summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-07-07 16:22:47 +0200
committerAndras Timar <andras.timar@collabora.com>2017-07-10 22:47:39 +0200
commit166d63036b57672a16d50663246c73750ef98ea7 (patch)
tree292bbaac5120c1e9ab678afe2b2047ed02efa786
parenta59cf3ecab2f327801c2b580d20df9e8b643cc6c (diff)
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. Reviewed-on: https://gerrit.libreoffice.org/39696 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 11652be4071ef6d1d89b2c397aa1a32476e03bf6) Change-Id: Id956ecf3ec831c569188b944be58da03bf30a55e Reviewed-on: https://gerrit.libreoffice.org/39709 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--cui/source/tabpages/numpages.cxx1
-rw-r--r--include/editeng/numitem.hxx5
-rwxr-xr-xsd/qa/unit/data/odp/tdf108925.odpbin0 -> 11219 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx19
4 files changed, 24 insertions, 1 deletions
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index 49564a9e1716..ded539a44714 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -1108,6 +1108,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 86d8b0591ede..b10056c70100 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -33,6 +33,7 @@
#include <unotools/fontcvt.hxx>
#include <editeng/editengdllapi.h>
#include <o3tl/typed_flags_set.hxx>
+#include <algorithm>
class SvxBrushItem;
namespace vcl { class Font; }
@@ -47,6 +48,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
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf108925.odp
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index b6f3462f7744..4e62c3479cf2 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -141,6 +141,7 @@ public:
void testTdf104015();
void testTdf104201();
void testTdf104445();
+ void testTdf108925();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -200,6 +201,7 @@ public:
CPPUNIT_TEST(testTdf104015);
CPPUNIT_TEST(testTdf104201);
CPPUNIT_TEST(testTdf104445);
+ CPPUNIT_TEST(testTdf108925);
CPPUNIT_TEST_SUITE_END();
};
@@ -1770,6 +1772,23 @@ void SdImportTest::testTdf104445()
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();