1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoport.hxx,v $
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 ************************************************************************/
32 #include <unoevtlstnr.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>
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>
55 /* -----------------29.05.98 14:42-------------------
57 * --------------------------------------------------*/
58 enum SwTextPortionType
65 PORTION_REFMARK_START
,
67 PORTION_TOXMARK_START
,
69 PORTION_BOOKMARK_START
,
71 PORTION_REDLINE_START
,
75 PORTION_SOFT_PAGEBREAK
,
78 PORTION_FIELD_START_END
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
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
;
113 SwTextPortionType ePortionType
;
114 sal_Int16 nControlChar
;
118 SwFmtFld
* GetFldFmt(BOOL bInit
= sal_False
);
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
,
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();
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
);
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);
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
);
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
);
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
);
181 virtual rtl::OUString SAL_CALL
getPresentation(BOOL bShowCommand
) throw( ::com::sun::star::uno::RuntimeException
);
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
);
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
);
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
);
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
);
206 virtual void Modify( SfxPoolItem
*pOld
, SfxPoolItem
*pNew
);
208 void SetRefMark( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextContent
> xMark
)
211 void SetTOXMark( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextContent
> xMark
)
214 void SetBookmark( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextContent
> xMark
)
217 void SetFootnote( ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextContent
> 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
235 SwXRubyPortion(const SwUnoCrsr
* pPortionCrsr
,
237 ::com::sun::star::uno::Reference
< ::com::sun::star::text::XText
> & rParent
,