/[packages]/updates/5/libreoffice/current/SOURCES/0001-allow-slide-design-to-affect-multiple-standard-pages.patch
ViewVC logotype

Contents of /updates/5/libreoffice/current/SOURCES/0001-allow-slide-design-to-affect-multiple-standard-pages.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 896529 - (show annotations) (download)
Thu Oct 29 21:56:40 2015 UTC (8 years, 5 months ago) by tv
File size: 6985 byte(s)
new release
1 From f7ed8b99b628625851fb28ec1a3dead710c8871c Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
3 Date: Tue, 23 Jun 2015 16:54:52 +0100
4 Subject: [PATCH] allow slide design to affect multiple standard pages
5
6 modify this minimally and select all standard pages
7 selected in the slidesorted, unselect them afterwards
8 and loop over the selected ones.
9
10 This looks like it could do with a rework to disentangle
11 the master/standard pages stuff, but leave it as is in
12 this commit
13
14 Change-Id: Ifd01fe21c91e5e6b07b2d8bba0d85facadc25998
15 ---
16 sd/source/ui/func/fuprlout.cxx | 94 +++++++++++++++++++++++++++++-------------
17 1 file changed, 66 insertions(+), 28 deletions(-)
18
19 diff --git a/sd/source/ui/func/fuprlout.cxx b/sd/source/ui/func/fuprlout.cxx
20 index 6ce661f..f087ad9 100644
21 --- a/sd/source/ui/func/fuprlout.cxx
22 +++ b/sd/source/ui/func/fuprlout.cxx
23 @@ -42,6 +42,7 @@
24 #include "strmname.h"
25 #include "app.hrc"
26 #include "DrawDocShell.hxx"
27 +#include "SlideSorterViewShell.hxx"
28 #include "unprlout.hxx"
29 #include "unchss.hxx"
30 #include "unmovss.hxx"
31 @@ -89,24 +90,6 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq )
32
33 bool bError = false;
34
35 - // determine the active page
36 - sal_uInt16 nSelectedPage = SDRPAGE_NOTFOUND;
37 - for (sal_uInt16 nPage = 0; nPage < mpDoc->GetSdPageCount(PK_STANDARD); nPage++)
38 - {
39 - if (mpDoc->GetSdPage(nPage, PK_STANDARD)->IsSelected())
40 - {
41 - nSelectedPage = nPage;
42 - break;
43 - }
44 - }
45 -
46 - DBG_ASSERT(nSelectedPage != SDRPAGE_NOTFOUND, "no selected page");
47 - SdPage* pSelectedPage = mpDoc->GetSdPage(nSelectedPage, PK_STANDARD);
48 - OUString aOldLayoutName(pSelectedPage->GetLayoutName());
49 - sal_Int32 nPos = aOldLayoutName.indexOf(SD_LT_SEPARATOR);
50 - if (nPos != -1)
51 - aOldLayoutName = aOldLayoutName.copy(0, nPos);
52 -
53 /* if we are on a master page, the changes apply for all pages and notes-
54 pages who are using the relevant layout */
55 bool bOnMaster = false;
56 @@ -117,6 +100,51 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq )
57 if (eEditMode == EM_MASTERPAGE)
58 bOnMaster = true;
59 }
60 +
61 + std::vector<SdPage*> aUnselect;
62 + if (!bOnMaster)
63 + {
64 + //We later rely on IsSelected, so transfer the selection here
65 + //into the document
66 + slidesorter::SlideSorterViewShell* pSlideSorterViewShell
67 + = slidesorter::SlideSorterViewShell::GetSlideSorter(mpViewShell->GetViewShellBase());
68 + if (pSlideSorterViewShell)
69 + {
70 + boost::shared_ptr<slidesorter::SlideSorterViewShell::PageSelection> xSelection(
71 + pSlideSorterViewShell->GetPageSelection());
72 + if (xSelection)
73 + {
74 + for (auto it = xSelection->begin(); it != xSelection->end(); ++it)
75 + {
76 + SdPage *pPage = *it;
77 + if (pPage->IsSelected() || pPage->GetPageKind() != PK_STANDARD)
78 + continue;
79 + mpDoc->SetSelected(pPage, true);
80 + aUnselect.push_back(pPage);
81 + }
82 + }
83 + }
84 + }
85 +
86 + std::vector<SdPage*> aSelectedPages;
87 + std::vector<sal_uInt16> aSelectedPageNums;
88 + // determine the active pages
89 + for (sal_uInt16 nPage = 0; nPage < mpDoc->GetSdPageCount(PK_STANDARD); nPage++)
90 + {
91 + SdPage* pPage = mpDoc->GetSdPage(nPage, PK_STANDARD);
92 + if (pPage->IsSelected())
93 + {
94 + aSelectedPages.push_back(pPage);
95 + aSelectedPageNums.push_back(nPage);
96 + }
97 + }
98 +
99 + assert(!aSelectedPages.empty() && "no selected page");
100 + OUString aOldLayoutName(aSelectedPages.back()->GetLayoutName());
101 + sal_Int32 nPos = aOldLayoutName.indexOf(SD_LT_SEPARATOR);
102 + if (nPos != -1)
103 + aOldLayoutName = aOldLayoutName.copy(0, nPos);
104 +
105 bool bMasterPage = bOnMaster;
106 bool bCheckMasters = false;
107
108 @@ -196,14 +224,15 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq )
109 OUString aLayoutName;
110 if( pTempDoc )
111 aLayoutName = aFile.getToken(1, DOCUMENT_TOKEN);
112 -
113 - mpDoc->SetMasterPage(nSelectedPage, aLayoutName, pTempDoc, bMasterPage, bCheckMasters);
114 + for (auto nSelectedPage : aSelectedPageNums)
115 + mpDoc->SetMasterPage(nSelectedPage, aLayoutName, pTempDoc, bMasterPage, bCheckMasters);
116 mpDoc->CloseBookmarkDoc();
117 }
118 else
119 {
120 // use master page with the layout name aFile from current Doc
121 - mpDoc->SetMasterPage(nSelectedPage, aFile, mpDoc, bMasterPage, bCheckMasters);
122 + for (auto nSelectedPage : aSelectedPageNums)
123 + mpDoc->SetMasterPage(nSelectedPage, aFile, mpDoc, bMasterPage, bCheckMasters);
124 }
125
126 // remove blocking
127 @@ -211,7 +240,7 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq )
128 static_cast<DrawView*>(mpView)->BlockPageOrderChangedHint(false);
129
130 // if the master page was visible, show it again
131 - if (!bError && nSelectedPage != SDRPAGE_NOTFOUND)
132 + if (!bError)
133 {
134 if (bOnMaster)
135 {
136 @@ -219,13 +248,16 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq )
137 {
138 ::sd::View* pView =
139 static_cast<DrawViewShell*>(mpViewShell)->GetView();
140 - sal_uInt16 nPgNum = pSelectedPage->TRG_GetMasterPage().GetPageNum();
141 + for (auto pSelectedPage : aSelectedPages)
142 + {
143 + sal_uInt16 nPgNum = pSelectedPage->TRG_GetMasterPage().GetPageNum();
144
145 - if (static_cast<DrawViewShell*>(mpViewShell)->GetPageKind() == PK_NOTES)
146 - nPgNum++;
147 + if (static_cast<DrawViewShell*>(mpViewShell)->GetPageKind() == PK_NOTES)
148 + nPgNum++;
149
150 - pView->HideSdrPage();
151 - pView->ShowSdrPage(pView->GetModel()->GetMasterPage(nPgNum));
152 + pView->HideSdrPage();
153 + pView->ShowSdrPage(pView->GetModel()->GetMasterPage(nPgNum));
154 + }
155 }
156
157 // force update of TabBar
158 @@ -233,10 +265,16 @@ void FuPresentationLayout::DoExecute( SfxRequest& rReq )
159 }
160 else
161 {
162 - pSelectedPage->SetAutoLayout(pSelectedPage->GetAutoLayout());
163 + for (auto pSelectedPage : aSelectedPages)
164 + pSelectedPage->SetAutoLayout(pSelectedPage->GetAutoLayout());
165 }
166 }
167
168 + //Undo transfer to document selection
169 + for (auto pPage : aUnselect)
170 + mpDoc->SetSelected(pPage, false);
171 +
172 +
173 // fake a mode change to repaint the page tab bar
174 if( mpViewShell && mpViewShell->ISA( DrawViewShell ) )
175 {
176 --
177 2.4.0
178

  ViewVC Help
Powered by ViewVC 1.1.30