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