xref: /trunk/main/sw/source/ui/uno/unodoc.cxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 // System - Includes -----------------------------------------------------
27 
28 #include <tools/string.hxx>
29 #include <sfx2/docfac.hxx>
30 #include <sfx2/sfxmodelfactory.hxx>
31 #include "swdll.hxx"
32 #include "docsh.hxx"
33 #include "globdoc.hxx"
34 #include "wdocsh.hxx"
35 #include <vos/mutex.hxx>
36 #include <vcl/svapp.hxx>
37 
38 using namespace ::com::sun::star;
39 
40 //============================================================
41 // com.sun.star.comp.Writer.TextDocument
42 
SwTextDocument_getSupportedServiceNames()43 uno::Sequence< ::rtl::OUString > SAL_CALL SwTextDocument_getSupportedServiceNames() throw()
44 {
45     // return only top level services here! All others must be
46     // resolved by rtti!
47     uno::Sequence< ::rtl::OUString > aRet ( 1 );
48     ::rtl::OUString* pArray = aRet.getArray();
49     pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.TextDocument" ) );
50 
51     return aRet;
52 }
53 
SwTextDocument_getImplementationName()54 ::rtl::OUString SAL_CALL SwTextDocument_getImplementationName() throw()
55 {
56     return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) );
57 }
58 
SwTextDocument_createInstance(const uno::Reference<lang::XMultiServiceFactory> &,const sal_uInt64 _nCreationFlags)59 uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance(
60         const uno::Reference< lang::XMultiServiceFactory >&, const sal_uInt64 _nCreationFlags )
61 {
62     ::vos::OGuard aGuard( Application::GetSolarMutex() );
63     SwDLL::Init();
64     SfxObjectShell* pShell = new SwDocShell( _nCreationFlags );
65     return uno::Reference< uno::XInterface >( pShell->GetModel() );
66 }
67 
68 //============================================================
69 // com.sun.star.comp.Writer.WebDocument
70 
SwWebDocument_getSupportedServiceNames()71 uno::Sequence< ::rtl::OUString > SAL_CALL SwWebDocument_getSupportedServiceNames() throw()
72 {
73     // return only top level services here! All others must be
74     // resolved by rtti!
75     uno::Sequence< ::rtl::OUString > aRet ( 1 );
76     ::rtl::OUString* pArray = aRet.getArray();
77     pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.WebDocument" ) );
78 
79     return aRet;
80 }
81 
SwWebDocument_getImplementationName()82 ::rtl::OUString SAL_CALL SwWebDocument_getImplementationName() throw()
83 {
84     return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.WebDocument" ) );
85 }
86 
SwWebDocument_createInstance(const uno::Reference<lang::XMultiServiceFactory> &)87 uno::Reference< uno::XInterface > SAL_CALL SwWebDocument_createInstance(
88     const uno::Reference< lang::XMultiServiceFactory > & )
89 {
90     ::vos::OGuard aGuard( Application::GetSolarMutex() );
91     SwDLL::Init();
92     SfxObjectShell* pShell = new SwWebDocShell( SFX_CREATE_MODE_STANDARD );
93     return uno::Reference< uno::XInterface >( pShell->GetModel() );
94 }
95 
96 //============================================================
97 // com.sun.star.comp.Writer.GlobalDocument
98 
SwGlobalDocument_getSupportedServiceNames()99 uno::Sequence< ::rtl::OUString > SAL_CALL SwGlobalDocument_getSupportedServiceNames() throw()
100 {
101     uno::Sequence< ::rtl::OUString > aRet ( 1 );
102     ::rtl::OUString* pArray = aRet.getArray();
103     pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.GlobalDocument" ) );
104 
105     return aRet;
106 }
107 
SwGlobalDocument_getImplementationName()108 ::rtl::OUString SAL_CALL SwGlobalDocument_getImplementationName() throw()
109 {
110     return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.GlobalDocument" ) );
111 }
112 
SwGlobalDocument_createInstance(const uno::Reference<lang::XMultiServiceFactory> &)113 uno::Reference< uno::XInterface > SAL_CALL SwGlobalDocument_createInstance(
114     const uno::Reference< lang::XMultiServiceFactory > &)
115 {
116     ::vos::OGuard aGuard( Application::GetSolarMutex() );
117     SwDLL::Init();
118     SfxObjectShell* pShell = new SwGlobalDocShell( SFX_CREATE_MODE_STANDARD );
119     return uno::Reference< uno::XInterface >( pShell->GetModel() );
120 }
121