Kaydet (Commit) 171fb61c authored tarafından Michael Stahl's avatar Michael Stahl

tdf#82784: cui: Area tab page: do not override imported bitmaps

Check that we don't clobber a custom bitmap in the dialog.

The (non-obvious) trick is that the name of these is non-empty, so we
can check that to filter out pool default items that Draw likes to put
into item sets (?), as well as just plain weird items that Draw likes to
put into item sets, while avoiding relying on the surprisingly
implemented ImpGraphic::operator==().

(regression from 38d0047d)

Change-Id: I0b94e49ef3a9a32c188c3b117a57f780f55e1584
üst 9657455d
...@@ -1450,28 +1450,35 @@ void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs ) ...@@ -1450,28 +1450,35 @@ void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs )
m_pLbHatchBckgrdColor->SelectEntry( rColorItem.GetColorValue() ); m_pLbHatchBckgrdColor->SelectEntry( rColorItem.GetColorValue() );
} }
if (SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_FILLGRADIENT)) SfxItemState const eGradState(rAttrs->GetItemState(XATTR_FILLGRADIENT));
XFillGradientItem const* pGradientItem(nullptr);
if (SfxItemState::DONTCARE != eGradState)
{ {
XFillGradientItem const& rGradientItem( pGradientItem = &static_cast<const XFillGradientItem&>(
static_cast<const XFillGradientItem&>( rAttrs->Get(XATTR_FILLGRADIENT));
rAttrs->Get(XATTR_FILLGRADIENT)) ); OUString const aString( pGradientItem->GetName() );
OUString const aString( rGradientItem.GetName() ); XGradient const aGradient( pGradientItem->GetGradientValue() );
XGradient const aGradient( rGradientItem.GetGradientValue() );
m_pLbGradient->SelectEntryByList(pGradientList, aString, aGradient); m_pLbGradient->SelectEntryByList(pGradientList, aString, aGradient);
} }
if (!m_pLbGradient->GetSelectEntryCount()) if (!m_pLbGradient->GetSelectEntryCount()
&& (SfxItemState::DEFAULT == eGradState
|| (pGradientItem && pGradientItem->GetName().isEmpty())))
{ // avoid relying on pool default - cannot export that { // avoid relying on pool default - cannot export that
m_pLbGradient->SelectEntryPos(0); // anything better than nothing m_pLbGradient->SelectEntryPos(0); // anything better than nothing
isMissingGradient = true; isMissingGradient = true;
} }
if (SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_FILLHATCH)) SfxItemState const eHatchState(rAttrs->GetItemState(XATTR_FILLHATCH));
XFillHatchItem const* pHatch(nullptr);
if (SfxItemState::DONTCARE != eHatchState)
{ {
m_pLbHatching->SelectEntry( static_cast<const XFillHatchItem&>( pHatch = &static_cast<const XFillHatchItem&>(
rAttrs->Get(XATTR_FILLHATCH)).GetName() ); rAttrs->Get(XATTR_FILLHATCH));
m_pLbHatching->SelectEntry(pHatch->GetName());
} }
if (!m_pLbHatching->GetSelectEntryCount()) if (!m_pLbHatching->GetSelectEntryCount()
&& (SfxItemState::DEFAULT == eHatchState
|| (pHatch && pHatch->GetName().isEmpty())))
{ // avoid relying on pool default - cannot export that { // avoid relying on pool default - cannot export that
m_pLbHatching->SelectEntryPos(0); // anything better than nothing m_pLbHatching->SelectEntryPos(0); // anything better than nothing
isMissingHatching = true; isMissingHatching = true;
...@@ -1482,14 +1489,17 @@ void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs ) ...@@ -1482,14 +1489,17 @@ void SvxAreaTabPage::Reset( const SfxItemSet* rAttrs )
rAttrs->Get(XATTR_FILLBACKGROUND)).GetValue() ); rAttrs->Get(XATTR_FILLBACKGROUND)).GetValue() );
} }
if (SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_FILLBITMAP)) SfxItemState const eBitmapState(rAttrs->GetItemState(XATTR_FILLBITMAP));
XFillBitmapItem const* pBitmapItem(nullptr);
if (SfxItemState::DONTCARE != eBitmapState)
{ {
XFillBitmapItem const& rBitmapItem( pBitmapItem = &static_cast<const XFillBitmapItem&>(
static_cast<const XFillBitmapItem&>( rAttrs->Get(XATTR_FILLBITMAP));
rAttrs->Get(XATTR_FILLBITMAP))); m_pLbBitmap->SelectEntry(pBitmapItem->GetName());
m_pLbBitmap->SelectEntry(rBitmapItem.GetName());
} }
if (!m_pLbBitmap->GetSelectEntryCount()) if (!m_pLbBitmap->GetSelectEntryCount()
&& (SfxItemState::DEFAULT == eBitmapState
|| (pBitmapItem && pBitmapItem->GetName().isEmpty())))
{ // avoid relying on pool default - cannot export that { // avoid relying on pool default - cannot export that
m_pLbBitmap->SelectEntryPos(0); // anything better than nothing m_pLbBitmap->SelectEntryPos(0); // anything better than nothing
isMissingBitmap = true; isMissingBitmap = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment