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
37b8f4e0
Kaydet (Commit)
37b8f4e0
authored
May 12, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
refactor SvxFontPrevWindow to use RenderContext + clean-up
Change-Id: Ibbb23adff4c38b4c819894b6714de355f13219c3
üst
a7246759
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
417 additions
and
431 deletions
+417
-431
fntctrl.hxx
include/svx/fntctrl.hxx
+6
-7
fntctrl.cxx
svx/source/dialog/fntctrl.cxx
+411
-424
No files found.
include/svx/fntctrl.hxx
Dosyayı görüntüle @
37b8f4e0
...
@@ -27,26 +27,25 @@
...
@@ -27,26 +27,25 @@
#include <rtl/ustring.hxx>
#include <rtl/ustring.hxx>
// forward ---------------------------------------------------------------
class
SfxItemSet
;
class
SfxItemSet
;
class
FontPrevWin_Impl
;
class
FontPrevWin_Impl
;
// class SvxFontPrevWindow -----------------------------------------------
class
SVX_DLLPUBLIC
SAL_WARN_UNUSED
SvxFontPrevWindow
:
public
vcl
::
Window
class
SVX_DLLPUBLIC
SAL_WARN_UNUSED
SvxFontPrevWindow
:
public
vcl
::
Window
{
{
using
OutputDevice
::
SetFont
;
using
OutputDevice
::
SetFont
;
private
:
private
:
FontPrevWin_Impl
*
pImpl
;
std
::
unique_ptr
<
FontPrevWin_Impl
>
pImpl
;
bool
mbResetForeground
:
1
;
bool
mbResetBackground
:
1
;
SVX_DLLPRIVATE
void
InitSettings
(
bool
bForeground
,
bool
bBackground
);
SVX_DLLPRIVATE
void
ResetSettings
(
bool
bForeground
,
bool
bBackground
);
SVX_DLLPRIVATE
void
ApplySettings
(
vcl
::
RenderContext
&
rRenderContext
);
SVX_DLLPRIVATE
void
Init
();
SVX_DLLPRIVATE
void
Init
();
SVX_DLLPRIVATE
void
SetFontSize
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
);
SVX_DLLPRIVATE
void
SetFontSize
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
);
SVX_DLLPRIVATE
void
SetFontLang
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
);
SVX_DLLPRIVATE
void
SetFontLang
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
);
public
:
public
:
SvxFontPrevWindow
(
vcl
::
Window
*
pParent
,
const
ResId
&
rId
);
SvxFontPrevWindow
(
vcl
::
Window
*
pParent
,
const
ResId
&
rId
);
SvxFontPrevWindow
(
vcl
::
Window
*
pParent
,
WinBits
nStyle
);
SvxFontPrevWindow
(
vcl
::
Window
*
pParent
,
WinBits
nStyle
);
virtual
~
SvxFontPrevWindow
();
virtual
~
SvxFontPrevWindow
();
virtual
void
dispose
()
SAL_OVERRIDE
;
virtual
void
dispose
()
SAL_OVERRIDE
;
...
...
svx/source/dialog/fntctrl.cxx
Dosyayı görüntüle @
37b8f4e0
...
@@ -83,80 +83,80 @@ using ::com::sun::star::i18n::BreakIterator;
...
@@ -83,80 +83,80 @@ using ::com::sun::star::i18n::BreakIterator;
namespace
namespace
{
{
void
scaleFontWidth
(
vcl
::
Font
&
_rFont
,
const
OutputDevice
&
rOutDev
,
long
&
_
n100PercentFont
)
void
scaleFontWidth
(
vcl
::
Font
&
rFont
,
vcl
::
RenderContext
&
rRenderContext
,
long
&
n100PercentFont
)
{
{
_rFont
.
SetWidth
(
0
);
rFont
.
SetWidth
(
0
);
_n100PercentFont
=
rOutDev
.
GetFontMetric
(
_rFont
).
GetWidth
();
n100PercentFont
=
rRenderContext
.
GetFontMetric
(
rFont
).
GetWidth
();
}
}
void
initFont
(
vcl
::
Font
&
_
rFont
)
void
initFont
(
vcl
::
Font
&
rFont
)
{
{
_
rFont
.
SetTransparent
(
true
);
rFont
.
SetTransparent
(
true
);
_
rFont
.
SetAlign
(
ALIGN_BASELINE
);
rFont
.
SetAlign
(
ALIGN_BASELINE
);
}
}
void
setFontSize
(
vcl
::
Font
&
_
rFont
)
void
setFontSize
(
vcl
::
Font
&
rFont
)
{
{
Size
aSize
(
_rFont
.
GetSize
()
);
Size
aSize
(
rFont
.
GetSize
()
);
aSize
.
Height
()
=
(
aSize
.
Height
()
*
3
)
/
5
;
aSize
.
Height
()
=
(
aSize
.
Height
()
*
3
)
/
5
;
aSize
.
Width
()
=
(
aSize
.
Width
()
*
3
)
/
5
;
aSize
.
Width
()
=
(
aSize
.
Width
()
*
3
)
/
5
;
_rFont
.
SetSize
(
aSize
);
rFont
.
SetSize
(
aSize
);
}
}
void
calcFontHeightAnyAscent
(
OutputDevice
*
_pWin
,
const
vcl
::
Font
&
_rFont
,
long
&
_nHeight
,
long
&
_
nAscent
)
void
calcFontHeightAnyAscent
(
vcl
::
RenderContext
&
rRenderContext
,
const
vcl
::
Font
&
rFont
,
long
&
nHeight
,
long
&
nAscent
)
{
{
if
(
!
_nHeight
)
if
(
!
nHeight
)
{
{
_pWin
->
SetFont
(
_rFont
);
rRenderContext
.
SetFont
(
rFont
);
FontMetric
aMetric
(
_pWin
->
GetFontMetric
()
);
FontMetric
aMetric
(
rRenderContext
.
GetFontMetric
());
_nHeight
=
aMetric
.
GetLineHeight
();
nHeight
=
aMetric
.
GetLineHeight
();
_nAscent
=
aMetric
.
GetAscent
();
nAscent
=
aMetric
.
GetAscent
();
}
}
}
}
void
setFont
(
const
SvxFont
&
rNewFont
,
SvxFont
&
rImplFont
)
void
setFont
(
const
SvxFont
&
rNewFont
,
SvxFont
&
rImplFont
)
{
{
rImplFont
=
rNewFont
;
rImplFont
=
rNewFont
;
rImplFont
.
SetTransparent
(
true
);
rImplFont
.
SetTransparent
(
true
);
rImplFont
.
SetAlign
(
ALIGN_BASELINE
);
rImplFont
.
SetAlign
(
ALIGN_BASELINE
);
}
}
}
}
// end anonymous namespace
class
FontPrevWin_Impl
class
FontPrevWin_Impl
{
{
friend
class
SvxFontPrevWindow
;
friend
class
SvxFontPrevWindow
;
SvxFont
aFont
;
SvxFont
m
aFont
;
VclPtr
<
Printer
>
pPrinter
;
VclPtr
<
Printer
>
m
pPrinter
;
bool
bDelPrinter
;
bool
m
bDelPrinter
;
Reference
<
XBreakIterator
>
xBreak
;
Reference
<
XBreakIterator
>
m
xBreak
;
std
::
vector
<
sal_uIntPtr
>
aTextWidth
;
std
::
vector
<
sal_uIntPtr
>
m
aTextWidth
;
std
::
deque
<
sal_Int32
>
aScriptChg
;
std
::
deque
<
sal_Int32
>
m
aScriptChg
;
std
::
vector
<
sal_uInt16
>
aScriptType
;
std
::
vector
<
sal_uInt16
>
m
aScriptType
;
SvxFont
aCJKFont
;
SvxFont
m
aCJKFont
;
SvxFont
aCTLFont
;
SvxFont
m
aCTLFont
;
OUString
aText
;
OUString
m
aText
;
OUString
aScriptText
;
OUString
m
aScriptText
;
Color
*
pColor
;
Color
*
m
pColor
;
Color
*
pBackColor
;
Color
*
m
pBackColor
;
long
nAscent
;
long
m
nAscent
;
sal_Unicode
cStartBracket
;
sal_Unicode
m
cStartBracket
;
sal_Unicode
cEndBracket
;
sal_Unicode
m
cEndBracket
;
long
n100PercentFontWidth
;
// initial -1 -> not set yet
long
mn100PercentFontWidth
;
// initial -1 -> not set yet
long
n100PercentFontWidthCJK
;
long
m
n100PercentFontWidthCJK
;
long
n100PercentFontWidthCTL
;
long
m
n100PercentFontWidthCTL
;
sal_uInt16
nFontWidthScale
;
sal_uInt16
m
nFontWidthScale
;
bool
bSelection
:
1
,
bool
mbSelection
:
1
;
bGetSelection
:
1
,
bool
mbGetSelection
:
1
;
bUseResText
:
1
,
bool
mbUseResText
:
1
;
bPreviewBackgroundToCharacter
:
1
,
bool
mbPreviewBackgroundToCharacter
:
1
;
bTwoLines
:
1
,
bool
mbTwoLines
:
1
;
bUseFontNameAsText
:
1
,
bool
mbUseFontNameAsText
:
1
;
bTextInited
:
1
;
bool
mbTextInited
:
1
;
bool
m_bCJKEnabled
;
bool
m_bCJKEnabled
;
bool
m_bCTLEnabled
;
bool
m_bCTLEnabled
;
...
@@ -164,12 +164,21 @@ class FontPrevWin_Impl
...
@@ -164,12 +164,21 @@ class FontPrevWin_Impl
public
:
public
:
inline
FontPrevWin_Impl
()
:
inline
FontPrevWin_Impl
()
:
pPrinter
(
NULL
),
bDelPrinter
(
false
),
mpPrinter
(
nullptr
),
pColor
(
NULL
),
pBackColor
(
0
),
nAscent
(
0
),
mbDelPrinter
(
false
),
cStartBracket
(
0
),
cEndBracket
(
0
),
nFontWidthScale
(
100
),
mpColor
(
nullptr
),
bSelection
(
false
),
bGetSelection
(
false
),
bUseResText
(
false
),
mpBackColor
(
0
),
bPreviewBackgroundToCharacter
(
false
),
bTwoLines
(
false
),
mnAscent
(
0
),
bUseFontNameAsText
(
false
),
bTextInited
(
false
)
mcStartBracket
(
0
),
mcEndBracket
(
0
),
mnFontWidthScale
(
100
),
mbSelection
(
false
),
mbGetSelection
(
false
),
mbUseResText
(
false
),
mbPreviewBackgroundToCharacter
(
false
),
mbTwoLines
(
false
),
mbUseFontNameAsText
(
false
),
mbTextInited
(
false
)
{
{
SvtLanguageOptions
aLanguageOptions
;
SvtLanguageOptions
aLanguageOptions
;
m_bCJKEnabled
=
aLanguageOptions
.
IsAnyEnabled
();
m_bCJKEnabled
=
aLanguageOptions
.
IsAnyEnabled
();
...
@@ -180,37 +189,37 @@ public:
...
@@ -180,37 +189,37 @@ public:
inline
~
FontPrevWin_Impl
()
inline
~
FontPrevWin_Impl
()
{
{
delete
pColor
;
delete
m
pColor
;
delete
pBackColor
;
delete
m
pBackColor
;
if
(
bDelPrinter
)
if
(
mbDelPrinter
)
pPrinter
.
disposeAndClear
();
m
pPrinter
.
disposeAndClear
();
}
}
void
CheckScript
();
void
CheckScript
();
Size
CalcTextSize
(
OutputDevice
*
pWin
,
OutputDevice
*
pPrt
,
const
SvxFont
&
rFont
);
Size
CalcTextSize
(
vcl
::
RenderContext
&
rRenderContext
,
OutputDevice
*
pPrinter
,
const
SvxFont
&
rFont
);
void
DrawPrev
(
OutputDevice
*
pWin
,
Printer
*
pPrt
,
Point
&
rPt
,
const
SvxFont
&
rFont
);
void
DrawPrev
(
vcl
::
RenderContext
&
rRenderContext
,
Printer
*
pPrinter
,
Point
&
rPt
,
const
SvxFont
&
rFont
);
bool
SetFontWidthScale
(
sal_uInt16
nScaleInPercent
);
bool
SetFontWidthScale
(
sal_uInt16
nScaleInPercent
);
inline
void
Invalidate100PercentFontWidth
();
inline
void
Invalidate100PercentFontWidth
();
inline
bool
Is100PercentFontWidthValid
()
const
;
inline
bool
Is100PercentFontWidthValid
()
const
;
void
ScaleFontWidth
(
const
OutputDevice
&
rOutDev
);
void
ScaleFontWidth
(
vcl
::
RenderContext
&
rRenderContext
);
// scales rNonCJKFont and aCJKFont depending on nFontWidthScale and
// scales rNonCJKFont and aCJKFont depending on nFontWidthScale and
// sets the 100%-Font-Widths
// sets the 100%-Font-Widths
};
};
inline
void
FontPrevWin_Impl
::
Invalidate100PercentFontWidth
()
inline
void
FontPrevWin_Impl
::
Invalidate100PercentFontWidth
()
{
{
n100PercentFontWidth
=
n100PercentFontWidthCJK
=
n100PercentFontWidthCTL
=
-
1
;
mn100PercentFontWidth
=
mn100PercentFontWidthCJK
=
m
n100PercentFontWidthCTL
=
-
1
;
}
}
inline
bool
FontPrevWin_Impl
::
Is100PercentFontWidthValid
()
const
inline
bool
FontPrevWin_Impl
::
Is100PercentFontWidthValid
()
const
{
{
DBG_ASSERT
(
(
n100PercentFontWidth
==
-
1
&&
n100PercentFontWidthCJK
==
-
1
)
||
DBG_ASSERT
(
(
mn100PercentFontWidth
==
-
1
&&
m
n100PercentFontWidthCJK
==
-
1
)
||
(
n100PercentFontWidth
!=
-
1
&&
n100PercentFontWidthCJK
!=
-
1
)
||
(
mn100PercentFontWidth
!=
-
1
&&
m
n100PercentFontWidthCJK
!=
-
1
)
||
(
n100PercentFontWidth
==
-
1
&&
n100PercentFontWidthCTL
==
-
1
)
||
(
mn100PercentFontWidth
==
-
1
&&
m
n100PercentFontWidthCTL
==
-
1
)
||
(
n100PercentFontWidth
!=
-
1
&&
n100PercentFontWidthCTL
!=
-
1
),
(
mn100PercentFontWidth
!=
-
1
&&
m
n100PercentFontWidthCTL
!=
-
1
),
"*FontPrevWin_Impl::Is100PercentFontWidthValid(): 100PercentFontWidth's not synchronous"
);
"*FontPrevWin_Impl::Is100PercentFontWidthValid(): 100PercentFontWidth's not synchronous"
);
return
n100PercentFontWidth
!=
-
1
;
return
m
n100PercentFontWidth
!=
-
1
;
}
}
/*
/*
...
@@ -221,52 +230,52 @@ inline bool FontPrevWin_Impl::Is100PercentFontWidthValid() const
...
@@ -221,52 +230,52 @@ inline bool FontPrevWin_Impl::Is100PercentFontWidthValid() const
*/
*/
void
FontPrevWin_Impl
::
CheckScript
()
void
FontPrevWin_Impl
::
CheckScript
()
{
{
assert
(
!
aText
.
isEmpty
());
// must have a preview text here!
assert
(
!
m
aText
.
isEmpty
());
// must have a preview text here!
if
(
aText
==
aScriptText
)
if
(
maText
==
m
aScriptText
)
{
{
return
;
// already initialized
return
;
// already initialized
}
}
aScriptText
=
aText
;
maScriptText
=
m
aText
;
aScriptChg
.
clear
();
m
aScriptChg
.
clear
();
aScriptType
.
clear
();
m
aScriptType
.
clear
();
aTextWidth
.
clear
();
m
aTextWidth
.
clear
();
if
(
!
xBreak
.
is
()
)
if
(
!
mxBreak
.
is
()
)
{
{
Reference
<
XComponentContext
>
xContext
=
::
comphelper
::
getProcessComponentContext
();
Reference
<
XComponentContext
>
xContext
=
::
comphelper
::
getProcessComponentContext
();
xBreak
=
BreakIterator
::
create
(
xContext
);
m
xBreak
=
BreakIterator
::
create
(
xContext
);
}
}
sal_uInt16
nScript
=
0
;
sal_uInt16
nScript
=
0
;
sal_Int32
nChg
=
0
;
sal_Int32
nChg
=
0
;
while
(
nChg
<
aText
.
getLength
()
)
while
(
nChg
<
maText
.
getLength
()
)
{
{
nScript
=
xBreak
->
getScriptType
(
aText
,
nChg
);
nScript
=
mxBreak
->
getScriptType
(
maText
,
nChg
);
nChg
=
xBreak
->
endOfScript
(
aText
,
nChg
,
nScript
);
nChg
=
mxBreak
->
endOfScript
(
maText
,
nChg
,
nScript
);
if
(
nChg
<
aText
.
getLength
()
&&
nChg
>
0
&&
if
(
nChg
<
m
aText
.
getLength
()
&&
nChg
>
0
&&
(
c
om
::
sun
::
star
::
i18n
::
ScriptType
::
WEAK
==
(
c
ss
::
i18n
::
ScriptType
::
WEAK
==
xBreak
->
getScriptType
(
aText
,
nChg
-
1
)))
mxBreak
->
getScriptType
(
m
aText
,
nChg
-
1
)))
{
{
int8_t
nType
=
u_charType
(
aText
[
nChg
]
);
int8_t
nType
=
u_charType
(
maText
[
nChg
]
);
if
(
nType
==
U_NON_SPACING_MARK
||
nType
==
U_ENCLOSING_MARK
||
if
(
nType
==
U_NON_SPACING_MARK
||
nType
==
U_ENCLOSING_MARK
||
nType
==
U_COMBINING_SPACING_MARK
)
nType
==
U_COMBINING_SPACING_MARK
)
{
{
aScriptChg
.
push_back
(
nChg
-
1
);
maScriptChg
.
push_back
(
nChg
-
1
);
}
}
else
else
{
{
aScriptChg
.
push_back
(
nChg
);
maScriptChg
.
push_back
(
nChg
);
}
}
}
}
else
else
{
{
aScriptChg
.
push_back
(
nChg
);
maScriptChg
.
push_back
(
nChg
);
}
}
aScriptType
.
push_back
(
nScript
);
maScriptType
.
push_back
(
nScript
);
aTextWidth
.
push_back
(
0
);
maTextWidth
.
push_back
(
0
);
}
}
}
}
...
@@ -280,77 +289,88 @@ void FontPrevWin_Impl::CheckScript()
...
@@ -280,77 +289,88 @@ void FontPrevWin_Impl::CheckScript()
* The member nAscent is calculated to the maximal ascent of all used fonts.
* The member nAscent is calculated to the maximal ascent of all used fonts.
*/
*/
Size
FontPrevWin_Impl
::
CalcTextSize
(
OutputDevice
*
pWin
,
OutputDevice
*
_pPrinter
,
Size
FontPrevWin_Impl
::
CalcTextSize
(
vcl
::
RenderContext
&
rRenderContext
,
OutputDevice
*
_pPrinter
,
const
SvxFont
&
rInFont
)
const
SvxFont
&
rFont
)
{
{
sal_uInt16
nScript
;
sal_uInt16
nScript
;
sal_uInt16
nIdx
=
0
;
sal_uInt16
nIdx
=
0
;
sal_Int32
nStart
=
0
;
sal_Int32
nStart
=
0
;
sal_Int32
nEnd
;
sal_Int32
nEnd
;
size_t
nCnt
=
aScriptChg
.
size
();
size_t
nCnt
=
maScriptChg
.
size
();
if
(
nCnt
)
if
(
nCnt
)
{
{
nEnd
=
aScriptChg
[
nIdx
];
nEnd
=
maScriptChg
[
nIdx
];
nScript
=
aScriptType
[
nIdx
];
nScript
=
maScriptType
[
nIdx
];
}
}
else
else
{
{
nEnd
=
aText
.
getLength
();
nEnd
=
m
aText
.
getLength
();
nScript
=
c
om
::
sun
::
star
::
i18n
::
ScriptType
::
LATIN
;
nScript
=
c
ss
::
i18n
::
ScriptType
::
LATIN
;
}
}
long
nTxtWidth
=
0
;
long
nTxtWidth
=
0
;
long
nCJKHeight
=
0
;
long
nCJKHeight
=
0
;
long
nCTLHeight
=
0
;
long
nCTLHeight
=
0
;
long
nHeight
=
0
;
long
nHeight
=
0
;
nAscent
=
0
;
m
nAscent
=
0
;
long
nCJKAscent
=
0
;
long
nCJKAscent
=
0
;
long
nCTLAscent
=
0
;
long
nCTLAscent
=
0
;
do
do
{
{
const
SvxFont
&
rFnt
=
(
nScript
==
com
::
sun
::
star
::
i18n
::
ScriptType
::
ASIAN
)
?
aCJKFont
:
((
nScript
==
com
::
sun
::
star
::
i18n
::
ScriptType
::
COMPLEX
)
?
aCTLFont
:
rFont
);
const
SvxFont
&
rFont
=
(
nScript
==
css
::
i18n
::
ScriptType
::
ASIAN
)
?
sal_uIntPtr
nWidth
=
rFnt
.
GetTxtSize
(
_pPrinter
,
aText
,
nStart
,
nEnd
-
nStart
).
maCJKFont
:
Width
();
((
nScript
==
css
::
i18n
::
ScriptType
::
COMPLEX
)
?
if
(
nIdx
>=
aTextWidth
.
size
())
maCTLFont
:
rInFont
);
sal_uIntPtr
nWidth
=
rFont
.
GetTxtSize
(
_pPrinter
,
maText
,
nStart
,
nEnd
-
nStart
).
Width
();
if
(
nIdx
>=
maTextWidth
.
size
())
break
;
break
;
aTextWidth
[
nIdx
++
]
=
nWidth
;
maTextWidth
[
nIdx
++
]
=
nWidth
;
nTxtWidth
+=
nWidth
;
nTxtWidth
+=
nWidth
;
switch
(
nScript
)
switch
(
nScript
)
{
{
case
c
om
:
:
sun
::
star
::
i18n
::
ScriptType
::
ASIAN
:
case
c
ss
:
:
i18n
::
ScriptType
::
ASIAN
:
calcFontHeightAnyAscent
(
pWin
,
aCJKFont
,
nCJKHeight
,
nCJKAscent
);
calcFontHeightAnyAscent
(
rRenderContext
,
maCJKFont
,
nCJKHeight
,
nCJKAscent
);
break
;
break
;
case
c
om
:
:
sun
::
star
::
i18n
::
ScriptType
::
COMPLEX
:
case
c
ss
:
:
i18n
::
ScriptType
::
COMPLEX
:
calcFontHeightAnyAscent
(
pWin
,
aCTLFont
,
nCTLHeight
,
nCTLAscent
);
calcFontHeightAnyAscent
(
rRenderContext
,
maCTLFont
,
nCTLHeight
,
nCTLAscent
);
break
;
break
;
default
:
default
:
calcFontHeightAnyAscent
(
pWin
,
rFont
,
nHeight
,
nAscent
);
calcFontHeightAnyAscent
(
rRenderContext
,
rFont
,
nHeight
,
m
nAscent
);
}
}
if
(
nEnd
<
aText
.
getLength
()
&&
nIdx
<
nCnt
)
if
(
nEnd
<
maText
.
getLength
()
&&
nIdx
<
nCnt
)
{
{
nStart
=
nEnd
;
nStart
=
nEnd
;
nEnd
=
aScriptChg
[
nIdx
];
nEnd
=
maScriptChg
[
nIdx
];
nScript
=
aScriptType
[
nIdx
];
nScript
=
maScriptType
[
nIdx
];
}
}
else
else
break
;
break
;
}
}
while
(
true
);
while
(
true
);
nHeight
-=
nAscent
;
nHeight
-=
mnAscent
;
nCJKHeight
-=
nCJKAscent
;
nCJKHeight
-=
nCJKAscent
;
nCTLHeight
-=
nCTLAscent
;
nCTLHeight
-=
nCTLAscent
;
if
(
nHeight
<
nCJKHeight
)
if
(
nHeight
<
nCJKHeight
)
nHeight
=
nCJKHeight
;
nHeight
=
nCJKHeight
;
if
(
nAscent
<
nCJKAscent
)
nAscent
=
nCJKAscent
;
if
(
mnAscent
<
nCJKAscent
)
if
(
nHeight
<
nCTLHeight
)
mnAscent
=
nCJKAscent
;
if
(
nHeight
<
nCTLHeight
)
nHeight
=
nCTLHeight
;
nHeight
=
nCTLHeight
;
if
(
nAscent
<
nCTLAscent
)
nAscent
=
nCTLAscent
;
nHeight
+=
nAscent
;
Size
aTxtSize
(
nTxtWidth
,
nHeight
);
if
(
mnAscent
<
nCTLAscent
)
mnAscent
=
nCTLAscent
;
nHeight
+=
mnAscent
;
Size
aTxtSize
(
nTxtWidth
,
nHeight
);
return
aTxtSize
;
return
aTxtSize
;
}
}
...
@@ -361,131 +381,143 @@ Size FontPrevWin_Impl::CalcTextSize( OutputDevice* pWin, OutputDevice* _pPrinter
...
@@ -361,131 +381,143 @@ Size FontPrevWin_Impl::CalcTextSize( OutputDevice* pWin, OutputDevice* _pPrinter
* given rFont.
* given rFont.
*/
*/
void
FontPrevWin_Impl
::
DrawPrev
(
OutputDevice
*
pWin
,
Printer
*
_pPrinter
,
void
FontPrevWin_Impl
::
DrawPrev
(
vcl
::
RenderContext
&
rRenderContext
,
Printer
*
_pPrinter
,
Point
&
rPt
,
const
SvxFont
&
rInFont
)
Point
&
rPt
,
const
SvxFont
&
rFont
)
{
{
vcl
::
Font
aOldFont
=
_pPrinter
->
GetFont
();
vcl
::
Font
aOldFont
=
_pPrinter
->
GetFont
();
sal_uInt16
nScript
;
sal_uInt16
nScript
;
sal_uInt16
nIdx
=
0
;
sal_uInt16
nIdx
=
0
;
sal_Int32
nStart
=
0
;
sal_Int32
nStart
=
0
;
sal_Int32
nEnd
;
sal_Int32
nEnd
;
size_t
nCnt
=
aScriptChg
.
size
();
size_t
nCnt
=
m
aScriptChg
.
size
();
if
(
nCnt
)
if
(
nCnt
)
{
{
nEnd
=
aScriptChg
[
nIdx
];
nEnd
=
maScriptChg
[
nIdx
];
nScript
=
aScriptType
[
nIdx
];
nScript
=
maScriptType
[
nIdx
];
}
}
else
else
{
{
nEnd
=
aText
.
getLength
();
nEnd
=
m
aText
.
getLength
();
nScript
=
c
om
::
sun
::
star
::
i18n
::
ScriptType
::
LATIN
;
nScript
=
c
ss
::
i18n
::
ScriptType
::
LATIN
;
}
}
do
do
{
{
const
SvxFont
&
rFnt
=
(
nScript
==
com
::
sun
::
star
::
i18n
::
ScriptType
::
ASIAN
)
?
aCJKFont
:
((
nScript
==
com
::
sun
::
star
::
i18n
::
ScriptType
::
COMPLEX
)
?
aCTLFont
:
rFont
);
const
SvxFont
&
rFont
=
(
nScript
==
css
::
i18n
::
ScriptType
::
ASIAN
)
_pPrinter
->
SetFont
(
rFnt
);
?
maCJKFont
:
((
nScript
==
css
::
i18n
::
ScriptType
::
COMPLEX
)
?
maCTLFont
:
rInFont
);
_pPrinter
->
SetFont
(
rFont
);
rF
nt
.
DrawPrev
(
pWin
,
_pPrinter
,
rPt
,
aText
,
nStart
,
nEnd
-
nStart
);
rF
ont
.
DrawPrev
(
&
rRenderContext
,
_pPrinter
,
rPt
,
maText
,
nStart
,
nEnd
-
nStart
);
rPt
.
X
()
+=
aTextWidth
[
nIdx
++
];
rPt
.
X
()
+=
maTextWidth
[
nIdx
++
];
if
(
nEnd
<
aText
.
getLength
()
&&
nIdx
<
nCnt
)
if
(
nEnd
<
maText
.
getLength
()
&&
nIdx
<
nCnt
)
{
{
nStart
=
nEnd
;
nStart
=
nEnd
;
nEnd
=
aScriptChg
[
nIdx
];
nEnd
=
maScriptChg
[
nIdx
];
nScript
=
aScriptType
[
nIdx
];
nScript
=
maScriptType
[
nIdx
];
}
}
else
else
break
;
break
;
}
}
while
(
true
);
while
(
true
);
_pPrinter
->
SetFont
(
aOldFont
);
_pPrinter
->
SetFont
(
aOldFont
);
}
}
bool
FontPrevWin_Impl
::
SetFontWidthScale
(
sal_uInt16
nScale
)
bool
FontPrevWin_Impl
::
SetFontWidthScale
(
sal_uInt16
nScale
)
{
{
if
(
nFontWidthScale
!=
nScale
)
if
(
mnFontWidthScale
!=
nScale
)
{
{
nFontWidthScale
=
nScale
;
m
nFontWidthScale
=
nScale
;
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
}
void
FontPrevWin_Impl
::
ScaleFontWidth
(
vcl
::
RenderContext
&
rOutDev
)
void
FontPrevWin_Impl
::
ScaleFontWidth
(
const
OutputDevice
&
rOutDev
)
{
{
if
(
!
Is100PercentFontWidthValid
()
)
if
(
!
Is100PercentFontWidthValid
()
)
{
{
scaleFontWidth
(
aFont
,
rOutDev
,
n100PercentFontWidth
);
scaleFontWidth
(
maFont
,
rOutDev
,
m
n100PercentFontWidth
);
scaleFontWidth
(
aCJKFont
,
rOutDev
,
n100PercentFontWidthCJK
);
scaleFontWidth
(
maCJKFont
,
rOutDev
,
m
n100PercentFontWidthCJK
);
scaleFontWidth
(
aCTLFont
,
rOutDev
,
n100PercentFontWidthCTL
);
scaleFontWidth
(
maCTLFont
,
rOutDev
,
m
n100PercentFontWidthCTL
);
}
}
aFont
.
SetWidth
(
n100PercentFontWidth
*
nFontWidthScale
/
100
);
maFont
.
SetWidth
(
mn100PercentFontWidth
*
mnFontWidthScale
/
100
);
aCJKFont
.
SetWidth
(
n100PercentFontWidthCJK
*
nFontWidthScale
/
100
);
maCJKFont
.
SetWidth
(
mn100PercentFontWidthCJK
*
mnFontWidthScale
/
100
);
aCTLFont
.
SetWidth
(
n100PercentFontWidthCTL
*
nFontWidthScale
/
100
);
maCTLFont
.
SetWidth
(
mn100PercentFontWidthCTL
*
mnFontWidthScale
/
100
);
}
void
SvxFontPrevWindow
::
ResetSettings
(
bool
bForeground
,
bool
bBackground
)
{
mbResetForeground
=
bForeground
;
mbResetBackground
=
bBackground
;
Invalidate
();
}
}
void
SvxFontPrevWindow
::
InitSettings
(
bool
bForeground
,
bool
bBackground
)
void
SvxFontPrevWindow
::
ApplySettings
(
vcl
::
RenderContext
&
rRenderContext
)
{
{
const
StyleSettings
&
rStyleSettings
=
Application
::
GetSettings
().
GetStyleSettings
();
const
StyleSettings
&
rStyleSettings
=
Application
::
GetSettings
().
GetStyleSettings
();
if
(
bForeground
)
if
(
mbResetForeground
)
{
{
svtools
::
ColorConfig
aColorConfig
;
svtools
::
ColorConfig
aColorConfig
;
Color
aTextColor
(
aColorConfig
.
GetColorValue
(
svtools
::
FONTCOLOR
).
nColor
);
Color
aTextColor
(
aColorConfig
.
GetColorValue
(
svtools
::
FONTCOLOR
).
nColor
);
if
(
IsControlForeground
()
)
if
(
IsControlForeground
()
)
aTextColor
=
GetControlForeground
();
aTextColor
=
GetControlForeground
();
SetTextColor
(
aTextColor
);
rRenderContext
.
SetTextColor
(
aTextColor
);
mbResetForeground
=
false
;
}
}
if
(
bBackground
)
if
(
mbResetBackground
)
{
{
if
(
IsControlBackground
()
)
if
(
IsControlBackground
()
)
SetBackground
(
GetControlBackground
()
);
rRenderContext
.
SetBackground
(
GetControlBackground
()
);
else
else
SetBackground
(
rStyleSettings
.
GetWindowColor
()
);
rRenderContext
.
SetBackground
(
rStyleSettings
.
GetWindowColor
());
mbResetBackground
=
false
;
}
}
Invalidate
();
}
}
void
SvxFontPrevWindow
::
Init
()
void
SvxFontPrevWindow
::
Init
()
{
{
pImpl
=
new
FontPrevWin_Impl
;
pImpl
.
reset
(
new
FontPrevWin_Impl
)
;
SfxViewShell
*
pSh
=
SfxViewShell
::
Current
();
SfxViewShell
*
pSh
=
SfxViewShell
::
Current
();
if
(
pSh
)
if
(
pSh
)
pImpl
->
pPrinter
=
pSh
->
GetPrinter
();
pImpl
->
m
pPrinter
=
pSh
->
GetPrinter
();
if
(
!
pImpl
->
pPrinter
)
if
(
!
pImpl
->
mpPrinter
)
{
{
pImpl
->
pPrinter
=
new
Printer
;
pImpl
->
m
pPrinter
=
new
Printer
;
pImpl
->
bDelPrinter
=
true
;
pImpl
->
m
bDelPrinter
=
true
;
}
}
SetMapMode
(
MapMode
(
MAP_TWIP
)
);
SetMapMode
(
MapMode
(
MAP_TWIP
));
initFont
(
pImpl
->
aFont
);
initFont
(
pImpl
->
maFont
);
initFont
(
pImpl
->
aCJKFont
);
initFont
(
pImpl
->
maCJKFont
);
initFont
(
pImpl
->
aCTLFont
);
initFont
(
pImpl
->
maCTLFont
);
InitSettings
(
true
,
true
);
SetBorderStyle
(
WindowBorderStyle
::
MONO
);
ResetSettings
(
true
,
true
);
SetBorderStyle
(
WindowBorderStyle
::
MONO
);
}
}
SvxFontPrevWindow
::
SvxFontPrevWindow
(
vcl
::
Window
*
pParent
,
const
ResId
&
rId
)
:
SvxFontPrevWindow
::
SvxFontPrevWindow
(
vcl
::
Window
*
pParent
,
const
ResId
&
rId
)
Window
(
pParent
,
rId
)
:
Window
(
pParent
,
rId
)
,
mbResetForeground
(
true
)
,
mbResetBackground
(
true
)
{
{
Init
();
Init
();
}
}
SvxFontPrevWindow
::
SvxFontPrevWindow
(
vcl
::
Window
*
pParent
,
WinBits
nStyle
)
SvxFontPrevWindow
::
SvxFontPrevWindow
(
vcl
::
Window
*
pParent
,
WinBits
nStyle
)
:
Window
(
pParent
,
nStyle
)
:
Window
(
pParent
,
nStyle
)
,
mbResetForeground
(
true
)
,
mbResetBackground
(
true
)
{
{
Init
();
Init
();
}
}
...
@@ -506,42 +538,35 @@ SvxFontPrevWindow::~SvxFontPrevWindow()
...
@@ -506,42 +538,35 @@ SvxFontPrevWindow::~SvxFontPrevWindow()
void
SvxFontPrevWindow
::
dispose
()
void
SvxFontPrevWindow
::
dispose
()
{
{
delete
pImpl
;
pImpl
.
reset
()
;
vcl
::
Window
::
dispose
();
vcl
::
Window
::
dispose
();
}
}
SvxFont
&
SvxFontPrevWindow
::
GetCTLFont
()
SvxFont
&
SvxFontPrevWindow
::
GetCTLFont
()
{
{
return
pImpl
->
aCTLFont
;
return
pImpl
->
m
aCTLFont
;
}
}
SvxFont
&
SvxFontPrevWindow
::
GetCJKFont
()
SvxFont
&
SvxFontPrevWindow
::
GetCJKFont
()
{
{
return
pImpl
->
aCJKFont
;
return
pImpl
->
m
aCJKFont
;
}
}
void
SvxFontPrevWindow
::
StateChanged
(
StateChangedType
nType
)
void
SvxFontPrevWindow
::
StateChanged
(
StateChangedType
nType
)
{
{
if
(
nType
==
StateChangedType
::
ControlForeground
)
if
(
nType
==
StateChangedType
::
ControlForeground
)
InitSettings
(
true
,
false
);
ResetSettings
(
true
,
false
);
else
if
(
nType
==
StateChangedType
::
ControlBackground
)
else
if
(
nType
==
StateChangedType
::
ControlBackground
)
InitSettings
(
false
,
true
);
ResetSettings
(
false
,
true
);
Window
::
StateChanged
(
nType
);
Window
::
StateChanged
(
nType
);
Invalidate
();
Invalidate
();
}
}
void
SvxFontPrevWindow
::
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
void
SvxFontPrevWindow
::
DataChanged
(
const
DataChangedEvent
&
rDCEvt
)
{
{
if
(
(
rDCEvt
.
GetType
()
==
DataChangedEventType
::
SETTINGS
)
&&
(
rDCEvt
.
GetFlags
()
&
AllSettingsFlags
::
STYLE
)
)
if
(
(
rDCEvt
.
GetType
()
==
DataChangedEventType
::
SETTINGS
)
&&
(
rDCEvt
.
GetFlags
()
&
AllSettingsFlags
::
STYLE
)
)
InitSettings
(
true
,
true
);
ResetSettings
(
true
,
true
);
else
else
Window
::
DataChanged
(
rDCEvt
);
Window
::
DataChanged
(
rDCEvt
);
}
}
...
@@ -549,333 +574,312 @@ void SvxFontPrevWindow::DataChanged( const DataChangedEvent& rDCEvt )
...
@@ -549,333 +574,312 @@ void SvxFontPrevWindow::DataChanged( const DataChangedEvent& rDCEvt )
SvxFont
&
SvxFontPrevWindow
::
GetFont
()
SvxFont
&
SvxFontPrevWindow
::
GetFont
()
{
{
pImpl
->
Invalidate100PercentFontWidth
();
// because the user might change the size
pImpl
->
Invalidate100PercentFontWidth
();
// because the user might change the size
return
pImpl
->
aFont
;
return
pImpl
->
m
aFont
;
}
}
const
SvxFont
&
SvxFontPrevWindow
::
GetFont
()
const
const
SvxFont
&
SvxFontPrevWindow
::
GetFont
()
const
{
{
return
pImpl
->
aFont
;
return
pImpl
->
m
aFont
;
}
}
void
SvxFontPrevWindow
::
SetPreviewText
(
const
OUString
&
rString
)
void
SvxFontPrevWindow
::
SetPreviewText
(
const
OUString
&
rString
)
{
{
pImpl
->
aText
=
rString
;
pImpl
->
m
aText
=
rString
;
pImpl
->
bTextInited
=
true
;
pImpl
->
m
bTextInited
=
true
;
}
}
void
SvxFontPrevWindow
::
SetFontNameAsPreviewText
()
void
SvxFontPrevWindow
::
SetFontNameAsPreviewText
()
{
{
pImpl
->
bUseFontNameAsText
=
true
;
pImpl
->
m
bUseFontNameAsText
=
true
;
}
}
void
SvxFontPrevWindow
::
SetFont
(
const
SvxFont
&
rNormalOutFont
,
const
SvxFont
&
rCJKOutFont
,
const
SvxFont
&
rCTLFont
)
void
SvxFontPrevWindow
::
SetFont
(
const
SvxFont
&
rNormalOutFont
,
const
SvxFont
&
rCJKOutFont
,
const
SvxFont
&
rCTLFont
)
{
{
setFont
(
rNormalOutFont
,
pImpl
->
aFont
);
setFont
(
rNormalOutFont
,
pImpl
->
maFont
);
setFont
(
rCJKOutFont
,
pImpl
->
aCJKFont
);
setFont
(
rCJKOutFont
,
pImpl
->
maCJKFont
);
setFont
(
rCTLFont
,
pImpl
->
aCTLFont
);
setFont
(
rCTLFont
,
pImpl
->
maCTLFont
);
pImpl
->
Invalidate100PercentFontWidth
();
pImpl
->
Invalidate100PercentFontWidth
();
Invalidate
();
Invalidate
();
}
}
void
SvxFontPrevWindow
::
SetColor
(
const
Color
&
rColor
)
void
SvxFontPrevWindow
::
SetColor
(
const
Color
&
rColor
)
{
{
delete
pImpl
->
pColor
;
delete
pImpl
->
m
pColor
;
pImpl
->
pColor
=
new
Color
(
rColor
);
pImpl
->
mpColor
=
new
Color
(
rColor
);
Invalidate
();
Invalidate
();
}
}
void
SvxFontPrevWindow
::
ResetColor
()
void
SvxFontPrevWindow
::
ResetColor
()
{
{
delete
pImpl
->
pColor
;
delete
pImpl
->
m
pColor
;
pImpl
->
pColor
=
0
;
pImpl
->
m
pColor
=
0
;
Invalidate
();
Invalidate
();
}
}
void
SvxFontPrevWindow
::
SetBackColor
(
const
Color
&
rColor
)
void
SvxFontPrevWindow
::
SetBackColor
(
const
Color
&
rColor
)
{
{
delete
pImpl
->
pBackColor
;
delete
pImpl
->
m
pBackColor
;
pImpl
->
pBackColor
=
new
Color
(
rColor
);
pImpl
->
mpBackColor
=
new
Color
(
rColor
);
Invalidate
();
Invalidate
();
}
}
void
SvxFontPrevWindow
::
UseResourceText
(
bool
bUse
)
void
SvxFontPrevWindow
::
UseResourceText
(
bool
bUse
)
{
{
pImpl
->
bUseResText
=
bUse
;
pImpl
->
m
bUseResText
=
bUse
;
}
}
void
SvxFontPrevWindow
::
Paint
(
vcl
::
RenderContext
&
rRenderContext
,
const
Rectangle
&
)
void
SvxFontPrevWindow
::
Paint
(
vcl
::
RenderContext
&
/*rRenderContext*/
,
const
Rectangle
&
)
{
{
Printer
*
pPrinter
=
pImpl
->
pPrinter
;
ApplySettings
(
rRenderContext
);
const
SvxFont
&
rFont
=
pImpl
->
aFont
;
const
SvxFont
&
rCJKFont
=
pImpl
->
aCJKFont
;
const
SvxFont
&
rCTLFont
=
pImpl
->
aCTLFont
;
if
(
!
IsEnabled
()
)
Printer
*
pPrinter
=
pImpl
->
mpPrinter
;
const
SvxFont
&
rFont
=
pImpl
->
maFont
;
const
SvxFont
&
rCJKFont
=
pImpl
->
maCJKFont
;
const
SvxFont
&
rCTLFont
=
pImpl
->
maCTLFont
;
if
(
!
IsEnabled
())
{
{
const
StyleSettings
&
rStyleSettings
=
Application
::
GetSettings
().
GetStyleSettings
();
const
StyleSettings
&
rStyleSettings
=
Application
::
GetSettings
().
GetStyleSettings
();
const
Size
aLogSize
(
GetOutputSize
()
);
const
Size
aLogSize
(
rRenderContext
.
GetOutputSize
()
);
Rectangle
aRect
(
Point
(
0
,
0
),
aLogSize
);
Rectangle
aRect
(
Point
(
0
,
0
),
aLogSize
);
SetLineColor
();
rRenderContext
.
SetLineColor
();
SetFillColor
(
rStyleSettings
.
GetWindowColor
()
);
rRenderContext
.
SetFillColor
(
rStyleSettings
.
GetWindowColor
()
);
DrawRect
(
aRect
);
rRenderContext
.
DrawRect
(
aRect
);
}
}
else
else
{
{
if
(
pImpl
->
bUseResText
)
if
(
pImpl
->
mbUseResText
)
pImpl
->
aText
=
GetText
();
pImpl
->
m
aText
=
GetText
();
else
if
(
!
pImpl
->
bSelection
&&
!
pImpl
->
bTextInited
)
else
if
(
!
pImpl
->
mbSelection
&&
!
pImpl
->
mbTextInited
)
{
{
using
namespace
c
om
::
sun
::
star
::
i18n
::
ScriptType
;
using
namespace
c
ss
::
i18n
::
ScriptType
;
SfxViewShell
*
pSh
=
SfxViewShell
::
Current
();
SfxViewShell
*
pSh
=
SfxViewShell
::
Current
();
if
(
pSh
&&
!
pImpl
->
bGetSelection
&&
!
pImpl
->
bUseFontNameAsText
)
if
(
pSh
&&
!
pImpl
->
mbGetSelection
&&
!
pImpl
->
mbUseFontNameAsText
)
{
{
pImpl
->
aText
=
pSh
->
GetSelectionText
();
pImpl
->
maText
=
pSh
->
GetSelectionText
();
pImpl
->
bGetSelection
=
true
;
pImpl
->
mbGetSelection
=
true
;
pImpl
->
bSelection
=
!
pImpl
->
aText
.
isEmpty
();
pImpl
->
mbSelection
=
!
pImpl
->
maText
.
isEmpty
();
}
}
if
(
!
pImpl
->
bSelection
||
pImpl
->
bUseFontNameAsText
)
if
(
!
pImpl
->
mbSelection
||
pImpl
->
mbUseFontNameAsText
)
{
{
//If we're showing multiple sample texts, then they're all
//If we're showing multiple sample texts, then they're all
//sample texts. If only showing Latin, continue to use
//sample texts. If only showing Latin, continue to use
//the fontname as the preview
//the fontname as the preview
if
((
pImpl
->
m_bCJKEnabled
)
||
(
pImpl
->
m_bCTLEnabled
))
if
((
pImpl
->
m_bCJKEnabled
)
||
(
pImpl
->
m_bCTLEnabled
))
pImpl
->
aText
=
makeRepresentativeTextForFont
(
LATIN
,
rFont
);
pImpl
->
m
aText
=
makeRepresentativeTextForFont
(
LATIN
,
rFont
);
else
else
pImpl
->
aText
=
rFont
.
GetName
();
pImpl
->
m
aText
=
rFont
.
GetName
();
if
(
pImpl
->
m_bCJKEnabled
)
if
(
pImpl
->
m_bCJKEnabled
)
{
{
if
(
!
pImpl
->
aText
.
isEmpty
())
if
(
!
pImpl
->
m
aText
.
isEmpty
())
pImpl
->
aText
+=
" "
;
pImpl
->
m
aText
+=
" "
;
pImpl
->
aText
+=
makeRepresentativeTextForFont
(
ASIAN
,
rCJKFont
);
pImpl
->
m
aText
+=
makeRepresentativeTextForFont
(
ASIAN
,
rCJKFont
);
}
}
if
(
pImpl
->
m_bCTLEnabled
)
if
(
pImpl
->
m_bCTLEnabled
)
{
{
if
(
!
pImpl
->
aText
.
isEmpty
())
if
(
!
pImpl
->
m
aText
.
isEmpty
())
pImpl
->
aText
+=
" "
;
pImpl
->
m
aText
+=
" "
;
pImpl
->
aText
+=
makeRepresentativeTextForFont
(
COMPLEX
,
rCTLFont
);
pImpl
->
m
aText
+=
makeRepresentativeTextForFont
(
COMPLEX
,
rCTLFont
);
}
}
}
}
if
(
pImpl
->
aText
.
isEmpty
()
)
if
(
pImpl
->
maText
.
isEmpty
()
)
pImpl
->
aText
=
GetText
();
pImpl
->
m
aText
=
GetText
();
if
(
pImpl
->
aText
.
isEmpty
())
if
(
pImpl
->
m
aText
.
isEmpty
())
{
// fdo#58427: still no text? let's try that one...
{
// fdo#58427: still no text? let's try that one...
pImpl
->
aText
=
makeRepresentativeTextForFont
(
LATIN
,
rFont
);
pImpl
->
m
aText
=
makeRepresentativeTextForFont
(
LATIN
,
rFont
);
}
}
// remove line feeds and carriage returns from string
// remove line feeds and carriage returns from string
bool
bNotEmpty
=
false
;
bool
bNotEmpty
=
false
;
for
(
sal_Int32
i
=
0
;
i
<
pImpl
->
aText
.
getLength
();
++
i
)
for
(
sal_Int32
i
=
0
;
i
<
pImpl
->
maText
.
getLength
();
++
i
)
{
{
if
(
0xa
==
pImpl
->
aText
[
i
]
||
0xd
==
pImpl
->
aText
[
i
]
)
if
(
0xa
==
pImpl
->
maText
[
i
]
||
0xd
==
pImpl
->
maText
[
i
]
)
pImpl
->
aText
=
pImpl
->
aText
.
replaceAt
(
i
,
1
,
" "
);
pImpl
->
maText
=
pImpl
->
maText
.
replaceAt
(
i
,
1
,
" "
);
else
else
bNotEmpty
=
true
;
bNotEmpty
=
true
;
}
}
if
(
!
bNotEmpty
)
if
(
!
bNotEmpty
)
pImpl
->
aText
=
GetText
();
pImpl
->
m
aText
=
GetText
();
if
(
pImpl
->
aText
.
getLength
()
>
(
TEXT_WIDTH
-
1
)
)
if
(
pImpl
->
maText
.
getLength
()
>
(
TEXT_WIDTH
-
1
)
)
{
{
sal_Int32
nSpaceIdx
=
pImpl
->
aText
.
indexOf
(
" "
,
TEXT_WIDTH
);
sal_Int32
nSpaceIdx
=
pImpl
->
m
aText
.
indexOf
(
" "
,
TEXT_WIDTH
);
if
(
nSpaceIdx
!=
-
1
)
if
(
nSpaceIdx
!=
-
1
)
pImpl
->
aText
=
pImpl
->
aText
.
copy
(
0
,
nSpaceIdx
);
pImpl
->
maText
=
pImpl
->
m
aText
.
copy
(
0
,
nSpaceIdx
);
}
}
}
}
// calculate text width scaling
// calculate text width scaling
pImpl
->
ScaleFontWidth
(
*
this
/*, rFont*/
);
pImpl
->
ScaleFontWidth
(
rRenderContext
);
pImpl
->
CheckScript
();
pImpl
->
CheckScript
();
Size
aTxtSize
=
pImpl
->
CalcTextSize
(
this
,
pPrinter
,
rFont
);
Size
aTxtSize
=
pImpl
->
CalcTextSize
(
rRenderContext
,
pPrinter
,
rFont
);
const
Size
aLogSize
(
GetOutputSize
()
);
const
Size
aLogSize
(
rRenderContext
.
GetOutputSize
()
);
long
nX
=
aLogSize
.
Width
()
/
2
-
aTxtSize
.
Width
()
/
2
;
long
nX
=
aLogSize
.
Width
()
/
2
-
aTxtSize
.
Width
()
/
2
;
long
nY
=
aLogSize
.
Height
()
/
2
-
aTxtSize
.
Height
()
/
2
;
long
nY
=
aLogSize
.
Height
()
/
2
-
aTxtSize
.
Height
()
/
2
;
if
(
nY
+
pImpl
->
nAscent
>
aLogSize
.
Height
()
)
if
(
nY
+
pImpl
->
mnAscent
>
aLogSize
.
Height
()
)
nY
=
aLogSize
.
Height
()
-
pImpl
->
nAscent
;
nY
=
aLogSize
.
Height
()
-
pImpl
->
m
nAscent
;
if
(
pImpl
->
pBackColor
)
if
(
pImpl
->
mpBackColor
)
{
{
Rectangle
aRect
(
Point
(
0
,
0
),
aLogSize
);
Rectangle
aRect
(
Point
(
0
,
0
),
aLogSize
);
Color
aLineCol
=
GetLineColor
();
Color
aLineCol
=
rRenderContext
.
GetLineColor
();
Color
aFillCol
=
GetFillColor
();
Color
aFillCol
=
rRenderContext
.
GetFillColor
();
SetLineColor
();
rRenderContext
.
SetLineColor
();
SetFillColor
(
*
pImpl
->
pBackColor
);
rRenderContext
.
SetFillColor
(
*
pImpl
->
mpBackColor
);
DrawRect
(
aRect
);
rRenderContext
.
DrawRect
(
aRect
);
SetLineColor
(
aLineCol
);
rRenderContext
.
SetLineColor
(
aLineCol
);
SetFillColor
(
aFillCol
);
rRenderContext
.
SetFillColor
(
aFillCol
);
}
}
if
(
pImpl
->
pColor
)
if
(
pImpl
->
mpColor
)
{
{
Rectangle
aRect
(
Point
(
nX
,
nY
),
aTxtSize
);
Rectangle
aRect
(
Point
(
nX
,
nY
),
aTxtSize
);
Color
aLineCol
=
GetLineColor
();
Color
aLineCol
=
rRenderContext
.
GetLineColor
();
Color
aFillCol
=
GetFillColor
();
Color
aFillCol
=
rRenderContext
.
GetFillColor
();
SetLineColor
();
rRenderContext
.
SetLineColor
();
SetFillColor
(
*
pImpl
->
pColor
);
rRenderContext
.
SetFillColor
(
*
pImpl
->
mpColor
);
DrawRect
(
aRect
);
rRenderContext
.
DrawRect
(
aRect
);
SetLineColor
(
aLineCol
);
rRenderContext
.
SetLineColor
(
aLineCol
);
SetFillColor
(
aFillCol
);
rRenderContext
.
SetFillColor
(
aFillCol
);
}
}
long
nStdAscent
=
pImpl
->
nAscent
;
long
nStdAscent
=
pImpl
->
m
nAscent
;
nY
+=
nStdAscent
;
nY
+=
nStdAscent
;
if
(
IsTwoLines
())
if
(
IsTwoLines
())
{
{
SvxFont
aSmallFont
(
rFont
);
SvxFont
aSmallFont
(
rFont
);
Size
aOldSize
=
pImpl
->
aCJKFont
.
GetSize
();
Size
aOldSize
=
pImpl
->
m
aCJKFont
.
GetSize
();
setFontSize
(
aSmallFont
);
setFontSize
(
aSmallFont
);
setFontSize
(
pImpl
->
aCJKFont
);
setFontSize
(
pImpl
->
m
aCJKFont
);
long
nStartBracketWidth
=
0
;
long
nStartBracketWidth
=
0
;
long
nEndBracketWidth
=
0
;
long
nEndBracketWidth
=
0
;
long
nTextWidth
=
0
;
long
nTextWidth
=
0
;
if
(
pImpl
->
cStartBracket
)
if
(
pImpl
->
m
cStartBracket
)
{
{
OUString
sBracket
(
pImpl
->
cStartBracket
);
OUString
sBracket
(
pImpl
->
m
cStartBracket
);
nStartBracketWidth
=
rFont
.
GetTxtSize
(
pPrinter
,
sBracket
).
Width
();
nStartBracketWidth
=
rFont
.
GetTxtSize
(
pPrinter
,
sBracket
).
Width
();
}
}
if
(
pImpl
->
cEndBracket
)
if
(
pImpl
->
m
cEndBracket
)
{
{
OUString
sBracket
(
pImpl
->
cEndBracket
);
OUString
sBracket
(
pImpl
->
m
cEndBracket
);
nEndBracketWidth
=
rFont
.
GetTxtSize
(
pPrinter
,
sBracket
).
Width
();
nEndBracketWidth
=
rFont
.
GetTxtSize
(
pPrinter
,
sBracket
).
Width
();
}
}
nTextWidth
=
pImpl
->
CalcTextSize
(
this
,
pPrinter
,
aSmallFont
).
Width
();
nTextWidth
=
pImpl
->
CalcTextSize
(
rRenderContext
,
pPrinter
,
aSmallFont
).
Width
();
long
nResultWidth
=
nStartBracketWidth
;
long
nResultWidth
=
nStartBracketWidth
;
nResultWidth
+=
nEndBracketWidth
;
nResultWidth
+=
nEndBracketWidth
;
nResultWidth
+=
nTextWidth
;
nResultWidth
+=
nTextWidth
;
long
_nX
=
(
aLogSize
.
Width
()
-
nResultWidth
)
/
2
;
long
_nX
=
(
aLogSize
.
Width
()
-
nResultWidth
)
/
2
;
DrawLine
(
Point
(
0
,
nY
),
Point
(
_nX
,
nY
)
);
rRenderContext
.
DrawLine
(
Point
(
0
,
nY
),
Point
(
_nX
,
nY
)
);
DrawLine
(
Point
(
_nX
+
nResultWidth
,
nY
),
Point
(
aLogSize
.
Width
(),
nY
)
);
rRenderContext
.
DrawLine
(
Point
(
_nX
+
nResultWidth
,
nY
),
Point
(
aLogSize
.
Width
(),
nY
)
);
long
nSmallAscent
=
pImpl
->
nAscent
;
long
nSmallAscent
=
pImpl
->
m
nAscent
;
long
nOffset
=
(
nStdAscent
-
nSmallAscent
)
/
2
;
long
nOffset
=
(
nStdAscent
-
nSmallAscent
)
/
2
;
if
(
pImpl
->
cStartBracket
)
if
(
pImpl
->
m
cStartBracket
)
{
{
OUString
sBracket
(
pImpl
->
cStartBracket
);
OUString
sBracket
(
pImpl
->
m
cStartBracket
);
rFont
.
DrawPrev
(
this
,
pPrinter
,
Point
(
_nX
,
nY
-
nOffset
-
4
),
sBracket
);
rFont
.
DrawPrev
(
&
rRenderContext
,
pPrinter
,
Point
(
_nX
,
nY
-
nOffset
-
4
),
sBracket
);
_nX
+=
nStartBracketWidth
;
_nX
+=
nStartBracketWidth
;
}
}
Point
aTmpPoint1
(
_nX
,
nY
-
nSmallAscent
-
2
);
Point
aTmpPoint1
(
_nX
,
nY
-
nSmallAscent
-
2
);
Point
aTmpPoint2
(
_nX
,
nY
);
Point
aTmpPoint2
(
_nX
,
nY
);
pImpl
->
DrawPrev
(
this
,
pPrinter
,
aTmpPoint1
,
aSmallFont
);
pImpl
->
DrawPrev
(
rRenderContext
,
pPrinter
,
aTmpPoint1
,
aSmallFont
);
pImpl
->
DrawPrev
(
this
,
pPrinter
,
aTmpPoint2
,
aSmallFont
);
pImpl
->
DrawPrev
(
rRenderContext
,
pPrinter
,
aTmpPoint2
,
aSmallFont
);
_nX
+=
nTextWidth
;
_nX
+=
nTextWidth
;
if
(
pImpl
->
cEndBracket
)
if
(
pImpl
->
m
cEndBracket
)
{
{
Point
aTmpPoint
(
_nX
+
1
,
nY
-
nOffset
-
4
);
Point
aTmpPoint
(
_nX
+
1
,
nY
-
nOffset
-
4
);
OUString
sBracket
(
pImpl
->
cEndBracket
);
OUString
sBracket
(
pImpl
->
m
cEndBracket
);
rFont
.
DrawPrev
(
this
,
pPrinter
,
aTmpPoint
,
sBracket
);
rFont
.
DrawPrev
(
&
rRenderContext
,
pPrinter
,
aTmpPoint
,
sBracket
);
}
}
pImpl
->
aCJKFont
.
SetSize
(
aOldSize
);
pImpl
->
maCJKFont
.
SetSize
(
aOldSize
);
}
}
else
else
{
{
Color
aLineCol
=
GetLineColor
();
Color
aLineCol
=
rRenderContext
.
GetLineColor
();
SetLineColor
(
rFont
.
GetColor
()
);
rRenderContext
.
SetLineColor
(
rFont
.
GetColor
()
);
DrawLine
(
Point
(
0
,
nY
),
Point
(
nX
,
nY
)
);
rRenderContext
.
DrawLine
(
Point
(
0
,
nY
),
Point
(
nX
,
nY
)
);
DrawLine
(
Point
(
nX
+
aTxtSize
.
Width
(),
nY
),
Point
(
aLogSize
.
Width
(),
nY
)
);
rRenderContext
.
DrawLine
(
Point
(
nX
+
aTxtSize
.
Width
(),
nY
),
Point
(
aLogSize
.
Width
(),
nY
)
);
SetLineColor
(
aLineCol
);
rRenderContext
.
SetLineColor
(
aLineCol
);
Point
aTmpPoint
(
nX
,
nY
);
Point
aTmpPoint
(
nX
,
nY
);
pImpl
->
DrawPrev
(
this
,
pPrinter
,
aTmpPoint
,
rFont
);
pImpl
->
DrawPrev
(
rRenderContext
,
pPrinter
,
aTmpPoint
,
rFont
);
}
}
}
}
}
}
bool
SvxFontPrevWindow
::
IsTwoLines
()
const
bool
SvxFontPrevWindow
::
IsTwoLines
()
const
{
{
return
pImpl
->
bTwoLines
;
return
pImpl
->
m
bTwoLines
;
}
}
void
SvxFontPrevWindow
::
SetTwoLines
(
bool
bSet
)
void
SvxFontPrevWindow
::
SetTwoLines
(
bool
bSet
)
{
{
pImpl
->
bTwoLines
=
bSet
;
pImpl
->
m
bTwoLines
=
bSet
;
}
}
void
SvxFontPrevWindow
::
SetBrackets
(
sal_Unicode
cStart
,
sal_Unicode
cEnd
)
void
SvxFontPrevWindow
::
SetBrackets
(
sal_Unicode
cStart
,
sal_Unicode
cEnd
)
{
{
pImpl
->
cStartBracket
=
cStart
;
pImpl
->
m
cStartBracket
=
cStart
;
pImpl
->
cEndBracket
=
cEnd
;
pImpl
->
m
cEndBracket
=
cEnd
;
}
}
void
SvxFontPrevWindow
::
SetFontWidthScale
(
sal_uInt16
n
)
void
SvxFontPrevWindow
::
SetFontWidthScale
(
sal_uInt16
n
)
{
{
if
(
pImpl
->
SetFontWidthScale
(
n
)
)
if
(
pImpl
->
SetFontWidthScale
(
n
)
)
Invalidate
();
Invalidate
();
}
}
void
SvxFontPrevWindow
::
AutoCorrectFontColor
()
void
SvxFontPrevWindow
::
AutoCorrectFontColor
()
{
{
Color
aFontColor
(
GetTextColor
()
);
Color
aFontColor
(
GetTextColor
()
);
if
(
COL_AUTO
==
pImpl
->
aFont
.
GetColor
().
GetColor
()
)
if
(
COL_AUTO
==
pImpl
->
maFont
.
GetColor
().
GetColor
()
)
pImpl
->
aFont
.
SetColor
(
aFontColor
);
pImpl
->
maFont
.
SetColor
(
aFontColor
);
if
(
COL_AUTO
==
pImpl
->
aCJKFont
.
GetColor
().
GetColor
()
)
if
(
COL_AUTO
==
pImpl
->
maCJKFont
.
GetColor
().
GetColor
()
)
pImpl
->
aCJKFont
.
SetColor
(
aFontColor
);
pImpl
->
maCJKFont
.
SetColor
(
aFontColor
);
if
(
COL_AUTO
==
pImpl
->
aCTLFont
.
GetColor
().
GetColor
()
)
if
(
COL_AUTO
==
pImpl
->
maCTLFont
.
GetColor
().
GetColor
()
)
pImpl
->
aCTLFont
.
SetColor
(
aFontColor
);
pImpl
->
maCTLFont
.
SetColor
(
aFontColor
);
}
}
static
bool
GetWhich
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
sal_uInt16
&
rWhich
)
static
bool
GetWhich
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
sal_uInt16
&
rWhich
)
{
{
rWhich
=
rSet
.
GetPool
()
->
GetWhich
(
nSlot
,
true
);
rWhich
=
rSet
.
GetPool
()
->
GetWhich
(
nSlot
,
true
);
return
rSet
.
GetItemState
(
rWhich
)
>=
SfxItemState
::
DEFAULT
;
return
rSet
.
GetItemState
(
rWhich
)
>=
SfxItemState
::
DEFAULT
;
}
}
static
void
SetPrevFont
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
)
static
void
SetPrevFont
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
)
{
{
sal_uInt16
nWhich
;
sal_uInt16
nWhich
;
if
(
GetWhich
(
rSet
,
nSlot
,
nWhich
)
)
if
(
GetWhich
(
rSet
,
nSlot
,
nWhich
)
)
{
{
const
SvxFontItem
&
rFontItem
=
static_cast
<
const
SvxFontItem
&>
(
rSet
.
Get
(
nWhich
)
);
const
SvxFontItem
&
rFontItem
=
static_cast
<
const
SvxFontItem
&>
(
rSet
.
Get
(
nWhich
)
);
rFont
.
SetFamily
(
rFontItem
.
GetFamily
()
);
rFont
.
SetFamily
(
rFontItem
.
GetFamily
()
);
rFont
.
SetName
(
rFontItem
.
GetFamilyName
()
);
rFont
.
SetName
(
rFontItem
.
GetFamilyName
()
);
rFont
.
SetPitch
(
rFontItem
.
GetPitch
()
);
rFont
.
SetPitch
(
rFontItem
.
GetPitch
()
);
rFont
.
SetCharSet
(
rFontItem
.
GetCharSet
()
);
rFont
.
SetCharSet
(
rFontItem
.
GetCharSet
()
);
rFont
.
SetStyleName
(
rFontItem
.
GetStyleName
()
);
rFont
.
SetStyleName
(
rFontItem
.
GetStyleName
()
);
}
}
}
}
...
@@ -899,16 +903,16 @@ void SvxFontPrevWindow::SetFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, S
...
@@ -899,16 +903,16 @@ void SvxFontPrevWindow::SetFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, S
{
{
sal_uInt16
nWhich
;
sal_uInt16
nWhich
;
long
nH
;
long
nH
;
if
(
GetWhich
(
rSet
,
nSlot
,
nWhich
)
)
if
(
GetWhich
(
rSet
,
nSlot
,
nWhich
)
)
{
{
nH
=
LogicToLogic
(
static_cast
<
const
SvxFontHeightItem
&>
(
rSet
.
Get
(
nWhich
)
).
GetHeight
(),
nH
=
LogicToLogic
(
static_cast
<
const
SvxFontHeightItem
&>
(
rSet
.
Get
(
nWhich
)
).
GetHeight
(),
(
MapUnit
)
rSet
.
GetPool
()
->
GetMetric
(
nWhich
),
(
MapUnit
)
rSet
.
GetPool
()
->
GetMetric
(
nWhich
),
MAP_TWIP
);
MAP_TWIP
);
}
}
else
else
nH
=
240
;
// as default 12pt
nH
=
240
;
// as default 12pt
rFont
.
SetSize
(
Size
(
0
,
nH
)
);
rFont
.
SetSize
(
Size
(
0
,
nH
)
);
}
}
void
SvxFontPrevWindow
::
SetFontLang
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
)
void
SvxFontPrevWindow
::
SetFontLang
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
)
...
@@ -922,15 +926,14 @@ void SvxFontPrevWindow::SetFontLang(const SfxItemSet& rSet, sal_uInt16 nSlot, Sv
...
@@ -922,15 +926,14 @@ void SvxFontPrevWindow::SetFontLang(const SfxItemSet& rSet, sal_uInt16 nSlot, Sv
rFont
.
SetLanguage
(
nLang
);
rFont
.
SetLanguage
(
nLang
);
}
}
static
void
SetPrevFontEscapement
(
SvxFont
&
_rFont
,
sal_uInt8
nProp
,
sal_uInt8
nEscProp
,
short
nEsc
)
static
void
SetPrevFontEscapement
(
SvxFont
&
rFont
,
sal_uInt8
nProp
,
sal_uInt8
nEscProp
,
short
nEsc
)
{
{
_rFont
.
SetPropr
(
nProp
);
rFont
.
SetPropr
(
nProp
);
_rFont
.
SetProprRel
(
nEscProp
);
rFont
.
SetProprRel
(
nEscProp
);
_rFont
.
SetEscapement
(
nEsc
);
rFont
.
SetEscapement
(
nEsc
);
}
}
void
SvxFontPrevWindow
::
SetFromItemSet
(
const
SfxItemSet
&
rSet
,
void
SvxFontPrevWindow
::
SetFromItemSet
(
const
SfxItemSet
&
rSet
,
bool
bPreviewBackgroundToCharacter
)
bool
bPreviewBackgroundToCharacter
)
{
{
sal_uInt16
nWhich
;
sal_uInt16
nWhich
;
SvxFont
&
rFont
=
GetFont
();
SvxFont
&
rFont
=
GetFont
();
...
@@ -1160,9 +1163,7 @@ void SvxFontPrevWindow::SetFromItemSet( const SfxItemSet &rSet,
...
@@ -1160,9 +1163,7 @@ void SvxFontPrevWindow::SetFromItemSet( const SfxItemSet &rSet,
Invalidate
();
Invalidate
();
}
}
void
SvxFontPrevWindow
::
Init
(
const
SfxItemSet
&
rSet
)
void
SvxFontPrevWindow
::
Init
(
const
SfxItemSet
&
rSet
)
{
{
SvxFont
&
rFont
=
GetFont
();
SvxFont
&
rFont
=
GetFont
();
SvxFont
&
rCJKFont
=
GetCJKFont
();
SvxFont
&
rCJKFont
=
GetCJKFont
();
...
@@ -1171,11 +1172,11 @@ void SvxFontPrevWindow::Init( const SfxItemSet& rSet )
...
@@ -1171,11 +1172,11 @@ void SvxFontPrevWindow::Init( const SfxItemSet& rSet )
initFont
(
rFont
);
initFont
(
rFont
);
initFont
(
rCJKFont
);
initFont
(
rCJKFont
);
initFont
(
rCTLFont
);
initFont
(
rCTLFont
);
InitSettings
(
true
,
true
);
ResetSettings
(
true
,
true
);
sal_uInt16
nWhich
;
sal_uInt16
nWhich
;
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
SID_CHAR_DLG_PREVIEW_STRING
);
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
SID_CHAR_DLG_PREVIEW_STRING
);
if
(
ISITEMSET
)
if
(
ISITEMSET
)
{
{
const
SfxStringItem
&
rItem
=
static_cast
<
const
SfxStringItem
&>
(
rSet
.
Get
(
nWhich
)
);
const
SfxStringItem
&
rItem
=
static_cast
<
const
SfxStringItem
&>
(
rSet
.
Get
(
nWhich
)
);
OUString
aString
=
rItem
.
GetValue
();
OUString
aString
=
rItem
.
GetValue
();
...
@@ -1300,15 +1301,15 @@ void SvxFontPrevWindow::Init( const SfxItemSet& rSet )
...
@@ -1300,15 +1301,15 @@ void SvxFontPrevWindow::Init( const SfxItemSet& rSet )
// Background
// Background
bool
bTransparent
;
bool
bTransparent
;
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
pImpl
->
bPreviewBackgroundToCharacter
?
SID_ATTR_BRUSH
:
SID_ATTR_BRUSH_CHAR
);
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
pImpl
->
mbPreviewBackgroundToCharacter
?
SID_ATTR_BRUSH
:
SID_ATTR_BRUSH_CHAR
);
if
(
ISITEMSET
)
if
(
ISITEMSET
)
{
{
const
SvxBrushItem
&
rBrush
=
static_cast
<
const
SvxBrushItem
&>
(
rSet
.
Get
(
nWhich
)
);
const
SvxBrushItem
&
rBrush
=
static_cast
<
const
SvxBrushItem
&>
(
rSet
.
Get
(
nWhich
)
);
const
Color
&
rColor
=
rBrush
.
GetColor
();
const
Color
&
rColor
=
rBrush
.
GetColor
();
bTransparent
=
rColor
.
GetTransparency
()
>
0
;
bTransparent
=
rColor
.
GetTransparency
()
>
0
;
rFont
.
SetFillColor
(
rColor
);
rFont
.
SetFillColor
(
rColor
);
rCJKFont
.
SetFillColor
(
rColor
);
rCJKFont
.
SetFillColor
(
rColor
);
rCTLFont
.
SetFillColor
(
rColor
);
rCTLFont
.
SetFillColor
(
rColor
);
}
}
else
else
bTransparent
=
true
;
bTransparent
=
true
;
...
@@ -1318,32 +1319,32 @@ void SvxFontPrevWindow::Init( const SfxItemSet& rSet )
...
@@ -1318,32 +1319,32 @@ void SvxFontPrevWindow::Init( const SfxItemSet& rSet )
rCTLFont
.
SetTransparent
(
bTransparent
);
rCTLFont
.
SetTransparent
(
bTransparent
);
Color
aBackCol
(
COL_TRANSPARENT
);
Color
aBackCol
(
COL_TRANSPARENT
);
if
(
!
pImpl
->
bPreviewBackgroundToCharacter
)
if
(
!
pImpl
->
mbPreviewBackgroundToCharacter
)
{
{
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
SID_ATTR_BRUSH
);
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
SID_ATTR_BRUSH
);
if
(
ISITEMSET
)
if
(
ISITEMSET
)
{
{
const
SvxBrushItem
&
rBrush
=
static_cast
<
const
SvxBrushItem
&>
(
rSet
.
Get
(
nWhich
)
);
const
SvxBrushItem
&
rBrush
=
static_cast
<
const
SvxBrushItem
&>
(
rSet
.
Get
(
nWhich
)
);
if
(
GPOS_NONE
==
rBrush
.
GetGraphicPos
()
)
if
(
GPOS_NONE
==
rBrush
.
GetGraphicPos
()
)
aBackCol
=
rBrush
.
GetColor
();
aBackCol
=
rBrush
.
GetColor
();
}
}
}
}
SetBackColor
(
aBackCol
);
SetBackColor
(
aBackCol
);
// Font
// Font
SetFont
(
rSet
,
SID_ATTR_CHAR_FONT
,
rFont
);
SetFont
(
rSet
,
SID_ATTR_CHAR_FONT
,
rFont
);
SetFont
(
rSet
,
SID_ATTR_CHAR_CJK_FONT
,
rCJKFont
);
SetFont
(
rSet
,
SID_ATTR_CHAR_CJK_FONT
,
rCJKFont
);
SetFont
(
rSet
,
SID_ATTR_CHAR_CTL_FONT
,
rCTLFont
);
SetFont
(
rSet
,
SID_ATTR_CHAR_CTL_FONT
,
rCTLFont
);
// Style
// Style
SetFontStyle
(
rSet
,
SID_ATTR_CHAR_POSTURE
,
SID_ATTR_CHAR_WEIGHT
,
rFont
);
SetFontStyle
(
rSet
,
SID_ATTR_CHAR_POSTURE
,
SID_ATTR_CHAR_WEIGHT
,
rFont
);
SetFontStyle
(
rSet
,
SID_ATTR_CHAR_CJK_POSTURE
,
SID_ATTR_CHAR_CJK_WEIGHT
,
rCJKFont
);
SetFontStyle
(
rSet
,
SID_ATTR_CHAR_CJK_POSTURE
,
SID_ATTR_CHAR_CJK_WEIGHT
,
rCJKFont
);
SetFontStyle
(
rSet
,
SID_ATTR_CHAR_CTL_POSTURE
,
SID_ATTR_CHAR_CTL_WEIGHT
,
rCTLFont
);
SetFontStyle
(
rSet
,
SID_ATTR_CHAR_CTL_POSTURE
,
SID_ATTR_CHAR_CTL_WEIGHT
,
rCTLFont
);
// Size
// Size
SetFontSize
(
rSet
,
SID_ATTR_CHAR_FONTHEIGHT
,
rFont
);
SetFontSize
(
rSet
,
SID_ATTR_CHAR_FONTHEIGHT
,
rFont
);
SetFontSize
(
rSet
,
SID_ATTR_CHAR_CJK_FONTHEIGHT
,
rCJKFont
);
SetFontSize
(
rSet
,
SID_ATTR_CHAR_CJK_FONTHEIGHT
,
rCJKFont
);
SetFontSize
(
rSet
,
SID_ATTR_CHAR_CTL_FONTHEIGHT
,
rCTLFont
);
SetFontSize
(
rSet
,
SID_ATTR_CHAR_CTL_FONTHEIGHT
,
rCTLFont
);
// Language
// Language
SetFontLang
(
rSet
,
SID_ATTR_CHAR_LANGUAGE
,
rFont
);
SetFontLang
(
rSet
,
SID_ATTR_CHAR_LANGUAGE
,
rFont
);
...
@@ -1405,11 +1406,6 @@ void SvxFontPrevWindow::Init( const SfxItemSet& rSet )
...
@@ -1405,11 +1406,6 @@ void SvxFontPrevWindow::Init( const SfxItemSet& rSet )
Invalidate
();
Invalidate
();
}
}
void
SvxFontPrevWindow
::
SetFont
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
)
void
SvxFontPrevWindow
::
SetFont
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nSlot
,
SvxFont
&
rFont
)
{
{
sal_uInt16
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
nSlot
);
sal_uInt16
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
nSlot
);
...
@@ -1424,8 +1420,6 @@ void SvxFontPrevWindow::SetFont( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFo
...
@@ -1424,8 +1420,6 @@ void SvxFontPrevWindow::SetFont( const SfxItemSet& rSet, sal_uInt16 nSlot, SvxFo
}
}
}
}
void
SvxFontPrevWindow
::
SetFontStyle
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nPosture
,
sal_uInt16
nWeight
,
SvxFont
&
rFont
)
void
SvxFontPrevWindow
::
SetFontStyle
(
const
SfxItemSet
&
rSet
,
sal_uInt16
nPosture
,
sal_uInt16
nWeight
,
SvxFont
&
rFont
)
{
{
sal_uInt16
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
nPosture
);
sal_uInt16
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
nPosture
);
...
@@ -1443,8 +1437,6 @@ void SvxFontPrevWindow::SetFontStyle( const SfxItemSet& rSet, sal_uInt16 nPostur
...
@@ -1443,8 +1437,6 @@ void SvxFontPrevWindow::SetFontStyle( const SfxItemSet& rSet, sal_uInt16 nPostur
}
}
}
}
void
SvxFontPrevWindow
::
SetFontWidthScale
(
const
SfxItemSet
&
rSet
)
void
SvxFontPrevWindow
::
SetFontWidthScale
(
const
SfxItemSet
&
rSet
)
{
{
sal_uInt16
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
SID_ATTR_CHAR_SCALEWIDTH
);
sal_uInt16
nWhich
=
rSet
.
GetPool
()
->
GetWhich
(
SID_ATTR_CHAR_SCALEWIDTH
);
...
@@ -1456,26 +1448,21 @@ void SvxFontPrevWindow::SetFontWidthScale( const SfxItemSet& rSet )
...
@@ -1456,26 +1448,21 @@ void SvxFontPrevWindow::SetFontWidthScale( const SfxItemSet& rSet )
}
}
}
}
namespace
namespace
{
{
void
setFontEscapement
(
SvxFont
&
rFont
,
sal_uInt8
nProp
,
sal_uInt8
nEscProp
,
short
nEsc
)
void
setFontEscapement
(
SvxFont
&
_rFont
,
sal_uInt8
nProp
,
sal_uInt8
nEscProp
,
short
nEsc
)
{
{
_rFont
.
SetPropr
(
nProp
);
rFont
.
SetPropr
(
nProp
);
_rFont
.
SetProprRel
(
nEscProp
);
rFont
.
SetProprRel
(
nEscProp
);
_rFont
.
SetEscapement
(
nEsc
);
rFont
.
SetEscapement
(
nEsc
);
}
}
}
}
void
SvxFontPrevWindow
::
SetFontEscapement
(
sal_uInt8
nProp
,
sal_uInt8
nEscProp
,
short
nEsc
)
void
SvxFontPrevWindow
::
SetFontEscapement
(
sal_uInt8
nProp
,
sal_uInt8
nEscProp
,
short
nEsc
)
{
{
setFontEscapement
(
GetFont
(),
nProp
,
nEscProp
,
nEsc
);
setFontEscapement
(
GetFont
(),
nProp
,
nEscProp
,
nEsc
);
setFontEscapement
(
GetCJKFont
(),
nProp
,
nEscProp
,
nEsc
);
setFontEscapement
(
GetCJKFont
(),
nProp
,
nEscProp
,
nEsc
);
setFontEscapement
(
GetCTLFont
(),
nProp
,
nEscProp
,
nEsc
);
setFontEscapement
(
GetCTLFont
(),
nProp
,
nEscProp
,
nEsc
);
Invalidate
();
Invalidate
();
}
}
...
...
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