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