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  css::uno::Reference< css::xml::sax::XFastAttributeList > aAttrs(pAttrList);
134  rStrm.GetCurrentStream()->singleElement( XML_pageSetup, aAttrs );
135 }
136 
138 {
139  XclBiff eBiff = rStrm.GetRoot().GetBiff();
140 
141  sal_uInt16 nFlags = 0;
146  if( eBiff >= EXC_BIFF5 )
147  {
149  /* Set the Comments/Notes to "At end of sheet" if Print Notes is true.
150  We don't currently support "as displayed on sheet". Thus this value
151  will be re-interpreted to "At end of sheet". */
152  const sal_uInt16 nNotes = EXC_SETUP_PRINTNOTES | EXC_SETUP_NOTES_END;
153  ::set_flag( nFlags, nNotes, mrData.mbPrintNotes );
155  }
156 
158  << mrData.mnFitToWidth << mrData.mnFitToHeight << nFlags;
159  if( eBiff >= EXC_BIFF5 )
160  {
163  }
164 }
165 
166 // Manual page breaks ---------------------------------------------------------
167 
168 XclExpPageBreaks::XclExpPageBreaks( sal_uInt16 nRecId, const ScfUInt16Vec& rPageBreaks, sal_uInt16 nMaxPos ) :
169  XclExpRecord( nRecId ),
170  mrPageBreaks( rPageBreaks ),
171  mnMaxPos( nMaxPos )
172 {
173 }
174 
176 {
177  if( !mrPageBreaks.empty() )
178  {
179  SetRecSize( 2 + ((rStrm.GetRoot().GetBiff() <= EXC_BIFF5) ? 2 : 6) * mrPageBreaks.size() );
180  XclExpRecord::Save( rStrm );
181  }
182 }
183 
185 {
186  bool bWriteRange = (rStrm.GetRoot().GetBiff() == EXC_BIFF8);
187 
188  rStrm << static_cast< sal_uInt16 >( mrPageBreaks.size() );
189  for( const auto& rPageBreak : mrPageBreaks )
190  {
191  rStrm << rPageBreak;
192  if( bWriteRange )
193  rStrm << sal_uInt16( 0 ) << mnMaxPos;
194  }
195 }
196 
198 {
199  if( mrPageBreaks.empty() )
200  return;
201 
202  sal_Int32 nElement = GetRecId() == EXC_ID_HORPAGEBREAKS ? XML_rowBreaks : XML_colBreaks;
203  sax_fastparser::FSHelperPtr& pWorksheet = rStrm.GetCurrentStream();
204  OString sNumPageBreaks = OString::number( mrPageBreaks.size() );
205  pWorksheet->startElement( nElement,
206  XML_count, sNumPageBreaks,
207  XML_manualBreakCount, sNumPageBreaks );
208  for( const auto& rPageBreak : mrPageBreaks )
209  {
210  pWorksheet->singleElement( XML_brk,
211  XML_id, OString::number(rPageBreak),
212  XML_man, "true",
213  XML_max, OString::number(mnMaxPos),
214  XML_min, "0"
215  // OOXTODO: XML_pt, ""
216  );
217  }
218  pWorksheet->endElement( nElement );
219 }
220 
221 // Page settings ==============================================================
222 
224  XclExpRoot( rRoot )
225 {
226  ScDocument& rDoc = GetDoc();
227  SCTAB nScTab = GetCurrScTab();
228 
229  if( SfxStyleSheetBase* pStyleSheet = GetStyleSheetPool().Find( rDoc.GetPageStyle( nScTab ), SfxStyleFamily::Page ) )
230  {
231  const SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
232  maData.mbValid = true;
233 
234  // *** page settings ***
235 
236  maData.mbPrintInRows = ! rItemSet.Get( ATTR_PAGE_TOPDOWN ).GetValue();
237  maData.mbHorCenter = rItemSet.Get( ATTR_PAGE_HORCENTER ).GetValue();
238  maData.mbVerCenter = rItemSet.Get( ATTR_PAGE_VERCENTER ).GetValue();
239  maData.mbPrintHeadings = rItemSet.Get( ATTR_PAGE_HEADERS ).GetValue();
240  maData.mbPrintGrid = rItemSet.Get( ATTR_PAGE_GRID ).GetValue();
241  maData.mbPrintNotes = rItemSet.Get( ATTR_PAGE_NOTES ).GetValue();
242 
243  maData.mnStartPage = rItemSet.Get( ATTR_PAGE_FIRSTPAGENO ).GetValue();
244  maData.mbManualStart = maData.mnStartPage && (!nScTab || rDoc.NeedPageResetAfterTab( nScTab - 1 ));
245 
246  const SvxLRSpaceItem& rLRItem = rItemSet.Get( ATTR_LRSPACE );
249  const SvxULSpaceItem& rULItem = rItemSet.Get( ATTR_ULSPACE );
250  maData.mfTopMargin = XclTools::GetInchFromTwips( rULItem.GetUpper() );
251  maData.mfBottomMargin = XclTools::GetInchFromTwips( rULItem.GetLower() );
252 
253  const SvxPageItem& rPageItem = rItemSet.Get( ATTR_PAGE );
254  const SvxSizeItem& rSizeItem = rItemSet.Get( ATTR_PAGE_SIZE );
255  maData.SetScPaperSize( rSizeItem.GetSize(), !rPageItem.IsLandscape() );
256 
257  const ScPageScaleToItem& rScaleToItem = rItemSet.Get( ATTR_PAGE_SCALETO );
258  sal_uInt16 nPages = rItemSet.Get( ATTR_PAGE_SCALETOPAGES ).GetValue();
259  sal_uInt16 nScale = rItemSet.Get( ATTR_PAGE_SCALE ).GetValue();
260 
261  if( ScfTools::CheckItem( rItemSet, ATTR_PAGE_SCALETO, false ) && rScaleToItem.IsValid() )
262  {
263  maData.mnFitToWidth = rScaleToItem.GetWidth();
264  maData.mnFitToHeight = rScaleToItem.GetHeight();
265  maData.mbFitToPages = true;
266  }
267  else if( ScfTools::CheckItem( rItemSet, ATTR_PAGE_SCALETOPAGES, false ) && nPages )
268  {
269  maData.mnFitToWidth = 1;
270  maData.mnFitToHeight = nPages;
271  maData.mbFitToPages = true;
272  }
273  else if( nScale )
274  {
275  maData.mnScaling = nScale;
276  maData.mbFitToPages = false;
277  }
278 
279  maData.mxBrushItem.reset( new SvxBrushItem( rItemSet.Get( ATTR_BACKGROUND ) ) );
280  maData.mbUseEvenHF = false;
281 
282  // *** header and footer ***
283 
284  XclExpHFConverter aHFConv( GetRoot() );
285 
286  // header
287  const SfxItemSet& rHdrItemSet = rItemSet.Get( ATTR_PAGE_HEADERSET ).GetItemSet();
288  if( rHdrItemSet.Get( ATTR_PAGE_ON ).GetValue() )
289  {
290  const ScPageHFItem& rHFItem = rItemSet.Get( ATTR_PAGE_HEADERRIGHT );
291  aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
292  maData.maHeader = aHFConv.GetHFString();
293  if ( rHdrItemSet.HasItem(ATTR_PAGE_SHARED) && !rHdrItemSet.Get(ATTR_PAGE_SHARED).GetValue())
294  {
295  const ScPageHFItem& rHFItemLeft = rItemSet.Get( ATTR_PAGE_HEADERLEFT );
296  aHFConv.GenerateString( rHFItemLeft.GetLeftArea(), rHFItemLeft.GetCenterArea(), rHFItemLeft.GetRightArea() );
297  maData.maHeaderEven = aHFConv.GetHFString();
298  maData.mbUseEvenHF = true;
299  }
300  else
301  {
302  // If maData.mbUseEvenHF become true, then we will need a copy of maHeader in maHeaderEven.
304  }
305  // header height (Excel excludes header from top margin)
306  sal_Int32 nHdrHeight = rHdrItemSet.Get( ATTR_PAGE_DYNAMIC ).GetValue() ?
307  // dynamic height: calculate header height, add header <-> sheet area distance
308  (aHFConv.GetTotalHeight() + rHdrItemSet.Get( ATTR_ULSPACE ).GetLower()) :
309  // static height: ATTR_PAGE_SIZE already includes header <-> sheet area distance
310  static_cast< sal_Int32 >( rHdrItemSet.Get( ATTR_PAGE_SIZE ).GetSize().Height() );
313  }
314 
315  // footer
316  const SfxItemSet& rFtrItemSet = rItemSet.Get( ATTR_PAGE_FOOTERSET ).GetItemSet();
317  if( rFtrItemSet.Get( ATTR_PAGE_ON ).GetValue() )
318  {
319  const ScPageHFItem& rHFItem = rItemSet.Get( ATTR_PAGE_FOOTERRIGHT );
320  aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
321  maData.maFooter = aHFConv.GetHFString();
322  if (rFtrItemSet.HasItem(ATTR_PAGE_SHARED) && !rFtrItemSet.Get(ATTR_PAGE_SHARED).GetValue())
323  {
324  const ScPageHFItem& rHFItemLeft = rItemSet.Get( ATTR_PAGE_FOOTERLEFT );
325  aHFConv.GenerateString( rHFItemLeft.GetLeftArea(), rHFItemLeft.GetCenterArea(), rHFItemLeft.GetRightArea() );
326  maData.maFooterEven = aHFConv.GetHFString();
327  maData.mbUseEvenHF = true;
328  }
329  else
330  {
332  }
333  // footer height (Excel excludes footer from bottom margin)
334  sal_Int32 nFtrHeight = rFtrItemSet.Get( ATTR_PAGE_DYNAMIC ).GetValue() ?
335  // dynamic height: calculate footer height, add sheet area <-> footer distance
336  (aHFConv.GetTotalHeight() + rFtrItemSet.Get( ATTR_ULSPACE ).GetUpper()) :
337  // static height: ATTR_PAGE_SIZE already includes sheet area <-> footer distance
338  static_cast< sal_Int32 >( rFtrItemSet.Get( ATTR_PAGE_SIZE ).GetSize().Height() );
341  }
342  }
343 
344  // *** page breaks ***
345 
346  set<SCROW> aRowBreaks;
347  rDoc.GetAllRowBreaks(aRowBreaks, nScTab, false, true);
348 
349  SCROW const nMaxRow = numeric_limits<sal_uInt16>::max();
350  for (const SCROW nRow : aRowBreaks)
351  {
352  if (nRow > nMaxRow)
353  break;
354 
355  maData.maHorPageBreaks.push_back(nRow);
356  }
357 
358  if (maData.maHorPageBreaks.size() > 1026)
359  {
360  // Excel allows only up to 1026 page breaks. Trim any excess page breaks.
361  ScfUInt16Vec::iterator itr = maData.maHorPageBreaks.begin();
362  ::std::advance(itr, 1026);
363  maData.maHorPageBreaks.erase(itr, maData.maHorPageBreaks.end());
364  }
365 
366  set<SCCOL> aColBreaks;
367  rDoc.GetAllColBreaks(aColBreaks, nScTab, false, true);
368  for (const auto& rColBreak : aColBreaks)
369  maData.maVerPageBreaks.push_back(rColBreak);
370 }
371 
372 namespace {
373 
374 class XclExpXmlStartHeaderFooterElementRecord : public XclExpXmlElementRecord
375 {
376 public:
377  explicit XclExpXmlStartHeaderFooterElementRecord(sal_Int32 const nElement, bool const bDifferentOddEven = false)
378  : XclExpXmlElementRecord(nElement), mbDifferentOddEven(bDifferentOddEven) {}
379 
380  virtual void SaveXml( XclExpXmlStream& rStrm ) override;
381 private:
382  bool mbDifferentOddEven;
383 };
384 
385 }
386 
387 void XclExpXmlStartHeaderFooterElementRecord::SaveXml(XclExpXmlStream& rStrm)
388 {
389  // OOXTODO: we currently only emit oddHeader/oddFooter elements, and
390  // do not support the first/even/odd page distinction.
392  rStream->startElement( mnElement,
393  // OOXTODO: XML_alignWithMargins,
394  XML_differentFirst, "false", // OOXTODO
395  XML_differentOddEven, mbDifferentOddEven ? "true" : "false"
396  // OOXTODO: XML_scaleWithDoc
397  );
398 }
399 
401 {
404  XclExpBoolRecord( EXC_ID_GRIDSET, true ).Save( rStrm );
405  XclExpPageBreaks( EXC_ID_HORPAGEBREAKS, maData.maHorPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).Save( rStrm );
406  XclExpPageBreaks( EXC_ID_VERPAGEBREAKS, maData.maVerPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).Save( rStrm );
415  XclExpSetup( maData ).Save( rStrm );
416 
417  if( (GetBiff() == EXC_BIFF8) && maData.mxBrushItem )
418  if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
419  XclExpImgData( *pGraphic, EXC_ID8_IMGDATA ).Save( rStrm );
420 }
421 
423 {
424  XclExpXmlStartSingleElementRecord( XML_printOptions ).SaveXml( rStrm );
427  XclExpBoolRecord( EXC_ID_GRIDSET, true, XML_gridLinesSet ).SaveXml( rStrm );
428  XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter, XML_horizontalCentered ).SaveXml( rStrm );
429  XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter, XML_verticalCentered ).SaveXml( rStrm );
430  XclExpXmlEndSingleElementRecord().SaveXml( rStrm ); // XML_printOptions
431 
432  XclExpXmlStartSingleElementRecord( XML_pageMargins ).SaveXml( rStrm );
433  XclExpDoubleRecord( EXC_ID_LEFTMARGIN, maData.mfLeftMargin ).SetAttribute( XML_left )->SaveXml( rStrm );
434  XclExpDoubleRecord( EXC_ID_RIGHTMARGIN, maData.mfRightMargin ).SetAttribute( XML_right )->SaveXml( rStrm );
435  XclExpDoubleRecord( EXC_ID_TOPMARGIN, maData.mfTopMargin ).SetAttribute( XML_top )->SaveXml( rStrm );
436  XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN, maData.mfBottomMargin ).SetAttribute( XML_bottom )->SaveXml( rStrm );
437  XclExpDoubleRecord( 0, maData.mfHeaderMargin).SetAttribute( XML_header )->SaveXml( rStrm );
438  XclExpDoubleRecord( 0, maData.mfFooterMargin).SetAttribute( XML_footer )->SaveXml( rStrm );
439  XclExpXmlEndSingleElementRecord().SaveXml( rStrm ); // XML_pageMargins
440 
441  XclExpSetup( maData ).SaveXml( rStrm );
442 
443  XclExpXmlStartHeaderFooterElementRecord(XML_headerFooter, maData.mbUseEvenHF).SaveXml(rStrm);
446  if (maData.mbUseEvenHF)
447  {
450  }
451  XclExpXmlEndElementRecord( XML_headerFooter ).SaveXml( rStrm );
452 
454  static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).SaveXml( rStrm );
456  static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).SaveXml( rStrm );
457 }
458 
460 {
461  if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
462  return new XclExpImgData( *pGraphic, EXC_ID8_IMGDATA );
463 
464  return nullptr;
465 }
466 
468  XclExpRoot( rRoot )
469 {
470 }
471 
473 {
478  XclExpSetup( maData ).Save( rStrm );
480 }
481 
482 /* 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:44
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:175
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:402
This class is used to export Excel record streams.
Definition: xestream.hxx:71
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_GRID(168)
static FastAttributeList * createAttrList()
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:184
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:422
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:94
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:197
XclExpChartPageSettings(const XclExpRoot &rRoot)
Creates all records containing the current page settings.
Definition: xepage.cxx:467
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_VERCENTER(163)
virtual void Save(XclExpStream &rStrm) override
Writes all page settings records to the stream.
Definition: xepage.cxx:472
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
void AssignByte(const OUString &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
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the SETUP record.
Definition: xepage.cxx:137
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:909
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:223
XclExpImgData * getGraphicExport()
Definition: xepage.cxx:459
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:4349
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:285
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6179
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:221
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:379
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
void add(const FastAttributeList &)
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:254
Contains the "scale to width/height" attribute in page styles.
Definition: attrib.hxx:223
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
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:377
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:6345
XclExpPageBreaks(sal_uInt16 nRecId, const ScfUInt16Vec &rPageBreaks, sal_uInt16 nMaxPos)
Definition: xepage.cxx:168
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:400
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:4342
constexpr TypedWhichId< SfxBoolItem > ATTR_PAGE_ON(164)
const XclExpRoot & GetRoot() const
Returns the filter root data.
Definition: xestream.hxx:86
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:360
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