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