[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sd/inc sd/qa sd/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Nov 21 08:54:57 UTC 2016


 sd/inc/glob.hrc                    |    3 +++
 sd/qa/unit/misc-tests.cxx          |   22 ++++++++++++++++++----
 sd/source/core/glob.src            |    9 +++++++++
 sd/source/ui/func/futext.cxx       |    2 ++
 sd/source/ui/inc/DrawViewShell.hxx |    2 +-
 5 files changed, 33 insertions(+), 5 deletions(-)

New commits:
commit be2de90a0f32fb6054691cdba4ef533f236a1072
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Nov 16 13:34:07 2016 +0200

    tdf#103950 Undo does not revert bundled font size changes for table cells
    
    Change-Id: Id41b7777739bfa93610f955e6c31f8bb979b8e2c
    Reviewed-on: https://gerrit.libreoffice.org/30902
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 90646b4966c73637ddf592acd05b3091fb3fa41f)
    Reviewed-on: https://gerrit.libreoffice.org/30956

diff --git a/sd/inc/glob.hrc b/sd/inc/glob.hrc
index bec03c2..0ec289c 100644
--- a/sd/inc/glob.hrc
+++ b/sd/inc/glob.hrc
@@ -137,6 +137,9 @@
 #define RID_SLIDESORTER_ICONS                   RID_GLOB_START+227
 #define STR_DEAUTHORISE_CLIENT                  RID_GLOB_START+229
 
+#define STR_SHRINK_FONT_SIZE                    RID_GLOB_START+232
+#define STR_GROW_FONT_SIZE                      RID_GLOB_START+233
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index bc73b5f..0a436e7 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -16,6 +16,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 
 #include <comphelper/processfactory.hxx>
+#include <comphelper/dispatchcommand.hxx>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/frame/XModel2.hpp>
 
@@ -38,6 +39,7 @@
 #include <controller/SlsClipboard.hxx>
 #include <controller/SlsPageSelector.hxx>
 #include <undo/undomanager.hxx>
+#include <DrawViewShell.hxx>
 #include <chrono>
 
 using namespace ::com::sun::star;
@@ -177,17 +179,16 @@ void SdMiscTest::testTdf99396TextEdit()
     sd::DrawDocShellRef xDocSh = Load(m_directories.getURLFromSrc("/sd/qa/unit/data/tdf99396.odp"), ODP);
     sd::ViewShell* pViewShell = xDocSh->GetViewShell();
     SdPage* pPage = pViewShell->GetActualPage();
-    SdrObject* pObject = pPage->GetObj(0);
-    auto pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pObject);
+    auto pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
     CPPUNIT_ASSERT(pTableObject);
     SdrView* pView = pViewShell->GetView();
-    pView->MarkObj(pObject, pView->GetSdrPageView());
+    pView->MarkObj(pTableObject, pView->GetSdrPageView());
 
     // Make sure that the undo stack is empty.
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), xDocSh->GetDoc()->GetUndoManager()->GetUndoActionCount());
 
     // Set horizontal and vertical adjustment during text edit.
-    pView->SdrBeginTextEdit(pObject);
+    pView->SdrBeginTextEdit(pTableObject);
     CPPUNIT_ASSERT(pView->GetTextEditObject());
     {
         SfxRequest aRequest(pViewShell->GetViewFrame(), SID_ATTR_PARA_ADJUST_RIGHT);
@@ -239,6 +240,19 @@ void SdMiscTest::testTdf99396TextEdit()
         CPPUNIT_ASSERT_EQUAL(SVX_ADJUST_CENTER, pAdjust->GetAdjust());
     }
 
+
+    /*
+     * now test tdf#103950 - Undo does not revert bundled font size changes for table cells
+     */
+    pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pPage->GetObj(0));
+    pView->MarkObj(pTableObject, pView->GetSdrPageView()); // select table
+    {
+        SfxRequest aRequest(pViewShell->GetViewFrame(), SID_GROW_FONT_SIZE);
+        static_cast<sd::DrawViewShell*>(pViewShell)->ExecChar(aRequest);
+    }
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), xDocSh->GetDoc()->GetUndoManager()->GetUndoActionCount());
+
+
     xDocSh->DoClose();
 }
 
diff --git a/sd/source/core/glob.src b/sd/source/core/glob.src
index d3b3a71..d158ccc 100644
--- a/sd/source/core/glob.src
+++ b/sd/source/core/glob.src
@@ -391,4 +391,13 @@ String STR_DEAUTHORISE_CLIENT
     Text [ en-US ] = "Remove client authorisation";
 };
 
+String STR_SHRINK_FONT_SIZE
+{
+    Text [ en-US ] = "Shrink font size";
+};
+String STR_GROW_FONT_SIZE
+{
+    Text [ en-US ] = "Grow font size";
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index b2af1c8..3498c40 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -1375,6 +1375,7 @@ void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFo
     else
     {
 
+        pView->BegUndo(SD_RESSTR(bGrow ? STR_GROW_FONT_SIZE : STR_SHRINK_FONT_SIZE));
         const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
         for( size_t nMark = 0; nMark < rMarkList.GetMarkCount(); ++nMark )
         {
@@ -1416,6 +1417,7 @@ void FuText::ChangeFontSize( bool bGrow, OutlinerView* pOLV, const FontList* pFo
                 }
             }
         }
+        pView->EndUndo();
     }
 }
 
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index b96a0e2..2f5acc4 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -220,7 +220,7 @@ public:
     void            ExecGoToLastPage (SfxRequest& rReq);
     void            GetStateGoToLastPage (SfxItemSet& rSet);
 
-    void            ExecChar(SfxRequest& rReq);
+    SD_DLLPUBLIC void ExecChar(SfxRequest& rReq);
 
     void            ExecuteAnnotation (SfxRequest& rRequest);
     void            GetAnnotationState (SfxItemSet& rItemSet);


More information about the Libreoffice-commits mailing list