diff options
Diffstat (limited to 'sw/source/core/doc/doc.cxx')
-rwxr-xr-x[-rw-r--r--] | sw/source/core/doc/doc.cxx | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index dedb46c08e..4d428b4987 100644..100755 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -47,6 +47,7 @@ #include <rtl/ustring.hxx> #include <vcl/virdev.hxx> #include <svl/itemiter.hxx> +#include <svl/poolitem.hxx> #include <unotools/syslocale.hxx> #include <sfx2/printer.hxx> #include <editeng/keepitem.hxx> @@ -55,9 +56,11 @@ #include <sfx2/linkmgr.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svx/svdmodel.hxx> +#include <editeng/pbinitem.hxx> #include <unotools/charclass.hxx> #include <unotools/localedatawrapper.hxx> +#include <swatrset.hxx> #include <swmodule.hxx> #include <fmtpdsc.hxx> #include <fmtanchr.hxx> @@ -1177,6 +1180,23 @@ static void lcl_FormatPostIt( } +// provide the paper tray to use according to the page style in use, +// but do that only if the respective item is NOT just the default item +static sal_Int32 lcl_GetPaperBin( const SwPageFrm *pStartFrm ) +{ + sal_Int32 nRes = -1; + + const SwFrmFmt &rFmt = pStartFrm->GetPageDesc()->GetMaster(); + const SfxPoolItem *pItem = NULL; + SfxItemState eState = rFmt.GetItemState( RES_PAPER_BIN, FALSE, &pItem ); + const SvxPaperBinItem *pPaperBinItem = dynamic_cast< const SvxPaperBinItem * >(pItem); + if (eState > SFX_ITEM_DEFAULT && pPaperBinItem) + nRes = pPaperBinItem->GetValue(); + + return nRes; +} + + void SwDoc::CalculatePagesForPrinting( /* out */ SwRenderData &rData, const SwPrintUIOptions &rOptions, @@ -1187,11 +1207,15 @@ void SwDoc::CalculatePagesForPrinting( if (!pLayout) return; + const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 ); + const bool bPrintSelection = nContent == 2; + // properties to take into account when calcualting the set of pages // (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(); - bool bPrintEmptyPages = rOptions.IsPrintEmptyPages( bIsPDFExport ); + // #i103700# printing selections should not allow for automatic inserting empty pages + bool bPrintEmptyPages = bPrintSelection ? false : rOptions.IsPrintEmptyPages( bIsPDFExport ); Range aPages( 1, nDocPageCount ); @@ -1253,6 +1277,7 @@ void SwDoc::CalculatePagesForPrinting( nPageNo = nFirstPageNo; + std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays(); std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet(); std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames(); rValidPages.clear(); @@ -1268,9 +1293,10 @@ void SwDoc::CalculatePagesForPrinting( if ( bPrintEmptyPages || pStPage->Frm().Height() ) // <-- { - // pStPage->GetUpper()->Paint( pStPage->Frm() ); rValidPages.insert( nPageNo ); rValidStartFrms[ nPageNo ] = pStPage; + + rPrinterPaperTrays[ nPageNo ] = lcl_GetPaperBin( pStPage ); } } @@ -1306,7 +1332,6 @@ void SwDoc::CalculatePagesForPrinting( // 0 -> print all pages (default if aPageRange is empty) // 1 -> print range according to PageRange // 2 -> print selection - const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 ); if (1 == nContent) aPageRange = rOptions.getStringValue( "PageRange", OUString() ); if (2 == nContent) @@ -1526,8 +1551,9 @@ void SwDoc::CalculatePagePairsForProspectPrinting( const SwPrintUIOptions &rOptions, sal_Int32 nDocPageCount ) { - std::set< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet(); - std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames(); + std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays(); + std::set< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet(); + std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames(); std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rData.GetPagePairsForProspectPrinting(); rPagePairs.clear(); @@ -1535,6 +1561,18 @@ void SwDoc::CalculatePagePairsForProspectPrinting( rValidStartFrms.clear(); rtl::OUString aPageRange = rOptions.getStringValue( "PageRange", rtl::OUString() ); + // PageContent : + // 0 -> print all pages (default if aPageRange is empty) + // 1 -> print range according to PageRange + // 2 -> print selection + const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 ); + if (0 == nContent) + { + // set page range to print to 'all pages' + aPageRange = OUString::valueOf( (sal_Int32)1 ); + aPageRange += OUString::valueOf( (sal_Unicode)'-'); + aPageRange += OUString::valueOf( nDocPageCount ); + } StringRangeEnumerator aRange( aPageRange, 1, nDocPageCount, 0 ); DBG_ASSERT( pLayout, "no layout present" ); @@ -1559,6 +1597,8 @@ void SwDoc::CalculatePagePairsForProspectPrinting( rValidPagesSet.insert( nPageNum ); rValidStartFrms[ nPageNum ] = pPageFrm; pPageFrm = (SwPageFrm*)pPageFrm->GetNext(); + + rPrinterPaperTrays[ nPageNum ] = lcl_GetPaperBin( pStPage ); } DBG_ASSERT( nPageNum == nDocPageCount, "unexpected number of pages" ); |