1 |
From 1ea49ea99bf0f93af7fcbc741ee45fc9ca21892c Mon Sep 17 00:00:00 2001 |
2 |
From: Eike Rathke <erack@redhat.com> |
3 |
Date: Tue, 17 Nov 2015 14:46:11 +0100 |
4 |
Subject: [PATCH] Resolves: tdf#89907 do not modify original ScViewData's |
5 |
ScMarkData |
6 |
|
7 |
Change-Id: I2ae5a06f9ffe29de0b1cc5875615010da75f4ae9 |
8 |
(cherry picked from commit d1225d60af08ed874ed72066ae0320617d4c8a91) |
9 |
--- |
10 |
sc/source/ui/view/viewfunc.cxx | 24 ++++++++++++------------ |
11 |
1 file changed, 12 insertions(+), 12 deletions(-) |
12 |
|
13 |
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx |
14 |
index ba1d432..f780f26 100644 |
15 |
--- a/sc/source/ui/view/viewfunc.cxx |
16 |
+++ b/sc/source/ui/view/viewfunc.cxx |
17 |
@@ -1824,13 +1824,13 @@ void ScViewFunc::SetWidthOrHeight( |
18 |
if (rRanges.empty()) |
19 |
return; |
20 |
|
21 |
- // use view's mark if none specified |
22 |
- if ( !pMarkData ) |
23 |
- pMarkData = &GetViewData().GetMarkData(); |
24 |
+ // Use view's mark if none specified, but do not modify the original data, |
25 |
+ // i.e. no MarkToMulti() on that. |
26 |
+ ScMarkData aMarkData( pMarkData ? *pMarkData : GetViewData().GetMarkData()); |
27 |
|
28 |
ScDocShell* pDocSh = GetViewData().GetDocShell(); |
29 |
ScDocument& rDoc = pDocSh->GetDocument(); |
30 |
- SCTAB nFirstTab = pMarkData->GetFirstSelected(); |
31 |
+ SCTAB nFirstTab = aMarkData.GetFirstSelected(); |
32 |
SCTAB nCurTab = GetViewData().GetTabNo(); |
33 |
SCTAB nTab; |
34 |
if (bRecord && !rDoc.IsUndoEnabled()) |
35 |
@@ -1839,7 +1839,7 @@ void ScViewFunc::SetWidthOrHeight( |
36 |
ScDocShellModificator aModificator( *pDocSh ); |
37 |
|
38 |
bool bAllowed = true; |
39 |
- ScMarkData::iterator itr = pMarkData->begin(), itrEnd = pMarkData->end(); |
40 |
+ ScMarkData::iterator itr = aMarkData.begin(), itrEnd = aMarkData.end(); |
41 |
for (; itr != itrEnd && bAllowed; ++itr) |
42 |
{ |
43 |
for (size_t i = 0, n = rRanges.size(); i < n && bAllowed; ++i) |
44 |
@@ -1886,7 +1886,7 @@ void ScViewFunc::SetWidthOrHeight( |
45 |
rDoc.BeginDrawUndo(); // Drawing Updates |
46 |
|
47 |
pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); |
48 |
- itr = pMarkData->begin(); |
49 |
+ itr = aMarkData.begin(); |
50 |
for (; itr != itrEnd; ++itr) |
51 |
{ |
52 |
if (bWidth) |
53 |
@@ -1918,12 +1918,12 @@ void ScViewFunc::SetWidthOrHeight( |
54 |
} |
55 |
|
56 |
if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT ) |
57 |
- pMarkData->MarkToMulti(); |
58 |
+ aMarkData.MarkToMulti(); |
59 |
|
60 |
bool bShow = nSizeTwips > 0 || eMode != SC_SIZE_DIRECT; |
61 |
bool bOutline = false; |
62 |
|
63 |
- itr = pMarkData->begin(); |
64 |
+ itr = aMarkData.begin(); |
65 |
for (; itr != itrEnd; ++itr) |
66 |
{ |
67 |
nTab = *itr; |
68 |
@@ -2036,7 +2036,7 @@ void ScViewFunc::SetWidthOrHeight( |
69 |
{ |
70 |
pDocSh->GetUndoManager()->AddUndoAction( |
71 |
new ScUndoWidthOrHeight( |
72 |
- pDocSh, *pMarkData, nStart, nCurTab, nEnd, nCurTab, |
73 |
+ pDocSh, aMarkData, nStart, nCurTab, nEnd, nCurTab, |
74 |
pUndoDoc, aUndoRanges, pUndoTab, eMode, nSizeTwips, bWidth)); |
75 |
} |
76 |
|
77 |
@@ -2044,7 +2044,7 @@ void ScViewFunc::SetWidthOrHeight( |
78 |
// the new heights and widths. |
79 |
GetViewData().GetView()->RefreshZoom(); |
80 |
|
81 |
- itr = pMarkData->begin(); |
82 |
+ itr = aMarkData.begin(); |
83 |
for (; itr != itrEnd; ++itr) |
84 |
rDoc.UpdatePageBreaks( *itr ); |
85 |
|
86 |
@@ -2052,7 +2052,7 @@ void ScViewFunc::SetWidthOrHeight( |
87 |
|
88 |
if (bPaint) |
89 |
{ |
90 |
- itr = pMarkData->begin(); |
91 |
+ itr = aMarkData.begin(); |
92 |
for (; itr != itrEnd; ++itr) |
93 |
{ |
94 |
nTab = *itr; |
95 |
@@ -2087,7 +2087,7 @@ void ScViewFunc::SetWidthOrHeight( |
96 |
if (ScModelObj* pModelObj = HelperNotifyChanges::getMustPropagateChangesModel(*pDocSh)) |
97 |
{ |
98 |
ScRangeList aChangeRanges; |
99 |
- itr = pMarkData->begin(); |
100 |
+ itr = aMarkData.begin(); |
101 |
for (; itr != itrEnd; ++itr) |
102 |
{ |
103 |
nTab = *itr; |
104 |
-- |
105 |
2.5.0 |
106 |
|