[Libreoffice-commits] core.git: 2 commits - extensions/source include/vcl vcl/source
Noel Grandin
noelgrandin at gmail.com
Mon May 30 06:36:40 UTC 2016
extensions/source/bibliography/general.cxx | 2 +-
include/vcl/field.hxx | 13 +++++++------
include/vcl/vclenum.hxx | 10 +++++-----
vcl/source/control/field2.cxx | 16 ++++++++--------
vcl/source/window/layout.cxx | 20 ++++++++++----------
vcl/source/window/window.cxx | 4 ++--
vcl/source/window/window2.cxx | 10 +++++-----
7 files changed, 38 insertions(+), 37 deletions(-)
New commits:
commit 06cb2df4dba489d83c44babc2b36f91ec9fde5c9
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun May 29 12:52:29 2016 +0200
Convert VclAlign to scoped enum
Change-Id: I03718cc63ec5c1260ebd599bddb1a787ca8f5788
Reviewed-on: https://gerrit.libreoffice.org/25603
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 2e42225..14c256a 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -505,7 +505,7 @@ uno::Reference< awt::XControlModel > BibGeneralPage::AddXControl(
vcl::Window* pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
pWindow->set_grid_top_attach(rLabel.get_grid_top_attach());
pWindow->set_grid_left_attach(rLabel.get_grid_left_attach()+1);
- pWindow->set_valign(VCL_ALIGN_CENTER);
+ pWindow->set_valign(VclAlign::Center);
rLabel.set_mnemonic_widget(pWindow);
if (&rLabel == pTitleFT)
pWindow->set_grid_width(3);
diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx
index 8dcafe1..d6d9180 100644
--- a/include/vcl/vclenum.hxx
+++ b/include/vcl/vclenum.hxx
@@ -99,12 +99,12 @@ inline bool operator !=(const ItalicMatrix& a, const ItalicMatrix& b)
return a.xx != b.xx || a.xy != b.xy || a.yx != b.yx || a.yy != b.yy;
}
-enum VclAlign
+enum class VclAlign
{
- VCL_ALIGN_FILL,
- VCL_ALIGN_START,
- VCL_ALIGN_END,
- VCL_ALIGN_CENTER
+ Fill,
+ Start,
+ End,
+ Center
};
enum class VclPackType
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 5e82e4a..b099a96 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -56,7 +56,7 @@ void VclContainer::setLayoutAllocation(vcl::Window &rChild, const Point &rAllocP
VclAlign eValign = rChild.get_valign();
//typical case
- if (eHalign == VCL_ALIGN_FILL && eValign == VCL_ALIGN_FILL)
+ if (eHalign == VclAlign::Fill && eValign == VclAlign::Fill)
{
setLayoutPosSize(rChild, rAllocPos, rChildAlloc);
return;
@@ -68,19 +68,19 @@ void VclContainer::setLayoutAllocation(vcl::Window &rChild, const Point &rAllocP
switch (eHalign)
{
- case VCL_ALIGN_FILL:
+ case VclAlign::Fill:
break;
- case VCL_ALIGN_START:
+ case VclAlign::Start:
if (aChildPreferredSize.Width() < rChildAlloc.Width())
aChildSize.Width() = aChildPreferredSize.Width();
break;
- case VCL_ALIGN_END:
+ case VclAlign::End:
if (aChildPreferredSize.Width() < rChildAlloc.Width())
aChildSize.Width() = aChildPreferredSize.Width();
aChildPos.X() += rChildAlloc.Width();
aChildPos.X() -= aChildSize.Width();
break;
- case VCL_ALIGN_CENTER:
+ case VclAlign::Center:
if (aChildPreferredSize.Width() < aChildSize.Width())
aChildSize.Width() = aChildPreferredSize.Width();
aChildPos.X() += (rChildAlloc.Width() - aChildSize.Width()) / 2;
@@ -89,19 +89,19 @@ void VclContainer::setLayoutAllocation(vcl::Window &rChild, const Point &rAllocP
switch (eValign)
{
- case VCL_ALIGN_FILL:
+ case VclAlign::Fill:
break;
- case VCL_ALIGN_START:
+ case VclAlign::Start:
if (aChildPreferredSize.Height() < rChildAlloc.Height())
aChildSize.Height() = aChildPreferredSize.Height();
break;
- case VCL_ALIGN_END:
+ case VclAlign::End:
if (aChildPreferredSize.Height() < rChildAlloc.Height())
aChildSize.Height() = aChildPreferredSize.Height();
aChildPos.Y() += rChildAlloc.Height();
aChildPos.Y() -= aChildSize.Height();
break;
- case VCL_ALIGN_CENTER:
+ case VclAlign::Center:
if (aChildPreferredSize.Height() < aChildSize.Height())
aChildSize.Height() = aChildPreferredSize.Height();
aChildPos.Y() += (rChildAlloc.Height() - aChildSize.Height()) / 2;
@@ -2171,7 +2171,7 @@ short MessageDialog::Execute()
}
m_pImage->set_grid_left_attach(0);
m_pImage->set_grid_top_attach(0);
- m_pImage->set_valign(VCL_ALIGN_START);
+ m_pImage->set_valign(VclAlign::Start);
m_pImage->Show();
WinBits nWinStyle = WB_CLIPCHILDREN | WB_LEFT | WB_VCENTER | WB_NOLABEL | WB_NOTABSTOP;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 83ae01c..140ad60 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -638,8 +638,8 @@ WindowImpl::WindowImpl( WindowType nType )
mnDlgCtrlFlags = DialogControlFlags::NONE; // DialogControl-Flags
mnLockCount = 0; // LockCount
meAlwaysInputMode = AlwaysInputNone; // neither AlwaysEnableInput nor AlwaysDisableInput called
- meHalign = VCL_ALIGN_FILL;
- meValign = VCL_ALIGN_FILL;
+ meHalign = VclAlign::Fill;
+ meValign = VclAlign::Fill;
mePackType = VclPackType::Start;
mnPadding = 0;
mnGridHeight = 1;
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index cd67ca6..00475f1 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1420,16 +1420,16 @@ namespace
{
VclAlign toAlign(const OString &rValue)
{
- VclAlign eRet = VCL_ALIGN_FILL;
+ VclAlign eRet = VclAlign::Fill;
if (rValue == "fill")
- eRet = VCL_ALIGN_FILL;
+ eRet = VclAlign::Fill;
else if (rValue == "start")
- eRet = VCL_ALIGN_START;
+ eRet = VclAlign::Start;
else if (rValue == "end")
- eRet = VCL_ALIGN_END;
+ eRet = VclAlign::End;
else if (rValue == "center")
- eRet = VCL_ALIGN_CENTER;
+ eRet = VclAlign::Center;
return eRet;
}
}
commit a6dacbe1d7d17283c20c75d3c97f72a0f876a716
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Sun May 29 12:43:29 2016 +0200
Convert TimeFormat to scoped enum
Change-Id: Ia40c70493a61886c76e515c3b2953243025c2438
Reviewed-on: https://gerrit.libreoffice.org/25602
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/vcl/field.hxx b/include/vcl/field.hxx
index 75f8207..d97e40a 100644
--- a/include/vcl/field.hxx
+++ b/include/vcl/field.hxx
@@ -366,12 +366,18 @@ public:
class VCL_DLLPUBLIC TimeFormatter : public FormatterBase
{
+public:
+ enum class TimeFormat {
+ Hour12,
+ Hour24
+ };
+
private:
tools::Time maLastTime;
tools::Time maMin;
tools::Time maMax;
TimeFieldFormat meFormat;
- sal_uInt16 mnTimeFormat;
+ TimeFormat mnTimeFormat;
bool mbDuration;
bool mbEnforceValidValue;
@@ -389,11 +395,6 @@ protected:
public:
- enum TimeFormat {
- HOUR_12,
- HOUR_24
- };
-
virtual ~TimeFormatter();
virtual void Reformat() override;
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index b3e7c8fb..1f17e75 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -2199,7 +2199,7 @@ bool TimeFormatter::ImplTimeReformat( const OUString& rStr, OUString& rOutStr )
else
{
rOutStr = ImplGetLocaleDataWrapper().getTime( aTempTime, bSecond, b100Sec );
- if ( GetTimeFormat() == HOUR_12 )
+ if ( GetTimeFormat() == TimeFormat::Hour12 )
{
if ( aTempTime.GetHour() > 12 )
{
@@ -2299,7 +2299,7 @@ void TimeFormatter::ImplInit()
{
meFormat = TimeFieldFormat::F_NONE;
mbDuration = false;
- mnTimeFormat = HOUR_24; // Should become a ExtTimeFieldFormat in next implementation, merge with mbDuration and meFormat
+ mnTimeFormat = TimeFormat::Hour24; // Should become a ExtTimeFieldFormat in next implementation, merge with mbDuration and meFormat
}
TimeFormatter::TimeFormatter() :
@@ -2337,7 +2337,7 @@ void TimeFormatter::SetMax( const tools::Time& rNewMax )
void TimeFormatter::SetTimeFormat( TimeFormatter::TimeFormat eNewFormat )
{
- mnTimeFormat = sal::static_int_cast<sal_uInt16>(eNewFormat);
+ mnTimeFormat = eNewFormat;
}
@@ -2427,7 +2427,7 @@ void TimeFormatter::ImplSetUserTime( const tools::Time& rNewTime, Selection* pNe
else
{
aStr = ImplGetLocaleDataWrapper().getTime( aNewTime, bSec, b100Sec );
- if ( GetTimeFormat() == HOUR_12 )
+ if ( GetTimeFormat() == TimeFormat::Hour12 )
{
if ( aNewTime.GetHour() > 12 )
{
@@ -2599,28 +2599,28 @@ void TimeField::SetExtFormat( ExtTimeFieldFormat eFormat )
{
case EXTTIMEF_24H_SHORT:
{
- SetTimeFormat( HOUR_24 );
+ SetTimeFormat( TimeFormat::Hour24 );
SetDuration( false );
SetFormat( TimeFieldFormat::F_NONE );
}
break;
case EXTTIMEF_24H_LONG:
{
- SetTimeFormat( HOUR_24 );
+ SetTimeFormat( TimeFormat::Hour24 );
SetDuration( false );
SetFormat( TimeFieldFormat::F_SEC );
}
break;
case EXTTIMEF_12H_SHORT:
{
- SetTimeFormat( HOUR_12 );
+ SetTimeFormat( TimeFormat::Hour12 );
SetDuration( false );
SetFormat( TimeFieldFormat::F_NONE );
}
break;
case EXTTIMEF_12H_LONG:
{
- SetTimeFormat( HOUR_12 );
+ SetTimeFormat( TimeFormat::Hour12 );
SetDuration( false );
SetFormat( TimeFieldFormat::F_SEC );
}
More information about the Libreoffice-commits
mailing list