diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2016-04-22 10:09:40 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-05-07 22:33:28 +0000 |
commit | 1ca277fad69d8a53788a5d457a2dd99bd50b6910 (patch) | |
tree | 2e8a0c8569c9dd3e976b19f24d7d0a883f98500a /filter | |
parent | c327bb5c88573c96f22e9a8cfc4b8a733ae6b671 (diff) |
tdf#84394: xls load: delay cell-anchoring of object groups
When cell-anchored object groups are loaded, their anchoring must be
delayed until all nested objects have been loaded, lest the invalid
rectangle dimensions lead to incorrect positioning of the object.
To achieve this, we keep track of the DffObjectData of the pending
group, and move the anchoring to a FinalizeObj() method.
Since DffObjectData has a const reference to a DffRecordHeader (which we
need when setting the object anchoring) whose scope has closed by the
time we call FinalizeObj() on the parent object, the stack of pending
DffObjectData has references to clones of the original DffRecordHeader
held in shared pointers. (This is to minimize the invasiveness of this
patch wrt the Import* API.)
Change-Id: Id23f5549dbc82306271cc02afc750f37eeea3ca2
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/24292
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 77c2ecfc258b..b84bae177582 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -4137,6 +4137,12 @@ SdrObject* SvxMSDffManager::ImportGroup( const DffRecordHeader& rHd, SvStream& r } } } + if (size_t(nCalledByGroup) < maPendingGroupData.size()) + { + // finalization for this group is pending, do it now + pRet = FinalizeObj(maPendingGroupData.back().first, pRet); + maPendingGroupData.pop_back(); + } return pRet; } @@ -4153,6 +4159,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r return pRet; DffObjData aObjData( rHd, rClientRect, nCalledByGroup ); + aObjData.bRotateTextWithShape = ( GetSvxMSDffSettings() & SVXMSDFF_SETTINGS_IMPORT_EXCEL ) == 0; maShapeRecords.Consume( rSt ); if( maShapeRecords.SeekToContent( rSt, @@ -4812,6 +4819,18 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r pRet->SetDescription( aAltText ); } + // If this shape opens a new group, push back its object data because + // finalization will be called when nested objects have been imported; + // otherwise, just finalize here + if (size_t(nCalledByGroup) > maPendingGroupData.size()) + { + std::shared_ptr<DffRecordHeader> rHdClone(new DffRecordHeader(aObjData.rSpHd)); + maPendingGroupData.push_back( make_pair(DffObjData(rHdClone, aObjData), rHdClone) ); + } + else + { + pRet = FinalizeObj(aObjData, pRet); + } return pRet; } @@ -5485,6 +5504,12 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt, return pObj; }; +SdrObject* SvxMSDffManager::FinalizeObj(DffObjData& /* rObjData */, SdrObject* pObj) +{ + return pObj; +} + + void SvxMSDffManager::StoreShapeOrder(sal_uLong nId, sal_uLong nTxBx, SdrObject* pObject, |