1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
29 #ifndef _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
30 #define _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
32 #define EDITOR_LIST_APPEND (sal_uInt16)-1
33 #define EDITOR_LIST_REPLACE_EXISTING (sal_uInt16)-1
35 /** === begin UNO includes === **/
36 #include <com/sun/star/uno/Sequence.hxx>
37 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
38 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
39 /** === end UNO includes === **/
41 #include <vcl/smartid.hxx>
42 #include <tools/string.hxx>
43 #include <toolkit/helper/vclunohelper.hxx>
44 #include <comphelper/listenernotification.hxx>
46 //............................................................................
49 //............................................................................
51 #define OWN_PROPERTY_ID_INTROSPECTEDOBJECT 0x0010
52 #define OWN_PROPERTY_ID_CURRENTPAGE 0x0011
53 #define OWN_PROPERTY_ID_CONTROLCONTEXT 0x0012
54 #define OWN_PROPERTY_ID_TABBINGMODEL 0x0013
56 //========================================================================
58 //========================================================================
59 typedef ::comphelper::OSimpleListenerContainer
< ::com::sun::star::beans::XPropertyChangeListener
60 , ::com::sun::star::beans::PropertyChangeEvent
61 > PropertyChangeListeners
;
63 //========================================================================
65 //========================================================================
66 // small helper to make the "swap" call on an STL container a single-line call, which
67 // in it's canonic form "aFoo.swap( Container() )" doesn't compile with GCC
68 template< class CONTAINER
>
69 void clearContainer( CONTAINER
& _rContainer
)
72 _rContainer
.swap( aEmpty
);
75 //========================================================================
77 //========================================================================
78 /// small helper to translate help ids into help urls
82 static SmartId
getHelpId( const ::rtl::OUString
& _rHelpURL
);
83 static ::rtl::OUString
getHelpURL( sal_uInt32 _nHelpId
);
86 //====================================================================
88 //====================================================================
89 template< class ELEMENT
>
90 class StlSyntaxSequence
: public ::com::sun::star::uno::Sequence
< ELEMENT
>
93 typedef ::com::sun::star::uno::Sequence
< ELEMENT
> UnoBase
;
96 inline StlSyntaxSequence() : UnoBase() { }
97 inline StlSyntaxSequence( const UnoBase
& rSeq
) : UnoBase( rSeq
) { }
98 inline StlSyntaxSequence( const ELEMENT
* pElements
, sal_Int32 len
) : UnoBase( pElements
, len
) { }
99 inline StlSyntaxSequence( sal_Int32 len
) : UnoBase( len
) { }
101 operator const UnoBase
&() const { return *this; }
102 operator UnoBase
&() { return *this; }
104 typedef const ELEMENT
* const_iterator
;
105 typedef ELEMENT
* iterator
;
107 inline const_iterator
begin() const { return UnoBase::getConstArray(); }
108 inline const_iterator
end() const { return UnoBase::getConstArray() + UnoBase::getLength(); }
110 inline iterator
begin() { return UnoBase::getArray(); }
111 inline iterator
end() { return UnoBase::getArray() + UnoBase::getLength(); }
113 inline sal_Int32
size() const { return UnoBase::getLength(); }
114 inline bool empty() const { return UnoBase::getLength() == 0; }
116 inline void resize( size_t _newSize
) { UnoBase::realloc( _newSize
); }
118 inline iterator
erase( iterator _pos
)
120 iterator loop
= end();
121 while ( --loop
!= _pos
)
122 *( loop
- 1 ) = *loop
;
123 resize( size() - 1 );
127 //========================================================================
129 //========================================================================
130 #define DECLARE_XCOMPONENT() \
131 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); \
132 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); \
133 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
135 #define IMPLEMENT_FORWARD_XCOMPONENT( classname, baseclass ) \
136 void SAL_CALL classname::dispose( ) throw (::com::sun::star::uno::RuntimeException) \
138 baseclass::WeakComponentImplHelperBase::dispose(); \
140 void SAL_CALL classname::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \
142 baseclass::WeakComponentImplHelperBase::addEventListener( _Listener ); \
144 void SAL_CALL classname::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \
146 baseclass::WeakComponentImplHelperBase::removeEventListener( _Listener ); \
149 //............................................................................
151 //............................................................................
153 #endif // _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */