LCOV - code coverage report
Current view: top level - sc/source/ui/vba - vbapagebreak.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 22 58 37.9 %
Date: 2014-11-03 Functions: 13 23 56.5 %
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 "vbapagebreak.hxx"
      20             : #include "vbarange.hxx"
      21             : #include <ooo/vba/excel/XlPageBreak.hpp>
      22             : using namespace ::com::sun::star;
      23             : using namespace ::ooo::vba;
      24             : 
      25             : template< typename Ifc1 >
      26           8 : ScVbaPageBreak<Ifc1>::ScVbaPageBreak( const uno::Reference< XHelperInterface >& xParent,
      27             :                     const uno::Reference< uno::XComponentContext >& xContext,
      28             :                     uno::Reference< beans::XPropertySet >& xProps,
      29             :                     sheet::TablePageBreakData aTablePageBreakData) throw (uno::RuntimeException):
      30             :             ScVbaPageBreak_BASE( xParent, xContext ),
      31             :             mxRowColPropertySet( xProps ),
      32           8 :             maTablePageBreakData( aTablePageBreakData )
      33             : {
      34           8 : }
      35             : 
      36             : template< typename Ifc1 >
      37           8 : sal_Int32 ScVbaPageBreak<Ifc1>::getType() throw (uno::RuntimeException)
      38             : {
      39           8 :     uno::Any aValue = mxRowColPropertySet->getPropertyValue("IsStartOfNewPage");
      40           8 :     bool hasPageBreak = false;
      41           8 :     aValue >>= hasPageBreak;
      42             : 
      43           8 :     if( !hasPageBreak )
      44           0 :         return excel::XlPageBreak::xlPageBreakNone;
      45             : 
      46           8 :     if( maTablePageBreakData.ManualBreak )
      47           8 :         return excel::XlPageBreak::xlPageBreakManual;
      48             : 
      49           0 :     return excel::XlPageBreak::xlPageBreakAutomatic;
      50             : }
      51             : 
      52             : template< typename Ifc1 >
      53           0 : void ScVbaPageBreak<Ifc1>::setType(sal_Int32 type) throw (uno::RuntimeException)
      54             : {
      55           0 :     if( (type != excel::XlPageBreak::xlPageBreakNone) &&
      56             :         (type != excel::XlPageBreak::xlPageBreakManual) &&
      57             :         (type != excel::XlPageBreak::xlPageBreakAutomatic) )
      58             :     {
      59           0 :         DebugHelper::runtimeexception(SbERR_BAD_PARAMETER, OUString() );
      60             :     }
      61             : 
      62           0 :     if( type == excel::XlPageBreak::xlPageBreakNone )
      63             :     {
      64           0 :         mxRowColPropertySet->setPropertyValue("IsStartOfNewPage", uno::makeAny(sal_False));
      65           0 :         return;
      66             :     }
      67             : 
      68           0 :     mxRowColPropertySet->setPropertyValue("IsStartOfNewPage", uno::makeAny(sal_True));
      69           0 :     if( type == excel::XlPageBreak::xlPageBreakManual )
      70           0 :         maTablePageBreakData.ManualBreak = sal_True;
      71             :     else
      72           0 :         maTablePageBreakData.ManualBreak = false;
      73             : }
      74             : 
      75             : template< typename Ifc1 >
      76           4 : void ScVbaPageBreak<Ifc1>::Delete() throw ( script::BasicErrorException, uno::RuntimeException)
      77             : {
      78           4 :     mxRowColPropertySet->setPropertyValue("IsStartOfNewPage", uno::makeAny(sal_False));
      79           4 : }
      80             : 
      81             : template< typename Ifc1 >
      82           4 : uno::Reference< excel::XRange> ScVbaPageBreak<Ifc1>::Location() throw ( script::BasicErrorException, uno::RuntimeException)
      83             : {
      84           4 :     uno::Reference< table::XCellRange > xRange( mxRowColPropertySet, uno::UNO_QUERY_THROW );
      85           4 :     return new ScVbaRange( ScVbaPageBreak_BASE::getParent(), ScVbaPageBreak_BASE::mxContext, xRange);
      86             : }
      87             : 
      88             : template< typename Ifc1 >
      89             : OUString
      90           0 : ScVbaPageBreak<Ifc1>::getServiceImplName()
      91             : {
      92           0 :     return OUString("ScVbaPageBreak");
      93             : }
      94             : 
      95             : template< typename Ifc1 >
      96             : uno::Sequence< OUString >
      97           0 : ScVbaPageBreak<Ifc1>::getServiceNames()
      98             : {
      99           0 :     static uno::Sequence< OUString > aServiceNames;
     100           0 :     if ( aServiceNames.getLength() == 0 )
     101             :     {
     102           0 :         aServiceNames.realloc( 1 );
     103           0 :         aServiceNames[ 0 ] = "ooo.vba.excel.PageBreak";
     104             :     }
     105           0 :     return aServiceNames;
     106             : }
     107             : 
     108             : template class ScVbaPageBreak< excel::XHPageBreak >;
     109             : 
     110             : /* class ScVbaHPageBreak */
     111             : OUString
     112           0 : ScVbaHPageBreak::getServiceImplName()
     113             : {
     114           0 :     return OUString("ScVbaHPageBreak");
     115             : }
     116             : 
     117             : uno::Sequence< OUString >
     118           0 : ScVbaHPageBreak::getServiceNames()
     119             : {
     120           0 :     static uno::Sequence< OUString > aServiceNames;
     121           0 :     if ( aServiceNames.getLength() == 0 )
     122             :     {
     123           0 :         aServiceNames.realloc( 1 );
     124           0 :         aServiceNames[ 0 ] = "ooo.vba.excel.HPageBreak";
     125             :     }
     126           0 :     return aServiceNames;
     127             : }
     128             : 
     129             : template class ScVbaPageBreak< excel::XVPageBreak >;
     130             : 
     131             : /* class ScVbaVPageBreak */
     132           4 : ScVbaVPageBreak::ScVbaVPageBreak( const css::uno::Reference< ov::XHelperInterface >& xParent,
     133             :                                   const css::uno::Reference< css::uno::XComponentContext >& xContext,
     134             :                                   css::uno::Reference< css::beans::XPropertySet >& xProps,
     135             :                                   css::sheet::TablePageBreakData aTablePageBreakData ) throw ( css::uno::RuntimeException )
     136           4 : :   ScVbaVPageBreak_BASE( xParent, xContext, xProps, aTablePageBreakData )
     137             : {
     138           4 : }
     139             : 
     140           8 : ScVbaVPageBreak::~ScVbaVPageBreak()
     141             : {
     142           8 : }
     143             : 
     144             : OUString
     145           0 : ScVbaVPageBreak::getServiceImplName()
     146             : {
     147           0 :     return OUString("ScVbaVPageBreak");
     148             : }
     149             : 
     150             : uno::Sequence< OUString >
     151           0 : ScVbaVPageBreak::getServiceNames()
     152             : {
     153           0 :     static uno::Sequence< OUString > aServiceNames;
     154           0 :     if ( aServiceNames.getLength() == 0 )
     155             :     {
     156           0 :         aServiceNames.realloc( 1 );
     157           0 :         aServiceNames[ 0 ] = "ooo.vba.excel.VPageBreak";
     158             :     }
     159           0 :     return aServiceNames;
     160          12 : }
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10