[Libreoffice-commits] core.git: sc/source
Michael Stahl
mstahl at redhat.com
Mon Jan 13 04:35:16 PST 2014
sc/source/ui/view/output2.cxx | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
New commits:
commit c6d5433c673f592c3fda4270df66fff6c667d021
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Jan 13 13:27:30 2014 +0100
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.
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 911cc11..9c09b5c 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;
More information about the Libreoffice-commits
mailing list