summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabdulmajeed ahmed <aalabdulrazzaq@kacst.edu.sa>2013-05-31 10:05:55 +0200
committerabdulmajeed ahmed <aalabdulrazzaq@kacst.edu.sa>2013-05-31 10:27:14 +0200
commitaf169a601dee381b17d1e87c346f2d97bad9a69f (patch)
tree0781c8c821315d8086d60dbe57bc9f24c7471a28
parentc2530b02311c46529eed53ee688bf6c83ce4b86e (diff)
Fix fdo#51835 Indent changes in Calc forces alignment to left
Change-Id: Ifef68cdd62a11b5cdc032a91a7dd96fa0357a42c
-rw-r--r--sc/source/core/data/attarray.cxx3
-rw-r--r--sc/source/ui/view/output2.cxx14
2 files changed, 12 insertions, 5 deletions
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 7ef31030722d..074424739a31 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 ef754057caaa..7bfcf4e53cf7 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(