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