summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2022-07-28 09:03:13 -0400
committerMiklos Vajna <vmiklos@collabora.com>2022-08-02 08:15:26 +0200
commitf7b5eefc36f6a7627e867651bafe38bdeb2f9c00 (patch)
tree33929a5368d034e3ebace2988d9e2dc20a11537f /editeng
parent339d47a352650285c8ea14f9d8c0b36616b0ed7c (diff)
tdf#148810 pptx import: Depth set by EE_PARA_OUTLLEVEL
It isn't enough to do Paragraph->SetDepth(). It must match the property EE_PARA_OUTLLEVEL. So I was hoping that the only thing I needed was the "set property" helper. But unit tests showed that I also needed "get property" to return an empty aAny instead of a -1. My confidence level on this one is fairly low. This code is way too tangled and weird. I'm sure the concept is right (that the property is the most important thing) but all of the wonkiness around the level means any changes to the implementation will be fragile. make UITest_impress_tests \ UITEST_TEST_NAME=tdf148810.Tdf148810.test_Tdf148810 Change-Id: I4aa62fe28ecbc483d5df0d1532fecd172afc54b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137569 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/uno/unotext.cxx33
1 files changed, 7 insertions, 26 deletions
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index e0ca965c5d3f..4f831a70a30f 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -507,7 +507,7 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry*
return !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is());
}
- case WID_NUMLEVEL:
+ case EE_PARA_OUTLLEVEL:
{
SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr;
if(pForwarder && pSelection)
@@ -519,7 +519,8 @@ bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemPropertyMapEntry*
if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel ) )
throw lang::IllegalArgumentException();
- return true;
+ // If valid, then not yet finished. Also needs to be added to paragraph props.
+ return nLevel < -1 || nLevel > 9;
}
}
}
@@ -684,7 +685,7 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet const & rSet, cons
}
break;
- case WID_NUMLEVEL:
+ case EE_PARA_OUTLLEVEL:
{
SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : nullptr;
if(pForwarder && pSelection)
@@ -976,7 +977,6 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert
}
break;
- case WID_NUMLEVEL:
case WID_NUMBERINGSTARTVALUE:
case WID_PARAISNUMBERINGRESTART:
eItemState = SfxItemState::SET;
@@ -1110,7 +1110,6 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf
}
break;
- case WID_NUMLEVEL:
case WID_NUMBERINGSTARTVALUE:
case WID_PARAISNUMBERINGRESTART:
eItemState = SfxItemState::SET;
@@ -1215,12 +1214,6 @@ void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, co
{
SvxUnoFontDescriptor::setPropertyToDefault( aSet );
}
- else if( pMap->nWID == WID_NUMLEVEL )
- {
- // #101004# Call interface method instead of unsafe cast
- pForwarder->SetDepth( maSelection.nStartPara, -1 );
- return;
- }
else if( pMap->nWID == WID_NUMBERINGSTARTVALUE )
{
pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 );
@@ -1263,7 +1256,7 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aProp
case WID_FONTDESC:
return SvxUnoFontDescriptor::getPropertyDefault( pPool );
- case WID_NUMLEVEL:
+ case EE_PARA_OUTLLEVEL:
{
uno::Any aAny;
return aAny;
@@ -1969,8 +1962,8 @@ static void SvxPropertyValuesToItemSet(
SfxItemSet &rItemSet,
const uno::Sequence< beans::PropertyValue >& rPropertyValues,
const SfxItemPropertySet *pPropSet,
- SvxTextForwarder *pForwarder /*needed for WID_NUMLEVEL*/,
- sal_Int32 nPara /*needed for WID_NUMLEVEL*/)
+ SvxTextForwarder *pForwarder,
+ sal_Int32 nPara)
{
for (const beans::PropertyValue& rProp : rPropertyValues)
{
@@ -1993,18 +1986,6 @@ static void SvxPropertyValuesToItemSet(
if (rProp.Value >>= aDesc)
SvxUnoFontDescriptor::FillItemSet( aDesc, rItemSet );
}
- else if (pEntry->nWID == WID_NUMLEVEL)
- {
- if (pForwarder)
- {
- sal_Int16 nLevel = -1;
- rProp.Value >>= nLevel;
-
- // #101004# Call interface method instead of unsafe cast
- if (!pForwarder->SetDepth( nPara, nLevel ))
- throw lang::IllegalArgumentException();
- }
- }
else if (pEntry->nWID == WID_NUMBERINGSTARTVALUE )
{
if( pForwarder )