summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-09-29 11:19:33 +0200
committerAndras Timar <andras.timar@collabora.com>2020-10-05 21:54:45 +0200
commit4da007664fe272297d96384670d8d4278871d122 (patch)
tree03c4be0819e57588b41e15512c25870e4ccde15a
parentaab50bda474910198a048a0714206775300efb40 (diff)
Set correct color for chart background in sidebar
Change-Id: Id41fba75133e3473dcb834c72ff2ecfb317ecb79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103603 Tested-by: Andras Timar <andras.timar@collabora.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--sc/source/ui/drawfunc/drawsh2.cxx47
1 files changed, 47 insertions, 0 deletions
diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx
index 952ca461d9f9..6040e32b7bfa 100644
--- a/sc/source/ui/drawfunc/drawsh2.cxx
+++ b/sc/source/ui/drawfunc/drawsh2.cxx
@@ -54,6 +54,11 @@
#include <comphelper/lok.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <svx/xflclit.hxx>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <sfx2/ipclient.hxx>
+
#include <com/sun/star/drawing/FillStyle.hpp>
using namespace com::sun::star::drawing;
@@ -303,6 +308,45 @@ void ScDrawShell::GetDrawFuncState( SfxItemSet& rSet ) // disable functions
svx::FontworkBar::getState( pView, rSet );
}
+static void setupFillColorForChart(SfxViewShell* pShell, SfxItemSet& rSet)
+{
+ if (pShell)
+ {
+ SfxInPlaceClient* pIPClient = pShell->GetIPClient();
+ if (pIPClient)
+ {
+ const css::uno::Reference<::css::embed::XEmbeddedObject>& xEmbObj = pIPClient->GetObject();
+ if( xEmbObj.is() )
+ {
+ ::css::uno::Reference<::css::chart2::XChartDocument> xChart( xEmbObj->getComponent(), uno::UNO_QUERY );
+ if( xChart.is() )
+ {
+ css::uno::Reference<css::beans::XPropertySet> xPropSet(xChart->getPageBackground(), uno::UNO_QUERY);
+ if (xPropSet.is())
+ {
+ css::uno::Reference<css::beans::XPropertySetInfo> xInfo(xPropSet->getPropertySetInfo());
+ if (xInfo.is())
+ {
+ if (xInfo->hasPropertyByName("FillColor"))
+ {
+ sal_uInt32 nFillColor = 0;
+ xPropSet->getPropertyValue("FillColor") >>= nFillColor;
+
+ XFillColorItem aFillColorItem("", Color(nFillColor));
+ rSet.Put(aFillColorItem);
+
+ if (comphelper::LibreOfficeKit::isActive())
+ pShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+ (".uno:FillColor=" + std::to_string(nFillColor)).c_str());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
// Attributes for Drawing-Objects
void ScDrawShell::GetDrawAttrState( SfxItemSet& rSet )
@@ -365,6 +409,9 @@ void ScDrawShell::GetDrawAttrState( SfxItemSet& rSet )
rSet.Put( SvxSizeItem( SID_ATTR_SIZE, Size( 0, 0 ) ) );
}
}
+
+ // Set correct colors for charts in sidebar
+ setupFillColorForChart(pDrView->GetSfxViewShell(), rSet);
}
}