summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-01-21 21:44:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-01-22 08:36:51 +0100
commit357bf8984ada1259720903ad7c7c44c9a6551cc8 (patch)
treed2a0db94d9e5d465c71de70c8608c2bec7532c85 /xmloff
parentf6c01b471a08ad1cb38377b8d82dba89206ea8cb (diff)
Convert reportdesign to fastparser
Change-Id: I0703344aad4ca6c72e494160b019c13e24cc843a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87160 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/txtparai.cxx62
1 files changed, 62 insertions, 0 deletions
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index 3a86343f7864..5983682863e0 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -144,6 +144,37 @@ XMLCharContext::XMLCharContext(
}
XMLCharContext::XMLCharContext(
+ SvXMLImport& rImport,
+ const Reference< xml::sax::XFastAttributeList > & xAttrList,
+ sal_Unicode c,
+ bool bCount ) :
+ SvXMLImportContext( rImport )
+ ,m_nControl(0)
+ ,m_nCount(1)
+ ,m_c(c)
+{
+ if( bCount )
+ {
+ sax_fastparser::FastAttributeList *pAttribList =
+ sax_fastparser::FastAttributeList::castToFastAttributeList( xAttrList );
+ for (auto &aIter : *pAttribList)
+ {
+ if( aIter.getToken() == XML_ELEMENT(TEXT, XML_C) )
+ {
+ sal_Int32 nTmp = aIter.toInt32();
+ if( nTmp > 0 )
+ {
+ if( nTmp > SAL_MAX_UINT16 )
+ m_nCount = SAL_MAX_UINT16;
+ else
+ m_nCount = static_cast<sal_uInt16>(nTmp);
+ }
+ }
+ }
+ }
+}
+
+XMLCharContext::XMLCharContext(
SvXMLImport& rImp,
sal_uInt16 nPrfx,
const OUString& rLName,
@@ -156,6 +187,16 @@ XMLCharContext::XMLCharContext(
{
}
+XMLCharContext::XMLCharContext(
+ SvXMLImport& rImp,
+ sal_Int16 nControl ) :
+ SvXMLImportContext( rImp )
+ ,m_nControl(nControl)
+ ,m_nCount(0)
+ ,m_c(0)
+{
+}
+
XMLCharContext::~XMLCharContext()
{
}
@@ -180,6 +221,27 @@ void XMLCharContext::EndElement()
}
}
}
+void XMLCharContext::endFastElement(sal_Int32 )
+{
+ if ( !m_nCount )
+ InsertControlCharacter( m_nControl );
+ else
+ {
+ if( 1U == m_nCount )
+ {
+ OUString sBuff( &m_c, 1 );
+ InsertString(sBuff);
+ }
+ else
+ {
+ OUStringBuffer sBuff(static_cast<int>(m_nCount));
+ while( m_nCount-- )
+ sBuff.append( &m_c, 1 );
+
+ InsertString(sBuff.makeStringAndClear() );
+ }
+ }
+}
void XMLCharContext::InsertControlCharacter(sal_Int16 _nControl)
{
GetImport().GetTextImport()->InsertControlCharacter( _nControl );