xref: /trunk/main/sd/source/ui/app/sddll.cxx (revision 16e7aaae)
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 #include <editeng/eeitem.hxx>
27 
28 #include <editeng/editeng.hxx>
29 #include <svx/svdobj.hxx>
30 #include <unotools/moduleoptions.hxx>
31 #include <svx/fmobjfac.hxx>
32 #include <svx/svdfield.hxx>
33 #include <svx/objfac3d.hxx>
34 
35 #include "sddll.hxx"
36 #include "DrawDocShell.hxx"
37 #include "GraphicDocShell.hxx"
38 #include "sdresid.hxx"
39 #include "sdobjfac.hxx"
40 #include "cfgids.hxx"
41 #include "strmname.h"
42 #include "SdShapeTypes.hxx"
43 
44 #include <svx/SvxShapeTypes.hxx>
45 #include <sfx2/docfilt.hxx>
46 #include <sfx2/docfile.hxx>
47 #include <sfx2/fcontnr.hxx>
48 #include <tools/urlobj.hxx>
49 #include <svtools/FilterConfigItem.hxx>
50 #include <com/sun/star/util/XArchiver.hpp>
51 #include <comphelper/processfactory.hxx>
52 
53 using namespace ::rtl;
54 using namespace ::com::sun::star;
55 
56 
57 /*************************************************************************
58 |* Init
59 \************************************************************************/
60 
Init()61 void SdDLL::Init()
62 {
63 	if ( SD_MOD() )
64 		return;
65 
66 	SfxObjectFactory* pDrawFact = NULL;
67 	SfxObjectFactory* pImpressFact = NULL;
68 
69 	if (SvtModuleOptions().IsImpress())
70 		pImpressFact = &::sd::DrawDocShell::Factory();
71 
72 	if (SvtModuleOptions().IsDraw())
73 		pDrawFact = &::sd::GraphicDocShell::Factory();
74 
75 	// the SdModule must be created
76 	 SdModule** ppShlPtr = (SdModule**) GetAppData(SHL_DRAW);
77 
78 	 // #i46427#
79 	 // The SfxModule::SfxModule stops when the first given factory
80 	 // is 0, so we must not give a 0 as first factory
81 	 if( pImpressFact )
82 	 {
83 		(*ppShlPtr) = new SdModule( pImpressFact, pDrawFact );
84 	 }
85 	 else
86 	 {
87 		(*ppShlPtr) = new SdModule( pDrawFact, pImpressFact );
88 	 }
89 
90 	if (SvtModuleOptions().IsImpress())
91 	{
92 		// Register the Impress shape types in order to make the shapes accessible.
93 		::accessibility::RegisterImpressShapeTypes ();
94 		::sd::DrawDocShell::Factory().SetDocumentServiceName( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) );
95 	}
96 
97 	if (SvtModuleOptions().IsDraw())
98 	{
99 		::sd::GraphicDocShell::Factory().SetDocumentServiceName( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) );
100 	}
101 
102 	// register your view-factories here
103 	RegisterFactorys();
104 
105 	// register your shell-interfaces here
106 	RegisterInterfaces();
107 
108 	// register your controllers here
109 	RegisterControllers();
110 
111 	// SvDraw-Felder registrieren
112 	SdrRegisterFieldClasses();
113 
114 	// 3D-Objekt-Factory eintragen
115 	E3dObjFactory();
116 
117 	// ::com::sun::star::form::component::Form-Objekt-Factory eintragen
118 	FmFormObjFactory();
119 
120 	// Objekt-Factory eintragen
121 	SdrObjFactory::InsertMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData));
122 }
123 
124 
125 
126 /*************************************************************************
127 |* Exit
128 \************************************************************************/
129 
Exit()130 void SdDLL::Exit()
131 {
132 	// called directly before unloading the DLL
133 	// do whatever you want, Sd-DLL is accessible
134 
135 	// Objekt-Factory austragen
136 	SdrObjFactory::RemoveMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData));
137 
138 	// the SdModule must be destroyed
139 	SdModule** ppShlPtr = (SdModule**) GetAppData(SHL_DRAW);
140 	delete (*ppShlPtr);
141 	(*ppShlPtr) = NULL;
142 }
143