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