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 INCLUDED_SC_SOURCE_UI_INC_TABVWSH_HXX
21 : #define INCLUDED_SC_SOURCE_UI_INC_TABVWSH_HXX
22 :
23 : #include <svx/fmshell.hxx>
24 : #include <svtools/htmlcfg.hxx>
25 : #include <sfx2/viewsh.hxx>
26 : #include <sfx2/viewfac.hxx>
27 : #include <editeng/svxenum.hxx>
28 : #include "scdllapi.h"
29 : #include "dbfunc.hxx"
30 : #include "target.hxx"
31 : #include "rangelst.hxx"
32 : #include "shellids.hxx"
33 : #include "tabprotection.hxx"
34 :
35 : #include <boost/ptr_container/ptr_map.hpp>
36 :
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 : class ScTabViewShell: public SfxViewShell, public ScDBFunc
93 : {
94 : private:
95 : static sal_uInt16 nInsertCtrlState;
96 : static sal_uInt16 nInsCellsCtrlState;
97 : static sal_uInt16 nInsObjCtrlState;
98 :
99 : SvxHtmlOptions aHTMLOpt;
100 : ObjectSelectionType eCurOST;
101 : sal_uInt16 nDrawSfxId;
102 : sal_uInt16 nCtrlSfxId;
103 : sal_uInt16 nFormSfxId;
104 : OUString sDrawCustom; // current custom shape type
105 : ScDrawShell* pDrawShell;
106 : ScDrawTextObjectBar* pDrawTextShell;
107 : ScEditShell* pEditShell;
108 : ScPivotShell* pPivotShell;
109 : ScAuditingShell* pAuditingShell;
110 : ScDrawFormShell* pDrawFormShell;
111 : ScCellShell* pCellShell;
112 : ScOleObjectShell* pOleObjectShell;
113 : ScChartShell* pChartShell;
114 : ScGraphicShell* pGraphicShell;
115 : ScMediaShell* pMediaShell;
116 : ScPageBreakShell* pPageBreakShell;
117 : svx::ExtrusionBar* pExtrusionBarShell;
118 : svx::FontworkBar* pFontworkBarShell;
119 :
120 : FmFormShell* pFormShell;
121 :
122 : ScInputHandler* pInputHandler; // for OLE input cell
123 :
124 : ::editeng::SvxBorderLine* pCurFrameLine;
125 :
126 : ::com::sun::star::uno::Reference<
127 : ::com::sun::star::frame::XDispatchProviderInterceptor >
128 : xDisProvInterceptor;
129 :
130 : Point aWinPos;
131 :
132 : ScTabViewTarget aTarget;
133 : ScArea* pPivotSource;
134 : ScDPObject* pDialogDPObject;
135 :
136 : ScNavigatorSettings* pNavSettings;
137 :
138 : // used in first Activate
139 : bool bFirstActivate;
140 :
141 : bool bActiveDrawSh;
142 : bool bActiveDrawTextSh;
143 : bool bActivePivotSh;
144 : bool bActiveAuditingSh;
145 : bool bActiveDrawFormSh;
146 : bool bActiveOleObjectSh;
147 : bool bActiveChartSh;
148 : bool bActiveGraphicSh;
149 : bool bActiveMediaSh;
150 : bool bActiveEditSh;
151 :
152 : bool bFormShellAtTop; // does the FormShell need to be on top?
153 :
154 : bool bDontSwitch; // Don't turn off EditShell
155 : bool bInFormatDialog; // for GetSelectionText
156 : bool bPrintSelected; // for result of SvxPrtQryBox
157 :
158 : bool bReadOnly; // to detect status changes
159 :
160 : bool bIsActive;
161 :
162 : SbxObject* pScSbxObject;
163 :
164 : bool bChartAreaValid; // if chart is drawn
165 : bool bForceFocusOnCurCell; // #i123629#
166 :
167 : OUString 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 : OUString 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( TriState nForceDesignMode = TRISTATE_INDET );
186 :
187 : SfxShell* GetMySubShell() const;
188 :
189 : void DoReadUserData( const OUString& 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, OUString* );
195 : DECL_LINK( SimpleRefAborted, OUString* );
196 : DECL_LINK( SimpleRefChange, OUString* );
197 : DECL_LINK( FormControlActivated, void* );
198 :
199 : protected:
200 : virtual void Activate(bool bMDI) SAL_OVERRIDE;
201 : virtual void Deactivate(bool bMDI) SAL_OVERRIDE;
202 : virtual bool PrepareClose( bool bUI = true ) SAL_OVERRIDE;
203 :
204 : virtual void ShowCursor(bool bOn) SAL_OVERRIDE;
205 :
206 : virtual void Move() SAL_OVERRIDE; // Benachrichtigung
207 :
208 : virtual void AdjustPosSizePixel( const Point &rPos, const Size &rSize ) SAL_OVERRIDE; // alt
209 :
210 : virtual void InnerResizePixel( const Point &rOfs, const Size &rSize ) SAL_OVERRIDE; // neu
211 : virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) SAL_OVERRIDE;
212 : virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) SAL_OVERRIDE;
213 :
214 : virtual void QueryObjAreaPixel( Rectangle& rRect ) const SAL_OVERRIDE;
215 :
216 : virtual OUString GetSelectionText( bool bWholeWord ) SAL_OVERRIDE;
217 : virtual bool HasSelection( bool bText ) const SAL_OVERRIDE;
218 :
219 : virtual void WriteUserData(OUString &, bool bBrowse = false) SAL_OVERRIDE;
220 : virtual void ReadUserData(const OUString &, bool bBrowse = false) SAL_OVERRIDE;
221 : virtual void WriteUserDataSequence (::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, bool bBrowse = false ) SAL_OVERRIDE;
222 : virtual void ReadUserDataSequence (const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, bool bBrowse = false ) SAL_OVERRIDE;
223 :
224 : virtual void UIDeactivated( SfxInPlaceClient* pClient ) SAL_OVERRIDE;
225 :
226 : virtual bool KeyInput( const KeyEvent &rKeyEvent ) SAL_OVERRIDE;
227 : virtual SdrView* GetDrawView() const SAL_OVERRIDE;
228 :
229 : public:
230 : TYPEINFO_VISIBILITY_OVERRIDE(SC_DLLPUBLIC);
231 104 : SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL)
232 52 : SFX_DECL_VIEWFACTORY(ScTabViewShell);
233 :
234 : private:
235 : /// SfxInterface initializer.
236 : static void InitInterface_Impl();
237 :
238 : public:
239 : /** -> Clone Method for Factory
240 : Created from a general shell and inherit as much as possible */
241 : ScTabViewShell( SfxViewFrame* pViewFrame,
242 : SfxViewShell* pOldSh );
243 :
244 : virtual ~ScTabViewShell();
245 :
246 : SC_DLLPUBLIC vcl::Window* GetDialogParent();
247 :
248 : bool IsRefInputMode() const;
249 : void ExecuteInputDirect();
250 :
251 21491 : ScInputHandler* GetInputHandler() const { return pInputHandler;}
252 : void UpdateInputHandler( bool bForce = false, bool bStopEditing = true );
253 : void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
254 : bool TabKeyInput(const KeyEvent& rKEvt);
255 : bool SfxKeyInput(const KeyEvent& rKEvt);
256 :
257 : void SetActive();
258 :
259 0 : ::editeng::SvxBorderLine* GetDefaultFrameLine() const { return pCurFrameLine; }
260 : void SetDefaultFrameLine(const ::editeng::SvxBorderLine* pLine );
261 :
262 : SC_DLLPUBLIC void Execute( SfxRequest& rReq );
263 : SC_DLLPUBLIC void GetState( SfxItemSet& rSet );
264 :
265 : void ExecuteTable( SfxRequest& rReq );
266 : void GetStateTable( SfxItemSet& rSet );
267 :
268 : void WindowChanged();
269 : void ExecDraw(SfxRequest&);
270 : void ExecDrawIns(SfxRequest& rReq);
271 : void GetDrawState(SfxItemSet &rSet);
272 : void GetDrawInsState(SfxItemSet &rSet);
273 : void ExecGallery(SfxRequest& rReq);
274 :
275 : void ExecChildWin(SfxRequest& rReq);
276 :
277 : void ExecImageMap( SfxRequest& rReq );
278 : void GetImageMapState( SfxItemSet& rSet );
279 :
280 : void ExecTbx( SfxRequest& rReq );
281 : static 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 : static void ExecuteSbx( SfxRequest& rReq );
291 : static 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( bool bActive );
301 : void SetDrawTextShell( bool bActive );
302 :
303 : void SetPivotShell( 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 : bool GetDontSwitch(){return bDontSwitch;}
310 0 : void SetDontSwitch(bool bFlag){bDontSwitch=bFlag;}
311 :
312 : void SetAuditShell( bool bActive );
313 : void SetDrawFormShell( bool bActive );
314 : void SetEditShell(EditView* pView, bool bActive );
315 : void SetOleObjectShell( bool bActive );
316 : void SetChartShell( bool bActive );
317 : void SetGraphicShell( bool bActive );
318 : void SetMediaShell( bool bActive );
319 :
320 : void SetDrawShellOrSub();
321 : void SetCurSubShell( ObjectSelectionType eOST, bool bForce = false );
322 :
323 : void SetFormShellAtTop( bool bSet );
324 :
325 85 : ObjectSelectionType GetCurObjectSelectionType() { return eCurOST; }
326 :
327 : virtual ErrCode DoVerb(long nVerb) SAL_OVERRIDE;
328 :
329 : void StopEditShell();
330 : bool IsDrawTextShell() const;
331 : bool IsAuditShell() const;
332 :
333 : void SetDrawTextUndo( ::svl::IUndoManager* pUndoMgr );
334 :
335 : void FillFieldData( ScHeaderFieldData& rData );
336 :
337 : bool GetChartArea( ScRangeListRef& rSource, Rectangle& rDest, SCTAB& rTab ) const;
338 :
339 : void SetEditChartName(const OUString& aStr){aEditChartName=aStr;}
340 :
341 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
342 :
343 : ScNavigatorSettings* GetNavigatorSettings();
344 :
345 : // Drucken:
346 : virtual SfxPrinter* GetPrinter( bool bCreate = false ) SAL_OVERRIDE;
347 : virtual sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter,
348 : SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false ) SAL_OVERRIDE;
349 :
350 : virtual bool HasPrintOptionsPage() const SAL_OVERRIDE;
351 : virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( vcl::Window *pParent, const SfxItemSet &rOptions ) SAL_OVERRIDE;
352 :
353 : void ConnectObject( SdrOle2Obj* pObj );
354 : bool ActivateObject( SdrOle2Obj* pObj, long nVerb );
355 :
356 : void DeactivateOle();
357 :
358 : SC_DLLPUBLIC static ScTabViewShell* GetActiveViewShell();
359 : VclPtr<SfxModelessDialog> CreateRefDialog( SfxBindings* pB, SfxChildWindow* pCW,
360 : SfxChildWinInfo* pInfo,
361 : vcl::Window* pParent, sal_uInt16 nSlotId );
362 :
363 : void UpdateOleZoom();
364 : inline SbxObject* GetScSbxObject() const
365 : { return pScSbxObject; }
366 : inline void SetScSbxObject( SbxObject* pOb )
367 : { pScSbxObject = pOb; }
368 :
369 0 : virtual const FmFormShell* GetFormShell() const SAL_OVERRIDE { return pFormShell; }
370 946 : virtual FmFormShell* GetFormShell() SAL_OVERRIDE { return pFormShell; }
371 :
372 : void InsertURL( const OUString& rName, const OUString& rURL, const OUString& rTarget,
373 : sal_uInt16 nMode );
374 : void InsertURLButton( const OUString& rName, const OUString& rURL, const OUString& rTarget,
375 : const Point* pInsPos = NULL );
376 : void InsertURLField( const OUString& rName, const OUString& rURL, const OUString& rTarget );
377 :
378 : bool SelectObject( const OUString& rName );
379 :
380 0 : void SetInFormatDialog(bool bFlag) {bInFormatDialog=bFlag;}
381 : bool IsInFormatDialog() {return bInFormatDialog;}
382 :
383 1155 : void ForceMove() { Move(); }
384 :
385 : static SvxNumberInfoItem* MakeNumberInfoItem( ScDocument* pDoc, ScViewData* pViewData );
386 :
387 : static void UpdateNumberFormatter( const SvxNumberInfoItem& rInfoItem );
388 :
389 : void ExecuteCellFormatDlg( SfxRequest& rReq, const OString &rTabPage = OString());
390 :
391 : bool GetFunction( OUString& rFuncStr, sal_uInt16 nErrCode = 0 );
392 :
393 : void StartSimpleRefDialog( const OUString& rTitle, const OUString& rInitVal,
394 : bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection );
395 : void StopSimpleRefDialog();
396 :
397 : void SetCurRefDlgId( sal_uInt16 nNew );
398 :
399 : void AddAccessibilityObject( SfxListener& rObject );
400 : void RemoveAccessibilityObject( SfxListener& rObject );
401 : void BroadcastAccessibility( const SfxHint &rHint );
402 : bool HasAccessibilityObjects();
403 :
404 : bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
405 :
406 : using ScTabView::ShowCursor;
407 :
408 0 : bool IsActive() const { return bIsActive; }
409 : OUString GetFormula(ScAddress& rAddress);
410 :
411 : // ugly hack to call Define Names from Manage Names
412 : void SwitchBetweenRefDialogs(SfxModelessDialog* pDialog);
413 : // #i123629#
414 86 : bool GetForceFocusOnCurCell() const { return bForceFocusOnCurCell; }
415 83 : void SetForceFocusOnCurCell(bool bFlag) { bForceFocusOnCurCell=bFlag; }
416 : };
417 :
418 : #endif
419 :
420 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|