diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-06-15 21:10:10 +0100 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2024-06-16 22:54:07 +0200 |
commit | 28e8907bfb3b87730e7efb3a805dc9e20b08c0f1 (patch) | |
tree | b6d185da231185efc711f14c127c4d00ff40c26c | |
parent | 672b28b2c62efdfe584822d31a5d57d11aa9f99f (diff) |
Resolves: tdf#159741 canceling printing results in 'modified' document
Change-Id: I627487a79f819351ec38e34b3fac432c36670d7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168932
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
-rw-r--r-- | sfx2/source/view/viewprn.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 6e646c9b1581..e1bc2c4ec915 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -68,6 +68,7 @@ class SfxPrinterController : public vcl::PrinterController, public SfxListener mutable Reference<awt::XDevice> mxDevice; SfxViewShell* mpViewShell; SfxObjectShell* mpObjectShell; + bool m_bJobStarted; bool m_bOrigStatus; bool m_bNeedsChange; bool m_bApi; @@ -114,6 +115,7 @@ SfxPrinterController::SfxPrinterController( const VclPtr<Printer>& i_rPrinter, , mpLastPrinter( nullptr ) , mpViewShell( pView ) , mpObjectShell(nullptr) + , m_bJobStarted( false ) , m_bOrigStatus( false ) , m_bNeedsChange( false ) , m_bApi(i_bApi) @@ -291,6 +293,8 @@ void SfxPrinterController::jobStarted() if ( !mpObjectShell ) return; + m_bJobStarted = true; + m_bOrigStatus = mpObjectShell->IsEnableSetModified(); // check configuration: shall update of printing information in DocInfo set the document to "modified"? @@ -348,10 +352,13 @@ void SfxPrinterController::jobFinished( css::view::PrintableState nState ) } case view::PrintableState_JOB_ABORTED : { - // printing not successful, reset DocInfo - uno::Reference<document::XDocumentProperties> xDocProps(mpObjectShell->getDocProperties()); - xDocProps->setPrintedBy(m_aLastPrintedBy); - xDocProps->setPrintDate(m_aLastPrinted); + // printing not successful, reset DocInfo if the job started and so DocInfo was modified + if (m_bJobStarted) + { + uno::Reference<document::XDocumentProperties> xDocProps(mpObjectShell->getDocProperties()); + xDocProps->setPrintedBy(m_aLastPrintedBy); + xDocProps->setPrintDate(m_aLastPrinted); + } break; } |