LibreOffice Module sw (master)  1
wrtsh1.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 <com/sun/star/beans/XPropertySet.hpp>
21 #include <com/sun/star/container/XChild.hpp>
22 #include <com/sun/star/embed/EmbedMisc.hpp>
23 #include <com/sun/star/embed/EmbedStates.hpp>
24 #include <com/sun/star/embed/EmbedVerbs.hpp>
25 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
26 #include <com/sun/star/chart2/XChartDocument.hpp>
27 #include <com/sun/star/util/XModifiable.hpp>
28 
29 #include <hintids.hxx>
30 #include <sot/exchange.hxx>
31 #include <svx/hdft.hxx>
32 #include <svx/svdview.hxx>
33 #include <svl/itemiter.hxx>
34 #include <tools/bigint.hxx>
35 #include <svtools/insdlg.hxx>
36 #include <sfx2/ipclient.hxx>
38 #include <editeng/svxacorr.hxx>
39 #include <editeng/ulspitem.hxx>
40 #include <vcl/graph.hxx>
41 #include <unotools/charclass.hxx>
43 #include <svx/svxdlg.hxx>
44 #include <svx/extrusionbar.hxx>
45 #include <svx/fontworkbar.hxx>
46 #include <dialoghelp.hxx>
47 #include <frmfmt.hxx>
48 #include <fmtftn.hxx>
49 #include <fmthdft.hxx>
50 #include <fmtpdsc.hxx>
51 #include <txtfrm.hxx>
52 #include <wdocsh.hxx>
53 #include <swmodule.hxx>
54 #include <wrtsh.hxx>
55 #include <view.hxx>
56 #include <cmdid.h>
57 #include <pagedesc.hxx>
58 #include <frmmgr.hxx>
59 #include <swundo.hxx>
60 #include <swcli.hxx>
61 #include <poolfmt.hxx>
62 #include <edtwin.hxx>
63 #include <fmtcol.hxx>
64 #include <swtable.hxx>
65 #include <viscrs.hxx>
66 #include <swdtflvr.hxx>
67 #include <doc.hxx>
69 #include <SwCapObjType.hxx>
70 #include <SwStyleNameMapper.hxx>
71 #include <sfx2/request.hxx>
72 #include <paratr.hxx>
73 #include <ndtxt.hxx>
74 #include <editeng/acorrcfg.hxx>
75 #include <IMark.hxx>
76 #include <sfx2/bindings.hxx>
77 #include <flyfrm.hxx>
78 
79 // -> #111827#
80 #include <SwRewriter.hxx>
81 #include <strings.hrc>
82 // <- #111827#
83 
85 #include <sfx2/viewfrm.hxx>
86 #include <vcl/uitest/logger.hxx>
88 
89 #include <PostItMgr.hxx>
90 #include <FrameControlsManager.hxx>
91 #include <fldmgr.hxx>
92 #include <docufld.hxx>
94 #include <fmtfld.hxx>
95 
96 #include <sfx2/msgpool.hxx>
97 #include <sfx2/msg.hxx>
98 #include <svtools/embedhlp.hxx>
99 #include <svx/postattr.hxx>
100 #include <comphelper/lok.hxx>
101 #include <memory>
102 
103 #include <frmtool.hxx>
104 #include <viewopt.hxx>
105 
106 using namespace sw::mark;
107 using namespace com::sun::star;
108 namespace {
109 
110 void collectUIInformation(const OUString& rAction, const OUString& aParameters)
111 {
112  EventDescription aDescription;
113  aDescription.aAction = rAction;
114  aDescription.aParameters = {{"parameters", aParameters}};
115  aDescription.aID = "writer_edit";
116  aDescription.aKeyWord = "SwEditWinUIObject";
117  aDescription.aParent = "MainWindow";
118  UITestLogger::getInstance().logEvent(aDescription);
119 }
120 
121 }
122 
123 #define BITFLD_INI_LIST \
124  m_bClearMark = \
125  m_bIns = true;\
126  m_bAddMode = \
127  m_bBlockMode = \
128  m_bExtMode = \
129  m_bInSelect = \
130  m_bLayoutMode = \
131  m_bSelWrd = \
132  m_bSelLn = \
133  m_bRetainSelection = false; \
134  m_bIsInClickToEdit = false;
135 
137 {
139  if( pACorr && !pACorr->IsAutoCorrFlag( ACFlags::CapitalStartSentence | ACFlags::CapitalStartWord |
140  ACFlags::AddNonBrkSpace | ACFlags::ChgOrdinalNumber | ACFlags::TransliterateRTL |
141  ACFlags::ChgToEnEmDash | ACFlags::SetINetAttr | ACFlags::Autocorrect ))
142  pACorr = nullptr;
143  return pACorr;
144 }
145 
146 void SwWrtShell::NoEdit(bool bHideCursor)
147 {
148  if(bHideCursor)
149  HideCursor();
150 }
151 
153 {
154  if (CanInsert())
155  {
156  ShowCursor();
157  }
158 }
159 
161 {
162  SwMvContext aMvContext(this);
163  if(IsEndPara() && !IsSttPara())
164  return true;
165 
166  return IsEndWord();
167 }
168 
169 // Insert string
170 void SwWrtShell::InsertByWord( const OUString & rStr)
171 {
172  if( rStr.isEmpty() )
173  return;
174 
175  bool bDelim = GetAppCharClass().isLetterNumeric( rStr, 0 );
176  sal_Int32 nPos = 0, nStt = 0;
177  for( ; nPos < rStr.getLength(); nPos++ )
178  {
179  bool bTmpDelim = GetAppCharClass().isLetterNumeric( rStr, nPos );
180  if( bTmpDelim != bDelim )
181  {
182  Insert( rStr.copy( nStt, nPos - nStt ));
183  nStt = nPos;
184  }
185  }
186  if( nStt != nPos )
187  Insert( rStr.copy( nStt, nPos - nStt ));
188 }
189 
190 void SwWrtShell::Insert( const OUString &rStr )
191 {
192  ResetCursorStack();
193  if( !CanInsert() )
194  return;
195 
196  bool bStarted = false;
197  bool bHasSel = HasSelection(),
198  bCallIns = m_bIns /*|| bHasSel*/;
199  bool bDeleted = false;
200 
202  RES_CHRATR_RSID + 1, RES_CHRATR_END - 1,
203  RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT> CharItems;
204  SfxItemSet aCharAttrSet(GetAttrPool(), CharItems{});
205 
206  if( bHasSel || ( !m_bIns && SelectHiddenRange() ) )
207  {
208  // Only here parenthesizing, because the normal
209  // insert is already in parentheses at Editshell.
210  StartAllAction();
211 
212  SwRewriter aRewriter;
213 
214  aRewriter.AddRule(UndoArg1, GetCursorDescr());
215  aRewriter.AddRule(UndoArg2, SwResId(STR_YIELDS));
216  {
217  OUString aTmpStr = SwResId(STR_START_QUOTE) +
218  rStr + SwResId(STR_END_QUOTE);
219 
220  aRewriter.AddRule(UndoArg3, aTmpStr);
221  }
222 
223  // tdf#79717 Save character formatting of the start of the selection
224  const SwPosition *pStart = GetCursor()->Start();
225  SwPaM aPaM(pStart->nNode.GetNode(), pStart->nContent.GetIndex(),
226  pStart->nNode.GetNode(), pStart->nContent.GetIndex() + 1);
227  GetPaMAttr(&aPaM, aCharAttrSet);
228 
229  StartUndo(SwUndoId::REPLACE, &aRewriter);
230  bStarted = true;
231  Push();
232  bDeleted = DelRight();
233  Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore selection (if tracking changes)
234  NormalizePam(false); // tdf#127635 put point at the end of deletion
235  ClearMark();
236  }
237 
238  bCallIns ?
239  SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr );
240 
241  if( bDeleted )
242  {
243  // tdf#79717 Restore formatting of the deleted selection
244  SwPosition* pEnd = GetCursor()->Start();
245  SwPaM aPaM(pEnd->nNode.GetNode(), pEnd->nContent.GetIndex() - rStr.getLength(),
246  pEnd->nNode.GetNode(), pEnd->nContent.GetIndex());
247 
248  std::set<sal_uInt16> aAttribs;
249  for (sal_uInt16 i = RES_CHRATR_BEGIN; i < RES_CHRATR_END; ++i)
250  if (i != sal_uInt16(RES_CHRATR_RSID))
251  aAttribs.insert(aAttribs.end(), i);
252  aAttribs.insert(aAttribs.end(), RES_TXTATR_CHARFMT);
253  ResetAttr(aAttribs, &aPaM);
254 
255  SetAttrSet(aCharAttrSet, SetAttrMode::DEFAULT, &aPaM);
256  }
257 
258  if( bStarted )
259  {
260  EndUndo();
261  EndAllAction();
262  }
263 }
264 
265 // Maximum height limit not possible, because the maximum height
266 // of the current frame can not be obtained.
267 
268 void SwWrtShell::Insert( const OUString &rPath, const OUString &rFilter,
269  const Graphic &rGrf, SwFlyFrameAttrMgr *pFrameMgr,
270  RndStdIds nAnchorType )
271 {
272  ResetCursorStack();
273  if ( !CanInsert() )
274  return;
275 
276  StartAllAction();
277 
278  SwRewriter aRewriter;
279  aRewriter.AddRule(UndoArg1, SwResId(STR_GRAPHIC));
280 
281  StartUndo(SwUndoId::INSERT, &aRewriter);
282 
283  if ( HasSelection() )
284  DelRight();
285  // Inserted graphics in its own paragraph,
286  // if at the end of a non-empty paragraph.
287  //For i120928,avoid to split node
288 
289  EnterSelFrameMode();
290 
291  bool bSetGrfSize = true;
292  bool bOwnMgr = false;
293 
294  if ( !pFrameMgr )
295  {
296  bOwnMgr = true;
297  pFrameMgr = new SwFlyFrameAttrMgr( true, this, Frmmgr_Type::GRF, nullptr );
298 
299  // CAUTION
300  // GetAttrSet makes an adjustment
301  // While pasting is a SwFrameSize present
302  // because of the DEF-Framesize
303  // These must be removed explicitly for the optimal size.
304  pFrameMgr->DelAttr(RES_FRM_SIZE);
305 
306  if (nAnchorType != RndStdIds::FLY_AT_PARA)
307  // Something other than at-para was requested.
308  pFrameMgr->SetAnchor(nAnchorType);
309  }
310  else
311  {
312  Size aSz( pFrameMgr->GetSize() );
313  if ( !aSz.Width() || !aSz.Height() )
314  {
315  aSz.setWidth(567);
316  aSz.setHeight( 567);
317  pFrameMgr->SetSize( aSz );
318  }
319  else if ( aSz.Width() != DFLT_WIDTH && aSz.Height() != DFLT_HEIGHT )
320  bSetGrfSize = false;
321 
323  }
324 
325  // Insert the graphic
326  SwFEShell::Insert(rPath, rFilter, &rGrf, &pFrameMgr->GetAttrSet());
327  if ( bOwnMgr )
328  pFrameMgr->UpdateAttrMgr();
329 
330  if( bSetGrfSize )
331  {
332  Size aGrfSize, aBound = GetGraphicDefaultSize();
333  GetGrfSize( aGrfSize );
334 
335  // Add the margin attributes to GrfSize,
336  // because these counts at the margin additionally
337  aGrfSize.AdjustWidth(pFrameMgr->CalcWidthBorder() );
338  aGrfSize.AdjustHeight(pFrameMgr->CalcHeightBorder() );
339 
340  const BigInt aTempWidth( aGrfSize.Width() );
341  const BigInt aTempHeight( aGrfSize.Height());
342 
343  // Fit width if necessary, scale down the height proportional thereafter.
344  if( aGrfSize.Width() > aBound.Width() )
345  {
346  aGrfSize.setWidth( aBound.Width() );
347  aGrfSize.setHeight( BigInt(aBound.Width()) * aTempHeight / aTempWidth );
348  }
349  // Fit height if necessary, scale down the width proportional thereafter.
350  if( aGrfSize.Height() > aBound.Height() )
351  {
352  aGrfSize.setHeight( aBound.Height() );
353  aGrfSize.setWidth( BigInt(aBound.Height()) * aTempWidth / aTempHeight );
354  }
355  pFrameMgr->SetSize( aGrfSize );
356  pFrameMgr->UpdateFlyFrame();
357  }
358  if ( bOwnMgr )
359  delete pFrameMgr;
360 
361  EndUndo();
362  EndAllAction();
363 }
364 
365 // Insert an OLE-Object into the CORE.
366 // if no object is transferred, then one will be created.
367 
369  sal_uInt16 nSlotId )
370 {
371  ResetCursorStack();
372  if( !CanInsert() )
373  return;
374 
375  if( !xRef.is() )
376  {
377  // temporary storage
379  uno::Reference < embed::XStorage > xStor = comphelper::OStorageHelper::GetTemporaryStorage();
380  bool bDoVerb = true;
381  if ( pName )
382  {
384  OUString aName;
385  // TODO/LATER: get aspect?
386  xObj.Assign( aCnt.CreateEmbeddedObject( pName->GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT );
387  }
388  else
389  {
390  SvObjectServerList aServerList;
391  switch (nSlotId)
392  {
393  case SID_INSERT_OBJECT:
394  {
395  aServerList.FillInsertObjects();
396  aServerList.Remove( SwDocShell::Factory().GetClassId() );
397  [[fallthrough]];
398  }
399 
400  // TODO/LATER: recording! Convert properties to items
401  case SID_INSERT_FLOATINGFRAME:
402  {
403  SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool();
404  const SfxSlot* pSlot = pSlotPool->GetSlot(nSlotId);
405  OString aCmd = OStringLiteral(".uno:") + pSlot->GetUnoName();
407  ScopedVclPtr<SfxAbstractInsertObjectDialog> pDlg(pFact->CreateInsertObjectDialog(GetFrameWeld(mxDoc->GetDocShell()),
408  OUString::fromUtf8( aCmd ), xStor, &aServerList));
409  if (pDlg)
410  {
411  pDlg->Execute();
412  bDoVerb = pDlg->IsCreateNew();
413  OUString aIconMediaType;
414  uno::Reference< io::XInputStream > xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType );
415  xObj.Assign( pDlg->GetObject(),
416  xIconMetaFile.is() ? embed::Aspects::MSOLE_ICON : embed::Aspects::MSOLE_CONTENT );
417  if ( xIconMetaFile.is() )
418  xObj.SetGraphicStream( xIconMetaFile, aIconMediaType );
419  }
420 
421  break;
422  }
423 
424  default:
425  break;
426  }
427  }
428 
429  if ( xObj.is() )
430  {
431  if( InsertOleObject( xObj ) && bDoVerb )
432  {
433  SfxInPlaceClient* pClient = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
434  if ( !pClient )
435  {
436  pClient = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
437  SetCheckForOLEInCaption( true );
438  }
439 
440  if ( xObj.GetViewAspect() == embed::Aspects::MSOLE_ICON )
441  {
442  SwRect aArea = GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() );
443  aArea.Pos() += GetAnyCurRect( CurRectType::FlyEmbedded, nullptr, xObj.GetObject() ).Pos();
444  MapMode aMapMode( MapUnit::MapTwip );
445  Size aSize = xObj.GetSize( &aMapMode );
446  aArea.Width( aSize.Width() );
447  aArea.Height( aSize.Height() );
448  RequestObjectResize( aArea, xObj.GetObject() );
449  }
450  else
451  CalcAndSetScale( xObj );
452 
453  //#50270# We don't need to handle error, this is handled by the
454  //DoVerb in the SfxViewShell
455  pClient->DoVerb(embed::EmbedVerbs::MS_OLEVERB_SHOW);
456 
457  // TODO/LATER: set document name - should be done in Client
458  }
459  }
460  }
461  else
462  {
463  if( HasSelection() )
464  DelRight();
465  InsertOleObject( xRef );
466  }
467 }
468 
469 // Insert object into the Core.
470 // From ClipBoard or Insert
471 
473 {
474  //tdf#125100 Ensure that ole object is initially shown as pictogram
475  comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = mxDoc->GetDocShell()->getEmbeddedObjectContainer();
476  bool bSaveUserAllowsLinkUpdate = rEmbeddedObjectContainer.getUserAllowsLinkUpdate();
477  rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
478 
479  ResetCursorStack();
480  StartAllAction();
481 
482  StartUndo(SwUndoId::INSERT);
483 
484  //Some differences between StarMath and any other objects:
485  //1. Selections should be deleted. For StarMath the Text should be
486  // passed to the Object
487  //2. If the cursor is at the end of a non empty paragraph a paragraph
488  // break should be inserted. StarMath objects are character bound and
489  // no break should be inserted.
490  //3. If an selection is passed to a StarMath object, this object should
491  // not be activated. false should be returned then.
492  bool bStarMath = true;
493  bool bActivate = true;
494 
495  // set parent to get correct VisArea(in case of object needing parent printer)
496  uno::Reference < container::XChild > xChild( xRef.GetObject(), uno::UNO_QUERY );
497  if ( xChild.is() )
498  xChild->setParent( mxDoc->GetDocShell()->GetModel() );
499 
500  SvGlobalName aCLSID( xRef->getClassID() );
501  bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 );
502  if( IsSelection() )
503  {
504  if( bStarMath )
505  {
506  OUString aMathData;
507  GetSelectedText( aMathData, ParaBreakType::ToOnlyCR );
508 
509  if( !aMathData.isEmpty() && svt::EmbeddedObjectRef::TryRunningState( xRef.GetObject() ) )
510  {
511  uno::Reference < beans::XPropertySet > xSet( xRef->getComponent(), uno::UNO_QUERY );
512  if ( xSet.is() )
513  {
514  try
515  {
516  xSet->setPropertyValue("Formula", uno::makeAny( aMathData ) );
517  bActivate = false;
518  }
519  catch (const uno::Exception&)
520  {
521  }
522  }
523  }
524  }
525  DelRight();
526  }
527 
528  if ( !bStarMath )
529  SwFEShell::SplitNode( false, false );
530 
531  EnterSelFrameMode();
532 
533  const SvGlobalName* pName = nullptr;
534  SvGlobalName aObjClsId;
535  if (xRef.is())
536  {
537  aObjClsId = SvGlobalName(xRef.GetObject()->getClassID());
538  pName = &aObjClsId;
539  }
540  SwFlyFrameAttrMgr aFrameMgr( true, this, Frmmgr_Type::OLE, pName );
542 
543  SwRect aBound;
544  CalcBoundRect( aBound, aFrameMgr.GetAnchor() );
545 
546  //The Size should be suggested by the OLE server
547  MapMode aMapMode( MapUnit::MapTwip );
548  Size aSz = xRef.GetSize( &aMapMode );
549 
550  //Object size can be limited
551  if ( aSz.Width() > aBound.Width() )
552  {
553  //Always limit proportional.
554  aSz.setHeight( aSz.Height() * aBound.Width() / aSz.Width() );
555  aSz.setWidth( aBound.Width() );
556  }
557  aFrameMgr.SetSize( aSz );
558  SwFlyFrameFormat *pFormat = SwFEShell::InsertObject( xRef, &aFrameMgr.GetAttrSet() );
559 
560  // --> #i972#
561  if ( bStarMath && mxDoc->getIDocumentSettingAccess().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT ) )
562  AlignFormulaToBaseline( xRef.GetObject() );
563 
564  if (pFlyFrameFormat)
565  *pFlyFrameFormat = pFormat;
566 
567  if ( SotExchange::IsChart( aCLSID ) )
568  {
569  uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = xRef.GetObject();
570  if ( xEmbeddedObj.is() )
571  {
572  bool bDisableDataTableDialog = false;
574  uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY );
575  if ( xProps.is() &&
576  ( xProps->getPropertyValue("DisableDataTableDialog") >>= bDisableDataTableDialog ) &&
577  bDisableDataTableDialog )
578  {
579  xProps->setPropertyValue("DisableDataTableDialog",
580  uno::makeAny( false ) );
581  xProps->setPropertyValue("DisableComplexChartTypes",
582  uno::makeAny( false ) );
583  uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY );
584  if ( xModifiable.is() )
585  {
586  xModifiable->setModified( true );
587  }
588  }
589  }
590  }
591 
592  EndAllAction();
593  GetView().AutoCaption(OLE_CAP, &aCLSID);
594 
595  SwRewriter aRewriter;
596 
597  if ( bStarMath )
598  aRewriter.AddRule(UndoArg1, SwResId(STR_MATH_FORMULA));
599  else if ( SotExchange::IsChart( aCLSID ) )
600  aRewriter.AddRule(UndoArg1, SwResId(STR_CHART));
601  else
602  aRewriter.AddRule(UndoArg1, SwResId(STR_OLE));
603 
604  EndUndo(SwUndoId::INSERT, &aRewriter);
605 
606  rEmbeddedObjectContainer.setUserAllowsLinkUpdate(bSaveUserAllowsLinkUpdate);
607 
608  return bActivate;
609 }
610 
611 // The current selected OLE object will be loaded with the
612 // verb into the server.
613 
615 {
616  if ( GetCntType() != CNT_OLE ||
617  GetView().GetViewFrame()->GetFrame().IsInPlace() )
618  return;
619 
620  svt::EmbeddedObjectRef& xRef = GetOLEObject();
621  OSL_ENSURE( xRef.is(), "OLE not found" );
622 
623  // LOK: we don't want to handle any other embedded objects than
624  // charts, there are too many problems with eg. embedded spreadsheets
625  // (like it creates a separate view for the calc sheet)
626  if (comphelper::LibreOfficeKit::isActive() && !SotExchange::IsChart(xRef->getClassID()))
627  return;
628 
629  SfxInPlaceClient* pCli = GetView().FindIPClient( xRef.GetObject(), &GetView().GetEditWin() );
630  if ( !pCli )
631  pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xRef );
632 
633  static_cast<SwOleClient*>(pCli)->SetInDoVerb( true );
634 
635  CalcAndSetScale( xRef );
636  pCli->DoVerb( nVerb );
637 
638  static_cast<SwOleClient*>(pCli)->SetInDoVerb( false );
639  CalcAndSetScale( xRef );
640 }
641 
642 void SwWrtShell::MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset )
643 {
644  try
645  {
646  sal_Int32 nState = xObj->getCurrentState();
647  if ( nState == css::embed::EmbedStates::INPLACE_ACTIVE
648  || nState == css::embed::EmbedStates::UI_ACTIVE )
649  {
650  SfxInPlaceClient* pCli =
651  GetView().FindIPClient( xObj.GetObject(), &(GetView().GetEditWin()) );
652  if ( pCli )
653  {
654  tools::Rectangle aArea = pCli->GetObjArea();
655  aArea += rOffset;
656  pCli->SetObjArea( aArea );
657  }
658  }
659  }
660  catch (const uno::Exception&)
661  {
662  }
663 }
664 
666  const SwRect *pFlyPrtRect,
667  const SwRect *pFlyFrameRect,
668  const bool bNoTextFramePrtAreaChanged )
669 {
670  // Setting the scale of the client. This arises from the difference
671  // between the VisArea of the object and the ObjArea.
672  OSL_ENSURE( xObj.is(), "ObjectRef not valid" );
673 
674  sal_Int64 nAspect = xObj.GetViewAspect();
675  if ( nAspect == embed::Aspects::MSOLE_ICON )
676  return; // the replacement image is completely controlled by container in this case
677 
678  sal_Int64 nMisc = 0;
679  bool bLinkingChart = false;
680 
681  try
682  {
683  nMisc = xObj->getStatus( nAspect );
684 
685  // This can surely only be a non-active object, if desired they
686  // get the new size set as VisArea (StarChart).
687  if( embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc )
688  {
689  // TODO/MBA: testing
690  SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
691  : GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() ));
692  if( !aRect.IsEmpty() )
693  {
694  // TODO/LEAN: getMapUnit can switch object to running state
695  // xObj.TryRunningState();
696 
697  MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
698 
699  // TODO/LATER: needs complete VisArea?!
700  Size aSize( OutputDevice::LogicToLogic(aRect.SVRect(), MapMode(MapUnit::MapTwip), MapMode(aUnit)).GetSize() );
701  awt::Size aSz;
702  aSz.Width = aSize.Width();
703  aSz.Height = aSize.Height();
704 
705  // Action 'setVisualAreaSize' doesn't have to turn on the
706  // modified state of the document, either.
707  bool bModified = false;
708  uno::Reference<util::XModifiable> xModifiable(xObj->getComponent(), uno::UNO_QUERY);
709  if (xModifiable.is())
710  bModified = xModifiable->isModified();
711  xObj->setVisualAreaSize( nAspect, aSz );
712  xModifiable.set(xObj->getComponent(), uno::UNO_QUERY);
713  if (xModifiable.is() && xModifiable->isModified() && !bModified)
714  xModifiable->setModified(bModified);
715 
716  // #i48419# - action 'UpdateReplacement' doesn't
717  // have to change the modified state of the document.
718  // This is only a workaround for the defect, that this action
719  // modifies a document after load, because unnecessarily the
720  // replacement graphic is updated, in spite of the fact that
721  // nothing has been changed.
722  // If the replacement graphic changes by this action, the document
723  // will be already modified via other mechanisms.
724  {
725  bool bResetEnableSetModified(false);
726  if ( GetDoc()->GetDocShell()->IsEnableSetModified() )
727  {
728  GetDoc()->GetDocShell()->EnableSetModified( false );
729  bResetEnableSetModified = true;
730  }
731 
732  //#i79576# don't destroy chart replacement images on load
733  //#i79578# don't request a new replacement image for charts to often
734  //a chart sends a modified call to the framework if it was changed
735  //thus the replacement update is already handled elsewhere
736  if ( !SotExchange::IsChart( xObj->getClassID() ) )
737  xObj.UpdateReplacement();
738 
739  if ( bResetEnableSetModified )
740  {
741  GetDoc()->GetDocShell()->EnableSetModified();
742  }
743  }
744  }
745 
746  // TODO/LATER: this is only a workaround,
747  uno::Reference< chart2::XChartDocument > xChartDocument( xObj->getComponent(), uno::UNO_QUERY );
748  bLinkingChart = ( xChartDocument.is() && !xChartDocument->hasInternalDataProvider() );
749  }
750  }
751  catch (const uno::Exception&)
752  {
753  // TODO/LATER: handle the error
754  return;
755  }
756 
757  SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
758  if ( !pCli )
759  {
760  if ( (embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY & nMisc)
761  || bLinkingChart
762  // --> OD #i117189# - refine condition for non-resizable objects
763  // non-resizable objects need to be set the size back by this method
764  || ( bNoTextFramePrtAreaChanged && nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
765  {
766  pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
767  }
768  else
769  return;
770  }
771 
772  // TODO/LEAN: getMapUnit can switch object to running state
773  // xObj.TryRunningState();
774 
775  awt::Size aSize;
776  try
777  {
778  aSize = xObj->getVisualAreaSize( nAspect );
779  }
780  catch (const embed::NoVisualAreaSizeException&)
781  {
782  OSL_FAIL("Can't get visual area size!" );
783  // the scaling will not be done
784  }
785  catch (const uno::Exception&)
786  {
787  // TODO/LATER: handle the error
788  OSL_FAIL("Can't get visual area size!" );
789  return;
790  }
791 
792  Size _aVisArea( aSize.Width, aSize.Height );
793 
794  Fraction aScaleWidth( 1, 1 );
795  Fraction aScaleHeight( 1, 1 );
796 
797  bool bUseObjectSize = false;
798 
799  // As long as there comes no reasonable size from the object,
800  // nothing can be scaled.
801  if( _aVisArea.Width() && _aVisArea.Height() )
802  {
803  const MapMode aTmp( MapUnit::MapTwip );
804  MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
805  _aVisArea = OutputDevice::LogicToLogic(_aVisArea, MapMode(aUnit), aTmp);
806  Size aObjArea;
807  if ( pFlyPrtRect )
808  aObjArea = pFlyPrtRect->SSize();
809  else
810  aObjArea = GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() ).SSize();
811 
812  // differ the aObjArea and _aVisArea by 1 Pixel then set new VisArea
813  tools::Long nX, nY;
814  SwSelPaintRects::Get1PixelInLogic( *this, &nX, &nY );
815  if( !( _aVisArea.Width() - nX <= aObjArea.Width() &&
816  _aVisArea.Width() + nX >= aObjArea.Width() &&
817  _aVisArea.Height()- nY <= aObjArea.Height()&&
818  _aVisArea.Height()+ nY >= aObjArea.Height() ))
819  {
820  if ( nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE )
821  {
822  // the object must not be scaled,
823  // the size stored in object must be used for restoring
824  bUseObjectSize = true;
825  }
826  else
827  {
828  aScaleWidth = Fraction( aObjArea.Width(), _aVisArea.Width() );
829  aScaleHeight = Fraction( aObjArea.Height(), _aVisArea.Height());
830  }
831  }
832  }
833 
834  // Now is the favorable time to set the ObjArea.
835  // The Scaling must be considered.
836  SwRect aArea;
837  if ( pFlyPrtRect )
838  {
839  aArea = *pFlyPrtRect;
840  aArea += pFlyFrameRect->Pos();
841  }
842  else
843  {
844  aArea = GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() );
845  aArea.Pos() += GetAnyCurRect( CurRectType::FlyEmbedded, nullptr, xObj.GetObject() ).Pos();
846  }
847 
848  if ( bUseObjectSize )
849  {
850  // --> this moves non-resizable object so that when adding borders the baseline remains the same
851  const SwFlyFrameFormat *pFlyFrameFormat = dynamic_cast< const SwFlyFrameFormat * >( GetFlyFrameFormat() );
852  OSL_ENSURE( pFlyFrameFormat, "Could not find fly frame." );
853  if ( pFlyFrameFormat )
854  {
855  const Point &rPoint = pFlyFrameFormat->GetLastFlyFramePrtRectPos();
856  SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
857  : GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() ));
858  aArea += rPoint - aRect.Pos(); // adjust area by diff of printing area position in order to keep baseline alignment correct.
859  }
860  aArea.Width ( _aVisArea.Width() );
861  aArea.Height( _aVisArea.Height() );
862  RequestObjectResize( aArea, xObj.GetObject() );
863  }
864  else
865  {
866  aArea.Width ( tools::Long( aArea.Width() / pCli->GetScaleWidth() ) );
867  aArea.Height( tools::Long( aArea.Height() / pCli->GetScaleHeight() ) );
868  }
869 
870  pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );
871 }
872 
874  const SwRect &rFrame )
875 {
876  SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin());
877  if ( !pCli )
878  new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
879  CalcAndSetScale( xObj, &rPrt, &rFrame );
880 }
881 
882 // Insert hard page break;
883 // Selections will be overwritten
884 void SwWrtShell::InsertPageBreak(const OUString *pPageDesc, const ::std::optional<sal_uInt16>& oPgNum )
885 {
886  ResetCursorStack();
887  if( CanInsert() )
888  {
889  SwActContext aActContext(this);
891 
892  if ( !IsCursorInTable() )
893  {
894  if(HasSelection())
895  DelRight();
897  // delete the numbered attribute of the last line if the last line is empty
898  GetDoc()->ClearLineNumAttrs( *GetCursor()->GetPoint() );
899  }
900 
901  const SwPageDesc *pDesc = pPageDesc
902  ? FindPageDescByName( *pPageDesc, true ) : nullptr;
903  if( pDesc )
904  {
905  SwFormatPageDesc aDesc( pDesc );
906  aDesc.SetNumOffset( oPgNum );
907  SetAttrItem( aDesc );
908  }
909  else
910  SetAttrItem( SvxFormatBreakItem(SvxBreak::PageBefore, RES_BREAK) );
912  }
913  collectUIInformation("BREAK_PAGE", "parameter");
914 }
915 
916 // Insert hard page break;
917 // Selections will be overwritten
918 
920 {
921  ResetCursorStack();
922  if( CanInsert() )
923  {
924  if(HasSelection())
925  DelRight();
926 
927  const sal_Unicode cIns = 0x0A;
928  SvxAutoCorrect* pACorr = lcl_IsAutoCorr();
929  if( pACorr )
930  AutoCorrect( *pACorr, cIns );
931  else
932  SwWrtShell::Insert( OUString( cIns ) );
933  }
934 }
935 
936 // Insert hard column break;
937 // Selections will be overwritten
938 
940 {
941  SwActContext aActContext(this);
942  ResetCursorStack();
943  if( !CanInsert() )
944  return;
945 
947 
948  if ( !IsCursorInTable() )
949  {
950  if(HasSelection())
951  DelRight();
952  SwFEShell::SplitNode( false, false );
953  }
954  SetAttrItem(SvxFormatBreakItem(SvxBreak::ColumnBefore, RES_BREAK));
955 
957 }
958 
959 // Insert footnote
960 // rStr - optional footnote mark
961 
962 void SwWrtShell::InsertFootnote(const OUString &rStr, bool bEndNote, bool bEdit )
963 {
964  ResetCursorStack();
965  if( !CanInsert() )
966  return;
967 
968  if(HasSelection())
969  {
970  //collapse cursor to the end
971  if(!IsCursorPtAtEnd())
972  SwapPam();
973  ClearMark();
974  }
975  SwPosition aPos = *GetCursor()->GetPoint();
976  SwFormatFootnote aFootNote( bEndNote );
977  if(!rStr.isEmpty())
978  aFootNote.SetNumStr( rStr );
979 
980  SetAttrItem(aFootNote);
981 
982  if( bEdit )
983  {
984  // For editing the footnote text.
985  Left(CRSR_SKIP_CHARS, false, 1, false );
986  GotoFootnoteText();
987  }
988  m_aNavigationMgr.addEntry(aPos);
989 }
990 
991 // SplitNode; also, because
992 // - of deleting selected content;
993 // - of reset of the Cursorstack if necessary.
994 
995 void SwWrtShell::SplitNode( bool bAutoFormat )
996 {
997  ResetCursorStack();
998  if( !CanInsert() )
999  return;
1000 
1001  SwActContext aActContext(this);
1002 
1003  m_rView.GetEditWin().FlushInBuffer();
1004  bool bHasSel = HasSelection();
1005  if( bHasSel )
1006  {
1007  StartUndo( SwUndoId::INSERT );
1008  DelRight();
1009  }
1010 
1011  SwFEShell::SplitNode( bAutoFormat );
1012  if( bHasSel )
1014 }
1015 
1016 // Turn on numbering
1017 // Parameter: Optional specification of a name for the named list;
1018 // this indicates a position if it is possible to convert them
1019 // into a number and less than nMaxRules.
1020 
1021 // To test the CharFormats at the numbering
1022 // external void SetNumChrFormat( SwWrtShell*, SwNumRules& );
1023 
1024 // -> #i40041#
1025 // Preconditions (as far as OD has figured out):
1026 // - <SwEditShell::HasNumber()> is false, if <bNum> is true
1027 // - <SwEditShell::HasBullet()> is false, if <bNum> is false
1028 // Behavior of method is determined by the current situation at the current
1029 // cursor position in the document.
1031 {
1032  // determine numbering rule found at current cursor position in the document.
1033  const SwNumRule* pCurRule = GetNumRuleAtCurrCursorPos();
1034 
1035  StartUndo(SwUndoId::NUMORNONUM);
1036 
1037  const SwNumRule * pNumRule = pCurRule;
1038 
1039  // - activate outline rule respectively turning on outline rule for
1040  // current text node. But, only for turning on a numbering (<bNum> == true).
1041  // - overwrite found numbering rule at current cursor position, if
1042  // no numbering rule can be retrieved from the paragraph style.
1043  bool bContinueFoundNumRule( false );
1044  bool bActivateOutlineRule( false );
1045  int nActivateOutlineLvl( MAXLEVEL ); // only relevant, if <bActivateOutlineRule> == true
1047  if ( pColl )
1048  {
1049  // retrieve numbering rule at paragraph
1050  // style, which is found at current cursor position in the document.
1051  SwNumRule* pCollRule = mxDoc->FindNumRulePtr(pColl->GetNumRule().GetValue());
1052  // #125993# - The outline numbering rule isn't allowed
1053  // to be derived from a parent paragraph style to a derived one.
1054  // Thus check, if the found outline numbering rule is directly
1055  // set at the paragraph style <pColl>. If not, set <pCollRule> to NULL
1056  if ( pCollRule && pCollRule == GetDoc()->GetOutlineNumRule() )
1057  {
1058  const SwNumRule* pDirectCollRule =
1059  mxDoc->FindNumRulePtr(pColl->GetNumRule( false ).GetValue());
1060  if ( !pDirectCollRule )
1061  {
1062  pCollRule = nullptr;
1063  }
1064  }
1065 
1066  if ( !pCollRule )
1067  {
1068  pNumRule = pCollRule;
1069  }
1070  // no activation or continuation of outline numbering in Writer/Web document
1071  else if ( bNum &&
1072  !dynamic_cast<SwWebDocShell*>(GetDoc()->GetDocShell()) &&
1073  pCollRule == GetDoc()->GetOutlineNumRule() )
1074  {
1075  if ( pNumRule == pCollRule )
1076  {
1077  // check, if text node at current cursor positioned is counted.
1078  // If not, let it been counted. Then it has to be checked,
1079  // of the outline numbering has to be activated or continued.
1080  SwTextNode const*const pTextNode = sw::GetParaPropsNode(
1081  *GetLayout(), GetCursor()->GetPoint()->nNode);
1082  if ( pTextNode && !pTextNode->IsCountedInList() )
1083  {
1084  // check, if numbering of the outline level of the paragraph
1085  // style is active. If not, activate this outline level.
1086  nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1087  OSL_ENSURE( pColl->IsAssignedToListLevelOfOutlineStyle(),
1088  "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
1089  if ( pColl->IsAssignedToListLevelOfOutlineStyle() &&
1090  pCollRule->Get( static_cast<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1091  == SVX_NUM_NUMBER_NONE )
1092  {
1093  // activate outline numbering
1094  bActivateOutlineRule = true;
1095  }
1096  else
1097  {
1098  // turning on outline numbering at current cursor position
1099  bContinueFoundNumRule = true;
1100  }
1101  }
1102  else
1103  {
1104  // #i101234#
1105  // activate outline numbering, because from the precondition
1106  // it's known, that <SwEdit::HasNumber()> == false
1107  bActivateOutlineRule = true;
1108  nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1109  }
1110  }
1111  else if ( !pNumRule )
1112  {
1113  // #i101234#
1114  // Check, if corresponding list level of the outline numbering
1115  // has already a numbering format set.
1116  nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1117  if ( pCollRule->Get( static_cast<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1118  == SVX_NUM_NUMBER_NONE )
1119  {
1120  // activate outline numbering, because from the precondition
1121  // it's known, that <SwEdit::HasNumber()> == false
1122  bActivateOutlineRule = true;
1123  }
1124  else
1125  {
1126  // turning on outline numbering at current cursor position
1127  bContinueFoundNumRule = true;
1128  }
1129  }
1130  else
1131  {
1132  // check, if numbering of the outline level of the paragraph
1133  // style is active. If not, activate this outline level.
1134  nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1135  OSL_ENSURE( pColl->IsAssignedToListLevelOfOutlineStyle(),
1136  "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
1137  if ( pColl->IsAssignedToListLevelOfOutlineStyle() &&
1138  pCollRule->Get( static_cast<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1139  == SVX_NUM_NUMBER_NONE )
1140  {
1141  // activate outline numbering
1142  bActivateOutlineRule = true;
1143  }
1144  else
1145  {
1146  // turning on outline numbering at current cursor position
1147  bContinueFoundNumRule = true;
1148  }
1149  }
1150  pNumRule = pCollRule;
1151  }
1152  }
1153 
1154  // Only automatic numbering/bullet rules should be changed.
1155  // Note: The outline numbering rule is also an automatic one. It's only
1156  // changed, if it has to be activated.
1157  if ( pNumRule )
1158  {
1159  if ( !pNumRule->IsAutoRule() )
1160  {
1161  pNumRule = nullptr;
1162  }
1163  else if ( pNumRule == GetDoc()->GetOutlineNumRule() &&
1164  !bActivateOutlineRule && !bContinueFoundNumRule )
1165  {
1166  pNumRule = nullptr;
1167  }
1168  }
1169 
1170  // Search for a previous numbering/bullet rule to continue it.
1171  OUString sContinuedListId;
1172  if ( !pNumRule )
1173  {
1174  pNumRule = GetDoc()->SearchNumRule( *GetCursor()->GetPoint(),
1175  false, bNum, false, 0,
1176  sContinuedListId, GetLayout() );
1177  bContinueFoundNumRule = pNumRule != nullptr;
1178  }
1179 
1180  if (pNumRule)
1181  {
1182  SwNumRule aNumRule(*pNumRule);
1183 
1184  // do not change found numbering/bullet rule, if it should only be continued.
1185  if ( !bContinueFoundNumRule )
1186  {
1187  SwTextNode const*const pTextNode = sw::GetParaPropsNode(
1188  *GetLayout(), GetCursor()->GetPoint()->nNode);
1189 
1190  if (pTextNode)
1191  {
1192  // use above retrieve outline level, if outline numbering has to be activated.
1193  int nLevel = bActivateOutlineRule
1194  ? nActivateOutlineLvl
1195  : pTextNode->GetActualListLevel();
1196 
1197  if (nLevel < 0)
1198  nLevel = 0;
1199 
1200  if (nLevel >= MAXLEVEL)
1201  nLevel = MAXLEVEL - 1;
1202 
1203  SwNumFormat aFormat(aNumRule.Get(static_cast<sal_uInt16>(nLevel)));
1204 
1205  if (bNum)
1207  else
1208  {
1209  // #i63395# Only apply user defined default bullet font
1211  {
1212  const vcl::Font* pFnt = &numfunc::GetDefBulletFont();
1213  aFormat.SetBulletFont( pFnt );
1214  }
1215  aFormat.SetBulletChar( numfunc::GetBulletChar(static_cast<sal_uInt8>(nLevel)));
1216  aFormat.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
1217  // #i93908# clear suffix for bullet lists
1218  aFormat.SetPrefix(OUString());
1219  aFormat.SetSuffix(OUString());
1220  }
1221  aNumRule.Set(static_cast<sal_uInt16>(nLevel), aFormat);
1222  }
1223  }
1224 
1225  // reset indent attribute on applying list style
1226  SetCurNumRule( aNumRule, false, sContinuedListId, true );
1227  }
1228  else
1229  {
1230  // #i95907#
1231  const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
1233  SwNumRule aNumRule( GetUniqueNumRuleName(), ePosAndSpaceMode );
1234  // Append the character template at the numbering.
1235  SwCharFormat* pChrFormat;
1236  SwDocShell* pDocSh = GetView().GetDocShell();
1237  // #i63395#
1238  // Only apply user defined default bullet font
1241  : nullptr;
1242 
1243  if (bNum)
1244  {
1245  pChrFormat = GetCharFormatFromPool( RES_POOLCHR_NUM_LEVEL );
1246  }
1247  else
1248  {
1249  pChrFormat = GetCharFormatFromPool( RES_POOLCHR_BULLET_LEVEL );
1250  }
1251 
1252  const SwTextNode *const pTextNode = sw::GetParaPropsNode(*GetLayout(),
1253  GetCursor()->GetPoint()->nNode);
1254  const SwTwips nWidthOfTabs = pTextNode
1255  ? pTextNode->GetWidthOfLeadingTabs()
1256  : 0;
1257  GetDoc()->getIDocumentContentOperations().RemoveLeadingWhiteSpace( *GetCursor()->GetPoint() );
1258 
1259  const bool bHtml = dynamic_cast<SwWebDocShell*>( pDocSh ) != nullptr;
1260  const bool bRightToLeft = IsInRightToLeftText();
1261  for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl )
1262  {
1263  SwNumFormat aFormat( aNumRule.Get( nLvl ) );
1264  aFormat.SetCharFormat( pChrFormat );
1265 
1266  if (! bNum)
1267  {
1268  // #i63395#
1269  // Only apply user defined default bullet font
1270  if ( pFnt )
1271  {
1272  aFormat.SetBulletFont( pFnt );
1273  }
1274  aFormat.SetBulletChar( numfunc::GetBulletChar(nLvl) );
1275  aFormat.SetNumberingType(SVX_NUM_CHAR_SPECIAL);
1276  // #i93908# clear suffix for bullet lists
1277  aFormat.SetPrefix(OUString());
1278  aFormat.SetSuffix(OUString());
1279  }
1280 
1281  // #i95907#
1282  if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1283  {
1284  if(bHtml && nLvl)
1285  {
1286  // 1/2" for HTML
1287  aFormat.SetAbsLSpace(nLvl * 720);
1288  }
1289  else if ( nWidthOfTabs > 0 )
1290  {
1291  aFormat.SetAbsLSpace(nWidthOfTabs + nLvl * 720);
1292  }
1293  }
1294 
1295  // #i38904# Default alignment for
1296  // numbering/bullet should be rtl in rtl paragraph:
1297  if ( bRightToLeft )
1298  {
1299  aFormat.SetNumAdjust( SvxAdjust::Right );
1300  }
1301 
1302  aNumRule.Set( nLvl, aFormat );
1303  }
1304 
1305  // #i95907#
1306  if ( pTextNode &&
1307  ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1308  {
1309 
1310  const SwTwips nTextNodeIndent = pTextNode->GetAdditionalIndentForStartingNewList();
1311  if ( ( nTextNodeIndent + nWidthOfTabs ) != 0 )
1312  {
1313  // #i111172#/fdo#85666
1314  // If text node is already inside a list, assure that the indents
1315  // are the same. Thus, adjust the indent change value by subtracting
1316  // indents of to be applied list style.
1317  SwTwips nIndentChange = nTextNodeIndent + nWidthOfTabs;
1318  if ( pTextNode->GetNumRule() )
1319  {
1320  int nLevel = pTextNode->GetActualListLevel();
1321 
1322  if (nLevel < 0)
1323  nLevel = 0;
1324 
1325  if (nLevel >= MAXLEVEL)
1326  nLevel = MAXLEVEL - 1;
1327 
1328  const SwNumFormat& aFormat( aNumRule.Get( nLevel ) );
1329  if ( aFormat.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
1330  {
1331  nIndentChange -= aFormat.GetIndentAt() + aFormat.GetFirstLineIndent();
1332  }
1333  }
1334  aNumRule.ChangeIndent( nIndentChange );
1335  }
1336  }
1337  // reset indent attribute on applying list style
1338  // start new list
1339  SetCurNumRule( aNumRule, true, OUString(), true );
1340  }
1341 
1343 }
1344 // <- #i40041#
1345 
1347 {
1348  NumOrBulletOn(true);
1349 }
1350 
1352 {
1353  const SwNumRule * pCurNumRule = GetNumRuleAtCurrCursorPos();
1354 
1355  if (!pCurNumRule)
1356  return;
1357 
1358  if (pCurNumRule->IsOutlineRule())
1359  {
1360  SwNumRule aNumRule(*pCurNumRule);
1361 
1362  SwTextNode * pTextNode =
1363  sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
1364 
1365  if (pTextNode)
1366  {
1367  int nLevel = pTextNode->GetActualListLevel();
1368 
1369  if (nLevel < 0)
1370  nLevel = 0;
1371 
1372  if (nLevel >= MAXLEVEL)
1373  nLevel = MAXLEVEL - 1;
1374 
1375  SwNumFormat aFormat(aNumRule.Get(static_cast<sal_uInt16>(nLevel)));
1376 
1378  aNumRule.Set(nLevel, aFormat);
1379 
1380  // no start or continuation of a list - the outline style is only changed.
1381  SetCurNumRule( aNumRule, false );
1382  }
1383  }
1384  else
1385  {
1386  DelNumRules();
1387  }
1388 
1389  // #126346# - Cursor can not be anymore in front of
1390  // a label, because numbering/bullet is switched off.
1391  SetInFrontOfLabel( false );
1392 }
1393 // <- #i29560#
1394 
1395 // Request Default-Bulletlist
1396 
1398 {
1399  NumOrBulletOn(false);
1400 }
1401 
1403 {
1404  // ContentType cannot be determined within a Start-/EndAction.
1405  // Because there is no invalid value TEXT will be returned.
1406  // The value does not matter, it may be updated in EndAction anyway.
1407 
1408  if (ActionPend())
1409  return IsSelFrameMode() ? SelectionType::Frame : SelectionType::Text;
1410 
1411  SwView &_rView = const_cast<SwView&>(GetView());
1412  if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
1413  return SelectionType::PostIt;
1414 
1415  // Inserting a frame is not a DrawMode
1416  SelectionType nCnt;
1417  if ( !_rView.GetEditWin().IsFrameAction() &&
1418  (IsObjSelected() || (_rView.IsDrawMode() && !IsFrameSelected()) ))
1419  {
1420  if (GetDrawView()->IsTextEdit())
1422  else
1423  {
1424  if (GetView().IsFormMode()) // Only Form selected
1425  nCnt = SelectionType::DbForm;
1426  else
1427  nCnt = SelectionType::DrawObject; // Any draw object
1428 
1429  if (_rView.IsBezierEditMode())
1430  nCnt |= SelectionType::Ornament;
1431  else if( GetDrawView()->GetContext() == SdrViewContext::Media )
1432  nCnt |= SelectionType::Media;
1433 
1434  if (svx::checkForSelectedCustomShapes( GetDrawView(), true /* bOnlyExtruded */ ))
1435  {
1437  }
1438  sal_uInt32 nCheckStatus = 0;
1439  if (svx::checkForSelectedFontWork( GetDrawView(), nCheckStatus ))
1440  {
1441  nCnt |= SelectionType::FontWork;
1442  }
1443  }
1444 
1445  return nCnt;
1446  }
1447 
1448  nCnt = static_cast<SelectionType>(GetCntType());
1449 
1450  if ( IsFrameSelected() )
1451  {
1452  if (_rView.IsDrawMode())
1453  _rView.LeaveDrawCreate(); // clean up (Bug #45639)
1454  if ( !(nCnt & (SelectionType::Graphic | SelectionType::Ole)) )
1455  return SelectionType::Frame;
1456  }
1457 
1458  if ( IsCursorInTable() )
1459  nCnt |= SelectionType::Table;
1460 
1461  if ( IsTableMode() )
1462  {
1464  SwTable::SearchType eTableSel = GetEnhancedTableSelection();
1465  if ( eTableSel == SwTable::SEARCH_ROW )
1466  nCnt |= SelectionType::TableRow;
1467  else if ( eTableSel == SwTable::SEARCH_COL )
1468  nCnt |= SelectionType::TableCol;
1469  }
1470 
1471  // Do not pop up numbering toolbar, if the text node has a numbering of type SVX_NUM_NUMBER_NONE.
1472  const SwNumRule* pNumRule = GetNumRuleAtCurrCursorPos();
1473  if ( pNumRule )
1474  {
1475  const SwTextNode* pTextNd =
1476  sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
1477 
1478  if ( pTextNd && pTextNd->IsInList() )
1479  {
1480  int nLevel = pTextNd->GetActualListLevel();
1481 
1482  if (nLevel < 0)
1483  nLevel = 0;
1484 
1485  if (nLevel >= MAXLEVEL)
1486  nLevel = MAXLEVEL - 1;
1487 
1488  const SwNumFormat& rFormat = pNumRule->Get(nLevel);
1489  if ( SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType() )
1490  nCnt |= SelectionType::NumberList;
1491  }
1492  }
1493 
1494  return nCnt;
1495 }
1496 
1497 // Find the text collection with the name rCollname
1498 // Returns: Pointer at the collection or 0, if no
1499 // text collection with this name exists, or
1500 // this is a default template.
1501 
1502 SwTextFormatColl *SwWrtShell::GetParaStyle(const OUString &rCollName, GetStyle eCreate )
1503 {
1504  SwTextFormatColl* pColl = FindTextFormatCollByName( rCollName );
1505  if( !pColl && GETSTYLE_NOCREATE != eCreate )
1506  {
1508  if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
1509  pColl = GetTextCollFromPool( nId );
1510  }
1511  return pColl;
1512 }
1513 
1514 // Find the text collection with the name rCollname
1515 // Returns: Pointer at the collection or 0, if no
1516 // character template with this name exists, or
1517 // this is a default template or template is automatic.
1518 
1519 SwCharFormat *SwWrtShell::GetCharStyle(const OUString &rFormatName, GetStyle eCreate )
1520 {
1521  SwCharFormat* pFormat = FindCharFormatByName( rFormatName );
1522  if( !pFormat && GETSTYLE_NOCREATE != eCreate )
1523  {
1525  if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
1526  pFormat = static_cast<SwCharFormat*>(GetFormatFromPool( nId ));
1527  }
1528  return pFormat;
1529 }
1530 
1531 // Find the table format with the name rFormatname
1532 // Returns: Pointer at the collection or 0, if no
1533 // frame format with this name exists or
1534 // this is a default format or the format is automatic.
1535 
1536 SwFrameFormat *SwWrtShell::GetTableStyle(const OUString &rFormatName)
1537 {
1538  for( size_t i = GetTableFrameFormatCount(); i; )
1539  {
1540  SwFrameFormat *pFormat = &GetTableFrameFormat( --i );
1541  if( !pFormat->IsDefault() &&
1542  pFormat->GetName() == rFormatName && IsUsed( *pFormat ) )
1543  return pFormat;
1544  }
1545  return nullptr;
1546 }
1547 
1549  SwPaM* pPaM = GetCursor();
1550  m_aNavigationMgr.addEntry(*pPaM->GetPoint());
1551 }
1552 
1553 // Applying templates
1554 
1555 void SwWrtShell::SetPageStyle(const OUString &rCollName)
1556 {
1557  if( !SwCursorShell::HasSelection() && !IsSelFrameMode() && !IsObjSelected() )
1558  {
1559  SwPageDesc* pDesc = FindPageDescByName( rCollName, true );
1560  if( pDesc )
1561  ChgCurPageDesc( *pDesc );
1562  }
1563 }
1564 
1565 // Access templates
1566 
1567 OUString const & SwWrtShell::GetCurPageStyle() const
1568 {
1569  return GetPageDesc(GetCurPageDesc( false/*bCalcFrame*/ )).GetName();
1570 }
1571 
1572 // Change the current template referring to the existing change.
1573 
1575 {
1577 
1578  // Default cannot be changed
1579  if(pColl && !pColl->IsDefault())
1580  {
1581  FillByEx(pColl);
1582  // Also apply the template to remove hard attribute assignment.
1583  SetTextFormatColl(pColl);
1584  }
1585 }
1586 
1587 void SwWrtShell::AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM )
1588 {
1589  SwPaM* pCursor = pPaM ? pPaM : GetCursor( );
1590  SfxItemSet aCoreSet(
1591  GetAttrPool(),
1592  svl::Items<
1596  SID_ATTR_TABSTOP_DEFAULTS,SID_ATTR_TABSTOP_OFFSET,
1597  SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
1598  SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
1599  SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM>{});
1600  GetPaMAttr( pCursor, aCoreSet );
1601  bool bReset = false;
1602  SfxItemIter aParaIter( aCoreSet );
1603  for (auto pParaItem = aParaIter.GetCurItem(); pParaItem; pParaItem = aParaIter.NextItem())
1604  {
1605  if(!IsInvalidItem(pParaItem))
1606  {
1607  sal_uInt16 nWhich = pParaItem->Which();
1608  if(SfxItemState::SET == aCoreSet.GetItemState(nWhich) &&
1609  SfxItemState::SET == rStyleSet.GetItemState(nWhich))
1610  {
1611  aCoreSet.ClearItem(nWhich);
1612  bReset = true;
1613  }
1614  }
1615  }
1616  StartAction();
1617  if(bReset)
1618  {
1619  ResetAttr( std::set<sal_uInt16>(), pCursor );
1620  SetAttrSet(aCoreSet, SetAttrMode::DEFAULT, pCursor);
1621  }
1622  mxDoc->ChgFormat(*pColl, rStyleSet );
1623  EndAction();
1624 }
1625 
1626 void SwWrtShell::AutoUpdateFrame( SwFrameFormat* pFormat, const SfxItemSet& rStyleSet )
1627 {
1628  StartAction();
1629 
1630  ResetFlyFrameAttr( &rStyleSet );
1631  pFormat->SetFormatAttr( rStyleSet );
1632 
1633  EndAction();
1634 }
1635 
1637 {
1638  ResetCursorStack();
1639  if(!CanInsert())
1640  return;
1641 
1642  bool bStarted = false;
1643  SwRewriter aRewriter;
1644 
1645  if(HasSelection())
1646  {
1647  // Only parentheses here, because the regular insert
1648  // is already clipped to the editshell
1649  StartAllAction();
1650 
1651  OUString aTmpStr1 = SwResId(STR_START_QUOTE) +
1652  GetSelText() +
1653  SwResId(STR_END_QUOTE);
1654  OUString aTmpStr3 = SwResId(STR_START_QUOTE) +
1655  OUStringChar(cChar) +
1656  SwResId(STR_END_QUOTE);
1657  aRewriter.AddRule( UndoArg1, aTmpStr1 );
1658  aRewriter.AddRule( UndoArg2, SwResId(STR_YIELDS) );
1659  aRewriter.AddRule( UndoArg3, aTmpStr3 );
1660 
1661  StartUndo( SwUndoId::REPLACE, &aRewriter );
1662  bStarted = true;
1663  DelRight();
1664  }
1665  SwEditShell::AutoCorrect( rACorr, IsInsMode(), cChar );
1666 
1667  if(bStarted)
1668  {
1669  EndAllAction();
1670  EndUndo( SwUndoId::REPLACE, &aRewriter );
1671  }
1672 }
1673 
1674 // Some kind of controlled copy ctor
1675 
1677  : SwFEShell(rSh, _pWin)
1678  , m_rView(rShell)
1679  , m_aNavigationMgr(*this)
1680 {
1682  CurrShell aCurr( this );
1683 
1684  SetSfxViewShell( static_cast<SfxViewShell *>(&rShell) );
1685  SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
1686 
1687  // place the cursor on the first field...
1688  IFieldmark *pBM = nullptr;
1689  if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=nullptr ) {
1690  GotoFieldmark(pBM);
1691  }
1692 }
1693 
1695  const SwViewOption *pViewOpt )
1696  : SwFEShell(rDoc, _pWin, pViewOpt)
1697  , m_rView(rShell)
1698  , m_aNavigationMgr(*this)
1699 {
1701  CurrShell aCurr( this );
1702  SetSfxViewShell( static_cast<SfxViewShell *>(&rShell) );
1703  SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
1704 
1705  // place the cursor on the first field...
1706  IFieldmark *pBM = nullptr;
1707  if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=nullptr ) {
1708  GotoFieldmark(pBM);
1709  }
1710 }
1711 
1713 {
1714  CurrShell aCurr( this );
1715  while(IsModePushed())
1716  PopMode();
1717  while(PopCursor(false))
1718  ;
1720 }
1721 
1723 {
1724  bool bRet = SwCursorShell::Pop(eDelete);
1725  if( bRet && IsSelection() )
1726  {
1729  }
1730  return bRet;
1731 }
1732 
1734 {
1735  if(IsSelFrameMode())
1736  {
1737  return false;
1738  }
1739 
1740  if(IsObjSelected())
1741  {
1742  return false;
1743  }
1744 
1745  if(GetView().GetDrawFuncPtr())
1746  {
1747  return false;
1748  }
1749 
1750  if(GetView().GetPostItMgr()->GetActiveSidebarWin())
1751  {
1752  return false;
1753  }
1754 
1755  return true;
1756 }
1757 
1758 void SwWrtShell::ChgDBData(const SwDBData& aDBData)
1759 {
1760  SwEditShell::ChgDBData(aDBData);
1761  //notify the db-beamer if available
1763 }
1764 
1765 OUString SwWrtShell::GetSelDescr() const
1766 {
1767  OUString aResult;
1768 
1769  SelectionType nSelType = GetSelectionType();
1770  switch (nSelType)
1771  {
1773  aResult = SwResId(STR_GRAPHIC);
1774 
1775  break;
1776  case SelectionType::Frame:
1777  {
1778  const SwFrameFormat * pFrameFormat = GetSelectedFrameFormat();
1779 
1780  if (pFrameFormat)
1781  aResult = pFrameFormat->GetDescription();
1782  }
1783  break;
1785  {
1786  aResult = SwResId(STR_DRAWING_OBJECTS);
1787  }
1788  break;
1789  default:
1790  if (mxDoc)
1791  aResult = GetCursorDescr();
1792  }
1793 
1794  return aResult;
1795 }
1796 
1798 {
1800  //#i115062# invalidate meta character slot
1802 }
1803 
1805 {
1808 }
1809 
1810 // Switch on/off header or footer of a page style - if an empty name is
1811 // given all styles are changed
1812 
1814  const OUString& rStyleName, bool bHeader, bool bOn, bool bShowWarning)
1815 {
1816  SdrView *const pSdrView = GetDrawView();
1817  if (pSdrView && pSdrView->IsTextEdit())
1818  { // tdf#107474 deleting header may delete active drawing object
1819  pSdrView->SdrEndTextEdit(true);
1820  }
1822  StartAllAction();
1823  StartUndo( SwUndoId::HEADER_FOOTER ); // #i7983#
1824  bool bExecute = true;
1825  bool bCursorSet = false;
1826  for( size_t nFrom = 0, nTo = GetPageDescCnt();
1827  nFrom < nTo; ++nFrom )
1828  {
1829  SwPageDesc aDesc( GetPageDesc( nFrom ));
1830  OUString sTmp(aDesc.GetName());
1831  if( rStyleName.isEmpty() || rStyleName == sTmp )
1832  {
1833  bool bChgd = false;
1834 
1835  if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() &&
1836  ( (bHeader && aDesc.GetMaster().GetHeader().IsActive()) ||
1837  (!bHeader && aDesc.GetMaster().GetFooter().IsActive()) ) )
1838  {
1839  bShowWarning = false;
1840  //Actions have to be closed while the dialog is showing
1841  EndAllAction();
1842 
1843  weld::Window* pParent = GetView().GetFrameWeld();
1844  short nResult;
1845  if (bHeader) {
1846  nResult = DeleteHeaderDialog(pParent).run();
1847  } else {
1848  nResult = DeleteFooterDialog(pParent).run();
1849  }
1850 
1851  bExecute = nResult == RET_YES;
1852  StartAllAction();
1853  if (nResult == RET_YES)
1855  }
1856  if( bExecute )
1857  {
1858  bChgd = true;
1859  SwFrameFormat &rMaster = aDesc.GetMaster();
1860  if(bHeader)
1861  rMaster.SetFormatAttr( SwFormatHeader( bOn ));
1862  else
1863  rMaster.SetFormatAttr( SwFormatFooter( bOn ));
1864  if( bOn )
1865  {
1866  SvxULSpaceItem aUL(bHeader ? 0 : MM50, bHeader ? MM50 : 0, RES_UL_SPACE );
1867  SwFrameFormat* pFormat = bHeader ?
1868  const_cast<SwFrameFormat*>(rMaster.GetHeader().GetHeaderFormat()) :
1869  const_cast<SwFrameFormat*>(rMaster.GetFooter().GetFooterFormat());
1870  pFormat->SetFormatAttr( aUL );
1871  }
1872  }
1873  if( bChgd )
1874  {
1875  ChgPageDesc( nFrom, aDesc );
1876 
1877  if( !bCursorSet && bOn )
1878  {
1879  if ( !IsHeaderFooterEdit() )
1881  bCursorSet = SetCursorInHdFt(
1882  rStyleName.isEmpty() ? SIZE_MAX : nFrom,
1883  bHeader );
1884  }
1885  }
1886  }
1887  }
1888  EndUndo( SwUndoId::HEADER_FOOTER ); // #i7983#
1889  EndAllAction();
1890 }
1891 
1893 {
1894  SwViewShell::SetShowHeaderFooterSeparator( eControl, bShow );
1895  if ( !bShow )
1897 }
1898 
1899 void SwWrtShell::InsertPostIt(SwFieldMgr& rFieldMgr, const SfxRequest& rReq)
1900 {
1901  SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(rFieldMgr.GetCurField());
1902  bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == SwFieldIds::Postit);
1903  if (bNew || GetView().GetPostItMgr()->IsAnswer())
1904  {
1905  const SvxPostItAuthorItem* pAuthorItem = rReq.GetArg<SvxPostItAuthorItem>(SID_ATTR_POSTIT_AUTHOR);
1906  OUString sAuthor;
1907  if ( pAuthorItem )
1908  sAuthor = pAuthorItem->GetValue();
1909  else
1910  {
1911  std::size_t nAuthor = SW_MOD()->GetRedlineAuthor();
1912  sAuthor = SW_MOD()->GetRedlineAuthor(nAuthor);
1913  }
1914 
1915  const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
1916  OUString sText;
1917  if ( pTextItem )
1918  sText = pTextItem->GetValue();
1919 
1920  // If we have a text already registered for answer, use that
1921  if (GetView().GetPostItMgr()->IsAnswer() && !GetView().GetPostItMgr()->GetAnswerText().isEmpty())
1922  {
1923  sText = GetView().GetPostItMgr()->GetAnswerText();
1924  GetView().GetPostItMgr()->RegisterAnswerText(OUString());
1925  }
1926 
1927  if ( HasSelection() && !IsTableMode() )
1928  {
1929  KillPams();
1930  }
1931 
1932  // #i120513# Inserting a comment into an autocompletion crashes
1933  // --> suggestion has to be removed before
1935 
1936  SwInsertField_Data aData(SwFieldTypesEnum::Postit, 0, sAuthor, sText, 0);
1937 
1938  if (IsSelFrameMode())
1939  {
1940  SwFlyFrame* pFly = GetSelectedFlyFrame();
1941 
1942  // Remember the anchor of the selected object before deletion.
1943  std::unique_ptr<SwPosition> pAnchor;
1944  if (pFly)
1945  {
1946  SwFrameFormat* pFormat = pFly->GetFormat();
1947  if (pFormat)
1948  {
1949  RndStdIds eAnchorId = pFormat->GetAnchor().GetAnchorId();
1950  if ((eAnchorId == RndStdIds::FLY_AS_CHAR || eAnchorId == RndStdIds::FLY_AT_CHAR) && pFormat->GetAnchor().GetContentAnchor())
1951  {
1952  pAnchor.reset(new SwPosition(*pFormat->GetAnchor().GetContentAnchor()));
1953  }
1954  }
1955  }
1956 
1957  // A frame is selected, end frame selection.
1958  EnterStdMode();
1959  GetView().AttrChangedNotify(nullptr);
1960 
1961  // Set up text selection, so the anchor of the frame will be the anchor of the
1962  // comment.
1963  if (pFly)
1964  {
1965  *GetCurrentShellCursor().GetPoint() = *pAnchor;
1966  SwFrameFormat* pFormat = pFly->GetFormat();
1967  if (pFormat && pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
1968  {
1969  Right(CRSR_SKIP_CELLS, /*bSelect=*/true, 1, /*bBasicCall=*/false, /*bVisual=*/true);
1970  }
1971  else if (pFormat && pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_CHAR)
1972  {
1973  aData.m_pAnnotationRange.reset(new SwPaM(*GetCurrentShellCursor().Start(),
1974  *GetCurrentShellCursor().End()));
1975  }
1976  }
1977  }
1978 
1979  rFieldMgr.InsertField( aData );
1980 
1981  Push();
1983  pPostIt = static_cast<SwPostItField*>(rFieldMgr.GetCurField());
1984  Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore cursor position
1985  }
1986 
1987  // Client has disabled annotations rendering, no need to
1988  // focus the postit field
1990  return;
1991 
1992  if (pPostIt)
1993  {
1995  if(auto pFormat = pType->FindFormatForField(pPostIt))
1996  pFormat->Broadcast( SwFormatFieldHint( nullptr, SwFormatFieldHintWhich::FOCUS, &GetView() ) );
1997  }
1998 }
1999 bool SwWrtShell::IsOutlineContentFolded(const size_t nPos)
2000 {
2001  const SwNodes& rNodes = GetDoc()->GetNodes();
2002  const SwOutlineNodes& rOutlineNodes = rNodes.GetOutLineNds();
2003 
2004  assert(nPos < rOutlineNodes.size());
2005 
2006  SwNode* pOutlineNode = rOutlineNodes[nPos];
2007  if (pOutlineNode->IsEndNode())
2008  return false;
2009 
2010  bool bOutlineContentVisibleAttr = false;
2011  if (pOutlineNode->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr))
2012  return !bOutlineContentVisibleAttr;
2013 
2014  return false;
2015 }
2016 
2018 {
2020  if (GetNodes().GetOutLineNds().Seek_Entry(pNd, &nPos))
2021  ToggleOutlineContentVisibility(nPos, bForceFold);
2022 }
2023 
2024 void SwWrtShell::ToggleOutlineContentVisibility(size_t nPos, bool bForceFold)
2025 {
2026  const SwNodes& rNodes = GetNodes();
2027  const SwOutlineNodes& rOutlineNodes = rNodes.GetOutLineNds();
2028 
2029  assert(nPos < rOutlineNodes.size());
2030 
2031  SwNode* pSttNd = rOutlineNodes[nPos];
2032  if (pSttNd->IsEndNode())
2033  return;
2034 
2035  SwNode* pEndNd = &rNodes.GetEndOfContent();
2036  if (rOutlineNodes.size() > nPos + 1)
2037  pEndNd = rOutlineNodes[nPos + 1];
2038 
2039  if (pSttNd->GetTableBox() || pSttNd->GetIndex() < rNodes.GetEndOfExtras().GetIndex())
2040  {
2041  // limit folding to within table box
2042  if (pSttNd->EndOfSectionIndex() < pEndNd->GetIndex() )
2043  pEndNd = pSttNd->EndOfSectionNode();
2044  }
2045  // if pSttNd isn't in table but pEndNd is, skip over all outline nodes in table
2046  else if (pEndNd->GetTableBox())
2047  {
2048  pEndNd = &rNodes.GetEndOfContent();
2049  for (size_t nOutlinePos = nPos + 2; nOutlinePos < rOutlineNodes.size(); nOutlinePos++)
2050  {
2051  if (!(rOutlineNodes[nOutlinePos]->GetTableBox()))
2052  {
2053  pEndNd = rOutlineNodes[nOutlinePos];
2054  break;
2055  }
2056  }
2057  }
2058 
2059  if (IsOutlineContentFolded(nPos) && !bForceFold)
2060  {
2061  // unfold
2062  SwNodeIndex aIdx(*pSttNd, +1);
2063  MakeFrames(GetDoc(), aIdx, *pEndNd);
2064 
2065  pSttNd->GetTextNode()->SetAttrOutlineContentVisible(true);
2066 
2067  if (GetViewOptions()->IsShowOutlineContentVisibilityButton())
2068  {
2069  // remove fold button if focus is not on outline frame control window
2070  SwContentFrame* pFrame = pSttNd->GetTextNode()->getLayoutFrame(nullptr);
2071  if (pFrame && !pFrame->IsInDtor())
2072  {
2074  if (pOutlineFrameControl && pOutlineFrameControl->GetWindow() && !pOutlineFrameControl->GetWindow()->HasFocus())
2076  }
2077 
2078  // fold revealed outline nodes that have collapsed content
2079  while (aIdx != *pEndNd)
2080  {
2081  SwNode* pTmpNd = &aIdx.GetNode();
2082  if (pTmpNd->IsTextNode() && pTmpNd->GetTextNode()->IsOutline())
2083  {
2084  SwTextNode* pTmpTextNd = pTmpNd->GetTextNode();
2085  bool bOutlineContentVisibleAttr = true;
2086  if (pTmpTextNd->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr) &&
2087  !bOutlineContentVisibleAttr)
2088  {
2090  if (rOutlineNodes.Seek_Entry(pTmpTextNd, &iPos))
2091  {
2092  if (pTmpTextNd->getLayoutFrame(nullptr))
2093  ToggleOutlineContentVisibility(iPos, true);
2094  }
2095  }
2096  }
2097  aIdx++;
2098  }
2099  }
2100  }
2101  else
2102  {
2103  // fold
2104  for (SwNodeIndex aIdx(*pSttNd, +1); &aIdx.GetNode() != pEndNd; aIdx++)
2105  {
2106  SwNode* pNd = &aIdx.GetNode();
2107  if (pNd->IsContentNode())
2108  pNd->GetContentNode()->DelFrames(nullptr);
2109  else if (pNd->IsTableNode())
2110  pNd->GetTableNode()->DelFrames(nullptr);
2111  }
2112  pSttNd->GetTextNode()->SetAttrOutlineContentVisible(false);
2113  }
2114  GetView().GetEditWin().Invalidate(InvalidateFlags::Update);
2115  GetDoc()->GetDocShell()->Broadcast(SfxHint(SfxHintId::DocChanged));
2116 }
2117 
2118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void InsertLineBreak()
Definition: wrtsh1.cxx:919
const Fraction & GetScaleWidth() const
SfxViewFrame * GetViewFrame() const
SvxNumType GetNumberingType() const
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:240
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:690
css::uno::Reference< css::embed::XEmbeddedObject > CreateEmbeddedObject(const css::uno::Sequence< sal_Int8 > &, OUString &, OUString const *pBaseURL=nullptr)
const SfxSlot * GetSlot(sal_uInt16 nId) const
const css::uno::Reference< css::embed::XEmbeddedObject > & GetObject() const
bool Right(sal_uInt16 nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:123
void KillPams()
Definition: crsrsh.cxx:1020
sal_uLong GetIndex() const
Definition: node.hxx:290
virtual css::uno::Reference< css::io::XInputStream > GetIconIfIconified(OUString *pGraphicMediaType)=0
void SplitNode(bool bAutoFormat=false)
Definition: wrtsh1.cxx:995
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2852
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:587
OUString const & GetCurPageStyle() const
Definition: wrtsh1.cxx:1567
void ChgDBData(const SwDBData &SwDBData)
Definition: edfld.cxx:305
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
Rect of current FlyFrame.
static SvxAutoCorrCfg & Get()
Marks a position in the document model.
Definition: pam.hxx:35
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
void InsertByWord(const OUString &)
Definition: wrtsh1.cxx:170
const SwNodes & GetNodes() const
Definition: viewsh.cxx:2091
bool IsAutoCorrFlag(ACFlags nFlag) const
bool IsDrawMode() const
Definition: view.hxx:524
SdrView * GetDrawView()
Definition: vnew.cxx:375
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
size_t GetPageDescCnt() const
Definition: fedesc.cxx:37
void InsertObject( const svt::EmbeddedObjectRef &, SvGlobalName const *pName, sal_uInt16 nSlotId=0)
Definition: wrtsh1.cxx:368
bool IsDefault() const
Definition: format.hxx:109
bool SetObjArea(const tools::Rectangle &)
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:749
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
Definition: ndtbl.cxx:2436
void BulletOn()
Definition: wrtsh1.cxx:1397
void setWidth(tools::Long nWidth)
SwView * GetActiveView()
Definition: swmodul1.cxx:116
const char aData[]
Definition: ww8scan.hxx:47
bool IsOutline() const
Returns if this text node is an outline.
Definition: ndtxt.cxx:3968
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
OutlinerParaObject * IsAnswer()
Definition: PostItMgr.hxx:255
void UpdateAttrMgr()
Definition: frmmgr.cxx:122
bool IsBezierEditMode() const
Definition: viewdraw.cxx:617
SwDocShell * GetDocShell()
Definition: doc.hxx:1348
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
SwNodeIndex nNode
Definition: pam.hxx:37
bool IsTableMode() const
Definition: crsrsh.hxx:643
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
void SetFlyMacroLnk(const Link< const SwFlyFrameFormat *, void > &rLnk)
Definition: crsrsh.hxx:479
void ChangeHeaderOrFooter(const OUString &rStyleName, bool bHeader, bool bOn, bool bShowWarning)
Definition: wrtsh1.cxx:1813
sal_uInt16 char char * pDesc
void Remove(const SvGlobalName &)
SVX_NUM_NUMBER_NONE
static SvxAbstractDialogFactory * Create()
long Long
void StopQuickHelp()
Definition: edtwin.cxx:5991
bool Pop(SwCursorShell::PopMode=SwCursorShell::PopMode::DeleteStack)
Definition: wrtsh1.cxx:1722
bool IsAutoRule() const
Definition: numrule.hxx:228
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow) override
Definition: wrtsh1.cxx:1892
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1192
virtual OUString GetDescription() const
Definition: atrfrm.cxx:2827
Definition: doc.hxx:184
void SetNumStr(const OUString &rStr)
Definition: fmtftn.hxx:76
void HideControls(FrameControlType eType)
sal_Int16 nId
css::uno::Sequence< sal_Int8 > GetByteSequence() const
void AutoCorrect(SvxAutoCorrect &rACorr, bool bInsertMode, sal_Unicode cChar)
Call AutoCorrect.
Definition: edws.cxx:255
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
OUString GetSelDescr() const
Definition: wrtsh1.cxx:1765
SwNode & GetNode() const
Definition: ndindex.hxx:119
bool Left(sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:349
long SwTwips
Definition: swtypes.hxx:49
SwTwips GetWidthOfLeadingTabs() const
Returns the width of leading tabs/blanks in this paragraph.
Definition: itratr.cxx:1437
void EnterStdMode()
Definition: select.cxx:550
bool checkForSelectedFontWork(SdrView const *pSdrView, sal_uInt32 &nCheckStatus)
SwEditWin & GetEditWin()
Definition: view.hxx:401
SwFormatField * FindFormatForField(const SwField *) const
Definition: fldbas.cxx:159
void SetPageStyle(const OUString &rCollName)
Definition: wrtsh1.cxx:1555
void Pos(const Point &rNew)
Definition: swrect.hxx:169
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void AutoUpdatePara(SwTextFormatColl *pColl, const SfxItemSet &rStyleSet, SwPaM *pPaM=nullptr)
Definition: wrtsh1.cxx:1587
void Invalidate(sal_uInt16 nId)
SwFlyFrame * GetSelectedFlyFrame() const
Definition: fefly1.cxx:275
bool InsertField(const SwInsertField_Data &rData)
Definition: fldmgr.cxx:890
bool InsertOleObject(const svt::EmbeddedObjectRef &xObj, SwFlyFrameFormat **pFlyFrameFormat=nullptr)
Definition: wrtsh1.cxx:472
OUString GetCursorDescr() const
Returns textual description of the current selection.
Definition: crsrsh.cxx:3623
RndStdIds GetAnchor() const
Definition: frmmgr.hxx:167
void DelAttr(sal_uInt16 nId)
Definition: frmmgr.cxx:521
void EndAllAction()
Definition: edws.cxx:97
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4082
static sal_uInt16 IsChart(const SvGlobalName &rName)
void InsertPostIt(SwFieldMgr &rFieldMgr, const SfxRequest &rReq)
Inserts a new annotation/comment at the current cursor position / selection.
Definition: wrtsh1.cxx:1899
void NoEdit(bool bHideCursor=true)
Definition: wrtsh1.cxx:146
virtual void SetReadonlyOption(bool bSet)
Definition: viewsh.cxx:2320
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2501
const OUString & GetName() const
Definition: pagedesc.hxx:187
bool IsActive() const
Definition: fmthdft.hxx:89
bool IsOutlineContentFolded(const size_t nPos)
Definition: wrtsh1.cxx:1999
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
static UITestLogger & getInstance()
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
bool IsHeaderFooterEdit() const
Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags.
Definition: viewsh.hxx:562
void logEvent(const EventDescription &rDescription)
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
sal_uInt16 sal_Unicode
const SfxPoolItem * NextItem()
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:332
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: editsh.cxx:1080
const SwTwips DFLT_HEIGHT
Definition: frmmgr.hxx:39
SwTableNode * GetTableNode()
Definition: node.hxx:607
const SwView & GetView() const
Definition: wrtsh.hxx:428
SwFrameControlsManager & GetFrameControlsManager()
Definition: edtwin.cxx:6634
RET_YES
void ToggleOutlineContentVisibility(SwNode *pNd, bool bForceFold=false)
Definition: wrtsh1.cxx:2017
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
rtl::Reference< SwDoc > mxDoc
The document; never 0.
Definition: viewsh.hxx:171
SwIndex nContent
Definition: pam.hxx:38
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_Unicode GetBulletChar(sal_uInt8 nLevel)
retrieve unicode of character used for the default bullet list for the given list level ...
Definition: number.cxx:1325
tools::Long CalcHeightBorder()
Definition: frmmgr.hxx:135
const OUString & GetName() const
Definition: format.hxx:111
void Edit()
Definition: wrtsh1.cxx:152
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
SVX_NUM_ARABIC
const sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:95
SELECTFUNC m_fnSetCursor
Definition: wrtsh.hxx:109
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
void Width(tools::Long nNew)
Definition: swrect.hxx:187
const SfxItemSet & GetAttrSet() const
Definition: frmmgr.hxx:124
Numbering symbols.
Definition: poolfmt.hxx:117
constexpr TypedWhichId< SwFormatCharFormat > RES_TXTATR_CHARFMT(52)
SwDoc * GetDoc() const
Definition: viewsh.hxx:281
bool checkForSelectedCustomShapes(SdrView const *pSdrView, bool bOnlyExtruded)
static sal_uInt16 IsMath(const SvGlobalName &rName)
virtual void MoveObjectIfActive(svt::EmbeddedObjectRef &xObj, const Point &rOffset) override
The layout has been changed, so the active object has to be moved after that.
Definition: wrtsh1.cxx:642
size_type size() const
bool IsEmpty() const
Definition: swrect.hxx:292
void Insert(SwField const &, SwPaM *pAnnotationRange=nullptr)
Definition: wrtsh2.cxx:61
void MakeFrames(SwDoc *pDoc, const SwNodeIndex &rSttIdx, const SwNodeIndex &rEndIdx)
Definition: frmtool.cxx:1936
void NumOn()
Definition: wrtsh1.cxx:1346
bool IsFormProtected()
Definition: crbm.cxx:278
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:163
SwWrtShell(SwWrtShell &, vcl::Window *pWin, SwView &rShell)
Definition: wrtsh1.cxx:1676
void SetReadonlyControls(bool bReadonly)
SVX_NUM_CHAR_SPECIAL
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:20
void SetHeightSizeType(SwFrameSize eType)
Definition: frmmgr.cxx:579
bool IsContentNode() const
Definition: node.hxx:636
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool IsInDtor() const
Definition: frame.hxx:870
void RemoveControlsByType(FrameControlType eType, const SwFrame *pFrame)
Class for automated call of Start- and EndAction().
Definition: editsh.hxx:1018
bool IsSelection() const
Definition: crsrsh.hxx:879
static void EndUndo(SwWrtShell &rSh)
Definition: basesh.cxx:2697
sal_uInt16 char * pName
std::unique_ptr< SwPaM > m_pAnnotationRange
Marks the PostIt field's annotation start/end if it differs from the cursor selection.
Definition: fldmgr.hxx:84
static css::uno::Reference< css::embed::XStorage > GetTemporaryStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
Style of a layout element.
Definition: frmfmt.hxx:57
virtual SwPaM & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:180
bool HasSelection() const
Definition: wrtsh.hxx:141
#define SW_MOD()
Definition: swmodule.hxx:255
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:81
int i
void Insert2(const OUString &, const bool bForceExpandHints=false)
Definition: editsh.cxx:79
bool IsFrameAction() const
Definition: edtwin.hxx:217
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
const SwPosition * GetPoint() const
Definition: pam.hxx:207
bool SetCursorInHdFt(size_t nDescNo, bool bInHeader)
Definition: crstrvl.cxx:192
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
Definition: number.cxx:1320
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:65
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:67
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow)
Definition: viewsh.cxx:93
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2236
SwCharFormat * GetCharStyle(const OUString &rFormatName, GetStyle eCreate=GETSTYLE_NOCREATE)
Definition: wrtsh1.cxx:1519
SvxAutoCorrect * GetAutoCorrect()
SfxBindings & GetBindings()
void Assign(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
SwContentNode * GetContentNode()
Definition: node.hxx:623
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
const OUString & GetValue() const
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:125
void SetTextFormatColl(const css::uno::Any &rAny, SwPaM &rPaM)
const T * GetArg(sal_uInt16 nSlotId) const
void SetSfxViewShell(SfxViewShell *pNew)
Definition: viewsh.hxx:442
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
Definition: node.cxx:1390
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
SwField * GetCurField()
Definition: fldmgr.cxx:425
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:29
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
void SetGraphicStream(const css::uno::Reference< css::io::XInputStream > &xInGrStream, const OUString &rMediaType)
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2779
void SetAnchor(RndStdIds eId)
Definition: frmmgr.cxx:213
void NumOrBulletOff()
Definition: wrtsh1.cxx:1351
bool GetAttrOutlineContentVisible(bool &bOutlineContentVisibleAttr)
GetAttrOutlineContentVisible.
Definition: ndtxt.cxx:4013
Marks a node in the document model.
Definition: ndindex.hxx:31
void ToggleHeaderFooterEdit()
Definition: fews.cxx:1318
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:231
virtual void SetReadonlyOption(bool bSet) override
Definition: wrtsh1.cxx:1804
#define CNT_OLE
Definition: editsh.hxx:131
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
void SSize(const Size &rNew)
Definition: swrect.hxx:178
void PopMode()
Definition: select.cxx:283
void LeaveDrawCreate()
Definition: view.hxx:523
void Insert(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet)
Definition: fefly1.cxx:822
Frame cannot be moved in Var-direction.
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:218
const char * GetUnoName() const
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
Definition: txtfrm.cxx:324
SwFieldType * GetTyp() const
Definition: fldbas.hxx:396
SwFrameFormat * GetTableStyle(const OUString &rFormatName)
Definition: wrtsh1.cxx:1536
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
Definition: fefly1.cxx:1191
void ChangeIndent(const sal_Int32 nDiff)
change indent of all list levels by given difference
Definition: number.cxx:931
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2355
virtual void CalcAndSetScale(svt::EmbeddedObjectRef &xObj, const SwRect *pFlyPrtRect=nullptr, const SwRect *pFlyFrameRect=nullptr, const bool bNoTextFramePrtAreaChanged=false) override
Client for OleObject has to be up-to-date regarding scaling.
Definition: wrtsh1.cxx:665
constexpr TypedWhichId< SvxRsidItem > RES_CHRATR_RSID(39)
SelectionType
Definition: wrtsh.hxx:58
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:460
static void Get1PixelInLogic(const SwViewShell &rSh, tools::Long *pX=nullptr, tools::Long *pY=nullptr)
Definition: viscrs.cxx:591
SwFlyFrameFormat * InsertObject(const svt::EmbeddedObjectRef &, SfxItemSet *pFlyAttrSet)
Definition: fefly1.cxx:905
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:79
const sal_uInt16 CRSR_SKIP_CELLS
Definition: swcrsr.hxx:66
constexpr sal_uInt16 RES_FRMATR_END(131)
virtual css::uno::Reference< css::embed::XEmbeddedObject > GetObject()=0
void InsertFootnote(const OUString &, bool bEndNote=false, bool bEdit=true)
Definition: wrtsh1.cxx:962
FrameControlType
Definition: swtypes.hxx:236
Class for automated call of Start- and EndCursorMove().
Definition: editsh.hxx:1026
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:217
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
void NumOrBulletOn(bool bNum)
Turns on numbering or bullets.
Definition: wrtsh1.cxx:1030
void addCurrentPosition()
Definition: wrtsh1.cxx:1548
void Set(sal_uInt16 i, const SwNumFormat *)
Definition: number.cxx:589
virtual ~SwWrtShell() override
Definition: wrtsh1.cxx:1712
void SetCharFormat(SwCharFormat *)
Definition: number.cxx:273
#define BITFLD_INI_LIST
Definition: wrtsh1.cxx:123
::sw::mark::IFieldmark * GetFieldmarkAfter()
Definition: crbm.cxx:290
virtual bool IsTextEdit() const final override
tools::Rectangle SVRect() const
Definition: swrect.hxx:280
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
ErrCode DoVerb(tools::Long nVerb)
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1486
weld::Window * GetFrameWeld() const
#define MM50
Definition: swtypes.hxx:59
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
bool IsDefBulletFontUserDefined()
determine if default bullet font is user defined
Definition: number.cxx:1315
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
unsigned char sal_uInt8
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:423
static void ClearSelection(SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4112
const o3tl::enumarray< SvxAdjust, unsigned short > aSvxToUnoAdjust USHRT_MAX
Definition: unosett.cxx:254
tools::Long CalcWidthBorder()
Definition: frmmgr.hxx:134
OUString aName
sal_Int32 GetIndex() const
Definition: index.hxx:91
bool IsCountedInList() const
Definition: ndtxt.cxx:4220
const tools::Rectangle & GetObjArea() const
SwNodes & GetNodes()
Definition: doc.hxx:403
tools::Long AdjustWidth(tools::Long n)
bool IsModePushed() const
Definition: wrtsh.hxx:132
void ChgPageDesc(size_t i, const SwPageDesc &)
Definition: fedesc.cxx:110
constexpr sal_uInt16 RES_PARATR_END(82)
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:621
tools::Long Height() const
bool CanInsert()
Definition: wrtsh1.cxx:1733
void NotifyDBChanged()
Definition: view.cxx:1847
Size GetSize(MapMode const *pTargetMapMode) const
size_t IsObjSelected() const
Definition: feshview.cxx:1149
SwFrameControlPtr GetControl(FrameControlType eType, const SwFrame *pFrame)
void SetSize(const Size &rLSize)
Definition: frmmgr.cxx:600
void SetObjAreaAndScale(const tools::Rectangle &, const Fraction &, const Fraction &)
void AutoUpdateFrame(SwFrameFormat *pFormat, const SfxItemSet &rStyleSet)
Definition: wrtsh1.cxx:1626
tools::Long AdjustHeight(tools::Long n)
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
#define FN_VIEW_META_CHARS
Definition: cmdid.h:161
void InsertColumnBreak()
Definition: wrtsh1.cxx:939
constexpr sal_uInt16 RES_CHRATR_END(46)
SAL_DLLPRIVATE tools::Long SetCursorKillSel(const Point *, bool bProp)
Definition: select.cxx:315
const SwPostItMgr * GetPostItMgr() const
Definition: viewsh.hxx:556
virtual bool IsCreateNew()=0
SwFormatColl * GetCurTextFormatColl(SwPaM &rPam, const bool bConditional)
Definition: unoobj.cxx:616
void setHeight(tools::Long nHeight)
void AutoCorrect(SvxAutoCorrect &rACorr, sal_Unicode cChar)
Definition: wrtsh1.cxx:1636
void Overwrite(const OUString &)
Definition: editsh.cxx:168
static SvxAutoCorrect * lcl_IsAutoCorr()
Definition: wrtsh1.cxx:136
bool IsEndWrd()
Definition: wrtsh1.cxx:160
const sal_uInt16 CRSR_SKIP_CHARS
Definition: swcrsr.hxx:65
MapUnit
RndStdIds
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
Definition: fmtpdsc.hxx:66
bool IsTableNode() const
Definition: node.hxx:648
SwTwips GetAdditionalIndentForStartingNewList() const
Definition: ndtxt.cxx:3213
bool IsInList() const
Definition: ndtxt.cxx:4324
void InsertPageBreak(const OUString *pPageDesc=nullptr, const ::std::optional< sal_uInt16 > &rPgNum=std::nullopt)
Definition: wrtsh1.cxx:884
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
const Point & GetLastFlyFramePrtRectPos() const
Definition: frmfmt.hxx:244
Left
void ChgDBData(const SwDBData &SwDBData)
Definition: wrtsh1.cxx:1758
SAL_DLLPRIVATE bool PopCursor(bool bUpdate, bool bSelect=false)
Definition: move.cxx:481
void SplitNode(bool bAutoFormat=false, bool bCheckTableStart=true)
Definition: editsh.cxx:182
bool Pop(PopMode)
delete cursor
Definition: crsrsh.cxx:2258
bool Seek_Entry(SwNode *rP, size_type *pnPos) const
Definition: ndnum.cxx:32
const Size & GetSize() const
Definition: frmmgr.hxx:138
void SetNumberingType(SvxNumType nSet)
virtual void ConnectObj(svt::EmbeddedObjectRef &xIPObj, const SwRect &rPrt, const SwRect &rFrame) override
Connect objects with ActivateWhenVisible at Paint.
Definition: wrtsh1.cxx:873
std::map< OUString, OUString > aParameters
bool IsActive() const
Definition: fmthdft.hxx:58
std::shared_ptr< SwFrameControl > SwFrameControlPtr
sal_Int64 GetViewAspect() const
bool IsInvalidItem(const SfxPoolItem *pItem)
std::vector< SwNode * >::size_type size_type
const SwTwips DFLT_WIDTH
Definition: frmmgr.hxx:38
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:161
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1402
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:1797
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
const Fraction & GetScaleHeight() const
bool GotoFieldmark(::sw::mark::IFieldmark const *const pMark)
Definition: wrtsh3.cxx:85
void RegisterAnswerText(const OUString &aAnswerText)
Definition: PostItMgr.hxx:256
tools::Long GetIndentAt() const
CharClass & GetAppCharClass()
Definition: init.cxx:708
bool IsTextNode() const
Definition: node.hxx:644
void Height(tools::Long nNew)
Definition: swrect.hxx:191
const OUString & GetAnswerText() const
Definition: PostItMgr.hxx:257
SwFieldIds Which() const
Definition: fldbas.hxx:272
sal_Int32 nState
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
Rect of PrtArea of FlyFrame.
void QuickUpdateStyle()
Definition: wrtsh1.cxx:1574
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
bool IsOutlineRule() const
Definition: numrule.hxx:240
Definition: view.hxx:144
SELECTFUNC m_fnKillSel
Definition: wrtsh.hxx:111
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
sal_uInt16 nPos
const SfxPoolItem * GetCurItem() const
bool IsSelFrameMode() const
Definition: wrtsh.hxx:170
SwTextFormatColl * GetParaStyle(const OUString &rCollName, GetStyle eCreate=GETSTYLE_NOCREATE)
Definition: wrtsh1.cxx:1502
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:844
void UpdateFlyFrame()
Definition: frmmgr.cxx:146
void LaunchOLEObj(tools::Long nVerb=0)
Definition: wrtsh1.cxx:614
Base class of the Writer document model elements.
Definition: node.hxx:79