1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "unomodel.hxx"
22 #include <osl/mutex.hxx>
23 #include <vcl/svapp.hxx>
25 #include <sfx2/docfac.hxx>
26 #include <sfx2/objsh.hxx>
28 #include <iderdll.hxx>
34 using namespace ::cppu
;
35 using namespace ::std
;
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
) throw(uno::RuntimeException
)
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 ) );
57 aRet
= SfxBaseModel::queryInterface ( rType
);
61 void SAL_CALL
SIDEModel::acquire() throw()
63 SolarMutexGuard aGuard
;
64 OWeakObject::acquire();
67 void SAL_CALL
SIDEModel::release() throw()
69 SolarMutexGuard aGuard
;
70 OWeakObject::release();
73 uno::Sequence
< uno::Type
> SAL_CALL
SIDEModel::getTypes( ) throw(uno::RuntimeException
)
75 uno::Sequence
< uno::Type
> aTypes
= SfxBaseModel::getTypes();
76 sal_Int32 nLen
= aTypes
.getLength();
77 aTypes
.realloc(nLen
+ 1);
78 uno::Type
* pTypes
= aTypes
.getArray();
79 pTypes
[nLen
++] = ::getCppuType((Reference
<XServiceInfo
>*)0);
84 OUString
SIDEModel::getImplementationName(void) throw( uno::RuntimeException
)
86 return getImplementationName_Static();
89 OUString
SIDEModel::getImplementationName_Static()
91 return OUString( "com.sun.star.comp.basic.BasicIDE" );
94 sal_Bool
SIDEModel::supportsService(const OUString
& rServiceName
) throw( uno::RuntimeException
)
96 return rServiceName
== OUString( "com.sun.star.script.BasicIDE" );
98 uno::Sequence
< OUString
> SIDEModel::getSupportedServiceNames(void) throw( uno::RuntimeException
)
100 return getSupportedServiceNames_Static();
103 uno::Sequence
< OUString
> SIDEModel::getSupportedServiceNames_Static(void)
105 uno::Sequence
< OUString
> aRet(1);
106 OUString
* pArray
= aRet
.getArray();
107 pArray
[0] = "com.sun.star.script.BasicIDE" ;
111 uno::Reference
< uno::XInterface
> SAL_CALL
SIDEModel_createInstance(
112 const uno::Reference
< lang::XMultiServiceFactory
> & ) throw( uno::Exception
)
114 SolarMutexGuard aGuard
;
116 SfxObjectShell
* pShell
= new DocShell();
117 return uno::Reference
< uno::XInterface
>( pShell
->GetModel() );
121 void SAL_CALL
SIDEModel::store() throw (io::IOException
, uno::RuntimeException
)
126 void SAL_CALL
SIDEModel::storeAsURL( const OUString
&, const uno::Sequence
< beans::PropertyValue
>& )
127 throw (io::IOException
, uno::RuntimeException
)
132 void SAL_CALL
SIDEModel::storeToURL( const OUString
&,
133 const uno::Sequence
< beans::PropertyValue
>& )
134 throw (io::IOException
, uno::RuntimeException
)
139 void SIDEModel::notImplemented() throw ( io::IOException
)
141 throw io::IOException("Can't store IDE model", uno::Reference
< uno::XInterface
>() );
144 } // namespace basctl
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */