sc/inc/patattr.hxx | 3 sc/qa/extras/macros-test.cxx | 4 sc/qa/extras/testdocuments/vba_findFunction.xls |binary sc/source/core/data/patattr.cxx | 151 ++++++++++++++++--- sc/source/filter/excel/xestyle.cxx | 190 ++++++++++++++++++++++-- sc/source/filter/inc/xestyle.hxx | 27 ++- sc/source/ui/condformat/condformatdlgentry.cxx | 47 ----- sc/source/ui/vba/vbarange.cxx | 1 8 files changed, 339 insertions(+), 84 deletions(-)
New commits: commit a623d1a0e65c4fb1f72f4ce87f462e5dcd8c3c45 Author: Justin Luth <justin_l...@sil.org> Date: Tue Apr 7 19:26:17 2015 +0300 tdf#90447 vba find() should NOT select the found cell. Change-Id: Ia8c331f33bc81e7bdabeea649a47c73930dae206 diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 2c7f5b8..3bc3a94 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -229,6 +229,10 @@ void ScMacrosTest::testVba() OUString("vba_endFunction."), OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document") }, + { + OUString("vba_findFunction."), + OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document") + }, }; OUString sTempDir; OUString sTempDirURL; diff --git a/sc/qa/extras/testdocuments/vba_findFunction.xls b/sc/qa/extras/testdocuments/vba_findFunction.xls new file mode 100644 index 0000000..2ea964e Binary files /dev/null and b/sc/qa/extras/testdocuments/vba_findFunction.xls differ diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index d312d3a..7cd73f3 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -3281,7 +3281,6 @@ ScVbaRange::Find( const uno::Any& What, const uno::Any& After, const uno::Any& L uno::Reference< excel::XRange > xResultRange = new ScVbaRange( mxParent, mxContext, xCellRange ); if( xResultRange.is() ) { - xResultRange->Select(); return xResultRange; } } commit 853bfc68b93427f105d2c8c0ed959b3971861755 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Tue Apr 14 17:52:49 2015 +0200 implement a sane and working dxf font export, tdf#81918 Dxf font export needs a lot of special handling to detect which parts are set in the itemset and only export these. The old code only checked for font name, font family and text encoding and exported the whole font as dxf font in that case. The new approach just exports the necessary bits. Change-Id: Ic9a9c547723a65f26ebb6c88040a51f04f3cc42b diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx index dfba0e2..cbc37d1 100644 --- a/sc/inc/patattr.hxx +++ b/sc/inc/patattr.hxx @@ -25,6 +25,7 @@ #include <unotools/fontcvt.hxx> #include <editeng/svxenum.hxx> #include "scdllapi.h" +#include "fonthelper.hxx" namespace vcl { class Font; } class OutputDevice; @@ -87,6 +88,8 @@ public: const SfxItemSet* pCondSet = NULL, sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL, const Color* pTextConfigColor = NULL ); + + static ScDxfFont GetDxfFont(const SfxItemSet& rSet, sal_uInt8 nScript); /** Fills a font object from the own item set. */ void GetFont( vcl::Font& rFont, ScAutoFontColorMode eAutoMode, OutputDevice* pOutDev = NULL, diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index dfcfa70..878f8af 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -215,30 +215,11 @@ SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet* pCondSet return GetCellOrientation( GetItemSet(), pCondSet ); } -void ScPatternAttr::GetFont( - vcl::Font& rFont, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, - OutputDevice* pOutDev, const Fraction* pScale, - const SfxItemSet* pCondSet, sal_uInt8 nScript, - const Color* pBackConfigColor, const Color* pTextConfigColor ) -{ - // Read items - - const SvxFontItem* pFontAttr; - sal_uInt32 nFontHeight; - FontWeight eWeight; - FontItalic eItalic; - FontUnderline eUnder; - FontUnderline eOver; - bool bWordLine; - FontStrikeout eStrike; - bool bOutline; - bool bShadow; - FontEmphasisMark eEmphasis; - FontRelief eRelief; - Color aColor; - LanguageType eLang; +namespace { - sal_uInt16 nFontId, nHeightId, nWeightId, nPostureId, nLangId; +void getFontIDsByScriptType(sal_uInt8 nScript, +sal_uInt16& nFontId, sal_uInt16& nHeightId, sal_uInt16& nWeightId, sal_uInt16& nPostureId, sal_uInt16& nLangId) +{ if ( nScript == SCRIPTTYPE_ASIAN ) { nFontId = ATTR_CJK_FONT; @@ -263,6 +244,35 @@ void ScPatternAttr::GetFont( nPostureId = ATTR_FONT_POSTURE; nLangId = ATTR_FONT_LANGUAGE; } +} + +} + +void ScPatternAttr::GetFont( + vcl::Font& rFont, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode, + OutputDevice* pOutDev, const Fraction* pScale, + const SfxItemSet* pCondSet, sal_uInt8 nScript, + const Color* pBackConfigColor, const Color* pTextConfigColor ) +{ + // Read items + + const SvxFontItem* pFontAttr; + sal_uInt32 nFontHeight; + FontWeight eWeight; + FontItalic eItalic; + FontUnderline eUnder; + FontUnderline eOver; + bool bWordLine; + FontStrikeout eStrike; + bool bOutline; + bool bShadow; + FontEmphasisMark eEmphasis; + FontRelief eRelief; + Color aColor; + LanguageType eLang; + + sal_uInt16 nFontId, nHeightId, nWeightId, nPostureId, nLangId; + getFontIDsByScriptType(nScript, nFontId, nHeightId, nWeightId, nPostureId, nLangId); if ( pCondSet ) { @@ -489,6 +499,101 @@ void ScPatternAttr::GetFont( GetFont( rFont, GetItemSet(), eAutoMode, pOutDev, pScale, pCondSet, nScript, pBackConfigColor, pTextConfigColor ); } +ScDxfFont ScPatternAttr::GetDxfFont(const SfxItemSet& rItemSet, sal_uInt8 nScript) +{ + sal_uInt16 nFontId, nHeightId, nWeightId, nPostureId, nLangId; + getFontIDsByScriptType(nScript, nFontId, nHeightId, nWeightId, nPostureId, nLangId); + const SfxPoolItem* pItem; + + ScDxfFont aReturn; + + if ( rItemSet.GetItemState( nFontId, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( nFontId ); + aReturn.pFontAttr = static_cast<const SvxFontItem*>(pItem); + } + + if ( rItemSet.GetItemState( nHeightId, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( nHeightId ); + aReturn.nFontHeight = static_cast<const SvxFontHeightItem*>(pItem)->GetHeight(); + } + + if ( rItemSet.GetItemState( nWeightId, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( nWeightId ); + aReturn.eWeight = (FontWeight)static_cast<const SvxWeightItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( nPostureId, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( nPostureId ); + aReturn.eItalic = (FontItalic)static_cast<const SvxPostureItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( ATTR_FONT_UNDERLINE, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( ATTR_FONT_UNDERLINE ); + aReturn.eUnder = (FontUnderline)static_cast<const SvxUnderlineItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( ATTR_FONT_OVERLINE, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( ATTR_FONT_OVERLINE ); + aReturn.eOver = (FontUnderline)static_cast<const SvxOverlineItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( ATTR_FONT_WORDLINE, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( ATTR_FONT_WORDLINE ); + aReturn.bWordLine = static_cast<const SvxWordLineModeItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( ATTR_FONT_CROSSEDOUT, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( ATTR_FONT_CROSSEDOUT ); + aReturn.eStrike = (FontStrikeout)static_cast<const SvxCrossedOutItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( ATTR_FONT_CONTOUR, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( ATTR_FONT_CONTOUR ); + aReturn.bOutline = static_cast<const SvxContourItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( ATTR_FONT_SHADOWED, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( ATTR_FONT_SHADOWED ); + aReturn.bShadow = static_cast<const SvxShadowedItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( ATTR_FONT_EMPHASISMARK, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( ATTR_FONT_EMPHASISMARK ); + aReturn.eEmphasis = static_cast<const SvxEmphasisMarkItem*>(pItem)->GetEmphasisMark(); + } + + if ( rItemSet.GetItemState( ATTR_FONT_RELIEF, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( ATTR_FONT_RELIEF ); + aReturn.eRelief = (FontRelief)static_cast<const SvxCharReliefItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( ATTR_FONT_COLOR, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( ATTR_FONT_COLOR ); + aReturn.aColor = static_cast<const SvxColorItem*>(pItem)->GetValue(); + } + + if ( rItemSet.GetItemState( nLangId, true, &pItem ) == SfxItemState::SET ) + { + pItem = &rItemSet.Get( nLangId ); + aReturn.eLang = static_cast<const SvxLanguageItem*>(pItem)->GetLanguage(); + } + + return aReturn; +} + void ScPatternAttr::FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& rSrcSet, const SfxItemSet* pCondSet ) { // Read Items diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index f4cf4cf..e391a3f 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -37,6 +37,7 @@ #include <editeng/colritem.hxx> #include <editeng/brushitem.hxx> #include <editeng/frmdiritem.hxx> +#include <editeng/fontitem.hxx> #include <editeng/eeitem.hxx> #include <editeng/escapementitem.hxx> #include <editeng/justifyitem.hxx> @@ -872,15 +873,12 @@ sal_Int16 XclExpFontHelper::GetFirstUsedScript( const XclExpRoot& rRoot, const S return nScript; } -vcl::Font XclExpFontHelper::GetFontFromItemSet( const XclExpRoot& rRoot, const SfxItemSet& rItemSet, sal_Int16 nScript ) +namespace { + +sal_uInt8 getCoreScriptType(sal_Int16 nScript) { namespace ApiScriptType = ::com::sun::star::i18n::ScriptType; - // if WEAK is passed, guess script type from existing items in the item set - if( nScript == ApiScriptType::WEAK ) - nScript = GetFirstUsedScript( rRoot, rItemSet ); - - // convert to core script type constants sal_uInt8 nScScript = SCRIPTTYPE_LATIN; switch( nScript ) { @@ -890,12 +888,37 @@ vcl::Font XclExpFontHelper::GetFontFromItemSet( const XclExpRoot& rRoot, const S default: OSL_FAIL( "XclExpFontHelper::GetFontFromItemSet - unknown script type" ); } + return nScScript; +} + +} + +vcl::Font XclExpFontHelper::GetFontFromItemSet( const XclExpRoot& rRoot, const SfxItemSet& rItemSet, sal_Int16 nScript ) +{ + namespace ApiScriptType = ::com::sun::star::i18n::ScriptType; + + // if WEAK is passed, guess script type from existing items in the item set + if( nScript == ApiScriptType::WEAK ) + nScript = GetFirstUsedScript( rRoot, rItemSet ); + + // convert to core script type constants + sal_uInt8 nScScript = getCoreScriptType(nScript); + // fill the font object vcl::Font aFont; ScPatternAttr::GetFont( aFont, rItemSet, SC_AUTOCOL_RAW, 0, 0, 0, nScScript ); return aFont; } +ScDxfFont XclExpFontHelper::GetDxfFontFromItemSet(const XclExpRoot& rRoot, const SfxItemSet& rItemSet) +{ + sal_Int16 nScript = GetFirstUsedScript(rRoot, rItemSet); + + // convert to core script type constants + sal_uInt8 nScScript = getCoreScriptType(nScript); + return ScPatternAttr::GetDxfFont(rItemSet, nScScript); +} + bool XclExpFontHelper::CheckItems( const XclExpRoot& rRoot, const SfxItemSet& rItemSet, sal_Int16 nScript, bool bDeep ) { static const sal_uInt16 pnCommonIds[] = { @@ -1006,6 +1029,151 @@ void XclExpFont::WriteBody( XclExpStream& rStrm ) << aFontName; } +XclExpDxfFont::XclExpDxfFont(const XclExpRoot& rRoot, + const SfxItemSet& rItemSet): + XclExpRoot(rRoot) +{ + maDxfData = XclExpFontHelper::GetDxfFontFromItemSet(rRoot, rItemSet); +} + +namespace { + +const char* getUnderlineOOXValue(FontUnderline eUnderline) +{ + switch (eUnderline) + { + case UNDERLINE_NONE: + case UNDERLINE_DONTKNOW: + return "none"; + case UNDERLINE_DOUBLE: + case UNDERLINE_DOUBLEWAVE: + return "double"; + default: + return "single"; + } +} + +const char* getFontFamilyOOXValue(FontFamily eValue) +{ + switch (eValue) + { + case FAMILY_DONTKNOW: + return "0"; + break; + case FAMILY_SWISS: + case FAMILY_SYSTEM: + return "2"; + case FAMILY_ROMAN: + return "1"; + case FAMILY_SCRIPT: + return "4"; + case FAMILY_MODERN: + return "3"; + case FAMILY_DECORATIVE: + return "5"; + default: + return "0"; + } +} + +} + +void XclExpDxfFont::SaveXml(XclExpXmlStream& rStrm) +{ + if (maDxfData.isEmpty()) + return; + + sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream(); + rStyleSheet->startElement(XML_font, FSEND); + + if (maDxfData.pFontAttr) + { + OUString aFontName = (*maDxfData.pFontAttr)->GetFamilyName(); + if (!aFontName.isEmpty()) + { + rStyleSheet->singleElement(XML_name, + XML_val, XclXmlUtils::ToOString(aFontName).getStr(), + FSEND); + } + + rtl_TextEncoding eTextEnc = (*maDxfData.pFontAttr)->GetCharSet(); + sal_uInt8 nExcelCharSet = rtl_getBestWindowsCharsetFromTextEncoding(eTextEnc); + if (nExcelCharSet) + { + rStyleSheet->singleElement(XML_charset, + XML_val, OString::number(nExcelCharSet).getStr(), + FSEND); + } + + FontFamily eFamily = (*maDxfData.pFontAttr)->GetFamily(); + const char* pVal = getFontFamilyOOXValue(eFamily); + if (pVal) + { + rStyleSheet->singleElement(XML_family, + XML_val, pVal, + FSEND); + } + } + + if (maDxfData.eWeight) + { + rStyleSheet->singleElement(XML_b, + XML_val, XclXmlUtils::ToPsz10(maDxfData.eWeight.get() != WEIGHT_NORMAL), + FSEND); + } + + if (maDxfData.eItalic) + { + bool bItalic = (maDxfData.eItalic.get() == ITALIC_OBLIQUE) || (maDxfData.eItalic.get() == ITALIC_NORMAL); + rStyleSheet->singleElement(XML_i, + XML_val, XclXmlUtils::ToPsz10(bItalic), + FSEND); + } + + if (maDxfData.eStrike) + { + bool bStrikeout = + (maDxfData.eStrike.get() == STRIKEOUT_SINGLE) || (maDxfData.eStrike.get() == STRIKEOUT_DOUBLE) || + (maDxfData.eStrike.get() == STRIKEOUT_BOLD) || (maDxfData.eStrike.get() == STRIKEOUT_SLASH) || + (maDxfData.eStrike.get() == STRIKEOUT_X); + + rStyleSheet->singleElement(XML_strike, + XML_val, XclXmlUtils::ToPsz10(bStrikeout), + FSEND); + } + + if (maDxfData.bOutline) + { + rStyleSheet->singleElement(XML_outline, + XML_val, XclXmlUtils::ToPsz10(maDxfData.bOutline.get()), + FSEND); + } + + if (maDxfData.bShadow) + { + rStyleSheet->singleElement(XML_shadow, + XML_val, XclXmlUtils::ToPsz10(maDxfData.bShadow.get()), + FSEND); + } + + if (maDxfData.aColor) + { + rStyleSheet->singleElement(XML_color, + XML_rgb, XclXmlUtils::ToOString(maDxfData.aColor.get()).getStr(), + FSEND); + } + + if (maDxfData.eUnder) + { + const char* pVal = getUnderlineOOXValue(maDxfData.eUnder.get()); + rStyleSheet->singleElement(XML_u, + XML_val, pVal, + FSEND); + } + + rStyleSheet->endElement(XML_font); +} + XclExpBlindFont::XclExpBlindFont( const XclExpRoot& rRoot ) : XclExpFont( rRoot, XclFontData(), EXC_COLOR_CELLTEXT ) { @@ -2918,13 +3086,7 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot ) pColor = NULL; } - XclExpFont* pFont = NULL; - // check if non default font is set and only export then - if (rSet.GetItemState(rSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT )) == SfxItemState::SET ) - { - vcl::Font aFont = XclExpFontHelper::GetFontFromItemSet( GetRoot(), rSet, com::sun::star::i18n::ScriptType::WEAK ); - pFont = new XclExpFont( GetRoot(), XclFontData( aFont ), EXC_COLOR_CELLTEXT ); - } + XclExpDxfFont* pFont = new XclExpDxfFont(rRoot, rSet); XclExpNumFmt* pNumFormat = NULL; const SfxPoolItem *pPoolItem = NULL; @@ -2972,7 +3134,7 @@ void XclExpDxfs::SaveXml( XclExpXmlStream& rStrm ) } XclExpDxf::XclExpDxf( const XclExpRoot& rRoot, XclExpCellAlign* pAlign, XclExpCellBorder* pBorder, - XclExpFont* pFont, XclExpNumFmt* pNumberFmt, XclExpCellProt* pProt, XclExpColor* pColor) + XclExpDxfFont* pFont, XclExpNumFmt* pNumberFmt, XclExpCellProt* pProt, XclExpColor* pColor) : XclExpRoot( rRoot ), mpAlign(pAlign), mpBorder(pBorder), diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx index f17e9da..0899d33 100644 --- a/sc/source/filter/inc/xestyle.hxx +++ b/sc/source/filter/inc/xestyle.hxx @@ -29,6 +29,7 @@ #include "xlstyle.hxx" #include "xeroot.hxx" #include "conditio.hxx" +#include "fonthelper.hxx" #include <boost/shared_ptr.hpp> #include <boost/scoped_ptr.hpp> #include <boost/ptr_container/ptr_vector.hpp> @@ -143,6 +144,13 @@ namespace XclExpFontHelper const SfxItemSet& rItemSet, sal_Int16 nScript ); + /** + * Get a dxf related font object from the item set. + * Only items that are explicitly set in the item set + * are also set in the returned object. + */ + ScDxfFont GetDxfFontFromItemSet(const XclExpRoot& rRoot, const SfxItemSet& rSet); + /** Returns true, if at least one font related item is set in the passed item set. @param bDeep true = Searches in parent item sets too. */ bool CheckItems( @@ -179,6 +187,17 @@ private: sal_uInt32 mnHash; /// Hash value for fast comparison. }; +class XclExpDxfFont : public XclExpRecordBase, protected XclExpRoot +{ +public: + XclExpDxfFont(const XclExpRoot& rRoot, const SfxItemSet& rItemSet); + + virtual void SaveXml(XclExpXmlStream& rStrm) SAL_OVERRIDE; +private: + + ScDxfFont maDxfData; +}; + /** Used as placeholder for font index 4, which is not used in Excel. */ class XclExpBlindFont : public XclExpFont { @@ -695,7 +714,7 @@ class XclExpDxf : public XclExpRecordBase, protected XclExpRoot { public: XclExpDxf( const XclExpRoot& rRoot, XclExpCellAlign* pAlign, XclExpCellBorder* pBorder, - XclExpFont* pFont, XclExpNumFmt* pNumberFmt, XclExpCellProt* pProt, XclExpColor* pColor); + XclExpDxfFont* pFont, XclExpNumFmt* pNumberFmt, XclExpCellProt* pProt, XclExpColor* pColor); virtual ~XclExpDxf(); virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE; @@ -703,7 +722,7 @@ public: private: boost::scoped_ptr<XclExpCellAlign> mpAlign; boost::scoped_ptr<XclExpCellBorder> mpBorder; - boost::scoped_ptr<XclExpFont> mpFont; + boost::scoped_ptr<XclExpDxfFont> mpFont; boost::scoped_ptr<XclExpNumFmt> mpNumberFmt; boost::scoped_ptr<XclExpCellProt> mpProt; boost::scoped_ptr<XclExpColor> mpColor; commit 533add1c73b7d8cd6aa43c942821daf3f529df75 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Tue Apr 14 17:51:24 2015 +0200 remove unused empty struct Change-Id: Ic9e2a947805f4aad987160c52ffb5ecf4a7cb54b diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx index 53967876..f17e9da 100644 --- a/sc/source/filter/inc/xestyle.hxx +++ b/sc/source/filter/inc/xestyle.hxx @@ -691,10 +691,6 @@ private: }; -struct XclDxfStyle -{ -}; - class XclExpDxf : public XclExpRecordBase, protected XclExpRoot { public: commit 153fad53d04729432408f2eeba80c84f7531049e Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Apr 9 05:29:14 2015 +0200 revert accidently commited code Change-Id: I3158762e7da10eacaf2616a7d868531ad7fa7a51 diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index b89b3b0..a7ea722 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -272,26 +272,6 @@ ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const return pEntry; } -namespace { - -bool containsOnlyColumnLabel(Edit* pEdit, ScTokenArray* pArr) -{ - formula::FormulaToken* token = pArr->First(); - formula::StackVar t = token->GetType(); - OpCode op = token->GetOpCode(); - if( ( op == ocColRowName ) || - ( ( op == ocBad ) && ( t == formula::svString ) ) - ) - { - pEdit->SetControlBackground(COL_YELLOW); - return true; - } - - return false; -} - -} - IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, Edit*, pEdit) { OUString aFormula = pEdit->GetText(); @@ -315,27 +295,14 @@ IMPL_LINK(ScConditionFrmtEntry, OnEdChanged, Edit*, pEdit) } // Recognized col/row name or string token, warn the user - bool bContainsColumnLabel = containsOnlyColumnLabel(pEdit, ta.get());; - if (!bContainsColumnLabel) - { - ScCompiler aComp2( mpDoc, maPos ); - aComp2.SetGrammar( mpDoc->GetGrammar() ); - if (&maEdVal1 == pEdit) - { - OUString aFormula2 = maEdVal2.GetText(); - boost::scoped_ptr<ScTokenArray> pArr2(aComp2.CompileString(aFormula2)); - bContainsColumnLabel = containsOnlyColumnLabel(&maEdVal2, pArr2.get()); - } - else - { - OUString aFormula1 = maEdVal1.GetText(); - boost::scoped_ptr<ScTokenArray> pArr1(aComp2.CompileString(aFormula1)); - bContainsColumnLabel = containsOnlyColumnLabel(&maEdVal1, pArr1.get()); - } - } - - if (bContainsColumnLabel) + formula::FormulaToken* token = ta->First(); + formula::StackVar t = token->GetType(); + OpCode op = token->GetOpCode(); + if( ( op == ocColRowName ) || + ( ( op == ocBad ) && ( t == formula::svString ) ) + ) { + pEdit->SetControlBackground(COL_YELLOW); maFtVal.SetText(ScGlobal::GetRscString(STR_UNQUOTED_STRING)); return 0; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits