Kaydet (Commit) 1fe24bb1 authored tarafından Mike Kaganski's avatar Mike Kaganski

Further cleanup of FastSerializerHelper's startElement/singleElement[NS]

Drop FSEND_t: C-style varargs code was replaced since version 6.0 in commit
d43fc407, so it's time to remove the last bits.

Drop int-to-string macros that are simple wrappers over OString::number.

Avoid unnecessary string type conversions.

Change-Id: I86478577b8e469f99b5a90619e5f78a61f4f23fb
Reviewed-on: https://gerrit.libreoffice.org/70964
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 2a6450cb
......@@ -24,21 +24,13 @@
#include <rtl/textenc.h>
#include <sal/types.h>
inline OString I32S_(sal_Int32 x) { return OString::number(x); }
inline OString I32SHEX_(sal_Int32 x)
inline OString I32SHEX(sal_Int32 x)
{
OString aStr = OString::number(x, 16);
while (aStr.getLength() < 6)
aStr = OString("0") + aStr;
return aStr.getStr();
return aStr;
}
inline OString I64S_(sal_Int64 x) { return OString::number(x); }
inline OString DS_(double x) { return OString::number(x); }
#define I32S(x) I32S_(x).getStr()
#define I32SHEX(x) I32SHEX_(x).getStr()
#define I64S(x) I64S_(x).getStr()
#define IS(x) OString::number( x ).getStr()
#define DS(x) DS_(x).getStr()
/**
* @return const char* literal "true" for true value, or literal "false"
......
......@@ -31,13 +31,6 @@ namespace com { namespace sun { namespace star { namespace io { class XOutputStr
namespace sax_fastparser { class FastAttributeList; }
#define FSNS(namespc, element) ((namespc << 16) | element)
// Backwards compatibility for code that used FSEND to terminate the vararg.
// As soon as no supported LO version has the varargs code, this can be removed entirely
// (otherwise backports might break silently if people didn't add FSEND).
// Ctor is there to get an error when trying to pass it to a vararg by accident.
struct FSEND_t { FSEND_t() {}; };
static const FSEND_t FSEND = FSEND_t();
const sal_Int32 FSEND_internal = -1; // same as XML_TOKEN_INVALID
namespace sax_fastparser {
......@@ -69,7 +62,7 @@ public:
pushAttributeValue(attribute, value);
startElement(elementTokenId, std::forward<Args>(args)...);
}
void startElement(sal_Int32 elementTokenId, FSEND_t);
void startElement(sal_Int32 elementTokenId);
/// Start an element. After the first two arguments there can be a number of (attribute, value) pairs.
template<typename... Args>
......@@ -85,9 +78,9 @@ public:
pushAttributeValue(attribute, value);
startElementNS(namespaceTokenId, elementTokenId, std::forward<Args>(args)...);
}
void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, FSEND_t)
void startElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId)
{
startElement(FSNS(namespaceTokenId, elementTokenId), FSEND);
startElement(FSNS(namespaceTokenId, elementTokenId));
}
/// Create a single element. After the first argument there can be a number of (attribute, value) pairs.
......@@ -104,7 +97,7 @@ public:
pushAttributeValue(attribute, value);
singleElement(elementTokenId, std::forward<Args>(args)...);
}
void singleElement(sal_Int32 elementTokenId, FSEND_t);
void singleElement(sal_Int32 elementTokenId);
/// Create a single element. After the first two arguments there can be a number of (attribute, value) pairs.
template<typename... Args>
......@@ -120,9 +113,9 @@ public:
pushAttributeValue(attribute, value);
singleElementNS(namespaceTokenId, elementTokenId, std::forward<Args>(args)...);
}
void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId, FSEND_t)
void singleElementNS(sal_Int32 namespaceTokenId, sal_Int32 elementTokenId)
{
singleElement(FSNS(namespaceTokenId, elementTokenId), FSEND);
singleElement(FSNS(namespaceTokenId, elementTokenId));
}
void endElement(sal_Int32 elementTokenId);
......
......@@ -545,7 +545,7 @@ OUString XmlFilterBase::addRelation( const Reference< XOutputStream >& rOutputSt
static void
writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const OUString& sValue )
{
pDoc->startElement( nXmlElement, FSEND );
pDoc->startElement(nXmlElement);
pDoc->writeEscaped( sValue );
pDoc->endElement( nXmlElement );
}
......@@ -553,7 +553,7 @@ writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const OUString& sV
static void
writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const sal_Int32 nValue )
{
pDoc->startElement( nXmlElement, FSEND );
pDoc->startElement(nXmlElement);
pDoc->write( nValue );
pDoc->endElement( nXmlElement );
}
......@@ -565,11 +565,9 @@ writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const util::DateTi
return;
if ( ( nXmlElement >> 16 ) != XML_dcterms )
pDoc->startElement( nXmlElement, FSEND );
pDoc->startElement(nXmlElement);
else
pDoc->startElement( nXmlElement,
FSNS( XML_xsi, XML_type ), "dcterms:W3CDTF",
FSEND );
pDoc->startElement(nXmlElement, FSNS(XML_xsi, XML_type), "dcterms:W3CDTF");
char pStr[200];
snprintf( pStr, sizeof( pStr ), "%d-%02d-%02dT%02d:%02d:%02dZ",
......@@ -622,12 +620,11 @@ writeCoreProperties( XmlFilterBase& rSelf, const Reference< XDocumentProperties
"docProps/core.xml",
"application/vnd.openxmlformats-package.core-properties+xml" );
pCoreProps->startElementNS( XML_cp, XML_coreProperties,
FSNS( XML_xmlns, XML_cp ), OUStringToOString(rSelf.getNamespaceURL(OOX_NS(packageMetaCorePr)), RTL_TEXTENCODING_UTF8).getStr(),
FSNS( XML_xmlns, XML_dc ), OUStringToOString(rSelf.getNamespaceURL(OOX_NS(dc)), RTL_TEXTENCODING_UTF8).getStr(),
FSNS( XML_xmlns, XML_dcterms ), OUStringToOString(rSelf.getNamespaceURL(OOX_NS(dcTerms)), RTL_TEXTENCODING_UTF8).getStr(),
FSNS( XML_xmlns, XML_dcmitype ), OUStringToOString(rSelf.getNamespaceURL(OOX_NS(dcmiType)), RTL_TEXTENCODING_UTF8).getStr(),
FSNS( XML_xmlns, XML_xsi ), OUStringToOString(rSelf.getNamespaceURL(OOX_NS(xsi)), RTL_TEXTENCODING_UTF8).getStr(),
FSEND );
FSNS(XML_xmlns, XML_cp), rSelf.getNamespaceURL(OOX_NS(packageMetaCorePr)).toUtf8(),
FSNS(XML_xmlns, XML_dc), rSelf.getNamespaceURL(OOX_NS(dc)).toUtf8(),
FSNS(XML_xmlns, XML_dcterms), rSelf.getNamespaceURL(OOX_NS(dcTerms)).toUtf8(),
FSNS(XML_xmlns, XML_dcmitype), rSelf.getNamespaceURL(OOX_NS(dcmiType)).toUtf8(),
FSNS(XML_xmlns, XML_xsi), rSelf.getNamespaceURL(OOX_NS(xsi)).toUtf8());
#ifdef OOXTODO
writeElement( pCoreProps, FSNS( XML_cp, XML_category ), "category" );
......@@ -665,9 +662,8 @@ writeAppProperties( XmlFilterBase& rSelf, const Reference< XDocumentProperties >
"docProps/app.xml",
"application/vnd.openxmlformats-officedocument.extended-properties+xml" );
pAppProps->startElement( XML_Properties,
XML_xmlns, OUStringToOString(rSelf.getNamespaceURL(OOX_NS(officeExtPr)), RTL_TEXTENCODING_UTF8).getStr(),
FSNS( XML_xmlns, XML_vt ), OUStringToOString(rSelf.getNamespaceURL(OOX_NS(officeDocPropsVT)), RTL_TEXTENCODING_UTF8).getStr(),
FSEND );
XML_xmlns, rSelf.getNamespaceURL(OOX_NS(officeExtPr)).toUtf8(),
FSNS(XML_xmlns, XML_vt), rSelf.getNamespaceURL(OOX_NS(officeDocPropsVT)).toUtf8());
writeElement( pAppProps, XML_Template, xProperties->getTemplateName() );
#ifdef OOXTODO
......@@ -778,9 +774,8 @@ writeCustomProperties( XmlFilterBase& rSelf, const Reference< XDocumentPropertie
"docProps/custom.xml",
"application/vnd.openxmlformats-officedocument.custom-properties+xml" );
pAppProps->startElement( XML_Properties,
XML_xmlns, OUStringToOString(rSelf.getNamespaceURL(OOX_NS(officeCustomPr)), RTL_TEXTENCODING_UTF8).getStr(),
FSNS( XML_xmlns, XML_vt ), OUStringToOString(rSelf.getNamespaceURL(OOX_NS(officeDocPropsVT)), RTL_TEXTENCODING_UTF8).getStr(),
FSEND );
XML_xmlns, rSelf.getNamespaceURL(OOX_NS(officeCustomPr)).toUtf8(),
FSNS(XML_xmlns, XML_vt), rSelf.getNamespaceURL(OOX_NS(officeDocPropsVT)).toUtf8());
size_t nIndex = 0;
for (const auto& rProp : aprop)
......@@ -792,8 +787,7 @@ writeCustomProperties( XmlFilterBase& rSelf, const Reference< XDocumentPropertie
pAppProps->startElement( XML_property ,
XML_fmtid, "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
XML_pid, OString::number(nIndex + 2),
XML_name, aName,
FSEND);
XML_name, aName);
switch ( rProp.Value.getValueTypeClass() )
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -425,9 +425,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
case ESCHER_WrapThrough: pWrapType = "through"; break;
}
if ( pWrapType )
m_pSerializer->singleElementNS( XML_w10, XML_wrap,
XML_type, pWrapType,
FSEND );
m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, pWrapType);
}
bAlreadyWritten[ ESCHER_Prop_WrapText ] = true;
break;
......@@ -907,9 +905,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle&
OUString aTextPathString = SvxMSDffManager::MSDFFReadZString(aStream, opt.nProp.size(), true);
aStream.Seek(0);
m_pSerializer->singleElementNS( XML_v, XML_path,
XML_textpathok, "t",
FSEND );
m_pSerializer->singleElementNS(XML_v, XML_path, XML_textpathok, "t");
sax_fastparser::FastAttributeList* pAttrList = FastSerializerHelper::createAttrList();
pAttrList->add(XML_on, "t");
......@@ -1374,7 +1370,7 @@ sal_Int32 VMLExport::StartShape()
if( pParaObj )
{
// this is reached only in case some text is attached to the shape
m_pSerializer->startElementNS(XML_v, XML_textbox, FSEND);
m_pSerializer->startElementNS(XML_v, XML_textbox);
m_pTextExport->WriteOutliner(*pParaObj);
m_pSerializer->endElementNS(XML_v, XML_textbox);
if( bOwnParaObj )
......
......@@ -40,7 +40,7 @@ FastSerializerHelper::~FastSerializerHelper()
delete mpSerializer;
}
void FastSerializerHelper::startElement(sal_Int32 elementTokenId, FSEND_t)
void FastSerializerHelper::startElement(sal_Int32 elementTokenId)
{
mpSerializer->startFastElement(elementTokenId);
}
......@@ -52,7 +52,7 @@ void FastSerializerHelper::pushAttributeValue(sal_Int32 attribute, const OString
{
mpSerializer->getTokenValueList().emplace_back(attribute, value.getStr());
}
void FastSerializerHelper::singleElement(sal_Int32 elementTokenId, FSEND_t)
void FastSerializerHelper::singleElement(sal_Int32 elementTokenId)
{
mpSerializer->singleFastElement(elementTokenId);
}
......
......@@ -688,8 +688,7 @@ void ExcTable::WriteXml( XclExpXmlStream& rStrm )
pWorksheet->startElement( XML_worksheet,
XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
FSEND );
FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8() );
SetCurrScTab( mnScTab );
if (mxCellTable)
......@@ -808,15 +807,14 @@ void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
rWorkbook->startElement( XML_workbook,
XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
FSEND );
FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8() );
rWorkbook->singleElement( XML_fileVersion,
XML_appName, "Calc",
XML_appName, "Calc"
// OOXTODO: XML_codeName
// OOXTODO: XML_lastEdited
// OOXTODO: XML_lowestEdited
// OOXTODO: XML_rupBuild
FSEND );
);
if( !maTableList.IsEmpty() )
{
......
......@@ -376,21 +376,20 @@ void XclExpXmlSheetPr::SaveXml( XclExpXmlStream& rStrm )
// OOXTODO: XML_transitionEntry,
// OOXTODO: XML_published,
// OOXTODO: XML_codeName,
XML_filterMode, mpManager ? ToPsz( mpManager->HasFilterMode( mnScTab ) ) : nullptr,
// OOXTODO: XML_enableFormatConditionsCalculation,
FSEND );
XML_filterMode, mpManager ? ToPsz(mpManager->HasFilterMode(mnScTab)) : nullptr
// OOXTODO: XML_enableFormatConditionsCalculation
);
// Note : the order of child elements is significant. Don't change the order.
// OOXTODO: XML_outlinePr
if (maTabColor != COL_AUTO)
rWorksheet->singleElement(
XML_tabColor, XML_rgb, XclXmlUtils::ToOString(maTabColor).getStr(), FSEND);
rWorksheet->singleElement(XML_tabColor, XML_rgb, XclXmlUtils::ToOString(maTabColor));
rWorksheet->singleElement(XML_pageSetUpPr,
// OOXTODO: XML_autoPageBreaks,
XML_fitToPage, ToPsz(mbFitToPage), FSEND);
XML_fitToPage, ToPsz(mbFitToPage));
rWorksheet->endElement( XML_sheetPr );
}
......@@ -463,13 +462,12 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm )
XML_sort, pTabProtect->isOptionEnabled( ScTableProtection::SORT ) ? ToPsz( false ) : nullptr,
XML_autoFilter, pTabProtect->isOptionEnabled( ScTableProtection::AUTOFILTER ) ? ToPsz( false ) : nullptr,
XML_pivotTables, pTabProtect->isOptionEnabled( ScTableProtection::PIVOT_TABLES ) ? ToPsz( false ) : nullptr,
XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? nullptr : ToPsz( true ),
FSEND );
XML_selectUnlockedCells, pTabProtect->isOptionEnabled( ScTableProtection::SELECT_UNLOCKED_CELLS ) ? nullptr : ToPsz( true ) );
const ::std::vector<ScEnhancedProtection>& rProts( pTabProtect->getEnhancedProtection());
if (!rProts.empty())
{
rWorksheet->startElement( XML_protectedRanges, FSEND);
rWorksheet->startElement(XML_protectedRanges);
for (const auto& rProt : rProts)
{
SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && !rProt.maSecurityDescriptor.empty(),
......@@ -486,8 +484,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm )
XML_hashValue, rProt.maPasswordHash.maHashValue.isEmpty() ? nullptr : rProt.maPasswordHash.maHashValue.toUtf8().getStr(),
XML_saltValue, rProt.maPasswordHash.maSaltValue.isEmpty() ? nullptr : rProt.maPasswordHash.maSaltValue.toUtf8().getStr(),
XML_spinCount, rProt.maPasswordHash.mnSpinCount ? OString::number( rProt.maPasswordHash.mnSpinCount).getStr() : nullptr,
XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( *rProt.maRangeList).getStr() : nullptr,
FSEND);
XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( *rProt.maRangeList).getStr() : nullptr);
}
rWorksheet->endElement( XML_protectedRanges);
}
......@@ -602,8 +599,7 @@ void ExcFilterCondition::SaveXml( XclExpXmlStream& rStrm )
rStrm.GetCurrentStream()->singleElement( XML_customFilter,
XML_operator, lcl_GetOperator( nOper ),
XML_val, lcl_GetValue( nType, fVal, pText.get() ).getStr(),
FSEND );
XML_val, lcl_GetValue(nType, fVal, pText.get()) );
}
void ExcFilterCondition::SaveText( XclExpStream& rStrm )
......@@ -793,10 +789,10 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm )
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_filterColumn,
XML_colId, OString::number( nCol ).getStr(),
XML_colId, OString::number(nCol)
// OOXTODO: XML_hiddenButton, AutoFilter12 fHideArrow?
// OOXTODO: XML_showButton,
FSEND );
// OOXTODO: XML_showButton
);
switch (meType)
{
......@@ -807,14 +803,13 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm )
rWorksheet->singleElement( XML_top10,
XML_top, ToPsz( get_flag( nFlags, EXC_AFFLAG_TOP10TOP ) ),
XML_percent, ToPsz( get_flag( nFlags, EXC_AFFLAG_TOP10PERC ) ),
XML_val, OString::number( (nFlags >> 7 ) ).getStr(),
// OOXTODO: XML_filterVal,
FSEND );
XML_val, OString::number((nFlags >> 7))
// OOXTODO: XML_filterVal
);
}
rWorksheet->startElement( XML_customFilters,
XML_and, ToPsz( (nFlags & EXC_AFFLAG_ANDORMASK) == EXC_AFFLAG_AND ),
FSEND );
XML_and, ToPsz((nFlags & EXC_AFFLAG_ANDORMASK) == EXC_AFFLAG_AND) );
aCond[ 0 ].SaveXml( rStrm );
aCond[ 1 ].SaveXml( rStrm );
rWorksheet->endElement( XML_customFilters );
......@@ -824,12 +819,12 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm )
break;
case MultiValue:
{
rWorksheet->startElement(XML_filters, FSEND);
rWorksheet->startElement(XML_filters);
for (const auto& rMultiValue : maMultiValues)
{
OString aStr = OUStringToOString(rMultiValue, RTL_TEXTENCODING_UTF8);
const char* pz = aStr.getStr();
rWorksheet->singleElement(XML_filter, XML_val, pz, FSEND);
rWorksheet->singleElement(XML_filter, XML_val, pz);
}
rWorksheet->endElement(XML_filters);
}
......@@ -991,9 +986,7 @@ void ExcAutoFilterRecs::SaveXml( XclExpXmlStream& rStrm )
return;
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_autoFilter,
XML_ref, XclXmlUtils::ToOString( maRef ).getStr(),
FSEND );
rWorksheet->startElement(XML_autoFilter, XML_ref, XclXmlUtils::ToOString(maRef));
// OOXTODO: XML_extLst, XML_sortState
if( !maFilterList.IsEmpty() )
maFilterList.SaveXml( rStrm );
......
......@@ -67,7 +67,7 @@ void XclExpTablesImpl8::SaveXml( XclExpXmlStream& rStrm )
{
sax_fastparser::FSHelperPtr& pWorksheetStrm = rStrm.GetCurrentStream();
pWorksheetStrm->startElement( XML_tableParts, FSEND);
pWorksheetStrm->startElement(XML_tableParts);
for (auto const& it : maTables)
{
OUString aRelId;
......@@ -79,9 +79,7 @@ void XclExpTablesImpl8::SaveXml( XclExpXmlStream& rStrm )
CREATE_OFFICEDOC_RELATION_TYPE("table"),
&aRelId);
pWorksheetStrm->singleElement( XML_tablePart,
FSNS(XML_r, XML_id), aRelId.toUtf8(),
FSEND);
pWorksheetStrm->singleElement(XML_tablePart, FSNS(XML_r, XML_id), aRelId.toUtf8());
rStrm.PushStream( pTableStrm);
SaveTableXml( rStrm, it);
......@@ -181,13 +179,13 @@ void XclExpTables::SaveTableXml( XclExpXmlStream& rStrm, const Entry& rEntry )
sax_fastparser::FSHelperPtr& pTableStrm = rStrm.GetCurrentStream();
pTableStrm->startElement( XML_table,
XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
XML_id, OString::number( rEntry.mnTableId).getStr(),
XML_id, OString::number( rEntry.mnTableId),
XML_name, rData.GetName().toUtf8(),
XML_displayName, rData.GetName().toUtf8(),
XML_ref, XclXmlUtils::ToOString(aRange),
XML_headerRowCount, ToPsz10(rData.HasHeader()),
XML_totalsRowCount, ToPsz10(rData.HasTotals()),
XML_totalsRowShown, ToPsz10(rData.HasTotals()), // we don't support that but if there are totals they are shown
XML_totalsRowShown, ToPsz10(rData.HasTotals()) // we don't support that but if there are totals they are shown
// OOXTODO: XML_comment, ...,
// OOXTODO: XML_connectionId, ...,
// OOXTODO: XML_dataCellStyle, ...,
......@@ -202,8 +200,8 @@ void XclExpTables::SaveTableXml( XclExpXmlStream& rStrm, const Entry& rEntry )
// OOXTODO: XML_tableType, ...,
// OOXTODO: XML_totalsRowBorderDxfId, ...,
// OOXTODO: XML_totalsRowCellStyle, ...,
// OOXTODO: XML_totalsRowDxfId, ...,
FSEND);
// OOXTODO: XML_totalsRowDxfId, ...
);
if (rData.HasAutoFilter())
{
......@@ -222,9 +220,8 @@ void XclExpTables::SaveTableXml( XclExpXmlStream& rStrm, const Entry& rEntry )
const std::vector< OUString >& rColNames = rData.GetTableColumnNames();
if (!rColNames.empty())
{
pTableStrm->startElement( XML_tableColumns,
XML_count, OString::number( aRange.aEnd.Col() - aRange.aStart.Col() + 1).getStr(),
FSEND);
pTableStrm->startElement(XML_tableColumns,
XML_count, OString::number(aRange.aEnd.Col() - aRange.aStart.Col() + 1));
for (size_t i=0, n=rColNames.size(); i < n; ++i)
{
......@@ -235,8 +232,8 @@ void XclExpTables::SaveTableXml( XclExpXmlStream& rStrm, const Entry& rEntry )
// OOXTODO: write <totalsRowFormula> once we support it.
pTableStrm->singleElement( XML_tableColumn,
XML_id, OString::number(i+1).getStr(),
XML_name, OUStringToOString( rColNames[i], RTL_TEXTENCODING_UTF8).getStr(),
XML_id, OString::number(i+1),
XML_name, rColNames[i].toUtf8()
// OOXTODO: XML_dataCellStyle, ...,
// OOXTODO: XML_dataDxfId, ...,
// OOXTODO: XML_headerRowCellStyle, ...,
......@@ -246,8 +243,8 @@ void XclExpTables::SaveTableXml( XclExpXmlStream& rStrm, const Entry& rEntry )
// OOXTODO: XML_totalsRowDxfId, ...,
// OOXTODO: XML_totalsRowFunction, ...,
// OOXTODO: XML_totalsRowLabel, ...,
// OOXTODO: XML_uniqueName, ...,
FSEND);
// OOXTODO: XML_uniqueName, ...
);
}
pTableStrm->endElement( XML_tableColumns);
......
......@@ -130,16 +130,16 @@ const char *ToVertAlign( SdrTextVertAdjust eAdjust )
void lcl_WriteAnchorVertex( sax_fastparser::FSHelperPtr const & rComments, const tools::Rectangle &aRect )
{
rComments->startElement( FSNS( XML_xdr, XML_col ), FSEND );
rComments->startElement(FSNS(XML_xdr, XML_col));
rComments->writeEscaped( OUString::number( aRect.Left() ) );
rComments->endElement( FSNS( XML_xdr, XML_col ) );
rComments->startElement( FSNS( XML_xdr, XML_colOff ), FSEND );
rComments->startElement(FSNS(XML_xdr, XML_colOff));
rComments->writeEscaped( OUString::number( aRect.Top() ) );
rComments->endElement( FSNS( XML_xdr, XML_colOff ) );
rComments->startElement( FSNS( XML_xdr, XML_row ), FSEND );
rComments->startElement(FSNS(XML_xdr, XML_row));
rComments->writeEscaped( OUString::number( aRect.Right() ) );
rComments->endElement( FSNS( XML_xdr, XML_row ) );
rComments->startElement( FSNS( XML_xdr, XML_rowOff ), FSEND );
rComments->startElement(FSNS(XML_xdr, XML_rowOff));
rComments->writeEscaped( OUString::number( aRect.Bottom() ) );
rComments->endElement( FSNS( XML_xdr, XML_rowOff ) );
}
......@@ -437,9 +437,7 @@ void XclExpImgData::SaveXml( XclExpXmlStream& rStrm )
DrawingML aDML(pWorksheet, &rStrm, drawingml::DOCUMENT_XLSX);
OUString rId = aDML.WriteImage( maGraphic );
pWorksheet->singleElement( XML_picture,
FSNS(XML_r, XML_id), rId.toUtf8(),
FSEND );
pWorksheet->singleElement(XML_picture, FSNS(XML_r, XML_id), rId.toUtf8());
}
XclExpControlHelper::XclExpControlHelper( const XclExpRoot& rRoot ) :
......@@ -1121,8 +1119,7 @@ void XclExpChartObj::SaveXml( XclExpXmlStream& rStrm )
// FIXME: two cell? it seems the two cell anchor is incorrect.
pDrawing->startElement( FSNS( XML_xdr, XML_twoCellAnchor ), // OOXTODO: oneCellAnchor, absoluteAnchor
XML_editAs, "oneCell",
FSEND );
XML_editAs, "oneCell" );
Reference< XPropertySet > xPropSet( mxShape, UNO_QUERY );
if (xPropSet.is())
{
......@@ -1138,10 +1135,10 @@ void XclExpChartObj::SaveXml( XclExpXmlStream& rStrm )
// TODO: get the correcto chart number
}
pDrawing->singleElement( FSNS( XML_xdr, XML_clientData),
pDrawing->singleElement( FSNS( XML_xdr, XML_clientData)
// OOXTODO: XML_fLocksWithSheet
// OOXTODO: XML_fPrintsWithSheet
FSEND );
);
pDrawing->endElement( FSNS( XML_xdr, XML_twoCellAnchor ) );
}
......@@ -1291,11 +1288,11 @@ void XclExpNote::WriteXml( sal_Int32 nAuthorId, XclExpXmlStream& rStrm )
sax_fastparser::FSHelperPtr rComments = rStrm.GetCurrentStream();
rComments->startElement( XML_comment,
XML_ref, XclXmlUtils::ToOString( maScPos ).getStr(),
XML_authorId, OString::number( nAuthorId ).getStr(),
// OOXTODO: XML_guid,
FSEND );
rComments->startElement( XML_text, FSEND );
XML_ref, XclXmlUtils::ToOString(maScPos),
XML_authorId, OString::number(nAuthorId)
// OOXTODO: XML_guid
);
rComments->startElement(XML_text);
// OOXTODO: phoneticPr, rPh, r
if( mpNoteContents )
mpNoteContents->WriteXml( rStrm );
......@@ -1308,8 +1305,8 @@ void XclExpNote::WriteXml( sal_Int32 nAuthorId, XclExpXmlStream& rStrm )
#if 1//def XLSX_OOXML_FUTURE
if( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 )
{
rComments->startElement( FSNS( XML_mc, XML_AlternateContent ), FSEND );
rComments->startElement( FSNS( XML_mc, XML_Choice ), XML_Requires, "v2", FSEND );
rComments->startElement(FSNS(XML_mc, XML_AlternateContent));
rComments->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, "v2");
rComments->startElement( XML_commentPr,
XML_autoFill, ToPsz( mbAutoFill ),
XML_autoScale, ToPsz( mbAutoScale ),
......@@ -1317,23 +1314,19 @@ void XclExpNote::WriteXml( sal_Int32 nAuthorId, XclExpXmlStream& rStrm )
XML_locked, ToPsz( mbLocked ),
XML_rowHidden, ToPsz( mbRowHidden ),
XML_textHAlign, ToHorizAlign( meTHA ),
XML_textVAlign, ToVertAlign( meTVA ) ,
FSEND );
rComments->startElement( XML_anchor,
XML_moveWithCells, "false",
XML_sizeWithCells, "false",
FSEND );
rComments->startElement( FSNS( XML_xdr, XML_from ), FSEND );
XML_textVAlign, ToVertAlign( meTVA ) );
rComments->startElement(XML_anchor, XML_moveWithCells, "false", XML_sizeWithCells, "false");
rComments->startElement(FSNS(XML_xdr, XML_from));
lcl_WriteAnchorVertex( rComments, maCommentFrom );
rComments->endElement( FSNS( XML_xdr, XML_from ) );
rComments->startElement( FSNS( XML_xdr, XML_to ), FSEND );
rComments->startElement(FSNS(XML_xdr, XML_to));
lcl_WriteAnchorVertex( rComments, maCommentTo );
rComments->endElement( FSNS( XML_xdr, XML_to ) );
rComments->endElement( XML_anchor );
rComments->endElement( XML_commentPr );
rComments->endElement( FSNS( XML_mc, XML_Choice ) );
rComments->startElement( FSNS( XML_mc, XML_Fallback ), FSEND );
rComments->startElement(FSNS(XML_mc, XML_Fallback));
// Any fallback code ?
rComments->endElement( FSNS( XML_mc, XML_Fallback ) );
rComments->endElement( FSNS( XML_mc, XML_AlternateContent ) );
......@@ -1429,15 +1422,13 @@ void XclExpComments::SaveXml( XclExpXmlStream& rStrm )
FSNS(XML_xmlns, XML_mc), rStrm.getNamespaceURL(OOX_NS(mce)).toUtf8(),
FSNS(XML_xmlns, XML_xdr), rStrm.getNamespaceURL(OOX_NS(dmlSpreadDr)).toUtf8(),
FSNS(XML_xmlns, XML_v2), rStrm.getNamespaceURL(OOX_NS(mceTest)).toUtf8(),
FSNS( XML_mc, XML_Ignorable ), "v2",
FSEND );
FSNS( XML_mc, XML_Ignorable ), "v2" );
else
rComments->startElement( XML_comments,
XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
FSNS(XML_xmlns, XML_xdr), rStrm.getNamespaceURL(OOX_NS(dmlSpreadDr)).toUtf8(),
FSEND );
FSNS(XML_xmlns, XML_xdr), rStrm.getNamespaceURL(OOX_NS(dmlSpreadDr)).toUtf8() );
rComments->startElement( XML_authors, FSEND );
rComments->startElement(XML_authors);
typedef std::set<OUString> Authors;
Authors aAuthors;
......@@ -1450,13 +1441,13 @@ void XclExpComments::SaveXml( XclExpXmlStream& rStrm )
for( const auto& rAuthor : aAuthors )
{
rComments->startElement( XML_author, FSEND );
rComments->startElement(XML_author);
rComments->writeEscaped( rAuthor );
rComments->endElement( XML_author );
}
rComments->endElement( XML_authors );
rComments->startElement( XML_commentList, FSEND );
rComments->startElement(XML_commentList);
Authors::const_iterator aAuthorsBegin = aAuthors.begin();
for( size_t i = 0; i < nNotes; ++i )
......
......@@ -33,8 +33,7 @@ XclExpExtNegativeColor::XclExpExtNegativeColor( const Color& rColor ):
void XclExpExtNegativeColor::SaveXml( XclExpXmlStream& rStrm )
{
rStrm.GetCurrentStream()->singleElementNS( XML_x14, XML_negativeFillColor,
XML_rgb, XclXmlUtils::ToOString( maColor ).getStr(),
FSEND );
XML_rgb, XclXmlUtils::ToOString(maColor) );
}
XclExpExtAxisColor::XclExpExtAxisColor( const Color& rColor ):
......@@ -45,8 +44,7 @@ XclExpExtAxisColor::XclExpExtAxisColor( const Color& rColor ):
void XclExpExtAxisColor::SaveXml( XclExpXmlStream& rStrm )
{
rStrm.GetCurrentStream()->singleElementNS( XML_x14, XML_axisColor,
XML_rgb, XclXmlUtils::ToOString( maAxisColor ).getStr(),
FSEND );
XML_rgb, XclXmlUtils::ToOString(maAxisColor) );
}
XclExpExtIcon::XclExpExtIcon(const XclExpRoot& rRoot, const std::pair<ScIconSetType, sal_Int32>& rCustomEntry):
......@@ -68,8 +66,7 @@ void XclExpExtIcon::SaveXml(XclExpXmlStream& rStrm)
rWorksheet->singleElementNS(XML_x14, XML_cfIcon,
XML_iconSet, pIconSetName,
XML_iconId, OString::number(nIndex).getStr(),
FSEND);
XML_iconId, OString::number(nIndex));
}
XclExpExtCfvo::XclExpExtCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rEntry, const ScAddress& rSrcPos, bool bFirst ):
......@@ -123,16 +120,14 @@ const char* getColorScaleType( ScColorScaleEntryType eType, bool bFirst )
void XclExpExtCfvo::SaveXml( XclExpXmlStream& rStrm )
{
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElementNS( XML_x14, XML_cfvo,
XML_type, getColorScaleType(meType, mbFirst),
FSEND );
rWorksheet->startElementNS(XML_x14, XML_cfvo, XML_type, getColorScaleType(meType, mbFirst));
if (meType == COLORSCALE_FORMULA ||
meType == COLORSCALE_PERCENT ||
meType == COLORSCALE_PERCENTILE ||
meType == COLORSCALE_VALUE)
{
rWorksheet->startElementNS(XML_xm, XML_f, FSEND);
rWorksheet->startElementNS(XML_xm, XML_f);
rWorksheet->writeEscaped(maValue.getStr());
rWorksheet->endElementNS(XML_xm, XML_f);
}
......@@ -180,11 +175,10 @@ void XclExpExtDataBar::SaveXml( XclExpXmlStream& rStrm )
{
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElementNS( XML_x14, XML_dataBar,
XML_minLength, OString::number(mnMinLength).getStr(),
XML_maxLength, OString::number(mnMaxLength).getStr(),
XML_minLength, OString::number(mnMinLength),
XML_maxLength, OString::number(mnMaxLength),
XML_axisPosition, getAxisPosition(meAxisPosition),
XML_gradient, ToPsz(mbGradient),
FSEND );
XML_gradient, ToPsz(mbGradient) );
mpLowerLimit->SaveXml( rStrm );
mpUpperLimit->SaveXml( rStrm );
......@@ -224,8 +218,7 @@ void XclExpExtIconSet::SaveXml(XclExpXmlStream& rStrm)
XML_iconSet, mpIconSetName,
XML_custom, mbCustom ? ToPsz10(mbCustom) : nullptr,
XML_reverse, ToPsz10(mbReverse),
XML_showValue, ToPsz10(mbShowValue),
FSEND);
XML_showValue, ToPsz10(mbShowValue));
maCfvos.SaveXml(rStrm);
......@@ -273,8 +266,7 @@ void XclExpExtCfRule::SaveXml( XclExpXmlStream& rStrm )
rWorksheet->startElementNS( XML_x14, XML_cfRule,
XML_type, pType,
XML_priority, mnPriority == -1 ? nullptr : OString::number(mnPriority).getStr(),
XML_id, maId.getStr(),
FSEND );
XML_id, maId );
mxEntry->SaveXml( rStrm );
......@@ -332,11 +324,10 @@ void XclExpExtConditionalFormatting::SaveXml( XclExpXmlStream& rStrm )
{
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElementNS( XML_x14, XML_conditionalFormatting,
FSNS( XML_xmlns, XML_xm ), rStrm.getNamespaceURL(OOX_NS(xm)).toUtf8(),
FSEND );
FSNS( XML_xmlns, XML_xm ), rStrm.getNamespaceURL(OOX_NS(xm)).toUtf8() );
maCfRules.SaveXml( rStrm );
rWorksheet->startElementNS( XML_xm, XML_sqref, FSEND );
rWorksheet->startElementNS(XML_xm, XML_sqref);