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 .
20 #ifndef INCLUDED_XMLOFF_XMLNUMFE_HXX
21 #define INCLUDED_XMLOFF_XMLNUMFE_HXX
23 #include <sal/config.h>
24 #include <xmloff/dllapi.h>
25 #include <sal/types.h>
26 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
27 #include <com/sun/star/uno/Sequence.h>
28 #include <rtl/ustrbuf.hxx>
30 #define XML_WRITTENNUMBERSTYLES "WrittenNumberStyles"
33 class LocaleDataWrapper
;
36 class SvXMLNamespaceMap
;
37 class SvXMLAttributeList
;
38 class SvNumberFormatter
;
40 class SvXMLNumUsedList_Impl
;
42 struct SvXMLEmbeddedTextEntry
;
43 class SvXMLEmbeddedTextEntryArr
;
45 class XMLOFF_DLLPUBLIC SvXMLNumFmtExport
50 SvNumberFormatter
* pFormatter
;
51 OUStringBuffer sTextContent
;
52 SvXMLNumUsedList_Impl
* pUsedList
;
53 CharClass
* pCharClass
;
54 LocaleDataWrapper
* pLocaleData
;
56 SAL_DLLPRIVATE
void AddCalendarAttr_Impl( const OUString
& rCalendar
);
57 SAL_DLLPRIVATE
void AddStyleAttr_Impl( bool bLong
);
58 SAL_DLLPRIVATE
void AddTextualAttr_Impl( bool bText
);
59 SAL_DLLPRIVATE
void AddLanguageAttr_Impl( sal_Int32 nLang
);
61 SAL_DLLPRIVATE
void AddToTextElement_Impl( const OUString
& rString
);
62 SAL_DLLPRIVATE
void FinishTextElement_Impl(bool bUseExtensionNS
= false);
64 SAL_DLLPRIVATE
void WriteColorElement_Impl( const Color
& rColor
);
65 SAL_DLLPRIVATE
void WriteNumberElement_Impl( sal_Int32 nDecimals
, sal_Int32 nMinDecimals
,
66 sal_Int32 nInteger
, const OUString
& rDashStr
,
67 bool bGrouping
, sal_Int32 nTrailingThousands
,
68 const SvXMLEmbeddedTextEntryArr
& rEmbeddedEntries
);
69 SAL_DLLPRIVATE
void WriteScientificElement_Impl( sal_Int32 nDecimals
, sal_Int32 nMinDecimals
, sal_Int32 nInteger
,
70 bool bGrouping
, sal_Int32 nExp
, sal_Int32 nExpInterval
, bool bExpSign
);
71 SAL_DLLPRIVATE
void WriteFractionElement_Impl( sal_Int32 nInteger
, bool bGrouping
,
72 sal_Int32 nNumeratorDigits
, sal_Int32 nDenominatorDigits
, sal_Int32 nDenominator
);
73 SAL_DLLPRIVATE
void WriteCurrencyElement_Impl( const OUString
& rString
,
74 const OUString
& rExt
);
75 SAL_DLLPRIVATE
void WriteBooleanElement_Impl();
76 SAL_DLLPRIVATE
void WriteTextContentElement_Impl();
77 SAL_DLLPRIVATE
void WriteDayElement_Impl( const OUString
& rCalendar
, bool bLong
);
78 SAL_DLLPRIVATE
void WriteMonthElement_Impl( const OUString
& rCalendar
, bool bLong
, bool bText
);
79 SAL_DLLPRIVATE
void WriteYearElement_Impl( const OUString
& rCalendar
, bool bLong
);
80 SAL_DLLPRIVATE
void WriteEraElement_Impl( const OUString
& rCalendar
, bool bLong
);
81 SAL_DLLPRIVATE
void WriteDayOfWeekElement_Impl( const OUString
& rCalendar
, bool bLong
);
82 SAL_DLLPRIVATE
void WriteWeekElement_Impl( const OUString
& rCalendar
);
83 SAL_DLLPRIVATE
void WriteQuarterElement_Impl( const OUString
& rCalendar
, bool bLong
);
84 SAL_DLLPRIVATE
void WriteHoursElement_Impl( bool bLong
);
85 SAL_DLLPRIVATE
void WriteMinutesElement_Impl( bool bLong
);
86 SAL_DLLPRIVATE
void WriteSecondsElement_Impl( bool bLong
, sal_uInt16 nDecimals
);
87 SAL_DLLPRIVATE
void WriteAMPMElement_Impl();
88 SAL_DLLPRIVATE
void WriteMapElement_Impl( sal_Int32 nOp
, double fLimit
,
89 sal_Int32 nKey
, sal_Int32 nPart
);
91 SAL_DLLPRIVATE
void WriteRepeatedElement_Impl( sal_Unicode ch
);
92 SAL_DLLPRIVATE
bool WriteTextWithCurrency_Impl( const OUString
& rString
,
93 const ::com::sun::star::lang::Locale
& rLocale
);
94 SAL_DLLPRIVATE
void ExportPart_Impl( const SvNumberformat
& rFormat
, sal_uInt32 nKey
,
95 sal_uInt16 nPart
, bool bDefPart
);
97 SAL_DLLPRIVATE
void ExportFormat_Impl( const SvNumberformat
& rFormat
, sal_uInt32 nKey
);
100 SvXMLNumFmtExport( SvXMLExport
& rExport
,
101 const ::com::sun::star::uno::Reference
<
102 ::com::sun::star::util::XNumberFormatsSupplier
>& rSupp
);
103 SvXMLNumFmtExport( SvXMLExport
& rExport
,
104 const ::com::sun::star::uno::Reference
<
105 ::com::sun::star::util::XNumberFormatsSupplier
>& rSupp
,
106 const OUString
& rPrefix
);
108 virtual ~SvXMLNumFmtExport();
111 void Export( bool bIsAutoStyle
);
113 // mark number format as used
114 void SetUsed( sal_uInt32 nKey
);
116 // get the style name that was generated for a key
117 OUString
GetStyleName( sal_uInt32 nKey
);
119 void GetWasUsed(com::sun::star::uno::Sequence
<sal_Int32
>& rWasUsed
);
120 void SetWasUsed(const com::sun::star::uno::Sequence
<sal_Int32
>& rWasUsed
);
124 // two methods to allow the field import/export to treat system languages
127 /// obtain number format with system languange for a given key
128 sal_uInt32
ForceSystemLanguage( sal_uInt32 nKey
);
130 /// determine whether number format uses system language
131 bool IsSystemLanguage( sal_uInt32 nKey
);
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */