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
53387dab
Kaydet (Commit)
53387dab
authored
Mar 30, 2014
tarafından
Matteo Casalin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Apply ROUND to floats and let it return longs
Change-Id: I88476c1ca2eff0898d31ab48d7d5a36301297bb9
üst
8d0f6946
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
labfmt.cxx
sw/source/ui/envelp/labfmt.cxx
+17
-17
No files found.
sw/source/ui/envelp/labfmt.cxx
Dosyayı görüntüle @
53387dab
...
@@ -39,7 +39,7 @@ using namespace utl;
...
@@ -39,7 +39,7 @@ using namespace utl;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
beans
;
using
namespace
::
com
::
sun
::
star
::
beans
;
#define ROUND(x)
((sal_uInt16) ((x) + .5)
)
#define ROUND(x)
static_cast<long>((x) + .5
)
SwLabPreview
::
SwLabPreview
(
Window
*
pParent
)
SwLabPreview
::
SwLabPreview
(
Window
*
pParent
)
:
Window
(
pParent
,
0
)
:
Window
(
pParent
,
0
)
...
@@ -119,16 +119,16 @@ void SwLabPreview::Paint(const Rectangle &)
...
@@ -119,16 +119,16 @@ void SwLabPreview::Paint(const Rectangle &)
SetFont
(
aPaintFont
);
SetFont
(
aPaintFont
);
// size of region to be displayed
// size of region to be displayed
long
lDispW
=
ROUND
(
aItem
.
lLeft
+
aItem
.
lHDist
)
;
long
lDispW
=
aItem
.
lLeft
+
aItem
.
lHDist
;
long
lDispH
=
ROUND
(
aItem
.
lUpper
+
aItem
.
lVDist
)
;
long
lDispH
=
aItem
.
lUpper
+
aItem
.
lVDist
;
if
(
aItem
.
nCols
==
1
)
if
(
aItem
.
nCols
==
1
)
lDispW
+=
ROUND
(
aItem
.
lLeft
)
;
lDispW
+=
aItem
.
lLeft
;
else
else
lDispW
+=
ROUND
(
aItem
.
lHDist
/
10
);
lDispW
+=
ROUND
(
aItem
.
lHDist
/
10
.0
);
if
(
aItem
.
nRows
==
1
)
if
(
aItem
.
nRows
==
1
)
lDispH
+=
ROUND
(
aItem
.
lUpper
)
;
lDispH
+=
aItem
.
lUpper
;
else
else
lDispH
+=
ROUND
(
aItem
.
lVDist
/
10
);
lDispH
+=
ROUND
(
aItem
.
lVDist
/
10
.0
);
// Scale factor
// Scale factor
float
fx
=
(
float
)
lOutWPix23
/
std
::
max
(
1L
,
lDispW
),
float
fx
=
(
float
)
lOutWPix23
/
std
::
max
(
1L
,
lDispW
),
...
@@ -141,12 +141,12 @@ void SwLabPreview::Paint(const Rectangle &)
...
@@ -141,12 +141,12 @@ void SwLabPreview::Paint(const Rectangle &)
long
lX0
=
(
lOutWPix
-
lOutlineW
)
/
2
;
long
lX0
=
(
lOutWPix
-
lOutlineW
)
/
2
;
long
lY0
=
(
lOutHPix
-
lOutlineH
)
/
2
;
long
lY0
=
(
lOutHPix
-
lOutlineH
)
/
2
;
long
lX1
=
ROUND
(
lX0
+
f
*
aItem
.
lLeft
);
long
lX1
=
lX0
+
ROUND
(
f
*
aItem
.
lLeft
);
long
lY1
=
ROUND
(
lY0
+
f
*
aItem
.
lUpper
);
long
lY1
=
lY0
+
ROUND
(
f
*
aItem
.
lUpper
);
long
lX2
=
ROUND
(
lX0
+
f
*
(
aItem
.
lLeft
+
aItem
.
lWidth
));
long
lX2
=
lX0
+
ROUND
(
f
*
(
aItem
.
lLeft
+
aItem
.
lWidth
));
long
lY2
=
ROUND
(
lY0
+
f
*
(
aItem
.
lUpper
+
aItem
.
lHeight
));
long
lY2
=
lY0
+
ROUND
(
f
*
(
aItem
.
lUpper
+
aItem
.
lHeight
));
long
lX3
=
ROUND
(
lX0
+
f
*
(
aItem
.
lLeft
+
aItem
.
lHDist
));
long
lX3
=
lX0
+
ROUND
(
f
*
(
aItem
.
lLeft
+
aItem
.
lHDist
));
long
lY3
=
ROUND
(
lY0
+
f
*
(
aItem
.
lUpper
+
aItem
.
lVDist
));
long
lY3
=
lY0
+
ROUND
(
f
*
(
aItem
.
lUpper
+
aItem
.
lVDist
));
// draw outline (area)
// draw outline (area)
DrawRect
(
Rectangle
(
Point
(
lX0
,
lY0
),
Size
(
lOutlineW
,
lOutlineH
)));
DrawRect
(
Rectangle
(
Point
(
lX0
,
lY0
),
Size
(
lOutlineW
,
lOutlineH
)));
...
@@ -166,8 +166,8 @@ void SwLabPreview::Paint(const Rectangle &)
...
@@ -166,8 +166,8 @@ void SwLabPreview::Paint(const Rectangle &)
for
(
sal_uInt16
nRow
=
0
;
nRow
<
std
::
min
((
sal_uInt16
)
2
,
(
sal_uInt16
)
aItem
.
nRows
);
nRow
++
)
for
(
sal_uInt16
nRow
=
0
;
nRow
<
std
::
min
((
sal_uInt16
)
2
,
(
sal_uInt16
)
aItem
.
nRows
);
nRow
++
)
for
(
sal_uInt16
nCol
=
0
;
nCol
<
std
::
min
((
sal_uInt16
)
2
,
(
sal_uInt16
)
aItem
.
nCols
);
nCol
++
)
for
(
sal_uInt16
nCol
=
0
;
nCol
<
std
::
min
((
sal_uInt16
)
2
,
(
sal_uInt16
)
aItem
.
nCols
);
nCol
++
)
DrawRect
(
Rectangle
(
DrawRect
(
Rectangle
(
Point
(
ROUND
(
lX0
+
f
*
(
aItem
.
lLeft
+
nCol
*
aItem
.
lHDist
)),
Point
(
lX0
+
ROUND
(
f
*
(
aItem
.
lLeft
+
nCol
*
aItem
.
lHDist
)),
ROUND
(
lY0
+
f
*
(
aItem
.
lUpper
+
nRow
*
aItem
.
lVDist
))),
lY0
+
ROUND
(
f
*
(
aItem
.
lUpper
+
nRow
*
aItem
.
lVDist
))),
Size
(
ROUND
(
f
*
aItem
.
lWidth
),
Size
(
ROUND
(
f
*
aItem
.
lWidth
),
ROUND
(
f
*
aItem
.
lHeight
))));
ROUND
(
f
*
aItem
.
lHeight
))));
SetClipRegion
();
SetClipRegion
();
...
@@ -185,7 +185,7 @@ void SwLabPreview::Paint(const Rectangle &)
...
@@ -185,7 +185,7 @@ void SwLabPreview::Paint(const Rectangle &)
if
(
aItem
.
lUpper
)
if
(
aItem
.
lUpper
)
{
{
DrawArrow
(
Point
(
lX0
-
5
,
lY0
),
Point
(
lX0
-
5
,
lY1
),
false
);
DrawArrow
(
Point
(
lX0
-
5
,
lY0
),
Point
(
lX0
-
5
,
lY1
),
false
);
DrawText
(
Point
(
lX0
-
10
-
lUpperWidth
,
ROUND
(
lY0
+
f
*
aItem
.
lUpper
/
2
-
lXHeight
/
2
)),
aUpperStr
);
DrawText
(
Point
(
lX0
-
10
-
lUpperWidth
,
lY0
+
ROUND
(
f
*
aItem
.
lUpper
/
2.0
-
lXHeight
/
2.0
)),
aUpperStr
);
}
}
// annotation: width and height
// annotation: width and height
...
@@ -213,7 +213,7 @@ void SwLabPreview::Paint(const Rectangle &)
...
@@ -213,7 +213,7 @@ void SwLabPreview::Paint(const Rectangle &)
if
(
aItem
.
nRows
>
1
)
if
(
aItem
.
nRows
>
1
)
{
{
DrawArrow
(
Point
(
lX0
-
5
,
lY1
),
Point
(
lX0
-
5
,
lY3
),
false
);
DrawArrow
(
Point
(
lX0
-
5
,
lY1
),
Point
(
lX0
-
5
,
lY3
),
false
);
DrawText
(
Point
(
lX0
-
10
-
lVDistWidth
,
ROUND
(
lY1
+
f
*
aItem
.
lVDist
/
2
-
lXHeight
/
2
)),
aVDistStr
);
DrawText
(
Point
(
lX0
-
10
-
lVDistWidth
,
lY1
+
ROUND
(
f
*
aItem
.
lVDist
/
2.0
-
lXHeight
/
2.0
)),
aVDistStr
);
}
}
// annotation: columns
// annotation: columns
...
...
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