Kaydet (Commit) 6d9a2557 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#105081 and tdf#113420

separate translations for Spacing: vs Margins:
separate translations for Inch vs cm

Change-Id: I9a2d8fe3ad0edde5afefe00258f1309f898130e8
Reviewed-on: https://gerrit.libreoffice.org/62699
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst beaba5f1
...@@ -23,11 +23,14 @@ ...@@ -23,11 +23,14 @@
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
#include <vcl/lstbox.hxx> #include <vcl/lstbox.hxx>
enum class SpacingType { SPACING_INCH, MARGINS_INCH, SPACING_CM, MARGINS_CM };
/// Custom Widget ListBox to hold entries for Spacing & Margin settings of Header/Footer /// Custom Widget ListBox to hold entries for Spacing & Margin settings of Header/Footer
class SVX_DLLPUBLIC SpacingListBox : public ListBox class SVX_DLLPUBLIC SpacingListBox : public ListBox
{ {
public: public:
SpacingListBox( vcl::Window* pParent ); SpacingListBox( vcl::Window* pParent );
void Init(SpacingType eType);
Size GetOptimalSize() const override; Size GetOptimalSize() const override;
}; };
......
...@@ -13,16 +13,60 @@ ...@@ -13,16 +13,60 @@
#define NC_(Context, String) (Context "\004" u8##String) #define NC_(Context, String) (Context "\004" u8##String)
const std::pair<const char*, int> RID_SVXSTRARY_SPACING[] = // To translators: this is a listbox labelled by "Spacing:", inch units
const std::pair<const char*, int> RID_SVXSTRARY_SPACING_INCH[] =
{ {
{ NC_("RID_SVXSTRARY_SPACING", "None"), 0 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "None"), 0 },
{ NC_("RID_SVXSTRARY_SPACING", "Extra Small (1/16\")"), 91 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Extra Small (1/16\")"), 91 },
{ NC_("RID_SVXSTRARY_SPACING", "Small (1/8\")"), 181 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Small (1/8\")"), 181 },
{ NC_("RID_SVXSTRARY_SPACING", "Small Medium (1/4\")"), 363 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Small Medium (1/4\")"), 363 },
{ NC_("RID_SVXSTRARY_SPACING", "Medium (3/8\")"), 539 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Medium (3/8\")"), 539 },
{ NC_("RID_SVXSTRARY_SPACING", "Medium Large (1/2\")"), 720 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Medium Large (1/2\")"), 720 },
{ NC_("RID_SVXSTRARY_SPACING", "Large (3/4\")"), 1077 }, { NC_("RID_SVXSTRARY_SPACING_INCH", "Large (3/4\")"), 1077 },
{ NC_("RID_SVXSTRARY_SPACING", "Extra Large (1\")"), 1440 } { NC_("RID_SVXSTRARY_SPACING_INCH", "Extra Large (1\")"), 1440 },
{ nullptr, 0 }
};
// To translators: this is a listbox labelled by "Spacing:", cm units
const std::pair<const char*, int> RID_SVXSTRARY_SPACING_CM[] =
{
{ NC_("RID_SVXSTRARY_SPACING_CM", "None"), 0 },
{ NC_("RID_SVXSTRARY_SPACING_CM", "Extra Small (0.16cm)"), 91 },
{ NC_("RID_SVXSTRARY_SPACING_CM", "Small (0.32cm)"), 181 },
{ NC_("RID_SVXSTRARY_SPACING_CM", "Small Medium (0.64cm)"), 363 },
{ NC_("RID_SVXSTRARY_SPACING_CM", "Medium (0.95cm)"), 539 },
{ NC_("RID_SVXSTRARY_SPACING_CM", "Medium Large (1.27cm)"), 720 },
{ NC_("RID_SVXSTRARY_SPACING_CM", "Large (1.9cm)"), 1077 },
{ NC_("RID_SVXSTRARY_SPACING_CM", "Extra Large (2.54cm)"), 1440 },
{ nullptr, 0 }
};
// To translators: this is a listbox labelled by "Margins:", inch units
const std::pair<const char*, int> RID_SVXSTRARY_MARGINS_INCH[] =
{
{ NC_("RID_SVXSTRARY_MARGINS_INCH", "None"), 0 },
{ NC_("RID_SVXSTRARY_MARGINS_INCH", "Extra Small (1/16\")"), 91 },
{ NC_("RID_SVXSTRARY_MARGINS_INCH", "Small (1/8\")"), 181 },
{ NC_("RID_SVXSTRARY_MARGINS_INCH", "Small Medium (1/4\")"), 363 },
{ NC_("RID_SVXSTRARY_MARGINS_INCH", "Medium (3/8\")"), 539 },
{ NC_("RID_SVXSTRARY_MARGINS_INCH", "Medium Large (1/2\")"), 720 },
{ NC_("RID_SVXSTRARY_MARGINS_INCH", "Large (3/4\")"), 1077 },
{ NC_("RID_SVXSTRARY_MARGINS_INCH", "Extra Large (1\")"), 1440 },
{ nullptr, 0 }
};
// To translators: this is a listbox labelled by "Margins:", cm units
const std::pair<const char*, int> RID_SVXSTRARY_MARGINS_CM[] =
{
{ NC_("RID_SVXSTRARY_MARGINS_CM", "None"), 0 },
{ NC_("RID_SVXSTRARY_MARGINS_CM", "Extra Small (0.16cm)"), 91 },
{ NC_("RID_SVXSTRARY_MARGINS_CM", "Small (0.32cm)"), 181 },
{ NC_("RID_SVXSTRARY_MARGINS_CM", "Small Medium (0.64cm)"), 363 },
{ NC_("RID_SVXSTRARY_MARGINS_CM", "Medium (0.95cm)"), 539 },
{ NC_("RID_SVXSTRARY_MARGINS_CM", "Medium Large (1.27cm)"), 720 },
{ NC_("RID_SVXSTRARY_MARGINS_CM", "Large (1.9cm)"), 1077 },
{ NC_("RID_SVXSTRARY_MARGINS_CM", "Extra Large (2.54cm)"), 1440 },
{ nullptr, 0 }
}; };
#endif #endif
......
...@@ -25,13 +25,37 @@ ...@@ -25,13 +25,37 @@
SpacingListBox::SpacingListBox(vcl::Window* pParent) SpacingListBox::SpacingListBox(vcl::Window* pParent)
: ListBox( pParent, WB_BORDER | WB_DROPDOWN) : ListBox( pParent, WB_BORDER | WB_DROPDOWN)
{ {
for (size_t i = 0; i < SAL_N_ELEMENTS(RID_SVXSTRARY_SPACING); ++i) }
void SpacingListBox::Init(SpacingType eType)
{
const std::pair<const char*, int>* pResources;
switch (eType)
{ {
OUString aStr = SvxResId(RID_SVXSTRARY_SPACING[i].first); case SpacingType::SPACING_INCH:
sal_uInt16 nData = RID_SVXSTRARY_SPACING[i].second; pResources = RID_SVXSTRARY_SPACING_INCH;
break;
case SpacingType::MARGINS_INCH:
pResources = RID_SVXSTRARY_MARGINS_INCH;
break;
case SpacingType::SPACING_CM:
pResources = RID_SVXSTRARY_SPACING_CM;
break;
default:
case SpacingType::MARGINS_CM:
pResources = RID_SVXSTRARY_MARGINS_CM;
break;
}
while (pResources->first)
{
OUString aStr = SvxResId(pResources->first);
sal_uInt16 nData = pResources->second;
sal_Int32 nPos = InsertEntry( aStr ); sal_Int32 nPos = InsertEntry( aStr );
SetEntryData( nPos, reinterpret_cast<void*>(static_cast<sal_uLong>(nData)) ); SetEntryData( nPos, reinterpret_cast<void*>(static_cast<sal_uLong>(nData)) );
++pResources;
} }
SetDropDownLineCount(8); SetDropDownLineCount(8);
SelectEntryPos(0); SelectEntryPos(0);
} }
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* 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_SW_INC_PAGEFORMATPANEL_HRC
#define INCLUDED_SW_INC_PAGEFORMATPANEL_HRC
#define NC_(Context, String) (Context "\004" u8##String)
// To translators: this is a listbox labelled by "Margins:", inch units
const char* RID_PAGEFORMATPANEL_MARGINS_INCH[] =
{
NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "None"),
NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Narrow"),
NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Moderate"),
NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (0.75\")"),
NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (1\")"),
NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Normal (1.25\")"),
NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Wide"),
NC_("RID_PAGEFORMATPANEL_MARGINS_INCH", "Mirrored")
};
// To translators: this is a listbox labelled by "Margins:", cm units
const char* RID_PAGEFORMATPANEL_MARGINS_CM[] =
{
NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "None"),
NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Narrow"),
NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Moderate"),
NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (1.9cm)"),
NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (2.54cm)"),
NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Normal (3.18cm)"),
NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Wide"),
NC_("RID_PAGEFORMATPANEL_MARGINS_CM", "Mirrored")
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
...@@ -25,12 +25,14 @@ ...@@ -25,12 +25,14 @@
#include <svx/svxids.hrc> #include <svx/svxids.hrc>
#include <svx/dlgutil.hxx> #include <svx/dlgutil.hxx>
#include <svx/rulritem.hxx> #include <svx/rulritem.hxx>
#include <svx/svdtrans.hxx>
#include "PageFooterPanel.hxx" #include "PageFooterPanel.hxx"
#include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/ControlFactory.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx> #include <sfx2/bindings.hxx>
#include <sfx2/viewsh.hxx> #include <sfx2/viewsh.hxx>
#include <sfx2/objsh.hxx> #include <sfx2/objsh.hxx>
#include <uitool.hxx>
#include <cmdid.h> #include <cmdid.h>
namespace sw { namespace sidebar{ namespace sw { namespace sidebar{
...@@ -66,8 +68,11 @@ PageFooterPanel::PageFooterPanel( ...@@ -66,8 +68,11 @@ PageFooterPanel::PageFooterPanel(
{ {
get(mpFooterToggle, "footertoggle"); get(mpFooterToggle, "footertoggle");
get(mpFooterSpacingLB, "spacingpreset"); get(mpFooterSpacingLB, "spacingpreset");
FieldUnit eMetric = ::GetDfltMetric(false);
mpFooterSpacingLB->Init(IsInch(eMetric) ? SpacingType::SPACING_INCH : SpacingType::SPACING_CM);
get(mpFooterLayoutLB, "samecontentLB"); get(mpFooterLayoutLB, "samecontentLB");
get(mpFooterMarginPresetLB, "footermarginpreset"); get(mpFooterMarginPresetLB, "footermarginpreset");
mpFooterMarginPresetLB->Init(IsInch(GetModuleFieldUnit()) ? SpacingType::MARGINS_INCH : SpacingType::MARGINS_CM);
get(mpCustomEntry, "customlabel"); get(mpCustomEntry, "customlabel");
Initialize(); Initialize();
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <svx/svxids.hrc> #include <svx/svxids.hrc>
#include <svx/dlgutil.hxx> #include <svx/dlgutil.hxx>
#include <svx/rulritem.hxx> #include <svx/rulritem.hxx>
#include <svx/svdtrans.hxx>
#include "PageFormatPanel.hxx" #include "PageFormatPanel.hxx"
#include "PageMarginUtils.hxx" #include "PageMarginUtils.hxx"
#include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/ControlFactory.hxx>
...@@ -32,7 +33,9 @@ ...@@ -32,7 +33,9 @@
#include <sfx2/bindings.hxx> #include <sfx2/bindings.hxx>
#include <sfx2/viewsh.hxx> #include <sfx2/viewsh.hxx>
#include <sfx2/objsh.hxx> #include <sfx2/objsh.hxx>
#include <pageformatpanel.hrc>
#include <cmdid.h> #include <cmdid.h>
#include <uitool.hxx>
#include <svtools/unitconv.hxx> #include <svtools/unitconv.hxx>
#include <svtools/optionsdrawinglayer.hxx> #include <svtools/optionsdrawinglayer.hxx>
...@@ -75,6 +78,17 @@ PageFormatPanel::PageFormatPanel( ...@@ -75,6 +78,17 @@ PageFormatPanel::PageFormatPanel(
get(mpPaperHeight, "paperheight"); get(mpPaperHeight, "paperheight");
get(mpPaperOrientation, "paperorientation"); get(mpPaperOrientation, "paperorientation");
get(mpMarginSelectBox, "marginLB"); get(mpMarginSelectBox, "marginLB");
FieldUnit eMetric = ::GetDfltMetric(false);
if (IsInch(eMetric))
{
for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_INCH); ++i)
mpMarginSelectBox->InsertEntry(SwResId(RID_PAGEFORMATPANEL_MARGINS_INCH[i]));
}
else
{
for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_CM); ++i)
mpMarginSelectBox->InsertEntry(SwResId(RID_PAGEFORMATPANEL_MARGINS_CM[i]));
}
get(mpCustomEntry, "customlabel"); get(mpCustomEntry, "customlabel");
Initialize(); Initialize();
} }
......
...@@ -25,12 +25,14 @@ ...@@ -25,12 +25,14 @@
#include <svx/svxids.hrc> #include <svx/svxids.hrc>
#include <svx/dlgutil.hxx> #include <svx/dlgutil.hxx>
#include <svx/rulritem.hxx> #include <svx/rulritem.hxx>
#include <svx/svdtrans.hxx>
#include "PageHeaderPanel.hxx" #include "PageHeaderPanel.hxx"
#include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/ControlFactory.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx> #include <sfx2/bindings.hxx>
#include <sfx2/viewsh.hxx> #include <sfx2/viewsh.hxx>
#include <sfx2/objsh.hxx> #include <sfx2/objsh.hxx>
#include <uitool.hxx>
#include <cmdid.h> #include <cmdid.h>
namespace sw { namespace sidebar{ namespace sw { namespace sidebar{
...@@ -69,8 +71,11 @@ PageHeaderPanel::PageHeaderPanel( ...@@ -69,8 +71,11 @@ PageHeaderPanel::PageHeaderPanel(
{ {
get(mpHeaderToggle, "headertoggle"); get(mpHeaderToggle, "headertoggle");
get(mpHeaderSpacingLB, "spacingpreset"); get(mpHeaderSpacingLB, "spacingpreset");
FieldUnit eMetric = ::GetDfltMetric(false);
mpHeaderSpacingLB->Init(IsInch(eMetric) ? SpacingType::SPACING_INCH : SpacingType::SPACING_CM);
get(mpHeaderLayoutLB, "samecontentLB"); get(mpHeaderLayoutLB, "samecontentLB");
get(mpHeaderMarginPresetLB, "headermarginpreset"); get(mpHeaderMarginPresetLB, "headermarginpreset");
mpHeaderMarginPresetLB->Init(IsInch(eMetric) ? SpacingType::MARGINS_INCH : SpacingType::MARGINS_CM);
get(mpCustomEntry, "customlabel"); get(mpCustomEntry, "customlabel");
Initialize(); Initialize();
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <cmdid.h> #include <cmdid.h>
#include <swtypes.hxx> #include <swtypes.hxx>
#include <svx/svxids.hrc> #include <svx/svxids.hrc>
#include <svx/svdtrans.hxx>
#include <sfx2/bindings.hxx> #include <sfx2/bindings.hxx>
#include <sfx2/dispatch.hxx> #include <sfx2/dispatch.hxx>
#include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/ControlFactory.hxx>
...@@ -33,6 +34,7 @@ ...@@ -33,6 +34,7 @@
#include <editeng/lrspitem.hxx> #include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx> #include <editeng/ulspitem.hxx>
#include <hintids.hxx> #include <hintids.hxx>
#include <uitool.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp>
const char UNO_WRAPOFF[] = ".uno:WrapOff"; const char UNO_WRAPOFF[] = ".uno:WrapOff";
...@@ -96,6 +98,8 @@ WrapPropertyPanel::WrapPropertyPanel( ...@@ -96,6 +98,8 @@ WrapPropertyPanel::WrapPropertyPanel(
get(mpEnableContour, "enablecontour"); get(mpEnableContour, "enablecontour");
get(mpEditContour, "editcontour"); get(mpEditContour, "editcontour");
get(mpSpacingLB, "spacingLB"); get(mpSpacingLB, "spacingLB");
FieldUnit eMetric = ::GetDfltMetric(false);
mpSpacingLB->Init(IsInch(eMetric) ? SpacingType::SPACING_INCH : SpacingType::SPACING_CM);
get(mpCustomEntry, "customlabel"); get(mpCustomEntry, "customlabel");
Initialize(); Initialize();
......
...@@ -139,16 +139,6 @@ ...@@ -139,16 +139,6 @@
<object class="GtkComboBoxText" id="marginLB"> <object class="GtkComboBoxText" id="marginLB">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<items>
<item translatable="yes" context="pageformatpanel|marginLB">None</item>
<item translatable="yes" context="pageformatpanel|marginLB">Narrow</item>
<item translatable="yes" context="pageformatpanel|marginLB">Moderate</item>
<item translatable="yes" context="pageformatpanel|marginLB">Normal 0.75"</item>
<item translatable="yes" context="pageformatpanel|marginLB">Normal 1"</item>
<item translatable="yes" context="pageformatpanel|marginLB">Normal 1.25"</item>
<item translatable="yes" context="pageformatpanel|marginLB">Wide</item>
<item translatable="yes" context="pageformatpanel|marginLB">Mirrored</item>
</items>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment