[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - cui/source include/editeng sd/qa

Tamás Zolnai tamas.zolnai at collabora.com
Tue Jul 11 15:45:03 UTC 2017


 cui/source/tabpages/numpages.cxx  |    1 +
 include/editeng/numitem.hxx       |    5 ++++-
 sd/qa/unit/data/odp/tdf108925.odp |binary
 sd/qa/unit/import-tests.cxx       |   19 +++++++++++++++++++
 4 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit d778119b867b67241b54fd7a9698c839e9bc00f5
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Fri Jul 7 16:22:47 2017 +0200

    tdf#108925: Too small bullet size confuses the user
    
    Add a constraint for bullet relative size to avoid too small
    bullets which are hardly recognizable. Use the same 25% lower
    limit what MSO uses.
    
    Change-Id: Id956ecf3ec831c569188b944be58da03bf30a55e
    Reviewed-on: https://gerrit.libreoffice.org/39696
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit 11652be4071ef6d1d89b2c397aa1a32476e03bf6)
    Reviewed-on: https://gerrit.libreoffice.org/39707
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 8b41a475fbff..04ebf4e947f2 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1113,6 +1113,7 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(vcl::Window* pParent,
 
     get(m_pBulRelSizeFT, "relsizeft");
     get(m_pBulRelSizeMF, "relsize");
+    m_pBulRelSizeMF->SetMin(SVX_NUM_REL_SIZE_MIN);
 
     get(m_pAllLevelFT, "sublevelsft");
     get(m_pAllLevelNF, "sublevels");
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 16d418de7f7b..1e72154b43b2 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -34,6 +34,7 @@
 #include <editeng/editengdllapi.h>
 #include <o3tl/typed_flags_set.hxx>
 #include <memory>
+#include <algorithm>
 
 class SvxBrushItem;
 namespace vcl { class Font; }
@@ -48,6 +49,8 @@ namespace com{namespace sun{ namespace star{
 
 #define SVX_NO_NUM              200 // Marker for no numbering
 #define SVX_NO_NUMLEVEL         0x20
+#define SVX_NUM_REL_SIZE_MIN    25 // Lower limit for numbering relative size
+
 
 #define LINK_TOKEN  0x80 //indicate linked bitmaps - for use in dialog only
 class EDITENG_DLLPUBLIC SvxNumberType
@@ -168,7 +171,7 @@ public:
     const vcl::Font* GetBulletFont() const {return pBulletFont;}
     void            SetBulletChar(sal_Unicode cSet){cBullet = cSet;}
     sal_Unicode     GetBulletChar()const {return cBullet;}
-    void            SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = nSet;}
+    void            SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = std::max(nSet,sal_uInt16(SVX_NUM_REL_SIZE_MIN));}
     sal_uInt16      GetBulletRelSize() const { return nBulletRelSize;}
     void            SetBulletColor(Color nSet){nBulletColor = nSet;}
     const Color&    GetBulletColor()const {return nBulletColor;}
diff --git a/sd/qa/unit/data/odp/tdf108925.odp b/sd/qa/unit/data/odp/tdf108925.odp
new file mode 100755
index 000000000000..5b6dfc4ca4a2
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf108925.odp differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index da02f49c6946..fde285c39ef7 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -160,6 +160,7 @@ public:
     void testTdf105150PPT();
     void testTdf100926();
     void testTdf89064();
+    void testTdf108925();
 
     bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
     void testPatternImport();
@@ -228,6 +229,7 @@ public:
     CPPUNIT_TEST(testTdf100926);
     CPPUNIT_TEST(testPatternImport);
     CPPUNIT_TEST(testTdf89064);
+    CPPUNIT_TEST(testTdf108925);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -2196,6 +2198,23 @@ void SdImportTest::testTdf89064()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf108925()
+{
+    // Test document contains bulleting with too small bullet size (1%) which breaks the lower constraint
+    // So it should be converted to the lowest allowed value (25%).
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf108925.odp"), ODP);
+    const SdrPage *pPage = GetPage(1, xDocShRef);
+    SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>(pPage->GetObj(0));
+    CPPUNIT_ASSERT_MESSAGE("No text object", pTxtObj != nullptr);
+    const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
+
+    const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET));
+    CPPUNIT_ASSERT(pNumFmt);
+    CPPUNIT_ASSERT_EQUAL(pNumFmt->GetNumRule()->GetLevel(0).GetBulletRelSize(), sal_uInt16(25));
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list