summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2024-01-20 19:24:07 +0100
committerArmin Le Grand <Armin.Le.Grand@me.com>2024-01-21 20:34:08 +0100
commit5dd814f13d795b471b2c9b01998ced75b2845a05 (patch)
tree44ce6220f562eab21be3ddbaddd5031edae2dd71 /cui
parentbd10851e9e5b4ecc5624f1fee8331e52c96df606 (diff)
ITEM: Remove Direct(Put|Remove)Item(In|From)Pool
After some experiments I now can remove DirectPutItemInPool and DirectRemoveItemFromPool. With the changes done before it is now possible to get rid of this 'compromize'. Now there are no more Items held at the 'Pool' which now can be developed in the direction of ssth like 'SfxItemSupport' - what it really is. Some of the last usages of DirectPutItemInPool were in SvxAreaTabDialog::SavePalettes(), so I tried to trigger those cases with using LO and calling that Dialog in all situations I could possibly think about, but it was never used. Then I added asserts and run a UnitTests in the apps, also no luck. Thus I would guess these are not used. These put changed stuff from the Dialog 'directly' to the Pool (what is not really supported and is a hint for a 'compromize' that some functionality did not find/want to use the right spot in the model to save and hold that data). Thus it *would* be accessible using the SurrogateMechanism at the Pool (which is also a 'compromize', see some of my other commits), but I also found no hints at places where that is done. Thus I decided to create this change and let's see if that asserts ever get triggered in the builds or tests. Indeed did not trigger. I checked what other places do which use SfxObjectShell::Current() when they get no DocShell: Most avoid doing something, but none puts stuff to the Pool, so I go one step further and do what other places do: warn and return. Also simplified SvxAreaTabDialog::SavePalettes() as then feasible. Change-Id: I1c351eac4ada26288a56a69d57008a09f2d19121 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162340 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/tabpages/tabarea.cxx64
1 files changed, 17 insertions, 47 deletions
diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx
index b4ef7edb6791..a568eb08223b 100644
--- a/cui/source/tabpages/tabarea.cxx
+++ b/cui/source/tabpages/tabarea.cxx
@@ -75,55 +75,46 @@ SvxAreaTabDialog::SvxAreaTabDialog
void SvxAreaTabDialog::SavePalettes()
{
- SfxObjectShell* pShell = SfxObjectShell::Current();
+ SfxObjectShell* pShell(SfxObjectShell::Current());
+ if (!pShell)
+ {
+ SAL_WARN("cui.dialogs", "SvxAreaTabDialog: No SfxObjectShell!");
+ return;
+ }
+
if( mpNewColorList != mpDrawModel->GetColorList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewColorList.get()) );
SvxColorListItem aColorListItem( mpNewColorList, SID_COLOR_TABLE );
- if ( pShell )
- pShell->PutItem( aColorListItem );
- else
- mpDrawModel->GetItemPool().DirectPutItemInPool(aColorListItem);
+ pShell->PutItem( aColorListItem );
mpColorList = mpDrawModel->GetColorList();
}
if( mpNewGradientList != mpDrawModel->GetGradientList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewGradientList.get()) );
SvxGradientListItem aItem( mpNewGradientList, SID_GRADIENT_LIST );
- if ( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().DirectPutItemInPool(aItem);
+ pShell->PutItem( aItem );
mpGradientList = mpDrawModel->GetGradientList();
}
if( mpNewHatchingList != mpDrawModel->GetHatchList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewHatchingList.get()) );
SvxHatchListItem aItem( mpNewHatchingList, SID_HATCH_LIST );
- if ( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().DirectPutItemInPool(aItem);
+ pShell->PutItem( aItem );
mpHatchingList = mpDrawModel->GetHatchList();
}
if( mpNewBitmapList != mpDrawModel->GetBitmapList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewBitmapList.get()) );
SvxBitmapListItem aItem( mpNewBitmapList, SID_BITMAP_LIST );
- if ( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().DirectPutItemInPool(aItem);
+ pShell->PutItem( aItem );
mpBitmapList = mpDrawModel->GetBitmapList();
}
if( mpNewPatternList != mpDrawModel->GetPatternList() )
{
mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewPatternList.get()) );
SvxPatternListItem aItem( mpNewPatternList, SID_PATTERN_LIST );
- if( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().DirectPutItemInPool(aItem);
+ pShell->PutItem( aItem );
mpPatternList = mpDrawModel->GetPatternList();
}
@@ -145,10 +136,7 @@ void SvxAreaTabDialog::SavePalettes()
SvxHatchListItem aItem( mpHatchingList, SID_HATCH_LIST );
// ToolBoxControls are informed:
- if ( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().DirectPutItemInPool(aItem);
+ pShell->PutItem( aItem );
}
if( mnBitmapListState & ChangeType::MODIFIED )
@@ -158,12 +146,7 @@ void SvxAreaTabDialog::SavePalettes()
SvxBitmapListItem aItem( mpBitmapList, SID_BITMAP_LIST );
// ToolBoxControls are informed:
- if ( pShell )
- pShell->PutItem( aItem );
- else
- {
- mpDrawModel->GetItemPool().DirectPutItemInPool(aItem);
- }
+ pShell->PutItem( aItem );
}
if( mnPatternListState & ChangeType::MODIFIED )
@@ -173,10 +156,7 @@ void SvxAreaTabDialog::SavePalettes()
SvxPatternListItem aItem( mpPatternList, SID_PATTERN_LIST );
// ToolBoxControls are informed:
- if( pShell )
- pShell->PutItem( aItem );
- else
- mpDrawModel->GetItemPool().DirectPutItemInPool(aItem);
+ pShell->PutItem( aItem );
}
if( mnGradientListState & ChangeType::MODIFIED )
@@ -186,24 +166,14 @@ void SvxAreaTabDialog::SavePalettes()
SvxGradientListItem aItem( mpGradientList, SID_GRADIENT_LIST );
// ToolBoxControls are informed:
- if ( pShell )
- pShell->PutItem( aItem );
- else
- {
- mpDrawModel->GetItemPool().DirectPutItemInPool(aItem);
- }
+ pShell->PutItem( aItem );
}
if (mnColorListState & ChangeType::MODIFIED && mpColorList.is())
{
SvxColorListItem aItem( mpColorList, SID_COLOR_TABLE );
// ToolBoxControls are informed:
- if ( pShell )
- pShell->PutItem( aItem );
- else
- {
- mpDrawModel->GetItemPool().DirectPutItemInPool(aItem);
- }
+ pShell->PutItem( aItem );
}
}