1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_OOX_SOURCE_DOCPROP_DOCPROPHANDLER_HXX
21 #define INCLUDED_OOX_SOURCE_DOCPROP_DOCPROPHANDLER_HXX
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <com/sun/star/document/XDocumentProperties.hpp>
25 #include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
27 #include <cppuhelper/implbase1.hxx>
29 #include "oox/token/namespaces.hxx"
30 #include "oox/token/tokens.hxx"
35 #define COREPR_TOKEN( token ) (::oox::NMSP_packageMetaCorePr | XML_##token)
36 #define CUSTPR_TOKEN( token ) (::oox::NMSP_officeCustomPr | XML_##token)
37 #define EXTPR_TOKEN( token ) (::oox::NMSP_officeExtPr | XML_##token)
38 #define VT_TOKEN( token ) (::oox::NMSP_officeDocPropsVT | XML_##token)
39 #define DC_TOKEN( token ) (::oox::NMSP_dc | XML_##token)
40 #define DCT_TOKEN( token ) (::oox::NMSP_dcTerms | XML_##token)
42 class OOXMLDocPropHandler
: public ::cppu::WeakImplHelper1
< ::com::sun::star::xml::sax::XFastDocumentHandler
>
44 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
45 ::com::sun::star::uno::Reference
< ::com::sun::star::document::XDocumentProperties
> m_xDocProp
;
53 OUString m_aCustomPropertyName
;
56 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
>& rDocProp
);
58 virtual ~OOXMLDocPropHandler();
61 void AddCustomProperty( const ::com::sun::star::uno::Any
& aAny
);
63 static ::com::sun::star::util::DateTime
GetDateTimeFromW3CDTF( const OUString
& aChars
);
64 static ::com::sun::star::uno::Sequence
< OUString
> GetKeywordsSet( const OUString
& aChars
);
65 void UpdateDocStatistic( const OUString
& aChars
);
67 // com.sun.star.xml.sax.XFastDocumentHandler
69 virtual void SAL_CALL
startDocument() throw (::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
70 virtual void SAL_CALL
endDocument() throw (::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
71 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
, std::exception
) SAL_OVERRIDE
;
73 // com.sun.star.xml.sax.XFastContextHandler
75 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
, std::exception
) SAL_OVERRIDE
;
76 virtual void SAL_CALL
startUnknownElement( const OUString
& Namespace
, const 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
, std::exception
) SAL_OVERRIDE
;
77 virtual void SAL_CALL
endFastElement( ::sal_Int32 Element
) throw (::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
78 virtual void SAL_CALL
endUnknownElement( const OUString
& Namespace
, const OUString
& Name
) throw (::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 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
, std::exception
) SAL_OVERRIDE
;
80 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XFastContextHandler
> SAL_CALL
createUnknownChildContext( const OUString
& Namespace
, const 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
, std::exception
) SAL_OVERRIDE
;
81 virtual void SAL_CALL
characters( const OUString
& aChars
) throw (::com::sun::star::xml::sax::SAXException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */