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