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_XLPAGE_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XLPAGE_HXX
22 
23 #include <tools/gen.hxx>
24 #include "ftools.hxx"
25 #include <memory>
26 
27 // Constants and Enumerations =================================================
28 
29 // (0x0014, 0x0015) HEADER, FOOTER --------------------------------------------
30 
31 const sal_uInt16 EXC_ID_HEADER              = 0x0014;
32 const sal_uInt16 EXC_ID_FOOTER              = 0x0015;
33 
34 // (0x001A, 0x001B) VERTICAL-, HORIZONTALPAGEBREAKS ---------------------------
35 
36 const sal_uInt16 EXC_ID_VERPAGEBREAKS       = 0x001A;
37 const sal_uInt16 EXC_ID_HORPAGEBREAKS       = 0x001B;
38 
39 // (0x0026, 0x0027, 0x0028, 0x0029) LEFT-, RIGHT-, TOP-, BOTTOMMARGIN ---------
40 
41 const sal_uInt16 EXC_ID_LEFTMARGIN          = 0x0026;
42 const sal_uInt16 EXC_ID_RIGHTMARGIN         = 0x0027;
43 const sal_uInt16 EXC_ID_TOPMARGIN           = 0x0028;
44 const sal_uInt16 EXC_ID_BOTTOMMARGIN        = 0x0029;
45 
46 const sal_Int32 EXC_MARGIN_DEFAULT_LR       = 1900;     /// Left/right default margin in 1/100mm.
47 const sal_Int32 EXC_MARGIN_DEFAULT_TB       = 2500;     /// Top/bottom default margin in 1/100mm.
48 const sal_Int32 EXC_MARGIN_DEFAULT_HF       = 1300;     /// Header/footer default margin in 1/100mm.
49 const sal_Int32 EXC_MARGIN_DEFAULT_HLR      = 1900;     /// Left/right header default margin in 1/100mm.
50 const sal_Int32 EXC_MARGIN_DEFAULT_FLR      = 1900;     /// Left/right footer default margin in 1/100mm.
51 
52 // (0x002A, 0x002B) PRINTHEADERS, PRINTGRIDLINES ------------------------------
53 
54 const sal_uInt16 EXC_ID_PRINTHEADERS        = 0x002A;
55 const sal_uInt16 EXC_ID_PRINTGRIDLINES      = 0x002B;
56 
57 // (0x0033) PRINTSIZE ---------------------------------------------------------
58 
59 const sal_uInt16 EXC_ID_PRINTSIZE           = 0x0033;
60 
61 const sal_uInt16 EXC_PRINTSIZE_SCREEN       = 1;
62 const sal_uInt16 EXC_PRINTSIZE_PAGE         = 2;
63 const sal_uInt16 EXC_PRINTSIZE_FULL         = 3;
64 
65 // (0x0082, 0x0083, 0x0084) GRIDSET, HCENTER, VCENTER -------------------------
66 
67 const sal_uInt16 EXC_ID_GRIDSET             = 0x0082;
68 const sal_uInt16 EXC_ID_HCENTER             = 0x0083;
69 const sal_uInt16 EXC_ID_VCENTER             = 0x0084;
70 
71 // (0x00A1) SETUP -------------------------------------------------------------
72 
73 const sal_uInt16 EXC_ID_SETUP               = 0x00A1;
74 
75 const sal_uInt16 EXC_SETUP_INROWS           = 0x0001;
76 const sal_uInt16 EXC_SETUP_PORTRAIT         = 0x0002;
77 const sal_uInt16 EXC_SETUP_INVALID          = 0x0004;
78 const sal_uInt16 EXC_SETUP_BLACKWHITE       = 0x0008;
79 const sal_uInt16 EXC_SETUP_DRAFT            = 0x0010;
80 const sal_uInt16 EXC_SETUP_PRINTNOTES       = 0x0020;
81 const sal_uInt16 EXC_SETUP_STARTPAGE        = 0x0080;
82 const sal_uInt16 EXC_SETUP_NOTES_END        = 0x0200;
83 
84 const sal_uInt16 EXC_PAPERSIZE_DEFAULT      = 0;
85 const sal_uInt16 EXC_PAPERSIZE_USER         = 0xFFFF;
86 
87 // Page settings ==============================================================
88 
89 class SvxBrushItem;
90 
91 /** Contains all page (print) settings for a single sheet. */
92 struct XclPageData
93 {
94     /** noncopyable */
95     XclPageData(const XclPageData&) = delete;
96     const XclPageData& operator=(const XclPageData&) = delete;
97 
98     typedef std::unique_ptr< SvxBrushItem > SvxBrushItemPtr;
99 
100     ScfUInt16Vec        maHorPageBreaks;    /// Horizontal page breaks.
101     ScfUInt16Vec        maVerPageBreaks;    /// Vertical page breaks.
102     SvxBrushItemPtr     mxBrushItem;        /// Background bitmap.
103     OUString            maHeader;           /// Excel header string (empty = off).
104     OUString            maFooter;           /// Excel footer string (empty = off).
105     double              mfLeftMargin;       /// Left margin in inches.
106     double              mfRightMargin;      /// Right margin in inches.
107     double              mfTopMargin;        /// Top margin in inches.
108     double              mfBottomMargin;     /// Bottom margin in inches.
109     double              mfHeaderMargin;     /// Margin main page to header.
110     double              mfFooterMargin;     /// Margin main page to footer.
111     double              mfHdrLeftMargin;    /// Left margin to header.
112     double              mfHdrRightMargin;   /// Right margin to header.
113     double              mfFtrLeftMargin;    /// Left margin to footer.
114     double              mfFtrRightMargin;   /// Right margin to footer.
115     sal_uInt16          mnPaperSize;        /// Index into paper size table.
116     sal_uInt16          mnStrictPaperSize;  /// Same as papersize - but for ooxml (considering stricter dimensions)
117     sal_uInt16          mnPaperWidth;       /// Paper Width in mm
118     sal_uInt16          mnPaperHeight;      /// Paper Height in mm
119     sal_uInt16          mnCopies;           /// Number of copies.
120     sal_uInt16          mnStartPage;        /// Start page number.
121     sal_uInt16          mnScaling;          /// Scaling in percent.
122     sal_uInt16          mnFitToWidth;       /// Fit to number of pages in width.
123     sal_uInt16          mnFitToHeight;      /// Fit to number of pages in height.
124     sal_uInt16          mnHorPrintRes;      /// Horizontal printing resolution.
125     sal_uInt16          mnVerPrintRes;      /// Vertical printing resolution.
126     bool                mbValid;            /// false = some of the values are not valid.
127     bool                mbPortrait;         /// true = portrait; false = landscape.
128     bool                mbPrintInRows;      /// true = in rows; false = in columns.
129     bool                mbBlackWhite;       /// true = black/white; false = colors.
130     bool                mbDraftQuality;     /// true = draft; false = default quality.
131     bool                mbPrintNotes;       /// true = print notes.
132     bool                mbManualStart;      /// true = mnStartPage valid; false = automatic.
133     bool                mbFitToPages;       /// true = fit to pages; false = scale in percent.
134     bool                mbHorCenter;        /// true = centered horizontally; false = left aligned.
135     bool                mbVerCenter;        /// true = centered vertically; false = top aligned.
136     bool                mbPrintHeadings;    /// true = print column and row headings.
137     bool                mbPrintGrid;        /// true = print grid lines.
138 
139     explicit            XclPageData();
140                         ~XclPageData();
141 
142     /** Sets Excel default page settings. */
143     void                SetDefaults();
144 
145     /** Returns the real paper size (twips) from the paper size index and paper orientation. */
146     Size                GetScPaperSize() const;
147     /** Sets the Excel paper size index and paper orientation from Calc paper size (twips). */
148     void                SetScPaperSize( const Size& rSize, bool bPortrait, bool bStrict = false );
149 };
150 
151 #endif
152 
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
154