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-02-21 18:28:49 +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-02-21 18:28:49 +00:00
|
|
|
#include "XMLFootnoteSeparatorExport.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
|
|
|
|
|
|
|
#include <sax/tools/converter.hxx>
|
|
|
|
|
2007-06-27 14:32:49 +00:00
|
|
|
#include <xmloff/xmlexp.hxx>
|
2013-11-11 22:30:35 -06:00
|
|
|
#include <xmloff/xmlnmspe.hxx>
|
2007-06-27 14:32:49 +00:00
|
|
|
#include <xmloff/xmluconv.hxx>
|
|
|
|
#include <xmloff/xmltoken.hxx>
|
|
|
|
#include <xmloff/xmlprmap.hxx>
|
2019-01-12 22:28:32 +01:00
|
|
|
#include <xmloff/xmlement.hxx>
|
2001-02-21 18:28:49 +00:00
|
|
|
|
2007-06-27 14:32:49 +00:00
|
|
|
#include <xmloff/PageMasterStyleMap.hxx>
|
2001-02-21 18:28:49 +00:00
|
|
|
#include <com/sun/star/text/HorizontalAdjust.hpp>
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
2001-06-15 09:37:08 +00:00
|
|
|
using namespace ::xmloff::token;
|
2001-02-21 18:28:49 +00:00
|
|
|
using ::std::vector;
|
|
|
|
|
|
|
|
XMLFootnoteSeparatorExport::XMLFootnoteSeparatorExport(SvXMLExport& rExp) :
|
|
|
|
rExport(rExp)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
XMLFootnoteSeparatorExport::~XMLFootnoteSeparatorExport()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void XMLFootnoteSeparatorExport::exportXML(
|
|
|
|
const vector<XMLPropertyState> * pProperties,
|
2015-05-20 11:22:32 +02:00
|
|
|
sal_uInt32 const nIdx,
|
2014-06-30 09:53:06 +02:00
|
|
|
const rtl::Reference<XMLPropertySetMapper> & rMapper)
|
2001-02-21 18:28:49 +00:00
|
|
|
{
|
2015-05-20 11:22:32 +02:00
|
|
|
assert(pProperties);
|
2001-02-21 18:28:49 +00:00
|
|
|
|
2017-03-02 09:34:30 +01:00
|
|
|
// initialize values
|
2017-03-09 09:04:15 +02:00
|
|
|
text::HorizontalAdjust eLineAdjust = text::HorizontalAdjust_LEFT;
|
2001-04-17 11:01:21 +00:00
|
|
|
sal_Int32 nLineColor = 0;
|
|
|
|
sal_Int32 nLineDistance = 0;
|
|
|
|
sal_Int8 nLineRelWidth = 0;
|
|
|
|
sal_Int32 nLineTextDistance = 0;
|
|
|
|
sal_Int16 nLineWeight = 0;
|
2011-03-17 17:39:42 +01:00
|
|
|
sal_Int8 nLineStyle = 0;
|
2001-04-17 11:01:21 +00:00
|
|
|
|
|
|
|
// find indices into property map and get values
|
|
|
|
sal_uInt32 nCount = pProperties->size();
|
|
|
|
for(sal_uInt32 i = 0; i < nCount; i++)
|
2001-02-21 18:28:49 +00:00
|
|
|
{
|
2001-04-17 11:01:21 +00:00
|
|
|
const XMLPropertyState& rState = (*pProperties)[i];
|
2001-02-28 17:09:57 +00:00
|
|
|
|
2004-03-30 13:31:23 +00:00
|
|
|
if( rState.mnIndex == -1 )
|
|
|
|
continue;
|
|
|
|
|
2001-04-17 11:01:21 +00:00
|
|
|
switch (rMapper->GetEntryContextId(rState.mnIndex))
|
2001-02-28 17:09:57 +00:00
|
|
|
{
|
2001-04-17 11:01:21 +00:00
|
|
|
case CTF_PM_FTN_LINE_ADJUST:
|
2018-03-07 17:32:40 +02:00
|
|
|
{
|
|
|
|
sal_Int16 nTmp;
|
|
|
|
if (rState.maValue >>= nTmp)
|
|
|
|
eLineAdjust = static_cast<text::HorizontalAdjust>(nTmp);
|
2001-04-17 11:01:21 +00:00
|
|
|
break;
|
2018-03-07 17:32:40 +02:00
|
|
|
}
|
2001-04-17 11:01:21 +00:00
|
|
|
case CTF_PM_FTN_LINE_COLOR:
|
|
|
|
rState.maValue >>= nLineColor;
|
|
|
|
break;
|
|
|
|
case CTF_PM_FTN_DISTANCE:
|
|
|
|
rState.maValue >>= nLineDistance;
|
|
|
|
break;
|
|
|
|
case CTF_PM_FTN_LINE_WIDTH:
|
|
|
|
rState.maValue >>= nLineRelWidth;
|
|
|
|
break;
|
|
|
|
case CTF_PM_FTN_LINE_DISTANCE:
|
|
|
|
rState.maValue >>= nLineTextDistance;
|
|
|
|
break;
|
2013-04-17 18:35:49 +03:00
|
|
|
case CTF_PM_FTN_LINE_WEIGHT:
|
2015-05-20 11:22:32 +02:00
|
|
|
(void) nIdx;
|
|
|
|
assert(i == nIdx && "received wrong property state index");
|
2001-04-17 11:01:21 +00:00
|
|
|
rState.maValue >>= nLineWeight;
|
|
|
|
break;
|
2011-03-17 17:39:42 +01:00
|
|
|
case CTF_PM_FTN_LINE_STYLE:
|
|
|
|
rState.maValue >>= nLineStyle;
|
|
|
|
break;
|
2001-02-28 17:09:57 +00:00
|
|
|
}
|
2001-04-17 11:01:21 +00:00
|
|
|
}
|
2001-02-28 17:09:57 +00:00
|
|
|
|
2001-04-17 11:01:21 +00:00
|
|
|
OUStringBuffer sBuf;
|
2001-02-28 17:09:57 +00:00
|
|
|
|
2001-04-17 11:01:21 +00:00
|
|
|
// weight/width
|
|
|
|
if (nLineWeight > 0)
|
|
|
|
{
|
2011-10-11 14:19:09 +02:00
|
|
|
rExport.GetMM100UnitConverter().convertMeasureToXML(sBuf, nLineWeight);
|
2001-06-29 20:07:26 +00:00
|
|
|
rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_WIDTH,
|
2001-04-17 11:01:21 +00:00
|
|
|
sBuf.makeStringAndClear());
|
|
|
|
}
|
2001-02-28 17:09:57 +00:00
|
|
|
|
2001-04-17 11:01:21 +00:00
|
|
|
// line text distance
|
|
|
|
if (nLineTextDistance > 0)
|
|
|
|
{
|
2011-10-11 14:19:09 +02:00
|
|
|
rExport.GetMM100UnitConverter().convertMeasureToXML(sBuf,
|
|
|
|
nLineTextDistance);
|
2001-06-29 20:07:26 +00:00
|
|
|
rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_DISTANCE_BEFORE_SEP,
|
2001-02-21 18:28:49 +00:00
|
|
|
sBuf.makeStringAndClear());
|
2001-04-17 11:01:21 +00:00
|
|
|
}
|
2001-02-21 18:28:49 +00:00
|
|
|
|
2001-04-17 11:01:21 +00:00
|
|
|
// line distance
|
|
|
|
if (nLineDistance > 0)
|
|
|
|
{
|
2011-10-11 14:19:09 +02:00
|
|
|
rExport.GetMM100UnitConverter().convertMeasureToXML(sBuf,
|
|
|
|
nLineDistance);
|
2001-06-29 20:07:26 +00:00
|
|
|
rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_DISTANCE_AFTER_SEP,
|
2001-02-21 18:28:49 +00:00
|
|
|
sBuf.makeStringAndClear());
|
2001-04-17 11:01:21 +00:00
|
|
|
}
|
2001-02-21 18:28:49 +00:00
|
|
|
|
2011-03-17 17:39:42 +01:00
|
|
|
// line style
|
2017-03-09 09:04:15 +02:00
|
|
|
static const SvXMLEnumMapEntry<sal_Int8> aXML_LineStyle_Enum[] =
|
2011-03-17 17:39:42 +01:00
|
|
|
{
|
|
|
|
{ XML_NONE, 0 },
|
|
|
|
{ XML_SOLID, 1 },
|
|
|
|
{ XML_DOTTED, 2 },
|
|
|
|
{ XML_DASH, 3 },
|
|
|
|
{ XML_TOKEN_INVALID, 0 }
|
|
|
|
};
|
2014-06-13 17:53:15 +02:00
|
|
|
if (SvXMLUnitConverter::convertEnum(
|
2011-03-17 17:39:42 +01:00
|
|
|
sBuf, nLineStyle, aXML_LineStyle_Enum ) )
|
|
|
|
{
|
|
|
|
rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LINE_STYLE,
|
|
|
|
sBuf.makeStringAndClear());
|
|
|
|
}
|
|
|
|
|
2001-04-17 11:01:21 +00:00
|
|
|
// adjustment
|
2017-03-09 09:04:15 +02:00
|
|
|
static const SvXMLEnumMapEntry<text::HorizontalAdjust> aXML_HorizontalAdjust_Enum[] =
|
2009-04-23 10:42:05 +00:00
|
|
|
{
|
|
|
|
{ XML_LEFT, text::HorizontalAdjust_LEFT },
|
|
|
|
{ XML_CENTER, text::HorizontalAdjust_CENTER },
|
|
|
|
{ XML_RIGHT, text::HorizontalAdjust_RIGHT },
|
2018-01-15 09:00:57 +01:00
|
|
|
{ XML_TOKEN_INVALID, text::HorizontalAdjust(0) }
|
2009-04-23 10:42:05 +00:00
|
|
|
};
|
|
|
|
|
2014-06-13 17:53:15 +02:00
|
|
|
if (SvXMLUnitConverter::convertEnum(
|
2001-04-17 11:01:21 +00:00
|
|
|
sBuf, eLineAdjust, aXML_HorizontalAdjust_Enum))
|
|
|
|
{
|
2001-06-29 20:07:26 +00:00
|
|
|
rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_ADJUSTMENT,
|
2001-04-17 11:01:21 +00:00
|
|
|
sBuf.makeStringAndClear());
|
2001-02-21 18:28:49 +00:00
|
|
|
}
|
2001-04-17 11:01:21 +00:00
|
|
|
|
|
|
|
// relative line width
|
#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::convertPercent(sBuf, nLineRelWidth);
|
2001-06-29 20:07:26 +00:00
|
|
|
rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_REL_WIDTH,
|
2001-04-17 11:01:21 +00:00
|
|
|
sBuf.makeStringAndClear());
|
|
|
|
|
|
|
|
// color
|
#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::convertColor(sBuf, nLineColor);
|
2001-06-29 20:07:26 +00:00
|
|
|
rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_COLOR,
|
2001-04-17 11:01:21 +00:00
|
|
|
sBuf.makeStringAndClear());
|
|
|
|
|
2011-03-17 17:39:42 +01:00
|
|
|
// line-style
|
|
|
|
|
2001-04-17 11:01:21 +00:00
|
|
|
SvXMLElementExport aElem(rExport, XML_NAMESPACE_STYLE,
|
2014-03-28 16:28:51 +02:00
|
|
|
XML_FOOTNOTE_SEP, true, true);
|
2001-02-21 18:28:49 +00:00
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|