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