20 #include <libxml/xmlwriter.h>
24 #include <osl/diagnose.h>
45 :
SwUndo(nUndoId, pFormat->GetDoc())
46 , m_pFrameFormat(pFormat)
68 (
void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwUndoFlyBase"));
69 (
void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nNodePagePos"),
71 (
void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nContentPos"),
73 (
void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nRndId"),
74 BAD_CAST(OString::number(static_cast<int>(
m_nRndId)).getStr()));
75 (
void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_bDelFormat"),
86 (
void)xmlTextWriterEndElement(pWriter);
103 if (RndStdIds::FLY_AT_PAGE ==
m_nRndId)
111 if ((RndStdIds::FLY_AS_CHAR ==
m_nRndId) || (RndStdIds::FLY_AT_CHAR ==
m_nRndId))
113 aNewPos.nContent.Assign( aNewPos.nNode.GetNode().GetContentNode(),
132 if (RndStdIds::FLY_AS_CHAR ==
m_nRndId)
136 OSL_ENSURE( pCNd->
IsTextNode(),
"no Text Node at position." );
183 case RndStdIds::FLY_AS_CHAR:
184 case RndStdIds::FLY_AT_CHAR:
191 case RndStdIds::FLY_AT_PARA:
192 case RndStdIds::FLY_AT_FLY:
198 case RndStdIds::FLY_AT_PAGE:
222 OSL_ENSURE( rContent.
GetContentIdx(),
"Fly without content" );
235 if (RndStdIds::FLY_AS_CHAR ==
m_nRndId)
240 OSL_ENSURE( pTextNd,
"No Textnode found" );
252 else if (RndStdIds::FLY_AT_CHAR ==
m_nRndId)
257 else if ((RndStdIds::FLY_AT_PARA ==
m_nRndId) || (RndStdIds::FLY_AT_FLY ==
m_nRndId))
276 mnCursorSaveIndexPara( nNodeIdx ), mnCursorSaveIndexPos( nCntIdx )
295 if( rContent.GetContentIdx() )
297 assert(&rContent.GetContentIdx()->GetNodes() == &rDoc.GetNodes());
298 bool bRemoveIdx =
true;
306 rContent.GetContentIdx()->GetIndex() );
308 aIdx.GetNode().EndOfSectionIndex() );
333 if ((RndStdIds::FLY_AT_PARA == aAnchor.GetAnchorId()) ||
334 (RndStdIds::FLY_AT_CHAR == aAnchor.GetAnchorId()) ||
335 (RndStdIds::FLY_AS_CHAR == aAnchor.GetAnchorId()))
338 if (RndStdIds::FLY_AT_PARA == aAnchor.GetAnchorId())
342 aAnchor.SetAnchor( &aPos );
344 else if( RndStdIds::FLY_AT_FLY == aAnchor.GetAnchorId() )
351 aAnchor.SetAnchor( &aPos );
358 else if (RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId())
363 OSL_FAIL(
"What kind of anchor is this?" );
410 OSL_ENSURE( rContent.
GetContentIdx(),
"Fly without content" );
413 SwNoTextNode *
const pNoTextNode(firstNode.GetNode().GetNoTextNode());
414 if (pNoTextNode && pNoTextNode->IsGrfNode())
418 else if (pNoTextNode && pNoTextNode->IsOLENode())
429 , m_bShowSelFrame( true )
469 if( rContent.GetContentIdx() )
489 m_DerivedFromFormatName( rFlyFormat.IsDefault() ?
"" : rFlyFormat.DerivedFrom()->
GetName() ),
490 m_NewFormatName( rNewFrameFormat.
GetName() ),
491 m_oItemSet(
std::in_place, *rFlyFormat.GetAttrSet().GetPool(),
493 m_nOldNode( 0 ), m_nNewNode( 0 ),
494 m_nOldContent( 0 ), m_nNewContent( 0 ),
516 if (RndStdIds::FLY_AT_PAGE != nAnchorTyp)
520 if( RndStdIds::FLY_AT_FLY == nAnchorTyp
522 static_cast<SwStartNode*
>(pNd)->GetStartNodeType() )
530 if ((RndStdIds::FLY_AS_CHAR == nAnchorTyp) ||
531 (RndStdIds::FLY_AT_CHAR == nAnchorTyp))
551 rAnchor.
SetType( RndStdIds::FLY_AT_PAGE );
565 if (!pDerivedFromFrameFormat)
587 if (RndStdIds::FLY_AS_CHAR == rOldAnch.
GetAnchorId())
595 OSL_ENSURE( pTextNode->
HasHints(),
"Missing FlyInCnt-Hint." );
599 assert(pHint &&
"Missing Hint.");
601 "Missing FlyInCnt-Hint." );
603 "Wrong TextFlyCnt-Hint." );
616 if (RndStdIds::FLY_AS_CHAR == aNewAnchor.
GetAnchorId())
635 if (!pNewFrameFormat)
643 aSet.
Put( aNewAnchor );
660 OSL_ENSURE( !
m_bAnchorChanged,
"multiple changes of an anchor are not allowed!" );
668 case RndStdIds::FLY_AS_CHAR:
669 case RndStdIds::FLY_AT_CHAR:
672 case RndStdIds::FLY_AT_PARA:
673 case RndStdIds::FLY_AT_FLY:
685 case RndStdIds::FLY_AS_CHAR:
686 case RndStdIds::FLY_AT_CHAR:
689 case RndStdIds::FLY_AT_PARA:
690 case RndStdIds::FLY_AT_FLY:
707 if (rHint.
GetId() != SfxHintId::SwLegacyModify)
712 const sal_uInt16 nWhich = pLegacy->
m_pOld->
Which();
714 PutAttr(nWhich, pLegacy->m_pOld);
717 SfxItemIter aIter(*static_cast<const SwAttrSetChg*>(pLegacy->m_pOld)->GetChgSet());
718 for(
const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
719 PutAttr(pItem->Which(), pItem);
Starts a section of nodes in the document model.
SwNode & GetNode(bool bPoint=true) const
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
bool GetRanges(std::vector< std::shared_ptr< SwUnoCursor >> &rRanges, SwDoc &rDoc, SwPaM const &rDelPam)
Marks a position in the document model.
SwNodeOffset GetMvNodeCnt() const
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
const OUString & GetText() const
virtual const SwRootFrame * GetCurrentLayout() const =0
sal_uInt16 GetCurrPage(const SwPaM *) const
Query/set the current Page and the collective Page count We'll format as much as necessary.
void dumpAsXml(xmlTextWriterPtr pWriter) const override
bool Rollback(SwDoc *pDoc, sal_uInt16 nStart=0)
static void RemoveIdxFromSection(SwDoc &, SwNodeOffset nSttIdx, const SwNodeOffset *pEndIdx=nullptr)
virtual SwFrameFormat * CopyLayoutFormat(const SwFrameFormat &rSrc, const SwFormatAnchor &rNewAnchor, bool bSetTextFlyAtt, bool bMakeFrames)=0
Content, content of frame (header, footer, fly).
const SwHistory * GetHistory() const
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 >)
void InsFly(::sw::UndoRedoContext &rContext, bool bShowSel=true)
const SwFrameFormats * GetSpzFrameFormats() const
constexpr TypedWhichId< SwFlyFrameFormat > RES_FLYFRMFMT(156)
SwFrameFormat * FindFrameFormatByName(const OUString &rName) 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...
const SfxPoolItem * NextItem()
SwNodeOffset m_nNodePagePos
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(159)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
for Undo, translated to SwInsertFlags::NOHINTEXPAND
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
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
SwNodeOffset GetIndex() const
virtual OUString GetName() const override
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
SwNodeIndex * GetMvSttIdx() const
SwFrameFormat * m_pFrameFormat
const SwPosition * GetPoint() const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
SwIndex & Assign(SwIndexReg *, sal_Int32)
static SwUndoId lcl_GetSwUndoId(SwFrameFormat const *const pFrameFormat)
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
bool SetFrameFormatToFly(SwFrameFormat &rFlyFormat, SwFrameFormat &rNewFormat, SfxItemSet *pSet=nullptr, bool bKeepOrient=false)
SwContentNode * GetContentNode()
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
Marks a character position inside a document model node.
void AddRule(SwUndoArg eWhat, const OUString &rWith)
std::optional< OUString > maComment
bool IsNoTextNode() const
Layout frame for SwNoTextNode, i.e. graphics and OLE nodes (including charts).
Marks a node in the document model.
SwNodes & GetNodes()
Node is in which nodes-array/doc?
virtual OUString GetComment() const override
Returns textual comment for this undo object.
virtual void setUnoShape(const css::uno::Reference< css::drawing::XShape > &_rxUnoShape)
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
virtual ~SwUndoFlyBase() override
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
const SwNodeIndex * GetContentIdx() const
sal_uInt16 GetCurPos() const
void EraseText(const SwIndex &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 SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
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)
void RestoreSection(SwDoc *pDoc, SwNodeIndex *pIdx, sal_uInt16 nSectType)
std::deque< AttacherIndex_Impl > aIndex
void CorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
const SfxPoolItem * m_pOld
sal_Int32 GetIndex() const
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
SwUndoFlyBase(SwFrameFormat *pFormat, SwUndoId nUndoId)
virtual void CallSwClientNotify(const SfxHint &rHint) const override
const SwStartNode * FindFlyStartNode() const
struct _xmlTextWriter * xmlTextWriterPtr
virtual OUString GetComment() const override
bool IsInvalidItem(const SfxPoolItem *pItem)
void SaveSection(const SwNodeIndex &rSttIdx)
const SfxPoolItem * GetCurItem() const
constexpr TypedWhichId< SwFormatAnchor > RES_ANCHOR(104)
const SwAttrPool & GetAttrPool() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
bool m_bDetectedRangeSegmentation false
const SwFormatFlyCnt & GetFlyCnt() const
Base class of the Writer document model elements.
OUString GetDescription() const
Remove OLE-object from "memory".