You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2011/09/18 00:39:52 UTC
svn commit: r1172115 - in /incubator/ooo/trunk/main:
sfx2/source/view/viewprn.cxx sw/inc/unotxdoc.hxx
sw/source/ui/uno/unotxdoc.cxx vcl/inc/vcl/print.hxx
vcl/source/gdi/print3.cxx vcl/source/window/printdlg.cxx
Author: mst
Date: Sat Sep 17 22:39:52 2011
New Revision: 1172115
URL: http://svn.apache.org/viewvc?rev=1172115&view=rev
Log:
sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines
# HG changeset patch
# User Oliver-Rainer Wittmann <od...@openoffice.org>
# Date 1304508061 -7200
# Node ID 766a0b3ad79f0aba468ae8ca769cad4906057167
# Parent c2ceb432950c99187e6924defb187fbf049d76cc
Modified:
incubator/ooo/trunk/main/sfx2/source/view/viewprn.cxx
incubator/ooo/trunk/main/sw/inc/unotxdoc.hxx
incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx
incubator/ooo/trunk/main/vcl/inc/vcl/print.hxx
incubator/ooo/trunk/main/vcl/source/gdi/print3.cxx
incubator/ooo/trunk/main/vcl/source/window/printdlg.cxx
Modified: incubator/ooo/trunk/main/sfx2/source/view/viewprn.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sfx2/source/view/viewprn.cxx?rev=1172115&r1=1172114&r2=1172115&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sfx2/source/view/viewprn.cxx (original)
+++ incubator/ooo/trunk/main/sfx2/source/view/viewprn.cxx Sat Sep 17 22:39:52 2011
@@ -158,7 +158,10 @@ SfxPrinterController::SfxPrinterControll
Sequence< beans::PropertyValue > aUIProps;
aRenderParms[i].Value >>= aUIProps;
setUIOptions( aUIProps );
- break;
+ }
+ else if( aRenderParms[i].Name.compareToAscii( "NUp", 3 ) == 0 )
+ {
+ setValue( aRenderParms[i].Name, aRenderParms[i].Value );
}
}
}
Modified: incubator/ooo/trunk/main/sw/inc/unotxdoc.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/inc/unotxdoc.hxx?rev=1172115&r1=1172114&r2=1172115&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/inc/unotxdoc.hxx (original)
+++ incubator/ooo/trunk/main/sw/inc/unotxdoc.hxx Sat Sep 17 22:39:52 2011
@@ -238,6 +238,14 @@ class SW_DLLPUBLIC SwXTextDocument : pub
rtl::OUString maBuildId;
+ // --> OD #i117783#
+ // boolean for XPagePrintable
+ // set in XPagePrintable::printPages(..) to indicate that the PagePrintSettings
+ // has to be applied in XRenderable::getRenderer(..) through which the printing
+ // is implemented.
+ sal_Bool bApplyPagePrintSettingsFromXPagePrintable;
+ // <--
+
using SfxBaseModel::addEventListener;
using SfxBaseModel::removeEventListener;
Modified: incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx?rev=1172115&r1=1172114&r2=1172115&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/ui/uno/unotxdoc.cxx Sat Sep 17 22:39:52 2011
@@ -36,6 +36,7 @@
#include <sfx2/viewfrm.hxx>
#include <sfx2/sfxbasecontroller.hxx>
#include <sfx2/docfile.hxx>
+#include <sfx2/printer.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/awt/vclxdevice.hxx>
#include <cmdid.h>
@@ -400,7 +401,10 @@ SwXTextDocument::SwXTextDocument(SwDocSh
pxXRedlines(0),
m_pHiddenViewFrame(0),
m_pPrintUIOptions( NULL ),
- m_pRenderData( NULL )
+ m_pRenderData( NULL ),
+ // --> OD #i117783#
+ bApplyPagePrintSettingsFromXPagePrintable( sal_False )
+ // <--
{
}
/*-- 18.12.98 11:53:00---------------------------------------------------
@@ -1292,7 +1296,9 @@ void SwXTextDocument::printPages(const S
}
}
-
+ // --> OD #i117783#
+ bApplyPagePrintSettingsFromXPagePrintable = sal_True;
+ // <--
pFrame->GetViewShell()->ExecuteSlot(aReq);
// Frame schliessen
pFrame->DoClose();
@@ -2972,6 +2978,63 @@ uno::Sequence< beans::PropertyValue > SA
}
}
+ // --> OD #i117783#
+ if ( bApplyPagePrintSettingsFromXPagePrintable )
+ {
+ const SwPagePreViewPrtData* pPagePrintSettings =
+ pDocShell->GetDoc()->GetPreViewPrtData();
+ if ( pPagePrintSettings &&
+ ( pPagePrintSettings->GetRow() > 1 ||
+ pPagePrintSettings->GetCol() > 1 ) )
+ {
+ // extend render data by page print settings attributes
+ sal_Int32 nLen = aRenderer.getLength();
+ const sal_Int32 nRenderDataIdxStart = nLen;
+ nLen += 9;
+ aRenderer.realloc( nLen );
+ // put page print settings attribute into render data
+ const sal_Int32 nRow = pPagePrintSettings->GetRow();
+ aRenderer[ nRenderDataIdxStart + 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpRows" ) );
+ aRenderer[ nRenderDataIdxStart + 0 ].Value <<= ( nRow > 1 ? nRow : 1 );
+ const sal_Int32 nCol = pPagePrintSettings->GetCol();
+ aRenderer[ nRenderDataIdxStart + 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpColumns" ) );
+ aRenderer[ nRenderDataIdxStart + 1 ].Value <<= ( nCol > 1 ? nCol : 1 );
+ aRenderer[ nRenderDataIdxStart + 2 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginLeft" ) );
+ aRenderer[ nRenderDataIdxStart + 2 ].Value <<= pPagePrintSettings->GetLeftSpace();
+ aRenderer[ nRenderDataIdxStart + 3 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginRight" ) );
+ aRenderer[ nRenderDataIdxStart + 3 ].Value <<= pPagePrintSettings->GetRightSpace();
+ aRenderer[ nRenderDataIdxStart + 4 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginTop" ) );
+ aRenderer[ nRenderDataIdxStart + 4 ].Value <<= pPagePrintSettings->GetTopSpace();
+ aRenderer[ nRenderDataIdxStart + 5 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginBottom" ) );
+ aRenderer[ nRenderDataIdxStart + 5 ].Value <<= pPagePrintSettings->GetBottomSpace();
+ aRenderer[ nRenderDataIdxStart + 6 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpHorizontalSpacing" ) );
+ aRenderer[ nRenderDataIdxStart + 6 ].Value <<= pPagePrintSettings->GetHorzSpace();
+ aRenderer[ nRenderDataIdxStart + 7 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpVerticalSpacing" ) );
+ aRenderer[ nRenderDataIdxStart + 7 ].Value <<= pPagePrintSettings->GetVertSpace();
+ {
+ Printer* pPrinter = pDocShell->GetDoc()->getPrinter( false );
+ if ( pPrinter )
+ {
+ awt::Size aNewPageSize;
+ const Size aPageSize = pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) );
+ aNewPageSize = awt::Size( aPageSize.Width(), aPageSize.Height() );
+ if ( ( pPagePrintSettings->GetLandscape() &&
+ aPageSize.Width() < aPageSize.Height() ) ||
+ ( !pPagePrintSettings->GetLandscape() &&
+ aPageSize.Width() > aPageSize.Height() ) )
+ {
+ aNewPageSize = awt::Size( aPageSize.Height(), aPageSize.Width() );
+ }
+ aRenderer[ nRenderDataIdxStart + 8 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPaperSize" ) );
+ aRenderer[ nRenderDataIdxStart + 8 ].Value <<= aNewPageSize;
+ }
+ }
+ }
+
+ bApplyPagePrintSettingsFromXPagePrintable = sal_False;
+ }
+ // <--
+
m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
return aRenderer;
Modified: incubator/ooo/trunk/main/vcl/inc/vcl/print.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/inc/vcl/print.hxx?rev=1172115&r1=1172114&r2=1172115&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/inc/vcl/print.hxx (original)
+++ incubator/ooo/trunk/main/vcl/inc/vcl/print.hxx Sat Sep 17 22:39:52 2011
@@ -470,6 +470,10 @@ public:
in case the property is unknown or not convertible to bool, i_bFallback is returned
*/
sal_Bool getBoolProperty( const rtl::OUString& i_rPropertyName, sal_Bool i_bFallback ) const;
+ /* get an int property
+ in case the property is unknown or not convertible to bool, i_nFallback is returned
+ */
+ sal_Int32 getIntProperty( const rtl::OUString& i_rPropertyName, sal_Int32 i_nFallback ) const;
/* set a property value - can also be used to add another UI property
*/
Modified: incubator/ooo/trunk/main/vcl/source/gdi/print3.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/print3.cxx?rev=1172115&r1=1172114&r2=1172115&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/print3.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/print3.cxx Sat Sep 17 22:39:52 2011
@@ -419,6 +419,46 @@ void Printer::ImplPrintJob( const boost:
pController->setReversePrint( bReverse );
}
+ // setup NUp printing from properties
+ sal_Int32 nRows = i_pController->getIntProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpRows" ) ), 1 );
+ sal_Int32 nCols = i_pController->getIntProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpColumns" ) ), 1 );
+ if( nRows > 1 || nCols > 1 )
+ {
+ PrinterController::MultiPageSetup aMPS;
+ aMPS.nRows = nRows > 1 ? nRows : 1;
+ aMPS.nColumns = nCols > 1 ? nCols : 1;
+ sal_Int32 nValue = i_pController->getIntProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginLeft" ) ), aMPS.nLeftMargin );
+ if( nValue >= 0 )
+ aMPS.nLeftMargin = nValue;
+ nValue = i_pController->getIntProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginRight" ) ), aMPS.nRightMargin );
+ if( nValue >= 0 )
+ aMPS.nRightMargin = nValue;
+ nValue = i_pController->getIntProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginTop" ) ), aMPS.nTopMargin );
+ if( nValue >= 0 )
+ aMPS.nTopMargin = nValue;
+ nValue = i_pController->getIntProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPageMarginBottom" ) ), aMPS.nBottomMargin );
+ if( nValue >= 0 )
+ aMPS.nBottomMargin = nValue;
+ nValue = i_pController->getIntProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpHorizontalSpacing" ) ), aMPS.nHorizontalSpacing );
+ if( nValue >= 0 )
+ aMPS.nHorizontalSpacing = nValue;
+ nValue = i_pController->getIntProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpVerticalSpacing" ) ), aMPS.nVerticalSpacing );
+ if( nValue >= 0 )
+ aMPS.nVerticalSpacing = nValue;
+ aMPS.bDrawBorder = i_pController->getBoolProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpDrawBorder" ) ), aMPS.bDrawBorder );
+ aMPS.nOrder = static_cast<PrinterController::NupOrderType>(i_pController->getIntProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpSubPageOrder" ) ), aMPS.nOrder ));
+ aMPS.aPaperSize = i_pController->getPrinter()->PixelToLogic( i_pController->getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) );
+ beans::PropertyValue* pPgSizeVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NUpPaperSize" ) ) );
+ awt::Size aSizeVal;
+ if( pPgSizeVal && (pPgSizeVal->Value >>= aSizeVal) )
+ {
+ aMPS.aPaperSize.Width() = aSizeVal.Width;
+ aMPS.aPaperSize.Height() = aSizeVal.Height;
+ }
+
+ i_pController->setMultipage( aMPS );
+ }
+
// in direct print case check whether there is anything to print.
// if not, show an errorbox (if appropriate)
if( pController->isShowDialogs() && pController->isDirectPrint() )
@@ -1633,6 +1673,15 @@ sal_Bool PrinterController::getBoolPrope
return bRet;
}
+sal_Int32 PrinterController::getIntProperty( const rtl::OUString& i_rProperty, sal_Int32 i_nFallback ) const
+{
+ sal_Int32 nRet = i_nFallback;
+ const com::sun::star::beans::PropertyValue* pVal = getValue( i_rProperty );
+ if( pVal )
+ pVal->Value >>= nRet;
+ return nRet;
+}
+
/*
* PrinterOptionsHelper
**/
Modified: incubator/ooo/trunk/main/vcl/source/window/printdlg.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/window/printdlg.cxx?rev=1172115&r1=1172114&r2=1172115&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/window/printdlg.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/window/printdlg.cxx Sat Sep 17 22:39:52 2011
@@ -593,6 +593,18 @@ void PrintDialog::NUpTabPage::initFromMu
maBorderCB.Check( i_rMPS.bDrawBorder );
maNupRowsEdt.SetValue( i_rMPS.nRows );
maNupColEdt.SetValue( i_rMPS.nColumns );
+ maBorderCB.Check( i_rMPS.bDrawBorder );
+ for( sal_uInt16 i = 0; i < maNupOrderBox.GetEntryCount(); i++ )
+ {
+ if( int(sal_IntPtr(maNupOrderBox.GetEntryData( i ))) == i_rMPS.nOrder )
+ maNupOrderBox.SelectEntryPos( i );
+ }
+ if( i_rMPS.nRows != 1 || i_rMPS.nColumns != 1 )
+ {
+ maNupPagesBox.SelectEntryPos( maNupPagesBox.GetEntryCount()-1 );
+ showAdvancedControls( true );
+ maNupOrderWin.setValues( i_rMPS.nOrder, i_rMPS.nColumns, i_rMPS.nRows );
+ }
}
void PrintDialog::NUpTabPage::readFromSettings()