Kaydet (Commit) d9b6f836 authored tarafından Eike Rathke's avatar Eike Rathke Kaydeden (comit) Markus Mohrhard

Resolves: tdf#89907 do not modify original ScViewData's ScMarkData

Change-Id: I2ae5a06f9ffe29de0b1cc5875615010da75f4ae9
(cherry picked from commit d1225d60)
Reviewed-on: https://gerrit.libreoffice.org/20020Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 22f51321
...@@ -1824,13 +1824,13 @@ void ScViewFunc::SetWidthOrHeight( ...@@ -1824,13 +1824,13 @@ void ScViewFunc::SetWidthOrHeight(
if (rRanges.empty()) if (rRanges.empty())
return; return;
// use view's mark if none specified // Use view's mark if none specified, but do not modify the original data,
if ( !pMarkData ) // i.e. no MarkToMulti() on that.
pMarkData = &GetViewData().GetMarkData(); ScMarkData aMarkData( pMarkData ? *pMarkData : GetViewData().GetMarkData());
ScDocShell* pDocSh = GetViewData().GetDocShell(); ScDocShell* pDocSh = GetViewData().GetDocShell();
ScDocument& rDoc = pDocSh->GetDocument(); ScDocument& rDoc = pDocSh->GetDocument();
SCTAB nFirstTab = pMarkData->GetFirstSelected(); SCTAB nFirstTab = aMarkData.GetFirstSelected();
SCTAB nCurTab = GetViewData().GetTabNo(); SCTAB nCurTab = GetViewData().GetTabNo();
SCTAB nTab; SCTAB nTab;
if (bRecord && !rDoc.IsUndoEnabled()) if (bRecord && !rDoc.IsUndoEnabled())
...@@ -1839,7 +1839,7 @@ void ScViewFunc::SetWidthOrHeight( ...@@ -1839,7 +1839,7 @@ void ScViewFunc::SetWidthOrHeight(
ScDocShellModificator aModificator( *pDocSh ); ScDocShellModificator aModificator( *pDocSh );
bool bAllowed = true; bool bAllowed = true;
ScMarkData::iterator itr = pMarkData->begin(), itrEnd = pMarkData->end(); ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end();
for (; itr != itrEnd && bAllowed; ++itr) for (; itr != itrEnd && bAllowed; ++itr)
{ {
for (size_t i = 0, n = rRanges.size(); i < n && bAllowed; ++i) for (size_t i = 0, n = rRanges.size(); i < n && bAllowed; ++i)
...@@ -1886,7 +1886,7 @@ void ScViewFunc::SetWidthOrHeight( ...@@ -1886,7 +1886,7 @@ void ScViewFunc::SetWidthOrHeight(
rDoc.BeginDrawUndo(); // Drawing Updates rDoc.BeginDrawUndo(); // Drawing Updates
pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
itr = pMarkData->begin(); itr = aMarkData.begin();
for (; itr != itrEnd; ++itr) for (; itr != itrEnd; ++itr)
{ {
if (bWidth) if (bWidth)
...@@ -1918,12 +1918,12 @@ void ScViewFunc::SetWidthOrHeight( ...@@ -1918,12 +1918,12 @@ void ScViewFunc::SetWidthOrHeight(
} }
if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT ) if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT )
pMarkData->MarkToMulti(); aMarkData.MarkToMulti();
bool bShow = nSizeTwips > 0 || eMode != SC_SIZE_DIRECT; bool bShow = nSizeTwips > 0 || eMode != SC_SIZE_DIRECT;
bool bOutline = false; bool bOutline = false;
itr = pMarkData->begin(); itr = aMarkData.begin();
for (; itr != itrEnd; ++itr) for (; itr != itrEnd; ++itr)
{ {
nTab = *itr; nTab = *itr;
...@@ -2036,7 +2036,7 @@ void ScViewFunc::SetWidthOrHeight( ...@@ -2036,7 +2036,7 @@ void ScViewFunc::SetWidthOrHeight(
{ {
pDocSh->GetUndoManager()->AddUndoAction( pDocSh->GetUndoManager()->AddUndoAction(
new ScUndoWidthOrHeight( new ScUndoWidthOrHeight(
pDocSh, *pMarkData, nStart, nCurTab, nEnd, nCurTab, pDocSh, aMarkData, nStart, nCurTab, nEnd, nCurTab,
pUndoDoc, aUndoRanges, pUndoTab, eMode, nSizeTwips, bWidth)); pUndoDoc, aUndoRanges, pUndoTab, eMode, nSizeTwips, bWidth));
} }
...@@ -2044,7 +2044,7 @@ void ScViewFunc::SetWidthOrHeight( ...@@ -2044,7 +2044,7 @@ void ScViewFunc::SetWidthOrHeight(
// the new heights and widths. // the new heights and widths.
GetViewData().GetView()->RefreshZoom(); GetViewData().GetView()->RefreshZoom();
itr = pMarkData->begin(); itr = aMarkData.begin();
for (; itr != itrEnd; ++itr) for (; itr != itrEnd; ++itr)
rDoc.UpdatePageBreaks( *itr ); rDoc.UpdatePageBreaks( *itr );
...@@ -2052,7 +2052,7 @@ void ScViewFunc::SetWidthOrHeight( ...@@ -2052,7 +2052,7 @@ void ScViewFunc::SetWidthOrHeight(
if (bPaint) if (bPaint)
{ {
itr = pMarkData->begin(); itr = aMarkData.begin();
for (; itr != itrEnd; ++itr) for (; itr != itrEnd; ++itr)
{ {
nTab = *itr; nTab = *itr;
...@@ -2087,7 +2087,7 @@ void ScViewFunc::SetWidthOrHeight( ...@@ -2087,7 +2087,7 @@ void ScViewFunc::SetWidthOrHeight(
if (ScModelObj* pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh)) if (ScModelObj* pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh))
{ {
ScRangeList aChangeRanges; ScRangeList aChangeRanges;
itr = pMarkData->begin(); itr = aMarkData.begin();
for (; itr != itrEnd; ++itr) for (; itr != itrEnd; ++itr)
{ {
nTab = *itr; nTab = *itr;
......
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