LCOV - code coverage report
Current view: top level - sc/source/filter/inc - pagesettings.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 2 100.0 %
Date: 2012-08-25 Functions: 2 3 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef OOX_XLS_PAGESETTINGS_HXX
      30                 :            : #define OOX_XLS_PAGESETTINGS_HXX
      31                 :            : 
      32                 :            : #include "worksheethelper.hxx"
      33                 :            : 
      34                 :            : namespace oox { class PropertySet; }
      35                 :            : namespace oox { namespace core { class Relations; } }
      36                 :            : 
      37                 :            : namespace oox {
      38                 :            : namespace xls {
      39                 :            : 
      40                 :            : class HeaderFooterParser;
      41                 :            : 
      42                 :            : // ============================================================================
      43                 :            : 
      44                 :            : /** Holds page style data for a single sheet. */
      45                 :         60 : struct PageSettingsModel
      46                 :            : {
      47                 :            :     ::rtl::OUString     maGraphicUrl;           /// URL of the graphic object.
      48                 :            :     ::rtl::OUString     maBinSettPath;          /// Relation identifier of binary printer settings.
      49                 :            :     ::rtl::OUString     maOddHeader;            /// Header string for odd pages.
      50                 :            :     ::rtl::OUString     maOddFooter;            /// Footer string for odd pages.
      51                 :            :     ::rtl::OUString     maEvenHeader;           /// Header string for even pages.
      52                 :            :     ::rtl::OUString     maEvenFooter;           /// Footer string for even pages.
      53                 :            :     ::rtl::OUString     maFirstHeader;          /// Header string for first page of the sheet.
      54                 :            :     ::rtl::OUString     maFirstFooter;          /// Footer string for first page of the sheet.
      55                 :            :     double              mfLeftMargin;           /// Margin between left edge of page and begin of sheet area.
      56                 :            :     double              mfRightMargin;          /// Margin between end of sheet area and right edge of page.
      57                 :            :     double              mfTopMargin;            /// Margin between top egde of page and begin of sheet area.
      58                 :            :     double              mfBottomMargin;         /// Margin between end of sheet area and bottom edge of page.
      59                 :            :     double              mfHeaderMargin;         /// Margin between top edge of page and begin of header.
      60                 :            :     double              mfFooterMargin;         /// Margin between end of footer and bottom edge of page.
      61                 :            :     sal_Int32           mnPaperSize;            /// Paper size (enumeration).
      62                 :            :     sal_Int32           mnPaperWidth;           /// Paper width in twips
      63                 :            :     sal_Int32           mnPaperHeight;          /// Paper height in twips
      64                 :            :     sal_Int32           mnCopies;               /// Number of copies to print.
      65                 :            :     sal_Int32           mnScale;                /// Page scale (zoom in percent).
      66                 :            :     sal_Int32           mnFirstPage;            /// First page number.
      67                 :            :     sal_Int32           mnFitToWidth;           /// Fit to number of pages in horizontal direction.
      68                 :            :     sal_Int32           mnFitToHeight;          /// Fit to number of pages in vertical direction.
      69                 :            :     sal_Int32           mnHorPrintRes;          /// Horizontal printing resolution in DPI.
      70                 :            :     sal_Int32           mnVerPrintRes;          /// Vertical printing resolution in DPI.
      71                 :            :     sal_Int32           mnOrientation;          /// Landscape or portrait.
      72                 :            :     sal_Int32           mnPageOrder;            /// Page order through sheet area (to left or down).
      73                 :            :     sal_Int32           mnCellComments;         /// Cell comments printing mode.
      74                 :            :     sal_Int32           mnPrintErrors;          /// Cell error printing mode.
      75                 :            :     bool                mbUseEvenHF;            /// True = use maEvenHeader/maEvenFooter.
      76                 :            :     bool                mbUseFirstHF;           /// True = use maFirstHeader/maFirstFooter.
      77                 :            :     bool                mbValidSettings;        /// True = use imported settings.
      78                 :            :     bool                mbUseFirstPage;         /// True = start page numbering with mnFirstPage.
      79                 :            :     bool                mbBlackWhite;           /// True = print black and white.
      80                 :            :     bool                mbDraftQuality;         /// True = print in draft quality.
      81                 :            :     bool                mbFitToPages;           /// True = Fit to width/height; false = scale in percent.
      82                 :            :     bool                mbHorCenter;            /// True = horizontally centered.
      83                 :            :     bool                mbVerCenter;            /// True = vertically centered.
      84                 :            :     bool                mbPrintGrid;            /// True = print grid lines.
      85                 :            :     bool                mbPrintHeadings;        /// True = print column/row headings.
      86                 :            : 
      87                 :            :     explicit            PageSettingsModel();
      88                 :            : 
      89                 :            :     /** Sets the BIFF print errors mode. */
      90                 :            :     void                setBiffPrintErrors( sal_uInt8 nPrintErrors );
      91                 :            : };
      92                 :            : 
      93                 :            : // ============================================================================
      94                 :            : 
      95         [ -  + ]:         60 : class PageSettings : public WorksheetHelper
      96                 :            : {
      97                 :            : public:
      98                 :            :     explicit            PageSettings( const WorksheetHelper& rHelper );
      99                 :            : 
     100                 :            :     /** Imports printing options from a printOptions element. */
     101                 :            :     void                importPrintOptions( const AttributeList& rAttribs );
     102                 :            :     /** Imports pageMarings element containing page margins. */
     103                 :            :     void                importPageMargins( const AttributeList& rAttribs );
     104                 :            :     /** Imports pageSetup element for worksheets. */
     105                 :            :     void                importPageSetup( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs );
     106                 :            :     /** Imports pageSetup element for chart sheets. */
     107                 :            :     void                importChartPageSetup( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs );
     108                 :            :     /** Imports header and footer settings from a headerFooter element. */
     109                 :            :     void                importHeaderFooter( const AttributeList& rAttribs );
     110                 :            :     /** Imports header/footer characters from a headerFooter element. */
     111                 :            :     void                importHeaderFooterCharacters( const ::rtl::OUString& rChars, sal_Int32 nElement );
     112                 :            :     /** Imports the picture element. */
     113                 :            :     void                importPicture( const ::oox::core::Relations& rRelations, const AttributeList& rAttribs );
     114                 :            : 
     115                 :            :     /** Imports the PRINTOPTIONS record from the passed stream. */
     116                 :            :     void                importPrintOptions( SequenceInputStream& rStrm );
     117                 :            :     /** Imports the PAGEMARGINS record from the passed stream. */
     118                 :            :     void                importPageMargins( SequenceInputStream& rStrm );
     119                 :            :     /** Imports the PAGESETUP record from the passed stream. */
     120                 :            :     void                importPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
     121                 :            :     /** Imports the CHARTPAGESETUP record from the passed stream. */
     122                 :            :     void                importChartPageSetup( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
     123                 :            :     /** Imports the HEADERFOOTER record from the passed stream. */
     124                 :            :     void                importHeaderFooter( SequenceInputStream& rStrm );
     125                 :            :     /** Imports the PICTURE record from the passed stream. */
     126                 :            :     void                importPicture( const ::oox::core::Relations& rRelations, SequenceInputStream& rStrm );
     127                 :            : 
     128                 :            :     /** Sets whether percentual scaling or fit to width/height scaling is used. */
     129                 :            :     void                setFitToPagesMode( bool bFitToPages );
     130                 :            : 
     131                 :            :     /** Creates a page style for the spreadsheet and sets all page properties. */
     132                 :            :     void                finalizeImport();
     133                 :            : 
     134                 :            : private:
     135                 :            :     /** Imports the binary picture data from the fragment with the passed identifier. */
     136                 :            :     void                importPictureData( const ::oox::core::Relations& rRelations, const ::rtl::OUString& rRelId );
     137                 :            : 
     138                 :            : private:
     139                 :            :     PageSettingsModel   maModel;
     140                 :            : };
     141                 :            : 
     142                 :            : // ============================================================================
     143                 :            : 
     144                 :            : class PageSettingsConverter : public WorkbookHelper
     145                 :            : {
     146                 :            : public:
     147                 :            :     explicit            PageSettingsConverter( const WorkbookHelper& rHelper );
     148                 :            :     virtual             ~PageSettingsConverter();
     149                 :            : 
     150                 :            :     /** Writes all properties to the passed property set of a page style object. */
     151                 :            :     void                writePageSettingsProperties(
     152                 :            :                             PropertySet& rPropSet,
     153                 :            :                             const PageSettingsModel& rModel,
     154                 :            :                             WorksheetType eSheetType );
     155                 :            : 
     156                 :            : private:
     157                 :            :     struct HFHelperData
     158                 :            :     {
     159                 :            :         sal_Int32           mnLeftPropId;
     160                 :            :         sal_Int32           mnRightPropId;
     161                 :            :         sal_Int32           mnHeight;
     162                 :            :         sal_Int32           mnBodyDist;
     163                 :            :         bool                mbHasContent;
     164                 :            :         bool                mbShareOddEven;
     165                 :            :         bool                mbDynamicHeight;
     166                 :            : 
     167                 :            :         explicit            HFHelperData( sal_Int32 nLeftPropId, sal_Int32 nRightPropId );
     168                 :            :     };
     169                 :            : 
     170                 :            : private:
     171                 :            :     void                convertHeaderFooterData(
     172                 :            :                             PropertySet& rPropSet,
     173                 :            :                             HFHelperData& orHFData,
     174                 :            :                             const ::rtl::OUString rOddContent,
     175                 :            :                             const ::rtl::OUString rEvenContent,
     176                 :            :                             bool bUseEvenContent,
     177                 :            :                             double fPageMargin,
     178                 :            :                             double fContentMargin );
     179                 :            : 
     180                 :            :     sal_Int32           writeHeaderFooter(
     181                 :            :                             PropertySet& rPropSet,
     182                 :            :                             sal_Int32 nPropId,
     183                 :            :                             const ::rtl::OUString& rContent );
     184                 :            : 
     185                 :            : private:
     186                 :            :     typedef ::std::auto_ptr< HeaderFooterParser > HeaderFooterParserPtr;
     187                 :            :     HeaderFooterParserPtr mxHFParser;
     188                 :            :     HFHelperData        maHeaderData;
     189                 :            :     HFHelperData        maFooterData;
     190                 :            : };
     191                 :            : 
     192                 :            : // ============================================================================
     193                 :            : 
     194                 :            : } // namespace xls
     195                 :            : } // namespace oox
     196                 :            : 
     197                 :            : #endif
     198                 :            : 
     199                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10