office-gobmx/slideshow
Stephan Bergmann 160689897c New loplugin:crosscast
...inspired by 2fa426da15 "Fix dynamic_cast after
splitting OutputDevice and vcl::Window class hierarchies":

"Find uses of dynamic_cast that cast between unrelated classes, which is
suspicious and might indicate a bug.  The heuristic used to consider two classes
unrelated is that neither derives from the other (directly or indirectly) and
they do not both virtually derive (directly or indirectly) from a common third
class.  Additionally, class definitions can be attributed with
SAL_LOPLUGIN_ANNOTATE("crosscast") (from sal/types.h) to suppress false warnings
about known-good cases casting from or to such a class."
(quoting compilerplugins/clang/crosscast.cxx)

This found two additional errors, 7a82ea5c79 "Fix
presumed typo" and fc6aa9e499 "fix assert", and
one still-open case that looks like an error, see the TODO comment in
sw/source/core/unocore/unodraw.cxx.

In addition to that it flagged another 102 uses of dynamic_cast as suspicious,
which have all been addressed, at least for now, by marking certain classes as
SAL_LOPLUGIN_ANNOTATE("crosscast"), see below.  (Where this commit also adds
that generic SAL_LOPLUGIN_ANNOTATE mechanism to include/sal/types.h.)  However,
some of those annotations might benefit from further inspection and clean up
similar to recent 8858962ec0 "Introduce
ParagraphProeprtiesPropertyMap", 8467aa93e2
"Replace a dynamic_cast with UNO_QUERY",
a534361141 "Fold OldBasicPassword into
basic::SfxScriptLibraryContainer", and 589e03fb4c
"[PATCH] Replace some dynamic_cast with UNO_QUERY".

