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