13 #include <rtl/ustrbuf.hxx>
15 #include <com/sun/star/beans/PropertyAttribute.hpp>
16 #include <com/sun/star/beans/XPropertySet.hpp>
17 #include <com/sun/star/beans/XPropertyContainer.hpp>
25 OUStringBuffer sRepresentation;
29 switch (rResult.meType)
35 sRepresentation.append(rResult.msName);
39 sRepresentation.append(
" ");
43 return sRepresentation.makeStringAndClear();
46 OUString
getProperty(uno::Reference<beans::XPropertyContainer>
const& rxPropertyContainer,
47 OUString
const& rName)
51 uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY);
52 return xPropertySet->getPropertyValue(rName).get<OUString>();
54 catch (
const css::uno::Exception&)
61 bool containsProperty(uno::Sequence<beans::Property>
const& rProperties, std::u16string_view rName)
63 return std::any_of(rProperties.begin(), rProperties.end(),
64 [&](
const beans::Property& rProperty) {
return rProperty.Name == rName; });
69 uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY);
71 = xPropertySet->getPropertySetInfo()->getProperties();
73 for (
const beans::Property& rProperty : aProperties)
75 rxPropertyContainer->removeProperty(rProperty.Name);
80 uno::Reference<beans::XPropertyContainer>
const& rxPropertyContainer, OUString
const& rsKey,
81 OUString
const& rsValue)
83 uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY);
87 if (
containsProperty(xPropertySet->getPropertySetInfo()->getProperties(), rsKey))
88 xPropertySet->setPropertyValue(rsKey, uno::makeAny(rsValue));
90 rxPropertyContainer->addProperty(rsKey, beans::PropertyAttribute::REMOVABLE,
91 uno::makeAny(rsValue));
93 catch (
const uno::Exception& )
101 uno::Reference<beans::XPropertyContainer>
const& rxPropertyContainer,
103 std::vector<svx::ClassificationResult>
const& rResults)
119 ? OUString(
"BAF_POLICY")
120 : OUString(
"MANUAL");
void insertCreationOrigin(uno::Reference< beans::XPropertyContainer > const &rxPropertyContainer, sfx::ClassificationKeyCreator const &rKeyCreator, sfx::ClassificationCreationOrigin eOrigin)
PropertiesInfo aProperties
ClassificationCreationOrigin
void removeAllProperties(uno::Reference< beans::XPropertyContainer > const &rxPropertyContainer)
OUString getProperty(uno::Reference< beans::XPropertyContainer > const &rxPropertyContainer, OUString const &rName)
OUString makeFullTextualRepresentationKey() const
OUString makeCreationOriginKey() const
bool containsProperty(uno::Sequence< beans::Property > const &rProperties, std::u16string_view rName)
void insertFullTextualRepresentationAsDocumentProperty(uno::Reference< beans::XPropertyContainer > const &rxPropertyContainer, sfx::ClassificationKeyCreator const &rKeyCreator, std::vector< svx::ClassificationResult > const &rResults)
OUString convertClassificationResultToString(std::vector< svx::ClassificationResult > const &rResults)
bool addOrInsertDocumentProperty(uno::Reference< beans::XPropertyContainer > const &rxPropertyContainer, OUString const &rsKey, OUString const &rsValue)