* canvas/source/cairo/cairo_repainttarget.hxx RepaintTarget:
> canvas/source/cairo/cairo_cachedbitmap.cxx:62:34: error: suspicious dynamic cross cast from 'com::sun::rendering::XCanvas *' to 'RepaintTarget *' [loplugin:crosscast]
>         RepaintTarget* pTarget = dynamic_cast< RepaintTarget* >(rTargetCanvas.get());
* canvas/source/cairo/cairo_surfaceprovider.hxx SurfaceProvider:
> canvas/source/cairo/cairo_canvashelper.cxx:301:45: error: suspicious dynamic cross cast from 'com::sun::rendering::XBitmap *' to 'SurfaceProvider *' [loplugin:crosscast]
>         SurfaceProvider* pSurfaceProvider = dynamic_cast<SurfaceProvider*>( xBitmap.get() );
* canvas/source/vcl/repainttarget.hxx RepaintTarget:
> canvas/source/vcl/cachedbitmap.cxx:73:34: error: suspicious dynamic cross cast from 'com::sun::rendering::XCanvas *' to 'RepaintTarget *' [loplugin:crosscast]
>         RepaintTarget* pTarget = dynamic_cast< RepaintTarget* >(rTargetCanvas.get());
* chart2/inc/ChartModel.hxx ChartModel:
> chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx:82:31: error: suspicious dynamic cross cast from 'com::sun::awt::XWindow *' to 'ChartModel *' [loplugin:crosscast]
>     ChartModel* pChartModel = dynamic_cast<ChartModel*>(rParent.get());
* chart2/source/controller/inc/TabPageNotifiable.hxx TabPageNotifiable:
> chart2/source/controller/dialogs/tp_RangeChooser.cxx:70:28: error: suspicious dynamic cross cast from 'weld::DialogController *' to 'TabPageNotifiable *' [loplugin:crosscast]
>     , m_pTabPageNotifiable(dynamic_cast<TabPageNotifiable*>(pController))
> chart2/source/controller/dialogs/tp_DataSource.cxx:171:28: error: suspicious dynamic cross cast from 'weld::DialogController *' to 'TabPageNotifiable *' [loplugin:crosscast]
>     , m_pTabPageNotifiable(dynamic_cast<TabPageNotifiable*>(pController))
* include/drawinglayer/primitive2d/svggradientprimitive2d.hxx SvgGradientHelper:
> drawinglayer/source/primitive2d/svggradientprimitive2d.cxx:582:59: error: suspicious dynamic cross cast from 'const BasePrimitive2D *' to 'const SvgGradientHelper *' [loplugin:crosscast]
>             const SvgGradientHelper* pSvgGradientHelper = dynamic_cast< const SvgGradientHelper* >(&rPrimitive);
> drawinglayer/source/primitive2d/svggradientprimitive2d.cxx:819:59: error: suspicious dynamic cross cast from 'const BasePrimitive2D *' to 'const SvgGradientHelper *' [loplugin:crosscast]
>             const SvgGradientHelper* pSvgGradientHelper = dynamic_cast< const SvgGradientHelper* >(&rPrimitive);
* include/editeng/unotext.hxx SvxUnoTextRangeBase:
> writerfilter/source/dmapper/DomainMapper_Impl.cxx:7645:62: error: suspicious dynamic cross cast from 'com::sun::text::XTextCursor *' to 'SvxUnoTextRangeBase *' [loplugin:crosscast]
>                             SvxUnoTextRangeBase* pDrawText = dynamic_cast<SvxUnoTextRangeBase*>(xCrsr.get());
* include/embeddedobj/embeddedupdate.hxx EmbeddedUpdate:
> svtools/source/misc/embedhlp.cxx:932:35: error: suspicious dynamic cross cast from 'com::sun::embed::XEmbeddedObject *' to 'embed::EmbeddedUpdate *' [loplugin:crosscast]
>     embed::EmbeddedUpdate* pObj = dynamic_cast<embed::EmbeddedUpdate*> (GetObject().get());
* include/oox/core/contexthandler2.hxx ContextHandler2Helper:
> oox/source/core/contexthandler2.cxx:183:21: error: suspicious dynamic cross cast from 'const ContextHandler2Helper' to 'const ContextHandler &' [loplugin:crosscast]
>     ContextHandler( dynamic_cast< ContextHandler const & >( rParent ) ),
* include/oox/mathml/export.hxx FormulaExportBase:
> oox/source/export/shapes.cxx:2475:42: error: suspicious dynamic cross cast from 'com::sun::frame::XModel *' to 'oox::FormulaExportBase *' [loplugin:crosscast]
>     oox::FormulaExportBase *const pMagic(dynamic_cast<oox::FormulaExportBase*>(xMathModel.get()));
* include/oox/mathml/import.hxx FormulaImportBase:
> oox/source/drawingml/shape.cxx:1298:25: error: suspicious dynamic cross cast from 'com::sun::uno::XInterface *' to 'oox::FormulaImportBase *' [loplugin:crosscast]
>                         dynamic_cast<oox::FormulaImportBase*>(xMathModel.get()));
> writerfilter/source/ooxml/OOXMLFastContextHandler.cxx:2287:38: error: suspicious dynamic cross cast from 'SfxBaseModel' to 'oox::FormulaImportBase &' [loplugin:crosscast]
>     oox::FormulaImportBase& import = dynamic_cast<oox::FormulaImportBase&>(dynamic_cast<SfxBaseModel&>(*component));
> writerfilter/source/rtftok/rtfdocumentimpl.cxx:2973:33: error: suspicious dynamic cross cast from 'SfxBaseModel' to 'oox::FormulaImportBase &' [loplugin:crosscast]
>                 auto& rImport = dynamic_cast<oox::FormulaImportBase&>(
> writerfilter/source/dmapper/DomainMapper_Impl.cxx:3000:53: error: suspicious dynamic cross cast from 'com::sun::uno::XInterface *' to 'oox::FormulaImportBase *' [loplugin:crosscast]
>         if( oox::FormulaImportBase* formulaimport = dynamic_cast< oox::FormulaImportBase* >( xInterface.get()))
* include/sfx2/Metadatable.hxx Metadatable:
> sw/source/core/doc/docbm.cxx:1837:17: error: suspicious dynamic cross cast from 'const IBookmark *const' to 'const ::sfx2::Metadatable *' [loplugin:crosscast]
>                 dynamic_cast< ::sfx2::Metadatable const* >(pBookmark));
> sw/source/core/doc/docbm.cxx:1924:13: error: suspicious dynamic cross cast from '::sw::mark::IBookmark *const' to '::sfx2::Metadatable *' [loplugin:crosscast]
>             dynamic_cast< ::sfx2::Metadatable* >(pBookmark));
> sw/source/core/doc/DocumentContentOperationsManager.cxx:342:21: error: suspicious dynamic cross cast from 'const sw::mark::IMark *const' to 'const ::sfx2::Metadatable *' [loplugin:crosscast]
>                     dynamic_cast< ::sfx2::Metadatable const* >(pMark));
> sw/source/core/doc/DocumentContentOperationsManager.cxx:344:21: error: suspicious dynamic cross cast from '::sw::mark::IMark *const' to '::sfx2::Metadatable *' [loplugin:crosscast]
>                     dynamic_cast< ::sfx2::Metadatable      * >(pNewMark));
> sw/source/core/unocore/unobkm.cxx:381:12: error: suspicious dynamic cross cast from '::sw::mark::IMark *' to '::sfx2::Metadatable *' [loplugin:crosscast]
>     return dynamic_cast< ::sfx2::Metadatable* >(m_pImpl->m_pRegisteredBookmark);
> sw/source/core/undo/rolbck.cxx:635:13: error: suspicious dynamic cross cast from 'const ::sw::mark::IBookmark *const' to 'const ::sfx2::Metadatable *' [loplugin:crosscast]
>             dynamic_cast< ::sfx2::Metadatable const* >(pBookmark));
> sw/source/core/undo/rolbck.cxx:713:13: error: suspicious dynamic cross cast from '::sw::mark::IBookmark *const' to '::sfx2::Metadatable *' [loplugin:crosscast]
>             dynamic_cast< ::sfx2::Metadatable* >(pBookmark));
* include/sfx2/digitalsignatures.hxx DigitalSignatures:
> sfx2/source/doc/docfile.cxx:3999:25: error: suspicious dynamic cross cast from 'com::sun::security::XDocumentDigitalSignatures *' to 'sfx2::DigitalSignatures *' [loplugin:crosscast]
>     auto xModelSigner = dynamic_cast<sfx2::DigitalSignatures*>(xSigner.get());
* include/sfx2/sidebar/IContextChangeReceiver.hxx IContextChangeReceiver:
> sfx2/source/sidebar/SidebarPanelBase.cxx:105:11: error: suspicious dynamic cross cast from 'pointer' (aka 'PanelLayout *') to 'IContextChangeReceiver *' [loplugin:crosscast]
>         = dynamic_cast<IContextChangeReceiver*>(mxControl.get());
* include/sfx2/sidebar/ILayoutableWindow.hxx ILayoutableWindow:
> sfx2/source/sidebar/SidebarPanelBase.cxx:164:44: error: suspicious dynamic cross cast from 'pointer' (aka 'PanelLayout *') to 'ILayoutableWindow *' [loplugin:crosscast]
>     ILayoutableWindow* pLayoutableWindow = dynamic_cast<ILayoutableWindow*>(mxControl.get());
* include/sfx2/sidebar/SidebarModelUpdate.hxx SidebarModelUpdate:
> sfx2/source/sidebar/SidebarPanelBase.cxx:189:40: error: suspicious dynamic cross cast from 'pointer' (aka 'PanelLayout *') to 'SidebarModelUpdate *' [loplugin:crosscast]
>     SidebarModelUpdate* pModelUpdate = dynamic_cast<SidebarModelUpdate*>(mxControl.get());
* include/sfx2/xmldump.hxx XmlDump:
> svtools/source/misc/embedhlp.cxx:290:27: error: suspicious dynamic cross cast from 'com::sun::util::XCloseable *' to 'sfx2::XmlDump *' [loplugin:crosscast]
>         auto pComponent = dynamic_cast<sfx2::XmlDump*>(mxObj->getComponent().get());
* include/svl/stylesheetuser.hxx StyleSheetUser:
> sd/source/core/stlsheet.cxx:294:48: error: suspicious dynamic cross cast from 'SfxListener *' to 'svl::StyleSheetUser *' [loplugin:crosscast]
>         const svl::StyleSheetUser* const pUser(dynamic_cast<svl::StyleSheetUser*>(pListener));
* include/svl/undo.hxx SfxRepeatTarget:
> starmath/source/action.cxx:45:5: error: suspicious dynamic cross cast from 'SfxRepeatTarget' to 'SmDocShell &' [loplugin:crosscast]
>     dynamic_cast< SmDocShell & >(rDocSh).SetFormat(aNewFormat);
* include/svx/ipolypolygoneditorcontroller.hxx IPolyPolygonEditorController:
> sd/source/ui/view/drbezob.cxx:127:22: error: suspicious dynamic cross cast from 'sd::SmartTag *' to 'IPolyPolygonEditorController *' [loplugin:crosscast]
>             pIPPEC = dynamic_cast< IPolyPolygonEditorController* >( mpView->getSmartTags().getSelected().get() );
> sd/source/ui/view/drbezob.cxx:216:26: error: suspicious dynamic cross cast from 'sd::SmartTag *' to 'IPolyPolygonEditorController *' [loplugin:crosscast]
>                 pIPPEC = dynamic_cast< IPolyPolygonEditorController* >( mpView->getSmartTags().getSelected().get() );
* include/vcl/IContext.hxx IContext:
> vcl/source/window/builder.cxx:3650:54: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IContext *' [loplugin:crosscast]
>                     vcl::IContext* pContextControl = dynamic_cast<vcl::IContext*>(pCurrentChild.get());
* include/vcl/ITiledRenderable.hxx ITiledRenderable:
> In file included from test/source/a11y/swaccessibletestbase.cxx:10:
> In file included from include/test/a11y/swaccessibletestbase.hxx:22:
> include/test/a11y/accessibletestbase.hxx:54:15: error: suspicious dynamic cross cast from 'com::sun::lang::XComponent *' to 'vcl::ITiledRenderable *' [loplugin:crosscast]
>             = dynamic_cast<vcl::ITiledRenderable*>(mxDocument.get());
* include/vcl/NotebookbarContextControl.hxx NotebookbarContextControl:
> vcl/source/control/notebookbar.cxx:113:33: error: suspicious dynamic cross cast from 'vcl::Window *' to 'NotebookbarContextControl *' [loplugin:crosscast]
>             pContextContainer = dynamic_cast<NotebookbarContextControl*>(m_pUIBuilder->get<Window>(OUStringToOString(aName, RTL_TEXTENCODING_UTF8)));
* include/vcl/gdimetafiletools.hxx MetafileAccessor:
> vcl/source/gdi/impgraph.cxx:716:61: error: suspicious dynamic cross cast from 'drawinglayer::primitive2d::BasePrimitive2D *' to 'const MetafileAccessor *' [loplugin:crosscast]
>                 const MetafileAccessor* pMetafileAccessor = dynamic_cast< const MetafileAccessor* >(pUnoPrimitive->getBasePrimitive2D().get());
* include/vcl/syswin.hxx VclBuilderContainer:
> vcl/source/app/salvtables.cxx:7465:11: error: suspicious dynamic cross cast from 'vcl::Window *' to 'VclBuilderContainer *' [loplugin:crosscast]
>         = dynamic_cast<VclBuilderContainer*>(m_aOwnedToplevel.get()))
* include/vcl/toolkit/field.hxx NumericFormatter:
> vcl/source/window/builder.cxx:583:37: error: suspicious dynamic cross cast from 'vcl::Window *' to 'NumericFormatter *' [loplugin:crosscast]
>         NumericFormatter *pTarget = dynamic_cast<NumericFormatter*>(get(elem.m_sID));
* include/vcl/transfer.hxx DragSourceHelper:
> svx/source/sdr/contact/sdrmediawindow.cxx:163:47: error: suspicious dynamic cross cast from 'vcl::Window *' to 'DragSourceHelper *' [loplugin:crosscast]
>         DragSourceHelper* pDragSourceHelper = dynamic_cast< DragSourceHelper* >( pWindow );
* include/vcl/transfer.hxx DropTargetHelper:
> svx/source/sdr/contact/sdrmediawindow.cxx:126:47: error: suspicious dynamic cross cast from 'vcl::Window *' to 'DropTargetHelper *' [loplugin:crosscast]
>         DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow );
> svx/source/sdr/contact/sdrmediawindow.cxx:145:47: error: suspicious dynamic cross cast from 'vcl::Window *' to 'DropTargetHelper *' [loplugin:crosscast]
>         DropTargetHelper* pDropTargetHelper = dynamic_cast< DropTargetHelper* >( pWindow );
* include/vcl/wizardmachine.hxx IWizardPageController:
> vcl/source/control/wizardmachine.cxx:1274:46: error: suspicious dynamic cross cast from 'BuilderPage *' to 'IWizardPageController *' [loplugin:crosscast]
>         IWizardPageController* pController = dynamic_cast<IWizardPageController*>(pCurrentPage);
* include/xmloff/settingsstore.hxx DocumentSettingsSerializer:
> xmloff/source/draw/sdxmlimp.cxx:540:15: error: suspicious dynamic cross cast from 'com::sun:🫘:XPropertySet *' to 'DocumentSettingsSerializer *' [loplugin:crosscast]
>     pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
> xmloff/source/draw/sdxmlexp.cxx:2474:41: error: suspicious dynamic cross cast from 'com::sun:🫘:XPropertySet *' to 'DocumentSettingsSerializer *' [loplugin:crosscast]
>     DocumentSettingsSerializer *pFilter(dynamic_cast<DocumentSettingsSerializer *>(xProps.get()));
* include/xmloff/xmlimp.hxx SvXMLImport:
> sdext/source/pdfimport/sax/emitcontext.cxx:45:37: error: suspicious dynamic cross cast from 'com::sun::xml::sax::XDocumentHandler *' to 'SvXMLImport *' [loplugin:crosscast]
>     if (SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>(m_xDocHdl.get()))
> writerperfect/source/common/DocumentHandler.cxx:118:37: error: suspicious dynamic cross cast from 'com::sun::xml::sax::XDocumentHandler *' to 'SvXMLImport *' [loplugin:crosscast]
>     if (SvXMLImport* pFastHandler = dynamic_cast<SvXMLImport*>(mxHandler.get()))
* reportdesign/inc/RptObject.hxx OObjectBase:
> reportdesign/source/ui/report/ViewsWindow.cxx:843:53: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>                             OObjectBase* pObjBase = dynamic_cast<OObjectBase*>(pObj);
> reportdesign/source/core/sdr/ReportUndoFactory.cxx:30:25: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>     OObjectBase* pObj = dynamic_cast<OObjectBase*>(&rObject);
> reportdesign/source/core/sdr/RptPage.cxx:62:29: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>         OObjectBase* pObj = dynamic_cast<OObjectBase*>(GetObj(i));
> reportdesign/source/core/sdr/RptPage.cxx:77:30: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>         OObjectBase* pBase = dynamic_cast<OObjectBase*>(GetObj(nPos));
> reportdesign/source/core/sdr/RptPage.cxx:116:28: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>     OObjectBase* pObject = dynamic_cast< OObjectBase* >(SdrObject::getSdrObjectFromXShape( _xObject ));
> reportdesign/source/core/sdr/RptPage.cxx:184:32: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>     OObjectBase* pObjectBase = dynamic_cast< OObjectBase* >( pObj );
> reportdesign/source/core/sdr/ReportDrawPage.cxx:60:29: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>     OObjectBase* pBaseObj = dynamic_cast<OObjectBase*>(pObj);
> reportdesign/source/ui/report/dlgedfunc.cxx:455:25: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>     OObjectBase* pObj = dynamic_cast<OObjectBase*>(_pOverlappedObj);
> reportdesign/source/ui/report/SectionView.cxx:177:37: error: suspicious dynamic cross cast from 'SdrObject' to 'OObjectBase &' [loplugin:crosscast]
>             OObjectBase& rBaseObj = dynamic_cast<OObjectBase&>(*pObj);
> reportdesign/source/ui/report/ReportSection.cxx:338:29: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>         OObjectBase* pObj = dynamic_cast<OObjectBase*>(pSdrObject);
> reportdesign/source/ui/report/ReportSection.cxx:513:38: error: suspicious dynamic cross cast from 'SdrObject' to 'OObjectBase &' [loplugin:crosscast]
>                 OObjectBase& rBase = dynamic_cast<OObjectBase&>(*pObject);
> reportdesign/source/ui/report/ReportSection.cxx:644:33: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>             OObjectBase* pObj = dynamic_cast<OObjectBase*>(pDlgEdObj);
> reportdesign/source/ui/report/ReportSection.cxx:663:35: error: suspicious dynamic cross cast from 'const SdrObject *' to 'const OObjectBase *' [loplugin:crosscast]
>         const OObjectBase* pObj = dynamic_cast<const OObjectBase*>(pDlgEdObj);
> reportdesign/source/ui/report/propbrw.cxx:286:33: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>             OObjectBase* pObj = dynamic_cast<OObjectBase*>(pCurrent);
> reportdesign/source/ui/report/ViewsWindow.cxx:843:53: error: suspicious dynamic cross cast from 'SdrObject *' to 'OObjectBase *' [loplugin:crosscast]
>                             OObjectBase* pObjBase = dynamic_cast<OObjectBase*>(pObj);
* sc/source/ui/inc/IAnyRefDialog.hxx IAnyRefDialog:
> sc/source/ui/app/scmod.cxx:1607:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast]
>                 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
> sc/source/ui/app/scmod.cxx:1646:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast]
>                 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
> sc/source/ui/app/scmod.cxx:1697:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast]
>                 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
> sc/source/ui/app/scmod.cxx:1766:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast]
>                 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
> sc/source/ui/app/scmod.cxx:1813:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast]
>                 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
> sc/source/ui/app/scmod.cxx:1853:38: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast]
>             IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
> sc/source/ui/view/tabview3.cxx:470:30: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast]
>     IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(xDlgController.get());
> sc/source/ui/view/tabview3.cxx:2053:42: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast]
>                 IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pChildWnd->GetController().get());
> sc/source/ui/view/tabvwsh4.cxx:210:46: error: suspicious dynamic cross cast from 'element_type *' (aka 'SfxDialogController *') to 'IAnyRefDialog *' [loplugin:crosscast]
>                     IAnyRefDialog* pRefDlg = dynamic_cast<IAnyRefDialog*>(pController.get());
* sd/source/filter/eppt/epptbase.hxx PPTExBulletProvider:
> sd/source/filter/eppt/pptx-epptbase.cxx:497:74: error: suspicious dynamic cross cast from 'PPTWriterBase *' to 'PPTExBulletProvider *' [loplugin:crosscast]
>         maStyleSheetList.emplace_back( new PPTExStyleSheet( nDefaultTab, dynamic_cast<PPTExBulletProvider*>(this) ) );
* sdext/source/presenter/PresenterViewFactory.hxx CachablePresenterView:
> sdext/source/presenter/PresenterViewFactory.cxx:218:36: error: suspicious dynamic cross cast from 'com::sun::drawing::framework::XResource *' to 'CachablePresenterView *' [loplugin:crosscast]
>     CachablePresenterView* pView = dynamic_cast<CachablePresenterView*>(rxView.get());
> sdext/source/presenter/PresenterViewFactory.cxx:274:23: error: suspicious dynamic cross cast from 'com::sun::drawing::framework::XView *' to 'CachablePresenterView *' [loplugin:crosscast]
>                     = dynamic_cast<CachablePresenterView*>(iView->second.first.get());
> sdext/source/presenter/PresenterViewFactory.cxx:325:40: error: suspicious dynamic cross cast from 'com::sun::drawing::framework::XView *' to 'CachablePresenterView *' [loplugin:crosscast]
>         CachablePresenterView* pView = dynamic_cast<CachablePresenterView*>(xView.get());
* slideshow/source/inc/cursormanager.hxx CursorManager:
> slideshow/source/engine/slide/userpaintoverlay.cxx:449:49: error: suspicious dynamic cross cast from 'CursorManager' to 'Slide &' [loplugin:crosscast]
>                                                 dynamic_cast<Slide&>(rContext.mrCursorManager),
* svx/source/inc/celltypes.hxx TableDesignUser:
> svx/source/table/tabledesign.cxx:267:38: error: suspicious dynamic cross cast from 'com::sun::util::XModifyListener *' to 'TableDesignUser *' [loplugin:crosscast]
>             TableDesignUser* pUser = dynamic_cast< TableDesignUser* >( it.next().get() );
* svx/source/inc/tablemodel.hxx ICellRange:
> svx/source/table/tablemodel.cxx:285:26: error: suspicious dynamic cross cast from 'com::sun::table::XCellRange *' to 'ICellRange *' [loplugin:crosscast]
>     ICellRange* pRange = dynamic_cast< ICellRange* >( rRange.get() );
* sw/inc/IDocumentUndoRedo.hxx IDocumentUndoRedo:
> sw/source/uibase/shells/drwtxtsh.cxx:585:38: error: suspicious dynamic cross cast from 'SfxUndoManager *' to 'IDocumentUndoRedo *' [loplugin:crosscast]
>                 auto* pUndoManager = dynamic_cast<IDocumentUndoRedo*>(GetUndoManager());
* sw/inc/IMark.hxx IFieldmark:
> sw/source/core/doc/docbm.cxx:1415:15: error: suspicious dynamic cross cast from 'sw::mark::MarkBase *const' to 'IFieldmark *' [loplugin:crosscast]
>             : dynamic_cast<IFieldmark*>(*pFieldmark);
> sw/source/core/doc/docbm.cxx:1437:16: error: suspicious dynamic cross cast from 'sw::mark::MarkBase *' to 'IFieldmark *' [loplugin:crosscast]
>         return dynamic_cast<IFieldmark*>(pFieldmark);
> sw/source/core/doc/docbm.cxx:1570:37: error: suspicious dynamic cross cast from 'sw::mark::MarkBase *' to 'IFieldmark *' [loplugin:crosscast]
>                 IFieldmark *pMark = dynamic_cast<IFieldmark*>(*aIter);
* sw/inc/calbck.hxx BroadcastingModify:
> sw/source/core/attr/swatrset.cxx:228:29: error: suspicious dynamic cross cast from 'const sw::BroadcastingModify *' to 'const sw::FormatDropDefiner *' [loplugin:crosscast]
>         auto pDropDefiner = dynamic_cast<const sw::FormatDropDefiner*>(pModify);
> sw/source/core/txtnode/OnlineAccessibilityCheck.cxx:38:28: error: suspicious dynamic cross cast from 'SwNode *' to 'sw::BroadcastingModify *' [loplugin:crosscast]
>         auto* pBroadcast = dynamic_cast<sw::BroadcastingModify*>(m_pNode);
* sw/inc/contentindex.hxx SwContentIndexReg:
> sw/source/core/doc/DocumentRedlineManager.cxx:56:20: error: suspicious dynamic cross cast from 'SwNode *' to 'SwContentIndexReg *' [loplugin:crosscast]
>             assert(dynamic_cast<SwContentIndexReg*>(&pPos->GetNode())
* sw/source/core/inc/flowfrm.hxx SwFlowFrame:
> sw/source/core/layout/frmtool.cxx:3044:35: error: suspicious dynamic cross cast from 'SwFrame *' to 'SwFlowFrame *' [loplugin:crosscast]
>         SwFlowFrame *pFlowFrame = dynamic_cast<SwFlowFrame*>(pSibling);
* sw/source/uibase/inc/FrameControl.hxx ISwFrameControl:
> sw/source/uibase/docvw/FrameControlsManager.cxx:283:15: error: suspicious dynamic cross cast from 'vcl::Window *' to 'ISwFrameControl *' [loplugin:crosscast]
>     mpIFace = dynamic_cast<ISwFrameControl *>( pWindow.get() );
* vcl/inc/IPrioritable.hxx IPrioritable:
> vcl/source/control/NotebookbarPopup.cxx:40:37: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast]
>         vcl::IPrioritable* pChild = dynamic_cast<vcl::IPrioritable*>(GetChild(0));
> vcl/source/control/PriorityHBox.cxx:89:43: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast]
>         vcl::IPrioritable* pPrioritable = dynamic_cast<vcl::IPrioritable*>(pChild);
> vcl/source/control/PriorityHBox.cxx:127:32: error: suspicious dynamic cross cast from 'vcl::IPrioritable *' to 'vcl::Window *' [loplugin:crosscast]
>         vcl::Window* pWindow = dynamic_cast<vcl::Window*>(pPrioritable);
> vcl/source/control/PriorityHBox.cxx:142:32: error: suspicious dynamic cross cast from 'vcl::IPrioritable *' to 'vcl::Window *' [loplugin:crosscast]
>         vcl::Window* pWindow = dynamic_cast<vcl::Window*>(*pChildR);
> vcl/source/control/PriorityHBox.cxx:186:43: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast]
>         vcl::IPrioritable* pPrioritable = dynamic_cast<vcl::IPrioritable*>(pChild);
> vcl/source/window/NotebookBarAddonsMerger.cxx:128:19: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast]
>                 = dynamic_cast<vcl::IPrioritable*>(pOptionalParent.get());
> ovcl/source/window/builder.cxx:3643:55: error: suspicious dynamic cross cast from 'vcl::Window *' to 'vcl::IPrioritable *' [loplugin:crosscast]
>                     vcl::IPrioritable* pPrioritable = dynamic_cast<vcl::IPrioritable*>(pCurrentChild.get());
* vcl/inc/jsdialog/jsdialogbuilder.hxx BaseJSWidget:
> vcl/jsdialog/executor.cxx:41:26: error: suspicious dynamic cross cast from 'weld::Widget *' to 'BaseJSWidget *' [loplugin:crosscast]
>     if (auto pJSWidget = dynamic_cast<BaseJSWidget*>(pWidget))
> vcl/jsdialog/executor.cxx:49:26: error: suspicious dynamic cross cast from 'weld::Widget *' to 'BaseJSWidget *' [loplugin:crosscast]
>     if (auto pJSWidget = dynamic_cast<BaseJSWidget*>(pWidget))
> vcl/jsdialog/executor.cxx:155:49: error: suspicious dynamic cross cast from 'weld::MenuButton *' to 'BaseJSWidget *' [loplugin:crosscast]
>                     BaseJSWidget* pMenuButton = dynamic_cast<BaseJSWidget*>(pButton);
* vcl/inc/unx/x11/x11gdiimpl.h X11GraphicsImpl:
> vcl/unx/generic/gdi/salgdi.cxx:387:36: error: suspicious dynamic cross cast from 'pointer' (aka 'SalGraphicsImpl *') to 'X11GraphicsImpl *' [loplugin:crosscast]
>     if( X11GraphicsImpl* x11Impl = dynamic_cast< X11GraphicsImpl* >( mxImpl.get()))
* xmlsecurity/inc/certificate.hxx Certificate:
> xmlsecurity/source/helper/documentsignaturemanager.cxx:334:33: error: suspicious dynamic cross cast from 'com::sun::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast]
>         if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get()))
> xmlsecurity/source/helper/documentsignaturemanager.cxx:381:33: error: suspicious dynamic cross cast from 'com::sun::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast]
>         if (auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCert.get()))
> xmlsecurity/source/component/documentdigitalsignatures.cxx:688:28: error: suspicious dynamic cross cast from 'com::sun::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast]
>             auto pAuthor = dynamic_cast<xmlsecurity::Certificate*>(xAuthor.get());
> xmlsecurity/source/component/documentdigitalsignatures.cxx:689:26: error: suspicious dynamic cross cast from 'com::sun::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast]
>             auto pCert = dynamic_cast<xmlsecurity::Certificate*>(xCert.get());
> xmlsecurity/qa/unit/signing/signing.cxx:130:29: error: suspicious dynamic cross cast from 'com::sun::security::XCertificate *' to 'xmlsecurity::Certificate *' [loplugin:crosscast]
>         auto pCertificate = dynamic_cast<xmlsecurity::Certificate*>(xCertificate.get());

