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