1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef SC_VBA_SHAPE_HXX 24 #define SC_VBA_SHAPE_HXX 25 26 #include <ooo/vba/office/MsoShapeType.hpp> 27 #include <com/sun/star/drawing/XShape.hpp> 28 #include <com/sun/star/drawing/XShapes.hpp> 29 #include <com/sun/star/lang/XEventListener.hpp> 30 #include <com/sun/star/beans/XPropertySet.hpp> 31 #include <ooo/vba/msforms/XShape.hpp> 32 #include <ooo/vba/msforms/XLineFormat.hpp> 33 #include <cppuhelper/implbase2.hxx> 34 35 #include <vbahelper/vbahelperinterface.hxx> 36 37 typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape; 38 39 typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE; 40 41 class VBAHELPER_DLLPUBLIC ScVbaShape : public ScVbaShape_BASE 42 { 43 private: 44 protected: 45 std::auto_ptr< ov::ShapeHelper > m_pShapeHelper; 46 css::uno::Reference< css::drawing::XShape > m_xShape; 47 css::uno::Reference< css::drawing::XShapes > m_xShapes; 48 css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; 49 sal_Int32 m_nType; 50 css::uno::Reference< css::frame::XModel > m_xModel; 51 css::uno::Any m_aRange; 52 virtual void addListeners(); 53 virtual void removeShapeListener(); 54 virtual void removeShapesListener(); 55 virtual rtl::OUString& getServiceImplName(); 56 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 57 public: 58 ScVbaShape( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XShapes >& xShapes, const css::uno::Reference< css::frame::XModel >& xModel, sal_Int32 nType ); 59 ScVbaShape( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::frame::XModel >& xModel ); 60 virtual ~ScVbaShape(); getRange()61 css::uno::Any getRange() { return m_aRange; }; setRange(css::uno::Any aRange)62 void setRange( css::uno::Any aRange ) { m_aRange = aRange; }; 63 64 static sal_Int32 getType( const css::uno::Reference< css::drawing::XShape > xShape ); 65 66 // Attributes 67 virtual rtl::OUString SAL_CALL getName(); 68 virtual void SAL_CALL setName( const rtl::OUString& _name ); 69 virtual double SAL_CALL getHeight(); 70 virtual void SAL_CALL setHeight( double _height ); 71 virtual double SAL_CALL getWidth(); 72 virtual void SAL_CALL setWidth( double _width ); 73 virtual double SAL_CALL getLeft(); 74 virtual void SAL_CALL setLeft( double _left ); 75 virtual double SAL_CALL getTop(); 76 virtual void SAL_CALL setTop( double _top ); 77 virtual sal_Bool SAL_CALL getVisible(); 78 virtual void SAL_CALL setVisible( sal_Bool _visible ); 79 virtual sal_Int32 SAL_CALL getZOrderPosition(); 80 virtual sal_Int32 SAL_CALL getType(); 81 virtual double SAL_CALL getRotation(); 82 virtual void SAL_CALL setRotation( double _rotation ); 83 virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine(); 84 virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill(); 85 virtual css::uno::Reference< ov::msforms::XPictureFormat > SAL_CALL getPictureFormat(); 86 virtual ::sal_Bool SAL_CALL getLockAspectRatio(); 87 virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ); 88 virtual ::sal_Bool SAL_CALL getLockAnchor(); 89 virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ); 90 virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition(); 91 virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ); 92 virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition(); 93 virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ); 94 95 // Methods 96 virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ); 97 virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ); 98 virtual void SAL_CALL Delete(); 99 virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ); 100 virtual void SAL_CALL IncrementRotation( double Increment ); 101 virtual void SAL_CALL IncrementLeft( double Increment ); 102 virtual void SAL_CALL IncrementTop( double Increment ); 103 virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ); 104 virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ); 105 // Replace?? 106 virtual void SAL_CALL Select( const css::uno::Any& Replace ); 107 virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ); 108 // XEventListener 109 virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ); 110 }; 111 #endif//SC_VBA_SHAPE_HXX 112