From 45709c3ca1f18caef2353c8add21ec172dfd41e9 Mon Sep 17 00:00:00 2001 From: Niklas Nebel Date: Mon, 26 Aug 2002 17:15:47 +0000 Subject: #102510# implementation of XRenderable for PDF export --- sc/inc/cellsuno.hxx | 8 +- sc/inc/docuno.hxx | 30 +++- sc/inc/unonames.hxx | 8 +- sc/source/ui/inc/printfun.hxx | 12 +- sc/source/ui/unoobj/cellsuno.cxx | 15 +- sc/source/ui/unoobj/docuno.cxx | 294 +++++++++++++++++++++++++++++++++++++-- sc/source/ui/unoobj/viewuno.cxx | 12 +- sc/source/ui/view/preview.cxx | 10 +- sc/source/ui/view/printfun.cxx | 20 ++- 9 files changed, 375 insertions(+), 34 deletions(-) diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx index cd80322fcb62..325f900740cd 100644 --- a/sc/inc/cellsuno.hxx +++ b/sc/inc/cellsuno.hxx @@ -2,9 +2,9 @@ * * $RCSfile: cellsuno.hxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: sab $ $Date: 2001-10-24 08:33:08 $ + * last change: $Author: nn $ $Date: 2002-08-26 18:13:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -282,6 +282,7 @@ private: ScRangeList aRanges; BOOL bChartColAsHdr; BOOL bChartRowAsHdr; + BOOL bCursorOnly; BOOL bValueChangePosted; XPropertyChangeListenerArr_Impl aValueListeners; @@ -348,6 +349,9 @@ public: void SetNewRange(const ScRange& rNew); // fuer Cursor void SetNewRanges(const ScRangeList& rNew); + void SetCursorOnly(BOOL bSet); + BOOL IsCursorOnly() const { return bCursorOnly; } + // XSheetOperation virtual double SAL_CALL computeFunction( ::com::sun::star::sheet::GeneralFunction nFunction ) throw(::com::sun::star::uno::Exception, diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 78abb6c7f21e..d6909f7adf42 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -2,9 +2,9 @@ * * $RCSfile: docuno.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: hr $ $Date: 2001-10-23 11:14:49 $ + * last change: $Author: nn $ $Date: 2002-08-26 18:13:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,9 @@ #include #endif +#ifndef _COM_SUN_STAR_VIEW_XRENDERABLE_HPP_ +#include +#endif #ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_HPP_ #include #endif @@ -155,6 +158,7 @@ class ScDocShell; class ScAnnotationObj; +class ScMarkData; class ScTableColumnObj; class ScTableRowObj; class ScTableSheetObj; @@ -172,6 +176,7 @@ class ScModelObj : public SfxBaseModel, public com::sun::star::sheet::XConsolidatable, public com::sun::star::sheet::XDocumentAuditing, public com::sun::star::style::XStyleFamiliesSupplier, + public com::sun::star::view::XRenderable, public com::sun::star::document::XLinkTargetSupplier, public com::sun::star::beans::XPropertySet, public SvxFmMSFactory, // derived from XMultiServiceFactory @@ -189,6 +194,9 @@ private: com::sun::star::uno::Reference xDrawMarkerTab; com::sun::star::uno::Reference xDrawDashTab; + BOOL FillRenderMarkData( const com::sun::star::uno::Any& aSelection, + ScMarkData& rMark ) const; + public: ScModelObj(ScDocShell* pDocSh); virtual ~ScModelObj(); @@ -221,6 +229,24 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getStyleFamilies() throw(::com::sun::star::uno::RuntimeException); + // XRenderable + virtual sal_Int32 SAL_CALL getRendererCount( const ::com::sun::star::uno::Any& aSelection, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& xOptions ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL + getRenderer( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& xOptions ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL render( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& xOptions ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + // XLinkTargetSupplier virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks() throw(::com::sun::star::uno::RuntimeException); diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index d88ee2e81663..3a8afc5846e5 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -2,9 +2,9 @@ * * $RCSfile: unonames.hxx,v $ * - * $Revision: 1.42 $ + * $Revision: 1.43 $ * - * last change: $Author: dr $ $Date: 2002-07-11 10:46:48 $ + * last change: $Author: nn $ $Date: 2002-08-26 18:13:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -506,5 +506,9 @@ #define SC_UNONAME_TITLE "Title" #define SC_UNONAME_CLOSEONUP "CloseOnMouseRelease" +// XRenderable +#define SC_UNONAME_PAGESIZE "PageSize" +#define SC_UNONAME_RENDERDEV "RenderDevice" + #endif diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx index d0e1a079fd50..cc19c64e08b3 100644 --- a/sc/source/ui/inc/printfun.hxx +++ b/sc/source/ui/inc/printfun.hxx @@ -2,9 +2,9 @@ * * $RCSfile: printfun.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: nn $ $Date: 2002-03-11 19:21:12 $ + * last change: $Author: nn $ $Date: 2002-08-26 18:15:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -195,6 +195,7 @@ private: USHORT nManualZoom; // Zoom in Preview (Prozent) BOOL bClearWin; // Ausgabe vorher loeschen BOOL bUseStyleColor; + BOOL bIsRender; USHORT nPrintTab; long nPageStart; // Offset fuer erste Seite @@ -274,12 +275,14 @@ public: const ScPrintOptions* pOptions = NULL, ScPageBreakData* pData = NULL ); - ScPrintFunc( ScDocShell* pShell, Window* pWindow, USHORT nTab, + // ctors for device other than printer - for preview and pdf: + + ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, USHORT nTab, long nPage = 0, long nDocP = 0, const ScRange* pArea = NULL, const ScPrintOptions* pOptions = NULL ); - ScPrintFunc( ScDocShell* pShell, Window* pWindow, + ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, const ScPrintState& rState, const ScPrintOptions* pOptions ); @@ -296,6 +299,7 @@ public: void SetClearFlag( BOOL bFlag ); void SetUseStyleColor( BOOL bFlag ); + void SetRenderFlag( BOOL bFlag ); BOOL UpdatePages(); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 5f28a5904950..2370af1fccf9 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cellsuno.cxx,v $ * - * $Revision: 1.64 $ + * $Revision: 1.65 $ * - * last change: $Author: er $ $Date: 2002-08-08 13:03:43 $ + * last change: $Author: nn $ $Date: 2002-08-26 18:14:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1206,6 +1206,7 @@ ScCellRangesBase::ScCellRangesBase() : aPropSet(lcl_GetCellsPropertyMap()), bChartColAsHdr( FALSE ), bChartRowAsHdr( FALSE ), + bCursorOnly( FALSE ), pCurrentFlat( NULL ), pCurrentDeep( NULL ), pCurrentDataSet( NULL ), @@ -1221,6 +1222,7 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) : aPropSet(lcl_GetCellsPropertyMap()), bChartColAsHdr( FALSE ), bChartRowAsHdr( FALSE ), + bCursorOnly( FALSE ), pCurrentFlat( NULL ), pCurrentDeep( NULL ), pCurrentDataSet( NULL ), @@ -1243,6 +1245,7 @@ ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR) : aPropSet(lcl_GetCellsPropertyMap()), bChartColAsHdr( FALSE ), bChartRowAsHdr( FALSE ), + bCursorOnly( FALSE ), pCurrentFlat( NULL ), pCurrentDeep( NULL ), pCurrentDataSet( NULL ), @@ -1424,6 +1427,14 @@ void ScCellRangesBase::SetNewRanges(const ScRangeList& rNew) RefChanged(); } +void ScCellRangesBase::SetCursorOnly( BOOL bSet ) +{ + // set for a selection object that is created from the cursor position + // without anything selected (may contain several sheets) + + bCursorOnly = bSet; +} + uno::Any SAL_CALL ScCellRangesBase::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException) { diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 991bd11b1f1d..0cb3acdf8ec3 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2,9 +2,9 @@ * * $RCSfile: docuno.cxx,v $ * - * $Revision: 1.25 $ + * $Revision: 1.26 $ * - * last change: $Author: nn $ $Date: 2002-01-08 09:45:18 $ + * last change: $Author: nn $ $Date: 2002-08-26 18:14:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,6 +66,7 @@ #pragma hdrstop #include +#include #include #include @@ -74,6 +75,8 @@ #include #include #include +#include +#include #include #include // DBL_MAX @@ -108,6 +111,7 @@ #include "unoguard.hxx" #include "unonames.hxx" #include "shapeuno.hxx" +#include "printfun.hxx" using namespace com::sun::star; @@ -332,6 +336,7 @@ uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) SC_QUERYINTERFACE( sheet::XConsolidatable ) SC_QUERYINTERFACE( sheet::XDocumentAuditing ) SC_QUERYINTERFACE( style::XStyleFamiliesSupplier ) + SC_QUERYINTERFACE( view::XRenderable ) SC_QUERYINTERFACE( document::XLinkTargetSupplier ) SC_QUERYINTERFACE( beans::XPropertySet ) SC_QUERYINTERFACE( lang::XMultiServiceFactory ) @@ -379,7 +384,7 @@ uno::Sequence SAL_CALL ScModelObj::getTypes() throw(uno::RuntimeExcep long nAggLen = aAggTypes.getLength(); const uno::Type* pAggPtr = aAggTypes.getConstArray(); - const long nThisLen = 14; + const long nThisLen = 15; aTypes.realloc( nParentLen + nAggLen + nThisLen ); uno::Type* pPtr = aTypes.getArray(); pPtr[nParentLen + 0] = getCppuType((const uno::Reference*)0); @@ -391,11 +396,12 @@ uno::Sequence SAL_CALL ScModelObj::getTypes() throw(uno::RuntimeExcep pPtr[nParentLen + 6] = getCppuType((const uno::Reference*)0); pPtr[nParentLen + 7] = getCppuType((const uno::Reference*)0); pPtr[nParentLen + 8] = getCppuType((const uno::Reference*)0); - pPtr[nParentLen + 9] = getCppuType((const uno::Reference*)0); - pPtr[nParentLen +10] = getCppuType((const uno::Reference*)0); - pPtr[nParentLen +11] = getCppuType((const uno::Reference*)0); - pPtr[nParentLen +12] = getCppuType((const uno::Reference*)0); - pPtr[nParentLen +13] = getCppuType((const uno::Reference*)0); + pPtr[nParentLen + 9] = getCppuType((const uno::Reference*)0); + pPtr[nParentLen +10] = getCppuType((const uno::Reference*)0); + pPtr[nParentLen +11] = getCppuType((const uno::Reference*)0); + pPtr[nParentLen +12] = getCppuType((const uno::Reference*)0); + pPtr[nParentLen +13] = getCppuType((const uno::Reference*)0); + pPtr[nParentLen +14] = getCppuType((const uno::Reference*)0); long i; for (i=0; i SAL_CALL ScModelObj::getStyleFamilies() return NULL; } +// XRenderable + + +class ScPrintFuncCache +{ + ScDocShell* pDocSh; + long nTotalPages; + long nPages[MAXTAB+1]; + long nFirstAttr[MAXTAB+1]; + +public: + ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark ); + ~ScPrintFuncCache(); + + long GetPageCount() const { return nTotalPages; } + long GetFirstAttr( USHORT nTab ) const { return nFirstAttr[nTab]; } + USHORT GetTabForPage( long nPage ) const; + long GetTabStart( USHORT nTab ) const; + long GetDisplayStart( USHORT nTab ) const; +}; + + +ScPrintFuncCache::ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark ) : + pDocSh( pD ), + nTotalPages( 0 ) +{ + // page count uses the stored cell widths for the printer anyway, + // so ScPrintFunc with the document's printer can be used to count + + SfxPrinter* pPrinter = pDocSh->GetPrinter(); + + ScRange aRange; + const ScRange* pSelRange = NULL; + if ( rMark.IsMarked() ) + { + rMark.GetMarkArea( aRange ); + pSelRange = &aRange; + } + + ScDocument* pDoc = pDocSh->GetDocument(); + USHORT nTabCount = pDoc->GetTableCount(); + USHORT nTab; + for ( nTab=0; nTabGetDocument(); + USHORT nTabCount = pDoc->GetTableCount(); + USHORT nTab = 0; + while ( nTab < nTabCount && nPage >= nPages[nTab] ) + nPage -= nPages[nTab++]; + return nTab; +} + +long ScPrintFuncCache::GetTabStart( USHORT nTab ) const +{ + long nRet = 0; + for ( USHORT i=0; iGetDocument(); + for (USHORT i=0; iNeedPageResetAfterTab(i) ) + nDisplayStart = 0; + else + nDisplayStart += nPages[i]; + } + return nDisplayStart; +} + +ScPrintFuncCache::~ScPrintFuncCache() +{ +} + + +OutputDevice* lcl_GetRenderDevice( const uno::Sequence& rOptions ) +{ + OutputDevice* pRet = NULL; + const beans::PropertyValue* pPropArray = rOptions.getConstArray(); + long nPropCount = rOptions.getLength(); + for (long i = 0; i < nPropCount; i++) + { + const beans::PropertyValue& rProp = pPropArray[i]; + String aPropName = rProp.Name; + + if (aPropName.EqualsAscii( SC_UNONAME_RENDERDEV )) + { + uno::Reference xRenderDevice; + if ( ( rProp.Value >>= xRenderDevice ) && xRenderDevice.is() ) + { + VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); + if ( pDevice ) + pRet = pDevice->GetOutputDevice(); + } + } + } + return pRet; +} + + +BOOL ScModelObj::FillRenderMarkData( const uno::Any& aSelection, ScMarkData& rMark ) const +{ + DBG_ASSERT( !rMark.IsMarked() && !rMark.IsMultiMarked(), "FillRenderMarkData: MarkData must be empty" ); + DBG_ASSERT( pDocShell, "FillRenderMarkData: DocShell must be set" ); + + BOOL bDone = FALSE; + + uno::Reference xInterface; + if ( aSelection >>= xInterface ) + { + ScCellRangesBase* pSelObj = ScCellRangesBase::getImplementation( xInterface ); + if ( pSelObj && pSelObj->GetDocShell() == pDocShell ) + { + BOOL bCursor = pSelObj->IsCursorOnly(); + const ScRangeList& rRanges = pSelObj->GetRangeList(); + + rMark.MarkFromRangeList( rRanges, FALSE ); + rMark.MarkToSimple(); + + if ( rMark.IsMarked() && !rMark.IsMultiMarked() ) + { + if ( bCursor ) // nothing selected -> use whole tables + rMark.ResetMark(); // doesn't change table selection + bDone = TRUE; + } + // multi selection isn't supported + } + else if ( ScModelObj::getImplementation( xInterface ) == this ) + { + // render the whole document + // -> no selection, all sheets + + USHORT nTabCount = pDocShell->GetDocument()->GetTableCount(); + for (USHORT nTab = 0; nTab < nTabCount; nTab++) + rMark.SelectTable( nTab, TRUE ); + bDone = TRUE; + } + // other selection types aren't supported + } + + return bDone; +} + + +sal_Int32 SAL_CALL ScModelObj::getRendererCount( const uno::Any& aSelection, + const uno::Sequence& xOptions ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + ScUnoGuard aGuard; + if (!pDocShell) + throw uno::RuntimeException(); + + ScMarkData aMark; + if ( !FillRenderMarkData( aSelection, aMark ) ) + return 0; + + ScPrintFuncCache aCache( pDocShell, aMark ); + return aCache.GetPageCount(); +} + +uno::Sequence SAL_CALL ScModelObj::getRenderer( sal_Int32 nRenderer, + const uno::Any& aSelection, const uno::Sequence& xOptions ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + ScUnoGuard aGuard; + if (!pDocShell) + throw uno::RuntimeException(); + + ScMarkData aMark; + if ( !FillRenderMarkData( aSelection, aMark ) ) + throw lang::IllegalArgumentException(); + + ScPrintFuncCache aCache( pDocShell, aMark ); + if ( nRenderer >= aCache.GetPageCount() ) + throw lang::IllegalArgumentException(); + + USHORT nTab = aCache.GetTabForPage( nRenderer ); + ScPrintFunc aFunc( pDocShell, pDocShell->GetPrinter(), nTab ); // just for page size + Size aTwips = aFunc.GetPageSize(); + awt::Size aPageSize( TwipsToHMM( aTwips.Width() ), TwipsToHMM( aTwips.Height() ) ); + + uno::Sequence aSequence(3); + beans::PropertyValue* pArray = aSequence.getArray(); + pArray[0].Name = rtl::OUString::createFromAscii( SC_UNONAME_PAGESIZE ); + pArray[0].Value <<= aPageSize; + return aSequence; +} + +void SAL_CALL ScModelObj::render( sal_Int32 nRenderer, const uno::Any& aSelection, + const uno::Sequence& rOptions ) + throw(lang::IllegalArgumentException, uno::RuntimeException) +{ + ScUnoGuard aGuard; + if (!pDocShell) + throw uno::RuntimeException(); + + ScMarkData aMark; + if ( !FillRenderMarkData( aSelection, aMark ) ) + throw lang::IllegalArgumentException(); + + ScPrintFuncCache aCache( pDocShell, aMark ); + long nTotalPages = aCache.GetPageCount(); + if ( nRenderer >= nTotalPages ) + throw lang::IllegalArgumentException(); + + OutputDevice* pDev = lcl_GetRenderDevice( rOptions ); + if ( !pDev ) + throw lang::IllegalArgumentException(); + + USHORT nTab = aCache.GetTabForPage( nRenderer ); + ScDocument* pDoc = pDocShell->GetDocument(); + + FmFormView* pDrawView = NULL; + Rectangle aFull( 0, 0, LONG_MAX, LONG_MAX ); + if ( pDoc->HasControl( nTab, aFull ) ) + { + ScDrawLayer* pModel = pDoc->GetDrawLayer(); // can't be NULL then + pDrawView = new FmFormView( pModel, pDev ); + pDrawView->ShowPagePgNum( nTab, Point() ); + pDrawView->SetPrintPreview( TRUE ); + } + + ScRange aRange; + const ScRange* pSelRange = NULL; + if ( aMark.IsMarked() ) + { + aMark.GetMarkArea( aRange ); + pSelRange = &aRange; + } + + ScPrintFunc aFunc( pDev, pDocShell, nTab, aCache.GetFirstAttr(nTab), nTotalPages, pSelRange ); + aFunc.SetDrawView( pDrawView ); +// aFunc.SetRenderFlag( TRUE ); + + Range aPageRange( nRenderer+1, nRenderer+1 ); + MultiSelection aPage( aPageRange ); + aPage.SetTotalRange( Range(0,RANGE_MAX) ); + aPage.Select( aPageRange ); + + long nDisplayStart = aCache.GetDisplayStart( nTab ); + long nTabStart = aCache.GetTabStart( nTab ); + + long nPrinted = aFunc.DoPrint( aPage, nTabStart, nDisplayStart, TRUE, NULL, NULL ); + + delete pDrawView; +} + // XLinkTargetSupplier uno::Reference SAL_CALL ScModelObj::getLinks() throw(uno::RuntimeException) diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index aff7215467bb..a2c933fc9743 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -2,9 +2,9 @@ * * $RCSfile: viewuno.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: sab $ $Date: 2002-08-12 08:42:34 $ + * last change: $Author: nn $ $Date: 2002-08-26 18:14:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -842,6 +842,14 @@ uno::Any SAL_CALL ScTabViewObj::getSelection() throw(uno::RuntimeException) pObj = new ScCellRangesObj( pDocSh, *xRanges ); } + + if ( !rMark.IsMarked() && !rMark.IsMultiMarked() ) + { + // remember if the selection was from the cursor position without anything selected + // (used when rendering the selection) + + pObj->SetCursorOnly( TRUE ); + } } uno::Reference xRet = static_cast(pObj); diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index f4314e0bcfed..c6714c3e978b 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: preview.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: nn $ $Date: 2002-06-18 13:11:09 $ + * last change: $Author: nn $ $Date: 2002-08-26 18:15:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -250,7 +250,7 @@ void ScPreview::CalcPages( USHORT nToWhichTab ) long nAttrPage = i ? nFirstAttr[i-1] : 1; long nThisStart = nTotalPages; - ScPrintFunc aPrintFunc( pDocShell, this, i, nAttrPage, 0, NULL, &aOptions ); + ScPrintFunc aPrintFunc( this, pDocShell, i, nAttrPage, 0, NULL, &aOptions ); long nThisTab = aPrintFunc.GetTotalPages(); nPages[i] = nThisTab; nTotalPages += nThisTab; @@ -371,9 +371,9 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) ScPrintFunc* pPrintFunc; if (bStateValid) - pPrintFunc = new ScPrintFunc( pDocShell, this, aState, &aOptions ); + pPrintFunc = new ScPrintFunc( this, pDocShell, aState, &aOptions ); else - pPrintFunc = new ScPrintFunc( pDocShell, this, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions ); + pPrintFunc = new ScPrintFunc( this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions ); pPrintFunc->SetOffset(aOffset); pPrintFunc->SetManualZoom(nZoom); diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 588e5516b24d..497a41a81dde 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -2,9 +2,9 @@ * * $RCSfile: printfun.cxx,v $ * - * $Revision: 1.21 $ + * $Revision: 1.22 $ * - * last change: $Author: nn $ $Date: 2002-06-07 10:31:09 $ + * last change: $Author: nn $ $Date: 2002-08-26 18:15:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -270,6 +270,7 @@ void ScPrintFunc::Construct( const ScPrintOptions* pOptions ) nManualZoom = 100; bClearWin = FALSE; bUseStyleColor = FALSE; + bIsRender = FALSE; InitParam(pOptions); @@ -299,7 +300,7 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, SfxPrinter* pNewPrinter, USHORT nT Construct( pOptions ); } -ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, USHORT nTab, +ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, USHORT nTab, long nPage, long nDocP, const ScRange* pArea, const ScPrintOptions* pOptions ) : pDocShell ( pShell ), @@ -316,11 +317,11 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, USHORT nTab, bPrintCurrentTable ( FALSE ), bMultiArea ( FALSE ) { - pDev = pWindow; + pDev = pOutDev; Construct( pOptions ); } -ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, +ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, const ScPrintState& rState, const ScPrintOptions* pOptions ) : pDocShell ( pShell ), pPrinter ( NULL ), @@ -330,7 +331,7 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, bPrintCurrentTable ( FALSE ), bMultiArea ( FALSE ) { - pDev = pWindow; + pDev = pOutDev; nPrintTab = rState.nPrintTab; nStartCol = rState.nStartCol; @@ -1583,7 +1584,7 @@ void ScPrintFunc::PrintArea( USHORT nX1, USHORT nY1, USHORT nX2, USHORT nY2, aGridColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor(); aOutputData.SetGridColor( aGridColor ); - if (!pPrinter) + if ( !pPrinter && !bIsRender ) // when rendering (PDF), don't use printer { OutputDevice* pRefDev = pDoc->GetPrinter(); // auch fuer Preview den Drucker nehmen Fraction aPrintFrac( nZoom, 100 ); // ohne nManualZoom @@ -2310,6 +2311,11 @@ void ScPrintFunc::SetUseStyleColor( BOOL bFlag ) pEditEngine->EnableAutoColor( bUseStyleColor ); } +void ScPrintFunc::SetRenderFlag( BOOL bFlag ) +{ + bIsRender = bFlag; // set when using XRenderable (PDF) +} + // // UpdatePages wird nur von aussen gerufen, um die Umbrueche fuer die Anzeige // richtig zu setzen - immer ohne UserArea -- cgit