summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-12 09:53:55 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-12 10:24:19 +0100
commita84fca9a0acebc26af655bdebc984c0d7113ee2c (patch)
tree3e66da11dc6a11071c6879e7ded0c0ae493abdd9
parentc165b1d54c4289eb029813a331ff963b17d1de2a (diff)
set mnemonic widget and replace 24 with optimal height request
Change-Id: I86bb00f134aaf95a48ac0a5d594c632d03f0e9d5
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx23
1 files changed, 18 insertions, 5 deletions
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index e7935edfe441..ed8de3e2c468 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -906,17 +906,25 @@ void SwAssignFieldsControl::Init(SwMailMergeConfigItem& rConfigItem)
//fill the controls
long nControlWidth = aOutputSize.Width() / 3;
- long nControlHeight = 24;
+ long nControlHeight = -1;
for(sal_uInt32 i = 0; i < rHeaders.Count(); ++i)
{
const OUString rHeader = rHeaders.GetString( i );
FixedText* pNewText = new FixedText(&m_aWindow, WB_VCENTER);
pNewText->SetText("<" + rHeader + ">");
ListBox* pNewLB = new ListBox(&m_aWindow, WB_DROPDOWN | WB_VCENTER | WB_TABSTOP);
+ pNewText->set_mnemonic_widget(pNewLB);
pNewLB->InsertEntry(SW_RESSTR(SW_STR_NONE));
pNewLB->SetHelpId( aHIDs[i] );
pNewLB->SelectEntryPos(0);
pNewLB->SetDropDownLineCount(5);
+
+ if (nControlHeight == -1) //first time
+ {
+ nControlHeight = std::max(pNewLB->get_preferred_size().Height(),
+ pNewText->get_preferred_size().Height());
+ }
+
for(sal_Int32 nField = 0; nField < aFields.getLength(); ++nField)
pNewLB->InsertEntry(pFields[nField]);
FixedText* pNewPreview = new FixedText(&m_aWindow, WB_VCENTER);
@@ -997,7 +1005,6 @@ void SwAssignFieldsControl::Resize()
Size aOutputSize = GetOutputSize();
long nHBHeight = m_aHeaderHB.CalcWindowSizePixel().Height();
- long nControlHeight = 24;
m_aWindow.SetSizePixel(Size(aOutputSize.Width() - m_aVScroll.GetSizePixel().Width(), aOutputSize.Height() - nHBHeight));
@@ -1010,9 +1017,15 @@ void SwAssignFieldsControl::Resize()
sal_Int32 nColWidth = aOutputSize.Width() / 3;
m_aHeaderHB.SetSizePixel(Size(aOutputSize.Width(), nHBHeight));
- m_aHeaderHB.SetItemSize( 1, nColWidth);
- m_aHeaderHB.SetItemSize( 2, nColWidth);
- m_aHeaderHB.SetItemSize( 3, nColWidth);
+ m_aHeaderHB.SetItemSize(1, nColWidth);
+ m_aHeaderHB.SetItemSize(2, nColWidth);
+ m_aHeaderHB.SetItemSize(3, nColWidth);
+
+ if (m_aFieldNames.empty() || m_aMatches.empty())
+ return;
+
+ long nControlHeight = std::max(m_aFieldNames[0]->get_preferred_size().Height(),
+ m_aMatches[0]->get_preferred_size().Height());
::std::vector<FixedText*>::iterator aFIIter;
for(aFIIter = m_aFieldNames.begin(); aFIIter != m_aFieldNames.end(); ++aFIIter)