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 |* 59 |* Init 60 |* 61 \************************************************************************/ 62 63 void SdDLL::Init() 64 { 65 if ( SD_MOD() ) 66 return; 67 68 SfxObjectFactory* pDrawFact = NULL; 69 SfxObjectFactory* pImpressFact = NULL; 70 71 if (SvtModuleOptions().IsImpress()) 72 pImpressFact = &::sd::DrawDocShell::Factory(); 73 74 if (SvtModuleOptions().IsDraw()) 75 pDrawFact = &::sd::GraphicDocShell::Factory(); 76 77 // the SdModule must be created 78 SdModule** ppShlPtr = (SdModule**) GetAppData(SHL_DRAW); 79 80 // #i46427# 81 // The SfxModule::SfxModule stops when the first given factory 82 // is 0, so we must not give a 0 as first factory 83 if( pImpressFact ) 84 { 85 (*ppShlPtr) = new SdModule( pImpressFact, pDrawFact ); 86 } 87 else 88 { 89 (*ppShlPtr) = new SdModule( pDrawFact, pImpressFact ); 90 } 91 92 if (SvtModuleOptions().IsImpress()) 93 { 94 // Register the Impress shape types in order to make the shapes accessible. 95 ::accessibility::RegisterImpressShapeTypes (); 96 ::sd::DrawDocShell::Factory().SetDocumentServiceName( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ); 97 } 98 99 if (SvtModuleOptions().IsDraw()) 100 { 101 ::sd::GraphicDocShell::Factory().SetDocumentServiceName( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ); 102 } 103 104 // register your view-factories here 105 RegisterFactorys(); 106 107 // register your shell-interfaces here 108 RegisterInterfaces(); 109 110 // register your controllers here 111 RegisterControllers(); 112 113 // SvDraw-Felder registrieren 114 SdrRegisterFieldClasses(); 115 116 // 3D-Objekt-Factory eintragen 117 E3dObjFactory(); 118 119 // ::com::sun::star::form::component::Form-Objekt-Factory eintragen 120 FmFormObjFactory(); 121 122 // Objekt-Factory eintragen 123 SdrObjFactory::InsertMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData)); 124 } 125 126 127 128 /************************************************************************* 129 |* 130 |* Exit 131 |* 132 \************************************************************************/ 133 134 void SdDLL::Exit() 135 { 136 // called directly befor unloading the DLL 137 // do whatever you want, Sd-DLL is accessible 138 139 // Objekt-Factory austragen 140 SdrObjFactory::RemoveMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData)); 141 142 // the SdModule must be destroyed 143 SdModule** ppShlPtr = (SdModule**) GetAppData(SHL_DRAW); 144 delete (*ppShlPtr); 145 (*ppShlPtr) = NULL; 146 } 147 148