lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / writerfilter / source / dmapper / DomainMapper.hxx
blobe7a52764bf94d75650e4ccf402971d0054e6f677
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 .
19 #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPER_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_DOMAINMAPPER_HXX
22 #include <dmapper/DomainMapperFactory.hxx>
23 #include "LoggedResources.hxx"
24 #include <com/sun/star/lang/XComponent.hpp>
25 #include <com/sun/star/style/TabAlign.hpp>
27 #include <map>
28 #include <vector>
29 #include <memory>
31 namespace com{ namespace sun {namespace star{
32 namespace beans{
33 struct PropertyValue;
35 namespace io{
36 class XInputStream;
38 namespace uno{
39 class XComponentContext;
41 namespace lang{
42 class XMultiServiceFactory;
44 namespace text{
45 class XTextRange;
47 }}}
49 namespace utl
51 class MediaDescriptor;
54 typedef std::vector<css::beans::PropertyValue> PropertyValueVector_t;
56 namespace writerfilter {
57 namespace dmapper
60 class PropertyMap;
61 class DomainMapper_Impl;
62 class ListsManager;
63 class StyleSheetTable;
64 class GraphicZOrderHelper;
65 class GraphicNamingHelper;
67 class DomainMapper : public LoggedProperties, public LoggedTable,
68 public BinaryObj, public LoggedStream
70 std::unique_ptr<DomainMapper_Impl> m_pImpl;
72 public:
73 DomainMapper(const css::uno::Reference<css::uno::XComponentContext>& xContext,
74 css::uno::Reference<css::io::XInputStream> const& xInputStream,
75 css::uno::Reference<css::lang::XComponent> const& xModel,
76 bool bRepairStorage,
77 SourceDocumentType eDocumentType,
78 utl::MediaDescriptor const & rMediaDesc);
79 virtual ~DomainMapper() override;
81 // Stream
82 virtual void markLastParagraphInSection() override;
83 virtual void markLastSectionGroup() override;
85 // BinaryObj
86 virtual void data(const sal_uInt8* buf, size_t len,
87 writerfilter::Reference<Properties>::Pointer_t ref) override;
89 void sprmWithProps( Sprm& sprm, const ::tools::SvRef<PropertyMap>& pContext );
91 void PushStyleSheetProperties( const ::tools::SvRef<PropertyMap>& pStyleProperties, bool bAffectTableMngr = false );
92 void PopStyleSheetProperties( bool bAffectTableMngr = false );
94 void PushListProperties( const ::tools::SvRef<PropertyMap>& pListProperties );
95 void PopListProperties();
97 bool IsOOXMLImport() const;
98 bool IsRTFImport() const;
99 css::uno::Reference<css::lang::XMultiServiceFactory> const & GetTextFactory() const;
100 css::uno::Reference<css::text::XTextRange> GetCurrentTextRange();
102 OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate );
103 tools::SvRef< StyleSheetTable > const & GetStyleSheetTable( );
104 GraphicZOrderHelper* graphicZOrderHelper();
105 GraphicNamingHelper& GetGraphicNamingHelper();
107 /// Return the first from the pending (not inserted to the document) shapes, if there are any.
108 css::uno::Reference<css::drawing::XShape> PopPendingShape();
110 bool IsInHeaderFooter() const;
111 bool IsInTable() const;
112 bool IsStyleSheetImport() const;
114 void hasControls( const bool bSet ) { mbHasControls = bSet; }
117 @see DomainMapper_Impl::processDeferredCharacterProperties()
119 void processDeferredCharacterProperties(const std::map<sal_Int32, css::uno::Any>& rDeferredCharacterProperties);
120 void setInTableStyleRunProps(bool bInTableStyleRunProps);
122 /// Enable storing of seen tokens in a named grab bag.
123 void enableInteropGrabBag(const OUString& aName);
124 /// Get the stored tokens and clear the internal storage.
125 css::beans::PropertyValue getInteropGrabBag();
127 void HandleRedline( Sprm& rSprm );
129 private:
130 // Stream
131 virtual void lcl_startSectionGroup() override;
132 virtual void lcl_endSectionGroup() override;
133 virtual void lcl_startParagraphGroup() override;
134 virtual void lcl_endParagraphGroup() override;
135 virtual void lcl_startCharacterGroup() override;
136 virtual void lcl_endCharacterGroup() override;
137 virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> const& xShape) override;
138 virtual void lcl_endShape( ) override;
140 virtual void lcl_text(const sal_uInt8 * data, size_t len) override;
141 virtual void lcl_utext(const sal_uInt8 * data, size_t len) override;
142 virtual void lcl_positionOffset(const OUString& rText, bool bVertical) override;
143 virtual css::awt::Point getPositionOffset() override;
144 virtual void lcl_align(const OUString& rText, bool bVertical) override;
145 virtual void lcl_positivePercentage(const OUString& rText) override;
146 virtual void lcl_props(writerfilter::Reference<Properties>::Pointer_t ref) override;
147 virtual void lcl_table(Id name,
148 writerfilter::Reference<Table>::Pointer_t ref) override;
149 virtual void lcl_substream(Id name,
150 ::writerfilter::Reference<Stream>::Pointer_t ref) override;
151 virtual void lcl_info(const std::string & info) override;
152 virtual void lcl_startGlossaryEntry() override;
153 virtual void lcl_endGlossaryEntry() override;
155 // Properties
156 virtual void lcl_attribute(Id Name, Value & val) override;
157 virtual void lcl_sprm(Sprm & sprm) override;
159 // Table
160 virtual void lcl_entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref) override;
162 void finishParagraph(const bool bRemove = false);
164 static void handleUnderlineType(const Id nId, const ::tools::SvRef<PropertyMap>& rContext);
165 void handleParaJustification(const sal_Int32 nIntValue, const ::tools::SvRef<PropertyMap>& rContext, const bool bExchangeLeftRight);
166 static bool getColorFromId(const Id, sal_Int32 &nColor);
167 static sal_Int16 getEmphasisValue(const sal_Int32 nIntValue);
168 static OUString getBracketStringFromEnum(const sal_Int32 nIntValue, const bool bIsPrefix = true);
169 static css::style::TabAlign getTabAlignFromValue(const sal_Int32 nIntValue);
170 static sal_Unicode getFillCharFromValue(const sal_Int32 nIntValue);
171 bool mbIsSplitPara;
172 bool mbHasControls;
173 std::unique_ptr< GraphicZOrderHelper > zOrderHelper;
174 std::unique_ptr<GraphicNamingHelper> m_pGraphicNamingHelper;
175 OUString m_sGlossaryEntryName;
178 } // namespace dmapper
179 } // namespace writerfilter
180 #endif
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */