[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 4 commits - chart2/source include/svx svx/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 11 13:13:01 UTC 2021


 chart2/source/controller/inc/ChartController.hxx        |    2 
 chart2/source/controller/main/ChartController.cxx       |   18 ++++
 chart2/source/controller/main/ChartController_Tools.cxx |   60 ++++++++++++++++
 chart2/source/controller/sidebar/ChartColorWrapper.cxx  |   14 +++
 chart2/source/controller/sidebar/ChartLinePanel.cxx     |   21 +++++
 chart2/source/controller/sidebar/ChartLinePanel.hxx     |    2 
 include/svx/sidebar/LinePropertyPanelBase.hxx           |    5 -
 svx/source/sidebar/line/LinePropertyPanelBase.cxx       |    2 
 8 files changed, 121 insertions(+), 3 deletions(-)

New commits:
commit 2dd29409d8a70fba4d393652d8879c8a9acd0d48
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Jan 6 11:44:43 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jan 11 14:02:08 2021 +0100

    lok: send chart line width updates
    
    Change-Id: I4c9c4a977df12a1cefb81cfbcac73b61ff26e488
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108843
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108925
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/chart2/source/controller/sidebar/ChartLinePanel.cxx b/chart2/source/controller/sidebar/ChartLinePanel.cxx
index daf6045b244f..6436b9184acb 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.cxx
@@ -26,6 +26,10 @@
 #include <com/sun/star/util/XModifyBroadcaster.hpp>
 #include <com/sun/star/chart2/XDiagram.hpp>
 
+#include <comphelper/lok.hxx>
+#include <sfx2/viewsh.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
 namespace chart { namespace sidebar {
 
 namespace {
@@ -203,6 +207,11 @@ void ChartLinePanel::updateData()
     XLineStyleItem aStyleItem(eStyle);
     updateLineStyle(false, true, &aStyleItem);
 
+    sal_uInt32 nWidth;
+    xPropSet->getPropertyValue("LineWidth") >>= nWidth;
+    XLineWidthItem aWidthItem(nWidth);
+    updateLineWidth(false, true, &aWidthItem);
+
     css::uno::Any aLineDashName = xPropSet->getPropertyValue("LineDashName");
     OUString aDashName;
     aLineDashName >>= aDashName;
@@ -330,6 +339,18 @@ void ChartLinePanel::setLineWidth(const XLineWidthItem& rItem)
     xPropSet->setPropertyValue("LineWidth", css::uno::Any(rItem.GetValue()));
 }
 
+void ChartLinePanel::updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem)
+{
+    LinePropertyPanelBase::updateLineWidth(bDisabled, bSetOrDefault, pItem);
+
+    SfxViewShell* pViewShell = SfxViewShell::Current();
+    if (comphelper::LibreOfficeKit::isActive() && pViewShell)
+    {
+        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                        (".uno:LineWidth=" + std::to_string(mnWidthCoreValue)).c_str());
+    }
+}
+
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/sidebar/ChartLinePanel.hxx b/chart2/source/controller/sidebar/ChartLinePanel.hxx
index c0b3d19fd579..f04571ef9c00 100644
--- a/chart2/source/controller/sidebar/ChartLinePanel.hxx
+++ b/chart2/source/controller/sidebar/ChartLinePanel.hxx
@@ -73,6 +73,8 @@ protected:
     virtual void setLineJoint(const XLineJointItem* pItem) override;
     virtual void setLineCap(const XLineCapItem* pItem) override;
 
+    virtual void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem) override;
+
 private:
 
     css::uno::Reference<css::frame::XModel> mxModel;
