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