summaryrefslogtreecommitdiff
path: root/sd/source/ui/animations/CustomAnimationDialog.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/animations/CustomAnimationDialog.cxx')
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx81
1 files changed, 12 insertions, 69 deletions
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 1d91489e5a0c..901034d5f1ef 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -62,6 +62,7 @@
#include <editeng/flstitem.hxx>
#include <svx/drawitem.hxx>
+#include <svx/colorbox.hxx>
#include <svx/xtable.hxx>
#include <svx/gallery.hxx>
@@ -193,43 +194,23 @@ public:
private:
VclPtr<ColorListBox> mpControl;
- DECL_LINK_TYPED(OnSelect, ListBox&, void);
+ DECL_LINK_TYPED(OnSelect, SvxColorListBox&, void);
Link<LinkParamNone*,void> maModifyLink;
};
ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl )
: PropertySubControl( nControlType ), maModifyLink(rModifyHdl)
{
- mpControl = VclPtr<ColorListBox>::Create( pParent, WB_BORDER|WB_TABSTOP|WB_DROPDOWN );
- mpControl->SetDropDownLineCount( 10 );
- mpControl->set_hexpand(true);
+ mpControl = VclPtr<SvxColorListBox>::Create(pParent);
mpControl->SetSelectHdl( LINK(this, ColorPropertyBox, OnSelect) );
mpControl->SetHelpId( HID_SD_CUSTOMANIMATIONPANE_COLORPROPERTYBOX );
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
- DBG_ASSERT( pDocSh, "DocShell not found!" );
- XColorListRef pColorList;
- const SfxPoolItem* pItem = nullptr;
-
- if ( pDocSh && ( ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != nullptr) )
- pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList();
-
- if ( !pColorList.is() )
- pColorList = XColorList::CreateStdColorList();
-
sal_Int32 nColor = 0;
rValue >>= nColor;
-
- for ( long i = 0; i < pColorList->Count(); i++ )
- {
- XColorEntry* pEntry = pColorList->GetColor(i);
- sal_Int32 nPos = mpControl->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
- if( pEntry->GetColor().GetRGBColor() == (sal_uInt32)nColor )
- mpControl->SelectEntryPos( nPos );
- }
+ mpControl->SelectEntry(static_cast<Color>(nColor));
}
-IMPL_LINK_NOARG_TYPED(ColorPropertyBox, OnSelect, ListBox&, void)
+IMPL_LINK_NOARG_TYPED(ColorPropertyBox, OnSelect, SvxColorListBox&, void)
{
maModifyLink.Call(nullptr);
}
@@ -247,7 +228,7 @@ void ColorPropertyBox::setValue( const Any& rValue, const OUString& )
rValue >>= nColor;
mpControl->SetNoSelection();
- mpControl->SelectEntryPos( mpControl->GetEntryPos( static_cast<Color>(nColor) ) );
+ mpControl->SelectEntry(static_cast<Color>(nColor));
}
}
@@ -1044,7 +1025,7 @@ private:
VclPtr<FixedText> mpFTAfterEffect;
VclPtr<ListBox> mpLBAfterEffect;
VclPtr<FixedText> mpFTDimColor;
- VclPtr<ColorListBox> mpCLBDimColor;
+ VclPtr<SvxColorListBox> mpCLBDimColor;
VclPtr<FixedText> mpFTTextAnim;
VclPtr<ListBox> mpLBTextAnim;
VclPtr<MetricField> mpMFTextDelay;
@@ -1069,6 +1050,7 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent
get(mpLBAfterEffect, "aeffect_list" );
get(mpFTDimColor, "dim_color_label" );
get(mpCLBDimColor, "dim_color_list" );
+ mpCLBDimColor->SelectEntry(Color(COL_BLACK));
get(mpFTTextAnim, "text_animation_label" );
get(mpLBTextAnim, "text_animation_list" );
get(mpMFTextDelay,"text_delay" );
@@ -1081,28 +1063,6 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent
mpPBSoundPreview->SetClickHdl( LINK( this, CustomAnimationEffectTabPage, implClickHdl ) );
- // fill the color box
- SfxObjectShell* pDocSh = SfxObjectShell::Current();
- DBG_ASSERT( pDocSh, "DocShell not found!" );
- XColorListRef pColorList;
- const SfxPoolItem* pItem = nullptr;
-
- if ( pDocSh && ( (pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) != nullptr ) )
- pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList();
-
- if ( !pColorList.is() )
- pColorList = XColorList::CreateStdColorList();
-
- mpCLBDimColor->SetUpdateMode( false );
-
- for ( long i = 0; i < pColorList->Count(); i++ )
- {
- XColorEntry* pEntry = pColorList->GetColor(i);
- mpCLBDimColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
- }
-
- mpCLBDimColor->SetUpdateMode( true );
-
// only show settings if all selected effects have the same preset-id
if( pSet->getPropertyState( nHandlePresetId ) != STLPropertyState_AMBIGUOUS )
{
@@ -1178,13 +1138,8 @@ CustomAnimationEffectTabPage::CustomAnimationEffectTabPage( vcl::Window* pParent
{
sal_Int32 nColor = 0;
aDimColor >>= nColor;
- Color aColor( nColor );
- sal_Int32 nColorPos = mpCLBDimColor->GetEntryPos( aColor );
- if ( LISTBOX_ENTRY_NOTFOUND != nColorPos )
- mpCLBDimColor->SelectEntryPos( nColorPos );
- else
- mpCLBDimColor->SelectEntryPos(
- mpCLBDimColor->InsertEntry( aColor, SVX_RESSTR(RID_SVXSTR_COLOR_USER) ) );
+ Color aColor(nColor);
+ mpCLBDimColor->SelectEntry(aColor);
}
else
{
@@ -1336,16 +1291,7 @@ IMPL_LINK_TYPED( CustomAnimationEffectTabPage, implSelectHdl, ListBox&, rListBox
void CustomAnimationEffectTabPage::implHdl(Control* pControl )
{
- if( pControl == mpLBAfterEffect )
- {
- sal_Int32 nPos = static_cast<ListBox*>( mpLBAfterEffect )->GetSelectEntryPos();
- if( nPos == 1 )
- {
- if( mpCLBDimColor->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
- mpCLBDimColor->SelectEntryPos(0);
- }
- }
- else if( pControl == mpLBTextAnim )
+ if( pControl == mpLBTextAnim )
{
if( mpMFTextDelay->GetValue() == 0 )
mpMFTextDelay->SetValue( 100 );
@@ -1424,10 +1370,7 @@ void CustomAnimationEffectTabPage::update( STLPropertySet* pSet )
Any aDimColor;
if( nPos == 1 )
{
- Color aSelectedColor;
- if ( mpCLBDimColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND )
- aSelectedColor = mpCLBDimColor->GetSelectEntryColor();
-
+ Color aSelectedColor = mpCLBDimColor->GetSelectEntryColor();
aDimColor = makeAny( (sal_Int32)aSelectedColor.GetRGBColor() );
}