Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : :
21 : : #include "unomodel.hxx"
22 : : #include <osl/mutex.hxx>
23 : : #include <vcl/svapp.hxx>
24 : :
25 : : #include <sfx2/docfac.hxx>
26 : : #include <sfx2/objsh.hxx>
27 : :
28 : : #include <iderdll.hxx>
29 : : #include <basdoc.hxx>
30 : :
31 : : using ::rtl::OUString;
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;
37 : :
38 : 0 : SIDEModel::SIDEModel( SfxObjectShell *pObjSh )
39 : 0 : : SfxBaseModel(pObjSh)
40 : : {
41 : 0 : }
42 : :
43 : 0 : SIDEModel::~SIDEModel()
44 : : {
45 : 0 : }
46 : :
47 : 0 : uno::Any SAL_CALL SIDEModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
48 : : {
49 : : uno::Any aRet = ::cppu::queryInterface ( rType,
50 : : // OWeakObject interfaces
51 : : static_cast< XInterface* >( static_cast< OWeakObject* >( this ) ),
52 : : static_cast< XWeak* > ( this ),
53 : 0 : static_cast< XServiceInfo* > ( this ) );
54 : 0 : if (!aRet.hasValue())
55 : 0 : aRet = SfxBaseModel::queryInterface ( rType );
56 : 0 : return aRet;
57 : : }
58 : :
59 : 0 : void SAL_CALL SIDEModel::acquire() throw()
60 : : {
61 : 0 : SolarMutexGuard aGuard;
62 : 0 : OWeakObject::acquire();
63 : 0 : }
64 : :
65 : 0 : void SAL_CALL SIDEModel::release() throw()
66 : : {
67 : 0 : SolarMutexGuard aGuard;
68 : 0 : OWeakObject::release();
69 : 0 : }
70 : :
71 : 0 : uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( ) throw(uno::RuntimeException)
72 : : {
73 : 0 : uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes();
74 : 0 : sal_Int32 nLen = aTypes.getLength();
75 : 0 : aTypes.realloc(nLen + 1);
76 : 0 : uno::Type* pTypes = aTypes.getArray();
77 : 0 : pTypes[nLen++] = ::getCppuType((Reference<XServiceInfo>*)0);
78 : :
79 : 0 : return aTypes;
80 : : }
81 : :
82 : 0 : OUString SIDEModel::getImplementationName(void) throw( uno::RuntimeException )
83 : : {
84 : 0 : return getImplementationName_Static();
85 : : }
86 : :
87 : 0 : ::rtl::OUString SIDEModel::getImplementationName_Static()
88 : : {
89 : 0 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.basic.BasicIDE" ));
90 : : }
91 : :
92 : 0 : sal_Bool SIDEModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
93 : : {
94 : 0 : return rServiceName == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ));
95 : : }
96 : 0 : uno::Sequence< OUString > SIDEModel::getSupportedServiceNames(void) throw( uno::RuntimeException )
97 : : {
98 : 0 : return getSupportedServiceNames_Static();
99 : : }
100 : :
101 : 0 : uno::Sequence< OUString > SIDEModel::getSupportedServiceNames_Static(void)
102 : : {
103 : 0 : uno::Sequence< OUString > aRet(1);
104 : 0 : OUString* pArray = aRet.getArray();
105 : 0 : pArray[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ));
106 : 0 : return aRet;
107 : : }
108 : :
109 : 0 : uno::Reference< uno::XInterface > SAL_CALL SIDEModel_createInstance(
110 : : const uno::Reference< lang::XMultiServiceFactory > & ) throw( uno::Exception )
111 : : {
112 : 0 : SolarMutexGuard aGuard;
113 : 0 : BasicIDEGlobals::ensure();
114 : 0 : SfxObjectShell* pShell = new BasicDocShell();
115 : 0 : return uno::Reference< uno::XInterface >( pShell->GetModel() );
116 : : }
117 : :
118 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|