summaryrefslogtreecommitdiff
path: root/sw/source/uibase/sidebar
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-06 11:30:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-08-06 13:39:40 +0200
commit6a32a2dfb45865d5bc8986e753260558a7be6429 (patch)
treed5dcd17bd6541561190cf972f0b2f9205169c990 /sw/source/uibase/sidebar
parentfeafbaa0372705be3f4cc4616983fb8641a81d44 (diff)
tdf#135488 ensure something is selected in experimental theme colorset
so double click without something selected can't normally happen, and bail out and do nothing if it does happen Change-Id: Ic9ed756d4b2b51b87f09786ab7b8506b2d720d84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100232 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/sidebar')
-rw-r--r--sw/source/uibase/sidebar/ThemePanel.cxx23
1 files changed, 14 insertions, 9 deletions
diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx
index 18abd157b71a..290ca4106fb3 100644
--- a/sw/source/uibase/sidebar/ThemePanel.cxx
+++ b/sw/source/uibase/sidebar/ThemePanel.cxx
@@ -444,6 +444,9 @@ ThemePanel::ThemePanel(vcl::Window* pParent,
}
mxValueSetColors->SetOptimalSize();
+
+ if (!aColorSets.empty())
+ mxValueSetColors->SelectItem(1); // ItemId 1, position 0
}
ThemePanel::~ThemePanel()
@@ -480,17 +483,19 @@ IMPL_LINK_NOARG(ThemePanel, DoubleClickHdl, weld::TreeView&, bool)
void ThemePanel::DoubleClickHdl()
{
SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current());
- if (pDocSh)
- {
- OUString sEntryFonts = mxListBoxFonts->get_selected_text();
- sal_uInt32 nItemId = mxValueSetColors->GetSelectedItemId();
- sal_uInt32 nIndex = nItemId - 1;
- OUString sEntryColors = maColorSets.getColorSet(nIndex).getName();
+ if (!pDocSh)
+ return;
- StyleSet aStyleSet = setupThemes();
+ sal_uInt32 nItemId = mxValueSetColors->GetSelectedItemId();
+ if (!nItemId)
+ return;
+ OUString sEntryFonts = mxListBoxFonts->get_selected_text();
+ sal_uInt32 nIndex = nItemId - 1;
+ OUString sEntryColors = maColorSets.getColorSet(nIndex).getName();
- applyTheme(pDocSh->GetStyleSheetPool(), sEntryFonts, sEntryColors, aStyleSet, maColorSets);
- }
+ StyleSet aStyleSet = setupThemes();
+
+ applyTheme(pDocSh->GetStyleSheetPool(), sEntryFonts, sEntryColors, aStyleSet, maColorSets);
}
void ThemePanel::NotifyItemUpdate(const sal_uInt16 /*nSId*/,