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>
34#include <rtl/ref.hxx>
35
36#include "vbawindow.hxx"
37
38typedef cppu::ImplInheritanceHelper< VbaApplicationBase, ooo::vba::word::XApplication, ooo::vba::XSinkCaller > SwVbaApplication_BASE;
39
40// This class is currently not a singleton. One instance is created per document with (potential?)
41// StarBasic code in it, I think, and a shared one for all Automation clients connected to the
42// ooo::vba::word::Application (Writer.Application) service. (Of course it probably is not common to
43// have several Automation clients at once.)
44
45// Should it be a true singleton? Hard to say. Anyway, it is actually the SwVbaGlobals class that
46// should be a singleton in that case, I think.
47
49{
50 std::vector<css::uno::Reference< ooo::vba::XSink >> mvSinks;
51
52public:
53 explicit SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& xContext );
54 virtual ~SwVbaApplication() override;
55
56 sal_uInt32 AddSink( const css::uno::Reference< ooo::vba::XSink >& xSink );
57 void RemoveSink( sal_uInt32 nNumber );
58
60 css::uno::Reference< css::uno::XComponentContext > const & getContext() const;
61
62 // XApplication
63 virtual OUString SAL_CALL getName() override;
64 virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() override;
65 virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() override;
66 virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() override;
67 virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() override;
68 virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() override;
69 virtual css::uno::Reference< ooo::vba::word::XWordBasic > SAL_CALL getWordBasic() override;
70 virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) override;
71 virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) override;
72 virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) override;
73 virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) override;
74 virtual css::uno::Any SAL_CALL ListGalleries( const css::uno::Any& aIndex ) override;
75 virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() override;
76 virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) override;
77 virtual sal_Int32 SAL_CALL getEnableCancelKey() override;
78 virtual void SAL_CALL setEnableCancelKey( sal_Int32 _enableCancelKey ) override;
79 virtual sal_Int32 SAL_CALL getWindowState() override;
80 virtual void SAL_CALL setWindowState( sal_Int32 _windowstate ) override;
81 virtual sal_Int32 SAL_CALL getWidth() override;
82 virtual void SAL_CALL setWidth( sal_Int32 _width ) override;
83 virtual sal_Int32 SAL_CALL getHeight() override;
84 virtual void SAL_CALL setHeight( sal_Int32 _height ) override;
85 virtual sal_Int32 SAL_CALL getLeft() override;
86 virtual void SAL_CALL setLeft( sal_Int32 _left ) override;
87 virtual sal_Int32 SAL_CALL getTop() override;
88 virtual void SAL_CALL setTop( sal_Int32 _top ) override;
89 virtual OUString SAL_CALL getStatusBar() override;
90 virtual void SAL_CALL setStatusBar( const OUString& _statusbar ) override;
91 virtual css::uno::Any SAL_CALL getCustomizationContext() override;
92 virtual void SAL_CALL setCustomizationContext( const css::uno::Any& _customizationcontext ) override;
93 virtual float SAL_CALL CentimetersToPoints( float Centimeters ) override;
94 virtual float SAL_CALL PointsToCentimeters( float Points ) override;
95 virtual float SAL_CALL PixelsToPoints( float Pixels, ::sal_Bool fVertical ) override;
96 virtual float SAL_CALL PointsToPixels( float Pixels, ::sal_Bool fVertical ) override;
97 virtual float SAL_CALL InchesToPoints( float Inches ) override;
98 virtual float SAL_CALL PointsToInches( float Points ) override;
99 virtual float SAL_CALL MillimetersToPoints( float Millimeters ) override;
100 virtual float SAL_CALL PointsToMillimeters( float Points ) override;
101 virtual float SAL_CALL PicasToPoints( float Picas ) override;
102 virtual float SAL_CALL PointsToPicas( float Points ) override;
103
104
105
106 virtual void SAL_CALL ShowMe() override;
107 virtual void SAL_CALL Resize( sal_Int32 Width, sal_Int32 Height ) override;
108 virtual void SAL_CALL Move( sal_Int32 Left, sal_Int32 Top ) override;
109
110 // XInterfaceWithIID
111 virtual OUString SAL_CALL getIID() override;
112
113 // XConnectable
114 virtual OUString SAL_CALL GetIIDForClassItselfNotCoclass() override;
115 virtual ov::TypeAndIID SAL_CALL GetConnectionPoint() override;
116 virtual css::uno::Reference<ov::XConnectionPoint> SAL_CALL FindConnectionPoint() override;
117
118 // XHelperInterface
119 virtual OUString getServiceImplName() override;
120 virtual css::uno::Sequence<OUString> getServiceNames() override;
121
122 // XSinkCaller
123 virtual void SAL_CALL CallSinks( const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments ) override;
124
125 virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override;
126};
127#endif // INCLUDED_SW_SOURCE_UI_VBA_VBAAPPLICATION_HXX
128
129/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL setHeight(sal_Int32 _height) override
virtual OUString SAL_CALL getName() override
virtual css::uno::Any SAL_CALL ListGalleries(const css::uno::Any &aIndex) override
virtual OUString getServiceImplName() override
virtual css::uno::Sequence< OUString > getServiceNames() override
virtual sal_Int32 SAL_CALL getHeight() override
virtual void SAL_CALL CallSinks(const OUString &Method, css::uno::Sequence< css::uno::Any > &Arguments) override
virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() override
virtual sal_Int32 SAL_CALL getLeft() override
virtual css::uno::Any SAL_CALL Addins(const css::uno::Any &aIndex) override
virtual float SAL_CALL CentimetersToPoints(float Centimeters) override
virtual void SAL_CALL setEnableCancelKey(sal_Int32 _enableCancelKey) override
sal_uInt32 AddSink(const css::uno::Reference< ooo::vba::XSink > &xSink)
virtual sal_Int32 SAL_CALL getTop() override
virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() override
virtual css::uno::Reference< ov::word::XWindow > SAL_CALL getActiveWindow() override
virtual sal_Int32 SAL_CALL getEnableCancelKey() override
std::vector< css::uno::Reference< ooo::vba::XSink > > mvSinks
virtual OUString SAL_CALL GetIIDForClassItselfNotCoclass() override
virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() override
virtual float SAL_CALL PointsToPixels(float Pixels, ::sal_Bool fVertical) override
virtual css::uno::Any SAL_CALL Documents(const css::uno::Any &aIndex) override
virtual OUString SAL_CALL getStatusBar() override
virtual void SAL_CALL setLeft(sal_Int32 _left) override
void RemoveSink(sal_uInt32 nNumber)
virtual sal_Int32 SAL_CALL getWindowState() override
virtual OUString SAL_CALL getIID() override
virtual float SAL_CALL PointsToMillimeters(float Points) override
virtual void SAL_CALL Resize(sal_Int32 Width, sal_Int32 Height) override
virtual void SAL_CALL ShowMe() override
virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() override
css::uno::Reference< css::uno::XComponentContext > const & getContext() const
virtual float SAL_CALL InchesToPoints(float Inches) override
virtual float SAL_CALL PointsToInches(float Points) override
virtual float SAL_CALL PointsToCentimeters(float Points) override
virtual void SAL_CALL setCustomizationContext(const css::uno::Any &_customizationcontext) override
virtual css::uno::Reference< ov::XConnectionPoint > SAL_CALL FindConnectionPoint() override
virtual void SAL_CALL Move(sal_Int32 Left, sal_Int32 Top) override
virtual float SAL_CALL PointsToPicas(float Points) override
virtual void SAL_CALL setDisplayAutoCompleteTips(sal_Bool _displayAutoCompleteTips) override
virtual float SAL_CALL MillimetersToPoints(float Millimeters) override
virtual ov::TypeAndIID SAL_CALL GetConnectionPoint() override
virtual css::uno::Any SAL_CALL Dialogs(const css::uno::Any &aIndex) override
virtual ~SwVbaApplication() override
rtl::Reference< SwVbaWindow > getActiveSwVbaWindow()
virtual sal_Int32 SAL_CALL getWidth() override
virtual float SAL_CALL PixelsToPoints(float Pixels, ::sal_Bool fVertical) override
virtual css::uno::Any SAL_CALL CommandBars(const css::uno::Any &aIndex) override
virtual css::uno::Reference< css::frame::XModel > getCurrentDocument() override
SwVbaApplication(css::uno::Reference< css::uno::XComponentContext > &xContext)
virtual css::uno::Reference< ooo::vba::word::XWordBasic > SAL_CALL getWordBasic() override
virtual void SAL_CALL setTop(sal_Int32 _top) override
virtual float SAL_CALL PicasToPoints(float Picas) override
virtual css::uno::Reference< ov::word::XDocument > SAL_CALL getActiveDocument() override
virtual void SAL_CALL setStatusBar(const OUString &_statusbar) override
virtual css::uno::Any SAL_CALL getCustomizationContext() override
virtual void SAL_CALL setWidth(sal_Int32 _width) override
virtual void SAL_CALL setWindowState(sal_Int32 _windowstate) override
std::vector< Point > Points
unsigned char sal_Bool
cppu::ImplInheritanceHelper< VbaApplicationBase, ooo::vba::word::XApplication, ooo::vba::XSinkCaller > SwVbaApplication_BASE