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 ACFlags::SetDOIAttr ))
178 pACorr = nullptr;
179 return pACorr;
180}
181
182void SwWrtShell::NoEdit(bool bHideCursor)
183{
184 if(bHideCursor)
185 HideCursor();
186}
187
189{
190 if (CanInsert())
191 {
192 ShowCursor();
193 }
194}
195
197{
198 SwMvContext aMvContext(this);
199 if(IsEndPara() && !IsSttPara())
200 return true;
201
202 return IsEndWord();
203}
204
205// Insert string
206void SwWrtShell::InsertByWord( const OUString & rStr)
207{
208 if( rStr.isEmpty() )
209 return;
210
211 bool bDelim = GetAppCharClass().isLetterNumeric( rStr, 0 );
212 sal_Int32 nPos = 0, nStt = 0;
213 for( ; nPos < rStr.getLength(); nPos++ )
214 {
215 bool bTmpDelim = GetAppCharClass().isLetterNumeric( rStr, nPos );
216 if( bTmpDelim != bDelim )
217 {
218 Insert( rStr.copy( nStt, nPos - nStt ));
219 nStt = nPos;
220 }
221 }
222 if( nStt != nPos )
223 Insert( rStr.copy( nStt, nPos - nStt ));
224}
225
226void SwWrtShell::Insert( const OUString &rStr )
227{
229 if( !CanInsert() )
230 return;
231
232 bool bStarted = false;
233 bool bHasSel = HasSelection(),
234 bCallIns = m_bIns /*|| bHasSel*/;
235 bool bDeleted = false;
236
237 if( bHasSel || ( !m_bIns && IsInHiddenRange(/*bSelect=*/true) ) )
238 {
239 // Only here parenthesizing, because the normal
240 // insert is already in parentheses at Editshell.
242
243 SwRewriter aRewriter;
244
245 aRewriter.AddRule(UndoArg1, GetCursorDescr());
246 aRewriter.AddRule(UndoArg2, SwResId(STR_YIELDS));
247 {
248 OUString aTmpStr = SwResId(STR_START_QUOTE) +
249 rStr + SwResId(STR_END_QUOTE);
250
251 aRewriter.AddRule(UndoArg3, aTmpStr);
252 }
253
254 StartUndo(SwUndoId::REPLACE, &aRewriter);
255 bStarted = true;
256 Push();
257 // let's interpret a selection within the same node as "replace"
258 bDeleted = DelRight(GetCursor()->GetPoint()->GetNode() == GetCursor()->GetMark()->GetNode());
259 Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore selection (if tracking changes)
260 NormalizePam(false); // tdf#127635 put point at the end of deletion
261 ClearMark();
262 }
263
264 bCallIns ?
265 SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr );
266
267 // Check whether node is content control
268 SwTextContentControl* pTextContentControl = CursorInsideContentControl();
269 if (pTextContentControl)
270 {
271 std::shared_ptr<SwContentControl> pContentControl =
272 pTextContentControl->GetContentControl().GetContentControl();
273 if (pContentControl)
274 {
275 // Set showingPlcHdr to false as node has been edited
276 pContentControl->SetShowingPlaceHolder(false);
277 }
278 }
279
280 if( bStarted )
281 {
282 EndUndo();
283 EndAllAction();
284 }
285}
286
287// Maximum height limit not possible, because the maximum height
288// of the current frame can not be obtained.
289
290void SwWrtShell::InsertGraphic( const OUString &rPath, const OUString &rFilter,
291 const Graphic &rGrf, SwFlyFrameAttrMgr *pFrameMgr,
292 RndStdIds nAnchorType )
293{
295 if ( !CanInsert() )
296 return;
297
299
300 SwRewriter aRewriter;
301 aRewriter.AddRule(UndoArg1, SwResId(STR_GRAPHIC));
302
303 StartUndo(SwUndoId::INSERT, &aRewriter);
304
305 if ( HasSelection() )
306 DelRight();
307 // Inserted graphics in its own paragraph,
308 // if at the end of a non-empty paragraph.
309 //For i120928,avoid to split node
310
312
313 bool bSetGrfSize = true;
314 bool bOwnMgr = false;
315
316 if ( !pFrameMgr )
317 {
318 bOwnMgr = true;
319 pFrameMgr = new SwFlyFrameAttrMgr( true, this, Frmmgr_Type::GRF, nullptr );
320
321 // CAUTION
322 // GetAttrSet makes an adjustment
323 // While pasting is a SwFrameSize present
324 // because of the DEF-Framesize
325 // These must be removed explicitly for the optimal size.
326 pFrameMgr->DelAttr(RES_FRM_SIZE);
327
328 if (nAnchorType != RndStdIds::FLY_AT_PARA)
329 // Something other than at-para was requested.
330 pFrameMgr->SetAnchor(nAnchorType);
331 }
332 else
333 {
334 Size aSz( pFrameMgr->GetSize() );
335 if ( !aSz.Width() || !aSz.Height() )
336 {
339 pFrameMgr->SetSize( aSz );
340 }
341 else if ( aSz.Width() != DFLT_WIDTH && aSz.Height() != DFLT_HEIGHT )
342 bSetGrfSize = false;
343
345 }
346
347 // during change tracking, insert the image anchored as character
348 // (to create an SwRangeRedline on its anchor point)
349 if ( IsRedlineOn() && nAnchorType != RndStdIds::FLY_AS_CHAR )
350 pFrameMgr->SetAnchor( RndStdIds::FLY_AS_CHAR );
351
352 // Insert the graphic
353 SwFEShell::Insert(rPath, rFilter, &rGrf, &pFrameMgr->GetAttrSet());
354 if ( bOwnMgr )
355 pFrameMgr->UpdateAttrMgr();
356
357 if( bSetGrfSize )
358 {
359 Size aSizePixel = rGrf.GetSizePixel();
360 Size aBound = GetGraphicDefaultSize();
361
362 sal_Int32 nPreferredDPI = mxDoc->getIDocumentSettingAccess().getImagePreferredDPI();
363 Size aGrfSize;
364
365 if (nPreferredDPI > 0)
366 {
367 auto nWidth = o3tl::toTwips(aSizePixel.Width() / double(nPreferredDPI), o3tl::Length::in);
368 auto nHeight = o3tl::toTwips(aSizePixel.Height() / double(nPreferredDPI), o3tl::Length::in);
369 aGrfSize = Size(nWidth, nHeight);
370 }
371 else
372 {
373 GetGrfSize(aGrfSize);
374 }
375
376 // Add the margin attributes to GrfSize,
377 // because these counts at the margin additionally
378 aGrfSize.AdjustWidth(pFrameMgr->CalcWidthBorder() );
379 aGrfSize.AdjustHeight(pFrameMgr->CalcHeightBorder() );
380
381 const BigInt aTempWidth( aGrfSize.Width() );
382 const BigInt aTempHeight( aGrfSize.Height());
383
384 // Fit width if necessary, scale down the height proportional thereafter.
385 if( aGrfSize.Width() > aBound.Width() )
386 {
387 aGrfSize.setWidth( aBound.Width() );
388 aGrfSize.setHeight( BigInt(aBound.Width()) * aTempHeight / aTempWidth );
389 }
390 // Fit height if necessary, scale down the width proportional thereafter.
391 if( aGrfSize.Height() > aBound.Height() )
392 {
393 aGrfSize.setHeight( aBound.Height() );
394 aGrfSize.setWidth( BigInt(aBound.Height()) * aTempWidth / aTempHeight );
395 }
396 pFrameMgr->SetSize( aGrfSize );
397 pFrameMgr->UpdateFlyFrame();
398 }
399 if ( bOwnMgr )
400 delete pFrameMgr;
401
402 EndUndo();
403 EndAllAction();
404}
405
406// Insert an OLE-Object into the CORE.
407// if no object is transferred, then one will be created.
408
410 sal_uInt16 nSlotId )
411{
413 if( !CanInsert() )
414 return;
415
416 if( !xRef.is() )
417 {
418 // temporary storage
420 uno::Reference < embed::XStorage > xStor = comphelper::OStorageHelper::GetTemporaryStorage();
421 bool bDoVerb = true;
422 if ( pName )
423 {
425 OUString aName;
426 // TODO/LATER: get aspect?
427 xObj.Assign( aCnt.CreateEmbeddedObject( pName->GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT );
428 }
429 else
430 {
431 SvObjectServerList aServerList;
432 switch (nSlotId)
433 {
434 case SID_INSERT_OBJECT:
435 {
436 aServerList.FillInsertObjects();
437 aServerList.Remove( SwDocShell::Factory().GetClassId() );
438 [[fallthrough]];
439 }
440
441 // TODO/LATER: recording! Convert properties to items
442 case SID_INSERT_FLOATINGFRAME:
443 {
444 SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool();
445 const SfxSlot* pSlot = pSlotPool->GetSlot(nSlotId);
446 OUString aCmd = pSlot->GetCommand();
448 ScopedVclPtr<SfxAbstractInsertObjectDialog> pDlg(pFact->CreateInsertObjectDialog(GetFrameWeld(mxDoc->GetDocShell()),
449 aCmd, xStor, &aServerList));
450 if (pDlg)
451 {
452 pDlg->Execute();
453 bDoVerb = pDlg->IsCreateNew();
454 OUString aIconMediaType;
455 uno::Reference< io::XInputStream > xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType );
456 xObj.Assign( pDlg->GetObject(),
457 xIconMetaFile.is() ? embed::Aspects::MSOLE_ICON : embed::Aspects::MSOLE_CONTENT );
458 if ( xIconMetaFile.is() )
459 xObj.SetGraphicStream( xIconMetaFile, aIconMediaType );
460 }
461
462 break;
463 }
464
465 default:
466 break;
467 }
468 }
469
470 if ( xObj.is() )
471 {
472 if( InsertOleObject( xObj ) && bDoVerb )
473 {
474 SfxInPlaceClient* pClient = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
475 if ( !pClient )
476 {
477 pClient = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
479 }
480
481 if ( xObj.GetViewAspect() == embed::Aspects::MSOLE_ICON )
482 {
483 SwRect aArea = GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() );
484 aArea.Pos() += GetAnyCurRect( CurRectType::FlyEmbedded, nullptr, xObj.GetObject() ).Pos();
485 MapMode aMapMode( MapUnit::MapTwip );
486 Size aSize = xObj.GetSize( &aMapMode );
487 aArea.Width( aSize.Width() );
488 aArea.Height( aSize.Height() );
489 RequestObjectResize( aArea, xObj.GetObject() );
490 }
491 else
492 CalcAndSetScale( xObj );
493
494 //#50270# We don't need to handle error, this is handled by the
495 //DoVerb in the SfxViewShell
496 pClient->DoVerb(embed::EmbedVerbs::MS_OLEVERB_SHOW);
497
498 // TODO/LATER: set document name - should be done in Client
499 }
500 }
501 }
502 else
503 {
504 if( HasSelection() )
505 DelRight();
506 InsertOleObject( xRef );
507 }
508}
509
510// Insert object into the Core.
511// From ClipBoard or Insert
512
514{
515 //tdf#125100 Ensure that ole object is initially shown as pictogram
516 comphelper::EmbeddedObjectContainer& rEmbeddedObjectContainer = mxDoc->GetDocShell()->getEmbeddedObjectContainer();
517 bool bSaveUserAllowsLinkUpdate = rEmbeddedObjectContainer.getUserAllowsLinkUpdate();
518 rEmbeddedObjectContainer.setUserAllowsLinkUpdate(true);
519
522
524
525 //Some differences between StarMath and any other objects:
526 //1. Selections should be deleted. For StarMath the Text should be
527 // passed to the Object
528 //2. If the cursor is at the end of a non empty paragraph a paragraph
529 // break should be inserted. StarMath objects are character bound and
530 // no break should be inserted.
531 //3. If an selection is passed to a StarMath object, this object should
532 // not be activated. false should be returned then.
533 bool bStarMath = true;
534 bool bActivate = true;
535
536 // set parent to get correct VisArea(in case of object needing parent printer)
537 uno::Reference < container::XChild > xChild( xRef.GetObject(), uno::UNO_QUERY );
538 if ( xChild.is() )
539 xChild->setParent( mxDoc->GetDocShell()->GetModel() );
540
541 SvGlobalName aCLSID( xRef->getClassID() );
542 bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 );
543 if( IsSelection() )
544 {
545 if( bStarMath )
546 {
547 OUString aMathData;
549
550 if( !aMathData.isEmpty() && svt::EmbeddedObjectRef::TryRunningState( xRef.GetObject() ) )
551 {
552 uno::Reference < beans::XPropertySet > xSet( xRef->getComponent(), uno::UNO_QUERY );
553 if ( xSet.is() )
554 {
555 try
556 {
557 xSet->setPropertyValue("Formula", uno::Any( aMathData ) );
558 bActivate = false;
559 }
560 catch (const uno::Exception&)
561 {
562 }
563 }
564 }
565 }
566 DelRight();
567 }
568
569 if ( !bStarMath )
570 SwFEShell::SplitNode( false, false );
571
573
574 const SvGlobalName* pName = nullptr;
575 SvGlobalName aObjClsId;
576 if (xRef.is())
577 {
578 aObjClsId = SvGlobalName(xRef.GetObject()->getClassID());
579 pName = &aObjClsId;
580 }
581 SwFlyFrameAttrMgr aFrameMgr( true, this, Frmmgr_Type::OLE, pName );
583
584 SwRect aBound;
585 CalcBoundRect( aBound, aFrameMgr.GetAnchor() );
586
587 //The Size should be suggested by the OLE server
588 MapMode aMapMode( MapUnit::MapTwip );
589 Size aSz = xRef.GetSize( &aMapMode );
590
591 //Object size can be limited
592 if ( aSz.Width() > aBound.Width() )
593 {
594 //Always limit proportional.
595 aSz.setHeight( aSz.Height() * aBound.Width() / aSz.Width() );
596 aSz.setWidth( aBound.Width() );
597 }
598 aFrameMgr.SetSize( aSz );
599 SwFlyFrameFormat *pFormat = SwFEShell::InsertObject( xRef, &aFrameMgr.GetAttrSet() );
600
601 // --> #i972#
602 if ( bStarMath && mxDoc->getIDocumentSettingAccess().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT ) )
604
605 if (pFlyFrameFormat)
606 *pFlyFrameFormat = pFormat;
607
608 if ( SotExchange::IsChart( aCLSID ) )
609 {
610 uno::Reference< embed::XEmbeddedObject > xEmbeddedObj = xRef.GetObject();
611 if ( xEmbeddedObj.is() )
612 {
613 bool bDisableDataTableDialog = false;
615 uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY );
616 if ( xProps.is() &&
617 ( xProps->getPropertyValue("DisableDataTableDialog") >>= bDisableDataTableDialog ) &&
618 bDisableDataTableDialog )
619 {
620 xProps->setPropertyValue("DisableDataTableDialog",
621 uno::Any( false ) );
622 xProps->setPropertyValue("DisableComplexChartTypes",
623 uno::Any( false ) );
624 uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY );
625 if ( xModifiable.is() )
626 {
627 xModifiable->setModified( true );
628 }
629 }
630 }
631 }
632
633 EndAllAction();
634 GetView().AutoCaption(OLE_CAP, &aCLSID);
635
636 SwRewriter aRewriter;
637
638 if ( bStarMath )
639 aRewriter.AddRule(UndoArg1, SwResId(STR_MATH_FORMULA));
640 else if ( SotExchange::IsChart( aCLSID ) )
641 aRewriter.AddRule(UndoArg1, SwResId(STR_CHART));
642 else
643 aRewriter.AddRule(UndoArg1, SwResId(STR_OLE));
644
645 EndUndo(SwUndoId::INSERT, &aRewriter);
646
647 rEmbeddedObjectContainer.setUserAllowsLinkUpdate(bSaveUserAllowsLinkUpdate);
648
649 return bActivate;
650}
651
652// The current selected OLE object will be loaded with the
653// verb into the server.
654void SwWrtShell::LaunchOLEObj(sal_Int32 nVerb)
655{
656 if ( GetCntType() != CNT_OLE ||
657 GetView().GetViewFrame().GetFrame().IsInPlace() )
658 return;
659
661 OSL_ENSURE( xRef.is(), "OLE not found" );
662
663 // LOK: we don't want to handle any other embedded objects than
664 // charts, there are too many problems with eg. embedded spreadsheets
665 // (like it creates a separate view for the calc sheet)
667 {
668 const auto classId = xRef->getClassID();
669 if (!SotExchange::IsChart(classId) && !SotExchange::IsMath(classId))
670 return;
671 }
672
673 SfxInPlaceClient* pCli = GetView().FindIPClient( xRef.GetObject(), &GetView().GetEditWin() );
674 if ( !pCli )
675 pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xRef );
676
677 uno::Reference<lang::XInitialization> xOLEInit(xRef.GetObject(), uno::UNO_QUERY);
678 if (xOLEInit.is())
679 {
680 uno::Sequence<beans::PropertyValue> aArguments
681 = { comphelper::makePropertyValue("ReadOnly", pCli->IsProtected()) };
682 xOLEInit->initialize({ uno::Any(aArguments) });
683 }
684
685 static_cast<SwOleClient*>(pCli)->SetInDoVerb( true );
686
687 CalcAndSetScale( xRef );
688 pCli->DoVerb( nVerb );
689
690 static_cast<SwOleClient*>(pCli)->SetInDoVerb( false );
691 CalcAndSetScale( xRef );
692}
693
695{
696 try
697 {
698 sal_Int32 nState = xObj->getCurrentState();
699 if ( nState == css::embed::EmbedStates::INPLACE_ACTIVE
700 || nState == css::embed::EmbedStates::UI_ACTIVE )
701 {
702 SfxInPlaceClient* pCli =
703 GetView().FindIPClient( xObj.GetObject(), &(GetView().GetEditWin()) );
704 if ( pCli )
705 {
706 tools::Rectangle aArea = pCli->GetObjArea();
707 aArea += rOffset;
708 pCli->SetObjArea( aArea );
709 }
710 }
711 }
712 catch (const uno::Exception&)
713 {
714 }
715}
716
718 const SwRect *pFlyPrtRect,
719 const SwRect *pFlyFrameRect,
720 const bool bNoTextFramePrtAreaChanged )
721{
722 // Setting the scale of the client. This arises from the difference
723 // between the VisArea of the object and the ObjArea.
724 OSL_ENSURE( xObj.is(), "ObjectRef not valid" );
725
726 sal_Int64 nAspect = xObj.GetViewAspect();
727 if ( nAspect == embed::Aspects::MSOLE_ICON )
728 return; // the replacement image is completely controlled by container in this case
729
730 sal_Int64 nMisc = 0;
731 bool bLinkingChart = false;
732
733 try
734 {
735 nMisc = xObj->getStatus( nAspect );
736
737 // This can surely only be a non-active object, if desired they
738 // get the new size set as VisArea (StarChart).
739 if( embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc )
740 {
741 // TODO/MBA: testing
742 SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
744 if( !aRect.IsEmpty() )
745 {
746 // TODO/LEAN: getMapUnit can switch object to running state
747 // xObj.TryRunningState();
748
749 MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
750
751 // TODO/LATER: needs complete VisArea?!
752 Size aSize( OutputDevice::LogicToLogic(aRect.SVRect(), MapMode(MapUnit::MapTwip), MapMode(aUnit)).GetSize() );
753 awt::Size aSz;
754 aSz.Width = aSize.Width();
755 aSz.Height = aSize.Height();
756
757 // Action 'setVisualAreaSize' doesn't have to turn on the
758 // modified state of the document, either.
759 bool bModified = false;
760 uno::Reference<util::XModifiable> xModifiable(xObj->getComponent(), uno::UNO_QUERY);
761 if (xModifiable.is())
762 bModified = xModifiable->isModified();
763 xObj->setVisualAreaSize( nAspect, aSz );
764 xModifiable.set(xObj->getComponent(), uno::UNO_QUERY);
765 if (xModifiable.is() && xModifiable->isModified() && !bModified)
766 xModifiable->setModified(bModified);
767
768 // #i48419# - action 'UpdateReplacement' doesn't
769 // have to change the modified state of the document.
770 // This is only a workaround for the defect, that this action
771 // modifies a document after load, because unnecessarily the
772 // replacement graphic is updated, in spite of the fact that
773 // nothing has been changed.
774 // If the replacement graphic changes by this action, the document
775 // will be already modified via other mechanisms.
776 {
777 bool bResetEnableSetModified(false);
778 if ( GetDoc()->GetDocShell()->IsEnableSetModified() )
779 {
780 GetDoc()->GetDocShell()->EnableSetModified( false );
781 bResetEnableSetModified = true;
782 }
783
784 //#i79576# don't destroy chart replacement images on load
785 //#i79578# don't request a new replacement image for charts to often
786 //a chart sends a modified call to the framework if it was changed
787 //thus the replacement update is already handled elsewhere
788 if ( !SotExchange::IsChart( xObj->getClassID() ) )
789 xObj.UpdateReplacement();
790
791 if ( bResetEnableSetModified )
792 {
794 }
795 }
796 }
797
798 // TODO/LATER: this is only a workaround,
799 uno::Reference< chart2::XChartDocument > xChartDocument( xObj->getComponent(), uno::UNO_QUERY );
800 bLinkingChart = ( xChartDocument.is() && !xChartDocument->hasInternalDataProvider() );
801 }
802 }
803 catch (const uno::Exception&)
804 {
805 // TODO/LATER: handle the error
806 return;
807 }
808
809 SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() );
810 if ( !pCli )
811 {
812 if ( (embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY & nMisc)
813 || bLinkingChart
814 // --> OD #i117189# - refine condition for non-resizable objects
815 // non-resizable objects need to be set the size back by this method
816 || ( bNoTextFramePrtAreaChanged && nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE ) )
817 {
818 pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
819 }
820 else
821 return;
822 }
823
824 // TODO/LEAN: getMapUnit can switch object to running state
825 // xObj.TryRunningState();
826
827 awt::Size aSize;
828 try
829 {
830 aSize = xObj->getVisualAreaSize( nAspect );
831 }
832 catch (const embed::NoVisualAreaSizeException&)
833 {
834 OSL_FAIL("Can't get visual area size!" );
835 // the scaling will not be done
836 }
837 catch (const uno::Exception&)
838 {
839 // TODO/LATER: handle the error
840 OSL_FAIL("Can't get visual area size!" );
841 return;
842 }
843
844 Size _aVisArea( aSize.Width, aSize.Height );
845
846 Fraction aScaleWidth( 1, 1 );
847 Fraction aScaleHeight( 1, 1 );
848
849 bool bUseObjectSize = false;
850
851 // As long as there comes no reasonable size from the object,
852 // nothing can be scaled.
853 if( _aVisArea.Width() && _aVisArea.Height() )
854 {
855 const MapMode aTmp( MapUnit::MapTwip );
856 MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) );
857 _aVisArea = OutputDevice::LogicToLogic(_aVisArea, MapMode(aUnit), aTmp);
858 Size aObjArea;
859 if ( pFlyPrtRect )
860 aObjArea = pFlyPrtRect->SSize();
861 else
862 aObjArea = GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() ).SSize();
863
864 // differ the aObjArea and _aVisArea by 1 Pixel then set new VisArea
865 tools::Long nX, nY;
866 SwSelPaintRects::Get1PixelInLogic( *this, &nX, &nY );
867 if( !( _aVisArea.Width() - nX <= aObjArea.Width() &&
868 _aVisArea.Width() + nX >= aObjArea.Width() &&
869 _aVisArea.Height()- nY <= aObjArea.Height()&&
870 _aVisArea.Height()+ nY >= aObjArea.Height() ))
871 {
872 if ( nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE )
873 {
874 // the object must not be scaled,
875 // the size stored in object must be used for restoring
876 bUseObjectSize = true;
877 }
878 else
879 {
880 aScaleWidth = Fraction( aObjArea.Width(), _aVisArea.Width() );
881 aScaleHeight = Fraction( aObjArea.Height(), _aVisArea.Height());
882 }
883 }
884 }
885
886 // Now is the favorable time to set the ObjArea.
887 // The Scaling must be considered.
888 SwRect aArea;
889 if ( pFlyPrtRect )
890 {
891 aArea = *pFlyPrtRect;
892 aArea += pFlyFrameRect->Pos();
893 }
894 else
895 {
896 aArea = GetAnyCurRect( CurRectType::FlyEmbeddedPrt, nullptr, xObj.GetObject() );
897 aArea.Pos() += GetAnyCurRect( CurRectType::FlyEmbedded, nullptr, xObj.GetObject() ).Pos();
898 }
899
900 if ( bUseObjectSize )
901 {
902 // --> this moves non-resizable object so that when adding borders the baseline remains the same
903 const SwFlyFrameFormat *pFlyFrameFormat = dynamic_cast< const SwFlyFrameFormat * >( GetFlyFrameFormat() );
904 OSL_ENSURE( pFlyFrameFormat, "Could not find fly frame." );
905 if ( pFlyFrameFormat )
906 {
907 const Point &rPoint = pFlyFrameFormat->GetLastFlyFramePrtRectPos();
908 SwRect aRect( pFlyPrtRect ? *pFlyPrtRect
910 aArea += rPoint - aRect.Pos(); // adjust area by diff of printing area position in order to keep baseline alignment correct.
911 }
912 aArea.Width ( _aVisArea.Width() );
913 aArea.Height( _aVisArea.Height() );
914 RequestObjectResize( aArea, xObj.GetObject() );
915 }
916 else
917 {
918 tools::Long nWidth(pCli->GetScaleWidth());
919 tools::Long nHeight(pCli->GetScaleHeight());
920 if (nWidth && nHeight)
921 {
922 aArea.Width ( aArea.Width() / nWidth );
923 aArea.Height( aArea.Height() / nHeight );
924 }
925 }
926
927 pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight );
928}
929
931 const SwRect &rFrame )
932{
933 SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin());
934 if ( !pCli )
935 new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj );
936 CalcAndSetScale( xObj, &rPrt, &rFrame );
937}
938
939// Insert hard page break;
940// Selections will be overwritten
941void SwWrtShell::InsertPageBreak(const OUString *pPageDesc, const ::std::optional<sal_uInt16>& oPgNum )
942{
943 if (!lcl_IsAllowed(this))
944 return;
945
947 if( CanInsert() )
948 {
949 SwActContext aActContext(this);
951
952 if ( !IsCursorInTable() )
953 {
954 if(HasSelection())
955 DelRight();
957 // delete the numbered attribute of the last line if the last line is empty
958 GetDoc()->ClearLineNumAttrs( *GetCursor()->GetPoint() );
959 }
960
961 const SwPageDesc *pDesc = pPageDesc
962 ? FindPageDescByName( *pPageDesc, true ) : nullptr;
963 if( pDesc )
964 {
965 SwFormatPageDesc aDesc( pDesc );
966 aDesc.SetNumOffset( oPgNum );
967 SetAttrItem( aDesc );
968 }
969 else
970 SetAttrItem( SvxFormatBreakItem(SvxBreak::PageBefore, RES_BREAK) );
972 }
973 collectUIInformation("BREAK_PAGE", "parameter");
974}
975
976// Insert hard page break;
977// Selections will be overwritten
978
979void SwWrtShell::InsertLineBreak(std::optional<SwLineBreakClear> oClear)
980{
981 if (!lcl_IsAllowed(this))
982 return;
983
985 if( CanInsert() )
986 {
987 if(HasSelection())
988 DelRight();
989
990 const sal_Unicode cIns = 0x0A;
992 if (oClear.has_value())
993 {
994 eClear = *oClear;
995 }
996 SvxAutoCorrect* pACorr = lcl_IsAutoCorr();
997 if (pACorr && eClear == SwLineBreakClear::NONE)
998 AutoCorrect( *pACorr, cIns );
999 else
1000 {
1001 if (eClear == SwLineBreakClear::NONE)
1002 {
1003 SwWrtShell::Insert(OUString(cIns));
1004 }
1005 else
1006 {
1007 SwFormatLineBreak aLineBreak(eClear);
1008 SetAttrItem(aLineBreak);
1009 }
1010 }
1011 }
1012}
1013
1014// Insert hard column break;
1015// Selections will be overwritten
1016
1018{
1019 if (!lcl_IsAllowed(this))
1020 return;
1021
1022 SwActContext aActContext(this);
1024 if( !CanInsert() )
1025 return;
1026
1028
1029 if ( !IsCursorInTable() )
1030 {
1031 if(HasSelection())
1032 DelRight();
1033 SwFEShell::SplitNode( false, false );
1034 }
1035 SetAttrItem(SvxFormatBreakItem(SvxBreak::ColumnBefore, RES_BREAK));
1036
1038}
1039
1041{
1042 if (!lcl_IsAllowed(this))
1043 {
1044 return;
1045 }
1046
1048 if (!CanInsert())
1049 {
1050 return;
1051 }
1052
1053 auto pContentControl = std::make_shared<SwContentControl>(nullptr);
1054 OUString aPlaceholder;
1055 switch (eType)
1056 {
1059 {
1060 pContentControl->SetShowingPlaceHolder(true);
1062 {
1063 pContentControl->SetPlainText(true);
1064 }
1065 if (!HasSelection())
1066 {
1067 aPlaceholder = SwResId(STR_CONTENT_CONTROL_PLACEHOLDER);
1068 }
1069 break;
1070 }
1072 {
1073 pContentControl->SetCheckbox(true);
1074 // Ballot Box with X
1075 pContentControl->SetCheckedState(u"\u2612");
1076 // Ballot Box
1077 pContentControl->SetUncheckedState(OUString(u"\u2610"));
1078 aPlaceholder = u"\u2610";
1079 break;
1080 }
1083 {
1085 {
1086 pContentControl->SetComboBox(true);
1087 }
1089 {
1090 pContentControl->SetDropDown(true);
1091 }
1092
1093 pContentControl->SetShowingPlaceHolder(true);
1094 if (!HasSelection())
1095 {
1096 aPlaceholder = SwResId(STR_DROPDOWN_CONTENT_CONTROL_PLACEHOLDER);
1097 }
1098 SwContentControlListItem aListItem;
1099 aListItem.m_aValue = aPlaceholder;
1100 pContentControl->SetListItems({ aListItem });
1101 break;
1102 }
1104 {
1105 // Set up the picture content control.
1106 pContentControl->SetShowingPlaceHolder(true);
1107 pContentControl->SetPicture(true);
1108
1109 // Create the placeholder bitmap.
1110 BitmapEx aBitmap(Size(1, 1), vcl::PixelFormat::N24_BPP);
1112 aColor.IncreaseLuminance(255 * 0.75);
1113 aBitmap.Erase(aColor);
1114 SwRewriter aRewriter;
1115 aRewriter.AddRule(UndoArg1, SwResId(STR_GRAPHIC_DEFNAME));
1116 StartUndo(SwUndoId::INSERT, &aRewriter);
1118 StartAction();
1119 InsertGraphic(OUString(), OUString(), aBitmap, nullptr, RndStdIds::FLY_AS_CHAR);
1120
1121 // Set properties on the bitmap.
1123 GetFlyFrameAttr(aSet);
1124 SwFormatFrameSize aSize(SwFrameSize::Fixed, 3000, 3000);
1125 aSet.Put(aSize);
1126 SetFlyFrameAttr(aSet);
1127 SwFrameFormat* pFrameFormat = GetFlyFrameFormat();
1128 EndAction();
1129 UnlockPaint();
1130 EndUndo();
1131
1132 // Go after the anchor position.
1133 UnSelectFrame();
1135 {
1136 SwCursor* pCursor = getShellCursor(true);
1137 pCursor->DeleteMark();
1138 const SwFormatAnchor& rFormatAnchor = pFrameFormat->GetAnchor();
1139 pCursor->GetPoint()->Assign( *rFormatAnchor.GetAnchorContentNode(), rFormatAnchor.GetAnchorContentOffset() + 1);
1140 }
1141
1142 // Select before the anchor position.
1143 Left(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false);
1144 break;
1145 }
1147 {
1148 pContentControl->SetShowingPlaceHolder(true);
1149 pContentControl->SetDate(true);
1150 SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter();
1151 sal_uInt32 nStandardFormat = pFormatter->GetStandardFormat(SvNumFormatType::DATE);
1152 const SvNumberformat* pFormat = pFormatter->GetEntry(nStandardFormat);
1153 pContentControl->SetDateFormat(pFormat->GetFormatstring());
1154 pContentControl->SetDateLanguage(LanguageTag(pFormat->GetLanguage()).getBcp47());
1155 if (!HasSelection())
1156 {
1157 aPlaceholder = SwResId(STR_DATE_CONTENT_CONTROL_PLACEHOLDER);
1158 }
1159 break;
1160 }
1161 }
1162 if (aPlaceholder.getLength())
1163 {
1164 Insert(aPlaceholder);
1165 Left(SwCursorSkipMode::Chars, /*bSelect=*/true, aPlaceholder.getLength(),
1166 /*bBasicCall=*/false);
1167 }
1168 SwFormatContentControl aContentControl(pContentControl, RES_TXTATR_CONTENTCONTROL);
1169 SetAttrItem(aContentControl);
1170}
1171
1172// Insert footnote
1173// rStr - optional footnote mark
1174
1175void SwWrtShell::InsertFootnote(const OUString &rStr, bool bEndNote, bool bEdit )
1176{
1178 if( !CanInsert() )
1179 return;
1180
1181 if(HasSelection())
1182 {
1183 //collapse cursor to the end
1184 if(!IsCursorPtAtEnd())
1185 SwapPam();
1186 ClearMark();
1187 }
1188 SwPosition aPos = *GetCursor()->GetPoint();
1189 SwFormatFootnote aFootNote( bEndNote );
1190 if(!rStr.isEmpty())
1191 aFootNote.SetNumStr( rStr );
1192
1193 SetAttrItem(aFootNote);
1194
1195 if( bEdit )
1196 {
1197 // For editing the footnote text.
1198 Left(SwCursorSkipMode::Chars, false, 1, false );
1200 }
1202}
1203
1204// tdf#141634
1206{
1207 SwTextNode* pTextNode = pThis->GetCursor()->GetPointNode().GetTextNode();
1208 if (pTextNode && pTextNode->IsOutline())
1209 {
1210 bool bVisible = true;
1212 if (!bVisible)
1213 {
1214 const SwNodes& rNodes = pThis->GetNodes();
1215 const SwOutlineNodes& rOutlineNodes = rNodes.GetOutLineNds();
1217 (void) rOutlineNodes.Seek_Entry(pTextNode, &nPos);
1218
1219 SwNode* pSttNd = rOutlineNodes[nPos];
1220
1221 // determine end node of folded outline content
1222 SwNode* pEndNd = &rNodes.GetEndOfContent();
1223 if (rOutlineNodes.size() > nPos + 1)
1224 pEndNd = rOutlineNodes[nPos + 1];
1225
1227 {
1228 // get the next outline node after the folded outline content (iPos)
1229 // it is the next outline node with the same level or less
1230 int nLevel = pSttNd->GetTextNode()->GetAttrOutlineLevel();
1232 while (++iPos < rOutlineNodes.size() &&
1233 rOutlineNodes[iPos]->GetTextNode()->GetAttrOutlineLevel() > nLevel);
1234
1235 // get the correct end node
1236 // the outline node may be in frames, headers, footers special section of doc model
1237 SwNode* pStartOfSectionNodeSttNd = pSttNd->StartOfSectionNode();
1238 while (pStartOfSectionNodeSttNd->StartOfSectionNode()
1239 != pStartOfSectionNodeSttNd->StartOfSectionNode()->StartOfSectionNode())
1240 {
1241 pStartOfSectionNodeSttNd = pStartOfSectionNodeSttNd->StartOfSectionNode();
1242 }
1243 pEndNd = pStartOfSectionNodeSttNd->EndOfSectionNode();
1244
1245 if (iPos < rOutlineNodes.size())
1246 {
1247 SwNode* pStartOfSectionNode = rOutlineNodes[iPos]->StartOfSectionNode();
1248 while (pStartOfSectionNode->StartOfSectionNode()
1249 != pStartOfSectionNode->StartOfSectionNode()->StartOfSectionNode())
1250 {
1251 pStartOfSectionNode = pStartOfSectionNode->StartOfSectionNode();
1252 }
1253 if (pStartOfSectionNodeSttNd == pStartOfSectionNode)
1254 pEndNd = rOutlineNodes[iPos];
1255 }
1256 }
1257
1258 // table, text box, header, footer
1259 if (pSttNd->GetTableBox() || pSttNd->GetIndex() < rNodes.GetEndOfExtras().GetIndex())
1260 {
1261 // insert before section end node
1262 if (pSttNd->EndOfSectionIndex() < pEndNd->GetIndex())
1263 {
1264 SwNodeIndex aIdx(*pSttNd->EndOfSectionNode());
1265 while (aIdx.GetNode().IsEndNode())
1266 --aIdx;
1267 ++aIdx;
1268 pEndNd = &aIdx.GetNode();
1269 }
1270 }
1271 // if pSttNd isn't in table but pEndNd is then insert after table
1272 else if (pEndNd->GetTableBox())
1273 {
1274 pEndNd = pEndNd->FindTableNode();
1275 SwNodeIndex aIdx(*pEndNd, -1);
1276 // account for nested tables
1277 while (aIdx.GetNode().GetTableBox())
1278 {
1279 pEndNd = aIdx.GetNode().FindTableNode();
1280 aIdx.Assign(*pEndNd, -1);
1281 }
1282 aIdx.Assign(*pEndNd->EndOfSectionNode(), +1);
1283 pEndNd = &aIdx.GetNode();
1284 }
1285 // end node determined
1286
1287 // now insert the new outline node
1288 SwDoc* pDoc = pThis->GetDoc();
1289
1290 // insert at end of tablebox doesn't work correct without
1292
1293 SwTextNode* pNd = pDoc->GetNodes().MakeTextNode(*pEndNd, pTextNode->GetTextColl(), true);
1294
1295 (void) rOutlineNodes.Seek_Entry(pNd, &nPos);
1296 pThis->GotoOutline(nPos);
1297
1298 if (pDoc->GetIDocumentUndoRedo().DoesUndo())
1299 {
1300 pDoc->GetIDocumentUndoRedo().ClearRedo();
1301 pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsert>(*pNd));
1302 pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoFormatColl>
1303 (SwPaM(*pNd), pNd->GetTextColl(), true, true));
1304 }
1305
1306 pThis->SetModified();
1307 return true;
1308 }
1309 }
1310 return false;
1311}
1312
1313// SplitNode; also, because
1314// - of deleting selected content;
1315// - of reset of the Cursorstack if necessary.
1316
1317void SwWrtShell::SplitNode( bool bAutoFormat )
1318{
1320 if( !CanInsert() )
1321 return;
1322
1323 SwActContext aActContext(this);
1324
1327
1328 bool bHasSel = HasSelection();
1329 if (bHasSel)
1330 DelRight();
1331
1332 bool bHandled = false;
1333 if (GetViewOptions()->IsShowOutlineContentVisibilityButton() && IsEndPara())
1334 bHandled = lcl_FoldedOutlineNodeEndOfParaSplit(this);
1335
1336 if (!bHandled)
1337 SwFEShell::SplitNode( bAutoFormat );
1338
1340}
1341
1342// Turn on numbering
1343// Parameter: Optional specification of a name for the named list;
1344// this indicates a position if it is possible to convert them
1345// into a number and less than nMaxRules.
1346
1347// To test the CharFormats at the numbering
1348// external void SetNumChrFormat( SwWrtShell*, SwNumRules& );
1349
1350// -> #i40041#
1351// Preconditions (as far as OD has figured out):
1352// - <SwEditShell::HasNumber()> is false, if <bNum> is true
1353// - <SwEditShell::HasBullet()> is false, if <bNum> is false
1354// Behavior of method is determined by the current situation at the current
1355// cursor position in the document.
1357{
1359
1360 const SwNumRule* pNumRule = GetNumRuleAtCurrCursorPos();
1361
1362 // - activate outline rule respectively turning on outline rule for
1363 // current text node. But, only for turning on a numbering (<bNum> == true).
1364 // - overwrite found numbering rule at current cursor position, if
1365 // no numbering rule can be retrieved from the paragraph style.
1366 bool bContinueFoundNumRule( false );
1367 bool bActivateOutlineRule( false );
1368 int nActivateOutlineLvl( MAXLEVEL ); // only relevant, if <bActivateOutlineRule> == true
1370 if ( pColl )
1371 {
1372 // retrieve numbering rule at paragraph
1373 // style, which is found at current cursor position in the document.
1374 SwNumRule* pCollRule = mxDoc->FindNumRulePtr(pColl->GetNumRule().GetValue());
1375 // #125993# - The outline numbering rule isn't allowed
1376 // to be derived from a parent paragraph style to a derived one.
1377 // Thus check, if the found outline numbering rule is directly
1378 // set at the paragraph style <pColl>. If not, set <pCollRule> to NULL
1379 if ( pCollRule && pCollRule == GetDoc()->GetOutlineNumRule() )
1380 {
1381 const SwNumRule* pDirectCollRule =
1382 mxDoc->FindNumRulePtr(pColl->GetNumRule( false ).GetValue());
1383 if ( !pDirectCollRule )
1384 {
1385 pCollRule = nullptr;
1386 }
1387 }
1388
1389 if ( !pCollRule )
1390 {
1391 pNumRule = pCollRule;
1392 }
1393 // no activation or continuation of outline numbering in Writer/Web document
1394 else if ( bNum &&
1395 !dynamic_cast<SwWebDocShell*>(GetDoc()->GetDocShell()) &&
1396 pCollRule == GetDoc()->GetOutlineNumRule() )
1397 {
1398 if ( pNumRule == pCollRule )
1399 {
1400 // check, if text node at current cursor positioned is counted.
1401 // If not, let it been counted. Then it has to be checked,
1402 // of the outline numbering has to be activated or continued.
1403 SwTextNode const*const pTextNode = sw::GetParaPropsNode(
1404 *GetLayout(), GetCursor()->GetPoint()->GetNode());
1405 if ( pTextNode && !pTextNode->IsCountedInList() )
1406 {
1407 // check, if numbering of the outline level of the paragraph
1408 // style is active. If not, activate this outline level.
1409 nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1410 OSL_ENSURE( pColl->IsAssignedToListLevelOfOutlineStyle(),
1411 "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
1413 pCollRule->Get( o3tl::narrowing<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1415 {
1416 // activate outline numbering
1417 bActivateOutlineRule = true;
1418 }
1419 else
1420 {
1421 // turning on outline numbering at current cursor position
1422 bContinueFoundNumRule = true;
1423 }
1424 }
1425 else
1426 {
1427 // #i101234#
1428 // activate outline numbering, because from the precondition
1429 // it's known, that <SwEdit::HasNumber()> == false
1430 bActivateOutlineRule = true;
1431 nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1432 }
1433 }
1434 else if ( !pNumRule )
1435 {
1436 // #i101234#
1437 // Check, if corresponding list level of the outline numbering
1438 // has already a numbering format set.
1439 nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1440 if ( pCollRule->Get( o3tl::narrowing<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1442 {
1443 // activate outline numbering, because from the precondition
1444 // it's known, that <SwEdit::HasNumber()> == false
1445 bActivateOutlineRule = true;
1446 }
1447 else
1448 {
1449 // turning on outline numbering at current cursor position
1450 bContinueFoundNumRule = true;
1451 }
1452 }
1453 else
1454 {
1455 // check, if numbering of the outline level of the paragraph
1456 // style is active. If not, activate this outline level.
1457 nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();
1458 OSL_ENSURE( pColl->IsAssignedToListLevelOfOutlineStyle(),
1459 "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" );
1461 pCollRule->Get( o3tl::narrowing<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType()
1463 {
1464 // activate outline numbering
1465 bActivateOutlineRule = true;
1466 }
1467 else
1468 {
1469 // turning on outline numbering at current cursor position
1470 bContinueFoundNumRule = true;
1471 }
1472 }
1473 pNumRule = pCollRule;
1474 }
1475 }
1476
1477 // Only automatic numbering/bullet rules should be changed.
1478 // Note: The outline numbering rule is also an automatic one. It's only
1479 // changed, if it has to be activated.
1480 if ( pNumRule )
1481 {
1482 if ( !pNumRule->IsAutoRule() )
1483 {
1484 pNumRule = nullptr;
1485 }
1486 else if ( pNumRule == GetDoc()->GetOutlineNumRule() &&
1487 !bActivateOutlineRule && !bContinueFoundNumRule )
1488 {
1489 pNumRule = nullptr;
1490 }
1491 }
1492
1493 // Search for a previous numbering/bullet rule to continue it.
1494 OUString sContinuedListId;
1495 if ( !pNumRule )
1496 {
1497 pNumRule = GetDoc()->SearchNumRule( *GetCursor()->GetPoint(),
1498 false, bNum, false, 0,
1499 sContinuedListId, GetLayout() );
1500 bContinueFoundNumRule = pNumRule != nullptr;
1501 }
1502
1503 if (pNumRule)
1504 {
1505 SwNumRule aNumRule(*pNumRule);
1506
1507 // do not change found numbering/bullet rule, if it should only be continued.
1508 if ( !bContinueFoundNumRule )
1509 {
1510 SwTextNode const*const pTextNode = sw::GetParaPropsNode(
1511 *GetLayout(), GetCursor()->GetPoint()->GetNode());
1512
1513 if (pTextNode)
1514 {
1515 // use above retrieve outline level, if outline numbering has to be activated.
1516 int nLevel = bActivateOutlineRule
1517 ? nActivateOutlineLvl
1518 : pTextNode->GetActualListLevel();
1519
1520 if (nLevel < 0)
1521 nLevel = 0;
1522
1523 if (nLevel >= MAXLEVEL)
1524 nLevel = MAXLEVEL - 1;
1525
1526 SwNumFormat aFormat(aNumRule.Get(o3tl::narrowing<sal_uInt16>(nLevel)));
1527
1528 if (bNum)
1530 else
1531 {
1532 // #i63395# Only apply user defined default bullet font
1534 {
1535 const vcl::Font* pFnt = &numfunc::GetDefBulletFont();
1536 aFormat.SetBulletFont( pFnt );
1537 }
1538 aFormat.SetBulletChar( numfunc::GetBulletChar(static_cast<sal_uInt8>(nLevel)));
1540 // #i93908# clear suffix for bullet lists
1541 aFormat.SetListFormat("", "", nLevel);
1542 }
1543 aNumRule.Set(o3tl::narrowing<sal_uInt16>(nLevel), aFormat);
1544 }
1545 }
1546
1547 // reset indent attribute on applying list style
1548 SetCurNumRule( aNumRule, false, sContinuedListId, true );
1549 }
1550 else
1551 {
1552 // #i95907#
1553 const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode(
1555 SwNumRule aNumRule( GetUniqueNumRuleName(), ePosAndSpaceMode );
1556 // Append the character template at the numbering.
1557 SwCharFormat* pChrFormat;
1558 SwDocShell* pDocSh = GetView().GetDocShell();
1559 // #i63395#
1560 // Only apply user defined default bullet font
1563 : nullptr;
1564
1565 if (bNum)
1566 {
1568 }
1569 else
1570 {
1572 }
1573
1574 const SwTextNode *const pTextNode = sw::GetParaPropsNode(*GetLayout(),
1575 GetCursor()->GetPoint()->GetNode());
1576 const SwTwips nWidthOfTabs = pTextNode
1577 ? pTextNode->GetWidthOfLeadingTabs()
1578 : 0;
1580
1581 const bool bHtml = dynamic_cast<SwWebDocShell*>( pDocSh ) != nullptr;
1582 const bool bRightToLeft = IsInRightToLeftText();
1583 for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl )
1584 {
1585 SwNumFormat aFormat( aNumRule.Get( nLvl ) );
1586 aFormat.SetCharFormat( pChrFormat );
1587
1588 if (! bNum)
1589 {
1590 // #i63395#
1591 // Only apply user defined default bullet font
1592 if ( pFnt )
1593 {
1594 aFormat.SetBulletFont( pFnt );
1595 }
1596 aFormat.SetBulletChar( numfunc::GetBulletChar(nLvl) );
1598 // #i93908# clear suffix for bullet lists
1599 aFormat.SetListFormat("", "", nLvl);
1600 }
1601
1602 // #i95907#
1603 if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
1604 {
1605 if(bHtml && nLvl)
1606 {
1607 // 1/2" for HTML
1608 aFormat.SetAbsLSpace(nLvl * 720);
1609 }
1610 else if ( nWidthOfTabs > 0 )
1611 {
1612 aFormat.SetAbsLSpace(nWidthOfTabs + nLvl * 720);
1613 }
1614 }
1615
1616 // #i38904# Default alignment for
1617 // numbering/bullet should be rtl in rtl paragraph:
1618 if ( bRightToLeft )
1619 {
1620 aFormat.SetNumAdjust( SvxAdjust::Right );
1621 }
1622
1623 aNumRule.Set( nLvl, aFormat );
1624 }
1625
1626 // #i95907#
1627 if ( pTextNode &&
1628 ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
1629 {
1630
1631 const SwTwips nTextNodeIndent = pTextNode->GetAdditionalIndentForStartingNewList();
1632 if ( ( nTextNodeIndent + nWidthOfTabs ) != 0 )
1633 {
1634 // #i111172#/fdo#85666
1635 // If text node is already inside a list, assure that the indents
1636 // are the same. Thus, adjust the indent change value by subtracting
1637 // indents of to be applied list style.
1638 SwTwips nIndentChange = nTextNodeIndent + nWidthOfTabs;
1639 if ( pTextNode->GetNumRule() )
1640 {
1641 int nLevel = pTextNode->GetActualListLevel();
1642
1643 if (nLevel < 0)
1644 nLevel = 0;
1645
1646 if (nLevel >= MAXLEVEL)
1647 nLevel = MAXLEVEL - 1;
1648
1649 const SwNumFormat& aFormat( aNumRule.Get( nLevel ) );
1651 {
1652 nIndentChange -= aFormat.GetIndentAt() + aFormat.GetFirstLineIndent();
1653 }
1654 }
1655 aNumRule.ChangeIndent( nIndentChange );
1656 }
1657 }
1658 // reset indent attribute on applying list style
1659 // start new list
1660 SetCurNumRule( aNumRule, true, OUString(), true );
1661 }
1662
1664}
1665// <- #i40041#
1666
1668{
1669 NumOrBulletOn(true);
1670}
1671
1673{
1674 const SwNumRule * pCurNumRule = GetNumRuleAtCurrCursorPos();
1675
1676 if (!pCurNumRule)
1677 return;
1678
1679 if (pCurNumRule->IsOutlineRule())
1680 {
1681 SwNumRule aNumRule(*pCurNumRule);
1682
1683 SwTextNode * pTextNode =
1684 sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->GetNode());
1685
1686 if (pTextNode)
1687 {
1688 int nLevel = pTextNode->GetActualListLevel();
1689
1690 if (nLevel < 0)
1691 nLevel = 0;
1692
1693 if (nLevel >= MAXLEVEL)
1694 nLevel = MAXLEVEL - 1;
1695
1696 SwNumFormat aFormat(aNumRule.Get(o3tl::narrowing<sal_uInt16>(nLevel)));
1697
1699 aNumRule.Set(nLevel, aFormat);
1700
1701 // no start or continuation of a list - the outline style is only changed.
1702 SetCurNumRule( aNumRule, false );
1703 }
1704 }
1705 else
1706 {
1707 DelNumRules();
1708 }
1709
1710 // #126346# - Cursor can not be anymore in front of
1711 // a label, because numbering/bullet is switched off.
1712 SetInFrontOfLabel( false );
1713}
1714// <- #i29560#
1715
1716// Request Default-Bulletlist
1717
1719{
1720 NumOrBulletOn(false);
1721}
1722
1724{
1725 // ContentType cannot be determined within a Start-/EndAction.
1726 // Because there is no invalid value TEXT will be returned.
1727 // The value does not matter, it may be updated in EndAction anyway.
1728
1729 if (ActionPend())
1731
1732 SwView &_rView = const_cast<SwView&>(GetView());
1733 if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
1734 return SelectionType::PostIt;
1735
1736 // Inserting a frame is not a DrawMode
1737 SelectionType nCnt;
1738 if ( !_rView.GetEditWin().IsFrameAction() &&
1739 (IsObjSelected() || (_rView.IsDrawMode() && !IsFrameSelected()) ))
1740 {
1741 if (GetDrawView()->IsTextEdit())
1743 else
1744 {
1745 if (GetView().IsFormMode()) // Only Form selected
1746 nCnt = SelectionType::DbForm;
1747 else
1748 nCnt = SelectionType::DrawObject; // Any draw object
1749
1750 if (_rView.IsBezierEditMode())
1752 else if( GetDrawView()->GetContext() == SdrViewContext::Media )
1753 nCnt |= SelectionType::Media;
1754
1755 if (svx::checkForSelectedCustomShapes( GetDrawView(), true /* bOnlyExtruded */ ))
1756 {
1758 }
1759
1761 {
1763 }
1764 }
1765
1766 return nCnt;
1767 }
1768
1769 nCnt = static_cast<SelectionType>(GetCntType());
1770
1771 if ( IsFrameSelected() )
1772 {
1773 if (_rView.IsDrawMode())
1774 _rView.LeaveDrawCreate(); // clean up (Bug #45639)
1775 if ( !(nCnt & (SelectionType::Graphic | SelectionType::Ole)) )
1776 return SelectionType::Frame;
1777 }
1778
1779 if ( IsCursorInTable() )
1780 nCnt |= SelectionType::Table;
1781
1782 if ( IsTableMode() )
1783 {
1786 if ( eTableSel == SwTable::SEARCH_ROW )
1788 else if ( eTableSel == SwTable::SEARCH_COL )
1790 }
1791
1792 // Do not pop up numbering toolbar, if the text node has a numbering of type SVX_NUM_NUMBER_NONE.
1793 const SwNumRule* pNumRule = GetNumRuleAtCurrCursorPos();
1794 if ( pNumRule )
1795 {
1796 const SwTextNode* pTextNd =
1797 sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->GetNode());
1798
1799 if ( pTextNd && pTextNd->IsInList() )
1800 {
1801 int nLevel = pTextNd->GetActualListLevel();
1802
1803 if (nLevel < 0)
1804 nLevel = 0;
1805
1806 if (nLevel >= MAXLEVEL)
1807 nLevel = MAXLEVEL - 1;
1808
1809 const SwNumFormat& rFormat = pNumRule->Get(nLevel);
1810 if ( SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType() )
1812 }
1813 }
1814
1815 return nCnt;
1816}
1817
1818// Find the text collection with the name rCollname
1819// Returns: Pointer at the collection or 0, if no
1820// text collection with this name exists, or
1821// this is a default template.
1822
1823SwTextFormatColl *SwWrtShell::GetParaStyle(const OUString &rCollName, GetStyle eCreate )
1824{
1825 SwTextFormatColl* pColl = FindTextFormatCollByName( rCollName );
1826 if( !pColl && GETSTYLE_NOCREATE != eCreate )
1827 {
1829 if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
1830 pColl = GetTextCollFromPool( nId );
1831 }
1832 return pColl;
1833}
1834
1835// Find the text collection with the name rCollname
1836// Returns: Pointer at the collection or 0, if no
1837// character template with this name exists, or
1838// this is a default template or template is automatic.
1839
1840SwCharFormat *SwWrtShell::GetCharStyle(const OUString &rFormatName, GetStyle eCreate )
1841{
1842 SwCharFormat* pFormat = FindCharFormatByName( rFormatName );
1843 if( !pFormat && GETSTYLE_NOCREATE != eCreate )
1844 {
1846 if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate )
1847 pFormat = static_cast<SwCharFormat*>(GetFormatFromPool( nId ));
1848 }
1849 return pFormat;
1850}
1851
1852// Find the table format with the name rFormatname
1853// Returns: Pointer at the collection or 0, if no
1854// frame format with this name exists or
1855// this is a default format or the format is automatic.
1856
1857SwFrameFormat *SwWrtShell::GetTableStyle(std::u16string_view rFormatName)
1858{
1859 for( size_t i = GetTableFrameFormatCount(); i; )
1860 {
1861 SwFrameFormat *pFormat = &GetTableFrameFormat( --i );
1862 if( !pFormat->IsDefault() &&
1863 pFormat->GetName() == rFormatName && IsUsed( *pFormat ) )
1864 return pFormat;
1865 }
1866 return nullptr;
1867}
1868
1870 SwPaM* pPaM = GetCursor();
1872}
1873
1874// Applying templates
1875
1876void SwWrtShell::SetPageStyle(const OUString &rCollName)
1877{
1879 {
1880 SwPageDesc* pDesc = FindPageDescByName( rCollName, true );
1881 if( pDesc )
1882 ChgCurPageDesc( *pDesc );
1883 }
1884}
1885
1886// Access templates
1887
1888OUString const & SwWrtShell::GetCurPageStyle() const
1889{
1890 return GetPageDesc(GetCurPageDesc( false/*bCalcFrame*/ )).GetName();
1891}
1892
1893// Change the current template referring to the existing change.
1894
1896{
1898
1899 // Default cannot be changed
1900 if(pColl && !pColl->IsDefault())
1901 {
1902 FillByEx(pColl);
1903 // Also apply the template to remove hard attribute assignment.
1904 SetTextFormatColl(pColl);
1905 }
1906}
1907
1908void SwWrtShell::AutoUpdatePara(SwTextFormatColl* pColl, const SfxItemSet& rStyleSet, SwPaM* pPaM )
1909{
1910 SwPaM* pCursor = pPaM ? pPaM : GetCursor( );
1915 SID_ATTR_TABSTOP_DEFAULTS,SID_ATTR_TABSTOP_OFFSET,
1916 SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
1917 SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
1918 SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM> aCoreSet( GetAttrPool() );
1919 GetPaMAttr( pCursor, aCoreSet );
1920 bool bReset = false;
1921 SfxItemIter aParaIter( aCoreSet );
1922 for (auto pParaItem = aParaIter.GetCurItem(); pParaItem; pParaItem = aParaIter.NextItem())
1923 {
1924 if(!IsInvalidItem(pParaItem))
1925 {
1926 sal_uInt16 nWhich = pParaItem->Which();
1927 if(SfxItemState::SET == aParaIter.GetItemState() &&
1928 SfxItemState::SET == rStyleSet.GetItemState(nWhich))
1929 {
1930 aParaIter.ClearItem();
1931 bReset = true;
1932 }
1933 }
1934 }
1935 StartAction();
1936 if(bReset)
1937 {
1938 ResetAttr({}, pCursor);
1939 SetAttrSet(aCoreSet, SetAttrMode::DEFAULT, pCursor);
1940 }
1941 mxDoc->ChgFormat(*pColl, rStyleSet );
1942 EndAction();
1943}
1944
1945void SwWrtShell::AutoUpdateFrame( SwFrameFormat* pFormat, const SfxItemSet& rStyleSet )
1946{
1947 StartAction();
1948
1949 ResetFlyFrameAttr( &rStyleSet );
1950 pFormat->SetFormatAttr( rStyleSet );
1951
1952 EndAction();
1953}
1954
1956{
1958 if(!CanInsert())
1959 return;
1960
1961 bool bStarted = false;
1962 SwRewriter aRewriter;
1963
1964 if(HasSelection())
1965 {
1966 // Only parentheses here, because the regular insert
1967 // is already clipped to the editshell
1969
1970 OUString aTmpStr1 = SwResId(STR_START_QUOTE) +
1971 GetSelText() +
1972 SwResId(STR_END_QUOTE);
1973 OUString aTmpStr3 = SwResId(STR_START_QUOTE) +
1974 OUStringChar(cChar) +
1975 SwResId(STR_END_QUOTE);
1976 aRewriter.AddRule( UndoArg1, aTmpStr1 );
1977 aRewriter.AddRule( UndoArg2, SwResId(STR_YIELDS) );
1978 aRewriter.AddRule( UndoArg3, aTmpStr3 );
1979
1980 StartUndo( SwUndoId::REPLACE, &aRewriter );
1981 bStarted = true;
1982 DelRight(true);
1983 }
1984 SwEditShell::AutoCorrect( rACorr, IsInsMode(), cChar );
1985
1986 if(bStarted)
1987 {
1988 EndAllAction();
1989 EndUndo( SwUndoId::REPLACE, &aRewriter );
1990 }
1991}
1992
1993// Some kind of controlled copy ctor
1994
1996 : SwFEShell(rSh, _pWin)
1997 , m_rView(rShell)
1998 , m_aNavigationMgr(*this)
1999{
2001 CurrShell aCurr( this );
2002
2003 SetSfxViewShell( static_cast<SfxViewShell *>(&rShell) );
2004 SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
2005
2006 // place the cursor on the first field...
2007 IFieldmark *pBM = nullptr;
2008 if (IsFormProtected() && (pBM = GetFieldmarkAfter(/*bLoop=*/true)) !=nullptr) {
2009 GotoFieldmark(pBM);
2010 }
2011}
2012
2014 const SwViewOption *pViewOpt )
2015 : SwFEShell(rDoc, _pWin, pViewOpt)
2016 , m_rView(rShell)
2017 , m_aNavigationMgr(*this)
2018{
2020 CurrShell aCurr( this );
2021 SetSfxViewShell( static_cast<SfxViewShell *>(&rShell) );
2022 SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) );
2023
2024 // place the cursor on the first field...
2025 IFieldmark *pBM = nullptr;
2026 if (IsFormProtected() && (pBM = GetFieldmarkAfter(/*bLoop=*/true)) !=nullptr) {
2027 GotoFieldmark(pBM);
2028 }
2029}
2030
2032{
2033 CurrShell aCurr( this );
2034 while(IsModePushed())
2035 PopMode();
2036 while(PopCursor(false))
2037 ;
2039}
2040
2042{
2043 ::std::optional<SwCallLink> aLink(std::in_place, *this);
2044 return Pop(eDelete, aLink);
2045}
2046
2047bool SwWrtShell::Pop(SwCursorShell::PopMode const eDelete, ::std::optional<SwCallLink>& roLink)
2048{
2049 bool bRet = SwCursorShell::Pop(eDelete, roLink);
2050 if( bRet && IsSelection() )
2051 {
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 {
2191 // keep in sync with FN_PGNUMBER_WIZARD
2193 SvxULSpaceItem aUL(bHeader ? 0 : constTwips_5mm, bHeader ? constTwips_5mm : 0, RES_UL_SPACE );
2194 SwFrameFormat* pFormat = bHeader ?
2195 const_cast<SwFrameFormat*>(rMaster.GetHeader().GetHeaderFormat()) :
2196 const_cast<SwFrameFormat*>(rMaster.GetFooter().GetFooterFormat());
2197 pFormat->SetFormatAttr( aUL );
2198 XFillStyleItem aFill(drawing::FillStyle_NONE);
2199 pFormat->SetFormatAttr(aFill);
2200 }
2201 }
2202 if( bChgd )
2203 {
2204 ChgPageDesc( nFrom, aDesc );
2205
2206 if( !bCursorSet && bOn )
2207 {
2208 if ( !IsHeaderFooterEdit() )
2210 bCursorSet = SetCursorInHdFt(
2211 rStyleName.empty() ? SIZE_MAX : nFrom,
2212 bHeader );
2213 }
2214 }
2215 }
2216 }
2217 EndUndo( SwUndoId::HEADER_FOOTER ); // #i7983#
2218 EndAllAction();
2219}
2220
2222{
2224 if ( !bShow )
2226}
2227
2229{
2230 SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(rFieldMgr.GetCurField());
2231 bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == SwFieldIds::Postit);
2232 if (bNew || GetView().GetPostItMgr()->IsAnswer())
2233 {
2234 const SvxPostItAuthorItem* pAuthorItem = rReq.GetArg<SvxPostItAuthorItem>(SID_ATTR_POSTIT_AUTHOR);
2235 OUString sAuthor;
2236 if ( pAuthorItem )
2237 sAuthor = pAuthorItem->GetValue();
2238 else
2239 {
2240 std::size_t nAuthor = SW_MOD()->GetRedlineAuthor();
2241 sAuthor = SW_MOD()->GetRedlineAuthor(nAuthor);
2242 }
2243
2244 const SvxPostItTextItem* pTextItem = rReq.GetArg<SvxPostItTextItem>(SID_ATTR_POSTIT_TEXT);
2245 OUString sText;
2246 if ( pTextItem )
2247 sText = pTextItem->GetValue();
2248
2249 // If we have a text already registered for answer, use that
2250 if (GetView().GetPostItMgr()->IsAnswer() && !GetView().GetPostItMgr()->GetAnswerText().isEmpty())
2251 {
2252 sText = GetView().GetPostItMgr()->GetAnswerText();
2253 GetView().GetPostItMgr()->RegisterAnswerText(OUString());
2254 }
2255
2256 if ( HasSelection() && !IsTableMode() )
2257 {
2258 KillPams();
2259 }
2260
2261 // #i120513# Inserting a comment into an autocompletion crashes
2262 // --> suggestion has to be removed before
2264
2265 SwInsertField_Data aData(SwFieldTypesEnum::Postit, 0, sAuthor, sText, 0);
2266
2267 if (IsSelFrameMode())
2268 {
2270
2271 // Remember the anchor of the selected object before deletion.
2272 std::optional<SwPosition> oAnchor;
2273 if (pFly)
2274 {
2275 SwFrameFormat* pFormat = pFly->GetFormat();
2276 if (pFormat)
2277 {
2278 RndStdIds eAnchorId = pFormat->GetAnchor().GetAnchorId();
2279 if ((eAnchorId == RndStdIds::FLY_AS_CHAR || eAnchorId == RndStdIds::FLY_AT_CHAR) && pFormat->GetAnchor().GetAnchorNode())
2280 {
2281 oAnchor.emplace(*pFormat->GetAnchor().GetContentAnchor());
2282 }
2283 }
2284 }
2285
2286 // A frame is selected, end frame selection.
2287 EnterStdMode();
2288 GetView().AttrChangedNotify(nullptr);
2289
2290 // Set up text selection, so the anchor of the frame will be the anchor of the
2291 // comment.
2292 if (pFly)
2293 {
2294 if (oAnchor)
2295 *GetCurrentShellCursor().GetPoint() = *oAnchor;
2296 SwFrameFormat* pFormat = pFly->GetFormat();
2297 if (pFormat && pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR)
2298 {
2299 Right(SwCursorSkipMode::Cells, /*bSelect=*/true, 1, /*bBasicCall=*/false, /*bVisual=*/true);
2300 }
2301 else if (pFormat && pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AT_CHAR)
2302 {
2303 aData.m_oAnnotationRange.emplace(*GetCurrentShellCursor().Start(),
2305 }
2306 }
2307 }
2308
2309 rFieldMgr.InsertField( aData );
2310
2311 Push();
2313 pPostIt = static_cast<SwPostItField*>(rFieldMgr.GetCurField());
2314 Pop(SwCursorShell::PopMode::DeleteCurrent); // Restore cursor position
2315 }
2316
2317 // Client has disabled annotations rendering, no need to
2318 // focus the postit field
2320 return;
2321
2322 if (pPostIt)
2323 {
2325 if(auto pFormat = pType->FindFormatForField(pPostIt))
2326 pFormat->Broadcast( SwFormatFieldHint( nullptr, SwFormatFieldHintWhich::FOCUS, &GetView() ) );
2327 }
2328}
2329
2331{
2332 const SwOutlineNodes& rOutlineNodes = GetDoc()->GetNodes().GetOutLineNds();
2333 const SwNode* pOutlineNode = rOutlineNodes[nPos];
2334
2335 // no layout frame means outline folding is set to include sub levels and the outline node has
2336 // a parent outline node with outline content visible attribute false (folded outline content)
2337 if (!pOutlineNode->GetTextNode()->getLayoutFrame(nullptr))
2338 return false;
2339
2340 // try the next node to determine if this outline node has visible content
2341 SwNodeIndex aIdx(*pOutlineNode, +1);
2342 if (aIdx.GetNode() == aIdx.GetNodes().GetEndOfContent()) // end of regular content
2343 return false;
2344
2345 if (aIdx.GetNode().IsTextNode() || aIdx.GetNode().IsTableNode() ||
2346 aIdx.GetNode().IsSectionNode())
2347 {
2348 // * sublevels treated as outline content
2349 // If next node (aIdx) doesn't have a layout frame
2350 // then this outline node does not have visible outline content.
2351 // * sublevels NOT treated as outline content
2352 // If the next node (aIdx) is the next outline node
2353 // then return the outline content visible attribute value.
2354 if (!GetViewOptions()->IsTreatSubOutlineLevelsAsContent() &&
2355 nPos + 1 < rOutlineNodes.size() &&
2356 rOutlineNodes[nPos + 1] == &aIdx.GetNode())
2358
2359 if (aIdx.GetNode().IsTextNode())
2360 return aIdx.GetNode().GetTextNode()->getLayoutFrame(nullptr);
2361 if (aIdx.GetNode().IsTableNode())
2362 {
2363 SwTable& rTable = aIdx.GetNode().GetTableNode()->GetTable();
2364 return rTable.HasLayout();
2365 }
2366 if (aIdx.GetNode().IsSectionNode())
2367 {
2368 const auto pFormat = aIdx.GetNode().GetSectionNode()->GetSection().GetFormat();
2369 return pFormat && pFormat->IsVisible();
2370 }
2371 }
2372
2373 return true;
2374}
2375
2377{
2379
2381
2382 bool bDocChanged = false;
2383
2384 const SwOutlineNodes& rOutlineNodes = GetNodes().GetOutLineNds();
2385
2386 // Make all missing frames.
2387 for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNodes.size(); ++nPos)
2388 {
2389 SwNode* pNode = rOutlineNodes[nPos];
2390 if (!pNode->GetTextNode()->getLayoutFrame(GetLayout()))
2391 {
2392 SwNodeIndex aIdx(*pNode, +1);
2393 // Make the outline paragraph frame
2394 MakeFrames(GetDoc(), *pNode, aIdx.GetNode());
2395 // Make the outline content visible but don't set the outline visible attribute and
2396 // don't make outline content made visible not visible that have outline visible
2397 // attribute false. Visibility will be taken care of when
2398 // MakeAllOutlineContentTemporarilyVisible goes out of scope.
2399 MakeOutlineContentVisible(nPos, true, false);
2400 bDocChanged = true;
2401 }
2402 }
2403 // Remove outline paragraph frame and outline content frames above given level.
2404 for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNodes.size(); ++nPos)
2405 {
2406 SwNode* pNode = rOutlineNodes[nPos];
2407 auto nOutlineLevel = pNode->GetTextNode()->GetAttrOutlineLevel();
2408 if (nOutlineLevel > nLevel)
2409 {
2410 // Remove the outline content but don't set the outline visible attribute. Visibility
2411 // will be taken care of when MakeAllOutlineContentTemporarilyVisible goes out of scope.
2412 MakeOutlineContentVisible(nPos, false, false);
2413 // Remove the outline paragraph frame.
2414 pNode->GetTextNode()->DelFrames(GetLayout());
2415 bDocChanged = true;
2416 }
2417 }
2418
2419 // Broadcast DocChanged if document layout has changed so the Navigator will be updated.
2420 if (bDocChanged)
2421 GetDoc()->GetDocShell()->Broadcast(SfxHint(SfxHintId::DocChanged));
2422}
2423
2424void SwWrtShell::MakeOutlineContentVisible(const size_t nPos, bool bMakeVisible, bool bSetAttrOutlineVisibility)
2425{
2426 const SwNodes& rNodes = GetNodes();
2427 const SwOutlineNodes& rOutlineNodes = rNodes.GetOutLineNds();
2428
2429 SwNode* pSttNd = rOutlineNodes[nPos];
2430
2431 // determine end node
2432 SwNode* pEndNd = &rNodes.GetEndOfContent();
2433 if (rOutlineNodes.size() > nPos + 1)
2434 pEndNd = rOutlineNodes[nPos + 1];
2435
2436 if (GetViewOptions()->IsTreatSubOutlineLevelsAsContent())
2437 {
2438 // get the last outline node to include (iPos)
2439 int nLevel = pSttNd->GetTextNode()->GetAttrOutlineLevel();
2440 int nMaxOutlineLevelShown = m_rView.GetMaxOutlineLevelShown();
2442 while (++iPos < rOutlineNodes.size() &&
2443 rOutlineNodes[iPos]->GetTextNode()->GetAttrOutlineLevel() > nLevel &&
2444 rOutlineNodes[iPos]->GetTextNode()->GetAttrOutlineLevel() <= nMaxOutlineLevelShown);
2445
2446 // get the correct end node
2447 // the outline node may be in frames, headers, footers special section of doc model
2448 SwNode* pStartOfSectionNodeSttNd = pSttNd->StartOfSectionNode();
2449 while (pStartOfSectionNodeSttNd->StartOfSectionNode()
2450 != pStartOfSectionNodeSttNd->StartOfSectionNode()->StartOfSectionNode())
2451 {
2452 pStartOfSectionNodeSttNd = pStartOfSectionNodeSttNd->StartOfSectionNode();
2453 }
2454 pEndNd = pStartOfSectionNodeSttNd->EndOfSectionNode();
2455
2456 if (iPos < rOutlineNodes.size())
2457 {
2458 SwNode* pStartOfSectionNode = rOutlineNodes[iPos]->StartOfSectionNode();
2459 while (pStartOfSectionNode->StartOfSectionNode()
2460 != pStartOfSectionNode->StartOfSectionNode()->StartOfSectionNode())
2461 {
2462 pStartOfSectionNode = pStartOfSectionNode->StartOfSectionNode();
2463 }
2464 if (pStartOfSectionNodeSttNd == pStartOfSectionNode)
2465 pEndNd = rOutlineNodes[iPos];
2466 }
2467 }
2468
2469 // table, text box, header, footer
2470 if (pSttNd->GetTableBox() || pSttNd->GetIndex() < rNodes.GetEndOfExtras().GetIndex())
2471 {
2472 // limit to within section
2473 if (pSttNd->EndOfSectionIndex() < pEndNd->GetIndex())
2474 pEndNd = pSttNd->EndOfSectionNode();
2475 }
2476 // if pSttNd isn't in table but pEndNd is, skip over all outline nodes in table
2477 else if (pEndNd->GetTableBox())
2478 {
2479 pEndNd = &rNodes.GetEndOfContent();
2480 for (size_t nOutlinePos = nPos + 2; nOutlinePos < rOutlineNodes.size(); nOutlinePos++)
2481 {
2482 if (!(rOutlineNodes[nOutlinePos]->GetTableBox()))
2483 {
2484 pEndNd = rOutlineNodes[nOutlinePos];
2485 break;
2486 }
2487 }
2488 }
2489 // end node determined
2490
2491 // Remove content frames from the next node after the starting outline node to
2492 // the determined ending node. Always do this to prevent the chance of duplicate
2493 // frames being made. They will be remade below if needed.
2494 SwNodeIndex aIdx(*pSttNd, +1);
2495 while (aIdx != *pEndNd)
2496 {
2497 SwNode* pNd = &aIdx.GetNode();
2498 if (pNd->IsContentNode())
2499 pNd->GetContentNode()->DelFrames(nullptr);
2500 else if (pNd->IsTableNode())
2501 pNd->GetTableNode()->DelFrames(nullptr);
2502 ++aIdx;
2503 }
2504
2505 if (bMakeVisible) // make outline nodes outline content visible
2506 {
2507 // reset the index marker and make frames
2508 aIdx.Assign(*pSttNd, +1);
2509 MakeFrames(GetDoc(), aIdx.GetNode(), *pEndNd);
2510
2511 if (bSetAttrOutlineVisibility)
2512 {
2514
2515 // make outline content made visible that have outline visible attribute false not visible
2516 while (aIdx != *pEndNd)
2517 {
2518 SwNode* pNd = &aIdx.GetNode();
2519 if (pNd->IsTextNode() && pNd->GetTextNode()->IsOutline())
2520 {
2521 SwTextNode* pTextNd = pNd->GetTextNode();
2522 bool bOutlineContentVisibleAttr = true;
2523 pTextNd->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr);
2524 if (!bOutlineContentVisibleAttr)
2525 {
2527 if (rOutlineNodes.Seek_Entry(pTextNd, &iPos))
2528 {
2529 if (pTextNd->getLayoutFrame(nullptr))
2530 MakeOutlineContentVisible(iPos, false);
2531 }
2532 }
2533 }
2534 ++aIdx;
2535 }
2536 }
2537 }
2538 else if (bSetAttrOutlineVisibility)
2539 pSttNd->GetTextNode()->SetAttrOutlineContentVisible(false);
2540}
2541
2542// make content visible or not visible only if needed
2544{
2546
2547 const SwOutlineNodes& rOutlineNds = GetNodes().GetOutLineNds();
2548 for (SwOutlineNodes::size_type nPos = 0; nPos < rOutlineNds.size(); ++nPos)
2549 {
2550 bool bIsOutlineContentVisible = IsOutlineContentVisible(nPos);
2551 bool bOutlineContentVisibleAttr = true;
2552 rOutlineNds[nPos]->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr);
2553 if (!bIsOutlineContentVisible && bOutlineContentVisibleAttr)
2555 else if (bIsOutlineContentVisible && !bOutlineContentVisibleAttr)
2557 }
2558}
2559
2561{
2562 if (bMakeVisible)
2563 {
2564 // make all content visible
2565
2566 // When shortcut is assigned to the show outline content visibility button and used to
2567 // toggle the feature and the mouse pointer is on an outline frame the button will not
2568 // be removed. An easy way to make sure the button does not remain shown is to use the
2569 // HideControls function.
2571
2572 // temporarily set outline content visible attribute true for folded outline nodes
2573 std::vector<SwNode*> aFoldedOutlineNodeArray;
2574 for (SwNode* pNd: GetNodes().GetOutLineNds())
2575 {
2576 bool bOutlineContentVisibleAttr = true;
2577 pNd->GetTextNode()->GetAttrOutlineContentVisible(bOutlineContentVisibleAttr);
2578 if (!bOutlineContentVisibleAttr)
2579 {
2580 aFoldedOutlineNodeArray.push_back(pNd);
2581 pNd->GetTextNode()->SetAttrOutlineContentVisible(true);
2582 }
2583 }
2584
2585 StartAction();
2587 EndAction();
2588
2589 // restore outline content visible attribute for folded outline nodes
2590 for (SwNode* pNd: aFoldedOutlineNodeArray)
2591 pNd->GetTextNode()->SetAttrOutlineContentVisible(false);
2592 }
2593 else
2594 {
2595 if (SdrView* pSdrView = GetDrawView(); pSdrView && pSdrView->IsTextEdit() )
2596 {
2597 bool bLockView = IsViewLocked();
2598 LockView(true);
2599 EndTextEdit();
2600 LockView(bLockView);
2601 }
2602 if (IsSelFrameMode() || IsObjSelected())
2603 {
2604 UnSelectFrame();
2607 EnterStdMode();
2608 }
2609
2610 // Get current frame in which the cursor is positioned for use in placing the cursor.
2611 const SwFrame* pCurrFrame = GetCurrFrame(false);
2612
2614
2615 StartAction();
2617 EndAction();
2618
2619 // If needed, find visible outline node frame to place cursor.
2620 if (!pCurrFrame || !pCurrFrame->isFrameAreaDefinitionValid() || pCurrFrame->IsInDtor() ||
2622 !GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(nullptr)))
2623 {
2624 while (nPos != SwOutlineNodes::npos &&
2625 !GetNodes().GetOutLineNds()[nPos]->GetTextNode()->getLayoutFrame(nullptr))
2626 --nPos;
2628 {
2629 EnterStdMode();
2631 }
2632 }
2633 }
2634 GetView().GetDocShell()->Broadcast(SfxHint(SfxHintId::DocChanged));
2635}
2636
2637bool SwWrtShell::GetAttrOutlineContentVisible(const size_t nPos) const
2638{
2639 bool bVisibleAttr = true;
2640 GetNodes().GetOutLineNds()[nPos]->GetTextNode()->GetAttrOutlineContentVisible(bVisibleAttr);
2641 return bVisibleAttr;
2642}
2643
2645{
2646 for(const SwPaM& rPaM : GetCursor()->GetRingContainer())
2647 {
2648 SwPaM aPaM(*rPaM.GetMark(), *rPaM.GetPoint());
2649 aPaM.Normalize();
2650 SwNodeIndex aPointIdx(aPaM.GetPoint()->GetNode());
2651 SwNodeIndex aMarkIdx(aPaM.GetMark()->GetNode());
2652 if (aPointIdx == aMarkIdx)
2653 continue;
2654 // Return true if any nodes in PaM are folded outline content nodes.
2656 for (SwNodeIndex aIdx = aPointIdx; aIdx <= aMarkIdx; ++aIdx)
2657 {
2658 if (GetDoc()->GetNodes().GetOutLineNds().Seek_Entry(&(aIdx.GetNode()), &nPos) &&
2660 return true;
2661 }
2662 }
2663 return false;
2664}
2665
2666void SwWrtShell::InfoReadOnlyDialog(bool bAsync) const
2667{
2668 if (bAsync)
2669 {
2670 auto xInfo = std::make_shared<weld::MessageDialogController>(
2671 GetView().GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui", "InfoReadonlyDialog");
2672 if (GetViewOptions()->IsShowOutlineContentVisibilityButton() &&
2674 {
2675 xInfo->set_primary_text(SwResId(STR_INFORODLG_FOLDED_PRIMARY));
2676 xInfo->set_secondary_text(SwResId(STR_INFORODLG_FOLDED_SECONDARY));
2677 }
2678 weld::DialogController::runAsync(xInfo, [](int) {});
2679 }
2680 else
2681 {
2682 std::unique_ptr<weld::Builder>
2684 "modules/swriter/ui/inforeadonlydialog.ui"));
2685 std::unique_ptr<weld::MessageDialog>
2686 xInfo(xBuilder->weld_message_dialog("InfoReadonlyDialog"));
2687 if (GetViewOptions()->IsShowOutlineContentVisibilityButton() &&
2689 {
2690 xInfo->set_primary_text(SwResId(STR_INFORODLG_FOLDED_PRIMARY));
2691 xInfo->set_secondary_text(SwResId(STR_INFORODLG_FOLDED_SECONDARY));
2692 }
2693 xInfo->run();
2694 }
2695}
2696
2698{
2699 std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(
2700 GetView().GetFrameWeld(), "modules/swriter/ui/warnhiddensectiondialog.ui"));
2701 std::unique_ptr<weld::MessageDialog> xQuery(
2702 xBuilder->weld_message_dialog("WarnHiddenSectionDialog"));
2703 if (GetViewOptions()->IsShowOutlineContentVisibilityButton()
2705 {
2706 xQuery->set_primary_text(SwResId(STR_INFORODLG_FOLDED_PRIMARY));
2707 xQuery->set_secondary_text(SwResId(STR_INFORODLG_FOLDED_SECONDARY));
2708 }
2709
2710 return (RET_YES == xQuery->run());
2711}
2712
2714{
2715 std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(nullptr,
2716 VclMessageType::Question, VclButtonsType::YesNo, SwResId(STR_A11Y_DESIGN_MODE_PRIMARY)));
2717 xQuery->set_default_response(RET_YES);
2718 xQuery->set_title(SwResId(STR_A11Y_DESIGN_MODE_TITLE));
2719 xQuery->set_secondary_text(SwResId(STR_A11Y_DESIGN_MODE_SECONDARY));
2720
2721 return (RET_YES == xQuery->run());
2722}
2723
2724/* 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)
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
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
SFX2_DLLPUBLIC OUString GetCommand() const
SfxBindings & GetBindings()
weld::Window * GetFrameWeld() const
SfxViewFrame & GetViewFrame() const
SfxInPlaceClient * FindIPClient(const css::uno::Reference< css::embed::XEmbeddedObject > &xObj, vcl::Window *pObjParentWin) 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:1040
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:1223
void DelFrames(SwRootFrame const *pLayout)
Method deletes all views of document for the node.
Definition: node.cxx:1432
bool Pop(PopMode, ::std::optional< SwCallLink > &roLink)
OUString GetCursorDescr() const
Returns textual description of the current selection.
Definition: crsrsh.cxx:4009
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2550
void ShowCursor()
Definition: crsrsh.cxx:2710
void StartAction()
Definition: crsrsh.cxx:226
const SwTableNode * IsCursorInTable() const
Check if Point of current cursor is placed within a table.
Definition: crsrsh.cxx:600
void SwapPam()
Definition: crsrsh.cxx:1262
bool IsInHiddenRange(const bool bSelect)
If the current cursor position is inside a hidden range true is returned.
Definition: crsrsh.cxx:3780
void HideCursor()
Definition: crsrsh.cxx:2731
bool HasSelection() const
Does the current cursor create a selection?
Definition: crsrsh.cxx:2838
void SetFlyMacroLnk(const Link< const SwFlyFrameFormat *, void > &rLnk)
Definition: crsrsh.hxx:499
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:1256
bool SetCursorInHdFt(size_t nDescNo, bool bInHeader, bool bEven=false, bool bFirst=false)
Definition: crstrvl.cxx:192
bool IsEndPara() const
Definition: crsrsh.cxx:1400
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:2862
bool IsSttPara() const
Definition: crsrsh.cxx:1381
bool IsFormProtected()
Definition: crbm.cxx:281
bool IsSelection() const
Definition: crsrsh.hxx:910
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:2771
bool IsInRightToLeftText() const
Definition: crsrsh.cxx:3770
void ClearMark()
Definition: crsrsh.cxx:1225
bool SetInFrontOfLabel(bool bNew)
Definition: crsrsh.cxx:1462
SwTextContentControl * CursorInsideContentControl() const
Definition: crstrvl.cxx:1104
SwShellCursor * getShellCursor(bool bBlock)
Delivers the current shell cursor.
Definition: crsrsh.cxx:3356
SwTable::SearchType GetEnhancedTableSelection() const
Definition: crsrsh.hxx:837
bool Left(sal_uInt16 nCnt, SwCursorSkipMode nMode, bool bAllowVisual=false)
Definition: crsrsh.hxx:364
void KillPams()
Definition: crsrsh.cxx:1308
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:1319
sw::mark::IFieldmark * GetFieldmarkAfter(bool bLoop)
Definition: crbm.cxx:293
bool IsCursorPtAtEnd() const
Definition: crsrsh.hxx:920
bool IsTableMode() const
Definition: crsrsh.hxx:668
Definition: doc.hxx:197
void ClearLineNumAttrs(SwPosition const &rPos)
Definition: ndtbl.cxx:4196
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
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:1620
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1429
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
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:297
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:355
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:2202
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:249
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:890
void StopQuickHelp()
Definition: edtwin.cxx:6192
bool IsFrameAction() const
Definition: edtwin.hxx:220
SwFrameControlsManager & GetFrameControlsManager()
Definition: edtwin.cxx:6832
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:2097
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:1133
void SetCheckForOLEInCaption(bool bFlag)
Definition: fesh.hxx:461
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:1193
void ChgCurPageDesc(const SwPageDesc &)
PageDescriptor-interface.
Definition: fedesc.cxx:43
size_t IsObjSelected() const
Definition: feshview.cxx:1125
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:895
SwField * GetCurField()
Definition: fldmgr.cxx:430
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:247
SwFieldIds Which() const
Definition: fldbas.hxx:276
SwFormatField * FindFormatForField(const SwField *) const
Definition: fldbas.cxx:171
SwFieldType * GetTyp() const
Definition: fldbas.hxx:402
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:283
general base class for all free-flowing frames
Definition: flyfrm.hxx:79
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:3119
FlyAnchors.
Definition: fmtanchr.hxx:37
sal_Int32 GetAnchorContentOffset() const
Definition: atrfrm.cxx:1631
SwContentNode * GetAnchorContentNode() const
Definition: atrfrm.cxx:1623
RndStdIds GetAnchorId() const
Definition: fmtanchr.hxx:67
const SwPosition * GetContentAnchor() const
Definition: fmtanchr.hxx:74
SwNode * GetAnchorNode() const
Definition: atrfrm.cxx:1614
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
SfxPoolItem subclass for footnotes and endnotes, stored in the anchor text node.
Definition: fmtftn.hxx:47
void SetNumStr(const OUString &rStr)
Definition: fmtftn.hxx:77
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:241
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:72
virtual OUString GetDescription() const
Definition: atrfrm.cxx:2887
Base class of the Writer layout elements.
Definition: frame.hxx:315
bool IsInDtor() const
Definition: frame.hxx:898
Class for automated call of Start- and EndCursorMove().
Definition: editsh.hxx:1048
bool addEntry(const SwPosition &rPos)
Definition: navmgr.cxx:168
Marks a node in the document model.
Definition: ndindex.hxx:31
const SwNodes & GetNodes() const
Definition: ndindex.hxx:119
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeIndex & Assign(SwNodes const &rNds, SwNodeOffset nIdx)
Definition: ndindex.hxx:114
Base class of the Writer document model elements.
Definition: node.hxx:98
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:901
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:772
bool IsContentNode() const
Definition: node.hxx:188
bool IsEndNode() const
Definition: node.hxx:189
bool IsSectionNode() const
Definition: node.hxx:192
bool IsTableNode() const
Definition: node.hxx:191
bool IsTextNode() const
Definition: node.hxx:190
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:691
SwContentNode * GetContentNode()
Definition: node.hxx:666
SwTableNode * GetTableNode()
Definition: node.hxx:650
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
const SwOutlineNodes & GetOutLineNds() const
Array of all OutlineNodes.
Definition: ndarr.hxx:236
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:188
const SwPosition * GetMark() const
Definition: pam.hxx:255
SwNode & GetPointNode() const
Definition: pam.hxx:275
void Normalize(bool bPointFirst=true)
Normalizes PaM, i.e.
Definition: pam.cxx:689
void DeleteMark()
Definition: pam.hxx:232
const SwPosition * GetPoint() const
Definition: pam.hxx:253
const OUString & GetName() const
Definition: pagedesc.hxx:196
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
void RegisterAnswerText(const OUString &aAnswerText)
Definition: PostItMgr.hxx:260
OutlinerParaObject * IsAnswer()
Definition: PostItMgr.hxx:259
const OUString & GetAnswerText() const
Definition: PostItMgr.hxx:261
SW_DLLPUBLIC bool HasActiveSidebarWin() const
Definition: PostItMgr.cxx:2372
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 IsVisible() const override
Definition: section.cxx:813
const SwSection & GetSection() const
Definition: node.hxx:590
SwSectionFormat * GetFormat()
Definition: section.hxx:341
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:2461
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:3196
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:678
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
bool IsOutline() const
Returns if this text node is an outline.
Definition: ndtxt.cxx:4138
bool IsInList() const
Definition: ndtxt.cxx:4546
void GetAttrOutlineContentVisible(bool &bOutlineContentVisibleAttr)
GetAttrOutlineContentVisible.
Definition: ndtxt.cxx:4183
bool IsCountedInList() const
Definition: ndtxt.cxx:4393
SwTwips GetAdditionalIndentForStartingNewList() const
Definition: ndtxt.cxx:3377
SwTwips GetWidthOfLeadingTabs() const
Returns the width of leading tabs/blanks in this paragraph.
Definition: itratr.cxx:1590
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2921
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:4248
int GetAttrOutlineLevel() const
Returns outline level of this text node.
Definition: ndtxt.cxx:4168
void SetAttrOutlineContentVisible(bool bVisible)
Definition: ndtxt.cxx:4191
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:895
static void ClearSelection(const SwWrtShell &rSh, const SwFrameShell *pCreator=nullptr)
Definition: swdtflvr.cxx:4382
bool IsShowOutlineContentVisibilityButton() const
Definition: viewopt.cxx:177
bool IsTreatSubOutlineLevelsAsContent() const
Definition: viewopt.cxx:182
bool IsViewLocked() const
Definition: viewsh.hxx:490
bool IsHeaderFooterEdit() const
Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags.
Definition: viewsh.hxx:589
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:452
void UnlockPaint(bool bVirDev=false)
Definition: viewsh.hxx:639
const SwNodes & GetNodes() const
Definition: viewsh.cxx:2181
rtl::Reference< SwDoc > mxDoc
The document; never 0.
Definition: viewsh.hxx:199
bool ActionPend() const
Definition: viewsh.hxx:225
SwRootFrame * GetLayout() const
Definition: viewsh.cxx:2163
virtual void SetReadonlyOption(bool bSet)
Definition: viewsh.cxx:2476
SwDoc * GetDoc() const
Definition: viewsh.hxx:308
void LockPaint(LockPaintReason eReason)
Definition: viewsh.hxx:632
void LockView(bool b)
Definition: viewsh.hxx:491
const SwPostItMgr * GetPostItMgr() const
Definition: viewsh.hxx:583
void SetSfxViewShell(SfxViewShell *pNew)
Definition: viewsh.hxx:471
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:648
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow)
Definition: viewsh.cxx:100
SdrView * GetDrawView()
Definition: vnew.cxx:386
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:659
void SetMaxOutlineLevelShown(int nLevel)
Definition: view.hxx:658
SwPostItMgr * GetPostItMgr()
Definition: view.hxx:650
SwEditWin & GetEditWin()
Definition: view.hxx:426
SwDocShell * GetDocShell()
Definition: view.cxx:1193
bool IsDrawMode() const
Definition: view.hxx:550
void LeaveDrawCreate()
Definition: view.hxx:549
void NotifyDBChanged()
Definition: view.cxx:1931
Used by the UI to modify the document model.
Definition: wrtsh.hxx:97
OUString const & GetCurPageStyle() const
Definition: wrtsh1.cxx:1888
bool IsSelFrameMode() const
Definition: wrtsh.hxx:177
SAL_DLLPRIVATE tools::Long SetCursorKillSel(const Point *, bool bProp)
Definition: select.cxx:325
void AutoUpdatePara(SwTextFormatColl *pColl, const SfxItemSet &rStyleSet, SwPaM *pPaM=nullptr)
Definition: wrtsh1.cxx:1908
void EnterSelFrameMode(const Point *pStartDrag=nullptr)
Definition: select.cxx:711
virtual void ConnectObj(svt::EmbeddedObjectRef &xIPObj, const SwRect &rPrt, const SwRect &rFrame) override
Connect objects with ActivateWhenVisible at Paint.
Definition: wrtsh1.cxx:930
bool Right(SwCursorSkipMode nMode, bool bSelect, sal_uInt16 nCount, bool bBasicCall, bool bVisual=false)
Definition: move.cxx:127
void LeaveSelFrameMode()
Definition: select.cxx:729
void InsertPostIt(SwFieldMgr &rFieldMgr, const SfxRequest &rReq)
Inserts a new annotation/comment at the current cursor position / selection.
Definition: wrtsh1.cxx:2228
bool IsOutlineContentVisible(const size_t nPos)
Definition: wrtsh1.cxx:2330
bool HasFoldedOutlineContentSelected() const
Definition: wrtsh1.cxx:2644
void addCurrentPosition()
Definition: wrtsh1.cxx:1869
bool GetAttrOutlineContentVisible(const size_t nPos) const
Definition: wrtsh1.cxx:2637
void MakeOutlineLevelsVisible(const int nLevel)
Definition: wrtsh1.cxx:2376
void PopMode()
Definition: select.cxx:293
SwWrtShell(SwWrtShell &, vcl::Window *pWin, SwView &rShell)
Definition: wrtsh1.cxx:1995
void InsertLineBreak(std::optional< SwLineBreakClear > oClear=std::nullopt)
Definition: wrtsh1.cxx:979
void AutoUpdateFrame(SwFrameFormat *pFormat, const SfxItemSet &rStyleSet)
Definition: wrtsh1.cxx:1945
bool GotoFieldmark(::sw::mark::IFieldmark const *const pMark)
Definition: wrtsh3.cxx:224
void NumOn()
Definition: wrtsh1.cxx:1667
bool IsModePushed() const
Definition: wrtsh.hxx:138
void NumOrBulletOff()
Definition: wrtsh1.cxx:1672
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:717
void Insert(const OUString &)
Definition: wrtsh1.cxx:226
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:694
void ResetCursorStack()
Definition: wrtsh.hxx:651
SelectionType GetSelectionType() const
Definition: wrtsh1.cxx:1723
void InsertGraphic(const OUString &rPath, const OUString &rFilter, const Graphic &, SwFlyFrameAttrMgr *=nullptr, RndStdIds nAnchorType=RndStdIds::FLY_AT_PARA)
Definition: wrtsh1.cxx:290
void EnterStdMode()
Definition: select.cxx:560
virtual void SetReadonlyOption(bool bSet) override
Definition: wrtsh1.cxx:2129
bool InsertOleObject(const svt::EmbeddedObjectRef &xObj, SwFlyFrameFormat **pFlyFrameFormat=nullptr)
Definition: wrtsh1.cxx:513
SELECTFUNC m_fnKillSel
Definition: wrtsh.hxx:117
SwFrameFormat * GetTableStyle(std::u16string_view rFormatName)
Definition: wrtsh1.cxx:1857
void QuickUpdateStyle()
Definition: wrtsh1.cxx:1895
void SplitNode(bool bAutoFormat=false)
Definition: wrtsh1.cxx:1317
void InsertContentControl(SwContentControlType eType)
Definition: wrtsh1.cxx:1040
SwCharFormat * GetCharStyle(const OUString &rFormatName, GetStyle eCreate=GETSTYLE_NOCREATE)
Definition: wrtsh1.cxx:1840
@ 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:182
void MakeOutlineContentVisible(const size_t nPos, bool bMakeVisible=true, bool bSetAttrOutlineVisibility=true)
Definition: wrtsh1.cxx:2424
void InsertByWord(const OUString &)
Definition: wrtsh1.cxx:206
void MakeAllFoldedOutlineContentVisible(bool bMakeVisible=true)
Definition: wrtsh1.cxx:2560
SAL_DLLPRIVATE bool PopCursor(bool bUpdate, bool bSelect=false)
Definition: move.cxx:523
void InsertColumnBreak()
Definition: wrtsh1.cxx:1017
void InsertFootnote(const OUString &, bool bEndNote=false, bool bEdit=true)
Definition: wrtsh1.cxx:1175
virtual void SetShowHeaderFooterSeparator(FrameControlType eControl, bool bShow) override
Definition: wrtsh1.cxx:2221
SwView & m_rView
Definition: wrtsh.hxx:573
virtual void InfoReadOnlyDialog(bool bAsync) const override
Selected area has readonly content.
Definition: wrtsh1.cxx:2666
SwNavigationMgr m_aNavigationMgr
Definition: wrtsh.hxx:574
void BulletOn()
Definition: wrtsh1.cxx:1718
void GotoOutline(SwOutlineNodes::size_type nIdx)
Definition: move.cxx:655
void ChangeHeaderOrFooter(std::u16string_view rStyleName, bool bHeader, bool bOn, bool bShowWarning)
Definition: wrtsh1.cxx:2138
bool DelRight(bool isReplaceHeuristic=false)
Definition: delete.cxx:285
SELECTFUNC m_fnSetCursor
Definition: wrtsh.hxx:115
void InsertObject(const svt::EmbeddedObjectRef &, SvGlobalName const *pName, sal_uInt16 nSlotId=0)
Definition: wrtsh1.cxx:409
void AutoCorrect(SvxAutoCorrect &rACorr, sal_Unicode cChar)
Definition: wrtsh1.cxx:1955
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:941
bool m_bIns
Definition: wrtsh.hxx:596
void Edit()
Definition: wrtsh1.cxx:188
void UnSelectFrame()
Definition: select.cxx:332
void InvalidateOutlineContentVisibility()
Definition: wrtsh1.cxx:2543
bool IsEndWrd()
Definition: wrtsh1.cxx:196
virtual bool WarnSwitchToDesignModeDialog() const override
Switch to Design mode for Forms.
Definition: wrtsh1.cxx:2713
virtual ~SwWrtShell() override
Definition: wrtsh1.cxx:2031
SwTextFormatColl * GetParaStyle(const OUString &rCollName, GetStyle eCreate=GETSTYLE_NOCREATE)
Definition: wrtsh1.cxx:1823
tools::Long ResetSelect(const Point *, bool)
Definition: select.cxx:342
void SetPageStyle(const OUString &rCollName)
Definition: wrtsh1.cxx:1876
bool CanInsert()
Definition: wrtsh1.cxx:2058
void LaunchOLEObj(sal_Int32 nVerb=css::embed::EmbedVerbs::MS_OLEVERB_PRIMARY)
Definition: wrtsh1.cxx:654
void NumOrBulletOn(bool bNum)
Turns on numbering or bullets.
Definition: wrtsh1.cxx:1356
OUString GetSelDescr() const
Definition: wrtsh1.cxx:2090
virtual bool WarnHiddenSectionDialog() const override
Selected area has hidden content.
Definition: wrtsh1.cxx:2697
bool Pop(SwCursorShell::PopMode, ::std::optional< SwCallLink > &roLink)
Definition: wrtsh1.cxx:2047
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:166
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
Definition: dialoghelp.cxx:19
float u
#define CNT_OLE
Definition: editsh.hxx:133
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:2026
SelectionType
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 TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr sal_uInt16 RES_FRMATR_END(141)
constexpr sal_uInt16 RES_PARATR_END(82)
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(100)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
CharClass & GetAppCharClass()
Definition: init.cxx:721
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:1367
SvxNumberFormat::SvxNumPositionAndSpaceMode GetDefaultPositionAndSpaceMode()
Definition: number.cxx:1538
sal_Unicode GetBulletChar(sal_uInt8 nLevel)
retrieve unicode of character used for the default bullet list for the given list level
Definition: number.cxx:1377
const vcl::Font & GetDefBulletFont()
retrieve font used for the default bullet list characters
Definition: number.cxx:1372
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:1043
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:38
SwNode & GetNode() const
Definition: pam.hxx:81
void Assign(const SwNode &rNd, SwNodeOffset nDelta, sal_Int32 nContentOffset=0)
These all set both nNode and nContent.
Definition: pam.cxx:231
SVX_NUM_NUMBER_NONE
SVX_NUM_ARABIC
SVX_NUM_CHAR_SPECIAL
RndStdIds
SwView * GetActiveView()
Definition: swmodul1.cxx:115
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:168
#define SW_MOD()
Definition: swmodule.hxx:254
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:1205
static SvxAutoCorrect * lcl_IsAutoCorr()
Definition: wrtsh1.cxx:171
#define BITFLD_INI_LIST
Definition: wrtsh1.cxx:158