Index: inc/anchoredobjectposition.hxx =================================================================== --- inc/anchoredobjectposition.hxx (revision 274311) +++ inc/anchoredobjectposition.hxx (working copy) @@ -86,12 +86,14 @@ void _GetInfoAboutObj(); // --> OD 2006-03-15 #i62875# - SwTwips _ImplAdjustVertRelPos( const SwTwips _nTopOfAnch, - const bool _bVert, - const SwFrm& _rPageAlignLayFrm, - const SwTwips _nProposedRelPosY, - const bool _bFollowTextFlow, - const bool _bCheckBottom = true ) const; + // --> OD 2009-09-01 #mongolianlayout# - add parameter + SwTwips _ImplAdjustVertRelPos( const SwTwips nTopOfAnch, + const bool bVert, + const bool bVertL2R, + const SwFrm& rPageAlignLayFrm, + const SwTwips nProposedRelPosY, + const bool bFollowTextFlow, + const bool bCheckBottom = true ) const; SwTwips _ImplAdjustHoriRelPos( const SwFrm& _rPageAlignLayFrm, const SwTwips _nProposedRelPosX ) const; // <-- @@ -173,53 +175,59 @@ /** adjust calculated vertical in order to keep object inside 'page' alignment layout frame. - OD 2004-07-22 #i31805# - add parameter <_bCheckBottom> - OD 2004-10-08 #i26945# - add parameter <_bFollowTextFlow> + OD 2004-07-22 #i31805# - add parameter + OD 2004-10-08 #i26945# - add parameter OD 2006-03-15 #i62875# - made inline, intrinsic actions moved to private method <_ImplAdjustVertRelPos>, which is only called, if not set. + OD 2009-09-01 #mongolianlayout# - add parameter - @param _nTopOfAnch + @param nTopOfAnch input parameter - 'vertical' position, at which the relative position of the object is calculated from. - @param _bVert + @param bVert input parameter - boolean, indicating, if object is in vertical layout. - @param _rPageAlignLayFrm + @param bVertL2R + input parameter - boolean, indicating, if object is in mongolian + layout (vertical left-to-right layout). + + @param rPageAlignLayFrm input parameter - layout frame, which determines the 'page area' the object has to be vertical positioned in. - @param _nProposedRelPosY + @param nProposedRelPosY input parameter - proposed relative vertical position, which will be adjusted. - @param _bFollowTextFlow + @param bFollowTextFlow input parameter - value of attribute 'Follow text flow' of the anchored object. - @param _bCheckBottom + @param bCheckBottom input parameter - boolean indicating, if bottom of anchored object has to be checked and thus, (if needed) the proposed relative position has to be adjusted. default value @author OD */ - inline SwTwips _AdjustVertRelPos( const SwTwips _nTopOfAnch, - const bool _bVert, - const SwFrm& _rPageAlignLayFrm, - const SwTwips _nProposedRelPosY, - const bool _bFollowTextFlow, - const bool _bCheckBottom = true ) const + inline SwTwips _AdjustVertRelPos( const SwTwips nTopOfAnch, + const bool bVert, + const bool bVertL2R, + const SwFrm& rPageAlignLayFrm, + const SwTwips nProposedRelPosY, + const bool bFollowTextFlow, + const bool bCheckBottom = true ) const { return !mbDoNotCaptureAnchoredObj - ? _ImplAdjustVertRelPos( _nTopOfAnch, _bVert, - _rPageAlignLayFrm, - _nProposedRelPosY, - _bFollowTextFlow, - _bCheckBottom ) - : _nProposedRelPosY; + ? _ImplAdjustVertRelPos( nTopOfAnch, bVert, bVertL2R, + rPageAlignLayFrm, + nProposedRelPosY, + bFollowTextFlow, + bCheckBottom ) + : nProposedRelPosY; } // ********************************************************************* Index: objectpositioning/anchoredobjectposition.cxx =================================================================== --- objectpositioning/anchoredobjectposition.cxx (revision 274311) +++ objectpositioning/anchoredobjectposition.cxx (working copy) @@ -379,8 +379,11 @@ case text::VertOrientation::TOP: { //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin - nRelPosY += bVert ? ( bVertL2R ? - _rLRSpacing.GetLeft() : _rLRSpacing.GetRight() ) : _rULSpacing.GetUpper(); + nRelPosY += bVert + ? ( bVertL2R + ? _rLRSpacing.GetLeft() + : _rLRSpacing.GetRight() ) + : _rULSpacing.GetUpper(); } break; case text::VertOrientation::CENTER: @@ -392,8 +395,11 @@ { //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin nRelPosY += nAlignAreaHeight - - (nObjHeight + ( bVert ? ( bVertL2R ? - _rLRSpacing.GetRight() : _rLRSpacing.GetLeft() ) : _rULSpacing.GetLower())); + ( nObjHeight + ( bVert + ? ( bVertL2R + ? _rLRSpacing.GetRight() + : _rLRSpacing.GetLeft() ) + : _rULSpacing.GetLower() ) ); } break; default: @@ -412,21 +418,23 @@ /** adjust calculated vertical in order to keep object inside 'page' alignment layout frame. - OD 2004-07-01 #i28701# - parameter <_nTopOfAnch> and <_bVert> added - OD 2004-07-22 #i31805# - add parameter <_bCheckBottom> - OD 2004-10-08 #i26945# - add parameter <_bFollowTextFlow> + OD 2004-07-01 #i28701# - parameter and added + OD 2004-07-22 #i31805# - add parameter + OD 2004-10-08 #i26945# - add parameter OD 2006-03-15 #i62875# - method now private and renamed. + OD 2009-09-01 #mongolianlayout# - add parameter @author OD */ -SwTwips SwAnchoredObjectPosition::_ImplAdjustVertRelPos( const SwTwips _nTopOfAnch, - const bool _bVert, - const SwFrm& _rPageAlignLayFrm, - const SwTwips _nProposedRelPosY, - const bool _bFollowTextFlow, - const bool _bCheckBottom ) const +SwTwips SwAnchoredObjectPosition::_ImplAdjustVertRelPos( const SwTwips nTopOfAnch, + const bool bVert, + const bool bVertL2R, + const SwFrm& rPageAlignLayFrm, + const SwTwips nProposedRelPosY, + const bool bFollowTextFlow, + const bool bCheckBottom ) const { - SwTwips nAdjustedRelPosY = _nProposedRelPosY; + SwTwips nAdjustedRelPosY = nProposedRelPosY; const Size aObjSize( GetAnchoredObj().GetObjRect().SSize() ); @@ -443,57 +451,67 @@ // --> OD 2004-10-08 #i26945# - no extension of restricted area, if // object's attribute follow text flow is set and its inside a table if ( GetFrmFmt().getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) && - ( !_bFollowTextFlow || + ( !bFollowTextFlow || !GetAnchoredObj().GetAnchorFrm()->IsInTab() ) ) { - aPgAlignArea = _rPageAlignLayFrm.FindPageFrm()->Frm(); + aPgAlignArea = rPageAlignLayFrm.FindPageFrm()->Frm(); } else { - aPgAlignArea = _rPageAlignLayFrm.Frm(); + aPgAlignArea = rPageAlignLayFrm.Frm(); } } - if ( _bVert ) + if ( bVert ) { - // OD 2004-07-22 #i31805# - consider value of <_bCheckBottom> - if ( _bCheckBottom && - _nTopOfAnch - nAdjustedRelPosY - aObjSize.Width() < + // --> OD 2009-09-01 #mongolianlayout# + if ( !bVertL2R ) + // <-- + { + if ( bCheckBottom && + nTopOfAnch - nAdjustedRelPosY - aObjSize.Width() < aPgAlignArea.Left() ) { nAdjustedRelPosY = aPgAlignArea.Left() + - _nTopOfAnch - + nTopOfAnch - aObjSize.Width(); } - // --> OD 2004-08-13 #i32964# - correction - if ( _nTopOfAnch - nAdjustedRelPosY > aPgAlignArea.Right() ) + if ( nTopOfAnch - nAdjustedRelPosY > aPgAlignArea.Right() ) { - nAdjustedRelPosY = _nTopOfAnch - aPgAlignArea.Right(); + nAdjustedRelPosY = nTopOfAnch - aPgAlignArea.Right(); } + } + // --> OD 2009-09-01 #mongolianlayout# + else + { + if ( bCheckBottom && + nTopOfAnch + nAdjustedRelPosY + aObjSize.Width() > + aPgAlignArea.Right() ) + { + nAdjustedRelPosY = aPgAlignArea.Right() - + nTopOfAnch - + aObjSize.Width(); + } + if ( nTopOfAnch + nAdjustedRelPosY < aPgAlignArea.Left() ) + { + nAdjustedRelPosY = aPgAlignArea.Left() - nTopOfAnch; + } + } // <-- } else { - // OD 2004-07-22 #i31805# - consider value of <_bCheckBottom> - if ( _bCheckBottom && - _nTopOfAnch + nAdjustedRelPosY + aObjSize.Height() > - // --> OD 2006-01-13 #129959# - // Do not mix usage of and -// aPgAlignArea.Bottom() ) + if ( bCheckBottom && + nTopOfAnch + nAdjustedRelPosY + aObjSize.Height() > aPgAlignArea.Top() + aPgAlignArea.Height() ) - // <-- { - // --> OD 2006-01-13 #129959# - // Do not mix usage of and -// nAdjustedRelPosY = aPgAlignArea.Bottom() - nAdjustedRelPosY = aPgAlignArea.Top() + aPgAlignArea.Height() - - // <-- - _nTopOfAnch - + nTopOfAnch - aObjSize.Height(); } - if ( _nTopOfAnch + nAdjustedRelPosY < aPgAlignArea.Top() ) + if ( nTopOfAnch + nAdjustedRelPosY < aPgAlignArea.Top() ) { - nAdjustedRelPosY = aPgAlignArea.Top() - _nTopOfAnch; + nAdjustedRelPosY = aPgAlignArea.Top() - nTopOfAnch; } } Index: objectpositioning/tolayoutanchoredobjectposition.cxx =================================================================== --- objectpositioning/tolayoutanchoredobjectposition.cxx (revision 274311) +++ objectpositioning/tolayoutanchoredobjectposition.cxx (working copy) @@ -212,7 +212,9 @@ // --> OD 2004-06-17 #i26791# - determine offset to 'horizontal' frame // anchor position, depending on layout-direction //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin - if( bVert && !bVertL2R ) + // --> OD 2009-09-04 #mongolianlayout# + if( bVert || bVertL2R ) + // <-- { aRelPos.Y() = nRelPosX; Index: objectpositioning/tocntntanchoredobjectposition.cxx =================================================================== --- objectpositioning/tocntntanchoredobjectposition.cxx (revision 274311) +++ objectpositioning/tocntntanchoredobjectposition.cxx (working copy) @@ -273,10 +273,20 @@ // determine relative vertical position SwTwips nRelPosY = nAlignAreaOffset; - SwTwips nObjHeight = (aObjBoundRect.*fnRect->fnGetHeight)(); + const SwTwips nObjHeight = (aObjBoundRect.*fnRect->fnGetHeight)(); //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin - SwTwips nUpperSpace = bVert ? ( bVertL2R ? rLR.GetLeft() : rLR.GetRight() ) : rUL.GetUpper(); - SwTwips nLowerSpace = bVert ? rLR.GetLeft() : rUL.GetLower(); + const SwTwips nUpperSpace = bVert + ? ( bVertL2R + ? rLR.GetLeft() + : rLR.GetRight() ) + : rUL.GetUpper(); + // --> OD 2009-08-31 #monglianlayout# + const SwTwips nLowerSpace = bVert + ? ( bVertL2R + ? rLR.GetLeft() + : rLR.GetRight() ) + : rUL.GetLower(); + // <-- switch ( aVert.GetVertOrient() ) { case text::VertOrientation::CHAR_BOTTOM: @@ -287,7 +297,9 @@ nRelPosY += nAlignAreaHeight + nUpperSpace; //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin if ( bVert && !bVertL2R) + { nRelPosY += nObjHeight; + } break; } } @@ -409,7 +421,7 @@ aEnvOfObj.GetVertEnvironmentLayoutFrm( *(pOrientFrm->GetUpper()) ); const bool bCheckBottom = !DoesObjFollowsTextFlow(); - nRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, + nRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, bVertL2R, rVertEnvironLayFrm, nRelPosY, DoesObjFollowsTextFlow(), bCheckBottom ); @@ -591,7 +603,7 @@ // anchored object would fit into environment layout frame, if // anchored object has to follow the text flow. const bool bCheckBottom = !DoesObjFollowsTextFlow(); - nRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, + nRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, bVertL2R, rVertEnvironLayFrm, nRelPosY, DoesObjFollowsTextFlow(), bCheckBottom ); @@ -632,7 +644,7 @@ // anchored object would fit into environment layout // frame, if anchored object has to follow the text flow. const bool bCheckBottom = !DoesObjFollowsTextFlow(); - nTmpRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, + nTmpRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, bVertL2R, rVertEnvironLayFrm, nTmpRelPosY, DoesObjFollowsTextFlow(), @@ -721,7 +733,7 @@ // align at 'page areas', but stay inside given environment const SwFrm& rVertEnvironLayFrm = aEnvOfObj.GetVertEnvironmentLayoutFrm( *pUpperOfOrientFrm ); - nRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, + nRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, bVertL2R, rVertEnvironLayFrm, nRelPosY, DoesObjFollowsTextFlow() ); @@ -742,12 +754,22 @@ const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrmForVertPos, fnRect, bVert ); if( bVert ) { + // --> OD 2009-08-31 #monglianlayout# + if ( !bVertL2R ) + { GetAnchoredObj().SetObjLeft( nTopOfAnch - ( aRelPos.X() - nRelDiff ) - aObjBoundRect.Width() ); } else { + GetAnchoredObj().SetObjLeft( nTopOfAnch + + ( aRelPos.X() - nRelDiff ) ); + } + // <-- + } + else + { GetAnchoredObj().SetObjTop( nTopOfAnch + ( aRelPos.Y() - nRelDiff ) ); } @@ -835,7 +857,7 @@ nTmpRelPosY = aRelPos.Y() + nDist; const SwLayoutFrm& rVertEnvironLayFrm = aEnvOfObj.GetVertEnvironmentLayoutFrm( *pUpperOfOrientFrm ); - nTmpRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, + nTmpRelPosY = _AdjustVertRelPos( nTopOfAnch, bVert, bVertL2R, rVertEnvironLayFrm, nTmpRelPosY, DoesObjFollowsTextFlow(), @@ -843,12 +865,21 @@ if ( bVert ) { aRelPos.X() = nTmpRelPosY; + // --> OD 2009-08-31 #mongolianlayout# + if ( !bVertL2R ) + { GetAnchoredObj().SetObjLeft( nTopOfAnch - aRelPos.X() - aObjBoundRect.Width() ); } else { + GetAnchoredObj().SetObjLeft( nTopOfAnch + aRelPos.X() ); + } + // <-- + } + else + { aRelPos.Y() = nTmpRelPosY; GetAnchoredObj().SetObjTop( nTopOfAnch + aRelPos.Y() ); } @@ -925,10 +956,22 @@ SWREFRESHFN( pUpperOfOrientFrm ) bMoveable = rAnchorTxtFrm.IsMoveable( (SwLayoutFrm*)pUpperOfOrientFrm ); if( bVertX ) + { + // --> OD 2009-08-31 #mongolianlayout# + if ( !bVertL2R ) + { GetAnchoredObj().SetObjLeft( nTopOfAnch - aRelPos.X() - aObjBoundRect.Width() ); + } else + { + GetAnchoredObj().SetObjLeft( nTopOfAnch + + aRelPos.X() ); + } + // <-- + } + else GetAnchoredObj().SetObjTop( nTopOfAnch + aRelPos.Y() ); nDist = (GetAnchoredObj().GetObjRect().*fnRect->fnBottomDist)( @@ -979,9 +1022,20 @@ // frame, the horizontal position is oriented at. const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrmForVertPos, fnRect, bVert ); if( bVert ) + { + // --> OD 2009-08-31 #mongolianlayout# + if ( !bVertL2R ) + { GetAnchoredObj().SetObjLeft( nTopOfAnch - aRelPos.X() - aObjBoundRect.Width() ); + } else + { + GetAnchoredObj().SetObjLeft( nTopOfAnch + aRelPos.X() ); + } + // <-- + } + else GetAnchoredObj().SetObjTop( nTopOfAnch + aRelPos.Y() ); // determine frame, horizontal position is oriented at. @@ -1030,8 +1084,17 @@ const SwTwips nTopOfAnch = _GetTopForObjPos( *pAnchorFrmForVertPos, fnRect, bVert ); if( bVert ) { + // --> OD 2009-08-31 #mongolianlayout# + if ( !bVertL2R ) + { GetAnchoredObj().SetObjLeft( nTopOfAnch - aRelPos.X() - aObjBoundRect.Width() ); + } + else + { + GetAnchoredObj().SetObjLeft( nTopOfAnch + aRelPos.X() ); + } + // <-- GetAnchoredObj().SetObjTop( rAnchorTxtFrm.Frm().Top() + aRelPos.Y() ); }