summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2016-11-05 13:28:17 -0500
committerNorbert Thiebaud <nthiebaud@gmail.com>2016-11-05 13:42:40 -0500
commitdb380aab1063e8a5e40111c40ee9f7921aa82601 (patch)
treef5057dfb205a7d7409251742888dfeaf4bfbee61 /svx
parentee2144aafc5b4be14630f723be9a2bb674671412 (diff)
Reverts a commit series that cripple windows ci.
Revert "SvxShadowTabPage::Construct was removed" f9a2c1c12ecad833c63b894c89d6008907477eb5. Revert "replace OColorPopup with SvxColorWindow" f300754bb1c6a347c92bb9548be7a65237176542. Revert "drop AutoColorInvalid/SID_ATTR_AUTO_COLOR_INVALID" 347c2c334589b18cc62af292674bb3df1dd54b71. Revert "replace last ColorLB use with a listbox of colors" 604b35bf55351751a396e34dcca3f85e75860fd5. Revert "simplify, its just a vector of colors" 351a97ce6bda3075677b59fa1387ba3d1ab17d7a. Revert "replace user draw with an Image of the color" df738e0f8ceedb4bad756960be14d9c41adc165d. Revert "strip down to the used pieces" commit 08d6cd788f2584ce10ab8fa10665245e953c59d9. Revert "move now combined ColorLB to location of last user" a19b18ad7c9eb0197c10e6d7e451ec4542e4bc9e. Revert "fold ColorListBox and ColorLB together" a989a0b1f2b425f05b58d0e44ce2de31c842ed65. Revert "move ColorListBox beside sole thing that uses it" 760a198e697f3070a5e0e029e4eff7be220eb9cd. Revert "extensions leaks out details of Color Selector, patch it up" 8bea644d6117a49405e6426dc97214220fc869d1. Revert "inherit FillAttrLB from ListBox not ColorListBox" d2ce812f1d3a7a2aad89ca0bd11948b63d2db7b0. Revert "unify color selectors" 43bc3031483d172eccd72c3804e2d4fc2ef37de4.
Diffstat (limited to 'svx')
-rw-r--r--svx/sdi/svx.sdi19
-rw-r--r--svx/source/dialog/_bmpmask.cxx56
-rw-r--r--svx/source/dialog/bmpmask.hrc2
-rw-r--r--svx/source/dialog/bmpmask.src5
-rw-r--r--svx/source/dialog/dlgctrl.cxx48
-rw-r--r--svx/source/dialog/fontwork.cxx13
-rw-r--r--svx/source/engine3d/float3d.cxx191
-rw-r--r--svx/source/engine3d/float3d.src15
-rw-r--r--svx/source/sidebar/area/AreaPropertyPanelBase.cxx97
-rw-r--r--svx/source/sidebar/shadow/ShadowPropertyPanel.cxx37
-rw-r--r--svx/source/sidebar/shadow/ShadowPropertyPanel.hxx11
-rw-r--r--svx/source/tbxctrls/PaletteManager.cxx23
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx411
-rw-r--r--svx/source/tbxctrls/tbcontrl.src12
-rw-r--r--svx/uiconfig/ui/colorwindow.ui50
-rw-r--r--svx/uiconfig/ui/docking3deffects.ui24
-rw-r--r--svx/uiconfig/ui/dockingcolorreplace.ui10
-rw-r--r--svx/uiconfig/ui/dockingfontwork.ui2
-rw-r--r--svx/uiconfig/ui/sidebararea.ui4
-rw-r--r--svx/uiconfig/ui/sidebarshadow.ui2
20 files changed, 424 insertions, 608 deletions
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 2e8b2f6bd9cc..0693af63dc7c 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -3596,6 +3596,25 @@ 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 5eec4f8f7e8a..77ca04fc3a01 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -25,7 +25,6 @@
#include <sfx2/dispatch.hxx>
#include <svtools/colrdlg.hxx>
-#include <svx/colorbox.hxx>
#include <svx/dialmgr.hxx>
#include <svx/bmpmask.hxx>
#include <svx/dialogs.hrc>
@@ -35,6 +34,7 @@
#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 )
{
- SvxColorListBox* pLb = static_cast<SvxColorListBox*>(&rControl);
+ ColorLB* pLb = static_cast<ColorLB*>(&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,7 +373,6 @@ 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);
@@ -381,7 +380,6 @@ 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);
@@ -389,7 +387,6 @@ 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);
@@ -397,15 +394,14 @@ 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");
- 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));
+ //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_pTbxPipette->SetSelectHdl( LINK( pData, MaskData, PipetteHdl ) );
m_pBtnExec->SetClickHdl( LINK( pData, MaskData, ExecHdl ) );
@@ -521,6 +517,40 @@ 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;
@@ -708,7 +738,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 ] == COL_TRANSPARENT);
+ pTrans[ i ] = ( pDstCols[ i ] == TRANSP_COL );
}
// Investigate actions and if necessary replace colors
@@ -1024,7 +1054,7 @@ Graphic SvxBmpMask::Mask( const Graphic& rGraphic )
for( sal_uInt16 i = 0; i < nCount; i++ )
{
// Do we have a transparent color?
- if (pDstCols[i] == COL_TRANSPARENT)
+ if( pDstCols[i] == TRANSP_COL )
{
BitmapEx aBmpEx( ImpMaskTransparent( aGraphic.GetBitmapEx(),
pSrcCols[ i ], pTols[ i ] ) );
diff --git a/svx/source/dialog/bmpmask.hrc b/svx/source/dialog/bmpmask.hrc
index bf054482824d..1e446c418145 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 16bf943d9f69..d154d7ed0db9 100644
--- a/svx/source/dialog/bmpmask.src
+++ b/svx/source/dialog/bmpmask.src
@@ -22,6 +22,11 @@
#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 d8f312bda281..740033df05e0 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -1103,6 +1103,52 @@ 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)
@@ -1257,7 +1303,7 @@ namespace
} // end of anonymous namespace
FillAttrLB::FillAttrLB(vcl::Window* pParent, WinBits aWB)
- : ListBox(pParent, aWB)
+: ColorListBox(pParent, aWB)
{
}
diff --git a/svx/source/dialog/fontwork.cxx b/svx/source/dialog/fontwork.cxx
index b86ce464a860..166277cc42b4 100644
--- a/svx/source/dialog/fontwork.cxx
+++ b/svx/source/dialog/fontwork.cxx
@@ -20,7 +20,6 @@
#include <sfx2/module.hxx>
#include <sfx2/dispatch.hxx>
-#include <svx/colorbox.hxx>
#include <svx/svdobj.hxx>
#include <svx/svdopath.hxx>
#include <svx/svdview.hxx>
@@ -792,13 +791,23 @@ IMPL_LINK_NOARG(SvxFontWorkDialog, InputTimoutHdl_Impl, Idle *, void)
{ &aDistItem, &aStartItem, &aShadowXItem, &aShadowYItem });
}
-IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl, SvxColorListBox&, void)
+IMPL_LINK_NOARG(SvxFontWorkDialog, ColorSelectHdl_Impl, ListBox&, 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 80d065df7a22..b5ed0de3e87a 100644
--- a/svx/source/engine3d/float3d.cxx
+++ b/svx/source/engine3d/float3d.cxx
@@ -24,7 +24,6 @@
#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>
@@ -274,20 +273,19 @@ 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( 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_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_pLbShademode->SetSelectHdl( aLink2 );
Link<Edit&,void> aLink3 = LINK( this, Svx3DWin, ModifyHdl );
@@ -943,7 +941,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue();
- SvxColorListBox* pLb = m_pLbLight1;
+ ColorLB* pLb = m_pLbLight1;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -952,7 +950,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbLight1->IsNoSelection())
+ if( m_pLbLight1->GetSelectEntryCount() != 0 )
{
m_pLbLight1->SetNoSelection();
bUpdate = true;
@@ -992,7 +990,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue();
- SvxColorListBox* pLb = m_pLbLight2;
+ ColorLB* pLb = m_pLbLight2;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1001,7 +999,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbLight2->IsNoSelection())
+ if( m_pLbLight2->GetSelectEntryCount() != 0 )
{
m_pLbLight2->SetNoSelection();
bUpdate = true;
@@ -1041,7 +1039,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue();
- SvxColorListBox* pLb = m_pLbLight3;
+ ColorLB* pLb = m_pLbLight3;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1050,7 +1048,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbLight3->IsNoSelection())
+ if( m_pLbLight3->GetSelectEntryCount() != 0 )
{
m_pLbLight3->SetNoSelection();
bUpdate = true;
@@ -1090,7 +1088,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue();
- SvxColorListBox* pLb = m_pLbLight4;
+ ColorLB* pLb = m_pLbLight4;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1099,7 +1097,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbLight4->IsNoSelection())
+ if( m_pLbLight4->GetSelectEntryCount() != 0 )
{
m_pLbLight4->SetNoSelection();
bUpdate = true;
@@ -1139,7 +1137,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue();
- SvxColorListBox* pLb = m_pLbLight5;
+ ColorLB* pLb = m_pLbLight5;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1148,7 +1146,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbLight5->IsNoSelection())
+ if( m_pLbLight5->GetSelectEntryCount() != 0 )
{
m_pLbLight5->SetNoSelection();
bUpdate = true;
@@ -1188,7 +1186,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue();
- SvxColorListBox* pLb = m_pLbLight6;
+ ColorLB* pLb = m_pLbLight6;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1197,7 +1195,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbLight6->IsNoSelection())
+ if( m_pLbLight6->GetSelectEntryCount() != 0 )
{
m_pLbLight6->SetNoSelection();
bUpdate = true;
@@ -1237,7 +1235,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue();
- SvxColorListBox* pLb = m_pLbLight7;
+ ColorLB* pLb = m_pLbLight7;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1246,7 +1244,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbLight7->IsNoSelection())
+ if( m_pLbLight7->GetSelectEntryCount() != 0 )
{
m_pLbLight7->SetNoSelection();
bUpdate = true;
@@ -1286,7 +1284,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue();
- SvxColorListBox* pLb = m_pLbLight8;
+ ColorLB* pLb = m_pLbLight8;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1295,7 +1293,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbLight8->IsNoSelection())
+ if( m_pLbLight8->GetSelectEntryCount() != 0 )
{
m_pLbLight8->SetNoSelection();
bUpdate = true;
@@ -1335,7 +1333,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue();
- SvxColorListBox* pLb = m_pLbAmbientlight;
+ ColorLB* pLb = m_pLbAmbientlight;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1344,7 +1342,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbAmbientlight->IsNoSelection())
+ if( m_pLbAmbientlight->GetSelectEntryCount() != 0 )
{
m_pLbAmbientlight->SetNoSelection();
bUpdate = true;
@@ -1495,7 +1493,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const XFillColorItem&>(rAttrs.Get(XATTR_FILLCOLOR)).GetColorValue();
- SvxColorListBox* pLb = m_pLbMatColor;
+ ColorLB* pLb = m_pLbMatColor;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1504,7 +1502,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbMatColor->IsNoSelection())
+ if( m_pLbMatColor->GetSelectEntryCount() != 0 )
{
m_pLbMatColor->SetNoSelection();
bUpdate = true;
@@ -1516,7 +1514,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DOBJ_MAT_EMISSION)).GetValue();
- SvxColorListBox* pLb = m_pLbMatEmission;
+ ColorLB* pLb = m_pLbMatEmission;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1525,7 +1523,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbMatEmission->IsNoSelection())
+ if( m_pLbMatEmission->GetSelectEntryCount() != 0 )
{
m_pLbMatEmission->SetNoSelection();
bUpdate = true;
@@ -1537,7 +1535,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
if( eState != SfxItemState::DONTCARE )
{
aColor = static_cast<const SvxColorItem&>(rAttrs.Get(SDRATTR_3DOBJ_MAT_SPECULAR)).GetValue();
- SvxColorListBox* pLb = m_pLbMatSpecular;
+ ColorLB* pLb = m_pLbMatSpecular;
if( aColor != pLb->GetSelectEntryColor() )
{
LBSelectColor( pLb, aColor );
@@ -1546,7 +1544,7 @@ void Svx3DWin::Update( SfxItemSet& rAttrs )
}
else
{
- if (!m_pLbMatSpecular->IsNoSelection())
+ if( m_pLbMatSpecular->GetSelectEntryCount() != 0 )
{
m_pLbMatSpecular->SetNoSelection();
bUpdate = true;
@@ -1854,7 +1852,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
const SfxItemSet aLightItemSet(m_pCtlLightPreview->GetSvx3DLightControl().Get3DAttributes());
// Light 1 color
- if (!m_pLbLight1->IsNoSelection())
+ if( m_pLbLight1->GetSelectEntryCount() )
{
aColor = m_pLbLight1->GetSelectEntryColor();
rAttrs.Put(makeSvx3DLightcolor1Item(aColor));
@@ -1879,7 +1877,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Light 2 color
- if (!m_pLbLight2->IsNoSelection())
+ if( m_pLbLight2->GetSelectEntryCount() )
{
aColor = m_pLbLight2->GetSelectEntryColor();
rAttrs.Put(makeSvx3DLightcolor2Item(aColor));
@@ -1903,7 +1901,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_2);
// Light 3 color
- if (!m_pLbLight3->IsNoSelection())
+ if( m_pLbLight3->GetSelectEntryCount() )
{
aColor = m_pLbLight3->GetSelectEntryColor();
rAttrs.Put(makeSvx3DLightcolor3Item(aColor));
@@ -1927,7 +1925,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_3);
// Light 4 color
- if (!m_pLbLight4->IsNoSelection())
+ if( m_pLbLight4->GetSelectEntryCount() )
{
aColor = m_pLbLight4->GetSelectEntryColor();
rAttrs.Put(makeSvx3DLightcolor4Item(aColor));
@@ -1951,7 +1949,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_4);
// Light 5 color
- if (!m_pLbLight5->IsNoSelection())
+ if( m_pLbLight5->GetSelectEntryCount() )
{
aColor = m_pLbLight5->GetSelectEntryColor();
rAttrs.Put(makeSvx3DLightcolor5Item(aColor));
@@ -1975,7 +1973,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_5);
// Light 6 color
- if (!m_pLbLight6->IsNoSelection())
+ if( m_pLbLight6->GetSelectEntryCount() )
{
aColor = m_pLbLight6->GetSelectEntryColor();
rAttrs.Put(makeSvx3DLightcolor6Item(aColor));
@@ -1999,7 +1997,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_6);
// Light 7 color
- if (!m_pLbLight7->IsNoSelection())
+ if( m_pLbLight7->GetSelectEntryCount() )
{
aColor = m_pLbLight7->GetSelectEntryColor();
rAttrs.Put(makeSvx3DLightcolor7Item(aColor));
@@ -2023,7 +2021,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_7);
// Light 8 color
- if (!m_pLbLight8->IsNoSelection())
+ if( m_pLbLight8->GetSelectEntryCount() )
{
aColor = m_pLbLight8->GetSelectEntryColor();
rAttrs.Put(makeSvx3DLightcolor8Item(aColor));
@@ -2047,7 +2045,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
rAttrs.InvalidateItem(SDRATTR_3DSCENE_LIGHTON_8);
// Ambient light
- if (!m_pLbAmbientlight->IsNoSelection())
+ if( m_pLbAmbientlight->GetSelectEntryCount() )
{
aColor = m_pLbAmbientlight->GetSelectEntryColor();
rAttrs.Put(makeSvx3DAmbientcolorItem(aColor));
@@ -2123,7 +2121,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
// Material
// Object color
- if (!m_pLbMatColor->IsNoSelection())
+ if( m_pLbMatColor->GetSelectEntryCount() )
{
aColor = m_pLbMatColor->GetSelectEntryColor();
rAttrs.Put( XFillColorItem( "", aColor) );
@@ -2134,7 +2132,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
}
// luminous color
- if (!m_pLbMatEmission->IsNoSelection())
+ if( m_pLbMatEmission->GetSelectEntryCount() )
{
aColor = m_pLbMatEmission->GetSelectEntryColor();
rAttrs.Put(makeSvx3DMaterialEmissionItem(aColor));
@@ -2143,7 +2141,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs )
rAttrs.InvalidateItem(SDRATTR_3DOBJ_MAT_EMISSION);
// Specular
- if (!m_pLbMatSpecular->IsNoSelection())
+ if( m_pLbMatSpecular->GetSelectEntryCount() )
{
aColor = m_pLbMatSpecular->GetSelectEntryColor();
rAttrs.Put(makeSvx3DMaterialSpecularItem(aColor));
@@ -2304,7 +2302,7 @@ IMPL_LINK( Svx3DWin, ClickViewTypeHdl, Button*, pBtn, void )
{
m_pFLLight->Show();
- SvxColorListBox* pLb = GetLbByButton();
+ ColorLB* pLb = GetLbByButton();
if( pLb )
pLb->Show();
@@ -2390,7 +2388,7 @@ IMPL_LINK( Svx3DWin, ClickHdl, Button *, pButton, void )
pBtn == m_pBtnLight8 )
{
// Lighting
- SvxColorListBox* pLb = GetLbByButton( pBtn );
+ ColorLB* pLb = GetLbByButton( pBtn );
pLb->Show();
if( pBtn->IsChecked() )
@@ -2515,7 +2513,7 @@ IMPL_LINK( Svx3DWin, ClickHdl, Button *, pButton, void )
IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void)
{
SvColorDialog aColorDlg( this );
- SvxColorListBox* pLb;
+ ColorLB* pLb;
if( pBtn == m_pBtnLightColor )
pLb = GetLbByButton();
@@ -2534,11 +2532,12 @@ IMPL_LINK( Svx3DWin, ClickColorHdl, Button *, pBtn, void)
if( aColorDlg.Execute() == RET_OK )
{
aColor = aColorDlg.GetColor();
- LBSelectColor(pLb, aColor);
- SelectColorHdl(*pLb);
+ if( LBSelectColor( pLb, aColor ) )
+ SelectHdl( *pLb );
}
}
+
IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void )
{
bool bUpdatePreview = false;
@@ -2605,20 +2604,9 @@ IMPL_LINK( Svx3DWin, SelectHdl, ListBox&, rListBox, void )
bUpdatePreview = true;
}
- 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 )
+ else if( &rListBox == m_pLbMatColor ||
+ &rListBox == m_pLbMatEmission ||
+ &rListBox == m_pLbMatSpecular )
{
m_pLbMatFavorites->SelectEntryPos( 0 );
bUpdatePreview = true;
@@ -2639,6 +2627,8 @@ IMPL_LINK( Svx3DWin, SelectColorHdl, SvxColorListBox&, rListBox, void )
{
bUpdatePreview = true;
}
+ else if (&rListBox == m_pLbShademode)
+ bUpdatePreview = true;
if( bUpdatePreview )
UpdatePreview();
@@ -2675,7 +2665,7 @@ IMPL_LINK( Svx3DWin, ModifyHdl, Edit&, rField, void )
void Svx3DWin::ClickLight(PushButton& rBtn)
{
sal_uInt16 nLightSource = GetLightSource( &rBtn );
- SvxColorListBox* pLb = GetLbByButton( &rBtn );
+ ColorLB* pLb = GetLbByButton( &rBtn );
Color aColor( pLb->GetSelectEntryColor() );
SfxItemSet aLightItemSet(m_pCtlLightPreview->GetSvx3DLightControl().Get3DAttributes());
const bool bOnOff(GetUILightState( static_cast<const ImageButton&>(rBtn) ));
@@ -2766,29 +2756,36 @@ 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
-void Svx3DWin::LBSelectColor( SvxColorListBox* pLb, const Color& rColor )
+// returns true if color was added
+
+bool Svx3DWin::LBSelectColor( ColorLB* pLb, const Color& rColor )
{
+ bool bRet = false;
+
pLb->SetNoSelection();
- pLb->SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor)));
+ 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;
}
+
void Svx3DWin::UpdatePreview()
{
if( pModel == nullptr )
@@ -2811,8 +2808,22 @@ void Svx3DWin::DocumentReload()
mpRemember2DAttributes = nullptr;
}
-void Svx3DWin::InitColorLB()
+
+void Svx3DWin::InitColorLB( const SdrModel* pDoc )
{
+ 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 );
@@ -2877,9 +2888,9 @@ sal_uInt16 Svx3DWin::GetLightSource( const PushButton* pBtn )
};
-SvxColorListBox* Svx3DWin::GetLbByButton( const PushButton* pBtn )
+ColorLB* Svx3DWin::GetLbByButton( const PushButton* pBtn )
{
- SvxColorListBox* pLb = nullptr;
+ ColorLB* pLb = nullptr;
if( pBtn == nullptr )
{
diff --git a/svx/source/engine3d/float3d.src b/svx/source/engine3d/float3d.src
index 43a48855ae25..734117060173 100644
--- a/svx/source/engine3d/float3d.src
+++ b/svx/source/engine3d/float3d.src
@@ -41,6 +41,21 @@ 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 318b95b20e23..5f90b223781a 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -167,11 +167,10 @@ 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( aLink3 );
- mpLbFillGradTo->SetSelectHdl( aLink3 );
+ mpLbFillGradFrom->SetSelectHdl( aLink );
+ mpLbFillGradTo->SetSelectHdl( aLink );
mpMTRAngle->SetModifyHdl(LINK(this,AreaPropertyPanelBase, ChangeGradientAngle));
mpLBTransType->SetSelectHdl(LINK(this, AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl));
@@ -297,33 +296,61 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void)
mpToolBoxColor->Hide();
mpBmpImport->Hide();
- mpLbFillAttr->Enable();
- mpLbFillGradTo->Enable();
- mpLbFillGradFrom->Enable();
- mpGradientStyle->Enable();
- mpMTRAngle->Enable();
- mpLbFillAttr->Clear();
-
- if (LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient)
+ const SvxColorListItem* pColorListItem = static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE));
+ if(pColorListItem)
{
- const SvxGradientListItem aItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST)));
+ mpLbFillAttr->Enable();
+ mpLbFillGradTo->Enable();
+ mpLbFillGradFrom->Enable();
+ mpGradientStyle->Enable();
+ mpMTRAngle->Enable();
+ mpLbFillAttr->Clear();
+ mpLbFillGradTo->Clear();
+ mpLbFillGradFrom->Clear();
+ mpLbFillGradTo->Fill(pColorListItem->GetColorList());
+ mpLbFillGradFrom->Fill(pColorListItem->GetColorList());
- if(mnLastPosGradient < aItem.GetGradientList()->Count())
+ mpLbFillGradFrom->AdaptDropDownLineCountToMaximum();
+ mpLbFillGradTo->AdaptDropDownLineCountToMaximum();
+
+ if(LISTBOX_ENTRY_NOTFOUND != mnLastPosGradient)
{
- 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 ));
+ 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 ));
+ }
}
}
+ else
+ {
+ mpLbFillGradFrom->Disable();
+ mpLbFillGradTo->Disable();
+ mpMTRAngle->Disable();
+ mpGradientStyle->Disable();
+ }
break;
}
case HATCH:
@@ -448,11 +475,6 @@ 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();
@@ -1154,15 +1176,28 @@ 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 0766550e29cd..a1ea3879f3dd 100644
--- a/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx
+++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.cxx
@@ -10,7 +10,6 @@
#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>
@@ -123,18 +122,25 @@ void ShadowPropertyPanel::dispose()
void ShadowPropertyPanel::Initialize()
{
- 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();
+ 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();
+ }
}
IMPL_LINK_NOARG(ShadowPropertyPanel, ClickShadowHdl, Button*, void)
@@ -153,7 +159,7 @@ IMPL_LINK_NOARG(ShadowPropertyPanel, ClickShadowHdl, Button*, void)
}
}
-IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl, SvxColorListBox&, void)
+IMPL_LINK_NOARG(ShadowPropertyPanel, ModifyShadowColorHdl, ListBox&, void)
{
XColorItem aItem(makeSdrShadowColorItem(mpLBShadowColor->GetSelectEntryColor()));
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_SHADOW_COLOR,
@@ -314,6 +320,9 @@ 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 f3fd1c7e12eb..7e7288617d32 100644
--- a/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx
+++ b/svx/source/sidebar/shadow/ShadowPropertyPanel.hxx
@@ -25,7 +25,6 @@
#include <sfx2/request.hxx>
#include <svx/dlgctrl.hxx>
-class SvxColorListBox;
namespace svx { namespace sidebar {
@@ -61,10 +60,10 @@ public:
SfxBindings* pBindings);
private:
- VclPtr<CheckBox> mpShowShadow;
- VclPtr<MetricBox> mpShadowDistance;
- VclPtr<SvxColorListBox> mpLBShadowColor;
- VclPtr<MetricBox> mpShadowAngle;
+ VclPtr<CheckBox> mpShowShadow;
+ VclPtr<MetricBox> mpShadowDistance;
+ VclPtr<ColorLB> mpLBShadowColor;
+ VclPtr<MetricBox> mpShadowAngle;
VclPtr<FixedText> mpFTAngle;
VclPtr<FixedText> mpFTDistance;
VclPtr<FixedText> mpFTTransparency;
@@ -85,7 +84,7 @@ private:
void SetTransparencyValue(long);
void UpdateControls();
DECL_LINK(ClickShadowHdl, Button*, void);
- DECL_LINK(ModifyShadowColorHdl, SvxColorListBox&, void);
+ DECL_LINK(ModifyShadowColorHdl, ListBox&, 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 7f1d5a140437..3ba048559620 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -254,21 +254,18 @@ void PaletteManager::SetLastColor(const Color& rLastColor)
mLastColor = rLastColor;
}
-void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName, bool bFront)
+void PaletteManager::AddRecentColor(const Color& rRecentColor, const OUString& rName)
{
auto itColor = std::find_if(maRecentColors.begin(),
maRecentColors.end(),
- [rRecentColor] (const NamedColor &a) { return a.first == rRecentColor; });
+ [rRecentColor] (const color_and_name &a) { return a.first == rRecentColor; });
// if recent color to be added is already in list, remove it
if( itColor != maRecentColors.end() )
maRecentColors.erase( itColor );
- if (maRecentColors.size() == mnMaxRecentColors)
+ maRecentColors.push_front(std::make_pair(rRecentColor, rName));
+ 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)
@@ -288,7 +285,7 @@ void PaletteManager::SetBtnUpdater(svx::ToolboxButtonColorUpdater* pBtnUpdater)
mLastColor = mpBtnUpdater->GetCurrentColor();
}
-void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const NamedColor&)>& aColorSelectFunction)
+void PaletteManager::SetColorSelectFunction(const std::function<void(const OUString&, const Color&)>& aColorSelectFunction)
{
maColorSelectFunction = aColorSelectFunction;
}
@@ -305,14 +302,12 @@ void PaletteManager::PopupColorPicker(const OUString& aCommand)
if (mpBtnUpdater)
mpBtnUpdater->Update( aColorDlg.GetColor() );
mLastColor = aColorDlg.GetColor();
- OUString sColorName = ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase());
- NamedColor aNamedColor = std::make_pair(mLastColor, sColorName);
- AddRecentColor(mLastColor, sColorName);
- maColorSelectFunction(aCommandCopy, aNamedColor);
+ AddRecentColor(mLastColor, ("#" + mLastColor.AsRGBHexString().toAsciiUpperCase()));
+ maColorSelectFunction(aCommandCopy, mLastColor);
}
}
-void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor)
+void PaletteManager::DispatchColorCommand(const OUString& aCommand, const Color& rColor)
{
using namespace css::uno;
using namespace css::frame;
@@ -328,7 +323,7 @@ void PaletteManager::DispatchColorCommand(const OUString& aCommand, const NamedC
Sequence<PropertyValue> aArgs(1);
aArgs[0].Name = aObj.GetURLPath();
- aArgs[0].Value = makeAny(sal_Int32(rColor.first.GetColor()));
+ aArgs[0].Value = makeAny(sal_Int32(rColor.GetColor()));
URL aTargetURL;
aTargetURL.Complete = aCommand;
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index c5c0d568227c..5d3b359b144c 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -51,7 +51,6 @@
#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>
@@ -86,7 +85,6 @@
#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"
@@ -1247,13 +1245,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 NamedColor&)> 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 Color&)> const & aFunction):
SfxPopupWindow( nSlotId, pParentWindow,
"palette_popup_window", "svx/ui/colorwindow.ui",
@@ -1266,7 +1264,6 @@ 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");
@@ -1281,16 +1278,6 @@ 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;
}
@@ -1298,7 +1285,15 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
case SID_ATTR_CHAR_COLOR2:
case SID_EXTRUSION_3D_COLOR:
{
- mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
+ 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 ) );
break;
}
default:
@@ -1358,7 +1353,6 @@ 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 ) );
@@ -1384,11 +1378,6 @@ SvxColorWindow::SvxColorWindow(const OUString& rCommand,
}
}
-void SvxColorWindow::ShowNoneButton()
-{
- mpButtonNoneColor->Show();
-}
-
SvxColorWindow::~SvxColorWindow()
{
disposeOnce();
@@ -1400,7 +1389,6 @@ void SvxColorWindow::dispose()
mpRecentColorSet.clear();
mpPaletteListBox.clear();
mpButtonAutoColor.clear();
- mpButtonNoneColor.clear();
mpButtonPicker.clear();
mpAutomaticSeparator.clear();
SfxPopupWindow::dispose();
@@ -1411,29 +1399,11 @@ 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);
- NamedColor aNamedColor = GetSelectEntryColor(pColorSet);
+ Color aColor = pColorSet->GetItemColor( pColorSet->GetSelectItemId() );
/* #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. */
@@ -1441,7 +1411,7 @@ IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void)
if ( pColorSet != mpRecentColorSet )
{
- mrPaletteManager.AddRecentColor(aNamedColor.first, aNamedColor.second);
+ mrPaletteManager.AddRecentColor(aColor, pColorSet->GetItemText(pColorSet->GetSelectItemId()));
if ( !IsInPopupMode() )
mrPaletteManager.ReloadRecentColorSet( *mpRecentColorSet );
}
@@ -1449,9 +1419,9 @@ IMPL_LINK(SvxColorWindow, SelectHdl, ValueSet*, pColorSet, void)
if ( IsInPopupMode() )
EndPopupMode();
- maSelectedLink.Call(aNamedColor);
+ maSelectedLink.Call(aColor);
- maColorSelectFunction(maCommand, aNamedColor);
+ maColorSelectFunction(maCommand, aColor);
}
IMPL_LINK_NOARG(SvxColorWindow, SelectPaletteHdl, ListBox&, void)
@@ -1462,64 +1432,37 @@ IMPL_LINK_NOARG(SvxColorWindow, SelectPaletteHdl, ListBox&, void)
mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount());
}
-NamedColor SvxColorWindow::GetNoneColor() const
+IMPL_LINK_NOARG(SvxColorWindow, AutoColorClickHdl, Button*, void)
{
- 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);
-}
+ VclPtr<SvxColorWindow> xThis(this);
-NamedColor SvxColorWindow::GetAutoColor() const
-{
Color aColor;
- OUString sColorName;
- switch (theSlotId)
+ 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(aNamedColor);
+ maSelectedLink.Call(aColor);
- maColorSelectFunction(maCommand, aNamedColor);
+ maColorSelectFunction(maCommand, aColor);
}
IMPL_LINK_NOARG(SvxColorWindow, OpenPickerClickHdl, Button*, void)
@@ -1536,23 +1479,6 @@ 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"
@@ -1563,76 +1489,34 @@ void SvxColorWindow::statusChanged( const css::frame::FeatureStateEvent& rEvent
}
else
{
- Color aColor(COL_TRANSPARENT);
+ mpColorSet->SetNoSelection();
+ 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;
}
- SelectEntry(aColor);
- }
-}
+ if ( aColor == COL_TRANSPARENT )
+ return;
-bool SvxColorWindow::SelectValueSetEntry(SvxColorValueSet* pColorSet, const Color& rColor)
-{
- for (size_t i = 1; i <= pColorSet->GetItemCount(); ++i)
- {
- if (rColor == pColorSet->GetItemColor(i))
+ for ( size_t i = 1; i <= mpColorSet->GetItemCount(); ++i )
{
- pColorSet->SelectItem(i);
- return true;
+ if ( aColor == mpColorSet->GetItemColor(i) )
+ {
+ mpColorSet->SelectItem(i);
+ break;
+ }
}
}
- 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 ),
@@ -2833,18 +2717,19 @@ VclPtr<SfxPopupWindow> SvxColorToolBoxControl::CreatePopupWindow()
&GetToolBox(),
m_aColorSelectFunction);
- pColorWin->StartPopupMode(&GetToolBox(), FloatWinPopupFlags::GrabFocus);
+ pColorWin->StartPopupMode( &GetToolBox(),
+ FloatWinPopupFlags::AllowTearOff|FloatWinPopupFlags::NoAppFocusClose );
pColorWin->StartSelection();
- SetPopupWindow(pColorWin);
+ SetPopupWindow( pColorWin );
if ( m_bSplitButton )
pColorWin->SetSelectedHdl( LINK( this, SvxColorToolBoxControl, SelectedHdl ) );
return pColorWin;
}
-IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const NamedColor&, rColor, void)
+IMPL_LINK(SvxColorToolBoxControl, SelectedHdl, const Color&, rColor, void)
{
- m_xBtnUpdater->Update(rColor.first);
- m_aPaletteManager.SetLastColor(rColor.first);
+ m_xBtnUpdater->Update( rColor );
+ m_aPaletteManager.SetLastColor( rColor );
}
void SvxColorToolBoxControl::statusChanged( const css::frame::FeatureStateEvent& rEvent )
@@ -3182,204 +3067,4 @@ 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 194d6a8d5997..27aed7b4d400 100644
--- a/svx/source/tbxctrls/tbcontrl.src
+++ b/svx/source/tbxctrls/tbcontrl.src
@@ -41,14 +41,9 @@ ImageList RID_SVXIL_FRAME
IdCount = { 12 ; };
};
-String RID_SVXSTR_NOFILL
-{
- Text [ en-US ] = "No Fill" ;
-};
-
String RID_SVXSTR_TRANSPARENT
{
- Text [ en-US ] = "Transparent";
+ Text [ en-US ] = "No Fill" ;
};
String RID_SVXSTR_FILLPATTERN
@@ -140,11 +135,6 @@ 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 444797ff9714..9482562f83a6 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.20.0 -->
+<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<requires lib="LibreOffice" version="1.0"/>
@@ -13,14 +13,9 @@
<property name="can_focus">False</property>
<property name="margin_right">6</property>
<property name="xalign">0</property>
- <property name="pixbuf">cmd/sc_square_unfilled.png</property>
+ <property name="pixbuf">cmd/sc_colorsettings.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>
@@ -30,6 +25,7 @@
<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">
@@ -37,41 +33,13 @@
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkBox">
+ <object class="GtkButton" id="auto_color_button">
<property name="visible">True</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>
+ <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>
diff --git a/svx/uiconfig/ui/docking3deffects.ui b/svx/uiconfig/ui/docking3deffects.ui
index fad6d1ca9d19..e3856ffbd3ca 100644
--- a/svx/uiconfig/ui/docking3deffects.ui
+++ b/svx/uiconfig/ui/docking3deffects.ui
@@ -1089,7 +1089,7 @@
</packing>
</child>
<child>
- <object class="svxlo-SvxColorListBox" id="ambientcolor">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor1">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor2">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor3">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor4">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor5">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor6">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor7">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="lightcolor8">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="objcolor">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="illumcolor">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="speccolor">
+ <object class="svxlo-ColorLB" 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 9b7e535c81a3..778c740f38bc 100644
--- a/svx/uiconfig/ui/dockingcolorreplace.ui
+++ b/svx/uiconfig/ui/dockingcolorreplace.ui
@@ -241,7 +241,7 @@
</packing>
</child>
<child>
- <object class="svxlo-SvxColorListBox" id="color1">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="color2">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="color3">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="color4">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="color5">
+ <object class="svxlo-ColorLB" 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 01e74c377e79..0c729be1b10e 100644
--- a/svx/uiconfig/ui/dockingfontwork.ui
+++ b/svx/uiconfig/ui/dockingfontwork.ui
@@ -437,7 +437,7 @@
</packing>
</child>
<child>
- <object class="svxlo-SvxColorListBox" id="color">
+ <object class="svxlo-ColorLB" 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 85a3122d68c6..e85fe45dfa20 100644
--- a/svx/uiconfig/ui/sidebararea.ui
+++ b/svx/uiconfig/ui/sidebararea.ui
@@ -100,7 +100,7 @@
</packing>
</child>
<child>
- <object class="svxlo-SvxColorListBox" id="fillgrad1">
+ <object class="svxlo-ColorLB" 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-SvxColorListBox" id="fillgrad2">
+ <object class="svxlo-ColorLB" 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 356b6ff46933..0b2e8cf6d48b 100644
--- a/svx/uiconfig/ui/sidebarshadow.ui
+++ b/svx/uiconfig/ui/sidebarshadow.ui
@@ -184,7 +184,7 @@
</packing>
</child>
<child>
- <object class="svxlo-SvxColorListBox" id="LB_SHADOW_COLOR">
+ <object class="svxlo-ColorLB" id="LB_SHADOW_COLOR">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>