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
83d33d35
Kaydet (Commit)
83d33d35
authored
May 12, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
refactor SvxParaPrevWindow to use RenderContext
Change-Id: I3eb7ad267b261c28b193dfc6de24e4facdf57850
üst
02eff9d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
146 additions
and
84 deletions
+146
-84
paraprev.hxx
include/svx/paraprev.hxx
+88
-31
paraprev.cxx
svx/source/dialog/paraprev.cxx
+58
-53
No files found.
include/svx/paraprev.hxx
Dosyayı görüntüle @
83d33d35
...
...
@@ -23,8 +23,6 @@
#include <editeng/svxenum.hxx>
#include <svx/svxdllapi.h>
// enum ------------------------------------------------------------------
enum
SvxPrevLineSpace
{
SVX_PREV_LINESPACE_1
=
0
,
...
...
@@ -35,8 +33,6 @@ enum SvxPrevLineSpace
SVX_PREV_LINESPACE_DURCH
};
// class SvxParaPrevWindow -----------------------------------------------
class
SVX_DLLPUBLIC
SvxParaPrevWindow
:
public
vcl
::
Window
{
using
Window
::
Draw
;
...
...
@@ -62,39 +58,100 @@ private:
Rectangle
Lines
[
9
];
protected
:
virtual
void
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
virtual
void
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
rRect
)
SAL_OVERRIDE
;
virtual
Size
GetOptimalSize
()
const
SAL_OVERRIDE
;
void
DrawParagraph
(
bool
bAll
);
void
DrawParagraph
(
vcl
::
RenderContext
&
rRenderContext
,
bool
bAll
);
public
:
SvxParaPrevWindow
(
vcl
::
Window
*
pParent
,
WinBits
nBits
);
void
SetFirstLineOfst
(
short
nNew
)
{
nFirstLineOfst
=
nNew
;
}
void
SetLeftMargin
(
long
nNew
)
{
nLeftMargin
=
nNew
;
}
void
SetRightMargin
(
long
nNew
)
{
nRightMargin
=
nNew
;
}
void
SetUpper
(
sal_uInt16
nNew
)
{
nUpper
=
nNew
;
}
void
SetLower
(
sal_uInt16
nNew
)
{
nLower
=
nNew
;
}
void
SetAdjust
(
SvxAdjust
eNew
)
{
eAdjust
=
eNew
;
}
void
SetLastLine
(
SvxAdjust
eNew
)
{
eLastLine
=
eNew
;
}
void
SetLineSpace
(
SvxPrevLineSpace
eNew
,
sal_uInt16
nNew
=
0
)
{
eLine
=
eNew
;
nLineVal
=
nNew
;
}
void
SetText
(
const
OUString
&
rStr
)
SAL_OVERRIDE
{
aText
=
rStr
;
}
void
SetSize
(
Size
aNew
)
{
aSize
=
aNew
;
}
short
GetFirstLineOfst
()
const
{
return
nFirstLineOfst
;
}
long
GetLeftMargin
()
const
{
return
nLeftMargin
;
}
long
GetRightMargin
()
const
{
return
nRightMargin
;
}
sal_uInt16
GetUpper
()
const
{
return
nUpper
;
}
sal_uInt16
GetLower
()
const
{
return
nLower
;
}
SvxAdjust
GetAdjust
()
const
{
return
eAdjust
;
}
SvxPrevLineSpace
GetLineEnum
()
const
{
return
eLine
;
}
sal_uInt16
GetLineValue
()
const
{
return
nLineVal
;
}
OUString
GetText
()
const
SAL_OVERRIDE
{
return
aText
;
}
Size
GetSize
()
const
{
return
aSize
;
}
void
Draw
(
bool
bAll
)
{
DrawParagraph
(
bAll
);
}
void
SetFirstLineOfst
(
short
nNew
)
{
nFirstLineOfst
=
nNew
;
}
void
SetLeftMargin
(
long
nNew
)
{
nLeftMargin
=
nNew
;
}
void
SetRightMargin
(
long
nNew
)
{
nRightMargin
=
nNew
;
}
void
SetUpper
(
sal_uInt16
nNew
)
{
nUpper
=
nNew
;
}
void
SetLower
(
sal_uInt16
nNew
)
{
nLower
=
nNew
;
}
void
SetAdjust
(
SvxAdjust
eNew
)
{
eAdjust
=
eNew
;
}
void
SetLastLine
(
SvxAdjust
eNew
)
{
eLastLine
=
eNew
;
}
void
SetLineSpace
(
SvxPrevLineSpace
eNew
,
sal_uInt16
nNew
=
0
)
{
eLine
=
eNew
;
nLineVal
=
nNew
;
}
void
SetText
(
const
OUString
&
rStr
)
SAL_OVERRIDE
{
aText
=
rStr
;
}
void
SetSize
(
Size
aNew
)
{
aSize
=
aNew
;
}
short
GetFirstLineOfst
()
const
{
return
nFirstLineOfst
;
}
long
GetLeftMargin
()
const
{
return
nLeftMargin
;
}
long
GetRightMargin
()
const
{
return
nRightMargin
;
}
sal_uInt16
GetUpper
()
const
{
return
nUpper
;
}
sal_uInt16
GetLower
()
const
{
return
nLower
;
}
SvxAdjust
GetAdjust
()
const
{
return
eAdjust
;
}
SvxPrevLineSpace
GetLineEnum
()
const
{
return
eLine
;
}
sal_uInt16
GetLineValue
()
const
{
return
nLineVal
;
}
OUString
GetText
()
const
SAL_OVERRIDE
{
return
aText
;
}
Size
GetSize
()
const
{
return
aSize
;
}
void
Draw
(
vcl
::
RenderContext
&
rRenderContext
,
bool
bAll
)
{
DrawParagraph
(
rRenderContext
,
bAll
);
}
};
#endif
...
...
svx/source/dialog/paraprev.cxx
Dosyayı görüntüle @
83d33d35
...
...
@@ -23,9 +23,7 @@
#include <vcl/settings.hxx>
SvxParaPrevWindow
::
SvxParaPrevWindow
(
vcl
::
Window
*
pParent
,
WinBits
nBits
)
:
Window
(
pParent
,
nBits
),
nLeftMargin
(
0
),
nRightMargin
(
0
),
nFirstLineOfst
(
0
),
...
...
@@ -38,11 +36,11 @@ SvxParaPrevWindow::SvxParaPrevWindow( vcl::Window* pParent, WinBits nBits) :
{
// Count in Twips by default
SetMapMode
(
MapMode
(
MAP_TWIP
)
);
SetMapMode
(
MapMode
(
MAP_TWIP
)
);
aSize
=
Size
(
11905
,
16837
);
aSize
=
Size
(
11905
,
16837
);
SetBorderStyle
(
WindowBorderStyle
::
MONO
);
SetBorderStyle
(
WindowBorderStyle
::
MONO
);
}
VCL_BUILDER_FACTORY_ARGS
(
SvxParaPrevWindow
,
WB_BORDER
)
...
...
@@ -52,62 +50,58 @@ Size SvxParaPrevWindow::GetOptimalSize() const
return
getParagraphPreviewOptimalSize
(
this
);
}
void
SvxParaPrevWindow
::
Paint
(
vcl
::
RenderContext
&
/*rRenderContext*/
,
const
Rectangle
&
)
void
SvxParaPrevWindow
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
)
{
DrawParagraph
(
true
);
DrawParagraph
(
rRenderContext
,
true
);
}
#define DEF_MARGIN 120
void
SvxParaPrevWindow
::
DrawParagraph
(
bool
bAll
)
void
SvxParaPrevWindow
::
DrawParagraph
(
vcl
::
RenderContext
&
rRenderContext
,
bool
bAll
)
{
Size
aWinSize
=
GetOutputSizePixel
();
aWinSize
=
PixelToLogic
(
aWinSize
);
Size
aWinSize
=
rRenderContext
.
GetOutputSizePixel
();
aWinSize
=
rRenderContext
.
PixelToLogic
(
aWinSize
);
Size
aTmp
(
1
,
1
);
aTmp
=
PixelToLogic
(
aTmp
);
aWinSize
.
Width
()
-=
aTmp
.
Width
()
/
2
;
aWinSize
.
Height
()
-=
aTmp
.
Height
()
/
2
;
const
StyleSettings
&
rStyleSettings
=
GetSettings
().
GetStyleSettings
();
const
StyleSettings
&
rStyleSettings
=
rRenderContext
.
GetSettings
().
GetStyleSettings
();
const
Color
&
rWinColor
=
rStyleSettings
.
GetWindowColor
();
Color
aGrayColor
(
COL_LIGHTGRAY
);
SetFillColor
(
Color
(
rWinColor
)
);
if
(
bAll
)
DrawRect
(
Rectangle
(
Point
(),
aWinSize
)
);
rRenderContext
.
SetFillColor
(
Color
(
rWinColor
)
);
if
(
bAll
)
rRenderContext
.
DrawRect
(
Rectangle
(
Point
(),
aWinSize
)
);
SetLineColor
();
rRenderContext
.
SetLineColor
();
long
nH
=
aWinSize
.
Height
()
/
19
;
Size
aLineSiz
(
aWinSize
.
Width
()
-
DEF_MARGIN
,
nH
),
aSiz
=
aLineSiz
;
Size
aLineSiz
(
aWinSize
.
Width
()
-
DEF_MARGIN
,
nH
);
Size
aSiz
=
aLineSiz
;
Point
aPnt
;
aPnt
.
X
()
=
DEF_MARGIN
/
2
;
SetFillColor
(
aGrayColor
);
rRenderContext
.
SetFillColor
(
aGrayColor
);
for
(
sal_uInt16
i
=
0
;
i
<
9
;
++
i
)
for
(
sal_uInt16
i
=
0
;
i
<
9
;
++
i
)
{
if
(
3
==
i
)
if
(
i
==
3
)
{
SetFillColor
(
Color
(
COL_GRAY
)
);
rRenderContext
.
SetFillColor
(
Color
(
COL_GRAY
)
);
long
nTop
=
nUpper
*
aLineSiz
.
Height
()
/
aSize
.
Height
();
aPnt
.
Y
()
+=
nTop
*
2
;
}
if
(
6
==
i
)
SetFillColor
(
aGrayColor
);
if
(
i
==
6
)
rRenderContext
.
SetFillColor
(
aGrayColor
);
if
(
3
<=
i
&&
6
>
i
)
if
(
3
<=
i
&&
6
>
i
)
{
long
nLeft
=
nLeftMargin
*
aLineSiz
.
Width
()
/
aSize
.
Width
();
long
nFirst
=
nFirstLineOfst
*
aLineSiz
.
Width
()
/
aSize
.
Width
();
long
nTmp
=
nLeft
+
nFirst
;
if
(
3
==
i
)
if
(
i
==
3
)
{
aPnt
.
X
()
+=
nTmp
;
aSiz
.
Width
()
-=
nTmp
;
...
...
@@ -121,36 +115,47 @@ void SvxParaPrevWindow::DrawParagraph( bool bAll )
aSiz
.
Width
()
-=
nRight
;
}
if
(
4
==
i
||
5
==
i
||
6
==
i
)
if
(
4
==
i
||
5
==
i
||
6
==
i
)
{
switch
(
eLine
)
switch
(
eLine
)
{
case
SVX_PREV_LINESPACE_1
:
break
;
case
SVX_PREV_LINESPACE_15
:
aPnt
.
Y
()
+=
nH
/
2
;
break
;
case
SVX_PREV_LINESPACE_2
:
aPnt
.
Y
()
+=
nH
;
break
;
case
SVX_PREV_LINESPACE_1
:
break
;
case
SVX_PREV_LINESPACE_15
:
aPnt
.
Y
()
+=
nH
/
2
;
break
;
case
SVX_PREV_LINESPACE_2
:
aPnt
.
Y
()
+=
nH
;
break
;
case
SVX_PREV_LINESPACE_PROP
:
case
SVX_PREV_LINESPACE_MIN
:
case
SVX_PREV_LINESPACE_DURCH
:
break
;
case
SVX_PREV_LINESPACE_DURCH
:
break
;
}
}
aPnt
.
Y
()
+=
nH
;
if
(
(
3
<=
i
)
&&
(
5
>=
i
)
)
if
(
3
<=
i
&&
5
>=
i
)
{
long
nLW
=
long
();
switch
(
i
)
switch
(
i
)
{
case
3
:
nLW
=
aLineSiz
.
Width
()
*
8
/
10
;
break
;
case
4
:
nLW
=
aLineSiz
.
Width
()
*
9
/
10
;
break
;
case
5
:
nLW
=
aLineSiz
.
Width
()
/
2
;
break
;
case
3
:
nLW
=
aLineSiz
.
Width
()
*
8
/
10
;
break
;
case
4
:
nLW
=
aLineSiz
.
Width
()
*
9
/
10
;
break
;
case
5
:
nLW
=
aLineSiz
.
Width
()
/
2
;
break
;
}
if
(
nLW
>
aSiz
.
Width
()
)
if
(
nLW
>
aSiz
.
Width
()
)
nLW
=
aSiz
.
Width
();
switch
(
eAdjust
)
switch
(
eAdjust
)
{
case
SVX_ADJUST_LEFT
:
break
;
...
...
@@ -162,9 +167,9 @@ void SvxParaPrevWindow::DrawParagraph( bool bAll )
break
;
default
:
;
//prevent warning
}
if
(
SVX_ADJUST_BLOCK
==
eAdjust
)
if
(
SVX_ADJUST_BLOCK
==
eAdjust
)
{
if
(
5
==
i
)
if
(
5
==
i
)
{
switch
(
eLastLine
)
{
...
...
@@ -188,22 +193,22 @@ void SvxParaPrevWindow::DrawParagraph( bool bAll )
aSiz
.
Width
()
=
nLW
;
}
Rectangle
aRect
(
aPnt
,
aSiz
);
Rectangle
aRect
(
aPnt
,
aSiz
);
if
(
Lines
[
i
]
!=
aRect
||
bAll
)
if
(
Lines
[
i
]
!=
aRect
||
bAll
)
{
if
(
!
bAll
)
if
(
!
bAll
)
{
Color
aFillCol
=
GetFillColor
();
SetFillColor
(
rWinColor
);
DrawRect
(
Lines
[
i
]
);
SetFillColor
(
aFillCol
);
Color
aFillCol
=
rRenderContext
.
GetFillColor
();
rRenderContext
.
SetFillColor
(
rWinColor
);
rRenderContext
.
DrawRect
(
Lines
[
i
]
);
rRenderContext
.
SetFillColor
(
aFillCol
);
}
DrawRect
(
aRect
);
Lines
[
i
]
=
aRect
;
}
if
(
5
==
i
)
if
(
5
==
i
)
{
long
nBottom
=
nLower
*
aLineSiz
.
Height
()
/
aSize
.
Height
();
aPnt
.
Y
()
+=
nBottom
*
2
;
...
...
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