Kaydet (Commit) 4345b5cb authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#38545: Show/hide anchor when the anchoring status changes.

Setting a page-anchored object to cell-anchored didn't show the anchor
immediately until you unselect the object and re-select it.  Same for
the cell-anchored to page-anchored direction.

This commit fixes it.
üst 25180de7
...@@ -87,6 +87,10 @@ void ScDrawView::SetPageAnchored() ...@@ -87,6 +87,10 @@ void ScDrawView::SetPageAnchored()
if ( pViewData ) if ( pViewData )
pViewData->GetDocShell()->SetDrawModified(); pViewData->GetDocShell()->SetDrawModified();
// Remove the anchor object.
aHdl.RemoveAllByKind(HDL_ANCHOR);
aHdl.RemoveAllByKind(HDL_ANCHOR_TR);
} }
} }
...@@ -108,6 +112,9 @@ void ScDrawView::SetCellAnchored() ...@@ -108,6 +112,9 @@ void ScDrawView::SetCellAnchored()
if ( pViewData ) if ( pViewData )
pViewData->GetDocShell()->SetDrawModified(); pViewData->GetDocShell()->SetDrawModified();
// Set the anchor object.
AddCustomHdl();
} }
} }
......
...@@ -502,6 +502,7 @@ public: ...@@ -502,6 +502,7 @@ public:
// also auf dem Heap stehen, da Clear() ein delete macht. // also auf dem Heap stehen, da Clear() ein delete macht.
void AddHdl(SdrHdl* pHdl, sal_Bool bAtBegin=sal_False); void AddHdl(SdrHdl* pHdl, sal_Bool bAtBegin=sal_False);
SdrHdl* RemoveHdl(sal_uIntPtr nNum); SdrHdl* RemoveHdl(sal_uIntPtr nNum);
void RemoveAllByKind(SdrHdlKind eKind);
// Zuletzt eingefuegte Handles werden am ehesten getroffen // Zuletzt eingefuegte Handles werden am ehesten getroffen
// (wenn Handles uebereinander liegen). // (wenn Handles uebereinander liegen).
......
...@@ -2081,6 +2081,26 @@ SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum) ...@@ -2081,6 +2081,26 @@ SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum)
return pRetval; return pRetval;
} }
void SdrHdlList::RemoveAllByKind(SdrHdlKind eKind)
{
SdrHdl* p = static_cast<SdrHdl*>(aList.Last());
while (p)
{
if (p->GetKind() == eKind)
{
// If removing an item doesn't invalidate the current position,
// then perhaps it's safe to keep calling Prev here. But then I'm
// too lazy to find out & this Container needs to be replaced by
// STL anyways... :-P
aList.Remove(p);
delete p;
p = static_cast<SdrHdl*>(aList.Last()); // start from the back again.
}
else
p = static_cast<SdrHdl*>(aList.Prev());
}
}
void SdrHdlList::Clear() void SdrHdlList::Clear()
{ {
for (sal_uIntPtr i=0; i<GetHdlCount(); i++) for (sal_uIntPtr i=0; i<GetHdlCount(); i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment