[Libreoffice-commits] core.git: sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 30 11:44:10 UTC 2020


 sw/source/uibase/shells/annotsh.cxx    |   20 
 sw/source/uibase/shells/basesh.cxx     |  447 +++++++-------
 sw/source/uibase/shells/drawsh.cxx     |   96 +--
 sw/source/uibase/shells/drwtxtex.cxx   |   40 -
 sw/source/uibase/shells/drwtxtsh.cxx   |  214 +++----
 sw/source/uibase/shells/frmsh.cxx      |  524 ++++++++---------
 sw/source/uibase/shells/grfsh.cxx      |   34 -
 sw/source/uibase/shells/langhelper.cxx |  130 ++--
 sw/source/uibase/shells/listsh.cxx     |  104 +--
 sw/source/uibase/shells/mediash.cxx    |   80 +-
 sw/source/uibase/shells/tabsh.cxx      |   40 -
 sw/source/uibase/shells/textfld.cxx    |  988 ++++++++++++++++-----------------
 sw/source/uibase/shells/textsh.cxx     |  166 ++---
 13 files changed, 1443 insertions(+), 1440 deletions(-)

New commits:
commit 19525a7f83203d734d0f234626e1ba0726ef14ff
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 30 10:41:05 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 30 13:43:27 2020 +0200

    loplugin:flatten in sw/uibase/shells
    
    Change-Id: I003c2c4e48bb59590ba952c74e3ee4733ce1051f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99764
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index 0c81d1d00009..f43534d66eb3 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1457,19 +1457,19 @@ void SwAnnotationShell::ExecTransliteration(SfxRequest const &rReq)
 
 void SwAnnotationShell::ExecRotateTransliteration( SfxRequest const & rReq )
 {
-    if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
-    {
-        SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
-        if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
-            return;
+    if( rReq.GetSlot() != SID_TRANSLITERATE_ROTATE_CASE )
+        return;
+
+    SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
+    if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
+        return;
 
-        OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
+    OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
 
-        if (!pOLV)
-            return;
+    if (!pOLV)
+        return;
 
-        pOLV->TransliterateText(m_aRotateCase.getNextMode());
-    }
+    pOLV->TransliterateText(m_aRotateCase.getNextMode());
 }
 
 void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 7b91c5c8aee8..59faca317408 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1261,69 +1261,71 @@ void SwBaseShell::Execute(SfxRequest &rReq)
 
     pItem = nullptr;
     pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
-    if(pItem)
-        switch(nSlot)
+    if(!pItem)
+        return;
+
+    switch(nSlot)
+    {
+    case SID_ATTR_BRUSH:
+    case SID_ATTR_BORDER_SHADOW:
+    case RES_SHADOW:
+    {
+        rSh.StartAllAction();
+        // Tabele cell(s) selected?
+        if ( rSh.IsTableMode() )
         {
-        case SID_ATTR_BRUSH:
-        case SID_ATTR_BORDER_SHADOW:
-        case RES_SHADOW:
+            SwFrameFormat *pFormat = rSh.GetTableFormat();
+            pFormat->SetFormatAttr( *pItem );
+        }
+        else if ( rSh.IsFrameSelected() )
         {
-            rSh.StartAllAction();
-            // Tabele cell(s) selected?
-            if ( rSh.IsTableMode() )
-            {
-                SwFrameFormat *pFormat = rSh.GetTableFormat();
-                pFormat->SetFormatAttr( *pItem );
-            }
-            else if ( rSh.IsFrameSelected() )
-            {
-                // Set border attributes via Frame-Manager.
-                SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
-                aMgr.SetAttrSet( *pArgs );
-                aMgr.UpdateFlyFrame();
-            }
-            else
-            {
-                rSh.SetAttrSet( *pArgs );
-            }
-            rSh.EndAllAction();
+            // Set border attributes via Frame-Manager.
+            SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
+            aMgr.SetAttrSet( *pArgs );
+            aMgr.UpdateFlyFrame();
         }
-        break;
-        case FN_PAGE_STYLE_SET_LR_MARGIN:
-        case FN_PAGE_STYLE_SET_UL_MARGIN:
-        case FN_PAGE_STYLE_SET_NUMBER_FORMAT:
-        case FN_PAGE_STYLE_SET_PAPER_SIZE:
-        case FN_PAGE_STYLE_SET_PAPER_BIN:
+        else
         {
-            OSL_FAIL("not implemented");
+            rSh.SetAttrSet( *pArgs );
         }
-        break;
+        rSh.EndAllAction();
+    }
+    break;
+    case FN_PAGE_STYLE_SET_LR_MARGIN:
+    case FN_PAGE_STYLE_SET_UL_MARGIN:
+    case FN_PAGE_STYLE_SET_NUMBER_FORMAT:
+    case FN_PAGE_STYLE_SET_PAPER_SIZE:
+    case FN_PAGE_STYLE_SET_PAPER_BIN:
+    {
+        OSL_FAIL("not implemented");
+    }
+    break;
 
-        case SID_ATTR_BORDER_OUTER:
+    case SID_ATTR_BORDER_OUTER:
+    {
+        // Tabele cell(s) selected?
+        if ( rSh.IsTableMode() )
         {
-            // Tabele cell(s) selected?
-            if ( rSh.IsTableMode() )
-            {
-                // Set border attributes Get/SetTabBorders()
-                rSh.SetTabBorders(*pArgs);
-            }
-            else if ( rSh.IsFrameSelected() )
-            {
-                // Set border attributes via Frame-Manager.
-                SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
-                aMgr.SetAttrSet(*pArgs);
-                aMgr.UpdateFlyFrame();
-            }
-            else
-            {
-                // Set border attributes via shell quite normally.
-                rSh.SetAttrItem( *pItem );
-            }
+            // Set border attributes Get/SetTabBorders()
+            rSh.SetTabBorders(*pArgs);
         }
-        break;
-        default:
-                OSL_FAIL("wrong Dispatcher");
+        else if ( rSh.IsFrameSelected() )
+        {
+            // Set border attributes via Frame-Manager.
+            SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
+            aMgr.SetAttrSet(*pArgs);
+            aMgr.UpdateFlyFrame();
         }
+        else
+        {
+            // Set border attributes via shell quite normally.
+            rSh.SetAttrItem( *pItem );
+        }
+    }
+    break;
+    default:
+            OSL_FAIL("wrong Dispatcher");
+    }
 }
 
 // Here the state for SID_IMAP / SID_CONTOUR will be handled
@@ -1335,94 +1337,93 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl, SwCursorShell&, void)
     if (CNT_GRF != rSh.SwEditShell::GetCntType())
         return;
     GraphicType const nGrfType(rSh.GetGraphicType());
-    if (GraphicType::NONE != nGrfType &&
-        !aGrfUpdateSlots.empty() )
+    if (GraphicType::NONE == nGrfType || aGrfUpdateSlots.empty())
+        return;
+
+    bool bProtect = FlyProtectFlags::NONE != rSh.IsSelObjProtected(FlyProtectFlags::Content|FlyProtectFlags::Parent);
+    SfxViewFrame* pVFrame = GetView().GetViewFrame();
+    for( const auto nSlot : aGrfUpdateSlots )
     {
-        bool bProtect = FlyProtectFlags::NONE != rSh.IsSelObjProtected(FlyProtectFlags::Content|FlyProtectFlags::Parent);
-        SfxViewFrame* pVFrame = GetView().GetViewFrame();
-        for( const auto nSlot : aGrfUpdateSlots )
+        bool bSetState = false;
+        bool bState = false;
+        switch( nSlot )
         {
-            bool bSetState = false;
-            bool bState = false;
-            switch( nSlot )
+        case SID_IMAP:
+        case SID_IMAP_EXEC:
             {
-            case SID_IMAP:
-            case SID_IMAP_EXEC:
-                {
-                    sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
-                    SfxChildWindow *pChildWindow = pVFrame->HasChildWindow(nId) ?
-                        pVFrame->GetChildWindow(nId) : nullptr;
-                    SvxIMapDlg *pDlg = pChildWindow ?
-                        static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr;
+                sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
+                SfxChildWindow *pChildWindow = pVFrame->HasChildWindow(nId) ?
+                    pVFrame->GetChildWindow(nId) : nullptr;
+                SvxIMapDlg *pDlg = pChildWindow ?
+                    static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr;
 
-                    if( pDlg && ( SID_IMAP_EXEC == nSlot ||
-                                ( SID_IMAP == nSlot && !bProtect)) &&
-                        pDlg->GetEditingObject() != rSh.GetIMapInventor())
-                            lcl_UpdateIMapDlg( rSh );
+                if( pDlg && ( SID_IMAP_EXEC == nSlot ||
+                            ( SID_IMAP == nSlot && !bProtect)) &&
+                    pDlg->GetEditingObject() != rSh.GetIMapInventor())
+                        lcl_UpdateIMapDlg( rSh );
 
-                    if( !bProtect && SID_IMAP == nSlot )
-                    {
-                        bSetState = true;
-                        bState = nullptr != pDlg;
-                    }
-                }
-                break;
-
-            case SID_CONTOUR_DLG:
-                if( !bProtect )
+                if( !bProtect && SID_IMAP == nSlot )
                 {
-                    sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
-                    SfxChildWindow *pChildWindow = pVFrame->HasChildWindow(nId) ?
-                        pVFrame->GetChildWindow(nId) : nullptr;
-                    SvxIMapDlg *pDlg = pChildWindow ?
-                        static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr;
-                    if( pDlg && pDlg->GetEditingObject() !=
-                                rSh.GetIMapInventor() )
-                        lcl_UpdateContourDlg( rSh, SelectionType::Graphic );
-
                     bSetState = true;
                     bState = nullptr != pDlg;
                 }
-                break;
+            }
+            break;
 
-            case FN_FRAME_WRAP_CONTOUR:
-                if( !bProtect )
-                {
-                    SfxItemSet aSet(GetPool(), svl::Items<RES_SURROUND, RES_SURROUND>{});
-                    rSh.GetFlyFrameAttr(aSet);
-                    const SwFormatSurround& rWrap = aSet.Get(RES_SURROUND);
-                    bSetState = true;
-                    bState = rWrap.IsContour();
-                }
-                break;
+        case SID_CONTOUR_DLG:
+            if( !bProtect )
+            {
+                sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
+                SfxChildWindow *pChildWindow = pVFrame->HasChildWindow(nId) ?
+                    pVFrame->GetChildWindow(nId) : nullptr;
+                SvxIMapDlg *pDlg = pChildWindow ?
+                    static_cast<SvxIMapDlg*>(pChildWindow->GetController().get()) : nullptr;
+                if( pDlg && pDlg->GetEditingObject() !=
+                            rSh.GetIMapInventor() )
+                    lcl_UpdateContourDlg( rSh, SelectionType::Graphic );
 
-            case SID_GRFFILTER:
-            case SID_GRFFILTER_INVERT:
-            case SID_GRFFILTER_SMOOTH:
-            case SID_GRFFILTER_SHARPEN:
-            case SID_GRFFILTER_REMOVENOISE:
-            case SID_GRFFILTER_SOBEL:
-            case SID_GRFFILTER_MOSAIC:
-            case SID_GRFFILTER_EMBOSS:
-            case SID_GRFFILTER_POSTER:
-            case SID_GRFFILTER_POPART:
-            case SID_GRFFILTER_SEPIA:
-            case SID_GRFFILTER_SOLARIZE:
-                bSetState = bState = GraphicType::Bitmap == nGrfType;
-                break;
+                bSetState = true;
+                bState = nullptr != pDlg;
             }
+            break;
 
-            if( bSetState )
+        case FN_FRAME_WRAP_CONTOUR:
+            if( !bProtect )
             {
-                SfxBoolItem aBool( nSlot, bState );
-                if( pGetStateSet )
-                    pGetStateSet->Put( aBool );
-                else
-                    pVFrame->GetBindings().SetState( aBool );
+                SfxItemSet aSet(GetPool(), svl::Items<RES_SURROUND, RES_SURROUND>{});
+                rSh.GetFlyFrameAttr(aSet);
+                const SwFormatSurround& rWrap = aSet.Get(RES_SURROUND);
+                bSetState = true;
+                bState = rWrap.IsContour();
             }
+            break;
+
+        case SID_GRFFILTER:
+        case SID_GRFFILTER_INVERT:
+        case SID_GRFFILTER_SMOOTH:
+        case SID_GRFFILTER_SHARPEN:
+        case SID_GRFFILTER_REMOVENOISE:
+        case SID_GRFFILTER_SOBEL:
+        case SID_GRFFILTER_MOSAIC:
+        case SID_GRFFILTER_EMBOSS:
+        case SID_GRFFILTER_POSTER:
+        case SID_GRFFILTER_POPART:
+        case SID_GRFFILTER_SEPIA:
+        case SID_GRFFILTER_SOLARIZE:
+            bSetState = bState = GraphicType::Bitmap == nGrfType;
+            break;
+        }
+
+        if( bSetState )
+        {
+            SfxBoolItem aBool( nSlot, bState );
+            if( pGetStateSet )
+                pGetStateSet->Put( aBool );
+            else
+                pVFrame->GetBindings().SetState( aBool );
         }
-        aGrfUpdateSlots.clear();
     }
+    aGrfUpdateSlots.clear();
 }
 
 void SwBaseShell::GetState( SfxItemSet &rSet )
@@ -2743,125 +2744,125 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
     const SfxItemSet* pArgs = _rRequest.GetArgs();
     SwWrtShell& rSh = GetShell();
 
-    if ( !( rSh.GetFrameType( nullptr, true ) & FrameTypeFlags::FOOTNOTE ) )
-    {
-        SwView &rTempView = GetView(); // Because GetView() does not work after the shell exchange
-        bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON);
-        bool bCallEndUndo = false;
+    if ( rSh.GetFrameType( nullptr, true ) & FrameTypeFlags::FOOTNOTE )
+        return;
 
-        if( !pArgs && rSh.IsSelection() && !rSh.IsInClickToEdit() &&
-            !rSh.IsTableMode() )
-        {
-            const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
-            SwInsertTableOptions aInsTableOpts = pModOpt->GetInsTableFlags(bHTMLMode);
+    SwView &rTempView = GetView(); // Because GetView() does not work after the shell exchange
+    bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON);
+    bool bCallEndUndo = false;
 
-            rSh.StartUndo(SwUndoId::INSTABLE);
-            bCallEndUndo = true;
+    if( !pArgs && rSh.IsSelection() && !rSh.IsInClickToEdit() &&
+        !rSh.IsTableMode() )
+    {
+        const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+        SwInsertTableOptions aInsTableOpts = pModOpt->GetInsTableFlags(bHTMLMode);
 
-            bool bInserted = rSh.TextToTable( aInsTableOpts, '\t' );
-            rSh.EnterStdMode();
-            if (bInserted)
-                rTempView.AutoCaption(TABLE_CAP);
-            _rRequest.Done();
-        }
-        else
+        rSh.StartUndo(SwUndoId::INSTABLE);
+        bCallEndUndo = true;
+
+        bool bInserted = rSh.TextToTable( aInsTableOpts, '\t' );
+        rSh.EnterStdMode();
+        if (bInserted)
+            rTempView.AutoCaption(TABLE_CAP);
+        _rRequest.Done();
+    }
+    else
+    {
+        sal_uInt16 nColsIn = 0;
+        sal_uInt16 nRowsIn = 0;
+        SwInsertTableOptions aInsTableOptsIn( SwInsertTableFlags::All, 1 );
+        OUString aTableNameIn;
+        OUString aAutoNameIn;
+        std::unique_ptr<SwTableAutoFormat> pTAFormatIn;
+
+        if( pArgs && pArgs->Count() >= 2 )
         {
-            sal_uInt16 nColsIn = 0;
-            sal_uInt16 nRowsIn = 0;
-            SwInsertTableOptions aInsTableOptsIn( SwInsertTableFlags::All, 1 );
-            OUString aTableNameIn;
-            OUString aAutoNameIn;
-            std::unique_ptr<SwTableAutoFormat> pTAFormatIn;
-
-            if( pArgs && pArgs->Count() >= 2 )
-            {
-                const SfxStringItem* pName = _rRequest.GetArg<SfxStringItem>(FN_INSERT_TABLE);
-                const SfxUInt16Item* pCols = _rRequest.GetArg<SfxUInt16Item>(SID_ATTR_TABLE_COLUMN);
-                const SfxUInt16Item* pRows = _rRequest.GetArg<SfxUInt16Item>(SID_ATTR_TABLE_ROW);
-                const SfxInt32Item* pFlags = _rRequest.GetArg<SfxInt32Item>(FN_PARAM_1);
-                const SfxStringItem* pAuto = _rRequest.GetArg<SfxStringItem>(FN_PARAM_2);
-
-                if ( pName )
-                    aTableNameIn = pName->GetValue();
-                if ( pCols )
-                    nColsIn = pCols->GetValue();
-                if ( pRows )
-                    nRowsIn = pRows->GetValue();
-                if ( pAuto )
-                {
-                    aAutoNameIn = pAuto->GetValue();
-                    if ( !aAutoNameIn.isEmpty() )
+            const SfxStringItem* pName = _rRequest.GetArg<SfxStringItem>(FN_INSERT_TABLE);
+            const SfxUInt16Item* pCols = _rRequest.GetArg<SfxUInt16Item>(SID_ATTR_TABLE_COLUMN);
+            const SfxUInt16Item* pRows = _rRequest.GetArg<SfxUInt16Item>(SID_ATTR_TABLE_ROW);
+            const SfxInt32Item* pFlags = _rRequest.GetArg<SfxInt32Item>(FN_PARAM_1);
+            const SfxStringItem* pAuto = _rRequest.GetArg<SfxStringItem>(FN_PARAM_2);
+
+            if ( pName )
+                aTableNameIn = pName->GetValue();
+            if ( pCols )
+                nColsIn = pCols->GetValue();
+            if ( pRows )
+                nRowsIn = pRows->GetValue();
+            if ( pAuto )
+            {
+                aAutoNameIn = pAuto->GetValue();
+                if ( !aAutoNameIn.isEmpty() )
+                {
+                    SwTableAutoFormatTable aTableTable;
+                    aTableTable.Load();
+                    for ( size_t n=0; n<aTableTable.size(); n++ )
                     {
-                        SwTableAutoFormatTable aTableTable;
-                        aTableTable.Load();
-                        for ( size_t n=0; n<aTableTable.size(); n++ )
+                        if ( aTableTable[n].GetName() == aAutoNameIn )
                         {
-                            if ( aTableTable[n].GetName() == aAutoNameIn )
-                            {
-                                pTAFormatIn.reset(new SwTableAutoFormat( aTableTable[n] ));
-                                break;
-                            }
+                            pTAFormatIn.reset(new SwTableAutoFormat( aTableTable[n] ));
+                            break;
                         }
                     }
                 }
-
-                if ( pFlags )
-                    aInsTableOptsIn.mnInsMode = static_cast<SwInsertTableFlags>(pFlags->GetValue());
-                else
-                {
-                    const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
-                    aInsTableOptsIn = pModOpt->GetInsTableFlags(bHTMLMode);
-                }
             }
 
-            if( !nColsIn || !nRowsIn )
+            if ( pFlags )
+                aInsTableOptsIn.mnInsMode = static_cast<SwInsertTableFlags>(pFlags->GetValue());
+            else
             {
-                SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-                std::shared_ptr<AbstractInsTableDlg> pAbstractDialog(pFact->CreateInsTableDlg(rTempView));
-                std::shared_ptr<weld::DialogController> pDialogController(pAbstractDialog->getDialogController());
+                const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
+                aInsTableOptsIn = pModOpt->GetInsTableFlags(bHTMLMode);
+            }
+        }
 
-                weld::DialogController::runAsync(pDialogController,
-                    [pAbstractDialog, &rSh, &rTempView, aTableNameIn, nRowsIn, nColsIn, aInsTableOptsIn, aAutoNameIn] (sal_Int32 nResult) {
-                        if( RET_OK == nResult )
-                        {
-                            sal_uInt16 nCols = nColsIn;
-                            sal_uInt16 nRows = nRowsIn;
-                            SwInsertTableOptions aInsTableOpts = aInsTableOptsIn;
-                            OUString aTableName = aTableNameIn;
-                            OUString aAutoName = aAutoNameIn;
-                            std::unique_ptr<SwTableAutoFormat> pTAFormat;
+        if( !nColsIn || !nRowsIn )
+        {
+            SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+            std::shared_ptr<AbstractInsTableDlg> pAbstractDialog(pFact->CreateInsTableDlg(rTempView));
+            std::shared_ptr<weld::DialogController> pDialogController(pAbstractDialog->getDialogController());
 
-                            pAbstractDialog->GetValues( aTableName, nRows, nCols, aInsTableOpts, aAutoName, pTAFormat );
+            weld::DialogController::runAsync(pDialogController,
+                [pAbstractDialog, &rSh, &rTempView, aTableNameIn, nRowsIn, nColsIn, aInsTableOptsIn, aAutoNameIn] (sal_Int32 nResult) {
+                    if( RET_OK == nResult )
+                    {
+                        sal_uInt16 nCols = nColsIn;
+                        sal_uInt16 nRows = nRowsIn;
+                        SwInsertTableOptions aInsTableOpts = aInsTableOptsIn;
+                        OUString aTableName = aTableNameIn;
+                        OUString aAutoName = aAutoNameIn;
+                        std::unique_ptr<SwTableAutoFormat> pTAFormat;
 
-                            if( nCols && nRows )
-                            {
-                                InsertTableImpl( rSh, rTempView, aTableName, nRows, nCols, aInsTableOpts, aAutoName, pTAFormat );
-                                EndUndo(rSh);
-                            }
+                        pAbstractDialog->GetValues( aTableName, nRows, nCols, aInsTableOpts, aAutoName, pTAFormat );
+
+                        if( nCols && nRows )
+                        {
+                            InsertTableImpl( rSh, rTempView, aTableName, nRows, nCols, aInsTableOpts, aAutoName, pTAFormat );
+                            EndUndo(rSh);
                         }
                     }
-                );
-            }
-            else
-            {
-                // record before shell change
-                _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableNameIn ) );
-                if ( !aAutoNameIn.isEmpty() )
-                    _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoNameIn ) );
-                _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nColsIn ) );
-                _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRowsIn ) );
-                _rRequest.AppendItem( SfxInt32Item( FN_PARAM_1, static_cast<sal_Int32>(aInsTableOptsIn.mnInsMode) ) );
-                _rRequest.Done();
+                }
+            );
+        }
+        else
+        {
+            // record before shell change
+            _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableNameIn ) );
+            if ( !aAutoNameIn.isEmpty() )
+                _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoNameIn ) );
+            _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nColsIn ) );
+            _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRowsIn ) );
+            _rRequest.AppendItem( SfxInt32Item( FN_PARAM_1, static_cast<sal_Int32>(aInsTableOptsIn.mnInsMode) ) );
+            _rRequest.Done();
 
-                InsertTableImpl( rSh, rTempView, aTableNameIn, nRowsIn, nColsIn, aInsTableOptsIn, aAutoNameIn, pTAFormatIn );
+            InsertTableImpl( rSh, rTempView, aTableNameIn, nRowsIn, nColsIn, aInsTableOptsIn, aAutoNameIn, pTAFormatIn );
 
-                bCallEndUndo = true;
-            }
+            bCallEndUndo = true;
         }
-
-        if( bCallEndUndo )
-            EndUndo(rSh);
     }
+
+    if( bCallEndUndo )
+        EndUndo(rSh);
 }
 
 void SwBaseShell::GetGalleryState( SfxItemSet &rSet )
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 958a38b2a39a..fe8e6b470479 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -114,67 +114,67 @@ void SwDrawShell::InsertPictureFromFile(SdrObject& rObject)
     SwWrtShell &rSh = GetShell();
     SdrView* pSdrView = rSh.GetDrawView();
 
-    if(pSdrView)
-    {
-        SvxOpenGraphicDialog aDlg(SwResId(STR_INSERT_GRAPHIC), GetView().GetFrameWeld());
+    if(!pSdrView)
+        return;
 
-        if (ERRCODE_NONE == aDlg.Execute())
-        {
-            Graphic aGraphic;
-            ErrCode nError = aDlg.GetGraphic(aGraphic);
+    SvxOpenGraphicDialog aDlg(SwResId(STR_INSERT_GRAPHIC), GetView().GetFrameWeld());
 
-            if(ERRCODE_NONE == nError)
-            {
-                const bool bAsLink(aDlg.IsAsLink());
-                SdrObject* pResult = &rObject;
+    if (ERRCODE_NONE != aDlg.Execute())
+        return;
 
-                rSh.StartUndo(SwUndoId::PASTE_CLIPBOARD);
+    Graphic aGraphic;
+    ErrCode nError = aDlg.GetGraphic(aGraphic);
 
-                if (SdrGrafObj* pSdrGrafObj = dynamic_cast<SdrGrafObj*>(&rObject))
-                {
-                    SdrGrafObj* pNewGrafObj(pSdrGrafObj->CloneSdrObject(pSdrGrafObj->getSdrModelFromSdrObject()));
+    if(ERRCODE_NONE != nError)
+        return;
 
-                    pNewGrafObj->SetGraphic(aGraphic);
+    const bool bAsLink(aDlg.IsAsLink());
+    SdrObject* pResult = &rObject;
 
-                    // #i123922#  for handling MasterObject and virtual ones correctly, SW
-                    // wants us to call ReplaceObject at the page, but that also
-                    // triggers the same assertion (I tried it), so stay at the view method
-                    pSdrView->ReplaceObjectAtView(&rObject, *pSdrView->GetSdrPageView(), pNewGrafObj);
+    rSh.StartUndo(SwUndoId::PASTE_CLIPBOARD);
 
-                    OUString aReferer;
-                    SwDocShell *pDocShell = rSh.GetDoc()->GetDocShell();
-                    if (pDocShell->HasName()) {
-                        aReferer = pDocShell->GetMedium()->GetName();
-                    }
+    if (SdrGrafObj* pSdrGrafObj = dynamic_cast<SdrGrafObj*>(&rObject))
+    {
+        SdrGrafObj* pNewGrafObj(pSdrGrafObj->CloneSdrObject(pSdrGrafObj->getSdrModelFromSdrObject()));
 
-                    // set in all cases - the Clone() will have copied an existing link (!)
-                    pNewGrafObj->SetGraphicLink(
-                        bAsLink ? aDlg.GetPath() : OUString(),
-                        aReferer,
-                        bAsLink ? aDlg.GetDetectedFilter() : OUString());
+        pNewGrafObj->SetGraphic(aGraphic);
 
-                    pResult = pNewGrafObj;
-                }
-                else // if(rObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rObject))
-                {
-                    pSdrView->AddUndo(std::make_unique<SdrUndoAttrObj>(rObject));
+        // #i123922#  for handling MasterObject and virtual ones correctly, SW
+        // wants us to call ReplaceObject at the page, but that also
+        // triggers the same assertion (I tried it), so stay at the view method
+        pSdrView->ReplaceObjectAtView(&rObject, *pSdrView->GetSdrPageView(), pNewGrafObj);
 
-                    SfxItemSet aSet(pSdrView->GetModel()->GetItemPool(), svl::Items<XATTR_FILLSTYLE, XATTR_FILLBITMAP>{});
+        OUString aReferer;
+        SwDocShell *pDocShell = rSh.GetDoc()->GetDocShell();
+        if (pDocShell->HasName()) {
+            aReferer = pDocShell->GetMedium()->GetName();
+        }
 
-                    aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
-                    aSet.Put(XFillBitmapItem(OUString(), aGraphic));
-                    rObject.SetMergedItemSetAndBroadcast(aSet);
-                }
+        // set in all cases - the Clone() will have copied an existing link (!)
+        pNewGrafObj->SetGraphicLink(
+            bAsLink ? aDlg.GetPath() : OUString(),
+            aReferer,
+            bAsLink ? aDlg.GetDetectedFilter() : OUString());
 
-                rSh.EndUndo( SwUndoId::END );
+        pResult = pNewGrafObj;
+    }
+    else // if(rObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rObject))
+    {
+        pSdrView->AddUndo(std::make_unique<SdrUndoAttrObj>(rObject));
 
-                if(pResult)
-                {
-                    // we are done; mark the modified/new object
-                    pSdrView->MarkObj(pResult, pSdrView->GetSdrPageView());
-                }
-            }
-        }
+        SfxItemSet aSet(pSdrView->GetModel()->GetItemPool(), svl::Items<XATTR_FILLSTYLE, XATTR_FILLBITMAP>{});
+
+        aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
+        aSet.Put(XFillBitmapItem(OUString(), aGraphic));
+        rObject.SetMergedItemSetAndBroadcast(aSet);
+    }
+
+    rSh.EndUndo( SwUndoId::END );
+
+    if(pResult)
+    {
+        // we are done; mark the modified/new object
+        pSdrView->MarkObj(pResult, pSdrView->GetSdrPageView());
     }
 }
 
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 185b79dd3eb2..929f2c7d6506 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -93,30 +93,30 @@ namespace
         OUString sColor;
         const SfxPoolItem* pItem = nullptr;
 
-        if (SfxItemState::SET == pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
-        {
-            sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
+        if (SfxItemState::SET != pArgs->GetItemState(SID_ATTR_COLOR_STR, false, &pItem))
+            return;
 
-            if (sColor == "transparent")
-                aColor = COL_TRANSPARENT;
-            else
-                aColor = Color(sColor.toInt32(16));
+        sColor = static_cast<const SfxStringItem*>(pItem)->GetValue();
+
+        if (sColor == "transparent")
+            aColor = COL_TRANSPARENT;
+        else
+            aColor = Color(sColor.toInt32(16));
 
-            switch (nSlot)
+        switch (nSlot)
+        {
+            case SID_ATTR_CHAR_COLOR:
             {
-                case SID_ATTR_CHAR_COLOR:
-                {
-                    SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
-                    pArgs->Put(aColorItem);
-                    break;
-                }
+                SvxColorItem aColorItem(aColor, EE_CHAR_COLOR);
+                pArgs->Put(aColorItem);
+                break;
+            }
 
-                case SID_ATTR_CHAR_BACK_COLOR:
-                {
-                    SvxBackgroundColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR);
-                    pArgs->Put(pBackgroundItem);
-                    break;
-                }
+            case SID_ATTR_CHAR_BACK_COLOR:
+            {
+                SvxBackgroundColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR);
+                pArgs->Put(pBackgroundItem);
+                break;
             }
         }
     }
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index b8d79ebb9816..4b72415e4aaa 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -202,23 +202,23 @@ void SwDrawTextShell::ExecFormText(SfxRequest const & rReq)
 
     const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
 
-    if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
-    {
-        const SfxItemSet& rSet = *rReq.GetArgs();
+    if ( !(rMarkList.GetMarkCount() == 1 && rReq.GetArgs()) )
+        return;
 
-        if ( pDrView->IsTextEdit() )
-        {
-            //#111733# Sometimes SdrEndTextEdit() initiates the change in selection and
-            // 'this' is not valid anymore
-            SwView& rTempView = GetView();
-            pDrView->SdrEndTextEdit(true);
-            //this removes the current shell from the dispatcher stack!!
-            rTempView.AttrChangedNotify(nullptr);
-        }
+    const SfxItemSet& rSet = *rReq.GetArgs();
 
-        pDrView->SetAttributes(rSet);
+    if ( pDrView->IsTextEdit() )
+    {
+        //#111733# Sometimes SdrEndTextEdit() initiates the change in selection and
+        // 'this' is not valid anymore
+        SwView& rTempView = GetView();
+        pDrView->SdrEndTextEdit(true);
+        //this removes the current shell from the dispatcher stack!!
+        rTempView.AttrChangedNotify(nullptr);
     }
 
+    pDrView->SetAttributes(rSet);
+
 }
 
 // Return Status values back to FontWork
@@ -264,88 +264,88 @@ void SwDrawTextShell::ExecDrawLingu(SfxRequest const &rReq)
 {
     SwWrtShell &rSh = GetShell();
     OutlinerView* pOutlinerView = pSdrView->GetTextEditOutlinerView();
-    if( rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() )
+    if( !rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() )
+        return;
+
+    switch(rReq.GetSlot())
     {
-        switch(rReq.GetSlot())
-        {
-        case SID_THESAURUS:
-            pOutlinerView->StartThesaurus();
-            break;
+    case SID_THESAURUS:
+        pOutlinerView->StartThesaurus();
+        break;
 
-        case SID_HANGUL_HANJA_CONVERSION:
-            pOutlinerView->StartTextConversion(LANGUAGE_KOREAN, LANGUAGE_KOREAN, nullptr,
-                    i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false);
-            break;
+    case SID_HANGUL_HANJA_CONVERSION:
+        pOutlinerView->StartTextConversion(LANGUAGE_KOREAN, LANGUAGE_KOREAN, nullptr,
+                i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false);
+        break;
 
-        case SID_CHINESE_CONVERSION:
-            {
-                //open ChineseTranslationDialog
-                Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
-                if (!xContext.is())
-                    return;
+    case SID_CHINESE_CONVERSION:
+        {
+            //open ChineseTranslationDialog
+            Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
+            if (!xContext.is())
+                return;
 
-                Reference<lang::XMultiComponentFactory> xMCF(xContext->getServiceManager());
-                if (!xMCF.is())
-                    return;
+            Reference<lang::XMultiComponentFactory> xMCF(xContext->getServiceManager());
+            if (!xMCF.is())
+                return;
 
-                Reference<ui::dialogs::XExecutableDialog> xDialog(
-                        xMCF->createInstanceWithContext("com.sun.star.linguistic2.ChineseTranslationDialog", xContext), UNO_QUERY);
+            Reference<ui::dialogs::XExecutableDialog> xDialog(
+                    xMCF->createInstanceWithContext("com.sun.star.linguistic2.ChineseTranslationDialog", xContext), UNO_QUERY);
 
-                Reference<lang::XInitialization> xInit(xDialog, UNO_QUERY);
+            Reference<lang::XInitialization> xInit(xDialog, UNO_QUERY);
 
-                if (!xInit.is())
-                    return;
+            if (!xInit.is())
+                return;
 
-                //  initialize dialog
-                uno::Sequence<uno::Any> aSequence(comphelper::InitAnyPropertySequence(
-                {
-                    {"ParentWindow", uno::Any(Reference<awt::XWindow>())}
-                }));
-                xInit->initialize( aSequence );
+            //  initialize dialog
+            uno::Sequence<uno::Any> aSequence(comphelper::InitAnyPropertySequence(
+            {
+                {"ParentWindow", uno::Any(Reference<awt::XWindow>())}
+            }));
+            xInit->initialize( aSequence );
 
-                //execute dialog
-                sal_Int16 nDialogRet = xDialog->execute();
-                if(RET_OK == nDialogRet)
+            //execute dialog
+            sal_Int16 nDialogRet = xDialog->execute();
+            if(RET_OK == nDialogRet)
+            {
+                //get some parameters from the dialog
+                bool bToSimplified = true;
+                bool bUseVariants = true;
+                bool bCommonTerms = true;
+                Reference<beans::XPropertySet> xPropertySet(xDialog, UNO_QUERY);
+                if (xPropertySet.is())
                 {
-                    //get some parameters from the dialog
-                    bool bToSimplified = true;
-                    bool bUseVariants = true;
-                    bool bCommonTerms = true;
-                    Reference<beans::XPropertySet> xPropertySet(xDialog, UNO_QUERY);
-                    if (xPropertySet.is())
+                    try
                     {
-                        try
-                        {
-                            xPropertySet->getPropertyValue("IsDirectionToSimplified") >>= bToSimplified;
-                            xPropertySet->getPropertyValue("IsUseCharacterVariants") >>= bUseVariants;
-                            xPropertySet->getPropertyValue("IsTranslateCommonTerms") >>= bCommonTerms;
-                        }
-                        catch (const Exception&)
-                        {
-                        }
+                        xPropertySet->getPropertyValue("IsDirectionToSimplified") >>= bToSimplified;
+                        xPropertySet->getPropertyValue("IsUseCharacterVariants") >>= bUseVariants;
+                        xPropertySet->getPropertyValue("IsTranslateCommonTerms") >>= bCommonTerms;
                     }
+                    catch (const Exception&)
+                    {
+                    }
+                }
 
-                    //execute translation
-                    LanguageType nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
-                    LanguageType nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
-                    sal_Int32 nOptions       = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
-                    if(!bCommonTerms)
-                        nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
-
-                    vcl::Font aTargetFont = OutputDevice::GetDefaultFont(DefaultFontType::CJK_TEXT, nTargetLang, GetDefaultFontFlags::OnlyOne);
+                //execute translation
+                LanguageType nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
+                LanguageType nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
+                sal_Int32 nOptions       = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
+                if(!bCommonTerms)
+                    nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
 
-                    pOutlinerView->StartTextConversion(nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false);
-                }
+                vcl::Font aTargetFont = OutputDevice::GetDefaultFont(DefaultFontType::CJK_TEXT, nTargetLang, GetDefaultFontFlags::OnlyOne);
 
-                Reference<lang::XComponent> xComponent(xDialog, UNO_QUERY);
-                if (xComponent.is())
-                    xComponent->dispose();
+                pOutlinerView->StartTextConversion(nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false);
             }
-            break;
 
-        default:
-            OSL_ENSURE(false, "unexpected slot-id");
+            Reference<lang::XComponent> xComponent(xDialog, UNO_QUERY);
+            if (xComponent.is())
+                xComponent->dispose();
         }
+        break;
+
+    default:
+        OSL_ENSURE(false, "unexpected slot-id");
     }
 }
 
@@ -489,43 +489,43 @@ void SwDrawTextShell::ExecDraw(SfxRequest &rReq)
 
 void SwDrawTextShell::ExecUndo(SfxRequest &rReq)
 {
-    if( IsTextEdit() )
+    if( !IsTextEdit() )
+        return;
+
+    bool bCallBase = true;
+    const SfxItemSet* pArgs = rReq.GetArgs();
+    if( pArgs )
     {
-        bool bCallBase = true;
-        const SfxItemSet* pArgs = rReq.GetArgs();
-        if( pArgs )
+        sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
+        const SfxPoolItem* pItem;
+        switch( nId )
         {
-            sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
-            const SfxPoolItem* pItem;
-            switch( nId )
+        case SID_UNDO:
+        case SID_REDO:
+            if( SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) &&
+                1 < (nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue()) )
             {
-            case SID_UNDO:
-            case SID_REDO:
-                if( SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) &&
-                    1 < (nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue()) )
+                // then we make by ourself.
+                SfxUndoManager* pUndoManager = GetUndoManager();
+                if( pUndoManager )
                 {
-                    // then we make by ourself.
-                    SfxUndoManager* pUndoManager = GetUndoManager();
-                    if( pUndoManager )
-                    {
-                        if( SID_UNDO == nId )
-                            while( nCnt-- )
-                                pUndoManager->Undo();
-                        else
-                            while( nCnt-- )
-                                pUndoManager->Redo();
-                    }
-                    bCallBase = false;
-                    GetView().GetViewFrame()->GetBindings().InvalidateAll(false);
+                    if( SID_UNDO == nId )
+                        while( nCnt-- )
+                            pUndoManager->Undo();
+                    else
+                        while( nCnt-- )
+                            pUndoManager->Redo();
                 }
-                break;
+                bCallBase = false;
+                GetView().GetViewFrame()->GetBindings().InvalidateAll(false);
             }
+            break;
         }
-        if( bCallBase )
-        {
-            SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
-            pSfxViewFrame->ExecuteSlot(rReq, pSfxViewFrame->GetInterface());
-        }
+    }
+    if( bCallBase )
+    {
+        SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
+        pSfxViewFrame->ExecuteSlot(rReq, pSfxViewFrame->GetInterface());
     }
 }
 
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index 08b6ff047234..c203ace11024 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -734,333 +734,333 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
 {
     SwWrtShell &rSh = GetShell();
     bool bHtmlMode = 0 != ::GetHtmlMode(rSh.GetView().GetDocShell());
-    if (rSh.IsFrameSelected())
-    {
-        SfxItemSet aSet(
-            rSh.GetAttrPool(),
-            svl::Items<
-                RES_LR_SPACE, RES_UL_SPACE,
-                RES_PRINT, RES_HORI_ORIENT>{});
-        rSh.GetFlyFrameAttr( aSet );
+    if (!rSh.IsFrameSelected())
+        return;
 
-        bool bProtect = rSh.IsSelObjProtected(FlyProtectFlags::Pos) != FlyProtectFlags::NONE;
-        bool bParentCntProt = rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
+    SfxItemSet aSet(
+        rSh.GetAttrPool(),
+        svl::Items<
+            RES_LR_SPACE, RES_UL_SPACE,
+            RES_PRINT, RES_HORI_ORIENT>{});
+    rSh.GetFlyFrameAttr( aSet );
+
+    bool bProtect = rSh.IsSelObjProtected(FlyProtectFlags::Pos) != FlyProtectFlags::NONE;
+    bool bParentCntProt = rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
 
-        bProtect |= bParentCntProt;
+    bProtect |= bParentCntProt;
 
-        const FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
-        SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
+    const FrameTypeFlags eFrameType = rSh.GetFrameType(nullptr,true);
+    SwFlyFrameAttrMgr aMgr( false, &rSh, Frmmgr_Type::NONE, nullptr );
 
-        SfxWhichIter aIter( rSet );
-        sal_uInt16 nWhich = aIter.FirstWhich();
-        while ( nWhich )
+    SfxWhichIter aIter( rSet );
+    sal_uInt16 nWhich = aIter.FirstWhich();
+    while ( nWhich )
+    {
+        switch ( nWhich )
         {
-            switch ( nWhich )
+            case RES_FRM_SIZE:
             {
-                case RES_FRM_SIZE:
-                {
-                    const SwFormatFrameSize& aSz(aMgr.GetFrameSize());
-                    rSet.Put(aSz);
-                }
-                break;
-                case RES_VERT_ORIENT:
-                case RES_HORI_ORIENT:
-                case SID_ATTR_ULSPACE:
-                case SID_ATTR_LRSPACE:
-                case RES_LR_SPACE:
-                case RES_UL_SPACE:
-                case RES_PROTECT:
-                case RES_OPAQUE:
-                case RES_PRINT:
-                case RES_SURROUND:
+                const SwFormatFrameSize& aSz(aMgr.GetFrameSize());
+                rSet.Put(aSz);
+            }
+            break;
+            case RES_VERT_ORIENT:
+            case RES_HORI_ORIENT:
+            case SID_ATTR_ULSPACE:
+            case SID_ATTR_LRSPACE:
+            case RES_LR_SPACE:
+            case RES_UL_SPACE:
+            case RES_PROTECT:
+            case RES_OPAQUE:
+            case RES_PRINT:
+            case RES_SURROUND:
+            {
+                rSet.Put(aSet.Get(GetPool().GetWhich(nWhich)));
+            }
+            break;
+            case SID_OBJECT_ALIGN:
+            {
+                if ( bProtect )
+                    rSet.DisableItem( nWhich );
+            }
+            break;
+            case SID_OBJECT_ALIGN_LEFT   :
+            case SID_OBJECT_ALIGN_CENTER :
+            case SID_OBJECT_ALIGN_RIGHT  :
+            case FN_FRAME_ALIGN_HORZ_CENTER:
+            case FN_FRAME_ALIGN_HORZ_RIGHT:
+            case FN_FRAME_ALIGN_HORZ_LEFT:
+                if ( (eFrameType & FrameTypeFlags::FLY_INCNT) ||
+                     bProtect ||
+                     ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER  || nWhich == SID_OBJECT_ALIGN_CENTER) &&
+                      bHtmlMode ))
                 {
-                    rSet.Put(aSet.Get(GetPool().GetWhich(nWhich)));
+                    rSet.DisableItem( nWhich );
                 }
-                break;
-                case SID_OBJECT_ALIGN:
+                else
                 {
-                    if ( bProtect )
-                        rSet.DisableItem( nWhich );
-                }
-                break;
-                case SID_OBJECT_ALIGN_LEFT   :
-                case SID_OBJECT_ALIGN_CENTER :
-                case SID_OBJECT_ALIGN_RIGHT  :
-                case FN_FRAME_ALIGN_HORZ_CENTER:
-                case FN_FRAME_ALIGN_HORZ_RIGHT:
-                case FN_FRAME_ALIGN_HORZ_LEFT:
-                    if ( (eFrameType & FrameTypeFlags::FLY_INCNT) ||
-                         bProtect ||
-                         ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER  || nWhich == SID_OBJECT_ALIGN_CENTER) &&
-                          bHtmlMode ))
+                    sal_Int16 nHoriOrient = -1;
+                    switch(nWhich)
                     {
-                        rSet.DisableItem( nWhich );
+                        case SID_OBJECT_ALIGN_LEFT:
+                            nHoriOrient = text::HoriOrientation::LEFT;
+                            break;
+                        case SID_OBJECT_ALIGN_CENTER:
+                            nHoriOrient = text::HoriOrientation::CENTER;
+                            break;
+                        case SID_OBJECT_ALIGN_RIGHT:
+                            nHoriOrient = text::HoriOrientation::RIGHT;
+                            break;
+                        default:
+                            break;
                     }
-                    else
+                    SwFormatHoriOrient aHOrient(aMgr.GetHoriOrient());
+                    if (nHoriOrient != -1)
+                        rSet.Put(SfxBoolItem(nWhich, nHoriOrient == aHOrient.GetHoriOrient()));
+                }
+            break;
+            case FN_FRAME_ALIGN_VERT_ROW_TOP:
+            case FN_FRAME_ALIGN_VERT_ROW_CENTER:
+            case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
+            case FN_FRAME_ALIGN_VERT_CHAR_TOP:
+            case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
+            case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
+                if ( !(eFrameType & FrameTypeFlags::FLY_INCNT) || bProtect
+                     || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) )
+                    rSet.DisableItem( nWhich );
+            break;
+
+            case SID_OBJECT_ALIGN_UP     :
+            case SID_OBJECT_ALIGN_MIDDLE :
+            case SID_OBJECT_ALIGN_DOWN :
+
+            case FN_FRAME_ALIGN_VERT_TOP:
+            case FN_FRAME_ALIGN_VERT_CENTER:
+            case FN_FRAME_ALIGN_VERT_BOTTOM:
+                if ( bProtect || (bHtmlMode && eFrameType & FrameTypeFlags::FLY_ATCNT))
+                    rSet.DisableItem( nWhich );
+                else
+                {
+                    // These slots need different labels depending on whether they are anchored in a character
+                    // or on a paragraph/page etc.
+                    OUString sNewLabel;
+                    if (eFrameType & FrameTypeFlags::FLY_INCNT)
                     {
-                        sal_Int16 nHoriOrient = -1;
-                        switch(nWhich)
+                        switch (nWhich)
                         {
-                            case SID_OBJECT_ALIGN_LEFT:
-                                nHoriOrient = text::HoriOrientation::LEFT;
-                                break;
-                            case SID_OBJECT_ALIGN_CENTER:
-                                nHoriOrient = text::HoriOrientation::CENTER;
+                            case SID_OBJECT_ALIGN_UP     :
+                            case FN_FRAME_ALIGN_VERT_TOP:
+                                sNewLabel = SwResId(STR_FRMUI_TOP_BASE);
                                 break;
-                            case SID_OBJECT_ALIGN_RIGHT:
-                                nHoriOrient = text::HoriOrientation::RIGHT;
-                                break;
-                            default:
+                            case SID_OBJECT_ALIGN_MIDDLE :
+                            case FN_FRAME_ALIGN_VERT_CENTER:
+                                sNewLabel = SwResId(STR_FRMUI_CENTER_BASE);
                                 break;
+                            case SID_OBJECT_ALIGN_DOWN :
+                            case FN_FRAME_ALIGN_VERT_BOTTOM:
+                                if(!bHtmlMode)
+                                    sNewLabel = SwResId(STR_FRMUI_BOTTOM_BASE);
+                                else
+                                    rSet.DisableItem( nWhich );
+                            break;
                         }
-                        SwFormatHoriOrient aHOrient(aMgr.GetHoriOrient());
-                        if (nHoriOrient != -1)
-                            rSet.Put(SfxBoolItem(nWhich, nHoriOrient == aHOrient.GetHoriOrient()));
                     }
-                break;
-                case FN_FRAME_ALIGN_VERT_ROW_TOP:
-                case FN_FRAME_ALIGN_VERT_ROW_CENTER:
-                case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
-                case FN_FRAME_ALIGN_VERT_CHAR_TOP:
-                case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
-                case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
-                    if ( !(eFrameType & FrameTypeFlags::FLY_INCNT) || bProtect
-                         || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) )
-                        rSet.DisableItem( nWhich );
-                break;
-
-                case SID_OBJECT_ALIGN_UP     :
-                case SID_OBJECT_ALIGN_MIDDLE :
-                case SID_OBJECT_ALIGN_DOWN :
-
-                case FN_FRAME_ALIGN_VERT_TOP:
-                case FN_FRAME_ALIGN_VERT_CENTER:
-                case FN_FRAME_ALIGN_VERT_BOTTOM:
-                    if ( bProtect || (bHtmlMode && eFrameType & FrameTypeFlags::FLY_ATCNT))
-                        rSet.DisableItem( nWhich );
                     else
                     {
-                        // These slots need different labels depending on whether they are anchored in a character
-                        // or on a paragraph/page etc.
-                        OUString sNewLabel;
-                        if (eFrameType & FrameTypeFlags::FLY_INCNT)
+                        if (nWhich != FN_FRAME_ALIGN_VERT_TOP &&
+                                nWhich != SID_OBJECT_ALIGN_UP )
                         {
-                            switch (nWhich)
+                            if (aMgr.GetAnchor() == RndStdIds::FLY_AT_FLY)
                             {
-                                case SID_OBJECT_ALIGN_UP     :
-                                case FN_FRAME_ALIGN_VERT_TOP:
-                                    sNewLabel = SwResId(STR_FRMUI_TOP_BASE);
-                                    break;
-                                case SID_OBJECT_ALIGN_MIDDLE :
-                                case FN_FRAME_ALIGN_VERT_CENTER:
-                                    sNewLabel = SwResId(STR_FRMUI_CENTER_BASE);
-                                    break;
-                                case SID_OBJECT_ALIGN_DOWN :
-                                case FN_FRAME_ALIGN_VERT_BOTTOM:
-                                    if(!bHtmlMode)
-                                        sNewLabel = SwResId(STR_FRMUI_BOTTOM_BASE);
-                                    else
+                                const SwFrameFormat* pFormat = rSh.IsFlyInFly();
+                                if (pFormat)
+                                {
+                                    const SwFormatFrameSize& rFrameSz = pFormat->GetFrameSize();
+                                    if (rFrameSz.GetHeightSizeType() != SwFrameSize::Fixed)
+                                    {
                                         rSet.DisableItem( nWhich );
-                                break;
+                                        break;
+                                    }
+                                }
                             }
                         }
-                        else
+                        OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame()->GetFrame().GetFrameInterface()));
+                        switch (nWhich)
                         {
-                            if (nWhich != FN_FRAME_ALIGN_VERT_TOP &&
-                                    nWhich != SID_OBJECT_ALIGN_UP )
+                            case SID_OBJECT_ALIGN_UP :
+                            case FN_FRAME_ALIGN_VERT_TOP:
                             {
-                                if (aMgr.GetAnchor() == RndStdIds::FLY_AT_FLY)
-                                {
-                                    const SwFrameFormat* pFormat = rSh.IsFlyInFly();
-                                    if (pFormat)
-                                    {
-                                        const SwFormatFrameSize& rFrameSz = pFormat->GetFrameSize();
-                                        if (rFrameSz.GetHeightSizeType() != SwFrameSize::Fixed)
-                                        {
-                                            rSet.DisableItem( nWhich );
-                                            break;
-                                        }
-                                    }
-                                }
+                                auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignTop", aModuleName);
+                                sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
+                                break;
                             }
-                            OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(GetFrame()->GetFrame().GetFrameInterface()));
-                            switch (nWhich)
+                            case SID_OBJECT_ALIGN_MIDDLE:
+                            case FN_FRAME_ALIGN_VERT_CENTER:
                             {
-                                case SID_OBJECT_ALIGN_UP :
-                                case FN_FRAME_ALIGN_VERT_TOP:
-                                {
-                                    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignTop", aModuleName);
-                                    sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
-                                    break;
-                                }
-                                case SID_OBJECT_ALIGN_MIDDLE:
-                                case FN_FRAME_ALIGN_VERT_CENTER:
-                                {
-                                    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignVerticalCenter", aModuleName);
-                                    sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
-                                    break;
-                                }
-                                case SID_OBJECT_ALIGN_DOWN:
-                                case FN_FRAME_ALIGN_VERT_BOTTOM:
-                                {
-                                    auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignBottom", aModuleName);
-                                    sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
-                                    break;
-                                }
+                                auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignVerticalCenter", aModuleName);
+                                sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
+                                break;
+                            }
+                            case SID_OBJECT_ALIGN_DOWN:
+                            case FN_FRAME_ALIGN_VERT_BOTTOM:
+                            {
+                                auto aProperties = vcl::CommandInfoProvider::GetCommandProperties(".uno:AlignBottom", aModuleName);
+                                sNewLabel = vcl::CommandInfoProvider::GetLabelForCommand(aProperties);
+                                break;
                             }
                         }
-                        if ( !sNewLabel.isEmpty() )
-                            rSet.Put( SfxStringItem( nWhich, sNewLabel ));
                     }
-                break;
-                case SID_HYPERLINK_GETLINK:
-                {
-                    SvxHyperlinkItem aHLinkItem;
-                    const SfxPoolItem* pItem;
+                    if ( !sNewLabel.isEmpty() )
+                        rSet.Put( SfxStringItem( nWhich, sNewLabel ));
+                }
+            break;
+            case SID_HYPERLINK_GETLINK:
+            {
+                SvxHyperlinkItem aHLinkItem;
+                const SfxPoolItem* pItem;
 
-                    SfxItemSet aURLSet(GetPool(), svl::Items<RES_URL, RES_URL>{});
-                    rSh.GetFlyFrameAttr( aURLSet );
+                SfxItemSet aURLSet(GetPool(), svl::Items<RES_URL, RES_URL>{});
+                rSh.GetFlyFrameAttr( aURLSet );
 
-                    if(SfxItemState::SET == aURLSet.GetItemState(RES_URL, true, &pItem))
-                    {
-                        const SwFormatURL* pFormatURL = static_cast<const SwFormatURL*>(pItem);
-                        aHLinkItem.SetURL(pFormatURL->GetURL());
-                        aHLinkItem.SetTargetFrame(pFormatURL->GetTargetFrameName());
-                        aHLinkItem.SetName(rSh.GetFlyName());
-                    }
+                if(SfxItemState::SET == aURLSet.GetItemState(RES_URL, true, &pItem))
+                {
+                    const SwFormatURL* pFormatURL = static_cast<const SwFormatURL*>(pItem);
+                    aHLinkItem.SetURL(pFormatURL->GetURL());
+                    aHLinkItem.SetTargetFrame(pFormatURL->GetTargetFrameName());
+                    aHLinkItem.SetName(rSh.GetFlyName());
+                }
 
-                    aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() |
-                        (bHtmlMode ? HLINK_HTMLMODE : 0)));
+                aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() |
+                    (bHtmlMode ? HLINK_HTMLMODE : 0)));
 
-                    rSet.Put(aHLinkItem);
-                }
-                break;
+                rSet.Put(aHLinkItem);
+            }
+            break;
 
-                case FN_FRAME_CHAIN:
+            case FN_FRAME_CHAIN:
+            {
+                const SelectionType nSel = rSh.GetSelectionType();
+                if (nSel & SelectionType::Graphic || nSel & SelectionType::Ole)
+                    rSet.DisableItem( FN_FRAME_CHAIN );
+                else
                 {
-                    const SelectionType nSel = rSh.GetSelectionType();
-                    if (nSel & SelectionType::Graphic || nSel & SelectionType::Ole)
+                    const SwFrameFormat *pFormat = rSh.GetFlyFrameFormat();
+                    if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
+                         !pFormat || pFormat->GetChain().GetNext() )
+                    {
                         rSet.DisableItem( FN_FRAME_CHAIN );
+                    }
                     else
                     {
-                        const SwFrameFormat *pFormat = rSh.GetFlyFrameFormat();
-                        if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
-                             !pFormat || pFormat->GetChain().GetNext() )
-                        {
-                            rSet.DisableItem( FN_FRAME_CHAIN );
-                        }
-                        else
-                        {
-                            bool bChainMode = rSh.GetView().GetEditWin().IsChainMode();
-                            rSet.Put( SfxBoolItem( FN_FRAME_CHAIN, bChainMode ) );
-                        }
+                        bool bChainMode = rSh.GetView().GetEditWin().IsChainMode();
+                        rSet.Put( SfxBoolItem( FN_FRAME_CHAIN, bChainMode ) );
                     }
                 }
-                break;
-                case FN_FRAME_UNCHAIN:
+            }
+            break;
+            case FN_FRAME_UNCHAIN:
+            {
+                const SelectionType nSel = rSh.GetSelectionType();
+                if (nSel & SelectionType::Graphic || nSel & SelectionType::Ole)
+                    rSet.DisableItem( FN_FRAME_UNCHAIN );
+                else
                 {
-                    const SelectionType nSel = rSh.GetSelectionType();
-                    if (nSel & SelectionType::Graphic || nSel & SelectionType::Ole)
-                        rSet.DisableItem( FN_FRAME_UNCHAIN );
-                    else
+                    const SwFrameFormat *pFormat = rSh.GetFlyFrameFormat();
+                    if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
+                         !pFormat || !pFormat->GetChain().GetNext() )
                     {
-                        const SwFrameFormat *pFormat = rSh.GetFlyFrameFormat();
-                        if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
-                             !pFormat || !pFormat->GetChain().GetNext() )
-                        {
-                            rSet.DisableItem( FN_FRAME_UNCHAIN );
-                        }
+                        rSet.DisableItem( FN_FRAME_UNCHAIN );
                     }
                 }
-                break;
-                case SID_FRAME_TO_TOP:
-                case SID_FRAME_TO_BOTTOM:
-                case FN_FRAME_UP:
-                case FN_FRAME_DOWN:
-                    if ( bParentCntProt )
-                        rSet.DisableItem( nWhich );
-                break;
-
-                case SID_ATTR_TRANSFORM:
-                {
+            }
+            break;
+            case SID_FRAME_TO_TOP:
+            case SID_FRAME_TO_BOTTOM:
+            case FN_FRAME_UP:
+            case FN_FRAME_DOWN:
+                if ( bParentCntProt )
                     rSet.DisableItem( nWhich );
-                }
-                break;
+            break;
 
-                case SID_ATTR_TRANSFORM_PROTECT_SIZE:
-                {
-                    const FlyProtectFlags eProtection = rSh.IsSelObjProtected( FlyProtectFlags::Size );
-                    if ( ( eProtection & FlyProtectFlags::Content ) ||
-                         ( eProtection & FlyProtectFlags::Size ) )
-                    {
-                        rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, true ) );
-                    }
-                    else
-                    {
-                        rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, false ) );
-                    }
-                }
-                break;
+            case SID_ATTR_TRANSFORM:
+            {
+                rSet.DisableItem( nWhich );
+            }
+            break;
 
-                case SID_ATTR_TRANSFORM_WIDTH:
+            case SID_ATTR_TRANSFORM_PROTECT_SIZE:
+            {
+                const FlyProtectFlags eProtection = rSh.IsSelObjProtected( FlyProtectFlags::Size );
+                if ( ( eProtection & FlyProtectFlags::Content ) ||
+                     ( eProtection & FlyProtectFlags::Size ) )
                 {
-                    rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, aMgr.GetSize().getWidth() ) );
+                    rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, true ) );
                 }
-                break;
-
-                case SID_ATTR_TRANSFORM_HEIGHT:
+                else
                 {
-                    rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, aMgr.GetSize().getHeight() ) );
+                    rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, false ) );
                 }
-                break;
+            }
+            break;
 
-                case FN_FORMAT_FRAME_DLG:
-                {
-                    const SelectionType nSel = rSh.GetSelectionType();
-                    if ( bParentCntProt || nSel & SelectionType::Graphic)
-                        rSet.DisableItem( nWhich );
-                }
-                break;
-                // #i73249#
-                case FN_TITLE_DESCRIPTION_SHAPE:
-                case FN_NAME_SHAPE:
+            case SID_ATTR_TRANSFORM_WIDTH:
+            {
+                rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, aMgr.GetSize().getWidth() ) );
+            }
+            break;
+
+            case SID_ATTR_TRANSFORM_HEIGHT:
+            {
+                rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, aMgr.GetSize().getHeight() ) );
+            }
+            break;
+
+            case FN_FORMAT_FRAME_DLG:
+            {
+                const SelectionType nSel = rSh.GetSelectionType();
+                if ( bParentCntProt || nSel & SelectionType::Graphic)
+                    rSet.DisableItem( nWhich );
+            }
+            break;
+            // #i73249#
+            case FN_TITLE_DESCRIPTION_SHAPE:
+            case FN_NAME_SHAPE:
+            {
+                SwWrtShell &rWrtSh = GetShell();
+                SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList();
+                if ( !pSdrView ||
+                     pSdrView->GetMarkedObjectCount() != 1 )
                 {
-                    SwWrtShell &rWrtSh = GetShell();
-                    SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList();
-                    if ( !pSdrView ||
-                         pSdrView->GetMarkedObjectCount() != 1 )
-                    {
-                        rSet.DisableItem( nWhich );
-                    }
+                    rSet.DisableItem( nWhich );
                 }
-                break;
+            }
+            break;
 
-                case FN_POSTIT:
+            case FN_POSTIT:
+            {
+                SwFlyFrame* pFly = rSh.GetSelectedFlyFrame();
+                if (pFly)
                 {
-                    SwFlyFrame* pFly = rSh.GetSelectedFlyFrame();
-                    if (pFly)
+                    SwFrameFormat* pFormat = pFly->GetFormat();
+                    if (pFormat)
                     {
-                        SwFrameFormat* pFormat = pFly->GetFormat();
-                        if (pFormat)
+                        RndStdIds eAnchorId = pFormat->GetAnchor().GetAnchorId();
+                        // SwWrtShell::InsertPostIt() only works on as-char and at-char anchored
+                        // images.
+                        if (eAnchorId != RndStdIds::FLY_AS_CHAR && eAnchorId != RndStdIds::FLY_AT_CHAR)
                         {
-                            RndStdIds eAnchorId = pFormat->GetAnchor().GetAnchorId();
-                            // SwWrtShell::InsertPostIt() only works on as-char and at-char anchored
-                            // images.
-                            if (eAnchorId != RndStdIds::FLY_AS_CHAR && eAnchorId != RndStdIds::FLY_AT_CHAR)
-                            {
-                                rSet.DisableItem(nWhich);
-                            }
+                            rSet.DisableItem(nWhich);
                         }
                     }
                 }
-                break;
-
-                default:
-                    /* do nothing */;
-                    break;
             }
-            nWhich = aIter.NextWhich();
+            break;
+
+            default:
+                /* do nothing */;
+                break;
         }
+        nWhich = aIter.NextWhich();
     }
 }
 
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 3287de6cb653..df942d4bda64 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -926,25 +926,25 @@ void SwGrfShell::ExecuteRotation(SfxRequest const &rReq)
         aRotation = 1800;
     }
 
-    if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RESET || 0 != aRotation)
+    if (rReq.GetSlot() != SID_ROTATE_GRAPHIC_RESET && 0 == aRotation)
+        return;
+
+    SwWrtShell& rShell = GetShell();
+    SfxItemSet aSet( rShell.GetAttrPool(), svl::Items<RES_GRFATR_ROTATION, RES_GRFATR_ROTATION>{} );
+    rShell.GetCurAttr( aSet );
+    const SwRotationGrf& rRotation = aSet.Get(RES_GRFATR_ROTATION);
+    SwFlyFrameAttrMgr aMgr(false, &rShell, rShell.IsFrameSelected() ? Frmmgr_Type::NONE : Frmmgr_Type::GRF, nullptr);
+
+    // RotGrfFlyFrame: Possible rotation change here, SwFlyFrameAttrMgr aMgr is available
+    if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RESET)
     {
-        SwWrtShell& rShell = GetShell();
-        SfxItemSet aSet( rShell.GetAttrPool(), svl::Items<RES_GRFATR_ROTATION, RES_GRFATR_ROTATION>{} );
-        rShell.GetCurAttr( aSet );
-        const SwRotationGrf& rRotation = aSet.Get(RES_GRFATR_ROTATION);
-        SwFlyFrameAttrMgr aMgr(false, &rShell, rShell.IsFrameSelected() ? Frmmgr_Type::NONE : Frmmgr_Type::GRF, nullptr);
-
-        // RotGrfFlyFrame: Possible rotation change here, SwFlyFrameAttrMgr aMgr is available
-        if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RESET)
-        {
-            aMgr.SetRotation(rRotation.GetValue(), 0, rRotation.GetUnrotatedSize());
-        }
-        else if(0 != aRotation)
-        {
-            const sal_uInt16 aNewRotation((aRotation + rRotation.GetValue()) % 3600);
+        aMgr.SetRotation(rRotation.GetValue(), 0, rRotation.GetUnrotatedSize());
+    }
+    else if(0 != aRotation)
+    {
+        const sal_uInt16 aNewRotation((aRotation + rRotation.GetValue()) % 3600);
 
-            aMgr.SetRotation(rRotation.GetValue(), aNewRotation, rRotation.GetUnrotatedSize());
-        }
+        aMgr.SetRotation(rRotation.GetValue(), aNewRotation, rRotation.GetUnrotatedSize());
     }
 }
 
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx
index 90904b37dcdc..bff1dc05530f 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -225,77 +225,77 @@ namespace SwLangHelper
     void SetLanguage( SwWrtShell &rWrtSh, OutlinerView const * pOLV, const ESelection& rSelection, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
     {
         const LanguageType nLang = SvtLanguageTable::GetLanguageType( rLangText );
-        if (nLang != LANGUAGE_DONTKNOW)
+        if (nLang == LANGUAGE_DONTKNOW)
+            return;
+
+        EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : nullptr;
+        OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
+
+        //get ScriptType
+        sal_uInt16 nLangWhichId = 0;
+        bool bIsSingleScriptType = true;
+        switch (SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ))
         {
-            EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : nullptr;
-            OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
+            case SvtScriptType::LATIN :    nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE) : sal_uInt16(RES_CHRATR_LANGUAGE); break;
+            case SvtScriptType::ASIAN :    nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CJK) : sal_uInt16(RES_CHRATR_CJK_LANGUAGE); break;
+            case SvtScriptType::COMPLEX :  nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CTL) : sal_uInt16(RES_CHRATR_CTL_LANGUAGE); break;
+            default:
+                bIsSingleScriptType = false;
+                OSL_FAIL("unexpected case" );
+        }
+        if (!bIsSingleScriptType)
+            return;
 
-            //get ScriptType
-            sal_uInt16 nLangWhichId = 0;
-            bool bIsSingleScriptType = true;
-            switch (SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ))
+        // change language for selection or paragraph
+        // (for paragraph is handled by previously having set the selection to the
+        // whole paragraph)
+        if (bIsForSelection)
+        {
+            // apply language to current selection
+            if (pEditEngine)
             {
-                case SvtScriptType::LATIN :    nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE) : sal_uInt16(RES_CHRATR_LANGUAGE); break;
-                case SvtScriptType::ASIAN :    nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CJK) : sal_uInt16(RES_CHRATR_CJK_LANGUAGE); break;
-                case SvtScriptType::COMPLEX :  nLangWhichId = pEditEngine ? sal_uInt16(EE_CHAR_LANGUAGE_CTL) : sal_uInt16(RES_CHRATR_CTL_LANGUAGE); break;
-                default:
-                    bIsSingleScriptType = false;
-                    OSL_FAIL("unexpected case" );
+                rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
+                pEditEngine->QuickSetAttribs(rCoreSet, rSelection);
             }
