sd/inc/pageformatpanel.hrc | 41 ++++++++++++++++++++++ sd/source/ui/sidebar/SlideBackground.cxx | 21 +++++++++++ sd/uiconfig/simpress/ui/sidebarslidebackground.ui | 9 ---- 3 files changed, 62 insertions(+), 9 deletions(-)
New commits: commit cc797cd31e99d47db5b2815a0a86c96204a65e62 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed Dec 5 18:54:22 2018 +0100 Commit: Xisco Faulí <xiscofa...@libreoffice.org> CommitDate: Thu Dec 6 13:19:42 2018 +0100 tdf#121926: Take metrics into account Similar to 6d9a2557a0f0366fff169f3c3581414b3cec80bd Change-Id: Ifecc3f86a3da8fdd4b0535cb67c6315e0d418f5a Reviewed-on: https://gerrit.libreoffice.org/64645 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Jenkins Reviewed-by: Xisco Faulí <xiscofa...@libreoffice.org> diff --git a/sd/inc/pageformatpanel.hrc b/sd/inc/pageformatpanel.hrc new file mode 100644 index 000000000000..23325e26ac2f --- /dev/null +++ b/sd/inc/pageformatpanel.hrc @@ -0,0 +1,41 @@ +/* -*- 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_SD_INC_PAGEFORMATPANEL_HRC +#define INCLUDED_SD_INC_PAGEFORMATPANEL_HRC + +#define NC_(Context, String) reinterpret_cast<char const *>(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"), +}; + +// 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"), +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index f3ba7365cbfe..e1958c1927ad 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -29,8 +29,11 @@ #include <drawdoc.hxx> #include <sdpage.hxx> #include <filedlg.hxx> +#include <sdmod.hxx> +#include <optsitem.hxx> #include "PageMarginUtils.hxx" #include <strings.hrc> +#include <pageformatpanel.hrc> #include "DocumentHelper.hxx" #include "MasterPagesSelector.hxx" #include <DrawViewShell.hxx> @@ -152,6 +155,24 @@ SlideBackground::SlideBackground( get(mpMasterLabel, "masterlabel"); get(mpMarginSelectBox, "marginLB"); + ::sd::DrawDocShell* pDocSh = dynamic_cast<::sd::DrawDocShell*>( SfxObjectShell::Current() ); + SdDrawDocument* pDoc = pDocSh ? pDocSh->GetDoc() : nullptr; + SdOptions* pOptions = SD_MOD()->GetSdOptions(pDoc->GetDocumentType()); + if (pOptions) + { + FieldUnit eMetric = static_cast<FieldUnit>(pOptions->GetMetric()); + if (IsInch(eMetric)) + { + for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_INCH); ++i) + mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_INCH[i])); + } + else + { + for (size_t i = 0; i < SAL_N_ELEMENTS(RID_PAGEFORMATPANEL_MARGINS_CM); ++i) + mpMarginSelectBox->InsertEntry(SdResId(RID_PAGEFORMATPANEL_MARGINS_CM[i])); + } + } + maCustomEntry = get<FixedText>("customlabel")->GetText(); addListener(); diff --git a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui index aa9183067e8d..256f06935ee4 100644 --- a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui +++ b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui @@ -244,15 +244,6 @@ <object class="GtkComboBoxText" id="marginLB"> <property name="visible">True</property> <property name="can_focus">False</property> - <items> - <item translatable="yes" context="sidebarslidebackground|marginLB">None</item> - <item translatable="yes" context="sidebarslidebackground|marginLB">Narrow</item> - <item translatable="yes" context="sidebarslidebackground|marginLB">Moderate</item> - <item translatable="yes" context="sidebarslidebackground|marginLB">Normal 0.75"</item> - <item translatable="yes" context="sidebarslidebackground|marginLB">Normal 1"</item> - <item translatable="yes" context="sidebarslidebackground|marginLB">Normal 1.25"</item> - <item translatable="yes" context="sidebarslidebackground|marginLB">Wide</item> - </items> </object> <packing> <property name="left_attach">1</property> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits