summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-03-11 22:30:24 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2016-03-17 23:54:43 +0100
commit3853ea5fd129800a2185b874587329d4332205a4 (patch)
tree9bc133b9372c8b4bbc1dad47e3f41e5e9ae8b459
parent54db77d45662e9611d85362069f33ce3c53e7921 (diff)
refactor out to limit scope: RES_PAPER_BIN
- also use get<> instead of stream operators Change-Id: I1657ebf70f16dda6d614c51f1b8dd054c6091468
-rw-r--r--sw/source/core/unocore/unostyle.cxx32
1 files changed, 17 insertions, 15 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index cb3f9d581c4f..dd199249ade0 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1995,6 +1995,22 @@ uno::Any SwXStyle::GetStyleProperty<FN_UNO_STYLE_INTEROP_GRAB_BAG>(const SfxItem
xBase->GetGrabBagItem(aRet);
return aRet;
}
+template<>
+uno::Any SwXStyle::GetStyleProperty<RES_PAPER_BIN>(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase)
+ throw(uno::RuntimeException, std::exception)
+{
+ SfxItemSet& rSet = rBase.GetItemSet();
+ uno::Any aValue;
+ rPropSet.getPropertyValue(rEntry, rSet, aValue);
+ sal_Int8 nBin(aValue.get<sal_Int8>());
+ if(nBin == -1)
+ return uno::makeAny<OUString>("[From printer settings]");
+ SfxPrinter* pPrinter = GetDoc()->getIDocumentDeviceAccess().getPrinter(false);
+ if(!pPrinter)
+ return uno::Any();
+ return uno::makeAny(pPrinter->GetPaperBinName(nBin));
+}
+
uno::Any SwXStyle::lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase)
throw(uno::RuntimeException, std::exception)
{
@@ -2031,21 +2047,7 @@ uno::Any SwXStyle::lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry
{
case RES_PAPER_BIN:
{
- SfxItemSet& rSet = rBase.GetItemSet();
- rPropSet.getPropertyValue(rEntry, rSet, aRet);
- sal_Int8 nBin = 0;
- aRet >>= nBin;
- if ( nBin == -1 )
- aRet <<= OUString( "[From printer settings]" );
- else
- {
- SfxPrinter *pPrinter = pDoc->getIDocumentDeviceAccess().getPrinter( false );
- OUString sTmp;
- if (pPrinter )
- sTmp = pPrinter->GetPaperBinName ( nBin );
- aRet <<= sTmp;
- }
- break;
+ return GetStyleProperty<RES_PAPER_BIN>(rEntry, rPropSet, rBase);
}
case FN_UNO_NUM_RULES: // special handling for a SvxNumRuleItem:
{