use more concrete types in chart2, ChartModel

Change-Id: Ic3020221111fea9c1026a91c72f7a2d1d5da42dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128666
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2022-01-20 16:04:37 +02:00
parent 81a5ba3cfc
commit 19e962d15c
16 changed files with 144 additions and 152 deletions

View File

@@ -14,6 +14,7 @@
#include "ChartAreaPanel.hxx"
#include <ChartController.hxx>
#include <ChartModel.hxx>
#include <ViewElementListProvider.hxx>
#include <PropertyHelper.hxx>
@@ -41,7 +42,7 @@ SvxColorToolBoxControl* getColorToolBoxControl(const ToolbarUnoDispatcher& rColo
return pToolBoxColorControl;
}
OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
OUString getCID(const rtl::Reference<::chart::ChartModel>& xModel)
{
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
@@ -72,7 +73,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
css::uno::Reference<css::beans::XPropertySet> getPropSet(
const css::uno::Reference<css::frame::XModel>& xModel)
const rtl::Reference<::chart::ChartModel>& xModel)
{
OUString aCID = getCID(xModel);
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -273,7 +274,7 @@ ChartAreaPanel::ChartAreaPanel(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController):
svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame),
mxModel(pController->getModel()),
mxModel(pController->getChartModel()),
mxListener(new ChartSidebarModifyListener(this)),
mxSelectionListener(new ChartSidebarSelectionListener(this)),
mbUpdate(true),
@@ -294,8 +295,7 @@ ChartAreaPanel::~ChartAreaPanel()
void ChartAreaPanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
@@ -334,7 +334,7 @@ void ChartAreaPanel::setFillFloatTransparence(
const OUString& aName = rItem.GetName();
css::uno::Any aGradientVal;
rItem.QueryValue(aGradientVal, MID_FILLGRADIENT);
OUString aNewName = PropertyHelper::addTransparencyGradientUniqueNameToTable(aGradientVal, css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY_THROW), aName);
OUString aNewName = PropertyHelper::addTransparencyGradientUniqueNameToTable(aGradientVal, mxModel, aName);
xPropSet->setPropertyValue("FillTransparenceGradientName", css::uno::Any(aNewName));
}
@@ -374,7 +374,7 @@ void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
const OUString& aName = rGradientItem.GetName();
css::uno::Any aGradientVal;
rGradientItem.QueryValue(aGradientVal, MID_FILLGRADIENT);
OUString aNewName = PropertyHelper::addGradientUniqueNameToTable(aGradientVal, css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY_THROW), aName);
OUString aNewName = PropertyHelper::addGradientUniqueNameToTable(aGradientVal, mxModel, aName);
xPropSet->setPropertyValue("FillGradientName", css::uno::Any(aNewName));
}
@@ -405,7 +405,7 @@ void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
css::uno::Any aBitmap;
rBitmapItem.QueryValue(aBitmap, MID_BITMAP);
const OUString& aPreferredName = rBitmapItem.GetName();
aBitmap <<= PropertyHelper::addBitmapUniqueNameToTable(aBitmap, css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY_THROW), aPreferredName);
aBitmap <<= PropertyHelper::addBitmapUniqueNameToTable(aBitmap, mxModel, aPreferredName);
xPropSet->setPropertyValue("FillBitmapName", aBitmap);
}
@@ -507,12 +507,11 @@ void ChartAreaPanel::selectionChanged(bool bCorrectType)
updateData();
}
void ChartAreaPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
void ChartAreaPanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
mxModel->removeModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
mxModel->getCurrentController(), css::uno::UNO_QUERY);
@@ -527,8 +526,7 @@ void ChartAreaPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMode
if (!mbModelValid)
return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
@@ -537,7 +535,9 @@ void ChartAreaPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMode
void ChartAreaPanel::updateModel( css::uno::Reference<css::frame::XModel> xModel)
{
doUpdateModel(xModel);
::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
assert(!xModel || pModel);
doUpdateModel(pModel);
}

View File

@@ -67,12 +67,12 @@ public:
private:
css::uno::Reference<css::frame::XModel> mxModel;
rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
rtl::Reference<ChartSidebarSelectionListener> mxSelectionListener;
void Initialize();
void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
void doUpdateModel(rtl::Reference<::chart::ChartModel> xModel);
bool mbUpdate;
bool mbModelValid;

View File

