From d2a76cd3d38bb93935f511b050f999dccdbcb9f667195a825a6d1e65bbbf2d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 15 Dec 2015 18:15:32 +0000 Subject: [PATCH] Accepting request 349054 from LibreOffice:5.0 - bnc#945047 - LO-L3: LO is duplicating master pages * bnc-945047.diff OBS-URL: https://build.opensuse.org/request/show/349054 OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=351 --- bnc-945047.diff | 104 ++++++++++++++++++++++++++++++++++++++++++++ libreoffice.changes | 6 +++ libreoffice.spec | 3 ++ 3 files changed, 113 insertions(+) create mode 100644 bnc-945047.diff diff --git a/bnc-945047.diff b/bnc-945047.diff new file mode 100644 index 0000000..51f9353 --- /dev/null +++ b/bnc-945047.diff @@ -0,0 +1,104 @@ +From 0b6c9ddce0478bbedc36e8531f31b154bbce661c Mon Sep 17 00:00:00 2001 +From: Mike Kaganski +Date: Thu, 3 Dec 2015 19:05:03 +1000 +Subject: [PATCH] tdf#96206: Avoid scaling objects while copying to clipboard + +... to prevent duplicating masters on slide copy-paste. +Also fixed a 10-year copy-paste error (pRefPage wasn't replaced +with pNPage). +Fixed argument evaluation order issue (aStream.GetEndOfData() +depends on Flush() but doesn't call it, so will return incorrect +result if called before aStream.GetBuffer()). +Replaced compare of hashes with results of stringify(), +because it removes useless overhead (hashes are calculated from +stringify() anyway, and are not cached anywhere). +Removed Flush() called from SvMemoryStream::GetBuffer(), because +it calls GetData(), which calls Flush() itself. + +Change-Id: Ia46d4e9a017fc628d424949a9d229045a249a4ca +--- + sd/source/core/drawdoc3.cxx | 22 ++++++++++++++++------ + svx/source/svdraw/svdobj.cxx | 1 + + tools/source/stream/stream.cxx | 1 - + 3 files changed, 17 insertions(+), 7 deletions(-) + +diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx +index 3f966e8..cb15650 100644 +--- a/sd/source/core/drawdoc3.cxx ++++ b/sd/source/core/drawdoc3.cxx +@@ -51,6 +51,7 @@ + #include "strmname.h" + #include "anminfo.hxx" + #include "customshowlist.hxx" ++#include "sdxfer.hxx" + + #include "../ui/inc/unmovss.hxx" + #include "../ui/inc/unchss.hxx" +@@ -110,7 +111,7 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc + { + // Ignore Layouts with "Default" these seem to be special - in the sense that there are lot of assumption all over Impress + // about this +- if( bRenameDuplicates && aTest != OUString( SdResId( STR_LAYOUT_DEFAULT_NAME ) ) && pTestPage->getHash() != pBMMPage->getHash() ) ++ if( bRenameDuplicates && aTest != OUString( SdResId( STR_LAYOUT_DEFAULT_NAME ) ) && pTestPage->stringify() != pBMMPage->stringify() ) + { + pBookmarkDoc->RenameLayoutTemplate( pBMMPage->GetLayoutName(), OUString(pBMMPage->GetName())+=OUString("_") ); + aLayout = pBMMPage->GetName(); +@@ -438,17 +439,26 @@ bool SdDrawDocument::InsertBookmarkAsPage( + sal_Int32 nNRight = pNPage->GetRgtBorder(); + sal_Int32 nNUpper = pNPage->GetUppBorder(); + sal_Int32 nNLower = pNPage->GetLwrBorder(); +- Orientation eNOrient = pRefPage->GetOrientation(); ++ Orientation eNOrient = pNPage->GetOrientation(); + + // Adapt page size and margins to those of the later pages? + pRefPage = GetSdPage(nSdPageCount - 1, PK_STANDARD); + + if( bNoDialogs ) + { +- if( rBookmarkList.empty() ) +- bScaleObjects = pRefPage->IsScaleObjects(); +- else +- bScaleObjects = true; ++ // If this is clipboard, then no need to scale objects: ++ // this will make copied masters to differ from the originals, ++ // and thus InsertBookmarkAsPage_FindDuplicateLayouts will ++ // duplicate masters on insert to same document ++ bool bIsClipBoard = (SD_MOD()->pTransferClip && ++ SD_MOD()->pTransferClip->GetWorkDocument() == this); ++ if (!bIsClipBoard) ++ { ++ if (rBookmarkList.empty()) ++ bScaleObjects = pRefPage->IsScaleObjects(); ++ else ++ bScaleObjects = true; ++ } + } + else + { +diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx +index b6d3827..b712850 100644 +--- a/svx/source/svdraw/svdobj.cxx ++++ b/svx/source/svdraw/svdobj.cxx +@@ -1776,6 +1776,7 @@ OString SdrObject::stringify() const + SfxItemSet aSet(GetMergedItemSet()); + aSet.InvalidateDefaultItems(); + aSet.Store(aStream, true); ++ aStream.Flush(); // for correct results from aStream.GetEndOfData() + aString.append(static_cast(aStream.GetBuffer()), aStream.GetEndOfData()); + + return aString.makeStringAndClear(); +diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx +index bb6d21e..17bdcd1 100644 +--- a/tools/source/stream/stream.cxx ++++ b/tools/source/stream/stream.cxx +@@ -1723,7 +1723,6 @@ SvMemoryStream::~SvMemoryStream() + + const void* SvMemoryStream::GetBuffer() + { +- Flush(); + return GetData(); + } + +-- +2.1.4 + diff --git a/libreoffice.changes b/libreoffice.changes index 8138b37..df837e6 100644 --- a/libreoffice.changes +++ b/libreoffice.changes @@ -4,6 +4,12 @@ Tue Dec 15 11:47:08 UTC 2015 - tchvatal@suse.com - Version update to 5.0.4.2: * Final of the 5.0.4 series +------------------------------------------------------------------- +Mon Dec 14 22:23:15 UTC 2015 - andras.timar@collabora.com + +- bnc#945047 - LO-L3: LO is duplicating master pages + * bnc-945047.diff + ------------------------------------------------------------------- Fri Dec 11 12:13:27 UTC 2015 - tchvatal@suse.com diff --git a/libreoffice.spec b/libreoffice.spec index 3eb6d80..ffc7ed4 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -177,6 +177,8 @@ Patch11: bnc-679938.diff Patch12: use-long-for-test-comparsion.patch # bnc#954345 - LO-L3: Insert-->Image-->Insert as Link hangs writer Patch13: bnc-954345.diff +# bnc#945047 - LO-L3: LO is duplicating master pages +Patch14: bnc-945047.diff # try to save space by using hardlinks Patch990: install-with-hardlinks.diff BuildRequires: %{name}-share-linker @@ -1008,6 +1010,7 @@ Provides additional %{langname} translations and resources for %{project}. \ %patch11 -p1 %patch12 -p1 %patch13 -p1 +%patch14 -p1 %patch990 -p1 # 256x256 icons tar -xjf %{SOURCE20}