[PATCH 2/2] tweak imported shape position for xls( binary ) format fdo#49430

Noel Power noel.power at novell.com
Fri May 4 02:03:15 PDT 2012


---
 sc/source/filter/excel/read.cxx     |    9 +++++++++
 sc/source/filter/excel/xiescher.cxx |   22 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index 4f0ce42e..179af68 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -52,6 +52,7 @@
 #include "root.hxx"
 #include "imp_op.hxx"
 #include "excimp8.hxx"
+#include <sfx2/objsh.hxx>
 
 FltError ImportExcel::Read( void )
 {
@@ -1309,6 +1310,14 @@ FltError ImportExcel8::Read( void )
         PostDocLoad();
 
         pD->CalcAfterLoad();
+        SfxObjectShell* pDocShell = GetDocShell();
+
+        if ( pDocShell )
+        {
+            std::vector< OrientationInfo > savedOrientations;
+            ScGlobal::CaptureShapeOrientationInfo( savedOrientations, pDocShell->GetModel() );
+            ScGlobal::ApplyShapeOrientationInfo( savedOrientations, pDocShell->GetModel(), *pD );
+        }
 
         // import change tracking data
         XclImpChangeTrack aImpChTr( GetRoot(), maStrm );
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index f6fda06..f440b05b 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -497,6 +497,28 @@ void XclImpDrawObjBase::PreProcessSdrObject( XclImpDffConverter& rDffConv, SdrOb
         }
     }
 
+    if ( GetAnchor() )
+    {
+        ScDrawObjData* pAnchor = ScDrawLayer::GetObjData( &rSdrObj, sal_True);
+        if ( pAnchor )
+        {
+            // Temporarily get start position of shape.
+            // At the end of the import we do some post processing
+            // to adjust the shape position to take into account
+            // errors between the drawing layer and the view/grid
+            pAnchor->maStart.SetRow( GetAnchor()->maFirst.mnRow );
+            pAnchor->maStart.SetCol( GetAnchor()->maFirst.mnCol );
+            pAnchor->maStart.SetTab( GetTab() );
+            XclObjAnchor tmpAnchor( *GetAnchor() );
+
+            // Calculate the start offset ( from the cell postion )
+            Rectangle withOffset = tmpAnchor.GetRect( GetRoot(), GetTab(), MAP_100TH_MM );
+            tmpAnchor.mnLX = tmpAnchor.mnTY = tmpAnchor.mnRX = tmpAnchor.mnBY = 0;
+            Rectangle noOffset =  tmpAnchor.GetRect( GetRoot(), GetTab(), MAP_100TH_MM );
+            pAnchor->maStartOffset.X() = withOffset.Left() - noOffset.Left();
+            pAnchor->maStartOffset.Y() = withOffset.Top() - noOffset.Top();
+        }
+    }
     // call virtual function for object type specific processing
     DoPreProcessSdrObj( rDffConv, rSdrObj );
 }
-- 
1.7.3.4


--------------060806050201050307000309
Content-Type: text/plain; charset=UTF-8;
 name="0001-fix-bad-import-positions-of-shapes-controls-fdo-4943.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0001-fix-bad-import-positions-of-shapes-controls-fdo-4943.pa";
 filename*1="tch"



More information about the LibreOffice mailing list