diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-04 18:00:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-05 16:42:39 +0200 |
commit | a5f95804c1a730fb393c33b49e6fbe0f5a5e9eac (patch) | |
tree | 44ceb650ccfa1e7e5178d8902ceb6f088acf47af /svtools | |
parent | 72bb13af1808b27a293e09a3ead2aadd049e9ec1 (diff) |
tdf#134479 allow disable font preview to work on existing font comboboxes
not just newly created one.
you can only restore back to a text-only view, not a text+(icon/whatever) view
Change-Id: Ic3becd7a942ee6b1dbabb57eebf1e25d1b626fdb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97991
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index e60494a51097..555d35a94aa0 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -466,14 +466,16 @@ void FontNameBox::Fill( const FontList* pList ) set_active_or_entry_text(aOldText); } -void FontNameBox::EnableWYSIWYG() +void FontNameBox::EnableWYSIWYG(bool bEnable) { - if (mbWYSIWYG || comphelper::LibreOfficeKit::isActive()) + if (comphelper::LibreOfficeKit::isActive()) return; - mbWYSIWYG = true; + if (mbWYSIWYG == bEnable) + return; + mbWYSIWYG = bEnable; static bool bGlobalsInited; - if (!bGlobalsInited) + if (mbWYSIWYG && !bGlobalsInited) { gUserItemSz = Size(m_xComboBox->get_approximate_digit_width() * 52, m_xComboBox->get_text_height()); gUserItemSz.setHeight(gUserItemSz.Height() * 16); @@ -485,11 +487,17 @@ void FontNameBox::EnableWYSIWYG() bGlobalsInited = true; } - m_xComboBox->connect_custom_get_size(LINK(this, FontNameBox, CustomGetSizeHdl)); - m_xComboBox->connect_custom_render(LINK(this, FontNameBox, CustomRenderHdl)); - m_xComboBox->set_custom_renderer(); - - mbWYSIWYG = true; + if (mbWYSIWYG) + { + m_xComboBox->connect_custom_get_size(LINK(this, FontNameBox, CustomGetSizeHdl)); + m_xComboBox->connect_custom_render(LINK(this, FontNameBox, CustomRenderHdl)); + } + else + { + m_xComboBox->connect_custom_get_size(Link<OutputDevice&, Size>()); + m_xComboBox->connect_custom_render(Link<weld::ComboBox::render_args, void>()); + } + m_xComboBox->set_custom_renderer(mbWYSIWYG); } IMPL_STATIC_LINK_NOARG(FontNameBox, CustomGetSizeHdl, OutputDevice&, Size) |