LCOV - code coverage report
Current view: top level - vbahelper/source/msforms - vbatextbox.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 79 0.0 %
Date: 2014-04-14 Functions: 0 23 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             : 
      20             : #include "vbatextbox.hxx"
      21             : #include "vbanewfont.hxx"
      22             : #include <com/sun/star/text/XTextRange.hpp>
      23             : #include <ooo/vba/msforms/fmBorderStyle.hpp>
      24             : #include <ooo/vba/msforms/fmSpecialEffect.hpp>
      25             : 
      26             : using namespace com::sun::star;
      27             : using namespace ooo::vba;
      28             : 
      29           0 : ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog )
      30             : {
      31           0 : }
      32             : 
      33             : // Attributes
      34             : uno::Any SAL_CALL
      35           0 : ScVbaTextBox::getValue() throw (css::uno::RuntimeException, std::exception)
      36             : {
      37           0 :     return uno::makeAny( getText() );
      38             : }
      39             : 
      40             : void SAL_CALL
      41           0 : ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException, std::exception)
      42             : {
      43             :     // booleans are converted to uppercase strings
      44           0 :     OUString sVal = extractStringFromAny( _value, true );
      45           0 :     setText( sVal );
      46           0 : }
      47             : 
      48             : //getString() will cause some imfo lose.
      49             : OUString SAL_CALL
      50           0 : ScVbaTextBox::getText() throw (css::uno::RuntimeException, std::exception)
      51             : {
      52           0 :     uno::Any aValue;
      53           0 :     aValue = m_xProps->getPropertyValue( "Text" );
      54           0 :     OUString sString;
      55           0 :     aValue >>= sString;
      56           0 :     return sString;
      57             : }
      58             : 
      59             : void SAL_CALL
      60           0 : ScVbaTextBox::setText( const OUString& _text ) throw (css::uno::RuntimeException, std::exception)
      61             : {
      62           0 :     OUString oldText( getText() );
      63           0 :     if ( !mbDialog )
      64             :     {
      65           0 :         uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
      66           0 :         xTextRange->setString( _text );
      67             :     }
      68             :     else
      69           0 :         m_xProps->setPropertyValue( "Text" , uno::makeAny( _text ) );
      70           0 :     if ( oldText != _text )
      71           0 :         fireChangeEvent();
      72           0 : }
      73             : 
      74             : sal_Int32 SAL_CALL
      75           0 : ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException, std::exception)
      76             : {
      77           0 :     uno::Any aValue;
      78           0 :     aValue = m_xProps->getPropertyValue( "MaxTextLen" );
      79           0 :     sal_Int16 nMaxLength = 0;
      80           0 :     aValue >>= nMaxLength;
      81           0 :     return (sal_Int32)nMaxLength;
      82             : }
      83             : 
      84             : void SAL_CALL
      85           0 : ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException, std::exception)
      86             : {
      87           0 :     sal_Int16 nTmp( _maxlength );
      88           0 :     uno::Any aValue( nTmp );
      89           0 :     m_xProps->setPropertyValue( "MaxTextLen" , aValue);
      90           0 : }
      91             : 
      92             : sal_Bool SAL_CALL
      93           0 : ScVbaTextBox::getMultiline() throw (css::uno::RuntimeException, std::exception)
      94             : {
      95           0 :     uno::Any aValue;
      96           0 :     aValue = m_xProps->getPropertyValue( "MultiLine" );
      97           0 :     sal_Bool bRet = false;
      98           0 :     aValue >>= bRet;
      99           0 :     return bRet;
     100             : }
     101             : 
     102             : void SAL_CALL
     103           0 : ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException, std::exception)
     104             : {
     105           0 :     uno::Any aValue( _multiline );
     106           0 :     m_xProps->setPropertyValue( "MultiLine" , aValue);
     107           0 : }
     108             : 
     109           0 : sal_Int32 SAL_CALL ScVbaTextBox::getSpecialEffect() throw (uno::RuntimeException, std::exception)
     110             : {
     111           0 :     return msforms::fmSpecialEffect::fmSpecialEffectSunken;
     112             : }
     113             : 
     114           0 : void SAL_CALL ScVbaTextBox::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException, std::exception)
     115             : {
     116             :     // #STUB
     117           0 : }
     118             : 
     119           0 : sal_Int32 SAL_CALL ScVbaTextBox::getBorderStyle() throw (uno::RuntimeException, std::exception)
     120             : {
     121           0 :     return msforms::fmBorderStyle::fmBorderStyleNone;
     122             : }
     123             : 
     124           0 : void SAL_CALL ScVbaTextBox::setBorderStyle( sal_Int32 /*nBorderStyle*/ ) throw (uno::RuntimeException, std::exception)
     125             : {
     126             :     // #STUB
     127           0 : }
     128             : 
     129           0 : sal_Int32 SAL_CALL ScVbaTextBox::getTextLength() throw (uno::RuntimeException, std::exception)
     130             : {
     131           0 :     return getText().getLength();
     132             : }
     133             : 
     134           0 : uno::Reference< msforms::XNewFont > SAL_CALL ScVbaTextBox::getFont() throw (uno::RuntimeException, std::exception)
     135             : {
     136           0 :     return new VbaNewFont( this, mxContext, m_xProps );
     137             : }
     138             : 
     139           0 : sal_Int32 SAL_CALL ScVbaTextBox::getBackColor() throw (uno::RuntimeException, std::exception)
     140             : {
     141           0 :     return ScVbaControl::getBackColor();
     142             : }
     143             : 
     144           0 : void SAL_CALL ScVbaTextBox::setBackColor( sal_Int32 nBackColor ) throw (uno::RuntimeException, std::exception)
     145             : {
     146           0 :     ScVbaControl::setBackColor( nBackColor );
     147           0 : }
     148             : 
     149           0 : sal_Bool SAL_CALL ScVbaTextBox::getAutoSize() throw (uno::RuntimeException, std::exception)
     150             : {
     151           0 :     return ScVbaControl::getAutoSize();
     152             : }
     153             : 
     154           0 : void SAL_CALL ScVbaTextBox::setAutoSize( sal_Bool bAutoSize ) throw (uno::RuntimeException, std::exception)
     155             : {
     156           0 :     ScVbaControl::setAutoSize( bAutoSize );
     157           0 : }
     158             : 
     159           0 : sal_Bool SAL_CALL ScVbaTextBox::getLocked() throw (uno::RuntimeException, std::exception)
     160             : {
     161           0 :     return ScVbaControl::getLocked();
     162             : }
     163             : 
     164           0 : void SAL_CALL ScVbaTextBox::setLocked( sal_Bool bLocked ) throw (uno::RuntimeException, std::exception)
     165             : {
     166           0 :     ScVbaControl::setLocked( bLocked );
     167           0 : }
     168             : 
     169             : OUString
     170           0 : ScVbaTextBox::getServiceImplName()
     171             : {
     172           0 :     return OUString( "ScVbaTextBox" );
     173             : }
     174             : 
     175             : uno::Sequence< OUString >
     176           0 : ScVbaTextBox::getServiceNames()
     177             : {
     178           0 :     static uno::Sequence< OUString > aServiceNames;
     179           0 :     if ( aServiceNames.getLength() == 0 )
     180             :     {
     181           0 :         aServiceNames.realloc( 1 );
     182           0 :         aServiceNames[ 0 ] = "ooo.vba.msforms.TextBox";
     183             :     }
     184           0 :     return aServiceNames;
     185             : }
     186             : 
     187             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10