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
cd5d4147
Kaydet (Commit)
cd5d4147
authored
Eki 08, 2012
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
support max-width-chars property for labels
Change-Id: I23245919c5180035fedb308fb5cc97bf3238ec07
üst
34638df6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
21 deletions
+62
-21
fixed.hxx
vcl/inc/vcl/fixed.hxx
+8
-2
button.cxx
vcl/source/control/button.cxx
+3
-3
fixed.cxx
vcl/source/control/fixed.cxx
+51
-16
No files found.
vcl/inc/vcl/fixed.hxx
Dosyayı görüntüle @
cd5d4147
...
...
@@ -44,6 +44,8 @@ class UserDrawEvent;
class
VCL_DLLPUBLIC
FixedText
:
public
Control
{
private
:
sal_Int32
m_nMaxWidthChars
;
using
Control
::
ImplInitSettings
;
using
Window
::
ImplInit
;
SAL_DLLPRIVATE
void
ImplInit
(
Window
*
pParent
,
WinBits
nStyle
);
...
...
@@ -71,10 +73,14 @@ public:
virtual
void
StateChanged
(
StateChangedType
nType
);
virtual
void
DataChanged
(
const
DataChangedEvent
&
rDCEvt
);
static
Size
CalcMinimumTextSize
(
Control
const
*
pControl
,
long
nMaxWidth
=
0
);
Size
CalcMinimumSize
(
long
nMaxWidth
=
0
)
const
;
void
setMaxWidthChars
(
sal_Int32
nWidth
);
sal_Int32
getMaxWidthChars
()
const
{
return
m_nMaxWidthChars
;
}
static
Size
CalcMinimumTextSize
(
Control
const
*
pControl
,
long
nMaxWidth
=
0x7fffffff
);
static
Size
getTextDimensions
(
Control
const
*
pControl
,
const
OUString
&
rTxt
,
long
nMaxWidth
);
Size
CalcMinimumSize
(
long
nMaxWidth
=
0x7fffffff
)
const
;
virtual
Size
GetOptimalSize
(
WindowSizeType
eType
)
const
;
virtual
void
take_properties
(
Window
&
rOther
);
virtual
bool
set_property
(
const
rtl
::
OString
&
rKey
,
const
rtl
::
OString
&
rValue
);
};
// -------------
...
...
vcl/source/control/button.cxx
Dosyayı görüntüle @
cd5d4147
...
...
@@ -1748,7 +1748,7 @@ Size PushButton::GetOptimalSize(WindowSizeType eType) const
bool
PushButton
::
set_property
(
const
rtl
::
OString
&
rKey
,
const
rtl
::
OString
&
rValue
)
{
if
(
rKey
.
equalsL
(
RTL_CONSTASCII_STRINGPARAM
(
"has-default"
))
)
if
(
rKey
==
"has-default"
)
{
WinBits
nBits
=
GetStyle
();
nBits
&=
~
(
WB_DEFBUTTON
);
...
...
@@ -2912,7 +2912,7 @@ void RadioButton::SetState( sal_Bool bCheck )
bool
RadioButton
::
set_property
(
const
rtl
::
OString
&
rKey
,
const
rtl
::
OString
&
rValue
)
{
if
(
rKey
.
equalsL
(
RTL_CONSTASCII_STRINGPARAM
(
"active"
))
)
if
(
rKey
==
"active"
)
SetState
(
toBool
(
rValue
));
else
return
Window
::
set_property
(
rKey
,
rValue
);
...
...
@@ -3885,7 +3885,7 @@ void CheckBox::SetState( TriState eState )
bool
CheckBox
::
set_property
(
const
rtl
::
OString
&
rKey
,
const
rtl
::
OString
&
rValue
)
{
if
(
rKey
.
equalsL
(
RTL_CONSTASCII_STRINGPARAM
(
"active"
))
)
if
(
rKey
==
"active"
)
SetState
(
toBool
(
rValue
)
?
STATE_CHECK
:
STATE_NOCHECK
);
else
return
Window
::
set_property
(
rKey
,
rValue
);
...
...
vcl/source/control/fixed.cxx
Dosyayı görüntüle @
cd5d4147
...
...
@@ -154,16 +154,18 @@ void FixedText::ImplInitSettings( sal_Bool bFont,
// -----------------------------------------------------------------------
FixedText
::
FixedText
(
Window
*
pParent
,
WinBits
nStyle
)
:
Control
(
WINDOW_FIXEDTEXT
)
FixedText
::
FixedText
(
Window
*
pParent
,
WinBits
nStyle
)
:
Control
(
WINDOW_FIXEDTEXT
)
,
m_nMaxWidthChars
(
-
1
)
{
ImplInit
(
pParent
,
nStyle
);
}
// -----------------------------------------------------------------------
FixedText
::
FixedText
(
Window
*
pParent
,
const
ResId
&
rResId
)
:
Control
(
WINDOW_FIXEDTEXT
)
FixedText
::
FixedText
(
Window
*
pParent
,
const
ResId
&
rResId
)
:
Control
(
WINDOW_FIXEDTEXT
)
,
m_nMaxWidthChars
(
-
1
)
{
rResId
.
SetRT
(
RSC_TEXT
);
WinBits
nStyle
=
ImplInitRes
(
rResId
);
...
...
@@ -188,8 +190,9 @@ void FixedText::take_properties(Window &rOther)
// -----------------------------------------------------------------------
FixedText
::
FixedText
(
Window
*
pParent
,
const
ResId
&
rResId
,
bool
bDisableAccessibleLabelForRelation
)
:
Control
(
WINDOW_FIXEDTEXT
)
FixedText
::
FixedText
(
Window
*
pParent
,
const
ResId
&
rResId
,
bool
bDisableAccessibleLabelForRelation
)
:
Control
(
WINDOW_FIXEDTEXT
)
,
m_nMaxWidthChars
(
-
1
)
{
rResId
.
SetRT
(
RSC_TEXT
);
WinBits
nStyle
=
ImplInitRes
(
rResId
);
...
...
@@ -397,14 +400,20 @@ void FixedText::DataChanged( const DataChangedEvent& rDCEvt )
// -----------------------------------------------------------------------
Size
FixedText
::
CalcMinimumTextSize
(
Control
const
*
pControl
,
long
nMaxWidth
)
Size
FixedText
::
getTextDimensions
(
Control
const
*
pControl
,
const
OUString
&
rTxt
,
long
nMaxWidth
)
{
sal_uInt16
nStyle
=
ImplGetTextStyle
(
pControl
->
GetStyle
()
);
if
(
!
(
pControl
->
GetStyle
()
&
WB_NOLABEL
)
)
nStyle
|=
TEXT_DRAW_MNEMONIC
;
Size
aSize
=
pControl
->
GetTextRect
(
Rectangle
(
Point
(),
Size
(
(
nMaxWidth
?
nMaxWidth
:
0x7fffffff
),
0x7fffffff
)
),
pControl
->
GetText
(),
nStyle
).
GetSize
();
return
pControl
->
GetTextRect
(
Rectangle
(
Point
(),
Size
(
nMaxWidth
,
0x7fffffff
)),
rTxt
,
nStyle
).
GetSize
();
}
Size
FixedText
::
CalcMinimumTextSize
(
Control
const
*
pControl
,
long
nMaxWidth
)
{
Size
aSize
=
getTextDimensions
(
pControl
,
pControl
->
GetText
(),
nMaxWidth
);
if
(
pControl
->
GetStyle
()
&
WB_EXTRAOFFSET
)
aSize
.
Width
()
+=
2
;
...
...
@@ -426,22 +435,48 @@ Size FixedText::CalcMinimumSize( long nMaxWidth ) const
Size
FixedText
::
GetOptimalSize
(
WindowSizeType
eType
)
const
{
switch
(
eType
)
{
case
WINDOWSIZE_MINIMUM
:
return
CalcMinimumSize
();
default
:
return
Control
::
GetOptimalSize
(
eType
);
switch
(
eType
)
{
case
WINDOWSIZE_MINIMUM
:
{
sal_Int32
nMaxAvailWidth
=
0x7fffffff
;
const
OUString
&
rTxt
=
GetText
();
if
(
m_nMaxWidthChars
!=
-
1
&&
m_nMaxWidthChars
<
rTxt
.
getLength
())
{
nMaxAvailWidth
=
getTextDimensions
(
this
,
rTxt
.
copy
(
0
,
m_nMaxWidthChars
),
0x7fffffff
).
Width
();
}
return
CalcMinimumSize
(
nMaxAvailWidth
);
}
default
:
return
Control
::
GetOptimalSize
(
eType
);
}
}
// -----------------------------------------------------------------------
void
FixedText
::
FillLayoutData
()
const
void
FixedText
::
FillLayoutData
()
const
{
mpControlData
->
mpLayoutData
=
new
vcl
::
ControlLayoutData
();
ImplDraw
(
const_cast
<
FixedText
*>
(
this
),
0
,
Point
(),
GetOutputSizePixel
(),
true
);
}
void
FixedText
::
setMaxWidthChars
(
sal_Int32
nWidth
)
{
m_nMaxWidthChars
=
nWidth
;
queue_resize
();
}
bool
FixedText
::
set_property
(
const
rtl
::
OString
&
rKey
,
const
rtl
::
OString
&
rValue
)
{
if
(
rKey
==
"max-width-chars"
)
{
setMaxWidthChars
(
rValue
.
toInt32
());
}
else
return
Control
::
set_property
(
rKey
,
rValue
);
}
// =======================================================================
void
FixedLine
::
ImplInit
(
Window
*
pParent
,
WinBits
nStyle
)
...
...
@@ -705,7 +740,7 @@ Size FixedLine::GetOptimalSize(WindowSizeType eType) const
{
switch
(
eType
)
{
case
WINDOWSIZE_MINIMUM
:
return
CalcWindowSize
(
FixedText
::
CalcMinimumTextSize
(
this
)
);
return
CalcWindowSize
(
FixedText
::
CalcMinimumTextSize
(
this
,
0x7fffffff
)
);
default
:
return
Control
::
GetOptimalSize
(
eType
);
}
...
...
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