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
bc3b71a9
Kaydet (Commit)
bc3b71a9
authored
Agu 31, 2014
tarafından
Matteo Casalin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sal_uInt16 to more proper types, constify
Change-Id: I2924f1f8c6ac0e82340293f92656541ffecbcf24
üst
e24a3daf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
43 deletions
+38
-43
scriptinfo.hxx
sw/source/core/inc/scriptinfo.hxx
+2
-2
porlay.cxx
sw/source/core/text/porlay.cxx
+36
-41
No files found.
sw/source/core/inc/scriptinfo.hxx
Dosyayı görüntüle @
bc3b71a9
...
@@ -247,8 +247,8 @@ public:
...
@@ -247,8 +247,8 @@ public:
// HIDDEN TEXT STUFF END
// HIDDEN TEXT STUFF END
// examines the range [ nStart, nStart + nEnd ] if there are kanas
// examines the range [ nStart, nStart + nEnd ] if there are kanas
// returns start index of kana entry in array, otherwise
USHRT_MAX
// returns start index of kana entry in array, otherwise
SAL_MAX_SIZE
s
al_uInt16
HasKana
(
sal_Int32
nStart
,
const
sal_Int32
nEnd
)
const
;
s
ize_t
HasKana
(
sal_Int32
nStart
,
const
sal_Int32
nEnd
)
const
;
// modifies the kerning array according to a given compress value
// modifies the kerning array according to a given compress value
long
Compress
(
long
*
pKernArray
,
sal_Int32
nIdx
,
sal_Int32
nLen
,
long
Compress
(
long
*
pKernArray
,
sal_Int32
nIdx
,
sal_Int32
nLen
,
...
...
sw/source/core/text/porlay.cxx
Dosyayı görüntüle @
bc3b71a9
...
@@ -286,7 +286,7 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf )
...
@@ -286,7 +286,7 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf )
}
}
else
else
{
{
sal_uInt16
nLineHeight
=
Height
();
const
sal_uInt16
nLineHeight
=
Height
();
Init
(
GetPortion
()
);
Init
(
GetPortion
()
);
SwLinePortion
*
pPos
=
pPortion
;
SwLinePortion
*
pPos
=
pPortion
;
SwLinePortion
*
pLast
=
this
;
SwLinePortion
*
pLast
=
this
;
...
@@ -602,14 +602,9 @@ SwScriptInfo::~SwScriptInfo()
...
@@ -602,14 +602,9 @@ SwScriptInfo::~SwScriptInfo()
sal_uInt8
SwScriptInfo
::
WhichFont
(
sal_Int32
nIdx
,
const
OUString
*
pTxt
,
const
SwScriptInfo
*
pSI
)
sal_uInt8
SwScriptInfo
::
WhichFont
(
sal_Int32
nIdx
,
const
OUString
*
pTxt
,
const
SwScriptInfo
*
pSI
)
{
{
assert
((
pSI
||
pTxt
)
&&
"How should I determine the script type?"
);
assert
((
pSI
||
pTxt
)
&&
"How should I determine the script type?"
);
sal_uInt16
nScript
;
const
sal_uInt16
nScript
=
pSI
?
pSI
->
ScriptType
(
nIdx
)
// use our SwScriptInfo if available
// First we try to use our SwScriptInfo
:
g_pBreakIt
->
GetRealScriptOfText
(
*
pTxt
,
nIdx
);
// else ask the break iterator
if
(
pSI
)
nScript
=
pSI
->
ScriptType
(
nIdx
);
else
// Ok, we have to ask the break iterator
nScript
=
g_pBreakIt
->
GetRealScriptOfText
(
*
pTxt
,
nIdx
);
switch
(
nScript
)
{
switch
(
nScript
)
{
case
i18n
:
:
ScriptType
::
LATIN
:
return
SW_LATIN
;
case
i18n
:
:
ScriptType
::
LATIN
:
return
SW_LATIN
;
...
@@ -662,11 +657,11 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
...
@@ -662,11 +657,11 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
nDefaultDir
=
static_cast
<
sal_uInt8
>
(
bRTL
?
UBIDI_RTL
:
UBIDI_LTR
);
nDefaultDir
=
static_cast
<
sal_uInt8
>
(
bRTL
?
UBIDI_RTL
:
UBIDI_LTR
);
// counter for script info arrays
// counter for script info arrays
s
al_uInt16
nCnt
=
0
;
s
ize_t
nCnt
=
0
;
// counter for compression information arrays
// counter for compression information arrays
s
al_uInt16
nCntComp
=
0
;
s
ize_t
nCntComp
=
0
;
// counter for kashida array
// counter for kashida array
s
al_uInt16
nCntKash
=
0
;
s
ize_t
nCntKash
=
0
;
sal_uInt8
nScript
=
i18n
::
ScriptType
::
LATIN
;
sal_uInt8
nScript
=
i18n
::
ScriptType
::
LATIN
;
...
@@ -938,7 +933,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
...
@@ -938,7 +933,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
sal_Unicode
cCh
;
sal_Unicode
cCh
;
sal_Unicode
cPrevCh
=
0
;
sal_Unicode
cPrevCh
=
0
;
sal_uInt16
nPriorityLevel
=
7
;
// 0..6 = level found
int
nPriorityLevel
=
7
;
// 0..6 = level found
// 7 not found
// 7 not found
sal_Int32
nWordLen
=
rWord
.
getLength
();
sal_Int32
nWordLen
=
rWord
.
getLength
();
...
@@ -1134,7 +1129,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
...
@@ -1134,7 +1129,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL )
// 1. All text in RTL runs will use the CTL font
// 1. All text in RTL runs will use the CTL font
// #i89825# change the script type also to CTL (hennerdrewes)
// #i89825# change the script type also to CTL (hennerdrewes)
// 2. Text in embedded LTR runs that does not have any strong LTR characters (numbers!)
// 2. Text in embedded LTR runs that does not have any strong LTR characters (numbers!)
for
(
s
al_uInt32
nDirIdx
=
0
;
nDirIdx
<
aDirectionChanges
.
size
();
++
nDirIdx
)
for
(
s
ize_t
nDirIdx
=
0
;
nDirIdx
<
aDirectionChanges
.
size
();
++
nDirIdx
)
{
{
const
sal_uInt8
nCurrDirType
=
GetDirType
(
nDirIdx
);
const
sal_uInt8
nCurrDirType
=
GetDirType
(
nDirIdx
);
// nStart ist start of RTL run:
// nStart ist start of RTL run:
...
@@ -1237,8 +1232,8 @@ void SwScriptInfo::UpdateBidiInfo( const OUString& rTxt )
...
@@ -1237,8 +1232,8 @@ void SwScriptInfo::UpdateBidiInfo( const OUString& rTxt )
// and Complex ( Hebrew, Arabian )
// and Complex ( Hebrew, Arabian )
sal_Int32
SwScriptInfo
::
NextScriptChg
(
const
sal_Int32
nPos
)
const
sal_Int32
SwScriptInfo
::
NextScriptChg
(
const
sal_Int32
nPos
)
const
{
{
sal_uInt16
nEnd
=
CountScriptChg
();
const
size_t
nEnd
=
CountScriptChg
();
for
(
s
al_uInt16
nX
=
0
;
nX
<
nEnd
;
++
nX
)
for
(
s
ize_t
nX
=
0
;
nX
<
nEnd
;
++
nX
)
{
{
if
(
nPos
<
GetScriptChg
(
nX
)
)
if
(
nPos
<
GetScriptChg
(
nX
)
)
return
GetScriptChg
(
nX
);
return
GetScriptChg
(
nX
);
...
@@ -1250,8 +1245,8 @@ sal_Int32 SwScriptInfo::NextScriptChg(const sal_Int32 nPos) const
...
@@ -1250,8 +1245,8 @@ sal_Int32 SwScriptInfo::NextScriptChg(const sal_Int32 nPos) const
// returns the script of the character at the input position
// returns the script of the character at the input position
sal_uInt8
SwScriptInfo
::
ScriptType
(
const
sal_Int32
nPos
)
const
sal_uInt8
SwScriptInfo
::
ScriptType
(
const
sal_Int32
nPos
)
const
{
{
sal_uInt16
nEnd
=
CountScriptChg
();
const
size_t
nEnd
=
CountScriptChg
();
for
(
s
al_uInt16
nX
=
0
;
nX
<
nEnd
;
++
nX
)
for
(
s
ize_t
nX
=
0
;
nX
<
nEnd
;
++
nX
)
{
{
if
(
nPos
<
GetScriptChg
(
nX
)
)
if
(
nPos
<
GetScriptChg
(
nX
)
)
return
GetScriptType
(
nX
);
return
GetScriptType
(
nX
);
...
@@ -1264,9 +1259,9 @@ sal_uInt8 SwScriptInfo::ScriptType(const sal_Int32 nPos) const
...
@@ -1264,9 +1259,9 @@ sal_uInt8 SwScriptInfo::ScriptType(const sal_Int32 nPos) const
sal_Int32
SwScriptInfo
::
NextDirChg
(
const
sal_Int32
nPos
,
sal_Int32
SwScriptInfo
::
NextDirChg
(
const
sal_Int32
nPos
,
const
sal_uInt8
*
pLevel
)
const
const
sal_uInt8
*
pLevel
)
const
{
{
sal_uInt8
nCurrDir
=
pLevel
?
*
pLevel
:
62
;
const
sal_uInt8
nCurrDir
=
pLevel
?
*
pLevel
:
62
;
sal_uInt16
nEnd
=
CountDirChg
();
const
size_t
nEnd
=
CountDirChg
();
for
(
s
al_uInt16
nX
=
0
;
nX
<
nEnd
;
++
nX
)
for
(
s
ize_t
nX
=
0
;
nX
<
nEnd
;
++
nX
)
{
{
if
(
nPos
<
GetDirChg
(
nX
)
&&
if
(
nPos
<
GetDirChg
(
nX
)
&&
(
nX
+
1
==
nEnd
||
GetDirType
(
nX
+
1
)
<=
nCurrDir
)
)
(
nX
+
1
==
nEnd
||
GetDirType
(
nX
+
1
)
<=
nCurrDir
)
)
...
@@ -1278,8 +1273,8 @@ sal_Int32 SwScriptInfo::NextDirChg( const sal_Int32 nPos,
...
@@ -1278,8 +1273,8 @@ sal_Int32 SwScriptInfo::NextDirChg( const sal_Int32 nPos,
sal_uInt8
SwScriptInfo
::
DirType
(
const
sal_Int32
nPos
)
const
sal_uInt8
SwScriptInfo
::
DirType
(
const
sal_Int32
nPos
)
const
{
{
sal_uInt16
nEnd
=
CountDirChg
();
const
size_t
nEnd
=
CountDirChg
();
for
(
s
al_uInt16
nX
=
0
;
nX
<
nEnd
;
++
nX
)
for
(
s
ize_t
nX
=
0
;
nX
<
nEnd
;
++
nX
)
{
{
if
(
nPos
<
GetDirChg
(
nX
)
)
if
(
nPos
<
GetDirChg
(
nX
)
)
return
GetDirType
(
nX
);
return
GetDirType
(
nX
);
...
@@ -1298,7 +1293,7 @@ sal_Int32 SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, OUStringBuffer
...
@@ -1298,7 +1293,7 @@ sal_Int32 SwScriptInfo::MaskHiddenRanges( const SwTxtNode& rNode, OUStringBuffer
PositionList
aList
;
PositionList
aList
;
sal_Int32
nHiddenStart
;
sal_Int32
nHiddenStart
;
sal_Int32
nHiddenEnd
;
sal_Int32
nHiddenEnd
;
sal_
uInt16
nNumOfHiddenChars
=
0
;
sal_
Int32
nNumOfHiddenChars
=
0
;
GetBoundsOfHiddenRange
(
rNode
,
0
,
nHiddenStart
,
nHiddenEnd
,
&
aList
);
GetBoundsOfHiddenRange
(
rNode
,
0
,
nHiddenStart
,
nHiddenEnd
,
&
aList
);
PositionList
::
const_reverse_iterator
rFirst
(
aList
.
end
()
);
PositionList
::
const_reverse_iterator
rFirst
(
aList
.
end
()
);
PositionList
::
const_reverse_iterator
rLast
(
aList
.
begin
()
);
PositionList
::
const_reverse_iterator
rLast
(
aList
.
begin
()
);
...
@@ -1435,8 +1430,8 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( sal_Int32 nPos, sal_Int32& rnStartPos
...
@@ -1435,8 +1430,8 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( sal_Int32 nPos, sal_Int32& rnStartPos
rnStartPos
=
COMPLETE_STRING
;
rnStartPos
=
COMPLETE_STRING
;
rnEndPos
=
0
;
rnEndPos
=
0
;
sal_uInt16
nEnd
=
CountHiddenChg
();
const
size_t
nEnd
=
CountHiddenChg
();
for
(
s
al_uInt16
nX
=
0
;
nX
<
nEnd
;
++
nX
)
for
(
s
ize_t
nX
=
0
;
nX
<
nEnd
;
++
nX
)
{
{
const
sal_Int32
nHiddenStart
=
GetHiddenChg
(
nX
++
);
const
sal_Int32
nHiddenStart
=
GetHiddenChg
(
nX
++
);
const
sal_Int32
nHiddenEnd
=
GetHiddenChg
(
nX
);
const
sal_Int32
nHiddenEnd
=
GetHiddenChg
(
nX
);
...
@@ -1453,7 +1448,7 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( sal_Int32 nPos, sal_Int32& rnStartPos
...
@@ -1453,7 +1448,7 @@ bool SwScriptInfo::GetBoundsOfHiddenRange( sal_Int32 nPos, sal_Int32& rnStartPos
if
(
pList
)
if
(
pList
)
{
{
for
(
s
al_uInt16
nX
=
0
;
nX
<
nEnd
;
++
nX
)
for
(
s
ize_t
nX
=
0
;
nX
<
nEnd
;
++
nX
)
{
{
pList
->
push_back
(
GetHiddenChg
(
nX
++
)
);
pList
->
push_back
(
GetHiddenChg
(
nX
++
)
);
pList
->
push_back
(
GetHiddenChg
(
nX
)
);
pList
->
push_back
(
GetHiddenChg
(
nX
)
);
...
@@ -1475,10 +1470,10 @@ bool SwScriptInfo::IsInHiddenRange( const SwTxtNode& rNode, sal_Int32 nPos )
...
@@ -1475,10 +1470,10 @@ bool SwScriptInfo::IsInHiddenRange( const SwTxtNode& rNode, sal_Int32 nPos )
// returns the type of the compressed character
// returns the type of the compressed character
sal_uInt8
SwScriptInfo
::
CompType
(
const
sal_Int32
nPos
)
const
sal_uInt8
SwScriptInfo
::
CompType
(
const
sal_Int32
nPos
)
const
{
{
sal_uInt16
nEnd
=
CountCompChg
();
const
size_t
nEnd
=
CountCompChg
();
for
(
s
al_uInt16
nX
=
0
;
nX
<
nEnd
;
++
nX
)
for
(
s
ize_t
nX
=
0
;
nX
<
nEnd
;
++
nX
)
{
{
sal_Int32
nChg
=
GetCompStart
(
nX
);
const
sal_Int32
nChg
=
GetCompStart
(
nX
);
if
(
nPos
<
nChg
)
if
(
nPos
<
nChg
)
return
NONE
;
return
NONE
;
...
@@ -1492,24 +1487,24 @@ sal_uInt8 SwScriptInfo::CompType( const sal_Int32 nPos ) const
...
@@ -1492,24 +1487,24 @@ sal_uInt8 SwScriptInfo::CompType( const sal_Int32 nPos ) const
// returns, if there are compressable kanas or specials
// returns, if there are compressable kanas or specials
// between nStart and nEnd
// between nStart and nEnd
s
al_uInt16
SwScriptInfo
::
HasKana
(
sal_Int32
nStart
,
const
sal_Int32
nLen
)
const
s
ize_t
SwScriptInfo
::
HasKana
(
sal_Int32
nStart
,
const
sal_Int32
nLen
)
const
{
{
sal_uInt16
nCnt
=
CountCompChg
();
const
size_t
nCnt
=
CountCompChg
();
sal_Int32
nEnd
=
nStart
+
nLen
;
sal_Int32
nEnd
=
nStart
+
nLen
;
for
(
s
al_uInt16
nX
=
0
;
nX
<
nCnt
;
++
nX
)
for
(
s
ize_t
nX
=
0
;
nX
<
nCnt
;
++
nX
)
{
{
sal_Int32
nKanaStart
=
GetCompStart
(
nX
);
sal_Int32
nKanaStart
=
GetCompStart
(
nX
);
sal_Int32
nKanaEnd
=
nKanaStart
+
GetCompLen
(
nX
);
sal_Int32
nKanaEnd
=
nKanaStart
+
GetCompLen
(
nX
);
if
(
nKanaStart
>=
nEnd
)
if
(
nKanaStart
>=
nEnd
)
return
USHRT_MAX
;
return
SAL_MAX_SIZE
;
if
(
nStart
<
nKanaEnd
)
if
(
nStart
<
nKanaEnd
)
return
nX
;
return
nX
;
}
}
return
USHRT_MAX
;
return
SAL_MAX_SIZE
;
}
}
long
SwScriptInfo
::
Compress
(
long
*
pKernArray
,
sal_Int32
nIdx
,
sal_Int32
nLen
,
long
SwScriptInfo
::
Compress
(
long
*
pKernArray
,
sal_Int32
nIdx
,
sal_Int32
nLen
,
...
@@ -1518,21 +1513,21 @@ long SwScriptInfo::Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
...
@@ -1518,21 +1513,21 @@ long SwScriptInfo::Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
{
{
SAL_WARN_IF
(
!
nCompress
,
"sw.core"
,
"Compression without compression?!"
);
SAL_WARN_IF
(
!
nCompress
,
"sw.core"
,
"Compression without compression?!"
);
SAL_WARN_IF
(
!
nLen
,
"sw.core"
,
"Compression without text?!"
);
SAL_WARN_IF
(
!
nLen
,
"sw.core"
,
"Compression without text?!"
);
sal_uInt16
nCompCount
=
CountCompChg
();
const
size_t
nCompCount
=
CountCompChg
();
// In asian typography, there are full width and half width characters.
// In asian typography, there are full width and half width characters.
// Full width punctuation characters can be compressed by 50%
// Full width punctuation characters can be compressed by 50%
// to determine this, we compare the font width with 75% of its height
// to determine this, we compare the font width with 75% of its height
sal_uInt16
nMinWidth
=
(
3
*
nFontHeight
)
/
4
;
const
long
nMinWidth
=
(
3
*
nFontHeight
)
/
4
;
s
al_uInt16
nCompIdx
=
HasKana
(
nIdx
,
nLen
);
s
ize_t
nCompIdx
=
HasKana
(
nIdx
,
nLen
);
if
(
USHRT_MAX
==
nCompIdx
)
if
(
SAL_MAX_SIZE
==
nCompIdx
)
return
0
;
return
0
;
sal_Int32
nChg
=
GetCompStart
(
nCompIdx
);
sal_Int32
nChg
=
GetCompStart
(
nCompIdx
);
sal_Int32
nCompLen
=
GetCompLen
(
nCompIdx
);
sal_Int32
nCompLen
=
GetCompLen
(
nCompIdx
);
sal_
uInt16
nI
=
0
;
sal_
Int32
nI
=
0
;
nLen
+=
nIdx
;
nLen
+=
nIdx
;
if
(
nChg
>
nIdx
)
if
(
nChg
>
nIdx
)
...
@@ -1550,7 +1545,7 @@ long SwScriptInfo::Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
...
@@ -1550,7 +1545,7 @@ long SwScriptInfo::Compress( long* pKernArray, sal_Int32 nIdx, sal_Int32 nLen,
long
nLast
=
nI
?
pKernArray
[
nI
-
1
]
:
0
;
long
nLast
=
nI
?
pKernArray
[
nI
-
1
]
:
0
;
do
do
{
{
sal_uInt16
nType
=
GetCompType
(
nCompIdx
);
const
sal_uInt8
nType
=
GetCompType
(
nCompIdx
);
#ifdef DBG_UTIL
#ifdef DBG_UTIL
SAL_WARN_IF
(
nType
!=
CompType
(
nIdx
),
"sw.core"
,
"Gimme the right type!"
);
SAL_WARN_IF
(
nType
!=
CompType
(
nIdx
),
"sw.core"
,
"Gimme the right type!"
);
#endif
#endif
...
...
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