[Libreoffice-commits] core.git: Branch 'feature/chart-sidebar' - 3 commits - chart2/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Fri Jul 24 07:59:22 PDT 2015
chart2/source/controller/inc/ChartController.hxx | 5
chart2/source/controller/main/ChartController.cxx | 6
chart2/source/controller/sidebar/ChartAreaPanel.cxx | 144 ++++++++++++++++++++
3 files changed, 154 insertions(+), 1 deletion(-)
New commits:
commit b05dbacef467ba1aaf3794f16cc11f8368c2f5b8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Jul 24 16:58:04 2015 +0200
handle bitmap in chart area panel
Change-Id: I3137fc1ac066b712594d0cf471ca4eb8a344c0bd
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index 9749b36..e5d40d2 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -435,6 +435,7 @@ public:
bool isShapeContext() const;
ViewElementListProvider getViewElementListProvider();
+ DrawModelWrapper* GetDrawModelWrapper();
DECL_LINK( NotifyUndoActionHdl, SdrUndoAction* );
@@ -442,7 +443,6 @@ public:
//private
private:
- DrawModelWrapper* GetDrawModelWrapper();
DrawViewWrapper* GetDrawViewWrapper();
private:
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 966a9fd..9343499 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()
commit 9eaf8bb2de31340ba02f4fb0fa80346b50c8f28d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Jul 24 13:37:15 2015 +0200
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
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 9e1b5e8..966a9fd 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -43,33 +43,76 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
return ObjectIdentifier::getObjectPropertySet(aCID, xModel);
}
-XGradient getXGradientForName(css::uno::Reference<css::frame::XModel> xModel,
- const OUString& rName)
+ViewElementListProvider getViewElementListProvider( css::uno::Reference<css::frame::XModel> xModel)
{
css::uno::Reference<css::frame::XController>xController = xModel->getCurrentController();
if (!xController.is())
- return XGradient();
+ throw std::exception();
ChartController* pController = dynamic_cast<ChartController*>(xController.get());
if (!pController)
- return XGradient();
+ throw std::exception();
ViewElementListProvider aProvider = pController->getViewElementListProvider();
- 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;
+ return aProvider;
+}
- if (pGradient->GetName() == rName)
- return XGradient(pGradient->GetGradient());
+XGradient getXGradientForName(css::uno::Reference<css::frame::XModel> xModel,
+ 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();
}
+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
{
public:
@@ -249,6 +292,12 @@ void ChartAreaPanel::updateData()
XGradient xGradient = getXGradientForName(mxModel, aGradientName);
XFillGradientItem aGradientItem(aGradientName, xGradient);
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()
commit f99153112846111518a1ce46803dedee85159aa5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Jul 24 01:47:31 2015 +0200
update gradients in sidebar as well
Change-Id: I0dc737c133e905d75fab23457fb86c8d2b724ce8
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index fb84c45..9749b36 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -127,6 +127,7 @@ class ChartWindow;
class DrawModelWrapper;
class DrawViewWrapper;
class ReferenceSizeProvider;
+class ViewElementListProvider;
class ChartController : public ::cppu::WeakImplHelper12 <
::com::sun::star::frame::XController //comprehends XComponent (required interface)
@@ -433,6 +434,8 @@ public:
bool isShapeContext() const;
+ ViewElementListProvider getViewElementListProvider();
+
DECL_LINK( NotifyUndoActionHdl, SdrUndoAction* );
public:
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 138fc65..66a7b29 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -43,6 +43,7 @@
#include "DrawCommandDispatch.hxx"
#include "ShapeController.hxx"
#include "UndoActions.hxx"
+#include "ViewElementListProvider.hxx"
#include <comphelper/InlineContainer.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -1623,6 +1624,11 @@ void ChartController::impl_initializeAccessible( const uno::Reference< lang::XIn
;
}
+ViewElementListProvider ChartController::getViewElementListProvider()
+{
+ return ViewElementListProvider(m_pDrawModelWrapper.get());
+}
+
} //namespace chart
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
diff --git a/chart2/source/controller/sidebar/ChartAreaPanel.cxx b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
index 6dcadd1..9e1b5e8 100644
--- a/chart2/source/controller/sidebar/ChartAreaPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartAreaPanel.cxx
@@ -10,6 +10,7 @@
#include "ChartAreaPanel.hxx"
#include "ChartController.hxx"
+#include "ViewElementListProvider.hxx"
#include <svx/xfltrit.hxx>
#include <svx/xflftrit.hxx>
@@ -42,6 +43,33 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
return ObjectIdentifier::getObjectPropertySet(aCID, xModel);
}
+XGradient getXGradientForName(css::uno::Reference<css::frame::XModel> xModel,
+ const OUString& rName)
+{
+ css::uno::Reference<css::frame::XController>xController = xModel->getCurrentController();
+ if (!xController.is())
+ return XGradient();
+
+ ChartController* pController = dynamic_cast<ChartController*>(xController.get());
+ if (!pController)
+ return XGradient();
+
+ ViewElementListProvider aProvider = pController->getViewElementListProvider();
+ 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());
+ }
+
+ return XGradient();
+}
+
class PreventUpdate
{
public:
@@ -215,6 +243,12 @@ void ChartAreaPanel::updateData()
xPropSet->getPropertyValue("Transparency") >>= nFillTransparence;
SfxUInt16Item aTransparenceItem(0, nFillTransparence);
updateFillTransparence(false, true, &aTransparenceItem);
+
+ OUString aGradientName;
+ xPropSet->getPropertyValue("GradientName") >>= aGradientName;
+ XGradient xGradient = getXGradientForName(mxModel, aGradientName);
+ XFillGradientItem aGradientItem(aGradientName, xGradient);
+ updateFillGradient(false, true, &aGradientItem);
}
void ChartAreaPanel::modelInvalid()
More information about the Libreoffice-commits
mailing list