Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / basctl / source / basicide / unomodel.cxx
blobb85090a048339c0906c6112ecec6fb0ac4745625
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 <sfx2/objsh.hxx>
25 #include <vcl/svapp.hxx>
27 #include "unomodel.hxx"
29 namespace basctl
32 using namespace ::cppu;
33 using namespace ::std;
34 using namespace ::com::sun::star;
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::lang;
38 SIDEModel::SIDEModel( SfxObjectShell *pObjSh )
39 : SfxBaseModel(pObjSh)
43 SIDEModel::~SIDEModel()
47 uno::Any SAL_CALL SIDEModel::queryInterface( const uno::Type& rType )
49 uno::Any aRet = ::cppu::queryInterface ( rType,
50 // OWeakObject interfaces
51 static_cast< XInterface* >( static_cast< OWeakObject* >( this ) ),
52 static_cast< XWeak* > ( this ),
53 static_cast< XServiceInfo* > ( this ) );
54 if (!aRet.hasValue())
55 aRet = SfxBaseModel::queryInterface ( rType );
56 return aRet;
59 void SAL_CALL SIDEModel::acquire() throw()
61 SolarMutexGuard aGuard;
62 OWeakObject::acquire();
65 void SAL_CALL SIDEModel::release() throw()
67 SolarMutexGuard aGuard;
68 OWeakObject::release();
71 uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( )
73 uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes();
74 sal_Int32 nLen = aTypes.getLength();
75 aTypes.realloc(nLen + 1);
76 uno::Type* pTypes = aTypes.getArray();
77 pTypes[nLen++] = cppu::UnoType<XServiceInfo>::get();
79 return aTypes;
82 OUString SIDEModel::getImplementationName()
84 return getImplementationName_Static();
87 OUString SIDEModel::getImplementationName_Static()
89 return OUString( "com.sun.star.comp.basic.BasicIDE" );
92 sal_Bool SIDEModel::supportsService(const OUString& rServiceName)
94 return cppu::supportsService(this, rServiceName);
96 uno::Sequence< OUString > SIDEModel::getSupportedServiceNames()
98 return getSupportedServiceNames_Static();
101 uno::Sequence< OUString > SIDEModel::getSupportedServiceNames_Static()
103 return { "com.sun.star.script.BasicIDE" };
106 uno::Reference< uno::XInterface > SIDEModel_createInstance(
107 const uno::Reference< lang::XMultiServiceFactory > & )
109 SolarMutexGuard aGuard;
110 EnsureIde();
111 SfxObjectShell* pShell = new DocShell();
112 return uno::Reference< uno::XInterface >( pShell->GetModel() );
115 // XStorable
116 void SAL_CALL SIDEModel::store()
118 notImplemented();
121 void SAL_CALL SIDEModel::storeAsURL( const OUString&, const uno::Sequence< beans::PropertyValue >& )
123 notImplemented();
126 void SAL_CALL SIDEModel::storeToURL( const OUString&,
127 const uno::Sequence< beans::PropertyValue >& )
129 notImplemented();
132 void SIDEModel::notImplemented()
134 throw io::IOException("Can't store IDE model" );
137 } // namespace basctl
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */