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 <basdoc.hxx>
22 : #include <cppuhelper/supportsservice.hxx>
23 : #include <iderdll.hxx>
24 : #include <osl/mutex.hxx>
25 : #include <sfx2/docfac.hxx>
26 : #include <sfx2/objsh.hxx>
27 : #include <vcl/svapp.hxx>
28 :
29 : #include "unomodel.hxx"
30 :
31 : namespace basctl
32 : {
33 :
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;
39 :
40 0 : SIDEModel::SIDEModel( SfxObjectShell *pObjSh )
41 0 : : SfxBaseModel(pObjSh)
42 : {
43 0 : }
44 :
45 0 : SIDEModel::~SIDEModel()
46 : {
47 0 : }
48 :
49 0 : uno::Any SAL_CALL SIDEModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException, std::exception)
50 : {
51 : uno::Any aRet = ::cppu::queryInterface ( rType,
52 : // OWeakObject interfaces
53 : static_cast< XInterface* >( static_cast< OWeakObject* >( this ) ),
54 : static_cast< XWeak* > ( this ),
55 0 : static_cast< XServiceInfo* > ( this ) );
56 0 : if (!aRet.hasValue())
57 0 : aRet = SfxBaseModel::queryInterface ( rType );
58 0 : return aRet;
59 : }
60 :
61 0 : void SAL_CALL SIDEModel::acquire() throw()
62 : {
63 0 : SolarMutexGuard aGuard;
64 0 : OWeakObject::acquire();
65 0 : }
66 :
67 0 : void SAL_CALL SIDEModel::release() throw()
68 : {
69 0 : SolarMutexGuard aGuard;
70 0 : OWeakObject::release();
71 0 : }
72 :
73 0 : uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( ) throw(uno::RuntimeException, std::exception)
74 : {
75 0 : uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes();
76 0 : sal_Int32 nLen = aTypes.getLength();
77 0 : aTypes.realloc(nLen + 1);
78 0 : uno::Type* pTypes = aTypes.getArray();
79 0 : pTypes[nLen++] = ::getCppuType((Reference<XServiceInfo>*)0);
80 :
81 0 : return aTypes;
82 : }
83 :
84 0 : OUString SIDEModel::getImplementationName(void) throw( uno::RuntimeException, std::exception )
85 : {
86 0 : return getImplementationName_Static();
87 : }
88 :
89 0 : OUString SIDEModel::getImplementationName_Static()
90 : {
91 0 : return OUString( "com.sun.star.comp.basic.BasicIDE" );
92 : }
93 :
94 0 : sal_Bool SIDEModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException, std::exception )
95 : {
96 0 : return cppu::supportsService(this, rServiceName);
97 : }
98 0 : uno::Sequence< OUString > SIDEModel::getSupportedServiceNames(void) throw( uno::RuntimeException, std::exception )
99 : {
100 0 : return getSupportedServiceNames_Static();
101 : }
102 :
103 0 : uno::Sequence< OUString > SIDEModel::getSupportedServiceNames_Static(void)
104 : {
105 0 : uno::Sequence< OUString > aRet(1);
106 0 : OUString* pArray = aRet.getArray();
107 0 : pArray[0] = "com.sun.star.script.BasicIDE" ;
108 0 : return aRet;
109 : }
110 :
111 0 : uno::Reference< uno::XInterface > SAL_CALL SIDEModel_createInstance(
112 : const uno::Reference< lang::XMultiServiceFactory > & ) throw( uno::Exception )
113 : {
114 0 : SolarMutexGuard aGuard;
115 0 : EnsureIde();
116 0 : SfxObjectShell* pShell = new DocShell();
117 0 : return uno::Reference< uno::XInterface >( pShell->GetModel() );
118 : }
119 :
120 : // XStorable
121 0 : void SAL_CALL SIDEModel::store() throw (io::IOException, uno::RuntimeException, std::exception)
122 : {
123 0 : notImplemented();
124 0 : }
125 :
126 0 : void SAL_CALL SIDEModel::storeAsURL( const OUString&, const uno::Sequence< beans::PropertyValue >& )
127 : throw (io::IOException, uno::RuntimeException, std::exception)
128 : {
129 0 : notImplemented();
130 0 : }
131 :
132 0 : void SAL_CALL SIDEModel::storeToURL( const OUString&,
133 : const uno::Sequence< beans::PropertyValue >& )
134 : throw (io::IOException, uno::RuntimeException, std::exception)
135 : {
136 0 : notImplemented();
137 0 : }
138 :
139 0 : void SIDEModel::notImplemented() throw ( io::IOException )
140 : {
141 0 : throw io::IOException("Can't store IDE model", uno::Reference< uno::XInterface >() );
142 : }
143 :
144 : } // namespace basctl
145 :
146 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|