20 #include <libxml/xmlwriter.h>
44 :
SwUndo(nUndoId, pFormat->GetDoc())
45 , m_pFrameFormat(pFormat)
67 xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwUndoFlyBase"));
68 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nNodePagePos"),
70 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nContentPos"),
72 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_nRndId"),
73 BAD_CAST(OString::number(static_cast<int>(
m_nRndId)).getStr()));
74 xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"m_bDelFormat"),
85 xmlTextWriterEndElement(pWriter);
102 if (RndStdIds::FLY_AT_PAGE ==
m_nRndId)
110 if ((RndStdIds::FLY_AS_CHAR ==
m_nRndId) || (RndStdIds::FLY_AT_CHAR ==
m_nRndId))
112 aNewPos.nContent.Assign( aNewPos.nNode.GetNode().GetContentNode(),
131 if (RndStdIds::FLY_AS_CHAR ==
m_nRndId)
135 OSL_ENSURE( pCNd->
IsTextNode(),
"no Text Node at position." );
178 case RndStdIds::FLY_AS_CHAR:
179 case RndStdIds::FLY_AT_CHAR:
186 case RndStdIds::FLY_AT_PARA:
187 case RndStdIds::FLY_AT_FLY:
193 case RndStdIds::FLY_AT_PAGE:
217 OSL_ENSURE( rContent.
GetContentIdx(),
"Fly without content" );
230 if (RndStdIds::FLY_AS_CHAR ==
m_nRndId)
235 OSL_ENSURE( pTextNd,
"No Textnode found" );
247 else if (RndStdIds::FLY_AT_CHAR ==
m_nRndId)
252 else if ((RndStdIds::FLY_AT_PARA ==
m_nRndId) || (RndStdIds::FLY_AT_FLY ==
m_nRndId))
271 mnCursorSaveIndexPara( nNodeIdx ), mnCursorSaveIndexPos( nCntIdx )
290 if( rContent.GetContentIdx() )
292 assert(&rContent.GetContentIdx()->GetNodes() == &rDoc.GetNodes());
293 bool bRemoveIdx =
true;
301 rContent.GetContentIdx()->GetIndex() );
303 aIdx.GetNode().EndOfSectionIndex() );
328 if ((RndStdIds::FLY_AT_PARA == aAnchor.GetAnchorId()) ||
329 (RndStdIds::FLY_AT_CHAR == aAnchor.GetAnchorId()) ||
330 (RndStdIds::FLY_AS_CHAR == aAnchor.GetAnchorId()))
333 if (RndStdIds::FLY_AT_PARA == aAnchor.GetAnchorId())
337 aAnchor.SetAnchor( &aPos );
339 else if( RndStdIds::FLY_AT_FLY == aAnchor.GetAnchorId() )
346 aAnchor.SetAnchor( &aPos );
353 else if (RndStdIds::FLY_AT_PAGE == aAnchor.GetAnchorId())
358 OSL_FAIL(
"What kind of anchor is this?" );
405 OSL_ENSURE( rContent.
GetContentIdx(),
"Fly without content" );
408 SwNoTextNode *
const pNoTextNode(firstNode.GetNode().GetNoTextNode());
409 if (pNoTextNode && pNoTextNode->IsGrfNode())
413 else if (pNoTextNode && pNoTextNode->IsOLENode())
424 , m_bShowSelFrame( true )
464 if( rContent.GetContentIdx() )
484 m_DerivedFromFormatName( rFlyFormat.IsDefault() ?
"" : rFlyFormat.DerivedFrom()->GetName() ),
485 m_NewFormatName( rNewFrameFormat.GetName() ),
486 m_pItemSet( new
SfxItemSet( *rFlyFormat.GetAttrSet().GetPool(),
488 m_nOldNode( 0 ), m_nNewNode( 0 ),
489 m_nOldContent( 0 ), m_nNewContent( 0 ),
511 if (RndStdIds::FLY_AT_PAGE != nAnchorTyp)
515 if( RndStdIds::FLY_AT_FLY == nAnchorTyp
517 static_cast<SwStartNode*
>(pNd)->GetStartNodeType() )
525 if ((RndStdIds::FLY_AS_CHAR == nAnchorTyp) ||
526 (RndStdIds::FLY_AT_CHAR == nAnchorTyp))
546 rAnchor.
SetType( RndStdIds::FLY_AT_PAGE );
560 if (!pDerivedFromFrameFormat)
582 if (RndStdIds::FLY_AS_CHAR == rOldAnch.
GetAnchorId())
590 OSL_ENSURE( pTextNode->
HasHints(),
"Missing FlyInCnt-Hint." );
594 assert(pHint &&
"Missing Hint.");
596 "Missing FlyInCnt-Hint." );
598 "Wrong TextFlyCnt-Hint." );
611 if (RndStdIds::FLY_AS_CHAR == aNewAnchor.
GetAnchorId())
630 if (!pNewFrameFormat)
638 aSet.Put( aNewAnchor );
655 OSL_ENSURE( !
m_bAnchorChanged,
"multiple changes of an anchor are not allowed!" );
663 case RndStdIds::FLY_AS_CHAR:
664 case RndStdIds::FLY_AT_CHAR:
667 case RndStdIds::FLY_AT_PARA:
668 case RndStdIds::FLY_AT_FLY:
680 case RndStdIds::FLY_AS_CHAR:
681 case RndStdIds::FLY_AT_CHAR:
684 case RndStdIds::FLY_AT_PARA:
685 case RndStdIds::FLY_AT_FLY:
703 if(!pLegacy || !pLegacy->m_pOld)
705 const sal_uInt16 nWhich = pLegacy->
m_pOld->
Which();
707 PutAttr(nWhich, pLegacy->m_pOld);
710 SfxItemIter aIter(*static_cast<const SwAttrSetChg*>(pLegacy->m_pOld)->GetChgSet());
711 for(
const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
712 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.
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)
virtual SwFrameFormat * CopyLayoutFormat(const SwFrameFormat &rSrc, const SwFormatAnchor &rNewAnchor, bool bSetTextFlyAtt, bool bMakeFrames)=0
void setUnoShape(const css::uno::Reference< css::uno::XInterface > &_rxUnoShape)
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(57)
Content, content of frame (header, footer, fly).
const SwHistory * GetHistory() const
static void RemoveIdxFromSection(SwDoc &, sal_uLong nSttIdx, const sal_uLong *pEndIdx=nullptr)
SwFrameFormat * FindFrameFormatByName(std::u16string_view rName) const
void InsFly(::sw::UndoRedoContext &rContext, bool bShowSel=true)
const SwFrameFormats * GetSpzFrameFormats() 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()
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
for Undo, translated to SwInsertFlags::NOHINTEXPAND
sal_uLong GetIndex() const
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(161)
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.
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
SwNodeIndex * GetMvSttIdx() const
struct _xmlTextWriter * xmlTextWriterPtr
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)
bool SetFrameFormatToFly(SwFrameFormat &rFlyFormat, SwFrameFormat &rNewFormat, SfxItemSet *pSet=nullptr, bool bKeepOrient=false)
SwContentNode * GetContentNode()
Marks a character position inside a document model node.
void AddRule(SwUndoArg eWhat, const OUString &rWith)
std::optional< OUString > maComment
bool IsNoTextNode() const
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.
sal_uLong GetMvNodeCnt() const
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 const aFrameFormatSetRange[]
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...
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
constexpr TypedWhichId< SwDrawFrameFormat > RES_DRAWFRMFMT(157)
SwUndoFlyBase(SwFrameFormat *pFormat, SwUndoId nUndoId)
virtual void CallSwClientNotify(const SfxHint &rHint) const override
const SwStartNode * FindFlyStartNode() const
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.
const SwFormatFlyCnt & GetFlyCnt() const
Base class of the Writer document model elements.
OUString GetDescription() const
Remove OLE-object from "memory".