Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
50c70948
Kaydet (Commit)
50c70948
authored
Tem 19, 2013
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Handle range reference expansion on insertion.
Change-Id: I128ed26b6d6319a7e227885801e0683b517eb439
üst
cbd61576
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
21 deletions
+97
-21
refupdatecontext.hxx
sc/inc/refupdatecontext.hxx
+2
-1
documen3.cxx
sc/source/core/data/documen3.cxx
+1
-1
refupdatecontext.cxx
sc/source/core/data/refupdatecontext.cxx
+7
-2
token.cxx
sc/source/core/tool/token.cxx
+87
-17
No files found.
sc/inc/refupdatecontext.hxx
Dosyayı görüntüle @
50c70948
...
...
@@ -40,7 +40,8 @@ struct RefUpdateContext
RefUpdateContext
();
bool
hasDelta
()
const
;
bool
isInserted
()
const
;
bool
isDeleted
()
const
;
};
struct
RefUpdateResult
...
...
sc/source/core/data/documen3.cxx
Dosyayı görüntüle @
50c70948
...
...
@@ -981,7 +981,7 @@ void ScDocument::UpdateReference(
return
;
boost
::
scoped_ptr
<
sc
::
ExpandRefsSwitch
>
pExpandRefsSwitch
;
if
(
rCxt
.
meMode
==
URM_INSDEL
&&
rCxt
.
hasDelta
())
if
(
rCxt
.
isInserted
())
pExpandRefsSwitch
.
reset
(
new
sc
::
ExpandRefsSwitch
(
*
this
,
SC_MOD
()
->
GetInputOptions
().
GetExpandRefs
()));
size_t
nFirstTab
,
nLastTab
;
...
...
sc/source/core/data/refupdatecontext.cxx
Dosyayı görüntüle @
50c70948
...
...
@@ -14,9 +14,14 @@ namespace sc {
RefUpdateContext
::
RefUpdateContext
()
:
meMode
(
URM_INSDEL
),
mnColDelta
(
0
),
mnRowDelta
(
0
),
mnTabDelta
(
0
)
{}
bool
RefUpdateContext
::
hasDelta
()
const
bool
RefUpdateContext
::
isInserted
()
const
{
return
(
mnColDelta
>
0
||
mnRowDelta
>
0
||
mnTabDelta
>
0
);
return
(
meMode
==
URM_INSDEL
)
&&
(
mnColDelta
>
0
||
mnRowDelta
>
0
||
mnTabDelta
>
0
);
}
bool
RefUpdateContext
::
isDeleted
()
const
{
return
(
meMode
==
URM_INSDEL
)
&&
(
mnColDelta
<
0
||
mnRowDelta
<
0
||
mnTabDelta
<
0
);
}
RefUpdateResult
::
RefUpdateResult
()
:
mbValueChanged
(
false
),
mbRangeSizeModified
(
false
)
{}
...
...
sc/source/core/tool/token.cxx
Dosyayı görüntüle @
50c70948
...
...
@@ -2195,28 +2195,45 @@ void ScTokenArray::AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddres
namespace
{
ScRange
get
Dele
tedRange
(
const
sc
::
RefUpdateContext
&
rCxt
)
ScRange
get
Selec
tedRange
(
const
sc
::
RefUpdateContext
&
rCxt
)
{
ScRange
a
Dele
tedRange
(
ScAddress
::
INITIALIZE_INVALID
);
ScRange
a
Selec
tedRange
(
ScAddress
::
INITIALIZE_INVALID
);
if
(
rCxt
.
mnColDelta
<
0
)
{
// Delete and shift to left.
a
Dele
tedRange
.
aStart
=
ScAddress
(
rCxt
.
maRange
.
aStart
.
Col
()
+
rCxt
.
mnColDelta
,
rCxt
.
maRange
.
aStart
.
Row
(),
rCxt
.
maRange
.
aStart
.
Tab
());
a
Dele
tedRange
.
aEnd
=
ScAddress
(
rCxt
.
maRange
.
aStart
.
Col
()
-
1
,
rCxt
.
maRange
.
aEnd
.
Row
(),
rCxt
.
maRange
.
aEnd
.
Tab
());
a
Selec
tedRange
.
aStart
=
ScAddress
(
rCxt
.
maRange
.
aStart
.
Col
()
+
rCxt
.
mnColDelta
,
rCxt
.
maRange
.
aStart
.
Row
(),
rCxt
.
maRange
.
aStart
.
Tab
());
a
Selec
tedRange
.
aEnd
=
ScAddress
(
rCxt
.
maRange
.
aStart
.
Col
()
-
1
,
rCxt
.
maRange
.
aEnd
.
Row
(),
rCxt
.
maRange
.
aEnd
.
Tab
());
}
else
if
(
rCxt
.
mnRowDelta
<
0
)
{
// Delete and shift up.
a
Dele
tedRange
.
aStart
=
ScAddress
(
rCxt
.
maRange
.
aStart
.
Col
(),
rCxt
.
maRange
.
aStart
.
Row
()
+
rCxt
.
mnRowDelta
,
rCxt
.
maRange
.
aStart
.
Tab
());
a
Dele
tedRange
.
aEnd
=
ScAddress
(
rCxt
.
maRange
.
aEnd
.
Col
(),
rCxt
.
maRange
.
aStart
.
Row
()
-
1
,
rCxt
.
maRange
.
aEnd
.
Tab
());
a
Selec
tedRange
.
aStart
=
ScAddress
(
rCxt
.
maRange
.
aStart
.
Col
(),
rCxt
.
maRange
.
aStart
.
Row
()
+
rCxt
.
mnRowDelta
,
rCxt
.
maRange
.
aStart
.
Tab
());
a
Selec
tedRange
.
aEnd
=
ScAddress
(
rCxt
.
maRange
.
aEnd
.
Col
(),
rCxt
.
maRange
.
aStart
.
Row
()
-
1
,
rCxt
.
maRange
.
aEnd
.
Tab
());
}
else
if
(
rCxt
.
mnTabDelta
<
0
)
{
// Deleting sheets.
// TODO : Figure out what to do here.
}
else
if
(
rCxt
.
mnColDelta
>
0
)
{
// Insert and shift to the right.
aSelectedRange
.
aStart
=
rCxt
.
maRange
.
aStart
;
aSelectedRange
.
aEnd
=
ScAddress
(
rCxt
.
maRange
.
aStart
.
Col
()
+
rCxt
.
mnColDelta
-
1
,
rCxt
.
maRange
.
aEnd
.
Row
(),
rCxt
.
maRange
.
aEnd
.
Tab
());
}
else
if
(
rCxt
.
mnRowDelta
>
0
)
{
// Insert and shift down.
aSelectedRange
.
aStart
=
rCxt
.
maRange
.
aStart
;
aSelectedRange
.
aEnd
=
ScAddress
(
rCxt
.
maRange
.
aEnd
.
Col
(),
rCxt
.
maRange
.
aStart
.
Row
()
+
rCxt
.
mnRowDelta
-
1
,
rCxt
.
maRange
.
aEnd
.
Tab
());
}
else
if
(
rCxt
.
mnTabDelta
>
0
)
{
// Inserting sheets.
// TODO : Figure out what to do here.
}
return
a
Dele
tedRange
;
return
a
Selec
tedRange
;
}
void
setRefDeleted
(
ScSingleRefData
&
rRef
,
const
sc
::
RefUpdateContext
&
rCxt
)
...
...
@@ -2279,11 +2296,48 @@ bool shrinkRange( const sc::RefUpdateContext& rCxt, ScRange& rRefRange, const Sc
return
false
;
}
bool
expandRange
(
const
sc
::
RefUpdateContext
&
rCxt
,
ScRange
&
rRefRange
,
const
ScRange
&
rInsertedRange
)
{
if
(
rCxt
.
mnColDelta
>
0
)
{
// Insert and shifting right.
if
(
rRefRange
.
aStart
.
Row
()
<
rInsertedRange
.
aStart
.
Row
()
||
rInsertedRange
.
aEnd
.
Row
()
<
rRefRange
.
aEnd
.
Row
())
// Inserted range is only partially overlapping in vertical direction. Bail out.
return
false
;
if
(
rInsertedRange
.
aStart
.
Col
()
==
rRefRange
.
aStart
.
Col
())
// Inserted range is at the left end. No expansion.
return
false
;
// Move the last column position to the right.
SCCOL
nDelta
=
rInsertedRange
.
aEnd
.
Col
()
-
rInsertedRange
.
aStart
.
Col
()
+
1
;
rRefRange
.
aEnd
.
IncCol
(
nDelta
);
return
true
;
}
else
if
(
rCxt
.
mnRowDelta
>
0
)
{
// Insert and shifting down.
if
(
rRefRange
.
aStart
.
Col
()
<
rInsertedRange
.
aStart
.
Col
()
||
rInsertedRange
.
aEnd
.
Col
()
<
rRefRange
.
aEnd
.
Col
())
// Inserted range is only partially overlapping in horizontal direction. Bail out.
return
false
;
if
(
rInsertedRange
.
aStart
.
Row
()
==
rRefRange
.
aStart
.
Row
())
// Inserted range is at the top end. No expansion.
return
false
;
// Move the last row position down.
SCROW
nDelta
=
rInsertedRange
.
aEnd
.
Row
()
-
rInsertedRange
.
aStart
.
Row
()
+
1
;
rRefRange
.
aEnd
.
IncRow
(
nDelta
);
return
true
;
}
return
false
;
}
}
sc
::
RefUpdateResult
ScTokenArray
::
AdjustReferenceOnShift
(
const
sc
::
RefUpdateContext
&
rCxt
,
const
ScAddress
&
rOldPos
)
{
ScRange
a
DeletedRange
=
getDele
tedRange
(
rCxt
);
ScRange
a
SelectedRange
=
getSelec
tedRange
(
rCxt
);
sc
::
RefUpdateResult
aRes
;
ScAddress
aNewPos
=
rOldPos
;
...
...
@@ -2303,7 +2357,7 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
ScSingleRefData
&
rRef
=
pToken
->
GetSingleRef
();
ScAddress
aAbs
=
rRef
.
toAbs
(
rOldPos
);
if
(
aDele
tedRange
.
In
(
aAbs
))
if
(
rCxt
.
isDeleted
()
&&
aSelec
tedRange
.
In
(
aAbs
))
{
// This reference is in the deleted region.
setRefDeleted
(
rRef
,
rCxt
);
...
...
@@ -2322,20 +2376,36 @@ sc::RefUpdateResult ScTokenArray::AdjustReferenceOnShift( const sc::RefUpdateCon
ScComplexRefData
&
rRef
=
pToken
->
GetDoubleRef
();
ScRange
aAbs
=
rRef
.
toAbs
(
rOldPos
);
if
(
aDeletedRange
.
In
(
aAbs
))
if
(
rCxt
.
isDeleted
(
))
{
// This reference is in the deleted region.
setRefDeleted
(
rRef
,
rCxt
);
aRes
.
mbValueChanged
=
true
;
break
;
if
(
aSelectedRange
.
In
(
aAbs
))
{
// This reference is in the deleted region.
setRefDeleted
(
rRef
,
rCxt
);
aRes
.
mbValueChanged
=
true
;
break
;
}
else
if
(
aSelectedRange
.
Intersects
(
aAbs
))
{
if
(
shrinkRange
(
rCxt
,
aAbs
,
aSelectedRange
))
{
// The reference range has been shrunk.
rRef
.
SetRange
(
aAbs
,
aNewPos
);
aRes
.
mbValueChanged
=
true
;
aRes
.
mbRangeSizeModified
=
true
;
break
;
}
}
}
else
if
(
aDeletedRange
.
Intersects
(
aAbs
))
if
(
rCxt
.
isInserted
()
&&
aSelectedRange
.
Intersects
(
aAbs
))
{
if
(
shrinkRange
(
rCxt
,
aAbs
,
aDele
tedRange
))
if
(
expandRange
(
rCxt
,
aAbs
,
aSelec
tedRange
))
{
// The reference range has been
shrunk
.
// The reference range has been
expanded
.
rRef
.
SetRange
(
aAbs
,
aNewPos
);
aRes
.
mbValueChanged
=
true
;
aRes
.
mbRangeSizeModified
=
true
;
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment