update dev300-m57
[ooovba.git] / sw / inc / unofield.hxx
blob845b9f385a48b5dcfa51a610c1082b1e9d5cc69e
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: unofield.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 _UNOFIELD_HXX
31 #define _UNOFIELD_HXX
33 #include <com/sun/star/text/XDependentTextField.hpp>
34 #include <com/sun/star/util/XRefreshable.hpp>
35 #include <com/sun/star/util/XUpdatable.hpp>
36 #include <calbck.hxx>
37 #include <unoobj.hxx>
38 #include <unocoll.hxx>
39 #include <RefreshListenerContainer.hxx>
41 class SwFieldType;
42 class SwDoc;
43 class SwFmtFld;
44 class SwField;
45 class SwSetExpField;
46 class String;
47 class SwTextAPIObject;
49 /* -----------------04.12.98 12:49-------------------
51 * --------------------------------------------------*/
52 class SwXFieldMaster : public cppu::WeakImplHelper4
54 ::com::sun::star::beans::XPropertySet,
55 ::com::sun::star::lang::XServiceInfo,
56 ::com::sun::star::lang::XUnoTunnel,
57 ::com::sun::star::lang::XComponent
59 public SwClient
61 SwEventListenerContainer aLstnrCntnr;
62 sal_uInt16 nResTypeId;
63 SwDoc* m_pDoc;
65 sal_Bool m_bIsDescriptor;
67 String sParam1; //Content / Database / NumberingSeparator
68 String sParam2; // - /DataTablename
69 String sParam3; // - /DataFieldName
70 String sParam4;
71 String sParam5; // - /DataBaseURL
72 String sParam6; // - /DataBaseResource
73 double fParam1; // Value / -
74 sal_Int8 nParam1; // ChapterNumberingLevel
75 sal_Bool bParam1; // IsExpression
76 sal_Int32 nParam2;
78 protected:
79 virtual ~SwXFieldMaster();
80 public:
82 SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId);
83 SwXFieldMaster(SwFieldType& rType, SwDoc* pDoc);
86 TYPEINFO();
88 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
90 //XUnoTunnel
91 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
93 //XPropertySet
94 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
95 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);
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 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);
98 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);
99 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);
100 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);
102 //XComponent
103 virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
104 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
105 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
107 //XServiceInfo
108 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
109 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
110 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
112 //SwClient
113 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
115 static rtl::OUString GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc);
116 static rtl::OUString LocalizeFormula(const SwSetExpField& rFld, const rtl::OUString& rFormula, sal_Bool bQuery);
118 SwFieldType* GetFldType(sal_Bool bDontCreate = sal_False) const;
119 SwDoc* GetDoc() {return m_pDoc;}
121 sal_Bool IsDescriptor()const {return m_bIsDescriptor;}
122 sal_uInt16 GetResId() const {return nResTypeId;}
125 /* -----------------04.12.98 12:49-------------------
127 * --------------------------------------------------*/
128 struct SwFieldProperties_Impl;
129 class SwXTextField : public cppu::WeakImplHelper5
131 ::com::sun::star::text::XDependentTextField,
132 ::com::sun::star::lang::XServiceInfo,
133 ::com::sun::star::beans::XPropertySet,
134 ::com::sun::star::lang::XUnoTunnel,
135 ::com::sun::star::util::XUpdatable
137 public SwClient
139 SwEventListenerContainer aLstnrCntnr;
140 const SwFmtFld* pFmtFld;
141 SwDoc* m_pDoc;
142 SwTextAPIObject* m_pTextObject;
144 sal_Bool m_bIsDescriptor;
145 SwClient m_aFieldTypeClient; // required to access field master of not yet inserted fields
146 sal_Bool m_bCallUpdate;
147 sal_uInt16 m_nServiceId;
148 SwFieldProperties_Impl* m_pProps;
149 String m_sTypeName;
152 //SwFieldType* GetFldType() const { return (SwFieldType*)GetRegisteredIn(); }
153 SwDoc* GetDoc() {return m_pDoc;}
154 protected:
155 virtual ~SwXTextField();
156 public:
157 SwXTextField(sal_uInt16 nServiceId, SwDoc* pDoc=0);
158 SwXTextField(const SwFmtFld& rFmt, SwDoc* pDoc);
161 TYPEINFO();
163 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
165 //XUnoTunnel
166 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
168 //XDependentTextField
169 virtual void SAL_CALL attachTextFieldMaster(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xFieldMaster) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
170 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL getTextFieldMaster(void) throw( ::com::sun::star::uno::RuntimeException );
172 //XTextField
173 virtual rtl::OUString SAL_CALL getPresentation(sal_Bool bShowCommand) throw( ::com::sun::star::uno::RuntimeException );
175 //XTextContent
176 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 );
177 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(void) throw( ::com::sun::star::uno::RuntimeException );
179 //XComponent
180 virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
181 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
182 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
184 //XPropertySet
185 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
186 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);
187 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);
188 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);
189 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);
190 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);
191 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);
193 //XServiceInfo
194 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
195 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
196 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
198 //XUpdatable
199 virtual void SAL_CALL update( ) throw (::com::sun::star::uno::RuntimeException);
201 //SwClient
202 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
204 void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
206 const SwField* GetField() const;
207 const SwFmtFld* GetFldFmt(){return GetField() ? pFmtFld : 0; };
209 void Invalidate();
211 /* -----------------21.12.98 10:26-------------------
213 * --------------------------------------------------*/
214 typedef
215 cppu::WeakImplHelper2
217 ::com::sun::star::container::XNameAccess,
218 ::com::sun::star::lang::XServiceInfo
220 SwXTextFieldMastersBaseClass;
221 class SwXTextFieldMasters : public SwXTextFieldMastersBaseClass,
222 public SwUnoCollection
224 protected:
225 virtual ~SwXTextFieldMasters();
226 public:
227 SwXTextFieldMasters(SwDoc* pDoc);
230 //XNameAccess
231 virtual ::com::sun::star::uno::Any SAL_CALL getByName(const rtl::OUString& Name) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
232 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException );
233 virtual sal_Bool SAL_CALL hasByName(const rtl::OUString& Name) throw( ::com::sun::star::uno::RuntimeException );
235 //XElementAccess
236 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
237 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
239 //XServiceInfo
240 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
241 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
242 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
245 static sal_Bool getInstanceName(const SwFieldType& rFldType, String& rName);
248 /* -----------------21.12.98 10:26-------------------
250 * --------------------------------------------------*/
251 typedef
252 cppu::WeakImplHelper3
254 ::com::sun::star::container::XEnumerationAccess,
255 ::com::sun::star::lang::XServiceInfo,
256 ::com::sun::star::util::XRefreshable
258 SwXTextFieldTypesBaseClass;
259 class SwXTextFieldTypes : public SwXTextFieldTypesBaseClass,
260 public SwUnoCollection
262 SwRefreshListenerContainer aRefreshCont;
263 protected:
264 virtual ~SwXTextFieldTypes();
265 public:
266 SwXTextFieldTypes(SwDoc* pDoc);
269 //XEnumerationAccess
270 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
272 //XElementAccess
273 virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
274 virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
276 // ::com::sun::star::util::XRefreshable
277 virtual void SAL_CALL refresh( ) throw(::com::sun::star::uno::RuntimeException);
278 virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
279 virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
281 //XServiceInfo
282 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
283 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
284 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
286 // SwUnoCollection
287 virtual void Invalidate();
290 /* -----------------21.12.98 14:49-------------------
292 * --------------------------------------------------*/
293 class SwXFieldEnumeration : public cppu::WeakImplHelper2
295 ::com::sun::star::container::XEnumeration,
296 ::com::sun::star::lang::XServiceInfo
298 public SwClient
300 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > > aItems;
301 sal_Int32 nNextIndex; // index of next element to be returned
303 SwDoc* pDoc;
305 protected:
306 virtual ~SwXFieldEnumeration();
307 public:
308 SwXFieldEnumeration(SwDoc* pDoc);
310 //XEnumeration
311 virtual BOOL SAL_CALL hasMoreElements(void) throw( ::com::sun::star::uno::RuntimeException );
312 virtual ::com::sun::star::uno::Any SAL_CALL nextElement(void) throw( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
314 //XServiceInfo
315 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
316 virtual BOOL SAL_CALL supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
317 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
319 //SwClient
320 virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
322 #endif