1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATTEDFIELD_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATTEDFIELD_HXX
22 #include <cppuhelper/propertysetmixin.hxx>
23 #include <com/sun/star/report/XFormattedField.hpp>
24 #include "ReportControlModel.hxx"
25 #include <comphelper/uno3.hxx>
26 #include <cppuhelper/compbase.hxx>
27 #include <cppuhelper/basemutex.hxx>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <ReportHelperDefines.hxx>
32 namespace reportdesign
34 typedef ::cppu::PropertySetMixin
< css::report::XFormattedField
> FormattedFieldPropertySet
;
35 typedef ::cppu::WeakComponentImplHelper
< css::report::XFormattedField
36 ,css::lang::XServiceInfo
> FormattedFieldBase
;
38 /** \class OFormattedField Defines the implementation of a \interface com:::sun::star::report::XFormattedField
39 * \ingroup reportdesign_api
42 class OFormattedField
: public cppu::BaseMutex
,
43 public FormattedFieldBase
,
44 public FormattedFieldPropertySet
46 friend class OShapeHelper
;
48 OReportControlModel m_aProps
;
49 css::uno::Reference
< css::util::XNumberFormatsSupplier
>
51 ::sal_Int32 m_nFormatKey
;
54 OFormattedField(const OFormattedField
&) = delete;
55 OFormattedField
& operator=(const OFormattedField
&) = delete;
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
60 ,css::style::ParagraphAdjust
& _member
)
64 ::osl::MutexGuard
aGuard(m_aMutex
);
65 if ( static_cast<sal_Int16
>(_member
) != Value
)
67 prepareSet(_sProperty
, css::uno::makeAny(static_cast<sal_Int16
>(_member
)), css::uno::makeAny(Value
), &l
);
68 _member
= static_cast<css::style::ParagraphAdjust
>(Value
);
73 template <typename T
> void set( const OUString
& _sProperty
79 ::osl::MutexGuard
aGuard(m_aMutex
);
80 if ( _member
!= Value
)
82 prepareSet(_sProperty
, css::uno::makeAny(_member
), css::uno::makeAny(Value
), &l
);
88 void set( const OUString
& _sProperty
94 ::osl::MutexGuard
aGuard(m_aMutex
);
95 if ( _member
!= Value
)
97 prepareSet(_sProperty
, css::uno::makeAny(_member
), css::uno::makeAny(Value
), &l
);
104 virtual ~OFormattedField() override
;
106 explicit OFormattedField(css::uno::Reference
< css::uno::XComponentContext
> const & _xContext
);
107 explicit OFormattedField(css::uno::Reference
< css::uno::XComponentContext
> const & _xContext
108 ,const css::uno::Reference
< css::lang::XMultiServiceFactory
> & _xFactory
109 ,css::uno::Reference
< css::drawing::XShape
>& _xShape
);
111 DECLARE_XINTERFACE( )
112 // css::lang::XServiceInfo
113 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
114 virtual OUString SAL_CALL
getImplementationName( ) override
;
115 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
117 /// @throws css::uno::RuntimeException
118 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
119 /// @throws css::uno::RuntimeException
120 static OUString
getImplementationName_Static();
121 static css::uno::Reference
< css::uno::XInterface
>
122 create(css::uno::Reference
< css::uno::XComponentContext
> const & xContext
);
123 // css::beans::XPropertySet
124 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
125 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
126 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
127 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
128 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
129 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
130 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
133 virtual void SAL_CALL
addContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) override
;
134 virtual void SAL_CALL
removeContainerListener( const css::uno::Reference
< css::container::XContainerListener
>& xListener
) override
;
137 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
138 virtual sal_Bool SAL_CALL
hasElements( ) override
;
141 virtual void SAL_CALL
replaceByIndex( ::sal_Int32 Index
, const css::uno::Any
& Element
) override
;
144 virtual void SAL_CALL
insertByIndex( ::sal_Int32 Index
, const css::uno::Any
& Element
) override
;
145 virtual void SAL_CALL
removeByIndex( ::sal_Int32 Index
) override
;
148 virtual ::sal_Int32 SAL_CALL
getCount( ) override
;
149 virtual css::uno::Any SAL_CALL
getByIndex( ::sal_Int32 Index
) override
;
152 REPORTCOMPONENT_HEADER()
158 virtual OUString SAL_CALL
getShapeType( ) override
;
160 // XReportControlModel
161 REPORTCONTROLMODEL_HEADER()
163 // XReportControlFormat
164 REPORTCONTROLFORMAT_HEADER()
167 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone( ) override
;
170 virtual ::sal_Int32 SAL_CALL
getFormatKey() override
;
171 virtual void SAL_CALL
setFormatKey(::sal_Int32 the_value
) override
;
172 virtual css::uno::Reference
< css::util::XNumberFormatsSupplier
> SAL_CALL
getFormatsSupplier() override
;
173 virtual void SAL_CALL
setFormatsSupplier( const css::uno::Reference
< css::util::XNumberFormatsSupplier
>& _formatssupplier
) override
;
176 virtual void SAL_CALL
dispose() override
;
177 virtual void SAL_CALL
addEventListener(const css::uno::Reference
< css::lang::XEventListener
> & aListener
) override
179 cppu::WeakComponentImplHelperBase::addEventListener(aListener
);
181 virtual void SAL_CALL
removeEventListener(const css::uno::Reference
< css::lang::XEventListener
> & aListener
) override
183 cppu::WeakComponentImplHelperBase::removeEventListener(aListener
);
187 virtual css::uno::Reference
< css::uno::XInterface
> SAL_CALL
getParent( ) override
;
188 virtual void SAL_CALL
setParent( const css::uno::Reference
< css::uno::XInterface
>& Parent
) override
;
191 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_FORMATTEDFIELD_HXX
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */