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