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