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 : 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::makeAny(static_cast<sal_Int16>(_member)), css::uno::makeAny(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::makeAny(_member), css::uno::makeAny(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::makeAny(_member), css::uno::makeAny(Value), &l);
95  _member = Value;
96  }
97  }
98  l.notify();
99  }
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);
107 
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;
113 
114  // css::beans::XPropertySet
115  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
116  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
117  virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
118  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
119  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
120  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
121  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
122 
123  // XReportComponent
125  // XShape
126  SHAPE_HEADER()
127 
128  // XShapeDescriptor
129  virtual OUString SAL_CALL getShapeType( ) override;
130 
131  // XReportControlModel
133 
134  // XCloneable
135  virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
136 
137  // XFixedText
138  virtual OUString SAL_CALL getLabel() override;
139  virtual void SAL_CALL setLabel( const OUString& _label ) override;
140 
141  // css::report::XReportControlFormat
143 
144  // XComponent
145  virtual void SAL_CALL dispose() override;
146  virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
147  {
148  cppu::WeakComponentImplHelperBase::addEventListener(aListener);
149  }
150  virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
151  {
152  cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
153  }
154 
155  // XChild
156  virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
157  virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
158  // XContainer
159  virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
160  virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
161 
162  // XElementAccess
163  virtual css::uno::Type SAL_CALL getElementType( ) override;
164  virtual sal_Bool SAL_CALL hasElements( ) override;
165 
166  // XIndexReplace
167  virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
168 
169  // XIndexContainer
170  virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
171  virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override;
172 
173  // XIndexAccess
174  virtual ::sal_Int32 SAL_CALL getCount( ) override;
175  virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
176  };
177 }
178 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FIXEDTEXT_HXX
179 
180 /* 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:292
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: FixedText.hxx:150
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: FixedText.cxx:204
OFixedText & operator=(const OFixedText &)=delete
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: FixedText.cxx:117
virtual ::sal_Int32 SAL_CALL getCount() override
Definition: FixedText.cxx:259
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: FixedText.cxx:112
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: FixedText.cxx:101
implementation of a
Definition: FixedText.hxx:43
virtual css::uno::Type SAL_CALL getElementType() override
Definition: FixedText.cxx:231
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:183
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: FixedText.hxx:146
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:127
virtual void SAL_CALL insertByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
Definition: FixedText.cxx:242
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: FixedText.cxx:142
OReportControlModel m_aProps
Definition: FixedText.hxx:48
virtual void SAL_CALL setLabel(const OUString &_label) override
Definition: FixedText.cxx:198
#define REPORTCOMPONENT_HEADER()
virtual void SAL_CALL removeByIndex(::sal_Int32 Index) override
Definition: FixedText.cxx:247
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: FixedText.cxx:96
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: FixedText.cxx:137
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: FixedText.cxx:225
#define SHAPE_HEADER()
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: FixedText.cxx:122
unsigned char sal_Bool
OFixedText(const OFixedText &)=delete
virtual OUString SAL_CALL getLabel() override
Definition: FixedText.cxx:192
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: FixedText.cxx:132
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:264
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: FixedText.cxx:220
virtual OUString SAL_CALL getImplementationName() override
Definition: FixedText.cxx:91
virtual sal_Bool SAL_CALL hasElements() override
Definition: FixedText.cxx:236
virtual void SAL_CALL replaceByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
Definition: FixedText.cxx:253
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: FixedText.cxx:209
#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()