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