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
04e7f3f2
Kaydet (Commit)
04e7f3f2
authored
May 28, 2011
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Revert "Extracted a method from a code block."
This reverts commit 4f46e40020699ea79d0d7254431aff27b087e4e2.
üst
eb7fe34e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
99 deletions
+87
-99
tabview2.cxx
sc/source/ui/view/tabview2.cxx
+87
-99
No files found.
sc/source/ui/view/tabview2.cxx
Dosyayı görüntüle @
04e7f3f2
...
@@ -58,102 +58,6 @@
...
@@ -58,102 +58,6 @@
namespace
{
namespace
{
/**
* Expand selection area accordingly when the current selection ends with a
* merged cell.
*/
void
expandSelectionByMergedCell
(
SCsCOL
&
rBlockStartX
,
SCsROW
&
rBlockStartY
,
SCsCOL
&
rBlockEndX
,
SCsROW
&
rBlockEndY
,
SCCOL
nCurX
,
SCROW
nCurY
,
SCTAB
nTab
,
ScDocument
*
pDoc
)
{
SCsCOL
nBlockStartXOld
=
rBlockStartX
;
SCsROW
nBlockStartYOld
=
rBlockStartY
;
SCsCOL
nCurXOffset
=
0
;
SCsCOL
nBlockStartXOffset
=
0
;
SCsROW
nCurYOffset
=
0
;
SCsROW
nBlockStartYOffset
=
0
;
bool
bBlockStartMerged
=
false
;
const
ScMergeAttr
*
pMergeAttr
=
NULL
;
// The following block checks whether or not the "BlockStart" (anchor)
// cell is merged. If it's merged, it'll then move the position of the
// anchor cell to the corner that's diagonally opposite of the
// direction of a current selection area. For instance, if a current
// selection is moving in the upperleft direction, the anchor cell will
// move to the lower-right corner of the merged anchor cell, and so on.
pMergeAttr
=
static_cast
<
const
ScMergeAttr
*>
(
pDoc
->
GetAttr
(
rBlockStartX
,
rBlockStartY
,
nTab
,
ATTR_MERGE
));
if
(
pMergeAttr
->
IsMerged
())
{
SCsCOL
nColSpan
=
pMergeAttr
->
GetColMerge
();
SCsROW
nRowSpan
=
pMergeAttr
->
GetRowMerge
();
if
(
!
(
nCurX
>=
nBlockStartXOld
+
nColSpan
-
1
&&
nCurY
>=
nBlockStartYOld
+
nRowSpan
-
1
)
)
{
rBlockStartX
=
nCurX
>=
nBlockStartXOld
?
nBlockStartXOld
:
nBlockStartXOld
+
nColSpan
-
1
;
rBlockStartY
=
nCurY
>=
nBlockStartYOld
?
nBlockStartYOld
:
nBlockStartYOld
+
nRowSpan
-
1
;
nCurXOffset
=
nCurX
>=
nBlockStartXOld
&&
nCurX
<
nBlockStartXOld
+
nColSpan
-
1
?
nBlockStartXOld
-
nCurX
+
nColSpan
-
1
:
0
;
nCurYOffset
=
nCurY
>=
nBlockStartYOld
&&
nCurY
<
nBlockStartYOld
+
nRowSpan
-
1
?
nBlockStartYOld
-
nCurY
+
nRowSpan
-
1
:
0
;
bBlockStartMerged
=
true
;
}
}
// The following block checks whether or not the current cell is
// merged. If it is, it'll then set the appropriate X & Y offset
// values (nCurXOffset & nCurYOffset) such that the selection area will
// grow by those specified offset amounts. Note that the values of
// nCurXOffset/nCurYOffset may also be specified in the previous code
// block, in which case whichever value is greater will take on.
pMergeAttr
=
static_cast
<
const
ScMergeAttr
*>
(
pDoc
->
GetAttr
(
nCurX
,
nCurY
,
nTab
,
ATTR_MERGE
));
if
(
pMergeAttr
->
IsMerged
()
)
{
SCsCOL
nColSpan
=
pMergeAttr
->
GetColMerge
();
SCsROW
nRowSpan
=
pMergeAttr
->
GetRowMerge
();
if
(
!
(
rBlockStartX
>=
nCurX
+
nColSpan
-
1
&&
rBlockStartY
>=
nCurY
+
nRowSpan
-
1
)
)
{
if
(
rBlockStartX
<=
nCurX
+
nColSpan
-
1
)
{
SCsCOL
nCurXOffsetTemp
=
nCurX
<
nCurX
+
nColSpan
-
1
?
nColSpan
-
1
:
0
;
nCurXOffset
=
nCurXOffset
>
nCurXOffsetTemp
?
nCurXOffset
:
nCurXOffsetTemp
;
}
if
(
rBlockStartY
<=
nCurY
+
nRowSpan
-
1
)
{
SCsROW
nCurYOffsetTemp
=
nCurY
<
nCurY
+
nRowSpan
-
1
?
nRowSpan
-
1
:
0
;
nCurYOffset
=
nCurYOffset
>
nCurYOffsetTemp
?
nCurYOffset
:
nCurYOffsetTemp
;
}
if
(
!
(
rBlockStartX
<=
nCurX
&&
rBlockStartY
<=
nCurY
)
&&
!
(
rBlockStartX
>
nCurX
+
nColSpan
-
1
&&
rBlockStartY
>
nCurY
+
nRowSpan
-
1
)
)
{
nBlockStartXOffset
=
rBlockStartX
>
nCurX
&&
rBlockStartX
<=
nCurX
+
nColSpan
-
1
?
nCurX
-
rBlockStartX
:
0
;
nBlockStartYOffset
=
rBlockStartY
>
nCurY
&&
rBlockStartY
<=
nCurY
+
nRowSpan
-
1
?
nCurY
-
rBlockStartY
:
0
;
}
}
}
else
{
// The current cell is not merged. Move the anchor cell to its
// original position.
if
(
!
bBlockStartMerged
)
{
rBlockStartX
=
nBlockStartXOld
;
rBlockStartY
=
nBlockStartYOld
;
}
}
rBlockStartX
=
rBlockStartX
+
nBlockStartXOffset
>=
0
?
rBlockStartX
+
nBlockStartXOffset
:
0
;
rBlockStartY
=
rBlockStartY
+
nBlockStartYOffset
>=
0
?
rBlockStartY
+
nBlockStartYOffset
:
0
;
rBlockEndX
=
nCurX
+
nCurXOffset
>
MAXCOL
?
MAXCOL
:
nCurX
+
nCurXOffset
;
rBlockEndY
=
nCurY
+
nCurYOffset
>
MAXROW
?
MAXROW
:
nCurY
+
nCurYOffset
;
}
bool
isCellQualified
(
ScDocument
*
pDoc
,
SCCOL
nCol
,
SCROW
nRow
,
SCTAB
nTab
,
bool
bSelectLocked
,
bool
bSelectUnlocked
)
bool
isCellQualified
(
ScDocument
*
pDoc
,
SCCOL
nCol
,
SCROW
nRow
,
SCTAB
nTab
,
bool
bSelectLocked
,
bool
bSelectUnlocked
)
{
{
bool
bCellProtected
=
pDoc
->
HasAttrib
(
bool
bCellProtected
=
pDoc
->
HasAttrib
(
...
@@ -572,9 +476,93 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
...
@@ -572,9 +476,93 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
if
(
bCellSelection
)
if
(
bCellSelection
)
{
{
expandSelectionByMergedCell
(
// Expand selection area accordingly when the current selection ends
nBlockStartX
,
nBlockStartY
,
nBlockEndX
,
nBlockEndY
,
// with a merged cell.
nCurX
,
nCurY
,
nTab
,
aViewData
.
GetDocument
());
SCsCOL
nBlockStartXOld
=
nBlockStartX
;
SCsROW
nBlockStartYOld
=
nBlockStartY
;
SCsCOL
nCurXOffset
=
0
;
SCsCOL
nBlockStartXOffset
=
0
;
SCsROW
nCurYOffset
=
0
;
SCsROW
nBlockStartYOffset
=
0
;
bool
bBlockStartMerged
=
false
;
const
ScMergeAttr
*
pMergeAttr
=
NULL
;
ScDocument
*
pDocument
=
aViewData
.
GetDocument
();
// The following block checks whether or not the "BlockStart" (anchor)
// cell is merged. If it's merged, it'll then move the position of the
// anchor cell to the corner that's diagonally opposite of the
// direction of a current selection area. For instance, if a current
// selection is moving in the upperleft direction, the anchor cell will
// move to the lower-right corner of the merged anchor cell, and so on.
pMergeAttr
=
static_cast
<
const
ScMergeAttr
*>
(
pDocument
->
GetAttr
(
nBlockStartX
,
nBlockStartY
,
nTab
,
ATTR_MERGE
)
);
if
(
pMergeAttr
->
IsMerged
()
)
{
SCsCOL
nColSpan
=
pMergeAttr
->
GetColMerge
();
SCsROW
nRowSpan
=
pMergeAttr
->
GetRowMerge
();
if
(
!
(
nCurX
>=
nBlockStartXOld
+
nColSpan
-
1
&&
nCurY
>=
nBlockStartYOld
+
nRowSpan
-
1
)
)
{
nBlockStartX
=
nCurX
>=
nBlockStartXOld
?
nBlockStartXOld
:
nBlockStartXOld
+
nColSpan
-
1
;
nBlockStartY
=
nCurY
>=
nBlockStartYOld
?
nBlockStartYOld
:
nBlockStartYOld
+
nRowSpan
-
1
;
nCurXOffset
=
nCurX
>=
nBlockStartXOld
&&
nCurX
<
nBlockStartXOld
+
nColSpan
-
1
?
nBlockStartXOld
-
nCurX
+
nColSpan
-
1
:
0
;
nCurYOffset
=
nCurY
>=
nBlockStartYOld
&&
nCurY
<
nBlockStartYOld
+
nRowSpan
-
1
?
nBlockStartYOld
-
nCurY
+
nRowSpan
-
1
:
0
;
bBlockStartMerged
=
sal_True
;
}
}
// The following block checks whether or not the current cell is
// merged. If it is, it'll then set the appropriate X & Y offset
// values (nCurXOffset & nCurYOffset) such that the selection area will
// grow by those specified offset amounts. Note that the values of
// nCurXOffset/nCurYOffset may also be specified in the previous code
// block, in which case whichever value is greater will take on.
pMergeAttr
=
static_cast
<
const
ScMergeAttr
*>
(
pDocument
->
GetAttr
(
nCurX
,
nCurY
,
nTab
,
ATTR_MERGE
)
);
if
(
pMergeAttr
->
IsMerged
()
)
{
SCsCOL
nColSpan
=
pMergeAttr
->
GetColMerge
();
SCsROW
nRowSpan
=
pMergeAttr
->
GetRowMerge
();
if
(
!
(
nBlockStartX
>=
nCurX
+
nColSpan
-
1
&&
nBlockStartY
>=
nCurY
+
nRowSpan
-
1
)
)
{
if
(
nBlockStartX
<=
nCurX
+
nColSpan
-
1
)
{
SCsCOL
nCurXOffsetTemp
=
nCurX
<
nCurX
+
nColSpan
-
1
?
nColSpan
-
1
:
0
;
nCurXOffset
=
nCurXOffset
>
nCurXOffsetTemp
?
nCurXOffset
:
nCurXOffsetTemp
;
}
if
(
nBlockStartY
<=
nCurY
+
nRowSpan
-
1
)
{
SCsROW
nCurYOffsetTemp
=
nCurY
<
nCurY
+
nRowSpan
-
1
?
nRowSpan
-
1
:
0
;
nCurYOffset
=
nCurYOffset
>
nCurYOffsetTemp
?
nCurYOffset
:
nCurYOffsetTemp
;
}
if
(
!
(
nBlockStartX
<=
nCurX
&&
nBlockStartY
<=
nCurY
)
&&
!
(
nBlockStartX
>
nCurX
+
nColSpan
-
1
&&
nBlockStartY
>
nCurY
+
nRowSpan
-
1
)
)
{
nBlockStartXOffset
=
nBlockStartX
>
nCurX
&&
nBlockStartX
<=
nCurX
+
nColSpan
-
1
?
nCurX
-
nBlockStartX
:
0
;
nBlockStartYOffset
=
nBlockStartY
>
nCurY
&&
nBlockStartY
<=
nCurY
+
nRowSpan
-
1
?
nCurY
-
nBlockStartY
:
0
;
}
}
}
else
{
// The current cell is not merged. Move the anchor cell to its
// original position.
if
(
!
bBlockStartMerged
)
{
nBlockStartX
=
nBlockStartXOld
;
nBlockStartY
=
nBlockStartYOld
;
}
}
nBlockStartX
=
nBlockStartX
+
nBlockStartXOffset
>=
0
?
nBlockStartX
+
nBlockStartXOffset
:
0
;
nBlockStartY
=
nBlockStartY
+
nBlockStartYOffset
>=
0
?
nBlockStartY
+
nBlockStartYOffset
:
0
;
nBlockEndX
=
nCurX
+
nCurXOffset
>
MAXCOL
?
MAXCOL
:
nCurX
+
nCurXOffset
;
nBlockEndY
=
nCurY
+
nCurYOffset
>
MAXROW
?
MAXROW
:
nCurY
+
nCurYOffset
;
}
}
else
else
{
{
...
...
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