diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-01 14:58:46 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-03-01 15:41:02 +0100 |
commit | e0e6d8a5827ce1cbc73caeab10c2e7ba9e66035b (patch) | |
tree | 3a738e328796c50191f996142604853687d504a4 /sfx2 | |
parent | a03958af8d04889bb6206f620185c87fc1fb27d1 (diff) |
sfx2 classification: select current toolbar listbox entry when state changes
With this, if .uno:ClassificationApply is invoked from e.g. a macro, the
toolbar listbox is updated to reflect the classification of the
document. Previously the listbox wasn't updated.
Change-Id: I45a7c6ee2f3b06e048fa119264c615e78bc46b37
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/classificationcontroller.cxx | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx index b05431c7ce4d..fa54a9b86fbe 100644 --- a/sfx2/source/view/classificationcontroller.cxx +++ b/sfx2/source/view/classificationcontroller.cxx @@ -122,7 +122,7 @@ IMPL_LINK_NOARG_TYPED(ClassificationCategoriesController, SelectHdl, ListBox&, v void ClassificationCategoriesController::statusChanged(const frame::FeatureStateEvent& /*rEvent*/) throw (uno::RuntimeException, std::exception) { - if (!m_pCategories || m_pCategories->GetEntryCount() > 0) + if (!m_pCategories) return; SfxObjectShell* pObjectShell = SfxObjectShell::Current(); @@ -130,12 +130,15 @@ void ClassificationCategoriesController::statusChanged(const frame::FeatureState return; SfxClassificationHelper aHelper(*pObjectShell); - std::vector<OUString> aNames = aHelper.GetBACNames(); - for (const OUString& rName : aNames) - m_pCategories->InsertEntry(rName); - // Normally VclBuilder::makeObject() does this. - m_pCategories->EnableAutoSize(true); - m_pCategories->SetSizePixel(m_pCategories->GetOptimalSize()); + if (m_pCategories->GetEntryCount() == 0) + { + std::vector<OUString> aNames = aHelper.GetBACNames(); + for (const OUString& rName : aNames) + m_pCategories->InsertEntry(rName); + // Normally VclBuilder::makeObject() does this. + m_pCategories->EnableAutoSize(true); + m_pCategories->SetSizePixel(m_pCategories->GetOptimalSize()); + } // Restore state based on the doc. model. const OUString& rCategoryName = aHelper.GetBACName(); |