Branch data Line data Source code
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 _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
21 : : #define _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
22 : :
23 : : #define EDITOR_LIST_APPEND (sal_uInt16)-1
24 : : #define EDITOR_LIST_REPLACE_EXISTING (sal_uInt16)-1
25 : :
26 : : #include <com/sun/star/uno/Sequence.hxx>
27 : : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
28 : : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
29 : :
30 : : #include <toolkit/helper/vclunohelper.hxx>
31 : : #include <comphelper/listenernotification.hxx>
32 : :
33 : : //............................................................................
34 : : namespace pcr
35 : : {
36 : : //............................................................................
37 : :
38 : : #define OWN_PROPERTY_ID_INTROSPECTEDOBJECT 0x0010
39 : : #define OWN_PROPERTY_ID_CURRENTPAGE 0x0011
40 : : #define OWN_PROPERTY_ID_CONTROLCONTEXT 0x0012
41 : : #define OWN_PROPERTY_ID_TABBINGMODEL 0x0013
42 : :
43 : : //========================================================================
44 : : //= types
45 : : //========================================================================
46 : : typedef ::comphelper::OSimpleListenerContainer < ::com::sun::star::beans::XPropertyChangeListener
47 : : , ::com::sun::star::beans::PropertyChangeEvent
48 : : > PropertyChangeListeners;
49 : :
50 : : //========================================================================
51 : : //= helper
52 : : //========================================================================
53 : : // small helper to make the "swap" call on an STL container a single-line call, which
54 : : // in it's canonic form "aFoo.swap( Container() )" doesn't compile with GCC
55 : : template< class CONTAINER >
56 : 0 : void clearContainer( CONTAINER& _rContainer )
57 : : {
58 : 0 : CONTAINER aEmpty;
59 : 0 : _rContainer.swap( aEmpty );
60 : 0 : }
61 : :
62 : : //========================================================================
63 : : //= HelpIdUrl
64 : : //========================================================================
65 : : /// small helper to translate help ids into help urls
66 : : class HelpIdUrl
67 : : {
68 : : public:
69 : : static rtl::OString getHelpId( const ::rtl::OUString& _rHelpURL );
70 : : static ::rtl::OUString getHelpURL( const rtl::OString& );
71 : : };
72 : :
73 : : //====================================================================
74 : : //= StlSyntaxSequence
75 : : //====================================================================
76 : : template< class ELEMENT >
77 : 0 : class StlSyntaxSequence : public ::com::sun::star::uno::Sequence< ELEMENT >
78 : : {
79 : : private:
80 : : typedef ::com::sun::star::uno::Sequence< ELEMENT > UnoBase;
81 : :
82 : : public:
83 : 0 : inline StlSyntaxSequence() : UnoBase() { }
84 : 0 : inline StlSyntaxSequence( const UnoBase& rSeq ) : UnoBase( rSeq ) { }
85 : : inline StlSyntaxSequence( const ELEMENT* pElements, sal_Int32 len ) : UnoBase( pElements, len ) { }
86 : 0 : inline StlSyntaxSequence( sal_Int32 len ) : UnoBase( len ) { }
87 : :
88 : : operator const UnoBase&() const { return *this; }
89 : : operator UnoBase&() { return *this; }
90 : :
91 : : typedef const ELEMENT* const_iterator;
92 : : typedef ELEMENT* iterator;
93 : :
94 : 0 : inline const_iterator begin() const { return UnoBase::getConstArray(); }
95 : 0 : inline const_iterator end() const { return UnoBase::getConstArray() + UnoBase::getLength(); }
96 : :
97 : 0 : inline iterator begin() { return UnoBase::getArray(); }
98 : 0 : inline iterator end() { return UnoBase::getArray() + UnoBase::getLength(); }
99 : :
100 : 0 : inline sal_Int32 size() const { return UnoBase::getLength(); }
101 : 0 : inline bool empty() const { return UnoBase::getLength() == 0; }
102 : :
103 : : inline void resize( size_t _newSize ) { UnoBase::realloc( _newSize ); }
104 : :
105 : : inline iterator erase( iterator _pos )
106 : : {
107 : : iterator loop = end();
108 : : while ( --loop != _pos )
109 : : *( loop - 1 ) = *loop;
110 : : resize( size() - 1 );
111 : : }
112 : : };
113 : :
114 : : //========================================================================
115 : : //= UNO helpers
116 : : //========================================================================
117 : : #define DECLARE_XCOMPONENT() \
118 : : virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); \
119 : : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); \
120 : : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
121 : :
122 : : #define IMPLEMENT_FORWARD_XCOMPONENT( classname, baseclass ) \
123 : : void SAL_CALL classname::dispose( ) throw (::com::sun::star::uno::RuntimeException) \
124 : : { \
125 : : baseclass::WeakComponentImplHelperBase::dispose(); \
126 : : } \
127 : : void SAL_CALL classname::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \
128 : : { \
129 : : baseclass::WeakComponentImplHelperBase::addEventListener( _Listener ); \
130 : : } \
131 : : void SAL_CALL classname::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException) \
132 : : { \
133 : : baseclass::WeakComponentImplHelperBase::removeEventListener( _Listener ); \
134 : : } \
135 : :
136 : : //............................................................................
137 : : } // namespace pcr
138 : : //............................................................................
139 : :
140 : : #endif // _EXTENSIONS_PROPCTRLR_PCRCOMMON_HXX_
141 : :
142 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|