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