chart color palette for data series: dialog tab pane
Change-Id: I0877212c715d320e954fcd8089d4f984eae16ac6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184265 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185143 Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -138,6 +138,7 @@ $(eval $(call gb_Library_add_exception_objects,chart2,\
|
||||
chart2/source/controller/dialogs/tp_3D_SceneIllumination \
|
||||
chart2/source/controller/dialogs/tp_AxisLabel \
|
||||
chart2/source/controller/dialogs/tp_AxisPositions \
|
||||
chart2/source/controller/dialogs/tp_ChartColorPalette \
|
||||
chart2/source/controller/dialogs/tp_ChartType \
|
||||
chart2/source/controller/dialogs/tp_DataLabel \
|
||||
chart2/source/controller/dialogs/tp_DataPointOption \
|
||||
|
||||
@@ -67,6 +67,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\
|
||||
chart2/uiconfig/ui/tp_3D_SceneIllumination \
|
||||
chart2/uiconfig/ui/tp_axisLabel \
|
||||
chart2/uiconfig/ui/tp_AxisPositions \
|
||||
chart2/uiconfig/ui/tp_ChartColorPalette \
|
||||
chart2/uiconfig/ui/tp_ChartType \
|
||||
chart2/uiconfig/ui/tp_DataLabel \
|
||||
chart2/uiconfig/ui/tp_DataPointOption \
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#define STR_PAGE_APPEARANCE NC_("STR_PAGE_APPEARANCE", "Appearance")
|
||||
#define STR_PAGE_ILLUMINATION NC_("STR_PAGE_ILLUMINATION", "Illumination")
|
||||
#define STR_PAGE_ASIAN NC_("STR_PAGE_ASIAN", "Asian Typography")
|
||||
#define STR_PAGE_COLOR_PALETTE NC_("STR_PAGE_COLOR_PALETTE", "Color Palette")
|
||||
#define STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS NC_("STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS", "Mean value line with value %AVERAGE_VALUE and standard deviation %STD_DEVIATION")
|
||||
#define STR_OBJECT_AXIS NC_("STR_OBJECT_AXIS", "Axis")
|
||||
#define STR_OBJECT_AXIS_X NC_("STR_OBJECT_AXIS_X", "X Axis")
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "tp_PolarOptions.hxx"
|
||||
#include "tp_DataPointOption.hxx"
|
||||
#include "tp_DataTable.hxx"
|
||||
#include "tp_ChartColorPalette.hxx"
|
||||
#include <ResId.hxx>
|
||||
#include <ViewElementListProvider.hxx>
|
||||
#include <ChartType.hxx>
|
||||
@@ -342,7 +343,8 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
|
||||
|
||||
m_xDialog->set_title(pDialogParameter->getLocalizedName());
|
||||
|
||||
switch (pDialogParameter->getObjectType())
|
||||
ObjectType eType = pDialogParameter->getObjectType();
|
||||
switch (eType)
|
||||
{
|
||||
case OBJECTTYPE_TITLE:
|
||||
AddTabPage(u"border"_ustr, SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
|
||||
@@ -359,6 +361,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
|
||||
AddTabPage(u"border"_ustr, SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
|
||||
AddTabPage(u"area"_ustr, SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
|
||||
AddTabPage(u"transparent"_ustr, SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
|
||||
AddTabPage(u"colorpalette"_ustr, SchResId(STR_PAGE_COLOR_PALETTE), ChartColorPaletteTabPage::Create);
|
||||
AddTabPage(u"fontname"_ustr, SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
|
||||
AddTabPage(u"effects"_ustr, SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
|
||||
AddTabPage(u"legendpos"_ustr, SchResId(STR_PAGE_POSITION), SchLegendPosTabPage::Create);
|
||||
@@ -384,6 +387,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
|
||||
AddTabPage(u"transparent"_ustr, SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
|
||||
}
|
||||
AddTabPage(u"border"_ustr, SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE ), RID_SVXPAGE_LINE);
|
||||
AddTabPage(u"colorpalette"_ustr, SchResId(STR_PAGE_COLOR_PALETTE), ChartColorPaletteTabPage::Create);
|
||||
break;
|
||||
|
||||
case OBJECTTYPE_DATA_LABEL:
|
||||
@@ -450,6 +454,8 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
|
||||
AddTabPage(u"border"_ustr, SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
|
||||
AddTabPage(u"area"_ustr, SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
|
||||
AddTabPage(u"transparent"_ustr, SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
|
||||
if (eType != OBJECTTYPE_DATA_STOCK_LOSS && eType != OBJECTTYPE_DATA_STOCK_GAIN)
|
||||
AddTabPage(u"colorpalette"_ustr, SchResId(STR_PAGE_COLOR_PALETTE), ChartColorPaletteTabPage::Create);
|
||||
break;
|
||||
|
||||
case OBJECTTYPE_LEGEND_ENTRY:
|
||||
@@ -621,6 +627,14 @@ void SchAttribTabDlg::PageCreated(const OUString& rId, SfxTabPage &rPage)
|
||||
pTrendlineTabPage->SetNbPoints( m_pParameter->getNbPoints() );
|
||||
}
|
||||
}
|
||||
else if (rId == "colorpalette")
|
||||
{
|
||||
auto* pColorPaletteTabPage = dynamic_cast<ChartColorPaletteTabPage*>( &rPage );
|
||||
if (pColorPaletteTabPage)
|
||||
{
|
||||
pColorPaletteTabPage->init(m_pParameter->getDocument());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_LINK(SchAttribTabDlg, OKPressed, weld::Button&, rButton, void)
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include "tp_ChartColorPalette.hxx"
|
||||
|
||||
#include <ChartColorPaletteHelper.hxx>
|
||||
#include <ChartModel.hxx>
|
||||
#include <chartview/ChartSfxItemIds.hxx>
|
||||
#include <svx/chrtitem.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
|
||||
namespace chart
|
||||
{
|
||||
ChartColorPaletteTabPage::ChartColorPaletteTabPage(weld::Container* pPage,
|
||||
weld::DialogController* pController,
|
||||
const SfxItemSet& rInAttrs)
|
||||
: SfxTabPage(pPage, pController, "modules/schart/ui/tp_ChartColorPalette.ui",
|
||||
"tp_ChartColorPalette", &rInAttrs)
|
||||
, mxColorfulValueSet(new ChartColorPalettes)
|
||||
, mxColorfulValueSetWin(
|
||||
new weld::CustomWeld(*m_xBuilder, "colorful_palettes", *mxColorfulValueSet))
|
||||
, mxMonoValueSet(new ChartColorPalettes)
|
||||
, mxMonoValueSetWin(
|
||||
new weld::CustomWeld(*m_xBuilder, "monochromatic_palettes", *mxMonoValueSet))
|
||||
{
|
||||
mxColorfulValueSet->SetColCount(2);
|
||||
mxColorfulValueSet->SetLineCount(2);
|
||||
mxColorfulValueSet->SetColor(Application::GetSettings().GetStyleSettings().GetFaceColor());
|
||||
|
||||
mxMonoValueSet->SetColCount(2);
|
||||
mxMonoValueSet->SetLineCount(3);
|
||||
mxMonoValueSet->SetColor(Application::GetSettings().GetStyleSettings().GetFaceColor());
|
||||
|
||||
mxColorfulValueSet->SetOptimalSize();
|
||||
mxColorfulValueSet->SetSelectHdl(
|
||||
LINK(this, ChartColorPaletteTabPage, SelectColorfulValueSetHdl));
|
||||
|
||||
mxMonoValueSet->SetOptimalSize();
|
||||
mxMonoValueSet->SetSelectHdl(LINK(this, ChartColorPaletteTabPage, SelectMonoValueSetHdl));
|
||||
}
|
||||
|
||||
ChartColorPaletteTabPage::~ChartColorPaletteTabPage()
|
||||
{
|
||||
mxColorfulValueSetWin.reset();
|
||||
mxColorfulValueSet.reset();
|
||||
mxMonoValueSetWin.reset();
|
||||
mxMonoValueSet.reset();
|
||||
}
|
||||
|
||||
std::unique_ptr<SfxTabPage> ChartColorPaletteTabPage::Create(weld::Container* pPage,
|
||||
weld::DialogController* pController,
|
||||
const SfxItemSet* rInAttrs)
|
||||
{
|
||||
return std::make_unique<ChartColorPaletteTabPage>(pPage, pController, *rInAttrs);
|
||||
}
|
||||
|
||||
void ChartColorPaletteTabPage::init(const rtl::Reference<ChartModel>& xChartModel)
|
||||
{
|
||||
assert(xChartModel);
|
||||
mxChartModel = xChartModel;
|
||||
|
||||
const std::shared_ptr<model::Theme> pTheme = mxChartModel->getDocumentTheme();
|
||||
mxHelper = std::make_unique<ChartColorPaletteHelper>(pTheme);
|
||||
|
||||
selectItem(mxChartModel->getColorPaletteType(), mxChartModel->getColorPaletteIndex() + 1);
|
||||
initColorPalettes();
|
||||
}
|
||||
|
||||
void ChartColorPaletteTabPage::initColorPalettes() const
|
||||
{
|
||||
if (!mxHelper)
|
||||
return;
|
||||
// colorful palettes
|
||||
for (size_t i = 0; i < ChartColorPaletteHelper::ColorfulPaletteSize; ++i)
|
||||
mxColorfulValueSet->insert(mxHelper->getColorPalette(ChartColorPaletteType::Colorful, i));
|
||||
// monotonic palettes
|
||||
for (size_t i = 0; i < ChartColorPaletteHelper::MonotonicPaletteSize; ++i)
|
||||
mxMonoValueSet->insert(mxHelper->getColorPalette(ChartColorPaletteType::Monochromatic, i));
|
||||
}
|
||||
|
||||
void ChartColorPaletteTabPage::selectItem(const ChartColorPaletteType eType,
|
||||
const sal_uInt32 nIndex) const
|
||||
{
|
||||
switch (eType)
|
||||
{
|
||||
default:
|
||||
case ChartColorPaletteType::Unknown:
|
||||
mxColorfulValueSet->SetNoSelection();
|
||||
mxMonoValueSet->SetNoSelection();
|
||||
break;
|
||||
case ChartColorPaletteType::Colorful:
|
||||
mxMonoValueSet->SetNoSelection();
|
||||
mxColorfulValueSet->SelectItem(nIndex);
|
||||
break;
|
||||
case ChartColorPaletteType::Monochromatic:
|
||||
mxColorfulValueSet->SetNoSelection();
|
||||
mxMonoValueSet->SelectItem(nIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChartColorPaletteTabPage::FillItemSet(SfxItemSet* pOutAttrs)
|
||||
{
|
||||
ChartColorPaletteType eType = ChartColorPaletteType::Unknown;
|
||||
sal_uInt32 nIndex = 0;
|
||||
|
||||
if (!mxColorfulValueSet->IsNoSelection())
|
||||
{
|
||||
eType = ChartColorPaletteType::Colorful;
|
||||
nIndex = mxColorfulValueSet->GetSelectedItemId() - 1;
|
||||
}
|
||||
else if (!mxMonoValueSet->IsNoSelection())
|
||||
{
|
||||
eType = ChartColorPaletteType::Monochromatic;
|
||||
nIndex = mxMonoValueSet->GetSelectedItemId() - 1;
|
||||
}
|
||||
|
||||
pOutAttrs->Put(SvxChartColorPaletteItem(eType, nIndex, SCHATTR_COLOR_PALETTE));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChartColorPaletteTabPage::Reset(const SfxItemSet*)
|
||||
{
|
||||
selectItem(mxChartModel->getColorPaletteType(), mxChartModel->getColorPaletteIndex() + 1);
|
||||
}
|
||||
|
||||
DeactivateRC ChartColorPaletteTabPage::DeactivatePage(SfxItemSet* pItemSet)
|
||||
{
|
||||
if (pItemSet)
|
||||
FillItemSet(pItemSet);
|
||||
|
||||
return DeactivateRC::LeavePage;
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(ChartColorPaletteTabPage, SelectColorfulValueSetHdl, ValueSet*, void)
|
||||
{
|
||||
sal_uInt32 nIndex = SelectValueSetHdl(mxColorfulValueSet);
|
||||
if (nIndex != static_cast<sal_uInt32>(-1))
|
||||
{
|
||||
mxMonoValueSet->SetNoSelection();
|
||||
}
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(ChartColorPaletteTabPage, SelectMonoValueSetHdl, ValueSet*, void)
|
||||
{
|
||||
sal_uInt32 nIndex = SelectValueSetHdl(mxMonoValueSet);
|
||||
if (nIndex != static_cast<sal_uInt32>(-1))
|
||||
{
|
||||
mxColorfulValueSet->SetNoSelection();
|
||||
}
|
||||
}
|
||||
|
||||
sal_uInt32
|
||||
ChartColorPaletteTabPage::SelectValueSetHdl(const std::unique_ptr<ChartColorPalettes>& xValueSet)
|
||||
{
|
||||
const sal_uInt32 nItemId = xValueSet->GetSelectedItemId();
|
||||
|
||||
if (!nItemId)
|
||||
return static_cast<sal_uInt32>(-1);
|
||||
|
||||
const sal_uInt32 nIndex = nItemId - 1;
|
||||
|
||||
if (xValueSet->getPalette(nIndex))
|
||||
{
|
||||
return nIndex;
|
||||
}
|
||||
return static_cast<sal_uInt32>(-1);
|
||||
}
|
||||
} //namespace chart
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -0,0 +1,64 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* This file incorporates work covered by the following license notice:
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed
|
||||
* with this work for additional information regarding copyright
|
||||
* ownership. The ASF licenses this file to you under the Apache
|
||||
* License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sfx2/tabdlg.hxx>
|
||||
#include <ChartColorPalettes.hxx>
|
||||
|
||||
namespace chart
|
||||
{
|
||||
class ChartModel;
|
||||
class ChartColorPaletteHelper;
|
||||
|
||||
class ChartColorPaletteTabPage final : public SfxTabPage
|
||||
{
|
||||
public:
|
||||
ChartColorPaletteTabPage(weld::Container* pPage, weld::DialogController* pController,
|
||||
const SfxItemSet& rInAttrs);
|
||||
~ChartColorPaletteTabPage() override;
|
||||
|
||||
static std::unique_ptr<SfxTabPage>
|
||||
Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs);
|
||||
|
||||
bool FillItemSet(SfxItemSet* pOutAttrs) override;
|
||||
void Reset(const SfxItemSet* rInAttrs) override;
|
||||
DeactivateRC DeactivatePage(SfxItemSet* pItemSet) override;
|
||||
|
||||
void init(const rtl::Reference<ChartModel>& xChartModel);
|
||||
|
||||
private:
|
||||
void selectItem(ChartColorPaletteType eType, sal_uInt32 nIndex) const;
|
||||
void initColorPalettes() const;
|
||||
|
||||
private:
|
||||
rtl::Reference<ChartModel> mxChartModel;
|
||||
std::unique_ptr<ChartColorPaletteHelper> mxHelper;
|
||||
std::unique_ptr<ChartColorPalettes> mxColorfulValueSet;
|
||||
std::unique_ptr<weld::CustomWeld> mxColorfulValueSetWin;
|
||||
std::unique_ptr<ChartColorPalettes> mxMonoValueSet;
|
||||
std::unique_ptr<weld::CustomWeld> mxMonoValueSetWin;
|
||||
|
||||
DECL_LINK(SelectColorfulValueSetHdl, ValueSet*, void);
|
||||
DECL_LINK(SelectMonoValueSetHdl, ValueSet*, void);
|
||||
static sal_uInt32 SelectValueSetHdl(const std::unique_ptr<ChartColorPalettes>& xValueSet);
|
||||
};
|
||||
} //namespace chart
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -20,10 +20,14 @@
|
||||
|
||||
#include "ItemConverter.hxx"
|
||||
|
||||
#include <rtl/ref.hxx>
|
||||
|
||||
namespace com::sun::star::lang { class XMultiServiceFactory; }
|
||||
|
||||
class SdrModel;
|
||||
|
||||
namespace chart { class ChartModel; }
|
||||
|
||||
namespace chart::wrapper
|
||||
{
|
||||
|
||||
@@ -57,6 +61,7 @@ private:
|
||||
GraphicObjectType m_GraphicObjectType;
|
||||
SdrModel & m_rDrawModel;
|
||||
css::uno::Reference< css::lang::XMultiServiceFactory > m_xNamedPropertyTableFactory;
|
||||
rtl::Reference<ChartModel> m_xChartModel;
|
||||
};
|
||||
|
||||
} // namespace chart::wrapper
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
|
||||
#include <GraphicPropertyItemConverter.hxx>
|
||||
#include "SchWhichPairs.hxx"
|
||||
#include <ChartModel.hxx>
|
||||
#include <ItemPropertyMap.hxx>
|
||||
#include <PropertyHelper.hxx>
|
||||
#include <CommonConverters.hxx>
|
||||
#include <editeng/memberids.h>
|
||||
#include <svx/chrtitem.hxx>
|
||||
#include <svx/unomid.hxx>
|
||||
#include <svx/xflbmtit.hxx>
|
||||
#include <svx/xflbstit.hxx>
|
||||
@@ -144,7 +146,11 @@ GraphicPropertyItemConverter::GraphicPropertyItemConverter(
|
||||
m_GraphicObjectType( eObjectType ),
|
||||
m_rDrawModel( rDrawModel ),
|
||||
m_xNamedPropertyTableFactory(std::move( xNamedPropertyContainerFactory ))
|
||||
{}
|
||||
{
|
||||
m_xChartModel = dynamic_cast<ChartModel*>(m_xNamedPropertyTableFactory.get());
|
||||
DBG_ASSERT(m_xChartModel.is(),
|
||||
"GraphicPropertyItemConverter ctor: passed XMultiServiceFactory parameter is not a ChartModel instance.");
|
||||
}
|
||||
|
||||
GraphicPropertyItemConverter::~GraphicPropertyItemConverter()
|
||||
{}
|
||||
@@ -168,6 +174,11 @@ const WhichRangesContainer& GraphicPropertyItemConverter::GetWhichPairs() const
|
||||
|
||||
bool GraphicPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
|
||||
{
|
||||
if (nWhichId == SCHATTR_COLOR_PALETTE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemPropertyMapType::const_iterator aEndIt;
|
||||
ItemPropertyMapType::const_iterator aIt;
|
||||
|
||||
@@ -742,6 +753,15 @@ bool GraphicPropertyItemConverter::ApplySpecialItem(
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SCHATTR_COLOR_PALETTE:
|
||||
{
|
||||
const auto& rItem = static_cast<const SvxChartColorPaletteItem&>(rItemSet.Get(nWhichId));
|
||||
m_xChartModel->setColorPalette(rItem.GetType(), rItem.GetIndex());
|
||||
const auto oColorPalette = m_xChartModel->getCurrentColorPalette();
|
||||
if (oColorPalette)
|
||||
m_xChartModel->applyColorPaletteToDataSeries(*oColorPalette);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return bChanged;
|
||||
|
||||
@@ -59,6 +59,7 @@ const WhichRangesContainer nGridWhichPairs(svl::Items<
|
||||
|
||||
const WhichRangesContainer nLegendWhichPairs(svl::Items<
|
||||
SCHATTR_LEGEND_START, SCHATTR_LEGEND_END, // 3 - 3 sch/schattr.hxx
|
||||
SCHATTR_COLOR_PALETTE_START, SCHATTR_COLOR_PALETTE_END, // 107 - 107
|
||||
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
|
||||
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
|
||||
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
|
||||
@@ -121,6 +122,7 @@ const WhichRangesContainer nRowWhichPairs(svl::Items<
|
||||
SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY,
|
||||
SCHATTR_BAR_OVERLAP,SCHATTR_BAR_CONNECT, /* 98 - 100 (incl. SCHATTR_GAPWIDTH) */
|
||||
SCHATTR_GROUP_BARS_PER_AXIS,SCHATTR_AXIS_FOR_ALL_SERIES,
|
||||
SCHATTR_COLOR_PALETTE_START, SCHATTR_COLOR_PALETTE_END, // 107 - 107
|
||||
XATTR_LINE_FIRST, XATTR_LINE_LAST, /* 1000 - 1016 svx/xdef.hxx */
|
||||
XATTR_FILL_FIRST, XATTR_FILL_LAST, /* 1018 - 1046 svx/xdef.hxx */
|
||||
SDRATTR_3D_FIRST, SDRATTR_3D_LAST, /* 1244 - 1334 svx/svddef.hxx */
|
||||
@@ -152,6 +154,7 @@ const WhichRangesContainer nLinePropertyWhichPairs(svl::Items<
|
||||
>);
|
||||
|
||||
const WhichRangesContainer nLineAndFillPropertyWhichPairs(svl::Items<
|
||||
SCHATTR_COLOR_PALETTE_START, SCHATTR_COLOR_PALETTE_END, // 107 - 107
|
||||
XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
|
||||
XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx
|
||||
SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST // 1067 - 1078 svx/svddef.hxx
|
||||
|
||||
@@ -33,6 +33,7 @@ class SvxChartKindErrorItem;
|
||||
class SvxChartTextOrderItem;
|
||||
class SvxChartRegressItem;
|
||||
class SdrAngleItem;
|
||||
class SvxChartColorPaletteItem;
|
||||
|
||||
// SCHATTR
|
||||
|
||||
@@ -201,7 +202,11 @@ inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_OUTLINE
|
||||
inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_KEYS (SCHATTR_DATA_TABLE_START + 3);
|
||||
inline constexpr sal_uInt16 SCHATTR_DATA_TABLE_END (SCHATTR_DATA_TABLE_KEYS);
|
||||
|
||||
inline constexpr sal_uInt16 SCHATTR_END (SCHATTR_DATA_TABLE_END);
|
||||
inline constexpr sal_uInt16 SCHATTR_COLOR_PALETTE_START (SCHATTR_DATA_TABLE_END + 1);
|
||||
inline constexpr TypedWhichId<SvxChartColorPaletteItem> SCHATTR_COLOR_PALETTE (SCHATTR_COLOR_PALETTE_START);
|
||||
inline constexpr sal_uInt16 SCHATTR_COLOR_PALETTE_END (SCHATTR_COLOR_PALETTE);
|
||||
|
||||
inline constexpr sal_uInt16 SCHATTR_END (SCHATTR_COLOR_PALETTE_END);
|
||||
|
||||
// values for Items
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <svx/sdangitm.hxx>
|
||||
#include <svx/svdpool.hxx>
|
||||
#include <svx/svx3ditems.hxx>
|
||||
#include <svx/ChartColorPaletteType.hxx>
|
||||
#include <svl/intitem.hxx>
|
||||
#include <editeng/editeng.hxx>
|
||||
#include <editeng/brushitem.hxx>
|
||||
@@ -179,7 +180,9 @@ static ItemInfoPackage& getItemInfoPackageChart()
|
||||
{ SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, new SfxBoolItem(SCHATTR_DATA_TABLE_HORIZONTAL_BORDER, false), 0, SFX_ITEMINFOFLAG_NONE },
|
||||
{ SCHATTR_DATA_TABLE_VERTICAL_BORDER, new SfxBoolItem(SCHATTR_DATA_TABLE_VERTICAL_BORDER, false), 0, SFX_ITEMINFOFLAG_NONE },
|
||||
{ SCHATTR_DATA_TABLE_OUTLINE, new SfxBoolItem(SCHATTR_DATA_TABLE_OUTLINE, false), 0, SFX_ITEMINFOFLAG_NONE },
|
||||
{ SCHATTR_DATA_TABLE_KEYS, new SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, false), 0, SFX_ITEMINFOFLAG_NONE }
|
||||
{ SCHATTR_DATA_TABLE_KEYS, new SfxBoolItem(SCHATTR_DATA_TABLE_KEYS, false), 0, SFX_ITEMINFOFLAG_NONE },
|
||||
{ SCHATTR_COLOR_PALETTE, new SvxChartColorPaletteItem(ChartColorPaletteType::Unknown, 0, SCHATTR_COLOR_PALETTE), 0, SFX_ITEMINFOFLAG_NONE }
|
||||
|
||||
}};
|
||||
|
||||
virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; }
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.40.0 -->
|
||||
<interface domain="chart">
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkBox" id="tp_ChartColorPalette">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-top">4</property>
|
||||
<property name="margin-bottom">4</property>
|
||||
<property name="spacing">16</property>
|
||||
<child>
|
||||
<object class="GtkFrame" id="FL_COLORFUL">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="margin-top">3</property>
|
||||
<property name="label-xalign">0</property>
|
||||
<property name="shadow-type">none</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="colorfulwin">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="colorful_palettes">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="LBL_COLORFUL">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-bottom">2</property>
|
||||
<property name="label" translatable="yes" context="tp_ChartColorPalette|colorfulwin">Colorful</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">8</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="FL_MONOCHROMATIC">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-start">4</property>
|
||||
<property name="margin-end">4</property>
|
||||
<property name="margin-top">3</property>
|
||||
<property name="label-xalign">0</property>
|
||||
<property name="shadow-type">none</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="monochromaticwin">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="monochromatic_palettes">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="valign">start</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="LBL_MONOCHROMATIC">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-bottom">2</property>
|
||||
<property name="label" translatable="yes" context="tp_ChartColorPalette|monochromaticwin">Monochromatic</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">8</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -322,6 +322,7 @@ enum class SfxItemType : sal_uInt16
|
||||
SvxCharReliefItemType,
|
||||
SvxCharRotateItemType,
|
||||
SvxCharScaleWidthItemType,
|
||||
SvxChartColorPaletteItemType,
|
||||
SvxChartColorTableItemType,
|
||||
SvxChartIndicateItemType,
|
||||
SvxChartKindErrorItemType,
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include <svl/poolitem.hxx>
|
||||
#include <svx/svxdllapi.h>
|
||||
|
||||
enum class ChartColorPaletteType: sal_Int32;
|
||||
|
||||
enum class SvxChartTextOrder
|
||||
{
|
||||
SideBySide,
|
||||
@@ -150,6 +152,35 @@ public:
|
||||
double GetValue() const { return m_fVal; }
|
||||
};
|
||||
|
||||
class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC SvxChartColorPaletteItem final : public SfxPoolItem
|
||||
{
|
||||
ChartColorPaletteType meType;
|
||||
sal_uInt32 mnIndex;
|
||||
|
||||
public:
|
||||
static SfxPoolItem* CreateDefault();
|
||||
DECLARE_ITEM_TYPE_FUNCTION(SvxChartColorPaletteItem);
|
||||
SvxChartColorPaletteItem(ChartColorPaletteType eType, sal_uInt32 nIndex,
|
||||
TypedWhichId<SvxChartColorPaletteItem> nId);
|
||||
SvxChartColorPaletteItem(const SvxChartColorPaletteItem& rItem);
|
||||
|
||||
virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override;
|
||||
virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
|
||||
|
||||
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric,
|
||||
MapUnit ePresMetric, OUString& rText,
|
||||
const IntlWrapper&) const override;
|
||||
|
||||
virtual bool operator==(const SfxPoolItem& rItem) const override;
|
||||
virtual SvxChartColorPaletteItem* Clone(SfxItemPool* pPool = nullptr) const override;
|
||||
|
||||
ChartColorPaletteType GetType() const { return meType; }
|
||||
sal_uInt32 GetIndex() const { return mnIndex; }
|
||||
|
||||
void SetType(const ChartColorPaletteType eType) { meType = eType; }
|
||||
void SetIndex(const sal_uInt32 nIndex) { mnIndex = nIndex; }
|
||||
};
|
||||
|
||||
#endif // INCLUDED_SVX_CHRTITEM_HXX
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -93,6 +93,10 @@
|
||||
|
||||
#define MID_LEFT 3
|
||||
|
||||
// SvxChartColorPaletteItem
|
||||
#define MID_CHART_COLOR_PALETTE_TYPE 0
|
||||
#define MID_CHART_COLOR_PALETTE_INDEX 1
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -22,7 +22,10 @@
|
||||
#include <unotools/localedatawrapper.hxx>
|
||||
#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
|
||||
#include <o3tl/hash_combine.hxx>
|
||||
|
||||
#include <svx/ChartColorPaletteType.hxx>
|
||||
#include <svx/chrtitem.hxx>
|
||||
#include <svx/unomid.hxx>
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
@@ -176,4 +179,89 @@ SvxChartRegressItem* SvxChartRegressItem::Clone(SfxItemPool* /*pPool*/) const
|
||||
return new SvxChartRegressItem(*this);
|
||||
}
|
||||
|
||||
// SvxChartColorPaletteItem implementation
|
||||
|
||||
SfxPoolItem* SvxChartColorPaletteItem::CreateDefault()
|
||||
{
|
||||
return new SvxChartColorPaletteItem(ChartColorPaletteType::Unknown, 0,
|
||||
TypedWhichId<SvxChartColorPaletteItem>(0));
|
||||
}
|
||||
|
||||
SvxChartColorPaletteItem::SvxChartColorPaletteItem(const ChartColorPaletteType eType,
|
||||
const sal_uInt32 nIndex,
|
||||
const TypedWhichId<SvxChartColorPaletteItem> nId)
|
||||
: SfxPoolItem(nId)
|
||||
, meType(eType)
|
||||
, mnIndex(nIndex)
|
||||
{
|
||||
}
|
||||
|
||||
SvxChartColorPaletteItem::SvxChartColorPaletteItem(const SvxChartColorPaletteItem& rItem)
|
||||
: SfxPoolItem(rItem)
|
||||
, meType(rItem.meType)
|
||||
, mnIndex(rItem.mnIndex)
|
||||
{
|
||||
}
|
||||
|
||||
bool SvxChartColorPaletteItem::QueryValue(uno::Any& rVal, const sal_uInt8 nMemberId) const
|
||||
{
|
||||
if (nMemberId == MID_CHART_COLOR_PALETTE_TYPE)
|
||||
{
|
||||
rVal <<= static_cast<sal_Int32>(meType);
|
||||
return true;
|
||||
}
|
||||
if (nMemberId == MID_CHART_COLOR_PALETTE_INDEX)
|
||||
{
|
||||
rVal <<= mnIndex;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SvxChartColorPaletteItem::PutValue(const uno::Any& rVal, const sal_uInt8 nMemberId)
|
||||
{
|
||||
if (nMemberId == MID_CHART_COLOR_PALETTE_TYPE)
|
||||
{
|
||||
sal_Int32 nType = -1;
|
||||
rVal >>= nType;
|
||||
meType = static_cast<ChartColorPaletteType>(nType);
|
||||
return true;
|
||||
}
|
||||
if (nMemberId == MID_CHART_COLOR_PALETTE_INDEX)
|
||||
{
|
||||
rVal >>= mnIndex;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SvxChartColorPaletteItem::GetPresentation(SfxItemPresentation /*ePres*/,
|
||||
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
|
||||
OUString& rText, const IntlWrapper&) const
|
||||
{
|
||||
if (meType == ChartColorPaletteType::Colorful)
|
||||
rText = u"Colorful"_ustr;
|
||||
else if (meType == ChartColorPaletteType::Monochromatic)
|
||||
rText = u"Monochromatic"_ustr;
|
||||
else
|
||||
rText = u"Unknown"_ustr;
|
||||
|
||||
rText += u" "_ustr;
|
||||
rText += OUString::number(mnIndex);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SvxChartColorPaletteItem::operator==(const SfxPoolItem& rItem) const
|
||||
{
|
||||
assert(SfxPoolItem::operator==(rItem));
|
||||
const auto& rOther = static_cast<const SvxChartColorPaletteItem&>(rItem);
|
||||
return (meType == rOther.meType && mnIndex == rOther.mnIndex);
|
||||
}
|
||||
|
||||
SvxChartColorPaletteItem* SvxChartColorPaletteItem::Clone(SfxItemPool* /*pPool*/) const
|
||||
{
|
||||
return new SvxChartColorPaletteItem(*this);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -285,6 +285,7 @@ constexpr auto SchartDialogList
|
||||
{ u"modules/schart/ui/inserttitledlg.ui" },
|
||||
{ u"modules/schart/ui/smoothlinesdlg.ui" },
|
||||
{ u"modules/schart/ui/steppedlinesdlg.ui" },
|
||||
{ u"modules/schart/ui/tp_ChartColorPalette.ui" },
|
||||
{ u"modules/schart/ui/tp_ChartType.ui" },
|
||||
{ u"modules/schart/ui/tp_DataLabel.ui" },
|
||||
{ u"modules/schart/ui/tp_DataSource.ui" },
|
||||
|
||||
Reference in New Issue
Block a user