[Libreoffice-commits] core.git: cui/source
Eike Rathke
erack at redhat.com
Fri Aug 15 13:59:09 PDT 2014
cui/source/tabpages/numfmt.cxx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
New commits:
commit 2e3d7c742a1c1253c4bb2af1c3d1b1506d2e7af4
Author: Eike Rathke <erack at redhat.com>
Date: Fri Aug 15 22:41:58 2014 +0200
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
diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx
index de36480..c235cfa 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);
}
More information about the Libreoffice-commits
mailing list