diff options
author | Armin Le Grand <alg@apache.org> | 2013-04-16 08:41:07 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-20 11:33:13 +0100 |
commit | 35aa48d80b4b800d408d26bd72fbdfd711abbb6f (patch) | |
tree | 2756d4aa78cd67be7d1597b4222f0da0657c770d /cui | |
parent | 05038d1bd0a7bc9ecb6676ba1309576ac74f849f (diff) |
Resolves: #i122041# Unified and centralized control for Color ValueSets
(cherry picked from commit 68e707bbc6fe23881b822e6efab8a2933343dc1a)
Conflicts:
cui/source/inc/backgrnd.hxx
cui/source/inc/cuitabarea.hxx
cui/source/tabpages/backgrnd.cxx
cui/source/tabpages/tpcolor.cxx
sd/source/ui/view/drviews6.cxx
svx/Package_inc.mk
svx/inc/svx/colrctrl.hxx
svx/source/sidebar/tools/ColorControl.cxx
svx/source/tbxctrls/colorwindow.hxx
svx/source/tbxctrls/colrctrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
Change-Id: Ie06fe355846b737ec8aae9aade4d408232c83193
Related: #i122041# Add a11y values for defining behaviour of ColorValueSets
(cherry picked from commit 401e8f2db607081e62eaaa1f08a8cd8971a3f637)
Conflicts:
cui/source/tabpages/backgrnd.cxx
officecfg/registry/schema/org/openoffice/Office/Common.xcs
sc/source/ui/miscdlgs/tabbgcolordlg.cxx
svtools/inc/svtools/accessibilityoptions.hxx
svtools/source/inc/configitems/accessibilityoptions_const.hxx
vcl/inc/vcl/bitmap.hxx
vcl/source/gdi/bitmap4.cxx
Change-Id: If9d0db5f22974cad1ac886eca3719ca92ca7f240
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/backgrnd.hxx | 4 | ||||
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 6 | ||||
-rw-r--r-- | cui/source/tabpages/backgrnd.cxx | 40 | ||||
-rw-r--r-- | cui/source/tabpages/tpcolor.cxx | 57 | ||||
-rw-r--r-- | cui/uiconfig/ui/backgroundpage.ui | 2 | ||||
-rw-r--r-- | cui/uiconfig/ui/colorpage.ui | 2 |
6 files changed, 52 insertions, 59 deletions
diff --git a/cui/source/inc/backgrnd.hxx b/cui/source/inc/backgrnd.hxx index c3e13b9e176d..cece693bf2bb 100644 --- a/cui/source/inc/backgrnd.hxx +++ b/cui/source/inc/backgrnd.hxx @@ -22,7 +22,7 @@ #include <vcl/group.hxx> #include <svtools/stdctrl.hxx> #include <vcl/graph.hxx> -#include <svtools/valueset.hxx> +#include <svx/SvxColorValueSet.hxx> #include <svx/dlgctrl.hxx> #include <editeng/brushitem.hxx> @@ -82,7 +82,7 @@ private: ListBox* m_pParaLBox; VclFrame* m_pBackGroundColorFrame; - ValueSet* m_pBackgroundColorSet; + SvxColorValueSet* m_pBackgroundColorSet; BackgroundPreviewImpl* m_pPreviewWin1; FixedText* m_pColTransFT;///<color transparency diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 548a9018192c..374dd3196a3c 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -27,6 +27,7 @@ #include <svx/xfillit0.hxx> #include <svx/xfillit.hxx> #include <svx/tabarea.hxx> +#include <svx/SvxColorValueSet.hxx> class SdrModel; class SdrView; @@ -650,7 +651,7 @@ private: Edit* m_pEdtName; ColorLB* m_pLbColor; - ValueSet* m_pValSetColorList; + SvxColorValueSet* m_pValSetColorList; SvxXRectPreview* m_pCtlPreviewOld; SvxXRectPreview* m_pCtlPreviewNew; @@ -698,7 +699,8 @@ private: sal_uInt16 ColorToPercent_Impl( sal_uInt16 nColor ); sal_uInt16 PercentToColor_Impl( sal_uInt16 nPercent ); - void FillValueSet_Impl( ValueSet& rVs ); + void ImpColorCountChanged(); + //----------------------------------------------------------------------------------------------------- DECL_LINK( ClickAddHdl_Impl, void * ); DECL_LINK( ClickModifyHdl_Impl, void * ); diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 3b94fdfc757d..a8ce0a75eba8 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -413,6 +413,8 @@ SvxBackgroundTabPage::SvxBackgroundTabPage(Window* pParent, const SfxItemSet& rC FillColorValueSets_Impl(); m_pBackgroundColorSet->SetSelectHdl( HDL(BackgroundColorHdl_Impl) ); + m_pBackgroundColorSet->SetStyle(m_pBackgroundColorSet->GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD); + m_pBackgroundColorSet->SetText(SVX_RESSTR(RID_SVXSTR_TRANSPARENT)); } //------------------------------------------------------------------------ @@ -1169,47 +1171,23 @@ void SvxBackgroundTabPage::FillColorValueSets_Impl() SfxObjectShell* pDocSh = SfxObjectShell::Current(); const SfxPoolItem* pItem = NULL; XColorListRef pColorTable = NULL; - const Size aSize15x15 = Size( 15, 15 ); - if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) ) + { pColorTable = ( (SvxColorListItem*)pItem )->GetColorList(); + } if ( !pColorTable.is() ) pColorTable = XColorList::CreateStdColorList(); if ( pColorTable.is() ) { - short i = 0; - long nCount = pColorTable->Count(); - XColorEntry* pEntry = NULL; - Color aColWhite( COL_WHITE ); - String aStrWhite( EditResId( RID_SVXITEMS_COLOR_WHITE ) ); - WinBits nBits = ( m_pBackgroundColorSet->GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD ); - m_pBackgroundColorSet->SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) ); - m_pBackgroundColorSet->SetStyle( nBits ); - m_pBackgroundColorSet->SetAccessibleName(m_pBackGroundColorFrame->get_label_widget()->GetText()); - for ( i = 0; i < nCount; i++ ) - { - pEntry = pColorTable->GetColor(i); - m_pBackgroundColorSet->InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() ); - } - - while ( i < 104 ) - { - m_pBackgroundColorSet->InsertItem( i + 1, aColWhite, aStrWhite ); - i++; - } - - if ( nCount > 104 ) - { - m_pBackgroundColorSet->SetStyle( nBits | WB_VSCROLL ); - } + m_pBackgroundColorSet->Clear(); + m_pBackgroundColorSet->addEntriesForXColorList(*pColorTable); } - m_pBackgroundColorSet->SetColCount( 8 ); - m_pBackgroundColorSet->SetLineCount( 13 ); - m_pBackgroundColorSet->CalcWindowSizePixel( aSize15x15 ); - + const WinBits nBits(m_pBackgroundColorSet->GetStyle() | WB_ITEMBORDER | WB_NAMEFIELD | WB_NONEFIELD); + m_pBackgroundColorSet->SetStyle(nBits); + m_pBackgroundColorSet->SetColCount(m_pBackgroundColorSet->getColumnCount()); } //------------------------------------------------------------------------ diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 371b61ec27ab..fc209ed5bf37 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -391,10 +391,7 @@ SvxColorTabPage::SvxColorTabPage(Window* pParent, const SfxItemSet& rInAttrs) LINK( this, SvxColorTabPage, ClickDeleteHdl_Impl ) ); // ValueSet - m_pValSetColorList->SetStyle( m_pValSetColorList->GetStyle() | WB_VSCROLL | WB_ITEMBORDER ); - m_pValSetColorList->SetColCount( 8 ); - m_pValSetColorList->SetLineCount( 13 ); - m_pValSetColorList->SetExtraSpacing( 0 ); + m_pValSetColorList->SetStyle( m_pValSetColorList->GetStyle() | WB_ITEMBORDER ); m_pValSetColorList->Show(); } @@ -405,11 +402,24 @@ SvxColorTabPage::~SvxColorTabPage() // ----------------------------------------------------------------------- +void SvxColorTabPage::ImpColorCountChanged() +{ + if (!pColorList.is()) + return; + m_pValSetColorList->SetColCount(m_pValSetColorList->getColumnCount()); +} + +// ----------------------------------------------------------------------- + void SvxColorTabPage::Construct() { - m_pLbColor->Fill(pColorList); - FillValueSet_Impl(*m_pValSetColorList); - UpdateTableName(); + if (pColorList.is()) + { + m_pLbColor->Fill(pColorList); + m_pValSetColorList->addEntriesForXColorList(*pColorList); + ImpColorCountChanged(); + UpdateTableName(); + } } // ----------------------------------------------------------------------- @@ -722,6 +732,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl) m_pLbColor->Append( pEntry ); m_pValSetColorList->InsertItem( m_pValSetColorList->GetItemCount() + 1, pEntry->GetColor(), pEntry->GetName() ); + ImpColorCountChanged(); m_pLbColor->SelectEntryPos( m_pLbColor->GetEntryCount() - 1 ); @@ -874,7 +885,9 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickDeleteHdl_Impl) // update Listbox and ValueSet m_pLbColor->RemoveEntry( nPos ); m_pValSetColorList->Clear(); - FillValueSet_Impl(*m_pValSetColorList); + m_pValSetColorList->addEntriesForXColorList(*pColorList); + ImpColorCountChanged(); + //FillValueSet_Impl(*m_pValSetColorList); // positioning m_pLbColor->SelectEntryPos( nPos ); @@ -1043,20 +1056,20 @@ long SvxColorTabPage::ChangeColorHdl_Impl( void* ) //------------------------------------------------------------------------ -void SvxColorTabPage::FillValueSet_Impl( ValueSet& rVs ) -{ - long nCount = pColorList->Count(); - XColorEntry* pColorEntry; - - if( nCount > 104 ) - rVs.SetStyle( rVs.GetStyle() | WB_VSCROLL ); - - for( long i = 0; i < nCount; i++ ) - { - pColorEntry = pColorList->GetColor( i ); - rVs.InsertItem( (sal_uInt16) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() ); - } -} +//void SvxColorTabPage::FillValueSet_Impl( ValueSet& rVs ) +//{ +// long nCount = pColorList->Count(); +// XColorEntry* pColorEntry; +// +// if( nCount > 104 ) +// rVs.SetStyle( rVs.GetStyle() | WB_VSCROLL ); +// +// for( long i = 0; i < nCount; i++ ) +// { +// pColorEntry = pColorList->GetColor( i ); +// rVs.InsertItem( (sal_uInt16) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() ); +// } +//} //------------------------------------------------------------------------ diff --git a/cui/uiconfig/ui/backgroundpage.ui b/cui/uiconfig/ui/backgroundpage.ui index 3182e288179f..78d761fb24f8 100644 --- a/cui/uiconfig/ui/backgroundpage.ui +++ b/cui/uiconfig/ui/backgroundpage.ui @@ -217,7 +217,7 @@ </packing> </child> <child> - <object class="svtlo-ValueSet" id="backgroundcolorset"> + <object class="svxlo-SvxColorValueSet" id="backgroundcolorset"> <property name="width_request">150</property> <property name="height_request">150</property> <property name="visible">True</property> diff --git a/cui/uiconfig/ui/colorpage.ui b/cui/uiconfig/ui/colorpage.ui index 48da1f31b5f6..0146da13b28b 100644 --- a/cui/uiconfig/ui/colorpage.ui +++ b/cui/uiconfig/ui/colorpage.ui @@ -129,7 +129,7 @@ </packing> </child> <child> - <object class="svtlo-ValueSet" id="colorset"> + <object class="svxlo-SvxColorValueSet" id="colorset"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> |