1*46dbaceeSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*46dbaceeSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*46dbaceeSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*46dbaceeSAndrew Rist  * distributed with this work for additional information
6*46dbaceeSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*46dbaceeSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*46dbaceeSAndrew Rist  * "License"); you may not use this file except in compliance
9*46dbaceeSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*46dbaceeSAndrew Rist  *
11*46dbaceeSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*46dbaceeSAndrew Rist  *
13*46dbaceeSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*46dbaceeSAndrew Rist  * software distributed under the License is distributed on an
15*46dbaceeSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*46dbaceeSAndrew Rist  * KIND, either express or implied.  See the License for the
17*46dbaceeSAndrew Rist  * specific language governing permissions and limitations
18*46dbaceeSAndrew Rist  * under the License.
19*46dbaceeSAndrew Rist  *
20*46dbaceeSAndrew Rist  *************************************************************/
21*46dbaceeSAndrew Rist 
22*46dbaceeSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
25cdf0e10cSrcweir #define _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #define EDITOR_LIST_APPEND	            (sal_uInt16)-1
28cdf0e10cSrcweir #define EDITOR_LIST_REPLACE_EXISTING    (sal_uInt16)-1
29cdf0e10cSrcweir 
30cdf0e10cSrcweir /** === begin UNO includes === **/
31cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
32cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
33cdf0e10cSrcweir #include <com/sun/star/beans/PropertyChangeEvent.hpp>
34cdf0e10cSrcweir /** === end UNO includes === **/
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <tools/string.hxx>
37cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
38cdf0e10cSrcweir #include <comphelper/listenernotification.hxx>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //............................................................................
41cdf0e10cSrcweir namespace pcr
42cdf0e10cSrcweir {
43cdf0e10cSrcweir //............................................................................
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     #define OWN_PROPERTY_ID_INTROSPECTEDOBJECT      0x0010
46cdf0e10cSrcweir     #define OWN_PROPERTY_ID_CURRENTPAGE             0x0011
47cdf0e10cSrcweir     #define OWN_PROPERTY_ID_CONTROLCONTEXT          0x0012
48cdf0e10cSrcweir     #define OWN_PROPERTY_ID_TABBINGMODEL            0x0013
49cdf0e10cSrcweir 
50cdf0e10cSrcweir     //========================================================================
51cdf0e10cSrcweir     //= types
52cdf0e10cSrcweir 	//========================================================================
53cdf0e10cSrcweir     typedef ::comphelper::OSimpleListenerContainer  <   ::com::sun::star::beans::XPropertyChangeListener
54cdf0e10cSrcweir                                                     ,   ::com::sun::star::beans::PropertyChangeEvent
55cdf0e10cSrcweir                                                     >   PropertyChangeListeners;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     //========================================================================
58cdf0e10cSrcweir     //= helper
59cdf0e10cSrcweir 	//========================================================================
60cdf0e10cSrcweir     // small helper to make the "swap" call on an STL container a single-line call, which
61cdf0e10cSrcweir     // in it's canonic form "aFoo.swap( Container() )" doesn't compile with GCC
62cdf0e10cSrcweir     template< class CONTAINER >
clearContainer(CONTAINER & _rContainer)63cdf0e10cSrcweir     void clearContainer( CONTAINER& _rContainer )
64cdf0e10cSrcweir     {
65cdf0e10cSrcweir         CONTAINER aEmpty;
66cdf0e10cSrcweir         _rContainer.swap( aEmpty );
67cdf0e10cSrcweir     }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir     //========================================================================
70cdf0e10cSrcweir     //= HelpIdUrl
71cdf0e10cSrcweir 	//========================================================================
72cdf0e10cSrcweir     /// small helper to translate help ids into help urls
73cdf0e10cSrcweir     class HelpIdUrl
74cdf0e10cSrcweir     {
75cdf0e10cSrcweir     public:
76cdf0e10cSrcweir         static rtl::OString getHelpId( const ::rtl::OUString& _rHelpURL );
77cdf0e10cSrcweir         static ::rtl::OUString getHelpURL( const rtl::OString& );
78cdf0e10cSrcweir     };
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	//====================================================================
81cdf0e10cSrcweir 	//= StlSyntaxSequence
82cdf0e10cSrcweir 	//====================================================================
83cdf0e10cSrcweir     template< class ELEMENT >
84cdf0e10cSrcweir     class StlSyntaxSequence : public ::com::sun::star::uno::Sequence< ELEMENT >
85cdf0e10cSrcweir     {
86cdf0e10cSrcweir     private:
87cdf0e10cSrcweir         typedef ::com::sun::star::uno::Sequence< ELEMENT >  UnoBase;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir     public:
StlSyntaxSequence()90cdf0e10cSrcweir         inline StlSyntaxSequence() : UnoBase() { }
StlSyntaxSequence(const UnoBase & rSeq)91cdf0e10cSrcweir         inline StlSyntaxSequence( const UnoBase& rSeq ) : UnoBase( rSeq ) { }
StlSyntaxSequence(const ELEMENT * pElements,sal_Int32 len)92cdf0e10cSrcweir         inline StlSyntaxSequence( const ELEMENT* pElements, sal_Int32 len ) : UnoBase( pElements, len ) { }
StlSyntaxSequence(sal_Int32 len)93cdf0e10cSrcweir         inline StlSyntaxSequence( sal_Int32 len ) : UnoBase( len ) { }
94cdf0e10cSrcweir 
95cdf0e10cSrcweir         operator const UnoBase&() const { return *this; }
operator UnoBase&()96cdf0e10cSrcweir         operator       UnoBase&()       { return *this; }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir         typedef const ELEMENT* const_iterator;
99cdf0e10cSrcweir         typedef       ELEMENT* iterator;
100cdf0e10cSrcweir 
begin() const101cdf0e10cSrcweir         inline const_iterator begin() const { return UnoBase::getConstArray(); }
end() const102cdf0e10cSrcweir         inline const_iterator end() const { return UnoBase::getConstArray() + UnoBase::getLength(); }
103cdf0e10cSrcweir 
begin()104cdf0e10cSrcweir         inline iterator begin() { return UnoBase::getArray(); }
end()105cdf0e10cSrcweir         inline iterator end() { return UnoBase::getArray() + UnoBase::getLength(); }
106cdf0e10cSrcweir 
size() const107cdf0e10cSrcweir         inline sal_Int32 size() const { return UnoBase::getLength(); }
empty() const108cdf0e10cSrcweir         inline bool empty() const { return UnoBase::getLength() == 0; }
109cdf0e10cSrcweir 
resize(size_t _newSize)110cdf0e10cSrcweir         inline void resize( size_t _newSize ) { UnoBase::realloc( _newSize ); }
111cdf0e10cSrcweir 
erase(iterator _pos)112cdf0e10cSrcweir         inline iterator erase( iterator _pos )
113cdf0e10cSrcweir         {
114cdf0e10cSrcweir             iterator loop = end();
115cdf0e10cSrcweir             while ( --loop != _pos )
116cdf0e10cSrcweir                 *( loop - 1 ) = *loop;
117cdf0e10cSrcweir             resize( size() - 1 );
118cdf0e10cSrcweir         }
119cdf0e10cSrcweir     };
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     //========================================================================
122cdf0e10cSrcweir     //= UNO helpers
123cdf0e10cSrcweir 	//========================================================================
124cdf0e10cSrcweir #define DECLARE_XCOMPONENT() \
125cdf0e10cSrcweir     virtual void SAL_CALL dispose(  ) throw (::com::sun::star::uno::RuntimeException); \
126cdf0e10cSrcweir     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); \
127cdf0e10cSrcweir     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir #define IMPLEMENT_FORWARD_XCOMPONENT( classname, baseclass ) \
130cdf0e10cSrcweir     void SAL_CALL classname::dispose(  ) throw (::com::sun::star::uno::RuntimeException) \
131cdf0e10cSrcweir     { \
132cdf0e10cSrcweir     baseclass::WeakComponentImplHelperBase::dispose(); \
133cdf0e10cSrcweir     } \
134cdf0e10cSrcweir     void SAL_CALL classname::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \
135cdf0e10cSrcweir     { \
136cdf0e10cSrcweir         baseclass::WeakComponentImplHelperBase::addEventListener( _Listener ); \
137cdf0e10cSrcweir     } \
138cdf0e10cSrcweir     void SAL_CALL classname::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \
139cdf0e10cSrcweir     { \
140cdf0e10cSrcweir         baseclass::WeakComponentImplHelperBase::removeEventListener( _Listener ); \
141cdf0e10cSrcweir     } \
142cdf0e10cSrcweir 
143cdf0e10cSrcweir //............................................................................
144cdf0e10cSrcweir } // namespace pcr
145cdf0e10cSrcweir //............................................................................
146cdf0e10cSrcweir 
147cdf0e10cSrcweir #endif // _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
148cdf0e10cSrcweir 
149