diff options
author | Mark Hung <marklh9@gmail.com> | 2018-07-07 23:05:51 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2018-07-11 17:44:18 +0200 |
commit | d0acd56420625133a2e5622f44932e439b2cf95d (patch) | |
tree | fd107cfc3feb94be61f85ae173d9e0991b132f70 /sw/qa/extras/inc/swmodeltestbase.hxx | |
parent | 10272122b2ace68add7d2b0191aa516558f8401f (diff) |
sw/qa: CjkNumberedListTestHelper -> getNumberingTypeOfParagraph
Move CjkNumberedListTestHelper to swmodeltestbase.hxx to get
rid of copy-pasted code, and rename it to getNumberingTypeOfParagraph.
Change-Id: I36f14be30bcd9a9d22d1d5071220a13c02602a22
Reviewed-on: https://gerrit.libreoffice.org/57137
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'sw/qa/extras/inc/swmodeltestbase.hxx')
-rw-r--r-- | sw/qa/extras/inc/swmodeltestbase.hxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 19090189510c..3bcc7116b091 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -579,6 +579,36 @@ protected: return xParagraph; } + sal_Int16 getNumberingTypeOfParagraph(int nPara) + { + sal_Int16 nNumberingType = -1; + uno::Reference<text::XTextRange> xPara(getParagraph(nPara)); + uno::Reference< beans::XPropertySet > properties( xPara, uno::UNO_QUERY); + bool isNumber = false; + properties->getPropertyValue("NumberingIsNumber") >>= isNumber; + if (isNumber) + { + uno::Reference<container::XIndexAccess> xLevels( properties->getPropertyValue("NumberingRules"), uno::UNO_QUERY); + sal_Int16 nNumberingLevel = -1; + properties->getPropertyValue("NumberingLevel") >>= nNumberingLevel; + if (nNumberingLevel >= 0 && nNumberingLevel < xLevels->getCount()) + { + uno::Sequence< beans::PropertyValue > aPropertyValue; + xLevels->getByIndex(nNumberingLevel) >>= aPropertyValue; + for( int j = 0 ; j< aPropertyValue.getLength() ; ++j) + { + beans::PropertyValue aProp= aPropertyValue[j]; + if (aProp.Name == "NumberingType") + { + nNumberingType = aProp.Value.get<sal_Int16>(); + break; + } + } + } + } + return nNumberingType; + } + uno::Reference<text::XTextRange> getParagraphOfText(int number, uno::Reference<text::XText> const & xText, const OUString& content = OUString()) const { uno::Reference<text::XTextRange> const xParagraph(getParagraphOrTable(number, xText), uno::UNO_QUERY_THROW); |