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 _WW8ATTRIBUTEOUTPUT_HXX_
32 #define _WW8ATTRIBUTEOUTPUT_HXX_
34 #include "attributeoutputbase.hxx"
37 class WW8AttributeOutput
: public AttributeOutputBase
40 /// Export the state of RTL/CJK.
41 virtual void RTLAndCJKState( bool bIsRTL
, sal_uInt16 nScript
);
43 /// Start of the paragraph.
44 virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t
/*pTextNodeInfo*/ ) {}
46 /// End of the paragraph.
47 virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner
);
49 /// Called before we start outputting the attributes.
50 virtual void StartParagraphProperties( const SwTxtNode
& /*rNode*/ ) {}
52 /// Called after we end outputting the attributes.
53 virtual void EndParagraphProperties() {}
56 virtual void EmptyParagraph();
58 /// Start of the text run.
60 /// No-op for binary filters.
61 virtual void StartRun( const SwRedlineData
* /*pRedlineData*/ ) {}
63 /// End of the text run.
65 /// No-op for binary filters.
66 virtual void EndRun() {}
68 /// Before we start outputting the attributes.
69 virtual void StartRunProperties();
71 /// After we end outputting the attributes.
72 virtual void EndRunProperties( const SwRedlineData
* pRedlineData
);
75 virtual void RunText( const String
& rText
, rtl_TextEncoding eCharSet
);
77 /// Output text (without markup).
78 virtual void RawText( const String
& rText
, bool bForceUnicode
, rtl_TextEncoding eCharSet
);
80 /// Output ruby start.
81 virtual void StartRuby( const SwTxtNode
& rNode
, const SwFmtRuby
& rRuby
);
84 virtual void EndRuby();
87 virtual bool StartURL( const String
&rUrl
, const String
&rTarget
);
90 virtual bool EndURL();
92 virtual void FieldVanish( const String
& rTxt
, ww::eField eType
);
95 virtual void Redline( const SwRedlineData
* pRedline
);
97 virtual void FormatDrop( const SwTxtNode
& rNode
, const SwFmtDrop
&rSwFmtDrop
, USHORT nStyle
, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo
, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner
);
99 /// Output FKP (Formatted disK Page) - necessary for binary formats only.
100 /// FIXME having it in AttributeOutputBase is probably a hack, it
101 /// should be in WW8AttributeOutput only...
102 virtual void OutputFKP();
105 virtual void ParagraphStyle( USHORT nStyle
);
107 virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
);
109 virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
);
111 virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
);
113 virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
);
115 virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
);
117 virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
);
119 virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
);
121 virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
);
123 virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo
);
125 virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo
);
127 virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner
);
129 virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner
);
131 virtual void TableRowEnd( sal_uInt32 nDepth
= 1 );
133 /// Start of the styles table.
134 virtual void StartStyles();
136 /// End of the styles table.
137 virtual void EndStyles( USHORT nNumberOfStyles
);
139 /// Write default style.
140 virtual void DefaultStyle( USHORT nStyle
);
142 /// Start of a style in the styles table.
143 virtual void StartStyle( const String
& rName
, bool bPapFmt
,
144 USHORT nBase
, USHORT nNext
, USHORT nWwIdi
, USHORT nId
);
146 /// End of a style in the styles table.
147 virtual void EndStyle();
149 /// Start of (paragraph or run) properties of a style.
150 virtual void StartStyleProperties( bool bParProp
, USHORT nStyle
);
152 /// End of (paragraph or run) properties of a style.
153 virtual void EndStyleProperties( bool bParProp
);
155 /// Numbering rule and Id.
156 virtual void OutlineNumbering( BYTE nLvl
, const SwNumFmt
&rNFmt
, const SwFmt
&rFmt
);
159 /// As a paragraph property - the paragraph should be on the next page.
160 virtual void PageBreakBefore( bool bBreak
);
162 /// Write a section break
163 /// msword::ColumnBreak or msword::PageBreak
164 virtual void SectionBreak( BYTE nC
, const WW8_SepInfo
* pSectionInfo
= NULL
);
166 /// Start of the section properties.
167 virtual void StartSection();
169 /// End of the section properties.
171 /// No-op for binary filters.
172 virtual void EndSection() {}
174 /// Protection of forms.
175 virtual void SectionFormProtection( bool bProtected
);
177 /// Numbering of the lines in the document.
178 virtual void SectionLineNumbering( ULONG nRestartNo
, const SwLineNumberInfo
& rLnNumInfo
);
180 /// Has different headers/footers for the title page.
181 virtual void SectionTitlePage();
183 /// Description of the page borders.
184 virtual void SectionPageBorders( const SwFrmFmt
* pFmt
, const SwFrmFmt
* pFirstPageFmt
);
186 /// Columns populated from right/numbers on the right side?
187 virtual void SectionBiDi( bool bBiDi
);
189 /// The style of the page numbers.
191 /// nPageRestartNumberr being 0 means no restart.
192 virtual void SectionPageNumbering( USHORT nNumType
, USHORT nPageRestartNumber
);
194 /// The type of breaking.
195 virtual void SectionType( BYTE nBreakCode
);
197 /// Special header/footer flags, needed for old versions only.
198 virtual void SectionWW6HeaderFooterFlags( BYTE nHeadFootFlags
);
200 /// Definition of a numbering instance.
201 virtual void NumberingDefinition( USHORT nId
, const SwNumRule
&rRule
);
203 /// All the numbering level information.
204 virtual void NumberingLevel( BYTE nLevel
,
206 USHORT nNumberingType
,
208 const BYTE
*pNumLvlPos
,
211 const SfxItemSet
*pOutSet
,
213 sal_Int16 nFirstLineIndex
,
214 sal_Int16 nListTabPos
,
215 const String
&rNumberingString
);
218 /// Output frames - the implementation.
219 void OutputFlyFrame_Impl( const sw::Frame
& rFmt
, const Point
& rNdTopLeft
);
221 /// Sfx item Sfx item RES_CHRATR_CASEMAP
222 virtual void CharCaseMap( const SvxCaseMapItem
& );
224 /// Sfx item Sfx item RES_CHRATR_COLOR
225 virtual void CharColor( const SvxColorItem
& );
227 /// Sfx item Sfx item RES_CHRATR_CONTOUR
228 virtual void CharContour( const SvxContourItem
& );
230 /// Sfx item RES_CHRATR_CROSSEDOUT
231 virtual void CharCrossedOut( const SvxCrossedOutItem
& rHt
);
233 /// Sfx item RES_CHRATR_ESCAPEMENT
234 virtual void CharEscapement( const SvxEscapementItem
& );
236 /// Sfx item RES_CHRATR_FONT
237 virtual void CharFont( const SvxFontItem
& );
239 /// Sfx item RES_CHRATR_FONTSIZE
240 virtual void CharFontSize( const SvxFontHeightItem
& );
242 /// Sfx item RES_CHRATR_KERNING
243 virtual void CharKerning( const SvxKerningItem
& );
245 /// Sfx item RES_CHRATR_LANGUAGE
246 virtual void CharLanguage( const SvxLanguageItem
& );
248 /// Sfx item RES_CHRATR_POSTURE
249 virtual void CharPosture( const SvxPostureItem
& );
251 /// Sfx item RES_CHRATR_SHADOWED
252 virtual void CharShadow( const SvxShadowedItem
& );
254 /// Sfx item RES_CHRATR_UNDERLINE
255 virtual void CharUnderline( const SvxUnderlineItem
& );
257 /// Sfx item RES_CHRATR_WEIGHT
258 virtual void CharWeight( const SvxWeightItem
& );
260 /// Sfx item RES_CHRATR_AUTOKERN
261 virtual void CharAutoKern( const SvxAutoKernItem
& );
263 /// Sfx item RES_CHRATR_BLINK
264 virtual void CharAnimatedText( const SvxBlinkItem
& );
266 /// Sfx item RES_CHRATR_BACKGROUND
267 virtual void CharBackground( const SvxBrushItem
& );
269 /// Sfx item RES_CHRATR_CJK_FONT
270 virtual void CharFontCJK( const SvxFontItem
& );
272 /// Sfx item RES_CHRATR_CJK_FONTSIZE
273 virtual void CharFontSizeCJK( const SvxFontHeightItem
& rHt
) { CharFontSize( rHt
); }
275 /// Sfx item RES_CHRATR_CJK_LANGUAGE
276 virtual void CharLanguageCJK( const SvxLanguageItem
& rHt
) { CharLanguage( rHt
); }
278 /// Sfx item RES_CHRATR_CJK_POSTURE
279 virtual void CharPostureCJK( const SvxPostureItem
& rHt
) { CharPosture( rHt
); }
281 /// Sfx item RES_CHRATR_CJK_WEIGHT
282 virtual void CharWeightCJK( const SvxWeightItem
& rHt
) { CharWeight( rHt
); }
284 /// Sfx item RES_CHRATR_CTL_FONT
285 virtual void CharFontCTL( const SvxFontItem
& );
287 /// Sfx item RES_CHRATR_CTL_FONTSIZE
288 virtual void CharFontSizeCTL( const SvxFontHeightItem
& rHt
) { CharFontSize( rHt
); }
290 /// Sfx item RES_CHRATR_CTL_LANGUAGE
291 virtual void CharLanguageCTL( const SvxLanguageItem
& rHt
) { CharLanguage( rHt
); }
293 /// Sfx item RES_CHRATR_CTL_POSTURE
294 virtual void CharPostureCTL( const SvxPostureItem
& );
296 /// Sfx item RES_CHRATR_CTL_WEIGHT
297 virtual void CharWeightCTL( const SvxWeightItem
& );
299 /// Sfx item RES_CHRATR_ROTATE
300 virtual void CharRotate( const SvxCharRotateItem
& );
302 /// Sfx item RES_CHRATR_EMPHASIS_MARK
303 virtual void CharEmphasisMark( const SvxEmphasisMarkItem
& rHt
);
305 /// Sfx item RES_CHRATR_TWO_LINES
306 virtual void CharTwoLines( const SvxTwoLinesItem
& );
308 /// Sfx item RES_CHRATR_SCALEW
309 virtual void CharScaleWidth( const SvxCharScaleWidthItem
& );
311 /// Sfx item RES_CHRATR_RELIEF
312 virtual void CharRelief( const SvxCharReliefItem
& );
314 /// Sfx item RES_CHRATR_HIDDEN
315 virtual void CharHidden( const SvxCharHiddenItem
& );
317 /// Sfx item RES_TXTATR_INETFMT
318 virtual void TextINetFormat( const SwFmtINetFmt
& );
320 /// Sfx item RES_TXTATR_CHARFMT
321 virtual void TextCharFormat( const SwFmtCharFmt
& );
323 /// Sfx item RES_TXTATR_FTN
324 virtual void TextFootnote_Impl( const SwFmtFtn
& );
326 /// Sfx item RES_TXTATR_HARDBLANK
327 virtual void TextHardBlank( const SwFmtHardBlank
& );
329 /// Sfx item RES_PARATR_LINESPACING
330 virtual void ParaLineSpacing_Impl( short nSpace
, short nMulti
);
332 /// Sfx item RES_PARATR_ADJUST
333 virtual void ParaAdjust( const SvxAdjustItem
& rHt
);
335 /// Sfx item RES_PARATR_SPLIT
336 virtual void ParaSplit( const SvxFmtSplitItem
& );
338 /// Sfx item RES_PARATR_WIDOWS
339 virtual void ParaWidows( const SvxWidowsItem
& rHt
);
341 /// Sfx item RES_PARATR_TABSTOP
342 virtual void ParaTabStop( const SvxTabStopItem
& rHt
);
344 /// Sfx item RES_PARATR_HYPHENZONE
345 virtual void ParaHyphenZone( const SvxHyphenZoneItem
& );
347 /// Sfx item RES_PARATR_NUMRULE
348 virtual void ParaNumRule_Impl( const SwTxtNode
*pTxtNd
, sal_Int32 nLvl
, sal_Int32 nNumId
);
350 /// Sfx item RES_PARATR_SCRIPTSPACE
351 virtual void ParaScriptSpace( const SfxBoolItem
& );
353 /// Sfx item RES_PARATR_VERTALIGN
354 virtual void ParaVerticalAlign( const SvxParaVertAlignItem
& );
356 /// Sfx item RES_PARATR_SNAPTOGRID
357 virtual void ParaSnapToGrid( const SvxParaGridItem
& );
359 /// Sfx item RES_FRM_SIZE
360 virtual void FormatFrameSize( const SwFmtFrmSize
& );
362 /// Sfx item RES_PAPER_BIN
363 virtual void FormatPaperBin( const SvxPaperBinItem
& );
365 /// Sfx item RES_LR_SPACE
366 virtual void FormatLRSpace( const SvxLRSpaceItem
& );
368 /// Sfx item RES_UL_SPACE
369 virtual void FormatULSpace( const SvxULSpaceItem
& rHt
);
371 /// Sfx item RES_SURROUND
372 virtual void FormatSurround( const SwFmtSurround
& );
374 /// Sfx item RES_VERT_ORIENT
375 virtual void FormatVertOrientation( const SwFmtVertOrient
& );
377 /// Sfx item RES_HORI_ORIENT
378 virtual void FormatHorizOrientation( const SwFmtHoriOrient
& );
380 /// Sfx item RES_ANCHOR
381 virtual void FormatAnchor( const SwFmtAnchor
& );
383 /// Sfx item RES_BACKGROUND
384 virtual void FormatBackground( const SvxBrushItem
& );
387 virtual void FormatBox( const SvxBoxItem
& );
390 virtual void FormatColumns_Impl( USHORT nCols
, const SwFmtCol
& rCol
, bool bEven
, SwTwips nPageSize
);
392 /// Sfx item RES_KEEP
393 virtual void FormatKeep( const SvxFmtKeepItem
& );
395 /// Sfx item RES_TEXTGRID
396 virtual void FormatTextGrid( const SwTextGridItem
& );
398 /// Sfx item RES_LINENUMBER
399 virtual void FormatLineNumbering( const SwFmtLineNumber
& );
401 /// Sfx item RES_FRAMEDIR
402 virtual void FormatFrameDirection( const SvxFrameDirectionItem
& );
404 /// Write the expanded field
405 virtual void WriteExpand( const SwField
* pFld
);
407 virtual void RefField ( const SwField
& rFld
, const String
& rRef
);
408 virtual void HiddenField( const SwField
& rFld
);
409 virtual void SetField( const SwField
& rFld
, ww::eField eType
, const String
& rCmd
);
410 virtual void PostitField( const SwField
* pFld
);
411 virtual bool DropdownField( const SwField
* pFld
);
413 virtual bool AnalyzeURL( const String
& rURL
, const String
& rTarget
, String
* pLinkURL
, String
* pMark
);
415 /// Reference to the export, where to get the data from
416 WW8Export
&m_rWW8Export
;
418 /// For output of styles.
420 /// We have to remember these positions between the StartStyle() and
422 USHORT nPOPosStdLen1
, nPOPosStdLen2
;
424 /// For output of styles.
426 /// We have to remember this position between StartStyleProperties() and
427 /// EndStyleProperties().
428 USHORT m_nStyleStartSize
, m_nStyleLenPos
;
430 /// For output of styles.
432 /// Used between StartStyles() and EndStyles().
435 /// For output of run properties.
437 /// We have to remember the number of field results, and do not export end
438 /// of the field results if we were forced to split text.
439 USHORT m_nFieldResults
;
442 WW8AttributeOutput( WW8Export
&rWW8Export
) : AttributeOutputBase(), m_rWW8Export( rWW8Export
) {}
443 virtual ~WW8AttributeOutput() {}
445 /// Return the right export class.
446 virtual MSWordExportBase
& GetExport() { return m_rWW8Export
; }
449 /// Output the bold etc. attributes
450 void OutputWW8Attribute( BYTE nId
, bool bVal
);
452 /// Output the bold etc. attributes, the Complex Text Layout version
453 void OutputWW8AttributeCTL( BYTE nId
, bool bVal
);
457 #endif // _WW8ATTRIBUTEOUTPUT_HXX_
459 /* vi:set tabstop=4 shiftwidth=4 expandtab: */