1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _ATTRIBUTEOUTPUTBASE_HXX_
32 #define _ATTRIBUTEOUTPUTBASE_HXX_
35 #include "WW8TableInfo.hxx"
37 #include <rtl/textenc.h>
38 #include <svx/svxenum.hxx>
39 #include <tools/solar.h>
41 #include <swtypes.hxx>
42 #include <wrtswtbl.hxx>
51 class SvxCrossedOutItem
;
52 class SvxEscapementItem
;
54 class SvxFontHeightItem
;
56 class SvxLanguageItem
;
58 class SvxShadowedItem
;
59 class SvxUnderlineItem
;
61 class SvxAutoKernItem
;
65 class SvxFontHeightItem
;
66 class SvxLanguageItem
;
70 class SvxFontHeightItem
;
71 class SvxLanguageItem
;
74 class SvxCharRotateItem
;
75 class SvxEmphasisMarkItem
;
76 class SvxTwoLinesItem
;
77 class SvxCharScaleWidthItem
;
78 class SvxCharReliefItem
;
79 class SvxCharHiddenItem
;
86 class SvxLineSpacingItem
;
88 class SvxFmtSplitItem
;
91 class SvxHyphenZoneItem
;
96 class SvxParaVertAlignItem
;
97 class SvxParaGridItem
;
99 class SvxPaperBinItem
;
100 class SvxLRSpaceItem
;
101 class SvxULSpaceItem
;
103 class SvxFmtBreakItem
;
105 class SwFmtVertOrient
;
106 class SwFmtHoriOrient
;
111 class SvxFmtKeepItem
;
112 class SwTextGridItem
;
113 class SwFmtLineNumber
;
114 class SvxFrameDirectionItem
;
126 struct WW8_PdAttrDesc
;
127 class SwLineNumberInfo
;
133 class MSWordExportBase
;
135 namespace sw
{ class Frame
; }
138 const BYTE ColumnBreak
= 0xE;
139 const BYTE PageBreak
= 0xC;
142 class AttributeOutputBase
145 /// Export the state of RTL/CJK.
146 virtual void RTLAndCJKState( bool bIsRTL
, sal_uInt16 nScript
) = 0;
148 /// Start of the paragraph.
149 virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo
) = 0;
151 /// End of the paragraph.
152 virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner
) = 0;
154 /// Called before we start outputting the attributes.
155 virtual void StartParagraphProperties( const SwTxtNode
& rNode
) = 0;
157 /// Called after we end outputting the attributes.
158 virtual void EndParagraphProperties() = 0;
161 virtual void EmptyParagraph() = 0;
163 /// Start of the text run.
164 virtual void StartRun( const SwRedlineData
* pRedlineData
) = 0;
166 /// End of the text run.
167 virtual void EndRun() = 0;
169 /// Called before we start outputting the attributes.
170 virtual void StartRunProperties() = 0;
172 /// Called after we end outputting the attributes.
173 virtual void EndRunProperties( const SwRedlineData
* pRedlineData
) = 0;
175 /// Output text (inside a run).
176 virtual void RunText( const String
& rText
, rtl_TextEncoding eCharSet
) = 0;
178 /// Output text (without markup).
179 virtual void RawText( const String
& rText
, bool bForceUnicode
, rtl_TextEncoding eCharSet
) = 0;
181 /// Output ruby start.
182 virtual void StartRuby( const SwTxtNode
& rNode
, const SwFmtRuby
& rRuby
) = 0;
185 virtual void EndRuby() = 0;
187 /// Output URL start.
188 virtual bool StartURL( const String
& rUrl
, const String
& rTarget
) = 0;
191 virtual bool EndURL() = 0;
193 virtual void FieldVanish( const String
& rTxt
, ww::eField eType
) = 0;
195 void StartTOX( const SwSection
& rSect
);
197 void EndTOX( const SwSection
& rSect
);
199 virtual void TOXMark( const SwTxtNode
& rNode
, const SwTOXMark
& rAttr
);
201 /// Output redlining.
202 virtual void Redline( const SwRedlineData
* pRedline
) = 0;
204 virtual void FormatDrop( const SwTxtNode
& rNode
, const SwFmtDrop
& rSwFmtDrop
, USHORT nStyle
, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo
, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner
) = 0;
206 /// Output FKP (Formatted disK Page) - necessary for binary formats only.
207 /// FIXME having it in AttributeOutputBase is probably a hack, it
208 /// should be in WW8AttributeOutput only...
209 virtual void OutputFKP() {}
212 virtual void ParagraphStyle( USHORT nStyle
) = 0;
214 virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
216 virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
218 virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
220 virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
222 virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
224 virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
226 virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
228 virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
230 virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
) = 0;
232 virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo
) = 0;
234 virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner
) = 0;
236 virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner
) = 0;
238 virtual void TableRowEnd( sal_uInt32 nDepth
) = 0;
240 /// Start of the styles table.
241 virtual void StartStyles() = 0;
243 /// End of the styles table.
244 virtual void EndStyles( USHORT nNumberOfStyles
) = 0;
246 /// Write default style.
247 virtual void DefaultStyle( USHORT nStyle
) = 0;
249 /// Start of a style in the styles table.
250 virtual void StartStyle( const String
& rName
, bool bPapFmt
,
251 USHORT nBase
, USHORT nNext
, USHORT nWwId
, USHORT nId
) = 0;
253 /// End of a style in the styles table.
254 virtual void EndStyle() = 0;
256 /// Start of (paragraph or run) properties of a style.
257 virtual void StartStyleProperties( bool bParProp
, USHORT nStyle
) = 0;
259 /// End of (paragraph or run) properties of a style.
260 virtual void EndStyleProperties( bool bParProp
) = 0;
262 /// Numbering rule and Id.
263 virtual void OutlineNumbering( BYTE nLvl
, const SwNumFmt
& rNFmt
, const SwFmt
& rFmt
) = 0;
266 /// As a paragraph property - the paragraph should be on the next page.
267 virtual void PageBreakBefore( bool bBreak
) = 0;
269 /// Write a section break
270 /// msword::ColumnBreak or msword::PageBreak
271 virtual void SectionBreak( BYTE nC
, const WW8_SepInfo
* pSectionInfo
= NULL
) = 0;
273 /// Start of the section properties.
274 virtual void StartSection() = 0;
276 /// End of the section properties.
277 virtual void EndSection() = 0;
279 /// Protection of forms.
280 virtual void SectionFormProtection( bool bProtected
) = 0;
282 /// Numbering of the lines in the document.
283 virtual void SectionLineNumbering( ULONG nRestartNo
, const SwLineNumberInfo
& rLnNumInfo
) = 0;
285 /// Has different headers/footers for the title page.
286 virtual void SectionTitlePage() = 0;
288 /// Description of the page borders.
289 virtual void SectionPageBorders( const SwFrmFmt
* pFmt
, const SwFrmFmt
* pFirstPageFmt
) = 0;
291 /// Columns populated from right/numbers on the right side?
292 virtual void SectionBiDi( bool bBiDi
) = 0;
294 /// The style of the page numbers.
296 /// nPageRestartNumberr being 0 means no restart.
297 virtual void SectionPageNumbering( USHORT nNumType
, USHORT nPageRestartNumber
) = 0;
299 /// The type of breaking.
300 virtual void SectionType( BYTE nBreakCode
) = 0;
302 /// Special header/footer flags, needed for old versions only.
303 virtual void SectionWW6HeaderFooterFlags( BYTE
/*nHeadFootFlags*/ ) {}
305 /// Definition of a numbering instance.
306 virtual void NumberingDefinition( USHORT nId
, const SwNumRule
&rRule
) = 0;
308 /// Start of the abstract numbering definition instance.
309 virtual void StartAbstractNumbering( USHORT
/*nId*/ ) {}
311 /// End of the abstract numbering definition instance.
312 virtual void EndAbstractNumbering() {}
314 /// All the numbering level information.
315 virtual void NumberingLevel( BYTE nLevel
,
317 USHORT nNumberingType
,
319 const BYTE
*pNumLvlPos
,
322 const SfxItemSet
*pOutSet
,
324 sal_Int16 nFirstLineIndex
,
325 sal_Int16 nListTabPos
,
326 const String
&rNumberingString
) = 0;
330 void GetNumberPara( String
& rStr
, const SwField
& rFld
);
332 /// Output frames - the implementation.
333 virtual void OutputFlyFrame_Impl( const sw::Frame
& rFmt
, const Point
& rNdTopLeft
) = 0;
335 /// Sfx item Sfx item RES_CHRATR_CASEMAP
336 virtual void CharCaseMap( const SvxCaseMapItem
& ) = 0;
338 /// Sfx item Sfx item RES_CHRATR_COLOR
339 virtual void CharColor( const SvxColorItem
& ) = 0;
341 /// Sfx item Sfx item RES_CHRATR_CONTOUR
342 virtual void CharContour( const SvxContourItem
& ) = 0;
344 /// Sfx item RES_CHRATR_CROSSEDOUT
345 virtual void CharCrossedOut( const SvxCrossedOutItem
& ) = 0;
347 /// Sfx item RES_CHRATR_ESCAPEMENT
348 virtual void CharEscapement( const SvxEscapementItem
& ) = 0;
350 /// Sfx item RES_CHRATR_FONT
351 virtual void CharFont( const SvxFontItem
& ) = 0;
353 /// Sfx item RES_CHRATR_FONTSIZE
354 virtual void CharFontSize( const SvxFontHeightItem
& ) = 0;
356 /// Sfx item RES_CHRATR_KERNING
357 virtual void CharKerning( const SvxKerningItem
& ) = 0;
359 /// Sfx item RES_CHRATR_LANGUAGE
360 virtual void CharLanguage( const SvxLanguageItem
& ) = 0;
362 /// Sfx item RES_CHRATR_POSTURE
363 virtual void CharPosture( const SvxPostureItem
& ) = 0;
365 /// Sfx item RES_CHRATR_SHADOWED
366 virtual void CharShadow( const SvxShadowedItem
& ) = 0;
368 /// Sfx item RES_CHRATR_UNDERLINE
369 virtual void CharUnderline( const SvxUnderlineItem
& ) = 0;
371 /// Sfx item RES_CHRATR_WEIGHT
372 virtual void CharWeight( const SvxWeightItem
& ) = 0;
374 /// Sfx item RES_CHRATR_AUTOKERN
375 virtual void CharAutoKern( const SvxAutoKernItem
& ) = 0;
377 /// Sfx item RES_CHRATR_BLINK
378 virtual void CharAnimatedText( const SvxBlinkItem
& ) = 0;
380 /// Sfx item RES_CHRATR_BACKGROUND
381 virtual void CharBackground( const SvxBrushItem
& ) = 0;
383 /// Sfx item RES_CHRATR_CJK_FONT
384 virtual void CharFontCJK( const SvxFontItem
& ) = 0;
386 /// Sfx item RES_CHRATR_CJK_FONTSIZE
387 virtual void CharFontSizeCJK( const SvxFontHeightItem
& ) = 0;
389 /// Sfx item RES_CHRATR_CJK_LANGUAGE
390 virtual void CharLanguageCJK( const SvxLanguageItem
& ) = 0;
392 /// Sfx item RES_CHRATR_CJK_POSTURE
393 virtual void CharPostureCJK( const SvxPostureItem
& ) = 0;
395 /// Sfx item RES_CHRATR_CJK_WEIGHT
396 virtual void CharWeightCJK( const SvxWeightItem
& ) = 0;
398 /// Sfx item RES_CHRATR_CTL_FONT
399 virtual void CharFontCTL( const SvxFontItem
& ) = 0;
401 /// Sfx item RES_CHRATR_CTL_FONTSIZE
402 virtual void CharFontSizeCTL( const SvxFontHeightItem
& ) = 0;
404 /// Sfx item RES_CHRATR_CTL_LANGUAGE
405 virtual void CharLanguageCTL( const SvxLanguageItem
& ) = 0;
407 /// Sfx item RES_CHRATR_CTL_POSTURE
408 virtual void CharPostureCTL( const SvxPostureItem
& ) = 0;
410 /// Sfx item RES_CHRATR_CTL_WEIGHT
411 virtual void CharWeightCTL( const SvxWeightItem
& ) = 0;
413 /// Sfx item RES_CHRATR_ROTATE
414 virtual void CharRotate( const SvxCharRotateItem
& ) = 0;
416 /// Sfx item RES_CHRATR_EMPHASIS_MARK
417 virtual void CharEmphasisMark( const SvxEmphasisMarkItem
& ) = 0;
419 /// Sfx item RES_CHRATR_TWO_LINES
420 virtual void CharTwoLines( const SvxTwoLinesItem
& ) = 0;
422 /// Sfx item RES_CHRATR_SCALEW
423 virtual void CharScaleWidth( const SvxCharScaleWidthItem
& ) = 0;
425 /// Sfx item RES_CHRATR_RELIEF
426 virtual void CharRelief( const SvxCharReliefItem
& ) = 0;
428 /// Sfx item RES_CHRATR_HIDDEN
429 virtual void CharHidden( const SvxCharHiddenItem
& ) = 0;
431 /// Sfx item RES_TXTATR_INETFMT
432 virtual void TextINetFormat( const SwFmtINetFmt
& ) = 0;
434 /// Sfx item RES_TXTATR_CHARFMT
435 virtual void TextCharFormat( const SwFmtCharFmt
& ) = 0;
437 /// Sfx item RES_TXTATR_FIELD
438 void TextField( const SwFmtFld
& );
440 /// Sfx item RES_TXTATR_FLYCNT
441 virtual void TextFlyContent( const SwFmtFlyCnt
& );
443 /// Sfx item RES_TXTATR_FTN
445 /// This one is common for both WW8AttributeOutput as well as
446 /// DocxAttributeOutput.
447 void TextFootnote( const SwFmtFtn
& );
449 /// Sfx item RES_TXTATR_FTN
450 virtual void TextFootnote_Impl( const SwFmtFtn
& ) = 0;
452 /// Sfx item RES_PARATR_LINESPACING
453 void ParaLineSpacing( const SvxLineSpacingItem
& );
455 /// Count the values in ParaLineSpacing, and pass theme here.
456 virtual void ParaLineSpacing_Impl( short nSpace
, short nMulti
) = 0;
458 /// Sfx item RES_PARATR_ADJUST
459 virtual void ParaAdjust( const SvxAdjustItem
& ) = 0;
461 /// Sfx item RES_PARATR_SPLIT
462 virtual void ParaSplit( const SvxFmtSplitItem
& ) = 0;
464 /// Sfx item RES_PARATR_WIDOWS
465 virtual void ParaWidows( const SvxWidowsItem
& ) = 0;
467 /// Sfx item RES_PARATR_TABSTOP
468 virtual void ParaTabStop( const SvxTabStopItem
& ) = 0;
470 /// Sfx item RES_PARATR_HYPHENZONE
471 virtual void ParaHyphenZone( const SvxHyphenZoneItem
& ) = 0;
473 /// Sfx item RES_PARATR_NUMRULE
474 void ParaNumRule( const SwNumRuleItem
& );
476 /// Numbering - the implementation.
477 virtual void ParaNumRule_Impl( const SwTxtNode
*pTxtNd
, sal_Int32 nLvl
, sal_Int32 nNumId
) = 0;
479 /// Sfx item RES_PARATR_SCRIPTSPACE
480 virtual void ParaScriptSpace( const SfxBoolItem
& ) = 0;
482 /// Sfx item RES_PARATR_HANGINGPUNCTUATION
483 void ParaHangingPunctuation( const SfxBoolItem
& rHt
) { ParaScriptSpace( rHt
); };
485 /// Sfx item RES_PARATR_FORBIDDEN_RULES
486 void ParaForbiddenRules( const SfxBoolItem
& rHt
) { ParaScriptSpace( rHt
); };
488 /// Sfx item RES_PARATR_VERTALIGN
489 virtual void ParaVerticalAlign( const SvxParaVertAlignItem
& ) = 0;
491 /// Sfx item RES_PARATR_SNAPTOGRID
492 virtual void ParaSnapToGrid( const SvxParaGridItem
& ) = 0;
494 /// Sfx item RES_FRM_SIZE
495 virtual void FormatFrameSize( const SwFmtFrmSize
& ) = 0;
497 /// Sfx item RES_PAPER_BIN
498 virtual void FormatPaperBin( const SvxPaperBinItem
& ) = 0;
500 /// Sfx item RES_LR_SPACE
501 virtual void FormatLRSpace( const SvxLRSpaceItem
& ) = 0;
503 /// Sfx item RES_UL_SPACE
504 virtual void FormatULSpace( const SvxULSpaceItem
& ) = 0;
506 /// Sfx item RES_PAGEDESC
507 void FormatPageDescription( const SwFmtPageDesc
& );
509 /// Sfx item RES_BREAK
510 void FormatBreak( const SvxFmtBreakItem
& );
512 /// Sfx item RES_SURROUND
513 virtual void FormatSurround( const SwFmtSurround
& ) = 0;
515 /// Sfx item RES_VERT_ORIENT
516 virtual void FormatVertOrientation( const SwFmtVertOrient
& ) = 0;
518 /// Sfx item RES_HORI_ORIENT
519 virtual void FormatHorizOrientation( const SwFmtHoriOrient
& ) = 0;
521 /// Sfx item RES_ANCHOR
522 virtual void FormatAnchor( const SwFmtAnchor
& ) = 0;
524 /// Sfx item RES_BACKGROUND
525 virtual void FormatBackground( const SvxBrushItem
& ) = 0;
528 virtual void FormatBox( const SvxBoxItem
& ) = 0;
531 void FormatColumns( const SwFmtCol
& );
533 virtual void FormatColumns_Impl( USHORT nCols
, const SwFmtCol
& rCol
, bool bEven
, SwTwips nPageSize
) = 0;
535 /// Sfx item RES_KEEP
536 virtual void FormatKeep( const SvxFmtKeepItem
& ) = 0;
538 /// Sfx item RES_TEXTGRID
539 virtual void FormatTextGrid( const SwTextGridItem
& ) = 0;
541 /// Sfx item RES_LINENUMBER
542 virtual void FormatLineNumbering( const SwFmtLineNumber
& ) = 0;
544 /// Sfx item RES_FRAMEDIR
545 virtual void FormatFrameDirection( const SvxFrameDirectionItem
& ) = 0;
547 /// Write the expanded field
548 virtual void WriteExpand( const SwField
* pFld
) = 0;
550 virtual void RefField( const SwField
& rFld
, const String
& rRef
) = 0;
551 virtual void HiddenField( const SwField
& rFld
) = 0;
552 virtual void SetField( const SwField
& rFld
, ww::eField eType
, const String
& rCmd
) = 0;
553 virtual void PostitField( const SwField
* pFld
) = 0;
554 virtual bool DropdownField( const SwField
* pFld
) = 0;
556 virtual bool AnalyzeURL( const String
& rUrl
, const String
& rTarget
, String
* pLinkURL
, String
* pMark
);
558 std::vector
<SwTwips
> GetGridCols( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner
);
560 void GetTablePageSize( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner
, sal_uInt32
& rPageSize
, bool& rRelBoxSize
);
563 AttributeOutputBase() {}
564 virtual ~AttributeOutputBase() {}
566 /// Return the right export class.
567 virtual MSWordExportBase
& GetExport() = 0;
569 /// Call the right virtual function according to the type of the item.
570 void OutputItem( const SfxPoolItem
& rHt
);
572 /// Use OutputItem() on an item set - for styles.
573 void OutputStyleItemSet( const SfxItemSet
& rSet
, BOOL bDeep
, BOOL bTestForDefault
);
576 void OutputFlyFrame( const sw::Frame
& rFmt
);
579 #endif // _ATTRIBUTEOUTPUTBASE_HXX_
581 /* vi:set tabstop=4 shiftwidth=4 expandtab: */