diff --git a/include/svx/sidebar/LinePropertyPanelBase.hxx b/include/svx/sidebar/LinePropertyPanelBase.hxx
index 2def46e3b524..3154a9444e53 100644
--- a/include/svx/sidebar/LinePropertyPanelBase.hxx
+++ b/include/svx/sidebar/LinePropertyPanelBase.hxx
@@ -94,7 +94,7 @@ protected:
     void updateLineStyle(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
     void updateLineDash(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
     void updateLineTransparence(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
-    void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
+    virtual void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
     void updateLineStart(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
     void updateLineEnd(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
     void updateLineJoint(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
@@ -115,6 +115,8 @@ protected:
 
     VclPtr<sfx2::sidebar::SidebarToolBox> mpTBColor;
 
+    sal_Int32       mnWidthCoreValue;
+
 private:
     //ui controls
     VclPtr<FixedText>   mpFTWidth;
@@ -136,7 +138,6 @@ private:
 
     sal_uInt16      mnTrans;
     MapUnit         meMapUnit;
-    sal_Int32       mnWidthCoreValue;
     XLineEndListRef mxLineEndList;
     XDashListRef    mxLineStyleList;
     std::unique_ptr<XLineStartItem> mpStartItem;
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index 75a703949610..79df3a88a460 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -166,11 +166,11 @@ LinePropertyPanelBase::LinePropertyPanelBase(
     vcl::Window* pParent,
     const uno::Reference<css::frame::XFrame>& rxFrame)
 :   PanelLayout(pParent, "LinePropertyPanel", "svx/ui/sidebarline.ui", rxFrame),
+    mnWidthCoreValue(0),
     mpStyleItem(),
     mpDashItem(),
     mnTrans(0),
     meMapUnit(MapUnit::MapMM),
-    mnWidthCoreValue(0),
     mpStartItem(),
     mpEndItem(),
     mxLineWidthPopup(VclPtr<LineWidthPopup>::Create(*this)),
commit a3a674f62ab284eab6eb5c52756e130f32c5c725
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 5 18:11:41 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jan 11 14:01:44 2021 +0100

    lok: Apply chart line width
    
    Change-Id: I94a6406eeb929498592ca5430cf7248cfd3e9f77
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108815
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108924
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index f41e1fbee2ad..c84d4f8d0a25 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -504,6 +504,7 @@ private:
     void executeDispatch_FillColor(sal_uInt32 nColor);
     void executeDispatch_FillGradient(OUString sJSONGradient);
     void executeDispatch_LineColor(sal_uInt32 nColor);
+    void executeDispatch_LineWidth(sal_uInt32 nWidth);
 
     void sendPopupRequest(OUString const & rCID, tools::Rectangle aRectangle);
 
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 2bfb3ba4e644..1528a322c719 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1132,6 +1132,15 @@ void SAL_CALL ChartController::dispatch(
             this->executeDispatch_LineColor(nColor);
         }
     }
+    else if(aCommand == "LineWidth")
+    {
+        if (rArgs.getLength() > 0)
+        {
+            sal_uInt32 nWidth = -1;
+            rArgs[0].Value >>= nWidth;
+            this->executeDispatch_LineWidth(nWidth);
+        }
+    }
     else if(aCommand.startsWith("FillGradient"))
     {
         this->executeDispatch_FillGradient(aCommand.copy(aCommand.indexOf('=') + 1));
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index b1e81f3a24ae..d205ffc07dda 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -1025,6 +1025,36 @@ void ChartController::executeDispatch_LineColor(sal_uInt32 nColor)
     }
 }
 
+void ChartController::executeDispatch_LineWidth(sal_uInt32 nWidth)
+{
+    try
+    {
+        OUString aCID( m_aSelection.getSelectedCID() );
+        const uno::Reference< frame::XModel >& xChartModel = getModel();
+        if( xChartModel.is() )
+        {
+            Reference< beans::XPropertySet > xPropSet(
+                ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) );
+
+            ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+            if (eType == OBJECTTYPE_DIAGRAM)
+            {
+                css::uno::Reference<css::chart2::XDiagram> xDiagram(
+                        xPropSet, css::uno::UNO_QUERY);
+                if (xDiagram.is())
+                    xPropSet.set(xDiagram->getWall());
+            }
+
+            if( xPropSet.is() )
+                xPropSet->setPropertyValue( "LineWidth", css::uno::makeAny( nWidth ) );
+        }
+    }
+    catch( const uno::Exception& )
+    {
+        DBG_UNHANDLED_EXCEPTION( "chart2" );
+    }
+}
+
 void ChartController::executeDispatch_LOKSetTextSelection(int nType, int nX, int nY)
 {
     if (m_pDrawViewWrapper)
commit a8b4fd0103a528915ebc66b09e254325abbb73cb
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Jan 5 10:36:31 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jan 11 14:01:25 2021 +0100

    lok: send chart color updates
    
    Change-Id: I037049fb19ddf4c1450d7d9327c574cb4e37977c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108793
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108922
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/chart2/source/controller/sidebar/ChartColorWrapper.cxx b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
index b47d6fd6c2aa..aed95c711c21 100644
--- a/chart2/source/controller/sidebar/ChartColorWrapper.cxx
+++ b/chart2/source/controller/sidebar/ChartColorWrapper.cxx
@@ -14,6 +14,10 @@
 
 #include <svx/tbcontrl.hxx>
 
+#include <comphelper/lok.hxx>
+#include <sfx2/viewsh.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
 namespace chart { namespace sidebar {
 
 namespace {
@@ -109,6 +113,16 @@ void ChartColorWrapper::updateData()
     aEvent.IsEnabled = true;
     aEvent.State = xPropSet->getPropertyValue(maPropertyName);
     mpControl->statusChanged(aEvent);
+
+    SfxViewShell* pViewShell = SfxViewShell::Current();
+    if (comphelper::LibreOfficeKit::isActive() && pViewShell && (maPropertyName == aLineColor))
+    {
+        std::string sCommand = OUStringToOString(aUrl.Complete, RTL_TEXTENCODING_ASCII_US).getStr();
+        sal_uInt32 nColor = -1;
+        aEvent.State >>= nColor;
+        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED,
+                                               (sCommand + "=" + std::to_string(nColor)).c_str());
+    }
 }
 
 } }
commit 21db3d290331a43afccd9c994901e725e295d550
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Jan 4 13:35:25 2021 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Jan 11 14:01:04 2021 +0100

    lok: Apply chart line color
    
    Change-Id: I21b96485f26439844f19278e0d6340b55012d4ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108666
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108921
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index 50568da2e998..f41e1fbee2ad 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -503,6 +503,7 @@ private:
     void executeDispatch_LOKPieSegmentDragging(int nOffset);
     void executeDispatch_FillColor(sal_uInt32 nColor);
     void executeDispatch_FillGradient(OUString sJSONGradient);
+    void executeDispatch_LineColor(sal_uInt32 nColor);
 
     void sendPopupRequest(OUString const & rCID, tools::Rectangle aRectangle);
 
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index fb1ed3efabc1..2bfb3ba4e644 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1123,6 +1123,15 @@ void SAL_CALL ChartController::dispatch(
             this->executeDispatch_FillColor(nColor);
         }
     }
+    else if(aCommand == "XLineColor")
+    {
+        if (rArgs.getLength() > 0)
+        {
+            sal_uInt32 nColor = -1;
+            rArgs[0].Value >>= nColor;
+            this->executeDispatch_LineColor(nColor);
+        }
+    }
     else if(aCommand.startsWith("FillGradient"))
     {
         this->executeDispatch_FillGradient(aCommand.copy(aCommand.indexOf('=') + 1));
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 94bafa620bce..b1e81f3a24ae 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -995,6 +995,36 @@ void ChartController::executeDispatch_FillGradient(OUString sJSONGradient)
     }
 }
 
+void ChartController::executeDispatch_LineColor(sal_uInt32 nColor)
+{
+    try
+    {
+        OUString aCID( m_aSelection.getSelectedCID() );
+        const uno::Reference< frame::XModel >& xChartModel = getModel();
+        if( xChartModel.is() )
+        {
+            Reference< beans::XPropertySet > xPropSet(
+                ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) );
+
+            ObjectType eType = ObjectIdentifier::getObjectType(aCID);
+            if (eType == OBJECTTYPE_DIAGRAM)
+            {
+                css::uno::Reference<css::chart2::XDiagram> xDiagram(
+                        xPropSet, css::uno::UNO_QUERY);
+                if (xDiagram.is())
+                    xPropSet.set(xDiagram->getWall());
+            }
+
+            if( xPropSet.is() )
+                xPropSet->setPropertyValue( "LineColor", css::uno::makeAny( Color(nColor) ) );
+        }
+    }
+    catch( const uno::Exception& )
+    {
+        DBG_UNHANDLED_EXCEPTION( "chart2" );
+    }
+}
+
 void ChartController::executeDispatch_LOKSetTextSelection(int nType, int nX, int nY)
 {
     if (m_pDrawViewWrapper)


More information about the Libreoffice-commits mailing list