diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-07-19 19:26:14 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-07-20 20:29:11 +0200 |
commit | cbc992e7370ab006ea7c0f8520896845f79f7749 (patch) | |
tree | 71000129a35f40d680279134efae7fac1c4e6a52 /sc | |
parent | 133da6ed83b278b9e6059c5c1a3d49f9f402792e (diff) |
tdf#118662 Cleanup old hack with cloned SdrCaptionObj
XclObjComment formally cloned the SdrCaptionObj for a single
reason - to suppress functionality of the UNO API implementation
in SvxShape::GetBitmap - non-inserted SdrObjects did not create
Graphic return values.
Changed this to use an exclusive flag at SdrCaptionObj, only
accessible for XclObjComment. Due to bad/undefined behaviour
of SdrObjects that are not iinserted anywhere (see old comment
in XclObjComment) there is no way to return to cloning the
SdrObjects just to have them without being added to a SdrPage.
Also improved the time eater UNO API implementation SvxShape::GetBitmap
to use more modern stuff to create the Graphics needed. All the
time constructing a full E3DView and setting SdrObjects selected
and getting the selection as graphic is way too expensive. That
way save may even get somewhat faster.
Last was to cleanup the bInserted flag in SdrObject. It is no
longer needed, being inserted now depends on being a member
of an SdrObjList (Group or Page) - sounds normal anyways and
is a synergy effect of already done AW080 cleanups.
Checked now on linux. Problem is UnitTest 'testN777345' which
checks file "n777345.docx".
First point is that this only happens
#if !defined(MACOSX)
#if !defined(_WIN32)
so it's clear why I detected no problem on Windows.
Second point is that this test takes a checksum of a Graphic
that is created using getReplacementGraphic() this value *will*
change - of course - every time creation of that graphic is
even *slightly* modified, so from my POV this UnitTest is
defined to fill quite often. It may even create different
results on different systems (!). Adaption of the test value
will be needed quite often and makes this test questionable.
Change-Id: If0918831a9cbd61b31298aeac7342e1913ee6c7a
Reviewed-on: https://gerrit.libreoffice.org/57758
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/xcl97/xcl97rec.cxx | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 2e3041662f1a..fa8390f41da6 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -487,29 +487,32 @@ void XclObj::SaveTextRecs( XclExpStream& rStrm ) pTxo->Save( rStrm ); } - // --- class XclObjComment ------------------------------------------ +// --- class XclObjComment ------------------------------------------ + +// tdf#118662 static helper to allow single function access as friend in SdrCaptionObj +void setSuppressGetBitmapFromXclObjComment(SdrCaptionObj* pSdrCaptionObj, bool bValue) +{ + if(nullptr != pSdrCaptionObj) + { + pSdrCaptionObj->setSuppressGetBitmap(bValue); + } +} XclObjComment::XclObjComment( XclExpObjectManager& rObjMgr, const tools::Rectangle& rRect, const EditTextObject& rEditObj, SdrCaptionObj* pCaption, bool bVisible, const ScAddress& rAddress, const tools::Rectangle &rFrom, const tools::Rectangle &rTo ) : XclObj( rObjMgr, EXC_OBJTYPE_NOTE, true ) , maScPos( rAddress ) - - // No need to CloneSdrObject(...) here, the SdrCaptionObj will exist - // during the whole im/export time. Seems that this was done - // initially to make UnitTest CppunitTest_sc_subsequent_export_test - // work (better: not crash) which had not added emfio/emfio to - // CppunitTest_sc_subsequent_export_test.mk and thus failed. - // Probably the Graphic created from the Clone was wrong. - // Problem with creating a Clone here is that it gets cloned, but not inserted to a - // SdrPage. In deeper export layers this then goes wrong since without being inserted - // to a Page, no SvxPage/UnoApiPage can be accessed. This was different in previous - // revisions of the code in that a SdrObject could be *not* inserted, but have a - // SdrPage*. That again was redundant, wrong and inconsequent. , mpCaption( pCaption ) - , mbVisible( bVisible ) , maFrom ( rFrom ) , maTo ( rTo ) { + // tdf#118662 due to no longer cloning the SdrCaptionObj an old 'hack' using the + // fact that no Graphics gets created when a SdrObject is not inserted in a SdrPage + // does not work anymore. In SvxShape::GetBitmap that info was used, and here the + // SdrCaptionObj was cloned for the only reason to have one not added to a SdrPage. + // To emulate old behaviour, use a boolean flag at the SdrCaptionObj. + setSuppressGetBitmapFromXclObjComment(mpCaption, true); + ProcessEscherObj( rObjMgr.GetRoot(), rRect, pCaption, bVisible); // TXO pTxo .reset(new XclTxo( rObjMgr.GetRoot(), rEditObj, pCaption )); @@ -590,6 +593,8 @@ void XclObjComment::ProcessEscherObj( const XclExpRoot& rRoot, const tools::Rect XclObjComment::~XclObjComment() { + // tdf#118662 reset flag + setSuppressGetBitmapFromXclObjComment(mpCaption, false); } void XclObjComment::Save( XclExpStream& rStrm ) |