cui/source/tabpages/numfmt.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
New commits: commit 2d52a907e26c306fa6738766409df2d7760fe3c4 Author: Eike Rathke <er...@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 (cherry picked from commit 2e3d7c742a1c1253c4bb2af1c3d1b1506d2e7af4) Reviewed-on: https://gerrit.libreoffice.org/10939 Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index 76a7743..52d2356 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -531,7 +531,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) @@ -1680,6 +1688,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); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits