cui/source/tabpages/chardlg.cxx              |    2 +-
 include/editeng/escapementitem.hxx           |    5 +++--
 writerfilter/source/dmapper/DomainMapper.cxx |   16 +++++++++++++---
 xmloff/source/style/escphdl.cxx              |    7 ++++---
 4 files changed, 21 insertions(+), 9 deletions(-)

New commits:
commit 39e5b45f53ad5c3634450b123e809b3057617806
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Wed May 29 16:36:41 2019 +0200
Commit:     Xisco Faulí <xiscofa...@libreoffice.org>
CommitDate: Wed Jun 5 11:30:56 2019 +0200

    tdf#120412 char formatting UI: clean-up DFLT_ESC_AUTO
    
    Default auto values must be outside of the new
    enlarged range of the superscript/subscript percent values.
    
    Note: the raising limit was modified to 13999 from 14400,
    because the RTF unit test tdf112208_hangingIndent.rtf
    lost its hanging from the bigger value.
    
    Change-Id: I3a7e9715a27570278ee4ee70f9fc9ad29457e100
    Reviewed-on: https://gerrit.libreoffice.org/73166
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit 32262b0a537207832d7d126d8427d8949b9e821d)
    Reviewed-on: https://gerrit.libreoffice.org/73460

diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index d1340a4463b3..8fa64293fe87 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -2705,7 +2705,7 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
         m_nSubProp = static_cast<sal_uInt8>(sUser.getToken( 0, ';', nIdx 
).toInt32());
 
         // tdf#120412 up to 14400% (eg. 1584 pt with 11 pt letters)
-        m_xHighLowMF->set_max(14400, FieldUnit::PERCENT);
+        m_xHighLowMF->set_max(MAX_ESC_POS, FieldUnit::PERCENT);
 
         //fdo#75307 validate all the entries and discard all of them if any are
         //out of range
diff --git a/include/editeng/escapementitem.hxx 
b/include/editeng/escapementitem.hxx
index 86e148361051..82f9dde70823 100644
--- a/include/editeng/escapementitem.hxx
+++ b/include/editeng/escapementitem.hxx
@@ -28,8 +28,9 @@
 #define DFLT_ESC_SUPER   33     // 1/3
 #define DFLT_ESC_SUB    -33     // also 1/3 previously 8/100
 #define DFLT_ESC_PROP    58
-#define DFLT_ESC_AUTO_SUPER 101
-#define DFLT_ESC_AUTO_SUB  -101
+#define MAX_ESC_POS      13999
+#define DFLT_ESC_AUTO_SUPER  (MAX_ESC_POS+1)
+#define DFLT_ESC_AUTO_SUB    -DFLT_ESC_AUTO_SUPER
 
 /*  [Description]
 
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 6276d56a1b01..195e360a671d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -68,6 +68,7 @@
 #include <comphelper/types.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/sequence.hxx>
+#include <editeng/escapementitem.hxx>
 #include <filter/msfilter/util.hxx>
 #include <sfx2/DocumentMetadataAccess.hxx>
 #include <unotools/mediadescriptor.hxx>
@@ -2206,9 +2207,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
         sal_Int16 nEscapement = 0;
         sal_Int8 nProp  = 58;
         if ( sStringValue == "superscript" )
-                nEscapement = 101;
+                nEscapement = DFLT_ESC_AUTO_SUPER;
         else if ( sStringValue == "subscript" )
-                nEscapement = -101;
+                nEscapement = DFLT_ESC_AUTO_SUB;
         else
             nProp = 100;
 
@@ -2839,8 +2840,17 @@ void DomainMapper::processDeferredCharacterProperties( 
const std::map< sal_Int32
                     nEscapement = ( nIntValue > 0 ) ? 58: -58;
                 }
             }
+
             // tdf#120412 up to 14400% (eg. 1584 pt with 11 pt letters)
-            if( nEscapement > 14400 ) nEscapement = 14400;
+            if ( nEscapement > MAX_ESC_POS )
+            {
+                nEscapement = MAX_ESC_POS;
+            }
+            else if ( nEscapement < -MAX_ESC_POS )
+            {
+                nEscapement = -MAX_ESC_POS;
+            }
+
             rContext->Insert(PROP_CHAR_ESCAPEMENT,         uno::makeAny( 
nEscapement ) );
             rContext->Insert(PROP_CHAR_ESCAPEMENT_HEIGHT,  uno::makeAny( nProp 
) );
         }
diff --git a/xmloff/source/style/escphdl.cxx b/xmloff/source/style/escphdl.cxx
index f97ca6ee1f2f..f52c360d0865 100644
--- a/xmloff/source/style/escphdl.cxx
+++ b/xmloff/source/style/escphdl.cxx
@@ -28,10 +28,11 @@
 using namespace ::com::sun::star;
 using namespace ::xmloff::token;
 
-// this is a copy of defines in svx/inc/escpitem.hxx
+// this is a copy of defines in include/editeng/escapementitem.hxx
 #define DFLT_ESC_PROP    58
-#define DFLT_ESC_AUTO_SUPER 101
-#define DFLT_ESC_AUTO_SUB  -101
+#define MAX_ESC_POS      13999
+#define DFLT_ESC_AUTO_SUPER  (MAX_ESC_POS+1)
+#define DFLT_ESC_AUTO_SUB    -DFLT_ESC_AUTO_SUPER
 
 
 // class XMLEscapementPropHdl
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to