Update to m13
[ooovba.git] / sw / inc / unoport.hxx
blob551120ea478a8fc3b7efae08cef3f1bc17f2c8e4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoport.hxx,v $
10 * $Revision: 1.20 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _UNOPORT_HXX
31 #define _UNOPORT_HXX
32 #include <unoevtlstnr.hxx>
33 #include <calbck.hxx>
34 #include <cppuhelper/implbase6.hxx>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/text/XTextRange.hpp>
37 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
38 #include <com/sun/star/container/XEnumerationAccess.hpp>
39 #include <com/sun/star/beans/XPropertyState.hpp>
40 #include <com/sun/star/beans/XMultiPropertySet.hpp>
41 //#ifndef _COM_SUN_STAR_BEANS_XTOLERANTMULTIPROPERTYSET_HPP_
42 //#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
43 //#endif
44 #include <com/sun/star/text/XTextField.hpp>
45 #include <com/sun/star/lang/XServiceInfo.hpp>
46 #include <com/sun/star/lang/XUnoTunnel.hpp>
47 #include <cppuhelper/implbase8.hxx>
48 #include <cppuhelper/implbase9.hxx>
49 #include <svtools/itemprop.hxx>
51 class SwFmtFld;
52 class SwFrmFmt;
53 class SwUnoCrsr;
54 class SwTxtRuby;
55 /* -----------------29.05.98 14:42-------------------
57 * --------------------------------------------------*/
58 enum SwTextPortionType
60 PORTION_TEXT,
61 PORTION_FIELD,
62 PORTION_FRAME,
63 PORTION_FOOTNOTE,
64 PORTION_CONTROL_CHAR,
65 PORTION_REFMARK_START,
66 PORTION_REFMARK_END,
67 PORTION_TOXMARK_START,
68 PORTION_TOXMARK_END,
69 PORTION_BOOKMARK_START,
70 PORTION_BOOKMARK_END,
71 PORTION_REDLINE_START,
72 PORTION_REDLINE_END,
73 PORTION_RUBY_START,
74 PORTION_RUBY_END,
75 PORTION_SOFT_PAGEBREAK,
76 PORTION_FIELD_START,
77 PORTION_FIELD_END,
78 PORTION_FIELD_START_END
81 class SwXRubyPortion;
83 class SwXTextPortion : public cppu::WeakImplHelper8
85 // ::com::sun::star::beans::XTolerantMultiPropertySet,
86 ::com::sun::star::beans::XMultiPropertySet,
87 ::com::sun::star::beans::XPropertySet,
88 ::com::sun::star::text::XTextRange,
89 ::com::sun::star::text::XTextField,
90 ::com::sun::star::beans::XPropertyState,
91 ::com::sun::star::container::XContentEnumerationAccess,
92 ::com::sun::star::lang::XUnoTunnel,
93 ::com::sun::star::lang::XServiceInfo
95 public SwClient
97 friend class SwXRubyPortion;
98 SwEventListenerContainer aLstnrCntnr;
99 SfxItemPropertySet aPropSet;
100 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
101 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xRefMark;
102 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xTOXMark;
103 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xBookmark;
104 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xFootnote;
105 ::com::sun::star::uno::Any* pRubyText;
106 ::com::sun::star::uno::Any* pRubyStyle;
107 ::com::sun::star::uno::Any* pRubyAdjust;
108 ::com::sun::star::uno::Any* pRubyIsAbove;
110 const SwFmtFld* pFmtFld;
111 SwDepend aFrameDepend;
112 SwFrmFmt* pFrameFmt;
113 SwTextPortionType ePortionType;
114 sal_Int16 nControlChar;
116 BOOL bIsCollapsed;
118 SwFmtFld* GetFldFmt(BOOL bInit = sal_False);
119 protected:
120 SfxItemPropertySet& GetPropSet() { return aPropSet; }
122 void SAL_CALL SetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) 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);
123 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL GetPropertyValues_Impl( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
125 // ::com::sun::star::uno::Any GetPropertyValue( const SfxItemPropertyMap *pEntry,
126 // SwUnoCrsr *pUnoCrsr,
127 // SfxItemSet *pSet );
128 void GetPropertyValues( const ::rtl::OUString *pPropertyNames,
129 ::com::sun::star::uno::Any *pValues,
130 sal_Int32 nLength );
132 void GetPropertyValue( ::com::sun::star::uno::Any &rVal,
133 const SfxItemPropertyMap *pEntry, SwUnoCrsr *pUnoCrsr, SfxItemSet *&pSet );
135 // ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL GetPropertyValuesTolerant_Impl(
136 // const ::com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames,
137 // sal_Bool bDirectValuesOnly ) throw (::com::sun::star::uno::RuntimeException);
139 virtual ~SwXTextPortion();
140 public:
141 SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > & rParent, SwTextPortionType eType );
142 SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > & rParent, SwFrmFmt& rFmt );
145 //XTextRange
146 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText(void) throw( ::com::sun::star::uno::RuntimeException );
147 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart(void) throw( ::com::sun::star::uno::RuntimeException );
148 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd(void) throw( ::com::sun::star::uno::RuntimeException );
149 virtual rtl::OUString SAL_CALL getString(void) throw( ::com::sun::star::uno::RuntimeException );
150 virtual void SAL_CALL setString(const rtl::OUString& aString) throw( ::com::sun::star::uno::RuntimeException );
152 //XTolerantMultiPropertySet
153 // virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL setPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
154 // virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
155 // virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
157 //XMultiPropertySet
158 // virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
159 virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
160 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
161 virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
162 virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
163 virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
165 //XPropertySet
166 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
167 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);
168 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);
169 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);
170 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);
171 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);
172 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);
174 //XPropertyState
175 virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
176 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
177 virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
178 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
180 //XTextField
181 virtual rtl::OUString SAL_CALL getPresentation(BOOL bShowCommand) throw( ::com::sun::star::uno::RuntimeException );
183 //XTextContent
184 virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
185 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
187 //XComponent
188 virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
189 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
190 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
192 //XUnoTunnel
193 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
194 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
196 //XServiceInfo
197 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
198 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
199 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
201 //XContentEnumerationAccess
202 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createContentEnumeration(const rtl::OUString& aServiceName) throw( ::com::sun::star::uno::RuntimeException );
203 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getAvailableServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
205 //SwClient
206 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
208 void SetRefMark( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xMark)
209 {xRefMark = xMark;}
211 void SetTOXMark( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xMark)
212 {xTOXMark = xMark;}
214 void SetBookmark( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xMark)
215 {xBookmark = xMark;}
217 void SetFootnote( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > xMark)
218 {xFootnote = xMark;}
220 void SetControlChar(sal_Int16 nSet) {nControlChar = nSet;}
222 BOOL IsCollapsed() const { return bIsCollapsed;}
223 void SetCollapsed(BOOL bSet) { bIsCollapsed = bSet;}
225 SwTextPortionType GetTextPortionType() const {return ePortionType;}
227 SwUnoCrsr* GetCrsr() const { return (SwUnoCrsr*)GetRegisteredIn(); }
229 /* -----------------------------19.02.01 10:46--------------------------------
231 ---------------------------------------------------------------------------*/
232 class SwXRubyPortion : public SwXTextPortion
234 public:
235 SwXRubyPortion(const SwUnoCrsr* pPortionCrsr,
236 SwTxtRuby& rAttr,
237 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > & rParent,
238 sal_Bool bEnd );
239 ~SwXRubyPortion();
241 #endif