svx/sdi/svx.sdi                  |    4 ++--
 svx/source/tbxctrls/grafctrl.cxx |   17 +++++++++++++----
 2 files changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 52dbfa8a3ca4dfdfaf29a47b0f49c33372f1e5e1
Author:     Mohit Marathe <[email protected]>
AuthorDate: Wed Oct 22 18:11:25 2025 +0530
Commit:     Mohit Marathe <[email protected]>
CommitDate: Fri Oct 24 12:51:28 2025 +0200

    tdf#168691 fix "Image Mode" and other toolbar buttons not working
    
    commits
    
29bd8d14eb632e621bbafa1fbf65add12800dc77^..eaa6757c5cb7865435367f0b80f13a8170f125a8
    added support for executing uno commands like .uno:GrafMode without
    needing any UI interaction (earlier it relied on the UI to extract the
    values), but it broke the existing toolbar buttons as the values from
    the UI were not properly passed via the params.
    
    This commit fixes that by passing the values extracted from UI
    to the required params.
    
    Signed-off-by: Mohit Marathe <[email protected]>
    Change-Id: I9a572e3fab2ff37efb8b0e4fce8758c08e3ff8d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192850
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 02ff629c0746fe704c6892a837bbc662936e7e41)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192886
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index 1e15e8af585a..aa9d5fd0873c 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -3903,7 +3903,7 @@ SfxInt16Item GrafLuminance SID_ATTR_GRAF_LUMINANCE
 
 
 SfxUInt16Item GrafMode SID_ATTR_GRAF_MODE
-(SfxInt16Item ColorMode FN_PARAM_1)
+(SfxUInt16Item ColorMode FN_PARAM_1)
 [
     AutoUpdate = TRUE,
     FastCall = FALSE,
@@ -3941,7 +3941,7 @@ SfxInt16Item GrafRed SID_ATTR_GRAF_RED
 
 
 SfxUInt16Item GrafTransparence SID_ATTR_GRAF_TRANSPARENCE
-(SfxInt16Item Transparency FN_PARAM_1)
+(SfxUInt16Item Transparency FN_PARAM_1)
 [
     AutoUpdate = TRUE,
     FastCall = FALSE,
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index 87046c0f5191..5e92bac35ab9 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -121,7 +121,16 @@ void ImplGrafControl::ImplModify()
 
     INetURLObject aObj( maCommand );
 
-    Sequence< PropertyValue > aArgs{ 
comphelper::makePropertyValue(aObj.GetURLPath(), a) };
+    // Map command to SDI FN_PARAM_1 names where applicable; else use URL path
+    OUString aParamName = aObj.GetURLPath();
+    if ( maCommand == ".uno:GrafLuminance" )
+        aParamName = u"Brightness"_ustr;
+    else if ( maCommand == ".uno:GrafContrast" )
+        aParamName = u"Contrast"_ustr;
+    else if ( maCommand == ".uno:GrafTransparence" )
+        aParamName = u"Transparency"_ustr;
+
+    Sequence< PropertyValue > aArgs{ comphelper::makePropertyValue(aParamName, 
a) };
 
     SfxToolBoxControl::Dispatch(
         Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
@@ -317,7 +326,7 @@ ImplGrafModeControl::~ImplGrafModeControl()
 
 IMPL_LINK(ImplGrafModeControl, SelectHdl, weld::ComboBox&, rBox, void)
 {
-    Sequence< PropertyValue > aArgs{ 
comphelper::makePropertyValue(u"GrafMode"_ustr,
+    Sequence< PropertyValue > aArgs{ 
comphelper::makePropertyValue(u"ColorMode"_ustr,
                                                                    
sal_Int16(rBox.get_active())) };
 
     /*  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() 
call.
@@ -586,7 +595,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, 
SdrView& rView )
 
         case SID_ATTR_GRAF_TRANSPARENCE:
         {
-            const SfxInt16Item* pTransparency = 
rReq.GetArg<SfxInt16Item>(FN_PARAM_1);
+            const SfxUInt16Item* pTransparency = 
rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
             if ( pTransparency )
                 aSet.Put( SdrGrafTransparenceItem( pTransparency->GetValue() 
));
             else if( pItem )
@@ -598,7 +607,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, 
SdrView& rView )
 
         case SID_ATTR_GRAF_MODE:
         {
-            const SfxInt16Item* pMode = rReq.GetArg<SfxInt16Item>(FN_PARAM_1);
+            const SfxUInt16Item* pMode = 
rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
             if ( pMode )
                 aSet.Put( SdrGrafModeItem( static_cast<GraphicDrawMode>( 
pMode->GetValue() ) ) );
             else if( pItem )

Reply via email to