update dev300-m58
[ooovba.git] / sw / source / ui / uno / unodoc.cxx
blob23d014bf59110ca2580f6af857eb287142856172
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unodoc.cxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 // System - Includes -----------------------------------------------------
35 #include <tools/string.hxx>
36 #include <sfx2/docfac.hxx>
37 #include <sfx2/sfxmodelfactory.hxx>
38 #include "swdll.hxx"
39 #include "docsh.hxx"
40 #include "globdoc.hxx"
41 #include "wdocsh.hxx"
42 #include <vos/mutex.hxx>
43 #include <vcl/svapp.hxx>
45 using namespace ::com::sun::star;
47 //============================================================
48 // com.sun.star.comp.Writer.TextDocument
50 uno::Sequence< ::rtl::OUString > SAL_CALL SwTextDocument_getSupportedServiceNames() throw()
52 // return only top level services here! All others must be
53 // resolved by rtti!
54 uno::Sequence< ::rtl::OUString > aRet ( 1 );
55 ::rtl::OUString* pArray = aRet.getArray();
56 pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.TextDocument" ) );
58 return aRet;
61 ::rtl::OUString SAL_CALL SwTextDocument_getImplementationName() throw()
63 return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.TextDocument" ) );
66 uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance(
67 const uno::Reference< lang::XMultiServiceFactory >&, const sal_uInt64 _nCreationFlags )
68 throw( uno::Exception )
70 ::vos::OGuard aGuard( Application::GetSolarMutex() );
71 SwDLL::Init();
72 const SfxObjectCreateMode eCreateMode = ( _nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD;
73 const bool bScriptSupport = ( _nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0;
74 SfxObjectShell* pShell = new SwDocShell( eCreateMode, bScriptSupport );
75 return uno::Reference< uno::XInterface >( pShell->GetModel() );
78 //============================================================
79 // com.sun.star.comp.Writer.WebDocument
81 uno::Sequence< ::rtl::OUString > SAL_CALL SwWebDocument_getSupportedServiceNames() throw()
83 // return only top level services here! All others must be
84 // resolved by rtti!
85 uno::Sequence< ::rtl::OUString > aRet ( 1 );
86 ::rtl::OUString* pArray = aRet.getArray();
87 pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.WebDocument" ) );
89 return aRet;
92 ::rtl::OUString SAL_CALL SwWebDocument_getImplementationName() throw()
94 return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.WebDocument" ) );
97 uno::Reference< uno::XInterface > SAL_CALL SwWebDocument_createInstance(
98 const uno::Reference< lang::XMultiServiceFactory > & )
99 throw( uno::Exception )
101 ::vos::OGuard aGuard( Application::GetSolarMutex() );
102 SwDLL::Init();
103 SfxObjectShell* pShell = new SwWebDocShell( SFX_CREATE_MODE_STANDARD );
104 return uno::Reference< uno::XInterface >( pShell->GetModel() );
107 //============================================================
108 // com.sun.star.comp.Writer.GlobalDocument
110 uno::Sequence< ::rtl::OUString > SAL_CALL SwGlobalDocument_getSupportedServiceNames() throw()
112 uno::Sequence< ::rtl::OUString > aRet ( 1 );
113 ::rtl::OUString* pArray = aRet.getArray();
114 pArray[0] = ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.text.GlobalDocument" ) );
116 return aRet;
119 ::rtl::OUString SAL_CALL SwGlobalDocument_getImplementationName() throw()
121 return ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.GlobalDocument" ) );
124 uno::Reference< uno::XInterface > SAL_CALL SwGlobalDocument_createInstance(
125 const uno::Reference< lang::XMultiServiceFactory > &)
126 throw( uno::Exception )
128 ::vos::OGuard aGuard( Application::GetSolarMutex() );
129 SwDLL::Init();
130 SfxObjectShell* pShell = new SwGlobalDocShell( SFX_CREATE_MODE_STANDARD );
131 return uno::Reference< uno::XInterface >( pShell->GetModel() );