LibreOffice Module sw (master) 1
vbaaddin.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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#include "vbaaddin.hxx"
20#include <tools/urlobj.hxx>
21#include <osl/file.hxx>
22#include <utility>
23
24using namespace ::ooo::vba;
25using namespace ::com::sun::star;
26
27SwVbaAddin::SwVbaAddin( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, OUString aFileURL ) :
28 SwVbaAddin_BASE( rParent, rContext ), msFileURL(std::move( aFileURL )), mbInstalled( true )
29{
30}
31
33{
34}
35
36OUString SAL_CALL SwVbaAddin::getName()
37{
38 OUString sName;
40 ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
41 return sName;
42}
43
44void SAL_CALL
45SwVbaAddin::setName( const OUString& )
46{
47 throw uno::RuntimeException(" Fail to set name" );
48}
49
50OUString SAL_CALL SwVbaAddin::getPath()
51{
53 aURL.CutLastName();
54 return aURL.GetURLPath();
55}
56
58{
59 return true;
60}
61
63{
64 return mbInstalled;
65}
66
67void SAL_CALL SwVbaAddin::setInstalled( sal_Bool _installed )
68{
69 if( bool(_installed) != mbInstalled )
70 {
71 mbInstalled = _installed;
72 // TODO: should call AutoExec and AutoExit etc.
73 }
74}
75
76OUString
78{
79 return "SwVbaAddin";
80}
81
82uno::Sequence< OUString >
84{
85 static uno::Sequence< OUString > const aServiceNames
86 {
87 "ooo.vba.word.Addin"
88 };
89 return aServiceNames;
90}
91
92/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL getPath() override
Definition: vbaaddin.cxx:50
virtual css::uno::Sequence< OUString > getServiceNames() override
Definition: vbaaddin.cxx:83
virtual sal_Bool SAL_CALL getAutoload() override
Definition: vbaaddin.cxx:57
bool mbInstalled
Definition: vbaaddin.hxx:31
virtual ~SwVbaAddin() override
Definition: vbaaddin.cxx:32
virtual sal_Bool SAL_CALL getInstalled() override
Definition: vbaaddin.cxx:62
virtual OUString SAL_CALL getName() override
Definition: vbaaddin.cxx:36
virtual OUString getServiceImplName() override
Definition: vbaaddin.cxx:77
OUString msFileURL
Definition: vbaaddin.hxx:30
virtual void SAL_CALL setInstalled(sal_Bool _installed) override
Definition: vbaaddin.cxx:67
SwVbaAddin(const css::uno::Reference< ooo::vba::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, OUString aFileURL)
Definition: vbaaddin.cxx:27
virtual void SAL_CALL setName(const OUString &_name) override
Definition: vbaaddin.cxx:45
URL aURL
Sequence< OUString > aServiceNames
OUString sName
unsigned char sal_Bool