LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbacolumn.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 37 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 9 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 "vbacolumn.hxx"
      20             : #include <vbahelper/vbahelper.hxx>
      21             : #include <tools/diagnose_ex.h>
      22             : #include "vbatable.hxx"
      23             : #include <com/sun/star/table/XCellRange.hpp>
      24             : #include <com/sun/star/view/XSelectionSupplier.hpp>
      25             : #include <rtl/ustrbuf.hxx>
      26             : #include "wordvbahelper.hxx"
      27             : #include "vbatablehelper.hxx"
      28             : 
      29             : using namespace ::ooo::vba;
      30             : using namespace ::com::sun::star;
      31             : 
      32           0 : SwVbaColumn::SwVbaColumn( 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 ) :
      33           0 :     SwVbaColumn_BASE( rParent, rContext ), mxTextTable( xTextTable ), mnIndex( nIndex )
      34             : {
      35           0 :     mxTableColumns = mxTextTable->getColumns();
      36           0 : }
      37             : 
      38           0 : SwVbaColumn::~SwVbaColumn()
      39             : {
      40           0 : }
      41             : 
      42             : sal_Int32 SAL_CALL
      43           0 : SwVbaColumn::getWidth( ) throw ( css::uno::RuntimeException, std::exception )
      44             : {
      45           0 :     SwVbaTableHelper aTableHelper( mxTextTable );
      46           0 :     return aTableHelper.GetColWidth( mnIndex );
      47             : }
      48             : 
      49             : void SAL_CALL
      50           0 : SwVbaColumn::setWidth( sal_Int32 _width ) throw ( css::uno::RuntimeException, std::exception )
      51             : {
      52             : 
      53           0 :     SwVbaTableHelper aTableHelper( mxTextTable );
      54           0 :     aTableHelper.SetColWidth( _width, mnIndex );
      55           0 : }
      56             : 
      57             : void SAL_CALL
      58           0 : SwVbaColumn::Select( ) throw ( uno::RuntimeException, std::exception )
      59             : {
      60           0 :     SelectColumn( getCurrentWordDoc(mxContext), mxTextTable, mnIndex, mnIndex );
      61           0 : }
      62             : 
      63           0 : void SwVbaColumn::SelectColumn( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nStartColumn, sal_Int32 nEndColumn ) throw ( uno::RuntimeException )
      64             : {
      65           0 :     OUStringBuffer aRangeName;
      66           0 :     OUString sStartCol = SwVbaTableHelper::getColumnStr( nStartColumn );
      67           0 :     aRangeName.append(sStartCol).append(sal_Int32( 1 ) );
      68           0 :     OUString sEndCol = SwVbaTableHelper::getColumnStr( nEndColumn );
      69           0 :     sal_Int32 nRowCount = xTextTable->getRows()->getCount();
      70           0 :     aRangeName.append(':').append( sEndCol ).append( sal_Int32( nRowCount ) );
      71             : 
      72           0 :     uno::Reference< table::XCellRange > xCellRange( xTextTable, uno::UNO_QUERY_THROW );
      73           0 :     OUString sSelRange = aRangeName.makeStringAndClear();
      74           0 :     uno::Reference< table::XCellRange > xSelRange = xCellRange->getCellRangeByName( sSelRange );
      75             : 
      76           0 :     uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
      77           0 :     xSelection->select( uno::makeAny( xSelRange ) );
      78           0 : }
      79             : 
      80             : OUString
      81           0 : SwVbaColumn::getServiceImplName()
      82             : {
      83           0 :     return OUString("SwVbaColumn");
      84             : }
      85             : 
      86             : uno::Sequence< OUString >
      87           0 : SwVbaColumn::getServiceNames()
      88             : {
      89           0 :     static uno::Sequence< OUString > aServiceNames;
      90           0 :     if ( aServiceNames.getLength() == 0 )
      91             :     {
      92           0 :         aServiceNames.realloc( 1 );
      93           0 :         aServiceNames[ 0 ] = "ooo.vba.word.Column";
      94             :     }
      95           0 :     return aServiceNames;
      96             : }
      97             : 
      98             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11