diff options
Diffstat (limited to 'sd/source/ui/dlg/copydlg.cxx')
-rw-r--r-- | sd/source/ui/dlg/copydlg.cxx | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index efcebc1442f1..f68e06c38293 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -19,7 +19,6 @@ #include "copydlg.hxx" #include <comphelper/string.hxx> -#include <svx/colorbox.hxx> #include <svx/dlgutil.hxx> #include <sfx2/module.hxx> #include <svx/xcolit.hxx> @@ -41,9 +40,11 @@ namespace sd { #define TOKEN ';' -CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pInView) +CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, + const XColorListRef &pColList, ::sd::View* pInView) : SfxModalDialog(pWindow, "DuplicateDialog", "modules/sdraw/ui/copydlg.ui") , mrOutAttrs(rInAttrs) + , mpColorList(pColList) , maUIScale(pInView->GetDoc().GetUIScale()) , mpView(pInView) { @@ -59,6 +60,11 @@ CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* p get(m_pLbEndColor, "end"); get(m_pBtnSetDefault, "default"); + // color tables + DBG_ASSERT( mpColorList.is(), "No colortable available !" ); + m_pLbStartColor->Fill( mpColorList ); + m_pLbEndColor->CopyEntries( *m_pLbStartColor ); + m_pLbStartColor->SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) ); m_pBtnSetViewData->SetClickHdl( LINK( this, CopyDlg, SetViewData ) ); m_pBtnSetDefault->SetClickHdl( LINK( this, CopyDlg, SetDefault ) ); @@ -195,22 +201,31 @@ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) rOutAttrs.Put( SfxInt32Item( ATTR_COPY_WIDTH, nWidth ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_HEIGHT, nHeight ) ); - NamedColor aColor = m_pLbStartColor->GetSelectEntry(); - rOutAttrs.Put(XColorItem(ATTR_COPY_START_COLOR, aColor.second, aColor.first)); - aColor = m_pLbEndColor->GetSelectEntry(); - rOutAttrs.Put(XColorItem(ATTR_COPY_END_COLOR, aColor.second, aColor.first)); + if( m_pLbStartColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + { + XColorItem aXColorItem( ATTR_COPY_START_COLOR, m_pLbStartColor->GetSelectEntry(), + m_pLbStartColor->GetSelectEntryColor() ); + rOutAttrs.Put( aXColorItem ); + } + if( m_pLbEndColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) + { + XColorItem aXColorItem( ATTR_COPY_END_COLOR, m_pLbEndColor->GetSelectEntry(), + m_pLbEndColor->GetSelectEntryColor() ); + rOutAttrs.Put( aXColorItem ); + } } /** * enables and selects end color LB */ -IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, SvxColorListBox&, void) +IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, ListBox&, void) { - const Color aColor = m_pLbStartColor->GetSelectEntryColor(); + sal_Int32 nPos = m_pLbStartColor->GetSelectEntryPos(); - if (!m_pLbEndColor->IsEnabled()) + if( nPos != LISTBOX_ENTRY_NOTFOUND && + !m_pLbEndColor->IsEnabled() ) { - m_pLbEndColor->SelectEntry(aColor); + m_pLbEndColor->SelectEntryPos( nPos ); m_pLbEndColor->Enable(); m_pFtEndColor->Enable(); } |