[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - desktop/source include/LibreOfficeKit include/vcl sc/source

Marco Cecchetti marco.cecchetti at collabora.com
Thu Nov 30 16:30:08 UTC 2017


 desktop/source/lib/init.cxx               |   33 ++++++++++++++----------------
 include/LibreOfficeKit/LibreOfficeKit.h   |    4 +++
 include/LibreOfficeKit/LibreOfficeKit.hxx |   13 +++++++++++
 include/vcl/ITiledRenderable.hxx          |   26 +++++++++++------------
 sc/source/ui/unoobj/docuno.cxx            |   26 +++++++++++------------
 sc/source/ui/view/tabview.cxx             |    4 +--
 6 files changed, 61 insertions(+), 45 deletions(-)

New commits:
commit e74fc612fb87d942a5ad74b882b211dcafb3967d
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Tue Nov 28 23:08:34 2017 +0100

    lok: calc: set outline state
    
    use a specific message from the client for set the visibility state of
    a group instead of hijacking the update row/column header message
    
    Change-Id: I9634c24bbffaddc916c8ad716ac6d5d31e735a55
    Reviewed-on: https://gerrit.libreoffice.org/45471
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 62e2def43b8f..82f76bafe2c1 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -619,6 +619,7 @@ static void doc_setClientZoom(LibreOfficeKitDocument* pThis,
                                     int nTileTwipWidth,
                                     int nTileTwipHeight);
 static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight);
+static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden);
 static int doc_createView(LibreOfficeKitDocument* pThis);
 static void doc_destroyView(LibreOfficeKitDocument* pThis, int nId);
 static void doc_setView(LibreOfficeKitDocument* pThis, int nId);
@@ -676,6 +677,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone
         m_pDocumentClass->getCommandValues = doc_getCommandValues;
         m_pDocumentClass->setClientZoom = doc_setClientZoom;
         m_pDocumentClass->setClientVisibleArea = doc_setClientVisibleArea;
+        m_pDocumentClass->setOutlineState = doc_setOutlineState;
 
         m_pDocumentClass->createView = doc_createView;
         m_pDocumentClass->destroyView = doc_destroyView;
@@ -3018,10 +3020,6 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
             int nY = 0;
             int nWidth = 0;
             int nHeight = 0;
-            bool bColumn = false;
-            int nLevel = -1;
-            int nGroupIndex = -2;
-            bool bHidden = false;
             OString aArguments = aCommand.copy(aViewRowColumnHeaders.getLength() + 1);
             sal_Int32 nParamIndex = 0;
             do
@@ -3047,23 +3045,10 @@ static char* doc_getCommandValues(LibreOfficeKitDocument* pThis, const char* pCo
                     nWidth = aValue.toInt32();
                 else if (aKey == "height")
                     nHeight = aValue.toInt32();
-                else if (aKey == "columnOutline")
-                    bColumn = aValue.toBoolean();
-                else if (aKey == "groupLevel")
-                    nLevel = aValue.toInt32();
-                else if (aKey == "groupIndex")
-                    nGroupIndex = aValue.toInt32();
-                else if (aKey == "groupHidden")
-                    bHidden = aValue.toBoolean();
             }
             while (nParamIndex >= 0);
 
             aRectangle = Rectangle(nX, nY, nX + nWidth, nY + nHeight);
-
-            if (nGroupIndex != -2)
-            {
-                pDoc->setOutlineState(bColumn, nLevel, nGroupIndex, bHidden);
-            }
         }
 
         OUString aHeaders = pDoc->getRowColumnHeaders(aRectangle);
@@ -3165,6 +3150,20 @@ static void doc_setClientVisibleArea(LibreOfficeKitDocument* pThis, int nX, int
     pDoc->setClientVisibleArea(aRectangle);
 }
 
+static void doc_setOutlineState(LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden)
+{
+    SolarMutexGuard aGuard;
+
+    ITiledRenderable* pDoc = getTiledRenderable(pThis);
+    if (!pDoc)
+    {
+        gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering";
+        return;
+    }
+
+    pDoc->setOutlineState(bColumn, nLevel, nIndex, bHidden);
+}
+
 static int doc_createView(LibreOfficeKitDocument* /*pThis*/)
 {
     SolarMutexGuard aGuard;
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 355c44579933..40f74f4f8f1a 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -213,9 +213,13 @@ struct _LibreOfficeKitDocumentClass
             int nTilePixelHeight,
             int nTileTwipWidth,
             int nTileTwipHeight);
+
     /// @see lok::Document::setVisibleArea).
     void (*setClientVisibleArea) (LibreOfficeKitDocument* pThis, int nX, int nY, int nWidth, int nHeight);
 
