Teach symstore more duplicated DLLs
[LibreOffice.git] / sc / inc / scmod.hxx
blobe214771bd2e4ffc69a66e5146d7e0618eed78c47
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 <o3tl/deleter.hxx>
25 #include <vcl/timer.hxx>
26 #include <vcl/idle.hxx>
27 #include <svl/lstner.hxx>
28 #include <sfx2/app.hxx>
29 #include <sfx2/module.hxx>
30 #include "global.hxx"
31 #include "shellids.hxx"
32 #include <unotools/options.hxx>
33 #include <com/sun/star/uno/Reference.h>
35 #include <vector>
36 #include <map>
37 #include <memory>
39 class KeyEvent;
40 class EditView;
41 class SfxErrorHandler;
42 class SvtAccessibilityOptions;
43 class SvtCTLOptions;
44 class SvtUserOptions;
46 namespace svtools { class ColorConfig; }
47 namespace ooo { namespace vba { class XSinkCaller; } }
48 namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
49 namespace com { namespace sun { namespace star { namespace uno { template <typename > class Sequence; } } } }
51 class ScRange;
52 class ScDocument;
53 class ScViewCfg;
54 class ScDocCfg;
55 class ScAppCfg;
56 class ScDefaultsCfg;
57 class ScFormulaCfg;
58 class ScInputCfg;
59 class ScPrintCfg;
60 class ScViewOptions;
61 class ScDocOptions;
62 class ScAppOptions;
63 class ScDefaultsOptions;
64 class ScFormulaOptions;
65 class ScInputOptions;
66 class ScPrintOptions;
67 class ScInputHandler;
68 class ScTabViewShell;
69 class ScMessagePool;
70 class EditFieldInfo;
71 class ScNavipiCfg;
72 class ScAddInCfg;
73 class ScTransferObj;
74 class ScDrawTransferObj;
75 class ScSelectionTransferObj;
76 class ScFormEditData;
77 class ScMarkData;
78 struct ScDragData;
79 class SfxDialogController;
81 class SAL_DLLPUBLIC_RTTI ScModule final : public SfxModule, public SfxListener, public utl::ConfigurationListener
83 Timer m_aIdleTimer;
84 Idle m_aSpellIdle;
85 std::unique_ptr<ScDragData> m_pDragData;
86 ScSelectionTransferObj* m_pSelTransfer;
87 ScMessagePool* m_pMessagePool;
88 // there is no global InputHandler anymore, each View has its own
89 ScInputHandler* m_pRefInputHandler;
90 std::unique_ptr<ScViewCfg, o3tl::default_delete<ScViewCfg>> m_pViewCfg;
91 std::unique_ptr<ScDocCfg, o3tl::default_delete<ScDocCfg>> m_pDocCfg;
92 std::unique_ptr<ScAppCfg, o3tl::default_delete<ScAppCfg>> m_pAppCfg;
93 std::unique_ptr<ScDefaultsCfg> m_pDefaultsCfg;
94 std::unique_ptr<ScFormulaCfg> m_pFormulaCfg;
95 std::unique_ptr<ScInputCfg> m_pInputCfg;
96 std::unique_ptr<ScPrintCfg> m_pPrintCfg;
97 std::unique_ptr<ScNavipiCfg> m_pNavipiCfg;
98 std::unique_ptr<ScAddInCfg> m_pAddInCfg;
99 std::unique_ptr<svtools::ColorConfig> m_pColorConfig;
100 std::unique_ptr<SvtAccessibilityOptions> m_pAccessOptions;
101 std::unique_ptr<SvtCTLOptions> m_pCTLOptions;
102 std::unique_ptr<SvtUserOptions> m_pUserOptions;
103 std::unique_ptr<SfxErrorHandler> m_pErrorHdl;
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 );
209 void SetRefInputHdl( ScInputHandler* pNew );
210 ScInputHandler* GetRefInputHdl() { return m_pRefInputHandler;}
212 void ViewShellGone(const ScTabViewShell* pViewSh);
213 void ViewShellChanged(bool bStopEditing);
214 // communication with function-autopilot
215 void InputGetSelection( sal_Int32& rStart, sal_Int32& rEnd );
216 void InputSetSelection( sal_Int32 nStart, sal_Int32 nEnd );
217 void InputReplaceSelection( const OUString& rStr );
218 void InputTurnOffWinEngine();
219 void ActivateInputWindow( const OUString* pStr = nullptr,
220 bool bMatrix = false );
222 // input of reference:
223 SC_DLLPUBLIC void SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm = nullptr );
224 bool IsModalMode(SfxObjectShell* pDocSh = nullptr);
225 bool IsFormulaMode();
226 bool IsRefDialogOpen();
227 bool IsTableLocked();
228 void SetReference( const ScRange& rRef, ScDocument* pDoc,
229 const ScMarkData* pMarkData = nullptr );
230 void AddRefEntry();
231 void EndReference();
232 sal_uInt16 GetCurRefDlgId() const { return m_nCurRefDlgId; }
234 // virtual methods for the options dialog
235 virtual std::unique_ptr<SfxItemSet> CreateItemSet( sal_uInt16 nId ) override;
236 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) override;
237 virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet ) override;
238 virtual std::unique_ptr<SfxStyleFamilies> CreateStyleFamilies() override;
240 void SetInSharedDocLoading( bool bNew ) { m_bIsInSharedDocLoading = bNew; }
241 bool IsInSharedDocLoading() const { return m_bIsInSharedDocLoading; }
242 void SetInSharedDocSaving( bool bNew ) { m_bIsInSharedDocSaving = bNew; }
243 bool IsInSharedDocSaving() const { return m_bIsInSharedDocSaving; }
245 SC_DLLPUBLIC void RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd, weld::Window* pWndAncestor);
246 SC_DLLPUBLIC void UnregisterRefController(sal_uInt16 nSlotId, const std::shared_ptr<SfxDialogController>& rWnd);
247 SC_DLLPUBLIC std::shared_ptr<SfxDialogController> Find1RefWindow(sal_uInt16 nSlotId, const weld::Window *pWndAncestor);
249 SC_DLLPUBLIC void RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller);
250 SC_DLLPUBLIC void CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments);
253 #define SC_MOD() ( static_cast<ScModule*>(SfxApplication::GetModule(SfxToolsModule::Calc)) )
255 void global_InitAppOptions();
257 #endif
259 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */