From 3706c2ff867e87d7b6d7ff905d9ac56bad064dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 23 Jun 2015 17:02:06 +0100 Subject: [PATCH] allow slide design to affect multiple pages --- ...gn-to-affect-multiple-standard-pages.patch | 178 ++++++++++++++++++ libreoffice.spec | 1 + 2 files changed, 179 insertions(+) create mode 100644 0001-allow-slide-design-to-affect-multiple-standard-pages.patch diff --git a/0001-allow-slide-design-to-affect-multiple-standard-pages.patch b/0001-allow-slide-design-to-affect-multiple-standard-pages.patch new file mode 100644 index 0000000..bbb8019 --- /dev/null +++ b/0001-allow-slide-design-to-affect-multiple-standard-pages.patch @@ -0,0 +1,178 @@ +From f7ed8b99b628625851fb28ec1a3dead710c8871c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Tue, 23 Jun 2015 16:54:52 +0100 +Subject: [PATCH] allow slide design to affect multiple standard pages + +modify this minimally and select all standard pages +selected in the slidesorted, unselect them afterwards +and loop over the selected ones. + +This looks like it could do with a rework to disentangle +the master/standard pages stuff, but leave it as is in +this commit + +Change-Id: Ifd01fe21c91e5e6b07b2d8bba0d85facadc25998 +--- + sd/source/ui/func/fuprlout.cxx | 94 +++++++++++++++++++++++++++++------------- + 1 file changed, 66 insertions(+), 28 deletions(-) + +diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx +index 6ce661f..f087ad9 100644 +--- a/sd/source/ui/func/fuprlout.cxx ++++ b/sd/source/ui/func/fuprlout.cxx +@@ -42,6 +42,7 @@ + #include "strmname.h" + #include "app.hrc" + #include "DrawDocShell.hxx" ++#include "SlideSorterViewShell.hxx" + #include "unprlout.hxx" + #include "unchss.hxx" + #include "unmovss.hxx" +@@ -89,24 +90,6 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) + + bool bError = false; + +- // determine the active page +- sal_uInt16 nSelectedPage = SDRPAGE_NOTFOUND; +- for (sal_uInt16 nPage = 0; nPage < mpDoc->GetSdPageCount(PK_STANDARD); nPage++) +- { +- if (mpDoc->GetSdPage(nPage, PK_STANDARD)->IsSelected()) +- { +- nSelectedPage = nPage; +- break; +- } +- } +- +- DBG_ASSERT(nSelectedPage != SDRPAGE_NOTFOUND, "no selected page"); +- SdPage* pSelectedPage = mpDoc->GetSdPage(nSelectedPage, PK_STANDARD); +- OUString aOldLayoutName(pSelectedPage->GetLayoutName()); +- sal_Int32 nPos = aOldLayoutName.indexOf(SD_LT_SEPARATOR); +- if (nPos != -1) +- aOldLayoutName = aOldLayoutName.copy(0, nPos); +- + /* if we are on a master page, the changes apply for all pages and notes- + pages who are using the relevant layout */ + bool bOnMaster = false; +@@ -117,6 +100,51 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) + if (eEditMode == EM_MASTERPAGE) + bOnMaster = true; + } ++ ++ std::vector aUnselect; ++ if (!bOnMaster) ++ { ++ //We later rely on IsSelected, so transfer the selection here ++ //into the document ++ slidesorter::SlideSorterViewShell* pSlideSorterViewShell ++ = slidesorter::SlideSorterViewShell::GetSlideSorter(mpViewShell->GetViewShellBase()); ++ if (pSlideSorterViewShell) ++ { ++ boost::shared_ptr xSelection( ++ pSlideSorterViewShell->GetPageSelection()); ++ if (xSelection) ++ { ++ for (auto it = xSelection->begin(); it != xSelection->end(); ++it) ++ { ++ SdPage *pPage = *it; ++ if (pPage->IsSelected() || pPage->GetPageKind() != PK_STANDARD) ++ continue; ++ mpDoc->SetSelected(pPage, true); ++ aUnselect.push_back(pPage); ++ } ++ } ++ } ++ } ++ ++ std::vector aSelectedPages; ++ std::vector aSelectedPageNums; ++ // determine the active pages ++ for (sal_uInt16 nPage = 0; nPage < mpDoc->GetSdPageCount(PK_STANDARD); nPage++) ++ { ++ SdPage* pPage = mpDoc->GetSdPage(nPage, PK_STANDARD); ++ if (pPage->IsSelected()) ++ { ++ aSelectedPages.push_back(pPage); ++ aSelectedPageNums.push_back(nPage); ++ } ++ } ++ ++ assert(!aSelectedPages.empty() && "no selected page"); ++ OUString aOldLayoutName(aSelectedPages.back()->GetLayoutName()); ++ sal_Int32 nPos = aOldLayoutName.indexOf(SD_LT_SEPARATOR); ++ if (nPos != -1) ++ aOldLayoutName = aOldLayoutName.copy(0, nPos); ++ + bool bMasterPage = bOnMaster; + bool bCheckMasters = false; + +@@ -196,14 +224,15 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) + OUString aLayoutName; + if( pTempDoc ) + aLayoutName = aFile.getToken(1, DOCUMENT_TOKEN); +- +- mpDoc->SetMasterPage(nSelectedPage, aLayoutName, pTempDoc, bMasterPage, bCheckMasters); ++ for (auto nSelectedPage : aSelectedPageNums) ++ mpDoc->SetMasterPage(nSelectedPage, aLayoutName, pTempDoc, bMasterPage, bCheckMasters); + mpDoc->CloseBookmarkDoc(); + } + else + { + // use master page with the layout name aFile from current Doc +- mpDoc->SetMasterPage(nSelectedPage, aFile, mpDoc, bMasterPage, bCheckMasters); ++ for (auto nSelectedPage : aSelectedPageNums) ++ mpDoc->SetMasterPage(nSelectedPage, aFile, mpDoc, bMasterPage, bCheckMasters); + } + + // remove blocking +@@ -211,7 +240,7 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) + static_cast(mpView)->BlockPageOrderChangedHint(false); + + // if the master page was visible, show it again +- if (!bError && nSelectedPage != SDRPAGE_NOTFOUND) ++ if (!bError) + { + if (bOnMaster) + { +@@ -219,13 +248,16 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) + { + ::sd::View* pView = + static_cast(mpViewShell)->GetView(); +- sal_uInt16 nPgNum = pSelectedPage->TRG_GetMasterPage().GetPageNum(); ++ for (auto pSelectedPage : aSelectedPages) ++ { ++ sal_uInt16 nPgNum = pSelectedPage->TRG_GetMasterPage().GetPageNum(); + +- if (static_cast(mpViewShell)->GetPageKind() == PK_NOTES) +- nPgNum++; ++ if (static_cast(mpViewShell)->GetPageKind() == PK_NOTES) ++ nPgNum++; + +- pView->HideSdrPage(); +- pView->ShowSdrPage(pView->GetModel()->GetMasterPage(nPgNum)); ++ pView->HideSdrPage(); ++ pView->ShowSdrPage(pView->GetModel()->GetMasterPage(nPgNum)); ++ } + } + + // force update of TabBar +@@ -233,10 +265,16 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq ) + } + else + { +- pSelectedPage->SetAutoLayout(pSelectedPage->GetAutoLayout()); ++ for (auto pSelectedPage : aSelectedPages) ++ pSelectedPage->SetAutoLayout(pSelectedPage->GetAutoLayout()); + } + } + ++ //Undo transfer to document selection ++ for (auto pPage : aUnselect) ++ mpDoc->SetSelected(pPage, false); ++ ++ + // fake a mode change to repaint the page tab bar + if( mpViewShell && mpViewShell->ISA( DrawViewShell ) ) + { +-- +2.4.0 + diff --git a/libreoffice.spec b/libreoffice.spec index 29760ee..660cbf8 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -328,6 +328,7 @@ Patch16: 0001-disable-PSD-import-test-which-deadlocks-on-ARM.patch Patch17: 0001-Resolves-tdf-89905-don-t-copy-palettes-from-shared-t.patch Patch18: 0001-Resolves-tdf-49407-enable-CaseMap-property-in-impres.patch Patch19: 0001-rhbz-1233420-handle-inexistent-cond.-format.patch +Patch20: 0001-allow-slide-design-to-affect-multiple-standard-pages.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice