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