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
cd23e6d3
Kaydet (Commit)
cd23e6d3
authored
Nis 17, 2015
tarafından
Noel Grandin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
convert BorderWidth flags to scoped enum
Change-Id: I99214dc2056122158df9d861e3fb3e44bf0b16f6
üst
0578aa4d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
34 deletions
+42
-34
borderline.cxx
editeng/source/items/borderline.cxx
+14
-14
ctrlbox.hxx
include/svtools/ctrlbox.hxx
+15
-7
ctrlbox.cxx
svtools/source/control/ctrlbox.cxx
+13
-13
No files found.
editeng/source/items/borderline.cxx
Dosyayı görüntüle @
cd23e6d3
...
@@ -307,7 +307,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
...
@@ -307,7 +307,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
{
{
// No line: no width
// No line: no width
case
css
:
:
table
::
BorderLineStyle
::
NONE
:
case
css
:
:
table
::
BorderLineStyle
::
NONE
:
aImpl
=
BorderWidthImpl
(
0
,
0.0
);
aImpl
=
BorderWidthImpl
(
BorderWidthImplFlags
::
FIXED
,
0.0
);
break
;
break
;
// Single lines
// Single lines
...
@@ -317,52 +317,52 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
...
@@ -317,52 +317,52 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
case
FINE_DASHED
:
case
FINE_DASHED
:
case
DASH_DOT
:
case
DASH_DOT
:
case
DASH_DOT_DOT
:
case
DASH_DOT_DOT
:
aImpl
=
BorderWidthImpl
(
CHANGE_LINE1
,
1.0
);
aImpl
=
BorderWidthImpl
(
BorderWidthImplFlags
::
CHANGE_LINE1
,
1.0
);
break
;
break
;
// Double lines
// Double lines
case
DOUBLE
:
case
DOUBLE
:
aImpl
=
BorderWidthImpl
(
aImpl
=
BorderWidthImpl
(
CHANGE_LINE1
|
CHANGE_LINE2
|
CHANGE_DIST
,
BorderWidthImplFlags
::
CHANGE_LINE1
|
BorderWidthImplFlags
::
CHANGE_LINE2
|
BorderWidthImplFlags
::
CHANGE_DIST
,
// fdo#46112 fdo#38542 fdo#43249:
// fdo#46112 fdo#38542 fdo#43249:
// non-constant witdths must sum to 1
// non-constant witdths must sum to 1
1.0
/
3.0
,
1.0
/
3.0
,
1.0
/
3.0
);
1.0
/
3.0
,
1.0
/
3.0
,
1.0
/
3.0
);
break
;
break
;
case
DOUBLE_THIN
:
case
DOUBLE_THIN
:
aImpl
=
BorderWidthImpl
(
CHANGE_DIST
,
10.0
,
10.0
,
1.0
);
aImpl
=
BorderWidthImpl
(
BorderWidthImplFlags
::
CHANGE_DIST
,
10.0
,
10.0
,
1.0
);
break
;
break
;
case
THINTHICK_SMALLGAP
:
case
THINTHICK_SMALLGAP
:
aImpl
=
BorderWidthImpl
(
CHANGE_LINE1
,
1.0
,
aImpl
=
BorderWidthImpl
(
BorderWidthImplFlags
::
CHANGE_LINE1
,
1.0
,
THINTHICK_SMALLGAP_line2
,
THINTHICK_SMALLGAP_gap
);
THINTHICK_SMALLGAP_line2
,
THINTHICK_SMALLGAP_gap
);
break
;
break
;
case
THINTHICK_MEDIUMGAP
:
case
THINTHICK_MEDIUMGAP
:
aImpl
=
BorderWidthImpl
(
aImpl
=
BorderWidthImpl
(
CHANGE_LINE1
|
CHANGE_LINE2
|
CHANGE_DIST
,
BorderWidthImplFlags
::
CHANGE_LINE1
|
BorderWidthImplFlags
::
CHANGE_LINE2
|
BorderWidthImplFlags
::
CHANGE_DIST
,
0.5
,
0.25
,
0.25
);
0.5
,
0.25
,
0.25
);
break
;
break
;
case
THINTHICK_LARGEGAP
:
case
THINTHICK_LARGEGAP
:
aImpl
=
BorderWidthImpl
(
CHANGE_DIST
,
aImpl
=
BorderWidthImpl
(
BorderWidthImplFlags
::
CHANGE_DIST
,
THINTHICK_LARGEGAP_line1
,
THINTHICK_LARGEGAP_line2
,
1.0
);
THINTHICK_LARGEGAP_line1
,
THINTHICK_LARGEGAP_line2
,
1.0
);
break
;
break
;
case
THICKTHIN_SMALLGAP
:
case
THICKTHIN_SMALLGAP
:
aImpl
=
BorderWidthImpl
(
CHANGE_LINE2
,
THICKTHIN_SMALLGAP_line1
,
aImpl
=
BorderWidthImpl
(
BorderWidthImplFlags
::
CHANGE_LINE2
,
THICKTHIN_SMALLGAP_line1
,
1.0
,
THICKTHIN_SMALLGAP_gap
);
1.0
,
THICKTHIN_SMALLGAP_gap
);
break
;
break
;
case
THICKTHIN_MEDIUMGAP
:
case
THICKTHIN_MEDIUMGAP
:
aImpl
=
BorderWidthImpl
(
aImpl
=
BorderWidthImpl
(
CHANGE_LINE1
|
CHANGE_LINE2
|
CHANGE_DIST
,
BorderWidthImplFlags
::
CHANGE_LINE1
|
BorderWidthImplFlags
::
CHANGE_LINE2
|
BorderWidthImplFlags
::
CHANGE_DIST
,
0.25
,
0.5
,
0.25
);
0.25
,
0.5
,
0.25
);
break
;
break
;
case
THICKTHIN_LARGEGAP
:
case
THICKTHIN_LARGEGAP
:
aImpl
=
BorderWidthImpl
(
CHANGE_DIST
,
THICKTHIN_LARGEGAP_line1
,
aImpl
=
BorderWidthImpl
(
BorderWidthImplFlags
::
CHANGE_DIST
,
THICKTHIN_LARGEGAP_line1
,
THICKTHIN_LARGEGAP_line2
,
1.0
);
THICKTHIN_LARGEGAP_line2
,
1.0
);
break
;
break
;
...
@@ -375,7 +375,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
...
@@ -375,7 +375,7 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
case
EMBOSSED
:
case
EMBOSSED
:
case
ENGRAVED
:
case
ENGRAVED
:
aImpl
=
BorderWidthImpl
(
aImpl
=
BorderWidthImpl
(
CHANGE_LINE1
|
CHANGE_LINE2
|
CHANGE_DIST
,
BorderWidthImplFlags
::
CHANGE_LINE1
|
BorderWidthImplFlags
::
CHANGE_LINE2
|
BorderWidthImplFlags
::
CHANGE_DIST
,
0.25
,
0.25
,
0.5
);
0.25
,
0.25
,
0.5
);
break
;
break
;
...
@@ -386,13 +386,13 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
...
@@ -386,13 +386,13 @@ BorderWidthImpl SvxBorderLine::getWidthImpl( SvxBorderStyle nStyle )
*/
*/
case
OUTSET
:
case
OUTSET
:
aImpl
=
BorderWidthImpl
(
aImpl
=
BorderWidthImpl
(
CHANGE_LINE2
|
CHANGE_DIST
,
BorderWidthImplFlags
::
CHANGE_LINE2
|
BorderWidthImplFlags
::
CHANGE_DIST
,
OUTSET_line1
,
0.5
,
0.5
);
OUTSET_line1
,
0.5
,
0.5
);
break
;
break
;
case
INSET
:
case
INSET
:
aImpl
=
BorderWidthImpl
(
aImpl
=
BorderWidthImpl
(
CHANGE_LINE1
|
CHANGE_DIST
,
BorderWidthImplFlags
::
CHANGE_LINE1
|
BorderWidthImplFlags
::
CHANGE_DIST
,
0.5
,
INSET_line2
,
0.5
);
0.5
,
INSET_line2
,
0.5
);
break
;
break
;
}
}
...
@@ -481,7 +481,7 @@ void SvxBorderLine::GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sa
...
@@ -481,7 +481,7 @@ void SvxBorderLine::GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sa
if
(
nOut
+
nIn
+
nDist
)
if
(
nOut
+
nIn
+
nDist
)
{
{
m_aWidthImpl
=
BorderWidthImpl
(
m_aWidthImpl
=
BorderWidthImpl
(
CHANGE_LINE1
|
CHANGE_LINE2
|
CHANGE_DIST
,
BorderWidthImplFlags
::
CHANGE_LINE1
|
BorderWidthImplFlags
::
CHANGE_LINE2
|
BorderWidthImplFlags
::
CHANGE_DIST
,
static_cast
<
double
>
(
nOut
)
/
static_cast
<
double
>
(
m_nWidth
),
static_cast
<
double
>
(
nOut
)
/
static_cast
<
double
>
(
m_nWidth
),
static_cast
<
double
>
(
nIn
)
/
static_cast
<
double
>
(
m_nWidth
),
static_cast
<
double
>
(
nIn
)
/
static_cast
<
double
>
(
m_nWidth
),
static_cast
<
double
>
(
nDist
)
/
static_cast
<
double
>
(
m_nWidth
));
static_cast
<
double
>
(
nDist
)
/
static_cast
<
double
>
(
m_nWidth
));
...
...
include/svtools/ctrlbox.hxx
Dosyayı görüntüle @
cd23e6d3
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include <vcl/field.hxx>
#include <vcl/field.hxx>
#include <com/sun/star/table/BorderLineStyle.hpp>
#include <com/sun/star/table/BorderLineStyle.hpp>
#include <o3tl/typed_flags_set.hxx>
class
FontList
;
class
FontList
;
class
ImplColorListData
;
class
ImplColorListData
;
...
@@ -39,11 +40,6 @@ typedef ::std::vector< ImplColorListData* > ImpColorList;
...
@@ -39,11 +40,6 @@ typedef ::std::vector< ImplColorListData* > ImpColorList;
typedef
::
std
::
vector
<
ImpLineListData
*
>
ImpLineList
;
typedef
::
std
::
vector
<
ImpLineListData
*
>
ImpLineList
;
typedef
::
std
::
vector
<
vcl
::
FontInfo
>
ImplFontList
;
typedef
::
std
::
vector
<
vcl
::
FontInfo
>
ImplFontList
;
#define CHANGE_LINE1 ( ( sal_uInt16 ) 1 )
#define CHANGE_LINE2 ( ( sal_uInt16 ) 2 )
#define CHANGE_DIST ( ( sal_uInt16 ) 4 )
#define ADAPT_DIST ( ( sal_uInt16 ) 8 )
/*************************************************************************
/*************************************************************************
Description
Description
...
@@ -238,16 +234,28 @@ inline Color ColorListBox::GetSelectEntryColor( sal_Int32 nSelIndex ) const
...
@@ -238,16 +234,28 @@ inline Color ColorListBox::GetSelectEntryColor( sal_Int32 nSelIndex ) const
For each line, the rate member is used as a multiplication factor is the width
For each line, the rate member is used as a multiplication factor is the width
isn't fixed. Otherwise it is the width in the unit expected by the client code.
isn't fixed. Otherwise it is the width in the unit expected by the client code.
*/
*/
enum
class
BorderWidthImplFlags
{
FIXED
=
0
,
CHANGE_LINE1
=
1
,
CHANGE_LINE2
=
2
,
CHANGE_DIST
=
4
,
ADAPT_DIST
=
8
,
};
namespace
o3tl
{
template
<>
struct
typed_flags
<
BorderWidthImplFlags
>
:
is_typed_flags
<
BorderWidthImplFlags
,
0x0f
>
{};
}
class
SVT_DLLPUBLIC
BorderWidthImpl
class
SVT_DLLPUBLIC
BorderWidthImpl
{
{
sal_uInt16
m_nFlags
;
BorderWidthImplFlags
m_nFlags
;
double
m_nRate1
;
double
m_nRate1
;
double
m_nRate2
;
double
m_nRate2
;
double
m_nRateGap
;
double
m_nRateGap
;
public
:
public
:
BorderWidthImpl
(
sal_uInt16
nFlags
=
CHANGE_LINE1
,
double
nRate1
=
0.0
,
BorderWidthImpl
(
BorderWidthImplFlags
nFlags
=
BorderWidthImplFlags
::
CHANGE_LINE1
,
double
nRate1
=
0.0
,
double
nRate2
=
0.0
,
double
nRateGap
=
0.0
);
double
nRate2
=
0.0
,
double
nRateGap
=
0.0
);
BorderWidthImpl
&
operator
=
(
const
BorderWidthImpl
&
r
);
BorderWidthImpl
&
operator
=
(
const
BorderWidthImpl
&
r
);
...
...
svtools/source/control/ctrlbox.cxx
Dosyayı görüntüle @
cd23e6d3
...
@@ -283,7 +283,7 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt )
...
@@ -283,7 +283,7 @@ void ColorListBox::UserDraw( const UserDrawEvent& rUDEvt )
ListBox
::
DrawEntry
(
rUDEvt
,
true
,
true
,
false
);
ListBox
::
DrawEntry
(
rUDEvt
,
true
,
true
,
false
);
}
}
BorderWidthImpl
::
BorderWidthImpl
(
sal_uInt16
nFlags
,
double
nRate1
,
double
nRate2
,
double
nRateGap
)
:
BorderWidthImpl
::
BorderWidthImpl
(
BorderWidthImplFlags
nFlags
,
double
nRate1
,
double
nRate2
,
double
nRateGap
)
:
m_nFlags
(
nFlags
),
m_nFlags
(
nFlags
),
m_nRate1
(
nRate1
),
m_nRate1
(
nRate1
),
m_nRate2
(
nRate2
),
m_nRate2
(
nRate2
),
...
@@ -311,10 +311,10 @@ bool BorderWidthImpl::operator== ( const BorderWidthImpl& r ) const
...
@@ -311,10 +311,10 @@ bool BorderWidthImpl::operator== ( const BorderWidthImpl& r ) const
long
BorderWidthImpl
::
GetLine1
(
long
nWidth
)
const
long
BorderWidthImpl
::
GetLine1
(
long
nWidth
)
const
{
{
long
result
=
static_cast
<
long
>
(
m_nRate1
);
long
result
=
static_cast
<
long
>
(
m_nRate1
);
if
(
(
m_nFlags
&
CHANGE_LINE1
)
>
0
)
if
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_LINE1
)
{
{
long
const
nConstant2
=
(
m_nFlags
&
CHANGE_LINE2
)
?
0
:
m_nRate2
;
long
const
nConstant2
=
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_LINE2
)
?
0
:
m_nRate2
;
long
const
nConstantD
=
(
m_nFlags
&
CHANGE_DIST
)
?
0
:
m_nRateGap
;
long
const
nConstantD
=
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_DIST
)
?
0
:
m_nRateGap
;
result
=
std
::
max
<
long
>
(
0
,
result
=
std
::
max
<
long
>
(
0
,
static_cast
<
long
>
((
m_nRate1
*
nWidth
)
+
0.5
)
static_cast
<
long
>
((
m_nRate1
*
nWidth
)
+
0.5
)
-
(
nConstant2
+
nConstantD
));
-
(
nConstant2
+
nConstantD
));
...
@@ -329,10 +329,10 @@ long BorderWidthImpl::GetLine1( long nWidth ) const
...
@@ -329,10 +329,10 @@ long BorderWidthImpl::GetLine1( long nWidth ) const
long
BorderWidthImpl
::
GetLine2
(
long
nWidth
)
const
long
BorderWidthImpl
::
GetLine2
(
long
nWidth
)
const
{
{
long
result
=
static_cast
<
long
>
(
m_nRate2
);
long
result
=
static_cast
<
long
>
(
m_nRate2
);
if
(
(
m_nFlags
&
CHANGE_LINE2
)
>
0
)
if
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_LINE2
)
{
{
long
const
nConstant1
=
(
m_nFlags
&
CHANGE_LINE1
)
?
0
:
m_nRate1
;
long
const
nConstant1
=
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_LINE1
)
?
0
:
m_nRate1
;
long
const
nConstantD
=
(
m_nFlags
&
CHANGE_DIST
)
?
0
:
m_nRateGap
;
long
const
nConstantD
=
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_DIST
)
?
0
:
m_nRateGap
;
result
=
std
::
max
<
long
>
(
0
,
result
=
std
::
max
<
long
>
(
0
,
static_cast
<
long
>
((
m_nRate2
*
nWidth
)
+
0.5
)
static_cast
<
long
>
((
m_nRate2
*
nWidth
)
+
0.5
)
-
(
nConstant1
+
nConstantD
));
-
(
nConstant1
+
nConstantD
));
...
@@ -343,10 +343,10 @@ long BorderWidthImpl::GetLine2( long nWidth ) const
...
@@ -343,10 +343,10 @@ long BorderWidthImpl::GetLine2( long nWidth ) const
long
BorderWidthImpl
::
GetGap
(
long
nWidth
)
const
long
BorderWidthImpl
::
GetGap
(
long
nWidth
)
const
{
{
long
result
=
static_cast
<
long
>
(
m_nRateGap
);
long
result
=
static_cast
<
long
>
(
m_nRateGap
);
if
(
(
m_nFlags
&
CHANGE_DIST
)
>
0
)
if
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_DIST
)
{
{
long
const
nConstant1
=
(
m_nFlags
&
CHANGE_LINE1
)
?
0
:
m_nRate1
;
long
const
nConstant1
=
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_LINE1
)
?
0
:
m_nRate1
;
long
const
nConstant2
=
(
m_nFlags
&
CHANGE_LINE2
)
?
0
:
m_nRate2
;
long
const
nConstant2
=
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_LINE2
)
?
0
:
m_nRate2
;
result
=
std
::
max
<
long
>
(
0
,
result
=
std
::
max
<
long
>
(
0
,
static_cast
<
long
>
((
m_nRateGap
*
nWidth
)
+
0.5
)
static_cast
<
long
>
((
m_nRateGap
*
nWidth
)
+
0.5
)
-
(
nConstant1
+
nConstant2
));
-
(
nConstant1
+
nConstant2
));
...
@@ -378,21 +378,21 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap )
...
@@ -378,21 +378,21 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap )
std
::
vector
<
double
>
aToCompare
;
std
::
vector
<
double
>
aToCompare
;
bool
bInvalid
=
false
;
bool
bInvalid
=
false
;
bool
bLine1Change
=
(
m_nFlags
&
CHANGE_LINE1
)
>
0
;
bool
bLine1Change
=
bool
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_LINE1
)
;
double
nWidth1
=
lcl_getGuessedWidth
(
nLine1
,
m_nRate1
,
bLine1Change
);
double
nWidth1
=
lcl_getGuessedWidth
(
nLine1
,
m_nRate1
,
bLine1Change
);
if
(
bLine1Change
)
if
(
bLine1Change
)
aToCompare
.
push_back
(
nWidth1
);
aToCompare
.
push_back
(
nWidth1
);
else
if
(
!
bLine1Change
&&
nWidth1
<
0
)
else
if
(
!
bLine1Change
&&
nWidth1
<
0
)
bInvalid
=
true
;
bInvalid
=
true
;
bool
bLine2Change
=
(
m_nFlags
&
CHANGE_LINE2
)
>
0
;
bool
bLine2Change
=
bool
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_LINE2
)
;
double
nWidth2
=
lcl_getGuessedWidth
(
nLine2
,
m_nRate2
,
bLine2Change
);
double
nWidth2
=
lcl_getGuessedWidth
(
nLine2
,
m_nRate2
,
bLine2Change
);
if
(
bLine2Change
)
if
(
bLine2Change
)
aToCompare
.
push_back
(
nWidth2
);
aToCompare
.
push_back
(
nWidth2
);
else
if
(
!
bLine2Change
&&
nWidth2
<
0
)
else
if
(
!
bLine2Change
&&
nWidth2
<
0
)
bInvalid
=
true
;
bInvalid
=
true
;
bool
bGapChange
=
(
m_nFlags
&
CHANGE_DIST
)
>
0
;
bool
bGapChange
=
bool
(
m_nFlags
&
BorderWidthImplFlags
::
CHANGE_DIST
)
;
double
nWidthGap
=
lcl_getGuessedWidth
(
nGap
,
m_nRateGap
,
bGapChange
);
double
nWidthGap
=
lcl_getGuessedWidth
(
nGap
,
m_nRateGap
,
bGapChange
);
if
(
bGapChange
&&
nGap
>
MINGAPWIDTH
)
if
(
bGapChange
&&
nGap
>
MINGAPWIDTH
)
aToCompare
.
push_back
(
nWidthGap
);
aToCompare
.
push_back
(
nWidthGap
);
...
...
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