xref: /aoo41x/main/sw/inc/unoredline.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _UNOREDLINE_HXX
28 #define _UNOREDLINE_HXX
29 
30 #include <unoport.hxx>
31 #include <unotext.hxx>
32 
33 
34 class SwRedline;
35 
36 /* -----------------------------19.12.00 11:35--------------------------------
37 
38  ---------------------------------------------------------------------------*/
39 
40 /**
41  * SwXRedlineText provides an XText which may be used to write
42  * directly into a redline node. It got implemented to enable XML
43  * import of redlines and should not be used directly via the API.
44  */
45 class SwXRedlineText :
46 	public SwXText,
47 	public cppu::OWeakObject,
48 	public ::com::sun::star::container::XEnumerationAccess
49 {
50 	SwNodeIndex aNodeIndex;
51 	virtual const SwStartNode *GetStartNode() const;
52 
53 public:
54 	SwXRedlineText(SwDoc* pDoc, SwNodeIndex aNodeIndex);
55 
56     virtual 	::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
57     virtual void SAL_CALL acquire(  ) throw(){OWeakObject::acquire();}
58     virtual void SAL_CALL release(  ) throw(){OWeakObject::release();}
59 
60 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
61     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
62 
63 	//XText
64 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >  SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
65 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >  SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
66 
67 	//XEnumerationAccess
68 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >  SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
69 
70 	//XElementAccess (via XEnumerationAccess)
71     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
72     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
73 };
74 /* ---------------------------------------------------------------------------
75 
76  ---------------------------------------------------------------------------*/
77 class SwXRedlinePortion : public SwXTextPortion
78 {
79 	const SwRedline*	pRedline;
80 
81 	void Validate() throw( ::com::sun::star::uno::RuntimeException );
82 
83     using SwXTextPortion::GetPropertyValue;
84 
85 public:
86 	SwXRedlinePortion(	const SwRedline* pRed,
87 						const SwUnoCrsr* pPortionCrsr,
88 						::com::sun::star::uno::Reference< ::com::sun::star::text::XText >  xParent,
89 						sal_Bool bIsStart);
90 
91 	~SwXRedlinePortion();
92 
93     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
94 
95 	//XPropertySet
96 	virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
97 
98 	static ::com::sun::star::uno::Any  GetPropertyValue( const ::rtl::OUString& PropertyName, const SwRedline& rRedline ) throw();
99     static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > CreateRedlineProperties( const SwRedline& rRedline, sal_Bool bIsStart ) throw();
100 
101 };
102 /* -----------------------------11.01.01 16:52--------------------------------
103 
104  ---------------------------------------------------------------------------*/
105 typedef
106 cppu::WeakImplHelper1
107 <
108 	::com::sun::star::container::XEnumerationAccess
109 >
110 SwXRedlineBaseClass;
111 class SwXRedline :
112 		public SwXRedlineBaseClass,
113 		public SwXText,
114 		public SwClient
115 {
116 	SwDoc* 		pDoc;
117 	SwRedline* 	pRedline;
118 public:
119 	SwXRedline(SwRedline& rRedline, SwDoc& rDoc);
120 	~SwXRedline();
121 
122 	TYPEINFO();
123 
124 	virtual 	::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
125     virtual void SAL_CALL acquire(  ) throw(){OWeakObject::acquire();}
126     virtual void SAL_CALL release(  ) throw(){OWeakObject::release();}
127 
128 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
129     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
130 
131 	//XText
132 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >  SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
133 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >  SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
134 
135 	//XPropertySet
136     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
137     virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
138     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
139     virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
140     virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
141     virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
142     virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
143 
144 	//XEnumerationAccess
145 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >  SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
146 
147 	//XElementAccess
148     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
149     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
150 
151 	const SwRedline* 	GetRedline() const {return pRedline;}
152 protected:
153 	//SwClient
154    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
155 };
156 #endif
157