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