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
7cf8320c
Kaydet (Commit)
7cf8320c
authored
Şub 18, 2013
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add a mechanism to load TimeFields from .ui files
Change-Id: I7704f46d262888639a17c5219e784559db91b847
üst
9a49ff64
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
27 deletions
+100
-27
builder.hxx
vcl/inc/vcl/builder.hxx
+9
-4
builder.cxx
vcl/source/window/builder.cxx
+91
-23
No files found.
vcl/inc/vcl/builder.hxx
Dosyayı görüntüle @
7cf8320c
...
...
@@ -23,6 +23,7 @@ class ListBox;
class
NumericFormatter
;
class
PopupMenu
;
class
ScrollBar
;
class
TimeField
;
class
VclMultiLineEdit
;
class
VCL_DLLPUBLIC
VclBuilder
...
...
@@ -127,8 +128,9 @@ private:
typedef
stringmap
Adjustment
;
const
Adjustment
*
get_adjustment_by_name
(
OString
sID
)
const
;
static
void
mungeSpinAdjustment
(
NumericFormatter
&
rTarget
,
const
Adjustment
&
rAdjustment
);
static
void
mungeScrollAdjustment
(
ScrollBar
&
rTarget
,
const
Adjustment
&
rAdjustment
);
static
void
mungeAdjustment
(
NumericFormatter
&
rTarget
,
const
Adjustment
&
rAdjustment
);
static
void
mungeAdjustment
(
TimeField
&
rTarget
,
const
Adjustment
&
rAdjustment
);
static
void
mungeAdjustment
(
ScrollBar
&
rTarget
,
const
Adjustment
&
rAdjustment
);
typedef
std
::
map
<
OString
,
OString
>
WidgetTranslations
;
typedef
std
::
map
<
OString
,
WidgetTranslations
>
Translations
;
...
...
@@ -165,7 +167,8 @@ private:
std
::
vector
<
TextBufferMap
>
m_aTextBufferMaps
;
std
::
map
<
OString
,
TextBuffer
>
m_aTextBuffers
;
std
::
vector
<
WidgetAdjustmentMap
>
m_aSpinAdjustmentMaps
;
std
::
vector
<
WidgetAdjustmentMap
>
m_aNumericFormatterAdjustmentMaps
;
std
::
vector
<
WidgetAdjustmentMap
>
m_aTimeFormatterAdjustmentMaps
;
std
::
vector
<
WidgetAdjustmentMap
>
m_aScrollAdjustmentMaps
;
std
::
map
<
OString
,
Adjustment
>
m_aAdjustments
;
...
...
@@ -258,10 +261,12 @@ private:
Window
*
makeObject
(
Window
*
pParent
,
const
OString
&
rClass
,
const
OString
&
rID
,
stringmap
&
rVec
,
const
std
::
vector
<
OString
>
&
rItems
);
void
connectNumericFormatterAdjustment
(
const
OString
&
id
,
const
OString
&
rAdjustment
);
void
connectTimeFormatterAdjustment
(
const
OString
&
id
,
const
OString
&
rAdjustment
);
bool
extractGroup
(
const
OString
&
id
,
stringmap
&
rVec
);
bool
extractModel
(
const
OString
&
id
,
stringmap
&
rVec
);
bool
extractBuffer
(
const
OString
&
id
,
stringmap
&
rVec
);
bool
extractSpinAdjustment
(
const
OString
&
id
,
stringmap
&
rVec
);
bool
extractScrollAdjustment
(
const
OString
&
id
,
stringmap
&
rVec
);
bool
extractButtonImage
(
const
OString
&
id
,
stringmap
&
rMap
,
bool
bRadio
);
bool
extractStock
(
const
OString
&
id
,
stringmap
&
rMap
);
...
...
vcl/source/window/builder.cxx
Dosyayı görüntüle @
7cf8320c
...
...
@@ -236,14 +236,24 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
}
//Set SpinButton adjustments when everything has been imported
for
(
std
::
vector
<
WidgetAdjustmentMap
>::
iterator
aI
=
m_pParserState
->
m_a
Spin
AdjustmentMaps
.
begin
(),
aEnd
=
m_pParserState
->
m_a
Spin
AdjustmentMaps
.
end
();
aI
!=
aEnd
;
++
aI
)
for
(
std
::
vector
<
WidgetAdjustmentMap
>::
iterator
aI
=
m_pParserState
->
m_a
NumericFormatter
AdjustmentMaps
.
begin
(),
aEnd
=
m_pParserState
->
m_a
NumericFormatter
AdjustmentMaps
.
end
();
aI
!=
aEnd
;
++
aI
)
{
NumericFormatter
*
pTarget
=
dynamic_cast
<
NumericFormatter
*>
(
get
<
Window
>
(
aI
->
m_sID
));
const
Adjustment
*
pAdjustment
=
get_adjustment_by_name
(
aI
->
m_sValue
);
SAL_WARN_IF
(
!
pTarget
||
!
pAdjustment
,
"vcl"
,
"missing elements of spinbutton/adjustment"
);
if
(
pTarget
&&
pAdjustment
)
mungeSpinAdjustment
(
*
pTarget
,
*
pAdjustment
);
mungeAdjustment
(
*
pTarget
,
*
pAdjustment
);
}
for
(
std
::
vector
<
WidgetAdjustmentMap
>::
iterator
aI
=
m_pParserState
->
m_aTimeFormatterAdjustmentMaps
.
begin
(),
aEnd
=
m_pParserState
->
m_aTimeFormatterAdjustmentMaps
.
end
();
aI
!=
aEnd
;
++
aI
)
{
TimeField
*
pTarget
=
dynamic_cast
<
TimeField
*>
(
get
<
Window
>
(
aI
->
m_sID
));
const
Adjustment
*
pAdjustment
=
get_adjustment_by_name
(
aI
->
m_sValue
);
SAL_WARN_IF
(
!
pTarget
||
!
pAdjustment
,
"vcl"
,
"missing elements of spinbutton/adjustment"
);
if
(
pTarget
&&
pAdjustment
)
mungeAdjustment
(
*
pTarget
,
*
pAdjustment
);
}
//Set ScrollBar adjustments when everything has been imported
...
...
@@ -254,7 +264,7 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri
const
Adjustment
*
pAdjustment
=
get_adjustment_by_name
(
aI
->
m_sValue
);
SAL_WARN_IF
(
!
pTarget
||
!
pAdjustment
,
"vcl"
,
"missing elements of scrollbar/adjustment"
);
if
(
pTarget
&&
pAdjustment
)
munge
Scroll
Adjustment
(
*
pTarget
,
*
pAdjustment
);
mungeAdjustment
(
*
pTarget
,
*
pAdjustment
);
}
//Set size-groups when all widgets have been imported
...
...
@@ -663,6 +673,8 @@ namespace
else
if
(
sUnit
==
"%"
)
eUnit
=
FUNIT_PERCENT
;
assert
(
eUnit
!=
FUNIT_NONE
);
//unknown unit
return
eUnit
;
}
...
...
@@ -691,19 +703,19 @@ bool VclBuilder::extractGroup(const OString &id, stringmap &rMap)
return
false
;
}
bool
VclBuilder
::
extractSpinAdjustment
(
const
OString
&
id
,
stringmap
&
rMap
)
void
VclBuilder
::
connectNumericFormatterAdjustment
(
const
OString
&
id
,
const
OString
&
rAdjustment
)
{
VclBuilder
::
stringmap
::
iterator
aFind
=
rMap
.
find
(
OString
(
"adjustment"
));
if
(
aFind
!=
rMap
.
end
())
{
m_pParserState
->
m_aSpinAdjustmentMaps
.
push_back
(
WidgetAdjustmentMap
(
id
,
aFind
->
second
));
rMap
.
erase
(
aFind
);
return
true
;
}
return
false
;
if
(
!
rAdjustment
.
isEmpty
())
m_pParserState
->
m_aNumericFormatterAdjustmentMaps
.
push_back
(
WidgetAdjustmentMap
(
id
,
rAdjustment
));
}
void
VclBuilder
::
connectTimeFormatterAdjustment
(
const
OString
&
id
,
const
OString
&
rAdjustment
)
{
if
(
!
rAdjustment
.
isEmpty
())
m_pParserState
->
m_aTimeFormatterAdjustmentMaps
.
push_back
(
WidgetAdjustmentMap
(
id
,
rAdjustment
))
;
}
bool
VclBuilder
::
extractScrollAdjustment
(
const
OString
&
id
,
stringmap
&
rMap
)
bool
VclBuilder
::
extractScrollAdjustment
(
const
OString
&
id
,
VclBuilder
::
stringmap
&
rMap
)
{
VclBuilder
::
stringmap
::
iterator
aFind
=
rMap
.
find
(
OString
(
"adjustment"
));
if
(
aFind
!=
rMap
.
end
())
...
...
@@ -741,6 +753,18 @@ namespace
return
bSelectable
;
}
OString
extractAdjustment
(
VclBuilder
::
stringmap
&
rMap
)
{
OString
sAdjustment
;
VclBuilder
::
stringmap
::
iterator
aFind
=
rMap
.
find
(
OString
(
"adjustment"
));
if
(
aFind
!=
rMap
.
end
())
{
sAdjustment
=
aFind
->
second
;
rMap
.
erase
(
aFind
);
return
sAdjustment
;
}
return
sAdjustment
;
}
}
bool
VclBuilder
::
extractModel
(
const
OString
&
id
,
stringmap
&
rMap
)
...
...
@@ -968,7 +992,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
}
else
if
(
name
==
"GtkSpinButton"
)
{
extractSpinAdjustment
(
id
,
rMap
);
OString
sAdjustment
=
extractAdjustment
(
rMap
);
OString
sPattern
=
extractCustomProperty
(
rMap
);
OString
sUnit
=
sPattern
;
...
...
@@ -981,23 +1005,34 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri
}
}
FieldUnit
eUnit
=
detectMetricUnit
(
sUnit
);
WinBits
nBits
=
WB_LEFT
|
WB_BORDER
|
WB_3DLOOK
;
if
(
!
id
.
endsWith
(
"-nospin"
))
nBits
|=
WB_SPIN
;
if
(
sPattern
.
isEmpty
())
{
connectNumericFormatterAdjustment
(
id
,
sAdjustment
);
SAL_INFO
(
"vcl.layout"
,
"making numeric field for "
<<
name
.
getStr
()
<<
" "
<<
sUnit
.
getStr
());
pWindow
=
new
NumericField
(
pParent
,
nBits
);
}
else
{
SAL_INFO
(
"vcl.layout"
,
"making metric field for "
<<
name
.
getStr
()
<<
" "
<<
sUnit
.
getStr
());
MetricField
*
pField
=
new
MetricField
(
pParent
,
nBits
);
pField
->
SetUnit
(
eUnit
);
pWindow
=
pField
;
if
(
sPattern
==
"hh:mm"
)
{
connectTimeFormatterAdjustment
(
id
,
sAdjustment
);
SAL_INFO
(
"vcl.layout"
,
"making time field for "
<<
name
.
getStr
()
<<
" "
<<
sUnit
.
getStr
());
TimeField
*
pField
=
new
TimeField
(
pParent
,
nBits
);
pWindow
=
pField
;
}
else
{
connectNumericFormatterAdjustment
(
id
,
sAdjustment
);
FieldUnit
eUnit
=
detectMetricUnit
(
sUnit
);
SAL_INFO
(
"vcl.layout"
,
"making metric field for "
<<
name
.
getStr
()
<<
" "
<<
sUnit
.
getStr
());
MetricField
*
pField
=
new
MetricField
(
pParent
,
nBits
);
pField
->
SetUnit
(
eUnit
);
pWindow
=
pField
;
}
}
}
else
if
(
name
==
"GtkLinkButton"
)
...
...
@@ -2467,7 +2502,7 @@ void VclBuilder::mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt1
rTarget
.
SelectEntryPos
(
nActiveId
);
}
void
VclBuilder
::
munge
Spin
Adjustment
(
NumericFormatter
&
rTarget
,
const
Adjustment
&
rAdjustment
)
void
VclBuilder
::
mungeAdjustment
(
NumericFormatter
&
rTarget
,
const
Adjustment
&
rAdjustment
)
{
int
nMul
=
rtl_math_pow10Exp
(
1
,
rTarget
.
GetDecimalDigits
());
...
...
@@ -2505,7 +2540,40 @@ void VclBuilder::mungeSpinAdjustment(NumericFormatter &rTarget, const Adjustment
}
}
void
VclBuilder
::
mungeScrollAdjustment
(
ScrollBar
&
rTarget
,
const
Adjustment
&
rAdjustment
)
//assume all in minutes for the moment
void
VclBuilder
::
mungeAdjustment
(
TimeField
&
rTarget
,
const
Adjustment
&
rAdjustment
)
{
for
(
stringmap
::
const_iterator
aI
=
rAdjustment
.
begin
(),
aEnd
=
rAdjustment
.
end
();
aI
!=
aEnd
;
++
aI
)
{
const
OString
&
rKey
=
aI
->
first
;
const
OString
&
rValue
=
aI
->
second
;
if
(
rKey
==
"upper"
)
{
Time
aUpper
(
0
,
rValue
.
toInt32
());
rTarget
.
SetMax
(
aUpper
);
rTarget
.
SetLast
(
aUpper
);
}
else
if
(
rKey
==
"lower"
)
{
Time
aLower
(
0
,
rValue
.
toInt32
());
rTarget
.
SetMin
(
aLower
);
rTarget
.
SetFirst
(
aLower
);
}
else
if
(
rKey
==
"value"
)
{
Time
aValue
(
0
,
rValue
.
toInt32
());
rTarget
.
SetTime
(
aValue
);
}
else
{
SAL_INFO
(
"vcl.layout"
,
"unhandled property :"
<<
rKey
.
getStr
());
}
}
}
void
VclBuilder
::
mungeAdjustment
(
ScrollBar
&
rTarget
,
const
Adjustment
&
rAdjustment
)
{
for
(
stringmap
::
const_iterator
aI
=
rAdjustment
.
begin
(),
aEnd
=
rAdjustment
.
end
();
aI
!=
aEnd
;
++
aI
)
{
...
...
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