LCOV - code coverage report
Current view: top level - sc/source/ui/vba - vbacharacters.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 48 0.0 %
Date: 2014-04-14 Functions: 0 12 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 "vbacharacters.hxx"
      20             : 
      21             : #include "vbaglobals.hxx"
      22             : #include "vbafont.hxx"
      23             : 
      24             : 
      25             : using namespace ::ooo::vba;
      26             : using namespace ::com::sun::star;
      27             : 
      28           0 : ScVbaCharacters::ScVbaCharacters( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, const uno::Reference< text::XSimpleText>& xRange,const css::uno::Any& Start, const css::uno::Any& Length, bool Replace  ) throw ( css::lang::IllegalArgumentException, css::uno::RuntimeException ) : ScVbaCharacters_BASE( xParent, xContext ), m_xSimpleText(xRange), m_aPalette( dPalette),  nLength(-1), nStart(1), bReplace( Replace )
      29             : {
      30           0 :     Start >>= nStart;
      31           0 :     if ( nStart < 1 )
      32           0 :         nStart = 1; // silently correct user error ( as ms )
      33           0 :     nStart--; // OOo is 0 based
      34           0 :     Length >>=nLength;
      35           0 :     uno::Reference< text::XTextCursor > xTextCursor( m_xSimpleText->createTextCursor(), uno::UNO_QUERY_THROW );
      36           0 :     xTextCursor->collapseToStart();
      37           0 :     if ( nStart )
      38             :     {
      39           0 :         if ( ( nStart + 1 ) > m_xSimpleText->getString().getLength() )
      40             :             //nStart = m_xSimpleText->getString().getLength();
      41           0 :             xTextCursor->gotoEnd( false );
      42           0 :         xTextCursor->goRight( nStart, false );
      43             :     }
      44           0 :     if ( nLength < 0 ) // expand to end
      45           0 :         xTextCursor->gotoEnd( sal_True );
      46             :     else
      47           0 :         xTextCursor->goRight( nLength, sal_True );
      48           0 :     m_xTextRange.set( xTextCursor, uno::UNO_QUERY_THROW );
      49             : 
      50           0 : }
      51             : 
      52             : OUString SAL_CALL
      53           0 : ScVbaCharacters::getCaption() throw (css::uno::RuntimeException, std::exception)
      54             : {
      55           0 :     return m_xTextRange->getString();
      56             : }
      57             : void SAL_CALL
      58           0 : ScVbaCharacters::setCaption( const OUString& _caption ) throw (css::uno::RuntimeException, std::exception)
      59             : {
      60           0 :     m_xTextRange->setString( _caption );
      61             : 
      62           0 : }
      63             : 
      64             : ::sal_Int32 SAL_CALL
      65           0 : ScVbaCharacters::getCount() throw (css::uno::RuntimeException, std::exception)
      66             : {
      67           0 :     return getCaption().getLength();
      68             : }
      69             : 
      70             : OUString SAL_CALL
      71           0 : ScVbaCharacters::getText() throw (css::uno::RuntimeException, std::exception)
      72             : {
      73           0 :     return getCaption();
      74             : }
      75             : void SAL_CALL
      76           0 : ScVbaCharacters::setText( const OUString& _text ) throw (css::uno::RuntimeException, std::exception)
      77             : {
      78           0 :     setCaption( _text );
      79           0 : }
      80             : uno::Reference< excel::XFont > SAL_CALL
      81           0 : ScVbaCharacters::getFont() throw (css::uno::RuntimeException, std::exception)
      82             : {
      83           0 :     uno::Reference< beans::XPropertySet > xProps( m_xTextRange, uno::UNO_QUERY_THROW );
      84           0 :     return uno::Reference< excel::XFont >( new ScVbaFont( this, mxContext, m_aPalette, xProps ) );
      85             : }
      86             : void SAL_CALL
      87           0 : ScVbaCharacters::setFont( const uno::Reference< excel::XFont >& /*_font*/ ) throw (css::uno::RuntimeException, std::exception)
      88             : {
      89             :     // #TODO #FIXME needs implementation, or can't be done?
      90           0 :     throw uno::RuntimeException("Not Implemented", uno::Reference< XInterface >() );
      91             : }
      92             : 
      93             : 
      94             : // Methods
      95             : void SAL_CALL
      96           0 : ScVbaCharacters::Insert( const OUString& rString ) throw (css::uno::RuntimeException, std::exception)
      97             : {
      98           0 :     m_xSimpleText->insertString( m_xTextRange, rString, bReplace );
      99           0 : }
     100             : 
     101             : void SAL_CALL
     102           0 : ScVbaCharacters::Delete(  ) throw (css::uno::RuntimeException, std::exception)
     103             : {
     104             :     // #FIXME #TODO is this a bit suspect?, I wonder should the contents
     105             :     // of the cell be deleted from the parent ( range )
     106           0 :     m_xSimpleText->setString(OUString());
     107           0 : }
     108             : 
     109             : 
     110             : OUString
     111           0 : ScVbaCharacters::getServiceImplName()
     112             : {
     113           0 :     return OUString("ScVbaCharacters");
     114             : }
     115             : 
     116             : uno::Sequence< OUString >
     117           0 : ScVbaCharacters::getServiceNames()
     118             : {
     119           0 :     static uno::Sequence< OUString > aServiceNames;
     120           0 :     if ( aServiceNames.getLength() == 0 )
     121             :     {
     122           0 :         aServiceNames.realloc( 1 );
     123           0 :         aServiceNames[ 0 ] = "ooo.vba.excel.Characters";
     124             :     }
     125           0 :     return aServiceNames;
     126             : }
     127             : 
     128             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10