Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / oox / source / docprop / docprophandler.hxx
blob29cdd6755e73d54af6c2232f9f9e7f7c6209b199
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/implbase.hxx>
29 #include <oox/token/namespaces.hxx>
30 #include <oox/token/tokens.hxx>
32 namespace oox {
33 namespace docprop {
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::WeakImplHelper< css::xml::sax::XFastDocumentHandler >
44 css::uno::Reference< css::document::XDocumentProperties > m_xDocProp;
46 sal_Int32 m_nState;
47 sal_Int32 m_nBlock;
48 sal_Int32 m_nType;
50 sal_Int32 m_nInBlock;
52 enum { NONE, INSERTED } m_CustomStringPropertyState;
53 OUString m_aCustomPropertyName;
55 public:
56 explicit OOXMLDocPropHandler( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::document::XDocumentProperties >& rDocProp );
58 virtual ~OOXMLDocPropHandler() override;
60 void InitNew();
61 void AddCustomProperty( const css::uno::Any& aAny );
63 static css::util::DateTime GetDateTimeFromW3CDTF( const OUString& aChars );
64 static css::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() override;
70 virtual void SAL_CALL endDocument() override;
71 virtual void SAL_CALL processingInstruction( const OUString& rTarget, const OUString& rData ) override;
72 virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& rxLocator ) override;
74 // com.sun.star.xml.sax.XFastContextHandler
76 virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
77 virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
78 virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) override;
79 virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) override;
80 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
81 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
82 virtual void SAL_CALL characters( const OUString& aChars ) override;
86 } // namespace core
87 } // namespace oox
89 #endif
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */