[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sw/source

Jan Holesovsky kendy at collabora.com
Thu Jan 18 12:54:51 UTC 2018


 sw/source/uibase/app/docst.cxx |   35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

New commits:
commit c58145ff3a814df6702f805eb75bbc31be888c51
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 17 11:11:34 2018 +0100

    sw: Actually only .uno:StyleApply and .uno:StyleWatercanMode can return...
    
    ...a value, at least according to sfx2/sdi/sfx.sdi.
    
    Change-Id: I1a12c025386cfc6eae529782cdb69207ffa388c5
    Reviewed-on: https://gerrit.libreoffice.org/48041
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/48114
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 7a749c1a5030..68e49790f662 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -292,7 +292,6 @@ void  SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh)
 void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
 {
     sal_uInt16  nSlot   = rReq.GetSlot();
-    sal_uInt16  nRet    = SFXSTYLEBIT_ALL;
 
     const SfxItemSet* pArgs = rReq.GetArgs();
     const SfxPoolItem* pItem;
@@ -320,7 +319,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
             if (sName.isEmpty() && m_xBasePool.get())
                 sName = SfxStyleDialog::GenerateUnusedName(*m_xBasePool);
 
-            nRet = Edit( sName, sParent, nFamily, nMask, true, OString(), nullptr, rReq.IsAPI() );
+            Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, rReq.IsAPI());
 
             // Update Watermark if new page style was created
             if( nFamily == SfxStyleFamily::Page )
@@ -495,47 +494,55 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
             }
             if (!aParam.isEmpty() || nSlot == SID_STYLE_WATERCAN )
             {
+                sal_uInt16 nRet = SFXSTYLEBIT_ALL;
+                bool bReturns = false;
+
                 switch(nSlot)
                 {
                     case SID_STYLE_EDIT:
-                        nRet = Edit(aParam, aEmptyOUStr, nFamily, nMask, false, OString(), pActShell );
+                        Edit(aParam, aEmptyOUStr, nFamily, nMask, false, OString(), pActShell);
                         break;
                     case SID_STYLE_DELETE:
-                        nRet = sal_uInt16(Delete(aParam, nFamily));
+                        Delete(aParam, nFamily);
                         break;
                     case SID_STYLE_HIDE:
                     case SID_STYLE_SHOW:
-                        nRet = sal_uInt16(Hide(aParam, nFamily, nSlot == SID_STYLE_HIDE));
+                        Hide(aParam, nFamily, nSlot == SID_STYLE_HIDE);
                         break;
                     case SID_STYLE_APPLY:
                         // Shell-switch in ApplyStyles
-                        nRet = (sal_uInt16) ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() );
+                        nRet = static_cast<sal_uInt16>(ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() ));
+                        bReturns = true;
                         break;
                     case SID_STYLE_WATERCAN:
-                        nRet = (sal_uInt16) DoWaterCan(aParam, nFamily);
+                        nRet = static_cast<sal_uInt16>(DoWaterCan(aParam, nFamily));
+                        bReturns = true;
                         break;
                     case SID_STYLE_UPDATE_BY_EXAMPLE:
-                        nRet = (sal_uInt16) UpdateStyle(aParam, nFamily, pActShell);
+                        UpdateStyle(aParam, nFamily, pActShell);
                         break;
                     case SID_STYLE_NEW_BY_EXAMPLE:
-                        nRet = (sal_uInt16) MakeByExample(aParam, nFamily, nMask, pActShell );
+                        MakeByExample(aParam, nFamily, nMask, pActShell);
                         break;
 
                     default:
                         OSL_FAIL("Invalid SlotId");
                 }
 
+                if (bReturns)
+                {
+                    if(rReq.IsAPI()) // Basic only gets TRUE or FALSE
+                        rReq.SetReturnValue(SfxUInt16Item(nSlot, sal_uInt16(nRet !=0)));
+                    else
+                        rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet));
+                }
+
                 rReq.Done();
             }
 
             break;
         }
     }
-
-        if(rReq.IsAPI()) // Basic only gets TRUE or FALSE
-            rReq.SetReturnValue(SfxUInt16Item(nSlot, sal_uInt16(nRet !=0)));
-        else
-            rReq.SetReturnValue(SfxUInt16Item(nSlot, nRet));
 }
 
 class ApplyStyle


More information about the Libreoffice-commits mailing list