summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-01-13 13:27:30 +0100
committerMichael Stahl <mstahl@redhat.com>2014-01-13 13:27:30 +0100
commitc6d5433c673f592c3fda4270df66fff6c667d021 (patch)
treebe609fc5f8feff94a539fdd4790f8077a44827c4 /sc/source
parent2b7d8a50fe9f47d64af959aa170e47cb5c8ae5d4 (diff)
Revert "fdo#32530 calc:alignment depend on 1st char direct"
This reverts commit f08c1edc0a99e0c29fb1614162d3e88c5660e092. This commit causes sc_macros_test to fail with "Assertion `!"meHorJustResult does not match getAlignmentFromContext()"' failed." and Eike has expressed some doubts about it too so revert it for now.
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/view/output2.cxx27
1 files changed, 24 insertions, 3 deletions
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 911cc11a2671..9c09b5c9212b 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1405,9 +1405,12 @@ bool beginsWithRTLCharacter(const OUString& rStr)
right alignment is returned.
*/
static SvxCellHorJustify getAlignmentFromContext( SvxCellHorJustify eInHorJust,
- bool bCellIsValue, const OUString& rText)
+ bool bCellIsValue, const OUString& rText,
+ const ScPatternAttr& rPattern, const SfxItemSet* pCondSet,
+ const ScDocument* pDoc, SCTAB nTab )
{
SvxCellHorJustify eHorJustContext = eInHorJust;
+ bool bUseWritingDirection = false;
if (eInHorJust == SVX_HOR_JUSTIFY_STANDARD)
{
// fdo#32530: Default alignment depends on value vs
@@ -1416,6 +1419,23 @@ static SvxCellHorJustify getAlignmentFromContext( SvxCellHorJustify eInHorJust,
eHorJustContext = bCellIsValue ? SVX_HOR_JUSTIFY_LEFT : SVX_HOR_JUSTIFY_RIGHT;
else if (bCellIsValue)
eHorJustContext = SVX_HOR_JUSTIFY_RIGHT;
+ else
+ bUseWritingDirection = true;
+ }
+
+ if (bUseWritingDirection ||
+ eInHorJust == SVX_HOR_JUSTIFY_BLOCK || eInHorJust == SVX_HOR_JUSTIFY_REPEAT)
+ {
+ sal_uInt16 nDirection = lcl_GetValue<SvxFrameDirectionItem, sal_uInt16>( rPattern, ATTR_WRITINGDIR, pCondSet);
+ if (nDirection == FRMDIR_HORI_LEFT_TOP || nDirection == FRMDIR_VERT_TOP_LEFT)
+ eHorJustContext = SVX_HOR_JUSTIFY_LEFT;
+ else if (nDirection == FRMDIR_ENVIRONMENT)
+ {
+ SAL_WARN_IF( !pDoc, "sc.ui", "getAlignmentFromContext - pDoc==NULL");
+ eHorJustContext = (pDoc && pDoc->IsLayoutRTL(nTab)) ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT;
+ }
+ else
+ eHorJustContext = SVX_HOR_JUSTIFY_RIGHT;
}
return eHorJustContext;
}
@@ -1694,7 +1714,8 @@ void ScOutputData::DrawStrings( sal_Bool bPixelToLogic )
bCellIsValue = pFCell->IsRunning() || pFCell->IsValue();
}
- eOutHorJust = getAlignmentFromContext( aVars.GetHorJust(), bCellIsValue, aVars.GetString());
+ eOutHorJust = getAlignmentFromContext( aVars.GetHorJust(), bCellIsValue, aVars.GetString(),
+ *pPattern, pCondSet, mpDoc, nTab);
bool bBreak = ( aVars.GetLineBreak() || aVars.GetHorJust() == SVX_HOR_JUSTIFY_BLOCK );
// #i111387# #o11817313# disable automatic line breaks only for "General" number format
@@ -4623,7 +4644,7 @@ void ScOutputData::DrawEdit(sal_Bool bPixelToLogic)
DrawEditParam aParam(pPattern, pCondSet, lcl_SafeIsValue(aCell));
aParam.meHorJustContext = getAlignmentFromContext( aParam.meHorJustAttr,
- aParam.mbCellIsValue, aStr);
+ aParam.mbCellIsValue, aStr, *pPattern, pCondSet, mpDoc, nTab);
aParam.meHorJustResult = (aParam.meHorJustAttr == SVX_HOR_JUSTIFY_BLOCK) ?
SVX_HOR_JUSTIFY_BLOCK : aParam.meHorJustContext;
aParam.mbPixelToLogic = bPixelToLogic;