LibreOffice Module sc (master)  1
pagesettings.hxx
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 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_PAGESETTINGS_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_PAGESETTINGS_HXX
22 
23 #include <memory>
24 #include <string_view>
25 
26 #include "worksheethelper.hxx"
27 
28 namespace oox { class AttributeList; }
29 namespace oox { class PropertySet; }
30 namespace oox::core { class Relations; }
31 
32 namespace oox::xls {
33 
34 class HeaderFooterParser;
35 
38 {
39  css::uno::Reference<css::graphic::XGraphic> mxGraphic;
40  OUString maBinSettPath;
41  OUString maOddHeader;
42  OUString maOddFooter;
43  OUString maEvenHeader;
44  OUString maEvenFooter;
45  OUString maFirstHeader;
46  OUString maFirstFooter;
47  double mfLeftMargin;
48  double mfRightMargin;
49  double mfTopMargin;
50  double mfBottomMargin;
51  double mfHeaderMargin;
52  double mfFooterMargin;
53  sal_Int32 mnPaperSize;
54  sal_Int32 mnPaperWidth;
55  sal_Int32 mnPaperHeight;
56  sal_Int32 mnCopies;
57  sal_Int32 mnScale;
58  sal_Int32 mnFirstPage;
59  sal_Int32 mnFitToWidth;
60  sal_Int32 mnFitToHeight;
61  sal_Int32 mnHorPrintRes;
62  sal_Int32 mnVerPrintRes;
63  sal_Int32 mnOrientation;
64  sal_Int32 mnPageOrder;
65  sal_Int32 mnCellComments;
66  sal_Int32 mnPrintErrors;
67  bool mbUseEvenHF;
68  bool mbUseFirstHF;
71  bool mbBlackWhite;
73  bool mbFitToPages;
74  bool mbHorCenter;
75  bool mbVerCenter;
76  bool mbPrintGrid;
78 
79  explicit PageSettingsModel();
80 
82  void setBiffPrintErrors( sal_uInt8 nPrintErrors );
83 };
84 
86 {
87 public:
88  explicit PageSettings( const WorksheetHelper& rHelper );
89 
91  void importPrintOptions( const AttributeList& rAttribs );
93  void importPageMargins( const AttributeList& rAttribs );
95  void importPageSetup( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs );
97  void importChartPageSetup( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs );
99  void importHeaderFooter( const AttributeList& rAttribs );
102  std::u16string_view rChars, sal_Int32 nElement );
104  void importPicture( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs );
105 
109  void importPageMargins( SequenceInputStream& rStrm );
111  void importPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
113  void importChartPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
117  void importPicture( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
118 
120  void setFitToPagesMode( bool bFitToPages );
121 
123  void finalizeImport();
124 
125 private:
127  void importPictureData( const ::oox::core::Relations& rRelations, const OUString& rRelId );
128 
129 private:
131 };
132 
134 {
135 public:
136  explicit PageSettingsConverter( const WorkbookHelper& rHelper );
137  virtual ~PageSettingsConverter() override;
138 
141  PropertySet& rPropSet,
142  const PageSettingsModel& rModel,
143  WorksheetType eSheetType );
144 
145 private:
147  {
148  sal_Int32 mnLeftPropId;
149  sal_Int32 mnRightPropId;
150  sal_Int32 mnHeight;
151  sal_Int32 mnBodyDist;
155 
156  explicit HFHelperData( sal_Int32 nLeftPropId, sal_Int32 nRightPropId );
157  };
158 
159 private:
161  PropertySet& rPropSet,
162  HFHelperData& orHFData,
163  const OUString& rOddContent,
164  const OUString& rEvenContent,
165  bool bUseEvenContent,
166  double fPageMargin,
167  double fContentMargin );
168 
169  sal_Int32 writeHeaderFooter(
170  PropertySet& rPropSet,
171  sal_Int32 nPropId,
172  const OUString& rContent );
173 
174 private:
175  typedef ::std::unique_ptr< HeaderFooterParser > HeaderFooterParserPtr;
176  HeaderFooterParserPtr mxHFParser;
179 };
180 
181 } // namespace oox::xls
182 
183 #endif
184 
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class to provide access to global workbook data.
bool mbHorCenter
True = Fit to width/height; false = scale in percent.
sal_Int32 mnHorPrintRes
Fit to number of pages in vertical direction.
sal_Int32 mnPrintErrors
Cell comments printing mode.
HFHelperData(sal_Int32 nLeftPropId, sal_Int32 nRightPropId)
OUString maFirstFooter
Header string for first page of the sheet.
OUString maBinSettPath
Background Graphic.
sal_Int32 mnCopies
Paper height in twips.
void convertHeaderFooterData(PropertySet &rPropSet, HFHelperData &orHFData, const OUString &rOddContent, const OUString &rEvenContent, bool bUseEvenContent, double fPageMargin, double fContentMargin)
PageSettings(const WorksheetHelper &rHelper)
sal_Int32 mnFitToWidth
First page number.
void importHeaderFooter(const AttributeList &rAttribs)
Imports header and footer settings from a headerFooter element.
bool mbVerCenter
True = horizontally centered.
OUString maEvenHeader
Footer string for odd pages.
sal_Int32 mnFirstPage
Page scale (zoom in percent).
css::uno::Reference< css::graphic::XGraphic > mxGraphic
bool mbPrintGrid
True = vertically centered.
OUString maOddHeader
Relation identifier of binary printer settings.
bool mbBlackWhite
True = start page numbering with mnFirstPage.
sal_Int32 mnFitToHeight
Fit to number of pages in horizontal direction.
void importPicture(const ::oox::core::Relations &rRelations, const AttributeList &rAttribs)
Imports the picture element.
sal_Int32 mnCellComments
Page order through sheet area (to left or down).
HeaderFooterParserPtr mxHFParser
void importPrintOptions(const AttributeList &rAttribs)
Imports printing options from a printOptions element.
double mfHeaderMargin
Margin between end of sheet area and bottom edge of page.
Holds page style data for a single sheet.
PageSettingsConverter(const WorkbookHelper &rHelper)
OUString maEvenFooter
Header string for even pages.
void importHeaderFooterCharacters(std::u16string_view rChars, sal_Int32 nElement)
Imports header/footer characters from a headerFooter element.
bool mbUseEvenHF
Cell error printing mode.
double mfFooterMargin
Margin between top edge of page and begin of header.
double mfRightMargin
Margin between left edge of page and begin of sheet area.
sal_Int32 mnPageOrder
Landscape or portrait.
double mfLeftMargin
Footer string for first page of the sheet.
sal_Int32 mnPaperWidth
Paper size (enumeration).
void setBiffPrintErrors(sal_uInt8 nPrintErrors)
Sets the BIFF print errors mode.
bool mbUseFirstHF
True = use maEvenHeader/maEvenFooter.
sal_Int32 mnPaperHeight
Paper width in twips.
OUString maOddFooter
Header string for odd pages.
PageSettingsModel maModel
double mfTopMargin
Margin between end of sheet area and right edge of page.
bool mbValidSettings
True = use maFirstHeader/maFirstFooter.
sal_Int32 mnScale
Number of copies to print.
bool mbFitToPages
True = print in draft quality.
void finalizeImport()
Creates a page style for the spreadsheet and sets all page properties.
unsigned char sal_uInt8
void importPageSetup(const ::oox::core::Relations &rRelations, const AttributeList &rAttribs)
Imports pageSetup element for worksheets.
sal_Int32 mnOrientation
Vertical printing resolution in DPI.
virtual ~PageSettingsConverter() override
bool mbPrintHeadings
True = print grid lines.
void importPageMargins(const AttributeList &rAttribs)
Imports pageMarings element containing page margins.
void importChartPageSetup(const ::oox::core::Relations &rRelations, const AttributeList &rAttribs)
Imports pageSetup element for chart sheets.
sal_Int32 mnPaperSize
Margin between end of footer and bottom edge of page.
void writePageSettingsProperties(PropertySet &rPropSet, const PageSettingsModel &rModel, WorksheetType eSheetType)
Writes all properties to the passed property set of a page style object.
bool mbDraftQuality
True = print black and white.
sal_Int32 writeHeaderFooter(PropertySet &rPropSet, sal_Int32 nPropId, const OUString &rContent)
::std::unique_ptr< HeaderFooterParser > HeaderFooterParserPtr
void setFitToPagesMode(bool bFitToPages)
Sets whether percentual scaling or fit to width/height scaling is used.
PageSettingsModel()
True = print column/row headings.
WorksheetType
An enumeration for all types of sheets in a workbook.
void SvStream & rStrm
bool mbUseFirstPage
True = use imported settings.
sal_Int32 mnVerPrintRes
Horizontal printing resolution in DPI.
OUString maFirstHeader
Footer string for even pages.
void importPictureData(const ::oox::core::Relations &rRelations, const OUString &rRelId)
Imports the binary picture data from the fragment with the passed identifier.
double mfBottomMargin
Margin between top edge of page and begin of sheet area.