summaryrefslogtreecommitdiff
path: root/sw/source/ui/uiview
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2010-01-21 13:49:22 +0100
committerMathias Bauer <mba@openoffice.org>2010-01-21 13:49:22 +0100
commit5fc2b31a91680c7e4548ff9ffcf2638a48639bea (patch)
treebf370125585f46ff7a297ac1aa12f93e0f06dfe6 /sw/source/ui/uiview
parente488bbd9693d9162082dafc5ea8cea6085cdb372 (diff)
parentfdde737ea0caf7450a6676f46651f78ee05321ab (diff)
resync to DEV300_m70
Diffstat (limited to 'sw/source/ui/uiview')
-rw-r--r--sw/source/ui/uiview/makefile.mk1
-rw-r--r--sw/source/ui/uiview/pview.cxx75
-rw-r--r--sw/source/ui/uiview/pview.src5
-rw-r--r--sw/source/ui/uiview/srcview.cxx172
-rw-r--r--sw/source/ui/uiview/view.cxx64
-rw-r--r--sw/source/ui/uiview/viewprt.cxx304
6 files changed, 116 insertions, 505 deletions
diff --git a/sw/source/ui/uiview/makefile.mk b/sw/source/ui/uiview/makefile.mk
index 2aa5e12e2631..28ab2271a823 100644
--- a/sw/source/ui/uiview/makefile.mk
+++ b/sw/source/ui/uiview/makefile.mk
@@ -54,6 +54,7 @@ EXCEPTIONSFILES= \
$(SLO)$/uivwimp.obj \
$(SLO)$/view.obj \
$(SLO)$/view2.obj \
+ $(SLO)$/viewprt.obj \
$(SLO)$/viewling.obj \
$(SLO)$/viewmdi.obj \
diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx
index 60f791fd06b7..c43c9ea50cc0 100644
--- a/sw/source/ui/uiview/pview.cxx
+++ b/sw/source/ui/uiview/pview.cxx
@@ -45,6 +45,7 @@
#include <svl/stritem.hxx>
#include <svl/eitem.hxx>
#include <sfx2/printer.hxx>
+#include <sfx2/progress.hxx>
#include <sfx2/app.hxx>
#include <sfx2/topfrm.hxx>
#include <sfx2/bindings.hxx>
@@ -1520,12 +1521,6 @@ MOVEPAGE:
rReq.SetSlot( FN_PRINT_PAGEPREVIEW );
return;
}
- case FN_PREVIEW_PRINT_OPTIONS :
- {
- SwPreviewPrintOptionsDialog aDlg(aViewWin, *this);
- aDlg.Execute();
- }
- break;
case SID_PRINTDOCDIRECT:
case SID_PRINTDOC:
::SetAppPrintOptions( aViewWin.GetViewShell(), FALSE );
@@ -1788,7 +1783,7 @@ void SwPagePreView::Init(const SwViewOption * pPrefs)
// OD 09.01.2003 #i6467# - adjust view shell option to the same as for print
SwPrtOptions aPrintOptions( GetViewFrame()->GetObjectShell()->GetTitle(0) );
- SwView::MakeOptions( 0, aPrintOptions, 0, 0, false, 0, 0 );
+ aPrintOptions.MakeOptions( false );
GetViewShell()->AdjustOptionsForPagePreview( aPrintOptions );
IDocumentSettingAccess* pIDSA = pESh->getIDocumentSettingAccess();
@@ -2416,72 +2411,6 @@ void SwPagePreView::ScrollDocSzChg()
// alles zum Thema Drucken
-USHORT SwPagePreView::Print( SfxProgress &rProgress, BOOL bIsAPI, PrintDialog *pDlg )
-{
- ViewShell* pSh = aViewWin.GetViewShell();
- SfxPrinter* pPrinter = GetPrinter();
- if( !pPrinter || !pPrinter->InitJob( &aViewWin,
- pSh->HasDrawView() && !bIsAPI && pSh->GetDrawView()->GetModel()->HasTransparentObjects() ))
- return ERRCODE_IO_ABORT;
-
- SwWait aWait( *GetDocShell(), TRUE );
-
- USHORT nRowCol = ( aViewWin.GetRow() << 8 ) +
- aViewWin.GetCol(); // Zeilen / DoppelSeiten
-
- {
- // die Felder aktualisieren
- // ACHTUNG: hochcasten auf die EditShell, um die SS zu nutzen.
- // In den Methoden wird auf die akt. Shell abgefragt!
- SwEditShell* pESh = (SwEditShell*)pSh;
- SwDocStat aDocStat;
- BOOL bIsModified = pESh->IsModified();
-
- pESh->StartAllAction();
- pESh->UpdateDocStat( aDocStat );
- pSh->UpdateFlds();
- pESh->EndAllAction();
-
- if( !bIsModified )
- pESh->ResetModified();
- }
-
- // Druckauftrag starten
- SfxObjectShell *pObjShell = GetViewFrame()->GetObjectShell();
- SwPrtOptions aOpts( pObjShell->GetTitle(0) );
-
- BOOL bPrtPros;
- BOOL bPrtPros_RTL;
- SwView::MakeOptions( pDlg, aOpts, &bPrtPros, &bPrtPros_RTL, FALSE, GetPrinter(), GetDocShell()->GetDoc()->getPrintData() );
-
- if( bNormalPrint )
- {
- if( bPrtPros )
- pSh->PrintProspect( aOpts, rProgress, bPrtPros_RTL );
- else
- pSh->Prt( aOpts, &rProgress );
- }
- else
- {
- const SwPagePreViewPrtData* pPPVPD = pSh->GetDoc()->GetPreViewPrtData();
- if( pPPVPD && pPPVPD->GetCol() && pPPVPD->GetRow() )
- {
- // Zeilen / Seiten
- nRowCol = ( pPPVPD->GetRow() << 8 ) + pPPVPD->GetCol();
- }
- else
- pPPVPD = 0;
- pSh->PrintPreViewPage( aOpts, nRowCol, rProgress, pPPVPD );
- }
-
- return 0; // OK
-}
-
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-
SfxPrinter* SwPagePreView::GetPrinter( BOOL bCreate )
{
return aViewWin.GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate );
diff --git a/sw/source/ui/uiview/pview.src b/sw/source/ui/uiview/pview.src
index a213c8df80e7..ff7f834db7a6 100644
--- a/sw/source/ui/uiview/pview.src
+++ b/sw/source/ui/uiview/pview.src
@@ -453,11 +453,6 @@ ToolBox RID_PVIEW_TOOLBOX
Identifier = FN_PRINT_PAGEPREVIEW ;
HelpID = FN_PRINT_PAGEPREVIEW ;
};
- ToolBoxItem
- {
- Identifier = FN_PREVIEW_PRINT_OPTIONS ;
- HelpID = FN_PREVIEW_PRINT_OPTIONS ;
- };
ToolBoxItem { Type = TOOLBOXITEM_SEPARATOR ; };
ToolBoxItem
{
diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx
index cc57017c3923..eb3a215aa552 100644
--- a/sw/source/ui/uiview/srcview.cxx
+++ b/sw/source/ui/uiview/srcview.cxx
@@ -152,23 +152,23 @@ TYPEINIT1(SwSrcView, SfxViewShell)
--------------------------------------------------*/
-void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const String& rTitle )
+void lcl_PrintHeader( OutputDevice &rOutDev, USHORT nPages, USHORT nCurPage, const String& rTitle )
{
short nLeftMargin = LMARGPRN;
- Size aSz = pPrinter->GetOutputSize();
+ Size aSz = rOutDev.GetOutputSize();
short nBorder = BORDERPRN;
- Color aOldFillColor( pPrinter->GetFillColor() );
- Font aOldFont( pPrinter->GetFont() );
+ Color aOldFillColor( rOutDev.GetFillColor() );
+ Font aOldFont( rOutDev.GetFont() );
- pPrinter->SetFillColor( Color(COL_TRANSPARENT) );
+ rOutDev.SetFillColor( Color(COL_TRANSPARENT) );
Font aFont( aOldFont );
aFont.SetWeight( WEIGHT_BOLD );
aFont.SetAlign( ALIGN_BOTTOM );
- pPrinter->SetFont( aFont );
+ rOutDev.SetFont( aFont );
- long nFontHeight = pPrinter->GetTextHeight();
+ long nFontHeight = rOutDev.GetTextHeight();
// 1.Border => Strich, 2+3 Border = Freiraum.
long nYTop = TMARGPRN-3*nBorder-nFontHeight;
@@ -176,34 +176,34 @@ void lcl_PrintHeader( Printer* pPrinter, USHORT nPages, USHORT nCurPage, const S
long nXLeft = nLeftMargin-nBorder;
long nXRight = aSz.Width()-RMARGPRN+nBorder;
- pPrinter->DrawRect( Rectangle(
+ rOutDev.DrawRect( Rectangle(
Point( nXLeft, nYTop ),
Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) );
long nY = TMARGPRN-2*nBorder;
Point aPos( nLeftMargin, nY );
- pPrinter->DrawText( aPos, rTitle );
+ rOutDev.DrawText( aPos, rTitle );
if ( nPages != 1 )
{
aFont.SetWeight( WEIGHT_NORMAL );
- pPrinter->SetFont( aFont );
+ rOutDev.SetFont( aFont );
String aPageStr( C2S(" [") );
aPageStr += String( SW_RES( STR_PAGE ) );
aPageStr += ' ';
aPageStr += String::CreateFromInt32( nCurPage );
aPageStr += ']';
- aPos.X() += pPrinter->GetTextWidth( rTitle );
- pPrinter->DrawText( aPos, aPageStr );
+ aPos.X() += rOutDev.GetTextWidth( rTitle );
+ rOutDev.DrawText( aPos, aPageStr );
}
nY = TMARGPRN-nBorder;
- pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
+ rOutDev.DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
- pPrinter->SetFont( aOldFont );
- pPrinter->SetFillColor( aOldFillColor );
+ rOutDev.SetFont( aOldFont );
+ rOutDev.SetFillColor( aOldFillColor );
}
/* -----------------13.11.2003 16:24-----------------
@@ -717,6 +717,7 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
if(!bApi)
+ {
if(bNotFoundMessage)
{
InfoBox( 0, SW_RES(MSG_NOT_FOUND)).Execute();
@@ -728,20 +729,18 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem,
pTextView->SetSelection( TextSelection( aPaM, aPaM ) );
StartSearchAndReplace( rSearchItem, FALSE, FALSE, TRUE );
}
+ }
}
return nFound;
}
-/*-----------------02.07.97 09:29-------------------
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
---------------------------------------------------*/
USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
{
SwDocShell* pDocSh = GetDocShell();
- SfxPrinter* pOld = pDocSh->GetDoc()->getPrinter( false );
- if ( pOld && pOld->IsPrinting() )
- return SFX_PRINTERROR_BUSY;
-
if ( (SFX_PRINTER_JOBSETUP | SFX_PRINTER_PRINTER) & nDiffFlags )
{
pDocSh->GetDoc()->setPrinter( pNew, true, true );
@@ -764,109 +763,88 @@ USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
Beschreibung:
--------------------------------------------------------------------*/
-ErrCode SwSrcView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, BOOL bIsAPI )
+SfxPrinter* SwSrcView::GetPrinter( BOOL bCreate )
{
- SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent );
- SfxPrinter *pDocPrinter = GetPrinter(TRUE);
- if ( !pPrinter )
- pPrinter = pDocPrinter;
- else if ( pDocPrinter != pPrinter )
- {
- pProgress->RestoreOnEndPrint( pDocPrinter->Clone() );
- SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
- }
- pProgress->SetWaitMode(FALSE);
+ return GetDocShell()->GetDoc()->getPrinter( bCreate );
+}
- // Drucker starten
- PreparePrint( pDlg );
+/*--------------------------------------------------------------------
+ Beschreibung:
+ --------------------------------------------------------------------*/
+sal_Int32 SwSrcView::PrintSource(
+ OutputDevice *pOutDev,
+ sal_Int32 nPage,
+ bool bCalcNumPagesOnly )
+{
+ if (!pOutDev || nPage <= 0)
+ return 0;
- SfxViewShell::Print(*pProgress, bIsAPI, pDlg ); //???
+ //! this a lgorithm for printing the n-th page is very poor since it
+ //! needs to go over the text of all previous pages to get to the correct one.
+ //! But since HTML source code is expected to be just a small number of pages
+ //! even this poor algorithm should be enough...
- MapMode eOldMapMode( pPrinter->GetMapMode() );
- Font aOldFont( pPrinter->Printer::GetFont() );
+ pOutDev->Push();
TextEngine* pTextEngine = aEditWin.GetTextEngine();
- pPrinter->SetMapMode(MAP_100TH_MM);
- Font aFont(aEditWin.GetOutWin()->GetFont());
- Size aSize(aFont.GetSize());
- aSize = aEditWin.GetOutWin()->PixelToLogic(aSize, MAP_100TH_MM);
- aFont.SetSize(aSize);
- aFont.SetColor(COL_BLACK);
- pPrinter->SetFont( aFont );
+ pOutDev->SetMapMode( MAP_100TH_MM );
+ Font aFont( aEditWin.GetOutWin()->GetFont() );
+ Size aSize( aFont.GetSize() );
+ aSize = aEditWin.GetOutWin()->PixelToLogic( aSize, MAP_100TH_MM );
+ aFont.SetSize( aSize );
+ aFont.SetColor( COL_BLACK );
+ pOutDev->SetFont( aFont );
String aTitle( GetViewFrame()->GetWindow().GetText() );
- USHORT nLineHeight = (USHORT) pPrinter->GetTextHeight(); // etwas mehr.
+ USHORT nLineHeight = (USHORT) pOutDev->GetTextHeight(); // etwas mehr.
USHORT nParaSpace = 10;
- Size aPaperSz = pPrinter->GetOutputSize();
- aPaperSz.Width() -= (LMARGPRN+RMARGPRN);
- aPaperSz.Height() -= (TMARGPRN+BMARGPRN);
+ Size aPaperSz = pOutDev->GetOutputSize();
+ aPaperSz.Width() -= (LMARGPRN + RMARGPRN);
+ aPaperSz.Height() -= (TMARGPRN + BMARGPRN);
// nLinepPage stimmt nicht, wenn Zeilen umgebrochen werden muessen...
- USHORT nLinespPage = (USHORT) (aPaperSz.Height()/nLineHeight);
- USHORT nCharspLine = (USHORT) (aPaperSz.Width() / pPrinter->GetTextWidth( 'X' ));
+ USHORT nLinespPage = (USHORT) (aPaperSz.Height() / nLineHeight);
+ USHORT nCharspLine = (USHORT) (aPaperSz.Width() / pOutDev->GetTextWidth( 'X' ));
USHORT nParas = static_cast< USHORT >( pTextEngine->GetParagraphCount() );
- USHORT nPages = (USHORT) (nParas/nLinespPage+1 );
+ USHORT nPages = (USHORT) (nParas / nLinespPage + 1 );
USHORT nCurPage = 1;
- BOOL bStartJob = pPrinter->StartJob( aTitle );
- if( bStartJob )
+ // Header drucken...
+ if (!bCalcNumPagesOnly && nPage == nCurPage)
+ lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle );
+ const Point aStartPos( LMARGPRN, TMARGPRN );
+ Point aPos( aStartPos );
+ for ( USHORT nPara = 0; nPara < nParas; ++nPara )
{
- pPrinter->StartPage();
- // Header drucken...
- lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle );
- Point aPos( LMARGPRN, TMARGPRN );
- for ( USHORT nPara = 0; nPara < nParas; nPara++ )
+ String aLine( pTextEngine->GetText( nPara ) );
+ lcl_ConvertTabsToSpaces( aLine );
+ USHORT nLines = aLine.Len() / nCharspLine + 1;
+ for ( USHORT nLine = 0; nLine < nLines; ++nLine )
{
- String aLine( pTextEngine->GetText( nPara ) );
- lcl_ConvertTabsToSpaces( aLine );
- USHORT nLines = aLine.Len()/nCharspLine+1;
- for ( USHORT nLine = 0; nLine < nLines; nLine++ )
+ String aTmpLine( aLine, nLine * nCharspLine, nCharspLine );
+ aPos.Y() += nLineHeight;
+ if ( aPos.Y() > ( aPaperSz.Height() + TMARGPRN - nLineHeight/2 ) )
{
- String aTmpLine( aLine, nLine*nCharspLine, nCharspLine );
- aPos.Y() += nLineHeight;
- if ( aPos.Y() > ( aPaperSz.Height()+TMARGPRN ) )
- {
- nCurPage++;
- pPrinter->EndPage();
- pPrinter->StartPage();
- lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle );
- aPos = Point( LMARGPRN, TMARGPRN+nLineHeight );
- }
- pPrinter->DrawText( aPos, aTmpLine );
+ ++nCurPage;
+ if (!bCalcNumPagesOnly && nPage == nCurPage)
+ lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle );
+ aPos = aStartPos;
}
- aPos.Y() += nParaSpace;
+ if (!bCalcNumPagesOnly && nPage == nCurPage)
+ pOutDev->DrawText( aPos, aTmpLine );
}
- pPrinter->EndPage();
+ aPos.Y() += nParaSpace;
}
- pPrinter->SetFont( aOldFont );
- pPrinter->SetMapMode( eOldMapMode );
-
- if ( !bStartJob )
- {
- // Printer konnte nicht gestartet werden
- delete pProgress;
- return ERRCODE_IO_ABORT;
- }
+ pOutDev->Pop();
- pProgress->Stop();
- pProgress->DeleteOnEndPrint();
- pPrinter->EndJob();
- return pPrinter->GetError();
+ DBG_ASSERT( bCalcNumPagesOnly || nPage <= nCurPage, "page number out of range" );
+ return nCurPage;
}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-
-SfxPrinter* SwSrcView::GetPrinter( BOOL bCreate )
-{
- return GetDocShell()->GetDoc()->getPrinter( bCreate );
-}
/*--------------------------------------------------------------------
Beschreibung:
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 5752c8d81b0b..6f6e9312f525 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -1919,53 +1919,6 @@ void SwView::NotifyDBChanged()
Beschreibung: Drucken
--------------------------------------------------------------------*/
-void SwView::MakeOptions( PrintDialog* pDlg, SwPrtOptions& rOpts,
- BOOL* pPrtProspect, BOOL* pPrtProspect_RTL, BOOL bWeb, SfxPrinter* pPrt, SwPrintData* pData )
-{
- SwAddPrinterItem* pAddPrinterAttr;
- if( pPrt && SFX_ITEM_SET == pPrt->GetOptions().GetItemState(
- FN_PARAM_ADDPRINTER, FALSE, (const SfxPoolItem**)&pAddPrinterAttr ))
- {
- pData = pAddPrinterAttr;
- }
- else if(!pData)
- {
- pData = SW_MOD()->GetPrtOptions(bWeb);
- }
- rOpts = *pData;
- if( pPrtProspect )
- *pPrtProspect = pData->bPrintProspect;
- if( pPrtProspect_RTL )
- *pPrtProspect_RTL = pData->bPrintProspect_RTL;
- rOpts.aMulti.SetTotalRange( Range( 0, RANGE_MAX ) );
- rOpts.aMulti.SelectAll( FALSE );
- rOpts.nCopyCount = 1;
- rOpts.bCollate = FALSE;
- rOpts.bPrintSelection = FALSE;
- rOpts.bJobStartet = FALSE;
-
- if ( pDlg )
- {
- rOpts.nCopyCount = pDlg->GetCopyCount();
- rOpts.bCollate = pDlg->IsCollateChecked();
- if ( pDlg->GetCheckedRange() == PRINTDIALOG_SELECTION )
- {
- rOpts.aMulti.SelectAll();
- rOpts.bPrintSelection = TRUE;
- }
- else if ( PRINTDIALOG_ALL == pDlg->GetCheckedRange() )
- rOpts.aMulti.SelectAll();
- else
- {
- rOpts.aMulti = MultiSelection( pDlg->GetRangeText() );
- rOpts.aMulti.SetTotalRange( Range( 0, RANGE_MAX ) );
- }
- }
- else
- rOpts.aMulti.SelectAll();
- rOpts.aMulti.Select( 0, FALSE );
-}
-
/* -----------------------------28.10.02 13:25--------------------------------
---------------------------------------------------------------------------*/
@@ -1994,3 +1947,20 @@ void SwView::AddTransferable(SwTransferable& rTransferable)
{
GetViewImpl()->AddTransferable(rTransferable);
}
+
+/* --------------------------------------------------*/
+
+void SwPrtOptions::MakeOptions( BOOL bWeb )
+{
+ *this = *SW_MOD()->GetPrtOptions(bWeb);
+
+ nCopyCount = 1;
+ bCollate = FALSE;
+ bPrintSelection = FALSE;
+ bJobStartet = FALSE;
+
+ aMulti.SetTotalRange( Range( 0, RANGE_MAX ) );
+ aMulti.SelectAll();
+ aMulti.Select( 0, FALSE );
+}
+
diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx
index d1fd5fbe0c6b..98ca39263404 100644
--- a/sw/source/ui/uiview/viewprt.cxx
+++ b/sw/source/ui/uiview/viewprt.cxx
@@ -47,9 +47,11 @@
#endif
#include <sfx2/request.hxx>
+#include <sfx2/progress.hxx>
#include <sfx2/app.hxx>
#include <svl/flagitem.hxx>
#include <vcl/msgbox.hxx>
+#include <vcl/oldprintadaptor.hxx>
#include <svtools/printdlg.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/prnmon.hxx>
@@ -175,287 +177,6 @@ USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool )
}
/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-ErrCode SwView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, BOOL bIsAPI )
-{
- // First test
- SwWrtShell* pSh = &GetWrtShell();
- SwNewDBMgr* pMgr = pSh->GetNewDBMgr();
-
- int bPrintSelection = -1;
- USHORT nMergeType = pMgr->GetMergeType();
- if( DBMGR_MERGE_MAILMERGE != nMergeType &&
- DBMGR_MERGE_DOCUMENTS != nMergeType &&
- !pDlg &&
- !bIsAPI && ( pSh->IsSelection() || pSh->IsFrmSelected() ||
- pSh->IsObjSelected() ) )
- {
- short nBtn = SvxPrtQryBox(&GetEditWin()).Execute();
- if( RET_CANCEL == nBtn )
- return ERRCODE_IO_ABORT;
-
- if( RET_OK == nBtn )
- bPrintSelection = 1;
- else
- bPrintSelection = 0;
- }
-
-// Der PrintProgress stellt Handler am Printer der ViewShell ein.
-// Das kann natuerlich erste nach dem evtl. Umschalten des Druckers korrekt
-// funktionieren. #55210#
-// SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent );
- SfxPrintProgress *pProgress = 0;
- SfxPrinter *pDocPrinter = GetPrinter(TRUE);
- if ( !pPrinter )
- pPrinter = pDocPrinter;
- else if ( pDocPrinter != pPrinter )
- {
- //Da der Doc-Drucker beim SetPrinter geloescht wird,
- // muss man ihn vorher clonen
- SfxPrinter* pClone = pDocPrinter->Clone();
- SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
- pProgress = new SfxPrintProgress( this, !bSilent );
- pProgress->RestoreOnEndPrint( pClone );
- }
- if(!pProgress)
- pProgress = new SfxPrintProgress( this, !bSilent );
- pProgress->SetWaitMode(FALSE);
-
- BOOL bStartJob = pPrinter->InitJob( &GetEditWin(),
- !bIsAPI && pSh->HasDrawView() && pSh->GetDrawView()->GetModel()->HasTransparentObjects());
- if( bStartJob )
- {
- // Drucker starten
- PreparePrint( pDlg );
- SfxObjectShell *pObjShell = GetViewFrame()->GetObjectShell();
- //#i82625# GetTitle( 0 ) doesn't work for 'embedded' documents like forms or reports
- String sDocumentTitle( pObjShell->GetTitle(SFX_TITLE_APINAME));
- SwPrtOptions aOpts( sDocumentTitle );
- BOOL bWeb = 0 != PTR_CAST(SwWebView, this);
- nMergeType = pMgr->GetMergeType();
-
- BOOL bPrtPros;
- BOOL bPrtPros_RTL;
- SwView::MakeOptions( pDlg, aOpts, &bPrtPros, &bPrtPros_RTL, bWeb, GetPrinter(),
- pSh->getIDocumentDeviceAccess()->getPrintData() );
-
- //set the appropriate view options to print
- //on silent mode the field commands have to be switched off always
- //on default print the user is asked what to do
- const SwViewOption* pCurrentViewOptions = pSh->GetViewOptions();
- bool bSwitchOff_IsFldName = pCurrentViewOptions->IsFldName() && pSh->IsAnyFieldInDoc();
-
- if(!bSilent && bSwitchOff_IsFldName)
- {
- QueryBox aBox( &GetEditWin(), SW_RES( DLG_PRT_FIELDNAME ) );
- USHORT nRet = aBox.Execute();
- if( RET_CANCEL == nRet)
- {
- delete pProgress;
- return ERRCODE_IO_ABORT;
- }
- // disable field commands
- if( RET_NO != nRet )
- {
- bSwitchOff_IsFldName = false;
- }
- }
- bool bApplyViewOptions = bSwitchOff_IsFldName;
- //switch off display of hidden characters if on and hidden characters are in use
- const sal_Bool bOldShowHiddenChar = pCurrentViewOptions->IsShowHiddenChar();
- const sal_Bool bOldMetaChars = pCurrentViewOptions->IsViewMetaChars();
- if( bOldShowHiddenChar != aOpts.IsPrintHiddenText()
- && pSh->GetDoc()->ContainsHiddenChars())
- bApplyViewOptions |= true;
- //switch off display of hidden paragraphs if on and hidden paragraphs are in use
- const sal_Bool bOldShowHiddenPara = pCurrentViewOptions->IsShowHiddenPara();
- if( aOpts.IsPrintHiddenText() != bOldShowHiddenPara )
- {
- const SwFieldType* pFldType = pSh->GetDoc()->GetSysFldType(RES_HIDDENPARAFLD);
- if( pFldType && pFldType->GetDepends())
- bApplyViewOptions |= true;
- }
- const sal_Bool bOldShowHiddenField = pCurrentViewOptions->IsShowHiddenField();
- if( aOpts.IsPrintHiddenText() != bOldShowHiddenField )
- {
- const SwFieldType* pFldType = pSh->GetDoc()->GetSysFldType(RES_HIDDENTXTFLD);
- if( pFldType || pFldType->GetDepends())
- bApplyViewOptions |= true;
- }
-
- SwViewOption* pOrgViewOption = 0;
- bApplyViewOptions |= !aOpts.IsPrintTextPlaceholder();
- if(bApplyViewOptions)
- {
- pOrgViewOption = new SwViewOption(*pSh->GetViewOptions());
- if(bSwitchOff_IsFldName)
- pOrgViewOption->SetFldName(aOpts.IsPrintHiddenText());
-
- pOrgViewOption->SetShowHiddenChar(aOpts.IsPrintHiddenText());
- pOrgViewOption->SetViewMetaChars(sal_True);
- pOrgViewOption->SetShowHiddenPara(aOpts.IsPrintHiddenText());
- pOrgViewOption->SetShowHiddenField(aOpts.IsPrintHiddenText());
- pOrgViewOption->SetShowPlaceHolderFields( aOpts.bPrintTextPlaceholder );
-
- SW_MOD()->ApplyUsrPref(*pOrgViewOption, this, VIEWOPT_DEST_VIEW_ONLY );
- }
-
- if( nMergeType == DBMGR_MERGE_MAILMERGE ||
- DBMGR_MERGE_DOCUMENTS == nMergeType )
- {
- if(DBMGR_MERGE_DOCUMENTS == nMergeType)
- bStartJob = pMgr->MergePrintDocuments( *this, aOpts, *pProgress, bIsAPI );
- else
- bStartJob = pMgr->MergePrint( *this, aOpts, *pProgress, bIsAPI );
- }
- else
- {
- const BOOL bLockedView = pSh->IsViewLocked();
- pSh->LockView( TRUE );
-
- //BrowseView abschalten und die View gegen alle Paints locken.
- BOOL bBrowse = pSh->getIDocumentSettingAccess()->get(IDocumentSettingAccess::BROWSE_MODE);
- SfxAllItemSet aSet( SFX_APP()->GetPool() );
- SfxBoolItem aBrowse( SID_BROWSER_MODE, FALSE );
- if ( bBrowse )
- {
- if ( pSh->GetWin() )
- pSh->GetWin()->Update();
- pSh->LockPaint();
- aSet.Put( aBrowse, aBrowse.Which() );
- SfxRequest aReq( SID_BROWSER_MODE, 0, aSet );
- GetDocShell()->Execute( aReq );
- }
-
- // die Felder aktualisieren
- BOOL bIsModified = pSh->IsModified();
- pSh->StartAllAction();
- SwDocStat aDocStat;
- pSh->UpdateDocStat( aDocStat );
- pSh->EndAllTblBoxEdit();
- pSh->ViewShell::UpdateFlds(TRUE);
- if( pSh->IsCrsrInTbl() )
- {
- pSh->ClearTblBoxCntnt();
- pSh->SaveTblBoxCntnt();
- }
- pSh->EndAllAction();
-
- if( !bIsModified )
- pSh->ResetModified();
-
- if( -1 != bPrintSelection )
- aOpts.bPrintSelection = 0 != bPrintSelection;
-
- uno::Sequence< beans::PropertyValue> aViewProperties(18);
- beans::PropertyValue* pViewProperties = aViewProperties.getArray();
- pViewProperties[1].Name = C2U("PrintGraphics");
- pViewProperties[1].Value <<= (sal_Bool)aOpts.IsPrintGraphic();
- pViewProperties[2].Name = C2U("PrintTables");
- pViewProperties[2].Value <<= (sal_Bool)aOpts.IsPrintTable();
- pViewProperties[3].Name = C2U("PrintDrawings");
- pViewProperties[3].Value <<= (sal_Bool)aOpts.IsPrintDraw();
- pViewProperties[4].Name = C2U("PrintLeftPages");
- pViewProperties[4].Value <<= (sal_Bool)aOpts.IsPrintLeftPage();
- pViewProperties[5].Name = C2U("PrintRightPages");
- pViewProperties[5].Value <<= (sal_Bool)aOpts.IsPrintRightPage();
- pViewProperties[6].Name = C2U("PrintControls");
- pViewProperties[6].Value <<= (sal_Bool)aOpts.IsPrintControl();
- pViewProperties[7].Name = C2U("PrintReversed");
- pViewProperties[7].Value <<= (sal_Bool)aOpts.IsPrintReverse();
- pViewProperties[8].Name = C2U("PrintPaperFromSetup");
- pViewProperties[8].Value <<= (sal_Bool)aOpts.IsPaperFromSetup();
- pViewProperties[9].Name = C2U("PrintFaxName");
- pViewProperties[9].Value <<= aOpts.GetFaxName();
- pViewProperties[10].Name = C2U("PrintAnnotationMode");
- pViewProperties[10].Value <<= (text::NotePrintMode) aOpts.GetPrintPostIts();
- pViewProperties[11].Name = C2U("PrintProspect");
- pViewProperties[11].Value <<= (sal_Bool)aOpts.IsPrintProspect();
- pViewProperties[12].Name = C2U("PrintPageBackground");
- pViewProperties[12].Value <<= (sal_Bool)aOpts.IsPrintPageBackground();
- pViewProperties[13].Name = C2U("PrintBlackFonts");
- pViewProperties[13].Value <<= (sal_Bool)aOpts.IsPrintBlackFont();
- pViewProperties[0].Name = C2U("IsSinglePrintJob");
- pViewProperties[0].Value <<= (sal_Bool)aOpts.IsPrintSingleJobs();
- pViewProperties[14].Name = C2U("Selection");
- pViewProperties[14].Value <<= (sal_Bool)aOpts.bPrintSelection;
- pViewProperties[15].Name = C2U("PrintEmptyPages");
- pViewProperties[15].Value <<= (sal_Bool)aOpts.bPrintEmptyPages;
- pViewProperties[16].Name = C2U("PrintHiddenText");
- pViewProperties[16].Value <<= (sal_Bool)aOpts.bPrintHiddenText;
- pViewProperties[17].Name = C2U("PrintTextPlaceholder");
- pViewProperties[17].Value <<= (sal_Bool)aOpts.bPrintTextPlaceholder;
- SetAdditionalPrintOptions(aViewProperties);
-
- SfxViewShell::Print(*pProgress, bIsAPI );
- if ( !pProgress->IsAborted() )
- {
- if( bPrtPros )
- {
- bStartJob = pPrinter->StartJob( aOpts.GetJobName() );
- if( bStartJob )
- pSh->PrintProspect( aOpts, *pProgress, bPrtPros_RTL );
- }
- else
- bStartJob = pSh->Prt( aOpts, pProgress );
-
- if ( bBrowse )
- {
- aBrowse.SetValue( TRUE );
- aSet.Put( aBrowse, aBrowse.Which() );
- SfxRequest aReq( SID_BROWSER_MODE, 0, aSet );
- GetDocShell()->Execute( aReq );
- pSh->UnlockPaint();
- }
- }
- else
- bStartJob = FALSE;
-
- pSh->LockView( bLockedView );
- }
- if(pOrgViewOption)
- {
- if(bSwitchOff_IsFldName)
- pOrgViewOption->SetFldName(TRUE);
- pOrgViewOption->SetShowHiddenChar(bOldShowHiddenChar);
- pOrgViewOption->SetViewMetaChars(bOldMetaChars);
- pOrgViewOption->SetShowHiddenField(bOldShowHiddenField);
- pOrgViewOption->SetShowHiddenPara(bOldShowHiddenPara);
- //must to be set to sal_True anyway
- pOrgViewOption->SetShowPlaceHolderFields( sal_True );
- SW_MOD()->ApplyUsrPref(*pOrgViewOption, this, VIEWOPT_DEST_VIEW_ONLY );
- delete pOrgViewOption;
- }
- }
-
- if( !bStartJob )
- {
- // Printer konnte nicht gestartet werden
- delete pProgress;
- return pPrinter->GetError();
- }
-
- pProgress->Stop();
- if ( pPrinter->IsJobActive() )
- {
- pProgress->DeleteOnEndPrint();
- pPrinter->EndJob();
- return pPrinter->GetError();
- }
- else
- {
- // the next call might destroy pPrinter (in case it is not the usual document printer); so get the error before
- ULONG nError = pPrinter->GetError();
- pProgress->DeleteOnEndPrint();
- return nError;
- }
-}
-
-
-
-/*--------------------------------------------------------------------
Beschreibung: TabPage fuer applikationsspezifische Druckoptionen
--------------------------------------------------------------------*/
@@ -549,6 +270,7 @@ void __EXPORT SwView::ExecutePrint(SfxRequest& rReq)
rReq.RemoveItem(FN_QRY_MERGE);
BOOL bFromMerge = pPrintFromMergeItem ? pPrintFromMergeItem->GetValue() : FALSE;
SwMiscConfig aMiscConfig;
+ bool bPrintSelection = false;
if(!bSilent && !bFromMerge &&
SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc())
{
@@ -563,12 +285,29 @@ void __EXPORT SwView::ExecutePrint(SfxRequest& rReq)
return;
}
}
+ else if( rReq.GetSlot() == SID_PRINTDOCDIRECT && ! bSilent )
+ {
+ if( /*!bIsAPI && */
+ ( pSh->IsSelection() || pSh->IsFrmSelected() || pSh->IsObjSelected() ) )
+ {
+ short nBtn = SvxPrtQryBox(&GetEditWin()).Execute();
+ if( RET_CANCEL == nBtn )
+ return;;
+
+ if( RET_OK == nBtn )
+ bPrintSelection = true;
+ }
+ }
+
//#i61455# if master documentes are printed silently without loaded links then update the links now
if( bSilent && pSh->IsGlobalDoc() && !pSh->IsGlblDocSaveLinks() )
{
pSh->GetLinkManager().UpdateAllLinks( sal_False, sal_False, sal_False, 0 );
}
- SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() );
+ SfxRequest aReq( rReq );
+ SfxBoolItem aBool(SID_SELECTION, bPrintSelection);
+ aReq.AppendItem( aBool );
+ SfxViewShell::ExecuteSlot( aReq, SfxViewShell::GetInterface() );
return;
}
default:
@@ -637,4 +376,3 @@ void SetAppPrintOptions( ViewShell* pSh, BOOL bWeb )
}
}
-