diff options
-rw-r--r-- | include/sfx2/classificationhelper.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 8 | ||||
-rw-r--r-- | sfx2/sdi/sfx.sdi | 2 | ||||
-rw-r--r-- | sfx2/source/view/classificationhelper.cxx | 10 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 9 |
8 files changed, 39 insertions, 7 deletions
diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx index de889fef34b0..6497d08323a8 100644 --- a/include/sfx2/classificationhelper.hxx +++ b/include/sfx2/classificationhelper.hxx @@ -76,6 +76,8 @@ public: /// The selected category has some content for the document footer. bool HasDocumentFooter(); void UpdateInfobar(SfxViewFrame& rViewFrame); + /// Does a best-effort conversion of rType to SfxClassificationPolicyType. + static SfxClassificationPolicyType stringToPolicyType(const OUString& rType); /// Brief text located at the top of each document's pages. static const OUString& PROP_DOCHEADER(); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 4bec4fbb58b2..b7af7e0ec8ae 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -974,7 +974,13 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) { const OUString& rName = static_cast<const SfxStringItem*>(pItem)->GetValue(); SfxClassificationHelper aHelper(pDocSh->getDocProperties()); - aHelper.SetBACName(rName, SfxClassificationPolicyType::IntellectualProperty); + auto eType = SfxClassificationPolicyType::IntellectualProperty; + if (pArgs->GetItemState(SID_TYPE_NAME, false, &pItem) == SfxItemState::SET) + { + const OUString& rType = static_cast<const SfxStringItem*>(pItem)->GetValue(); + eType = SfxClassificationHelper::stringToPolicyType(rType); + } + aHelper.SetBACName(rName, eType); } else SAL_WARN("sc.ui", "missing parameter for SID_CLASSIFICATION_APPLY"); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index d3bf56761e22..40606950f007 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1151,12 +1151,18 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if (pArgs && pArgs->GetItemState(nSId, false, &pItem) == SfxItemState::SET) { const OUString& rName = static_cast<const SfxStringItem*>(pItem)->GetValue(); + auto eType = SfxClassificationPolicyType::IntellectualProperty; + if (pArgs->GetItemState(SID_TYPE_NAME, false, &pItem) == SfxItemState::SET) + { + const OUString& rType = static_cast<const SfxStringItem*>(pItem)->GetValue(); + eType = SfxClassificationHelper::stringToPolicyType(rType); + } if (SfxViewFrame* pViewFrame = GetViewFrame()) { if (SfxObjectShell* pObjectShell = pViewFrame->GetObjectShell()) { SfxClassificationHelper aHelper(pObjectShell->getDocProperties()); - aHelper.SetBACName(rName, SfxClassificationPolicyType::IntellectualProperty); + aHelper.SetBACName(rName, eType); } } } diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index ee791052d446..2c80801384f2 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -4388,7 +4388,7 @@ SfxBoolItem StyleWatercanMode SID_STYLE_WATERCAN ] SfxVoidItem ClassificationApply SID_CLASSIFICATION_APPLY -(SfxStringItem Name SID_CLASSIFICATION_APPLY) +(SfxStringItem Name SID_CLASSIFICATION_APPLY, SfxStringItem Type SID_TYPE_NAME) [ AutoUpdate = FALSE, FastCall = FALSE, diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index bb6febe015c9..c8d2715f3d2a 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -745,6 +745,16 @@ void SfxClassificationHelper::UpdateInfobar(SfxViewFrame& rViewFrame) } } +SfxClassificationPolicyType SfxClassificationHelper::stringToPolicyType(const OUString& rType) +{ + if (rType == PROP_PREFIX_EXPORTCONTROL()) + return SfxClassificationPolicyType::ExportControl; + else if (rType == PROP_PREFIX_NATIONALSECURITY()) + return SfxClassificationPolicyType::NationalSecurity; + else + return SfxClassificationPolicyType::IntellectualProperty; +} + const OUString& SfxClassificationHelper::PROP_DOCHEADER() { static OUString sProp("Marking:document-header"); diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index ccc323105681..47d472b8c942 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -99,6 +99,7 @@ class SwAuthEntry; class SwRewriter; struct SwConversionArgs; enum class SvtScriptType; +enum class SfxClassificationPolicyType; namespace com { namespace sun { namespace star { namespace uno { template < class > class Sequence; }}}} @@ -359,7 +360,7 @@ public: SwCharFormat* GetCharFormatFromPool( sal_uInt16 nId ) { return static_cast<SwCharFormat*>(SwEditShell::GetFormatFromPool( nId )); } - void SetClassification(const OUString& rName); + void SetClassification(const OUString& rName, SfxClassificationPolicyType eType); void Insert2(SwField&, const bool bForceExpandHints = false); diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index ee6d2428d340..0093c4006347 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -171,7 +171,7 @@ SwTextFormatColl& SwEditShell::GetTextFormatColl( sal_uInt16 nFormatColl) const return *((*(GetDoc()->GetTextFormatColls()))[nFormatColl]); } -void SwEditShell::SetClassification(const OUString& rName) +void SwEditShell::SetClassification(const OUString& rName, SfxClassificationPolicyType eType) { SwDocShell* pDocShell = GetDoc()->GetDocShell(); if (!pDocShell) @@ -182,7 +182,7 @@ void SwEditShell::SetClassification(const OUString& rName) bool bHadWatermark = !aHelper.GetDocumentWatermark().isEmpty(); // This updates the infobar as well. - aHelper.SetBACName(rName, SfxClassificationPolicyType::IntellectualProperty); + aHelper.SetBACName(rName, eType); bool bHeaderIsNeeded = aHelper.HasDocumentHeader(); bool bFooterIsNeeded = aHelper.HasDocumentFooter(); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 83fca394af11..17dfe2330bdf 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -56,6 +56,7 @@ #include <editeng/langitem.hxx> #include <svx/fmshell.hxx> #include <sfx2/linkmgr.hxx> +#include <sfx2/classificationhelper.hxx> #include <svtools/htmlcfg.hxx> #include <svx/ofaitem.hxx> @@ -1145,7 +1146,13 @@ void SwDocShell::Execute(SfxRequest& rReq) { SwWrtShell* pSh = GetWrtShell(); const OUString& rValue = static_cast<const SfxStringItem*>(pItem)->GetValue(); - pSh->SetClassification(rValue); + auto eType = SfxClassificationPolicyType::IntellectualProperty; + if (pArgs->GetItemState(SID_TYPE_NAME, false, &pItem) == SfxItemState::SET) + { + const OUString& rType = static_cast<const SfxStringItem*>(pItem)->GetValue(); + eType = SfxClassificationHelper::stringToPolicyType(rType); + } + pSh->SetClassification(rValue, eType); } else SAL_WARN("sw.ui", "missing parameter for SID_CLASSIFICATION_APPLY"); |