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