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