LCOV - code coverage report
Current view: top level - libreoffice/sc/source/ui/vba - vbapagesetup.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 284 0.0 %
Date: 2012-12-27 Functions: 0 37 0.0 %
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             : #include "vbapagesetup.hxx"
      20             : #include "cellsuno.hxx"
      21             : #include "convuno.hxx"
      22             : #include "rangelst.hxx"
      23             : #include "excelvbahelper.hxx"
      24             : #include <com/sun/star/sheet/XPrintAreas.hpp>
      25             : #include <com/sun/star/sheet/XHeaderFooterContent.hpp>
      26             : #include <com/sun/star/text/XText.hpp>
      27             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      28             : #include <com/sun/star/container/XNameAccess.hpp>
      29             : #include <ooo/vba/excel/XlPageOrientation.hpp>
      30             : #include <ooo/vba/excel/XlOrder.hpp>
      31             : #include <ooo/vba/excel/Constants.hpp>
      32             : #include <i18nutil/paper.hxx>
      33             : #include <sal/macros.h>
      34             : 
      35             : using namespace ::com::sun::star;
      36             : using namespace ::ooo::vba;
      37             : 
      38             : #define ZOOM_IN 10
      39             : #define ZOOM_MAX 400
      40             : 
      41             : bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, ScRange& refRange, ScRangeList& aCellRanges, formula::FormulaGrammar::AddressConvention aConv = formula::FormulaGrammar::CONV_XL_A1 ) throw ( uno::RuntimeException );
      42             : 
      43           0 : ScVbaPageSetup::ScVbaPageSetup(const uno::Reference< XHelperInterface >& xParent,
      44             :                 const uno::Reference< uno::XComponentContext >& xContext,
      45             :                 const uno::Reference< sheet::XSpreadsheet >& xSheet,
      46             :                 const uno::Reference< frame::XModel >& xModel) throw (uno::RuntimeException):
      47           0 :            ScVbaPageSetup_BASE( xParent, xContext ), mxSheet( xSheet )
      48             : {
      49             :     // query for current page style
      50           0 :     mxModel.set( xModel, uno::UNO_QUERY_THROW );
      51           0 :     uno::Reference< beans::XPropertySet > xSheetProps( mxSheet, uno::UNO_QUERY_THROW );
      52           0 :     uno::Any aValue = xSheetProps->getPropertyValue( rtl::OUString(  "PageStyle" ));
      53           0 :     rtl::OUString aStyleName;
      54           0 :     aValue >>= aStyleName;
      55             : 
      56           0 :     uno::Reference< style::XStyleFamiliesSupplier > xStyleFamiliesSup( mxModel, uno::UNO_QUERY_THROW );
      57           0 :     uno::Reference< container::XNameAccess > xStyleFamilies = xStyleFamiliesSup->getStyleFamilies();
      58           0 :     uno::Reference< container::XNameAccess > xPageStyle( xStyleFamilies->getByName(rtl::OUString( "PageStyles")), uno::UNO_QUERY_THROW );
      59           0 :     mxPageProps.set( xPageStyle->getByName(aStyleName), uno::UNO_QUERY_THROW );
      60           0 :     mnOrientLandscape = excel::XlPageOrientation::xlLandscape;
      61           0 :     mnOrientPortrait = excel::XlPageOrientation::xlPortrait;
      62           0 : }
      63             : 
      64           0 : rtl::OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeException)
      65             : {
      66           0 :     String aPrintArea;
      67           0 :     uno::Reference< sheet::XPrintAreas > xPrintAreas( mxSheet, uno::UNO_QUERY_THROW );
      68           0 :     uno::Sequence< table::CellRangeAddress > aSeq = xPrintAreas->getPrintAreas();
      69           0 :     sal_Int32 nCount = aSeq.getLength();
      70           0 :     if( nCount )
      71             :     {
      72           0 :         ScAddress::Details aDetails( formula::FormulaGrammar::CONV_XL_A1, 0, 0 );
      73           0 :         sal_uInt16 nFlags = SCA_VALID;
      74           0 :         nFlags |= ( SCA_TAB_ABSOLUTE | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB2_ABSOLUTE | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE );
      75           0 :         ScRangeList aRangeList;
      76           0 :         for( sal_Int32 i=0; i<nCount; i++ )
      77             :         {
      78           0 :             ScRange aRange;
      79           0 :             ScUnoConversion::FillScRange( aRange, aSeq[i] );
      80           0 :             aRangeList.Append( aRange );
      81             :         }
      82           0 :         ScDocument* pDoc = excel::getDocShell( mxModel )->GetDocument();
      83           0 :         aRangeList.Format( aPrintArea, nFlags, pDoc, formula::FormulaGrammar::CONV_XL_A1, ','  );
      84             :     }
      85             : 
      86           0 :     return aPrintArea;
      87             : }
      88             : 
      89           0 : void SAL_CALL ScVbaPageSetup::setPrintArea( const rtl::OUString& rAreas ) throw (css::uno::RuntimeException)
      90             : {
      91           0 :     uno::Reference< sheet::XPrintAreas > xPrintAreas( mxSheet, uno::UNO_QUERY_THROW );
      92           0 :     if( rAreas.isEmpty() ||
      93           0 :         rAreas.equalsIgnoreAsciiCase ( rtl::OUString("FALSE") ) )
      94             :     {
      95             :         // print the whole sheet
      96           0 :         uno::Sequence< table::CellRangeAddress > aSeq;
      97           0 :         xPrintAreas->setPrintAreas( aSeq );
      98             :     }
      99             :     else
     100             :     {
     101           0 :         ScRangeList aCellRanges;
     102           0 :         ScRange aRange;
     103           0 :         if( getScRangeListForAddress( rAreas, excel::getDocShell( mxModel ) , aRange, aCellRanges ) )
     104             :         {
     105           0 :             uno::Sequence< table::CellRangeAddress > aSeq( aCellRanges.size() );
     106           0 :             for ( size_t i = 0, nRanges = aCellRanges.size(); i < nRanges; ++i )
     107             :             {
     108           0 :                 ScRange* pRange = aCellRanges[ i ];
     109           0 :                 table::CellRangeAddress aRangeAddress;
     110           0 :                 ScUnoConversion::FillApiRange( aRangeAddress, *pRange );
     111           0 :                 aSeq[ i++ ] = aRangeAddress;
     112             :             }
     113           0 :             xPrintAreas->setPrintAreas( aSeq );
     114           0 :         }
     115           0 :     }
     116           0 : }
     117             : 
     118           0 : double SAL_CALL ScVbaPageSetup::getHeaderMargin() throw (css::uno::RuntimeException)
     119             : {
     120           0 :     return VbaPageSetupBase::getHeaderMargin();
     121             : }
     122             : 
     123           0 : void SAL_CALL ScVbaPageSetup::setHeaderMargin( double margin ) throw (css::uno::RuntimeException)
     124             : {
     125           0 :     VbaPageSetupBase::setHeaderMargin( margin );
     126           0 : }
     127             : 
     128           0 : double SAL_CALL ScVbaPageSetup::getFooterMargin() throw (css::uno::RuntimeException)
     129             : {
     130           0 :     return VbaPageSetupBase::getFooterMargin();
     131             : }
     132             : 
     133           0 : void SAL_CALL ScVbaPageSetup::setFooterMargin( double margin ) throw (css::uno::RuntimeException)
     134             : {
     135           0 :     VbaPageSetupBase::setFooterMargin( margin );
     136           0 : }
     137             : 
     138           0 : uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesTall() throw (css::uno::RuntimeException)
     139             : {
     140           0 :     return mxPageProps->getPropertyValue( rtl::OUString( "ScaleToPagesY"));
     141             : }
     142             : 
     143           0 : void SAL_CALL ScVbaPageSetup::setFitToPagesTall( const uno::Any& fitToPagesTall) throw (css::uno::RuntimeException)
     144             : {
     145           0 :     sal_uInt16 scaleToPageY = 0;
     146             :     try
     147             :     {
     148             :         sal_Bool aValue;
     149           0 :         if( fitToPagesTall.getValueTypeClass() != uno::TypeClass_BOOLEAN || (fitToPagesTall >>= aValue))
     150             :         {
     151           0 :             fitToPagesTall >>= scaleToPageY;
     152             :         }
     153             : 
     154           0 :         mxPageProps->setPropertyValue( rtl::OUString( "ScaleToPagesY"), uno::makeAny( scaleToPageY ));
     155             :     }
     156           0 :     catch( uno::Exception& )
     157             :     {
     158             :     }
     159           0 : }
     160             : 
     161           0 : uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesWide() throw (css::uno::RuntimeException)
     162             : {
     163           0 :     return mxPageProps->getPropertyValue( rtl::OUString( "ScaleToPagesX"));
     164             : }
     165             : 
     166           0 : void SAL_CALL ScVbaPageSetup::setFitToPagesWide( const uno::Any& fitToPagesWide) throw (css::uno::RuntimeException)
     167             : {
     168           0 :     sal_uInt16 scaleToPageX = 0;
     169             :     try
     170             :     {
     171           0 :         sal_Bool aValue = false;
     172           0 :         if( fitToPagesWide.getValueTypeClass() != uno::TypeClass_BOOLEAN || (fitToPagesWide >>= aValue))
     173             :         {
     174           0 :             fitToPagesWide >>= scaleToPageX;
     175             :         }
     176             : 
     177           0 :         mxPageProps->setPropertyValue( rtl::OUString( "ScaleToPagesX"), uno::makeAny( scaleToPageX ));
     178             :     }
     179           0 :     catch( uno::Exception& )
     180             :     {
     181             :     }
     182           0 : }
     183             : 
     184           0 : uno::Any SAL_CALL ScVbaPageSetup::getZoom() throw (css::uno::RuntimeException)
     185             : {
     186           0 :     return mxPageProps->getPropertyValue( rtl::OUString( "PageScale"));
     187             : }
     188             : 
     189           0 : void SAL_CALL ScVbaPageSetup::setZoom( const uno::Any& zoom) throw (css::uno::RuntimeException)
     190             : {
     191           0 :     sal_uInt16 pageScale = 0;
     192             :     try
     193             :     {
     194           0 :         if( zoom.getValueTypeClass() == uno::TypeClass_BOOLEAN )
     195             :         {
     196           0 :             sal_Bool aValue = false;
     197           0 :             zoom >>= aValue;
     198           0 :             if( aValue )
     199             :             {
     200           0 :                 DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
     201             :             }
     202             :         }
     203             :         else
     204             :         {
     205           0 :             zoom >>= pageScale;
     206           0 :             if(( pageScale < ZOOM_IN )||( pageScale > ZOOM_MAX ))
     207             :             {
     208           0 :                 DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
     209             :             }
     210             :         }
     211             : 
     212             :         // these only exist in S08
     213           0 :         sal_uInt16 nScale = 0;
     214           0 :         mxPageProps->setPropertyValue( rtl::OUString( "ScaleToPages"), uno::makeAny( nScale ));
     215           0 :         mxPageProps->setPropertyValue( rtl::OUString( "ScaleToPagesX"), uno::makeAny( nScale ));
     216           0 :         mxPageProps->setPropertyValue( rtl::OUString( "ScaleToPagesY"), uno::makeAny( nScale ));
     217             :     }
     218           0 :     catch( beans::UnknownPropertyException& )
     219             :     {
     220           0 :         if( pageScale == 0 )
     221             :         {
     222           0 :             DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
     223             :         }
     224             :     }
     225           0 :     catch( uno::Exception& )
     226             :     {
     227             :     }
     228             : 
     229           0 :     mxPageProps->setPropertyValue( rtl::OUString( "PageScale"), uno::makeAny( pageScale ));
     230           0 : }
     231             : 
     232           0 : rtl::OUString SAL_CALL ScVbaPageSetup::getLeftHeader() throw (css::uno::RuntimeException)
     233             : {
     234           0 :     rtl::OUString leftHeader;
     235             :     try
     236             :     {
     237           0 :         uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageHeaderContent")), uno::UNO_QUERY_THROW);
     238           0 :         if( xHeaderContent.is() )
     239             :         {
     240           0 :             uno::Reference< text::XText > xText = xHeaderContent->getLeftText();
     241           0 :             leftHeader = xText->getString();
     242           0 :         }
     243             :     }
     244           0 :     catch( uno::Exception& )
     245             :     {
     246             :     }
     247             : 
     248           0 :     return leftHeader;
     249             : }
     250             : 
     251           0 : void SAL_CALL ScVbaPageSetup::setLeftHeader( const rtl::OUString& leftHeader) throw (css::uno::RuntimeException)
     252             : {
     253             :     try
     254             :     {
     255           0 :         uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageHeaderContent")), uno::UNO_QUERY_THROW);
     256           0 :         if( xHeaderContent.is() )
     257             :         {
     258           0 :             uno::Reference< text::XText > xText = xHeaderContent->getLeftText();
     259           0 :             xText->setString( leftHeader );
     260           0 :             mxPageProps->setPropertyValue( rtl::OUString( "RightPageHeaderContent"), uno::makeAny(xHeaderContent) );
     261           0 :         }
     262             :     }
     263           0 :     catch( uno::Exception& )
     264             :     {
     265             :     }
     266           0 : }
     267             : 
     268           0 : rtl::OUString SAL_CALL ScVbaPageSetup::getCenterHeader() throw (css::uno::RuntimeException)
     269             : {
     270           0 :     rtl::OUString centerHeader;
     271             :     try
     272             :     {
     273           0 :         uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageHeaderContent")), uno::UNO_QUERY_THROW);
     274           0 :         if( xHeaderContent.is() )
     275             :         {
     276           0 :             uno::Reference< text::XText > xText = xHeaderContent->getCenterText();
     277           0 :             centerHeader = xText->getString();
     278           0 :         }
     279             :     }
     280           0 :     catch( uno::Exception& )
     281             :     {
     282             :     }
     283             : 
     284           0 :     return centerHeader;
     285             : }
     286             : 
     287           0 : void SAL_CALL ScVbaPageSetup::setCenterHeader( const rtl::OUString& centerHeader) throw (css::uno::RuntimeException)
     288             : {
     289             :     try
     290             :     {
     291           0 :         uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageHeaderContent")), uno::UNO_QUERY_THROW);
     292           0 :         if( xHeaderContent.is() )
     293             :         {
     294           0 :             uno::Reference< text::XText > xText = xHeaderContent->getCenterText();
     295           0 :             xText->setString( centerHeader );
     296           0 :             mxPageProps->setPropertyValue( rtl::OUString( "RightPageHeaderContent"), uno::makeAny(xHeaderContent) );
     297           0 :         }
     298             :     }
     299           0 :     catch( uno::Exception& )
     300             :     {
     301             :     }
     302           0 : }
     303             : 
     304           0 : rtl::OUString SAL_CALL ScVbaPageSetup::getRightHeader() throw (css::uno::RuntimeException)
     305             : {
     306           0 :     rtl::OUString rightHeader;
     307             :     try
     308             :     {
     309           0 :         uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageHeaderContent")), uno::UNO_QUERY_THROW);
     310           0 :         if( xHeaderContent.is() )
     311             :         {
     312           0 :             uno::Reference< text::XText > xText = xHeaderContent->getRightText();
     313           0 :             rightHeader = xText->getString();
     314           0 :         }
     315             :     }
     316           0 :     catch( uno::Exception& )
     317             :     {
     318             :     }
     319             : 
     320           0 :     return rightHeader;
     321             : }
     322             : 
     323           0 : void SAL_CALL ScVbaPageSetup::setRightHeader( const rtl::OUString& rightHeader) throw (css::uno::RuntimeException)
     324             : {
     325             :     try
     326             :     {
     327           0 :         uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageHeaderContent")), uno::UNO_QUERY_THROW);
     328           0 :         if( xHeaderContent.is() )
     329             :         {
     330           0 :             uno::Reference< text::XText > xText = xHeaderContent->getRightText();
     331           0 :             xText->setString( rightHeader );
     332           0 :             mxPageProps->setPropertyValue( rtl::OUString( "RightPageHeaderContent"), uno::makeAny(xHeaderContent) );
     333           0 :         }
     334             :     }
     335           0 :     catch( uno::Exception& )
     336             :     {
     337             :     }
     338           0 : }
     339             : 
     340           0 : rtl::OUString SAL_CALL ScVbaPageSetup::getLeftFooter() throw (css::uno::RuntimeException)
     341             : {
     342           0 :     rtl::OUString leftFooter;
     343             :     try
     344             :     {
     345           0 :         uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageFooterContent")), uno::UNO_QUERY_THROW);
     346           0 :         if( xFooterContent.is() )
     347             :         {
     348           0 :             uno::Reference< text::XText > xText = xFooterContent->getLeftText();
     349           0 :             leftFooter = xText->getString();
     350           0 :         }
     351             :     }
     352           0 :     catch( uno::Exception& )
     353             :     {
     354             :     }
     355             : 
     356           0 :     return leftFooter;
     357             : }
     358             : 
     359           0 : void SAL_CALL ScVbaPageSetup::setLeftFooter( const rtl::OUString& leftFooter) throw (css::uno::RuntimeException)
     360             : {
     361             :     try
     362             :     {
     363           0 :         uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageFooterContent")), uno::UNO_QUERY_THROW);
     364           0 :         if( xFooterContent.is() )
     365             :         {
     366           0 :             uno::Reference< text::XText > xText = xFooterContent->getLeftText();
     367           0 :             xText->setString( leftFooter );
     368           0 :             mxPageProps->setPropertyValue( rtl::OUString( "RightPageFooterContent"), uno::makeAny(xFooterContent) );
     369           0 :         }
     370             :     }
     371           0 :     catch( uno::Exception& )
     372             :     {
     373             :     }
     374           0 : }
     375             : 
     376           0 : rtl::OUString SAL_CALL ScVbaPageSetup::getCenterFooter() throw (css::uno::RuntimeException)
     377             : {
     378           0 :     rtl::OUString centerFooter;
     379             :     try
     380             :     {
     381           0 :         uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageFooterContent")), uno::UNO_QUERY_THROW);
     382           0 :         if( xFooterContent.is() )
     383             :         {
     384           0 :             uno::Reference< text::XText > xText = xFooterContent->getCenterText();
     385           0 :             centerFooter = xText->getString();
     386           0 :         }
     387             :     }
     388           0 :     catch( uno::Exception& )
     389             :     {
     390             :     }
     391             : 
     392           0 :     return centerFooter;
     393             : }
     394             : 
     395           0 : void SAL_CALL ScVbaPageSetup::setCenterFooter( const rtl::OUString& centerFooter) throw (css::uno::RuntimeException)
     396             : {
     397             :     try
     398             :     {
     399           0 :         uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageFooterContent")), uno::UNO_QUERY_THROW);
     400           0 :         if( xFooterContent.is() )
     401             :         {
     402           0 :             uno::Reference< text::XText > xText = xFooterContent->getCenterText();
     403           0 :             xText->setString( centerFooter );
     404           0 :             mxPageProps->setPropertyValue( rtl::OUString( "RightPageFooterContent"), uno::makeAny(xFooterContent) );
     405           0 :         }
     406             :     }
     407           0 :     catch( uno::Exception& )
     408             :     {
     409             :     }
     410             : 
     411           0 : }
     412             : 
     413           0 : rtl::OUString SAL_CALL ScVbaPageSetup::getRightFooter() throw (css::uno::RuntimeException)
     414             : {
     415           0 :     rtl::OUString rightFooter;
     416             :     try
     417             :     {
     418           0 :         uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageFooterContent")), uno::UNO_QUERY_THROW);
     419           0 :         if( xFooterContent.is() )
     420             :         {
     421           0 :             uno::Reference< text::XText > xText = xFooterContent->getRightText();
     422           0 :             rightFooter = xText->getString();
     423           0 :         }
     424             :     }
     425           0 :     catch( uno::Exception& )
     426             :     {
     427             :     }
     428             : 
     429           0 :     return rightFooter;
     430             : }
     431             : 
     432           0 : void SAL_CALL ScVbaPageSetup::setRightFooter( const rtl::OUString& rightFooter) throw (css::uno::RuntimeException)
     433             : {
     434             :     try
     435             :     {
     436           0 :         uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( "RightPageFooterContent")), uno::UNO_QUERY_THROW);
     437           0 :         if( xFooterContent.is() )
     438             :         {
     439           0 :             uno::Reference< text::XText > xText = xFooterContent->getRightText();
     440           0 :             xText->setString( rightFooter );
     441           0 :             mxPageProps->setPropertyValue( rtl::OUString( "RightPageFooterContent"), uno::makeAny(xFooterContent) );
     442           0 :         }
     443             :     }
     444           0 :     catch( uno::Exception& )
     445             :     {
     446             :     }
     447           0 : }
     448             : 
     449           0 : sal_Int32 SAL_CALL ScVbaPageSetup::getOrder() throw (css::uno::RuntimeException)
     450             : {
     451           0 :     sal_Int32 order = excel::XlOrder::xlDownThenOver;
     452             :     try
     453             :     {
     454           0 :         uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( "PrintDownFirst"));
     455           0 :         sal_Bool bPrintDownFirst = false;
     456           0 :         aValue >>= bPrintDownFirst;
     457           0 :         if( !bPrintDownFirst )
     458           0 :             order = excel::XlOrder::xlOverThenDown;
     459             :     }
     460           0 :     catch( uno::Exception& )
     461             :     {
     462             :     }
     463             : 
     464           0 :     return order;
     465             : }
     466             : 
     467           0 : void SAL_CALL ScVbaPageSetup::setOrder( sal_Int32 order) throw (css::uno::RuntimeException)
     468             : {
     469           0 :     sal_Bool bOrder = sal_True;
     470           0 :     switch( order )
     471             :     {
     472             :         case excel::XlOrder::xlDownThenOver:
     473           0 :             break;
     474             :         case excel::XlOrder::xlOverThenDown:
     475           0 :             bOrder = false;
     476           0 :             break;
     477             :         default:
     478           0 :             DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
     479             :     }
     480             : 
     481             :     try
     482             :     {
     483           0 :         mxPageProps->setPropertyValue( rtl::OUString( "PrintDownFirst"), uno::makeAny( bOrder ));
     484             :     }
     485           0 :     catch( uno::Exception& )
     486             :     {
     487             :     }
     488           0 : }
     489             : 
     490           0 : sal_Int32 SAL_CALL ScVbaPageSetup::getFirstPageNumber() throw (css::uno::RuntimeException)
     491             : {
     492           0 :     sal_Int16 number = 0;
     493             :     try
     494             :     {
     495           0 :         uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( "FirstPageNumber"));
     496           0 :         aValue >>= number;
     497             :     }
     498           0 :     catch( uno::Exception& )
     499             :     {
     500             :     }
     501             : 
     502           0 :     if( number ==0 )
     503             :     {
     504           0 :         number = excel::Constants::xlAutomatic;
     505             :     }
     506             : 
     507           0 :     return number;
     508             : }
     509             : 
     510           0 : void SAL_CALL ScVbaPageSetup::setFirstPageNumber( sal_Int32 firstPageNumber) throw (css::uno::RuntimeException)
     511             : {
     512           0 :     if( firstPageNumber < 0 )
     513           0 :         DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
     514           0 :     if( firstPageNumber == excel::Constants::xlAutomatic )
     515           0 :         firstPageNumber = 0;
     516             : 
     517             :     try
     518             :     {
     519           0 :         uno::Any aValue;
     520           0 :         aValue <<= (sal_Int16)firstPageNumber;
     521           0 :         mxPageProps->setPropertyValue( rtl::OUString( "FirstPageNumber"), aValue );
     522             :     }
     523           0 :     catch( uno::Exception& )
     524             :     {
     525             :     }
     526           0 : }
     527             : 
     528           0 : sal_Bool SAL_CALL ScVbaPageSetup::getCenterVertically() throw (css::uno::RuntimeException)
     529             : {
     530           0 :     sal_Bool centerVertically = false;
     531             :     try
     532             :     {
     533           0 :         uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( "CenterVertically"));
     534           0 :         aValue >>= centerVertically;
     535             :     }
     536           0 :     catch( uno::Exception& )
     537             :     {
     538             :     }
     539           0 :     return centerVertically;
     540             : }
     541             : 
     542           0 : void SAL_CALL ScVbaPageSetup::setCenterVertically( sal_Bool centerVertically) throw (css::uno::RuntimeException)
     543             : {
     544             :     try
     545             :     {
     546           0 :         mxPageProps->setPropertyValue( rtl::OUString( "CenterVertically"), uno::makeAny( centerVertically ));
     547             :     }
     548           0 :     catch( uno::Exception& )
     549             :     {
     550             :     }
     551           0 : }
     552             : 
     553           0 : sal_Bool SAL_CALL ScVbaPageSetup::getCenterHorizontally() throw (css::uno::RuntimeException)
     554             : {
     555           0 :     sal_Bool centerHorizontally = false;
     556             :     try
     557             :     {
     558           0 :         uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( "CenterHorizontally"));
     559           0 :         aValue >>= centerHorizontally;
     560             :     }
     561           0 :     catch( uno::Exception& )
     562             :     {
     563             :     }
     564           0 :     return centerHorizontally;
     565             : }
     566             : 
     567           0 : void SAL_CALL ScVbaPageSetup::setCenterHorizontally( sal_Bool centerHorizontally) throw (css::uno::RuntimeException)
     568             : {
     569             :     try
     570             :     {
     571           0 :         mxPageProps->setPropertyValue( rtl::OUString( "CenterHorizontally"), uno::makeAny( centerHorizontally ));
     572             :     }
     573           0 :     catch( uno::Exception& )
     574             :     {
     575             :     }
     576           0 : }
     577             : 
     578           0 : sal_Bool SAL_CALL ScVbaPageSetup::getPrintHeadings() throw (css::uno::RuntimeException)
     579             : {
     580           0 :     sal_Bool printHeadings = false;
     581             :     try
     582             :     {
     583           0 :         uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( "PrintHeaders"));
     584           0 :         aValue >>= printHeadings;
     585             :     }
     586           0 :     catch( uno::Exception& )
     587             :     {
     588             :     }
     589           0 :     return printHeadings;
     590             : }
     591             : 
     592           0 : void SAL_CALL ScVbaPageSetup::setPrintHeadings( sal_Bool printHeadings) throw (css::uno::RuntimeException)
     593             : {
     594             :     try
     595             :     {
     596           0 :         mxPageProps->setPropertyValue( rtl::OUString( "PrintHeaders"), uno::makeAny( printHeadings ));
     597             :     }
     598           0 :     catch( uno::Exception& )
     599             :     {
     600             :     }
     601           0 : }
     602             : 
     603             : rtl::OUString
     604           0 : ScVbaPageSetup::getServiceImplName()
     605             : {
     606           0 :     return rtl::OUString("ScVbaPageSetup");
     607             : }
     608             : 
     609             : uno::Sequence< rtl::OUString >
     610           0 : ScVbaPageSetup::getServiceNames()
     611             : {
     612           0 :     static uno::Sequence< rtl::OUString > aServiceNames;
     613           0 :     if ( aServiceNames.getLength() == 0 )
     614             :     {
     615           0 :         aServiceNames.realloc( 1 );
     616           0 :         aServiceNames[ 0 ] = rtl::OUString( "ooo.vba.excel.PageSetup"  );
     617             :     }
     618           0 :     return aServiceNames;
     619             : }
     620             : 
     621             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10