update dev300-m58
[ooovba.git] / sc / source / ui / vba / vbaeventshelper.hxx
blob78037afda68bd3a86e357d8610911c240b1a6bc6
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: vbaeventshelper.hxx,v $
7 * $Revision: 1.0 $
9 * last change: $Author: vg $ $Date: 2007/12/07 10:42:26 $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA
34 ************************************************************************/
36 #ifndef SC_VBAEVENTS_HXX
37 #define SC_VBAEVENTS_HXX
39 #include "document.hxx"
40 #include <cppuhelper/implbase1.hxx>
41 #include <com/sun/star/document/VbaEventId.hpp>
42 #include <com/sun/star/document/XVbaEventsHelper.hpp>
43 #include <com/sun/star/awt/XWindowListener.hpp>
44 #include "excelvbahelper.hxx"
46 #define INVALID_TAB -1
48 typedef ::cppu::WeakImplHelper1< com::sun::star::document::XVbaEventsHelper > VBAWorkbookEvent_BASE;
50 class VbaEventsListener;
51 class ScDocShell;
52 class ScVbaEventsHelper : public VBAWorkbookEvent_BASE
54 private:
55 ScDocument* pDoc;
56 ScDocShell* pDocShell;
57 css::uno::Reference< css::uno::XComponentContext > m_xContext;
58 css::uno::Reference< css::awt::XWindowListener > m_xVbaEventsListener;
59 sal_Bool mbOpened;
60 sal_Bool mbIgnoreEvents;
62 String getSheetModuleName( SCTAB nTab );
63 css::uno::Any createWorkSheet( SfxObjectShell* pShell, SCTAB nTab );
64 css::uno::Any createRange( const css::uno::Any& aRange );
65 css::uno::Any createHyperlink( const css::uno::Any& rCell );
66 css::uno::Any createWindow( SfxObjectShell* pShell );
67 SCTAB getTabFromArgs( const css::uno::Sequence< css::uno::Any > aArgs, const sal_Int32 nPos = 0 );
68 rtl::OUString getEventName( const sal_Int32 nEventId );
69 rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab = INVALID_TAB );
70 sal_Bool processVbaEvent( const sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs, const SCTAB nTab = INVALID_TAB );
72 public:
73 ScVbaEventsHelper( ScDocument* pDocument ):pDoc( pDocument ), mbOpened( sal_False ){};
74 ScVbaEventsHelper( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext );
75 ~ScVbaEventsHelper();
76 ScDocument* getDocument() { return pDoc; };
77 ScDocShell* getDocumentShell() { return pDocShell; };
78 // XVBAWorkbookEventHelper
79 virtual sal_Bool SAL_CALL ProcessCompatibleVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
80 virtual void SAL_CALL setIgnoreEvents( ::sal_Bool _ignoreevents ) throw (css::uno::RuntimeException);
81 virtual ::sal_Bool SAL_CALL getIgnoreEvents() throw (css::uno::RuntimeException);
84 #endif