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 _ATTRIBUTEOUTPUTBASE_HXX_
21 #define _ATTRIBUTEOUTPUTBASE_HXX_
24 #include "WW8TableInfo.hxx"
26 #include <rtl/textenc.h>
27 #include <editeng/svxenum.hxx>
28 #include <tools/solar.h>
30 #include <swtypes.hxx>
31 #include <wrtswtbl.hxx>
40 class SvxCrossedOutItem
;
41 class SvxEscapementItem
;
43 class SvxFontHeightItem
;
45 class SvxLanguageItem
;
47 class SvxShadowedItem
;
48 class SvxUnderlineItem
;
50 class SvxAutoKernItem
;
54 class XFillGradientItem
;
56 class SvxFontHeightItem
;
57 class SvxLanguageItem
;
61 class SvxFontHeightItem
;
62 class SvxLanguageItem
;
65 class SvxCharRotateItem
;
66 class SvxEmphasisMarkItem
;
67 class SvxTwoLinesItem
;
68 class SvxCharScaleWidthItem
;
69 class SvxCharReliefItem
;
70 class SvxCharHiddenItem
;
76 class SvxLineSpacingItem
;
78 class SvxFmtSplitItem
;
81 class SvxHyphenZoneItem
;
86 class SvxParaVertAlignItem
;
87 class SvxParaGridItem
;
89 class SvxPaperBinItem
;
93 class SvxFmtBreakItem
;
95 class SwFmtVertOrient
;
96 class SwFmtHoriOrient
;
101 class SvxFmtKeepItem
;
102 class SwTextGridItem
;
103 class SwFmtLineNumber
;
104 class SvxFrameDirectionItem
;
115 class SwLineNumberInfo
;
121 class MSWordExportBase
;
123 namespace sw
{ class Frame
; }
126 const sal_uInt8 ColumnBreak
= 0xE;
127 const sal_uInt8 PageBreak
= 0xC;
130 class AttributeOutputBase
133 /// Export the state of RTL/CJK.
134 virtual void RTLAndCJKState( bool bIsRTL
, sal_uInt16 nScript
) = 0;
136 /// Start of the paragraph.
137 virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo
) = 0;
139 /// End of the paragraph.
140 virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner
) = 0;
142 /// Called before we start outputting the attributes.
143 virtual void StartParagraphProperties( const SwTxtNode
& rNode
) = 0;
145 /// Called after we end outputting the attributes.
146 virtual void EndParagraphProperties() = 0;
149 virtual void EmptyParagraph() = 0;
151 /// Start of the text run.
152 virtual void StartRun( const SwRedlineData
* pRedlineData
, bool bSingleEmptyRun
= false ) = 0;
154 /// End of the text run.
155 virtual void EndRun() = 0;
157 /// Called before we start outputting the attributes.
158 virtual void StartRunProperties() = 0;
160 /// Called after we end outputting the attributes.
161 virtual void EndRunProperties( const SwRedlineData
* pRedlineData
) = 0;
163 /// docx requires footnoteRef/endnoteRef tag at the beginning of each of them
164 virtual void FootnoteEndnoteRefTag() {};
166 /// for docx footnotePr/endnotePr inside sectPr
167 virtual void SectFootnoteEndnotePr() {};
169 /// for docx w:commentReference
170 virtual void WritePostitFieldReference() {};
172 /// for docx w:commentRangeStart
173 virtual void WritePostitFieldStart() {};
175 /// for docx w:commentRangeEnd
176 virtual void WritePostitFieldEnd() {};
178 /// Output text (inside a run).
179 virtual void RunText( const String
& rText
, rtl_TextEncoding eCharSet
) = 0;
181 /// Output text (without markup).
182 virtual void RawText( const String
& rText
, bool bForceUnicode
, rtl_TextEncoding eCharSet
) = 0;
184 /// Output ruby start.
185 virtual void StartRuby( const SwTxtNode
& rNode
, xub_StrLen nPos
, const SwFmtRuby
& rRuby
) = 0;
188 virtual void EndRuby() = 0;
190 /// Output URL start.
191 virtual bool StartURL( const String
& rUrl
, const String
& rTarget
) = 0;
194 virtual bool EndURL() = 0;
196 virtual void FieldVanish( const String
& rTxt
, ww::eField eType
) = 0;
198 void StartTOX( const SwSection
& rSect
);
200 void EndTOX( const SwSection
& rSect
);
202 virtual void TOXMark( const SwTxtNode
& rNode
, const SwTOXMark
& rAttr
);
204 /// Output redlining.
205 virtual void Redline( const SwRedlineData
* pRedline
) = 0;
207 virtual void FormatDrop( const SwTxtNode
& rNode
, const SwFmtDrop
& rSwFmtDrop
, sal_uInt16 nStyle
, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo
, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner
) = 0;
209 /// Output FKP (Formatted disK Page) - necessary for binary formats only.
210 /// FIXME having it in AttributeOutputBase is probably a hack, it
211 /// should be in WW8AttributeOutput only...
212 virtual void OutputFKP() {}
215 virtual void ParagraphStyle( sal_uInt16 nStyle
) = 0;
217 virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
219 virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
221 virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
223 virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
225 virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
227 virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
229 virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
231 virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
233 virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
235 virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo
) = 0;
237 virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner
) = 0;
239 virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner
) = 0;
241 virtual void TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner
) = 0;
243 virtual void TableRowEnd( sal_uInt32 nDepth
) = 0;
245 /// Start of the styles table.
246 virtual void StartStyles() = 0;
248 /// End of the styles table.
249 virtual void EndStyles( sal_uInt16 nNumberOfStyles
) = 0;
251 /// Write default style.
252 virtual void DefaultStyle( sal_uInt16 nStyle
) = 0;
254 /// Start of a style in the styles table.
255 virtual void StartStyle( const String
& rName
, bool bPapFmt
,
256 sal_uInt16 nBase
, sal_uInt16 nNext
, sal_uInt16 nWwId
, sal_uInt16 nId
,
257 bool bAutoUpdate
) = 0;
259 /// End of a style in the styles table.
260 virtual void EndStyle() = 0;
262 /// Start of (paragraph or run) properties of a style.
263 virtual void StartStyleProperties( bool bParProp
, sal_uInt16 nStyle
) = 0;
265 /// End of (paragraph or run) properties of a style.
266 virtual void EndStyleProperties( bool bParProp
) = 0;
268 /// Numbering rule and Id.
269 virtual void OutlineNumbering( sal_uInt8 nLvl
, const SwNumFmt
& rNFmt
, const SwFmt
& rFmt
) = 0;
272 /// As a paragraph property - the paragraph should be on the next page.
273 virtual void PageBreakBefore( bool bBreak
) = 0;
275 /// Write a section break
276 /// msword::ColumnBreak or msword::PageBreak
277 virtual void SectionBreak( sal_uInt8 nC
, const WW8_SepInfo
* pSectionInfo
= NULL
) = 0;
279 /// Start of the section properties.
280 virtual void StartSection() = 0;
282 /// End of the section properties.
283 virtual void EndSection() = 0;
285 /// Protection of forms.
286 virtual void SectionFormProtection( bool bProtected
) = 0;
288 /// Numbering of the lines in the document.
289 virtual void SectionLineNumbering( sal_uLong nRestartNo
, const SwLineNumberInfo
& rLnNumInfo
) = 0;
291 /// Has different headers/footers for the title page.
292 virtual void SectionTitlePage() = 0;
294 /// Description of the page borders.
295 virtual void SectionPageBorders( const SwFrmFmt
* pFmt
, const SwFrmFmt
* pFirstPageFmt
) = 0;
297 /// Columns populated from right/numbers on the right side?
298 virtual void SectionBiDi( bool bBiDi
) = 0;
300 /// The style of the page numbers.
302 /// nPageRestartNumberr being 0 means no restart.
303 virtual void SectionPageNumbering( sal_uInt16 nNumType
, sal_uInt16 nPageRestartNumber
) = 0;
305 /// The type of breaking.
306 virtual void SectionType( sal_uInt8 nBreakCode
) = 0;
308 /// Special header/footer flags, needed for old versions only.
309 virtual void SectionWW6HeaderFooterFlags( sal_uInt8
/*nHeadFootFlags*/ ) {}
311 /// Definition of a numbering instance.
312 virtual void NumberingDefinition( sal_uInt16 nId
, const SwNumRule
&rRule
) = 0;
314 /// Start of the abstract numbering definition instance.
315 virtual void StartAbstractNumbering( sal_uInt16
/*nId*/ ) {}
317 /// End of the abstract numbering definition instance.
318 virtual void EndAbstractNumbering() {}
320 /// All the numbering level information.
321 virtual void NumberingLevel( sal_uInt8 nLevel
,
323 sal_uInt16 nNumberingType
,
325 const sal_uInt8
*pNumLvlPos
,
328 const SfxItemSet
*pOutSet
,
330 sal_Int16 nFirstLineIndex
,
331 sal_Int16 nListTabPos
,
332 const String
&rNumberingString
,
333 const SvxBrushItem
* pBrush
= 0) = 0; // #i120928 export graphic of bullet
337 void GetNumberPara( String
& rStr
, const SwField
& rFld
);
339 /// Output frames - the implementation.
340 virtual void OutputFlyFrame_Impl( const sw::Frame
& rFmt
, const Point
& rNdTopLeft
) = 0;
342 /// Sfx item Sfx item RES_CHRATR_CASEMAP
343 virtual void CharCaseMap( const SvxCaseMapItem
& ) = 0;
345 /// Sfx item Sfx item RES_CHRATR_COLOR
346 virtual void CharColor( const SvxColorItem
& ) = 0;
348 /// Sfx item Sfx item RES_CHRATR_CONTOUR
349 virtual void CharContour( const SvxContourItem
& ) = 0;
351 /// Sfx item RES_CHRATR_CROSSEDOUT
352 virtual void CharCrossedOut( const SvxCrossedOutItem
& ) = 0;
354 /// Sfx item RES_CHRATR_ESCAPEMENT
355 virtual void CharEscapement( const SvxEscapementItem
& ) = 0;
357 /// Sfx item RES_CHRATR_FONT
358 virtual void CharFont( const SvxFontItem
& ) = 0;
360 /// Sfx item RES_CHRATR_FONTSIZE
361 virtual void CharFontSize( const SvxFontHeightItem
& ) = 0;
363 /// Sfx item RES_CHRATR_KERNING
364 virtual void CharKerning( const SvxKerningItem
& ) = 0;
366 /// Sfx item RES_CHRATR_LANGUAGE
367 virtual void CharLanguage( const SvxLanguageItem
& ) = 0;
369 /// Sfx item RES_CHRATR_POSTURE
370 virtual void CharPosture( const SvxPostureItem
& ) = 0;
372 /// Sfx item RES_CHRATR_SHADOWED
373 virtual void CharShadow( const SvxShadowedItem
& ) = 0;
375 /// Sfx item RES_CHRATR_UNDERLINE
376 virtual void CharUnderline( const SvxUnderlineItem
& ) = 0;
378 /// Sfx item RES_CHRATR_WEIGHT
379 virtual void CharWeight( const SvxWeightItem
& ) = 0;
381 /// Sfx item RES_CHRATR_AUTOKERN
382 virtual void CharAutoKern( const SvxAutoKernItem
& ) = 0;
384 /// Sfx item RES_CHRATR_BLINK
385 virtual void CharAnimatedText( const SvxBlinkItem
& ) = 0;
387 /// Sfx item RES_CHRATR_BACKGROUND
388 virtual void CharBackground( const SvxBrushItem
& ) = 0;
390 /// Sfx item RES_CHRATR_CJK_FONT
391 virtual void CharFontCJK( const SvxFontItem
& ) = 0;
393 /// Sfx item RES_CHRATR_CJK_FONTSIZE
394 virtual void CharFontSizeCJK( const SvxFontHeightItem
& ) = 0;
396 /// Sfx item RES_CHRATR_CJK_LANGUAGE
397 virtual void CharLanguageCJK( const SvxLanguageItem
& ) = 0;
399 /// Sfx item RES_CHRATR_CJK_POSTURE
400 virtual void CharPostureCJK( const SvxPostureItem
& ) = 0;
402 /// Sfx item RES_CHRATR_CJK_WEIGHT
403 virtual void CharWeightCJK( const SvxWeightItem
& ) = 0;
405 /// Sfx item RES_CHRATR_CTL_FONT
406 virtual void CharFontCTL( const SvxFontItem
& ) = 0;
408 /// Sfx item RES_CHRATR_CTL_FONTSIZE
409 virtual void CharFontSizeCTL( const SvxFontHeightItem
& ) = 0;
411 /// Sfx item RES_CHRATR_CTL_LANGUAGE
412 virtual void CharLanguageCTL( const SvxLanguageItem
& ) = 0;
414 /// Sfx item RES_CHRATR_CTL_POSTURE
415 virtual void CharPostureCTL( const SvxPostureItem
& ) = 0;
417 /// Sfx item RES_CHRATR_CTL_WEIGHT
418 virtual void CharWeightCTL( const SvxWeightItem
& ) = 0;
420 /// Sfx item RES_CHRATR_ROTATE
421 virtual void CharRotate( const SvxCharRotateItem
& ) = 0;
423 /// Sfx item RES_CHRATR_EMPHASIS_MARK
424 virtual void CharEmphasisMark( const SvxEmphasisMarkItem
& ) = 0;
426 /// Sfx item RES_CHRATR_TWO_LINES
427 virtual void CharTwoLines( const SvxTwoLinesItem
& ) = 0;
429 /// Sfx item RES_CHRATR_SCALEW
430 virtual void CharScaleWidth( const SvxCharScaleWidthItem
& ) = 0;
432 /// Sfx item RES_CHRATR_RELIEF
433 virtual void CharRelief( const SvxCharReliefItem
& ) = 0;
435 /// Sfx item RES_CHRATR_HIDDEN
436 virtual void CharHidden( const SvxCharHiddenItem
& ) = 0;
438 /// Sfx item RES_TXTATR_INETFMT
439 virtual void TextINetFormat( const SwFmtINetFmt
& ) = 0;
441 /// Sfx item RES_TXTATR_CHARFMT
442 virtual void TextCharFormat( const SwFmtCharFmt
& ) = 0;
444 /// Sfx item RES_TXTATR_FIELD
445 void TextField( const SwFmtFld
& );
447 /// Sfx item RES_TXTATR_FLYCNT
448 virtual void TextFlyContent( const SwFmtFlyCnt
& );
450 /// Sfx item RES_TXTATR_FTN
452 /// This one is common for both WW8AttributeOutput as well as
453 /// DocxAttributeOutput.
454 void TextFootnote( const SwFmtFtn
& );
456 /// Sfx item RES_TXTATR_FTN
457 virtual void TextFootnote_Impl( const SwFmtFtn
& ) = 0;
459 /// Sfx item RES_PARATR_LINESPACING
460 void ParaLineSpacing( const SvxLineSpacingItem
& );
462 /// Count the values in ParaLineSpacing, and pass theme here.
463 virtual void ParaLineSpacing_Impl( short nSpace
, short nMulti
) = 0;
465 /// Sfx item RES_PARATR_ADJUST
466 virtual void ParaAdjust( const SvxAdjustItem
& ) = 0;
468 /// Sfx item RES_PARATR_SPLIT
469 virtual void ParaSplit( const SvxFmtSplitItem
& ) = 0;
471 /// Sfx item RES_PARATR_WIDOWS
472 virtual void ParaWidows( const SvxWidowsItem
& ) = 0;
474 /// Sfx item RES_PARATR_TABSTOP
475 virtual void ParaTabStop( const SvxTabStopItem
& ) = 0;
477 /// Sfx item RES_PARATR_HYPHENZONE
478 virtual void ParaHyphenZone( const SvxHyphenZoneItem
& ) = 0;
480 /// Sfx item RES_PARATR_NUMRULE
481 void ParaNumRule( const SwNumRuleItem
& );
483 /// Numbering - the implementation.
484 virtual void ParaNumRule_Impl( const SwTxtNode
*pTxtNd
, sal_Int32 nLvl
, sal_Int32 nNumId
) = 0;
486 /// Sfx item RES_PARATR_SCRIPTSPACE
487 virtual void ParaScriptSpace( const SfxBoolItem
& ) = 0;
489 /// Sfx item RES_PARATR_HANGINGPUNCTUATION
490 void ParaHangingPunctuation( const SfxBoolItem
& rHt
) { ParaScriptSpace( rHt
); };
492 /// Sfx item RES_PARATR_FORBIDDEN_RULES
493 void ParaForbiddenRules( const SfxBoolItem
& rHt
) { ParaScriptSpace( rHt
); };
495 /// Sfx item RES_PARATR_VERTALIGN
496 virtual void ParaVerticalAlign( const SvxParaVertAlignItem
& ) = 0;
498 /// Sfx item RES_PARATR_SNAPTOGRID
499 virtual void ParaSnapToGrid( const SvxParaGridItem
& ) = 0;
501 /// Sfx item RES_FRM_SIZE
502 virtual void FormatFrameSize( const SwFmtFrmSize
& ) = 0;
504 /// Sfx item RES_PAPER_BIN
505 virtual void FormatPaperBin( const SvxPaperBinItem
& ) = 0;
507 /// Sfx item RES_LR_SPACE
508 virtual void FormatLRSpace( const SvxLRSpaceItem
& ) = 0;
510 /// Sfx item RES_UL_SPACE
511 virtual void FormatULSpace( const SvxULSpaceItem
& ) = 0;
513 /// Sfx item RES_PAGEDESC
514 void FormatPageDescription( const SwFmtPageDesc
& );
516 /// Sfx item RES_BREAK
517 void FormatBreak( const SvxFmtBreakItem
& );
519 /// Sfx item RES_SURROUND
520 virtual void FormatSurround( const SwFmtSurround
& ) = 0;
522 /// Sfx item RES_VERT_ORIENT
523 virtual void FormatVertOrientation( const SwFmtVertOrient
& ) = 0;
525 /// Sfx item RES_HORI_ORIENT
526 virtual void FormatHorizOrientation( const SwFmtHoriOrient
& ) = 0;
528 /// Sfx item RES_ANCHOR
529 virtual void FormatAnchor( const SwFmtAnchor
& ) = 0;
531 /// Sfx item RES_BACKGROUND
532 virtual void FormatBackground( const SvxBrushItem
& ) = 0;
534 /// Sfx item RES_FILL_STYLE
535 virtual void FormatFillStyle( const XFillStyleItem
& ) = 0;
537 /// Sfx item RES_FILL_GRADIENT
538 virtual void FormatFillGradient( const XFillGradientItem
& ) = 0;
541 virtual void FormatBox( const SvxBoxItem
& ) = 0;
544 void FormatColumns( const SwFmtCol
& );
546 virtual void FormatColumns_Impl( sal_uInt16 nCols
, const SwFmtCol
& rCol
, bool bEven
, SwTwips nPageSize
) = 0;
548 /// Sfx item RES_KEEP
549 virtual void FormatKeep( const SvxFmtKeepItem
& ) = 0;
551 /// Compute the grid character pitch
552 sal_uInt32
GridCharacterPitch( const SwTextGridItem
& rGrid
) const;
554 /// Sfx item RES_TEXTGRID
555 virtual void FormatTextGrid( const SwTextGridItem
& ) = 0;
557 /// Sfx item RES_LINENUMBER
558 virtual void FormatLineNumbering( const SwFmtLineNumber
& ) = 0;
560 /// Sfx item RES_FRAMEDIR
561 virtual void FormatFrameDirection( const SvxFrameDirectionItem
& ) = 0;
563 /// Write the expanded field
564 virtual void WriteExpand( const SwField
* pFld
) = 0;
566 virtual void RefField( const SwField
& rFld
, const String
& rRef
) = 0;
567 virtual void HiddenField( const SwField
& rFld
) = 0;
568 virtual void SetField( const SwField
& rFld
, ww::eField eType
, const String
& rCmd
) = 0;
569 virtual void PostitField( const SwField
* pFld
) = 0;
570 virtual bool DropdownField( const SwField
* pFld
) = 0;
571 virtual bool PlaceholderField( const SwField
* pFld
) = 0;
573 virtual bool AnalyzeURL( const String
& rUrl
, const String
& rTarget
, String
* pLinkURL
, String
* pMark
);
575 ww8::GridColsPtr
GetGridCols( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner
);
578 AttributeOutputBase() {}
579 virtual ~AttributeOutputBase() {}
581 /// Return the right export class.
582 virtual MSWordExportBase
& GetExport() = 0;
585 const MSWordExportBase
& GetExport() const { return const_cast< AttributeOutputBase
* >( this )->GetExport(); }
587 /// Call the right virtual function according to the type of the item.
588 void OutputItem( const SfxPoolItem
& rHt
);
590 /// Use OutputItem() on an item set - for styles.
591 void OutputStyleItemSet( const SfxItemSet
& rSet
, sal_Bool bDeep
, sal_Bool bTestForDefault
);
594 void OutputFlyFrame( const sw::Frame
& rFmt
);
596 void GetTablePageSize
597 ( ww8::WW8TableNodeInfoInner
* pTableTextNodeInfoInner
,
598 sal_uInt32
& rPageSize
, bool& rRelBoxSize
);
600 /// Exports the definition (image, size) of a single numbering picture bullet.
601 virtual void BulletDefinition(int /*nId*/, const Graphic
& /*rGraphic*/, Size
/*aSize*/) {}
605 #endif // _ATTRIBUTEOUTPUTBASE_HXX_
607 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */