LibreOffice Module oox (master) 1
docprophandler.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_OOX_SOURCE_DOCPROP_DOCPROPHANDLER_HXX
21#define INCLUDED_OOX_SOURCE_DOCPROP_DOCPROPHANDLER_HXX
22
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>
26
28
29#include <oox/token/namespaces.hxx>
30
31namespace oox::docprop {
32
33#define COREPR_TOKEN( token ) (::oox::NMSP_packageMetaCorePr | XML_##token)
34#define CUSTPR_TOKEN( token ) (::oox::NMSP_officeCustomPr | XML_##token)
35#define EXTPR_TOKEN( token ) (::oox::NMSP_officeExtPr | XML_##token)
36#define VT_TOKEN( token ) (::oox::NMSP_officeDocPropsVT | XML_##token)
37#define DC_TOKEN( token ) (::oox::NMSP_dc | XML_##token)
38#define DCT_TOKEN( token ) (::oox::NMSP_dcTerms | XML_##token)
39
40class OOXMLDocPropHandler : public ::cppu::WeakImplHelper< css::xml::sax::XFastDocumentHandler >
41{
42 css::uno::Reference< css::document::XDocumentProperties > m_xDocProp;
43
44 sal_Int32 m_nState;
45 sal_Int32 m_nBlock;
46 sal_Int32 m_nType;
47
48 sal_Int32 m_nInBlock;
49
52
53public:
54 explicit OOXMLDocPropHandler( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::document::XDocumentProperties >& rDocProp );
55
56 virtual ~OOXMLDocPropHandler() override;
57
58 void InitNew();
59 void AddCustomProperty( const css::uno::Any& aAny );
60
61 static css::util::DateTime GetDateTimeFromW3CDTF( const OUString& aChars );
62 static css::uno::Sequence< OUString > GetKeywordsSet( std::u16string_view aChars );
63 void UpdateDocStatistic( std::u16string_view aChars );
64
65 // com.sun.star.xml.sax.XFastDocumentHandler
66
67 virtual void SAL_CALL startDocument() override;
68 virtual void SAL_CALL endDocument() override;
69 virtual void SAL_CALL processingInstruction( const OUString& rTarget, const OUString& rData ) override;
70 virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& rxLocator ) override;
71
72 // com.sun.star.xml.sax.XFastContextHandler
73
74 virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
75 virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
76 virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) override;
77 virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) override;
78 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override;
79 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;
80 virtual void SAL_CALL characters( const OUString& aChars ) override;
81
82};
83
84} // namespace oox::core
85
86#endif
87
88/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &rxLocator) override
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
virtual void SAL_CALL startDocument() override
virtual void SAL_CALL endUnknownElement(const OUString &Namespace, const OUString &Name) override
static css::uno::Sequence< OUString > GetKeywordsSet(std::u16string_view aChars)
OOXMLDocPropHandler(const css::uno::Reference< css::uno::XComponentContext > &xContext, const css::uno::Reference< css::document::XDocumentProperties > &rDocProp)
virtual void SAL_CALL endFastElement(::sal_Int32 Element) override
enum oox::docprop::OOXMLDocPropHandler::@0 m_CustomStringPropertyState
virtual void SAL_CALL processingInstruction(const OUString &rTarget, const OUString &rData) override
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
virtual void SAL_CALL startFastElement(::sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
virtual void SAL_CALL endDocument() override
css::uno::Reference< css::document::XDocumentProperties > m_xDocProp
static css::util::DateTime GetDateTimeFromW3CDTF(const OUString &aChars)
void UpdateDocStatistic(std::u16string_view aChars)
virtual void SAL_CALL characters(const OUString &aChars) override
virtual void SAL_CALL startUnknownElement(const OUString &Namespace, const OUString &Name, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
void AddCustomProperty(const css::uno::Any &aAny)
virtual ~OOXMLDocPropHandler() override