LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbarow.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 55 0.0 %
Date: 2012-08-25 Functions: 0 12 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 110 0.0 %

           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 2008 by Sun Microsystems, Inc.
       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                 :            : #include "vbarow.hxx"
      29                 :            : #include <vbahelper/vbahelper.hxx>
      30                 :            : #include <tools/diagnose_ex.h>
      31                 :            : #include <com/sun/star/table/XCellRange.hpp>
      32                 :            : #include <com/sun/star/view/XSelectionSupplier.hpp>
      33                 :            : #include <ooo/vba/word/WdRowHeightRule.hpp>
      34                 :            : #include <ooo/vba/word/WdConstants.hpp>
      35                 :            : #include <rtl/ustrbuf.hxx>
      36                 :            : #include "wordvbahelper.hxx"
      37                 :            : #include "vbatablehelper.hxx"
      38                 :            : 
      39                 :            : using namespace ::ooo::vba;
      40                 :            : using namespace ::com::sun::star;
      41                 :            : 
      42                 :          0 : SwVbaRow::SwVbaRow( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext,const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nIndex ) throw ( uno::RuntimeException ) :
      43                 :          0 :     SwVbaRow_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
      44                 :            : {
      45 [ #  # ][ #  # ]:          0 :     mxTableRows = mxTextTable->getRows();
                 [ #  # ]
      46 [ #  # ][ #  # ]:          0 :     mxRowProps.set( mxTableRows->getByIndex( mnIndex ), uno::UNO_QUERY_THROW );
                 [ #  # ]
      47                 :          0 : }
      48                 :            : 
      49                 :          0 : SwVbaRow::~SwVbaRow()
      50                 :            : {
      51         [ #  # ]:          0 : }
      52                 :            : 
      53                 :          0 : uno::Any SAL_CALL SwVbaRow::getHeight() throw (css::uno::RuntimeException)
      54                 :            : {
      55 [ #  # ][ #  # ]:          0 :     if( getHeightRule() == word::WdRowHeightRule::wdRowHeightAuto )
      56         [ #  # ]:          0 :         return uno::makeAny( sal_Int32( word::WdConstants::wdUndefined ) );
      57                 :            : 
      58                 :          0 :     sal_Int32 nHeight = 0;
      59 [ #  # ][ #  # ]:          0 :     mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ) ) >>= nHeight;
                 [ #  # ]
      60 [ #  # ][ #  # ]:          0 :     return uno::makeAny( (float)Millimeter::getInPoints( nHeight ) );
      61                 :            : }
      62                 :            : 
      63                 :          0 : void SAL_CALL SwVbaRow::setHeight( const uno::Any& _height ) throw (css::uno::RuntimeException)
      64                 :            : {
      65                 :          0 :     float height = 0;
      66                 :          0 :     _height >>= height;
      67                 :            : 
      68         [ #  # ]:          0 :     sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( height );
      69 [ #  # ][ #  # ]:          0 :     mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height") ), uno::makeAny( nHeight ) );
         [ #  # ][ #  # ]
      70                 :          0 : }
      71                 :            : 
      72                 :          0 : ::sal_Int32 SAL_CALL SwVbaRow::getHeightRule() throw (css::uno::RuntimeException)
      73                 :            : {
      74                 :          0 :     sal_Bool isAutoHeight = sal_False;
      75 [ #  # ][ #  # ]:          0 :     mxRowProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ) ) >>= isAutoHeight;
                 [ #  # ]
      76         [ #  # ]:          0 :     return isAutoHeight ? word::WdRowHeightRule::wdRowHeightAuto : word::WdRowHeightRule::wdRowHeightExactly;
      77                 :            : }
      78                 :            : 
      79                 :          0 : void SAL_CALL SwVbaRow::setHeightRule( ::sal_Int32 _heightrule ) throw (css::uno::RuntimeException)
      80                 :            : {
      81                 :          0 :     sal_Bool isAutoHeight = ( _heightrule == word::WdRowHeightRule::wdRowHeightAuto );
      82 [ #  # ][ #  # ]:          0 :     mxRowProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsAutoHeight") ), uno::makeAny( isAutoHeight ) );
         [ #  # ][ #  # ]
      83                 :          0 : }
      84                 :            : 
      85                 :            : void SAL_CALL
      86                 :          0 : SwVbaRow::Select( ) throw ( uno::RuntimeException )
      87                 :            : {
      88         [ #  # ]:          0 :     SelectRow( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
      89                 :          0 : }
      90                 :            : 
      91                 :          0 : void SwVbaRow::SelectRow( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartRow, sal_Int32 nEndRow ) throw ( uno::RuntimeException )
      92                 :            : {
      93                 :          0 :     rtl::OUStringBuffer aRangeName;
      94 [ #  # ][ #  # ]:          0 :     aRangeName.append('A').append(sal_Int32( nStartRow + 1 ) );
      95         [ #  # ]:          0 :     SwVbaTableHelper aTableHelper( xTextTable );
      96         [ #  # ]:          0 :     sal_Int32 nColCount = aTableHelper.getTabColumnsCount( nEndRow );
      97                 :            :     // FIXME: the column count > 26
      98                 :            :     //sal_Char cCol = 'A' + nColCount - 1;
      99         [ #  # ]:          0 :     rtl::OUString sCol = aTableHelper.getColumnStr( nColCount - 1);
     100 [ #  # ][ #  # ]:          0 :     aRangeName.append(':').append( sCol ).append( sal_Int32( nEndRow + 1 ) );
                 [ #  # ]
     101                 :            : 
     102         [ #  # ]:          0 :     uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
     103         [ #  # ]:          0 :     rtl::OUString sSelRange = aRangeName.makeStringAndClear();
     104 [ #  # ][ #  # ]:          0 :     uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
     105                 :            : 
     106 [ #  # ][ #  # ]:          0 :     uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     107 [ #  # ][ #  # ]:          0 :     xSelection->select( uno::makeAny( xSelRange ) );
         [ #  # ][ #  # ]
     108                 :          0 : }
     109                 :            : 
     110                 :          0 : void SAL_CALL SwVbaRow::SetHeight( float height, sal_Int32 heightrule ) throw (css::uno::RuntimeException)
     111                 :            : {
     112                 :          0 :     setHeightRule( heightrule );
     113         [ #  # ]:          0 :     setHeight( uno::makeAny( height ) );
     114                 :          0 : }
     115                 :            : 
     116                 :            : rtl::OUString
     117                 :          0 : SwVbaRow::getServiceImplName()
     118                 :            : {
     119                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaRow"));
     120                 :            : }
     121                 :            : 
     122                 :            : uno::Sequence< rtl::OUString >
     123                 :          0 : SwVbaRow::getServiceNames()
     124                 :            : {
     125 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > aServiceNames;
         [ #  # ][ #  # ]
     126         [ #  # ]:          0 :     if ( aServiceNames.getLength() == 0 )
     127                 :            :     {
     128                 :          0 :         aServiceNames.realloc( 1 );
     129         [ #  # ]:          0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Row" ) );
     130                 :            :     }
     131                 :          0 :     return aServiceNames;
     132                 :            : }
     133                 :            : 
     134                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10