-            if (bIsSingleScriptType)
+            else
             {
-                // change language for selection or paragraph
-                // (for paragraph is handled by previously having set the selection to the
-                // whole paragraph)
-                if (bIsForSelection)
-                {
-                    // apply language to current selection
-                    if (pEditEngine)
-                    {
-                        rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
-                        pEditEngine->QuickSetAttribs(rCoreSet, rSelection);
-                    }
-                    else
-                    {
-                        rWrtSh.GetCurAttr( rCoreSet );
-                        rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
-                        rWrtSh.SetAttrSet( rCoreSet );
-                    }
-                }
-                else // change language for all text
-                {
-                    // set document default language
-                    switch (nLangWhichId)
-                    {
-                         case EE_CHAR_LANGUAGE :      nLangWhichId = RES_CHRATR_LANGUAGE; break;
-                         case EE_CHAR_LANGUAGE_CJK :  nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
-                         case EE_CHAR_LANGUAGE_CTL :  nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
-                    }
-                    //Set the default document language
-                    rWrtSh.SetDefault( SvxLanguageItem( nLang, nLangWhichId ) );
-
-                    //Resolves: fdo#35282 Clear the language from all Text Styles, and
-                    //fallback to default document language
-                    const SwTextFormatColls *pColls = rWrtSh.GetDoc()->GetTextFormatColls();
-                    for(size_t i = 0, nCount = pColls->size(); i < nCount; ++i)
-                    {
-                        SwTextFormatColl &rTextColl = *(*pColls)[ i ];
-                        rTextColl.ResetFormatAttr(nLangWhichId);
-                    }
-                    //Resolves: fdo#35282 Clear the language from all Character Styles,
-                    //and fallback to default document language
-                    const SwCharFormats *pCharFormats = rWrtSh.GetDoc()->GetCharFormats();
-                    for(size_t i = 0, nCount = pCharFormats->size(); i < nCount; ++i)
-                    {
-                        SwCharFormat &rCharFormat = *(*pCharFormats)[ i ];
-                        rCharFormat.ResetFormatAttr(nLangWhichId);
-                    }
-
-                    // #i102191: hard set respective language attribute in text document
-                    // (for all text in the document - which should be selected by now...)
-                    rWrtSh.SetAttrItem( SvxLanguageItem( nLang, nLangWhichId ) );
-                }
+                rWrtSh.GetCurAttr( rCoreSet );
+                rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
+                rWrtSh.SetAttrSet( rCoreSet );
+            }
+        }
+        else // change language for all text
+        {
+            // set document default language
+            switch (nLangWhichId)
+            {
+                 case EE_CHAR_LANGUAGE :      nLangWhichId = RES_CHRATR_LANGUAGE; break;
+                 case EE_CHAR_LANGUAGE_CJK :  nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
+                 case EE_CHAR_LANGUAGE_CTL :  nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
+            }
+            //Set the default document language
+            rWrtSh.SetDefault( SvxLanguageItem( nLang, nLangWhichId ) );
+
+            //Resolves: fdo#35282 Clear the language from all Text Styles, and
+            //fallback to default document language
+            const SwTextFormatColls *pColls = rWrtSh.GetDoc()->GetTextFormatColls();
+            for(size_t i = 0, nCount = pColls->size(); i < nCount; ++i)
+            {
+                SwTextFormatColl &rTextColl = *(*pColls)[ i ];
+                rTextColl.ResetFormatAttr(nLangWhichId);
             }
+            //Resolves: fdo#35282 Clear the language from all Character Styles,
+            //and fallback to default document language
+            const SwCharFormats *pCharFormats = rWrtSh.GetDoc()->GetCharFormats();
+            for(size_t i = 0, nCount = pCharFormats->size(); i < nCount; ++i)
+            {
+                SwCharFormat &rCharFormat = *(*pCharFormats)[ i ];
+                rCharFormat.ResetFormatAttr(nLangWhichId);
+            }
+
+            // #i102191: hard set respective language attribute in text document
+            // (for all text in the document - which should be selected by now...)
+            rWrtSh.SetAttrItem( SvxLanguageItem( nLang, nLangWhichId ) );
         }
     }
 
diff --git a/sw/source/uibase/shells/listsh.cxx b/sw/source/uibase/shells/listsh.cxx
index a8d7eb91f8c7..8220f6cd4ef1 100644
--- a/sw/source/uibase/shells/listsh.cxx
+++ b/sw/source/uibase/shells/listsh.cxx
@@ -51,76 +51,76 @@ void SwListShell::InitInterface_Impl()
 static void lcl_OutlineUpDownWithSubPoints( SwWrtShell& rSh, bool bMove, bool bUp )
 {
     const SwOutlineNodes::size_type nActPos = rSh.GetOutlinePos();
-    if ( nActPos < SwOutlineNodes::npos && rSh.IsOutlineMovable( nActPos ) )
+    if ( !(nActPos < SwOutlineNodes::npos && rSh.IsOutlineMovable( nActPos )) )
+        return;
+
+    rSh.Push();
+    rSh.MakeOutlineSel( nActPos, nActPos, true );
+
+    if ( bMove )
     {
-        rSh.Push();
-        rSh.MakeOutlineSel( nActPos, nActPos, true );
+        const IDocumentOutlineNodes* pIDoc( rSh.getIDocumentOutlineNodesAccess() );
+        const int nActLevel = pIDoc->getOutlineLevel( nActPos );
+        SwOutlineNodes::difference_type nDir = 0;
 
-        if ( bMove )
+        if ( !bUp )
         {
-            const IDocumentOutlineNodes* pIDoc( rSh.getIDocumentOutlineNodesAccess() );
-            const int nActLevel = pIDoc->getOutlineLevel( nActPos );
-            SwOutlineNodes::difference_type nDir = 0;
+            // Move down with subpoints:
+            SwOutlineNodes::size_type nActEndPos = nActPos + 1;
+            while ( nActEndPos < pIDoc->getOutlineNodesCount() &&
+                   (!pIDoc->isOutlineInLayout(nActEndPos, *rSh.GetLayout())
+                    || nActLevel < pIDoc->getOutlineLevel(nActEndPos)))
+            {
+                ++nActEndPos;
+            }
 
-            if ( !bUp )
+            if ( nActEndPos < pIDoc->getOutlineNodesCount() )
             {
-                // Move down with subpoints:
-                SwOutlineNodes::size_type nActEndPos = nActPos + 1;
-                while ( nActEndPos < pIDoc->getOutlineNodesCount() &&
-                       (!pIDoc->isOutlineInLayout(nActEndPos, *rSh.GetLayout())
-                        || nActLevel < pIDoc->getOutlineLevel(nActEndPos)))
+                // The current subpoint which should be moved
+                // starts at nActPos and ends at nActEndPos - 1
+                --nActEndPos;
+                SwOutlineNodes::size_type nDest = nActEndPos + 2;
+                while ( nDest < pIDoc->getOutlineNodesCount() &&
+                       (!pIDoc->isOutlineInLayout(nDest, *rSh.GetLayout())
+                        || nActLevel < pIDoc->getOutlineLevel(nDest)))
                 {
-                    ++nActEndPos;
+                    ++nDest;
                 }
 
-                if ( nActEndPos < pIDoc->getOutlineNodesCount() )
-                {
-                    // The current subpoint which should be moved
-                    // starts at nActPos and ends at nActEndPos - 1
-                    --nActEndPos;
-                    SwOutlineNodes::size_type nDest = nActEndPos + 2;
-                    while ( nDest < pIDoc->getOutlineNodesCount() &&
-                           (!pIDoc->isOutlineInLayout(nDest, *rSh.GetLayout())
-                            || nActLevel < pIDoc->getOutlineLevel(nDest)))
-                    {
-                        ++nDest;
-                    }
-
-                    nDir = nDest - 1 - nActEndPos;
-                }
+                nDir = nDest - 1 - nActEndPos;
             }
-            else
+        }
+        else
+        {
+            // Move up with subpoints:
+            if ( nActPos > 0 )
             {
-                // Move up with subpoints:
-                if ( nActPos > 0 )
+                SwOutlineNodes::size_type nDest = nActPos - 1;
+                while (nDest > 0 &&
+                       (!pIDoc->isOutlineInLayout(nDest, *rSh.GetLayout())
+                        || nActLevel < pIDoc->getOutlineLevel(nDest)))
                 {
-                    SwOutlineNodes::size_type nDest = nActPos - 1;
-                    while (nDest > 0 &&
-                           (!pIDoc->isOutlineInLayout(nDest, *rSh.GetLayout())
-                            || nActLevel < pIDoc->getOutlineLevel(nDest)))
-                    {
-                        --nDest;
-                    }
-
-                    nDir = nDest - nActPos;
+                    --nDest;
                 }
-            }
 
-            if ( nDir )
-            {
-                rSh.MoveOutlinePara( nDir );
-                rSh.GotoOutline( nActPos + nDir );
+                nDir = nDest - nActPos;
             }
         }
-        else
+
+        if ( nDir )
         {
-            // Up/down with subpoints:
-            rSh.OutlineUpDown( bUp ? -1 : 1 );
+            rSh.MoveOutlinePara( nDir );
+            rSh.GotoOutline( nActPos + nDir );
         }
-
-        rSh.ClearMark();
-        rSh.Pop(SwCursorShell::PopMode::DeleteCurrent);
     }
+    else
+    {
+        // Up/down with subpoints:
+        rSh.OutlineUpDown( bUp ? -1 : 1 );
+    }
+
+    rSh.ClearMark();
+    rSh.Pop(SwCursorShell::PopMode::DeleteCurrent);
 }
 
 void SwListShell::Execute(SfxRequest &rReq)
diff --git a/sw/source/uibase/shells/mediash.cxx b/sw/source/uibase/shells/mediash.cxx
index 932b2feb6529..7aaabc817c08 100644
--- a/sw/source/uibase/shells/mediash.cxx
+++ b/sw/source/uibase/shells/mediash.cxx
@@ -50,67 +50,67 @@ void SwMediaShell::ExecMedia(SfxRequest const &rReq)
     SwWrtShell* pSh = &GetShell();
     SdrView*    pSdrView = pSh->GetDrawView();
 
-    if( pSdrView )
-    {
-        const SfxItemSet*   pArgs = rReq.GetArgs();
-        bool                bChanged = pSdrView->GetModel()->IsChanged();
+    if( !pSdrView )
+        return;
+
+    const SfxItemSet*   pArgs = rReq.GetArgs();
+    bool                bChanged = pSdrView->GetModel()->IsChanged();
 
-        pSdrView->GetModel()->SetChanged( false );
+    pSdrView->GetModel()->SetChanged( false );
 
-        switch( rReq.GetSlot() )
+    switch( rReq.GetSlot() )
+    {
+        case SID_DELETE:
         {
-            case SID_DELETE:
+            if( pSh->IsObjSelected() )
             {
-                if( pSh->IsObjSelected() )
-                {
-                    pSh->SetModified();
-                    pSh->DelSelectedObj();
+                pSh->SetModified();
+                pSh->DelSelectedObj();
 
-                    if( pSh->IsSelFrameMode() )
-                        pSh->LeaveSelFrameMode();
+                if( pSh->IsSelFrameMode() )
+                    pSh->LeaveSelFrameMode();
 
-                    GetView().AttrChangedNotify(nullptr);
-                }
+                GetView().AttrChangedNotify(nullptr);
             }
-            break;
+        }
+        break;
 
-            case SID_AVMEDIA_TOOLBOX:
+        case SID_AVMEDIA_TOOLBOX:
+        {
+            if( pSh->IsObjSelected() )
             {
-                if( pSh->IsObjSelected() )
-                {
-                    const SfxPoolItem*  pItem;
+                const SfxPoolItem*  pItem;
+
+                if( !pArgs || ( SfxItemState::SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) )
+                    pItem = nullptr;
 
-                    if( !pArgs || ( SfxItemState::SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) )
-                        pItem = nullptr;
+                if( pItem )
+                {
+                    std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( pSdrView->GetMarkedObjectList() ));
 
-                    if( pItem )
+                    if( 1 == pMarkList->GetMarkCount() )
                     {
-                        std::unique_ptr<SdrMarkList> pMarkList(new SdrMarkList( pSdrView->GetMarkedObjectList() ));
+                        SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
 
-                        if( 1 == pMarkList->GetMarkCount() )
+                        if( dynamic_cast< const SdrMediaObj *>( pObj ) )
                         {
-                            SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-
-                            if( dynamic_cast< const SdrMediaObj *>( pObj ) )
-                            {
-                                static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
-                                    static_cast< const ::avmedia::MediaItem& >( *pItem ) );
-                            }
+                            static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
+                                static_cast< const ::avmedia::MediaItem& >( *pItem ) );
                         }
                     }
                 }
             }
-            break;
-
-            default:
-            break;
         }
