LibreOffice Module writerfilter (master) 1
DomainMapper.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#pragma once
20
22#include "LoggedResources.hxx"
23#include "PropertyMap.hxx"
24#include "SettingsTable.hxx"
25#include <com/sun/star/lang/XComponent.hpp>
26#include <com/sun/star/style/TabAlign.hpp>
27
28#include <map>
29#include <vector>
30#include <memory>
31
32namespace com::sun::star{
33 namespace beans{
34 struct PropertyValue;
35 }
36 namespace io{
37 class XInputStream;
38 }
39 namespace uno{
40 class XComponentContext;
41 }
42 namespace lang{
43 class XMultiServiceFactory;
44 }
45 namespace text{
46 class XTextRange;
47 }
48}
49
50namespace utl
51{
52class MediaDescriptor;
53}
54
55typedef std::vector<css::beans::PropertyValue> PropertyValueVector_t;
56
58{
59
60class PropertyMap;
61class DomainMapper_Impl;
62class ListsManager;
63class StyleSheetTable;
64class GraphicZOrderHelper;
65
67
69 public BinaryObj, public LoggedStream
70{
71 std::unique_ptr<DomainMapper_Impl> m_pImpl;
72
73public:
74 DomainMapper(const css::uno::Reference<css::uno::XComponentContext>& xContext,
75 css::uno::Reference<css::io::XInputStream> const& xInputStream,
76 css::uno::Reference<css::lang::XComponent> const& xModel,
77 bool bRepairStorage,
78 SourceDocumentType eDocumentType,
79 utl::MediaDescriptor const & rMediaDesc);
80 virtual ~DomainMapper() override;
81
82 virtual void setDocumentReference(writerfilter::ooxml::OOXMLDocument* pDocument) override;
83
84 // Stream
85 virtual void markLastParagraphInSection() override;
86 virtual void markLastSectionGroup() override;
87
88 // BinaryObj
89 virtual void data(const sal_uInt8* buf, size_t len) override;
90
91 void sprmWithProps( Sprm& sprm, const PropertyMapPtr& pContext );
92
93 void PushStyleSheetProperties( const PropertyMapPtr& pStyleProperties, bool bAffectTableMngr = false );
94 void PopStyleSheetProperties( bool bAffectTableMngr = false );
95
96 void PushListProperties( const ::tools::SvRef<PropertyMap>& pListProperties );
97 void PopListProperties();
98 OUString GetListStyleName(sal_Int32 nListId) const;
99 void ValidateListLevel(const OUString& sStyleIdentifierD);
100
101 bool IsOOXMLImport() const;
102 bool IsRTFImport() const;
103 css::uno::Reference<css::lang::XMultiServiceFactory> const & GetTextFactory() const;
104 css::uno::Reference<css::text::XTextRange> GetCurrentTextRange();
105
106 OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
110
112 css::uno::Reference<css::drawing::XShape> PopPendingShape();
113
114 bool IsInHeaderFooter() const;
115 bool IsInTable() const;
116 void SetDocDefaultsImport(bool bSet);
117 bool IsStyleSheetImport() const;
118 bool IsNumberingImport() const;
119 bool IsInShape() const;
120
121 void hasControls( const bool bSet ) { mbHasControls = bSet; }
122
127 const std::map<sal_Int32, css::uno::Any>& rDeferredCharacterProperties,
128 bool bCharContext = true);
129
131
133 void enableInteropGrabBag(const OUString& aName);
135 css::beans::PropertyValue getInteropGrabBag();
136
137 void HandleRedline( Sprm& rSprm );
138
139 virtual void commentProps(const OUString& sId, const CommentProperties& rProps) override;
140
141 css::uno::Reference<css::container::XNameContainer> const & GetCharacterStyles();
143
144private:
145 // Stream
146 virtual void lcl_startSectionGroup() override;
147 virtual void lcl_endSectionGroup() override;
148 virtual void lcl_startParagraphGroup() override;
149 virtual void lcl_endParagraphGroup() override;
150 virtual void lcl_startCharacterGroup() override;
151 virtual void lcl_endCharacterGroup() override;
152 virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> const& xShape) override;
153 virtual void lcl_endShape( ) override;
154 virtual void lcl_startTextBoxContent() override;
155 virtual void lcl_endTextBoxContent() override;
156 virtual void lcl_text(const sal_uInt8 * data, size_t len) override;
157 virtual void lcl_utext(const sal_uInt8 * data, size_t len) override;
158 virtual void lcl_positionOffset(const OUString& rText, bool bVertical) override;
159 virtual css::awt::Point getPositionOffset() override;
160 virtual void lcl_align(const OUString& rText, bool bVertical) override;
161 virtual void lcl_positivePercentage(const OUString& rText) override;
163 virtual void lcl_table(Id name,
165 virtual void lcl_substream(Id name,
167 virtual void lcl_startGlossaryEntry() override;
168 virtual void lcl_endGlossaryEntry() override;
169 virtual void lcl_checkId(const sal_Int32 nId) override;
170
171 // Properties
172 virtual void lcl_attribute(Id Name, Value & val) override;
173 virtual void lcl_sprm(Sprm & sprm) override;
174
175 // Table
177
178 void finishParagraph(const bool bRemove = false, const bool bNoNumbering = false);
179
180 static void handleUnderlineType(const Id nId, const ::tools::SvRef<PropertyMap>& rContext);
181 void handleParaJustification(const sal_Int32 nIntValue, const ::tools::SvRef<PropertyMap>& rContext, const bool bExchangeLeftRight);
182 static bool getColorFromId(const Id, sal_Int32 &nColor);
183 static sal_Int16 getEmphasisValue(const sal_Int32 nIntValue);
184 static OUString getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix = true);
185 static css::style::TabAlign getTabAlignFromValue(const sal_Int32 nIntValue);
186 static sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue);
190 std::unique_ptr< GraphicZOrderHelper > m_zOrderHelper;
192};
193
194} // namespace writerfilter::dmapper
195
196/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< css::beans::PropertyValue > PropertyValueVector_t
Handler for binary objects.
void sprm(Sprm &sprm) override
Receives a SPRM.
An SPRM: Section, Paragraph and Run Modifier.
virtual void lcl_endTextBoxContent() override
virtual void lcl_endSectionGroup() override
virtual void lcl_props(writerfilter::Reference< Properties >::Pointer_t ref) override
virtual void lcl_startShape(css::uno::Reference< css::drawing::XShape > const &xShape) override
virtual void lcl_endCharacterGroup() override
virtual void lcl_attribute(Id Name, Value &val) override
virtual void lcl_endGlossaryEntry() override
static OUString getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix=true)
GraphicZOrderHelper * graphicZOrderHelper()
virtual void markLastSectionGroup() override
The current section is the last one in this body text.
virtual void lcl_positivePercentage(const OUString &rText) override
css::uno::Reference< css::container::XNameContainer > const & GetCharacterStyles()
void enableInteropGrabBag(const OUString &aName)
Enable storing of seen tokens in a named grab bag.
virtual void lcl_substream(Id name, ::writerfilter::Reference< Stream >::Pointer_t ref) override
virtual void lcl_endShape() override
virtual css::awt::Point getPositionOffset() override
Returns the last set offsets of a shape in HMM.
virtual void markLastParagraphInSection() override
css::uno::Reference< css::text::XTextRange > GetCurrentTextRange()
virtual void lcl_text(const sal_uInt8 *data, size_t len) override
css::uno::Reference< css::drawing::XShape > PopPendingShape()
Return the first from the pending (not inserted to the document) shapes, if there are any.
void PopStyleSheetProperties(bool bAffectTableMngr=false)
virtual void lcl_entry(writerfilter::Reference< Properties >::Pointer_t ref) override
OUString GetListStyleName(sal_Int32 nListId) const
static sal_Int16 getEmphasisValue(const sal_Int32 nIntValue)
virtual void lcl_startCharacterGroup() override
StyleSheetTablePtr const & GetStyleSheetTable()
void ValidateListLevel(const OUString &sStyleIdentifierD)
OUString getOrCreateCharStyle(PropertyValueVector_t &rCharProperties, bool bAlwaysCreate)
virtual void lcl_startGlossaryEntry() override
virtual void lcl_utext(const sal_uInt8 *data, size_t len) override
virtual void lcl_align(const OUString &rText, bool bVertical) override
void sprmWithProps(Sprm &sprm, const PropertyMapPtr &pContext)
std::unique_ptr< DomainMapper_Impl > m_pImpl
virtual void lcl_sprm(Sprm &sprm) override
css::uno::Reference< css::lang::XMultiServiceFactory > const & GetTextFactory() const
void PushStyleSheetProperties(const PropertyMapPtr &pStyleProperties, bool bAffectTableMngr=false)
static css::style::TabAlign getTabAlignFromValue(const sal_Int32 nIntValue)
void PushListProperties(const ::tools::SvRef< PropertyMap > &pListProperties)
static bool getColorFromId(const Id, sal_Int32 &nColor)
static sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue)
std::unique_ptr< GraphicZOrderHelper > m_zOrderHelper
virtual void lcl_checkId(const sal_Int32 nId) override
DomainMapper(const css::uno::Reference< css::uno::XComponentContext > &xContext, css::uno::Reference< css::io::XInputStream > const &xInputStream, css::uno::Reference< css::lang::XComponent > const &xModel, bool bRepairStorage, SourceDocumentType eDocumentType, utl::MediaDescriptor const &rMediaDesc)
virtual void setDocumentReference(writerfilter::ooxml::OOXMLDocument *pDocument) override
virtual void lcl_startTextBoxContent() override
virtual void lcl_positionOffset(const OUString &rText, bool bVertical) override
static void handleUnderlineType(const Id nId, const ::tools::SvRef< PropertyMap > &rContext)
void processDeferredCharacterProperties(const std::map< sal_Int32, css::uno::Any > &rDeferredCharacterProperties, bool bCharContext=true)
css::beans::PropertyValue getInteropGrabBag()
Get the stored tokens and clear the internal storage.
virtual void lcl_startSectionGroup() override
SettingsTablePtr const & GetSettingsTable()
virtual void lcl_endParagraphGroup() override
virtual void data(const sal_uInt8 *buf, size_t len) override
Receives binary data of the object.
virtual void lcl_startParagraphGroup() override
void handleParaJustification(const sal_Int32 nIntValue, const ::tools::SvRef< PropertyMap > &rContext, const bool bExchangeLeftRight)
virtual void lcl_table(Id name, writerfilter::Reference< Table >::Pointer_t ref) override
virtual void commentProps(const OUString &sId, const CommentProperties &rProps) override
void finishParagraph(const bool bRemove=false, const bool bNoNumbering=false)
def text(shape, orig_st)
std::map< sal_Int32, STLPropertyMapEntry > PropertyMap
tools::SvRef< StyleSheetTable > StyleSheetTablePtr
sal_uInt32 Id
A container for the extended comment properties linked to the last paragraph of a comment.
unsigned char sal_uInt8
sal_uInt16 sal_Unicode