LibreOffice Module reportdesign (master) 1
FormattedField.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#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATTEDFIELD_HXX
20#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATTEDFIELD_HXX
21
23#include <com/sun/star/report/XFormattedField.hpp>
25#include <comphelper/uno3.hxx>
28#include <com/sun/star/lang/XServiceInfo.hpp>
30
31
32namespace reportdesign
33{
34 typedef ::cppu::PropertySetMixin< css::report::XFormattedField > FormattedFieldPropertySet;
35 typedef ::cppu::WeakComponentImplHelper< css::report::XFormattedField
36 ,css::lang::XServiceInfo > FormattedFieldBase;
37
42 class OFormattedField final : public cppu::BaseMutex,
43 public FormattedFieldBase,
45 {
46 friend class OShapeHelper;
47
49 css::uno::Reference< css::util::XNumberFormatsSupplier >
51 ::sal_Int32 m_nFormatKey;
52
53 private:
56
57 // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16
58 void set( const OUString& _sProperty
59 ,sal_Int16 Value
60 ,css::style::ParagraphAdjust& _member)
61 {
62 BoundListeners l;
63 {
64 ::osl::MutexGuard aGuard(m_aMutex);
65 if ( static_cast<sal_Int16>(_member) != Value )
66 {
67 prepareSet(_sProperty, css::uno::Any(static_cast<sal_Int16>(_member)), css::uno::Any(Value), &l);
68 _member = static_cast<css::style::ParagraphAdjust>(Value);
69 }
70 }
71 l.notify();
72 }
73 template <typename T> void set( const OUString& _sProperty
74 ,const T& Value
75 ,T& _member)
76 {
77 BoundListeners l;
78 {
79 ::osl::MutexGuard aGuard(m_aMutex);
80 if ( _member != Value )
81 {
82 prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
83 _member = Value;
84 }
85 }
86 l.notify();
87 }
88 void set( const OUString& _sProperty
89 ,bool Value
90 ,bool& _member)
91 {
92 BoundListeners l;
93 {
94 ::osl::MutexGuard aGuard(m_aMutex);
95 if ( _member != Value )
96 {
97 prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
98 _member = Value;
99 }
100 }
101 l.notify();
102 }
103 virtual ~OFormattedField() override;
104 public:
105 explicit OFormattedField(css::uno::Reference< css::uno::XComponentContext > const & _xContext);
106 explicit OFormattedField(css::uno::Reference< css::uno::XComponentContext > const & _xContext
107 ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory
108 ,css::uno::Reference< css::drawing::XShape >& _xShape);
109
111 // css::lang::XServiceInfo
112 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
113 virtual OUString SAL_CALL getImplementationName( ) override;
114 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
115
117 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
119 static OUString getImplementationName_Static();
120 static css::uno::Reference< css::uno::XInterface >
121 create(css::uno::Reference< css::uno::XComponentContext > const & xContext);
122 // css::beans::XPropertySet
123 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
124 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
125 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
126 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
127 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
128 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
129 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
130
131 // XContainer
132 virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
133 virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
134
135 // XElementAccess
136 virtual css::uno::Type SAL_CALL getElementType( ) override;
137 virtual sal_Bool SAL_CALL hasElements( ) override;
138
139 // XIndexReplace
140 virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
141
142 // XIndexContainer
143 virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
144 virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override;
145
146 // XIndexAccess
147 virtual ::sal_Int32 SAL_CALL getCount( ) override;
148 virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
149
150 // XReportComponent
152
153 // XShape
155
156 // XShapeDescriptor
157 virtual OUString SAL_CALL getShapeType( ) override;
158
159 // XReportControlModel
161
162 // XReportControlFormat
164
165 // XCloneable
166 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
167
168 // XFormattedField
169 virtual ::sal_Int32 SAL_CALL getFormatKey() override;
170 virtual void SAL_CALL setFormatKey(::sal_Int32 the_value) override;
171 virtual css::uno::Reference< css::util::XNumberFormatsSupplier > SAL_CALL getFormatsSupplier() override;
172 virtual void SAL_CALL setFormatsSupplier( const css::uno::Reference< css::util::XNumberFormatsSupplier >& _formatssupplier ) override;
173
174 // XComponent
175 virtual void SAL_CALL dispose() override;
176 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
177 {
178 cppu::WeakComponentImplHelperBase::addEventListener(aListener);
179 }
180 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
181 {
182 cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
183 }
184
185 // XChild
186 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
187 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
188 };
189}
190#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATTEDFIELD_HXX
191
192/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
#define REPORTCONTROLMODEL_HEADER()
#define SHAPE_HEADER()
#define REPORTCONTROLFORMAT_HEADER()
#define REPORTCOMPONENT_HEADER()
mutable::osl::Mutex m_aMutex
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual ::sal_Int32 SAL_CALL getCount() override
virtual void SAL_CALL removeByIndex(::sal_Int32 Index) override
virtual ~OFormattedField() override
virtual void SAL_CALL setFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > &_formatssupplier) override
OFormattedField & operator=(const OFormattedField &)=delete
css::uno::Reference< css::util::XNumberFormatsSupplier > m_xFormatsSupplier
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
OFormattedField(css::uno::Reference< css::uno::XComponentContext > const &_xContext)
virtual void SAL_CALL insertByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL dispose() override
static css::uno::Reference< css::uno::XInterface > create(css::uno::Reference< css::uno::XComponentContext > const &xContext)
void set(const OUString &_sProperty, sal_Int16 Value, css::style::ParagraphAdjust &_member)
void set(const OUString &_sProperty, bool Value, bool &_member)
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual void SAL_CALL setFormatKey(::sal_Int32 the_value) override
OFormattedField(css::uno::Reference< css::uno::XComponentContext > const &_xContext, const css::uno::Reference< css::lang::XMultiServiceFactory > &_xFactory, css::uno::Reference< css::drawing::XShape > &_xShape)
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
virtual void SAL_CALL replaceByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
virtual OUString SAL_CALL getImplementationName() override
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
void set(const OUString &_sProperty, const T &Value, T &_member)
OReportControlModel m_aProps
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
OFormattedField(const OFormattedField &)=delete
virtual OUString SAL_CALL getShapeType() override
virtual ::sal_Int32 SAL_CALL getFormatKey() override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Reference< css::util::XNumberFormatsSupplier > SAL_CALL getFormatsSupplier() override
virtual css::uno::Any SAL_CALL getByIndex(::sal_Int32 Index) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
static OUString getImplementationName_Static()
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Value
::cppu::WeakComponentImplHelper< css::report::XFormattedField,css::lang::XServiceInfo > FormattedFieldBase
::cppu::PropertySetMixin< css::report::XFormattedField > FormattedFieldPropertySet
unsigned char sal_Bool
#define DECLARE_XINTERFACE()