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