xref: /aoo41x/main/sd/source/ui/unoidl/unodoc.cxx (revision 79aad27f)
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_sd.hxx"
26 
27 // System - Includes -----------------------------------------------------
28 
29 #include <tools/string.hxx>
30 #include <sfx2/docfac.hxx>
31 #include <sfx2/sfxmodelfactory.hxx>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 
34 #include "sdmod.hxx"
35 #include "DrawDocShell.hxx"
36 #include "GraphicDocShell.hxx"
37 #include <vos/mutex.hxx>
38 #include <vcl/svapp.hxx>
39 
40 using namespace ::com::sun::star;
41 
42 // com.sun.star.comp.Draw.DrawingDocument
43 
SdDrawingDocument_getImplementationName()44 ::rtl::OUString SAL_CALL SdDrawingDocument_getImplementationName() throw( uno::RuntimeException )
45 {
46 	return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.DrawingDocument" ) );
47 }
48 
SdDrawingDocument_getSupportedServiceNames()49 uno::Sequence< rtl::OUString > SAL_CALL SdDrawingDocument_getSupportedServiceNames() throw( uno::RuntimeException )
50 {
51     uno::Sequence< rtl::OUString > aSeq( 2 );
52     aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"));
53     aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
54 
55 	return aSeq;
56 }
57 
SdDrawingDocument_createInstance(const uno::Reference<lang::XMultiServiceFactory> &,const sal_uInt64 _nCreationFlags)58 uno::Reference< uno::XInterface > SAL_CALL SdDrawingDocument_createInstance(
59 				const uno::Reference< lang::XMultiServiceFactory > &, const sal_uInt64 _nCreationFlags )
60 {
61     ::vos::OGuard aGuard( Application::GetSolarMutex() );
62 
63 	SdDLL::Init();
64 
65 	SfxObjectShell* pShell =
66         new ::sd::GraphicDocShell(
67             _nCreationFlags, sal_False, DOCUMENT_TYPE_DRAW );
68 	return uno::Reference< uno::XInterface >( pShell->GetModel() );
69 }
70 
71 // com.sun.star.comp.Draw.PresentationDocument
72 
SdPresentationDocument_getImplementationName()73 ::rtl::OUString SAL_CALL SdPresentationDocument_getImplementationName() throw( uno::RuntimeException )
74 {
75 	return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Draw.PresentationDocument" ) );
76 }
77 
SdPresentationDocument_getSupportedServiceNames()78 uno::Sequence< rtl::OUString > SAL_CALL SdPresentationDocument_getSupportedServiceNames() throw( uno::RuntimeException )
79 {
80 	uno::Sequence< rtl::OUString > aSeq( 2 );
81 	aSeq[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory"));
82 	aSeq[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"));
83 
84 	return aSeq;
85 }
86 
SdPresentationDocument_createInstance(const uno::Reference<lang::XMultiServiceFactory> &,const sal_uInt64 _nCreationFlags)87 uno::Reference< uno::XInterface > SAL_CALL SdPresentationDocument_createInstance(
88 				const uno::Reference< lang::XMultiServiceFactory > &, const sal_uInt64 _nCreationFlags )
89 {
90     ::vos::OGuard aGuard( Application::GetSolarMutex() );
91 
92 	SdDLL::Init();
93 
94     SfxObjectShell* pShell =
95         new ::sd::DrawDocShell(
96             _nCreationFlags, sal_False, DOCUMENT_TYPE_IMPRESS );
97 	return uno::Reference< uno::XInterface >( pShell->GetModel() );
98 }
99 
100 
101