summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-08-15 22:41:58 +0200
committerEike Rathke <erack@redhat.com>2014-08-15 22:58:43 +0200
commit2e3d7c742a1c1253c4bb2af1c3d1b1506d2e7af4 (patch)
treef067eac69346a7ecc7695cb1bca43a50c8c2c3bb /cui
parent403fdaba8a2c3b450dbe8b4b26d1d777ab32e04e (diff)
fdo#48110 disable the "Automatically" currency unless already used
This disables the "Automatically" currency listbox entry in the number formats dialog and makes it unselectable, unless such currency format was already used at the current position of a loaded document. Getting completely rid of the listbox entry if not used is more cumbersome as the positions are tied to the list entries in SvxNumberFormatShell::aCurCurrencyList, but at least the disabled entry prevents accidental or ill intended selection of that awkward format. Change-Id: I16f3e88feede34e3f83afb108f253fb53d82d34d
Diffstat (limited to 'cui')
-rw-r--r--cui/source/tabpages/numfmt.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index de36480db1c8..c235cfa5a5bc 100644
--- a/cui/source/tabpages/numfmt.cxx
+++ b/cui/source/tabpages/numfmt.cxx
@@ -535,7 +535,15 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet* rSet )
pNumFmtShell->GetInitSettings( nCatLbSelPos, eLangType, nFmtLbSelPos,
aFmtEntryList, aPrevString, pDummy );
- m_pLbCurrency->SelectEntryPos((sal_Int32)pNumFmtShell->GetCurrencySymbol());
+ if (nCatLbSelPos==CAT_CURRENCY)
+ {
+ sal_Int32 nPos = pNumFmtShell->GetCurrencySymbol();
+ if (nPos == 0)
+ // Enable "Automatically" if currently used so it is selectable.
+ m_pLbCurrency->SetEntryFlags( nPos, 0);
+
+ m_pLbCurrency->SelectEntryPos(nPos);
+ }
nFixedCategory=nCatLbSelPos;
if(bOneAreaFlag)
@@ -1682,6 +1690,11 @@ void SvxNumberFormatTabPage::FillCurrencyBox()
for(std::vector<OUString>::iterator i = aList.begin() + 1;i != aList.end(); ++i)
m_pLbCurrency->InsertEntry(*i);
+ // Initially disable the "Automatically" entry. First ensure that nothing
+ // is selected, else if the to be disabled (first) entry was selected it
+ // would be sticky when disabled and could not be deselected!
+ m_pLbCurrency->SetNoSelection();
+ m_pLbCurrency->SetEntryFlags( 0, LISTBOX_ENTRY_FLAG_DISABLE_SELECTION | LISTBOX_ENTRY_FLAG_DRAW_DISABLED);
m_pLbCurrency->SelectEntryPos(nSelPos);
}