LibreOffice Module xmloff (master)  1
xmlnumfe.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_XMLOFF_XMLNUMFE_HXX
21 #define INCLUDED_XMLOFF_XMLNUMFE_HXX
22 
23 #include <sal/config.h>
24 #include <xmloff/dllapi.h>
25 #include <sal/types.h>
26 #include <com/sun/star/uno/Sequence.h>
27 #include <rtl/ustrbuf.hxx>
28 #include <i18nlangtag/lang.h>
29 #include <memory>
30 
31 namespace com::sun::star::lang { struct Locale; }
32 namespace com::sun::star::uno { template <typename > class Reference; }
33 namespace com::sun::star::util { class XNumberFormatsSupplier; }
34 
35 #define XML_WRITTENNUMBERSTYLES "WrittenNumberStyles"
36 
37 class Color;
38 class LocaleDataWrapper;
39 class CharClass;
40 class SvXMLExport;
41 class SvNumberFormatter;
42 class SvNumberformat;
44 
46 
48 {
49 private:
51  OUString sPrefix;
53  OUStringBuffer sTextContent;
54  bool bHasText;
55  std::unique_ptr<SvXMLNumUsedList_Impl> pUsedList;
56  std::unique_ptr<CharClass> pCharClass;
57  std::unique_ptr<LocaleDataWrapper> pLocaleData;
58 
59  SAL_DLLPRIVATE void AddCalendarAttr_Impl( const OUString& rCalendar );
60  SAL_DLLPRIVATE void AddStyleAttr_Impl( bool bLong );
61  SAL_DLLPRIVATE void AddLanguageAttr_Impl( LanguageType nLang );
62 
63  SAL_DLLPRIVATE void AddToTextElement_Impl( std::u16string_view rString );
64  SAL_DLLPRIVATE void FinishTextElement_Impl(bool bUseExtensionNS = false);
65 
66  SAL_DLLPRIVATE void WriteColorElement_Impl( const Color& rColor );
67  SAL_DLLPRIVATE void WriteNumberElement_Impl( sal_Int32 nDecimals, sal_Int32 nMinDecimals,
68  sal_Int32 nInteger, const OUString& rDashStr,
69  bool bGrouping, sal_Int32 nTrailingThousands,
70  const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries );
71  SAL_DLLPRIVATE void WriteScientificElement_Impl( sal_Int32 nDecimals, sal_Int32 nMinDecimals, sal_Int32 nInteger,
72  bool bGrouping, sal_Int32 nExp, sal_Int32 nExpInterval, bool bExpSign );
73  SAL_DLLPRIVATE void WriteFractionElement_Impl( sal_Int32 nInteger, bool bGrouping,
74  const SvNumberformat& rFormat, sal_uInt16 nPart );
75  SAL_DLLPRIVATE void WriteCurrencyElement_Impl( const OUString& rString,
76  const OUString& rExt );
77  SAL_DLLPRIVATE void WriteBooleanElement_Impl();
78  SAL_DLLPRIVATE void WriteTextContentElement_Impl();
79  SAL_DLLPRIVATE void WriteDayElement_Impl( const OUString& rCalendar, bool bLong );
80  SAL_DLLPRIVATE void WriteMonthElement_Impl( const OUString& rCalendar, bool bLong, bool bText );
81  SAL_DLLPRIVATE void WriteYearElement_Impl( const OUString& rCalendar, bool bLong );
82  SAL_DLLPRIVATE void WriteEraElement_Impl( const OUString& rCalendar, bool bLong );
83  SAL_DLLPRIVATE void WriteDayOfWeekElement_Impl( const OUString& rCalendar, bool bLong );
84  SAL_DLLPRIVATE void WriteWeekElement_Impl( const OUString& rCalendar );
85  SAL_DLLPRIVATE void WriteQuarterElement_Impl( const OUString& rCalendar, bool bLong );
86  SAL_DLLPRIVATE void WriteHoursElement_Impl( bool bLong );
87  SAL_DLLPRIVATE void WriteMinutesElement_Impl( bool bLong );
88  SAL_DLLPRIVATE void WriteSecondsElement_Impl( bool bLong, sal_uInt16 nDecimals );
89  SAL_DLLPRIVATE void WriteAMPMElement_Impl();
90  SAL_DLLPRIVATE void WriteMapElement_Impl( sal_Int32 nOp, double fLimit,
91  sal_Int32 nKey, sal_Int32 nPart );
92 
93  SAL_DLLPRIVATE void WriteRepeatedElement_Impl( sal_Unicode ch );
94  SAL_DLLPRIVATE bool WriteTextWithCurrency_Impl( const OUString& rString,
95  const css::lang::Locale& rLocale );
96  SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey,
97  sal_uInt16 nPart, bool bDefPart );
98 
99  SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey, sal_uInt32 nRealKey );
100 
101 public:
102  SvXMLNumFmtExport( SvXMLExport& rExport,
103  const css::uno::Reference< css::util::XNumberFormatsSupplier >& rSupp );
104  SvXMLNumFmtExport( SvXMLExport& rExport,
105  const css::uno::Reference< css::util::XNumberFormatsSupplier >& rSupp,
106  const OUString& rPrefix );
107 
109 
110  // core API
111  void Export( bool bIsAutoStyle);
112 
113  // mark number format as used
114  void SetUsed( sal_uInt32 nKey );
115 
116  // get the style name that was generated for a key
117  OUString GetStyleName( sal_uInt32 nKey );
118 
119  css::uno::Sequence<sal_Int32> GetWasUsed() const;
120  void SetWasUsed(const css::uno::Sequence<sal_Int32>& rWasUsed);
121 
122 
123  // two methods to allow the field import/export to treat system languages
124  // properly:
125 
127  sal_uInt32 ForceSystemLanguage( sal_uInt32 nKey );
128 };
129 
130 #endif
131 
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< LocaleDataWrapper > pLocaleData
Definition: xmlnumfe.hxx:57
Reference
OUString sPrefix
Definition: xmlnumfe.hxx:51
sal_uInt16 sal_Unicode
SvNumberFormatter * pFormatter
Definition: xmlnumfe.hxx:52
std::unique_ptr< SvXMLNumUsedList_Impl > pUsedList
Definition: xmlnumfe.hxx:55
SvXMLExport & rExport
Definition: xmlnumfe.hxx:50
OUStringBuffer sTextContent
Definition: xmlnumfe.hxx:53
std::unique_ptr< CharClass > pCharClass
Definition: xmlnumfe.hxx:56
#define XMLOFF_DLLPUBLIC
Definition: dllapi.h:29