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