summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Sikeler <d.sikeler94@gmail.com>2015-08-01 12:33:04 +0200
committerDaniel Sikeler <d.sikeler94@gmail.com>2015-08-01 13:16:47 +0200
commita01cbeef14441c45e3501e56895cc1542219bae1 (patch)
treedd610f7487a054b082125e409a753919c11f9138
parent5319bab802047063b827d12492f95fc04dbf8c30 (diff)
fastparser impl. for XMLImpRubyContext_Impl
and XMLImpRubyBaseContext_Impl and XMLImpRubyTextContext_Impl Change-Id: I2d488cc0e3ecd1607bbfdbc8882d177db04d436a
-rw-r--r--xmloff/source/text/txtparai.cxx120
1 files changed, 120 insertions, 0 deletions
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index c475c4fd2e59..dd8add297bc1 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -645,14 +645,26 @@ public:
const Reference< xml::sax::XAttributeList > & xAttrList,
XMLHints_Impl& rHnts,
bool& rIgnLeadSpace );
+ XMLImpRubyBaseContext_Impl(
+ SvXMLImport& rImport,
+ sal_Int32 Element,
+ const Reference< xml::sax::XFastAttributeList >& xAttrList,
+ XMLHints_Impl& rHnts,
+ bool& rIgnLeadSpace );
virtual ~XMLImpRubyBaseContext_Impl();
virtual SvXMLImportContext *CreateChildContext(
sal_uInt16 nPrefix, const OUString& rLocalName,
const Reference< xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+ virtual Reference< xml::sax::XFastContextHandler >
+ createFastChildContext( sal_Int32 Element,
+ const Reference< xml::sax::XFastAttributeList >& xAttrList )
+ throw(RuntimeException, xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
virtual void Characters( const OUString& rChars ) SAL_OVERRIDE;
+ virtual void characters( const OUString& rChars )
+ throw(RuntimeException, xml::sax::SAXException, std::exception ) SAL_OVERRIDE;
};
TYPEINIT1( XMLImpRubyBaseContext_Impl, SvXMLImportContext );
@@ -670,6 +682,18 @@ XMLImpRubyBaseContext_Impl::XMLImpRubyBaseContext_Impl(
{
}
+XMLImpRubyBaseContext_Impl::XMLImpRubyBaseContext_Impl(
+ SvXMLImport& rImport,
+ sal_Int32 /*Element*/,
+ const Reference< xml::sax::XFastAttributeList >&,
+ XMLHints_Impl& rHnts,
+ bool& rIgnLeadSpace )
+: SvXMLImportContext( rImport ),
+ rHints( rHnts ),
+ rIgnoreLeadingSpace( rIgnLeadSpace )
+{
+}
+
XMLImpRubyBaseContext_Impl::~XMLImpRubyBaseContext_Impl()
{
}
@@ -687,11 +711,31 @@ SvXMLImportContext *XMLImpRubyBaseContext_Impl::CreateChildContext(
nToken, rHints, rIgnoreLeadingSpace );
}
+Reference< xml::sax::XFastContextHandler >
+ XMLImpRubyBaseContext_Impl::createFastChildContext(
+ sal_Int32 Element,
+ const Reference< xml::sax::XFastAttributeList >& xAttrList )
+ throw(RuntimeException, xml::sax::SAXException, std::exception )
+{
+ const SvXMLTokenMap& rTokenMap =
+ GetImport().GetTextImport()->GetTextPElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( Element );
+
+ return XMLImpSpanContext_Impl::createFastChildContext( GetImport(), Element,
+ xAttrList, nToken, rHints, rIgnoreLeadingSpace );
+}
+
void XMLImpRubyBaseContext_Impl::Characters( const OUString& rChars )
{
GetImport().GetTextImport()->InsertString( rChars, rIgnoreLeadingSpace );
}
+void XMLImpRubyBaseContext_Impl::characters( const OUString& rChars )
+ throw(RuntimeException, xml::sax::SAXException, std::exception )
+{
+ GetImport().GetTextImport()->InsertString( rChars, rIgnoreLeadingSpace );
+}
+
class XMLImpRubyContext_Impl : public SvXMLImportContext
{
XMLHints_Impl& rHints;
@@ -714,12 +758,22 @@ public:
const Reference< xml::sax::XAttributeList > & xAttrList,
XMLHints_Impl& rHnts,
bool& rIgnLeadSpace );
+ XMLImpRubyContext_Impl(
+ SvXMLImport& rImport,
+ sal_Int32 Element,
+ const Reference< xml::sax::XFastAttributeList >& xAttrList,
+ XMLHints_Impl& rHnts,
+ bool& rIgnLeadSpace );
virtual ~XMLImpRubyContext_Impl();
virtual SvXMLImportContext *CreateChildContext(
sal_uInt16 nPrefix, const OUString& rLocalName,
const Reference< xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
+ virtual Reference< xml::sax::XFastContextHandler >
+ createFastChildContext( sal_Int32 Element,
+ const Reference< xml::sax::XFastAttributeList >& xAttrList )
+ throw(RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
void SetTextStyleName( const OUString& s ) { m_sTextStyleName = s; }
void AppendText( const OUString& s ) { m_sText += s; }
@@ -739,10 +793,17 @@ public:
const OUString& rLName,
const Reference< xml::sax::XAttributeList > & xAttrList,
XMLImpRubyContext_Impl & rParent );
+ XMLImpRubyTextContext_Impl(
+ SvXMLImport& rImport,
+ sal_Int32 Element,
+ const Reference< xml::sax::XFastAttributeList >& xAttrList,
+ XMLImpRubyContext_Impl& rParent );
virtual ~XMLImpRubyTextContext_Impl();
virtual void Characters( const OUString& rChars ) SAL_OVERRIDE;
+ virtual void characters( const OUString& rChars )
+ throw(RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
};
TYPEINIT1( XMLImpRubyTextContext_Impl, SvXMLImportContext );
@@ -775,6 +836,20 @@ XMLImpRubyTextContext_Impl::XMLImpRubyTextContext_Impl(
}
}
+XMLImpRubyTextContext_Impl::XMLImpRubyTextContext_Impl(
+ SvXMLImport& rImport,
+ sal_Int32 /*Element*/,
+ const Reference< xml::sax::XFastAttributeList >& xAttrList,
+ XMLImpRubyContext_Impl& rParent )
+: SvXMLImportContext( rImport ),
+ m_rRubyContext( rParent )
+{
+ if( xAttrList.is() &&
+ xAttrList->hasAttribute( NAMESPACE | XML_NAMESPACE_TEXT | XML_style_name ) )
+ m_rRubyContext.SetTextStyleName( xAttrList->getValue(
+ NAMESPACE | XML_NAMESPACE_TEXT | XML_style_name ) );
+}
+
XMLImpRubyTextContext_Impl::~XMLImpRubyTextContext_Impl()
{
}
@@ -784,6 +859,12 @@ void XMLImpRubyTextContext_Impl::Characters( const OUString& rChars )
m_rRubyContext.AppendText( rChars );
}
+void XMLImpRubyTextContext_Impl::characters( const OUString& rChars )
+ throw(RuntimeException, xml::sax::SAXException, std::exception )
+{
+ m_rRubyContext.AppendText( rChars );
+}
+
TYPEINIT1( XMLImpRubyContext_Impl, SvXMLImportContext );
XMLImpRubyContext_Impl::XMLImpRubyContext_Impl(
@@ -817,6 +898,24 @@ XMLImpRubyContext_Impl::XMLImpRubyContext_Impl(
}
}
+XMLImpRubyContext_Impl::XMLImpRubyContext_Impl(
+ SvXMLImport& rImport,
+ sal_Int32 /*Element*/,
+ const Reference< xml::sax::XFastAttributeList >& xAttrList,
+ XMLHints_Impl& rHnts,
+ bool& rIgnLeadSpace )
+: SvXMLImportContext( rImport ),
+ rHints( rHnts ),
+ rIgnoreLeadingSpace( rIgnLeadSpace ),
+ m_xStart( GetImport().GetTextImport()->GetCursorAsRange()->getStart() )
+{
+ if( xAttrList.is() &&
+ xAttrList->hasAttribute( NAMESPACE | XML_NAMESPACE_TEXT | XML_style_name ) )
+ {
+ m_sStyleName = xAttrList->getValue( NAMESPACE | XML_NAMESPACE_TEXT | XML_style_name );
+ }
+}
+
XMLImpRubyContext_Impl::~XMLImpRubyContext_Impl()
{
const rtl::Reference < XMLTextImportHelper > xTextImport(
@@ -858,6 +957,27 @@ SvXMLImportContext *XMLImpRubyContext_Impl::CreateChildContext(
return pContext;
}
+Reference< xml::sax::XFastContextHandler >
+ XMLImpRubyContext_Impl::createFastChildContext(
+ sal_Int32 Element,
+ const Reference< xml::sax::XFastAttributeList >& xAttrList )
+ throw (RuntimeException, xml::sax::SAXException, std::exception)
+{
+ Reference< xml::sax::XFastContextHandler > pContext = NULL;
+ if( Element == (NAMESPACE | XML_NAMESPACE_TEXT | XML_ruby_base) )
+ pContext = new XMLImpRubyBaseContext_Impl( GetImport(), Element,
+ xAttrList, rHints, rIgnoreLeadingSpace );
+ else if( Element == (NAMESPACE | XML_NAMESPACE_TEXT | XML_ruby_text) )
+ pContext = new XMLImpRubyTextContext_Impl( GetImport(), Element,
+ xAttrList, *this );
+
+ if( !pContext.is() )
+ pContext = SvXMLImportContext::createFastChildContext(
+ Element, xAttrList );
+
+ return pContext;
+}
+
/** for text:meta and text:meta-field
*/
class XMLMetaImportContextBase : public SvXMLImportContext