Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <sot/factory.hxx>
21 : #include <svx/svxids.hrc>
22 : #include <svx/modctrl.hxx>
23 : #include <svx/zoomctrl.hxx>
24 : #include <sfx2/docfac.hxx>
25 : #include <svx/lboxctrl.hxx>
26 : #include <sfx2/docfile.hxx>
27 : #include <sfx2/docfilt.hxx>
28 : #include <sfx2/app.hxx>
29 : #include <sfx2/taskpane.hxx>
30 :
31 : #include <smdll.hxx>
32 : #include <document.hxx>
33 : #include <toolbox.hxx>
34 : #include <view.hxx>
35 :
36 : #include <starmath.hrc>
37 :
38 : #include <svx/xmlsecctrl.hxx>
39 :
40 : namespace
41 : {
42 : class SmDLL
43 : {
44 : public:
45 : SmDLL();
46 : ~SmDLL();
47 : };
48 :
49 4 : SmDLL::SmDLL()
50 : {
51 4 : SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM);
52 4 : if ( *ppShlPtr )
53 4 : return;
54 :
55 4 : SfxObjectFactory& rFactory = SmDocShell::Factory();
56 4 : SmModule *pModule = new SmModule( &rFactory );
57 4 : *ppShlPtr = pModule;
58 :
59 4 : rFactory.SetDocumentServiceName( rtl::OUString("com.sun.star.formula.FormulaProperties") );
60 :
61 4 : SmModule::RegisterInterface(pModule);
62 4 : SmDocShell::RegisterInterface(pModule);
63 4 : SmViewShell::RegisterInterface(pModule);
64 :
65 4 : SmViewShell::RegisterFactory(1);
66 :
67 4 : SvxZoomStatusBarControl::RegisterControl(SID_ATTR_ZOOM, pModule);
68 4 : SvxModifyControl::RegisterControl(SID_TEXTSTATUS, pModule);
69 4 : SvxUndoRedoControl::RegisterControl(SID_UNDO, pModule);
70 4 : SvxUndoRedoControl::RegisterControl(SID_REDO, pModule);
71 4 : XmlSecStatusBarControl::RegisterControl(SID_SIGNATURE, pModule);
72 :
73 4 : SmToolBoxWrapper::RegisterChildWindow(true);
74 4 : SmCmdBoxWrapper::RegisterChildWindow(true);
75 :
76 4 : ::sfx2::TaskPaneWrapper::RegisterChildWindow(false, pModule);
77 : }
78 :
79 4 : SmDLL::~SmDLL()
80 : {
81 : #if 0
82 : // the SdModule must be destroyed
83 : SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM);
84 : delete (*ppShlPtr);
85 : (*ppShlPtr) = NULL;
86 : *GetAppData(SHL_SM) = 0;
87 : #endif
88 4 : }
89 :
90 : struct theSmDLLInstance : public rtl::Static<SmDLL, theSmDLLInstance> {};
91 : }
92 :
93 : namespace SmGlobals
94 : {
95 163 : void ensure()
96 : {
97 163 : theSmDLLInstance::get();
98 163 : }
99 12 : }
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|