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