Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _WW8ATTRIBUTEOUTPUT_HXX_
30 : : #define _WW8ATTRIBUTEOUTPUT_HXX_
31 : :
32 : : #include "attributeoutputbase.hxx"
33 : : #include "wrtww8.hxx"
34 : :
35 : : class WW8AttributeOutput : public AttributeOutputBase
36 : : {
37 : : public:
38 : : /// Export the state of RTL/CJK.
39 : : virtual void RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript );
40 : :
41 : : /// Start of the paragraph.
42 : 72 : virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/ ) {}
43 : :
44 : : /// End of the paragraph.
45 : : virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner );
46 : :
47 : : /// Called before we start outputting the attributes.
48 : 72 : virtual void StartParagraphProperties( const SwTxtNode& /*rNode*/ ) {}
49 : :
50 : : /// Called after we end outputting the attributes.
51 : 72 : virtual void EndParagraphProperties() {}
52 : :
53 : : /// Empty paragraph.
54 : : virtual void EmptyParagraph();
55 : :
56 : : /// Start of the text run.
57 : : ///
58 : : virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false );
59 : :
60 : : /// End of the text run.
61 : : ///
62 : : /// No-op for binary filters.
63 : 81 : virtual void EndRun() {}
64 : :
65 : : /// Before we start outputting the attributes.
66 : : virtual void StartRunProperties();
67 : :
68 : : /// After we end outputting the attributes.
69 : : virtual void EndRunProperties( const SwRedlineData* pRedlineData );
70 : :
71 : : /// Output text.
72 : : virtual void RunText( const String& rText, rtl_TextEncoding eCharSet );
73 : :
74 : : /// Output text (without markup).
75 : : virtual void RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet );
76 : :
77 : : /// Output ruby start.
78 : : virtual void StartRuby( const SwTxtNode& rNode, xub_StrLen nPos, const SwFmtRuby& rRuby );
79 : :
80 : : /// Output ruby end.
81 : : virtual void EndRuby();
82 : :
83 : : /// Output URL start.
84 : : virtual bool StartURL( const String &rUrl, const String &rTarget );
85 : :
86 : : /// Output URL end.
87 : : virtual bool EndURL();
88 : :
89 : : virtual void FieldVanish( const String& rTxt, ww::eField eType );
90 : :
91 : : /// Output redlining.
92 : : virtual void Redline( const SwRedlineData* pRedline );
93 : :
94 : : virtual void FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rSwFmtDrop, sal_uInt16 nStyle, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner );
95 : :
96 : : /// Output FKP (Formatted disK Page) - necessary for binary formats only.
97 : : /// FIXME having it in AttributeOutputBase is probably a hack, it
98 : : /// should be in WW8AttributeOutput only...
99 : : virtual void OutputFKP();
100 : :
101 : : /// Output style.
102 : : virtual void ParagraphStyle( sal_uInt16 nStyle );
103 : :
104 : : virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
105 : : virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
106 : : virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
107 : : virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
108 : : virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
109 : : virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
110 : : virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
111 : : virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
112 : : virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfo );
113 : : virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo );
114 : : virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner );
115 : : virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
116 : : virtual void TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
117 : : virtual void TableRowEnd( sal_uInt32 nDepth = 1 );
118 : :
119 : : /// Start of the styles table.
120 : : virtual void StartStyles();
121 : :
122 : : /// End of the styles table.
123 : : virtual void EndStyles( sal_uInt16 nNumberOfStyles );
124 : :
125 : : /// Write default style.
126 : : virtual void DefaultStyle( sal_uInt16 nStyle );
127 : :
128 : : /// Start of a style in the styles table.
129 : : virtual void StartStyle( const String& rName, bool bPapFmt,
130 : : sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwIdi, sal_uInt16 nId,
131 : : bool bAutoUpdate );
132 : :
133 : : /// End of a style in the styles table.
134 : : virtual void EndStyle();
135 : :
136 : : /// Start of (paragraph or run) properties of a style.
137 : : virtual void StartStyleProperties( bool bParProp, sal_uInt16 nStyle );
138 : :
139 : : /// End of (paragraph or run) properties of a style.
140 : : virtual void EndStyleProperties( bool bParProp );
141 : :
142 : : /// Numbering rule and Id.
143 : : virtual void OutlineNumbering( sal_uInt8 nLvl, const SwNumFmt &rNFmt, const SwFmt &rFmt );
144 : :
145 : : /// Page break
146 : : /// As a paragraph property - the paragraph should be on the next page.
147 : : virtual void PageBreakBefore( bool bBreak );
148 : :
149 : : /// Write a section break
150 : : /// msword::ColumnBreak or msword::PageBreak
151 : : virtual void SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectionInfo = NULL );
152 : :
153 : : /// Start of the section properties.
154 : : virtual void StartSection();
155 : :
156 : : /// End of the section properties.
157 : : ///
158 : : /// No-op for binary filters.
159 : 9 : virtual void EndSection() {}
160 : :
161 : : /// Protection of forms.
162 : : virtual void SectionFormProtection( bool bProtected );
163 : :
164 : : /// Numbering of the lines in the document.
165 : : virtual void SectionLineNumbering( sal_uLong nRestartNo, const SwLineNumberInfo& rLnNumInfo );
166 : :
167 : : /// Has different headers/footers for the title page.
168 : : virtual void SectionTitlePage();
169 : :
170 : : /// Description of the page borders.
171 : : virtual void SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* pFirstPageFmt );
172 : :
173 : : /// Columns populated from right/numbers on the right side?
174 : : virtual void SectionBiDi( bool bBiDi );
175 : :
176 : : /// The style of the page numbers.
177 : : ///
178 : : /// nPageRestartNumberr being 0 means no restart.
179 : : virtual void SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber );
180 : :
181 : : /// The type of breaking.
182 : : virtual void SectionType( sal_uInt8 nBreakCode );
183 : :
184 : : /// Special header/footer flags, needed for old versions only.
185 : : virtual void SectionWW6HeaderFooterFlags( sal_uInt8 nHeadFootFlags );
186 : :
187 : : /// Definition of a numbering instance.
188 : : virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule );
189 : :
190 : : /// All the numbering level information.
191 : : virtual void NumberingLevel( sal_uInt8 nLevel,
192 : : sal_uInt16 nStart,
193 : : sal_uInt16 nNumberingType,
194 : : SvxAdjust eAdjust,
195 : : const sal_uInt8 *pNumLvlPos,
196 : : sal_uInt8 nFollow,
197 : : const wwFont *pFont,
198 : : const SfxItemSet *pOutSet,
199 : : sal_Int16 nIndentAt,
200 : : sal_Int16 nFirstLineIndex,
201 : : sal_Int16 nListTabPos,
202 : : const String &rNumberingString );
203 : :
204 : : protected:
205 : : /// Output frames - the implementation.
206 : : void OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point& rNdTopLeft );
207 : :
208 : : /// Sfx item Sfx item RES_CHRATR_CASEMAP
209 : : virtual void CharCaseMap( const SvxCaseMapItem& );
210 : :
211 : : /// Sfx item Sfx item RES_CHRATR_COLOR
212 : : virtual void CharColor( const SvxColorItem& );
213 : :
214 : : /// Sfx item Sfx item RES_CHRATR_CONTOUR
215 : : virtual void CharContour( const SvxContourItem& );
216 : :
217 : : /// Sfx item RES_CHRATR_CROSSEDOUT
218 : : virtual void CharCrossedOut( const SvxCrossedOutItem& rHt );
219 : :
220 : : /// Sfx item RES_CHRATR_ESCAPEMENT
221 : : virtual void CharEscapement( const SvxEscapementItem& );
222 : :
223 : : /// Sfx item RES_CHRATR_FONT
224 : : virtual void CharFont( const SvxFontItem& );
225 : :
226 : : /// Sfx item RES_CHRATR_FONTSIZE
227 : : virtual void CharFontSize( const SvxFontHeightItem& );
228 : :
229 : : /// Sfx item RES_CHRATR_KERNING
230 : : virtual void CharKerning( const SvxKerningItem& );
231 : :
232 : : /// Sfx item RES_CHRATR_LANGUAGE
233 : : virtual void CharLanguage( const SvxLanguageItem& );
234 : :
235 : : /// Sfx item RES_CHRATR_POSTURE
236 : : virtual void CharPosture( const SvxPostureItem& );
237 : :
238 : : /// Sfx item RES_CHRATR_SHADOWED
239 : : virtual void CharShadow( const SvxShadowedItem& );
240 : :
241 : : /// Sfx item RES_CHRATR_UNDERLINE
242 : : virtual void CharUnderline( const SvxUnderlineItem& );
243 : :
244 : : /// Sfx item RES_CHRATR_WEIGHT
245 : : virtual void CharWeight( const SvxWeightItem& );
246 : :
247 : : /// Sfx item RES_CHRATR_AUTOKERN
248 : : virtual void CharAutoKern( const SvxAutoKernItem& );
249 : :
250 : : /// Sfx item RES_CHRATR_BLINK
251 : : virtual void CharAnimatedText( const SvxBlinkItem& );
252 : :
253 : : /// Sfx item RES_CHRATR_BACKGROUND
254 : : virtual void CharBackground( const SvxBrushItem& );
255 : :
256 : : /// Sfx item RES_CHRATR_CJK_FONT
257 : : virtual void CharFontCJK( const SvxFontItem& );
258 : :
259 : : /// Sfx item RES_CHRATR_CJK_FONTSIZE
260 : 0 : virtual void CharFontSizeCJK( const SvxFontHeightItem& rHt ) { CharFontSize( rHt ); }
261 : :
262 : : /// Sfx item RES_CHRATR_CJK_LANGUAGE
263 : 18 : virtual void CharLanguageCJK( const SvxLanguageItem& rHt ) { CharLanguage( rHt ); }
264 : :
265 : : /// Sfx item RES_CHRATR_CJK_POSTURE
266 : 0 : virtual void CharPostureCJK( const SvxPostureItem& rHt ) { CharPosture( rHt ); }
267 : :
268 : : /// Sfx item RES_CHRATR_CJK_WEIGHT
269 : 0 : virtual void CharWeightCJK( const SvxWeightItem& rHt ) { CharWeight( rHt ); }
270 : :
271 : : /// Sfx item RES_CHRATR_CTL_FONT
272 : : virtual void CharFontCTL( const SvxFontItem& );
273 : :
274 : : /// Sfx item RES_CHRATR_CTL_FONTSIZE
275 : 105 : virtual void CharFontSizeCTL( const SvxFontHeightItem& rHt ) { CharFontSize( rHt ); }
276 : :
277 : : /// Sfx item RES_CHRATR_CTL_LANGUAGE
278 : 12 : virtual void CharLanguageCTL( const SvxLanguageItem& rHt ) { CharLanguage( rHt ); }
279 : :
280 : : /// Sfx item RES_CHRATR_CTL_POSTURE
281 : : virtual void CharPostureCTL( const SvxPostureItem& );
282 : :
283 : : /// Sfx item RES_CHRATR_CTL_WEIGHT
284 : : virtual void CharWeightCTL( const SvxWeightItem& );
285 : :
286 : : /// Sfx item RES_CHRATR_ROTATE
287 : : virtual void CharRotate( const SvxCharRotateItem& );
288 : :
289 : : /// Sfx item RES_CHRATR_EMPHASIS_MARK
290 : : virtual void CharEmphasisMark( const SvxEmphasisMarkItem& rHt );
291 : :
292 : : /// Sfx item RES_CHRATR_TWO_LINES
293 : : virtual void CharTwoLines( const SvxTwoLinesItem& );
294 : :
295 : : /// Sfx item RES_CHRATR_SCALEW
296 : : virtual void CharScaleWidth( const SvxCharScaleWidthItem& );
297 : :
298 : : /// Sfx item RES_CHRATR_RELIEF
299 : : virtual void CharRelief( const SvxCharReliefItem& );
300 : :
301 : : /// Sfx item RES_CHRATR_HIDDEN
302 : : virtual void CharHidden( const SvxCharHiddenItem& );
303 : :
304 : : /// Sfx item RES_TXTATR_INETFMT
305 : : virtual void TextINetFormat( const SwFmtINetFmt& );
306 : :
307 : : /// Sfx item RES_TXTATR_CHARFMT
308 : : virtual void TextCharFormat( const SwFmtCharFmt& );
309 : :
310 : : /// Sfx item RES_TXTATR_FTN
311 : : virtual void TextFootnote_Impl( const SwFmtFtn& );
312 : :
313 : : /// Sfx item RES_PARATR_LINESPACING
314 : : virtual void ParaLineSpacing_Impl( short nSpace, short nMulti );
315 : :
316 : : /// Sfx item RES_PARATR_ADJUST
317 : : virtual void ParaAdjust( const SvxAdjustItem& rHt );
318 : :
319 : : /// Sfx item RES_PARATR_SPLIT
320 : : virtual void ParaSplit( const SvxFmtSplitItem& );
321 : :
322 : : /// Sfx item RES_PARATR_WIDOWS
323 : : virtual void ParaWidows( const SvxWidowsItem& rHt );
324 : :
325 : : /// Sfx item RES_PARATR_TABSTOP
326 : : virtual void ParaTabStop( const SvxTabStopItem& rHt );
327 : :
328 : : /// Sfx item RES_PARATR_HYPHENZONE
329 : : virtual void ParaHyphenZone( const SvxHyphenZoneItem& );
330 : :
331 : : /// Sfx item RES_PARATR_NUMRULE
332 : : virtual void ParaNumRule_Impl( const SwTxtNode *pTxtNd, sal_Int32 nLvl, sal_Int32 nNumId );
333 : :
334 : : /// Sfx item RES_PARATR_SCRIPTSPACE
335 : : virtual void ParaScriptSpace( const SfxBoolItem& );
336 : :
337 : : /// Sfx item RES_PARATR_VERTALIGN
338 : : virtual void ParaVerticalAlign( const SvxParaVertAlignItem& );
339 : :
340 : : /// Sfx item RES_PARATR_SNAPTOGRID
341 : : virtual void ParaSnapToGrid( const SvxParaGridItem& );
342 : :
343 : : /// Sfx item RES_FRM_SIZE
344 : : virtual void FormatFrameSize( const SwFmtFrmSize& );
345 : :
346 : : /// Sfx item RES_PAPER_BIN
347 : : virtual void FormatPaperBin( const SvxPaperBinItem& );
348 : :
349 : : /// Sfx item RES_LR_SPACE
350 : : virtual void FormatLRSpace( const SvxLRSpaceItem& );
351 : :
352 : : /// Sfx item RES_UL_SPACE
353 : : virtual void FormatULSpace( const SvxULSpaceItem& rHt );
354 : :
355 : : /// Sfx item RES_SURROUND
356 : : virtual void FormatSurround( const SwFmtSurround& );
357 : :
358 : : /// Sfx item RES_VERT_ORIENT
359 : : virtual void FormatVertOrientation( const SwFmtVertOrient& );
360 : :
361 : : /// Sfx item RES_HORI_ORIENT
362 : : virtual void FormatHorizOrientation( const SwFmtHoriOrient& );
363 : :
364 : : /// Sfx item RES_ANCHOR
365 : : virtual void FormatAnchor( const SwFmtAnchor& );
366 : :
367 : : /// Sfx item RES_BACKGROUND
368 : : virtual void FormatBackground( const SvxBrushItem& );
369 : :
370 : : /// Sfx item RES_BOX
371 : : virtual void FormatBox( const SvxBoxItem& );
372 : :
373 : : /// Sfx item RES_COL
374 : : virtual void FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol & rCol, bool bEven, SwTwips nPageSize );
375 : :
376 : : /// Sfx item RES_KEEP
377 : : virtual void FormatKeep( const SvxFmtKeepItem& );
378 : :
379 : : /// Sfx item RES_TEXTGRID
380 : : virtual void FormatTextGrid( const SwTextGridItem& );
381 : :
382 : : /// Sfx item RES_LINENUMBER
383 : : virtual void FormatLineNumbering( const SwFmtLineNumber& );
384 : :
385 : : /// Sfx item RES_FRAMEDIR
386 : : virtual void FormatFrameDirection( const SvxFrameDirectionItem& );
387 : :
388 : : /// Write the expanded field
389 : : virtual void WriteExpand( const SwField* pFld );
390 : :
391 : : virtual void RefField ( const SwField& rFld, const String& rRef );
392 : : virtual void HiddenField( const SwField& rFld );
393 : : virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd );
394 : : virtual void PostitField( const SwField* pFld );
395 : : virtual bool DropdownField( const SwField* pFld );
396 : :
397 : : virtual bool AnalyzeURL( const String& rURL, const String& rTarget, String* pLinkURL, String* pMark );
398 : :
399 : : /// Reference to the export, where to get the data from
400 : : WW8Export &m_rWW8Export;
401 : :
402 : : /// For output of styles.
403 : : ///
404 : : /// We have to remember these positions between the StartStyle() and
405 : : /// EndStyle().
406 : : sal_uInt16 nPOPosStdLen1, nPOPosStdLen2;
407 : :
408 : : /// For output of styles.
409 : : ///
410 : : /// We have to remember this position between StartStyleProperties() and
411 : : /// EndStyleProperties().
412 : : sal_uInt16 m_nStyleStartSize, m_nStyleLenPos;
413 : :
414 : : /// For output of styles.
415 : : ///
416 : : /// Used between StartStyles() and EndStyles().
417 : : sal_uLong m_nStyAnzPos;
418 : :
419 : : /// For output of run properties.
420 : : ///
421 : : /// We have to remember the number of field results, and do not export end
422 : : /// of the field results if we were forced to split text.
423 : : sal_uInt16 m_nFieldResults;
424 : :
425 : : public:
426 : 9 : WW8AttributeOutput( WW8Export &rWW8Export ) : AttributeOutputBase(), m_rWW8Export( rWW8Export ) {}
427 [ - + ]: 18 : virtual ~WW8AttributeOutput() {}
428 : :
429 : : /// Return the right export class.
430 : 87 : virtual WW8Export& GetExport() { return m_rWW8Export; }
431 : : const WW8Export& GetExport() const { return m_rWW8Export; }
432 : :
433 : : protected:
434 : : /// Output the bold etc. attributes
435 : : void OutputWW8Attribute( sal_uInt8 nId, bool bVal );
436 : :
437 : : /// Output the bold etc. attributes, the Complex Text Layout version
438 : : void OutputWW8AttributeCTL( sal_uInt8 nId, bool bVal );
439 : :
440 : : };
441 : :
442 : : #endif // _WW8ATTRIBUTEOUTPUT_HXX_
443 : :
444 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|