Bump version to 4.1-6
[LibreOffice.git] / vbahelper / source / msforms / vbacontrol.hxx
blob7644b56515f8bd80c6fe7e1bbf9f8cdd447be877
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef SC_VBA_CONTROL_HXX
20 #define SC_VBA_CONTROL_HXX
22 #include <cppuhelper/implbase1.hxx>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/uno/XComponentContext.hpp>
25 #include <com/sun/star/script/XDefaultProperty.hpp>
26 #include <com/sun/star/drawing/XControlShape.hpp>
27 #include <com/sun/star/awt/XControl.hpp>
28 #include <com/sun/star/awt/XWindowPeer.hpp>
29 #include <com/sun/star/script/ScriptEvent.hpp>
30 #include <ooo/vba/msforms/XControl.hpp>
32 #include <vbahelper/vbahelper.hxx>
33 #include <vbahelper/vbahelperinterface.hxx>
34 #include <memory>
36 //typedef ::cppu::WeakImplHelper1< ov::msforms::XControl > ControlImpl_BASE;
37 //template SAL_DLLPUBLIC_IMPORT InheritedHelperInterfaceImpl1< ov::msforms::XControl >;
38 typedef InheritedHelperInterfaceImpl1< ov::msforms::XControl > ControlImpl_BASE;
40 class ScVbaControl : public ControlImpl_BASE
42 private:
43 com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
44 com::sun::star::uno::Reference< com::sun::star::awt::XControl > m_xEmptyFormControl;
45 protected:
46 // awt control has nothing similar to Tag property of Mso controls,
47 // whether it is necessary is another question
48 OUString m_aControlTag;
50 bool bIsDialog;
51 OUString m_sLibraryAndCodeName;
52 std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper;
53 css::uno::Reference< css::beans::XPropertySet > m_xProps;
54 css::uno::Reference< css::uno::XInterface > m_xControl;
55 css::uno::Reference< css::frame::XModel > m_xModel;
57 virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException);
58 void fireChangeEvent();
59 void fireClickEvent();
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 // sets the name of the associated library ( used for UserForm controls )
68 void setLibraryAndCodeName( const OUString& sLibCodeName ) { m_sLibraryAndCodeName = sLibCodeName; }
69 OUString getLibraryAndCodeName() const { return m_sLibraryAndCodeName; }
71 // XControl
72 virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
73 virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
74 virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
75 virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
76 virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
77 virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
78 virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
79 virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException);
80 virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException);
81 virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException);
82 virtual double SAL_CALL getTop() throw (css::uno::RuntimeException);
83 virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException);
84 virtual void SAL_CALL SetFocus( ) throw (css::uno::RuntimeException);
85 virtual void SAL_CALL Move( double Left, double Top, const ::com::sun::star::uno::Any& Width, const ::com::sun::star::uno::Any& Height ) throw (::com::sun::star::uno::RuntimeException);
86 virtual void SAL_CALL fireEvent( const css::script::ScriptEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
88 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException);
89 virtual OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException);
90 virtual void SAL_CALL setControlSource( const OUString& _controlsource ) throw (css::uno::RuntimeException);
91 virtual OUString SAL_CALL getRowSource() throw (css::uno::RuntimeException);
92 virtual void SAL_CALL setRowSource( const OUString& _rowsource ) throw (css::uno::RuntimeException);
93 virtual OUString SAL_CALL getName() throw (css::uno::RuntimeException);
94 virtual void SAL_CALL setName( const OUString& _name ) throw (css::uno::RuntimeException);
95 virtual OUString SAL_CALL getControlTipText() throw (css::uno::RuntimeException);
96 virtual void SAL_CALL setControlTipText( const OUString& ) throw (css::uno::RuntimeException);
97 virtual OUString SAL_CALL getTag() throw (css::uno::RuntimeException);
98 virtual void SAL_CALL setTag( const OUString& aTag ) throw (css::uno::RuntimeException);
99 virtual sal_Int32 SAL_CALL getTabIndex() throw (css::uno::RuntimeException);
100 virtual void SAL_CALL setTabIndex( sal_Int32 nTabIndex ) throw (css::uno::RuntimeException);
101 virtual ::sal_Int32 SAL_CALL getMousePointer() throw (::com::sun::star::uno::RuntimeException);
102 virtual void SAL_CALL setMousePointer( ::sal_Int32 _mousepointer ) throw (::com::sun::star::uno::RuntimeException);
103 //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
104 virtual void removeResouce() throw( css::uno::RuntimeException );
105 virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
106 virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
107 //XHelperInterface
108 virtual OUString getServiceImplName();
109 virtual css::uno::Sequence<OUString> getServiceNames();
110 //General helper methods for properties ( may or maynot be relevant for all
111 //controls
112 sal_Int32 getBackColor() throw (css::uno::RuntimeException);
113 void setBackColor( sal_Int32 nBackColor ) throw (css::uno::RuntimeException);
114 sal_Bool getAutoSize() throw (css::uno::RuntimeException);
115 void setAutoSize( sal_Bool bAutoSize ) throw (css::uno::RuntimeException);
116 sal_Bool getLocked() throw (css::uno::RuntimeException);
117 void setLocked( sal_Bool bAutoSize ) throw (css::uno::RuntimeException);
121 class ScVbaControlFactory
123 public:
124 static css::uno::Reference< ov::msforms::XControl > createShapeControl(
125 const css::uno::Reference< css::uno::XComponentContext >& xContext,
126 const css::uno::Reference< css::drawing::XControlShape >& xControlShape,
127 const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
129 static css::uno::Reference< ov::msforms::XControl > createUserformControl(
130 const css::uno::Reference< css::uno::XComponentContext >& xContext,
131 const css::uno::Reference< css::awt::XControl >& xControl,
132 const css::uno::Reference< css::awt::XControl >& xDialog,
133 const css::uno::Reference< css::frame::XModel >& xModel,
134 double fOffsetX, double fOffsetY ) throw (css::uno::RuntimeException);
136 private:
137 ScVbaControlFactory();
138 ~ScVbaControlFactory();
141 #endif//SC_VBA_CONTROL_HXX
143 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */