LCOV - code coverage report
Current view: top level - sc/source/ui/vba - vbatitle.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 49 0.0 %
Date: 2014-04-14 Functions: 0 30 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             : #ifndef SC_VBA_TITLE_HXX
      20             : #define SC_VBA_TITLE_HXX
      21             : 
      22             : #include <vbahelper/vbahelperinterface.hxx>
      23             : #include "excelvbahelper.hxx"
      24             : #include "vbainterior.hxx"
      25             : #include "vbafont.hxx"
      26             : #include "vbapalette.hxx"
      27             : #include <com/sun/star/drawing/XShape.hpp>
      28             : #include <com/sun/star/beans/XPropertySet.hpp>
      29             : #include <ooo/vba/excel/XTitle.hpp>
      30             : #include <ooo/vba/excel/XCharacters.hpp>
      31             : #include <basic/sberrors.hxx>
      32             : #include <memory>
      33             : 
      34             : template< typename Ifc1 >
      35           0 : class TitleImpl : public InheritedHelperInterfaceImpl< Ifc1 >
      36             : {
      37             : typedef InheritedHelperInterfaceImpl< Ifc1 > BaseClass;
      38             : 
      39             : protected:
      40             :     css::uno::Reference< css::drawing::XShape > xTitleShape;
      41             :     css::uno::Reference< css::beans::XPropertySet > xShapePropertySet;
      42             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
      43             :     std::auto_ptr<ov::ShapeHelper> oShapeHelper;
      44             :     SAL_WNODEPRECATED_DECLARATIONS_POP
      45             :     ScVbaPalette m_Palette;
      46             : public:
      47           0 :     TitleImpl(  const css::uno::Reference< ov::XHelperInterface >& xParent,   const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& _xTitleShape ) : BaseClass( xParent, xContext ), xTitleShape( _xTitleShape )
      48             :     {
      49           0 :         xShapePropertySet.set( xTitleShape, css::uno::UNO_QUERY_THROW );
      50           0 :         oShapeHelper.reset( new ov::ShapeHelper(xTitleShape) );
      51           0 :     }
      52           0 :     css::uno::Reference< ov::excel::XInterior > SAL_CALL Interior(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
      53             :     {
      54             :         // #TODO find out what the proper parent should be
      55             :         // leaving as set by the helperapi for the moment
      56             :         // #TODO we really need the ScDocument to pass to ScVbaInterior
      57             :         // otherwise attemps to access the palette will fail
      58           0 :         return new ScVbaInterior( BaseClass::mxParent, BaseClass::mxContext, xShapePropertySet );
      59             :     }
      60           0 :     css::uno::Reference< ov::excel::XFont > SAL_CALL Font(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
      61             :     {
      62             :         // #TODO find out what the proper parent should be
      63             :         // leaving as set by the helperapi for the moment
      64           0 :         return new ScVbaFont( BaseClass::mxParent, BaseClass::mxContext, m_Palette, xShapePropertySet );
      65             : 
      66             :     }
      67           0 :     void SAL_CALL setText( const OUString& Text ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
      68             :     {
      69             :         try
      70             :         {
      71           0 :             xShapePropertySet->setPropertyValue("String", css::uno::makeAny( Text ));
      72             :         }
      73           0 :         catch ( css::uno::Exception& )
      74             :         {
      75           0 :             throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
      76             :         }
      77           0 :     }
      78           0 :     OUString SAL_CALL getText(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
      79             :     {
      80           0 :         OUString sText;
      81             :         try
      82             :         {
      83           0 :             xShapePropertySet->getPropertyValue("String") >>= sText;
      84             :         }
      85           0 :         catch ( css::uno::Exception& )
      86             :         {
      87           0 :             throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
      88             :         }
      89           0 :         return sText;
      90             :     }
      91             : 
      92             :     css::uno::Reference< ov::excel::XCharacters > SAL_CALL Characters(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
      93             :     {
      94             :         // #FIXME #TODO the helperapi Characters implementation doesn't
      95             :         // seem to do very much, need to know how the existing Characters
      96             :         // impl ( that we use for Range ) can be reused
      97             :         return  css::uno::Reference< ov::excel::XCharacters > ();
      98             :     }
      99             : 
     100           0 :     void SAL_CALL setTop( double Top ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
     101             :     {
     102           0 :         oShapeHelper->setTop( Top );
     103           0 :     }
     104           0 :     double SAL_CALL getTop(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
     105             :     {
     106           0 :         return oShapeHelper->getTop();
     107             :     }
     108           0 :     void SAL_CALL setLeft( double Left ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
     109             :     {
     110           0 :         oShapeHelper->setLeft( Left );
     111           0 :     }
     112           0 :     double SAL_CALL getLeft(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
     113             :     {
     114           0 :         return oShapeHelper->getLeft();
     115             :     }
     116           0 :     void SAL_CALL setOrientation( ::sal_Int32 _nOrientation ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
     117             :     {
     118             :         try
     119             :         {
     120           0 :             xShapePropertySet->setPropertyValue("TextRotation", css::uno::makeAny(_nOrientation*100));
     121             :         }
     122           0 :         catch (css::uno::Exception& )
     123             :         {
     124           0 :             throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     125             :         }
     126           0 :     }
     127           0 :     ::sal_Int32 SAL_CALL getOrientation(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
     128             :     {
     129           0 :         sal_Int32 nSOOrientation = 0;
     130             :         try
     131             :         {
     132           0 :             xShapePropertySet->getPropertyValue("TextRotation") >>= nSOOrientation;
     133             :         }
     134           0 :         catch (css::uno::Exception& )
     135             :         {
     136           0 :             throw css::script::BasicErrorException( OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, OUString() );
     137             :         }
     138           0 :         return static_cast< sal_Int32 >(nSOOrientation / 100) ;
     139             :     }
     140             : // XHelperInterface
     141           0 :     OUString getServiceImplName()
     142             :     {
     143           0 :         return OUString("TitleImpl");
     144             :     }
     145           0 :     css::uno::Sequence< OUString > getServiceNames()
     146             :     {
     147           0 :         static css::uno::Sequence< OUString > aServiceNames;
     148           0 :         if ( aServiceNames.getLength() == 0 )
     149             :         {
     150           0 :             aServiceNames.realloc( 1 );
     151           0 :             aServiceNames[ 0 ] = OUString("ooo.vba.excel.XTitle" );
     152             :         }
     153           0 :         return aServiceNames;
     154             :     }
     155             : };
     156             : #endif
     157             : 
     158             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10