update emoji autocorrect entries from po-files
[LibreOffice.git] / include / vbahelper / vbaaccesshelper.hxx
blob362c2b277248174af4ef7eb98b20e1ec2ec6b4ad
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 #ifndef INCLUDED_VBAHELPER_VBAACCESSHELPER_HXX
20 #define INCLUDED_VBAHELPER_VBAACCESSHELPER_HXX
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include <basic/basmgr.hxx>
24 #include <sfx2/objsh.hxx>
25 #include <sfx2/docfilt.hxx>
26 #include <sfx2/docfile.hxx>
27 //#define VBAHELPER_DLLIMPLEMENTATION
28 #include <vbahelper/vbadllapi.h>
29 #include <memory>
31 namespace ooo
33 namespace vba
36 VBAHELPER_DLLPRIVATE inline css::uno::Reference< css::lang::XMultiServiceFactory > getVBAServiceFactory( SfxObjectShell* pShell )
38 css::uno::Any aUnoVar;
39 if ( !pShell || ! pShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aUnoVar ) )
40 throw css::lang::IllegalArgumentException();
41 css::uno::Reference< css::lang::XMultiServiceFactory > xVBAFactory( aUnoVar, css::uno::UNO_QUERY_THROW );
42 return xVBAFactory;
45 VBAHELPER_DLLPRIVATE inline css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::Exception)
47 OSL_PRECOND( pShell, "createVBAUnoAPIService: no shell!" );
48 OUString sVarName( OUString::createFromAscii( _pAsciiName ) );
49 css::uno::Reference< css::uno::XInterface > xIf = getVBAServiceFactory( pShell )->createInstanceWithArguments( sVarName, aArgs );
50 return xIf;
54 VBAHELPER_DLLPRIVATE inline bool isAlienDoc( SfxObjectShell& rDocShell, const char* pMimeType )
56 bool bRes( false );
57 const SfxMedium *pMedium = rDocShell.GetMedium();
58 const SfxFilter *pFilt = pMedium ? pMedium->GetFilter() : NULL;
59 if ( pFilt && pFilt->IsAlienFormat() )
60 bRes = pFilt->GetMimeType().equalsAscii( pMimeType );
61 return bRes;
63 VBAHELPER_DLLPRIVATE inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); }
64 //VBAHELPER_DLLPRIVATE inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
65 // word seems to return an erroneous mime type :-/ "application/msword" not consistent with the excel one
66 VBAHELPER_DLLPRIVATE inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/msword" ); }
68 } // openoffice
69 } // org
71 #endif
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */