include/svx/sdr/table/tablecontroller.hxx |    1 +
 include/svx/selectioncontroller.hxx       |    2 ++
 svx/source/svdraw/selectioncontroller.cxx |    4 ++++
 svx/source/svdraw/svdview.cxx             |   29 ++++++++++++++++++++++++++++-
 svx/source/table/tablecontroller.cxx      |   15 ++++++++-------
 5 files changed, 43 insertions(+), 8 deletions(-)

New commits:
commit aeaceb5b880f886ce01927f26b4bd9602315292c
Author:     merttumer <[email protected]>
AuthorDate: Thu Apr 15 11:25:00 2021 +0300
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Jun 15 09:18:14 2021 +0200

    Implemented CTRL + A selects all the cells
    
    When the table is selected, ctrl + a should select
    all the cells unless text editing is enabled.
    The previous behavior was deselecting the table and
    marking all the objects. However, for table it should
    select all the cells instead.
    
    Change-Id: I9fb512618a61a96ff21daa74c5a4ae9b31e3906e
    Signed-off-by: merttumer <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114129
    Reviewed-by: Jan Holesovsky <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117189
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/include/svx/sdr/table/tablecontroller.hxx 
b/include/svx/sdr/table/tablecontroller.hxx
index cec83b996c87..9018e2587a2d 100644
--- a/include/svx/sdr/table/tablecontroller.hxx
+++ b/include/svx/sdr/table/tablecontroller.hxx
@@ -58,6 +58,7 @@ public:
     SVX_DLLPRIVATE virtual bool DeleteMarked() override;
 
     SVX_DLLPRIVATE virtual void onSelectionHasChanged() override;
+    SVX_DLLPRIVATE virtual void onSelectAll() override;
 
     SVX_DLLPRIVATE virtual void GetState( SfxItemSet& rSet ) override;
     SVX_DLLPRIVATE virtual void Execute( SfxRequest& rReq ) override;
diff --git a/include/svx/selectioncontroller.hxx 
b/include/svx/selectioncontroller.hxx
index 11acdac3cd59..3ce5f7849ec3 100644
--- a/include/svx/selectioncontroller.hxx
+++ b/include/svx/selectioncontroller.hxx
@@ -51,6 +51,8 @@ public:
 
     virtual void onSelectionHasChanged();
 
+    virtual void onSelectAll();
+
     virtual void GetState( SfxItemSet& rSet );
     virtual void Execute( SfxRequest& rReq );
 
diff --git a/svx/source/svdraw/selectioncontroller.cxx 
b/svx/source/svdraw/selectioncontroller.cxx
index 8cb678d66467..bc31a7543366 100644
--- a/svx/source/svdraw/selectioncontroller.cxx
+++ b/svx/source/svdraw/selectioncontroller.cxx
@@ -47,6 +47,10 @@ void SelectionController::onSelectionHasChanged()
 {
 }
 
+void SelectionController::onSelectAll()
+{
+}
+
 void SelectionController::GetState( SfxItemSet& /*rSet*/ )
 {
 }
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index c68bbe443a72..ad6e4beb7cc4 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -35,6 +35,7 @@
 #include <svdibrow.hxx>
 #endif
 
+#include <svx/sdr/table/tablecontroller.hxx>
 #include <svx/svdoutl.hxx>
 #include <svx/svdview.hxx>
 #include <editeng/editview.hxx>
@@ -1359,7 +1360,33 @@ void SdrView::MarkAll()
 #endif
     } else if (IsGluePointEditMode()) MarkAllGluePoints();
     else if (HasMarkablePoints()) MarkAllPoints();
-    else MarkAllObj();
+    else {
+        // check for table
+        bool bMarkAll = true;
+        const SdrMarkList& rMarkList = GetMarkedObjectList();
+        if (rMarkList.GetMarkCount() == 1)
+        {
+            const SdrObject* pObj(rMarkList.GetMark(0)->GetMarkedSdrObj());
+            SdrView* pView(dynamic_cast<SdrView*>(this));
+            if (pObj && pView && (pObj->GetObjInventor() == 
SdrInventor::Default)
+                && (pObj->GetObjIdentifier() == OBJ_TABLE))
+            {
+                mxSelectionController.clear();
+                mxSelectionController = sdr::table::CreateTableController(
+                    *pView, static_cast<const sdr::table::SdrTableObj&>(*pObj),
+                    mxLastSelectionController);
+
+                if (mxSelectionController.is())
+                {
+                    mxLastSelectionController.clear();
+                    mxSelectionController->onSelectAll();
+                    bMarkAll = false;
+                }
+            }
+        }
+        if ( bMarkAll )
+            MarkAllObj();
+    }
 }
 
 void SdrView::UnmarkAll()
diff --git a/svx/source/table/tablecontroller.cxx 
b/svx/source/table/tablecontroller.cxx
index e4183878c637..04d0d7a17bc6 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -410,6 +410,14 @@ void SvxTableController::onSelectionHasChanged()
         destroySelectionOverlay();
     }
 }
+void SvxTableController::onSelectAll()
+{
+    sdr::table::SdrTableObj* pTableObj = mxTableObj.get();
+    if ( pTableObj && !pTableObj->IsTextEditActive())
+    {
+        selectAll();
+    }
+}
 
 
 void SvxTableController::GetState( SfxItemSet& rSet )
commit ebe0ba78ca7f6767351023a93fd03a0f336c4189
Author:     merttumer <[email protected]>
AuthorDate: Thu Apr 15 11:21:01 2021 +0300
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Jun 15 09:17:59 2021 +0200

    Fix ESC key selects all the cells of the table object
    
    Selecting the table should not necessarily mean
    selecting all the cells. If all the cells are selected
    which ESC key does the same thing, it is impossible to
    delete the table with the delete key,
    only after an input following by an ESC
    deleselects them and deleting becomes possible.
    
    Change-Id: I33f182d330f1cbc411d47b86098a4aea544a90ae
    Signed-off-by: merttumer <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114128
    Reviewed-by: Jan Holesovsky <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117188
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Andras Timar <[email protected]>

diff --git a/svx/source/table/tablecontroller.cxx 
b/svx/source/table/tablecontroller.cxx
index 43c74993961b..e4183878c637 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -399,13 +399,6 @@ void SvxTableController::onSelectionHasChanged()
         const SdrMarkList& rMarkList= mrView.GetMarkedObjectList();
         if( rMarkList.GetMarkCount() == 1 )
             bSelected = mxTableObj.get() == 
rMarkList.GetMark(0)->GetMarkedSdrObj();
-        /* fdo#46186 Selecting the table means selecting the entire cells */
-        if (!hasSelectedCells() && pTableObj)
-        {
-            maCursorFirstPos = SdrTableObj::getFirstCell();
-            maCursorLastPos = pTableObj->getLastCell();
-            mbCellSelectionMode=true;
-        }
     }
 
     if( bSelected )
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to