From 59e0854dd302659f67ec0b4b3a18515b26499280 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 26 Nov 2011 04:20:38 +0100 Subject: ManageNames: make the header bar work correctly --- sc/source/ui/namedlg/namemgrtable.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sc/source/ui') diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx index f2b03b11509d..d471c7467cc7 100644 --- a/sc/source/ui/namedlg/namemgrtable.cxx +++ b/sc/source/ui/namedlg/namemgrtable.cxx @@ -44,7 +44,7 @@ #define ITEMID_RANGE 2 #define ITEMID_SCOPE 3 -#define MINSIZE 50 +#define MINSIZE 80 String createEntryString(const ScRangeNameLine& rLine) @@ -173,6 +173,7 @@ std::vector ScRangeManagerTable::GetSelectedEntries() namespace { +//ensure that the minimum column size is respected void CalculateItemSize(const long& rTableSize, long& rItemNameSize, long& rItemRangeSize) { long aItemScopeSize = rTableSize - rItemNameSize - rItemRangeSize; @@ -218,16 +219,20 @@ IMPL_LINK( ScRangeManagerTable, HeaderEndDragHdl, void*, EMPTYARG) long aItemNameSize = maHeaderBar.GetItemSize(ITEMID_NAME); long aItemRangeSize = maHeaderBar.GetItemSize(ITEMID_RANGE); + //calculate column size based on user input and minimum size CalculateItemSize(aTableSize, aItemNameSize, aItemRangeSize); long aItemScopeSize = aTableSize - aItemNameSize - aItemRangeSize; Size aSz; aSz.Width() = aItemNameSize; SetTab( ITEMID_NAME, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT ); + maHeaderBar.SetItemSize(ITEMID_NAME, aItemNameSize); aSz.Width() += aItemRangeSize; SetTab( ITEMID_RANGE, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT ); + maHeaderBar.SetItemSize(ITEMID_RANGE, aItemRangeSize); aSz.Width() += aItemScopeSize; SetTab( ITEMID_SCOPE, PixelToLogic( aSz, MapMode(MAP_APPFONT) ).Width(), MAP_APPFONT ); + maHeaderBar.SetItemSize(ITEMID_SCOPE, aItemScopeSize); return 0; } -- cgit