related tdf#80194 SvxEscapementItem: set auto flag as default

This OUGHT to effectively be identical - since nProp
is the default, and the DFLT_ESC_ values match what
_AUTO_ ought to calculate. So it shouldn't be too scary.
It would ?only? expose areas that deficiently handle _AUTO_.

The primary intended effect is on calling .uno:SubScript
(via the properties panel or toolbar) and getting an
automatic subscript/superscript for editeng text
(which would be draw/impress/calc objects, or Writer textboxes).

Instead of setting the default value for subscript/superscript,
set the auto-flag so the computer can more intelligently handle
the positioning. That's what I would expect as a user,
especially since this is the default in the character format dialog,
and Writer already did this explicitly.

One possible downside to this is that "automatic" is less
clearly defined for pixel-exact compatibility with other
programs, or for export/import. But we already do that with
Writer - which is the most concerned about pixel-exactness...

Prior to 7.0, editeng automatic subscripts weren't calculated very well
(i.e. subscripts were placed way too low).
So don't enable automatic mode until after 7.6,
so that the older, stable versions have a chance
to not mess up positioning an automatic value
on newly created documents.

CAUTION: Doing this at such a low level might be too radical.
The other option would be to specify it at all of the
SID_SET_SUB_SCRIPT locations - similar to the way that
Writer did it.

Change-Id: Ic6fb866477653ff57edd02bb894769545a60acf3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88998
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/include/editeng/escapementitem.hxx b/include/editeng/escapementitem.hxx
index ea8f99e..d9d4f7d 100644
--- a/include/editeng/escapementitem.hxx
+++ b/include/editeng/escapementitem.hxx
@@ -73,9 +73,9 @@ public:
        {
            nProp = DFLT_ESC_PROP;
            if( SvxEscapement::Superscript == eNew )
                nEsc = DFLT_ESC_SUPER;
                nEsc = DFLT_ESC_AUTO_SUPER;
            else
                nEsc = DFLT_ESC_SUB;
                nEsc = DFLT_ESC_AUTO_SUB;
        }
    }
    SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index 6c97143..fad1776 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1840,6 +1840,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147310)
    }
}

CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf80194_autoSubscript)
{
    createSwDoc();

    CPPUNIT_ASSERT_EQUAL_MESSAGE(
        "Automatic mode enabled", false,
        getProperty<bool>(getRun(getParagraph(1), 1), "CharAutoEscapement"));
    dispatchCommand(mxComponent, ".uno:SubScript", {});
    // Writer has always had automatic mode enabled when creating subscript/superscripts.
    CPPUNIT_ASSERT_EQUAL_MESSAGE(
        "Automatic mode enabled", true,
        getProperty<bool>(getRun(getParagraph(1), 1), "CharAutoEscapement"));
}

CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf64242_optimizeTable)
{
    createSwDoc("tdf64242_optimizeTable.odt");
diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx
index c5c90c8..68f4197 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -115,10 +115,6 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq)
                break;
            }
            SvxEscapementItem aEscape( eEscape, RES_CHRATR_ESCAPEMENT );
            if(eEscape == SvxEscapement::Superscript)
                aEscape.GetEsc() = DFLT_ESC_AUTO_SUPER;
            else if(eEscape == SvxEscapement::Subscript)
                aEscape.GetEsc() = DFLT_ESC_AUTO_SUB;
            rSh.SetAttrItem( aEscape );
            rReq.AppendItem( aEscape );
            rReq.Done();