LibreOffice Module reportdesign (master)  1
FixedText.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 #ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX
21 #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX
22 
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>
31 
32 
33 namespace reportdesign
34 {
35  typedef ::cppu::PropertySetMixin< css::report::XFixedText > FixedTextPropertySet;
36  typedef ::cppu::WeakComponentImplHelper< css::report::XFixedText
37  ,css::lang::XServiceInfo > FixedTextBase;
38 
43  class OFixedText final : public cppu::BaseMutex,
44  public FixedTextBase,
45  public FixedTextPropertySet
46  {
47  friend class OShapeHelper;
49  OUString m_sLabel;
50  private:
51  OFixedText(const OFixedText&) = delete;
52  OFixedText& operator=(const OFixedText&) = delete;
53 
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)
58  {
59  BoundListeners l;
60  {
61  ::osl::MutexGuard aGuard(m_aMutex);
62  if ( static_cast<sal_Int16>(_member) != Value )
63  {
64  prepareSet(_sProperty, css::uno::Any(static_cast<sal_Int16>(_member)), css::uno::Any(Value), &l);
65  _member = static_cast<css::style::ParagraphAdjust>(Value);
66  }
67  }
68  l.notify();
69  }
70  template <typename T> void set( const OUString& _sProperty
71  ,const T& Value
72  ,T& _member)
73  {
74  BoundListeners l;
75  {
76  ::osl::MutexGuard aGuard(m_aMutex);
77  if ( _member != Value )
78  {
79  prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
80  _member = Value;
81  }
82  }
83  l.notify();
84  }
85  void set( const OUString& _sProperty
86  ,bool Value
87  ,bool& _member)
88  {
89  BoundListeners l;
90  {
91  ::osl::MutexGuard aGuard(m_aMutex);
92  if ( _member != Value )
93  {
94  prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
95  _member = Value;
96  }
97  }
98  l.notify();
99  }
100  virtual ~OFixedText() override;
101  public:
102  explicit OFixedText(css::uno::Reference< css::uno::XComponentContext > const & _xContext);
103  explicit OFixedText(css::uno::Reference< css::uno::XComponentContext > const & _xContext
104  ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory
105  ,css::uno::Reference< css::drawing::XShape >& _xShape);
106 
108  // css::lang::XServiceInfo
109  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
110  virtual OUString SAL_CALL getImplementationName( ) override;
111  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
112 
114  static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
116  static OUString getImplementationName_Static();
117  static css::uno::Reference< css::uno::XInterface >
118  create(css::uno::Reference< css::uno::XComponentContext > const & xContext);
119  // css::beans::XPropertySet
120  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
121  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
122  virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
123  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
124  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
125  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
126  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
127 
128  // XReportComponent
130  // XShape
131  SHAPE_HEADER()
132 
133  // XShapeDescriptor
134  virtual OUString SAL_CALL getShapeType( ) override;
135 
136  // XReportControlModel
138 
139  // XCloneable
140  virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
141 
142  // XFixedText
143  virtual OUString SAL_CALL getLabel() override;
144  virtual void SAL_CALL setLabel( const OUString& _label ) override;
145 
146  // css::report::XReportControlFormat
148 
149  // XComponent
150  virtual void SAL_CALL dispose() override;
151  virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
152  {
153  cppu::WeakComponentImplHelperBase::addEventListener(aListener);
154  }
155  virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
156  {
157  cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
158  }
159 
160  // XChild
161  virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
162  virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
163  // XContainer
164  virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
165  virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
166 
167  // XElementAccess
168  virtual css::uno::Type SAL_CALL getElementType( ) override;
169  virtual sal_Bool SAL_CALL hasElements( ) override;
170 
171  // XIndexReplace
172  virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
173 
174  // XIndexContainer
175  virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
176  virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override;
177 
178  // XIndexAccess
179  virtual ::sal_Int32 SAL_CALL getCount( ) override;
180  virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
181  };
182 }
183 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX
184 
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL dispose() override
Definition: FixedText.cxx:84
virtual OUString SAL_CALL getShapeType() override
Definition: FixedText.cxx:311
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: FixedText.hxx:155
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: FixedText.cxx:223
OFixedText & operator=(const OFixedText &)=delete
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: FixedText.cxx:136
virtual ::sal_Int32 SAL_CALL getCount() override
Definition: FixedText.cxx:278
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
Definition: FixedText.cxx:102
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: FixedText.cxx:131
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: FixedText.cxx:120
implementation of a
Definition: FixedText.hxx:43
virtual css::uno::Type SAL_CALL getElementType() override
Definition: FixedText.cxx:250
void set(const OUString &_sProperty, sal_Int16 Value, css::style::ParagraphAdjust &_member)
Definition: FixedText.hxx:55
::cppu::WeakComponentImplHelper< css::report::XFixedText,css::lang::XServiceInfo > FixedTextBase
Definition: FixedText.hxx:37
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
Definition: FixedText.cxx:202
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: FixedText.hxx:151
mutable::osl::Mutex m_aMutex
#define REPORTCONTROLFORMAT_HEADER()
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: FixedText.cxx:146
virtual void SAL_CALL insertByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
Definition: FixedText.cxx:261
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: FixedText.cxx:161
OReportControlModel m_aProps
Definition: FixedText.hxx:48
virtual void SAL_CALL setLabel(const OUString &_label) override
Definition: FixedText.cxx:217
#define REPORTCOMPONENT_HEADER()
virtual void SAL_CALL removeByIndex(::sal_Int32 Index) override
Definition: FixedText.cxx:266
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: FixedText.cxx:115
static css::uno::Reference< css::uno::XInterface > create(css::uno::Reference< css::uno::XComponentContext > const &xContext)
Definition: FixedText.cxx:109
static OUString getImplementationName_Static()
Definition: FixedText.cxx:91
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: FixedText.cxx:156
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: FixedText.cxx:244
#define SHAPE_HEADER()
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: FixedText.cxx:141
unsigned char sal_Bool
OFixedText(const OFixedText &)=delete
virtual OUString SAL_CALL getLabel() override
Definition: FixedText.cxx:211
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: FixedText.cxx:151
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
virtual ~OFixedText() override
Definition: FixedText.cxx:66
void set(const OUString &_sProperty, const T &Value, T &_member)
Definition: FixedText.hxx:70
virtual css::uno::Any SAL_CALL getByIndex(::sal_Int32 Index) override
Definition: FixedText.cxx:283
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: FixedText.cxx:239
virtual OUString SAL_CALL getImplementationName() override
Definition: FixedText.cxx:97
virtual sal_Bool SAL_CALL hasElements() override
Definition: FixedText.cxx:255
virtual void SAL_CALL replaceByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
Definition: FixedText.cxx:272
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: FixedText.cxx:228
#define REPORTCONTROLMODEL_HEADER()
void set(const OUString &_sProperty, bool Value, bool &_member)
Definition: FixedText.hxx:85
struct _ADOIndex Index
::cppu::PropertySetMixin< css::report::XFixedText > FixedTextPropertySet
Definition: FixedText.hxx:35
#define DECLARE_XINTERFACE()