[Libreoffice-commits] core.git: sd/source sd/uiconfig
pv2k
vidhey96 at gmail.com
Sat Sep 30 06:32:44 UTC 2017
sd/source/ui/sidebar/PageMarginUtils.hxx | 158 ++++++++++++++++++
sd/source/ui/sidebar/SlideBackground.cxx | 188 ++++++++++++----------
sd/source/ui/sidebar/SlideBackground.hxx | 15 -
sd/uiconfig/simpress/ui/sidebarslidebackground.ui | 107 ++----------
4 files changed, 299 insertions(+), 169 deletions(-)
New commits:
commit d5a64f114c101339ed479ea926653c703951fae5
Author: pv2k <vidhey96 at gmail.com>
Date: Thu Aug 31 01:59:05 2017 +0530
tdf#109100 margin spinboxes in draw's sidebar changed to listbox
Change-Id: Ia59f0fb64f10beab70f449d01b8a25113bea475d
Reviewed-on: https://gerrit.libreoffice.org/41741
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/sd/source/ui/sidebar/PageMarginUtils.hxx b/sd/source/ui/sidebar/PageMarginUtils.hxx
new file mode 100644
index 000000000000..7061a11f9a6a
--- /dev/null
+++ b/sd/source/ui/sidebar/PageMarginUtils.hxx
@@ -0,0 +1,158 @@
+/* -*- 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 .
+ */
+#include <cmath>
+#define SDPAGE_NO_MARGIN 0
+#define SDPAGE_NARROW_VALUE 635
+#define SDPAGE_MODERATE_LR 955
+#define SDPAGE_NORMAL_VALUE 1000
+#define SDPAGE_WIDE_VALUE1 1270
+#define SDPAGE_WIDE_VALUE2 2540
+#define SDPAGE_WIDE_VALUE3 1590
+#define SDPAGE_UNIT_THRESHOLD 5
+
+namespace sd { namespace sidebar{
+
+bool IsNone( const long nPageLeftMargin, const long nPageRightMargin,
+ const long nPageTopMargin, const long nPageBottomMargin )
+{
+ return( std::abs(nPageLeftMargin - SDPAGE_NO_MARGIN) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageRightMargin - SDPAGE_NO_MARGIN ) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageTopMargin - SDPAGE_NO_MARGIN) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageBottomMargin - SDPAGE_NO_MARGIN) <= SDPAGE_UNIT_THRESHOLD );
+}
+
+void SetNone( long& nPageLeftMargin, long& nPageRightMargin,
+ long& nPageTopMargin, long& nPageBottomMargin )
+{
+ nPageLeftMargin = SDPAGE_NO_MARGIN;
+ nPageRightMargin = SDPAGE_NO_MARGIN;
+ nPageTopMargin = SDPAGE_NO_MARGIN;
+ nPageBottomMargin = SDPAGE_NO_MARGIN;
+}
+
+bool IsNarrow( const long nPageLeftMargin, const long nPageRightMargin,
+ const long nPageTopMargin, const long nPageBottomMargin )
+{
+ return( std::abs(nPageLeftMargin - SDPAGE_NARROW_VALUE) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageRightMargin - SDPAGE_NARROW_VALUE) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageTopMargin - SDPAGE_NARROW_VALUE) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageBottomMargin - SDPAGE_NARROW_VALUE) <= SDPAGE_UNIT_THRESHOLD );
+}
+
+void SetNarrow( long& nPageLeftMargin, long& nPageRightMargin,
+ long& nPageTopMargin, long& nPageBottomMargin )
+{
+ nPageLeftMargin = SDPAGE_NARROW_VALUE;
+ nPageRightMargin = SDPAGE_NARROW_VALUE;
+ nPageTopMargin = SDPAGE_NARROW_VALUE;
+ nPageBottomMargin = SDPAGE_NARROW_VALUE;
+}
+
+bool IsModerate( const long nPageLeftMargin, const long nPageRightMargin,
+ const long nPageTopMargin, const long nPageBottomMargin )
+{
+ return( std::abs(nPageLeftMargin - SDPAGE_MODERATE_LR) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageRightMargin - SDPAGE_MODERATE_LR) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageTopMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageBottomMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD );
+}
+
+void SetModerate( long& nPageLeftMargin, long& nPageRightMargin,
+ long& nPageTopMargin, long& nPageBottomMargin )
+{
+ nPageLeftMargin = SDPAGE_MODERATE_LR;
+ nPageRightMargin = SDPAGE_MODERATE_LR;
+ nPageTopMargin = SDPAGE_WIDE_VALUE1;
+ nPageBottomMargin = SDPAGE_WIDE_VALUE1;
+}
+
+bool IsNormal075( const long nPageLeftMargin, const long nPageRightMargin,
+ const long nPageTopMargin, const long nPageBottomMargin )
+{
+ return( std::abs(nPageLeftMargin - SDPAGE_NORMAL_VALUE) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageRightMargin - SDPAGE_NORMAL_VALUE) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageTopMargin - SDPAGE_NORMAL_VALUE) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageBottomMargin - SDPAGE_NORMAL_VALUE) <= SDPAGE_UNIT_THRESHOLD );
+}
+
+void SetNormal075( long& nPageLeftMargin, long& nPageRightMargin,
+ long& nPageTopMargin, long& nPageBottomMargin )
+{
+ nPageLeftMargin = SDPAGE_NORMAL_VALUE;
+ nPageRightMargin = SDPAGE_NORMAL_VALUE;
+ nPageTopMargin = SDPAGE_NORMAL_VALUE;
+ nPageBottomMargin = SDPAGE_NORMAL_VALUE;
+}
+
+bool IsNormal100( const long nPageLeftMargin, const long nPageRightMargin,
+ const long nPageTopMargin, const long nPageBottomMargin )
+{
+ return( std::abs(nPageLeftMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageRightMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageTopMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageBottomMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD );
+}
+
+void SetNormal100( long& nPageLeftMargin, long& nPageRightMargin,
+ long& nPageTopMargin, long& nPageBottomMargin )
+{
+ nPageLeftMargin = SDPAGE_WIDE_VALUE1;
+ nPageRightMargin = SDPAGE_WIDE_VALUE1;
+ nPageTopMargin = SDPAGE_WIDE_VALUE1;
+ nPageBottomMargin = SDPAGE_WIDE_VALUE1;
+}
+
+bool IsNormal125( const long nPageLeftMargin, const long nPageRightMargin,
+ const long nPageTopMargin, const long nPageBottomMargin )
+{
+ return( std::abs(nPageLeftMargin - SDPAGE_WIDE_VALUE3) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageRightMargin - SDPAGE_WIDE_VALUE3) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageTopMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageBottomMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD );
+}
+
+void SetNormal125( long& nPageLeftMargin, long& nPageRightMargin,
+ long& nPageTopMargin, long& nPageBottomMargin )
+{
+ nPageLeftMargin = SDPAGE_WIDE_VALUE3;
+ nPageRightMargin = SDPAGE_WIDE_VALUE3;
+ nPageTopMargin = SDPAGE_WIDE_VALUE1;
+ nPageBottomMargin = SDPAGE_WIDE_VALUE1;
+}
+
+bool IsWide( const long nPageLeftMargin, const long nPageRightMargin,
+ const long nPageTopMargin, const long nPageBottomMargin )
+{
+ return( std::abs(nPageLeftMargin - SDPAGE_WIDE_VALUE2) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageRightMargin - SDPAGE_WIDE_VALUE2) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageTopMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD &&
+ std::abs(nPageBottomMargin - SDPAGE_WIDE_VALUE1) <= SDPAGE_UNIT_THRESHOLD );
+}
+
+void SetWide( long& nPageLeftMargin, long& nPageRightMargin,
+ long& nPageTopMargin, long& nPageBottomMargin )
+{
+ nPageLeftMargin = SDPAGE_WIDE_VALUE2;
+ nPageRightMargin = SDPAGE_WIDE_VALUE2;
+ nPageTopMargin = SDPAGE_WIDE_VALUE1;
+ nPageBottomMargin = SDPAGE_WIDE_VALUE1;
+}
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index 82e0fc8e7bb6..08e7cab09e6d 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -28,6 +28,7 @@
#include "SlideSorterViewShell.hxx"
#include "drawdoc.hxx"
#include "filedlg.hxx"
+#include "PageMarginUtils.hxx"
#include "strings.hrc"
#include "DocumentHelper.hxx"
#include "MasterPagesSelector.hxx"
@@ -141,11 +142,14 @@ SlideBackground::SlideBackground(
maImpressMasterContext(vcl::EnumContext::Application::Impress, vcl::EnumContext::Context::MasterPage),
maImpressHandoutContext(vcl::EnumContext::Application::Impress, vcl::EnumContext::Context::HandoutPage),
mbTitle(false),
+ mpPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) ),
+ mpPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) ),
meFieldUnit(lcl_GetFieldUnit()),
m_nPageLeftMargin(0),
m_nPageRightMargin(0),
m_nPageTopMargin(0),
m_nPageBottomMargin(0),
+ maCustomEntry(),
mpBindings(pBindings)
{
get(mpPaperSizeBox,"paperformat");
@@ -165,10 +169,9 @@ SlideBackground::SlideBackground(
get(mpCloseMaster, "closemasterslide");
get(mpEditMaster, "masterslidebutton");
get(mpMasterLabel, "masterlabel");
- get(m_pLeftMarginEdit, "left");
- get(m_pRightMarginEdit, "right");
- get(m_pTopMarginEdit, "top");
- get(m_pBottomMarginEdit, "bottom");
+ get(mpMarginSelectBox, "marginLB");
+
+ maCustomEntry = get<FixedText>("customlabel")->GetText();
SfxViewFrame* pCurrent = SfxViewFrame::Current();
if (pCurrent)
@@ -181,10 +184,6 @@ SlideBackground::SlideBackground(
m_aPageSize = pSize->GetSize();
}
}
- SetFieldUnit( *m_pTopMarginEdit, meFieldUnit );
- SetFieldUnit( *m_pBottomMarginEdit, meFieldUnit );
- SetFieldUnit( *m_pLeftMarginEdit, meFieldUnit );
- SetFieldUnit( *m_pRightMarginEdit, meFieldUnit );
addListener();
Initialize();
}
@@ -238,12 +237,10 @@ void SlideBackground::Initialize()
mpDspMasterObjects->SetClickHdl(LINK(this,SlideBackground, DspObjects));
//margins
- m_pLeftMarginEdit->SetModifyHdl(LINK(this, SlideBackground, ModifyLRMarginHdl));
- m_pRightMarginEdit->SetModifyHdl(LINK(this, SlideBackground, ModifyLRMarginHdl));
- m_pTopMarginEdit->SetModifyHdl(LINK(this, SlideBackground, ModifyULMarginHdl));
- m_pBottomMarginEdit->SetModifyHdl(LINK(this, SlideBackground, ModifyULMarginHdl));
+ mpMarginSelectBox->SetSelectHdl(LINK(this, SlideBackground,ModifyMarginHdl));
Update();
+ UpdateMarginBox();
}
void SlideBackground::HandleContextChange(
@@ -370,6 +367,56 @@ void SlideBackground::Update()
}
}
+void SlideBackground::UpdateMarginBox()
+{
+ m_nPageLeftMargin = mpPageLRMarginItem->GetLeft();
+ m_nPageRightMargin = mpPageLRMarginItem->GetRight();
+ m_nPageTopMargin = mpPageULMarginItem->GetUpper();
+ m_nPageBottomMargin = mpPageULMarginItem->GetLower();
+
+ if( IsNone(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin) )
+ {
+ mpMarginSelectBox->SelectEntryPos(0);
+ mpMarginSelectBox->RemoveEntry(maCustomEntry);
+ }
+ else if( IsNarrow(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin) )
+ {
+ mpMarginSelectBox->SelectEntryPos(1);
+ mpMarginSelectBox->RemoveEntry(maCustomEntry);
+ }
+ else if( IsModerate(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin) )
+ {
+ mpMarginSelectBox->SelectEntryPos(2);
+ mpMarginSelectBox->RemoveEntry(maCustomEntry);
+ }
+ else if( IsNormal075(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin) )
+ {
+ mpMarginSelectBox->SelectEntryPos(3);
+ mpMarginSelectBox->RemoveEntry(maCustomEntry);
+ }
+ else if( IsNormal100(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin) )
+ {
+ mpMarginSelectBox->SelectEntryPos(4);
+ mpMarginSelectBox->RemoveEntry(maCustomEntry);
+ }
+ else if( IsNormal125(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin) )
+ {
+ mpMarginSelectBox->SelectEntryPos(5);
+ mpMarginSelectBox->RemoveEntry(maCustomEntry);
+ }
+ else if( IsWide(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin) )
+ {
+ mpMarginSelectBox->SelectEntryPos(6);
+ mpMarginSelectBox->RemoveEntry(maCustomEntry);
+ }
+ else
+ {
+ if(mpMarginSelectBox->GetEntryPos(maCustomEntry) == LISTBOX_ENTRY_NOTFOUND)
+ mpMarginSelectBox->InsertEntry(maCustomEntry);
+ mpMarginSelectBox->SelectEntry(maCustomEntry);
+ }
+}
+
void SlideBackground::SetPanelTitle( const OUString& rTitle )
{
Reference<frame::XController2> xController( mxFrame->getController(), uno::UNO_QUERY);
@@ -546,15 +593,13 @@ void SlideBackground::dispose()
mpFillStyle.clear();
mpFillLB.clear();
mpInsertImage.clear();
+ mpMarginSelectBox.disposeAndClear();
mpDspMasterBackground.clear();
mpDspMasterObjects.clear();
mpMasterLabel.clear();
mpEditMaster.clear();
mpCloseMaster.clear();
- m_pLeftMarginEdit.clear();
- m_pRightMarginEdit.clear();
- m_pTopMarginEdit.clear();
- m_pBottomMarginEdit.clear();
+
m_pContainer.clear();
maPaperSizeController.dispose();
@@ -576,9 +621,25 @@ void SlideBackground::dispose()
mpColorItem.reset();
mpHatchItem.reset();
mpBitmapItem.reset();
+ mpPageLRMarginItem.reset();
+ mpPageULMarginItem.reset();
PanelLayout::dispose();
}
+void SlideBackground::ExecuteMarginLRChange(const long mnPageLeftMargin, const long mnPageRightMargin)
+{
+ mpPageLRMarginItem->SetLeft(mnPageLeftMargin);
+ mpPageLRMarginItem->SetRight(mnPageRightMargin);
+ GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE, SfxCallMode::RECORD, { mpPageLRMarginItem.get() } );
+}
+
+void SlideBackground::ExecuteMarginULChange(const long mnPageTopMargin, const long mnPageBottomMargin)
+{
+ mpPageULMarginItem->SetUpper(mnPageTopMargin);
+ mpPageULMarginItem->SetLower(mnPageBottomMargin);
+ GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_ULSPACE, SfxCallMode::RECORD, { mpPageULMarginItem.get() } );
+}
+
Color SlideBackground::GetColorSetOrDefault()
{
// Tango Sky Blue 1, to be consistent w/ area fill panel (b/c COL_AUTO for slides is transparent)
@@ -789,12 +850,8 @@ void SlideBackground::NotifyItemUpdate(
pLRItem = dynamic_cast<const SvxLongLRSpaceItem*>(pState);
if (pLRItem)
{
- m_nPageLeftMargin = pLRItem->GetLeft();
- m_nPageRightMargin = pLRItem->GetRight();
- SetFieldUnit(*m_pLeftMarginEdit, meFieldUnit, true);
- SetMetricValue(*m_pLeftMarginEdit.get(), m_nPageLeftMargin, meUnit);
- SetFieldUnit(*m_pRightMarginEdit, meFieldUnit, true);
- SetMetricValue(*m_pRightMarginEdit.get(), m_nPageRightMargin, meUnit);
+ mpPageLRMarginItem.reset( static_cast<SvxLongLRSpaceItem*>(pState->Clone()) );
+ UpdateMarginBox();
}
}
break;
@@ -806,12 +863,8 @@ void SlideBackground::NotifyItemUpdate(
pULItem = dynamic_cast<const SvxLongULSpaceItem*>(pState);
if (pULItem)
{
- m_nPageTopMargin = pULItem->GetUpper();
- m_nPageBottomMargin = pULItem->GetLower();
- SetFieldUnit(*m_pTopMarginEdit, meFieldUnit, true);
- SetMetricValue(*m_pTopMarginEdit.get(), m_nPageTopMargin, meUnit);
- SetFieldUnit(*m_pBottomMarginEdit, meFieldUnit, true);
- SetMetricValue(*m_pBottomMarginEdit.get(), m_nPageBottomMargin, meUnit);
+ mpPageULMarginItem.reset( static_cast<SvxLongULSpaceItem*>(pState->Clone()) );
+ UpdateMarginBox();
}
}
break;
@@ -848,33 +901,6 @@ void SlideBackground::NotifyItemUpdate(
}
}
-void SlideBackground::SetMetricFieldMaxValues( const Size& rPageSize )
-{
- const long nML = m_pLeftMarginEdit->Denormalize( m_pLeftMarginEdit->GetValue( FUNIT_TWIP ) );
- const long nMR = m_pRightMarginEdit->Denormalize( m_pRightMarginEdit->GetValue( FUNIT_TWIP ) );
- const long nMT = m_pTopMarginEdit->Denormalize( m_pTopMarginEdit->GetValue( FUNIT_TWIP ) );
- const long nMB = m_pBottomMarginEdit->Denormalize( m_pBottomMarginEdit->GetValue( FUNIT_TWIP ) );
-
- const long nPH = LogicToLogic( rPageSize.Height(), meUnit, MapUnit::MapTwip );
- const long nPW = LogicToLogic( rPageSize.Width(), meUnit, MapUnit::MapTwip );
-
- // Left
- long nMax = nPW - nMR - MINBODY;
- m_pLeftMarginEdit->SetMax( m_pLeftMarginEdit->Normalize( nMax ), FUNIT_TWIP );
-
- // Right
- nMax = nPW - nML - MINBODY;
- m_pRightMarginEdit->SetMax( m_pRightMarginEdit->Normalize( nMax ), FUNIT_TWIP );
-
- //Top
- nMax = nPH - nMB - MINBODY;
- m_pTopMarginEdit->SetMax( m_pTopMarginEdit->Normalize( nMax ), FUNIT_TWIP );
-
- //Bottom
- nMax = nPH - nMT - MINBODY;
- m_pBottomMarginEdit->SetMax( m_pTopMarginEdit->Normalize( nMax ), FUNIT_TWIP );
-}
-
IMPL_LINK_NOARG(SlideBackground, FillStyleModifyHdl, ListBox&, void)
{
const eFillStyle nPos = (eFillStyle)mpFillStyle->GetSelectedEntryPos();
@@ -1055,34 +1081,42 @@ IMPL_LINK_NOARG(SlideBackground, DspObjects, Button*, void)
GetBindings()->GetDispatcher()->ExecuteList(SID_DISPLAY_MASTER_OBJECTS, SfxCallMode::RECORD, { &aBoolItem, &aBoolItem });
}
-IMPL_LINK_NOARG( SlideBackground, ModifyLRMarginHdl, Edit&, void )
+IMPL_LINK_NOARG( SlideBackground, ModifyMarginHdl, ListBox&, void )
{
- m_nPageLeftMargin = GetCoreValue( *m_pLeftMarginEdit.get(), meUnit );
- m_nPageRightMargin = GetCoreValue( *m_pRightMarginEdit.get(), meUnit );
- if ( SfxViewFrame::Current() )
+ bool bApplyNewPageMargins = true;
+ switch ( mpMarginSelectBox->GetSelectedEntryPos() )
{
- std::unique_ptr<SvxLongLRSpaceItem> pPageLRMarginItem( new SvxLongLRSpaceItem( 0, 0, SID_ATTR_PAGE_LRSPACE ) );
- pPageLRMarginItem->SetLeft( m_nPageLeftMargin );
- pPageLRMarginItem->SetRight( m_nPageRightMargin );
- GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_LRSPACE, SfxCallMode::RECORD, { pPageLRMarginItem.get() } );
- pPageLRMarginItem.reset();
+ case 0:
+ SetNone(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
+ break;
+ case 1:
+ SetNarrow(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
+ break;
+ case 2:
+ SetModerate(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
+ break;
+ case 3:
+ SetNormal075(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
+ break;
+ case 4:
+ SetNormal100(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
+ break;
+ case 5:
+ SetNormal125(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
+ break;
+ case 6:
+ SetWide(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
+ break;
+ default:
+ bApplyNewPageMargins = false;
+ break;
}
- SetMetricFieldMaxValues( m_aPageSize );
-}
-IMPL_LINK_NOARG( SlideBackground, ModifyULMarginHdl, Edit&, void )
-{
- m_nPageTopMargin = GetCoreValue( *m_pTopMarginEdit.get(), meUnit );
- m_nPageBottomMargin = GetCoreValue( *m_pBottomMarginEdit.get(), meUnit );
- if ( SfxViewFrame::Current() )
+ if(bApplyNewPageMargins)
{
- std::unique_ptr<SvxLongULSpaceItem> pPageULMarginItem( new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ) );
- pPageULMarginItem->SetUpper( m_nPageTopMargin );
- pPageULMarginItem->SetLower( m_nPageBottomMargin );
- GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PAGE_ULSPACE, SfxCallMode::RECORD, { pPageULMarginItem.get() } );
- pPageULMarginItem.reset();
+ ExecuteMarginLRChange(m_nPageLeftMargin, m_nPageRightMargin);
+ ExecuteMarginULChange(m_nPageTopMargin, m_nPageBottomMargin);
}
- SetMetricFieldMaxValues( m_aPageSize );
}
}}
diff --git a/sd/source/ui/sidebar/SlideBackground.hxx b/sd/source/ui/sidebar/SlideBackground.hxx
index 4463f233b80b..804b6571b20d 100644
--- a/sd/source/ui/sidebar/SlideBackground.hxx
+++ b/sd/source/ui/sidebar/SlideBackground.hxx
@@ -95,10 +95,7 @@ private:
VclPtr<Button> mpCloseMaster;
VclPtr<Button> mpEditMaster;
VclPtr<FixedText> mpMasterLabel;
- VclPtr<MetricField> m_pLeftMarginEdit;
- VclPtr<MetricField> m_pRightMarginEdit;
- VclPtr<MetricField> m_pTopMarginEdit;
- VclPtr<MetricField> m_pBottomMarginEdit;
+ VclPtr<ListBox> mpMarginSelectBox;
VclPtr<VclVBox> m_pContainer;
::sfx2::sidebar::ControllerItem maPaperSizeController;
@@ -132,11 +129,14 @@ private:
vcl::EnumContext maImpressMasterContext;
vcl::EnumContext maImpressHandoutContext;
bool mbTitle;
+ std::unique_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem;
+ std::unique_ptr<SvxLongULSpaceItem> mpPageULMarginItem;
FieldUnit meFieldUnit;
long m_nPageLeftMargin;
long m_nPageRightMargin;
long m_nPageTopMargin;
long m_nPageBottomMargin;
+ OUString maCustomEntry;
SfxBindings* mpBindings;
@@ -152,11 +152,11 @@ private:
DECL_LINK(DspObjects, Button*, void);
DECL_LINK(CloseMasterHdl, Button*, void);
DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent&, void );
- DECL_LINK( ModifyLRMarginHdl, Edit&, void );
- DECL_LINK( ModifyULMarginHdl, Edit&, void );
+ DECL_LINK( ModifyMarginHdl, ListBox&, void );
void Initialize();
void Update();
+ void UpdateMarginBox();
void SetPanelTitle(const OUString& rTitle);
Color GetColorSetOrDefault();
@@ -167,9 +167,10 @@ private:
bool IsImpress();
void addListener();
void removeListener();
+ void ExecuteMarginLRChange(const long mnPageLeftMargin, const long mnPageRightMargin);
+ void ExecuteMarginULChange(const long mnPageTopMargin, const long mnPageBottomMargin);
void populateMasterSlideDropdown();
void updateMasterSlideSelection();
- void SetMetricFieldMaxValues(const Size& rPageSize);
};
}}
diff --git a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui
index 9eea5fbc0c3a..370527a13ed5 100644
--- a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui
+++ b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui
@@ -99,7 +99,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">9</property>
+ <property name="top_attach">10</property>
</packing>
</child>
<child>
@@ -110,7 +110,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">8</property>
</packing>
</child>
<child>
@@ -122,7 +122,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">8</property>
</packing>
</child>
<child>
@@ -175,7 +175,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">8</property>
+ <property name="top_attach">9</property>
</packing>
</child>
<child>
@@ -237,111 +237,48 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">10</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="labeltop">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="label" translatable="yes" context="sidebarslidebackground|labeltop">Top: </property>
- <property name="mnemonic_widget">top:0.00cm</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">13</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="top:0.00cm">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">•</property>
- <property name="digits">2</property>
- <property name="adjustment">adjustment1</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">13</property>
+ <property name="top_attach">11</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="labelbottom">
+ <object class="GtkComboBoxText" id="marginLB">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="label" translatable="yes" context="sidebarslidebackground|labelbottom">Bottom: </property>
- <property name="mnemonic_widget">bottom:0.00cm</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">14</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="bottom:0.00cm">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">•</property>
- <property name="digits">2</property>
- <property name="adjustment">adjustment1</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>
- <property name="top_attach">14</property>
+ <property name="top_attach">7</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="labelleft">
+ <object class="GtkLabel" id="labelmargin">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
- <property name="label" translatable="yes" context="sidebarslidebackground|labelleft">Left: </property>
- <property name="mnemonic_widget">left:0.00cm</property>
+ <property name="label" translatable="yes" context="sidebarslidebackground|labelmargin">Margin: </property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">11</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="left:0.00cm">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">•</property>
- <property name="digits">2</property>
- <property name="adjustment">adjustment1</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">11</property>
+ <property name="top_attach">7</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="labelright">
- <property name="visible">True</property>
+ <object class="GtkLabel" id="customlabel">
<property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="label" translatable="yes" context="sidebarslidebackground|labelright">Right: </property>
- <property name="mnemonic_widget">right:0.00cm</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">12</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="right:0.00cm">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">•</property>
- <property name="digits">2</property>
- <property name="adjustment">adjustment1</property>
+ <property name="label" translatable="yes" context="sidebarslidebackground|customlabel">Custom</property>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">12</property>
+ <property name="top_attach">16</property>
</packing>
</child>
<child>
More information about the Libreoffice-commits
mailing list