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() throw( css::uno::RuntimeException );
54 	virtual void removeShapesListener() throw( css::uno::RuntimeException );
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 ) throw ( css::lang::IllegalArgumentException );
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 ) throw ( css::lang::IllegalArgumentException );
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 ) throw (css::uno::RuntimeException);
65 
66     // Attributes
67     virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
68     virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
69     virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
70     virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
71     virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
72     virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
73     virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
74     virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
75     virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
76     virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
77     virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
78     virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
79     virtual sal_Int32 SAL_CALL getZOrderPosition() throw (css::uno::RuntimeException);
80     virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException);
81     virtual double SAL_CALL getRotation() throw (css::uno::RuntimeException);
82     virtual void SAL_CALL setRotation( double _rotation ) throw (css::uno::RuntimeException);
83     virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException);
84     virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException);
85     virtual css::uno::Reference< ov::msforms::XPictureFormat > SAL_CALL getPictureFormat() throw (css::uno::RuntimeException);
86     virtual ::sal_Bool SAL_CALL getLockAspectRatio() throw (css::uno::RuntimeException);
87     virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (css::uno::RuntimeException);
88     virtual ::sal_Bool SAL_CALL getLockAnchor() throw (css::uno::RuntimeException);
89     virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ) throw (css::uno::RuntimeException);
90     virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() throw (css::uno::RuntimeException);
91     virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (css::uno::RuntimeException);
92     virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() throw (css::uno::RuntimeException);
93     virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
94 
95     // Methods
96     virtual css::uno::Any SAL_CALL SAL_CALL TextFrame(  ) throw (css::uno::RuntimeException);
97     virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat(  ) throw (css::uno::RuntimeException);
98     virtual void SAL_CALL Delete() throw (css::uno::RuntimeException);
99     virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException);
100     virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException);
101     virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException);
102     virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException);
103     virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException);
104     virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException);
105     // Replace??
106     virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException);
107     virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
108     // XEventListener
109     virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException );
110 };
111 #endif//SC_VBA_SHAPE_HXX
112