1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_RTFATTRIBUTEOUTPUT_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_WW8_RTFATTRIBUTEOUTPUT_HXX
22 
23 #include <memory>
24 #include <com/sun/star/drawing/FillStyle.hpp>
25 
26 #include "attributeoutputbase.hxx"
27 #include "rtfstringbuffer.hxx"
28 
29 #include <wrtswtbl.hxx>
30 
31 #include <rtl/strbuf.hxx>
32 
33 #include <optional>
34 
35 class SwGrfNode;
36 class SwOLENode;
37 class SwFlyFrameFormat;
38 class RtfExport;
39 
40 /// The class that has handlers for various resource types when exporting as RTF
41 class RtfAttributeOutput : public AttributeOutputBase
42 {
43     friend class RtfStringBufferValue;
44     friend class SaveRunState;
45 
46 public:
47     /// Export the state of RTL/CJK.
48     void RTLAndCJKState(bool bIsRTL, sal_uInt16 nScript) override;
49 
50     /// Start of the paragraph.
51     sal_Int32 StartParagraph(ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo,
52                              bool bGenerateParaId) override;
53 
54     /// End of the paragraph.
55     void EndParagraph(ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner) override;
56 
57     /// Empty paragraph.
58     void EmptyParagraph() override;
59 
60     /// Called in order to output section breaks.
61     void SectionBreaks(const SwNode& rNode) override;
62 
63     /// Called before we start outputting the attributes.
64     void StartParagraphProperties() override;
65 
66     /// Called after we end outputting the attributes.
67     void EndParagraphProperties(const SfxItemSet& rParagraphMarkerProperties,
68                                 const SwRedlineData* pRedlineData,
69                                 const SwRedlineData* pRedlineParagraphMarkerDeleted,
70                                 const SwRedlineData* pRedlineParagraphMarkerInserted) override;
71 
72     /// Start of the text run.
73     void StartRun(const SwRedlineData* pRedlineData, sal_Int32 nPos,
74                   bool bSingleEmptyRun = false) override;
75 
76     /// End of the text run.
77     void EndRun(const SwTextNode* pNode, sal_Int32 nPos, bool bLastRun = false) override;
78 
79     /// Called before we start outputting the attributes.
80     void StartRunProperties() override;
81 
82     /// Called after we end outputting the attributes.
83     void EndRunProperties(const SwRedlineData* pRedlineData) override;
84 
85     /// Output text (inside a run).
86     void RunText(const OUString& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8) override;
87 
88     // Access to (anyway) private buffers, used by the sdr exporter
89     OStringBuffer& RunText();
90     OString MoveCharacterProperties(bool aAutoWriteRtlLtr = false);
91 
92     /// Output text (without markup).
93     void RawText(const OUString& rText, rtl_TextEncoding eCharSet) override;
94 
95     /// Output ruby start.
96     void StartRuby(const SwTextNode& rNode, sal_Int32 nPos, const SwFormatRuby& rRuby) override;
97 
98     /// Output ruby end.
99     void EndRuby(const SwTextNode& rNode, sal_Int32 nPos) override;
100 
101     /// Output URL start.
102     bool StartURL(const OUString& rUrl, const OUString& rTarget) override;
103 
104     /// Output URL end.
105     bool EndURL(bool isAtEndOfParagraph) override;
106 
107     void FieldVanish(const OUString& rText, ww::eField eType, OUString const*) override;
108 
109     /// Output redlining.
110     ///
111     /// The common attribute that can be among the run properties.
112     void Redline(const SwRedlineData* pRedline) override;
113 
114     void FormatDrop(const SwTextNode& rNode, const SwFormatDrop& rSwFormatDrop, sal_uInt16 nStyle,
115                     ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo,
116                     ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner) override;
117 
118     /// Output style.
119     void ParagraphStyle(sal_uInt16 nStyle) override;
120 
121     void TableInfoCell(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
122     void TableInfoRow(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
123     void TableDefinition(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
124     void
125     TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
126     void TableBackgrounds(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
127     void TableRowRedline(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
128     void TableCellRedline(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
129     void TableHeight(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
130     void TableCanSplit(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
131     void TableBidi(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
132     void TableVerticalCell(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
133     void TableNodeInfoInner(ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner) override;
134     void TableOrientation(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
135     void TableSpacing(ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner) override;
136     void TableRowEnd(sal_uInt32 nDepth) override;
137 
138     /// Start of the styles table.
139     void StartStyles() override;
140 
141     /// End of the styles table.
142     void EndStyles(sal_uInt16 nNumberOfStyles) override;
143 
144     /// Write default style.
145     void DefaultStyle() override;
146 
147     /// Start of a style in the styles table.
148     void StartStyle(const OUString& rName, StyleType eType, sal_uInt16 nBase, sal_uInt16 nNext,
149                     sal_uInt16 nWwId, sal_uInt16 nId, bool bAutoUpdate) override;
150 
151     /// End of a style in the styles table.
152     void EndStyle() override;
153 
154     /// Start of (paragraph or run) properties of a style.
155     void StartStyleProperties(bool bParProp, sal_uInt16 nStyle) override;
156 
157     /// End of (paragraph or run) properties of a style.
158     void EndStyleProperties(bool bParProp) override;
159 
160     /// Numbering rule and Id.
161     void OutlineNumbering(sal_uInt8 nLvl) override;
162 
163     /// Page break
164     /// As a paragraph property - the paragraph should be on the next page.
165     void PageBreakBefore(bool bBreak) override;
166 
167     /// Write a section break
168     /// msword::ColumnBreak or msword::PageBreak
169     void SectionBreak(sal_uInt8 nC, bool bBreakAfter, const WW8_SepInfo* pSectionInfo = nullptr,
170                       bool bExtraPageBreak = false) override;
171 
172     /// Start of the section properties.
173     void StartSection() override;
174 
175     /// End of the section properties.
176     void EndSection() override;
177 
178     /// Protection of forms.
179     void SectionFormProtection(bool bProtected) override;
180 
181     /// Numbering of the lines in the document.
182     void SectionLineNumbering(sal_uLong nRestartNo, const SwLineNumberInfo& rLnNumInfo) override;
183 
184     /// Has different headers/footers for the title page.
185     void SectionTitlePage() override;
186 
187     /// Description of the page borders.
188     void SectionPageBorders(const SwFrameFormat* pFormat,
189                             const SwFrameFormat* pFirstPageFormat) override;
190 
191     /// Columns populated from right/numbers on the right side?
192     void SectionBiDi(bool bBiDi) override;
193 
194     /// The style of the page numbers.
195     ///
196     void SectionPageNumbering(sal_uInt16 nNumType,
197                               const ::std::optional<sal_uInt16>& oPageRestartNumber) override;
198 
199     /// The type of breaking.
200     void SectionType(sal_uInt8 nBreakCode) override;
201 
202     void SectFootnoteEndnotePr() override;
203 
204     void WriteFootnoteEndnotePr(bool bFootnote, const SwEndNoteInfo& rInfo);
205 
206     /// Definition of a numbering instance.
207     void NumberingDefinition(sal_uInt16 nId, const SwNumRule& rRule) override;
208 
209     /// Start of the abstract numbering definition instance.
210     void StartAbstractNumbering(sal_uInt16 nId) override;
211 
212     /// End of the abstract numbering definition instance.
213     void EndAbstractNumbering() override;
214 
215     /// All the numbering level information.
216     void
217     NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart, sal_uInt16 nNumberingType,
218                    SvxAdjust eAdjust, const sal_uInt8* pNumLvlPos, sal_uInt8 nFollow,
219                    const wwFont* pFont, const SfxItemSet* pOutSet, sal_Int16 nIndentAt,
220                    sal_Int16 nFirstLineIndex, sal_Int16 nListTabPos,
221                    const OUString& rNumberingString,
222                    const SvxBrushItem* pBrush) override; //For i120928,to export graphic of bullet
223 
224     void WriteField_Impl(const SwField* pField, ww::eField eType, const OUString& rFieldCmd,
225                          FieldFlags nMode);
226     void WriteBookmarks_Impl(std::vector<OUString>& rStarts, std::vector<OUString>& rEnds);
227     void WriteAnnotationMarks_Impl(std::vector<OUString>& rStarts, std::vector<OUString>& rEnds);
228     void WriteHeaderFooter_Impl(const SwFrameFormat& rFormat, bool bHeader, const char* pStr,
229                                 bool bTitlepg);
WriteBookmarkInActParagraph(const OUString &,sal_Int32,sal_Int32)230     void WriteBookmarkInActParagraph(const OUString& /*rName*/, sal_Int32 /*nFirstRunPos*/,
231                                      sal_Int32 /*nLastRunPos*/) override{};
232 
233 protected:
234     /// Output frames - the implementation.
235     void OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Point& rNdTopLeft) override;
236 
237     /// Sfx item Sfx item RES_CHRATR_CASEMAP
238     void CharCaseMap(const SvxCaseMapItem& rCaseMap) override;
239 
240     /// Sfx item Sfx item RES_CHRATR_COLOR
241     void CharColor(const SvxColorItem& rColor) override;
242 
243     /// Sfx item Sfx item RES_CHRATR_CONTOUR
244     void CharContour(const SvxContourItem& rContour) override;
245 
246     /// Sfx item RES_CHRATR_CROSSEDOUT
247     void CharCrossedOut(const SvxCrossedOutItem& rCrossedOut) override;
248 
249     /// Sfx item RES_CHRATR_ESCAPEMENT
250     void CharEscapement(const SvxEscapementItem& rEscapement) override;
251 
252     /// Sfx item RES_CHRATR_FONT
253     void CharFont(const SvxFontItem& rFont) override;
254 
255     /// Sfx item RES_CHRATR_FONTSIZE
256     void CharFontSize(const SvxFontHeightItem& rFontSize) override;
257 
258     /// Sfx item RES_CHRATR_KERNING
259     void CharKerning(const SvxKerningItem& rKerning) override;
260 
261     /// Sfx item RES_CHRATR_LANGUAGE
262     void CharLanguage(const SvxLanguageItem& rLanguage) override;
263 
264     /// Sfx item RES_CHRATR_POSTURE
265     void CharPosture(const SvxPostureItem& rPosture) override;
266 
267     /// Sfx item RES_CHRATR_SHADOWED
268     void CharShadow(const SvxShadowedItem& rShadow) override;
269 
270     /// Sfx item RES_CHRATR_UNDERLINE
271     void CharUnderline(const SvxUnderlineItem& rUnderline) override;
272 
273     /// Sfx item RES_CHRATR_WEIGHT
274     void CharWeight(const SvxWeightItem& rWeight) override;
275 
276     /// Sfx item RES_CHRATR_AUTOKERN
277     void CharAutoKern(const SvxAutoKernItem& rAutoKern) override;
278 
279     /// Sfx item RES_CHRATR_BLINK
280     void CharAnimatedText(const SvxBlinkItem& rBlink) override;
281 
282     /// Sfx item RES_CHRATR_BACKGROUND
283     void CharBackground(const SvxBrushItem& rBrush) override;
284 
285     /// Sfx item RES_CHRATR_CJK_FONT
286     void CharFontCJK(const SvxFontItem& rFont) override;
287 
288     /// Sfx item RES_CHRATR_CJK_FONTSIZE
289     void CharFontSizeCJK(const SvxFontHeightItem& rFontSize) override;
290 
291     /// Sfx item RES_CHRATR_CJK_LANGUAGE
292     void CharLanguageCJK(const SvxLanguageItem& rLanguageItem) override;
293 
294     /// Sfx item RES_CHRATR_CJK_POSTURE
295     void CharPostureCJK(const SvxPostureItem& rPosture) override;
296 
297     /// Sfx item RES_CHRATR_CJK_WEIGHT
298     void CharWeightCJK(const SvxWeightItem& rWeight) override;
299 
300     /// Sfx item RES_CHRATR_CTL_FONT
301     void CharFontCTL(const SvxFontItem& rFont) override;
302 
303     /// Sfx item RES_CHRATR_CTL_FONTSIZE
304     void CharFontSizeCTL(const SvxFontHeightItem& rFontSize) override;
305 
306     /// Sfx item RES_CHRATR_CTL_LANGUAGE
307     void CharLanguageCTL(const SvxLanguageItem& rLanguageItem) override;
308 
309     /// Sfx item RES_CHRATR_CTL_POSTURE
310     void CharPostureCTL(const SvxPostureItem& rPosture) override;
311 
312     /// Sfx item RES_CHRATR_CTL_WEIGHT
313     void CharWeightCTL(const SvxWeightItem& rWeight) override;
314 
315     /// Sfx item RES_CHRATR_BidiRTL
316     void CharBidiRTL(const SfxPoolItem& rItem) override;
317 
318     /// Sfx item RES_CHRATR_IdctHint
319     void CharIdctHint(const SfxPoolItem& rItem) override;
320 
321     /// Sfx item RES_CHRATR_ROTATE
322     void CharRotate(const SvxCharRotateItem& rRotate) override;
323 
324     /// Sfx item RES_CHRATR_EMPHASIS_MARK
325     void CharEmphasisMark(const SvxEmphasisMarkItem& rEmphasisMark) override;
326 
327     /// Sfx item RES_CHRATR_TWO_LINES
328     void CharTwoLines(const SvxTwoLinesItem& rTwoLines) override;
329 
330     /// Sfx item RES_CHRATR_SCALEW
331     void CharScaleWidth(const SvxCharScaleWidthItem& rScaleWidth) override;
332 
333     /// Sfx item RES_CHRATR_RELIEF
334     void CharRelief(const SvxCharReliefItem& rRelief) override;
335 
336     /// Sfx item RES_CHRATR_HIDDEN
337     void CharHidden(const SvxCharHiddenItem& rHidden) override;
338 
339     /// Sfx item RES_CHRATR_BOX
340     void CharBorder(const ::editeng::SvxBorderLine* pAllBorder, sal_uInt16 nDist,
341                     bool bShadow) override;
342 
343     /// Sfx item RES_CHRATR_HIGHLIGHT
344     void CharHighlight(const SvxBrushItem& rBrush) override;
345 
346     /// Sfx item RES_TXTATR_INETFMT
347     void TextINetFormat(const SwFormatINetFormat& rURL) override;
348 
349     /// Sfx item RES_TXTATR_CHARFMT
350     void TextCharFormat(const SwFormatCharFormat& rCharFormat) override;
351 
352     /// Sfx item RES_TXTATR_FTN
353     void TextFootnote_Impl(const SwFormatFootnote& rFootnote) override;
354 
355     /// Sfx item RES_PARATR_LINESPACING
356     void ParaLineSpacing_Impl(short nSpace, short nMulti) override;
357 
358     /// Sfx item RES_PARATR_ADJUST
359     void ParaAdjust(const SvxAdjustItem& rAdjust) override;
360 
361     /// Sfx item RES_PARATR_SPLIT
362     void ParaSplit(const SvxFormatSplitItem& rSplit) override;
363 
364     /// Sfx item RES_PARATR_WIDOWS
365     void ParaWidows(const SvxWidowsItem& rWidows) override;
366 
367     /// Sfx item RES_PARATR_TABSTOP
368     void ParaTabStop(const SvxTabStopItem& rTabStop) override;
369 
370     /// Sfx item RES_PARATR_HYPHENZONE
371     void ParaHyphenZone(const SvxHyphenZoneItem& rHyphenZone) override;
372 
373     /// Sfx item RES_PARATR_NUMRULE
374     void ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 nLvl, sal_Int32 nNumId) override;
375 
376     /// Sfx item RES_PARATR_SCRIPTSPACE
377     void ParaScriptSpace(const SfxBoolItem& rScriptSpace) override;
378 
379     /// Sfx item RES_PARATR_HANGINGPUNCTUATION
380     void ParaHangingPunctuation(const SfxBoolItem& rItem) override;
381 
382     /// Sfx item RES_PARATR_FORBIDDEN_RULES
383     void ParaForbiddenRules(const SfxBoolItem& rItem) override;
384 
385     /// Sfx item RES_PARATR_VERTALIGN
386     void ParaVerticalAlign(const SvxParaVertAlignItem& rAlign) override;
387 
388     /// Sfx item RES_PARATR_SNAPTOGRID
389     void ParaSnapToGrid(const SvxParaGridItem& rItem) override;
390 
391     /// Sfx item RES_FRM_SIZE
392     void FormatFrameSize(const SwFormatFrameSize& rSize) override;
393 
394     /// Sfx item RES_PAPER_BIN
395     void FormatPaperBin(const SvxPaperBinItem& rItem) override;
396 
397     /// Sfx item RES_LR_SPACE
398     void FormatLRSpace(const SvxLRSpaceItem& rLRSpace) override;
399 
400     /// Sfx item RES_UL_SPACE
401     void FormatULSpace(const SvxULSpaceItem& rULSpace) override;
402 
403     /// Sfx item RES_SURROUND
404     void FormatSurround(const SwFormatSurround& rSurround) override;
405 
406     /// Sfx item RES_VERT_ORIENT
407     void FormatVertOrientation(const SwFormatVertOrient& rFlyVert) override;
408 
409     /// Sfx item RES_HORI_ORIENT
410     void FormatHorizOrientation(const SwFormatHoriOrient& rFlyHori) override;
411 
412     /// Sfx item RES_ANCHOR
413     void FormatAnchor(const SwFormatAnchor& rAnchor) override;
414 
415     /// Sfx item RES_BACKGROUND
416     void FormatBackground(const SvxBrushItem& rBrush) override;
417 
418     /// Sfx item RES_FILL_STYLE
419     void FormatFillStyle(const XFillStyleItem& rFillStyle) override;
420 
421     /// Sfx item RES_FILL_GRADIENT
422     void FormatFillGradient(const XFillGradientItem& rFillGradient) override;
423 
424     /// Sfx item RES_BOX
425     void FormatBox(const SvxBoxItem& rBox) override;
426 
427     /// Sfx item RES_COL
428     void FormatColumns_Impl(sal_uInt16 nCols, const SwFormatCol& rCol, bool bEven,
429                             SwTwips nPageSize) override;
430 
431     /// Sfx item RES_KEEP
432     void FormatKeep(const SvxFormatKeepItem& rItem) override;
433 
434     /// Sfx item RES_TEXTGRID
435     void FormatTextGrid(const SwTextGridItem& rItem) override;
436 
437     /// Sfx item RES_LINENUMBER
438     void FormatLineNumbering(const SwFormatLineNumber& rNumbering) override;
439 
440     /// Sfx item RES_FRAMEDIR
441     void FormatFrameDirection(const SvxFrameDirectionItem& rDirection) override;
442 
443     /// Sfx item RES_PARATR_GRABBAG
444     void ParaGrabBag(const SfxGrabBagItem& rItem) override;
445 
446     /// Sfx item RES_CHRATR_GRABBAG
447     void CharGrabBag(const SfxGrabBagItem& rItem) override;
448 
449     /// Sfx item RES_PARATR_OUTLINELEVEL
450     void ParaOutlineLevel(const SfxUInt16Item& rItem) override;
451 
452     /// Write the expanded field
453     void WriteExpand(const SwField* pField) override;
454 
455     void RefField(const SwField& rField, const OUString& rRef) override;
456     void HiddenField(const SwField& rField) override;
457     void SetField(const SwField& rField, ww::eField eType, const OUString& rCmd) override;
458     void PostitField(const SwField* pField) override;
459     bool DropdownField(const SwField* pField) override;
460     bool PlaceholderField(const SwField* pField) override;
461 
462     void SectionRtlGutter(const SfxBoolItem& rRtlGutter) override;
463 
464 private:
465     /// Reference to the export, where to get the data from
466     RtfExport& m_rExport;
467 
468     OStringBuffer m_aTabStop;
469 
470     /// Access to the page style of the previous paragraph.
471     const SwPageDesc* m_pPrevPageDesc;
472 
473     /// Output graphic fly frames.
474     void FlyFrameGraphic(const SwFlyFrameFormat* pFlyFrameFormat, const SwGrfNode* pGrfNode);
475     void FlyFrameOLE(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode,
476                      const Size& rSize);
477     void FlyFrameOLEReplacement(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode,
478                                 const Size& rSize);
479     /// Math export.
480     bool FlyFrameOLEMath(const SwFlyFrameFormat* pFlyFrameFormat, SwOLENode& rOLENode,
481                          const Size& rSize);
482 
483     /*
484      * Table methods.
485      */
486     void InitTableHelper(const ww8::WW8TableNodeInfoInner::Pointer_t& pTableTextNodeInfoInner);
487     void StartTable();
488     void StartTableRow(const ww8::WW8TableNodeInfoInner::Pointer_t& pTableTextNodeInfoInner);
489     void StartTableCell();
490     void TableCellProperties(const ww8::WW8TableNodeInfoInner::Pointer_t& pTableTextNodeInfoInner);
491     void EndTableCell();
492     void EndTableRow();
493     void EndTable();
494 
495     /// End cell, row, and even the entire table if necessary.
496     void FinishTableRowCell(const ww8::WW8TableNodeInfoInner::Pointer_t& pInner);
497 
498     void WriteTextFootnoteNumStr(const SwFormatFootnote& rFootnote);
499 
500     /*
501      * Current style name and its ID.
502      */
503     OUString m_rStyleName;
504     sal_uInt16 m_nStyleId;
505     /*
506      * Current list ID.
507      */
508     sal_uInt16 m_nListId;
509     /*
510      * This is needed because the call order is: run text, run properties, paragraph properties.
511      * What we need is the opposite.
512      */
513     RtfStringBuffer m_aRun;
514     RtfStringBuffer m_aRunText;
515     /*
516      * This is written after runs.
517      */
518     OStringBuffer m_aAfterRuns;
519     /*
520      * Same for colors and stylesheets: first we just want to output colors,
521      * need to buffer the stylesheet table to output it after the color one.
522      */
523     OStringBuffer m_aStylesheet;
524     /*
525      * This one just holds the style commands in the current style.
526      */
527     OStringBuffer m_aStyles;
528     /*
529      * This is the same as m_aStyles but the contents of it is Assoc.
530      */
531     OStringBuffer m_aStylesAssocHich;
532     OStringBuffer m_aStylesAssocDbch;
533     OStringBuffer m_aStylesAssocRtlch;
534     OStringBuffer m_aStylesAssocLtrch;
535 
536     bool m_bIsRTL;
537     sal_uInt16 m_nScript;
538     bool m_bControlLtrRtl;
539 
540     sal_Int32 m_nNextAnnotationMarkId;
541     sal_Int32 m_nCurrentAnnotationMarkId;
542     /// Maps annotation mark names to ID's.
543     std::map<OString, sal_Int32> m_rOpenedAnnotationMarksIds;
544 
545     /*
546      * The current table helper.
547      */
548     std::unique_ptr<SwWriteTable> m_pTableWrt;
549 
550     /*
551      * Remember if we are in an open cell, or not.
552      */
553     bool m_bTableCellOpen;
554 
555     /*
556      * Remember the current table depth.
557      */
558     sal_uInt32 m_nTableDepth;
559 
560     /*
561      * Remember if we wrote a \cell or not.
562      */
563     bool m_bTableAfterCell;
564 
565     /*
566      * For late output of row definitions.
567      */
568     OStringBuffer m_aRowDefs;
569 
570     /*
571      * Is a column break needed after the next \par?
572      */
573     bool m_nColBreakNeeded;
574 
575     /*
576      * If section breaks should be buffered to m_aSectionBreaks
577      */
578     bool m_bBufferSectionBreaks;
579     OStringBuffer m_aSectionBreaks;
580 
581     /*
582      * If section headers (and footers) should be buffered to
583      * m_aSectionHeaders.
584      */
585     bool m_bBufferSectionHeaders;
586     OStringBuffer m_aSectionHeaders;
587 
588     /*
589      * Support for starting multiple tables at the same cell.
590      * If the current table is the last started one.
591      */
592     bool m_bLastTable;
593     /*
594      * List of already started but not yet defined tables (need to be defined
595      * after the nested tables).
596      */
597     std::vector<OString> m_aTables;
598     /*
599      * If cell info is already output.
600      */
601     bool m_bWroteCellInfo;
602 
603     /// If we ended a table row without starting a new one.
604     bool m_bTableRowEnded;
605 
606     /// Number of cells from the table definition, by depth.
607     std::map<sal_uInt32, sal_uInt32> m_aCells;
608 
609     bool m_bIsBeforeFirstParagraph;
610 
611     /// If we're in a paragraph that has a single empty run only.
612     bool m_bSingleEmptyRun;
613 
614     bool m_bInRun;
615 
616     bool m_bInRuby;
617 
618     /// Maps ID's to postit fields, used in atrfstart/end and atnref.
619     std::map<sal_uInt16, const SwPostItField*> m_aPostitFields;
620 
621     /// When exporting fly frames, this holds the real size of the frame.
622     const Size* m_pFlyFrameSize;
623 
624     std::vector<std::pair<OString, OString>> m_aFlyProperties;
625 
626     std::optional<css::drawing::FillStyle> m_oFillStyle;
627 
628     /// If we're in the process of exporting a hyperlink, then its URL.
629     std::stack<OUString> m_aURLs;
630 
631     /// If original file had \sbauto.
632     bool m_bParaBeforeAutoSpacing;
633     /// If m_bParaBeforeAutoSpacing is set, value of \sb.
634     sal_Int32 m_nParaBeforeSpacing;
635     /// If original file had \saauto.
636     bool m_bParaAfterAutoSpacing;
637     /// If m_bParaBeforeAutoSpacing is set, value of \sa.
638     sal_Int32 m_nParaAfterSpacing;
639 
640 public:
641     explicit RtfAttributeOutput(RtfExport& rExport);
642 
643     ~RtfAttributeOutput() override;
644 
645     /// Return the right export class.
646     MSWordExportBase& GetExport() override;
647 
648     // These are used by wwFont::WriteRtf()
649     /// Start the font.
650     void StartFont(const OUString& rFamilyName) const;
651 
652     /// End the font.
653     void EndFont() const;
654 
655     /// Alternate name for the font.
656     void FontAlternateName(const OUString& rName) const;
657 
658     /// Font charset.
659     void FontCharset(sal_uInt8 nCharSet) const;
660 
661     /// Font family.
662     void FontFamilyType(FontFamily eFamily, const wwFont& rFont) const;
663 
664     /// Font pitch.
665     void FontPitchType(FontPitch ePitch) const;
666 
667     void BulletDefinition(int nId, const Graphic& rGraphic, Size aSize) override;
668 
669     /// Handles just the {\shptxt ...} part of a shape export.
670     void writeTextFrame(const ww8::Frame& rFrame, bool bTextBox = false);
671 
GetTabStop()672     OStringBuffer& GetTabStop() { return m_aTabStop; }
673 
GetPrevPageDesc() const674     const SwPageDesc* GetPrevPageDesc() const { return m_pPrevPageDesc; }
675 };
676 
677 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_RTFATTRIBUTEOUTPUT_HXX
678 
679 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
680