My Project
UDK 3.2.7 C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 
29 #ifndef _CPPUHELPER_PROPSHLP_HXX
30 #define _CPPUHELPER_PROPSHLP_HXX
31 
32 #include <rtl/alloc.h>
33 
35 
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/beans/XPropertySetOption.hpp>
38 #include <com/sun/star/beans/XMultiPropertySet.hpp>
39 #include <com/sun/star/beans/XFastPropertySet.hpp>
40 
41 #include <memory>
42 #include "cppuhelperdllapi.h"
43 
44 
45 namespace cppu
46 {
47 
48 
49 /*************************************************************************
50 *************************************************************************/
51 
52 
57 {
58 public:
59  // these are here to force memory de/allocation to sal lib.
60  inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
61  { return ::rtl_allocateMemory( nSize ); }
62  inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
63  { ::rtl_freeMemory( pMem ); }
64  inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
65  { return pMem; }
66  inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
67  {}
68 
72  virtual ~IPropertyArrayHelper();
73 
85  virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
86  ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) = 0;
90  virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void) = 0;
96  virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
97  const ::rtl::OUString& rPropertyName )
98  throw (::com::sun::star::beans::UnknownPropertyException) = 0;
103  virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) = 0;
109  virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) = 0;
115  virtual sal_Int32 SAL_CALL fillHandles(
116  /*out*/ sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ) = 0;
117 };
118 
124 {
125 public:
135  ::com::sun::star::beans::Property *pProps,
136  sal_Int32 nElements ,
137  sal_Bool bSorted = sal_True )
138  SAL_THROW(());
139 
147  const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > & aProps,
148  sal_Bool bSorted = sal_True )
149  SAL_THROW(());
150 
154  sal_Int32 SAL_CALL getCount() const SAL_THROW(());
167  virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
168  ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle );
172  virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void);
178  virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
179  const ::rtl::OUString& rPropertyName )
180  throw (::com::sun::star::beans::UnknownPropertyException);
185  virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName);
191  virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName );
197  virtual sal_Int32 SAL_CALL fillHandles(
198  /*out*/sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames );
199 
200 protected:
203  void * m_pReserved;
204 
205 private:
206  void init( sal_Bool bSorted ) SAL_THROW(());
207 
210 
215  sal_Bool bRightOrdered;
216 };
217 
218 
219 //-----------------------------------------------------------------------------
220 // helper defines needed for an interface container with a 32 bit key values
221 
223 {
224  bool operator()(const sal_Int32 & i1 , const sal_Int32 & i2) const SAL_THROW(())
225  { return i1 == i2; }
226 };
227 
229 {
230  size_t operator()(const sal_Int32 & i) const SAL_THROW(())
231  { return i; }
232 };
237 {
238 public:
239  // these are here to force memory de/allocation to sal lib.
240  inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
241  { return ::rtl_allocateMemory( nSize ); }
242  inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
243  { ::rtl_freeMemory( pMem ); }
244  inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
245  { return pMem; }
246  inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
247  {}
248 
261 
265  ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getContainedTypes() const SAL_THROW(());
266 
272  OInterfaceContainerHelper * SAL_CALL getContainer( const sal_Int32 & rKey ) const SAL_THROW(());
273 
281  sal_Int32 SAL_CALL addInterface(
282  const sal_Int32 & rKey,
283  const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & r )
284  SAL_THROW(());
285 
293  sal_Int32 SAL_CALL removeInterface(
294  const sal_Int32 & rKey,
295  const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace )
296  SAL_THROW(());
297 
302  void SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt ) SAL_THROW(());
306  void SAL_CALL clear() SAL_THROW(());
307 
308  typedef sal_Int32 keyType;
309 private:
310  void *m_pMap;
311  ::osl::Mutex & rMutex;
312 
314  inline OMultiTypeInterfaceContainerHelperInt32 & operator = ( const OMultiTypeInterfaceContainerHelperInt32 & ) SAL_THROW(());
315 };
316 
317 
321 {
322 public:
332  virtual void fireEvents(
333  sal_Int32 * pnHandles,
334  sal_Int32 nCount,
335  sal_Bool bVetoable,
336  bool bIgnoreRuntimeExceptionsWhileFiring) = 0;
337 
338 #if !defined _MSC_VER // public -> protected changes mangled names there
339 protected:
340 #endif
342  // avoid warnings about virtual members and non-virtual dtor
343 };
344 
345 
346 
360  public ::com::sun::star::beans::XMultiPropertySet,
361  public ::com::sun::star::beans::XFastPropertySet,
362  public ::com::sun::star::beans::XPropertySet
363 {
364 public:
372 
392  OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring );
393 
416  OBroadcastHelper & rBHelper,
417  IEventNotificationHook *i_pFireEvents,
418  bool bIgnoreRuntimeExceptionsWhileFiring = false);
419 
424  virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
425  throw (::com::sun::star::uno::RuntimeException);
426 
430  throw(::com::sun::star::uno::RuntimeException);
431 
438  void SAL_CALL disposing() SAL_THROW(());
439 
445  virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue )
446  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);
451  virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName)
452  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
454  virtual void SAL_CALL addPropertyChangeListener(
455  const ::rtl::OUString& aPropertyName,
456  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener)
457  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
458 
460  virtual void SAL_CALL removePropertyChangeListener(
461  const ::rtl::OUString& aPropertyName,
462  const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertyChangeListener >& aListener)
463  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
464 
466  virtual void SAL_CALL addVetoableChangeListener(
467  const ::rtl::OUString& aPropertyName,
468  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener)
469  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
470 
472  virtual void SAL_CALL removeVetoableChangeListener(
473  const ::rtl::OUString& aPropertyName,
474  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener )
475  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
476 
484  virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
485  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);
486 
491  virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle )
492  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
493 
494  // XMultiPropertySet
495  virtual void SAL_CALL setPropertyValues(
496  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
497  const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values )
498  throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
499 
500  virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues(
501  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames )
502  throw(::com::sun::star::uno::RuntimeException);
503 
504  virtual void SAL_CALL addPropertiesChangeListener(
505  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
506  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
507  throw(::com::sun::star::uno::RuntimeException);
508 
509  virtual void SAL_CALL removePropertiesChangeListener(
510  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
511  throw(::com::sun::star::uno::RuntimeException);
512 
513  virtual void SAL_CALL firePropertiesChangeEvent(
514  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
515  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > & Listener )
516  throw(::com::sun::star::uno::RuntimeException);
517 
521  static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
522  createPropertySetInfo( IPropertyArrayHelper & rProperties ) SAL_THROW(());
523 protected:
533  void SAL_CALL fire(
534  sal_Int32 * pnHandles,
535  const ::com::sun::star::uno::Any * pNewValues,
536  const ::com::sun::star::uno::Any * pOldValues,
537  sal_Int32 nCount,
538  sal_Bool bVetoable );
539 
549  void SAL_CALL setFastPropertyValues(
550  sal_Int32 nSeqLen,
551  sal_Int32 * pHandles,
552  const ::com::sun::star::uno::Any * pValues,
553  sal_Int32 nHitCount )
554  SAL_THROW( (::com::sun::star::uno::Exception) );
555 
560  virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
561 
573  virtual sal_Bool SAL_CALL convertFastPropertyValue(
574  ::com::sun::star::uno::Any & rConvertedValue,
575  ::com::sun::star::uno::Any & rOldValue,
576  sal_Int32 nHandle,
577  const ::com::sun::star::uno::Any& rValue )
578  throw (::com::sun::star::lang::IllegalArgumentException) = 0;
579 
598  virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
599  sal_Int32 nHandle,
600  const ::com::sun::star::uno::Any& rValue )
601  throw (::com::sun::star::uno::Exception) = 0;
607  virtual void SAL_CALL getFastPropertyValue(
608  ::com::sun::star::uno::Any& rValue,
609  sal_Int32 nHandle ) const = 0;
610 
629  void setDependentFastPropertyValue(
630  sal_Int32 i_handle,
631  const ::com::sun::star::uno::Any& i_value
632  );
633 
644 
645  class Impl;
646 
649  const std::auto_ptr<Impl> m_pReserved;
650 
651 private:
652  OPropertySetHelper( const OPropertySetHelper & ) SAL_THROW(());
653  OPropertySetHelper & operator = ( const OPropertySetHelper & ) SAL_THROW(());
654 
658  void impl_fireAll(
659  sal_Int32* i_handles,
660  const ::com::sun::star::uno::Any * i_newValues,
661  const ::com::sun::star::uno::Any * i_oldValues,
662  sal_Int32 i_count
663  );
664 
665 #if defined _MSC_VER // public -> protected changes mangled names there
666 public:
667 #else
668 protected:
669 #endif
670 // Suppress warning about virtual functions but non-virtual destructor:
671 #if defined _MSC_VER
672 #pragma warning(push)
673 #pragma warning(disable: 4265)
674 #endif
675 
678  ~OPropertySetHelper() SAL_THROW(());
679 };
680 #if defined _MSC_VER
681 #pragma warning(pop)
682 #endif
683 
688  public ::com::sun::star::beans::XPropertySetOption
689 {
690 public:
695  explicit OPropertySetHelper2(
696  OBroadcastHelper & rBHelper,
697  IEventNotificationHook *i_pFireEvents = NULL,
698  bool bIgnoreRuntimeExceptionsWhileFiring = false);
699 
700  // XInterface
701  virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
702  throw (::com::sun::star::uno::RuntimeException);
703 
704  // XPropertySetOption
705  virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
706  throw(::com::sun::star::uno::RuntimeException);
707 
708 
709 
710 private:
712  OPropertySetHelper2 & operator = ( const OPropertySetHelper2 & ) SAL_THROW(());
713 
714 #if defined _MSC_VER // public -> protected changes mangled names there
715 public:
716 #else
717 protected:
718 #endif
719 // Suppress warning about virtual functions but non-virtual destructor:
723  virtual ~OPropertySetHelper2() SAL_THROW(());
724 };
725 
726 } // end namespace cppuhelper
727 #endif //
728 
729 
730 
731 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */