LibreOffice Module sw (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 <sal/config.h>
21 #include <sal/log.hxx>
22 
23 #include <comphelper/string.hxx>
24 #include <o3tl/safeint.hxx>
25 #include <officecfg/Office/Common.hxx>
26 #include <tools/gen.hxx>
27 #include <sfx2/objface.hxx>
28 #include <sfx2/viewfrm.hxx>
29 #include <sfx2/dispatch.hxx>
30 #include <svx/ruler.hxx>
31 #include <svl/stritem.hxx>
32 #include <vcl/event.hxx>
33 #include <vcl/weldutils.hxx>
34 
35 #include <swtypes.hxx>
36 #include <cmdid.h>
37 #include <swmodule.hxx>
38 #include <wrtsh.hxx>
39 #include <view.hxx>
40 #include <inputwin.hxx>
41 #include <fldbas.hxx>
42 #include <fldmgr.hxx>
43 #include <frmfmt.hxx>
44 #include <cellatr.hxx>
45 #include <edtwin.hxx>
46 #include <helpids.h>
47 #include <strings.hrc>
48 #include <bitmaps.hlst>
49 
50 // Only for the UpdateRange: Delete the box in which the stacked cursor is positioned.
51 #include <pam.hxx>
52 
53 #include <swundo.hxx>
54 
56 
57 constexpr ToolBoxItemId ED_POS(2);
58 constexpr ToolBoxItemId ED_FORMULA(3);
59 constexpr ToolBoxItemId FN_FORMULA_CALC(FN_FORMAT + 156); /* select formula */
60 constexpr ToolBoxItemId FN_FORMULA_CANCEL(FN_FORMAT + 157); /* don't apply formula */
61 constexpr ToolBoxItemId FN_FORMULA_APPLY(FN_FORMAT + 158); /* apply formula */
62 
64 
65 IMPL_LINK(PosEdit, KeyInputHdl, const KeyEvent&, rKEvt, bool)
66 {
67  return ChildKeyInput(rKEvt);
68 }
69 
71  : ToolBox(pParent, WB_3DLOOK|WB_BORDER)
72  , mxPos(VclPtr<PosEdit>::Create(this))
73  , mxEdit(VclPtr<InputEdit>::Create(this))
74  , pWrtShell(nullptr)
75  , pView(nullptr)
76  , m_bDoesUndo(true)
77  , m_bResetUndo(false)
78  , m_bCallUndo(false)
79 {
80  bFirst = true;
81  bIsTable = bDelSel = false;
82 
83  InsertItem(FN_FORMULA_CALC, Image(StockImage::Yes, RID_BMP_FORMULA_CALC),
84  SwResId(STR_FORMULA_CALC));
85  InsertItem(FN_FORMULA_CANCEL, Image(StockImage::Yes, RID_BMP_FORMULA_CANCEL),
86  SwResId(STR_FORMULA_CANCEL));
87  InsertItem(FN_FORMULA_APPLY, Image(StockImage::Yes, RID_BMP_FORMULA_APPLY),
88  SwResId(STR_FORMULA_APPLY));
89 
93 
94  SwView *pDispatcherView = dynamic_cast<SwView*>(pDispatcher ? pDispatcher->GetFrame()->GetViewShell() : nullptr);
95  SwView* pActiveView = ::GetActiveView();
96  if (pDispatcherView == pActiveView)
97  pView = pActiveView;
98  pWrtShell = pView ? pView->GetWrtShellPtr() : nullptr;
99 
100  InsertWindow(ED_POS, mxPos.get(), ToolBoxItemBits::NONE, 0);
101  SetItemText(ED_POS, SwResId(STR_ACCESS_FORMULA_TYPE));
102  mxPos->set_accessible_name(SwResId(STR_ACCESS_FORMULA_TYPE));
103  SetAccessibleName(SwResId(STR_ACCESS_FORMULA_TOOLBAR));
104  InsertSeparator ( 1 );
105  InsertSeparator ();
107  SetItemText(ED_FORMULA, SwResId(STR_ACCESS_FORMULA_TEXT));
108  mxEdit->set_accessible_name(SwResId(STR_ACCESS_FORMULA_TEXT));
110 
111  SetItemBits( FN_FORMULA_CALC, GetItemBits( FN_FORMULA_CALC ) | ToolBoxItemBits::DROPDOWNONLY );
112  SetDropdownClickHdl( LINK( this, SwInputWindow, DropdownClickHdl ));
113 
114  Size aSizeTbx = CalcWindowSizePixel();
115  Size aEditSize = mxEdit->GetSizePixel();
117  tools::Long nMaxHeight = std::max(aEditSize.Height(), aItemRect.GetHeight());
118  if( nMaxHeight+2 > aSizeTbx.Height() )
119  aSizeTbx.setHeight( nMaxHeight+2 );
120  Size aSize = GetSizePixel();
121  aSize.setHeight( aSizeTbx.Height() );
122  SetSizePixel( aSize );
123 
124  // align edit and item vcentered
125  Size aPosSize = mxPos->GetSizePixel();
126  aPosSize.setHeight( nMaxHeight );
127  aEditSize.setHeight( nMaxHeight );
128  Point aPosPos = mxPos->GetPosPixel();
129  Point aEditPos = mxEdit->GetPosPixel();
130  aPosPos.setY( (aSize.Height() - nMaxHeight)/2 + 1 );
131  aEditPos.setY( (aSize.Height() - nMaxHeight)/2 + 1 );
132  mxPos->SetPosSizePixel( aPosPos, aPosSize );
133  mxEdit->SetPosSizePixel( aEditPos, aEditSize );
134 }
135 
137 {
138  disposeOnce();
139 }
140 
142 {
143  // wake rulers
144  if(pView)
145  {
148  }
149  pMgr.reset();
150  if(pWrtShell)
152 
154 
158 }
159 
161 {
162  if (!m_bResetUndo)
163  return;
164 
165  if (pWrtShell)
166  {
167  DelBoxContent();
169  if (m_bCallUndo)
170  {
171  pWrtShell->Undo();
172  }
173  }
174  m_bResetUndo = false; // #i117122# once is enough :)
175 }
176 
178 {
179  ToolBox::Resize();
180 
181  tools::Long nWidth = GetSizePixel().Width();
182  tools::Long nLeft = mxEdit->GetPosPixel().X();
183  Size aEditSize = mxEdit->GetSizePixel();
184 
185  aEditSize.setWidth( std::max( static_cast<tools::Long>(nWidth - nLeft - 5), tools::Long(0) ) );
186  mxEdit->SetSizePixel( aEditSize );
187 }
188 
190 {
191  bIsTable = false;
192  // stop rulers
193  if (pView)
194  {
195  pView->GetHRuler().SetActive( false );
196  pView->GetVRuler().SetActive( false );
197 
198  OSL_ENSURE(pWrtShell, "no WrtShell!");
199  // Cursor in table
201 
202  if( bFirst )
204  SelTableCellsNotify) );
205  if( bIsTable )
206  {
207  const OUString& rPos = pWrtShell->GetBoxNms();
208  sal_Int32 nPos = 0;
209  short nSrch = -1;
210  while( (nPos = rPos.indexOf( ':',nPos + 1 ) ) != -1 )
211  nSrch = static_cast<short>(nPos);
212  mxPos->set_text( rPos.copy( ++nSrch ) );
214  }
215  else
216  mxPos->set_text(SwResId(STR_TBL_FORMULA));
217 
218  // Edit current field
219  OSL_ENSURE(pMgr == nullptr, "FieldManager not deleted");
220  pMgr.reset(new SwFieldMgr);
221 
222  // Form should always begin with "=" , so set here
223  OUString sEdit('=');
224  if( pMgr->GetCurField() && SwFieldTypesEnum::Formel == pMgr->GetCurTypeId() )
225  {
226  sEdit += pMgr->GetCurFieldPar2();
227  }
228  else if( bFirst && bIsTable )
229  {
230  m_bResetUndo = true;
231  SAL_WARN_IF(
233  "sw", "/org.openoffice.Office.Common/Undo/Steps <= 0");
234 
236  if( !m_bDoesUndo )
237  {
238  pWrtShell->DoUndo();
239  }
240 
241  if( !pWrtShell->SwCursorShell::HasSelection() )
242  {
244  pWrtShell->SetMark();
246  }
247  if( pWrtShell->SwCursorShell::HasSelection() )
248  {
250  pWrtShell->Delete();
252  {
253  m_bCallUndo = true;
254  }
255  }
256  pWrtShell->DoUndo(false);
257 
258  SfxItemSet aSet( pWrtShell->GetAttrPool(), svl::Items<RES_BOXATR_FORMULA, RES_BOXATR_FORMULA> );
259  if( pWrtShell->GetTableBoxFormulaAttrs( aSet ))
260  sEdit += aSet.Get( RES_BOXATR_FORMULA ).GetFormula();
261  }
262 
263  if( bFirst )
264  {
265  // Set WrtShell flags correctly
266  pWrtShell->SttSelect();
267  pWrtShell->EndSelect();
268  }
269 
270  bFirst = false;
271 
272  mxEdit->connect_changed( LINK( this, SwInputWindow, ModifyHdl ));
273 
274  mxEdit->set_text( sEdit );
275  sOldFormula = sEdit;
276 
277  // For input cut the UserInterface
278 
279  pView->GetEditWin().LockKeyInput(true);
280  pView->GetViewFrame()->GetDispatcher()->Lock(true);
281  pWrtShell->Push();
282  }
283 
284  ToolBox::Show();
285 
286  // grab focus after ToolBox is shown so focus isn't potentially lost elsewhere
287  if (pView)
288  {
289  int nPos = mxEdit->get_text().getLength();
290  mxEdit->select_region(nPos, nPos);
291  mxEdit->GrabFocus();
292  }
293 }
294 
295 void SwInputWindow::MenuHdl(std::string_view command)
296 {
297  if (!command.empty())
298  mxEdit->replace_selection(OUString::fromUtf8(command) + " ");
299 }
300 
301 IMPL_LINK_NOARG(SwInputWindow, DropdownClickHdl, ToolBox *, void)
302 {
303  ToolBoxItemId nCurID = GetCurItemId();
304  EndSelection(); // reset back CurItemId !
305  if (nCurID == FN_FORMULA_CALC)
306  {
307  std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/inputwinmenu.ui"));
308  std::unique_ptr<weld::Menu> xPopMenu(xBuilder->weld_menu("menu"));
309  tools::Rectangle aRect(GetItemRect(FN_FORMULA_CALC));
310  weld::Window* pParent = weld::GetPopupParent(*this, aRect);
311  MenuHdl(xPopMenu->popup_at_rect(pParent, aRect));
312  }
313 }
314 
316 {
317  ToolBoxItemId nCurID = GetCurItemId();
318  EndSelection(); // reset back CurItemId !
319  if ( nCurID == FN_FORMULA_CANCEL )
320  {
321  CancelFormula();
322  }
323  else if (nCurID == FN_FORMULA_APPLY)
324  {
325  ApplyFormula();
326  }
327 }
328 
330 {
331  // in case it was created while loading the document, the active view
332  // wasn't initialised at that time, so ShowWin() didn't initialise anything
333  // either - nothing to do
334  if (!pView)
335  {
336  // presumably there must be an active view now since the event arrived
337  SwView *const pActiveView = ::GetActiveView();
338  // this just makes the input window go away, so that the next time it works
339  pActiveView->GetViewFrame()->GetDispatcher()->Execute(FN_EDIT_FORMULA, SfxCallMode::ASYNCHRON);
340  return;
341  }
342 
343  pView->GetViewFrame()->GetDispatcher()->Lock(false);
344  pView->GetEditWin().LockKeyInput(false);
347 
348  // Form should always begin with "=", so remove it here again
349  OUString sEdit(comphelper::string::strip(mxEdit->get_text(), ' '));
350  if( !sEdit.isEmpty() && '=' == sEdit[0] )
351  sEdit = sEdit.copy( 1 );
352  SfxStringItem aParam(FN_EDIT_FORMULA, sEdit);
353 
356  const SfxPoolItem* aArgs[2];
357  aArgs[0] = &aParam;
358  aArgs[1] = nullptr;
359  pView->GetViewFrame()->GetBindings().Execute( FN_EDIT_FORMULA, aArgs, SfxCallMode::ASYNCHRON );
360 }
361 
363 {
364  // in case it was created while loading the document, the active view
365  // wasn't initialised at that time, so ShowWin() didn't initialise anything
366  // either - nothing to do
367  if (!pView)
368  {
369  // presumably there must be an active view now since the event arrived
370  SwView *const pActiveView = ::GetActiveView();
371  // this just makes the input window go away, so that the next time it works
372  pActiveView->GetViewFrame()->GetDispatcher()->Execute(FN_EDIT_FORMULA, SfxCallMode::ASYNCHRON);
373  return;
374  }
375 
376  pView->GetViewFrame()->GetDispatcher()->Lock( false );
377  pView->GetEditWin().LockKeyInput(false);
380 
381  if( bDelSel )
383 
385 
387 
388  pView->GetViewFrame()->GetDispatcher()->Execute( FN_EDIT_FORMULA, SfxCallMode::ASYNCHRON);
389 }
390 
391 const sal_Unicode CH_LRE = 0x202a;
392 const sal_Unicode CH_PDF = 0x202c;
393 
394 IMPL_LINK( SwInputWindow, SelTableCellsNotify, SwWrtShell&, rCaller, void )
395 {
396  if(bIsTable)
397  {
398  SwFrameFormat* pTableFormat = rCaller.GetTableFormat();
399  OUString sBoxNms( rCaller.GetBoxNms() );
400  OUString sTableNm;
401  if( pTableFormat && aCurrentTableName != pTableFormat->GetName() )
402  sTableNm = pTableFormat->GetName();
403 
404  mxEdit->UpdateRange( sBoxNms, sTableNm );
405 
406  OUString sNew = OUStringChar(CH_LRE) + mxEdit->get_text()
407  + OUStringChar(CH_PDF);
408 
409  if( sNew != sOldFormula )
410  {
411  // The WrtShell is in the table selection,
412  // then cancel the table selection otherwise, the cursor is
413  // positioned "in the forest" and the live update does not work!
414  pWrtShell->StartAllAction();
415 
416  SwPaM aPam( *pWrtShell->GetStackCursor()->GetPoint() );
418  aPam.SetMark();
419  aPam.Move( fnMoveForward, GoInSection );
420 
421  IDocumentContentOperations& rIDCO = pWrtShell->getIDocumentContentOperations();
422  rIDCO.DeleteRange( aPam );
423  rIDCO.InsertString( aPam, sNew );
424  pWrtShell->EndAllAction();
425  sOldFormula = sNew;
426  }
427  }
428  else
429  mxEdit->GrabFocus();
430 }
431 
432 void SwInputWindow::SetFormula( const OUString& rFormula )
433 {
434  OUString sEdit('=');
435  if( !rFormula.isEmpty() )
436  {
437  if( '=' == rFormula[0] )
438  sEdit = rFormula;
439  else
440  sEdit += rFormula;
441  }
442  mxEdit->set_text( sEdit );
443  mxEdit->select_region(sEdit.getLength(), sEdit.getLength());
444  bDelSel = true;
445 }
446 
448 {
449  if (bIsTable && m_bResetUndo)
450  {
451  pWrtShell->StartAllAction();
452  DelBoxContent();
453  OUString sNew = OUStringChar(CH_LRE) + mxEdit->get_text()
454  + OUStringChar(CH_PDF);
455  pWrtShell->SwEditShell::Insert2( sNew );
456  pWrtShell->EndAllAction();
457  sOldFormula = sNew;
458  }
459 }
460 
462 {
463  if( bIsTable )
464  {
466  pWrtShell->ClearMark();
468  pWrtShell->Push();
470  pWrtShell->SetMark();
472  pWrtShell->SwEditShell::Delete();
474  }
475 }
476 
477 IMPL_LINK(InputEdit, KeyInputHdl, const KeyEvent&, rEvent, bool)
478 {
479  bool bHandled = false;
480  const vcl::KeyCode aCode = rEvent.GetKeyCode();
481  if (aCode == KEY_RETURN || aCode == KEY_F2)
482  {
483  bHandled = ActivateHdl(*m_xWidget);
484  }
485  else if(aCode == KEY_ESCAPE )
486  {
487  static_cast<SwInputWindow*>(GetParent())->CancelFormula();
488  bHandled = true;
489  }
490  return bHandled || ChildKeyInput(rEvent);
491 }
492 
493 IMPL_LINK_NOARG(InputEdit, ActivateHdl, weld::Entry&, bool)
494 {
495  static_cast<SwInputWindow*>(GetParent())->ApplyFormula();
496  return true;
497 }
498 
499 void InputEdit::UpdateRange(std::u16string_view rBoxes,
500  const OUString& rName )
501 {
502  if( rBoxes.empty() )
503  {
504  GrabFocus();
505  return;
506  }
507  const sal_Unicode cOpen = '<', cClose = '>',
508  cOpenBracket = '(';
509  OUString aPrefix = rName;
510  if(!rName.isEmpty())
511  aPrefix += ".";
512  OUString aBoxes = aPrefix + rBoxes;
513 
514  int nSelStartPos, nSelEndPos;
515  m_xWidget->get_selection_bounds(nSelStartPos, nSelEndPos);
516 
517  Selection aSelection(nSelStartPos, nSelEndPos);
518  sal_uInt16 nSel = o3tl::narrowing<sal_uInt16>(aSelection.Len());
519  // OS: The following expression ensures that in the overwrite mode,
520  // the selected closing parenthesis will be not deleted.
521  if( nSel && ( nSel > 1 ||
522  m_xWidget->get_text()[ o3tl::narrowing<sal_uInt16>(aSelection.Min()) ] != cClose ))
523  m_xWidget->cut_clipboard();
524  else
525  aSelection.Max() = aSelection.Min();
526  OUString aActText(m_xWidget->get_text());
527  const sal_uInt16 nLen = aActText.getLength();
528  if( !nLen )
529  {
530  OUString aStr = OUStringChar(cOpen) + aBoxes + OUStringChar(cClose);
531  m_xWidget->set_text(aStr);
532  sal_Int32 nPos = aStr.indexOf( cClose );
533  OSL_ENSURE(nPos != -1, "delimiter not found");
534  ++nPos;
535  m_xWidget->select_region(nPos, nPos);
536  }
537  else
538  {
539  bool bFound = false;
540  sal_Unicode cCh;
541  sal_uInt16 nPos, nEndPos = 0, nStartPos = o3tl::narrowing<sal_uInt16>(aSelection.Min());
542  if( nStartPos-- )
543  {
544  do {
545  if( cOpen == (cCh = aActText[ nStartPos ] ) ||
546  cOpenBracket == cCh )
547  {
548  bFound = cCh == cOpen;
549  break;
550  }
551  } while( nStartPos-- > 0 );
552  }
553  if( bFound )
554  {
555  bFound = false;
556  nEndPos = nStartPos;
557  while( nEndPos < nLen )
558  {
559  if( cClose == aActText[ nEndPos ] )
560  {
561  bFound = true;
562  break;
563  }
564  ++nEndPos;
565  }
566  // Only if the current position lies in the range or right behind.
567  if( bFound && ( nStartPos >= o3tl::make_unsigned(aSelection.Max()) ||
568  o3tl::narrowing<sal_uInt16>(aSelection.Max()) > nEndPos + 1 ))
569  bFound = false;
570  }
571  if( bFound )
572  {
573  nPos = ++nStartPos + 1; // We want behind
574  aActText = aActText.replaceAt( nStartPos, nEndPos - nStartPos, aBoxes );
575  nPos = nPos + aBoxes.getLength();
576  }
577  else
578  {
579  OUString aTmp = OUStringChar(cOpen) + aBoxes + OUStringChar(cClose);
580  nPos = o3tl::narrowing<sal_uInt16>(aSelection.Min());
581  aActText = aActText.replaceAt( nPos, 0, aTmp );
582  nPos = nPos + aTmp.getLength();
583  }
584  if( m_xWidget->get_text() != aActText )
585  {
586  m_xWidget->set_text(aActText);
587  m_xWidget->select_region(nPos, nPos);
588  }
589  }
590  GrabFocus();
591 
592 }
593 
595  sal_uInt16 nId,
596  SfxBindings const * pBindings,
597  SfxChildWinInfo* ) :
598  SfxChildWindow( _pParent, nId )
599 {
600  pDispatch = pBindings->GetDispatcher();
602  static_cast<SwInputWindow*>(GetWindow())->ShowWin();
603  SetAlignment(SfxChildAlignment::LOWESTTOP);
604 }
605 
607 {
608  if(pDispatch)
609  pDispatch->Lock(false);
610 }
611 
613 {
615  return aInfo;
616 }
617 
618 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetHelpId(ToolBoxItemId nItemId, const OString &rHelpId)
tools::Long Max() const
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
virtual Point GetPosPixel() const
void replace_selection(const OUString &rText)
Definition: inputwin.hxx:78
SfxViewFrame * GetViewFrame() const
SFX_IMPL_POS_CHILDWINDOW_WITHID(SfxInfoBarContainerChild, SID_INFOBAR, SFX_OBJECTBAR_OBJECT)
constexpr ToolBoxItemId ED_FORMULA(3)
virtual void Resize() override
Definition: inputwin.cxx:177
bool m_bCallUndo
Definition: inputwin.hxx:163
void EndSelTableCells()
Definition: wrtsh.hxx:642
void SetActive(bool bOn=true)
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
virtual void dispose() override
Definition: inputwin.cxx:141
SwWrtShell * pWrtShell
Definition: inputwin.hxx:154
void setWidth(tools::Long nWidth)
ToolBoxItemBits GetItemBits(ToolBoxItemId nItemId) const
SwView * GetActiveView()
Definition: swmodul1.cxx:116
void ApplyFormula()
Definition: inputwin.cxx:329
#define HID_TBX_FORMULA_CANCEL
Definition: helpids.h:155
void DelBoxContent()
Definition: inputwin.cxx:461
OString strip(std::string_view rIn, char c)
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
Definition: legacyitem.cxx:32
SfxDispatcher * GetDispatcher()
ToolBoxItemId GetCurItemId() const
long Long
void disposeAndClear()
SwView * pView
Definition: inputwin.hxx:155
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1752
SwInputWindow(vcl::Window *pParent, SfxDispatcher const *pDispatcher)
Definition: inputwin.cxx:70
constexpr ToolBoxItemId FN_FORMULA_CALC(FN_FORMAT+156)
void SetAccessibleName(const OUString &rName)
virtual Size GetSizePixel() const
virtual void SetSizePixel(const Size &rNewSize)
virtual void dispose() override
void CancelFormula()
Definition: inputwin.cxx:362
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
virtual void DeleteRange(SwPaM &)=0
Delete a range SwFlyFrameFormat.
void SetWindow(const VclPtr< vcl::Window > &p)
std::unique_ptr< weld::Entry > m_xWidget
Definition: inputwin.hxx:39
void EnterStdMode()
Definition: select.cxx:551
SwEditWin & GetEditWin()
Definition: view.hxx:416
void DoUndo(bool bOn=true)
Undo.
Definition: edws.cxx:200
#define FN_EDIT_FORMULA
Definition: cmdid.h:77
void EndAllAction()
Definition: edws.cxx:97
tools::Rectangle GetItemRect(ToolBoxItemId nItemId)
vcl::Window * GetWindow() const
constexpr ToolBoxItemId FN_FORMULA_APPLY(FN_FORMAT+158)
VclPtr< PosEdit > mxPos
Definition: inputwin.hxx:151
virtual void Resize() override
SvxRuler & GetVRuler()
Definition: view.hxx:495
virtual void Click() override
Definition: inputwin.cxx:315
Used by the UI to modify the document model.
Definition: wrtsh.hxx:93
bool GoInSection(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:955
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
constexpr tools::Long Width() const
Size CalcWindowSizePixel()
sal_uInt16 sal_Unicode
void MenuHdl(std::string_view command)
Definition: inputwin.cxx:295
void SetDropdownClickHdl(const Link< ToolBox *, void > &rLink)
void SetItemText(ToolBoxItemId nItemId, const OUString &rText)
void CleanupUglyHackWithUndo()
Definition: inputwin.cxx:160
const OUString & GetName() const
Definition: format.hxx:115
void SetItemBits(ToolBoxItemId nItemId, ToolBoxItemBits nBits)
void set_text(const OUString &rText)
Definition: inputwin.hxx:131
constexpr sal_uInt16 KEY_F2
SwInputChild(vcl::Window *, sal_uInt16 nId, SfxBindings const *, SfxChildWinInfo *)
Definition: inputwin.cxx:594
virtual void InsertItem(const OUString &rCommand, const css::uno::Reference< css::frame::XFrame > &rFrame, ToolBoxItemBits nBits, const Size &rRequestedSize, ImplToolItems::size_type nPos=APPEND)
bool Execute(sal_uInt16 nSlot, const SfxPoolItem **pArgs=nullptr, SfxCallMode nCall=SfxCallMode::SLOT)
constexpr ToolBoxItemId ED_POS(2)
void LockKeyInput(bool bSet)
Definition: edtwin.hxx:242
virtual ~SwInputChild() override
Definition: inputwin.cxx:606
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
void EndSelect()
Definition: select.cxx:425
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:504
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:612
void set_text(const OUString &rText)
Definition: inputwin.hxx:63
virtual bool InsertString(const SwPaM &rRg, const OUString &, const SwInsertFlags nInsertMode=SwInsertFlags::EMPTYEXPAND)=0
Insert string into existing text node at position rRg.Point().
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:889
const sal_Unicode CH_PDF
Definition: inputwin.cxx:392
Style of a layout element.
Definition: frmfmt.hxx:59
void EndSelection()
OUString aCurrentTableName
Definition: inputwin.hxx:156
void set_accessible_name(const OUString &rName)
Definition: inputwin.hxx:73
#define HID_TBX_FORMULA_CALC
Definition: helpids.h:154
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2240
weld::Window * GetPopupParent(vcl::Window &rOutWin, tools::Rectangle &rRect)
SfxBindings & GetBindings()
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
void ShowWin()
Definition: inputwin.cxx:189
std::unique_ptr< SwFieldMgr > pMgr
Definition: inputwin.hxx:153
SfxDispatcher * pDispatch
Definition: inputwin.hxx:194
void SetMark()
Definition: crsrsh.hxx:875
bool GoCurrSection(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:1058
virtual ~SwInputWindow() override
Definition: inputwin.cxx:136
const sal_Unicode CH_LRE
Definition: inputwin.cxx:391
void Lock(bool bLock)
Text operation/manipulation interface.
void SttSelect()
Definition: select.cxx:385
OUString sOldFormula
Definition: inputwin.hxx:156
void GrabFocus()
#define HID_TBX_FORMULA_APPLY
Definition: helpids.h:156
SfxViewShell * GetViewShell() const
OUString GetBoxNms() const
Definition: trvltbl.cxx:746
SwFrameFormat * GetTableFormat()
Definition: edws.cxx:183
constexpr sal_uInt16 KEY_RETURN
tools::Long Len() const
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
bool MoveSection(SwWhichSection, SwMoveFnCollection const &)
Definition: crsrsh.cxx:720
bool Delete()
Delete content of all ranges.
Definition: eddel.cxx:125
#define HID_EDIT_FORMULA
Definition: helpids.h:67
void SetAlignment(SfxChildAlignment eAlign)
WinBits const WB_3DLOOK
void InsertWindow(ToolBoxItemId nItemId, vcl::Window *pWindow, ToolBoxItemBits nBits=ToolBoxItemBits::NONE, ImplToolItems::size_type nPos=APPEND)
Size GetSizePixel() const override
void connect_changed(const Link< weld::Entry &, void > &rLink)
Definition: inputwin.hxx:96
SwWrtShell * GetWrtShellPtr() const
Definition: view.hxx:414
constexpr ToolBoxItemId FN_FORMULA_CANCEL(FN_FORMAT+157)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
#define SAL_WARN_IF(condition, area, stream)
constexpr tools::Long Height() const
WinBits const WB_BORDER
constexpr sal_uInt16 KEY_ESCAPE
SwMoveFnCollection const & fnSectionEnd
Definition: paminit.cxx:50
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
tools::Long Min() const
IMPL_LINK_NOARG(SwInputWindow, DropdownClickHdl, ToolBox *, void)
Definition: inputwin.cxx:301
bool m_bDoesUndo
Definition: inputwin.hxx:161
void UpdateRange(std::u16string_view rSel, const OUString &rTableName)
Definition: inputwin.cxx:499
SfxViewFrame * GetFrame() const
constexpr TypedWhichId< SwTableBoxFormula > RES_BOXATR_FORMULA(151)
void InsertSeparator(ImplToolItems::size_type nPos=APPEND, sal_uInt16 nPixSize=0)
bool GetTableBoxFormulaAttrs(SfxItemSet &rSet) const
Definition: edtab.cxx:305
void select_region(int nStartPos, int nEndPos)
Definition: inputwin.hxx:91
void ClearMark()
Definition: crsrsh.cxx:939
SvxRuler & GetHRuler()
Definition: view.hxx:494
SwMoveFnCollection const & fnSectionStart
Definition: paminit.cxx:49
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
IMPL_LINK(PosEdit, KeyInputHdl, const KeyEvent &, rKEvt, bool)
Definition: inputwin.cxx:65
void setHeight(tools::Long nHeight)
SfxDispatcher * GetDispatcher() const
OUString get_text() const
Definition: inputwin.hxx:68
reference_type * get() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
void set_accessible_name(const OUString &rName)
Definition: inputwin.hxx:136
std::unique_ptr< weld::Image > m_xWidget
bool DoesUndo() const
Definition: edws.cxx:203
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
aStr
void Undo(sal_uInt16 const nCount=1)
Definition: edundo.cxx:99
virtual SfxChildWinInfo GetInfo() const
Definition: view.hxx:144
sal_uInt16 nPos
bool m_bResetUndo
Definition: inputwin.hxx:162
VclPtr< InputEdit > mxEdit
Definition: inputwin.hxx:152
void SetFormula(const OUString &rFormula)
Definition: inputwin.cxx:432
void SelTableCells(const Link< SwWrtShell &, void > &rLink)
Definition: wrtsh.hxx:636
constexpr tools::Long GetHeight() const
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)