Resolves: rhbz#1168757 Selecting multiple slides is not reflected in Print dialog

This commit is contained in:
David Tardon 2016-01-25 21:14:38 +01:00
parent 87ae9dc1c0
commit 7a35d3d288
2 changed files with 116 additions and 1 deletions

View File

@ -0,0 +1,110 @@
From 830b0e364cb1fec07664e1d5ec8a4c9593009959 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Wed, 20 Jan 2016 18:40:06 +0100
Subject: [PATCH] rhbz#1168757 propagate selected slides to print dialog
Change-Id: Icef119baffb8985ea0cb94d7e59f0daae88023ac
(cherry picked from commit f90f8329fe5e95f25ba449e307fd40d56d68d3bb)
---
sd/source/ui/view/DocumentRenderer.cxx | 41 ++++++++++++++++++++++++++++++----
1 file changed, 37 insertions(+), 4 deletions(-)
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index fd2b69c..d3b0a65 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -33,10 +33,12 @@
#include "FrameView.hxx"
#include "Outliner.hxx"
#include "OutlineViewShell.hxx"
+#include "SlideSorterViewShell.hxx"
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <rtl/ustrbuf.hxx>
#include <sfx2/printer.hxx>
#include <editeng/editstat.hxx>
#include <editeng/outlobj.hxx>
@@ -333,8 +335,9 @@ namespace {
class DialogCreator : Resource
{
public:
- DialogCreator (bool bImpress, sal_Int32 nCurPage)
+ DialogCreator (ViewShellBase &rBase, bool bImpress, sal_Int32 nCurPage)
: Resource(SdResId(_STR_IMPRESS_PRINT_UI_OPTIONS))
+ , mrBase(rBase)
, mbImpress(bImpress)
, mnCurPage(nCurPage)
{
@@ -359,6 +362,7 @@ namespace {
}
private:
+ ViewShellBase &mrBase;
std::vector<beans::PropertyValue> maProperties;
std::vector<sal_Int32> maSlidesPerPage;
bool mbImpress;
@@ -584,19 +588,48 @@ namespace {
aWidgetIds[0] = "printallpages";
aWidgetIds[1] = "printpages";
aWidgetIds[2] = "printselection";
+
+ // check if there is a selection of slides
+ OUString aPageRange(OUString::number(mnCurPage + 1));
+ int nPrintRange(0);
+ using sd::slidesorter::SlideSorterViewShell;
+ SlideSorterViewShell* const pSSViewSh(SlideSorterViewShell::GetSlideSorter(mrBase));
+ if (pSSViewSh)
+ {
+ const std::shared_ptr<SlideSorterViewShell::PageSelection> pPageSelection(pSSViewSh->GetPageSelection());
+ if (bool(pPageSelection) && pPageSelection->size() > 1)
+ {
+ OUStringBuffer aBuf;
+ // TODO: this could be improved by writing ranges instead of consecutive page
+ // numbers if appropriate. Do we have a helper function for that somewhere?
+ bool bFirst(true);
+ for (auto pPage: *pPageSelection)
+ {
+ if (!bFirst)
+ {
+ aBuf.append(',');
+ bFirst = false;
+ }
+ aBuf.append(OUString::number(pPage->GetPageNum() / 2 + 1));
+ }
+ aPageRange = aBuf.getStr();
+ nPrintRange = 1;
+ }
+ }
+
AddDialogControl( vcl::PrinterOptionsHelper::setChoiceRadiosControlOpt(aWidgetIds, "",
aHelpIds,
aPrintRangeName,
CreateChoice(mbImpress
? _STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE
: _STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE),
- 0 )
+ nPrintRange )
);
// create a an Edit dependent on "Pages" selected
vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, true );
AddDialogControl(vcl::PrinterOptionsHelper::setEditControlOpt("pagerange", "",
".HelpID:vcl:PrintDialog:PageRange:Edit", "PageRange",
- OUString::number(mnCurPage + 1), aPageRangeOpt));
+ aPageRange, aPageRangeOpt));
FreeResource();
}
@@ -1140,7 +1173,7 @@ public:
, mpPrintView()
, mbHasOrientationWarningBeenShown(false)
{
- DialogCreator aCreator( mrBase.GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS, GetCurrentPageIndex() );
+ DialogCreator aCreator( mrBase, mrBase.GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS, GetCurrentPageIndex() );
m_aUIProperties = aCreator.GetDialogControls();
maSlidesPerPage = aCreator.GetSlidesPerPage();
--
2.5.0

View File

@ -56,7 +56,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.2
Release: 5%{?libo_prerelease}%{?dist}
Release: 6%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 and CC0
URL: http://www.libreoffice.org/
@ -252,6 +252,7 @@ Patch14: 0003-gtk3-wayland-start-floating-windows-hidden.patch
Patch15: 0001-tdf-95450-avoid-double-swap-on-big-endian-arches.patch
Patch16: 0001-these-popups-should-start-invisible-and-take-default.patch
Patch17: 0002-disable-tearability-of-color-window.patch
Patch18: 0001-rhbz-1168757-propagate-selected-slides-to-print-dial.patch
%define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice
@ -2156,6 +2157,10 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif
%changelog
* Mon Jan 25 2016 David Tardon <dtardon@redhat.com> - 1:5.1.0.2-6-UNBUILT
- Resolves: rhbz#1168757 Selecting multiple slides is not reflected in Print
dialog
* Fri Jan 22 2016 Marek Kasik <mkasik@redhat.com> - 1:5.1.0.2-5
- Rebuild for poppler-0.40.0