diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2018-12-05 18:54:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-12-09 22:16:31 +0100 |
commit | 0ec24d6f29c319462912bbf6a2eca361fab08637 (patch) | |
tree | c809a06954f1e104a8177279397e059da685873f /sd/source | |
parent | 79defcb4a9d559c16f59af561f7767f8fbfed98d (diff) |
tdf#121926: Take metrics into account
Similar to 6d9a2557a0f0366fff169f3c3581414b3cec80bd
Reviewed-on: https://gerrit.libreoffice.org/64645
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
(cherry picked from commit cc797cd31e99d47db5b2815a0a86c96204a65e62)
Change-Id: Ifecc3f86a3da8fdd4b0535cb67c6315e0d418f5a
Reviewed-on: https://gerrit.libreoffice.org/64705
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index f3ba7365cbfe..d1c7bdcdb8ef 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,27 @@ SlideBackground::SlideBackground( get(mpMasterLabel, "masterlabel"); get(mpMarginSelectBox, "marginLB"); + ::sd::DrawDocShell* pDocSh = dynamic_cast<::sd::DrawDocShell*>( SfxObjectShell::Current() ); + SdDrawDocument* pDoc = pDocSh ? pDocSh->GetDoc() : nullptr; + if (pDoc) + { + 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(); |