xref: /AOO41X/main/starmath/source/smdll.cxx (revision 74ad9c3aaef738e2700a4c8981cd71fca1d6eb81)
1d107581fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3d107581fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4d107581fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5d107581fSAndrew Rist  * distributed with this work for additional information
6d107581fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7d107581fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8d107581fSAndrew Rist  * "License"); you may not use this file except in compliance
9d107581fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11d107581fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13d107581fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14d107581fSAndrew Rist  * software distributed under the License is distributed on an
15d107581fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d107581fSAndrew Rist  * KIND, either express or implied.  See the License for the
17d107581fSAndrew Rist  * specific language governing permissions and limitations
18d107581fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20d107581fSAndrew Rist  *************************************************************/
21d107581fSAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_starmath.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <sot/factory.hxx>
26cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC //autogen
27cdf0e10cSrcweir #include <svx/svxids.hrc>
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #include <svx/modctrl.hxx>
30cdf0e10cSrcweir #include <svx/zoomctrl.hxx>
31cdf0e10cSrcweir #include <sfx2/docfac.hxx>
32cdf0e10cSrcweir #include <svx/lboxctrl.hxx>
33cdf0e10cSrcweir #include <sfx2/docfile.hxx>
34cdf0e10cSrcweir #include <sfx2/docfilt.hxx>
35cdf0e10cSrcweir #include <sfx2/app.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #ifndef _SMDLL_HXX
38cdf0e10cSrcweir #include <smdll.hxx>
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir #include <document.hxx>
41cdf0e10cSrcweir #include <toolbox.hxx>
42cdf0e10cSrcweir #include <view.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #ifndef _STARMATH_HRC
45cdf0e10cSrcweir #include <starmath.hrc>
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir 
48cdf0e10cSrcweir #include <svx/xmlsecctrl.hxx>
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 
52cdf0e10cSrcweir sal_Bool SmDLL::bInitialized = sal_False;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir /*************************************************************************
55cdf0e10cSrcweir |*
56cdf0e10cSrcweir |* Initialisierung
57cdf0e10cSrcweir |*
58cdf0e10cSrcweir \************************************************************************/
Init()59cdf0e10cSrcweir void SmDLL::Init()
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     if ( bInitialized )
62cdf0e10cSrcweir         return;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir     bInitialized = sal_True;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     SfxObjectFactory& rFactory = SmDocShell::Factory();
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 	SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM);
69cdf0e10cSrcweir     *ppShlPtr = new SmModule( &rFactory );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir     SfxModule *p = SM_MOD();
72cdf0e10cSrcweir 	SmModule *pp = (SmModule *) p;
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     rFactory.SetDocumentServiceName( String::CreateFromAscii("com.sun.star.formula.FormulaProperties") );
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	SmModule::RegisterInterface(pp);
77cdf0e10cSrcweir     SmDocShell::RegisterInterface(pp);
78cdf0e10cSrcweir 	SmViewShell::RegisterInterface(pp);
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	SmViewShell::RegisterFactory(1);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	SvxZoomStatusBarControl::RegisterControl( SID_ATTR_ZOOM, pp );
83cdf0e10cSrcweir 	SvxModifyControl::RegisterControl( SID_TEXTSTATUS, pp );
84cdf0e10cSrcweir 	SvxUndoRedoControl::RegisterControl( SID_UNDO, pp );
85cdf0e10cSrcweir 	SvxUndoRedoControl::RegisterControl( SID_REDO, pp );
86cdf0e10cSrcweir 	XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pp );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	SmToolBoxWrapper::RegisterChildWindow(sal_True);
89cdf0e10cSrcweir 	SmCmdBoxWrapper::RegisterChildWindow(sal_True);
90cdf0e10cSrcweir }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir /*************************************************************************
93cdf0e10cSrcweir |*
94cdf0e10cSrcweir |* Deinitialisierung
95cdf0e10cSrcweir |*
96cdf0e10cSrcweir \************************************************************************/
Exit()97cdf0e10cSrcweir void SmDLL::Exit()
98cdf0e10cSrcweir {
99cdf0e10cSrcweir 	// the SdModule must be destroyed
100cdf0e10cSrcweir 	SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM);
101cdf0e10cSrcweir 	delete (*ppShlPtr);
102cdf0e10cSrcweir 	(*ppShlPtr) = NULL;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	*GetAppData(SHL_SM) = 0;
105cdf0e10cSrcweir }
106*74ad9c3aSmseidel 
107*74ad9c3aSmseidel /* vim: set noet sw=4 ts=4: */
108