LibreOffice Module extensions (master) 1
pcrcommon.hxx
Go to the documentation of this file.
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#pragma once
21
22#define EDITOR_LIST_APPEND (SAL_MAX_UINT16)
23#define EDITOR_LIST_ENTRY_NOTFOUND (SAL_MAX_UINT16)
24
25#include <sal/config.h>
26
27#include <com/sun/star/uno/Sequence.hxx>
28#include <com/sun/star/beans/XPropertyChangeListener.hpp>
30
31namespace pcr
32{
33
34 enum class OwnPropertyId
35 {
36 INTROSPECTEDOBJECT = 0x0010,
37 CURRENTPAGE = 0x0011,
38 CONTROLCONTEXT = 0x0012,
39 TABBINGMODEL = 0x0013
40 };
41
42
43 //= types
44
45 typedef ::comphelper::OInterfaceContainerHelper3 < css::beans::XPropertyChangeListener
47
48
49 //= helper
50
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 )
55 {
56 CONTAINER().swap(_rContainer);
57 }
58
59
60 //= HelpIdUrl
61
64 {
65 public:
66 static OUString getHelpId( std::u16string_view _rHelpURL );
67 static OUString getHelpURL( std::u16string_view );
68 };
69
70
71 //= StlSyntaxSequence
72
73 template< class ELEMENT >
74 class StlSyntaxSequence : public css::uno::Sequence< ELEMENT >
75 {
76 private:
77 typedef css::uno::Sequence< ELEMENT > UnoBase;
78
79 public:
81 explicit StlSyntaxSequence( const UnoBase& rSeq ) : UnoBase( rSeq ) { }
82 explicit StlSyntaxSequence( sal_Int32 len ) : UnoBase( len ) { }
83
84 typedef const ELEMENT* const_iterator;
85 typedef ELEMENT* iterator;
86
87 const_iterator begin() const { return UnoBase::getConstArray(); }
88 const_iterator end() const { return UnoBase::getConstArray() + UnoBase::getLength(); }
89
90 iterator begin() { return UnoBase::getArray(); }
91 iterator end() { return UnoBase::getArray() + UnoBase::getLength(); }
92
93 sal_Int32 size() const { return UnoBase::getLength(); }
94 bool empty() const { return !UnoBase::hasElements(); }
95 };
96
97
98 //= UNO helpers
99
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;
104
105#define IMPLEMENT_FORWARD_XCOMPONENT( classname, baseclass ) \
106 void SAL_CALL classname::dispose( ) \
107 { \
108 baseclass::WeakComponentImplHelperBase::dispose(); \
109 } \
110 void SAL_CALL classname::addEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) \
111 { \
112 baseclass::WeakComponentImplHelperBase::addEventListener( Listener ); \
113 } \
114 void SAL_CALL classname::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& Listener ) \
115 { \
116 baseclass::WeakComponentImplHelperBase::removeEventListener( Listener ); \
117 } \
118
119
120} // namespace pcr
121
122
123/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
small helper to translate help ids into help urls
Definition: pcrcommon.hxx:64
static OUString getHelpId(std::u16string_view _rHelpURL)
Definition: pcrcommon.cxx:37
static OUString getHelpURL(std::u16string_view)
Definition: pcrcommon.cxx:47
const_iterator end() const
Definition: pcrcommon.hxx:88
const ELEMENT * const_iterator
Definition: pcrcommon.hxx:84
bool empty() const
Definition: pcrcommon.hxx:94
const_iterator begin() const
Definition: pcrcommon.hxx:87
StlSyntaxSequence(sal_Int32 len)
Definition: pcrcommon.hxx:82
sal_Int32 size() const
Definition: pcrcommon.hxx:93
StlSyntaxSequence(const UnoBase &rSeq)
Definition: pcrcommon.hxx:81
css::uno::Sequence< ELEMENT > UnoBase
Definition: pcrcommon.hxx:77
a property handler for any virtual string properties
Definition: browserline.cxx:39
::comphelper::OInterfaceContainerHelper3< css::beans::XPropertyChangeListener > PropertyChangeListeners
Definition: pcrcommon.hxx:46
void clearContainer(CONTAINER &_rContainer)
Definition: pcrcommon.hxx:54
OwnPropertyId
Definition: pcrcommon.hxx:35