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>
This commit is contained in:
Justin Luth
2023-06-12 09:30:30 +02:00
committed by Miklos Vajna
parent 49d9bdd259
commit d384ccdb04
3 changed files with 16 additions and 6 deletions
+2 -2
View File
@@ -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() ); }
+14
View File
@@ -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");
-4
View File
@@ -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();