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 <svx/zoomsliderctrl.hxx>
25 : #include <sfx2/docfac.hxx>
26 : #include <svx/lboxctrl.hxx>
27 : #include <sfx2/docfile.hxx>
28 : #include <sfx2/docfilt.hxx>
29 : #include <sfx2/app.hxx>
30 : #include <sfx2/taskpane.hxx>
31 :
32 : #include <smdll.hxx>
33 : #include <document.hxx>
34 : #include <view.hxx>
35 :
36 : #include <ElementsDockingWindow.hxx>
37 :
38 : #include <starmath.hrc>
39 :
40 : #include <svx/xmlsecctrl.hxx>
41 :
42 : namespace
43 : {
44 : class SmDLL
45 : {
46 : public:
47 : SmDLL();
48 : ~SmDLL();
49 : };
50 :
51 14 : SmDLL::SmDLL()
52 : {
53 14 : SmModule** ppShlPtr = reinterpret_cast<SmModule**>(GetAppData(SHL_SM));
54 14 : if ( *ppShlPtr )
55 14 : return;
56 :
57 14 : SfxObjectFactory& rFactory = SmDocShell::Factory();
58 14 : SmModule *pModule = new SmModule( &rFactory );
59 14 : *ppShlPtr = pModule;
60 :
61 14 : rFactory.SetDocumentServiceName( OUString("com.sun.star.formula.FormulaProperties") );
62 :
63 14 : SmModule::RegisterInterface(pModule);
64 14 : SmDocShell::RegisterInterface(pModule);
65 14 : SmViewShell::RegisterInterface(pModule);
66 :
67 14 : SmViewShell::RegisterFactory(1);
68 :
69 14 : SvxZoomStatusBarControl::RegisterControl(SID_ATTR_ZOOM, pModule);
70 14 : SvxZoomSliderControl::RegisterControl(SID_ATTR_ZOOMSLIDER, pModule);
71 14 : SvxModifyControl::RegisterControl(SID_TEXTSTATUS, pModule);
72 14 : SvxUndoRedoControl::RegisterControl(SID_UNDO, pModule);
73 14 : SvxUndoRedoControl::RegisterControl(SID_REDO, pModule);
74 14 : XmlSecStatusBarControl::RegisterControl(SID_SIGNATURE, pModule);
75 :
76 14 : SmCmdBoxWrapper::RegisterChildWindow(true);
77 14 : SmElementsDockingWindowWrapper::RegisterChildWindow(true);
78 :
79 14 : ::sfx2::TaskPaneWrapper::RegisterChildWindow(false, pModule);
80 : }
81 :
82 14 : SmDLL::~SmDLL()
83 : {
84 : #if 0
85 : // the SdModule must be destroyed
86 : SmModule** ppShlPtr = (SmModule**) GetAppData(SHL_SM);
87 : delete (*ppShlPtr);
88 : (*ppShlPtr) = NULL;
89 : *GetAppData(SHL_SM) = 0;
90 : #endif
91 14 : }
92 :
93 : struct theSmDLLInstance : public rtl::Static<SmDLL, theSmDLLInstance> {};
94 : }
95 :
96 : namespace SmGlobals
97 : {
98 323 : void ensure()
99 : {
100 323 : theSmDLLInstance::get();
101 323 : }
102 42 : }
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|