summaryrefslogtreecommitdiff
path: root/sw/source/uibase/app
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-12-16 12:11:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-12-16 21:17:15 +0000
commit1726c27e0d633ab04843834d2bf987bc7645807f (patch)
tree7810a18cd5bc3bf5aa345b816b372d93bd323974 /sw/source/uibase/app
parent1ae71d8f09771ba7180be6ebdf89d36a31eb8625 (diff)
check SfxObjectShell::Current()
SfxObjectShell::Current() can return null, it's based on the equally vile SfxViewFrame::Current() Change-Id: Ia5c7783680e9d8e5d3075078f16a2c15cb6f7a47 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144339 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/app')
-rw-r--r--sw/source/uibase/app/docsh2.cxx50
1 files changed, 26 insertions, 24 deletions
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index ef3c607444e5..bc9647d77dd7 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -1223,36 +1223,38 @@ void SwDocShell::Execute(SfxRequest& rReq)
}
break;
case SID_CLASSIFICATION_DIALOG:
- {
- auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), false);
+ if (SfxObjectShell* pObjSh = SfxObjectShell::Current())
+ {
+ auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), pObjSh->getDocProperties(), false);
- SwWrtShell* pShell = GetWrtShell();
- std::vector<svx::ClassificationResult> aInput = pShell->CollectAdvancedClassification();
- xDialog->setupValues(std::move(aInput));
+ SwWrtShell* pShell = GetWrtShell();
+ std::vector<svx::ClassificationResult> aInput = pShell->CollectAdvancedClassification();
+ xDialog->setupValues(std::move(aInput));
- weld::DialogController::runAsync(xDialog, [xDialog, pShell](sal_Int32 nResult){
- if (RET_OK == nResult)
- pShell->ApplyAdvancedClassification(xDialog->getResult());
- });
- }
- break;
+ weld::DialogController::runAsync(xDialog, [xDialog, pShell](sal_Int32 nResult){
+ if (RET_OK == nResult)
+ pShell->ApplyAdvancedClassification(xDialog->getResult());
+ });
+ }
+ break;
case SID_PARAGRAPH_SIGN_CLASSIFY_DLG:
- {
- SwWrtShell* pShell = GetWrtShell();
- auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), true, [pShell]()
+ if (SfxObjectShell* pObjSh = SfxObjectShell::Current())
{
- pShell->SignParagraph();
- });
+ SwWrtShell* pShell = GetWrtShell();
+ auto xDialog = std::make_shared<svx::ClassificationDialog>(GetView()->GetFrameWeld(), pObjSh->getDocProperties(), true, [pShell]()
+ {
+ pShell->SignParagraph();
+ });
- std::vector<svx::ClassificationResult> aInput = pShell->CollectParagraphClassification();
- xDialog->setupValues(std::move(aInput));
+ std::vector<svx::ClassificationResult> aInput = pShell->CollectParagraphClassification();
+ xDialog->setupValues(std::move(aInput));
- weld::DialogController::runAsync(xDialog, [xDialog, pShell](sal_Int32 nResult){
- if (RET_OK == nResult)
- pShell->ApplyParagraphClassification(xDialog->getResult());
- });
- }
- break;
+ weld::DialogController::runAsync(xDialog, [xDialog, pShell](sal_Int32 nResult){
+ if (RET_OK == nResult)
+ pShell->ApplyParagraphClassification(xDialog->getResult());
+ });
+ }
+ break;
case SID_WATERMARK:
{
SwWrtShell* pSh = GetWrtShell();