Kaydet (Commit) 8ab10c27 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

update hatch in chart sidebar

There is a huge level of insanity in the hatch handling. Apparently
different parts of the code use different case of the hatch id which
makes it difficult to handle it.

Change-Id: I5674e21a6c9a2d01d7b641473e00ab5e2bcaffd4
üst b5c0f852
...@@ -43,33 +43,76 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet( ...@@ -43,33 +43,76 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
return ObjectIdentifier::getObjectPropertySet(aCID, xModel); return ObjectIdentifier::getObjectPropertySet(aCID, xModel);
} }
XGradient getXGradientForName(css::uno::Reference<css::frame::XModel> xModel, ViewElementListProvider getViewElementListProvider( css::uno::Reference<css::frame::XModel> xModel)
const OUString& rName)
{ {
css::uno::Reference<css::frame::XController>xController = xModel->getCurrentController(); css::uno::Reference<css::frame::XController>xController = xModel->getCurrentController();
if (!xController.is()) if (!xController.is())
return XGradient(); throw std::exception();
ChartController* pController = dynamic_cast<ChartController*>(xController.get()); ChartController* pController = dynamic_cast<ChartController*>(xController.get());
if (!pController) if (!pController)
return XGradient(); throw std::exception();
ViewElementListProvider aProvider = pController->getViewElementListProvider(); ViewElementListProvider aProvider = pController->getViewElementListProvider();
XGradientListRef aRef = aProvider.GetGradientList(); return aProvider;
size_t n = aRef->Count(); }
for (size_t i = 0; i < n; ++i)
{
XGradientEntry* pGradient = aRef->GetGradient(i);
if (!pGradient)
continue;
if (pGradient->GetName() == rName) XGradient getXGradientForName(css::uno::Reference<css::frame::XModel> xModel,
return XGradient(pGradient->GetGradient()); const OUString& rName)
{
try
{
ViewElementListProvider aProvider = getViewElementListProvider(xModel);
XGradientListRef aRef = aProvider.GetGradientList();
size_t n = aRef->Count();
for (size_t i = 0; i < n; ++i)
{
XGradientEntry* pGradient = aRef->GetGradient(i);
if (!pGradient)
continue;
if (pGradient->GetName() == rName)
return XGradient(pGradient->GetGradient());
}
}
catch (...)
{
// ignore exception
} }
return XGradient(); return XGradient();
} }
XHatch getXHatchFromName(css::uno::Reference<css::frame::XModel> xModel,
OUString& rName)
{
try
{
ViewElementListProvider aProvider = getViewElementListProvider(xModel);
XHatchListRef aRef = aProvider.GetHatchList();
size_t n = aRef->Count();
for (size_t i = 0; i < n; ++i)
{
XHatchEntry* pHatch = aRef->GetHatch(i);
if (!pHatch)
continue;
if (pHatch->GetName().equalsIgnoreAsciiCase(rName))
{
// we need to update the hatch name
rName = pHatch->GetName();
return XHatch(pHatch->GetHatch());
}
}
}
catch (...)
{
// ignore exception
}
return XHatch();
}
class PreventUpdate class PreventUpdate
{ {
public: public:
...@@ -249,6 +292,12 @@ void ChartAreaPanel::updateData() ...@@ -249,6 +292,12 @@ void ChartAreaPanel::updateData()
XGradient xGradient = getXGradientForName(mxModel, aGradientName); XGradient xGradient = getXGradientForName(mxModel, aGradientName);
XFillGradientItem aGradientItem(aGradientName, xGradient); XFillGradientItem aGradientItem(aGradientName, xGradient);
updateFillGradient(false, true, &aGradientItem); updateFillGradient(false, true, &aGradientItem);
OUString aHatchName;
xPropSet->getPropertyValue("HatchName") >>= aHatchName;
XHatch xHatch = getXHatchFromName(mxModel, aHatchName);
XFillHatchItem aHatchItem(aHatchName, xHatch);
updateFillHatch(false, true, &aHatchItem);
} }
void ChartAreaPanel::modelInvalid() void ChartAreaPanel::modelInvalid()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment