[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 2 commits - chart2/source desktop/source include/vcl vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 22 11:10:54 UTC 2020


 chart2/source/controller/inc/ChartController.hxx        |    1 
 chart2/source/controller/main/ChartController.cxx       |    9 ++++
 chart2/source/controller/main/ChartController_Tools.cxx |   20 +++++++++
 desktop/source/lib/init.cxx                             |    2 
 include/vcl/uitest/uiobject.hxx                         |    2 
 vcl/source/uitest/uiobject.cxx                          |   33 +++++++++++++---
 6 files changed, 61 insertions(+), 6 deletions(-)

New commits:
commit 2fa5ba8346b484d45d143a982bc6d44586de2d6c
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Sep 17 13:27:53 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Sep 22 13:10:27 2020 +0200

    lok: Add posibility to change chart fill color
    
    Change-Id: I519a0fe15c4983803109aed7eef840d36a5e7b21
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102920
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    (cherry picked from commit 5b7d841f062de8872457369da4d4e8e35be9bf60)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103062
    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 6b4d7782be89..6894ab3b3592 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -502,6 +502,7 @@ private:
 
     void executeDispatch_LOKSetTextSelection(int nType, int nX, int nY);
     void executeDispatch_LOKPieSegmentDragging(int nOffset);
+    void executeDispatch_FillColor(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 96ec317defa6..c2dc975d02f2 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -1104,6 +1104,15 @@ void SAL_CALL ChartController::dispatch(
             this->executeDispatch_PositionAndSize(&rArgs);
         }
     }
+    else if(aCommand == "FillColor")
+    {
+        if (rArgs.getLength() > 0)
+        {
+            sal_uInt32 nColor = -1;
+            rArgs[0].Value >>= nColor;
+            this->executeDispatch_FillColor(nColor);
+        }
+    }
     else if(aCommand == "Paste")
         this->executeDispatch_Paste();
     else if(aCommand == "Copy" )
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 74f7e9ab6f79..646aaf535b17 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -932,6 +932,26 @@ void ChartController::executeDispatch_ToggleGridVertical()
     }
 }
 
+void ChartController::executeDispatch_FillColor(sal_uInt32 nColor)
+{
+    try
+    {
+        OUString aCID( m_aSelection.getSelectedCID() );
+        const uno::Reference< frame::XModel >& xChartModel = getModel();
+        if( xChartModel.is() )
+        {
+            Reference< beans::XPropertySet > xPointProperties(
+                ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ) );
+            if( xPointProperties.is() )
+                xPointProperties->setPropertyValue( "FillColor", uno::Any( nColor ) );
+        }
+    }
+    catch( const uno::Exception & ex )
+    {
+        SAL_WARN( "chart2", "Exception caught. " << ex );
+    }
+}
+
 void ChartController::executeDispatch_LOKSetTextSelection(int nType, int nX, int nY)
 {
     if (m_pDrawViewWrapper)
commit a22a6cb8c3afdd7db3a5d23c64cd2f20d4fbd291
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Sep 17 10:18:23 2020 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue Sep 22 13:10:17 2020 +0200

    jsdialog: use window only if visible
    
    When there is a name conflict we should take
    currently visible window.
    
    Change-Id: Iaccf03a78b083ecaca0ee6aa538674a6de093a4b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102903
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103142

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 91613147b624..d6cd2f3fb9ce 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3748,7 +3748,7 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned long
             if (!bIsWeldedDialog)
             {
                 WindowUIObject aUIObject(pWindow);
-                std::unique_ptr<UIObject> pUIWindow(aUIObject.get_child(aMap["id"]));
+                std::unique_ptr<UIObject> pUIWindow(aUIObject.get_visible_child(aMap["id"]));
                 if (pUIWindow) {
                     bool bIsClickAction = false;
 
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index 43035e2fa39e..60d84dedbe24 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -119,6 +119,8 @@ public:
 
     virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override;
 
+    virtual std::unique_ptr<UIObject> get_visible_child(const OUString& rID);
+
     virtual std::set<OUString> get_children() const override;
 
     virtual OUString dumpState() const override;
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index f2361fad3965..3d6242697066 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -381,7 +381,7 @@ OUString WindowUIObject::get_type() const
 
 namespace {
 
-vcl::Window* findChild(vcl::Window* pParent, const OUString& rID)
+vcl::Window* findChild(vcl::Window* pParent, const OUString& rID, bool bRequireVisible = false)
 {
     if (!pParent)
         return nullptr;
@@ -393,12 +393,16 @@ vcl::Window* findChild(vcl::Window* pParent, const OUString& rID)
     for (size_t i = 0; i < nCount; ++i)
     {
         vcl::Window* pChild = pParent->GetChild(i);
-        if (pChild && pChild->get_id() == rID)
+        if (pChild && pChild->get_id() == rID
+            && (!bRequireVisible || pChild->IsVisible()))
             return pChild;
 
-        vcl::Window* pResult = findChild(pChild, rID);
-        if (pResult)
-            return pResult;
+        if (!bRequireVisible || pChild->IsVisible())
+        {
+            vcl::Window* pResult = findChild(pChild, rID);
+            if (pResult)
+                return pResult;
+        }
     }
 
     return nullptr;
@@ -448,6 +452,25 @@ std::unique_ptr<UIObject> WindowUIObject::get_child(const OUString& rID)
     return aFunction(pWindow);
 }
 
+std::unique_ptr<UIObject> WindowUIObject::get_visible_child(const OUString& rID)
+{
+    // in a first step try the real children before moving to the top level parent
+    // This makes it easier to handle cases with the same ID as there is a way
+    // to resolve conflicts
+    vcl::Window* pWindow = findChild(mxWindow.get(), rID, true);
+    if (!pWindow)
+    {
+        vcl::Window* pDialogParent = get_top_parent(mxWindow.get());
+        pWindow = findChild(pDialogParent, rID, true);
+    }
+
+    if (!pWindow)
+        throw css::uno::RuntimeException("Could not find child with id: " + rID);
+
+    FactoryFunction aFunction = pWindow->GetUITestFactory();
+    return aFunction(pWindow);
+}
+
 std::set<OUString> WindowUIObject::get_children() const
 {
     vcl::Window* pDialogParent = get_top_parent(mxWindow.get());


More information about the Libreoffice-commits mailing list