xref: /trunk/main/sc/source/ui/app/scdll.cxx (revision cf6516809c57e1bb0a940545cca99cdad54d4ce2)
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_sc.hxx"
24 
25 #include <editeng/eeitem.hxx>
26 
27 #ifndef _FM_FMOBJFAC_HXX
28 #include <svx/fmobjfac.hxx>
29 #endif
30 #include <svx/objfac3d.hxx>
31 #include <svx/tbxcolor.hxx>
32 
33 #include <sot/clsids.hxx>
34 #include <sfx2/sidebar/SidebarChildWindow.hxx>
35 #include <sfx2/docfilt.hxx>
36 #include <sfx2/fcontnr.hxx>
37 #include <sfx2/docfile.hxx>
38 #include <sfx2/app.hxx>
39 #include <avmedia/mediaplayer.hxx>
40 #include <avmedia/mediatoolbox.hxx>
41 #include <comphelper/types.hxx>
42 #include <svx/extrusioncolorcontrol.hxx>
43 #include <svx/fontworkgallery.hxx>
44 #include <svx/tbxcustomshapes.hxx>
45 
46 #include <svtools/parhtml.hxx>
47 #include <sot/formats.hxx>
48 #define SOT_FORMATSTR_ID_STARCALC_30 SOT_FORMATSTR_ID_STARCALC
49 
50 #include "scitems.hxx" // for tbxctrls etc.
51 #include "scmod.hxx"
52 #include "scresid.hxx"
53 #include "sc.hrc"
54 #include "cfgids.hxx"
55 
56 //! die Registrierung wird wegen CLOOKs in ein eigenes File wandern muessen...
57 
58 // Interface-Registrierung
59 #include "docsh.hxx"
60 #include "tabvwsh.hxx"
61 #include "prevwsh.hxx"
62 #include "drawsh.hxx"
63 #include "drformsh.hxx"
64 #include "drtxtob.hxx"
65 #include "editsh.hxx"
66 #include "pivotsh.hxx"
67 #include "auditsh.hxx"
68 #include "cellsh.hxx"
69 #include "oleobjsh.hxx"
70 #include "chartsh.hxx"
71 #include "graphsh.hxx"
72 #include "mediash.hxx"
73 #include "pgbrksh.hxx"
74 
75 #include "docpool.hxx"
76 #include "appoptio.hxx"
77 
78 // Controls
79 
80 #include <svx/tbxalign.hxx>
81 #include <svx/tbxctl.hxx>
82 #include <svx/fillctrl.hxx>
83 #include <svx/linectrl.hxx>
84 #include <svx/tbcontrl.hxx>
85 #include <svx/selctrl.hxx>
86 #include <svx/insctrl.hxx>
87 #include <svx/zoomctrl.hxx>
88 #include <editeng/flditem.hxx>
89 #include <svx/modctrl.hxx>
90 #include <svx/pszctrl.hxx>
91 #include <svx/fntctl.hxx>
92 #include <svx/fntszctl.hxx>
93 #include <svx/grafctrl.hxx>
94 #include <svx/galbrws.hxx>
95 #include <svx/clipboardctl.hxx>
96 #include <svx/lboxctrl.hxx>
97 #include <svx/verttexttbxctrl.hxx>
98 #include <svx/formatpaintbrushctrl.hxx>
99 #include "tbinsert.hxx"
100 #include "tbzoomsliderctrl.hxx"
101 #include <svx/zoomsliderctrl.hxx>
102 
103 #include <svx/xmlsecctrl.hxx>
104 // Child-Windows
105 #include "reffact.hxx"
106 #include "navipi.hxx"
107 #include "inputwin.hxx"
108 #include "spelldialog.hxx"
109 #include <svx/fontwork.hxx>
110 #include <svx/srchdlg.hxx>
111 #include <svx/hyprlink.hxx>
112 #include <svx/hyperdlg.hxx>
113 #include <svx/imapdlg.hxx>
114 
115 #include "editutil.hxx"
116 #include <svx/svdfield.hxx>     //  SdrRegisterFieldClasses
117 #include <rtl/logfile.hxx>
118 
119 #include "dwfunctr.hxx"
120 #include "acredlin.hxx"
121 
122 //------------------------------------------------------------------
123 
124 //UNUSED2008-05  // filter detection can't use ScFilterOptions (in sc-dll),
125 //UNUSED2008-05  // so access to wk3 flag must be implemented here again
126 //UNUSED2008-05
127 //UNUSED2008-05  class ScLibOptions : public utl::ConfigItem
128 //UNUSED2008-05  {
129 //UNUSED2008-05      sal_Bool        bWK3Flag;
130 //UNUSED2008-05
131 //UNUSED2008-05  public:
132 //UNUSED2008-05                  ScLibOptions();
133 //UNUSED2008-05      sal_Bool        GetWK3Flag() const          { return bWK3Flag; }
134 //UNUSED2008-05  };
135 //UNUSED2008-05
136 //UNUSED2008-05  #define CFGPATH_LIBFILTER      "Office.Calc/Filter/Import/Lotus123"
137 //UNUSED2008-05  #define ENTRYSTR_WK3           "WK3"
138 //UNUSED2008-05
139 //UNUSED2008-05  ScLibOptions::ScLibOptions() :
140 //UNUSED2008-05      ConfigItem( rtl::OUString::createFromAscii( CFGPATH_LIBFILTER ) ),
141 //UNUSED2008-05      bWK3Flag( sal_False )
142 //UNUSED2008-05  {
143 //UNUSED2008-05      com::sun::star::uno::Sequence<rtl::OUString> aNames(1);
144 //UNUSED2008-05      aNames[0] = rtl::OUString::createFromAscii( ENTRYSTR_WK3 );
145 //UNUSED2008-05      com::sun::star::uno::Sequence<com::sun::star::uno::Any> aValues = GetProperties(aNames);
146 //UNUSED2008-05      if ( aValues.getLength() == 1 && aValues[0].hasValue() )
147 //UNUSED2008-05          bWK3Flag = comphelper::getBOOL( aValues[0] );
148 //UNUSED2008-05  }
149 
150 //------------------------------------------------------------------
151 
ScResId(sal_uInt16 nId)152 ScResId::ScResId( sal_uInt16 nId ) :
153     ResId( nId, *SC_MOD()->GetResMgr() )
154 {
155 }
156 
157 //------------------------------------------------------------------
158 
Init()159 void ScDLL::Init()
160 {
161     RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDLL::Init" );
162 
163     ScModule **ppShlPtr = (ScModule**) GetAppData(SHL_CALC);
164     if ( *ppShlPtr )
165         return;
166 
167     ScDocumentPool::InitVersionMaps();  // wird im ScModule ctor gebraucht
168 
169     ScModule* pMod = new ScModule( &ScDocShell::Factory() );
170     (*ppShlPtr) = pMod;
171 
172 //REMOVE        ScDocShell::RegisterFactory( SDT_SC_DOCFACTPRIO );
173 
174     ScDocShell::Factory().SetDocumentServiceName( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) );
175 
176     ScGlobal::Init();       // erst wenn der ResManager initialisiert ist
177                             //  erst nach ScGlobal::Init duerfen die App-Optionen
178                             //  initialisiert werden
179 
180     // register your view-factories here
181 
182     ScTabViewShell      ::RegisterFactory(1);
183     ScPreviewShell      ::RegisterFactory(2);
184 
185     // register your shell-interfaces here
186 
187     ScModule            ::RegisterInterface(pMod);
188     ScDocShell          ::RegisterInterface(pMod);
189     ScTabViewShell      ::RegisterInterface(pMod);
190     ScPreviewShell      ::RegisterInterface(pMod);
191     ScDrawShell         ::RegisterInterface(pMod);
192     ScDrawFormShell     ::RegisterInterface(pMod);
193     ScDrawTextObjectBar ::RegisterInterface(pMod);
194     ScEditShell         ::RegisterInterface(pMod);
195     ScPivotShell        ::RegisterInterface(pMod);
196     ScAuditingShell     ::RegisterInterface(pMod);
197     ScFormatShell       ::RegisterInterface(pMod);
198     ScCellShell         ::RegisterInterface(pMod);
199     ScOleObjectShell    ::RegisterInterface(pMod);
200     ScChartShell        ::RegisterInterface(pMod);
201     ScGraphicShell      ::RegisterInterface(pMod);
202     ScMediaShell        ::RegisterInterface(pMod);
203     ScPageBreakShell    ::RegisterInterface(pMod);
204 
205     //  eigene Controller
206     ScTbxInsertCtrl     ::RegisterControl(SID_TBXCTL_INSERT, pMod);
207     ScTbxInsertCtrl     ::RegisterControl(SID_TBXCTL_INSCELLS, pMod);
208     ScTbxInsertCtrl     ::RegisterControl(SID_TBXCTL_INSOBJ, pMod);
209     ScZoomSliderControl ::RegisterControl(SID_PREVIEW_SCALINGFACTOR, pMod);
210 
211     //  Svx-Toolbox-Controller
212     SvxTbxCtlDraw                   ::RegisterControl(SID_INSERT_DRAW,          pMod);
213     SvxTbxCtlCustomShapes           ::RegisterControl(SID_DRAWTBX_CS_BASIC,     pMod);
214     SvxTbxCtlCustomShapes           ::RegisterControl(SID_DRAWTBX_CS_SYMBOL,    pMod);
215     SvxTbxCtlCustomShapes           ::RegisterControl(SID_DRAWTBX_CS_ARROW,     pMod);
216     SvxTbxCtlCustomShapes           ::RegisterControl(SID_DRAWTBX_CS_FLOWCHART, pMod);
217     SvxTbxCtlCustomShapes           ::RegisterControl(SID_DRAWTBX_CS_CALLOUT,   pMod);
218     SvxTbxCtlCustomShapes           ::RegisterControl(SID_DRAWTBX_CS_STAR,      pMod);
219     SvxTbxCtlAlign                  ::RegisterControl(SID_OBJECT_ALIGN,         pMod);
220     SvxFillToolBoxControl           ::RegisterControl(0, pMod);
221     SvxLineStyleToolBoxControl      ::RegisterControl(0, pMod);
222     SvxLineWidthToolBoxControl      ::RegisterControl(0, pMod);
223     SvxLineColorToolBoxControl      ::RegisterControl(0, pMod);
224     SvxLineEndToolBoxControl        ::RegisterControl(SID_ATTR_LINEEND_STYLE,   pMod);
225     SvxStyleToolBoxControl          ::RegisterControl(SID_STYLE_APPLY,          pMod);
226     SvxFontNameToolBoxControl       ::RegisterControl(SID_ATTR_CHAR_FONT,       pMod);
227 //  SvxFontHeightToolBoxControl     ::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod);
228     SvxFontColorToolBoxControl      ::RegisterControl(SID_ATTR_CHAR_COLOR,      pMod);
229     SvxColorToolBoxControl          ::RegisterControl(SID_BACKGROUND_COLOR,     pMod);
230     SvxFrameToolBoxControl          ::RegisterControl(SID_ATTR_BORDER,          pMod);
231     SvxFrameLineStyleToolBoxControl ::RegisterControl(SID_FRAME_LINESTYLE,      pMod);
232     SvxFrameLineColorToolBoxControl ::RegisterControl(SID_FRAME_LINECOLOR,      pMod);
233     SvxClipBoardControl             ::RegisterControl(SID_PASTE,                pMod );
234     SvxUndoRedoControl              ::RegisterControl(SID_UNDO,                 pMod );
235     SvxUndoRedoControl              ::RegisterControl(SID_REDO,                 pMod );
236     svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH,  pMod );
237 
238     SvxGrafModeToolBoxControl       ::RegisterControl(SID_ATTR_GRAF_MODE,       pMod);
239     SvxGrafRedToolBoxControl        ::RegisterControl(SID_ATTR_GRAF_RED,        pMod);
240     SvxGrafGreenToolBoxControl      ::RegisterControl(SID_ATTR_GRAF_GREEN,      pMod);
241     SvxGrafBlueToolBoxControl       ::RegisterControl(SID_ATTR_GRAF_BLUE,       pMod);
242     SvxGrafLuminanceToolBoxControl  ::RegisterControl(SID_ATTR_GRAF_LUMINANCE,  pMod);
243     SvxGrafContrastToolBoxControl   ::RegisterControl(SID_ATTR_GRAF_CONTRAST,   pMod);
244     SvxGrafGammaToolBoxControl      ::RegisterControl(SID_ATTR_GRAF_GAMMA,      pMod);
245     SvxGrafTransparenceToolBoxControl::RegisterControl(SID_ATTR_GRAF_TRANSPARENCE, pMod);
246     SvxGrafFilterToolBoxControl     ::RegisterControl(SID_GRFFILTER,            pMod);
247 
248     SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_CAPTION_VERTICAL,          pMod);
249     SvxVertTextTbxCtrl::RegisterControl(SID_DRAW_TEXT_VERTICAL,             pMod);
250     SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_LEFT_TO_RIGHT,    pMod);
251     SvxVertTextTbxCtrl::RegisterControl(SID_TEXTDIRECTION_TOP_TO_BOTTOM,    pMod);
252     SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_LEFT_TO_RIGHT, pMod);
253     SvxCTLTextTbxCtrl::RegisterControl(SID_ATTR_PARA_RIGHT_TO_LEFT, pMod);
254 
255     //Media Controller
256     ::avmedia::MediaToolBoxControl::RegisterControl( SID_AVMEDIA_TOOLBOX, pMod );
257 
258     // common SFX controller
259     ::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(sal_False, pMod);
260 
261     // Svx-StatusBar-Controller
262     SvxInsertStatusBarControl       ::RegisterControl(SID_ATTR_INSERT,      pMod);
263     SvxSelectionModeControl         ::RegisterControl(SID_STATUS_SELMODE,   pMod);
264     SvxZoomStatusBarControl         ::RegisterControl(SID_ATTR_ZOOM,        pMod);
265     SvxZoomSliderControl            ::RegisterControl(SID_ATTR_ZOOMSLIDER,  pMod);
266     SvxModifyControl                ::RegisterControl(SID_DOC_MODIFIED,     pMod);
267     XmlSecStatusBarControl          ::RegisterControl( SID_SIGNATURE,       pMod );
268 
269     SvxPosSizeStatusBarControl      ::RegisterControl(SID_ATTR_SIZE,        pMod);
270 
271     // Svx-Menue-Controller
272     SvxFontMenuControl              ::RegisterControl(SID_ATTR_CHAR_FONT,       pMod);
273     SvxFontSizeMenuControl          ::RegisterControl(SID_ATTR_CHAR_FONTHEIGHT, pMod);
274 
275     // CustomShape extrusion controller
276     svx::ExtrusionColorControl::RegisterControl( SID_EXTRUSION_3D_COLOR, pMod );
277     svx::FontWorkShapeTypeControl::RegisterControl( SID_FONTWORK_SHAPE_TYPE, pMod );
278 
279     //  Child-Windows
280 
281     // Hack: Eingabezeile mit 42 registrieren, damit sie im PlugIn immer sichtbar ist
282     ScInputWindowWrapper        ::RegisterChildWindow(42, pMod, SFX_CHILDWIN_TASK|SFX_CHILDWIN_FORCEDOCK);
283     ScNavigatorDialogWrapper    ::RegisterChildWindowContext(
284             sal::static_int_cast<sal_uInt16>(ScTabViewShell::GetInterfaceId()), pMod);
285     ScSolverDlgWrapper          ::RegisterChildWindow(sal_False, pMod);
286     ScOptSolverDlgWrapper       ::RegisterChildWindow(sal_False, pMod);
287     ScNameDlgWrapper            ::RegisterChildWindow(sal_False, pMod);
288     ScPivotLayoutWrapper        ::RegisterChildWindow(sal_False, pMod);
289     ScTabOpDlgWrapper           ::RegisterChildWindow(sal_False, pMod);
290     ScFilterDlgWrapper          ::RegisterChildWindow(sal_False, pMod);
291     ScSpecialFilterDlgWrapper   ::RegisterChildWindow(sal_False, pMod);
292     ScDbNameDlgWrapper          ::RegisterChildWindow(sal_False, pMod);
293     ScConsolidateDlgWrapper     ::RegisterChildWindow(sal_False, pMod);
294     ScPrintAreasDlgWrapper      ::RegisterChildWindow(sal_False, pMod);
295     ScCondFormatDlgWrapper      ::RegisterChildWindow(sal_False, pMod);
296     ScColRowNameRangesDlgWrapper::RegisterChildWindow(sal_False, pMod);
297     ScFormulaDlgWrapper         ::RegisterChildWindow(sal_False, pMod);
298 
299     // First docking Window for Calc
300     ScFunctionChildWindow       ::RegisterChildWindow(sal_False, pMod);
301 
302     // Redlining- Window
303     ScAcceptChgDlgWrapper       ::RegisterChildWindow(sal_False, pMod);
304     ScSimpleRefDlgWrapper       ::RegisterChildWindow(sal_False, pMod, SFX_CHILDWIN_ALWAYSAVAILABLE|SFX_CHILDWIN_NEVERHIDE );
305     ScHighlightChgDlgWrapper    ::RegisterChildWindow(sal_False, pMod);
306 
307     SvxSearchDialogWrapper      ::RegisterChildWindow(sal_False, pMod);
308     SvxHlinkDlgWrapper          ::RegisterChildWindow(sal_False, pMod);
309     SvxFontWorkChildWindow      ::RegisterChildWindow(sal_False, pMod);
310     SvxHyperlinkDlgWrapper      ::RegisterChildWindow(sal_False, pMod, SFX_CHILDWIN_FORCEDOCK);
311     SvxIMapDlgChildWindow       ::RegisterChildWindow(sal_False, pMod);
312     GalleryChildWindow          ::RegisterChildWindow(sal_False, pMod);
313     ScSpellDialogChildWindow    ::RegisterChildWindow(sal_False, pMod);
314     ::avmedia::MediaPlayer      ::RegisterChildWindow(sal_False, pMod);
315 
316     //<!--Added by PengYunQuan for Validity Cell Range Picker
317     ScValidityRefChildWin::RegisterChildWindow(sal_False, pMod);
318     //-->Added by PengYunQuan for Validity Cell Range Picker
319 
320     //  Edit-Engine-Felder, soweit nicht schon in OfficeApplication::Init
321 
322     SvClassManager& rClassManager = SvxFieldItem::GetClassManager();
323 //  rClassManager.SV_CLASS_REGISTER( SvxURLField );
324 //  rClassManager.SV_CLASS_REGISTER( SvxDateField );
325 //  rClassManager.SV_CLASS_REGISTER( SvxPageField );
326     rClassManager.SV_CLASS_REGISTER( SvxPagesField );
327 //  rClassManager.SV_CLASS_REGISTER( SvxTimeField );
328     rClassManager.SV_CLASS_REGISTER( SvxFileField );
329 //  rClassManager.SV_CLASS_REGISTER( SvxExtFileField );
330     rClassManager.SV_CLASS_REGISTER( SvxTableField );
331 
332     SdrRegisterFieldClasses();      // SvDraw-Felder registrieren
333 
334     // 3D-Objekt-Factory eintragen
335     E3dObjFactory();
336 
337     // ::com::sun::star::form::component::Form-Objekt-Factory eintragen
338     FmFormObjFactory();
339 
340     pMod->PutItem( SfxUInt16Item( SID_ATTR_METRIC, sal::static_int_cast<sal_uInt16>(pMod->GetAppOptions().GetAppMetric()) ) );
341 
342     //  StarOne Services are now handled in the registry
343 }
344 
Exit()345 void ScDLL::Exit()
346 {
347     // the SxxModule must be destroyed
348     ScModule **ppShlPtr = (ScModule**) GetAppData(SHL_CALC);
349     delete (*ppShlPtr);
350     (*ppShlPtr) = NULL;
351 
352     //  ScGlobal::Clear ist schon im Module-dtor
353 }
354 
355 // DetectFilter functionality has moved - please update your bookmarks
356 // see sc/source/ui/unoobj/scdetect.cxx, have a nice day.
357