26#include <svx/svxids.hrc>
27#include <osl/diagnose.h>
28#include <officecfg/Office/Common.hxx>
33 const OUString& rStr = rEntry.
GetName();
39 xDevice->SetOutputSize(aImageSize);
40 const ::tools::Rectangle aRect(
Point(0, 0), aImageSize);
41 xDevice->SetFillColor(rColor);
43 xDevice->DrawRect(aRect);
46 nullptr, xDevice.
get(),
false,
nullptr);
52 ImpColorList::iterator it =
aColorList.begin();
53 std::advance( it,
nPos );
61 ImpColorList::iterator it =
aColorList.begin();
62 std::advance(it,
nPos);
92 :
SfxTabPage(pPage, pController,
"cui/ui/optchartcolorspage.ui",
"OptChartColorsPage", &rInAttrs)
93 , m_xLbChartColors(m_xBuilder->weld_tree_view(
"colors"))
94 , m_xLbPaletteSelector(m_xBuilder->weld_combo_box(
"paletteselector"))
95 , m_xPBDefault(m_xBuilder->weld_button(
"default"))
96 , m_xPBAdd(m_xBuilder->weld_button(
"add"))
97 , m_xPBRemove(m_xBuilder->weld_button(
"delete"))
98 , m_xValSetColorBox(new
SvxColorValueSet(m_xBuilder->weld_scrolled_window(
"tablewin", true)))
99 , m_xValSetColorBoxWin(new
weld::CustomWeld(*m_xBuilder,
"table", *m_xValSetColorBox))
115 pEditOptionsItem->GetColorList());
143 return std::make_unique<SvxDefaultColorOptPage>( pPage, pController, *rAttrs );
165 for (
auto const& palette : aPaletteList)
168 OUString aPaletteName(officecfg::Office::Common::UserColors::PaletteName::get());
186 if( m_SvxChartColorTableUniquePtr )
188 m_SvxChartColorTableUniquePtr->useDefault();
190 FillBoxChartColorLB();
192 m_xLbChartColors->grab_focus();
193 m_xLbChartColors->select( 0 );
194 m_xPBRemove->set_sensitive(
true);
201 if( m_SvxChartColorTableUniquePtr )
203 Color const black( 0x00, 0x00, 0x00 );
205 m_SvxChartColorTableUniquePtr->append(
208 FillBoxChartColorLB();
209 m_xLbChartColors->grab_focus();
210 m_xLbChartColors->select(m_SvxChartColorTableUniquePtr->size() - 1);
211 m_xPBRemove->set_sensitive(
true);
218 sal_Int32
nIndex = m_xLbChartColors->get_selected_index();
222 if( !m_SvxChartColorTableUniquePtr )
225 OSL_ENSURE(m_SvxChartColorTableUniquePtr->size() > 1,
"don't delete the last chart color");
228 std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(
"QueryDeleteChartColorDialog"));
233 m_SvxChartColorTableUniquePtr->remove(
nIndex);
235 FillBoxChartColorLB();
237 m_xLbChartColors->grab_focus();
239 if (
nIndex == m_xLbChartColors->n_children() && m_xLbChartColors->n_children() > 0)
240 m_xLbChartColors->select(m_SvxChartColorTableUniquePtr->size() - 1);
241 else if (m_xLbChartColors->n_children() > 0)
242 m_xLbChartColors->select(
nIndex );
244 m_xPBRemove->set_sensitive(
true);
249 sal_Int32
nPos = m_xLbPaletteSelector->get_active();
250 aPaletteManager.SetPalette(
nPos );
251 aPaletteManager.ReloadColorSet( *m_xValSetColorBox );
252 m_xValSetColorBox->Resize();
257 sal_Int32 nIdx = m_xLbChartColors->get_selected_index();
260 const XColorEntry aEntry(m_xValSetColorBox->GetItemColor(m_xValSetColorBox->GetSelectedItemId()), m_xLbChartColors->get_selected_text());
262 ModifyColorEntry(aEntry, nIdx);
263 m_SvxChartColorTableUniquePtr->replace(nIdx, aEntry);
265 m_xLbChartColors->select(nIdx);
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
std::vector< OUString > GetPaletteList()
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const Color & GetDisableColor() const
const Size & GetListBoxPreviewDefaultPixelSize() const
static OUString getDefaultName(size_t _nIndex)
virtual void Reset(const SfxItemSet *rInAttrs) override
std::unique_ptr< weld::Button > m_xPBDefault
void InsertColorEntry(const XColorEntry &rEntry, sal_Int32 nPos=-1)
virtual bool FillItemSet(SfxItemSet *rOutAttrs) override
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rInAttrs)
SvxDefaultColorOptPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
void RemoveColorEntry(sal_Int32 nPos)
std::unique_ptr< weld::TreeView > m_xLbChartColors
std::unique_ptr< weld::CustomWeld > m_xValSetColorBoxWin
void ModifyColorEntry(const XColorEntry &rEntry, sal_Int32 nPos)
std::unique_ptr< SvxColorValueSet > m_xValSetColorBox
std::unique_ptr< weld::Button > m_xPBAdd
virtual ~SvxDefaultColorOptPage() override
PaletteManager aPaletteManager
std::unique_ptr< weld::ComboBox > m_xLbPaletteSelector
std::unique_ptr< SvxChartColorTable > m_SvxChartColorTableUniquePtr
std::unique_ptr< weld::Button > m_xPBRemove
void FillBoxChartColorLB()
reference_type * get() const
const Color & GetColor() const
const OUString & GetName() const
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define LINK(Instance, Class, Member)
void SetDefaultColors(const SvxChartColorTable &aCol)
IMPL_LINK_NOARG(SvxDefaultColorOptPage, ResetToDefaults, weld::Button &, void)