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_WW8ATTRIBUTEOUTPUT_HXX
21 #define INCLUDED_SW_SOURCE_FILTER_WW8_WW8ATTRIBUTEOUTPUT_HXX
23 #include "attributeoutputbase.hxx"
25 #include <editeng/boxitem.hxx>
26 #include <sfx2/docfile.hxx>
28 class WW8AttributeOutput
: public AttributeOutputBase
31 /// Export the state of RTL/CJK.
32 virtual void RTLAndCJKState( bool bIsRTL
, sal_uInt16 nScript
) override
;
34 /// Start of the paragraph.
35 virtual sal_Int32
StartParagraph( ww8::WW8TableNodeInfo::Pointer_t
/*pTextNodeInfo*/, bool /*bGenerateParaId*/ ) override
{ return 0; }
37 /// End of the paragraph.
38 virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner
) override
;
40 /// Called in order to output section breaks.
41 virtual void SectionBreaks(const SwNode
& /*rNode*/) override
{}
43 /// Called before we start outputting the attributes.
44 virtual void StartParagraphProperties() override
{}
46 /// Called after we end outputting the attributes.
47 virtual void EndParagraphProperties(const SfxItemSet
& /*rParagraphMarkerProperties*/, const SwRedlineData
* /*pRedlineData*/, const SwRedlineData
* /*pRedlineParagraphMarkerDeleted*/, const SwRedlineData
* /*pRedlineParagraphMarkerInserted*/) override
{}
50 virtual void EmptyParagraph() override
;
52 /// Start of the text run.
54 virtual void StartRun( const SwRedlineData
* pRedlineData
, sal_Int32 nPos
, bool bSingleEmptyRun
= false ) override
;
56 virtual void OnTOXEnding() override
;
58 /// End of the text run.
60 /// No-op for binary filters.
61 virtual void EndRun(const SwTextNode
* pNode
, sal_Int32 nPos
, sal_Int32 nLen
, bool bLastRun
= false) override
;
63 /// Before we start outputting the attributes.
64 virtual void StartRunProperties() override
;
66 /// After we end outputting the attributes.
67 virtual void EndRunProperties( const SwRedlineData
* pRedlineData
) override
;
70 virtual void RunText( const OUString
& rText
, rtl_TextEncoding eCharSet
= RTL_TEXTENCODING_UTF8
, const OUString
& rSymbolFont
= OUString() ) override
;
72 /// Output text (without markup).
73 virtual void RawText(const OUString
& rText
, rtl_TextEncoding eCharSet
) override
;
75 /// Output ruby start.
76 virtual void StartRuby( const SwTextNode
& rNode
, sal_Int32 nPos
, const SwFormatRuby
& rRuby
) override
;
79 virtual void EndRuby(const SwTextNode
& rNode
, sal_Int32 nPos
) override
;
82 virtual bool StartURL( const OUString
&rUrl
, const OUString
&rTarget
) override
;
85 virtual bool EndURL(bool) override
;
87 virtual void FieldVanish(const OUString
& rText
, ww::eField eType
, OUString
const* pBookmarkName
) override
;
90 virtual void Redline( const SwRedlineData
* pRedline
) override
;
92 virtual void FormatDrop( const SwTextNode
& rNode
, const SwFormatDrop
&rSwFormatDrop
, sal_uInt16 nStyle
, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo
, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner
) override
;
94 /// Output FKP (Formatted disK Page) - necessary for binary formats only.
95 /// FIXME having it in AttributeOutputBase is probably a hack, it
96 /// should be in WW8AttributeOutput only...
97 virtual void OutputFKP(bool bForce
) override
;
100 virtual void ParagraphStyle( sal_uInt16 nStyle
) override
;
102 virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
103 virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
104 virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
105 void TablePositioning(SwFrameFormat
* pFlyFormat
);
106 virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
107 virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
108 virtual void TableRowRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
109 virtual void TableCellRedline( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
110 virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
111 virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
112 virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
113 virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) override
;
114 virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner
) override
;
115 virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner
) override
;
116 virtual void TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner
) override
;
117 virtual void TableRowEnd( sal_uInt32 nDepth
) override
;
119 /// Start of the styles table.
120 virtual void StartStyles() override
;
122 /// End of the styles table.
123 virtual void EndStyles( sal_uInt16 nNumberOfStyles
) override
;
125 /// Write default style.
126 virtual void DefaultStyle() override
;
128 /// Start of a style in the styles table.
129 virtual void StartStyle( const OUString
& rName
, StyleType eType
,
130 sal_uInt16 nBase
, sal_uInt16 nNext
, sal_uInt16 nLink
, sal_uInt16 nWwIdi
, sal_uInt16 nSlot
,
131 bool bAutoUpdate
) override
;
133 /// End of a style in the styles table.
134 virtual void EndStyle() override
;
136 /// Start of (paragraph or run) properties of a style.
137 virtual void StartStyleProperties( bool bParProp
, sal_uInt16 nStyle
) override
;
139 /// End of (paragraph or run) properties of a style.
140 virtual void EndStyleProperties( bool bParProp
) override
;
142 /// Numbering rule and Id.
143 virtual void OutlineNumbering(sal_uInt8 nLvl
) override
;
146 /// As a paragraph property - the paragraph should be on the next page.
147 virtual void PageBreakBefore( bool bBreak
) override
;
149 /// Write a section break
150 /// msword::ColumnBreak or msword::PageBreak
151 virtual void SectionBreak( sal_uInt8 nC
, bool bBreakAfter
, const WW8_SepInfo
* pSectionInfo
= nullptr, bool bExtraPageBreak
= false ) override
;
153 // preserve DOC page vertical alignment
154 virtual void TextVerticalAdjustment( const css::drawing::TextVerticalAdjust
) override
;
156 /// Start of the section properties.
157 virtual void StartSection() override
;
159 // footnote / endnote section properties
160 virtual void SectFootnoteEndnotePr() override
;
162 /// End of the section properties.
164 /// No-op for binary filters.
165 virtual void EndSection() override
{}
167 /// Protection of forms.
168 virtual void SectionFormProtection( bool bProtected
) override
;
170 /// Numbering of the lines in the document.
171 virtual void SectionLineNumbering( sal_uLong nRestartNo
, const SwLineNumberInfo
& rLnNumInfo
) override
;
173 /// Has different headers/footers for the title page.
174 virtual void SectionTitlePage() override
;
176 /// Description of the page borders.
177 virtual void SectionPageBorders( const SwFrameFormat
* pFormat
, const SwFrameFormat
* pFirstPageFormat
) override
;
179 /// Columns populated from right/numbers on the right side?
180 virtual void SectionBiDi( bool bBiDi
) override
;
182 /// The style of the page numbers.
184 virtual void SectionPageNumbering( sal_uInt16 nNumType
, const ::std::optional
<sal_uInt16
>& oPageRestartNumber
) override
;
186 /// The type of breaking.
187 virtual void SectionType( sal_uInt8 nBreakCode
) override
;
189 /// Definition of a numbering instance.
190 virtual void NumberingDefinition( sal_uInt16 nId
, const SwNumRule
&rRule
) override
;
192 /// All the numbering level information.
193 virtual void NumberingLevel( sal_uInt8 nLevel
,
195 sal_uInt16 nNumberingType
,
197 const sal_uInt8
*pNumLvlPos
,
200 const SfxItemSet
*pOutSet
,
202 sal_Int16 nFirstLineIndex
,
203 sal_Int16 nListTabPos
,
204 const OUString
&rNumberingString
,
205 const SvxBrushItem
* pBrush
) override
; //For i120928,transfer graphic of bullet
208 /// Output frames - the implementation.
209 void OutputFlyFrame_Impl( const ww8::Frame
& rFormat
, const Point
& rNdTopLeft
) override
;
211 /// Sfx item Sfx item RES_CHRATR_CASEMAP
212 virtual void CharCaseMap( const SvxCaseMapItem
& ) override
;
214 /// Sfx item Sfx item RES_CHRATR_COLOR
215 virtual void CharColor( const SvxColorItem
& ) override
;
217 /// Sfx item Sfx item RES_CHRATR_CONTOUR
218 virtual void CharContour( const SvxContourItem
& ) override
;
220 /// Sfx item RES_CHRATR_CROSSEDOUT
221 virtual void CharCrossedOut( const SvxCrossedOutItem
& rHt
) override
;
223 /// Sfx item RES_CHRATR_ESCAPEMENT
224 virtual void CharEscapement( const SvxEscapementItem
& ) override
;
226 /// Sfx item RES_CHRATR_FONT
227 virtual void CharFont( const SvxFontItem
& ) override
;
229 /// Sfx item RES_CHRATR_FONTSIZE
230 virtual void CharFontSize( const SvxFontHeightItem
& ) override
;
232 /// Sfx item RES_CHRATR_KERNING
233 virtual void CharKerning( const SvxKerningItem
& ) override
;
235 /// Sfx item RES_CHRATR_LANGUAGE
236 virtual void CharLanguage( const SvxLanguageItem
& ) override
;
238 /// Sfx item RES_CHRATR_POSTURE
239 virtual void CharPosture( const SvxPostureItem
& ) override
;
241 /// Sfx item RES_CHRATR_SHADOWED
242 virtual void CharShadow( const SvxShadowedItem
& ) override
;
244 /// Sfx item RES_CHRATR_UNDERLINE
245 virtual void CharUnderline( const SvxUnderlineItem
& ) override
;
247 /// Sfx item RES_CHRATR_WEIGHT
248 virtual void CharWeight( const SvxWeightItem
& ) override
;
250 /// Sfx item RES_CHRATR_AUTOKERN
251 virtual void CharAutoKern( const SvxAutoKernItem
& ) override
;
253 /// Sfx item RES_CHRATR_BLINK
254 virtual void CharAnimatedText( const SvxBlinkItem
& ) override
;
256 /// Sfx item RES_CHRATR_BACKGROUND
257 virtual void CharBackground( const SvxBrushItem
& ) override
;
259 /// Sfx item RES_CHRATR_CJK_FONT
260 virtual void CharFontCJK( const SvxFontItem
& ) override
;
262 /// Sfx item RES_CHRATR_CJK_FONTSIZE
263 virtual void CharFontSizeCJK( const SvxFontHeightItem
& rHt
) override
{ CharFontSize( rHt
); }
265 /// Sfx item RES_CHRATR_CJK_LANGUAGE
266 virtual void CharLanguageCJK( const SvxLanguageItem
& rHt
) override
{ CharLanguage( rHt
); }
268 /// Sfx item RES_CHRATR_CJK_POSTURE
269 virtual void CharPostureCJK( const SvxPostureItem
& rHt
) override
{ CharPosture( rHt
); }
271 /// Sfx item RES_CHRATR_CJK_WEIGHT
272 virtual void CharWeightCJK( const SvxWeightItem
& rHt
) override
{ CharWeight( rHt
); }
274 /// Sfx item RES_CHRATR_CTL_FONT
275 virtual void CharFontCTL( const SvxFontItem
& ) override
;
277 /// Sfx item RES_CHRATR_CTL_FONTSIZE
278 virtual void CharFontSizeCTL( const SvxFontHeightItem
& rHt
) override
{ CharFontSize( rHt
); }
280 /// Sfx item RES_CHRATR_CTL_LANGUAGE
281 virtual void CharLanguageCTL( const SvxLanguageItem
& rHt
) override
{ CharLanguage( rHt
); }
283 /// Sfx item RES_CHRATR_CTL_POSTURE
284 virtual void CharPostureCTL( const SvxPostureItem
& ) override
;
286 /// Sfx item RES_CHRATR_CTL_WEIGHT
287 virtual void CharWeightCTL( const SvxWeightItem
& ) override
;
289 /// Sfx item RES_CHRATR_BidiRTL
290 virtual void CharBidiRTL( const SfxPoolItem
& rHt
) override
;
292 /// Sfx item RES_CHRATR_IdctHint
293 virtual void CharIdctHint( const SfxPoolItem
& rHt
) override
;
295 /// Sfx item RES_CHRATR_ROTATE
296 virtual void CharRotate( const SvxCharRotateItem
& ) override
;
298 /// Sfx item RES_CHRATR_EMPHASIS_MARK
299 virtual void CharEmphasisMark( const SvxEmphasisMarkItem
& rHt
) override
;
301 /// Sfx item RES_CHRATR_TWO_LINES
302 virtual void CharTwoLines( const SvxTwoLinesItem
& ) override
;
304 /// Sfx item RES_CHRATR_SCALEW
305 virtual void CharScaleWidth( const SvxCharScaleWidthItem
& ) override
;
307 /// Sfx item RES_CHRATR_RELIEF
308 virtual void CharRelief( const SvxCharReliefItem
& ) override
;
310 /// Sfx item RES_CHRATR_HIDDEN
311 virtual void CharHidden( const SvxCharHiddenItem
& ) override
;
313 /// Sfx item RES_CHRATR_BOX
314 virtual void CharBorder( const ::editeng::SvxBorderLine
* pAllBorder
, const sal_uInt16 nDist
, const bool bShadow
) override
;
316 /// Sfx item RES_CHRATR_HIGHLIGHT
317 virtual void CharHighlight( const SvxBrushItem
& ) override
;
319 /// Sfx item RES_TXTATR_INETFMT
320 virtual void TextINetFormat( const SwFormatINetFormat
& ) override
;
322 /// Sfx item RES_TXTATR_CHARFMT
323 virtual void TextCharFormat( const SwFormatCharFormat
& ) override
;
325 /// Sfx item RES_TXTATR_FTN
326 virtual void TextFootnote_Impl( const SwFormatFootnote
& ) override
;
328 /// Sfx item RES_PARATR_LINESPACING
329 virtual void ParaLineSpacing_Impl( short nSpace
, short nMulti
) override
;
331 /// Sfx item RES_PARATR_ADJUST
332 virtual void ParaAdjust( const SvxAdjustItem
& rHt
) override
;
334 /// Sfx item RES_PARATR_SPLIT
335 virtual void ParaSplit( const SvxFormatSplitItem
& ) override
;
337 /// Sfx item RES_PARATR_WIDOWS
338 virtual void ParaWidows( const SvxWidowsItem
& rHt
) override
;
340 /// Sfx item RES_PARATR_TABSTOP
341 virtual void ParaTabStop( const SvxTabStopItem
& rHt
) override
;
343 /// Sfx item RES_PARATR_HYPHENZONE
344 virtual void ParaHyphenZone( const SvxHyphenZoneItem
& ) override
;
346 /// Sfx item RES_PARATR_NUMRULE
347 virtual void ParaNumRule_Impl( const SwTextNode
*pTextNd
, sal_Int32 nLvl
, sal_Int32 nNumId
) override
;
349 /// Sfx item RES_PARATR_SCRIPTSPACE
350 virtual void ParaScriptSpace( const SfxBoolItem
& ) override
;
352 /// Sfx item RES_PARATR_HANGINGPUNCTUATION
353 virtual void ParaHangingPunctuation( const SfxBoolItem
& ) override
;
355 /// Sfx item RES_PARATR_FORBIDDEN_RULES
356 virtual void ParaForbiddenRules( const SfxBoolItem
& ) override
;
358 /// Sfx item RES_PARATR_VERTALIGN
359 virtual void ParaVerticalAlign( const SvxParaVertAlignItem
& ) override
;
361 /// Sfx item RES_PARATR_SNAPTOGRID
362 virtual void ParaSnapToGrid( const SvxParaGridItem
& ) override
;
364 /// Sfx item RES_FRM_SIZE
365 virtual void FormatFrameSize( const SwFormatFrameSize
& ) override
;
367 /// Sfx item RES_PAPER_BIN
368 virtual void FormatPaperBin( const SvxPaperBinItem
& ) override
;
370 /// Sfx item RES_MARGIN_FIRSTLINE
371 virtual void FormatFirstLineIndent(const SvxFirstLineIndentItem
& rFirstLine
) override
;
372 /// Sfx item RES_MARGIN_TEXTLEFT
373 virtual void FormatTextLeftMargin(const SvxTextLeftMarginItem
& rTextLeftMargin
) override
;
374 /// Sfx item RES_MARGIN_RIGHT
375 virtual void FormatRightMargin(const SvxRightMarginItem
& rRightMargin
) override
;
377 /// Sfx item RES_LR_SPACE
378 virtual void FormatLRSpace( const SvxLRSpaceItem
& ) override
;
380 /// Sfx item RES_UL_SPACE
381 virtual void FormatULSpace( const SvxULSpaceItem
& rHt
) override
;
383 /// Sfx item RES_SURROUND
384 virtual void FormatSurround( const SwFormatSurround
& ) override
;
386 /// Sfx item RES_VERT_ORIENT
387 virtual void FormatVertOrientation( const SwFormatVertOrient
& ) override
;
389 /// Sfx item RES_HORI_ORIENT
390 virtual void FormatHorizOrientation( const SwFormatHoriOrient
& ) override
;
392 /// Sfx item RES_ANCHOR
393 virtual void FormatAnchor( const SwFormatAnchor
& ) override
;
395 /// Sfx item RES_BACKGROUND
396 virtual void FormatBackground( const SvxBrushItem
& ) override
;
398 /// Sfx item RES_FILL_STYLE
399 virtual void FormatFillStyle( const XFillStyleItem
& ) override
;
401 /// Sfx item RES_FILL_GRADIENT
402 virtual void FormatFillGradient( const XFillGradientItem
& ) override
;
405 virtual void FormatBox( const SvxBoxItem
& ) override
;
408 virtual void FormatColumns_Impl( sal_uInt16 nCols
, const SwFormatCol
& rCol
, bool bEven
, SwTwips nPageSize
) override
;
410 /// Sfx item RES_KEEP
411 virtual void FormatKeep( const SvxFormatKeepItem
& ) override
;
413 /// Sfx item RES_TEXTGRID
414 virtual void FormatTextGrid( const SwTextGridItem
& ) override
;
416 /// Sfx item RES_LINENUMBER
417 virtual void FormatLineNumbering( const SwFormatLineNumber
& ) override
;
419 /// Sfx item RES_FRAMEDIR
420 virtual void FormatFrameDirection( const SvxFrameDirectionItem
& ) override
;
422 /// Sfx item RES_PARATR_GRABBAG
423 virtual void ParaGrabBag( const SfxGrabBagItem
& ) override
;
425 /// Sfx item RES_TXTATR_GRABBAG
426 virtual void CharGrabBag( const SfxGrabBagItem
& ) override
;
428 // Sfx item RES_PARATR_OUTLINELEVEL
429 virtual void ParaOutlineLevel( const SfxUInt16Item
& ) override
;
431 /// Write the expanded field
432 virtual void WriteExpand( const SwField
* pField
) override
;
434 virtual void RefField ( const SwField
& rField
, const OUString
& rRef
) override
;
435 virtual void HiddenField( const SwField
& rField
) override
;
436 virtual void SetField( const SwField
& rField
, ww::eField eType
, const OUString
& rCmd
) override
;
437 virtual void PostitField( const SwField
* pField
) override
;
438 virtual bool DropdownField( const SwField
* pField
) override
;
439 virtual bool PlaceholderField( const SwField
* pField
) override
;
441 virtual bool AnalyzeURL( const OUString
& rURL
, const OUString
& rTarget
, OUString
* pLinkURL
, OUString
* pMark
) override
;
443 virtual void WriteBookmarkInActParagraph( const OUString
& rName
, sal_Int32 nFirstRunPos
, sal_Int32 nLastRunPos
) override
;
445 void SectionRtlGutter( const SfxBoolItem
& rRtlGutter
) override
;
447 void TextLineBreak(const SwFormatLineBreak
& rLineBreak
) override
;
450 explicit WW8AttributeOutput( WW8Export
&rWW8Export
)
451 : AttributeOutputBase(rWW8Export
.GetWriter().GetMedia()->GetURLObject().GetMainURL(
452 INetURLObject::DecodeMechanism::NONE
))
453 , m_rWW8Export(rWW8Export
)
456 , m_nStyleStartSize(0)
458 , m_nStyleCountPos(0)
460 , mbOnTOXEnding(false)
464 /// Return the right export class.
465 virtual WW8Export
& GetExport() override
{ return m_rWW8Export
; }
468 /// Output the bold etc. attributes
469 void OutputWW8Attribute( sal_uInt8 nId
, bool bVal
);
471 /// Output the bold etc. attributes, the Complex Text Layout version
472 void OutputWW8AttributeCTL( sal_uInt8 nId
, bool bVal
);
474 void TableCellBorders(
475 ww8::WW8TableNodeInfoInner::Pointer_t
const & pTableTextNodeInfoInner
);
479 /// Reference to the export, where to get the data from
480 WW8Export
&m_rWW8Export
;
482 /// For output of styles.
484 /// We have to remember these positions between the StartStyle() and
486 sal_uInt16 m_nPOPosStdLen1
, m_nPOPosStdLen2
;
488 /// For output of styles.
490 /// We have to remember this position between StartStyleProperties() and
491 /// EndStyleProperties().
492 sal_uInt16 m_nStyleStartSize
, m_nStyleLenPos
;
494 /// For output of styles.
496 /// Used between StartStyles() and EndStyles().
497 sal_uLong m_nStyleCountPos
;
499 /// For output of run properties.
501 /// We have to remember the number of field results, and do not export end
502 /// of the field results if we were forced to split text.
503 sal_uInt16 m_nFieldResults
;
507 /// Bookmarks of the current paragraph
508 std::multimap
<sal_Int32
, OUString
> m_aBookmarksOfParagraphStart
;
509 std::multimap
<sal_Int32
, OUString
> m_aBookmarksOfParagraphEnd
;
511 editeng::WordPageMargins m_pageMargins
;
512 bool m_bFromEdge
= false;
515 #endif // INCLUDED_SW_SOURCE_FILTER_WW8_WW8ATTRIBUTEOUTPUT_HXX
517 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */