tdf#173141: Duplicate overwrites Bitmap or Gradient with last used colors
Save the pFillStyleItem in FuCopy::DoExecute so we can test it if it's a FillStyle_SOLID in CopyDlg::Reset. If it's the case, we can use the last colors, if not we use automatic colors. Change-Id: I2d4ea4a0d7eb5794aee3af771c51ca1e63d93ff7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209136 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <svx/sdangitm.hxx>
|
||||
#include <sfx2/module.hxx>
|
||||
#include <svx/xcolit.hxx>
|
||||
#include <svx/xfillit0.hxx>
|
||||
#include <svl/intitem.hxx>
|
||||
|
||||
#include <svtools/unitconv.hxx>
|
||||
@@ -35,6 +36,8 @@
|
||||
#include <View.hxx>
|
||||
#include <drawdoc.hxx>
|
||||
|
||||
#include <com/sun/star/drawing/FillStyle.hpp>
|
||||
|
||||
|
||||
namespace sd {
|
||||
|
||||
@@ -171,8 +174,17 @@ void CopyDlg::Reset()
|
||||
m_xMtrFldAngle->set_value(o3tl::toInt64(o3tl::getToken(aStr, 0, TOKEN, nIdx)), FieldUnit::NONE);
|
||||
m_xMtrFldWidth->set_value(o3tl::toInt64(o3tl::getToken(aStr, 0, TOKEN, nIdx)), FieldUnit::NONE);
|
||||
m_xMtrFldHeight->set_value(o3tl::toInt64(o3tl::getToken(aStr, 0, TOKEN, nIdx)), FieldUnit::NONE);
|
||||
m_xLbStartColor->SelectEntry( Color( ColorTransparency, o3tl::toUInt32(o3tl::getToken(aStr, 0, TOKEN, nIdx)) ) );
|
||||
m_xLbEndColor->SelectEntry( Color( ColorTransparency, o3tl::toUInt32(o3tl::getToken(aStr, 0, TOKEN, nIdx)) ) );
|
||||
// tdf#173141: in duplicate dialog, we want to retrieve previously selected start and stop color
|
||||
// only if the shape uses solid color (and not gradient or bitmap for example)
|
||||
if ( const XFillStyleItem* pFillStyleItem = mrOutAttrs.GetItemIfSet( XATTR_FILLSTYLE ) )
|
||||
{
|
||||
css::drawing::FillStyle eStyle = pFillStyleItem->GetValue();
|
||||
if( eStyle == css::drawing::FillStyle_SOLID )
|
||||
{
|
||||
m_xLbStartColor->SelectEntry( Color( ColorTransparency, o3tl::toUInt32(o3tl::getToken(aStr, 0, TOKEN, nIdx)) ) );
|
||||
m_xLbEndColor->SelectEntry( Color( ColorTransparency, o3tl::toUInt32(o3tl::getToken(aStr, 0, TOKEN, nIdx)) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ void FuCopy::DoExecute( SfxRequest& rReq )
|
||||
|
||||
if( !pArgs )
|
||||
{
|
||||
SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<ATTR_COPY_START, ATTR_COPY_END>( mrViewShell.GetPool() ));
|
||||
SfxItemSet aSet(SfxItemSet::makeFixedSfxItemSet<XATTR_FILLSTYLE, XATTR_FILLSTYLE, ATTR_COPY_START, ATTR_COPY_END>( mrViewShell.GetPool() ));
|
||||
|
||||
// indicate color attribute
|
||||
SfxItemSet aAttr( mrDoc.GetPool() );
|
||||
@@ -91,6 +91,7 @@ void FuCopy::DoExecute( SfxRequest& rReq )
|
||||
{
|
||||
XColorItem aXColorItem( ATTR_COPY_START_COLOR, pFillColorItem->GetName(),
|
||||
pFillColorItem->GetColorValue() );
|
||||
aSet.Put(*pFillStyleItem);
|
||||
aSet.Put( aXColorItem );
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user