summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-12-10 11:52:18 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-12-10 20:35:11 +0100
commit837902468522531c8d0ad35612dce53d4facb668 (patch)
treeb911c89b8f65adddcce31c912f0c9cc3083e7181 /editeng
parentd7e9db93aec2d1c698e01893fbcaadd6d1207167 (diff)
reorganize enum based translation
Change-Id: I5615b07d6c1280119f52622566a9c60c46cd5f7a Reviewed-on: https://gerrit.libreoffice.org/84820 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/inc/strings.hrc45
-rw-r--r--editeng/source/items/justifyitem.cxx79
2 files changed, 54 insertions, 70 deletions
diff --git a/editeng/inc/strings.hrc b/editeng/inc/strings.hrc
new file mode 100644
index 000000000000..7982997116b8
--- /dev/null
+++ b/editeng/inc/strings.hrc
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_EDITENG_INC_UNITS_HRC
+#define INCLUDED_EDITENG_INC_UNITS_HRC
+
+#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String)
+
+const char* RID_SVXITEMS_HORJUST[] =
+{
+ // enum SvxCellHorJustify ----------------------------------------------------
+ NC_("RID_SVXITEMS_HORJUST_STANDARD", "Horizontal alignment default"),
+ NC_("RID_SVXITEMS_HORJUST_LEFT", "Align left"),
+ NC_("RID_SVXITEMS_HORJUST_CENTER", "Centered horizontally"),
+ NC_("RID_SVXITEMS_HORJUST_RIGHT", "Align right"),
+ NC_("RID_SVXITEMS_HORJUST_BLOCK", "Justify horizontally"),
+ NC_("RID_SVXITEMS_HORJUST_REPEAT", "Repeat alignment")
+};
+
+const char* RID_SVXITEMS_VERJUST[] =
+{
+ // enum SvxCellVerJustify ----------------------------------------------------
+ NC_("RID_SVXITEMS_VERJUST_STANDARD", "Vertical alignment default"),
+ NC_("RID_SVXITEMS_VERJUST_TOP", "Align to top"),
+ NC_("RID_SVXITEMS_VERJUST_CENTER", "Centered vertically"),
+ NC_("RID_SVXITEMS_VERJUST_BOTTOM", "Align to bottom"),
+ NC_("RID_SVXITEMS_HORJUST_BLOCK", "Justify vertically")
+};
+
+const char* RID_SVXITEMS_JUSTMETHOD[] =
+{
+ // enum SvxCellJustifyMethod ----------------------------------------------------
+ NC_("RID_SVXITEMS_JUSTMETHOD_AUTO", "Automatic"),
+ NC_("RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE", "Distributed")
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx
index 4c813a591aa7..9b2c2be3b947 100644
--- a/editeng/source/items/justifyitem.cxx
+++ b/editeng/source/items/justifyitem.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/table/CellVertJustify2.hpp>
#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <strings.hrc>
SfxPoolItem* SvxHorJustifyItem::CreateDefault() { return new SvxHorJustifyItem(SvxCellHorJustify::Standard, 0) ;}
SfxPoolItem* SvxVerJustifyItem::CreateDefault() { return new SvxVerJustifyItem(SvxCellVerJustify::Standard, 0) ;}
@@ -57,7 +58,7 @@ bool SvxHorJustifyItem::GetPresentation
MapUnit /*ePresUnit*/,
OUString& rText, const IntlWrapper&) const
{
- rText = GetValueText( GetValue() );
+ rText = GetValueText(GetValue());
return true;
}
@@ -158,37 +159,12 @@ bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
return true;
}
-
-OUString SvxHorJustifyItem::GetValueText( SvxCellHorJustify nVal )
+OUString SvxHorJustifyItem::GetValueText(SvxCellHorJustify nVal)
{
- DBG_ASSERT( nVal <= SvxCellHorJustify::Repeat, "enum overflow!" );
-
- OUString sRet;
- switch (nVal)
- {
- case SvxCellHorJustify::Standard:
- sRet = EditResId(RID_SVXITEMS_HORJUST_STANDARD);
- break;
- case SvxCellHorJustify::Left:
- sRet = EditResId(RID_SVXITEMS_HORJUST_LEFT);
- break;
- case SvxCellHorJustify::Center:
- sRet = EditResId(RID_SVXITEMS_HORJUST_CENTER);
- break;
- case SvxCellHorJustify::Right:
- sRet = EditResId(RID_SVXITEMS_HORJUST_RIGHT);
- break;
- case SvxCellHorJustify::Block:
- sRet = EditResId(RID_SVXITEMS_HORJUST_BLOCK);
- break;
- case SvxCellHorJustify::Repeat:
- sRet = EditResId(RID_SVXITEMS_HORJUST_REPEAT);
- break;
- }
- return sRet;
+ assert(nVal <= SvxCellHorJustify::Repeat && "enum overflow!");
+ return EditResId(RID_SVXITEMS_HORJUST[static_cast<size_t>(nVal)]);
}
-
SfxPoolItem* SvxHorJustifyItem::Clone( SfxItemPool* ) const
{
return new SvxHorJustifyItem( *this );
@@ -308,53 +284,28 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
return true;
}
-
OUString SvxVerJustifyItem::GetValueText( SvxCellVerJustify nVal )
{
- DBG_ASSERT( nVal <= SvxCellVerJustify::Bottom, "enum overflow!" );
-
- OUString sRet;
- switch (nVal)
- {
- case SvxCellVerJustify::Standard:
- sRet = EditResId(RID_SVXITEMS_VERJUST_STANDARD);
- break;
- case SvxCellVerJustify::Top:
- sRet = EditResId(RID_SVXITEMS_VERJUST_TOP);
- break;
- case SvxCellVerJustify::Center:
- sRet = EditResId(RID_SVXITEMS_VERJUST_CENTER);
- break;
- case SvxCellVerJustify::Bottom:
- sRet = EditResId(RID_SVXITEMS_VERJUST_BOTTOM);
- break;
- case SvxCellVerJustify::Block:
- sRet = EditResId(RID_SVXITEMS_VERJUST_BLOCK);
- break;
- }
- return sRet;
+ assert(nVal <= SvxCellVerJustify::Block && "enum overflow!");
+ return EditResId(RID_SVXITEMS_VERJUST[static_cast<size_t>(nVal)]);
}
-
SfxPoolItem* SvxVerJustifyItem::Clone( SfxItemPool* ) const
{
return new SvxVerJustifyItem( *this );
}
-
sal_uInt16 SvxVerJustifyItem::GetValueCount() const
{
return static_cast<sal_uInt16>(SvxCellVerJustify::Bottom) + 1; // Last Enum value + 1
}
-
SvxJustifyMethodItem::SvxJustifyMethodItem( const SvxCellJustifyMethod eJustify,
const sal_uInt16 nId ) :
SfxEnumItem( nId, eJustify )
{
}
-
bool SvxJustifyMethodItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -402,29 +353,17 @@ bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId
return true;
}
-
OUString SvxJustifyMethodItem::GetValueText( SvxCellJustifyMethod nVal )
{
- OUString sRet;
- switch (nVal)
- {
- case SvxCellJustifyMethod::Auto:
- sRet = EditResId(RID_SVXITEMS_JUSTMETHOD_AUTO);
- break;
- case SvxCellJustifyMethod::Distribute:
- sRet = EditResId(RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE);
- break;
- }
- return sRet;
+ assert(nVal <= SvxCellJustifyMethod::Distribute && "enum overflow!");
+ return EditResId(RID_SVXITEMS_JUSTMETHOD[static_cast<size_t>(nVal)]);
}
-
SfxPoolItem* SvxJustifyMethodItem::Clone( SfxItemPool* ) const
{
return new SvxJustifyMethodItem( *this );
}
-
sal_uInt16 SvxJustifyMethodItem::GetValueCount() const
{
return static_cast<sal_uInt16>(SvxCellJustifyMethod::Distribute) + 1; // Last Enum value + 1