diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-24 16:58:04 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-07-26 00:27:00 +0200 |
commit | 7b9818c4cc0c955d9b5a0f0adba34a9c44b6065c (patch) | |
tree | c92f6ef0b04f0112a81f78eed24112fc031b45c4 /chart2/source/controller/sidebar/ChartAreaPanel.cxx | |
parent | 8ab10c27be8ab33e5cf355ab91f6783175184784 (diff) |
handle bitmap in chart area panel
Change-Id: I3137fc1ac066b712594d0cf471ca4eb8a344c0bd
Diffstat (limited to 'chart2/source/controller/sidebar/ChartAreaPanel.cxx')
-rw-r--r-- | chart2/source/controller/sidebar/ChartAreaPanel.cxx | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx index 966a9fda0ffa..9343499e27af 100644 --- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx +++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx @@ -12,6 +12,8 @@ #include "ChartController.hxx" #include "ViewElementListProvider.hxx" +#include "chartview/DrawModelWrapper.hxx" + #include <svx/xfltrit.hxx> #include <svx/xflftrit.hxx> @@ -43,7 +45,7 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet( return ObjectIdentifier::getObjectPropertySet(aCID, xModel); } -ViewElementListProvider getViewElementListProvider( css::uno::Reference<css::frame::XModel> xModel) +ChartController* getController(css::uno::Reference<css::frame::XModel> xModel) { css::uno::Reference<css::frame::XController>xController = xModel->getCurrentController(); if (!xController.is()) @@ -53,10 +55,22 @@ ViewElementListProvider getViewElementListProvider( css::uno::Reference<css::fra if (!pController) throw std::exception(); + return pController; +} + +ViewElementListProvider getViewElementListProvider( css::uno::Reference<css::frame::XModel> xModel) +{ + ChartController* pController = getController(xModel); ViewElementListProvider aProvider = pController->getViewElementListProvider(); return aProvider; } +DrawModelWrapper* getDrawModelWrapper(css::uno::Reference<css::frame::XModel> xModel) +{ + ChartController* pController = getController(xModel); + return pController->GetDrawModelWrapper(); +} + XGradient getXGradientForName(css::uno::Reference<css::frame::XModel> xModel, const OUString& rName) { @@ -113,6 +127,34 @@ XHatch getXHatchFromName(css::uno::Reference<css::frame::XModel> xModel, return XHatch(); } +GraphicObject getXBitmapFromName(css::uno::Reference<css::frame::XModel> xModel, + const OUString& rName) +{ + try + { + ViewElementListProvider aProvider = getViewElementListProvider(xModel); + XBitmapListRef aRef = aProvider.GetBitmapList(); + size_t n = aRef->Count(); + for (size_t i = 0; i < n; ++i) + { + XBitmapEntry* pBitmap = aRef->GetBitmap(i); + if (!pBitmap) + continue; + + if (pBitmap->GetName().equalsIgnoreAsciiCase(rName)) + { + return GraphicObject(pBitmap->GetGraphicObject()); + } + } + } + catch (...) + { + // ignore exception + } + + return GraphicObject(); +} + class PreventUpdate { public: @@ -298,6 +340,25 @@ void ChartAreaPanel::updateData() XHatch xHatch = getXHatchFromName(mxModel, aHatchName); XFillHatchItem aHatchItem(aHatchName, xHatch); updateFillHatch(false, true, &aHatchItem); + + OUString aBitmapName; + xPropSet->getPropertyValue("FillBitmapName") >>= aBitmapName; + GraphicObject xBitmap = getXBitmapFromName(mxModel, aBitmapName); + XFillBitmapItem aBitmapItem(aBitmapName, xBitmap); + XFillBitmapItem* pBitmapItem = NULL; + try + { + DrawModelWrapper* pModelWrapper = getDrawModelWrapper(mxModel); + if (pModelWrapper) + { + pBitmapItem = aBitmapItem.checkForUniqueItem(&pModelWrapper->getSdrModel()); + } + } + catch (...) + { + } + updateFillBitmap(false, true, pBitmapItem ? pBitmapItem : &aBitmapItem); + delete pBitmapItem; } void ChartAreaPanel::modelInvalid() |