/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using ClassificationPropertyListenerBase = comphelper::ConfigurationListenerProperty<OUString>;
namespace {
/// Listens to configuration changes, so no restart is needed after setting the classification path. class ClassificationPropertyListener : public ClassificationPropertyListenerBase
{
ClassificationCategoriesController& m_rController;
/// Classification control is the parent of all widgets that belongs to ClassificationCategoriesController. class SAL_WARN_UNUSED ClassificationControl final : public InterimItemWindow
{
std::unique_ptr<weld::Label> m_xLabel;
std::unique_ptr<weld::ComboBox> m_xCategory;
void ClassificationPropertyListener::setProperty(const uno::Any& /*rProperty*/)
{ // So that its gets re-filled with entries from the new policy.
m_rController.removeEntries();
}
//toggle if the pop-up is enabled/disabled
m_pClassification->toggleInteractivityOnOrigin();
// check if classification was set via the advanced dialog if (ClassificationControl::getExistingClassificationOrigin() != sfx::ClassificationCreationOrigin::MANUAL)
{
weld::ComboBox& rCategories = m_pClassification->getCategory(); if (rCategories.get_count() == 0)
{
std::vector<OUString> aNames = aHelper.GetBACNames(); for (const OUString& rName : aNames)
rCategories.append_text(rName);
}
}
// Restore state based on the doc. model.
m_pClassification->setCategoryStateFromPolicy(aHelper);
// WB_NOLABEL means here that the control won't be replaced with a label // when it wouldn't fit the available space.
SetStyle(GetStyle() | WB_DIALOGCONTROL | WB_NOLABEL);
OUString aText; switch (SfxClassificationHelper::getPolicyType())
{ case SfxClassificationPolicyType::IntellectualProperty:
aText = SfxResId(STR_CLASSIFIED_INTELLECTUAL_PROPERTY); break; case SfxClassificationPolicyType::NationalSecurity:
aText = SfxResId(STR_CLASSIFIED_NATIONAL_SECURITY); break; case SfxClassificationPolicyType::ExportControl:
aText = SfxResId(STR_CLASSIFIED_EXPORT_CONTROL); break;
}
m_xLabel->set_label(aText);
// Same as SvxColorDockingWindow. const Size aLogicalAttrSize(150, 0);
Size aSize(LogicToPixel(aLogicalAttrSize, MapMode(MapUnit::MapAppFont)));
m_xCategory->set_size_request(aSize.Width() - m_xLabel->get_preferred_size().Width(), -1);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.