diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
commit | 5a7157d319477830426797532e02ac39d3b859f4 (patch) | |
tree | 3773f5ce209bee14a5643e98672e0f3828c71434 /sw/source/core/unocore/unostyle.cxx | |
parent | Releasing progress-linux version 4:24.2.0-3~progress7.99u1. (diff) | |
download | libreoffice-5a7157d319477830426797532e02ac39d3b859f4.tar.xz libreoffice-5a7157d319477830426797532e02ac39d3b859f4.zip |
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/source/core/unocore/unostyle.cxx')
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 94219281b5..665c1d2c6a 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1669,27 +1669,37 @@ void SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>(const SfxItemPropertyMapE template<> void SwXStyle::SetPropertyValue<sal_uInt16(RES_PAPER_BIN)>(const SfxItemPropertyMapEntry& rEntry, const SfxItemPropertySet& rPropSet, const uno::Any& rValue, SwStyleBase_Impl& o_rStyleBase) { - if(!rValue.has<OUString>()) + if (!rValue.has<OUString>() && !rValue.has<sal_Int32>()) throw lang::IllegalArgumentException(); SfxPrinter* pPrinter = m_pDoc->getIDocumentDeviceAccess().getPrinter(true); - OUString sValue(rValue.get<OUString>()); using printeridx_t = decltype(pPrinter->GetPaperBinCount()); printeridx_t nBin = std::numeric_limits<printeridx_t>::max(); - if(sValue == "[From printer settings]") - nBin = std::numeric_limits<printeridx_t>::max()-1; - else if(pPrinter) + if(rValue.has<OUString>()) { - for(sal_uInt16 i=0, nEnd = pPrinter->GetPaperBinCount(); i < nEnd; ++i) + OUString sValue(rValue.get<OUString>()); + if(sValue == "[From printer settings]") + nBin = std::numeric_limits<printeridx_t>::max()-1; + else if(pPrinter) { - if (sValue == pPrinter->GetPaperBinName(i)) + for(printeridx_t i=0, nEnd = pPrinter->GetPaperBinCount(); i < nEnd; ++i) { - nBin = i; - break; + if (sValue == pPrinter->GetPaperBinName(i)) + { + nBin = i; + break; + } } } } + else if (rValue.has<sal_Int32>() && pPrinter) + { + sal_Int32 nValue (rValue.get<sal_Int32>()); + nBin = pPrinter->GetPaperBinBySourceIndex(nValue); + } + if(nBin == std::numeric_limits<printeridx_t>::max()) throw lang::IllegalArgumentException(); + SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet(); SfxItemSet aSet(*rStyleSet.GetPool(), rEntry.nWID, rEntry.nWID); aSet.SetParent(&rStyleSet); |