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