[Libreoffice-commits] core.git: 2 commits - editeng/inc editeng/source include/editeng include/svx svx/inc svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 10 19:36:31 UTC 2019
editeng/inc/strings.hrc | 45 +++++++++++++++++++
editeng/source/items/justifyitem.cxx | 79 +++--------------------------------
include/editeng/editrids.hrc | 19 --------
include/svx/rotmodit.hxx | 2
svx/inc/rotationstrings.hrc | 36 +++++++++++++++
svx/source/items/rotmodit.cxx | 13 ++++-
6 files changed, 103 insertions(+), 91 deletions(-)
New commits:
commit e1807c61f1abc6cab74d0fa8ccac7a8ef9114b88
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 10 12:48:42 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Dec 10 20:35:35 2019 +0100
Related: tdf#129300 rotation reference edge had no real description
Change-Id: I739c577d9a5f98969daa0c8fb3b7a63dea40743c
Reviewed-on: https://gerrit.libreoffice.org/84831
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svx/rotmodit.hxx b/include/svx/rotmodit.hxx
index c76b569a903f..013bf98d1240 100644
--- a/include/svx/rotmodit.hxx
+++ b/include/svx/rotmodit.hxx
@@ -51,6 +51,8 @@ public:
OUString& rText, const IntlWrapper& ) const override;
virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+private:
+ static OUString GetValueText(SvxRotateMode nVal);
};
diff --git a/svx/inc/rotationstrings.hrc b/svx/inc/rotationstrings.hrc
new file mode 100644
index 000000000000..dfc6c7aa7b44
--- /dev/null
+++ b/svx/inc/rotationstrings.hrc
@@ -0,0 +1,36 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SVX_INC_ROTATIONSTRINGS_HRC
+#define INCLUDED_SVX_INC_ROTATIONSTRINGS_HRC
+
+#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String)
+
+const char* RID_SVXITEMS_ROTATE_MODE[] =
+{
+ // enum SvxRotateMode ----------------------------------------------------
+ NC_("RID_SVXITEMS_ROTATE_MODE_STANDARD", "Rotation only within cell"),
+ NC_("RID_SVXITEMS_ROTATE_MODE_TOP", "From upper cell edge"),
+ NC_("RID_SVXITEMS_ROTATE_MODE_CENTER", "From vertical middle cell"),
+ NC_("RID_SVXITEMS_ROTATE_MODE_BOTTOM", "From lower cell edge"),
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/rotmodit.cxx b/svx/source/items/rotmodit.cxx
index 8b378cdf5cc9..3ec86cc1ab3d 100644
--- a/svx/source/items/rotmodit.cxx
+++ b/svx/source/items/rotmodit.cxx
@@ -31,7 +31,9 @@
#include <com/sun/star/table/CellOrientation.hpp>
#include <com/sun/star/table/CellAddress.hpp>
+#include <svx/dialmgr.hxx>
#include <svx/rotmodit.hxx>
+#include <rotationstrings.hrc>
using namespace ::com::sun::star;
@@ -56,6 +58,12 @@ SvxRotateModeItem::~SvxRotateModeItem()
{
}
+OUString SvxRotateModeItem::GetValueText(SvxRotateMode nVal)
+{
+ assert(nVal <= SVX_ROTATE_MODE_BOTTOM && "enum overflow!");
+ return SvxResId(RID_SVXITEMS_ROTATE_MODE[static_cast<size_t>(nVal)]);
+}
+
bool SvxRotateModeItem::GetPresentation(
SfxItemPresentation ePres,
MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
@@ -66,8 +74,9 @@ bool SvxRotateModeItem::GetPresentation(
switch ( ePres )
{
case SfxItemPresentation::Complete:
- rText += "...: ";
- [[fallthrough]]; // break; // FALL THROUGH!!!
+ rText += GetValueText(GetValue());
+ return true;
+ break;
case SfxItemPresentation::Nameless:
rText += OUString::number( GetValue() );
commit 837902468522531c8d0ad35612dce53d4facb668
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 10 11:52:18 2019 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Dec 10 20:35:11 2019 +0100
reorganize enum based translation
Change-Id: I5615b07d6c1280119f52622566a9c60c46cd5f7a
Reviewed-on: https://gerrit.libreoffice.org/84820
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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
diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc
index 0857da52adff..1abb476975e0 100644
--- a/include/editeng/editrids.hrc
+++ b/include/editeng/editrids.hrc
@@ -277,25 +277,6 @@
#define RID_SVXITEMS_CHARHIDDEN_FALSE NC_("RID_SVXITEMS_CHARHIDDEN_FALSE", "Not hidden")
#define RID_SVXITEMS_CHARHIDDEN_TRUE NC_("RID_SVXITEMS_CHARHIDDEN_TRUE", "Hidden")
-// enum SvxCellHorJustify ----------------------------------------------------
-#define RID_SVXITEMS_HORJUST_STANDARD NC_("RID_SVXITEMS_HORJUST_STANDARD", "Horizontal alignment default")
-#define RID_SVXITEMS_HORJUST_LEFT NC_("RID_SVXITEMS_HORJUST_LEFT", "Align left")
-#define RID_SVXITEMS_HORJUST_CENTER NC_("RID_SVXITEMS_HORJUST_CENTER", "Centered horizontally")
-#define RID_SVXITEMS_HORJUST_RIGHT NC_("RID_SVXITEMS_HORJUST_RIGHT", "Align right")
-#define RID_SVXITEMS_HORJUST_BLOCK NC_("RID_SVXITEMS_HORJUST_BLOCK", "Justify horizontally")
-#define RID_SVXITEMS_HORJUST_REPEAT NC_("RID_SVXITEMS_HORJUST_REPEAT", "Repeat alignment")
-
-// enum SvxCellVerJustify ----------------------------------------------------
-#define RID_SVXITEMS_VERJUST_STANDARD NC_("RID_SVXITEMS_VERJUST_STANDARD", "Vertical alignment default")
-#define RID_SVXITEMS_VERJUST_TOP NC_("RID_SVXITEMS_VERJUST_TOP", "Align to top")
-#define RID_SVXITEMS_VERJUST_CENTER NC_("RID_SVXITEMS_VERJUST_CENTER", "Centered vertically")
-#define RID_SVXITEMS_VERJUST_BOTTOM NC_("RID_SVXITEMS_VERJUST_BOTTOM", "Align to bottom")
-#define RID_SVXITEMS_VERJUST_BLOCK NC_("RID_SVXITEMS_HORJUST_BLOCK", "Justify vertically")
-
-// enum SvxCellJustifyMethod ----------------------------------------------------
-#define RID_SVXITEMS_JUSTMETHOD_AUTO NC_("RID_SVXITEMS_JUSTMETHOD_AUTO", "Automatic")
-#define RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE NC_("RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE", "Distributed")
-
#define RID_SVXSTR_PAPERBIN NC_("RID_SVXSTR_PAPERBIN", "Paper tray")
#define RID_SVXSTR_PAPERBIN_SETTINGS NC_("RID_SVXSTR_PAPERBIN_SETTINGS", "[From printer settings]")
More information about the Libreoffice-commits
mailing list