lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / reportdesign / source / core / inc / FixedText.hxx
blob03126ab30e5f0b2774e4d528475d43b783ca7d7b
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 #ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX
21 #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX
23 #include <cppuhelper/propertysetmixin.hxx>
24 #include <com/sun/star/report/XFixedText.hpp>
25 #include "ReportControlModel.hxx"
26 #include <comphelper/uno3.hxx>
27 #include <cppuhelper/compbase.hxx>
28 #include <cppuhelper/basemutex.hxx>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <ReportHelperDefines.hxx>
33 namespace reportdesign
35 typedef ::cppu::PropertySetMixin< css::report::XFixedText > FixedTextPropertySet;
36 typedef ::cppu::WeakComponentImplHelper< css::report::XFixedText
37 ,css::lang::XServiceInfo > FixedTextBase;
39 /** \class OFixedText Defines the implementation of a \interface com:::sun::star::report::XFixedText
40 * \ingroup reportdesign_api
43 class OFixedText : public cppu::BaseMutex,
44 public FixedTextBase,
45 public FixedTextPropertySet
47 friend class OShapeHelper;
48 OReportControlModel m_aProps;
49 OUString m_sLabel;
50 private:
51 OFixedText(const OFixedText&) = delete;
52 OFixedText& operator=(const OFixedText&) = delete;
54 // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16
55 void set( const OUString& _sProperty
56 ,sal_Int16 Value
57 ,css::style::ParagraphAdjust& _member)
59 BoundListeners l;
61 ::osl::MutexGuard aGuard(m_aMutex);
62 if ( static_cast<sal_Int16>(_member) != Value )
64 prepareSet(_sProperty, css::uno::makeAny(static_cast<sal_Int16>(_member)), css::uno::makeAny(Value), &l);
65 _member = static_cast<css::style::ParagraphAdjust>(Value);
68 l.notify();
70 template <typename T> void set( const OUString& _sProperty
71 ,const T& Value
72 ,T& _member)
74 BoundListeners l;
76 ::osl::MutexGuard aGuard(m_aMutex);
77 if ( _member != Value )
79 prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
80 _member = Value;
83 l.notify();
85 void set( const OUString& _sProperty
86 ,bool Value
87 ,bool& _member)
89 BoundListeners l;
91 ::osl::MutexGuard aGuard(m_aMutex);
92 if ( _member != Value )
94 prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
95 _member = Value;
98 l.notify();
100 protected:
101 virtual ~OFixedText() override;
102 public:
103 explicit OFixedText(css::uno::Reference< css::uno::XComponentContext > const & _xContext);
104 explicit OFixedText(css::uno::Reference< css::uno::XComponentContext > const & _xContext
105 ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory
106 ,css::uno::Reference< css::drawing::XShape >& _xShape);
108 DECLARE_XINTERFACE( )
109 // css::lang::XServiceInfo
110 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
111 virtual OUString SAL_CALL getImplementationName( ) override;
112 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
114 /// @throws css::uno::RuntimeException
115 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
116 /// @throws css::uno::RuntimeException
117 static OUString getImplementationName_Static();
118 static css::uno::Reference< css::uno::XInterface >
119 create(css::uno::Reference< css::uno::XComponentContext > const & xContext);
120 // css::beans::XPropertySet
121 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
122 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
123 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
124 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
125 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
126 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
127 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
129 // XReportComponent
130 REPORTCOMPONENT_HEADER()
131 // XShape
132 SHAPE_HEADER()
134 // XShapeDescriptor
135 virtual OUString SAL_CALL getShapeType( ) override;
137 // XReportControlModel
138 REPORTCONTROLMODEL_HEADER()
140 // XCloneable
141 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
143 // XFixedText
144 virtual OUString SAL_CALL getLabel() override;
145 virtual void SAL_CALL setLabel( const OUString& _label ) override;
147 // css::report::XReportControlFormat
148 REPORTCONTROLFORMAT_HEADER()
150 // XComponent
151 virtual void SAL_CALL dispose() override;
152 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
154 cppu::WeakComponentImplHelperBase::addEventListener(aListener);
156 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
158 cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
161 // XChild
162 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
163 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
164 // XContainer
165 virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
166 virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
168 // XElementAccess
169 virtual css::uno::Type SAL_CALL getElementType( ) override;
170 virtual sal_Bool SAL_CALL hasElements( ) override;
172 // XIndexReplace
173 virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
175 // XIndexContainer
176 virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
177 virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override;
179 // XIndexAccess
180 virtual ::sal_Int32 SAL_CALL getCount( ) override;
181 virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
184 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */