AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
propshlp.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 
4 #ifndef INCLUDED_CPPUHELPER_PROPSHLP_HXX
5 #define INCLUDED_CPPUHELPER_PROPSHLP_HXX
6 
7 #include "rtl/alloc.h"
8 
10 
11 #include "com/sun/star/beans/XPropertySet.hpp"
12 #include "com/sun/star/beans/XPropertySetOption.hpp"
13 #include "com/sun/star/beans/XMultiPropertySet.hpp"
14 #include "com/sun/star/beans/XFastPropertySet.hpp"
15 
17 
18 
19 namespace cppu
20 {
21 
22 
23 /*************************************************************************
24 *************************************************************************/
25 
26 
31 {
32 public:
33  // these are here to force memory de/allocation to sal lib.
34  static void * SAL_CALL operator new( size_t nSize )
35  { return ::rtl_allocateMemory( nSize ); }
36  static void SAL_CALL operator delete( void * pMem )
37  { ::rtl_freeMemory( pMem ); }
38  static void * SAL_CALL operator new( size_t, void * pMem )
39  { return pMem; }
40  static void SAL_CALL operator delete( void *, void * )
41  {}
42 
46  virtual ~IPropertyArrayHelper();
47 
59  virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
60  ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) = 0;
64  virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() = 0;
70  virtual css::beans::Property SAL_CALL getPropertyByName(
71  const ::rtl::OUString& rPropertyName ) = 0;
76  virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) = 0;
82  virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) = 0;
88  virtual sal_Int32 SAL_CALL fillHandles(
89  /*out*/ sal_Int32 * pHandles, const css::uno::Sequence< ::rtl::OUString > & rPropNames ) = 0;
90 };
91 
97 {
98 public:
108  css::beans::Property *pProps,
109  sal_Int32 nElements ,
110  sal_Bool bSorted = true );
111 
119  const css::uno::Sequence< css::beans::Property > & aProps,
120  sal_Bool bSorted = true );
121 
125  sal_Int32 SAL_CALL getCount() const;
138  virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
139  ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) SAL_OVERRIDE;
143  virtual css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() SAL_OVERRIDE;
149  virtual css::beans::Property SAL_CALL getPropertyByName(
150  const ::rtl::OUString& rPropertyName ) SAL_OVERRIDE;
155  virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) SAL_OVERRIDE;
161  virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) SAL_OVERRIDE;
167  virtual sal_Int32 SAL_CALL fillHandles(
168  /*out*/sal_Int32 * pHandles, const css::uno::Sequence< ::rtl::OUString > & rPropNames ) SAL_OVERRIDE;
169 
170 protected:
173  void * m_pReserved;
174 
175 private:
176  void init( sal_Bool bSorted );
177 
179  css::uno::Sequence< css::beans::Property > aInfos;
180 
185  sal_Bool bRightOrdered;
186 };
187 
188 
189 // helper defines needed for an interface container with a 32 bit key values
190 
192 {
193  bool operator()(const sal_Int32 & i1 , const sal_Int32 & i2) const
194  { return i1 == i2; }
195 };
196 
198 {
199  size_t operator()(const sal_Int32 & i) const
200  { return i; }
201 };
202 
207 {
208 public:
209  // these are here to force memory de/allocation to sal lib.
210  static void * SAL_CALL operator new( size_t nSize )
211  { return ::rtl_allocateMemory( nSize ); }
212  static void SAL_CALL operator delete( void * pMem )
213  { ::rtl_freeMemory( pMem ); }
214  static void * SAL_CALL operator new( size_t, void * pMem )
215  { return pMem; }
216  static void SAL_CALL operator delete( void *, void * )
217  {}
218 
231 
235  css::uno::Sequence< sal_Int32 > SAL_CALL getContainedTypes() const;
236 
242  OInterfaceContainerHelper * SAL_CALL getContainer( const sal_Int32 & rKey ) const;
243 
251  sal_Int32 SAL_CALL addInterface(
252  const sal_Int32 & rKey,
253  const css::uno::Reference< css::uno::XInterface > & r );
254 
262  sal_Int32 SAL_CALL removeInterface(
263  const sal_Int32 & rKey,
264  const css::uno::Reference< css::uno::XInterface > & rxIFace );
265 
270  void SAL_CALL disposeAndClear( const css::lang::EventObject & rEvt );
274  void SAL_CALL clear();
275 
276  typedef sal_Int32 keyType;
277 private:
278  void * m_pMap;
279  ::osl::Mutex & rMutex;
280 
282  OMultiTypeInterfaceContainerHelperInt32 & operator = ( const OMultiTypeInterfaceContainerHelperInt32 & )SAL_DELETED_FUNCTION;
283 };
284 
285 
289 {
290 public:
310  virtual void fireEvents(
311  sal_Int32 * pnHandles,
312  sal_Int32 nCount,
313  sal_Bool bVetoable,
314  bool bIgnoreRuntimeExceptionsWhileFiring) = 0;
315 
316 #if !defined _MSC_VER // public -> protected changes mangled names there
317 protected:
318 #endif
320  // avoid warnings about virtual members and non-virtual dtor
321 };
322 
323 
337  public css::beans::XMultiPropertySet,
338  public css::beans::XFastPropertySet,
339  public css::beans::XPropertySet
340 {
341 public:
348  OPropertySetHelper( OBroadcastHelper & rBHelper );
349 
369  OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring );
370 
393  OBroadcastHelper & rBHelper,
394  IEventNotificationHook *i_pFireEvents,
395  bool bIgnoreRuntimeExceptionsWhileFiring = false);
396 
401  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) SAL_OVERRIDE;
402 
407  css::uno::Sequence< css::uno::Type > getTypes();
408 
415  void SAL_CALL disposing();
416 
422  virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const css::uno::Any& aValue ) SAL_OVERRIDE;
427  virtual css::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName) SAL_OVERRIDE;
429  virtual void SAL_CALL addPropertyChangeListener(
430  const ::rtl::OUString& aPropertyName,
431  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener) SAL_OVERRIDE;
432 
434  virtual void SAL_CALL removePropertyChangeListener(
435  const ::rtl::OUString& aPropertyName,
436  const css::uno::Reference < css::beans::XPropertyChangeListener >& aListener) SAL_OVERRIDE;
437 
439  virtual void SAL_CALL addVetoableChangeListener(
440  const ::rtl::OUString& aPropertyName,
441  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener) SAL_OVERRIDE;
442 
444  virtual void SAL_CALL removeVetoableChangeListener(
445  const ::rtl::OUString& aPropertyName,
446  const css::uno::Reference< css::beans::XVetoableChangeListener > & aListener ) SAL_OVERRIDE;
447 
455  virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) SAL_OVERRIDE;
456 
461  virtual css::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) SAL_OVERRIDE;
462 
463  // XMultiPropertySet
464  virtual void SAL_CALL setPropertyValues(
465  const css::uno::Sequence< ::rtl::OUString >& PropertyNames,
466  const css::uno::Sequence< css::uno::Any >& Values ) SAL_OVERRIDE;
467 
468  virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(
469  const css::uno::Sequence< ::rtl::OUString >& PropertyNames ) SAL_OVERRIDE;
470 
471  virtual void SAL_CALL addPropertiesChangeListener(
472  const css::uno::Sequence< ::rtl::OUString >& PropertyNames,
473  const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) SAL_OVERRIDE;
474 
475  virtual void SAL_CALL removePropertiesChangeListener(
476  const css::uno::Reference< css::beans::XPropertiesChangeListener >& Listener ) SAL_OVERRIDE;
477 
478  virtual void SAL_CALL firePropertiesChangeEvent(
479  const css::uno::Sequence< ::rtl::OUString >& PropertyNames,
480  const css::uno::Reference< css::beans::XPropertiesChangeListener > & Listener ) SAL_OVERRIDE;
481 
485  static css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL
486  createPropertySetInfo( IPropertyArrayHelper & rProperties );
487 protected:
497  void SAL_CALL fire(
498  sal_Int32 * pnHandles,
499  const css::uno::Any * pNewValues,
500  const css::uno::Any * pOldValues,
501  sal_Int32 nCount,
502  sal_Bool bVetoable );
503 
513  void SAL_CALL setFastPropertyValues(
514  sal_Int32 nSeqLen,
515  sal_Int32 * pHandles,
516  const css::uno::Any * pValues,
517  sal_Int32 nHitCount );
518 
523  virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
524 
540  virtual sal_Bool SAL_CALL convertFastPropertyValue(
541  css::uno::Any & rConvertedValue,
542  css::uno::Any & rOldValue,
543  sal_Int32 nHandle,
544  const css::uno::Any& rValue ) = 0;
545 
565  virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
566  sal_Int32 nHandle,
567  const css::uno::Any& rValue ) = 0;
573  virtual void SAL_CALL getFastPropertyValue(
574  css::uno::Any& rValue,
575  sal_Int32 nHandle ) const = 0;
576 
595  void setDependentFastPropertyValue(
596  sal_Int32 i_handle,
597  const css::uno::Any& i_value
598  );
599 
610 
611  class Impl;
612 
615  Impl * const m_pReserved;
616 
617 private:
619  OPropertySetHelper & operator = ( const OPropertySetHelper & )
620  SAL_DELETED_FUNCTION;
621 
625  void impl_fireAll(
626  sal_Int32* i_handles,
627  const css::uno::Any * i_newValues,
628  const css::uno::Any * i_oldValues,
629  sal_Int32 i_count
630  );
631 
632 #if defined _MSC_VER // public -> protected changes mangled names there
633 public:
634 #else
635 protected:
636 #endif
637 
641 };
642 
651  public css::beans::XPropertySetOption
652 {
653 public:
658  explicit OPropertySetHelper2(
659  OBroadcastHelper & rBHelper,
660  IEventNotificationHook *i_pFireEvents = NULL,
661  bool bIgnoreRuntimeExceptionsWhileFiring = false);
662 
663  // XInterface
664  virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) SAL_OVERRIDE;
665 
666  // XPropertySetOption
667  virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable ) SAL_OVERRIDE;
668 
669 
670 private:
672  OPropertySetHelper2 & operator = ( const OPropertySetHelper2 & )
674 
675 #if defined _MSC_VER // public -> protected changes mangled names there
676 public:
677 #else
678 protected:
679 #endif
680 // Suppress warning about virtual functions but non-virtual destructor:
684  virtual ~OPropertySetHelper2();
685 };
686 
687 } // end namespace cppuhelper
688 #endif
689 
690 
691 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OPropertySetHelper plus XPropertySetOption.
Definition: propshlp.hxx:650
Impl *const m_pReserved
reserved for future use.
Definition: propshlp.hxx:611
void * m_pReserved
reserved for future use.
Definition: propshlp.hxx:173
unsigned char sal_Bool
Definition: types.h:18
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
OBroadcastHelper & rBHelper
The common data of a broadcaster.
Definition: propshlp.hxx:601
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:182
Specialized class for key type sal_Int32, without explicit usage of STL symbols.
Definition: propshlp.hxx:206
Definition: propshlp.hxx:191
OMultiTypeInterfaceContainerHelperInt32 aBoundLC
Container for the XPropertyChangedListener.
Definition: propshlp.hxx:605
sal_Int32 keyType
Definition: propshlp.hxx:276
~IEventNotificationHook()
Definition: propshlp.hxx:319
This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet and XPrope...
Definition: propshlp.hxx:336
Definition: propshlp.hxx:197
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:567
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:12
css::uno::Any queryInterface(const css::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:23
A container of interfaces.
Definition: interfacecontainer.h:111
This interface is used by the OPropertyHelper, to access the property description.
Definition: propshlp.hxx:30
bool operator()(const sal_Int32 &i1, const sal_Int32 &i2) const
Definition: propshlp.hxx:193
You can use this helper class to map a XPropertySet-Interface to a XFast- or a XMultiPropertySet inte...
Definition: propshlp.hxx:96
OMultiTypeInterfaceContainerHelperInt32 aVetoableLC
Container for the XPropertyVetoableListener.
Definition: propshlp.hxx:609
A mutual exclusion synchronization object.
Definition: mutex.hxx:15
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
size_t operator()(const sal_Int32 &i) const
Definition: propshlp.hxx:199
#define SAL_OVERRIDE
C++11 &quot;override&quot; feature.
Definition: types.h:371
An interface to extend event notification actions.
Definition: propshlp.hxx:288
This struct contains the standard variables of a broadcaster.
Definition: interfacecontainer.h:419
#define SAL_DELETED_FUNCTION
short-circuit extra-verbose API namespaces
Definition: types.h:358