xref: /trunk/main/xmloff/inc/xmloff/xmlnumfe.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _XMLOFF_XMLNUMFE_HXX
29*cdf0e10cSrcweir #define _XMLOFF_XMLNUMFE_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "sal/config.h"
32*cdf0e10cSrcweir #include "xmloff/dllapi.h"
33*cdf0e10cSrcweir #include "sal/types.h"
34*cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h>
36*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #define XML_WRITTENNUMBERSTYLES "WrittenNumberStyles"
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir class Color;
41*cdf0e10cSrcweir class LocaleDataWrapper;
42*cdf0e10cSrcweir class CharClass;
43*cdf0e10cSrcweir class SvXMLExport;
44*cdf0e10cSrcweir class SvXMLNamespaceMap;
45*cdf0e10cSrcweir class SvXMLAttributeList;
46*cdf0e10cSrcweir class SvNumberFormatter;
47*cdf0e10cSrcweir class SvNumberformat;
48*cdf0e10cSrcweir class SvXMLNumUsedList_Impl;
49*cdf0e10cSrcweir class SvXMLEmbeddedTextEntryArr;
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir class XMLOFF_DLLPUBLIC SvXMLNumFmtExport
52*cdf0e10cSrcweir {
53*cdf0e10cSrcweir private:
54*cdf0e10cSrcweir     SvXMLExport&                rExport;
55*cdf0e10cSrcweir     ::rtl::OUString             sPrefix;
56*cdf0e10cSrcweir     SvNumberFormatter*          pFormatter;
57*cdf0e10cSrcweir     ::rtl::OUStringBuffer       sTextContent;
58*cdf0e10cSrcweir     SvXMLNumUsedList_Impl*      pUsedList;
59*cdf0e10cSrcweir     CharClass*                  pCharClass;
60*cdf0e10cSrcweir     LocaleDataWrapper*          pLocaleData;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir     SAL_DLLPRIVATE void AddCalendarAttr_Impl( const ::rtl::OUString& rCalendar );
63*cdf0e10cSrcweir     SAL_DLLPRIVATE void AddStyleAttr_Impl( sal_Bool bLong );
64*cdf0e10cSrcweir     SAL_DLLPRIVATE void AddTextualAttr_Impl( sal_Bool bText );
65*cdf0e10cSrcweir     SAL_DLLPRIVATE void AddLanguageAttr_Impl( sal_Int32 nLang );
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir     SAL_DLLPRIVATE void AddToTextElement_Impl( const ::rtl::OUString& rString );
68*cdf0e10cSrcweir     SAL_DLLPRIVATE void FinishTextElement_Impl();
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteColorElement_Impl( const Color& rColor );
71*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteNumberElement_Impl( sal_Int32 nDecimals, sal_Int32 nInteger,
72*cdf0e10cSrcweir                                         const ::rtl::OUString& rDashStr, sal_Bool bVarDecimals,
73*cdf0e10cSrcweir                                         sal_Bool bGrouping, sal_Int32 nTrailingThousands,
74*cdf0e10cSrcweir                                         const SvXMLEmbeddedTextEntryArr& rEmbeddedEntries );
75*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteScientificElement_Impl( sal_Int32 nDecimals, sal_Int32 nInteger,
76*cdf0e10cSrcweir                                         sal_Bool bGrouping, sal_Int32 nExp );
77*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteFractionElement_Impl( sal_Int32 nInteger, sal_Bool bGrouping,
78*cdf0e10cSrcweir                                         sal_Int32 nNumerator, sal_Int32 nDenominator );
79*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteCurrencyElement_Impl( const ::rtl::OUString& rString,
80*cdf0e10cSrcweir                                         const ::rtl::OUString& rExt );
81*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteBooleanElement_Impl();
82*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteTextContentElement_Impl();
83*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteDayElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
84*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteMonthElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong, sal_Bool bText );
85*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteYearElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
86*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteEraElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
87*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteDayOfWeekElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
88*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteWeekElement_Impl( const ::rtl::OUString& rCalendar );
89*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteQuarterElement_Impl( const ::rtl::OUString& rCalendar, sal_Bool bLong );
90*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteHoursElement_Impl( sal_Bool bLong );
91*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteMinutesElement_Impl( sal_Bool bLong );
92*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteSecondsElement_Impl( sal_Bool bLong, sal_uInt16 nDecimals );
93*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteAMPMElement_Impl();
94*cdf0e10cSrcweir     SAL_DLLPRIVATE void WriteMapElement_Impl( sal_Int32 nOp, double fLimit,
95*cdf0e10cSrcweir                                     sal_Int32 nKey, sal_Int32 nPart );
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir     SAL_DLLPRIVATE sal_Bool WriteTextWithCurrency_Impl( const ::rtl::OUString& rString,
98*cdf0e10cSrcweir                             const ::com::sun::star::lang::Locale& rLocale );
99*cdf0e10cSrcweir     SAL_DLLPRIVATE void ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey,
100*cdf0e10cSrcweir                                 sal_uInt16 nPart, sal_Bool bDefPart );
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     SAL_DLLPRIVATE void ExportFormat_Impl( const SvNumberformat& rFormat, sal_uInt32 nKey );
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir public:
105*cdf0e10cSrcweir     SvXMLNumFmtExport( SvXMLExport& rExport,
106*cdf0e10cSrcweir                        const ::com::sun::star::uno::Reference<
107*cdf0e10cSrcweir                         ::com::sun::star::util::XNumberFormatsSupplier >& rSupp );
108*cdf0e10cSrcweir     SvXMLNumFmtExport( SvXMLExport& rExport,
109*cdf0e10cSrcweir                        const ::com::sun::star::uno::Reference<
110*cdf0e10cSrcweir                         ::com::sun::star::util::XNumberFormatsSupplier >& rSupp,
111*cdf0e10cSrcweir                        const rtl::OUString& rPrefix );
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir     virtual ~SvXMLNumFmtExport();
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     // core API
116*cdf0e10cSrcweir     void Export( sal_Bool bIsAutoStyle);
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir     // mark number format as used
119*cdf0e10cSrcweir     void SetUsed( sal_uInt32 nKey );
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     // get the style name that was generated for a key
122*cdf0e10cSrcweir     ::rtl::OUString GetStyleName( sal_uInt32 nKey );
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     void GetWasUsed(com::sun::star::uno::Sequence<sal_Int32>& rWasUsed);
125*cdf0e10cSrcweir     void SetWasUsed(const com::sun::star::uno::Sequence<sal_Int32>& rWasUsed);
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir     // two methods to allow the field import/export to treat system languages
130*cdf0e10cSrcweir     // properly:
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir     /// obtain number format with system languange for a given key
133*cdf0e10cSrcweir     sal_uInt32 ForceSystemLanguage( sal_uInt32 nKey );
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     /// determine whether number format uses system language
136*cdf0e10cSrcweir     bool IsSystemLanguage( sal_uInt32 nKey );
137*cdf0e10cSrcweir };
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir #endif
140*cdf0e10cSrcweir 
141