+    /// @see lok::Document::setOutlineState).
+    void (*setOutlineState) (LibreOfficeKitDocument* pThis, bool bColumn, int nLevel, int nIndex, bool bHidden);
+
     /// @see lok::Document::createView().
     int (*createView) (LibreOfficeKitDocument* pThis);
     /// @see lok::Document::destroyView().
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 08fbcf857abc..93c7e574ec57 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -447,6 +447,19 @@ public:
     }
 
     /**
+     * Show/Hide a single row/column header outline for Calc dosuments.
+     *
+     * @param bColumn - if we are dealing with a column or row group
+     * @param nLevel - the level to which the group belongs
+     * @param nIndex - the group entry index
+     * @param bHidden - the new group state (collapsed/expanded)
+     */
+    void setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden)
+    {
+        mpDoc->pClass->setOutlineState(mpDoc, bColumn, nLevel, nIndex, bHidden);
+    }
+
+    /**
      * Create a new view for an existing document.
      * By default a loaded document has 1 view.
      * @return the ID of the new view.
diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 95676d751244..b04b10eb404b 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -151,19 +151,6 @@ public:
     }
 
     /**
-     * Show/Hide a single row/column header outline for Calc dosuments.
-     *
-     * @param bColumn - if we are dealing with a column or row group
-     * @param nLevel - the level to which the group belongs
-     * @param nIndex - the group entry index
-     * @param bHidden - the new group state (collapsed/expanded)
-     */
-    virtual void setOutlineState(bool /*bColumn*/, int /*nLevel*/, int /*nIndex*/, bool /*bHidden*/)
-    {
-        return;
-    }
-
-    /**
      * Get position and content of row/column headers of Calc documents.
      *
      * @param rRectangle - if not empty, then limit the output only to the area of this rectangle
@@ -219,6 +206,19 @@ public:
     {
     }
 
+    /**
+     * Show/Hide a single row/column header outline for Calc dosuments.
+     *
+     * @param bColumn - if we are dealing with a column or row group
+     * @param nLevel - the level to which the group belongs
+     * @param nIndex - the group entry index
+     * @param bHidden - the new group state (collapsed/expanded)
+     */
+    virtual void setOutlineState(bool /*bColumn*/, int /*nLevel*/, int /*nIndex*/, bool /*bHidden*/)
+    {
+        return;
+    }
+
     /// Implementation for
     /// lok::Document::getCommandValues(".uno:AcceptTrackedChanges") when there
     /// is no matching UNO API.
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 0d5e4f50a159..dbd63f6ad14b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -958,19 +958,6 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int
     mnTileTwipHeight = nTileTwipHeight_;
 }
 
-void ScModelObj::setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden)
-{
-    ScViewData* pViewData = ScDocShell::GetViewData();
-
-    if (!pViewData)
-        return;
-
-    ScDBFunc* pFunc = pViewData->GetView();
-
-    if (pFunc)
-        pFunc->SetOutlineState(bColumn, nLevel, nIndex, bHidden);
-}
-
 OUString ScModelObj::getRowColumnHeaders(const Rectangle& rRectangle)
 {
     ScViewData* pViewData = ScDocShell::GetViewData();
@@ -1044,6 +1031,19 @@ void ScModelObj::setClientVisibleArea(const Rectangle& rRectangle)
     pViewData->ForcePageUpDownOffset(rRectangle.GetHeight());
 }
 
+void ScModelObj::setOutlineState(bool bColumn, int nLevel, int nIndex, bool bHidden)
+{
+    ScViewData* pViewData = ScDocShell::GetViewData();
+
+    if (!pViewData)
+        return;
+
+    ScDBFunc* pFunc = pViewData->GetView();
+
+    if (pFunc)
+        pFunc->SetOutlineState(bColumn, nLevel, nIndex, bHidden);
+}
+
 OUString ScModelObj::getPostIts()
 {
     if (!pDocShell)
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index de425afdd698..59a9899d3bd6 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2665,14 +2665,14 @@ void lcl_createGroupsData(
                     rGroupsBuffer += ", ";
                 }
 
-                bool bGroupHidden = pEntry->IsHidden();
+                int nGroupHidden = static_cast<int>(pEntry->IsHidden());
 
                 OUString aGroupData;
                 aGroupData += "{ \"level\": \"" + OUString::number(nLevel + 1) + "\", ";
                 aGroupData += "\"index\": \"" + OUString::number(nIndex) + "\", ";
                 aGroupData += "\"startPos\": \"" + OUString::number(rGroupStartPositions[nLevel]) + "\", ";
                 aGroupData += "\"endPos\": \"" + OUString::number(nTotalTwips) + "\", ";
-                aGroupData += "\"hidden\": \"" + OUString::number(bGroupHidden) + "\" }";
+                aGroupData += "\"hidden\": \"" + OUString::number(nGroupHidden) + "\" }";
 
                 rGroupsBuffer += aGroupData;
 


More information about the Libreoffice-commits mailing list