nss: upgrade to release 3.73
[LibreOffice.git] / sc / source / ui / inc / tabvwsh.hxx
blob480f4ca9c73b51db4354ed9c53b3b260618e1fb4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_TABVWSH_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_TABVWSH_HXX
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>
37 #include <memory>
38 #include <map>
40 class SdrOle2Obj;
41 class SfxBindings;
42 class SfxChildWindow;
43 class SvxNumberInfoItem;
44 struct SfxChildWinInfo;
46 class ScArea;
47 class ScAuditingShell;
48 class ScDrawShell;
49 class ScDrawTextObjectBar;
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;
61 class ScNavigatorSettings;
62 class ScRangeName;
64 struct ScHeaderFieldData;
66 namespace editeng { class SvxBorderLine; }
68 namespace com::sun::star::frame { class XDispatchProviderInterceptor; }
70 namespace svx {
71 class ExtrusionBar;
72 class FontworkBar;
75 enum ObjectSelectionType
77 OST_NONE,
78 OST_Cell,
79 OST_Editing,
80 OST_DrawText,
81 OST_Drawing,
82 OST_DrawForm,
83 OST_Pivot,
84 OST_Auditing,
85 OST_OleObject,
86 OST_Chart,
87 OST_Graphic,
88 OST_Media
91 class ScFormEditData;
92 class SC_DLLPUBLIC ScTabViewShell: public SfxViewShell, public ScDBFunc
94 private:
95 ObjectSelectionType eCurOST;
96 sal_uInt16 nDrawSfxId;
97 SdrObjKind eFormObjKind;
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;
114 std::unique_ptr<FmFormShell> pFormShell;
116 std::unique_ptr<ScFormEditData> mpFormEditData;
117 std::unique_ptr<ScInputHandler, o3tl::default_delete<ScInputHandler>> mpInputHandler; // for OLE input cell
119 std::unique_ptr<::editeng::SvxBorderLine> pCurFrameLine;
121 css::uno::Reference< css::frame::XDispatchProviderInterceptor >
122 xDisProvInterceptor;
124 Point aWinPos;
126 ScTabViewTarget aTarget;
127 std::unique_ptr<ScDPObject> pDialogDPObject;
129 std::unique_ptr<ScNavigatorSettings> pNavSettings;
131 // used in first Activate
132 bool bFirstActivate;
134 bool bActiveDrawSh;
135 bool bActiveDrawTextSh;
136 bool bActiveDrawFormSh;
137 bool bActiveOleObjectSh;
138 bool bActiveChartSh;
139 bool bActiveGraphicSh;
140 bool bActiveMediaSh;
141 bool bActiveEditSh;
143 bool bFormShellAtTop; // does the FormShell need to be on top?
145 bool bDontSwitch; // Don't turn off EditShell
146 bool bInFormatDialog; // for GetSelectionText
148 bool bReadOnly; // to detect status changes
150 bool bIsActive;
152 bool bForceFocusOnCurCell; // #i123629#
154 bool bInPrepareClose;
155 bool bInDispose;
157 sal_uInt16 nCurRefDlgId;
159 std::unique_ptr<SfxBroadcaster> pAccessibilityBroadcaster;
161 // ugly hack for Add button in ScNameDlg
162 std::map<OUString, std::unique_ptr<ScRangeName>> m_RangeMap;
163 bool mbInSwitch;
164 OUString maName;
165 OUString maScope;
166 private:
167 void Construct( TriState nForceDesignMode );
169 SfxShell* GetMySubShell() const;
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();
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 );
184 protected:
185 virtual void Activate(bool bMDI) override;
186 virtual void Deactivate(bool bMDI) override;
187 virtual bool PrepareClose( bool bUI = true ) override;
189 virtual void ShowCursor(bool bOn) override;
191 virtual void Move() override; // notification
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;
197 virtual void QueryObjAreaPixel( tools::Rectangle& rRect ) const override;
199 virtual OUString GetSelectionText( bool bWholeWord = false ) override;
200 virtual bool HasSelection( bool bText = true ) const override;
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;
207 virtual void UIDeactivated( SfxInPlaceClient* pClient ) override;
209 virtual bool KeyInput( const KeyEvent &rKeyEvent ) override;
210 virtual SdrView* GetDrawView() const override;
212 public:
213 SFX_DECL_INTERFACE(SCID_TABVIEW_SHELL)
214 SFX_DECL_VIEWFACTORY(ScTabViewShell);
216 private:
217 /// SfxInterface initializer.
218 static void InitInterface_Impl();
220 public:
221 /** -> Clone Method for Factory
222 Created from a general shell and inherit as much as possible */
223 ScTabViewShell( SfxViewFrame* pViewFrame,
224 SfxViewShell* pOldSh );
226 virtual ~ScTabViewShell() override;
228 weld::Window* GetDialogParent();
230 bool IsRefInputMode() const;
231 void ExecuteInputDirect();
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);
240 void SetActive();
242 ::editeng::SvxBorderLine* GetDefaultFrameLine() const { return pCurFrameLine.get(); }
243 void SetDefaultFrameLine(const ::editeng::SvxBorderLine* pLine );
245 void Execute( SfxRequest& rReq );
246 void GetState( SfxItemSet& rSet );
248 void ExecuteTable( SfxRequest& rReq );
249 void GetStateTable( SfxItemSet& rSet );
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);
258 void ExecChildWin(const SfxRequest& rReq);
260 void ExecImageMap( SfxRequest& rReq );
261 void GetImageMapState( SfxItemSet& rSet );
263 void ExecuteSave( SfxRequest& rReq );
264 void GetSaveState( SfxItemSet& rSet );
265 void ExecSearch( SfxRequest& rReq );
267 void ExecuteUndo(SfxRequest& rReq);
268 void GetUndoState(SfxItemSet &rSet);
270 void ExecuteObject(const SfxRequest& rReq);
271 void GetObjectState(SfxItemSet &rSet);
273 void ExecDrawOpt(const SfxRequest& rReq);
274 void GetDrawOptState(SfxItemSet &rSet);
276 void UpdateDrawShell();
277 void SetDrawShell( bool bActive );
278 void SetDrawTextShell( bool bActive );
280 void SetPivotShell( bool bActive );
281 void SetDialogDPObject( std::unique_ptr<ScDPObject> pObj );
282 const ScDPObject* GetDialogDPObject() const { return pDialogDPObject.get(); }
284 void SetDontSwitch(bool bFlag){bDontSwitch=bFlag;}
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 );
294 void SetDrawShellOrSub();
295 void SetCurSubShell( ObjectSelectionType eOST, bool bForce = false );
297 void SetFormShellAtTop( bool bSet );
299 ObjectSelectionType GetCurObjectSelectionType() const { return eCurOST; }
301 virtual ErrCode DoVerb(tools::Long nVerb) override;
303 void StopEditShell();
304 bool IsDrawTextShell() const;
305 bool IsAuditShell() const;
307 void SetDrawTextUndo( SfxUndoManager* pUndoMgr );
309 void FillFieldData( ScHeaderFieldData& rData );
311 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
313 ScNavigatorSettings* GetNavigatorSettings();
315 // Drucken:
316 virtual SfxPrinter* GetPrinter( bool bCreate = false ) override;
317 virtual sal_uInt16 SetPrinter( SfxPrinter* pNewPrinter,
318 SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ) override;
320 virtual bool HasPrintOptionsPage() const override;
321 virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rOptions) override;
323 void ConnectObject( const SdrOle2Obj* pObj );
324 void ActivateObject( SdrOle2Obj* pObj, tools::Long nVerb );
326 void DeactivateOle();
328 static ScTabViewShell* GetActiveViewShell();
330 std::shared_ptr<SfxModelessDialogController> CreateRefDialogController(SfxBindings* pB, SfxChildWindow* pCW,
331 const SfxChildWinInfo* pInfo,
332 weld::Window* pParent, sal_uInt16 nSlotId);
334 void UpdateOleZoom();
336 virtual const FmFormShell* GetFormShell() const override { return pFormShell.get(); }
337 virtual FmFormShell* GetFormShell() override { return pFormShell.get(); }
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 );
345 bool SelectObject( const OUString& rName );
347 void SetInFormatDialog(bool bFlag) {bInFormatDialog=bFlag;}
349 void ForceMove() { Move(); }
351 static std::unique_ptr<SvxNumberInfoItem> MakeNumberInfoItem( ScDocument& rDoc, const ScViewData* pViewData );
353 static void UpdateNumberFormatter( const SvxNumberInfoItem& rInfoItem );
355 void ExecuteCellFormatDlg( SfxRequest& rReq, const OString &rTabPage);
357 bool GetFunction( OUString& rFuncStr, FormulaError nErrCode );
359 void StartSimpleRefDialog( const OUString& rTitle, const OUString& rInitVal,
360 bool bCloseOnButtonUp, bool bSingleCell, bool bMultiSelection );
361 void StopSimpleRefDialog();
363 void SetCurRefDlgId( sal_uInt16 nNew );
365 void AddAccessibilityObject( SfxListener& rObject );
366 void RemoveAccessibilityObject( SfxListener& rObject );
367 void BroadcastAccessibility( const SfxHint &rHint );
368 bool HasAccessibilityObjects() const;
370 bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
372 using ScTabView::ShowCursor;
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);
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; }
384 /// See SfxViewShell::getPart().
385 int getPart() const override;
386 /// See SfxViewShell::afterCallbackRegistered().
387 void afterCallbackRegistered() override;
388 /// See SfxViewShell::NotifyCursor().
389 void NotifyCursor(SfxViewShell* pViewShell) const override;
390 /// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab is equal to nCurrentTabIndex
391 static void notifyAllViewsHeaderInvalidation(const SfxViewShell* pForViewShell, HeaderType eHeaderType, SCTAB nCurrentTabIndex);
392 static bool isAnyEditViewInRange(const SfxViewShell* pForViewShell, bool bColumns, SCCOLROW nStart, SCCOLROW nEnd);
393 /// Emits a LOK_CALLBACK_INVALIDATE_SHEET_GEOMETRY for all views whose current tab
394 /// is equal to nCurrentTabIndex
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);
400 void InitFormEditData();
401 void ClearFormEditData();
402 ScFormEditData* GetFormEditData() { return mpFormEditData.get(); }
405 #endif
407 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */