LCOV - code coverage report
Current view: top level - sc/source/ui/vba - vbasheetobject.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 3 0.0 %
Date: 2014-11-03 Functions: 0 6 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             : #ifndef INCLUDED_SC_SOURCE_UI_VBA_VBASHEETOBJECT_HXX
      21             : #define INCLUDED_SC_SOURCE_UI_VBA_VBASHEETOBJECT_HXX
      22             : 
      23             : #include <ooo/vba/excel/XButton.hpp>
      24             : #include <ooo/vba/excel/XControlObject.hpp>
      25             : #include <ooo/vba/excel/XSheetObject.hpp>
      26             : #include <vbahelper/vbahelperinterface.hxx>
      27             : #include "vbapalette.hxx"
      28             : 
      29             : namespace com { namespace sun { namespace star {
      30             :     namespace container { class XIndexContainer; }
      31             :     namespace drawing { class XControlShape; }
      32             : } } }
      33             : 
      34             : typedef InheritedHelperInterfaceImpl1< ov::excel::XCharacters > ScVbaButtonCharacters_BASE;
      35             : 
      36             : /** Simple implementation of the Characters symbol for drawing button objects. */
      37             : class ScVbaButtonCharacters : public ScVbaButtonCharacters_BASE
      38             : {
      39             : public:
      40             :     explicit ScVbaButtonCharacters(
      41             :         const css::uno::Reference< ov::XHelperInterface >& rxParent,
      42             :         const css::uno::Reference< css::uno::XComponentContext >& rxContext,
      43             :         const css::uno::Reference< css::beans::XPropertySet >& rxPropSet,
      44             :         const ScVbaPalette& rPalette,
      45             :         const css::uno::Any& rStart,
      46             :         const css::uno::Any& rLength ) throw (css::uno::RuntimeException);
      47             :     virtual ~ScVbaButtonCharacters();
      48             : 
      49             :     // XCharacters attributes
      50             :     virtual OUString SAL_CALL getCaption() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      51             :     virtual void SAL_CALL setCaption( const OUString& rCaption ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      52             :     virtual OUString SAL_CALL getText() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      53             :     virtual void SAL_CALL setText( const OUString& rText ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      54             :     virtual sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      55             :     virtual css::uno::Reference< ov::excel::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      56             :     virtual void SAL_CALL setFont( const css::uno::Reference< ov::excel::XFont >& rxFont ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      57             : 
      58             :     // XCharacters methods
      59             :     virtual void SAL_CALL Insert( const OUString& rString ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      60             :     virtual void SAL_CALL Delete() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      61             : 
      62             :     // XHelperInterface
      63             :     VBAHELPER_DECL_XHELPERINTERFACE
      64             : 
      65             : private:
      66             :     OUString getFullString() const throw (css::uno::RuntimeException);
      67             :     void setFullString( const OUString& rString ) throw (css::uno::RuntimeException);
      68             : 
      69             : private:
      70             :     ScVbaPalette maPalette;
      71             :     css::uno::Reference< css::beans::XPropertySet > mxPropSet;
      72             :     sal_Int32 mnStart;
      73             :     sal_Int32 mnLength;
      74             : };
      75             : 
      76             : typedef InheritedHelperInterfaceImpl1< ov::excel::XSheetObject > ScVbaSheetObject_BASE;
      77             : 
      78             : /** Base class for drawing objects embedded in sheets. */
      79           0 : class ScVbaSheetObjectBase : public ScVbaSheetObject_BASE
      80             : {
      81             : public:
      82             :     explicit ScVbaSheetObjectBase(
      83             :         const css::uno::Reference< ov::XHelperInterface >& rxParent,
      84             :         const css::uno::Reference< css::uno::XComponentContext >& rxContext,
      85             :         const css::uno::Reference< css::frame::XModel >& rxModel,
      86             :         const css::uno::Reference< css::drawing::XShape >& rxShape ) throw (css::uno::RuntimeException);
      87             : 
      88             :     // XSheetObject attributes
      89             :     virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      90             :     virtual void SAL_CALL setLeft( double fLeft ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      91             :     virtual double SAL_CALL getTop() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      92             :     virtual void SAL_CALL setTop( double fTop ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      93             :     virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      94             :     virtual void SAL_CALL setWidth( double fWidth ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      95             :     virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      96             :     virtual void SAL_CALL setHeight( double fHeight ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      97             :     virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             :     virtual void SAL_CALL setName( const OUString& rName ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      99             :     virtual sal_Int32 SAL_CALL getPlacement() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     100             :     virtual void SAL_CALL setPlacement( sal_Int32 nPlacement ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     101             :     virtual sal_Bool SAL_CALL getPrintObject() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     102             :     virtual void SAL_CALL setPrintObject( sal_Bool bPrintObject ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     103             : 
     104             :     /** Sets default properties after a new object has been created. */
     105             :     void setDefaultProperties( sal_Int32 nIndex ) throw (css::uno::RuntimeException);
     106             : 
     107             : protected:
     108             :     /** Derived classes return the base name used for new objects. */
     109             :     virtual OUString implGetBaseName() const = 0;
     110             :     /** Derived classes set default properties for new drawing objects. */
     111             :     virtual void implSetDefaultProperties() throw (css::uno::RuntimeException);
     112             : 
     113             : protected:
     114             :     ScVbaPalette maPalette;
     115             :     css::uno::Reference< css::frame::XModel > mxModel;
     116             :     css::uno::Reference< css::drawing::XShape > mxShape;
     117             :     css::uno::Reference< css::beans::XPropertySet > mxShapeProps;
     118             : };
     119             : 
     120             : typedef ::cppu::ImplInheritanceHelper1< ScVbaSheetObjectBase, ov::excel::XControlObject > ScVbaControlObject_BASE;
     121             : 
     122           0 : class ScVbaControlObjectBase : public ScVbaControlObject_BASE
     123             : {
     124             : public:
     125             :     /** Specifies the listener used for OnAction events. */
     126             :     enum ListenerType
     127             :     {
     128             :         LISTENER_ACTION,        /// XActionListener.actionPerformed
     129             :         LISTENER_MOUSE,         /// XMouseListener.mouseReleased
     130             :         LISTENER_TEXT,          /// XTextListener.textChanged
     131             :         LISTENER_VALUE,         /// XAdjustmentListener.adjustmentValueChanged
     132             :         LISTENER_CHANGE         /// XChangeListener.changed
     133             :     };
     134             : 
     135             :     explicit ScVbaControlObjectBase(
     136             :         const css::uno::Reference< ov::XHelperInterface >& rxParent,
     137             :         const css::uno::Reference< css::uno::XComponentContext >& rxContext,
     138             :         const css::uno::Reference< css::frame::XModel >& rxModel,
     139             :         const css::uno::Reference< css::container::XIndexContainer >& rxFormIC,
     140             :         const css::uno::Reference< css::drawing::XControlShape >& rxControlShape,
     141             :         ListenerType eListenerType ) throw (css::uno::RuntimeException);
     142             : 
     143             :     // XSheetObject attributes
     144             :     virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     145             :     virtual void SAL_CALL setName( const OUString& rName ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     146             :     virtual OUString SAL_CALL getOnAction() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     147             :     virtual void SAL_CALL setOnAction( const OUString& rMacroName ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     148             :     virtual sal_Bool SAL_CALL getPrintObject() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             :     virtual void SAL_CALL setPrintObject( sal_Bool bPrintObject ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     150             : 
     151             :     // XControlObject attributes
     152             :     virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     153             :     virtual void SAL_CALL setAutoSize( sal_Bool bAutoSize ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     154             : 
     155             : protected:
     156             :     sal_Int32 getModelIndexInForm() const throw (css::uno::RuntimeException);
     157             : 
     158             : protected:
     159             :     css::uno::Reference< css::container::XIndexContainer > mxFormIC;
     160             :     css::uno::Reference< css::beans::XPropertySet > mxControlProps;
     161             :     OUString maListenerType;
     162             :     OUString maEventMethod;
     163             : };
     164             : 
     165             : typedef ::cppu::ImplInheritanceHelper1< ScVbaControlObjectBase, ov::excel::XButton > ScVbaButton_BASE;
     166             : 
     167           0 : class ScVbaButton : public ScVbaButton_BASE
     168             : {
     169             : public:
     170             :     explicit ScVbaButton(
     171             :         const css::uno::Reference< ov::XHelperInterface >& rxParent,
     172             :         const css::uno::Reference< css::uno::XComponentContext >& rxContext,
     173             :         const css::uno::Reference< css::frame::XModel >& rxModel,
     174             :         const css::uno::Reference< css::container::XIndexContainer >& rxFormIC,
     175             :         const css::uno::Reference< css::drawing::XControlShape >& rxControlShape ) throw (css::uno::RuntimeException);
     176             : 
     177             :     // XButton attributes
     178             :     virtual OUString SAL_CALL getCaption() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     179             :     virtual void SAL_CALL setCaption( const OUString& rCaption ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     180             :     virtual css::uno::Reference< ov::excel::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     181             :     virtual void SAL_CALL setFont( const css::uno::Reference< ov::excel::XFont >& rxFont ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     182             :     virtual sal_Int32 SAL_CALL getHorizontalAlignment() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     183             :     virtual void SAL_CALL setHorizontalAlignment( sal_Int32 nAlign ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     184             :     virtual sal_Int32 SAL_CALL getVerticalAlignment() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     185             :     virtual void SAL_CALL setVerticalAlignment( sal_Int32 nAlign ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     186             :     virtual sal_Int32 SAL_CALL getOrientation() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     187             :     virtual void SAL_CALL setOrientation( sal_Int32 nOrientation ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     188             : 
     189             :     // XButton methods
     190             :     css::uno::Reference< ov::excel::XCharacters > SAL_CALL Characters(
     191             :         const css::uno::Any& rStart, const css::uno::Any& rLength ) throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     192             : 
     193             :     // XHelperInterface
     194             :     VBAHELPER_DECL_XHELPERINTERFACE
     195             : 
     196             : protected:
     197             :     virtual OUString implGetBaseName() const SAL_OVERRIDE;
     198             :     virtual void implSetDefaultProperties() throw (css::uno::RuntimeException) SAL_OVERRIDE;
     199             : };
     200             : 
     201             : #endif
     202             : 
     203             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10