cid#1636693 COPY_INSTEAD_OF_MOVE
[LibreOffice.git] / extensions / source / propctrlr / pcrcommon.hxx
blobf2a8b847c00090edd4126ee77fde3a05aa5aacd8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #define EDITOR_LIST_APPEND (SAL_MAX_UINT16)
23 #define EDITOR_LIST_ENTRY_NOTFOUND (SAL_MAX_UINT16)
25 #include <sal/config.h>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
29 #include <comphelper/interfacecontainer3.hxx>
31 namespace pcr
34 enum class OwnPropertyId
36 INTROSPECTEDOBJECT = 0x0010,
37 CURRENTPAGE = 0x0011,
38 CONTROLCONTEXT = 0x0012,
39 TABBINGMODEL = 0x0013
43 //= types
45 typedef ::comphelper::OInterfaceContainerHelper3 < css::beans::XPropertyChangeListener
46 > PropertyChangeListeners;
49 //= helper
51 // small helper to make the "swap" call on an STL container a single-line call, which
52 // in its canonic form "aFoo.swap( Container() )" doesn't compile with GCC
53 template< class CONTAINER >
54 void clearContainer( CONTAINER& _rContainer )
56 CONTAINER().swap(_rContainer);
60 //= HelpIdUrl
62 /// small helper to translate help ids into help urls
63 class HelpIdUrl
65 public:
66 static OUString getHelpId( std::u16string_view _rHelpURL );
67 static OUString getHelpURL( std::u16string_view );
71 //= StlSyntaxSequence
73 template< class ELEMENT >
74 class StlSyntaxSequence : public css::uno::Sequence< ELEMENT >
76 private:
77 typedef css::uno::Sequence< ELEMENT > UnoBase;
79 public:
80 StlSyntaxSequence() : UnoBase() { }
81 explicit StlSyntaxSequence( const UnoBase& rSeq ) : UnoBase( rSeq ) { }
82 explicit StlSyntaxSequence( sal_Int32 len ) : UnoBase( len ) { }
84 typedef const ELEMENT* const_iterator;
85 typedef ELEMENT* iterator;
87 const_iterator begin() const { return UnoBase::getConstArray(); }
88 const_iterator end() const { return UnoBase::getConstArray() + UnoBase::getLength(); }
90 iterator begin() { return UnoBase::getArray(); }
91 iterator end() { return UnoBase::getArray() + UnoBase::getLength(); }
93 sal_Int32 size() const { return UnoBase::getLength(); }
94 bool empty() const { return !UnoBase::hasElements(); }
98 //= UNO helpers
100 #define DECLARE_XCOMPONENT() \
101 virtual void SAL_CALL dispose( ) override; \
102 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; \
103 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
105 #define IMPLEMENT_FORWARD_XCOMPONENT( classname, baseclass ) \
106 void SAL_CALL classname::dispose( ) \
108 baseclass::WeakComponentImplHelperBase::dispose(); \
110 void SAL_CALL classname::addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) \
112 baseclass::WeakComponentImplHelperBase::addEventListener( Listener ); \
114 void SAL_CALL classname::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) \
116 baseclass::WeakComponentImplHelperBase::removeEventListener( Listener ); \
120 } // namespace pcr
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */