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
f0c03edd
Kaydet (Commit)
f0c03edd
authored
Ara 19, 2013
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sw: remove silly BigInt based SqRt
Change-Id: I0a23682998fcf23f917289a0137d137b240a9d92
üst
09af884e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
53 deletions
+23
-53
frmtool.hxx
sw/source/core/inc/frmtool.hxx
+0
-3
flycnt.cxx
sw/source/core/layout/flycnt.cxx
+16
-17
frmtool.cxx
sw/source/core/layout/frmtool.cxx
+0
-24
trvlfrm.cxx
sw/source/core/layout/trvlfrm.cxx
+7
-9
No files found.
sw/source/core/inc/frmtool.hxx
Dosyayı görüntüle @
f0c03edd
...
@@ -35,7 +35,6 @@ class SwRootFrm;
...
@@ -35,7 +35,6 @@ class SwRootFrm;
class
SwDoc
;
class
SwDoc
;
class
SwAttrSet
;
class
SwAttrSet
;
class
SdrObject
;
class
SdrObject
;
class
BigInt
;
class
SvxBrushItem
;
class
SvxBrushItem
;
class
XFillStyleItem
;
class
XFillStyleItem
;
class
XFillGradientItem
;
class
XFillGradientItem
;
...
@@ -82,8 +81,6 @@ void PaintCharacterBorder(
...
@@ -82,8 +81,6 @@ void PaintCharacterBorder(
// Implementation in feshview.cxx
// Implementation in feshview.cxx
SwFlyFrm
*
GetFlyFromMarked
(
const
SdrMarkList
*
pLst
,
SwViewShell
*
pSh
);
SwFlyFrm
*
GetFlyFromMarked
(
const
SdrMarkList
*
pLst
,
SwViewShell
*
pSh
);
sal_uLong
SqRt
(
BigInt
nX
);
SwFrm
*
SaveCntnt
(
SwLayoutFrm
*
pLay
,
SwFrm
*
pStart
=
NULL
);
SwFrm
*
SaveCntnt
(
SwLayoutFrm
*
pLay
,
SwFrm
*
pStart
=
NULL
);
void
RestoreCntnt
(
SwFrm
*
pSav
,
SwLayoutFrm
*
pParent
,
SwFrm
*
pSibling
,
bool
bGrow
);
void
RestoreCntnt
(
SwFrm
*
pSav
,
SwLayoutFrm
*
pParent
,
SwFrm
*
pSibling
,
bool
bGrow
);
...
...
sw/source/core/layout/flycnt.cxx
Dosyayı görüntüle @
f0c03edd
...
@@ -877,7 +877,7 @@ static const SwFrm * lcl_CalcDownDist( SwDistance &rRet,
...
@@ -877,7 +877,7 @@ static const SwFrm * lcl_CalcDownDist( SwDistance &rRet,
return
0
;
return
0
;
}
}
static
sal_u
Long
lcl_FindCntDiff
(
const
Point
&
rPt
,
const
SwLayoutFrm
*
pLay
,
static
sal_u
Int64
lcl_FindCntDiff
(
const
Point
&
rPt
,
const
SwLayoutFrm
*
pLay
,
const
SwCntntFrm
*&
rpCnt
,
const
SwCntntFrm
*&
rpCnt
,
const
bool
bBody
,
const
sal_Bool
bFtn
)
const
bool
bBody
,
const
sal_Bool
bFtn
)
{
{
...
@@ -890,8 +890,8 @@ static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay,
...
@@ -890,8 +890,8 @@ static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay,
#endif
#endif
rpCnt
=
0
;
rpCnt
=
0
;
sal_u
Long
nDistance
=
ULONG_MAX
;
sal_u
Int64
nDistance
=
SAL_MAX_UINT64
;
sal_u
Long
nNearest
=
ULONG_MAX
;
sal_u
Int64
nNearest
=
SAL_MAX_UINT64
;
const
SwCntntFrm
*
pCnt
=
pLay
->
ContainsCntnt
();
const
SwCntntFrm
*
pCnt
=
pLay
->
ContainsCntnt
();
while
(
pCnt
&&
(
bBody
!=
pCnt
->
IsInDocBody
()
||
bFtn
!=
pCnt
->
IsInFtn
()))
while
(
pCnt
&&
(
bBody
!=
pCnt
->
IsInDocBody
()
||
bFtn
!=
pCnt
->
IsInFtn
()))
...
@@ -907,13 +907,12 @@ static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay,
...
@@ -907,13 +907,12 @@ static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay,
{
{
//Calculate the distance between those two points.
//Calculate the distance between those two points.
//'delta' X^2 + 'delta' Y^2 = 'distance'^2
//'delta' X^2 + 'delta' Y^2 = 'distance'^2
sal_uInt
32
dX
=
std
::
max
(
pCnt
->
Frm
().
Left
(),
rPt
.
X
()
)
-
sal_uInt
64
dX
=
std
::
max
(
pCnt
->
Frm
().
Left
(),
rPt
.
X
()
)
-
std
::
min
(
pCnt
->
Frm
().
Left
(),
rPt
.
X
()
),
std
::
min
(
pCnt
->
Frm
().
Left
(),
rPt
.
X
()
),
dY
=
std
::
max
(
pCnt
->
Frm
().
Top
(),
rPt
.
Y
()
)
-
dY
=
std
::
max
(
pCnt
->
Frm
().
Top
(),
rPt
.
Y
()
)
-
std
::
min
(
pCnt
->
Frm
().
Top
(),
rPt
.
Y
()
);
std
::
min
(
pCnt
->
Frm
().
Top
(),
rPt
.
Y
()
);
BigInt
dX1
(
dX
),
dY1
(
dY
);
// square of the difference will do fine here
dX1
*=
dX1
;
dY1
*=
dY1
;
const
sal_uInt64
nDiff
=
(
dX
*
dX
)
+
(
dY
*
dY
);
const
sal_uLong
nDiff
=
::
SqRt
(
dX1
+
dY1
);
if
(
pCnt
->
Frm
().
Top
()
<=
rPt
.
Y
()
)
if
(
pCnt
->
Frm
().
Top
()
<=
rPt
.
Y
()
)
{
{
if
(
nDiff
<
nDistance
)
if
(
nDiff
<
nDistance
)
...
@@ -935,7 +934,7 @@ static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay,
...
@@ -935,7 +934,7 @@ static sal_uLong lcl_FindCntDiff( const Point &rPt, const SwLayoutFrm *pLay,
}
while
(
pCnt
&&
pLay
->
IsAnLower
(
pCnt
)
);
}
while
(
pCnt
&&
pLay
->
IsAnLower
(
pCnt
)
);
}
}
if
(
nDistance
==
ULONG_MAX
)
if
(
nDistance
==
SAL_MAX_UINT64
)
{
rpCnt
=
pNearest
;
{
rpCnt
=
pNearest
;
return
nNearest
;
return
nNearest
;
}
}
...
@@ -955,26 +954,26 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt,
...
@@ -955,26 +954,26 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt,
//above the point.
//above the point.
const
SwCntntFrm
*
pRet
,
*
pNew
;
const
SwCntntFrm
*
pRet
,
*
pNew
;
const
SwLayoutFrm
*
pLay
=
pCnt
->
FindPageFrm
();
const
SwLayoutFrm
*
pLay
=
pCnt
->
FindPageFrm
();
sal_u
Long
nDist
;
sal_u
Int64
nDist
;
// not sure if a sal_Int32 would be enough?
nDist
=
::
lcl_FindCntDiff
(
rPt
,
pLay
,
pNew
,
bBody
,
bFtn
);
nDist
=
::
lcl_FindCntDiff
(
rPt
,
pLay
,
pNew
,
bBody
,
bFtn
);
if
(
pNew
)
if
(
pNew
)
pRet
=
pNew
;
pRet
=
pNew
;
else
else
{
pRet
=
pCnt
;
{
pRet
=
pCnt
;
nDist
=
ULONG_MAX
;
nDist
=
SAL_MAX_UINT64
;
}
}
const
SwCntntFrm
*
pNearest
=
pRet
;
const
SwCntntFrm
*
pNearest
=
pRet
;
sal_u
Long
nNearest
=
nDist
;
sal_u
Int64
nNearest
=
nDist
;
if
(
pLay
)
if
(
pLay
)
{
{
const
SwLayoutFrm
*
pPge
=
pLay
;
const
SwLayoutFrm
*
pPge
=
pLay
;
sal_u
Long
nOldNew
=
ULONG_MAX
;
sal_u
Int64
nOldNew
=
SAL_MAX_UINT64
;
for
(
sal_uInt16
i
=
0
;
pPge
->
GetPrev
()
&&
(
i
<
3
);
++
i
)
for
(
sal_uInt16
i
=
0
;
pPge
->
GetPrev
()
&&
(
i
<
3
);
++
i
)
{
{
pPge
=
(
SwLayoutFrm
*
)
pPge
->
GetPrev
();
pPge
=
(
SwLayoutFrm
*
)
pPge
->
GetPrev
();
const
sal_u
Long
nNew
=
::
lcl_FindCntDiff
(
rPt
,
pPge
,
pNew
,
bBody
,
bFtn
);
const
sal_u
Int64
nNew
=
::
lcl_FindCntDiff
(
rPt
,
pPge
,
pNew
,
bBody
,
bFtn
);
if
(
nNew
<
nDist
)
if
(
nNew
<
nDist
)
{
{
if
(
pNew
->
Frm
().
Top
()
<=
rPt
.
Y
()
)
if
(
pNew
->
Frm
().
Top
()
<=
rPt
.
Y
()
)
...
@@ -988,18 +987,18 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt,
...
@@ -988,18 +987,18 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt,
nNearest
=
nNew
;
nNearest
=
nNew
;
}
}
}
}
else
if
(
nOldNew
!=
ULONG_MAX
&&
nNew
>
nOldNew
)
else
if
(
nOldNew
!=
SAL_MAX_UINT64
&&
nNew
>
nOldNew
)
break
;
break
;
else
else
nOldNew
=
nNew
;
nOldNew
=
nNew
;
}
}
pPge
=
pLay
;
pPge
=
pLay
;
nOldNew
=
ULONG_MAX
;
nOldNew
=
SAL_MAX_UINT64
;
for
(
sal_uInt16
j
=
0
;
pPge
->
GetNext
()
&&
(
j
<
3
);
++
j
)
for
(
sal_uInt16
j
=
0
;
pPge
->
GetNext
()
&&
(
j
<
3
);
++
j
)
{
{
pPge
=
(
SwLayoutFrm
*
)
pPge
->
GetNext
();
pPge
=
(
SwLayoutFrm
*
)
pPge
->
GetNext
();
const
sal_u
Long
nNew
=
::
lcl_FindCntDiff
(
rPt
,
pPge
,
pNew
,
bBody
,
bFtn
);
const
sal_u
Int64
nNew
=
::
lcl_FindCntDiff
(
rPt
,
pPge
,
pNew
,
bBody
,
bFtn
);
if
(
nNew
<
nDist
)
if
(
nNew
<
nDist
)
{
{
if
(
pNew
->
Frm
().
Top
()
<=
rPt
.
Y
()
)
if
(
pNew
->
Frm
().
Top
()
<=
rPt
.
Y
()
)
...
@@ -1013,7 +1012,7 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt,
...
@@ -1013,7 +1012,7 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt,
nNearest
=
nNew
;
nNearest
=
nNew
;
}
}
}
}
else
if
(
nOldNew
!=
ULONG_MAX
&&
nNew
>
nOldNew
)
else
if
(
nOldNew
!=
SAL_MAX_UINT64
&&
nNew
>
nOldNew
)
break
;
break
;
else
else
nOldNew
=
nNew
;
nOldNew
=
nNew
;
...
...
sw/source/core/layout/frmtool.cxx
Dosyayı görüntüle @
f0c03edd
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
*/
#include <tools/bigint.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdmodel.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdpage.hxx>
#include <editeng/brushitem.hxx>
#include <editeng/brushitem.hxx>
...
@@ -2683,29 +2682,6 @@ void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGro
...
@@ -2683,29 +2682,6 @@ void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGro
pParent
->
Grow
(
nGrowVal
);
pParent
->
Grow
(
nGrowVal
);
}
}
/*************************************************************************
|*
|* SqRt() Berechnung der Quadratwurzel, damit die math.lib
|* nicht auch noch dazugelinkt werden muss.
|*
|*************************************************************************/
sal_uLong
SqRt
(
BigInt
nX
)
{
BigInt
nErg
=
1
;
if
(
!
nX
.
IsNeg
()
)
{
BigInt
nOldErg
=
1
;
for
(
int
i
=
0
;
i
<=
5
;
i
++
)
{
nErg
=
(
nOldErg
+
(
nX
/
nOldErg
))
/
BigInt
(
2
);
nOldErg
=
nErg
;
}
}
return
nErg
>=
BigInt
(
SAL_MAX_UINT32
)
?
ULONG_MAX
:
(
sal_uLong
)
nErg
;
}
/*************************************************************************/
/*************************************************************************/
SwPageFrm
*
InsertNewPage
(
SwPageDesc
&
rDesc
,
SwFrm
*
pUpper
,
SwPageFrm
*
InsertNewPage
(
SwPageDesc
&
rDesc
,
SwFrm
*
pUpper
,
...
...
sw/source/core/layout/trvlfrm.cxx
Dosyayı görüntüle @
f0c03edd
...
@@ -1142,17 +1142,15 @@ sal_Bool GetFrmInPage( const SwCntntFrm *pCnt, SwWhichPage fnWhichPage,
...
@@ -1142,17 +1142,15 @@ sal_Bool GetFrmInPage( const SwCntntFrm *pCnt, SwWhichPage fnWhichPage,
}
}
}
}
s
al_uLong
CalcDiff
(
const
Point
&
rPt1
,
const
Point
&
rPt2
)
s
tatic
sal_uInt64
CalcDiff
(
const
Point
&
rPt1
,
const
Point
&
rPt2
)
{
{
//Calculate the distance between the two points.
//Calculate the distance between the two points.
//'delta' X^2 + 'delta'Y^2 = 'distance'^2
//'delta' X^2 + 'delta'Y^2 = 'distance'^2
sal_uInt
32
dX
=
std
::
max
(
rPt1
.
X
(),
rPt2
.
X
()
)
-
sal_uInt
64
dX
=
std
::
max
(
rPt1
.
X
(),
rPt2
.
X
()
)
-
std
::
min
(
rPt1
.
X
(),
rPt2
.
X
()
),
std
::
min
(
rPt1
.
X
(),
rPt2
.
X
()
),
dY
=
std
::
max
(
rPt1
.
Y
(),
rPt2
.
Y
()
)
-
dY
=
std
::
max
(
rPt1
.
Y
(),
rPt2
.
Y
()
)
-
std
::
min
(
rPt1
.
Y
(),
rPt2
.
Y
()
);
std
::
min
(
rPt1
.
Y
(),
rPt2
.
Y
()
);
BigInt
dX1
(
dX
),
dY1
(
dY
);
return
(
dX
*
dX
)
+
(
dY
*
dY
);
dX1
*=
dX1
;
dY1
*=
dY1
;
return
::
SqRt
(
dX1
+
dY1
);
}
}
/** Check if the point lies inside the page part in wich also the CntntFrame lies.
/** Check if the point lies inside the page part in wich also the CntntFrame lies.
...
@@ -1209,7 +1207,7 @@ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint,
...
@@ -1209,7 +1207,7 @@ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint,
const
SwLayoutFrm
*
pInside
=
NULL
;
const
SwLayoutFrm
*
pInside
=
NULL
;
sal_uInt16
nMaxPage
=
GetPhyPageNum
()
+
(
bDefaultExpand
?
1
:
0
);
sal_uInt16
nMaxPage
=
GetPhyPageNum
()
+
(
bDefaultExpand
?
1
:
0
);
Point
aPoint
=
rPoint
;
Point
aPoint
=
rPoint
;
sal_u
Long
nDistance
=
ULONG_MAX
;
sal_u
Int64
nDistance
=
SAL_MAX_UINT64
;
while
(
true
)
//A loop to be sure we always find one.
while
(
true
)
//A loop to be sure we always find one.
{
{
...
@@ -1262,7 +1260,7 @@ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint,
...
@@ -1262,7 +1260,7 @@ const SwCntntFrm *SwLayoutFrm::GetCntntPos( Point& rPoint,
if
(
!
pInside
||
(
pInside
->
IsAnLower
(
pCntnt
)
&&
if
(
!
pInside
||
(
pInside
->
IsAnLower
(
pCntnt
)
&&
(
!
pCntnt
->
IsInFtn
()
||
pInside
->
IsFtnContFrm
()
)
)
)
(
!
pCntnt
->
IsInFtn
()
||
pInside
->
IsFtnContFrm
()
)
)
)
{
{
const
sal_u
Long
nDiff
=
::
CalcDiff
(
aCntntPoint
,
rPoint
);
const
sal_u
Int64
nDiff
=
::
CalcDiff
(
aCntntPoint
,
rPoint
);
sal_Bool
bBetter
=
nDiff
<
nDistance
;
// This one is nearer
sal_Bool
bBetter
=
nDiff
<
nDistance
;
// This one is nearer
if
(
!
pInside
)
if
(
!
pInside
)
{
{
...
@@ -1406,7 +1404,7 @@ void SwPageFrm::GetCntntPosition( const Point &rPt, SwPosition &rPos ) const
...
@@ -1406,7 +1404,7 @@ void SwPageFrm::GetCntntPosition( const Point &rPt, SwPosition &rPos ) const
const
SwCntntFrm
*
pAct
=
pCntnt
;
const
SwCntntFrm
*
pAct
=
pCntnt
;
Point
aAct
=
rPt
;
Point
aAct
=
rPt
;
sal_uLong
nDist
=
ULONG_MAX
;
sal_uLong
nDist
=
SAL_MAX_UINT64
;
while
(
pCntnt
)
while
(
pCntnt
)
{
{
...
@@ -1433,7 +1431,7 @@ void SwPageFrm::GetCntntPosition( const Point &rPt, SwPosition &rPos ) const
...
@@ -1433,7 +1431,7 @@ void SwPageFrm::GetCntntPosition( const Point &rPt, SwPosition &rPos ) const
else
if
(
aCntFrm
.
Right
()
<
rPt
.
X
()
)
else
if
(
aCntFrm
.
Right
()
<
rPt
.
X
()
)
aPoint
.
X
()
=
aCntFrm
.
Right
();
aPoint
.
X
()
=
aCntFrm
.
Right
();
const
sal_u
Long
nDiff
=
::
CalcDiff
(
aPoint
,
rPt
);
const
sal_u
Int64
nDiff
=
::
CalcDiff
(
aPoint
,
rPt
);
if
(
nDiff
<
nDist
)
if
(
nDiff
<
nDist
)
{
{
aAct
=
aPoint
;
aAct
=
aPoint
;
...
...
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