2010-10-27 13:11:31 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-12 17:21:24 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-10-23 19:09:35 +02:00
|
|
|
#ifndef INCLUDED_XMLOFF_NUMEHELP_HXX
|
|
|
|
#define INCLUDED_XMLOFF_NUMEHELP_HXX
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-11-09 15:30:56 -06:00
|
|
|
#include <sal/config.h>
|
|
|
|
#include <xmloff/xmlnmspe.hxx>
|
|
|
|
#include <xmloff/dllapi.h>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <sal/types.h>
|
|
|
|
#include <com/sun/star/frame/XModel.hpp>
|
|
|
|
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
|
|
|
|
|
2001-05-16 09:05:41 +00:00
|
|
|
#include <set>
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
class SvXMLExport;
|
|
|
|
|
2001-05-16 09:05:41 +00:00
|
|
|
struct XMLNumberFormat
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sCurrency;
|
2014-03-31 21:23:53 +01:00
|
|
|
sal_Int32 nNumberFormat;
|
|
|
|
sal_Int16 nType;
|
|
|
|
bool bIsStandard : 1;
|
|
|
|
|
2016-03-16 10:17:37 +02:00
|
|
|
XMLNumberFormat(const OUString& sTempCurrency, sal_Int32 nTempFormat)
|
2014-03-31 21:23:53 +01:00
|
|
|
: sCurrency(sTempCurrency)
|
|
|
|
, nNumberFormat(nTempFormat)
|
2016-03-16 10:17:37 +02:00
|
|
|
, nType(0)
|
2014-03-31 21:23:53 +01:00
|
|
|
, bIsStandard(false)
|
|
|
|
{
|
|
|
|
}
|
2001-05-16 09:05:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LessNumberFormat
|
|
|
|
{
|
2014-03-28 10:53:57 +02:00
|
|
|
bool operator() (const XMLNumberFormat& rValue1, const XMLNumberFormat& rValue2) const
|
2001-05-16 09:05:41 +00:00
|
|
|
{
|
|
|
|
return rValue1.nNumberFormat < rValue2.nNumberFormat;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::set<XMLNumberFormat, LessNumberFormat> XMLNumberFormatSet;
|
|
|
|
|
2005-01-11 13:17:34 +00:00
|
|
|
class XMLOFF_DLLPUBLIC XMLNumberFormatAttributesExportHelper
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-10-23 10:32:47 +02:00
|
|
|
css::uno::Reference< css::util::XNumberFormats > xNumberFormats;
|
2001-05-23 10:36:01 +00:00
|
|
|
SvXMLExport* pExport;
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString sStandardFormat;
|
|
|
|
const OUString sType;
|
|
|
|
const OUString sAttrValue;
|
|
|
|
const OUString sAttrDateValue;
|
|
|
|
const OUString sAttrTimeValue;
|
|
|
|
const OUString sAttrBooleanValue;
|
|
|
|
const OUString sAttrStringValue;
|
|
|
|
const OUString sAttrCurrency;
|
|
|
|
const OUString msCurrencySymbol;
|
|
|
|
const OUString msCurrencyAbbreviation;
|
2001-05-16 09:05:41 +00:00
|
|
|
XMLNumberFormatSet aNumberFormats;
|
2015-07-17 10:29:59 +02:00
|
|
|
public:
|
2015-10-23 10:32:47 +02:00
|
|
|
XMLNumberFormatAttributesExportHelper(css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier);
|
|
|
|
XMLNumberFormatAttributesExportHelper(css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier,
|
2004-07-13 06:56:29 +00:00
|
|
|
SvXMLExport& rExport );
|
2001-05-16 09:05:41 +00:00
|
|
|
~XMLNumberFormatAttributesExportHelper();
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_Int16 GetCellType(const sal_Int32 nNumberFormat, OUString& sCurrency, bool& bIsStandard);
|
2001-05-16 09:05:41 +00:00
|
|
|
static void WriteAttributes(SvXMLExport& rXMLExport,
|
|
|
|
const sal_Int16 nTypeKey,
|
|
|
|
const double& rValue,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& rCurrencySymbol,
|
2016-09-14 09:02:16 +02:00
|
|
|
bool bExportValue);
|
2014-03-28 10:53:57 +02:00
|
|
|
static bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol,
|
2015-10-23 10:32:47 +02:00
|
|
|
css::uno::Reference< css::util::XNumberFormatsSupplier > & xNumberFormatsSupplier);
|
2014-03-28 10:53:57 +02:00
|
|
|
static sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard,
|
2015-10-23 10:32:47 +02:00
|
|
|
css::uno::Reference< css::util::XNumberFormatsSupplier > & xNumberFormatsSupplier);
|
2000-09-18 16:07:07 +00:00
|
|
|
static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
|
|
|
|
const sal_Int32 nNumberFormat,
|
2001-05-16 09:05:41 +00:00
|
|
|
const double& rValue,
|
2014-03-28 10:53:57 +02:00
|
|
|
bool bExportValue = true);
|
2000-09-18 16:07:07 +00:00
|
|
|
static void SetNumberFormatAttributes(SvXMLExport& rXMLExport,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& rValue,
|
|
|
|
const OUString& rCharacters,
|
2016-09-14 09:02:16 +02:00
|
|
|
bool bExportValue,
|
2014-03-28 10:53:57 +02:00
|
|
|
bool bExportTypeAttribute = true);
|
2003-03-27 17:21:03 +00:00
|
|
|
|
2014-03-28 10:53:57 +02:00
|
|
|
bool GetCurrencySymbol(const sal_Int32 nNumberFormat, OUString& rCurrencySymbol);
|
2011-08-28 04:08:33 +02:00
|
|
|
sal_Int16 GetCellType(const sal_Int32 nNumberFormat, bool& bIsStandard);
|
2003-03-27 17:21:03 +00:00
|
|
|
void WriteAttributes(const sal_Int16 nTypeKey,
|
|
|
|
const double& rValue,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& rCurrencySymbol,
|
2016-09-14 09:02:16 +02:00
|
|
|
bool bExportValue, sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE);
|
2003-03-27 17:21:03 +00:00
|
|
|
void SetNumberFormatAttributes(const sal_Int32 nNumberFormat,
|
|
|
|
const double& rValue,
|
2014-03-28 10:53:57 +02:00
|
|
|
bool bExportValue = true,
|
2013-05-23 16:09:36 +02:00
|
|
|
sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE, bool bExportCurrencySymbol = true);
|
2013-04-07 12:06:47 +02:00
|
|
|
void SetNumberFormatAttributes(const OUString& rValue,
|
|
|
|
const OUString& rCharacters,
|
2014-03-28 10:53:57 +02:00
|
|
|
bool bExportValue = true,
|
2013-04-24 18:45:15 +02:00
|
|
|
sal_uInt16 nNamespace = XML_NAMESPACE_OFFICE);
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-10-27 13:11:31 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|