summaryrefslogtreecommitdiffstats
path: root/sfx2
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2011-02-23 14:59:16 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2011-02-23 14:59:16 +0100
commit0e78fb2766daf2d598a09d54ee80cd1ea02f7d88 (patch)
tree5c60bcde297a79aee15f1ad3e13770c92fb8b1e3 /sfx2
parentvcl119: #i114306# update jobsetup before and after print job (diff)
downloadcore-0e78fb2766daf2d598a09d54ee80cd1ea02f7d88.tar.gz
core-0e78fb2766daf2d598a09d54ee80cd1ea02f7d88.zip
vcl119: #i117025# fix selection printing in direct print case.
Diffstat (limited to 'sfx2')
-rwxr-xr-xsfx2/source/view/viewprn.cxx32
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) );