Change-Id: If4f9efd8c012d0f650fe670450cf7ac0c8978036
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143458
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-29 18:07:23 +01:00
..
inc/pch Drop comphelper::OWeakTypeObject, use cppu::WeakImplHelper<> instead 2022-11-21 19:35:40 +01:00
opengl
qa CppunitTest_slideshow_engine: inherit from UnoApiTest 2022-11-22 12:49:06 +01:00
source New loplugin:crosscast 2022-11-29 18:07:23 +01:00
test
util
CppunitTest_slideshow.mk
CppunitTest_slideshow_engine.mk CppunitTest_slideshow_engine: inherit from UnoApiTest 2022-11-22 12:49:06 +01:00
IwyuFilter_slideshow.yaml
Library_OGLTrans.mk
Library_slideshow.mk
Makefile
manifest.txt
Module_slideshow.mk
Package_opengl.mk
README.md

Impress Slideshow Engine

3D Transitions

The 3D transitions are slideshow transition engine using OpenGL and are located in slideshow/source/engine/OGLTrans/. They were initially written by GSOC student Shane.M.Mathews. Radek has later polished the code a bit, added few new 3D transitions, added infrastructure for vertex and fragment shaders. Wrote few transitions with fragment shader too.

Physics Animation Effects

Physics animation effects are simulated by external 2d physics engine library Box2D. They don't directly call Box2D functions but instead use the wrapper in:

  • slideshow/source/inc/box2dtools.hxx
  • slideshow/source/engine/box2dtools.cxx

The wrapper has two corresponding classes to manage the Box2D world and Box2D bodies.

When a physics animation starts, a Box2DWorld is initiated and populated with every shape that is part of the foreground (which are shapes that do not belong to the master slide and not a background shape).

After creation until the end of the slide (not the whole slideshow) the Box2D World isn't destroyed and reused. But the bodies that represent the shapes in the slide get destroyed when there's a point in time that there's no physics animation in progress. And recreated when another physics animation starts.

If there are multiple physics animations in parallel only one of them takes the role of stepping through the simulation.

If there are other animation effects that go in parallel which change the shape position, rotation, or visibility - they also report the change to Box2DWorld. These updates are collected in a queue in Box2DWorld and processed before stepping through the simulation. To achieve convincing results these updates are performed by setting the Box2D body's linear velocity or angular velocity instead of setting directly it's position or rotation.