27#include <osl/diagnose.h>
65 GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwSdrUndo>(std::move(pUndo), pMarkList, *
this) );
102 if (!((RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId()) ||
103 (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId()) ||
104 (RndStdIds::FLY_AT_FLY == rAnchor.
GetAnchorId()) ||
105 (RndStdIds::FLY_AS_CHAR == rAnchor.
GetAnchorId())))
109 sal_Int32 nContentPos = 0;
111 if (RndStdIds::FLY_AS_CHAR == rAnchor.
GetAnchorId())
117 OSL_ENSURE( pTextNd,
"No text node found!" );
129 else if (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId())
140 if (!((RndStdIds::FLY_AT_PARA == rAnchor.
GetAnchorId()) ||
141 (RndStdIds::FLY_AT_CHAR == rAnchor.
GetAnchorId()) ||
142 (RndStdIds::FLY_AT_FLY == rAnchor.
GetAnchorId()) ||
143 (RndStdIds::FLY_AS_CHAR == rAnchor.
GetAnchorId())))
146 const sal_Int32 nContentPos = rAnchor.
GetPageNum();
153 if ((RndStdIds::FLY_AS_CHAR == rAnchor.
GetAnchorId()) ||
162 if (RndStdIds::FLY_AS_CHAR == nAnchorId)
165 OSL_ENSURE( pTextNd,
"no Text Node" );
167 pTextNd->
InsertItem( aFormat, nContentPos, nContentPos );
182 for( sal_uInt16
n = 1;
n <
m_nSize; ++
n, ++pTmp )
198 pObj->SetUserCall(
nullptr);
201 std::vector<std::pair<SdrObject*, SwFrameFormat*>> vTextBoxes;
204 if (
auto pChildren = pObj->getChildrenOfSdrObject())
206 for (
size_t idx = 0;
idx < pChildren->GetObjCount();
idx++)
208 auto pChild = pChildren->GetObj(
idx);
210 if (
auto pTextBox = pOldTextBoxNode->GetTextBox(pChild))
211 vTextBoxes.push_back(std::pair(pChild, pTextBox));
223 rFlyFormats.
erase( std::find( rFlyFormats.
begin(), rFlyFormats.
end(), pFormat ));
239 for (
auto& rElem : vTextBoxes)
241 if (rElem.first == pObj)
245 pNewTextBoxNode->AddTextBox(rElem.first, rElem.second);
246 rElem.second->SetOtherTextBoxFormats(pNewTextBoxNode);
254 OSL_ENSURE(pDrawFrameFormat,
255 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object");
256 if (pDrawFrameFormat)
270 std::vector<std::pair<SdrObject*, SwFrameFormat*>> vTextBoxes;
283 if (
auto pTextBox = pOldTextBoxNode->GetTextBox(pObj))
284 vTextBoxes.push_back(std::pair(pObj, pTextBox));
311 if (vTextBoxes.size())
314 for (
auto& rElem : vTextBoxes)
316 pNewTextBoxNode->AddTextBox(rElem.first, rElem.second);
317 rElem.second->SetOtherTextBoxFormats(pNewTextBoxNode);
319 m_pObjArray[0].pFormat->SetOtherTextBoxFormats(pNewTextBoxNode);
323 OSL_ENSURE(pDrawFrameFormat,
324 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object");
325 if (pDrawFrameFormat)
340 rFlyFormats.
erase( std::find( rFlyFormats.
begin(), rFlyFormats.
end(), pFormat ));
371 rFlyFormats.
erase( std::find( rFlyFormats.
begin(), rFlyFormats.
end(), pFormat ));
379 for( sal_uInt16
n = 1;
n <
m_nSize; ++
n, ++pTmp )
394 std::vector<std::pair<SdrObject*, SwFrameFormat*>> vTextBoxes;
408 if (
auto pChildren = pGroupObj->getChildrenOfSdrObject())
410 for (
size_t idx = 0;
idx < pChildren->GetObjCount();
idx++)
412 auto pChild = pChildren->GetObj(
idx);
413 if (
auto pTextBox = pTxBxNd->GetTextBox(pChild))
414 vTextBoxes.push_back(std::pair(pChild, pTextBox));
437 if (vTextBoxes.size())
440 for (
auto& rElem : vTextBoxes)
442 pNewTxBxNd->AddTextBox(rElem.first, rElem.second);
443 rElem.second->SetOtherTextBoxFormats(pNewTxBxNd);
445 m_pObjArray[0].pFormat->SetOtherTextBoxFormats(pNewTxBxNd);
450 OSL_ENSURE(pDrawFrameFormat,
451 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object");
452 if (pDrawFrameFormat)
468 std::vector<std::pair<SdrObject*, SwFrameFormat*>> vTextBoxes;
473 if (
auto pObjList = pMasterObj->getChildrenOfSdrObject())
474 for (
size_t idx = 0;
idx < pObjList->GetObjCount();
idx++)
476 vTextBoxes.push_back(std::pair(pObjList->GetObj(
idx), pTextBoxNode->GetTextBox(pObjList->GetObj(
idx))));
485 rFlyFormats.
erase( std::find( rFlyFormats.
begin(), rFlyFormats.
end(), pFormat ));
497 for (
auto& pElem : vTextBoxes)
499 if (pElem.first == rSave.
pObj)
502 pTmpTxBxNd->AddTextBox(rSave.
pObj, pElem.second);
504 pElem.second->SetOtherTextBoxFormats(pTmpTxBxNd);
510 OSL_ENSURE(pDrawFrameFormat,
511 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object" );
512 if (pDrawFrameFormat)
521 rSave.
pObj =
nullptr;
540 OSL_ENSURE( pDrawContact,
541 "<SwUndoDrawUnGroupConnectToLayout::Undo(..)> -- missing SwDrawContact instance" );
599 pContact->
Changed_( *pObj, SdrUserCallType::Inserted,
nullptr );
611 OSL_ENSURE(pDrawFrameFormat,
612 "<SwUndoDrawGroup::Undo(..)> - wrong type of frame format for drawing object");
613 if (pDrawFrameFormat)
636 rFlyFormats.
erase( std::find( rFlyFormats.
begin(), rFlyFormats.
end(), pFormat ));
654 rFlyFormats.
erase( std::find( rFlyFormats.
begin(), rFlyFormats.
end(), pFormat ));
661 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwUndoDrawDelete"));
666 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"SwUndoGroupObjImpl"));
667 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST(
"index"),
668 BAD_CAST(OString::number(
i).getStr()));
672 (void)xmlTextWriterStartElement(pWriter, BAD_CAST(
"pFormat"));
674 (void)xmlTextWriterEndElement(pWriter);
676 (void)xmlTextWriterEndElement(pWriter);
679 (void)xmlTextWriterEndElement(pWriter);
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
size_t GetMarkCount() const
const SdrMarkList & GetMarkedObjectList() const
SdrObject * GetMarkedSdrObj() const
virtual SdrObjList * GetSubList() const override
size_t GetObjCount() const
SdrObjUserCall * GetUserCall() const
void SetUserCall(SdrObjUserCall *pUser)
virtual const tools::Rectangle & GetLastBoundRect() const
Marks a character position inside a document model content node (SwContentNode)
IDocumentUndoRedo & GetIDocumentUndoRedo()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
void AddDrawUndo(std::unique_ptr< SdrUndoAction >)
const sw::FrameFormats< sw::SpzFrameFormat * > * GetSpzFrameFormats() const
Marks a node in the document model.
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
SwNodeOffset GetIndex() const
std::unique_ptr< SdrUndoAction > m_pSdrUndo
virtual void RedoImpl(::sw::UndoRedoContext &) override
SwSdrUndo(std::unique_ptr< SdrUndoAction >, const SdrMarkList *pMarkList, const SwDoc &rDoc)
virtual ~SwSdrUndo() override
std::unique_ptr< SdrMarkList > m_pMarkList
virtual OUString GetComment() const override
Returns textual comment for this undo object.
virtual void UndoImpl(::sw::UndoRedoContext &) override
const SwFormatFlyCnt & GetFlyCnt() const
static bool changeAnchor(SwFrameFormat *pShape, SdrObject *pObj)
Sets the anchor of the associated textframe of the given shape, and returns true on success.
static void synchronizeGroupTextBoxProperty(bool pFunc(SwFrameFormat *, SdrObject *), SwFrameFormat *pFormat, SdrObject *pObj)
Calls the method given by pFunc with every textboxes of the group given by pFormat.
Textboxes are basically textframe + shape pairs.
SwTextNode is a paragraph in the document model.
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...
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...
virtual void RedoImpl(::sw::UndoRedoContext &) override
std::unique_ptr< SdrMarkList > m_pMarkList
std::unique_ptr< SwUndoGroupObjImpl[]> m_pObjArray
void dumpAsXml(xmlTextWriterPtr pWriter) const override
void AddObj(SwDrawFrameFormat *, const SdrMark &)
virtual void UndoImpl(::sw::UndoRedoContext &) override
virtual ~SwUndoDrawDelete() override
SwUndoDrawDelete(sal_uInt16 nCnt, const SwDoc &rDoc)
virtual ~SwUndoDrawGroup() override
void AddObj(sal_uInt16 nPos, SwDrawFrameFormat *, SdrObject *)
virtual void RedoImpl(::sw::UndoRedoContext &) override
SwUndoDrawGroup(sal_uInt16 nCnt, const SwDoc &rDoc)
std::unique_ptr< SwUndoGroupObjImpl[]> m_pObjArray
virtual void UndoImpl(::sw::UndoRedoContext &) override
void SetGroupFormat(SwDrawFrameFormat *)
virtual ~SwUndoDrawUnGroupConnectToLayout() override
virtual void RedoImpl(::sw::UndoRedoContext &) override
SwUndoDrawUnGroupConnectToLayout(const SwDoc &rDoc)
virtual void UndoImpl(::sw::UndoRedoContext &) override
std::vector< std::pair< SwDrawFrameFormat *, SdrObject * > > m_aDrawFormatsAndObjs
void AddFormatAndObj(SwDrawFrameFormat *pDrawFrameFormat, SdrObject *pDrawObject)
virtual void RedoImpl(::sw::UndoRedoContext &) override
virtual void UndoImpl(::sw::UndoRedoContext &) override
virtual ~SwUndoDrawUnGroup() override
void AddObj(sal_uInt16 nPos, SwDrawFrameFormat *)
std::unique_ptr< SwUndoGroupObjImpl[]> m_pObjArray
SwUndoDrawUnGroup(SdrObjGroup *, const SwDoc &rDoc)
void SetSelections(SwFrameFormat *const pSelFormat, SdrMarkList *const pMarkList)
struct _xmlTextWriter * xmlTextWriterPtr
constexpr TypedWhichId< SwFormatFlyCnt > RES_TXTATR_FLYCNT(58)
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.
SwDrawFrameFormat * pFormat
static void lcl_RestoreAnchor(SwFrameFormat *pFormat, SwNodeOffset nNodePos)
static void lcl_SaveAnchor(SwFrameFormat *pFormat, SwNodeOffset &rNodePos)