Author: leidb
Date: Mon Sep 10 05:45:43 2012
New Revision: 1382645

URL: http://svn.apache.org/viewvc?rev=1382645&view=rev
Log:
#119549# fix Position of drawing obj incorrect 
 * when opening .doc in AOO, if the text direction of the whole document is 
vertical, the pos of the drawing obj will be wrong.
Reported by: Lou Qing le
Patch by: Chen Zuo Jun
Review by: Lei De Bin 

Modified:
    incubator/ooo/trunk/main/sw/source/filter/ww8/ww8graf.cxx

Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/ww8graf.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/ww8graf.cxx?rev=1382645&r1=1382644&r2=1382645&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/ww8graf.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/ww8graf.cxx Mon Sep 10 
05:45:43 2012
@@ -2234,6 +2234,7 @@ RndStdIds SwWW8ImplReader::ProcessEscher
     ASSERT(pRecord || pFSPA, "give me something! to work with for anchoring");
     if (!pRecord && !pFSPA)
         return FLY_AT_PAGE;
+       sal_Bool bCurSectionVertical = 
maSectionManager.CurrentSectionIsVertical();
 
     SvxMSDffImportRec aRecordFromFSPA;
     if (!pRecord)
@@ -2269,7 +2270,7 @@ RndStdIds SwWW8ImplReader::ProcessEscher
         // is a hint that these values aren't set by the escher import - see
         // method <SwMSDffManager::ProcessObj(..)>. Then, check if for each
         // values, if it differs from the one in the FSPA.
-        if ( pRecord->nXRelTo == 2 && pRecord->nYRelTo == 2 )
+        if ( pRecord->nXRelTo == 2 && pRecord->nYRelTo == 2 && 
!bCurSectionVertical)
         {
             // if <nYRelTo> differs from <FSPA.nby> overwrite <nYRelTo>
             if ( pFSPA->nby != pRecord->nYRelTo )
@@ -2408,11 +2409,6 @@ RndStdIds SwWW8ImplReader::ProcessEscher
         }
         // <--
 
-        SwFmtHoriOrient aHoriOri(MakeSafePositioningValue(pFSPA->nXaLeft),
-            eHoriOri, eHoriRel);
-        if( 4 <= nXAlign )
-            aHoriOri.SetPosToggle(true);
-        rFlySet.Put( aHoriOri );
 
         //Writer honours this wrap distance when aligned as "left" or "right",
         //Word doesn't. Writer doesn't honour it when its "from left".
@@ -2424,6 +2420,8 @@ RndStdIds SwWW8ImplReader::ProcessEscher
         sal_Int16 eVertRel;
         // OD 14.10.2003 #i18732#
         eVertRel = aVertRelOriTab[  nYRelTo ];
+               if ( bCurSectionVertical && nYRelTo == 2 )
+                       eVertRel = text::RelOrientation::PAGE_PRINT_AREA;
         // CMC, OD 24.11.2003 #i22673# - fill <eVertOri> in dependence of 
<eVertRel>
         sal_Int16 eVertOri;
         if ( eVertRel == text::RelOrientation::TEXT_LINE )
@@ -2442,8 +2440,16 @@ RndStdIds SwWW8ImplReader::ProcessEscher
         if ((eVertRel == text::RelOrientation::TEXT_LINE) && (eVertOri == 
text::VertOrientation::NONE))
             nYPos = -nYPos;
 
-        rFlySet.Put(SwFmtVertOrient(MakeSafePositioningValue(nYPos),
-            eVertOri, eVertRel));
+               SwFmtHoriOrient aHoriOri(MakeSafePositioningValue(      
bCurSectionVertical ? nYPos : pFSPA->nXaLeft ),
+                                                                               
                                        bCurSectionVertical ? eVertOri : 
eHoriOri, 
+                                                                               
                                        bCurSectionVertical ? eVertRel : 
eHoriRel);
+               if( 4 <= nXAlign )
+                   aHoriOri.SetPosToggle(true);
+               rFlySet.Put( aHoriOri );
+
+        rFlySet.Put(SwFmtVertOrient(MakeSafePositioningValue( 
!bCurSectionVertical ? nYPos : -pFSPA->nXaRight ),
+                                                                               
                                                !bCurSectionVertical ? eVertOri 
: eHoriOri, 
+                                                                               
                                                !bCurSectionVertical ? eVertRel 
: eHoriRel ));
 
         if (
             (pFSPA->nYaTop < 0) && (eVertOri == text::VertOrientation::NONE) &&


Reply via email to