summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r--svx/source/tbxctrls/PaletteManager.cxx23
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx411
-rw-r--r--svx/source/tbxctrls/tbcontrl.src12
3 files changed, 388 insertions, 58 deletions
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";