diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-03-08 19:28:14 +0100 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Oracle.COM> | 2011-03-08 19:28:14 +0100 |
commit | 4a8b8ee334507f89ed7b918fda1678b213f6609b (patch) | |
tree | 529c7b217a9782f1bfced7a6a4d1ab5aa128f24c /sfx2 | |
parent | vcl120: #i114306# enforce setting a new document printer (diff) | |
download | core-4a8b8ee334507f89ed7b918fda1678b213f6609b.tar.gz core-4a8b8ee334507f89ed7b918fda1678b213f6609b.zip |
vcl120: #i115695# respond to a PrinterName property used by the application
Diffstat (limited to 'sfx2')
-rwxr-xr-x | sfx2/source/view/viewprn.cxx | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 50fe40dd9e0d..4c04ef0774e8 100755 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -80,13 +80,15 @@ class SfxPrinterController : public vcl::PrinterController, public SfxListener sal_Bool m_bOrigStatus; sal_Bool m_bNeedsChange; sal_Bool m_bApi; + sal_Bool m_bTempPrinter; util::DateTime m_aLastPrinted; ::rtl::OUString m_aLastPrintedBy; Sequence< beans::PropertyValue > getMergedOptions() const; const Any& getSelectionObject() const; public: - SfxPrinterController( const Any& i_rComplete, + SfxPrinterController( const boost::shared_ptr<Printer>& i_rPrinter, + const Any& i_rComplete, const Any& i_rSelection, const Any& i_rViewProp, const Reference< view::XRenderable >& i_xRender, @@ -105,7 +107,8 @@ public: virtual void jobFinished( com::sun::star::view::PrintableState ); }; -SfxPrinterController::SfxPrinterController( const Any& i_rComplete, +SfxPrinterController::SfxPrinterController( const boost::shared_ptr<Printer>& i_rPrinter, + const Any& i_rComplete, const Any& i_rSelection, const Any& i_rViewProp, const Reference< view::XRenderable >& i_xRender, @@ -113,7 +116,8 @@ SfxPrinterController::SfxPrinterController( const Any& i_rComplete, SfxViewShell* pView, const uno::Sequence< beans::PropertyValue >& rProps ) - : maCompleteSelection( i_rComplete ) + : PrinterController( i_rPrinter) + , maCompleteSelection( i_rComplete ) , maSelection( i_rSelection ) , mxRenderable( i_xRender ) , mpLastPrinter( NULL ) @@ -122,6 +126,7 @@ SfxPrinterController::SfxPrinterController( const Any& i_rComplete, , m_bOrigStatus( sal_False ) , m_bNeedsChange( sal_False ) , m_bApi(i_bApi) + , m_bTempPrinter( i_rPrinter.get() != NULL ) { if ( mpViewShell ) { @@ -339,7 +344,7 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt rBind.Invalidate( SID_PRINTDOC ); rBind.Invalidate( SID_PRINTDOCDIRECT ); rBind.Invalidate( SID_SETUPPRINTER ); - bCopyJobSetup = true; + bCopyJobSetup = ! m_bTempPrinter; break; } @@ -613,8 +618,21 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro aSelection <<= GetObjectShell()->GetModel(); Any aComplete( makeAny( GetObjectShell()->GetModel() ) ); Any aViewProp( makeAny( xController ) ); + boost::shared_ptr<Printer> aPrt; - boost::shared_ptr<vcl::PrinterController> pController( new SfxPrinterController( aComplete, + const beans::PropertyValue* pVal = rProps.getConstArray(); + for( sal_Int32 i = 0; i < rProps.getLength(); i++ ) + { + if( pVal[i].Name.equalsAscii( "PrinterName" ) ) + { + aPrt.reset( new Printer( pVal[i].Name ) ); + break; + } + } + + boost::shared_ptr<vcl::PrinterController> pController( new SfxPrinterController( + aPrt, + aComplete, aSelection, aViewProp, GetRenderable(), |