tdf#125181 maxY is 50000 in prstGeom for star24 and star32
[LibreOffice.git] / sc / inc / scmod.hxx
blob7d0d7e0a36752ff6d94c2f30f2552892597c3a13
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_INC_SCMOD_HXX
21 #define INCLUDED_SC_INC_SCMOD_HXX
23 #include "scdllapi.h"
24 #include <vcl/timer.hxx>
25 #include <vcl/idle.hxx>
26 #include <svl/lstner.hxx>
27 #include <sfx2/app.hxx>
28 #include <sfx2/module.hxx>
29 #include "global.hxx"
30 #include "shellids.hxx"
31 #include <unotools/options.hxx>
32 #include <com/sun/star/uno/Reference.h>
34 #include <vector>
35 #include <map>
36 #include <memory>
38 class KeyEvent;
39 class EditView;
40 class SfxErrorHandler;
41 class SvtAccessibilityOptions;
42 class SvtCTLOptions;
43 class SvtUserOptions;
45 namespace svtools { class ColorConfig; }
46 namespace ooo { namespace vba { class XSinkCaller; } }
47 namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
48 namespace com { namespace sun { namespace star { namespace uno { template <typename > class Sequence; } } } }
50 class ScRange;
51 class ScDocument;
52 class ScViewCfg;
53 class ScDocCfg;
54 class ScAppCfg;
55 class ScDefaultsCfg;
56 class ScFormulaCfg;
57 class ScInputCfg;
58 class ScPrintCfg;
59 class ScViewOptions;
60 class ScDocOptions;
61 class ScAppOptions;
62 class ScDefaultsOptions;
63 class ScFormulaOptions;
64 class ScInputOptions;
65 class ScPrintOptions;
66 class ScInputHandler;
67 class ScTabViewShell;
68 class ScMessagePool;
69 class EditFieldInfo;
70 class ScNavipiCfg;
71 class ScAddInCfg;
72 class ScTransferObj;
73 class ScDrawTransferObj;
74 class ScSelectionTransferObj;
75 class ScFormEditData;
76 class ScMarkData;
77 struct ScDragData;
78 class SfxDialogController;
80 class SAL_DLLPUBLIC_RTTI ScModule: public SfxModule, public SfxListener, public utl::ConfigurationListener
82 Timer m_aIdleTimer;
83 Idle m_aSpellIdle;
84 std::unique_ptr<ScDragData> m_pDragData;
85 ScSelectionTransferObj* m_pSelTransfer;
86 ScMessagePool* m_pMessagePool;
87 // there is no global InputHandler anymore, each View has its own
88 ScInputHandler* m_pRefInputHandler;
89 std::unique_ptr<ScViewCfg> m_pViewCfg;
90 std::unique_ptr<ScDocCfg> m_pDocCfg;
91 std::unique_ptr<ScAppCfg> m_pAppCfg;
92 std::unique_ptr<ScDefaultsCfg> m_pDefaultsCfg;
93 std::unique_ptr<ScFormulaCfg> m_pFormulaCfg;
94 std::unique_ptr<ScInputCfg> m_pInputCfg;
95 std::unique_ptr<ScPrintCfg> m_pPrintCfg;
96 std::unique_ptr<ScNavipiCfg> m_pNavipiCfg;
97 std::unique_ptr<ScAddInCfg> m_pAddInCfg;
98 std::unique_ptr<svtools::ColorConfig> m_pColorConfig;
99 std::unique_ptr<SvtAccessibilityOptions> m_pAccessOptions;
100 std::unique_ptr<SvtCTLOptions> m_pCTLOptions;
101 std::unique_ptr<SvtUserOptions> m_pUserOptions;
102 std::unique_ptr<SfxErrorHandler> m_pErrorHdl;
103 std::unique_ptr<ScFormEditData> m_pFormEditData;
104 sal_uInt16 m_nCurRefDlgId;
105 bool m_bIsWaterCan:1;
106 bool m_bIsInEditCommand:1;
107 bool m_bIsInExecuteDrop:1;
108 bool m_bIsInSharedDocLoading:1;
109 bool m_bIsInSharedDocSaving:1;
111 // a way to find existing Dialogs for a given parent Window of the slot type
112 std::map<sal_uInt16, std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>>> m_mapRefController;
114 css::uno::Reference< ooo::vba::XSinkCaller > mxAutomationApplicationEventsCaller;
116 public:
117 SFX_DECL_INTERFACE(SCID_APP)
119 private:
120 /// SfxInterface initializer.
121 static void InitInterface_Impl();
123 public:
124 ScModule( SfxObjectFactory* pFact );
125 virtual ~ScModule() override;
127 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
128 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override;
129 void DeleteCfg();
131 // moved by the application
133 DECL_LINK( IdleHandler, Timer*, void ); // Timer instead of idle
134 DECL_LINK( SpellTimerHdl, Timer*, void );
135 DECL_LINK( CalcFieldValueHdl, EditFieldInfo*, void );
137 void Execute( SfxRequest& rReq );
138 void GetState( SfxItemSet& rSet );
139 static void HideDisabledSlots( SfxItemSet& rSet );
141 void AnythingChanged();
143 // Drag & Drop:
144 const ScDragData& GetDragData() const { return *m_pDragData;}
145 void SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj );
146 void ResetDragObject();
147 void SetDragLink(
148 const OUString& rDoc, const OUString& rTab, const OUString& rArea );
149 void SetDragJump(
150 ScDocument* pLocalDoc, const OUString& rTarget, const OUString& rText );
152 static ScDocument* GetClipDoc(); // called from document - should be removed later
154 // X selection:
155 ScSelectionTransferObj* GetSelectionTransfer() const { return m_pSelTransfer; }
156 void SetSelectionTransfer( ScSelectionTransferObj* pNew );
158 void SetWaterCan( bool bNew ) { m_bIsWaterCan = bNew; }
159 bool GetIsWaterCan() const { return m_bIsWaterCan; }
161 void SetInEditCommand( bool bNew ) { m_bIsInEditCommand = bNew; }
163 void SetInExecuteDrop( bool bNew ) { m_bIsInExecuteDrop = bNew; }
164 bool IsInExecuteDrop() const { return m_bIsInExecuteDrop; }
166 // Options:
167 const ScViewOptions& GetViewOptions ();
168 SC_DLLPUBLIC const ScDocOptions& GetDocOptions ();
169 SC_DLLPUBLIC const ScAppOptions& GetAppOptions ();
170 SC_DLLPUBLIC const ScDefaultsOptions& GetDefaultsOptions ();
171 SC_DLLPUBLIC const ScFormulaOptions& GetFormulaOptions ();
172 SC_DLLPUBLIC const ScInputOptions& GetInputOptions ();
173 SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions ();
174 void SetViewOptions ( const ScViewOptions& rOpt );
175 SC_DLLPUBLIC void SetDocOptions ( const ScDocOptions& rOpt );
176 SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt );
177 void SetDefaultsOptions ( const ScDefaultsOptions& rOpt );
178 SC_DLLPUBLIC void SetFormulaOptions ( const ScFormulaOptions& rOpt );
179 SC_DLLPUBLIC void SetInputOptions ( const ScInputOptions& rOpt );
180 void SetPrintOptions ( const ScPrintOptions& rOpt );
181 void InsertEntryToLRUList(sal_uInt16 nFIndex);
183 static void GetSpellSettings( LanguageType& rDefLang, LanguageType& rCjkLang, LanguageType& rCtlLang,
184 bool& rAutoSpell );
185 static void SetAutoSpellProperty( bool bSet );
186 static bool HasThesaurusLanguage( LanguageType nLang );
188 LanguageType GetOptDigitLanguage(); // from CTL options
190 ScNavipiCfg& GetNavipiCfg();
191 ScAddInCfg& GetAddInCfg();
192 svtools::ColorConfig& GetColorConfig();
193 SvtAccessibilityOptions& GetAccessOptions();
194 SvtCTLOptions& GetCTLOptions();
195 SC_DLLPUBLIC SvtUserOptions& GetUserOptions();
197 void ModifyOptions( const SfxItemSet& rOptSet );
199 // InputHandler:
200 bool IsEditMode(); // not for SC_INPUT_TYPE
201 bool IsInputMode(); // also for SC_INPUT_TYPE
202 void SetInputMode( ScInputMode eMode, const OUString* pInitText = nullptr );
203 bool InputKeyEvent( const KeyEvent& rKEvt, bool bStartEdit = false );
204 SC_DLLPUBLIC void InputEnterHandler( ScEnterMode nBlockMode = ScEnterMode::NORMAL );
205 void InputCancelHandler();
206 void InputSelection( const EditView* pView );
207 void InputChanged( const EditView* pView );
208 ScInputHandler* GetInputHdl( ScTabViewShell* pViewSh = nullptr, bool bUseRef = true );
210 void SetRefInputHdl( ScInputHandler* pNew );
211 ScInputHandler* GetRefInputHdl() { return m_pRefInputHandler;}
213 void ViewShellGone(const ScTabViewShell* pViewSh);
214 void ViewShellChanged(bool bStopEditing);
215 // communication with function-autopilot
216 void InputGetSelection( sal_Int32& rStart, sal_Int32& rEnd );
217 void InputSetSelection( sal_Int32 nStart, sal_Int32 nEnd );
218 void InputReplaceSelection( const OUString& rStr );
219 void InputTurnOffWinEngine();
220 OUString InputGetFormulaStr();
221 void ActivateInputWindow( const OUString* pStr = nullptr,
222 bool bMatrix = false );
224 void InitFormEditData();
225 void ClearFormEditData();
226 ScFormEditData* GetFormEditData() { return m_pFormEditData.get(); }
228 // input of reference:
229 SC_DLLPUBLIC void SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm = nullptr );
230 bool IsModalMode(SfxObjectShell* pDocSh = nullptr);
231 bool IsFormulaMode();
232 bool IsRefDialogOpen();
233 bool IsTableLocked();
234 void SetReference( const ScRange& rRef, ScDocument* pDoc,
235 const ScMarkData* pMarkData = nullptr );
236 void AddRefEntry();
237 void EndReference();
238 sal_uInt16 GetCurRefDlgId() const { return m_nCurRefDlgId; }
240 // virtual methods for the options dialog
241 virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override;
242 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override;
243 virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, TabPageParent pParent, const SfxItemSet& rSet ) override;
244 virtual std::unique_ptr<SfxStyleFamilies> CreateStyleFamilies() override;
246 void SetInSharedDocLoading( bool bNew ) { m_bIsInSharedDocLoading = bNew; }
247 bool IsInSharedDocLoading() const { return m_bIsInSharedDocLoading; }
248 void SetInSharedDocSaving( bool bNew ) { m_bIsInSharedDocSaving = bNew; }
249 bool IsInSharedDocSaving() const { return m_bIsInSharedDocSaving; }
251 SC_DLLPUBLIC void RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd, weld::Window* pWndAncestor);
252 SC_DLLPUBLIC void UnregisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd);
253 SC_DLLPUBLIC std::shared_ptr<SfxDialogController> Find1RefWindow(sal_uInt16 nSlotId, weld::Window *pWndAncestor);
255 SC_DLLPUBLIC void RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller);
256 SC_DLLPUBLIC void CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments);
259 #define SC_MOD() ( static_cast<ScModule*>(SfxApplication::GetModule(SfxToolsModule::Calc)) )
261 void global_InitAppOptions();
263 #endif
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */