LCOV - code coverage report
Current view: top level - sc/source/filter/excel - xepage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 227 0.4 %
Date: 2012-08-25 Functions: 2 18 11.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 430 0.5 %

           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                 :            : 
      30                 :            : #include "xepage.hxx"
      31                 :            : #include <svl/itemset.hxx>
      32                 :            : #include "scitems.hxx"
      33                 :            : #include <svl/eitem.hxx>
      34                 :            : #include <svl/intitem.hxx>
      35                 :            : #include <svx/pageitem.hxx>
      36                 :            : #include <editeng/sizeitem.hxx>
      37                 :            : #include <editeng/lrspitem.hxx>
      38                 :            : #include <editeng/ulspitem.hxx>
      39                 :            : #include <editeng/brshitem.hxx>
      40                 :            : #include "document.hxx"
      41                 :            : #include "stlpool.hxx"
      42                 :            : #include "stlsheet.hxx"
      43                 :            : #include "attrib.hxx"
      44                 :            : #include "xehelper.hxx"
      45                 :            : #include "xeescher.hxx"
      46                 :            : 
      47                 :            : #include <set>
      48                 :            : #include <limits>
      49                 :            : 
      50                 :            : using namespace ::oox;
      51                 :            : 
      52                 :            : using ::rtl::OString;
      53                 :            : using ::std::set;
      54                 :            : using ::std::numeric_limits;
      55                 :            : 
      56                 :            : // Page settings records ======================================================
      57                 :            : 
      58                 :            : // Header/footer --------------------------------------------------------------
      59                 :            : 
      60                 :          0 : XclExpHeaderFooter::XclExpHeaderFooter( sal_uInt16 nRecId, const String& rHdrString ) :
      61                 :            :     XclExpRecord( nRecId ),
      62         [ #  # ]:          0 :     maHdrString( rHdrString )
      63                 :            : {
      64                 :          0 : }
      65                 :            : 
      66                 :          0 : void XclExpHeaderFooter::SaveXml( XclExpXmlStream& rStrm )
      67                 :            : {
      68                 :          0 :     sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
      69         [ #  # ]:          0 :     sal_Int32 nElement = GetRecId() == EXC_ID_HEADER ?  XML_oddHeader : XML_oddFooter;
      70                 :          0 :     rWorksheet->startElement( nElement, FSEND );
      71         [ #  # ]:          0 :     rWorksheet->writeEscaped( XclXmlUtils::ToOUString( maHdrString ) );
      72                 :          0 :     rWorksheet->endElement( nElement );
      73                 :          0 : }
      74                 :            : 
      75                 :          0 : void XclExpHeaderFooter::WriteBody( XclExpStream& rStrm )
      76                 :            : {
      77         [ #  # ]:          0 :     if( maHdrString.Len() )
      78                 :            :     {
      79         [ #  # ]:          0 :         XclExpString aExString;
      80         [ #  # ]:          0 :         if( rStrm.GetRoot().GetBiff() <= EXC_BIFF5 )
      81         [ #  # ]:          0 :             aExString.AssignByte( maHdrString, rStrm.GetRoot().GetTextEncoding(), EXC_STR_8BITLENGTH );
      82                 :            :         else
      83         [ #  # ]:          0 :             aExString.Assign( maHdrString, EXC_STR_DEFAULT, 255 );  // 16-bit length, but max 255 chars
      84         [ #  # ]:          0 :         rStrm << aExString;
      85                 :            :     }
      86                 :          0 : }
      87                 :            : 
      88                 :            : // General page settings ------------------------------------------------------
      89                 :            : 
      90                 :          0 : XclExpSetup::XclExpSetup( const XclPageData& rPageData ) :
      91                 :            :     XclExpRecord( EXC_ID_SETUP, 34 ),
      92                 :          0 :     mrData( rPageData )
      93                 :            : {
      94                 :          0 : }
      95                 :            : 
      96                 :          0 : void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
      97                 :            : {
      98 [ #  # ][ #  # ]:          0 :     sax_fastparser::FastAttributeList* pAttrList=rStrm.GetCurrentStream()->createAttrList();
      99 [ #  # ][ #  # ]:          0 :     if( rStrm.getVersion() != oox::core::ISOIEC_29500_2008 ||
         [ #  # ][ #  # ]
     100                 :            :         mrData.mnStrictPaperSize != EXC_PAPERSIZE_USER )
     101                 :            :     {
     102         [ #  # ]:          0 :         pAttrList->add( XML_paperSize,           OString::valueOf( (sal_Int32) mrData.mnPaperSize ).getStr() );
     103                 :            :     }
     104                 :            :     else
     105                 :            :     {
     106         [ #  # ]:          0 :         pAttrList->add( XML_paperWidth,          OString::valueOf( (sal_Int32) mrData.mnPaperWidth ).concat(OString("mm")).getStr() );
     107         [ #  # ]:          0 :         pAttrList->add( XML_paperHeight,         OString::valueOf( (sal_Int32) mrData.mnPaperHeight ).concat(OString("mm")).getStr() );
     108                 :            :         // pAttrList->add( XML_paperUnits,          "mm" );
     109                 :            :     }
     110         [ #  # ]:          0 :     pAttrList->add( XML_scale,              OString::valueOf( (sal_Int32) mrData.mnScaling ).getStr() );
     111         [ #  # ]:          0 :     pAttrList->add( XML_firstPageNumber,    OString::valueOf( (sal_Int32) mrData.mnStartPage ).getStr() );
     112         [ #  # ]:          0 :     pAttrList->add( XML_fitToWidth,         OString::valueOf( (sal_Int32) mrData.mnFitToWidth ).getStr() );
     113         [ #  # ]:          0 :     pAttrList->add( XML_fitToHeight,        OString::valueOf( (sal_Int32) mrData.mnFitToHeight ).getStr() );
     114 [ #  # ][ #  # ]:          0 :     pAttrList->add( XML_pageOrder,          mrData.mbPrintInRows ? "overThenDown" : "downThenOver" );
     115 [ #  # ][ #  # ]:          0 :     pAttrList->add( XML_orientation,        mrData.mbPortrait ? "portrait" : "landscape" );   // OOXTODO: "default"?
     116 [ #  # ][ #  # ]:          0 :     pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( !mrData.mbValid ) );
     117 [ #  # ][ #  # ]:          0 :     pAttrList->add( XML_blackAndWhite,      XclXmlUtils::ToPsz( mrData.mbBlackWhite ) );
     118 [ #  # ][ #  # ]:          0 :     pAttrList->add( XML_draft,              XclXmlUtils::ToPsz( mrData.mbDraftQuality ) );
     119 [ #  # ][ #  # ]:          0 :     pAttrList->add( XML_cellComments,       mrData.mbPrintNotes ? "atEnd" : "none" );         // OOXTODO: "asDisplayed"?
     120 [ #  # ][ #  # ]:          0 :     pAttrList->add( XML_useFirstPageNumber, XclXmlUtils::ToPsz( mrData.mbManualStart ) );
     121                 :            :     // OOXTODO: XML_errors, // == displayed|blank|dash|NA
     122         [ #  # ]:          0 :     pAttrList->add( XML_horizontalDpi,      OString::valueOf( (sal_Int32) mrData.mnHorPrintRes ).getStr() );
     123         [ #  # ]:          0 :     pAttrList->add( XML_verticalDpi,        OString::valueOf( (sal_Int32) mrData.mnVerPrintRes ).getStr() );
     124         [ #  # ]:          0 :     pAttrList->add( XML_copies,             OString::valueOf( (sal_Int32) mrData.mnCopies ).getStr() );
     125                 :            :     // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
     126                 :            : 
     127 [ #  # ][ #  # ]:          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList > aAttrs(pAttrList);
     128 [ #  # ][ #  # ]:          0 :     rStrm.GetCurrentStream()->singleElement( XML_pageSetup, aAttrs );
     129                 :          0 : }
     130                 :            : 
     131                 :          0 : void XclExpSetup::WriteBody( XclExpStream& rStrm )
     132                 :            : {
     133                 :          0 :     XclBiff eBiff = rStrm.GetRoot().GetBiff();
     134                 :            : 
     135                 :          0 :     sal_uInt16 nFlags = 0;
     136                 :          0 :     ::set_flag( nFlags, EXC_SETUP_INROWS,       mrData.mbPrintInRows );
     137                 :          0 :     ::set_flag( nFlags, EXC_SETUP_PORTRAIT,     mrData.mbPortrait );
     138                 :          0 :     ::set_flag( nFlags, EXC_SETUP_INVALID,      !mrData.mbValid );
     139                 :          0 :     ::set_flag( nFlags, EXC_SETUP_BLACKWHITE,   mrData.mbBlackWhite );
     140         [ #  # ]:          0 :     if( eBiff >= EXC_BIFF5 )
     141                 :            :     {
     142                 :          0 :         ::set_flag( nFlags, EXC_SETUP_DRAFT,        mrData.mbDraftQuality );
     143                 :            :         /*  Set the Comments/Notes to "At end of sheet" if Print Notes is true.
     144                 :            :             We don't currently support "as displayed on sheet". Thus this value
     145                 :            :             will be re-interpreted to "At end of sheet". */
     146                 :          0 :         const sal_uInt16 nNotes = EXC_SETUP_PRINTNOTES | EXC_SETUP_NOTES_END;
     147                 :          0 :         ::set_flag( nFlags, nNotes,                 mrData.mbPrintNotes );
     148                 :          0 :         ::set_flag( nFlags, EXC_SETUP_STARTPAGE,    mrData.mbManualStart );
     149                 :            :     }
     150                 :            : 
     151 [ #  # ][ #  # ]:          0 :     rStrm   << mrData.mnPaperSize << mrData.mnScaling << mrData.mnStartPage
                 [ #  # ]
     152 [ #  # ][ #  # ]:          0 :             << mrData.mnFitToWidth << mrData.mnFitToHeight << nFlags;
                 [ #  # ]
     153         [ #  # ]:          0 :     if( eBiff >= EXC_BIFF5 )
     154                 :            :     {
     155 [ #  # ][ #  # ]:          0 :         rStrm   << mrData.mnHorPrintRes << mrData.mnVerPrintRes
     156 [ #  # ][ #  # ]:          0 :                 << mrData.mfHeaderMargin << mrData.mfFooterMargin << mrData.mnCopies;
                 [ #  # ]
     157                 :            :     }
     158                 :          0 : }
     159                 :            : 
     160                 :            : // Manual page breaks ---------------------------------------------------------
     161                 :            : 
     162                 :          0 : XclExpPageBreaks::XclExpPageBreaks( sal_uInt16 nRecId, const ScfUInt16Vec& rPageBreaks, sal_uInt16 nMaxPos ) :
     163                 :            :     XclExpRecord( nRecId ),
     164                 :            :     mrPageBreaks( rPageBreaks ),
     165                 :          0 :     mnMaxPos( nMaxPos )
     166                 :            : {
     167                 :          0 : }
     168                 :            : 
     169                 :          0 : void XclExpPageBreaks::Save( XclExpStream& rStrm )
     170                 :            : {
     171         [ #  # ]:          0 :     if( !mrPageBreaks.empty() )
     172                 :            :     {
     173         [ #  # ]:          0 :         SetRecSize( 2 + ((rStrm.GetRoot().GetBiff() <= EXC_BIFF5) ? 2 : 6) * mrPageBreaks.size() );
     174                 :          0 :         XclExpRecord::Save( rStrm );
     175                 :            :     }
     176                 :          0 : }
     177                 :            : 
     178                 :          0 : void XclExpPageBreaks::WriteBody( XclExpStream& rStrm )
     179                 :            : {
     180                 :          0 :     bool bWriteRange = (rStrm.GetRoot().GetBiff() == EXC_BIFF8);
     181                 :            : 
     182                 :          0 :     rStrm << static_cast< sal_uInt16 >( mrPageBreaks.size() );
     183 [ #  # ][ #  # ]:          0 :     for( ScfUInt16Vec::const_iterator aIt = mrPageBreaks.begin(), aEnd = mrPageBreaks.end(); aIt != aEnd; ++aIt )
                 [ #  # ]
     184                 :            :     {
     185 [ #  # ][ #  # ]:          0 :         rStrm << *aIt;
     186         [ #  # ]:          0 :         if( bWriteRange )
     187 [ #  # ][ #  # ]:          0 :             rStrm << sal_uInt16( 0 ) << mnMaxPos;
     188                 :            :     }
     189                 :          0 : }
     190                 :            : 
     191                 :          0 : void XclExpPageBreaks::SaveXml( XclExpXmlStream& rStrm )
     192                 :            : {
     193         [ #  # ]:          0 :     if( mrPageBreaks.empty() )
     194                 :          0 :         return;
     195                 :            : 
     196         [ #  # ]:          0 :     sal_Int32 nElement = GetRecId() == EXC_ID_HORPAGEBREAKS ? XML_rowBreaks : XML_colBreaks;
     197         [ #  # ]:          0 :     sax_fastparser::FSHelperPtr& pWorksheet = rStrm.GetCurrentStream();
     198                 :          0 :     OString sNumPageBreaks = OString::valueOf( (sal_Int32) mrPageBreaks.size() );
     199                 :            :     pWorksheet->startElement( nElement,
     200                 :            :             XML_count,              sNumPageBreaks.getStr(),
     201                 :            :             XML_manualBreakCount,   sNumPageBreaks.getStr(),
     202         [ #  # ]:          0 :             FSEND );
     203 [ #  # ][ #  # ]:          0 :     for( ScfUInt16Vec::const_iterator aIt = mrPageBreaks.begin(), aEnd = mrPageBreaks.end(); aIt != aEnd; ++aIt )
                 [ #  # ]
     204                 :            :     {
     205                 :            :         pWorksheet->singleElement( XML_brk,
     206         [ #  # ]:          0 :                 XML_id,     OString::valueOf( (sal_Int32) *aIt ).getStr(),
     207                 :            :                 XML_man,    "true",
     208                 :            :                 XML_max,    OString::valueOf( (sal_Int32) mnMaxPos ).getStr(),
     209                 :            :                 XML_min,    "0",
     210                 :            :                 // OOXTODO: XML_pt, "",
     211         [ #  # ]:          0 :                 FSEND );
     212                 :            :     }
     213         [ #  # ]:          0 :     pWorksheet->endElement( nElement );
     214                 :            : }
     215                 :            : 
     216                 :            : // Page settings ==============================================================
     217                 :            : 
     218                 :          0 : XclExpPageSettings::XclExpPageSettings( const XclExpRoot& rRoot ) :
     219 [ #  # ][ #  # ]:          0 :     XclExpRoot( rRoot )
     220                 :            : {
     221                 :          0 :     ScDocument& rDoc = GetDoc();
     222                 :          0 :     SCTAB nScTab = GetCurrScTab();
     223                 :            : 
     224 [ #  # ][ #  # ]:          0 :     if( SfxStyleSheetBase* pStyleSheet = GetStyleSheetPool().Find( rDoc.GetPageStyle( nScTab ), SFX_STYLE_FAMILY_PAGE ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     225                 :            :     {
     226         [ #  # ]:          0 :         const SfxItemSet& rItemSet = pStyleSheet->GetItemSet();
     227                 :          0 :         maData.mbValid = true;
     228                 :            : 
     229                 :            :         // *** page settings ***
     230                 :            : 
     231         [ #  # ]:          0 :         maData.mbPrintInRows   = !GETITEMBOOL( rItemSet, ATTR_PAGE_TOPDOWN   );
     232         [ #  # ]:          0 :         maData.mbHorCenter     =  GETITEMBOOL( rItemSet, ATTR_PAGE_HORCENTER );
     233         [ #  # ]:          0 :         maData.mbVerCenter     =  GETITEMBOOL( rItemSet, ATTR_PAGE_VERCENTER );
     234         [ #  # ]:          0 :         maData.mbPrintHeadings =  GETITEMBOOL( rItemSet, ATTR_PAGE_HEADERS   );
     235         [ #  # ]:          0 :         maData.mbPrintGrid     =  GETITEMBOOL( rItemSet, ATTR_PAGE_GRID      );
     236         [ #  # ]:          0 :         maData.mbPrintNotes    =  GETITEMBOOL( rItemSet, ATTR_PAGE_NOTES     );
     237                 :            : 
     238         [ #  # ]:          0 :         maData.mnStartPage     = GETITEMVALUE( rItemSet, SfxUInt16Item, ATTR_PAGE_FIRSTPAGENO, sal_uInt16 );
     239 [ #  # ][ #  # ]:          0 :         maData.mbManualStart   = maData.mnStartPage && (!nScTab || rDoc.NeedPageResetAfterTab( nScTab - 1 ));
         [ #  # ][ #  # ]
     240                 :            : 
     241         [ #  # ]:          0 :         const SvxLRSpaceItem& rLRItem = GETITEM( rItemSet, SvxLRSpaceItem, ATTR_LRSPACE );
     242         [ #  # ]:          0 :         maData.mfLeftMargin    = XclTools::GetInchFromTwips( rLRItem.GetLeft() );
     243         [ #  # ]:          0 :         maData.mfRightMargin   = XclTools::GetInchFromTwips( rLRItem.GetRight() );
     244         [ #  # ]:          0 :         const SvxULSpaceItem& rULItem = GETITEM( rItemSet, SvxULSpaceItem, ATTR_ULSPACE );
     245         [ #  # ]:          0 :         maData.mfTopMargin     = XclTools::GetInchFromTwips( rULItem.GetUpper() );
     246         [ #  # ]:          0 :         maData.mfBottomMargin  = XclTools::GetInchFromTwips( rULItem.GetLower() );
     247                 :            : 
     248         [ #  # ]:          0 :         const SvxPageItem& rPageItem = GETITEM( rItemSet, SvxPageItem, ATTR_PAGE );
     249         [ #  # ]:          0 :         const SvxSizeItem& rSizeItem = GETITEM( rItemSet, SvxSizeItem, ATTR_PAGE_SIZE );
     250         [ #  # ]:          0 :         maData.SetScPaperSize( rSizeItem.GetSize(), !rPageItem.IsLandscape() );
     251                 :            : 
     252         [ #  # ]:          0 :         const ScPageScaleToItem& rScaleToItem = GETITEM( rItemSet, ScPageScaleToItem, ATTR_PAGE_SCALETO );
     253         [ #  # ]:          0 :         sal_uInt16 nPages = GETITEMVALUE( rItemSet, SfxUInt16Item, ATTR_PAGE_SCALETOPAGES, sal_uInt16 );
     254         [ #  # ]:          0 :         sal_uInt16 nScale = GETITEMVALUE( rItemSet, SfxUInt16Item, ATTR_PAGE_SCALE, sal_uInt16 );
     255                 :            : 
     256 [ #  # ][ #  # ]:          0 :         if( ScfTools::CheckItem( rItemSet, ATTR_PAGE_SCALETO, false ) && rScaleToItem.IsValid() )
         [ #  # ][ #  # ]
     257                 :            :         {
     258                 :          0 :             maData.mnFitToWidth = rScaleToItem.GetWidth();
     259                 :          0 :             maData.mnFitToHeight = rScaleToItem.GetHeight();
     260                 :          0 :             maData.mbFitToPages = true;
     261                 :            : 
     262                 :            :         }
     263 [ #  # ][ #  # ]:          0 :         else if( ScfTools::CheckItem( rItemSet, ATTR_PAGE_SCALETOPAGES, false ) && nPages )
         [ #  # ][ #  # ]
     264                 :            :         {
     265                 :          0 :             maData.mnFitToWidth = 1;
     266                 :          0 :             maData.mnFitToHeight = nPages;
     267                 :          0 :             maData.mbFitToPages = true;
     268                 :            :         }
     269         [ #  # ]:          0 :         else if( nScale )
     270                 :            :         {
     271                 :          0 :             maData.mnScaling = nScale;
     272                 :          0 :             maData.mbFitToPages = false;
     273                 :            :         }
     274                 :            : 
     275 [ #  # ][ #  # ]:          0 :         maData.mxBrushItem.reset( new SvxBrushItem( GETITEM( rItemSet, SvxBrushItem, ATTR_BACKGROUND ) ) );
                 [ #  # ]
     276                 :            : 
     277                 :            :         // *** header and footer ***
     278                 :            : 
     279         [ #  # ]:          0 :         XclExpHFConverter aHFConv( GetRoot() );
     280                 :            : 
     281                 :            :         // header
     282         [ #  # ]:          0 :         const SfxItemSet& rHdrItemSet = GETITEM( rItemSet, SvxSetItem, ATTR_PAGE_HEADERSET ).GetItemSet();
     283 [ #  # ][ #  # ]:          0 :         if( GETITEMBOOL( rHdrItemSet, ATTR_PAGE_ON ) )
     284                 :            :         {
     285         [ #  # ]:          0 :             const ScPageHFItem& rHFItem = GETITEM( rItemSet, ScPageHFItem, ATTR_PAGE_HEADERRIGHT );
     286         [ #  # ]:          0 :             aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
     287         [ #  # ]:          0 :             maData.maHeader = aHFConv.GetHFString();
     288                 :            :             // header height (Excel excludes header from top margin)
     289         [ #  # ]:          0 :             sal_Int32 nHdrHeight = GETITEMBOOL( rHdrItemSet, ATTR_PAGE_DYNAMIC ) ?
     290                 :            :                 // dynamic height: calculate header height, add header <-> sheet area distance
     291         [ #  # ]:          0 :                 (aHFConv.GetTotalHeight() + GETITEM( rHdrItemSet, SvxULSpaceItem, ATTR_ULSPACE ).GetLower()) :
     292                 :            :                 // static height: ATTR_PAGE_SIZE already includes header <-> sheet area distance
     293 [ #  # ][ #  # ]:          0 :                 static_cast< sal_Int32 >( GETITEM( rHdrItemSet, SvxSizeItem, ATTR_PAGE_SIZE ).GetSize().Height() );
     294                 :          0 :             maData.mfHeaderMargin = maData.mfTopMargin;
     295         [ #  # ]:          0 :             maData.mfTopMargin += XclTools::GetInchFromTwips( nHdrHeight );
     296                 :            :         }
     297                 :            : 
     298                 :            :         // footer
     299         [ #  # ]:          0 :         const SfxItemSet& rFtrItemSet = GETITEM( rItemSet, SvxSetItem, ATTR_PAGE_FOOTERSET ).GetItemSet();
     300 [ #  # ][ #  # ]:          0 :         if( GETITEMBOOL( rFtrItemSet, ATTR_PAGE_ON ) )
     301                 :            :         {
     302         [ #  # ]:          0 :             const ScPageHFItem& rHFItem = GETITEM( rItemSet, ScPageHFItem, ATTR_PAGE_FOOTERRIGHT );
     303         [ #  # ]:          0 :             aHFConv.GenerateString( rHFItem.GetLeftArea(), rHFItem.GetCenterArea(), rHFItem.GetRightArea() );
     304         [ #  # ]:          0 :             maData.maFooter = aHFConv.GetHFString();
     305                 :            :             // footer height (Excel excludes footer from bottom margin)
     306         [ #  # ]:          0 :             sal_Int32 nFtrHeight = GETITEMBOOL( rFtrItemSet, ATTR_PAGE_DYNAMIC ) ?
     307                 :            :                 // dynamic height: calculate footer height, add sheet area <-> footer distance
     308         [ #  # ]:          0 :                 (aHFConv.GetTotalHeight() + GETITEM( rFtrItemSet, SvxULSpaceItem, ATTR_ULSPACE ).GetUpper()) :
     309                 :            :                 // static height: ATTR_PAGE_SIZE already includes sheet area <-> footer distance
     310 [ #  # ][ #  # ]:          0 :                 static_cast< sal_Int32 >( GETITEM( rFtrItemSet, SvxSizeItem, ATTR_PAGE_SIZE ).GetSize().Height() );
     311                 :          0 :             maData.mfFooterMargin = maData.mfBottomMargin;
     312         [ #  # ]:          0 :             maData.mfBottomMargin += XclTools::GetInchFromTwips( nFtrHeight );
     313         [ #  # ]:          0 :         }
     314                 :            :     }
     315                 :            : 
     316                 :            :     // *** page breaks ***
     317                 :            : 
     318         [ #  # ]:          0 :     set<SCROW> aRowBreaks;
     319         [ #  # ]:          0 :     rDoc.GetAllRowBreaks(aRowBreaks, nScTab, false, true);
     320                 :            : 
     321                 :          0 :     SCROW nMaxRow = numeric_limits<sal_uInt16>::max();
     322 [ #  # ][ #  # ]:          0 :     for (set<SCROW>::const_iterator itr = aRowBreaks.begin(), itrEnd = aRowBreaks.end(); itr != itrEnd; ++itr)
                 [ #  # ]
     323                 :            :     {
     324         [ #  # ]:          0 :         SCROW nRow = *itr;
     325         [ #  # ]:          0 :         if (nRow > nMaxRow)
     326                 :          0 :             break;
     327                 :            : 
     328         [ #  # ]:          0 :         maData.maHorPageBreaks.push_back(nRow);
     329                 :            :     }
     330                 :            : 
     331         [ #  # ]:          0 :     if (maData.maHorPageBreaks.size() > 1026)
     332                 :            :     {
     333                 :            :         // Excel allows only up to 1026 page breaks.  Trim any excess page breaks.
     334                 :          0 :         ScfUInt16Vec::iterator itr = maData.maHorPageBreaks.begin();
     335         [ #  # ]:          0 :         ::std::advance(itr, 1026);
     336         [ #  # ]:          0 :         maData.maHorPageBreaks.erase(itr, maData.maHorPageBreaks.end());
     337                 :            :     }
     338                 :            : 
     339         [ #  # ]:          0 :     set<SCCOL> aColBreaks;
     340         [ #  # ]:          0 :     rDoc.GetAllColBreaks(aColBreaks, nScTab, false, true);
     341 [ #  # ][ #  # ]:          0 :     for (set<SCCOL>::const_iterator itr = aColBreaks.begin(), itrEnd = aColBreaks.end(); itr != itrEnd; ++itr)
                 [ #  # ]
     342 [ #  # ][ #  # ]:          0 :         maData.maVerPageBreaks.push_back(*itr);
     343                 :          0 : }
     344                 :            : 
     345                 :          0 : static void lcl_WriteHeaderFooter( XclExpXmlStream& rStrm )
     346                 :            : {
     347                 :            :     // OOXTODO: we currently only emit oddHeader/oddFooter elements, and
     348                 :            :     //          do not support the first/even/odd page distinction.
     349                 :            :     rStrm.WriteAttributes(
     350                 :            :             // OOXTODO: XML_alignWithMargins,
     351                 :            :             XML_differentFirst,     "false",    // OOXTODO
     352                 :            :             XML_differentOddEven,   "false",    // OOXTODO
     353                 :            :             // OOXTODO: XML_scaleWithDoc
     354                 :          0 :             FSEND );
     355                 :          0 :     rStrm.GetCurrentStream()->write( ">" );
     356                 :          0 : }
     357                 :            : 
     358                 :          0 : void XclExpPageSettings::Save( XclExpStream& rStrm )
     359                 :            : {
     360         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_PRINTHEADERS, maData.mbPrintHeadings ).Save( rStrm );
     361         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_PRINTGRIDLINES, maData.mbPrintGrid ).Save( rStrm );
     362         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_GRIDSET, true ).Save( rStrm );
     363         [ #  # ]:          0 :     XclExpPageBreaks( EXC_ID_HORPAGEBREAKS, maData.maHorPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).Save( rStrm );
     364         [ #  # ]:          0 :     XclExpPageBreaks( EXC_ID_VERPAGEBREAKS, maData.maVerPageBreaks, static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).Save( rStrm );
     365         [ #  # ]:          0 :     XclExpHeaderFooter( EXC_ID_HEADER, maData.maHeader ).Save( rStrm );
     366         [ #  # ]:          0 :     XclExpHeaderFooter( EXC_ID_FOOTER, maData.maFooter ).Save( rStrm );
     367         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter ).Save( rStrm );
     368         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter ).Save( rStrm );
     369         [ #  # ]:          0 :     XclExpDoubleRecord( EXC_ID_LEFTMARGIN, maData.mfLeftMargin ).Save( rStrm );
     370         [ #  # ]:          0 :     XclExpDoubleRecord( EXC_ID_RIGHTMARGIN, maData.mfRightMargin ).Save( rStrm );
     371         [ #  # ]:          0 :     XclExpDoubleRecord( EXC_ID_TOPMARGIN, maData.mfTopMargin ).Save( rStrm );
     372         [ #  # ]:          0 :     XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN, maData.mfBottomMargin ).Save( rStrm );
     373         [ #  # ]:          0 :     XclExpSetup( maData ).Save( rStrm );
     374                 :            : 
     375 [ #  # ][ #  # ]:          0 :     if( (GetBiff() == EXC_BIFF8) && maData.mxBrushItem.get() )
                 [ #  # ]
     376         [ #  # ]:          0 :         if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
     377         [ #  # ]:          0 :             XclExpImgData( *pGraphic, EXC_ID8_IMGDATA ).Save( rStrm );
     378                 :          0 : }
     379                 :            : 
     380                 :          0 : void XclExpPageSettings::SaveXml( XclExpXmlStream& rStrm )
     381                 :            : {
     382         [ #  # ]:          0 :     XclExpXmlStartSingleElementRecord( XML_printOptions ).SaveXml( rStrm );
     383         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_PRINTHEADERS, maData.mbPrintHeadings, XML_headings ).SaveXml( rStrm );
     384         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_PRINTGRIDLINES, maData.mbPrintGrid, XML_gridLines ).SaveXml( rStrm );
     385         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_GRIDSET, true, XML_gridLinesSet ).SaveXml( rStrm );
     386         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter, XML_horizontalCentered ).SaveXml( rStrm );
     387         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter, XML_verticalCentered ).SaveXml( rStrm );
     388         [ #  # ]:          0 :     XclExpXmlEndSingleElementRecord().SaveXml( rStrm );    // XML_printOptions
     389                 :            : 
     390         [ #  # ]:          0 :     XclExpXmlStartSingleElementRecord( XML_pageMargins ).SaveXml( rStrm );
     391         [ #  # ]:          0 :     XclExpDoubleRecord( EXC_ID_LEFTMARGIN, maData.mfLeftMargin ).SetAttribute( XML_left )->SaveXml( rStrm );
     392         [ #  # ]:          0 :     XclExpDoubleRecord( EXC_ID_RIGHTMARGIN, maData.mfRightMargin ).SetAttribute( XML_right )->SaveXml( rStrm );
     393         [ #  # ]:          0 :     XclExpDoubleRecord( EXC_ID_TOPMARGIN, maData.mfTopMargin ).SetAttribute( XML_top )->SaveXml( rStrm );
     394         [ #  # ]:          0 :     XclExpDoubleRecord( EXC_ID_BOTTOMMARGIN, maData.mfBottomMargin ).SetAttribute( XML_bottom )->SaveXml( rStrm );
     395         [ #  # ]:          0 :     XclExpDoubleRecord( 0, maData.mfHeaderMargin).SetAttribute( XML_header )->SaveXml( rStrm );
     396         [ #  # ]:          0 :     XclExpDoubleRecord( 0, maData.mfFooterMargin).SetAttribute( XML_footer )->SaveXml( rStrm );
     397         [ #  # ]:          0 :     XclExpXmlEndSingleElementRecord().SaveXml( rStrm );    // XML_pageMargins
     398                 :            : 
     399         [ #  # ]:          0 :     XclExpSetup( maData ).SaveXml( rStrm );
     400                 :            : 
     401         [ #  # ]:          0 :     XclExpXmlStartElementRecord( XML_headerFooter, lcl_WriteHeaderFooter ).SaveXml( rStrm );
     402         [ #  # ]:          0 :     XclExpHeaderFooter( EXC_ID_HEADER, maData.maHeader ).SaveXml( rStrm );
     403         [ #  # ]:          0 :     XclExpHeaderFooter( EXC_ID_FOOTER, maData.maFooter ).SaveXml( rStrm );
     404         [ #  # ]:          0 :     XclExpXmlEndElementRecord( XML_headerFooter ).SaveXml( rStrm );
     405                 :            : 
     406                 :            :     XclExpPageBreaks( EXC_ID_HORPAGEBREAKS, maData.maHorPageBreaks,
     407         [ #  # ]:          0 :                     static_cast< sal_uInt16 >( GetXclMaxPos().Col() ) ).SaveXml( rStrm );
     408                 :            :     XclExpPageBreaks( EXC_ID_VERPAGEBREAKS, maData.maVerPageBreaks,
     409         [ #  # ]:          0 :                     static_cast< sal_uInt16 >( GetXclMaxPos().Row() ) ).SaveXml( rStrm );
     410                 :            : 
     411         [ #  # ]:          0 :     if( const Graphic* pGraphic = maData.mxBrushItem->GetGraphic() )
     412         [ #  # ]:          0 :         XclExpImgData( *pGraphic, EXC_ID8_IMGDATA ).SaveXml( rStrm );
     413                 :          0 : }
     414                 :            : 
     415                 :            : // ----------------------------------------------------------------------------
     416                 :            : 
     417                 :          0 : XclExpChartPageSettings::XclExpChartPageSettings( const XclExpRoot& rRoot ) :
     418 [ #  # ][ #  # ]:          0 :     XclExpRoot( rRoot )
     419                 :            : {
     420                 :          0 : }
     421                 :            : 
     422                 :          0 : void XclExpChartPageSettings::Save( XclExpStream& rStrm )
     423                 :            : {
     424         [ #  # ]:          0 :     XclExpHeaderFooter( EXC_ID_HEADER, maData.maHeader ).Save( rStrm );
     425         [ #  # ]:          0 :     XclExpHeaderFooter( EXC_ID_FOOTER, maData.maFooter ).Save( rStrm );
     426         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_HCENTER, maData.mbHorCenter ).Save( rStrm );
     427         [ #  # ]:          0 :     XclExpBoolRecord( EXC_ID_VCENTER, maData.mbVerCenter ).Save( rStrm );
     428         [ #  # ]:          0 :     XclExpSetup( maData ).Save( rStrm );
     429         [ #  # ]:          0 :     XclExpUInt16Record( EXC_ID_PRINTSIZE, EXC_PRINTSIZE_FULL ).Save( rStrm );
     430 [ +  - ][ +  - ]:         24 : }
     431                 :            : 
     432                 :            : // ============================================================================
     433                 :            : 
     434                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10