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