1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <svl/itemset.hxx>
22 #include <scitems.hxx>
23 #include <svl/eitem.hxx>
24 #include <svl/intitem.hxx>
25 #include <svx/pageitem.hxx>
26 #include <editeng/sizeitem.hxx>
27 #include <editeng/lrspitem.hxx>
28 #include <editeng/ulspitem.hxx>
29 #include <editeng/brushitem.hxx>
30 #include <oox/export/utils.hxx>
31 #include <oox/token/tokens.hxx>
32 #include <sax/fastattribs.hxx>
33 #include <document.hxx>
34 #include <stlpool.hxx>
36 #include <xehelper.hxx>
37 #include <xeescher.hxx>
38 #include <xltools.hxx>
43 using namespace ::oox
;
46 using ::std::numeric_limits
;
48 // Page settings records ======================================================
50 // Header/footer --------------------------------------------------------------
52 XclExpHeaderFooter::XclExpHeaderFooter( sal_uInt16 nRecId
, const OUString
& rHdrString
) :
53 XclExpRecord( nRecId
),
54 maHdrString( rHdrString
)
58 void XclExpHeaderFooter::SaveXml( XclExpXmlStream
& rStrm
)
60 sax_fastparser::FSHelperPtr
& rWorksheet
= rStrm
.GetCurrentStream();
63 case EXC_ID_HEADER_FIRST
: nElement
= XML_firstHeader
; break;
64 case EXC_ID_FOOTER_FIRST
: nElement
= XML_firstFooter
; break;
65 case EXC_ID_HEADER_EVEN
: nElement
= XML_evenHeader
; break;
66 case EXC_ID_FOOTER_EVEN
: nElement
= XML_evenFooter
; break;
67 case EXC_ID_HEADER
: nElement
= XML_oddHeader
; break;
69 default: nElement
= XML_oddFooter
;
71 rWorksheet
->startElement(nElement
);
72 rWorksheet
->writeEscaped( maHdrString
);
73 rWorksheet
->endElement( nElement
);
76 void XclExpHeaderFooter::WriteBody( XclExpStream
& rStrm
)
78 if( !maHdrString
.isEmpty() )
80 XclExpString aExString
;
81 if( rStrm
.GetRoot().GetBiff() <= EXC_BIFF5
)
82 aExString
.AssignByte( maHdrString
, rStrm
.GetRoot().GetTextEncoding(), XclStrFlags::EightBitLength
);
84 aExString
.Assign( maHdrString
, XclStrFlags::NONE
, 255 ); // 16-bit length, but max 255 chars
89 // General page settings ------------------------------------------------------
91 XclExpSetup::XclExpSetup( const XclPageData
& rPageData
) :
92 XclExpRecord( EXC_ID_SETUP
, 34 ),
97 void XclExpSetup::SaveXml( XclExpXmlStream
& rStrm
)
99 rtl::Reference
<sax_fastparser::FastAttributeList
> pAttrList
= sax_fastparser::FastSerializerHelper::createAttrList();
100 if( rStrm
.getVersion() != oox::core::ISOIEC_29500_2008
||
101 mrData
.mnStrictPaperSize
!= EXC_PAPERSIZE_USER
)
103 pAttrList
->add( XML_paperSize
, OString::number( mrData
.mnPaperSize
).getStr() );
107 pAttrList
->add( XML_paperWidth
, OString::number( mrData
.mnPaperWidth
) + "mm" );
108 pAttrList
->add( XML_paperHeight
, OString::number( mrData
.mnPaperHeight
) + "mm" );
109 // pAttrList->add( XML_paperUnits, "mm" );
111 pAttrList
->add( XML_scale
, OString::number( mrData
.mnScaling
).getStr() );
112 pAttrList
->add( XML_fitToWidth
, OString::number( mrData
.mnFitToWidth
).getStr() );
113 pAttrList
->add( XML_fitToHeight
, OString::number( mrData
.mnFitToHeight
).getStr() );
114 pAttrList
->add( XML_pageOrder
, mrData
.mbPrintInRows
? "overThenDown" : "downThenOver" );
115 pAttrList
->add( XML_orientation
, mrData
.mbPortrait
? "portrait" : "landscape" ); // OOXTODO: "default"?
116 // tdf#48767 if XML_usePrinterDefaults field is exist, then XML_orientation is always "portrait" in MS Excel
117 // To resolve that import issue, if XML_usePrinterDefaults has default value (false) then XML_usePrinterDefaults is not added.
118 if ( !mrData
.mbValid
)
119 pAttrList
->add( XML_usePrinterDefaults
, ToPsz( !mrData
.mbValid
) );
120 pAttrList
->add( XML_blackAndWhite
, ToPsz( mrData
.mbBlackWhite
) );
121 pAttrList
->add( XML_draft
, ToPsz( mrData
.mbDraftQuality
) );
122 pAttrList
->add( XML_cellComments
, mrData
.mbPrintNotes
? "atEnd" : "none" ); // OOXTODO: "asDisplayed"?
124 if ( mrData
.mbManualStart
)
126 pAttrList
->add( XML_firstPageNumber
, OString::number( mrData
.mnStartPage
).getStr() );
127 pAttrList
->add( XML_useFirstPageNumber
, ToPsz( mrData
.mbManualStart
) );
129 // OOXTODO: XML_errors, // == displayed|blank|dash|NA
130 pAttrList
->add( XML_horizontalDpi
, OString::number( mrData
.mnHorPrintRes
).getStr() );
131 pAttrList
->add( XML_verticalDpi
, OString::number( mrData
.mnVerPrintRes
).getStr() );
132 pAttrList
->add( XML_copies
, OString::number( mrData
.mnCopies
).getStr() );
133 // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
135 rStrm
.GetCurrentStream()->singleElement( XML_pageSetup
, pAttrList
);
138 void XclExpSetup::WriteBody( XclExpStream
& rStrm
)
140 XclBiff eBiff
= rStrm
.GetRoot().GetBiff();
142 sal_uInt16 nFlags
= 0;
143 ::set_flag( nFlags
, EXC_SETUP_INROWS
, mrData
.mbPrintInRows
);
144 ::set_flag( nFlags
, EXC_SETUP_PORTRAIT
, mrData
.mbPortrait
);
145 ::set_flag( nFlags
, EXC_SETUP_INVALID
, !mrData
.mbValid
);
146 ::set_flag( nFlags
, EXC_SETUP_BLACKWHITE
, mrData
.mbBlackWhite
);
147 if( eBiff
>= EXC_BIFF5
)
149 ::set_flag( nFlags
, EXC_SETUP_DRAFT
, mrData
.mbDraftQuality
);
150 /* Set the Comments/Notes to "At end of sheet" if Print Notes is true.
151 We don't currently support "as displayed on sheet". Thus this value
152 will be re-interpreted to "At end of sheet". */
153 const sal_uInt16 nNotes
= EXC_SETUP_PRINTNOTES
| EXC_SETUP_NOTES_END
;
154 ::set_flag( nFlags
, nNotes
, mrData
.mbPrintNotes
);
155 ::set_flag( nFlags
, EXC_SETUP_STARTPAGE
, mrData
.mbManualStart
);
158 rStrm
<< mrData
.mnPaperSize
<< mrData
.mnScaling
<< mrData
.mnStartPage
159 << mrData
.mnFitToWidth
<< mrData
.mnFitToHeight
<< nFlags
;
160 if( eBiff
>= EXC_BIFF5
)
162 rStrm
<< mrData
.mnHorPrintRes
<< mrData
.mnVerPrintRes
163 << mrData
.mfHeaderMargin
<< mrData
.mfFooterMargin
<< mrData
.mnCopies
;
167 // Manual page breaks ---------------------------------------------------------
169 XclExpPageBreaks::XclExpPageBreaks( sal_uInt16 nRecId
, const ScfUInt16Vec
& rPageBreaks
, sal_uInt16 nMaxPos
) :
170 XclExpRecord( nRecId
),
171 mrPageBreaks( rPageBreaks
),
176 void XclExpPageBreaks::Save( XclExpStream
& rStrm
)
178 if( !mrPageBreaks
.empty() )
180 SetRecSize( 2 + ((rStrm
.GetRoot().GetBiff() <= EXC_BIFF5
) ? 2 : 6) * mrPageBreaks
.size() );
181 XclExpRecord::Save( rStrm
);
185 void XclExpPageBreaks::WriteBody( XclExpStream
& rStrm
)
187 bool bWriteRange
= (rStrm
.GetRoot().GetBiff() == EXC_BIFF8
);
189 rStrm
<< static_cast< sal_uInt16
>( mrPageBreaks
.size() );
190 for( const auto& rPageBreak
: mrPageBreaks
)
194 rStrm
<< sal_uInt16( 0 ) << mnMaxPos
;
198 void XclExpPageBreaks::SaveXml( XclExpXmlStream
& rStrm
)
200 if( mrPageBreaks
.empty() )
203 sal_Int32 nElement
= GetRecId() == EXC_ID_HORPAGEBREAKS
? XML_rowBreaks
: XML_colBreaks
;
204 sax_fastparser::FSHelperPtr
& pWorksheet
= rStrm
.GetCurrentStream();
205 OString sNumPageBreaks
= OString::number( mrPageBreaks
.size() );
206 pWorksheet
->startElement( nElement
,
207 XML_count
, sNumPageBreaks
,
208 XML_manualBreakCount
, sNumPageBreaks
);
209 for( const auto& rPageBreak
: mrPageBreaks
)
211 pWorksheet
->singleElement( XML_brk
,
212 XML_id
, OString::number(rPageBreak
),
214 XML_max
, OString::number(mnMaxPos
),
216 // OOXTODO: XML_pt, ""
219 pWorksheet
->endElement( nElement
);
222 // Page settings ==============================================================
224 XclExpPageSettings::XclExpPageSettings( const XclExpRoot
& rRoot
) :
227 ScDocument
& rDoc
= GetDoc();
228 SCTAB nScTab
= GetCurrScTab();
230 if( SfxStyleSheetBase
* pStyleSheet
= GetStyleSheetPool().Find( rDoc
.GetPageStyle( nScTab
), SfxStyleFamily::Page
) )
232 const SfxItemSet
& rItemSet
= pStyleSheet
->GetItemSet();
233 maData
.mbValid
= true;
235 // *** page settings ***
237 maData
.mbPrintInRows
= ! rItemSet
.Get( ATTR_PAGE_TOPDOWN
).GetValue();
238 maData
.mbHorCenter
= rItemSet
.Get( ATTR_PAGE_HORCENTER
).GetValue();
239 maData
.mbVerCenter
= rItemSet
.Get( ATTR_PAGE_VERCENTER
).GetValue();
240 maData
.mbPrintHeadings
= rItemSet
.Get( ATTR_PAGE_HEADERS
).GetValue();
241 maData
.mbPrintGrid
= rItemSet
.Get( ATTR_PAGE_GRID
).GetValue();
242 maData
.mbPrintNotes
= rItemSet
.Get( ATTR_PAGE_NOTES
).GetValue();
244 maData
.mnStartPage
= rItemSet
.Get( ATTR_PAGE_FIRSTPAGENO
).GetValue();
245 maData
.mbManualStart
= maData
.mnStartPage
&& (!nScTab
|| rDoc
.NeedPageResetAfterTab( nScTab
- 1 ));
247 const SvxLRSpaceItem
& rLRItem
= rItemSet
.Get( ATTR_LRSPACE
);
248 maData
.mfLeftMargin
= XclTools::GetInchFromTwips( rLRItem
.GetLeft() );
249 maData
.mfRightMargin
= XclTools::GetInchFromTwips( rLRItem
.GetRight() );
250 const SvxULSpaceItem
& rULItem
= rItemSet
.Get( ATTR_ULSPACE
);
251 maData
.mfTopMargin
= XclTools::GetInchFromTwips( rULItem
.GetUpper() );
252 maData
.mfBottomMargin
= XclTools::GetInchFromTwips( rULItem
.GetLower() );
254 const SvxPageItem
& rPageItem
= rItemSet
.Get( ATTR_PAGE
);
255 const SvxSizeItem
& rSizeItem
= rItemSet
.Get( ATTR_PAGE_SIZE
);
256 maData
.SetScPaperSize( rSizeItem
.GetSize(), !rPageItem
.IsLandscape() );
258 const ScPageScaleToItem
& rScaleToItem
= rItemSet
.Get( ATTR_PAGE_SCALETO
);
259 sal_uInt16 nPages
= rItemSet
.Get( ATTR_PAGE_SCALETOPAGES
).GetValue();
260 sal_uInt16 nScale
= rItemSet
.Get( ATTR_PAGE_SCALE
).GetValue();
262 if( ScfTools::CheckItem( rItemSet
, ATTR_PAGE_SCALETO
, false ) && rScaleToItem
.IsValid() )
264 maData
.mnFitToWidth
= rScaleToItem
.GetWidth();
265 maData
.mnFitToHeight
= rScaleToItem
.GetHeight();
266 maData
.mbFitToPages
= true;
268 else if( ScfTools::CheckItem( rItemSet
, ATTR_PAGE_SCALETOPAGES
, false ) && nPages
)
270 maData
.mnFitToWidth
= 1;
271 maData
.mnFitToHeight
= nPages
;
272 maData
.mbFitToPages
= true;
276 maData
.mnScaling
= nScale
;
277 maData
.mbFitToPages
= false;
280 maData
.mxBrushItem
.reset( new SvxBrushItem( rItemSet
.Get( ATTR_BACKGROUND
) ) );
281 maData
.mbUseEvenHF
= false;
282 maData
.mbUseFirstHF
= false;
284 // *** header and footer ***
286 XclExpHFConverter
aHFConv( GetRoot() );
289 const SfxItemSet
& rHdrItemSet
= rItemSet
.Get( ATTR_PAGE_HEADERSET
).GetItemSet();
290 if( rHdrItemSet
.Get( ATTR_PAGE_ON
).GetValue() )
292 const ScPageHFItem
& rHFItem
= rItemSet
.Get( ATTR_PAGE_HEADERRIGHT
);
293 aHFConv
.GenerateString( rHFItem
.GetLeftArea(), rHFItem
.GetCenterArea(), rHFItem
.GetRightArea() );
294 maData
.maHeader
= aHFConv
.GetHFString();
295 if ( rHdrItemSet
.HasItem(ATTR_PAGE_SHARED
) && !rHdrItemSet
.Get(ATTR_PAGE_SHARED
).GetValue())
297 const ScPageHFItem
& rHFItemLeft
= rItemSet
.Get( ATTR_PAGE_HEADERLEFT
);
298 aHFConv
.GenerateString( rHFItemLeft
.GetLeftArea(), rHFItemLeft
.GetCenterArea(), rHFItemLeft
.GetRightArea() );
299 maData
.maHeaderEven
= aHFConv
.GetHFString();
300 maData
.mbUseEvenHF
= true;
304 // If maData.mbUseEvenHF become true, then we will need a copy of maHeader in maHeaderEven.
305 maData
.maHeaderEven
= maData
.maHeader
;
307 if (rHdrItemSet
.HasItem(ATTR_PAGE_SHARED_FIRST
) && !rHdrItemSet
.Get(ATTR_PAGE_SHARED_FIRST
).GetValue())
309 const ScPageHFItem
& rHFItemFirst
= rItemSet
.Get( ATTR_PAGE_HEADERFIRST
);
310 aHFConv
.GenerateString( rHFItemFirst
.GetLeftArea(), rHFItemFirst
.GetCenterArea(), rHFItemFirst
.GetRightArea() );
311 maData
.maHeaderFirst
= aHFConv
.GetHFString();
312 maData
.mbUseFirstHF
= true;
316 maData
.maHeaderFirst
= maData
.maHeader
;
318 // header height (Excel excludes header from top margin)
319 sal_Int32 nHdrHeight
= rHdrItemSet
.Get( ATTR_PAGE_DYNAMIC
).GetValue() ?
320 // dynamic height: calculate header height, add header <-> sheet area distance
321 (aHFConv
.GetTotalHeight() + rHdrItemSet
.Get( ATTR_ULSPACE
).GetLower()) :
322 // static height: ATTR_PAGE_SIZE already includes header <-> sheet area distance
323 static_cast< sal_Int32
>( rHdrItemSet
.Get( ATTR_PAGE_SIZE
).GetSize().Height() );
324 maData
.mfHeaderMargin
= maData
.mfTopMargin
;
325 maData
.mfTopMargin
+= XclTools::GetInchFromTwips( nHdrHeight
);
329 const SfxItemSet
& rFtrItemSet
= rItemSet
.Get( ATTR_PAGE_FOOTERSET
).GetItemSet();
330 if( rFtrItemSet
.Get( ATTR_PAGE_ON
).GetValue() )
332 const ScPageHFItem
& rHFItem
= rItemSet
.Get( ATTR_PAGE_FOOTERRIGHT
);
333 aHFConv
.GenerateString( rHFItem
.GetLeftArea(), rHFItem
.GetCenterArea(), rHFItem
.GetRightArea() );
334 maData
.maFooter
= aHFConv
.GetHFString();
335 if (rFtrItemSet
.HasItem(ATTR_PAGE_SHARED
) && !rFtrItemSet
.Get(ATTR_PAGE_SHARED
).GetValue())
337 const ScPageHFItem
& rHFItemLeft
= rItemSet
.Get( ATTR_PAGE_FOOTERLEFT
);
338 aHFConv
.GenerateString( rHFItemLeft
.GetLeftArea(), rHFItemLeft
.GetCenterArea(), rHFItemLeft
.GetRightArea() );
339 maData
.maFooterEven
= aHFConv
.GetHFString();
340 maData
.mbUseEvenHF
= true;
344 maData
.maFooterEven
= maData
.maFooter
;
346 if (rFtrItemSet
.HasItem(ATTR_PAGE_SHARED_FIRST
) && !rFtrItemSet
.Get(ATTR_PAGE_SHARED_FIRST
).GetValue())
348 const ScPageHFItem
& rHFItemFirst
= rItemSet
.Get( ATTR_PAGE_FOOTERFIRST
);
349 aHFConv
.GenerateString( rHFItemFirst
.GetLeftArea(), rHFItemFirst
.GetCenterArea(), rHFItemFirst
.GetRightArea() );
350 maData
.maFooterFirst
= aHFConv
.GetHFString();
351 maData
.mbUseFirstHF
= true;
355 maData
.maFooterFirst
= maData
.maFooter
;
357 // footer height (Excel excludes footer from bottom margin)
358 sal_Int32 nFtrHeight
= rFtrItemSet
.Get( ATTR_PAGE_DYNAMIC
).GetValue() ?
359 // dynamic height: calculate footer height, add sheet area <-> footer distance
360 (aHFConv
.GetTotalHeight() + rFtrItemSet
.Get( ATTR_ULSPACE
).GetUpper()) :
361 // static height: ATTR_PAGE_SIZE already includes sheet area <-> footer distance
362 static_cast< sal_Int32
>( rFtrItemSet
.Get( ATTR_PAGE_SIZE
).GetSize().Height() );
363 maData
.mfFooterMargin
= maData
.mfBottomMargin
;
364 maData
.mfBottomMargin
+= XclTools::GetInchFromTwips( nFtrHeight
);
368 // *** page breaks ***
370 set
<SCROW
> aRowBreaks
;
371 rDoc
.GetAllRowBreaks(aRowBreaks
, nScTab
, false, true);
373 SCROW
const nMaxRow
= numeric_limits
<sal_uInt16
>::max();
374 for (const SCROW nRow
: aRowBreaks
)
379 maData
.maHorPageBreaks
.push_back(nRow
);
382 if (maData
.maHorPageBreaks
.size() > 1026)
384 // Excel allows only up to 1026 page breaks. Trim any excess page breaks.
385 ScfUInt16Vec::iterator itr
= maData
.maHorPageBreaks
.begin();
386 ::std::advance(itr
, 1026);
387 maData
.maHorPageBreaks
.erase(itr
, maData
.maHorPageBreaks
.end());
390 set
<SCCOL
> aColBreaks
;
391 rDoc
.GetAllColBreaks(aColBreaks
, nScTab
, false, true);
392 for (const auto& rColBreak
: aColBreaks
)
393 maData
.maVerPageBreaks
.push_back(rColBreak
);
398 class XclExpXmlStartHeaderFooterElementRecord
: public XclExpXmlElementRecord
401 explicit XclExpXmlStartHeaderFooterElementRecord(sal_Int32
const nElement
, bool const bDifferentOddEven
= false, bool const bDifferentFirst
= false)
402 : XclExpXmlElementRecord(nElement
), mbDifferentOddEven(bDifferentOddEven
), mbDifferentFirst(bDifferentFirst
) {}
404 virtual void SaveXml( XclExpXmlStream
& rStrm
) override
;
406 bool mbDifferentOddEven
;
407 bool mbDifferentFirst
;
412 void XclExpXmlStartHeaderFooterElementRecord::SaveXml(XclExpXmlStream
& rStrm
)
414 // OOXTODO: we currently only emit oddHeader/oddFooter elements, and
415 // do not support the first/even/odd page distinction.
416 sax_fastparser::FSHelperPtr
& rStream
= rStrm
.GetCurrentStream();
417 rStream
->startElement( mnElement
,
418 // OOXTODO: XML_alignWithMargins,
419 XML_differentFirst
, mbDifferentFirst
? "true" : "false",
420 XML_differentOddEven
, mbDifferentOddEven
? "true" : "false"
421 // OOXTODO: XML_scaleWithDoc
425 void XclExpPageSettings::Save( XclExpStream
& rStrm
)
427 XclExpBoolRecord( EXC_ID_PRINTHEADERS
, maData
.mbPrintHeadings
).Save( rStrm
);
428 XclExpBoolRecord( EXC_ID_PRINTGRIDLINES
, maData
.mbPrintGrid
).Save( rStrm
);
429 XclExpBoolRecord( EXC_ID_GRIDSET
, true ).Save( rStrm
);
430 XclExpPageBreaks( EXC_ID_HORPAGEBREAKS
, maData
.maHorPageBreaks
, static_cast< sal_uInt16
>( GetXclMaxPos().Col() ) ).Save( rStrm
);
431 XclExpPageBreaks( EXC_ID_VERPAGEBREAKS
, maData
.maVerPageBreaks
, static_cast< sal_uInt16
>( GetXclMaxPos().Row() ) ).Save( rStrm
);
432 XclExpHeaderFooter( EXC_ID_HEADER
, maData
.maHeader
).Save( rStrm
);
433 XclExpHeaderFooter( EXC_ID_FOOTER
, maData
.maFooter
).Save( rStrm
);
434 XclExpBoolRecord( EXC_ID_HCENTER
, maData
.mbHorCenter
).Save( rStrm
);
435 XclExpBoolRecord( EXC_ID_VCENTER
, maData
.mbVerCenter
).Save( rStrm
);
436 XclExpDoubleRecord( EXC_ID_LEFTMARGIN
, maData
.mfLeftMargin
).Save( rStrm
);
437 XclExpDoubleRecord( EXC_ID_RIGHTMARGIN
, maData
.mfRightMargin
).Save( rStrm
);
438 XclExpDoubleRecord( EXC_ID_TOPMARGIN
, maData
.mfTopMargin
).Save( rStrm
);
439 XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN
, maData
.mfBottomMargin
).Save( rStrm
);
440 XclExpSetup( maData
).Save( rStrm
);
442 if( (GetBiff() == EXC_BIFF8
) && maData
.mxBrushItem
)
443 if( const Graphic
* pGraphic
= maData
.mxBrushItem
->GetGraphic() )
444 XclExpImgData( *pGraphic
, EXC_ID8_IMGDATA
).Save( rStrm
);
447 void XclExpPageSettings::SaveXml( XclExpXmlStream
& rStrm
)
449 XclExpXmlStartSingleElementRecord( XML_printOptions
).SaveXml( rStrm
);
450 XclExpBoolRecord( EXC_ID_PRINTHEADERS
, maData
.mbPrintHeadings
, XML_headings
).SaveXml( rStrm
);
451 XclExpBoolRecord( EXC_ID_PRINTGRIDLINES
, maData
.mbPrintGrid
, XML_gridLines
).SaveXml( rStrm
);
452 XclExpBoolRecord( EXC_ID_GRIDSET
, true, XML_gridLinesSet
).SaveXml( rStrm
);
453 XclExpBoolRecord( EXC_ID_HCENTER
, maData
.mbHorCenter
, XML_horizontalCentered
).SaveXml( rStrm
);
454 XclExpBoolRecord( EXC_ID_VCENTER
, maData
.mbVerCenter
, XML_verticalCentered
).SaveXml( rStrm
);
455 XclExpXmlEndSingleElementRecord().SaveXml( rStrm
); // XML_printOptions
457 XclExpXmlStartSingleElementRecord( XML_pageMargins
).SaveXml( rStrm
);
458 XclExpDoubleRecord( EXC_ID_LEFTMARGIN
, maData
.mfLeftMargin
).SetAttribute( XML_left
)->SaveXml( rStrm
);
459 XclExpDoubleRecord( EXC_ID_RIGHTMARGIN
, maData
.mfRightMargin
).SetAttribute( XML_right
)->SaveXml( rStrm
);
460 XclExpDoubleRecord( EXC_ID_TOPMARGIN
, maData
.mfTopMargin
).SetAttribute( XML_top
)->SaveXml( rStrm
);
461 XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN
, maData
.mfBottomMargin
).SetAttribute( XML_bottom
)->SaveXml( rStrm
);
462 XclExpDoubleRecord( 0, maData
.mfHeaderMargin
).SetAttribute( XML_header
)->SaveXml( rStrm
);
463 XclExpDoubleRecord( 0, maData
.mfFooterMargin
).SetAttribute( XML_footer
)->SaveXml( rStrm
);
464 XclExpXmlEndSingleElementRecord().SaveXml( rStrm
); // XML_pageMargins
466 XclExpSetup( maData
).SaveXml( rStrm
);
468 XclExpXmlStartHeaderFooterElementRecord(XML_headerFooter
, maData
.mbUseEvenHF
, maData
.mbUseFirstHF
).SaveXml(rStrm
);
469 XclExpHeaderFooter( EXC_ID_HEADER
, maData
.maHeader
).SaveXml( rStrm
);
470 XclExpHeaderFooter( EXC_ID_FOOTER
, maData
.maFooter
).SaveXml( rStrm
);
471 if (maData
.mbUseEvenHF
)
473 XclExpHeaderFooter( EXC_ID_HEADER_EVEN
, maData
.maHeaderEven
).SaveXml( rStrm
);
474 XclExpHeaderFooter( EXC_ID_FOOTER_EVEN
, maData
.maFooterEven
).SaveXml( rStrm
);
476 if (maData
.mbUseFirstHF
)
478 XclExpHeaderFooter( EXC_ID_HEADER_FIRST
, maData
.maHeaderFirst
).SaveXml( rStrm
);
479 XclExpHeaderFooter( EXC_ID_FOOTER_FIRST
, maData
.maFooterFirst
).SaveXml( rStrm
);
481 XclExpXmlEndElementRecord( XML_headerFooter
).SaveXml( rStrm
);
483 XclExpPageBreaks( EXC_ID_HORPAGEBREAKS
, maData
.maHorPageBreaks
,
484 static_cast< sal_uInt16
>( GetXclMaxPos().Col() ) ).SaveXml( rStrm
);
485 XclExpPageBreaks( EXC_ID_VERPAGEBREAKS
, maData
.maVerPageBreaks
,
486 static_cast< sal_uInt16
>( GetXclMaxPos().Row() ) ).SaveXml( rStrm
);
489 XclExpImgData
* XclExpPageSettings::getGraphicExport()
491 if( const Graphic
* pGraphic
= maData
.mxBrushItem
->GetGraphic() )
492 return new XclExpImgData( *pGraphic
, EXC_ID8_IMGDATA
);
497 XclExpChartPageSettings::XclExpChartPageSettings( const XclExpRoot
& rRoot
) :
502 void XclExpChartPageSettings::Save( XclExpStream
& rStrm
)
504 XclExpHeaderFooter( EXC_ID_HEADER
, maData
.maHeader
).Save( rStrm
);
505 XclExpHeaderFooter( EXC_ID_FOOTER
, maData
.maFooter
).Save( rStrm
);
506 XclExpBoolRecord( EXC_ID_HCENTER
, maData
.mbHorCenter
).Save( rStrm
);
507 XclExpBoolRecord( EXC_ID_VCENTER
, maData
.mbVerCenter
).Save( rStrm
);
508 XclExpSetup( maData
).Save( rStrm
);
509 XclExpUInt16Record( EXC_ID_PRINTSIZE
, EXC_PRINTSIZE_FULL
).Save( rStrm
);
512 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */