diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-10-28 13:37:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-04 17:14:26 +0000 |
commit | 43bc3031483d172eccd72c3804e2d4fc2ef37de4 (patch) | |
tree | 991d98e8e61fae47ada28ba7a0b02e1d6c8e443f /sc/source/ui/condformat | |
parent | 44523738f094ff3987e85ea0c47b8c636bbe5786 (diff) |
unify color selectors
Note: this removes the use of auto-color from writer's asian text grid, because
its always invisible as far as I can see in practice.
Change-Id: Ie850790d740a4d56c43015e493e093678cef3b4e
Diffstat (limited to 'sc/source/ui/condformat')
-rw-r--r-- | sc/source/ui/condformat/colorformat.cxx | 57 | ||||
-rw-r--r-- | sc/source/ui/condformat/condformatdlgentry.cxx | 79 |
2 files changed, 15 insertions, 121 deletions
diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index ab2e08983b3f..f6e9ebc4eb9d 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -13,6 +13,7 @@ #include "document.hxx" #include "sc.hrc" +#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <svx/drawitem.hxx> #include <vcl/msgbox.hxx> @@ -66,16 +67,6 @@ void SetValue( ScDocument* pDoc, ScColorScaleEntry* pEntry, Edit& aEdit) aEdit.Disable(); } -void SelectColor(const Color& aColor, const OUString & aCustomName, ColorListBox& rLstBox) -{ - rLstBox.SelectEntry( aColor ); - if ( rLstBox.GetSelectEntryColor() != aColor ) - { - rLstBox.InsertEntry( aColor, aCustomName ); - rLstBox.SelectEntry( aColor ); - } -} - } ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBarFormatData& rData, ScDocument* pDoc, const ScAddress& rPos): @@ -100,14 +91,13 @@ ScDataBarSettingsDlg::ScDataBarSettingsDlg(vcl::Window* pWindow, const ScDataBar get( mpCbOnlyBar, "only_bar"); maStrWarnSameValue = get<FixedText>("str_same_value")->GetText(); - maCustomColor = get<FixedText>("custom_color")->GetText(); Init(); - ::SelectColor( rData.maPositiveColor, maCustomColor, *mpLbPos); + mpLbPos->SelectEntry(rData.maPositiveColor); mpLbFillType->SelectEntryPos( rData.mbGradient ? 1 : 0 ); - if(rData.mpNegativeColor) - ::SelectColor( *rData.mpNegativeColor, maCustomColor, *mpLbNeg ); + if (rData.mpNegativeColor) + mpLbNeg->SelectEntry(*rData.mpNegativeColor); switch (rData.meAxisPosition) { @@ -160,42 +150,9 @@ void ScDataBarSettingsDlg::dispose() void ScDataBarSettingsDlg::Init() { - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - } - if ( pColorTable.is() ) - { - // filling the line color box - mpLbPos->SetUpdateMode( false ); - mpLbNeg->SetUpdateMode( false ); - mpLbAxisCol->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - mpLbPos->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - mpLbNeg->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - mpLbAxisCol->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - - if(pEntry->GetColor() == Color(COL_LIGHTRED)) - mpLbNeg->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_BLACK)) - mpLbAxisCol->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - mpLbPos->SelectEntryPos(i); - } - mpLbPos->SetUpdateMode( true ); - mpLbNeg->SetUpdateMode( true ); - mpLbAxisCol->SetUpdateMode( true ); - } + mpLbNeg->SelectEntry(Color(COL_LIGHTRED)); + mpLbAxisCol->SelectEntry(Color(COL_BLACK)); + mpLbPos->SelectEntry(Color(COL_LIGHTBLUE)); mpBtnOk->SetClickHdl( LINK( this, ScDataBarSettingsDlg, OkBtnHdl ) ); mpLbTypeMin->SetSelectHdl( LINK( this, ScDataBarSettingsDlg, TypeSelectHdl ) ); diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 415aa11274e5..f4273992e9f4 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -18,6 +18,7 @@ #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> #include <svl/intitem.hxx> +#include <svx/colorbox.hxx> #include <svx/xtable.hxx> #include <svx/drawitem.hxx> #include <vcl/msgbox.hxx> @@ -663,7 +664,7 @@ OUString convertNumberToString(double nVal, ScDocument* pDoc) return aText; } -void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, ColorListBox& rLbCol, ScDocument* pDoc ) +void SetColorScaleEntryTypes( const ScColorScaleEntry& rEntry, ListBox& rLbType, Edit& rEdit, SvxColorListBox& rLbCol, ScDocument* pDoc ) { // entry Automatic is not available for color scales sal_Int32 nIndex = static_cast<sal_Int32>(rEntry.GetType()); @@ -726,7 +727,7 @@ void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const } } -ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const ColorListBox& rColor, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) +ScColorScaleEntry* createColorScaleEntry( const ListBox& rType, const SvxColorListBox& rColor, const Edit& rValue, ScDocument* pDoc, const ScAddress& rPos ) { ScColorScaleEntry* pEntry = new ScColorScaleEntry(); @@ -796,38 +797,8 @@ void ScColorScale2FrmtEntry::Init() { maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) ); - - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast<const SvxColorListItem*>(pItem) ->GetColorList(); - } - if ( pColorTable.is() ) - { - // filling the line color box - maLbColMin->SetUpdateMode( false ); - maLbColMax->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - - if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_LIGHTBLUE)) - maLbColMax->SelectEntryPos(i); - } - maLbColMin->SetUpdateMode( true ); - maLbColMax->SetUpdateMode( true ); - } + maLbColMin->SelectEntry(Color(COL_LIGHTRED)); + maLbColMax->SelectEntry(Color(COL_LIGHTBLUE)); } ScFormatEntry* ScColorScale2FrmtEntry::createColorscaleEntry() const @@ -976,43 +947,9 @@ void ScColorScale3FrmtEntry::Init() maLbEntryTypeMin->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMax->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); maLbEntryTypeMiddle->SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) ); - - SfxObjectShell* pDocSh = SfxObjectShell::Current(); - XColorListRef pColorTable; - - DBG_ASSERT( pDocSh, "DocShell not found!" ); - - if ( pDocSh ) - { - const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); - if ( pItem != nullptr ) - pColorTable = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); - } - if ( pColorTable.is() ) - { - // filling the line color box - maLbColMin->SetUpdateMode( false ); - maLbColMiddle->SetUpdateMode( false ); - maLbColMax->SetUpdateMode( false ); - - for ( long i = 0; i < pColorTable->Count(); ++i ) - { - const XColorEntry* pEntry = pColorTable->GetColor(i); - maLbColMin->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMiddle->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - maLbColMax->InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - - if(pEntry->GetColor() == Color(COL_LIGHTRED)) - maLbColMin->SelectEntryPos(i); - if(pEntry->GetColor() == Color(COL_YELLOW)) - maLbColMiddle->SelectEntryPos(i); - if(pEntry->GetColor() == Color(0x00CC00)) // Green 3 - maLbColMax->SelectEntryPos(i); - } - maLbColMin->SetUpdateMode( true ); - maLbColMiddle->SetUpdateMode( true ); - maLbColMax->SetUpdateMode( true ); - } + maLbColMin->SelectEntry(Color(COL_LIGHTRED)); + maLbColMiddle->SelectEntry(Color(COL_YELLOW)); + maLbColMax->SelectEntry(Color(0x00CC00)); } ScFormatEntry* ScColorScale3FrmtEntry::createColorscaleEntry() const |