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(),
nullptr,
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
ColorValueSet(m_xBuilder->weld_scrolled_window(
"tablewin")))
99 , m_xValSetColorBoxWin(new
weld::CustomWeld(*m_xBuilder,
"table", *m_xValSetColorBox))
115 if ( rInAttrs.
GetItemState( SID_SCH_EDITOPTIONS,
false, &pItem ) == SfxItemState::SET )
146 return std::make_unique<SvxDefaultColorOptPage>( pPage, pController, *rAttrs );
168 for (
auto const& palette : aPaletteList)
171 OUString aPaletteName(officecfg::Office::Common::UserColors::PaletteName::get());
192 if( m_SvxChartColorTableUniquePtr )
194 m_SvxChartColorTableUniquePtr->useDefault();
196 FillBoxChartColorLB();
198 m_xLbChartColors->grab_focus();
199 m_xLbChartColors->select( 0 );
200 m_xPBRemove->set_sensitive(
true);
207 if( m_SvxChartColorTableUniquePtr )
209 Color const black( 0x00, 0x00, 0x00 );
211 m_SvxChartColorTableUniquePtr->append(
214 FillBoxChartColorLB();
215 m_xLbChartColors->grab_focus();
216 m_xLbChartColors->select(m_SvxChartColorTableUniquePtr->size() - 1);
217 m_xPBRemove->set_sensitive(
true);
224 sal_Int32
nIndex = m_xLbChartColors->get_selected_index();
228 if( m_SvxChartColorTableUniquePtr )
230 OSL_ENSURE(m_SvxChartColorTableUniquePtr->size() > 1,
"don't delete the last chart color");
233 std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog(
"QueryDeleteChartColorDialog"));
237 m_SvxChartColorTableUniquePtr->remove(nIndex);
239 FillBoxChartColorLB();
241 m_xLbChartColors->grab_focus();
243 if (nIndex == m_xLbChartColors->n_children() && m_xLbChartColors->n_children() > 0)
244 m_xLbChartColors->select(m_SvxChartColorTableUniquePtr->size() - 1);
245 else if (m_xLbChartColors->n_children() > 0)
246 m_xLbChartColors->select( nIndex );
248 m_xPBRemove->set_sensitive(
true);
255 sal_Int32
nPos = m_xLbPaletteSelector->get_active();
256 aPaletteManager.SetPalette( nPos );
257 aPaletteManager.ReloadColorSet( *m_xValSetColorBox );
258 m_xValSetColorBox->Resize();
263 sal_Int32 nIdx = m_xLbChartColors->get_selected_index();
266 const XColorEntry aEntry(m_xValSetColorBox->GetItemColor(m_xValSetColorBox->GetSelectedItemId()), m_xLbChartColors->get_selected_text());
268 ModifyColorEntry(aEntry, nIdx);
269 m_SvxChartColorTableUniquePtr->replace(nIdx, aEntry);
271 m_xLbChartColors->select(nIdx);
#define LINK(Instance, Class, Member)
std::unique_ptr< weld::Button > m_xPBRemove
static OUString getDefaultName(size_t _nIndex)
std::unique_ptr< SvxChartOptions > m_SvxChartOptionsUniquePtr
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
std::unique_ptr< weld::ComboBox > m_xLbPaletteSelector
SvxDefaultColorOptPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
const Size & GetListBoxPreviewDefaultPixelSize() const
void RemoveColorEntry(sal_Int32 nPos)
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rInAttrs)
std::unique_ptr< SvxChartColorTable > m_SvxChartColorTableUniquePtr
virtual ~SvxDefaultColorOptPage() override
IMPL_LINK_NOARG(SvxDefaultColorOptPage, ResetToDefaults, weld::Button &, void)
PaletteManager aPaletteManager
const OUString & GetName() const
const Color & GetDisableColor() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
std::vector< OUString > GetPaletteList()
std::unique_ptr< weld::Button > m_xPBDefault
void InsertColorEntry(const XColorEntry &rEntry, sal_Int32 nPos=-1)
void ModifyColorEntry(const XColorEntry &rEntry, sal_Int32 nPos)
virtual void Reset(const SfxItemSet *rInAttrs) override
void FillBoxChartColorLB()
std::unique_ptr< weld::CustomWeld > m_xValSetColorBoxWin
std::unique_ptr< weld::Button > m_xPBAdd
std::unique_ptr< ColorValueSet > m_xValSetColorBox
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< weld::TreeView > m_xLbChartColors
virtual bool FillItemSet(SfxItemSet *rOutAttrs) override
const Color & GetColor() const
reference_type * get() const
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)