LibreOffice Module xmloff (master) 1
sdxmlimp_impl.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#pragma once
21
22#include <com/sun/star/drawing/XDrawPage.hpp>
23#include <com/sun/star/task/XStatusIndicator.hpp>
24#include <xmloff/xmltkmap.hxx>
25#include <com/sun/star/container/XNameAccess.hpp>
26
27#include <map>
28#include <memory>
29#include <vector>
30#include <xmloff/xmlimp.hxx>
31
33class SvXMLTokenMap;
35
37{
38 OUString maStrText;
39 bool mbFixed;
41
43};
44
45typedef std::map<OUString, OUString> HeaderFooterDeclMap;
46typedef std::map<OUString, DateTimeDeclContextImpl> DateTimeDeclMap;
47
48class SdXMLImport: public SvXMLImport
49{
50 css::uno::Reference< css::container::XNameAccess > mxDocStyleFamilies;
51 css::uno::Reference< css::container::XIndexAccess > mxDocMasterPages;
52 css::uno::Reference< css::container::XIndexAccess > mxDocDrawPages;
53 css::uno::Reference< css::container::XNameAccess > mxPageLayouts;
54
55 // contexts for Style and AutoStyle import
57
58 sal_Int32 mnNewPageCount;
60
64
65 static constexpr OUStringLiteral gsPageLayouts = u"PageLayouts";
66 static constexpr OUStringLiteral gsPreview = u"Preview";
67
71
72protected:
73
74 // This method is called after the namespace map has been updated, but
75 // before a context for the current element has been pushed.
76 virtual SvXMLImportContext *CreateFastContext( sal_Int32 nElement,
77 const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList ) override;
78
79public:
81 const css::uno::Reference< css::uno::XComponentContext >& xContext,
82 OUString const & implementationName,
83 bool bIsDraw, SvXMLImportFlags nImportFlags );
84
85 // XImporter
86 virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override;
87
88 // XInitialization
89 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
90
91 virtual void SetViewSettings(const css::uno::Sequence<css::beans::PropertyValue>& aViewProps) override;
92 virtual void SetConfigurationSettings(const css::uno::Sequence<css::beans::PropertyValue>& aConfigProps) override;
93
94 // namespace office
95 // NB: in contrast to other CreateFooContexts, this particular one handles
96 // the root element (i.e. office:document-meta)
97 SvXMLImportContext* CreateMetaContext(const sal_Int32 nElement,
98 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList);
103
104 // export local parameters concerning page access and similar
105 const css::uno::Reference< css::container::XNameAccess >& GetLocalDocStyleFamilies() const { return mxDocStyleFamilies; }
106 const css::uno::Reference< css::container::XIndexAccess >& GetLocalMasterPages() const { return mxDocMasterPages; }
107 const css::uno::Reference< css::container::XIndexAccess >& GetLocalDrawPages() const { return mxDocDrawPages; }
108
109 sal_Int32 GetNewPageCount() const { return mnNewPageCount; }
111 sal_Int32 GetNewMasterPageCount() const { return mnNewMasterPageCount; }
113
114 const css::uno::Reference< css::container::XNameAccess >& getPageLayouts() const { return mxPageLayouts; }
115
116 bool IsDraw() const { return mbIsDraw; }
117 bool IsImpress() const { return !mbIsDraw; }
118
119 virtual void SetStatistics(
120 const css::uno::Sequence< css::beans::NamedValue> & i_rStats) override;
121
122 bool IsPreview() const { return mbPreview; }
123
124 void AddHeaderDecl( const OUString& rName, const OUString& rText );
125 void AddFooterDecl( const OUString& rName, const OUString& rText );
126 void AddDateTimeDecl( const OUString& rName, const OUString& rText, bool bFixed, const OUString& rDateTimeFormat );
127
128 OUString GetHeaderDecl( const OUString& rName ) const;
129 OUString GetFooterDecl( const OUString& rName ) const;
130 OUString GetDateTimeDecl( const OUString& rName, bool& rbFixed, OUString& rDateTimeFormat );
131
132 virtual void NotifyContainsEmbeddedFont() override;
133};
134
135/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void AddFooterDecl(const OUString &rName, const OUString &rText)
Definition: sdxmlimp.cxx:616
SvXMLStylesContext * CreateStylesContext()
Definition: sdxmlimp.cxx:458
const css::uno::Reference< css::container::XIndexAccess > & GetLocalDrawPages() const
void IncrementNewPageCount()
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
Definition: sdxmlimp.cxx:321
void IncrementNewMasterPageCount()
bool IsDraw() const
rtl::Reference< SdXMLMasterStylesContext > mxMasterStylesContext
virtual SvXMLImportContext * CreateFastContext(sal_Int32 nElement, const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList > &xAttrList) override
Definition: sdxmlimp.cxx:409
SvXMLImportContext * CreateFontDeclsContext()
Definition: sdxmlimp.cxx:487
static constexpr OUStringLiteral gsPreview
SvXMLImportContext * CreateMetaContext(const sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
Definition: sdxmlimp.cxx:441
bool IsPreview() const
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
Definition: sdxmlimp.cxx:374
const css::uno::Reference< css::container::XIndexAccess > & GetLocalMasterPages() const
css::uno::Reference< css::container::XNameAccess > mxPageLayouts
OUString GetDateTimeDecl(const OUString &rName, bool &rbFixed, OUString &rDateTimeFormat)
Definition: sdxmlimp.cxx:654
HeaderFooterDeclMap maFooterDeclsMap
virtual void SetViewSettings(const css::uno::Sequence< css::beans::PropertyValue > &aViewProps) override
Definition: sdxmlimp.cxx:495
virtual void SetConfigurationSettings(const css::uno::Sequence< css::beans::PropertyValue > &aConfigProps) override
Definition: sdxmlimp.cxx:538
virtual void SetStatistics(const css::uno::Sequence< css::beans::NamedValue > &i_rStats) override
Definition: sdxmlimp.cxx:581
sal_Int32 mnNewMasterPageCount
sal_Int32 mnNewPageCount
bool IsImpress() const
SvXMLImportContext * CreateMasterStylesContext()
Definition: sdxmlimp.cxx:480
css::uno::Reference< css::container::XIndexAccess > mxDocMasterPages
sal_Int32 GetNewPageCount() const
HeaderFooterDeclMap maHeaderDeclsMap
css::uno::Reference< css::container::XIndexAccess > mxDocDrawPages
const css::uno::Reference< css::container::XNameAccess > & getPageLayouts() const
static constexpr OUStringLiteral gsPageLayouts
DateTimeDeclMap maDateTimeDeclsMap
SdXMLImport(const css::uno::Reference< css::uno::XComponentContext > &xContext, OUString const &implementationName, bool bIsDraw, SvXMLImportFlags nImportFlags)
Definition: sdxmlimp.cxx:297
void AddHeaderDecl(const OUString &rName, const OUString &rText)
Definition: sdxmlimp.cxx:610
virtual void NotifyContainsEmbeddedFont() override
Definition: sdxmlimp.cxx:667
void AddDateTimeDecl(const OUString &rName, const OUString &rText, bool bFixed, const OUString &rDateTimeFormat)
Definition: sdxmlimp.cxx:622
SvXMLStylesContext * CreateAutoStylesContext()
Definition: sdxmlimp.cxx:469
OUString GetHeaderDecl(const OUString &rName) const
Definition: sdxmlimp.cxx:634
OUString GetFooterDecl(const OUString &rName) const
Definition: sdxmlimp.cxx:644
sal_Int32 GetNewMasterPageCount() const
const css::uno::Reference< css::container::XNameAccess > & GetLocalDocStyleFamilies() const
css::uno::Reference< css::container::XNameAccess > mxDocStyleFamilies
This class deliberately does not support XWeak, to improve performance when loading large documents.
Definition: xmlictxt.hxx:48
the SvXMLTypeConverter converts values of various types from their internal representation to the tex...
Definition: xmluconv.hxx:83
float u
std::map< OUString, OUString > HeaderFooterDeclMap
std::map< OUString, DateTimeDeclContextImpl > DateTimeDeclMap
SvXMLImportFlags
Definition: xmlimp.hxx:111