1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef OOX_DOCPROP_DOCPROPHANDLER_HXX 25*b1cdbd2cSJim Jagielski #define OOX_DOCPROP_DOCPROPHANDLER_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #include <com/sun/star/uno/XComponentContext.hpp> 28*b1cdbd2cSJim Jagielski #include <com/sun/star/document/XDocumentProperties.hpp> 29*b1cdbd2cSJim Jagielski #include <com/sun/star/xml/sax/XFastDocumentHandler.hpp> 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski #include <cppuhelper/implbase1.hxx> 32*b1cdbd2cSJim Jagielski 33*b1cdbd2cSJim Jagielski #include "oox/token/namespaces.hxx" 34*b1cdbd2cSJim Jagielski #include "oox/token/tokens.hxx" 35*b1cdbd2cSJim Jagielski 36*b1cdbd2cSJim Jagielski namespace oox { 37*b1cdbd2cSJim Jagielski namespace docprop { 38*b1cdbd2cSJim Jagielski 39*b1cdbd2cSJim Jagielski #define COREPR_TOKEN( token ) (::oox::NMSP_packageMetaCorePr | XML_##token) 40*b1cdbd2cSJim Jagielski #define CUSTPR_TOKEN( token ) (::oox::NMSP_officeCustomPr | XML_##token) 41*b1cdbd2cSJim Jagielski #define EXTPR_TOKEN( token ) (::oox::NMSP_officeExtPr | XML_##token) 42*b1cdbd2cSJim Jagielski #define VT_TOKEN( token ) (::oox::NMSP_officeDocPropsVT | XML_##token) 43*b1cdbd2cSJim Jagielski #define DC_TOKEN( token ) (::oox::NMSP_dc | XML_##token) 44*b1cdbd2cSJim Jagielski #define DCT_TOKEN( token ) (::oox::NMSP_dcTerms | XML_##token) 45*b1cdbd2cSJim Jagielski 46*b1cdbd2cSJim Jagielski class OOXMLDocPropHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastDocumentHandler > 47*b1cdbd2cSJim Jagielski { 48*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 49*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > m_xDocProp; 50*b1cdbd2cSJim Jagielski 51*b1cdbd2cSJim Jagielski sal_Int32 m_nState; 52*b1cdbd2cSJim Jagielski sal_Int32 m_nBlock; 53*b1cdbd2cSJim Jagielski sal_Int32 m_nType; 54*b1cdbd2cSJim Jagielski 55*b1cdbd2cSJim Jagielski sal_Int32 m_nInBlock; 56*b1cdbd2cSJim Jagielski 57*b1cdbd2cSJim Jagielski ::rtl::OUString m_aCustomPropertyName; 58*b1cdbd2cSJim Jagielski 59*b1cdbd2cSJim Jagielski public: 60*b1cdbd2cSJim Jagielski explicit OOXMLDocPropHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > xDocProp ); 61*b1cdbd2cSJim Jagielski 62*b1cdbd2cSJim Jagielski virtual ~OOXMLDocPropHandler(); 63*b1cdbd2cSJim Jagielski 64*b1cdbd2cSJim Jagielski void InitNew(); 65*b1cdbd2cSJim Jagielski void AddCustomProperty( const ::com::sun::star::uno::Any& aAny ); 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielski ::com::sun::star::util::DateTime GetDateTimeFromW3CDTF( const ::rtl::OUString& aChars ); 68*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Sequence< ::rtl::OUString > GetKeywordsSet( const ::rtl::OUString& aChars ); 69*b1cdbd2cSJim Jagielski ::com::sun::star::lang::Locale GetLanguage( const ::rtl::OUString& aChars ); 70*b1cdbd2cSJim Jagielski void UpdateDocStatistic( const ::rtl::OUString& aChars ); 71*b1cdbd2cSJim Jagielski 72*b1cdbd2cSJim Jagielski // com.sun.star.xml.sax.XFastDocumentHandler 73*b1cdbd2cSJim Jagielski 74*b1cdbd2cSJim Jagielski virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 75*b1cdbd2cSJim Jagielski virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 76*b1cdbd2cSJim Jagielski virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& rxLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 77*b1cdbd2cSJim Jagielski 78*b1cdbd2cSJim Jagielski // com.sun.star.xml.sax.XFastContextHandler 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 81*b1cdbd2cSJim Jagielski virtual void SAL_CALL startUnknownElement( const ::rtl::OUString& Namespace, const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 82*b1cdbd2cSJim Jagielski virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 83*b1cdbd2cSJim Jagielski virtual void SAL_CALL endUnknownElement( const ::rtl::OUString& Namespace, const ::rtl::OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 84*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 85*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const ::rtl::OUString& Namespace, const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 86*b1cdbd2cSJim Jagielski virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 87*b1cdbd2cSJim Jagielski virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 88*b1cdbd2cSJim Jagielski virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); 89*b1cdbd2cSJim Jagielski 90*b1cdbd2cSJim Jagielski }; 91*b1cdbd2cSJim Jagielski 92*b1cdbd2cSJim Jagielski // ============================================================================ 93*b1cdbd2cSJim Jagielski 94*b1cdbd2cSJim Jagielski } // namespace core 95*b1cdbd2cSJim Jagielski } // namespace oox 96*b1cdbd2cSJim Jagielski 97*b1cdbd2cSJim Jagielski #endif 98*b1cdbd2cSJim Jagielski 99