diff options
author | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2011-02-23 14:59:16 +0100 |
---|---|---|
committer | Philipp Lohmann [pl] <Philipp.Lohmann@Sun.COM> | 2011-02-23 14:59:16 +0100 |
commit | 0e78fb2766daf2d598a09d54ee80cd1ea02f7d88 (patch) | |
tree | 5c60bcde297a79aee15f1ad3e13770c92fb8b1e3 /sfx2 | |
parent | 5b5c2ecf2c91d97652e6a16b615b0f7d92ebf98b (diff) |
vcl119: #i117025# fix selection printing in direct print case.
Diffstat (limited to 'sfx2')
-rwxr-xr-x | sfx2/source/view/viewprn.cxx | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 734ccda7a532..b125efc87267 100755 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -191,15 +191,19 @@ SfxPrinterController::~SfxPrinterController() const Any& SfxPrinterController::getSelectionObject() const { + const beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) ) ); + if( pVal ) + { + sal_Bool bSel = sal_False; + pVal->Value >>= bSel; + return bSel ? maSelection : maCompleteSelection; + } + sal_Int32 nChoice = 0; - sal_Bool bSel = sal_False; - const beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) ); + pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) ); if( pVal ) pVal->Value >>= nChoice; - pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) ) ); - if( pVal ) - pVal->Value >>= bSel; - return (nChoice > 1 || bSel) ? maSelection : maCompleteSelection; + return (nChoice > 1) ? maSelection : maCompleteSelection; } Sequence< beans::PropertyValue > SfxPrinterController::getMergedOptions() const @@ -722,10 +726,18 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) } } } - sal_Int32 nLen = aProps.getLength(); - aProps.realloc( nLen + 1 ); - aProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) ); - aProps[nLen].Value = makeAny( bSelection ); + // HACK: writer sets the SID_SELECTION item when printing directly and expects + // to get only the selection document in that case (see getSelectionObject) + // however it also reacts to the PrintContent property. We need this distinction here, too, + // else one of the combinations print / print direct and selection / all will not work. + // it would be better if writer handled this internally + if( nId == SID_PRINTDOCDIRECT ) + { + sal_Int32 nLen = aProps.getLength(); + aProps.realloc( nLen + 1 ); + aProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) ); + aProps[nLen].Value = makeAny( bSelection ); + } ExecPrint( aProps, bIsAPI, (nId == SID_PRINTDOCDIRECT) ); |