LibreOffice Module svl (master) 1
numfmuno.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_SVL_SOURCE_NUMBERS_NUMFMUNO_HXX
21#define INCLUDED_SVL_SOURCE_NUMBERS_NUMFMUNO_HXX
22
23#include <com/sun/star/util/XNumberFormatter2.hpp>
24#include <com/sun/star/util/XNumberFormats.hpp>
25#include <com/sun/star/util/XNumberFormatTypes.hpp>
26#include <com/sun/star/lang/XServiceInfo.hpp>
27#include <com/sun/star/beans/XPropertyAccess.hpp>
30#include <rtl/ref.hxx>
31#include <tools/solar.h>
32
34
35
39class SvNumberFormatterServiceObj : public cppu::WeakImplHelper<
40 css::util::XNumberFormatter2,
41 css::lang::XServiceInfo>
42{
43private:
45 mutable ::comphelper::SharedMutex m_aMutex;
46
47public:
49 virtual ~SvNumberFormatterServiceObj() override;
50
51 // XNumberFormatter
52 virtual void SAL_CALL attachNumberFormatsSupplier(
53 const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier ) override;
54 virtual css::uno::Reference< css::util::XNumberFormatsSupplier >
55 SAL_CALL getNumberFormatsSupplier() override;
56 virtual sal_Int32 SAL_CALL detectNumberFormat( sal_Int32 nKey, const OUString& aString ) override;
57 virtual double SAL_CALL convertStringToNumber( sal_Int32 nKey, const OUString& aString ) override;
58 virtual OUString SAL_CALL convertNumberToString( sal_Int32 nKey, double fValue ) override;
59 virtual sal_Int32 SAL_CALL queryColorForNumber( sal_Int32 nKey,
60 double fValue, sal_Int32 aDefaultColor ) override;
61 virtual OUString SAL_CALL formatString( sal_Int32 nKey, const OUString& aString ) override;
62 virtual sal_Int32 SAL_CALL queryColorForString( sal_Int32 nKey,
63 const OUString& aString,
64 sal_Int32 aDefaultColor ) override;
65 virtual OUString SAL_CALL getInputString( sal_Int32 nKey, double fValue ) override;
66
67 // XNumberFormatPreviewer
68 virtual OUString SAL_CALL convertNumberToPreviewString(
69 const OUString& aFormat, double fValue,
70 const css::lang::Locale& nLocale, sal_Bool bAllowEnglish ) override;
71 virtual sal_Int32 SAL_CALL queryPreviewColorForNumber(
72 const OUString& aFormat, double fValue,
73 const css::lang::Locale& nLocale, sal_Bool bAllowEnglish,
74 sal_Int32 aDefaultColor ) override;
75
76 // XServiceInfo
77 virtual OUString SAL_CALL getImplementationName( ) override;
78 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
79 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
80};
81
82
83class SvNumberFormatsObj : public cppu::WeakImplHelper<
84 css::util::XNumberFormats,
85 css::util::XNumberFormatTypes,
86 css::lang::XServiceInfo>
87{
88private:
90 mutable ::comphelper::SharedMutex m_aMutex;
91
92public:
94 virtual ~SvNumberFormatsObj() override;
95
96
97 // XNumberFormats
98 virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL
99 getByKey( sal_Int32 nKey ) override;
100 virtual css::uno::Sequence< sal_Int32 > SAL_CALL queryKeys( sal_Int16 nType,
101 const css::lang::Locale& nLocale, sal_Bool bCreate ) override;
102 virtual sal_Int32 SAL_CALL queryKey( const OUString& aFormat,
103 const css::lang::Locale& nLocale, sal_Bool bScan ) override;
104 virtual sal_Int32 SAL_CALL addNew( const OUString& aFormat,
105 const css::lang::Locale& nLocale ) override;
106 virtual sal_Int32 SAL_CALL addNewConverted( const OUString& aFormat,
107 const css::lang::Locale& nLocale,
108 const css::lang::Locale& nNewLocale ) override;
109 virtual void SAL_CALL removeByKey( sal_Int32 nKey ) override;
110 virtual OUString SAL_CALL generateFormat( sal_Int32 nBaseKey,
111 const css::lang::Locale& nLocale, sal_Bool bThousands,
112 sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading ) override;
113
114 // XNumberFormatTypes
115 virtual sal_Int32 SAL_CALL getStandardIndex( const css::lang::Locale& nLocale ) override;
116 virtual sal_Int32 SAL_CALL getStandardFormat( sal_Int16 nType,
117 const css::lang::Locale& nLocale ) override;
118 virtual sal_Int32 SAL_CALL getFormatIndex( sal_Int16 nIndex,
119 const css::lang::Locale& nLocale ) override;
120 virtual sal_Bool SAL_CALL isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType ) override;
121 virtual sal_Int32 SAL_CALL getFormatForLocale( sal_Int32 nKey,
122 const css::lang::Locale& nLocale ) override;
123
124 // XServiceInfo
125 virtual OUString SAL_CALL getImplementationName( ) override;
126 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
127 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
128};
129
130
131class SvNumberFormatObj : public cppu::WeakImplHelper<
132 css::beans::XPropertySet,
133 css::beans::XPropertyAccess,
134 css::lang::XServiceInfo>
135{
136private:
140 mutable ::comphelper::SharedMutex m_aMutex;
141
142public:
144 virtual ~SvNumberFormatObj() override;
145
146 // XPropertySet
147 virtual css::uno::Reference< css::beans::XPropertySetInfo >
148 SAL_CALL getPropertySetInfo( ) override;
149 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
150 const css::uno::Any& aValue ) override;
151 virtual css::uno::Any SAL_CALL getPropertyValue(
152 const OUString& PropertyName ) override;
153 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
154 const css::uno::Reference<
155 css::beans::XPropertyChangeListener >& xListener ) override;
156 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
157 const css::uno::Reference<
158 css::beans::XPropertyChangeListener >& aListener ) override;
159 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
160 const css::uno::Reference<
161 css::beans::XVetoableChangeListener >& aListener ) override;
162 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
163 const css::uno::Reference<
164 css::beans::XVetoableChangeListener >& aListener ) override;
165
166 // XPropertyAccess
167 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
168 getPropertyValues() override;
169 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence<
170 css::beans::PropertyValue >& aProps ) override;
171
172 // XServiceInfo
173 virtual OUString SAL_CALL getImplementationName( ) override;
174 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
175 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
176};
177
178
179class SvNumberFormatSettingsObj : public cppu::WeakImplHelper<
180 css::beans::XPropertySet,
181 css::lang::XServiceInfo>
182{
183private:
186 mutable ::comphelper::SharedMutex m_aMutex;
187
188public:
190 virtual ~SvNumberFormatSettingsObj() override;
191
192
193 // XPropertySet
194 virtual css::uno::Reference< css::beans::XPropertySetInfo >
195 SAL_CALL getPropertySetInfo( ) override;
196 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
197 const css::uno::Any& aValue ) override;
198 virtual css::uno::Any SAL_CALL getPropertyValue(
199 const OUString& PropertyName ) override;
200 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
201 const css::uno::Reference<
202 css::beans::XPropertyChangeListener >& xListener ) override;
203 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
204 const css::uno::Reference<
205 css::beans::XPropertyChangeListener >& aListener ) override;
206 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
207 const css::uno::Reference<
208 css::beans::XVetoableChangeListener >& aListener ) override;
209 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
210 const css::uno::Reference<
211 css::beans::XVetoableChangeListener >& aListener ) override;
212
213 // XServiceInfo
214 virtual OUString SAL_CALL getImplementationName( ) override;
215 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
216 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
217};
218
219
220#endif
221
222/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~SvNumberFormatObj() override
Definition: numfmuno.cxx:649
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: numfmuno.cxx:842
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: numfmuno.cxx:662
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: numfmuno.cxx:847
sal_uLong nKey
Definition: numfmuno.hxx:139
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue > &aProps) override
Definition: numfmuno.cxx:830
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: numfmuno.cxx:655
SvNumberFormatObj(SvNumberFormatsSupplierObj &rParent, sal_uLong nK, ::comphelper::SharedMutex _aMutex)
Definition: numfmuno.cxx:642
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: numfmuno.cxx:775
mutable::comphelper::SharedMutex m_aMutex
Definition: numfmuno.hxx:140
rtl::Reference< SvNumberFormatsSupplierObj > m_xSupplier
Definition: numfmuno.hxx:138
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: numfmuno.cxx:668
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: numfmuno.cxx:757
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: numfmuno.cxx:769
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: numfmuno.cxx:763
virtual OUString SAL_CALL getImplementationName() override
Definition: numfmuno.cxx:837
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() override
Definition: numfmuno.cxx:783
mutable::comphelper::SharedMutex m_aMutex
Definition: numfmuno.hxx:186
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: numfmuno.cxx:968
virtual ~SvNumberFormatSettingsObj() override
Definition: numfmuno.cxx:858
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: numfmuno.cxx:909
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: numfmuno.cxx:864
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: numfmuno.cxx:871
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: numfmuno.cxx:937
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: numfmuno.cxx:973
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: numfmuno.cxx:955
rtl::Reference< SvNumberFormatsSupplierObj > m_xSupplier
Definition: numfmuno.hxx:185
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: numfmuno.cxx:949
SvNumberFormatSettingsObj(SvNumberFormatsSupplierObj &rParent, ::comphelper::SharedMutex _aMutex)
Definition: numfmuno.cxx:852
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: numfmuno.cxx:943
virtual OUString SAL_CALL getImplementationName() override
Definition: numfmuno.cxx:963
virtual sal_Int32 SAL_CALL getStandardIndex(const css::lang::Locale &nLocale) override
Definition: numfmuno.cxx:562
virtual void SAL_CALL removeByKey(sal_Int32 nKey) override
Definition: numfmuno.cxx:532
virtual css::uno::Sequence< sal_Int32 > SAL_CALL queryKeys(sal_Int16 nType, const css::lang::Locale &nLocale, sal_Bool bCreate) override
Definition: numfmuno.cxx:371
virtual sal_Int32 SAL_CALL getFormatIndex(sal_Int16 nIndex, const css::lang::Locale &nLocale) override
Definition: numfmuno.cxx:592
virtual OUString SAL_CALL generateFormat(sal_Int32 nBaseKey, const css::lang::Locale &nLocale, sal_Bool bThousands, sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading) override
Definition: numfmuno.cxx:543
virtual sal_Int32 SAL_CALL queryKey(const OUString &aFormat, const css::lang::Locale &nLocale, sal_Bool bScan) override
Definition: numfmuno.cxx:398
virtual sal_Int32 SAL_CALL addNew(const OUString &aFormat, const css::lang::Locale &nLocale) override
Definition: numfmuno.cxx:464
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: numfmuno.cxx:637
virtual sal_Int32 SAL_CALL getStandardFormat(sal_Int16 nType, const css::lang::Locale &nLocale) override
Definition: numfmuno.cxx:575
mutable::comphelper::SharedMutex m_aMutex
Definition: numfmuno.hxx:90
virtual sal_Int32 SAL_CALL getFormatForLocale(sal_Int32 nKey, const css::lang::Locale &nLocale) override
Definition: numfmuno.cxx:612
rtl::Reference< SvNumberFormatsSupplierObj > m_xSupplier
Definition: numfmuno.hxx:89
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getByKey(sal_Int32 nKey) override
Definition: numfmuno.cxx:359
virtual sal_Bool SAL_CALL isTypeCompatible(sal_Int16 nOldType, sal_Int16 nNewType) override
Definition: numfmuno.cxx:605
virtual sal_Int32 SAL_CALL addNewConverted(const OUString &aFormat, const css::lang::Locale &nLocale, const css::lang::Locale &nNewLocale) override
Definition: numfmuno.cxx:500
SvNumberFormatsObj(SvNumberFormatsSupplierObj &pParent, ::comphelper::SharedMutex _aMutex)
Definition: numfmuno.cxx:347
virtual OUString SAL_CALL getImplementationName() override
Definition: numfmuno.cxx:627
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: numfmuno.cxx:632
virtual ~SvNumberFormatsObj() override
Definition: numfmuno.cxx:353
SvNumberFormatterServiceObj is registered globally as a Service.
Definition: numfmuno.hxx:42
virtual double SAL_CALL convertStringToNumber(sal_Int32 nKey, const OUString &aString) override
Definition: numfmuno.cxx:159
virtual css::uno::Reference< css::util::XNumberFormatsSupplier > SAL_CALL getNumberFormatsSupplier() override
Definition: numfmuno.cxx:137
virtual sal_Int32 SAL_CALL queryPreviewColorForNumber(const OUString &aFormat, double fValue, const css::lang::Locale &nLocale, sal_Bool bAllowEnglish, sal_Int32 aDefaultColor) override
Definition: numfmuno.cxx:297
::rtl::Reference< SvNumberFormatsSupplierObj > xSupplier
Definition: numfmuno.hxx:44
virtual sal_Int32 SAL_CALL queryColorForNumber(sal_Int32 nKey, double fValue, sal_Int32 aDefaultColor) override
Definition: numfmuno.cxx:190
virtual OUString SAL_CALL formatString(sal_Int32 nKey, const OUString &aString) override
Definition: numfmuno.cxx:211
virtual OUString SAL_CALL getImplementationName() override
Definition: numfmuno.cxx:332
virtual sal_Int32 SAL_CALL queryColorForString(sal_Int32 nKey, const OUString &aString, sal_Int32 aDefaultColor) override
Definition: numfmuno.cxx:229
virtual OUString SAL_CALL convertNumberToString(sal_Int32 nKey, double fValue) override
Definition: numfmuno.cxx:175
virtual void SAL_CALL attachNumberFormatsSupplier(const css::uno::Reference< css::util::XNumberFormatsSupplier > &xSupplier) override
Definition: numfmuno.cxx:117
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: numfmuno.cxx:337
virtual OUString SAL_CALL getInputString(sal_Int32 nKey, double fValue) override
Definition: numfmuno.cxx:254
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: numfmuno.cxx:342
virtual OUString SAL_CALL convertNumberToPreviewString(const OUString &aFormat, double fValue, const css::lang::Locale &nLocale, sal_Bool bAllowEnglish) override
Definition: numfmuno.cxx:270
virtual sal_Int32 SAL_CALL detectNumberFormat(sal_Int32 nKey, const OUString &aString) override
Definition: numfmuno.cxx:143
mutable::comphelper::SharedMutex m_aMutex
Definition: numfmuno.hxx:45
virtual ~SvNumberFormatterServiceObj() override
Definition: numfmuno.cxx:111
sal_uIntPtr sal_uLong
unsigned char sal_Bool