tdf#120703 PVS: Silence V522 warnings

V522 There might be dereferencing of a potential null pointer.

Change-Id: Ie4bc74a734a6d5a73838a27e0d80cc8e51595839
Reviewed-on: https://gerrit.libreoffice.org/70730
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/codemaker/source/codemaker/typemanager.cxx b/codemaker/source/codemaker/typemanager.cxx
index cf638f0..12a0049 100644
--- a/codemaker/source/codemaker/typemanager.cxx
+++ b/codemaker/source/codemaker/typemanager.cxx
@@ -220,8 +220,7 @@
            return s;
        case codemaker::UnoType::Sort::PolymorphicStructTemplate:
            if (args.size()
                != (dynamic_cast<
                    unoidl::PolymorphicStructTypeTemplateEntity * >(ent.get())->
                != (dynamic_cast<unoidl::PolymorphicStructTypeTemplateEntity&>(*ent).
                    getTypeParameters().size()))
            {
                throw CannotDumpException(
diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx
index 0bb433f..0a73dfd 100644
--- a/cui/source/tabpages/tppattern.cxx
+++ b/cui/source/tabpages/tppattern.cxx
@@ -392,7 +392,9 @@

            if(SfxItemState::SET == m_rOutAttrs.GetItemState(XATTR_FILLBITMAP, true, &pPoolItem))
            {
                pEntry.reset(new XBitmapEntry(dynamic_cast<const XFillBitmapItem*>(pPoolItem)->GetGraphicObject(), aName));
                auto pFillBmpItem = dynamic_cast<const XFillBitmapItem*>(pPoolItem);
                assert(pFillBmpItem);
                pEntry.reset(new XBitmapEntry(pFillBmpItem->GetGraphicObject(), aName));
            }
            else
                assert(!"SvxPatternTabPage::ClickAddHdl_Impl(), XBitmapEntry* pEntry == nullptr ?");
diff --git a/dbaccess/source/ext/macromigration/macromigrationpages.cxx b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
index d4b84e5..d2b19ed 100644
--- a/dbaccess/source/ext/macromigration/macromigrationpages.cxx
+++ b/dbaccess/source/ext/macromigration/macromigrationpages.cxx
@@ -41,7 +41,9 @@

    MacroMigrationDialog& MacroMigrationPage::getDialog()
    {
        return *dynamic_cast< MacroMigrationDialog* >( GetParentDialog() );
        auto pDialog = dynamic_cast<MacroMigrationDialog*>(GetParentDialog());
        assert(pDialog);
        return *pDialog;
    }

    // PreparationPage
diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index 3736561..17f516a 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -348,6 +348,7 @@
    if (pPreStoryID && !(pPreStoryID->IsNull()))
    {
        LwpStory* pPreStory = dynamic_cast<LwpStory*>(pPreStoryID->obj(VO_STORY).get());
        assert(pPreStory);
        return dynamic_cast<LwpPara*>(pPreStory->GetLastPara().obj(VO_PARA).get());
    }
    else
diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx
index ccb7307..de53625 100644
--- a/lotuswordpro/source/filter/lwpfribsection.cxx
+++ b/lotuswordpro/source/filter/lwpfribsection.cxx
@@ -132,8 +132,8 @@
 */
LwpPageLayout* LwpFribSection::GetPageLayout()
{
    if(GetSection())
        return GetSection()->GetPageLayout();
    if (LwpSection* pSection = GetSection())
        return pSection->GetPageLayout();
    return nullptr;
}

diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index a0a90a4..4140385 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -191,6 +191,7 @@
void LwpRowLayout::ConvertRow(rtl::Reference<XFTable> const & pXFTable,sal_uInt8 nStartCol,sal_uInt8 nEndCol)
{
    LwpTableLayout* pTableLayout = GetParentTableLayout();
    assert(pTableLayout);
    LwpTable* pTable = pTableLayout->GetTable();

    //calculate the connected cell position
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index f149901..48e4ee9 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -757,8 +757,8 @@

    // the old code doesn't check if the LwpFoundry pointer is NULL,
    // so the NULL pointer cause sodc freeze. Add code to check the pointer.
    if (GetFoundry() && GetTable())
        PutCellVals(GetFoundry(), GetTable()->GetObjectID());
    if (GetFoundry())
        PutCellVals(GetFoundry(), pTable->GetObjectID());
}
/**
 * @short   read table layout
@@ -847,7 +847,9 @@
        rtl::Reference<XFTable> const & pXFTable, sal_uInt16 nStartHeadRow, sal_uInt16 nEndHeadRow)
{
    sal_uInt16 nContentRow;
    sal_uInt8 nCol = static_cast<sal_uInt8>(GetTable()->GetColumn());
    LwpTable* pTable = GetTable();
    assert(pTable);
    sal_uInt8 nCol = static_cast<sal_uInt8>(pTable->GetColumn());
    rtl::Reference<XFTable> pTmpTable( new XFTable );

    ConvertTable(pTmpTable.get(),nStartHeadRow,nEndHeadRow,0,nCol);
@@ -888,7 +890,9 @@
{
    sal_uInt16 i;
    sal_uInt16 nRowNum = pTmpTable->GetRowCount();
    sal_uInt8 nCol = static_cast<sal_uInt8>(GetTable()->GetColumn());
    LwpTable* pTable = GetTable();
    assert(pTable);
    sal_uInt8 nCol = static_cast<sal_uInt8>(pTable->GetColumn());

    rtl::Reference<XFRow> xXFRow(new XFRow);

@@ -1360,8 +1364,10 @@
        rtl::Reference<XFCell> xCell;
        if (m_pDefaultCellLayout)
        {
            LwpTable* pTable = GetTable();
            assert(pTable);
            xCell = m_pDefaultCellLayout->DoConvertCell(
                GetTable()->GetObjectID(),nRowID,j+nStartCol);
                pTable->GetObjectID(),nRowID,j+nStartCol);
        }
        else
        {
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index 0f3de97..da61e81 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -418,7 +418,7 @@
            if ( pContainerModel->getControlType() == API_CONTROL_MULTIPAGE )
            {
                AxMultiPageModel* pMultiPage = dynamic_cast< AxMultiPageModel* >( pContainerModel );
                if ( pMultiPage )
                assert(pMultiPage);
                {
                    BinaryXInputStream aXStrm( rStrg.openInputStream( "x" ), true );
                    pMultiPage->importPageAndMultiPageProperties( aXStrm, maControls.size() );
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index f08d86b..90e8013 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -409,6 +409,7 @@
                    //set comment chars for last comment on slide
                    SlideFragmentHandler* comment_handler =
                        dynamic_cast<SlideFragmentHandler*>(xCommentsFragmentHandler.get());
                    assert(comment_handler);
                    // some comments have no text -> set empty string as text to avoid
                    // crash (back() on empty vector is undefined) and losing other
                    // comment data that might be there (author, position, timestamp etc.)
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index d4c8235..5e8e7e7 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -3470,6 +3470,7 @@
                    for(i = 0; i < SAL_N_ELEMENTS(pControl); ++i)
                    {
                        pObjs[i] = dynamic_cast<OUnoObject*>(pControl[i].get());
                        assert(pObjs[i]);
                        uno::Reference<beans::XPropertySet> xUnoProp(pObjs[i]->GetUnoControlModel(),uno::UNO_QUERY_THROW);
                        uno::Reference< report::XReportComponent> xShapeProp(pObjs[i]->getUnoShape(),uno::UNO_QUERY_THROW);
                        xUnoProp->setPropertyValue(PROPERTY_NAME,xShapeProp->getPropertyValue(PROPERTY_NAME));
@@ -3541,6 +3542,7 @@
                        xShapePropLabel->setPosition(aPosLabel);
                    }
                    OUnoObject* pObj = dynamic_cast<OUnoObject*>(pControl[0].get());
                    assert(pObj);
                    uno::Reference< report::XFixedText> xShapeProp(pObj->getUnoShape(),uno::UNO_QUERY_THROW);
                    xShapeProp->setName(xShapeProp->getName() + sDefaultName );

diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 09c7bbd..381c275 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1050,7 +1050,8 @@
                aNewViewOpt.SetGridOptions( aNewGridOpt );
                rViewData.SetOptions( aNewViewOpt );
                rViewData.GetDocument()->SetViewOptions( aNewViewOpt );
                pDocSh->SetDocumentModified();
                if (pDocSh)
                    pDocSh->SetDocumentModified();
                bRepaint = true;
            }
        }
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index f150035..747dbf4 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -1777,6 +1777,7 @@
    {
        uno::Reference<uno::XInterface>  xRanges( pThisRanges->queryFormulaCells( sheet::FormulaResult::ERROR | sheet::FormulaResult::VALUE | sheet::FormulaResult::STRING ), uno::UNO_QUERY_THROW );
        ScCellRangesBase* pFormulaRanges = dynamic_cast< ScCellRangesBase * > ( xRanges.get() );
        assert(pFormulaRanges);
        // check if there are no formula cell, return false
        if ( pFormulaRanges->GetRangeList().empty() )
            return uno::makeAny(false);
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 18bf732..0c40536f 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1727,6 +1727,7 @@
            if (pViewShell2 && pViewShell2 == this)
            {
                ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
                assert(pTabViewShell);
                ScInputHandler* pInputHdl = pTabViewShell->GetInputHandler();
                if (pInputHdl && pInputHdl->IsFormulaMode())
                {
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 2e09250..dec4fd7 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -111,23 +111,26 @@
    double rel_x = rElem.x, rel_y = rElem.y;

    // find anchor type by recursing though parents
    Element* pAnchor = rElem.Parent;
    while( pAnchor &&
           ! dynamic_cast<ParagraphElement*>(pAnchor) &&
           ! dynamic_cast<PageElement*>(pAnchor) )
    Element* pAnchor = &rElem;
    ParagraphElement* pParaElt = nullptr;
    PageElement* pPage = nullptr;
    while ((pAnchor = pAnchor->Parent))
    {
        pAnchor = pAnchor->Parent;
        if ((pParaElt = dynamic_cast<ParagraphElement*>(pAnchor)))
            break;
        if ((pPage = dynamic_cast<PageElement*>(pAnchor)))
            break;
    }
    if( pAnchor )
    {
        if( dynamic_cast<ParagraphElement*>(pAnchor) )
        if (pParaElt)
        {
            rProps[ "text:anchor-type" ] = rElem.isCharacter
                ? OUString("character") : OUString("paragraph");
        }
        else
        {
            PageElement* pPage = dynamic_cast<PageElement*>(pAnchor);
            assert(pPage); // guaranteed by the while loop above
            rProps[ "text:anchor-type" ] = "page";
            rProps[ "text:anchor-page-number" ] = OUString::number(pPage->PageNumber);
        }
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index bcd013d..772df95 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1570,7 +1570,7 @@
    if ( (nId == SID_STYLE_NEW || SID_STYLE_EDIT == nId) && (pTreeBox->IsVisible() || aFmtLb->GetSelectionCount() <= 1) )
    {
        const SfxUInt16Item *pFilterItem = dynamic_cast< const SfxUInt16Item* >(pItem);
        OSL_ENSURE(pFilterItem, "SfxUINT16Item expected");
        assert(pFilterItem);
        SfxStyleSearchBits nFilterFlags = static_cast<SfxStyleSearchBits>(pFilterItem->GetValue()) & ~SfxStyleSearchBits::UserDefined;
        if(nFilterFlags == SfxStyleSearchBits::Auto)       // User Template?
            nFilterFlags = static_cast<SfxStyleSearchBits>(pFilterItem->GetValue());
diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx
index 012bc5b..4570cec 100644
--- a/sfx2/source/doc/Metadatable.cxx
+++ b/sfx2/source/doc/Metadatable.cxx
@@ -1424,6 +1424,7 @@
        {
            XmlIdRegistryDocument * pRegDoc(
                dynamic_cast<XmlIdRegistryDocument*>( m_pReg ) );
            assert(pRegDoc);
            std::shared_ptr<MetadatableUndo> xUndo(
                sfx2::XmlIdRegistryDocument::CreateUndo(*this) );
            pRegDoc->RegisterCopy(*this, *xUndo, false);
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index d94e1a8..af2c127 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -793,11 +793,14 @@

        aEdit->GrabFocus();

        bool bInPlace = GetView()->GetViewFrame()->GetFrame().IsInPlace();
        SmViewShell* pView = GetView();
        assert(pView);
        bool bInPlace = pView->GetViewFrame()->GetFrame().IsInPlace();
        uno::Reference< frame::XFrame > xFrame( GetBindings().GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface());
        if ( bInPlace )
        {
            uno::Reference< container::XChild > xModel( GetView()->GetDoc()->GetModel(), uno::UNO_QUERY_THROW );
            uno::Reference<container::XChild> xModel(pView->GetDoc()->GetModel(),
                                                     uno::UNO_QUERY_THROW);
            uno::Reference< frame::XModel > xParent( xModel->getParent(), uno::UNO_QUERY_THROW );
            uno::Reference< frame::XController > xParentCtrler( xParent->getCurrentController() );
            uno::Reference< frame::XFramesSupplier > xParentFrame( xParentCtrler->getFrame(), uno::UNO_QUERY_THROW );
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 74fd2b1..693038a2 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -6411,8 +6411,9 @@
    // Save it as DOCX & load it again
    reload("Office Open XML Text", "mm-field.docx");

    CPPUNIT_ASSERT(mxComponent.get());
    pDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get())->GetDocShell()->GetDoc();
    auto pXTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get());
    CPPUNIT_ASSERT(pXTextDocument);
    pDoc = pXTextDocument->GetDocShell()->GetDoc();
    CPPUNIT_ASSERT(pDoc);
    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
    CPPUNIT_ASSERT(pWrtShell);
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index d2f792e..dc7ef13 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -328,8 +328,9 @@
                 pCNd && pCNd->IsTextNode() &&
                 GetItemState( RES_PARATR_LIST_ID, false, &pItem ) == SfxItemState::SET )
            {
                const OUString& sListId =
                        dynamic_cast<const SfxStringItem*>(pItem)->GetValue();
                auto pStrItem = dynamic_cast<const SfxStringItem*>(pItem);
                assert(pStrItem);
                const OUString& sListId = pStrItem->GetValue();
                if ( !sListId.isEmpty() &&
                     !pDstDoc->getIDocumentListsAccess().getListByName( sListId ) )
                {
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index d247485..3d87041 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1108,7 +1108,9 @@
        {
            // break the link of the corresponding section.
            // the link is also removed from the link manager
            pSectLnk->GetSectNode()->GetSection().BreakLink();
            SwSectionNode* pSectNode = pSectLnk->GetSectNode();
            assert(pSectNode);
            pSectNode->GetSection().BreakLink();

            // for robustness, because link is removed from the link manager
            if ( n > rLnks.size() )
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 63b8971..c044b49 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -4746,6 +4746,7 @@

            const SwNumRuleItem* pNumRuleItem =
                            dynamic_cast<const SwNumRuleItem*>(pItem);
            assert(pNumRuleItem);
            if ( !pNumRuleItem->GetValue().isEmpty() )
            {
                mbAddTextNodeToList = true;
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 7742dd6..cf6e4f8 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1065,8 +1065,12 @@
        if (! pListId2)
            return;

        const OUString& sListId1 = dynamic_cast<const SfxStringItem*>(pListId1)->GetValue();
        const OUString& sListId2 = dynamic_cast<const SfxStringItem*>(pListId2)->GetValue();
        auto pStringListId1 = dynamic_cast<const SfxStringItem*>(pListId1);
        assert(pStringListId1);
        const OUString& sListId1 = pStringListId1->GetValue();
        auto pStringListId2 = dynamic_cast<const SfxStringItem*>(pListId2);
        assert(pStringListId2);
        const OUString& sListId2 = pStringListId2->GetValue();

        const SwList* pList1 = pDoc->getIDocumentListsAccess().getListByName( sListId1 );
        const SwList* pList2 = pDoc->getIDocumentListsAccess().getListByName( sListId2 );
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index d96b18f..b361136 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -332,6 +332,7 @@
        case SID_SAVEDOC:
        {
            SwDocShell* pDocShell = GetDocShell();
            assert(pDocShell);
            SfxMedium* pMed = nullptr;
            if(pDocShell->HasName())
                pMed = pDocShell->GetMedium();
@@ -366,7 +367,11 @@
            SetSearchItem( static_cast<const SvxSearchItem&>(rItem));
            StartSearchAndReplace( static_cast<const SvxSearchItem&>(rItem), rReq.IsAPI() );
            if(aEditWin->IsModified())
                GetDocShell()->GetDoc()->getIDocumentState().SetModified();
            {
                SwDocShell* pDocShell = GetDocShell();
                assert(pDocShell);
                pDocShell->GetDoc()->getIDocumentState().SetModified();
            }
        }
        break;
        case FN_REPEAT_SEARCH:
@@ -433,6 +438,7 @@
            case SID_SAVEDOC:
            {
                SwDocShell* pDocShell = GetDocShell();
                assert(pDocShell);
                if(!pDocShell->IsModified())
                    rSet.DisableItem(nWhich);
            }
@@ -455,7 +461,9 @@
            case SID_SEARCH_OPTIONS:
            {
                SearchOptionFlags nOpt = SRC_SEARCHOPTIONS;
                if(GetDocShell()->IsReadOnly())
                SwDocShell* pDocShell = GetDocShell();
                assert(pDocShell);
                if (pDocShell->IsReadOnly())
                    nOpt &= ~SearchOptionFlags(SearchOptionFlags::REPLACE|SearchOptionFlags::REPLACE_ALL);

                rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS,  static_cast<sal_uInt16>(nOpt) ) );
@@ -646,6 +654,7 @@
sal_uInt16 SwSrcView::SetPrinter(SfxPrinter* pNew, SfxPrinterChangeFlags nDiffFlags )
{
    SwDocShell* pDocSh = GetDocShell();
    assert(pDocSh);
    if ( (SfxPrinterChangeFlags::JOBSETUP | SfxPrinterChangeFlags::PRINTER) & nDiffFlags )
    {
        pDocSh->GetDoc()->getIDocumentDeviceAccess().setPrinter( pNew, true, true );
@@ -666,7 +675,9 @@

SfxPrinter* SwSrcView::GetPrinter( bool bCreate )
{
    return  GetDocShell()->GetDoc()->getIDocumentDeviceAccess().getPrinter( bCreate );
    SwDocShell* pDocSh = GetDocShell();
    assert(pDocSh);
    return pDocSh->GetDoc()->getIDocumentDeviceAccess().getPrinter(bCreate);
}

sal_Int32 SwSrcView::PrintSource(
@@ -749,17 +760,17 @@

void SwSrcView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
    if ( rHint.GetId() == SfxHintId::ModeChanged ||
            (
             rHint.GetId() == SfxHintId::TitleChanged &&
             !GetDocShell()->IsReadOnly() && aEditWin->IsReadonly()
            )
       )
    if (rHint.GetId() == SfxHintId::ModeChanged || rHint.GetId() == SfxHintId::TitleChanged)
    {
        // Broadcast only comes once!
        const SwDocShell* pDocSh = GetDocShell();
        const bool bReadonly = pDocSh->IsReadOnly();
        aEditWin->SetReadonly(bReadonly);
        assert(pDocSh);
        if (!(rHint.GetId() == SfxHintId::TitleChanged
              && (pDocSh->IsReadOnly() || !aEditWin->IsReadonly())))
        {
            // Broadcast only comes once!
            const bool bReadonly = pDocSh->IsReadOnly();
            aEditWin->SetReadonly(bReadonly);
        }
    }
    SfxViewShell::Notify(rBC, rHint);
}
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 4a1c0b9..4a5dcee 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3808,18 +3808,21 @@
            LanguageType nLang = LANGUAGE_DONTKNOW;
            if (bLatin)
            {
                assert(pSet);
                nLang = dynamic_cast< const SvxLanguageItem & >(pSet->Get( RES_CHRATR_LANGUAGE, false )).GetLanguage();
                if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
                    aAllLangs.insert( nLang );
            }
            if (bAsian)
            {
                assert(pSet);
                nLang = dynamic_cast< const SvxLanguageItem & >(pSet->Get( RES_CHRATR_CJK_LANGUAGE, false )).GetLanguage();
                if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
                    aAllLangs.insert( nLang );
            }
            if (bComplex)
            {
                assert(pSet);
                nLang = dynamic_cast< const SvxLanguageItem & >(pSet->Get( RES_CHRATR_CTL_LANGUAGE, false )).GetLanguage();
                if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
                    aAllLangs.insert( nLang );
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index b950cef..ae28379 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -530,6 +530,7 @@

    // Make sure it's re-compressed.
    auto pLength = dynamic_cast<vcl::filter::PDFNumberElement*>(pXObject->Lookup("Length"));
    CPPUNIT_ASSERT(pLength);
    int nLength = pLength->GetValue();
    // This failed: cropped TIFF-in-JPEG wasn't re-compressed, so crop was
    // lost. Size was 59416, now is 11827.
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 373acab..a86a155 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -744,6 +744,7 @@
            if( meOutDevType == OUTDEV_PRINTER )
            {
                Printer* pThis = dynamic_cast<Printer*>(this);
                assert(pThis);
                Point aPageOffset = pThis->GetPageOffsetPixel();
                aPageOffset = Point( 0, 0 ) - aPageOffset;
                Size aSize  = pThis->GetPaperSizePixel();
@@ -1107,6 +1108,7 @@
        else if( meOutDevType == OUTDEV_PRINTER )
        {
            Printer* pThis = dynamic_cast<Printer*>(this);
            assert(pThis);
            aPageOffset = pThis->GetPageOffsetPixel();
            aPageOffset = Point( 0, 0 ) - aPageOffset;
            aTmpSize  = pThis->GetPaperSizePixel();
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx
index 51d755b..9e99cd8 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -660,6 +660,7 @@
                        if ( pAction->GetType() == MetaActionType::BMPSCALE )
                        {
                            MetaBmpScaleAction* pScaleAction = dynamic_cast< MetaBmpScaleAction* >( pAction );
                            assert(pScaleAction);
                            aBmpEx = pScaleAction->GetBitmap();
                            aPos = pScaleAction->GetPoint();
                            aSize = pScaleAction->GetSize();
@@ -667,6 +668,7 @@
                        else
                        {
                            MetaBmpExScaleAction* pScaleAction = dynamic_cast< MetaBmpExScaleAction* >( pAction );
                            assert(pScaleAction);
                            aBmpEx = pScaleAction->GetBitmapEx();
                            aPos = pScaleAction->GetPoint();
                            aSize = pScaleAction->GetSize();
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 4a0fe21..b9e4f26 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -2177,9 +2177,13 @@

        // get some other guys to leach off this context
        VclPtrInstance<VirtualDevice> xVDev;
        rtl::Reference<OpenGLContext> pContext = getImpl(xVDev)->GetOpenGLContext();
        OpenGLSalGraphicsImpl* pImpl = getImpl(xVDev);
        assert(pImpl);
        rtl::Reference<OpenGLContext> pContext = pImpl->GetOpenGLContext();
        VclPtrInstance<VirtualDevice> xVDev2;
        rtl::Reference<OpenGLContext> pContext2 = getImpl(xVDev)->GetOpenGLContext();
        OpenGLSalGraphicsImpl* pImpl2 = getImpl(xVDev2);
        assert(pImpl2);
        rtl::Reference<OpenGLContext> pContext2 = pImpl2->GetOpenGLContext();

        // sharing the same off-screen context.
        assert(pContext == pContext2);
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 29fd6f3..9f67a82 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -605,8 +605,6 @@

        do
        {
            XMLPropStyleContext* pDocStyle = nullptr;

            // set style on shape
            if(maDrawStyleName.isEmpty())
                break;
@@ -626,10 +624,10 @@
            OUString aStyleName = maDrawStyleName;
            uno::Reference< style::XStyle > xStyle;

            if( dynamic_cast<const XMLShapeStyleContext*>( pStyle ) )
            XMLPropStyleContext* pDocStyle
                = dynamic_cast<XMLShapeStyleContext*>(const_cast<SvXMLStyleContext*>(pStyle));
            if (pDocStyle)
            {
                pDocStyle = const_cast<XMLShapeStyleContext*>(dynamic_cast<const XMLShapeStyleContext*>( pStyle ) );

                if( pDocStyle->GetStyle().is() )
                {
                    xStyle = pDocStyle->GetStyle();