diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-18 09:16:30 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-18 08:52:27 +0000 |
commit | ff42ad90bae398285eb630c34be230a4f0619d68 (patch) | |
tree | 0fe566cc0e1234a554c0678b38a224b1ca60a357 /sw | |
parent | 433cb02f88c75428fe5a34ca090fd43ae1cc855d (diff) |
sfx2 classification: add Type parameter to the UNO command
So that sc/sd/sw doesn't have to hardcode
SfxClassificationPolicyType::IntellectualProperty.
Change-Id: Ib7c2376622ecaa8c7fc8401cec2ba16d12b8b8d2
Reviewed-on: https://gerrit.libreoffice.org/25078
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-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 |
3 files changed, 12 insertions, 4 deletions
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"); |