LibreOffice Module sc (master)  1
tabvwsh.hxx
Go to the documentation of this file.
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 <com/sun/star/drawing/QRCode.hpp>
24 #include <formula/errorcodes.hxx>
25 #include <formula/opcode.hxx>
26 #include <svx/fmshell.hxx>
27 #include <sfx2/viewsh.hxx>
28 #include <editeng/svxenum.hxx>
29 #include <o3tl/deleter.hxx>
30 #include <scdllapi.h>
31 #include "dbfunc.hxx"
32 #include "target.hxx"
33 #include <shellids.hxx>
34 #include <tabprotection.hxx>
35 #include <com/sun/star/ui/dialogs/XDialogClosedListener.hpp>
36 
37 #include <memory>
38 #include <map>
39 
40 class SdrOle2Obj;
41 class SfxBindings;
42 class SfxChildWindow;
43 class SvxNumberInfoItem;
44 struct SfxChildWinInfo;
45 
46 class ScArea;
47 class ScAuditingShell;
48 class ScDrawShell;
50 class ScEditShell;
51 class ScInputHandler;
52 class ScPivotShell;
53 class ScDrawFormShell;
54 class ScCellShell;
55 class ScOleObjectShell;
56 class ScGraphicShell;
57 class ScMediaShell;
58 class ScChartShell;
59 class ScPageBreakShell;
60 class ScDPObject;
62 class ScRangeName;
63 
64 struct ScHeaderFieldData;
65 
66 namespace editeng { class SvxBorderLine; }
67 
68 namespace com::sun::star::frame { class XDispatchProviderInterceptor; }
69 
70 namespace svx {
71  class ExtrusionBar;
72  class FontworkBar;
73 }
74 
76 {
89 };
90 
91 class ScFormEditData;
93 {
94 private:
96  sal_uInt16 nDrawSfxId;
97  sal_uInt16 nFormSfxId;
98  OUString sDrawCustom; // current custom shape type
99  std::unique_ptr<ScDrawShell> pDrawShell;
100  std::unique_ptr<ScDrawTextObjectBar> pDrawTextShell;
101  std::unique_ptr<ScEditShell> pEditShell;
102  std::unique_ptr<ScPivotShell> pPivotShell;
103  std::unique_ptr<ScAuditingShell> pAuditingShell;
104  std::unique_ptr<ScDrawFormShell> pDrawFormShell;
105  std::unique_ptr<ScCellShell> pCellShell;
106  std::unique_ptr<ScOleObjectShell> pOleObjectShell;
107  std::unique_ptr<ScChartShell> pChartShell;
108  std::unique_ptr<ScGraphicShell> pGraphicShell;
109  std::unique_ptr<ScMediaShell> pMediaShell;
110  std::unique_ptr<ScPageBreakShell> pPageBreakShell;
111  std::unique_ptr<svx::ExtrusionBar> pExtrusionBarShell;
112  std::unique_ptr<svx::FontworkBar> pFontworkBarShell;
113 
114  std::unique_ptr<FmFormShell> pFormShell;
115 
116  std::unique_ptr<ScFormEditData> mpFormEditData;
117  std::unique_ptr<ScInputHandler, o3tl::default_delete<ScInputHandler>> mpInputHandler; // for OLE input cell
118 
119  std::unique_ptr<::editeng::SvxBorderLine> pCurFrameLine;
120 
121  css::uno::Reference< css::frame::XDispatchProviderInterceptor >
123 
125 
127  std::unique_ptr<ScDPObject> pDialogDPObject;
128 
129  std::unique_ptr<ScNavigatorSettings> pNavSettings;
130 
131  // used in first Activate
133 
142 
143  bool bFormShellAtTop; // does the FormShell need to be on top?
144 
145  bool bDontSwitch; // Don't turn off EditShell
146  bool bInFormatDialog; // for GetSelectionText
147 
148  bool bReadOnly; // to detect status changes
149 
150  bool bIsActive;
151 
152  bool bForceFocusOnCurCell; // #i123629#
153 
156 
157  sal_uInt16 nCurRefDlgId;
158 
159  std::unique_ptr<SfxBroadcaster> pAccessibilityBroadcaster;
160 
161  // ugly hack for Add button in ScNameDlg
162  std::map<OUString, std::unique_ptr<ScRangeName>> m_RangeMap;
164  OUString maName;
165  OUString maScope;
166 private:
167  void Construct( TriState nForceDesignMode );
168 
169  SfxShell* GetMySubShell() const;
170 
171  void DoReadUserData( const OUString& rData );
172  void DoReadUserDataSequence( const css::uno::Sequence< css::beans::PropertyValue >& rSettings );
173  bool IsSignatureLineSelected();
174  bool IsSignatureLineSigned();
175  bool IsQRCodeSelected();
176 
177  DECL_LINK( SimpleRefClose, const OUString*, void );
178  DECL_LINK( SimpleRefDone, const OUString&, void );
179  DECL_LINK( SimpleRefAborted, const OUString&, void );
180  DECL_LINK( SimpleRefChange, const OUString&, void );
181  DECL_LINK( FormControlActivated, LinkParamNone*, void );
182  DECL_LINK( DialogClosedHdl, css::ui::dialogs::DialogClosedEvent*, void );
183 
184 protected:
185  virtual void Activate(bool bMDI) override;
186  virtual void Deactivate(bool bMDI) override;
187  virtual bool PrepareClose( bool bUI = true ) override;
188 
189  virtual void ShowCursor(bool bOn) override;
190 
191  virtual void Move() override; // notification
192 
193  virtual void InnerResizePixel( const Point &rOfs, const Size &rSize, bool inplaceEditModeChange ) override; // new
194  virtual void OuterResizePixel( const Point &rOfs, const Size &rSize ) override;
195  virtual void SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) override;
196 
197  virtual void QueryObjAreaPixel( tools::Rectangle& rRect ) const override;
198 
199  virtual OUString GetSelectionText( bool bWholeWord = false ) override;
200  virtual bool HasSelection( bool bText = true ) const override;
201 
202  virtual void WriteUserData(OUString &, bool bBrowse = false) override;
203  virtual void ReadUserData(const OUString &, bool bBrowse = false) override;
204  virtual void WriteUserDataSequence (css::uno::Sequence < css::beans::PropertyValue >& ) override;
205  virtual void ReadUserDataSequence (const css::uno::Sequence < css::beans::PropertyValue >& ) override;
206 
207  virtual void UIDeactivated( SfxInPlaceClient* pClient ) override;
208 
209  virtual bool KeyInput( const KeyEvent &rKeyEvent ) override;
210  virtual SdrView* GetDrawView() const override;
211 
212 public:
214  SFX_DECL_VIEWFACTORY(ScTabViewShell);
215 
216 private:
218  static void InitInterface_Impl();
219 
220 public:
223  ScTabViewShell( SfxViewFrame* pViewFrame,
224  SfxViewShell* pOldSh );
225 
226  virtual ~ScTabViewShell() override;
227 
228  weld::Window* GetDialogParent();
229 
230  bool IsRefInputMode() const;
231  void ExecuteInputDirect();
232 
233  const ScInputHandler* GetInputHandler() const { return mpInputHandler.get(); }
234  ScInputHandler* GetInputHandler() { return mpInputHandler.get(); }
235  void UpdateInputHandler( bool bForce = false, bool bStopEditing = true );
236  void UpdateInputHandlerCellAdjust( SvxCellHorJustify eJust );
237  bool TabKeyInput(const KeyEvent& rKEvt);
238  bool SfxKeyInput(const KeyEvent& rKEvt);
239 
240  void SetActive();
241 
242  ::editeng::SvxBorderLine* GetDefaultFrameLine() const { return pCurFrameLine.get(); }
243  void SetDefaultFrameLine(const ::editeng::SvxBorderLine* pLine );
244 
245  void Execute( SfxRequest& rReq );
246  void GetState( SfxItemSet& rSet );
247 
248  void ExecuteTable( SfxRequest& rReq );
249  void GetStateTable( SfxItemSet& rSet );
250 
251  void WindowChanged();
252  void ExecDraw(SfxRequest&);
253  void ExecDrawIns(SfxRequest& rReq);
254  void GetDrawState(SfxItemSet &rSet);
255  void GetDrawInsState(SfxItemSet &rSet);
256  void ExecGallery(const SfxRequest& rReq);
257 
258  void ExecChildWin(const SfxRequest& rReq);
259 
260  void ExecImageMap( SfxRequest& rReq );
261  void GetImageMapState( SfxItemSet& rSet );
262 
263  void ExecuteSave( SfxRequest& rReq );
264  void GetSaveState( SfxItemSet& rSet );
265  void ExecSearch( SfxRequest& rReq );
266 
267  void ExecuteUndo(SfxRequest& rReq);
268  void GetUndoState(SfxItemSet &rSet);
269 
270  void ExecuteObject(const SfxRequest& rReq);
271  void GetObjectState(SfxItemSet &rSet);
272 
273  void ExecDrawOpt(const SfxRequest& rReq);
274  void GetDrawOptState(SfxItemSet &rSet);
275 
276  void UpdateDrawShell();
277  void SetDrawShell( bool bActive );
278  void SetDrawTextShell( bool bActive );
279 
280  void SetPivotShell( bool bActive );
281  void SetDialogDPObject( std::unique_ptr<ScDPObject> pObj );
282  const ScDPObject* GetDialogDPObject() const { return pDialogDPObject.get(); }
283 
284  void SetDontSwitch(bool bFlag){bDontSwitch=bFlag;}
285 
286  void SetAuditShell( bool bActive );
287  void SetDrawFormShell( bool bActive );
288  void SetEditShell(EditView* pView, bool bActive );
289  void SetOleObjectShell( bool bActive );
290  void SetChartShell( bool bActive );
291  void SetGraphicShell( bool bActive );
292  void SetMediaShell( bool bActive );
293 
294  void SetDrawShellOrSub();
295  void SetCurSubShell( ObjectSelectionType eOST, bool bForce = false );
296 
297  void SetFormShellAtTop( bool bSet );
298 
299  ObjectSelectionType GetCurObjectSelectionType() const { return eCurOST; }
300 
301  virtual ErrCode DoVerb(tools::Long nVerb) override;
302 
303  void StopEditShell();
304  bool IsDrawTextShell() const;
305  bool IsAuditShell() const;
306 
307  void SetDrawTextUndo( SfxUndoManager* pUndoMgr );
308 
309  void FillFieldData( ScHeaderFieldData& rData );
310 
311  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
312 
313  ScNavigatorSettings* GetNavigatorSettings();
314 
315  // Drucken:
316  virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
317  virtual sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter,
318  SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override;
319 
320  virtual bool HasPrintOptionsPage() const override;
321  virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rOptions) override;
322 
323  void ConnectObject( const SdrOle2Obj* pObj );
324  void ActivateObject( SdrOle2Obj* pObj, tools::Long nVerb );
325 
326  void DeactivateOle();
327 
328  static ScTabViewShell* GetActiveViewShell();
329 
330  std::shared_ptr<SfxModelessDialogController> CreateRefDialogController(SfxBindings* pB, SfxChildWindow* pCW,
331  const SfxChildWinInfo* pInfo,
332  weld::Window* pParent, sal_uInt16 nSlotId);
333 
334  void UpdateOleZoom();
335 
336  virtual const FmFormShell* GetFormShell() const override { return pFormShell.get(); }
337  virtual FmFormShell* GetFormShell() override { return pFormShell.get(); }
338 
339  void InsertURL( const OUString& rName, const OUString& rURL, const OUString& rTarget,
340  sal_uInt16 nMode );
341  void InsertURLButton( const OUString& rName, const OUString& rURL, const OUString& rTarget,
342  const Point* pInsPos );
343  void InsertURLField( const OUString& rName, const OUString& rURL, const OUString& rTarget );
344 
345  bool SelectObject( const OUString& rName );
346 
347  void SetInFormatDialog(bool bFlag) {bInFormatDialog=bFlag;}
348 
349  void ForceMove() { Move(); }
350 
351  static std::unique_ptr<SvxNumberInfoItem> MakeNumberInfoItem( ScDocument& rDoc, const ScViewData* pViewData );
352 
353  static void UpdateNumberFormatter( const SvxNumberInfoItem& rInfoItem );
354 
355  void ExecuteCellFormatDlg( SfxRequest& rReq, const OString &rTabPage);
356 
357  bool GetFunction( OUString& rFuncStr, FormulaError nErrCode );
358 
359  void StartSimpleRefDialog( const OUString& rTitle, const OUString& rInitVal,
360  bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection );
361  void StopSimpleRefDialog();
362 
363  void SetCurRefDlgId( sal_uInt16 nNew );
364 
365  void AddAccessibilityObject( SfxListener& rObject );
366  void RemoveAccessibilityObject( SfxListener& rObject );
367  void BroadcastAccessibility( const SfxHint &rHint );
368  bool HasAccessibilityObjects() const;
369 
370  bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
371 
372  using ScTabView::ShowCursor;
373 
374  bool IsActive() const { return bIsActive; }
375  OUString GetFormula(const ScAddress& rAddress);
376  bool UseSubTotal(ScRangeList* pRangeList);
377  OUString DoAutoSum(bool& rRangeFinder, bool& rSubTotal, const OpCode eCode);
378 
379  // ugly hack to call Define Names from Manage Names
380  void SwitchBetweenRefDialogs(SfxModelessDialogController* pDialog);
381  // #i123629#
382  bool GetForceFocusOnCurCell() const { return bForceFocusOnCurCell; }
383  void SetForceFocusOnCurCell(bool bFlag) { bForceFocusOnCurCell=bFlag; }
385  int getPart() const override;
387  void afterCallbackRegistered() override;
389  void NotifyCursor(SfxViewShell* pViewShell) const override;
391  static void notifyAllViewsHeaderInvalidation(const SfxViewShell* pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex);
392  static bool isAnyEditViewInRange(const SfxViewShell* pForViewShell, bool bColumns, SCCOLROW nStart, SCCOLROW nEnd);
395  static void notifyAllViewsSheetGeomInvalidation(const SfxViewShell* pForViewShell, bool bColumns, bool bRows, bool bSizes,
396  bool bHidden, bool bFiltered, bool bGroups, SCTAB nCurrentTabIndex);
397  css::uno::Reference<css::drawing::XShapes> getSelectedXShapes();
398  static css::uno::Reference<css::datatransfer::XTransferable2> GetClipData(vcl::Window* pWin);
399 
400  void InitFormEditData();
401  void ClearFormEditData();
402  ScFormEditData* GetFormEditData() { return mpFormEditData.get(); }
403 };
404 
405 #endif
406 
407 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxCellHorJustify
void ForceMove()
Definition: tabvwsh.hxx:349
DECL_LINK(ScrollHdl, ScrollBar *, void)
OUString sDrawCustom
Definition: tabvwsh.hxx:98
bool bFormShellAtTop
Definition: tabvwsh.hxx:143
bool bFirstActivate
Definition: tabvwsh.hxx:132
std::unique_ptr< ScInputHandler, o3tl::default_delete< ScInputHandler > > mpInputHandler
Definition: tabvwsh.hxx:117
const ScDPObject * GetDialogDPObject() const
Definition: tabvwsh.hxx:282
virtual const FmFormShell * GetFormShell() const override
Definition: tabvwsh.hxx:336
std::unique_ptr< ScGraphicShell > pGraphicShell
Definition: tabvwsh.hxx:108
HeaderType
Definition: tabview.hxx:58
virtual std::unique_ptr< SfxTabPage > CreatePrintOptionsPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rOptions)
virtual FmFormShell * GetFormShell() override
Definition: tabvwsh.hxx:337
#define SCID_TABVIEW_SHELL
Definition: shellids.hxx:26
std::unique_ptr< ScDPObject > pDialogDPObject
Definition: tabvwsh.hxx:127
std::map< OUString, std::unique_ptr< ScRangeName > > m_RangeMap
Definition: tabvwsh.hxx:162
bool bActiveGraphicSh
Definition: tabvwsh.hxx:139
long Long
sal_uInt16 nCurRefDlgId
Definition: tabvwsh.hxx:157
std::unique_ptr< ScMediaShell > pMediaShell
Definition: tabvwsh.hxx:109
bool bInPrepareClose
Definition: tabvwsh.hxx:154
std::unique_ptr< ScOleObjectShell > pOleObjectShell
Definition: tabvwsh.hxx:106
bool GetForceFocusOnCurCell() const
Definition: tabvwsh.hxx:382
Contains settings of the navigator listbox.
Definition: navsett.hxx:30
bool IsActive() const
Definition: tabvwsh.hxx:374
virtual void InnerResizePixel(const Point &rOfs, const Size &rSize, bool inplaceEditModeChange)
std::unique_ptr< ScCellShell > pCellShell
Definition: tabvwsh.hxx:105
virtual OUString GetSelectionText(bool bCompleteWords=false)
void SetDontSwitch(bool bFlag)
Definition: tabvwsh.hxx:284
bool bActiveDrawFormSh
Definition: tabvwsh.hxx:136
std::unique_ptr< FmFormShell > pFormShell
Definition: tabvwsh.hxx:114
virtual bool HasPrintOptionsPage() const
bool bActiveDrawSh
Definition: tabvwsh.hxx:134
bool bActiveDrawTextSh
Definition: tabvwsh.hxx:135
virtual void WriteUserData(OUString &, bool bBrowse=false)
virtual sal_uInt16 SetPrinter(SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags=SFX_PRINTER_ALL)
virtual int getPart() const
SfxPrinterChangeFlags
std::unique_ptr< ScEditShell > pEditShell
Definition: tabvwsh.hxx:101
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:24
css::uno::Reference< css::frame::XDispatchProviderInterceptor > xDisProvInterceptor
Definition: tabvwsh.hxx:122
void SetForceFocusOnCurCell(bool bFlag)
Definition: tabvwsh.hxx:383
OpCode
ScTabViewTarget aTarget
Definition: tabvwsh.hxx:126
ScPasswordHash
std::unique_ptr< ScDrawFormShell > pDrawFormShell
Definition: tabvwsh.hxx:104
bool bForceFocusOnCurCell
Definition: tabvwsh.hxx:152
std::unique_ptr< ScNavigatorSettings > pNavSettings
Definition: tabvwsh.hxx:129
std::unique_ptr< ScDrawTextObjectBar > pDrawTextShell
Definition: tabvwsh.hxx:100
::editeng::SvxBorderLine * GetDefaultFrameLine() const
Definition: tabvwsh.hxx:242
ScFormEditData * GetFormEditData()
Definition: tabvwsh.hxx:402
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
Definition: docsh.hxx:477
std::unique_ptr< svx::FontworkBar > pFontworkBarShell
Definition: tabvwsh.hxx:112
std::unique_ptr< ScPivotShell > pPivotShell
Definition: tabvwsh.hxx:102
OUString maScope
Definition: tabvwsh.hxx:165
virtual void ReadUserData(const OUString &, bool bBrowse=false)
virtual void OuterResizePixel(const Point &rOfs, const Size &rSize)
virtual void Activate(bool IsMDIActivate) override
bool bInFormatDialog
Definition: tabvwsh.hxx:146
bool bActiveEditSh
Definition: tabvwsh.hxx:141
sal_uInt16 nDrawSfxId
Definition: tabvwsh.hxx:96
virtual void QueryObjAreaPixel(tools::Rectangle &rRect) const
sal_uInt16 nFormSfxId
Definition: tabvwsh.hxx:97
virtual void UIDeactivated(SfxInPlaceClient *pClient)
virtual void Deactivate(bool IsMDIActivate) override
FormulaError
std::unique_ptr< ScDrawShell > pDrawShell
Definition: tabvwsh.hxx:99
virtual void NotifyCursor(SfxViewShell *) const
virtual void afterCallbackRegistered()
std::unique_ptr< ScChartShell > pChartShell
Definition: tabvwsh.hxx:107
std::unique_ptr< ScFormEditData > mpFormEditData
Definition: tabvwsh.hxx:116
virtual void WriteUserDataSequence(css::uno::Sequence< css::beans::PropertyValue > &)
virtual ErrCode DoVerb(tools::Long nVerb)
ObjectSelectionType eCurOST
Definition: tabvwsh.hxx:95
bool bActiveOleObjectSh
Definition: tabvwsh.hxx:137
bool bActiveMediaSh
Definition: tabvwsh.hxx:140
std::unique_ptr< SfxBroadcaster > pAccessibilityBroadcaster
Definition: tabvwsh.hxx:159
OUString maName
Definition: tabvwsh.hxx:164
virtual SfxPrinter * GetPrinter(bool bCreate=false)
virtual SdrView * GetDrawView() const
void ShowCursor()
Definition: tabview3.cxx:241
ScInputHandler * GetInputHandler()
Definition: tabvwsh.hxx:234
std::unique_ptr< svx::ExtrusionBar > pExtrusionBarShell
Definition: tabvwsh.hxx:111
ObjectSelectionType GetCurObjectSelectionType() const
Definition: tabvwsh.hxx:299
virtual bool KeyInput(const KeyEvent &rKeyEvent)
std::unique_ptr<::editeng::SvxBorderLine > pCurFrameLine
Definition: tabvwsh.hxx:119
virtual void Move()
virtual bool HasSelection(bool bText=true) const
virtual void ReadUserDataSequence(const css::uno::Sequence< css::beans::PropertyValue > &)
TriState
std::unique_ptr< ScAuditingShell > pAuditingShell
Definition: tabvwsh.hxx:103
ObjectSelectionType
Definition: tabvwsh.hxx:75
bool bDontSwitch
Definition: tabvwsh.hxx:145
#define SC_DLLPUBLIC
Definition: scdllapi.h:28
bool bActiveChartSh
Definition: tabvwsh.hxx:138
std::unique_ptr< ScPageBreakShell > pPageBreakShell
Definition: tabvwsh.hxx:110
virtual bool PrepareClose(bool bUI=true)
sal_Int16 SCTAB
Definition: types.hxx:23
virtual void SetZoomFactor(const Fraction &rZoomX, const Fraction &rZoomY)
#define SFX_DECL_INTERFACE(nId)
void SetInFormatDialog(bool bFlag)
Definition: tabvwsh.hxx:347