Update ooo320-m1
[ooovba.git] / sd / source / ui / unoidl / unodoc.cxx
blob3a2a5fb6e599e176c23c78aa170e6d961b6897a9
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.12 $
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_sd.hxx"
34 // System - Includes -----------------------------------------------------
36 #include <tools/string.hxx>
37 #include <sfx2/docfac.hxx>
38 #include <sfx2/sfxmodelfactory.hxx>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
41 #include "sdmod.hxx"
42 #include "DrawDocShell.hxx"
43 #include "GraphicDocShell.hxx"
44 #include <vos/mutex.hxx>
45 #include <vcl/svapp.hxx>
47 using namespace ::com::sun::star;
49 // com.sun.star.comp.Draw.DrawingDocument
51 ::rtl::OUString SAL_CALL SdDrawingDocument_getImplementationName() throw( uno::RuntimeException )
53 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.DrawingDocument" ) );
56 uno::Sequence< rtl::OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames() throw( uno::RuntimeException )
58 uno::Sequence< rtl::OUString > aSeq( 2 );
59 aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"));
60 aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
62 return aSeq;
65 uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance(
66 const uno::Reference< lang::XMultiServiceFactory > &, const sal_uInt64 _nCreationFlags )
68 ::vos::OGuard aGuard( Application::GetSolarMutex() );
70 SdDLL::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;
75 SfxObjectShell* pShell =
76 new ::sd::GraphicDocShell(
77 eCreateMode, FALSE, DOCUMENT_TYPE_DRAW, bScriptSupport );
78 return uno::Reference< uno::XInterface >( pShell->GetModel() );
81 // com.sun.star.comp.Draw.PresentationDocument
83 ::rtl::OUString SAL_CALL SdPresentationDocument_getImplementationName() throw( uno::RuntimeException )
85 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.PresentationDocument" ) );
88 uno::Sequence< rtl::OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames() throw( uno::RuntimeException )
90 uno::Sequence< rtl::OUString > aSeq( 2 );
91 aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
92 aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
94 return aSeq;
97 uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance(
98 const uno::Reference< lang::XMultiServiceFactory > &, const sal_uInt64 _nCreationFlags )
100 ::vos::OGuard aGuard( Application::GetSolarMutex() );
102 SdDLL::Init();
104 const SfxObjectCreateMode eCreateMode = ( _nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD;
105 const bool bScriptSupport = ( _nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0;
107 SfxObjectShell* pShell =
108 new ::sd::DrawDocShell(
109 eCreateMode, FALSE, DOCUMENT_TYPE_IMPRESS, bScriptSupport );
110 return uno::Reference< uno::XInterface >( pShell->GetModel() );