Index: sw/source/filter/ww8/ww8graf.cxx =================================================================== RCS file: /cvs/sw/sw/source/filter/ww8/ww8graf.cxx,v retrieving revision 1.124 diff -u -r1.124 ww8graf.cxx --- sw/source/filter/ww8/ww8graf.cxx 16 Nov 2004 15:56:03 -0000 1.124 +++ sw/source/filter/ww8/ww8graf.cxx 19 Dec 2004 08:30:24 -0000 @@ -2397,6 +2397,7 @@ Strangely in this case the FSPA value seems to be considered before the newer escher nXRelTo record. */ + /* if ( ((pRecord->nXRelTo == 2) && (pFSPA->nbx != pRecord->nXRelTo)) && ((pRecord->nYRelTo == 2) && (pFSPA->nby != pRecord->nYRelTo)) @@ -2405,6 +2406,7 @@ pRecord->nXRelTo = pFSPA->nbx; pRecord->nYRelTo = pFSPA->nby; } + */ } UINT32 nXRelTo = nCntRelTo > pRecord->nXRelTo ? pRecord->nXRelTo : 1; @@ -2485,6 +2487,7 @@ eHoriRel = aHoriRelOriTab[ nXRelTo ]; //#111875# + /* if ((eHoriRel == REL_PG_FRAME) && (eHoriOri == HORI_RIGHT)) { eHoriRel = REL_FRM_RIGHT; @@ -2492,8 +2495,10 @@ pFSPA->nXaRight -= pFSPA->nXaLeft; pFSPA->nXaLeft = 0; } + */ //#109311# Miserable miserable hack. + /* if (!bDrawingHacks) { //#109311# Miserable miserable hack. @@ -2504,6 +2509,69 @@ pFSPA->nXaRight = pFSPA->nXaLeft + nWidth; } } + */ + long nObjWidth = (pFSPA->nXaRight - pFSPA->nXaLeft); + switch (eHoriOri) + { + case HORI_NONE: // Absolute positioning in MS Word + { + switch (eHoriRel) + { + case REL_PG_PRTAREA: // "Margin" in MS Word + { + if(IsRightToLeft()) + { + pFSPA->nXaLeft = maSectionManager.GetTextAreaWidth() - pFSPA->nXaRight; + pFSPA->nXaRight = pFSPA->nXaLeft + nObjWidth; + } + } + break; + case REL_CHAR: // "Character" in MS Word + { + if(IsRightToLeft()) + pFSPA->nXaLeft -= maSectionManager.GetTextAreaWidth(); + } + break; + case REL_PG_FRAME: // "Page" in MS Word + { + if(IsRightToLeft()) + { + pFSPA->nXaLeft = maSectionManager.GetPageWidth() - pFSPA->nXaRight; + pFSPA->nXaRight = pFSPA->nXaLeft + nObjWidth; + } + } + break; + case FRAME: // "Column" in MS Word + { + if(IsRightToLeft()) + pFSPA->nXaLeft = maSectionManager.GetTextAreaWidth() - pFSPA->nXaRight; + } + break; + } + } + break; + case HORI_LEFT: + break; + case HORI_CENTER: + { + if(eHoriRel == REL_CHAR) + { + if(!IsRightToLeft()) + pFSPA->nXaLeft = maSectionManager.GetPageLeft() - (nObjWidth/2); + else + pFSPA->nXaLeft = maSectionManager.GetPageWidth() - maSectionManager.GetPageRight() - (nObjWidth/2); + pFSPA->nXaRight = pFSPA->nXaLeft + nObjWidth; + } + } + break; + case HORI_RIGHT: + break; + case HORI_INSIDE: + break; + case HORI_OUTSIDE: + eHoriOri = HORI_RIGHT; + break; + } SwFmtHoriOrient aHoriOri(MakeSafePositioningValue(pFSPA->nXaLeft), eHoriOri, eHoriRel); Index: sw/source/core/objectpositioning/anchoredobjectposition.cxx =================================================================== RCS file: /cvs/sw/sw/source/core/objectpositioning/anchoredobjectposition.cxx,v retrieving revision 1.9 diff -u -r1.9 anchoredobjectposition.cxx --- sw/source/core/objectpositioning/anchoredobjectposition.cxx 16 Nov 2004 15:50:58 -0000 1.9 +++ sw/source/core/objectpositioning/anchoredobjectposition.cxx 19 Dec 2004 08:30:25 -0000 @@ -857,10 +857,17 @@ SWRECTFN( (&_rHoriOrientFrm) ) SwTwips nObjWidth = (GetAnchoredObj().GetObjRect().*fnRect->fnGetWidth)(); SwTwips nRelPosX = nOffset; + + const SwFrm& rEnvironmentLayoutFrame = _rEnvOfObj.GetHoriEnvironmentLayoutFrm( _rHoriOrientFrm, false ); + long pageLeft = rAnchorFrm.Frm().Left() - rEnvironmentLayoutFrame.Frm().Left(); + long pageRight = rEnvironmentLayoutFrame.Frm().Right() - rAnchorFrm.Frm().Right(); + long pageWidth = rEnvironmentLayoutFrame.Frm().Right() - rEnvironmentLayoutFrame.Frm().Left(); + bool bSkipAdjustment = false; + const bool bR2L = rAnchorFrm.IsRightToLeft(); + if ( _rHoriOrient.GetHoriOrient() == HORI_NONE ) { // 'manual' horizonal position - const bool bR2L = rAnchorFrm.IsRightToLeft(); if( IsAnchoredToChar() && REL_CHAR == eRelOrient ) { if( bR2L ) @@ -880,11 +887,32 @@ } } else if ( HORI_CENTER == eHoriOrient ) - nRelPosX += (nWidth / 2) - (nObjWidth / 2); + { + if(eRelOrient == REL_CHAR) + { + bSkipAdjustment = true; + if(!bR2L) + nRelPosX = -(nObjWidth / 2); + else + nRelPosX = pageWidth - (pageLeft + pageRight) - (nObjWidth / 2); + } + else + nRelPosX += (nWidth / 2) - (nObjWidth / 2); + } else if ( HORI_RIGHT == eHoriOrient ) + { nRelPosX += nWidth - ( nObjWidth + ( bVert ? _rULSpacing.GetLower() : _rLRSpacing.GetRight() ) ); + } + else if(HORI_LEFT == eHoriOrient && eRelOrient == REL_CHAR) + { + bSkipAdjustment = true; + if(!bR2L) + nRelPosX = 0; + else + nRelPosX = pageWidth - (pageLeft + pageRight); + } else nRelPosX += bVert ? _rULSpacing.GetUpper() : _rLRSpacing.GetLeft(); @@ -935,7 +963,8 @@ // keep object inside 'page' alignment layout frame const SwFrm& rEnvironmentLayFrm = _rEnvOfObj.GetHoriEnvironmentLayoutFrm( _rHoriOrientFrm, false ); - nRelPosX = _AdjustHoriRelPos( rEnvironmentLayFrm, nRelPosX ); + if (!bSkipAdjustment) + nRelPosX = _AdjustHoriRelPos( rEnvironmentLayFrm, nRelPosX ); // if object is a Writer fly frame and it's anchored to a content and // it is horizontal positioned left or right, but not relative to character,