1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 INCLUDED_SW_SOURCE_UI_VBA_VBAAPPLICATION_HXX
20 #define INCLUDED_SW_SOURCE_UI_VBA_VBAAPPLICATION_HXX
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>
32 #include <vbahelper/vbaapplicationbase.hxx>
33 #include <cppuhelper/implbase.hxx>
34 #include <rtl/ref.hxx>
36 #include "vbawindow.hxx"
38 typedef cppu::ImplInheritanceHelper
< VbaApplicationBase
, ooo::vba::word::XApplication
, ooo::vba::XSinkCaller
> SwVbaApplication_BASE
;
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.)
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.
48 class SwVbaApplication
: public SwVbaApplication_BASE
50 std::vector
<css::uno::Reference
< ooo::vba::XSink
>> mvSinks
;
53 explicit SwVbaApplication( css::uno::Reference
< css::uno::XComponentContext
>& xContext
);
54 virtual ~SwVbaApplication() override
;
56 sal_uInt32
AddSink( const css::uno::Reference
< ooo::vba::XSink
>& xSink
);
57 void RemoveSink( sal_uInt32 nNumber
);
59 rtl::Reference
<SwVbaWindow
> getActiveSwVbaWindow();
60 css::uno::Reference
< css::uno::XComponentContext
> const & getContext() const;
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
;
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
;
111 virtual OUString SAL_CALL
getIID() override
;
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
;
119 virtual OUString
getServiceImplName() override
;
120 virtual css::uno::Sequence
<OUString
> getServiceNames() override
;
123 virtual void SAL_CALL
CallSinks( const OUString
& Method
, css::uno::Sequence
< css::uno::Any
>& Arguments
) override
;
125 virtual css::uno::Reference
< css::frame::XModel
> getCurrentDocument() override
;
127 #endif // INCLUDED_SW_SOURCE_UI_VBA_VBAAPPLICATION_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */