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 _DOCXATTRIBUTEOUTPUT_HXX_
21 : #define _DOCXATTRIBUTEOUTPUT_HXX_
22 :
23 : #include "attributeoutputbase.hxx"
24 : #include "fields.hxx"
25 : #include "IMark.hxx"
26 : #include "docxexport.hxx"
27 :
28 : #include <sax/fshelper.hxx>
29 : #include <sax/fastattribs.hxx>
30 : #include <vcl/vclenum.hxx>
31 :
32 : #include <fldbas.hxx>
33 :
34 : #include <vector>
35 : #include <boost/scoped_ptr.hpp>
36 : #include <oox/export/vmlexport.hxx>
37 :
38 : class SwGrfNode;
39 : class SdrObject;
40 :
41 : namespace docx { class FootnotesList; }
42 : namespace oox { namespace drawingml { class DrawingML; } }
43 :
44 12 : struct FieldInfos
45 : {
46 : const SwField* pField;
47 : const ::sw::mark::IFieldmark* pFieldmark;
48 : ww::eField eType;
49 : bool bOpen;
50 : bool bClose;
51 : String sCmd;
52 4 : FieldInfos() : pField(NULL), pFieldmark(NULL), eType(ww::eUNKNOWN), bOpen(false), bClose(false){}
53 : };
54 :
55 : enum DocxColBreakStatus
56 : {
57 : COLBRK_NONE,
58 : COLBRK_POSTPONE,
59 : COLBRK_WRITE
60 : };
61 :
62 : /// The class that has handlers for various resource types when exporting as DOCX.
63 : class DocxAttributeOutput : public AttributeOutputBase, public oox::vml::VMLTextExport
64 : {
65 : public:
66 : /// Export the state of RTL/CJK.
67 : virtual void RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript );
68 :
69 : /// Start of the paragraph.
70 : virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo );
71 :
72 : /// End of the paragraph.
73 : virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner );
74 :
75 : /// Empty paragraph.
76 : virtual void EmptyParagraph();
77 :
78 : /// Called before we start outputting the attributes.
79 : virtual void StartParagraphProperties( const SwTxtNode& rNode );
80 :
81 : /// Called after we end outputting the attributes.
82 : virtual void EndParagraphProperties();
83 :
84 : /// Start of the text run.
85 : virtual void StartRun( const SwRedlineData* pRedlineData, bool bSingleEmptyRun = false );
86 :
87 : /// End of the text run.
88 : virtual void EndRun();
89 :
90 : /// Called before we start outputting the attributes.
91 : virtual void StartRunProperties();
92 :
93 : /// Called after we end outputting the attributes.
94 : virtual void EndRunProperties( const SwRedlineData* pRedlineData );
95 :
96 : virtual void FootnoteEndnoteRefTag();
97 :
98 : virtual void SectFootnoteEndnotePr();
99 :
100 : virtual void WritePostitFieldReference();
101 :
102 : virtual void WritePostitFieldStart();
103 :
104 : virtual void WritePostitFieldEnd();
105 :
106 : /// Output text (inside a run).
107 : virtual void RunText( const String& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8 );
108 :
109 : /// Output text (without markup).
110 : virtual void RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet );
111 :
112 : /// Output ruby start.
113 : virtual void StartRuby( const SwTxtNode& rNode, xub_StrLen nPos, const SwFmtRuby& rRuby );
114 :
115 : /// Output ruby end.
116 : virtual void EndRuby();
117 :
118 : /// Output URL start.
119 : virtual bool StartURL( const String& rUrl, const String& rTarget );
120 :
121 : /// Output URL end.
122 : virtual bool EndURL();
123 :
124 : virtual void FieldVanish( const String& rTxt, ww::eField eType );
125 :
126 : /// Output redlining.
127 : ///
128 : /// The common attribute that can be among the run properties.
129 : virtual void Redline( const SwRedlineData* pRedline );
130 :
131 : /// Output redlining.
132 : ///
133 : /// Start of the tag that encloses the run, fills the info according to
134 : /// the value of m_pRedlineData.
135 : void StartRedline();
136 :
137 : /// Output redlining.
138 : ///
139 : /// End of the tag that encloses the run.
140 : void EndRedline();
141 :
142 : virtual void FormatDrop( const SwTxtNode& rNode, const SwFmtDrop& rSwFmtDrop, sal_uInt16 nStyle, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner );
143 :
144 : /// Output style.
145 : virtual void ParagraphStyle( sal_uInt16 nStyle );
146 :
147 : virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
148 : virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
149 : virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
150 : virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
151 : virtual void TableDefaultCellMargins( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner, sal_Int32& tblIndent );
152 : virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
153 : virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
154 : virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
155 : virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
156 : virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
157 : virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo );
158 : virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner );
159 : virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
160 : virtual void TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
161 : virtual void TableRowEnd( sal_uInt32 nDepth = 1 );
162 :
163 : /// Start of the styles table.
164 : virtual void StartStyles();
165 :
166 : /// End of the styles table.
167 : virtual void EndStyles( sal_uInt16 nNumberOfStyles );
168 :
169 : /// Write default style.
170 : virtual void DefaultStyle( sal_uInt16 nStyle );
171 :
172 : /// Start of a style in the styles table.
173 : virtual void StartStyle( const String& rName, bool bPapFmt,
174 : sal_uInt16 nBase, sal_uInt16 nNext, sal_uInt16 nWwId, sal_uInt16 nId,
175 : bool bAutoUpdate );
176 :
177 : /// End of a style in the styles table.
178 : virtual void EndStyle();
179 :
180 : /// Start of (paragraph or run) properties of a style.
181 : virtual void StartStyleProperties( bool bParProp, sal_uInt16 nStyle );
182 :
183 : /// End of (paragraph or run) properties of a style.
184 : virtual void EndStyleProperties( bool bParProp );
185 :
186 : /// Numbering rule and Id.
187 : virtual void OutlineNumbering( sal_uInt8 nLvl, const SwNumFmt &rNFmt, const SwFmt &rFmt );
188 :
189 : /// Page break
190 : /// As a paragraph property - the paragraph should be on the next page.
191 : virtual void PageBreakBefore( bool bBreak );
192 :
193 : /// Write a section break
194 : /// msword::ColumnBreak or msword::PageBreak
195 : virtual void SectionBreak( sal_uInt8 nC, const WW8_SepInfo* pSectionInfo = NULL );
196 :
197 : /// Start of the section properties.
198 : virtual void StartSection();
199 :
200 : /// End of the section properties.
201 : virtual void EndSection();
202 :
203 : /// Protection of forms.
204 : virtual void SectionFormProtection( bool bProtected );
205 :
206 : /// Numbering of the lines in the document.
207 : virtual void SectionLineNumbering( sal_uLong nRestartNo, const SwLineNumberInfo& rLnNumInfo );
208 :
209 : /// Has different headers/footers for the title page.
210 : virtual void SectionTitlePage();
211 :
212 : /// Description of the page borders.
213 : virtual void SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* pFirstPageFmt );
214 :
215 : /// Columns populated from right/numbers on the right side?
216 : virtual void SectionBiDi( bool bBiDi );
217 :
218 : /// The style of the page numbers.
219 : ///
220 : /// nPageRestartNumberr being 0 means no restart.
221 : virtual void SectionPageNumbering( sal_uInt16 nNumType, sal_uInt16 nPageRestartNumber );
222 :
223 : /// The type of breaking.
224 : virtual void SectionType( sal_uInt8 nBreakCode );
225 :
226 : /// Start the font.
227 : void StartFont( const String& rFamilyName ) const;
228 :
229 : /// End the font.
230 : void EndFont() const;
231 :
232 : /// Alternate name for the font.
233 : void FontAlternateName( const String& rName ) const;
234 :
235 : /// Font charset.
236 : void FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEncoding ) const;
237 :
238 : /// Font family.
239 : void FontFamilyType( FontFamily eFamily ) const;
240 :
241 : /// Font pitch.
242 : void FontPitchType( FontPitch ePitch ) const;
243 :
244 : /// Write out the font into the document, if it's an embedded font.
245 : void EmbedFont( const OUString& name );
246 :
247 : /// Definition of a numbering instance.
248 : virtual void NumberingDefinition( sal_uInt16 nId, const SwNumRule &rRule );
249 :
250 : /// Start of the abstract numbering definition instance.
251 : virtual void StartAbstractNumbering( sal_uInt16 nId );
252 :
253 : /// End of the abstract numbering definition instance.
254 : virtual void EndAbstractNumbering();
255 :
256 : /// All the numbering level information.
257 : virtual void NumberingLevel( sal_uInt8 nLevel,
258 : sal_uInt16 nStart,
259 : sal_uInt16 nNumberingType,
260 : SvxAdjust eAdjust,
261 : const sal_uInt8 *pNumLvlPos,
262 : sal_uInt8 nFollow,
263 : const wwFont *pFont,
264 : const SfxItemSet *pOutSet,
265 : sal_Int16 nIndentAt,
266 : sal_Int16 nFirstLineIndex,
267 : sal_Int16 nListTabPos,
268 : const String &rNumberingString );
269 :
270 : void WriteField_Impl( const SwField* pFld, ww::eField eType, const String& rFldCmd, sal_uInt8 nMode );
271 : void WriteFormData_Impl( const ::sw::mark::IFieldmark& rFieldmark );
272 :
273 : void WriteBookmarks_Impl( std::vector< rtl::OUString >& rStarts, std::vector< rtl::OUString >& rEnds );
274 :
275 : private:
276 : /// Initialize the structures where we are going to collect some of the paragraph properties.
277 : ///
278 : /// Some of the properties have to be collected from more sources, and are
279 : /// actually not written between StartParagraphProperties and
280 : /// EndParagraphProperties. They are output in this method, which is
281 : /// supposed to be called just before outputting </rPr> whenever it is done.
282 : void InitCollectedParagraphProperties();
283 :
284 : /// Output what we collected during the run properties output.
285 : ///
286 : /// @see WriteCollectedParagrapProperties().
287 : void WriteCollectedParagraphProperties();
288 :
289 : /// Initialize the structures where we are going to collect some of the run properties.
290 : ///
291 : /// This is an equivalent of InitCollectedParagraphProperties(), resp.
292 : /// WriteCollectectedParagraphProperties().
293 : ///
294 : /// @see InitCollectedParagraphProperties().
295 : void InitCollectedRunProperties();
296 :
297 : /// Output what we collected during the run properties output.
298 : ///
299 : /// @see InitCollectedRunProperies(), WriteCollectedParagraphProperties()
300 : void WriteCollectedRunProperties();
301 :
302 : /// Output graphic fly frames or replacement graphics for OLE nodes.
303 : ///
304 : /// For graphic frames, just use the first two parameters, for OLE
305 : /// replacement graphics, set the first as 0, and pass the remaining three.
306 : ///
307 : /// @see WriteOLE2Obj()
308 : void FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size& rSize, const SwFlyFrmFmt* pOLEFrmFmt = 0, SwOLENode* pOLENode = 0);
309 : void WriteOLE2Obj( const SdrObject* pSdrObj, SwOLENode& rNode, const Size& rSize, const SwFlyFrmFmt* pFlyFrmFmt);
310 : bool WriteOLEChart( const SdrObject* pSdrObj, const Size& rSize );
311 : bool WriteOLEMath( const SdrObject* pSdrObj, const SwOLENode& rNode, const Size& rSize );
312 :
313 : void InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
314 : void StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
315 : void StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
316 : void StartTableCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
317 : void TableCellProperties( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
318 : void EndTableCell( );
319 : void EndTableRow( );
320 : void EndTable();
321 :
322 : /// End cell, row, and even the entire table if necessary.
323 : void FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t pInner, bool bForceEmptyParagraph = false );
324 :
325 : void WriteFFData( const FieldInfos& rInfos );
326 :
327 : void EmbedFontStyle( const OUString& name, int tag, const char* style );
328 :
329 : protected:
330 :
331 : /// Output frames - the implementation.
332 : virtual void OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point& rNdTopLeft );
333 :
334 : /// Sfx item Sfx item RES_CHRATR_CASEMAP
335 : virtual void CharCaseMap( const SvxCaseMapItem& rCaseMap );
336 :
337 : /// Sfx item Sfx item RES_CHRATR_COLOR
338 : virtual void CharColor( const SvxColorItem& rColor);
339 :
340 : /// Sfx item Sfx item RES_CHRATR_CONTOUR
341 : virtual void CharContour( const SvxContourItem& rContour );
342 :
343 : /// Sfx item RES_CHRATR_CROSSEDOUT
344 : virtual void CharCrossedOut( const SvxCrossedOutItem& rCrossedOut );
345 :
346 : /// Sfx item RES_CHRATR_ESCAPEMENT
347 : virtual void CharEscapement( const SvxEscapementItem& rEscapement );
348 :
349 : /// Sfx item RES_CHRATR_FONT
350 : virtual void CharFont( const SvxFontItem& rFont );
351 :
352 : /// Sfx item RES_CHRATR_FONTSIZE
353 : virtual void CharFontSize( const SvxFontHeightItem& rFontSize );
354 :
355 : /// Sfx item RES_CHRATR_KERNING
356 : virtual void CharKerning( const SvxKerningItem& rKerning );
357 :
358 : /// Sfx item RES_CHRATR_LANGUAGE
359 : virtual void CharLanguage( const SvxLanguageItem& rLanguage );
360 :
361 : /// Sfx item RES_CHRATR_POSTURE
362 : virtual void CharPosture( const SvxPostureItem& rPosture );
363 :
364 : /// Sfx item RES_CHRATR_SHADOWED
365 : virtual void CharShadow( const SvxShadowedItem& rShadow );
366 :
367 : /// Sfx item RES_CHRATR_UNDERLINE
368 : virtual void CharUnderline( const SvxUnderlineItem& rUnderline );
369 :
370 : /// Sfx item RES_CHRATR_WEIGHT
371 : virtual void CharWeight( const SvxWeightItem& rWeight );
372 :
373 : /// Sfx item RES_CHRATR_AUTOKERN
374 : virtual void CharAutoKern( const SvxAutoKernItem& );
375 :
376 : /// Sfx item RES_CHRATR_BLINK
377 : virtual void CharAnimatedText( const SvxBlinkItem& rBlink );
378 :
379 : /// Sfx item RES_CHRATR_BACKGROUND
380 : virtual void CharBackground( const SvxBrushItem& rBrush );
381 :
382 : /// Sfx item RES_CHRATR_CJK_FONT
383 : virtual void CharFontCJK( const SvxFontItem& rFont );
384 :
385 : /// Sfx item RES_CHRATR_CJK_FONTSIZE
386 0 : virtual void CharFontSizeCJK( const SvxFontHeightItem& rFontSize ) { CharFontSize( rFontSize ); }
387 :
388 : /// Sfx item RES_CHRATR_CJK_LANGUAGE
389 54 : virtual void CharLanguageCJK( const SvxLanguageItem& rLanguageItem ) { CharLanguage( rLanguageItem ); }
390 :
391 : /// Sfx item RES_CHRATR_CJK_POSTURE
392 : virtual void CharPostureCJK( const SvxPostureItem& rPosture );
393 :
394 : /// Sfx item RES_CHRATR_CJK_WEIGHT
395 : virtual void CharWeightCJK( const SvxWeightItem& rWeight );
396 :
397 : /// Sfx item RES_CHRATR_CTL_FONT
398 : virtual void CharFontCTL( const SvxFontItem& rFont );
399 :
400 : /// Sfx item RES_CHRATR_CTL_FONTSIZE
401 162 : virtual void CharFontSizeCTL( const SvxFontHeightItem& rFontSize ) { CharFontSize( rFontSize ); }
402 :
403 : /// Sfx item RES_CHRATR_CTL_LANGUAGE
404 54 : virtual void CharLanguageCTL( const SvxLanguageItem& rLanguageItem ) { CharLanguage( rLanguageItem); }
405 :
406 : /// Sfx item RES_CHRATR_CTL_POSTURE
407 : virtual void CharPostureCTL( const SvxPostureItem& rWeight );
408 :
409 : /// Sfx item RES_CHRATR_CTL_WEIGHT
410 : virtual void CharWeightCTL( const SvxWeightItem& rWeight );
411 :
412 : /// Sfx item RES_CHRATR_ROTATE
413 : virtual void CharRotate( const SvxCharRotateItem& rRotate );
414 :
415 : /// Sfx item RES_CHRATR_EMPHASIS_MARK
416 : virtual void CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasisMark );
417 :
418 : /// Sfx item RES_CHRATR_TWO_LINES
419 : virtual void CharTwoLines( const SvxTwoLinesItem& rTwoLines );
420 :
421 : /// Sfx item RES_CHRATR_SCALEW
422 : virtual void CharScaleWidth( const SvxCharScaleWidthItem& rScaleWidth );
423 :
424 : /// Sfx item RES_CHRATR_RELIEF
425 : virtual void CharRelief( const SvxCharReliefItem& rRelief);
426 :
427 : /// Sfx item RES_CHRATR_HIDDEN
428 : virtual void CharHidden( const SvxCharHiddenItem& rHidden );
429 :
430 : /// Sfx item RES_TXTATR_INETFMT
431 : virtual void TextINetFormat( const SwFmtINetFmt& );
432 :
433 : /// Sfx item RES_TXTATR_CHARFMT
434 : virtual void TextCharFormat( const SwFmtCharFmt& );
435 :
436 : /// Sfx item RES_TXTATR_FTN
437 : virtual void TextFootnote_Impl( const SwFmtFtn& );
438 :
439 : /// Output the footnote/endnote reference (if there's one to output).
440 : void FootnoteEndnoteReference();
441 :
442 : /// Sfx item RES_PARATR_LINESPACING
443 : virtual void ParaLineSpacing_Impl( short nSpace, short nMulti );
444 :
445 : /// Sfx item RES_PARATR_ADJUST
446 : virtual void ParaAdjust( const SvxAdjustItem& rAdjust );
447 :
448 : /// Sfx item RES_PARATR_SPLIT
449 : virtual void ParaSplit( const SvxFmtSplitItem& rSplit );
450 :
451 : /// Sfx item RES_PARATR_WIDOWS
452 : virtual void ParaWidows( const SvxWidowsItem& rWidows );
453 :
454 : /// Sfx item RES_PARATR_TABSTOP
455 : virtual void ParaTabStop( const SvxTabStopItem& rTabStop );
456 :
457 : /// Sfx item RES_PARATR_HYPHENZONE
458 : virtual void ParaHyphenZone( const SvxHyphenZoneItem& );
459 :
460 : /// Sfx item RES_PARATR_NUMRULE
461 : virtual void ParaNumRule_Impl( const SwTxtNode *pTxtNd, sal_Int32 nLvl, sal_Int32 nNumId );
462 :
463 : /// Sfx item RES_PARATR_SCRIPTSPACE
464 : virtual void ParaScriptSpace( const SfxBoolItem& );
465 :
466 : /// Sfx item RES_PARATR_VERTALIGN
467 : virtual void ParaVerticalAlign( const SvxParaVertAlignItem& rAlign );
468 :
469 : /// Sfx item RES_PARATR_SNAPTOGRID
470 : virtual void ParaSnapToGrid( const SvxParaGridItem& );
471 :
472 : /// Sfx item RES_FRM_SIZE
473 : virtual void FormatFrameSize( const SwFmtFrmSize& );
474 :
475 : /// Sfx item RES_PAPER_BIN
476 : virtual void FormatPaperBin( const SvxPaperBinItem& );
477 :
478 : /// Sfx item RES_LR_SPACE
479 : virtual void FormatLRSpace( const SvxLRSpaceItem& rLRSpace );
480 :
481 : /// Sfx item RES_UL_SPACE
482 : virtual void FormatULSpace( const SvxULSpaceItem& rULSpace );
483 :
484 : /// Sfx item RES_SURROUND
485 : virtual void FormatSurround( const SwFmtSurround& );
486 :
487 : /// Sfx item RES_VERT_ORIENT
488 : virtual void FormatVertOrientation( const SwFmtVertOrient& );
489 :
490 : /// Sfx item RES_HORI_ORIENT
491 : virtual void FormatHorizOrientation( const SwFmtHoriOrient& );
492 :
493 : /// Sfx item RES_ANCHOR
494 : virtual void FormatAnchor( const SwFmtAnchor& );
495 :
496 : /// Sfx item RES_BACKGROUND
497 : virtual void FormatBackground( const SvxBrushItem& );
498 :
499 : /// Sfx item RES_BOX
500 : virtual void FormatBox( const SvxBoxItem& );
501 :
502 : /// Sfx item RES_COL
503 : virtual void FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol & rCol, bool bEven, SwTwips nPageSize );
504 :
505 : /// Sfx item RES_KEEP
506 : virtual void FormatKeep( const SvxFmtKeepItem& );
507 :
508 : /// Sfx item RES_TEXTGRID
509 : virtual void FormatTextGrid( const SwTextGridItem& );
510 :
511 : /// Sfx item RES_LINENUMBER
512 : virtual void FormatLineNumbering( const SwFmtLineNumber& );
513 :
514 : /// Sfx item RES_FRAMEDIR
515 : virtual void FormatFrameDirection( const SvxFrameDirectionItem& );
516 :
517 : /// Write the expanded field
518 : virtual void WriteExpand( const SwField* pFld );
519 :
520 : virtual void RefField( const SwField& rFld, const String& rRef );
521 : virtual void HiddenField( const SwField& rFld );
522 : virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd );
523 : virtual void PostitField( const SwField* pFld );
524 : virtual bool DropdownField( const SwField* pFld );
525 :
526 : virtual bool AnalyzeURL( const String& rURL, const String& rTarget, String* pLinkURL, String* pMark );
527 :
528 : /// Reference to the export, where to get the data from
529 : DocxExport &m_rExport;
530 :
531 : /// Fast serializer to output the data
532 : ::sax_fastparser::FSHelperPtr m_pSerializer;
533 :
534 : /// DrawingML access
535 : oox::drawingml::DrawingML &m_rDrawingML;
536 :
537 : private:
538 :
539 : void DoWriteBookmarks( );
540 : void WritePostponedGraphic();
541 : void WritePostponedMath();
542 : void WriteCommentRanges();
543 :
544 : void StartField_Impl( FieldInfos& rInfos, bool bWriteRun = sal_False );
545 : void DoWriteCmd( String& rCmd );
546 : void CmdField_Impl( FieldInfos& rInfos );
547 : void EndField_Impl( FieldInfos& rInfos );
548 :
549 : ::sax_fastparser::FastAttributeList *m_pFontsAttrList, *m_pEastAsianLayoutAttrList;
550 : ::sax_fastparser::FastAttributeList *m_pCharLangAttrList;
551 : ::sax_fastparser::FastAttributeList *m_pSectionSpacingAttrList;
552 : ::sax_fastparser::FastAttributeList *m_pParagraphSpacingAttrList;
553 : ::sax_fastparser::FastAttributeList *m_pHyperlinkAttrList;
554 : ::sax_fastparser::FastAttributeList *m_pFlyAttrList;
555 :
556 : ::docx::FootnotesList *m_pFootnotesList;
557 : ::docx::FootnotesList *m_pEndnotesList;
558 : int m_footnoteEndnoteRefTag;
559 :
560 : boost::scoped_ptr< const WW8_SepInfo > m_pSectionInfo;
561 :
562 : /// Redline data to remember in the text run.
563 : const SwRedlineData *m_pRedlineData;
564 :
565 : /// Id of the redline
566 : sal_Int32 m_nRedlineId;
567 :
568 : /// Flag indicating that the section properties are being written
569 : bool m_bOpenedSectPr;
570 :
571 : /// Field data to remember in the text run
572 : std::vector< FieldInfos > m_Fields;
573 : String m_sFieldBkm;
574 : sal_Int32 m_nNextMarkId;
575 :
576 : /// Bookmarks to output
577 : std::vector<rtl::OString> m_rMarksStart;
578 : std::vector<rtl::OString> m_rMarksEnd;
579 :
580 : /// Is there a postit start to output?
581 : bool m_bPostitStart;
582 : /// Is there a postit end to output?
583 : bool m_bPostitEnd;
584 :
585 : /// Maps of the bookmarks ids
586 : std::map<rtl::OString, sal_uInt16> m_rOpenedMarksIds;
587 :
588 : /// The current table helper
589 : SwWriteTable *m_pTableWrt;
590 :
591 : /// Remember if we are in an open cell, or not.
592 : bool m_bTableCellOpen;
593 :
594 : /// Remember the current table depth.
595 : sal_uInt32 m_nTableDepth;
596 :
597 : bool m_bParagraphOpened;
598 :
599 : // Remember that a column break has to be opened at the
600 : // beginning of the next paragraph
601 : DocxColBreakStatus m_nColBreakStatus;
602 :
603 : sw::Frame *m_pParentFrame;
604 : // close of hyperlink needed
605 : bool m_closeHyperlinkInThisRun;
606 : bool m_closeHyperlinkInPreviousRun;
607 : bool m_startedHyperlink;
608 :
609 : struct PostponedGraphic
610 : {
611 0 : PostponedGraphic( const SwGrfNode* n, Size s ) : grfNode( n ), size( s ) {};
612 : const SwGrfNode* grfNode;
613 : Size size;
614 : };
615 : std::list< PostponedGraphic >* m_postponedGraphic;
616 : const SwOLENode* m_postponedMath;
617 : std::vector< const SwPostItField* > m_postitFields;
618 : unsigned int m_postitFieldsMaxId;
619 : int m_anchorId;
620 : int m_nextFontId;
621 :
622 : // Remember first cell (used for for default borders/margins) of each table
623 : std::vector<ww8::WW8TableNodeInfoInner::Pointer_t> tableFirstCells;
624 :
625 : public:
626 : DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML );
627 :
628 : virtual ~DocxAttributeOutput();
629 :
630 : /// Return the right export class.
631 : virtual DocxExport& GetExport();
632 336 : const DocxExport& GetExport() const { return const_cast< DocxAttributeOutput* >( this )->GetExport(); }
633 :
634 : /// For eg. the output of the styles, we need to switch the serializer to an other one.
635 196 : void SetSerializer( ::sax_fastparser::FSHelperPtr pSerializer ) { m_pSerializer = pSerializer; }
636 :
637 : /// Occasionnaly need to use this serializer from the outside
638 0 : ::sax_fastparser::FSHelperPtr GetSerializer( ) { return m_pSerializer; }
639 :
640 : /// Do we have any footnotes?
641 : bool HasFootnotes() const;
642 :
643 : /// Do we have any endnotes?
644 : bool HasEndnotes() const;
645 :
646 : /// Output the content of the footnotes.xml resp. endnotes.xml
647 : void FootnotesEndnotes( bool bFootnotes );
648 :
649 : /// writes the footnotePr/endnotePr (depending on tag) section
650 : void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr fs, int tag, const SwEndNoteInfo& info, int listtag );
651 :
652 : bool HasPostitFields() const;
653 : void WritePostitFields();
654 :
655 : /// VMLTextExport
656 : virtual void WriteOutliner(const OutlinerParaObject& rParaObj);
657 : virtual oox::drawingml::DrawingML& GetDrawingML();
658 : };
659 :
660 : #endif // _DOCXATTRIBUTEOUTPUT_HXX_
661 :
662 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|