1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sd.hxx" 30 #include <editeng/eeitem.hxx> 31 32 #include <editeng/editeng.hxx> 33 #include <svx/svdobj.hxx> 34 #include <unotools/moduleoptions.hxx> 35 #include <svx/fmobjfac.hxx> 36 #include <svx/svdfield.hxx> 37 #include <svx/objfac3d.hxx> 38 39 #include "sddll.hxx" 40 #include "DrawDocShell.hxx" 41 #include "GraphicDocShell.hxx" 42 #include "sdresid.hxx" 43 #include "sdobjfac.hxx" 44 #include "cfgids.hxx" 45 #include "strmname.h" 46 #include "SdShapeTypes.hxx" 47 48 #include <svx/SvxShapeTypes.hxx> 49 #include <sfx2/docfilt.hxx> 50 #include <sfx2/docfile.hxx> 51 #include <sfx2/fcontnr.hxx> 52 #include <tools/urlobj.hxx> 53 #include <svtools/FilterConfigItem.hxx> 54 #include <com/sun/star/util/XArchiver.hpp> 55 #include <comphelper/processfactory.hxx> 56 57 using namespace ::rtl; 58 using namespace ::com::sun::star; 59 60 61 /************************************************************************* 62 |* 63 |* Init 64 |* 65 \************************************************************************/ 66 67 void SdDLL::Init() 68 { 69 if ( SD_MOD() ) 70 return; 71 72 SfxObjectFactory* pDrawFact = NULL; 73 SfxObjectFactory* pImpressFact = NULL; 74 75 if (SvtModuleOptions().IsImpress()) 76 pImpressFact = &::sd::DrawDocShell::Factory(); 77 78 if (SvtModuleOptions().IsDraw()) 79 pDrawFact = &::sd::GraphicDocShell::Factory(); 80 81 // the SdModule must be created 82 SdModule** ppShlPtr = (SdModule**) GetAppData(SHL_DRAW); 83 84 // #i46427# 85 // The SfxModule::SfxModule stops when the first given factory 86 // is 0, so we must not give a 0 as first factory 87 if( pImpressFact ) 88 { 89 (*ppShlPtr) = new SdModule( pImpressFact, pDrawFact ); 90 } 91 else 92 { 93 (*ppShlPtr) = new SdModule( pDrawFact, pImpressFact ); 94 } 95 96 if (SvtModuleOptions().IsImpress()) 97 { 98 // Register the Impress shape types in order to make the shapes accessible. 99 ::accessibility::RegisterImpressShapeTypes (); 100 ::sd::DrawDocShell::Factory().SetDocumentServiceName( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.presentation.PresentationDocument" ) ) ); 101 } 102 103 if (SvtModuleOptions().IsDraw()) 104 { 105 ::sd::GraphicDocShell::Factory().SetDocumentServiceName( String( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DrawingDocument" ) ) ); 106 } 107 108 // register your view-factories here 109 RegisterFactorys(); 110 111 // register your shell-interfaces here 112 RegisterInterfaces(); 113 114 // register your controllers here 115 RegisterControllers(); 116 117 // SvDraw-Felder registrieren 118 SdrRegisterFieldClasses(); 119 120 // 3D-Objekt-Factory eintragen 121 E3dObjFactory(); 122 123 // ::com::sun::star::form::component::Form-Objekt-Factory eintragen 124 FmFormObjFactory(); 125 126 // Objekt-Factory eintragen 127 SdrObjFactory::InsertMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData)); 128 } 129 130 131 132 /************************************************************************* 133 |* 134 |* Exit 135 |* 136 \************************************************************************/ 137 138 void SdDLL::Exit() 139 { 140 // called directly befor unloading the DLL 141 // do whatever you want, Sd-DLL is accessible 142 143 // Objekt-Factory austragen 144 SdrObjFactory::RemoveMakeUserDataHdl(LINK(&aSdObjectFactory, SdObjectFactory, MakeUserData)); 145 146 // the SdModule must be destroyed 147 SdModule** ppShlPtr = (SdModule**) GetAppData(SHL_DRAW); 148 delete (*ppShlPtr); 149 (*ppShlPtr) = NULL; 150 } 151 152