android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / ui / vba / vbaaddin.cxx
blob8fdfb0048008147ef4d600fa4354f25c96cc3aed
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include "vbaaddin.hxx"
20 #include <tools/urlobj.hxx>
21 #include <osl/file.hxx>
22 #include <utility>
24 using namespace ::ooo::vba;
25 using namespace ::com::sun::star;
27 SwVbaAddin::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 )
32 SwVbaAddin::~SwVbaAddin()
36 OUString SAL_CALL SwVbaAddin::getName()
38 OUString sName;
39 INetURLObject aURL( msFileURL );
40 ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName );
41 return sName;
44 void SAL_CALL
45 SwVbaAddin::setName( const OUString& )
47 throw uno::RuntimeException(" Fail to set name" );
50 OUString SAL_CALL SwVbaAddin::getPath()
52 INetURLObject aURL( msFileURL );
53 aURL.CutLastName();
54 return aURL.GetURLPath();
57 sal_Bool SAL_CALL SwVbaAddin::getAutoload()
59 return true;
62 sal_Bool SAL_CALL SwVbaAddin::getInstalled()
64 return mbInstalled;
67 void SAL_CALL SwVbaAddin::setInstalled( sal_Bool _installed )
69 if( bool(_installed) != mbInstalled )
71 mbInstalled = _installed;
72 // TODO: should call AutoExec and AutoExit etc.
76 OUString
77 SwVbaAddin::getServiceImplName()
79 return "SwVbaAddin";
82 uno::Sequence< OUString >
83 SwVbaAddin::getServiceNames()
85 static uno::Sequence< OUString > const aServiceNames
87 "ooo.vba.word.Addin"
89 return aServiceNames;
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */