diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-10-07 11:46:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-07 11:46:59 +0100 |
commit | e5dd19526fcdb2f9eb0e87017e33e9fd8402b028 (patch) | |
tree | 7b2aac570143d743ca51c50a7c9c36461ef14a71 /svtools | |
parent | 9cff818949f0a3d07c225c916c03097c6602e63b (diff) |
make font style size stable on switching fonts
Change-Id: I891fa5b9b8bd3be7dd4d73f2911ec56d16a3b09f
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 32513d41e4f1..87ed82d92b5f 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1431,10 +1431,30 @@ FontStyleBox::FontStyleBox( Window* pParent, const ResId& rResId ) : aLastStyle = GetText(); } -FontStyleBox::FontStyleBox( Window* pParent, WinBits nBits ) : - ComboBox( pParent, nBits ) +FontStyleBox::FontStyleBox(Window* pParent, WinBits nBits) + : ComboBox(pParent, nBits) { aLastStyle = GetText(); + + //Use the standard texts to get an optimal size and stick to that size. + //That should stop the character dialog dancing around. + InsertEntry(SVT_RESSTR(STR_SVT_STYLE_LIGHT)); + InsertEntry(SVT_RESSTR(STR_SVT_STYLE_LIGHT_ITALIC)); + InsertEntry(SVT_RESSTR(STR_SVT_STYLE_NORMAL)); + InsertEntry(SVT_RESSTR(STR_SVT_STYLE_NORMAL_ITALIC)); + InsertEntry(SVT_RESSTR(STR_SVT_STYLE_BOLD)); + InsertEntry(SVT_RESSTR(STR_SVT_STYLE_BOLD_ITALIC)); + InsertEntry(SVT_RESSTR(STR_SVT_STYLE_BLACK)); + InsertEntry(SVT_RESSTR(STR_SVT_STYLE_BLACK_ITALIC)); + aOptimalSize = GetOptimalSize(); + Clear(); +} + +Size FontStyleBox::GetOptimalSize() const +{ + if (aOptimalSize.Width() || aOptimalSize.Height()) + return aOptimalSize; + return ComboBox::GetOptimalSize(); } extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeFontStyleBox(Window *pParent, VclBuilder::stringmap &rMap) |