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 28 : XclExpHeaderFooter::XclExpHeaderFooter( sal_uInt16 nRecId, const String& rHdrString ) :
51 : XclExpRecord( nRecId ),
52 28 : maHdrString( rHdrString )
53 : {
54 28 : }
55 :
56 18 : void XclExpHeaderFooter::SaveXml( XclExpXmlStream& rStrm )
57 : {
58 18 : sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
59 18 : sal_Int32 nElement = GetRecId() == EXC_ID_HEADER ? XML_oddHeader : XML_oddFooter;
60 18 : rWorksheet->startElement( nElement, FSEND );
61 18 : rWorksheet->writeEscaped( XclXmlUtils::ToOUString( maHdrString ) );
62 18 : rWorksheet->endElement( nElement );
63 18 : }
64 :
65 10 : void XclExpHeaderFooter::WriteBody( XclExpStream& rStrm )
66 : {
67 10 : if( maHdrString.Len() )
68 : {
69 4 : XclExpString aExString;
70 4 : if( rStrm.GetRoot().GetBiff() <= EXC_BIFF5 )
71 0 : aExString.AssignByte( maHdrString, rStrm.GetRoot().GetTextEncoding(), EXC_STR_8BITLENGTH );
72 : else
73 4 : aExString.Assign( maHdrString, EXC_STR_DEFAULT, 255 ); // 16-bit length, but max 255 chars
74 4 : rStrm << aExString;
75 : }
76 10 : }
77 :
78 : // General page settings ------------------------------------------------------
79 :
80 14 : XclExpSetup::XclExpSetup( const XclPageData& rPageData ) :
81 : XclExpRecord( EXC_ID_SETUP, 34 ),
82 14 : mrData( rPageData )
83 : {
84 14 : }
85 :
86 9 : void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
87 : {
88 9 : sax_fastparser::FastAttributeList* pAttrList=rStrm.GetCurrentStream()->createAttrList();
89 11 : if( rStrm.getVersion() != oox::core::ISOIEC_29500_2008 ||
90 2 : mrData.mnStrictPaperSize != EXC_PAPERSIZE_USER )
91 : {
92 9 : pAttrList->add( XML_paperSize, OString::valueOf( (sal_Int32) mrData.mnPaperSize ).getStr() );
93 : }
94 : else
95 : {
96 0 : pAttrList->add( XML_paperWidth, OString::valueOf( (sal_Int32) mrData.mnPaperWidth ).concat(OString("mm")).getStr() );
97 0 : pAttrList->add( XML_paperHeight, OString::valueOf( (sal_Int32) mrData.mnPaperHeight ).concat(OString("mm")).getStr() );
98 : // pAttrList->add( XML_paperUnits, "mm" );
99 : }
100 9 : pAttrList->add( XML_scale, OString::valueOf( (sal_Int32) mrData.mnScaling ).getStr() );
101 9 : pAttrList->add( XML_firstPageNumber, OString::valueOf( (sal_Int32) mrData.mnStartPage ).getStr() );
102 9 : pAttrList->add( XML_fitToWidth, OString::valueOf( (sal_Int32) mrData.mnFitToWidth ).getStr() );
103 9 : pAttrList->add( XML_fitToHeight, OString::valueOf( (sal_Int32) mrData.mnFitToHeight ).getStr() );
104 9 : pAttrList->add( XML_pageOrder, mrData.mbPrintInRows ? "overThenDown" : "downThenOver" );
105 9 : pAttrList->add( XML_orientation, mrData.mbPortrait ? "portrait" : "landscape" ); // OOXTODO: "default"?
106 9 : pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( !mrData.mbValid ) );
107 9 : pAttrList->add( XML_blackAndWhite, XclXmlUtils::ToPsz( mrData.mbBlackWhite ) );
108 9 : pAttrList->add( XML_draft, XclXmlUtils::ToPsz( mrData.mbDraftQuality ) );
109 9 : pAttrList->add( XML_cellComments, mrData.mbPrintNotes ? "atEnd" : "none" ); // OOXTODO: "asDisplayed"?
110 9 : pAttrList->add( XML_useFirstPageNumber, XclXmlUtils::ToPsz( mrData.mbManualStart ) );
111 : // OOXTODO: XML_errors, // == displayed|blank|dash|NA
112 9 : pAttrList->add( XML_horizontalDpi, OString::valueOf( (sal_Int32) mrData.mnHorPrintRes ).getStr() );
113 9 : pAttrList->add( XML_verticalDpi, OString::valueOf( (sal_Int32) mrData.mnVerPrintRes ).getStr() );
114 9 : pAttrList->add( XML_copies, OString::valueOf( (sal_Int32) mrData.mnCopies ).getStr() );
115 : // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
116 :
117 9 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList > aAttrs(pAttrList);
118 9 : rStrm.GetCurrentStream()->singleElement( XML_pageSetup, aAttrs );
119 9 : }
120 :
121 5 : void XclExpSetup::WriteBody( XclExpStream& rStrm )
122 : {
123 5 : XclBiff eBiff = rStrm.GetRoot().GetBiff();
124 :
125 5 : sal_uInt16 nFlags = 0;
126 5 : ::set_flag( nFlags, EXC_SETUP_INROWS, mrData.mbPrintInRows );
127 5 : ::set_flag( nFlags, EXC_SETUP_PORTRAIT, mrData.mbPortrait );
128 5 : ::set_flag( nFlags, EXC_SETUP_INVALID, !mrData.mbValid );
129 5 : ::set_flag( nFlags, EXC_SETUP_BLACKWHITE, mrData.mbBlackWhite );
130 5 : if( eBiff >= EXC_BIFF5 )
131 : {
132 5 : ::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 5 : const sal_uInt16 nNotes = EXC_SETUP_PRINTNOTES | EXC_SETUP_NOTES_END;
137 5 : ::set_flag( nFlags, nNotes, mrData.mbPrintNotes );
138 5 : ::set_flag( nFlags, EXC_SETUP_STARTPAGE, mrData.mbManualStart );
139 : }
140 :
141 5 : rStrm << mrData.mnPaperSize << mrData.mnScaling << mrData.mnStartPage
142 10 : << mrData.mnFitToWidth << mrData.mnFitToHeight << nFlags;
143 5 : if( eBiff >= EXC_BIFF5 )
144 : {
145 5 : rStrm << mrData.mnHorPrintRes << mrData.mnVerPrintRes
146 10 : << mrData.mfHeaderMargin << mrData.mfFooterMargin << mrData.mnCopies;
147 : }
148 5 : }
149 :
150 : // Manual page breaks ---------------------------------------------------------
151 :
152 28 : XclExpPageBreaks::XclExpPageBreaks( sal_uInt16 nRecId, const ScfUInt16Vec& rPageBreaks, sal_uInt16 nMaxPos ) :
153 : XclExpRecord( nRecId ),
154 : mrPageBreaks( rPageBreaks ),
155 28 : mnMaxPos( nMaxPos )
156 : {
157 28 : }
158 :
159 10 : void XclExpPageBreaks::Save( XclExpStream& rStrm )
160 : {
161 10 : if( !mrPageBreaks.empty() )
162 : {
163 0 : SetRecSize( 2 + ((rStrm.GetRoot().GetBiff() <= EXC_BIFF5) ? 2 : 6) * mrPageBreaks.size() );
164 0 : XclExpRecord::Save( rStrm );
165 : }
166 10 : }
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 18 : void XclExpPageBreaks::SaveXml( XclExpXmlStream& rStrm )
182 : {
183 18 : if( mrPageBreaks.empty() )
184 36 : 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::valueOf( (sal_Int32) 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::valueOf( (sal_Int32) *aIt ).getStr(),
197 : XML_man, "true",
198 : XML_max, OString::valueOf( (sal_Int32) 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 14 : XclExpPageSettings::XclExpPageSettings( const XclExpRoot& rRoot ) :
209 14 : XclExpRoot( rRoot )
210 : {
211 14 : ScDocument& rDoc = GetDoc();
212 14 : SCTAB nScTab = GetCurrScTab();
213 :
214 14 : if( SfxStyleSheetBase* pStyleSheet = GetStyleSheetPool().Find( rDoc.GetPageStyle( nScTab ), SFX_STYLE_FAMILY_PAGE ) )
215 : {
216 14 : const SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
217 14 : maData.mbValid = true;
218 :
219 : // *** page settings ***
220 :
221 14 : maData.mbPrintInRows = !GETITEMBOOL( rItemSet, ATTR_PAGE_TOPDOWN );
222 14 : maData.mbHorCenter = GETITEMBOOL( rItemSet, ATTR_PAGE_HORCENTER );
223 14 : maData.mbVerCenter = GETITEMBOOL( rItemSet, ATTR_PAGE_VERCENTER );
224 14 : maData.mbPrintHeadings = GETITEMBOOL( rItemSet, ATTR_PAGE_HEADERS );
225 14 : maData.mbPrintGrid = GETITEMBOOL( rItemSet, ATTR_PAGE_GRID );
226 14 : maData.mbPrintNotes = GETITEMBOOL( rItemSet, ATTR_PAGE_NOTES );
227 :
228 14 : maData.mnStartPage = GETITEMVALUE( rItemSet, SfxUInt16Item, ATTR_PAGE_FIRSTPAGENO, sal_uInt16 );
229 14 : maData.mbManualStart = maData.mnStartPage && (!nScTab || rDoc.NeedPageResetAfterTab( nScTab - 1 ));
230 :
231 14 : const SvxLRSpaceItem& rLRItem = GETITEM( rItemSet, SvxLRSpaceItem, ATTR_LRSPACE );
232 14 : maData.mfLeftMargin = XclTools::GetInchFromTwips( rLRItem.GetLeft() );
233 14 : maData.mfRightMargin = XclTools::GetInchFromTwips( rLRItem.GetRight() );
234 14 : const SvxULSpaceItem& rULItem = GETITEM( rItemSet, SvxULSpaceItem, ATTR_ULSPACE );
235 14 : maData.mfTopMargin = XclTools::GetInchFromTwips( rULItem.GetUpper() );
236 14 : maData.mfBottomMargin = XclTools::GetInchFromTwips( rULItem.GetLower() );
237 :
238 14 : const SvxPageItem& rPageItem = GETITEM( rItemSet, SvxPageItem, ATTR_PAGE );
239 14 : const SvxSizeItem& rSizeItem = GETITEM( rItemSet, SvxSizeItem, ATTR_PAGE_SIZE );
240 14 : maData.SetScPaperSize( rSizeItem.GetSize(), !rPageItem.IsLandscape() );
241 :
242 14 : const ScPageScaleToItem& rScaleToItem = GETITEM( rItemSet, ScPageScaleToItem, ATTR_PAGE_SCALETO );
243 14 : sal_uInt16 nPages = GETITEMVALUE( rItemSet, SfxUInt16Item, ATTR_PAGE_SCALETOPAGES, sal_uInt16 );
244 14 : sal_uInt16 nScale = GETITEMVALUE( rItemSet, SfxUInt16Item, ATTR_PAGE_SCALE, sal_uInt16 );
245 :
246 14 : 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 14 : 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 14 : else if( nScale )
260 : {
261 14 : maData.mnScaling = nScale;
262 14 : maData.mbFitToPages = false;
263 : }
264 :
265 14 : maData.mxBrushItem.reset( new SvxBrushItem( GETITEM( rItemSet, SvxBrushItem, ATTR_BACKGROUND ) ) );
266 :
267 : // *** header and footer ***
268 :
269 14 : XclExpHFConverter aHFConv( GetRoot() );
270 :
271 : // header
272 14 : const SfxItemSet& rHdrItemSet = GETITEM( rItemSet, SvxSetItem, ATTR_PAGE_HEADERSET ).GetItemSet();
273 14 : if( GETITEMBOOL( rHdrItemSet, ATTR_PAGE_ON ) )
274 : {
275 7 : const ScPageHFItem& rHFItem = GETITEM( rItemSet, ScPageHFItem, ATTR_PAGE_HEADERRIGHT );
276 7 : aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
277 7 : maData.maHeader = aHFConv.GetHFString();
278 : // header height (Excel excludes header from top margin)
279 7 : sal_Int32 nHdrHeight = GETITEMBOOL( rHdrItemSet, ATTR_PAGE_DYNAMIC ) ?
280 : // dynamic height: calculate header height, add header <-> sheet area distance
281 7 : (aHFConv.GetTotalHeight() + GETITEM( rHdrItemSet, SvxULSpaceItem, ATTR_ULSPACE ).GetLower()) :
282 : // static height: ATTR_PAGE_SIZE already includes header <-> sheet area distance
283 14 : static_cast< sal_Int32 >( GETITEM( rHdrItemSet, SvxSizeItem, ATTR_PAGE_SIZE ).GetSize().Height() );
284 7 : maData.mfHeaderMargin = maData.mfTopMargin;
285 7 : maData.mfTopMargin += XclTools::GetInchFromTwips( nHdrHeight );
286 : }
287 :
288 : // footer
289 14 : const SfxItemSet& rFtrItemSet = GETITEM( rItemSet, SvxSetItem, ATTR_PAGE_FOOTERSET ).GetItemSet();
290 14 : if( GETITEMBOOL( rFtrItemSet, ATTR_PAGE_ON ) )
291 : {
292 7 : const ScPageHFItem& rHFItem = GETITEM( rItemSet, ScPageHFItem, ATTR_PAGE_FOOTERRIGHT );
293 7 : aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
294 7 : maData.maFooter = aHFConv.GetHFString();
295 : // footer height (Excel excludes footer from bottom margin)
296 7 : sal_Int32 nFtrHeight = GETITEMBOOL( rFtrItemSet, ATTR_PAGE_DYNAMIC ) ?
297 : // dynamic height: calculate footer height, add sheet area <-> footer distance
298 7 : (aHFConv.GetTotalHeight() + GETITEM( rFtrItemSet, SvxULSpaceItem, ATTR_ULSPACE ).GetUpper()) :
299 : // static height: ATTR_PAGE_SIZE already includes sheet area <-> footer distance
300 14 : static_cast< sal_Int32 >( GETITEM( rFtrItemSet, SvxSizeItem, ATTR_PAGE_SIZE ).GetSize().Height() );
301 7 : maData.mfFooterMargin = maData.mfBottomMargin;
302 7 : maData.mfBottomMargin += XclTools::GetInchFromTwips( nFtrHeight );
303 14 : }
304 : }
305 :
306 : // *** page breaks ***
307 :
308 14 : set<SCROW> aRowBreaks;
309 14 : rDoc.GetAllRowBreaks(aRowBreaks, nScTab, false, true);
310 :
311 14 : SCROW nMaxRow = numeric_limits<sal_uInt16>::max();
312 14 : 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 14 : 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 28 : set<SCCOL> aColBreaks;
330 14 : rDoc.GetAllColBreaks(aColBreaks, nScTab, false, true);
331 14 : for (set<SCCOL>::const_iterator itr = aColBreaks.begin(), itrEnd = aColBreaks.end(); itr != itrEnd; ++itr)
332 14 : maData.maVerPageBreaks.push_back(*itr);
333 14 : }
334 :
335 9 : class XclExpXmlStartHeaderFooterElementRecord : public XclExpXmlElementRecord
336 : {
337 : public:
338 9 : explicit XclExpXmlStartHeaderFooterElementRecord(sal_Int32 const nElement)
339 9 : : XclExpXmlElementRecord(nElement) {}
340 :
341 : virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
342 : };
343 :
344 9 : 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 9 : 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 9 : FSEND );
355 9 : }
356 :
357 5 : void XclExpPageSettings::Save( XclExpStream& rStrm )
358 : {
359 5 : XclExpBoolRecord( EXC_ID_PRINTHEADERS, maData.mbPrintHeadings ).Save( rStrm );
360 5 : XclExpBoolRecord( EXC_ID_PRINTGRIDLINES, maData.mbPrintGrid ).Save( rStrm );
361 5 : XclExpBoolRecord( EXC_ID_GRIDSET, true ).Save( rStrm );
362 5 : XclExpPageBreaks( EXC_ID_HORPAGEBREAKS, maData.maHorPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).Save( rStrm );
363 5 : XclExpPageBreaks( EXC_ID_VERPAGEBREAKS, maData.maVerPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).Save( rStrm );
364 5 : XclExpHeaderFooter( EXC_ID_HEADER, maData.maHeader ).Save( rStrm );
365 5 : XclExpHeaderFooter( EXC_ID_FOOTER, maData.maFooter ).Save( rStrm );
366 5 : XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter ).Save( rStrm );
367 5 : XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter ).Save( rStrm );
368 5 : XclExpDoubleRecord( EXC_ID_LEFTMARGIN, maData.mfLeftMargin ).Save( rStrm );
369 5 : XclExpDoubleRecord( EXC_ID_RIGHTMARGIN, maData.mfRightMargin ).Save( rStrm );
370 5 : XclExpDoubleRecord( EXC_ID_TOPMARGIN, maData.mfTopMargin ).Save( rStrm );
371 5 : XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN, maData.mfBottomMargin ).Save( rStrm );
372 5 : XclExpSetup( maData ).Save( rStrm );
373 :
374 5 : if( (GetBiff() == EXC_BIFF8) && maData.mxBrushItem.get() )
375 5 : if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
376 0 : XclExpImgData( *pGraphic, EXC_ID8_IMGDATA ).Save( rStrm );
377 5 : }
378 :
379 9 : void XclExpPageSettings::SaveXml( XclExpXmlStream& rStrm )
380 : {
381 9 : XclExpXmlStartSingleElementRecord( XML_printOptions ).SaveXml( rStrm );
382 9 : XclExpBoolRecord( EXC_ID_PRINTHEADERS, maData.mbPrintHeadings, XML_headings ).SaveXml( rStrm );
383 9 : XclExpBoolRecord( EXC_ID_PRINTGRIDLINES, maData.mbPrintGrid, XML_gridLines ).SaveXml( rStrm );
384 9 : XclExpBoolRecord( EXC_ID_GRIDSET, true, XML_gridLinesSet ).SaveXml( rStrm );
385 9 : XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter, XML_horizontalCentered ).SaveXml( rStrm );
386 9 : XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter, XML_verticalCentered ).SaveXml( rStrm );
387 9 : XclExpXmlEndSingleElementRecord().SaveXml( rStrm ); // XML_printOptions
388 :
389 9 : XclExpXmlStartSingleElementRecord( XML_pageMargins ).SaveXml( rStrm );
390 9 : XclExpDoubleRecord( EXC_ID_LEFTMARGIN, maData.mfLeftMargin ).SetAttribute( XML_left )->SaveXml( rStrm );
391 9 : XclExpDoubleRecord( EXC_ID_RIGHTMARGIN, maData.mfRightMargin ).SetAttribute( XML_right )->SaveXml( rStrm );
392 9 : XclExpDoubleRecord( EXC_ID_TOPMARGIN, maData.mfTopMargin ).SetAttribute( XML_top )->SaveXml( rStrm );
393 9 : XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN, maData.mfBottomMargin ).SetAttribute( XML_bottom )->SaveXml( rStrm );
394 9 : XclExpDoubleRecord( 0, maData.mfHeaderMargin).SetAttribute( XML_header )->SaveXml( rStrm );
395 9 : XclExpDoubleRecord( 0, maData.mfFooterMargin).SetAttribute( XML_footer )->SaveXml( rStrm );
396 9 : XclExpXmlEndSingleElementRecord().SaveXml( rStrm ); // XML_pageMargins
397 :
398 9 : XclExpSetup( maData ).SaveXml( rStrm );
399 :
400 9 : XclExpXmlStartHeaderFooterElementRecord(XML_headerFooter).SaveXml(rStrm);
401 9 : XclExpHeaderFooter( EXC_ID_HEADER, maData.maHeader ).SaveXml( rStrm );
402 9 : XclExpHeaderFooter( EXC_ID_FOOTER, maData.maFooter ).SaveXml( rStrm );
403 9 : XclExpXmlEndElementRecord( XML_headerFooter ).SaveXml( rStrm );
404 :
405 : XclExpPageBreaks( EXC_ID_HORPAGEBREAKS, maData.maHorPageBreaks,
406 9 : static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).SaveXml( rStrm );
407 : XclExpPageBreaks( EXC_ID_VERPAGEBREAKS, maData.maVerPageBreaks,
408 9 : static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).SaveXml( rStrm );
409 :
410 9 : if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
411 0 : XclExpImgData( *pGraphic, EXC_ID8_IMGDATA ).SaveXml( rStrm );
412 9 : }
413 :
414 : // ----------------------------------------------------------------------------
415 :
416 2 : XclExpChartPageSettings::XclExpChartPageSettings( const XclExpRoot& rRoot ) :
417 2 : XclExpRoot( rRoot )
418 : {
419 2 : }
420 :
421 0 : void XclExpChartPageSettings::Save( XclExpStream& rStrm )
422 : {
423 0 : XclExpHeaderFooter( EXC_ID_HEADER, maData.maHeader ).Save( rStrm );
424 0 : XclExpHeaderFooter( EXC_ID_FOOTER, maData.maFooter ).Save( rStrm );
425 0 : XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter ).Save( rStrm );
426 0 : XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter ).Save( rStrm );
427 0 : XclExpSetup( maData ).Save( rStrm );
428 0 : XclExpUInt16Record( EXC_ID_PRINTSIZE, EXC_PRINTSIZE_FULL ).Save( rStrm );
429 15 : }
430 :
431 : // ============================================================================
432 :
433 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|