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
04ee80c1
Kaydet (Commit)
04ee80c1
authored
Eyl 26, 2014
tarafından
Kohei Yoshida
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Store height array to RowHeightContext and reduce function arg counts.
Change-Id: I09b79bc76ffc55e25c24bbfa8f000f4a46df0a1c
üst
48f2cc5a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
34 deletions
+45
-34
column.hxx
sc/inc/column.hxx
+1
-2
rowheightcontext.hxx
sc/inc/rowheightcontext.hxx
+6
-0
column2.cxx
sc/source/core/data/column2.cxx
+12
-12
rowheightcontext.cxx
sc/source/core/data/rowheightcontext.cxx
+5
-0
table1.cxx
sc/source/core/data/table1.cxx
+21
-20
No files found.
sc/inc/column.hxx
Dosyayı görüntüle @
04ee80c1
...
@@ -465,8 +465,7 @@ public:
...
@@ -465,8 +465,7 @@ public:
bool
bFormula
,
sal_uInt16
nOldWidth
,
const
ScMarkData
*
pMarkData
,
const
ScColWidthParam
*
pParam
)
const
;
bool
bFormula
,
sal_uInt16
nOldWidth
,
const
ScMarkData
*
pMarkData
,
const
ScColWidthParam
*
pParam
)
const
;
void
GetOptimalHeight
(
void
GetOptimalHeight
(
sc
::
RowHeightContext
&
rCxt
,
SCROW
nStartRow
,
SCROW
nEndRow
,
sal_uInt16
*
pHeight
,
sc
::
RowHeightContext
&
rCxt
,
SCROW
nStartRow
,
SCROW
nEndRow
,
sal_uInt16
nMinHeight
,
SCROW
nMinStart
);
sal_uInt16
nMinHeight
,
SCROW
nMinStart
);
/// Including current, may return -1
/// Including current, may return -1
SCsROW
GetNextUnprotected
(
SCROW
nRow
,
bool
bUp
)
const
;
SCsROW
GetNextUnprotected
(
SCROW
nRow
,
bool
bUp
)
const
;
...
...
sc/inc/rowheightcontext.hxx
Dosyayı görüntüle @
04ee80c1
...
@@ -14,12 +14,16 @@
...
@@ -14,12 +14,16 @@
#include <tools/rational.hxx>
#include <tools/rational.hxx>
#include <vector>
class
OutputDevice
;
class
OutputDevice
;
namespace
sc
{
namespace
sc
{
class
SC_DLLPUBLIC
RowHeightContext
class
SC_DLLPUBLIC
RowHeightContext
{
{
std
::
vector
<
sal_uInt16
>
maHeights
;
double
mfPPTX
;
double
mfPPTX
;
double
mfPPTY
;
double
mfPPTY
;
boost
::
rational
<
sal_Int64
>
maZoomX
;
boost
::
rational
<
sal_Int64
>
maZoomX
;
...
@@ -48,6 +52,8 @@ public:
...
@@ -48,6 +52,8 @@ public:
void
setForceAutoSize
(
bool
b
);
void
setForceAutoSize
(
bool
b
);
bool
isForceAutoSize
()
const
{
return
mbForceAutoSize
;}
bool
isForceAutoSize
()
const
{
return
mbForceAutoSize
;}
std
::
vector
<
sal_uInt16
>&
getHeightArray
();
};
};
}
}
...
...
sc/source/core/data/column2.cxx
Dosyayı görüntüle @
04ee80c1
...
@@ -772,9 +772,9 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16
...
@@ -772,9 +772,9 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16
// (is only evaluated with bStdAllowed)
// (is only evaluated with bStdAllowed)
void
ScColumn
::
GetOptimalHeight
(
void
ScColumn
::
GetOptimalHeight
(
sc
::
RowHeightContext
&
rCxt
,
SCROW
nStartRow
,
SCROW
nEndRow
,
sal_uInt16
*
pHeight
,
sc
::
RowHeightContext
&
rCxt
,
SCROW
nStartRow
,
SCROW
nEndRow
,
sal_uInt16
nMinHeight
,
SCROW
nMinStart
)
sal_uInt16
nMinHeight
,
SCROW
nMinStart
)
{
{
std
::
vector
<
sal_uInt16
>&
rHeights
=
rCxt
.
getHeightArray
();
ScAttrIterator
aIter
(
pAttrArray
,
nStartRow
,
nEndRow
);
ScAttrIterator
aIter
(
pAttrArray
,
nStartRow
,
nEndRow
);
SCROW
nStart
=
-
1
;
SCROW
nStart
=
-
1
;
...
@@ -865,8 +865,8 @@ void ScColumn::GetOptimalHeight(
...
@@ -865,8 +865,8 @@ void ScColumn::GetOptimalHeight(
nStdEnd
=
(
nMinStart
>
0
)
?
nMinStart
-
1
:
0
;
nStdEnd
=
(
nMinStart
>
0
)
?
nMinStart
-
1
:
0
;
for
(
SCROW
nRow
=
nStart
;
nRow
<=
nStdEnd
;
++
nRow
)
for
(
SCROW
nRow
=
nStart
;
nRow
<=
nStdEnd
;
++
nRow
)
if
(
nDefHeight
>
pHeight
[
nRow
-
nStartRow
])
if
(
nDefHeight
>
rHeights
[
nRow
-
nStartRow
])
pHeight
[
nRow
-
nStartRow
]
=
nDefHeight
;
rHeights
[
nRow
-
nStartRow
]
=
nDefHeight
;
if
(
bStdOnly
)
if
(
bStdOnly
)
{
{
...
@@ -887,22 +887,22 @@ void ScColumn::GetOptimalHeight(
...
@@ -887,22 +887,22 @@ void ScColumn::GetOptimalHeight(
{
{
if
(
nCjkHeight
==
0
)
if
(
nCjkHeight
==
0
)
nCjkHeight
=
lcl_GetAttribHeight
(
*
pPattern
,
ATTR_CJK_FONT_HEIGHT
);
nCjkHeight
=
lcl_GetAttribHeight
(
*
pPattern
,
ATTR_CJK_FONT_HEIGHT
);
if
(
nCjkHeight
>
pHeight
[
nRow
-
nStartRow
])
if
(
nCjkHeight
>
rHeights
[
nRow
-
nStartRow
])
pHeight
[
nRow
-
nStartRow
]
=
nCjkHeight
;
rHeights
[
nRow
-
nStartRow
]
=
nCjkHeight
;
}
}
else
if
(
nScript
==
SCRIPTTYPE_COMPLEX
)
else
if
(
nScript
==
SCRIPTTYPE_COMPLEX
)
{
{
if
(
nCtlHeight
==
0
)
if
(
nCtlHeight
==
0
)
nCtlHeight
=
lcl_GetAttribHeight
(
*
pPattern
,
ATTR_CTL_FONT_HEIGHT
);
nCtlHeight
=
lcl_GetAttribHeight
(
*
pPattern
,
ATTR_CTL_FONT_HEIGHT
);
if
(
nCtlHeight
>
pHeight
[
nRow
-
nStartRow
])
if
(
nCtlHeight
>
rHeights
[
nRow
-
nStartRow
])
pHeight
[
nRow
-
nStartRow
]
=
nCtlHeight
;
rHeights
[
nRow
-
nStartRow
]
=
nCtlHeight
;
}
}
else
else
{
{
if
(
nLatHeight
==
0
)
if
(
nLatHeight
==
0
)
nLatHeight
=
lcl_GetAttribHeight
(
*
pPattern
,
ATTR_FONT_HEIGHT
);
nLatHeight
=
lcl_GetAttribHeight
(
*
pPattern
,
ATTR_FONT_HEIGHT
);
if
(
nLatHeight
>
pHeight
[
nRow
-
nStartRow
])
if
(
nLatHeight
>
rHeights
[
nRow
-
nStartRow
])
pHeight
[
nRow
-
nStartRow
]
=
nLatHeight
;
rHeights
[
nRow
-
nStartRow
]
=
nLatHeight
;
}
}
}
}
}
}
...
@@ -928,8 +928,8 @@ void ScColumn::GetOptimalHeight(
...
@@ -928,8 +928,8 @@ void ScColumn::GetOptimalHeight(
(
GetNeededSize
(
nRow
,
rCxt
.
getOutputDevice
(),
rCxt
.
getPPTX
(),
rCxt
.
getPPTY
(),
(
GetNeededSize
(
nRow
,
rCxt
.
getOutputDevice
(),
rCxt
.
getPPTX
(),
rCxt
.
getPPTY
(),
rCxt
.
getZoomX
(),
rCxt
.
getZoomY
(),
false
,
aOptions
,
rCxt
.
getZoomX
(),
rCxt
.
getZoomY
(),
false
,
aOptions
,
&
pPattern
)
/
rCxt
.
getPPTY
()
);
&
pPattern
)
/
rCxt
.
getPPTY
()
);
if
(
nHeight
>
pHeight
[
nRow
-
nStartRow
])
if
(
nHeight
>
rHeights
[
nRow
-
nStartRow
])
pHeight
[
nRow
-
nStartRow
]
=
nHeight
;
rHeights
[
nRow
-
nStartRow
]
=
nHeight
;
// Pattern changed due to calculation? => sync.
// Pattern changed due to calculation? => sync.
if
(
pPattern
!=
pOldPattern
)
if
(
pPattern
!=
pOldPattern
)
{
{
...
...
sc/source/core/data/rowheightcontext.cxx
Dosyayı görüntüle @
04ee80c1
...
@@ -32,6 +32,11 @@ void RowHeightContext::setForceAutoSize( bool b )
...
@@ -32,6 +32,11 @@ void RowHeightContext::setForceAutoSize( bool b )
mbForceAutoSize
=
b
;
mbForceAutoSize
=
b
;
}
}
std
::
vector
<
sal_uInt16
>&
RowHeightContext
::
getHeightArray
()
{
return
maHeights
;
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sc/source/core/data/table1.cxx
Dosyayı görüntüle @
04ee80c1
...
@@ -82,7 +82,7 @@ ScProgress* GetProgressBar(
...
@@ -82,7 +82,7 @@ ScProgress* GetProgressBar(
void
GetOptimalHeightsInColumn
(
void
GetOptimalHeightsInColumn
(
sc
::
RowHeightContext
&
rCxt
,
ScColumn
*
pCol
,
SCROW
nStartRow
,
SCROW
nEndRow
,
sc
::
RowHeightContext
&
rCxt
,
ScColumn
*
pCol
,
SCROW
nStartRow
,
SCROW
nEndRow
,
vector
<
sal_uInt16
>&
aHeights
,
ScProgress
*
pProgress
,
sal_uInt32
nProgressStart
)
ScProgress
*
pProgress
,
sal_uInt32
nProgressStart
)
{
{
SCSIZE
nCount
=
static_cast
<
SCSIZE
>
(
nEndRow
-
nStartRow
+
1
);
SCSIZE
nCount
=
static_cast
<
SCSIZE
>
(
nEndRow
-
nStartRow
+
1
);
...
@@ -90,20 +90,22 @@ void GetOptimalHeightsInColumn(
...
@@ -90,20 +90,22 @@ void GetOptimalHeightsInColumn(
// (mit der letzten Spalte in der Hoffnung, dass die am ehesten noch auf
// (mit der letzten Spalte in der Hoffnung, dass die am ehesten noch auf
// Standard formatiert ist)
// Standard formatiert ist)
pCol
[
MAXCOL
].
GetOptimalHeight
(
rCxt
,
nStartRow
,
nEndRow
,
&
aHeights
[
0
],
0
,
0
);
std
::
vector
<
sal_uInt16
>&
rHeights
=
rCxt
.
getHeightArray
();
pCol
[
MAXCOL
].
GetOptimalHeight
(
rCxt
,
nStartRow
,
nEndRow
,
0
,
0
);
// daraus Standardhoehe suchen, die im unteren Bereich gilt
// daraus Standardhoehe suchen, die im unteren Bereich gilt
sal_uInt16
nMinHeight
=
a
Heights
[
nCount
-
1
];
sal_uInt16
nMinHeight
=
r
Heights
[
nCount
-
1
];
SCSIZE
nPos
=
nCount
-
1
;
SCSIZE
nPos
=
nCount
-
1
;
while
(
nPos
&&
a
Heights
[
nPos
-
1
]
>=
nMinHeight
)
while
(
nPos
&&
r
Heights
[
nPos
-
1
]
>=
nMinHeight
)
--
nPos
;
--
nPos
;
SCROW
nMinStart
=
nStartRow
+
nPos
;
SCROW
nMinStart
=
nStartRow
+
nPos
;
sal_uLong
nWeightedCount
=
0
;
sal_uLong
nWeightedCount
=
0
;
for
(
SCCOL
nCol
=
0
;
nCol
<
MAXCOL
;
nCol
++
)
// MAXCOL schon oben
for
(
SCCOL
nCol
=
0
;
nCol
<
MAXCOL
;
nCol
++
)
// MAXCOL schon oben
{
{
pCol
[
nCol
].
GetOptimalHeight
(
rCxt
,
nStartRow
,
nEndRow
,
&
aHeights
[
0
],
nMinHeight
,
nMinStart
);
pCol
[
nCol
].
GetOptimalHeight
(
rCxt
,
nStartRow
,
nEndRow
,
nMinHeight
,
nMinStart
);
if
(
pProgress
)
if
(
pProgress
)
{
{
...
@@ -155,9 +157,10 @@ struct SetRowHeightRangeFunc : public OptimalHeightsFuncObjBase
...
@@ -155,9 +157,10 @@ struct SetRowHeightRangeFunc : public OptimalHeightsFuncObjBase
}
}
};
};
bool
SetOptimalHeightsToRows
(
OptimalHeightsFuncObjBase
&
rFuncObj
,
bool
SetOptimalHeightsToRows
(
ScBitMaskCompressedArray
<
SCROW
,
sal_uInt8
>*
pRowFlags
,
SCROW
nStartRow
,
SCROW
nEndRow
,
sal_uInt16
nExtra
,
sc
::
RowHeightContext
&
rCxt
,
const
vector
<
sal_uInt16
>&
aHeights
,
bool
bForce
)
OptimalHeightsFuncObjBase
&
rFuncObj
,
ScBitMaskCompressedArray
<
SCROW
,
sal_uInt8
>*
pRowFlags
,
SCROW
nStartRow
,
SCROW
nEndRow
)
{
{
SCSIZE
nCount
=
static_cast
<
SCSIZE
>
(
nEndRow
-
nStartRow
+
1
);
SCSIZE
nCount
=
static_cast
<
SCSIZE
>
(
nEndRow
-
nStartRow
+
1
);
bool
bChanged
=
false
;
bool
bChanged
=
false
;
...
@@ -174,9 +177,9 @@ bool SetOptimalHeightsToRows(OptimalHeightsFuncObjBase& rFuncObj,
...
@@ -174,9 +177,9 @@ bool SetOptimalHeightsToRows(OptimalHeightsFuncObjBase& rFuncObj,
SCSIZE
nMoreRows
=
nRegionEndRow
-
(
nStartRow
+
i
);
// additional equal rows after first
SCSIZE
nMoreRows
=
nRegionEndRow
-
(
nStartRow
+
i
);
// additional equal rows after first
bool
bAutoSize
=
((
nRowFlag
&
CR_MANUALSIZE
)
==
0
);
bool
bAutoSize
=
((
nRowFlag
&
CR_MANUALSIZE
)
==
0
);
if
(
bAutoSize
||
bForce
)
if
(
bAutoSize
||
rCxt
.
isForceAutoSize
()
)
{
{
if
(
nExtra
)
if
(
rCxt
.
getExtraHeight
()
)
{
{
if
(
bAutoSize
)
if
(
bAutoSize
)
pRowFlags
->
SetValue
(
nStartRow
+
i
,
nRegionEndRow
,
nRowFlag
|
CR_MANUALSIZE
);
pRowFlags
->
SetValue
(
nStartRow
+
i
,
nRegionEndRow
,
nRowFlag
|
CR_MANUALSIZE
);
...
@@ -188,7 +191,7 @@ bool SetOptimalHeightsToRows(OptimalHeightsFuncObjBase& rFuncObj,
...
@@ -188,7 +191,7 @@ bool SetOptimalHeightsToRows(OptimalHeightsFuncObjBase& rFuncObj,
{
{
if
(
nLast
)
if
(
nLast
)
{
{
if
(
aHeights
[
nInner
]
+
nExtra
==
nLast
)
if
(
rCxt
.
getHeightArray
()[
nInner
]
+
rCxt
.
getExtraHeight
()
==
nLast
)
nRngEnd
=
nStartRow
+
nInner
;
nRngEnd
=
nStartRow
+
nInner
;
else
else
{
{
...
@@ -198,7 +201,7 @@ bool SetOptimalHeightsToRows(OptimalHeightsFuncObjBase& rFuncObj,
...
@@ -198,7 +201,7 @@ bool SetOptimalHeightsToRows(OptimalHeightsFuncObjBase& rFuncObj,
}
}
if
(
!
nLast
)
if
(
!
nLast
)
{
{
nLast
=
aHeights
[
nInner
]
+
nExtra
;
nLast
=
rCxt
.
getHeightArray
()[
nInner
]
+
rCxt
.
getExtraHeight
()
;
nRngStart
=
nStartRow
+
nInner
;
nRngStart
=
nStartRow
+
nInner
;
nRngEnd
=
nStartRow
+
nInner
;
nRngEnd
=
nStartRow
+
nInner
;
}
}
...
@@ -465,13 +468,12 @@ bool ScTable::SetOptimalHeight(
...
@@ -465,13 +468,12 @@ bool ScTable::SetOptimalHeight(
ScProgress
*
pProgress
=
GetProgressBar
(
nCount
,
GetWeightedCount
(),
pOuterProgress
,
pDocument
);
ScProgress
*
pProgress
=
GetProgressBar
(
nCount
,
GetWeightedCount
(),
pOuterProgress
,
pDocument
);
vector
<
sal_uInt16
>
aHeights
(
nCount
,
0
);
rCxt
.
getHeightArray
().
resize
(
nCount
,
0
);
GetOptimalHeightsInColumn
(
rCxt
,
aCol
,
nStartRow
,
nEndRow
,
aHeights
,
pProgress
,
nProgressStart
);
GetOptimalHeightsInColumn
(
rCxt
,
aCol
,
nStartRow
,
nEndRow
,
pProgress
,
nProgressStart
);
SetRowHeightRangeFunc
aFunc
(
this
,
rCxt
.
getPPTX
(),
rCxt
.
getPPTY
());
SetRowHeightRangeFunc
aFunc
(
this
,
rCxt
.
getPPTX
(),
rCxt
.
getPPTY
());
bool
bChanged
=
SetOptimalHeightsToRows
(
bool
bChanged
=
SetOptimalHeightsToRows
(
rCxt
,
aFunc
,
pRowFlags
,
nStartRow
,
nEndRow
);
aFunc
,
pRowFlags
,
nStartRow
,
nEndRow
,
rCxt
.
getExtraHeight
(),
aHeights
,
rCxt
.
isForceAutoSize
());
if
(
pProgress
!=
pOuterProgress
)
if
(
pProgress
!=
pOuterProgress
)
delete
pProgress
;
delete
pProgress
;
...
@@ -493,13 +495,12 @@ void ScTable::SetOptimalHeightOnly(
...
@@ -493,13 +495,12 @@ void ScTable::SetOptimalHeightOnly(
ScProgress
*
pProgress
=
GetProgressBar
(
nCount
,
GetWeightedCount
(),
pOuterProgress
,
pDocument
);
ScProgress
*
pProgress
=
GetProgressBar
(
nCount
,
GetWeightedCount
(),
pOuterProgress
,
pDocument
);
vector
<
sal_uInt16
>
aHeights
(
nCount
,
0
);
rCxt
.
getHeightArray
().
resize
(
nCount
,
0
);
GetOptimalHeightsInColumn
(
rCxt
,
aCol
,
nStartRow
,
nEndRow
,
aHeights
,
pProgress
,
nProgressStart
);
GetOptimalHeightsInColumn
(
rCxt
,
aCol
,
nStartRow
,
nEndRow
,
pProgress
,
nProgressStart
);
SetRowHeightOnlyFunc
aFunc
(
this
);
SetRowHeightOnlyFunc
aFunc
(
this
);
SetOptimalHeightsToRows
(
SetOptimalHeightsToRows
(
rCxt
,
aFunc
,
pRowFlags
,
nStartRow
,
nEndRow
);
aFunc
,
pRowFlags
,
nStartRow
,
nEndRow
,
rCxt
.
getExtraHeight
(),
aHeights
,
rCxt
.
isForceAutoSize
());
if
(
pProgress
!=
pOuterProgress
)
if
(
pProgress
!=
pOuterProgress
)
delete
pProgress
;
delete
pProgress
;
...
...
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