diff options
author | Andrzej Hunt <andrzej@ahunt.org> | 2015-06-01 18:37:26 +0100 |
---|---|---|
committer | Andrzej Hunt <andrzej@ahunt.org> | 2015-10-20 18:18:38 +0200 |
commit | 7ec97b0b9b7455003eaab9851c8a11190266b9ef (patch) | |
tree | ab85bd01d7d94dcc830869a969d892569c02a4e9 | |
parent | Add tests for output unit verification. (diff) | |
download | core-7ec97b0b9b7455003eaab9851c8a11190266b9ef.tar.gz core-7ec97b0b9b7455003eaab9851c8a11190266b9ef.zip |
Show whether error is in formula or output in units warning
Change-Id: Ib21462b3d67bb9b960c0d37384cdcef5003a884e
-rw-r--r-- | sc/inc/sc.hrc | 5 | ||||
-rw-r--r-- | sc/source/ui/src/units.src | 9 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 18 |
3 files changed, 27 insertions, 5 deletions
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index c7ad1f776857..ede086accbdb 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -1001,8 +1001,9 @@ #define STR_TITLE_DATE (STR_START + 443) #define STR_UNKNOWN_USER_CONFLICT (STR_START + 444) -#define STR_UNITS_ERRORINCELL (STR_START + 450) -#define BT_UNITS_EDIT_CELL (STR_START + 451) +#define STR_UNITS_ERROR_INPUT (STR_START + 450) +#define STR_UNITS_ERROR_OUTPUT (STR_START + 451) +#define BT_UNITS_EDIT_CELL (STR_START + 452) #define STR_UNITS_CONVERSION_RECOMMENDED (STR_START + 455) #define BT_UNITS_CONVERT_THIS_CELL (STR_START + 456) diff --git a/sc/source/ui/src/units.src b/sc/source/ui/src/units.src index 7a818e954d82..d666923f0d51 100644 --- a/sc/source/ui/src/units.src +++ b/sc/source/ui/src/units.src @@ -19,9 +19,14 @@ #include "sc.hrc" -String STR_UNITS_ERRORINCELL +String STR_UNITS_ERROR_INPUT { - Text [ en-US ] = "Units error in formula in Cell $1" ; + Text [ en-US ] = "Units error in formula in Cell $1: incompatible units used in formula." ; +}; + +String STR_UNITS_ERROR_OUTPUT +{ + Text [ en-US ] = "Units error in formula in Cell $1: result units don't match specified units." ; }; PushButton BT_UNITS_EDIT_CELL diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index f25711a7c995..dbbff8eadfd9 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2863,7 +2863,23 @@ void ScViewFunc::NotifyUnitErrorInFormula( const ScAddress& rAddress, ScDocument // after having carried out further edits on the document (whereby any tab changes/additions/removals // could change the number of the tab, with a name change being much more rare), hence having // all information (including tab name) could be useful. - OUString sTitle = SC_RESSTR( STR_UNITS_ERRORINCELL ); + OUString sTitle; + if (rStatus == FormulaStatus::ERROR_INPUT_SCALING || + rStatus == FormulaStatus::ERROR_INPUT_INCOMPATIBLE) + { + sTitle = SC_RESSTR( STR_UNITS_ERROR_INPUT ); + } + else if (rStatus == FormulaStatus::ERROR_OUTPUT_SCALING || + rStatus == FormulaStatus::ERROR_OUTPUT_INCOMPATIBLE) + { + sTitle = SC_RESSTR( STR_UNITS_ERROR_OUTPUT ); + } + else + { + // We should not be showing a warning bar for any other statuses. + assert(false); + } + sTitle = sTitle.replaceAll( "$1", rAddress.GetColRowString() ); OUString sCellAddress = rAddress.Format( SCA_BITS, pDoc ); SfxInfoBarWindow* pInfoBar = pViewFrame->AppendInfoBar( sCellAddress, sTitle ); |