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