bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / xmloff / numehelp.hxx
blob9e0292e6380e92a8b91b7ad64ad3236ee6fd63bc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_NUMEHELP_HXX
21 #define INCLUDED_XMLOFF_NUMEHELP_HXX
23 #include <sal/config.h>
24 #include <xmloff/xmlnmspe.hxx>
25 #include <xmloff/dllapi.h>
26 #include <sal/types.h>
27 #include <com/sun/star/uno/Reference.hxx>
29 #include <set>
31 namespace com { namespace sun { namespace star { namespace util { class XNumberFormats; } } } }
32 namespace com { namespace sun { namespace star { namespace util { class XNumberFormatsSupplier; } } } }
34 class SvXMLExport;
36 struct XMLNumberFormat
38 OUString sCurrency;
39 sal_Int32 const nNumberFormat;
40 sal_Int16 nType;
41 bool bIsStandard : 1;
43 XMLNumberFormat(sal_Int32 nTempFormat)
44 : nNumberFormat(nTempFormat)
45 , nType(0)
46 , bIsStandard(false)
51 struct LessNumberFormat
53 bool operator() (const XMLNumberFormat& rValue1, const XMLNumberFormat& rValue2) const
55 return rValue1.nNumberFormat < rValue2.nNumberFormat;
59 typedef std::set<XMLNumberFormat, LessNumberFormat> XMLNumberFormatSet;
61 class XMLOFF_DLLPUBLIC XMLNumberFormatAttributesExportHelper
63 css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
64 SvXMLExport* pExport;
65 const OUString sAttrValue;
66 const OUString sAttrDateValue;
67 const OUString sAttrTimeValue;
68 const OUString sAttrBooleanValue;
69 const OUString sAttrStringValue;
70 const OUString sAttrCurrency;
71 XMLNumberFormatSet aNumberFormats;
72 public:
73 XMLNumberFormatAttributesExportHelper(css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier);
74 XMLNumberFormatAttributesExportHelper(css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier,
75 SvXMLExport& rExport );
76 ~XMLNumberFormatAttributesExportHelper();
78 sal_Int16 GetCellType(const sal_Int32 nNumberFormat, OUString& sCurrency, bool& bIsStandard);
79 static void WriteAttributes(SvXMLExport& rXMLExport,
80 const sal_Int16 nTypeKey,
81 const double& rValue,
82 const OUString& rCurrencySymbol,
83 bool bExportValue);
84 static bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol,
85 css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier);
86 static sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard,
87 css::uno::Reference< css::util::XNumberFormatsSupplier > const & xNumberFormatsSupplier);
88 static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
89 const sal_Int32 nNumberFormat,
90 const double& rValue,
91 bool bExportValue = true);
92 static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
93 const OUString& rValue,
94 const OUString& rCharacters,
95 bool bExportValue,
96 bool bExportTypeAttribute = true);
98 bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol);
99 sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard);
100 void WriteAttributes(const sal_Int16 nTypeKey,
101 const double& rValue,
102 const OUString& rCurrencySymbol,
103 bool bExportValue, sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE);
104 void SetNumberFormatAttributes(const sal_Int32 nNumberFormat,
105 const double& rValue,
106 bool bExportValue = true,
107 sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE, bool bExportCurrencySymbol = true);
108 void SetNumberFormatAttributes(const OUString& rValue,
109 const OUString& rCharacters,
110 bool bExportValue = true,
111 sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE);
114 #endif
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */