chart2/source/controller/inc/CommandDispatchContainer.hxx | 2 chart2/source/controller/inc/ControllerCommandDispatch.hxx | 1 chart2/source/controller/main/ChartController.cxx | 157 ++++++++ chart2/source/controller/main/ChartController_Window.cxx | 20 + chart2/source/controller/main/ControllerCommandDispatch.cxx | 224 +++++++----- 5 files changed, 310 insertions(+), 94 deletions(-)
New commits: commit 4740ad873c5cbcfe766bea41af5685ed82d963dc Author: Attila Szűcs <[email protected]> AuthorDate: Wed May 7 03:38:03 2025 +0200 Commit: Marco Cecchetti <[email protected]> CommitDate: Wed Feb 4 11:39:14 2026 +0100 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 <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> Tested-by: Caolán McNamara <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198494 Reviewed-by: Marco Cecchetti <[email protected]> diff --git a/chart2/source/controller/inc/CommandDispatchContainer.hxx b/chart2/source/controller/inc/CommandDispatchContainer.hxx index e9f8ed072073..0c3f2b75c566 100644 --- a/chart2/source/controller/inc/CommandDispatchContainer.hxx +++ b/chart2/source/controller/inc/CommandDispatchContainer.hxx @@ -104,7 +104,7 @@ public: const css::uno::Reference< css::frame::XController > & xChartController, const css::util::URL & rURL ); - const ControllerCommandDispatch* getChartDispatcher() const { return m_xChartDispatcher.get(); } + ControllerCommandDispatch* getChartDispatcher() const { return m_xChartDispatcher.get(); } void setDrawCommandDispatch( DrawCommandDispatch* pDispatch ); DrawCommandDispatch* getDrawCommandDispatch() { return m_pDrawCommandDispatch; } diff --git a/chart2/source/controller/inc/ControllerCommandDispatch.hxx b/chart2/source/controller/inc/ControllerCommandDispatch.hxx index 3ce2c4139f48..ca409e13e486 100644 --- a/chart2/source/controller/inc/ControllerCommandDispatch.hxx +++ b/chart2/source/controller/inc/ControllerCommandDispatch.hxx @@ -66,6 +66,7 @@ public: bool commandAvailable(const OUString& rCommand) const; bool commandHandled(const OUString& rCommand) const; + void updateAndFireStatus(); protected: // ____ XDispatch ____ diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index f845f0d56494..2f69ec1f7764 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -80,6 +80,24 @@ #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 #define TEST_ENABLE_MODIFY_LISTENER @@ -1287,13 +1305,143 @@ 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 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 + = m_aDispatchContainer.getChartDispatcher(); + if (pCommandDispatch) + { + pCommandDispatch->updateAndFireStatus(); + } } - // if the Title is not in edit mode - if (!pOutlinerView) + else { + // if the Title is not in edit mode const Sequence<Reference<chart2::XFormattedString>> aStrings( xTitle->getText()); xProperties.pop_back(); @@ -1303,9 +1451,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); @@ -1316,6 +1461,7 @@ void SAL_CALL ChartController::dispatch( } if (bAllPropertiesExist) { + UndoGuard aUndoGuard(EditResId(RID_OUTLUNDO_ATTR), m_xUndoManager); if (aCommand == "Bold") { executeDispatch_FontBold(xProperties); @@ -1372,6 +1518,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 23436a40c2f2..ba982b3de35f 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -548,6 +548,12 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) ( rMEvt.IsRight() && pDrawViewWrapper->PickAnything( rMEvt, SdrMouseEventKind::BUTTONDOWN, aVEvt ) == SdrHitKind::MarkedObject ) ) { pDrawViewWrapper->MouseButtonDown(rMEvt, pChartWindow->GetOutDev()); + ControllerCommandDispatch* pCommandDispatch + = m_aDispatchContainer.getChartDispatcher(); + if (pCommandDispatch) + { + pCommandDispatch->updateAndFireStatus(); + } return; } else @@ -720,7 +726,15 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) if(pDrawViewWrapper->IsTextEdit()) { if( pDrawViewWrapper->MouseButtonUp(rMEvt,pChartWindow->GetOutDev()) ) + { + ControllerCommandDispatch* pCommandDispatch + = m_aDispatchContainer.getChartDispatcher(); + if (pCommandDispatch) + { + pCommandDispatch->updateAndFireStatus(); + } return; + } } // #i12587# support for shapes in chart @@ -1302,6 +1316,12 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) { EndTextEdit(); } + ControllerCommandDispatch* pCommandDispatch + = m_aDispatchContainer.getChartDispatcher(); + if (pCommandDispatch) + { + pCommandDispatch->updateAndFireStatus(); + } } } diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index a7f06f99eb9b..af015e46bfbd 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -48,6 +48,17 @@ #include <com/sun/star/chart2/XDataProviderAccess.hpp> #include <com/sun/star/frame/status/FontHeight.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; @@ -657,19 +668,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; @@ -686,23 +685,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 @@ -712,7 +708,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? @@ -728,81 +724,127 @@ void ControllerCommandDispatch::updateCommandAvailability() { const Sequence<Reference<chart2::XFormattedString>> aStrings(xTitle->getText()); xProperties.pop_back(); - for (const auto& aString : aStrings) + + 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(aString, uno::UNO_QUERY); - xProperties.push_back(xTitlePropSet); + for (const auto& aString : aStrings) + { + Reference<beans::XPropertySet> xTitlePropSet(aString, + 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) { - if (getPropertyIfSame(xProperties, u"CharFontName"_ustr).hasValue()) + awt::FontDescriptor aFont + = CharacterProperties::createFontDescriptorFromPropertySet(aMObjProps); + + if (!aFont.Name.isEmpty()) { - m_aCommandArguments[u".uno:CharFontName"_ustr] <<= aFont; + if (getPropertyIfSame(xProperties, u"CharFontName"_ustr).hasValue()) + { + m_aCommandArguments[u".uno:CharFontName"_ustr] <<= aFont; + } } } - } - if (frame::status::FontHeight aFontHeight; - getPropertyIfSame(xProperties, u"CharHeight"_ustr) >>= aFontHeight.Height) - { - // another type is needed here, so - m_aCommandArguments[u".uno:FontHeight"_ustr] <<= aFontHeight; - } + if (frame::status::FontHeight aFontHeight; + getPropertyIfSame(xProperties, u"CharHeight"_ustr) >>= aFontHeight.Height) + { + // another type is needed here, so + m_aCommandArguments[u".uno:FontHeight"_ustr] <<= aFontHeight; + } - if (float nFontWeight; - getPropertyIfSame(xProperties, u"CharWeight"_ustr) >>= nFontWeight) - { - bool bFontWeight = (nFontWeight > 100.0); - m_aCommandArguments[u".uno:Bold"_ustr] <<= bFontWeight; - } + if (float nFontWeight; + getPropertyIfSame(xProperties, u"CharWeight"_ustr) >>= nFontWeight) + { + bool bFontWeight = (nFontWeight > 100.0); + m_aCommandArguments[u".uno:Bold"_ustr] <<= bFontWeight; + } - if (awt::FontSlant nFontItalic; - getPropertyIfSame(xProperties, u"CharPosture"_ustr) >>= nFontItalic) - { - bool bItalic = (nFontItalic == awt::FontSlant_ITALIC); - m_aCommandArguments[u".uno:Italic"_ustr] <<= bItalic; - } + if (awt::FontSlant nFontItalic; + getPropertyIfSame(xProperties, u"CharPosture"_ustr) >>= nFontItalic) + { + bool bItalic = (nFontItalic == awt::FontSlant_ITALIC); + m_aCommandArguments[u".uno:Italic"_ustr] <<= bItalic; + } - if (sal_Int16 nFontStrikeout; - getPropertyIfSame(xProperties, u"CharStrikeout"_ustr) >>= nFontStrikeout) - { - bool bFontStrikeout = (nFontStrikeout > 0); - m_aCommandArguments[u".uno:Strikeout"_ustr] <<= bFontStrikeout; - } + if (sal_Int16 nFontStrikeout; + getPropertyIfSame(xProperties, u"CharStrikeout"_ustr) >>= nFontStrikeout) + { + bool bFontStrikeout = (nFontStrikeout > 0); + m_aCommandArguments[u".uno:Strikeout"_ustr] <<= bFontStrikeout; + } - if (sal_Int16 nFontUnderline; - getPropertyIfSame(xProperties, u"CharUnderline"_ustr) >>= nFontUnderline) - { - bool bFontUnderline = (nFontUnderline > 0); - m_aCommandArguments[u".uno:Underline"_ustr] <<= bFontUnderline; - } + if (sal_Int16 nFontUnderline; + getPropertyIfSame(xProperties, u"CharUnderline"_ustr) >>= nFontUnderline) + { + bool bFontUnderline = (nFontUnderline > 0); + m_aCommandArguments[u".uno:Underline"_ustr] <<= bFontUnderline; + } - if (bool bShadowed; getPropertyIfSame(xProperties, u"CharShadowed"_ustr) >>= bShadowed) - { - m_aCommandArguments[u".uno:Shadowed"_ustr] <<= bShadowed; - } + if (bool bShadowed; getPropertyIfSame(xProperties, u"CharShadowed"_ustr) >>= bShadowed) + { + m_aCommandArguments[u".uno:Shadowed"_ustr] <<= bShadowed; + } - // Font color is not set in panel... it is just enabled 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 enabled to use + m_aCommandArguments[u".uno:Color"_ustr] <<= false; + m_aCommandArguments[u".uno:FontColor"_ustr] <<= false; - if (sal_Int32 nCharEscapement; - getPropertyIfSame(xProperties, u"CharEscapement"_ustr) >>= nCharEscapement) - { - m_aCommandArguments[u".uno:SuperScript"_ustr] <<= (nCharEscapement > 0); - m_aCommandArguments[u".uno:SubScript"_ustr] <<= (nCharEscapement < 0); - } + if (sal_Int32 nCharEscapement; + getPropertyIfSame(xProperties, u"CharEscapement"_ustr) >>= 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 enabled to use - m_aCommandArguments[u".uno:Spacing"_ustr] <<= false; + // Font Spacing is not set in panel... it is just enabled to use + m_aCommandArguments[u".uno:Spacing"_ustr] <<= false; + } } } catch (const uno::Exception&) @@ -888,6 +930,12 @@ bool ControllerCommandDispatch::commandHandled(const OUString& rCommand) const return m_aCommandAvailability.contains(rCommand); } +void ControllerCommandDispatch::updateAndFireStatus() +{ + updateCommandAvailability(); + fireStatusEvent(OUString(), nullptr); +} + bool ControllerCommandDispatch::isShapeControllerCommandAvailable( const OUString& rCommand ) { ShapeController* pShapeController(nullptr);
