LibreOffice
LibreOffice 4.2 SDK 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 INCLUDED_CPPUHELPER_PROPSHLP_HXX
21 #define INCLUDED_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>
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:
336  virtual void fireEvents(
337  sal_Int32 * pnHandles,
338  sal_Int32 nCount,
339  sal_Bool bVetoable,
340  bool bIgnoreRuntimeExceptionsWhileFiring) = 0;
341 
342 #if !defined _MSC_VER // public -> protected changes mangled names there
343 protected:
344 #endif
346  // avoid warnings about virtual members and non-virtual dtor
347 };
348 
349 
350 
364  public ::com::sun::star::beans::XMultiPropertySet,
365  public ::com::sun::star::beans::XFastPropertySet,
366  public ::com::sun::star::beans::XPropertySet
367 {
368 public:
376 
396  OBroadcastHelper & rBHelper, bool bIgnoreRuntimeExceptionsWhileFiring );
397 
420  OBroadcastHelper & rBHelper,
421  IEventNotificationHook *i_pFireEvents,
422  bool bIgnoreRuntimeExceptionsWhileFiring = false);
423 
428  virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
429  throw (::com::sun::star::uno::RuntimeException);
430 
434  throw(::com::sun::star::uno::RuntimeException);
435 
442  void SAL_CALL disposing() SAL_THROW(());
443 
449  virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue )
450  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);
455  virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName)
456  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
458  virtual void SAL_CALL addPropertyChangeListener(
459  const ::rtl::OUString& aPropertyName,
460  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener)
461  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
462 
464  virtual void SAL_CALL removePropertyChangeListener(
465  const ::rtl::OUString& aPropertyName,
466  const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertyChangeListener >& aListener)
467  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
468 
470  virtual void SAL_CALL addVetoableChangeListener(
471  const ::rtl::OUString& aPropertyName,
472  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener)
473  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
474 
476  virtual void SAL_CALL removeVetoableChangeListener(
477  const ::rtl::OUString& aPropertyName,
478  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener )
479  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
480 
488  virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
489  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);
490 
495  virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle )
496  throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
497 
498  // XMultiPropertySet
499  virtual void SAL_CALL setPropertyValues(
500  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
501  const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values )
502  throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
503 
504  virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues(
505  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames )
506  throw(::com::sun::star::uno::RuntimeException);
507 
508  virtual void SAL_CALL addPropertiesChangeListener(
509  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
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 removePropertiesChangeListener(
514  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& Listener )
515  throw(::com::sun::star::uno::RuntimeException);
516 
517  virtual void SAL_CALL firePropertiesChangeEvent(
518  const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames,
519  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener > & Listener )
520  throw(::com::sun::star::uno::RuntimeException);
521 
525  static ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
526  createPropertySetInfo( IPropertyArrayHelper & rProperties ) SAL_THROW(());
527 protected:
537  void SAL_CALL fire(
538  sal_Int32 * pnHandles,
539  const ::com::sun::star::uno::Any * pNewValues,
540  const ::com::sun::star::uno::Any * pOldValues,
541  sal_Int32 nCount,
542  sal_Bool bVetoable );
543 
553  void SAL_CALL setFastPropertyValues(
554  sal_Int32 nSeqLen,
555  sal_Int32 * pHandles,
556  const ::com::sun::star::uno::Any * pValues,
557  sal_Int32 nHitCount )
558  SAL_THROW( (::com::sun::star::uno::Exception) );
559 
564  virtual IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0;
565 
578  virtual sal_Bool SAL_CALL convertFastPropertyValue(
579  ::com::sun::star::uno::Any & rConvertedValue,
580  ::com::sun::star::uno::Any & rOldValue,
581  sal_Int32 nHandle,
582  const ::com::sun::star::uno::Any& rValue )
583  throw (::com::sun::star::lang::IllegalArgumentException) = 0;
584 
603  virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
604  sal_Int32 nHandle,
605  const ::com::sun::star::uno::Any& rValue )
606  throw (::com::sun::star::uno::Exception) = 0;
612  virtual void SAL_CALL getFastPropertyValue(
613  ::com::sun::star::uno::Any& rValue,
614  sal_Int32 nHandle ) const = 0;
615 
634  void setDependentFastPropertyValue(
635  sal_Int32 i_handle,
636  const ::com::sun::star::uno::Any& i_value
637  );
638 
649 
650  class Impl;
651 
654  const std::auto_ptr<Impl> m_pReserved;
655 
656 private:
657  OPropertySetHelper( const OPropertySetHelper & ) SAL_THROW(());
658  OPropertySetHelper & operator = ( const OPropertySetHelper & ) SAL_THROW(());
659 
663  void impl_fireAll(
664  sal_Int32* i_handles,
665  const ::com::sun::star::uno::Any * i_newValues,
666  const ::com::sun::star::uno::Any * i_oldValues,
667  sal_Int32 i_count
668  );
669 
670 #if defined _MSC_VER // public -> protected changes mangled names there
671 public:
672 #else
673 protected:
674 #endif
675 // Suppress warning about virtual functions but non-virtual destructor:
676 #if defined _MSC_VER
677 #pragma warning(push)
678 #pragma warning(disable: 4265)
679 #endif
680 
683  ~OPropertySetHelper() SAL_THROW(());
684 };
685 #if defined _MSC_VER
686 #pragma warning(pop)
687 #endif
688 
693  public ::com::sun::star::beans::XPropertySetOption
694 {
695 public:
700  explicit OPropertySetHelper2(
701  OBroadcastHelper & rBHelper,
702  IEventNotificationHook *i_pFireEvents = NULL,
703  bool bIgnoreRuntimeExceptionsWhileFiring = false);
704 
705  // XInterface
706  virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
707  throw (::com::sun::star::uno::RuntimeException);
708 
709  // XPropertySetOption
710  virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
711  throw(::com::sun::star::uno::RuntimeException);
712 
713 
714 
715 private:
717  OPropertySetHelper2 & operator = ( const OPropertySetHelper2 & ) SAL_THROW(());
718 
719 #if defined _MSC_VER // public -> protected changes mangled names there
720 public:
721 #else
722 protected:
723 #endif
724 // Suppress warning about virtual functions but non-virtual destructor:
728  virtual ~OPropertySetHelper2() SAL_THROW(());
729 };
730 
731 } // end namespace cppuhelper
732 #endif //
733 
734 
735 
736 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OBroadcastHelper & rBHelper
The common data of a broadcaster.
Definition: propshlp.hxx:640
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
This interface is used by the OPropertyHelper, to access the property description.
Definition: propshlp.hxx:47
Specialized class for key type sal_Int32, without explicit usage of STL symbols.
Definition: propshlp.hxx:227
#define sal_True
Definition: types.h:48
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet and XPrope...
Definition: propshlp.hxx:363
inline::com::sun::star::uno::Any queryInterface(const ::com::sun::star::uno::Type &rType, Interface1 *p1)
Compares demanded type to given template argument types.
Definition: queryinterface.hxx:39
OMultiTypeInterfaceContainerHelperInt32 aVetoableLC
Container for the XPropertyVetoableListener.
Definition: propshlp.hxx:648
size_t operator()(const sal_Int32 &i) const
Definition: propshlp.hxx:221
A container of interfaces.
Definition: interfacecontainer.h:114
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
An interface to extend event notification actions.
Definition: propshlp.hxx:311
~IEventNotificationHook()
Definition: propshlp.hxx:345
You can use this helper class to map a XPropertySet-Interface to a XFast- or a XMultiPropertySet inte...
Definition: propshlp.hxx:114
A mutual exclusion synchronization object.
Definition: mutex.hxx:32
OMultiTypeInterfaceContainerHelperInt32 aBoundLC
Container for the XProperyChangedListener.
Definition: propshlp.hxx:644
This struct contains the standard variables of a broadcaster.
Definition: interfacecontainer.h:423
C++ class representing an IDL any.
Definition: Any.h:46
bool operator()(const sal_Int32 &i1, const sal_Int32 &i2) const
Definition: propshlp.hxx:215
unsigned char sal_Bool
Definition: types.h:46
Definition: propshlp.hxx:213
sal_Int32 keyType
Definition: propshlp.hxx:299
const std::auto_ptr< Impl > m_pReserved
reserved for future use.
Definition: propshlp.hxx:650
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
Definition: propshlp.hxx:219
void * m_pReserved
reserved for future use.
Definition: propshlp.hxx:194
OPropertySetHelper plus XPropertySetOption.
Definition: propshlp.hxx:692
#define SAL_THROW(exc)
Definition of function throw clause macros.
Definition: types.h:358