From 979c4753831eec5e05df685880cc2052bea64307 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Fri, 12 Oct 2012 11:57:07 +0200 Subject: improve showing the condition text when the entry is collapsed Change-Id: I298f80c9df39156f950880a530076e0b0edf27b5 --- sc/source/ui/condformat/condformatdlgentry.cxx | 4 ++-- sc/source/ui/condformat/condformathelper.cxx | 19 +++++++++++++++++-- sc/source/ui/inc/condformathelper.hxx | 3 ++- 3 files changed, 21 insertions(+), 5 deletions(-) (limited to 'sc/source') diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 646f928a4b01..58f59bb18940 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -289,7 +289,7 @@ ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const rtl::OUString ScConditionFrmtEntry::GetExpressionString() { - return ScCondFormatHelper::GetExpression(CONDITION, maLbCondType.GetSelectEntryPos()); + return ScCondFormatHelper::GetExpression(CONDITION, maLbCondType.GetSelectEntryPos(), maEdVal1.GetText(), maEdVal2.GetText()); } ScFormatEntry* ScConditionFrmtEntry::GetEntry() const @@ -483,7 +483,7 @@ ScFormatEntry* ScFormulaFrmtEntry::GetEntry() const rtl::OUString ScFormulaFrmtEntry::GetExpressionString() { - return ScCondFormatHelper::GetExpression(FORMULA, 0); + return ScCondFormatHelper::GetExpression(FORMULA, 0, maEdFormula.GetText()); } void ScFormulaFrmtEntry::SetActive() diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx index 1ec8607759dc..1f658e326456 100644 --- a/sc/source/ui/condformat/condformathelper.cxx +++ b/sc/source/ui/condformat/condformathelper.cxx @@ -91,7 +91,7 @@ rtl::OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rForm aBuffer.append(rtl::OUString(" and ")); aBuffer.append(pEntry->GetExpression(rPos, 1)); } - else + else if(eMode <= SC_COND_NOTEQUAL) { aBuffer.append(pEntry->GetExpression(rPos, 0)); } @@ -110,12 +110,27 @@ rtl::OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rForm return aBuffer.makeStringAndClear(); } -rtl::OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex ) +rtl::OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex, + rtl::OUString aStr1, rtl::OUString aStr2 ) { rtl::OUStringBuffer aBuffer(getTextForType(eType)); aBuffer.append(rtl::OUString(" ")); if(eType == CONDITION) + { aBuffer.append(getExpression(nIndex)); + if(nIndex <= 7) + { + aBuffer.append(" ").append(aStr1); + if(nIndex == 6 || nIndex == 7) + { + aBuffer.append(" and ").append(aStr2); + } + } + } + else if(eType == FORMULA) + { + aBuffer.append(" ").append(aStr1); + } return aBuffer.makeStringAndClear(); } diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx index 48c269de0bd6..297d032d88ad 100644 --- a/sc/source/ui/inc/condformathelper.hxx +++ b/sc/source/ui/inc/condformathelper.hxx @@ -26,7 +26,8 @@ class ScCondFormatHelper public: static SC_DLLPUBLIC rtl::OUString GetExpression(const ScConditionalFormat& rFormat, const ScAddress& rPos); - static SC_DLLPUBLIC rtl::OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex ); + static SC_DLLPUBLIC rtl::OUString GetExpression( ScCondFormatEntryType eType, sal_Int32 nIndex, + rtl::OUString aStr1 = rtl::OUString(), rtl::OUString aStr2 = rtl::OUString() ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit