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  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef _CPPUHELPER_PROPSHLP_HXX
21 #define _CPPUHELPER_PROPSHLP_HXX
22 
23 #include <rtl/alloc.h>
24 
26 
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/beans/XPropertySetOption.hpp>
29 #include <com/sun/star/beans/XMultiPropertySet.hpp>
30 #include <com/sun/star/beans/XFastPropertySet.hpp>
31 
32 #include <memory>
33 #include "cppuhelperdllapi.h"
34 
35 
36 namespace cppu
37 {
38 
39 
40 /*************************************************************************
41 *************************************************************************/
42 
43 
48 {
49 public:
50  // these are here to force memory de/allocation to sal lib.
51  inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
52  { return ::rtl_allocateMemory( nSize ); }
53  inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
54  { ::rtl_freeMemory( pMem ); }
55  inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
56  { return pMem; }
57  inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
58  {}
59 
63  virtual ~IPropertyArrayHelper();
64 
76  virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
77  ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) = 0;
81  virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void) = 0;
87  virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
88  const ::rtl::OUString& rPropertyName )
89  throw (::com::sun::star::beans::UnknownPropertyException) = 0;
94  virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) = 0;
100  virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) = 0;
106  virtual sal_Int32 SAL_CALL fillHandles(
107  /*out*/ sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ) = 0;
108 };
109 
115 {
116 public:
126  ::com::sun::star::beans::Property *pProps,
127  sal_Int32 nElements ,
128  sal_Bool bSorted = sal_True )
129  SAL_THROW(());
130 
138  const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > & aProps,
139  sal_Bool bSorted = sal_True )
140  SAL_THROW(());
141 
145  sal_Int32 SAL_CALL getCount() const SAL_THROW(());
158  virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(
159  ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle );
163  virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void);
169  virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
170  const ::rtl::OUString& rPropertyName )
171  throw (::com::sun::star::beans::UnknownPropertyException);
176  virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName);
182  virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName );
188  virtual sal_Int32 SAL_CALL fillHandles(
189  /*out*/sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames );
190 
191 protected:
194  void * m_pReserved;
195 
196 private:
197  void init( sal_Bool bSorted ) SAL_THROW(());
198 
201 
206  sal_Bool bRightOrdered;
207 };
208 
209 
210 //-----------------------------------------------------------------------------
211 // helper defines needed for an interface container with a 32 bit key values
212 
214 {
215  bool operator()(const sal_Int32 & i1 , const sal_Int32 & i2) const SAL_THROW(())
216  { return i1 == i2; }
217 };
218 
220 {
221  size_t operator()(const sal_Int32 & i) const SAL_THROW(())
222  { return i; }
223 };
228 {
229 public:
230  // these are here to force memory de/allocation to sal lib.
231  inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
232  { return ::rtl_allocateMemory( nSize ); }
233  inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
234  { ::rtl_freeMemory( pMem ); }
235  inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
236  { return pMem; }
237  inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
238  {}
239 
252 
256  ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getContainedTypes() const SAL_THROW(());
257 
263  OInterfaceContainerHelper * SAL_CALL getContainer( const sal_Int32 & rKey ) const SAL_THROW(());
264 
272  sal_Int32 SAL_CALL addInterface(
273  const sal_Int32 & rKey,
274  const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & r )
275  SAL_THROW(());
276 
284  sal_Int32 SAL_CALL removeInterface(
285  const sal_Int32 & rKey,
286  const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & rxIFace )
287  SAL_THROW(());
288 
293  void SAL_CALL disposeAndClear( const ::com::sun::star::lang::EventObject & rEvt ) SAL_THROW(());
297  void SAL_CALL clear() SAL_THROW(());
298 
299  typedef sal_Int32 keyType;
300 private:
301  void *m_pMap;
302  ::osl::Mutex & rMutex;
303 
305  inline OMultiTypeInterfaceContainerHelperInt32 & operator = ( const OMultiTypeInterfaceContainerHelperInt32 & ) SAL_THROW(());
306 };
307 
308 
312 {
313 public:
323  virtual void fireEvents(
324  sal_Int32 * pnHandles,
325  sal_Int32 nCount,
326  sal_Bool bVetoable,
327  bool bIgnoreRuntimeExceptionsWhileFiring) = 0;
328 
329 #if !defined _MSC_VER // public -> protected changes mangled names there
330 protected:
331 #endif
333  // avoid warnings about virtual members and non-virtual dtor
334 };
335 
336 
337 
351  public ::com::sun::star::beans::XMultiPropertySet,
352  public ::com::sun::star::beans::XFastPropertySet,
353  public ::com::sun::star::beans::XPropertySet
354 {
355 public:
363 
383  OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring );
384 
407  OBroadcastHelper & rBHelper,
408  IEventNotificationHook *i_pFireEvents,
409  bool bIgnoreRuntimeExceptionsWhileFiring = false);
410 
415  virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
416  throw (::com::sun::star::uno::RuntimeException);
417 
421  throw(::com::sun::star::uno::RuntimeException);
422 
429  void SAL_CALL disposing() SAL_THROW(());
430 
436  virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue )
437  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);
442  virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName)
443  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
445  virtual void SAL_CALL addPropertyChangeListener(
446  const ::rtl::OUString& aPropertyName,
447  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener)
448  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
449 
451  virtual void SAL_CALL removePropertyChangeListener(
452  const ::rtl::OUString& aPropertyName,
453  const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertyChangeListener >& aListener)
454  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
455 
457  virtual void SAL_CALL addVetoableChangeListener(
458  const ::rtl::OUString& aPropertyName,
459  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener)
460  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
461 
463  virtual void SAL_CALL removeVetoableChangeListener(
464  const ::rtl::OUString& aPropertyName,
465  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener )
466  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
467 
475  virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
476  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);
477 
482  virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle )
483  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
484 
485  // XMultiPropertySet
486  virtual void SAL_CALL setPropertyValues(
487  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
488  const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values )
489  throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
490 
491  virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues(
492  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames )
493  throw(::com::sun::star::uno::RuntimeException);
494 
495  virtual void SAL_CALL addPropertiesChangeListener(
496  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
497  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
498  throw(::com::sun::star::uno::RuntimeException);
499 
500  virtual void SAL_CALL removePropertiesChangeListener(
501  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
502  throw(::com::sun::star::uno::RuntimeException);
503 
504  virtual void SAL_CALL firePropertiesChangeEvent(
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 
512  static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
513  createPropertySetInfo( IPropertyArrayHelper & rProperties ) SAL_THROW(());
514 protected:
524  void SAL_CALL fire(
525  sal_Int32 * pnHandles,
526  const ::com::sun::star::uno::Any * pNewValues,
527  const ::com::sun::star::uno::Any * pOldValues,
528  sal_Int32 nCount,
529  sal_Bool bVetoable );
530 
540  void SAL_CALL setFastPropertyValues(
541  sal_Int32 nSeqLen,
542  sal_Int32 * pHandles,
543  const ::com::sun::star::uno::Any * pValues,
544  sal_Int32 nHitCount )
545  SAL_THROW( (::com::sun::star::uno::Exception) );
546 
551  virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
552 
564  virtual sal_Bool SAL_CALL convertFastPropertyValue(
565  ::com::sun::star::uno::Any & rConvertedValue,
566  ::com::sun::star::uno::Any & rOldValue,
567  sal_Int32 nHandle,
568  const ::com::sun::star::uno::Any& rValue )
569  throw (::com::sun::star::lang::IllegalArgumentException) = 0;
570 
589  virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
590  sal_Int32 nHandle,
591  const ::com::sun::star::uno::Any& rValue )
592  throw (::com::sun::star::uno::Exception) = 0;
598  virtual void SAL_CALL getFastPropertyValue(
599  ::com::sun::star::uno::Any& rValue,
600  sal_Int32 nHandle ) const = 0;
601 
620  void setDependentFastPropertyValue(
621  sal_Int32 i_handle,
622  const ::com::sun::star::uno::Any& i_value
623  );
624 
635 
636  class Impl;
637 
640  const std::auto_ptr<Impl> m_pReserved;
641 
642 private:
643  OPropertySetHelper( const OPropertySetHelper & ) SAL_THROW(());
644  OPropertySetHelper & operator = ( const OPropertySetHelper & ) SAL_THROW(());
645 
649  void impl_fireAll(
650  sal_Int32* i_handles,
651  const ::com::sun::star::uno::Any * i_newValues,
652  const ::com::sun::star::uno::Any * i_oldValues,
653  sal_Int32 i_count
654  );
655 
656 #if defined _MSC_VER // public -> protected changes mangled names there
657 public:
658 #else
659 protected:
660 #endif
661 // Suppress warning about virtual functions but non-virtual destructor:
662 #if defined _MSC_VER
663 #pragma warning(push)
664 #pragma warning(disable: 4265)
665 #endif
666 
669  ~OPropertySetHelper() SAL_THROW(());
670 };
671 #if defined _MSC_VER
672 #pragma warning(pop)
673 #endif
674 
679  public ::com::sun::star::beans::XPropertySetOption
680 {
681 public:
686  explicit OPropertySetHelper2(
687  OBroadcastHelper & rBHelper,
688  IEventNotificationHook *i_pFireEvents = NULL,
689  bool bIgnoreRuntimeExceptionsWhileFiring = false);
690 
691  // XInterface
692  virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
693  throw (::com::sun::star::uno::RuntimeException);
694 
695  // XPropertySetOption
696  virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
697  throw(::com::sun::star::uno::RuntimeException);
698 
699 
700 
701 private:
703  OPropertySetHelper2 & operator = ( const OPropertySetHelper2 & ) SAL_THROW(());
704 
705 #if defined _MSC_VER // public -> protected changes mangled names there
706 public:
707 #else
708 protected:
709 #endif
710 // Suppress warning about virtual functions but non-virtual destructor:
714  virtual ~OPropertySetHelper2() SAL_THROW(());
715 };
716 
717 } // end namespace cppuhelper
718 #endif //
719 
720 
721 
722 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */