summaryrefslogtreecommitdiff
path: root/include/filter/msfilter/msdffimp.hxx
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2016-04-22 10:09:40 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-05-07 22:33:28 +0000
commit1ca277fad69d8a53788a5d457a2dd99bd50b6910 (patch)
tree2e8a0c8569c9dd3e976b19f24d7d0a883f98500a /include/filter/msfilter/msdffimp.hxx
parentc327bb5c88573c96f22e9a8cfc4b8a733ae6b671 (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 'include/filter/msfilter/msdffimp.hxx')
-rw-r--r--include/filter/msfilter/msdffimp.hxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
index e0c23eeda75f..3b594d01b1b4 100644
--- a/include/filter/msfilter/msdffimp.hxx
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -324,6 +324,23 @@ struct DffObjData
bRotateTextWithShape( true ),
bPageAnchor( true ),
nCalledByGroup( nClByGroup ){}
+
+ // Clone a DffObjData _o_ by replacing its rSpHd with a shared_ptr to another one
+ DffObjData( const std::shared_ptr<DffRecordHeader>& rObjHd, const DffObjData& o) :
+ rSpHd( *rObjHd ),
+ aBoundRect( o.aBoundRect ),
+ nShapeId( o.nShapeId ),
+ nSpFlags( o.nSpFlags ),
+ eShapeType( o.eShapeType ),
+ bShapeType( o.bShapeType ),
+ bClientAnchor( o.bClientAnchor ),
+ bClientData( o.bClientData ),
+ bChildAnchor( o.bChildAnchor ),
+ bOpt( o.bOpt ),
+ bOpt2( o.bOpt2 ),
+ bRotateTextWithShape( o.bRotateTextWithShape ),
+ bPageAnchor( o.bPageAnchor ),
+ nCalledByGroup( o.nCalledByGroup ){}
};
#define DFF_RECORD_MANAGER_BUF_SIZE 64
@@ -407,6 +424,13 @@ protected:
std::vector<FIDCL> maFidcls;
OffsetMap maDgOffsetTable; ///< array of fileoffsets
+ /** When importing Excel files, cell anchor computations for non-page-anchored
+ groups must be done after all nested groups have been processed; for each open
+ group, the pending data is stored here. The storage also holds a shared_ptr to
+ the DffObjData ow DffRecordHeader to avoid it going out of scope except whe needed
+ */
+ std::vector< std::pair<DffObjData, std::shared_ptr<DffRecordHeader> > > maPendingGroupData;
+
friend class DffPropertyReader;
SvStream& rStCtrl;
@@ -483,6 +507,13 @@ protected:
void* pData,
Rectangle& rTextRect,
SdrObject* pObj = nullptr);
+
+ /** Object finalization, used by the Excel filter to correctly
+ compute the object anchoring after nested objects have been imported.
+ */
+ virtual SdrObject* FinalizeObj(DffObjData& rData,
+ SdrObject* pObj = nullptr);
+
virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const;
// Fontwork objects use a new implementation of ReadObjText because the old