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