diff options
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 35 | ||||
-rw-r--r-- | cui/source/tabpages/tpcolor.cxx | 650 | ||||
-rw-r--r-- | cui/uiconfig/ui/colorpage.ui | 1338 | ||||
-rw-r--r-- | include/svx/Palette.hxx | 10 | ||||
-rw-r--r-- | include/svx/PaletteManager.hxx | 6 | ||||
-rw-r--r-- | include/svx/dialogs.hrc | 2 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 21 | ||||
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 54 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 5 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.src | 4 |
10 files changed, 921 insertions, 1204 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 8eb92b965ff8..25c0924f9174 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -31,6 +31,8 @@ #include <svx/hexcolorcontrol.hxx> #include <svx/SvxColorValueSet.hxx> #include <svx/SvxPresetListBox.hxx> +#include <svx/Palette.hxx> +#include <svx/PaletteManager.hxx> class SdrModel; class SdrView; @@ -671,28 +673,16 @@ class SvxColorTabPage : public SfxTabPage using TabPage::DeactivatePage; private: - static const XPropertyListType meType = XCOLOR_LIST; + XPropertyListType meType; VclPtr<Window> mpTopDlg; - VclPtr<CheckBox> m_pBoxEmbed; - VclPtr<PushButton> m_pBtnLoad; - VclPtr<PushButton> m_pBtnSave; - VclPtr<FixedText> m_pTableName; - - DECL_LINK_TYPED( EmbedToggleHdl_Impl, CheckBox&, void ); - DECL_LINK_TYPED( ClickLoadHdl_Impl, Button*, void ); - DECL_LINK_TYPED( ClickSaveHdl_Impl, Button*, void ); - - XPropertyListRef GetList(); - bool GetEmbed(); - void SetEmbed( bool bEmbed ); - void UpdateTableName(); - void EnableSave( bool bCanSave ); SvxColorTabPageShadow *pShadow; - VclPtr<ColorLB> m_pLbColor; + PaletteManager maPaletteManager; + VclPtr<ListBox> m_pSelectPalette; VclPtr<SvxColorValueSet> m_pValSetColorList; + VclPtr<SvxColorValueSet> m_pValSetRecentList; VclPtr<SvxXRectPreview> m_pCtlPreviewOld; VclPtr<SvxXRectPreview> m_pCtlPreviewNew; @@ -723,9 +713,8 @@ private: VclPtr<MetricField> m_pKpreset; VclPtr<PushButton> m_pBtnAdd; - VclPtr<PushButton> m_pBtnModify; - VclPtr<PushButton> m_pBtnWorkOn; VclPtr<PushButton> m_pBtnDelete; + VclPtr<PushButton> m_pBtnWorkOn; const SfxItemSet& rOutAttrs; @@ -754,26 +743,26 @@ private: sal_uInt16 PercentToColor_Impl( sal_uInt16 nPercent ); void ImpColorCountChanged(); - + void FillPaletteLB(); DECL_LINK_TYPED( ClickAddHdl_Impl, Button*, void ); - DECL_LINK_TYPED( ClickModifyHdl_Impl, Button*, void ); - DECL_LINK_TYPED( ClickDeleteHdl_Impl, Button*, void ); DECL_LINK_TYPED( ClickWorkOnHdl_Impl, Button*, void ); + DECL_LINK_TYPED( ClickDeleteHdl_Impl, Button*, void ); - DECL_LINK_TYPED( SelectColorLBHdl_Impl, ListBox&, void ); + DECL_LINK_TYPED( SelectPaletteLBHdl, ListBox&, void ); DECL_LINK_TYPED( SelectValSetHdl_Impl, ValueSet*, void ); DECL_LINK_TYPED( SelectColorModeHdl_Impl, RadioButton&, void ); void ChangeColor(const Color &rNewColor); void SetColorModel(ColorModel eModel); void ChangeColorModel(); void UpdateColorValues(); - sal_Int32 SearchColorList(OUString const & aColorName); + static sal_Int32 SearchColorList(OUString const & aColorName); DECL_LINK_TYPED( ModifiedHdl_Impl, Edit&, void ); long CheckChanges_Impl(); void UpdateModified(); + css::uno::Reference< css::uno::XComponentContext > m_context; public: SvxColorTabPage( vcl::Window* pParent, const SfxItemSet& rInAttrs ); virtual ~SvxColorTabPage(); diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index 82599b085282..4c70df8e38ae 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -45,243 +45,13 @@ #include <cuitabline.hxx> #include <svx/dialmgr.hxx> #include <svx/dialogs.hrc> +#include <osl/file.hxx> +#include <svx/Palette.hxx> +#include <cppu/unotype.hxx> +#include <officecfg/Office/Common.hxx> using namespace com::sun::star; -XPropertyListRef SvxColorTabPage::GetList() -{ - SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( mpTopDlg.get() ); - SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( mpTopDlg.get() ); - - XColorListRef pList; - if( pArea ) - pList = pArea->GetNewColorList(); - if( pLine ) - pList = pLine->GetNewColorList(); - - if( !pList.is() ) { - if( pArea ) - pList = pArea->GetColorList(); - if( pLine ) - pList = pLine->GetColorList(); - } - - // URGH - abstract this nicely ... for re-using SvxLoadSaveEmbed - if( !pList.is() ) { - pList = GetColorList(); - } - - return XPropertyListRef( static_cast< XPropertyList * >( pList.get() ) ); -} - -void SvxColorTabPage::SetEmbed( bool bEmbed ) -{ - XPropertyListRef pList = GetList(); - if( pList.is() ) - pList->SetEmbedInDocument( bEmbed ); - m_pBoxEmbed->Check( bEmbed ); -} - -bool SvxColorTabPage::GetEmbed() -{ - XPropertyListRef pList = GetList(); - return pList.is() && pList->IsEmbedInDocument(); -} - -IMPL_LINK_NOARG_TYPED(SvxColorTabPage, EmbedToggleHdl_Impl, CheckBox&, void) -{ - SetEmbed( m_pBoxEmbed->IsChecked() ); -} - -void SvxColorTabPage::UpdateTableName() -{ - // Truncate the name if necessary ... - OUString aString( CUI_RES( RID_SVXSTR_TABLE ) ); - aString += ": "; - - XPropertyListRef pList = GetList(); - if( !pList.is() ) - return; - - INetURLObject aURL( pList->GetPath() ); - aURL.Append( pList->GetName() ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += aURL.getBase().copy( 0, 15 ); - aString += "..."; - } - else - aString += aURL.getBase(); - - m_pTableName->SetText( aString ); -} - - -IMPL_LINK_NOARG_TYPED(SvxColorTabPage, ClickLoadHdl_Impl, Button*, void) -{ - sal_uInt16 nReturn = RET_YES; - bool bLoaded = false; - - if( IsModified() && GetList()->Count() > 0 ) - { - nReturn = ScopedVclPtrInstance<MessageDialog>(GetParentDialog() - ,"AskSaveList" - ,"cui/ui/querysavelistdialog.ui")->Execute(); - - if ( nReturn == RET_YES ) - GetList()->Save(); - } - - if ( nReturn != RET_CANCEL ) - { - ::sfx2::FileDialogHelper aDlg( css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE ); - OUString aStrFilterType( XPropertyList::GetDefaultExtFilter( meType ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - OUString aPalettePath(SvtPathOptions().GetPalettePath()); - OUString aLastDir; - sal_Int32 nIndex = 0; - do - { - aLastDir = aPalettePath.getToken(0, ';', nIndex); - } - while (nIndex >= 0); - - INetURLObject aFile(aLastDir); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - - if ( aDlg.Execute() == ERRCODE_NONE ) - { - XColorListRef pList = XPropertyList::AsColorList( - XPropertyList::CreatePropertyListFromURL( - meType, aDlg.GetPath())); - if( pList->Load() ) - { - // check whether the table may be deleted: - SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( mpTopDlg.get() ); - SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( mpTopDlg.get() ); - - // FIXME: want to have a generic set and get method by type ... - if( pArea ) - pArea->SetNewColorList(pList); - else if( pLine ) - pLine->SetNewColorList(pList); - else - SetColorList(pList); - - bLoaded = true; - UpdateTableName(); - - AddState( ChangeType::CHANGED ); - SetModified( false ); - SetEmbed( true ); - } - else - { - ScopedVclPtrInstance<MessageDialog>(mpTopDlg - ,"NoLoadedFileDialog" - ,"cui/ui/querynoloadedfiledialog.ui")->Execute(); - } - } - } - Update( bLoaded ); -} - -void SvxColorTabPage::EnableSave( bool bCanSave ) -{ - if ( bCanSave ) - m_pBtnSave->Enable(); - else - m_pBtnSave->Disable(); -} - - -IMPL_LINK_NOARG_TYPED(SvxColorTabPage, ClickSaveHdl_Impl, Button*, void) -{ - ::sfx2::FileDialogHelper aDlg( - css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE ); - - OUString aStrFilterType( XPropertyList::GetDefaultExtFilter( meType ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - OUString aPalettePath(SvtPathOptions().GetPalettePath()); - OUString aLastDir; - sal_Int32 nIndex = 0; - do - { - aLastDir = aPalettePath.getToken(0, ';', nIndex); - } - while (nIndex >= 0); - - INetURLObject aFile(aLastDir); - SAL_WARN_IF( aFile.GetProtocol() == INetProtocol::NotValid, "cui.tabpages", "invalid URL" ); - - XPropertyListRef pList = GetList(); - - if( !pList->GetName().isEmpty() ) - { - aFile.Append( pList->GetName() ); - - if( aFile.getExtension().isEmpty() ) - aFile.SetExtension( XPropertyList::GetDefaultExt( meType ) ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - pList->SetName( aURL.getName() ); - pList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( pList->Save() ) - { - UpdateTableName(); - AddState( ChangeType::SAVED ); - SetModified( false ); - } - else - { - ScopedVclPtrInstance<MessageDialog>(mpTopDlg - ,"NoSaveFileDialog" - ,"cui/ui/querynosavefiledialog.ui")->Execute(); - } - } -} - -void SvxColorTabPage::Update(bool bLoaded) -{ - pColorList = XColorListRef( static_cast<XColorList *>( GetList().get() ) ); - - if (bLoaded) - { - m_pLbColor->Clear(); - m_pValSetColorList->Clear(); - Construct(); - Reset( &rOutAttrs ); - - if( m_pLbColor->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) - m_pLbColor->SelectEntryPos( 0 ); - else - m_pLbColor->SelectEntryPos( m_pLbColor->GetSelectEntryPos() ); - - sal_Int32 nPos = m_pLbColor->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - XColorEntry* pEntry = pColorList->GetColor( nPos ); - ChangeColor(pEntry->GetColor()); - } - SelectColorLBHdl_Impl( *m_pLbColor ); - } - - UpdateModified(); -} - // FIXME: you have to hate yourself for this - all this // horrible and broadly unused pointer based coupling // needs to die. cf SetupForViewFrame @@ -305,6 +75,7 @@ struct SvxColorTabPageShadow SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs) : SfxTabPage(pParent, "ColorPage", "cui/ui/colorpage.ui", &rInAttrs) + , meType( XCOLOR_LIST ) , mpTopDlg( GetParentDialog() ) , pShadow ( new SvxColorTabPageShadow() ) , rOutAttrs ( rInAttrs ) @@ -319,17 +90,14 @@ SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr , aXFillAttr( static_cast<XOutdevItemPool*>( rInAttrs.GetPool() )) , rXFSet( aXFillAttr.GetItemSet() ) , eCM( CM_RGB ) + , m_context(comphelper::getProcessComponentContext()) { - get(m_pBoxEmbed, "embed"); - get(m_pBtnLoad, "load"); - get(m_pBtnSave, "save"); - get(m_pTableName, "colortableft"); - - get(m_pLbColor, "colorlb"); + get(m_pSelectPalette, "paletteselector"); get(m_pValSetColorList, "colorset"); - Size aSize = LogicToPixel(Size(94 , 117), MAP_APPFONT); + Size aSize = LogicToPixel(Size(100 , 120), MAP_APPFONT); m_pValSetColorList->set_width_request(aSize.Width()); m_pValSetColorList->set_height_request(aSize.Height()); + get(m_pValSetRecentList, "recentcolorset"); get(m_pCtlPreviewOld, "oldpreview"); get(m_pCtlPreviewNew, "newpreview"); aSize = LogicToPixel(Size(34 , 25), MAP_APPFONT); @@ -360,17 +128,8 @@ SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr get(m_pKcustom, "K_custom"); get(m_pKpreset, "K_preset-nospin"); get(m_pBtnAdd, "add"); - get(m_pBtnModify, "modify"); - get(m_pBtnWorkOn, "edit"); get(m_pBtnDelete, "delete"); - - m_pBoxEmbed->SetToggleHdl( LINK( this, SvxColorTabPage, EmbedToggleHdl_Impl ) ); - - m_pBtnLoad->SetClickHdl( LINK( this, SvxColorTabPage, ClickLoadHdl_Impl ) ); - m_pBtnSave->SetClickHdl( LINK( this, SvxColorTabPage, ClickSaveHdl_Impl ) ); - - SetEmbed( GetEmbed() ); - UpdateTableName(); + get(m_pBtnWorkOn, "edit"); // this page needs ExchangeSupport SetExchangeSupport(); @@ -382,10 +141,10 @@ SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); // set handler - m_pLbColor->SetSelectHdl( - LINK( this, SvxColorTabPage, SelectColorLBHdl_Impl ) ); - m_pValSetColorList->SetSelectHdl( - LINK( this, SvxColorTabPage, SelectValSetHdl_Impl ) ); + m_pSelectPalette->SetSelectHdl( LINK(this, SvxColorTabPage, SelectPaletteLBHdl) ); + Link<ValueSet*, void> aValSelectLink = LINK( this, SvxColorTabPage, SelectValSetHdl_Impl ); + m_pValSetColorList->SetSelectHdl( aValSelectLink ); + m_pValSetRecentList->SetSelectHdl( aValSelectLink ); Link<Edit&,void> aLink = LINK( this, SvxColorTabPage, ModifiedHdl_Impl ); m_pRcustom->SetModifyHdl( aLink ); @@ -405,9 +164,11 @@ SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr ChangeColorModel(); m_pBtnAdd->SetClickHdl( LINK( this, SvxColorTabPage, ClickAddHdl_Impl ) ); - m_pBtnModify->SetClickHdl( LINK( this, SvxColorTabPage, ClickModifyHdl_Impl ) ); m_pBtnWorkOn->SetClickHdl( LINK( this, SvxColorTabPage, ClickWorkOnHdl_Impl ) ); m_pBtnDelete->SetClickHdl( LINK( this, SvxColorTabPage, ClickDeleteHdl_Impl ) ); + // disable modify buttons + // Color palettes can't be modified + m_pBtnDelete->Disable(); // disable preset color values m_pRGBpreset->Disable(); @@ -416,6 +177,13 @@ SvxColorTabPage::SvxColorTabPage(vcl::Window* pParent, const SfxItemSet& rInAttr // ValueSet m_pValSetColorList->SetStyle( m_pValSetColorList->GetStyle() | WB_ITEMBORDER ); m_pValSetColorList->Show(); + + m_pValSetRecentList->SetStyle( m_pValSetColorList->GetStyle() | WB_ITEMBORDER ); + m_pValSetRecentList->Show(); + maPaletteManager.ReloadRecentColorSet( *m_pValSetRecentList ); + aSize = m_pValSetRecentList->layoutAllVisible(maPaletteManager.GetRecentColorCount()); + m_pValSetRecentList->set_height_request(aSize.Height()); + m_pValSetRecentList->set_width_request(aSize.Width()); } SvxColorTabPage::~SvxColorTabPage() @@ -428,12 +196,9 @@ void SvxColorTabPage::dispose() delete pShadow; pShadow = nullptr; mpTopDlg.clear(); - m_pBoxEmbed.clear(); - m_pBtnLoad.clear(); - m_pBtnSave.clear(); - m_pTableName.clear(); - m_pLbColor.clear(); + m_pSelectPalette.clear(); m_pValSetColorList.clear(); + m_pValSetRecentList.clear(); m_pCtlPreviewOld.clear(); m_pCtlPreviewNew.clear(); m_pRbRGB.clear(); @@ -459,9 +224,8 @@ void SvxColorTabPage::dispose() m_pKcustom.clear(); m_pKpreset.clear(); m_pBtnAdd.clear(); - m_pBtnModify.clear(); - m_pBtnWorkOn.clear(); m_pBtnDelete.clear(); + m_pBtnWorkOn.clear(); SfxTabPage::dispose(); } @@ -470,17 +234,29 @@ void SvxColorTabPage::ImpColorCountChanged() if (!pColorList.is()) return; m_pValSetColorList->SetColCount(SvxColorValueSet::getColumnCount()); + m_pValSetRecentList->SetColCount(SvxColorValueSet::getColumnCount()); } +void SvxColorTabPage::FillPaletteLB() +{ + m_pSelectPalette->Clear(); + std::vector<OUString> aPaletteList = maPaletteManager.GetPaletteList(); + for( std::vector<OUString>::iterator it = aPaletteList.begin(); it != aPaletteList.end(); ++it ) + { + m_pSelectPalette->InsertEntry( *it ); + } + OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() ); + m_pSelectPalette->SelectEntry(aPaletteName); + SelectPaletteLBHdl( *m_pSelectPalette ); +} void SvxColorTabPage::Construct() { if (pColorList.is()) { - m_pLbColor->Fill(pColorList); - m_pValSetColorList->addEntriesForXColorList(*pColorList); + FillPaletteLB(); + SelectPaletteLBHdl( *m_pSelectPalette ); ImpColorCountChanged(); - UpdateTableName(); } } @@ -494,8 +270,7 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& ) { if( *pPageType == PT_COLOR && *pPos != LISTBOX_ENTRY_NOTFOUND ) { - m_pLbColor->SelectEntryPos( *pPos ); - m_pValSetColorList->SelectItem( m_pLbColor->GetSelectEntryPos() + 1 ); + m_pValSetColorList->SelectItem( m_pValSetColorList->GetItemId( static_cast<size_t>(*pPos) ) ); XColorEntry* pEntry = pColorList->GetColor( *pPos ); aPreviousColor = pEntry->GetColor(); ChangeColor(pEntry->GetColor()); @@ -523,14 +298,12 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& ) m_pCtlPreviewOld->SetAttributes( aXFillAttr.GetItemSet() ); m_pCtlPreviewOld->Invalidate(); - SelectColorLBHdl_Impl( *m_pLbColor ); + SelectValSetHdl_Impl( m_pValSetColorList ); *pPageType = PT_COLOR; *pPos = LISTBOX_ENTRY_NOTFOUND; } } - else - m_pBoxEmbed->Hide(); } DeactivateRC SvxColorTabPage::DeactivatePage( SfxItemSet* _pSet ) @@ -547,60 +320,34 @@ DeactivateRC SvxColorTabPage::DeactivatePage( SfxItemSet* _pSet ) long SvxColorTabPage::CheckChanges_Impl() { - // used to NOT lose changes - sal_Int32 nPos = m_pLbColor->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + if( ColorToPercent_Impl( aCurrentColor.GetRed() ) != ColorToPercent_Impl( aPreviousColor.GetRed() ) || + ColorToPercent_Impl( aCurrentColor.GetGreen() ) != ColorToPercent_Impl( aPreviousColor.GetGreen() ) || + ColorToPercent_Impl( aCurrentColor.GetBlue() ) != ColorToPercent_Impl( aPreviousColor.GetBlue() ) ) { - Color aColor = pColorList->GetColor( nPos )->GetColor(); - - // aNewColor, because COL_USER != COL_something, even if RGB values are the same - // Color aNewColor( aColor.GetRed(), aColor.GetGreen(), aColor.GetBlue() ); - - if( ColorToPercent_Impl( aCurrentColor.GetRed() ) != ColorToPercent_Impl( aColor.GetRed() ) || - ColorToPercent_Impl( aCurrentColor.GetGreen() ) != ColorToPercent_Impl( aColor.GetGreen() ) || - ColorToPercent_Impl( aCurrentColor.GetBlue() ) != ColorToPercent_Impl( aColor.GetBlue() ) ) - { - ResMgr& rMgr = CUI_MGR(); - Image aWarningBoxImage = WarningBox::GetStandardImage(); - ScopedVclPtrInstance<SvxMessDialog> aMessDlg( GetParentDialog(), - SVX_RESSTR( RID_SVXSTR_COLOR ), - ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ), - &aWarningBoxImage ); - aMessDlg->SetButtonText( SvxMessDialogButton::N1, + ResMgr& rMgr = CUI_MGR(); + Image aWarningBoxImage = WarningBox::GetStandardImage(); + ScopedVclPtrInstance<SvxMessDialog> aMessDlg( GetParentDialog(), + SVX_RESSTR( RID_SVXSTR_COLOR ), + ResId( RID_SVXSTR_ASK_CHANGE_COLOR, rMgr ), + &aWarningBoxImage ); + aMessDlg->SetButtonText( SvxMessDialogButton::N1, ResId( RID_SVXSTR_CHANGE, rMgr ) ); - aMessDlg->SetButtonText( SvxMessDialogButton::N2, + aMessDlg->SetButtonText( SvxMessDialogButton::N2, ResId( RID_SVXSTR_ADD, rMgr ) ); + aMessDlg->DisableButton( SvxMessDialogButton::N1 ); - short nRet = aMessDlg->Execute(); + short nRet = aMessDlg->Execute(); - switch( nRet ) + switch( nRet ) + { + case RET_BTN_2: { - case RET_BTN_1: - { - ClickModifyHdl_Impl( nullptr ); - aColor = pColorList->GetColor( nPos )->GetColor(); - } - break; - - case RET_BTN_2: - { - ClickAddHdl_Impl( nullptr ); - nPos = m_pLbColor->GetSelectEntryPos(); - aColor = pColorList->GetColor( nPos )->GetColor(); - } - break; - - case RET_CANCEL: - break; + ClickAddHdl_Impl( nullptr ); } - } - } - if( nDlgType == 0 ) // area dialog - { - nPos = m_pLbColor->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - *pPos = nPos; + break; + + case RET_CANCEL: + break; } } return 0; @@ -612,33 +359,17 @@ bool SvxColorTabPage::FillItemSet( SfxItemSet* rSet ) if( ( nDlgType != 0 ) || ( *pPageType == PT_COLOR && !*pbAreaTP ) ) { - OUString aString; - Color aColor; - - sal_Int32 nPos = m_pLbColor->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - aColor = pColorList->GetColor( nPos )->GetColor(); - aString = m_pLbColor->GetSelectEntry(); - } - else - { - aColor.SetColor (aCurrentColor.GetColor()); - } - rSet->Put( XFillColorItem( aString, aColor ) ); + maPaletteManager.AddRecentColor( aCurrentColor ); + rSet->Put( XFillColorItem( OUString(), aCurrentColor ) ); rSet->Put( XFillStyleItem( drawing::FillStyle_SOLID ) ); } - return true; } void SvxColorTabPage::UpdateModified() { bool bEnable = pColorList.is() && pColorList->Count(); - m_pBtnModify->Enable( bEnable ); m_pBtnWorkOn->Enable( bEnable ); - m_pBtnDelete->Enable( bEnable ); - EnableSave( bEnable ); } void SvxColorTabPage::Reset( const SfxItemSet* rSet ) @@ -652,12 +383,6 @@ void SvxColorTabPage::Reset( const SfxItemSet* rSet ) XFillColorItem aColorItem( static_cast<const XFillColorItem&>(rSet->Get( XATTR_FILLCOLOR )) ); aPreviousColor = aColorItem.GetColorValue(); aNewColor = aColorItem.GetColorValue(); - m_pLbColor->SelectEntry(aNewColor); - auto pos = m_pLbColor->GetSelectEntryPos(); - if (pos != LISTBOX_ENTRY_NOTFOUND) - { - m_pValSetColorList->SelectItem( pos + 1 ); - } } // set color model @@ -759,80 +484,29 @@ IMPL_LINK_NOARG_TYPED(SvxColorTabPage, ClickAddHdl_Impl, Button*, void) if (!nError) { - XColorEntry* pEntry = new XColorEntry( aCurrentColor, aName ); - - pColorList->Insert( pEntry, pColorList->Count() ); - - m_pLbColor->Append( *pEntry ); - m_pValSetColorList->InsertItem( m_pValSetColorList->GetItemCount() + 1, pEntry->GetColor(), pEntry->GetName() ); - m_pValSetColorList->Resize(); + m_pSelectPalette->SelectEntryPos(0); + SelectPaletteLBHdl( *m_pSelectPalette ); + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); + css::uno::Sequence< sal_Int32 > aCustomColorList(officecfg::Office::Common::UserColors::CustomColor::get()); + css::uno::Sequence< OUString > aCustomColorNameList(officecfg::Office::Common::UserColors::CustomColorName::get()); + sal_Int32 nSize = aCustomColorList.getLength(); + aCustomColorList.realloc( nSize + 1 ); + aCustomColorNameList.realloc( nSize + 1 ); + aCustomColorList[nSize] = aCurrentColor.GetColor(); + aCustomColorNameList[nSize] = aName; + officecfg::Office::Common::UserColors::CustomColor::set(aCustomColorList, batch); + officecfg::Office::Common::UserColors::CustomColorName::set(aCustomColorNameList, batch); + batch->commit(); + sal_uInt16 nId = m_pValSetColorList->GetItemId(nSize - 1); + m_pValSetColorList->InsertItem( nId + 1 , aCurrentColor, aName ); + m_pValSetColorList->SelectItem( nId + 1 ); + m_pBtnDelete->Enable(); ImpColorCountChanged(); - - m_pLbColor->SelectEntryPos( m_pLbColor->GetEntryCount() - 1 ); - - *pnColorListState |= ChangeType::MODIFIED; - - SelectColorLBHdl_Impl( *m_pLbColor ); } UpdateModified(); } - -IMPL_LINK_NOARG_TYPED(SvxColorTabPage, ClickModifyHdl_Impl, Button*, void) -{ - sal_Int32 nPos = m_pLbColor->GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - ResMgr& rMgr = CUI_MGR(); - OUString aDesc( ResId( RID_SVXSTR_DESC_COLOR, rMgr ) ); - OUString aName( m_pLbColor->GetSelectEntry() ); - - SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - std::unique_ptr<AbstractSvxNameDialog> pDlg(pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc )); - assert(pFact && "Dialog Creation Failed"); - - bool bLoop = true; - - while( bLoop && pDlg->Execute() == RET_OK ) - { - pDlg->GetName( aName ); - sal_Int32 nColorPos = SearchColorList(aName); - bool bValidColorName = (nColorPos == nPos) || (nColorPos == LISTBOX_ENTRY_NOTFOUND); - - if( bValidColorName ) - { - bLoop = false; - // #123497# Need to replace the existing entry with a new one (old returned needs to be deleted) - XColorEntry* pEntry = new XColorEntry(aCurrentColor, aName); - delete pColorList->Replace(pEntry, nPos); - - m_pLbColor->Modify( *pEntry, nPos ); - m_pLbColor->SelectEntryPos( nPos ); - - m_pValSetColorList->Clear(); - m_pValSetColorList->addEntriesForXColorList( *pColorList ); - m_pValSetColorList->SelectItem( nPos + 1 ); - - m_pCtlPreviewOld->Invalidate(); - - *pnColorListState |= ChangeType::MODIFIED; - } - - // if yes, it is repeated and a new name is demanded - else - { - ScopedVclPtrInstance<MessageDialog> aWarningBox( GetParentDialog() - ,"DuplicateNameDialog" - ,"cui/ui/queryduplicatedialog.ui"); - aWarningBox->Execute(); - } - } - } -} - - IMPL_LINK_NOARG_TYPED(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void) { std::unique_ptr<SvColorDialog> pColorDlg(new SvColorDialog( GetParentDialog() )); @@ -854,87 +528,100 @@ IMPL_LINK_NOARG_TYPED(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void) } } - IMPL_LINK_NOARG_TYPED(SvxColorTabPage, ClickDeleteHdl_Impl, Button*, void) { - sal_Int32 nPos = m_pLbColor->GetSelectEntryPos(); - - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + sal_uInt16 nId = m_pValSetColorList->GetSelectItemId(); + size_t nPos = m_pValSetColorList->GetSelectItemPos(); + if(m_pSelectPalette->GetSelectEntryPos() == 0 && nPos != VALUESET_ITEM_NOTFOUND ) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( GetParentDialog(),"AskDelColorDialog","cui/ui/querydeletecolordialog.ui"); - - if( aQueryBox->Execute() == RET_YES ) + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); + css::uno::Sequence< sal_Int32 > aCustomColorList(officecfg::Office::Common::UserColors::CustomColor::get()); + css::uno::Sequence< OUString > aCustomColorNameList(officecfg::Office::Common::UserColors::CustomColorName::get()); + sal_Int32 nSize = aCustomColorList.getLength() - 1; + for(sal_Int32 nIndex = static_cast<sal_Int32>(nPos);nIndex < nSize;nIndex++) { - XColorEntry* pEntry = pColorList->Remove( nPos ); - assert( pEntry && "ColorEntry not found !" ); - delete pEntry; - - // update Listbox and ValueSet - m_pLbColor->RemoveEntry( nPos ); - m_pValSetColorList->Clear(); - m_pValSetColorList->addEntriesForXColorList(*pColorList); - m_pValSetColorList->Resize(); - ImpColorCountChanged(); - //FillValueSet_Impl(*m_pValSetColorList); - - // positioning - long nColorCount = pColorList->Count(); - if( nColorCount != 0 ) - { - if( nPos >= nColorCount ) - nPos = nColorCount - 1; - m_pLbColor->SelectEntryPos( nPos ); - } - else - m_pLbColor->SetNoSelection(); - - SelectColorLBHdl_Impl( *m_pLbColor ); - - m_pCtlPreviewOld->Invalidate(); - - *pnColorListState |= ChangeType::MODIFIED; + aCustomColorList[nIndex] = aCustomColorList[nIndex+1]; + aCustomColorNameList[nIndex] = aCustomColorNameList[nIndex+1]; } + aCustomColorList.realloc(nSize); + aCustomColorNameList.realloc(nSize); + officecfg::Office::Common::UserColors::CustomColor::set(aCustomColorList, batch); + officecfg::Office::Common::UserColors::CustomColorName::set(aCustomColorNameList, batch); + batch->commit(); + m_pValSetColorList->RemoveItem(nId); + if(m_pValSetColorList->GetItemCount() != 0) + { + nId = m_pValSetColorList->GetItemId(0); + m_pValSetColorList->SelectItem(nId); + SelectValSetHdl_Impl( m_pValSetColorList ); + } + else + m_pBtnDelete->Disable(); } - UpdateModified(); } - -IMPL_LINK_NOARG_TYPED(SvxColorTabPage, SelectColorLBHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG_TYPED(SvxColorTabPage, SelectPaletteLBHdl, ListBox&, void) { - sal_Int32 nPos = m_pLbColor->GetSelectEntryPos(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) - { - m_pValSetColorList->SelectItem( nPos + 1 ); + m_pValSetColorList->Clear(); + sal_Int32 nPos = m_pSelectPalette->GetSelectEntryPos(); + maPaletteManager.SetPalette( nPos ); + maPaletteManager.ReloadColorSet( *m_pValSetColorList ); - rXFSet.Put( XFillColorItem( OUString(), - m_pLbColor->GetSelectEntryColor() ) ); - m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); - m_pCtlPreviewNew->Invalidate(); - - XColorEntry* pEntry = pColorList->GetColor(nPos); - ChangeColor(pEntry->GetColor()); + if(nPos != maPaletteManager.GetPaletteCount() - 1 && nPos != 0) + { + XColorListRef pList = XPropertyList::AsColorList( + XPropertyList::CreatePropertyListFromURL( + meType, maPaletteManager.GetSelectedPalettePath())); + pList->SetName(maPaletteManager.GetPaletteName()); + if(pList->Load()) + { + SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( mpTopDlg.get() ); + SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( mpTopDlg.get() ); + pColorList = pList; + if( pArea ) + pArea->SetNewColorList(pList); + else if( pLine ) + pLine->SetNewColorList(pList); + else + SetColorList(pList); + AddState( ChangeType::CHANGED ); + SetModified( false ); + } } -} + if(nPos != 0) + m_pBtnDelete->Disable(); + m_pValSetColorList->Resize(); +} -IMPL_LINK_NOARG_TYPED(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, void) +IMPL_LINK_TYPED(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void) { - sal_Int32 nPos = m_pValSetColorList->GetSelectItemId(); - if( nPos != LISTBOX_ENTRY_NOTFOUND ) + sal_Int32 nPos = pValSet->GetSelectItemId(); + if( nPos != 0 ) { - m_pLbColor->SelectEntryPos( nPos - 1 ); + Color aColor = pValSet->GetItemColor( nPos ); - rXFSet.Put( XFillColorItem( OUString(), - m_pLbColor->GetSelectEntryColor() ) ); + rXFSet.Put( XFillColorItem( OUString(), aColor ) ); m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() ); m_pCtlPreviewNew->Invalidate(); + ChangeColor(aColor); - XColorEntry* pEntry = pColorList->GetColor(nPos-1); - ChangeColor(pEntry->GetColor()); + if(pValSet == m_pValSetColorList) + { + m_pValSetRecentList->SetNoSelection(); + if(m_pSelectPalette->GetSelectEntryPos() == 0 && m_pValSetColorList->GetSelectItemId() != 0) + m_pBtnDelete->Enable(); + else + m_pBtnDelete->Disable(); + } + if(pValSet == m_pValSetRecentList) + { + m_pValSetColorList->SetNoSelection(); + m_pBtnDelete->Disable(); + } } } - void SvxColorTabPage::ConvertColorValues (Color& rColor, ColorModel eModell) { switch (eModell) @@ -967,6 +654,7 @@ IMPL_LINK_TYPED(SvxColorTabPage, SelectColorModeHdl_Impl, RadioButton&, rRadioBu void SvxColorTabPage::ChangeColor(const Color &rNewColor) { + aPreviousColor = rNewColor; aCurrentColor = rNewColor; UpdateColorValues(); // fill ItemSet and pass it on to XOut @@ -1043,13 +731,14 @@ void SvxColorTabPage::UpdateColorValues() sal_Int32 SvxColorTabPage::SearchColorList(OUString const & aColorName) { - long nCount = pColorList->Count(); + css::uno::Sequence< OUString > aCustomColorNameList(officecfg::Office::Common::UserColors::CustomColorName::get()); + long nCount = aCustomColorNameList.getLength(); bool bValidColorName = true; sal_Int32 nPos = LISTBOX_ENTRY_NOTFOUND; for(long i = 0;i < nCount && bValidColorName;i++) { - if(aColorName == pColorList->GetColor( i )->GetName()) + if(aColorName == aCustomColorNameList[i]) { nPos = i; bValidColorName = false; @@ -1058,22 +747,6 @@ sal_Int32 SvxColorTabPage::SearchColorList(OUString const & aColorName) return nPos; } -//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( i + 1, pColorEntry->GetColor(), pColorEntry->GetName() ); -// } -//} - - // A RGB value is converted to a CMYK value - not in an ideal way as // R is converted into C, G into M and B into Y. The K value is held in an // extra variable. For further color models one should develop own @@ -1186,8 +859,6 @@ void SvxColorTabPage::SaveToViewFrame( SfxViewFrame *pViewFrame ) if( !pColorList.is() ) return; - pColorList->Save(); - if( !pViewFrame ) return; @@ -1222,4 +893,3 @@ void SvxColorTabPage::SetColorList( const XColorListRef& pColList ) } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ - diff --git a/cui/uiconfig/ui/colorpage.ui b/cui/uiconfig/ui/colorpage.ui index bb9823f55609..dd908c532b2b 100644 --- a/cui/uiconfig/ui/colorpage.ui +++ b/cui/uiconfig/ui/colorpage.ui @@ -13,15 +13,10 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> - <object class="GtkImage" id="image1"> + <object class="GtkImage" id="image3"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="pixbuf">res/sc05501.png</property> - </object> - <object class="GtkImage" id="image2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="pixbuf">res/sc05502.png</property> + <property name="pixbuf">res/sc10350.png</property> </object> <object class="GtkBox" id="ColorPage"> <property name="visible">True</property> @@ -29,44 +24,119 @@ <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="border_width">6</property> - <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="vexpand">True</property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> <child> <object class="GtkAlignment" id="alignment1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> <property name="top_padding">6</property> <property name="left_padding">12</property> <child> - <object class="GtkBox" id="box2"> + <object class="GtkGrid" id="grid2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="spacing">12</property> + <property name="halign">start</property> + <property name="valign">start</property> + <property name="row_spacing">6</property> <child> - <object class="GtkGrid" id="grid2"> + <object class="GtkBox" id="box7"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="vexpand">True</property> - <property name="row_spacing">6</property> - <property name="column_spacing">12</property> + <property name="orientation">vertical</property> + <property name="spacing">3</property> <child> - <object class="GtkLabel" id="label6"> + <object class="GtkLabel" id="label21"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> - <property name="label" translatable="yes">C_olor:</property> - <property name="use_underline">True</property> + <property name="yalign">0</property> + <property name="label" translatable="yes">Palette :</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="paletteselector"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">3</property> + <child> + <object class="GtkLabel" id="label20"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Recent Colors</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="svxcorelo-SvxColorValueSet" id="recentcolorset"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="column_spacing">3</property> + <property name="column_homogeneous">True</property> + <child> + <object class="GtkButton" id="add"> + <property name="label">gtk-add</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> </object> <packing> <property name="left_attach">0</property> @@ -76,10 +146,43 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="colorlb"> + <object class="GtkRadioButton" id="RGB"> + <property name="label" translatable="yes">RGB</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="CMYK"> + <property name="label" translatable="yes">CMYK</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="delete"> + <property name="label" translatable="yes">Delete</property> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">start</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -88,97 +191,142 @@ <property name="height">1</property> </packing> </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="orientation">vertical</property> <child> - <object class="GtkGrid" id="grid3"> + <object class="svxcorelo-SvxColorValueSet" id="colorset"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Colors</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="svxlo-SvxXRectPreview" id="oldpreview"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkLabel" id="colortableft"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Color table:</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="svxcorelo-SvxColorValueSet" id="colorset"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="oldpreview-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">Old Color</property> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> </packing> </child> - <child> - <placeholder/> - </child> </object> <packing> <property name="expand">False</property> - <property name="fill">False</property> + <property name="fill">True</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkGrid" id="grid1"> + <object class="GtkGrid" id="rgbpreset"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">center</property> <property name="valign">start</property> - <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="row_spacing">6</property> <property name="column_spacing">6</property> <child> - <object class="svxlo-SvxXRectPreview" id="newpreview"> + <object class="GtkLabel" id="label7"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="newpreview-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">New Color</property> - </object> - </child> + <property name="label" translatable="yes">B</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">B_custom</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="left_attach">0</property> + <property name="top_attach">2</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="svxlo-SvxXRectPreview" id="oldpreview"> + <object class="GtkLabel" id="label8"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <child internal-child="accessible"> - <object class="AtkObject" id="oldpreview-atkobject"> - <property name="AtkObject::accessible-name" translatable="yes">Old Color</property> - </object> - </child> + <property name="label" translatable="yes">G</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">G_custom</property> </object> <packing> <property name="left_attach">0</property> @@ -188,13 +336,12 @@ </packing> </child> <child> - <object class="GtkRadioButton" id="RGB"> - <property name="label" translatable="yes">RGB</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="xalign">0</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> + <object class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">R</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">R_custom</property> </object> <packing> <property name="left_attach">0</property> @@ -204,143 +351,62 @@ </packing> </child> <child> - <object class="GtkRadioButton" id="CMYK"> - <property name="label" translatable="yes">CMYK</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="xalign">0</property> - <property name="active">True</property> - <property name="draw_indicator">True</property> + <object class="GtkLabel" id="label18"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Hex</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="left_attach">0</property> + <property name="top_attach">3</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="GtkGrid" id="rgbcustom"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="valign">start</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - <property name="row_homogeneous">True</property> - <child> - <object class="GtkSpinButton" id="B_custom"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="adjustment">adjustment2</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="R_custom"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="adjustment">adjustment2</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_B</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">B_custom</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_G</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">G_custom</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_R</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">R_custom</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="G_custom"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="adjustment">adjustment2</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label19"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Hex</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="svxcorelo-HexColorControl" id="hex_custom"> + <object class="svxcorelo-HexColorControl" id="hex_preset"> <property name="width_request">6</property> <property name="visible">True</property> <property name="can_focus">True</property> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="R_preset-nospin"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustment2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="G_preset-nospin"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustment2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="B_preset-nospin"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustment2</property> </object> <packing> <property name="left_attach">1</property> @@ -349,255 +415,43 @@ <property name="height">1</property> </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="cmykpreset"> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="valign">start</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> <child> - <object class="GtkGrid" id="cmykcustom"> + <object class="GtkLabel" id="label10"> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="no_show_all">True</property> - <property name="halign">end</property> - <property name="valign">start</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - <property name="row_homogeneous">True</property> - <child> - <object class="GtkLabel" id="label11"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_C</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">C_custom:0%</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label12"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_M</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_K</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">K_custom:0%</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="C_custom:0%"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="adjustment">adjustment1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="K_custom:0%"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="adjustment">adjustment1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label14"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Y</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="M_custom:0%"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="adjustment">adjustment1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="Y_custom:0%"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="invisible_char">•</property> - <property name="adjustment">adjustment1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> + <property name="label" translatable="yes">_C</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">C_custom:0%</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> + <property name="left_attach">0</property> + <property name="top_attach">0</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="GtkGrid" id="cmykpreset"> + <object class="GtkLabel" id="label16"> + <property name="visible">True</property> <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="valign">start</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - <property name="row_homogeneous">True</property> - <child> - <object class="GtkLabel" id="label10"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_C</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">C_custom:0%</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label15"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_M</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label16"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_K</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">K_custom:0%</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label17"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">_Y</property> - <property name="use_underline">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="C_preset-nospin:0%"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="M_preset-nospin:0%"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="Y_preset-nospin:0%"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="K_preset-nospin:0%"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment1</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> + <property name="label" translatable="yes">_K</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">K_custom:0%</property> </object> <packing> <property name="left_attach">0</property> @@ -607,305 +461,447 @@ </packing> </child> <child> - <object class="GtkButton" id="edit"> - <property name="label" translatable="yes">_Pick…</property> + <object class="GtkLabel" id="label17"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Y</property> <property name="use_underline">True</property> </object> <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="C_preset-nospin:0%"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustment1</property> + </object> + <packing> <property name="left_attach">1</property> - <property name="top_attach">4</property> + <property name="top_attach">0</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <object class="GtkGrid" id="rgbpreset"> + <object class="GtkSpinButton" id="M_preset-nospin:0%"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="valign">start</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - <property name="row_homogeneous">True</property> - <child> - <object class="GtkLabel" id="label7"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">B</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">B_custom</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label8"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">G</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">G_custom</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label9"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">R</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">R_custom</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Hex</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="svxcorelo-HexColorControl" id="hex_preset"> - <property name="width_request">6</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="R_preset-nospin"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment2</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="G_preset-nospin"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment2</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkSpinButton" id="B_preset-nospin"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="adjustment">adjustment2</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="adjustment">adjustment1</property> </object> <packing> - <property name="left_attach">0</property> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="Y_preset-nospin:0%"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustment1</property> + </object> + <packing> + <property name="left_attach">1</property> <property name="top_attach">2</property> <property name="width">1</property> <property name="height">1</property> </packing> </child> <child> - <placeholder/> + <object class="GtkSpinButton" id="K_preset-nospin:0%"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="adjustment">adjustment1</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label15"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_M</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Active</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">start</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="valign">start</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> <child> - <object class="GtkButtonBox" id="buttonbox1"> + <object class="GtkBox" id="box5"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="orientation">vertical</property> - <property name="spacing">6</property> - <property name="layout_style">start</property> <child> - <object class="GtkButton" id="add"> - <property name="label">gtk-add</property> + <object class="svxlo-SvxXRectPreview" id="newpreview"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child internal-child="accessible"> + <object class="AtkObject" id="newpreview-atkobject"> + <property name="AtkObject::accessible-name" translatable="yes">New Color</property> + </object> + </child> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> <property name="position">0</property> </packing> </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="rgbcustom"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">center</property> + <property name="valign">start</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> <child> - <object class="GtkButton" id="modify"> - <property name="label" translatable="yes">_Modify</property> + <object class="GtkSpinButton" id="B_custom"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustment2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="R_custom"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustment2</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_B</property> <property name="use_underline">True</property> + <property name="mnemonic_widget">B_custom</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> </packing> </child> <child> - <object class="GtkButton" id="delete"> - <property name="label">gtk-delete</property> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_G</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">G_custom</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_R</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">R_custom</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="G_custom"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustment2</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> </packing> </child> <child> - <object class="GtkGrid" id="grid4"> + <object class="GtkLabel" id="label19"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="row_spacing">6</property> - <property name="column_spacing">6</property> - <child> - <object class="GtkButton" id="load"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Load Color List</property> - <property name="tooltip_text" translatable="yes">Load Color List</property> - <property name="halign">center</property> - <property name="valign">end</property> - <property name="hexpand">True</property> - <property name="image">image1</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> - <child> - <object class="GtkButton" id="save"> + <property name="label" translatable="yes">_Hex</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="svxcorelo-HexColorControl" id="hex_custom"> + <property name="width_request">6</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="has_tooltip">True</property> - <property name="tooltip_markup" translatable="yes">Save Color List</property> - <property name="tooltip_text" translatable="yes">Save Color List</property> - <property name="halign">center</property> - <property name="valign">end</property> - <property name="hexpand">True</property> - <property name="image">image2</property> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkGrid" id="cmykcustom"> + <property name="can_focus">False</property> + <property name="no_show_all">True</property> + <property name="halign">center</property> + <property name="valign">start</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="label11"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_C</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">C_custom:0%</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">4</property> - <property name="secondary">True</property> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> </packing> </child> <child> - <object class="GtkGrid" id="grid5"> + <object class="GtkLabel" id="label12"> <property name="visible">True</property> <property name="can_focus">False</property> - <child> - <object class="GtkCheckButton" id="embed"> - <property name="label" translatable="yes">Embed</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="valign">start</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> - </packing> - </child> + <property name="label" translatable="yes">_M</property> + <property name="use_underline">True</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">5</property> - <property name="secondary">True</property> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label13"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_K</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">K_custom:0%</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="C_custom:0%"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustment1</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="K_custom:0%"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustment1</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label14"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Y</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="Y_custom:0%"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustment1</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="M_custom:0%"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="invisible_char">•</property> + <property name="adjustment">adjustment1</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> </packing> </child> </object> <packing> <property name="expand">False</property> - <property name="fill">False</property> + <property name="fill">True</property> <property name="position">2</property> </packing> </child> + <child> + <object class="GtkButton" id="edit"> + <property name="label" translatable="yes">Pick</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="valign">start</property> + <property name="image">image3</property> + <property name="image_position">right</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> </object> </child> </object> </child> <child type="label"> - <object class="GtkLabel" id="label1"> + <object class="GtkLabel" id="label6"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes">Properties</property> + <property name="label" translatable="yes">New</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -913,9 +909,9 @@ </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">2</property> </packing> </child> </object> diff --git a/include/svx/Palette.hxx b/include/svx/Palette.hxx index 1cbb83e2c94a..ffbd529fbe2f 100644 --- a/include/svx/Palette.hxx +++ b/include/svx/Palette.hxx @@ -29,7 +29,7 @@ class SvFileStream; typedef std::pair<Color, OUString> NamedColor; typedef std::vector< NamedColor > ColorList; -class Palette +class SVX_DLLPUBLIC Palette { public: virtual ~Palette(); @@ -43,7 +43,7 @@ public: // ASE = Adobe Swatch Exchange -class PaletteASE : public Palette +class SVX_DLLPUBLIC PaletteASE : public Palette { bool mbValidPalette; OUString maFPath; @@ -64,7 +64,7 @@ public: // GPL - this is *not* GNU Public License, but is the Gimp PaLette -class PaletteGPL : public Palette +class SVX_DLLPUBLIC PaletteGPL : public Palette { bool mbLoadedPalette; bool mbValidPalette; @@ -89,7 +89,7 @@ public: // SOC - Star Office Color-table -class PaletteSOC : public Palette +class SVX_DLLPUBLIC PaletteSOC : public Palette { bool mbLoadedPalette; OUString maFPath; @@ -108,4 +108,4 @@ public: #endif // INCLUDED_SVX_PALETTE_HXX -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx index c8eb922df874..ceeea5d5a5e8 100644 --- a/include/svx/PaletteManager.hxx +++ b/include/svx/PaletteManager.hxx @@ -36,7 +36,7 @@ #include <vector> #include <memory> -class PaletteManager +class SVX_DLLPUBLIC PaletteManager { const sal_uInt16 mnMaxRecentColors; @@ -56,13 +56,17 @@ class PaletteManager public: PaletteManager(); ~PaletteManager(); + PaletteManager(const PaletteManager&) = delete; + PaletteManager& operator=(const PaletteManager&) = delete; void LoadPalettes(); void ReloadColorSet(SvxColorValueSet& rColorSet); void ReloadRecentColorSet(SvxColorValueSet& rColorSet); std::vector<OUString> GetPaletteList(); void SetPalette( sal_Int32 nPos ); sal_Int32 GetPalette(); + sal_Int32 GetPaletteCount() { return mnNumOfPalettes; } OUString GetPaletteName(); + OUString GetSelectedPalettePath(); long GetColorCount(); long GetRecentColorCount(); diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc index de9f394cf63c..8e87be9b576f 100644 --- a/include/svx/dialogs.hrc +++ b/include/svx/dialogs.hrc @@ -239,7 +239,7 @@ #define RID_SVXSTR_MORENUMBERING (RID_SVX_START + 204) #define RID_SVXSTR_MOREBULLETS (RID_SVX_START + 205) -#define RID_SVXSTR_DEFAULT_PAL (RID_SVX_START + 206) +#define RID_SVXSTR_CUSTOM_PAL (RID_SVX_START + 206) #define RID_SVXSTR_DOC_COLORS (RID_SVX_START + 207) #define RID_SVXSTR_DOC_COLOR_PREFIX (RID_SVX_START + 208) diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 5edc96c46edc..112e04c12a76 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -3414,7 +3414,26 @@ <info> <desc>List of Recent colors</desc> </info> - <value/> </prop> + <value/> + </prop> + <prop oor:name="PaletteName" oor:type="xs:string" oor:nillable="false"> + <info> + <desc>Name of selected palette</desc> + </info> + <value>standard</value> + </prop> + <prop oor:name="CustomColor" oor:type="oor:int-list" oor:nillable="false"> + <info> + <desc>List of Custom colors</desc> + </info> + <value/> + </prop> + <prop oor:name="CustomColorName" oor:type="oor:string-list" oor:nillable="false"> + <info> + <desc>List of Custom colors</desc> + </info> + <value/> + </prop> </group> <group oor:name="Help"> <info> diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index e1da1d71bff2..e2dbe421c885 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -35,7 +35,7 @@ PaletteManager::PaletteManager() : mnMaxRecentColors(Application::GetSettings().GetStyleSettings().GetColorValueSetColumnCount()), - mnNumOfPalettes(1), + mnNumOfPalettes(2), mnCurrentPalette(0), mnColorCount(0), mpBtnUpdater(nullptr), @@ -120,7 +120,21 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet) { SfxObjectShell* pDocSh = SfxObjectShell::Current(); - if( mnCurrentPalette == mnNumOfPalettes - 1 ) + if( mnCurrentPalette == 0) + { + rColorSet.Clear(); + css::uno::Sequence< sal_Int32 > CustomColorList( officecfg::Office::Common::UserColors::CustomColor::get() ); + css::uno::Sequence< OUString > CustomColorNameList( officecfg::Office::Common::UserColors::CustomColorName::get() ); + int nIx = 1; + for( int i = 0;i < CustomColorList.getLength();i++ ) + { + Color aColor( CustomColorList[i] ); + OUString aColorName( CustomColorNameList[i] ); + rColorSet.InsertItem( nIx, aColor, aColorName ); + ++nIx; + } + } + else if( mnCurrentPalette == mnNumOfPalettes - 1 ) { // Add doc colors to palette std::set<Color> aColors = pDocSh->GetDocColors(); @@ -130,7 +144,7 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet) } else { - m_Palettes[mnCurrentPalette]->LoadColorSet( rColorSet ); + m_Palettes[mnCurrentPalette - 1]->LoadColorSet( rColorSet ); mnColorCount = rColorSet.GetItemCount(); } } @@ -158,11 +172,11 @@ std::vector<OUString> PaletteManager::GetPaletteList() { std::vector<OUString> aPaletteNames; + aPaletteNames.push_back( SVX_RESSTR( RID_SVXSTR_CUSTOM_PAL ) ); for (auto const& it : m_Palettes) { aPaletteNames.push_back( (*it).GetName() ); } - aPaletteNames.push_back( SVX_RESSTR ( RID_SVXSTR_DOC_COLORS ) ); return aPaletteNames; @@ -170,12 +184,13 @@ std::vector<OUString> PaletteManager::GetPaletteList() void PaletteManager::SetPalette( sal_Int32 nPos ) { - if( nPos != mnNumOfPalettes - 1 ) + mnCurrentPalette = nPos; + if( nPos != mnNumOfPalettes - 1 && nPos != 0) { pColorList = XPropertyList::AsColorList( XPropertyList::CreatePropertyListFromURL( - XCOLOR_LIST, m_Palettes[nPos]->GetPath())); - pColorList->SetName(m_Palettes[nPos]->GetName()); + XCOLOR_LIST, GetSelectedPalettePath())); + pColorList->SetName(GetPaletteName()); if(pColorList->Load()) { SfxObjectShell* pShell = SfxObjectShell::Current(); @@ -183,7 +198,9 @@ void PaletteManager::SetPalette( sal_Int32 nPos ) pShell->PutItem( aColorItem ); } } - mnCurrentPalette = nPos; + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create(m_context)); + officecfg::Office::Common::UserColors::PaletteName::set(GetPaletteName(), batch); + batch->commit(); } sal_Int32 PaletteManager::GetPalette() @@ -193,7 +210,26 @@ sal_Int32 PaletteManager::GetPalette() OUString PaletteManager::GetPaletteName() { - return pColorList->GetName(); + std::vector<OUString> aNames(GetPaletteList()); + if(mnCurrentPalette != mnNumOfPalettes - 1 && mnCurrentPalette != 0) + { + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + if(pDocSh) + { + const SfxPoolItem* pItem = nullptr; + if( nullptr != ( pItem = pDocSh->GetItem(SID_COLOR_TABLE) ) ) + pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList(); + } + } + return aNames[mnCurrentPalette]; +} + +OUString PaletteManager::GetSelectedPalettePath() +{ + if(mnCurrentPalette != mnNumOfPalettes - 1 && mnCurrentPalette != 0) + return m_Palettes[mnCurrentPalette - 1]->GetPath(); + else + return OUString(); } long PaletteManager::GetColorCount() diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 2851dfa1f2b4..2dceb15814f4 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -96,6 +96,8 @@ #include <svx/xflclit.hxx> #include <svl/currencytable.hxx> #include <svtools/langtab.hxx> +#include <cppu/unotype.hxx> +#include <officecfg/Office/Common.hxx> #define MAX_MRU_FONTNAME_ENTRIES 5 @@ -1331,7 +1333,8 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand, { mpPaletteListBox->InsertEntry( *it ); } - mpPaletteListBox->SelectEntry(mrPaletteManager.GetPaletteName()); + OUString aPaletteName( officecfg::Office::Common::UserColors::PaletteName::get() ); + mpPaletteListBox->SelectEntry( aPaletteName ); SelectPaletteHdl( *mpPaletteListBox ); mpButtonAutoColor->SetClickHdl( LINK( this, SvxColorWindow_Impl, AutoColorClickHdl ) ); diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src index 8e7a44267f6c..48777fc9d70a 100644 --- a/svx/source/tbxctrls/tbcontrl.src +++ b/svx/source/tbxctrls/tbcontrl.src @@ -224,9 +224,9 @@ String RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE Text [ en-US ] = "Font Name. The current font is not available and will be substituted."; }; -String RID_SVXSTR_DEFAULT_PAL +String RID_SVXSTR_CUSTOM_PAL { - Text [ en-US ] = "Default palette"; + Text [ en-US ] = "custom"; }; String RID_SVXSTR_DOC_COLORS |