LibreOffice Module basctl (master) 1
unomodel.cxx
Go to the documentation of this file.
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 <com/sun/star/io/IOException.hpp>
27#include <sfx2/objsh.hxx>
28#include <vcl/svapp.hxx>
29
30#include "unomodel.hxx"
31
32namespace basctl
33{
34
35using namespace ::cppu;
36using namespace ::com::sun::star;
37using namespace ::com::sun::star::uno;
38using namespace ::com::sun::star::lang;
39
41: SfxBaseModel(pObjSh)
42{
43}
44
46{
47}
48
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 static_cast< XServiceInfo* > ( this ) );
56 if (!aRet.hasValue())
57 aRet = SfxBaseModel::queryInterface ( rType );
58 return aRet;
59}
60
61void SAL_CALL SIDEModel::acquire() noexcept
62{
63 SolarMutexGuard aGuard;
64 OWeakObject::acquire();
65}
66
67void SAL_CALL SIDEModel::release() noexcept
68{
69 SolarMutexGuard aGuard;
70 OWeakObject::release();
71}
72
73uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( )
74{
77 uno::Sequence { cppu::UnoType<XServiceInfo>::get() });
78}
79
81{
82 return "com.sun.star.comp.basic.BasicIDE";
83}
84
85sal_Bool SIDEModel::supportsService(const OUString& rServiceName)
86{
87 return cppu::supportsService(this, rServiceName);
88}
89
90uno::Sequence< OUString > SIDEModel::getSupportedServiceNames()
91{
92 return { "com.sun.star.script.BasicIDE" };
93}
94
95// XStorable
96void SAL_CALL SIDEModel::store()
97{
99}
100
101void SAL_CALL SIDEModel::storeAsURL( const OUString&, const uno::Sequence< beans::PropertyValue >& )
102{
104}
105
106void SAL_CALL SIDEModel::storeToURL( const OUString&,
107 const uno::Sequence< beans::PropertyValue >& )
108{
110}
111
113{
114 throw io::IOException("Can't store IDE model" );
115}
116
117} // namespace basctl
118
119extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
121 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
122{
123 SolarMutexGuard aGuard;
125 SfxObjectShell* pShell = new basctl::DocShell();
126 auto pModel = pShell->GetModel();
127 pModel->acquire();
128 return pModel.get();
129}
130
131/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
css::uno::Reference< css::frame::XModel3 > GetModel() const
SIDEModel(SfxObjectShell *pObjSh)
Definition: unomodel.cxx:40
virtual ~SIDEModel() override
Definition: unomodel.cxx:45
virtual void SAL_CALL release() noexcept override
Definition: unomodel.cxx:67
static void notImplemented()
Definition: unomodel.cxx:112
virtual void SAL_CALL storeToURL(const OUString &sURL, const css::uno::Sequence< css::beans::PropertyValue > &seqArguments) override
Definition: unomodel.cxx:106
virtual void SAL_CALL storeAsURL(const OUString &sURL, const css::uno::Sequence< css::beans::PropertyValue > &seqArguments) override
Definition: unomodel.cxx:101
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: unomodel.cxx:49
virtual OUString SAL_CALL getImplementationName() override
Definition: unomodel.cxx:80
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unomodel.cxx:73
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unomodel.cxx:90
virtual void SAL_CALL store() override
Definition: unomodel.cxx:96
virtual void SAL_CALL acquire() noexcept override
Definition: unomodel.cxx:61
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unomodel.cxx:85
css::uno::Type const & get()
void EnsureIde()
Definition: iderdll.cxx:74
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
bool hasValue()
unsigned char sal_Bool
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_basic_BasicID_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unomodel.cxx:120