12#include <com/sun/star/lang/XServiceInfo.hpp>
13#include <com/sun/star/document/XDocumentProperties.hpp>
15#include <com/sun/star/uno/XComponentContext.hpp>
16#include <com/sun/star/frame/XFrame.hpp>
22#include <sfx2/strings.hrc>
42class ClassificationCategoriesController;
57 void setProperty(
const uno::Any& rProperty)
override;
66class ClassificationControl;
78 explicit ClassificationCategoriesController(
const uno::Reference<uno::XComponentContext>& rContext);
86 void SAL_CALL
dispose()
override;
89 uno::Reference<awt::XWindow> SAL_CALL createItemWindow(
const uno::Reference<awt::XWindow>& rParent)
override;
92 void SAL_CALL statusChanged(
const frame::FeatureStateEvent& rEvent)
override;
105 void SetOptimalSize();
109 explicit ClassificationControl(
vcl::Window* pParent);
110 ~ClassificationControl()
override;
116 void set_sensitive(
bool bSensitive)
122 void toggleInteractivityOnOrigin();
126OUString
const & getCategoryType()
139void ClassificationPropertyListener::setProperty(
const uno::Any& )
145ClassificationCategoriesController::ClassificationCategoriesController(
const uno::Reference<uno::XComponentContext>& rContext)
148 ,
m_xListener(new
comphelper::ConfigurationListener(
"/org.openoffice.Office.Paths/Paths/Classification"))
154OUString ClassificationCategoriesController::getImplementationName()
156 return "com.sun.star.comp.sfx2.ClassificationCategoriesController";
159sal_Bool ClassificationCategoriesController::supportsService(
const OUString& rServiceName)
164uno::Sequence<OUString> ClassificationCategoriesController::getSupportedServiceNames()
166 return {
"com.sun.star.frame.ToolbarController" };
169void ClassificationCategoriesController::dispose()
179uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindow(
const uno::Reference<awt::XWindow>& rParent)
182 auto pToolbar =
dynamic_cast<ToolBox*
>(pParent.
get());
186 m_pClassification->getCategory().connect_changed(
LINK(
this, ClassificationCategoriesController, SelectHdl));
207 OUString aEntry = rCategory.get_active_text();
209 const OUString& aType = getCategoryType();
218void ClassificationCategoriesController::statusChanged(
const frame::FeatureStateEvent& )
238 std::vector<OUString> aNames =
aHelper.GetBACNames();
239 for (
const OUString& rName : aNames)
249void ClassificationCategoriesController::removeEntries()
254ClassificationControl::ClassificationControl(
vcl::Window* pParent)
256 ,
m_xLabel(m_xBuilder->weld_label(
"label"))
257 ,
m_xCategory(m_xBuilder->weld_combo_box(
"combobox"))
261 m_xCategory->connect_key_press(
LINK(
this, ClassificationControl, KeyInputHdl));
265 SetStyle(GetStyle() | WB_DIALOGCONTROL | WB_NOLABEL);
271 aText =
SfxResId(STR_CLASSIFIED_INTELLECTUAL_PROPERTY);
274 aText =
SfxResId(STR_CLASSIFIED_NATIONAL_SECURITY);
277 aText =
SfxResId(STR_CLASSIFIED_EXPORT_CONTROL);
284 const Size aLogicalAttrSize(150, 0);
285 Size aSize(LogicToPixel(aLogicalAttrSize,
MapMode(MapUnit::MapAppFont)));
293 return ChildKeyInput(rKEvt);
296ClassificationControl::~ClassificationControl()
301void ClassificationControl::dispose()
308void ClassificationControl::SetOptimalSize()
310 SetSizePixel(get_preferred_size());
315 if ((rEvent.
GetType() == DataChangedEventType::SETTINGS) && (rEvent.
GetFlags() & AllSettingsFlags::STYLE))
318 toggleInteractivityOnOrigin();
329 uno::Reference<document::XDocumentProperties> xDocumentProperties = pObjectShell->
getDocProperties();
330 uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties();
336void ClassificationControl::toggleInteractivityOnOrigin()
340 set_sensitive(
false);
351 if (!rCategoryName.isEmpty())
353 getCategory().set_active_text(rCategoryName);
361 return cppu::acquire(
new sfx2::ClassificationCategoriesController(pContext));
PropertyValueVector_t aPropertyValues
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
virtual void dispose() override
Shared code to handle Business Authorization Identification and Labeling Scheme (BAILS) properties.
static SfxClassificationPolicyType getPolicyType()
const OUString & GetBACName(SfxClassificationPolicyType eType) const
Get the currently selected category for eType.
static const OUString & policyTypeToString(SfxClassificationPolicyType eType)
Returns the string representation of a SfxClassificationPolicyType element.
css::uno::Reference< css::document::XDocumentProperties > getDocProperties() const
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
reference_type * get() const
static VclPtr< reference_type > Create(Arg &&... arg)
std::unique_ptr< weld::ComboBox > m_xCategory
rtl::Reference< comphelper::ConfigurationListener > m_xListener
SAL_DLLPUBLIC_EXPORT uno::XInterface * com_sun_star_sfx2_ClassificationCategoriesController_get_implementation(uno::XComponentContext *pContext, const uno::Sequence< uno::Any > &)
VclPtr< ClassificationControl > m_pClassification
ClassificationCategoriesController & m_rController
ClassificationPropertyListener m_aPropertyListener
std::unique_ptr< weld::Label > m_xLabel
virtual void DataChanged(const DataChangedEvent &rDCEvt)
void append_text(const OUString &rStr)
virtual int get_count() const=0
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
#define LINK(Instance, Class, Member)
bool dispatchCommand(const OUString &rCommand, const uno::Reference< css::frame::XFrame > &rFrame, const css::uno::Sequence< css::beans::PropertyValue > &rArguments, const uno::Reference< css::frame::XDispatchResultListener > &rListener)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
comphelper::ConfigurationListenerProperty< OUString > ClassificationPropertyListenerBase
cppu::ImplInheritanceHelper< svt::ToolboxController, lang::XServiceInfo > ClassificationCategoriesControllerBase
IMPL_LINK(ClassificationControl, KeyInputHdl, const KeyEvent &, rKEvt, bool)
sfx::ClassificationCreationOrigin getCreationOriginProperty(uno::Reference< beans::XPropertyContainer > const &rxPropertyContainer, sfx::ClassificationKeyCreator const &rKeyCreator)
ClassificationCreationOrigin
Specifies the origin: either defined by the BAF policy or manual via. the advanced classification dia...
Reference< XNameAccess > m_xContainer
OUString SfxResId(TranslateId aId)