summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/inc/sfx2/viewsh.hxx7
-rwxr-xr-xsfx2/source/doc/printhelper.cxx20
-rw-r--r--sfx2/source/view/viewimp.hxx26
-rw-r--r--sfx2/source/view/viewprn.cxx10
4 files changed, 28 insertions, 35 deletions
diff --git a/sfx2/inc/sfx2/viewsh.hxx b/sfx2/inc/sfx2/viewsh.hxx
index 0109bbbf602d..8465a238cd5b 100644
--- a/sfx2/inc/sfx2/viewsh.hxx
+++ b/sfx2/inc/sfx2/viewsh.hxx
@@ -59,6 +59,7 @@ class SfxTabPage;
class SfxPrintMonitor;
class SfxFrameSetDescriptor;
class PrintDialog;
+class Printer;
class SfxPrinter;
class SfxProgress;
class SvStringsDtor;
@@ -149,6 +150,7 @@ class SFX2_DLLPUBLIC SfxViewShell: public SfxShell, public SfxListener
friend class SfxViewFrame;
friend class SfxPlugInFrame;
friend class SfxBaseController;
+friend class SfxPrinterController;
#endif
struct SfxViewShell_Impl* pImp;
@@ -188,10 +190,6 @@ public:
SfxViewShell( SfxViewFrame *pFrame, USHORT nFlags = 0 );
virtual ~SfxViewShell();
- // In-Place
- // should be superfluous
- //virtual SfxInPlaceClient* CreateIPClient( WorkWindow * pTop, WorkWindow * pDoc, Window * pDraw );
-
SfxInPlaceClient* GetIPClient() const;
SfxInPlaceClient* GetUIActiveClient() const;
SfxInPlaceClient* FindIPClient( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, Window *pObjParentWin ) const;
@@ -250,6 +248,7 @@ public:
void LockPrinter( BOOL bLock = TRUE );
BOOL IsPrinterLocked() const;
virtual JobSetup GetJobSetup() const;
+ Printer* GetActivePrinter() const;
// Workingset
virtual void WriteUserData( String&, BOOL bBrowse = FALSE );
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 459a142b9129..82ba4d64a91b 100755
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -266,17 +266,23 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro
// object already disposed?
::vos::OGuard aGuard( Application::GetSolarMutex() );
- // Printer beschaffen
- SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ?
- SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0;
- if ( !pViewFrm )
- return uno::Sequence< beans::PropertyValue >();
+ // search for any view of this document that is currently printing
+ const Printer *pPrinter = NULL;
+ SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0;
+ SfxViewFrame* pFirst = pViewFrm;
+ while ( pViewFrm && !pPrinter )
+ {
+ pPrinter = pViewFrm->GetViewShell()->GetActivePrinter();
+ pViewFrm = SfxViewFrame::GetNext( *pViewFrm, m_pData->m_pObjectShell, 0, sal_False );
+ }
+
+ // if no view is printing currently, use the permanent SfxPrinter instance
+ if ( !pPrinter && pFirst )
+ pPrinter = pFirst->GetViewShell()->GetPrinter(sal_True);
- const SfxPrinter *pPrinter = pViewFrm->GetViewShell()->GetPrinter(sal_True);
if ( !pPrinter )
return uno::Sequence< beans::PropertyValue >();
- // Printer Eigenschaften uebertragen
uno::Sequence< beans::PropertyValue > aPrinter(8);
aPrinter.getArray()[7].Name = DEFINE_CONST_UNICODE( "CanSetPaperSize" );
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 69ce837fb023..1c9e219cf180 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -30,20 +30,16 @@
// include ---------------------------------------------------------------
-#ifndef __SBX_SBXOBJ_HXX
#include <basic/sbxobj.hxx>
-#endif
#include <sfx2/viewsh.hxx>
#include <sfx2/viewfrm.hxx> // SvBorder
#include <osl/mutex.hxx>
#include <cppuhelper/interfacecontainer.hxx>
-
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <svtools/acceleratorexecute.hxx>
-
#include <rtl/ref.hxx>
-
+#include <vcl/print.hxx>
#include <queue>
// forward ---------------------------------------------------------------
@@ -54,24 +50,6 @@ class SfxBaseController;
typedef SfxShell* SfxShellPtr_Impl;
SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 )
-// struct SfxViewShell_Impl ----------------------------------------------
-#if 0
-class SfxAsyncPrintExec_Impl : public SfxListener
-{
- SfxViewShell* pView;
- ::std::queue < SfxRequest*> aReqs;
-
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
-
-public:
- SfxAsyncPrintExec_Impl( SfxViewShell* pShell)
- : pView( pShell )
- {}
-
- void AddRequest( SfxRequest& rReq );
-};
-#endif
-
class SfxClipboardChangeListener;
struct SfxViewShell_Impl
@@ -95,9 +73,9 @@ struct SfxViewShell_Impl
USHORT nFamily;
SfxBaseController* pController;
::svt::AcceleratorExecute* pAccExec;
-// SfxAsyncPrintExec_Impl* pPrinterCommandQueue;
com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts;
::rtl::Reference< SfxClipboardChangeListener > xClipboardListener;
+ vcl::PrinterController* pPrinterController;
SfxViewShell_Impl();
};
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 2d5403b72abd..4d9016d81f6b 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -329,6 +329,9 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
if ( m_bNeedsChange )
mpObjectShell->EnableSetModified( m_bOrigStatus );
+
+ if ( mpViewShell )
+ mpViewShell->pImp->pPrinterController = 0;
}
}
@@ -639,6 +642,8 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro
this,
rProps
) );
+ pImp->pPrinterController = pController.get();
+
SfxObjectShell *pObjShell = GetObjectShell();
pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ),
makeAny( rtl::OUString( pObjShell->GetTitle(0) ) ) );
@@ -653,6 +658,11 @@ void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rPro
Printer::PrintJob( pController, aJobSetup );
}
+Printer* SfxViewShell::GetActivePrinter() const
+{
+ return pImp->pPrinterController ? pImp->pPrinterController->getPrinter().get() : 0;
+}
+
void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
{
// USHORT nCopies=1;