xref: /aoo42x/main/sw/source/ui/uno/unodoc.cxx (revision efeef26f)
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 	throw( uno::Exception )
62 {
63     ::vos::OGuard aGuard( Application::GetSolarMutex() );
64 	SwDLL::Init();
65     SfxObjectShell* pShell = new SwDocShell( _nCreationFlags );
66 	return uno::Reference< uno::XInterface >( pShell->GetModel() );
67 }
68 
69 //============================================================
70 // com.sun.star.comp.Writer.WebDocument
71 
SwWebDocument_getSupportedServiceNames()72 uno::Sequence< ::rtl::OUString > SAL_CALL SwWebDocument_getSupportedServiceNames() throw()
73 {
74     // return only top level services here! All others must be
75     // resolved by rtti!
76     uno::Sequence< ::rtl::OUString > aRet ( 1 );
77 	::rtl::OUString* pArray = aRet.getArray();
78     pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.WebDocument" ) );
79 
80 	return aRet;
81 }
82 
SwWebDocument_getImplementationName()83 ::rtl::OUString SAL_CALL SwWebDocument_getImplementationName() throw()
84 {
85 	return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.WebDocument" ) );
86 }
87 
SwWebDocument_createInstance(const uno::Reference<lang::XMultiServiceFactory> &)88 uno::Reference< uno::XInterface > SAL_CALL SwWebDocument_createInstance(
89     const uno::Reference< lang::XMultiServiceFactory > & )
90         throw( uno::Exception )
91 {
92     ::vos::OGuard aGuard( Application::GetSolarMutex() );
93 	SwDLL::Init();
94 	SfxObjectShell* pShell = new SwWebDocShell( SFX_CREATE_MODE_STANDARD );
95 	return uno::Reference< uno::XInterface >( pShell->GetModel() );
96 }
97 
98 //============================================================
99 // com.sun.star.comp.Writer.GlobalDocument
100 
SwGlobalDocument_getSupportedServiceNames()101 uno::Sequence< ::rtl::OUString > SAL_CALL SwGlobalDocument_getSupportedServiceNames() throw()
102 {
103     uno::Sequence< ::rtl::OUString > aRet ( 1 );
104 	::rtl::OUString* pArray = aRet.getArray();
105     pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.GlobalDocument" ) );
106 
107 	return aRet;
108 }
109 
SwGlobalDocument_getImplementationName()110 ::rtl::OUString SAL_CALL SwGlobalDocument_getImplementationName() throw()
111 {
112 	return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.GlobalDocument" ) );
113 }
114 
SwGlobalDocument_createInstance(const uno::Reference<lang::XMultiServiceFactory> &)115 uno::Reference< uno::XInterface > SAL_CALL SwGlobalDocument_createInstance(
116     const uno::Reference< lang::XMultiServiceFactory > &)
117         throw( uno::Exception )
118 {
119     ::vos::OGuard aGuard( Application::GetSolarMutex() );
120 	SwDLL::Init();
121 	SfxObjectShell* pShell = new SwGlobalDocShell( SFX_CREATE_MODE_STANDARD );
122 	return uno::Reference< uno::XInterface >( pShell->GetModel() );
123 }
124 
125