xref: /AOO41X/main/starmath/source/smdll.cxx (revision ffb6c864b85bd0b97dee75a8ee80cfa70b5094d2)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_starmath.hxx"
24 
25 #include <sot/factory.hxx>
26 #ifndef _SVX_SVXIDS_HRC //autogen
27 #include <svx/svxids.hrc>
28 #endif
29 #include <svx/modctrl.hxx>
30 #include <svx/zoomctrl.hxx>
31 #include <sfx2/docfac.hxx>
32 #include <svx/lboxctrl.hxx>
33 #include <sfx2/docfile.hxx>
34 #include <sfx2/docfilt.hxx>
35 #include <sfx2/app.hxx>
36 
37 #ifndef _SMDLL_HXX
38 #include <smdll.hxx>
39 #endif
40 #include <document.hxx>
41 #include <toolbox.hxx>
42 #include <view.hxx>
43 
44 #ifndef _STARMATH_HRC
45 #include <starmath.hrc>
46 #endif
47 
48 #include <svx/xmlsecctrl.hxx>
49 
50 
51 
52 sal_Bool SmDLL::bInitialized = sal_False;
53 
54 /*************************************************************************
55 |*
56 |* Initialisierung
57 |*
58 \************************************************************************/
59 void SmDLL::Init()
60 {
61     if ( bInitialized )
62         return;
63 
64     bInitialized = sal_True;
65 
66     SfxObjectFactory& rFactory = SmDocShell::Factory();
67 
68 	SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM);
69     *ppShlPtr = new SmModule( &rFactory );
70 
71     SfxModule *p = SM_MOD();
72 	SmModule *pp = (SmModule *) p;
73 
74     rFactory.SetDocumentServiceName( String::CreateFromAscii("com.sun.star.formula.FormulaProperties") );
75 
76 	SmModule::RegisterInterface(pp);
77     SmDocShell::RegisterInterface(pp);
78 	SmViewShell::RegisterInterface(pp);
79 
80 	SmViewShell::RegisterFactory(1);
81 
82 	SvxZoomStatusBarControl::RegisterControl( SID_ATTR_ZOOM, pp );
83 	SvxModifyControl::RegisterControl( SID_TEXTSTATUS, pp );
84 	SvxUndoRedoControl::RegisterControl( SID_UNDO, pp );
85 	SvxUndoRedoControl::RegisterControl( SID_REDO, pp );
86 	XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE, pp );
87 
88 	SmToolBoxWrapper::RegisterChildWindow(sal_True);
89 	SmCmdBoxWrapper::RegisterChildWindow(sal_True);
90 }
91 
92 /*************************************************************************
93 |*
94 |* Deinitialisierung
95 |*
96 \************************************************************************/
97 void SmDLL::Exit()
98 {
99 	// the SdModule must be destroyed
100 	SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM);
101 	delete (*ppShlPtr);
102 	(*ppShlPtr) = NULL;
103 
104 	*GetAppData(SHL_SM) = 0;
105 }
106 
107 /* vim: set noet sw=4 ts=4: */
108