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>
This commit is contained in:
@@ -58,7 +58,8 @@ public:
|
||||
|
||||
SfxClassificationHelper(const css::uno::Reference<css::document::XDocumentProperties>& xDocumentProperties);
|
||||
~SfxClassificationHelper();
|
||||
const OUString& GetBACName();
|
||||
/// Get the currently selected category for eType.
|
||||
const OUString& GetBACName(SfxClassificationPolicyType eType);
|
||||
/// Return all possible valid category names, based on the policy.
|
||||
std::vector<OUString> GetBACNames();
|
||||
/// Setting this sets all the other properties, based on the policy.
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user