summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2001-09-19 13:44:24 +0000
committerMathias Bauer <mba@openoffice.org>2001-09-19 13:44:24 +0000
commit8c89361074847152d8522a95ff4bbc37040a3bca (patch)
treee4b64045dbc1c34f09a49e3cd470b9006ca510d3
parentd5160c67e1c5cd26225f8e11dafc2e8c864c9825 (diff)
#62832#: user may want his document unmodified by printing
-rw-r--r--sfx2/source/view/prnmon.cxx21
-rw-r--r--sfx2/source/view/viewprn.cxx27
2 files changed, 44 insertions, 4 deletions
diff --git a/sfx2/source/view/prnmon.cxx b/sfx2/source/view/prnmon.cxx
index 5f39bd422927..d8bd79b1954f 100644
--- a/sfx2/source/view/prnmon.cxx
+++ b/sfx2/source/view/prnmon.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: prnmon.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dv $ $Date: 2001-07-03 12:18:09 $
+ * last change: $Author: mba $ $Date: 2001-09-19 14:42:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,8 @@
#include <svtools/asynclink.hxx>
#endif
+#include <svtools/printoptions.hxx>
+
#pragma hdrstop
#include "prnmon.hxx"
@@ -117,6 +119,8 @@ struct SfxPrintProgress_Impl
BOOL bShow;
BOOL bCallbacks;
BOOL bOldEnablePrintFile;
+ BOOL bOldFlag;
+ BOOL bRestoreFlag;
svtools::AsynchronLink aDeleteLink;
private:
@@ -169,6 +173,8 @@ SfxPrintProgress_Impl::SfxPrintProgress_Impl( SfxViewShell* pTheViewShell,
bCancel ( FALSE ),
bCallbacks ( FALSE ),
bOldEnablePrintFile ( FALSE ),
+ bOldFlag ( TRUE ),
+ bRestoreFlag ( FALSE ),
nLastPage ( 0 ),
aDeleteLink ( STATIC_LINK( this, SfxPrintProgress_Impl, DeleteHdl ) )
@@ -241,6 +247,13 @@ SfxPrintProgress::SfxPrintProgress( SfxViewShell* pViewSh, FASTBOOL bShow )
pImp->pViewShell->GetViewFrame()->GetFrame()->Lock_Impl(TRUE);
pImp->bShow = bShow;
Lock();
+ if ( !SvtPrinterOptions().IsModifyDocumentOnPrintingAllowed() )
+ {
+ pImp->bRestoreFlag = TRUE;
+ pImp->bOldFlag = pViewSh->GetObjectShell()->IsEnableSetModified();
+ if ( pImp->bOldFlag )
+ pViewSh->GetObjectShell()->EnableSetModified( FALSE );
+ }
}
//--------------------------------------------------------------------
@@ -311,6 +324,8 @@ IMPL_LINK_INLINE_START( SfxPrintProgress, PrintErrorNotify, void *, pvoid )
pImp->pPrinter->AbortJob();
InfoBox( pImp->GetViewShell()->GetWindow(),
String( SfxResId(STR_ERROR_PRINT) ) ).Execute();
+ if ( pImp->bRestoreFlag && pImp->pViewShell->GetObjectShell()->IsEnableSetModified() != pImp->bOldFlag )
+ pImp->pViewShell->GetObjectShell()->EnableSetModified( pImp->bOldFlag );
return 0;
}
IMPL_LINK_INLINE_END( SfxPrintProgress, PrintErrorNotify, void *, pvoid )
@@ -367,6 +382,8 @@ IMPL_LINK( SfxPrintProgress, EndPrintNotify, void *, pvoid )
pImp->bRunning = FALSE;
}
+ if ( pImp->bRestoreFlag && pImp->pViewShell->GetObjectShell()->IsEnableSetModified() != pImp->bOldFlag )
+ pImp->pViewShell->GetObjectShell()->EnableSetModified( TRUE );
return 0;
}
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index e5eafac1c269..cf59587fcfc2 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewprn.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: pb $ $Date: 2001-08-20 13:35:46 $
+ * last change: $Author: mba $ $Date: 2001-09-19 14:42:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,6 +91,7 @@
#include <app.hxx>
#endif
#include <svtools/useroptions.hxx>
+#include <svtools/printoptions.hxx>
#pragma hdrstop
#include "viewsh.hxx"
@@ -676,14 +677,29 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
if ( !pInfo->IsUseUserData() )
aUserName.Erase();
+ BOOL bOldFlag = pObjSh->IsEnableSetModified();
+ BOOL bDontModifyDoc = !SvtPrinterOptions().IsModifyDocumentOnPrintingAllowed();
+ if ( bDontModifyDoc && bOldFlag )
+ pObjSh->EnableSetModified( FALSE );
+
pInfo->SetPrinted( aUserName );
pObjSh->Broadcast( SfxDocumentInfoHint( pInfo ) );
+ if ( bDontModifyDoc && bOldFlag != pObjSh->IsEnableSetModified() )
+ pObjSh->EnableSetModified( bOldFlag );
+
ErrCode nError = DoPrint( pPrinter, pPrintDlg, bSilent );
if ( nError == PRINTER_OK )
{
+ bOldFlag = pObjSh->IsEnableSetModified();
+ if ( bDontModifyDoc && bOldFlag )
+ pObjSh->EnableSetModified( FALSE );
+
pObjSh->FlushDocInfo();
+ if ( bDontModifyDoc && bOldFlag != pObjSh->IsEnableSetModified() )
+ pObjSh->EnableSetModified( bOldFlag );
+
Invalidate( SID_PRINTDOC );
Invalidate( SID_PRINTDOCDIRECT );
Invalidate( SID_SETUPPRINTER );
@@ -697,9 +713,16 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
}
else
{
+ bOldFlag = pObjSh->IsEnableSetModified();
+ if ( bDontModifyDoc && bOldFlag )
+ pObjSh->EnableSetModified( FALSE );
+
pInfo->SetPrinted(aOldStamp);
pObjSh->Broadcast( SfxDocumentInfoHint( pInfo ) );
+ if ( bDontModifyDoc && bOldFlag != pObjSh->IsEnableSetModified() )
+ pObjSh->EnableSetModified( bOldFlag );
+
if ( nError != PRINTER_ABORT )
{
// Printer konnte nicht gestartet werden