update dev300-m58
[ooovba.git] / vbahelper / source / msforms / vbacontrol.hxx
blob3c9a128ece0130527a56746f416bfa9b1aa38ecd
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: vbacontrol.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef SC_VBA_CONTROL_HXX
31 #define SC_VBA_CONTROL_HXX
33 #include <cppuhelper/implbase1.hxx>
34 #include <com/sun/star/beans/XPropertySet.hpp>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include <com/sun/star/script/XDefaultProperty.hpp>
37 #include <com/sun/star/drawing/XControlShape.hpp>
38 #include <com/sun/star/awt/XControl.hpp>
39 #include <com/sun/star/awt/XWindowPeer.hpp>
40 #include <ooo/vba/msforms/XControl.hpp>
42 #include <vbahelper/vbahelper.hxx>
43 #include <vbahelper/vbahelperinterface.hxx>
44 #include <memory>
46 //typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE;
47 typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE;
49 class ScVbaControl : public ControlImpl_BASE
51 private:
52 com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
53 protected:
54 std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper;
55 css::uno::Reference< css::beans::XPropertySet > m_xProps;
56 css::uno::Reference< css::uno::XInterface > m_xControl;
57 css::uno::Reference< css::frame::XModel > m_xModel;
59 virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException);
60 public:
61 ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
62 const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper );
63 virtual ~ScVbaControl();
64 // This class will own the helper, so make sure it is allocated from
65 // the heap
66 void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
67 // XControl
68 virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
69 virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
70 virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
71 virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
72 virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
73 virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
74 virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
75 virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
76 virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
77 virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
78 virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
79 virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
80 virtual void SAL_CALL SetFocus( ) throw (css::uno::RuntimeException);
82 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException);
83 virtual rtl::OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException);
84 virtual void SAL_CALL setControlSource( const rtl::OUString& _controlsource ) throw (css::uno::RuntimeException);
85 virtual rtl::OUString SAL_CALL getRowSource() throw (css::uno::RuntimeException);
86 virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException);
87 virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
88 virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
89 virtual rtl::OUString SAL_CALL getControlTipText() throw (css::uno::RuntimeException);
90 virtual void SAL_CALL setControlTipText( const rtl::OUString& ) throw (css::uno::RuntimeException);
91 //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
92 virtual void removeResouce() throw( css::uno::RuntimeException );
93 //XHelperInterface
94 virtual rtl::OUString& getServiceImplName();
95 virtual css::uno::Sequence<rtl::OUString> getServiceNames();
99 class ScVbaControlFactory
101 public:
102 ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext,
103 const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel );
104 ScVbaControl* createControl() throw ( css::uno::RuntimeException );
105 ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent ) throw ( css::uno::RuntimeException );
106 private:
107 ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
108 ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
109 css::uno::Reference< css::uno::XComponentContext > m_xContext;
110 css::uno::Reference< css::uno::XInterface > m_xControl;
111 css::uno::Reference< css::frame::XModel > m_xModel;
114 #endif//SC_VBA_CONTROL_HXX