16#include <com/sun/star/beans/XPropertyContainer.hpp>
17#include <com/sun/star/beans/Property.hpp>
18#include <com/sun/star/beans/XPropertySet.hpp>
19#include <com/sun/star/document/XDocumentProperties.hpp>
20#include <com/sun/star/xml/sax/Parser.hpp>
21#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
22#include <com/sun/star/xml/sax/SAXParseException.hpp>
23#include <com/sun/star/beans/PropertyAttribute.hpp>
34#include <sfx2/strings.hrc>
37#include <tools/datetime.hxx>
46#include <officecfg/Office/Common.hxx>
53const OUString& PROP_BACNAME()
55 static const OUString sProp(
"BusinessAuthorizationCategory:Name");
59const OUString& PROP_STARTVALIDITY()
61 static const OUString sProp(
"Authorization:StartValidity");
65const OUString& PROP_NONE()
67 static const OUString sProp(
"None");
71const OUString& PROP_IMPACTSCALE()
73 static const OUString sProp(
"Impact:Scale");
77const OUString& PROP_IMPACTLEVEL()
79 static const OUString sProp(
"Impact:Level:Confidentiality");
83const OUString& PROP_PREFIX_EXPORTCONTROL()
85 static const OUString sProp(
"urn:bails:ExportControl:");
89const OUString& PROP_PREFIX_NATIONALSECURITY()
91 static const OUString sProp(
"urn:bails:NationalSecurity:");
96class SfxClassificationCategory
101 OUString m_aAbbreviatedName;
102 OUString m_aIdentifier;
103 size_t m_nConfidentiality;
104 std::map<OUString, OUString> m_aLabels;
108class SfxClassificationParser :
public cppu::WeakImplHelper<xml::sax::XDocumentHandler>
111 std::vector<SfxClassificationCategory> m_aCategories;
112 std::vector<OUString> m_aMarkings;
113 std::vector<OUString> m_aIPParts;
114 std::vector<OUString> m_aIPPartNumbers;
116 OUString m_aPolicyAuthorityName;
117 bool m_bInPolicyAuthorityName =
false;
118 OUString m_aPolicyName;
119 bool m_bInPolicyName =
false;
120 OUString m_aProgramID;
121 bool m_bInProgramID =
false;
123 bool m_bInScale =
false;
124 OUString m_aConfidentalityValue;
125 bool m_bInConfidentalityValue =
false;
126 OUString m_aIdentifier;
127 bool m_bInIdentifier =
false;
129 bool m_bInValue =
false;
132 SfxClassificationCategory* m_pCategory =
nullptr;
134 SfxClassificationParser();
136 void SAL_CALL startDocument()
override;
138 void SAL_CALL endDocument()
override;
140 void SAL_CALL startElement(
const OUString& rName,
const uno::Reference<xml::sax::XAttributeList>& xAttribs)
override;
142 void SAL_CALL endElement(
const OUString& rName)
override;
144 void SAL_CALL characters(
const OUString& rChars)
override;
146 void SAL_CALL ignorableWhitespace(
const OUString& rWhitespaces)
override;
148 void SAL_CALL processingInstruction(
const OUString&
rTarget,
const OUString& rData)
override;
150 void SAL_CALL setDocumentLocator(
const uno::Reference<xml::sax::XLocator>& xLocator)
override;
153SfxClassificationParser::SfxClassificationParser() =
default;
155void SAL_CALL SfxClassificationParser::startDocument()
159void SAL_CALL SfxClassificationParser::endDocument()
163void SAL_CALL SfxClassificationParser::startElement(
const OUString& rName,
const uno::Reference<xml::sax::XAttributeList>& xAttribs)
165 if (rName ==
"baf:PolicyAuthorityName")
167 m_aPolicyAuthorityName.clear();
168 m_bInPolicyAuthorityName =
true;
170 else if (rName ==
"baf:PolicyName")
172 m_aPolicyName.clear();
173 m_bInPolicyName =
true;
175 else if (rName ==
"baf:ProgramID")
177 m_aProgramID.clear();
178 m_bInProgramID =
true;
180 else if (rName ==
"baf:BusinessAuthorizationCategory")
182 const OUString
aName = xAttribs->getValueByName(
"Name");
183 if (!m_pCategory && !
aName.isEmpty())
185 OUString aIdentifier = xAttribs->getValueByName(
"Identifier");
188 m_aCategories.emplace_back();
189 SfxClassificationCategory& rCategory = m_aCategories.back();
191 rCategory.m_aName =
aName;
193 const OUString aAbbreviatedName = xAttribs->getValueByName(
"loextAbbreviatedName");
194 rCategory.m_aAbbreviatedName = !aAbbreviatedName.isEmpty() ? aAbbreviatedName :
aName;
195 rCategory.m_aIdentifier = aIdentifier;
197 rCategory.m_aLabels[
"PolicyAuthority:Name"] = m_aPolicyAuthorityName;
198 rCategory.m_aLabels[
"Policy:Name"] = m_aPolicyName;
199 rCategory.m_aLabels[
"BusinessAuthorization:Identifier"] = m_aProgramID;
200 rCategory.m_aLabels[
"BusinessAuthorizationCategory:Identifier"] = aIdentifier;
203 rCategory.m_aLabels[
"PolicyAuthority:Identifier"] = PROP_NONE();
204 rCategory.m_aLabels[
"PolicyAuthority:Country"] = PROP_NONE();
205 rCategory.m_aLabels[
"Policy:Identifier"] = PROP_NONE();
206 rCategory.m_aLabels[
"BusinessAuthorization:Name"] = PROP_NONE();
207 rCategory.m_aLabels[
"BusinessAuthorization:Locator"] = PROP_NONE();
208 rCategory.m_aLabels[
"BusinessAuthorizationCategory:Identifier:OID"] = PROP_NONE();
209 rCategory.m_aLabels[
"BusinessAuthorizationCategory:Locator"] = PROP_NONE();
210 rCategory.m_aLabels[
"BusinessAuthorization:Locator"] = PROP_NONE();
211 rCategory.m_aLabels[
"MarkingPrecedence"] = PROP_NONE();
212 rCategory.m_aLabels[
"Marking:general-summary"].clear();
213 rCategory.m_aLabels[
"Marking:general-warning-statement"].clear();
214 rCategory.m_aLabels[
"Marking:general-warning-statement:ext:2"].clear();
215 rCategory.m_aLabels[
"Marking:general-warning-statement:ext:3"].clear();
216 rCategory.m_aLabels[
"Marking:general-warning-statement:ext:4"].clear();
217 rCategory.m_aLabels[
"Marking:general-distribution-statement"].clear();
218 rCategory.m_aLabels[
"Marking:general-distribution-statement:ext:2"].clear();
219 rCategory.m_aLabels[
"Marking:general-distribution-statement:ext:3"].clear();
220 rCategory.m_aLabels[
"Marking:general-distribution-statement:ext:4"].clear();
224 rCategory.m_aLabels[
"Marking:email-first-line-of-text"].clear();
225 rCategory.m_aLabels[
"Marking:email-last-line-of-text"].clear();
226 rCategory.m_aLabels[
"Marking:email-subject-prefix"].clear();
227 rCategory.m_aLabels[
"Marking:email-subject-suffix"].clear();
228 rCategory.m_aLabels[PROP_STARTVALIDITY()] = PROP_NONE();
229 rCategory.m_aLabels[
"Authorization:StopValidity"] = PROP_NONE();
230 m_pCategory = &rCategory;
233 else if (rName ==
"loext:Marking")
235 OUString
aName = xAttribs->getValueByName(
"Name");
236 m_aMarkings.push_back(aName);
238 else if (rName ==
"loext:IntellectualPropertyPart")
240 OUString
aName = xAttribs->getValueByName(
"Name");
241 m_aIPParts.push_back(aName);
243 else if (rName ==
"loext:IntellectualPropertyPartNumber")
245 OUString
aName = xAttribs->getValueByName(
"Name");
246 m_aIPPartNumbers.push_back(aName);
248 else if (rName ==
"baf:Scale")
253 else if (rName ==
"baf:ConfidentalityValue")
255 m_aConfidentalityValue.clear();
256 m_bInConfidentalityValue =
true;
258 else if (rName ==
"baf:Identifier")
260 m_aIdentifier.clear();
261 m_bInIdentifier =
true;
263 else if (rName ==
"baf:Value")
270void SAL_CALL SfxClassificationParser::endElement(
const OUString& rName)
272 if (rName ==
"baf:PolicyAuthorityName")
273 m_bInPolicyAuthorityName =
false;
274 else if (rName ==
"baf:PolicyName")
275 m_bInPolicyName =
false;
276 else if (rName ==
"baf:ProgramID")
277 m_bInProgramID =
false;
278 else if (rName ==
"baf:BusinessAuthorizationCategory")
279 m_pCategory =
nullptr;
280 else if (rName ==
"baf:Scale")
284 m_pCategory->m_aLabels[PROP_IMPACTSCALE()] = m_aScale;
286 else if (rName ==
"baf:ConfidentalityValue")
288 m_bInConfidentalityValue =
false;
291 std::map<OUString, OUString>& rLabels = m_pCategory->m_aLabels;
292 rLabels[PROP_IMPACTLEVEL()] = m_aConfidentalityValue;
293 m_pCategory->m_nConfidentiality = m_aConfidentalityValue.toInt32();
296 rLabels.try_emplace(
"Impact:Level:Integrity", m_aConfidentalityValue);
297 rLabels.try_emplace(
"Impact:Level:Availability", m_aConfidentalityValue);
300 else if (rName ==
"baf:Identifier")
301 m_bInIdentifier =
false;
302 else if (rName ==
"baf:Value")
306 if (m_aIdentifier ==
"Document: Header")
308 else if (m_aIdentifier ==
"Document: Footer")
310 else if (m_aIdentifier ==
"Document: Watermark")
316void SAL_CALL SfxClassificationParser::characters(
const OUString& rChars)
318 if (m_bInPolicyAuthorityName)
319 m_aPolicyAuthorityName += rChars;
320 else if (m_bInPolicyName)
321 m_aPolicyName += rChars;
322 else if (m_bInProgramID)
323 m_aProgramID += rChars;
326 else if (m_bInConfidentalityValue)
327 m_aConfidentalityValue += rChars;
328 else if (m_bInIdentifier)
329 m_aIdentifier += rChars;
334void SAL_CALL SfxClassificationParser::ignorableWhitespace(
const OUString& )
338void SAL_CALL SfxClassificationParser::processingInstruction(
const OUString& ,
const OUString& )
342void SAL_CALL SfxClassificationParser::setDocumentLocator(
const uno::Reference<xml::sax::XLocator>& )
353 std::map<SfxClassificationPolicyType, SfxClassificationCategory>
m_aCategory;
364 explicit Impl(uno::Reference<document::XDocumentProperties> xDocumentProperties,
bool bUseLocalized);
373 : m_xDocumentProperties(
std::move(xDocumentProperties))
374 , m_bUseLocalized(bUseLocalized)
386 OUString aExtension(
".xml");
387 if (aPath.endsWith(aExtension) && m_bUseLocalized)
389 std::u16string_view aBase = aPath.subView(0, aPath.getLength() - aExtension.getLength());
392 OUString
aLocalized = OUString::Concat(aBase) +
"_" + rLanguageTag.
getBcp47() + aExtension;
398 uno::Reference<io::XInputStream> xInputStream(
new utl::OStreamWrapper(std::move(pStream)));
399 xml::sax::InputSource aParserInput;
400 aParserInput.aInputStream = xInputStream;
402 uno::Reference<xml::sax::XParser> xParser = xml::sax::Parser::create(xComponentContext);
404 xParser->setDocumentHandler(xClassificationParser);
407 xParser->parseStream(aParserInput);
409 catch (
const xml::sax::SAXParseException&)
413 m_aCategories = xClassificationParser->m_aCategories;
414 m_aMarkings = xClassificationParser->m_aMarkings;
415 m_aIPParts = xClassificationParser->m_aIPParts;
416 m_aIPPartNumbers = xClassificationParser->m_aIPPartNumbers;
421 return std::any_of(rProperties.begin(), rProperties.end(), [&](
const beans::Property& rProperty)
423 return rProperty.Name == rName;
429 auto itCategory = m_aCategory.find(
eType);
430 if (itCategory == m_aCategory.end())
433 SfxClassificationCategory& rCategory = itCategory->second;
435 if (it != rCategory.m_aLabels.end())
437 if (it->second == PROP_NONE())
448 uno::Reference<beans::XPropertyContainer> xPropertyContainer = m_xDocumentProperties->getUserDefinedProperties();
449 uno::Reference<beans::XPropertySet> xPropertySet(xPropertyContainer, uno::UNO_QUERY);
450 uno::Sequence<beans::Property>
aProperties = xPropertySet->getPropertySetInfo()->getProperties();
451 for (
auto& rPair : m_aCategory)
454 SfxClassificationCategory& rCategory = rPair.second;
455 std::map<OUString, OUString> aLabels = rCategory.m_aLabels;
457 for (
const auto& rLabel : aLabels)
462 xPropertySet->setPropertyValue(rLabel.first,
uno::Any(rLabel.second));
464 xPropertyContainer->addProperty(rLabel.first, beans::PropertyAttribute::REMOVABLE,
uno::Any(rLabel.second));
466 catch (
const uno::Exception&)
468 TOOLS_WARN_EXCEPTION(
"sfx.view",
"pushDocumentProperties() failed for property " << rLabel.first);
476 uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties();
477 if (!xPropertyContainer.is())
480 uno::Reference<beans::XPropertySet> xPropertySet(xPropertyContainer, uno::UNO_QUERY);
481 const uno::Sequence<beans::Property>
aProperties = xPropertySet->getPropertySetInfo()->getProperties();
482 for (
const beans::Property& rProperty :
aProperties)
484 if (rProperty.Name.startsWith(
"urn:bails:"))
492 const uno::Reference<document::XDocumentProperties>& xDestination)
533 VclMessageType::Info, VclButtonsType::Ok,
534 SfxResId(STR_TARGET_DOC_NOT_CLASSIFIED)));
545 VclMessageType::Info, VclButtonsType::Ok,
546 SfxResId(STR_DOC_CLASSIFICATION_TOO_LOW)));
558 :
m_pImpl(
std::make_unique<
Impl>(xDocumentProperties, bUseLocalizedPolicy))
560 if (!xDocumentProperties.is())
563 uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties();
564 if (!xPropertyContainer.is())
567 uno::Reference<beans::XPropertySet> xPropertySet(xPropertyContainer, uno::UNO_QUERY);
568 const uno::Sequence<beans::Property>
aProperties = xPropertySet->getPropertySetInfo()->getProperties();
569 for (
const beans::Property& rProperty :
aProperties)
571 if (!rProperty.Name.startsWith(
"urn:bails:"))
574 uno::Any aAny = xPropertySet->getPropertyValue(rProperty.Name);
580 if (!rProperty.Name.startsWith(aPrefix))
585 if (rProperty.Name == Concat2View(aPrefix + PROP_BACNAME()))
588 m_pImpl->m_aCategory[
eType].m_aLabels[rProperty.Name] = aValue;
607 return m_pImpl->m_aIPPartNumbers;
617 for (
const auto& category :
m_pImpl->m_aCategories)
619 if (category.m_aName == sFullName)
620 return category.m_aAbbreviatedName;
628 if (sIdentifier.empty())
631 for (
const auto& category :
m_pImpl->m_aCategories)
633 if (category.m_aIdentifier == sIdentifier)
634 return category.m_aName;
642 size_t nFirstConfidentiality = 0;
643 size_t nSecondConfidentiality = 0;
644 for (
const auto& category :
m_pImpl->m_aCategories)
646 if (category.m_aName ==
first)
647 nFirstConfidentiality = category.m_nConfidentiality;
648 if (category.m_aName == second)
649 nSecondConfidentiality = category.m_nConfidentiality;
652 return nFirstConfidentiality >= nSecondConfidentiality ?
first : second;
658 if (itCategory ==
m_pImpl->m_aCategory.end())
661 SfxClassificationCategory& rCategory = itCategory->second;
663 if (it == rCategory.m_aLabels.end())
667 return it != rCategory.m_aLabels.end();
673 if (itCategory ==
m_pImpl->m_aCategory.end())
676 SfxClassificationCategory& rCategory = itCategory->second;
678 return it != rCategory.m_aLabels.end() && !it->second.isEmpty();
684 if (itCategory ==
m_pImpl->m_aCategory.end())
687 SfxClassificationCategory& rCategory = itCategory->second;
689 return it != rCategory.m_aLabels.end() && !it->second.isEmpty();
699 if (itCategory ==
m_pImpl->m_aCategory.end())
702 SfxClassificationCategory& rCategory = itCategory->second;
704 if (it == rCategory.m_aLabels.end())
706 OUString aScale = it->second;
709 if (it == rCategory.m_aLabels.end())
711 OUString aLevel = it->second;
714 if (aScale ==
"UK-Cabinet")
718 else if (aLevel ==
"1")
720 else if (aLevel ==
"2")
722 else if (aLevel ==
"3")
725 else if (aScale ==
"FIPS-199")
729 else if (aLevel ==
"Moderate")
731 else if (aLevel ==
"High")
742 if (itCategory ==
m_pImpl->m_aCategory.end())
745 SfxClassificationCategory& rCategory = itCategory->second;
747 if (it == rCategory.m_aLabels.end())
749 OUString aScale = it->second;
752 if (it == rCategory.m_aLabels.end())
754 OUString aLevel = it->second;
756 if (aScale ==
"UK-Cabinet")
758 sal_Int32
nValue = aLevel.toInt32();
759 if (nValue < 0 || nValue > 3)
763 else if (aScale ==
"FIPS-199")
765 static std::map<OUString, sal_Int32>
const aValues
771 auto itValues = aValues.find(aLevel);
772 if (itValues == aValues.end())
774 nRet = itValues->second;
783 if (itCategory ==
m_pImpl->m_aCategory.end())
786 SfxClassificationCategory& rCategory = itCategory->second;
788 if (it != rCategory.m_aLabels.end())
797 if (itCategory ==
m_pImpl->m_aCategory.end())
800 SfxClassificationCategory& rCategory = itCategory->second;
802 if (it != rCategory.m_aLabels.end())
810 if (
m_pImpl->m_aCategories.empty())
813 std::vector<OUString> aRet;
814 std::transform(
m_pImpl->m_aCategories.begin(),
m_pImpl->m_aCategories.end(), std::back_inserter(aRet), [](
const SfxClassificationCategory& rCategory)
816 return rCategory.m_aName;
823 if (
m_pImpl->m_aCategories.empty())
826 std::vector<OUString> aRet;
827 std::transform(
m_pImpl->m_aCategories.begin(),
m_pImpl->m_aCategories.end(), std::back_inserter(aRet), [](
const SfxClassificationCategory& rCategory)
829 return rCategory.m_aIdentifier;
836 if (
m_pImpl->m_aCategories.empty())
839 std::vector<OUString> aRet;
840 std::transform(
m_pImpl->m_aCategories.begin(),
m_pImpl->m_aCategories.end(), std::back_inserter(aRet), [](
const SfxClassificationCategory& rCategory)
842 return rCategory.m_aAbbreviatedName;
849 if (
m_pImpl->m_aCategories.empty())
852 auto it = std::find_if(
m_pImpl->m_aCategories.begin(),
m_pImpl->m_aCategories.end(), [&](
const SfxClassificationCategory& rCategory)
854 return rCategory.m_aName == rName;
856 if (it ==
m_pImpl->m_aCategories.end())
858 SAL_WARN(
"sfx.view",
"'" << rName <<
"' is not a recognized category name");
863 m_pImpl->m_aCategory[
eType].m_aAbbreviatedName = it->m_aAbbreviatedName;
864 m_pImpl->m_aCategory[
eType].m_nConfidentiality = it->m_nConfidentiality;
867 for (
const auto& rLabel : it->m_aLabels)
868 m_pImpl->m_aCategory[
eType].m_aLabels[rPrefix + rLabel.first] = rLabel.second;
871 m_pImpl->pushToDocumentProperties();
883 if (!aBACName.isEmpty() && bImpactLevel)
885 OUString aMessage =
SfxResId(STR_CLASSIFIED_DOCUMENT);
886 aMessage = aMessage.replaceFirst(
"%1", aBACName);
908 return PROP_PREFIX_EXPORTCONTROL();
910 return PROP_PREFIX_NATIONALSECURITY();
920 static const OUString sProp(
"Marking:document-header");
926 static const OUString sProp(
"Marking:document-footer");
932 static const OUString sProp(
"Marking:document-watermark");
938 static const OUString sProp(
"urn:bails:IntellectualProperty:");
946 sal_Int32 nPolicyTypeNumber = officecfg::Office::Common::Classification::Policy::get();
957OUString
getProperty(uno::Reference<beans::XPropertyContainer>
const& rxPropertyContainer,
958 OUString
const& rName)
962 uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY);
963 return xPropertySet->getPropertyValue(rName).get<OUString>();
965 catch (
const css::uno::Exception&)
978 if (sValue.isEmpty())
981 return (sValue ==
"BAF_POLICY")
PropertiesInfo aProperties
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static bool IsHeadlessModeEnabled()
css::util::DateTime GetUNODateTime() const
const OUString & getBcp47(bool bResolveSystem=true) const
Implementation details of SfxClassificationHelper.
void setStartValidity(SfxClassificationPolicyType eType)
Set the classification start date to the system time.
std::vector< SfxClassificationCategory > m_aCategories
Possible categories of a policy to choose from.
std::vector< OUString > m_aMarkings
std::vector< OUString > m_aIPPartNumbers
Impl(uno::Reference< document::XDocumentProperties > xDocumentProperties, bool bUseLocalized)
std::map< SfxClassificationPolicyType, SfxClassificationCategory > m_aCategory
Selected categories, one category for each policy type.
uno::Reference< document::XDocumentProperties > m_xDocumentProperties
void pushToDocumentProperties()
Synchronize m_aLabels back to the document properties.
std::vector< OUString > m_aIPParts
Shared code to handle Business Authorization Identification and Labeling Scheme (BAILS) properties.
bool HasDocumentFooter()
The selected category has some content for the document footer.
InfobarType GetImpactLevelType()
static const OUString & PROP_DOCFOOTER()
Brief text located at the bottom of each document's pages.
bool HasDocumentHeader()
The selected category has some content for the document header.
static bool IsClassified(const css::uno::Reference< css::document::XDocumentProperties > &xDocumentProperties)
Does the document have any BAILS properties?
std::vector< OUString > const & GetIntellectualPropertyParts() const
OUString GetHigherClass(const OUString &first, const OUString &second)
Returns the class with the higher priority (based on sensitivity).
static SfxClassificationPolicyType getPolicyType()
OUString GetImpactScale()
Comparing the GetImpactLevel() result is only meaningful when the impact scale is the same.
std::vector< OUString > const & GetIntellectualPropertyPartNumbers() const
const OUString & GetBACName(SfxClassificationPolicyType eType) const
Get the currently selected category for eType.
static bool ShowPasteInfo(SfxClassificationCheckPasteResult eResult)
Wrapper around CheckPaste(): informs the user if necessary and finds out if the paste can be continue...
OUString GetDocumentWatermark()
std::vector< OUString > GetBACIdentifiers()
Return all possible valid category identifiers, based on the policy.
sal_Int32 GetImpactLevel()
Larger value means more confidential.
bool HasImpactLevel()
If GetImpactScale() and GetImpactLevel*() will return something meaningful.
const OUString & GetAbbreviatedBACName(const OUString &sFullName)
Get the currently selected category abbreviation for eType. Returns full name if no abbreviation defi...
~SfxClassificationHelper()
std::unique_ptr< Impl > m_pImpl
OUString GetBACNameForIdentifier(std::u16string_view sIdentifier)
Get the currently selected category for the identifier.
SfxClassificationHelper(const css::uno::Reference< css::document::XDocumentProperties > &xDocumentProperties, bool bUseLocalizedPolicy=true)
static const OUString & PROP_DOCHEADER()
Brief text located at the top of each document's pages.
std::vector< OUString > const & GetMarkings() const
static SfxClassificationPolicyType stringToPolicyType(std::u16string_view rType)
Does a best-effort conversion of rType to SfxClassificationPolicyType.
std::vector< OUString > GetAbbreviatedBACNames()
Return all possible valid abbreviated category names, based on the policy.
void SetBACName(const OUString &rName, SfxClassificationPolicyType eType)
Setting this sets all the other properties, based on the policy.
static SfxClassificationCheckPasteResult CheckPaste(const css::uno::Reference< css::document::XDocumentProperties > &xSource, const css::uno::Reference< css::document::XDocumentProperties > &xDestination)
Checks if pasting from xSource to xDestination would leak information.
void UpdateInfobar(SfxViewFrame &rViewFrame)
static const OUString & PROP_DOCWATERMARK()
Brief text formatted as a watermark on each document's page.
std::vector< OUString > GetBACNames()
Return all possible valid category names, based on the policy.
static const OUString & policyTypeToString(SfxClassificationPolicyType eType)
Returns the string representation of a SfxClassificationPolicyType element.
static const OUString & PROP_PREFIX_INTELLECTUALPROPERTY()
Get the property prefix for the IntellectualProperty policy type.
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
void RemoveInfoBar(std::u16string_view sId)
VclPtr< SfxInfoBarWindow > AppendInfoBar(const OUString &sId, const OUString &sPrimaryMessage, const OUString &sSecondaryMessage, InfobarType aInfobarType, bool bShowCloseButton=true)
Append a new InfoBar (see https://wiki.documentfoundation.org/Design/Whiteboards/Infobar).
const OUString & GetClassificationPath() const
static bool lcl_containsProperty(const uno::Sequence< beans::Property > &rProperties, std::u16string_view rName)
SfxClassificationPolicyType
Specifies a policy type, to be used with SetBACName(). Getters always use IntellectualProperty for no...
SfxClassificationCheckPasteResult
Return code of SfxClassificationHelper::CheckPaste().
@ DocClassificationTooLow
OUString makeCreationOriginKey() const
Classification creation origin key.
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
#define TOOLS_WARN_EXCEPTION(area, stream)
const std::pair< sal_uInt16, TranslateId > aLocalized[]
#define SAL_WARN(area, stream)
SVL_DLLPUBLIC bool IsDocument(const OUString &rURL)
Reference< XComponentContext > getProcessComponentContext()
constexpr OUStringLiteral first
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
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...
SVX_DLLPUBLIC OUString getProperty(css::uno::Reference< css::beans::XPropertyContainer > const &rxPropertyContainer, OUString const &rName)
OUString toISO8601(const css::util::DateTime &rDateTime)
OUString SfxResId(TranslateId aId)