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#include <com/sun/star/lang/XInitialization.hpp>
29
30#include <hintids.hxx>
31#include <sot/exchange.hxx>
32#include <svx/xfillit0.hxx>
33#include <svx/hdft.hxx>
34#include <svx/svdview.hxx>
35#include <svl/itemiter.hxx>
36#include <tools/bigint.hxx>
37#include <svtools/insdlg.hxx>
38#include <sfx2/ipclient.hxx>
40#include <editeng/svxacorr.hxx>
41#include <editeng/ulspitem.hxx>
42#include <vcl/graph.hxx>
45#include <svx/svxdlg.hxx>
46#include <svx/extrusionbar.hxx>
47#include <svx/fontworkbar.hxx>
48#include <dialoghelp.hxx>
49#include <frmfmt.hxx>
50#include <fmtftn.hxx>
51#include <fmthdft.hxx>
52#include <fmtpdsc.hxx>
53#include <txtfrm.hxx>
54#include <wdocsh.hxx>
55#include <swmodule.hxx>
56#include <wrtsh.hxx>
57#include <view.hxx>
58#include <cmdid.h>
59#include <pagedesc.hxx>
60#include <frmmgr.hxx>
61#include <swundo.hxx>
62#include <swcli.hxx>
63#include <poolfmt.hxx>
64#include <edtwin.hxx>
65#include <fmtcol.hxx>
66#include <swtable.hxx>
67#include <viscrs.hxx>
68#include <swdtflvr.hxx>
69#include <doc.hxx>
71#include <SwCapObjType.hxx>
72#include <SwStyleNameMapper.hxx>
73#include <sfx2/request.hxx>
74#include <paratr.hxx>
75#include <ndtxt.hxx>
76#include <editeng/acorrcfg.hxx>
77#include <IMark.hxx>
78#include <sfx2/bindings.hxx>
79#include <flyfrm.hxx>
80
81// -> #111827#
82#include <SwRewriter.hxx>
83#include <strings.hrc>
84// <- #111827#
85
87#include <sfx2/viewfrm.hxx>
88#include <vcl/uitest/logger.hxx>
90#include <osl/diagnose.h>
92
93#include <PostItMgr.hxx>
95#include <fldmgr.hxx>
96#include <docufld.hxx>
98#include <fmtfld.hxx>
99
100#include <sfx2/msgpool.hxx>
101#include <sfx2/msg.hxx>
102#include <svtools/embedhlp.hxx>
103#include <svx/postattr.hxx>
104#include <comphelper/lok.hxx>
107#include <svl/numformat.hxx>
108#include <svl/zformat.hxx>
109#include <memory>
110
111#include "../../core/crsr/callnk.hxx"
112#include <frmtool.hxx>
113#include <viewopt.hxx>
114
115#include <IDocumentUndoRedo.hxx>
116#include <UndoInsert.hxx>
117#include <UndoCore.hxx>
118#include <formatlinebreak.hxx>
120#include <textcontentcontrol.hxx>
121
122using namespace sw::mark;
123using namespace com::sun::star;
124namespace {
125
126void collectUIInformation(const OUString& rAction, const OUString& aParameters)
127{
128 EventDescription aDescription;
129 aDescription.aAction = rAction;
130 aDescription.aParameters = {{"parameters", aParameters}};
131 aDescription.aID = "writer_edit";
132 aDescription.aKeyWord = "SwEditWinUIObject";
133 aDescription.aParent = "MainWindow";
134 UITestLogger::getInstance().logEvent(aDescription);
135}
136
137}
138
140
141static bool lcl_IsAllowed(const SwWrtShell* rSh)
142{
144 {
145 SwTextNode* pTextNode = rSh->GetCursor()->GetPointNode().GetTextNode();
146 if (pTextNode && pTextNode->IsOutline())
147 {
148 // disallow if this is an outline node having folded content
149 bool bVisible = true;
151 if (!bVisible)
152 return false;
153 }
154 }
155 return true;
156}
157
158#define BITFLD_INI_LIST \
159 m_bClearMark = \
160 m_bIns = true;\
161 m_bAddMode = \
162 m_bBlockMode = \
163 m_bExtMode = \
164 m_bInSelect = \
165 m_bLayoutMode = \
166 m_bSelWrd = \
167 m_bSelLn = \
168 m_bRetainSelection = false; \
169 m_bIsInClickToEdit = false;
170
172{
174 if( pACorr && !pACorr->IsAutoCorrFlag( ACFlags::CapitalStartSentence | ACFlags::CapitalStartWord |
175 ACFlags::AddNonBrkSpace | ACFlags::ChgOrdinalNumber | ACFlags::TransliterateRTL |
176 ACFlags::ChgToEnEmDash | ACFlags::SetINetAttr | ACFlags::Autocorrect ))
177 pACorr = nullptr;
178 return pACorr;
179}
180
181void SwWrtShell::NoEdit(bool bHideCursor)
182{
183 if(bHideCursor)
184 HideCursor();
185}
186
188{
189 if (CanInsert())
190 {
191 ShowCursor();
192 }
193}
194
196{
197 SwMvContext aMvContext(this);
198 if(IsEndPara() && !IsSttPara())
199 return true;
200
201 return IsEndWord();
202}
203
204// Insert string
205void SwWrtShell::InsertByWord( const OUString & rStr)
206{
207 if( rStr.isEmpty() )
208 return;
209
210 bool bDelim = GetAppCharClass().isLetterNumeric( rStr, 0 );
211 sal_Int32 nPos = 0, nStt = 0;
212 for( ; nPos < rStr.getLength(); nPos++ )
213 {
214 bool bTmpDelim = GetAppCharClass().isLetterNumeric( rStr, nPos );
215 if( bTmpDelim != bDelim )
216 {
217 Insert( rStr.copy( nStt, nPos - nStt ));
218 nStt = nPos;
219 }
220 }
221 if( nStt != nPos )
222 Insert( rStr.copy( nStt, nPos - nStt ));
223}
224
225void SwWrtShell::Insert( const OUString &rStr )
226{
228 if( !CanInsert() )
229 return;
230
231 bool bStarted = false;
232 bool bHasSel = HasSelection(),
233 bCallIns = m_bIns /*|| bHasSel*/;
234 bool bDeleted = false;
235
236 if( bHasSel || ( !m_bIns && SelectHiddenRange() ) )
237 {
238 // Only here parenthesizing, because the normal
239 // insert is already in parentheses at Editshell.
241
242 SwRewriter aRewriter;
243
244 aRewriter.AddRule(UndoArg1, GetCursorDescr());
245 aRewriter.AddRule(UndoArg2, SwResId(STR_YIELDS));
246 {
247 OUString aTmpStr = SwResId(STR_START_QUOTE) +
248 rStr + SwResId(STR_END_QUOTE);
249
250 aRewriter.AddRule(UndoArg3, aTmpStr);
251 }
252
253 StartUndo(SwUndoId::REPLACE, &aRewriter);
254 bStarted = true;
255 Push();
256 // let's interpret a selection within the same node as "replace"
257 bDeleted = DelRight(GetCursor()->GetPoint()->GetNode() == GetCursor()->GetMark()->GetNode());
258 Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore selection (if tracking changes)
259 NormalizePam(false); // tdf#127635 put point at the end of deletion
260 ClearMark();
261 }
262
263 bCallIns ?
264 SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr );
265
266 // Check whether node is content control
267 SwTextContentControl* pTextContentControl = CursorInsideContentControl();
268 if (pTextContentControl)
269 {
270 std::shared_ptr<SwContentControl> pContentControl =
271 pTextContentControl->GetContentControl().GetContentControl();
272 if (pContentControl)
273 {
274 // Set showingPlcHdr to false as node has been edited
275 pContentControl->SetShowingPlaceHolder(false);
276 }
277 }
278
279 if( bStarted )
280 {
281 EndUndo();
282 EndAllAction();
283 }
284}
285
286// Maximum height limit not possible, because the maximum height
287// of the current frame can not be obtained.
288
289void SwWrtShell::InsertGraphic( const OUString &rPath, const OUString &rFilter,
290 const Graphic &rGrf, SwFlyFrameAttrMgr *pFrameMgr,
291 RndStdIds nAnchorType )
292{
294 if ( !CanInsert() )
295 return;
296
298
299 SwRewriter aRewriter;
300 aRewriter.AddRule(UndoArg1, SwResId(STR_GRAPHIC));
301
302 StartUndo(SwUndoId::INSERT, &aRewriter);
303
304 if ( HasSelection() )
305 DelRight();
306 // Inserted graphics in its own paragraph,
307 // if at the end of a non-empty paragraph.
308 //For i120928,avoid to split node
309
311
312 bool bSetGrfSize = true;
313 bool bOwnMgr = false;
314
315 if ( !pFrameMgr )
316 {
317 bOwnMgr = true;
318 pFrameMgr = new SwFlyFrameAttrMgr( true, this, Frmmgr_Type::GRF, nullptr );
319
320 // CAUTION
321 // GetAttrSet makes an adjustment
322 // While pasting is a SwFrameSize present
323 // because of the DEF-Framesize
324 // These must be removed explicitly for the optimal size.
325 pFrameMgr->DelAttr(RES_FRM_SIZE);
326
327 if (nAnchorType != RndStdIds::FLY_AT_PARA)
328 // Something other than at-para was requested.
329 pFrameMgr->SetAnchor(nAnchorType);
330 }
331 else
332 {
333 Size aSz( pFrameMgr->GetSize() );
334 if ( !aSz.Width() || !aSz.Height() )
335 {
338 pFrameMgr->SetSize( aSz );
339 }
340 else if ( aSz.Width() != DFLT_WIDTH && aSz.Height() != DFLT_HEIGHT )
341 bSetGrfSize = false;
342
344 }
345
346 // during change tracking, insert the image anchored as character
347 // (to create an SwRangeRedline on its anchor point)
348 if ( IsRedlineOn() && nAnchorType != RndStdIds::FLY_AS_CHAR )
349 pFrameMgr->SetAnchor( RndStdIds::FLY_AS_CHAR );
350
351 // Insert the graphic
352 SwFEShell::Insert(rPath, rFilter, &rGrf, &pFrameMgr->GetAttrSet());
353 if ( bOwnMgr )
354 pFrameMgr->UpdateAttrMgr();
355
356 if( bSetGrfSize )
357 {
358 Size aSizePixel = rGrf.GetSizePixel();
359 Size aBound = GetGraphicDefaultSize();
360
361 sal_Int32 nPreferredDPI = mxDoc->getIDocumentSettingAccess().getImagePreferredDPI();
362 Size aGrfSize;
363
364 if (nPreferredDPI > 0)
365 {
366 auto nWidth = o3tl::toTwips(aSizePixel.Width() / double(nPreferredDPI), o3tl::Length::in);
367 auto nHeight = o3tl::toTwips(aSizePixel.Height() / double(nPreferredDPI), o3tl::Length::in);
368 aGrfSize = Size(nWidth, nHeight);
369 }
370 else
371 {
372 GetGrfSize(aGrfSize);
373 }
374
375 // Add the margin attributes to GrfSize,
376 // because these counts at the margin additionally
377 aGrfSize.AdjustWidth(pFrameMgr->CalcWidthBorder() );
378 aGrfSize.AdjustHeight(pFrameMgr->CalcHeightBorder() );
379
380 const BigInt aTempWidth( aGrfSize.Width() );
381 const BigInt aTempHeight( aGrfSize.Height());
382
383 // Fit width if necessary, scale down the height proportional thereafter.
384 if( aGrfSize.Width() > aBound.Width() )
385 {
386 aGrfSize.setWidth( aBound.Width() );
387 aGrfSize.setHeight( BigInt(aBound.Width()) * aTempHeight / aTempWidth );
388 }
389 // Fit height if necessary, scale down the width proportional thereafter.
390 if( aGrfSize.Height() > aBound.Height() )
391 {
392 aGrfSize.setHeight( aBound.Height() );
393 aGrfSize.setWidth( BigInt(aBound.Height()) * aTempWidth / aTempHeight );
394 }
395 pFrameMgr->SetSize( aGrfSize );
396 pFrameMgr->UpdateFlyFrame();
397 }
398 if ( bOwnMgr )
399 delete pFrameMgr;
400
401 EndUndo();
402 EndAllAction();
403}
404
405// Insert an OLE-Object into the CORE.
406// if no object is transferred, then one will be created.
407
409 sal_uInt16 nSlotId )
410{
412 if( !CanInsert() )
413 return;
414
415 if( !xRef.is() )
416 {
417 // temporary storage
419 uno::Reference < embed::XStorage > xStor = comphelper::OStorageHelper::GetTemporaryStorage();
420 bool bDoVerb = true;
421 if ( pName )
422 {
424 OUString aName;
425 // TODO/LATER: get aspect?
426 xObj.Assign( aCnt.CreateEmbeddedObject( pName->GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT );
427 }
428 else
429 {
430 SvObjectServerList aServerList;
431 switch (nSlotId)
432 {
433 case SID_INSERT_OBJECT:
434 {
435 aServerList.FillInsertObjects();
436 aServerList.Remove( SwDocShell::Factory().GetClassId() );
437 [[fallthrough]];
438 }
439
440 // TODO/LATER: recording! Convert properties to items
441 case SID_INSERT_FLOATINGFRAME:
442 {
443 SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool();
444 const SfxSlot* pSlot = pSlotPool->GetSlot(nSlotId);
445 OString aCmd = OString::Concat(".uno:") + pSlot->GetUnoName();
447 ScopedVclPtr<SfxAbstractInsertObjectDialog> pDlg(pFact->CreateInsertObjectDialog(GetFrameWeld(mxDoc->GetDocShell()),
448 OUString::fromUtf8( aCmd ), xStor, &aServerList));
449 if (pDlg)
450 {
451 pDlg->Execute();
452 bDoVerb = pDlg->IsCreateNew();
453 OUString aIconMediaType;
454 uno::Reference< io::XInputStream > xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType );
455 xObj.Assign( pDlg->GetObject(),
456 xIconMetaFile.is() ? embed::Aspects::MSOLE_ICON : embed::Aspects::MSOLE_CONTENT );
457 if ( xIconMetaFile.is() )
458 xObj.SetGraphicStream( xIconMetaFile, aIconMediaType );
459 }
460
461 break;
462 }
463
464 default:
465 break;
466 }
467 }
468
469 if ( xObj.is() )
470 {
471 if( InsertOleObject( xObj ) && bDoVerb )
472 {
473 SfxInPlaceClient* pClient = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
474 if ( !pClient )
475 {
476 pClient = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
478 }
479
480 if ( xObj.GetViewAspect() == embed::Aspects::MSOLE_ICON )
481 {
482 SwRect aArea = GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() );
483 aArea.Pos() += GetAnyCurRect( CurRectType::FlyEmbedded, nullptr, xObj.GetObject() ).Pos();
484 MapMode aMapMode( MapUnit::MapTwip );
485 Size aSize = xObj.GetSize( &aMapMode );
486 aArea.Width( aSize.Width() );
487 aArea.Height( aSize.Height() );
488 RequestObjectResize( aArea, xObj.GetObject() );
489 }
490 else
491 CalcAndSetScale( xObj );
492
493 //#50270# We don't need to handle error, this is handled by the
494 //DoVerb in the SfxViewShell
495 pClient->DoVerb(embed::EmbedVerbs::MS_OLEVERB_SHOW);
496
497 // TODO/LATER: set document name - should be done in Client
498 }
499 }
500 }
501 else
502 {
503 if( HasSelection() )
504 DelRight();
505 InsertOleObject( xRef );
506 }
507}
508
509// Insert object into the Core.
510// From ClipBoard or Insert
511
513{
514 //tdf#125100 Ensure that ole object is initially shown as pictogram
515 comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = mxDoc->GetDocShell()->getEmbeddedObjectContainer();
516 bool bSaveUserAllowsLinkUpdate = rEmbeddedObjectContainer.getUserAllowsLinkUpdate();
517 rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
518
521
523
524 //Some differences between StarMath and any other objects:
525 //1. Selections should be deleted. For StarMath the Text should be
526 // passed to the Object
527 //2. If the cursor is at the end of a non empty paragraph a paragraph
528 // break should be inserted. StarMath objects are character bound and
529 // no break should be inserted.
530 //3. If an selection is passed to a StarMath object, this object should
531 // not be activated. false should be returned then.
532 bool bStarMath = true;
533 bool bActivate = true;
534
535 // set parent to get correct VisArea(in case of object needing parent printer)
536 uno::Reference < container::XChild > xChild( xRef.GetObject(), uno::UNO_QUERY );
537 if ( xChild.is() )
538 xChild->setParent( mxDoc->GetDocShell()->GetModel() );
539
540 SvGlobalName aCLSID( xRef->getClassID() );
541 bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 );
542 if( IsSelection() )
543 {
544 if( bStarMath )
545 {
546 OUString aMathData;
548
549 if( !aMathData.isEmpty() && svt::EmbeddedObjectRef::TryRunningState( xRef.GetObject() ) )
550 {
551 uno::Reference < beans::XPropertySet > xSet( xRef->getComponent(), uno::UNO_QUERY );
552 if ( xSet.is() )
553 {
554 try
555 {
556 xSet->setPropertyValue("Formula", uno::Any( aMathData ) );
557 bActivate = false;
558 }
559 catch (const uno::Exception&)
560 {
561 }
562 }
563 }
564 }
565 DelRight();
566 }
567
568 if ( !bStarMath )
569 SwFEShell::SplitNode( false, false );
570
572
573 const SvGlobalName* pName = nullptr;
574 SvGlobalName aObjClsId;
575 if (xRef.is())
576 {
577 aObjClsId = SvGlobalName(xRef.GetObject()->getClassID());
578 pName = &aObjClsId;
579 }
580 SwFlyFrameAttrMgr aFrameMgr( true, this, Frmmgr_Type::OLE, pName );
582
583 SwRect aBound;
584 CalcBoundRect( aBound, aFrameMgr.GetAnchor() );
585
586 //The Size should be suggested by the OLE server
587 MapMode aMapMode( MapUnit::MapTwip );
588 Size aSz = xRef.GetSize( &aMapMode );
589
590 //Object size can be limited
591 if ( aSz.Width() > aBound.Width() )
592 {
593 //Always limit proportional.
594 aSz.setHeight( aSz.Height() * aBound.Width() / aSz.Width() );
595 aSz.setWidth( aBound.Width() );
596 }
597 aFrameMgr.SetSize( aSz );
598 SwFlyFrameFormat *pFormat = SwFEShell::InsertObject( xRef, &aFrameMgr.GetAttrSet() );
599
600 // --> #i972#
601 if ( bStarMath && mxDoc->getIDocumentSettingAccess().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT ) )
603
604 if (pFlyFrameFormat)
605 *pFlyFrameFormat = pFormat;
606
607 if ( SotExchange::IsChart( aCLSID ) )
608 {
609 uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = xRef.GetObject();
610 if ( xEmbeddedObj.is() )
611 {
612 bool bDisableDataTableDialog = false;
614 uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY );
615 if ( xProps.is() &&
616 ( xProps->getPropertyValue("DisableDataTableDialog") >>= bDisableDataTableDialog ) &&
617 bDisableDataTableDialog )
618 {
619 xProps->setPropertyValue("DisableDataTableDialog",
620 uno::Any( false ) );
621 xProps->setPropertyValue("DisableComplexChartTypes",
622 uno::Any( false ) );
623 uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY );
624 if ( xModifiable.is() )
625 {
626 xModifiable->setModified( true );
627 }
628 }
629 }
630 }
631
632 EndAllAction();
633 GetView().AutoCaption(OLE_CAP, &aCLSID);
634
635 SwRewriter aRewriter;
636
637 if ( bStarMath )
638 aRewriter.AddRule(UndoArg1, SwResId(STR_MATH_FORMULA));
639 else if ( SotExchange::IsChart( aCLSID ) )
640 aRewriter.AddRule(UndoArg1, SwResId(STR_CHART));
641 else
642 aRewriter.AddRule(UndoArg1, SwResId(STR_OLE));
643
644 EndUndo(SwUndoId::INSERT, &aRewriter);
645
646 rEmbeddedObjectContainer.setUserAllowsLinkUpdate(bSaveUserAllowsLinkUpdate);
647
648 return bActivate;
649}
650
651// The current selected OLE object will be loaded with the
652// verb into the server.
653void SwWrtShell::LaunchOLEObj(sal_Int32 nVerb)
654{
655 if ( GetCntType() != CNT_OLE ||
656 GetView().GetViewFrame()->GetFrame().IsInPlace() )
657 return;
658
660 OSL_ENSURE( xRef.is(), "OLE not found" );
661
662 // LOK: we don't want to handle any other embedded objects than
663 // charts, there are too many problems with eg. embedded spreadsheets
664 // (like it creates a separate view for the calc sheet)
666 {
667 const auto classId = xRef->getClassID();
668 if (!SotExchange::IsChart(classId) && !SotExchange::IsMath(classId))
669 return;
670 }
671
672 SfxInPlaceClient* pCli = GetView().FindIPClient( xRef.GetObject(), &GetView().GetEditWin() );
673 if ( !pCli )
674 pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xRef );
675
676 uno::Reference<lang::XInitialization> xOLEInit(xRef.GetObject(), uno::UNO_QUERY);
677 if (xOLEInit.is())
678 {
679 uno::Sequence<beans::PropertyValue> aArguments
680 = { comphelper::makePropertyValue("ReadOnly", pCli->IsProtected()) };
681 xOLEInit->initialize({ uno::Any(aArguments) });
682 }
683
684 static_cast<SwOleClient*>(pCli)->SetInDoVerb( true );
685
686 CalcAndSetScale( xRef );
687 pCli->DoVerb( nVerb );
688
689 static_cast<SwOleClient*>(pCli)->SetInDoVerb( false );
690 CalcAndSetScale( xRef );
691}
692
694{
695 try
696 {
697 sal_Int32 nState = xObj->getCurrentState();
698 if ( nState == css::embed::EmbedStates::INPLACE_ACTIVE
699 || nState == css::embed::EmbedStates::UI_ACTIVE )
700 {
701 SfxInPlaceClient* pCli =
702 GetView().FindIPClient( xObj.GetObject(), &(GetView().GetEditWin()) );
703 if ( pCli )
704 {
705 tools::Rectangle aArea = pCli->GetObjArea();
706 aArea += rOffset;
707 pCli->SetObjArea( aArea );
708 }
709 }
710 }
711 catch (const uno::Exception&)
712 {
713 }
714}
715
717 const SwRect *pFlyPrtRect,
718 const SwRect *pFlyFrameRect,
719 const bool bNoTextFramePrtAreaChanged )
720{
721 // Setting the scale of the client. This arises from the difference
722 // between the VisArea of the object and the ObjArea.
723 OSL_ENSURE( xObj.is(), "ObjectRef not valid" );
724
725 sal_Int64 nAspect = xObj.GetViewAspect();
726 if ( nAspect == embed::Aspects::MSOLE_ICON )
727 return; // the replacement image is completely controlled by container in this case
728
729 sal_Int64 nMisc = 0;
730 bool bLinkingChart = false;
731
732 try
733 {
734 nMisc = xObj->getStatus( nAspect );
735
736 // This can surely only be a non-active object, if desired they
737 // get the new size set as VisArea (StarChart).
738 if( embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc )
739 {
740 // TODO/MBA: testing
741 SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
743 if( !aRect.IsEmpty() )
744 {
745 // TODO/LEAN: getMapUnit can switch object to running state
746 // xObj.TryRunningState();
747
748 MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
749
750 // TODO/LATER: needs complete VisArea?!
751 Size aSize( OutputDevice::LogicToLogic(aRect.SVRect(), MapMode(MapUnit::MapTwip), MapMode(aUnit)).GetSize() );
752 awt::Size aSz;
753 aSz.Width = aSize.Width();
754 aSz.Height = aSize.Height();
755
756 // Action 'setVisualAreaSize' doesn't have to turn on the
757 // modified state of the document, either.
758 bool bModified = false;
759 uno::Reference<util::XModifiable> xModifiable(xObj->getComponent(), uno::UNO_QUERY);
760 if (xModifiable.is())
761 bModified = xModifiable->isModified();
762 xObj->setVisualAreaSize( nAspect, aSz );
763 xModifiable.set(xObj->getComponent(), uno::UNO_QUERY);
764 if (xModifiable.is() && xModifiable->isModified() && !bModified)
765 xModifiable->setModified(bModified);
766
767 // #i48419# - action 'UpdateReplacement' doesn't
768 // have to change the modified state of the document.
769 // This is only a workaround for the defect, that this action
770 // modifies a document after load, because unnecessarily the
771 // replacement graphic is updated, in spite of the fact that
772 // nothing has been changed.
773 // If the replacement graphic changes by this action, the document
774 // will be already modified via other mechanisms.
775 {
776 bool bResetEnableSetModified(false);
777 if ( GetDoc()->GetDocShell()->IsEnableSetModified() )
778 {
779 GetDoc()->GetDocShell()->EnableSetModified( false );
780 bResetEnableSetModified = true;
781 }
782
783 //#i79576# don't destroy chart replacement images on load
784 //#i79578# don't request a new replacement image for charts to often
785 //a chart sends a modified call to the framework if it was changed
786 //thus the replacement update is already handled elsewhere
787 if ( !SotExchange::IsChart( xObj->getClassID() ) )
788 xObj.UpdateReplacement();
789
790 if ( bResetEnableSetModified )
791 {
793 }
794 }
795 }
796
797 // TODO/LATER: this is only a workaround,
798 uno::Reference< chart2::XChartDocument > xChartDocument( xObj->getComponent(), uno::UNO_QUERY );
799 bLinkingChart = ( xChartDocument.is() && !xChartDocument->hasInternalDataProvider() );
800 }
801 }
802 catch (const uno::Exception&)
803 {
804 // TODO/LATER: handle the error
805 return;
806 }
807
808 SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
809 if ( !pCli )
810 {
811 if ( (embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY & nMisc)
812 || bLinkingChart
813 // --> OD #i117189# - refine condition for non-resizable objects
814 // non-resizable objects need to be set the size back by this method
815 || ( bNoTextFramePrtAreaChanged && nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
816 {
817 pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
818 }
819 else
820 return;
821 }
822
823 // TODO/LEAN: getMapUnit can switch object to running state
824 // xObj.TryRunningState();
825
826 awt::Size aSize;
827 try
828 {
829 aSize = xObj->getVisualAreaSize( nAspect );
830 }
831 catch (const embed::NoVisualAreaSizeException&)
832 {
833 OSL_FAIL("Can't get visual area size!" );
834 // the scaling will not be done
835 }
836 catch (const uno::Exception&)
837 {
838 // TODO/LATER: handle the error
839 OSL_FAIL("Can't get visual area size!" );
840 return;
841 }
842
843 Size _aVisArea( aSize.Width, aSize.Height );
844
845 Fraction aScaleWidth( 1, 1 );
846 Fraction aScaleHeight( 1, 1 );
847
848 bool bUseObjectSize = false;
849
850 // As long as there comes no reasonable size from the object,
851 // nothing can be scaled.
852 if( _aVisArea.Width() && _aVisArea.Height() )
853 {
854 const MapMode aTmp( MapUnit::MapTwip );
855 MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
856 _aVisArea = OutputDevice::LogicToLogic(_aVisArea, MapMode(aUnit), aTmp);
857 Size aObjArea;
858 if ( pFlyPrtRect )
859 aObjArea = pFlyPrtRect->SSize();
860 else
861 aObjArea = GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() ).SSize();
862
863 // differ the aObjArea and _aVisArea by 1 Pixel then set new VisArea
864 tools::Long nX, nY;
865 SwSelPaintRects::Get1PixelInLogic( *this, &nX, &nY );
866 if( !( _aVisArea.Width() - nX <= aObjArea.Width() &&
867 _aVisArea.Width() + nX >= aObjArea.Width() &&
868 _aVisArea.Height()- nY <= aObjArea.Height()&&
869 _aVisArea.Height()+ nY >= aObjArea.Height() ))
870 {
871 if ( nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE )
872 {
873 // the object must not be scaled,
874 // the size stored in object must be used for restoring
875 bUseObjectSize = true;
876 }
877 else
878 {
879 aScaleWidth = Fraction( aObjArea.Width(), _aVisArea.Width() );
880 aScaleHeight = Fraction( aObjArea.Height(), _aVisArea.Height());
881 }
882 }
883 }
884
885 // Now is the favorable time to set the ObjArea.
886 // The Scaling must be considered.
887 SwRect aArea;
888 if ( pFlyPrtRect )
889 {
890 aArea = *pFlyPrtRect;
891 aArea += pFlyFrameRect->Pos();
892 }
893 else
894 {
895 aArea = GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() );
896 aArea.Pos() += GetAnyCurRect( CurRectType::FlyEmbedded, nullptr, xObj.GetObject() ).Pos();
897 }
898
899 if ( bUseObjectSize )
900 {
901 // --> this moves non-resizable object so that when adding borders the baseline remains the same
902 const SwFlyFrameFormat *pFlyFrameFormat = dynamic_cast< const SwFlyFrameFormat * >( GetFlyFrameFormat() );
903 OSL_ENSURE( pFlyFrameFormat, "Could not find fly frame." );
904 if ( pFlyFrameFormat )
905 {
906 const Point &rPoint = pFlyFrameFormat->GetLastFlyFramePrtRectPos();
907 SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
909 aArea += rPoint - aRect.Pos(); // adjust area by diff of printing area position in order to keep baseline alignment correct.
910 }
911 aArea.Width ( _aVisArea.Width() );
912 aArea.Height( _aVisArea.Height() );
913 RequestObjectResize( aArea, xObj.GetObject() );
914 }
915 else
916 {
917 aArea.Width ( tools::Long( aArea.Width() / pCli->GetScaleWidth() ) );
918 aArea.Height( tools::Long( aArea.Height() / pCli->GetScaleHeight() ) );
919 }
920
921 pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );
922}
923
925 const SwRect &rFrame )
926{
927 SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin());
928 if ( !pCli )
929 new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
930 CalcAndSetScale( xObj, &rPrt, &rFrame );
931}
932
933// Insert hard page break;
934// Selections will be overwritten
935void SwWrtShell::InsertPageBreak(const OUString *pPageDesc, const ::std::optional<sal_uInt16>& oPgNum )
936{
937 if (!lcl_IsAllowed(this))
938 return;
939
941 if( CanInsert() )
942 {
943 SwActContext aActContext(this);
945
946 if ( !IsCursorInTable() )
947 {
948 if(HasSelection())
949 DelRight();
951 // delete the numbered attribute of the last line if the last line is empty
952 GetDoc()->ClearLineNumAttrs( *GetCursor()->GetPoint() );
953 }
954
955 const SwPageDesc *pDesc = pPageDesc
956 ? FindPageDescByName( *pPageDesc, true ) : nullptr;
957 if( pDesc )
958 {
959 SwFormatPageDesc aDesc( pDesc );
960 aDesc.SetNumOffset( oPgNum );
961 SetAttrItem( aDesc );
962 }
963 else
964 SetAttrItem( SvxFormatBreakItem(SvxBreak::PageBefore, RES_BREAK) );
966 }
967 collectUIInformation("BREAK_PAGE", "parameter");
968}
969
970// Insert hard page break;
971// Selections will be overwritten
972
973void SwWrtShell::InsertLineBreak(std::optional<SwLineBreakClear> oClear)
974{
975 if (!lcl_IsAllowed(this))
976 return;
977
979 if( CanInsert() )
980 {
981 if(HasSelection())
982 DelRight();
983
984 const sal_Unicode cIns = 0x0A;
986 if (oClear.has_value())
987 {
988 eClear = *oClear;
989 }
990 SvxAutoCorrect* pACorr = lcl_IsAutoCorr();
991 if (pACorr && eClear == SwLineBreakClear::NONE)
992 AutoCorrect( *pACorr, cIns );
993 else
994 {
995 if (eClear == SwLineBreakClear::NONE)
996 {
997 SwWrtShell::Insert(OUString(cIns));
998 }
999 else
1000 {
1001 SwFormatLineBreak aLineBreak(eClear);
1002 SetAttrItem(aLineBreak);
1003 }
1004 }
1005 }
1006}
1007
1008// Insert hard column break;
1009// Selections will be overwritten
1010
1012{
1013 if (!lcl_IsAllowed(this))
1014 return;
1015
1016 SwActContext aActContext(this);
1018 if( !CanInsert() )
1019 return;
1020
1022
1023 if ( !IsCursorInTable() )
1024 {
1025 if(HasSelection())
1026 DelRight();
1027 SwFEShell::SplitNode( false, false );
1028 }
1029 SetAttrItem(SvxFormatBreakItem(SvxBreak::ColumnBefore, RES_BREAK));
1030
1032}
1033
1035{
1036 if (!lcl_IsAllowed(this))
1037 {
1038 return;
1039 }
1040
1042 if (!CanInsert())
1043 {
1044 return;
1045 }
1046
1047 auto pContentControl = std::make_shared<SwContentControl>(nullptr);
1048 OUString aPlaceholder;
1049 switch (eType)
1050 {
1053 {
1054 pContentControl->SetShowingPlaceHolder(true);
1056 {
1057 pContentControl->SetPlainText(true);
1058 }
1059 if (!HasSelection())
1060 {
1061 aPlaceholder = SwResId(STR_CONTENT_CONTROL_PLACEHOLDER);
1062 }
1063 break;
1064 }
1066 {
1067 pContentControl->SetCheckbox(true);
1068 // Ballot Box with X
1069 pContentControl->SetCheckedState(u"\u2612");
1070 // Ballot Box
1071 pContentControl->SetUncheckedState(OUString(u"\u2610"));
1072 aPlaceholder = u"\u2610";
1073 break;
1074 }
1077 {
1079 {
1080 pContentControl->SetComboBox(true);
1081 }
1083 {
1084 pContentControl->SetDropDown(true);
1085 }
1086
1087 pContentControl->SetShowingPlaceHolder(true);
1088 if (!HasSelection())
1089 {
1090 aPlaceholder = SwResId(STR_DROPDOWN_CONTENT_CONTROL_PLACEHOLDER);
1091 }
1092 SwContentControlListItem aListItem;
1093 aListItem.m_aValue = aPlaceholder;
1094 pContentControl->SetListItems({ aListItem });
1095 break;
1096 }
1098 {
1099 // Set up the picture content control.
1100 pContentControl->SetShowingPlaceHolder(true);
1101 pContentControl->SetPicture(true);
1102
1103 // Create the placeholder bitmap.
1104 BitmapEx aBitmap(Size(1, 1), vcl::PixelFormat::N24_BPP);
1106 aColor.IncreaseLuminance(255 * 0.75);
1107 aBitmap.Erase(aColor);
1108 SwRewriter aRewriter;
1109 aRewriter.AddRule(UndoArg1, SwResId(STR_GRAPHIC_DEFNAME));
1110 StartUndo(SwUndoId::INSERT, &aRewriter);
1111 LockPaint();
1112 StartAction();
1113 InsertGraphic(OUString(), OUString(), aBitmap, nullptr, RndStdIds::FLY_AS_CHAR);
1114
1115 // Set properties on the bitmap.
1117 GetFlyFrameAttr(aSet);
1118 SwFormatFrameSize aSize(SwFrameSize::Fixed, 3000, 3000);
1119 aSet.Put(aSize);
1120 SetFlyFrameAttr(aSet);
1121 SwFrameFormat* pFrameFormat = GetFlyFrameFormat();
1122 EndAction();
1123 UnlockPaint();
1124 EndUndo();
1125
1126 // Go after the anchor position.
1127 UnSelectFrame();
1129 {
1130 SwCursor* pCursor = getShellCursor(true);
1131 pCursor->DeleteMark();
1132 const SwFormatAnchor& rFormatAnchor = pFrameFormat->GetAnchor();
1133 pCursor->GetPoint()->Assign( *rFormatAnchor.GetAnchorContentNode(), rFormatAnchor.GetAnchorContentOffset() + 1);
1134 }
1135
1136 // Select before the anchor position.
1137 Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false);
1138 break;
1139 }
1141 {
1142 pContentControl->SetShowingPlaceHolder(true);
1143 pContentControl->SetDate(true);
1144 SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter();
1145 sal_uInt32 nStandardFormat = pFormatter->GetStandardFormat(SvNumFormatType::DATE);
1146 const SvNumberformat* pFormat = pFormatter->GetEntry(nStandardFormat);
1147 pContentControl->SetDateFormat(pFormat->GetFormatstring());
1148 pContentControl->SetDateLanguage(LanguageTag(pFormat->GetLanguage()).getBcp47());
1149 if (!HasSelection())
1150 {
1151 aPlaceholder = SwResId(STR_DATE_CONTENT_CONTROL_PLACEHOLDER);
1152 }
1153 break;
1154 }
1155 }
1156 if (aPlaceholder.getLength())
1157 {
1158 Insert(aPlaceholder);
1159 Left(SwCursorSkipMode::Chars, /*bSelect=*/true, aPlaceholder.getLength(),
1160 /*bBasicCall=*/false);
1161 }
1162 SwFormatContentControl aContentControl(pContentControl, RES_TXTATR_CONTENTCONTROL);
1163 SetAttrItem(aContentControl);
1164}
1165
1166// Insert footnote
1167// rStr - optional footnote mark
1168
1169void SwWrtShell::InsertFootnote(const OUString &rStr, bool bEndNote, bool bEdit )
1170{
1172 if( !CanInsert() )
1173 return;
1174
1175 if(HasSelection())
1176 {
1177 //collapse cursor to the end
1178 if(!IsCursorPtAtEnd())
1179 SwapPam();
1180 ClearMark();
1181 }
1182 SwPosition aPos = *GetCursor()->GetPoint();
1183 SwFormatFootnote aFootNote( bEndNote );
1184 if(!rStr.isEmpty())
1185 aFootNote.SetNumStr( rStr );
1186
1187 SetAttrItem(aFootNote);
1188
1189 if( bEdit )
1190 {
1191 // For editing the footnote text.
1192 Left(SwCursorSkipMode::Chars, false, 1, false );
1194 }
1196}
1197
1198// tdf#141634
1200{
1201 SwTextNode* pTextNode = pThis->GetCursor()->GetPointNode().GetTextNode();
1202 if (pTextNode && pTextNode->IsOutline())
1203 {
1204 bool bVisible = true;
1206 if (!bVisible)
1207 {
1208 const SwNodes& rNodes = pThis->GetNodes();
1209 const SwOutlineNodes& rOutlineNodes = rNodes.GetOutLineNds();
1211 (void) rOutlineNodes.Seek_Entry(pTextNode, &nPos);
1212
1213 SwNode* pSttNd = rOutlineNodes[nPos];
1214
1215 // determine end node of folded outline content
1216 SwNode* pEndNd = &rNodes.GetEndOfContent();
1217 if (rOutlineNodes.size() > nPos + 1)
1218 pEndNd = rOutlineNodes[nPos + 1];
1219
1221 {
1222 // get the next outline node after the folded outline content (iPos)
1223 // it is the next outline node with the same level or less
1224 int nLevel = pSttNd->GetTextNode()->GetAttrOutlineLevel();
1226 while (++iPos < rOutlineNodes.size() &&
1227 rOutlineNodes[iPos]->GetTextNode()->GetAttrOutlineLevel() > nLevel);
1228
1229 // get the correct end node
1230 // the outline node may be in frames, headers, footers special section of doc model
1231 SwNode* pStartOfSectionNodeSttNd = pSttNd->StartOfSectionNode();
1232 while (pStartOfSectionNodeSttNd->StartOfSectionNode()
1233 != pStartOfSectionNodeSttNd->StartOfSectionNode()->StartOfSectionNode())
1234 {
1235 pStartOfSectionNodeSttNd = pStartOfSectionNodeSttNd->StartOfSectionNode();
1236 }
1237 pEndNd = pStartOfSectionNodeSttNd->EndOfSectionNode();
1238
1239 if (iPos < rOutlineNodes.size())
1240 {
1241 SwNode* pStartOfSectionNode = rOutlineNodes[iPos]->StartOfSectionNode();
1242 while (pStartOfSectionNode->StartOfSectionNode()
1243 != pStartOfSectionNode->StartOfSectionNode()->StartOfSectionNode())
1244 {
1245 pStartOfSectionNode = pStartOfSectionNode->StartOfSectionNode();
1246 }
1247 if (pStartOfSectionNodeSttNd == pStartOfSectionNode)
1248 pEndNd = rOutlineNodes[iPos];
1249 }
1250 }
1251
1252 // table, text box, header, footer
1253 if (pSttNd->GetTableBox() || pSttNd->GetIndex() < rNodes.GetEndOfExtras().GetIndex())
1254 {
1255 // insert before section end node
1256 if (pSttNd->EndOfSectionIndex() < pEndNd->GetIndex())
1257 {
1258 SwNodeIndex aIdx(*pSttNd->EndOfSectionNode());
1259 while (aIdx.GetNode().IsEndNode())
1260 --aIdx;
1261 ++aIdx;
1262 pEndNd = &aIdx.GetNode();
1263 }
1264 }
1265 // if pSttNd isn't in table but pEndNd is then insert after table
1266 else if (pEndNd->GetTableBox())
1267 {
1268 pEndNd = pEndNd->FindTableNode();
1269 SwNodeIndex aIdx(*pEndNd, -1);
1270 // account for nested tables
1271 while (aIdx.GetNode().GetTableBox())
1272 {
1273 pEndNd = aIdx.GetNode().FindTableNode();
1274 aIdx.Assign(*pEndNd, -1);
1275 }
1276 aIdx.Assign(*pEndNd->EndOfSectionNode(), +1);
1277 pEndNd = &aIdx.GetNode();
1278 }
1279 // end node determined
1280
1281 // now insert the new outline node
1282 SwDoc* pDoc = pThis->GetDoc();
1283
1284 // insert at end of tablebox doesn't work correct without
1286
1287 SwTextNode* pNd = pDoc->GetNodes().MakeTextNode(*pEndNd, pTextNode->GetTextColl(), true);
1288
1289 (void) rOutlineNodes.Seek_Entry(pNd, &nPos);
1290 pThis->GotoOutline(nPos);
1291
1292 if (pDoc->GetIDocumentUndoRedo().DoesUndo())
1293 {
1294 pDoc->GetIDocumentUndoRedo().ClearRedo();
1295 pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsert>(*pNd));
1296 pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoFormatColl>
1297 (SwPaM(*pNd), pNd->GetTextColl(), true, true));
1298 }
1299
1300 pThis->SetModified();
1301 return true;
1302 }
1303 }
1304 return false;
1305}
1306
1307// SplitNode; also, because
1308// - of deleting selected content;
1309// - of reset of the Cursorstack if necessary.
1310
1311void SwWrtShell::SplitNode( bool bAutoFormat )
1312{
1314 if( !CanInsert() )
1315 return;
1316
1317 SwActContext aActContext(this);
1318
1321
1322 bool bHasSel = HasSelection();
1323 if (bHasSel)
1324 DelRight();
1325
1326 bool bHandled = false;
1327 if (GetViewOptions()->IsShowOutlineContentVisibilityButton() && IsEndPara())
1328 bHandled = lcl_FoldedOutlineNodeEndOfParaSplit(this);
1329
1330 if (!bHandled)
1331 SwFEShell::SplitNode( bAutoFormat );
1332
1334}
1335
1336// Turn on numbering
1337// Parameter: Optional specification of a name for the named list;
1338// this indicates a position if it is possible to convert them
1339// into a number and less than nMaxRules.
1340
1341// To test the CharFormats at the numbering
1342// external void SetNumChrFormat( SwWrtShell*, SwNumRules& );
1343
1344// -> #i40041#
1345// Preconditions (as far as OD has figured out):
1346// - <SwEditShell::HasNumber()> is false, if <bNum> is true
1347// - <SwEditShell::HasBullet()> is false, if <bNum> is false
1348// Behavior of method is determined by the current situation at the current
1349// cursor position in the document.
1351{
1352 // determine numbering rule found at current cursor position in the document.
1353 const SwNumRule* pCurRule = GetNumRuleAtCurrCursorPos();
1354
1356
1357 const SwNumRule * pNumRule = pCurRule;
1358
1359 // - activate outline rule respectively turning on outline rule for
1360 // current text node. But, only for turning on a numbering (<bNum> == true).
1361 // - overwrite found numbering rule at current cursor position, if
1362 // no numbering rule can be retrieved from the paragraph style.
1363 bool bContinueFoundNumRule( false );
1364 bool bActivateOutlineRule( false );
1365 int nActivateOutlineLvl( MAXLEVEL ); // only relevant, if <bActivateOutlineRule> == true
1367 if ( pColl )
1368 {
1369 // retrieve numbering rule at paragraph
1370 // style, which is found at current cursor position in the document.
1371 SwNumRule* pCollRule = mxDoc->FindNumRulePtr(pColl->GetNumRule().GetValue());
1372 // #125993# - The outline numbering rule isn't allowed
1373 // to be derived from a parent paragraph style to a derived one.
1374 // Thus check, if the found outline numbering rule is directly
1375 // set at the paragraph style <pColl>. If not, set <pCollRule> to NULL
1376 if ( pCollRule && pCollRule == GetDoc()->GetOutlineNumRule() )
1377 {
1378 const SwNumRule* pDirectCollRule =
1379 mxDoc->FindNumRulePtr(pColl->GetNumRule( false ).GetValue());
1380 if ( !pDirectCollRule )
1381 {
1382 pCollRule = nullptr;
1383 }
1384 }
1385
1386 if ( !pCollRule )
1387 {
1388 pNumRule = pCollRule;
1389 }
1390 // no activation or continuation of outline numbering in Writer/Web document
1391 else if ( bNum &&
1392 !dynamic_cast<SwWebDocShell*>(GetDoc()->GetDocShell()) &&
1393 pCollRule == GetDoc()->GetOutlineNumRule() )
1394 {
1395 if ( pNumRule == pCollRule )
1396 {
1397 // check, if text node at current cursor positioned is counted.
1398 // If not, let it been counted. Then it has to be checked,
1399 // of the outline numbering has to be activated or continued.
1400 SwTextNode const*const pTextNode = sw::GetParaPropsNode(
1401 *GetLayout(), GetCursor()->GetPoint()->GetNode());
1402 if ( pTextNode && !pTextNode->IsCountedInList() )
1403 {
1404 // check, if numbering of the outline level of the paragraph
1405 // style is active. If not, activate this outline level.
1406 nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1407 OSL_ENSURE( pColl->IsAssignedToListLevelOfOutlineStyle(),
1408 "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
1410 pCollRule->Get( o3tl::narrowing<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1412 {
1413 // activate outline numbering
1414 bActivateOutlineRule = true;
1415 }
1416 else
1417 {
1418 // turning on outline numbering at current cursor position
1419 bContinueFoundNumRule = true;
1420 }
1421 }
1422 else
1423 {
1424 // #i101234#
1425 // activate outline numbering, because from the precondition
1426 // it's known, that <SwEdit::HasNumber()> == false
1427 bActivateOutlineRule = true;
1428 nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1429 }
1430 }
1431 else if ( !pNumRule )
1432 {
1433 // #i101234#
1434 // Check, if corresponding list level of the outline numbering
1435 // has already a numbering format set.
1436 nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1437 if ( pCollRule->Get( o3tl::narrowing<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1439 {
1440 // activate outline numbering, because from the precondition
1441 // it's known, that <SwEdit::HasNumber()> == false
1442 bActivateOutlineRule = true;
1443 }
1444 else
1445 {
1446 // turning on outline numbering at current cursor position
1447 bContinueFoundNumRule = true;
1448 }
1449 }
1450 else
1451 {
1452 // check, if numbering of the outline level of the paragraph
1453 // style is active. If not, activate this outline level.
1454 nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1455 OSL_ENSURE( pColl->IsAssignedToListLevelOfOutlineStyle(),
1456 "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
1458 pCollRule->Get( o3tl::narrowing<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1460 {
1461 // activate outline numbering
1462 bActivateOutlineRule = true;
1463 }
1464 else
1465 {
1466 // turning on outline numbering at current cursor position
1467 bContinueFoundNumRule = true;
1468 }
1469 }
1470 pNumRule = pCollRule;
1471 }
1472 }
1473
1474 // Only automatic numbering/bullet rules should be changed.
1475 // Note: The outline numbering rule is also an automatic one. It's only
1476 // changed, if it has to be activated.
1477 if ( pNumRule )
1478 {
1479 if ( !pNumRule->IsAutoRule() )
1480 {
1481 pNumRule = nullptr;
1482 }
1483 else if ( pNumRule == GetDoc()->GetOutlineNumRule() &&
1484 !bActivateOutlineRule && !bContinueFoundNumRule )
1485 {
1486 pNumRule = nullptr;
1487 }
1488 }
1489
1490 // Search for a previous numbering/bullet rule to continue it.
1491 OUString sContinuedListId;
1492 if ( !pNumRule )
1493 {
1494 pNumRule = GetDoc()->SearchNumRule( *GetCursor()->GetPoint(),
1495 false, bNum, false, 0,
1496 sContinuedListId, GetLayout() );
1497 bContinueFoundNumRule = pNumRule != nullptr;
1498 }
1499
1500 if (pNumRule)
1501 {
1502 SwNumRule aNumRule(*pNumRule);
1503
1504 // do not change found numbering/bullet rule, if it should only be continued.
1505 if ( !bContinueFoundNumRule )
1506 {
1507 SwTextNode const*const pTextNode = sw::GetParaPropsNode(
1508 *GetLayout(), GetCursor()->GetPoint()->GetNode());
1509
1510 if (pTextNode)
1511 {
1512 // use above retrieve outline level, if outline numbering has to be activated.
1513 int nLevel = bActivateOutlineRule
1514 ? nActivateOutlineLvl
1515 : pTextNode->GetActualListLevel();
1516
1517 if (nLevel < 0)
1518 nLevel = 0;
1519
1520 if (nLevel >= MAXLEVEL)
1521 nLevel = MAXLEVEL - 1;
1522
1523 SwNumFormat aFormat(aNumRule.Get(o3tl::narrowing<sal_uInt16>(nLevel)));
1524
1525 if (bNum)
1527 else
1528 {
1529 // #i63395# Only apply user defined default bullet font
1531 {
1532 const vcl::Font* pFnt = &numfunc::GetDefBulletFont();
1533 aFormat.SetBulletFont( pFnt );
1534 }
1535 aFormat.SetBulletChar( numfunc::GetBulletChar(static_cast<sal_uInt8>(nLevel)));
1537 // #i93908# clear suffix for bullet lists
1538 aFormat.SetListFormat("", "", nLevel);
1539 }
1540 aNumRule.Set(o3tl::narrowing<sal_uInt16>(nLevel), aFormat);
1541 }
1542 }
1543
1544 // reset indent attribute on applying list style
1545 SetCurNumRule( aNumRule, false, sContinuedListId, true );
1546 }
1547 else
1548 {
1549 // #i95907#
1550 const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
1552 SwNumRule aNumRule( GetUniqueNumRuleName(), ePosAndSpaceMode );
1553 // Append the character template at the numbering.
1554 SwCharFormat* pChrFormat;
1555 SwDocShell* pDocSh = GetView().GetDocShell();
1556 // #i63395#
1557 // Only apply user defined default bullet font
1560 : nullptr;
1561
1562 if (bNum)
1563 {
1565 }
1566 else
1567 {
1569 }
1570
1571 const SwTextNode *const pTextNode = sw::GetParaPropsNode(*GetLayout(),
1572 GetCursor()->GetPoint()->GetNode());
1573 const SwTwips nWidthOfTabs = pTextNode
1574 ? pTextNode->GetWidthOfLeadingTabs()
1575 : 0;
1577
1578 const bool bHtml = dynamic_cast<SwWebDocShell*>( pDocSh ) != nullptr;
1579 const bool bRightToLeft = IsInRightToLeftText();
1580 for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl )
1581 {
1582 SwNumFormat aFormat( aNumRule.Get( nLvl ) );
1583 aFormat.SetCharFormat( pChrFormat );
1584
1585 if (! bNum)
1586 {
1587 // #i63395#
1588 // Only apply user defined default bullet font
1589 if ( pFnt )
1590 {
1591 aFormat.SetBulletFont( pFnt );
1592 }
1593 aFormat.SetBulletChar( numfunc::GetBulletChar(nLvl) );
1595 // #i93908# clear suffix for bullet lists
1596 aFormat.SetListFormat("", "", nLvl);
1597 }
1598
1599 // #i95907#
1600 if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1601 {
1602 if(bHtml && nLvl)
1603 {
1604 // 1/2" for HTML
1605 aFormat.SetAbsLSpace(nLvl * 720);
1606 }
1607 else if ( nWidthOfTabs > 0 )
1608 {
1609 aFormat.SetAbsLSpace(nWidthOfTabs + nLvl * 720);
1610 }
1611 }
1612
1613 // #i38904# Default alignment for
1614 // numbering/bullet should be rtl in rtl paragraph:
1615 if ( bRightToLeft )
1616 {
1617 aFormat.SetNumAdjust( SvxAdjust::Right );
1618 }
1619
1620 aNumRule.Set( nLvl, aFormat );
1621 }
1622
1623 // #i95907#
1624 if ( pTextNode &&
1625 ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1626 {
1627
1628 const SwTwips nTextNodeIndent = pTextNode->GetAdditionalIndentForStartingNewList();
1629 if ( ( nTextNodeIndent + nWidthOfTabs ) != 0 )
1630 {
1631 // #i111172#/fdo#85666
1632 // If text node is already inside a list, assure that the indents
1633 // are the same. Thus, adjust the indent change value by subtracting
1634 // indents of to be applied list style.
1635 SwTwips nIndentChange = nTextNodeIndent + nWidthOfTabs;
1636 if ( pTextNode->GetNumRule() )
1637 {
1638 int nLevel = pTextNode->GetActualListLevel();
1639
1640 if (nLevel < 0)
1641 nLevel = 0;
1642
1643 if (nLevel >= MAXLEVEL)
1644 nLevel = MAXLEVEL - 1;
1645
1646 const SwNumFormat& aFormat( aNumRule.Get( nLevel ) );
1648 {
1649 nIndentChange -= aFormat.GetIndentAt() + aFormat.GetFirstLineIndent();
1650 }
1651 }
1652 aNumRule.ChangeIndent( nIndentChange );
1653 }
1654 }
1655 // reset indent attribute on applying list style
1656 // start new list
1657 SetCurNumRule( aNumRule, true, OUString(), true );
1658 }
1659
1661}
1662// <- #i40041#
1663
1665{
1666 NumOrBulletOn(true);
1667}
1668
1670{
1671 const SwNumRule * pCurNumRule = GetNumRuleAtCurrCursorPos();
1672
1673 if (!pCurNumRule)
1674 return;
1675
1676 if (pCurNumRule->IsOutlineRule())
1677 {
1678 SwNumRule aNumRule(*pCurNumRule);
1679
1680 SwTextNode * pTextNode =
1681 sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->GetNode());
1682
1683 if (pTextNode)
1684 {
1685 int nLevel = pTextNode->GetActualListLevel();
1686
1687 if (nLevel < 0)
1688 nLevel = 0;
1689
1690 if (nLevel >= MAXLEVEL)
1691 nLevel = MAXLEVEL - 1;
1692
1693 SwNumFormat aFormat(aNumRule.Get(o3tl::narrowing<sal_uInt16>(nLevel)));
1694
1696 aNumRule.Set(nLevel, aFormat);
1697
1698 // no start or continuation of a list - the outline style is only changed.
1699 SetCurNumRule( aNumRule, false );
1700 }
1701 }
1702 else
1703 {
1704 DelNumRules();
1705 }
1706
1707 // #126346# - Cursor can not be anymore in front of
1708 // a label, because numbering/bullet is switched off.
1709 SetInFrontOfLabel( false );
1710}
1711// <- #i29560#
1712
1713// Request Default-Bulletlist
1714
1716{
1717 NumOrBulletOn(false);
1718}
1719
1721{
1722 // ContentType cannot be determined within a Start-/EndAction.
1723 // Because there is no invalid value TEXT will be returned.
1724 // The value does not matter, it may be updated in EndAction anyway.
1725
1726 if (ActionPend())
1728
1729 SwView &_rView = const_cast<SwView&>(GetView());
1730 if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
1731 return SelectionType::PostIt;
1732
1733 // Inserting a frame is not a DrawMode
1734 SelectionType nCnt;
1735 if ( !_rView.GetEditWin().IsFrameAction() &&
1736 (IsObjSelected() || (_rView.IsDrawMode() && !IsFrameSelected()) ))
1737 {
1738 if (GetDrawView()->IsTextEdit())
1740 else
1741 {
1742 if (GetView().IsFormMode()) // Only Form selected
1743 nCnt = SelectionType::DbForm;
1744 else
1745 nCnt = SelectionType::DrawObject; // Any draw object
1746
1747 if (_rView.IsBezierEditMode())
1749 else if( GetDrawView()->GetContext() == SdrViewContext::Media )
1750 nCnt |= SelectionType::Media;
1751
1752 if (svx::checkForSelectedCustomShapes( GetDrawView(), true /* bOnlyExtruded */ ))
1753 {
1755 }
1756
1758 {
1760 }
1761 }
1762
1763 return nCnt;
1764 }
1765
1766 nCnt = static_cast<SelectionType>(GetCntType());
1767
1768 if ( IsFrameSelected() )
1769 {
1770 if (_rView.IsDrawMode())
1771 _rView.LeaveDrawCreate(); // clean up (Bug #45639)
1772 if ( !(nCnt & (SelectionType::Graphic | SelectionType::Ole)) )
1773 return SelectionType::Frame;
1774 }
1775
1776 if ( IsCursorInTable() )
1777 nCnt |= SelectionType::Table;
1778
1779 if ( IsTableMode() )
1780 {
1783 if ( eTableSel == SwTable::SEARCH_ROW )
1785 else if ( eTableSel == SwTable::SEARCH_COL )
1787 }
1788
1789 // Do not pop up numbering toolbar, if the text node has a numbering of type SVX_NUM_NUMBER_NONE.
1790 const SwNumRule* pNumRule = GetNumRuleAtCurrCursorPos();
1791 if ( pNumRule )
1792 {
1793 const SwTextNode* pTextNd =
1794 sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->GetNode());
1795
1796 if ( pTextNd && pTextNd->IsInList() )
1797 {
1798 int nLevel = pTextNd->GetActualListLevel();
1799
1800 if (nLevel < 0)
1801 nLevel = 0;
1802
1803 if (nLevel >= MAXLEVEL)
1804 nLevel = MAXLEVEL - 1;
1805
1806 const SwNumFormat& rFormat = pNumRule->Get(nLevel);
1807 if ( SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType() )
1809 }
1810 }
1811
1812 return nCnt;
1813}
1814
1815// Find the text collection with the name rCollname
1816// Returns: Pointer at the collection or 0, if no
1817// text collection with this name exists, or
1818// this is a default template.
1819
1820SwTextFormatColl *SwWrtShell::GetParaStyle(const OUString &rCollName, GetStyle eCreate )
1821{
1822 SwTextFormatColl* pColl = FindTextFormatCollByName( rCollName );
1823 if( !pColl && GETSTYLE_NOCREATE != eCreate )
1824 {
1826 if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
1827 pColl = GetTextCollFromPool( nId );
1828 }
1829 return pColl;
1830}
1831
1832// Find the text collection with the name rCollname
1833// Returns: Pointer at the collection or 0, if no
1834// character template with this name exists, or
1835// this is a default template or template is automatic.
1836
1837SwCharFormat *SwWrtShell::GetCharStyle(const OUString &rFormatName, GetStyle eCreate )
1838{
1839 SwCharFormat* pFormat = FindCharFormatByName( rFormatName );
1840 if( !pFormat && GETSTYLE_NOCREATE != eCreate )
1841 {
1843 if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
1844 pFormat = static_cast<SwCharFormat*>(GetFormatFromPool( nId ));
1845 }
1846 return pFormat;
1847}
1848
1849// Find the table format with the name rFormatname
1850// Returns: Pointer at the collection or 0, if no
1851// frame format with this name exists or
1852// this is a default format or the format is automatic.
1853
1854SwFrameFormat *SwWrtShell::GetTableStyle(std::u16string_view rFormatName)
1855{
1856 for( size_t i = GetTableFrameFormatCount(); i; )
1857 {
1858 SwFrameFormat *pFormat = &GetTableFrameFormat( --i );
1859 if( !pFormat->IsDefault() &&
1860 pFormat->GetName() == rFormatName && IsUsed( *pFormat ) )
1861 return pFormat;
1862 }
1863 return nullptr;
1864}
1865
1867 SwPaM* pPaM = GetCursor();
1869}
1870
1871// Applying templates
1872
1873void SwWrtShell::SetPageStyle(const OUString &rCollName)
1874{
1876 {
1877 SwPageDesc* pDesc = FindPageDescByName( rCollName, true );
1878 if( pDesc )
1879 ChgCurPageDesc( *pDesc );
1880 }
1881}
1882
1883// Access templates
1884
1885OUString const & SwWrtShell::GetCurPageStyle() const
1886{
1887 return GetPageDesc(GetCurPageDesc( false/*bCalcFrame*/ )).GetName();
1888}
1889
1890// Change the current template referring to the existing change.
1891
1893{
1895
1896 // Default cannot be changed
1897 if(pColl && !pColl->IsDefault())
1898 {
1899 FillByEx(pColl);
1900 // Also apply the template to remove hard attribute assignment.
1901 SetTextFormatColl(pColl);
1902 }
1903}
1904
1905void SwWrtShell::AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM )
1906{
1907 SwPaM* pCursor = pPaM ? pPaM : GetCursor( );
1912 SID_ATTR_TABSTOP_DEFAULTS,SID_ATTR_TABSTOP_OFFSET,
1913 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
1914 SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
1915 SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM> aCoreSet( GetAttrPool() );
1916 GetPaMAttr( pCursor, aCoreSet );
1917 bool bReset = false;
1918 SfxItemIter aParaIter( aCoreSet );
1919 for (auto pParaItem = aParaIter.GetCurItem(); pParaItem; pParaItem = aParaIter.NextItem())
1920 {
1921 if(!IsInvalidItem(pParaItem))
1922 {
1923 sal_uInt16 nWhich = pParaItem->Which();
1924 if(SfxItemState::SET == aParaIter.GetItemState() &&
1925 SfxItemState::SET == rStyleSet.GetItemState(nWhich))
1926 {
1927 aParaIter.ClearItem();
1928 bReset = true;
1929 }
1930 }
1931 }
1932 StartAction();
1933 if(bReset)
1934 {
1935 ResetAttr({}, pCursor);
1936 SetAttrSet(aCoreSet, SetAttrMode::DEFAULT, pCursor);
1937 }
1938 mxDoc->ChgFormat(*pColl, rStyleSet );
1939 EndAction();
1940}
1941
1942void SwWrtShell::AutoUpdateFrame( SwFrameFormat* pFormat, const SfxItemSet& rStyleSet )
1943{
1944 StartAction();
1945
1946 ResetFlyFrameAttr( &rStyleSet );
1947 pFormat->SetFormatAttr( rStyleSet );
1948
1949 EndAction();
1950}
1951
1953{
1955 if(!CanInsert())
1956 return;
1957
1958 bool bStarted = false;
1959 SwRewriter aRewriter;
1960
1961 if(HasSelection())
1962 {
1963 // Only parentheses here, because the regular insert
1964 // is already clipped to the editshell
1966
1967 OUString aTmpStr1 = SwResId(STR_START_QUOTE) +
1968 GetSelText() +
1969 SwResId(STR_END_QUOTE);
1970 OUString aTmpStr3 = SwResId(STR_START_QUOTE) +
1971 OUStringChar(cChar) +
1972 SwResId(STR_END_QUOTE);
1973 aRewriter.AddRule( UndoArg1, aTmpStr1 );
1974 aRewriter.AddRule( UndoArg2, SwResId(STR_YIELDS) );
1975 aRewriter.AddRule( UndoArg3, aTmpStr3 );
1976
1977 StartUndo( SwUndoId::REPLACE, &aRewriter );
1978 bStarted = true;
1979 DelRight(true);
1980 }
1981 SwEditShell::AutoCorrect( rACorr, IsInsMode(), cChar );
1982
1983 if(bStarted)
1984 {
1985 EndAllAction();
1986 EndUndo( SwUndoId::REPLACE, &aRewriter );
1987 }
1988}
1989
1990// Some kind of controlled copy ctor
1991
1993 : SwFEShell(rSh, _pWin)
1994 , m_rView(rShell)
1995 , m_aNavigationMgr(*this)
1996{
1998 CurrShell aCurr( this );
1999
2000 SetSfxViewShell( static_cast<SfxViewShell *>(&rShell) );
2001 SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
2002
2003 // place the cursor on the first field...
2004 IFieldmark *pBM = nullptr;
2005 if (IsFormProtected() && (pBM = GetFieldmarkAfter(/*bLoop=*/true)) !=nullptr) {
2006 GotoFieldmark(pBM);
2007 }
2008}
2009
2011 const SwViewOption *pViewOpt )
2012 : SwFEShell(rDoc, _pWin, pViewOpt)
2013 , m_rView(rShell)
2014 , m_aNavigationMgr(*this)
2015{
2017 CurrShell aCurr( this );
2018 SetSfxViewShell( static_cast<SfxViewShell *>(&rShell) );
2019 SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
2020
2021 // place the cursor on the first field...
2022 IFieldmark *pBM = nullptr;
2023 if (IsFormProtected() && (pBM = GetFieldmarkAfter(/*bLoop=*/true)) !=nullptr) {
2024 GotoFieldmark(pBM);
2025 }
2026}
2027
2029{
2030 CurrShell aCurr( this );
2031 while(IsModePushed())
2032 PopMode();
2033 while(PopCursor(false))
2034 ;
2036}
2037
2039{
2040 ::std::optional<SwCallLink> aLink(std::in_place, *this);
2041 return Pop(eDelete, aLink);
2042}
2043
2044bool SwWrtShell::Pop(SwCursorShell::PopMode const eDelete, ::std::optional<SwCallLink>& roLink)
2045{
2046 bool bRet = SwCursorShell::Pop(eDelete, roLink);
2047 if( bRet && IsSelection() )
2048 {
2049 if (!IsAddMode())
2050 {
2053 }
2054 }
2055 return bRet;
2056}
2057
2059{
2060 if(IsSelFrameMode())
2061 {
2062 return false;
2063 }
2064
2065 if(IsObjSelected())
2066 {
2067 return false;
2068 }
2069
2070 if(GetView().GetDrawFuncPtr())
2071 {
2072 return false;
2073 }
2074
2075 if(GetView().GetPostItMgr()->GetActiveSidebarWin())
2076 {
2077 return false;
2078 }
2079
2080 return true;
2081}
2082
2084{
2085 SwEditShell::ChgDBData(aDBData);
2086 //notify the db-beamer if available
2088}
2089
2091{
2092 OUString aResult;
2093
2094 SelectionType nSelType = GetSelectionType();
2095 switch (nSelType)
2096 {
2098 aResult = SwResId(STR_GRAPHIC);
2099
2100 break;
2102 {
2103 const SwFrameFormat * pFrameFormat = GetSelectedFrameFormat();
2104
2105 if (pFrameFormat)
2106 aResult = pFrameFormat->GetDescription();
2107 }
2108 break;
2110 {
2111 aResult = SwResId(STR_DRAWING_OBJECTS);
2112 }
2113 break;
2114 default:
2115 if (mxDoc)
2116 aResult = GetCursorDescr();
2117 }
2118
2119 return aResult;
2120}
2121
2123{
2125 //#i115062# invalidate meta character slot
2127}
2128
2130{
2133}
2134
2135// Switch on/off header or footer of a page style - if an empty name is
2136// given all styles are changed
2137
2139 std::u16string_view rStyleName, bool bHeader, bool bOn, bool bShowWarning)
2140{
2141 SdrView *const pSdrView = GetDrawView();
2142 if (pSdrView && pSdrView->IsTextEdit())
2143 { // tdf#107474 deleting header may delete active drawing object
2144 pSdrView->SdrEndTextEdit(true);
2145 }
2148 StartUndo( SwUndoId::HEADER_FOOTER ); // #i7983#
2149 bool bExecute = true;
2150 bool bCursorSet = false;
2151 for( size_t nFrom = 0, nTo = GetPageDescCnt();
2152 nFrom < nTo; ++nFrom )
2153 {
2154 SwPageDesc aDesc( GetPageDesc( nFrom ));
2155 OUString sTmp(aDesc.GetName());
2156 if( rStyleName.empty() || rStyleName == sTmp )
2157 {
2158 bool bChgd = false;
2159
2160 if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() &&
2161 ( (bHeader && aDesc.GetMaster().GetHeader().IsActive()) ||
2162 (!bHeader && aDesc.GetMaster().GetFooter().IsActive()) ) )
2163 {
2164 bShowWarning = false;
2165 //Actions have to be closed while the dialog is showing
2166 EndAllAction();
2167
2168 weld::Window* pParent = GetView().GetFrameWeld();
2169 short nResult;
2170 if (bHeader) {
2171 nResult = DeleteHeaderDialog(pParent).run();
2172 } else {
2173 nResult = DeleteFooterDialog(pParent).run();
2174 }
2175
2176 bExecute = nResult == RET_YES;
2178 if (nResult == RET_YES)
2180 }
2181 if( bExecute )
2182 {
2183 bChgd = true;
2184 SwFrameFormat &rMaster = aDesc.GetMaster();
2185 if(bHeader)
2186 rMaster.SetFormatAttr( SwFormatHeader( bOn ));
2187 else
2188 rMaster.SetFormatAttr( SwFormatFooter( bOn ));
2189 if( bOn )
2190 {
2192 SvxULSpaceItem aUL(bHeader ? 0 : constTwips_5mm, bHeader ? constTwips_5mm : 0, RES_UL_SPACE );
2193 SwFrameFormat* pFormat = bHeader ?
2194 const_cast<SwFrameFormat*>(rMaster.GetHeader().GetHeaderFormat()) :
2195 const_cast<SwFrameFormat*>(rMaster.GetFooter().GetFooterFormat());
2196 pFormat->SetFormatAttr( aUL );
2197 XFillStyleItem aFill(drawing::FillStyle_NONE);
2198 pFormat->SetFormatAttr(aFill);
2199 }
2200 }
2201 if( bChgd )
2202 {
2203 ChgPageDesc( nFrom, aDesc );
2204
2205 if( !bCursorSet && bOn )
2206 {
2207 if ( !IsHeaderFooterEdit() )
2209 bCursorSet = SetCursorInHdFt(
2210 rStyleName.empty() ? SIZE_MAX : nFrom,
2211 bHeader );
2212 }
2213 }
2214 }
2215 }
2216 EndUndo( SwUndoId::HEADER_FOOTER ); // #i7983#
2217 EndAllAction();
2218}
2219
2221{
2223 if ( !bShow )
2225}
2226
2228{
2229 SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(rFieldMgr.GetCurField());
2230 bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == SwFieldIds::Postit);
2231 if (bNew || GetView().GetPostItMgr()->IsAnswer())
2232 {
2233 const SvxPostItAuthorItem* pAuthorItem = rReq.GetArg<SvxPostItAuthorItem>(SID_ATTR_POSTIT_AUTHOR);
2234 OUString sAuthor;
2235 if ( pAuthorItem )
2236 sAuthor = pAuthorItem->GetValue();
2237 else
2238 {
2239 std::size_t nAuthor = SW_MOD()->GetRedlineAuthor();
2240 sAuthor = SW_MOD()->GetRedlineAuthor(nAuthor);
2241 }
2242
2243 const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
2244 OUString sText;
2245 if ( pTextItem )
2246 sText = pTextItem->GetValue();
2247
2248 // If we have a text already registered for answer, use that
2249 if (GetView().GetPostItMgr()->IsAnswer() && !GetView().GetPostItMgr()->GetAnswerText().isEmpty())
2250 {
2251 sText = GetView().GetPostItMgr()->GetAnswerText();
2252 GetView().GetPostItMgr()->RegisterAnswerText(OUString());
2253 }
2254
2255 if ( HasSelection() && !IsTableMode() )
2256 {
2257 KillPams();
2258 }
2259
2260 // #i120513# Inserting a comment into an autocompletion crashes
2261 // --> suggestion has to be removed before
2263
2264 SwInsertField_Data aData(SwFieldTypesEnum::Postit, 0, sAuthor, sText, 0);
2265
2266 if (IsSelFrameMode())
2267 {
2269
2270 // Remember the anchor of the selected object before deletion.
2271 std::optional<SwPosition> oAnchor;
2272 if (pFly)
2273 {
2274 SwFrameFormat* pFormat = pFly->GetFormat();
2275 if (pFormat)
2276 {
2277 RndStdIds eAnchorId = pFormat->GetAnchor().GetAnchorId();
2278 if ((eAnchorId == RndStdIds::FLY_AS_CHAR || eAnchorId == RndStdIds::FLY_AT_CHAR) && pFormat->GetAnchor().GetAnchorNode())
2279 {
2280 oAnchor.emplace(*pFormat->GetAnchor().GetContentAnchor());
2281 }
2282 }
2283 }
2284
2285 // A frame is selected, end frame selection.
2286 EnterStdMode();
2287 GetView().AttrChangedNotify(nullptr);
2288
2289 // Set up text selection, so the anchor of the frame will be the anchor of the
2290 // comment.
2291 if (pFly)
2292 {
2293 if (oAnchor)
2294 *GetCurrentShellCursor().GetPoint() = *oAnchor;
2295 SwFrameFormat* pFormat = pFly->GetFormat();
2296 if (pFormat && pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
2297 {
2298 Right(SwCursorSkipMode::Cells, /*bSelect=*/true, 1, /*bBasicCall=*/false, /*bVisual=*/true);
2299 }
2300 else if (pFormat && pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_CHAR)
2301 {
2302 aData.m_oAnnotationRange.emplace(*GetCurrentShellCursor().Start(),
2304 }
2305 }
2306 }
2307
2308 rFieldMgr.InsertField( aData );
2309
2310 Push();
2312 pPostIt = static_cast<SwPostItField*>(rFieldMgr.GetCurField());
2313 Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore cursor position
2314 }
2315
2316 // Client has disabled annotations rendering, no need to
2317 // focus the postit field
2319 return;
2320
2321 if (pPostIt)
2322 {
2324 if(auto pFormat = pType->FindFormatForField(pPostIt))
2325 pFormat->Broadcast( SwFormatFieldHint( nullptr, SwFormatFieldHintWhich::FOCUS, &GetView() ) );
2326 }
2327}
2328
2330{
2331 const SwOutlineNodes& rOutlineNodes = GetDoc()->GetNodes().GetOutLineNds();
2332 const SwNode* pOutlineNode = rOutlineNodes[nPos];
2333
2334 // no layout frame means outline folding is set to include sub levels and the outline node has
2335 // a parent outline node with outline content visible attribute false (folded outline content)
2336 if (!pOutlineNode->GetTextNode()->getLayoutFrame(nullptr))
2337 return false;
2338
2339 // try the next node to determine if this outline node has visible content
2340 SwNodeIndex aIdx(*pOutlineNode, +1);
2341 if (aIdx.GetNode() == aIdx.GetNodes().GetEndOfContent()) // end of regular content
2342 return false;
2343
2344 if (aIdx.GetNode().IsTextNode() || aIdx.GetNode().IsTableNode() ||
2345 aIdx.GetNode().IsSectionNode())
2346 {
2347 // * sublevels treated as outline content
2348 // If next node (aIdx) doesn't have a layout frame
2349 // then this outline node does not have visible outline content.
2350 // * sublevels NOT treated as outline content
2351 // If the next node (aIdx) is the next outline node
2352 // then return the outline content visible attribute value.
2353 if (!GetViewOptions()->IsTreatSubOutlineLevelsAsContent() &&
2354 nPos + 1 < rOutlineNodes.size() &&
2355 rOutlineNodes[nPos + 1] == &aIdx.GetNode())
2357
2358 if (aIdx.GetNode().IsTextNode())
2359 return aIdx.GetNode().GetTextNode()->getLayoutFrame(nullptr);
2360 if (aIdx.GetNode().IsTableNode())
2361 {
2362 SwTable& rTable = aIdx.GetNode().GetTableNode()->GetTable();
2363 return rTable.HasLayout();
2364 }
2365 if (aIdx.GetNode().IsSectionNode())
2366 {
2367 const SwSectionFormat* pFormat =
2369 if (!pFormat)
2370 return false;
2371 SwPtrMsgPoolItem aAskItem(RES_CONTENT_VISIBLE, nullptr);
2372 pFormat->GetInfo(aAskItem);
2373 return aAskItem.pObject;
2374 }
2375 }
2376
2377 return true;
2378}
2379
2381{
2383
2385
2386 bool bDocChanged = false;
2387
2388 const SwOutlineNodes& rOutlineNodes = GetNodes().GetOutLineNds();
2389
2390 // Make all missing frames.
2391 for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNodes.size(); ++nPos)
2392 {
2393 SwNode* pNode = rOutlineNodes[nPos];
2394 if (!pNode->GetTextNode()->getLayoutFrame(GetLayout()))
2395 {
2396 SwNodeIndex aIdx(*pNode, +1);
2397 // Make the outline paragraph frame
2398 MakeFrames(GetDoc(), *pNode, aIdx.GetNode());
2399 // Make the outline content visible but don't set the outline visible attribute and
2400 // don't make outline content made visible not visible that have outline visible
2401 // attribute false. Visibility will be taken care of when
2402 // MakeAllOutlineContentTemporarilyVisible goes out of scope.
2403 MakeOutlineContentVisible(nPos, true, false);
2404 bDocChanged = true;
2405 }
2406 }
2407 // Remove outline paragraph frame and outline content frames above given level.
2408 for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNodes.size(); ++nPos)
2409 {
2410 SwNode* pNode = rOutlineNodes[nPos];
2411 auto nOutlineLevel = pNode->GetTextNode()->GetAttrOutlineLevel();
2412 if (nOutlineLevel > nLevel)
2413 {
2414 // Remove the outline content but don't set the outline visible attribute. Visibility
2415 // will be taken care of when MakeAllOutlineContentTemporarilyVisible goes out of scope.
2416 MakeOutlineContentVisible(nPos, false, false);
2417 // Remove the outline paragraph frame.
2418 pNode->GetTextNode()->DelFrames(GetLayout());
2419 bDocChanged = true;
2420 }
2421 }
2422
2423 // Broadcast DocChanged if document layout has changed so the Navigator will be updated.
2424 if (bDocChanged)
2425 GetDoc()->GetDocShell()->Broadcast(SfxHint(SfxHintId::DocChanged));
2426}
2427
2428void SwWrtShell::MakeOutlineContentVisible(const size_t nPos, bool bMakeVisible, bool bSetAttrOutlineVisibility)
2429{
2430 const SwNodes& rNodes = GetNodes();
2431 const SwOutlineNodes& rOutlineNodes = rNodes.GetOutLineNds();
2432
2433 SwNode* pSttNd = rOutlineNodes[nPos];
2434
2435 // determine end node
2436 SwNode* pEndNd = &rNodes.GetEndOfContent();
2437 if (rOutlineNodes.size() > nPos + 1)
2438 pEndNd = rOutlineNodes[nPos + 1];
2439
2440 if (GetViewOptions()->IsTreatSubOutlineLevelsAsContent())
2441 {
2442 // get the last outline node to include (iPos)
2443 int nLevel = pSttNd->GetTextNode()->GetAttrOutlineLevel();
2444 int nMaxOutlineLevelShown = m_rView.GetMaxOutlineLevelShown();
2446 while (++iPos < rOutlineNodes.size() &&
2447 rOutlineNodes[iPos]->GetTextNode()->GetAttrOutlineLevel() > nLevel &&
2448 rOutlineNodes[iPos]->GetTextNode()->GetAttrOutlineLevel() <= nMaxOutlineLevelShown);
2449
2450 // get the correct end node
2451 // the outline node may be in frames, headers, footers special section of doc model
2452 SwNode* pStartOfSectionNodeSttNd = pSttNd->StartOfSectionNode();
2453 while (pStartOfSectionNodeSttNd->StartOfSectionNode()
2454 != pStartOfSectionNodeSttNd->StartOfSectionNode()->StartOfSectionNode())
2455 {
2456 pStartOfSectionNodeSttNd = pStartOfSectionNodeSttNd->StartOfSectionNode();
2457 }
2458 pEndNd = pStartOfSectionNodeSttNd->EndOfSectionNode();
2459
2460 if (iPos < rOutlineNodes.size())
2461 {
2462 SwNode* pStartOfSectionNode = rOutlineNodes[iPos]->StartOfSectionNode();
2463 while (pStartOfSectionNode->StartOfSectionNode()
2464 != pStartOfSectionNode->StartOfSectionNode()->StartOfSectionNode())
2465 {
2466 pStartOfSectionNode = pStartOfSectionNode->StartOfSectionNode();
2467 }
2468 if (pStartOfSectionNodeSttNd == pStartOfSectionNode)
2469 pEndNd = rOutlineNodes[iPos];
2470 }
2471 }
2472
2473 // table, text box, header, footer
2474 if (pSttNd->GetTableBox() || pSttNd->GetIndex() < rNodes.GetEndOfExtras().GetIndex())
2475 {
2476 // limit to within section
2477 if (pSttNd->EndOfSectionIndex() < pEndNd->GetIndex())
2478 pEndNd = pSttNd->EndOfSectionNode();
2479 }
2480 // if pSttNd isn't in table but pEndNd is, skip over all outline nodes in table
2481 else if (pEndNd->GetTableBox())
2482 {
2483 pEndNd = &rNodes.GetEndOfContent();
2484 for (size_t nOutlinePos = nPos + 2; nOutlinePos < rOutlineNodes.size(); nOutlinePos++)
2485 {
2486 if (!(rOutlineNodes[nOutlinePos]->GetTableBox()))
2487 {
2488 pEndNd = rOutlineNodes[nOutlinePos];
2489 break;
2490 }
2491 }
2492 }
2493 // end node determined
2494
2495 // Remove content frames from the next node after the starting outline node to
2496 // the determined ending node. Always do this to prevent the chance of duplicate
2497 // frames being made. They will be remade below if needed.
2498 SwNodeIndex aIdx(*pSttNd, +1);
2499 while (aIdx != *pEndNd)
2500 {
2501 SwNode* pNd = &aIdx.GetNode();
2502 if (pNd->IsContentNode())
2503 pNd->GetContentNode()->DelFrames(nullptr);
2504 else if (pNd->IsTableNode())
2505 pNd->GetTableNode()->DelFrames(nullptr);
2506 aIdx++;
2507 }
2508
2509 if (bMakeVisible) // make outline nodes outline content visible
2510 {
2511 // reset the index marker and make frames
2512 aIdx.Assign(*pSttNd, +1);
2513 MakeFrames(GetDoc(), aIdx.GetNode(), *pEndNd);
2514
2515 if (bSetAttrOutlineVisibility)
2516 {
2518
2519 // make outline content made visible that have outline visible attribute false not visible
2520 while (aIdx != *pEndNd)
2521 {
2522 SwNode* pNd = &aIdx.GetNode();
2523 if (pNd->IsTextNode() && pNd->GetTextNode()->IsOutline())
2524 {
2525 SwTextNode* pTextNd = pNd->GetTextNode();
2526 bool bOutlineContentVisibleAttr = true;
2527 pTextNd->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr);
2528 if (!bOutlineContentVisibleAttr)
2529 {
2531 if (rOutlineNodes.Seek_Entry(pTextNd, &iPos))
2532 {
2533 if (pTextNd->getLayoutFrame(nullptr))
2534 MakeOutlineContentVisible(iPos, false);
2535 }
2536 }
2537 }
2538 aIdx++;
2539 }
2540 }
2541 }
2542 else if (bSetAttrOutlineVisibility)
2543 pSttNd->GetTextNode()->SetAttrOutlineContentVisible(false);
2544}
2545
2546// make content visible or not visible only if needed
2548{
2550
2551 const SwOutlineNodes& rOutlineNds = GetNodes().GetOutLineNds();
2552 for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos)
2553 {
2554 bool bIsOutlineContentVisible = IsOutlineContentVisible(nPos);
2555 bool bOutlineContentVisibleAttr = true;
2556 rOutlineNds[nPos]->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr);
2557 if (!bIsOutlineContentVisible && bOutlineContentVisibleAttr)
2559 else if (bIsOutlineContentVisible && !bOutlineContentVisibleAttr)
2561 }
2562}
2563
2565{
2566 if (bMakeVisible)
2567 {
2568 // make all content visible
2569
2570 // When shortcut is assigned to the show outline content visibility button and used to
2571 // toggle the feature and the mouse pointer is on an outline frame the button will not
2572 // be removed. An easy way to make sure the button does not remain shown is to use the
2573 // HideControls function.
2575
2576 // temporarily set outline content visible attribute true for folded outline nodes
2577 std::vector<SwNode*> aFoldedOutlineNodeArray;
2578 for (SwNode* pNd: GetNodes().GetOutLineNds())
2579 {
2580 bool bOutlineContentVisibleAttr = true;
2581 pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr);
2582 if (!bOutlineContentVisibleAttr)
2583 {
2584 aFoldedOutlineNodeArray.push_back(pNd);
2585 pNd->GetTextNode()->SetAttrOutlineContentVisible(true);
2586 }
2587 }
2588
2589 StartAction();
2591 EndAction();
2592
2593 // restore outline content visible attribute for folded outline nodes
2594 for (SwNode* pNd: aFoldedOutlineNodeArray)
2595 pNd->GetTextNode()->SetAttrOutlineContentVisible(false);
2596 }
2597 else
2598 {
2599 if (SdrView* pSdrView = GetDrawView(); pSdrView && pSdrView->IsTextEdit() )
2600 {
2601 bool bLockView = IsViewLocked();
2602 LockView(true);
2603 EndTextEdit();
2604 LockView(bLockView);
2605 }
2606 if (IsSelFrameMode() || IsObjSelected())
2607 {
2608 UnSelectFrame();
2611 EnterStdMode();
2612 }
2613
2614 // Get current frame in which the cursor is positioned for use in placing the cursor.
2615 const SwFrame* pCurrFrame = GetCurrFrame(false);
2616
2618
2619 StartAction();
2621 EndAction();
2622
2623 // If needed, find visible outline node frame to place cursor.
2624 if (!pCurrFrame || !pCurrFrame->isFrameAreaDefinitionValid() || pCurrFrame->IsInDtor() ||
2626 !GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(nullptr)))
2627 {
2628 while (nPos != SwOutlineNodes::npos &&
2629 !GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(nullptr))
2630 --nPos;
2632 {
2633 EnterStdMode();
2635 }
2636 }
2637 }
2638 GetView().GetDocShell()->Broadcast(SfxHint(SfxHintId::DocChanged));
2639}
2640
2642{
2643 bool bVisibleAttr = true;
2644 GetNodes().GetOutLineNds()[nPos]->GetTextNode()->GetAttrOutlineContentVisible(bVisibleAttr);
2645 return bVisibleAttr;
2646}
2647
2649{
2650 for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
2651 {
2652 SwPaM aPaM(*rPaM.GetMark(), *rPaM.GetPoint());
2653 aPaM.Normalize();
2654 SwNodeIndex aPointIdx(aPaM.GetPoint()->GetNode());
2655 SwNodeIndex aMarkIdx(aPaM.GetMark()->GetNode());
2656 if (aPointIdx == aMarkIdx)
2657 continue;
2658 // Return true if any nodes in PaM are folded outline content nodes.
2660 for (SwNodeIndex aIdx = aPointIdx; aIdx <= aMarkIdx; aIdx++)
2661 {
2662 if (GetDoc()->GetNodes().GetOutLineNds().Seek_Entry(&(aIdx.GetNode()), &nPos) &&
2664 return true;
2665 }
2666 }
2667 return false;
2668}
2669
2671{
2672 if (bAsync)
2673 {
2674 auto xInfo = std::make_shared<weld::MessageDialogController>(
2675 GetView().GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui", "InfoReadonlyDialog");
2676 if (GetViewOptions()->IsShowOutlineContentVisibilityButton() &&
2678 {
2679 xInfo->set_primary_text(SwResId(STR_INFORODLG_FOLDED_PRIMARY));
2680 xInfo->set_secondary_text(SwResId(STR_INFORODLG_FOLDED_SECONDARY));
2681 }
2682 weld::DialogController::runAsync(xInfo, [](int) {});
2683 }
2684 else
2685 {
2686 std::unique_ptr<weld::Builder>
2688 "modules/swriter/ui/inforeadonlydialog.ui"));
2689 std::unique_ptr<weld::MessageDialog>
2690 xInfo(xBuilder->weld_message_dialog("InfoReadonlyDialog"));
2691 if (GetViewOptions()->IsShowOutlineContentVisibilityButton() &&
2693 {
2694 xInfo->set_primary_text(SwResId(STR_INFORODLG_FOLDED_PRIMARY));
2695 xInfo->set_secondary_text(SwResId(STR_INFORODLG_FOLDED_SECONDARY));
2696 }
2697 xInfo->run();
2698 }
2699}
2700
2701/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@ OLE_CAP
@ UndoArg1
Definition: SwRewriter.hxx:29
@ UndoArg3
Definition: SwRewriter.hxx:31
@ UndoArg2
Definition: SwRewriter.hxx:30
const char * pName
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
bool Erase(const Color &rFillColor)
bool isLetterNumeric(const OUString &rStr, sal_Int32 nPos) const
const OUString & GetValue() const
void IncreaseLuminance(sal_uInt8 cLumInc)
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
virtual void RemoveLeadingWhiteSpace(const SwPosition &rPos)=0
Removes any leading white space from the paragraph.
virtual SwFieldType * GetFieldType(SwFieldIds nResId, const OUString &rName, bool bDbFieldMatching) const =0
const OUString & getBcp47(bool bResolveSystem=true) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false)
virtual bool IsTextEdit() const final override
virtual SdrViewContext GetContext() const
void Invalidate(sal_uInt16 nId)
bool SetObjArea(const tools::Rectangle &)
void SetObjAreaAndScale(const tools::Rectangle &, const Fraction &, const Fraction &)
const Fraction & GetScaleHeight() const
const tools::Rectangle & GetObjArea() const
ErrCode DoVerb(sal_Int32 nVerb)
const Fraction & GetScaleWidth() const
virtual bool IsProtected() const
void ClearItem()
const SfxPoolItem * GetCurItem() const
const SfxPoolItem * NextItem()
SfxItemState GetItemState(bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void EnableSetModified(bool bEnable=true)
const T * GetArg(sal_uInt16 nSlotId) const
const SfxSlot * GetSlot(sal_uInt16 nId) const
const char * GetUnoName() const
SfxBindings & GetBindings()
weld::Window * GetFrameWeld() const
SfxInPlaceClient * FindIPClient(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, vcl::Window *pObjParentWin) const
SfxViewFrame * GetViewFrame() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
static sal_uInt16 IsChart(const SvGlobalName &rName)
static sal_uInt16 IsMath(const SvGlobalName &rName)
sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge=LANGUAGE_DONTKNOW)
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
LanguageType GetLanguage() const
const OUString & GetFormatstring() const
void Remove(const SvGlobalName &)
static SvxAbstractDialogFactory * Create()
SvxAutoCorrect * GetAutoCorrect()
static SvxAutoCorrCfg & Get()
bool IsAutoCorrFlag(ACFlags nFlag) const
tools::Long GetIndentAt() const
void SetAbsLSpace(sal_Int32 nSet)
void SetBulletFont(const vcl::Font *pFont)
tools::Long GetFirstLineIndent() const
void SetListFormat(const OUString &rPrefix, const OUString &rSuffix, int nLevel)
void SetNumAdjust(SvxAdjust eSet)
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
void SetBulletChar(sal_UCS4 cSet)
void SetNumberingType(SvxNumType nSet)
SvxNumType GetNumberingType() const
Class for automated call of Start- and EndAction().
Definition: editsh.hxx:1019
Represents the style of a text portion.
Definition: charfmt.hxx:27
Represents one list item in a content control dropdown list.
OUString m_aValue
This must not be empty.
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1230
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
Definition: node.cxx:1439
bool Pop(PopMode, ::std::optional< SwCallLink > &roLink)
OUString GetCursorDescr() const
Returns textual description of the current selection.
Definition: crsrsh.cxx:3670
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2251
void ShowCursor()
Definition: crsrsh.cxx:2410
void StartAction()
Definition: crsrsh.cxx:226
const SwTableNode * IsCursorInTable() const
Definition: crsrsh.hxx:909
bool SetCursorInHdFt(size_t nDescNo, bool bInHeader)
Definition: crstrvl.cxx:192
void SwapPam()
Definition: crsrsh.cxx:976
void HideCursor()
Definition: crsrsh.cxx:2429
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2535
void SetFlyMacroLnk(const Link< const SwFlyFrameFormat *, void > &rLnk)
Definition: crsrsh.hxx:495
virtual SwCursor & GetCurrentShellCursor() override
Return the current shell cursor.
Definition: crsrsh.cxx:185
void NormalizePam(bool bPointFirst=true)
Ensure point and mark of the current PaM are in a specific order.
Definition: crsrsh.cxx:970
bool IsEndPara() const
Definition: crsrsh.cxx:1114
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
OUString GetSelText() const
get selected text of a node at current cursor
Definition: crsrsh.cxx:2559
bool IsSttPara() const
Definition: crsrsh.cxx:1095
bool IsFormProtected()
Definition: crbm.cxx:281
bool IsSelection() const
Definition: crsrsh.hxx:899
bool IsEndWord(sal_Int16 nWordType=css::i18n::WordType::ANYWORD_IGNOREWHITESPACES) const
Definition: crstrvl1.cxx:31
void EndAction(const bool bIdleEnd=false)
Definition: crsrsh.cxx:243
bool GotoFootnoteText()
jump from content to footnote
Definition: trvlfnfl.cxx:89
SwContentFrame * GetCurrFrame(const bool bCalcFrame=true) const
Get current frame in which the cursor is positioned.
Definition: crsrsh.cxx:2469
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3434
void ClearMark()
Definition: crsrsh.cxx:939
bool SetInFrontOfLabel(bool bNew)
Definition: crsrsh.cxx:1162
SwTextContentControl * CursorInsideContentControl() const
Definition: crstrvl.cxx:970
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3053
SwTable::SearchType GetEnhancedTableSelection() const
Definition: crsrsh.hxx:826
bool Left(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:361
void KillPams()
Definition: crsrsh.cxx:1022
SwOutlineNodes::size_type GetOutlinePos(sal_uInt8 nLevel=UCHAR_MAX, SwPaM *pPaM=nullptr)
search "outline position" before previous outline node at given level
Definition: crstrvl.cxx:1185
sw::mark::IFieldmark * GetFieldmarkAfter(bool bLoop)
Definition: crbm.cxx:293
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:914
bool IsTableMode() const
Definition: crsrsh.hxx:659
bool SelectHiddenRange()
If the current cursor position is inside a hidden range, the hidden range is selected.
Definition: crsrsh.cxx:3444
Definition: doc.hxx:195
void ClearLineNumAttrs(SwPosition const &rPos)
Definition: ndtbl.cxx:4187
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:323
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:152
SwNodes & GetNodes()
Definition: doc.hxx:418
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:365
const SwNumRule * SearchNumRule(const SwPosition &rPos, const bool bForward, const bool bNum, const bool bOutline, int nNonEmptyAllowed, OUString &sListId, SwRootFrame const *pLayout, const bool bInvestigateStartNode=false)
Searches for a text node with a numbering rule.
Definition: docnum.cxx:1607
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1421
SwDocShell * GetDocShell()
Definition: doc.hxx:1362
sal_uInt16 GetCntType() const
Determine form of content. Return Type at CurrentCursor->SPoint.
Definition: edws.cxx:126
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
void SplitNode(bool bAutoFormat=false, bool bCheckTableStart=true)
Definition: editsh.cxx:182
size_t GetTableFrameFormatCount(bool bUsed=false) const
TABLE.
Definition: edfmt.cxx:99
SwFormat * GetFormatFromPool(sal_uInt16 nId)
return the requested automatic format - base-class !
Definition: edfmt.cxx:127
bool IsRedlineOn() const
Definition: edredln.cxx:43
void ChgDBData(const SwDBData &SwDBData)
Definition: edfld.cxx:296
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: editsh.cxx:1091
SwFrameFormat & GetTableFrameFormat(size_t nFormat, bool bUsed=false) const
Definition: edfmt.cxx:104
SwCharFormat * GetCharFormatFromPool(sal_uInt16 nId)
Definition: editsh.hxx:354
SwUndoId StartUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Undo: set up Undo parenthesis, return nUndoId of this parenthesis.
Definition: edws.cxx:223
bool GetGrfSize(Size &) const
Definition: editsh.cxx:278
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:98
void SetAttrSet(const SfxItemSet &, SetAttrMode nFlags=SetAttrMode::DEFAULT, SwPaM *pCursor=nullptr, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:129
SwCharFormat * FindCharFormatByName(const OUString &rName) const
Definition: edfmt.cxx:147
void Overwrite(const OUString &)
Definition: editsh.cxx:168
svt::EmbeddedObjectRef & GetOLEObject() const
Get OLE object at pointer.
Definition: editsh.cxx:358
void Insert2(const OUString &, const bool bForceExpandHints=false)
Definition: editsh.cxx:79
void SetTextFormatColl(SwTextFormatColl *, const bool bResetListAttrs=false)
Add 2nd optional parameter <bResetListAttrs> - see also <SwDoc::SetTextFormatColl(....
Definition: edfcol.cxx:2199
void SetCurNumRule(const SwNumRule &, const bool bCreateNewList, const OUString &sContinuedListId=OUString(), const bool bResetIndentAttrs=false)
Optional parameter <bResetIndentAttrs> (default value false).
Definition: ednumber.cxx:738
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: edfmt.cxx:152
const SwNumRule * GetOutlineNumRule() const
Definition: ednumber.cxx:117
bool GetPaMAttr(SwPaM *pPaM, SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Apply / remove attributes.
Definition: edattr.cxx:59
SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId)
Definition: edfmt.cxx:121
const SwNumRule * GetNumRuleAtCurrCursorPos() const
Definition: ednumber.cxx:694
void DelNumRules()
Delete, split enumeration list.
Definition: ednumber.cxx:249
void SetModified()
Definition: edws.cxx:70
SwUndoId EndUndo(SwUndoId eUndoId=SwUndoId::EMPTY, const SwRewriter *pRewriter=nullptr)
Closes parenthesis of nUndoId, not used by UI.
Definition: edws.cxx:234
void AutoCorrect(SvxAutoCorrect &rACorr, bool bInsertMode, sal_Unicode cChar)
Call AutoCorrect.
Definition: edws.cxx:255
SwTextFormatColl * GetCurTextFormatColl() const
Get the named paragraph format of the current selection.
Definition: edattr.cxx:238
OUString GetUniqueNumRuleName() const
Definition: ednumber.cxx:780
void GetSelectedText(OUString &rBuf, ParaBreakType nHndlParaBreak=ParaBreakType::ToBlank)
Query text within selection.
Definition: edglss.cxx:259
void FillByEx(SwCharFormat *)
Definition: edfmt.cxx:51
void ResetAttr(const o3tl::sorted_vector< sal_uInt16 > &attrs=o3tl::sorted_vector< sal_uInt16 >(), SwPaM *pCursor=nullptr)
Definition: edatmisc.cxx:32
void EndAllAction()
Definition: edws.cxx:97
bool IsUsed(const sw::BroadcastingModify &) const
Query if the paragraph-/character-/frame-/page-style is used.
Definition: edfmt.cxx:137
void FlushInBuffer()
Character buffer is inserted into the document.
Definition: edtwin.cxx:883
void StopQuickHelp()
Definition: edtwin.cxx:6178
bool IsFrameAction() const
Definition: edtwin.hxx:219
SwFrameControlsManager & GetFrameControlsManager()
Definition: edtwin.cxx:6815
SwFlyFrame * GetSelectedFlyFrame() const
Definition: fefly1.cxx:277
bool SetFlyFrameAttr(SfxItemSet &rSet)
Definition: fefly1.cxx:1103
void AlignFormulaToBaseline(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj)
for starmath formulas anchored 'as char' it aligns it baseline to baseline changing the previous vert...
Definition: fefly1.cxx:2048
void ChgPageDesc(size_t i, const SwPageDesc &)
Definition: fedesc.cxx:111
SwFlyFrameFormat * InsertObject(const svt::EmbeddedObjectRef &, SfxItemSet *pFlyAttrSet)
Definition: fefly1.cxx:928
SwPageDesc * FindPageDescByName(const OUString &rName, bool bGetFromPool=false, size_t *pPos=nullptr)
Definition: fedesc.cxx:131
bool IsFrameSelected() const
Definition: feshview.cxx:1253
void SetCheckForOLEInCaption(bool bFlag)
Definition: fesh.hxx:459
size_t GetPageDescCnt() const
Definition: fedesc.cxx:38
SwFrameFormat * GetSelectedFrameFormat() const
If frame then frame style, else 0.
Definition: fefly1.cxx:1213
void ToggleHeaderFooterEdit()
Definition: fews.cxx:1319
void Insert(const OUString &rGrfName, const OUString &rFltName, const Graphic *pGraphic, const SfxItemSet *pFlyAttrSet)
Definition: fefly1.cxx:837
size_t GetCurPageDesc(const bool bCalcFrame=true) const
Definition: fedesc.cxx:167
Size GetGraphicDefaultSize() const
Definition: fews.cxx:1241
const SwRect & GetAnyCurRect(CurRectType eType, const Point *pPt=nullptr, const css::uno::Reference< css::embed::XEmbeddedObject > &=css::uno::Reference< css::embed::XEmbeddedObject >()) const
Definition: fews.cxx:90
bool GetFlyFrameAttr(SfxItemSet &rSet) const
Definition: fefly1.cxx:1061
Size RequestObjectResize(const SwRect &rRect, const css::uno::Reference< css::embed::XEmbeddedObject > &)
OLE.
Definition: fefly1.cxx:1318
void EndTextEdit()
Deletes object if required.
Definition: feshview.cxx:1313
void ChgCurPageDesc(const SwPageDesc &)
PageDescriptor-interface.
Definition: fedesc.cxx:43
size_t IsObjSelected() const
Definition: feshview.cxx:1245
void CalcBoundRect(SwRect &_orRect, const RndStdIds _nAnchorId, const sal_Int16 _eHoriRelOrient=css::text::RelOrientation::FRAME, const sal_Int16 _eVertRelOrient=css::text::RelOrientation::FRAME, const SwFormatAnchor *_pToCharContentPos=nullptr, const bool _bFollowTextFlow=false, bool _bMirror=false, Point *_opRef=nullptr, Size *_opPercent=nullptr, const SwFormatFrameSize *pFormatFrameSize=nullptr) const
i#17567 - adjustments to allow negative vertical positions for fly frames anchored to paragraph or to...
Definition: fews.cxx:690
const SwPageDesc & GetPageDesc(size_t i) const
Definition: fedesc.cxx:126
void ResetFlyFrameAttr(const SfxItemSet *pSet)
Definition: fefly1.cxx:1186
const SwFrameFormat * GetFlyFrameFormat() const
Get FlyFrameFormat; for UI macro linkage at Flys.
Definition: fefly1.cxx:1270
bool InsertField(SwInsertField_Data &rData)
Definition: fldmgr.cxx:897
SwField * GetCurField()
Definition: fldmgr.cxx:432
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:243
SwFieldIds Which() const
Definition: fldbas.hxx:274
SwFormatField * FindFormatForField(const SwField *) const
Definition: fldbas.cxx:169
SwFieldType * GetTyp() const
Definition: fldbas.hxx:399
void SetAnchor(RndStdIds eId)
Definition: frmmgr.cxx:225
tools::Long CalcWidthBorder()
Definition: frmmgr.hxx:134
void SetSize(const Size &rLSize)
Definition: frmmgr.cxx:612
RndStdIds GetAnchor() const
Definition: frmmgr.hxx:167
const Size & GetSize() const
Definition: frmmgr.hxx:138
void DelAttr(sal_uInt16 nId)
Definition: frmmgr.cxx:533
tools::Long CalcHeightBorder()
Definition: frmmgr.hxx:135
const SfxItemSet & GetAttrSet() const
Definition: frmmgr.hxx:124
void UpdateFlyFrame()
Definition: frmmgr.cxx:159
void SetHeightSizeType(SwFrameSize eType)
Definition: frmmgr.cxx:591
void UpdateAttrMgr()
Definition: frmmgr.cxx:137
const Point & GetLastFlyFramePrtRectPos() const
Definition: frmfmt.hxx:255
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2905
FlyAnchors.
Definition: fmtanchr.hxx:37
sal_Int32 GetAnchorContentOffset() const
Definition: atrfrm.cxx:1623
SwContentNode * GetAnchorContentNode() const
Definition: atrfrm.cxx:1615
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:74
SwNode * GetAnchorNode() const
Definition: atrfrm.cxx:1606
SfxPoolItem subclass that wraps an SwContentControl.
const std::shared_ptr< SwContentControl > & GetContentControl() const
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:65
bool IsActive() const
Definition: fmthdft.hxx:89
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
void SetNumStr(const OUString &rStr)
Definition: fmtftn.hxx:75
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:34
bool IsActive() const
Definition: fmthdft.hxx:58
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
SfxPoolItem subclass that wraps an SwLineBreakClear.
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:36
void SetNumOffset(const ::std::optional< sal_uInt16 > &oNum)
Definition: fmtpdsc.hxx:65
bool IsDefault() const
Definition: format.hxx:129
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
const OUString & GetName() const
Definition: format.hxx:131
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:232
const SwFormatAnchor & GetAnchor(bool=true) const
Definition: fmtanchr.hxx:88
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:171
void HideControls(FrameControlType eType)
void SetReadonlyControls(bool bReadonly)
Style of a layout element.
Definition: frmfmt.hxx:62
virtual OUString GetDescription() const
Definition: atrfrm.cxx:2888
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsInDtor() const
Definition: frame.hxx:892
Class for automated call of Start- and EndCursorMove().
Definition: editsh.hxx:1027
bool addEntry(const SwPosition &rPos)
Definition: navmgr.cxx:168
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset)
Definition: ndindex.hxx:291
const SwNodes & GetNodes() const
Definition: ndindex.hxx:175
SwNode & GetNode() const
Definition: ndindex.hxx:136
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:897
SwSectionNode * GetSectionNode()
Definition: node.hxx:658
SwNodeOffset GetIndex() const
Definition: node.hxx:312
SwTableBox * GetTableBox() const
If node is in a table return the respective table box.
Definition: node.cxx:774
bool IsContentNode() const
Definition: node.hxx:679
bool IsEndNode() const
Definition: node.hxx:683
bool IsSectionNode() const
Definition: node.hxx:695
bool IsTableNode() const
Definition: node.hxx:691
bool IsTextNode() const
Definition: node.hxx:687
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:380
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:153
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:728
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwTableNode * GetTableNode()
Definition: node.hxx:650
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:733
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:240
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:163
SwTextNode * MakeTextNode(SwNode &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:121
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:165
void SetCharFormat(SwCharFormat *)
Definition: number.cxx:281
bool IsAutoRule() const
Definition: numrule.hxx:229
bool IsOutlineRule() const
Definition: numrule.hxx:241
void ChangeIndent(const sal_Int32 nDiff)
change indent of all list levels by given difference
Definition: number.cxx:984
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:87
void Set(sal_uInt16 i, const SwNumFormat *)
Definition: number.cxx:618
bool Seek_Entry(SwNode *rP, size_type *pnPos) const
Definition: ndnum.cxx:32
static constexpr auto npos
Definition: ndarr.hxx:81
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
SwNode & GetPointNode() const
Definition: pam.hxx:283
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
Definition: pam.cxx:700
void DeleteMark()
Definition: pam.hxx:231
const SwPosition * GetPoint() const
Definition: pam.hxx:261
const OUString & GetName() const
Definition: pagedesc.hxx:196
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
void RegisterAnswerText(const OUString &aAnswerText)
Definition: PostItMgr.hxx:258
OutlinerParaObject * IsAnswer()
Definition: PostItMgr.hxx:257
const OUString & GetAnswerText() const
Definition: PostItMgr.hxx:259
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2378
void * pObject
Definition: hints.hxx:61
Of course Writer needs its own rectangles.
Definition: swrect.hxx:35
void Height(tools::Long nNew)
Definition: swrect.hxx:193
bool IsEmpty() const
Definition: swrect.hxx:304
void Pos(const Point &rNew)
Definition: swrect.hxx:171
void SSize(const Size &rNew)
Definition: swrect.hxx:180
tools::Rectangle SVRect() const
Definition: swrect.hxx:292
void Width(tools::Long nNew)
Definition: swrect.hxx:189
void AddRule(SwUndoArg eWhat, const OUString &rWith)
Definition: SwRewriter.cxx:25
virtual bool GetInfo(SfxPoolItem &) const override
Definition: section.cxx:814
const SwSection & GetSection() const
Definition: node.hxx:590
SwSectionFormat * GetFormat()
Definition: section.hxx:339
static void Get1PixelInLogic(const SwViewShell &rSh, tools::Long *pX=nullptr, tools::Long *pY=nullptr)
Definition: viscrs.cxx:879
static SW_DLLPUBLIC sal_uInt16 GetPoolIdFromUIName(const OUString &rName, SwGetPoolIdFromName)
const SwTable & GetTable() const
Definition: node.hxx:542
void DelFrames(SwRootFrame const *pLayout=nullptr)
Method deletes all views of document for the node.
Definition: ndtbl.cxx:2420
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:113
@ SEARCH_COL
Definition: swtable.hxx:148
@ SEARCH_ROW
Definition: swtable.hxx:147
bool HasLayout() const
Definition: swtable.cxx:2969
const SwFormatContentControl & GetContentControl() const
Definition: txatbase.hxx:220
SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
Represents the style of a paragraph.
Definition: fmtcol.hxx:61
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:122
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:614
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:111
bool IsOutline() const
Returns if this text node is an outline.
Definition: ndtxt.cxx:4130
bool IsInList() const
Definition: ndtxt.cxx:4538
void GetAttrOutlineContentVisible(bool &bOutlineContentVisibleAttr)
GetAttrOutlineContentVisible.
Definition: ndtxt.cxx:4175
bool IsCountedInList() const
Definition: ndtxt.cxx:4385
SwTwips GetAdditionalIndentForStartingNewList() const
Definition: ndtxt.cxx:3361
SwTwips GetWidthOfLeadingTabs() const
Returns the width of leading tabs/blanks in this paragraph.
Definition: itratr.cxx:1450
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2919
int GetActualListLevel(SwListRedlineType eRedline=SwListRedlineType::SHOW) const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4240
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4160
void SetAttrOutlineContentVisible(bool bVisible)
Definition: ndtxt.cxx:4183
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:891
static void ClearSelection(const SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4342
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:100
bool IsTreatSubOutlineLevelsAsContent() const
Definition: viewopt.cxx:105
bool IsViewLocked() const
Definition: viewsh.hxx:471
bool IsHeaderFooterEdit() const
Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags.
Definition: viewsh.hxx:572
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:433
void UnlockPaint(bool bVirDev=false)
Definition: viewsh.hxx:619
const SwNodes & GetNodes() const
Definition: viewsh.cxx:2178
rtl::Reference< SwDoc > mxDoc
The document; never 0.
Definition: viewsh.hxx:179
bool ActionPend() const
Definition: viewsh.hxx:204
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2160
void LockPaint()
Definition: viewsh.hxx:614
virtual void SetReadonlyOption(bool bSet)
Definition: viewsh.cxx:2466
SwDoc * GetDoc() const
Definition: viewsh.hxx:290
void LockView(bool b)
Definition: viewsh.hxx:472
const SwPostItMgr * GetPostItMgr() const
Definition: viewsh.hxx:566
void SetSfxViewShell(SfxViewShell *pNew)
Definition: viewsh.hxx:452
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:624
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow)
Definition: viewsh.cxx:99
SdrView * GetDrawView()
Definition: vnew.cxx:373
Definition: view.hxx:146
bool IsFormMode() const
Definition: viewdraw.cxx:631
void AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId=nullptr)
Definition: viewdlg2.cxx:183
bool IsBezierEditMode() const
Definition: viewdraw.cxx:626
int GetMaxOutlineLevelShown() const
Definition: view.hxx:657
void SetMaxOutlineLevelShown(int nLevel)
Definition: view.hxx:656
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:648
SwEditWin & GetEditWin()
Definition: view.hxx:424
SwDocShell * GetDocShell()
Definition: view.cxx:1161
bool IsDrawMode() const
Definition: view.hxx:548
void LeaveDrawCreate()
Definition: view.hxx:547
void NotifyDBChanged()
Definition: view.cxx:1915
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
OUString const & GetCurPageStyle() const
Definition: wrtsh1.cxx:1885
bool IsSelFrameMode() const
Definition: wrtsh.hxx:177
SAL_DLLPRIVATE tools::Long SetCursorKillSel(const Point *, bool bProp)
Definition: select.cxx:316
void AutoUpdatePara(SwTextFormatColl *pColl, const SfxItemSet &rStyleSet, SwPaM *pPaM=nullptr)
Definition: wrtsh1.cxx:1905
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:702
virtual void ConnectObj(svt::EmbeddedObjectRef &xIPObj, const SwRect &rPrt, const SwRect &rFrame) override
Connect objects with ActivateWhenVisible at Paint.
Definition: wrtsh1.cxx:924
bool Right(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:127
void LeaveSelFrameMode()
Definition: select.cxx:720
void InsertPostIt(SwFieldMgr &rFieldMgr, const SfxRequest &rReq)
Inserts a new annotation/comment at the current cursor position / selection.
Definition: wrtsh1.cxx:2227
bool IsOutlineContentVisible(const size_t nPos)
Definition: wrtsh1.cxx:2329
void addCurrentPosition()
Definition: wrtsh1.cxx:1866
void MakeOutlineLevelsVisible(const int nLevel)
Definition: wrtsh1.cxx:2380
void PopMode()
Definition: select.cxx:284
SwWrtShell(SwWrtShell &, vcl::Window *pWin, SwView &rShell)
Definition: wrtsh1.cxx:1992
void InsertLineBreak(std::optional< SwLineBreakClear > oClear=std::nullopt)
Definition: wrtsh1.cxx:973
void AutoUpdateFrame(SwFrameFormat *pFormat, const SfxItemSet &rStyleSet)
Definition: wrtsh1.cxx:1942
bool GotoFieldmark(::sw::mark::IFieldmark const *const pMark)
Definition: wrtsh3.cxx:224
void NumOn()
Definition: wrtsh1.cxx:1664
bool GetAttrOutlineContentVisible(const size_t nPos)
Definition: wrtsh1.cxx:2641
bool IsModePushed() const
Definition: wrtsh.hxx:138
void NumOrBulletOff()
Definition: wrtsh1.cxx:1669
bool Left(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:110
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:716
void Insert(const OUString &)
Definition: wrtsh1.cxx:225
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:693
void ResetCursorStack()
Definition: wrtsh.hxx:649
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1720
void InsertGraphic(const OUString &rPath, const OUString &rFilter, const Graphic &, SwFlyFrameAttrMgr *=nullptr, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA)
Definition: wrtsh1.cxx:289
bool HasFoldedOutlineContentSelected()
Definition: wrtsh1.cxx:2648
void EnterStdMode()
Definition: select.cxx:551
virtual void SetReadonlyOption(bool bSet) override
Definition: wrtsh1.cxx:2129
bool InsertOleObject(const svt::EmbeddedObjectRef &xObj, SwFlyFrameFormat **pFlyFrameFormat=nullptr)
Definition: wrtsh1.cxx:512
SELECTFUNC m_fnKillSel
Definition: wrtsh.hxx:117
SwFrameFormat * GetTableStyle(std::u16string_view rFormatName)
Definition: wrtsh1.cxx:1854
void QuickUpdateStyle()
Definition: wrtsh1.cxx:1892
void SplitNode(bool bAutoFormat=false)
Definition: wrtsh1.cxx:1311
void InsertContentControl(SwContentControlType eType)
Definition: wrtsh1.cxx:1034
SwCharFormat * GetCharStyle(const OUString &rFormatName, GetStyle eCreate=GETSTYLE_NOCREATE)
Definition: wrtsh1.cxx:1837
@ GETSTYLE_NOCREATE
Definition: wrtsh.hxx:361
@ GETSTYLE_CREATEANY
Definition: wrtsh.hxx:363
virtual void ApplyViewOptions(const SwViewOption &rOpt) override
Apply ViewOptions with Start-/EndAction.
Definition: wrtsh1.cxx:2122
void ChgDBData(const SwDBData &SwDBData)
Definition: wrtsh1.cxx:2083
void NoEdit(bool bHideCursor=true)
Definition: wrtsh1.cxx:181
void MakeOutlineContentVisible(const size_t nPos, bool bMakeVisible=true, bool bSetAttrOutlineVisibility=true)
Definition: wrtsh1.cxx:2428
void InsertByWord(const OUString &)
Definition: wrtsh1.cxx:205
void MakeAllFoldedOutlineContentVisible(bool bMakeVisible=true)
Definition: wrtsh1.cxx:2564
SAL_DLLPRIVATE bool PopCursor(bool bUpdate, bool bSelect=false)
Definition: move.cxx:485
void InsertColumnBreak()
Definition: wrtsh1.cxx:1011
void InfoReadOnlyDialog(bool bAsync=false)
Definition: wrtsh1.cxx:2670
void InsertFootnote(const OUString &, bool bEndNote=false, bool bEdit=true)
Definition: wrtsh1.cxx:1169
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow) override
Definition: wrtsh1.cxx:2220
SwView & m_rView
Definition: wrtsh.hxx:571
SwNavigationMgr m_aNavigationMgr
Definition: wrtsh.hxx:572
void BulletOn()
Definition: wrtsh1.cxx:1715
void GotoOutline(SwOutlineNodes::size_type nIdx)
Definition: move.cxx:617
void ChangeHeaderOrFooter(std::u16string_view rStyleName, bool bHeader, bool bOn, bool bShowWarning)
Definition: wrtsh1.cxx:2138
bool DelRight(bool isReplaceHeuristic=false)
Definition: delete.cxx:291
SELECTFUNC m_fnSetCursor
Definition: wrtsh.hxx:115
void InsertObject(const svt::EmbeddedObjectRef &, SvGlobalName const *pName, sal_uInt16 nSlotId=0)
Definition: wrtsh1.cxx:408
void AutoCorrect(SvxAutoCorrect &rACorr, sal_Unicode cChar)
Definition: wrtsh1.cxx:1952
bool HasSelection() const
Definition: wrtsh.hxx:147
bool IsInsMode() const
Definition: wrtsh.hxx:172
void InsertPageBreak(const OUString *pPageDesc=nullptr, const ::std::optional< sal_uInt16 > &rPgNum=std::nullopt)
Definition: wrtsh1.cxx:935
bool m_bIns
Definition: wrtsh.hxx:594
void Edit()
Definition: wrtsh1.cxx:187
bool IsAddMode() const
Definition: wrtsh.hxx:163
void UnSelectFrame()
Definition: select.cxx:323
void InvalidateOutlineContentVisibility()
Definition: wrtsh1.cxx:2547
bool IsEndWrd()
Definition: wrtsh1.cxx:195
virtual ~SwWrtShell() override
Definition: wrtsh1.cxx:2028
SwTextFormatColl * GetParaStyle(const OUString &rCollName, GetStyle eCreate=GETSTYLE_NOCREATE)
Definition: wrtsh1.cxx:1820
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:333
void SetPageStyle(const OUString &rCollName)
Definition: wrtsh1.cxx:1873
bool CanInsert()
Definition: wrtsh1.cxx:2058
void LaunchOLEObj(sal_Int32 nVerb=css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY)
Definition: wrtsh1.cxx:653
void NumOrBulletOn(bool bNum)
Turns on numbering or bullets.
Definition: wrtsh1.cxx:1350
OUString GetSelDescr() const
Definition: wrtsh1.cxx:2090
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2044
const SwView & GetView() const
Definition: wrtsh.hxx:443
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
static MapUnit UnoEmbed2VCLMapUnit(sal_Int32 nUnoEmbedMapUnit)
css::uno::Reference< css::embed::XEmbeddedObject > CreateEmbeddedObject(const css::uno::Sequence< sal_Int8 > &, OUString &, OUString const *pBaseURL=nullptr)
static css::uno::Reference< css::embed::XStorage > GetTemporaryStorage(const css::uno::Reference< css::uno::XComponentContext > &rxContext=css::uno::Reference< css::uno::XComponentContext >())
size_type size() const
static bool TryRunningState(const css::uno::Reference< css::embed::XEmbeddedObject > &)
void SetGraphicStream(const css::uno::Reference< css::io::XInputStream > &xInGrStream, const OUString &rMediaType)
void UpdateReplacement(bool bUpdateOle=false)
sal_Int64 GetViewAspect() const
Size GetSize(MapMode const *pTargetMapMode) const
void Assign(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, sal_Int64 nAspect)
const css::uno::Reference< css::embed::XEmbeddedObject > & GetObject() const
ring_container GetRingContainer()
Definition: ring.hxx:240
static bool runAsync(const std::shared_ptr< DialogController > &rController, const std::function< void(sal_Int32)> &)
#define FN_VIEW_META_CHARS
Definition: cmdid.h:165
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
float u
#define CNT_OLE
Definition: editsh.hxx:132
sal_Int32 nState
@ FlyEmbeddedPrt
Rect of PrtArea of FlyFrame.
@ FlyEmbedded
Rect of current FlyFrame.
DocumentType eType
@ Fixed
Frame cannot be moved in Var-direction.
SwContentControlType
SwLineBreakClear
Defines the location of a line break text wrapping restart.
constexpr SwTwips DFLT_HEIGHT
Definition: frmmgr.hxx:39
constexpr SwTwips DFLT_WIDTH
Definition: frmmgr.hxx:38
void MakeFrames(SwDoc *pDoc, SwNode &rSttIdx, SwNode &rEndIdx)
Definition: frmtool.cxx:2019
SelectionType
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
constexpr sal_uInt16 RES_FRMATR_BEGIN(RES_PARATR_LIST_END)
constexpr sal_uInt16 RES_CHRATR_END(46)
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
constexpr sal_uInt16 RES_FRMATR_END(135)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr sal_uInt16 RES_PARATR_END(82)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_CONTENT_VISIBLE(185)
CharClass & GetAppCharClass()
Definition: init.cxx:706
Sequence< PropertyValue > aArguments
OUString aName
uno_Any a
sal_uInt16 nPos
MapUnit
constexpr OUStringLiteral aData
Definition: ww8scan.hxx:48
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
int i
bool IsDefBulletFontUserDefined()
determine if default bullet font is user defined
Definition: number.cxx:1390
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1561
sal_Unicode GetBulletChar(sal_uInt8 nLevel)
retrieve unicode of character used for the default bullet list for the given list level
Definition: number.cxx:1400
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
Definition: number.cxx:1395
constexpr auto toTwips(N number, Length from)
bool checkForSelectedCustomShapes(SdrView const *pSdrView, bool bOnlyExtruded)
bool checkForSelectedFontWork(SdrView const *pSdrView)
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNode const &rNode)
Definition: txtfrm.cxx:330
long Long
sal_Int16 nId
SwContentNode * GetNode(SwPaM &rPam, bool &rbFirst, SwMoveFnCollection const &fnMove, bool const bInReadOnly, SwRootFrame const *const i_pLayout)
This function returns the next node in direction of search.
Definition: pam.cxx:1020
constexpr tools::Long constTwips_5mm
Definition: pggrid.cxx:38
@ RES_POOLCHR_BULLET_LEVEL
Bullets.
Definition: poolfmt.hxx:118
@ RES_POOLCHR_NUM_LEVEL
Numbering symbols.
Definition: poolfmt.hxx:117
bool IsInvalidItem(const SfxPoolItem *pItem)
std::map< OUString, OUString > aParameters
Marks a position in the document model.
Definition: pam.hxx:37
SwNode & GetNode() const
Definition: pam.hxx:80
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:230
SVX_NUM_NUMBER_NONE
SVX_NUM_ARABIC
SVX_NUM_CHAR_SPECIAL
RndStdIds
SwView * GetActiveView()
Definition: swmodul1.cxx:116
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define SW_MOD()
Definition: swmodule.hxx:256
tools::Long SwTwips
Definition: swtypes.hxx:51
constexpr sal_uInt8 MAXLEVEL
Definition: swtypes.hxx:92
FrameControlType
Definition: swtypes.hxx:246
@ UI_INSERT_COLUMN_BREAK
@ UI_INSERT_PAGE_BREAK
bool bVisible
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
RET_YES
static bool lcl_IsAllowed(const SwWrtShell *rSh)
Definition: wrtsh1.cxx:141
static bool lcl_FoldedOutlineNodeEndOfParaSplit(SwWrtShell *pThis)
Definition: wrtsh1.cxx:1199
static SvxAutoCorrect * lcl_IsAutoCorr()
Definition: wrtsh1.cxx:171
#define BITFLD_INI_LIST
Definition: wrtsh1.cxx:158