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