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