diff options
-rwxr-xr-x | sw/inc/IDocumentDeviceAccess.hxx | 2 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 9 | ||||
-rw-r--r-- | sw/inc/printdata.hxx | 79 | ||||
-rw-r--r-- | sw/inc/swprtopt.hxx | 48 | ||||
-rw-r--r-- | sw/inc/unomod.hxx | 2 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 9 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 36 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 56 | ||||
-rw-r--r-- | sw/source/core/view/viewpg.cxx | 34 | ||||
-rw-r--r-- | sw/source/core/view/vprint.cxx | 189 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbmgr.cxx | 90 | ||||
-rw-r--r-- | sw/source/ui/inc/view.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/uiview/viewprt.cxx | 44 | ||||
-rw-r--r-- | sw/source/ui/uno/unotxdoc.cxx | 131 |
14 files changed, 430 insertions, 301 deletions
diff --git a/sw/inc/IDocumentDeviceAccess.hxx b/sw/inc/IDocumentDeviceAccess.hxx index 30e698e74d70..fbfdd82d001b 100755 --- a/sw/inc/IDocumentDeviceAccess.hxx +++ b/sw/inc/IDocumentDeviceAccess.hxx @@ -33,7 +33,7 @@ class SfxPrinter; class JobSetup; - struct SwPrintData; + class SwPrintData; class VirtualDevice; class OutputDevice; diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 2b1937f2912e..d2ec00c8ad0c 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -208,7 +208,8 @@ struct SwDocStat; struct SwHash; struct SwSortOptions; struct SwDefTOXBase_Impl; -struct SwPrintData; +class SwPrintData; +class SwPrintUIOptions; class SdrPageView; struct SwConversionArgs; class SwRewriter; @@ -216,7 +217,7 @@ class SwMsgPoolItem; class SwChartDataProvider; class SwChartLockController_Helper; class IGrammarContact; -class SwPrintUIOptions; +class SwPrintData; class SwPageFrm; namespace sw { namespace mark { @@ -1335,9 +1336,9 @@ public: // get the set of printable pages for the XRenderable API by // evaluating the respective settings (see implementation) - void CalculatePagesForPrinting( bool bIsPDFExport, SwPrintUIOptions &rPrintUIOptions, + void CalculatePagesForPrinting( bool bIsPDFExport, SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ); - void CalculatePagePairsForProspectPrinting( SwPrintUIOptions &rPrintUIOptions, + void CalculatePagePairsForProspectPrinting( SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ); sal_uInt16 GetPageCount() const; diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 1a6547ab540e..3ff07102733a 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -33,9 +33,75 @@ #include <sal/types.h> #include <rtl/ustring.hxx> +#include <vcl/print.hxx> -struct SwPrintData +#include <set> +#include <map> +#include <vector> +#include <utility> + +class SwPageFrm; + +//////////////////////////////////////////////////////////// + +class SwPrintUIOptions : public vcl::PrinterOptionsHelper +{ + OutputDevice* m_pLast; + + // pages valid for printing (according to the current settings) + // and their respective start frames (see getRendererCount in unotxdoc.cxx) + // This set of pages does NOT depend on the 'PageRange' that is used as a printing option! + std::set< sal_Int32 > aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) + std::map< sal_Int32, const SwPageFrm * > aValidStartFrms; // the map of start frames for those pages + + // vector of pages and their order to be printed (duplicates and any order allowed!) + // (see 'render' in unotxdoc.cxx) + std::vector< sal_Int32 > aPagesToPrint; + + // for prospect printing: the pairs of pages to be printed together on a single prospect page. + // -1 indicates a half page to be left empty. + std::vector< std::pair< sal_Int32, sal_Int32 > > aPagePairs; + +public: + SwPrintUIOptions( BOOL bWeb = FALSE ); + ~SwPrintUIOptions(); + + bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); + + typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; + typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t; + + std::set< sal_Int32 > & GetValidPagesSet() { return aValidPages; } + const std::set< sal_Int32 > & GetValidPagesSet() const { return aValidPages; } + ValidStartFramesMap_t & GetValidStartFrms() { return aValidStartFrms; } + const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } + + // used for 'normal' printing + std::vector< sal_Int32 > & GetPagesToPrint() { return aPagesToPrint; } + const std::vector< sal_Int32 > & GetPagesToPrint() const { return aPagesToPrint; } + + // used for prospect printing only + PagePairsVec_t & GetPagePairsForProspectPrinting() { return aPagePairs; } + const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return aPagePairs; } + + bool IsPrintLeftPages() const; + bool IsPrintRightPages() const; + bool IsPrintEmptyPages( bool bIsPDFExport ) const; + bool IsPrintTables() const; + bool IsPrintGraphics() const; + bool IsPrintDrawings() const; +}; + + +//////////////////////////////////////////////////////////// + + +class SwPrintData { + const SwPrintUIOptions * m_pPrintUIOptions; + +public: + sal_Bool bPrintGraphic, bPrintTable, bPrintDraw, bPrintControl, bPrintPageBackground, bPrintBlackFont, //#i81434# - printing of hidden text @@ -55,6 +121,8 @@ struct SwPrintData SwPrintData() { + m_pPrintUIOptions = NULL; + bPrintGraphic = bPrintTable = bPrintDraw = @@ -103,6 +171,12 @@ struct SwPrintData bPrintHiddenText == rData.bPrintHiddenText && bPrintTextPlaceholder == rData.bPrintTextPlaceholder; } + + // Note: int the conntext where this class ist used the pointer should always be valid + // during the lifetime of this object + const SwPrintUIOptions & GetPrintUIOptions() const { return *m_pPrintUIOptions; } + void SetPrintUIOptions( const SwPrintUIOptions *pOpt ) { m_pPrintUIOptions = pOpt; } + sal_Bool IsPrintGraphic() const { return bPrintGraphic; } sal_Bool IsPrintTable() const { return bPrintTable; } sal_Bool IsPrintDraw() const { return bPrintDraw; } @@ -139,8 +213,11 @@ struct SwPrintData void SetFaxName(const rtl::OUString& rSet){sFaxName = rSet;} void SetPrintHiddenText(sal_Bool b){ doSetModified(); bPrintHiddenText = b;} void SetPrintTextPlaceholder(sal_Bool b){ doSetModified(); bPrintTextPlaceholder = b;} + virtual void doSetModified () { bModified = sal_True;} }; +//////////////////////////////////////////////////////////// + #endif //_SW_PRINTDATA_HXX diff --git a/sw/inc/swprtopt.hxx b/sw/inc/swprtopt.hxx index 53b00bff4f07..86bcefa5d455 100644 --- a/sw/inc/swprtopt.hxx +++ b/sw/inc/swprtopt.hxx @@ -31,7 +31,6 @@ #ifndef _SWPRTOPT_HXX #define _SWPRTOPT_HXX -#include <vcl/print.hxx> #include <tools/multisel.hxx> #include <printdata.hxx> @@ -46,10 +45,9 @@ #define POSTITS_ENDPAGE 3 -class SwPageFrm; - //////////////////////////////////////////////////////////// + class SwPrtOptions : public SwPrintData { USHORT nJobNo; @@ -96,49 +94,5 @@ public: //////////////////////////////////////////////////////////// -class SwPrintUIOptions : public vcl::PrinterOptionsHelper -{ - OutputDevice* mpLast; - - // pages valid for printing (according to the current settings) - // and their respective start frames (see getRendererCount in unotxdoc.cxx) - // This set of pages does NOT depend on the 'PageRange' that is used as a printing option! - std::set< sal_Int32 > aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString ) - std::map< sal_Int32, const SwPageFrm * > aValidStartFrms; // the map of start frames for those pages - - // vector of pages and their order to be printed (duplicates and any order allowed!) - // (see 'render' in unotxdoc.cxx) - std::vector< sal_Int32 > aPagesToPrint; - - // for prospect printing: the pairs of pages to be printed together on a single prospect page. - // -1 indicates a half page to be left empty. - std::vector< std::pair< sal_Int32, sal_Int32 > > aPagePairs; - -public: - SwPrintUIOptions( BOOL bWeb ); - - bool processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ); - - typedef std::map< sal_Int32, const SwPageFrm * > ValidStartFramesMap_t; - typedef std::vector< std::pair< sal_Int32, sal_Int32 > > PagePairsVec_t; - - std::set< sal_Int32 > & GetValidPagesSet() { return aValidPages; } - const std::set< sal_Int32 > & GetValidPagesSet() const { return aValidPages; } - ValidStartFramesMap_t & GetValidStartFrms() { return aValidStartFrms; } - const ValidStartFramesMap_t & GetValidStartFrms() const { return aValidStartFrms; } - - // used for 'normal' printing - std::vector< sal_Int32 > & GetPagesToPrint() { return aPagesToPrint; } - const std::vector< sal_Int32 > & GetPagesToPrint() const { return aPagesToPrint; } - - // used for prospect printing only - PagePairsVec_t & GetPagePairsForProspectPrinting() { return aPagePairs; } - const PagePairsVec_t & GetPagePairsForProspectPrinting() const { return aPagePairs; } - - bool IsPrintLeftPages() const; - bool IsPrintRightPages() const; -}; - - #endif //_SWPRTOPT_HXX diff --git a/sw/inc/unomod.hxx b/sw/inc/unomod.hxx index dcb2f9cfcbda..0f46a92f323e 100644 --- a/sw/inc/unomod.hxx +++ b/sw/inc/unomod.hxx @@ -45,7 +45,7 @@ class SwView; class SwViewOption; -struct SwPrintData; +class SwPrintData; class SwDoc; /****************************************************************************** diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 7b81a0ce191b..7292ce74fcff 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -127,6 +127,7 @@ class SwUnoCrsr; class SwXDocumentPropertyHelper; class SfxViewFrame; class SwPrintUIOptions; +class SwPrintData; typedef UnoActionContext* UnoActionContextPtr; SV_DECL_PTRARR(ActionContextArr, UnoActionContextPtr, 4, 4) @@ -216,11 +217,11 @@ class SwXTextDocument : public SwXTextDocumentBaseClass, css::uno::Reference< css::container::XNameContainer> xXFormsContainer; //temporary frame to enable PDF export if no valid view is available - SfxViewFrame* m_pHiddenViewFrame; - css::uno::Reference< css::uno::XInterface> xPropertyHelper; - SwXDocumentPropertyHelper* pPropertyHelper; + SfxViewFrame* m_pHiddenViewFrame; + css::uno::Reference< css::uno::XInterface> xPropertyHelper; + SwXDocumentPropertyHelper* pPropertyHelper; - SwPrintUIOptions* m_pPrintUIOptions; + SwPrintUIOptions* m_pPrintUIOprions; void GetBodyText(); void GetNumberFormatter(); diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 007fc7c05ed3..9e4f89fb1134 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -71,7 +71,7 @@ class SfxViewShell; class SwViewOption; class SwViewImp; class SwPrtOptions; -class SwPrintUIOptions; +class SwPrintData; class SwPagePreViewPrtData; class Window; class OutputDevice; @@ -94,12 +94,19 @@ class SwPostItMgr; // #i74769# class SdrPaintWindow; +namespace vcl +{ + class PrinterController; +}; + + //JP 19.07.98: - Bug 52312 // define fuer Flags, die im CTOR oder den darunter liegenden Schichten // benoetigt werden. // Zur Zeit wird fuer die DrawPage das PreView Flag benoetigt #define VSHELLFLAG_ISPREVIEW ((long)0x1) + class SW_DLLPUBLIC ViewShell : public Ring { friend void SetOutDev( ViewShell *pSh, OutputDevice *pOut ); @@ -188,7 +195,7 @@ class SW_DLLPUBLIC ViewShell : public Ring SW_DLLPRIVATE void Scroll(); //Scrollen wenn sich aus der LayAction Scrollmoeglichkeiten //ergaben. - SW_DLLPRIVATE void PrepareForPrint( const SwPrtOptions &rOptions ); + SW_DLLPRIVATE void PrepareForPrint( const SwPrintData &rOptions ); SW_DLLPRIVATE void ImplApplyViewOptions( const SwViewOption &rOpt ); @@ -363,20 +370,27 @@ public: void ChgAllPageOrientation( sal_uInt16 eOri ); void ChgAllPageSize( Size &rSz ); - //Druckauftrag abwickeln. + // printing of one page. // bIsPDFExport == true is: do PDF Export (no printing!) - sal_Bool PrintOrPDFExport( OutputDevice* pOutDev, SwPrtOptions& rOptions, - const SwPrintUIOptions &rPrintUIOptions, + sal_Bool PrintOrPDFExport( OutputDevice *pOutDev, const SwPrtOptions &rPrintData, sal_Int32 nRenderer, /* offset in vector of pages to print */ bool bIsPDFExport = sal_False ); - // Prospekt-Format drucken - void PrintProspect( OutputDevice* pOutDev, SwPrtOptions& rOptions, - const SwPrintUIOptions &rPrintUIOptions, - sal_Int32 nRenderer /* offset in vector of page pairs for prospect */ ); + // printing of one brochure page + void PrintProspect( OutputDevice *pOutDev, const SwPrintData &rPrintData, + sal_Int32 nRenderer /* offset in vector of page pairs for prospect printing */ ); + + // printing of a complete document for mail merge + // bIsPDFExport == true is: do PDF Export (no printing!) + sal_Bool PrintOrPDFExportMM( const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + const SwPrtOptions &rPrintData, bool bIsPDFExport = sal_False ); + + // printing of a complete brochure for mail merge + void PrintProspectMM( const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + const SwPrintData &rPrintData, bool bProspectRTL ); - //"Drucken" fuer OLE 2.0 - static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, SwPrtOptions& rOptions, + // printing for OLE 2.0 + static void PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData& rOptions, OutputDevice* pOleOut, const Rectangle& rRect ); // creates temporary doc with selected text for PDF export diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index e480138a8ca6..ca02f3e2eb30 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -993,7 +993,7 @@ const SwDocStat& SwDoc::GetDocStat() const void SwDoc::CalculatePagesForPrinting( bool bIsPDFExport, - SwPrintUIOptions &rPrintUIOptions, + SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ) { DBG_ASSERT( pLayout, "no layout present" ); @@ -1001,22 +1001,12 @@ void SwDoc::CalculatePagesForPrinting( return; // properties to take into account when calcualting the set of pages - bool bPrintLeftPage = rPrintUIOptions.IsPrintLeftPages(); - bool bPrintRightPage = rPrintUIOptions.IsPrintRightPages(); + // (PDF export UI does not allow for selecting left or right pages only) + bool bPrintLeftPages = bIsPDFExport ? true : rOptions.IsPrintLeftPages(); + bool bPrintRightPages = bIsPDFExport ? true : rOptions.IsPrintRightPages(); // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now -//TLPDF bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); - bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( "PrintEmptyPages", false ); - - if (bIsPDFExport) - { - // PDF export UI does not allow for selecting left or right pages only or reverse print - bPrintLeftPage = true; - bPrintRightPage = true; -// bPrintReverse = false; - // TLPDF, TODO; take care of the option 'Export automatically inserted blank pages' - // from the 'Export as PDF' (aka PDF Options) dialog. - bPrintEmptyPages = false; - } +//TLPDF bool bPrintReverse = rOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); + bool bPrintEmptyPages = rOptions.IsPrintEmptyPages( bIsPDFExport ); Range aPages( 1, nDocPageCount ); @@ -1088,16 +1078,16 @@ void SwDoc::CalculatePagesForPrinting( #endif // TL_NOT_NOW /*TLPDF*/ nPageNo = nFirstPageNo; - std::set< sal_Int32 > &rValidPages = rPrintUIOptions.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rPrintUIOptions.GetValidStartFrms(); + std::set< sal_Int32 > &rValidPages = rOptions.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrms(); rValidPages.clear(); rValidStartFrms.clear(); while ( pStPage ) { const BOOL bRightPg = pStPage->OnRightPage(); if ( aMulti.IsSelected( nPageNo ) && - ( (bRightPg && bPrintRightPage) || - (!bRightPg && bPrintLeftPage) ) ) + ( (bRightPg && bPrintRightPages) || + (!bRightPg && bPrintLeftPages) ) ) { // --> FME 2005-12-12 #b6354161# Feature - Print empty pages if ( bPrintEmptyPages || pStPage->Frm().Height() ) @@ -1130,18 +1120,18 @@ void SwDoc::CalculatePagesForPrinting( void SwDoc::CalculatePagePairsForProspectPrinting( - SwPrintUIOptions &rPrintUIOptions, + SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ) { - std::set< sal_Int32 > &rValidPagesSet = rPrintUIOptions.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rPrintUIOptions.GetValidStartFrms(); - std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rPrintUIOptions.GetPagePairsForProspectPrinting(); + std::set< sal_Int32 > &rValidPagesSet = rOptions.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rOptions.GetValidStartFrms(); + std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rOptions.GetPagePairsForProspectPrinting(); rPagePairs.clear(); rValidPagesSet.clear(); rValidStartFrms.clear(); - rtl::OUString aPageRange = rPrintUIOptions.getStringValue( "PageRange", rtl::OUString() ); + rtl::OUString aPageRange = rOptions.getStringValue( "PageRange", rtl::OUString() ); StringRangeEnumerator aRange( aPageRange, 1, nDocPageCount, 0 ); DBG_ASSERT( pLayout, "no layout present" ); @@ -1170,14 +1160,14 @@ void SwDoc::CalculatePagePairsForProspectPrinting( DBG_ASSERT( nPageNum == nDocPageCount, "unexpected number of pages" ); // properties to take into account when calcualting the set of pages - // Note: here bPrintLeftPage and bPrintRightPage refer to the (virtual) resulting pages + // Note: here bPrintLeftPages and bPrintRightPages refer to the (virtual) resulting pages // of the prospect! - bool bPrintLeftPage = rPrintUIOptions.IsPrintLeftPages(); - bool bPrintRightPage = rPrintUIOptions.IsPrintRightPages(); + bool bPrintLeftPages = rOptions.IsPrintLeftPages(); + bool bPrintRightPages = rOptions.IsPrintRightPages(); // TLPDF, TODO: remove bPrintReverse, should be handled by PLs framework now -//TLPDF bool bPrintReverse = rPrintUIOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); - // TLPDF: this one seems not to be used in prospect printing: bool bPrintEmptyPages = rPrintUIOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); - bool bPrintProspect_RTL = rPrintUIOptions.getIntValue( "PrintBrochureRTL", 0 ) ? true : false; +//TLPDF bool bPrintReverse = rOptions.getBoolValue( C2U( "PrintReverseOrder" ), false ); + // TLPDF: this one seems not to be used in prospect printing: bool bPrintEmptyPages = rOptions.getBoolValue( C2U( "PrintEmptyPages" ), false ); + bool bPrintProspect_RTL = rOptions.getIntValue( "PrintBrochureRTL", 0 ) ? true : false; // get pages for prospect printing according to the 'PageRange' // (duplicates and any order allowed!) @@ -1247,9 +1237,9 @@ void SwDoc::CalculatePagePairsForProspectPrinting( if ( 0 == (nEPg & 1 )) // ungerade gibt es nicht! --nEPg; - if ( !bPrintLeftPage ) + if ( !bPrintLeftPages ) ++nStep; - else if ( !bPrintRightPage ) + else if ( !bPrintRightPages ) { ++nStep; ++nSPg, --nEPg; diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 283e6b6a79f2..fbcae6776d82 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -447,18 +447,30 @@ void ViewShell::PrintPreViewPage( SwPrtOptions& rOptions, pFntCache->Flush(); } + +void ViewShell::PrintProspectMM( + const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + const SwPrintData & rPrintData, + bool bProspectRTL ) +{ + (void) rpPrinterController; (void) rPrintData; (void) bProspectRTL; + + Printer::PrintJob( rpPrinterController, JobSetup() ); +} + + // print brochure // OD 05.05.2003 #i14016# - consider empty pages on calculation of the scaling // for a page to be printed. void ViewShell::PrintProspect(
OutputDevice* pOutDev,
- SwPrtOptions& rOptions,
- const SwPrintUIOptions & rPrintUIOptions, /* TLPDF keep this or the above? */
- sal_Int32 nRenderer )
+ const SwPrintData & rPrintData, + sal_Int32 nRenderer // the index in the vector of prospect pages to be printed + )
{ // TLPDF if( !rOptions.aMulti.GetSelectCount() ) Printer *pPrinter = dynamic_cast< Printer * >(pOutDev); - if (!pPrinter || rPrintUIOptions.GetPagePairsForProspectPrinting().size() <= 0) + if (!pPrinter || rPrintData.GetPrintUIOptions().GetPagePairsForProspectPrinting().size() <= 0) return; #ifdef TL_NOT_NOW /*TLPDF*/ @@ -475,15 +487,15 @@ void ViewShell::PrintProspect( /* TLPDF neu: start */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintUIOptions.GetPagePairsForProspectPrinting().size(), "nRenderer out of bounds"); + DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetPrintUIOptions().GetPagePairsForProspectPrinting().size(), "nRenderer out of bounds"); #endif std::pair< sal_Int32, sal_Int32 > rPagesToPrint = - rPrintUIOptions.GetPagePairsForProspectPrinting()[ nRenderer ]; + rPrintData.GetPrintUIOptions().GetPagePairsForProspectPrinting()[ nRenderer ]; const USHORT nPageMax = static_cast< USHORT >(rPagesToPrint.first > rPagesToPrint.second ? rPagesToPrint.first : rPagesToPrint.second); #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( rPagesToPrint.first == -1 || rPrintUIOptions.GetValidPagesSet().count( rPagesToPrint.first ) == 1, "first Page not valid" ); - DBG_ASSERT( rPagesToPrint.second == -1 || rPrintUIOptions.GetValidPagesSet().count( rPagesToPrint.second ) == 1, "second Page not valid" ); + DBG_ASSERT( rPagesToPrint.first == -1 || rPrintData.GetPrintUIOptions().GetValidPagesSet().count( rPagesToPrint.first ) == 1, "first Page not valid" ); + DBG_ASSERT( rPagesToPrint.second == -1 || rPrintData.GetPrintUIOptions().GetValidPagesSet().count( rPagesToPrint.second ) == 1, "second Page not valid" ); #endif /* TLPDF neu: end */ @@ -509,7 +521,7 @@ void ViewShell::PrintProspect( SET_CURR_SHELL( &aShell ); - aShell.PrepareForPrint( rOptions ); + aShell.PrepareForPrint( rPrintData ); // gibt es versteckte Absatzfelder, unnoetig wenn die Absaetze bereits // ausgeblendet sind. @@ -541,7 +553,7 @@ void ViewShell::PrintProspect( #ifdef TL_NOT_NOW /*TLPDF*/ should not happen any more since the test - rPrintUIOptions.GetPagePairsForProspectPrinting().size() <= 0 + rPrintData.GetPagePairsForProspectPrinting().size() <= 0 above should have taken care that there is at least one page to print if( !pStPage ) // dann wars das { @@ -680,7 +692,7 @@ void ViewShell::PrintProspect( /* TLPDF neu: start */ const SwPageFrm *pStPage = 0; const SwPageFrm *pNxtPage = 0; - const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintUIOptions.GetValidStartFrms(); + const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrms(); if (rPagesToPrint.first > 0) { SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( rPagesToPrint.first ) ); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index a1878283cf01..23cf28e938ea 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -230,7 +230,7 @@ const XubString& SwPrtOptions::MakeNextJobName() /*****************************************************************************/ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : - mpLast( NULL ) + m_pLast( NULL ) { ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) ); @@ -257,13 +257,13 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create a bool option for background m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ), aLocalizedStrings.GetString( 3 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBackground" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ), sal_True ); // create a bool option for graphics m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ), aLocalizedStrings.GetString( 5 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintGraphicsAndDiagrams" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTablesGraphicsAndDiagrams" ) ), sal_True ); if (!bWeb) { @@ -276,7 +276,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create a bool option for place holder m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ), aLocalizedStrings.GetString( 9 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPlaceholder" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ), sal_False ); } @@ -292,7 +292,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : // create a bool option for black m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ), aLocalizedStrings.GetString( 14 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlack" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ), sal_False ); // create subgroup for misc options @@ -309,7 +309,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) ); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ), aLocalizedStrings.GetString( 19 ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PaperTray" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ), sal_False, aPaperTrayOpt ); @@ -332,7 +332,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aHelpText[1] = aLocalizedStrings.GetString( 25 ); m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ), aHelpText, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintNotes" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ), aChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ) @@ -363,7 +363,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : } // create a bool option for brochure - rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochure" ) ); + rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ); m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 33 ), aLocalizedStrings.GetString( 34 ), aBrochurePropertyName, @@ -379,7 +379,7 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) ); m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(), uno::Sequence< rtl::OUString >(), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBrochureRTL" ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ), aBRTLChoices, 0, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ), aBrochureRTLOpt ); @@ -417,22 +417,79 @@ SwPrintUIOptions::SwPrintUIOptions( BOOL bWeb ) : aPageRangeOpt ); - DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" ); } + +SwPrintUIOptions::~SwPrintUIOptions() +{ +} + bool SwPrintUIOptions::IsPrintLeftPages() const { - sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 ); - return nLRPages == 0 || nLRPages == 1; + // take care of different property names for the option. + // for compatibility the old name should win + + // 0: left and right pages + // 1: left pages only + // 2: right pages only + sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); + bool bRes = nLRPages == 0 || nLRPages == 1; + bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ ); + return bRes; } bool SwPrintUIOptions::IsPrintRightPages() const { - sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 ); - return nLRPages == 0 || nLRPages == 2; + // take care of different property names for the option. + // for compatibility the old name should win +
+ sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ ); + bool bRes = nLRPages == 0 || nLRPages == 2; + bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ ); + return bRes; } +bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const
+{
+ // take care of different property names for the option. +
+ bool bRes = bIsPDFExport ?
+ !getBoolValue( "IsSkipEmptyPages", sal_True ) :
+ getBoolValue( "PrintEmptyPages", sal_True );
+ return bRes;
+}
+
+bool SwPrintUIOptions::IsPrintTables() const
+{
+ // take care of different property names for the option. + // for compatibility the old name should win +
+ bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True );
+ bRes = getBoolValue( "PrintTables", bRes );
+ return bRes;
+}
+
+bool SwPrintUIOptions::IsPrintGraphics() const
+{
+ // take care of different property names for the option. + // for compatibility the old name should win +
+ bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True );
+ bRes = getBoolValue( "PrintGraphics", bRes );
+ return bRes;
+}
+
+bool SwPrintUIOptions::IsPrintDrawings() const
+{
+ // take care of different property names for the option. + // for compatibility the old name should win +
+ bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True );
+ bRes = getBoolValue( "PrintDDrawings", bRes );
+ return bRes;
+}
+ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp ) { bool bChanged = processProperties( i_rNewProp ); @@ -447,9 +504,9 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::un VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); pOut = pDevice ? pDevice->GetOutputDevice() : 0; } - bChanged = bChanged || (pOut != mpLast); + bChanged = bChanged || (pOut != m_pLast); if( pOut ) - mpLast = pOut; + m_pLast = pOut; return bChanged; } @@ -938,6 +995,9 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, const SwFrm *pPage = pLayout->Lower(); SwLayAction aAction( pLayout, Imp() ); +#ifdef TL_NOT_NOW /*TLPDF*/ +//Currently we have no progress bar here. It is handled in the new Print UI now. +//Not year clear: what about Progressbar in MailMerge if( pProgress ) { // HACK, damit die Anzeige sich nicht verschluckt. @@ -947,6 +1007,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? aAction.SetProgress(pProgress); } +#endif // TL_NOT_NOW /*TLPDF*/ pLayout->StartAllAction(); for ( USHORT i = 1; pPage && i <= nMax; pPage = pPage->GetNext(), ++i ) @@ -954,6 +1015,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, if ( ( bPrtJob && !pPrt->IsJobActive() ) || Imp()->IsStopPrt() ) break; +#ifdef TL_NOT_NOW /*TLPDF*/ if( pProgress ) { //HACK, damit die Anzeige sich nicht verschluckt. @@ -961,6 +1023,7 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, lcl_SetState( *pProgress, i, nStatMax, pStr, nMergeAct, nMergeCnt, 0, i ); pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? } +#endif // TL_NOT_NOW /*TLPDF*/ if ( ( bPrtJob && !pPrt->IsJobActive() ) || Imp()->IsStopPrt() ) break; @@ -980,8 +1043,10 @@ void ViewShell::CalcPagesForPrint( USHORT nMax, SfxProgress* pProgress, Imp()->SetFirstVisPageInvalid(); SwPaintQueue::Repaint(); +#ifdef TL_NOT_NOW /*TLPDF*/ if ( pProgress ) pProgress->Reschedule(); //Mag der Anwender noch oder hat er genug? +#endif // TL_NOT_NOW /*TLPDF*/ } if (pProgress) @@ -1175,11 +1240,23 @@ SwDoc * ViewShell::FillPrtDoc( SwDoc *pPrtDoc, const SfxPrinter* pPrt) } +sal_Bool ViewShell::PrintOrPDFExportMM( + const boost::shared_ptr< vcl::PrinterController > & rpPrinterController, + const SwPrtOptions &rPrintData, /* TLPDF can't we make use of just SwPrintData only as it is the case in PrintProspect??? */ + bool bIsPDFExport ) +{ + (void) rpPrinterController; (void) rPrintData; (void) bIsPDFExport; + + + Printer::PrintJob( rpPrinterController, JobSetup() ); + return sal_True; +} + + sal_Bool ViewShell::PrintOrPDFExport( OutputDevice* pOutDev, - SwPrtOptions& rOptions, - const SwPrintUIOptions &rPrintUIOptions, /* TLPDF keep this or the above? */ - sal_Int32 nRenderer, + const SwPrtOptions &rPrintData, /* TLPDF can't we make use of just SwPrintData only as it is the case in PrintProspect??? */ + sal_Int32 nRenderer, // the index in the vector of pages to be printed bool bIsPDFExport ) { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -1190,11 +1267,11 @@ sal_Bool ViewShell::PrintOrPDFExport( //! Note: Since for PDF export of (multi-)selection a temporary //! document is created that contains only the selects parts, //! and thus that document is to printed in whole the, - //! rOptions.bPrintSelection parameter will be false. - BOOL bSelection = rOptions.bPrintSelection; + //! rPrintData.bPrintSelection parameter will be false. + BOOL bSelection = rPrintData.bPrintSelection; // TLPDF: this one should hold just one page now. Thus clean-up should be possible - MultiSelection aMulti( rOptions.aMulti ); + MultiSelection aMulti( rPrintData.aMulti ); if ( !pOutDev || !aMulti.GetSelectCount() ) return bStartJob; @@ -1270,21 +1347,21 @@ sal_Bool ViewShell::PrintOrPDFExport( // save options at draw view: SwDrawViewSave aDrawViewSave( pShell->GetDrawView() ); - pShell->PrepareForPrint( rOptions ); + pShell->PrepareForPrint( rPrintData ); XubString* pStr = 0; - ULONG nMergeAct = rOptions.nMergeAct, nMergeCnt = rOptions.nMergeCnt; +//TLPDF ULONG nMergeAct = rPrintData.nMergeAct, nMergeCnt = rPrintData.nMergeCnt; /* TLPDF neu: start */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintUIOptions.GetPagesToPrint().size(), "nRenderer out of bounds"); + DBG_ASSERT( 0 <= nRenderer && nRenderer < (sal_Int32)rPrintData.GetPrintUIOptions().GetPagesToPrint().size(), "nRenderer out of bounds"); #endif - const sal_Int32 nPage = rPrintUIOptions.GetPagesToPrint()[ nRenderer ]; /* TLPDF */ + const sal_Int32 nPage = rPrintData.GetPrintUIOptions().GetPagesToPrint()[ nRenderer ]; /* TLPDF */ #if OSL_DEBUG_LEVEL > 1 - DBG_ASSERT( rPrintUIOptions.GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); + DBG_ASSERT( rPrintData.GetPrintUIOptions().GetValidPagesSet().count( nPage ) == 1, "nPage not valid" ); #endif - const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintUIOptions.GetValidStartFrms(); + const SwPrintUIOptions::ValidStartFramesMap_t &rFrms = rPrintData.GetPrintUIOptions().GetValidStartFrms(); SwPrintUIOptions::ValidStartFramesMap_t::const_iterator aIt( rFrms.find( nPage ) ); DBG_ASSERT( aIt != rFrms.end(), "failed to find start frame" ); const SwPageFrm *pStPage = aIt->second; @@ -1293,7 +1370,7 @@ sal_Bool ViewShell::PrintOrPDFExport( // ben�tigte Seiten fuers Drucken formatieren pShell->CalcPagesForPrint( (USHORT)nPage, 0 /*TLPDF*/, pStr, - nMergeAct, nMergeCnt ); + 0, 0 /* TLPDF, there is no progressbar right now nMergeAct, nMergeCnt */ ); // Some field types, can require a valid layout // (expression fields in tables). For these we do an UpdateFlds @@ -1301,19 +1378,19 @@ sal_Bool ViewShell::PrintOrPDFExport( // --> FME 2004-06-21 #i9684# For performance reasons, we do not update // the fields during pdf export. // #i56195# prevent update of fields (for mail merge) - if ( !bIsPDFExport && rOptions.bUpdateFieldsInPrinting ) + if ( !bIsPDFExport && rPrintData.bUpdateFieldsInPrinting ) // <-- pShell->UpdateFlds(TRUE); // TLPDF if( !pShell->Imp()->IsStopOutDev() && -// TLPDF ( bIsPDFExport || rOptions.GetJobName().Len() || pOutDev->IsJobActive()) ) +// TLPDF ( bIsPDFExport || rPrintData.GetJobName().Len() || pOutDev->IsJobActive()) ) if( /*!pShell->Imp()->IsStopOutDev() && */ - ( bIsPDFExport || rOptions.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) + ( bIsPDFExport || rPrintData.GetJobName().Len() /*TLPDF|| pOutDev->IsJobActive()*/) ) { BOOL bStop = FALSE; int nJobStartError = JOBSET_ERR_DEFAULT; - XubString sJobName( rOptions.GetJobName() ); + XubString sJobName( rPrintData.GetJobName() ); // HACK: Hier muss von der MultiSelection noch eine akzeptable Moeglichkeit // geschaffen werden, alle Seiten von Seite x an zu deselektieren. @@ -1342,7 +1419,7 @@ sal_Bool ViewShell::PrintOrPDFExport( _SetGetExpFlds aPostItFields; SwDoc* pPostItDoc = 0; ViewShell* pPostItShell = 0; - if( rOptions.nPrintPostIts != POSTITS_NONE ) + if( rPrintData.nPrintPostIts != POSTITS_NONE ) { lcl_GetPostIts( pDoc, aPostItFields ); pPostItDoc = new SwDoc; @@ -1354,11 +1431,11 @@ sal_Bool ViewShell::PrintOrPDFExport( pShell->GetViewOptions() ); // Wenn PostIts am Dokumentenende gedruckt werden sollen, // die Druckreihenfolge allerdings umgekehrt ist, dann hier - if ( ( rOptions.nPrintPostIts == POSTITS_ENDDOC ) && - rOptions.bPrintReverse ) + if ( ( rPrintData.nPrintPostIts == POSTITS_ENDDOC ) && + rPrintData.bPrintReverse ) lcl_PrintPostItsEndDoc( pPostItShell, aPostItFields, aMulti, sJobName, bStartJob, nJobStartError, - rOptions.bPrintRightPage, rOptions.bPrintLeftPage, TRUE ); + rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, TRUE ); } @@ -1370,7 +1447,7 @@ sal_Bool ViewShell::PrintOrPDFExport( // BOOL bSetPaperSz = FALSE; BOOL bSetPrt = FALSE; - if ( rOptions.nPrintPostIts != POSTITS_ONLY ) + if ( rPrintData.nPrintPostIts != POSTITS_ONLY ) { //TLPDF while( pStPage && !bStop ) { @@ -1381,7 +1458,7 @@ sal_Bool ViewShell::PrintOrPDFExport( { aOldMapMode = pOutDev->GetMapMode(); Point aNewOrigin = pOutDev->GetMapMode().GetOrigin(); - aNewOrigin += rOptions.aOffset; + aNewOrigin += rPrintData.aOffset; MapMode aTmp( pOutDev->GetMapMode() ); aTmp.SetOrigin( aNewOrigin ); pOutDev->SetMapMode( aTmp ); @@ -1437,12 +1514,12 @@ sal_Bool ViewShell::PrintOrPDFExport( // Wenn PostIts nach Seite gedruckt werden sollen, // jedoch Reverse eingestellt ist ... - if( rOptions.bPrintReverse && - rOptions.nPrintPostIts == POSTITS_ENDPAGE ) + if( rPrintData.bPrintReverse && + rPrintData.nPrintPostIts == POSTITS_ENDPAGE ) lcl_PrintPostItsEndPage( pPostItShell, aPostItFields, nPage /* TLPDF nPageNo*/, aMulti, sJobName, bStartJob, nJobStartError, - rOptions.bPrintRightPage, rOptions.bPrintLeftPage, - rOptions.bPrintReverse ); + rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, + rPrintData.bPrintReverse ); if( !bStartJob && JOBSET_ERR_DEFAULT == nJobStartError @@ -1456,7 +1533,7 @@ sal_Bool ViewShell::PrintOrPDFExport( nJobStartError = JOBSET_ERR_ISSTARTET; } // --> FME 2005-12-12 #b6354161# Feature - Print empty pages -// TLPDF if ( rOptions.bPrintEmptyPages || pStPage->Frm().Height() ) +// TLPDF if ( rPrintData.bPrintEmptyPages || pStPage->Frm().Height() ) // <-- { pStPage->GetUpper()->Paint( pStPage->Frm() ); @@ -1464,12 +1541,12 @@ sal_Bool ViewShell::PrintOrPDFExport( SwPaintQueue::Repaint(); // Wenn PostIts nach Seite gedruckt werden sollen ... - if( (!rOptions.bPrintReverse) && - rOptions.nPrintPostIts == POSTITS_ENDPAGE ) + if( (!rPrintData.bPrintReverse) && + rPrintData.nPrintPostIts == POSTITS_ENDPAGE ) lcl_PrintPostItsEndPage( pPostItShell, aPostItFields, nPage /* TLPDF nPageNo */, aMulti, sJobName, bStartJob, nJobStartError, - rOptions.bPrintRightPage, rOptions.bPrintLeftPage, - rOptions.bPrintReverse ); + rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, + rPrintData.bPrintReverse ); } // den eventl. fuer Umschlaege modifizierte OutDevOffset wieder @@ -1483,12 +1560,12 @@ sal_Bool ViewShell::PrintOrPDFExport( if (!bStop) // TLPDF: see break above { // Wenn PostIts am Dokumentenende gedruckt werden sollen, dann hier machen - if( ((rOptions.nPrintPostIts == POSTITS_ENDDOC) && !rOptions.bPrintReverse) - || (rOptions.nPrintPostIts == POSTITS_ONLY) ) + if( ((rPrintData.nPrintPostIts == POSTITS_ENDDOC) && !rPrintData.bPrintReverse) + || (rPrintData.nPrintPostIts == POSTITS_ONLY) ) lcl_PrintPostItsEndDoc( pPostItShell, aPostItFields, aMulti, sJobName, bStartJob, nJobStartError, - rOptions.bPrintRightPage, rOptions.bPrintLeftPage, - rOptions.bPrintReverse ); + rPrintData.bPrintRightPage, rPrintData.bPrintLeftPage, + rPrintData.bPrintReverse ); if( pPostItShell ) { @@ -1496,8 +1573,8 @@ sal_Bool ViewShell::PrintOrPDFExport( delete pPostItShell; //Nimmt das PostItDoc mit ins Grab. } - if( bStartJob ) - rOptions.bJobStartet = TRUE; +//TLPDF if( bStartJob ) +//TLPDF rPrintData.bJobStartet = TRUE; } // TLPDF: if (!bStop) see break above } @@ -1532,7 +1609,7 @@ sal_Bool ViewShell::PrintOrPDFExport( -void ViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, SwPrtOptions& rOptions, +void ViewShell::PrtOle2( SwDoc *pDoc, const SwViewOption *pOpt, const SwPrintData& rOptions, OutputDevice* pOleOut, const Rectangle& rRect ) { //Wir brauchen eine Shell fuer das Drucken. Entweder hat das Doc schon @@ -1679,7 +1756,7 @@ SwDrawViewSave::~SwDrawViewSave() // OD 09.01.2003 #i6467# - method also called for page preview -void ViewShell::PrepareForPrint( const SwPrtOptions &rOptions ) +void ViewShell::PrepareForPrint( const SwPrintData &rOptions ) { // Viewoptions fuer den Drucker setzen pOpt->SetGraphic ( TRUE == rOptions.bPrintGraphic ); diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 97d882c3a8e1..e53f5d766427 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -79,7 +79,8 @@ #include <svtools/zformat.hxx> #include <svtools/stritem.hxx> #include <svtools/eitem.hxx> -#include <sfx2/printer.hxx> +#include <vcl/oldprintadaptor.hxx> +//#include <sfx2/printer.hxx> #include <sfx2/docfile.hxx> #include <sfx2/progress.hxx> #include <sfx2/dispatch.hxx> @@ -877,11 +878,11 @@ SwNewDBMgr::~SwNewDBMgr() --------------------------------------------------------------------*/ -BOOL SwNewDBMgr::MergePrint( SwView& rView, - SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) +BOOL SwNewDBMgr::MergePrint( SwView& /*rView*/, + SwPrtOptions& /*rOpt*/, SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ ) { - (void) rView; (void) rOpt; (void) rProgress; (void) bIsAPI; /* TLPDF */ -#ifdef TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer + return TRUE; +#ifdef TL_NOT_NOW /*TLPDF*/ SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section BOOL bSynchronizedDoc = pSh->IsLabelDoc() && pSh->GetSectionFmtCount() > 1; @@ -904,12 +905,12 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); pModOpt->SetSinglePrintJob(rOpt.IsPrintSingleJobs()); - SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); -#ifdef TL_NOT_NOW /*TLPDF*/ - Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); - if( rOpt.IsPrintSingleJobs() ) - pPrt->SetEndPrintHdl( Link() ); -#endif +//TLPDF SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); + const boost::shared_ptr< Printer > pPrt( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF + vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF +//TLPDF Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); +//TLPDF if( rOpt.IsPrintSingleJobs() ) +//TLPDF pPrt->SetEndPrintHdl( Link() ); BOOL bUserBreak = FALSE, bRet = FALSE; @@ -986,23 +987,27 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ); pPrt->StartJob( rOpt.GetJobName() ); } -#endif if( pPrt->IsJobActive() ) { - pSh->PrintProspect( rOpt, rProgress, rOpt.IsPrintProspect_RTL() ); + pSh->PrintProspectMM( aPrtAdaptor, rOpt, rOpt.IsPrintProspect_RTL() ); /* TLPDF */ bRet = TRUE; } +#endif // TL_NOT_NOW /*TLPDF*/ + pSh->PrintProspectMM( aPrtAdaptor, rOpt, rOpt.IsPrintProspect_RTL() ); // TLPDF + bRet = TRUE; // TLPDF } - else if( pSh->Prt( pPrt, rOpt, &rProgress ) ) /* TLPDF */ + else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, rOpt ) /* TLPDF */ ) bRet = TRUE; bMergeLock = FALSE; +#ifdef TL_NOT_NOW /*TLPDF*/ if( !pPrt->IsJobActive() ) { bUserBreak = TRUE; bRet = FALSE; break; } +#endif // TL_NOT_NOW /*TLPDF*/ if( !rOpt.IsPrintSingleJobs() ) { String& rJNm = (String&)rOpt.GetJobName(); @@ -1012,15 +1017,16 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0; } while( bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()); -#ifdef TL_NOT_NOW /*TLPDF*/ if( rOpt.IsPrintSingleJobs() ) { - SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); - pTmpPrinter->SetEndPrintHdl( aSfxSaveLnk ); - if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? - aSfxSaveLnk.Call( pTmpPrinter ); +//TLPDF SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); +//TLPDF const boost::shared_ptr< Printer > pTmpPrinter( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF +//TLPDF vcl::OldStylePrintAdaptor aPrtAdaptor( pTmpPrinter ); + // TLPDF +//TLPDF pTmpPrinter->SetEndPrintHdl( aSfxSaveLnk ); +//TLPDF if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? +//TLPDF aSfxSaveLnk.Call( pTmpPrinter ); } -#endif rOpt.nMergeCnt = 0; rOpt.nMergeAct = 0; @@ -1039,29 +1045,28 @@ BOOL SwNewDBMgr::MergePrint( SwView& rView, } return bRet; -#endif // TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer - return TRUE; /* TLPDF */ +#endif // TL_NOT_NOW /*TLPDF*/ } /*-- 21.06.2004 09:08:16--------------------------------------------------- -----------------------------------------------------------------------*/ -BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, - SwPrtOptions& rOpt, SfxProgress& rProgress, BOOL bIsAPI ) +BOOL SwNewDBMgr::MergePrintDocuments( SwView& /*rView*/, + SwPrtOptions& /*rOpt*/, SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ ) { - (void) rView; (void) rOpt; (void) rProgress; (void) bIsAPI; /* TLPDF */ -#ifdef TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer + return TRUE; +#ifdef TL_NOT_NOW /*TLPDF*/ SwWrtShell* pSh = &rView.GetWrtShell(); //check if the doc is synchronized and contains at least one linked section //merge source is already open rOpt.nMergeCnt = 0; rOpt.SetPrintSingleJobs( sal_True ); - SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); -#ifdef TL_NOT_NOW /*TLPDF*/ - Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); - if( rOpt.IsPrintSingleJobs() ) - pPrt->SetEndPrintHdl( Link() ); -#endif +//TLPDF SfxPrinter *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( false ); + const boost::shared_ptr< Printer > pPrt( new Printer /* Printer( const JobSetup& rJobSetup ) */ ); // TLPDF + vcl::OldStylePrintAdaptor aPrtAdaptor( pPrt ); // TLPDF +//TLPDF Link aSfxSaveLnk = pPrt->GetEndPrintHdl(); +//TLPDF if( rOpt.IsPrintSingleJobs() ) +//TLPDF pPrt->SetEndPrintHdl( Link() ); BOOL bUserBreak = FALSE, bRet = FALSE; @@ -1152,17 +1157,13 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, bMergeLock = TRUE; if(rOpt.IsPrintProspect()) { - if( pPrt->IsJobActive() -#ifdef TL_NOT_NOW /*TLPDF*/ - || pPrt->StartJob( rOpt.GetJobName() ) -#endif - ) - { - pSh->PrintProspect( rOpt, rProgress, rOpt.IsPrintProspect_RTL() ); +//TLPDF if( pPrt->IsJobActive() || pPrt->StartJob( rOpt.GetJobName() )) +//TLPDF { + pSh->PrintProspectMM( aPrtAdaptor, rOpt, rOpt.IsPrintProspect_RTL() ); bRet = TRUE; - } +//TLPDF } } - else if( pSh->Prt( pPrt, rOpt, &rProgress ) ) /* TLPDF */ + else if( pSh->PrintOrPDFExportMM( aPrtAdaptor, rOpt ) /* TLPDF */ ) bRet = TRUE; bMergeLock = FALSE; @@ -1179,15 +1180,15 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, } } -#ifdef TL_NOT_NOW /*TLPDF*/ if( rOpt.IsPrintSingleJobs() ) { +#ifdef TL_NOT_NOW /*TLPDF*/ SfxPrinter* pTmpPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); pTmpPrinter->SetEndPrintHdl( aSfxSaveLnk ); if ( !bUserBreak && !pTmpPrinter->IsJobActive() ) //Schon zu spaet? aSfxSaveLnk.Call( pTmpPrinter ); +#endif // TL_NOT_NOW /*TLPDF*/ } -#endif rOpt.nMergeCnt = 0; rOpt.nMergeAct = 0; @@ -1206,8 +1207,7 @@ BOOL SwNewDBMgr::MergePrintDocuments( SwView& rView, } return bRet; -#endif // TL_NOT_NOW /*TLPDF*/ //!! Currently broken beyond repair since we will not have a printer - return TRUE; /* TLPDF */ +#endif // TL_NOT_NOW /*TLPDF*/ } diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx index 7ddfc2775299..0fb458573a61 100644 --- a/sw/source/ui/inc/view.hxx +++ b/sw/source/ui/inc/view.hxx @@ -88,7 +88,7 @@ class SwPrtOptions; class SwTransferable; class SwMailMergeConfigItem; class SwTxtNode; // #i23726# -struct SwPrintData; +class SwPrintData; class SwFormatClipboard; struct SwConversionArgs; class Graphic; diff --git a/sw/source/ui/uiview/viewprt.cxx b/sw/source/ui/uiview/viewprt.cxx index a6faae1894da..ab601c6926c3 100644 --- a/sw/source/ui/uiview/viewprt.cxx +++ b/sw/source/ui/uiview/viewprt.cxx @@ -47,6 +47,7 @@ #endif #include <sfx2/request.hxx> +#include <sfx2/progress.hxx> #include <sfx2/app.hxx> #include <svtools/flagitem.hxx> #include <vcl/msgbox.hxx> @@ -174,9 +175,8 @@ USHORT __EXPORT SwView::SetPrinter(SfxPrinter* pNew, USHORT nDiffFlags, bool ) Beschreibung: --------------------------------------------------------------------*/ -ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) +ErrCode SwView::DoPrint( SfxPrinter* pPrinter, PrintDialog* pDlg, BOOL bSilent, BOOL bIsAPI ) { - #if 0 // First test SwWrtShell* pSh = &GetWrtShell(); SwNewDBMgr* pMgr = pSh->GetNewDBMgr(); @@ -200,10 +200,10 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / } // Der PrintProgress stellt Handler am Printer der ViewShell ein. -// Das kann natuerlich erste nach dem evtl. Umschalten des Druckers korrekt +// Das kann natuerlich erst nach dem evtl. Umschalten des Druckers korrekt // funktionieren. #55210# // SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent ); - SfxPrintProgress *pProgress = 0; + /* TLPDF SfxPrintProgress */ SfxProgress *pProgress = 0; SfxPrinter *pDocPrinter = GetPrinter(TRUE); if ( !pPrinter ) pPrinter = pDocPrinter; @@ -211,13 +211,17 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / { //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 ); +//TLPDF SfxPrinter* pClone = pDocPrinter->Clone(); +//TLPDF SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); +//TLPDF pProgress = new SfxPrintProgress( this, !bSilent ); +//TLPDF pProgress->RestoreOnEndPrint( pClone ); } if(!pProgress) - pProgress = new SfxPrintProgress( this, !bSilent ); +//TLPDF pProgress = new SfxPrintProgress( this, !bSilent ); + { + SfxObjectShell *pObjShell = GetViewFrame()->GetObjectShell(); // TLPDF ?? + pProgress = new SfxProgress( pObjShell, String(), 1 ); // TLPDF ?? + } pProgress->SetWaitMode(FALSE); BOOL bStartJob = pPrinter->InitJob( &GetEditWin(), @@ -384,16 +388,16 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / SetAdditionalPrintOptions(aViewProperties); SfxViewShell::Print(*pProgress, bIsAPI ); - if ( !pProgress->IsAborted() ) +//TLPDF if ( !pProgress->IsAborted() ) { if( bPrtPros ) { - bStartJob = pPrinter->StartJob( aOpts.GetJobName() ); - if( bStartJob ) - pSh->PrintProspect( aOpts, *pProgress, bPrtPros_RTL ); +//TLPDF bStartJob = pPrinter->StartJob( aOpts.GetJobName() ); +//TLPDF if( bStartJob ) + pSh->PrintProspectMM( aPrtAdaptor, aOpts, bPrtPros_RTL ); /* TLPDF */ } else - bStartJob = pSh->Prt( pPrinter, aOpts, pProgress ); /*TLPDF*/ + bStartJob = pSh->PrintOrPDFExportMM( aPrtAdaptor, aOpts ); /*TLPDF*/ if ( bBrowse ) { @@ -404,8 +408,8 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / pSh->UnlockPaint(); } } - else - bStartJob = FALSE; +//TLPDF else +//TLPDF bStartJob = FALSE; pSh->LockView( bLockedView ); } @@ -432,13 +436,9 @@ ErrCode SwView::DoPrint( SfxPrinter* /*pPrinter*/, PrintDialog* /*pDlg*/, BOOL / } pProgress->Stop(); - pProgress->DeleteOnEndPrint(); - pPrinter->EndJob(); +//TLPDF pProgress->DeleteOnEndPrint(); +//TLPDF pPrinter->EndJob(); return pPrinter->GetError(); - #else - DBG_ERROR( "dead code" ); - return ERRCODE_IO_NOTSUPPORTED; - #endif } diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 104e3257ccfb..135e0c05bc10 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -360,7 +360,7 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell) : pxLinkTargetSupplier(0), pxXRedlines(0), m_pHiddenViewFrame(0), - m_pPrintUIOptions( NULL ) + m_pPrintUIOprions( NULL ) { } /*-- 18.12.98 11:53:00--------------------------------------------------- @@ -375,7 +375,7 @@ SwXTextDocument::~SwXTextDocument() xNumFmtAgg->setDelegator(x0); xNumFmtAgg = 0; } - delete m_pPrintUIOptions; + delete m_pPrintUIOprions; } @@ -2608,13 +2608,13 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( if(!IsValid()) throw RuntimeException(); - if( ! m_pPrintUIOptions ) + if( ! m_pPrintUIOprions ) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + m_pPrintUIOprions = new SwPrintUIOptions( bWebDoc ); } - bool bFormat = m_pPrintUIOptions->processPropertiesAndCheckFormat( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + bool bFormat = m_pPrintUIOprions->processPropertiesAndCheckFormat( rxOptions ); + const bool bIsPDFExport = !m_pPrintUIOprions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); @@ -2660,8 +2660,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( OUString aPageRange; if (bIsPDFExport) { -// TLPDF ?? m_pPrintUIOptions->getValue( C2U("Selection") ); - aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); +// TLPDF ?? m_pPrintUIOprions->getValue( C2U("Selection") ); + aPageRange = m_pPrintUIOprions->getStringValue( "PageRange", OUString() ); } else { @@ -2669,8 +2669,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // 0 -> print all pages // 1 -> print range according to PageRange // 2 -> print selection - if (1 == m_pPrintUIOptions->getIntValue( "PrintContent", 0 )) - aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); + if (1 == m_pPrintUIOprions->getIntValue( "PrintContent", 0 )) + aPageRange = m_pPrintUIOprions->getStringValue( "PageRange", OUString() ); } if (aPageRange.getLength() == 0) // empty string -> print all { @@ -2681,26 +2681,26 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } // get number of pages to be rendered - const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", false ); + const bool bPrintProspect = m_pPrintUIOprions->getBoolValue( "PrintProspect", false ); if (bPrintProspect) { - pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOptions, nPageCount ); - nRet = m_pPrintUIOptions->GetPagePairsForProspectPrinting().size(); + pDoc->CalculatePagePairsForProspectPrinting( *m_pPrintUIOprions, nPageCount ); + nRet = m_pPrintUIOprions->GetPagePairsForProspectPrinting().size(); } else { // get set of valid pages (according to the current settings) // and their start frames - pDoc->CalculatePagesForPrinting( bIsPDFExport, *m_pPrintUIOptions, nPageCount ); + pDoc->CalculatePagesForPrinting( bIsPDFExport, *m_pPrintUIOprions, nPageCount ); DBG_ASSERT( nPageCount >= 1, "valid pages count is 0! Should not happen." ); // get vector of pages to print according to PageRange and valid pages from above // (result may be an empty vector, for example if the range string is not correct) StringRangeEnumerator::getRangesFromString( - aPageRange, m_pPrintUIOptions->GetPagesToPrint(), - 1, nPageCount, 0, &m_pPrintUIOptions->GetValidPagesSet() ); + aPageRange, m_pPrintUIOprions->GetPagesToPrint(), + 1, nPageCount, 0, &m_pPrintUIOprions->GetValidPagesSet() ); - nRet = m_pPrintUIOptions->GetPagesToPrint().size(); + nRet = m_pPrintUIOprions->GetPagesToPrint().size(); } DBG_ASSERT( nRet >= 0, "negative number of pages???" ); @@ -2719,13 +2719,13 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if(!IsValid()) throw RuntimeException(); - if( ! m_pPrintUIOptions ) + if( ! m_pPrintUIOprions ) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); } m_pPrintUIOptions->processProperties( rxOptions ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + const bool bIsPDFExport = !m_pPrintUIOprions->hasProperty( "IsPrinter" ); SfxViewShell *pView = 0; SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport ); @@ -2740,19 +2740,21 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( if (nRenderer >= pDoc->GetPageCount()) return uno::Sequence< beans::PropertyValue >(); - const bool bIsSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); + bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages(); Size aPgSize( pDoc->GetPageSize( sal_uInt16(nRenderer + 1), bIsSkipEmptyPages ) ); awt::Size aPageSize( TWIP_TO_MM100( aPgSize.Width() ), TWIP_TO_MM100( aPgSize.Height() )); // prospect printing should be landscape, thus switching width and height - if (m_pPrintUIOptions->getBoolValue( "PrintBrochure", sal_False )) + if (m_pPrintUIOprions->getBoolValue( "PrintProspect", sal_False )) aPageSize = awt::Size( aPageSize.Height, aPageSize.Width ); - uno::Sequence< beans::PropertyValue > aRenderer(1); + uno::Sequence< beans::PropertyValue > aRenderer(2); PropertyValue &rValue = aRenderer.getArray()[0]; rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); rValue.Value <<= aPageSize; + rValue.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) ); + rValue.Value <<= sal_False; - m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); + m_pPrintUIOprions->appendPrintUIOptions( aRenderer ); return aRenderer; } @@ -2809,14 +2811,14 @@ void SAL_CALL SwXTextDocument::render( if(!IsValid()) throw RuntimeException(); - if (!m_pPrintUIOptions) + if (!m_pPrintUIOprions) { const BOOL bWebDoc = (0 != PTR_CAST(SwWebDocShell, pDocShell)); - m_pPrintUIOptions = new SwPrintUIOptions( bWebDoc ); + m_pPrintUIOprions = new SwPrintUIOptions( bWebDoc ); } - m_pPrintUIOptions->processProperties( rxOptions ); - const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", false ); - const bool bIsPDFExport = !m_pPrintUIOptions->hasProperty( "IsPrinter" ); + m_pPrintUIOprions->processProperties( rxOptions ); + const bool bPrintProspect = m_pPrintUIOprions->getBoolValue( "PrintProspect", false ); + const bool bIsPDFExport = !m_pPrintUIOprions->hasProperty( "IsPrinter" ); // get view shell to use SfxViewShell *pView = 0; @@ -2824,7 +2826,7 @@ void SAL_CALL SwXTextDocument::render( pView = GuessViewShell(); else { - uno::Any aTmp( m_pPrintUIOptions->getValue( C2U( "View" ) )); + uno::Any aTmp( m_pPrintUIOprions->getValue( C2U( "View" ) )); uno::Reference< frame::XController > xController; if (aTmp >>= xController) { @@ -2843,8 +2845,8 @@ void SAL_CALL SwXTextDocument::render( // Thus instead of throwing the exception we silently return. if (0 > nRenderer) throw IllegalArgumentException(); - if ( (bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagePairsForProspectPrinting().size()) - || (!bPrintProspect && size_t(nRenderer) >= m_pPrintUIOptions->GetPagesToPrint().size())) + if ( (bPrintProspect && size_t(nRenderer) >= m_pPrintUIOprions->GetPagePairsForProspectPrinting().size()) + || (!bPrintProspect && size_t(nRenderer) >= m_pPrintUIOprions->GetPagesToPrint().size())) return; // the view shell should be SwView for documents PDF export @@ -2860,7 +2862,7 @@ void SAL_CALL SwXTextDocument::render( ((SwPagePreView*)pView)->GetViewShell(); } - uno::Any aAny( m_pPrintUIOptions->getValue( C2U( "RenderDevice" ) )); + uno::Any aAny( m_pPrintUIOprions->getValue( C2U( "RenderDevice" ) )); uno::Reference< awt::XDevice > xRenderDevice; aAny >>= xRenderDevice; @@ -2873,42 +2875,42 @@ void SAL_CALL SwXTextDocument::render( if(pVwSh && pOut) { - const bool bFirstPage = m_pPrintUIOptions->getBoolValue( "IsFirstPage", sal_False ); - const bool bLastPage = m_pPrintUIOptions->getBoolValue( "IsLastPage", sal_False ); - const bool bIsSkipEmptyPages = m_pPrintUIOptions->getBoolValue( "IsSkipEmptyPages", sal_False ); - const rtl::OUString aPageRange = m_pPrintUIOptions->getStringValue( "PageRange", OUString() ); - - SwPrtOptions aOptions( C2U("PDF export") ); + // TLPDF2DO: clean-up, need to check if only one of aOptions and m_pPrintUIOprions should be used + SwPrtOptions aOptions( C2U( bIsPDFExport ? "PDF export" : "Printing" ) ); - // get print options to use from provided properties + // get default print options const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell); BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId ); SwView::MakeOptions( NULL, aOptions, NULL, NULL, bWeb, NULL, NULL ); - sal_Int64 nLeftRightPages = 0; - if( ! aOptions.bPrintLeftPage ) - nLeftRightPages = 2; - if( ! aOptions.bPrintRightPage ) - nLeftRightPages = 1; - nLeftRightPages = m_pPrintUIOptions->getIntValue( "PrintLeftRightPages", nLeftRightPages ); - aOptions.bPrintGraphic = m_pPrintUIOptions->getBoolValue( "PrintGraphicsAndDiagrams", aOptions.bPrintGraphic ); - aOptions.bPrintTable = m_pPrintUIOptions->getBoolValue( "PrintGraphicsAndDiagrams", aOptions.bPrintTable ); - aOptions.bPrintDraw = m_pPrintUIOptions->getBoolValue( "PrintGraphicsAndDiagrams", aOptions.bPrintDraw ); - aOptions.bPrintControl = m_pPrintUIOptions->getBoolValue( "PrintControls", aOptions.bPrintControl ); - aOptions.bPrintLeftPage = nLeftRightPages == 0 || nLeftRightPages == 1; - aOptions.bPrintRightPage = nLeftRightPages == 0 || nLeftRightPages == 2; - aOptions.bPrintPageBackground = m_pPrintUIOptions->getBoolValue( "PrintBackground", aOptions.bPrintPageBackground ); - aOptions.bPrintEmptyPages = m_pPrintUIOptions->getBoolValue( "PrintEmptyPages", aOptions.bPrintEmptyPages ); + + // get print options to use from provided properties + const rtl::OUString aPageRange = m_pPrintUIOprions->getStringValue( "PageRange", OUString() ); + const bool bFirstPage = m_pPrintUIOprions->getBoolValue( "IsFirstPage", sal_False ); + const bool bLastPage = m_pPrintUIOprions->getBoolValue( "IsLastPage", sal_False ); + bool bIsSkipEmptyPages = !m_pPrintUIOprions->IsPrintEmptyPages( bIsPDFExport ); + aOptions.bPrintGraphic = m_pPrintUIOprions->IsPrintGraphics(); + aOptions.bPrintTable = m_pPrintUIOprions->IsPrintTables(); + aOptions.bPrintDraw = m_pPrintUIOprions->IsPrintDrawings(); + aOptions.bPrintControl = m_pPrintUIOprions->getBoolValue( "PrintControls", aOptions.bPrintControl ); + aOptions.bPrintLeftPage = m_pPrintUIOprions->IsPrintLeftPages(); + aOptions.bPrintRightPage = m_pPrintUIOprions->IsPrintRigthPages(); + aOptions.bPrintPageBackground = m_pPrintUIOprions->getBoolValue( "PrintPageBackground", aOptions.bPrintPageBackground ); + aOptions.bPrintEmptyPages = !bIsSkipEmptyPages; // bUpdateFieldsInPrinting <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PaperTray", aOptions.bPaperFromSetup ); - aOptions.bPrintReverse = m_pPrintUIOptions->getBoolValue( "PrintReverseOrder", aOptions.bPrintReverse ); - aOptions.bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintBrochure", aOptions.bPrintProspect ); - aOptions.bPrintProspect_RTL = m_pPrintUIOptions->getIntValue( "PrintBrochureRTL", aOptions.bPrintProspect_RTL ) ? true : false; + aOptions.bPaperFromSetup = m_pPrintUIOprions->getBoolValue( "PrintPaperFromSetup", aOptions.bPaperFromSetup ); + aOptions.bPrintReverse = m_pPrintUIOprions->getBoolValue( "PrintReversed", aOptions.bPrintReverse ); + aOptions.bPrintProspect = m_pPrintUIOprions->getBoolValue( "PrintProspect", aOptions.bPrintProspect ); + aOptions.bPrintProspect_RTL = m_pPrintUIOprions->getIntValue( "PrintProspectRTL", aOptions.bPrintProspect_RTL ) ? true : false; // bPrintSingleJobs <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? // bModified <-- not set here // TLPDF: TODO: remove this from SwPrintData?? Get rid of SwPrtOptions?? - aOptions.bPrintBlackFont = m_pPrintUIOptions->getBoolValue( "PrintBlack", aOptions.bPrintBlackFont ); - aOptions.bPrintHiddenText = m_pPrintUIOptions->getBoolValue( "PrintHiddenText", aOptions.bPrintHiddenText ); - aOptions.bPrintTextPlaceholder = m_pPrintUIOptions->getBoolValue( "PrintPlaceholder", aOptions.bPrintTextPlaceholder ); - aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOptions->getIntValue( "PrintNotes", aOptions.nPrintPostIts )); + aOptions.bPrintBlackFont = m_pPrintUIOprions->getBoolValue( "PrintBlackFonts", aOptions.bPrintBlackFont ); + aOptions.bPrintHiddenText = m_pPrintUIOprions->getBoolValue( "PrintHiddenText", aOptions.bPrintHiddenText ); + aOptions.bPrintTextPlaceholder = m_pPrintUIOprions->getBoolValue( "PrintTextPlaceholder", aOptions.bPrintTextPlaceholder ); + aOptions.nPrintPostIts = static_cast< sal_Int16 >(m_pPrintUIOprions->getIntValue( "PrintAnnotationMode", aOptions.nPrintPostIts )); + + //! needs to be set after MakeOptions since the assingment operation in that + //! function will destroy this pointer + aOptions.SetPrintUIOptions( m_pPrintUIOprions ); Range aRange( nRenderer+1, nRenderer+1 ); MultiSelection aPages( aRange ); @@ -2948,9 +2950,9 @@ void SAL_CALL SwXTextDocument::render( // TLPDF OutputDevice *pOldDev = pVwSh->GetOut(); // TLPDF if (bPrintProspect) - pVwSh->PrintProspect( pOut, aOptions, *m_pPrintUIOptions, nRenderer ); + pVwSh->PrintProspect( pOut, aOptions, nRenderer ); else // normal printing and PDF export - pVwSh->PrintOrPDFExport( pOut, aOptions, *m_pPrintUIOptions, nRenderer, bIsPDFExport ); + pVwSh->PrintOrPDFExport( pOut, aOptions, nRenderer, bIsPDFExport ); // --> FME 2004-10-08 #i35176# // @@ -2977,7 +2979,8 @@ void SAL_CALL SwXTextDocument::render( lcl_DisposeView( m_pHiddenViewFrame, pDocShell ); m_pHiddenViewFrame = 0; } - delete m_pPrintUIOptions, m_pPrintUIOptions = NULL; + aOptions.SetPrintUIOptions( NULL ); + delete m_pPrintUIOprions, m_pPrintUIOprions = NULL; } } } |