[Libreoffice-commits] core.git: 5 commits - include/svx svx/source svx/uiconfig
Maxim Monastirsky
momonasmon at gmail.com
Tue Oct 28 13:59:52 PDT 2014
include/svx/SvxColorValueSet.hxx | 2 -
svx/source/tbxctrls/PaletteManager.cxx | 6 ++-
svx/source/tbxctrls/SvxColorValueSet.cxx | 2 -
svx/source/tbxctrls/colorwindow.hxx | 5 --
svx/source/tbxctrls/tbcontrl.cxx | 61 +++++++++++--------------------
svx/uiconfig/ui/colorwindow.ui | 2 -
6 files changed, 31 insertions(+), 47 deletions(-)
New commits:
commit 3efc3cc5b0b4b6151e928c2348c7dc6f74181db5
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Oct 28 22:24:23 2014 +0200
colorwindow: try to fix initial layout
Change-Id: Ic69bbcd877d248afd0f23a867d4c57d801479b74
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 9ca375a..f42b853 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1148,10 +1148,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
mpColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT) );
mpRecentColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT) );
- mpColorSet->layoutAllVisible(mrPaletteManager.GetColorCount());
- mpRecentColorSet->SetLineCount( 1 );
- mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount());
-
if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId )
{
mpButtonAutoColor->SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) );
@@ -1211,7 +1207,14 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
SetText( rWndTitle );
mrPaletteManager.ReloadColorSet(*mpColorSet);
+ mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount());
+
mrPaletteManager.ReloadRecentColorSet(*mpRecentColorSet);
+ mpRecentColorSet->SetLineCount( 1 );
+ Size aSize = mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount());
+ mpRecentColorSet->set_height_request(aSize.Height());
+ mpRecentColorSet->set_width_request(aSize.Width());
+
AddStatusListener( ".uno:ColorTableState" );
AddStatusListener( maCommand );
}
@@ -1293,8 +1296,6 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
void SvxColorWindow_Impl::Resize()
{
- mpColorSet->SetSizePixel( this->GetOutputSizePixel() );
- mpRecentColorSet->SetSizePixel( this->GetOutputSizePixel() );
}
void SvxColorWindow_Impl::StartSelection()
@@ -1313,11 +1314,11 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
{
if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem )))
{
- mrPaletteManager.ReloadColorSet(*mpColorSet);
- mrPaletteManager.ReloadRecentColorSet(*mpRecentColorSet);
-
- mpColorSet->layoutAllVisible(mrPaletteManager.GetColorCount());
- mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount());
+ if ( mrPaletteManager.GetPalette() == 0 )
+ {
+ mrPaletteManager.ReloadColorSet(*mpColorSet);
+ mpColorSet->layoutToGivenHeight(mpColorSet->GetSizePixel().Height(), mrPaletteManager.GetColorCount());
+ }
}
else if ( SfxItemState::DEFAULT <= eState )
{
diff --git a/svx/uiconfig/ui/colorwindow.ui b/svx/uiconfig/ui/colorwindow.ui
index 1c2978e..1055385 100644
--- a/svx/uiconfig/ui/colorwindow.ui
+++ b/svx/uiconfig/ui/colorwindow.ui
@@ -108,7 +108,7 @@
<property name="receives_default">True</property>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
commit 7ff283c6b3dad49129cd0df9176275805d25d7b9
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Oct 28 21:09:16 2014 +0200
colorwindow: Use exactly one row of recent colors
Right now one row of SvxColorValueSet is 12 colors.
Change-Id: I9be6e8487d5325866e17f578b7abb08f7c338fb1
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index e07ad15..b6d3cb7 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -24,13 +24,15 @@
#include <svx/drawitem.hxx>
#include <svx/dialogs.hrc>
#include <svtools/colrdlg.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/settings.hxx>
#define STR_DEFAULT_PAL "Default palette"
#define STR_DOC_COLORS "Document colors"
#define STR_DOC_COLOR_PREFIX "Document Color "
PaletteManager::PaletteManager() :
- mnMaxRecentColors(10),
+ mnMaxRecentColors(Application::GetSettings().GetStyleSettings().GetColorValueSetColumnCount()),
mnNumOfPalettes(2),
mnCurrentPalette(0),
mnColorCount(0),
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index f0ccdc5..b7f5681 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -47,8 +47,6 @@ private:
PaletteManager& mrPaletteManager;
- const sal_uInt16 mnColorSetCols;
-
DECL_LINK( SelectHdl, SvxColorValueSet* );
DECL_LINK( SelectPaletteHdl, void *);
DECL_LINK( AutoColorClickHdl, void * );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index abcf9c9..9ca375a 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1136,9 +1136,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
rFrame ),
theSlotId( nSlotId ),
maCommand( rCommand ),
- mrPaletteManager( rPaletteManager ),
- mnColorSetCols( 10 )
-
+ mrPaletteManager( rPaletteManager )
{
get(mpPaletteListBox, "palette_listbox");
get(mpButtonAutoColor, "auto_color_button");
@@ -1150,9 +1148,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
mpColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT) );
mpRecentColorSet->SetStyle( WinBits(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT) );
- mpColorSet->SetColCount( mnColorSetCols );
mpColorSet->layoutAllVisible(mrPaletteManager.GetColorCount());
- mpRecentColorSet->SetColCount( mnColorSetCols );
mpRecentColorSet->SetLineCount( 1 );
mpRecentColorSet->layoutAllVisible(mrPaletteManager.GetRecentColorCount());
commit 2c3c7529b5a0f66e01215ab4c3b309c8e5028000
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Oct 28 18:01:51 2014 +0200
colorwindow: Update recent colors list immediately
Change-Id: Ieb6277f0962f88dfa55b6af80535ec8af497433e
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 8900416..abcf9c9 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1242,11 +1242,15 @@ IMPL_LINK(SvxColorWindow_Impl, SelectHdl, SvxColorValueSet*, pColorSet)
while in Dispatch()), accessing members will crash in this case. */
pColorSet->SetNoSelection();
- if ( IsInPopupMode() )
- EndPopupMode();
-
if ( pColorSet != mpRecentColorSet )
+ {
mrPaletteManager.AddRecentColor( aColor );
+ if ( !IsInPopupMode() )
+ mrPaletteManager.ReloadRecentColorSet( *mpRecentColorSet );
+ }
+
+ if ( IsInPopupMode() )
+ EndPopupMode();
if ( maSelectedLink.IsSet() )
maSelectedLink.Call(&aColor);
commit 2b54af3b6479d131ea7b6040eac1bb2ef0e416c1
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Oct 28 16:41:17 2014 +0200
colorwindow: Unify SelectHdl and SelectRecentHdl
Change-Id: I680517bc7d91ef15593d235a7ff72588c7513b15
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index 0dc41ee..f0ccdc5 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -49,8 +49,7 @@ private:
const sal_uInt16 mnColorSetCols;
- DECL_LINK( SelectHdl, void * );
- DECL_LINK( SelectRecentHdl, void * );
+ DECL_LINK( SelectHdl, SvxColorValueSet* );
DECL_LINK( SelectPaletteHdl, void *);
DECL_LINK( AutoColorClickHdl, void * );
DECL_LINK( OpenPickerClickHdl, void * );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 9df403e..8900416 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1209,7 +1209,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
mpButtonPicker->SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) );
mpColorSet->SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) );
- mpRecentColorSet->SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectRecentHdl ) );
+ mpRecentColorSet->SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) );
SetHelpId( HID_POPUP_COLOR );
mpColorSet->SetHelpId( HID_POPUP_COLOR_CTRL );
SetText( rWndTitle );
@@ -1234,35 +1234,19 @@ SfxPopupWindow* SvxColorWindow_Impl::Clone() const
return new SvxColorWindow_Impl( maCommand, mrPaletteManager, theSlotId, GetFrame(), GetText(), GetParent() );
}
-IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
+IMPL_LINK(SvxColorWindow_Impl, SelectHdl, SvxColorValueSet*, pColorSet)
{
- Color aColor = mpColorSet->GetItemColor( mpColorSet->GetSelectItemId() );
+ 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. */
- mpColorSet->SetNoSelection();
+ pColorSet->SetNoSelection();
if ( IsInPopupMode() )
EndPopupMode();
- if ( maSelectedLink.IsSet() )
- maSelectedLink.Call(&aColor);
-
- PaletteManager::DispatchColorCommand(maCommand, aColor);
- mrPaletteManager.AddRecentColor(aColor);
- return 0;
-}
-
-IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectRecentHdl)
-{
- Color aColor = mpRecentColorSet->GetItemColor( mpRecentColorSet->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. */
- mpRecentColorSet->SetNoSelection();
-
- if ( IsInPopupMode() )
- EndPopupMode();
+ if ( pColorSet != mpRecentColorSet )
+ mrPaletteManager.AddRecentColor( aColor );
if ( maSelectedLink.IsSet() )
maSelectedLink.Call(&aColor);
commit a48145a854f13baaa9cde17790ada26df365fed5
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Tue Oct 28 14:29:46 2014 +0200
Rename loadColorVector to addEntriesForColorVector
So it will be similar to addEntriesForXColorList
Change-Id: Ie352e0cf05fa6875ed76e69478131a57293b39a1
diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx
index 585b54f..55a2ddb 100644
--- a/include/svx/SvxColorValueSet.hxx
+++ b/include/svx/SvxColorValueSet.hxx
@@ -39,7 +39,7 @@ public:
sal_uInt32 getColumnCount() const;
void addEntriesForXColorList(const XColorList& rXColorList, sal_uInt32 nStartIndex = 1);
- void loadColorVector(const std::vector<Color>& rColorVector, const OUString& rNamePrefix, sal_uInt32 nStartIndex = 1);
+ void addEntriesForColorVector(const std::vector<Color>& rColorVector, const OUString& rNamePrefix, sal_uInt32 nStartIndex = 1);
Size layoutAllVisible(sal_uInt32 nEntryCount);
Size layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount);
};
diff --git a/svx/source/tbxctrls/PaletteManager.cxx b/svx/source/tbxctrls/PaletteManager.cxx
index c561a5e..e07ad15 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -108,7 +108,7 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
std::vector<Color> aColors = pDocSh->GetDocColors();
mnColorCount = aColors.size();
rColorSet.Clear();
- rColorSet.loadColorVector(aColors, STR_DOC_COLOR_PREFIX );
+ rColorSet.addEntriesForColorVector(aColors, STR_DOC_COLOR_PREFIX );
}
else
{
diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx
index 299dc4a..4085912 100644
--- a/svx/source/tbxctrls/SvxColorValueSet.cxx
+++ b/svx/source/tbxctrls/SvxColorValueSet.cxx
@@ -86,7 +86,7 @@ void SvxColorValueSet::addEntriesForXColorList(const XColorList& rXColorList, sa
}
}
-void SvxColorValueSet::loadColorVector(const std::vector<Color>& rColorVector, const OUString& rNamePrefix, sal_uInt32 nStartIndex)
+void SvxColorValueSet::addEntriesForColorVector(const std::vector<Color>& rColorVector, const OUString& rNamePrefix, sal_uInt32 nStartIndex)
{
if(rNamePrefix.getLength() != 0)
{
More information about the Libreoffice-commits
mailing list