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 #pragma once
21 
22 #include "xlpage.hxx"
23 #include "xiroot.hxx"
24 
25 // Page settings ==============================================================
26 
27 /** Contains all page (print) settings for a single sheet.
28     @descr  Supports reading all related records and creating a page style sheet. */
29 class XclImpPageSettings : protected XclImpRoot
30 {
31 public:
32     explicit            XclImpPageSettings( const XclImpRoot& rRoot );
33 
34     /** Returns read-only access to the page data. */
GetPageData() const35     const XclPageData& GetPageData() const { return maData; }
36 
37     /** Initializes the object to be used for a new sheet. */
38     void                Initialize();
39 
40     /** Reads a SETUP record and inserts contained data. */
41     void                ReadSetup( XclImpStream& rStrm );
42     /** Reads a ***MARGIN record (reads all 4 margin records). */
43     void                ReadMargin( XclImpStream& rStrm );
44     /** Reads a HCENTER or VCENTER record. */
45     void                ReadCenter( XclImpStream& rStrm );
46     /** Reads a HEADER or FOOTER record. */
47     void                ReadHeaderFooter( XclImpStream& rStrm );
48     /** Reads a HORIZONTALPAGEBREAKS or VERTICALPAGEBREAKS record. */
49     void                ReadPageBreaks( XclImpStream& rStrm );
50     /** Reads a PRINTHEADERS record. */
51     void                ReadPrintHeaders( XclImpStream& rStrm );
52     /** Reads a PRINTGRIDLINES record. */
53     void                ReadPrintGridLines( XclImpStream& rStrm );
54     /** Reads an IMGDATA record and creates the SvxBrushItem. */
55     void                ReadImgData( XclImpStream& rStrm );
56 
57     /** Overrides paper size and orientation (used in sheet-charts). */
58     void                SetPaperSize( sal_uInt16 nXclPaperSize, bool bPortrait );
59     /** Sets or clears the fit-to-pages setting (contained in WSBOOL record). */
SetFitToPages(bool bFitToPages)60     void         SetFitToPages( bool bFitToPages ) { maData.mbFitToPages = bFitToPages; }
61 
62     /** Creates a page stylesheet from current settings and sets it at current sheet. */
63     void                Finalize();
64 
65 private:
66     XclPageData         maData;         /// Page settings data.
67     bool                mbValidPaper;   /// true = Paper size and orientation valid.
68 };
69 
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
71