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