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 : #ifndef SC_TABVWSH_HXX
21 : #define SC_TABVWSH_HXX
22 :
23 : #include <svtools/htmlcfg.hxx>
24 : #include <sfx2/viewsh.hxx>
25 : #include <sfx2/viewfac.hxx>
26 : #include <editeng/svxenum.hxx>
27 : #include "scdllapi.h"
28 : #include "dbfunc.hxx" // -> tabview
29 : #include "target.hxx"
30 : #include "rangelst.hxx" // ScRangeListRef
31 : #include "shellids.hxx"
32 : #include "tabprotection.hxx" // for ScPasswordHash
33 :
34 : #include <boost/ptr_container/ptr_map.hpp>
35 :
36 : class FmFormShell;
37 : class SbxObject;
38 : class SdrOle2Obj;
39 : class SfxBindings;
40 : class SfxChildWindow;
41 : class SfxModelessDialog;
42 : class SvxNumberInfoItem;
43 : struct SfxChildWinInfo;
44 :
45 : class ScArea;
46 : class ScAuditingShell;
47 : class ScDrawShell;
48 : class ScDrawTextObjectBar;
49 : class ScEditShell;
50 : class ScInputHandler;
51 : class ScPivotShell;
52 : class ScDrawFormShell;
53 : class ScCellShell;
54 : class ScOleObjectShell;
55 : class ScGraphicShell;
56 : class ScMediaShell;
57 : class ScChartShell;
58 : class ScPageBreakShell;
59 : class ScDPObject;
60 : class ScNavigatorSettings;
61 : class ScRangeName;
62 :
63 : struct ScHeaderFieldData;
64 :
65 : namespace editeng { class SvxBorderLine; }
66 :
67 : namespace com { namespace sun { namespace star { namespace frame {
68 : class XDispatchProviderInterceptor;
69 : } } } }
70 :
71 : namespace svx {
72 : class ExtrusionBar;
73 : class FontworkBar;
74 : }
75 :
76 : enum ObjectSelectionType
77 : {
78 : OST_NONE,
79 : OST_Cell,
80 : OST_Editing,
81 : OST_DrawText,
82 : OST_Drawing,
83 : OST_DrawForm,
84 : OST_Pivot,
85 : OST_Auditing,
86 : OST_OleObject,
87 : OST_Chart,
88 : OST_Graphic,
89 : OST_Media
90 : };
91 :
92 : //==================================================================
93 :
94 :
95 : class ScTabViewShell: public SfxViewShell, public ScDBFunc
96 : {
97 : private:
98 : static sal_uInt16 nInsertCtrlState;
99 : static sal_uInt16 nInsCellsCtrlState;
100 : static sal_uInt16 nInsObjCtrlState;
101 :
102 : SvxHtmlOptions aHTMLOpt;
103 : ObjectSelectionType eCurOST;
104 : sal_uInt16 nDrawSfxId;
105 : sal_uInt16 nCtrlSfxId;
106 : sal_uInt16 nFormSfxId;
107 : String sDrawCustom; // current custom shape type
108 : ScDrawShell* pDrawShell;
109 : ScDrawTextObjectBar* pDrawTextShell;
110 : ScEditShell* pEditShell;
111 : ScPivotShell* pPivotShell;
112 : ScAuditingShell* pAuditingShell;
113 : ScDrawFormShell* pDrawFormShell;
114 : ScCellShell* pCellShell;
115 : ScOleObjectShell* pOleObjectShell;
116 : ScChartShell* pChartShell;
117 : ScGraphicShell* pGraphicShell;
118 : ScMediaShell* pMediaShell;
119 : ScPageBreakShell* pPageBreakShell;
120 : svx::ExtrusionBar* pExtrusionBarShell;
121 : svx::FontworkBar* pFontworkBarShell;
122 :
123 : FmFormShell* pFormShell;
124 :
125 : ScInputHandler* pInputHandler; // for OLE input cell
126 :
127 : ::editeng::SvxBorderLine* pCurFrameLine;
128 :
129 : ::com::sun::star::uno::Reference<
130 : ::com::sun::star::frame::XDispatchProviderInterceptor >
131 : xDisProvInterceptor;
132 :
133 : Point aWinPos;
134 :
135 : ScTabViewTarget aTarget;
136 : ScArea* pPivotSource;
137 : ScDPObject* pDialogDPObject;
138 :
139 : ScNavigatorSettings* pNavSettings;
140 :
141 : // used in first Activate
142 : sal_Bool bFirstActivate;
143 :
144 : sal_Bool bActiveDrawSh;
145 : sal_Bool bActiveDrawTextSh;
146 : sal_Bool bActivePivotSh;
147 : sal_Bool bActiveAuditingSh;
148 : sal_Bool bActiveDrawFormSh;
149 : sal_Bool bActiveOleObjectSh;
150 : sal_Bool bActiveChartSh;
151 : sal_Bool bActiveGraphicSh;
152 : sal_Bool bActiveMediaSh;
153 : sal_Bool bActiveEditSh;
154 :
155 : sal_Bool bFormShellAtTop; // does the FormShell need to be on top?
156 :
157 :
158 : sal_Bool bDontSwitch; // Don't turn off EditShell
159 : sal_Bool bInFormatDialog; // for GetSelectionText
160 : sal_Bool bPrintSelected; // for result of SvxPrtQryBox
161 :
162 : sal_Bool bReadOnly; // to detect status changes
163 :
164 : SbxObject* pScSbxObject;
165 :
166 : sal_Bool bChartAreaValid; // if chart is drawn
167 : String aEditChartName;
168 : ScRangeListRef aChartSource;
169 : Rectangle aChartPos;
170 : SCTAB nChartDestTab;
171 : sal_uInt16 nCurRefDlgId;
172 :
173 : SfxBroadcaster* pAccessibilityBroadcaster;
174 :
175 : static const int MASTERENUMCOMMANDS = 6;
176 : String aCurrShapeEnumCommand[ MASTERENUMCOMMANDS ];
177 :
178 : // ugly hack for Add button in ScNameDlg
179 : boost::ptr_map<OUString, ScRangeName> maRangeMap;
180 : bool mbInSwitch;
181 : OUString maName;
182 : OUString maScope;
183 :
184 : private:
185 : void Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE );
186 :
187 : SfxShell* GetMySubShell() const;
188 :
189 : void DoReadUserData( const String& rData );
190 : void DoReadUserDataSequence( const ::com::sun::star::uno::Sequence<
191 : ::com::sun::star::beans::PropertyValue >& rSettings );
192 :
193 : DECL_LINK( SimpleRefClose, void* );
194 : DECL_LINK( SimpleRefDone, String* );
195 : DECL_LINK( SimpleRefAborted, String* );
196 : DECL_LINK( SimpleRefChange, String* );
197 : DECL_LINK( FormControlActivated, void* );
198 :
199 : protected:
200 : virtual void Activate(sal_Bool bMDI);
201 : virtual void Deactivate(sal_Bool bMDI);
202 : virtual sal_uInt16 PrepareClose( sal_Bool bUI = sal_True, sal_Bool bForBrowsing = false );
203 :
204 : virtual void ShowCursor(bool bOn);
205 :
206 : virtual void Move(); // Benachrichtigung
207 :
208 : virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize ); // alt
209 :
210 : virtual void InnerResizePixel( const Point &rOfs, const Size &rSize ); // neu
211 : virtual void OuterResizePixel( const Point &rOfs, const Size &rSize );
212 : virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY );
213 :
214 : virtual void QueryObjAreaPixel( Rectangle& rRect ) const;
215 :
216 : virtual String GetSelectionText( sal_Bool bWholeWord );
217 : virtual sal_Bool HasSelection( sal_Bool bText ) const;
218 : virtual String GetDescription() const;
219 :
220 : virtual void WriteUserData(String &, sal_Bool bBrowse = false);
221 : virtual void ReadUserData(const String &, sal_Bool bBrowse = false);
222 : virtual void WriteUserDataSequence (::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = false );
223 : virtual void ReadUserDataSequence (const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, sal_Bool bBrowse = false );
224 :
225 : virtual void UIDeactivated( SfxInPlaceClient* pClient );
226 :
227 : virtual bool KeyInput( const KeyEvent &rKeyEvent );
228 : virtual SdrView* GetDrawView() const;
229 :
230 : public:
231 : TYPEINFO_VISIBILITY(SC_DLLPUBLIC);
232 :
233 62 : SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL)
234 31 : SFX_DECL_VIEWFACTORY(ScTabViewShell);
235 :
236 :
237 : /** -> Clone Method for Factory
238 : Created from a general shell and inherit as much as possible */
239 : ScTabViewShell( SfxViewFrame* pViewFrame,
240 : SfxViewShell* pOldSh );
241 :
242 : virtual ~ScTabViewShell();
243 :
244 : SC_DLLPUBLIC Window* GetDialogParent();
245 :
246 : bool IsRefInputMode() const;
247 : void ExecuteInputDirect();
248 :
249 : ScInputHandler* GetInputHandler() const;
250 : void UpdateInputHandler( sal_Bool bForce = false, sal_Bool bStopEditing = sal_True );
251 : void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
252 : sal_Bool TabKeyInput(const KeyEvent& rKEvt);
253 : sal_Bool SfxKeyInput(const KeyEvent& rKEvt);
254 :
255 : void SetActive();
256 :
257 0 : ::editeng::SvxBorderLine* GetDefaultFrameLine() const { return pCurFrameLine; }
258 : void SetDefaultFrameLine(const ::editeng::SvxBorderLine* pLine );
259 :
260 : SC_DLLPUBLIC void Execute( SfxRequest& rReq );
261 : SC_DLLPUBLIC void GetState( SfxItemSet& rSet );
262 :
263 : void ExecuteTable( SfxRequest& rReq );
264 : void GetStateTable( SfxItemSet& rSet );
265 :
266 : void WindowChanged();
267 : void ExecDraw(SfxRequest&);
268 : void ExecDrawIns(SfxRequest& rReq);
269 : void GetDrawState(SfxItemSet &rSet);
270 : void GetDrawInsState(SfxItemSet &rSet);
271 : void ExecGallery(SfxRequest& rReq); // StarGallery
272 : void GetGalleryState(SfxItemSet& rSet);
273 :
274 : void ExecChildWin(SfxRequest& rReq);
275 : void GetChildWinState( SfxItemSet& rSet );
276 :
277 : void ExecImageMap( SfxRequest& rReq );
278 : void GetImageMapState( SfxItemSet& rSet );
279 :
280 : void ExecTbx( SfxRequest& rReq );
281 : void GetTbxState( SfxItemSet& rSet );
282 :
283 : void ExecuteSave( SfxRequest& rReq );
284 : void GetSaveState( SfxItemSet& rSet );
285 : void ExecSearch( SfxRequest& rReq );
286 :
287 : void ExecuteUndo(SfxRequest& rReq);
288 : void GetUndoState(SfxItemSet &rSet);
289 :
290 : void ExecuteSbx( SfxRequest& rReq );
291 : void GetSbxState( SfxItemSet& rSet );
292 :
293 : void ExecuteObject(SfxRequest& rReq);
294 : void GetObjectState(SfxItemSet &rSet);
295 :
296 : void ExecDrawOpt(SfxRequest& rReq);
297 : void GetDrawOptState(SfxItemSet &rSet);
298 :
299 : void UpdateDrawShell();
300 : void SetDrawShell( sal_Bool bActive );
301 : void SetDrawTextShell( sal_Bool bActive );
302 :
303 : void SetPivotShell( sal_Bool bActive );
304 : ScArea* GetPivotSource(){return pPivotSource;}
305 : void SetPivotSource(ScArea* pSrc){pPivotSource=pSrc;}
306 : void SetDialogDPObject( const ScDPObject* pObj );
307 0 : const ScDPObject* GetDialogDPObject() const { return pDialogDPObject; }
308 :
309 : sal_Bool GetDontSwitch(){return bDontSwitch;}
310 0 : void SetDontSwitch(sal_Bool bFlag){bDontSwitch=bFlag;}
311 :
312 :
313 : void SetAuditShell( sal_Bool bActive );
314 : void SetDrawFormShell( sal_Bool bActive );
315 : void SetEditShell(EditView* pView, sal_Bool bActive );
316 : void SetOleObjectShell( sal_Bool bActive );
317 : void SetChartShell( sal_Bool bActive );
318 : void SetGraphicShell( sal_Bool bActive );
319 : void SetMediaShell( sal_Bool bActive );
320 :
321 :
322 : void SetDrawShellOrSub();
323 : void SetCurSubShell( ObjectSelectionType eOST, sal_Bool bForce = false );
324 :
325 : void SetFormShellAtTop( sal_Bool bSet );
326 :
327 : ObjectSelectionType GetCurObjectSelectionType();
328 :
329 : virtual ErrCode DoVerb(long nVerb);
330 :
331 :
332 : void StopEditShell();
333 : sal_Bool IsDrawTextShell() const;
334 : sal_Bool IsAuditShell() const;
335 :
336 : void SetDrawTextUndo( ::svl::IUndoManager* pUndoMgr );
337 :
338 : void FillFieldData( ScHeaderFieldData& rData );
339 :
340 : void SetChartArea( const ScRangeListRef& rSource, const Rectangle& rDest );
341 : sal_Bool GetChartArea( ScRangeListRef& rSource, Rectangle& rDest, SCTAB& rTab ) const;
342 :
343 : void SetEditChartName(const String& aStr){aEditChartName=aStr;}
344 :
345 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
346 :
347 : ScNavigatorSettings* GetNavigatorSettings();
348 :
349 : // Drucken:
350 : virtual SfxPrinter* GetPrinter( sal_Bool bCreate = false );
351 : virtual sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter,
352 : sal_uInt16 nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false );
353 :
354 : virtual bool HasPrintOptionsPage() const;
355 : virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions );
356 :
357 : void ConnectObject( SdrOle2Obj* pObj );
358 : sal_Bool ActivateObject( SdrOle2Obj* pObj, long nVerb );
359 :
360 : void DeactivateOle();
361 :
362 : SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell();
363 : SfxModelessDialog* CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW,
364 : SfxChildWinInfo* pInfo,
365 : Window* pParent, sal_uInt16 nSlotId );
366 :
367 : void UpdateOleZoom();
368 : inline SbxObject* GetScSbxObject() const
369 : { return pScSbxObject; }
370 : inline void SetScSbxObject( SbxObject* pOb )
371 : { pScSbxObject = pOb; }
372 :
373 499 : FmFormShell* GetFormShell() const { return pFormShell; }
374 :
375 : void InsertURL( const String& rName, const String& rURL, const String& rTarget,
376 : sal_uInt16 nMode );
377 : void InsertURLButton( const String& rName, const String& rURL, const String& rTarget,
378 : const Point* pInsPos = NULL );
379 : void InsertURLField( const String& rName, const String& rURL, const String& rTarget );
380 :
381 : sal_Bool SelectObject( const String& rName );
382 :
383 0 : void SetInFormatDialog(sal_Bool bFlag) {bInFormatDialog=bFlag;}
384 : sal_Bool IsInFormatDialog() {return bInFormatDialog;}
385 :
386 528 : void ForceMove() { Move(); }
387 :
388 : void MakeNumberInfoItem ( ScDocument* pDoc,
389 : ScViewData* pViewData,
390 : SvxNumberInfoItem** ppItem );
391 :
392 : void UpdateNumberFormatter ( const SvxNumberInfoItem& rInfoItem );
393 :
394 : void ExecuteCellFormatDlg ( SfxRequest& rReq, const OString &rTabPage = OString());
395 :
396 : sal_Bool GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 );
397 :
398 : void StartSimpleRefDialog( const String& rTitle, const String& rInitVal,
399 : sal_Bool bCloseOnButtonUp, sal_Bool bSingleCell, sal_Bool bMultiSelection );
400 : void StopSimpleRefDialog();
401 :
402 : void SetCurRefDlgId( sal_uInt16 nNew );
403 :
404 : void AddAccessibilityObject( SfxListener& rObject );
405 : void RemoveAccessibilityObject( SfxListener& rObject );
406 : void BroadcastAccessibility( const SfxHint &rHint );
407 : sal_Bool HasAccessibilityObjects();
408 :
409 : bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
410 :
411 : using ScTabView::ShowCursor;
412 :
413 : // ugly hack to call Define Names from Manage Names
414 : void SwitchBetweenRefDialogs(SfxModelessDialog* pDialog);
415 : };
416 :
417 : //==================================================================
418 :
419 :
420 : #endif
421 :
422 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|