20#include <libxml/xmlwriter.h>
24#include <osl/diagnose.h>
46 :
SwUndo(nUndoId, pFormat->GetDoc())
47 , m_pFrameFormat(pFormat)
66 pTextBoxes->ClearAll();
77 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwUndoFlyBase"));
78 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nNodePagePos"),
80 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nContentPos"),
82 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nRndId"),
83 BAD_CAST(OString::number(
static_cast<int>(
m_nRndId)).getStr()));
84 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_bDelFormat"),
95 (void)xmlTextWriterEndElement(pWriter);
112 if (RndStdIds::FLY_AT_PAGE ==
m_nRndId)
119 if ((RndStdIds::FLY_AS_CHAR ==
m_nRndId) || (RndStdIds::FLY_AT_CHAR ==
m_nRndId))
139 if (RndStdIds::FLY_AS_CHAR ==
m_nRndId)
143 OSL_ENSURE( pCNd->
IsTextNode(),
"no Text Node at position." );
190 case RndStdIds::FLY_AS_CHAR:
191 case RndStdIds::FLY_AT_CHAR:
198 case RndStdIds::FLY_AT_PARA:
199 case RndStdIds::FLY_AT_FLY:
205 case RndStdIds::FLY_AT_PAGE:
229 OSL_ENSURE( rContent.
GetContentIdx(),
"Fly without content" );
242 if (RndStdIds::FLY_AS_CHAR ==
m_nRndId)
247 OSL_ENSURE( pTextNd,
"No Textnode found" );
258 else if (RndStdIds::FLY_AT_CHAR ==
m_nRndId)
263 else if ((RndStdIds::FLY_AT_PARA ==
m_nRndId) || (RndStdIds::FLY_AT_FLY ==
m_nRndId))
282 mnCursorSaveIndexPara( nNodeIdx ), mnCursorSaveIndexPos( nCntIdx )
334 if ((RndStdIds::FLY_AT_PARA == aAnchor.
GetAnchorId()) ||
335 (RndStdIds::FLY_AT_CHAR == aAnchor.
GetAnchorId()) ||
341 else if( RndStdIds::FLY_AT_FLY == aAnchor.
GetAnchorId() )
355 else if (RndStdIds::FLY_AT_PAGE == aAnchor.
GetAnchorId())
360 OSL_FAIL(
"What kind of anchor is this?" );
407 OSL_ENSURE( rContent.
GetContentIdx(),
"Fly without content" );
411 if (pNoTextNode && pNoTextNode->
IsGrfNode())
415 else if (pNoTextNode && pNoTextNode->
IsOLENode())
426 , m_bShowSelFrame( true )
486 m_DerivedFromFormatName( rFlyFormat.IsDefault() ?
"" : rFlyFormat.DerivedFrom()->
GetName() ),
487 m_NewFormatName( rNewFrameFormat.
GetName() ),
488 m_oItemSet(
std::in_place, *rFlyFormat.GetAttrSet().GetPool(),
490 m_nOldNode( 0 ), m_nNewNode( 0 ),
491 m_nOldContent( 0 ), m_nNewContent( 0 ),
513 if (RndStdIds::FLY_AT_PAGE != nAnchorTyp)
517 if( RndStdIds::FLY_AT_FLY == nAnchorTyp
527 if ((RndStdIds::FLY_AS_CHAR == nAnchorTyp) ||
528 (RndStdIds::FLY_AT_CHAR == nAnchorTyp))
548 rAnchor.
SetType( RndStdIds::FLY_AT_PAGE );
562 if (!pDerivedFromFrameFormat)
584 if (RndStdIds::FLY_AS_CHAR == rOldAnch.
GetAnchorId())
592 OSL_ENSURE( pTextNode->
HasHints(),
"Missing FlyInCnt-Hint." );
596 assert(pHint &&
"Missing Hint.");
598 "Missing FlyInCnt-Hint." );
600 "Wrong TextFlyCnt-Hint." );
613 if (RndStdIds::FLY_AS_CHAR == aNewAnchor.
GetAnchorId())
632 if (!pNewFrameFormat)
640 aSet.
Put( aNewAnchor );
657 OSL_ENSURE( !
m_bAnchorChanged,
"multiple changes of an anchor are not allowed!" );
665 case RndStdIds::FLY_AS_CHAR:
666 case RndStdIds::FLY_AT_CHAR:
669 case RndStdIds::FLY_AT_PARA:
670 case RndStdIds::FLY_AT_FLY:
682 case RndStdIds::FLY_AS_CHAR:
683 case RndStdIds::FLY_AT_CHAR:
686 case RndStdIds::FLY_AT_PARA:
687 case RndStdIds::FLY_AT_FLY:
704 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
709 const sal_uInt16 nWhich = pLegacy->
m_pOld->
Which();
711 PutAttr(nWhich, pLegacy->m_pOld);
716 PutAttr(pItem->Which(), pItem);
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual SwFrameFormat * CopyLayoutFormat(const SwFrameFormat &rSrc, const SwFormatAnchor &rNewAnchor, bool bSetTextFlyAtt, bool bMakeFrames)=0
virtual void setUnoShape(const css::uno::Reference< css::drawing::XShape > &_rxUnoShape)
virtual OUString GetComment() const override
const SfxPoolItem * GetCurItem() const
sal_uInt16 GetCurPos() const
const SfxPoolItem * NextItem()
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
const SwAttrSet * GetChgSet() const
What has changed.
bool SetFrameFormatToFly(SwFrameFormat &rFlyFormat, SwFrameFormat &rNewFormat, SfxItemSet *pSet=nullptr, bool bKeepOrient=false)
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
const SwAttrPool & GetAttrPool() const
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Content, content of frame (header, footer, fly).
const SwNodeIndex * GetContentIdx() const
bool Rollback(SwDoc *pDoc, sal_uInt16 nStart=0)
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Marks a node in the document model.
const SwNodes & GetNodes() const
SwNodeOffset GetIndex() const
Base class of the Writer document model elements.
SwStartNode * GetStartNode()
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
bool IsNoTextNode() const
const SwStartNode * FindFlyStartNode() const
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
SwNodeOffset EndOfSectionIndex() const
SwContentNode * GetContentNode()
SwNoTextNode * GetNoTextNode()
OUString GetDescription() const
Remove OLE-object from "memory".
PaM is Point and Mark: a selection of the document model.
SwNode & GetPointNode() const
const SwPosition * GetPoint() const
void AddRule(SwUndoArg eWhat, const OUString &rWith)
sal_uInt16 GetCurrPage(const SwPaM *) const
Query/set the current Page and the collective Page count We'll format as much as necessary.
Starts a section of nodes in the document model.
SwStartNodeType GetStartNodeType() const
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
const SwFormatFlyCnt & GetFlyCnt() const
SwTextNode is a paragraph in the document model.
void DeleteAttributes(const sal_uInt16 nWhich, const sal_Int32 nStart, const sal_Int32 nEnd=0)
delete all attributes of type nWhich at nStart (opt. end nEnd)
SwTextAttr * InsertItem(SfxPoolItem &rAttr, const sal_Int32 nStart, const sal_Int32 nEnd, const SetAttrMode nMode=SetAttrMode::DEFAULT)
create new text attribute from rAttr and insert it
void EraseText(const SwContentIndex &rIdx, const sal_Int32 nCount=SAL_MAX_INT32, const SwInsertFlags nMode=SwInsertFlags::DEFAULT)
delete text content ATTENTION: must not be called with a range that overlaps the start of an attribut...
const OUString & GetText() const
SwTextAttr * GetTextAttrForCharAt(const sal_Int32 nIndex, const sal_uInt16 nWhich=RES_TXTATR_END) const
get the text attribute at position nIndex which owns the dummy character CH_TXTATR_* at that position...
void InsFly(::sw::UndoRedoContext &rContext, bool bShowSel=true)
SwNodeOffset m_nNodePagePos
SwFrameFormat * m_pFrameFormat
SwNodeOffset GetMvNodeCnt() const
virtual ~SwUndoFlyBase() override
SwUndoFlyBase(SwFrameFormat *pFormat, SwUndoId nUndoId)
void dumpAsXml(xmlTextWriterPtr pWriter) const override
const SwNodeIndex * GetMvSttIdx() const
void SaveSection(const SwNodeIndex &rSttIdx)
const SwHistory * GetHistory() const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
void RestoreSection(SwDoc *pDoc, SwNodeIndex *pIdx, sal_uInt16 nSectType)
std::optional< OUString > maComment
virtual OUString GetComment() const override
Returns textual comment for this undo object.
static void RemoveIdxFromSection(SwDoc &, SwNodeOffset nSttIdx, const SwNodeOffset *pEndIdx=nullptr)
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
struct _xmlTextWriter * xmlTextWriterPtr
virtual OUString GetName() const override
void PaMCorrAbs(const SwPaM &rRange, const SwPosition &rNewPos)
Function declarations so that everything below the CursorShell can move the Cursor once in a while.
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(169)
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(162)
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(165)
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(110)
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
WhichRangesContainer const aFrameFormatSetRange(svl::Items< RES_FRMATR_BEGIN, RES_FRMATR_END-1, RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1, XATTR_FILL_FIRST, XATTR_FILL_LAST >)
bool GetRanges(std::vector< std::shared_ptr< SwUnoCursor > > &rRanges, SwDoc &rDoc, SwPaM const &rDelPam)
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
bool IsInvalidItem(const SfxPoolItem *pItem)
Marks a position in the document model.
void SetContent(sal_Int32 nContentIndex)
Set content index, only valid to call this if the position points to a SwContentNode subclass.
const SfxPoolItem * m_pOld
@ NOHINTEXPAND
for Undo, translated to SwInsertFlags::NOHINTEXPAND
static SwUndoId lcl_GetSwUndoId(SwFrameFormat const *const pFrameFormat)