diff options
author | Armin Le Grand (Allotropia) <Armin.Le.Grand@me.com> | 2022-04-06 12:03:10 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-04-06 14:31:01 +0200 |
commit | 4e8d6ccf97e29e5ea14e0d074074606f12040f36 (patch) | |
tree | 5071e27e6f9b0425b50e72c99c9042b653e24c82 /svx/source/svdraw | |
parent | c0f8570361aa4c2b771b758284258f8a8f0246f8 (diff) |
Advanced Diagram support: Enhance BackgroundShape handling
The BackgroundShape may have a FillStyle after import, so do
handle that FillStyle accordingly. Also enhance breaking
the Group by keeping that shape in that case and deactivate
Move/Size change lock for it. Also Undo needed.
Change-Id: Iccdb236a2311275efc07162fd4bd2cfc252fd437
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132626
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r-- | svx/source/svdraw/svdedtv2.cxx | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index a046a6b3a59e..08b361afa9a3 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1915,25 +1915,43 @@ void SdrEditView::UnGroupMarked() const bool bIsDiagram(nullptr != pGroup && pGroup->isDiagram()); // If the Group is a Diagram, it has a filler BG object to guarantee - // the Diagam's dimensions. Identify that shape & delete it, it is not - // useful for any further processing + // the Diagam's dimensions. Identify that shape if(bIsDiagram && nObjCount) { SdrObject* pObj(pSrcLst->GetObj(0)); if(nullptr != pObj && !pObj->IsGroupObject() && - !pObj->HasFillStyle() && !pObj->HasLineStyle() && + !pObj->HasLineStyle() && pObj->IsMoveProtect() && pObj->IsResizeProtect()) { - if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); + if(pObj->HasFillStyle()) + { + // If it has FillStyle it is a useful object representing that possible + // defined fill from oox import. In this case, we should remove the + // Move/Resize protection to allow seamless further processing. + + // Undo of these is handled by SdrUndoGeoObj which holds a SdrObjGeoData, + // creae one + if( bUndo ) + AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + + pObj->SetMoveProtect(false); + pObj->SetResizeProtect(false); + } + else + { + // If it has no FillStyle it is not useful for any further processing + // but only was used as a placeholder, get directly rid of it + if( bUndo ) + AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); - pObj = pSrcLst->RemoveObject(0); + pObj = pSrcLst->RemoveObject(0); - if( !bUndo ) - SdrObject::Free(pObj); + if( !bUndo ) + SdrObject::Free(pObj); - nObjCount = pSrcLst->GetObjCount(); + nObjCount = pSrcLst->GetObjCount(); + } } } |