LibreOffice Module sc (master) 1
scmod.cxx
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#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
21#include <comphelper/lok.hxx>
23#include <scitems.hxx>
24#include <sfx2/app.hxx>
25
26#include <editeng/flditem.hxx>
27#include <editeng/outliner.hxx>
28
29#include <sfx2/viewfrm.hxx>
30#include <sfx2/objface.hxx>
31
32#include <IAnyRefDialog.hxx>
33
34#include <svtools/ehdl.hxx>
36#include <svl/ctloptions.hxx>
38#include <sfx2/bindings.hxx>
39#include <sfx2/request.hxx>
40#include <sfx2/printer.hxx>
41#include <editeng/langitem.hxx>
42#include <svtools/colorcfg.hxx>
43
44#include <svl/whiter.hxx>
45#include <svx/dialogs.hrc>
46#include <svl/inethist.hxx>
47#include <vcl/svapp.hxx>
48#include <svx/svxerr.hxx>
50
51#include <editeng/unolingu.hxx>
52#include <unotools/lingucfg.hxx>
55#include <com/sun/star/i18n/ScriptType.hpp>
56#include <com/sun/star/linguistic2/XThesaurus.hpp>
57#include <ooo/vba/XSinkCaller.hpp>
58
59#include <scmod.hxx>
60#include <global.hxx>
61#include <viewopti.hxx>
62#include <docoptio.hxx>
63#include <appoptio.hxx>
64#include <defaultsoptions.hxx>
65#include <formulaopt.hxx>
66#include <inputopt.hxx>
67#include <printopt.hxx>
68#include <navicfg.hxx>
69#include <addincfg.hxx>
70#include <tabvwsh.hxx>
71#include <prevwsh.hxx>
72#include <docsh.hxx>
73#include <drwlayer.hxx>
74#include <uiitems.hxx>
75#include <sc.hrc>
76#include <scerrors.hrc>
77#include <scstyles.hrc>
78#include <globstr.hrc>
79#include <scresid.hxx>
80#include <bitmaps.hlst>
81#include <inputhdl.hxx>
82#include <inputwin.hxx>
83#include <msgpool.hxx>
84#include <detfunc.hxx>
85#include <preview.hxx>
86#include <dragdata.hxx>
87#include <markdata.hxx>
88#include <transobj.hxx>
89#include <funcdesc.hxx>
90
91#define ShellClass_ScModule
92#include <scslots.hxx>
93
94#include <scabstdlg.hxx>
96#include <documentlinkmgr.hxx>
97#include <LibreOfficeKit/LibreOfficeKitEnums.h>
98#include <sfx2/lokhelper.hxx>
99
100#define SC_IDLE_MIN 150
101#define SC_IDLE_MAX 3000
102#define SC_IDLE_STEP 75
103#define SC_IDLE_COUNT 50
104
105static sal_uInt16 nIdleCount = 0;
106
108
109void ScModule::InitInterface_Impl()
110{
111 GetStaticInterface()->RegisterObjectBar(SFX_OBJECTBAR_APPLICATION,
112 SfxVisibilityFlags::Standard | SfxVisibilityFlags::Client | SfxVisibilityFlags::Viewer,
113 ToolbarId::Objectbar_App);
114
115 GetStaticInterface()->RegisterStatusBar(StatusBarId::CalcStatusBar);
116}
117
119 SfxModule("sc", {pFact}),
120 m_aIdleTimer("sc ScModule IdleTimer"),
121 m_pDragData(new ScDragData),
122 m_pSelTransfer( nullptr ),
123 m_pRefInputHandler( nullptr ),
124 m_nCurRefDlgId( 0 ),
125 m_bIsWaterCan( false ),
126 m_bIsInEditCommand( false ),
127 m_bIsInExecuteDrop( false ),
128 m_bIsInSharedDocLoading( false ),
129 m_bIsInSharedDocSaving( false )
130{
131 // The ResManager (DLL data) is not yet initialized in the ctor!
132 SetName("StarCalc"); // for Basic
133
134 ResetDragObject();
135
136 // InputHandler does not need to be created
137
138 // Create ErrorHandler - was in Init()
139 // Between OfficeApplication::Init and ScGlobal::Init
141 m_pErrorHdl.reset( new SfxErrorHandler(RID_ERRHDLSC,
142 ErrCodeArea::Sc,
143 ErrCodeArea::Sc,
144 GetResLocale()) );
145
146 m_aIdleTimer.SetTimeout(SC_IDLE_MIN);
147 m_aIdleTimer.SetInvokeHandler( LINK( this, ScModule, IdleHandler ) );
148 m_aIdleTimer.Start();
149
150 m_pMessagePool = new ScMessagePool;
151 m_pMessagePool->FreezeIdRanges();
152 SetPool( m_pMessagePool.get() );
153 ScGlobal::InitTextHeight( m_pMessagePool.get() );
154
155 StartListening( *SfxGetpApp() ); // for SfxHintId::Deinitializing
156
157 // Initialize the color config
158 GetColorConfig();
159}
160
162{
163 OSL_ENSURE( !m_pSelTransfer, "Selection Transfer object not deleted" );
164
165 // InputHandler does not need to be deleted (there's none in the App anymore)
166
167 m_pMessagePool.clear();
168
169 m_pDragData.reset();
170 m_pErrorHdl.reset();
171
172 ScGlobal::Clear(); // Also calls ScDocumentPool::DeleteVersionMaps();
173
174 DeleteCfg(); // Called from Exit()
175}
176
178{
179 if ( p == m_pColorConfig.get() || p == m_pAccessOptions.get() )
180 {
181 // Test if detective objects have to be updated with new colors
182 // (if the detective colors haven't been used yet, there's nothing to update)
184 {
185 const svtools::ColorConfig& rColors = GetColorConfig();
186 bool bArrows =
189 bool bComments =
191 if ( bArrows || bComments )
192 {
193 ScDetectiveFunc::InitializeColors(); // get the new colors
194
195 // update detective objects in all open documents
197 while ( pObjSh )
198 {
199 if ( auto pDocSh = dynamic_cast<ScDocShell * >(pObjSh) )
200 {
201 if ( bArrows )
202 ScDetectiveFunc( pDocSh->GetDocument(), 0 ).UpdateAllArrowColors();
203 if ( bComments )
204 ScDetectiveFunc::UpdateAllComments( pDocSh->GetDocument() );
205 }
206 pObjSh = SfxObjectShell::GetNext( *pObjSh );
207 }
208 }
209 }
210
212 {
213 SfxViewShell* pSfxViewShell = SfxViewShell::Current();
214 ScTabViewShell* pViewShell = dynamic_cast<ScTabViewShell*>(pSfxViewShell);
215
216 if (pViewShell)
217 {
218 ScViewData& pViewData = pViewShell->GetViewData();
219 ScViewOptions aViewOptions = pViewData.GetOptions();
220 Color aFillColor(m_pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor);
221 aViewOptions.SetDocColor(aFillColor);
223 pViewData.SetOptions(aViewOptions);
224 ScModelObj* pScModelObj = comphelper::getFromUnoTunnel<ScModelObj>(SfxObjectShell::Current()->GetModel());
226 // In Online, the document color is the one used for the background, contrary to
227 // Writer and Draw that use the application background color.
228 pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR,
229 aFillColor.AsRGBHexString().toUtf8());
230 }
231 }
232
233 // force all views to repaint, using the new options
234 SfxViewShell* pViewShell = SfxViewShell::GetFirst();
235 while(pViewShell)
236 {
237 if (ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(pViewShell))
238 {
239 pViewSh->PaintGrid();
240 pViewSh->PaintTop();
241 pViewSh->PaintLeft();
242 pViewSh->PaintExtras();
243
244 ScInputHandler* pHdl = pViewSh->GetInputHandler();
245 if ( pHdl )
246 pHdl->ForgetLastPattern(); // EditEngine BackgroundColor may change
247 }
248 else if ( dynamic_cast<const ScPreviewShell*>( pViewShell) != nullptr )
249 {
250 vcl::Window* pWin = pViewShell->GetWindow();
251 if (pWin)
252 pWin->Invalidate();
253 }
254 pViewShell = SfxViewShell::GetNext( *pViewShell );
255 }
256 }
257 else if ( p == m_pCTLOptions.get() )
258 {
259 // for all documents: set digit language for printer, recalc output factor, update row heights
261 while ( pObjSh )
262 {
263 if ( auto pDocSh = dynamic_cast<ScDocShell *>(pObjSh) )
264 {
265 OutputDevice* pPrinter = pDocSh->GetPrinter();
266 if ( pPrinter )
268
269 pDocSh->CalcOutputFactor();
270
271 SCTAB nTabCount = pDocSh->GetDocument().GetTableCount();
272 for (SCTAB nTab=0; nTab<nTabCount; nTab++)
273 pDocSh->AdjustRowHeight( 0, pDocSh->GetDocument().MaxRow(), nTab );
274 }
275 pObjSh = SfxObjectShell::GetNext( *pObjSh );
276 }
277
278 // for all views (table and preview): update digit language
280 while ( pSh )
281 {
282 if (ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(pSh))
283 {
284 // set ref-device for EditEngine (re-evaluates digit settings)
285 ScInputHandler* pHdl = GetInputHdl(pViewSh);
286 if (pHdl)
287 pHdl->UpdateRefDevice();
288
289 pViewSh->DigitLanguageChanged();
290 pViewSh->PaintGrid();
291 }
292 else if (ScPreviewShell* pPreviewSh = dynamic_cast<ScPreviewShell*>(pSh))
293 {
294 ScPreview* pPreview = pPreviewSh->GetPreview();
295
297 pPreview->Invalidate();
298 }
299
300 pSh = SfxViewShell::GetNext( *pSh );
301 }
302 }
303}
304
306{
307 if ( rHint.GetId() == SfxHintId::Deinitializing )
308 {
309 // ConfigItems must be removed before ConfigManager
310 DeleteCfg();
311 }
312}
313
315{
316 m_pViewCfg.reset(); // Saving happens automatically before Exit()
317 m_pDocCfg.reset();
318 m_pAppCfg.reset();
319 m_pDefaultsCfg.reset();
320 m_pFormulaCfg.reset();
321 m_pInputCfg.reset();
322 m_pPrintCfg.reset();
323 m_pNavipiCfg.reset();
324 m_pAddInCfg.reset();
325
326 if ( m_pColorConfig )
327 {
328 m_pColorConfig->RemoveListener(this);
329 m_pColorConfig.reset();
330 }
331 if ( m_pAccessOptions )
332 {
333 m_pAccessOptions->RemoveListener(this);
334 m_pAccessOptions.reset();
335 }
336 if ( m_pCTLOptions )
337 {
338 m_pCTLOptions->RemoveListener(this);
339 m_pCTLOptions.reset();
340 }
341 m_pUserOptions.reset();
342}
343
344// Moved here from the App
345
347{
349 SfxBindings* pBindings = pViewFrm ? &pViewFrm->GetBindings() : nullptr;
350
351 const SfxItemSet* pReqArgs = rReq.GetArgs();
352 sal_uInt16 nSlot = rReq.GetSlot();
353
354 switch ( nSlot )
355 {
356 case SID_CHOOSE_DESIGN:
357 SfxApplication::CallAppBasic( "Template.Samples.ShowStyles" );
358 break;
359 case SID_EURO_CONVERTER:
360 SfxApplication::CallAppBasic( "Euro.ConvertRun.Main" );
361 break;
362 case SID_AUTOSPELL_CHECK:
363 {
364 bool bSet;
365 const SfxPoolItem* pItem;
366 if (pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( FN_PARAM_1, true, &pItem ))
367 bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
368 else if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( nSlot, true, &pItem ) )
369 bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
370 else
371 { // Toggle
372 ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() );
373 if ( pDocSh )
374 bSet = !pDocSh->GetDocument().GetDocOptions().IsAutoSpell();
375 else
376 bSet = !GetDocOptions().IsAutoSpell();
377 }
378
380 aSet.Put( SfxBoolItem( SID_AUTOSPELL_CHECK, bSet ) );
381 ModifyOptions( aSet );
382 rReq.Done();
383 }
384 break;
385
386 case SID_ATTR_METRIC:
387 {
388 const SfxPoolItem* pItem;
389 if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( nSlot, true, &pItem ) )
390 {
391 FieldUnit eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
392 switch( eUnit )
393 {
394 case FieldUnit::MM: // Just the units that are also in the dialog
395 case FieldUnit::CM:
396 case FieldUnit::INCH:
397 case FieldUnit::PICA:
398 case FieldUnit::POINT:
399 {
400 PutItem( *pItem );
401 ScAppOptions aNewOpts( GetAppOptions() );
402 aNewOpts.SetAppMetric( eUnit );
403 SetAppOptions( aNewOpts );
404 rReq.Done();
405 }
406 break;
407 default:
408 {
409 // added to avoid warnings
410 }
411 }
412 }
413 }
414 break;
415
416 case FID_AUTOCOMPLETE:
417 {
418 ScAppOptions aNewOpts( GetAppOptions() );
419 bool bNew = !aNewOpts.GetAutoComplete();
420 aNewOpts.SetAutoComplete( bNew );
421 SetAppOptions( aNewOpts );
422 if (pBindings)
423 pBindings->Invalidate( FID_AUTOCOMPLETE );
424 rReq.Done();
425 }
426 break;
427
428 case SID_DETECTIVE_AUTO:
429 {
430 ScAppOptions aNewOpts( GetAppOptions() );
431 bool bNew = !aNewOpts.GetDetectiveAuto();
432 const SfxBoolItem* pAuto = rReq.GetArg<SfxBoolItem>(SID_DETECTIVE_AUTO);
433 if ( pAuto )
434 bNew = pAuto->GetValue();
435
436 aNewOpts.SetDetectiveAuto( bNew );
437 SetAppOptions( aNewOpts );
438 if (pBindings)
439 pBindings->Invalidate( SID_DETECTIVE_AUTO );
440 rReq.AppendItem( SfxBoolItem( SID_DETECTIVE_AUTO, bNew ) );
441 rReq.Done();
442 }
443 break;
444
445 case SID_PSZ_FUNCTION:
446 if (pReqArgs)
447 {
448 const SfxUInt32Item & rItem = pReqArgs->Get(SID_PSZ_FUNCTION);
449
450 ScAppOptions aNewOpts( GetAppOptions() );
451 aNewOpts.SetStatusFunc( rItem.GetValue() );
452 SetAppOptions( aNewOpts );
453
454 if (pBindings)
455 {
456 pBindings->Invalidate( SID_TABLE_CELL );
457 pBindings->Update( SID_TABLE_CELL ); // Immediately
458
459 pBindings->Invalidate( SID_PSZ_FUNCTION );
460 pBindings->Update( SID_PSZ_FUNCTION );
461 // If the menu is opened again immediately
462 }
463 }
464 break;
465
466 case SID_ATTR_LANGUAGE:
467 case SID_ATTR_CHAR_CJK_LANGUAGE:
468 case SID_ATTR_CHAR_CTL_LANGUAGE:
469 {
470 const SfxPoolItem* pItem;
471 if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( GetPool().GetWhich(nSlot), true, &pItem ) )
472 {
473 ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() );
474 if ( pDocSh )
475 {
476 ScDocument& rDoc = pDocSh->GetDocument();
477 LanguageType eNewLang = static_cast<const SvxLanguageItem*>(pItem)->GetLanguage();
478 LanguageType eLatin, eCjk, eCtl;
479 rDoc.GetLanguage( eLatin, eCjk, eCtl );
480 LanguageType eOld = ( nSlot == SID_ATTR_CHAR_CJK_LANGUAGE ) ? eCjk :
481 ( ( nSlot == SID_ATTR_CHAR_CTL_LANGUAGE ) ? eCtl : eLatin );
482 if ( eNewLang != eOld )
483 {
484 if ( nSlot == SID_ATTR_CHAR_CJK_LANGUAGE )
485 eCjk = eNewLang;
486 else if ( nSlot == SID_ATTR_CHAR_CTL_LANGUAGE )
487 eCtl = eNewLang;
488 else
489 eLatin = eNewLang;
490
491 rDoc.SetLanguage( eLatin, eCjk, eCtl );
492
493 ScInputHandler* pInputHandler = GetInputHdl();
494 if ( pInputHandler )
495 pInputHandler->UpdateSpellSettings(); // EditEngine flags
496 ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
497 if ( pViewSh )
498 pViewSh->UpdateDrawTextOutliner(); // EditEngine flags
499
500 pDocSh->SetDocumentModified();
501 }
502 }
503 }
504 }
505 break;
506
507 case FID_FOCUS_POSWND:
508 {
509 ScInputHandler* pHdl = GetInputHdl();
510 if (pHdl)
511 {
512 ScInputWindow* pWin = pHdl->GetInputWindow();
513 if (pWin)
514 pWin->PosGrabFocus();
515 }
516 rReq.Done();
517 }
518 break;
519
520 case SID_OPEN_XML_FILTERSETTINGS:
521 {
522 try
523 {
524 css::uno::Reference < css::ui::dialogs::XExecutableDialog > xDialog = css::ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext());
525 xDialog->execute();
526 }
527 catch( css::uno::RuntimeException& )
528 {
530 }
531 }
532 break;
533
534 default:
535 OSL_FAIL( "ScApplication: Unknown Message." );
536 break;
537 }
538}
539
541{
542 ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() );
543 bool bTabView = pDocSh && (pDocSh->GetBestViewShell() != nullptr);
544
545 SfxWhichIter aIter(rSet);
546 for (sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich())
547 {
548 if (!bTabView)
549 {
550 // Not in the normal calc view shell (most likely in preview shell). Disable all actions.
551 rSet.DisableItem(nWhich);
552 continue;
553 }
554
555 switch ( nWhich )
556 {
557 case FID_AUTOCOMPLETE:
558 rSet.Put( SfxBoolItem( nWhich, GetAppOptions().GetAutoComplete() ) );
559 break;
560 case SID_DETECTIVE_AUTO:
561 rSet.Put( SfxBoolItem( nWhich, GetAppOptions().GetDetectiveAuto() ) );
562 break;
563 case SID_PSZ_FUNCTION:
564 rSet.Put( SfxUInt32Item( nWhich, GetAppOptions().GetStatusFunc() ) );
565 break;
566 case SID_ATTR_METRIC:
567 rSet.Put( SfxUInt16Item( nWhich, sal::static_int_cast<sal_uInt16>(GetAppOptions().GetAppMetric()) ) );
568 break;
569 case SID_AUTOSPELL_CHECK:
570 rSet.Put( SfxBoolItem( nWhich, pDocSh->GetDocument().GetDocOptions().IsAutoSpell()) );
571 break;
572 case SID_ATTR_LANGUAGE:
573 case ATTR_CJK_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CJK_LANGUAGE
574 case ATTR_CTL_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CTL_LANGUAGE
575 {
576 LanguageType eLatin, eCjk, eCtl;
577 pDocSh->GetDocument().GetLanguage( eLatin, eCjk, eCtl );
578 LanguageType eLang = ( nWhich == ATTR_CJK_FONT_LANGUAGE ) ? eCjk :
579 ( ( nWhich == ATTR_CTL_FONT_LANGUAGE ) ? eCtl : eLatin );
580 rSet.Put( SvxLanguageItem( eLang, nWhich ) );
581 }
582 break;
583 }
584 }
585}
586
588{
589 if( SfxViewFrame* pViewFrm = SfxViewFrame::Current() )
590 {
591 SfxBindings& rBindings = pViewFrm->GetBindings();
592 SfxWhichIter aIter( rSet );
593 for( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich != 0; nWhich = aIter.NextWhich() )
594 {
595 ScViewUtil::HideDisabledSlot( rSet, rBindings, nWhich );
596 // always disable the slots
597 rSet.DisableItem( nWhich );
598 }
599 }
600}
601
603{
605 {
607 if (pViewShell)
608 pViewShell->ResetDragObject();
609 }
610 else
611 {
612 m_pDragData->pCellTransfer = nullptr;
613 m_pDragData->pDrawTransfer = nullptr;
614 m_pDragData->pJumpLocalDoc = nullptr;
615 m_pDragData->aLinkDoc.clear();
616 m_pDragData->aLinkTable.clear();
617 m_pDragData->aLinkArea.clear();
618 m_pDragData->aJumpTarget.clear();
619 m_pDragData->aJumpText.clear();
620 }
621}
622
624{
626 {
628 assert(pViewShell);
629 return pViewShell->GetDragData();
630 }
631 else
632 return *m_pDragData;
633}
634
636{
638 {
640 if (pViewShell)
641 pViewShell->SetDragObject(pCellObj, pDrawObj);
642 }
643 else
644 {
646 m_pDragData->pCellTransfer = pCellObj;
647 m_pDragData->pDrawTransfer = pDrawObj;
648 }
649}
650
652 const OUString& rDoc, const OUString& rTab, const OUString& rArea )
653{
655 {
657 if (pViewShell)
658 pViewShell->SetDragLink(rDoc, rTab, rArea);
659 }
660 else
661 {
663 m_pDragData->aLinkDoc = rDoc;
664 m_pDragData->aLinkTable = rTab;
665 m_pDragData->aLinkArea = rArea;
666 }
667}
668
670 ScDocument* pLocalDoc, const OUString& rTarget, const OUString& rText )
671{
673 {
675 if (pViewShell)
676 pViewShell->SetDragJump(pLocalDoc, rTarget, rText);
677 }
678 else
679 {
681
682 m_pDragData->pJumpLocalDoc = pLocalDoc;
683 m_pDragData->aJumpTarget = rTarget;
684 m_pDragData->aJumpText = rText;
685 }
686}
687
689{
690 // called from document
691 SfxViewFrame* pViewFrame = nullptr;
692 ScTabViewShell* pViewShell = nullptr;
693 css::uno::Reference<css::datatransfer::XTransferable2> xTransferable;
694
695 if ((pViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current())))
696 xTransferable.set(ScTabViewShell::GetClipData(pViewShell->GetViewData().GetActiveWin()));
697 else if ((pViewShell = dynamic_cast<ScTabViewShell*>(SfxViewShell::GetFirst())))
698 xTransferable.set(ScTabViewShell::GetClipData(pViewShell->GetViewData().GetActiveWin()));
699 else if ((pViewFrame = SfxViewFrame::GetFirst()))
700 {
701 css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipboard =
702 pViewFrame->GetWindow().GetClipboard();
703 xTransferable.set(xClipboard.is() ? xClipboard->getContents() : nullptr, css::uno::UNO_QUERY);
704 }
705
706 const ScTransferObj* pObj = ScTransferObj::GetOwnClipboard(xTransferable);
707 if (pObj)
708 {
709 ScDocument* pDoc = pObj->GetDocument();
710 assert((!pDoc || pDoc->IsClipboard()) && "Document is not clipboard, how can that be?");
711 return pDoc;
712 }
713
714 return nullptr;
715}
716
718{
719 m_pSelTransfer = pNew;
720}
721
723{
724 if ( !m_pViewCfg )
725 m_pViewCfg.reset(new ScViewCfg);
726
727 m_pViewCfg->SetOptions( rOpt );
728}
729
731{
732 if ( !m_pViewCfg )
733 m_pViewCfg.reset( new ScViewCfg );
734
735 return *m_pViewCfg;
736}
737
739{
740 if ( !m_pDocCfg )
741 m_pDocCfg.reset( new ScDocCfg );
742
743 m_pDocCfg->SetOptions( rOpt );
744}
745
747{
748 if ( !m_pDocCfg )
749 m_pDocCfg.reset( new ScDocCfg );
750
751 return *m_pDocCfg;
752}
753
754void ScModule::InsertEntryToLRUList(sal_uInt16 nFIndex)
755{
756 if(nFIndex == 0)
757 return;
758
759 const ScAppOptions& rAppOpt = GetAppOptions();
760 sal_uInt16 nLRUFuncCount = std::min( rAppOpt.GetLRUFuncListCount(), sal_uInt16(LRU_MAX) );
761 sal_uInt16* pLRUListIds = rAppOpt.GetLRUFuncList();
762
763 sal_uInt16 aIdxList[LRU_MAX];
764 sal_uInt16 n = 0;
765 bool bFound = false;
766
767 while ((n < LRU_MAX) && n<nLRUFuncCount) // Iterate through old list
768 {
769 if (!bFound && (pLRUListIds[n]== nFIndex))
770 bFound = true; // First hit!
771 else if (bFound)
772 aIdxList[n ] = pLRUListIds[n]; // Copy after hit
773 else if ((n+1) < LRU_MAX)
774 aIdxList[n+1] = pLRUListIds[n]; // Move before hit
775 n++;
776 }
777 if (!bFound && (n < LRU_MAX)) // Entry not found?
778 n++; // One more
779 aIdxList[0] = nFIndex; // Current on Top
780
781 ScAppOptions aNewOpts(rAppOpt); // Let App know
782 aNewOpts.SetLRUFuncList(aIdxList, n);
783 SetAppOptions(aNewOpts);
784}
785
787{
788 if ( !m_pAppCfg )
789 m_pAppCfg.reset( new ScAppCfg );
790
791 m_pAppCfg->SetOptions( rOpt );
792}
793
795{
796 SC_MOD()->GetAppOptions();
797}
798
800{
801 if ( !m_pAppCfg )
802 m_pAppCfg.reset( new ScAppCfg );
803
804 return m_pAppCfg->GetOptions();
805}
806
808{
809 if ( !m_pDefaultsCfg )
810 m_pDefaultsCfg.reset( new ScDefaultsCfg );
811
812 m_pDefaultsCfg->SetOptions( rOpt );
813}
814
816{
817 if ( !m_pDefaultsCfg )
818 m_pDefaultsCfg.reset( new ScDefaultsCfg );
819
820 return *m_pDefaultsCfg;
821}
822
824{
825 if ( !m_pFormulaCfg )
826 m_pFormulaCfg.reset( new ScFormulaCfg );
827
828 m_pFormulaCfg->SetOptions( rOpt );
829}
830
832{
833 if ( !m_pFormulaCfg )
834 m_pFormulaCfg.reset( new ScFormulaCfg );
835
836 return *m_pFormulaCfg;
837}
838
840{
841 if ( !m_pInputCfg )
842 m_pInputCfg.reset( new ScInputCfg );
843
844 m_pInputCfg->SetOptions( rOpt );
845}
846
848{
849 if ( !m_pInputCfg )
850 m_pInputCfg.reset( new ScInputCfg );
851
852 return m_pInputCfg->GetOptions();
853}
854
856{
857 if ( !m_pPrintCfg )
858 m_pPrintCfg.reset( new ScPrintCfg );
859
860 m_pPrintCfg->SetOptions( rOpt );
861}
862
864{
865 if ( !m_pPrintCfg )
866 m_pPrintCfg.reset( new ScPrintCfg );
867
868 return m_pPrintCfg->GetOptions();
869}
870
872{
873 if ( !m_pNavipiCfg )
874 m_pNavipiCfg.reset( new ScNavipiCfg );
875
876 return *m_pNavipiCfg;
877}
878
880{
881 if ( !m_pAddInCfg )
882 m_pAddInCfg.reset( new ScAddInCfg );
883
884 return *m_pAddInCfg;
885}
886
888{
889 if ( !m_pColorConfig )
890 {
892 m_pColorConfig->AddListener(this);
893 }
894
895 return *m_pColorConfig;
896}
897
899{
900 if( !m_pUserOptions )
901 {
902 m_pUserOptions.reset( new SvtUserOptions );
903 }
904 return *m_pUserOptions;
905}
906
908{
910 return ( eNumerals == SvtCTLOptions::NUMERALS_ARABIC ) ? LANGUAGE_ENGLISH_US :
913}
914
921{
922 LanguageType nOldSpellLang, nOldCjkLang, nOldCtlLang;
923 bool bOldAutoSpell;
924 GetSpellSettings( nOldSpellLang, nOldCjkLang, nOldCtlLang, bOldAutoSpell );
925
926 if (!m_pAppCfg)
928 OSL_ENSURE( m_pAppCfg, "AppOptions not initialised :-(" );
929
930 if (!m_pInputCfg)
932 OSL_ENSURE( m_pInputCfg, "InputOptions not initialised :-(" );
933
935 SfxBindings* pBindings = pViewFrm ? &pViewFrm->GetBindings() : nullptr;
936
937 ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
938 ScDocShell* pDocSh = dynamic_cast<ScDocShell*>( SfxObjectShell::Current() );
939 ScDocument* pDoc = pDocSh ? &pDocSh->GetDocument() : nullptr;
940 bool bRepaint = false;
941 bool bUpdateMarks = false;
942 bool bUpdateRefDev = false;
943 bool bCalcAll = false;
944 bool bSaveAppOptions = false;
945 bool bSaveInputOptions = false;
946 bool bCompileErrorCells = false;
947
948 // SfxGetpApp()->SetOptions( rOptSet );
949
950 ScAppOptions aAppOptions = m_pAppCfg->GetOptions();
951
952 // No more linguistics
953 if (const SfxUInt16Item* pItem = rOptSet.GetItemIfSet(SID_ATTR_METRIC))
954 {
955 PutItem( *pItem );
956 aAppOptions.SetAppMetric( static_cast<FieldUnit>(pItem->GetValue()) );
957 bSaveAppOptions = true;
958 }
959
960 if (const ScUserListItem* pItem = rOptSet.GetItemIfSet(SCITEM_USERLIST))
961 {
962 ScGlobal::SetUserList( pItem->GetUserList() );
963 bSaveAppOptions = true;
964 }
965
966 if (const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_SC_OPT_SYNCZOOM))
967 {
968 aAppOptions.SetSynchronizeZoom( pItem->GetValue() );
969 bSaveAppOptions = true;
970 }
971
972 if (const SfxUInt16Item* pItem = rOptSet.GetItemIfSet(SID_SC_OPT_KEY_BINDING_COMPAT))
973 {
974 sal_uInt16 nVal = pItem->GetValue();
977 if (eOld != eNew)
978 {
979 aAppOptions.SetKeyBindingType(eNew);
980 bSaveAppOptions = true;
982 }
983 }
984
985 // DefaultsOptions
986 if (const ScTpDefaultsItem* pItem = rOptSet.GetItemIfSet(SID_SCDEFAULTSOPTIONS))
987 {
988 const ScDefaultsOptions& rOpt = pItem->GetDefaultsOptions();
989 SetDefaultsOptions( rOpt );
990 }
991
992 // FormulaOptions
993 if (const ScTpFormulaItem* pItem = rOptSet.GetItemIfSet(SID_SCFORMULAOPTIONS))
994 {
995 const ScFormulaOptions& rOpt = pItem->GetFormulaOptions();
996
997 if (!m_pFormulaCfg || (*m_pFormulaCfg != rOpt))
998 // Formula options have changed. Repaint the column headers.
999 bRepaint = true;
1000
1001 if (m_pFormulaCfg && m_pFormulaCfg->GetUseEnglishFuncName() != rOpt.GetUseEnglishFuncName())
1002 {
1003 // Re-compile formula cells with error as the error may have been
1004 // caused by unresolved function names.
1005 bCompileErrorCells = true;
1006 }
1007
1008 // Recalc for interpreter options changes.
1009 if (m_pFormulaCfg && m_pFormulaCfg->GetCalcConfig() != rOpt.GetCalcConfig())
1010 bCalcAll = true;
1011
1012 if ( pDocSh )
1013 {
1014 pDocSh->SetFormulaOptions( rOpt );
1015 pDocSh->SetDocumentModified();
1016 }
1017
1018 // ScDocShell::SetFormulaOptions() may check for changed settings, so
1019 // set the new options here after that has been called.
1020 if (!bCalcAll || rOpt.GetWriteCalcConfig())
1021 {
1022 // CalcConfig is new, didn't change or is global, simply set all.
1023 SetFormulaOptions( rOpt );
1024 }
1025 else
1026 {
1027 // If "only for current document" was checked, reset those affected
1028 // by that setting to previous values.
1029 ScFormulaOptions aNewOpt( rOpt);
1030 aNewOpt.GetCalcConfig().MergeDocumentSpecific( m_pFormulaCfg->GetCalcConfig());
1031 SetFormulaOptions( aNewOpt);
1032 }
1033 }
1034
1035 // ViewOptions
1036 if (const ScTpViewItem* pItem = rOptSet.GetItemIfSet(SID_SCVIEWOPTIONS))
1037 {
1038 const ScViewOptions& rNewOpt = pItem->GetViewOptions();
1039
1040 if ( pViewSh )
1041 {
1042 ScViewData& rViewData = pViewSh->GetViewData();
1043 const ScViewOptions& rOldOpt = rViewData.GetOptions();
1044
1045 bool bAnchorList = ( rOldOpt.GetOption( VOPT_ANCHOR ) !=
1046 rNewOpt.GetOption( VOPT_ANCHOR ) );
1047
1048 if ( rOldOpt != rNewOpt )
1049 {
1050 rViewData.SetOptions( rNewOpt ); // Changes rOldOpt
1051 rViewData.GetDocument().SetViewOptions( rNewOpt );
1052 if (pDocSh)
1053 pDocSh->SetDocumentModified();
1054 bRepaint = true;
1055 }
1056 if ( bAnchorList )
1057 pViewSh->UpdateAnchorHandles();
1058 }
1059 SetViewOptions( rNewOpt );
1060 if (pBindings)
1061 {
1062 pBindings->Invalidate(SID_HELPLINES_MOVE);
1063 }
1064 }
1065
1066 // GridOptions
1067 // Evaluate after ViewOptions, as GridOptions is a member of ViewOptions
1068 if ( const SvxGridItem* pItem = rOptSet.GetItemIfSet(SID_ATTR_GRID_OPTIONS) )
1069 {
1070 ScGridOptions aNewGridOpt( *pItem );
1071
1072 if ( pViewSh )
1073 {
1074 ScViewData& rViewData = pViewSh->GetViewData();
1075 ScViewOptions aNewViewOpt( rViewData.GetOptions() );
1076 const ScGridOptions& rOldGridOpt = aNewViewOpt.GetGridOptions();
1077
1078 if ( rOldGridOpt != aNewGridOpt )
1079 {
1080 aNewViewOpt.SetGridOptions( aNewGridOpt );
1081 rViewData.SetOptions( aNewViewOpt );
1082 rViewData.GetDocument().SetViewOptions( aNewViewOpt );
1083 if (pDocSh)
1084 pDocSh->SetDocumentModified();
1085 bRepaint = true;
1086 }
1087 }
1088 ScViewOptions aNewViewOpt ( GetViewOptions() );
1089 aNewViewOpt.SetGridOptions( aNewGridOpt );
1090 SetViewOptions( aNewViewOpt );
1091 if (pBindings)
1092 {
1093 pBindings->Invalidate(SID_GRID_VISIBLE);
1094 pBindings->Invalidate(SID_GRID_USE);
1095 }
1096 }
1097
1098 // DocOptions
1099 if ( const ScTpCalcItem* pItem = rOptSet.GetItemIfSet(SID_SCDOCOPTIONS) )
1100 {
1101 const ScDocOptions& rNewOpt = pItem->GetDocOptions();
1102
1103 if ( pDoc )
1104 {
1105 const ScDocOptions& rOldOpt = pDoc->GetDocOptions();
1106
1107 bRepaint = ( bRepaint || ( rOldOpt != rNewOpt ) );
1108 bCalcAll = bRepaint &&
1109 ( rOldOpt.IsIter() != rNewOpt.IsIter()
1110 || rOldOpt.GetIterCount() != rNewOpt.GetIterCount()
1111 || rOldOpt.GetIterEps() != rNewOpt.GetIterEps()
1112 || rOldOpt.IsIgnoreCase() != rNewOpt.IsIgnoreCase()
1113 || rOldOpt.IsCalcAsShown() != rNewOpt.IsCalcAsShown()
1114 || (rNewOpt.IsCalcAsShown() &&
1115 rOldOpt.GetStdPrecision() != rNewOpt.GetStdPrecision())
1116 || rOldOpt.IsMatchWholeCell() != rNewOpt.IsMatchWholeCell()
1117 || rOldOpt.GetYear2000() != rNewOpt.GetYear2000()
1118 || rOldOpt.IsFormulaRegexEnabled() != rNewOpt.IsFormulaRegexEnabled()
1120 );
1121 pDoc->SetDocOptions( rNewOpt );
1122 pDocSh->SetDocumentModified();
1123 }
1124 SetDocOptions( rNewOpt );
1125 }
1126
1127 // Set TabDistance after the actual DocOptions
1128 if ( const SfxUInt16Item* pItem = rOptSet.GetItemIfSet(SID_ATTR_DEFTABSTOP) )
1129 {
1130 sal_uInt16 nTabDist = pItem->GetValue();
1132 aOpt.SetTabDistance(nTabDist);
1133 SetDocOptions( aOpt );
1134
1135 if ( pDoc )
1136 {
1137 ScDocOptions aDocOpt(pDoc->GetDocOptions());
1138 aDocOpt.SetTabDistance(nTabDist);
1139 pDoc->SetDocOptions( aDocOpt );
1140 pDocSh->SetDocumentModified();
1141 if(pDoc->GetDrawLayer())
1142 pDoc->GetDrawLayer()->SetDefaultTabulator(nTabDist);
1143 }
1144 }
1145
1146 // AutoSpell after the DocOptions (due to being a member)
1147 if ( const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_AUTOSPELL_CHECK) ) // At DocOptions
1148 {
1149 bool bDoAutoSpell = pItem->GetValue();
1150
1151 if (pDoc)
1152 {
1153 ScDocOptions aNewOpt = pDoc->GetDocOptions();
1154 if ( aNewOpt.IsAutoSpell() != bDoAutoSpell )
1155 {
1156 aNewOpt.SetAutoSpell( bDoAutoSpell );
1157 pDoc->SetDocOptions( aNewOpt );
1158
1159 if (pViewSh)
1160 pViewSh->EnableAutoSpell(bDoAutoSpell);
1161
1162 bRepaint = true; // Because HideAutoSpell might be invalid
1163 //TODO: Paint all Views?
1164 }
1165 }
1166
1167 if ( bOldAutoSpell != bDoAutoSpell )
1168 SetAutoSpellProperty( bDoAutoSpell );
1169 if ( pDocSh )
1170 pDocSh->PostPaintGridAll(); // Due to marks
1171 ScInputHandler* pInputHandler = GetInputHdl();
1172 if ( pInputHandler )
1173 pInputHandler->UpdateSpellSettings(); // EditEngine flags
1174 if ( pViewSh )
1175 pViewSh->UpdateDrawTextOutliner(); // EditEngine flags
1176
1177 if (pBindings)
1178 pBindings->Invalidate( SID_AUTOSPELL_CHECK );
1179 }
1180
1181 // InputOptions
1182 ScInputOptions aInputOptions = m_pInputCfg->GetOptions();
1183 if ( const SfxUInt16Item* pItem = rOptSet.GetItemIfSet(SID_SC_INPUT_SELECTIONPOS) )
1184 {
1185 aInputOptions.SetMoveDir( pItem->GetValue() );
1186 bSaveInputOptions = true;
1187 }
1188 if ( const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_SC_INPUT_SELECTION) )
1189 {
1190 aInputOptions.SetMoveSelection( pItem->GetValue() );
1191 bSaveInputOptions = true;
1192 }
1193 if ( const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_SC_INPUT_EDITMODE) )
1194 {
1195 aInputOptions.SetEnterEdit( pItem->GetValue() );
1196 bSaveInputOptions = true;
1197 }
1198 if ( const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_SC_INPUT_FMT_EXPAND) )
1199 {
1200 aInputOptions.SetExtendFormat( pItem->GetValue() );
1201 bSaveInputOptions = true;
1202 }
1203 if ( const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_SC_INPUT_RANGEFINDER) )
1204 {
1205 aInputOptions.SetRangeFinder( pItem->GetValue() );
1206 bSaveInputOptions = true;
1207 }
1208 if ( const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_SC_INPUT_REF_EXPAND) )
1209 {
1210 aInputOptions.SetExpandRefs( pItem->GetValue() );
1211 bSaveInputOptions = true;
1212 }
1213 if (const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_SC_OPT_SORT_REF_UPDATE))
1214 {
1215 aInputOptions.SetSortRefUpdate( pItem->GetValue());
1216 bSaveInputOptions = true;
1217 }
1218
1219 if ( const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_SC_INPUT_MARK_HEADER) )
1220 {
1221 aInputOptions.SetMarkHeader( pItem->GetValue() );
1222 bSaveInputOptions = true;
1223 bUpdateMarks = true;
1224 }
1225 if ( const SfxBoolItem* pItem = rOptSet.GetItemIfSet(SID_SC_INPUT_TEXTWYSIWYG) )
1226 {
1227 bool bNew = pItem->GetValue();
1228 if ( bNew != aInputOptions.GetTextWysiwyg() )
1229 {
1230 aInputOptions.SetTextWysiwyg( bNew );
1231 bSaveInputOptions = true;
1232 bUpdateRefDev = true;
1233 }
1234 }
1235 if( const SfxBoolItem* pItem = rOptSet.GetItemIfSet( SID_SC_INPUT_REPLCELLSWARN ) )
1236 {
1237 aInputOptions.SetReplaceCellsWarn( pItem->GetValue() );
1238 bSaveInputOptions = true;
1239 }
1240
1241 if( const SfxBoolItem* pItem = rOptSet.GetItemIfSet( SID_SC_INPUT_LEGACY_CELL_SELECTION ) )
1242 {
1243 aInputOptions.SetLegacyCellSelection( pItem->GetValue() );
1244 bSaveInputOptions = true;
1245 }
1246
1247 if( const SfxBoolItem* pItem = rOptSet.GetItemIfSet( SID_SC_INPUT_ENTER_PASTE_MODE ) )
1248 {
1249 aInputOptions.SetEnterPasteMode( pItem->GetValue() );
1250 bSaveInputOptions = true;
1251 }
1252
1253 // PrintOptions
1254 if ( const ScTpPrintItem* pItem = rOptSet.GetItemIfSet(SID_SCPRINTOPTIONS) )
1255 {
1256 const ScPrintOptions& rNewOpt = pItem->GetPrintOptions();
1257 SetPrintOptions( rNewOpt );
1258
1259 // broadcast causes all previews to recalc page numbers
1260 SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScPrintOptions ) );
1261 }
1262
1263 if ( bSaveAppOptions )
1264 m_pAppCfg->SetOptions(aAppOptions);
1265
1266 if ( bSaveInputOptions )
1267 m_pInputCfg->SetOptions(aInputOptions);
1268
1269 // Kick off recalculation?
1270 if (pDoc && bCompileErrorCells)
1271 {
1272 // Re-compile cells with name error, and recalc if at least one cell
1273 // has been re-compiled. In the future we may want to find a way to
1274 // recalc only those that are affected.
1275 if (pDoc->CompileErrorCells(FormulaError::NoName))
1276 bCalcAll = true;
1277 }
1278
1279 if ( pDoc && bCalcAll )
1280 {
1282 pDoc->CalcAll();
1283 if ( pViewSh )
1284 pViewSh->UpdateCharts( true );
1285 else
1286 ScDBFunc::DoUpdateCharts( ScAddress(), *pDoc, true );
1287 if (pBindings)
1288 pBindings->Invalidate( SID_ATTR_SIZE ); //SvxPosSize StatusControl Update
1289 }
1290
1291 if ( pViewSh && bUpdateMarks )
1292 pViewSh->UpdateAutoFillMark();
1293
1294 // Repaint View?
1295 if ( pViewSh && bRepaint )
1296 {
1297 pViewSh->UpdateFixPos();
1298 pViewSh->PaintGrid();
1299 pViewSh->PaintTop();
1300 pViewSh->PaintLeft();
1301 pViewSh->PaintExtras();
1302 pViewSh->InvalidateBorder();
1303 if (pBindings)
1304 {
1305 pBindings->Invalidate( FID_TOGGLEHEADERS ); // -> Checks in menu
1306 pBindings->Invalidate( FID_TOGGLESYNTAX );
1307 }
1308 }
1309
1310 // update ref device (for all documents)
1311 if ( !bUpdateRefDev )
1312 return;
1313
1314 // for all documents: recalc output factor, update row heights
1316 while ( pObjSh )
1317 {
1318 if ( auto pOneDocSh = dynamic_cast<ScDocShell *>(pObjSh) )
1319 {
1320 pOneDocSh->CalcOutputFactor();
1321 SCTAB nTabCount = pOneDocSh->GetDocument().GetTableCount();
1322 for (SCTAB nTab=0; nTab<nTabCount; nTab++)
1323 pOneDocSh->AdjustRowHeight( 0, pDocSh->GetDocument().MaxRow(), nTab );
1324 }
1325 pObjSh = SfxObjectShell::GetNext( *pObjSh );
1326 }
1327
1328 // for all (tab-) views:
1329 SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
1330 while ( pSh )
1331 {
1332 ScTabViewShell* pOneViewSh = static_cast<ScTabViewShell*>(pSh);
1333
1334 // set ref-device for EditEngine
1335 ScInputHandler* pHdl = GetInputHdl(pOneViewSh);
1336 if (pHdl)
1337 pHdl->UpdateRefDevice();
1338
1339 // update view scale
1340 ScViewData& rViewData = pOneViewSh->GetViewData();
1341 pOneViewSh->SetZoom( rViewData.GetZoomX(), rViewData.GetZoomY(), false );
1342
1343 // repaint
1344 pOneViewSh->PaintGrid();
1345 pOneViewSh->PaintTop();
1346 pOneViewSh->PaintLeft();
1347
1348 pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
1349 }
1350}
1351
1356{
1358 return m_pRefInputHandler;
1359
1360 ScInputHandler* pHdl = nullptr;
1361 if ( !pViewSh )
1362 {
1363 // in case a UIActive embedded object has no ViewShell (UNO component)
1364 // the own calc view shell will be set as current, but no handling should happen
1365 ScTabViewShell* pCurViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
1366 if ( pCurViewSh && !pCurViewSh->GetUIActiveClient() )
1367 pViewSh = pCurViewSh;
1368 }
1369
1370 if ( pViewSh )
1371 pHdl = pViewSh->GetInputHandler(); // Viewshell always has one, from now on
1372
1373 // If no ViewShell passed or active, we can get NULL
1374 OSL_ENSURE( pHdl || !pViewSh, "GetInputHdl: no InputHandler found!" );
1375 return pHdl;
1376}
1377
1378void ScModule::ViewShellChanged(bool bStopEditing /*=true*/)
1379{
1380 ScInputHandler* pHdl = GetInputHdl();
1382 if ( pShell && pHdl )
1383 pShell->UpdateInputHandler(false, bStopEditing);
1384}
1385
1386void ScModule::SetInputMode( ScInputMode eMode, const OUString* pInitText )
1387{
1388 ScInputHandler* pHdl = GetInputHdl();
1389 if (pHdl)
1390 pHdl->SetMode(eMode, pInitText);
1391}
1392
1394{
1395 ScInputHandler* pHdl = GetInputHdl();
1396 return pHdl && pHdl->IsEditMode();
1397}
1398
1400{
1401 ScInputHandler* pHdl = GetInputHdl();
1402 return pHdl && pHdl->IsInputMode();
1403}
1404
1405bool ScModule::InputKeyEvent( const KeyEvent& rKEvt, bool bStartEdit )
1406{
1407 ScInputHandler* pHdl = GetInputHdl();
1408 return pHdl && pHdl->KeyInput( rKEvt, bStartEdit );
1409}
1410
1411void ScModule::InputEnterHandler( ScEnterMode nBlockMode, bool bBeforeSavingInLOK )
1412{
1413 if ( !SfxGetpApp()->IsDowning() ) // Not when quitting the program
1414 {
1415 ScInputHandler* pHdl = GetInputHdl();
1416 if (pHdl)
1417 pHdl->EnterHandler( nBlockMode, bBeforeSavingInLOK );
1418 }
1419}
1420
1422{
1423 ScInputHandler* pHdl = GetInputHdl();
1424 if (pHdl)
1425 pHdl->CancelHandler();
1426}
1427
1429{
1430 ScInputHandler* pHdl = GetInputHdl();
1431 if (pHdl)
1432 pHdl->InputSelection( pView );
1433}
1434
1436{
1437 ScInputHandler* pHdl = GetInputHdl();
1438 if (pHdl)
1439 pHdl->InputChanged( pView, false );
1440}
1441
1443{
1444 ScInputHandler* pHdl = GetInputHdl();
1445 if (pHdl)
1446 pHdl->ViewShellGone( pViewSh );
1447}
1448
1450{
1451 m_pRefInputHandler = pNew;
1452}
1453
1454void ScModule::InputGetSelection( sal_Int32& rStart, sal_Int32& rEnd )
1455{
1456 ScInputHandler* pHdl = GetInputHdl();
1457 if (pHdl)
1458 pHdl->InputGetSelection( rStart, rEnd );
1459}
1460
1461void ScModule::InputSetSelection( sal_Int32 nStart, sal_Int32 nEnd )
1462{
1463 ScInputHandler* pHdl = GetInputHdl();
1464 if (pHdl)
1465 pHdl->InputSetSelection( nStart, nEnd );
1466}
1467
1468void ScModule::InputReplaceSelection( std::u16string_view aStr )
1469{
1470 ScInputHandler* pHdl = GetInputHdl();
1471 if (pHdl)
1472 pHdl->InputReplaceSelection( aStr );
1473}
1474
1476{
1477 ScInputHandler* pHdl = GetInputHdl();
1478 if (pHdl)
1479 pHdl->InputTurnOffWinEngine();
1480}
1481
1482void ScModule::ActivateInputWindow( const OUString* pStrFormula, bool bMatrix )
1483{
1484 ScInputHandler* pHdl = GetInputHdl();
1485 if ( !pHdl )
1486 return;
1487
1488 ScInputWindow* pWin = pHdl->GetInputWindow();
1489 if ( pStrFormula )
1490 {
1491 // Take over formula
1492 if ( pWin )
1493 {
1494 pWin->SetFuncString( *pStrFormula, false );
1495 // SetSumAssignMode due to sal_False not necessary
1496 }
1498 pHdl->EnterHandler( nMode );
1499
1500 // Without Invalidate the selection remains active, if the formula has not changed
1501 if (pWin)
1502 pWin->TextInvalidate();
1503 }
1504 else
1505 {
1506 // Cancel
1507 if ( pWin )
1508 {
1509 pWin->SetFuncString( OUString(), false );
1510 // SetSumAssignMode due to sal_False no necessary
1511 }
1512 pHdl->CancelHandler();
1513 }
1514}
1515
1519void ScModule::SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm )
1520{
1521 //TODO: Move reference dialog handling to view
1522 // Just keep function autopilot here for references to other documents
1523 if ( !(m_nCurRefDlgId == 0 || ( nId == m_nCurRefDlgId && !bVis )
1525 return;
1526
1527 if ( !pViewFrm )
1528 pViewFrm = SfxViewFrame::Current();
1529
1530 // bindings update causes problems with update of stylist if
1531 // current style family has changed
1532 //if ( pViewFrm )
1533 // pViewFrm->GetBindings().Update(); // to avoid trouble in LockDispatcher
1534
1535 // before SetChildWindow
1537 {
1538 if ( bVis )
1540 }
1541 else
1542 {
1543 m_nCurRefDlgId = bVis ? nId : 0;
1544 }
1545
1546 if ( pViewFrm )
1547 {
1548 // store the dialog id also in the view shell
1549 SfxViewShell* pViewSh = pViewFrm->GetViewShell();
1550 if (ScTabViewShell* pTabViewSh = dynamic_cast<ScTabViewShell*>(pViewSh))
1551 pTabViewSh->SetCurRefDlgId(m_nCurRefDlgId);
1552 else
1553 {
1554 // no ScTabViewShell - possible for example from a Basic macro
1555 bVis = false;
1556 m_nCurRefDlgId = 0; // don't set nCurRefDlgId if no dialog is created
1557 }
1558
1559 pViewFrm->SetChildWindow( nId, bVis );
1560 }
1561
1562 SfxApplication* pSfxApp = SfxGetpApp();
1563 pSfxApp->Broadcast( SfxHint( SfxHintId::ScRefModeChanged ) );
1564}
1565
1567{
1568 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1569
1570 // #i46999# current view frame can be null (for example, when closing help)
1571 return pViewFrm ? pViewFrm->GetChildWindow( nId ) : nullptr;
1572}
1573
1575{
1576 // First, try the current view
1578 if ( pChildWnd )
1579 return pChildWnd; // found in the current view
1580
1581 // if not found there, get the child window from any open view
1582 // it can be open only in one view because nCurRefDlgId is global
1583
1585 while ( pViewFrm )
1586 {
1587 pChildWnd = pViewFrm->GetChildWindow( nId );
1588 if ( pChildWnd )
1589 return pChildWnd; // found in any view
1590
1591 pViewFrm = SfxViewFrame::GetNext( *pViewFrm );
1592 }
1593
1594 return nullptr; // none found
1595}
1596
1598{
1599 //TODO: Move reference dialog handling to view
1600 // Just keep function autopilot here for references to other documents
1601 bool bIsModal = false;
1602
1603 if ( m_nCurRefDlgId )
1604 {
1606 if ( pChildWnd )
1607 {
1608 if (pChildWnd->GetController())
1609 {
1610 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
1611 assert(pRefDlg);
1612 bIsModal = pChildWnd->IsVisible() && pRefDlg &&
1613 !( pRefDlg->IsRefInputMode() && pRefDlg->IsDocAllowed(pDocSh) );
1614 }
1615 }
1616 else if ( pDocSh && comphelper::LibreOfficeKit::isActive() )
1617 {
1618 // m_nCurRefDlgId is not deglobalized so it can be set by other view
1619 // in LOK case when no ChildWindow for this view was detected -> fallback
1620 ScInputHandler* pHdl = GetInputHdl();
1621 if ( pHdl )
1622 bIsModal = pHdl->IsModalMode(pDocSh);
1623 }
1624 }
1625 else if (pDocSh)
1626 {
1627 ScInputHandler* pHdl = GetInputHdl();
1628 if ( pHdl )
1629 bIsModal = pHdl->IsModalMode(pDocSh);
1630 }
1631
1632 return bIsModal;
1633}
1634
1636{
1637 //TODO: Move reference dialog handling to view
1638 // Just keep function autopilot here for references to other documents
1639 bool bLocked = false;
1640
1641 // Up until now just for ScAnyRefDlg
1642 if ( m_nCurRefDlgId )
1643 {
1645 if ( pChildWnd )
1646 {
1647 if (pChildWnd->GetController())
1648 {
1649 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
1650 assert(pRefDlg);
1651 if (pRefDlg)
1652 bLocked = pRefDlg->IsTableLocked();
1653 }
1654 }
1656 bLocked = true; // for other views, see IsModalMode
1657 }
1658
1659 // We can't stop LOK clients from switching part, and getting out of sync.
1660 assert(!bLocked || !comphelper::LibreOfficeKit::isActive());
1661
1662 return bLocked;
1663}
1664
1666{
1667 //TODO: Move reference dialog handling to view
1668 // Just keep function autopilot here for references to other documents
1669 bool bIsOpen = false;
1670
1671 if ( m_nCurRefDlgId )
1672 {
1674 if ( pChildWnd )
1675 bIsOpen = pChildWnd->IsVisible();
1676 }
1677
1678 return bIsOpen;
1679}
1680
1682{
1683 //TODO: Move reference dialog handling to view
1684 // Just keep function autopilot here for references to other documents
1685 bool bIsFormula = false;
1686
1687 if ( m_nCurRefDlgId )
1688 {
1689 SfxChildWindow* pChildWnd = nullptr;
1690
1693 else
1695
1696 if ( pChildWnd )
1697 {
1698 if (pChildWnd->GetController())
1699 {
1700 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
1701 assert(pRefDlg);
1702 bIsFormula = pChildWnd->IsVisible() && pRefDlg && pRefDlg->IsRefInputMode();
1703 }
1704 }
1706 {
1707 // m_nCurRefDlgId is not deglobalized so it can be set by other view
1708 // in LOK case when no ChildWindow for this view was detected -> fallback
1709 ScInputHandler* pHdl = GetInputHdl();
1710 if ( pHdl )
1711 bIsFormula = pHdl->IsFormulaMode();
1712 }
1713 }
1714 else
1715 {
1716 ScInputHandler* pHdl = GetInputHdl();
1717 if ( pHdl )
1718 bIsFormula = pHdl->IsFormulaMode();
1719 }
1720
1722 bIsFormula = true;
1723
1724 return bIsFormula;
1725}
1726
1727static void lcl_MarkedTabs( const ScMarkData& rMark, SCTAB& rStartTab, SCTAB& rEndTab )
1728{
1729 if (rMark.GetSelectCount() > 1)
1730 {
1731 rEndTab = rMark.GetLastSelected();
1732 rStartTab = rMark.GetFirstSelected();
1733 }
1734}
1735
1737 const ScMarkData* pMarkData )
1738{
1739 //TODO: Move reference dialog handling to view
1740 // Just keep function autopilot here for references to other documents
1741
1742 // In RefDialogs we also trigger the ZoomIn, if the Ref's Start and End are different
1743 ScRange aNew = rRef;
1744 aNew.PutInOrder(); // Always in the right direction
1745
1746 if( m_nCurRefDlgId )
1747 {
1748 SfxChildWindow* pChildWnd = nullptr;
1749
1752 else
1754
1755 OSL_ENSURE( pChildWnd, "NoChildWin" );
1756 if ( pChildWnd )
1757 {
1758 if ( m_nCurRefDlgId == SID_OPENDLG_CONSOLIDATE && pMarkData )
1759 {
1760 SCTAB nStartTab = aNew.aStart.Tab();
1761 SCTAB nEndTab = aNew.aEnd.Tab();
1762 lcl_MarkedTabs( *pMarkData, nStartTab, nEndTab );
1763 aNew.aStart.SetTab(nStartTab);
1764 aNew.aEnd.SetTab(nEndTab);
1765 }
1766
1767 if (pChildWnd->GetController())
1768 {
1769 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
1770 assert(pRefDlg);
1771 if(pRefDlg)
1772 {
1773 // hide the (color) selection now instead of later from LoseFocus,
1774 // don't abort the ref input that causes this call (bDoneRefMode = sal_False)
1775 pRefDlg->HideReference( false );
1776 pRefDlg->SetReference( aNew, rDoc );
1777 }
1778 }
1779 }
1781 {
1782 // m_nCurRefDlgId is not deglobalized so it can be set by other view
1783 // in LOK case when no ChildWindow for this view was detected -> fallback
1784 ScInputHandler* pHdl = GetInputHdl();
1785 if (pHdl)
1786 pHdl->SetReference( aNew, rDoc );
1787 }
1788 }
1789 else
1790 {
1791 ScInputHandler* pHdl = GetInputHdl();
1792 if (pHdl)
1793 pHdl->SetReference( aNew, rDoc );
1794 else
1795 {
1796 OSL_FAIL("SetReference without receiver");
1797 }
1798 }
1799}
1800
1805{
1806 //TODO: Move reference dialog handling to view
1807 // Just keep function autopilot here for references to other documents
1808 if ( m_nCurRefDlgId )
1809 {
1811 OSL_ENSURE( pChildWnd, "NoChildWin" );
1812 if ( pChildWnd )
1813 {
1814 if (pChildWnd->GetController())
1815 {
1816 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
1817 assert(pRefDlg);
1818 if (pRefDlg)
1819 {
1820 pRefDlg->AddRefEntry();
1821 }
1822 }
1823 }
1824 }
1825 else
1826 {
1827 ScInputHandler* pHdl = GetInputHdl();
1828 if (pHdl)
1829 pHdl->AddRefEntry();
1830 }
1831}
1832
1834{
1835 //TODO: Move reference dialog handling to view
1836 // Just keep function autopilot here for references to other documents
1837
1838 // We also annul the ZoomIn again in RefDialogs
1839
1840 //FIXME: ShowRefFrame at InputHdl, if the Function AutoPilot is open?
1841 if ( !m_nCurRefDlgId )
1842 return;
1843
1844 SfxChildWindow* pChildWnd = nullptr;
1845
1848 else
1850
1851 OSL_ENSURE( pChildWnd, "NoChildWin" );
1852 if ( pChildWnd )
1853 {
1854 if (pChildWnd->GetController())
1855 {
1856 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
1857 assert(pRefDlg);
1858 if(pRefDlg)
1859 {
1860 pRefDlg->SetActive();
1861 }
1862 }
1863 }
1864}
1865
1870{
1871 sal_uInt64 nOldTime = m_aIdleTimer.GetTimeout();
1872 if ( nOldTime != SC_IDLE_MIN )
1874
1875 nIdleCount = 0;
1876}
1877
1878static void lcl_CheckNeedsRepaint( const ScDocShell* pDocShell )
1879{
1880 SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocShell );
1881 while ( pFrame )
1882 {
1883 SfxViewShell* p = pFrame->GetViewShell();
1884 ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( p );
1885 if ( pViewSh )
1886 pViewSh->CheckNeedsRepaint();
1887 pFrame = SfxViewFrame::GetNext( *pFrame, pDocShell );
1888 }
1889}
1890
1891IMPL_LINK_NOARG(ScModule, IdleHandler, Timer *, void)
1892{
1893 if ( Application::AnyInput( VclInputFlags::MOUSE | VclInputFlags::KEYBOARD ) )
1894 {
1895 m_aIdleTimer.Start(); // Timeout unchanged
1896 return;
1897 }
1898
1899 bool bMore = false;
1900 ScDocShell* pDocSh = dynamic_cast<ScDocShell*>(SfxObjectShell::Current());
1901
1902 if ( pDocSh )
1903 {
1904 ScDocument& rDoc = pDocSh->GetDocument();
1905 sc::DocumentLinkManager& rLinkMgr = rDoc.GetDocLinkManager();
1906 bool bLinks = rLinkMgr.idleCheckLinks();
1907 bool bWidth = rDoc.IdleCalcTextWidth();
1908
1909 bMore = bLinks || bWidth; // Still something at all?
1910
1911 // While calculating a Basic formula, a paint event may have occurred,
1912 // so check the bNeedsRepaint flags for this document's views
1913 if (bWidth)
1914 lcl_CheckNeedsRepaint( pDocSh );
1915 }
1916
1917
1918 sal_uInt64 nOldTime = m_aIdleTimer.GetTimeout();
1919 sal_uInt64 nNewTime = nOldTime;
1920 if ( bMore )
1921 {
1922 nNewTime = SC_IDLE_MIN;
1923 nIdleCount = 0;
1924 }
1925 else
1926 {
1927 // Set SC_IDLE_COUNT to initial Timeout - increase afterwards
1928 if ( nIdleCount < SC_IDLE_COUNT )
1929 ++nIdleCount;
1930 else
1931 {
1932 nNewTime += SC_IDLE_STEP;
1933 if ( nNewTime > SC_IDLE_MAX )
1934 nNewTime = SC_IDLE_MAX;
1935 }
1936 }
1937 if ( nNewTime != nOldTime )
1938 m_aIdleTimer.SetTimeout( nNewTime );
1939
1940
1941 m_aIdleTimer.Start();
1942}
1943
1947std::optional<SfxItemSet> ScModule::CreateItemSet( sal_uInt16 nId )
1948{
1949 std::optional<SfxItemSet> pRet;
1950 if(SID_SC_EDITOPTIONS == nId)
1951 {
1952 pRet.emplace(
1953 GetPool(),
1954 svl::Items<
1955 // TP_USERLISTS:
1957 // TP_GRID:
1958 SID_ATTR_GRID_OPTIONS, SID_ATTR_GRID_OPTIONS,
1959 SID_ATTR_METRIC, SID_ATTR_METRIC,
1960 SID_ATTR_DEFTABSTOP, SID_ATTR_DEFTABSTOP,
1961 // TP_INPUT:
1962 SID_SC_INPUT_LEGACY_CELL_SELECTION, SID_SC_OPT_SORT_REF_UPDATE,
1963 // TP_FORMULA, TP_DEFAULTS:
1964 SID_SCFORMULAOPTIONS, SID_SCDEFAULTSOPTIONS,
1965 // TP_VIEW, TP_CALC:
1966 SID_SCVIEWOPTIONS, SID_SCDOCOPTIONS,
1967 // TP_INPUT:
1968 SID_SC_INPUT_ENTER_PASTE_MODE, SID_SC_INPUT_ENTER_PASTE_MODE,
1969 // TP_PRINT:
1970 SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS,
1971 // TP_INPUT:
1972 SID_SC_INPUT_SELECTION, SID_SC_INPUT_MARK_HEADER,
1973 SID_SC_INPUT_TEXTWYSIWYG, SID_SC_INPUT_TEXTWYSIWYG,
1974 SID_SC_INPUT_REPLCELLSWARN, SID_SC_INPUT_REPLCELLSWARN,
1975 // TP_VIEW:
1976 SID_SC_OPT_SYNCZOOM, SID_SC_OPT_KEY_BINDING_COMPAT>);
1977
1978 const ScAppOptions& rAppOpt = GetAppOptions();
1979
1980 ScDocShell* pDocSh = dynamic_cast< ScDocShell *>( SfxObjectShell::Current() );
1981 ScDocOptions aCalcOpt = pDocSh
1982 ? pDocSh->GetDocument().GetDocOptions()
1983 : GetDocOptions();
1984
1985 ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( SfxViewShell::Current() );
1986 ScViewOptions aViewOpt = pViewSh
1987 ? pViewSh->GetViewData().GetOptions()
1988 : GetViewOptions();
1989
1992
1993 // SfxGetpApp()->GetOptions( aSet );
1994
1995 pRet->Put( SfxUInt16Item( SID_ATTR_METRIC,
1996 sal::static_int_cast<sal_uInt16>(rAppOpt.GetAppMetric()) ) );
1997
1998 // TP_CALC
1999 pRet->Put( SfxUInt16Item( SID_ATTR_DEFTABSTOP,
2000 aCalcOpt.GetTabDistance()));
2001 pRet->Put( ScTpCalcItem( SID_SCDOCOPTIONS, aCalcOpt ) );
2002
2003 // TP_VIEW
2004 pRet->Put( ScTpViewItem( aViewOpt ) );
2005 pRet->Put( SfxBoolItem( SID_SC_OPT_SYNCZOOM, rAppOpt.GetSynchronizeZoom() ) );
2006
2007 // TP_INPUT
2008 const ScInputOptions& rInpOpt = GetInputOptions();
2009 pRet->Put( SfxUInt16Item( SID_SC_INPUT_SELECTIONPOS,
2010 rInpOpt.GetMoveDir() ) );
2011 pRet->Put( SfxBoolItem( SID_SC_INPUT_SELECTION,
2012 rInpOpt.GetMoveSelection() ) );
2013 pRet->Put( SfxBoolItem( SID_SC_INPUT_EDITMODE,
2014 rInpOpt.GetEnterEdit() ) );
2015 pRet->Put( SfxBoolItem( SID_SC_INPUT_FMT_EXPAND,
2016 rInpOpt.GetExtendFormat() ) );
2017 pRet->Put( SfxBoolItem( SID_SC_INPUT_RANGEFINDER,
2018 rInpOpt.GetRangeFinder() ) );
2019 pRet->Put( SfxBoolItem( SID_SC_INPUT_REF_EXPAND,
2020 rInpOpt.GetExpandRefs() ) );
2021 pRet->Put( SfxBoolItem(SID_SC_OPT_SORT_REF_UPDATE, rInpOpt.GetSortRefUpdate()));
2022 pRet->Put( SfxBoolItem( SID_SC_INPUT_MARK_HEADER,
2023 rInpOpt.GetMarkHeader() ) );
2024 pRet->Put( SfxBoolItem( SID_SC_INPUT_TEXTWYSIWYG,
2025 rInpOpt.GetTextWysiwyg() ) );
2026 pRet->Put( SfxBoolItem( SID_SC_INPUT_REPLCELLSWARN,
2027 rInpOpt.GetReplaceCellsWarn() ) );
2028 pRet->Put( SfxBoolItem( SID_SC_INPUT_LEGACY_CELL_SELECTION,
2029 rInpOpt.GetLegacyCellSelection() ) );
2030 pRet->Put( SfxBoolItem( SID_SC_INPUT_ENTER_PASTE_MODE,
2031 rInpOpt.GetEnterPasteMode() ) );
2032
2033 // RID_SC_TP_PRINT
2034 pRet->Put( ScTpPrintItem( GetPrintOptions() ) );
2035
2036 // TP_GRID
2037 pRet->Put( aViewOpt.CreateGridItem() );
2038
2039 // TP_USERLISTS
2040 if ( pUL )
2041 {
2042 aULItem.SetUserList( *pUL );
2043 pRet->Put(aULItem);
2044 }
2045
2046 // TP_COMPATIBILITY
2047 pRet->Put( SfxUInt16Item( SID_SC_OPT_KEY_BINDING_COMPAT,
2048 rAppOpt.GetKeyBindingType() ) );
2049
2050 // TP_DEFAULTS
2051 pRet->Put( ScTpDefaultsItem( GetDefaultsOptions() ) );
2052
2053 // TP_FORMULA
2055 if (pDocSh)
2056 {
2057 ScCalcConfig aConfig( aOptions.GetCalcConfig());
2058 aConfig.MergeDocumentSpecific( pDocSh->GetDocument().GetCalcConfig());
2059 aOptions.SetCalcConfig( aConfig);
2060 }
2061 pRet->Put( ScTpFormulaItem( std::move(aOptions) ) );
2062 }
2063 return pRet;
2064}
2065
2066void ScModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
2067{
2068 if(SID_SC_EDITOPTIONS == nId)
2069 {
2071 }
2072}
2073
2074std::unique_ptr<SfxTabPage> ScModule::CreateTabPage( sal_uInt16 nId, weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet )
2075{
2076 std::unique_ptr<SfxTabPage> xRet;
2078 switch(nId)
2079 {
2080 case SID_SC_TP_LAYOUT:
2081 {
2082 ::CreateTabPage ScTpLayoutOptionsCreate = pFact->GetTabPageCreatorFunc(SID_SC_TP_LAYOUT);
2083 if (ScTpLayoutOptionsCreate)
2084 xRet = (*ScTpLayoutOptionsCreate)(pPage, pController, &rSet);
2085 break;
2086 }
2087 case SID_SC_TP_CONTENT:
2088 {
2089 ::CreateTabPage ScTpContentOptionsCreate = pFact->GetTabPageCreatorFunc(SID_SC_TP_CONTENT);
2090 if (ScTpContentOptionsCreate)
2091 xRet = (*ScTpContentOptionsCreate)(pPage, pController, &rSet);
2092 break;
2093 }
2094 case SID_SC_TP_GRID:
2095 xRet = SvxGridTabPage::Create(pPage, pController, rSet);
2096 break;
2097 case SID_SC_TP_USERLISTS:
2098 {
2099 ::CreateTabPage ScTpUserListsCreate = pFact->GetTabPageCreatorFunc(SID_SC_TP_USERLISTS);
2100 if (ScTpUserListsCreate)
2101 xRet = (*ScTpUserListsCreate)(pPage, pController, &rSet);
2102 break;
2103 }
2104 case SID_SC_TP_CALC:
2105 {
2106 ::CreateTabPage ScTpCalcOptionsCreate = pFact->GetTabPageCreatorFunc(SID_SC_TP_CALC);
2107 if (ScTpCalcOptionsCreate)
2108 xRet = (*ScTpCalcOptionsCreate)(pPage, pController, &rSet);
2109 break;
2110 }
2111 case SID_SC_TP_FORMULA:
2112 {
2113 ::CreateTabPage ScTpFormulaOptionsCreate = pFact->GetTabPageCreatorFunc(SID_SC_TP_FORMULA);
2114 if (ScTpFormulaOptionsCreate)
2115 xRet = (*ScTpFormulaOptionsCreate)(pPage, pController, &rSet);
2116 break;
2117 }
2118 case SID_SC_TP_COMPATIBILITY:
2119 {
2120 ::CreateTabPage ScTpCompatOptionsCreate = pFact->GetTabPageCreatorFunc(SID_SC_TP_COMPATIBILITY);
2121 if (ScTpCompatOptionsCreate)
2122 xRet = (*ScTpCompatOptionsCreate)(pPage, pController, &rSet);
2123 break;
2124 }
2125 case SID_SC_TP_CHANGES:
2126 {
2127 ::CreateTabPage ScRedlineOptionsTabPageCreate = pFact->GetTabPageCreatorFunc(SID_SC_TP_CHANGES);
2128 if (ScRedlineOptionsTabPageCreate)
2129 xRet =(*ScRedlineOptionsTabPageCreate)(pPage, pController, &rSet);
2130 break;
2131 }
2132 case RID_SC_TP_PRINT:
2133 {
2134 ::CreateTabPage ScTpPrintOptionsCreate = pFact->GetTabPageCreatorFunc(RID_SC_TP_PRINT);
2135 if (ScTpPrintOptionsCreate)
2136 xRet = (*ScTpPrintOptionsCreate)(pPage, pController, &rSet);
2137 break;
2138 }
2139 case RID_SC_TP_DEFAULTS:
2140 {
2141 ::CreateTabPage ScTpDefaultsOptionsCreate = pFact->GetTabPageCreatorFunc(RID_SC_TP_DEFAULTS);
2142 if (ScTpDefaultsOptionsCreate)
2143 xRet = (*ScTpDefaultsOptionsCreate)(pPage, pController, &rSet);
2144 break;
2145 }
2146 }
2147
2148 OSL_ENSURE( xRet, "ScModule::CreateTabPage(): no valid ID for TabPage!" );
2149
2150 return xRet;
2151}
2152
2153IMPL_LINK( ScModule, CalcFieldValueHdl, EditFieldInfo*, pInfo, void )
2154{
2155 //TODO: Merge with ScFieldEditEngine!
2156 if (!pInfo)
2157 return;
2158
2159 const SvxFieldItem& rField = pInfo->GetField();
2160 const SvxFieldData* pField = rField.GetField();
2161
2162 if (const SvxURLField* pURLField = dynamic_cast<const SvxURLField*>(pField))
2163 {
2164 // URLField
2165 const OUString& aURL = pURLField->GetURL();
2166
2167 switch ( pURLField->GetFormat() )
2168 {
2169 case SvxURLFormat::AppDefault: //TODO: Settable in the App?
2170 case SvxURLFormat::Repr:
2171 {
2172 pInfo->SetRepresentation( pURLField->GetRepresentation() );
2173 }
2174 break;
2175
2176 case SvxURLFormat::Url:
2177 {
2178 pInfo->SetRepresentation( aURL );
2179 }
2180 break;
2181 }
2182
2185 pInfo->SetTextColor( GetColorConfig().GetColorValue(eEntry).nColor );
2186 }
2187 else
2188 {
2189 OSL_FAIL("Unknown Field");
2190 pInfo->SetRepresentation(OUString('?'));
2191 }
2192}
2193
2194void ScModule::RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd, weld::Window* pWndAncestor)
2195{
2196 std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = m_mapRefController[nSlotId];
2197
2198 if (std::none_of(rlRefWindow.begin(), rlRefWindow.end(),
2199 [rWnd](const std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>& rCandidate)
2200 {
2201 return rCandidate.first.get() == rWnd.get();
2202 }))
2203 {
2204 rlRefWindow.emplace_back(rWnd, pWndAncestor);
2205 }
2206}
2207
2208void ScModule::UnregisterRefController(sal_uInt16 nSlotId, const std::shared_ptr<SfxDialogController>& rWnd)
2209{
2210 auto iSlot = m_mapRefController.find( nSlotId );
2211
2212 if( iSlot == m_mapRefController.end() )
2213 return;
2214
2215 std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = iSlot->second;
2216
2217 auto i = std::find_if(rlRefWindow.begin(), rlRefWindow.end(),
2218 [rWnd](const std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>& rCandidate)
2219 {
2220 return rCandidate.first.get() == rWnd.get();
2221 });
2222
2223 if( i == rlRefWindow.end() )
2224 return;
2225
2226 rlRefWindow.erase( i );
2227
2228 if( rlRefWindow.empty() )
2229 m_mapRefController.erase( nSlotId );
2230}
2231
2232std::shared_ptr<SfxDialogController> ScModule::Find1RefWindow(sal_uInt16 nSlotId, const weld::Window *pWndAncestor)
2233{
2234 if (!pWndAncestor)
2235 return nullptr;
2236
2237 auto iSlot = m_mapRefController.find( nSlotId );
2238
2239 if( iSlot == m_mapRefController.end() )
2240 return nullptr;
2241
2242 std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = iSlot->second;
2243
2244 for (auto const& refWindow : rlRefWindow)
2245 if ( refWindow.second == pWndAncestor )
2246 return refWindow.first;
2247
2248 return nullptr;
2249}
2250
2251using namespace com::sun::star;
2252
2253constexpr OUStringLiteral LINGUPROP_AUTOSPELL = u"IsSpellAuto";
2254
2256 bool& rAutoSpell )
2257{
2258 // use SvtLinguConfig instead of service LinguProperties to avoid
2259 // loading the linguistic component
2260 SvtLinguConfig aConfig;
2261
2262 SvtLinguOptions aOptions;
2263 aConfig.GetOptions( aOptions );
2264
2265 rDefLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage, css::i18n::ScriptType::LATIN);
2266 rCjkLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK, css::i18n::ScriptType::ASIAN);
2267 rCtlLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL, css::i18n::ScriptType::COMPLEX);
2268 rAutoSpell = aOptions.bIsSpellAuto;
2269}
2270
2272{
2273 // use SvtLinguConfig instead of service LinguProperties to avoid
2274 // loading the linguistic component
2275 SvtLinguConfig aConfig;
2276
2277 aConfig.SetProperty( LINGUPROP_AUTOSPELL, uno::Any(bSet) );
2278}
2279
2281{
2282 if ( nLang == LANGUAGE_NONE )
2283 return false;
2284
2285 bool bHasLang = false;
2286 try
2287 {
2288 uno::Reference< linguistic2::XThesaurus > xThes(LinguMgr::GetThesaurus());
2289 if ( xThes.is() )
2290 bHasLang = xThes->hasLocale( LanguageTag::convertToLocale( nLang ) );
2291 }
2292 catch( uno::Exception& )
2293 {
2294 OSL_FAIL("Error in Thesaurus");
2295 }
2296
2297 return bHasLang;
2298}
2299
2300std::optional<SfxStyleFamilies> ScModule::CreateStyleFamilies()
2301{
2302 SfxStyleFamilies aStyleFamilies;
2303
2304 aStyleFamilies.emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Para,
2305 ScResId(STR_STYLE_FAMILY_CELL),
2306 BMP_STYLES_FAMILY_CELL,
2307 RID_CELLSTYLEFAMILY, SC_MOD()->GetResLocale()));
2308
2309 aStyleFamilies.emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Page,
2310 ScResId(STR_STYLE_FAMILY_PAGE),
2311 BMP_STYLES_FAMILY_PAGE,
2312 RID_PAGESTYLEFAMILY, SC_MOD()->GetResLocale()));
2313
2314 aStyleFamilies.emplace_back(SfxStyleFamilyItem(SfxStyleFamily::Frame,
2315 ScResId(STR_STYLE_FAMILY_GRAPHICS),
2316 BMP_STYLES_FAMILY_GRAPHICS,
2317 RID_GRAPHICSTYLEFAMILY, SC_MOD()->GetResLocale()));
2318
2319 return aStyleFamilies;
2320}
2321
2322void ScModule::RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller)
2323{
2325}
2326
2327void ScModule::CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments)
2328{
2330 mxAutomationApplicationEventsCaller->CallSinks(Method, Arguments);
2331}
2332
2333/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxApplication * SfxGetpApp()
#define GetWhich(nSlot)
static bool AnyInput(VclInputFlags nType=VCL_INPUT_ANY)
sal_uInt32 GetValue() const
OUString AsRGBHexString() const
static INetURLHistory * GetOrCreate()
bool QueryUrl(const INetURLObject &rUrl) const
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
static css::uno::Reference< css::linguistic2::XThesaurus > GetThesaurus()
static LanguageType resolveSystemLanguageByScriptType(LanguageType nLang, sal_Int16 nType)
void SetDigitLanguage(LanguageType)
virtual CreateTabPage GetTabPageCreatorFunc(sal_uInt16 nId)=0
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
Definition: scabstdlg.cxx:37
SCTAB Tab() const
Definition: address.hxx:283
void SetTab(SCTAB nTabP)
Definition: address.hxx:295
void SetStatusFunc(sal_uInt32 nNew)
Definition: appoptio.hxx:51
sal_uInt16 GetLRUFuncListCount() const
Definition: appoptio.hxx:47
void SetKeyBindingType(ScOptionsUtil::KeyBindingType e)
Definition: appoptio.hxx:78
FieldUnit GetAppMetric() const
Definition: appoptio.hxx:40
void SetLRUFuncList(const sal_uInt16 *pList, const sal_uInt16 nCount)
Definition: appoptio.cxx:107
void SetDetectiveAuto(bool bNew)
Definition: appoptio.hxx:55
void SetAutoComplete(bool bNew)
Definition: appoptio.hxx:53
bool GetSynchronizeZoom() const
Definition: appoptio.hxx:46
void SetAppMetric(FieldUnit eUnit)
Definition: appoptio.hxx:39
sal_uInt16 * GetLRUFuncList() const
Definition: appoptio.hxx:48
bool GetAutoComplete() const
Definition: appoptio.hxx:54
ScOptionsUtil::KeyBindingType GetKeyBindingType() const
Definition: appoptio.hxx:77
bool GetDetectiveAuto() const
Definition: appoptio.hxx:56
void SetSynchronizeZoom(bool bNew)
Definition: appoptio.hxx:45
static sal_uInt16 DoUpdateCharts(const ScAddress &rPos, ScDocument &rDoc, bool bAllCharts)
Definition: dbfunc4.cxx:31
void UpdateCharts(bool bAllCharts)
Definition: dbfunc2.cxx:24
static void InitializeColors()
Definition: detfunc.cxx:1631
static void UpdateAllComments(ScDocument &rDoc)
on all tables
Definition: detfunc.cxx:1378
static Color GetArrowColor()
Definition: detfunc.cxx:1610
static bool IsColorsInitialized()
Definition: detfunc.cxx:1643
void UpdateAllArrowColors()
on all tables
Definition: detfunc.cxx:1403
static Color GetErrorColor()
Definition: detfunc.cxx:1617
static Color GetCommentColor()
Definition: detfunc.cxx:1624
sal_uInt16 GetYear2000() const
Definition: docoptio.hxx:85
bool IsFormulaWildcardsEnabled() const
Definition: docoptio.hxx:98
bool IsIgnoreCase() const
Definition: docoptio.hxx:57
void SetTabDistance(sal_uInt16 nTabDist)
Definition: docoptio.hxx:71
sal_uInt16 GetIterCount() const
Definition: docoptio.hxx:61
void SetAutoSpell(bool bVal)
Definition: docoptio.hxx:54
sal_uInt16 GetTabDistance() const
Definition: docoptio.hxx:70
bool IsAutoSpell() const
Definition: docoptio.hxx:53
sal_uInt16 GetStdPrecision() const
Definition: docoptio.hxx:78
bool IsIter() const
Definition: docoptio.hxx:59
bool IsMatchWholeCell() const
Definition: docoptio.hxx:55
bool IsFormulaRegexEnabled() const
Definition: docoptio.hxx:95
bool IsCalcAsShown() const
Definition: docoptio.hxx:81
double GetIterEps() const
Definition: docoptio.hxx:63
static weld::Window * GetActiveDialogParent()
Definition: docsh.cxx:3112
void PostPaintGridAll()
Definition: docsh3.cxx:183
void SetDocumentModified()
Definition: docsh.cxx:2982
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
ScTabViewShell * GetBestViewShell(bool bOnlyVisible=true)
Definition: docsh4.cxx:2623
void SetFormulaOptions(const ScFormulaOptions &rOpt, bool bForLoading=false)
Definition: docsh6.cxx:419
static void ResetKeyBindings(ScOptionsUtil::KeyBindingType eType)
Definition: docsh.cxx:3155
const ScCalcConfig & GetCalcConfig() const
Definition: document.hxx:2619
bool CompileErrorCells(FormulaError nErrCode)
Re-compile formula cells with error.
Definition: document.cxx:4016
bool IsClipboard() const
Definition: document.hxx:1594
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
SC_DLLPUBLIC void SetDocOptions(const ScDocOptions &rOpt)
Definition: documen3.cxx:1942
void SetLanguage(LanguageType eLatin, LanguageType eCjk, LanguageType eCtl)
Definition: documen3.cxx:1970
SC_DLLPUBLIC void SetViewOptions(const ScViewOptions &rOpt)
Definition: documen3.cxx:1957
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1084
bool IdleCalcTextWidth()
Definition: documen8.cxx:532
SC_DLLPUBLIC void GetLanguage(LanguageType &rLatin, LanguageType &rCjk, LanguageType &rCtl) const
Definition: documen3.cxx:1963
sc::DocumentLinkManager & GetDocLinkManager()
Definition: documen2.cxx:241
SC_DLLPUBLIC void CalcAll()
Definition: document.cxx:3939
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1936
ScCalcConfig & GetCalcConfig()
Definition: formulaopt.hxx:42
bool GetWriteCalcConfig() const
Definition: formulaopt.hxx:50
bool GetUseEnglishFuncName() const
Definition: formulaopt.hxx:47
void SetCalcConfig(const ScCalcConfig &rConfig)
Definition: formulaopt.hxx:44
static void InitTextHeight(const SfxItemPool *pPool)
Definition: global.cxx:505
static void SetUserList(const ScUserList *pNewList)
Definition: global.cxx:299
static SC_DLLPUBLIC ScUserList * GetUserList()
Definition: global.cxx:288
static SC_DLLPUBLIC void Clear()
Definition: global.cxx:536
bool IsInputMode() const
Definition: inputhdl.hxx:186
void CancelHandler()
Definition: inputhdl.cxx:3453
void ForgetLastPattern()
Definition: inputhdl.cxx:2361
void SetReference(const ScRange &rRef, const ScDocument &rDoc)
Definition: inputhdl.cxx:3558
bool KeyInput(const KeyEvent &rKEvt, bool bStartEdit)
Definition: inputhdl.cxx:3738
void AddRefEntry()
Definition: inputhdl.cxx:3525
void ViewShellGone(const ScTabViewShell *pViewSh)
Definition: inputhdl.cxx:2259
void UpdateSpellSettings(bool bFromStartTab=false)
Definition: inputhdl.cxx:965
void InputTurnOffWinEngine()
Definition: inputhdl.cxx:4625
bool IsEditMode() const
Definition: inputhdl.hxx:187
ScInputWindow * GetInputWindow()
Definition: inputhdl.hxx:264
void UpdateRefDevice()
Definition: inputhdl.cxx:897
void SetMode(ScInputMode eNewMode, const OUString *pInitText=nullptr, ScEditEngineDefaulter *pTopEngine=nullptr)
Definition: inputhdl.cxx:2960
void InputGetSelection(sal_Int32 &rStart, sal_Int32 &rEnd)
Methods for FunctionAutoPilot: InputGetSelection, InputSetSelection, InputReplaceSelection,...
Definition: inputhdl.cxx:4542
bool IsFormulaMode() const
Definition: inputhdl.hxx:263
void InputChanged(const EditView *pView, bool bFromNotify)
Definition: inputhdl.cxx:4454
void InputSelection(const EditView *pView)
Definition: inputhdl.cxx:4437
bool IsModalMode(const SfxObjectShell *pDocSh)
Definition: inputhdl.cxx:3517
void EnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL, bool bBeforeSavingInLOK=false)
Definition: inputhdl.cxx:3069
void InputReplaceSelection(std::u16string_view aStr)
Definition: inputhdl.cxx:4594
void InputSetSelection(sal_Int32 nStart, sal_Int32 nEnd)
Definition: inputhdl.cxx:4574
void SetTextWysiwyg(bool bSet)
Definition: inputopt.hxx:62
sal_uInt16 GetMoveDir() const
Definition: inputopt.hxx:45
void SetExpandRefs(bool bSet)
Definition: inputopt.hxx:54
void SetEnterEdit(bool bSet)
Definition: inputopt.hxx:48
void SetExtendFormat(bool bSet)
Definition: inputopt.hxx:50
void SetMarkHeader(bool bSet)
Definition: inputopt.hxx:58
void SetMoveDir(sal_uInt16 nNew)
Definition: inputopt.hxx:44
bool GetTextWysiwyg() const
Definition: inputopt.hxx:63
bool GetSortRefUpdate() const
Definition: inputopt.hxx:57
void SetRangeFinder(bool bSet)
Definition: inputopt.hxx:52
bool GetMarkHeader() const
Definition: inputopt.hxx:59
void SetReplaceCellsWarn(bool bSet)
Definition: inputopt.hxx:64
void SetMoveSelection(bool bSet)
Definition: inputopt.hxx:46
bool GetEnterEdit() const
Definition: inputopt.hxx:49
bool GetReplaceCellsWarn() const
Definition: inputopt.hxx:65
void SetSortRefUpdate(bool bSet)
Definition: inputopt.hxx:56
bool GetLegacyCellSelection() const
Definition: inputopt.hxx:67
void SetEnterPasteMode(bool bSet)
Definition: inputopt.hxx:68
bool GetExtendFormat() const
Definition: inputopt.hxx:51
bool GetRangeFinder() const
Definition: inputopt.hxx:53
void SetLegacyCellSelection(bool bSet)
Definition: inputopt.hxx:66
bool GetExpandRefs() const
Definition: inputopt.hxx:55
bool GetEnterPasteMode() const
Definition: inputopt.hxx:69
bool GetMoveSelection() const
Definition: inputopt.hxx:47
void SetFuncString(const OUString &rString, bool bDoEdit=true)
Definition: inputwin.cxx:558
void PosGrabFocus()
Definition: inputwin.cxx:717
void TextInvalidate()
Definition: inputwin.cxx:693
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
SCTAB GetFirstSelected() const
Definition: markdata.cxx:185
SCTAB GetLastSelected() const
Definition: markdata.cxx:194
SCTAB GetSelectCount() const
Definition: markdata.cxx:180
void SetDragLink(const OUString &rDoc, const OUString &rTab, const OUString &rArea)
Definition: scmod.cxx:651
SC_DLLPUBLIC void SetDocOptions(const ScDocOptions &rOpt)
Definition: scmod.cxx:738
SC_DLLPUBLIC std::shared_ptr< SfxDialogController > Find1RefWindow(sal_uInt16 nSlotId, const weld::Window *pWndAncestor)
Definition: scmod.cxx:2232
SC_DLLPUBLIC void UnregisterRefController(sal_uInt16 nSlotId, const std::shared_ptr< SfxDialogController > &rWnd)
Definition: scmod.cxx:2208
void InputSetSelection(sal_Int32 nStart, sal_Int32 nEnd)
Definition: scmod.cxx:1461
ScAddInCfg & GetAddInCfg()
Definition: scmod.cxx:879
ScNavipiCfg & GetNavipiCfg()
Definition: scmod.cxx:871
svtools::ColorConfig & GetColorConfig()
Definition: scmod.cxx:887
sal_uInt16 m_nCurRefDlgId
Definition: scmod.hxx:101
void SetRefInputHdl(ScInputHandler *pNew)
Definition: scmod.cxx:1449
void ViewShellGone(const ScTabViewShell *pViewSh)
Definition: scmod.cxx:1442
SC_DLLPUBLIC SvtUserOptions & GetUserOptions()
Definition: scmod.cxx:898
std::unique_ptr< ScNavipiCfg > m_pNavipiCfg
Definition: scmod.hxx:94
virtual std::optional< SfxItemSet > CreateItemSet(sal_uInt16 nId) override
Virtual methods for the OptionsDialog.
Definition: scmod.cxx:1947
Timer m_aIdleTimer
Definition: scmod.hxx:81
SC_DLLPUBLIC void RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const &xCaller)
Definition: scmod.cxx:2322
css::uno::Reference< ooo::vba::XSinkCaller > mxAutomationApplicationEventsCaller
Definition: scmod.hxx:111
void SetReference(const ScRange &rRef, ScDocument &rDoc, const ScMarkData *pMarkData=nullptr)
Definition: scmod.cxx:1736
SC_DLLPUBLIC void RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr< SfxDialogController > &rWnd, weld::Window *pWndAncestor)
Definition: scmod.cxx:2194
ScInputHandler * GetInputHdl(ScTabViewShell *pViewSh=nullptr, bool bUseRef=true)
Input-Handler.
Definition: scmod.cxx:1355
SC_DLLPUBLIC void SetRefDialog(sal_uInt16 nId, bool bVis, SfxViewFrame *pViewFrm=nullptr)
Reference dialogs.
Definition: scmod.cxx:1519
void InputTurnOffWinEngine()
Definition: scmod.cxx:1475
bool InputKeyEvent(const KeyEvent &rKEvt, bool bStartEdit=false)
Definition: scmod.cxx:1405
SC_DLLPUBLIC const ScFormulaOptions & GetFormulaOptions()
Definition: scmod.cxx:831
std::map< sal_uInt16, std::vector< std::pair< std::shared_ptr< SfxDialogController >, weld::Window * > > > m_mapRefController
Definition: scmod.hxx:109
void DeleteCfg()
Definition: scmod.cxx:314
std::unique_ptr< svtools::ColorConfig > m_pColorConfig
Definition: scmod.hxx:96
std::unique_ptr< SvtCTLOptions > m_pCTLOptions
Definition: scmod.hxx:98
bool IsModalMode(SfxObjectShell *pDocSh=nullptr)
Definition: scmod.cxx:1597
SC_DLLPUBLIC const ScPrintOptions & GetPrintOptions()
Definition: scmod.cxx:863
std::unique_ptr< ScInputCfg > m_pInputCfg
Definition: scmod.hxx:92
void SetViewOptions(const ScViewOptions &rOpt)
Definition: scmod.cxx:722
std::unique_ptr< SvtUserOptions > m_pUserOptions
Definition: scmod.hxx:99
void SetPrintOptions(const ScPrintOptions &rOpt)
Definition: scmod.cxx:855
virtual void ConfigurationChanged(utl::ConfigurationBroadcaster *, ConfigurationHints) override
Definition: scmod.cxx:177
ScSelectionTransferObj * m_pSelTransfer
Definition: scmod.hxx:83
std::unique_ptr< ScFormulaCfg > m_pFormulaCfg
Definition: scmod.hxx:91
std::unique_ptr< ScViewCfg, o3tl::default_delete< ScViewCfg > > m_pViewCfg
Definition: scmod.hxx:87
virtual ~ScModule() override
Definition: scmod.cxx:161
void SetInputMode(ScInputMode eMode, const OUString *pInitText=nullptr)
Definition: scmod.cxx:1386
virtual std::optional< SfxStyleFamilies > CreateStyleFamilies() override
Definition: scmod.cxx:2300
void InputGetSelection(sal_Int32 &rStart, sal_Int32 &rEnd)
Definition: scmod.cxx:1454
rtl::Reference< ScMessagePool > m_pMessagePool
Definition: scmod.hxx:84
void ActivateInputWindow(const OUString *pStr=nullptr, bool bMatrix=false)
Definition: scmod.cxx:1482
ScModule(SfxObjectFactory *pFact)
Definition: scmod.cxx:118
bool IsInputMode()
Definition: scmod.cxx:1399
SC_DLLPUBLIC const ScDocOptions & GetDocOptions()
Definition: scmod.cxx:746
void InputReplaceSelection(std::u16string_view aStr)
Definition: scmod.cxx:1468
SC_DLLPUBLIC const ScInputOptions & GetInputOptions()
Definition: scmod.cxx:847
void ViewShellChanged(bool bStopEditing)
Definition: scmod.cxx:1378
std::unique_ptr< SvtAccessibilityOptions > m_pAccessOptions
Definition: scmod.hxx:97
void InputChanged(const EditView *pView)
Definition: scmod.cxx:1435
const ScDragData & GetDragData() const
Definition: scmod.cxx:623
SC_DLLPUBLIC const ScAppOptions & GetAppOptions()
Definition: scmod.cxx:799
ScInputHandler * m_pRefInputHandler
Definition: scmod.hxx:86
bool IsEditMode()
Definition: scmod.cxx:1393
SC_DLLPUBLIC void CallAutomationApplicationEventSinks(const OUString &Method, css::uno::Sequence< css::uno::Any > &Arguments)
Definition: scmod.cxx:2327
static bool HasThesaurusLanguage(LanguageType nLang)
Definition: scmod.cxx:2280
virtual std::unique_ptr< SfxTabPage > CreateTabPage(sal_uInt16 nId, weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet) override
Definition: scmod.cxx:2074
std::unique_ptr< SfxErrorHandler > m_pErrorHdl
Definition: scmod.hxx:100
void SetSelectionTransfer(ScSelectionTransferObj *pNew)
Definition: scmod.cxx:717
SC_DLLPUBLIC void SetAppOptions(const ScAppOptions &rOpt)
Definition: scmod.cxx:786
static void GetSpellSettings(LanguageType &rDefLang, LanguageType &rCjkLang, LanguageType &rCtlLang, bool &rAutoSpell)
Definition: scmod.cxx:2255
static void SetAutoSpellProperty(bool bSet)
Definition: scmod.cxx:2271
std::unique_ptr< ScDefaultsCfg > m_pDefaultsCfg
Definition: scmod.hxx:90
void EndReference()
Definition: scmod.cxx:1833
std::unique_ptr< ScDragData > m_pDragData
Definition: scmod.hxx:82
void AddRefEntry()
Multiple selection.
Definition: scmod.cxx:1804
void SetDragJump(ScDocument *pLocalDoc, const OUString &rTarget, const OUString &rText)
Definition: scmod.cxx:669
SC_DLLPUBLIC void SetFormulaOptions(const ScFormulaOptions &rOpt)
Definition: scmod.cxx:823
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL, bool bBeforeSavingInLOK=false)
Definition: scmod.cxx:1411
bool IsTableLocked()
Definition: scmod.cxx:1635
std::unique_ptr< ScAppCfg, o3tl::default_delete< ScAppCfg > > m_pAppCfg
Definition: scmod.hxx:89
bool m_bIsInEditCommand
Definition: scmod.hxx:103
void ResetDragObject()
Definition: scmod.cxx:602
void Execute(SfxRequest &rReq)
Definition: scmod.cxx:346
std::unique_ptr< ScPrintCfg > m_pPrintCfg
Definition: scmod.hxx:93
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: scmod.cxx:305
void ModifyOptions(const SfxItemSet &rOptSet)
Options.
Definition: scmod.cxx:920
bool IsFormulaMode()
Definition: scmod.cxx:1681
void InsertEntryToLRUList(sal_uInt16 nFIndex)
Definition: scmod.cxx:754
std::unique_ptr< ScDocCfg, o3tl::default_delete< ScDocCfg > > m_pDocCfg
Definition: scmod.hxx:88
void InputCancelHandler()
Definition: scmod.cxx:1421
static ScDocument * GetClipDoc()
Definition: scmod.cxx:688
SC_DLLPUBLIC const ScDefaultsOptions & GetDefaultsOptions()
Definition: scmod.cxx:815
void GetState(SfxItemSet &rSet)
Definition: scmod.cxx:540
void InputSelection(const EditView *pView)
Definition: scmod.cxx:1428
bool IsRefDialogOpen()
Definition: scmod.cxx:1665
void SetDragObject(ScTransferObj *pCellObj, ScDrawTransferObj *pDrawObj)
Definition: scmod.cxx:635
static void HideDisabledSlots(SfxItemSet &rSet)
Definition: scmod.cxx:587
const ScViewOptions & GetViewOptions()
Definition: scmod.cxx:730
virtual void ApplyItemSet(sal_uInt16 nId, const SfxItemSet &rSet) override
Definition: scmod.cxx:2066
SC_DLLPUBLIC void SetInputOptions(const ScInputOptions &rOpt)
Definition: scmod.cxx:839
SC_DLLPUBLIC void SetDefaultsOptions(const ScDefaultsOptions &rOpt)
Definition: scmod.cxx:807
void AnythingChanged()
Idle/OnlineSpelling.
Definition: scmod.cxx:1869
static LanguageType GetOptDigitLanguage()
Definition: scmod.cxx:907
std::unique_ptr< ScAddInCfg > m_pAddInCfg
Definition: scmod.hxx:95
void PutInOrder()
Definition: address.hxx:622
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
const ScDragData & GetDragData() const
Definition: tabvwsh.hxx:424
static css::uno::Reference< css::datatransfer::XTransferable2 > GetClipData(vcl::Window *pWin)
Definition: tabvwshc.cxx:519
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:690
void ResetDragObject()
Definition: tabvwsh4.cxx:1912
void SetDragObject(ScTransferObj *pCellObj, ScDrawTransferObj *pDrawObj)
Definition: tabvwsh4.cxx:1905
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1076
const ScInputHandler * GetInputHandler() const
Definition: tabvwsh.hxx:237
void SetDragJump(ScDocument *pLocalDoc, const OUString &rTarget, const OUString &rText)
Definition: tabvwsh4.cxx:1932
void SetDragLink(const OUString &rDoc, const OUString &rTab, const OUString &rArea)
Definition: tabvwsh4.cxx:1924
void PaintLeft()
Definition: tabview3.cxx:2734
void UpdateAutoFillMark(bool bFromPaste=false)
Definition: tabview3.cxx:187
void CheckNeedsRepaint()
Definition: tabview3.cxx:3113
bool PaintExtras()
Definition: tabview3.cxx:2787
void EnableAutoSpell(bool bEnable)
Definition: tabview.cxx:2337
void UpdateDrawTextOutliner()
Definition: tabview5.cxx:528
void UpdateAnchorHandles()
Definition: tabview5.cxx:489
ScViewData & GetViewData()
Definition: tabview.hxx:344
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, bool bAll)
Definition: tabview5.cxx:424
void PaintTop()
Definition: tabview3.cxx:2667
void UpdateFixPos()
Definition: tabview.cxx:750
void PaintGrid()
Definition: tabview3.cxx:2656
ScDocument * GetDocument() const
Definition: transobj.hxx:82
static SC_DLLPUBLIC ScTransferObj * GetOwnClipboard(const css::uno::Reference< css::datatransfer::XTransferable2 > &)
Definition: transobj.cxx:199
void SetUserList(const ScUserList &rUserList)
Definition: uiitems.cxx:316
Collection of user-defined sort lists.
Definition: userlist.hxx:62
void SetOptions(const ScViewOptions &rOpt)
Definition: viewdata.cxx:3982
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:554
const Fraction & GetZoomY() const
Definition: viewdata.hxx:460
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3162
const Fraction & GetZoomX() const
Definition: viewdata.hxx:459
std::unique_ptr< SvxGridItem > CreateGridItem() const
Definition: viewopti.cxx:149
void SetColorSchemeName(const OUString &rName)
Definition: viewopti.hxx:99
const ScGridOptions & GetGridOptions() const
Definition: viewopti.hxx:94
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:86
void SetDocColor(const Color &rDocColor)
Definition: viewopti.hxx:102
void SetGridOptions(const ScGridOptions &rNew)
Definition: viewopti.hxx:95
static void HideDisabledSlot(SfxItemSet &rSet, SfxBindings &rBindings, sal_uInt16 nSlotId)
Definition: viewutil.cxx:284
void SetDefaultTabulator(sal_uInt16 nVal)
static ErrCode CallAppBasic(const OUString &i_macroName)
void Update(sal_uInt16 nId)
void Invalidate(sal_uInt16 nId)
bool GetValue() const
bool IsVisible() const
std::shared_ptr< SfxDialogController > & GetController()
SfxHintId GetId() const
void FreezeIdRanges()
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void DisableItem(sal_uInt16 nWhich)
static void notifyViewRenderState(SfxViewShell const *pViewShell, vcl::ITiledRenderable *pDoc)
std::locale GetResLocale() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetNext(const SfxObjectShell &rPrev, const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
sal_uInt16 GetSlot() const
const SfxItemSet * GetArgs() const
const T * GetArg(sal_uInt16 nSlotId) const
void AppendItem(const SfxPoolItem &)
void Done(bool bRemove=false)
void PutItem(const SfxPoolItem &rItem)
SfxItemPool & GetPool() const
SfxViewShell * GetViewShell() const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
vcl::Window & GetWindow() const
SfxBindings & GetBindings()
void SetChildWindow(sal_uInt16 nId, bool bVisible, bool bSetFocus=true)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetNext(const SfxViewFrame &rPrev, const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
SfxChildWindow * GetChildWindow(sal_uInt16)
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
void InvalidateBorder()
SfxInPlaceClient * GetUIActiveClient() const
virtual void libreOfficeKitViewCallback(int nType, const OString &pPayload) const override
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
vcl::Window * GetWindow() const
sal_uInt16 FirstWhich()
sal_uInt16 NextWhich()
static TextNumerals GetCTLTextNumerals()
void GetOptions(SvtLinguOptions &rOptions) const
bool SetProperty(std::u16string_view rPropertyName, const css::uno::Any &rValue)
static void ensure()
const SvxFieldData * GetField() const
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rAttrSet)
void SetTimeout(sal_uInt64 nTimeoutMs)
sal_uInt64 GetTimeout() const
static const OUString & GetCurrentSchemeName()
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
::OutputDevice const * GetOutDev() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard()
#define DBG_UNHANDLED_EXCEPTION(...)
URL aURL
float u
FilterGroup & rTarget
FieldUnit
#define LRU_MAX
Definition: funcdesc.hxx:34
@ StartListening
If set, cloned formula cells will start to listen to the document.
ScInputMode
Definition: global.hxx:360
ScEnterMode
Definition: global.hxx:219
Mode eMode
void * p
sal_Int64 n
#define LANGUAGE_SYSTEM
#define LANGUAGE_NONE
#define LANGUAGE_ARABIC_SAUDI_ARABIA
#define LANGUAGE_ENGLISH_US
aStr
LanguageType GetLanguage(SfxItemSet const &aSet, sal_uInt16 nLangWhichId)
int i
static constexpr auto Items
CALCDETECTIVEERROR
CALCNOTESBACKGROUND
#define SFX_OBJECTBAR_APPLICATION
sal_Int16 nId
const char GetValue[]
ConfigurationHints
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
#define SCITEM_USERLIST
Definition: scitems.hxx:96
constexpr TypedWhichId< SvxLanguageItem > ATTR_CTL_FONT_LANGUAGE(120)
constexpr TypedWhichId< SvxLanguageItem > ATTR_CJK_FONT_LANGUAGE(115)
static SfxChildWindow * lcl_GetChildWinFromAnyView(sal_uInt16 nId)
Definition: scmod.cxx:1574
void global_InitAppOptions()
Definition: scmod.cxx:794
#define SC_IDLE_COUNT
Definition: scmod.cxx:103
#define SC_IDLE_STEP
Definition: scmod.cxx:102
static SfxChildWindow * lcl_GetChildWinFromCurrentView(sal_uInt16 nId)
Definition: scmod.cxx:1566
static sal_uInt16 nIdleCount
Definition: scmod.cxx:105
IMPL_LINK(ScModule, CalcFieldValueHdl, EditFieldInfo *, pInfo, void)
Definition: scmod.cxx:2153
static void lcl_CheckNeedsRepaint(const ScDocShell *pDocShell)
Definition: scmod.cxx:1878
IMPL_LINK_NOARG(ScModule, IdleHandler, Timer *, void)
Definition: scmod.cxx:1891
static void lcl_MarkedTabs(const ScMarkData &rMark, SCTAB &rStartTab, SCTAB &rEndTab)
Definition: scmod.cxx:1727
#define SC_IDLE_MAX
Definition: scmod.cxx:101
#define SC_IDLE_MIN
Definition: scmod.cxx:100
constexpr OUStringLiteral LINGUPROP_AUTOSPELL
Definition: scmod.cxx:2253
#define SC_MOD()
Definition: scmod.hxx:247
static SfxItemSet & rSet
#define SFX_IMPL_INTERFACE(Class, SuperClass)
Configuration options for formula interpreter.
Definition: calcconfig.hxx:44
void MergeDocumentSpecific(const ScCalcConfig &r)
Definition: calcconfig.cxx:153
LanguageType nDefaultLanguage
LanguageType nDefaultLanguage_CTL
LanguageType nDefaultLanguage_CJK
std::vector< SfxStyleFamilyItem > SfxStyleFamilies
Method
sal_Int16 SCTAB
Definition: types.hxx:22
@ VOPT_ANCHOR
Definition: viewopti.hxx:45