2010-10-12 15:53:47 +02: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 .
|
|
|
|
*/
|
2001-03-30 14:00:43 +00:00
|
|
|
|
#i108468#: clean up xmluconv code duplication, part 1:
move convertNumber64 from SvXMLUnitConverter to sax::converter.
remove duplicate methods from SvXMLUnitConverter:
convertBool, convertPercent, convertColor, convertNumber, convertDouble,
indexOfComma, encodeBase64, decodeBase64, decodeBase64SomeChars,
clearUndefinedChars
2011-10-11 14:19:00 +02:00
|
|
|
|
2001-03-30 14:00:43 +00:00
|
|
|
#include <XMLCalculationSettingsContext.hxx>
|
#i108468#: clean up xmluconv code duplication, part 1:
move convertNumber64 from SvXMLUnitConverter to sax::converter.
remove duplicate methods from SvXMLUnitConverter:
convertBool, convertPercent, convertColor, convertNumber, convertDouble,
indexOfComma, encodeBase64, decodeBase64, decodeBase64SomeChars,
clearUndefinedChars
2011-10-11 14:19:00 +02:00
|
|
|
|
2001-03-30 14:00:43 +00:00
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#include <com/sun/star/text/XTextDocument.hpp>
|
#i108468#: clean up xmluconv code duplication, part 1:
move convertNumber64 from SvXMLUnitConverter to sax::converter.
remove duplicate methods from SvXMLUnitConverter:
convertBool, convertPercent, convertColor, convertNumber, convertDouble,
indexOfComma, encodeBase64, decodeBase64, decodeBase64SomeChars,
clearUndefinedChars
2011-10-11 14:19:00 +02:00
|
|
|
|
|
|
|
#include <sax/tools/converter.hxx>
|
|
|
|
|
2007-06-27 14:52:12 +00:00
|
|
|
#include <xmloff/xmlimp.hxx>
|
|
|
|
#include <xmloff/nmspmap.hxx>
|
2013-11-11 22:30:35 -06:00
|
|
|
#include <xmloff/xmlnmspe.hxx>
|
2007-06-27 14:52:12 +00:00
|
|
|
#include <xmloff/xmltoken.hxx>
|
2001-03-30 14:00:43 +00:00
|
|
|
|
|
|
|
|
2008-03-12 10:00:29 +00:00
|
|
|
|
2001-03-30 14:00:43 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::text;
|
2001-06-29 20:07:26 +00:00
|
|
|
using namespace ::xmloff::token;
|
2001-03-30 14:00:43 +00:00
|
|
|
|
|
|
|
XMLCalculationSettingsContext::XMLCalculationSettingsContext( SvXMLImport& rImport,
|
2006-06-19 17:38:25 +00:00
|
|
|
sal_uInt16 p_nPrefix,
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& rLocalName,
|
2015-11-26 08:43:00 +02:00
|
|
|
const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList )
|
2006-06-19 17:38:25 +00:00
|
|
|
: SvXMLImportContext ( rImport, p_nPrefix, rLocalName )
|
|
|
|
, nYear( 1930 )
|
2001-03-30 14:00:43 +00:00
|
|
|
{
|
|
|
|
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
|
|
|
|
for( sal_Int16 i=0; i < nAttrCount; i++ )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sAttrName = xAttrList->getNameByIndex( i );
|
|
|
|
OUString aLocalName;
|
2001-03-30 14:00:43 +00:00
|
|
|
sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName(
|
|
|
|
sAttrName, &aLocalName );
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sValue = xAttrList->getValueByIndex( i );
|
2001-03-30 14:00:43 +00:00
|
|
|
|
|
|
|
if (nPrefix == XML_NAMESPACE_TABLE)
|
|
|
|
{
|
2001-06-29 20:07:26 +00:00
|
|
|
if ( IsXMLToken( aLocalName, XML_NULL_YEAR ) )
|
2001-03-30 14:00:43 +00:00
|
|
|
{
|
|
|
|
sal_Int32 nTemp;
|
#i108468#: clean up xmluconv code duplication, part 1:
move convertNumber64 from SvXMLUnitConverter to sax::converter.
remove duplicate methods from SvXMLUnitConverter:
convertBool, convertPercent, convertColor, convertNumber, convertDouble,
indexOfComma, encodeBase64, decodeBase64, decodeBase64SomeChars,
clearUndefinedChars
2011-10-11 14:19:00 +02:00
|
|
|
::sax::Converter::convertNumber(nTemp, sValue);
|
2001-03-30 14:00:43 +00:00
|
|
|
nYear= static_cast <sal_Int16> (nTemp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLCalculationSettingsContext::~XMLCalculationSettingsContext()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void XMLCalculationSettingsContext::EndElement()
|
|
|
|
{
|
|
|
|
if (nYear != 1930 )
|
|
|
|
{
|
|
|
|
Reference < XTextDocument > xTextDoc ( GetImport().GetModel(), UNO_QUERY);
|
|
|
|
if (xTextDoc.is())
|
|
|
|
{
|
|
|
|
Reference < XPropertySet > xPropSet ( xTextDoc, UNO_QUERY );
|
2013-02-26 22:00:44 +01:00
|
|
|
OUString sTwoDigitYear ( "TwoDigitYear" );
|
2001-03-30 14:00:43 +00:00
|
|
|
Any aAny;
|
|
|
|
aAny <<= nYear;
|
|
|
|
xPropSet->setPropertyValue ( sTwoDigitYear, aAny );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|