From c8bc5be2dca2dbe7e9cba1c9027f2c97076e8374 Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Thu, 11 Jun 2009 17:26:10 +0000 Subject: make compile again, needs adaption ? --- sw/source/ui/uiview/srcview.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sw/source/ui/uiview/srcview.cxx') diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 7898e4db1cb2..72a99e79240e 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -753,8 +753,9 @@ USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) Beschreibung: --------------------------------------------------------------------*/ -ErrCode SwSrcView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilent, BOOL bIsAPI ) +ErrCode SwSrcView::DoPrint( SfxPrinter */*pPrinter*/, PrintDialog */*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) { + #if 0 SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent ); SfxPrinter *pDocPrinter = GetPrinter(TRUE); if ( !pPrinter ) @@ -845,6 +846,10 @@ ErrCode SwSrcView::DoPrint( SfxPrinter *pPrinter, PrintDialog *pDlg, BOOL bSilen pProgress->DeleteOnEndPrint(); pPrinter->EndJob(); return pPrinter->GetError(); + #else + DBG_ERROR( "dead code" ); + return ERRCODE_IO_NOTSUPPORTED; + #endif } /*-------------------------------------------------------------------- -- cgit From ed4721887cd14279f5de473fac41ba8b9df12a7d Mon Sep 17 00:00:00 2001 From: Philipp Lohmann Date: Mon, 15 Jun 2009 18:03:16 +0000 Subject: solve a warning --- sw/source/ui/uiview/srcview.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sw/source/ui/uiview/srcview.cxx') diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 72a99e79240e..fdbfb6a8309b 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -753,7 +753,7 @@ USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) Beschreibung: --------------------------------------------------------------------*/ -ErrCode SwSrcView::DoPrint( SfxPrinter */*pPrinter*/, PrintDialog */*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) +ErrCode SwSrcView::DoPrint( SfxPrinter * /*pPrinter*/, PrintDialog * /*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) { #if 0 SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent ); -- cgit From 4c0bd776257fb1ad287e34b4e1bcf4bb6cd2f822 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Thu, 3 Sep 2009 15:12:37 +0000 Subject: #i101242# printing from HTML source view --- sw/source/ui/uiview/srcview.cxx | 170 +++++++++++++++++----------------------- 1 file changed, 72 insertions(+), 98 deletions(-) (limited to 'sw/source/ui/uiview/srcview.cxx') diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 1b496b3b4fae..d1e0ab8e3bec 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -151,23 +151,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; @@ -175,34 +175,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----------------- @@ -725,9 +725,10 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, return nFound; } -/*-----------------02.07.97 09:29------------------- +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ ---------------------------------------------------*/ USHORT SwSrcView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) { SwDocShell* pDocSh = GetDocShell(); @@ -753,114 +754,87 @@ 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 ) { - #if 0 - 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 ); + Point aPos( LMARGPRN, TMARGPRN ); + 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 ) ) { - 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 = Point( LMARGPRN, TMARGPRN + nLineHeight ); } - 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(); - #else - DBG_ERROR( "dead code" ); - return ERRCODE_IO_NOTSUPPORTED; - #endif + DBG_ASSERT( bCalcNumPagesOnly || nPage <= nCurPage, "page number out of range" ); + return nCurPage; } -/*-------------------------------------------------------------------- - Beschreibung: - --------------------------------------------------------------------*/ - - -SfxPrinter* SwSrcView::GetPrinter( BOOL bCreate ) -{ - return GetDocShell()->GetDoc()->getPrinter( bCreate ); -} /*-------------------------------------------------------------------- Beschreibung: -- cgit From aacdff37a8696ddcbe0094e7b3fcd650eb311eb5 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Fri, 4 Sep 2009 09:03:29 +0000 Subject: #i101242# printing of HTML source won't cross the border frame anymore --- sw/source/ui/uiview/srcview.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sw/source/ui/uiview/srcview.cxx') diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index d1e0ab8e3bec..a36c4b553128 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -806,7 +806,8 @@ sal_Int32 SwSrcView::PrintSource( // Header drucken... if (!bCalcNumPagesOnly && nPage == nCurPage) lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle ); - Point aPos( LMARGPRN, TMARGPRN ); + const Point aStartPos( LMARGPRN, TMARGPRN ); + Point aPos( aStartPos ); for ( USHORT nPara = 0; nPara < nParas; ++nPara ) { String aLine( pTextEngine->GetText( nPara ) ); @@ -816,12 +817,12 @@ sal_Int32 SwSrcView::PrintSource( { String aTmpLine( aLine, nLine * nCharspLine, nCharspLine ); aPos.Y() += nLineHeight; - if ( aPos.Y() > ( aPaperSz.Height() + TMARGPRN ) ) + if ( aPos.Y() > ( aPaperSz.Height() + TMARGPRN - nLineHeight/2 ) ) { ++nCurPage; if (!bCalcNumPagesOnly && nPage == nCurPage) lcl_PrintHeader( *pOutDev, nPages, nCurPage, aTitle ); - aPos = Point( LMARGPRN, TMARGPRN + nLineHeight ); + aPos = aStartPos; } if (!bCalcNumPagesOnly && nPage == nCurPage) pOutDev->DrawText( aPos, aTmpLine ); -- cgit From ff016bd9d3e87d93db950c60ad7ccb5c31b5fa7a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 3 Dec 2009 17:24:39 +0000 Subject: cmcfixes68: #i107420# remove trivial warnings from sw with newer gcc --- sw/source/ui/uiview/srcview.cxx | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sw/source/ui/uiview/srcview.cxx') diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index d30e85c5ee71..e93abdf73b15 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -717,6 +717,7 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, if(!bApi) + { if(bNotFoundMessage) { InfoBox( 0, SW_RES(MSG_NOT_FOUND)).Execute(); @@ -728,6 +729,7 @@ USHORT SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, pTextView->SetSelection( TextSelection( aPaM, aPaM ) ); StartSearchAndReplace( rSearchItem, FALSE, FALSE, TRUE ); } + } } return nFound; } -- cgit