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