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