1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_DOCXATTRIBUTEOUTPUT_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_WW8_DOCXATTRIBUTEOUTPUT_HXX
24 #include <string_view>
26 #include "attributeoutputbase.hxx"
29 #include "docxexport.hxx"
30 #include <wrtswtbl.hxx>
31 #include <redline.hxx>
33 #include <editeng/boxitem.hxx>
34 #include <sax/fshelper.hxx>
35 #include <sax/fastattribs.hxx>
36 #include <vcl/vclenum.hxx>
37 #include <svx/xenum.hxx>
43 #include <o3tl/sorted_vector.hxx>
44 #include <oox/export/vmlexport.hxx>
45 #include <oox/export/drawingml.hxx>
46 #include "docxtablestyleexport.hxx"
48 #include <com/sun/star/table/BorderLine2.hpp>
49 #include <com/sun/star/drawing/FillStyle.hpp>
53 enum class SvxBoxItemLine
;
54 enum class SwLineBreakClear
;
55 class SwContentControl
;
57 namespace docx
{ class FootnotesList
; }
58 namespace oox::drawingml
{ class DrawingML
; }
62 std::shared_ptr
<const SwField
> pField
;
63 const ::sw::mark::Fieldmark
* pFieldmark
;
70 : pFieldmark(nullptr), eType(ww::eUNKNOWN
)
71 , bOpen(false), bSep(false), bClose(false)
75 enum DocxColBreakStatus
79 COLBRK_WRITEANDPOSTPONE
,
84 * A structure that holds information about the options selected
85 * when outputting a border to DOCX.
87 * There are 3 functions that initialize this structure:
88 * - lcl_getTableDefaultBorderOptions - retrieves the options for when outputting table default borders
89 * - lcl_getTableCellBorderOptions - retrieves the options for when outputting table cell borders
90 * - lcl_getBoxBorderOptions - retrieves the options for when outputting box borders
93 struct OutputBorderOptions
96 bool bUseStartEnd
= false;
97 bool bWriteTag
= true;
98 bool bWriteDistance
= false;
99 SvxShadowLocation aShadowLocation
= SvxShadowLocation::NONE
;
100 std::shared_ptr
<editeng::WordBorderDistances
> pDistances
;
103 struct DocxTableExportContext
;
106 * A structure that holds flags for the table export.
108 struct TableReference
110 /// Remember if we are in an open cell, or not.
111 bool m_bTableCellOpen
;
113 /// If paragraph sdt got opened in this table cell.
114 bool m_bTableCellParaSdtOpen
;
116 /// Remember if we are in a deleted/inserted cell, or not.
117 bool m_bTableCellChanged
;
119 /// Remember the current table depth.
120 sal_uInt32 m_nTableDepth
;
123 : m_bTableCellOpen(false),
124 m_bTableCellParaSdtOpen(false),
125 m_bTableCellChanged(false),
131 /** Using framePr, a paragraph can be enclosed in a frame described by its pPr paragraph settings,
132 * and therefore it needs to apply the frame's properties when exporting the paragraph properties.
136 ww8::Frame
* m_pFrame
;
137 sal_Int32 m_nTableDepth
;
138 bool m_bUseFrameBorders
;
139 bool m_bUseFrameBackground
;
140 bool m_bUseFrameTextDirection
;
146 , m_bUseFrameBorders(true)
147 , m_bUseFrameBackground(true)
148 , m_bUseFrameTextDirection(true)
151 ww8::Frame
* Frame() { return m_pFrame
; }
152 void SetFrame(ww8::Frame
* pSet
, sal_Int32 nTableDepth
= -1);
153 bool UseFrameBorders(sal_Int32 nTableDepth
);
154 void SetUseFrameBorders(bool bSet
) { m_bUseFrameBorders
= bSet
; }
155 bool UseFrameBackground();
156 void SetUseFrameBackground(bool bSet
) { m_bUseFrameBackground
= bSet
; }
157 bool UseFrameTextDirection(sal_Int32 nTableDepth
);
158 void SetUseFrameTextDirection(bool bSet
) { m_bUseFrameTextDirection
= bSet
; }
166 , m_bStartedSdt(false)
167 , m_bShowingPlaceHolder(false)
174 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pTokenChildren
;
175 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pTokenAttributes
;
176 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pTextAttrs
;
177 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pDataBindingAttrs
;
179 OUString m_aAppearance
;
180 OUString m_aPlaceHolderDocPart
;
181 bool m_bShowingPlaceHolder
;
184 sal_Int32 m_nTabIndex
;
186 sal_Int32 m_nSdtPrToken
;
188 void DeleteAndResetTheLists();
190 void WriteSdtBlock(const ::sax_fastparser::FSHelperPtr
& pSerializer
, bool bRunTextIsOn
, bool bParagraphHasDrawing
);
191 void WriteExtraParams(const ::sax_fastparser::FSHelperPtr
& pSerializer
);
193 /// Closes a currently open SDT block.
194 void EndSdtBlock(const ::sax_fastparser::FSHelperPtr
& pSerializer
);
196 void GetSdtParamsFromGrabBag(const uno::Sequence
<beans::PropertyValue
>& aGrabBagSdt
);
199 /// The class that has handlers for various resource types when exporting as DOCX.
200 class DocxAttributeOutput
: public AttributeOutputBase
, public oox::vml::VMLTextExport
, public oox::drawingml::DMLTextExport
203 /// Export the state of RTL/CJK.
204 virtual void RTLAndCJKState( bool bIsRTL
, sal_uInt16 nScript
) override
;
206 /// Start of the paragraph.
207 virtual sal_Int32
StartParagraph(const ww8::WW8TableNodeInfo::Pointer_t
& pTextNodeInfo
,
208 bool bGenerateParaId
) override
;
210 /// End of the paragraph.
211 virtual void EndParagraph( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTextNodeInfoInner
) override
;
214 virtual void EmptyParagraph() override
;
216 /// Called in order to output section breaks.
217 virtual void SectionBreaks(const SwNode
& rNode
) override
;
219 /// Called before we start outputting the attributes.
220 virtual void StartParagraphProperties() override
;
222 /// Called after we end outputting the attributes.
223 virtual void EndParagraphProperties(const SfxItemSet
& rParagraphMarkerProperties
, const SwRedlineData
* pRedlineData
, const SwRedlineData
* pRedlineParagraphMarkerDeleted
, const SwRedlineData
* pRedlineParagraphMarkerInserted
) override
;
225 /// Start of the text run.
226 virtual void StartRun( const SwRedlineData
* pRedlineData
, sal_Int32 nPos
, bool bSingleEmptyRun
= false ) override
;
228 /// End of the text run.
229 virtual void EndRun(const SwTextNode
* pNode
, sal_Int32 nPos
, sal_Int32 nLen
, bool bLastRun
= false) override
;
231 /// Called before we start outputting the attributes.
232 virtual void StartRunProperties() override
;
234 /// Called after we end outputting the attributes.
235 virtual void EndRunProperties( const SwRedlineData
* pRedlineData
) override
;
237 virtual bool FootnoteEndnoteRefTag() override
;
239 virtual void SectFootnoteEndnotePr() override
;
241 virtual void WritePostitFieldReference() override
;
243 /// Output text (inside a run).
244 virtual void RunText( const OUString
& rText
, rtl_TextEncoding eCharSet
= RTL_TEXTENCODING_UTF8
, const OUString
& rSymbolFont
= OUString() ) override
;
246 /// Output text (without markup).
247 virtual void RawText(const OUString
& rText
, rtl_TextEncoding eCharSet
) override
;
249 /// Output ruby start.
250 virtual void StartRuby( const SwTextNode
& rNode
, sal_Int32 nPos
, const SwFormatRuby
& rRuby
) override
;
253 virtual void EndRuby(const SwTextNode
& rNode
, sal_Int32 nPos
) override
;
255 /// Output URL start.
256 virtual bool StartURL( const OUString
& rUrl
, const OUString
& rTarget
, const OUString
& rName
= OUString() ) override
;
259 virtual bool EndURL(bool) override
;
261 virtual void FieldVanish(const OUString
& rText
, ww::eField eType
, OUString
const*) override
;
263 /// Output redlining.
265 /// The common attribute that can be among the run properties.
266 virtual void Redline( const SwRedlineData
* pRedline
) override
;
268 /// Output redlining.
270 /// Start of the tag that encloses the run, fills the info according to
271 /// the value of pRedlineData.
272 void StartRedline( const SwRedlineData
* pRedlineData
, bool bLastRun
);
274 /// Output redlining.
276 /// End of the tag that encloses the run.
277 void EndRedline( const SwRedlineData
* pRedlineData
, bool bLastRun
);
279 virtual void SetStateOfFlyFrame( FlyProcessingState nStateOfFlyFrame
) override
;
280 virtual void SetAnchorIsLinkedToNode( bool bAnchorLinkedToNode
) override
;
281 virtual bool IsFlyProcessingPostponed() override
;
282 virtual void ResetFlyProcessingFlag() override
;
284 virtual void FormatDrop( const SwTextNode
& rNode
, const SwFormatDrop
& rSwFormatDrop
, sal_uInt16 nStyle
, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo
, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner
) override
;
287 virtual void ParagraphStyle( sal_uInt16 nStyle
) override
;
289 virtual void TableInfoCell( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
290 virtual void TableInfoRow( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
291 virtual void TableDefinition( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
292 virtual void TableDefaultBorders( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
293 void TableDefaultCellMargins( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
);
294 virtual void TableBackgrounds( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
295 virtual void TableRowRedline( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
296 virtual void TableCellRedline( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
297 virtual void TableHeight( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
298 virtual void TableCanSplit( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
299 virtual void TableBidi( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
300 virtual void TableVerticalCell( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
301 virtual void TableNodeInfoInner( const ww8::WW8TableNodeInfoInner::Pointer_t
& pNodeInfoInner
) override
;
302 virtual void TableOrientation( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
303 virtual void TableSpacing( const ww8::WW8TableNodeInfoInner::Pointer_t
& pTableTextNodeInfoInner
) override
;
304 virtual void TableRowEnd( sal_uInt32 nDepth
) override
;
306 /// Start of the styles table.
307 virtual void StartStyles() override
;
309 /// End of the styles table.
310 virtual void EndStyles( sal_uInt16 nNumberOfStyles
) override
;
312 /// Write default style.
313 virtual void DefaultStyle() override
;
315 /// Write Doc Defaults
318 /// Write latent styles.
321 /** Similar to OutputItem(), but write something only if it is not the default.
323 This is to output the docDefaults, and we should write something out
324 only in case it is not what MSO already uses for the document by default.
326 void OutputDefaultItem(const SfxPoolItem
& rHt
);
328 /// Start of a style in the styles table.
329 virtual void StartStyle( const OUString
& rName
, StyleType eType
,
330 sal_uInt16 nBase
, sal_uInt16 nNext
, sal_uInt16 nLink
, sal_uInt16 nWwId
, sal_uInt16 nSlot
,
331 bool bAutoUpdate
) override
;
333 /// End of a style in the styles table.
334 virtual void EndStyle() override
;
336 /// Start of (paragraph or run) properties of a style.
337 virtual void StartStyleProperties( bool bParProp
, sal_uInt16 nStyle
) override
;
339 /// End of (paragraph or run) properties of a style.
340 virtual void EndStyleProperties( bool bParProp
) override
;
342 /// Numbering rule and Id.
343 virtual void OutlineNumbering(sal_uInt8 nLvl
) override
;
346 /// As a paragraph property - the paragraph should be on the next page.
347 virtual void PageBreakBefore( bool bBreak
) override
;
349 /// Write a section break
350 /// msword::ColumnBreak or msword::PageBreak
351 /// bBreakAfter: the break must be scheduled for insertion in the end of current paragraph
352 virtual void SectionBreak( sal_uInt8 nC
, bool bBreakAfter
, const WW8_SepInfo
* pSectionInfo
= nullptr, bool bExtraPageBreak
= false ) override
;
354 // preserve DOCX page vertical alignment
355 virtual void TextVerticalAdjustment( const css::drawing::TextVerticalAdjust
) override
;
357 /// Start of the section properties.
358 virtual void StartSection() override
;
360 /// End of the section properties.
361 virtual void EndSection() override
;
363 /// Protection of forms.
364 virtual void SectionFormProtection( bool bProtected
) override
;
366 /// Numbering of the lines in the document.
367 virtual void SectionLineNumbering( sal_uLong nRestartNo
, const SwLineNumberInfo
& rLnNumInfo
) override
;
369 /// Has different headers/footers for the title page.
370 virtual void SectionTitlePage() override
;
372 /// Description of the page borders.
373 virtual void SectionPageBorders( const SwFrameFormat
* pFormat
, const SwFrameFormat
* pFirstPageFormat
) override
;
375 /// Columns populated from right/numbers on the right side?
376 virtual void SectionBiDi( bool bBiDi
) override
;
378 /// The style of the page numbers.
380 virtual void SectionPageNumbering( sal_uInt16 nNumType
, const ::std::optional
<sal_uInt16
>& oPageRestartNumber
) override
;
382 /// The type of breaking.
383 virtual void SectionType( sal_uInt8 nBreakCode
) override
;
386 void StartFont( const OUString
& rFamilyName
) const;
389 void EndFont() const;
391 /// Alternate name for the font.
392 void FontAlternateName( const OUString
& rName
) const;
395 void FontCharset( sal_uInt8 nCharSet
, rtl_TextEncoding nEncoding
) const;
398 void FontFamilyType( FontFamily eFamily
) const;
401 void FontPitchType( FontPitch ePitch
) const;
403 /// Write out the font into the document, if it's an embedded font.
404 void EmbedFont( std::u16string_view name
, FontFamily family
, FontPitch pitch
);
406 /// Definition of a numbering instance.
407 virtual void NumberingDefinition( sal_uInt16 nId
, const SwNumRule
&rRule
) override
;
409 /// Numbering definition that overrides abstract numbering definition
410 virtual void OverrideNumberingDefinition( SwNumRule
const& rRule
,
411 sal_uInt16 nNum
, sal_uInt16 nAbstractNum
,
412 const std::map
< size_t, size_t > & rLevelOverrides
) override
;
414 /// Start of the abstract numbering definition instance.
415 virtual void StartAbstractNumbering( sal_uInt16 nId
) override
;
417 /// End of the abstract numbering definition instance.
418 virtual void EndAbstractNumbering() override
;
420 /// All the numbering level information.
421 virtual void NumberingLevel( sal_uInt8 nLevel
,
423 sal_uInt16 nNumberingType
,
425 const sal_uInt8
*pNumLvlPos
,
428 const SfxItemSet
*pOutSet
,
430 sal_Int16 nFirstLineIndex
,
431 sal_Int16 nListTabPos
,
432 const OUString
&rNumberingString
,
433 const SvxBrushItem
* pBrush
,
434 bool isLegal
) override
;
436 void WriteField_Impl(const SwField
* pField
, ww::eField eType
,
437 const OUString
& rFieldCmd
, FieldFlags nMode
,
438 OUString
const* pBookmarkName
= nullptr);
439 void WriteFormData_Impl( const ::sw::mark::Fieldmark
& rFieldmark
);
441 void WriteBookmarks_Impl( std::vector
< OUString
>& rStarts
, std::vector
< OUString
>& rEnds
, const SwRedlineData
* pRedlineData
= nullptr );
442 void WriteFinalBookmarks_Impl( std::vector
< OUString
>& rStarts
, std::vector
< OUString
>& rEnds
);
443 void WriteAnnotationMarks_Impl( std::vector
< OUString
>& rStarts
, std::vector
< OUString
>& rEnds
);
444 /// End possibly opened paragraph sdt block.
445 void EndParaSdtBlock();
447 void WriteFloatingTable(ww8::Frame
const* pParentFrame
);
450 /// Initialize the structures where we are going to collect some of the paragraph properties.
452 /// Some of the properties have to be collected from more sources, and are
453 /// actually not written between StartParagraphProperties and
454 /// EndParagraphProperties. They are output in this method, which is
455 /// supposed to be called just before outputting </rPr> whenever it is done.
456 void InitCollectedParagraphProperties();
458 /// Output what we collected during the run properties output.
460 /// @see WriteCollectedParagrapProperties().
461 void WriteCollectedParagraphProperties();
463 /// Initialize the structures where we are going to collect some of the run properties.
465 /// This is an equivalent of InitCollectedParagraphProperties(), resp.
466 /// WriteCollectectedParagraphProperties().
468 /// @see InitCollectedParagraphProperties().
469 void InitCollectedRunProperties();
471 /// Output what we collected during the run properties output.
473 /// @see InitCollectedRunproperties(), WriteCollectedParagraphProperties()
474 void WriteCollectedRunProperties();
476 /// Output graphic fly frames or replacement graphics for OLE nodes.
478 /// For graphic frames, just use the first two parameters, for OLE
479 /// replacement graphics, set the first as 0, and pass the remaining three.
481 /// @see WriteOLE2Obj()
482 void FlyFrameGraphic( const SwGrfNode
* pGrfNode
, const Size
& rSize
, const SwFlyFrameFormat
* pOLEFrameFormat
, SwOLENode
* pOLENode
, const SdrObject
* pSdrObj
= nullptr);
483 void WriteSrcRect(const css::uno::Reference
<css::beans::XPropertySet
>& xShapePropSet
,
484 const SwFrameFormat
* pFrameFormat
);
485 void WriteOLE2Obj( const SdrObject
* pSdrObj
, SwOLENode
& rNode
, const Size
& rSize
, const SwFlyFrameFormat
* pFlyFrameFormat
, const sal_Int8 nFormulaAlignment
);
486 bool WriteOLEChart( const SdrObject
* pSdrObj
, const Size
& rSize
, const SwFlyFrameFormat
* pFlyFrameFormat
);
487 bool WriteOLEMath( const SwOLENode
& rNode
, const sal_Int8 nAlign
);
488 void PostponeOLE( SwOLENode
& rNode
, const Size
& rSize
, const SwFlyFrameFormat
* pFlyFrameFormat
);
489 void WriteOLE( SwOLENode
& rNode
, const Size
& rSize
, const SwFlyFrameFormat
* rFlyFrameFormat
);
490 void WriteOLEShape(const SwFlyFrameFormat
& rFrameFormat
, const Size
& rSize
,
491 std::string_view rShapeId
, const OUString
& rImageId
);
492 static OString
GetOLEStyle(const SwFlyFrameFormat
& rFormat
, const Size
& rSize
);
493 void ExportOLESurround(const SwFormatSurround
& rWrap
);
495 void WriteActiveXControl(const SdrObject
* pObject
, const SwFrameFormat
& rFrameFormat
, bool bInsideRun
);
496 bool ExportAsActiveXControl(const SdrObject
* pObject
) const;
498 void InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t
const & pTableTextNodeInfoInner
);
499 void StartTable( ww8::WW8TableNodeInfoInner::Pointer_t
const & pTableTextNodeInfoInner
);
500 void StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t
const & pTableTextNodeInfoInner
);
501 void StartTableCell( ww8::WW8TableNodeInfoInner::Pointer_t
const & pTableTextNodeInfoInner
, sal_uInt32 nCell
, sal_uInt32 nRow
);
502 void TableCellProperties( ww8::WW8TableNodeInfoInner::Pointer_t
const & pTableTextNodeInfoInner
, sal_uInt32 nCell
, sal_uInt32 nRow
);
503 void EndTableCell( sal_uInt32 nCell
);
506 void SyncNodelessCells(ww8::WW8TableNodeInfoInner::Pointer_t
const & pInner
, sal_Int32 nCell
, sal_uInt32 nRow
);
507 void PopulateFrameProperties(const SwFrameFormat
* pFrameFormat
, const Size
& rSize
);
508 /// End cell, row, and even the entire table if necessary.
509 void FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t
const & pInner
, bool bForceEmptyParagraph
= false );
511 void WriteFFData( const FieldInfos
& rInfos
);
512 void WritePendingPlaceholder();
514 bool EmbedFontStyle( std::u16string_view name
, int tag
, FontFamily family
, FontItalic italic
, FontWeight weight
,
518 * Translate an ico value to the corresponding HighlightColorValues enumeration item
520 * @param[in] nIco ico value [0..16]
521 * @return color name (e.g. "red"), if color is inside [1..16] range
522 * empty string, otherwise
524 static OString
TransHighlightColor( sal_uInt8 nIco
);
527 /// Output frames - the implementation.
528 virtual void OutputFlyFrame_Impl( const ww8::Frame
& rFormat
, const Point
& rNdTopLeft
) override
;
530 /// Sfx item Sfx item RES_CHRATR_CASEMAP
531 virtual void CharCaseMap( const SvxCaseMapItem
& rCaseMap
) override
;
533 /// Sfx item Sfx item RES_CHRATR_COLOR
534 virtual void CharColor( const SvxColorItem
& rColor
) override
;
536 /// Sfx item Sfx item RES_CHRATR_CONTOUR
537 virtual void CharContour( const SvxContourItem
& rContour
) override
;
539 /// Sfx item RES_CHRATR_CROSSEDOUT
540 virtual void CharCrossedOut( const SvxCrossedOutItem
& rCrossedOut
) override
;
542 /// Sfx item RES_CHRATR_ESCAPEMENT
543 virtual void CharEscapement( const SvxEscapementItem
& rEscapement
) override
;
545 /// Sfx item RES_CHRATR_FONT
546 virtual void CharFont( const SvxFontItem
& rFont
) override
;
548 /// Sfx item RES_CHRATR_FONTSIZE
549 virtual void CharFontSize( const SvxFontHeightItem
& rFontSize
) override
;
551 /// Sfx item RES_CHRATR_KERNING
552 virtual void CharKerning( const SvxKerningItem
& rKerning
) override
;
554 /// Sfx item RES_CHRATR_LANGUAGE
555 virtual void CharLanguage( const SvxLanguageItem
& rLanguage
) override
;
557 /// Sfx item RES_CHRATR_POSTURE
558 virtual void CharPosture( const SvxPostureItem
& rPosture
) override
;
560 /// Sfx item RES_CHRATR_SHADOWED
561 virtual void CharShadow( const SvxShadowedItem
& rShadow
) override
;
563 /// Sfx item RES_CHRATR_UNDERLINE
564 virtual void CharUnderline( const SvxUnderlineItem
& rUnderline
) override
;
566 /// Sfx item RES_CHRATR_WEIGHT
567 virtual void CharWeight( const SvxWeightItem
& rWeight
) override
;
569 /// Sfx item RES_CHRATR_AUTOKERN
570 virtual void CharAutoKern( const SvxAutoKernItem
& ) override
;
572 /// Sfx item RES_CHRATR_BLINK
573 virtual void CharAnimatedText( const SvxBlinkItem
& rBlink
) override
;
575 /// Sfx item RES_CHRATR_BACKGROUND
576 virtual void CharBackground( const SvxBrushItem
& rBrush
) override
;
578 /// Sfx item RES_CHRATR_CJK_FONT
579 virtual void CharFontCJK( const SvxFontItem
& rFont
) override
;
581 /// Sfx item RES_CHRATR_CJK_FONTSIZE
582 virtual void CharFontSizeCJK( const SvxFontHeightItem
& rFontSize
) override
{ CharFontSize( rFontSize
); }
584 /// Sfx item RES_CHRATR_CJK_LANGUAGE
585 virtual void CharLanguageCJK( const SvxLanguageItem
& rLanguageItem
) override
{ CharLanguage( rLanguageItem
); }
587 /// Sfx item RES_CHRATR_CJK_POSTURE
588 virtual void CharPostureCJK( const SvxPostureItem
& rPosture
) override
;
590 /// Sfx item RES_CHRATR_CJK_WEIGHT
591 virtual void CharWeightCJK( const SvxWeightItem
& rWeight
) override
;
593 /// Sfx item RES_CHRATR_CTL_FONT
594 virtual void CharFontCTL( const SvxFontItem
& rFont
) override
;
596 /// Sfx item RES_CHRATR_CTL_FONTSIZE
597 virtual void CharFontSizeCTL( const SvxFontHeightItem
& rFontSize
) override
{ CharFontSize( rFontSize
); }
599 /// Sfx item RES_CHRATR_CTL_LANGUAGE
600 virtual void CharLanguageCTL( const SvxLanguageItem
& rLanguageItem
) override
{ CharLanguage( rLanguageItem
); }
602 /// Sfx item RES_CHRATR_CTL_POSTURE
603 virtual void CharPostureCTL( const SvxPostureItem
& rWeight
) override
;
605 /// Sfx item RES_CHRATR_CTL_WEIGHT
606 virtual void CharWeightCTL( const SvxWeightItem
& rWeight
) override
;
608 /// Sfx item RES_CHRATR_BidiRTL
609 virtual void CharBidiRTL( const SfxPoolItem
& ) override
;
611 /// Sfx item RES_CHRATR_IdctHint
612 virtual void CharIdctHint( const SfxPoolItem
& ) override
;
614 /// Sfx item RES_CHRATR_ROTATE
615 virtual void CharRotate( const SvxCharRotateItem
& rRotate
) override
;
617 /// Sfx item RES_CHRATR_EMPHASIS_MARK
618 virtual void CharEmphasisMark( const SvxEmphasisMarkItem
& rEmphasisMark
) override
;
620 /// Sfx item RES_CHRATR_TWO_LINES
621 virtual void CharTwoLines( const SvxTwoLinesItem
& rTwoLines
) override
;
623 /// Sfx item RES_CHRATR_SCALEW
624 virtual void CharScaleWidth( const SvxCharScaleWidthItem
& rScaleWidth
) override
;
626 /// Sfx item RES_CHRATR_RELIEF
627 virtual void CharRelief( const SvxCharReliefItem
& rRelief
) override
;
629 /// Sfx item RES_CHRATR_HIDDEN
630 virtual void CharHidden( const SvxCharHiddenItem
& rHidden
) override
;
632 /// Sfx item RES_CHRATR_BOX
633 virtual void CharBorder( const ::editeng::SvxBorderLine
* pAllBorder
, const sal_uInt16 nDist
, const bool bShadow
) override
;
635 /// Sfx item RES_CHRATR_HIGHLIGHT
636 virtual void CharHighlight( const SvxBrushItem
& rHighlight
) override
;
638 /// Sfx item RES_TXTATR_INETFMT
639 virtual void TextINetFormat( const SwFormatINetFormat
& ) override
;
641 /// Sfx item RES_TXTATR_CHARFMT
642 virtual void TextCharFormat( const SwFormatCharFormat
& ) override
;
644 /// Sfx item RES_TXTATR_FTN
645 virtual void TextFootnote_Impl( const SwFormatFootnote
& ) override
;
647 /// Output the footnote/endnote reference (if there's one to output).
648 void FootnoteEndnoteReference();
650 /// Sfx item RES_PARATR_LINESPACING
651 virtual void ParaLineSpacing_Impl( short nSpace
, short nMulti
) override
;
653 /// Sfx item RES_PARATR_ADJUST
654 virtual void ParaAdjust( const SvxAdjustItem
& rAdjust
) override
;
656 /// Sfx item RES_PARATR_SPLIT
657 virtual void ParaSplit( const SvxFormatSplitItem
& rSplit
) override
;
659 /// Sfx item RES_PARATR_WIDOWS
660 virtual void ParaWidows( const SvxWidowsItem
& rWidows
) override
;
662 /// Sfx item RES_PARATR_TABSTOP
663 virtual void ParaTabStop( const SvxTabStopItem
& rTabStop
) override
;
665 /// Sfx item RES_PARATR_HYPHENZONE
666 virtual void ParaHyphenZone( const SvxHyphenZoneItem
& ) override
;
668 /// Sfx item RES_PARATR_NUMRULE
669 virtual void ParaNumRule_Impl( const SwTextNode
*pTextNd
, sal_Int32 nLvl
, sal_Int32 nNumId
) override
;
671 /// Sfx item RES_PARATR_SCRIPTSPACE
672 virtual void ParaScriptSpace( const SfxBoolItem
& ) override
;
674 /// Sfx item RES_PARATR_HANGINGPUNCTUATION
675 virtual void ParaHangingPunctuation( const SfxBoolItem
& ) override
;
677 /// Sfx item RES_PARATR_FORBIDDEN_RULES
678 virtual void ParaForbiddenRules( const SfxBoolItem
& ) override
;
680 /// Sfx item RES_PARATR_VERTALIGN
681 virtual void ParaVerticalAlign( const SvxParaVertAlignItem
& rAlign
) override
;
683 /// Sfx item RES_PARATR_SNAPTOGRID
684 virtual void ParaSnapToGrid( const SvxParaGridItem
& ) override
;
686 /// Sfx item RES_FRM_SIZE
687 virtual void FormatFrameSize( const SwFormatFrameSize
& ) override
;
689 /// Sfx item RES_PAPER_BIN
690 virtual void FormatPaperBin( const SvxPaperBinItem
& ) override
;
692 /// Sfx item RES_MARGIN_FIRSTLINE
693 virtual void FormatFirstLineIndent(const SvxFirstLineIndentItem
& rFirstLine
) override
;
694 /// Sfx item RES_MARGIN_TEXTLEFT
695 virtual void FormatTextLeftMargin(const SvxTextLeftMarginItem
& rTextLeftMargin
) override
;
696 /// Sfx item RES_MARGIN_RIGHT
697 virtual void FormatRightMargin(const SvxRightMarginItem
& rRightMargin
) override
;
699 /// Sfx item RES_LR_SPACE
700 virtual void FormatLRSpace( const SvxLRSpaceItem
& rLRSpace
) override
;
702 /// Sfx item RES_UL_SPACE
703 virtual void FormatULSpace( const SvxULSpaceItem
& rULSpace
) override
;
705 /// Sfx item RES_SURROUND
706 virtual void FormatSurround( const SwFormatSurround
& ) override
;
708 /// Sfx item RES_VERT_ORIENT
709 virtual void FormatVertOrientation( const SwFormatVertOrient
& ) override
;
711 /// Sfx item RES_HORI_ORIENT
712 virtual void FormatHorizOrientation( const SwFormatHoriOrient
& ) override
;
714 /// Sfx item RES_ANCHOR
715 virtual void FormatAnchor( const SwFormatAnchor
& ) override
;
717 /// Sfx item RES_BACKGROUND
718 virtual void FormatBackground( const SvxBrushItem
& ) override
;
720 /// Sfx item RES_FILL_STYLE
721 virtual void FormatFillStyle( const XFillStyleItem
& ) override
;
723 /// Sfx item RES_FILL_GRADIENT
724 virtual void FormatFillGradient( const XFillGradientItem
& ) override
;
727 virtual void FormatBox( const SvxBoxItem
& ) override
;
730 virtual void FormatColumns_Impl( sal_uInt16 nCols
, const SwFormatCol
& rCol
, bool bEven
, SwTwips nPageSize
) override
;
732 /// Sfx item RES_KEEP
733 virtual void FormatKeep( const SvxFormatKeepItem
& ) override
;
735 /// Sfx item RES_TEXTGRID
736 virtual void FormatTextGrid( const SwTextGridItem
& ) override
;
738 /// Sfx item RES_LINENUMBER
739 virtual void FormatLineNumbering( const SwFormatLineNumber
& ) override
;
741 /// Sfx item RES_FRAMEDIR
742 virtual void FormatFrameDirection( const SvxFrameDirectionItem
& ) override
;
744 /// Sfx item RES_PARATR_GRABBAG
745 virtual void ParaGrabBag( const SfxGrabBagItem
& ) override
;
747 /// Sfx item RES_CHRATR_GRABBAG
748 virtual void CharGrabBag( const SfxGrabBagItem
& ) override
;
750 // Sfx item RES_PARATR_OUTLINELEVEL
751 virtual void ParaOutlineLevel( const SfxUInt16Item
& ) override
;
753 /// Write the expanded field
754 virtual void WriteExpand( const SwField
* pField
) override
;
756 virtual void RefField( const SwField
& rField
, const OUString
& rRef
) override
;
757 virtual void HiddenField( const SwField
& rField
) override
;
758 virtual void SetField( const SwField
& rField
, ww::eField eType
, const OUString
& rCmd
) override
;
759 virtual void PostitField( const SwField
* pField
) override
;
760 virtual bool DropdownField( const SwField
* pField
) override
;
761 virtual bool PlaceholderField( const SwField
* pField
) override
;
763 virtual bool AnalyzeURL( const OUString
& rURL
, const OUString
& rTarget
, OUString
* pLinkURL
, OUString
* pMark
) override
;
765 virtual void WriteBookmarkInActParagraph( const OUString
& rName
, sal_Int32 nFirstRunPos
, sal_Int32 nLastRunPos
) override
;
767 void SectionRtlGutter( const SfxBoolItem
& rRtlGutter
) override
;
769 void TextLineBreak(const SwFormatLineBreak
& rLineBreak
) override
;
771 /// Writes a clearing line break at the end of run properties, if there are any.
772 void WriteLineBreak();
776 void DoWriteBookmarkTagStart(const OUString
& bookmarkName
);
777 void DoWriteBookmarkTagEnd(sal_Int32 nId
);
778 void DoWriteMoveRangeTagStart(std::u16string_view bookmarkName
,
779 bool bFrom
, const SwRedlineData
* pRedlineData
);
780 void DoWriteMoveRangeTagEnd(sal_Int32 nId
, bool bFrom
);
781 void DoWriteBookmarksStart(std::vector
<OUString
>& rStarts
, const SwRedlineData
* pRedlineData
= nullptr);
782 void DoWriteBookmarksEnd(std::vector
<OUString
>& rEnds
);
783 void DoWriteBookmarkStartIfExist(sal_Int32 nRunPos
);
784 void DoWriteBookmarkEndIfExist(sal_Int32 nRunPos
);
786 void DoWritePermissionTagStart(const OUString
& permission
);
787 void DoWritePermissionTagEnd(const OUString
& permission
);
788 void DoWritePermissionsStart();
789 void DoWritePermissionsEnd();
791 void DoWriteAnnotationMarks( );
792 void WritePostponedGraphic();
793 void WritePostponedMath(const SwOLENode
* pObject
, sal_Int8
/*nAlign*/);
794 void WritePostponedFormControl(const SdrObject
* pObject
);
795 void WritePostponedActiveXControl(bool bInsideRun
);
796 void WritePostponedDiagram();
797 void WritePostponedChart();
798 void WritePostponedOLE();
799 void WritePostponedDMLDrawing();
800 void WritePostponedCustomShape();
801 void WriteFlyFrame(const ww8::Frame
& rFrame
);
803 void WriteFormDateStart(const OUString
& sFullDate
, const OUString
& sDateFormat
, const OUString
& sLang
, const uno::Sequence
<beans::PropertyValue
>& aGrabBagSdt
);
804 void WriteSdtPlainText(const OUString
& sValue
, const uno::Sequence
<beans::PropertyValue
>& aGrabBagSdt
);
805 void WriteSdtDropDownStart(const OUString
& rName
, OUString
const& rSelected
, uno::Sequence
<OUString
> const& rListItems
);
806 void WriteSdtDropDownEnd(OUString
const& rSelected
, uno::Sequence
<OUString
> const& rListItems
);
807 void WriteContentControlStart();
808 void WriteContentControlEnd();
810 void StartField_Impl( const SwTextNode
* pNode
, sal_Int32 nPos
, FieldInfos
const & rInfos
, bool bWriteRun
= false );
811 void DoWriteCmd( std::u16string_view rCmd
);
812 void CmdField_Impl( const SwTextNode
* pNode
, sal_Int32 nPos
, FieldInfos
const & rInfos
, bool bWriteRun
);
813 void CmdEndField_Impl( const SwTextNode
* pNode
, sal_Int32 nPos
, bool bWriteRun
);
814 void EndField_Impl( const SwTextNode
* pNode
, sal_Int32 nPos
, FieldInfos
& rInfos
);
815 void DoWriteFieldRunProperties( const SwTextNode
* pNode
, sal_Int32 nPos
, bool bWriteCombChars
= false );
817 /// Reference to the export, where to get the data from
818 DocxExport
&m_rExport
;
820 /// Fast serializer to output the data
821 ::sax_fastparser::FSHelperPtr m_pSerializer
;
824 oox::drawingml::DrawingML
&m_rDrawingML
;
826 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pFontsAttrList
;
827 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pEastAsianLayoutAttrList
;
828 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pCharLangAttrList
;
829 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pSectionSpacingAttrList
;
830 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pLRSpaceAttrList
;
831 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pParagraphSpacingAttrList
;
832 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pHyperlinkAttrList
;
833 std::shared_ptr
<SwContentControl
> m_pContentControl
;
834 /// If the current SDT around runs should be ended before the current run.
836 /// Attributes of the run color
837 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pColorAttrList
;
838 sal_uInt8 m_nCharTransparence
= 0;
839 model::ComplexColor m_aComplexColor
;
840 /// Attributes of the paragraph background
841 rtl::Reference
<sax_fastparser::FastAttributeList
> m_pBackgroundAttrList
;
842 OUString m_sOriginalBackgroundColor
;
843 OUString m_hyperLinkAnchor
;
845 std::unique_ptr
<docx::FootnotesList
> m_pFootnotesList
;
846 std::unique_ptr
<docx::FootnotesList
> m_pEndnotesList
;
847 int m_footnoteEndnoteRefTag
;
848 OUString m_footnoteCustomLabel
;
849 std::unique_ptr
< const WW8_SepInfo
> m_pSectionInfo
;
851 /// Redline data to remember in the text run.
852 const SwRedlineData
*m_pRedlineData
;
854 /// Id of the redline
855 sal_Int32 m_nRedlineId
;
857 /// Flag indicating that the section properties are being written
858 bool m_bOpenedSectPr
;
859 /// Did we have a section break in this paragraph? Set by StartSection(), reset by the next StartParagraph().
861 /// Flag indicating that the paragraph properties are being written
862 bool m_bOpenedParaPr
;
864 /// Flag indicating that the Run Text is being written
867 /// Flag indicating that the header \ footer are being written
868 bool m_bWritingHeaderFooter
;
869 bool m_bAnchorLinkedToNode
;
871 /// Flag indicating that multiple runs of a field are being written
872 bool m_bWritingField
;
874 /// Field data to remember in the text run
875 bool m_bPreventDoubleFieldsHandling
;
876 std::vector
< FieldInfos
> m_Fields
;
877 OUString m_sFieldBkm
;
878 sal_Int32 m_nNextBookmarkId
;
879 sal_Int32 m_nNextAnnotationMarkId
;
881 /// [MS-DOCX] section 2.6.2.3
882 sal_Int32 m_nNextParaId
= 1; // MUST be greater than 0
886 /// The first frame (anchored to the main text) is 0.
887 /// The second frame what is anchored to the previous in, is 1
888 /// The third anchored inside the second is the 2 etc.
889 sal_uInt32 m_nEmbedFlyLevel
;
891 /// Stores the flys what are anchored inside a fly
892 std::vector
<ww8::Frame
> m_vPostponedFlys
;
894 /// Bookmarks to output
895 std::vector
<OUString
> m_rBookmarksStart
;
896 std::vector
<OUString
> m_rBookmarksEnd
;
897 SwRedlineData
* m_pMoveRedlineData
;
899 /// Bookmarks to output at the end
900 std::vector
<OUString
> m_rFinalBookmarksStart
;
901 std::vector
<OUString
> m_rFinalBookmarksEnd
;
903 /// Bookmarks of the current paragraph
904 std::multimap
<sal_Int32
, OUString
> m_aBookmarksOfParagraphStart
;
905 std::multimap
<sal_Int32
, OUString
> m_aBookmarksOfParagraphEnd
;
907 /// Permissions to output
908 std::vector
<OUString
> m_rPermissionsStart
;
909 std::vector
<OUString
> m_rPermissionsEnd
;
911 /// Annotation marks to output
912 std::vector
<OUString
> m_rAnnotationMarksStart
;
913 std::vector
<OUString
> m_rAnnotationMarksEnd
;
915 /// Maps of the bookmarks ids
916 std::map
<OUString
, sal_Int32
> m_rOpenedBookmarksIds
;
918 /// Name of the last opened bookmark.
919 OUString m_sLastOpenedBookmark
;
921 /// Set of ids of the saved bookmarks (used only for moveRange, yet)
922 std::unordered_set
<sal_Int32
> m_rSavedBookmarksIds
;
924 /// Maps of the annotation marks ids
925 std::map
<OUString
, sal_Int32
> m_rOpenedAnnotationMarksIds
;
927 /// Name of the last opened annotation mark.
928 OUString m_sLastOpenedAnnotationMark
;
930 /// Set of currently opened permissions
931 std::unordered_set
<OUString
> m_aOpenedPermissions
;
933 /// If there are bookmarks around sequence fields, this map contains the
934 /// names of these bookmarks for each sequence.
935 std::map
<OUString
, std::vector
<OUString
> > m_aSeqBookmarksNames
;
937 /// GrabBag for text effects like glow, shadow, ...
938 std::vector
<css::beans::PropertyValue
> m_aTextEffectsGrabBag
;
940 /// GrabBag for text fill effects
941 std::vector
<css::beans::PropertyValue
> m_aTextFillGrabBag
;
943 /// The current table helper
944 std::unique_ptr
<SwWriteTable
> m_xTableWrt
;
946 FramePrHelper m_aFramePr
;
948 bool m_bParagraphOpened
;
949 bool m_bParagraphFrameOpen
;
950 bool m_bIsFirstParagraph
;
951 bool m_bAlternateContentChoiceOpen
;
952 bool m_bPostponedProcessingFly
;
954 // Remember that a column break has to be opened at the
955 // beginning of the next paragraph
956 DocxColBreakStatus m_nColBreakStatus
;
958 // Remember that a page break has to be opened at the
959 // beginning of the next paragraph
960 bool m_bPostponedPageBreak
;
962 // This paragraph must end with page break
963 bool m_bPageBreakAfter
= false;
965 std::stack
< std::vector
<ww8::Frame
> > m_aFramesOfParagraph
;
966 o3tl::sorted_vector
<const SwFrameFormat
*> m_aFloatingTablesOfParagraph
;
967 sal_Int32 m_nTextFrameLevel
;
969 // close of hyperlink needed
970 bool m_closeHyperlinkInThisRun
;
971 bool m_closeHyperlinkInPreviousRun
;
972 // Count nested HyperLinks
973 std::vector
<sal_Int32
> m_nHyperLinkCount
;
974 sal_Int16 m_nFieldsInHyperlink
;
976 // If the exported numbering rule defines the outlines
977 bool m_bExportingOutline
;
979 struct PostponedGraphic
981 PostponedGraphic( const SwGrfNode
* n
, Size s
, const SdrObject
* sObj
)
982 : grfNode( n
), size( s
), pSdrObj(sObj
) {};
984 const SwGrfNode
* grfNode
;
986 const SdrObject
* pSdrObj
;
988 std::optional
< std::vector
<PostponedGraphic
> > m_oPostponedGraphic
;
989 struct PostponedDiagram
991 PostponedDiagram( const SdrObject
* o
, const SwFrameFormat
* frm
) : object( o
), frame( frm
) {};
992 const SdrObject
* object
;
993 const SwFrameFormat
* frame
;
995 std::optional
< std::vector
<PostponedDiagram
> > m_oPostponedDiagrams
;
997 struct PostponedDrawing
999 PostponedDrawing( const SdrObject
* sdrObj
, const SwFrameFormat
* frm
) : object( sdrObj
), frame( frm
) {};
1000 const SdrObject
* object
;
1001 const SwFrameFormat
* frame
;
1003 std::optional
< std::vector
<PostponedDrawing
> > m_oPostponedDMLDrawings
;
1004 std::optional
< std::vector
<PostponedDrawing
> > m_oPostponedCustomShape
;
1008 PostponedOLE( SwOLENode
* rObject
, const Size
& rSize
, const SwFlyFrameFormat
* rFrame
) : object( rObject
), size( rSize
), frame( rFrame
) {};
1011 const SwFlyFrameFormat
* frame
;
1013 std::optional
< std::vector
<PostponedOLE
> > m_oPostponedOLEs
;
1015 struct PostponedMathObjects
1017 SwOLENode
* pMathObject
;
1018 sal_Int8 nMathObjAlignment
;
1020 std::vector
<PostponedMathObjects
> m_aPostponedMaths
;
1021 /// count charts consistently for unit tests
1022 unsigned int m_nChartCount
;
1023 struct PostponedChart
1025 PostponedChart( const SdrObject
* sdrObject
, const Size
& rSize
, const SwFlyFrameFormat
* rFrame
) : object(sdrObject
), size(rSize
), frame(rFrame
) {};
1026 const SdrObject
* object
;
1028 const SwFlyFrameFormat
* frame
;
1030 std::vector
<PostponedChart
> m_aPostponedCharts
;
1031 std::vector
<const SdrObject
*> m_aPostponedFormControls
;
1032 std::vector
<PostponedDrawing
> m_aPostponedActiveXControls
;
1033 const SwField
* m_PendingPlaceholder
;
1035 /// Used to store the parent status of a PostIt (parent/child/neither)
1036 enum class ParentStatus
1042 struct PostItDOCXData
{
1044 sal_Int32 lastParaId
= 0; // [MS-DOCX] 2.5.3.1 CT_CommentEx needs paraId attribute
1045 ParentStatus parentStatus
= ParentStatus::None
;
1046 size_t parentIndex
= 0;
1048 /// Maps postit fields to ID's, used in commentRangeStart/End, commentReference and comment.xml.
1049 std::vector
<std::pair
<const SwPostItField
*, PostItDOCXData
>> m_postitFields
;
1050 /// Number of postit fields which already have a commentReference written.
1051 unsigned int m_postitFieldsMaxId
;
1054 struct EmbeddedFontRef
1060 TableReference m_tableReference
;
1062 std::map
< OUString
, EmbeddedFontRef
> m_FontFilesMap
; // font file url to data
1064 // Remember first cell (used for default borders/margins) of each table
1065 std::vector
<ww8::WW8TableNodeInfoInner::Pointer_t
> m_TableFirstCells
;
1066 // Remember last open and closed cells on each level
1067 std::vector
<sal_Int32
> m_LastOpenCell
;
1068 std::vector
<sal_Int32
> m_LastClosedCell
;
1070 std::optional
<css::drawing::FillStyle
> m_oFillStyle
;
1071 /// If FormatBox() already handled fill style / gradient.
1072 bool m_bIgnoreNextFill
;
1074 editeng::WordPageMargins m_pageMargins
;
1076 std::shared_ptr
<DocxTableStyleExport
> m_pTableStyleExport
;
1077 // flag to check if auto spacing was set in original file
1078 bool m_bParaBeforeAutoSpacing
,m_bParaAfterAutoSpacing
;
1079 // store hardcoded value which was set during import.
1080 sal_Int32 m_nParaBeforeSpacing
,m_nParaAfterSpacing
;
1081 // flag inline heading
1082 bool m_bParaInlineHeading
;
1084 SdtBlockHelper m_aParagraphSdt
;
1085 SdtBlockHelper m_aRunSdt
;
1087 /// State of the Fly at current position
1088 FlyProcessingState m_nStateOfFlyFrame
;
1090 /// Same as m_aParagraphSdtPrAlias, but its content is available till the SDT is closed.
1091 OUString m_aStartedParagraphSdtPrAlias
;
1093 std::vector
<std::map
<SvxBoxItemLine
, css::table::BorderLine2
>> m_aTableStyleConfs
;
1095 std::optional
<SwLineBreakClear
> m_oLineBreakClear
;
1098 DocxAttributeOutput( DocxExport
&rExport
, const ::sax_fastparser::FSHelperPtr
& pSerializer
, oox::drawingml::DrawingML
* pDrawingML
);
1100 virtual ~DocxAttributeOutput() override
;
1102 /// Return the right export class.
1103 virtual DocxExport
& GetExport() override
;
1104 const DocxExport
& GetExport() const { return const_cast< DocxAttributeOutput
* >( this )->GetExport(); }
1106 /// For e.g. the output of the styles, we need to switch the serializer to another one.
1107 void SetSerializer( ::sax_fastparser::FSHelperPtr
const & pSerializer
);
1109 /// Occasionally need to use this serializer from the outside
1110 const ::sax_fastparser::FSHelperPtr
& GetSerializer( ) const { return m_pSerializer
; }
1112 /// Do we have any footnotes?
1113 bool HasFootnotes() const;
1115 /// Do we have any endnotes?
1116 bool HasEndnotes() const;
1118 /// Output the content of the footnotes.xml resp. endnotes.xml
1119 void FootnotesEndnotes( bool bFootnotes
);
1121 /// writes the footnotePr/endnotePr (depending on tag) section
1122 void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr
const & fs
, int tag
, const SwEndNoteInfo
& info
, int listtag
);
1124 bool HasPostitFields() const;
1125 enum class hasProperties
{ no
, yes
};
1126 hasProperties
WritePostitFields();
1127 void WritePostItFieldsResolved();
1130 virtual void WriteOutliner(const OutlinerParaObject
& rParaObj
) override
;
1131 virtual void WriteVMLTextBox(css::uno::Reference
<css::drawing::XShape
> xShape
) override
;
1133 virtual void WriteTextBox(css::uno::Reference
<css::drawing::XShape
> xShape
) override
;
1134 virtual css::uno::Reference
<css::text::XTextFrame
> GetUnoTextFrame(
1135 css::uno::Reference
<css::drawing::XShape
> xShape
) override
;
1136 virtual oox::drawingml::DrawingML
& GetDrawingML() override
;
1137 virtual bool MaybeOutputBrushItem(SfxItemSet
const&) override
;
1139 void BulletDefinition(int nId
, const Graphic
& rGraphic
, Size aSize
) override
;
1141 void SetWritingHeaderFooter( bool bWritingHeaderFooter
) { m_bWritingHeaderFooter
= bWritingHeaderFooter
; }
1142 bool GetWritingHeaderFooter( ) const { return m_bWritingHeaderFooter
; }
1143 void SetAlternateContentChoiceOpen( bool bAltContentChoiceOpen
) { m_bAlternateContentChoiceOpen
= bAltContentChoiceOpen
; }
1144 bool IsAlternateContentChoiceOpen( ) const { return m_bAlternateContentChoiceOpen
; }
1145 void GetSdtEndBefore(const SdrObject
* pSdrObj
);
1146 bool IsFirstParagraph() const { return m_bIsFirstParagraph
; }
1148 /// Stores the table export state to the passed context and resets own state.
1149 void pushToTableExportContext(DocxTableExportContext
& rContext
);
1150 /// Restores from the remembered state.
1151 void popFromTableExportContext(DocxTableExportContext
const & rContext
);
1153 static OString
convertToOOXMLHoriOrient(sal_Int16 nOrient
, bool bIsPosToggle
);
1154 static OString
convertToOOXMLVertOrient(sal_Int16 nOrient
);
1155 static OString
convertToOOXMLVertOrientRel(sal_Int16 nOrientRel
);
1156 static OString
convertToOOXMLHoriOrientRel(sal_Int16 nOrientRel
);
1157 static void ImplCellMargins( sax_fastparser::FSHelperPtr
const & pSerializer
, const SvxBoxItem
& rBox
, sal_Int32 tag
, bool bUseStartEnd
, const SvxBoxItem
* pDefaultMargins
= nullptr);
1158 template <class... Args
>
1159 static void AddToAttrList(rtl::Reference
<sax_fastparser::FastAttributeList
>& pAttrList
, Args
&&... args
)
1162 pAttrList
= sax_fastparser::FastSerializerHelper::createAttrList();
1163 pAttrList
->add(std::forward
<Args
>(args
)...);
1166 static const sal_Int32 Tag_StartParagraph_1
= 1;
1167 static const sal_Int32 Tag_StartParagraph_2
= 2;
1168 static const sal_Int32 Tag_WriteSdtBlock
= 3;
1169 static const sal_Int32 Tag_StartParagraphProperties
= 4;
1170 static const sal_Int32 Tag_InitCollectedParagraphProperties
= 5;
1171 static const sal_Int32 Tag_StartRun_1
= 6;
1172 static const sal_Int32 Tag_StartRun_2
= 7;
1173 static const sal_Int32 Tag_StartRun_3
= 8;
1174 static const sal_Int32 Tag_EndRun_1
= 9;
1175 static const sal_Int32 Tag_EndRun_2
= 10;
1176 static const sal_Int32 Tag_StartRunProperties
= 11;
1177 static const sal_Int32 Tag_InitCollectedRunProperties
= 12;
1178 static const sal_Int32 Tag_Redline_1
= 13;
1179 static const sal_Int32 Tag_Redline_2
= 14;
1180 static const sal_Int32 Tag_TableDefinition
= 15;
1181 static const sal_Int32 Tag_OutputFlyFrame
= 16;
1182 static const sal_Int32 Tag_StartSection
= 17;
1186 * All the information that should be stashed away when we're in the middle of
1187 * of a table export and still have to do something else, e.g. export a shape.
1189 struct DocxTableExportContext
1191 DocxAttributeOutput
& m_rOutput
;
1192 ww8::WW8TableInfo::Pointer_t m_pTableInfo
;
1193 bool m_bTableCellOpen
;
1194 bool m_bStartedParaSdt
;
1195 bool m_bStartedRunSdt
;
1196 sal_uInt32 m_nTableDepth
;
1197 sal_Int32 m_nHyperLinkCount
= 0;
1198 DocxTableExportContext(DocxAttributeOutput
& rOutput
) : m_rOutput(rOutput
) { m_rOutput
.pushToTableExportContext(*this); }
1199 ~DocxTableExportContext() { m_rOutput
.popFromTableExportContext(*this); }
1204 rtl::Reference
<sax_fastparser::FastAttributeList
> SurroundToVMLWrap(SwFormatSurround
const& rSurround
);
1208 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_DOCXATTRIBUTEOUTPUT_HXX
1210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */