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: fielduno.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 ************************************************************************/
31 #ifndef SC_FIELDUNO_HXX
32 #define SC_FIELDUNO_HXX
35 #include "global.hxx" // ScRange, ScAddress
37 #ifndef SC_MUTEXHLP_HXX
38 #include "mutexhlp.hxx"
41 #ifndef _SFXLSTNER_HXX //autogen
42 #include <bf_svtools/lstner.hxx>
44 #ifndef _SFX_ITEMPROP_HXX
45 #include <bf_svtools/itemprop.hxx>
47 #ifndef _MyEDITDATA_HXX //autogen
48 #include <bf_svx/editdata.hxx>
51 #ifndef _COM_SUN_STAR_TEXT_XTEXTFIELD_HPP_
52 #include <com/sun/star/text/XTextField.hpp>
54 #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
55 #include <com/sun/star/lang/XServiceInfo.hpp>
57 #ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
58 #include <com/sun/star/container/XContainer.hpp>
60 #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
61 #include <com/sun/star/lang/XUnoTunnel.hpp>
63 #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
64 #include <com/sun/star/container/XEnumerationAccess.hpp>
66 #ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
67 #include <com/sun/star/container/XIndexAccess.hpp>
69 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
70 #include <com/sun/star/beans/XPropertySet.hpp>
72 #ifndef _COM_SUN_STAR_UTIL_XREFRESHABLE_HPP_
73 #include <com/sun/star/util/XRefreshable.hpp>
76 #ifndef _CPPUHELPER_COMPONENT_HXX_
77 #include <cppuhelper/component.hxx>
79 #ifndef _CPPUHELPER_IMPLBASE5_HXX_
80 #include <cppuhelper/implbase5.hxx>
82 #ifndef _OSL_MUTEX_HXX_
83 #include <osl/mutex.hxx>
90 class ScHeaderFieldObj
;
91 class ScHeaderFooterContentObj
;
94 //------------------------------------------------------------------
97 class ScCellFieldsObj
: public cppu::WeakImplHelper5
<
98 ::com::sun::star::container::XEnumerationAccess
,
99 ::com::sun::star::container::XIndexAccess
,
100 ::com::sun::star::container::XContainer
,
101 ::com::sun::star::util::XRefreshable
,
102 ::com::sun::star::lang::XServiceInfo
>,
106 ScDocShell
* pDocShell
;
108 SvxEditSource
* pEditSource
;
109 /// List of refresh listeners.
110 cppu::OInterfaceContainerHelper
* mpRefreshListeners
;
111 /// mutex to lock the InterfaceContainerHelper
114 ScCellFieldObj
* GetObjectByIndex_Impl(INT32 Index
) const;
117 ScCellFieldsObj(ScDocShell
* pDocSh
, const ScAddress
& rPos
);
118 virtual ~ScCellFieldsObj();
120 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
123 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
);
124 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
125 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
126 ::com::sun::star::lang::WrappedTargetException
,
127 ::com::sun::star::uno::RuntimeException
);
129 // XEnumerationAccess
130 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
131 createEnumeration() throw(::com::sun::star::uno::RuntimeException
);
134 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
135 throw(::com::sun::star::uno::RuntimeException
);
136 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
139 virtual void SAL_CALL
addContainerListener( const ::com::sun::star::uno::Reference
<
140 ::com::sun::star::container::XContainerListener
>& xListener
)
141 throw(::com::sun::star::uno::RuntimeException
);
142 virtual void SAL_CALL
removeContainerListener( const ::com::sun::star::uno::Reference
<
143 ::com::sun::star::container::XContainerListener
>& xListener
)
144 throw(::com::sun::star::uno::RuntimeException
);
147 virtual void SAL_CALL
refresh( )
148 throw (::com::sun::star::uno::RuntimeException
);
149 virtual void SAL_CALL
addRefreshListener( const ::com::sun::star::uno::Reference
<
150 ::com::sun::star::util::XRefreshListener
>& l
)
151 throw (::com::sun::star::uno::RuntimeException
);
152 virtual void SAL_CALL
removeRefreshListener( const ::com::sun::star::uno::Reference
<
153 ::com::sun::star::util::XRefreshListener
>& l
)
154 throw (::com::sun::star::uno::RuntimeException
);
157 virtual ::rtl::OUString SAL_CALL
getImplementationName()
158 throw(::com::sun::star::uno::RuntimeException
);
159 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
160 throw(::com::sun::star::uno::RuntimeException
);
161 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
162 throw(::com::sun::star::uno::RuntimeException
);
166 class ScCellFieldObj
: public ScMutexHelper
,
167 public ::cppu::OComponentHelper
,
168 public ::com::sun::star::text::XTextField
,
169 public ::com::sun::star::beans::XPropertySet
,
170 public ::com::sun::star::lang::XUnoTunnel
,
171 public ::com::sun::star::lang::XServiceInfo
,
175 SfxItemPropertySet aPropSet
;
176 ScDocShell
* pDocShell
;
178 SvxEditSource
* pEditSource
;
179 ESelection aSelection
;
181 String aUrl
; // Inhalt, wenn noch nicht eingefuegt (nur dann!)
182 String aRepresentation
;
186 ScCellFieldObj(ScDocShell
* pDocSh
, const ScAddress
& rPos
,
187 const ESelection
& rSel
);
188 virtual ~ScCellFieldObj();
190 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
192 // per getImplementation gerufen:
194 BOOL
IsInserted() const { return pEditSource
!= NULL
; }
195 SvxFieldItem
CreateFieldItem();
196 void InitDoc( ScDocShell
* pDocSh
, const ScAddress
& rPos
,
197 const ESelection
& rSel
);
199 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation(
200 const ::com::sun::star::uno::Type
& rType
)
201 throw(::com::sun::star::uno::RuntimeException
);
202 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
203 const ::com::sun::star::uno::Type
& rType
)
204 throw(::com::sun::star::uno::RuntimeException
);
205 virtual void SAL_CALL
acquire() throw();
206 virtual void SAL_CALL
release() throw();
209 virtual ::rtl::OUString SAL_CALL
getPresentation( sal_Bool bShowCommand
)
210 throw(::com::sun::star::uno::RuntimeException
);
213 virtual void SAL_CALL
attach( const ::com::sun::star::uno::Reference
<
214 ::com::sun::star::text::XTextRange
>& xTextRange
)
215 throw(::com::sun::star::lang::IllegalArgumentException
,
216 ::com::sun::star::uno::RuntimeException
);
217 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> SAL_CALL
218 getAnchor() throw(::com::sun::star::uno::RuntimeException
);
221 virtual void SAL_CALL
dispose() throw(::com::sun::star::uno::RuntimeException
);
222 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
<
223 ::com::sun::star::lang::XEventListener
>& xListener
)
224 throw(::com::sun::star::uno::RuntimeException
);
225 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
<
226 ::com::sun::star::lang::XEventListener
>& aListener
)
227 throw(::com::sun::star::uno::RuntimeException
);
230 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
231 SAL_CALL
getPropertySetInfo()
232 throw(::com::sun::star::uno::RuntimeException
);
233 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
234 const ::com::sun::star::uno::Any
& aValue
)
235 throw(::com::sun::star::beans::UnknownPropertyException
,
236 ::com::sun::star::beans::PropertyVetoException
,
237 ::com::sun::star::lang::IllegalArgumentException
,
238 ::com::sun::star::lang::WrappedTargetException
,
239 ::com::sun::star::uno::RuntimeException
);
240 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
241 const ::rtl::OUString
& PropertyName
)
242 throw(::com::sun::star::beans::UnknownPropertyException
,
243 ::com::sun::star::lang::WrappedTargetException
,
244 ::com::sun::star::uno::RuntimeException
);
245 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
246 const ::com::sun::star::uno::Reference
<
247 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
248 throw(::com::sun::star::beans::UnknownPropertyException
,
249 ::com::sun::star::lang::WrappedTargetException
,
250 ::com::sun::star::uno::RuntimeException
);
251 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
252 const ::com::sun::star::uno::Reference
<
253 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
254 throw(::com::sun::star::beans::UnknownPropertyException
,
255 ::com::sun::star::lang::WrappedTargetException
,
256 ::com::sun::star::uno::RuntimeException
);
257 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
258 const ::com::sun::star::uno::Reference
<
259 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
260 throw(::com::sun::star::beans::UnknownPropertyException
,
261 ::com::sun::star::lang::WrappedTargetException
,
262 ::com::sun::star::uno::RuntimeException
);
263 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
264 const ::com::sun::star::uno::Reference
<
265 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
266 throw(::com::sun::star::beans::UnknownPropertyException
,
267 ::com::sun::star::lang::WrappedTargetException
,
268 ::com::sun::star::uno::RuntimeException
);
271 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
<
272 sal_Int8
>& aIdentifier
)
273 throw(::com::sun::star::uno::RuntimeException
);
275 static const ::com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId();
276 static ScCellFieldObj
* getImplementation( const ::com::sun::star::uno::Reference
<
277 ::com::sun::star::text::XTextContent
> xObj
);
280 virtual ::rtl::OUString SAL_CALL
getImplementationName()
281 throw(::com::sun::star::uno::RuntimeException
);
282 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
283 throw(::com::sun::star::uno::RuntimeException
);
284 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
285 throw(::com::sun::star::uno::RuntimeException
);
288 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
289 throw(::com::sun::star::uno::RuntimeException
);
290 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
291 throw(::com::sun::star::uno::RuntimeException
);
294 //------------------------------------------------------------------
296 class ScHeaderFieldsObj
: public cppu::WeakImplHelper5
<
297 ::com::sun::star::container::XEnumerationAccess
,
298 ::com::sun::star::container::XIndexAccess
,
299 ::com::sun::star::container::XContainer
,
300 ::com::sun::star::util::XRefreshable
,
301 ::com::sun::star::lang::XServiceInfo
>
304 ScHeaderFooterContentObj
* pContentObj
;
307 SvxEditSource
* pEditSource
;
309 /// List of refresh listeners.
310 cppu::OInterfaceContainerHelper
* mpRefreshListeners
;
311 /// mutex to lock the InterfaceContainerHelper
314 ScHeaderFieldObj
* GetObjectByIndex_Impl(INT32 Index
) const;
317 ScHeaderFieldsObj(ScHeaderFooterContentObj
* pContent
,
318 USHORT nP
, USHORT nT
);
319 virtual ~ScHeaderFieldsObj();
322 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
);
323 virtual ::com::sun::star::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
)
324 throw(::com::sun::star::lang::IndexOutOfBoundsException
,
325 ::com::sun::star::lang::WrappedTargetException
,
326 ::com::sun::star::uno::RuntimeException
);
328 // XEnumerationAccess
329 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::container::XEnumeration
> SAL_CALL
330 createEnumeration() throw(::com::sun::star::uno::RuntimeException
);
333 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType()
334 throw(::com::sun::star::uno::RuntimeException
);
335 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
338 virtual void SAL_CALL
addContainerListener( const ::com::sun::star::uno::Reference
<
339 ::com::sun::star::container::XContainerListener
>& xListener
)
340 throw(::com::sun::star::uno::RuntimeException
);
341 virtual void SAL_CALL
removeContainerListener( const ::com::sun::star::uno::Reference
<
342 ::com::sun::star::container::XContainerListener
>& xListener
)
343 throw(::com::sun::star::uno::RuntimeException
);
346 virtual void SAL_CALL
refresh( )
347 throw (::com::sun::star::uno::RuntimeException
);
348 virtual void SAL_CALL
addRefreshListener( const ::com::sun::star::uno::Reference
<
349 ::com::sun::star::util::XRefreshListener
>& l
)
350 throw (::com::sun::star::uno::RuntimeException
);
351 virtual void SAL_CALL
removeRefreshListener( const ::com::sun::star::uno::Reference
<
352 ::com::sun::star::util::XRefreshListener
>& l
)
353 throw (::com::sun::star::uno::RuntimeException
);
356 virtual ::rtl::OUString SAL_CALL
getImplementationName()
357 throw(::com::sun::star::uno::RuntimeException
);
358 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
359 throw(::com::sun::star::uno::RuntimeException
);
360 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
361 throw(::com::sun::star::uno::RuntimeException
);
365 class ScHeaderFieldObj
: public ScMutexHelper
,
366 public ::cppu::OComponentHelper
,
367 public ::com::sun::star::text::XTextField
,
368 public ::com::sun::star::beans::XPropertySet
,
369 public ::com::sun::star::lang::XUnoTunnel
,
370 public ::com::sun::star::lang::XServiceInfo
373 SfxItemPropertySet aPropSet
;
374 ScHeaderFooterContentObj
* pContentObj
;
377 SvxEditSource
* pEditSource
;
378 ESelection aSelection
;
379 sal_Int16 nFileFormat
; // enum SvxFileFormat, valid if not inserted
382 ScHeaderFieldObj(ScHeaderFooterContentObj
* pContent
, USHORT nP
,
383 USHORT nT
, const ESelection
& rSel
);
384 virtual ~ScHeaderFieldObj();
386 // per getImplementation gerufen:
388 BOOL
IsInserted() const { return pEditSource
!= NULL
; }
389 SvxFieldItem
CreateFieldItem();
390 void InitDoc( ScHeaderFooterContentObj
* pContent
, USHORT nP
,
391 const ESelection
& rSel
);
393 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation(
394 const ::com::sun::star::uno::Type
& rType
)
395 throw(::com::sun::star::uno::RuntimeException
);
396 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
397 const ::com::sun::star::uno::Type
& rType
)
398 throw(::com::sun::star::uno::RuntimeException
);
399 virtual void SAL_CALL
acquire() throw();
400 virtual void SAL_CALL
release() throw();
403 virtual ::rtl::OUString SAL_CALL
getPresentation( sal_Bool bShowCommand
)
404 throw(::com::sun::star::uno::RuntimeException
);
407 virtual void SAL_CALL
attach( const ::com::sun::star::uno::Reference
<
408 ::com::sun::star::text::XTextRange
>& xTextRange
)
409 throw(::com::sun::star::lang::IllegalArgumentException
,
410 ::com::sun::star::uno::RuntimeException
);
411 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::text::XTextRange
> SAL_CALL
412 getAnchor() throw(::com::sun::star::uno::RuntimeException
);
415 virtual void SAL_CALL
dispose() throw(::com::sun::star::uno::RuntimeException
);
416 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
<
417 ::com::sun::star::lang::XEventListener
>& xListener
)
418 throw(::com::sun::star::uno::RuntimeException
);
419 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
<
420 ::com::sun::star::lang::XEventListener
>& aListener
)
421 throw(::com::sun::star::uno::RuntimeException
);
424 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
>
425 SAL_CALL
getPropertySetInfo()
426 throw(::com::sun::star::uno::RuntimeException
);
427 virtual void SAL_CALL
setPropertyValue( const ::rtl::OUString
& aPropertyName
,
428 const ::com::sun::star::uno::Any
& aValue
)
429 throw(::com::sun::star::beans::UnknownPropertyException
,
430 ::com::sun::star::beans::PropertyVetoException
,
431 ::com::sun::star::lang::IllegalArgumentException
,
432 ::com::sun::star::lang::WrappedTargetException
,
433 ::com::sun::star::uno::RuntimeException
);
434 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue(
435 const ::rtl::OUString
& PropertyName
)
436 throw(::com::sun::star::beans::UnknownPropertyException
,
437 ::com::sun::star::lang::WrappedTargetException
,
438 ::com::sun::star::uno::RuntimeException
);
439 virtual void SAL_CALL
addPropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
440 const ::com::sun::star::uno::Reference
<
441 ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
442 throw(::com::sun::star::beans::UnknownPropertyException
,
443 ::com::sun::star::lang::WrappedTargetException
,
444 ::com::sun::star::uno::RuntimeException
);
445 virtual void SAL_CALL
removePropertyChangeListener( const ::rtl::OUString
& aPropertyName
,
446 const ::com::sun::star::uno::Reference
<
447 ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
448 throw(::com::sun::star::beans::UnknownPropertyException
,
449 ::com::sun::star::lang::WrappedTargetException
,
450 ::com::sun::star::uno::RuntimeException
);
451 virtual void SAL_CALL
addVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
452 const ::com::sun::star::uno::Reference
<
453 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
454 throw(::com::sun::star::beans::UnknownPropertyException
,
455 ::com::sun::star::lang::WrappedTargetException
,
456 ::com::sun::star::uno::RuntimeException
);
457 virtual void SAL_CALL
removeVetoableChangeListener( const ::rtl::OUString
& PropertyName
,
458 const ::com::sun::star::uno::Reference
<
459 ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
460 throw(::com::sun::star::beans::UnknownPropertyException
,
461 ::com::sun::star::lang::WrappedTargetException
,
462 ::com::sun::star::uno::RuntimeException
);
465 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
<
466 sal_Int8
>& aIdentifier
)
467 throw(::com::sun::star::uno::RuntimeException
);
469 static const ::com::sun::star::uno::Sequence
<sal_Int8
>& getUnoTunnelId();
470 static ScHeaderFieldObj
* getImplementation( const ::com::sun::star::uno::Reference
<
471 ::com::sun::star::text::XTextContent
> xObj
);
474 virtual ::rtl::OUString SAL_CALL
getImplementationName()
475 throw(::com::sun::star::uno::RuntimeException
);
476 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
477 throw(::com::sun::star::uno::RuntimeException
);
478 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames()
479 throw(::com::sun::star::uno::RuntimeException
);
482 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
483 throw(::com::sun::star::uno::RuntimeException
);
484 virtual ::com::sun::star::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
485 throw(::com::sun::star::uno::RuntimeException
);
488 } //namespace binfilter