LibreOffice
LibreOffice 4.3 SDK C/C++ API Reference
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 ) SAL_OVERRIDE;
163  virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties(void) SAL_OVERRIDE;
169  virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(
170  const ::rtl::OUString& rPropertyName )
171  throw (::com::sun::star::beans::UnknownPropertyException) SAL_OVERRIDE;
176  virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName) SAL_OVERRIDE;
182  virtual sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName ) SAL_OVERRIDE;
188  virtual sal_Int32 SAL_CALL fillHandles(
189  /*out*/sal_Int32 * pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames ) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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,
607  std::exception) = 0;
613  virtual void SAL_CALL getFastPropertyValue(
614  ::com::sun::star::uno::Any& rValue,
615  sal_Int32 nHandle ) const = 0;
616 
635  void setDependentFastPropertyValue(
636  sal_Int32 i_handle,
637  const ::com::sun::star::uno::Any& i_value
638  );
639 
650 
651  class Impl;
652 
655  const std::auto_ptr<Impl> m_pReserved;
656 
657 private:
658  OPropertySetHelper( const OPropertySetHelper & ) SAL_THROW(());
659  OPropertySetHelper & operator = ( const OPropertySetHelper & ) SAL_THROW(());
660 
664  void impl_fireAll(
665  sal_Int32* i_handles,
666  const ::com::sun::star::uno::Any * i_newValues,
667  const ::com::sun::star::uno::Any * i_oldValues,
668  sal_Int32 i_count
669  );
670 
671 #if defined _MSC_VER // public -> protected changes mangled names there
672 public:
673 #else
674 protected:
675 #endif
676 // Suppress warning about virtual functions but non-virtual destructor:
677 #if defined _MSC_VER
678 #pragma warning(push)
679 #pragma warning(disable: 4265)
680 #endif
681 
684  ~OPropertySetHelper() SAL_THROW(());
685 };
686 #if defined _MSC_VER
687 #pragma warning(pop)
688 #endif
689 
694  public ::com::sun::star::beans::XPropertySetOption
695 {
696 public:
701  explicit OPropertySetHelper2(
702  OBroadcastHelper & rBHelper,
703  IEventNotificationHook *i_pFireEvents = NULL,
704  bool bIgnoreRuntimeExceptionsWhileFiring = false);
705 
706  // XInterface
707  virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType )
708  throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
709 
710  // XPropertySetOption
711  virtual void SAL_CALL enableChangeListenerNotification( sal_Bool bEnable )
712  throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
713 
714 
715 
716 private:
718  OPropertySetHelper2 & operator = ( const OPropertySetHelper2 & ) SAL_THROW(());
719 
720 #if defined _MSC_VER // public -> protected changes mangled names there
721 public:
722 #else
723 protected:
724 #endif
725 // Suppress warning about virtual functions but non-virtual destructor:
729  virtual ~OPropertySetHelper2() SAL_THROW(());
730 };
731 
732 } // end namespace cppuhelper
733 #endif
734 
735 
736 
737 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 keyType
Definition: propshlp.hxx:299
bool operator()(const sal_Int32 &i1, const sal_Int32 &i2) const SAL_THROW(())
Definition: propshlp.hxx:215
This interface is used by the OPropertyHelper, to access the property description.
Definition: propshlp.hxx:47
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
void virtual setFastPropertyValues(sal_Int32 nSeqLen, sal_Int32 *pHandles, const ::com::sun::star::uno::Any *pValues, sal_Int32 nHitCount) SAL_THROW((IPropertyArrayHelper getInfoHelper)()=0
Set multiple properties with the handles.
Definition: propshlp.hxx:564
const std::auto_ptr< Impl > m_pReserved
reserved for future use.
Definition: propshlp.hxx:651
This abstract class maps the methods of the interfaces XMultiPropertySet, XFastPropertySet and XPrope...
Definition: propshlp.hxx:363
unsigned char sal_Bool
Definition: types.h:46
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
An interface to extend event notification actions.
Definition: propshlp.hxx:311
You can use this helper class to map a XPropertySet-Interface to a XFast- or a XMultiPropertySet inte...
Definition: propshlp.hxx:114
Specialized class for key type sal_Int32, without explicit usage of STL symbols.
Definition: propshlp.hxx:227
OBroadcastHelper & rBHelper
The common data of a broadcaster.
Definition: propshlp.hxx:641
void * m_pReserved
reserved for future use.
Definition: propshlp.hxx:194
A container of interfaces.
Definition: interfacecontainer.h:117
#define SAL_OVERRIDE
C++11 "override" feature.
Definition: types.h:423
~IEventNotificationHook()
Definition: propshlp.hxx:345
Definition: propshlp.hxx:213
Definition: conditn.hxx:30
This struct contains the standard variables of a broadcaster.
Definition: interfacecontainer.h:426
Definition: Enterable.hxx:26
C++ class representing an IDL any.
Definition: Any.h:46
#define SAL_THROW(x)
Exception specification documentation.
Definition: types.h:361
#define sal_True
Definition: types.h:48
OMultiTypeInterfaceContainerHelperInt32 aBoundLC
Container for the XProperyChangedListener.
Definition: propshlp.hxx:645
OPropertySetHelper plus XPropertySetOption.
Definition: propshlp.hxx:693
A mutual exclusion synchronization object.
Definition: mutex.hxx:32
#define CPPUHELPER_DLLPUBLIC
Definition: cppuhelperdllapi.h:28
Definition: propshlp.hxx:219
This String class provides base functionality for C++ like Unicode character array handling...
Definition: ustring.hxx:82
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
OMultiTypeInterfaceContainerHelperInt32 aVetoableLC
Container for the XPropertyVetoableListener.
Definition: propshlp.hxx:649
size_t operator()(const sal_Int32 &i) const SAL_THROW(())
Definition: propshlp.hxx:221
Definition: types.h:391