sc drawstyles: Enable the clear DF command

.uno:StandardTextAttributes works for shape formatting already
(despite its name), but it's a different command than Format >
Clear DF. So let's connect the regular Clear DF command to the
same code.

Also includes a workaround for comments to maintain their size.
Changing the size (because of the "Fit height to text" setting)
is probably confusing for other shapes as well, but for comments
this requires an extra step to undo, as comments can't be resized
unless they're shown permanently. And manually resizing each
comment back will also result with inconsistency in their size.

Change-Id: I7c158523ecc4be18d17479632eaf9fd2a51dca12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151161
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
This commit is contained in:
Maxim Monastirsky 2023-04-28 11:48:25 +03:00
parent 1497d5c8dd
commit 0a74b5fcfb
4 changed files with 22 additions and 3 deletions

View file

@ -37,6 +37,7 @@ interface TableDraw
SID_DRAW_CHART [ StateMethod = StateDisableItems; ]
SID_TEXT_STANDARD [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ]
SID_CELL_FORMAT_RESET [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ]
SID_DRAWTEXT_ATTR_DLG [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ]
// ---- Slot-IDs for Objectbar:

View file

@ -47,6 +47,7 @@ interface TableDrawText
SID_THESAURUS [ ExecMethod = Execute; StateMethod = GetState; ]
// attribute:
SID_TEXT_STANDARD [ ExecMethod = ExecuteAttr; StateMethod = GetState; ]
SID_CELL_FORMAT_RESET [ ExecMethod = ExecuteAttr; StateMethod = GetState; ]
SID_DRAWTEXT_ATTR_DLG [ ExecMethod = ExecuteAttr; StateMethod = GetState; ]
SID_ATTR_CHAR_FONT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ]
SID_ATTR_CHAR_FONTHEIGHT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ]

View file

@ -161,9 +161,15 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq )
}
break;
case SID_TEXT_STANDARD: // delete hard text attributes
case SID_CELL_FORMAT_RESET:
case SID_TEXT_STANDARD:
{
SfxItemSetFixed<EE_ITEMS_START, EE_ITEMS_END> aEmptyAttr(GetPool());
SfxItemSetFixed<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_MINFRAMEHEIGHT,
SDRATTR_TEXT_MAXFRAMEHEIGHT, SDRATTR_TEXT_MAXFRAMEWIDTH> aEmptyAttr(GetPool());
if (ScDrawLayer::IsNoteCaption(pSingleSelectedObj))
aEmptyAttr.Put(pView->GetAttrFromMarked(true));
pView->SetAttributes(aEmptyAttr, true);
}
break;

View file

@ -791,7 +791,8 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq )
{
switch ( nSlot )
{
case SID_TEXT_STANDARD: // delete hard text attributes
case SID_CELL_FORMAT_RESET:
case SID_TEXT_STANDARD:
{
OutlinerView* pOutView = pView->IsTextEdit() ?
pView->GetTextEditOutlinerView() : nullptr;
@ -799,8 +800,18 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq )
pOutView->Paint( tools::Rectangle() );
SfxItemSetFixed<EE_ITEMS_START, EE_ITEMS_END> aEmptyAttr( *aEditAttr.GetPool() );
SfxItemSetFixed<SDRATTR_TEXT_MINFRAMEHEIGHT, SDRATTR_TEXT_MINFRAMEHEIGHT,
SDRATTR_TEXT_MAXFRAMEHEIGHT, SDRATTR_TEXT_MAXFRAMEWIDTH> aSizeAttr(*aEditAttr.GetPool());
aSizeAttr.Put(pView->GetAttrFromMarked(true));
pView->SetAttributes( aEmptyAttr, true );
if (IsNoteEdit())
{
pView->SetAttributes(aSizeAttr, false);
pView->GetTextEditObject()->AdjustTextFrameWidthAndHeight();
}
if ( pOutView )
{
lcl_RemoveFields( *pOutView );