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