[Libreoffice-commits] core.git: 2 commits - sc/source

abdulmajeed ahmed aalabdulrazzaq at kacst.edu.sa
Fri May 31 01:28:13 PDT 2013


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

New commits:
commit 4e673dbb5b7c7f0fd48d50255d10340229a33ade
Author: abdulmajeed ahmed <aalabdulrazzaq at kacst.edu.sa>
Date:   Fri May 31 10:26:13 2013 +0200

    Code clean up
    
    Change-Id: I0e75478e4cb98409210ca40dcaa4676a69c30f6c

diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 7bfcf4e..33432fa 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -140,19 +140,19 @@ public:
     void SetTextToWidthOrHash( ScRefCellValue& rCell, long nWidth );
     void        SetAutoText( const String& rAutoText );
 
-    const ScPatternAttr*    GetPattern() const      { return pPattern; }
-    SvxCellOrientation      GetOrient() const       { return eAttrOrient; }
-    SvxCellHorJustify       GetHorJust() const      { return eAttrHorJust; }
-    SvxCellVerJustify       GetVerJust() const      { return eAttrVerJust; }
+    const ScPatternAttr*    GetPattern() const       { return pPattern; }
+    SvxCellOrientation      GetOrient() const        { return eAttrOrient; }
+    SvxCellHorJustify       GetHorJust() const       { return eAttrHorJust; }
+    SvxCellVerJustify       GetVerJust() const       { return eAttrVerJust; }
     SvxCellJustifyMethod    GetHorJustMethod() const { return eAttrHorJustMethod; }
     SvxCellJustifyMethod    GetVerJustMethod() const { return eAttrVerJustMethod; }
-    const SvxMarginItem*    GetMargin() const       { return pMargin; }
+    const SvxMarginItem*    GetMargin() const        { return pMargin; }
 
     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; }
+    const String&           GetString() const        { return aString; }
+    const Size&             GetTextSize() const      { return aTextSize; }
     long                    GetOriginalWidth() const { return nOriginalWidth; }
 
     sal_uLong GetResultValueFormat( const ScRefCellValue& rCell ) const;
commit af169a601dee381b17d1e87c346f2d97bad9a69f
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

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