android: Update app-specific/MIME type icons
[LibreOffice.git] / writerfilter / source / dmapper / DomainMapper_Impl.hxx
blob76be3e6701e3ef1ab23024b48db6f011c36c24be
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 #pragma once
21 #include <com/sun/star/text/XParagraphCursor.hpp>
22 #include <com/sun/star/text/XTextDocument.hpp>
23 #include <com/sun/star/text/XTextCursor.hpp>
24 #include <com/sun/star/text/XTextAppend.hpp>
25 #include <com/sun/star/text/XTextFrame.hpp>
26 #include <com/sun/star/style/TabStop.hpp>
27 #include <com/sun/star/container/XNameContainer.hpp>
28 #include <com/sun/star/embed/XStorage.hpp>
29 #include <queue>
30 #include <stack>
31 #include <string_view>
32 #include <o3tl/sorted_vector.hxx>
33 #include <unordered_map>
34 #include <utility>
35 #include <vector>
36 #include <optional>
38 #include <ooxml/OOXMLDocument.hxx>
40 #include <dmapper/CommentProperties.hxx>
42 #include "DomainMapper.hxx"
43 #include "DomainMapperTableManager.hxx"
44 #include "DomainMapperTableHandler.hxx"
45 #include "PropertyMap.hxx"
46 #include "FontTable.hxx"
47 #include "NumberingManager.hxx"
48 #include "StyleSheetTable.hxx"
49 #include "SettingsTable.hxx"
50 #include "ThemeHandler.hxx"
51 #include "GraphicImport.hxx"
52 #include "OLEHandler.hxx"
53 #include "FFDataHandler.hxx"
54 #include "SmartTagHandler.hxx"
55 #include "FormControlHelper.hxx"
56 #include <map>
58 namespace com::sun::star{
59 namespace awt{
60 struct Size;
62 namespace lang{
63 class XMultiServiceFactory;
64 struct Locale;
66 namespace text
68 class XTextField;
69 class XTextFrame;
70 class XFormField;
72 namespace beans{ class XPropertySet;}
75 namespace writerfilter::ooxml {
76 class OOXMLDocument;
79 namespace writerfilter::dmapper {
81 class SdtHelper;
83 struct PageMar
85 sal_Int32 top;
86 sal_Int32 right;
87 sal_Int32 bottom;
88 sal_Int32 left;
89 sal_Int32 header;
90 sal_Int32 footer;
91 sal_Int32 gutter;
92 public:
93 PageMar();
95 enum PageMarElement
97 PAGE_MAR_TOP,
98 PAGE_MAR_RIGHT,
99 PAGE_MAR_BOTTOM,
100 PAGE_MAR_LEFT,
101 PAGE_MAR_HEADER,
102 PAGE_MAR_FOOTER,
103 PAGE_MAR_GUTTER
106 /// property stack element
107 enum ContextType
109 CONTEXT_SECTION,
110 CONTEXT_PARAGRAPH,
111 CONTEXT_CHARACTER,
112 CONTEXT_STYLESHEET,
113 CONTEXT_LIST
115 enum { NUMBER_OF_CONTEXTS = CONTEXT_LIST + 1 };
117 enum BreakType
119 PAGE_BREAK,
120 COLUMN_BREAK,
121 LINE_BREAK
125 * Two special footnotes are a separator line, and a continuation line.
126 * In MSOffice, these can contain text as well, but LO doesn't implement this
127 * rarely used feature, so the separator text needs to be skipped. (tdf#123262)
128 * Three-way logic is needed because there is no guaranteed on-off event.
129 * OFF == not in footnote separator
130 * ON == in footnote separator
131 * SKIPPING == ON status has been recognized.
133 enum class SkipFootnoteSeparator
135 OFF,
137 SKIPPING
140 // type of stored redlines
141 enum StoredRedlines
143 FRAME = 0,
144 FOOTNOTE,
145 ENDNOTE,
146 NONE
150 * Storage for state that is relevant outside a header/footer, but not inside it.
152 * In case some state of DomainMapper_Impl should be reset before handling the
153 * header/footer and should be restored once handling of header/footer is done,
154 * then you can use this class to do so.
156 class HeaderFooterContext
158 bool m_bTextInserted;
159 sal_Int32 m_nTableDepth;
161 public:
162 explicit HeaderFooterContext(bool bTextInserted, sal_Int32 nTableDepth);
163 bool getTextInserted() const;
164 sal_Int32 getTableDepth() const;
167 /// Information about a paragraph to be finished after a field end.
168 struct FieldParagraph
170 PropertyMapPtr m_pPropertyMap;
171 bool m_bRemove = false;
174 /// field stack element
175 class FieldContext : public virtual SvRefBase
177 bool m_bFieldCommandCompleted;
178 css::uno::Reference<css::text::XTextRange> m_xStartRange;
180 // Two command string:
181 // 0: Normal, inserted command line
182 // 1: Deleted command line
183 OUString m_sCommand[2];
184 OUString m_sResult;
185 OUString m_sVariableValue;
186 std::optional<FieldId> m_eFieldId;
187 bool m_bFieldLocked;
188 // Current command line type: normal or deleted
189 bool m_bCommandType;
191 css::uno::Reference<css::text::XTextField> m_xTextField;
192 css::uno::Reference<css::text::XFormField> m_xFormField;
193 css::uno::Reference<css::beans::XPropertySet> m_xTOC;
194 css::uno::Reference<css::beans::XPropertySet> m_xTC; // TOX entry
195 css::uno::Reference<css::beans::XPropertySet> m_xCustomField;
197 OUString m_sHyperlinkURL;
198 /// A frame for the hyperlink when one exists.
199 OUString m_sHyperlinkTarget;
201 FFDataHandler::Pointer_t m_pFFDataHandler;
202 FormControlHelper::Pointer_t m_pFormControlHelper;
203 /// (Character) properties of the field itself.
204 PropertyMapPtr m_pProperties;
206 std::vector<FieldParagraph> m_aParagraphsToFinish;
208 public:
209 explicit FieldContext(css::uno::Reference<css::text::XTextRange> xStart);
210 ~FieldContext() override;
212 const css::uno::Reference<css::text::XTextRange>& GetStartRange() const { return m_xStartRange; }
214 void AppendCommand(std::u16string_view rPart);
215 const OUString& GetCommand() const {return m_sCommand[m_bCommandType]; }
216 bool GetCommandIsEmpty(bool bType) const { return m_sCommand[bType].isEmpty(); }
217 void SetCommandType(bool cType) { m_bCommandType = cType; }
219 void SetFieldId(FieldId eFieldId ) { m_eFieldId = eFieldId; }
220 std::optional<FieldId> const & GetFieldId() const { return m_eFieldId; }
222 void AppendResult(std::u16string_view rResult) { m_sResult += rResult; }
223 const OUString& GetResult() const { return m_sResult; }
225 void CacheVariableValue(const css::uno::Any& rAny);
226 const OUString& GetVariableValue() { return m_sVariableValue; }
228 void SetCommandCompleted() { m_bFieldCommandCompleted = true; }
229 bool IsCommandCompleted() const { return m_bFieldCommandCompleted; }
231 void SetFieldLocked() { m_bFieldLocked = true; }
232 bool IsFieldLocked() const { return m_bFieldLocked; }
234 const css::uno::Reference<css::beans::XPropertySet>& GetCustomField() const { return m_xCustomField; }
235 void SetCustomField(css::uno::Reference<css::beans::XPropertySet> const& xCustomField) { m_xCustomField = xCustomField; }
236 const css::uno::Reference<css::text::XTextField>& GetTextField() const { return m_xTextField;}
237 void SetTextField(css::uno::Reference<css::text::XTextField> const& xTextField);
238 const css::uno::Reference<css::text::XFormField>& GetFormField() const { return m_xFormField;}
239 void SetFormField(css::uno::Reference<css::text::XFormField> const& xFormField) { m_xFormField = xFormField;}
241 void SetTOC(css::uno::Reference<css::beans::XPropertySet> const& xTOC) { m_xTOC = xTOC; }
242 const css::uno::Reference<css::beans::XPropertySet>& GetTOC() const { return m_xTOC; }
244 void SetTC(css::uno::Reference<css::beans::XPropertySet> const& xTC) { m_xTC = xTC; }
245 const css::uno::Reference<css::beans::XPropertySet>& GetTC() const { return m_xTC; }
247 void SetHyperlinkURL( const OUString& rURL ) { m_sHyperlinkURL = rURL; }
248 const OUString& GetHyperlinkURL() const { return m_sHyperlinkURL; }
249 void SetHyperlinkTarget(const OUString& rTarget) { m_sHyperlinkTarget = rTarget; }
250 const OUString& GetHyperlinkTarget() const { return m_sHyperlinkTarget; }
252 void setFFDataHandler(FFDataHandler::Pointer_t pFFDataHandler) { m_pFFDataHandler = pFFDataHandler; }
253 const FFDataHandler::Pointer_t& getFFDataHandler() const { return m_pFFDataHandler; }
255 void setFormControlHelper(FormControlHelper::Pointer_t pFormControlHelper) { m_pFormControlHelper = pFormControlHelper; }
256 const FormControlHelper::Pointer_t& getFormControlHelper() const { return m_pFormControlHelper; }
257 const PropertyMapPtr& getProperties() const { return m_pProperties; }
259 ::std::vector<OUString> GetCommandParts() const;
261 std::vector<FieldParagraph>& GetParagraphsToFinish() { return m_aParagraphsToFinish; }
264 struct TextAppendContext
266 css::uno::Reference<css::text::XTextAppend> xTextAppend;
267 css::uno::Reference<css::text::XTextRange> xInsertPosition;
268 css::uno::Reference<css::text::XParagraphCursor> xCursor;
269 ParagraphPropertiesPtr pLastParagraphProperties;
272 * Objects anchored to the current paragraph, may affect the paragraph
273 * spacing.
275 std::vector<AnchoredObjectInfo> m_aAnchoredObjects;
277 inline TextAppendContext(css::uno::Reference<css::text::XTextAppend> xAppend, const css::uno::Reference<css::text::XTextCursor>& xCur);
280 struct AnchoredContext
282 css::uno::Reference<css::text::XTextContent> xTextContent;
283 bool bToRemove;
285 explicit AnchoredContext(css::uno::Reference<css::text::XTextContent> xContent)
286 : xTextContent(std::move(xContent)), bToRemove(false)
291 typedef tools::SvRef<FieldContext> FieldContextPtr;
293 /*-------------------------------------------------------------------------
294 extended tab stop struct
295 -----------------------------------------------------------------------*/
296 struct DeletableTabStop : public css::style::TabStop
298 bool bDeleted;
299 explicit DeletableTabStop()
300 : bDeleted(false)
302 FillChar = ' '; // same default as SvxXMLTabStopContext_Impl
304 DeletableTabStop(const css::style::TabStop& rTabStop)
305 : TabStop(rTabStop),
306 bDeleted(false)
310 /// helper to remember bookmark start position
311 struct BookmarkInsertPosition
313 bool m_bIsStartOfText;
314 OUString m_sBookmarkName;
315 css::uno::Reference<css::text::XTextRange> m_xTextRange;
316 BookmarkInsertPosition(bool bIsStartOfText, OUString rName, css::uno::Reference<css::text::XTextRange> xTextRange):
317 m_bIsStartOfText( bIsStartOfText ),
318 m_sBookmarkName(std::move( rName )),
319 m_xTextRange(std::move( xTextRange ))
323 struct PermInsertPosition
325 bool m_bIsStartOfText;
326 sal_Int32 m_Id;
327 OUString m_Ed;
328 OUString m_EdGrp;
330 css::uno::Reference<css::text::XTextRange> m_xTextRange;
332 PermInsertPosition(bool bIsStartOfText, sal_Int32 id, OUString ed, OUString edGrp, css::uno::Reference<css::text::XTextRange> xTextRange)
333 : m_bIsStartOfText(bIsStartOfText)
334 , m_Id(id)
335 , m_Ed(std::move(ed))
336 , m_EdGrp(std::move(edGrp))
337 , m_xTextRange(std::move(xTextRange))
340 OUString createBookmarkName() const
342 OUString bookmarkName;
344 assert((!m_Ed.isEmpty()) || (!m_EdGrp.isEmpty()));
346 if (m_Ed.isEmpty())
348 bookmarkName += "permission-for-group:" +
349 OUString::number(m_Id) +
350 ":" +
351 m_EdGrp;
353 else
355 bookmarkName += "permission-for-user:" +
356 OUString::number(m_Id) +
357 ":" +
358 m_Ed;
361 //todo: make sure the name is not used already!
362 return bookmarkName;
366 /// Stores the start/end positions of an annotation before its insertion.
367 struct AnnotationPosition
369 css::uno::Reference<css::text::XTextRange> m_xStart;
370 css::uno::Reference<css::text::XTextRange> m_xEnd;
373 struct RubyInfo
375 OUString sRubyText;
376 OUString sRubyStyle;
377 sal_uInt32 nSprmId;
378 sal_uInt32 nRubyAlign;
379 sal_uInt32 nHps;
380 sal_uInt32 nHpsBaseText;
382 RubyInfo():
383 nSprmId(0),
384 nRubyAlign(0),
385 nHps(0),
386 nHpsBaseText(0)
391 struct LineNumberSettings
393 sal_Int32 nDistance;
394 sal_Int32 nInterval;
395 bool bRestartAtEachPage;
396 LineNumberSettings() :
397 nDistance(-1)
398 ,nInterval(0)
399 ,bRestartAtEachPage(true)
404 /// Contains information about a table that will be potentially converted to a floating one at the section end.
405 struct FloatingTableInfo
407 css::uno::Sequence<css::beans::PropertyValue> m_aFrameProperties;
409 FloatingTableInfo(const css::uno::Sequence<css::beans::PropertyValue>& aFrameProperties)
410 : m_aFrameProperties(aFrameProperties)
413 css::uno::Any getPropertyValue(std::u16string_view propertyName);
416 /// Stores original/in-file-format info about a single anchored object.
417 struct AnchoredObjectInfo
419 css::uno::Reference<css::text::XTextContent> m_xAnchoredObject;
420 sal_Int32 m_nLeftMargin = 0;
421 RedlineParamsPtr m_xRedlineForInline;
424 /// Stores info about objects anchored to a given paragraph.
425 struct AnchoredObjectsInfo
427 css::uno::Reference<css::text::XTextRange> m_xParagraph;
428 std::vector<AnchoredObjectInfo> m_aAnchoredObjects;
431 struct SymbolData
433 sal_Unicode cSymbol;
434 OUString sFont;
435 SymbolData():
436 cSymbol(),
437 sFont()
441 class DomainMapper;
442 class DomainMapper_Impl final
444 public:
445 typedef std::map < OUString, BookmarkInsertPosition > BookmarkMap_t;
446 typedef std::map < sal_Int32, PermInsertPosition > PermMap_t;
448 private:
449 SourceDocumentType m_eDocumentType;
450 DomainMapper& m_rDMapper;
451 writerfilter::ooxml::OOXMLDocument* m_pOOXMLDocument;
452 OUString m_aBaseUrl;
453 css::uno::Reference<css::text::XTextDocument> m_xTextDocument;
454 css::uno::Reference<css::beans::XPropertySet> m_xDocumentSettings;
455 css::uno::Reference<css::lang::XMultiServiceFactory> m_xTextFactory;
456 css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
457 css::uno::Reference<css::container::XNameContainer> m_xPageStyles1;
458 // cache next available number, expensive to repeatedly compute
459 std::optional<int> m_xNextUnusedPageStyleNo;
460 css::uno::Reference<css::container::XNameContainer> m_xCharacterStyles;
461 // cache next available number, expensive to repeatedly compute
462 std::optional<int> m_xNextUnusedCharacterStyleNo;
463 css::uno::Reference<css::text::XText> m_xBodyText;
464 css::uno::Reference<css::text::XTextContent> m_xEmbedded;
466 std::stack<TextAppendContext> m_aTextAppendStack;
467 std::stack<AnchoredContext> m_aAnchoredStack;
468 std::stack<HeaderFooterContext> m_aHeaderFooterStack;
469 std::stack<std::pair<TextAppendContext, bool>> m_aHeaderFooterTextAppendStack;
470 std::deque<FieldContextPtr> m_aFieldStack;
471 bool m_bForceGenericFields;
472 /// Type of decimal symbol associated to the document language in Writer locale definition
473 bool m_bIsDecimalComma;
474 bool m_bSetUserFieldContent;
475 bool m_bSetCitation;
476 bool m_bSetDateValue;
477 bool m_bIsFirstSection;
478 bool m_bIsColumnBreakDeferred;
479 bool m_bIsPageBreakDeferred;
480 sal_Int32 m_nLineBreaksDeferred;
481 /// If we want to set "sdt end" on the next character context.
482 bool m_bSdtEndDeferred;
483 /// If we want to set "paragraph sdt end" on the next paragraph context.
484 bool m_bParaSdtEndDeferred;
485 bool m_bStartTOC;
486 bool m_bStartTOCHeaderFooter;
487 /// If we got any text that is the pre-rendered result of the TOC field.
488 bool m_bStartedTOC;
489 bool m_bStartIndex;
490 bool m_bStartBibliography;
491 unsigned int m_nStartGenericField;
492 bool m_bTextInserted;
493 bool m_bTextDeleted;
494 LineNumberSettings m_aLineNumberSettings;
496 BookmarkMap_t m_aBookmarkMap;
497 OUString m_sCurrentBkmkId;
498 OUString m_sCurrentBkmkName;
499 OUString m_sCurrentBkmkPrefix;
501 PermMap_t m_aPermMap;
502 sal_Int32 m_sCurrentPermId;
503 OUString m_sCurrentPermEd;
504 OUString m_sCurrentPermEdGrp;
506 PageMar m_aPageMargins;
507 SymbolData m_aSymbolData;
509 // TableManagers are stacked: one for each stream to avoid any confusion
510 std::stack< tools::SvRef< DomainMapperTableManager > > m_aTableManagers;
511 tools::SvRef<DomainMapperTableHandler> m_pTableHandler;
512 // List of document lists overrides. They are applied only once on first occurrence in document
513 o3tl::sorted_vector<sal_Int32> m_aListOverrideApplied;
515 //each context needs a stack of currently used attributes
516 std::stack<PropertyMapPtr> m_aPropertyStacks[NUMBER_OF_CONTEXTS];
517 std::stack<ContextType> m_aContextStack;
518 std::queue<std::optional<sal_Int16>> m_aFrameDirectionQueue;
519 bool m_bFrameDirectionSet;
520 FontTablePtr m_pFontTable;
521 ListsManager::Pointer m_pListTable;
522 std::deque< css::uno::Reference<css::drawing::XShape> > m_aPendingShapes;
523 StyleSheetTablePtr m_pStyleSheetTable;
524 SettingsTablePtr m_pSettingsTable;
525 GraphicImportPtr m_pGraphicImport;
527 std::unique_ptr<ThemeHandler> m_pThemeHandler;
529 PropertyMapPtr m_pTopContext;
530 PropertyMapPtr m_pLastSectionContext;
531 PropertyMapPtr m_pLastCharacterContext;
533 ::std::vector<DeletableTabStop> m_aCurrentTabStops;
534 OUString m_sCurrentParaStyleName; //highly inaccurate. Overwritten by "overlapping" paragraphs like comments, flys.
535 OUString m_sDefaultParaStyleName; //caches the ConvertedStyleName of the default paragraph style
536 bool m_bInDocDefaultsImport;
537 bool m_bInStyleSheetImport; //in import of fonts, styles, lists or lfos
538 bool m_bInNumberingImport; //in import of numbering (i.e. numbering.xml)
539 bool m_bInAnyTableImport; //in import of fonts, styles, lists or lfos
540 enum class HeaderFooterImportState
542 none,
543 header,
544 footer,
545 } m_eInHeaderFooterImport;
546 bool m_bDiscardHeaderFooter;
547 bool m_bInFootOrEndnote;
548 bool m_bInFootnote;
549 PropertyMapPtr m_pFootnoteContext;
550 bool m_bHasFootnoteStyle;
551 bool m_bCheckFootnoteStyle;
552 /// Skip paragraphs from the <w:separator/> footnote
553 SkipFootnoteSeparator m_eSkipFootnoteState;
554 /// preload footnotes and endnotes
555 sal_Int32 m_nFootnotes; // footnote count
556 sal_Int32 m_nEndnotes; // endnote count
557 // these are the real first notes, use their content in the first notes
558 sal_Int32 m_nFirstFootnoteIndex;
559 sal_Int32 m_nFirstEndnoteIndex;
561 bool m_bLineNumberingSet;
562 bool m_bIsInFootnoteProperties;
564 RubyInfo m_aRubyInfo;
565 //registered frame properties
566 std::vector<css::beans::PropertyValue> m_aFrameProperties;
567 css::uno::Reference<css::text::XTextRange> m_xFrameStartRange;
568 css::uno::Reference<css::text::XTextRange> m_xFrameEndRange;
570 // Redline stack
571 std::stack< std::vector< RedlineParamsPtr > > m_aRedlines;
572 // The redline currently read, may be also stored by a context instead of m_aRedlines.
573 RedlineParamsPtr m_currentRedline;
574 RedlineParamsPtr m_previousRedline;
575 RedlineParamsPtr m_pParaMarkerRedline;
576 bool m_bIsParaMarkerChange;
577 bool m_bIsParaMarkerMove;
578 // redline data of the terminating run, if it's a moveFrom deletion or a moveTo insertion
579 RedlineParamsPtr m_pParaMarkerRedlineMove;
580 // This is for removing workaround (double ZWSPs around the anchoring point) for track
581 // changed images anchored *to* character, if it's followed by a redline text run immediately.
582 // (In that case, the image is part of a tracked text range, no need for the dummy
583 // text ZWSPs to keep the change tracking of the image in Writer.)
584 bool m_bRedlineImageInPreviousRun;
586 /// If the current paragraph has any runs.
587 bool m_bParaChanged;
588 bool m_bIsFirstParaInSection;
589 bool m_bIsFirstParaInSectionAfterRedline;
590 bool m_bIsFirstParaInShape = false;
591 bool m_bDummyParaAddedForTableInSection;
592 bool m_bDummyParaAddedForTableInSectionPage;
593 bool m_bTextFrameInserted;
594 bool m_bIsPreviousParagraphFramed;
595 bool m_bIsLastParaInSection;
596 bool m_bIsLastSectionGroup;
597 bool m_bIsInComments;
598 /// If the current paragraph contains section property definitions.
599 bool m_bParaSectpr;
600 bool m_bUsingEnhancedFields;
601 /// If the current paragraph is inside a structured document element.
602 bool m_bSdt;
603 bool m_bIsFirstRun;
604 bool m_bIsOutsideAParagraph;
605 /// This is a continuation of already finished paragraph - e.g., first in an index section
606 bool m_bRemoveThisParagraph = false;
608 css::uno::Reference< css::text::XTextCursor > m_xTOCMarkerCursor;
610 //annotation import
611 css::uno::Reference< css::beans::XPropertySet > m_xAnnotationField;
612 sal_Int32 m_nAnnotationId;
613 bool m_bAnnotationResolved = false;
614 OUString m_sAnnotationParent;
615 OUString m_sAnnotationImportedParaId;
616 std::unordered_map< sal_Int32, AnnotationPosition > m_aAnnotationPositions;
618 void SetNumberFormat(const OUString& rCommand, css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, bool bDetectFormat = false);
619 /// @throws css::uno::Exception
620 css::uno::Reference<css::beans::XPropertySet> FindOrCreateFieldMaster(const char* pFieldMasterService, const OUString& rFieldMasterName);
621 css::uno::Reference<css::beans::XPropertySet> const & GetDocumentSettings();
623 std::map<sal_Int32, css::uno::Any> m_deferredCharacterProperties;
624 SmartTagHandler m_aSmartTagHandler;
626 css::uno::Reference<css::text::XTextRange> m_xGlossaryEntryStart;
627 css::uno::Reference<css::text::XTextRange> m_xSdtEntryStart;
628 std::stack<BookmarkInsertPosition> m_xSdtStarts;
630 std::queue< css::uno::Reference< css::text::XTextFrame > > m_xPendingTextBoxFrames;
632 public:
633 css::uno::Reference<css::text::XTextRange> m_xInsertTextRange;
634 css::uno::Reference<css::text::XTextRange> m_xAltChunkStartingRange;
635 std::deque<sal_Int32> m_aFootnoteIds;
636 std::deque<sal_Int32> m_aEndnoteIds;
638 bool m_bIsInTextBox;
639 private:
640 bool m_bIsNewDoc;
641 bool m_bIsAltChunk = false;
642 bool m_bIsReadGlossaries;
643 std::optional<sal_Int16> m_oLineBreakClear;
645 public:
646 DomainMapper_Impl(
647 DomainMapper& rDMapper,
648 css::uno::Reference < css::uno::XComponentContext > xContext,
649 css::uno::Reference< css::lang::XComponent > const& xModel,
650 SourceDocumentType eDocumentType,
651 utl::MediaDescriptor const & rMediaDesc);
652 ~DomainMapper_Impl();
654 void setDocumentReference(writerfilter::ooxml::OOXMLDocument* pDocument) { if (!m_pOOXMLDocument) m_pOOXMLDocument = pDocument; };
655 writerfilter::ooxml::OOXMLDocument* getDocumentReference() const;
657 SectionPropertyMap* GetLastSectionContext( )
659 return dynamic_cast< SectionPropertyMap* >( m_pLastSectionContext.get( ) );
662 css::uno::Reference<css::container::XNameContainer> const & GetPageStyles();
663 OUString GetUnusedPageStyleName();
664 css::uno::Reference<css::container::XNameContainer> const & GetCharacterStyles();
665 OUString GetUnusedCharacterStyleName();
666 css::uno::Reference<css::text::XText> const & GetBodyText();
667 const css::uno::Reference<css::lang::XMultiServiceFactory>& GetTextFactory() const
669 return m_xTextFactory;
671 const css::uno::Reference<css::text::XTextDocument>& GetTextDocument() const
673 return m_xTextDocument;
675 void SetDocumentSettingsProperty( const OUString& rPropName, const css::uno::Any& rValue );
677 void CreateRedline(css::uno::Reference<css::text::XTextRange> const& xRange, const RedlineParamsPtr& pRedline);
679 void CheckParaMarkerRedline(css::uno::Reference<css::text::XTextRange> const& xRange);
681 void CheckRedline(css::uno::Reference<css::text::XTextRange> const& xRange);
683 void StartParaMarkerChange( );
684 void EndParaMarkerChange( );
685 void StartParaMarkerMove( );
686 void EndParaMarkerMove( );
687 void ChainTextFrames();
689 void PushTextBoxContent();
690 void PopTextBoxContent();
691 void AttachTextBoxContentToShape(css::uno::Reference<css::drawing::XShape> xShape);
693 void RemoveDummyParaForTableInSection();
694 void AddDummyParaForTableInSection();
695 void RemoveLastParagraph( );
696 void SetIsDecimalComma() { m_bIsDecimalComma = true; };
697 void SetIsLastParagraphInSection( bool bIsLast );
698 bool GetIsLastParagraphInSection() const { return m_bIsLastParaInSection;}
699 void SetRubySprmId( sal_uInt32 nSprmId) { m_aRubyInfo.nSprmId = nSprmId ; }
700 void SetRubyText( OUString const &sText, OUString const &sStyle) {
701 m_aRubyInfo.sRubyText = sText;
702 m_aRubyInfo.sRubyStyle = sStyle;
704 const RubyInfo & GetRubyInfo() const { return m_aRubyInfo;}
705 void SetRubyInfo(const RubyInfo & rInfo) { m_aRubyInfo = rInfo;}
707 void SetIsLastSectionGroup( bool bIsLast );
708 bool GetIsLastSectionGroup() const { return m_bIsLastSectionGroup;}
709 void SetIsFirstParagraphInSection( bool bIsFirst );
710 void SetIsFirstParagraphInSectionAfterRedline( bool bIsFirstAfterRedline );
711 bool GetIsFirstParagraphInSection( bool bAfterRedline = false ) const;
712 void SetIsFirstParagraphInShape(bool bIsFirst);
713 bool GetIsFirstParagraphInShape() const { return m_bIsFirstParaInShape; }
714 void SetIsDummyParaAddedForTableInSection( bool bIsAdded );
715 bool GetIsDummyParaAddedForTableInSection() const { return m_bDummyParaAddedForTableInSection;}
716 void SetIsDummyParaAddedForTableInSectionPage(bool bIsAdded);
717 bool GetIsDummyParaAddedForTableInSectionPage() const { return m_bDummyParaAddedForTableInSectionPage; }
719 /// Track if a textframe has been inserted into this section
720 void SetIsTextFrameInserted( bool bIsInserted );
721 bool GetIsTextFrameInserted() const { return m_bTextFrameInserted;}
722 void SetIsTextDeleted(bool bIsTextDeleted) { m_bTextDeleted = bIsTextDeleted; }
724 void SetIsPreviousParagraphFramed( bool bIsFramed ) { m_bIsPreviousParagraphFramed = bIsFramed; }
725 bool GetIsPreviousParagraphFramed() const { return m_bIsPreviousParagraphFramed; }
726 void SetParaSectpr(bool bParaSectpr);
727 bool GetParaSectpr() const { return m_bParaSectpr;}
729 void SetSymbolChar( sal_Int32 nSymbol) { m_aSymbolData.cSymbol = sal_Unicode(nSymbol); }
730 void SetSymbolFont( OUString const &rName ) { m_aSymbolData.sFont = rName; }
731 const SymbolData & GetSymbolData() const { return m_aSymbolData;}
733 /// Setter method for m_bSdt.
734 void SetSdt(bool bSdt);
736 void PushSdt();
737 void PopSdt();
738 /// Gives access to the currently open run/inline SDTs.
739 const std::stack<BookmarkInsertPosition>& GetSdtStarts() const;
741 /// Getter method for m_bSdt.
742 bool GetSdt() const { return m_bSdt;}
743 bool GetParaChanged() const { return m_bParaChanged;}
744 bool GetParaHadField() const { return m_bParaHadField; }
745 bool GetRemoveThisPara() const { return m_bRemoveThisParagraph; }
747 void deferBreak( BreakType deferredBreakType );
748 bool isBreakDeferred( BreakType deferredBreakType );
749 void clearDeferredBreaks();
750 void clearDeferredBreak(BreakType deferredBreakType);
752 void setSdtEndDeferred(bool bSdtEndDeferred);
753 bool isSdtEndDeferred() const;
754 void setParaSdtEndDeferred(bool bParaSdtEndDeferred);
755 bool isParaSdtEndDeferred() const;
757 void finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove = false, const bool bNoNumbering = false);
758 void appendTextPortion( const OUString& rString, const PropertyMapPtr& pPropertyMap );
759 void appendTextContent(const css::uno::Reference<css::text::XTextContent>&, const css::uno::Sequence<css::beans::PropertyValue>&);
760 void appendOLE( const OUString& rStreamName, const std::shared_ptr<OLEHandler>& pOleHandler );
761 void appendStarMath( const Value& v);
762 void adjustLastPara(sal_Int8 nAlign);
763 css::uno::Reference<css::beans::XPropertySet> appendTextSectionAfter(css::uno::Reference<css::text::XTextRange> const & xBefore);
765 /// AutoText import: each entry is placed in the separate section
766 void appendGlossaryEntry();
767 /// Remember where entry was started
768 void setGlossaryEntryStart( css::uno::Reference<css::text::XTextRange> const & xStart )
770 m_xGlossaryEntryStart = xStart;
773 // push the new properties onto the stack and make it the 'current' property map
774 void PushProperties(ContextType eId);
775 void PushStyleProperties(const PropertyMapPtr& pStyleProperties);
776 void PushListProperties(const PropertyMapPtr& pListProperties);
777 void PopProperties(ContextType eId);
779 ContextType GetTopContextType() const { return m_aContextStack.top(); }
780 const PropertyMapPtr& GetTopContext() const
782 return m_pTopContext;
784 PropertyMapPtr GetTopContextOfType(ContextType eId);
786 bool HasTopText() const;
787 css::uno::Reference<css::text::XTextAppend> const & GetTopTextAppend();
788 FieldContextPtr const & GetTopFieldContext();
790 bool HasTopAnchoredObjects() const;
792 FontTablePtr const & GetFontTable()
794 if(!m_pFontTable)
795 m_pFontTable = new FontTable();
796 return m_pFontTable;
798 StyleSheetTablePtr const & GetStyleSheetTable()
800 if(!m_pStyleSheetTable)
801 m_pStyleSheetTable = new StyleSheetTable( m_rDMapper, m_xTextDocument, m_bIsNewDoc );
802 return m_pStyleSheetTable;
804 OUString GetListStyleName(sal_Int32 nListId);
805 ListsManager::Pointer const & GetListTable();
807 std::unique_ptr<ThemeHandler> const& getThemeHandler()
809 if (!m_pThemeHandler && m_pOOXMLDocument && m_pOOXMLDocument->getTheme())
811 m_pThemeHandler = std::make_unique<ThemeHandler>(m_pOOXMLDocument->getTheme(), GetSettingsTable()->GetThemeFontLangProperties());
813 return m_pThemeHandler;
816 SettingsTablePtr const & GetSettingsTable()
818 if( !m_pSettingsTable )
819 m_pSettingsTable = new SettingsTable(m_rDMapper);
820 return m_pSettingsTable;
823 GraphicImportPtr const & GetGraphicImport();
824 void ResetGraphicImport();
825 // this method deletes the current m_pGraphicImport after import
826 void ImportGraphic(const writerfilter::Reference<Properties>::Pointer_t&);
828 void InitTabStopFromStyle(const css::uno::Sequence<css::style::TabStop>& rInitTabStops);
829 void IncorporateTabStop( const DeletableTabStop &aTabStop );
830 css::uno::Sequence<css::style::TabStop> GetCurrentTabStopAndClear();
832 void SetCurrentParaStyleName(const OUString& sStringValue) {m_sCurrentParaStyleName = sStringValue;}
833 OUString GetCurrentParaStyleName();
834 OUString GetDefaultParaStyleName();
836 // specified style - including inherited properties. Indicate whether paragraph defaults should be checked.
837 css::uno::Any GetPropertyFromStyleSheet(PropertyIds eId, StyleSheetEntryPtr pEntry, const bool bDocDefaults, const bool bPara, bool* bIsDocDefault = nullptr);
838 // current paragraph style - including inherited properties
839 css::uno::Any GetPropertyFromParaStyleSheet(PropertyIds eId);
840 // context's character style - including inherited properties
841 css::uno::Any GetPropertyFromCharStyleSheet(PropertyIds eId, const PropertyMapPtr& rContext);
842 // get property first from the given context, or secondly via inheritance from styles/docDefaults
843 css::uno::Any GetAnyProperty(PropertyIds eId, const PropertyMapPtr& rContext);
844 void SetDocDefaultsImport( bool bSet ) { m_bInDocDefaultsImport = bSet;}
845 bool IsDocDefaultsImport()const { return m_bInDocDefaultsImport;}
846 void SetStyleSheetImport( bool bSet ) { m_bInStyleSheetImport = bSet;}
847 bool IsStyleSheetImport()const { return m_bInStyleSheetImport;}
848 void SetNumberingImport( bool bSet ) { m_bInNumberingImport = bSet;}
849 bool IsNumberingImport() const { return m_bInNumberingImport;}
850 void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;}
851 bool IsAnyTableImport()const { return m_bInAnyTableImport;}
852 bool IsInShape()const { return m_aAnchoredStack.size() > 0;}
854 void PushShapeContext(const css::uno::Reference<css::drawing::XShape>& xShape);
855 void PopShapeContext();
856 void UpdateEmbeddedShapeProps(const css::uno::Reference<css::drawing::XShape>& xShape);
857 /// Add a pending shape: it's currently inserted into the document, but it should be removed before the import finishes.
858 void PushPendingShape(const css::uno::Reference<css::drawing::XShape>& xShape);
859 /// Get the first pending shape, if there are any.
860 css::uno::Reference<css::drawing::XShape> PopPendingShape();
862 void PushPageHeader(SectionPropertyMap::PageType eType);
863 void PushPageFooter(SectionPropertyMap::PageType eType);
865 void PopPageHeaderFooter();
866 bool IsInHeaderFooter() const { return m_eInHeaderFooterImport != HeaderFooterImportState::none; }
867 void ConvertHeaderFooterToTextFrame(bool, bool);
868 static void fillEmptyFrameProperties(std::vector<css::beans::PropertyValue>& rFrameProperties, bool bSetAnchorToChar);
870 bool IsInTOC() const;
872 void PushFootOrEndnote( bool bIsFootnote );
873 void PopFootOrEndnote();
874 bool IsInFootOrEndnote() const { return m_bInFootOrEndnote; }
875 bool IsInFootnote() const { return IsInFootOrEndnote() && m_bInFootnote; }
877 void StartCustomFootnote(const PropertyMapPtr pContext);
878 void EndCustomFootnote();
879 bool IsInCustomFootnote() const { return m_bHasFootnoteStyle; }
880 bool CheckFootnoteStyle() const { return m_bCheckFootnoteStyle; }
881 void SetHasFootnoteStyle(bool bVal) { m_bHasFootnoteStyle = bVal; }
882 void SetCheckFootnoteStyle(bool bVal) { m_bCheckFootnoteStyle = bVal; }
884 const PropertyMapPtr& GetFootnoteContext() const { return m_pFootnoteContext; }
886 SkipFootnoteSeparator GetSkipFootnoteState() const { return m_eSkipFootnoteState; }
887 void SetSkipFootnoteState(SkipFootnoteSeparator eId) { m_eSkipFootnoteState = eId; }
888 sal_Int32 GetFootnoteCount() const { return m_nFootnotes; }
889 void IncrementFootnoteCount() { ++m_nFootnotes; }
890 sal_Int32 GetEndnoteCount() const { return m_nEndnotes; }
891 void IncrementEndnoteCount() { ++m_nEndnotes; }
892 bool CopyTemporaryNotes(
893 css::uno::Reference< css::text::XFootnote > xNoteSrc,
894 css::uno::Reference< css::text::XFootnote > xNoteDest );
895 void RemoveTemporaryFootOrEndnotes();
897 void PushAnnotation();
898 void PopAnnotation();
899 sal_Int32 GetAnnotationId() { return m_nAnnotationId; }
901 /// A field context starts with a cFieldStart.
902 void PushFieldContext();
903 //the current field context waits for the completion of the command
904 bool IsOpenFieldCommand() const;
905 bool IsOpenField() const;
906 //mark field in current context as locked (fixed)
907 void SetFieldLocked();
908 //collect the pieces of the command
909 void AppendFieldCommand(OUString const & rPartOfCommand);
910 void handleRubyEQField( const FieldContextPtr& pContext);
911 void handleFieldSet
912 (const FieldContextPtr& pContext,
913 css::uno::Reference< css::uno::XInterface > const & xFieldInterface,
914 css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties);
915 void handleFieldAsk
916 (const FieldContextPtr& pContext,
917 css::uno::Reference< css::uno::XInterface > & xFieldInterface,
918 css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties);
919 OUString convertFieldFormula(const OUString& input);
920 void handleFieldFormula
921 (const FieldContextPtr& pContext,
922 css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties);
923 void handleAutoNum
924 (const FieldContextPtr& pContext,
925 css::uno::Reference< css::uno::XInterface > const & xFieldInterface,
926 css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties);
927 static void handleAuthor
928 (std::u16string_view rFirstParam,
929 css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties,
930 FieldId eFieldId);
931 void handleDocProperty
932 (const FieldContextPtr& pContext,
933 OUString const& rFirstParam,
934 css::uno::Reference< css::uno::XInterface > & xFieldInterface);
935 void handleToc
936 (const FieldContextPtr& pContext,
937 const OUString & sTOCServiceName);
938 void handleIndex
939 (const FieldContextPtr& pContext,
940 const OUString & sTOCServiceName);
942 void handleBibliography
943 (const FieldContextPtr& pContext,
944 const OUString & sTOCServiceName);
945 /// The field command has to be closed (cFieldSep appeared).
946 void CloseFieldCommand();
947 //the _current_ fields require a string type result while TOCs accept richt results
948 bool IsFieldResultAsString();
949 void AppendFieldResult(std::u16string_view rResult);
950 //apply the result text to the related field
951 void SetFieldResult(OUString const& rResult);
952 // set FFData of top field context
953 void SetFieldFFData( const FFDataHandler::Pointer_t& pFFDataHandler );
954 /// The end of field is reached (cFieldEnd appeared) - the command might still be open.
955 void PopFieldContext();
957 /// Returns title of the TOC placed in paragraph(s) before TOC field inside STD-frame
958 OUString extractTocTitle();
959 css::uno::Reference<css::beans::XPropertySet> createSectionForRange(css::uno::Reference< css::text::XTextRange > xStart, css::uno::Reference< css::text::XTextRange > xEnd, const OUString & sObjectType, bool stepLeft);
961 void SetBookmarkName( const OUString& rBookmarkName );
962 void StartOrEndBookmark( const OUString& rId );
964 void SetMoveBookmark( bool IsFrom );
966 void setPermissionRangeEd(const OUString& user);
967 void setPermissionRangeEdGrp(const OUString& group);
968 void startOrEndPermissionRange(sal_Int32 permissinId);
970 void AddAnnotationPosition(
971 const bool bStart,
972 const sal_Int32 nAnnotationId );
974 bool hasTableManager() const
976 return !m_aTableManagers.empty();
979 DomainMapperTableManager& getTableManager()
981 return *m_aTableManagers.top();
984 void appendTableManager( )
986 tools::SvRef<DomainMapperTableManager> pMngr(new DomainMapperTableManager());
987 m_aTableManagers.push( pMngr );
990 void appendTableHandler( )
992 if (m_pTableHandler)
993 m_aTableManagers.top()->setHandler(m_pTableHandler);
996 void popTableManager( )
998 if (hasTableManager())
999 m_aTableManagers.pop();
1002 void SetLineNumbering( sal_Int32 nLnnMod, sal_uInt32 nLnc, sal_Int32 ndxaLnn );
1003 bool IsLineNumberingSet() const {return m_bLineNumberingSet;}
1005 DeletableTabStop m_aCurrentTabStop;
1007 bool IsOOXMLImport() const { return m_eDocumentType == SourceDocumentType::OOXML; }
1009 bool IsRTFImport() const { return m_eDocumentType == SourceDocumentType::RTF; }
1011 void InitPageMargins() { m_aPageMargins = PageMar(); }
1012 void SetPageMarginTwip( PageMarElement eElement, sal_Int32 nValue );
1013 const PageMar& GetPageMargins() const {return m_aPageMargins;}
1015 const LineNumberSettings& GetLineNumberSettings() const { return m_aLineNumberSettings;}
1016 void SetLineNumberSettings(const LineNumberSettings& rSet) { m_aLineNumberSettings = rSet;}
1018 void SetInFootnoteProperties(bool bSet) { m_bIsInFootnoteProperties = bSet;}
1019 bool IsInFootnoteProperties() const { return m_bIsInFootnoteProperties;}
1021 bool IsInComments() const { return m_bIsInComments; };
1023 std::vector<css::beans::PropertyValue> MakeFrameProperties(const ParagraphProperties& rProps);
1024 void CheckUnregisteredFrameConversion(bool bPreventOverlap = false);
1026 void RegisterFrameConversion(css::uno::Reference<css::text::XTextRange> const& xFrameStartRange,
1027 css::uno::Reference<css::text::XTextRange> const& xFrameEndRange,
1028 std::vector<css::beans::PropertyValue>&& aFrameProperties);
1029 void ExecuteFrameConversion();
1031 void AddNewRedline( sal_uInt32 sprmId );
1033 sal_Int32 GetCurrentRedlineToken( ) const;
1034 void SetCurrentRedlineAuthor( const OUString& sAuthor );
1035 void SetCurrentRedlineDate( const OUString& sDate );
1036 void SetCurrentRedlineId( sal_Int32 nId );
1037 void SetCurrentRedlineToken( sal_Int32 nToken );
1038 void SetCurrentRedlineRevertProperties( const css::uno::Sequence<css::beans::PropertyValue>& aProperties );
1039 void SetCurrentRedlineIsRead();
1040 void RemoveTopRedline( );
1041 void SetCurrentRedlineInitials( const OUString& sInitials );
1042 bool IsFirstRun() const { return m_bIsFirstRun;}
1043 void SetIsFirstRun(bool bval) { m_bIsFirstRun = bval;}
1044 bool IsOutsideAParagraph() const { return m_bIsOutsideAParagraph;}
1045 void SetIsOutsideAParagraph(bool bval) { m_bIsOutsideAParagraph = bval;}
1047 void ApplySettingsTable();
1049 css::uno::Reference<css::text::XTextAppend> GetCurrentXText() {
1050 return m_aTextAppendStack.empty() ? nullptr : m_aTextAppendStack.top().xTextAppend;
1053 void NewFrameDirection() {
1054 m_aFrameDirectionQueue.push(std::nullopt);
1055 m_bFrameDirectionSet = false;
1057 void SetFrameDirection(sal_Int16 nDirection) {
1058 if (!m_bFrameDirectionSet && !m_aFrameDirectionQueue.empty()) {
1059 m_aFrameDirectionQueue.back() = nDirection;
1060 m_bFrameDirectionSet = true;
1063 std::optional<sal_Int16> PopFrameDirection() {
1064 if (m_aFrameDirectionQueue.empty())
1065 return {};
1066 const std::optional<sal_Int16> nDirection = m_aFrameDirectionQueue.front();
1067 m_aFrameDirectionQueue.pop();
1068 return nDirection;
1071 SectionPropertyMap * GetSectionContext();
1073 sal_Int16 GetListLevel(const StyleSheetEntryPtr& pEntry, const PropertyMapPtr& pParaContext = nullptr);
1074 void ValidateListLevel(const OUString& sStyleIdentifierD);
1077 Used for attributes/sprms which cannot be evaluated immediately (e.g. they depend
1078 on another one that comes in the same CONTEXT_CHARACTER). The property will be processed
1079 again in DomainMapper::processDeferredCharacterProperties().
1081 void deferCharacterProperty(sal_Int32 id, const css::uno::Any& value);
1083 Processes properties deferred using deferCharacterProperty(). To be called whenever the top
1084 CONTEXT_CHARACTER is going to be used (e.g. by appendText()).
1086 void processDeferredCharacterProperties(bool bCharContext = true);
1088 sal_Int32 getNumberingProperty(const sal_Int32 nListId, sal_Int32 nListLevel, const OUString& aProp);
1089 /// Get a property of the current numbering style's current level.
1090 sal_Int32 getCurrentNumberingProperty(const OUString& aProp);
1092 /// If we're importing into a new document, or just pasting to an existing one.
1093 bool IsNewDoc() const { return m_bIsNewDoc;}
1095 bool IsAltChunk() const { return m_bIsAltChunk;}
1097 /// If we're importing autotext.
1098 bool IsReadGlossaries() const { return m_bIsReadGlossaries;}
1100 tools::SvRef<SdtHelper> m_pSdtHelper;
1102 /// Document background color, applied to every page style.
1103 std::optional<sal_Int32> m_oBackgroundColor;
1106 * This contains the raw table depth. m_nTableDepth > 0 is the same as
1107 * getTableManager().isInTable(), unless we're in the first paragraph of a
1108 * table, or first paragraph after a table, as the table manager is only
1109 * updated once we ended the paragraph (and know if the para has the
1110 * inTbl SPRM or not).
1112 sal_Int32 m_nTableDepth;
1113 /// Raw table cell depth.
1114 sal_Int32 m_nTableCellDepth;
1115 /// Table cell depth of the last finished paragraph.
1116 sal_Int32 m_nLastTableCellParagraphDepth;
1118 /// If the current section has footnotes.
1119 bool m_bHasFtn;
1120 /// If the current section has a footnote separator.
1121 bool m_bHasFtnSep;
1123 /// If the next tab should be ignored, used for footnotes.
1124 bool m_bCheckFirstFootnoteTab;
1125 bool m_bIgnoreNextTab;
1127 /// Paragraphs with anchored objects in the current section.
1128 std::vector<AnchoredObjectsInfo> m_aAnchoredObjectAnchors;
1130 /// Append a property to a sub-grabbag if necessary (e.g. 'lineRule', 'auto')
1131 void appendGrabBag(std::vector<css::beans::PropertyValue>& rInteropGrabBag, const OUString& aKey, const OUString& aValue);
1132 void appendGrabBag(std::vector<css::beans::PropertyValue>& rInteropGrabBag, const OUString& aKey, std::vector<css::beans::PropertyValue>& rValue);
1134 /// Enable, disable and check status of grabbags
1135 void enableInteropGrabBag(const OUString& aName);
1136 void disableInteropGrabBag();
1137 bool isInteropGrabBagEnabled() const;
1139 /// Name of m_aInteropGrabBag.
1140 OUString m_aInteropGrabBagName;
1142 /// A toplevel dmapper grabbag, like 'pPr'.
1143 std::vector<css::beans::PropertyValue> m_aInteropGrabBag;
1145 /// A sub-grabbag of m_aInteropGrabBag, like 'spacing'.
1146 std::vector<css::beans::PropertyValue> m_aSubInteropGrabBag;
1148 /// ST_PositionOffset values we received
1149 std::pair<OUString, OUString> m_aPositionOffsets;
1150 /// ST_AlignH/V values we received
1151 std::pair<OUString, OUString> m_aAligns;
1152 /// ST_PositivePercentage values we received
1153 std::queue<OUString> m_aPositivePercentages;
1154 enum GraphicImportType m_eGraphicImportType = {};
1155 bool isInIndexContext() const { return m_bStartIndex;}
1156 bool isInBibliographyContext() const { return m_bStartBibliography;}
1157 SmartTagHandler& getSmartTagHandler() { return m_aSmartTagHandler; }
1159 void substream(Id rName, ::writerfilter::Reference<Stream>::Pointer_t const& ref);
1161 /// If the document needs to split paragraph.
1162 bool m_bIsSplitPara;
1164 /// Check if "SdtEndBefore" property is set
1165 bool IsSdtEndBefore();
1167 bool IsDiscardHeaderFooter() const;
1169 bool IsForceGenericFields() const { return m_bForceGenericFields; }
1171 void SetParaAutoBefore(bool bParaAutoBefore) { m_bParaAutoBefore = bParaAutoBefore; }
1173 /// Forget about the previous paragraph, as it's not inside the same
1174 /// start/end node.
1175 void ClearPreviousParagraph();
1177 /// Check if previous paragraph has borders in between and do the border magic to it if so
1178 bool handlePreviousParagraphBorderInBetween() const;
1180 /// Handle redline text portions in a frame, footnotes and redlines:
1181 /// store their data, and create them after frame creation or footnote/endnote copying
1182 bool m_bIsActualParagraphFramed;
1183 std::deque<css::uno::Any> m_aStoredRedlines[StoredRedlines::NONE];
1185 bool IsParaWithInlineObject() const { return m_bParaWithInlineObject; }
1187 css::uno::Reference< css::embed::XStorage > m_xDocumentStorage;
1189 /// Handles <w:altChunk>.
1190 void HandleAltChunk(const OUString& rStreamName);
1192 /// Handles <w:ptab>.
1193 void HandlePTab(sal_Int32 nAlignment);
1195 /// Handles <w:br w:clear="...">.
1196 void HandleLineBreakClear(sal_Int32 nClear);
1198 /// Handles <w:br>.
1199 void HandleLineBreak(const PropertyMapPtr& pPropertyMap);
1201 void commentProps(const OUString& sId, const CommentProperties& rProps);
1203 OUString ConvertTOCStyleName(OUString const&);
1205 OUString getFontNameForTheme(const Id id);
1207 private:
1208 void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType);
1209 // Start a new index section; if needed, finish current paragraph
1210 css::uno::Reference<css::beans::XPropertySet> StartIndexSectionChecked(const OUString& sServiceName);
1211 std::vector<css::uno::Reference< css::drawing::XShape > > m_vTextFramesForChaining ;
1212 /// Current paragraph had at least one field in it.
1213 bool m_bParaHadField;
1214 bool m_bSaveParaHadField;
1215 css::uno::Reference<css::beans::XPropertySet> m_xPreviousParagraph;
1216 /// Current paragraph has automatic before spacing.
1217 bool m_bParaAutoBefore;
1218 /// Current paragraph in a table is first paragraph of a cell
1219 bool m_bFirstParagraphInCell;
1220 bool m_bSaveFirstParagraphInCell;
1221 /// Current paragraph had at least one inline object in it.
1222 bool m_bParaWithInlineObject;
1223 /// SAXException was seen so document will be abandoned
1224 bool m_bSaxError;
1226 std::unordered_map<OUString, CommentProperties> m_aCommentProps;
1229 TextAppendContext::TextAppendContext(css::uno::Reference<css::text::XTextAppend> xAppend, const css::uno::Reference<css::text::XTextCursor>& xCur)
1230 : xTextAppend(std::move(xAppend))
1232 xCursor.set(xCur, css::uno::UNO_QUERY);
1233 xInsertPosition = xCursor;
1236 } //namespace writerfilter::dmapper
1238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */