LCOV - code coverage report
Current view: top level - sc/source/filter/excel - xipage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 164 196 83.7 %
Date: 2012-08-25 Functions: 13 15 86.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 165 389 42.4 %

           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                 :            : #include "xipage.hxx"
      30                 :            : #include <svl/itemset.hxx>
      31                 :            : #include <vcl/graph.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 "stlsheet.hxx"
      42                 :            : #include "attrib.hxx"
      43                 :            : #include "xistream.hxx"
      44                 :            : #include "xihelper.hxx"
      45                 :            : #include "xiescher.hxx"
      46                 :            : 
      47                 :            : // Page settings ==============================================================
      48                 :            : 
      49                 :         55 : XclImpPageSettings::XclImpPageSettings( const XclImpRoot& rRoot ) :
      50         [ +  - ]:         55 :     XclImpRoot( rRoot )
      51                 :            : {
      52         [ +  - ]:         55 :     Initialize();
      53                 :         55 : }
      54                 :            : 
      55                 :        220 : void XclImpPageSettings::Initialize()
      56                 :            : {
      57                 :        220 :     maData.SetDefaults();
      58                 :        220 :     mbValidPaper = false;
      59                 :        220 : }
      60                 :            : 
      61                 :        165 : void XclImpPageSettings::ReadSetup( XclImpStream& rStrm )
      62                 :            : {
      63                 :            :     OSL_ENSURE_BIFF( GetBiff() >= EXC_BIFF4 );
      64         [ +  - ]:        165 :     if( GetBiff() < EXC_BIFF4 )
      65                 :        165 :         return;
      66                 :            : 
      67                 :            :     // BIFF4 - BIFF8
      68                 :            :     sal_uInt16 nFlags;
      69 [ +  - ][ +  - ]:        165 :     rStrm   >> maData.mnPaperSize >> maData.mnScaling >> maData.mnStartPage
                 [ +  - ]
      70 [ +  - ][ +  - ]:        165 :             >> maData.mnFitToWidth >> maData.mnFitToHeight >> nFlags;
                 [ +  - ]
      71                 :            : 
      72                 :        165 :     mbValidPaper = maData.mbValid = !::get_flag( nFlags, EXC_SETUP_INVALID );
      73                 :        165 :     maData.mbPrintInRows = ::get_flag( nFlags, EXC_SETUP_INROWS );
      74                 :        165 :     maData.mbPortrait = ::get_flag( nFlags, EXC_SETUP_PORTRAIT );
      75                 :        165 :     maData.mbBlackWhite = ::get_flag( nFlags, EXC_SETUP_BLACKWHITE );
      76                 :        165 :     maData.mbManualStart = true;
      77                 :            : 
      78                 :            :     // new in BIFF5 - BIFF8
      79         [ +  - ]:        165 :     if( GetBiff() >= EXC_BIFF5 )
      80                 :            :     {
      81 [ +  - ][ +  - ]:        165 :         rStrm   >> maData.mnHorPrintRes >> maData.mnVerPrintRes
      82 [ +  - ][ +  - ]:        165 :                 >> maData.mfHeaderMargin >> maData.mfFooterMargin >> maData.mnCopies;
                 [ +  - ]
      83                 :            : 
      84                 :        165 :         maData.mbDraftQuality = ::get_flag( nFlags, EXC_SETUP_DRAFT );
      85                 :        165 :         maData.mbPrintNotes = ::get_flag( nFlags, EXC_SETUP_PRINTNOTES );
      86                 :        165 :         maData.mbManualStart = ::get_flag( nFlags, EXC_SETUP_STARTPAGE );
      87                 :            :     }
      88                 :            : }
      89                 :            : 
      90                 :        336 : void XclImpPageSettings::ReadMargin( XclImpStream& rStrm )
      91                 :            : {
      92   [ +  +  +  +  :        336 :     switch( rStrm.GetRecId() )
                      - ]
      93                 :            :     {
      94                 :         84 :         case EXC_ID_LEFTMARGIN:     rStrm >> maData.mfLeftMargin;   break;
      95                 :         84 :         case EXC_ID_RIGHTMARGIN:    rStrm >> maData.mfRightMargin;  break;
      96                 :         84 :         case EXC_ID_TOPMARGIN:      rStrm >> maData.mfTopMargin;    break;
      97                 :         84 :         case EXC_ID_BOTTOMMARGIN:   rStrm >> maData.mfBottomMargin; break;
      98                 :            :         default:    OSL_FAIL( "XclImpPageSettings::ReadMargin - unknown record" );
      99                 :            :     }
     100                 :        336 : }
     101                 :            : 
     102                 :        330 : void XclImpPageSettings::ReadCenter( XclImpStream& rStrm )
     103                 :            : {
     104                 :            :     OSL_ENSURE_BIFF( GetBiff() >= EXC_BIFF3 );  // read it anyway
     105                 :        330 :     bool bCenter = (rStrm.ReaduInt16() != 0);
     106      [ +  +  - ]:        330 :     switch( rStrm.GetRecId() )
     107                 :            :     {
     108                 :        165 :         case EXC_ID_HCENTER:    maData.mbHorCenter = bCenter;   break;
     109                 :        165 :         case EXC_ID_VCENTER:    maData.mbVerCenter = bCenter;   break;
     110                 :            :         default:    OSL_FAIL( "XclImpPageSettings::ReadCenter - unknown record" );
     111                 :            :     }
     112                 :        330 : }
     113                 :            : 
     114                 :        330 : void XclImpPageSettings::ReadHeaderFooter( XclImpStream& rStrm )
     115                 :            : {
     116         [ +  - ]:        330 :     String aString;
     117 [ +  - ][ +  + ]:        330 :     if( rStrm.GetRecLeft() )
     118 [ -  + ][ #  # ]:         96 :         aString = (GetBiff() <= EXC_BIFF5) ? rStrm.ReadByteString( false ) : rStrm.ReadUniString();
         [ +  - ][ +  - ]
                 [ +  - ]
     119                 :            : 
     120      [ +  +  - ]:        330 :     switch( rStrm.GetRecId() )
     121                 :            :     {
     122         [ +  - ]:        165 :         case EXC_ID_HEADER:     maData.maHeader = aString;  break;
     123         [ +  - ]:        165 :         case EXC_ID_FOOTER:     maData.maFooter = aString;  break;
     124                 :            :         default:    OSL_FAIL( "XclImpPageSettings::ReadHeaderFooter - unknown record" );
     125         [ +  - ]:        330 :     }
     126                 :        330 : }
     127                 :            : 
     128                 :          6 : void XclImpPageSettings::ReadPageBreaks( XclImpStream& rStrm )
     129                 :            : {
     130                 :          6 :     ScfUInt16Vec* pVec = 0;
     131      [ +  +  - ]:          6 :     switch( rStrm.GetRecId() )
     132                 :            :     {
     133                 :          3 :         case EXC_ID_HORPAGEBREAKS:  pVec = &maData.maHorPageBreaks;     break;
     134                 :          3 :         case EXC_ID_VERPAGEBREAKS:  pVec = &maData.maVerPageBreaks;     break;
     135                 :            :         default:    OSL_FAIL( "XclImpPageSettings::ReadPageBreaks - unknown record" );
     136                 :            :     }
     137                 :            : 
     138         [ +  - ]:          6 :     if( pVec )
     139                 :            :     {
     140                 :          6 :         bool bIgnore = GetBiff() == EXC_BIFF8;  // ignore start/end columns or rows in BIFF8
     141                 :            : 
     142                 :            :         sal_uInt16 nCount, nBreak;
     143         [ +  - ]:          6 :         rStrm >> nCount;
     144                 :          6 :         pVec->clear();
     145         [ +  - ]:          6 :         pVec->reserve( nCount );
     146                 :            : 
     147         [ -  + ]:          6 :         while( nCount-- )
     148                 :            :         {
     149         [ #  # ]:          0 :             rStrm >> nBreak;
     150         [ #  # ]:          0 :             if( nBreak )
     151         [ #  # ]:          0 :                 pVec->push_back( nBreak );
     152         [ #  # ]:          0 :             if( bIgnore )
     153         [ #  # ]:          0 :                 rStrm.Ignore( 4 );
     154                 :            :         }
     155                 :            :     }
     156                 :          6 : }
     157                 :            : 
     158                 :        165 : void XclImpPageSettings::ReadPrintHeaders( XclImpStream& rStrm )
     159                 :            : {
     160                 :        165 :     maData.mbPrintHeadings = (rStrm.ReaduInt16() != 0);
     161                 :        165 : }
     162                 :            : 
     163                 :        165 : void XclImpPageSettings::ReadPrintGridLines( XclImpStream& rStrm )
     164                 :            : {
     165                 :        165 :     maData.mbPrintGrid = (rStrm.ReaduInt16() != 0);
     166                 :        165 : }
     167                 :            : 
     168                 :          0 : void XclImpPageSettings::ReadImgData( XclImpStream& rStrm )
     169                 :            : {
     170         [ #  # ]:          0 :     Graphic aGraphic = XclImpDrawing::ReadImgData( GetRoot(), rStrm );
     171 [ #  # ][ #  # ]:          0 :     if( aGraphic.GetType() != GRAPHIC_NONE )
     172 [ #  # ][ #  # ]:          0 :         maData.mxBrushItem.reset( new SvxBrushItem( aGraphic, GPOS_TILED, ATTR_BACKGROUND ) );
                 [ #  # ]
     173                 :          0 : }
     174                 :            : 
     175                 :          0 : void XclImpPageSettings::SetPaperSize( sal_uInt16 nXclPaperSize, bool bPortrait )
     176                 :            : {
     177                 :          0 :     maData.mnPaperSize = nXclPaperSize;
     178                 :          0 :     maData.mbPortrait = bPortrait;
     179                 :          0 :     mbValidPaper = true;
     180                 :          0 : }
     181                 :            : 
     182                 :            : // ----------------------------------------------------------------------------
     183                 :            : 
     184                 :            : namespace {
     185                 :            : 
     186                 :       1650 : void lclPutMarginItem( SfxItemSet& rItemSet, sal_uInt16 nRecId, double fMarginInch )
     187                 :            : {
     188                 :       1650 :     sal_uInt16 nMarginTwips = XclTools::GetTwipsFromInch( fMarginInch );
     189      [ +  +  - ]:       1650 :     switch( nRecId )
     190                 :            :     {
     191                 :            :         case EXC_ID_TOPMARGIN:
     192                 :            :         case EXC_ID_BOTTOMMARGIN:
     193                 :            :         {
     194 [ +  - ][ +  - ]:        660 :             SvxULSpaceItem aItem( GETITEM( rItemSet, SvxULSpaceItem, ATTR_ULSPACE ) );
     195         [ +  + ]:        660 :             if( nRecId == EXC_ID_TOPMARGIN )
     196                 :        330 :                 aItem.SetUpperValue( nMarginTwips );
     197                 :            :             else
     198                 :        330 :                 aItem.SetLowerValue( nMarginTwips );
     199 [ +  - ][ +  - ]:        660 :             rItemSet.Put( aItem );
     200                 :            :         }
     201                 :        660 :         break;
     202                 :            :         case EXC_ID_LEFTMARGIN:
     203                 :            :         case EXC_ID_RIGHTMARGIN:
     204                 :            :         {
     205 [ +  - ][ +  - ]:        990 :             SvxLRSpaceItem aItem( GETITEM( rItemSet, SvxLRSpaceItem, ATTR_LRSPACE ) );
     206         [ +  + ]:        990 :             if( nRecId == EXC_ID_LEFTMARGIN )
     207                 :        495 :                 aItem.SetLeftValue( nMarginTwips );
     208                 :            :             else
     209                 :        495 :                 aItem.SetRightValue( nMarginTwips );
     210 [ +  - ][ +  - ]:        990 :             rItemSet.Put( aItem );
     211                 :            :         }
     212                 :        990 :         break;
     213                 :            :         default:
     214                 :            :             OSL_FAIL( "XclImpPageSettings::SetMarginItem - unknown record id" );
     215                 :            :     }
     216                 :       1650 : }
     217                 :            : 
     218                 :            : } // namespace
     219                 :            : 
     220                 :        165 : void XclImpPageSettings::Finalize()
     221                 :            : {
     222                 :        165 :     ScDocument& rDoc = GetDoc();
     223                 :        165 :     SCTAB nScTab = GetCurrScTab();
     224                 :            : 
     225                 :            :     // *** create page style sheet ***
     226                 :            : 
     227                 :        165 :     rtl::OUStringBuffer aStyleName;
     228         [ +  - ]:        165 :     aStyleName.appendAscii("PageStyle_");
     229                 :            : 
     230                 :        165 :     rtl::OUString aTableName;
     231 [ +  - ][ +  - ]:        165 :     if( GetDoc().GetName( nScTab, aTableName ) )
     232         [ +  - ]:        165 :         aStyleName.append(aTableName);
     233                 :            :     else
     234         [ #  # ]:          0 :         aStyleName.append(static_cast<sal_Int32>(nScTab+1));
     235                 :            : 
     236                 :            :     ScStyleSheet& rStyleSheet = ScfTools::MakePageStyleSheet(
     237 [ +  - ][ +  - ]:        165 :         GetStyleSheetPool(), aStyleName.makeStringAndClear(), false);
         [ +  - ][ +  - ]
                 [ +  - ]
     238                 :            : 
     239         [ +  - ]:        165 :     SfxItemSet& rItemSet = rStyleSheet.GetItemSet();
     240                 :            : 
     241                 :            :     // *** page settings ***
     242                 :            : 
     243 [ +  - ][ +  - ]:        165 :     ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_PAGE_TOPDOWN,    !maData.mbPrintInRows ),    true );
                 [ +  - ]
     244 [ +  - ][ +  - ]:        165 :     ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_PAGE_HORCENTER,  maData.mbHorCenter ),       true );
                 [ +  - ]
     245 [ +  - ][ +  - ]:        165 :     ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_PAGE_VERCENTER,  maData.mbVerCenter ),       true );
                 [ +  - ]
     246 [ +  - ][ +  - ]:        165 :     ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_PAGE_HEADERS,    maData.mbPrintHeadings ),   true );
                 [ +  - ]
     247 [ +  - ][ +  - ]:        165 :     ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_PAGE_GRID,       maData.mbPrintGrid ),       true );
                 [ +  - ]
     248 [ +  - ][ +  - ]:        165 :     ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_PAGE_NOTES,      maData.mbPrintNotes ),      true );
                 [ +  - ]
     249                 :            : 
     250         [ +  + ]:        165 :     sal_uInt16 nStartPage = maData.mbManualStart ? maData.mnStartPage : 0;
     251 [ +  - ][ +  - ]:        165 :     ScfTools::PutItem( rItemSet, SfxUInt16Item( ATTR_PAGE_FIRSTPAGENO, nStartPage ), true );
                 [ +  - ]
     252                 :            : 
     253         [ -  + ]:        165 :     if( maData.mxBrushItem.get() )
     254         [ #  # ]:          0 :         rItemSet.Put( *maData.mxBrushItem );
     255                 :            : 
     256         [ +  + ]:        165 :     if( mbValidPaper )
     257                 :            :     {
     258 [ +  - ][ +  - ]:         84 :         SvxPageItem aPageItem( GETITEM( rItemSet, SvxPageItem, ATTR_PAGE ) );
     259                 :         84 :         aPageItem.SetLandscape( !maData.mbPortrait );
     260         [ +  - ]:         84 :         rItemSet.Put( aPageItem );
     261 [ +  - ][ +  - ]:         84 :         ScfTools::PutItem( rItemSet, SvxSizeItem( ATTR_PAGE_SIZE, maData.GetScPaperSize() ), true );
         [ +  - ][ +  - ]
                 [ +  - ]
     262                 :            :     }
     263                 :            : 
     264         [ -  + ]:        165 :     if( maData.mbFitToPages )
     265 [ #  # ][ #  # ]:          0 :         rItemSet.Put( ScPageScaleToItem( maData.mnFitToWidth, maData.mnFitToHeight ) );
                 [ #  # ]
     266         [ +  + ]:        165 :     else if( maData.mbValid )
     267 [ +  - ][ +  - ]:         84 :         rItemSet.Put( SfxUInt16Item( ATTR_PAGE_SCALE, maData.mnScaling ) );
                 [ +  - ]
     268                 :            : 
     269                 :            :     // *** margin preparations ***
     270                 :            : 
     271                 :        165 :     double fLeftMargin   = maData.mfLeftMargin;
     272                 :        165 :     double fRightMargin  = maData.mfRightMargin;
     273                 :        165 :     double fTopMargin    = maData.mfTopMargin;
     274                 :        165 :     double fBottomMargin = maData.mfBottomMargin;
     275                 :            :     // distances between header/footer and page area
     276                 :        165 :     double fHeaderHeight = 0.0;
     277                 :        165 :     double fHeaderDist = 0.0;
     278                 :        165 :     double fFooterHeight = 0.0;
     279                 :        165 :     double fFooterDist = 0.0;
     280                 :            :     // in Calc, "header/footer left/right margin" is X distance between header/footer and page margin
     281                 :        165 :     double fHdrLeftMargin  = maData.mfHdrLeftMargin  - maData.mfLeftMargin;
     282                 :        165 :     double fHdrRightMargin = maData.mfHdrRightMargin - maData.mfRightMargin;
     283                 :        165 :     double fFtrLeftMargin  = maData.mfFtrLeftMargin  - maData.mfLeftMargin;
     284                 :        165 :     double fFtrRightMargin = maData.mfFtrRightMargin - maData.mfRightMargin;
     285                 :            : 
     286                 :            :     // *** header and footer ***
     287                 :            : 
     288         [ +  - ]:        165 :     XclImpHFConverter aHFConv( GetRoot() );
     289                 :            : 
     290                 :            :     // header
     291                 :        165 :     bool bHasHeader = (maData.maHeader.Len() != 0);
     292 [ +  - ][ +  - ]:        165 :     SvxSetItem aHdrSetItem( GETITEM( rItemSet, SvxSetItem, ATTR_PAGE_HEADERSET ) );
     293                 :        165 :     SfxItemSet& rHdrItemSet = aHdrSetItem.GetItemSet();
     294 [ +  - ][ +  - ]:        165 :     rHdrItemSet.Put( SfxBoolItem( ATTR_PAGE_ON, bHasHeader ) );
                 [ +  - ]
     295         [ +  + ]:        165 :     if( bHasHeader )
     296                 :            :     {
     297         [ +  - ]:         42 :         aHFConv.ParseString( maData.maHeader );
     298         [ +  - ]:         42 :         aHFConv.FillToItemSet( rItemSet, ATTR_PAGE_HEADERLEFT );
     299         [ +  - ]:         42 :         aHFConv.FillToItemSet( rItemSet, ATTR_PAGE_HEADERRIGHT );
     300                 :            :         // #i23296# In Calc, "top margin" is distance to header
     301                 :         42 :         fTopMargin = maData.mfHeaderMargin;
     302                 :            :         // Calc uses distance between header and sheet data area
     303 [ +  - ][ +  - ]:         42 :         fHeaderHeight = XclTools::GetInchFromTwips( aHFConv.GetTotalHeight() );
     304                 :         42 :         fHeaderDist = maData.mfTopMargin - maData.mfHeaderMargin - fHeaderHeight;
     305                 :            :     }
     306         [ -  + ]:        165 :     if( fHeaderDist < 0.0 )
     307                 :            :     {
     308                 :            :         /*  #i23296# Header overlays sheet data:
     309                 :            :             -> set fixed header height to get correct sheet data position. */
     310 [ #  # ][ #  # ]:          0 :         ScfTools::PutItem( rHdrItemSet, SfxBoolItem( ATTR_PAGE_DYNAMIC, false ), true );
                 [ #  # ]
     311                 :            :         // shrink header height
     312         [ #  # ]:          0 :         long nHdrHeight = XclTools::GetTwipsFromInch( fHeaderHeight + fHeaderDist );
     313 [ #  # ][ #  # ]:          0 :         ScfTools::PutItem( rHdrItemSet, SvxSizeItem( ATTR_PAGE_SIZE, Size( 0, nHdrHeight ) ), true );
                 [ #  # ]
     314         [ #  # ]:          0 :         lclPutMarginItem( rHdrItemSet, EXC_ID_BOTTOMMARGIN, 0.0 );
     315                 :            :     }
     316                 :            :     else
     317                 :            :     {
     318                 :            :         // use dynamic header height
     319 [ +  - ][ +  - ]:        165 :         ScfTools::PutItem( rHdrItemSet, SfxBoolItem( ATTR_PAGE_DYNAMIC, true ), true );
                 [ +  - ]
     320         [ +  - ]:        165 :         lclPutMarginItem( rHdrItemSet, EXC_ID_BOTTOMMARGIN, fHeaderDist );
     321                 :            :     }
     322         [ +  - ]:        165 :     lclPutMarginItem( rHdrItemSet, EXC_ID_LEFTMARGIN,   fHdrLeftMargin );
     323         [ +  - ]:        165 :     lclPutMarginItem( rHdrItemSet, EXC_ID_RIGHTMARGIN,  fHdrRightMargin );
     324         [ +  - ]:        165 :     rItemSet.Put( aHdrSetItem );
     325                 :            : 
     326                 :            :     // footer
     327                 :        165 :     bool bHasFooter = (maData.maFooter.Len() != 0);
     328 [ +  - ][ +  - ]:        165 :     SvxSetItem aFtrSetItem( GETITEM( rItemSet, SvxSetItem, ATTR_PAGE_FOOTERSET ) );
     329                 :        165 :     SfxItemSet& rFtrItemSet = aFtrSetItem.GetItemSet();
     330 [ +  - ][ +  - ]:        165 :     rFtrItemSet.Put( SfxBoolItem( ATTR_PAGE_ON, bHasFooter ) );
                 [ +  - ]
     331         [ +  + ]:        165 :     if( bHasFooter )
     332                 :            :     {
     333         [ +  - ]:         48 :         aHFConv.ParseString( maData.maFooter );
     334         [ +  - ]:         48 :         aHFConv.FillToItemSet( rItemSet, ATTR_PAGE_FOOTERLEFT );
     335         [ +  - ]:         48 :         aHFConv.FillToItemSet( rItemSet, ATTR_PAGE_FOOTERRIGHT );
     336                 :            :         // #i23296# In Calc, "bottom margin" is distance to footer
     337                 :         48 :         fBottomMargin = maData.mfFooterMargin;
     338                 :            :         // Calc uses distance between footer and sheet data area
     339 [ +  - ][ +  - ]:         48 :         fFooterHeight = XclTools::GetInchFromTwips( aHFConv.GetTotalHeight() );
     340                 :         48 :         fFooterDist = maData.mfBottomMargin - maData.mfFooterMargin - fFooterHeight;
     341                 :            :     }
     342         [ -  + ]:        165 :     if( fFooterDist < 0.0 )
     343                 :            :     {
     344                 :            :         /*  #i23296# Footer overlays sheet data:
     345                 :            :             -> set fixed footer height to get correct sheet data end position. */
     346 [ #  # ][ #  # ]:          0 :         ScfTools::PutItem( rFtrItemSet, SfxBoolItem( ATTR_PAGE_DYNAMIC, false ), true );
                 [ #  # ]
     347                 :            :         // shrink footer height
     348         [ #  # ]:          0 :         long nFtrHeight = XclTools::GetTwipsFromInch( fFooterHeight + fFooterDist );
     349 [ #  # ][ #  # ]:          0 :         ScfTools::PutItem( rFtrItemSet, SvxSizeItem( ATTR_PAGE_SIZE, Size( 0, nFtrHeight ) ), true );
                 [ #  # ]
     350         [ #  # ]:          0 :         lclPutMarginItem( rFtrItemSet, EXC_ID_TOPMARGIN, 0.0 );
     351                 :            :     }
     352                 :            :     else
     353                 :            :     {
     354                 :            :         // use dynamic footer height
     355 [ +  - ][ +  - ]:        165 :         ScfTools::PutItem( rFtrItemSet, SfxBoolItem( ATTR_PAGE_DYNAMIC, true ), true );
                 [ +  - ]
     356         [ +  - ]:        165 :         lclPutMarginItem( rFtrItemSet, EXC_ID_TOPMARGIN, fFooterDist );
     357                 :            :     }
     358         [ +  - ]:        165 :     lclPutMarginItem( rFtrItemSet, EXC_ID_LEFTMARGIN,   fFtrLeftMargin );
     359         [ +  - ]:        165 :     lclPutMarginItem( rFtrItemSet, EXC_ID_RIGHTMARGIN,  fFtrRightMargin );
     360         [ +  - ]:        165 :     rItemSet.Put( aFtrSetItem );
     361                 :            : 
     362                 :            :     // *** set final margins ***
     363                 :            : 
     364         [ +  - ]:        165 :     lclPutMarginItem( rItemSet, EXC_ID_LEFTMARGIN,   fLeftMargin );
     365         [ +  - ]:        165 :     lclPutMarginItem( rItemSet, EXC_ID_RIGHTMARGIN,  fRightMargin );
     366         [ +  - ]:        165 :     lclPutMarginItem( rItemSet, EXC_ID_TOPMARGIN,    fTopMargin );
     367         [ +  - ]:        165 :     lclPutMarginItem( rItemSet, EXC_ID_BOTTOMMARGIN, fBottomMargin );
     368                 :            : 
     369                 :            :     // *** put style sheet into document ***
     370                 :            : 
     371 [ +  - ][ +  - ]:        165 :     rDoc.SetPageStyle( nScTab, rStyleSheet.GetName() );
                 [ +  - ]
     372                 :            : 
     373                 :            :     // *** page breaks ***
     374                 :            : 
     375                 :        165 :     ScfUInt16Vec::const_iterator aIt, aEnd;
     376                 :            : 
     377 [ +  - ][ #  # ]:        165 :     for( aIt = maData.maHorPageBreaks.begin(), aEnd = maData.maHorPageBreaks.end(); aIt != aEnd; ++aIt )
         [ +  - ][ -  + ]
                 [ +  - ]
     378                 :            :     {
     379         [ #  # ]:          0 :         SCROW nScRow = static_cast< SCROW >( *aIt );
     380         [ #  # ]:          0 :         if( nScRow <= MAXROW )
     381         [ #  # ]:          0 :             rDoc.SetRowBreak(nScRow, nScTab, false, true);
     382                 :            :     }
     383                 :            : 
     384 [ +  - ][ +  - ]:        165 :     for( aIt = maData.maVerPageBreaks.begin(), aEnd = maData.maVerPageBreaks.end(); aIt != aEnd; ++aIt )
         [ #  # ][ +  - ]
                 [ -  + ]
     385                 :            :     {
     386         [ #  # ]:          0 :         SCCOL nScCol = static_cast< SCCOL >( *aIt );
     387         [ #  # ]:          0 :         if( nScCol <= MAXCOL )
     388         [ #  # ]:          0 :             rDoc.SetColBreak(nScCol, nScTab, false, true);
     389 [ +  - ][ +  - ]:        165 :     }
                 [ +  - ]
     390 [ +  - ][ +  - ]:        189 : }
     391                 :            : 
     392                 :            : // ============================================================================
     393                 :            : 
     394                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10