summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2018-05-08 18:57:38 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2018-05-14 13:24:52 +0200
commitd6d5c1c855a0ce57ab96747b950241065f849b83 (patch)
tree1ecc52095085d676851519c3a5e501619a19bc66 /chart2
parentd05567e04e6696418ac65686763b4db70665cb4b (diff)
tdf#113688: Pattern fill can be set from sidebar now
Change-Id: I877dd2610aadd1b0118cdb6928a8473af1dc4c73 Reviewed-on: https://gerrit.libreoffice.org/54020 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/sidebar/ChartAreaPanel.cxx31
1 files changed, 27 insertions, 4 deletions
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 907840adcae2..725bb30a22f6 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -15,8 +15,10 @@
#include <chartview/DrawModelWrapper.hxx>
+#include <editeng/memberids.h>
#include <svx/xfltrit.hxx>
#include <svx/xflftrit.hxx>
+#include <svx/xbtmpit.hxx>
#include <svx/unomid.hxx>
#include <vcl/svapp.hxx>
@@ -181,11 +183,27 @@ GraphicObject getXBitmapFromName(const css::uno::Reference<css::frame::XModel>&
try
{
ViewElementListProvider aProvider = getViewElementListProvider(xModel);
- XBitmapListRef aRef = aProvider.GetBitmapList();
- size_t n = aRef->Count();
+ XBitmapListRef aBmpRef = aProvider.GetBitmapList();
+ XPatternListRef aPatRef = aProvider.GetPatternList();
+
+ size_t n = aBmpRef->Count();
for (size_t i = 0; i < n; ++i)
{
- const XBitmapEntry* pBitmap = aRef->GetBitmap(i);
+ const XBitmapEntry* pBitmap = aBmpRef->GetBitmap(i);
+ if (!pBitmap)
+ continue;
+
+ if (pBitmap->GetName().equalsIgnoreAsciiCase(rName))
+ {
+ return GraphicObject(pBitmap->GetGraphicObject());
+ }
+ }
+
+ // perhaps it's a pattern
+ size_t m = aPatRef->Count();
+ for (size_t i = 0; i < m; ++i)
+ {
+ const XBitmapEntry* pBitmap = aPatRef->GetBitmap(i);
if (!pBitmap)
continue;
@@ -376,7 +394,12 @@ void ChartAreaPanel::setFillStyleAndBitmap(const XFillStyleItem* pStyleItem,
if (pStyleItem)
xPropSet->setPropertyValue("FillStyle", css::uno::Any(pStyleItem->GetValue()));
- xPropSet->setPropertyValue("FillBitmapName", css::uno::Any(rBitmapItem.GetValue()));
+
+ css::uno::Any aBitmap;
+ rBitmapItem.QueryValue(aBitmap, MID_BITMAP);
+ OUString aPreferredName = rBitmapItem.GetName();
+ aBitmap <<= PropertyHelper::addBitmapUniqueNameToTable(aBitmap, css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY_THROW), aPreferredName);
+ xPropSet->setPropertyValue("FillBitmapName", aBitmap);
}
void ChartAreaPanel::updateData()