2015-07-20 23:46:27 +02:00
|
|
|
/* -*- 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/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ChartAreaPanel.hxx"
|
|
|
|
|
|
|
|
#include "ChartController.hxx"
|
|
|
|
|
|
|
|
namespace chart { namespace sidebar {
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
OUString getCID(css::uno::Reference<css::frame::XModel> xModel)
|
|
|
|
{
|
|
|
|
css::uno::Reference<css::frame::XController> xController(xModel->getCurrentController());
|
|
|
|
css::uno::Reference<css::view::XSelectionSupplier> xSelectionSupplier(xController, css::uno::UNO_QUERY);
|
|
|
|
if (!xSelectionSupplier.is())
|
|
|
|
return OUString();
|
|
|
|
|
|
|
|
css::uno::Any aAny = xSelectionSupplier->getSelection();
|
2015-07-21 19:01:06 +02:00
|
|
|
if (!aAny.hasValue())
|
|
|
|
return OUString();
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
OUString aCID;
|
|
|
|
aAny >>= aCID;
|
|
|
|
|
|
|
|
return aCID;
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Reference<css::beans::XPropertySet> getPropSet(
|
|
|
|
css::uno::Reference<css::frame::XModel> xModel)
|
|
|
|
{
|
|
|
|
OUString aCID = getCID(xModel);
|
|
|
|
return ObjectIdentifier::getObjectPropertySet(aCID, xModel);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-07-20 23:46:27 +02:00
|
|
|
VclPtr<vcl::Window> ChartAreaPanel::Create(
|
|
|
|
vcl::Window* pParent,
|
|
|
|
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
|
|
|
ChartController* pController)
|
|
|
|
{
|
|
|
|
if (pParent == NULL)
|
|
|
|
throw css::lang::IllegalArgumentException("no parent Window given to ChartAxisPanel::Create", NULL, 0);
|
|
|
|
if (!rxFrame.is())
|
|
|
|
throw css::lang::IllegalArgumentException("no XFrame given to ChartAxisPanel::Create", NULL, 1);
|
|
|
|
|
|
|
|
return VclPtr<ChartAreaPanel>::Create(
|
|
|
|
pParent, rxFrame, pController);
|
|
|
|
}
|
|
|
|
|
|
|
|
ChartAreaPanel::ChartAreaPanel(vcl::Window* pParent,
|
|
|
|
const css::uno::Reference<css::frame::XFrame>& rxFrame,
|
2015-07-21 15:03:48 +02:00
|
|
|
ChartController* pController):
|
|
|
|
svx::sidebar::AreaPropertyPanelBase(pParent, rxFrame),
|
|
|
|
mxModel(pController->getModel()),
|
|
|
|
mxListener(new ChartSidebarModifyListener(this))
|
2015-07-20 23:46:27 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ChartAreaPanel::~ChartAreaPanel()
|
|
|
|
{
|
|
|
|
disposeOnce();
|
|
|
|
}
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::dispose()
|
2015-07-20 23:46:27 +02:00
|
|
|
{
|
2015-07-21 15:03:48 +02:00
|
|
|
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
|
|
|
|
xBroadcaster->removeModifyListener(mxListener);
|
2015-07-21 19:00:37 +02:00
|
|
|
|
|
|
|
AreaPropertyPanelBase::dispose();
|
2015-07-21 15:03:48 +02:00
|
|
|
}
|
2015-07-20 23:46:27 +02:00
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::Initialize()
|
|
|
|
{
|
|
|
|
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcaster(mxModel, css::uno::UNO_QUERY_THROW);
|
|
|
|
xBroadcaster->addModifyListener(mxListener);
|
2015-07-20 23:46:27 +02:00
|
|
|
}
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::setFillTransparence(const XFillTransparenceItem& /*rItem*/)
|
2015-07-20 23:46:27 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::setFillFloatTransparence(const XFillFloatTransparenceItem& /*rItem*/)
|
2015-07-20 23:46:27 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::setFillStyle(const XFillStyleItem& rItem)
|
2015-07-20 23:46:27 +02:00
|
|
|
{
|
2015-07-21 15:03:48 +02:00
|
|
|
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
|
2015-07-21 19:01:06 +02:00
|
|
|
if (!xPropSet.is())
|
|
|
|
return;
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(rItem.GetValue()));
|
2015-07-20 23:46:27 +02:00
|
|
|
}
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::setFillStyleAndColor(const XFillStyleItem* pStyleItem,
|
|
|
|
const XFillColorItem& rColorItem)
|
2015-07-20 23:46:27 +02:00
|
|
|
{
|
2015-07-21 15:03:48 +02:00
|
|
|
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
|
2015-07-21 19:01:06 +02:00
|
|
|
if (!xPropSet.is())
|
|
|
|
return;
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
if (pStyleItem)
|
|
|
|
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
|
|
|
|
xPropSet->setPropertyValue("Color", css::uno::makeAny(rColorItem.GetValue()));
|
|
|
|
}
|
2015-07-20 23:46:27 +02:00
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::setFillStyleAndGradient(const XFillStyleItem* pStyleItem,
|
|
|
|
const XFillGradientItem& rGradientItem)
|
|
|
|
{
|
|
|
|
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
|
2015-07-21 19:01:06 +02:00
|
|
|
if (!xPropSet.is())
|
|
|
|
return;
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
if (pStyleItem)
|
|
|
|
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
|
|
|
|
xPropSet->setPropertyValue("GradientName", css::uno::makeAny(rGradientItem.GetValue()));
|
2015-07-20 23:46:27 +02:00
|
|
|
}
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::setFillStyleAndHatch(const XFillStyleItem* pStyleItem,
|
|
|
|
const XFillHatchItem& rHatchItem)
|
2015-07-20 23:46:27 +02:00
|
|
|
{
|
2015-07-21 15:03:48 +02:00
|
|
|
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
|
2015-07-21 19:01:06 +02:00
|
|
|
if (!xPropSet.is())
|
|
|
|
return;
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
if (pStyleItem)
|
|
|
|
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
|
|
|
|
xPropSet->setPropertyValue("HatchName", css::uno::makeAny(rHatchItem.GetValue()));
|
|
|
|
}
|
2015-07-20 23:46:27 +02:00
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
|
|
|
|
const XFillBitmapItem& rBitmapItem)
|
|
|
|
{
|
|
|
|
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
|
2015-07-21 19:01:06 +02:00
|
|
|
if (!xPropSet.is())
|
|
|
|
return;
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
if (pStyleItem)
|
|
|
|
xPropSet->setPropertyValue("FillStyle", css::uno::makeAny(pStyleItem->GetValue()));
|
|
|
|
xPropSet->setPropertyValue("FillBitmapName", css::uno::makeAny(rBitmapItem.GetValue()));
|
2015-07-20 23:46:27 +02:00
|
|
|
}
|
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::updateData()
|
2015-07-20 23:46:27 +02:00
|
|
|
{
|
2015-07-21 15:03:48 +02:00
|
|
|
}
|
2015-07-20 23:46:27 +02:00
|
|
|
|
2015-07-21 15:03:48 +02:00
|
|
|
void ChartAreaPanel::modelInvalid()
|
|
|
|
{
|
2015-07-20 23:46:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} }
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|