LibreOffice Module sw (master)  1
vbaapplication.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 #ifndef INCLUDED_SW_SOURCE_UI_VBA_VBAAPPLICATION_HXX
20 #define INCLUDED_SW_SOURCE_UI_VBA_VBAAPPLICATION_HXX
21 
22 #include <vector>
23 
24 #include <ooo/vba/XSink.hpp>
25 #include <ooo/vba/XSinkCaller.hpp>
26 #include <ooo/vba/word/XApplication.hpp>
27 #include <ooo/vba/word/XDocument.hpp>
28 #include <ooo/vba/word/XWindow.hpp>
29 #include <ooo/vba/word/XSystem.hpp>
30 #include <ooo/vba/word/XOptions.hpp>
31 #include <ooo/vba/word/XSelection.hpp>
33 #include <cppuhelper/implbase.hxx>
34 
35 #include "vbawindow.hxx"
36 
37 typedef cppu::ImplInheritanceHelper< VbaApplicationBase, ooo::vba::word::XApplication, ooo::vba::XSinkCaller > SwVbaApplication_BASE;
38 
39 // This class is currently not a singleton. One instance is created per document with (potential?)
40 // StarBasic code in it, I think, and a shared one for all Automation clients connected to the
41 // ooo::vba::word::Application (Writer.Application) service. (Of course it probably is not common to
42 // have several Automation clients at once.)
43 
44 // Should it be a true singleton? Hard to say. Anyway, it is actually the SwVbaGlobals class that
45 // should be a singleton in that case, I think.
46 
48 {
49  std::vector<css::uno::Reference< ooo::vba::XSink >> mvSinks;
50 
51 public:
52  explicit SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& xContext );
53  virtual ~SwVbaApplication() override;
54 
55  sal_uInt32 AddSink( const css::uno::Reference< ooo::vba::XSink >& xSink );
56  void RemoveSink( sal_uInt32 nNumber );
57 
59  css::uno::Reference< css::uno::XComponentContext > const & getContext() const;
60 
61  // XApplication
62  virtual OUString SAL_CALL getName() override;
63  virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() override;
64  virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() override;
65  virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() override;
66  virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() override;
67  virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() override;
68  virtual css::uno::Reference< ooo::vba::word::XWordBasic > SAL_CALL getWordBasic() override;
69  virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) override;
70  virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) override;
71  virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) override;
72  virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) override;
73  virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) override;
74  virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() override;
75  virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) override;
76  virtual sal_Int32 SAL_CALL getEnableCancelKey() override;
77  virtual void SAL_CALL setEnableCancelKey( sal_Int32 _enableCancelKey ) override;
78  virtual sal_Int32 SAL_CALL getWindowState() override;
79  virtual void SAL_CALL setWindowState( sal_Int32 _windowstate ) override;
80  virtual sal_Int32 SAL_CALL getWidth() override;
81  virtual void SAL_CALL setWidth( sal_Int32 _width ) override;
82  virtual sal_Int32 SAL_CALL getHeight() override;
83  virtual void SAL_CALL setHeight( sal_Int32 _height ) override;
84  virtual sal_Int32 SAL_CALL getLeft() override;
85  virtual void SAL_CALL setLeft( sal_Int32 _left ) override;
86  virtual sal_Int32 SAL_CALL getTop() override;
87  virtual void SAL_CALL setTop( sal_Int32 _top ) override;
88  virtual OUString SAL_CALL getStatusBar() override;
89  virtual void SAL_CALL setStatusBar( const OUString& _statusbar ) override;
90  virtual css::uno::Any SAL_CALL getCustomizationContext() override;
91  virtual void SAL_CALL setCustomizationContext( const css::uno::Any& _customizationcontext ) override;
92  virtual float SAL_CALL CentimetersToPoints( float Centimeters ) override;
93  virtual void SAL_CALL ShowMe() override;
94  virtual void SAL_CALL Resize( sal_Int32 Width, sal_Int32 Height ) override;
95  virtual void SAL_CALL Move( sal_Int32 Left, sal_Int32 Top ) override;
96 
97  // XInterfaceWithIID
98  virtual OUString SAL_CALL getIID() override;
99 
100  // XConnectable
101  virtual OUString SAL_CALL GetIIDForClassItselfNotCoclass() override;
102  virtual ov::TypeAndIID SAL_CALL GetConnectionPoint() override;
103  virtual css::uno::Reference<ov::XConnectionPoint> SAL_CALL FindConnectionPoint() override;
104 
105  // XHelperInterface
106  virtual OUString getServiceImplName() override;
107  virtual css::uno::Sequence<OUString> getServiceNames() override;
108 
109  // XSinkCaller
110  virtual void SAL_CALL CallSinks( const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments ) override;
111 
112  virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override;
113 };
114 #endif // INCLUDED_SW_SOURCE_UI_VBA_VBAAPPLICATION_HXX
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL setStatusBar(const OUString &_statusbar) override
SwVbaApplication(css::uno::Reference< css::uno::XComponentContext > &xContext)
virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() override
virtual void SAL_CALL ShowMe() override
virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() override
virtual css::uno::Reference< ov::XConnectionPoint > SAL_CALL FindConnectionPoint() override
virtual ~SwVbaApplication() override
sal_uInt32 AddSink(const css::uno::Reference< ooo::vba::XSink > &xSink)
virtual void SAL_CALL setWindowState(sal_Int32 _windowstate) override
virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() override
virtual css::uno::Reference< ooo::vba::word::XWordBasic > SAL_CALL getWordBasic() override
virtual sal_Int32 SAL_CALL getWindowState() override
std::vector< css::uno::Reference< ooo::vba::XSink > > mvSinks
virtual OUString getServiceImplName() override
virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override
virtual ov::TypeAndIID SAL_CALL GetConnectionPoint() override
virtual sal_Int32 SAL_CALL getLeft() override
virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() override
virtual void SAL_CALL setDisplayAutoCompleteTips(sal_Bool _displayAutoCompleteTips) override
cppu::ImplInheritanceHelper< VbaApplicationBase, ooo::vba::word::XApplication, ooo::vba::XSinkCaller > SwVbaApplication_BASE
virtual void SAL_CALL setEnableCancelKey(sal_Int32 _enableCancelKey) override
virtual css::uno::Any SAL_CALL Documents(const css::uno::Any &aIndex) override
virtual css::uno::Any SAL_CALL CommandBars(const css::uno::Any &aIndex) override
SwVbaWindow * getActiveSwVbaWindow()
virtual void SAL_CALL CallSinks(const OUString &Method, css::uno::Sequence< css::uno::Any > &Arguments) override
virtual void SAL_CALL setWidth(sal_Int32 _width) override
virtual OUString SAL_CALL GetIIDForClassItselfNotCoclass() override
virtual OUString SAL_CALL getIID() override
virtual sal_Int32 SAL_CALL getHeight() override
virtual css::uno::Any SAL_CALL ListGalleries(const css::uno::Any &aIndex) override
virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() override
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual css::uno::Any SAL_CALL Dialogs(const css::uno::Any &aIndex) override
virtual float SAL_CALL CentimetersToPoints(float Centimeters) override
virtual sal_Int32 SAL_CALL getWidth() override
unsigned char sal_Bool
virtual css::uno::Any SAL_CALL getCustomizationContext() override
virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() override
virtual OUString SAL_CALL getStatusBar() override
virtual void SAL_CALL setHeight(sal_Int32 _height) override
virtual void SAL_CALL Resize(sal_Int32 Width, sal_Int32 Height) override
virtual sal_Int32 SAL_CALL getTop() override
virtual sal_Int32 SAL_CALL getEnableCancelKey() override
void RemoveSink(sal_uInt32 nNumber)
virtual void SAL_CALL Move(sal_Int32 Left, sal_Int32 Top) override
virtual OUString SAL_CALL getName() override
css::uno::Reference< css::uno::XComponentContext > const & getContext() const
virtual void SAL_CALL setCustomizationContext(const css::uno::Any &_customizationcontext) override
virtual void SAL_CALL setLeft(sal_Int32 _left) override
virtual css::uno::Any SAL_CALL Addins(const css::uno::Any &aIndex) override
virtual void SAL_CALL setTop(sal_Int32 _top) override