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

Generated by: LCOV version 1.11