[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sc/source

abdulmajeed ahmed aalabdulrazzaq at kacst.edu.sa
Fri May 31 12:33:00 PDT 2013


 sc/source/core/data/attarray.cxx |    3 ++-
 sc/source/ui/view/output2.cxx    |   14 ++++++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit a81f52a3367f54675c89c1fc84ca161598662bd8
Author: abdulmajeed ahmed <aalabdulrazzaq at kacst.edu.sa>
Date:   Fri May 31 10:05:55 2013 +0200

    Fix fdo#51835  Indent changes in Calc forces alignment to left
    
    Change-Id: Ifef68cdd62a11b5cdc032a91a7dd96fa0357a42c
    (cherry picked from commit af169a601dee381b17d1e87c346f2d97bad9a69f)

diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 7ef3103..0744247 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -1653,7 +1653,8 @@ void ScAttrArray::ChangeIndent( SCROW nStartRow, SCROW nEndRow, bool bIncrement
         const SfxPoolItem* pItem;
 
         bool bNeedJust = ( rOldSet.GetItemState( ATTR_HOR_JUSTIFY, false, &pItem ) != SFX_ITEM_SET
-                        || ((const SvxHorJustifyItem*)pItem)->GetValue() != SVX_HOR_JUSTIFY_LEFT );
+                           || (((const SvxHorJustifyItem*)pItem)->GetValue() != SVX_HOR_JUSTIFY_LEFT &&
+                               ((const SvxHorJustifyItem*)pItem)->GetValue() != SVX_HOR_JUSTIFY_RIGHT ));
         sal_uInt16 nOldValue = ((const SfxUInt16Item&)rOldSet.Get( ATTR_INDENT )).GetValue();
         sal_uInt16 nNewValue = nOldValue;
         if ( bIncrement )
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index ef75405..7bfcf4e 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -148,7 +148,8 @@ public:
     SvxCellJustifyMethod    GetVerJustMethod() const { return eAttrVerJustMethod; }
     const SvxMarginItem*    GetMargin() const       { return pMargin; }
 
-    sal_uInt16  GetLeftTotal() const        { return pMargin->GetLeftMargin() + nIndent; }
+    sal_uInt16              GetLeftTotal() const     { return pMargin->GetLeftMargin() + nIndent; }
+    sal_uInt16              GetRightTotal() const    { return pMargin->GetRightMargin() + nIndent; }
 
     const String&           GetString() const       { return aString; }
     const Size&             GetTextSize() const     { return aTextSize; }
@@ -422,7 +423,7 @@ void ScDrawStringsVars::SetPattern(
     //  Raender
 
     pMargin = (const SvxMarginItem*)&pPattern->GetItem( ATTR_MARGIN, pCondSet );
-    if ( eAttrHorJust == SVX_HOR_JUSTIFY_LEFT )
+    if ( eAttrHorJust == SVX_HOR_JUSTIFY_LEFT || eAttrHorJust == SVX_HOR_JUSTIFY_RIGHT )
         nIndent = ((const SfxUInt16Item&)pPattern->GetItem( ATTR_INDENT, pCondSet )).GetValue();
     else
         nIndent = 0;
@@ -1863,7 +1864,7 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
                                 break;
                             case SVX_HOR_JUSTIFY_RIGHT:
                                 nJustPosX += nAvailWidth - aVars.GetTextSize().Width() -
-                                            (long) ( aVars.GetMargin()->GetRightMargin() * mnPPTX );
+                                            (long) ( aVars.GetRightTotal() * mnPPTX );
                                 bRightAdjusted = sal_True;
                                 break;
                             case SVX_HOR_JUSTIFY_CENTER:
@@ -2376,13 +2377,18 @@ void ScOutputData::DrawEditParam::calcMargins(long& rTopM, long& rLeftM, long& r
         static_cast<const SvxMarginItem&>(mpPattern->GetItem(ATTR_MARGIN, mpCondSet));
 
     sal_uInt16 nIndent = 0;
-    if (meHorJust == SVX_HOR_JUSTIFY_LEFT)
+    if (meHorJust == SVX_HOR_JUSTIFY_LEFT || meHorJust == SVX_HOR_JUSTIFY_RIGHT)
         nIndent = lcl_GetValue<SfxUInt16Item, sal_uInt16>(*mpPattern, ATTR_INDENT, mpCondSet);
 
     rLeftM   = static_cast<long>(((rMargin.GetLeftMargin() + nIndent) * nPPTX));
     rTopM    = static_cast<long>((rMargin.GetTopMargin() * nPPTY));
     rRightM  = static_cast<long>((rMargin.GetRightMargin() * nPPTX));
     rBottomM = static_cast<long>((rMargin.GetBottomMargin() * nPPTY));
+    if(meHorJust == SVX_HOR_JUSTIFY_RIGHT)
+    {
+        rLeftM   = static_cast<long>((rMargin.GetLeftMargin()  * nPPTX));
+        rRightM  = static_cast<long>(((rMargin.GetRightMargin() + nIndent) * nPPTX));
+    }
 }
 
 void ScOutputData::DrawEditParam::calcPaperSize(


More information about the Libreoffice-commits mailing list