Kaydet (Commit) 0ec24d6f authored tarafından Xisco Fauli's avatar Xisco Fauli Kaydeden (comit) Caolán McNamara

tdf#121926: Take metrics into account

Similar to 6d9a2557

Reviewed-on: https://gerrit.libreoffice.org/64645Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: Jenkins
Reviewed-by: 's avatarXisco Faulí <xiscofauli@libreoffice.org>
(cherry picked from commit cc797cd3)

Change-Id: Ifecc3f86a3da8fdd4b0535cb67c6315e0d418f5a
Reviewed-on: https://gerrit.libreoffice.org/64705
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 79defcb4
/* -*- 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: */
...@@ -29,8 +29,11 @@ ...@@ -29,8 +29,11 @@
#include <drawdoc.hxx> #include <drawdoc.hxx>
#include <sdpage.hxx> #include <sdpage.hxx>
#include <filedlg.hxx> #include <filedlg.hxx>
#include <sdmod.hxx>
#include <optsitem.hxx>
#include "PageMarginUtils.hxx" #include "PageMarginUtils.hxx"
#include <strings.hrc> #include <strings.hrc>
#include <pageformatpanel.hrc>
#include "DocumentHelper.hxx" #include "DocumentHelper.hxx"
#include "MasterPagesSelector.hxx" #include "MasterPagesSelector.hxx"
#include <DrawViewShell.hxx> #include <DrawViewShell.hxx>
...@@ -152,6 +155,27 @@ SlideBackground::SlideBackground( ...@@ -152,6 +155,27 @@ SlideBackground::SlideBackground(
get(mpMasterLabel, "masterlabel"); get(mpMasterLabel, "masterlabel");
get(mpMarginSelectBox, "marginLB"); 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(); maCustomEntry = get<FixedText>("customlabel")->GetText();
addListener(); addListener();
......
...@@ -244,15 +244,6 @@ ...@@ -244,15 +244,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="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> </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