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 :
21 : #include "xepage.hxx"
22 : #include <svl/itemset.hxx>
23 : #include "scitems.hxx"
24 : #include <svl/eitem.hxx>
25 : #include <svl/intitem.hxx>
26 : #include <svx/pageitem.hxx>
27 : #include <editeng/sizeitem.hxx>
28 : #include <editeng/lrspitem.hxx>
29 : #include <editeng/ulspitem.hxx>
30 : #include <editeng/brushitem.hxx>
31 : #include "document.hxx"
32 : #include "stlpool.hxx"
33 : #include "stlsheet.hxx"
34 : #include "attrib.hxx"
35 : #include "xehelper.hxx"
36 : #include "xeescher.hxx"
37 :
38 : #include <set>
39 : #include <limits>
40 :
41 : using namespace ::oox;
42 :
43 : using ::std::set;
44 : using ::std::numeric_limits;
45 :
46 : // Page settings records ======================================================
47 :
48 : // Header/footer --------------------------------------------------------------
49 :
50 0 : XclExpHeaderFooter::XclExpHeaderFooter( sal_uInt16 nRecId, const OUString& rHdrString ) :
51 : XclExpRecord( nRecId ),
52 0 : maHdrString( rHdrString )
53 : {
54 0 : }
55 :
56 0 : void XclExpHeaderFooter::SaveXml( XclExpXmlStream& rStrm )
57 : {
58 0 : sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
59 0 : sal_Int32 nElement = GetRecId() == EXC_ID_HEADER ? XML_oddHeader : XML_oddFooter;
60 0 : rWorksheet->startElement( nElement, FSEND );
61 0 : rWorksheet->writeEscaped( maHdrString );
62 0 : rWorksheet->endElement( nElement );
63 0 : }
64 :
65 0 : void XclExpHeaderFooter::WriteBody( XclExpStream& rStrm )
66 : {
67 0 : if( !maHdrString.isEmpty() )
68 : {
69 0 : XclExpString aExString;
70 0 : if( rStrm.GetRoot().GetBiff() <= EXC_BIFF5 )
71 0 : aExString.AssignByte( maHdrString, rStrm.GetRoot().GetTextEncoding(), EXC_STR_8BITLENGTH );
72 : else
73 0 : aExString.Assign( maHdrString, EXC_STR_DEFAULT, 255 ); // 16-bit length, but max 255 chars
74 0 : rStrm << aExString;
75 : }
76 0 : }
77 :
78 : // General page settings ------------------------------------------------------
79 :
80 0 : XclExpSetup::XclExpSetup( const XclPageData& rPageData ) :
81 : XclExpRecord( EXC_ID_SETUP, 34 ),
82 0 : mrData( rPageData )
83 : {
84 0 : }
85 :
86 0 : void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
87 : {
88 0 : sax_fastparser::FastAttributeList* pAttrList=rStrm.GetCurrentStream()->createAttrList();
89 0 : if( rStrm.getVersion() != oox::core::ISOIEC_29500_2008 ||
90 0 : mrData.mnStrictPaperSize != EXC_PAPERSIZE_USER )
91 : {
92 0 : pAttrList->add( XML_paperSize, OString::number( mrData.mnPaperSize ).getStr() );
93 : }
94 : else
95 : {
96 0 : pAttrList->add( XML_paperWidth, OString::number( mrData.mnPaperWidth ).concat(OString("mm")).getStr() );
97 0 : pAttrList->add( XML_paperHeight, OString::number( mrData.mnPaperHeight ).concat(OString("mm")).getStr() );
98 : // pAttrList->add( XML_paperUnits, "mm" );
99 : }
100 0 : pAttrList->add( XML_scale, OString::number( mrData.mnScaling ).getStr() );
101 0 : pAttrList->add( XML_firstPageNumber, OString::number( mrData.mnStartPage ).getStr() );
102 0 : pAttrList->add( XML_fitToWidth, OString::number( mrData.mnFitToWidth ).getStr() );
103 0 : pAttrList->add( XML_fitToHeight, OString::number( mrData.mnFitToHeight ).getStr() );
104 0 : pAttrList->add( XML_pageOrder, mrData.mbPrintInRows ? "overThenDown" : "downThenOver" );
105 0 : pAttrList->add( XML_orientation, mrData.mbPortrait ? "portrait" : "landscape" ); // OOXTODO: "default"?
106 0 : pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( !mrData.mbValid ) );
107 0 : pAttrList->add( XML_blackAndWhite, XclXmlUtils::ToPsz( mrData.mbBlackWhite ) );
108 0 : pAttrList->add( XML_draft, XclXmlUtils::ToPsz( mrData.mbDraftQuality ) );
109 0 : pAttrList->add( XML_cellComments, mrData.mbPrintNotes ? "atEnd" : "none" ); // OOXTODO: "asDisplayed"?
110 0 : pAttrList->add( XML_useFirstPageNumber, XclXmlUtils::ToPsz( mrData.mbManualStart ) );
111 : // OOXTODO: XML_errors, // == displayed|blank|dash|NA
112 0 : pAttrList->add( XML_horizontalDpi, OString::number( mrData.mnHorPrintRes ).getStr() );
113 0 : pAttrList->add( XML_verticalDpi, OString::number( mrData.mnVerPrintRes ).getStr() );
114 0 : pAttrList->add( XML_copies, OString::number( mrData.mnCopies ).getStr() );
115 : // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
116 :
117 0 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList > aAttrs(pAttrList);
118 0 : rStrm.GetCurrentStream()->singleElement( XML_pageSetup, aAttrs );
119 0 : }
120 :
121 0 : void XclExpSetup::WriteBody( XclExpStream& rStrm )
122 : {
123 0 : XclBiff eBiff = rStrm.GetRoot().GetBiff();
124 :
125 0 : sal_uInt16 nFlags = 0;
126 0 : ::set_flag( nFlags, EXC_SETUP_INROWS, mrData.mbPrintInRows );
127 0 : ::set_flag( nFlags, EXC_SETUP_PORTRAIT, mrData.mbPortrait );
128 0 : ::set_flag( nFlags, EXC_SETUP_INVALID, !mrData.mbValid );
129 0 : ::set_flag( nFlags, EXC_SETUP_BLACKWHITE, mrData.mbBlackWhite );
130 0 : if( eBiff >= EXC_BIFF5 )
131 : {
132 0 : ::set_flag( nFlags, EXC_SETUP_DRAFT, mrData.mbDraftQuality );
133 : /* Set the Comments/Notes to "At end of sheet" if Print Notes is true.
134 : We don't currently support "as displayed on sheet". Thus this value
135 : will be re-interpreted to "At end of sheet". */
136 0 : const sal_uInt16 nNotes = EXC_SETUP_PRINTNOTES | EXC_SETUP_NOTES_END;
137 0 : ::set_flag( nFlags, nNotes, mrData.mbPrintNotes );
138 0 : ::set_flag( nFlags, EXC_SETUP_STARTPAGE, mrData.mbManualStart );
139 : }
140 :
141 0 : rStrm << mrData.mnPaperSize << mrData.mnScaling << mrData.mnStartPage
142 0 : << mrData.mnFitToWidth << mrData.mnFitToHeight << nFlags;
143 0 : if( eBiff >= EXC_BIFF5 )
144 : {
145 0 : rStrm << mrData.mnHorPrintRes << mrData.mnVerPrintRes
146 0 : << mrData.mfHeaderMargin << mrData.mfFooterMargin << mrData.mnCopies;
147 : }
148 0 : }
149 :
150 : // Manual page breaks ---------------------------------------------------------
151 :
152 0 : XclExpPageBreaks::XclExpPageBreaks( sal_uInt16 nRecId, const ScfUInt16Vec& rPageBreaks, sal_uInt16 nMaxPos ) :
153 : XclExpRecord( nRecId ),
154 : mrPageBreaks( rPageBreaks ),
155 0 : mnMaxPos( nMaxPos )
156 : {
157 0 : }
158 :
159 0 : void XclExpPageBreaks::Save( XclExpStream& rStrm )
160 : {
161 0 : if( !mrPageBreaks.empty() )
162 : {
163 0 : SetRecSize( 2 + ((rStrm.GetRoot().GetBiff() <= EXC_BIFF5) ? 2 : 6) * mrPageBreaks.size() );
164 0 : XclExpRecord::Save( rStrm );
165 : }
166 0 : }
167 :
168 0 : void XclExpPageBreaks::WriteBody( XclExpStream& rStrm )
169 : {
170 0 : bool bWriteRange = (rStrm.GetRoot().GetBiff() == EXC_BIFF8);
171 :
172 0 : rStrm << static_cast< sal_uInt16 >( mrPageBreaks.size() );
173 0 : for( ScfUInt16Vec::const_iterator aIt = mrPageBreaks.begin(), aEnd = mrPageBreaks.end(); aIt != aEnd; ++aIt )
174 : {
175 0 : rStrm << *aIt;
176 0 : if( bWriteRange )
177 0 : rStrm << sal_uInt16( 0 ) << mnMaxPos;
178 : }
179 0 : }
180 :
181 0 : void XclExpPageBreaks::SaveXml( XclExpXmlStream& rStrm )
182 : {
183 0 : if( mrPageBreaks.empty() )
184 0 : return;
185 :
186 0 : sal_Int32 nElement = GetRecId() == EXC_ID_HORPAGEBREAKS ? XML_rowBreaks : XML_colBreaks;
187 0 : sax_fastparser::FSHelperPtr& pWorksheet = rStrm.GetCurrentStream();
188 0 : OString sNumPageBreaks = OString::number( mrPageBreaks.size() );
189 : pWorksheet->startElement( nElement,
190 : XML_count, sNumPageBreaks.getStr(),
191 : XML_manualBreakCount, sNumPageBreaks.getStr(),
192 0 : FSEND );
193 0 : for( ScfUInt16Vec::const_iterator aIt = mrPageBreaks.begin(), aEnd = mrPageBreaks.end(); aIt != aEnd; ++aIt )
194 : {
195 : pWorksheet->singleElement( XML_brk,
196 0 : XML_id, OString::number( *aIt ).getStr(),
197 : XML_man, "true",
198 : XML_max, OString::number( mnMaxPos ).getStr(),
199 : XML_min, "0",
200 : // OOXTODO: XML_pt, "",
201 0 : FSEND );
202 : }
203 0 : pWorksheet->endElement( nElement );
204 : }
205 :
206 : // Page settings ==============================================================
207 :
208 0 : XclExpPageSettings::XclExpPageSettings( const XclExpRoot& rRoot ) :
209 0 : XclExpRoot( rRoot )
210 : {
211 0 : ScDocument& rDoc = GetDoc();
212 0 : SCTAB nScTab = GetCurrScTab();
213 :
214 0 : if( SfxStyleSheetBase* pStyleSheet = GetStyleSheetPool().Find( rDoc.GetPageStyle( nScTab ), SFX_STYLE_FAMILY_PAGE ) )
215 : {
216 0 : const SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
217 0 : maData.mbValid = true;
218 :
219 : // *** page settings ***
220 :
221 0 : maData.mbPrintInRows = !GETITEMBOOL( rItemSet, ATTR_PAGE_TOPDOWN );
222 0 : maData.mbHorCenter = GETITEMBOOL( rItemSet, ATTR_PAGE_HORCENTER );
223 0 : maData.mbVerCenter = GETITEMBOOL( rItemSet, ATTR_PAGE_VERCENTER );
224 0 : maData.mbPrintHeadings = GETITEMBOOL( rItemSet, ATTR_PAGE_HEADERS );
225 0 : maData.mbPrintGrid = GETITEMBOOL( rItemSet, ATTR_PAGE_GRID );
226 0 : maData.mbPrintNotes = GETITEMBOOL( rItemSet, ATTR_PAGE_NOTES );
227 :
228 0 : maData.mnStartPage = GETITEMVALUE( rItemSet, SfxUInt16Item, ATTR_PAGE_FIRSTPAGENO, sal_uInt16 );
229 0 : maData.mbManualStart = maData.mnStartPage && (!nScTab || rDoc.NeedPageResetAfterTab( nScTab - 1 ));
230 :
231 0 : const SvxLRSpaceItem& rLRItem = GETITEM( rItemSet, SvxLRSpaceItem, ATTR_LRSPACE );
232 0 : maData.mfLeftMargin = XclTools::GetInchFromTwips( rLRItem.GetLeft() );
233 0 : maData.mfRightMargin = XclTools::GetInchFromTwips( rLRItem.GetRight() );
234 0 : const SvxULSpaceItem& rULItem = GETITEM( rItemSet, SvxULSpaceItem, ATTR_ULSPACE );
235 0 : maData.mfTopMargin = XclTools::GetInchFromTwips( rULItem.GetUpper() );
236 0 : maData.mfBottomMargin = XclTools::GetInchFromTwips( rULItem.GetLower() );
237 :
238 0 : const SvxPageItem& rPageItem = GETITEM( rItemSet, SvxPageItem, ATTR_PAGE );
239 0 : const SvxSizeItem& rSizeItem = GETITEM( rItemSet, SvxSizeItem, ATTR_PAGE_SIZE );
240 0 : maData.SetScPaperSize( rSizeItem.GetSize(), !rPageItem.IsLandscape() );
241 :
242 0 : const ScPageScaleToItem& rScaleToItem = GETITEM( rItemSet, ScPageScaleToItem, ATTR_PAGE_SCALETO );
243 0 : sal_uInt16 nPages = GETITEMVALUE( rItemSet, SfxUInt16Item, ATTR_PAGE_SCALETOPAGES, sal_uInt16 );
244 0 : sal_uInt16 nScale = GETITEMVALUE( rItemSet, SfxUInt16Item, ATTR_PAGE_SCALE, sal_uInt16 );
245 :
246 0 : if( ScfTools::CheckItem( rItemSet, ATTR_PAGE_SCALETO, false ) && rScaleToItem.IsValid() )
247 : {
248 0 : maData.mnFitToWidth = rScaleToItem.GetWidth();
249 0 : maData.mnFitToHeight = rScaleToItem.GetHeight();
250 0 : maData.mbFitToPages = true;
251 :
252 : }
253 0 : else if( ScfTools::CheckItem( rItemSet, ATTR_PAGE_SCALETOPAGES, false ) && nPages )
254 : {
255 0 : maData.mnFitToWidth = 1;
256 0 : maData.mnFitToHeight = nPages;
257 0 : maData.mbFitToPages = true;
258 : }
259 0 : else if( nScale )
260 : {
261 0 : maData.mnScaling = nScale;
262 0 : maData.mbFitToPages = false;
263 : }
264 :
265 0 : maData.mxBrushItem.reset( new SvxBrushItem( GETITEM( rItemSet, SvxBrushItem, ATTR_BACKGROUND ) ) );
266 :
267 : // *** header and footer ***
268 :
269 0 : XclExpHFConverter aHFConv( GetRoot() );
270 :
271 : // header
272 0 : const SfxItemSet& rHdrItemSet = GETITEM( rItemSet, SvxSetItem, ATTR_PAGE_HEADERSET ).GetItemSet();
273 0 : if( GETITEMBOOL( rHdrItemSet, ATTR_PAGE_ON ) )
274 : {
275 0 : const ScPageHFItem& rHFItem = GETITEM( rItemSet, ScPageHFItem, ATTR_PAGE_HEADERRIGHT );
276 0 : aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
277 0 : maData.maHeader = aHFConv.GetHFString();
278 : // header height (Excel excludes header from top margin)
279 0 : sal_Int32 nHdrHeight = GETITEMBOOL( rHdrItemSet, ATTR_PAGE_DYNAMIC ) ?
280 : // dynamic height: calculate header height, add header <-> sheet area distance
281 0 : (aHFConv.GetTotalHeight() + GETITEM( rHdrItemSet, SvxULSpaceItem, ATTR_ULSPACE ).GetLower()) :
282 : // static height: ATTR_PAGE_SIZE already includes header <-> sheet area distance
283 0 : static_cast< sal_Int32 >( GETITEM( rHdrItemSet, SvxSizeItem, ATTR_PAGE_SIZE ).GetSize().Height() );
284 0 : maData.mfHeaderMargin = maData.mfTopMargin;
285 0 : maData.mfTopMargin += XclTools::GetInchFromTwips( nHdrHeight );
286 : }
287 :
288 : // footer
289 0 : const SfxItemSet& rFtrItemSet = GETITEM( rItemSet, SvxSetItem, ATTR_PAGE_FOOTERSET ).GetItemSet();
290 0 : if( GETITEMBOOL( rFtrItemSet, ATTR_PAGE_ON ) )
291 : {
292 0 : const ScPageHFItem& rHFItem = GETITEM( rItemSet, ScPageHFItem, ATTR_PAGE_FOOTERRIGHT );
293 0 : aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
294 0 : maData.maFooter = aHFConv.GetHFString();
295 : // footer height (Excel excludes footer from bottom margin)
296 0 : sal_Int32 nFtrHeight = GETITEMBOOL( rFtrItemSet, ATTR_PAGE_DYNAMIC ) ?
297 : // dynamic height: calculate footer height, add sheet area <-> footer distance
298 0 : (aHFConv.GetTotalHeight() + GETITEM( rFtrItemSet, SvxULSpaceItem, ATTR_ULSPACE ).GetUpper()) :
299 : // static height: ATTR_PAGE_SIZE already includes sheet area <-> footer distance
300 0 : static_cast< sal_Int32 >( GETITEM( rFtrItemSet, SvxSizeItem, ATTR_PAGE_SIZE ).GetSize().Height() );
301 0 : maData.mfFooterMargin = maData.mfBottomMargin;
302 0 : maData.mfBottomMargin += XclTools::GetInchFromTwips( nFtrHeight );
303 0 : }
304 : }
305 :
306 : // *** page breaks ***
307 :
308 0 : set<SCROW> aRowBreaks;
309 0 : rDoc.GetAllRowBreaks(aRowBreaks, nScTab, false, true);
310 :
311 0 : SCROW nMaxRow = numeric_limits<sal_uInt16>::max();
312 0 : for (set<SCROW>::const_iterator itr = aRowBreaks.begin(), itrEnd = aRowBreaks.end(); itr != itrEnd; ++itr)
313 : {
314 0 : SCROW nRow = *itr;
315 0 : if (nRow > nMaxRow)
316 0 : break;
317 :
318 0 : maData.maHorPageBreaks.push_back(nRow);
319 : }
320 :
321 0 : if (maData.maHorPageBreaks.size() > 1026)
322 : {
323 : // Excel allows only up to 1026 page breaks. Trim any excess page breaks.
324 0 : ScfUInt16Vec::iterator itr = maData.maHorPageBreaks.begin();
325 0 : ::std::advance(itr, 1026);
326 0 : maData.maHorPageBreaks.erase(itr, maData.maHorPageBreaks.end());
327 : }
328 :
329 0 : set<SCCOL> aColBreaks;
330 0 : rDoc.GetAllColBreaks(aColBreaks, nScTab, false, true);
331 0 : for (set<SCCOL>::const_iterator itr = aColBreaks.begin(), itrEnd = aColBreaks.end(); itr != itrEnd; ++itr)
332 0 : maData.maVerPageBreaks.push_back(*itr);
333 0 : }
334 :
335 0 : class XclExpXmlStartHeaderFooterElementRecord : public XclExpXmlElementRecord
336 : {
337 : public:
338 0 : explicit XclExpXmlStartHeaderFooterElementRecord(sal_Int32 const nElement)
339 0 : : XclExpXmlElementRecord(nElement) {}
340 :
341 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
342 : };
343 :
344 0 : void XclExpXmlStartHeaderFooterElementRecord::SaveXml(XclExpXmlStream& rStrm)
345 : {
346 : // OOXTODO: we currently only emit oddHeader/oddFooter elements, and
347 : // do not support the first/even/odd page distinction.
348 0 : sax_fastparser::FSHelperPtr& rStream = rStrm.GetCurrentStream();
349 : rStream->startElement( mnElement,
350 : // OOXTODO: XML_alignWithMargins,
351 : XML_differentFirst, "false", // OOXTODO
352 : XML_differentOddEven, "false", // OOXTODO
353 : // OOXTODO: XML_scaleWithDoc
354 0 : FSEND );
355 0 : }
356 :
357 0 : void XclExpPageSettings::Save( XclExpStream& rStrm )
358 : {
359 0 : XclExpBoolRecord( EXC_ID_PRINTHEADERS, maData.mbPrintHeadings ).Save( rStrm );
360 0 : XclExpBoolRecord( EXC_ID_PRINTGRIDLINES, maData.mbPrintGrid ).Save( rStrm );
361 0 : XclExpBoolRecord( EXC_ID_GRIDSET, true ).Save( rStrm );
362 0 : XclExpPageBreaks( EXC_ID_HORPAGEBREAKS, maData.maHorPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).Save( rStrm );
363 0 : XclExpPageBreaks( EXC_ID_VERPAGEBREAKS, maData.maVerPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).Save( rStrm );
364 0 : XclExpHeaderFooter( EXC_ID_HEADER, maData.maHeader ).Save( rStrm );
365 0 : XclExpHeaderFooter( EXC_ID_FOOTER, maData.maFooter ).Save( rStrm );
366 0 : XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter ).Save( rStrm );
367 0 : XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter ).Save( rStrm );
368 0 : XclExpDoubleRecord( EXC_ID_LEFTMARGIN, maData.mfLeftMargin ).Save( rStrm );
369 0 : XclExpDoubleRecord( EXC_ID_RIGHTMARGIN, maData.mfRightMargin ).Save( rStrm );
370 0 : XclExpDoubleRecord( EXC_ID_TOPMARGIN, maData.mfTopMargin ).Save( rStrm );
371 0 : XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN, maData.mfBottomMargin ).Save( rStrm );
372 0 : XclExpSetup( maData ).Save( rStrm );
373 :
374 0 : if( (GetBiff() == EXC_BIFF8) && maData.mxBrushItem.get() )
375 0 : if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
376 0 : XclExpImgData( *pGraphic, EXC_ID8_IMGDATA ).Save( rStrm );
377 0 : }
378 :
379 0 : void XclExpPageSettings::SaveXml( XclExpXmlStream& rStrm )
380 : {
381 0 : XclExpXmlStartSingleElementRecord( XML_printOptions ).SaveXml( rStrm );
382 0 : XclExpBoolRecord( EXC_ID_PRINTHEADERS, maData.mbPrintHeadings, XML_headings ).SaveXml( rStrm );
383 0 : XclExpBoolRecord( EXC_ID_PRINTGRIDLINES, maData.mbPrintGrid, XML_gridLines ).SaveXml( rStrm );
384 0 : XclExpBoolRecord( EXC_ID_GRIDSET, true, XML_gridLinesSet ).SaveXml( rStrm );
385 0 : XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter, XML_horizontalCentered ).SaveXml( rStrm );
386 0 : XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter, XML_verticalCentered ).SaveXml( rStrm );
387 0 : XclExpXmlEndSingleElementRecord().SaveXml( rStrm ); // XML_printOptions
388 :
389 0 : XclExpXmlStartSingleElementRecord( XML_pageMargins ).SaveXml( rStrm );
390 0 : XclExpDoubleRecord( EXC_ID_LEFTMARGIN, maData.mfLeftMargin ).SetAttribute( XML_left )->SaveXml( rStrm );
391 0 : XclExpDoubleRecord( EXC_ID_RIGHTMARGIN, maData.mfRightMargin ).SetAttribute( XML_right )->SaveXml( rStrm );
392 0 : XclExpDoubleRecord( EXC_ID_TOPMARGIN, maData.mfTopMargin ).SetAttribute( XML_top )->SaveXml( rStrm );
393 0 : XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN, maData.mfBottomMargin ).SetAttribute( XML_bottom )->SaveXml( rStrm );
394 0 : XclExpDoubleRecord( 0, maData.mfHeaderMargin).SetAttribute( XML_header )->SaveXml( rStrm );
395 0 : XclExpDoubleRecord( 0, maData.mfFooterMargin).SetAttribute( XML_footer )->SaveXml( rStrm );
396 0 : XclExpXmlEndSingleElementRecord().SaveXml( rStrm ); // XML_pageMargins
397 :
398 0 : XclExpSetup( maData ).SaveXml( rStrm );
399 :
400 0 : XclExpXmlStartHeaderFooterElementRecord(XML_headerFooter).SaveXml(rStrm);
401 0 : XclExpHeaderFooter( EXC_ID_HEADER, maData.maHeader ).SaveXml( rStrm );
402 0 : XclExpHeaderFooter( EXC_ID_FOOTER, maData.maFooter ).SaveXml( rStrm );
403 0 : XclExpXmlEndElementRecord( XML_headerFooter ).SaveXml( rStrm );
404 :
405 : XclExpPageBreaks( EXC_ID_HORPAGEBREAKS, maData.maHorPageBreaks,
406 0 : static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).SaveXml( rStrm );
407 : XclExpPageBreaks( EXC_ID_VERPAGEBREAKS, maData.maVerPageBreaks,
408 0 : static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).SaveXml( rStrm );
409 :
410 0 : if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
411 0 : XclExpImgData( *pGraphic, EXC_ID8_IMGDATA ).SaveXml( rStrm );
412 0 : }
413 :
414 0 : XclExpChartPageSettings::XclExpChartPageSettings( const XclExpRoot& rRoot ) :
415 0 : XclExpRoot( rRoot )
416 : {
417 0 : }
418 :
419 0 : void XclExpChartPageSettings::Save( XclExpStream& rStrm )
420 : {
421 0 : XclExpHeaderFooter( EXC_ID_HEADER, maData.maHeader ).Save( rStrm );
422 0 : XclExpHeaderFooter( EXC_ID_FOOTER, maData.maFooter ).Save( rStrm );
423 0 : XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter ).Save( rStrm );
424 0 : XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter ).Save( rStrm );
425 0 : XclExpSetup( maData ).Save( rStrm );
426 0 : XclExpUInt16Record( EXC_ID_PRINTSIZE, EXC_PRINTSIZE_FULL ).Save( rStrm );
427 0 : }
428 :
429 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|