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