diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-09-19 15:07:14 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-09-19 15:22:48 +0200 |
commit | 836e15d972b28efe3a0048d8162b0bd9b167c9c1 (patch) | |
tree | 763df33fdfc8c858b7d89dc77523fab0b34d7587 | |
parent | f13618c56a66d034ac5c8a0588ed4ec02608cba8 (diff) |
TSCP: synchronize document properties and classification dialog
Change-Id: Id22fdd9c5daf986afb917487910b0a32bcc0ee43
-rw-r--r-- | include/svx/ClassificationDialog.hxx | 6 | ||||
-rw-r--r-- | include/svx/ClassificationField.hxx | 9 | ||||
-rw-r--r-- | svx/source/dialog/ClassificationDialog.cxx | 69 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 265 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 15 |
6 files changed, 334 insertions, 33 deletions
diff --git a/include/svx/ClassificationDialog.hxx b/include/svx/ClassificationDialog.hxx index 2e678c68177a..7fb3d8f55d80 100644 --- a/include/svx/ClassificationDialog.hxx +++ b/include/svx/ClassificationDialog.hxx @@ -44,13 +44,17 @@ private: DECL_LINK(SelectIPPartNumbersHdl, ListBox&, void); DECL_LINK(DoubleClickIPPartHdl, ListBox&, void); + void insertField(ClassificationType eType, OUString const & rString); + public: - virtual short Execute() override; ClassificationDialog(vcl::Window* pParent); virtual ~ClassificationDialog() override; + + virtual short Execute() override; virtual void dispose() override; std::vector<ClassificationResult> getResult(); + void setupValues(std::vector<ClassificationResult> const & rInput); }; } // end svx namespace diff --git a/include/svx/ClassificationField.hxx b/include/svx/ClassificationField.hxx index df28d5cf7286..53237dae1921 100644 --- a/include/svx/ClassificationField.hxx +++ b/include/svx/ClassificationField.hxx @@ -13,13 +13,14 @@ #include <sal/config.h> #include <svx/svxdllapi.h> +#include <editeng/flditem.hxx> namespace svx { enum class ClassificationType { - CLASSIFICATION, - MARKINGS, + CATEGORY, + MARKING, TEXT, INTELLECTUAL_PROPERTY_PART }; @@ -47,8 +48,8 @@ public: return false; const ClassificationField& rOtherField = static_cast<const ClassificationField&>(rOther); - return (meType == rOtherField.meType) && - (msDescription == rOtherField.msDescription); + return (meType == rOtherField.meType && + msDescription == rOtherField.msDescription); } }; diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx index 9c4b10855fee..4690d7ca3b46 100644 --- a/svx/source/dialog/ClassificationDialog.cxx +++ b/svx/source/dialog/ClassificationDialog.cxx @@ -84,6 +84,50 @@ short ClassificationDialog::Execute() return ModalDialog::Execute(); } +void ClassificationDialog::insertField(ClassificationType eType, OUString const & rString) +{ + ClassificationField aField(eType, rString); + m_pEditWindow->InsertField(SvxFieldItem(aField, EE_FEATURE_FIELD)); +} + +void ClassificationDialog::setupValues(std::vector<ClassificationResult> const & rInput) +{ + for (ClassificationResult const & rClassificationResult : rInput) + { + switch (rClassificationResult.meType) + { + case svx::ClassificationType::TEXT: + { + m_pEditWindow->pEdView->InsertText(rClassificationResult.msString); + } + break; + + case svx::ClassificationType::CATEGORY: + { + m_pClassificationListBox->SelectEntry(rClassificationResult.msString); + insertField(rClassificationResult.meType, rClassificationResult.msString); + } + break; + + case svx::ClassificationType::MARKING: + { + m_pMarkingListBox->SelectEntry(rClassificationResult.msString); + insertField(rClassificationResult.meType, rClassificationResult.msString); + } + break; + + case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART: + { + insertField(rClassificationResult.meType, rClassificationResult.msString); + } + break; + + default: + break; + } + } +} + std::vector<ClassificationResult> ClassificationDialog::getResult() { std::vector<ClassificationResult> aClassificationResults; @@ -95,14 +139,18 @@ std::vector<ClassificationResult> ClassificationDialog::getResult() for (editeng::Section const & rSection : aSections) { - const SvxFieldItem* rField = findField(rSection); - if (rField) + const SvxFieldItem* pFieldItem = findField(rSection); + + ESelection aSelection(rSection.mnParagraph, rSection.mnStart, rSection.mnParagraph, rSection.mnEnd); + OUString sString = m_pEditWindow->pEdEngine->GetText(aSelection); + + if (pFieldItem) { + const ClassificationField* pClassificationField = dynamic_cast<const ClassificationField*>(pFieldItem->GetField()); + aClassificationResults.push_back({ pClassificationField->meType , sString, rSection.mnParagraph }); } else { - ESelection aSelection(rSection.mnParagraph, rSection.mnStart, rSection.mnParagraph, rSection.mnEnd); - OUString sString = m_pEditWindow->pEdEngine->GetText(aSelection); aClassificationResults.push_back({ ClassificationType::TEXT, sString, rSection.mnParagraph }); } } @@ -124,7 +172,7 @@ IMPL_LINK(ClassificationDialog, SelectClassificationHdl, ListBox&, rBox, void) if (pFieldItem) { const ClassificationField* pClassificationField = dynamic_cast<const ClassificationField*>(pFieldItem->GetField()); - if (pClassificationField && pClassificationField->meType == ClassificationType::CLASSIFICATION) + if (pClassificationField && pClassificationField->meType == ClassificationType::CATEGORY) { m_pEditWindow->pEdView->SetSelection(ESelection(rSection.mnParagraph, rSection.mnStart, rSection.mnParagraph, rSection.mnEnd)); } @@ -132,8 +180,7 @@ IMPL_LINK(ClassificationDialog, SelectClassificationHdl, ListBox&, rBox, void) } OUString aString = maHelper.GetBACNames()[nSelected]; - ClassificationField aField(ClassificationType::CLASSIFICATION, aString); - m_pEditWindow->InsertField(SvxFieldItem(aField, EE_FEATURE_FIELD)); + insertField(ClassificationType::CATEGORY, aString); } } @@ -152,7 +199,7 @@ IMPL_LINK(ClassificationDialog, SelectMarkingHdl, ListBox&, rBox, void) if (pFieldItem) { const ClassificationField* pClassificationField = dynamic_cast<const ClassificationField*>(pFieldItem->GetField()); - if (pClassificationField && pClassificationField->meType == ClassificationType::MARKINGS) + if (pClassificationField && pClassificationField->meType == ClassificationType::MARKING) { m_pEditWindow->pEdView->SetSelection(ESelection(rSection.mnParagraph, rSection.mnStart, rSection.mnParagraph, rSection.mnEnd)); } @@ -160,8 +207,7 @@ IMPL_LINK(ClassificationDialog, SelectMarkingHdl, ListBox&, rBox, void) } OUString aString = maHelper.GetMarkings()[nSelected]; - ClassificationField aField(ClassificationType::MARKINGS, aString); - m_pEditWindow->InsertField(SvxFieldItem(aField, EE_FEATURE_FIELD)); + insertField(ClassificationType::MARKING, aString); } } @@ -193,8 +239,7 @@ IMPL_LINK(ClassificationDialog, ButtonClicked, Button*, pButton, void) } else if (pButton == m_pIntellectualPropertyPartAddButton) { - ClassificationField aField(ClassificationType::INTELLECTUAL_PROPERTY_PART, m_pIntellectualPropertyPartEdit->GetText()); - m_pEditWindow->InsertField(SvxFieldItem(aField, EE_FEATURE_FIELD)); + insertField(ClassificationType::INTELLECTUAL_PROPERTY_PART, m_pIntellectualPropertyPartEdit->GetText()); } } diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index f8d40ddcd0ba..bda5d3216a48 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -34,6 +34,7 @@ #include <svtools/embedhlp.hxx> #include <editeng/swafopt.hxx> +#include <svx/ClassificationField.hxx> #include <vcl/font.hxx> @@ -367,6 +368,8 @@ public: { return static_cast<SwCharFormat*>(SwEditShell::GetFormatFromPool( nId )); } void SetClassification(const OUString& rName, SfxClassificationPolicyType eType); + void ApplyAdvancedClassification(std::vector<svx::ClassificationResult> const & rResult); + std::vector<svx::ClassificationResult> CollectAdvancedClassification(); SfxWatermarkItem GetWatermark(); void SetWatermark(const SfxWatermarkItem& rText); diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index d23828d35fa5..21de327476fd 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -78,25 +78,28 @@ #include <strings.hrc> #include <undobj.hxx> +#include <officecfg/Office/Common.hxx> +#include <com/sun/star/beans/PropertyAttribute.hpp> + #define WATERMARK_NAME "PowerPlusWaterMarkObject" namespace { /// Find all page styles which are currently used in the document. -std::set<OUString> lcl_getUsedPageStyles(SwViewShell const * pShell) +std::vector<OUString> lcl_getUsedPageStyles(SwViewShell const * pShell) { - std::set<OUString> aRet; + std::vector<OUString> aReturn; SwRootFrame* pLayout = pShell->GetLayout(); for (SwFrame* pFrame = pLayout->GetLower(); pFrame; pFrame = pFrame->GetNext()) { SwPageFrame* pPage = static_cast<SwPageFrame*>(pFrame); if (const SwPageDesc *pDesc = pPage->FindPageDesc()) - aRet.insert(pDesc->GetName()); + aReturn.push_back(pDesc->GetName()); } - return aRet; + return aReturn; } /// Search for a field named rFieldName of type rServiceName in xText. @@ -295,6 +298,254 @@ SwTextFormatColl& SwEditShell::GetTextFormatColl( sal_uInt16 nFormatColl) const return *((*(GetDoc()->GetTextFormatColls()))[nFormatColl]); } +OUString lcl_getProperty(uno::Reference<beans::XPropertyContainer>& rxPropertyContainer, const OUString& rName) +{ + uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY); + return xPropertySet->getPropertyValue(rName).get<OUString>(); +} + +bool lcl_containsProperty(const uno::Sequence<beans::Property>& rProperties, const OUString& rName) +{ + return std::find_if(rProperties.begin(), rProperties.end(), [&](const beans::Property& rProperty) + { + return rProperty.Name == rName; + }) != rProperties.end(); +} + +void lcl_removeAllProperties(uno::Reference<beans::XPropertyContainer>& rxPropertyContainer) +{ + uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY); + uno::Sequence<beans::Property> aProperties = xPropertySet->getPropertySetInfo()->getProperties(); + + for (const beans::Property& rProperty : aProperties) + { + rxPropertyContainer->removeProperty(rProperty.Name); + } +} + +// from classification helper +SfxClassificationPolicyType getPolicyType() +{ + sal_Int32 nPolicyTypeNumber = officecfg::Office::Common::Classification::Policy::get(); + auto eType = static_cast<SfxClassificationPolicyType>(nPolicyTypeNumber); + return eType; +} + +bool addOrInsertDocumentProperty(uno::Reference<beans::XPropertyContainer>& rxPropertyContainer, OUString const & rsKey, OUString const & rsValue) +{ + uno::Reference<beans::XPropertySet> xPropertySet(rxPropertyContainer, uno::UNO_QUERY); + + try + { + if (lcl_containsProperty(xPropertySet->getPropertySetInfo()->getProperties(), rsKey)) + xPropertySet->setPropertyValue(rsKey, uno::makeAny(rsValue)); + else + rxPropertyContainer->addProperty(rsKey, beans::PropertyAttribute::REMOVABLE, uno::makeAny(rsValue)); + } + catch (const uno::Exception& rException) + { + return false; + } + return true; +} + +void insertFieldToDocument(uno::Reference<lang::XMultiServiceFactory>& rxMultiServiceFactory, uno::Reference<text::XText>& rxText, OUString const & rsKey) +{ + const OUString aServiceName = "com.sun.star.text.TextField.DocInfo.Custom"; + if (!lcl_hasField(rxText, aServiceName, rsKey)) + { + uno::Reference<beans::XPropertySet> xField(rxMultiServiceFactory->createInstance(aServiceName), uno::UNO_QUERY); + xField->setPropertyValue(UNO_NAME_NAME, uno::makeAny(rsKey)); + uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY); + rxText->insertTextContent(rxText->getEnd(), xTextContent, false); + } +} + +void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationResult> const & rResults) +{ + SwDocShell* pDocShell = GetDoc()->GetDocShell(); + if (!pDocShell) + return; + + uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel(); + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); + + uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel, uno::UNO_QUERY); + + uno::Reference<document::XDocumentProperties> xDocumentProperties = SfxObjectShell::Current()->getDocProperties(); + + // Clear properties + uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties(); + lcl_removeAllProperties(xPropertyContainer); + + SfxClassificationHelper aHelper(xDocumentProperties); + + // Apply properties from the BA policy + for (svx::ClassificationResult const & rResult : rResults) + { + if (rResult.meType == svx::ClassificationType::CATEGORY) + { + aHelper.SetBACName(rResult.msString, getPolicyType()); + } + } + + OUString sPolicy = SfxClassificationHelper::policyTypeToString(getPolicyType()); + + std::vector<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this); + for (const OUString& rPageStyleName : aUsedPageStyles) + { + uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName(rPageStyleName), uno::UNO_QUERY); + + // HEADER + bool bHeaderIsOn = false; + xPageStyle->getPropertyValue(UNO_NAME_HEADER_IS_ON) >>= bHeaderIsOn; + if (!bHeaderIsOn) + xPageStyle->setPropertyValue(UNO_NAME_HEADER_IS_ON, uno::makeAny(true)); + uno::Reference<text::XText> xHeaderText; + xPageStyle->getPropertyValue(UNO_NAME_HEADER_TEXT) >>= xHeaderText; + + // FOOTER + bool bFooterIsOn = false; + xPageStyle->getPropertyValue(UNO_NAME_FOOTER_IS_ON) >>= bFooterIsOn; + if (!bFooterIsOn) + xPageStyle->setPropertyValue(UNO_NAME_FOOTER_IS_ON, uno::makeAny(true)); + uno::Reference<text::XText> xFooterText; + xPageStyle->getPropertyValue(UNO_NAME_FOOTER_TEXT) >>= xFooterText; + + sal_Int32 nTextNumber = 1; + + for (svx::ClassificationResult const & rResult : rResults) + { + switch(rResult.meType) + { + case svx::ClassificationType::TEXT: + { + OUString sKey = sPolicy + "Marking:Text:" + OUString::number(nTextNumber); + nTextNumber++; + + addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msString); + insertFieldToDocument(xMultiServiceFactory, xHeaderText, sKey); + insertFieldToDocument(xMultiServiceFactory, xFooterText, sKey); + } + break; + + case svx::ClassificationType::CATEGORY: + { + OUString sKey = sPolicy + "BusinessAuthorizationCategory:Name"; + insertFieldToDocument(xMultiServiceFactory, xHeaderText, sKey); + insertFieldToDocument(xMultiServiceFactory, xFooterText, sKey); + } + break; + + case svx::ClassificationType::MARKING: + { + OUString sKey = sPolicy + "Extension:Marking"; + addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msString); + insertFieldToDocument(xMultiServiceFactory, xHeaderText, sKey); + insertFieldToDocument(xMultiServiceFactory, xFooterText, sKey); + } + break; + + case svx::ClassificationType::INTELLECTUAL_PROPERTY_PART: + { + OUString sKey = sPolicy + "Extension:IntellectualPropertyPart"; + addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msString); + insertFieldToDocument(xMultiServiceFactory, xHeaderText, sKey); + insertFieldToDocument(xMultiServiceFactory, xFooterText, sKey); + } + break; + + default: + break; + } + } + } +} + +std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassification() +{ + std::vector<svx::ClassificationResult> aResult; + + SwDocShell* pDocShell = GetDoc()->GetDocShell(); + + if (!pDocShell) + return aResult; + + uno::Reference<frame::XModel> xModel = pDocShell->GetBaseModel(); + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); + + std::vector<OUString> aPageStyles = lcl_getUsedPageStyles(this); + OUString aPageStyleString = aPageStyles.back(); + uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName(aPageStyleString), uno::UNO_QUERY); + + bool bHeaderIsOn = false; + xPageStyle->getPropertyValue(UNO_NAME_HEADER_IS_ON) >>= bHeaderIsOn; + if (!bHeaderIsOn) + return aResult; + + uno::Reference<text::XText> xHeaderText; + xPageStyle->getPropertyValue(UNO_NAME_HEADER_TEXT) >>= xHeaderText; + + uno::Reference<container::XEnumerationAccess> xParagraphEnumerationAccess(xHeaderText, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xParagraphs = xParagraphEnumerationAccess->createEnumeration(); + + uno::Reference<document::XDocumentProperties> xDocumentProperties = SfxObjectShell::Current()->getDocProperties(); + uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties(); + + OUString sPolicy = SfxClassificationHelper::policyTypeToString(getPolicyType()); + sal_Int32 nParagraph = 1; + + while (xParagraphs->hasMoreElements()) + { + uno::Reference<container::XEnumerationAccess> xTextPortionEnumerationAccess(xParagraphs->nextElement(), uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xTextPortions = xTextPortionEnumerationAccess->createEnumeration(); + while (xTextPortions->hasMoreElements()) + { + uno::Reference<beans::XPropertySet> xTextPortion(xTextPortions->nextElement(), uno::UNO_QUERY); + OUString aTextPortionType; + xTextPortion->getPropertyValue(UNO_NAME_TEXT_PORTION_TYPE) >>= aTextPortionType; + if (aTextPortionType != UNO_NAME_TEXT_FIELD) + continue; + + uno::Reference<lang::XServiceInfo> xTextField; + xTextPortion->getPropertyValue(UNO_NAME_TEXT_FIELD) >>= xTextField; + if (!xTextField->supportsService("com.sun.star.text.TextField.DocInfo.Custom")) + continue; + + OUString aName; + uno::Reference<beans::XPropertySet> xPropertySet(xTextField, uno::UNO_QUERY); + xPropertySet->getPropertyValue(UNO_NAME_NAME) >>= aName; + if (aName.startsWith(sPolicy + "Marking:Text:")) + { + OUString aValue = lcl_getProperty(xPropertyContainer, aName); + aResult.push_back({ svx::ClassificationType::TEXT, aValue, nParagraph }); + } + else if (aName.startsWith(sPolicy + "BusinessAuthorizationCategory:Name")) + { + OUString aValue = lcl_getProperty(xPropertyContainer, aName); + aResult.push_back({ svx::ClassificationType::CATEGORY, aValue, nParagraph }); + } + else if (aName.startsWith(sPolicy + "Extension:Marking")) + { + OUString aValue = lcl_getProperty(xPropertyContainer, aName); + aResult.push_back({ svx::ClassificationType::MARKING, aValue, nParagraph }); + } + else if (aName.startsWith(sPolicy + "Extension:IntellectualPropertyPart")) + { + OUString aValue = lcl_getProperty(xPropertyContainer, aName); + aResult.push_back({ svx::ClassificationType::INTELLECTUAL_PROPERTY_PART, aValue, nParagraph }); + } + } + nParagraph++; + } + + return aResult; +} + void SwEditShell::SetClassification(const OUString& rName, SfxClassificationPolicyType eType) { SwDocShell* pDocShell = GetDoc()->GetDocShell(); @@ -321,7 +572,7 @@ void SwEditShell::SetClassification(const OUString& rName, SfxClassificationPoli uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); - std::set<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this); + std::vector<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this); for (const OUString& rPageStyleName : aUsedPageStyles) { uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName(rPageStyleName), uno::UNO_QUERY); @@ -414,7 +665,7 @@ SfxWatermarkItem SwEditShell::GetWatermark() uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(xModel, uno::UNO_QUERY); uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); - std::set<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this); + std::vector<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this); for (const OUString& rPageStyleName : aUsedPageStyles) { uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName(rPageStyleName), uno::UNO_QUERY); @@ -629,7 +880,7 @@ void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark) uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), uno::UNO_QUERY); - std::set<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this); + std::vector<OUString> aUsedPageStyles = lcl_getUsedPageStyles(this); for (const OUString& rPageStyleName : aUsedPageStyles) { uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName(rPageStyleName), uno::UNO_QUERY); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index dd837ca414ac..eae9c158ff91 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1167,17 +1167,14 @@ void SwDocShell::Execute(SfxRequest& rReq) case SID_CLASSIFICATION_DIALOG: { ScopedVclPtr<svx::ClassificationDialog> pDialog(VclPtr<svx::ClassificationDialog>::Create(nullptr)); - if (RET_OK == pDialog->Execute()) - { - SwDocShell* pDocShell = GetDoc()->GetDocShell(); - if (!pDocShell) - return; - for (svx::ClassificationResult const & rResult : pDialog->getResult()) - { + SwWrtShell* pShell = GetWrtShell(); + std::vector<svx::ClassificationResult> aInput = pShell->CollectAdvancedClassification(); + pDialog->setupValues(aInput); + + if (RET_OK == pDialog->Execute()) + pShell->ApplyAdvancedClassification(pDialog->getResult()); - } - } pDialog.disposeAndClear(); } break; |