Update ooo320-m1
[ooovba.git] / sw / source / ui / app / swdll.cxx
blobd26756eaaeccfa63c7fbad2a1911aa256005e565
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: swdll.cxx,v $
10 * $Revision: 1.23 $
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_sw.hxx"
35 #include <svx/svdobj.hxx>
36 #include <rtl/logfile.hxx>
38 #ifndef _GLOBDOC_HRC
39 #include "globdoc.hrc"
40 #endif
42 #ifndef _SWDLL_HXX
43 #include <swdll.hxx>
44 #endif
45 #include <wdocsh.hxx>
46 #include <globdoc.hxx>
47 #include <initui.hxx>
48 #include <swmodule.hxx>
49 #include <swtypes.hxx>
50 #include <init.hxx>
51 #include <dobjfac.hxx>
52 #include <cfgid.h>
54 #include <svtools/moduleoptions.hxx>
56 #ifndef _FM_FMOBJFAC_HXX
57 #include <svx/fmobjfac.hxx>
58 #endif
59 #include <svx/svdfield.hxx>
60 #include <svx/objfac3d.hxx>
62 #include <unomid.h>
65 /*************************************************************************
67 |* Init
69 \************************************************************************/
71 void SwDLL::Init()
73 RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDLL" );
75 // the SdModule must be created
76 SwModule** ppShlPtr = (SwModule**) GetAppData(SHL_WRITER);
77 if ( *ppShlPtr )
78 return;
80 SvtModuleOptions aOpt;
81 SfxObjectFactory* pDocFact = 0;
82 SfxObjectFactory* pGlobDocFact = 0;
83 if ( aOpt.IsWriter() )
85 pDocFact = &SwDocShell::Factory();
86 pGlobDocFact = &SwGlobalDocShell::Factory();
89 SfxObjectFactory* pWDocFact = &SwWebDocShell::Factory();
91 SwModule* pModule = new SwModule( pWDocFact, pDocFact, pGlobDocFact );
92 (*ppShlPtr) = pModule;
94 pWDocFact->SetDocumentServiceName(C2S("com.sun.star.text.WebDocument"));
96 if ( aOpt.IsWriter() )
98 pGlobDocFact->SetDocumentServiceName(C2S("com.sun.star.text.GlobalDocument"));
99 pDocFact->SetDocumentServiceName(C2S("com.sun.star.text.TextDocument"));
102 // SvDraw-Felder registrieren
103 SdrRegisterFieldClasses();
105 // 3D-Objekt-Factory eintragen
106 E3dObjFactory();
108 // form::component::Form-Objekt-Factory eintragen
109 FmFormObjFactory();
111 SdrObjFactory::InsertMakeObjectHdl( LINK( &aSwObjectFactory, SwObjectFactory, MakeObject ) );
113 RTL_LOGFILE_CONTEXT_TRACE( aLog, "Init Core/UI/Filter" );
115 //Initialisierung der Statics
116 ::_InitCore();
117 ::_InitFilter();
118 ::_InitUI();
120 pModule->InitAttrPool();
121 //jetzt darf das SwModule seinen Pool anlegen
123 // register your view-factories here
124 RegisterFactories();
126 // register your shell-interfaces here
127 RegisterInterfaces();
129 // register your controllers here
130 RegisterControls();
135 /*************************************************************************
137 |* Exit
139 \************************************************************************/
141 void SwDLL::Exit()
143 // called directly befor unloading the DLL
144 // do whatever you want, Sw-DLL is accessible
146 // der Pool muss vor den statics geloescht werden
147 SW_MOD()->RemoveAttrPool();
149 ::_FinitUI();
150 ::_FinitFilter();
151 ::_FinitCore();
152 // Objekt-Factory austragen
153 SdrObjFactory::RemoveMakeObjectHdl(LINK(&aSwObjectFactory, SwObjectFactory, MakeObject ));
154 // the SwModule must be destroyed
155 SwModule** ppShlPtr = (SwModule**) GetAppData(SHL_WRITER);
156 delete (*ppShlPtr);
157 (*ppShlPtr) = NULL;