diff options
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 198 | ||||
-rw-r--r-- | sc/source/ui/inc/docsh.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/inc/prevwsh.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/inc/tabvwsh.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/prevwsh.cxx | 59 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh4.cxx | 70 |
6 files changed, 0 insertions, 338 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index d6386d040d0c..4b7f79ddfc51 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1943,60 +1943,6 @@ bool ScDocShell::CheckPrint( ScMarkData* pMarkData, bool bForceSelected, bool bI return true; } -void ScDocShell::PreparePrint( ScMarkData* pMarkData ) -{ - SfxPrinter* pPrinter = GetPrinter(); - if ( !pPrinter ) - { - return; - } - - delete pOldJobSetup; // gesetzt nur bei Fehler in StartJob() - pOldJobSetup = new ScJobSetup( pPrinter ); // Einstellungen merken - - // Einstellungen fuer die erste gedruckte Seite muessen hier (vor StartJob) gesetzt werden - //! Selection etc. mit Print() zusammenfassen !!! - //! Seiten nur einmal zaehlen - - bool bHasOptions = false; - ScPrintOptions aOptions; - bool bAllTabs = true; - long nTotalPages = 0; - long aPageArr[MAXTABCOUNT]; // pages per sheet - MultiSelection aPageRanges; // pages to print - ScRange* pMarkedRange = NULL; - - lcl_GetPrintData( this, &aDocument, pPrinter, false, - pMarkData, bHasOptions, aOptions, bAllTabs, nTotalPages, - aPageArr, aPageRanges, &pMarkedRange ); - - BOOL bFound = FALSE; // erste Seite gefunden - long nTabStart = 0; - SCTAB nTabCount = aDocument.GetTableCount(); - for ( SCTAB nTab=0; nTab<nTabCount && !bFound; nTab++ ) - { - if ( bAllTabs || !pMarkData || pMarkData->GetTableSelect( nTab ) ) - { - long nNext = nTabStart + aPageArr[nTab]; - BOOL bSelected = FALSE; - for (long nP=nTabStart+1; nP<=nNext; nP++) // 1-basiert - if (aPageRanges.IsSelected( nP )) // eine Seite von dieser Tabelle selektiert? - bSelected = TRUE; - - if (bSelected) - { - ScPrintFunc aPrintFunc( this, pPrinter, nTab ); - - aPrintFunc.ApplyPrintSettings(); // dann Settings fuer diese Tabelle - bFound = TRUE; - } - nTabStart = nNext; - } - } - - delete pMarkedRange; -} - BOOL lcl_HasTransparent( ScDocument* pDoc, SCTAB nTab, const ScRange* pRange ) { BOOL bFound = FALSE; @@ -2036,150 +1982,6 @@ BOOL lcl_HasTransparent( ScDocument* pDoc, SCTAB nTab, const ScRange* pRange ) return bFound; } -void ScDocShell::Print( SfxProgress& rProgress, - ScMarkData* pMarkData, Window* pDialogParent, BOOL bForceSelected, BOOL bIsAPI ) -{ - SfxPrinter* pPrinter = GetPrinter(); - if ( !pPrinter ) - { - return; - } - - bool bHasOptions = false; - ScPrintOptions aOptions; - bool bAllTabs = true; - long nTotalPages = 0; - long aPageArr[MAXTABCOUNT]; // pages per sheet - MultiSelection aPageRanges; // pages to print - ScRange* pMarkedRange = NULL; - - lcl_GetPrintData( this, &aDocument, pPrinter, bForceSelected, - pMarkData, bHasOptions, aOptions, bAllTabs, nTotalPages, - aPageArr, aPageRanges, &pMarkedRange ); - - USHORT nCollateCopies = 1; - // test if printed range contains transparent objects - - BOOL bHasTransp = FALSE; - BOOL bAnyPrintRanges = aDocument.HasPrintRange(); - ScStyleSheetPool* pStylePool = aDocument.GetStyleSheetPool(); - SCTAB nTabCount = aDocument.GetTableCount(); - for ( SCTAB nTab=0; nTab<nTabCount && !bHasTransp; nTab++ ) - { - if ( bAllTabs || !pMarkData || pMarkData->GetTableSelect( nTab ) ) - { - SfxStyleSheetBase* pStyleSheet = pStylePool->Find( - aDocument.GetPageStyle( nTab ), SFX_STYLE_FAMILY_PAGE ); - if ( pStyleSheet ) - { - const SfxItemSet& rSet = pStyleSheet->GetItemSet(); - if ( ((const ScViewObjectModeItem&)rSet.Get(ATTR_PAGE_CHARTS)).GetValue() == VOBJ_MODE_SHOW || - ((const ScViewObjectModeItem&)rSet.Get(ATTR_PAGE_OBJECTS)).GetValue() == VOBJ_MODE_SHOW || - ((const ScViewObjectModeItem&)rSet.Get(ATTR_PAGE_DRAWINGS)).GetValue() == VOBJ_MODE_SHOW ) - { - if ( pMarkedRange ) - bHasTransp = bHasTransp || lcl_HasTransparent( &aDocument, nTab, pMarkedRange ); - else if ( aDocument.GetPrintRangeCount(nTab) ) - { - USHORT nRangeCount = aDocument.GetPrintRangeCount(nTab); - for (USHORT i=0; i<nRangeCount; i++) - bHasTransp = bHasTransp || - lcl_HasTransparent( &aDocument, nTab, aDocument.GetPrintRange( nTab, i ) ); - } - else if (!bAnyPrintRanges || aDocument.IsPrintEntireSheet(nTab)) - bHasTransp = bHasTransp || lcl_HasTransparent( &aDocument, nTab, NULL ); - } - } - } - } - - for ( USHORT n=0; n<nCollateCopies; n++ ) - { - long nTabStart = 0; - long nDisplayStart = 0; - long nAttrPage = 1; - long nPrinted = 0; - - for ( SCTAB nTab=0; nTab<nTabCount; nTab++ ) - { - if ( bAllTabs || !pMarkData || pMarkData->GetTableSelect( nTab ) ) - { - FmFormView* pDrawView = NULL; - Rectangle aFull( 0, 0, LONG_MAX, LONG_MAX ); - - // #114135# - ScDrawLayer* pModel = aDocument.GetDrawLayer(); // ist nicht NULL - - if(pModel) - { - pDrawView = new FmFormView( pModel, pPrinter ); - pDrawView->ShowSdrPage(pDrawView->GetModel()->GetPage(nTab)); - pDrawView->SetPrintPreview( TRUE ); - } - - ScPrintFunc aPrintFunc( this, pPrinter, nTab, nAttrPage, nTotalPages, pMarkedRange, &aOptions ); - aPrintFunc.SetDrawView( pDrawView ); - nPrinted += aPrintFunc.DoPrint( aPageRanges, nTabStart, nDisplayStart, TRUE, &rProgress, NULL ); - - nTabStart += aPageArr[nTab]; - if ( aDocument.NeedPageResetAfterTab(nTab) ) - nDisplayStart = 0; - else - nDisplayStart += aPageArr[nTab]; - nAttrPage = aPrintFunc.GetFirstPageNo(); // behalten oder aus Vorlage - - delete pDrawView; - } - } - - if ( n+1 < nCollateCopies && - (pPrinter->GetDuplexMode() == DUPLEX_SHORTEDGE || pPrinter->GetDuplexMode() == DUPLEX_LONGEDGE) && - ( nPrinted % 2 ) == 1 ) - { - // #105584# when several collated copies are printed in duplex mode, and there is - // an odd number of pages, print an empty page between copies, so the first page of - // the second copy isn't printed on the back of the last page of the first copy. - // (same as in Writer ViewShell::Prt) - - // FIXME: needs to be adapted to XRenderable interface - #if 0 - pPrinter->StartPage(); - pPrinter->EndPage(); - #endif - } - } - - delete pMarkedRange; - - if (pOldJobSetup) - { - pPrinter->SetOrientation( pOldJobSetup->eOrientation ); - pPrinter->SetPaperBin ( pOldJobSetup->nPaperBin ); - pPrinter->SetPaper ( pOldJobSetup->ePaper ); - - if ( PAPER_USER == pOldJobSetup->ePaper ) - { - pPrinter->SetMapMode( pOldJobSetup->aUserMapMode ); - pPrinter->SetPaperSizeUser( pOldJobSetup->aUserSize ); - } - - delete pOldJobSetup; - pOldJobSetup = NULL; - } - - if ( bHasOptions ) - { - // remove PrintOptions from printer ItemSet, - // so next time the options from the configuration are used - - SfxItemSet aSet( pPrinter->GetOptions() ); - aSet.ClearItem( SID_SCPRINTOPTIONS ); - pPrinter->SetOptions( aSet ); - } - - PostPaintGridAll(); //! nur wenn geaendert -} - void ScDocShell::GetState( SfxItemSet &rSet ) { SfxWhichIter aIter(rSet); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 624aa5181da7..e13bee9d8adc 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -303,10 +303,6 @@ public: void DoHardRecalc( BOOL bApi ); bool CheckPrint( ScMarkData* pMarkData, bool bForceSelected, bool bIsAPI ); - void PreparePrint( ScMarkData* pMarkData ); - void Print( SfxProgress& rProgress, - ScMarkData* pMarkData, Window* pDialogParent, - BOOL bForceSelected, BOOL bIsAPI ); void UpdateOle( const ScViewData* pViewData, BOOL bSnapSize = FALSE ); BOOL IsOle(); diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx index d9f19d48c0c0..79f4d799223a 100644 --- a/sc/source/ui/inc/prevwsh.hxx +++ b/sc/source/ui/inc/prevwsh.hxx @@ -117,9 +117,6 @@ public: virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE ); virtual USHORT SetPrinter( SfxPrinter* pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false ); virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ); - virtual void PreparePrint(); - virtual ErrCode DoPrint( SfxPrinter *pPrinter, BOOL bSilent, BOOL bIsAPI ); - virtual USHORT Print( SfxProgress& rProgress, BOOL bIsAPI ); void AddAccessibilityObject( SfxListener& rObject ); void RemoveAccessibilityObject( SfxListener& rObject ); diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 27baaa6d9c56..c3316092d044 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -370,10 +370,6 @@ public: USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsApi=false ); virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ); - virtual void PreparePrint(); - virtual ErrCode DoPrint( SfxPrinter *pPrinter, - BOOL bSilent, BOOL bIsAPI ); - virtual USHORT Print( SfxProgress& rProgress, BOOL bIsAPI ); void ConnectObject( SdrOle2Obj* pObj ); BOOL ActivateObject( SdrOle2Obj* pObj, long nVerb ); diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 59e3977e9f89..12d153dab1e4 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -495,65 +495,6 @@ SfxTabPage* ScPreviewShell::CreatePrintOptionsPage( Window *pParent, const SfxIt return 0; } -void __EXPORT ScPreviewShell::PreparePrint() -{ - SfxViewShell::PreparePrint(); - - ScMarkData aMarkData; - aMarkData.SelectTable( static_cast< SCTAB >( pPreview->GetTab() ), TRUE ); - pDocShell->PreparePrint(&aMarkData ); -} - -ErrCode ScPreviewShell::DoPrint( SfxPrinter *pPrinter, BOOL bSilent, BOOL bIsAPI ) -{ - ErrCode nRet = ERRCODE_IO_ABORT; - - ScMarkData aMarkData; - aMarkData.SelectTable( static_cast< SCTAB >( pPreview->GetTab() ), TRUE ); - - if ( pDocShell->CheckPrint( &aMarkData, false, bIsAPI ) ) - { - // SfxViewShell::DoPrint calls Print (after StartJob etc.) - nRet = SfxViewShell::DoPrint( pPrinter, bSilent, bIsAPI ); - } - - return nRet; -} - -USHORT __EXPORT ScPreviewShell::Print( SfxProgress& rProgress, BOOL bIsAPI ) -{ - pDocShell->GetDocument()->SetPrintOptions(); // Optionen aus OFA am Printer setzen - - // get the list of affected sheets before SfxViewShell::Print - bool bAllTabs = SC_MOD()->GetPrintOptions().GetAllSheets(); - - ScMarkData aMarkData; - aMarkData.SelectTable( static_cast< SCTAB >( pPreview->GetTab() ), TRUE ); - - uno::Sequence< sal_Int32 > aSheets; - SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); - sal_Int32 nPrinted = 0; - for ( SCTAB nTab = 0; nTab < nTabCount; ++nTab ) - { - if ( bAllTabs || aMarkData.GetTableSelect( nTab ) ) - { - aSheets.realloc( nPrinted + 1 ); - aSheets[nPrinted] = nTab; - ++nPrinted; - } - } - - uno::Sequence < beans::PropertyValue > aProps(1); - aProps[0].Name = ::rtl::OUString::createFromAscii( "PrintSheets" ); - aProps[0].Value <<= aSheets; - SetAdditionalPrintOptions( aProps ); - - SfxViewShell::Print( rProgress, bIsAPI ); - pDocShell->Print( rProgress, &aMarkData, pPreview, FALSE, bIsAPI ); - - return 0; -} - //------------------------------------------------------------------------ void __EXPORT ScPreviewShell::Activate(BOOL bMDI) diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 77fbe6bf5ada..4596880b7fb6 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1169,76 +1169,6 @@ SfxTabPage* ScTabViewShell::CreatePrintOptionsPage( Window *pParent, const SfxIt return 0; } -void __EXPORT ScTabViewShell::PreparePrint() -{ - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - - SfxViewShell::PreparePrint(); - pDocShell->PreparePrint( &GetViewData()->GetMarkData() ); -} - -ErrCode ScTabViewShell::DoPrint( SfxPrinter *pPrinter, BOOL bSilent, BOOL bIsAPI ) -{ - // #72527# if SID_PRINTDOCDIRECT is executed and there's a selection, - // ask if only the selection should be printed - - const ScMarkData& rMarkData = GetViewData()->GetMarkData(); - if ( !bSilent && !bIsAPI && ( rMarkData.IsMarked() || rMarkData.IsMultiMarked() ) ) - { - SvxPrtQryBox aQuery( GetDialogParent() ); - short nBtn = aQuery.Execute(); - - if ( nBtn == RET_CANCEL ) - return ERRCODE_IO_ABORT; - - if ( nBtn == RET_OK ) - bPrintSelected = TRUE; - } - - ErrCode nRet = ERRCODE_IO_ABORT; - - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - if ( pDocShell->CheckPrint( &GetViewData()->GetMarkData(), bPrintSelected, bIsAPI ) ) - { - // get the list of affected sheets before SfxViewShell::Print - bool bAllTabs = SC_MOD()->GetPrintOptions().GetAllSheets(); - - uno::Sequence<sal_Int32> aSheets; - SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); - USHORT nPrinted = 0; - for ( SCTAB nTab=0; nTab<nTabCount; nTab++ ) - if ( bAllTabs || rMarkData.GetTableSelect(nTab) ) - { - aSheets.realloc( nPrinted + 1 ); - aSheets[nPrinted] = nTab; - ++nPrinted; - } - - uno::Sequence < beans::PropertyValue > aProps(1); - aProps[0].Name=::rtl::OUString::createFromAscii("PrintSheets"); - aProps[0].Value <<= aSheets; - SetAdditionalPrintOptions( aProps ); - - // SfxViewShell::DoPrint calls Print (after StartJob etc.) - nRet = SfxViewShell::DoPrint( pPrinter, bSilent, bIsAPI ); - } - - bPrintSelected = FALSE; - - return nRet; -} - -USHORT __EXPORT ScTabViewShell::Print( SfxProgress& rProgress, BOOL bIsAPI ) -{ - ScDocShell* pDocShell = GetViewData()->GetDocShell(); - pDocShell->GetDocument()->SetPrintOptions(); // Optionen aus OFA am Printer setzen - - SfxViewShell::Print( rProgress, bIsAPI ); - pDocShell->Print( rProgress, &GetViewData()->GetMarkData(), - GetDialogParent(), bPrintSelected, bIsAPI ); - return 0; -} - void ScTabViewShell::StopEditShell() { if ( pEditShell != NULL && !bDontSwitch ) |