LibreOffice Module sw (master)  1
unodoc.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 #include <sal/config.h>
21 
22 #include <com/sun/star/frame/XModel.hpp>
23 #include <sfx2/sfxmodelfactory.hxx>
24 #include <swdll.hxx>
25 #include <unofreg.hxx>
26 #include <docsh.hxx>
27 #include <globdoc.hxx>
28 #include <wdocsh.hxx>
29 #include <vcl/svapp.hxx>
30 
31 using namespace ::com::sun::star;
32 
33 // com.sun.star.comp.Writer.TextDocument
34 
35 uno::Sequence< OUString > SwTextDocument_getSupportedServiceNames() throw()
36 {
37  // return only top level services here! All others must be
38  // resolved by rtti!
39  uno::Sequence< OUString > aRet { "com.sun.star.text.TextDocument" };
40  return aRet;
41 }
42 
44 {
45  return "com.sun.star.comp.Writer.TextDocument";
46 }
47 
48 uno::Reference< uno::XInterface > SwTextDocument_createInstance(
49  const uno::Reference< lang::XMultiServiceFactory >&, SfxModelFlags _nCreationFlags )
50 {
51  SolarMutexGuard aGuard;
53  SfxObjectShell* pShell = new SwDocShell( _nCreationFlags );
54  return uno::Reference< uno::XInterface >( pShell->GetModel() );
55 }
56 
57 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
59  css::uno::Sequence<css::uno::Any> const &)
60 {
61  SolarMutexGuard aGuard;
63  SfxObjectShell* pShell = new SwWebDocShell;
64  uno::Reference< uno::XInterface > model( pShell->GetModel() );
65  model->acquire();
66  return model.get();
67 }
68 
69 
70 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
72  css::uno::Sequence<css::uno::Any> const &)
73 {
74  SolarMutexGuard aGuard;
76  SfxObjectShell* pShell = new SwGlobalDocShell( SfxObjectCreateMode::STANDARD );
77  uno::Reference< uno::XInterface > model( pShell->GetModel() );
78  model->acquire();
79  return model.get();
80 }
81 
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString SwTextDocument_getImplementationName()
Definition: unodoc.cxx:43
css::uno::Reference< css::frame::XModel > GetModel() const
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_WebDocument_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unodoc.cxx:58
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_Writer_GlobalDocument_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
Definition: unodoc.cxx:71
tuple model
void ensure()
Definition: swdll.cxx:67
SfxModelFlags
uno::Reference< uno::XInterface > SwTextDocument_createInstance(const uno::Reference< lang::XMultiServiceFactory > &, SfxModelFlags _nCreationFlags)
Definition: unodoc.cxx:48
uno::Sequence< OUString > SwTextDocument_getSupportedServiceNames()
Definition: unodoc.cxx:35