@@ -28,6 +28,7 @@
#include "ChartAxisPanel.hxx"
#include <ChartController.hxx>
#include <ChartModel.hxx>
using namespace css;
using namespace css::uno;
@@ -36,7 +37,7 @@ namespace chart::sidebar {
namespace {
bool isLabelShown(const css::uno::Reference<css::frame::XModel>& xModel,
bool isLabelShown(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID)
{
css::uno::Reference< css::beans::XPropertySet > xAxis(
@@ -54,7 +55,7 @@ bool isLabelShown(const css::uno::Reference<css::frame::XModel>& xModel,
return bVisible;
}
void setLabelShown(const css::uno::Reference<css::frame::XModel>& xModel,
void setLabelShown(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, bool bVisible)
{
css::uno::Reference< css::beans::XPropertySet > xAxis(
@@ -79,7 +80,7 @@ AxisLabelPosMap const aLabelPosMap[] = {
{ 3, css::chart::ChartAxisLabelPosition_OUTSIDE_END }
};
sal_Int32 getLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel,
sal_Int32 getLabelPosition(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID)
{
css::uno::Reference< css::beans::XPropertySet > xAxis(
@@ -103,7 +104,7 @@ sal_Int32 getLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel
return 0;
}
void setLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel,
void setLabelPosition(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, sal_Int32 nPos)
{
css::uno::Reference< css::beans::XPropertySet > xAxis(
@@ -122,7 +123,7 @@ void setLabelPosition(const css::uno::Reference<css::frame::XModel>& xModel,
xAxis->setPropertyValue("LabelPosition", css::uno::Any(ePos));
}
bool isReverse(const css::uno::Reference<css::frame::XModel>& xModel,
bool isReverse(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID)
{
css::uno::Reference< css::chart2::XAxis > xAxis =
@@ -136,7 +137,7 @@ bool isReverse(const css::uno::Reference<css::frame::XModel>& xModel,
return aData.Orientation == css::chart2::AxisOrientation_REVERSE;
}
void setReverse(const css::uno::Reference<css::frame::XModel>& xModel,
void setReverse(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, bool bReverse)
{
css::uno::Reference< css::chart2::XAxis > xAxis =
@@ -174,7 +175,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
return aCID;
}
void setAxisRotation(const css::uno::Reference<css::frame::XModel>& xModel,
void setAxisRotation(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, double nVal)
{
css::uno::Reference< css::beans::XPropertySet > xAxis(
@@ -186,7 +187,7 @@ void setAxisRotation(const css::uno::Reference<css::frame::XModel>& xModel,
xAxis->setPropertyValue("TextRotation", css::uno::Any(nVal));
}
double getAxisRotation(const css::uno::Reference<css::frame::XModel>& xModel,
double getAxisRotation(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID)
{
css::uno::Reference< css::beans::XPropertySet > xAxis(
@@ -212,7 +213,7 @@ ChartAxisPanel::ChartAxisPanel(
, mxLBLabelPos(m_xBuilder->weld_combo_box("comboboxtext_label_position"))
, mxGridLabel(m_xBuilder->weld_widget("label_props"))
, mxNFRotation(m_xBuilder->weld_metric_spin_button("spinbutton1", FieldUnit::DEGREE))
, mxModel(pController->getModel())
, mxModel(pController->getChartModel())
, mxModifyListener(new ChartSidebarModifyListener(this))
, mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_AXIS))
, mbModelValid(true)
@@ -235,8 +236,7 @@ ChartAxisPanel::~ChartAxisPanel()
void ChartAxisPanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxModifyListener);
mxModel->addModifyListener(mxModifyListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
@@ -306,12 +306,11 @@ void ChartAxisPanel::modelInvalid()
mbModelValid = false;
}
void ChartAxisPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
void ChartAxisPanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxModifyListener);
mxModel->removeModifyListener(mxModifyListener);
css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
mxModel->getCurrentController(), css::uno::UNO_QUERY);
@@ -326,8 +325,7 @@ void ChartAxisPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMode
if (!mbModelValid)
return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxModifyListener);
mxModel->addModifyListener(mxModifyListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
@@ -336,7 +334,9 @@ void ChartAxisPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMode
void ChartAxisPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
{
doUpdateModel(xModel);
::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
assert(!xModel || pModel);
doUpdateModel(pModel);
}
void ChartAxisPanel::selectionChanged(bool bCorrectType)

View File

@@ -74,14 +74,14 @@ private:
std::unique_ptr<weld::Widget> mxGridLabel;
std::unique_ptr<weld::MetricSpinButton> mxNFRotation;
css::uno::Reference<css::frame::XModel> mxModel;
rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxModifyListener;
css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
bool mbModelValid;
void Initialize();
void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
void doUpdateModel(rtl::Reference<::chart::ChartModel> xModel);
DECL_LINK(CheckBoxHdl, weld::Toggleable&, void);
DECL_LINK(ListBoxHdl, weld::ComboBox&, void);

View File

@@ -12,6 +12,7 @@
#include <string_view>
#include "ChartColorWrapper.hxx"
#include <ChartModel.hxx>
#include <ObjectIdentifier.hxx>
#include <PropertyHelper.hxx>
@@ -53,7 +54,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
css::uno::Reference<css::beans::XPropertySet> getPropSet(
const css::uno::Reference<css::frame::XModel>& xModel)
const rtl::Reference<::chart::ChartModel>& xModel)
{
OUString aCID = getCID(xModel);
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -76,7 +77,7 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
}
ChartColorWrapper::ChartColorWrapper(
css::uno::Reference<css::frame::XModel> const & xModel,
rtl::Reference<::chart::ChartModel> const & xModel,
SvxColorToolBoxControl* pControl,
const OUString& rName):
mxModel(xModel),
@@ -98,7 +99,7 @@ void ChartColorWrapper::operator()([[maybe_unused]] const OUString& , const svx:
xPropSet->setPropertyValue(maPropertyName, css::uno::makeAny(rColor.m_aColor));
}
void ChartColorWrapper::updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
void ChartColorWrapper::updateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
mxModel = xModel;
}
@@ -133,14 +134,14 @@ void ChartColorWrapper::updateData()
}
ChartLineStyleWrapper::ChartLineStyleWrapper(
css::uno::Reference<css::frame::XModel> const & xModel,
rtl::Reference<::chart::ChartModel> const & xModel,
SvxLineStyleToolBoxControl* pControl)
: mxModel(xModel)
, mpControl(pControl)
{
}
void ChartLineStyleWrapper::updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
void ChartLineStyleWrapper::updateModel(const rtl::Reference<::chart::ChartModel>& xModel)
{
mxModel = xModel;
}
@@ -218,7 +219,7 @@ bool ChartLineStyleWrapper::operator()(std::u16string_view rCommand, const css::
css::uno::Any aAny;
aDashItem.QueryValue(aAny, MID_LINEDASH);
OUString aDashName = PropertyHelper::addLineDashUniqueNameToTable(aAny,
css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY),
mxModel,
"");
xPropSet->setPropertyValue("LineDash", aAny);
xPropSet->setPropertyValue("LineDashName", css::uno::Any(aDashName));

View File

@@ -11,9 +11,10 @@
#include <com/sun/star/uno/Reference.hxx>
#include <svx/Palette.hxx>
#include <rtl/ref.hxx>
namespace com::sun::star::frame { class XModel; }
namespace chart { class ChartModel; }
class SvxColorToolBoxControl;
class SvxLineStyleToolBoxControl;
@@ -22,20 +23,20 @@ namespace chart::sidebar {
class ChartColorWrapper
{
public:
ChartColorWrapper(css::uno::Reference<css::frame::XModel> const & xModel,
ChartColorWrapper(rtl::Reference<::chart::ChartModel> const & xModel,
SvxColorToolBoxControl* pControl,
const OUString& rPropertyName);
void operator()(const OUString& rCommand, const svx::NamedThemedColor& rColor);
// ColorSelectFunction signature
void updateModel(const css::uno::Reference<css::frame::XModel>& xModel);
void updateModel(const rtl::Reference<::chart::ChartModel>& xModel);
void updateData();
private:
css::uno::Reference<css::frame::XModel> mxModel;
rtl::Reference<::chart::ChartModel> mxModel;
SvxColorToolBoxControl* mpControl;
@@ -45,18 +46,18 @@ private:
class ChartLineStyleWrapper
{
public:
ChartLineStyleWrapper(css::uno::Reference<css::frame::XModel> const & xModel,
ChartLineStyleWrapper(rtl::Reference<::chart::ChartModel> const & xModel,
SvxLineStyleToolBoxControl* pControl);
bool operator()(std::u16string_view rCommand, const css::uno::Any& rValue);
void updateModel(const css::uno::Reference<css::frame::XModel>& xModel);
void updateModel(const rtl::Reference<::chart::ChartModel>& xModel);
void updateData();
private:
css::uno::Reference<css::frame::XModel> mxModel;
rtl::Reference<::chart::ChartModel> mxModel;
SvxLineStyleToolBoxControl* mpControl;
};

View File

@@ -144,7 +144,7 @@ void setLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel, boo
xLegendProp->setPropertyValue("Overlay", css::uno::Any(bOverlay));
}
bool isTitleVisible(const css::uno::Reference<css::frame::XModel>& xModel, TitleHelper::eTitleType eTitle)
bool isTitleVisible(const rtl::Reference<::chart::ChartModel>& xModel, TitleHelper::eTitleType eTitle)
{
css::uno::Reference<css::uno::XInterface> xTitle = TitleHelper::getTitle(eTitle, xModel);
if (!xTitle.is())
@@ -156,7 +156,7 @@ bool isTitleVisible(const css::uno::Reference<css::frame::XModel>& xModel, Title
return bVisible;
}
bool isGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridType eType)
bool isGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType eType)
{
rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(xModel));
if(xDiagram.is())
@@ -173,7 +173,7 @@ bool isGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridTy
return false;
}
void setGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridType eType, bool bVisible)
void setGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType eType, bool bVisible)
{
rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(xModel));
if(!xDiagram.is())
@@ -193,7 +193,7 @@ void setGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridT
AxisHelper::hideGrid(nDimensionIndex, nCooSysIndex, bMajor, xDiagram);
}
bool isAxisVisible(const css::uno::Reference<css::frame::XModel>& xModel, AxisType eType)
bool isAxisVisible(const rtl::Reference<::chart::ChartModel>& xModel, AxisType eType)
{
rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(xModel));
if(xDiagram.is())
@@ -212,7 +212,7 @@ bool isAxisVisible(const css::uno::Reference<css::frame::XModel>& xModel, AxisTy
return false;
}
void setAxisVisible(const css::uno::Reference<css::frame::XModel>& xModel, AxisType eType, bool bVisible)
void setAxisVisible(const rtl::Reference<::chart::ChartModel>& xModel, AxisType eType, bool bVisible)
{
rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(xModel));
if(!xDiagram.is())
@@ -327,7 +327,7 @@ ChartElementsPanel::ChartElementsPanel(
, mxLBGrid(m_xBuilder->weld_label("label_gri"))
, mxLBLegendPosition(m_xBuilder->weld_combo_box("comboboxtext_legend"))
, mxBoxLegend(m_xBuilder->weld_widget("box_legend"))
, mxModel(pController->getModel())
, mxModel(pController->getChartModel())
, mxListener(new ChartSidebarModifyListener(this))
, mbModelValid(true)
{
@@ -374,8 +374,7 @@ ChartElementsPanel::~ChartElementsPanel()
void ChartElementsPanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
updateData();
Link<weld::Toggleable&,void> aLink = LINK(this, ChartElementsPanel, CheckBoxHdl);
@@ -563,12 +562,11 @@ void ChartElementsPanel::modelInvalid()
mbModelValid = false;
}
void ChartElementsPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
void ChartElementsPanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
mxModel->removeModifyListener(mxListener);
}
mxModel = xModel;
@@ -577,13 +575,14 @@ void ChartElementsPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> x
if (!mbModelValid)
return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
}
void ChartElementsPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
{
doUpdateModel(xModel);
::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
assert(!xModel || pModel);
doUpdateModel(pModel);
}
IMPL_LINK(ChartElementsPanel, CheckBoxHdl, weld::Toggleable&, rCheckBox, void)

View File

@@ -93,7 +93,7 @@ private:
vcl::EnumContext maContext;
css::uno::Reference<css::frame::XModel> mxModel;
rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
bool mbModelValid;
@@ -102,7 +102,7 @@ private:
OUString maTextSubTitle;
void Initialize();
void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
void doUpdateModel(rtl::Reference<::chart::ChartModel> xModel);
void setTitleVisible(TitleHelper::eTitleType eTitle, bool bVisible);

View File

@@ -23,6 +23,7 @@
#include "ChartErrorBarPanel.hxx"
#include <ChartController.hxx>
#include <ChartModel.hxx>
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
@@ -41,12 +42,12 @@ enum class ErrorBarDirection
};
css::uno::Reference<css::beans::XPropertySet> getErrorBarPropSet(
const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rCID)
const rtl::Reference<::chart::ChartModel>& xModel, const OUString& rCID)
{
return ObjectIdentifier::getObjectPropertySet(rCID, xModel);
}
bool showPositiveError(const css::uno::Reference<css::frame::XModel>& xModel,
bool showPositiveError(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -65,7 +66,7 @@ bool showPositiveError(const css::uno::Reference<css::frame::XModel>& xModel,
return bShow;
}
bool showNegativeError(const css::uno::Reference<css::frame::XModel>& xModel,
bool showNegativeError(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -84,7 +85,7 @@ bool showNegativeError(const css::uno::Reference<css::frame::XModel>& xModel,
return bShow;
}
void setShowPositiveError(const css::uno::Reference<css::frame::XModel>& xModel,
void setShowPositiveError(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, bool bShow)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -96,7 +97,7 @@ void setShowPositiveError(const css::uno::Reference<css::frame::XModel>& xModel,
xPropSet->setPropertyValue("ShowPositiveError", css::uno::Any(bShow));
}
void setShowNegativeError(const css::uno::Reference<css::frame::XModel>& xModel,
void setShowNegativeError(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, bool bShow)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -124,7 +125,7 @@ ErrorBarTypeMap const aErrorBarType[] = {
{ 6, css::chart::ErrorBarStyle::ERROR_MARGIN },
};
sal_Int32 getTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
sal_Int32 getTypePos(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -150,7 +151,7 @@ sal_Int32 getTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
return 0;
}
void setTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
void setTypePos(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, sal_Int32 nPos)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -169,7 +170,7 @@ void setTypePos(const css::uno::Reference<css::frame::XModel>& xModel,
xPropSet->setPropertyValue("ErrorBarStyle", css::uno::Any(nApi));
}
double getValue(const css::uno::Reference<css::frame::XModel>& xModel,
double getValue(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, ErrorBarDirection eDir)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -193,7 +194,7 @@ double getValue(const css::uno::Reference<css::frame::XModel>& xModel,
return nVal;
}
void setValue(const css::uno::Reference<css::frame::XModel>& xModel,
void setValue(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, double nVal, ErrorBarDirection eDir)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -209,7 +210,7 @@ void setValue(const css::uno::Reference<css::frame::XModel>& xModel,
xPropSet->setPropertyValue(aName, css::uno::Any(nVal));
}
OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
OUString getCID(const rtl::Reference<::chart::ChartModel>& xModel)
{
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
@@ -242,7 +243,7 @@ ChartErrorBarPanel::ChartErrorBarPanel(weld::Widget* pParent, ChartController* p
, mxLBType(m_xBuilder->weld_combo_box("comboboxtext_type"))
, mxMFPos(m_xBuilder->weld_spin_button("spinbutton_pos"))
, mxMFNeg(m_xBuilder->weld_spin_button("spinbutton_neg"))
, mxModel(pController->getModel())
, mxModel(pController->getChartModel())
, mxListener(new ChartSidebarModifyListener(this))
, mbModelValid(true)
{
@@ -265,8 +266,7 @@ ChartErrorBarPanel::~ChartErrorBarPanel()
void ChartErrorBarPanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
mxRBNeg->set_active(false);
mxRBPos->set_active(false);
mxRBPosAndNeg->set_active(false);
@@ -370,12 +370,11 @@ void ChartErrorBarPanel::modelInvalid()
mbModelValid = false;
}
void ChartErrorBarPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
void ChartErrorBarPanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
mxModel->removeModifyListener(mxListener);
}
mxModel = xModel;
@@ -384,13 +383,14 @@ void ChartErrorBarPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> x
if (!mbModelValid)
return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
}
void ChartErrorBarPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
{
doUpdateModel(xModel);
::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
assert(!xModel || pModel);
doUpdateModel(pModel);
}
IMPL_LINK_NOARG(ChartErrorBarPanel, RadioBtnHdl, weld::Toggleable&, void)

View File

@@ -21,6 +21,7 @@ namespace com::sun::star::util { class XModifyListener; }
namespace chart {
class ChartController;
class ChartModel;
namespace sidebar {
@@ -72,13 +73,13 @@ private:
std::unique_ptr<weld::SpinButton> mxMFPos;
std::unique_ptr<weld::SpinButton> mxMFNeg;
css::uno::Reference<css::frame::XModel> mxModel;
rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
bool mbModelValid;
void Initialize();
void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
void doUpdateModel(rtl::Reference<::chart::ChartModel> xModel);
DECL_LINK(RadioBtnHdl, weld::Toggleable&, void);
DECL_LINK(ListBoxHdl, weld::ComboBox&, void);

View File

@@ -10,6 +10,7 @@
#include "ChartLinePanel.hxx"
#include <ChartController.hxx>
#include <ChartModel.hxx>
#include <svx/xlnwtit.hxx>
#include <svx/xlinjoit.hxx>
@@ -46,7 +47,7 @@ SvxColorToolBoxControl* getColorToolBoxControl(const ToolbarUnoDispatcher& rTool
return pToolBoxColorControl;
}
OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
OUString getCID(const rtl::Reference<::chart::ChartModel>& xModel)
{
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
@@ -67,7 +68,7 @@ OUString getCID(const css::uno::Reference<css::frame::XModel>& xModel)
}
css::uno::Reference<css::beans::XPropertySet> getPropSet(
const css::uno::Reference<css::frame::XModel>& xModel)
const rtl::Reference<::chart::ChartModel>& xModel)
{
OUString aCID = getCID(xModel);
css::uno::Reference<css::beans::XPropertySet> xPropSet =
@@ -124,7 +125,7 @@ ChartLinePanel::ChartLinePanel(weld::Widget* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
ChartController* pController):
svx::sidebar::LinePropertyPanelBase(pParent, rxFrame),
mxModel(pController->getModel()),
mxModel(pController->getChartModel()),
mxListener(new ChartSidebarModifyListener(this)),
mxSelectionListener(new ChartSidebarSelectionListener(this)),
mbUpdate(true),
@@ -148,8 +149,7 @@ ChartLinePanel::~ChartLinePanel()
void ChartLinePanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
@@ -200,12 +200,11 @@ void ChartLinePanel::selectionChanged(bool bCorrectType)
updateData();
}
void ChartLinePanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
void ChartLinePanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
mxModel->removeModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
mxModel->getCurrentController(), css::uno::UNO_QUERY);
@@ -223,8 +222,7 @@ void ChartLinePanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMode
maLineStyleWrapper.updateModel(mxModel);
maLineColorWrapper.updateModel(mxModel);
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
@@ -233,7 +231,9 @@ void ChartLinePanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMode
void ChartLinePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
{
doUpdateModel(xModel);
::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
assert(!xModel || pModel);
doUpdateModel(pModel);
}
void ChartLinePanel::setLineJoint(const XLineJointItem* pItem)

View File

@@ -69,12 +69,12 @@ protected:
private:
css::uno::Reference<css::frame::XModel> mxModel;
rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
rtl::Reference<ChartSidebarSelectionListener> mxSelectionListener;
void Initialize();
void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
void doUpdateModel(rtl::Reference<::chart::ChartModel> xModel);
bool mbUpdate;
bool mbModelValid;

View File

@@ -32,7 +32,7 @@
#include "ChartSeriesPanel.hxx"
#include <ChartController.hxx>
#include <ChartModel.hxx>
#include <DataSeriesHelper.hxx>
#include <DiagramHelper.hxx>
#include <RegressionCurveHelper.hxx>
@@ -47,7 +47,7 @@ namespace chart::sidebar {
namespace {
bool isDataLabelVisible(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rCID)
bool isDataLabelVisible(const rtl::Reference<::chart::ChartModel>& xModel, const OUString& rCID)
{
css::uno::Reference< css::chart2::XDataSeries > xSeries =
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
@@ -58,7 +58,7 @@ bool isDataLabelVisible(const css::uno::Reference<css::frame::XModel>& xModel, c
return DataSeriesHelper::hasDataLabelsAtSeries(xSeries);
}
void setDataLabelVisible(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rCID, bool bVisible)
void setDataLabelVisible(const rtl::Reference<::chart::ChartModel>& xModel, const OUString& rCID, bool bVisible)
{
css::uno::Reference< css::chart2::XDataSeries > xSeries =
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
@@ -87,7 +87,7 @@ LabelPlacementMap const aLabelPlacementMap[] = {
{ 5, css::chart::DataLabelPlacement::NEAR_ORIGIN }
};
sal_Int32 getDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& xModel,
sal_Int32 getDataLabelPlacement(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID)
{
css::uno::Reference< css::beans::XPropertySet > xSeries(
@@ -112,7 +112,7 @@ sal_Int32 getDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& x
return 0;
}
void setDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& xModel,
void setDataLabelPlacement(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, sal_Int32 nPos)
{
css::uno::Reference< css::beans::XPropertySet > xSeries(
@@ -134,7 +134,7 @@ void setDataLabelPlacement(const css::uno::Reference<css::frame::XModel>& xModel
xSeries->setPropertyValue("LabelPlacement", css::uno::Any(nApi));
}
bool isTrendlineVisible(const css::uno::Reference<css::frame::XModel>& xModel,
bool isTrendlineVisible(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID)
{
css::uno::Reference< css::chart2::XRegressionCurveContainer > xRegressionCurveContainer(
@@ -146,7 +146,7 @@ bool isTrendlineVisible(const css::uno::Reference<css::frame::XModel>& xModel,
return xRegressionCurveContainer->getRegressionCurves().hasElements();
}
void setTrendlineVisible(const css::uno::Reference<css::frame::XModel>&
void setTrendlineVisible(const rtl::Reference<::chart::ChartModel>&
xModel, const OUString& rCID, bool bVisible)
{
css::uno::Reference< css::chart2::XRegressionCurveContainer > xRegressionCurveContainer(
@@ -167,7 +167,7 @@ void setTrendlineVisible(const css::uno::Reference<css::frame::XModel>&
}
bool isErrorBarVisible(const css::uno::Reference<css::frame::XModel>& xModel,
bool isErrorBarVisible(const rtl::Reference<::chart::ChartModel>& xModel,
const OUString& rCID, bool bYError)
{
css::uno::Reference< css::chart2::XDataSeries > xSeries =
@@ -179,7 +179,7 @@ bool isErrorBarVisible(const css::uno::Reference<css::frame::XModel>& xModel,
return StatisticsHelper::hasErrorBars(xSeries, bYError);
}
void setErrorBarVisible(const css::uno::Reference<css::frame::XModel>&
void setErrorBarVisible(const rtl::Reference<::chart::ChartModel>&
xModel, const OUString& rCID, bool bYError, bool bVisible)
{
css::uno::Reference< css::chart2::XDataSeries > xSeries =
@@ -200,7 +200,7 @@ void setErrorBarVisible(const css::uno::Reference<css::frame::XModel>&
}
}
bool isPrimaryAxis(const css::uno::Reference<css::frame::XModel>&
bool isPrimaryAxis(const rtl::Reference<::chart::ChartModel>&
xModel, const OUString& rCID)
{
css::uno::Reference< css::chart2::XDataSeries > xSeries =
@@ -212,7 +212,7 @@ bool isPrimaryAxis(const css::uno::Reference<css::frame::XModel>&
return DataSeriesHelper::getAttachedAxisIndex(xSeries) == 0;
}
void setAttachedAxisType(const css::uno::Reference<css::frame::XModel>&
void setAttachedAxisType(const rtl::Reference<::chart::ChartModel>&
xModel, const OUString& rCID, bool bPrimary)
{
const uno::Reference<chart2::XDataSeries>& xDataSeries = ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
@@ -220,16 +220,14 @@ void setAttachedAxisType(const css::uno::Reference<css::frame::XModel>&
if (!xDataSeries.is())
return;
uno::Reference<chart2::XChartDocument> xChartDoc(xModel, css::uno::UNO_QUERY);
uno::Reference<chart2::XDiagram> xDiagram = xChartDoc->getFirstDiagram();
uno::Reference<chart2::XDiagram> xDiagram = xModel->getFirstDiagram();
DiagramHelper::attachSeriesToAxis(bPrimary, xDataSeries, xDiagram, comphelper::getProcessComponentContext());
}
css::uno::Reference<css::chart2::XChartType> getChartType(
const css::uno::Reference<css::frame::XModel>& xModel)
const rtl::Reference<::chart::ChartModel>& xModel)
{
css::uno::Reference<css::chart2::XChartDocument> xChartDoc (xModel, css::uno::UNO_QUERY);
css::uno::Reference<css::chart2::XDiagram> xDiagram = xChartDoc->getFirstDiagram();
css::uno::Reference<css::chart2::XDiagram> xDiagram = xModel->getFirstDiagram();
css::uno::Reference< css::chart2::XCoordinateSystemContainer > xCooSysContainer( xDiagram, UNO_QUERY_THROW );
css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > xCooSysSequence( xCooSysContainer->getCoordinateSystems());
css::uno::Reference< css::chart2::XChartTypeContainer > xChartTypeContainer( xCooSysSequence[0], UNO_QUERY_THROW );
@@ -237,7 +235,7 @@ css::uno::Reference<css::chart2::XChartType> getChartType(
return xChartTypeSequence[0];
}
OUString getSeriesLabel(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rCID)
OUString getSeriesLabel(const rtl::Reference<::chart::ChartModel>& xModel, const OUString& rCID)
{
css::uno::Reference< css::chart2::XDataSeries > xSeries =
ObjectIdentifier::getDataSeriesForCID(rCID, xModel);
@@ -293,7 +291,7 @@ ChartSeriesPanel::ChartSeriesPanel(
, mxLBLabelPlacement(m_xBuilder->weld_combo_box("comboboxtext_label"))
, mxFTSeriesName(m_xBuilder->weld_label("label_series_name"))
, mxFTSeriesTemplate(m_xBuilder->weld_label("label_series_tmpl"))
, mxModel(pController->getModel())
, mxModel(pController->getChartModel())
, mxListener(new ChartSidebarModifyListener(this))
, mxSelectionListener(new ChartSidebarSelectionListener(this, OBJECTTYPE_DATA_SERIES))
, mbModelValid(true)
@@ -322,8 +320,7 @@ ChartSeriesPanel::~ChartSeriesPanel()
void ChartSeriesPanel::Initialize()
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener);
@@ -408,12 +405,11 @@ void ChartSeriesPanel::modelInvalid()
mbModelValid = false;
}
void ChartSeriesPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
void ChartSeriesPanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
mxModel->removeModifyListener(mxListener);
}
css::uno::Reference<css::view::XSelectionSupplier> oldSelectionSupplier(
@@ -428,8 +424,7 @@ void ChartSeriesPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMo
if (!mbModelValid)
return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
mxModel->addModifyListener(mxListener);
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(mxModel->getCurrentController(), css::uno::UNO_QUERY);
if (xSelectionSupplier.is())
@@ -438,7 +433,9 @@ void ChartSeriesPanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xMo
void ChartSeriesPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
{
doUpdateModel(xModel);
::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
assert(!xModel || pModel);
doUpdateModel(pModel);
}
void ChartSeriesPanel::selectionChanged(bool bCorrectType)

View File

@@ -91,14 +91,14 @@ private:
std::unique_ptr<weld::Label> mxFTSeriesName;
std::unique_ptr<weld::Label> mxFTSeriesTemplate;
css::uno::Reference<css::frame::XModel> mxModel;
rtl::Reference<::chart::ChartModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
css::uno::Reference<css::view::XSelectionChangeListener> mxSelectionListener;
bool mbModelValid;
void Initialize();
void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
void doUpdateModel(rtl::Reference<::chart::ChartModel> xModel);
DECL_LINK(CheckBoxHdl, weld::Toggleable&, void);
DECL_LINK(RadioBtnHdl, weld::Toggleable&, void);

View File

@@ -45,7 +45,6 @@ namespace chart::sidebar
{
ChartTypePanel::ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* pController)
: PanelLayout(pParent, "ChartTypePanel", "modules/schart/ui/sidebartype.ui")
, mxModel(pController->getModel())
, mxListener(new ChartSidebarModifyListener(this))
, mbModelValid(true)
, m_pDim3DLookResourceGroup(new Dim3DLookResourceGroup(m_xBuilder.get()))
@@ -54,7 +53,7 @@ ChartTypePanel::ChartTypePanel(weld::Widget* pParent, ::chart::ChartController*
new SplineResourceGroup(m_xBuilder.get(), pController->GetChartFrame()))
, m_pGeometryResourceGroup(new GeometryResourceGroup(m_xBuilder.get()))
, m_pSortByXValuesResourceGroup(new SortByXValuesResourceGroup(m_xBuilder.get()))
, m_xChartModel(dynamic_cast<ChartModel*>(mxModel.get()))
, m_xChartModel(pController->getChartModel())
, m_aChartTypeDialogControllerList(0)
, m_pCurrentMainType(nullptr)
, m_nChangingCalls(0)
@@ -161,11 +160,10 @@ void ChartTypePanel::Initialize()
{
if (!m_xChartModel.is())
return;
rtl::Reference<::chart::ChartTypeManager> xTemplateManager
= dynamic_cast<::chart::ChartTypeManager*>(m_xChartModel->getChartTypeManager().get());
rtl::Reference<Diagram> xDiagram(ChartModelHelper::findDiagram(m_xChartModel));
rtl::Reference<::chart::ChartTypeManager> xChartTypeManager = m_xChartModel->getTypeManager();
rtl::Reference<Diagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
DiagramHelper::tTemplateWithServiceName aTemplate
= DiagramHelper::getTemplateForDiagram(xDiagram, xTemplateManager);
= DiagramHelper::getTemplateForDiagram(xDiagram, xChartTypeManager);
OUString aServiceName(aTemplate.sServiceName);
bool bFound = false;
@@ -226,12 +224,10 @@ void ChartTypePanel::updateData()
// Chart Type related
if (!m_xChartModel.is())
return;
rtl::Reference<::chart::ChartTypeManager> xTemplateManager
= dynamic_cast<::chart::ChartTypeManager*>(m_xChartModel->getChartTypeManager().get());
uno::Reference<frame::XModel> xModel(m_xChartModel);
rtl::Reference<Diagram> xDiagram(ChartModelHelper::findDiagram(xModel));
rtl::Reference<::chart::ChartTypeManager> xChartTypeManager = m_xChartModel->getTypeManager();
rtl::Reference<Diagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
DiagramHelper::tTemplateWithServiceName aTemplate
= DiagramHelper::getTemplateForDiagram(xDiagram, xTemplateManager);
= DiagramHelper::getTemplateForDiagram(xDiagram, xChartTypeManager);
OUString aServiceName(aTemplate.sServiceName);
sal_uInt16 nM = 0;
@@ -267,29 +263,27 @@ void ChartTypePanel::HandleContextChange(const vcl::EnumContext& rContext)
void ChartTypePanel::modelInvalid() { mbModelValid = false; }
void ChartTypePanel::doUpdateModel(css::uno::Reference<css::frame::XModel> xModel)
void ChartTypePanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel)
{
if (mbModelValid)
{
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel,
css::uno::UNO_QUERY_THROW);
xBroadcaster->removeModifyListener(mxListener);
m_xChartModel->removeModifyListener(mxListener);
}
mxModel = xModel;
mbModelValid = mxModel.is();
m_xChartModel = xModel;
mbModelValid = m_xChartModel.is();
if (!mbModelValid)
return;
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel,
css::uno::UNO_QUERY_THROW);
xBroadcasterNew->addModifyListener(mxListener);
m_xChartModel->addModifyListener(mxListener);
}
void ChartTypePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
{
doUpdateModel(xModel);
::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
assert(!xModel || pModel);
doUpdateModel(pModel);
}
rtl::Reference<::chart::ChartTypeTemplate> ChartTypePanel::getCurrentTemplate() const
@@ -298,9 +292,9 @@ rtl::Reference<::chart::ChartTypeTemplate> ChartTypePanel::getCurrentTemplate()
{
ChartTypeParameter aParameter(getCurrentParameter());
m_pCurrentMainType->adjustParameterToSubType(aParameter);
rtl::Reference<ChartTypeManager> xTemplateManager
= dynamic_cast<ChartTypeManager*>(m_xChartModel->getChartTypeManager().get());
return m_pCurrentMainType->getCurrentTemplate(aParameter, xTemplateManager);
rtl::Reference<::chart::ChartTypeManager> xChartTypeManager
= m_xChartModel->getTypeManager();
return m_pCurrentMainType->getCurrentTemplate(aParameter, xChartTypeManager);
}
return nullptr;
}

View File

@@ -89,13 +89,12 @@ private:
vcl::EnumContext maContext;
css::uno::Reference<css::frame::XModel> mxModel;
css::uno::Reference<css::util::XModifyListener> mxListener;
bool mbModelValid;
void Initialize();
void doUpdateModel(css::uno::Reference<css::frame::XModel> xModel);
void doUpdateModel(rtl::Reference<::chart::ChartModel> xModel);
std::unique_ptr<Dim3DLookResourceGroup> m_pDim3DLookResourceGroup;
std::unique_ptr<StackingResourceGroup> m_pStackingResourceGroup;