summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/appopen.cxx2
-rw-r--r--sfx2/source/control/shell.cxx2
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx4
-rw-r--r--sfx2/source/doc/objcont.cxx79
-rwxr-xr-xsfx2/source/doc/printhelper.cxx92
-rw-r--r--sfx2/source/view/makefile.mk3
-rw-r--r--sfx2/source/view/printer.cxx14
-rw-r--r--sfx2/source/view/prnmon.cxx6
-rw-r--r--sfx2/source/view/topfrm.cxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx14
-rw-r--r--sfx2/source/view/viewimp.hxx4
-rw-r--r--sfx2/source/view/viewprn.cxx816
-rw-r--r--sfx2/source/view/viewsh.cxx23
13 files changed, 561 insertions, 500 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index bf3cb633cf6a..469a198db64e 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -216,7 +216,7 @@ SfxObjectShellRef SfxApplication::DocAlreadyLoaded
SfxTopViewFrame *pFrame;
for( pFrame = (SfxTopViewFrame*)
SfxViewFrame::GetFirst( xDoc, TYPE(SfxTopViewFrame) );
- pFrame && !pFrame->IsVisible_Impl();
+ pFrame && !pFrame->IsVisible();
pFrame = (SfxTopViewFrame*)
SfxViewFrame::GetNext( *pFrame, xDoc, TYPE(SfxTopViewFrame) ) ) ;
if ( pFrame )
diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx
index 7c88c4bef24a..aee76353f1f3 100644
--- a/sfx2/source/control/shell.cxx
+++ b/sfx2/source/control/shell.cxx
@@ -1260,7 +1260,7 @@ long DispatcherUpdate_Impl( void*, void* pArg )
void SfxShell::UIFeatureChanged()
{
SfxViewFrame *pFrame = GetFrame();
- if ( pFrame && pFrame->IsVisible_Impl() )
+ if ( pFrame && pFrame->IsVisible() )
{
// Auch dann Update erzwingen, wenn Dispatcher schon geupdated ist,
// sonst bleibt evtl. irgendwas in den gebunkerten Tools stecken.
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 683aedcbf32f..f8a77e721533 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -801,7 +801,9 @@ IMPL_LINK( FileDialogHelper_Impl, TimeOutHdl_Impl, Timer*, EMPTYARG )
aData << aBmp;
- Sequence < sal_Int8 > aBuffer( (sal_Int8*) aData.GetData(), aData.GetSize() );
+ const Sequence < sal_Int8 > aBuffer(
+ static_cast< const sal_Int8* >(aData.GetData()),
+ aData.GetEndOfData() );
aAny <<= aBuffer;
}
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index 6883f0976566..8514ca9a917a 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -62,6 +62,7 @@
#include <unotools/useroptions.hxx>
#include <unotools/localfilehelper.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/oldprintadaptor.hxx>
#include <sfx2/app.hxx>
#include "sfxresid.hxx"
@@ -1031,26 +1032,18 @@ BOOL SfxObjectShell::Print
if ( !pStyle )
return TRUE;
- if ( !rPrt.StartJob(String(SfxResId(STR_STYLES))) )
- {
- delete pIter;
- return FALSE;
- }
- if ( !rPrt.StartPage() )
- {
- delete pIter;
- return FALSE;
- }
- Reference< task::XStatusIndicator > xStatusIndicator;
- xStatusIndicator = SFX_APP()->GetStatusIndicator();
- if ( xStatusIndicator.is() )
- xStatusIndicator->start( String(SfxResId(STR_PRINT_STYLES)), nStyles );
+ // pepare adaptor for old style StartPage/EndPage printing
+ boost::shared_ptr< Printer > pPrinter( new Printer( rPrt.GetJobSetup() ) );
+ vcl::OldStylePrintAdaptor* pAdaptor = new vcl::OldStylePrintAdaptor( pPrinter );
+ boost::shared_ptr< vcl::PrinterController > pController( pAdaptor );
- rPrt.SetMapMode(MapMode(MAP_10TH_MM));
+ pAdaptor->StartPage();
+
+ pPrinter->SetMapMode(MapMode(MAP_10TH_MM));
Font aFont( DEFINE_CONST_UNICODE( "Arial" ), Size(0, 64)); // 18pt
aFont.SetWeight(WEIGHT_BOLD);
- rPrt.SetFont(aFont);
- const Size aPageSize(rPrt.GetOutputSize());
+ pPrinter->SetFont(aFont);
+ const Size aPageSize(pPrinter->GetOutputSize());
const USHORT nXIndent = 200;
USHORT nYIndent = 200;
Point aOutPos(nXIndent, nYIndent);
@@ -1059,68 +1052,66 @@ BOOL SfxObjectShell::Print
aHeader += *pObjectName;
else
aHeader += GetTitle();
- long nTextHeight( rPrt.GetTextHeight() );
- rPrt.DrawText(aOutPos, aHeader);
+ long nTextHeight( pPrinter->GetTextHeight() );
+ pPrinter->DrawText(aOutPos, aHeader);
aOutPos.Y() += nTextHeight;
aOutPos.Y() += nTextHeight/2;
aFont.SetSize(Size(0, 35)); // 10pt
nStyles = 1;
while(pStyle)
{
- if ( xStatusIndicator.is() )
- xStatusIndicator->setValue( nStyles++ );
- // Ausgabe des Vorlagennamens
+ // print template name
String aStr(pStyle->GetName());
aFont.SetWeight(WEIGHT_BOLD);
- rPrt.SetFont(aFont);
- nTextHeight = rPrt.GetTextHeight();
- // Seitenwechsel
+ pPrinter->SetFont(aFont);
+ nTextHeight = pPrinter->GetTextHeight();
+ // check for new page
if ( aOutPos.Y() + nTextHeight*2 >
aPageSize.Height() - (long) nYIndent )
{
- rPrt.EndPage();
- rPrt.StartPage();
+ pAdaptor->EndPage();
+ pAdaptor->StartPage();
aOutPos.Y() = nYIndent;
}
- rPrt.DrawText(aOutPos, aStr);
+ pPrinter->DrawText(aOutPos, aStr);
aOutPos.Y() += nTextHeight;
- // Ausgabe der Vorlagenbeschreibung
+ // print template description
aFont.SetWeight(WEIGHT_NORMAL);
- rPrt.SetFont(aFont);
+ pPrinter->SetFont(aFont);
aStr = pStyle->GetDescription();
const char cDelim = ' ';
USHORT nStart = 0, nIdx = 0;
- nTextHeight = rPrt.GetTextHeight();
- // wie viele Worte passen auf eine Zeile
+ nTextHeight = pPrinter->GetTextHeight();
+ // break text into lines
while(nIdx < aStr.Len())
{
USHORT nOld = nIdx;
long nTextWidth;
nIdx = aStr.Search(cDelim, nStart);
- nTextWidth = rPrt.GetTextWidth(aStr, nStart, nIdx-nStart);
+ nTextWidth = pPrinter->GetTextWidth(aStr, nStart, nIdx-nStart);
while(nIdx != STRING_NOTFOUND &&
aOutPos.X() + nTextWidth <
aPageSize.Width() - (long) nXIndent)
{
nOld = nIdx;
nIdx = aStr.Search(cDelim, nIdx+1);
- nTextWidth = rPrt.GetTextWidth(aStr, nStart, nIdx-nStart);
+ nTextWidth = pPrinter->GetTextWidth(aStr, nStart, nIdx-nStart);
}
String aTmp(aStr, nStart, nIdx == STRING_NOTFOUND?
STRING_LEN :
nOld-nStart);
if ( aTmp.Len() )
{
- nStart = nOld+1; // wegen trailing space
+ nStart = nOld+1; // trailing space
}
else
{
USHORT nChar = 1;
while(
nStart + nChar < aStr.Len() &&
- aOutPos.X() + rPrt.GetTextWidth(
+ aOutPos.X() + pPrinter->GetTextWidth(
aStr, nStart, nChar) <
aPageSize.Width() - nXIndent)
++nChar;
@@ -1131,19 +1122,19 @@ BOOL SfxObjectShell::Print
if ( aOutPos.Y() + nTextHeight*2 >
aPageSize.Height() - nYIndent )
{
- rPrt.EndPage();
- rPrt.StartPage();
+ pAdaptor->EndPage();
+ pAdaptor->StartPage();
aOutPos.Y() = nYIndent;
}
- rPrt.DrawText(aOutPos, aTmp);
- aOutPos.Y() += rPrt.GetTextHeight();
+ pPrinter->DrawText(aOutPos, aTmp);
+ aOutPos.Y() += pPrinter->GetTextHeight();
}
pStyle = pIter->Next();
}
- rPrt.EndPage();
- rPrt.EndJob();
- if ( xStatusIndicator.is() )
- xStatusIndicator->end();
+ pAdaptor->EndPage();
+
+ Printer::PrintJob( pController, rPrt.GetJobSetup() );
+
delete pIter;
break;
}
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index d61bd4701e1b..103dcf505846 100755
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/view/DuplexMode.hpp>
#include <svl/lstner.hxx>
#include <svl/stritem.hxx>
@@ -148,8 +149,9 @@ Reference< ::com::sun::star::view::XPrintable > SAL_CALL SfxPrintJob_Impl::getPr
void SAL_CALL SfxPrintJob_Impl::cancelJob() throw (RuntimeException)
{
+ // FIXME: how to cancel PrintJob via API?!
if( m_pData->m_pObjectShell.Is() )
- m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( -2, NULL, NULL ) );
+ m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( -2 ) );
}
SfxPrintHelper::SfxPrintHelper()
@@ -590,7 +592,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
if ( !pView )
return;
- SfxAllItemSet aArgs( pView->GetPool() );
+// SfxAllItemSet aArgs( pView->GetPool() );
sal_Bool bMonitor = sal_False;
// We need this information at the end of this method, if we start the vcl printer
// by executing the slot. Because if it is a ucb relevant URL we must wait for
@@ -601,7 +603,10 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
String sUcbUrl;
::utl::TempFile* pUCBPrintTempFile = NULL;
- sal_Bool bWaitUntilEnd = sal_False;
+ uno::Sequence < beans::PropertyValue > aCheckedArgs( rOptions.getLength() );
+ sal_Int32 nProps = 0;
+ sal_Bool bWaitUntilEnd = sal_False;
+ sal_Int16 nDuplexMode = ::com::sun::star::view::DuplexMode::UNKNOWN;
for ( int n = 0; n < rOptions.getLength(); ++n )
{
// get Property-Value from options
@@ -634,10 +639,15 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
// converted its not an URL nor a system path. Then we can't accept
// this parameter and have to throw an exception.
::rtl::OUString sSystemPath(sTemp);
- ::rtl::OUString sFileURL ;
+ ::rtl::OUString sFileURL;
if (::osl::FileBase::getFileURLFromSystemPath(sSystemPath,sFileURL)!=::osl::FileBase::E_None)
throw ::com::sun::star::lang::IllegalArgumentException();
- aArgs.Put( SfxStringItem(SID_FILE_NAME,sTemp) );
+ aCheckedArgs[nProps].Name = rProp.Name;
+ aCheckedArgs[nProps++].Value <<= sFileURL;
+ // and append the local filename
+ aCheckedArgs.realloc( aCheckedArgs.getLength()+1 );
+ aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("LocalFileName");
+ aCheckedArgs[nProps++].Value <<= ::rtl::OUString( sTemp );
}
else
// It's a valid URL. but now we must know, if it is a local one or not.
@@ -648,7 +658,12 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
// And we have to use the system notation of the incoming URL.
// But it into the descriptor and let the slot be executed at
// the end of this method.
- aArgs.Put( SfxStringItem(SID_FILE_NAME,sPath) );
+ aCheckedArgs[nProps].Name = rProp.Name;
+ aCheckedArgs[nProps++].Value <<= sTemp;
+ // and append the local filename
+ aCheckedArgs.realloc( aCheckedArgs.getLength()+1 );
+ aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("LocalFileName");
+ aCheckedArgs[nProps++].Value <<= ::rtl::OUString( sPath );
}
else
{
@@ -663,7 +678,10 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
// a slot ...
pUCBPrintTempFile = new ::utl::TempFile();
pUCBPrintTempFile->EnableKillingFile();
- aArgs.Put( SfxStringItem(SID_FILE_NAME,pUCBPrintTempFile->GetFileName()) );
+
+ //FIXME: does it work?
+ aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("LocalFileName");
+ aCheckedArgs[nProps++].Value <<= ::rtl::OUString( pUCBPrintTempFile->GetFileName() );
sUcbUrl = sURL;
}
}
@@ -674,25 +692,22 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
sal_Int32 nCopies = 0;
if ( ( rProp.Value >>= nCopies ) == sal_False )
throw ::com::sun::star::lang::IllegalArgumentException();
- aArgs.Put( SfxInt16Item( SID_PRINT_COPIES, (USHORT) nCopies ) );
+
+ aCheckedArgs[nProps].Name = rProp.Name;
+ aCheckedArgs[nProps++].Value <<= nCopies;
}
// Collate-Property
- else if ( rProp.Name.compareToAscii( "Collate" ) == 0 )
+ // Sort-Property (deprecated)
+ else if ( rProp.Name.compareToAscii( "Collate" ) == 0 ||
+ ( rProp.Name.compareToAscii( "Sort" ) == 0 ) )
{
sal_Bool bTemp = sal_Bool();
if ( rProp.Value >>= bTemp )
- aArgs.Put( SfxBoolItem( SID_PRINT_COLLATE, bTemp ) );
- else
- throw ::com::sun::star::lang::IllegalArgumentException();
- }
-
- // Sort-Property
- else if ( rProp.Name.compareToAscii( "Sort" ) == 0 )
- {
- sal_Bool bTemp = sal_Bool();
- if( rProp.Value >>= bTemp )
- aArgs.Put( SfxBoolItem( SID_PRINT_SORT, bTemp ) );
+ {
+ aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("Collate");
+ aCheckedArgs[nProps++].Value <<= bTemp;
+ }
else
throw ::com::sun::star::lang::IllegalArgumentException();
}
@@ -702,7 +717,10 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
{
OUSTRING sTemp;
if( rProp.Value >>= sTemp )
- aArgs.Put( SfxStringItem( SID_PRINT_PAGES, String( sTemp ) ) );
+ {
+ aCheckedArgs[nProps].Name = rProp.Name;
+ aCheckedArgs[nProps++].Value <<= sTemp;
+ }
else
throw ::com::sun::star::lang::IllegalArgumentException();
}
@@ -712,26 +730,36 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
{
if( !(rProp.Value >>= bMonitor) )
throw ::com::sun::star::lang::IllegalArgumentException();
+ aCheckedArgs[nProps].Name = rProp.Name;
+ aCheckedArgs[nProps++].Value <<= bMonitor;
}
- // MonitorVisible
+ // Wait
else if ( rProp.Name.compareToAscii( "Wait" ) == 0 )
{
if ( !(rProp.Value >>= bWaitUntilEnd) )
throw ::com::sun::star::lang::IllegalArgumentException();
+ aCheckedArgs[nProps].Name = rProp.Name;
+ aCheckedArgs[nProps++].Value <<= bWaitUntilEnd;
+ }
+
+ else if ( rProp.Name.compareToAscii( "DuplexMode" ) == 0 )
+ {
+ if ( !(rProp.Value >>= nDuplexMode ) )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ aCheckedArgs[nProps].Name = rProp.Name;
+ aCheckedArgs[nProps++].Value <<= nDuplexMode;
}
}
+ if ( nProps != aCheckedArgs.getLength() )
+ aCheckedArgs.realloc(nProps);
+
// Execute the print request every time.
// It doesn'tmatter if it is a real printer used or we print to a local file
// nor if we print to a temp file and move it afterwards by using the ucb.
// That will be handled later. see pUCBPrintFile below!
- aArgs.Put( SfxBoolItem( SID_SILENT, !bMonitor ) );
- if ( bWaitUntilEnd )
- aArgs.Put( SfxBoolItem( SID_ASYNCHRON, sal_False ) );
- SfxRequest aReq( SID_PRINTDOC, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_API, pView->GetPool() );
- aReq.SetArgs( aArgs );
- pView->ExecuteSlot( aReq );
+ pView->ExecPrint( aCheckedArgs, sal_True, sal_False );
// Ok - may be execution before has finished (or started!) printing.
// And may it was a printing to a file.
@@ -764,11 +792,11 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin
SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint );
if ( pPrintHint )
{
- if ( pPrintHint->GetWhich() == -1 ) // -1 : Initialisation of PrintOptions
+ if ( pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_STARTED )
{
if ( !m_xPrintJob.is() )
m_xPrintJob = new SfxPrintJob_Impl( this );
-
+/*
PrintDialog* pDlg = pPrintHint->GetPrintDialog();
Printer* pPrinter = pPrintHint->GetPrinter();
::rtl::OUString aPrintFile ( ( pPrinter && pPrinter->IsPrintFileEnabled() ) ? pPrinter->GetPrintFile() : String() );
@@ -805,7 +833,10 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin
m_aPrintOptions[nArgs-1].Name = DEFINE_CONST_UNICODE("FileName");
m_aPrintOptions[nArgs-1].Value <<= aPrintFile;
}
+*/
+ m_aPrintOptions = pPrintHint->GetOptions();
}
+/*
else if ( pPrintHint->GetWhich() == -3 ) // -3 : AdditionalPrintOptions
{
uno::Sequence < beans::PropertyValue >& lOldOpts = m_aPrintOptions;
@@ -839,6 +870,7 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin
// at least one new options has overwritten an old one, so we allocated too much
lOldOpts.realloc( nTotal );
}
+*/
else if ( pPrintHint->GetWhich() != -2 ) // -2 : CancelPrintJob
{
view::PrintJobEvent aEvent;
diff --git a/sfx2/source/view/makefile.mk b/sfx2/source/view/makefile.mk
index 98d34215e097..cad12052720c 100644
--- a/sfx2/source/view/makefile.mk
+++ b/sfx2/source/view/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -54,7 +54,6 @@ SLOFILES = \
$(SLO)$/frmload.obj \
$(SLO)$/frame.obj \
$(SLO)$/printer.obj \
- $(SLO)$/prnmon.obj \
$(SLO)$/viewprn.obj \
$(SLO)$/viewfac.obj \
$(SLO)$/orgmgr.obj \
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index 1ea49ecd879b..2b7f89eac7c4 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -546,14 +546,17 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog( Window *pParent,
// TabPage einh"angen
pPage = pViewSh->CreatePrintOptionsPage( this, *pOptions );
DBG_ASSERT( pPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" );
- pPage->Reset( *pOptions );
- SetHelpId( pPage->GetHelpId() );
- pPage->Show();
+ if( pPage )
+ {
+ pPage->Reset( *pOptions );
+ SetHelpId( pPage->GetHelpId() );
+ pPage->Show();
+ }
// Dialoggr"o\se bestimmen
Size a6Sz = LogicToPixel( Size( 6, 6 ), MAP_APPFONT );
Size aBtnSz = LogicToPixel( Size( 50, 14 ), MAP_APPFONT );
- Size aOutSz( pPage->GetSizePixel() );
+ Size aOutSz( pPage ? pPage->GetSizePixel() : Size() );
aOutSz.Height() += 6;
long nWidth = aBtnSz.Width();
nWidth += a6Sz.Width();
@@ -589,6 +592,9 @@ SfxPrintOptionsDialog::~SfxPrintOptionsDialog()
short SfxPrintOptionsDialog::Execute()
{
+ if( ! pPage )
+ return RET_CANCEL;
+
short nRet = ModalDialog::Execute();
if ( nRet == RET_OK )
pPage->FillItemSet( *pOptions );
diff --git a/sfx2/source/view/prnmon.cxx b/sfx2/source/view/prnmon.cxx
index f875143bfab0..de075647ab48 100644
--- a/sfx2/source/view/prnmon.cxx
+++ b/sfx2/source/view/prnmon.cxx
@@ -274,10 +274,12 @@ SfxPrintProgress::SfxPrintProgress( SfxViewShell* pViewSh, FASTBOOL bShow )
String(SfxResId(STR_PRINTING)), 1, FALSE ),
pImp( new SfxPrintProgress_Impl( pViewSh, pViewSh->GetPrinter() ) )
{
+ #if 0
pImp->pPrinter->SetEndPrintHdl( LINK( this, SfxPrintProgress, EndPrintNotify ) );
pImp->pPrinter->SetErrorHdl( LINK( this, SfxPrintProgress, PrintErrorNotify ) );
pImp->pPrinter->SetStartPrintHdl( LINK( this, SfxPrintProgress, StartPrintNotify ) );
pImp->bCallbacks = TRUE;
+ #endif
SfxObjectShell* pDoc = pViewSh->GetObjectShell();
SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_HIDDEN, FALSE );
@@ -307,7 +309,7 @@ SfxPrintProgress::~SfxPrintProgress()
// ggf. Callbacks entfermen
if ( pImp->bCallbacks )
{
- pImp->pPrinter->SetEndPrintHdl( Link() );
+ // pImp->pPrinter->SetEndPrintHdl( Link() );
pImp->pPrinter->SetErrorHdl( Link() );
pImp->bCallbacks = FALSE;
}
@@ -410,7 +412,7 @@ IMPL_LINK( SfxPrintProgress, EndPrintNotify, void *, EMPTYARG )
//! if( pMDI->IsPrinterChanged() ) pMDI->Changed( 0L );
// Callbacks rausnehmen
- pImp->pPrinter->SetEndPrintHdl( Link() );
+ // pImp->pPrinter->SetEndPrintHdl( Link() );
pImp->pPrinter->SetErrorHdl( Link() );
pImp->bCallbacks = FALSE;
diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx
index f3596de6b1c2..6f5c2ffcc3eb 100644
--- a/sfx2/source/view/topfrm.cxx
+++ b/sfx2/source/view/topfrm.cxx
@@ -370,7 +370,7 @@ void SfxTopViewWin_Impl::StateChanged( StateChangedType nStateChange )
if ( nStateChange == STATE_CHANGE_INITSHOW )
{
SfxObjectShell* pDoc = pFrame->GetObjectShell();
- if ( pDoc && !pFrame->IsVisible_Impl() )
+ if ( pDoc && !pFrame->IsVisible() )
pFrame->Show();
pFrame->Resize();
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 945419189b78..ba87f0fc33ca 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1331,7 +1331,7 @@ String SfxViewFrame::UpdateTitle()
// Name des SbxObjects
String aSbxName = pObjSh->SfxShell::GetName();
- if ( IsVisible_Impl() )
+ if ( IsVisible() )
{
aSbxName += ':';
aSbxName += String::CreateFromInt32(pImp->nDocViewNo);
@@ -1801,7 +1801,7 @@ sal_uInt16 SfxViewFrame::Count(TypeId aType)
{
SfxViewFrame *pFrame = rFrames[i];
if ( ( !aType || pFrame->IsA(aType) ) &&
- pFrame->IsVisible_Impl() )
+ pFrame->IsVisible() )
++nFound;
}
return nFound;
@@ -1825,7 +1825,7 @@ SfxViewFrame* SfxViewFrame::GetFirst
SfxViewFrame *pFrame = rFrames.GetObject(nPos);
if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) &&
( !aType || pFrame->IsA(aType) ) &&
- ( !bOnlyIfVisible || pFrame->IsVisible_Impl()) )
+ ( !bOnlyIfVisible || pFrame->IsVisible()) )
return pFrame;
}
@@ -1857,7 +1857,7 @@ SfxViewFrame* SfxViewFrame::GetNext
SfxViewFrame *pFrame = rFrames.GetObject(nPos);
if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) &&
( !aType || pFrame->IsA(aType) ) &&
- ( !bOnlyIfVisible || pFrame->IsVisible_Impl()) )
+ ( !bOnlyIfVisible || pFrame->IsVisible()) )
return pFrame;
}
return 0;
@@ -1870,7 +1870,7 @@ void SfxViewFrame::CloseHiddenFrames_Impl()
for ( sal_uInt16 nPos=0; nPos<rFrames.Count(); )
{
SfxViewFrame *pFrame = rFrames.GetObject(nPos);
- if ( !pFrame->IsVisible_Impl() )
+ if ( !pFrame->IsVisible() )
pFrame->DoClose();
else
nPos++;
@@ -2142,7 +2142,7 @@ void SfxViewFrame::Show()
}
//--------------------------------------------------------------------
-sal_Bool SfxViewFrame::IsVisible_Impl() const
+sal_Bool SfxViewFrame::IsVisible() const
{
//Window *pWin = pImp->bInCtor ? 0 : &GetWindow();
//return GetFrame()->HasComponent() || pImp->bObjLocked || ( pWin && pWin->IsVisible() );
@@ -2172,7 +2172,7 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus )
{
if ( GetViewShell() && !GetFrame()->IsClosing_Impl() )
{
- if ( IsVisible_Impl() )
+ if ( IsVisible() )
{
if ( GetViewShell() )
{
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 97f86ee1f395..9e3791340daa 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -58,6 +58,7 @@ 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;
@@ -72,6 +73,7 @@ public:
void AddRequest( SfxRequest& rReq );
};
+#endif
class SfxClipboardChangeListener;
@@ -98,7 +100,7 @@ struct SfxViewShell_Impl
USHORT nFamily;
SfxBaseController* pController;
::svt::AcceleratorExecute* pAccExec;
- SfxAsyncPrintExec_Impl* pPrinterCommandQueue;
+// SfxAsyncPrintExec_Impl* pPrinterCommandQueue;
com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts;
::rtl::Reference< SfxClipboardChangeListener > xClipboardListener;
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index e4a53a8a6e7a..24d31337a662 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -33,16 +33,12 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/view/PrintableState.hpp>
+#include "com/sun/star/view/XRenderable.hpp"
+
#include <svl/itempool.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
-#ifndef _SV_PRINTDLG_HXX //autogen
#include <svtools/printdlg.hxx>
-#endif
-#ifndef _SV_PRNSETUP_HXX //autogen
#include <svtools/prnsetup.hxx>
-#endif
#include <svl/flagitem.hxx>
#include <svl/stritem.hxx>
#include <svl/intitem.hxx>
@@ -51,9 +47,9 @@
#include <unotools/useroptions.hxx>
#include <unotools/printwarningoptions.hxx>
#include <tools/datetime.hxx>
-
+#include <sfx2/bindings.hxx>
+#include <sfx2/objface.hxx>
#include <sfx2/viewsh.hxx>
-#include <sfx2/dispatch.hxx>
#include "viewimp.hxx"
#include <sfx2/viewfrm.hxx>
#include <sfx2/prnmon.hxx>
@@ -65,50 +61,282 @@
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
+#include "toolkit/awt/vclxdevice.hxx"
+
#include "view.hrc"
#include "helpid.hrc"
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
TYPEINIT1(SfxPrintingHint, SfxHint);
// -----------------------------------------------------------------------
+class SfxPrinterController : public vcl::PrinterController, public SfxListener
+{
+ Any maCompleteSelection;
+ Any maSelection;
+ Reference< view::XRenderable > mxRenderable;
+ mutable Printer* mpLastPrinter;
+ mutable Reference<awt::XDevice> mxDevice;
+ SfxViewShell* mpViewShell;
+ SfxObjectShell* mpObjectShell;
+ sal_Bool m_bOrigStatus;
+ sal_Bool m_bNeedsChange;
+ sal_Bool m_bApi;
+ util::DateTime m_aLastPrinted;
+ ::rtl::OUString m_aLastPrintedBy;
-void SfxAsyncPrintExec_Impl::AddRequest( SfxRequest& rReq )
+ Sequence< beans::PropertyValue > getMergedOptions() const;
+ const Any& getSelectionObject() const;
+public:
+ SfxPrinterController( const Any& i_rComplete,
+ const Any& i_rSelection,
+ const Any& i_rViewProp,
+ const Reference< view::XRenderable >& i_xRender,
+ sal_Bool i_bApi, sal_Bool i_bDirect,
+ SfxViewShell* pView,
+ const uno::Sequence< beans::PropertyValue >& rProps
+ );
+
+ virtual ~SfxPrinterController();
+ virtual void Notify( SfxBroadcaster&, const SfxHint& );
+
+ virtual int getPageCount() const;
+ virtual Sequence< beans::PropertyValue > getPageParameters( int i_nPage ) const;
+ virtual void printPage( int i_nPage ) const;
+ virtual void jobStarted();
+ virtual void jobFinished( com::sun::star::view::PrintableState );
+};
+
+SfxPrinterController::SfxPrinterController( const Any& i_rComplete,
+ const Any& i_rSelection,
+ const Any& i_rViewProp,
+ const Reference< view::XRenderable >& i_xRender,
+ sal_Bool i_bApi, sal_Bool i_bDirect,
+ SfxViewShell* pView,
+ const uno::Sequence< beans::PropertyValue >& rProps
+ )
+ : maCompleteSelection( i_rComplete )
+ , maSelection( i_rSelection )
+ , mxRenderable( i_xRender )
+ , mpLastPrinter( NULL )
+ , mpViewShell( pView )
+ , mpObjectShell(0)
+ , m_bOrigStatus( sal_False )
+ , m_bNeedsChange( sal_False )
+ , m_bApi(i_bApi)
{
- if ( rReq.GetArgs() )
+ if ( mpViewShell )
{
- // only queue API requests
- if ( aReqs.empty() )
- StartListening( *pView->GetObjectShell() );
+ StartListening( *mpViewShell );
+ mpObjectShell = mpViewShell->GetObjectShell();
+ StartListening( *mpObjectShell );
+ m_bOrigStatus = mpObjectShell->IsEnableSetModified();
+
+ // check configuration: shall update of printing information in DocInfo set the document to "modified"?
+ if ( m_bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() )
+ {
+ mpObjectShell->EnableSetModified( sal_False );
+ m_bNeedsChange = sal_True;
+ }
+
+ // refresh document info
+ uno::Reference<document::XDocumentProperties> xDocProps(mpObjectShell->getDocProperties());
+ m_aLastPrintedBy = xDocProps->getPrintedBy();
+ m_aLastPrinted = xDocProps->getPrintDate();
+
+ xDocProps->setPrintedBy( mpObjectShell->IsUseUserData()
+ ? ::rtl::OUString( SvtUserOptions().GetFullName() )
+ : ::rtl::OUString() );
+ ::DateTime now;
+
+ xDocProps->setPrintDate( util::DateTime(
+ now.Get100Sec(), now.GetSec(), now.GetMin(), now.GetHour(),
+ now.GetDay(), now.GetMonth(), now.GetYear() ) );
+ }
- aReqs.push( new SfxRequest( rReq ) );
+ // initialize extra ui options
+ if( mxRenderable.is() )
+ {
+ for (sal_Int32 nProp=0; nProp<rProps.getLength(); nProp++)
+ setValue( rProps[nProp].Name, rProps[nProp].Value );
+
+ Sequence< beans::PropertyValue > aRenderOptions( 3 );
+ aRenderOptions[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExtraPrintUIOptions" ) );
+ aRenderOptions[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "View" ) );
+ aRenderOptions[1].Value = i_rViewProp;
+ aRenderOptions[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) );
+ aRenderOptions[2].Value <<= sal_True;
+ Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) );
+ int nProps = aRenderParms.getLength();
+ for( int i = 0; i < nProps; i++ )
+ {
+ if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) )
+ {
+ Sequence< beans::PropertyValue > aUIProps;
+ aRenderParms[i].Value >>= aUIProps;
+ setUIOptions( aUIProps );
+ break;
+ }
+ }
}
+
+ // set some job parameters
+ setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsApi" ) ), makeAny( i_bApi ) );
+ setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDirect" ) ), makeAny( i_bDirect ) );
+ setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) ), makeAny( sal_True ) );
+ setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "View" ) ), i_rViewProp );
}
-void SfxAsyncPrintExec_Impl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+void SfxPrinterController::Notify( SfxBroadcaster& , const SfxHint& rHint )
{
- if ( &rBC == pView->GetObjectShell() )
+ if ( rHint.IsA(TYPE(SfxSimpleHint)) )
{
- SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint );
- if ( pPrintHint && pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_COMPLETED )
+ if ( ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
{
- while ( aReqs.front() )
+ EndListening(*mpViewShell);
+ EndListening(*mpObjectShell);
+ mpViewShell = 0;
+ mpObjectShell = 0;
+ }
+ }
+}
+
+SfxPrinterController::~SfxPrinterController()
+{
+}
+
+const Any& SfxPrinterController::getSelectionObject() const
+{
+ sal_Int32 nChoice = 0;
+ sal_Bool bSel = sal_False;
+ const beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) );
+ if( pVal )
+ pVal->Value >>= nChoice;
+ pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) ) );
+ if( pVal )
+ pVal->Value >>= bSel;
+ return (nChoice > 1 || bSel) ? maSelection : maCompleteSelection;
+}
+
+Sequence< beans::PropertyValue > SfxPrinterController::getMergedOptions() const
+{
+ boost::shared_ptr<Printer> pPrinter( getPrinter() );
+ if( pPrinter.get() != mpLastPrinter )
+ {
+ mpLastPrinter = pPrinter.get();
+ VCLXDevice* pXDevice = new VCLXDevice();
+ pXDevice->SetOutputDevice( mpLastPrinter );
+ mxDevice = Reference< awt::XDevice >( pXDevice );
+ }
+
+ Sequence< beans::PropertyValue > aRenderOptions( 1 );
+ aRenderOptions[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) );
+ aRenderOptions[ 0 ].Value <<= mxDevice;
+
+ aRenderOptions = getJobProperties( aRenderOptions );
+ return aRenderOptions;
+}
+
+int SfxPrinterController::getPageCount() const
+{
+ int nPages = 0;
+ boost::shared_ptr<Printer> pPrinter( getPrinter() );
+ if( mxRenderable.is() && pPrinter )
+ {
+ Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() );
+ nPages = mxRenderable->getRendererCount( getSelectionObject(), aJobOptions );
+ }
+ return nPages;
+}
+
+Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_nPage ) const
+{
+ boost::shared_ptr<Printer> pPrinter( getPrinter() );
+ Sequence< beans::PropertyValue > aResult;
+
+ if( mxRenderable.is() && pPrinter )
+ {
+ Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() );
+ aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions );
+ }
+ return aResult;
+}
+
+void SfxPrinterController::printPage( int i_nPage ) const
+{
+ boost::shared_ptr<Printer> pPrinter( getPrinter() );
+ if( mxRenderable.is() && pPrinter )
+ {
+ Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() );
+ try
+ {
+ mxRenderable->render( i_nPage, getSelectionObject(), aJobOptions );
+ }
+ catch( lang::IllegalArgumentException& )
+ {
+ // don't care enough about nonexistant page here
+ // to provoke a crash
+ }
+ }
+}
+
+void SfxPrinterController::jobStarted()
+{
+ if ( mpObjectShell )
+ {
+ // FIXME: how to get all print options incl. AdditionalOptions easily?
+ uno::Sequence < beans::PropertyValue > aOpts;
+ mpObjectShell->Broadcast( SfxPrintingHint( view::PrintableState_JOB_STARTED, aOpts ) );
+ }
+}
+
+void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nState )
+{
+ if ( mpObjectShell )
+ {
+ mpObjectShell->Broadcast( SfxPrintingHint( nState ) );
+ switch ( nState )
+ {
+ case view::PrintableState_JOB_FAILED :
{
- SfxRequest* pReq = aReqs.front();
- aReqs.pop();
- pView->GetViewFrame()->GetDispatcher()->Execute( pReq->GetSlot(), SFX_CALLMODE_ASYNCHRON, *pReq->GetArgs() );
- USHORT nSlot = pReq->GetSlot();
- delete pReq;
- if ( nSlot == SID_PRINTDOC || nSlot == SID_PRINTDOCDIRECT )
- // print jobs must be executed before the next command can be dispatched
- break;
+ // "real" problem (not simply printing cancelled by user)
+ String aMsg( SfxResId( STR_NOSTARTPRINTER ) );
+ if ( !m_bApi )
+ ErrorBox( mpViewShell->GetWindow(), WB_OK | WB_DEF_OK, aMsg ).Execute();
+ // intentionally no break
+ }
+ case view::PrintableState_JOB_ABORTED :
+ {
+ // printing not succesful, reset DocInfo
+ uno::Reference<document::XDocumentProperties> xDocProps(mpObjectShell->getDocProperties());
+ xDocProps->setPrintedBy(m_aLastPrintedBy);
+ xDocProps->setPrintDate(m_aLastPrinted);
+ break;
}
- if ( aReqs.empty() )
- EndListening( *pView->GetObjectShell() );
+ case view::PrintableState_JOB_SPOOLED :
+ case view::PrintableState_JOB_COMPLETED :
+ {
+ SfxBindings& rBind = mpViewShell->GetViewFrame()->GetBindings();
+ rBind.Invalidate( SID_PRINTDOC );
+ rBind.Invalidate( SID_PRINTDOCDIRECT );
+ rBind.Invalidate( SID_SETUPPRINTER );
+ break;
+ }
+
+ default:
+ break;
}
+
+ if ( m_bNeedsChange )
+ mpObjectShell->EnableSetModified( m_bOrigStatus );
}
}
+// -----------------------------------------------------------------------
+
void DisableRanges( PrintDialog& rDlg, SfxPrinter* pPrinter )
/* [Beschreibung]
@@ -391,68 +619,137 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
#pragma optimize ( "", off )
#endif
-class SfxPrintGuard_Impl
+void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rProps, sal_Bool bIsAPI, sal_Bool bIsDirect )
{
- SfxObjectShell* m_pObjectShell;
- sal_Bool m_bOrigStatus;
- sal_Bool m_bNeedsChange;
-
-public:
- SfxPrintGuard_Impl( SfxObjectShell* pObjectShell )
- : m_pObjectShell( pObjectShell )
- , m_bOrigStatus( sal_False )
- , m_bNeedsChange( sal_False )
- {
- if ( m_pObjectShell )
- {
- m_bOrigStatus = m_pObjectShell->IsEnableSetModified();
+ // get the current selection; our controller should know it
+ Reference< frame::XController > xController( GetController() );
+ Reference< view::XSelectionSupplier > xSupplier( xController, UNO_QUERY );
- // check configuration: shall update of printing information in DocInfo set the document to "modified"?
- if ( m_bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() )
- {
- m_pObjectShell->EnableSetModified( sal_False );
- m_bNeedsChange = sal_True;
- }
- }
- }
-
- ~SfxPrintGuard_Impl()
- {
- if ( m_pObjectShell && m_bNeedsChange )
- m_pObjectShell->EnableSetModified( m_bOrigStatus );
- }
-};
+ Any aSelection;
+ if( xSupplier.is() )
+ aSelection = xSupplier->getSelection();
+ else
+ aSelection <<= GetObjectShell()->GetModel();
+ Any aComplete( makeAny( GetObjectShell()->GetModel() ) );
+ Any aViewProp( makeAny( xController ) );
+
+ boost::shared_ptr<vcl::PrinterController> pController( new SfxPrinterController( aComplete,
+ aSelection,
+ aViewProp,
+ GetRenderable(),
+ bIsAPI,
+ bIsDirect,
+ this,
+ rProps
+ ) );
+ SfxObjectShell *pObjShell = GetObjectShell();
+ pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ),
+ makeAny( rtl::OUString( pObjShell->GetTitle(0) ) ) );
+
+ // FIXME: job setup
+ SfxPrinter* pDocPrt = GetPrinter(FALSE);
+ JobSetup aJobSetup = pDocPrt ? pDocPrt->GetJobSetup() : GetJobSetup();
+ if( bIsDirect )
+ aJobSetup.SetValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ),
+ String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) );
+
+ Printer::PrintJob( pController, aJobSetup );
+}
void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
{
- USHORT nCopies=1;
+ // USHORT nCopies=1;
USHORT nDialogRet = RET_CANCEL;
- BOOL bCollate=TRUE;
+ // BOOL bCollate=FALSE;
SfxPrinter* pPrinter = 0;
PrintDialog* pPrintDlg = 0;
SfxDialogExecutor_Impl* pExecutor = 0;
bool bSilent = false;
BOOL bIsAPI = rReq.GetArgs() && rReq.GetArgs()->Count();
-
- if ( bIsAPI && GetPrinter( FALSE ) && GetPrinter( FALSE )->IsPrinting() )
+ if ( bIsAPI )
{
- pImp->pPrinterCommandQueue->AddRequest( rReq );
- return;
+ SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, FALSE);
+ bSilent = pSilentItem && pSilentItem->GetValue();
}
+ //FIXME: how to transport "bPrintOnHelp"?
+
+ // no help button in dialogs if called from the help window
+ // (pressing help button would exchange the current page inside the help document that is going to be printed!)
+ String aHelpFilterName( DEFINE_CONST_UNICODE("writer_web_HTML_help") );
+ SfxMedium* pMedium = GetViewFrame()->GetObjectShell()->GetMedium();
+ const SfxFilter* pFilter = pMedium ? pMedium->GetFilter() : NULL;
+ sal_Bool bPrintOnHelp = ( pFilter && pFilter->GetFilterName() == aHelpFilterName );
+
const USHORT nId = rReq.GetSlot();
switch( nId )
{
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
case SID_PRINTDOC:
- case SID_SETUPPRINTER:
- case SID_PRINTER_NAME :
+ case SID_PRINTDOCDIRECT:
{
- // quiet mode (AppEvent, API call)
- SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, FALSE);
- bSilent = pSilentItem && pSilentItem->GetValue();
+ SfxObjectShell* pDoc = GetObjectShell();
+ bool bDetectHidden = ( !bSilent && pDoc );
+ if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES )
+ break;
+
+ SFX_REQUEST_ARG(rReq, pSelectItem, SfxBoolItem, SID_SELECTION, FALSE);
+ sal_Bool bSelection = pSelectItem && pSelectItem->GetValue();
+ if( pSelectItem && rReq.GetArgs()->Count() == 1 )
+ bIsAPI = FALSE;
+
+ uno::Sequence < beans::PropertyValue > aProps;
+ if ( bIsAPI )
+ {
+ // supported properties:
+ // String PrinterName
+ // String FileName
+ // Int16 From
+ // Int16 To
+ // In16 Copies
+ // String RangeText
+ // bool Selection
+ // bool Asynchron
+ // bool Collate
+ // bool Silent
+ TransformItems( nId, *rReq.GetArgs(), aProps, GetInterface()->GetSlot(nId) );
+ for ( sal_Int32 nProp=0; nProp<aProps.getLength(); nProp++ )
+ {
+ if ( aProps[nProp].Name.equalsAscii("Copies") )
+ aProps[nProp]. Name = rtl::OUString::createFromAscii("CopyCount");
+ else if ( aProps[nProp].Name.equalsAscii("RangeText") )
+ aProps[nProp]. Name = rtl::OUString::createFromAscii("Pages");
+ if ( aProps[nProp].Name.equalsAscii("Asynchron") )
+ {
+ aProps[nProp]. Name = rtl::OUString::createFromAscii("Wait");
+ sal_Bool bAsynchron = sal_False;
+ aProps[nProp].Value >>= bAsynchron;
+ aProps[nProp].Value <<= (sal_Bool) (!bAsynchron);
+ }
+ if ( aProps[nProp].Name.equalsAscii("Silent") )
+ {
+ aProps[nProp]. Name = rtl::OUString::createFromAscii("MonitorVisible");
+ sal_Bool bPrintSilent = sal_False;
+ aProps[nProp].Value >>= bPrintSilent;
+ aProps[nProp].Value <<= (sal_Bool) (!bPrintSilent);
+ }
+ }
+ }
+ sal_Int32 nLen = aProps.getLength();
+ aProps.realloc( nLen + 1 );
+ aProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) );
+ aProps[nLen].Value = makeAny( bSelection );
+
+ ExecPrint( aProps, bIsAPI, (nId == SID_PRINTDOCDIRECT) );
+
+ // FIXME: Recording
+ rReq.Done();
+ break;
+ }
+ case SID_SETUPPRINTER :
+ case SID_PRINTER_NAME : // only for recorded macros
+ {
// get printer and printer settings from the document
SfxPrinter *pDocPrinter = GetPrinter(TRUE);
@@ -473,7 +770,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
// just set a recorded printer name
if ( pPrinter )
SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
- return;
+ break;
}
// no PrinterName parameter in ItemSet or the PrinterName points to an unknown printer
@@ -487,7 +784,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
if ( bSilent )
{
rReq.SetReturnValue(SfxBoolItem(0,FALSE));
- return;
+ break;
}
else
ErrorBox( NULL, WB_OK | WB_DEF_OK, String( SfxResId( STR_NODEFPRINTER ) ) ).Execute();
@@ -497,112 +794,57 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
{
// printer is not available, but standard printer should not be used
rReq.SetReturnValue(SfxBoolItem(0,FALSE));
- return;
+ break;
}
+ // FIXME: printer isn't used for printing anymore!
if( pPrinter->IsPrinting() )
{
// if printer is busy, abort printing
if ( !bSilent )
InfoBox( NULL, String( SfxResId( STR_ERROR_PRINTER_BUSY ) ) ).Execute();
rReq.SetReturnValue(SfxBoolItem(0,FALSE));
- return;
+ break;
}
- // the print dialog shouldn't use a help button if it is called from the help window
- // (pressing help button would exchange the current page inside the help document that is going to be printed!)
- String aHelpFilterName( DEFINE_CONST_UNICODE("writer_web_HTML_help") );
- SfxMedium* pMedium = GetViewFrame()->GetObjectShell()->GetMedium();
- const SfxFilter* pFilter = pMedium ? pMedium->GetFilter() : NULL;
- sal_Bool bPrintOnHelp = ( pFilter && pFilter->GetFilterName() == aHelpFilterName );
-
- SfxObjectShell* pDoc = NULL;
- if ( SID_PRINTDOC == nId )
- pDoc = GetObjectShell();
-
- // Let the document stay nonmodified during the printing if the configuration says to do so
- SfxPrintGuard_Impl aGuard( pDoc );
-
// if no arguments are given, retrieve them from a dialog
if ( !bIsAPI )
{
// PrinterDialog needs a temporary printer
SfxPrinter* pDlgPrinter = pPrinter->Clone();
nDialogRet = 0;
- if ( SID_PRINTDOC == nId )
+
+ // execute PrinterSetupDialog
+ PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() );
+
+ if ( pImp->bHasPrintOptions )
{
- bool bDetectHidden = ( !bSilent && !bPrintOnHelp && pDoc );
- if ( !bDetectHidden
- || pDoc->QueryHiddenInformation( WhenPrinting, NULL ) == RET_YES )
- {
- // execute PrintDialog
- pPrintDlg = CreatePrintDialog( NULL );
- if ( bPrintOnHelp )
- pPrintDlg->DisableHelp();
-
- if ( pImp->bHasPrintOptions )
- {
- // additional controls for dialog
- pExecutor = new SfxDialogExecutor_Impl( this, pPrintDlg );
- if ( bPrintOnHelp )
- pExecutor->DisableHelp();
- pPrintDlg->SetOptionsHdl( pExecutor->GetLink() );
- pPrintDlg->ShowOptionsButton();
- }
-
- // set printer on dialog and execute
- pPrintDlg->SetPrinter( pDlgPrinter );
- ::DisableRanges( *pPrintDlg, pDlgPrinter );
- nDialogRet = pPrintDlg->Execute();
- if ( pExecutor && pExecutor->GetOptions() )
- {
- if ( nDialogRet == RET_OK )
- // remark: have to be recorded if possible!
- pDlgPrinter->SetOptions( *pExecutor->GetOptions() );
- else
- {
- pPrinter->SetOptions( *pExecutor->GetOptions() );
- SetPrinter( pPrinter, SFX_PRINTER_OPTIONS );
- }
- }
-
- DELETEZ( pExecutor );
- }
+ // additional controls for dialog
+ pExecutor = new SfxDialogExecutor_Impl( this, pPrintSetupDlg );
+ if ( bPrintOnHelp )
+ pExecutor->DisableHelp();
+ pPrintSetupDlg->SetOptionsHdl( pExecutor->GetLink() );
}
- else
- {
- // execute PrinterSetupDialog
- PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() );
-
- if ( pImp->bHasPrintOptions )
- {
- // additional controls for dialog
- pExecutor = new SfxDialogExecutor_Impl( this, pPrintSetupDlg );
- if ( bPrintOnHelp )
- pExecutor->DisableHelp();
- pPrintSetupDlg->SetOptionsHdl( pExecutor->GetLink() );
- }
- pPrintSetupDlg->SetPrinter( pDlgPrinter );
- nDialogRet = pPrintSetupDlg->Execute();
+ pPrintSetupDlg->SetPrinter( pDlgPrinter );
+ nDialogRet = pPrintSetupDlg->Execute();
- if ( pExecutor && pExecutor->GetOptions() )
+ if ( pExecutor && pExecutor->GetOptions() )
+ {
+ if ( nDialogRet == RET_OK )
+ // remark: have to be recorded if possible!
+ pDlgPrinter->SetOptions( *pExecutor->GetOptions() );
+ else
{
- if ( nDialogRet == RET_OK )
- // remark: have to be recorded if possible!
- pDlgPrinter->SetOptions( *pExecutor->GetOptions() );
- else
- {
- pPrinter->SetOptions( *pExecutor->GetOptions() );
- SetPrinter( pPrinter, SFX_PRINTER_OPTIONS );
- }
+ pPrinter->SetOptions( *pExecutor->GetOptions() );
+ SetPrinter( pPrinter, SFX_PRINTER_OPTIONS );
}
+ }
- DELETEZ( pPrintSetupDlg );
+ DELETEZ( pPrintSetupDlg );
- // no recording of PrinterSetup except printer name (is printer dependent)
- rReq.Ignore();
- }
+ // no recording of PrinterSetup except printer name (is printer dependent)
+ rReq.Ignore();
if ( nDialogRet == RET_OK )
{
@@ -623,14 +865,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
/* Now lets reset the Dialog printer, since its freed */
if (pPrintDlg)
pPrintDlg->SetPrinter (pPrinter);
-
- if ( SID_PRINTDOC == nId )
- {
- nCopies = pPrintDlg->GetCopyCount();
- bCollate = pPrintDlg->IsCollateChecked();
- }
- else
- break;
}
else
{
@@ -641,226 +875,11 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
rReq.Ignore();
if ( SID_PRINTDOC == nId )
rReq.SetReturnValue(SfxBoolItem(0,FALSE));
- break;
- }
-
- // recording
- rReq.AppendItem( SfxBoolItem( SID_PRINT_COLLATE, bCollate ) );
- rReq.AppendItem( SfxInt16Item( SID_PRINT_COPIES, (INT16) pPrintDlg->GetCopyCount() ) );
- if ( pPrinter->IsPrintFileEnabled() )
- rReq.AppendItem( SfxStringItem( SID_FILE_NAME, pPrinter->GetPrintFile() ) );
- if ( pPrintDlg->IsRangeChecked(PRINTDIALOG_SELECTION) )
- rReq.AppendItem( SfxBoolItem( SID_SELECTION, TRUE ) );
- else if ( pPrintDlg->IsRangeChecked(PRINTDIALOG_RANGE) )
- rReq.AppendItem( SfxStringItem( SID_PRINT_PAGES, pPrintDlg->GetRangeText() ) );
- else if ( pPrintDlg->IsRangeChecked(PRINTDIALOG_FROMTO) )
- {
- // currently this doesn't seem to work -> return values of dialog are always 0
- // seems to be encoded as range string like "1-3"
- rReq.AppendItem( SfxInt16Item( SID_PRINT_FIRST_PAGE, (INT16) pPrintDlg->GetFirstPage() ) );
- rReq.AppendItem( SfxInt16Item( SID_PRINT_LAST_PAGE, (INT16) pPrintDlg->GetLastPage() ) );
}
}
- else if ( rReq.GetArgs() )
- {
- if ( SID_PRINTDOC != nId )
- {
- DBG_ERROR("Wrong slotid!");
- break;
- }
-
- // PrinterDialog is used to transfer information on printing
- pPrintDlg = CreatePrintDialog( GetWindow() );
- if ( bPrintOnHelp )
- pPrintDlg->DisableHelp();
- pPrintDlg->SetPrinter( pPrinter );
- ::DisableRanges( *pPrintDlg, pPrinter );
-
- // PrintToFile requested?
- SFX_REQUEST_ARG(rReq, pFileItem, SfxStringItem, SID_FILE_NAME, FALSE);
- if ( pFileItem )
- {
- pPrinter->EnablePrintFile(TRUE);
- pPrinter->SetPrintFile( pFileItem->GetValue() );
- }
-
- // Collate
- SFX_REQUEST_ARG(rReq, pCollateItem, SfxBoolItem, SID_PRINT_COLLATE, FALSE);
- if ( pCollateItem )
- {
- bCollate = pCollateItem->GetValue();
- pPrintDlg->CheckCollate( bCollate );
- }
-
- // Selection
- SFX_REQUEST_ARG(rReq, pSelectItem, SfxBoolItem, SID_SELECTION, FALSE);
-
- // Pages (as String)
- SFX_REQUEST_ARG(rReq, pPagesItem, SfxStringItem, SID_PRINT_PAGES, FALSE);
-
- // FirstPage
- SFX_REQUEST_ARG(rReq, pFirstPgItem, SfxInt16Item, SID_PRINT_FIRST_PAGE, FALSE);
- USHORT nFrom = 1;
- if ( pFirstPgItem )
- nFrom = pFirstPgItem->GetValue();
-
- // LastPage
- SFX_REQUEST_ARG(rReq, pLastPgItem, SfxInt16Item, SID_PRINT_LAST_PAGE, FALSE);
- USHORT nTo = 9999;
- if ( pLastPgItem )
- nTo = pLastPgItem->GetValue();
-
- // CopyCount
- SFX_REQUEST_ARG(rReq, pCopyItem, SfxInt16Item, SID_PRINT_COPIES, FALSE);
- if ( pCopyItem )
- {
- nCopies = pCopyItem->GetValue();
- pPrintDlg->SetCopyCount( nCopies );
- }
-
- // does the view support ranges?
- if ( pSelectItem && pSelectItem->GetValue() )
- {
- // print selection only
- pPrintDlg->CheckRange(PRINTDIALOG_SELECTION);
- }
- else if ( pPagesItem )
- {
- // get range text from parameter
- // enable ranges
- pPrintDlg->CheckRange(PRINTDIALOG_RANGE);
- pPrintDlg->SetRangeText( pPagesItem->GetValue() );
- }
- else if ( pPrintDlg->IsRangeEnabled(PRINTDIALOG_RANGE) )
- {
- // enable ranges
- // construct range text from page range
- pPrintDlg->CheckRange(PRINTDIALOG_RANGE);
- String aRange = String::CreateFromInt32( nFrom );
- aRange += '-';
- aRange += String::CreateFromInt32( nTo );
- pPrintDlg->SetRangeText( aRange );
- }
- else
- {
- // print page rage
- pPrintDlg->CheckRange(PRINTDIALOG_FROMTO);
- pPrintDlg->SetFirstPage( nFrom );
- pPrintDlg->SetLastPage( nTo );
- }
- }
-
- // intentionally no break for SID_PRINTDOC
- // printing now proceeds like SID_PRINTDOCDIRECT
}
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- case SID_PRINTDOCDIRECT:
- {
- if ( SID_PRINTDOCDIRECT == nId )
- {
- SfxObjectShell* pDoc = GetObjectShell();
- bool bDetectHidden = ( !bSilent && pDoc );
- if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES )
- return;
-
- // if no printer was selected before
- if ( !pPrinter )
- pPrinter = GetPrinter(TRUE);
-
- if( !pPrinter->IsValid() )
- {
- // redirect slot to call the print dialog if the document's printer is not valid!
- rReq.SetSlot( SID_PRINTDOC );
- ExecPrint_Impl( rReq );
- return;
- }
-
- if( pPrinter->IsOriginal() && pPrinter->GetName() != Printer::GetDefaultPrinterName() )
- {
- // redirect slot to call the print dialog
- // if the document's printer is available but not system default
- rReq.SetSlot( SID_PRINTDOC );
- ExecPrint_Impl( rReq );
- return;
- }
-
- pPrinter->SetNextJobIsQuick();
- }
-
- // if "Collate" was checked, the SfxPrinter must handle the CopyCount itself,
- // usually this is handled by the printer driver
- if( bCollate )
- // set printer to default, handle multiple copies explicitly
- pPrinter->SetCopyCount( 1 );
- else
- pPrinter->SetCopyCount( nCopies );
-
- // enable background printing
- pPrinter->SetPageQueueSize( 1 );
-
- // refresh document info
- using namespace ::com::sun::star;
- SfxObjectShell *pObjSh = GetObjectShell();
- uno::Reference<document::XDocumentProperties> xDocProps(
- pObjSh->getDocProperties());
- ::rtl::OUString aLastPrintedBy = xDocProps->getPrintedBy();
- util::DateTime aLastPrinted = xDocProps->getPrintDate();
-
- // Let the document stay nonmodified during the printing if the configuration says to do so
- SfxPrintGuard_Impl aGuard( pObjSh );
-
- xDocProps->setPrintedBy( GetObjectShell()->IsUseUserData()
- ? ::rtl::OUString( SvtUserOptions().GetFullName() )
- : ::rtl::OUString() );
- ::DateTime now;
- xDocProps->setPrintDate( util::DateTime(
- now.Get100Sec(), now.GetSec(), now.GetMin(), now.GetHour(),
- now.GetDay(), now.GetMonth(), now.GetYear() ) );
-
- GetObjectShell()->Broadcast( SfxPrintingHint( -1, pPrintDlg, pPrinter ) );
- ErrCode nError = DoPrint( pPrinter, pPrintDlg, bSilent, bIsAPI );
- if ( nError == PRINTER_OK )
- {
- Invalidate( SID_PRINTDOC );
- Invalidate( SID_PRINTDOCDIRECT );
- Invalidate( SID_SETUPPRINTER );
- rReq.SetReturnValue(SfxBoolItem(0,TRUE));
-
- SFX_REQUEST_ARG(rReq, pAsyncItem, SfxBoolItem, SID_ASYNCHRON, FALSE);
- if ( pAsyncItem && !pAsyncItem->GetValue() )
- {
- // synchronous execution wanted - wait for end of printing
- while ( pPrinter->IsPrinting())
- Application::Yield();
- }
-
- rReq.Done();
- }
- else
- {
- // printing not succesful, reset DocInfo
- xDocProps->setPrintedBy(aLastPrintedBy);
- xDocProps->setPrintDate(aLastPrinted);
-
- if ( nError != PRINTER_ABORT )
- {
- // "real" problem (not simply printing cancelled by user)
- String aMsg( SfxResId( STR_NOSTARTPRINTER ) );
- if ( !bIsAPI )
- ErrorBox( NULL, WB_OK | WB_DEF_OK, aMsg ).Execute();
- rReq.SetReturnValue(SfxBoolItem(0,FALSE));
- }
-
- rReq.Ignore();
- }
-
- pPrinter->SetNextJobIsQuick( false );
-
- delete pPrintDlg;
- break;
- }
+ break;
}
}
@@ -871,7 +890,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
//--------------------------------------------------------------------
-PrintDialog* SfxViewShell::CreatePrintDialog( Window* pParent )
+PrintDialog* SfxViewShell::CreatePrintDialog( Window* /*pParent*/ )
/* [Beschreibung]
@@ -881,11 +900,15 @@ PrintDialog* SfxViewShell::CreatePrintDialog( Window* pParent )
*/
{
+ #if 0
PrintDialog *pDlg = new PrintDialog( pParent, false );
pDlg->SetFirstPage( 1 );
pDlg->SetLastPage( 9999 );
pDlg->EnableCollate();
return pDlg;
+ #else
+ return NULL;
+ #endif
}
//--------------------------------------------------------------------
@@ -897,10 +920,11 @@ void SfxViewShell::PreparePrint( PrintDialog * )
//--------------------------------------------------------------------
-ErrCode SfxViewShell::DoPrint( SfxPrinter *pPrinter,
- PrintDialog *pPrintDlg,
- BOOL bSilent, BOOL bIsAPI )
+ErrCode SfxViewShell::DoPrint( SfxPrinter* /*pPrinter*/,
+ PrintDialog* /*pPrintDlg*/,
+ BOOL /*bSilent*/, BOOL /*bIsAPI*/ )
{
+ #if 0
// Printer-Dialogbox waehrend des Ausdrucks mu\s schon vor
// StartJob erzeugt werden, da SV bei einem Quit-Event h"angt
SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent );
@@ -910,11 +934,8 @@ ErrCode SfxViewShell::DoPrint( SfxPrinter *pPrinter,
else if ( pDocPrinter != pPrinter )
{
pProgress->RestoreOnEndPrint( pDocPrinter->Clone() );
- USHORT nError = SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
- if ( nError != SFX_PRINTERROR_NONE )
- return PRINTER_ACCESSDENIED;
+ SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
}
-
pProgress->SetWaitMode(FALSE);
// Drucker starten
@@ -935,6 +956,10 @@ ErrCode SfxViewShell::DoPrint( SfxPrinter *pPrinter,
}
return pPrinter->GetError();
+ #else
+ DBG_ERROR( "DoPrint called, dead code !" );
+ return ERRCODE_IO_NOTSUPPORTED;
+ #endif
}
//--------------------------------------------------------------------
@@ -990,23 +1015,12 @@ SfxTabPage* SfxViewShell::CreatePrintOptionsPage
Window* /*pParent*/,
const SfxItemSet& /*rOptions*/
)
-
-/* [Beschreibung]
-
- Diese Factory-Methode wird vom SFx verwendet, um die TabPage mit den
- Print-Optionen, welche "uber das <SfxItemSet> am <SfxPrinter>
- transportiert werden, zu erzeugen.
-
- Abgeleitete Klassen k"onnen diese Methode also "uberladen um die zu
- ihren SfxPrinter passenden Einstellungen vorzunehmen. Dieses sollte
- genau die <SfxTabPage> sein, die auch unter Extras/Einstellungen
- verwendet wird.
-
- Die Basisimplementierung liefert einen 0-Pointer.
-*/
-
{
return 0;
}
+JobSetup SfxViewShell::GetJobSetup() const
+{
+ return JobSetup();
+}
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 86c9ba0bb70e..4ee90289347e 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1261,7 +1261,7 @@ SfxViewShell::SfxViewShell
{
DBG_CTOR(SfxViewShell, 0);
- pImp->pPrinterCommandQueue = new SfxAsyncPrintExec_Impl( this );
+ //pImp->pPrinterCommandQueue = new SfxAsyncPrintExec_Impl( this );
pImp->pController = 0;
pImp->bIsShowView =
!(SFX_VIEW_NO_SHOW == (nFlags & SFX_VIEW_NO_SHOW));
@@ -1322,7 +1322,7 @@ SfxViewShell::~SfxViewShell()
DELETEZ( pImp->pAccExec );
}
- DELETEZ( pImp->pPrinterCommandQueue );
+ //DELETEZ( pImp->pPrinterCommandQueue );
DELETEZ( pImp );
DELETEZ( pIPClientList );
}
@@ -1578,7 +1578,7 @@ SfxViewShell* SfxViewShell::GetFirst
if ( pFrame == pShell->GetViewFrame() )
{
// only ViewShells with a valid ViewFrame will be returned
- if ( ( !bOnlyVisible || pFrame->IsVisible_Impl() ) && ( !pType || pShell->IsA(*pType) ) )
+ if ( ( !bOnlyVisible || pFrame->IsVisible() ) && ( !pType || pShell->IsA(*pType) ) )
return pShell;
break;
}
@@ -1620,7 +1620,7 @@ SfxViewShell* SfxViewShell::GetNext
if ( pFrame == pShell->GetViewFrame() )
{
// only ViewShells with a valid ViewFrame will be returned
- if ( ( !bOnlyVisible || pFrame->IsVisible_Impl() ) && ( !pType || pShell->IsA(*pType) ) )
+ if ( ( !bOnlyVisible || pFrame->IsVisible() ) && ( !pType || pShell->IsA(*pType) ) )
return pShell;
break;
}
@@ -2211,7 +2211,7 @@ BOOL SfxViewShell::HasMouseClickListeners_Impl()
void SfxViewShell::SetAdditionalPrintOptions( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rOpts )
{
pImp->aPrintOpts = rOpts;
- GetObjectShell()->Broadcast( SfxPrintingHint( -3, NULL, NULL, rOpts ) );
+// GetObjectShell()->Broadcast( SfxPrintingHint( -3, NULL, NULL, rOpts ) );
}
BOOL SfxViewShell::Escape()
@@ -2219,6 +2219,19 @@ BOOL SfxViewShell::Escape()
return GetViewFrame()->GetBindings().Execute( SID_TERMINATE_INPLACEACTIVATION );
}
+Reference< view::XRenderable > SfxViewShell::GetRenderable()
+{
+ Reference< view::XRenderable >xRender;
+ SfxObjectShell* pObj = GetObjectShell();
+ if( pObj )
+ {
+ Reference< frame::XModel > xModel( pObj->GetModel() );
+ if( xModel.is() )
+ xRender = Reference< view::XRenderable >( xModel, UNO_QUERY );
+ }
+ return xRender;
+}
+
void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransfer::clipboard::XClipboardListener >& rClp, BOOL bAdd )
{
try