diff options
author | Daniel Sikeler <d.sikeler94@gmail.com> | 2015-08-14 12:14:25 +0200 |
---|---|---|
committer | Daniel Sikeler <d.sikeler94@gmail.com> | 2015-08-14 12:14:25 +0200 |
commit | 827aeb3ba9a12a9893a2be63a187b33482ba5e0d (patch) | |
tree | 11860954346181a98d1eaba7397664fa3005915b | |
parent | 6f524e38e2a3dbe4eeea60852933857252c22253 (diff) |
fastparser impl. for XMLStartReferenceContext_Impl
Change-Id: Iff5b71238c7cc2e0121aad621c597a9dd7dea41e
-rw-r--r-- | xmloff/source/text/txtparai.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index dd8add297bc1..fd0c1d5998f2 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -227,11 +227,19 @@ public: const OUString& rLocalName, XMLHints_Impl& rHnts, const Reference<xml::sax::XAttributeList> & xAttrList); + XMLStartReferenceContext_Impl ( + SvXMLImport& rImport, + sal_Int32 Element, + XMLHints_Impl& rHnts, + const Reference< xml::sax::XFastAttributeList >& xAttrList ); static bool FindName( SvXMLImport& rImport, const Reference<xml::sax::XAttributeList> & xAttrList, OUString& rName); + static bool FindName( + const Reference< xml::sax::XFastAttributeList >& xAttrList, + OUString& rName ); }; TYPEINIT1( XMLStartReferenceContext_Impl, SvXMLImportContext ); @@ -258,6 +266,27 @@ XMLStartReferenceContext_Impl::XMLStartReferenceContext_Impl( } } +XMLStartReferenceContext_Impl::XMLStartReferenceContext_Impl( + SvXMLImport& rImport, + sal_Int32 /*Element*/, + XMLHints_Impl& rHints, + const Reference< xml::sax::XFastAttributeList >& xAttrList ) +: SvXMLImportContext( rImport ) +{ + OUString sName; + + if( FindName( xAttrList, sName ) ) + { + XMLHint_Impl* pHint = new XMLReferenceHint_Impl( + sName, rImport.GetTextImport()->GetCursor()->getStart() ); + + // degenerates to point reference, if no end is found! + pHint->SetEnd( rImport.GetTextImport()->GetCursor()->getStart() ); + + rHints.push_back(pHint); + } +} + bool XMLStartReferenceContext_Impl::FindName( SvXMLImport& rImport, const Reference<xml::sax::XAttributeList> & xAttrList, @@ -285,6 +314,23 @@ bool XMLStartReferenceContext_Impl::FindName( return bNameOK; } +bool XMLStartReferenceContext_Impl::FindName( + const Reference< xml::sax::XFastAttributeList >& xAttrList, + OUString& rName ) +{ + bool bNameOK( false ); + + // find name attribute first + if( xAttrList.is() && + xAttrList->hasAttribute( NAMESPACE | XML_NAMESPACE_TEXT | XML_name ) ) + { + rName = xAttrList->getValue( NAMESPACE | XML_NAMESPACE_TEXT | XML_name ); + bNameOK = true; + } + + return bNameOK; +} + /** import end of reference (<text:reference-end>) */ class XMLEndReferenceContext_Impl : public SvXMLImportContext { |