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 84 : 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 84 : uno::Sequence< OUString > aRet ( 1 );
39 84 : OUString* pArray = aRet.getArray();
40 84 : pArray[0] = "com.sun.star.text.TextDocument";
41 :
42 84 : return aRet;
43 : }
44 :
45 176 : OUString SAL_CALL SwTextDocument_getImplementationName() throw()
46 : {
47 176 : return OUString( "com.sun.star.comp.Writer.TextDocument" );
48 : }
49 :
50 4696 : uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance(
51 : const uno::Reference< lang::XMultiServiceFactory >&, const sal_uInt64 _nCreationFlags )
52 : throw( uno::Exception )
53 : {
54 4696 : SolarMutexGuard aGuard;
55 4696 : SwGlobals::ensure();
56 4696 : SfxObjectShell* pShell = new SwDocShell( _nCreationFlags );
57 4696 : return uno::Reference< uno::XInterface >( pShell->GetModel() );
58 : }
59 :
60 : // com.sun.star.comp.Writer.WebDocument
61 :
62 2 : uno::Sequence< OUString > SAL_CALL SwWebDocument_getSupportedServiceNames() throw()
63 : {
64 : // return only top level services here! All others must be
65 : // resolved by rtti!
66 2 : uno::Sequence< OUString > aRet ( 1 );
67 2 : OUString* pArray = aRet.getArray();
68 2 : pArray[0] = "com.sun.star.text.WebDocument";
69 :
70 2 : return aRet;
71 : }
72 :
73 10 : OUString SAL_CALL SwWebDocument_getImplementationName() throw()
74 : {
75 10 : return OUString( "com.sun.star.comp.Writer.WebDocument" );
76 : }
77 :
78 4 : uno::Reference< uno::XInterface > SAL_CALL SwWebDocument_createInstance(
79 : const uno::Reference< lang::XMultiServiceFactory > & )
80 : throw( uno::Exception )
81 : {
82 4 : SolarMutexGuard aGuard;
83 4 : SwGlobals::ensure();
84 4 : SfxObjectShell* pShell = new SwWebDocShell( SFX_CREATE_MODE_STANDARD );
85 4 : return uno::Reference< uno::XInterface >( pShell->GetModel() );
86 : }
87 :
88 : // com.sun.star.comp.Writer.GlobalDocument
89 :
90 0 : uno::Sequence< OUString > SAL_CALL SwGlobalDocument_getSupportedServiceNames() throw()
91 : {
92 0 : uno::Sequence< OUString > aRet ( 1 );
93 0 : OUString* pArray = aRet.getArray();
94 0 : pArray[0] = "com.sun.star.text.GlobalDocument";
95 :
96 0 : return aRet;
97 : }
98 :
99 6 : OUString SAL_CALL SwGlobalDocument_getImplementationName() throw()
100 : {
101 6 : return OUString( "com.sun.star.comp.Writer.GlobalDocument" );
102 : }
103 :
104 0 : uno::Reference< uno::XInterface > SAL_CALL SwGlobalDocument_createInstance(
105 : const uno::Reference< lang::XMultiServiceFactory > &)
106 : throw( uno::Exception )
107 : {
108 0 : SolarMutexGuard aGuard;
109 0 : SwGlobals::ensure();
110 0 : SfxObjectShell* pShell = new SwGlobalDocShell( SFX_CREATE_MODE_STANDARD );
111 0 : return uno::Reference< uno::XInterface >( pShell->GetModel() );
112 270 : }
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|