1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
29 #define _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
31 #define EDITOR_LIST_APPEND (sal_uInt16)-1
32 #define EDITOR_LIST_REPLACE_EXISTING (sal_uInt16)-1
34 /** === begin UNO includes === **/
35 #include <com/sun/star/uno/Sequence.hxx>
36 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
37 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
38 /** === end UNO includes === **/
40 #include <vcl/smartid.hxx>
41 #include <tools/string.hxx>
42 #include <toolkit/helper/vclunohelper.hxx>
43 #include <comphelper/listenernotification.hxx>
45 //............................................................................
48 //............................................................................
50 #define OWN_PROPERTY_ID_INTROSPECTEDOBJECT 0x0010
51 #define OWN_PROPERTY_ID_CURRENTPAGE 0x0011
52 #define OWN_PROPERTY_ID_CONTROLCONTEXT 0x0012
53 #define OWN_PROPERTY_ID_TABBINGMODEL 0x0013
55 //========================================================================
57 //========================================================================
58 typedef ::comphelper::OSimpleListenerContainer
< ::com::sun::star::beans::XPropertyChangeListener
59 , ::com::sun::star::beans::PropertyChangeEvent
60 > PropertyChangeListeners
;
62 //========================================================================
64 //========================================================================
65 // small helper to make the "swap" call on an STL container a single-line call, which
66 // in it's canonic form "aFoo.swap( Container() )" doesn't compile with GCC
67 template< class CONTAINER
>
68 void clearContainer( CONTAINER
& _rContainer
)
71 _rContainer
.swap( aEmpty
);
74 //========================================================================
76 //========================================================================
77 /// small helper to translate help ids into help urls
81 static SmartId
getHelpId( const ::rtl::OUString
& _rHelpURL
);
82 static ::rtl::OUString
getHelpURL( sal_uInt32 _nHelpId
);
85 //====================================================================
87 //====================================================================
88 template< class ELEMENT
>
89 class StlSyntaxSequence
: public ::com::sun::star::uno::Sequence
< ELEMENT
>
92 typedef ::com::sun::star::uno::Sequence
< ELEMENT
> UnoBase
;
95 inline StlSyntaxSequence() : UnoBase() { }
96 inline StlSyntaxSequence( const UnoBase
& rSeq
) : UnoBase( rSeq
) { }
97 inline StlSyntaxSequence( const ELEMENT
* pElements
, sal_Int32 len
) : UnoBase( pElements
, len
) { }
98 inline StlSyntaxSequence( sal_Int32 len
) : UnoBase( len
) { }
100 operator const UnoBase
&() const { return *this; }
101 operator UnoBase
&() { return *this; }
103 typedef const ELEMENT
* const_iterator
;
104 typedef ELEMENT
* iterator
;
106 inline const_iterator
begin() const { return UnoBase::getConstArray(); }
107 inline const_iterator
end() const { return UnoBase::getConstArray() + UnoBase::getLength(); }
109 inline iterator
begin() { return UnoBase::getArray(); }
110 inline iterator
end() { return UnoBase::getArray() + UnoBase::getLength(); }
112 inline sal_Int32
size() const { return UnoBase::getLength(); }
113 inline bool empty() const { return UnoBase::getLength() == 0; }
115 inline void resize( size_t _newSize
) { UnoBase::realloc( _newSize
); }
117 inline iterator
erase( iterator _pos
)
119 iterator loop
= end();
120 while ( --loop
!= _pos
)
121 *( loop
- 1 ) = *loop
;
122 resize( size() - 1 );
126 //========================================================================
128 //========================================================================
129 #define DECLARE_XCOMPONENT() \
130 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); \
131 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); \
132 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
134 #define IMPLEMENT_FORWARD_XCOMPONENT( classname, baseclass ) \
135 void SAL_CALL classname::dispose( ) throw (::com::sun::star::uno::RuntimeException) \
137 baseclass::WeakComponentImplHelperBase::dispose(); \
139 void SAL_CALL classname::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \
141 baseclass::WeakComponentImplHelperBase::addEventListener( _Listener ); \
143 void SAL_CALL classname::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \
145 baseclass::WeakComponentImplHelperBase::removeEventListener( _Listener ); \
148 //............................................................................
150 //............................................................................
152 #endif // _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_