diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-05 20:28:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-07 21:04:50 +0000 |
commit | 64a708cba9b954afe3331f63c58218eb53b3d0ce (patch) | |
tree | ddc1bea3b63f32a1c6d377c1d1dd7aee0803fb70 /svx | |
parent | f01c49c4a89ecad2376fd0023625186e5cac642e (diff) |
Revert "Reverts a commit series that cripple windows ci."
with addition of...
- svxlo-SvxColorListBox
+ svxcorelo-SvxColorListBox
This reverts commit db380aab1063e8a5e40111c40ee9f7921aa82601.
Change-Id: I3af7aa0abb1a430bce64188244404fcbd480b128
Reviewed-on: https://gerrit.libreoffice.org/30598
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/sdi/svx.sdi | 19 | ||||
-rw-r--r-- | svx/source/dialog/_bmpmask.cxx | 56 | ||||
-rw-r--r-- | svx/source/dialog/bmpmask.hrc | 2 | ||||
-rw-r--r-- | svx/source/dialog/bmpmask.src | 5 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 48 | ||||
-rw-r--r-- | svx/source/dialog/fontwork.cxx | 13 | ||||
-rw-r--r-- | svx/source/engine3d/float3d.cxx | 191 | ||||
-rw-r--r-- | svx/source/engine3d/float3d.src | 15 | ||||
-rw-r--r-- | svx/source/sidebar/area/AreaPropertyPanelBase.cxx | 97 | ||||
-rw-r--r-- | svx/source/sidebar/shadow/ShadowPropertyPanel.cxx | 37 | ||||
-rw-r--r-- | svx/source/sidebar/shadow/ShadowPropertyPanel.hxx | 11 | ||||
-rw-r--r-- | svx/source/tbxctrls/PaletteManager.cxx | 23 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 411 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.src | 12 | ||||
-rw-r--r-- | svx/uiconfig/ui/colorwindow.ui | 50 | ||||
-rw-r--r-- | svx/uiconfig/ui/docking3deffects.ui | 24 | ||||
-rw-r--r-- | svx/uiconfig/ui/dockingcolorreplace.ui | 10 | ||||
-rw-r--r-- | svx/uiconfig/ui/dockingfontwork.ui | 2 | ||||
-rw-r--r-- | svx/uiconfig/ui/sidebararea.ui | 4 | ||||
-rw-r--r-- | svx/uiconfig/ui/sidebarshadow.ui | 2 |
20 files changed, 608 insertions, 424 deletions
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 0693af63dc7c..2e8b2f6bd9cc 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -3596,25 +3596,6 @@ SfxBoolItem Freeline_Unfilled SID_DRAW_FREELINE_NOFILL ] -SfxBoolItem AutoColorInvalid SID_ATTR_AUTO_COLOR_INVALID - -[ - AutoUpdate = TRUE, - FastCall = FALSE, - ReadOnlyDoc = FALSE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - - - AccelConfig = FALSE, - MenuConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_INSERT; -] - - SfxVoidItem Gallery SID_GALLERY [ diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 77ca04fc3a01..5eec4f8f7e8a 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -25,6 +25,7 @@ #include <sfx2/dispatch.hxx> #include <svtools/colrdlg.hxx> +#include <svx/colorbox.hxx> #include <svx/dialmgr.hxx> #include <svx/bmpmask.hxx> #include <svx/dialogs.hrc> @@ -34,7 +35,6 @@ #include "helpid.hrc" #define BMP_RESID(nId) ResId(nId, DIALOG_MGR()) -#define TRANSP_COL (Color( 252, 252, 252 )) #define OWN_CALLMODE SfxCallMode::ASYNCHRON | SfxCallMode::RECORD @@ -293,7 +293,7 @@ IMPL_LINK( MaskData, CbxTransHdl, Button*, pButton, void ) IMPL_LINK( MaskData, FocusLbHdl, Control&, rControl, void ) { - ColorLB* pLb = static_cast<ColorLB*>(&rControl); + SvxColorListBox* pLb = static_cast<SvxColorListBox*>(&rControl); // MT: bFireFox as API parameter is ugly, find better solution???? pMask->m_pQSet1->SelectItem( pLb == pMask->m_pLbColor1 ? 1 : 0 /* , false */ ); pMask->m_pQSet2->SelectItem( pLb == pMask->m_pLbColor2 ? 1 : 0 /* , false */ ); @@ -373,6 +373,7 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* m_pQSet1->Show(); get(m_pSp1, "tol1"); get(m_pLbColor1, "color1"); + m_pLbColor1->SetSlotId(SID_BMPMASK_COLOR); get(m_pCbx2, "cbx2"); m_pQSet2 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet2->set_grid_left_attach(1); @@ -380,6 +381,7 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* m_pQSet2->Show(); get(m_pSp2, "tol2"); get(m_pLbColor2, "color2"); + m_pLbColor2->SetSlotId(SID_BMPMASK_COLOR); get(m_pCbx3, "cbx3"); m_pQSet3 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet3->set_grid_left_attach(1); @@ -387,6 +389,7 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* m_pQSet3->Show(); get(m_pSp3, "tol3"); get(m_pLbColor3, "color3"); + m_pLbColor3->SetSlotId(SID_BMPMASK_COLOR); get(m_pCbx4, "cbx4"); m_pQSet4 = VclPtr<MaskSet>::Create(this, pGrid); m_pQSet4->set_grid_left_attach(1); @@ -394,14 +397,15 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* m_pQSet4->Show(); get(m_pSp4, "tol4"); get(m_pLbColor4, "color4"); + m_pLbColor4->SetSlotId(SID_BMPMASK_COLOR); get(m_pCbxTrans, "cbx5"); get(m_pLbColorTrans, "color5"); - //temp fill it to get optimal size - m_pLbColor1->Fill(XColorList::GetStdColorList()); - m_pLbColor1->set_width_request(m_pLbColor1->get_preferred_size().Width()); - m_pLbColor1->Clear(); - //clear again + m_pLbColorTrans->SelectEntry(Color(COL_BLACK)); + m_pLbColor1->SelectEntry(Color(COL_TRANSPARENT)); + m_pLbColor2->SelectEntry(Color(COL_TRANSPARENT)); + m_pLbColor3->SelectEntry(Color(COL_TRANSPARENT)); + m_pLbColor4->SelectEntry(Color(COL_TRANSPARENT)); m_pTbxPipette->SetSelectHdl( LINK( pData, MaskData, PipetteHdl ) ); m_pBtnExec->SetClickHdl( LINK( pData, MaskData, ExecHdl ) ); @@ -517,40 +521,6 @@ bool SvxBmpMask::Close() return SfxDockingWindow::Close(); } -bool SvxBmpMask::NeedsColorList() const -{ - return ( m_pLbColor1->GetEntryCount() == 0 ); -} - -void SvxBmpMask::SetColorList( const XColorListRef &pList ) -{ - if ( pList.is() && ( pList != pColLst ) ) - { - const OUString aTransp(BMP_RESID(RID_SVXDLG_BMPMASK_STR_TRANSP).toString()); - - pColLst = pList; - - m_pLbColorTrans->Fill( pColLst ); - m_pLbColorTrans->SelectEntryPos( 0 ); - - m_pLbColor1->Fill( pColLst ); - m_pLbColor1->InsertEntry( TRANSP_COL, aTransp, 0 ); - m_pLbColor1->SelectEntryPos( 0 ); - - m_pLbColor2->Fill( pColLst ); - m_pLbColor2->InsertEntry( TRANSP_COL, aTransp, 0 ); - m_pLbColor2->SelectEntryPos( 0 ); - - m_pLbColor3->Fill( pColLst ); - m_pLbColor3->InsertEntry( TRANSP_COL, aTransp, 0 ); - m_pLbColor3->SelectEntryPos( 0 ); - - m_pLbColor4->Fill( pColLst ); - m_pLbColor4->InsertEntry( TRANSP_COL, aTransp, 0 ); - m_pLbColor4->SelectEntryPos( 0 ); - } -} - void SvxBmpMask::SetColor( const Color& rColor ) { aPipetteColor = rColor; @@ -738,7 +708,7 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf ) pMinB[i] = std::max( nVal - nTol, 0L ); pMaxB[i] = std::min( nVal + nTol, 255L ); - pTrans[ i ] = ( pDstCols[ i ] == TRANSP_COL ); + pTrans[ i ] = (pDstCols[ i ] == COL_TRANSPARENT); } // Investigate actions and if necessary replace colors @@ -1054,7 +1024,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic ) for( sal_uInt16 i = 0; i < nCount; i++ ) { // Do we have a transparent color? - if( pDstCols[i] == TRANSP_COL ) + if (pDstCols[i] == COL_TRANSPARENT) { BitmapEx aBmpEx( ImpMaskTransparent( aGraphic.GetBitmapEx(), pSrcCols[ i ], pTols[ i ] ) ); diff --git a/svx/source/dialog/bmpmask.hrc b/svx/source/dialog/bmpmask.hrc index 1e446c418145..bf054482824d 100644 --- a/svx/source/dialog/bmpmask.hrc +++ b/svx/source/dialog/bmpmask.hrc @@ -16,7 +16,7 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#define RID_SVXDLG_BMPMASK_STR_TRANSP (RID_SVX_BMPMASK_START + 1) + #define RID_SVXDLG_BMPMASK_STR_PALETTE (RID_SVX_BMPMASK_START + 3) /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/bmpmask.src b/svx/source/dialog/bmpmask.src index d154d7ed0db9..16bf943d9f69 100644 --- a/svx/source/dialog/bmpmask.src +++ b/svx/source/dialog/bmpmask.src @@ -22,11 +22,6 @@ #include "bmpmask.hrc" #include "helpid.hrc" -String RID_SVXDLG_BMPMASK_STR_TRANSP -{ - Text [ en-US ] = "Transparent"; -}; - String RID_SVXDLG_BMPMASK_STR_PALETTE { Text [ en-US ] = "Color Palette"; diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 740033df05e0..d8f312bda281 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -1103,52 +1103,6 @@ void SvxPixelCtl::Reset() Invalidate(); } -VCL_BUILDER_DECL_FACTORY(ColorLB) -{ - bool bDropdown = VclBuilder::extractDropdown(rMap); - WinBits nWinBits = WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE|WB_TABSTOP; - if (bDropdown) - nWinBits |= WB_DROPDOWN; - OString sBorder = VclBuilder::extractCustomProperty(rMap); - if (!sBorder.isEmpty()) - nWinBits |= WB_BORDER; - VclPtrInstance<ColorLB> pListBox(pParent, nWinBits); - pListBox->EnableAutoSize(true); - rRet = pListBox; -} - -// Fills the Listbox with color and strings - -void ColorLB::Fill( const XColorListRef &pColorTab ) -{ - if( !pColorTab.is() ) - return; - - long nCount = pColorTab->Count(); - SetUpdateMode( false ); - - for( long i = 0; i < nCount; i++ ) - { - const XColorEntry* pEntry = pColorTab->GetColor(i); - InsertEntry( pEntry->GetColor(), pEntry->GetName() ); - } - - AdaptDropDownLineCountToMaximum(); - SetUpdateMode( true ); -} - -void ColorLB::Append( const XColorEntry& rEntry ) -{ - InsertEntry( rEntry.GetColor(), rEntry.GetName() ); - AdaptDropDownLineCountToMaximum(); -} - -void ColorLB::Modify( const XColorEntry& rEntry, sal_Int32 nPos ) -{ - RemoveEntry( nPos ); - InsertEntry( rEntry.GetColor(), rEntry.GetName(), nPos ); -} - // Fills the listbox (provisional) with strings HatchingLB::HatchingLB( vcl::Window* pParent, WinBits nWinStyle) @@ -1303,7 +1257,7 @@ namespace } // end of anonymous namespace FillAttrLB::FillAttrLB(vcl::Window* pParent, WinBits aWB) -: ColorListBox(pParent, aWB) + : ListBox(pParent, aWB) { } diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx index 166277cc42b4..b86ce464a860 100644 --- a/svx/source/dialog/fontwork.cxx +++ b/svx/source/dialog/fontwork.cxx @@ -20,6 +20,7 @@ #include <sfx2/module.hxx> #include <sfx2/dispatch.hxx> +#include <svx/colorbox.hxx> #include <svx/svdobj.hxx> #include <svx/svdopath.hxx> #include <svx/svdview.hxx> @@ -791,23 +792,13 @@ IMPL_LINK_NOARG(SvxFontWorkDialog, InputTimoutHdl_Impl, Idle *, void) { &aDistItem, &aStartItem, &aShadowXItem, &aShadowYItem }); } -IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl, ListBox&, void) +IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl, SvxColorListBox&, void) { XFormTextShadowColorItem aItem( "", m_pShadowColorLB->GetSelectEntryColor() ); GetBindings().GetDispatcher()->ExecuteList(SID_FORMTEXT_SHDWCOLOR, SfxCallMode::RECORD, { &aItem }); } -void SvxFontWorkDialog::SetColorList(const XColorListRef &pList) -{ - if ( pList.is() && pList != pColorList ) - { - pColorList = pList; - m_pShadowColorLB->Clear(); - m_pShadowColorLB->Fill(pColorList); - } -} - void SvxFontWorkDialog::ApplyImageList() { if (nLastShadowTbxId == nShadowSlantId) diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index b5ed0de3e87a..80d065df7a22 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -24,6 +24,7 @@ #include <svtools/colrdlg.hxx> #include <vcl/msgbox.hxx> #include <sfx2/viewsh.hxx> +#include <svx/colorbox.hxx> #include <svx/xflclit.hxx> #include <svx/svdmodel.hxx> #include <svx/globl3d.hxx> @@ -273,19 +274,20 @@ Svx3DWin::Svx3DWin(SfxBindings* pInBindings, SfxChildWindow *pCW, vcl::Window* p Link<ListBox&,void> aLink2 = LINK( this, Svx3DWin, SelectHdl ); + Link<SvxColorListBox&,void> aLink4 = LINK( this, Svx3DWin, SelectColorHdl ); m_pLbMatFavorites->SetSelectHdl( aLink2 ); - m_pLbMatColor->SetSelectHdl( aLink2 ); - m_pLbMatEmission->SetSelectHdl( aLink2 ); - m_pLbMatSpecular->SetSelectHdl( aLink2 ); - m_pLbLight1->SetSelectHdl( aLink2 ); - m_pLbLight2->SetSelectHdl( aLink2 ); - m_pLbLight3->SetSelectHdl( aLink2 ); - m_pLbLight4->SetSelectHdl( aLink2 ); - m_pLbLight5->SetSelectHdl( aLink2 ); - m_pLbLight6->SetSelectHdl( aLink2 ); - m_pLbLight7->SetSelectHdl( aLink2 ); - m_pLbLight8->SetSelectHdl( aLink2 ); - m_pLbAmbientlight->SetSelectHdl( aLink2 ); + m_pLbMatColor->SetSelectHdl( aLink4 ); + m_pLbMatEmission->SetSelectHdl( aLink4 ); + m_pLbMatSpecular->SetSelectHdl( aLink4 ); + m_pLbLight1->SetSelectHdl( aLink4 ); + m_pLbLight2->SetSelectHdl( aLink4 ); + m_pLbLight3->SetSelectHdl( aLink4 ); + m_pLbLight4->SetSelectHdl( aLink4 ); + m_pLbLight5->SetSelectHdl( aLink4 ); + m_pLbLight6->SetSelectHdl( aLink4 ); + m_pLbLight7->SetSelectHdl( aLink4 ); + m_pLbLight8->SetSelectHdl( aLink4 ); + m_pLbAmbientlight->SetSelectHdl( aLink4 ); m_pLbShademode->SetSelectHdl( aLink2 ); Link<Edit&,void> aLink3 = LINK( this, Svx3DWin, ModifyHdl ); @@ -941,7 +943,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue(); - ColorLB* pLb = m_pLbLight1; + SvxColorListBox* pLb = m_pLbLight1; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -950,7 +952,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight1->GetSelectEntryCount() != 0 ) + if (!m_pLbLight1->IsNoSelection()) { m_pLbLight1->SetNoSelection(); bUpdate = true; @@ -990,7 +992,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue(); - ColorLB* pLb = m_pLbLight2; + SvxColorListBox* pLb = m_pLbLight2; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -999,7 +1001,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight2->GetSelectEntryCount() != 0 ) + if (!m_pLbLight2->IsNoSelection()) { m_pLbLight2->SetNoSelection(); bUpdate = true; @@ -1039,7 +1041,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue(); - ColorLB* pLb = m_pLbLight3; + SvxColorListBox* pLb = m_pLbLight3; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1048,7 +1050,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight3->GetSelectEntryCount() != 0 ) + if (!m_pLbLight3->IsNoSelection()) { m_pLbLight3->SetNoSelection(); bUpdate = true; @@ -1088,7 +1090,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue(); - ColorLB* pLb = m_pLbLight4; + SvxColorListBox* pLb = m_pLbLight4; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1097,7 +1099,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight4->GetSelectEntryCount() != 0 ) + if (!m_pLbLight4->IsNoSelection()) { m_pLbLight4->SetNoSelection(); bUpdate = true; @@ -1137,7 +1139,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue(); - ColorLB* pLb = m_pLbLight5; + SvxColorListBox* pLb = m_pLbLight5; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1146,7 +1148,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight5->GetSelectEntryCount() != 0 ) + if (!m_pLbLight5->IsNoSelection()) { m_pLbLight5->SetNoSelection(); bUpdate = true; @@ -1186,7 +1188,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue(); - ColorLB* pLb = m_pLbLight6; + SvxColorListBox* pLb = m_pLbLight6; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1195,7 +1197,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight6->GetSelectEntryCount() != 0 ) + if (!m_pLbLight6->IsNoSelection()) { m_pLbLight6->SetNoSelection(); bUpdate = true; @@ -1235,7 +1237,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue(); - ColorLB* pLb = m_pLbLight7; + SvxColorListBox* pLb = m_pLbLight7; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1244,7 +1246,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight7->GetSelectEntryCount() != 0 ) + if (!m_pLbLight7->IsNoSelection()) { m_pLbLight7->SetNoSelection(); bUpdate = true; @@ -1284,7 +1286,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue(); - ColorLB* pLb = m_pLbLight8; + SvxColorListBox* pLb = m_pLbLight8; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1293,7 +1295,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbLight8->GetSelectEntryCount() != 0 ) + if (!m_pLbLight8->IsNoSelection()) { m_pLbLight8->SetNoSelection(); bUpdate = true; @@ -1333,7 +1335,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue(); - ColorLB* pLb = m_pLbAmbientlight; + SvxColorListBox* pLb = m_pLbAmbientlight; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1342,7 +1344,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbAmbientlight->GetSelectEntryCount() != 0 ) + if (!m_pLbAmbientlight->IsNoSelection()) { m_pLbAmbientlight->SetNoSelection(); bUpdate = true; @@ -1493,7 +1495,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const XFillColorItem&>(rAttrs.Get(XATTR_FILLCOLOR)).GetColorValue(); - ColorLB* pLb = m_pLbMatColor; + SvxColorListBox* pLb = m_pLbMatColor; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1502,7 +1504,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbMatColor->GetSelectEntryCount() != 0 ) + if (!m_pLbMatColor->IsNoSelection()) { m_pLbMatColor->SetNoSelection(); bUpdate = true; @@ -1514,7 +1516,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue(); - ColorLB* pLb = m_pLbMatEmission; + SvxColorListBox* pLb = m_pLbMatEmission; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1523,7 +1525,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbMatEmission->GetSelectEntryCount() != 0 ) + if (!m_pLbMatEmission->IsNoSelection()) { m_pLbMatEmission->SetNoSelection(); bUpdate = true; @@ -1535,7 +1537,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) if( eState != SfxItemState::DONTCARE ) { aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue(); - ColorLB* pLb = m_pLbMatSpecular; + SvxColorListBox* pLb = m_pLbMatSpecular; if( aColor != pLb->GetSelectEntryColor() ) { LBSelectColor( pLb, aColor ); @@ -1544,7 +1546,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs ) } else { - if( m_pLbMatSpecular->GetSelectEntryCount() != 0 ) + if (!m_pLbMatSpecular->IsNoSelection()) { m_pLbMatSpecular->SetNoSelection(); bUpdate = true; @@ -1852,7 +1854,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) const SfxItemSet aLightItemSet(m_pCtlLightPreview->GetSvx3DLightControl().Get3DAttributes()); // Light 1 color - if( m_pLbLight1->GetSelectEntryCount() ) + if (!m_pLbLight1->IsNoSelection()) { aColor = m_pLbLight1->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor1Item(aColor)); @@ -1877,7 +1879,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Light 2 color - if( m_pLbLight2->GetSelectEntryCount() ) + if (!m_pLbLight2->IsNoSelection()) { aColor = m_pLbLight2->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor2Item(aColor)); @@ -1901,7 +1903,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_2); // Light 3 color - if( m_pLbLight3->GetSelectEntryCount() ) + if (!m_pLbLight3->IsNoSelection()) { aColor = m_pLbLight3->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor3Item(aColor)); @@ -1925,7 +1927,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_3); // Light 4 color - if( m_pLbLight4->GetSelectEntryCount() ) + if (!m_pLbLight4->IsNoSelection()) { aColor = m_pLbLight4->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor4Item(aColor)); @@ -1949,7 +1951,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_4); // Light 5 color - if( m_pLbLight5->GetSelectEntryCount() ) + if (!m_pLbLight5->IsNoSelection()) { aColor = m_pLbLight5->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor5Item(aColor)); @@ -1973,7 +1975,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_5); // Light 6 color - if( m_pLbLight6->GetSelectEntryCount() ) + if (!m_pLbLight6->IsNoSelection()) { aColor = m_pLbLight6->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor6Item(aColor)); @@ -1997,7 +1999,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_6); // Light 7 color - if( m_pLbLight7->GetSelectEntryCount() ) + if (!m_pLbLight7->IsNoSelection()) { aColor = m_pLbLight7->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor7Item(aColor)); @@ -2021,7 +2023,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_7); // Light 8 color - if( m_pLbLight8->GetSelectEntryCount() ) + if (!m_pLbLight8->IsNoSelection()) { aColor = m_pLbLight8->GetSelectEntryColor(); rAttrs.Put(makeSvx3DLightcolor8Item(aColor)); @@ -2045,7 +2047,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_8); // Ambient light - if( m_pLbAmbientlight->GetSelectEntryCount() ) + if (!m_pLbAmbientlight->IsNoSelection()) { aColor = m_pLbAmbientlight->GetSelectEntryColor(); rAttrs.Put(makeSvx3DAmbientcolorItem(aColor)); @@ -2121,7 +2123,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Material // Object color - if( m_pLbMatColor->GetSelectEntryCount() ) + if (!m_pLbMatColor->IsNoSelection()) { aColor = m_pLbMatColor->GetSelectEntryColor(); rAttrs.Put( XFillColorItem( "", aColor) ); @@ -2132,7 +2134,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) } // luminous color - if( m_pLbMatEmission->GetSelectEntryCount() ) + if (!m_pLbMatEmission->IsNoSelection()) { aColor = m_pLbMatEmission->GetSelectEntryColor(); rAttrs.Put(makeSvx3DMaterialEmissionItem(aColor)); @@ -2141,7 +2143,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_EMISSION); // Specular - if( m_pLbMatSpecular->GetSelectEntryCount() ) + if (!m_pLbMatSpecular->IsNoSelection()) { aColor = m_pLbMatSpecular->GetSelectEntryColor(); rAttrs.Put(makeSvx3DMaterialSpecularItem(aColor)); @@ -2302,7 +2304,7 @@ IMPL_LINK( Svx3DWin, ClickViewTypeHdl, Button*, pBtn, void ) { m_pFLLight->Show(); - ColorLB* pLb = GetLbByButton(); + SvxColorListBox* pLb = GetLbByButton(); if( pLb ) pLb->Show(); @@ -2388,7 +2390,7 @@ IMPL_LINK( Svx3DWin, ClickHdl, Button *, pButton, void ) pBtn == m_pBtnLight8 ) { // Lighting - ColorLB* pLb = GetLbByButton( pBtn ); + SvxColorListBox* pLb = GetLbByButton( pBtn ); pLb->Show(); if( pBtn->IsChecked() ) @@ -2513,7 +2515,7 @@ IMPL_LINK( Svx3DWin, ClickHdl, Button *, pButton, void ) IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void) { SvColorDialog aColorDlg( this ); - ColorLB* pLb; + SvxColorListBox* pLb; if( pBtn == m_pBtnLightColor ) pLb = GetLbByButton(); @@ -2532,12 +2534,11 @@ IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void) if( aColorDlg.Execute() == RET_OK ) { aColor = aColorDlg.GetColor(); - if( LBSelectColor( pLb, aColor ) ) - SelectHdl( *pLb ); + LBSelectColor(pLb, aColor); + SelectColorHdl(*pLb); } } - IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void ) { bool bUpdatePreview = false; @@ -2604,9 +2605,20 @@ IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void ) bUpdatePreview = true; } - else if( &rListBox == m_pLbMatColor || - &rListBox == m_pLbMatEmission || - &rListBox == m_pLbMatSpecular ) + else if (&rListBox == m_pLbShademode) + bUpdatePreview = true; + + if( bUpdatePreview ) + UpdatePreview(); +} + +IMPL_LINK( Svx3DWin, SelectColorHdl, SvxColorListBox&, rListBox, void ) +{ + bool bUpdatePreview = false; + + if( &rListBox == m_pLbMatColor || + &rListBox == m_pLbMatEmission || + &rListBox == m_pLbMatSpecular ) { m_pLbMatFavorites->SelectEntryPos( 0 ); bUpdatePreview = true; @@ -2627,8 +2639,6 @@ IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void ) { bUpdatePreview = true; } - else if (&rListBox == m_pLbShademode) - bUpdatePreview = true; if( bUpdatePreview ) UpdatePreview(); @@ -2665,7 +2675,7 @@ IMPL_LINK( Svx3DWin, ModifyHdl, Edit&, rField, void ) void Svx3DWin::ClickLight(PushButton& rBtn) { sal_uInt16 nLightSource = GetLightSource( &rBtn ); - ColorLB* pLb = GetLbByButton( &rBtn ); + SvxColorListBox* pLb = GetLbByButton( &rBtn ); Color aColor( pLb->GetSelectEntryColor() ); SfxItemSet aLightItemSet(m_pCtlLightPreview->GetSvx3DLightControl().Get3DAttributes()); const bool bOnOff(GetUILightState( static_cast<const ImageButton&>(rBtn) )); @@ -2756,36 +2766,29 @@ IMPL_LINK_NOARG(Svx3DWin, ChangeSelectionCallbackHdl, SvxLightCtl3D*, void) } } +namespace +{ + OUString lcl_makeColorName(const Color& rColor) + { + OUString aStr = SVX_RESSTR(RID_SVXFLOAT3D_FIX_R) + + OUString::number(rColor.GetRed()) + + " " + + SVX_RESSTR(RID_SVXFLOAT3D_FIX_G) + + OUString::number(rColor.GetGreen()) + + " " + + SVX_RESSTR(RID_SVXFLOAT3D_FIX_B) + + OUString::number(rColor.GetBlue()); + return aStr; + } +} // Method to ensure that the LB is also associated with a color -// returns true if color was added - -bool Svx3DWin::LBSelectColor( ColorLB* pLb, const Color& rColor ) +void Svx3DWin::LBSelectColor( SvxColorListBox* pLb, const Color& rColor ) { - bool bRet = false; - pLb->SetNoSelection(); - pLb->SelectEntry( rColor ); - if( pLb->GetSelectEntryCount() == 0 ) - { - OUString aStr(SVX_RESSTR(RID_SVXFLOAT3D_FIX_R)); - - aStr += OUString::number((sal_Int32)rColor.GetRed()); - aStr += " "; - aStr += SVX_RESSTR(RID_SVXFLOAT3D_FIX_G); - aStr += OUString::number((sal_Int32)rColor.GetGreen()); - aStr += " "; - aStr += SVX_RESSTR(RID_SVXFLOAT3D_FIX_B); - aStr += OUString::number((sal_Int32)rColor.GetBlue()); - - const sal_Int32 nPos = pLb->InsertEntry( rColor, aStr ); - pLb->SelectEntryPos( nPos ); - bRet = true; - } - return bRet; + pLb->SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor))); } - void Svx3DWin::UpdatePreview() { if( pModel == nullptr ) @@ -2808,22 +2811,8 @@ void Svx3DWin::DocumentReload() mpRemember2DAttributes = nullptr; } - -void Svx3DWin::InitColorLB( const SdrModel* pDoc ) +void Svx3DWin::InitColorLB() { - m_pLbLight1->Fill( pDoc->GetColorList() ); - m_pLbLight2->CopyEntries( *m_pLbLight1 ); - m_pLbLight3->CopyEntries( *m_pLbLight1 ); - m_pLbLight4->CopyEntries( *m_pLbLight1 ); - m_pLbLight5->CopyEntries( *m_pLbLight1 ); - m_pLbLight6->CopyEntries( *m_pLbLight1 ); - m_pLbLight7->CopyEntries( *m_pLbLight1 ); - m_pLbLight8->CopyEntries( *m_pLbLight1 ); - m_pLbAmbientlight->CopyEntries( *m_pLbLight1 ); - m_pLbMatColor->CopyEntries( *m_pLbLight1 ); - m_pLbMatEmission->CopyEntries( *m_pLbLight1 ); - m_pLbMatSpecular->CopyEntries( *m_pLbLight1 ); - // First... Color aColWhite( COL_WHITE ); Color aColBlack( COL_BLACK ); @@ -2888,9 +2877,9 @@ sal_uInt16 Svx3DWin::GetLightSource( const PushButton* pBtn ) }; -ColorLB* Svx3DWin::GetLbByButton( const PushButton* pBtn ) +SvxColorListBox* Svx3DWin::GetLbByButton( const PushButton* pBtn ) { - ColorLB* pLb = nullptr; + SvxColorListBox* pLb = nullptr; if( pBtn == nullptr ) { diff --git a/svx/source/engine3d/float3d.src b/svx/source/engine3d/float3d.src index 734117060173..43a48855ae25 100644 --- a/svx/source/engine3d/float3d.src +++ b/svx/source/engine3d/float3d.src @@ -41,21 +41,6 @@ String RID_SVXFLOAT3D_FAVORITE Text [ en-US ] = "Favorite"; }; -String RID_SVXFLOAT3D_FIX_X -{ - Text [ en-US ] = "X"; -}; - -String RID_SVXFLOAT3D_FIX_Y -{ - Text [ en-US ] = "Y"; -}; - -String RID_SVXFLOAT3D_FIX_Z -{ - Text [ en-US ] = "Z"; -}; - String RID_SVXFLOAT3D_FIX_R { Text [ en-US ] = "R:"; diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 5f90b223781a..318b95b20e23 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -167,10 +167,11 @@ void AreaPropertyPanelBase::Initialize() mpLbFillType->SetSelectHdl( LINK( this, AreaPropertyPanelBase, SelectFillTypeHdl ) ); Link<ListBox&,void> aLink = LINK( this, AreaPropertyPanelBase, SelectFillAttrHdl ); + Link<SvxColorListBox&,void> aLink3 = LINK( this, AreaPropertyPanelBase, SelectFillColorHdl ); mpLbFillAttr->SetSelectHdl( aLink ); mpGradientStyle->SetSelectHdl( aLink ); - mpLbFillGradFrom->SetSelectHdl( aLink ); - mpLbFillGradTo->SetSelectHdl( aLink ); + mpLbFillGradFrom->SetSelectHdl( aLink3 ); + mpLbFillGradTo->SetSelectHdl( aLink3 ); mpMTRAngle->SetModifyHdl(LINK(this,AreaPropertyPanelBase, ChangeGradientAngle)); mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl)); @@ -296,61 +297,33 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) mpToolBoxColor->Hide(); mpBmpImport->Hide(); - const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE)); - if(pColorListItem) - { - mpLbFillAttr->Enable(); - mpLbFillGradTo->Enable(); - mpLbFillGradFrom->Enable(); - mpGradientStyle->Enable(); - mpMTRAngle->Enable(); - mpLbFillAttr->Clear(); - mpLbFillGradTo->Clear(); - mpLbFillGradFrom->Clear(); - mpLbFillGradTo->Fill(pColorListItem->GetColorList()); - mpLbFillGradFrom->Fill(pColorListItem->GetColorList()); + mpLbFillAttr->Enable(); + mpLbFillGradTo->Enable(); + mpLbFillGradFrom->Enable(); + mpGradientStyle->Enable(); + mpMTRAngle->Enable(); + mpLbFillAttr->Clear(); - mpLbFillGradFrom->AdaptDropDownLineCountToMaximum(); - mpLbFillGradTo->AdaptDropDownLineCountToMaximum(); + if (LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient) + { + const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); - if(LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient) + if(mnLastPosGradient < aItem.GetGradientList()->Count()) { - const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); - - if(mnLastPosGradient < aItem.GetGradientList()->Count()) - { - const XGradient aGradient = aItem.GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient(); - const XFillGradientItem aXFillGradientItem(aGradient); - - // #i122676# change FillStyle and Gradient in one call - XFillStyleItem aXFillStyleItem(drawing::FillStyle_GRADIENT); - setFillStyleAndGradient(&aXFillStyleItem, aXFillGradientItem); - mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - if(mpLbFillGradFrom->GetSelectEntryCount() == 0) - { - mpLbFillGradFrom->InsertEntry(aGradient.GetStartColor(), OUString()); - mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - } - mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - if(mpLbFillGradTo->GetSelectEntryCount() == 0) - { - mpLbFillGradTo->InsertEntry(aGradient.GetEndColor(), OUString()); - mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - } - - mpMTRAngle->SetValue(aGradient.GetAngle() / 10); - css::awt::GradientStyle eXGS = aGradient.GetGradientStyle(); - mpGradientStyle->SelectEntryPos(sal::static_int_cast< sal_Int32 >( eXGS )); - } + const XGradient aGradient = aItem.GetGradientList()->GetGradient(mnLastPosGradient)->GetGradient(); + const XFillGradientItem aXFillGradientItem(aGradient); + + // #i122676# change FillStyle and Gradient in one call + XFillStyleItem aXFillStyleItem(drawing::FillStyle_GRADIENT); + setFillStyleAndGradient(&aXFillStyleItem, aXFillGradientItem); + mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); + mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); + + mpMTRAngle->SetValue(aGradient.GetAngle() / 10); + css::awt::GradientStyle eXGS = aGradient.GetGradientStyle(); + mpGradientStyle->SelectEntryPos(sal::static_int_cast< sal_Int32 >( eXGS )); } } - else - { - mpLbFillGradFrom->Disable(); - mpLbFillGradTo->Disable(); - mpMTRAngle->Disable(); - mpGradientStyle->Disable(); - } break; } case HATCH: @@ -475,6 +448,11 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) } } +IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillColorHdl, SvxColorListBox&, void) +{ + SelectFillAttrHdl_Impl(); +} + IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillAttrHdl, ListBox&, void) { SelectFillAttrHdl_Impl(); @@ -1176,28 +1154,15 @@ void AreaPropertyPanelBase::Update() mpLbFillAttr->Enable(); mpLbFillAttr->Clear(); mpLbFillAttr->Fill(aItem.GetGradientList()); - const SvxColorListItem aColorItem(*static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE))); - mpLbFillGradFrom->Fill(aColorItem.GetColorList()); - mpLbFillGradTo->Fill(aColorItem.GetColorList()); mpLbFillGradTo->SetNoSelection(); mpLbFillGradFrom->SetNoSelection(); - if(mpFillGradientItem) + if (mpFillGradientItem) { const OUString aString(mpFillGradientItem->GetName()); mpLbFillAttr->SelectEntry(aString); const XGradient aGradient = mpFillGradientItem->GetGradientValue(); mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - if(mpLbFillGradFrom->GetSelectEntryCount() == 0) - { - mpLbFillGradFrom->InsertEntry(aGradient.GetStartColor(), OUString()); - mpLbFillGradFrom->SelectEntry(aGradient.GetStartColor()); - } mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - if(mpLbFillGradTo->GetSelectEntryCount() == 0) - { - mpLbFillGradTo->InsertEntry(aGradient.GetEndColor(), OUString()); - mpLbFillGradTo->SelectEntry(aGradient.GetEndColor()); - } mpGradientStyle->SelectEntryPos(sal::static_int_cast< sal_Int32 >( aGradient.GetGradientStyle() )); if(mpGradientStyle->GetSelectEntryPos() == (sal_Int32)GradientStyle::Radial) mpMTRAngle->Disable(); diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx index a1ea3879f3dd..0766550e29cd 100644 --- a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx @@ -10,6 +10,7 @@ #include <ShadowPropertyPanel.hxx> #include <comphelper/string.hxx> #include <sfx2/sidebar/ControlFactory.hxx> +#include <svx/colorbox.hxx> #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> #include <sfx2/objsh.hxx> @@ -122,25 +123,18 @@ void ShadowPropertyPanel::dispose() void ShadowPropertyPanel::Initialize() { - SfxObjectShell* pSh = SfxObjectShell::Current(); - - const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh ? pSh->GetItem(SID_COLOR_TABLE) : nullptr); - if (pColorListItem) - { - mpLBShadowColor->Fill(pColorListItem->GetColorList()); - mpShowShadow->SetState( TRISTATE_FALSE ); - mpShowShadow->SetClickHdl( LINK(this, ShadowPropertyPanel, ClickShadowHdl ) ); - mpShadowTransMetric->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransMetricHdl) ); - mpLBShadowColor->SetSelectHdl( LINK( this, ShadowPropertyPanel, ModifyShadowColorHdl ) ); - mpShadowAngle->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); - mpShadowDistance->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); - mpShadowTransSlider->SetRange(Range(0,100)); - mpShadowTransSlider->SetUpdateMode(true); - mpShadowTransSlider->SetSlideHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransSliderHdl) ); - for(sal_uInt16 i = 0; i <= 20 ; i++) - mpShadowDistance->InsertValue(i*2,FUNIT_POINT); - InsertAngleValues(); - } + mpShowShadow->SetState( TRISTATE_FALSE ); + mpShowShadow->SetClickHdl( LINK(this, ShadowPropertyPanel, ClickShadowHdl ) ); + mpShadowTransMetric->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransMetricHdl) ); + mpLBShadowColor->SetSelectHdl( LINK( this, ShadowPropertyPanel, ModifyShadowColorHdl ) ); + mpShadowAngle->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); + mpShadowDistance->SetModifyHdl( LINK(this, ShadowPropertyPanel, ModifyShadowDistanceHdl) ); + mpShadowTransSlider->SetRange(Range(0,100)); + mpShadowTransSlider->SetUpdateMode(true); + mpShadowTransSlider->SetSlideHdl( LINK(this, ShadowPropertyPanel, ModifyShadowTransSliderHdl) ); + for(sal_uInt16 i = 0; i <= 20 ; i++) + mpShadowDistance->InsertValue(i*2,FUNIT_POINT); + InsertAngleValues(); } IMPL_LINK_NOARG(ShadowPropertyPanel, ClickShadowHdl, Button*, void) @@ -159,7 +153,7 @@ IMPL_LINK_NOARG(ShadowPropertyPanel, ClickShadowHdl, Button*, void) } } -IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl, ListBox&, void) +IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl, SvxColorListBox&, void) { XColorItem aItem(makeSdrShadowColorItem(mpLBShadowColor->GetSelectEntryColor())); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_SHADOW_COLOR, @@ -320,9 +314,6 @@ void ShadowPropertyPanel::NotifyItemUpdate( { mpLBShadowColor->SelectEntry(pColorItem->GetColorValue()); } - else - { - } } } break; diff --git a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx index 7e7288617d32..f3fd1c7e12eb 100644 --- a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx +++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx @@ -25,6 +25,7 @@ #include <sfx2/request.hxx> #include <svx/dlgctrl.hxx> +class SvxColorListBox; namespace svx { namespace sidebar { @@ -60,10 +61,10 @@ public: SfxBindings* pBindings); private: - VclPtr<CheckBox> mpShowShadow; - VclPtr<MetricBox> mpShadowDistance; - VclPtr<ColorLB> mpLBShadowColor; - VclPtr<MetricBox> mpShadowAngle; + VclPtr<CheckBox> mpShowShadow; + VclPtr<MetricBox> mpShadowDistance; + VclPtr<SvxColorListBox> mpLBShadowColor; + VclPtr<MetricBox> mpShadowAngle; VclPtr<FixedText> mpFTAngle; VclPtr<FixedText> mpFTDistance; VclPtr<FixedText> mpFTTransparency; @@ -84,7 +85,7 @@ private: void SetTransparencyValue(long); void UpdateControls(); DECL_LINK(ClickShadowHdl, Button*, void); - DECL_LINK(ModifyShadowColorHdl, ListBox&, void); + DECL_LINK(ModifyShadowColorHdl, SvxColorListBox&, void); DECL_LINK(ModifyShadowTransMetricHdl, Edit&, void); DECL_LINK(ModifyShadowDistanceHdl, Edit&, void); DECL_LINK(ModifyShadowTransSliderHdl, Slider*, void); diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx index 3ba048559620..7f1d5a140437 100644 --- a/svx/source/tbxctrls/PaletteManager.cxx +++ b/svx/source/tbxctrls/PaletteManager.cxx @@ -254,18 +254,21 @@ void PaletteManager::SetLastColor(const Color& rLastColor) mLastColor = rLastColor; } -void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName) +void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName, bool bFront) { auto itColor = std::find_if(maRecentColors.begin(), maRecentColors.end(), - [rRecentColor] (const color_and_name &a) { return a.first == rRecentColor; }); + [rRecentColor] (const NamedColor &a) { return a.first == rRecentColor; }); // if recent color to be added is already in list, remove it if( itColor != maRecentColors.end() ) maRecentColors.erase( itColor ); - maRecentColors.push_front(std::make_pair(rRecentColor, rName)); - if( maRecentColors.size() > mnMaxRecentColors ) + if (maRecentColors.size() == mnMaxRecentColors) maRecentColors.pop_back(); + if (bFront) + maRecentColors.push_front(std::make_pair(rRecentColor, rName)); + else + maRecentColors.push_back(std::make_pair(rRecentColor, rName)); css::uno::Sequence< sal_Int32 > aColorList(maRecentColors.size()); css::uno::Sequence< OUString > aColorNameList(maRecentColors.size()); for (size_t i = 0; i < maRecentColors.size(); ++i) @@ -285,7 +288,7 @@ void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater) mLastColor = mpBtnUpdater->GetCurrentColor(); } -void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const Color&)>& aColorSelectFunction) +void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction) { maColorSelectFunction = aColorSelectFunction; } @@ -302,12 +305,14 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand) if (mpBtnUpdater) mpBtnUpdater->Update( aColorDlg.GetColor() ); mLastColor = aColorDlg.GetColor(); - AddRecentColor(mLastColor, ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase())); - maColorSelectFunction(aCommandCopy, mLastColor); + OUString sColorName = ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase()); + NamedColor aNamedColor = std::make_pair(mLastColor, sColorName); + AddRecentColor(mLastColor, sColorName); + maColorSelectFunction(aCommandCopy, aNamedColor); } } -void PaletteManager::DispatchColorCommand(const OUString& aCommand, const Color& rColor) +void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor) { using namespace css::uno; using namespace css::frame; @@ -323,7 +328,7 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const Color& Sequence<PropertyValue> aArgs(1); aArgs[0].Name = aObj.GetURLPath(); - aArgs[0].Value = makeAny(sal_Int32(rColor.GetColor())); + aArgs[0].Value = makeAny(sal_Int32(rColor.first.GetColor())); URL aTargetURL; aTargetURL.Complete = aCommand; diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 5d3b359b144c..c5c0d568227c 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -51,6 +51,7 @@ #include <sfx2/childwin.hxx> #include <sfx2/viewfrm.hxx> #include <unotools/fontoptions.hxx> +#include <vcl/builderfactory.hxx> #include <vcl/mnemonic.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -85,6 +86,7 @@ #include <editeng/svxfont.hxx> #include <editeng/cmapitem.hxx> #include <svx/colorwindow.hxx> +#include <svx/colorbox.hxx> #include "svx/drawitem.hxx" #include <svx/tbcontrl.hxx> #include "svx/dlgutil.hxx" @@ -1245,13 +1247,13 @@ void SvxFontNameBox_Impl::Select() #endif -SvxColorWindow::SvxColorWindow( const OUString& rCommand, - PaletteManager& rPaletteManager, - BorderColorStatus& rBorderColorStatus, - sal_uInt16 nSlotId, - const Reference< XFrame >& rFrame, - vcl::Window* pParentWindow, - std::function<void(const OUString&, const Color&)> const & aFunction): +SvxColorWindow::SvxColorWindow(const OUString& rCommand, + PaletteManager& rPaletteManager, + BorderColorStatus& rBorderColorStatus, + sal_uInt16 nSlotId, + const Reference< XFrame >& rFrame, + vcl::Window* pParentWindow, + std::function<void(const OUString&, const NamedColor&)> const & aFunction): SfxPopupWindow( nSlotId, pParentWindow, "palette_popup_window", "svx/ui/colorwindow.ui", @@ -1264,6 +1266,7 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, { get(mpPaletteListBox, "palette_listbox"); get(mpButtonAutoColor, "auto_color_button"); + get(mpButtonNoneColor, "none_color_button"); get(mpButtonPicker, "color_picker_button"); get(mpColorSet, "colorset"); get(mpRecentColorSet, "recent_colorset"); @@ -1278,6 +1281,16 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, case SID_BACKGROUND_COLOR: case SID_ATTR_CHAR_BACK_COLOR: { + mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_NOFILL ) ); + break; + } + case SID_AUTHOR_COLOR: + { + mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_BY_AUTHOR ) ); + break; + } + case SID_BMPMASK_COLOR: + { mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) ); break; } @@ -1285,15 +1298,7 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, case SID_ATTR_CHAR_COLOR2: case SID_EXTRUSION_3D_COLOR: { - SfxPoolItem* pDummy; - - Reference< XDispatchProvider > aDisp( GetFrame()->getController(), UNO_QUERY ); - SfxQueryStatus aQueryStatus( aDisp, - SID_ATTR_AUTO_COLOR_INVALID, - OUString( ".uno:AutoColorInvalid" )); - SfxItemState eState = aQueryStatus.QueryState( pDummy ); - if( (SfxItemState::DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == theSlotId ) ) - mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) ); + mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) ); break; } default: @@ -1353,6 +1358,7 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, SelectPaletteHdl( *mpPaletteListBox ); mpButtonAutoColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) ); + mpButtonNoneColor->SetClickHdl( LINK( this, SvxColorWindow, AutoColorClickHdl ) ); mpButtonPicker->SetClickHdl( LINK( this, SvxColorWindow, OpenPickerClickHdl ) ); mpColorSet->SetSelectHdl( LINK( this, SvxColorWindow, SelectHdl ) ); @@ -1378,6 +1384,11 @@ SvxColorWindow::SvxColorWindow( const OUString& rCommand, } } +void SvxColorWindow::ShowNoneButton() +{ + mpButtonNoneColor->Show(); +} + SvxColorWindow::~SvxColorWindow() { disposeOnce(); @@ -1389,6 +1400,7 @@ void SvxColorWindow::dispose() mpRecentColorSet.clear(); mpPaletteListBox.clear(); mpButtonAutoColor.clear(); + mpButtonNoneColor.clear(); mpButtonPicker.clear(); mpAutomaticSeparator.clear(); SfxPopupWindow::dispose(); @@ -1399,11 +1411,29 @@ void SvxColorWindow::KeyInput( const KeyEvent& rKEvt ) mpColorSet->KeyInput(rKEvt); } +NamedColor SvxColorWindow::GetSelectEntryColor(ValueSet* pColorSet) +{ + Color aColor = pColorSet->GetItemColor(pColorSet->GetSelectItemId()); + OUString sColorName = pColorSet->GetItemText(pColorSet->GetSelectItemId()); + return std::make_pair(aColor, sColorName); +} + +NamedColor SvxColorWindow::GetSelectEntryColor() const +{ + if (!mpColorSet->IsNoSelection()) + return GetSelectEntryColor(mpColorSet); + if (!mpRecentColorSet->IsNoSelection()) + return GetSelectEntryColor(mpRecentColorSet); + if (mpButtonNoneColor->GetStyle() & WB_DEFBUTTON) + return GetNoneColor(); + return GetAutoColor(); +} + IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void) { VclPtr<SvxColorWindow> xThis(this); - Color aColor = pColorSet->GetItemColor( pColorSet->GetSelectItemId() ); + NamedColor aNamedColor = GetSelectEntryColor(pColorSet); /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls. This instance may be deleted in the meantime (i.e. when a dialog is opened while in Dispatch()), accessing members will crash in this case. */ @@ -1411,7 +1441,7 @@ IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void) if ( pColorSet != mpRecentColorSet ) { - mrPaletteManager.AddRecentColor(aColor, pColorSet->GetItemText(pColorSet->GetSelectItemId())); + mrPaletteManager.AddRecentColor(aNamedColor.first, aNamedColor.second); if ( !IsInPopupMode() ) mrPaletteManager.ReloadRecentColorSet( *mpRecentColorSet ); } @@ -1419,9 +1449,9 @@ IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void) if ( IsInPopupMode() ) EndPopupMode(); - maSelectedLink.Call(aColor); + maSelectedLink.Call(aNamedColor); - maColorSelectFunction(maCommand, aColor); + maColorSelectFunction(maCommand, aNamedColor); } IMPL_LINK_NOARG(SvxColorWindow, SelectPaletteHdl, ListBox&, void) @@ -1432,37 +1462,64 @@ IMPL_LINK_NOARG(SvxColorWindow, SelectPaletteHdl, ListBox&, void) mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount()); } -IMPL_LINK_NOARG(SvxColorWindow, AutoColorClickHdl, Button*, void) +NamedColor SvxColorWindow::GetNoneColor() const { - VclPtr<SvxColorWindow> xThis(this); + Color aColor; + OUString sColorName; + if (theSlotId == SID_AUTHOR_COLOR) + { + aColor = COL_NONE_COLOR; + sColorName = SVX_RESSTR(RID_SVXSTR_NONE); + } + + return std::make_pair(aColor, sColorName); +} +NamedColor SvxColorWindow::GetAutoColor() const +{ Color aColor; - switch ( theSlotId ) + OUString sColorName; + switch (theSlotId) { case SID_ATTR_CHAR_COLOR_BACKGROUND: case SID_BACKGROUND_COLOR: case SID_ATTR_CHAR_BACK_COLOR: - { aColor = COL_TRANSPARENT; + sColorName = SVX_RESSTR(RID_SVXSTR_NOFILL); + break; + case SID_AUTHOR_COLOR: + aColor = COL_TRANSPARENT; + sColorName = SVX_RESSTR(RID_SVXSTR_BY_AUTHOR); + break; + case SID_BMPMASK_COLOR: + aColor = COL_TRANSPARENT; + sColorName = SVX_RESSTR(RID_SVXSTR_TRANSPARENT); break; - } case SID_ATTR_CHAR_COLOR: case SID_ATTR_CHAR_COLOR2: case SID_EXTRUSION_3D_COLOR: - { aColor = COL_AUTO; + sColorName = SVX_RESSTR(RID_SVXSTR_AUTOMATIC); break; - } } + return std::make_pair(aColor, sColorName); +} + +IMPL_LINK(SvxColorWindow, AutoColorClickHdl, Button*, pButton, void) +{ + VclPtr<SvxColorWindow> xThis(this); + + NamedColor aNamedColor = pButton == mpButtonAutoColor ? GetAutoColor() : GetNoneColor(); + mpRecentColorSet->SetNoSelection(); if ( IsInPopupMode() ) EndPopupMode(); - maSelectedLink.Call(aColor); + maSelectedLink.Call(aNamedColor); - maColorSelectFunction(maCommand, aColor); + maColorSelectFunction(maCommand, aNamedColor); } IMPL_LINK_NOARG(SvxColorWindow, OpenPickerClickHdl, Button*, void) @@ -1479,6 +1536,23 @@ void SvxColorWindow::StartSelection() mpColorSet->StartSelection(); } +void SvxColorWindow::SetNoSelection() +{ + mpColorSet->SetNoSelection(); + mpRecentColorSet->SetNoSelection(); + mpButtonAutoColor->set_property("has-default", "false"); + mpButtonNoneColor->set_property("has-default", "false"); +} + +bool SvxColorWindow::IsNoSelection() const +{ + if (!mpColorSet->IsNoSelection()) + return false; + if (!mpRecentColorSet->IsNoSelection()) + return false; + return !mpButtonAutoColor->IsVisible() && !mpButtonNoneColor->IsVisible(); +} + void SvxColorWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent ) { if ( rEvent.IsEnabled && rEvent.FeatureURL.Complete == ".uno:ColorTableState" @@ -1489,34 +1563,76 @@ void SvxColorWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent } else { - mpColorSet->SetNoSelection(); - Color aColor( COL_TRANSPARENT ); + Color aColor(COL_TRANSPARENT); - if ( mrBorderColorStatus.statusChanged( rEvent ) ) + if (mrBorderColorStatus.statusChanged(rEvent)) { aColor = mrBorderColorStatus.GetColor(); } - else if ( rEvent.IsEnabled ) + else if (rEvent.IsEnabled) { sal_Int32 nValue; - if ( rEvent.State >>= nValue ) + if (rEvent.State >>= nValue) aColor = nValue; } - if ( aColor == COL_TRANSPARENT ) - return; + SelectEntry(aColor); + } +} - for ( size_t i = 1; i <= mpColorSet->GetItemCount(); ++i ) +bool SvxColorWindow::SelectValueSetEntry(SvxColorValueSet* pColorSet, const Color& rColor) +{ + for (size_t i = 1; i <= pColorSet->GetItemCount(); ++i) + { + if (rColor == pColorSet->GetItemColor(i)) { - if ( aColor == mpColorSet->GetItemColor(i) ) - { - mpColorSet->SelectItem(i); - break; - } + pColorSet->SelectItem(i); + return true; } } + return false; } +void SvxColorWindow::SelectEntry(const NamedColor& rNamedColor) +{ + SetNoSelection(); + + const Color &rColor = rNamedColor.first; + + if (rColor == COL_TRANSPARENT || rColor == COL_AUTO) + { + mpButtonAutoColor->set_property("has-default", "true"); + return; + } + + if (mpButtonNoneColor->IsVisible() && rColor == COL_NONE_COLOR) + { + mpButtonNoneColor->set_property("has-default", "true"); + return; + } + + // try current palette + bool bFoundColor = SelectValueSetEntry(mpColorSet, rColor); + // try recently used + if (!bFoundColor) + bFoundColor = SelectValueSetEntry(mpRecentColorSet, rColor); + // if its not there, add it there now to the end of the recently used + // so its available somewhere handy, but not without trashing the + // whole recently used + if (!bFoundColor) + { + const OUString& rColorName = rNamedColor.second; + mrPaletteManager.AddRecentColor(rColor, rColorName, false); + mrPaletteManager.ReloadRecentColorSet(*mpRecentColorSet); + SelectValueSetEntry(mpRecentColorSet, rColor); + } +} + +void SvxColorWindow::SelectEntry(const Color& rColor) +{ + OUString sColorName = ("#" + rColor.AsRGBHexString().toAsciiUpperCase()); + SvxColorWindow::SelectEntry(std::make_pair(rColor, sColorName)); +} BorderColorStatus::BorderColorStatus() : maColor( COL_TRANSPARENT ), @@ -2717,19 +2833,18 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow() &GetToolBox(), m_aColorSelectFunction); - pColorWin->StartPopupMode( &GetToolBox(), - FloatWinPopupFlags::AllowTearOff|FloatWinPopupFlags::NoAppFocusClose ); + pColorWin->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus); pColorWin->StartSelection(); - SetPopupWindow( pColorWin ); + SetPopupWindow(pColorWin); if ( m_bSplitButton ) pColorWin->SetSelectedHdl( LINK( this, SvxColorToolBoxControl, SelectedHdl ) ); return pColorWin; } -IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const Color&, rColor, void) +IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const NamedColor&, rColor, void) { - m_xBtnUpdater->Update( rColor ); - m_aPaletteManager.SetLastColor( rColor ); + m_xBtnUpdater->Update(rColor.first); + m_aPaletteManager.SetLastColor(rColor.first); } void SvxColorToolBoxControl::statusChanged( const css::frame::FeatureStateEvent& rEvent ) @@ -3067,4 +3182,204 @@ void SvxCurrencyToolBoxControl::GetCurrencySymbols( std::vector<OUString>& rList } } +SvxListBoxColorWrapper::SvxListBoxColorWrapper(SvxColorListBox* pControl) + : mxControl(pControl) +{ +} + +void SvxListBoxColorWrapper::operator()(const OUString& /*rCommand*/, const NamedColor& rColor) +{ + mxControl->Selected(rColor); +} + +void SvxListBoxColorWrapper::dispose() +{ + mxControl.clear(); +} + +SvxColorListBox::SvxColorListBox(vcl::Window* pParent, WinBits nStyle) + : MenuButton(pParent, nStyle) + , m_aColorWrapper(this) + , m_aAutoDisplayColor(Application::GetSettings().GetStyleSettings().GetDialogColor()) + , m_nSlotId(0) + , m_bShowNoneButton(false) +{ + LockWidthRequest(); + m_aPaletteManager.SetColorSelectFunction(m_aColorWrapper); + SetActivateHdl(LINK(this, SvxColorListBox, MenuActivateHdl)); + SetNoSelection(); +} + +void SvxColorListBox::SetSlotId(sal_uInt16 nSlotId, bool bShowNoneButton) +{ + m_nSlotId = nSlotId; + m_bShowNoneButton = bShowNoneButton; + m_xColorWindow.disposeAndClear(); + createColorWindow(); +} + +//to avoid the box resizing every time the color is changed to +//the optimal size of the individual color, get the longest +//standard color and stick with that as the size for all +void SvxColorListBox::LockWidthRequest() +{ + if (get_width_request() != -1) + return; + NamedColor aLongestColor; + long nMaxStandardColorTextWidth = 0; + XColorListRef const xColorTable = XColorList::CreateStdColorList(); + for (sal_Int32 i = 0; i != xColorTable->Count(); ++i) + { + XColorEntry& rEntry = *xColorTable->GetColor(i); + long nColorTextWidth = GetTextWidth(rEntry.GetName()); + if (nColorTextWidth > nMaxStandardColorTextWidth) + { + nMaxStandardColorTextWidth = nColorTextWidth; + aLongestColor.second = rEntry.GetName(); + } + } + ShowPreview(aLongestColor); + set_width_request(get_preferred_size().Width()); +} + +void SvxColorListBox::ShowPreview(const NamedColor &rColor) +{ + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + Size aImageSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize()); + + VclPtr<VirtualDevice> xDevice = VclPtr<VirtualDevice>::Create(); + xDevice->SetOutputSize(aImageSize); + const Rectangle aRect(Point(0, 0), aImageSize); + if (m_bShowNoneButton && rColor.first == COL_NONE_COLOR) + xDevice->SetFillColor(COL_BLACK); + else if (rColor.first == COL_AUTO) + xDevice->SetFillColor(m_aAutoDisplayColor); + else + xDevice->SetFillColor(rColor.first); + xDevice->SetLineColor(rStyleSettings.GetDisableColor()); + xDevice->DrawRect(aRect); + + Bitmap aBitmap(xDevice->GetBitmap(Point(0, 0), xDevice->GetOutputSize())); + SetImageAlign(ImageAlign::Left); + SetModeImage(Image(aBitmap)); + SetText(rColor.second); +} + +IMPL_LINK(SvxColorListBox, MenuActivateHdl, MenuButton *, pBtn, void) +{ + (void)pBtn; + if (!m_xColorWindow || m_xColorWindow->isDisposed()) + createColorWindow(); +} + +void SvxColorListBox::createColorWindow() +{ + const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); + const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr; + css::uno::Reference<css::frame::XFrame> xFrame(pFrame ? pFrame->GetFrameInterface() : uno::Reference<css::frame::XFrame>()); + + m_xColorWindow = VclPtr<SvxColorWindow>::Create( + OUString() /*m_aCommandURL*/, + m_aPaletteManager, + m_aBorderColorStatus, + m_nSlotId, + xFrame, + this, + m_aColorWrapper); + if (m_bShowNoneButton) + m_xColorWindow->ShowNoneButton(); + m_xColorWindow->SelectEntry(m_aSelectedColor); + SetPopover(m_xColorWindow); +} + +void SvxColorListBox::Selected(const NamedColor& rColor) +{ + ShowPreview(rColor); + m_aPaletteManager.SetLastColor(rColor.first); + m_aSelectedColor = rColor; + if (m_aSelectedLink.IsSet()) + m_aSelectedLink.Call(*this); +} + +VCL_BUILDER_FACTORY(SvxColorListBox) + +SvxColorListBox::~SvxColorListBox() +{ + disposeOnce(); +} + +void SvxColorListBox::dispose() +{ + m_xColorWindow.disposeAndClear(); + m_aColorWrapper.dispose(); + MenuButton::dispose(); +} + +VclPtr<SvxColorWindow> SvxColorListBox::getColorWindow() const +{ + if (!m_xColorWindow || m_xColorWindow->isDisposed()) + const_cast<SvxColorListBox*>(this)->createColorWindow(); + return m_xColorWindow; +} + +void SvxColorListBox::SelectEntry(const NamedColor& rColor) +{ + if (rColor.second.trim().isEmpty()) + { + SelectEntry(rColor.first); + return; + } + VclPtr<SvxColorWindow> xColorWindow = getColorWindow(); + xColorWindow->SelectEntry(rColor); + m_aSelectedColor = xColorWindow->GetSelectEntryColor(); + ShowPreview(m_aSelectedColor); +} + +void SvxColorListBox::SelectEntry(const Color& rColor) +{ + VclPtr<SvxColorWindow> xColorWindow = getColorWindow(); + xColorWindow->SelectEntry(rColor); + m_aSelectedColor = xColorWindow->GetSelectEntryColor(); + ShowPreview(m_aSelectedColor); +} + +Color SvxColorListBox::GetSelectEntryColor() const +{ + return m_aSelectedColor.first; +} + +NamedColor SvxColorListBox::GetSelectEntry() const +{ + return m_aSelectedColor; +} + +SvxColorListBoxWrapper::SvxColorListBoxWrapper(SvxColorListBox& rListBox) + : sfx::SingleControlWrapper<SvxColorListBox, Color>(rListBox) +{ +} + +SvxColorListBoxWrapper::~SvxColorListBoxWrapper() +{ +} + +bool SvxColorListBoxWrapper::IsControlDontKnow() const +{ + return GetControl().IsNoSelection(); +} + +void SvxColorListBoxWrapper::SetControlDontKnow( bool bSet ) +{ + if( bSet ) GetControl().SetNoSelection(); +} + +Color SvxColorListBoxWrapper::GetControlValue() const +{ + return GetControl().GetSelectEntryColor(); +} + +void SvxColorListBoxWrapper::SetControlValue( Color aColor ) +{ + GetControl().SelectEntry( aColor ); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src index 27aed7b4d400..194d6a8d5997 100644 --- a/svx/source/tbxctrls/tbcontrl.src +++ b/svx/source/tbxctrls/tbcontrl.src @@ -41,11 +41,16 @@ ImageList RID_SVXIL_FRAME IdCount = { 12 ; }; }; -String RID_SVXSTR_TRANSPARENT +String RID_SVXSTR_NOFILL { Text [ en-US ] = "No Fill" ; }; +String RID_SVXSTR_TRANSPARENT +{ + Text [ en-US ] = "Transparent"; +}; + String RID_SVXSTR_FILLPATTERN { Text [ en-US ] = "Pattern" ; @@ -135,6 +140,11 @@ String RID_SVXSTR_AUTOMATIC Text [ en-US ] = "Automatic"; }; +String RID_SVXSTR_BY_AUTHOR +{ + Text [ en-US ] = "By author"; +}; + String RID_SVXSTR_PAGES { Text [ en-US ] = "Pages"; diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui index 9482562f83a6..444797ff9714 100644 --- a/svx/uiconfig/ui/colorwindow.ui +++ b/svx/uiconfig/ui/colorwindow.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.0 --> <interface> <requires lib="gtk+" version="3.10"/> <requires lib="LibreOffice" version="1.0"/> @@ -13,9 +13,14 @@ <property name="can_focus">False</property> <property name="margin_right">6</property> <property name="xalign">0</property> - <property name="pixbuf">cmd/sc_colorsettings.png</property> + <property name="pixbuf">cmd/sc_square_unfilled.png</property> <property name="icon_size">1</property> </object> + <object class="GtkImage" id="none_icon"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">cmd/sc_square_unfilled.png</property> + </object> <object class="GtkWindow" id="palette_popup_window"> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -25,7 +30,6 @@ <property name="destroy_with_parent">True</property> <property name="type_hint">popup-menu</property> <property name="skip_pager_hint">True</property> - <property name="decorated">False</property> <property name="deletable">False</property> <child> <object class="GtkBox" id="box1"> @@ -33,13 +37,41 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="GtkButton" id="auto_color_button"> + <object class="GtkBox"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="image">auto_icon</property> - <property name="relief">none</property> - <property name="xalign">0</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkButton" id="auto_color_button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">auto_icon</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="none_color_button"> + <property name="label" translatable="yes">None</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">none_icon</property> + <property name="relief">none</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> diff --git a/svx/uiconfig/ui/docking3deffects.ui b/svx/uiconfig/ui/docking3deffects.ui index e3856ffbd3ca..b468ce2a076d 100644 --- a/svx/uiconfig/ui/docking3deffects.ui +++ b/svx/uiconfig/ui/docking3deffects.ui @@ -1089,7 +1089,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="ambientcolor"> + <object class="svxcorelo-SvxColorListBox" id="ambientcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -1250,7 +1250,7 @@ <property name="can_focus">False</property> <property name="orientation">vertical</property> <child> - <object class="svxlo-ColorLB" id="lightcolor1"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">start</property> @@ -1263,7 +1263,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor2"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor2"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1276,7 +1276,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor3"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor3"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1289,7 +1289,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor4"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor4"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1302,7 +1302,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor5"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor5"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1315,7 +1315,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor6"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor6"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1328,7 +1328,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor7"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor7"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1341,7 +1341,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="lightcolor8"> + <object class="svxcorelo-SvxColorListBox" id="lightcolor8"> <property name="can_focus">False</property> <property name="no_show_all">True</property> <property name="valign">start</property> @@ -1721,7 +1721,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="objcolor"> + <object class="svxcorelo-SvxColorListBox" id="objcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -1733,7 +1733,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="illumcolor"> + <object class="svxcorelo-SvxColorListBox" id="illumcolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> @@ -1856,7 +1856,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="speccolor"> + <object class="svxcorelo-SvxColorListBox" id="speccolor"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="valign">center</property> diff --git a/svx/uiconfig/ui/dockingcolorreplace.ui b/svx/uiconfig/ui/dockingcolorreplace.ui index 778c740f38bc..c74b4618e385 100644 --- a/svx/uiconfig/ui/dockingcolorreplace.ui +++ b/svx/uiconfig/ui/dockingcolorreplace.ui @@ -241,7 +241,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color1"> + <object class="svxcorelo-SvxColorListBox" id="color1"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -257,7 +257,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color2"> + <object class="svxcorelo-SvxColorListBox" id="color2"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -273,7 +273,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color3"> + <object class="svxcorelo-SvxColorListBox" id="color3"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -289,7 +289,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color4"> + <object class="svxcorelo-SvxColorListBox" id="color4"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> @@ -305,7 +305,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color5"> + <object class="svxcorelo-SvxColorListBox" id="color5"> <property name="visible">True</property> <property name="can_focus">False</property> </object> diff --git a/svx/uiconfig/ui/dockingfontwork.ui b/svx/uiconfig/ui/dockingfontwork.ui index 0c729be1b10e..32ab55392784 100644 --- a/svx/uiconfig/ui/dockingfontwork.ui +++ b/svx/uiconfig/ui/dockingfontwork.ui @@ -437,7 +437,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="color"> + <object class="svxcorelo-SvxColorListBox" id="color"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes">Shadow Color</property> diff --git a/svx/uiconfig/ui/sidebararea.ui b/svx/uiconfig/ui/sidebararea.ui index e85fe45dfa20..79bc5b65a520 100644 --- a/svx/uiconfig/ui/sidebararea.ui +++ b/svx/uiconfig/ui/sidebararea.ui @@ -100,7 +100,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="fillgrad1"> + <object class="svxcorelo-SvxColorListBox" id="fillgrad1"> <property name="can_focus">False</property> <property name="has_tooltip">True</property> <property name="tooltip_text" translatable="yes">Fill gradient from.</property> @@ -144,7 +144,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="fillgrad2"> + <object class="svxcorelo-SvxColorListBox" id="fillgrad2"> <property name="can_focus">False</property> <property name="has_tooltip">True</property> <property name="tooltip_text" translatable="yes">Fill gradient to.</property> diff --git a/svx/uiconfig/ui/sidebarshadow.ui b/svx/uiconfig/ui/sidebarshadow.ui index 0b2e8cf6d48b..31531ab823b1 100644 --- a/svx/uiconfig/ui/sidebarshadow.ui +++ b/svx/uiconfig/ui/sidebarshadow.ui @@ -184,7 +184,7 @@ </packing> </child> <child> - <object class="svxlo-ColorLB" id="LB_SHADOW_COLOR"> + <object class="svxcorelo-SvxColorListBox" id="LB_SHADOW_COLOR"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">end</property> |