diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-03-11 23:14:57 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2016-03-17 23:54:43 +0100 |
commit | c21667c0f961a47cff7f477e3db30679586add98 (patch) | |
tree | 276e75034b09bf895c80eceadfaef8dd6b0e7f0c /sw | |
parent | 3853ea5fd129800a2185b874587329d4332205a4 (diff) |
refactor to limit scope: FN_UNO_NUM_RULES
- assert hard on nullptr which is used later
Change-Id: I785b4dc2f666a9345b9bf55036423514415c767c
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index dd199249ade0..95744bf8601d 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -2010,6 +2010,15 @@ uno::Any SwXStyle::GetStyleProperty<RES_PAPER_BIN>(const SfxItemPropertySimpleEn return uno::Any(); return uno::makeAny(pPrinter->GetPaperBinName(nBin)); } +template<> +uno::Any SwXStyle::GetStyleProperty<FN_UNO_NUM_RULES>(const SfxItemPropertySimpleEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase) + throw(uno::RuntimeException, std::exception) +{ + const SwNumRule* pRule = rBase.getNewBase()->GetNumRule(); + assert(pRule && "Where is the NumRule?"); + uno::Reference<container::XIndexReplace> xRules(new SwXNumberingRules(*pRule, GetDoc())); + return uno::makeAny<uno::Reference<container::XIndexReplace>>(xRules); +} uno::Any SwXStyle::lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, const SfxItemPropertySet& rPropSet, SwStyleBase_Impl& rBase) throw(uno::RuntimeException, std::exception) @@ -2049,14 +2058,9 @@ uno::Any SwXStyle::lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry { return GetStyleProperty<RES_PAPER_BIN>(rEntry, rPropSet, rBase); } - case FN_UNO_NUM_RULES: // special handling for a SvxNumRuleItem: + case FN_UNO_NUM_RULES: // special handling for a SvxNumRuleItem: { - const SwNumRule* pRule = rBase.getNewBase()->GetNumRule(); - OSL_ENSURE(pRule, "Where is the NumRule?"); - uno::Reference< container::XIndexReplace > xRules = new SwXNumberingRules(*pRule, pDoc); - - aRet.setValue(&xRules, cppu::UnoType<container::XIndexReplace>::get()); - break; + return GetStyleProperty<FN_UNO_NUM_RULES>(rEntry, rPropSet, rBase); } break; case RES_PARATR_OUTLINELEVEL: |