diff options
author | Daniel Sikeler <d.sikeler94@gmail.com> | 2015-10-02 13:10:55 +0200 |
---|---|---|
committer | Daniel Sikeler <d.sikeler94@gmail.com> | 2015-10-02 13:10:55 +0200 |
commit | 45cc7a9bb79bac6635e1fe3f4150bca1ffaf9659 (patch) | |
tree | 9c2a62e397aed041588ee4f9a6ae85e3bc1438cc | |
parent | f18cdf04c8c0803cdfba7df380ce96ef21e3f86d (diff) |
fastparser impl. for XMLBibliographyFieldImportContext
// TODO set aValue.Name in startFastElement
Change-Id: Iac6238e13622a436b6ec0e2bff3bcce888d13cff
-rw-r--r-- | xmloff/inc/txtfldi.hxx | 6 | ||||
-rw-r--r-- | xmloff/source/text/txtfldi.cxx | 55 |
2 files changed, 61 insertions, 0 deletions
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx index 51c4f70ae5f5..22695cf9ca53 100644 --- a/xmloff/inc/txtfldi.hxx +++ b/xmloff/inc/txtfldi.hxx @@ -1337,12 +1337,18 @@ public: XMLTextImportHelper& rHlp, sal_uInt16 nPrfx, const OUString& sLocalName); + XMLBibliographyFieldImportContext(SvXMLImport& rImport, + XMLTextImportHelper& rHlp, + sal_Int32 Element); protected: /// process attributes (fill aValues) virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList> & xAttrList) SAL_OVERRIDE; + virtual void startFastElement( sal_Int32 Element, + const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) + throw(css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE; /// empty method; all attributes are handled in StartElement virtual void ProcessAttribute( sal_uInt16 nAttrToken, diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index 6311bd8ab7fd..a5d61a291ab2 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -4111,6 +4111,16 @@ XMLBibliographyFieldImportContext::XMLBibliographyFieldImportContext( bValid = true; } +XMLBibliographyFieldImportContext::XMLBibliographyFieldImportContext( + SvXMLImport& rImport, XMLTextImportHelper& rHlp, + sal_Int32 Element) +: XMLTextFieldImportContext(rImport, rHlp, sAPI_bibliography, Element), + sPropertyFields("Fields"), + aValues() +{ + bValid = true; +} + // TODO: this is the same map as is used in the text field export static SvXMLEnumMapEntry const aBibliographyDataTypeMap[] = { @@ -4189,6 +4199,51 @@ void XMLBibliographyFieldImportContext::StartElement( } } +void XMLBibliographyFieldImportContext::startFastElement( sal_Int32 /*Element*/, + const Reference< XFastAttributeList >& xAttrList ) + throw( RuntimeException, SAXException, std::exception ) +{ + // iterate over attributes + Sequence< xml::FastAttribute > attributesSeq = xAttrList->getFastAttributes(); + sal_Int16 nLength = attributesSeq.getLength(); + xml::FastAttribute* attributes = attributesSeq.getArray(); + for( sal_Int16 i=0; i < nLength; i++ ) + { + xml::FastAttribute attr = attributes[i]; + + if( (attr.Token & (NAMESPACE | XML_NAMESPACE_TEXT)) == (NAMESPACE | XML_NAMESPACE_TEXT) ) + { + PropertyValue aValue; + // TODO set aValue.Name + Any aAny; + + // special treatment for bibliography type + // biblio vx bibilio: #96658#; also read old documents + if( attr.Token == (NAMESPACE | XML_NAMESPACE_TEXT | XML_bibiliographic_type) || + attr.Token == (NAMESPACE | XML_NAMESPACE_TEXT | XML_bibliography_type) ) + { + sal_uInt16 nTmp; + if( SvXMLUnitConverter::convertEnum( + nTmp, attr.Value, aBibliographyDataTypeMap) ) + { + aAny <<= (sal_Int16)nTmp; + aValue.Value = aAny; + + aValues.push_back(aValue); + } + } + else + { + aAny <<= attr.Value; + aValue.Value = aAny; + + aValues.push_back(aValue); + } + } + // else: unknown namespace -> ignore + } +} + void XMLBibliographyFieldImportContext::ProcessAttribute( sal_uInt16, const OUString& ) |