LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / basctl / source / basicide / unomodel.cxx
blob4a9ee759f06017f65169614107308a4de4d9be36
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 .
21 #include "basdoc.hxx"
22 #include <iderdll.hxx>
23 #include <com/sun/star/io/IOException.hpp>
24 #include <comphelper/sequence.hxx>
25 #include <cppuhelper/queryinterface.hxx>
26 #include <cppuhelper/supportsservice.hxx>
27 #include <sfx2/objsh.hxx>
28 #include <vcl/svapp.hxx>
30 #include "unomodel.hxx"
32 namespace basctl
35 using namespace ::cppu;
36 using namespace ::std;
37 using namespace ::com::sun::star;
38 using namespace ::com::sun::star::uno;
39 using namespace ::com::sun::star::lang;
41 SIDEModel::SIDEModel( SfxObjectShell *pObjSh )
42 : SfxBaseModel(pObjSh)
46 SIDEModel::~SIDEModel()
50 uno::Any SAL_CALL SIDEModel::queryInterface( const uno::Type& rType )
52 uno::Any aRet = ::cppu::queryInterface ( rType,
53 // OWeakObject interfaces
54 static_cast< XInterface* >( static_cast< OWeakObject* >( this ) ),
55 static_cast< XWeak* > ( this ),
56 static_cast< XServiceInfo* > ( this ) );
57 if (!aRet.hasValue())
58 aRet = SfxBaseModel::queryInterface ( rType );
59 return aRet;
62 void SAL_CALL SIDEModel::acquire() noexcept
64 SolarMutexGuard aGuard;
65 OWeakObject::acquire();
68 void SAL_CALL SIDEModel::release() noexcept
70 SolarMutexGuard aGuard;
71 OWeakObject::release();
74 uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( )
76 return comphelper::concatSequences(
77 SfxBaseModel::getTypes(),
78 uno::Sequence { cppu::UnoType<XServiceInfo>::get() });
81 OUString SIDEModel::getImplementationName()
83 return "com.sun.star.comp.basic.BasicIDE";
86 sal_Bool SIDEModel::supportsService(const OUString& rServiceName)
88 return cppu::supportsService(this, rServiceName);
91 uno::Sequence< OUString > SIDEModel::getSupportedServiceNames()
93 return { "com.sun.star.script.BasicIDE" };
96 // XStorable
97 void SAL_CALL SIDEModel::store()
99 notImplemented();
102 void SAL_CALL SIDEModel::storeAsURL( const OUString&, const uno::Sequence< beans::PropertyValue >& )
104 notImplemented();
107 void SAL_CALL SIDEModel::storeToURL( const OUString&,
108 const uno::Sequence< beans::PropertyValue >& )
110 notImplemented();
113 void SIDEModel::notImplemented()
115 throw io::IOException("Can't store IDE model" );
118 } // namespace basctl
120 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
121 com_sun_star_comp_basic_BasicID_get_implementation(
122 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
124 SolarMutexGuard aGuard;
125 basctl::EnsureIde();
126 SfxObjectShell* pShell = new basctl::DocShell();
127 auto pModel = pShell->GetModel();
128 pModel->acquire();
129 return pModel.get();
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */