summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2019-12-05 19:02:30 +0100
committerJan-Marek Glogowski <glogow@fbihome.de>2019-12-06 11:59:46 +0100
commitd8c36a8771398327ba83884a2e0aa82a6d7c8492 (patch)
treebf7cb475f585561daf5a466a260ff8526949a0f7
parent05db09fbe9b9de79a61a5b699dbf93fa67d9bdfd (diff)
sw: add getter for RES_PARATR_LIST_AUTOFMT
Change-Id: Ic492dd4062a5ce659a996fb96f3ed9e12d1767ce Reviewed-on: https://gerrit.libreoffice.org/84581 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx82
1 files changed, 71 insertions, 11 deletions
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 0ca6dc57b242..a82e7a1c2308 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -23,6 +23,7 @@
#include <algorithm>
#include <memory>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertyState.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
@@ -303,6 +304,31 @@ GetNestedTextContent(SwTextNode const & rTextNode, sal_Int32 const nIndex,
return xRet;
}
+static uno::Any GetParaListAutoFormat(SwTextNode const& rNode)
+{
+ SwFormatAutoFormat const*const pFormat(
+ rNode.GetSwAttrSet().GetItem<SwFormatAutoFormat>(RES_PARATR_LIST_AUTOFMT, false));
+ if (!pFormat)
+ {
+ return uno::Any();
+ }
+ SfxItemSet const& rSet(*pFormat->GetStyleHandle());
+ SfxItemPropertySet const& rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE));
+ SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap());
+ std::vector<beans::NamedValue> props;
+ // have to iterate the map, not the item set?
+ for (auto const& rEntry : rMap.getPropertyEntries())
+ {
+ if (rPropSet.getPropertyState(rEntry, rSet) == PropertyState_DIRECT_VALUE)
+ {
+ Any value;
+ rPropSet.getPropertyValue(rEntry, rSet, value);
+ props.emplace_back(rEntry.sName, value);
+ }
+ }
+ return uno::makeAny(comphelper::containerToSequence(props));
+}
+
// Read the special properties of the cursor
bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
, SwPaM& rPam
@@ -413,48 +439,82 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
// #i91601#
case FN_UNO_LIST_ID:
case FN_NUMBER_NEWSTART:
+ case FN_UNO_PARA_NUM_AUTO_FORMAT:
{
+ if (!pAny)
+ {
+ break;
+ }
// a multi selection is not considered
const SwTextNode* pTextNd = rPam.GetNode().GetTextNode();
if ( pTextNd && pTextNd->IsInList() )
{
- if( pAny )
+ switch (rEntry.nWID)
{
- if(rEntry.nWID == FN_UNO_NUM_LEVEL)
+ case FN_UNO_NUM_LEVEL:
+ {
*pAny <<= static_cast<sal_Int16>(pTextNd->GetActualListLevel());
- else if(rEntry.nWID == FN_UNO_IS_NUMBER)
+ break;
+ }
+ case FN_UNO_IS_NUMBER:
{
*pAny <<= pTextNd->IsCountedInList();
+ break;
}
// #i91601#
- else if ( rEntry.nWID == FN_UNO_LIST_ID )
+ case FN_UNO_LIST_ID:
{
*pAny <<= pTextNd->GetListId();
+ break;
}
- else
+ case FN_NUMBER_NEWSTART:
{
*pAny <<= pTextNd->IsListRestart();
+ break;
}
+ case FN_UNO_PARA_NUM_AUTO_FORMAT:
+ {
+ *pAny = GetParaListAutoFormat(*pTextNd);
+ break;
+ }
+ default:
+ assert(false);
}
}
else
{
eNewState = PropertyState_DEFAULT_VALUE;
- if( pAny )
- {
// #i30838# set default values for default properties
- if(rEntry.nWID == FN_UNO_NUM_LEVEL)
+ switch (rEntry.nWID)
+ {
+ case FN_UNO_NUM_LEVEL:
+ {
*pAny <<= static_cast<sal_Int16>( 0 );
- else if(rEntry.nWID == FN_UNO_IS_NUMBER)
+ break;
+ }
+ case FN_UNO_IS_NUMBER:
+ {
*pAny <<= false;
+ break;
+ }
// #i91601#
- else if ( rEntry.nWID == FN_UNO_LIST_ID )
+ case FN_UNO_LIST_ID:
{
*pAny <<= OUString();
+ break;
}
- else
+ case FN_NUMBER_NEWSTART:
+ {
*pAny <<= false;
+ break;
+ }
+ case FN_UNO_PARA_NUM_AUTO_FORMAT:
+ {
+ break; // void
+ }
+ default:
+ assert(false);
}
}
//PROPERTY_MAYBEVOID!