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