chart2/source/controller/main/ChartController.cxx | 156 +++++++ chart2/source/controller/main/ChartController_Window.cxx | 23 + chart2/source/controller/main/ControllerCommandDispatch.cxx | 258 +++++++----- chart2/source/controller/main/ControllerCommandDispatch.hxx | 1 4 files changed, 328 insertions(+), 110 deletions(-)
New commits: commit f55d44e4133b201916f24aeb9d93e1c7fe2f459a Author: Attila Szűcs <attila.sz...@collabora.com> AuthorDate: Wed May 7 03:38:03 2025 +0200 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Tue May 13 12:21:47 2025 +0200 Chart: font sidebar for chart edited title enable font sidebar in case of chart title that is in edit mode. Made it work in both way chart <-> sidebar. It get/set data directly to the Editview. Made undo work in most cases, but not in edited title case. Change-Id: Id5c8c07b980814f3db23da4d55f1a2b9ceca5743 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185006 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 822eb1b6faeb..47152d320972 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -83,7 +83,23 @@ #include <svx/ActionDescriptionProvider.hxx> #include <comphelper/diagnose_ex.hxx> +#include <editeng/eerdll.hxx> +#include <editeng/editrids.hrc> +#include <editeng/editids.hrc> +#include <editeng/udlnitem.hxx> +#include <svx/svdoutl.hxx> +#include <editeng/outliner.hxx> +#include <editeng/postitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/crossedoutitem.hxx> #include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/shaditem.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/flstitem.hxx> // enable the following define to let the controller listen to model changes and // react on this by rebuilding the view @@ -1306,13 +1322,144 @@ void SAL_CALL ChartController::dispatch( if (xTitle.is()) { OutlinerView* pOutlinerView = nullptr; + SdrOutliner* pOutliner = nullptr; if (m_pDrawViewWrapper) { pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView(); + pOutliner = m_pDrawViewWrapper->GetTextEditOutliner(); } - // if the Title is not in edit mode - if (!pOutlinerView) + + // if the Title is in edit mode + if (pOutlinerView && pOutliner) + { + xProperties.pop_back(); + + SolarMutexGuard aSolarGuard; + SfxItemSet aEditAttr(pOutlinerView->GetAttribs()); + SfxItemSet aNewAttr(pOutliner->GetEmptyItemSet()); + + if (aCommand == "CharFontName") + { + SvxFontItem aFont(EE_CHAR_FONTINFO); + aFont.PutValue(rArgs[0].Value, 0); + aNewAttr.Put(aFont); + } + else if (aCommand == "FontHeight") + { + SvxFontHeightItem aFontHeight(260, 100, EE_CHAR_FONTHEIGHT); + aFontHeight.PutValue(rArgs[0].Value, MID_FONTHEIGHT); + aNewAttr.Put(aFontHeight); + + } + else if (aCommand == "Bold") + { + FontWeight eFW = aEditAttr.Get(EE_CHAR_WEIGHT).GetWeight(); + aNewAttr.Put(SvxWeightItem(eFW == WEIGHT_NORMAL ? WEIGHT_BOLD + : WEIGHT_NORMAL, + EE_CHAR_WEIGHT)); + } + else if (aCommand == "Italic") + { + FontItalic eFI = aEditAttr.Get(EE_CHAR_ITALIC).GetPosture(); + aNewAttr.Put(SvxPostureItem(eFI == ITALIC_NORMAL ? ITALIC_NONE + : ITALIC_NORMAL, + EE_CHAR_ITALIC)); + } + else if (aCommand == "Underline") + { + sal_Int16 nFontUnderline = 0; + sal_Int32 nFontUnderline32 = 0; + if (!(rArgs[0].Value >>= nFontUnderline) + && (rArgs[0].Value >>= nFontUnderline32)) + { + aNewAttr.Put(SvxUnderlineItem(FontLineStyle(nFontUnderline32), + EE_CHAR_UNDERLINE)); + } + else + { + FontLineStyle eFU + = aEditAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle(); + aNewAttr.Put(SvxUnderlineItem( + eFU == LINESTYLE_SINGLE ? LINESTYLE_NONE : LINESTYLE_SINGLE, + EE_CHAR_UNDERLINE)); + } + } + else if (aCommand == "Strikeout") + { + FontStrikeout eFSO + = aEditAttr.Get(EE_CHAR_STRIKEOUT).GetStrikeout(); + aNewAttr.Put(SvxCrossedOutItem( + eFSO == STRIKEOUT_SINGLE ? STRIKEOUT_NONE : STRIKEOUT_SINGLE, + EE_CHAR_STRIKEOUT)); + } + else if (aCommand == "Shadowed") + { + bool bShadow = aEditAttr.Get(EE_CHAR_SHADOW).GetValue(); + aNewAttr.Put(SvxShadowedItem(!bShadow, EE_CHAR_SHADOW)); + } + else if (aCommand == "Color" || aCommand == "FontColor") + { + SvxColorItem aColor(EE_CHAR_COLOR); + aColor.PutValue(rArgs[0].Value, MID_COLOR_RGB); + aNewAttr.Put(aColor); + } + else if (aCommand == "Grow" || aCommand == "Shrink") + { + bool bGrow = (aCommand == "Grow"); + const SfxObjectShell* pObjSh = SfxObjectShell::Current(); + const SvxFontListItem* pFontListItem + = static_cast<const SvxFontListItem*>( + pObjSh ? pObjSh->GetItem(SID_ATTR_CHAR_FONTLIST) : nullptr); + const FontList* pFontList + = pFontListItem ? pFontListItem->GetFontList() : nullptr; + pOutlinerView->GetEditView().ChangeFontSize(bGrow, pFontList); + } + else if (aCommand == "ResetAttributes") + { + aNewAttr.Put(SvxFontItem(EE_CHAR_FONTINFO)); + aNewAttr.Put(SvxFontHeightItem(260, 100, EE_CHAR_FONTHEIGHT)); + aNewAttr.Put(SvxWeightItem(WEIGHT_NORMAL, EE_CHAR_WEIGHT)); + aNewAttr.Put(SvxPostureItem(ITALIC_NONE, EE_CHAR_ITALIC)); + aNewAttr.Put(SvxUnderlineItem(LINESTYLE_NONE, EE_CHAR_UNDERLINE)); + aNewAttr.Put(SvxCrossedOutItem(STRIKEOUT_NONE, EE_CHAR_STRIKEOUT)); + aNewAttr.Put(SvxShadowedItem(false, EE_CHAR_SHADOW)); + aNewAttr.Put(SvxColorItem(Color(0), EE_CHAR_COLOR)); + aNewAttr.Put(SvxKerningItem(0, EE_CHAR_KERNING)); + aNewAttr.Put( + SvxEscapementItem(SvxEscapement::Off, EE_CHAR_ESCAPEMENT)); + } + else if (aCommand == "Spacing") + { + sal_Int16 nKerning = 0; + rArgs[0].Value >>= nKerning; + aNewAttr.Put(SvxKerningItem(nKerning, EE_CHAR_KERNING)); + } + else if (aCommand == "SuperScript" || aCommand == "SubScript") + { + SvxEscapement eCmd = aCommand == "SuperScript" + ? SvxEscapement::Superscript + : SvxEscapement::Subscript; + SvxEscapement eFE + = aEditAttr.Get(EE_CHAR_ESCAPEMENT).GetEscapement(); + aNewAttr.Put(SvxEscapementItem( + eFE == eCmd ? SvxEscapement::Off : eCmd, EE_CHAR_ESCAPEMENT)); + } + + // Set the Attributes to the Editview + pOutlinerView->SetAttribs(aNewAttr); + + // update the sidebar + ControllerCommandDispatch* pCommandDispatch + = dynamic_cast<ControllerCommandDispatch*>( + m_aDispatchContainer.getChartDispatcher().get()); + if (pCommandDispatch) + { + pCommandDispatch->updateAndFireStatus(); + } + } + else { + // if the Title is not in edit mode const Sequence<Reference<chart2::XFormattedString>> aStrings( xTitle->getText()); xProperties.pop_back(); @@ -1323,9 +1470,6 @@ void SAL_CALL ChartController::dispatch( xProperties.push_back(xTitlePropSet); } } - // Todo: implement the edit mode case here. - // the edited text attributes are a bit different from the properties - // SfxItemSet aItemSet = pOutlinerView->GetAttribs(); } } bool bAllPropertiesExist = (xProperties.size() > 0); @@ -1336,6 +1480,7 @@ void SAL_CALL ChartController::dispatch( } if (bAllPropertiesExist) { + UndoGuard aUndoGuard(EditResId(RID_OUTLUNDO_ATTR), m_xUndoManager); if (aCommand == "Bold") { executeDispatch_FontBold(xProperties); @@ -1392,6 +1537,7 @@ void SAL_CALL ChartController::dispatch( { executeDispatch_FontSubScript(xProperties); } + aUndoGuard.commit(); } } } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index b0fbf6a25cb4..484093daf878 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -599,6 +599,13 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) ( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt ) == SdrHitKind::MarkedObject ) ) { pDrawViewWrapper->MouseButtonDown(rMEvt, pChartWindow->GetOutDev()); + ControllerCommandDispatch* pCommandDispatch + = dynamic_cast<ControllerCommandDispatch*>( + m_aDispatchContainer.getChartDispatcher().get()); + if (pCommandDispatch) + { + pCommandDispatch->updateAndFireStatus(); + } return; } else @@ -771,7 +778,16 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) if(pDrawViewWrapper->IsTextEdit()) { if( pDrawViewWrapper->MouseButtonUp(rMEvt,pChartWindow->GetOutDev()) ) + { + ControllerCommandDispatch* pCommandDispatch + = dynamic_cast<ControllerCommandDispatch*>( + m_aDispatchContainer.getChartDispatcher().get()); + if (pCommandDispatch) + { + pCommandDispatch->updateAndFireStatus(); + } return; + } } // #i12587# support for shapes in chart @@ -1354,6 +1370,13 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) { EndTextEdit(); } + ControllerCommandDispatch* pCommandDispatch + = dynamic_cast<ControllerCommandDispatch*>( + m_aDispatchContainer.getChartDispatcher().get()); + if (pCommandDispatch) + { + pCommandDispatch->updateAndFireStatus(); + } } } } diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index ee2a81e48fa2..fca534d32b37 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -51,6 +51,17 @@ // only needed until #i68864# is fixed #include <com/sun/star/frame/XLayoutManager.hpp> +#include <editeng/eeitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/crossedoutitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/shaditem.hxx> +#include <editeng/escapementitem.hxx> + using namespace ::com::sun::star; using ::com::sun::star::uno::Reference; @@ -671,19 +682,7 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[ u".uno:ScaleText"_ustr ] = bIsWritable && bModelStateIsValid ; m_aCommandArguments[ u".uno:ScaleText"_ustr ] <<= bModelStateIsValid && m_apModelState->bHasAutoScaledText; - bool bTitleIsInEditMode = false; - try - { - OUString aObjectCID2 = m_xChartController->getSelectionMember().getSelectedCID(); - if (!aObjectCID2.isEmpty()) - if (ObjectIdentifier::getObjectType(aObjectCID2) == OBJECTTYPE_TITLE) - if (m_xChartController->GetDrawViewWrapper()) - if (m_xChartController->GetDrawViewWrapper()->GetTextEditOutlinerView()) - bTitleIsInEditMode = true; - } - catch (const uno::Exception&) { TOOLS_WARN_EXCEPTION("chart2", ""); } - - bool bEnableUnoCommands = bIsWritable && bModelStateIsValid && !bTitleIsInEditMode; + bool bEnableUnoCommands = bIsWritable && bModelStateIsValid; m_aCommandAvailability[u".uno:Bold"_ustr] = bEnableUnoCommands; m_aCommandAvailability[u".uno:Strikeout"_ustr] = bEnableUnoCommands; m_aCommandAvailability[u".uno:CharFontName"_ustr] = bEnableUnoCommands; @@ -700,23 +699,20 @@ void ControllerCommandDispatch::updateCommandAvailability() m_aCommandAvailability[u".uno:Spacing"_ustr] = bEnableUnoCommands; m_aCommandAvailability[u".uno:ResetAttributes"_ustr] = bEnableUnoCommands; - if (!bTitleIsInEditMode) - { - // at default they are not filled in the sidebar - m_aCommandArguments[u".uno:CharFontName"_ustr] <<= false; - m_aCommandArguments[u".uno:FontHeight"_ustr] <<= false; - m_aCommandArguments[u".uno:Bold"_ustr] <<= false; - m_aCommandArguments[u".uno:Strikeout"_ustr] <<= false; - m_aCommandArguments[u".uno:Italic"_ustr] <<= false; - m_aCommandArguments[u".uno:Underline"_ustr] <<= false; - m_aCommandArguments[u".uno:Shadowed"_ustr] <<= false; - m_aCommandArguments[u".uno:Color"_ustr] <<= false; - m_aCommandArguments[u".uno:FontColor"_ustr] <<= false; - m_aCommandArguments[u".uno:SuperScript"_ustr] <<= false; - m_aCommandArguments[u".uno:SubScript"_ustr] <<= false; - m_aCommandArguments[u".uno:Spacing"_ustr] <<= false; - m_aCommandArguments[u".uno:ResetAttributes"_ustr] <<= false; - } + // at default they are not filled in the sidebar + m_aCommandArguments[u".uno:CharFontName"_ustr] <<= false; + m_aCommandArguments[u".uno:FontHeight"_ustr] <<= false; + m_aCommandArguments[u".uno:Bold"_ustr] <<= false; + m_aCommandArguments[u".uno:Strikeout"_ustr] <<= false; + m_aCommandArguments[u".uno:Italic"_ustr] <<= false; + m_aCommandArguments[u".uno:Underline"_ustr] <<= false; + m_aCommandArguments[u".uno:Shadowed"_ustr] <<= false; + m_aCommandArguments[u".uno:Color"_ustr] <<= false; + m_aCommandArguments[u".uno:FontColor"_ustr] <<= false; + m_aCommandArguments[u".uno:SuperScript"_ustr] <<= false; + m_aCommandArguments[u".uno:SubScript"_ustr] <<= false; + m_aCommandArguments[u".uno:Spacing"_ustr] <<= false; + m_aCommandArguments[u".uno:ResetAttributes"_ustr] <<= false; // They are filled based on the text properties.. if there are only 1 // but only those properties that are true for the whole text @@ -726,7 +722,7 @@ void ControllerCommandDispatch::updateCommandAvailability() // enable the uno commands only if the title is not in edit mode // Todo: enable font panel here if the panel will be able to handle edited title. OUString aObjectCID = m_xChartController->getSelectionMember().getSelectedCID(); - if (!aObjectCID.isEmpty() && !bTitleIsInEditMode) + if (!aObjectCID.isEmpty()) { // If the selected is not title, then we should check the text properties.. // or the selected text properties? @@ -742,98 +738,144 @@ void ControllerCommandDispatch::updateCommandAvailability() { const Sequence<Reference<chart2::XFormattedString>> aStrings(xTitle->getText()); xProperties.pop_back(); - for (int i = 0; i < aStrings.getLength(); i++) + + OutlinerView* pOutlinerView = nullptr; + if (m_xChartController->GetDrawViewWrapper()) + { + pOutlinerView + = m_xChartController->GetDrawViewWrapper()->GetTextEditOutlinerView(); + } + + if (pOutlinerView) + { + SfxItemSet aEditAttr(pOutlinerView->GetAttribs()); + FontWeight eFW = aEditAttr.Get(EE_CHAR_WEIGHT).GetWeight(); + FontItalic eFI = aEditAttr.Get(EE_CHAR_ITALIC).GetPosture(); + FontLineStyle eFU = aEditAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle(); + FontStrikeout eFSO = aEditAttr.Get(EE_CHAR_STRIKEOUT).GetStrikeout(); + + uno::Any aFF; + aEditAttr.Get(EE_CHAR_FONTINFO).QueryValue(aFF, 0); + float nFFS = aEditAttr.Get(EE_CHAR_FONTHEIGHT).GetHeight(); + nFFS = o3tl::convert(nFFS, o3tl::Length::mm100, o3tl::Length::pt); + frame::status::FontHeight aFontHeight; + aFontHeight.Height = nFFS; + bool eFSH = aEditAttr.Get(EE_CHAR_SHADOW).GetValue(); + SvxEscapement eFES = aEditAttr.Get(EE_CHAR_ESCAPEMENT).GetEscapement(); + + m_aCommandArguments[u".uno:CharFontName"_ustr] = aFF; + m_aCommandArguments[u".uno:FontHeight"_ustr] <<= aFontHeight; + + m_aCommandArguments[u".uno:Bold"_ustr] <<= (eFW != WEIGHT_NORMAL); + m_aCommandArguments[u".uno:Italic"_ustr] <<= (eFI != ITALIC_NONE); + m_aCommandArguments[u".uno:Underline"_ustr] <<= (eFU != LINESTYLE_NONE); + m_aCommandArguments[u".uno:Strikeout"_ustr] <<= (eFSO != STRIKEOUT_NONE); + + m_aCommandArguments[u".uno:Shadowed"_ustr] <<= eFSH; + m_aCommandArguments[u".uno:SuperScript"_ustr] + <<= (eFES == SvxEscapement::Superscript); + m_aCommandArguments[u".uno:SubScript"_ustr] + <<= (eFES == SvxEscapement::Subscript); + } + else { - Reference<beans::XPropertySet> xTitlePropSet(aStrings[i], uno::UNO_QUERY); - xProperties.push_back(xTitlePropSet); + for (int i = 0; i < aStrings.getLength(); i++) + { + Reference<beans::XPropertySet> xTitlePropSet(aStrings[i], + uno::UNO_QUERY); + xProperties.push_back(xTitlePropSet); + } } } } - Reference<beans::XMultiPropertySet> aMObjProps(xProperties[0], uno::UNO_QUERY); - if (aMObjProps) + if (xProperties.size() > 0) { - awt::FontDescriptor aFont - = CharacterProperties::createFontDescriptorFromPropertySet(aMObjProps); - - if (!aFont.Name.isEmpty()) + Reference<beans::XMultiPropertySet> aMObjProps(xProperties[0], uno::UNO_QUERY); + if (aMObjProps) { - OUString aPropName = u"CharFontName"_ustr; - if (lcl_arePropertiesSame(xProperties, aPropName)) + awt::FontDescriptor aFont + = CharacterProperties::createFontDescriptorFromPropertySet(aMObjProps); + + if (!aFont.Name.isEmpty()) { - m_aCommandArguments[u".uno:CharFontName"_ustr] <<= aFont; + OUString aPropName = u"CharFontName"_ustr; + if (lcl_arePropertiesSame(xProperties, aPropName)) + { + m_aCommandArguments[u".uno:CharFontName"_ustr] <<= aFont; + } } } - } - OUString aPropName = u"CharHeight"_ustr; - if (lcl_arePropertiesSame(xProperties, aPropName)) - { - uno::Any aAny = xProperties[0]->getPropertyValue(aPropName); - frame::status::FontHeight aFontHeight; - aAny >>= aFontHeight.Height; - // another type is needed here, so - m_aCommandArguments[u".uno:FontHeight"_ustr] <<= aFontHeight; - } + OUString aPropName = u"CharHeight"_ustr; + if (lcl_arePropertiesSame(xProperties, aPropName)) + { + uno::Any aAny = xProperties[0]->getPropertyValue(aPropName); + frame::status::FontHeight aFontHeight; + aAny >>= aFontHeight.Height; + // another type is needed here, so + m_aCommandArguments[u".uno:FontHeight"_ustr] <<= aFontHeight; + } - aPropName = u"CharWeight"_ustr; - if (lcl_arePropertiesSame(xProperties, aPropName)) - { - float nFontWeight; - xProperties[0]->getPropertyValue(aPropName) >>= nFontWeight; - bool bFontWeight = (nFontWeight > 100.0); - m_aCommandArguments[u".uno:Bold"_ustr] <<= bFontWeight; - } + aPropName = u"CharWeight"_ustr; + if (lcl_arePropertiesSame(xProperties, aPropName)) + { + float nFontWeight; + xProperties[0]->getPropertyValue(aPropName) >>= nFontWeight; + bool bFontWeight = (nFontWeight > 100.0); + m_aCommandArguments[u".uno:Bold"_ustr] <<= bFontWeight; + } - aPropName = u"CharPosture"_ustr; - if (lcl_arePropertiesSame(xProperties, aPropName)) - { - awt::FontSlant nFontItalic; - xProperties[0]->getPropertyValue(aPropName) >>= nFontItalic; - bool bItalic = (nFontItalic == awt::FontSlant_ITALIC); - m_aCommandArguments[u".uno:Italic"_ustr] <<= bItalic; - } + aPropName = u"CharPosture"_ustr; + if (lcl_arePropertiesSame(xProperties, aPropName)) + { + awt::FontSlant nFontItalic; + xProperties[0]->getPropertyValue(aPropName) >>= nFontItalic; + bool bItalic = (nFontItalic == awt::FontSlant_ITALIC); + m_aCommandArguments[u".uno:Italic"_ustr] <<= bItalic; + } - aPropName = u"CharStrikeout"_ustr; - if (lcl_arePropertiesSame(xProperties, aPropName)) - { - sal_Int16 nFontStrikeout; - xProperties[0]->getPropertyValue(aPropName) >>= nFontStrikeout; - bool bFontStrikeout = (nFontStrikeout > 0); - m_aCommandArguments[u".uno:Strikeout"_ustr] <<= bFontStrikeout; - } + aPropName = u"CharStrikeout"_ustr; + if (lcl_arePropertiesSame(xProperties, aPropName)) + { + sal_Int16 nFontStrikeout; + xProperties[0]->getPropertyValue(aPropName) >>= nFontStrikeout; + bool bFontStrikeout = (nFontStrikeout > 0); + m_aCommandArguments[u".uno:Strikeout"_ustr] <<= bFontStrikeout; + } - aPropName = u"CharUnderline"_ustr; - if (lcl_arePropertiesSame(xProperties, aPropName)) - { - sal_Int16 nFontUnderline; - xProperties[0]->getPropertyValue(aPropName) >>= nFontUnderline; - bool bFontUnderline = (nFontUnderline > 0); - m_aCommandArguments[u".uno:Underline"_ustr] <<= bFontUnderline; - } + aPropName = u"CharUnderline"_ustr; + if (lcl_arePropertiesSame(xProperties, aPropName)) + { + sal_Int16 nFontUnderline; + xProperties[0]->getPropertyValue(aPropName) >>= nFontUnderline; + bool bFontUnderline = (nFontUnderline > 0); + m_aCommandArguments[u".uno:Underline"_ustr] <<= bFontUnderline; + } - aPropName = u"CharShadowed"_ustr; - if (lcl_arePropertiesSame(xProperties, aPropName)) - { - bool bShadowed = false; - xProperties[0]->getPropertyValue(aPropName) >>= bShadowed; - m_aCommandArguments[u".uno:Shadowed"_ustr] <<= bShadowed; - } + aPropName = u"CharShadowed"_ustr; + if (lcl_arePropertiesSame(xProperties, aPropName)) + { + bool bShadowed = false; + xProperties[0]->getPropertyValue(aPropName) >>= bShadowed; + m_aCommandArguments[u".uno:Shadowed"_ustr] <<= bShadowed; + } - // Font color is not set in panel.. it is just evnabled to use - m_aCommandArguments[u".uno:Color"_ustr] <<= false; - m_aCommandArguments[u".uno:FontColor"_ustr] <<= false; + // Font color is not set in panel.. it is just evnabled to use + m_aCommandArguments[u".uno:Color"_ustr] <<= false; + m_aCommandArguments[u".uno:FontColor"_ustr] <<= false; - aPropName = u"CharEscapement"_ustr; - if (lcl_arePropertiesSame(xProperties, aPropName)) - { - sal_Int32 nCharEscapement = 0; - xProperties[0]->getPropertyValue(aPropName) >>= nCharEscapement; - m_aCommandArguments[u".uno:SuperScript"_ustr] <<= (nCharEscapement > 0); - m_aCommandArguments[u".uno:SubScript"_ustr] <<= (nCharEscapement < 0); - } + aPropName = u"CharEscapement"_ustr; + if (lcl_arePropertiesSame(xProperties, aPropName)) + { + sal_Int32 nCharEscapement = 0; + xProperties[0]->getPropertyValue(aPropName) >>= nCharEscapement; + m_aCommandArguments[u".uno:SuperScript"_ustr] <<= (nCharEscapement > 0); + m_aCommandArguments[u".uno:SubScript"_ustr] <<= (nCharEscapement < 0); + } - // Font Spacing is not set in panel.. it is just evnabled to use - m_aCommandArguments[u".uno:Spacing"_ustr] <<= false; + // Font Spacing is not set in panel.. it is just evnabled to use + m_aCommandArguments[u".uno:Spacing"_ustr] <<= false; + } } } catch (const uno::Exception&) @@ -914,6 +956,12 @@ bool ControllerCommandDispatch::commandAvailable( const OUString & rCommand ) return false; } +void ControllerCommandDispatch::updateAndFireStatus() +{ + updateCommandAvailability(); + fireStatusEvent(OUString(), nullptr); +} + bool ControllerCommandDispatch::isShapeControllerCommandAvailable( const OUString& rCommand ) { ShapeController* pShapeController(nullptr); diff --git a/chart2/source/controller/main/ControllerCommandDispatch.hxx b/chart2/source/controller/main/ControllerCommandDispatch.hxx index 6a5e441e8e3c..a5cc5b9e39cb 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.hxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.hxx @@ -65,6 +65,7 @@ public: virtual void initialize() override; bool commandAvailable( const OUString & rCommand ); + void updateAndFireStatus(); protected: // ____ XDispatch ____