diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-20 09:37:21 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-20 08:49:34 +0000 |
commit | 5840c2787c61bcbb5401d2aa0fc9e163e303f76c (patch) | |
tree | e9f36c7ad6396c3fc9e47529680eb98b216098f4 /sfx2 | |
parent | 72edb6967f245f0c99c6a61e0ce8d0a245600cba (diff) |
sfx2 classification toolbar: set state of all listboxes on status change
With this the listboxes reflect the state of the document after load.
This also means that the only difference between the first listbox and
the remaining ones is the first one influences the UI as well, but
everything else is implemented.
Change-Id: Ibea0e2fbc431f7327342fd8c2a1d31c34b73d6a8
Reviewed-on: https://gerrit.libreoffice.org/25188
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/view/classificationcontroller.cxx | 23 | ||||
-rw-r--r-- | sfx2/source/view/classificationhelper.cxx | 6 |
2 files changed, 21 insertions, 8 deletions
diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx index 5b8ca213c149..7abcdf650bde 100644 --- a/sfx2/source/view/classificationcontroller.cxx +++ b/sfx2/source/view/classificationcontroller.cxx @@ -208,16 +208,29 @@ void ClassificationCategoriesController::statusChanged(const frame::FeatureState } // Restore state based on the doc. model. - VclPtr<ListBox> pCategories = m_pClassification->getCategories(SfxClassificationPolicyType::IntellectualProperty); - const OUString& rCategoryName = aHelper.GetBACName(); - if (!rCategoryName.isEmpty()) - pCategories->SelectEntry(rCategoryName); + for (size_t i = m_pClassification->getLabelsSize(); i > 0; --i) + { + auto eType = static_cast<SfxClassificationPolicyType>(i); + const OUString& rCategoryName = aHelper.GetBACName(eType); + if (!rCategoryName.isEmpty()) + { + VclPtr<ListBox> pCategories = m_pClassification->getCategories(eType); + pCategories->SelectEntry(rCategoryName); + } + } } void ClassificationCategoriesController::removeEntries() { if (m_pClassification) - m_pClassification->getCategories(SfxClassificationPolicyType::IntellectualProperty)->Clear(); + { + for (size_t i = m_pClassification->getLabelsSize(); i > 0; --i) + { + auto eType = static_cast<SfxClassificationPolicyType>(i); + VclPtr<ListBox> pCategories = m_pClassification->getCategories(eType); + pCategories->Clear(); + } + } } ClassificationControl::ClassificationControl(vcl::Window* pParent) diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index eebe37c452fa..0c93e93dd636 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -542,9 +542,9 @@ SfxClassificationHelper::~SfxClassificationHelper() { } -const OUString& SfxClassificationHelper::GetBACName() +const OUString& SfxClassificationHelper::GetBACName(SfxClassificationPolicyType eType) { - return m_pImpl->m_aCategory[SfxClassificationPolicyType::IntellectualProperty].m_aName; + return m_pImpl->m_aCategory[eType].m_aName; } bool SfxClassificationHelper::HasImpactLevel() @@ -765,7 +765,7 @@ void SfxClassificationHelper::SetBACName(const OUString& rName, SfxClassificatio void SfxClassificationHelper::UpdateInfobar(SfxViewFrame& rViewFrame) { - OUString aBACName = GetBACName(); + OUString aBACName = GetBACName(SfxClassificationPolicyType::IntellectualProperty); bool bImpactLevel = HasImpactLevel(); if (!aBACName.isEmpty() && bImpactLevel) { |