LCOV - code coverage report
Current view: top level - sc/source/filter/excel - xepage.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 197 233 84.5 %
Date: 2015-06-13 12:38:46 Functions: 20 22 90.9 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.11