LibreOffice Module sc (master) 1
inputwin.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 <memory>
21#include <algorithm>
22#include <string_view>
23
24#include <editeng/eeitem.hxx>
25
26#include <sfx2/app.hxx>
28#include <editeng/editview.hxx>
29#include <editeng/editstat.hxx>
30#include <editeng/lspcitem.hxx>
31#include <editeng/fhgtitem.hxx>
32#include <editeng/wghtitem.hxx>
33#include <editeng/postitem.hxx>
34#include <editeng/langitem.hxx>
35#include <sfx2/bindings.hxx>
36#include <sfx2/viewfrm.hxx>
37#include <sfx2/dispatch.hxx>
38#include <sfx2/event.hxx>
40#include <vcl/commandevent.hxx>
41#include <vcl/cursor.hxx>
42#include <vcl/help.hxx>
43#include <vcl/settings.hxx>
44#include <svl/stritem.hxx>
45#include <vcl/svapp.hxx>
46#include <vcl/weldutils.hxx>
48
49#include <inputwin.hxx>
50#include <scmod.hxx>
51#include <global.hxx>
52#include <scresid.hxx>
53#include <strings.hrc>
54#include <globstr.hrc>
55#include <bitmaps.hlst>
56#include <reffact.hxx>
57#include <editutil.hxx>
58#include <inputhdl.hxx>
59#include <tabvwsh.hxx>
60#include <document.hxx>
61#include <docsh.hxx>
62#include <appoptio.hxx>
63#include <rangenam.hxx>
64#include <rangeutl.hxx>
65#include <docfunc.hxx>
66#include <funcdesc.hxx>
67#include <editeng/fontitem.hxx>
69#include <AccessibleText.hxx>
70#include <comphelper/lok.hxx>
71#include <comphelper/string.hxx>
72#include <com/sun/star/frame/XLayoutManager.hpp>
73#include <helpids.h>
74#include <output.hxx>
75
76namespace com::sun::star::accessibility { class XAccessible; }
77
78const tools::Long THESIZE = 1000000; // Should be more than enough!
79const tools::Long INPUTLINE_INSET_MARGIN = 2; // Space between border and interior widgets of input line
80const tools::Long LEFT_OFFSET = 5; // Left offset of input line
81//TODO const long BUTTON_OFFSET = 2; // Space between input line and button to expand/collapse
82const tools::Long INPUTWIN_MULTILINES = 6; // Initial number of lines within multiline dropdown
83const tools::Long TOOLBOX_WINDOW_HEIGHT = 22; // Height of toolbox window in pixels - TODO: The same on all systems?
84const tools::Long POSITION_COMBOBOX_WIDTH = 18; // Width of position combobox in characters
86
88using com::sun::star::uno::UNO_QUERY;
89
90using com::sun::star::frame::XLayoutManager;
92
93namespace {
94
95constexpr ToolBoxItemId SID_INPUT_FUNCTION (SC_VIEW_START + 47);
96constexpr ToolBoxItemId SID_INPUT_SUM (SC_VIEW_START + 48);
97constexpr ToolBoxItemId SID_INPUT_EQUAL (SC_VIEW_START + 49);
98constexpr ToolBoxItemId SID_INPUT_CANCEL (SC_VIEW_START + 50);
99constexpr ToolBoxItemId SID_INPUT_OK (SC_VIEW_START + 51);
100
101enum ScNameInputType
102{
103 SC_NAME_INPUT_CELL,
104 SC_NAME_INPUT_RANGE,
105 SC_NAME_INPUT_NAMEDRANGE_LOCAL,
106 SC_NAME_INPUT_NAMEDRANGE_GLOBAL,
107 SC_NAME_INPUT_DATABASE,
108 SC_NAME_INPUT_ROW,
109 SC_NAME_INPUT_SHEET,
110 SC_NAME_INPUT_DEFINE,
111 SC_NAME_INPUT_BAD_NAME,
112 SC_NAME_INPUT_BAD_SELECTION,
113 SC_MANAGE_NAMES
114};
115
116}
117
119
121 sal_uInt16 nId,
122 SfxBindings* pBindings,
123 SfxChildWinInfo* /* pInfo */ )
124 : SfxChildWindow( pParentP, nId )
125{
126 VclPtr<ScInputWindow> pWin = VclPtr<ScInputWindow>::Create( pParentP, pBindings );
127 SetWindow( pWin );
128
129 pWin->Show();
130
131 pWin->SetSizePixel( pWin->CalcWindowSizePixel() );
132
133 SetAlignment(SfxChildAlignment::LOWESTTOP);
134 pBindings->Invalidate( FID_TOGGLEINPUTLINE );
135}
136
141{
143 return aInfo;
144}
145
146
148{
149 ScTabViewShell* pViewSh = nullptr;
150 SfxDispatcher* pDisp = pBind->GetDispatcher();
151 if ( pDisp )
152 {
153 SfxViewFrame* pViewFrm = pDisp->GetFrame();
154 if ( pViewFrm )
155 pViewSh = dynamic_cast<ScTabViewShell*>( pViewFrm->GetViewShell() );
156 }
157
158 return VclPtr<ScInputBarGroup>::Create( pParent, pViewSh );
159}
160
162 // With WB_CLIPCHILDREN otherwise we get flickering
164 aWndPos ( !comphelper::LibreOfficeKit::isActive() ? VclPtr<ScPosWnd>::Create(this) : nullptr ),
165 mxTextWindow ( lcl_chooseRuntimeImpl( this, pBind ) ),
166 pInputHdl ( nullptr ),
167 mpViewShell ( nullptr ),
168 mnMaxY (0),
169 mnStandardItemHeight(0),
170 bIsOkCancelMode ( false ),
171 bInResize ( false )
172{
173 // #i73615# don't rely on SfxViewShell::Current while constructing the input line
174 // (also for GetInputHdl below)
175 ScTabViewShell* pViewSh = nullptr;
176 SfxDispatcher* pDisp = pBind->GetDispatcher();
177 if ( pDisp )
178 {
179 SfxViewFrame* pViewFrm = pDisp->GetFrame();
180 if ( pViewFrm )
181 pViewSh = dynamic_cast<ScTabViewShell*>( pViewFrm->GetViewShell() );
182 }
183 OSL_ENSURE( pViewSh, "no view shell for input window" );
184
185 mpViewShell = pViewSh;
186
187 // Position window, 3 buttons, input window
189 {
190 InsertWindow (ToolBoxItemId(1), aWndPos.get(), ToolBoxItemBits::NONE, 0);
191 InsertSeparator (1);
192 InsertItem (SID_INPUT_FUNCTION, Image(StockImage::Yes, RID_BMP_INPUT_FUNCTION), ToolBoxItemBits::NONE, 2);
193 }
194
195 const bool bIsLOKMobilePhone = mpViewShell && mpViewShell->isLOKMobilePhone();
196
197 // sigma and equal buttons
198 if (!bIsLOKMobilePhone)
199 {
200 InsertItem (SID_INPUT_SUM, Image(StockImage::Yes, RID_BMP_INPUT_SUM), ToolBoxItemBits::DROPDOWN, 3);
201 InsertItem (SID_INPUT_EQUAL, Image(StockImage::Yes, RID_BMP_INPUT_EQUAL), ToolBoxItemBits::NONE, 4);
202 InsertItem (SID_INPUT_CANCEL, Image(StockImage::Yes, RID_BMP_INPUT_CANCEL), ToolBoxItemBits::NONE, 5);
203 InsertItem (SID_INPUT_OK, Image(StockImage::Yes, RID_BMP_INPUT_OK), ToolBoxItemBits::NONE, 6);
204 }
205
206 InsertWindow (ToolBoxItemId(7), mxTextWindow.get(), ToolBoxItemBits::NONE, 7);
207 SetDropdownClickHdl( LINK( this, ScInputWindow, DropdownClickHdl ));
208
210 {
211 aWndPos ->SetQuickHelpText(ScResId(SCSTR_QHELP_POSWND));
212 aWndPos ->SetHelpId (HID_INSWIN_POS);
213
214 mxTextWindow->SetQuickHelpText(ScResId(SCSTR_QHELP_INPUTWND));
215 mxTextWindow->SetHelpId (HID_INSWIN_INPUT);
216
217 // No SetHelpText: the helptexts come from the Help
218 SetItemText (SID_INPUT_FUNCTION, ScResId(SCSTR_QHELP_BTNCALC));
219 SetHelpId (SID_INPUT_FUNCTION, HID_INSWIN_CALC);
220 }
221
222 // sigma and equal buttons
223 if (!bIsLOKMobilePhone)
224 {
225 SetHelpId (SID_INPUT_SUM, HID_INSWIN_SUMME);
226 SetHelpId (SID_INPUT_EQUAL, HID_INSWIN_FUNC);
227 SetHelpId (SID_INPUT_CANCEL, HID_INSWIN_CANCEL);
228 SetHelpId (SID_INPUT_OK, HID_INSWIN_OK);
229
231 {
232 SetItemText ( SID_INPUT_SUM, ScResId( SCSTR_QHELP_BTNSUM ) );
233 SetItemText ( SID_INPUT_EQUAL, ScResId( SCSTR_QHELP_BTNEQUAL ) );
234 SetItemText ( SID_INPUT_CANCEL, ScResId( SCSTR_QHELP_BTNCANCEL ) );
235 SetItemText ( SID_INPUT_OK, ScResId( SCSTR_QHELP_BTNOK ) );
236 }
237
238 EnableItem( SID_INPUT_CANCEL, false );
239 EnableItem( SID_INPUT_OK, false );
240
241 HideItem( SID_INPUT_CANCEL );
242 HideItem( SID_INPUT_OK );
243
244 mnStandardItemHeight = GetItemRect(SID_INPUT_SUM).GetHeight();
245 }
246
247 SetHelpId( HID_SC_INPUTWIN ); // For the whole input row
248
250 aWndPos ->Show();
251 mxTextWindow->Show();
252
253 pInputHdl = SC_MOD()->GetInputHdl( pViewSh, false ); // use own handler even if ref-handler is set
254 if (pInputHdl)
255 pInputHdl->SetInputWindow( this );
256
257 if (pInputHdl && !pInputHdl->GetFormString().isEmpty())
258 {
259 // Switch over while the Function AutoPilot is active
260 // -> show content of the Function AutoPilot again
261 // Also show selection (remember at the InputHdl)
262 mxTextWindow->SetTextString( pInputHdl->GetFormString() );
263 }
264 else if (pInputHdl && pInputHdl->IsInputMode())
265 {
266 // If the input row was hidden while editing (e.g. when editing a formula
267 // and then switching to another document or the help), display the text
268 // we just edited from the InputHandler
269 mxTextWindow->SetTextString( pInputHdl->GetEditString() ); // Display text
270 if ( pInputHdl->IsTopMode() )
271 pInputHdl->SetMode( SC_INPUT_TABLE ); // Focus ends up at the bottom anyways
272 }
273 else if (pViewSh)
274 {
275 // Don't stop editing in LOK a remote user might be editing.
276 const bool bStopEditing = !comphelper::LibreOfficeKit::isActive();
277 pViewSh->UpdateInputHandler(true, bStopEditing); // Absolutely necessary update
278 }
279
280 SetToolbarLayoutMode( ToolBoxLayoutMode::Locked );
281
282 SetAccessibleName(ScResId(STR_ACC_TOOLBAR_FORMULA));
283}
284
286{
287 disposeOnce();
288}
289
291{
292 bool bDown = !ScGlobal::oSysLocale; // after Clear?
293
294 // if any view's input handler has a pointer to this input window, reset it
295 // (may be several ones, #74522#)
296 // member pInputHdl is not used here
297
298 if ( !bDown )
299 {
300 SfxViewShell* pSh = SfxViewShell::GetFirst( true, checkSfxViewShell<ScTabViewShell> );
301 while ( pSh )
302 {
303 ScInputHandler* pHdl = static_cast<ScTabViewShell*>(pSh)->GetInputHandler();
304 if ( pHdl && pHdl->GetInputWindow() == this )
305 {
306 pHdl->SetInputWindow( nullptr );
307 pHdl->StopInputWinEngine( false ); // reset pTopView pointer
308 }
309 pSh = SfxViewShell::GetNext( *pSh, true, checkSfxViewShell<ScTabViewShell> );
310 }
311 }
312
314 {
315 if (GetLOKNotifier())
317 }
318
321
323}
324
326{
327 // Is called in the Activate of the View ...
328 if ( pNew != pInputHdl )
329 {
330 // On Reload (last version) the pInputHdl is the InputHandler of the old, deleted
331 // ViewShell: so don't touch it here!
332 pInputHdl = pNew;
333 if (pInputHdl)
334 pInputHdl->SetInputWindow( this );
335 }
336}
337
339{
340 ScModule* pScMod = SC_MOD();
342
343 ToolBoxItemId curItemId = GetCurItemId();
344 if (curItemId == SID_INPUT_FUNCTION)
345 {
348 if ( pViewFrm && ( comphelper::LibreOfficeKit::isActive() || !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) ) )
349 {
350 pViewFrm->GetDispatcher()->Execute( SID_OPENDLG_FUNCTION,
351 SfxCallMode::SYNCHRON | SfxCallMode::RECORD );
352
353 // The Toolbox will be disabled anyways, so we don't need to switch here,
354 // regardless whether it succeeded or not!
355// SetOkCancelMode();
356 }
357 }
358 else if (curItemId == SID_INPUT_CANCEL)
359 {
360 pScMod->InputCancelHandler();
362 }
363 else if (curItemId == SID_INPUT_OK)
364 {
365 pScMod->InputEnterHandler();
367 mxTextWindow->Invalidate(); // Or else the Selection remains
368 }
369 else if (curItemId == SID_INPUT_SUM)
370 {
371 ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
372 if (pViewSh)
373 {
374 bool bSubTotal = false;
375 bool bRangeFinder = false;
376 const OUString aFormula = pViewSh->DoAutoSum(bRangeFinder, bSubTotal, ocSum);
377 if (!aFormula.isEmpty())
378 {
379 SetFuncString(aFormula);
380 if (bRangeFinder && pScMod->IsEditMode())
381 {
382 ScInputHandler* pHdl = pScMod->GetInputHdl(pViewSh);
383 if (pHdl)
384 {
385 pHdl->InitRangeFinder(aFormula);
386
389 const sal_Int32 nOpen = aFormula.indexOf('(');
390 const sal_Int32 nLen = aFormula.getLength();
391 if (nOpen != -1 && nLen > nOpen)
392 {
393 ESelection aSel(0, nOpen + (bSubTotal ? 3 : 1), 0, nLen - 1);
394 EditView* pTableView = pHdl->GetTableView();
395 if (pTableView)
396 pTableView->SetSelection(aSel);
397 EditView* pTopView = pHdl->GetTopView();
398 if (pTopView)
399 pTopView->SetSelection(aSel);
400 }
401 }
402 }
403 }
404 }
405 }
406 else if (curItemId == SID_INPUT_EQUAL)
407 {
408 StartFormula();
409 }
410}
411
413{
414 ScModule* pScMod = SC_MOD();
415 mxTextWindow->StartEditEngine();
416 if ( pScMod->IsEditMode() ) // Isn't if e.g. protected
417 {
418 mxTextWindow->StartEditEngine();
419
420 sal_Int32 nStartPos = 1;
421 sal_Int32 nEndPos = 1;
422
423 ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
424 if ( pViewSh )
425 {
426 const OUString& rString = mxTextWindow->GetTextString();
427 const sal_Int32 nLen = rString.getLength();
428
429 ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
430 CellType eCellType = rDoc.GetCellType( pViewSh->GetViewData().GetCurPos() );
431 switch ( eCellType )
432 {
433 case CELLTYPE_VALUE:
434 {
435 nEndPos = nLen + 1;
436 mxTextWindow->SetTextString("=" + rString);
437 break;
438 }
439 case CELLTYPE_STRING:
440 case CELLTYPE_EDIT:
441 nStartPos = 0;
442 nEndPos = nLen;
443 break;
444 case CELLTYPE_FORMULA:
445 nEndPos = nLen;
446 break;
447 default:
448 mxTextWindow->SetTextString("=");
449 break;
450 }
451 }
452
453 EditView* pView = mxTextWindow->GetEditView();
454 if (pView)
455 {
456 sal_Int32 nStartPara = 0, nEndPara = 0;
458 {
460 if (pViewSh && !pViewSh->isLOKDesktop())
461 {
462 nStartPara = nEndPara = pView->GetEditEngine()->GetParagraphCount() ?
463 (pView->GetEditEngine()->GetParagraphCount() - 1) : 0;
464 nStartPos = nEndPos = pView->GetEditEngine()->GetTextLen(nStartPara);
465 }
466 }
467 pView->SetSelection(ESelection(nStartPara, nStartPos, nEndPara, nEndPos));
468 pScMod->InputChanged(pView);
470 pView->SetEditEngineUpdateLayout(true);
471 }
472 }
473}
474
476{
478 return;
479
480 if (pRectangle)
481 {
482 tools::Rectangle aRect(*pRectangle);
484 Window::PixelInvalidate(&aRect);
485 }
486 else
487 {
488 Window::PixelInvalidate(nullptr);
489 }
490}
491
492void ScInputWindow::SetSizePixel( const Size& rNewSize )
493{
494 const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier();
495 if (pNotifier)
496 {
497 if (vcl::Window* pFrameWindowImpl = GetParent())
498 {
499 if (vcl::Window* pWorkWindow = pFrameWindowImpl->GetParent())
500 {
501 if (vcl::Window* pImplBorderWindow = pWorkWindow->GetParent())
502 {
503 Size aSize = pImplBorderWindow->GetSizePixel();
504 aSize.setWidth(rNewSize.getWidth());
505 pImplBorderWindow->SetSizePixel(aSize);
506 }
507 }
508 }
509 }
510
511 ToolBox::SetSizePixel(rNewSize);
512}
513
515{
517
518 Size aStartSize = GetSizePixel();
519 Size aSize = aStartSize;
520
521 auto nLines = mxTextWindow->GetNumLines();
522 //(-10) to allow margin between sidebar and formulabar
524 Size aTextWindowSize(aSize.Width() - mxTextWindow->GetPosPixel().X() - LEFT_OFFSET - margin,
525 mxTextWindow->GetPixelHeightForLines(nLines));
526 mxTextWindow->SetSizePixel(aTextWindowSize);
527
528 int nTopOffset = 0;
529 if (nLines > 1)
530 {
531 // Initially there is 1 line and the edit is vertically centered in the toolbar
532 // Later, if expanded then the vertical position of the edit will remain at
533 // that initial position, so when calculating the overall size of the expanded
534 // toolbar we have to include that initial offset in order to not make
535 // the edit overlap the RESIZE_HOTSPOT_HEIGHT area so that dragging to resize
536 // is still possible.
537 int nNormalHeight = mxTextWindow->GetPixelHeightForLines(1);
538 int nInitialTopMargin = (mnStandardItemHeight - nNormalHeight) / 2;
539 if (nInitialTopMargin > 0)
540 nTopOffset = nInitialTopMargin;
541 }
542
543 // add empty space of RESIZE_HOTSPOT_HEIGHT so resize is possible when hovering there
545
546 if (aStartSize != aSize)
547 SetSizePixel(aSize);
548
549 Invalidate();
550}
551
553{
556}
557
558void ScInputWindow::SetFuncString( const OUString& rString, bool bDoEdit )
559{
562 EnableButtons( pViewFrm && !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) );
563 mxTextWindow->StartEditEngine();
564
565 ScModule* pScMod = SC_MOD();
566 if ( !pScMod->IsEditMode() )
567 return;
568
569 if ( bDoEdit )
570 mxTextWindow->TextGrabFocus();
571 mxTextWindow->SetTextString( rString );
572 EditView* pView = mxTextWindow->GetEditView();
573 if (!pView)
574 return;
575
576 sal_Int32 nLen = rString.getLength();
577
578 if ( nLen > 0 )
579 {
580 nLen--;
581 pView->SetSelection( ESelection( 0, nLen, 0, nLen ) );
582 }
583
584 pScMod->InputChanged(pView);
585 if ( bDoEdit )
586 SetOkCancelMode(); // Not the case if immediately followed by Enter/Cancel
587
588 pView->SetEditEngineUpdateLayout(true);
589}
590
591void ScInputWindow::SetPosString( const OUString& rStr )
592{
594 aWndPos->SetPos( rStr );
595}
596
597void ScInputWindow::SetTextString( const OUString& rString )
598{
599 if (rString.getLength() <= 32767)
600 mxTextWindow->SetTextString(rString);
601 else
602 mxTextWindow->SetTextString(rString.copy(0, 32767));
603}
604
606{
609 EnableButtons( pViewFrm && !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) );
610
611 if (bIsOkCancelMode)
612 return;
613
614 EnableItem ( SID_INPUT_SUM, false );
615 EnableItem ( SID_INPUT_EQUAL, false );
616 HideItem ( SID_INPUT_SUM );
617 HideItem ( SID_INPUT_EQUAL );
618
619 ShowItem ( SID_INPUT_CANCEL, true );
620 ShowItem ( SID_INPUT_OK, true );
621 EnableItem ( SID_INPUT_CANCEL, true );
622 EnableItem ( SID_INPUT_OK, true );
623
624 bIsOkCancelMode = true;
625}
626
628{
631 EnableButtons( pViewFrm && !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) );
632
633 if (!bIsOkCancelMode)
634 return;
635
636 EnableItem ( SID_INPUT_CANCEL, false );
637 EnableItem ( SID_INPUT_OK, false );
638 HideItem ( SID_INPUT_CANCEL );
639 HideItem ( SID_INPUT_OK );
640
641 ShowItem ( SID_INPUT_SUM, true );
642 ShowItem ( SID_INPUT_EQUAL, true );
643 EnableItem ( SID_INPUT_SUM, true );
644 EnableItem ( SID_INPUT_EQUAL, true );
645
646 bIsOkCancelMode = false;
647
648 SetFormulaMode(false); // No editing -> no formula
649}
650
652{
654 aWndPos->SetFormulaMode(bSet);
655 mxTextWindow->SetFormulaMode(bSet);
656}
657
659{
660 return mxTextWindow->IsInputActive();
661}
662
664{
665 return mxTextWindow->GetEditView();
666}
667
669{
670 return mxTextWindow;
671}
672
674{
675 return mxTextWindow->GetCursorScreenPixelPos(bBelow);
676}
677
679{
680 mxTextWindow->MakeDialogEditView();
681}
682
684{
685 mxTextWindow->StopEditEngine( bAll );
686}
687
689{
690 mxTextWindow->TextGrabFocus();
691}
692
694{
695 mxTextWindow->Invalidate();
696}
697
699{
700 // used for shift-ctrl-F2
701
702 mxTextWindow->StartEditEngine();
703 if ( SC_MOD()->IsEditMode() )
704 {
705 mxTextWindow->TextGrabFocus();
706 EditView* pView = mxTextWindow->GetEditView();
707 if (pView)
708 {
709 sal_Int32 nPara = pView->GetEditEngine()->GetParagraphCount() ? ( pView->GetEditEngine()->GetParagraphCount() - 1 ) : 0;
710 sal_Int32 nLen = pView->GetEditEngine()->GetTextLen( nPara );
711 ESelection aSel( nPara, nLen, nPara, nLen );
712 pView->SetSelection( aSel ); // set cursor to end of text
713 }
714 }
715}
716
718{
720 aWndPos->GrabFocus();
721}
722
724{
725 // when enabling buttons, always also enable the input window itself
726 if ( bEnable && !IsEnabled() )
727 Enable();
728
729 EnableItem( SID_INPUT_FUNCTION, bEnable );
730 EnableItem( bIsOkCancelMode ? SID_INPUT_CANCEL : SID_INPUT_SUM, bEnable );
731 EnableItem( bIsOkCancelMode ? SID_INPUT_OK : SID_INPUT_EQUAL, bEnable );
732// Invalidate();
733}
734
736{
737 mxTextWindow->NumLinesChanged();
738}
739
741{
743
744 if ( nType == StateChangedType::InitShow ) Resize();
745}
746
748{
749 if ( rDCEvt.GetType() == DataChangedEventType::SETTINGS && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
750 {
751 // update item images
752 SetItemImage(SID_INPUT_FUNCTION, Image(StockImage::Yes, RID_BMP_INPUT_FUNCTION));
753 if ( bIsOkCancelMode )
754 {
755 SetItemImage(SID_INPUT_CANCEL, Image(StockImage::Yes, RID_BMP_INPUT_CANCEL));
756 SetItemImage(SID_INPUT_OK, Image(StockImage::Yes, RID_BMP_INPUT_OK));
757 }
758 else
759 {
760 SetItemImage(SID_INPUT_SUM, Image(StockImage::Yes, RID_BMP_INPUT_SUM));
761 SetItemImage(SID_INPUT_EQUAL, Image(StockImage::Yes, RID_BMP_INPUT_EQUAL));
762 }
763 }
764
765 ToolBox::DataChanged( rDCEvt );
766}
767
769{
771}
772
774{
775 Point aPosPixel = GetPointerPosPixel();
776
777 ScInputBarGroup* pGroupBar = mxTextWindow.get();
778
780 SetPointer(PointerStyle::WindowSSize);
781 else
782 SetPointer(PointerStyle::Arrow);
783
784 if (bInResize)
785 {
786 // detect direction
787 tools::Long nResizeThreshold = tools::Long(TOOLBOX_WINDOW_HEIGHT * 0.7);
788 bool bResetPointerPos = false;
789
790 // Detect attempt to expand toolbar too much
791 if (aPosPixel.Y() >= mnMaxY)
792 {
793 bResetPointerPos = true;
794 aPosPixel.setY( mnMaxY );
795 } // or expanding down
796 else if (GetOutputSizePixel().Height() - aPosPixel.Y() < -nResizeThreshold)
797 {
798 pGroupBar->IncrementVerticalSize();
799 bResetPointerPos = true;
800 } // or shrinking up
801 else if ((GetOutputSizePixel().Height() - aPosPixel.Y()) > nResizeThreshold)
802 {
803 bResetPointerPos = true;
804 pGroupBar->DecrementVerticalSize();
805 }
806
807 if (bResetPointerPos)
808 {
809 aPosPixel.setY( GetOutputSizePixel().Height() );
810 SetPointerPosPixel(aPosPixel);
811 }
812 }
813
814 ToolBox::MouseMove(rMEvt);
815}
816
818{
819 if (rMEvt.IsLeft())
820 {
822 {
823 // Don't leave the mouse pointer leave *this* window
824 CaptureMouse();
825 bInResize = true;
826
827 // find the height of the gridwin, we don't want to be
828 // able to expand the toolbar too far so we need to
829 // calculate an upper limit
830 // I'd prefer to leave at least a single column header and a
831 // row but I don't know how to get that value in pixels.
832 // Use TOOLBOX_WINDOW_HEIGHT for the moment
836 }
837 }
838
840}
842{
843 ReleaseMouse();
844 if ( rMEvt.IsLeft() )
845 {
846 bInResize = false;
847 mnMaxY = 0;
848 }
849
850 ToolBox::MouseButtonUp( rMEvt );
851}
852
853void ScInputWindow::AutoSum( bool& bRangeFinder, bool& bSubTotal, OpCode eCode )
854{
855 ScModule* pScMod = SC_MOD();
856 ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
857 if ( !pViewSh )
858 return;
859
860 const OUString aFormula = pViewSh->DoAutoSum(bRangeFinder, bSubTotal, eCode);
861 if ( aFormula.isEmpty() )
862 return;
863
864 SetFuncString( aFormula );
865 const sal_Int32 aOpen = aFormula.indexOf('(');
866 const sal_Int32 aLen = aFormula.getLength();
867 if (!(bRangeFinder && pScMod->IsEditMode()))
868 return;
869
870 ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh );
871 if ( !pHdl )
872 return;
873
874 pHdl->InitRangeFinder( aFormula );
875
878 if ( aOpen != -1 && aLen > aOpen )
879 {
880 ESelection aSel( 0, aOpen + (bSubTotal ? 3 : 1), 0, aLen-1 );
881 EditView* pTableView = pHdl->GetTableView();
882 if ( pTableView )
883 pTableView->SetSelection( aSel );
884 EditView* pTopView = pHdl->GetTopView();
885 if ( pTopView )
886 pTopView->SetSelection( aSel );
887 }
888}
889
891 : InterimItemWindow(pParent, "modules/scalc/ui/inputbar.ui", "InputBar", true, reinterpret_cast<sal_uInt64>(pViewSh))
892 , mxBackground(m_xBuilder->weld_container("background"))
893 , mxTextWndGroup(new ScTextWndGroup(*this, pViewSh))
894 , mxButtonUp(m_xBuilder->weld_button("up"))
895 , mxButtonDown(m_xBuilder->weld_button("down"))
896{
898
899 SetPaintTransparent(false);
901
902 mxButtonUp->connect_clicked(LINK(this, ScInputBarGroup, ClickHdl));
903 mxButtonDown->connect_clicked(LINK(this, ScInputBarGroup, ClickHdl));
904
906 {
907 mxButtonUp->set_tooltip_text(ScResId( SCSTR_QHELP_COLLAPSE_FORMULA));
908 mxButtonDown->set_tooltip_text(ScResId(SCSTR_QHELP_EXPAND_FORMULA));
909 }
910
911 int nHeight = mxTextWndGroup->GetPixelHeightForLines(1);
912 mxButtonUp->set_size_request(-1, nHeight);
913 mxButtonDown->set_size_request(-1, nHeight);
914
915 // disable the multiline toggle on the mobile phones
916 const SfxViewShell* pViewShell = SfxViewShell::Current();
917 if (!comphelper::LibreOfficeKit::isActive() || !(pViewShell && pViewShell->isLOKMobilePhone()))
918 mxButtonDown->show();
919
920 // tdf#154042 Use an initial height of one row so the Toolbar positions
921 // this in the same place regardless of how many rows it eventually shows
922 Size aSize(GetSizePixel().Width(), nHeight);
923 SetSizePixel(aSize);
924}
925
927{
928 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
929 SetBackground(rStyleSettings.GetFaceColor());
930 // match to bg used in ScTextWnd::SetDrawingArea to the margin area is drawn with the
931 // same desired bg
932 mxBackground->set_background(rStyleSettings.GetWindowColor());
933}
934
936{
938 if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
939 {
941 Invalidate();
942 }
943}
944
946{
947 return mxTextWndGroup->GetCursorScreenPixelPos(bBelow);
948}
949
951{
952 disposeOnce();
953}
954
956{
957 mxTextWndGroup.reset();
958 mxButtonUp.reset();
959 mxButtonDown.reset();
960 mxBackground.reset();
962}
963
965{
966 mxTextWndGroup->InsertAccessibleTextData(rTextData);
967}
968
970{
971 mxTextWndGroup->RemoveAccessibleTextData(rTextData);
972}
973
974const OUString& ScInputBarGroup::GetTextString() const
975{
976 return mxTextWndGroup->GetTextString();
977}
978
979void ScInputBarGroup::SetTextString( const OUString& rString )
980{
981 mxTextWndGroup->SetTextString(rString);
982}
983
985{
986 mxTextWndGroup->SetScrollPolicy();
988}
989
991{
992 mxTextWndGroup->StopEditEngine(bAll);
993}
994
996{
997 mxTextWndGroup->StartEditEngine();
998}
999
1001{
1002 mxTextWndGroup->MakeDialogEditView();
1003}
1004
1006{
1007 return mxTextWndGroup->GetEditView();
1008}
1009
1011{
1012 return mxTextWndGroup->HasEditView();
1013}
1014
1016{
1017 return mxTextWndGroup->IsInputActive();
1018}
1019
1021{
1022 mxTextWndGroup->SetFormulaMode(bSet);
1023}
1024
1026{
1027 mxTextWndGroup->SetNumLines(mxTextWndGroup->GetNumLines() + 1);
1029}
1030
1032{
1033 if (mxTextWndGroup->GetNumLines() > 1)
1034 {
1035 mxTextWndGroup->SetNumLines(mxTextWndGroup->GetNumLines() - 1);
1037 }
1038}
1039
1040void ScInputWindow::MenuHdl(std::u16string_view command)
1041{
1042 if (command.empty())
1043 return;
1044
1045 bool bSubTotal = false;
1046 bool bRangeFinder = false;
1047 OpCode eCode = ocSum;
1048 if ( command == u"sum" )
1049 {
1050 eCode = ocSum;
1051 }
1052 else if ( command == u"average" )
1053 {
1054 eCode = ocAverage;
1055 }
1056 else if ( command == u"max" )
1057 {
1058 eCode = ocMax;
1059 }
1060 else if ( command == u"min" )
1061 {
1062 eCode = ocMin;
1063 }
1064 else if ( command == u"count" )
1065 {
1066 eCode = ocCount;
1067 }
1068 else if ( command == u"counta" )
1069 {
1070 eCode = ocCount2;
1071 }
1072 else if ( command == u"product" )
1073 {
1074 eCode = ocProduct;
1075 }
1076 else if (command == u"stdev")
1077 {
1078 eCode = ocStDev;
1079 }
1080 else if (command == u"stdevp")
1081 {
1082 eCode = ocStDevP;
1083 }
1084 else if (command == u"var")
1085 {
1086 eCode = ocVar;
1087 }
1088 else if (command == u"varp")
1089 {
1090 eCode = ocVarP;
1091 }
1092
1093 AutoSum( bRangeFinder, bSubTotal, eCode );
1094}
1095
1096IMPL_LINK_NOARG(ScInputWindow, DropdownClickHdl, ToolBox *, void)
1097{
1098 ToolBoxItemId nCurID = GetCurItemId();
1099 EndSelection();
1100
1101 if (nCurID == SID_INPUT_SUM)
1102 {
1103 tools::Rectangle aRect(GetItemRect(SID_INPUT_SUM));
1104 weld::Window* pPopupParent = weld::GetPopupParent(*this, aRect);
1105 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pPopupParent, "modules/scalc/ui/autosum.ui"));
1106 std::unique_ptr<weld::Menu> xPopMenu(xBuilder->weld_menu("menu"));
1107 MenuHdl(xPopMenu->popup_at_rect(pPopupParent, aRect));
1108 }
1109}
1110
1112{
1113 if (mxTextWndGroup->GetNumLines() > 1)
1114 mxTextWndGroup->SetNumLines(1);
1115 else
1116 mxTextWndGroup->SetNumLines(mxTextWndGroup->GetLastNumExpandedLines());
1117
1118 NumLinesChanged();
1119}
1120
1122{
1123 if (mxTextWndGroup->GetNumLines() > 1)
1124 {
1125 mxButtonDown->hide();
1126 mxButtonUp->show();
1127 mxTextWndGroup->SetLastNumExpandedLines(mxTextWndGroup->GetNumLines());
1128 }
1129 else
1130 {
1131 mxButtonUp->hide();
1132 mxButtonDown->show();
1133 }
1135
1136 // Restore focus to input line(s) if necessary
1137 ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
1138 if ( pHdl && pHdl->IsTopMode() )
1139 mxTextWndGroup->TextGrabFocus();
1140}
1141
1143{
1145 ScInputWindow &rParent = dynamic_cast<ScInputWindow&>(*w);
1146 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1147
1148 if ( !pViewFrm )
1149 return;
1150
1151 Reference< css::beans::XPropertySet > xPropSet( pViewFrm->GetFrame().GetFrameInterface(), UNO_QUERY );
1153
1154 if ( xPropSet.is() )
1155 {
1156 css::uno::Any aValue = xPropSet->getPropertyValue("LayoutManager");
1157 aValue >>= xLayoutManager;
1158 }
1159
1160 if ( !xLayoutManager.is() )
1161 return;
1162
1163 xLayoutManager->lock();
1164 DataChangedEvent aFakeUpdate( DataChangedEventType::SETTINGS, nullptr, AllSettingsFlags::STYLE );
1165
1166 // this basically will trigger the repositioning of the
1167 // items in the toolbar from ImplFormat ( which is controlled by
1168 // mnWinHeight ) which in turn is updated in ImplCalcItem which is
1169 // controlled by mbCalc. Additionally the ImplFormat above is
1170 // controlled via mbFormat. It seems the easiest way to get these
1171 // booleans set is to send in the fake event below.
1172 rParent.DataChanged( aFakeUpdate);
1173
1174 // highest item in toolbar will have been calculated via the
1175 // event above. Call resize on InputBar to pick up the height
1176 // change
1177 rParent.Resize();
1178
1179 // unlock relayouts the toolbars in the 4 quadrants
1180 xLayoutManager->unlock();
1181}
1182
1184{
1185 mxTextWndGroup->TextGrabFocus();
1186}
1187
1190
1192 : mxTextWnd(new ScTextWnd(*this, pViewSh))
1193 , mxScrollWin(rParent.GetBuilder().weld_scrolled_window("scrolledwindow", true))
1194 , mxTextWndWin(new weld::CustomWeld(rParent.GetBuilder(), "sc_input_window", *mxTextWnd))
1195 , mrParent(rParent)
1196{
1197 mxScrollWin->connect_vadjustment_changed(LINK(this, ScTextWndGroup, Impl_ScrollHdl));
1200}
1201
1203{
1204 Point aPos;
1205 if (!HasEditView())
1206 return aPos;
1207 EditView* pEditView = GetEditView();
1208 vcl::Cursor* pCur = pEditView->GetCursor();
1209 if (!pCur)
1210 return aPos;
1211 Point aLogicPos = pCur->GetPos();
1212 if (bBelow)
1213 aLogicPos.AdjustY(pCur->GetHeight());
1214 aPos = GetEditViewDevice().LogicToPixel(aLogicPos);
1215 bool bRTL = mrParent.IsRTLEnabled();
1216 if (bRTL)
1217 aPos.setX(mxTextWnd->GetOutputSizePixel().Width() - aPos.X() + gnBorderWidth);
1218 else
1219 aPos.AdjustX(gnBorderWidth + 1);
1220
1221 return mrParent.OutputToScreenPixel(aPos);
1222}
1223
1225{
1226}
1227
1229{
1230 mxTextWnd->InsertAccessibleTextData(rTextData);
1231}
1232
1234{
1235 return mxTextWnd->GetEditView();
1236}
1237
1239{
1240 return mxTextWnd->GetEditViewDevice();
1241}
1242
1244{
1245 return mxTextWnd->GetLastNumExpandedLines();
1246}
1247
1249{
1250 mxTextWnd->SetLastNumExpandedLines(nLastExpandedLines);
1251}
1252
1254{
1255 return mxTextWnd->GetNumLines();
1256}
1257
1259{
1260 return mxTextWnd->GetPixelHeightForLines(nLines) + 2 * gnBorderHeight;
1261}
1262
1264{
1265 return *mxScrollWin;
1266}
1267
1268const OUString& ScTextWndGroup::GetTextString() const
1269{
1270 return mxTextWnd->GetTextString();
1271}
1272
1274{
1275 return mxTextWnd->HasEditView();
1276}
1277
1279{
1280 return mxTextWnd->IsInputActive();
1281}
1282
1284{
1285 mxTextWnd->MakeDialogEditView();
1286}
1287
1289{
1290 mxTextWnd->RemoveAccessibleTextData(rTextData);
1291}
1292
1294{
1295 if (mxTextWnd->GetNumLines() > 2)
1296 mxScrollWin->set_vpolicy(VclPolicyType::ALWAYS);
1297 else
1298 mxScrollWin->set_vpolicy(VclPolicyType::NEVER);
1299}
1300
1302{
1303 mxTextWnd->SetNumLines(nLines);
1304}
1305
1307{
1308 mxTextWnd->SetFormulaMode(bSet);
1309}
1310
1311void ScTextWndGroup::SetTextString(const OUString& rString)
1312{
1313 mxTextWnd->SetTextString(rString);
1314}
1315
1317{
1318 mxTextWnd->StartEditEngine();
1319}
1320
1322{
1323 mxTextWnd->StopEditEngine( bAll );
1324}
1325
1327{
1328 mxTextWnd->TextGrabFocus();
1329}
1330
1332{
1333 mxTextWnd->DoScroll();
1334}
1335
1336void ScTextWnd::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect )
1337{
1338 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1339 Color aBgColor = rStyleSettings.GetWindowColor();
1340 rRenderContext.SetBackground(aBgColor);
1341
1342 // tdf#137713 we rely on GetEditView creating it if it doesn't already exist so
1343 // GetEditView() must be called unconditionally
1344 if (EditView* pView = GetEditView())
1345 {
1346 if (mbInvalidate)
1347 {
1348 pView->Invalidate();
1349 mbInvalidate = false;
1350 }
1351 }
1352
1354 {
1355 // EditEngine/EditView works in twips logical coordinates, so set the device map-mode to twips before painting
1356 // and use twips version of the painting area 'rRect'.
1357 // Document zoom should not be included in this conversion.
1358 tools::Rectangle aLogicRect = OutputDevice::LogicToLogic(rRect, MapMode(MapUnit::MapPixel), MapMode(MapUnit::MapTwip));
1359 MapMode aOriginalMode = rRenderContext.GetMapMode();
1360 rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip));
1361 WeldEditView::Paint(rRenderContext, aLogicRect);
1362 rRenderContext.SetMapMode(aOriginalMode);
1363 }
1364 else
1365 WeldEditView::Paint(rRenderContext, rRect);
1366}
1367
1369{
1370 if ( !m_xEditView )
1371 const_cast<ScTextWnd&>(*this).InitEditEngine();
1372 return m_xEditView.get();
1373}
1374
1375bool ScTextWnd::HasEditView() const { return m_xEditView != nullptr; }
1376
1378{
1379 return EditViewOutputDevice();
1380}
1381
1383{
1384 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
1385 return rDevice.LogicToPixel(Size(0, nLines * rDevice.GetTextHeight())).Height() + 1;
1386}
1387
1389{
1390 ScViewData& rViewData = mpViewShell->GetViewData();
1391 return rViewData.GetFormulaBarLines();
1392}
1393
1395{
1396 ScViewData& rViewData = mpViewShell->GetViewData();
1397 rViewData.SetFormulaBarLines(nLines);
1398 if ( nLines > 1 )
1399 {
1400 // SetFormulaBarLines sanitizes the height, so get the sanitized value
1402 Resize();
1403 }
1404}
1405
1407{
1408 if (m_xEditView)
1409 {
1410 Size aOutputSize = GetOutputSizePixel();
1411 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
1412 tools::Rectangle aOutputArea = rDevice.PixelToLogic( tools::Rectangle( Point(), aOutputSize ));
1413 m_xEditView->SetOutputArea( aOutputArea );
1414
1415 // Don't leave an empty area at the bottom if we can move the text down.
1416 tools::Long nMaxVisAreaTop = m_xEditEngine->GetTextHeight() - aOutputArea.GetHeight();
1417 if (m_xEditView->GetVisArea().Top() > nMaxVisAreaTop)
1418 {
1419 m_xEditView->Scroll(0, m_xEditView->GetVisArea().Top() - nMaxVisAreaTop);
1420 }
1421
1422 m_xEditEngine->SetPaperSize( rDevice.PixelToLogic( Size( aOutputSize.Width(), 10000 ) ) );
1423 }
1424
1425 // skip WeldEditView's Resize();
1427
1429}
1430
1432{
1433 return m_xEditView ? m_xEditView->GetEditEngine()->GetTextHeight() : 0;
1434}
1435
1437{
1438 if (!m_xEditView)
1439 return;
1440
1441 OutputDevice& rDevice = GetDrawingArea()->get_ref_device();
1442 Size aOutputSize = rDevice.GetOutputSize();
1443
1444 int nUpper = GetEditEngTxtHeight();
1445 int nCurrentDocPos = m_xEditView->GetVisArea().Top();
1446 int nStepIncrement = GetTextHeight();
1447 int nPageIncrement = aOutputSize.Height();
1448 int nPageSize = aOutputSize.Height();
1449
1450 /* limit the page size to below nUpper because gtk's gtk_scrolled_window_start_deceleration has
1451 effectively...
1452
1453 lower = gtk_adjustment_get_lower
1454 upper = gtk_adjustment_get_upper - gtk_adjustment_get_page_size
1455
1456 and requires that upper > lower or the deceleration animation never ends
1457 */
1458 nPageSize = std::min(nPageSize, nUpper);
1459
1461 rVBar.vadjustment_configure(nCurrentDocPos, 0, nUpper,
1462 nStepIncrement, nPageIncrement, nPageSize);
1463}
1464
1466{
1467 if (m_xEditView)
1468 {
1470 auto currentDocPos = m_xEditView->GetVisArea().Top();
1471 auto nDiff = currentDocPos - rVBar.vadjustment_get_value();
1472 // we expect SetScrollBarRange callback to be triggered by Scroll
1473 // to set where we ended up
1474 m_xEditView->Scroll(0, nDiff);
1475 }
1476}
1477
1479{
1480 // Don't activate if we're a modal dialog ourselves (Doc-modal dialog)
1482 if ( pObjSh && pObjSh->IsInModalMode() )
1483 return;
1484
1485 if ( !m_xEditView || !m_xEditEngine )
1486 {
1488 }
1489
1491 if (pHdl)
1492 pHdl->SetMode(SC_INPUT_TOP, nullptr, static_cast<ScEditEngineDefaulter*>(m_xEditEngine.get()));
1493
1494 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1495 if (pViewFrm)
1496 pViewFrm->GetBindings().Invalidate( SID_ATTR_INSERT );
1497}
1498
1500{
1501 const SfxPoolItem& rFontItem = rSet.Get( EE_CHAR_FONTINFO );
1502 std::unique_ptr<SfxPoolItem> pNewItem(rFontItem.Clone());
1503 pNewItem->SetWhich(EE_CHAR_FONTINFO_CJK);
1504 rSet.Put( *pNewItem );
1505 pNewItem->SetWhich(EE_CHAR_FONTINFO_CTL);
1506 rSet.Put( *pNewItem );
1507 const SfxPoolItem& rHeightItem = rSet.Get( EE_CHAR_FONTHEIGHT );
1508 pNewItem.reset(rHeightItem.Clone());
1510 rSet.Put( *pNewItem );
1512 rSet.Put( *pNewItem );
1513 const SfxPoolItem& rWeightItem = rSet.Get( EE_CHAR_WEIGHT );
1514 pNewItem.reset(rWeightItem.Clone());
1515 pNewItem->SetWhich(EE_CHAR_WEIGHT_CJK);
1516 rSet.Put( *pNewItem );
1517 pNewItem->SetWhich(EE_CHAR_WEIGHT_CTL);
1518 rSet.Put( *pNewItem );
1519 const SfxPoolItem& rItalicItem = rSet.Get( EE_CHAR_ITALIC );
1520 pNewItem.reset(rItalicItem.Clone());
1521 pNewItem->SetWhich(EE_CHAR_ITALIC_CJK);
1522 rSet.Put( *pNewItem );
1523 pNewItem->SetWhich(EE_CHAR_ITALIC_CTL);
1524 rSet.Put( *pNewItem );
1525 const SfxPoolItem& rLangItem = rSet.Get( EE_CHAR_LANGUAGE );
1526 pNewItem.reset(rLangItem.Clone());
1527 pNewItem->SetWhich(EE_CHAR_LANGUAGE_CJK);
1528 rSet.Put( *pNewItem );
1529 pNewItem->SetWhich(EE_CHAR_LANGUAGE_CTL);
1530 rSet.Put( *pNewItem );
1531}
1532
1534{
1535 rSet.Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) );
1536
1537 // always using rtl writing direction would break formulas
1538 //rSet.Put( SvxFrameDirectionItem( SvxFrameDirection::Horizontal_RL_TB, EE_PARA_WRITINGDIR ) );
1539
1540 // PaperSize width is limited to USHRT_MAX in RTL mode (because of EditEngine's
1541 // sal_uInt16 values in EditLine), so the text may be wrapped and line spacing must be
1542 // increased to not see the beginning of the next line.
1544 aItem.SetPropLineSpace( 200 );
1545 rSet.Put( aItem );
1546}
1547
1548static void lcl_ModifyRTLVisArea( EditView* pEditView )
1549{
1550 tools::Rectangle aVisArea = pEditView->GetVisArea();
1551 Size aPaper = pEditView->GetEditEngine()->GetPaperSize();
1552 tools::Long nDiff = aPaper.Width() - aVisArea.Right();
1553 aVisArea.AdjustLeft(nDiff );
1554 aVisArea.AdjustRight(nDiff );
1555 pEditView->SetVisArea(aVisArea);
1556}
1557
1559{
1560 std::unique_ptr<ScFieldEditEngine> pNew;
1561 ScDocShell* pDocSh = nullptr;
1562 if ( mpViewShell )
1563 {
1564 pDocSh = mpViewShell->GetViewData().GetDocShell();
1566 pNew = std::make_unique<ScFieldEditEngine>(&rDoc, rDoc.GetEnginePool(), rDoc.GetEditPool());
1567 }
1568 else
1569 pNew = std::make_unique<ScFieldEditEngine>(nullptr, EditEngine::CreatePool().get(), nullptr, true);
1570 pNew->SetExecuteURL( false );
1571 m_xEditEngine = std::move(pNew);
1572
1573 Size barSize = GetOutputSizePixel();
1574 m_xEditEngine->SetUpdateLayout( false );
1575 m_xEditEngine->SetPaperSize( GetDrawingArea()->get_ref_device().PixelToLogic(Size(barSize.Width(),10000)) );
1576 m_xEditEngine->SetWordDelimiters(
1577 ScEditUtil::ModifyDelimiters( m_xEditEngine->GetWordDelimiters() ) );
1578 m_xEditEngine->SetReplaceLeadingSingleQuotationMark( false );
1579
1581
1582 {
1583 auto pSet = std::make_unique<SfxItemSet>( m_xEditEngine->GetEmptyItemSet() );
1586 // turn off script spacing to match DrawText output
1587 pSet->Put( SvxScriptSpaceItem( false, EE_PARA_ASIANCJKSPACING ) );
1588 if ( bIsRTL )
1589 lcl_ModifyRTLDefaults( *pSet );
1590 static_cast<ScEditEngineDefaulter*>(m_xEditEngine.get())->SetDefaults( std::move(pSet) );
1591 }
1592
1593 // If the Cell contains URLFields, they need to be taken over into the entry row,
1594 // or else the position is not correct anymore
1595 bool bFilled = false;
1596 ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
1597 if ( pHdl )
1598 bFilled = pHdl->GetTextAndFields(static_cast<ScEditEngineDefaulter&>(*m_xEditEngine));
1599
1600 m_xEditEngine->SetUpdateLayout( true );
1601
1602 // aString is the truth ...
1603 if (bFilled && m_xEditEngine->GetText() == aString)
1604 Invalidate(); // Repaint for (filled) Field
1605 else
1606 static_cast<ScEditEngineDefaulter*>(m_xEditEngine.get())->SetTextCurrentDefaults(aString); // At least the right text then
1607
1608 m_xEditView = std::make_unique<EditView>(m_xEditEngine.get(), nullptr);
1609
1610 // we get cursor, selection etc. messages from the VCL/window layer
1611 // otherwise these are injected into the document causing confusion.
1612 m_xEditView->SuppressLOKMessages(true);
1613
1614 m_xEditView->setEditViewCallbacks(this);
1615 m_xEditView->SetInsertMode(bIsInsertMode);
1616
1617 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1618 Color aBgColor = rStyleSettings.GetWindowColor();
1619 m_xEditView->SetBackgroundColor(aBgColor);
1620
1621 if (pAcc)
1622 {
1623 pAcc->InitAcc(nullptr, m_xEditView.get(),
1624 ScResId(STR_ACC_EDITLINE_NAME),
1625 ScResId(STR_ACC_EDITLINE_DESCR));
1626 }
1627
1629 m_xEditView->RegisterViewShell(mpViewShell);
1630
1631 // Text from Clipboard is taken over as ASCII in a single row
1632 EVControlBits n = m_xEditView->GetControlWord();
1633 m_xEditView->SetControlWord( n | EVControlBits::SINGLELINEPASTE );
1634
1635 m_xEditEngine->InsertView( m_xEditView.get(), EE_APPEND );
1636
1637 Resize();
1638
1639 if ( bIsRTL )
1641
1642 m_xEditEngine->SetModifyHdl(LINK(this, ScTextWnd, ModifyHdl));
1643 m_xEditEngine->SetStatusEventHdl(LINK(this, ScTextWnd, EditStatusHdl));
1644
1645 if (!maAccTextDatas.empty())
1646 maAccTextDatas.back()->StartEdit();
1647
1648 // as long as EditEngine and DrawText sometimes differ for CTL text,
1649 // repaint now to have the EditEngine's version visible
1650 if (pDocSh)
1651 {
1652 ScDocument& rDoc = pDocSh->GetDocument(); // any document
1653 SvtScriptType nScript = rDoc.GetStringScriptType( aString );
1654 if ( nScript & SvtScriptType::COMPLEX )
1655 Invalidate();
1656 }
1657}
1658
1660 bIsRTL(AllSettings::GetLayoutRTL()),
1661 bIsInsertMode(true),
1662 bFormulaMode (false),
1663 bInputMode (false),
1664 mpViewShell(pViewSh),
1665 mrGroupBar(rParent),
1666 mnLastExpandedLines(INPUTWIN_MULTILINES),
1667 mbInvalidate(false)
1668{
1669}
1670
1672{
1673 while (!maAccTextDatas.empty()) {
1674 maAccTextDatas.back()->Dispose();
1675 }
1676}
1677
1679{
1680 return m_xEditView && m_xEditView->MouseMove(rMEvt);
1681}
1682
1684{
1685 return SC_MOD()->IsEditMode();
1686}
1687
1689{
1690 if (!HasFocus())
1691 {
1693 if (CanFocus())
1694 TextGrabFocus();
1695 }
1696}
1697
1699{
1700 UpdateFocus();
1701
1702 bool bClickOnSelection = false;
1703 if (m_xEditView)
1704 {
1705 m_xEditView->SetEditEngineUpdateLayout( true );
1706 bClickOnSelection = m_xEditView->IsSelectionAtPoint(rMEvt.GetPosPixel());
1707 }
1708 if (!bClickOnSelection)
1709 {
1711 GetDrawingArea()->enable_drag_source(xTransferable, DND_ACTION_NONE);
1712 }
1713 else
1714 {
1716 GetDrawingArea()->enable_drag_source(xTransferable, DND_ACTION_COPY);
1717 }
1718 return WeldEditView::MouseButtonDown(rMEvt);
1719}
1720
1722{
1723 bool bRet = WeldEditView::MouseButtonUp(rMEvt);
1724 if (bRet)
1725 {
1726 if ( rMEvt.IsMiddle() &&
1727 Application::GetSettings().GetMouseSettings().GetMiddleButtonAction() == MouseMiddleButtonAction::PasteSelection )
1728 {
1729 // EditView may have pasted from selection
1730 SC_MOD()->InputChanged( m_xEditView.get() );
1731 }
1732 else
1733 SC_MOD()->InputSelection( m_xEditView.get() );
1734 }
1735 return bRet;
1736}
1737
1739{
1740 bool bConsumed = false;
1741
1742 bInputMode = true;
1743 CommandEventId nCommand = rCEvt.GetCommand();
1744 if (m_xEditView)
1745 {
1746 ScModule* pScMod = SC_MOD();
1748
1749 // don't modify the font defaults here - the right defaults are
1750 // already set in StartEditEngine when the EditEngine is created
1751
1752 // Prevent that the EditView is lost when switching between Views
1753 pScMod->SetInEditCommand( true );
1754 m_xEditView->Command( rCEvt );
1755 pScMod->SetInEditCommand( false );
1756
1757 // CommandEventId::StartDrag does not mean by far that the content was actually changed,
1758 // so don't trigger an InputChanged.
1760
1761 if ( nCommand == CommandEventId::StartDrag )
1762 {
1763 // Is dragged onto another View?
1765 if ( pEndViewSh != pStartViewSh && pStartViewSh != nullptr )
1766 {
1767 ScViewData& rViewData = pStartViewSh->GetViewData();
1768 ScInputHandler* pHdl = pScMod->GetInputHdl( pStartViewSh );
1769 if ( pHdl && rViewData.HasEditView( rViewData.GetActivePart() ) )
1770 {
1771 pHdl->CancelHandler();
1772 rViewData.GetView()->ShowCursor(); // Missing for KillEditView, due to being inactive
1773 }
1774 }
1775 }
1776 else if ( nCommand == CommandEventId::EndExtTextInput )
1777 {
1778 if (bFormulaMode)
1779 {
1780 ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
1781 if (pHdl)
1782 pHdl->InputCommand(rCEvt);
1783 }
1784 }
1785 else if ( nCommand == CommandEventId::CursorPos )
1786 {
1787 // don't call InputChanged for CommandEventId::CursorPos
1788 }
1789 else if ( nCommand == CommandEventId::InputLanguageChange )
1790 {
1791 // #i55929# Font and font size state depends on input language if nothing is selected,
1792 // so the slots have to be invalidated when the input language is changed.
1793
1794 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1795 if (pViewFrm)
1796 {
1797 SfxBindings& rBindings = pViewFrm->GetBindings();
1798 rBindings.Invalidate( SID_ATTR_CHAR_FONT );
1799 rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
1800 }
1801 }
1802 else if ( nCommand == CommandEventId::ContextMenu )
1803 {
1804 bConsumed = true;
1805 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1806 if (pViewFrm)
1807 {
1808 Point aPos = rCEvt.GetMousePosPixel();
1809 if (!rCEvt.IsMouseEvent())
1810 {
1811 Size aSize = GetOutputSizePixel();
1812 aPos = Point(aSize.Width() / 2, aSize.Height() / 2);
1813 }
1814 if (IsMouseCaptured())
1815 ReleaseMouse();
1816 UpdateFocus();
1817 pViewFrm->GetDispatcher()->ExecutePopup("formulabar", &mrGroupBar.GetVclParent(), &aPos);
1818 }
1819 }
1820 else if ( nCommand == CommandEventId::Wheel )
1821 {
1822 //don't call InputChanged for CommandEventId::Wheel
1823 }
1824 else if ( nCommand == CommandEventId::GestureSwipe )
1825 {
1826 //don't call InputChanged for CommandEventId::GestureSwipe
1827 }
1828 else if ( nCommand == CommandEventId::GestureLongPress )
1829 {
1830 //don't call InputChanged for CommandEventId::GestureLongPress
1831 }
1832 else if ( nCommand == CommandEventId::ModKeyChange )
1833 {
1834 //pass alt press/release to parent impl
1835 }
1836 else
1837 SC_MOD()->InputChanged( m_xEditView.get() );
1838 }
1839
1840 if ( comphelper::LibreOfficeKit::isActive() && nCommand == CommandEventId::CursorPos )
1841 {
1842 // LOK uses this to setup caret position because drawingarea is replaced
1843 // with text input field, it sends logical caret position (start, end) not pixels
1844
1846 TextGrabFocus();
1847
1848 if (!m_xEditView)
1849 return true;
1850
1851 // information about paragraph is in additional data
1852 // information about position in a paragraph in a Mouse Pos
1853 // see vcl/jsdialog/executor.cxx "textselection" event
1854 const Point* pParaPoint = static_cast<const Point*>(rCEvt.GetEventData());
1855 Point aSelectionStartEnd = rCEvt.GetMousePosPixel();
1856
1857 sal_Int32 nParaStart, nParaEnd, nPosStart, nPosEnd;
1858
1859 nParaStart = pParaPoint ? pParaPoint->X() : 0;
1860 nParaEnd = pParaPoint ? pParaPoint->Y() : 0;
1861 nPosStart = m_xEditView->GetPosNoField(nParaStart, aSelectionStartEnd.X());
1862 nPosEnd = m_xEditView->GetPosNoField(nParaEnd, aSelectionStartEnd.Y());
1863
1864 m_xEditView->SetSelection(ESelection(nParaStart, nPosStart, nParaEnd, nPosEnd));
1865 SC_MOD()->InputSelection( m_xEditView.get() );
1866
1867 bConsumed = true;
1868 }
1869
1870 bInputMode = false;
1871
1872 return bConsumed;
1873}
1874
1876{
1877 // tdf#145248 don't start a drag if actively selecting
1878 if (m_xEditView && !m_xEditEngine->IsInSelectionMode())
1879 {
1880 OUString sSelection = m_xEditView->GetSelected();
1881 m_xHelper->SetData(sSelection);
1882 return sSelection.isEmpty();
1883 }
1884 return true;
1885}
1886
1888{
1889 bool bUsed = true;
1890 bInputMode = true;
1891 if (!SC_MOD()->InputKeyEvent( rKEvt ))
1892 {
1893 bUsed = false;
1895 if ( pViewSh )
1896 bUsed = pViewSh->SfxKeyInput(rKEvt); // Only accelerators, no input
1897 }
1898 bInputMode = false;
1899 return bUsed;
1900}
1901
1903{
1905 if ( pViewSh )
1906 pViewSh->SetFormShellAtTop( false ); // focus in input line -> FormShell no longer on top
1908}
1909
1911{
1912 if ( bSet != bFormulaMode )
1913 {
1914 bFormulaMode = bSet;
1916 }
1917}
1918
1920{
1921 if (m_xEditEngine)
1922 {
1923 EEControlBits nControl = m_xEditEngine->GetControlWord();
1924 EEControlBits nOld = nControl;
1925 if ( bFormulaMode )
1926 nControl &= ~EEControlBits::AUTOCORRECT; // No AutoCorrect in Formulas
1927 else
1928 nControl |= EEControlBits::AUTOCORRECT; // Else do enable it
1929
1930 if ( nControl != nOld )
1931 m_xEditEngine->SetControlWord( nControl );
1932 }
1933}
1934
1936{
1937 // editengine height has changed or editview scroll pos has changed
1939}
1940
1942{
1943 if (m_xEditView && !bInputMode)
1944 {
1945 ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
1946
1947 // Use the InputHandler's InOwnChange flag to prevent calling InputChanged
1948 // while an InputHandler method is modifying the EditEngine content
1949
1950 if ( pHdl && !pHdl->IsInOwnChange() )
1951 pHdl->InputChanged( m_xEditView.get(), true ); // #i20282# InputChanged must know if called from modify handler
1952 }
1953}
1954
1955IMPL_LINK_NOARG(ScTextWnd, EditStatusHdl, EditStatus&, void)
1956{
1957 SetScrollBarRange();
1958 DoScroll();
1959 Invalidate();
1960}
1961
1963{
1964 if (!m_xEditEngine)
1965 return;
1966
1967 if (m_xEditView)
1968 {
1969 if (!maAccTextDatas.empty())
1970 maAccTextDatas.back()->EndEdit();
1971
1972 ScModule* pScMod = SC_MOD();
1973
1974 if (!bAll)
1975 pScMod->InputSelection( m_xEditView.get() );
1976 aString = m_xEditEngine->GetText();
1977 bIsInsertMode = m_xEditView->IsInsertMode();
1978 bool bSelection = m_xEditView->HasSelection();
1979 m_xEditEngine->SetStatusEventHdl(Link<EditStatus&, void>());
1981 m_xEditView.reset();
1982 m_xEditEngine.reset();
1983
1985
1986 if (pHdl && pHdl->IsEditMode() && !bAll)
1987 pHdl->SetMode(SC_INPUT_TABLE);
1988
1989 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
1990 if (pViewFrm)
1991 pViewFrm->GetBindings().Invalidate( SID_ATTR_INSERT );
1992
1993 if (bSelection)
1994 Invalidate(); // So that the Selection is not left there
1995 }
1996
1998 {
1999 // Clear
2000 std::vector<ReferenceMark> aReferenceMarks;
2002 }
2003}
2004
2005static sal_Int32 findFirstNonMatchingChar(const OUString& rStr1, const OUString& rStr2)
2006{
2007 // Search the string for unmatching chars
2008 const sal_Unicode* pStr1 = rStr1.getStr();
2009 const sal_Unicode* pStr2 = rStr2.getStr();
2010 sal_Int32 i = 0;
2011 while ( i < rStr1.getLength() )
2012 {
2013 // Abort on the first unmatching char
2014 if ( *pStr1 != *pStr2 )
2015 return i;
2016 ++pStr1;
2017 ++pStr2;
2018 ++i;
2019 }
2020
2021 return i;
2022}
2023
2024void ScTextWnd::SetTextString( const OUString& rNewString )
2025{
2026 // Ideally it would be best to create on demand the EditEngine/EditView here, but... for
2027 // the initialisation scenario where a cell is first clicked on we end up with the text in the
2028 // inputbar window scrolled to the bottom if we do that here ( because the tableview and topview
2029 // are synced I guess ).
2030 // should fix that I suppose :-/ need to look a bit further into that
2031 mbInvalidate = true; // ensure next Paint ( that uses editengine ) call will call Invalidate first
2032
2033 if ( rNewString != aString )
2034 {
2035 bInputMode = true;
2036
2037 // Find position of the change, only paint the rest
2038 if (!m_xEditEngine)
2039 {
2040 bool bPaintAll = GetNumLines() > 1 || bIsRTL;
2041 if (!bPaintAll)
2042 {
2043 // test if CTL script type is involved
2044 SvtScriptType nOldScript = SvtScriptType::NONE;
2045 SvtScriptType nNewScript = SvtScriptType::NONE;
2047 if ( auto pDocShell = dynamic_cast<ScDocShell*>( pObjSh) )
2048 {
2049 // any document can be used (used only for its break iterator)
2050 ScDocument& rDoc = pDocShell->GetDocument();
2051 nOldScript = rDoc.GetStringScriptType( aString );
2052 nNewScript = rDoc.GetStringScriptType( rNewString );
2053 }
2054 bPaintAll = ( nOldScript & SvtScriptType::COMPLEX ) || ( nNewScript & SvtScriptType::COMPLEX );
2055 }
2056
2057 if ( bPaintAll )
2058 {
2059 // In multiline mode, or if CTL is involved, the whole text has to be redrawn
2060 Invalidate();
2061 }
2062 else
2063 {
2064 tools::Long nTextSize = 0;
2065 sal_Int32 nDifPos;
2066 if (rNewString.getLength() > aString.getLength())
2067 nDifPos = findFirstNonMatchingChar(rNewString, aString);
2068 else
2069 nDifPos = findFirstNonMatchingChar(aString, rNewString);
2070
2071 tools::Long nSize1 = GetTextWidth(aString);
2072 tools::Long nSize2 = GetTextWidth(rNewString);
2073 if ( nSize1>0 && nSize2>0 )
2074 nTextSize = std::max( nSize1, nSize2 );
2075 else
2076 nTextSize = GetOutputSizePixel().Width(); // Overflow
2077
2078 Point aLogicStart = GetDrawingArea()->get_ref_device().PixelToLogic(Point(0,0));
2079 tools::Long nStartPos = aLogicStart.X();
2080 tools::Long nInvPos = nStartPos;
2081 if (nDifPos)
2082 nInvPos += GetTextWidth(aString.copy(0,nDifPos));
2083
2084 Invalidate(tools::Rectangle(nInvPos, 0, nStartPos+nTextSize, GetOutputSizePixel().Height() - 1));
2085 }
2086 }
2087 else
2088 {
2089 static_cast<ScEditEngineDefaulter*>(m_xEditEngine.get())->SetTextCurrentDefaults(rNewString);
2090 }
2091
2092 aString = rNewString;
2093
2094 if (!maAccTextDatas.empty())
2095 maAccTextDatas.back()->TextChanged();
2096
2097 bInputMode = false;
2098 }
2099
2101 {
2102 ESelection aSel = m_xEditView ? m_xEditView->GetSelection() : ESelection();
2104 }
2105
2107 DoScroll();
2108}
2109
2110const OUString& ScTextWnd::GetTextString() const
2111{
2112 return aString;
2113}
2114
2116{
2117 return HasFocus();
2118}
2119
2121{
2122 if ( m_xEditView ) return;
2123
2124 std::unique_ptr<ScFieldEditEngine> pNew;
2126 if ( pViewSh )
2127 {
2128 ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
2129 pNew = std::make_unique<ScFieldEditEngine>(&rDoc, rDoc.GetEnginePool(), rDoc.GetEditPool());
2130 }
2131 else
2132 pNew = std::make_unique<ScFieldEditEngine>(nullptr, EditEngine::CreatePool().get(), nullptr, true);
2133 pNew->SetExecuteURL( false );
2134 m_xEditEngine = std::move(pNew);
2135
2136 const bool bPrevUpdateLayout = m_xEditEngine->SetUpdateLayout( false );
2137 m_xEditEngine->SetWordDelimiters( m_xEditEngine->GetWordDelimiters() + "=" );
2138 m_xEditEngine->SetPaperSize( Size( bIsRTL ? USHRT_MAX : THESIZE, 300 ) );
2139
2140 auto pSet = std::make_unique<SfxItemSet>( m_xEditEngine->GetEmptyItemSet() );
2143 if ( bIsRTL )
2144 lcl_ModifyRTLDefaults( *pSet );
2145 static_cast<ScEditEngineDefaulter*>(m_xEditEngine.get())->SetDefaults( std::move(pSet) );
2146 m_xEditEngine->SetUpdateLayout( bPrevUpdateLayout );
2147
2148 m_xEditView = std::make_unique<EditView>(m_xEditEngine.get(), nullptr);
2149 m_xEditView->setEditViewCallbacks(this);
2150
2151 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2152 Color aBgColor = rStyleSettings.GetWindowColor();
2153 m_xEditView->SetBackgroundColor(aBgColor);
2154
2155 if (pAcc)
2156 {
2157 pAcc->InitAcc(nullptr, m_xEditView.get(),
2158 ScResId(STR_ACC_EDITLINE_NAME),
2159 ScResId(STR_ACC_EDITLINE_DESCR));
2160 }
2161
2163 m_xEditView->RegisterViewShell(mpViewShell);
2164 m_xEditEngine->InsertView( m_xEditView.get(), EE_APPEND );
2165
2166 Resize();
2167
2168 if ( bIsRTL )
2170
2171 if (!maAccTextDatas.empty())
2172 maAccTextDatas.back()->StartEdit();
2173}
2174
2176{
2178
2179 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2180
2181 Color aBgColor= rStyleSettings.GetWindowColor();
2182 Color aTxtColor= rStyleSettings.GetWindowTextColor();
2183
2184 aTextFont.SetFillColor ( aBgColor );
2185 aTextFont.SetColor (aTxtColor);
2186 Invalidate();
2187}
2188
2190{
2191 // bypass WeldEditView::SetDrawingArea
2193
2194 // set cursor
2195 pDrawingArea->set_cursor(PointerStyle::Text);
2196
2197 // initialize dnd, deliberately just a simple string so
2198 // we don't transfer the happenstance formatting in
2199 // the input line
2200 m_xHelper.set(new svt::OStringTransferable(OUString()));
2202 SetDragDataTransferable(xHelper, DND_ACTION_COPY);
2203
2204 OutputDevice& rDevice = pDrawingArea->get_ref_device();
2205 pDrawingArea->set_margin_start(gnBorderWidth);
2206 pDrawingArea->set_margin_end(gnBorderWidth);
2207 // leave 1 for the width of the scrolledwindow border
2208 pDrawingArea->set_margin_top(gnBorderHeight - 1);
2209 pDrawingArea->set_margin_bottom(gnBorderHeight - 1);
2210
2211 // always use application font, so a font with cjk chars can be installed
2213 weld::SetPointFont(rDevice, aAppFont);
2214
2215 aTextFont = rDevice.GetFont();
2216 Size aFontSize = aTextFont.GetFontSize();
2217 aTextFont.SetFontSize(rDevice.PixelToLogic(aFontSize, MapMode(MapUnit::MapTwip)));
2218
2219 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2220
2221 Color aBgColor = rStyleSettings.GetWindowColor();
2222 Color aTxtColor = rStyleSettings.GetWindowTextColor();
2223
2225 aTextFont.SetFillColor(aBgColor);
2226 aTextFont.SetColor(aTxtColor);
2228
2229 Size aSize(1, GetPixelHeightForLines(1));
2230 pDrawingArea->set_size_request(aSize.Width(), aSize.Height());
2231
2232 rDevice.SetBackground(aBgColor);
2233 rDevice.SetLineColor(COL_BLACK);
2234 rDevice.SetMapMode(MapMode(MapUnit::MapTwip));
2235 rDevice.SetFont(aTextFont);
2236
2237 EnableRTL(false); // EditEngine can't be used with VCL EnableRTL
2238}
2239
2240css::uno::Reference< css::accessibility::XAccessible > ScTextWnd::CreateAccessible()
2241{
2242 pAcc = new ScAccessibleEditLineObject(this);
2243 return pAcc;
2244}
2245
2247{
2248 OSL_ENSURE( ::std::find( maAccTextDatas.begin(), maAccTextDatas.end(), &rTextData ) == maAccTextDatas.end(),
2249 "ScTextWnd::InsertAccessibleTextData - passed object already registered" );
2250 maAccTextDatas.push_back( &rTextData );
2251}
2252
2254{
2255 AccTextDataVector::iterator aEnd = maAccTextDatas.end();
2256 AccTextDataVector::iterator aIt = ::std::find( maAccTextDatas.begin(), aEnd, &rTextData );
2257 OSL_ENSURE( aIt != aEnd, "ScTextWnd::RemoveAccessibleTextData - passed object not registered" );
2258 if( aIt != aEnd )
2259 maAccTextDatas.erase( aIt );
2260}
2261
2263{
2265 CustomWidgetController::Invalidate();
2266}
2267
2269{
2270 GrabFocus();
2271}
2272
2273// Position window
2275 : InterimItemWindow(pParent, "modules/scalc/ui/posbox.ui", "PosBox")
2276 , m_xWidget(m_xBuilder->weld_combo_box("pos_window"))
2277 , m_nAsyncGetFocusId(nullptr)
2278 , nTipVisible(nullptr)
2279 , bFormulaMode(false)
2280{
2282
2283 // Use calculation according to tdf#132338 to align combobox width to width of fontname combobox within formatting toolbar;
2284 // formatting toolbar is placed above formulabar when using multiple toolbars typically
2285
2286 m_xWidget->set_entry_width_chars(1);
2287 Size aSize(LogicToPixel(Size(POSITION_COMBOBOX_WIDTH * 4, 0), MapMode(MapUnit::MapAppFont)));
2288 m_xWidget->set_size_request(aSize.Width(), -1);
2289 SetSizePixel(m_xContainer->get_preferred_size());
2290
2292
2293 StartListening( *SfxGetpApp() ); // For Navigator rangename updates
2294
2295 m_xWidget->connect_key_press(LINK(this, ScPosWnd, KeyInputHdl));
2296 m_xWidget->connect_entry_activate(LINK(this, ScPosWnd, ActivateHdl));
2297 m_xWidget->connect_changed(LINK(this, ScPosWnd, ModifyHdl));
2298 m_xWidget->connect_focus_in(LINK(this, ScPosWnd, FocusInHdl));
2299 m_xWidget->connect_focus_out(LINK(this, ScPosWnd, FocusOutHdl));
2300}
2301
2303{
2304 disposeOnce();
2305}
2306
2308{
2310
2311 HideTip();
2312
2314 {
2316 m_nAsyncGetFocusId = nullptr;
2317 }
2318 m_xWidget.reset();
2319
2321}
2322
2324{
2325 if ( bSet != bFormulaMode )
2326 {
2327 bFormulaMode = bSet;
2328
2329 if ( bSet )
2330 FillFunctions();
2331 else
2333
2334 HideTip();
2335 }
2336}
2337
2338void ScPosWnd::SetPos( const OUString& rPosStr )
2339{
2340 if ( aPosStr != rPosStr )
2341 {
2342 aPosStr = rPosStr;
2343 m_xWidget->set_entry_text(aPosStr);
2344 }
2345}
2346
2347// static
2348OUString ScPosWnd::createLocalRangeName(std::u16string_view rName, std::u16string_view rTableName)
2349{
2350 return OUString::Concat(rName) + " (" + rTableName + ")";
2351}
2352
2354{
2355 m_xWidget->clear();
2356 m_xWidget->freeze();
2357
2359 if ( auto pDocShell = dynamic_cast<ScDocShell*>( pObjSh) )
2360 {
2361 ScDocument& rDoc = pDocShell->GetDocument();
2362
2363 m_xWidget->append_text(ScResId(STR_MANAGE_NAMES));
2364 m_xWidget->append_separator("separator");
2365
2366 ScRange aDummy;
2367 std::set<OUString> aSet;
2368 ScRangeName* pRangeNames = rDoc.GetRangeName();
2369 for (const auto& rEntry : *pRangeNames)
2370 {
2371 if (rEntry.second->IsValidReference(aDummy))
2372 aSet.insert(rEntry.second->GetName());
2373 }
2374 for (SCTAB i = 0; i < rDoc.GetTableCount(); ++i)
2375 {
2376 ScRangeName* pLocalRangeName = rDoc.GetRangeName(i);
2377 if (pLocalRangeName && !pLocalRangeName->empty())
2378 {
2379 OUString aTableName;
2380 rDoc.GetName(i, aTableName);
2381 for (const auto& rEntry : *pLocalRangeName)
2382 {
2383 if (rEntry.second->IsValidReference(aDummy))
2384 aSet.insert(createLocalRangeName(rEntry.second->GetName(), aTableName));
2385 }
2386 }
2387 }
2388
2389 for (const auto& rItem : aSet)
2390 {
2391 m_xWidget->append_text(rItem);
2392 }
2393 }
2394 m_xWidget->thaw();
2395 m_xWidget->set_entry_text(aPosStr);
2396}
2397
2399{
2400 m_xWidget->clear();
2401 m_xWidget->freeze();
2402
2403 OUString aFirstName;
2404 const ScAppOptions& rOpt = SC_MOD()->GetAppOptions();
2405 sal_uInt16 nMRUCount = rOpt.GetLRUFuncListCount();
2406 const sal_uInt16* pMRUList = rOpt.GetLRUFuncList();
2407 if (pMRUList)
2408 {
2410 sal_uInt32 nListCount = pFuncList->GetCount();
2411 for (sal_uInt16 i=0; i<nMRUCount; i++)
2412 {
2413 sal_uInt16 nId = pMRUList[i];
2414 for (sal_uInt32 j=0; j<nListCount; j++)
2415 {
2416 const ScFuncDesc* pDesc = pFuncList->GetFunction( j );
2417 if ( pDesc->nFIndex == nId && pDesc->mxFuncName )
2418 {
2419 m_xWidget->append_text(*pDesc->mxFuncName);
2420 if (aFirstName.isEmpty())
2421 aFirstName = *pDesc->mxFuncName;
2422 break; // Stop searching
2423 }
2424 }
2425 }
2426 }
2427
2429 // has been entered so far
2430
2431 // m_xWidget->append_text(ScResId(STR_FUNCTIONLIST_MORE));
2432
2433 m_xWidget->thaw();
2434 m_xWidget->set_entry_text(aFirstName);
2435}
2436
2438{
2439 if ( bFormulaMode )
2440 return;
2441
2442 // Does the list of range names need updating?
2443 if ( auto pEventHint = dynamic_cast<const SfxEventHint*>(&rHint) )
2444 {
2445 SfxEventHintId nEventId = pEventHint->GetEventId();
2446 if ( nEventId == SfxEventHintId::ActivateDoc )
2448 }
2449 else
2450 {
2451 const SfxHintId nHintId = rHint.GetId();
2452 if (nHintId == SfxHintId::ScAreasChanged || nHintId == SfxHintId::ScNavigatorUpdateAll)
2454 }
2455}
2456
2458{
2459 if (nTipVisible)
2460 {
2462 nTipVisible = nullptr;
2463 }
2464}
2465
2466static ScNameInputType lcl_GetInputType( const OUString& rText )
2467{
2468 ScNameInputType eRet = SC_NAME_INPUT_BAD_NAME; // the more general error
2469
2471 if ( pViewSh )
2472 {
2473 ScViewData& rViewData = pViewSh->GetViewData();
2474 ScDocument& rDoc = rViewData.GetDocument();
2475 SCTAB nTab = rViewData.GetTabNo();
2476 ScAddress::Details aDetails( rDoc.GetAddressConvention());
2477
2478 // test in same order as in SID_CURRENTCELL execute
2479
2480 ScRange aRange;
2481 ScAddress aAddress;
2482 SCTAB nNameTab;
2483 sal_Int32 nNumeric;
2484
2485 // From the context we know that when testing for a range name
2486 // sheet-local scope names have " (sheetname)" appended and global
2487 // names don't and can't contain ')', so we can force one or the other.
2488 const RutlNameScope eNameScope =
2489 ((!rText.isEmpty() && rText[rText.getLength()-1] == ')') ? RUTL_NAMES_LOCAL : RUTL_NAMES_GLOBAL);
2490
2491 if (rText == ScResId(STR_MANAGE_NAMES))
2492 eRet = SC_MANAGE_NAMES;
2493 else if ( aRange.Parse( rText, rDoc, aDetails ) & ScRefFlags::VALID )
2494 eRet = SC_NAME_INPUT_RANGE;
2495 else if ( aAddress.Parse( rText, rDoc, aDetails ) & ScRefFlags::VALID )
2496 eRet = SC_NAME_INPUT_CELL;
2497 else if ( ScRangeUtil::MakeRangeFromName( rText, rDoc, nTab, aRange, eNameScope, aDetails ) )
2498 {
2499 eRet = ((eNameScope == RUTL_NAMES_LOCAL) ? SC_NAME_INPUT_NAMEDRANGE_LOCAL :
2500 SC_NAME_INPUT_NAMEDRANGE_GLOBAL);
2501 }
2502 else if ( ScRangeUtil::MakeRangeFromName( rText, rDoc, nTab, aRange, RUTL_DBASE, aDetails ) )
2503 eRet = SC_NAME_INPUT_DATABASE;
2504 else if ( comphelper::string::isdigitAsciiString( rText ) &&
2505 ( nNumeric = rText.toInt32() ) > 0 && nNumeric <= rDoc.MaxRow()+1 )
2506 eRet = SC_NAME_INPUT_ROW;
2507 else if ( rDoc.GetTable( rText, nNameTab ) )
2508 eRet = SC_NAME_INPUT_SHEET;
2509 else if (ScRangeData::IsNameValid(rText, rDoc)
2510 == ScRangeData::IsNameValidType::NAME_VALID) // nothing found, create new range?
2511 {
2512 if ( rViewData.GetSimpleArea( aRange ) == SC_MARK_SIMPLE )
2513 eRet = SC_NAME_INPUT_DEFINE;
2514 else
2515 eRet = SC_NAME_INPUT_BAD_SELECTION;
2516 }
2517 else
2518 eRet = SC_NAME_INPUT_BAD_NAME;
2519 }
2520
2521 return eRet;
2522}
2523
2525{
2526 HideTip();
2527
2528 if (m_xWidget->changed_by_direct_pick())
2529 {
2530 DoEnter();
2531 return;
2532 }
2533
2534 if (bFormulaMode)
2535 return;
2536
2537 // determine the action that would be taken for the current input
2538
2539 ScNameInputType eType = lcl_GetInputType(m_xWidget->get_active_text()); // uses current view
2540 TranslateId pStrId;
2541 switch ( eType )
2542 {
2543 case SC_NAME_INPUT_CELL:
2544 pStrId = STR_NAME_INPUT_CELL;
2545 break;
2546 case SC_NAME_INPUT_RANGE:
2547 case SC_NAME_INPUT_NAMEDRANGE_LOCAL:
2548 case SC_NAME_INPUT_NAMEDRANGE_GLOBAL:
2549 pStrId = STR_NAME_INPUT_RANGE; // named range or range reference
2550 break;
2551 case SC_NAME_INPUT_DATABASE:
2552 pStrId = STR_NAME_INPUT_DBRANGE;
2553 break;
2554 case SC_NAME_INPUT_ROW:
2555 pStrId = STR_NAME_INPUT_ROW;
2556 break;
2557 case SC_NAME_INPUT_SHEET:
2558 pStrId = STR_NAME_INPUT_SHEET;
2559 break;
2560 case SC_NAME_INPUT_DEFINE:
2561 pStrId = STR_NAME_INPUT_DEFINE;
2562 break;
2563 default:
2564 // other cases (error): no tip help
2565 break;
2566 }
2567
2568 if (!pStrId)
2569 return;
2570
2571 // show the help tip at the text cursor position
2572 Point aPos;
2573 vcl::Cursor* pCur = GetCursor();
2574 if (pCur)
2575 aPos = LogicToPixel( pCur->GetPos() );
2576 aPos = OutputToScreenPixel( aPos );
2577 tools::Rectangle aRect( aPos, aPos );
2578
2579 OUString aText = ScResId(pStrId);
2580 QuickHelpFlags const nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
2581 nTipVisible = Help::ShowPopover(this, aRect, aText, nAlign);
2582}
2583
2585{
2586 bool bOpenManageNamesDialog = false;
2587 OUString aText = m_xWidget->get_active_text();
2588 if ( !aText.isEmpty() )
2589 {
2590 if ( bFormulaMode )
2591 {
2592 ScModule* pScMod = SC_MOD();
2593 if ( aText == ScResId(STR_FUNCTIONLIST_MORE) )
2594 {
2595 // Function AutoPilot
2597
2599 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
2600 if ( pViewFrm && !pViewFrm->GetChildWindow( SID_OPENDLG_FUNCTION ) )
2601 pViewFrm->GetDispatcher()->Execute( SID_OPENDLG_FUNCTION,
2602 SfxCallMode::SYNCHRON | SfxCallMode::RECORD );
2603 }
2604 else
2605 {
2606 ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
2607 ScInputHandler* pHdl = pScMod->GetInputHdl( pViewSh );
2608 if (pHdl)
2609 pHdl->InsertFunction( aText );
2610 }
2611 }
2612 else
2613 {
2614 // depending on the input, select something or create a new named range
2615
2617 if ( pViewSh )
2618 {
2619 ScViewData& rViewData = pViewSh->GetViewData();
2620 ScDocShell* pDocShell = rViewData.GetDocShell();
2621 ScDocument& rDoc = pDocShell->GetDocument();
2622
2623 ScNameInputType eType = lcl_GetInputType( aText );
2624 if ( eType == SC_NAME_INPUT_BAD_NAME || eType == SC_NAME_INPUT_BAD_SELECTION )
2625 {
2626 TranslateId pId = (eType == SC_NAME_INPUT_BAD_NAME) ? STR_NAME_ERROR_NAME : STR_NAME_ERROR_SELECTION;
2627 pViewSh->ErrorMessage(pId);
2628 }
2629 else if ( eType == SC_NAME_INPUT_DEFINE )
2630 {
2631 ScRangeName* pNames = rDoc.GetRangeName();
2632 ScRange aSelection;
2633 if ( pNames && !pNames->findByUpperName(ScGlobal::getCharClass().uppercase(aText)) &&
2634 (rViewData.GetSimpleArea( aSelection ) == SC_MARK_SIMPLE) )
2635 {
2636 ScRangeName aNewRanges( *pNames );
2637 ScAddress aCursor( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() );
2638 OUString aContent(aSelection.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention()));
2639 ScRangeData* pNew = new ScRangeData( rDoc, aText, aContent, aCursor );
2640 if ( aNewRanges.insert(pNew) )
2641 {
2642 pDocShell->GetDocFunc().ModifyRangeNames( aNewRanges );
2643 pViewSh->UpdateInputHandler(true);
2644 }
2645 }
2646 }
2647 else if (eType == SC_MANAGE_NAMES)
2648 {
2649 // dialog is only set below after calling 'ReleaseFocus_Impl' to ensure it gets focus
2650 bOpenManageNamesDialog = true;
2651 }
2652 else
2653 {
2654 bool bForceGlobalName = false;
2655 // for all selection types, execute the SID_CURRENTCELL slot.
2656 if (eType == SC_NAME_INPUT_CELL || eType == SC_NAME_INPUT_RANGE)
2657 {
2658 // Note that SID_CURRENTCELL always expects address to
2659 // be in Calc A1 format. Convert the text.
2660 ScRange aRange(0,0, rViewData.GetTabNo());
2661 aRange.ParseAny(aText, rDoc, rDoc.GetAddressConvention());
2663 }
2664 else if (eType == SC_NAME_INPUT_NAMEDRANGE_GLOBAL)
2665 {
2666 bForceGlobalName = true;
2667 }
2668
2669 SfxStringItem aPosItem( SID_CURRENTCELL, aText );
2670 SfxBoolItem aUnmarkItem( FN_PARAM_1, true ); // remove existing selection
2671 // FN_PARAM_2 reserved for AlignToCursor
2672 SfxBoolItem aForceGlobalName( FN_PARAM_3, bForceGlobalName );
2673
2674 pViewSh->GetViewData().GetDispatcher().ExecuteList( SID_CURRENTCELL,
2675 SfxCallMode::SYNCHRON | SfxCallMode::RECORD,
2676 { &aPosItem, &aUnmarkItem, &aForceGlobalName });
2677 }
2678 }
2679 }
2680 }
2681 else
2682 m_xWidget->set_entry_text(aPosStr);
2683
2685
2686 if (bOpenManageNamesDialog)
2687 {
2688 const sal_uInt16 nId = ScNameDlgWrapper::GetChildWindowId();
2690 assert(pViewSh);
2691 SfxViewFrame& rViewFrm = pViewSh->GetViewFrame();
2692 SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId );
2693 SC_MOD()->SetRefDialog( nId, pWnd == nullptr );
2694 }
2695}
2696
2698{
2699 DoEnter();
2700 return true;
2701}
2702
2703IMPL_LINK(ScPosWnd, KeyInputHdl, const KeyEvent&, rKEvt, bool)
2704{
2705 bool bHandled = true;
2706
2707 switch (rKEvt.GetKeyCode().GetCode())
2708 {
2709 case KEY_RETURN:
2710 bHandled = ActivateHdl(*m_xWidget);
2711 break;
2712 case KEY_ESCAPE:
2713 if (nTipVisible)
2714 {
2715 // escape when the tip help is shown: only hide the tip
2716 HideTip();
2717 }
2718 else
2719 {
2720 if (!bFormulaMode)
2721 m_xWidget->set_entry_text(aPosStr);
2722 ReleaseFocus_Impl();
2723 }
2724 break;
2725 default:
2726 bHandled = false;
2727 break;
2728 }
2729
2730 return bHandled || ChildKeyInput(rKEvt);
2731}
2732
2733IMPL_LINK_NOARG(ScPosWnd, OnAsyncGetFocus, void*, void)
2734{
2735 m_nAsyncGetFocusId = nullptr;
2736 m_xWidget->select_entry_region(0, -1);
2737}
2738
2740{
2741 if (m_nAsyncGetFocusId)
2742 return;
2743 // do it async to defeat entry in combobox having its own ideas about the focus
2744 m_nAsyncGetFocusId = Application::PostUserEvent(LINK(this, ScPosWnd, OnAsyncGetFocus));
2745}
2746
2748{
2749 if (m_nAsyncGetFocusId)
2750 {
2751 Application::RemoveUserEvent(m_nAsyncGetFocusId);
2752 m_nAsyncGetFocusId = nullptr;
2753 }
2754
2755 HideTip();
2756}
2757
2759{
2760 HideTip();
2761
2763 ScInputHandler* pHdl = SC_MOD()->GetInputHdl( dynamic_cast<ScTabViewShell*>( pCurSh ) );
2764 if ( pHdl && pHdl->IsTopMode() )
2765 {
2766 // Focus back in input row?
2767 ScInputWindow* pInputWin = pHdl->GetInputWindow();
2768 if (pInputWin)
2769 {
2770 pInputWin->TextGrabFocus();
2771 return;
2772 }
2773 }
2774
2775 // Set focus to active View
2776 if ( pCurSh )
2777 {
2778 vcl::Window* pShellWnd = pCurSh->GetWindow();
2779
2780 if ( pShellWnd )
2781 pShellWnd->GrabFocus();
2782 }
2783}
2784
2785/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::Image > m_xWidget
BaseContainerNodeSharedPtr & mrParent
SfxApplication * SfxGetpApp()
const MouseSettings & GetMouseSettings() const
const StyleSettings & GetStyleSettings() const
static bool GetLayoutRTL()
static const AllSettings & GetSettings()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
void * GetEventData() const
bool IsMouseEvent() const
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
Size GetSizePixel() const override
Size GetOutputSizePixel() const
sal_Int32 GetParagraphCount() const
const Size & GetPaperSize() const
sal_Int32 GetTextLen() const
static rtl::Reference< SfxItemPool > CreatePool()
static void SetFontInfoInItemSet(SfxItemSet &rItemSet, const vcl::Font &rFont)
tools::Rectangle GetVisArea() const
void SetSelection(const ESelection &rNewSel)
vcl::Cursor * GetCursor() const
EditEngine * GetEditEngine() const
void SetVisArea(const tools::Rectangle &rRect)
bool SetEditEngineUpdateLayout(bool bUpdate)
static void * ShowPopover(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rText, QuickHelpFlags nStyle)
static void HidePopover(vcl::Window const *pParent, void *nId)
virtual void Resize() override
virtual void dispose() override
std::unique_ptr< weld::Container > m_xContainer
void InitControlBase(weld::Widget *pWidget)
const Point & GetPosPixel() const
bool IsMiddle() const
bool IsLeft() const
MouseMiddleButtonAction GetMiddleButtonAction() const
Size GetOutputSize() const
const vcl::Font & GetFont() const
void SetFont(const vcl::Font &rNewFont)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
void SetLineColor()
void SetMapMode()
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
const MapMode & GetMapMode() const
tools::Long GetTextHeight() const
void SetBackground()
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const Details &rDetails=detailsOOOa1, ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, sal_Int32 *pSheetEndPos=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1537
sal_uInt16 GetLRUFuncListCount() const
Definition: appoptio.hxx:47
sal_uInt16 * GetLRUFuncList() const
Definition: appoptio.hxx:48
void ModifyRangeNames(const ScRangeName &rNewRanges, SCTAB nTab=-1)
Definition: docfunc.cxx:5137
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:221
SC_DLLPUBLIC SfxItemPool * GetEnginePool() const
Definition: documen2.cxx:478
SC_DLLPUBLIC bool GetTable(const OUString &rName, SCTAB &rTab) const
Definition: document.cxx:244
SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const
Definition: documen3.cxx:492
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
SC_DLLPUBLIC SvtScriptType GetStringScriptType(const OUString &rString)
Definition: documen6.cxx:76
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
Definition: documen2.cxx:473
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:171
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3736
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:204
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:297
static OUString ModifyDelimiters(const OUString &rOld)
Definition: editutil.cxx:65
Stores and generates human readable descriptions for spreadsheet-functions, e.g. functions used in fo...
Definition: funcdesc.hxx:41
sal_uInt16 nFIndex
Unique function index.
Definition: funcdesc.hxx:221
std::optional< OUString > mxFuncName
Function name.
Definition: funcdesc.hxx:216
List of spreadsheet functions.
Definition: funcdesc.hxx:242
const ScFuncDesc * GetFunction(sal_uInt32 nIndex) const
Definition: funcdesc.cxx:993
sal_uInt32 GetCount() const
Definition: funcdesc.hxx:247
static ScFunctionList * GetStarCalcFunctionList()
Definition: global.cxx:626
static std::optional< SvtSysLocale > oSysLocale
Definition: global.hxx:544
static SC_DLLPUBLIC const CharClass & getCharClass()
Definition: global.cxx:1064
void SetBackgrounds()
Definition: inputwin.cxx:926
void NumLinesChanged()
Definition: inputwin.cxx:1121
virtual ~ScInputBarGroup() override
Definition: inputwin.cxx:950
std::unique_ptr< weld::Button > mxButtonUp
Definition: inputwin.hxx:282
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: inputwin.cxx:935
void IncrementVerticalSize()
Definition: inputwin.cxx:1025
void TriggerToolboxLayout()
Definition: inputwin.cxx:1142
void DecrementVerticalSize()
Definition: inputwin.cxx:1031
Point GetCursorScreenPixelPos(bool bBelowLine)
Definition: inputwin.cxx:945
void MakeDialogEditView() override
Definition: inputwin.cxx:1000
virtual void RemoveAccessibleTextData(ScAccessibleEditLineTextData &rTextData) override
Definition: inputwin.cxx:969
std::unique_ptr< weld::Container > mxBackground
Definition: inputwin.hxx:280
void SetTextString(const OUString &rString) override
Definition: inputwin.cxx:979
virtual bool HasEditView() const override
Definition: inputwin.cxx:1010
virtual EditView * GetEditView() const override
Definition: inputwin.cxx:1005
void StartEditEngine() override
Definition: inputwin.cxx:995
virtual void dispose() override
Definition: inputwin.cxx:955
virtual void InsertAccessibleTextData(ScAccessibleEditLineTextData &rTextData) override
Definition: inputwin.cxx:964
virtual void TextGrabFocus() override
Definition: inputwin.cxx:1183
bool IsInputActive() override
Definition: inputwin.cxx:1015
void SetFormulaMode(bool bSet) override
Definition: inputwin.cxx:1020
std::unique_ptr< ScTextWndGroup > mxTextWndGroup
Definition: inputwin.hxx:281
virtual const OUString & GetTextString() const override
Definition: inputwin.cxx:974
virtual void Resize() override
Definition: inputwin.cxx:984
ScInputBarGroup(vcl::Window *Parent, ScTabViewShell *pViewSh)
Definition: inputwin.cxx:890
std::unique_ptr< weld::Button > mxButtonDown
Definition: inputwin.hxx:283
virtual void StopEditEngine(bool bAll) override
Definition: inputwin.cxx:990
bool IsInputMode() const
Definition: inputhdl.hxx:186
bool IsTopMode() const
Definition: inputhdl.hxx:189
void CancelHandler()
Definition: inputhdl.cxx:3453
void InputCommand(const CommandEvent &rCEvt)
Definition: inputhdl.cxx:4070
bool IsInOwnChange() const
Definition: inputhdl.hxx:269
static void LOKSendFormulabarUpdate(EditView *pEditView, const SfxViewShell *pActiveViewSh, const OUString &rText, const ESelection &rSelection)
Definition: inputhdl.cxx:1808
static void SendReferenceMarks(const SfxViewShell *pViewShell, const std::vector< ReferenceMark > &rReferenceMarks)
Definition: inputhdl.cxx:306
bool GetTextAndFields(ScEditEngineDefaulter &rDestEngine)
Definition: inputhdl.cxx:4503
bool IsEditMode() const
Definition: inputhdl.hxx:187
ScInputWindow * GetInputWindow()
Definition: inputhdl.hxx:264
EditView * GetTopView()
Definition: inputhdl.hxx:239
void SetMode(ScInputMode eNewMode, const OUString *pInitText=nullptr, ScEditEngineDefaulter *pTopEngine=nullptr)
Definition: inputhdl.cxx:2960
const OUString & GetFormString() const
Definition: inputhdl.hxx:192
void InsertFunction(const OUString &rFuncName, bool bAddPar=true)
Definition: inputhdl.cxx:3663
void SetInputWindow(ScInputWindow *pNew)
Definition: inputhdl.cxx:2342
void InitRangeFinder(const OUString &rFormula)
Definition: inputhdl.cxx:358
void InputChanged(const EditView *pView, bool bFromNotify)
Definition: inputhdl.cxx:4454
EditView * GetTableView()
Definition: inputhdl.hxx:238
void StopInputWinEngine(bool bAll)
Definition: inputhdl.cxx:2347
const OUString & GetEditString()
Definition: inputhdl.cxx:4483
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: inputwin.cxx:817
void SetInputHandler(ScInputHandler *pNew)
Definition: inputwin.cxx:325
ScTabViewShell * mpViewShell
Definition: inputwin.hxx:352
void SetFuncString(const OUString &rString, bool bDoEdit=true)
Definition: inputwin.cxx:558
void SetSumAssignMode()
Definition: inputwin.cxx:627
ScInputHandler * GetInputHandler()
Definition: inputwin.hxx:331
EditView * GetEditView()
Definition: inputwin.cxx:663
vcl::Window * GetEditWindow()
Definition: inputwin.cxx:668
tools::Long mnMaxY
Definition: inputwin.hxx:353
tools::Long mnStandardItemHeight
Definition: inputwin.hxx:354
void MenuHdl(std::u16string_view command)
Definition: inputwin.cxx:1040
virtual void dispose() override
Definition: inputwin.cxx:290
ScInputHandler * pInputHdl
Definition: inputwin.hxx:351
virtual void Resize() override
Definition: inputwin.cxx:514
void PosGrabFocus()
Definition: inputwin.cxx:717
ScInputWindow(vcl::Window *pParent, const SfxBindings *pBind)
Definition: inputwin.cxx:161
void StartFormula()
Definition: inputwin.cxx:412
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: inputwin.cxx:773
VclPtr< ScPosWnd > aWndPos
Definition: inputwin.hxx:349
bool IsInputActive()
Definition: inputwin.cxx:658
void NumLinesChanged()
Update Input bar after the number of lines was changed externally.
Definition: inputwin.cxx:735
void EnableButtons(bool bEnable)
Definition: inputwin.cxx:723
void AutoSum(bool &bRangeFinder, bool &bSubTotal, OpCode eCode)
Definition: inputwin.cxx:853
void MakeDialogEditView()
Definition: inputwin.cxx:678
VclPtr< ScInputBarGroup > mxTextWindow
Definition: inputwin.hxx:350
void StateChanged(StateChangedType nType) override
Definition: inputwin.cxx:740
Point GetCursorScreenPixelPos(bool bBelowLine=false)
Definition: inputwin.cxx:673
void SetTextString(const OUString &rString)
Definition: inputwin.cxx:597
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: inputwin.cxx:841
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: inputwin.cxx:747
void TextInvalidate()
Definition: inputwin.cxx:693
void SetPosString(const OUString &rStr)
Definition: inputwin.cxx:591
virtual ~ScInputWindow() override
Definition: inputwin.cxx:285
virtual void SetSizePixel(const Size &rNewSize) override
Definition: inputwin.cxx:492
void StopEditEngine(bool bAll)
Definition: inputwin.cxx:683
void SetOkCancelMode()
Definition: inputwin.cxx:605
virtual void PixelInvalidate(const tools::Rectangle *pRectangle) override
Definition: inputwin.cxx:475
bool bIsOkCancelMode
Definition: inputwin.hxx:355
void NotifyLOKClient()
Definition: inputwin.cxx:552
bool IsPointerAtResizePos()
Definition: inputwin.cxx:768
void SwitchToTextWin()
Definition: inputwin.cxx:698
virtual void Select() override
Definition: inputwin.cxx:338
void TextGrabFocus()
Definition: inputwin.cxx:688
void SetFormulaMode(bool bSet)
Definition: inputwin.cxx:651
ScInputHandler * GetInputHdl(ScTabViewShell *pViewSh=nullptr, bool bUseRef=true)
Input-Handler.
Definition: scmod.cxx:1355
void InputChanged(const EditView *pView)
Definition: scmod.cxx:1435
bool IsEditMode()
Definition: scmod.cxx:1393
void SetInEditCommand(bool bNew)
Definition: scmod.hxx:157
SC_DLLPUBLIC void InputEnterHandler(ScEnterMode nBlockMode=ScEnterMode::NORMAL, bool bBeforeSavingInLOK=false)
Definition: scmod.cxx:1411
void InputCancelHandler()
Definition: scmod.cxx:1421
void InputSelection(const EditView *pView)
Definition: scmod.cxx:1428
std::unique_ptr< weld::ComboBox > m_xWidget
Definition: inputwin.hxx:166
void HideTip()
Definition: inputwin.cxx:2457
void * nTipVisible
Definition: inputwin.hxx:171
void ReleaseFocus_Impl()
Definition: inputwin.cxx:2758
void FillFunctions()
Definition: inputwin.cxx:2398
OUString aPosStr
Definition: inputwin.hxx:170
void SetPos(const OUString &rPosStr)
Definition: inputwin.cxx:2338
void SetFormulaMode(bool bSet)
Definition: inputwin.cxx:2323
ScPosWnd(vcl::Window *pParent)
Definition: inputwin.cxx:2274
ImplSVEvent * m_nAsyncGetFocusId
Definition: inputwin.hxx:168
void FillRangeNames()
Definition: inputwin.cxx:2353
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: inputwin.cxx:2437
virtual void dispose() override
Definition: inputwin.cxx:2307
virtual ~ScPosWnd() override
Definition: inputwin.cxx:2302
void DoEnter()
Definition: inputwin.cxx:2584
static OUString createLocalRangeName(std::u16string_view rName, std::u16string_view rTableName)
Definition: inputwin.cxx:2348
bool bFormulaMode
Definition: inputwin.hxx:172
static SC_DLLPUBLIC IsNameValidType IsNameValid(const OUString &rName, const ScDocument &rDoc)
Definition: rangenam.cxx:468
bool empty() const
Definition: rangenam.hxx:249
SC_DLLPUBLIC ScRangeData * findByUpperName(const OUString &rName)
Definition: rangenam.cxx:704
SC_DLLPUBLIC bool insert(ScRangeData *p, bool bReuseFreeIndex=true)
Insert object into set.
Definition: rangenam.cxx:802
static bool MakeRangeFromName(const OUString &rName, const ScDocument &rDoc, SCTAB nCurTab, ScRange &rRange, RutlNameScope eScope=RUTL_NAMES, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1, bool bUseDetailsPos=false)
Definition: rangeutl.cxx:233
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2170
ScRefFlags ParseAny(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
Definition: address.cxx:1733
ScRefFlags Parse(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, ScAddress::ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1700
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:690
OUString DoAutoSum(bool &rRangeFinder, bool &rSubTotal, const OpCode eCode)
Definition: tabvwshc.cxx:691
void SetFormShellAtTop(bool bSet)
Definition: tabvwsh4.cxx:1001
static ScTabViewShell * GetActiveViewShell()
Definition: tabvwsh4.cxx:1076
const ScInputHandler * GetInputHandler() const
Definition: tabvwsh.hxx:237
bool SfxKeyInput(const KeyEvent &rKEvt)
Definition: tabvwsh4.cxx:1485
void ErrorMessage(TranslateId pGlobStrId)
Definition: tabview2.cxx:1553
tools::Long GetGridHeight(ScVSplitPos eWhich)
Definition: tabview3.cxx:3039
ScViewData & GetViewData()
Definition: tabview.hxx:344
void ShowCursor()
Definition: tabview3.cxx:246
tools::Long GetLastNumExpandedLines() const
Definition: inputwin.cxx:1243
virtual void RemoveAccessibleTextData(ScAccessibleEditLineTextData &rTextData) override
Definition: inputwin.cxx:1288
std::unique_ptr< ScTextWnd > mxTextWnd
Definition: inputwin.hxx:234
virtual EditView * GetEditView() const override
Definition: inputwin.cxx:1233
const OutputDevice & GetEditViewDevice() const
Definition: inputwin.cxx:1238
virtual void StopEditEngine(bool bAll) override
Definition: inputwin.cxx:1321
virtual bool HasEditView() const override
Definition: inputwin.cxx:1273
virtual void SetFormulaMode(bool bSet) override
Definition: inputwin.cxx:1306
void SetNumLines(tools::Long nLines)
Definition: inputwin.cxx:1301
int GetPixelHeightForLines(tools::Long nLines)
Definition: inputwin.cxx:1258
virtual const OUString & GetTextString() const override
Definition: inputwin.cxx:1268
virtual void StartEditEngine() override
Definition: inputwin.cxx:1316
virtual ~ScTextWndGroup() override
Definition: inputwin.cxx:1224
std::unique_ptr< weld::ScrolledWindow > mxScrollWin
Definition: inputwin.hxx:235
virtual bool IsInputActive() override
Definition: inputwin.cxx:1278
virtual void InsertAccessibleTextData(ScAccessibleEditLineTextData &rTextData) override
Definition: inputwin.cxx:1228
virtual tools::Long GetNumLines() const override
Definition: inputwin.cxx:1253
void SetScrollPolicy()
Definition: inputwin.cxx:1293
ScTextWndGroup(ScInputBarGroup &pParent, ScTabViewShell *pViewSh)
Definition: inputwin.cxx:1191
vcl::Window & GetVclParent()
Definition: inputwin.hxx:231
virtual void MakeDialogEditView() override
Definition: inputwin.cxx:1283
Point GetCursorScreenPixelPos(bool bBelowLine)
Definition: inputwin.cxx:1202
virtual void TextGrabFocus() override
Definition: inputwin.cxx:1326
weld::ScrolledWindow & GetScrollWin()
Definition: inputwin.cxx:1263
void SetLastNumExpandedLines(tools::Long nLastExpandedLines)
Definition: inputwin.cxx:1248
vcl::Window & mrParent
Definition: inputwin.hxx:237
virtual void SetTextString(const OUString &rString) override
Definition: inputwin.cxx:1311
ScTextWndGroup & mrGroupBar
Definition: inputwin.hxx:158
virtual void GetFocus() override
Definition: inputwin.cxx:1902
virtual void Resize() override
Definition: inputwin.cxx:1406
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: inputwin.cxx:1721
AccTextDataVector maAccTextDatas
Definition: inputwin.hxx:148
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: inputwin.cxx:2189
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: inputwin.cxx:1336
bool IsInputActive() override
Definition: inputwin.cxx:2115
void UpdateAutoCorrFlag()
Definition: inputwin.cxx:1919
rtl::Reference< ScAccessibleEditObject > pAcc
Definition: inputwin.hxx:144
virtual void RemoveAccessibleTextData(ScAccessibleEditLineTextData &rTextData) override
Definition: inputwin.cxx:2253
const OutputDevice & GetEditViewDevice() const
Definition: inputwin.cxx:1377
virtual const OUString & GetTextString() const override
Definition: inputwin.cxx:2110
int GetEditEngTxtHeight() const
Definition: inputwin.cxx:1431
virtual void EditViewScrollStateChange() override
Definition: inputwin.cxx:1935
OUString aString
Definition: inputwin.hxx:146
void DoScroll()
Definition: inputwin.cxx:1465
bool mbInvalidate
Definition: inputwin.hxx:160
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: inputwin.cxx:1698
virtual void StartEditEngine() override
Definition: inputwin.cxx:1478
bool bIsRTL
Definition: inputwin.hxx:149
void ImplInitSettings()
Definition: inputwin.cxx:2175
virtual bool CanFocus() const override
Definition: inputwin.cxx:1683
ScTabViewShell * mpViewShell
Definition: inputwin.hxx:157
int GetPixelHeightForLines(tools::Long nLines)
Definition: inputwin.cxx:1382
bool bFormulaMode
Definition: inputwin.hxx:151
virtual void InsertAccessibleTextData(ScAccessibleEditLineTextData &rTextData) override
Definition: inputwin.cxx:2246
virtual bool StartDrag() override
Definition: inputwin.cxx:1875
virtual void MakeDialogEditView() override
Definition: inputwin.cxx:2120
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: inputwin.cxx:1678
virtual void StopEditEngine(bool bAll) override
Definition: inputwin.cxx:1962
void InitEditEngine()
Definition: inputwin.cxx:1558
bool bInputMode
Definition: inputwin.hxx:155
bool bIsInsertMode
Definition: inputwin.hxx:150
virtual ~ScTextWnd() override
Definition: inputwin.cxx:1671
virtual void TextGrabFocus() override
Definition: inputwin.cxx:2268
void SetScrollBarRange()
Definition: inputwin.cxx:1436
void SetNumLines(tools::Long nLines)
Definition: inputwin.cxx:1394
virtual void SetFormulaMode(bool bSet) override
Definition: inputwin.cxx:1910
virtual void StyleUpdated() override
Definition: inputwin.cxx:2262
tools::Long mnLastExpandedLines
Definition: inputwin.hxx:159
void UpdateFocus()
Definition: inputwin.cxx:1688
vcl::Font aTextFont
Definition: inputwin.hxx:147
virtual EditView * GetEditView() const override
Definition: inputwin.cxx:1368
virtual bool Command(const CommandEvent &rCEvt) override
Definition: inputwin.cxx:1738
virtual void SetTextString(const OUString &rString) override
Definition: inputwin.cxx:2024
virtual tools::Long GetNumLines() const override
Definition: inputwin.cxx:1388
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Definition: inputwin.cxx:2240
virtual bool HasEditView() const override
Definition: inputwin.cxx:1375
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: inputwin.cxx:1887
ScTextWnd(ScTextWndGroup &rParent, ScTabViewShell *pViewSh)
Definition: inputwin.cxx:1659
rtl::Reference< svt::OStringTransferable > m_xHelper
Definition: inputwin.hxx:140
SfxDispatcher & GetDispatcher()
Definition: viewdata.cxx:3140
void SetFormulaBarLines(sal_Int16 nLines)
Definition: viewdata.hxx:471
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScMarkType GetSimpleArea(SCCOL &rStartCol, SCROW &rStartRow, SCTAB &rStartTab, SCCOL &rEndCol, SCROW &rEndRow, SCTAB &rEndTab) const
Definition: viewdata.cxx:1182
ScDBFunc * GetView() const
Definition: viewdata.cxx:864
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
ScAddress GetCurPos() const
Definition: viewdata.cxx:4119
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:582
SCROW GetCurY() const
Definition: viewdata.hxx:402
SCCOL GetCurX() const
Definition: viewdata.hxx:401
sal_Int16 GetFormulaBarLines() const
Definition: viewdata.hxx:478
SfxDispatcher * GetDispatcher() const
void Invalidate(sal_uInt16 nId)
virtual SfxChildWinInfo GetInfo() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
SfxViewFrame * GetFrame() const
void ExecutePopup(const OUString &rResName, vcl::Window *pWin=nullptr, const Point *pPos=nullptr)
const css::uno::Reference< css::frame::XFrame > & GetFrameInterface() const
SfxHintId GetId() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
bool IsInModalMode() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
void SetWhich(sal_uInt16 nId)
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
SfxViewShell * GetViewShell() const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
SfxBindings & GetBindings()
SfxDispatcher * GetDispatcher()
SfxChildWindow * GetChildWindow(sal_uInt16)
SfxFrame & GetFrame() const
bool isLOKMobilePhone() const
SfxViewFrame & GetViewFrame() const
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()
bool isLOKDesktop() const
vcl::Window * GetWindow() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetWindowColor() const
const Color & GetWindowTextColor() const
const Color & GetFaceColor() const
const vcl::Font & GetAppFont() const
void SetPropLineSpace(const sal_uInt16 nProp)
void SetDropdownClickHdl(const Link< ToolBox *, void > &rLink)
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
virtual void MouseMove(const MouseEvent &rMEvt) override
virtual void StateChanged(StateChangedType nType) override
void InsertWindow(ToolBoxItemId nItemId, vcl::Window *pWindow, ToolBoxItemBits nBits=ToolBoxItemBits::NONE, ImplToolItems::size_type nPos=APPEND)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
void InsertSeparator(ImplToolItems::size_type nPos=APPEND, sal_uInt16 nPixSize=0)
Size CalcWindowSizePixel()
virtual void dispose() override
void EnableItem(ToolBoxItemId nItemId, bool bEnable=true)
virtual void Resize() override
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
void ShowItem(ToolBoxItemId nItemId, bool bVisible=true)
ToolBoxItemId GetCurItemId() const
virtual void InsertItem(const OUString &rCommand, const css::uno::Reference< css::frame::XFrame > &rFrame, ToolBoxItemBits nBits, const Size &rRequestedSize, ImplToolItems::size_type nPos=APPEND)
void HideItem(ToolBoxItemId nItemId)
void SetHelpId(ToolBoxItemId nItemId, const OUString &rHelpId)
void SetToolbarLayoutMode(ToolBoxLayoutMode eLayout)
tools::Rectangle GetItemRect(ToolBoxItemId nItemId)
virtual void Select()
void SetItemText(ToolBoxItemId nItemId, const OUString &rText)
void SetItemImage(ToolBoxItemId nItemId, const Image &rImage)
void disposeAndClear()
reference_type * get() const
static VclPtr< reference_type > Create(Arg &&... arg)
std::unique_ptr< EditEngine > m_xEditEngine
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
std::unique_ptr< EditView > m_xEditView
virtual OutputDevice & EditViewOutputDevice() const override
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
virtual void GetFocus() override
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr tools::Long GetHeight() const
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
const Point & GetPos() const
tools::Long GetHeight() const
void SetFontSize(const Size &)
void SetTransparent(bool bTransparent)
void SetFillColor(const Color &)
void SetColor(const Color &)
void SetWeight(FontWeight)
const Size & GetFontSize() const
Point OutputToScreenPixel(const Point &rPos) const
vcl::Window * GetParent() const
tools::Long GetOutOffXPixel() const
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier *pNotifier, bool bParent=false)
Point LogicToPixel(const Point &rLogicPt) const
virtual void SetSizePixel(const Size &rNewSize)
void GrabFocus()
void ReleaseLOKNotifier()
void Enable(bool bEnable=true, bool bChild=true)
tools::Long GetOutOffYPixel() const
void SetAccessibleName(const OUString &rName)
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
void SetPointerPosPixel(const Point &rPos)
void ReleaseMouse()
bool IsRTLEnabled() const
virtual Size GetSizePixel() const
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Point GetPointerPosPixel()
virtual void SetPointer(PointerStyle)
void SetPaintTransparent(bool bTransparent)
void CaptureMouse()
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
bool IsEnabled() const
void SetBackground()
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
virtual OutputDevice & get_ref_device()=0
virtual void set_cursor(PointerStyle ePointerStyle)=0
virtual void vadjustment_configure(int value, int lower, int upper, int step_increment, int page_increment, int page_size)=0
virtual int vadjustment_get_value() const=0
virtual void set_margin_bottom(int nMargin)=0
virtual void set_margin_top(int nMargin)=0
virtual void set_size_request(int nWidth, int nHeight)=0
virtual void set_margin_end(int nMargin)=0
virtual void set_margin_start(int nMargin)=0
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
CommandEventId
float u
const size_t EE_APPEND
EEControlBits
EVControlBits
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CJK(EE_CHAR_START+17)
constexpr TypedWhichId< SvxAdjustItem > EE_PARA_JUST(EE_PARA_START+16)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CTL(EE_CHAR_START+16)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT(EE_CHAR_START+4)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CTL(EE_CHAR_START+22)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC(EE_CHAR_START+7)
constexpr TypedWhichId< SvxLineSpacingItem > EE_PARA_SBL(EE_PARA_START+15)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
constexpr TypedWhichId< SvxWeightItem > EE_CHAR_WEIGHT_CJK(EE_CHAR_START+21)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE_CJK(EE_CHAR_START+15)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CJK(EE_CHAR_START+23)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO_CTL(EE_CHAR_START+18)
constexpr TypedWhichId< SvxPostureItem > EE_CHAR_ITALIC_CTL(EE_CHAR_START+24)
constexpr TypedWhichId< SvxLanguageItem > EE_CHAR_LANGUAGE(EE_CHAR_START+14)
constexpr TypedWhichId< SvxScriptSpaceItem > EE_PARA_ASIANCJKSPACING(EE_PARA_START+4)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
constexpr TypedWhichId< SvxFontItem > EE_CHAR_FONTINFO(EE_CHAR_START+1)
SfxEventHintId
DocumentType eType
WEIGHT_NORMAL
CellType
Definition: global.hxx:272
@ CELLTYPE_EDIT
Definition: global.hxx:277
@ CELLTYPE_STRING
Definition: global.hxx:275
@ CELLTYPE_FORMULA
Definition: global.hxx:276
@ CELLTYPE_VALUE
Definition: global.hxx:274
@ SC_INPUT_TABLE
Definition: global.hxx:363
@ SC_INPUT_TOP
Definition: global.hxx:364
QuickHelpFlags
constexpr OUStringLiteral HID_INSWIN_FUNC
Definition: helpids.h:29
constexpr OUStringLiteral HID_INSWIN_SUMME
Definition: helpids.h:28
constexpr OUStringLiteral HID_INSWIN_INPUT
Definition: helpids.h:30
constexpr OUStringLiteral HID_INSWIN_CANCEL
Definition: helpids.h:26
constexpr OUStringLiteral HID_SC_INPUTWIN
Definition: helpids.h:42
constexpr OUStringLiteral HID_INSWIN_CALC
Definition: helpids.h:25
constexpr OUStringLiteral HID_INSWIN_OK
Definition: helpids.h:27
constexpr OUStringLiteral HID_INSWIN_POS
Definition: helpids.h:24
SfxHintId
const tools::Long INPUTLINE_INSET_MARGIN
Definition: inputwin.cxx:79
static VclPtr< ScInputBarGroup > lcl_chooseRuntimeImpl(vcl::Window *pParent, const SfxBindings *pBind)
Definition: inputwin.cxx:147
const tools::Long TOOLBOX_WINDOW_HEIGHT
Definition: inputwin.cxx:83
static void lcl_ModifyRTLDefaults(SfxItemSet &rSet)
Definition: inputwin.cxx:1533
static ScNameInputType lcl_GetInputType(const OUString &rText)
Definition: inputwin.cxx:2466
constexpr tools::Long gnBorderWidth
Definition: inputwin.cxx:1188
static void lcl_ExtendEditFontAttribs(SfxItemSet &rSet)
Definition: inputwin.cxx:1499
constexpr tools::Long gnBorderHeight
Definition: inputwin.cxx:1189
static sal_Int32 findFirstNonMatchingChar(const OUString &rStr1, const OUString &rStr2)
Definition: inputwin.cxx:2005
const tools::Long INPUTWIN_MULTILINES
Definition: inputwin.cxx:82
const int RESIZE_HOTSPOT_HEIGHT
Definition: inputwin.cxx:85
const tools::Long POSITION_COMBOBOX_WIDTH
Definition: inputwin.cxx:84
const tools::Long THESIZE
Definition: inputwin.cxx:78
const tools::Long LEFT_OFFSET
Definition: inputwin.cxx:80
static void lcl_ModifyRTLVisArea(EditView *pEditView)
Definition: inputwin.cxx:1548
IMPL_LINK_NOARG(ScInputWindow, DropdownClickHdl, ToolBox *, void)
Definition: inputwin.cxx:1096
IMPL_LINK(ScPosWnd, KeyInputHdl, const KeyEvent &, rKEvt, bool)
Definition: inputwin.cxx:2703
sal_Int64 n
constexpr sal_uInt16 KEY_RETURN
constexpr sal_uInt16 KEY_ESCAPE
SvtScriptType
#define LINE_SPACE_DEFAULT_HEIGHT
class SAL_NO_VTABLE XPropertySet
bool isActive()
bool isdigitAsciiString(std::string_view rString)
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
void SetPointFont(OutputDevice &rDevice, const vcl::Font &rFont)
weld::Window * GetPopupParent(vcl::Window &rOutWin, tools::Rectangle &rRect)
sal_Int32 w
sal_Int16 nId
OpCode
ocStDev
ocProduct
ocAverage
ocCount2
ocVarP
ocStDevP
ocMin
ocVar
ocSum
ocCount
ocMax
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
RutlNameScope
Definition: rangeutl.hxx:36
@ RUTL_DBASE
Definition: rangeutl.hxx:41
@ RUTL_NAMES_GLOBAL
Definition: rangeutl.hxx:40
@ RUTL_NAMES_LOCAL
Definition: rangeutl.hxx:39
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
#define SC_MOD()
Definition: scmod.hxx:247
static SfxItemSet & rSet
SFX_IMPL_CHILDWINDOW_WITHID(SvxSearchDialogWrapper, SID_SEARCH_DLG)
#define DND_ACTION_COPY
#define DND_ACTION_NONE
sal_uInt16 sal_Unicode
sal_Int16 SCTAB
Definition: types.hxx:22
@ SC_MARK_SIMPLE
Definition: viewdata.hxx:65
@ SC_SPLIT_TOP
Definition: viewdata.hxx:46
@ SC_SPLIT_BOTTOM
Definition: viewdata.hxx:46
StateChangedType
sal_Int64 WinBits
WinBits const WB_BORDER
WinBits const WB_CLIPCHILDREN
WinBits const WB_NOSHADOW