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 _XMLOFF_XMLNUMFE_HXX
21 #define _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
;
41 class SvXMLEmbeddedTextEntryArr
;
43 class XMLOFF_DLLPUBLIC SvXMLNumFmtExport
48 SvNumberFormatter
* pFormatter
;
49 OUStringBuffer sTextContent
;
50 SvXMLNumUsedList_Impl
* pUsedList
;
51 CharClass
* pCharClass
;
52 LocaleDataWrapper
* pLocaleData
;
54 SAL_DLLPRIVATE
void AddCalendarAttr_Impl( const OUString
& rCalendar
);
55 SAL_DLLPRIVATE
void AddStyleAttr_Impl( sal_Bool bLong
);
56 SAL_DLLPRIVATE
void AddTextualAttr_Impl( sal_Bool bText
);
57 SAL_DLLPRIVATE
void AddLanguageAttr_Impl( sal_Int32 nLang
);
59 SAL_DLLPRIVATE
void AddToTextElement_Impl( const OUString
& rString
);
60 SAL_DLLPRIVATE
void FinishTextElement_Impl();
62 SAL_DLLPRIVATE
void WriteColorElement_Impl( const Color
& rColor
);
63 SAL_DLLPRIVATE
void WriteNumberElement_Impl( sal_Int32 nDecimals
, sal_Int32 nInteger
,
64 const OUString
& rDashStr
, sal_Bool bVarDecimals
,
65 sal_Bool bGrouping
, sal_Int32 nTrailingThousands
,
66 const SvXMLEmbeddedTextEntryArr
& rEmbeddedEntries
);
67 SAL_DLLPRIVATE
void WriteScientificElement_Impl( sal_Int32 nDecimals
, sal_Int32 nInteger
,
68 sal_Bool bGrouping
, sal_Int32 nExp
);
69 SAL_DLLPRIVATE
void WriteFractionElement_Impl( sal_Int32 nInteger
, sal_Bool bGrouping
,
70 sal_Int32 nNumeratorDigits
, sal_Int32 nDenominatorDigits
, sal_Int32 nDenominator
);
71 SAL_DLLPRIVATE
void WriteCurrencyElement_Impl( const OUString
& rString
,
72 const OUString
& rExt
);
73 SAL_DLLPRIVATE
void WriteBooleanElement_Impl();
74 SAL_DLLPRIVATE
void WriteTextContentElement_Impl();
75 SAL_DLLPRIVATE
void WriteDayElement_Impl( const OUString
& rCalendar
, sal_Bool bLong
);
76 SAL_DLLPRIVATE
void WriteMonthElement_Impl( const OUString
& rCalendar
, sal_Bool bLong
, sal_Bool bText
);
77 SAL_DLLPRIVATE
void WriteYearElement_Impl( const OUString
& rCalendar
, sal_Bool bLong
);
78 SAL_DLLPRIVATE
void WriteEraElement_Impl( const OUString
& rCalendar
, sal_Bool bLong
);
79 SAL_DLLPRIVATE
void WriteDayOfWeekElement_Impl( const OUString
& rCalendar
, sal_Bool bLong
);
80 SAL_DLLPRIVATE
void WriteWeekElement_Impl( const OUString
& rCalendar
);
81 SAL_DLLPRIVATE
void WriteQuarterElement_Impl( const OUString
& rCalendar
, sal_Bool bLong
);
82 SAL_DLLPRIVATE
void WriteHoursElement_Impl( sal_Bool bLong
);
83 SAL_DLLPRIVATE
void WriteMinutesElement_Impl( sal_Bool bLong
);
84 SAL_DLLPRIVATE
void WriteSecondsElement_Impl( sal_Bool bLong
, sal_uInt16 nDecimals
);
85 SAL_DLLPRIVATE
void WriteAMPMElement_Impl();
86 SAL_DLLPRIVATE
void WriteMapElement_Impl( sal_Int32 nOp
, double fLimit
,
87 sal_Int32 nKey
, sal_Int32 nPart
);
89 SAL_DLLPRIVATE
void WriteRepeatedElement_Impl( sal_Unicode ch
);
90 SAL_DLLPRIVATE sal_Bool
WriteTextWithCurrency_Impl( const OUString
& rString
,
91 const ::com::sun::star::lang::Locale
& rLocale
);
92 SAL_DLLPRIVATE
void ExportPart_Impl( const SvNumberformat
& rFormat
, sal_uInt32 nKey
,
93 sal_uInt16 nPart
, sal_Bool bDefPart
);
95 SAL_DLLPRIVATE
void ExportFormat_Impl( const SvNumberformat
& rFormat
, sal_uInt32 nKey
);
98 SvXMLNumFmtExport( SvXMLExport
& rExport
,
99 const ::com::sun::star::uno::Reference
<
100 ::com::sun::star::util::XNumberFormatsSupplier
>& rSupp
);
101 SvXMLNumFmtExport( SvXMLExport
& rExport
,
102 const ::com::sun::star::uno::Reference
<
103 ::com::sun::star::util::XNumberFormatsSupplier
>& rSupp
,
104 const OUString
& rPrefix
);
106 virtual ~SvXMLNumFmtExport();
109 void Export( sal_Bool bIsAutoStyle
);
111 // mark number format as used
112 void SetUsed( sal_uInt32 nKey
);
114 // get the style name that was generated for a key
115 OUString
GetStyleName( sal_uInt32 nKey
);
117 void GetWasUsed(com::sun::star::uno::Sequence
<sal_Int32
>& rWasUsed
);
118 void SetWasUsed(const com::sun::star::uno::Sequence
<sal_Int32
>& rWasUsed
);
122 // two methods to allow the field import/export to treat system languages
125 /// obtain number format with system languange for a given key
126 sal_uInt32
ForceSystemLanguage( sal_uInt32 nKey
);
128 /// determine whether number format uses system language
129 bool IsSystemLanguage( sal_uInt32 nKey
);
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */