1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMON_HXX
21 #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMON_HXX
23 #define EDITOR_LIST_APPEND (SAL_MAX_UINT16)
24 #define EDITOR_LIST_REPLACE_EXISTING (SAL_MAX_UINT16)
25 #define EDITOR_LIST_ENTRY_NOTFOUND (SAL_MAX_UINT16)
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
29 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
31 #include <toolkit/helper/vclunohelper.hxx>
32 #include <comphelper/listenernotification.hxx>
39 #define OWN_PROPERTY_ID_INTROSPECTEDOBJECT 0x0010
40 #define OWN_PROPERTY_ID_CURRENTPAGE 0x0011
41 #define OWN_PROPERTY_ID_CONTROLCONTEXT 0x0012
42 #define OWN_PROPERTY_ID_TABBINGMODEL 0x0013
47 typedef ::comphelper::OSimpleListenerContainer
< ::com::sun::star::beans::XPropertyChangeListener
48 , ::com::sun::star::beans::PropertyChangeEvent
49 > PropertyChangeListeners
;
54 // small helper to make the "swap" call on an STL container a single-line call, which
55 // in it's canonic form "aFoo.swap( Container() )" doesn't compile with GCC
56 template< class CONTAINER
>
57 void clearContainer( CONTAINER
& _rContainer
)
60 _rContainer
.swap( aEmpty
);
66 /// small helper to translate help ids into help urls
70 static OString
getHelpId( const OUString
& _rHelpURL
);
71 static OUString
getHelpURL( const OString
& );
77 template< class ELEMENT
>
78 class StlSyntaxSequence
: public ::com::sun::star::uno::Sequence
< ELEMENT
>
81 typedef ::com::sun::star::uno::Sequence
< ELEMENT
> UnoBase
;
84 inline StlSyntaxSequence() : UnoBase() { }
85 inline StlSyntaxSequence( const UnoBase
& rSeq
) : UnoBase( rSeq
) { }
86 inline StlSyntaxSequence( const ELEMENT
* pElements
, sal_Int32 len
) : UnoBase( pElements
, len
) { }
87 inline StlSyntaxSequence( sal_Int32 len
) : UnoBase( len
) { }
89 operator const UnoBase
&() const { return *this; }
90 operator UnoBase
&() { return *this; }
92 typedef const ELEMENT
* const_iterator
;
93 typedef ELEMENT
* iterator
;
95 inline const_iterator
begin() const { return UnoBase::getConstArray(); }
96 inline const_iterator
end() const { return UnoBase::getConstArray() + UnoBase::getLength(); }
98 inline iterator
begin() { return UnoBase::getArray(); }
99 inline iterator
end() { return UnoBase::getArray() + UnoBase::getLength(); }
101 inline sal_Int32
size() const { return UnoBase::getLength(); }
102 inline bool empty() const { return UnoBase::getLength() == 0; }
104 inline void resize( size_t _newSize
) { UnoBase::realloc( _newSize
); }
106 inline iterator
erase( iterator _pos
)
108 iterator loop
= end();
109 while ( --loop
!= _pos
)
110 *( loop
- 1 ) = *loop
;
111 resize( size() - 1 );
118 #define DECLARE_XCOMPONENT() \
119 virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \
120 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \
121 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 #define IMPLEMENT_FORWARD_XCOMPONENT( classname, baseclass ) \
124 void SAL_CALL classname::dispose( ) throw (::com::sun::star::uno::RuntimeException, std::exception) \
126 baseclass::WeakComponentImplHelperBase::dispose(); \
128 void SAL_CALL classname::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException, std::exception) \
130 baseclass::WeakComponentImplHelperBase::addEventListener( _Listener ); \
132 void SAL_CALL classname::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _Listener ) throw (::com::sun::star::uno::RuntimeException, std::exception) \
134 baseclass::WeakComponentImplHelperBase::removeEventListener( _Listener ); \
141 #endif // INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_PCRCOMMON_HXX
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */