xref: /aoo42x/main/sw/inc/unoredline.hxx (revision 1d2dbeb0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _UNOREDLINE_HXX
24 #define _UNOREDLINE_HXX
25 
26 #include <unoport.hxx>
27 #include <unotext.hxx>
28 
29 
30 class SwRedline;
31 
32 /* -----------------------------19.12.00 11:35--------------------------------
33 
34  ---------------------------------------------------------------------------*/
35 
36 /**
37  * SwXRedlineText provides an XText which may be used to write
38  * directly into a redline node. It got implemented to enable XML
39  * import of redlines and should not be used directly via the API.
40  */
41 class SwXRedlineText :
42 	public SwXText,
43 	public cppu::OWeakObject,
44 	public ::com::sun::star::container::XEnumerationAccess
45 {
46 	SwNodeIndex aNodeIndex;
47 	virtual const SwStartNode *GetStartNode() const;
48 
49 public:
50 	SwXRedlineText(SwDoc* pDoc, SwNodeIndex aNodeIndex);
51 
52     virtual 	::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
acquire()53     virtual void SAL_CALL acquire(  ) throw(){OWeakObject::acquire();}
release()54     virtual void SAL_CALL release(  ) throw(){OWeakObject::release();}
55 
56 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
57     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
58 
59 	//XText
60 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >  SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
61 	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 );
62 
63 	//XEnumerationAccess
64 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >  SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
65 
66 	//XElementAccess (via XEnumerationAccess)
67     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
68     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
69 };
70 /* ---------------------------------------------------------------------------
71 
72  ---------------------------------------------------------------------------*/
73 class SwXRedlinePortion : public SwXTextPortion
74 {
75 	const SwRedline*	pRedline;
76 
77 	void Validate() throw( ::com::sun::star::uno::RuntimeException );
78 
79     using SwXTextPortion::GetPropertyValue;
80 
81 public:
82 	SwXRedlinePortion(	const SwRedline* pRed,
83 						const SwUnoCrsr* pPortionCrsr,
84 						::com::sun::star::uno::Reference< ::com::sun::star::text::XText >  xParent,
85 						sal_Bool bIsStart);
86 
87 	~SwXRedlinePortion();
88 
89     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
90 
91 	//XPropertySet
92 	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);
93 
94 	static ::com::sun::star::uno::Any  GetPropertyValue( const ::rtl::OUString& PropertyName, const SwRedline& rRedline ) throw();
95     static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > CreateRedlineProperties( const SwRedline& rRedline, sal_Bool bIsStart ) throw();
96 
97 };
98 /* -----------------------------11.01.01 16:52--------------------------------
99 
100  ---------------------------------------------------------------------------*/
101 typedef
102 cppu::WeakImplHelper1
103 <
104 	::com::sun::star::container::XEnumerationAccess
105 >
106 SwXRedlineBaseClass;
107 class SwXRedline :
108 		public SwXRedlineBaseClass,
109 		public SwXText,
110 		public SwClient
111 {
112 	SwDoc* 		pDoc;
113 	SwRedline* 	pRedline;
114 public:
115 	SwXRedline(SwRedline& rRedline, SwDoc& rDoc);
116 	~SwXRedline();
117 
118 	TYPEINFO();
119 
120 	virtual 	::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
acquire()121     virtual void SAL_CALL acquire(  ) throw(){OWeakObject::acquire();}
release()122     virtual void SAL_CALL release(  ) throw(){OWeakObject::release();}
123 
124 	virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes(  ) throw(::com::sun::star::uno::RuntimeException);
125     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
126 
127 	//XText
128 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor >  SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
129 	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 );
130 
131 	//XPropertySet
132     virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
133     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);
134     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);
135     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);
136     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);
137     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);
138     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);
139 
140 	//XEnumerationAccess
141 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >  SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
142 
143 	//XElementAccess
144     virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw(::com::sun::star::uno::RuntimeException);
145     virtual sal_Bool SAL_CALL hasElements(  ) throw(::com::sun::star::uno::RuntimeException);
146 
GetRedline() const147 	const SwRedline* 	GetRedline() const {return pRedline;}
148 protected:
149 	//SwClient
150    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
151 };
152 #endif
153