+        break;
 
-        if( pSdrView->GetModel()->IsChanged() )
-            GetShell().SetModified();
-        else if( bChanged )
-            pSdrView->GetModel()->SetChanged();
+        default:
+        break;
     }
+
+    if( pSdrView->GetModel()->IsChanged() )
+        GetShell().SetModified();
+    else if( bChanged )
+        pSdrView->GetModel()->SetChanged();
 }
 
 void SwMediaShell::GetMediaState(SfxItemSet &rSet)
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 6d4c784c40d5..cd38b92d1adf 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -1489,27 +1489,29 @@ void SwTableShell::ExecTableStyle(SfxRequest& rReq)
 {
     SwWrtShell &rSh = GetShell();
     const SfxItemSet *pArgs = rReq.GetArgs();
-    if(pArgs)
-        switch ( rReq.GetSlot() )
-        {
-            case SID_FRAME_LINESTYLE:
-            case SID_FRAME_LINECOLOR:
-                if ( rReq.GetSlot() == SID_FRAME_LINESTYLE )
-                {
-                    const SvxLineItem &rLineItem = pArgs->Get( SID_FRAME_LINESTYLE );
-                    const SvxBorderLine* pBorderLine = rLineItem.GetLine();
-                    rSh.SetTabLineStyle( nullptr, true, pBorderLine);
-                }
-                else
-                {
-                    const SvxColorItem &rNewColorItem = pArgs->Get( SID_FRAME_LINECOLOR );
-                    rSh.SetTabLineStyle( &rNewColorItem.GetValue() );
-                }
+    if(!pArgs)
+        return;
+
+    switch ( rReq.GetSlot() )
+    {
+        case SID_FRAME_LINESTYLE:
+        case SID_FRAME_LINECOLOR:
+            if ( rReq.GetSlot() == SID_FRAME_LINESTYLE )
+            {
+                const SvxLineItem &rLineItem = pArgs->Get( SID_FRAME_LINESTYLE );
+                const SvxBorderLine* pBorderLine = rLineItem.GetLine();
+                rSh.SetTabLineStyle( nullptr, true, pBorderLine);
+            }
+            else
+            {
+                const SvxColorItem &rNewColorItem = pArgs->Get( SID_FRAME_LINECOLOR );
+                rSh.SetTabLineStyle( &rNewColorItem.GetValue() );
+            }
 
-                rReq.Done();
+            rReq.Done();
 
-                break;
-        }
+            break;
+    }
 }
 
 void SwTableShell::GetLineStyleState(SfxItemSet &rSet)
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 9b7d3b10a4fd..f08c01f2c5fc 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -196,559 +196,559 @@ void SwTextShell::ExecField(SfxRequest &rReq)
         default:
             bMore = true;
     }
-    if(bMore)
+    if(!bMore)
+        return;
+
+    // Here come the slots with FieldMgr.
+    SwFieldMgr aFieldMgr(GetShellPtr());
+    switch(nSlot)
     {
-        // Here come the slots with FieldMgr.
-        SwFieldMgr aFieldMgr(GetShellPtr());
-        switch(nSlot)
+        case FN_INSERT_DBFIELD:
         {
-            case FN_INSERT_DBFIELD:
+            bool bRes = false;
+            if( pItem )
             {
-                bool bRes = false;
-                if( pItem )
+                sal_uInt32 nFormat = 0;
+                SwFieldTypesEnum nType = SwFieldTypesEnum::Date;
+                OUString aPar1 = static_cast<const SfxStringItem *>(pItem)->GetValue();
+                OUString aPar2;
+                sal_Int32 nCommand = 0;
+
+                if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
+                                                            false, &pItem ))
+                    nType = static_cast<SwFieldTypesEnum>(static_cast<const SfxUInt16Item *>(pItem)->GetValue());
+                aPar1 += OUStringChar(DB_DELIM);
+                if( SfxItemState::SET == pArgs->GetItemState(
+                                    FN_PARAM_1, false, &pItem ))
                 {
-                    sal_uInt32 nFormat = 0;
-                    SwFieldTypesEnum nType = SwFieldTypesEnum::Date;
-                    OUString aPar1 = static_cast<const SfxStringItem *>(pItem)->GetValue();
-                    OUString aPar2;
-                    sal_Int32 nCommand = 0;
-
-                    if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
-                                                                false, &pItem ))
-                        nType = static_cast<SwFieldTypesEnum>(static_cast<const SfxUInt16Item *>(pItem)->GetValue());
-                    aPar1 += OUStringChar(DB_DELIM);
-                    if( SfxItemState::SET == pArgs->GetItemState(
-                                        FN_PARAM_1, false, &pItem ))
-                    {
-                        aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
-                    }
-                    if( SfxItemState::SET == pArgs->GetItemState(
-                                        FN_PARAM_3, false, &pItem ))
-                        nCommand = static_cast<const SfxInt32Item*>(pItem)->GetValue();
-                    aPar1 += OUStringChar(DB_DELIM)
-                        + OUString::number(nCommand)
-                        + OUStringChar(DB_DELIM);
-                    if( SfxItemState::SET == pArgs->GetItemState(
-                                        FN_PARAM_2, false, &pItem ))
-                    {
-                        aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
-                    }
-                    if( SfxItemState::SET == pArgs->GetItemState(
-                                        FN_PARAM_FIELD_CONTENT, false, &pItem ))
-                        aPar2 = static_cast<const SfxStringItem *>(pItem)->GetValue();
-                    if( SfxItemState::SET == pArgs->GetItemState(
-                                        FN_PARAM_FIELD_FORMAT, false, &pItem ))
-                        nFormat = static_cast<const SfxUInt32Item *>(pItem)->GetValue();
-                    OSL_FAIL("Command is not yet used");
-                    SwInsertField_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), ' '/*separator*/ );
-                    bRes = aFieldMgr.InsertField(aData);
+                    aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
                 }
-                rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
-            }
-            break;
-            case FN_INSERT_FIELD_CTRL:
-            case FN_INSERT_FIELD:
-            {
-                bool bRes = false;
-                if( pItem && nSlot != FN_INSERT_FIELD_CTRL)
+                if( SfxItemState::SET == pArgs->GetItemState(
+                                    FN_PARAM_3, false, &pItem ))
+                    nCommand = static_cast<const SfxInt32Item*>(pItem)->GetValue();
+                aPar1 += OUStringChar(DB_DELIM)
+                    + OUString::number(nCommand)
+                    + OUStringChar(DB_DELIM);
+                if( SfxItemState::SET == pArgs->GetItemState(
+                                    FN_PARAM_2, false, &pItem ))
                 {
-                    sal_uInt32 nFormat = 0;
-                    SwFieldTypesEnum nType = SwFieldTypesEnum::Date;
-                    sal_uInt16 nSubType = 0;
-                    OUString aPar1 = static_cast<const SfxStringItem *>(pItem)->GetValue();
-                    OUString aPar2;
-                    sal_Unicode cSeparator = ' ';
-
-                    if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
-                                                                false, &pItem ))
-                        nType = static_cast<SwFieldTypesEnum>(static_cast<const SfxUInt16Item *>(pItem)->GetValue());
-                    if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_SUBTYPE,
-                                                                false, &pItem ))
-                        nSubType = static_cast<const SfxUInt16Item *>(pItem)->GetValue();
-                    if( SfxItemState::SET == pArgs->GetItemState(
-                                        FN_PARAM_FIELD_CONTENT, false, &pItem ))
-                        aPar2 = static_cast<const SfxStringItem *>(pItem)->GetValue();
-                    if( SfxItemState::SET == pArgs->GetItemState(
-                                        FN_PARAM_FIELD_FORMAT, false, &pItem ))
-                        nFormat = static_cast<const SfxUInt32Item *>(pItem)->GetValue();
-                    if( SfxItemState::SET == pArgs->GetItemState(
-                                        FN_PARAM_3, false, &pItem ))
-                    {
-                        OUString sTmp = static_cast<const SfxStringItem *>(pItem)->GetValue();
-                        if(!sTmp.isEmpty())
-                            cSeparator = sTmp[0];
-                    }
-                    SwInsertField_Data aData(nType, nSubType, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
-                    bRes = aFieldMgr.InsertField( aData );
+                    aPar1 += static_cast<const SfxStringItem *>(pItem)->GetValue();
                 }
-                else
-                {
-                    //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
-                    if(!GetView().GetViewFrame()->IsInModalMode())
-                    {
-                        SfxViewFrame* pVFrame = GetView().GetViewFrame();
-                        pVFrame->ToggleChildWindow(FN_INSERT_FIELD);
-                        bRes = pVFrame->GetChildWindow( nSlot ) != nullptr;
-                        Invalidate(rReq.GetSlot());
-                        Invalidate(FN_INSERT_FIELD_CTRL);
-                        rReq.Ignore();
-                    }
-                }
-                rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
+                if( SfxItemState::SET == pArgs->GetItemState(
+                                    FN_PARAM_FIELD_CONTENT, false, &pItem ))
+                    aPar2 = static_cast<const SfxStringItem *>(pItem)->GetValue();
+                if( SfxItemState::SET == pArgs->GetItemState(
+                                    FN_PARAM_FIELD_FORMAT, false, &pItem ))
+                    nFormat = static_cast<const SfxUInt32Item *>(pItem)->GetValue();
+                OSL_FAIL("Command is not yet used");
+                SwInsertField_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), ' '/*separator*/ );
+                bRes = aFieldMgr.InsertField(aData);
             }
-            break;
-
-            case FN_INSERT_REF_FIELD:
-            {
-                SfxViewFrame* pVFrame = GetView().GetViewFrame();
-                if (!pVFrame->HasChildWindow(FN_INSERT_FIELD))
-                    pVFrame->ToggleChildWindow(FN_INSERT_FIELD);    // Show dialog
-
-                // Switch Fielddlg at a new TabPage
-                sal_uInt16 nId = SwFieldDlgWrapper::GetChildWindowId();
-                SwFieldDlgWrapper *pWrp = static_cast<SwFieldDlgWrapper*>(pVFrame->GetChildWindow(nId));
-                if (pWrp)
-                    pWrp->ShowReferencePage();
-                rReq.Ignore();
-            }
-            break;
-            case FN_DELETE_COMMENT:
+            rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
+        }
+        break;
+        case FN_INSERT_FIELD_CTRL:
+        case FN_INSERT_FIELD:
+        {
+            bool bRes = false;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list