LibreOffice Module sc (master) 1
xepage.cxx
Go to the documentation of this file.
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 <utility>
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 <oox/export/utils.hxx>
32#include <oox/token/tokens.hxx>
33#include <sax/fastattribs.hxx>
34#include <document.hxx>
35#include <stlpool.hxx>
36#include <attrib.hxx>
37#include <xehelper.hxx>
38#include <xeescher.hxx>
39#include <xltools.hxx>
40
41#include <set>
42#include <limits>
43
44using namespace ::oox;
45
46using ::std::set;
47using ::std::numeric_limits;
48
49// Page settings records ======================================================
50
51// Header/footer --------------------------------------------------------------
52
53XclExpHeaderFooter::XclExpHeaderFooter( sal_uInt16 nRecId, OUString aHdrString ) :
54 XclExpRecord( nRecId ),
55 maHdrString(std::move( aHdrString ))
56{
57}
58
60{
61 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
62 sal_Int32 nElement;
63 switch(GetRecId()) {
64 case EXC_ID_HEADER_FIRST: nElement = XML_firstHeader; break;
65 case EXC_ID_FOOTER_FIRST: nElement = XML_firstFooter; break;
66 case EXC_ID_HEADER_EVEN: nElement = XML_evenHeader; break;
67 case EXC_ID_FOOTER_EVEN: nElement = XML_evenFooter; break;
68 case EXC_ID_HEADER: nElement = XML_oddHeader; break;
69 case EXC_ID_FOOTER:
70 default: nElement = XML_oddFooter;
71 }
72 rWorksheet->startElement(nElement);
73 rWorksheet->writeEscaped( maHdrString );
74 rWorksheet->endElement( nElement );
75}
76
78{
79 if( !maHdrString.isEmpty() )
80 {
81 XclExpString aExString;
82 if( rStrm.GetRoot().GetBiff() <= EXC_BIFF5 )
83 aExString.AssignByte( maHdrString, rStrm.GetRoot().GetTextEncoding(), XclStrFlags::EightBitLength );
84 else
85 aExString.Assign( maHdrString, XclStrFlags::NONE, 255 ); // 16-bit length, but max 255 chars
86 rStrm << aExString;
87 }
88}
89
90// General page settings ------------------------------------------------------
91
94 mrData( rPageData )
95{
96}
97
99{
101 if( rStrm.getVersion() != oox::core::ISOIEC_29500_2008 ||
103 {
104 pAttrList->add( XML_paperSize, OString::number( mrData.mnPaperSize ) );
105 }
106 else
107 {
108 pAttrList->add( XML_paperWidth, OString::number( mrData.mnPaperWidth ) + "mm" );
109 pAttrList->add( XML_paperHeight, OString::number( mrData.mnPaperHeight ) + "mm" );
110 // pAttrList->add( XML_paperUnits, "mm" );
111 }
112 pAttrList->add( XML_scale, OString::number( mrData.mnScaling ) );
113 pAttrList->add( XML_fitToWidth, OString::number( mrData.mnFitToWidth ) );
114 pAttrList->add( XML_fitToHeight, OString::number( mrData.mnFitToHeight ) );
115 pAttrList->add( XML_pageOrder, mrData.mbPrintInRows ? "overThenDown" : "downThenOver" );
116 pAttrList->add( XML_orientation, mrData.mbPortrait ? "portrait" : "landscape" ); // OOXTODO: "default"?
117 // tdf#48767 if XML_usePrinterDefaults field is exist, then XML_orientation is always "portrait" in MS Excel
118 // To resolve that import issue, if XML_usePrinterDefaults has default value (false) then XML_usePrinterDefaults is not added.
119 if ( !mrData.mbValid )
120 pAttrList->add( XML_usePrinterDefaults, ToPsz( !mrData.mbValid ) );
121 pAttrList->add( XML_blackAndWhite, ToPsz( mrData.mbBlackWhite ) );
122 pAttrList->add( XML_draft, ToPsz( mrData.mbDraftQuality ) );
123 pAttrList->add( XML_cellComments, mrData.mbPrintNotes ? "atEnd" : "none" ); // OOXTODO: "asDisplayed"?
124
125 if ( mrData.mbManualStart )
126 {
127 pAttrList->add( XML_firstPageNumber, OString::number( mrData.mnStartPage ) );
128 pAttrList->add( XML_useFirstPageNumber, ToPsz( mrData.mbManualStart ) );
129 }
130 // OOXTODO: XML_errors, // == displayed|blank|dash|NA
131 pAttrList->add( XML_horizontalDpi, OString::number( mrData.mnHorPrintRes ) );
132 pAttrList->add( XML_verticalDpi, OString::number( mrData.mnVerPrintRes ) );
133 pAttrList->add( XML_copies, OString::number( mrData.mnCopies ) );
134 // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
135
136 rStrm.GetCurrentStream()->singleElement( XML_pageSetup, pAttrList );
137}
138
140{
141 XclBiff eBiff = rStrm.GetRoot().GetBiff();
142
143 sal_uInt16 nFlags = 0;
148 if( eBiff >= EXC_BIFF5 )
149 {
151 /* Set the Comments/Notes to "At end of sheet" if Print Notes is true.
152 We don't currently support "as displayed on sheet". Thus this value
153 will be re-interpreted to "At end of sheet". */
154 const sal_uInt16 nNotes = EXC_SETUP_PRINTNOTES | EXC_SETUP_NOTES_END;
155 ::set_flag( nFlags, nNotes, mrData.mbPrintNotes );
157 }
158
160 << mrData.mnFitToWidth << mrData.mnFitToHeight << nFlags;
161 if( eBiff >= EXC_BIFF5 )
162 {
165 }
166}
167
168// Manual page breaks ---------------------------------------------------------
169
170XclExpPageBreaks::XclExpPageBreaks( sal_uInt16 nRecId, const ScfUInt16Vec& rPageBreaks, sal_uInt16 nMaxPos ) :
171 XclExpRecord( nRecId ),
172 mrPageBreaks( rPageBreaks ),
173 mnMaxPos( nMaxPos )
174{
175}
176
178{
179 if( !mrPageBreaks.empty() )
180 {
181 SetRecSize( 2 + ((rStrm.GetRoot().GetBiff() <= EXC_BIFF5) ? 2 : 6) * mrPageBreaks.size() );
183 }
184}
185
187{
188 bool bWriteRange = (rStrm.GetRoot().GetBiff() == EXC_BIFF8);
189
190 rStrm << static_cast< sal_uInt16 >( mrPageBreaks.size() );
191 for( const auto& rPageBreak : mrPageBreaks )
192 {
193 rStrm << rPageBreak;
194 if( bWriteRange )
195 rStrm << sal_uInt16( 0 ) << mnMaxPos;
196 }
197}
198
200{
201 if( mrPageBreaks.empty() )
202 return;
203
204 sal_Int32 nElement = GetRecId() == EXC_ID_HORPAGEBREAKS ? XML_rowBreaks : XML_colBreaks;
205 sax_fastparser::FSHelperPtr& pWorksheet = rStrm.GetCurrentStream();
206 OString sNumPageBreaks = OString::number( mrPageBreaks.size() );
207 pWorksheet->startElement( nElement,
208 XML_count, sNumPageBreaks,
209 XML_manualBreakCount, sNumPageBreaks );
210 for( const auto& rPageBreak : mrPageBreaks )
211 {
212 pWorksheet->singleElement( XML_brk,
213 XML_id, OString::number(rPageBreak),
214 XML_man, "true",
215 XML_max, OString::number(mnMaxPos),
216 XML_min, "0"
217 // OOXTODO: XML_pt, ""
218 );
219 }
220 pWorksheet->endElement( nElement );
221}
222
223// Page settings ==============================================================
224
226 XclExpRoot( rRoot )
227{
228 ScDocument& rDoc = GetDoc();
229 SCTAB nScTab = GetCurrScTab();
230
231 if( SfxStyleSheetBase* pStyleSheet = GetStyleSheetPool().Find( rDoc.GetPageStyle( nScTab ), SfxStyleFamily::Page ) )
232 {
233 const SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
234 maData.mbValid = true;
235
236 // *** page settings ***
237
238 maData.mbPrintInRows = ! rItemSet.Get( ATTR_PAGE_TOPDOWN ).GetValue();
239 maData.mbHorCenter = rItemSet.Get( ATTR_PAGE_HORCENTER ).GetValue();
240 maData.mbVerCenter = rItemSet.Get( ATTR_PAGE_VERCENTER ).GetValue();
241 maData.mbPrintHeadings = rItemSet.Get( ATTR_PAGE_HEADERS ).GetValue();
242 maData.mbPrintGrid = rItemSet.Get( ATTR_PAGE_GRID ).GetValue();
243 maData.mbPrintNotes = rItemSet.Get( ATTR_PAGE_NOTES ).GetValue();
244
245 maData.mnStartPage = rItemSet.Get( ATTR_PAGE_FIRSTPAGENO ).GetValue();
246 maData.mbManualStart = maData.mnStartPage && (!nScTab || rDoc.NeedPageResetAfterTab( nScTab - 1 ));
247
248 const SvxLRSpaceItem& rLRItem = rItemSet.Get( ATTR_LRSPACE );
251 const SvxULSpaceItem& rULItem = rItemSet.Get( ATTR_ULSPACE );
254
255 const SvxPageItem& rPageItem = rItemSet.Get( ATTR_PAGE );
256 const SvxSizeItem& rSizeItem = rItemSet.Get( ATTR_PAGE_SIZE );
257 maData.SetScPaperSize( rSizeItem.GetSize(), !rPageItem.IsLandscape() );
258
259 const ScPageScaleToItem& rScaleToItem = rItemSet.Get( ATTR_PAGE_SCALETO );
260 sal_uInt16 nPages = rItemSet.Get( ATTR_PAGE_SCALETOPAGES ).GetValue();
261 sal_uInt16 nScale = rItemSet.Get( ATTR_PAGE_SCALE ).GetValue();
262
263 if( ScfTools::CheckItem( rItemSet, ATTR_PAGE_SCALETO, false ) && rScaleToItem.IsValid() )
264 {
265 maData.mnFitToWidth = rScaleToItem.GetWidth();
266 maData.mnFitToHeight = rScaleToItem.GetHeight();
267 maData.mbFitToPages = true;
268 }
269 else if( ScfTools::CheckItem( rItemSet, ATTR_PAGE_SCALETOPAGES, false ) && nPages )
270 {
272 maData.mnFitToHeight = nPages;
273 maData.mbFitToPages = true;
274 }
275 else if( nScale )
276 {
277 maData.mnScaling = nScale;
278 maData.mbFitToPages = false;
279 }
280
281 maData.mxBrushItem.reset( new SvxBrushItem( rItemSet.Get( ATTR_BACKGROUND ) ) );
282 maData.mbUseEvenHF = false;
283 maData.mbUseFirstHF = false;
284
285 // *** header and footer ***
286
287 XclExpHFConverter aHFConv( GetRoot() );
288
289 // header
290 const SfxItemSet& rHdrItemSet = rItemSet.Get( ATTR_PAGE_HEADERSET ).GetItemSet();
291 if( rHdrItemSet.Get( ATTR_PAGE_ON ).GetValue() )
292 {
293 const ScPageHFItem& rHFItem = rItemSet.Get( ATTR_PAGE_HEADERRIGHT );
294 aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
295 maData.maHeader = aHFConv.GetHFString();
296 if ( rHdrItemSet.HasItem(ATTR_PAGE_SHARED) && !rHdrItemSet.Get(ATTR_PAGE_SHARED).GetValue())
297 {
298 const ScPageHFItem& rHFItemLeft = rItemSet.Get( ATTR_PAGE_HEADERLEFT );
299 aHFConv.GenerateString( rHFItemLeft.GetLeftArea(), rHFItemLeft.GetCenterArea(), rHFItemLeft.GetRightArea() );
300 maData.maHeaderEven = aHFConv.GetHFString();
301 maData.mbUseEvenHF = true;
302 }
303 else
304 {
305 // If maData.mbUseEvenHF become true, then we will need a copy of maHeader in maHeaderEven.
307 }
308 if (rHdrItemSet.HasItem(ATTR_PAGE_SHARED_FIRST) && !rHdrItemSet.Get(ATTR_PAGE_SHARED_FIRST).GetValue())
309 {
310 const ScPageHFItem& rHFItemFirst = rItemSet.Get( ATTR_PAGE_HEADERFIRST );
311 aHFConv.GenerateString( rHFItemFirst.GetLeftArea(), rHFItemFirst.GetCenterArea(), rHFItemFirst.GetRightArea() );
312 maData.maHeaderFirst = aHFConv.GetHFString();
313 maData.mbUseFirstHF = true;
314 }
315 else
316 {
318 }
319 // header height (Excel excludes header from top margin)
320 sal_Int32 nHdrHeight = rHdrItemSet.Get( ATTR_PAGE_DYNAMIC ).GetValue() ?
321 // dynamic height: calculate header height, add header <-> sheet area distance
322 (aHFConv.GetTotalHeight() + rHdrItemSet.Get( ATTR_ULSPACE ).GetLower()) :
323 // static height: ATTR_PAGE_SIZE already includes header <-> sheet area distance
324 static_cast< sal_Int32 >( rHdrItemSet.Get( ATTR_PAGE_SIZE ).GetSize().Height() );
327 }
328
329 // footer
330 const SfxItemSet& rFtrItemSet = rItemSet.Get( ATTR_PAGE_FOOTERSET ).GetItemSet();
331 if( rFtrItemSet.Get( ATTR_PAGE_ON ).GetValue() )
332 {
333 const ScPageHFItem& rHFItem = rItemSet.Get( ATTR_PAGE_FOOTERRIGHT );
334 aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
335 maData.maFooter = aHFConv.GetHFString();
336 if (rFtrItemSet.HasItem(ATTR_PAGE_SHARED) && !rFtrItemSet.Get(ATTR_PAGE_SHARED).GetValue())
337 {
338 const ScPageHFItem& rHFItemLeft = rItemSet.Get( ATTR_PAGE_FOOTERLEFT );
339 aHFConv.GenerateString( rHFItemLeft.GetLeftArea(), rHFItemLeft.GetCenterArea(), rHFItemLeft.GetRightArea() );
340 maData.maFooterEven = aHFConv.GetHFString();
341 maData.mbUseEvenHF = true;
342 }
343 else
344 {
346 }
347 if (rFtrItemSet.HasItem(ATTR_PAGE_SHARED_FIRST) && !rFtrItemSet.Get(ATTR_PAGE_SHARED_FIRST).GetValue())
348 {
349 const ScPageHFItem& rHFItemFirst = rItemSet.Get( ATTR_PAGE_FOOTERFIRST );
350 aHFConv.GenerateString( rHFItemFirst.GetLeftArea(), rHFItemFirst.GetCenterArea(), rHFItemFirst.GetRightArea() );
351 maData.maFooterFirst = aHFConv.GetHFString();
352 maData.mbUseFirstHF = true;
353 }
354 else
355 {
357 }
358 // footer height (Excel excludes footer from bottom margin)
359 sal_Int32 nFtrHeight = rFtrItemSet.Get( ATTR_PAGE_DYNAMIC ).GetValue() ?
360 // dynamic height: calculate footer height, add sheet area <-> footer distance
361 (aHFConv.GetTotalHeight() + rFtrItemSet.Get( ATTR_ULSPACE ).GetUpper()) :
362 // static height: ATTR_PAGE_SIZE already includes sheet area <-> footer distance
363 static_cast< sal_Int32 >( rFtrItemSet.Get( ATTR_PAGE_SIZE ).GetSize().Height() );
366 }
367 }
368
369 // *** page breaks ***
370
371 set<SCROW> aRowBreaks;
372 rDoc.GetAllRowBreaks(aRowBreaks, nScTab, false, true);
373
374 SCROW const nMaxRow = numeric_limits<sal_uInt16>::max();
375 for (const SCROW nRow : aRowBreaks)
376 {
377 if (nRow > nMaxRow)
378 break;
379
380 maData.maHorPageBreaks.push_back(nRow);
381 }
382
383 if (maData.maHorPageBreaks.size() > 1026)
384 {
385 // Excel allows only up to 1026 page breaks. Trim any excess page breaks.
386 ScfUInt16Vec::iterator itr = maData.maHorPageBreaks.begin();
387 ::std::advance(itr, 1026);
389 }
390
391 set<SCCOL> aColBreaks;
392 rDoc.GetAllColBreaks(aColBreaks, nScTab, false, true);
393 for (const auto& rColBreak : aColBreaks)
394 maData.maVerPageBreaks.push_back(rColBreak);
395}
396
397namespace {
398
399class XclExpXmlStartHeaderFooterElementRecord : public XclExpXmlElementRecord
400{
401public:
402 explicit XclExpXmlStartHeaderFooterElementRecord(sal_Int32 const nElement, bool const bDifferentOddEven = false, bool const bDifferentFirst = false)
403 : XclExpXmlElementRecord(nElement), mbDifferentOddEven(bDifferentOddEven), mbDifferentFirst(bDifferentFirst) {}
404
405 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
406private:
407 bool mbDifferentOddEven;
408 bool mbDifferentFirst;
409};
410
411}
412
413void XclExpXmlStartHeaderFooterElementRecord::SaveXml(XclExpXmlStream& rStrm)
414{
415 // OOXTODO: we currently only emit oddHeader/oddFooter elements, and
416 // do not support the first/even/odd page distinction.
417 sax_fastparser::FSHelperPtr& rStream = rStrm.GetCurrentStream();
418 rStream->startElement( mnElement,
419 // OOXTODO: XML_alignWithMargins,
420 XML_differentFirst, mbDifferentFirst ? "true" : "false",
421 XML_differentOddEven, mbDifferentOddEven ? "true" : "false"
422 // OOXTODO: XML_scaleWithDoc
423 );
424}
425
427{
431 XclExpPageBreaks( EXC_ID_HORPAGEBREAKS, maData.maHorPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).Save( rStrm );
432 XclExpPageBreaks( EXC_ID_VERPAGEBREAKS, maData.maVerPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).Save( rStrm );
442
443 if( (GetBiff() == EXC_BIFF8) && maData.mxBrushItem )
444 if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
445 XclExpImgData( *pGraphic, EXC_ID8_IMGDATA ).Save( rStrm );
446}
447
449{
450 XclExpXmlStartSingleElementRecord( XML_printOptions ).SaveXml( rStrm );
453 XclExpBoolRecord( EXC_ID_GRIDSET, true, XML_gridLinesSet ).SaveXml( rStrm );
454 XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter, XML_horizontalCentered ).SaveXml( rStrm );
455 XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter, XML_verticalCentered ).SaveXml( rStrm );
456 XclExpXmlEndSingleElementRecord().SaveXml( rStrm ); // XML_printOptions
457
458 XclExpXmlStartSingleElementRecord( XML_pageMargins ).SaveXml( rStrm );
459 XclExpDoubleRecord( EXC_ID_LEFTMARGIN, maData.mfLeftMargin ).SetAttribute( XML_left )->SaveXml( rStrm );
460 XclExpDoubleRecord( EXC_ID_RIGHTMARGIN, maData.mfRightMargin ).SetAttribute( XML_right )->SaveXml( rStrm );
461 XclExpDoubleRecord( EXC_ID_TOPMARGIN, maData.mfTopMargin ).SetAttribute( XML_top )->SaveXml( rStrm );
462 XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN, maData.mfBottomMargin ).SetAttribute( XML_bottom )->SaveXml( rStrm );
463 XclExpDoubleRecord( 0, maData.mfHeaderMargin).SetAttribute( XML_header )->SaveXml( rStrm );
464 XclExpDoubleRecord( 0, maData.mfFooterMargin).SetAttribute( XML_footer )->SaveXml( rStrm );
465 XclExpXmlEndSingleElementRecord().SaveXml( rStrm ); // XML_pageMargins
466
468
469 XclExpXmlStartHeaderFooterElementRecord(XML_headerFooter, maData.mbUseEvenHF, maData.mbUseFirstHF).SaveXml(rStrm);
473 {
476 }
478 {
481 }
482 XclExpXmlEndElementRecord( XML_headerFooter ).SaveXml( rStrm );
483
485 static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).SaveXml( rStrm );
487 static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).SaveXml( rStrm );
488}
489
491{
492 if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
493 return new XclExpImgData( *pGraphic, EXC_ID8_IMGDATA );
494
495 return nullptr;
496}
497
499 XclExpRoot( rRoot )
500{
501}
502
504{
511}
512
513/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6176
SC_DLLPUBLIC void GetAllColBreaks(std::set< SCCOL > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4349
SC_DLLPUBLIC bool NeedPageResetAfterTab(SCTAB nTab) const
Definition: document.cxx:6340
SC_DLLPUBLIC void GetAllRowBreaks(std::set< SCROW > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4343
const EditTextObject * GetCenterArea() const
Definition: attrib.hxx:191
const EditTextObject * GetLeftArea() const
Definition: attrib.hxx:190
const EditTextObject * GetRightArea() const
Definition: attrib.hxx:192
Contains the "scale to width/height" attribute in page styles.
Definition: attrib.hxx:230
bool IsValid() const
Definition: attrib.hxx:249
sal_uInt16 GetHeight() const
Definition: attrib.hxx:248
sal_uInt16 GetWidth() const
Definition: attrib.hxx:247
static bool CheckItem(const SfxItemSet &rItemSet, sal_uInt16 nWhichId, bool bDeep)
Returns true, if the passed item set contains the item.
Definition: ftools.cxx:200
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
tools::Long GetRight() const
tools::Long GetLeft() const
bool IsLandscape() const
const Size & GetSize() const
sal_uInt16 GetUpper() const
sal_uInt16 GetLower() const
Record which contains a Boolean value.
Definition: xerecord.hxx:255
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xerecord.cxx:171
virtual void Save(XclExpStream &rStrm) override
Writes all page settings records to the stream.
Definition: xepage.cxx:503
XclPageData maData
Definition: xepage.hxx:121
XclExpChartPageSettings(const XclExpRoot &rRoot)
Creates all records containing the current page settings.
Definition: xepage.cxx:498
Converts edit engine text objects to an Excel header/footer string.
Definition: xehelper.hxx:362
sal_Int32 GetTotalHeight() const
Returns the total height of the last generated header/footer in twips.
Definition: xehelper.hxx:380
void GenerateString(const EditTextObject *pLeftObj, const EditTextObject *pCenterObj, const EditTextObject *pRightObj)
Generates the header/footer string from the passed edit engine text objects.
Definition: xehelper.cxx:674
const OUString & GetHFString() const
Returns the last generated header/footer string.
Definition: xehelper.hxx:378
Represents a HEADER or FOOTER record.
Definition: xepage.hxx:34
virtual void WriteBody(XclExpStream &rStrm) override
Writes the header or footer string.
Definition: xepage.cxx:77
XclExpHeaderFooter(sal_uInt16 nRecId, OUString aHdrString)
Definition: xepage.cxx:53
OUString maHdrString
Definition: xepage.hxx:44
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xepage.cxx:59
Provides export of bitmap data to an IMGDATA record.
Definition: xeescher.hxx:150
virtual void Save(XclExpStream &rStrm) override
Writes the BITMAP record.
Definition: xeescher.cxx:393
Stores an array of manual page breaks for columns or rows.
Definition: xepage.hxx:68
XclExpPageBreaks(sal_uInt16 nRecId, const ScfUInt16Vec &rPageBreaks, sal_uInt16 nMaxPos)
Definition: xepage.cxx:170
sal_uInt16 mnMaxPos
Page settings data of current sheet.
Definition: xepage.hxx:85
virtual void Save(XclExpStream &rStrm) override
Writes the record, if the list is not empty.
Definition: xepage.cxx:177
virtual void WriteBody(XclExpStream &rStrm) override
Writes the page break list.
Definition: xepage.cxx:186
const ScfUInt16Vec & mrPageBreaks
Definition: xepage.hxx:84
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xepage.cxx:199
virtual void Save(XclExpStream &rStrm) override
Writes all page settings records to the stream.
Definition: xepage.cxx:426
XclExpImgData * getGraphicExport()
Definition: xepage.cxx:490
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xepage.cxx:448
XclPageData maData
Definition: xepage.hxx:107
XclExpPageSettings(const XclExpRoot &rRoot)
Creates all records containing the current page settings.
Definition: xepage.cxx:225
virtual void SaveXml(XclExpXmlStream &rStrm)
Definition: xerecord.cxx:40
Base class for single records with any content.
Definition: xerecord.hxx:143
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xerecord.cxx:150
sal_uInt16 GetRecId() const
Returns the current record ID.
Definition: xerecord.hxx:156
void SetRecSize(std::size_t nRecSize)
Sets a new record size prediction.
Definition: xerecord.hxx:163
Access to global data from other classes.
Definition: xeroot.hxx:113
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:118
Represents a SETUP record that contains common page settings.
Definition: xepage.hxx:51
XclExpSetup(const XclPageData &rPageData)
Definition: xepage.cxx:92
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xepage.cxx:98
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the SETUP record.
Definition: xepage.cxx:139
const XclPageData & mrData
Definition: xepage.hxx:61
This class is used to export Excel record streams.
Definition: xestream.hxx:73
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:48
void AssignByte(std::u16string_view rString, rtl_TextEncoding eTextEnc, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Assigns an unformatted string, converts this object to a BIFF2-BIFF7 byte string.
Definition: xestring.cxx:121
void Assign(const OUString &rString, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Assigns an unformatted string, converts this object to a BIFF8 Unicode string.
Definition: xestring.cxx:111
virtual void SaveXml(XclExpXmlStream &rStrm) override
Ends the element nElement.
Definition: xerecord.cxx:96
virtual void SaveXml(XclExpXmlStream &rStrm) override
Ends the single element nElement.
Definition: xerecord.cxx:125
virtual void SaveXml(XclExpXmlStream &rStrm) override
Starts the single element nElement.
Definition: xerecord.cxx:111
SCTAB GetCurrScTab() const
Returns the current Calc sheet index.
Definition: xlroot.hxx:162
ScStyleSheetPool & GetStyleSheetPool() const
Returns the style sheet pool of the Calc document.
Definition: xlroot.cxx:306
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:141
const ScAddress & GetXclMaxPos() const
Returns the highest possible cell address in an Excel document (using current BIFF version).
Definition: xlroot.hxx:246
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:285
static double GetInchFromTwips(sal_Int32 nTwips)
Returns the length in inches calculated from a length in twips.
Definition: xltools.cxx:287
static rtl::Reference< FastAttributeList > createAttrList()
void set_flag(Type &rnBitField, Type nMask, bool bSet=true)
Sets or clears (according to bSet) all set bits of nMask in rnBitField.
Definition: ftools.hxx:95
::std::vector< sal_uInt16 > ScfUInt16Vec
Definition: ftools.hxx:255
void SvStream & rStrm
std::shared_ptr< FastSerializerHelper > FSHelperPtr
ObjectFormatterData & mrData
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(175)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_SHARED(166)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERLEFT(179)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERLEFT(178)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_HORCENTER(162)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_DYNAMIC(165)
constexpr TypedWhichId< SvxSizeItem > ATTR_PAGE_SIZE(161)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_VERCENTER(163)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_HEADERS(170)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_HEADERSET(184)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERRIGHT(181)
constexpr TypedWhichId< SvxULSpaceItem > ATTR_ULSPACE(158)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_GRID(169)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_TOPDOWN(174)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERRIGHT(180)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_FIRSTPAGENO(177)
constexpr TypedWhichId< SvxPageItem > ATTR_PAGE(159)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_NOTES(168)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_HEADERFIRST(182)
constexpr TypedWhichId< ScPageHFItem > ATTR_PAGE_FOOTERFIRST(183)
constexpr TypedWhichId< ScPageScaleToItem > ATTR_PAGE_SCALETO(188)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_SHARED_FIRST(167)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALETOPAGES(176)
constexpr TypedWhichId< SvxSetItem > ATTR_PAGE_FOOTERSET(185)
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_ON(164)
constexpr TypedWhichId< SvxLRSpaceItem > ATTR_LRSPACE(157)
Contains all page (print) settings for a single sheet.
Definition: xlpage.hxx:102
sal_uInt16 mnPaperSize
Right margin to footer.
Definition: xlpage.hxx:128
sal_uInt16 mnVerPrintRes
Horizontal printing resolution.
Definition: xlpage.hxx:138
double mfHeaderMargin
Bottom margin in inches.
Definition: xlpage.hxx:122
sal_uInt16 mnScaling
Start page number.
Definition: xlpage.hxx:134
bool mbBlackWhite
true = in rows; false = in columns.
Definition: xlpage.hxx:144
SvxBrushItemPtr mxBrushItem
Vertical page breaks.
Definition: xlpage.hxx:111
OUString maFooterFirst
Excel header string for first page (empty = off).
Definition: xlpage.hxx:117
sal_uInt16 mnPaperHeight
Paper Width in mm.
Definition: xlpage.hxx:131
bool mbUseEvenHF
Vertical printing resolution.
Definition: xlpage.hxx:139
bool mbPrintHeadings
true = centered vertically; false = top aligned.
Definition: xlpage.hxx:151
bool mbManualStart
true = print notes.
Definition: xlpage.hxx:147
ScfUInt16Vec maHorPageBreaks
Definition: xlpage.hxx:109
OUString maFooterEven
Excel header string for even pages (empty = off).
Definition: xlpage.hxx:115
sal_uInt16 mnFitToHeight
Fit to number of pages in width.
Definition: xlpage.hxx:136
double mfRightMargin
Left margin in inches.
Definition: xlpage.hxx:119
bool mbPortrait
false = some of the values are not valid.
Definition: xlpage.hxx:142
bool mbVerCenter
true = centered horizontally; false = left aligned.
Definition: xlpage.hxx:150
sal_uInt16 mnStrictPaperSize
Index into paper size table.
Definition: xlpage.hxx:129
double mfFooterMargin
Margin main page to header.
Definition: xlpage.hxx:123
bool mbValid
True = use maHeaderFirst/maFooterFirst.
Definition: xlpage.hxx:141
OUString maHeaderFirst
Excel footer string for even pages (empty = off).
Definition: xlpage.hxx:116
bool mbDraftQuality
true = black/white; false = colors.
Definition: xlpage.hxx:145
OUString maFooter
Excel header string (empty = off).
Definition: xlpage.hxx:113
bool mbPrintGrid
true = print column and row headings.
Definition: xlpage.hxx:152
sal_uInt16 mnFitToWidth
Scaling in percent.
Definition: xlpage.hxx:135
bool mbUseFirstHF
True = use maHeaderEven/maFooterEven.
Definition: xlpage.hxx:140
sal_uInt16 mnPaperWidth
Same as papersize - but for ooxml (considering stricter dimensions)
Definition: xlpage.hxx:130
OUString maHeaderEven
Excel footer string (empty = off).
Definition: xlpage.hxx:114
void SetScPaperSize(const Size &rSize, bool bPortrait, bool bStrict=false)
Sets the Excel paper size index and paper orientation from Calc paper size (twips).
Definition: xlpage.cxx:220
sal_uInt16 mnCopies
Paper Height in mm.
Definition: xlpage.hxx:132
double mfBottomMargin
Top margin in inches.
Definition: xlpage.hxx:121
bool mbHorCenter
true = fit to pages; false = scale in percent.
Definition: xlpage.hxx:149
sal_uInt16 mnHorPrintRes
Fit to number of pages in height.
Definition: xlpage.hxx:137
bool mbPrintNotes
true = draft; false = default quality.
Definition: xlpage.hxx:146
ScfUInt16Vec maVerPageBreaks
Horizontal page breaks.
Definition: xlpage.hxx:110
double mfTopMargin
Right margin in inches.
Definition: xlpage.hxx:120
bool mbFitToPages
true = mnStartPage valid; false = automatic.
Definition: xlpage.hxx:148
bool mbPrintInRows
true = portrait; false = landscape.
Definition: xlpage.hxx:143
OUString maHeader
Background bitmap.
Definition: xlpage.hxx:112
sal_uInt16 mnStartPage
Number of copies.
Definition: xlpage.hxx:133
double mfLeftMargin
Excel footer string for first page (empty = off).
Definition: xlpage.hxx:118
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int32 SCROW
Definition: types.hxx:17
XclExpValueRecord< double > XclExpDoubleRecord
A record containing a double value.
Definition: xerecord.hxx:250
XclExpValueRecord< sal_uInt16 > XclExpUInt16Record
A record containing an unsigned 16-bit value.
Definition: xerecord.hxx:247
XclBiff
An enumeration for all Excel file format types (BIFF types).
Definition: xlconst.hxx:30
@ EXC_BIFF5
MS Excel 4.0.
Definition: xlconst.hxx:34
@ EXC_BIFF8
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:35
const sal_uInt16 EXC_ID8_IMGDATA
Definition: xlescher.hxx:242
const sal_uInt16 EXC_ID_FOOTER
Definition: xlpage.hxx:31
const sal_uInt16 EXC_ID_HEADER_FIRST
Definition: xlpage.hxx:40
const sal_uInt16 EXC_ID_PRINTHEADERS
Left/right footer default margin in 1/100mm.
Definition: xlpage.hxx:63
const sal_uInt16 EXC_ID_VCENTER
Definition: xlpage.hxx:78
const sal_uInt16 EXC_ID_PRINTSIZE
Definition: xlpage.hxx:68
const sal_uInt16 EXC_SETUP_BLACKWHITE
Definition: xlpage.hxx:87
const sal_uInt16 EXC_SETUP_PRINTNOTES
Definition: xlpage.hxx:89
const sal_uInt16 EXC_PRINTSIZE_FULL
Definition: xlpage.hxx:72
const sal_uInt16 EXC_SETUP_DRAFT
Definition: xlpage.hxx:88
const sal_uInt16 EXC_ID_RIGHTMARGIN
Definition: xlpage.hxx:51
const sal_uInt16 EXC_ID_LEFTMARGIN
Definition: xlpage.hxx:50
const sal_uInt16 EXC_SETUP_NOTES_END
Definition: xlpage.hxx:91
const sal_uInt16 EXC_SETUP_STARTPAGE
Definition: xlpage.hxx:90
const sal_uInt16 EXC_ID_SETUP
Definition: xlpage.hxx:82
const sal_uInt16 EXC_ID_TOPMARGIN
Definition: xlpage.hxx:52
const sal_uInt16 EXC_PAPERSIZE_USER
Definition: xlpage.hxx:94
const sal_uInt16 EXC_ID_GRIDSET
Definition: xlpage.hxx:76
const sal_uInt16 EXC_ID_HEADER
Definition: xlpage.hxx:30
const sal_uInt16 EXC_ID_FOOTER_FIRST
Definition: xlpage.hxx:41
const sal_uInt16 EXC_ID_HEADER_EVEN
Definition: xlpage.hxx:35
const sal_uInt16 EXC_SETUP_INVALID
Definition: xlpage.hxx:86
const sal_uInt16 EXC_ID_HORPAGEBREAKS
Definition: xlpage.hxx:46
const sal_uInt16 EXC_ID_FOOTER_EVEN
Definition: xlpage.hxx:36
const sal_uInt16 EXC_ID_VERPAGEBREAKS
Definition: xlpage.hxx:45
const sal_uInt16 EXC_SETUP_INROWS
Definition: xlpage.hxx:84
const sal_uInt16 EXC_ID_PRINTGRIDLINES
Definition: xlpage.hxx:64
const sal_uInt16 EXC_SETUP_PORTRAIT
Definition: xlpage.hxx:85
const sal_uInt16 EXC_ID_BOTTOMMARGIN
Definition: xlpage.hxx:53
const sal_uInt16 EXC_ID_HCENTER
Definition: xlpage.hxx:77
@ EightBitLength
Always use UCS-2 characters (default: try to compress). BIFF8 only.