Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3352
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/52/3352/1
fdo#60551 Impress: pasting text removes bullet
The reason the bullet is removed is that the pool used in
copying is different from the pool in pasting. The fix passes
the global text edit object pool so we have the same pool
thus keep the bullet attributes. This also fix the crash in
fdo#47018.
Note that it currently only fixes .odp, not .pptx nor .ppt
Change-Id: I57d1245db650d12e6b2c05baece379038b673689
---
M editeng/source/editeng/editobj.cxx
M editeng/source/editeng/impedit4.cxx
M svl/inc/svl/itempool.hxx
M svl/source/items/poolio.cxx
4 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 0433ea5..6c3aded 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -1041,6 +1041,13 @@
if ( bOwnerOfPool )
GetPool()->Load( rIStream );
+ else
+ {
+ // Don't load, a global Pool is passed.
+ // Inform this is the current loading version to avoid GetNewWhich in
+ // SfxPoolItem::LoadItem
+ GetPool()->SetIsCurrentVersionLoading( );
+ }
// CharSet, in which it was saved:
sal_uInt16 nCharSet;
@@ -1085,7 +1092,10 @@
const SfxPoolItem* pItem;
rIStream >> _nWhich;
- _nWhich = pPool->GetNewWhich( _nWhich );
+
+ // Only map new which if we don't use a global pool
+ if ( bOwnerOfPool)
+ _nWhich = pPool->GetNewWhich( _nWhich );
pItem = pPool->LoadSurrogate( rIStream, _nWhich, 0 );
rIStream >> nStart;
rIStream >> nEnd;
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 34ef278..d701dec 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -197,8 +197,8 @@
EditPaM ImpEditEngine::ReadBin( SvStream& rInput, EditSelection aSel )
{
- // Simply abuse a temporary text object ...
- EditTextObject* pObj = EditTextObject::Create( rInput, NULL );
+ // fdo#60551 pass global text object pool to load attributes
+ EditTextObject* pObj = EditTextObject::Create( rInput, GetEditTextObjectPool( ) );
EditPaM aLastPaM = aSel.Max();
if ( pObj )
@@ -301,7 +301,8 @@
sal_uInt32 ImpEditEngine::WriteBin( SvStream& rOutput, EditSelection aSel, bool
bStoreUnicodeStrings )
{
- boost::scoped_ptr<EditTextObject> pObj(CreateTextObject(aSel, NULL));
+ // fdo#60551 use global pool instead of creating a new pool
+ boost::scoped_ptr<EditTextObject> pObj(CreateTextObject( aSel ));
pObj->mpImpl->StoreUnicodeStrings(bStoreUnicodeStrings);
pObj->Store(rOutput);
return 0;
diff --git a/svl/inc/svl/itempool.hxx b/svl/inc/svl/itempool.hxx
index ab9ff84..6d4ee7f 100644
--- a/svl/inc/svl/itempool.hxx
+++ b/svl/inc/svl/itempool.hxx
@@ -215,6 +215,7 @@
sal_uInt16 GetVersion() const;
void SetFileFormatVersion( sal_uInt16 nFileFormatVersion );
bool IsCurrentVersionLoading() const;
+ void SetIsCurrentVersionLoading( );
static int IsWhich(sal_uInt16 nId) {
return nId && nId <= SFX_WHICH_MAX; }
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index 76ce008..7139737 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -1629,5 +1629,16 @@
return pItem;
}
+//-------------------------------------------------------------------------
+/*
+ In case ::LoadItem() is called without preceeded by ::Load(),
+ This function is used to avoid using of ::GetNewWhich() which lead to
+ out of range error.
+ */
+
+void SfxItemPool::SetIsCurrentVersionLoading( )
+{
+ pImp->nLoadingVersion = pImp->nVersion;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
--
To view, visit https://gerrit.libreoffice.org/3352
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I57d1245db650d12e6b2c05baece379038b673689
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Cao Cuong Ngo <cao.cuong.ngo@gmail.com>
Context
- [PATCH] fdo#60551 Impress: pasting text removes bullet · Cao Cuong Ngo (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.