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 : #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 <osl/mutex.hxx>
28 : #include <vcl/svapp.hxx>
29 :
30 : using namespace ::com::sun::star;
31 :
32 : // com.sun.star.comp.Writer.TextDocument
33 :
34 58 : uno::Sequence< OUString > SAL_CALL SwTextDocument_getSupportedServiceNames() throw()
35 : {
36 : // return only top level services here! All others must be
37 : // resolved by rtti!
38 58 : uno::Sequence< OUString > aRet ( 1 );
39 58 : OUString* pArray = aRet.getArray();
40 58 : pArray[0] = "com.sun.star.text.TextDocument";
41 :
42 58 : return aRet;
43 : }
44 :
45 117 : OUString SAL_CALL SwTextDocument_getImplementationName() throw()
46 : {
47 117 : return OUString( "com.sun.star.comp.Writer.TextDocument" );
48 : }
49 :
50 2712 : uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance(
51 : const uno::Reference< lang::XMultiServiceFactory >&, SfxModelFlags _nCreationFlags )
52 : throw( uno::Exception )
53 : {
54 2712 : SolarMutexGuard aGuard;
55 2712 : SwGlobals::ensure();
56 2712 : SfxObjectShell* pShell = new SwDocShell( _nCreationFlags );
57 2712 : return uno::Reference< uno::XInterface >( pShell->GetModel() );
58 : }
59 :
60 : extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
61 3 : com_sun_star_comp_Writer_WebDocument_get_implementation(::com::sun::star::uno::XComponentContext*,
62 : ::com::sun::star::uno::Sequence<css::uno::Any> const &)
63 : {
64 3 : SolarMutexGuard aGuard;
65 3 : SwGlobals::ensure();
66 3 : SfxObjectShell* pShell = new SwWebDocShell( SfxObjectCreateMode::STANDARD );
67 6 : uno::Reference< uno::XInterface > model( pShell->GetModel() );
68 3 : model->acquire();
69 6 : return model.get();
70 : }
71 :
72 :
73 : extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
74 1 : com_sun_star_comp_Writer_GlobalDocument_get_implementation(::com::sun::star::uno::XComponentContext*,
75 : ::com::sun::star::uno::Sequence<css::uno::Any> const &)
76 : {
77 1 : SolarMutexGuard aGuard;
78 1 : SwGlobals::ensure();
79 1 : SfxObjectShell* pShell = new SwGlobalDocShell( SfxObjectCreateMode::STANDARD );
80 2 : uno::Reference< uno::XInterface > model( pShell->GetModel() );
81 1 : model->acquire();
82 2 : return model.get();
83 : }
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|