LCOV - code coverage report
Current view: top level - sc/source/ui/vba - vbapagebreak.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 21 57 36.8 %
Date: 2015-06-13 12:38:46 Functions: 11 21 52.4 %
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           4 : 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           4 :             maTablePageBreakData( aTablePageBreakData )
      33             : {
      34           4 : }
      35             : 
      36             : template< typename Ifc1 >
      37           4 : sal_Int32 ScVbaPageBreak<Ifc1>::getType() throw (uno::RuntimeException)
      38             : {
      39           4 :     uno::Any aValue = mxRowColPropertySet->getPropertyValue("IsStartOfNewPage");
      40           4 :     bool hasPageBreak = false;
      41           4 :     aValue >>= hasPageBreak;
      42             : 
      43           4 :     if( !hasPageBreak )
      44           0 :         return excel::XlPageBreak::xlPageBreakNone;
      45             : 
      46           4 :     if( maTablePageBreakData.ManualBreak )
      47           4 :         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           2 : void ScVbaPageBreak<Ifc1>::Delete() throw ( script::BasicErrorException, uno::RuntimeException)
      77             : {
      78           2 :     mxRowColPropertySet->setPropertyValue("IsStartOfNewPage", uno::makeAny(sal_False));
      79           2 : }
      80             : 
      81             : template< typename Ifc1 >
      82           2 : uno::Reference< excel::XRange> ScVbaPageBreak<Ifc1>::Location() throw ( script::BasicErrorException, uno::RuntimeException)
      83             : {
      84           2 :     uno::Reference< table::XCellRange > xRange( mxRowColPropertySet, uno::UNO_QUERY_THROW );
      85           2 :     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           2 : 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           2 : :   ScVbaVPageBreak_BASE( xParent, xContext, xProps, aTablePageBreakData )
     137             : {
     138           2 : }
     139             : 
     140           4 : ScVbaVPageBreak::~ScVbaVPageBreak()
     141             : {
     142           4 : }
     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             : }
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11