android: Update app-specific/MIME type icons
[LibreOffice.git] / basctl / source / basicide / unomodel.cxx
blob5d3946b426c6c730e1e832aeb2796df1a2857e90
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 ::com::sun::star;
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::lang;
40 SIDEModel::SIDEModel( SfxObjectShell *pObjSh )
41 : SfxBaseModel(pObjSh)
45 SIDEModel::~SIDEModel()
49 uno::Any SAL_CALL SIDEModel::queryInterface( const uno::Type& rType )
51 uno::Any aRet = ::cppu::queryInterface ( rType,
52 // OWeakObject interfaces
53 static_cast< XInterface* >( static_cast< OWeakObject* >( this ) ),
54 static_cast< XWeak* > ( this ),
55 static_cast< XServiceInfo* > ( this ) );
56 if (!aRet.hasValue())
57 aRet = SfxBaseModel::queryInterface ( rType );
58 return aRet;
61 void SAL_CALL SIDEModel::acquire() noexcept
63 SolarMutexGuard aGuard;
64 OWeakObject::acquire();
67 void SAL_CALL SIDEModel::release() noexcept
69 SolarMutexGuard aGuard;
70 OWeakObject::release();
73 uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( )
75 return comphelper::concatSequences(
76 SfxBaseModel::getTypes(),
77 uno::Sequence { cppu::UnoType<XServiceInfo>::get() });
80 OUString SIDEModel::getImplementationName()
82 return "com.sun.star.comp.basic.BasicIDE";
85 sal_Bool SIDEModel::supportsService(const OUString& rServiceName)
87 return cppu::supportsService(this, rServiceName);
90 uno::Sequence< OUString > SIDEModel::getSupportedServiceNames()
92 return { "com.sun.star.script.BasicIDE" };
95 // XStorable
96 void SAL_CALL SIDEModel::store()
98 notImplemented();
101 void SAL_CALL SIDEModel::storeAsURL( const OUString&, const uno::Sequence< beans::PropertyValue >& )
103 notImplemented();
106 void SAL_CALL SIDEModel::storeToURL( const OUString&,
107 const uno::Sequence< beans::PropertyValue >& )
109 notImplemented();
112 void SIDEModel::notImplemented()
114 throw io::IOException("Can't store IDE model" );
117 } // namespace basctl
119 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
120 com_sun_star_comp_basic_BasicID_get_implementation(
121 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
123 SolarMutexGuard aGuard;
124 basctl::EnsureIde();
125 SfxObjectShell* pShell = new basctl::DocShell();
126 auto pModel = pShell->GetModel();
127 pModel->acquire();
128 return pModel.get();
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */