diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-30 15:21:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-30 17:34:39 +0200 |
commit | 0c1b49048f1127d352b43847353392f0512f19e3 (patch) | |
tree | 81bbe680c12a5a1fa5e4c98f73881ca14e4fc1e2 | |
parent | 64cf52d47968d512afd383ce9a7321a4bd72b2ca (diff) |
loplugin:unusedmethods
and tweak the plugin a little to speed it up
Change-Id: Ia59456232602184c4f1b5d1d75ad94a9a2e2d0be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99799
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
28 files changed, 69 insertions, 730 deletions
diff --git a/comphelper/source/misc/componentmodule.cxx b/comphelper/source/misc/componentmodule.cxx index 2fb5c31d9144..0c09cb80ccb0 100644 --- a/comphelper/source/misc/componentmodule.cxx +++ b/comphelper/source/misc/componentmodule.cxx @@ -33,15 +33,11 @@ namespace comphelper using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; - typedef std::vector< ComponentDescription > ComponentDescriptions; - /** implementation for <type>OModule</type>. not threadsafe, has to be guarded by its owner */ class OModuleImpl { public: - ComponentDescriptions m_aRegisteredComponents; - OModuleImpl(); }; @@ -58,15 +54,6 @@ namespace comphelper { } - void OModule::registerImplementation( const ComponentDescription& _rComp ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !m_pImpl ) - throw RuntimeException(); - - m_pImpl->m_aRegisteredComponents.push_back( _rComp ); - } - } // namespace comphelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx index 610f4a1974d5..b854238d2688 100644 --- a/compilerplugins/clang/unusedmethods.cxx +++ b/compilerplugins/clang/unusedmethods.cxx @@ -89,8 +89,12 @@ public: std::string output; for (const MyFuncInfo & s : definitionSet) - output += "definition:\t" + s.access + "\t" + s.returnType + "\t" + s.nameAndParams - + "\t" + s.sourceLocation + "\t" + s.virtualness + "\n"; + { + // ignore external code + if (s.sourceLocation.rfind("external/", 0) != 0) + output += "definition:\t" + s.access + "\t" + s.returnType + "\t" + s.nameAndParams + + "\t" + s.sourceLocation + "\t" + s.virtualness + "\n"; + } // for the "unused method" analysis for (const MyFuncInfo & s : callSet) output += "call:\t" + s.returnType + "\t" + s.nameAndParams + "\n"; diff --git a/compilerplugins/clang/unusedmethods.py b/compilerplugins/clang/unusedmethods.py index 3df9b1e96ebe..71d10f82bec2 100755 --- a/compilerplugins/clang/unusedmethods.py +++ b/compilerplugins/clang/unusedmethods.py @@ -145,9 +145,6 @@ for d in definitionSet: # ignore the Java symbols, loaded from the JavaVM if d[1].startswith("Java_"): continue - # ignore external code - if definitionToSourceLocationMap[d].startswith("external/"): - continue # ignore the VCL_BUILDER_DECL_FACTORY stuff if d[0]=="void" and d[1].startswith("make") and ("(class VclPtr<class vcl::Window> &" in d[1]): continue @@ -216,9 +213,6 @@ for d in definitionSet: or "operator<<" in d[1] or "operator>>" in d[1] or "operator++" in d[1] or "operator--" in d[1]): continue - # ignore external code - if definitionToSourceLocationMap[d].startswith("external/"): - continue # ignore UNO constructor functions if (d[0] == "class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface>" and d[1].endswith("_createInstance(const class com::sun::star::uno::Reference<class com::sun::star::lang::XMultiServiceFactory> &)")): @@ -260,9 +254,6 @@ for d in publicDefinitionSet: continue if isOtherConstness(d, calledFromOutsideSet): continue - # ignore external code - if definitionToSourceLocationMap[d].startswith("external/"): - continue tmp3set.add((method, definitionToSourceLocationMap[d])) # print output, sorted by name and line number diff --git a/compilerplugins/clang/unusedmethods.results b/compilerplugins/clang/unusedmethods.results index 61578439f7a0..e8869b11a721 100644 --- a/compilerplugins/clang/unusedmethods.results +++ b/compilerplugins/clang/unusedmethods.results @@ -104,6 +104,8 @@ connectivity/source/inc/OTypeInfo.hxx:47 _Bool connectivity::OTypeInfo::operator!=(const struct connectivity::OTypeInfo &) const cui/source/dialogs/SpellAttrib.hxx:72 _Bool svx::SpellErrorDescription::operator==(const struct svx::SpellErrorDescription &) const +cui/source/inc/AdditionsDialog.hxx:141 + void SearchAndParseThread::AppendAllExtensions() cui/source/inc/cfg.hxx:336 class rtl::OUString SvxMenuEntriesListBox::get_text(int) cui/source/inc/cfg.hxx:337 @@ -190,14 +192,12 @@ editeng/inc/edtspell.hxx:104 class __gnu_debug::_Safe_iterator<class __gnu_cxx::__normal_iterator<const struct editeng::MisspellRange *, class std::__cxx1998::vector<struct editeng::MisspellRange, class std::allocator<struct editeng::MisspellRange> > >, class std::__debug::vector<struct editeng::MisspellRange, class std::allocator<struct editeng::MisspellRange> >, struct std::random_access_iterator_tag> WrongList::begin() const editeng/inc/edtspell.hxx:105 class __gnu_debug::_Safe_iterator<class __gnu_cxx::__normal_iterator<const struct editeng::MisspellRange *, class std::__cxx1998::vector<struct editeng::MisspellRange, class std::allocator<struct editeng::MisspellRange> > >, class std::__debug::vector<struct editeng::MisspellRange, class std::allocator<struct editeng::MisspellRange> >, struct std::random_access_iterator_tag> WrongList::end() const -extensions/source/propctrlr/formcontroller.hxx:99 - class rtl::OUString pcr::DialogController::getImplementationName_static() -extensions/source/propctrlr/formcontroller.hxx:101 - class com::sun::star::uno::Sequence<class rtl::OUString> pcr::DialogController::getSupportedServiceNames_static() -extensions/source/propctrlr/formcontroller.hxx:103 - class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface> pcr::DialogController::Create(const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &) -extensions/source/propctrlr/modulepcr.hxx:45 - pcr::OAutoRegistration::OAutoRegistration<TYPE>() +extensions/source/inc/componentmodule.hxx:96 + class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface> compmodule::OModule::getComponentFactory(const class rtl::OUString &,const class com::sun::star::uno::Reference<class com::sun::star::lang::XMultiServiceFactory> &) +extensions/source/inc/componentmodule.hxx:122 + compmodule::OMultiInstanceAutoRegistration::OMultiInstanceAutoRegistration<TYPE>() +extensions/source/propctrlr/modulepcr.hxx:33 + class pcr::PcrModule & pcr::PcrModule::getInstance() extensions/source/scanner/scanner.hxx:79 void ScannerManager::SetData(void *) hwpfilter/source/mzstring.h:99 @@ -406,12 +406,10 @@ include/comphelper/basicio.hxx:52 const class com::sun::star::uno::Reference<class com::sun::star::io::XObjectInputStream> & comphelper::operator>>(const class com::sun::star::uno::Reference<class com::sun::star::io::XObjectInputStream> &,unsigned int &) include/comphelper/basicio.hxx:53 const class com::sun::star::uno::Reference<class com::sun::star::io::XObjectOutputStream> & comphelper::operator<<(const class com::sun::star::uno::Reference<class com::sun::star::io::XObjectOutputStream> &,unsigned int) -include/comphelper/componentmodule.hxx:102 - void comphelper::OModule::registerImplementation(const class rtl::OUString &,const class com::sun::star::uno::Sequence<class rtl::OUString> &,class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface> (*)(const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &)) -include/comphelper/componentmodule.hxx:118 - class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface> comphelper::OModule::getComponentFactory(const class rtl::OUString &) -include/comphelper/componentmodule.hxx:146 - comphelper::OAutoRegistration::OAutoRegistration<TYPE>(class comphelper::OModule &) +include/comphelper/componentmodule.hxx:61 + comphelper::ComponentDescription::ComponentDescription(const class rtl::OUString &,const class com::sun::star::uno::Sequence<class rtl::OUString> &,class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface> (*)(const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &),class com::sun::star::uno::Reference<class com::sun::star::lang::XSingleComponentFactory> (*)(class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface> (*)(const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &), const class rtl::OUString &, const class com::sun::star::uno::Sequence<class rtl::OUString> &, struct _rtl_ModuleCount *)) +include/comphelper/componentmodule.hxx:94 + void comphelper::OModule::registerImplementation(const struct comphelper::ComponentDescription &) include/comphelper/configuration.hxx:248 type-parameter-?-? comphelper::ConfigurationLocalizedProperty::get(const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &) include/comphelper/configuration.hxx:264 @@ -511,8 +509,6 @@ include/comphelper/scopeguard.hxx:57 include/comphelper/scopeguard.hxx:84 ScopeGuard<Func> comphelper::<deduction guide for ScopeGuard>(const ScopeGuard<Func> &) include/comphelper/sequence.hxx:200 - Sequence<type-parameter-?-?> comphelper::containerToSequence(type-parameter-?-? const (&)[_Num]) -include/comphelper/sequence.hxx:200 Sequence<type-parameter-?-?> comphelper::containerToSequence(type-parameter-?-? const (&)[S]) include/comphelper/sequence.hxx:200 Sequence<type-parameter-?-?> comphelper::containerToSequence(type-parameter-?-? const (&)[_Bound]) @@ -522,22 +518,40 @@ include/comphelper/sequence.hxx:200 Sequence<type-parameter-?-?> comphelper::containerToSequence(type-parameter-?-? const (&)[_Nm]) include/comphelper/sequence.hxx:200 Sequence<type-parameter-?-?> comphelper::containerToSequence(type-parameter-?-? const (&)[SrcSize]) +include/comphelper/sequence.hxx:200 + Sequence<type-parameter-?-?> comphelper::containerToSequence(type-parameter-?-? const (&)[_Num]) +include/comphelper/servicedecl.hxx:108 + comphelper::service_decl::ServiceDecl::ServiceDecl(const type-parameter-?-? &,const char *,const char *) +include/comphelper/servicedecl.hxx:152 + comphelper::service_decl::detail::OwnServiceImpl::OwnServiceImpl<ImplT>(const class comphelper::service_decl::ServiceDecl &,const class com::sun::star::uno::Sequence<class com::sun::star::uno::Any> &,const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &) +include/comphelper/servicedecl.hxx:157 + comphelper::service_decl::detail::OwnServiceImpl::OwnServiceImpl<ImplT>(const class comphelper::service_decl::ServiceDecl &,const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &) include/comphelper/servicedecl.hxx:183 comphelper::service_decl::detail::ServiceImpl::ServiceImpl<ImplT>(const class comphelper::service_decl::ServiceDecl &,const class com::sun::star::uno::Sequence<class com::sun::star::uno::Any> &,const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &) include/comphelper/servicedecl.hxx:188 comphelper::service_decl::detail::ServiceImpl::ServiceImpl<ImplT>(const class comphelper::service_decl::ServiceDecl &,const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &) -include/comphelper/servicedecl.hxx:283 - comphelper::service_decl::serviceimpl_base::serviceimpl_base(const type-parameter-?-? &) +include/comphelper/servicedecl.hxx:199 + comphelper::service_decl::detail::InheritingServiceImpl::InheritingServiceImpl<ImplT>(const class comphelper::service_decl::ServiceDecl &,const class com::sun::star::uno::Sequence<class com::sun::star::uno::Any> &,const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &) +include/comphelper/servicedecl.hxx:209 + class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface> comphelper::service_decl::detail::PostProcessDefault::operator()(type-parameter-?-? *) const +include/comphelper/servicedecl.hxx:220 + comphelper::service_decl::detail::CreateFunc::CreateFunc<type-parameter-?-?, type-parameter-?-?, comphelper::service_decl::with_args<false> >(const type-parameter-?-? &) +include/comphelper/servicedecl.hxx:224 + class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface> comphelper::service_decl::detail::CreateFunc::operator()(const class comphelper::service_decl::ServiceDecl &,const class com::sun::star::uno::Sequence<class com::sun::star::uno::Any> &,const class com::sun::star::uno::Reference<class com::sun::star::uno::XComponentContext> &) const +include/comphelper/servicedecl.hxx:237 + comphelper::service_decl::detail::CreateFunc::CreateFunc<type-parameter-?-?, type-parameter-?-?, comphelper::service_decl::with_args<true> >(const type-parameter-?-? &) +include/comphelper/servicedecl.hxx:271 + comphelper::service_decl::serviceimpl_base::serviceimpl_base<ImplT_, WithArgsT>() include/comphelper/servicedecl.hxx:283 comphelper::service_decl::serviceimpl_base::serviceimpl_base<ImplT_, WithArgsT>(const type-parameter-?-? &) include/comphelper/servicedecl.hxx:295 comphelper::service_decl::class_::class_<ImplT_, WithArgsT>() include/comphelper/servicedecl.hxx:304 comphelper::service_decl::class_::class_<ImplT_, WithArgsT>(const type-parameter-?-? &) +include/comphelper/servicedecl.hxx:314 + comphelper::service_decl::inheritingClass_::inheritingClass_<ImplT_, WithArgsT>() include/comphelper/servicedecl.hxx:323 comphelper::service_decl::inheritingClass_::inheritingClass_<ImplT_, WithArgsT>(const type-parameter-?-? &) -include/comphelper/servicedecl.hxx:323 - comphelper::service_decl::inheritingClass_::inheritingClass_(const type-parameter-?-? &) include/comphelper/unique_disposing_ptr.hxx:46 type-parameter-?-? & comphelper::unique_disposing_ptr::operator*() const include/comphelper/unwrapargs.hxx:51 @@ -674,6 +688,8 @@ include/sfx2/lokhelper.hxx:62 int SfxLokHelper::getDocumentIdOfView(int) include/sfx2/msg.hxx:120 const class std::type_info * SfxType0::Type() const +include/sfx2/sfxmodelfactory.hxx:66 + class com::sun::star::uno::Reference<class com::sun::star::lang::XSingleServiceFactory> sfx2::createSfxModelFactory(const class com::sun::star::uno::Reference<class com::sun::star::lang::XMultiServiceFactory> &,const class rtl::OUString &,class com::sun::star::uno::Reference<class com::sun::star::uno::XInterface> (*const)(const class com::sun::star::uno::Reference<class com::sun::star::lang::XMultiServiceFactory> &, enum SfxModelFlags),const class com::sun::star::uno::Sequence<class rtl::OUString> &) include/sfx2/thumbnailview.hxx:206 unsigned short ThumbnailView::getNextItemId() const include/sfx2/viewsh.hxx:365 @@ -716,7 +732,7 @@ include/svx/framelink.hxx:198 _Bool svx::frame::operator>(const class svx::frame::Style &,const class svx::frame::Style &) include/svx/gallery1.hxx:58 const class std::unique_ptr<class GalleryBinaryEngineEntry, struct std::default_delete<class GalleryBinaryEngineEntry> > & GalleryThemeEntry::getGalleryBinaryEngineEntry() const -include/svx/gallerybinaryengine.hxx:58 +include/svx/gallerybinaryengine.hxx:63 const class INetURLObject & GalleryBinaryEngine::GetStrURL() const include/svx/langbox.hxx:94 void SvxLanguageBox::show() @@ -826,6 +842,8 @@ include/unotools/moduleoptions.hxx:166 _Bool SvtModuleOptions::IsDataBase() const include/unotools/textsearch.hxx:121 basic_ostream<type-parameter-?-?, type-parameter-?-?> & utl::operator<<(basic_ostream<type-parameter-?-?, type-parameter-?-?> &,const enum utl::SearchParam::SearchType &) +include/vbahelper/helperdecl.hxx:33 + comphelper::service_decl::vba_service_class_::vba_service_class_<ImplT_, WithArgsT>() include/vcl/alpha.hxx:47 _Bool AlphaMask::operator==(const class AlphaMask &) const include/vcl/alpha.hxx:48 @@ -840,7 +858,7 @@ include/vcl/BitmapColor.hxx:39 void BitmapColor::SetAlpha(unsigned char) include/vcl/builder.hxx:338 void VclBuilder::connectNumericFormatterAdjustment(const class rtl::OString &,const class rtl::OUString &) -include/vcl/builder.hxx:482 +include/vcl/builder.hxx:480 class rtl::OString VclBuilderContainer::getUIFile() const include/vcl/builderpage.hxx:36 void BuilderPage::SetHelpId(const class rtl::OString &) @@ -866,8 +884,6 @@ include/vcl/customweld.hxx:138 void weld::CustomWeld::queue_draw_area(int,int,int,int) include/vcl/customweld.hxx:153 void weld::CustomWeld::set_visible(_Bool) -include/vcl/edit.hxx:209 - _Bool Edit::IsValueChangedFromSaved() const include/vcl/errcode.hxx:86 _Bool ErrCode::operator<(const class ErrCode &) const include/vcl/errcode.hxx:87 @@ -924,7 +940,7 @@ include/vcl/settings.hxx:509 void StyleSettings::SetSpinSize(long) include/vcl/settings.hxx:664 _Bool HelpSettings::operator!=(const class HelpSettings &) const -include/vcl/settings.hxx:721 +include/vcl/settings.hxx:722 _Bool AllSettings::operator!=(const class AllSettings &) const include/vcl/split.hxx:92 void Splitter::SetHorizontal(_Bool) @@ -1086,10 +1102,10 @@ libreofficekit/qa/gtktiledviewer/gtv-application-window.cxx:72 void ::operator()(struct _GtkBuilder *) const libreofficekit/qa/gtktiledviewer/gtv-comments-sidebar.cxx:31 void * gtv_comments_sidebar_get_instance_private(struct GtvCommentsSidebar *) +libreofficekit/qa/gtktiledviewer/gtv-comments-sidebar.cxx:49 + void ::operator()(struct _GList *) const libreofficekit/qa/gtktiledviewer/gtv-helpers.cxx:80 void ::operator()(struct _GtkTargetList *) const -libreofficekit/qa/gtktiledviewer/gtv-lokdocview-signal-handlers.cxx:255 - void ::operator()(struct _GList *) const libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.hxx:35 void openLokDialog(struct _GtkWidget *,void *) lotuswordpro/source/filter/clone.hxx:28 @@ -1116,9 +1132,9 @@ oox/inc/drawingml/textliststyle.hxx:49 void oox::drawingml::TextListStyle::dump() const oox/inc/drawingml/textparagraphproperties.hxx:98 void oox::drawingml::TextParagraphProperties::setLineSpacing(const class oox::drawingml::TextSpacing &) -oox/source/drawingml/diagram/diagramlayoutatoms.hxx:256 +oox/source/drawingml/diagram/diagramlayoutatoms.hxx:278 const class std::__debug::vector<class std::shared_ptr<class oox::drawingml::Shape>, class std::allocator<class std::shared_ptr<class oox::drawingml::Shape> > > & oox::drawingml::LayoutNode::getNodeShapes() const -oox/source/drawingml/diagram/diagramlayoutatoms.hxx:265 +oox/source/drawingml/diagram/diagramlayoutatoms.hxx:287 const class oox::drawingml::LayoutNode * oox::drawingml::LayoutNode::getParentLayoutNode() const sal/osl/unx/uunxapi.hxx:35 int mkdir_c(const class rtl::OString &,unsigned int) @@ -1333,12 +1349,12 @@ sd/source/filter/ppt/pptinanimations.hxx:108 sd/source/ui/inc/filedlg.hxx:55 _Bool SdOpenSoundFileDialog::IsInsertAsLinkSelected() const sd/source/ui/inc/GraphicViewShell.hxx:43 + class SfxViewFactory * sd::GraphicViewShell::Factory() +sd/source/ui/inc/GraphicViewShell.hxx:43 void sd::GraphicViewShell::RegisterFactory(struct o3tl::strong_int<unsigned short, struct SfxInterfaceIdTag>) sd/source/ui/inc/GraphicViewShell.hxx:43 void sd::GraphicViewShell::InitFactory() sd/source/ui/inc/GraphicViewShell.hxx:43 - class SfxViewFactory * sd::GraphicViewShell::Factory() -sd/source/ui/inc/GraphicViewShell.hxx:43 class SfxViewShell * sd::GraphicViewShell::CreateInstance(class SfxViewFrame *,class SfxViewShell *) sd/source/ui/inc/optsitem.hxx:178 _Bool SdOptionsContents::operator==(const class SdOptionsContents &) const @@ -1427,6 +1443,8 @@ slideshow/source/engine/animationfactory.cxx:538 slideshow/source/engine/opengl/TransitionImpl.hxx:184 void OGLTransitionImpl::cleanup() slideshow/source/inc/listenercontainer.hxx:44 + _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::ViewUpdate> &) +slideshow/source/inc/listenercontainer.hxx:44 _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::AnimationEventHandler> &) slideshow/source/inc/listenercontainer.hxx:44 _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::ShapeListenerEventHandler> &) @@ -1435,15 +1453,13 @@ slideshow/source/inc/listenercontainer.hxx:44 slideshow/source/inc/listenercontainer.hxx:44 _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::PauseEventHandler> &) slideshow/source/inc/listenercontainer.hxx:44 - _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::ViewUpdate> &) -slideshow/source/inc/listenercontainer.hxx:44 _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::UserPaintEventHandler> &) slideshow/source/inc/listenercontainer.hxx:44 _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::IntrinsicAnimationEventHandler> &) slideshow/source/inc/listenercontainer.hxx:54 - _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::ViewEventHandler> &) -slideshow/source/inc/listenercontainer.hxx:54 _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::ViewRepaintHandler> &) +slideshow/source/inc/listenercontainer.hxx:54 + _Bool slideshow::internal::FunctionApply::apply(type-parameter-?-?,const class std::shared_ptr<class slideshow::internal::ViewEventHandler> &) slideshow/source/inc/shape.hxx:212 _Bool slideshow::internal::Shape::isForeground() const slideshow/source/inc/shapemanager.hxx:105 @@ -1529,12 +1545,12 @@ sw/inc/docary.hxx:94 sw/inc/docary.hxx:94 void SwVectorModifyBase::insert(class __gnu_debug::_Safe_iterator<class __gnu_cxx::__normal_iterator<class SwGrfFormatColl **, class std::__cxx1998::vector<class SwGrfFormatColl *, class std::allocator<class SwGrfFormatColl *> > >, class std::__debug::vector<class SwGrfFormatColl *, class std::allocator<class SwGrfFormatColl *> >, struct std::random_access_iterator_tag>,type-parameter-?-?,type-parameter-?-?) sw/inc/docary.hxx:94 + void SwVectorModifyBase::insert(class __gnu_debug::_Safe_iterator<class __gnu_cxx::__normal_iterator<class SwFrameFormat **, class std::__cxx1998::vector<class SwFrameFormat *, class std::allocator<class SwFrameFormat *> > >, class std::__debug::vector<class SwFrameFormat *, class std::allocator<class SwFrameFormat *> >, struct std::random_access_iterator_tag>,type-parameter-?-?,type-parameter-?-?) +sw/inc/docary.hxx:94 void SwVectorModifyBase::insert(class __gnu_debug::_Safe_iterator<class __gnu_cxx::__normal_iterator<class SwSectionFormat **, class std::__cxx1998::vector<class SwSectionFormat *, class std::allocator<class SwSectionFormat *> > >, class std::__debug::vector<class SwSectionFormat *, class std::allocator<class SwSectionFormat *> >, struct std::random_access_iterator_tag>,type-parameter-?-?,type-parameter-?-?) sw/inc/docary.hxx:94 void SwVectorModifyBase::insert(class __gnu_debug::_Safe_iterator<class __gnu_cxx::__normal_iterator<class SwCharFormat **, class std::__cxx1998::vector<class SwCharFormat *, class std::allocator<class SwCharFormat *> > >, class std::__debug::vector<class SwCharFormat *, class std::allocator<class SwCharFormat *> >, struct std::random_access_iterator_tag>,type-parameter-?-?,type-parameter-?-?) sw/inc/docary.hxx:94 - void SwVectorModifyBase::insert(class __gnu_debug::_Safe_iterator<class __gnu_cxx::__normal_iterator<class SwFrameFormat **, class std::__cxx1998::vector<class SwFrameFormat *, class std::allocator<class SwFrameFormat *> > >, class std::__debug::vector<class SwFrameFormat *, class std::allocator<class SwFrameFormat *> >, struct std::random_access_iterator_tag>,type-parameter-?-?,type-parameter-?-?) -sw/inc/docary.hxx:94 void SwVectorModifyBase::insert(class __gnu_debug::_Safe_iterator<class __gnu_cxx::__normal_iterator<class SwNumRule **, class std::__cxx1998::vector<class SwNumRule *, class std::allocator<class SwNumRule *> > >, class std::__debug::vector<class SwNumRule *, class std::allocator<class SwNumRule *> >, struct std::random_access_iterator_tag>,type-parameter-?-?,type-parameter-?-?) sw/inc/docary.hxx:140 void SwVectorModifyBase::dumpAsXml(struct _xmlTextWriter *) @@ -1806,7 +1822,7 @@ vcl/inc/unx/salframe.h:184 enum SalFrameStyleFlags X11SalFrame::GetStyle() const vcl/qa/cppunit/lifecycle.cxx:237 (anonymous namespace)::LeakTestClass::LeakTestClass(_Bool &,type-parameter-?-? &&...) -vcl/skia/salbmp.cxx:454 +vcl/skia/salbmp.cxx:481 void ::operator()(void *,void *) const vcl/source/app/scheduler.cxx:83 basic_ostream<type-parameter-?-?, type-parameter-?-?> & (anonymous namespace)::operator<<(basic_ostream<type-parameter-?-?, type-parameter-?-?> &,const class Idle &) diff --git a/extensions/source/abpilot/abspage.hxx b/extensions/source/abpilot/abspage.hxx index b10ee599c144..7c55bf3fae20 100644 --- a/extensions/source/abpilot/abspage.hxx +++ b/extensions/source/abpilot/abspage.hxx @@ -22,6 +22,7 @@ #include <vcl/wizardmachine.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <strings.hrc> #include <componentmodule.hxx> diff --git a/extensions/source/abpilot/datasourcehandling.cxx b/extensions/source/abpilot/datasourcehandling.cxx index 3ee8f4d368ab..1d7da2e1719b 100644 --- a/extensions/source/abpilot/datasourcehandling.cxx +++ b/extensions/source/abpilot/datasourcehandling.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdb/XCompletedConnection.hpp> diff --git a/extensions/source/dbpilots/controlwizard.hxx b/extensions/source/dbpilots/controlwizard.hxx index f918a5a94ab8..12835c1a6ce2 100644 --- a/extensions/source/dbpilots/controlwizard.hxx +++ b/extensions/source/dbpilots/controlwizard.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/form/FormComponentType.hpp> #include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <vcl/weld.hxx> #include <vcl/wizardmachine.hxx> #include "dbptypes.hxx" diff --git a/extensions/source/inc/componentmodule.cxx b/extensions/source/inc/componentmodule.cxx index fa55250df2d5..69d2234adbdb 100644 --- a/extensions/source/inc/componentmodule.cxx +++ b/extensions/source/inc/componentmodule.cxx @@ -19,130 +19,15 @@ #include "componentmodule.hxx" #include <unotools/resmgr.hxx> -#include <osl/diagnose.h> namespace compmodule { - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::registry; - using namespace ::cppu; OUString ModuleRes(const char* pId) { return Translate::get(pId, Translate::Create("pcr")); } - //- registration helper - - std::vector< OUString >* OModule::s_pImplementationNames = nullptr; - std::vector< Sequence< OUString > >* OModule::s_pSupportedServices = nullptr; - std::vector< ComponentInstantiation >* OModule::s_pCreationFunctionPointers = nullptr; - std::vector< FactoryInstantiation >* OModule::s_pFactoryFunctionPointers = nullptr; - - - void OModule::registerComponent( - const OUString& _rImplementationName, - const Sequence< OUString >& _rServiceNames, - ComponentInstantiation _pCreateFunction, - FactoryInstantiation _pFactoryFunction) - { - if (!s_pImplementationNames) - { - OSL_ENSURE(!s_pSupportedServices && !s_pCreationFunctionPointers && !s_pFactoryFunctionPointers, - "OModule::registerComponent : inconsistent state (the pointers (1)) !"); - s_pImplementationNames = new std::vector< OUString >; - s_pSupportedServices = new std::vector< Sequence< OUString > >; - s_pCreationFunctionPointers = new std::vector< ComponentInstantiation >; - s_pFactoryFunctionPointers = new std::vector< FactoryInstantiation >; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OModule::registerComponent : inconsistent state (the pointers (2)) !"); - - OSL_ENSURE( (s_pImplementationNames->size() == s_pSupportedServices->size()) - && (s_pImplementationNames->size() == s_pCreationFunctionPointers->size()) - && (s_pImplementationNames->size() == s_pFactoryFunctionPointers->size()), - "OModule::registerComponent : inconsistent state !"); - - s_pImplementationNames->push_back(_rImplementationName); - s_pSupportedServices->push_back(_rServiceNames); - s_pCreationFunctionPointers->push_back(_pCreateFunction); - s_pFactoryFunctionPointers->push_back(_pFactoryFunction); - } - - - void OModule::revokeComponent(const OUString& _rImplementationName) - { - if (!s_pImplementationNames) - { - OSL_FAIL("OModule::revokeComponent : have no class infos ! Are you sure called this method at the right time ?"); - return; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OModule::revokeComponent : inconsistent state (the pointers) !"); - OSL_ENSURE( (s_pImplementationNames->size() == s_pSupportedServices->size()) - && (s_pImplementationNames->size() == s_pCreationFunctionPointers->size()) - && (s_pImplementationNames->size() == s_pFactoryFunctionPointers->size()), - "OModule::revokeComponent : inconsistent state !"); - - auto it = std::find(s_pImplementationNames->begin(), s_pImplementationNames->end(), _rImplementationName); - if (it != s_pImplementationNames->end()) - { - sal_Int32 i = static_cast<sal_Int32>(std::distance(s_pImplementationNames->begin(), it)); - s_pImplementationNames->erase(it); - s_pSupportedServices->erase(s_pSupportedServices->begin() + i); - s_pCreationFunctionPointers->erase(s_pCreationFunctionPointers->begin() + i); - s_pFactoryFunctionPointers->erase(s_pFactoryFunctionPointers->begin() + i); - } - - if (s_pImplementationNames->empty()) - { - delete s_pImplementationNames; s_pImplementationNames = nullptr; - delete s_pSupportedServices; s_pSupportedServices = nullptr; - delete s_pCreationFunctionPointers; s_pCreationFunctionPointers = nullptr; - delete s_pFactoryFunctionPointers; s_pFactoryFunctionPointers = nullptr; - } - } - - - Reference< XInterface > OModule::getComponentFactory( - const OUString& _rImplementationName, - const Reference< XMultiServiceFactory >& _rxServiceManager) - { - OSL_ENSURE(_rxServiceManager.is(), "OModule::getComponentFactory : invalid argument (service manager) !"); - OSL_ENSURE(!_rImplementationName.isEmpty(), "OModule::getComponentFactory : invalid argument (implementation name) !"); - - if (!s_pImplementationNames) - { - OSL_FAIL("OModule::getComponentFactory : have no class infos ! Are you sure called this method at the right time ?"); - return nullptr; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OModule::getComponentFactory : inconsistent state (the pointers) !"); - OSL_ENSURE( (s_pImplementationNames->size() == s_pSupportedServices->size()) - && (s_pImplementationNames->size() == s_pCreationFunctionPointers->size()) - && (s_pImplementationNames->size() == s_pFactoryFunctionPointers->size()), - "OModule::getComponentFactory : inconsistent state !"); - - - sal_Int32 nLen = s_pImplementationNames->size(); - - for (sal_Int32 i=0; i<nLen; ++i) - { - if ((*s_pImplementationNames)[i] == _rImplementationName) - { - const FactoryInstantiation FactoryInstantiationFunction = (*s_pFactoryFunctionPointers)[i]; - - Reference< XInterface > xReturn = FactoryInstantiationFunction( _rxServiceManager, _rImplementationName, - (*s_pCreationFunctionPointers)[i], - (*s_pSupportedServices)[i], nullptr); - return xReturn; - } - } - - return nullptr; - } - } // namespace compmodule diff --git a/extensions/source/inc/componentmodule.hxx b/extensions/source/inc/componentmodule.hxx index d697ab86644e..3b5d402578cd 100644 --- a/extensions/source/inc/componentmodule.hxx +++ b/extensions/source/inc/componentmodule.hxx @@ -20,126 +20,14 @@ #ifndef INCLUDED_EXTENSIONS_SOURCE_INC_COMPONENTMODULE_HXX #define INCLUDED_EXTENSIONS_SOURCE_INC_COMPONENTMODULE_HXX -/** you may find this file helpful if you implement a component (in its own library) which can't use - the usual infrastructure.<br/> - More precise, you find helper classes to ease the use of resources and the registration of services. -*/ - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> -#include <com/sun/star/uno/Sequence.hxx> -#include <cppuhelper/factory.hxx> -#include <vector> +#include <rtl/ustring.hxx> namespace compmodule { -typedef css::uno::Reference< css::lang::XSingleServiceFactory > (*FactoryInstantiation) - ( - const css::uno::Reference< css::lang::XMultiServiceFactory >& _rServiceManager, - const OUString & _rComponentName, - ::cppu::ComponentInstantiation _pCreateFunction, - const css::uno::Sequence< OUString > & _rServiceNames, - rtl_ModuleCount* - ); - - class OModule - { - private: - OModule() = delete; //TODO: get rid of this class - - protected: - // auto registration administration - static std::vector< OUString >* - s_pImplementationNames; - static std::vector< css::uno::Sequence< OUString > >* - s_pSupportedServices; - static std::vector< cppu::ComponentInstantiation >* - s_pCreationFunctionPointers; - static std::vector< FactoryInstantiation >* - s_pFactoryFunctionPointers; - - public: - /** register a component implementing a service with the given data. - @param _rImplementationName - the implementation name of the component - @param _rServiceNames - the services the component supports - @param _pCreateFunction - a function for creating an instance of the component - @param _pFactoryFunction - a function for creating a factory for that component - @see revokeComponent - */ - static void registerComponent( - const OUString& _rImplementationName, - const css::uno::Sequence< OUString >& _rServiceNames, - ::cppu::ComponentInstantiation _pCreateFunction, - FactoryInstantiation _pFactoryFunction); - - /** revoke the registration for the specified component - @param _rImplementationName - the implementation name of the component - */ - static void revokeComponent( - const OUString& _rImplementationName); - - /** creates a Factory for the component with the given implementation name. - <p>Usually used from within component_getFactory.<p/> - @param _rxServiceManager - a pointer to an XMultiServiceFactory interface as got in component_getFactory - @param _pImplementationName - the implementation name of the component - @return - the XInterface access to a factory for the component - */ - static css::uno::Reference< css::uno::XInterface > getComponentFactory( - const OUString& _rImplementationName, - const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxServiceManager - ); - }; - // specialized ResId, using the resource locale provided by the global module OUString ModuleRes(const char* pId); - template <class TYPE> - class OMultiInstanceAutoRegistration - { - public: - /** automatically registers a multi instance component - <p>Assumed that the template argument has the three methods - <ul> - <li><code>static OUString getImplementationName_Static()</code><li/> - <li><code>static css::uno::Sequence< OUString > getSupportedServiceNames_Static()</code><li/> - <li><code>static css::uno::Reference< css::uno::XInterface > - Create(const css::uno::Reference< css::lang::XMultiServiceFactory >&)</code> - </li> - <ul/> - the instantiation of this object will automatically register the class via <method>OModule::registerComponent</method>. - <p/> - The factory creation function used is <code>::cppu::createSingleFactory</code>. - */ - OMultiInstanceAutoRegistration(); - ~OMultiInstanceAutoRegistration(); - }; - - template <class TYPE> - OMultiInstanceAutoRegistration<TYPE>::OMultiInstanceAutoRegistration() - { - OModule::registerComponent( - TYPE::getImplementationName_Static(), - TYPE::getSupportedServiceNames_Static(), - TYPE::Create, - ::cppu::createSingleFactory - ); - } - - template <class TYPE> - OMultiInstanceAutoRegistration<TYPE>::~OMultiInstanceAutoRegistration() - { - OModule::revokeComponent(TYPE::getImplementationName_Static()); - } - } // namespace compmodule diff --git a/extensions/source/propctrlr/modulepcr.cxx b/extensions/source/propctrlr/modulepcr.cxx index 37d119e8e824..fdaf3b2a6348 100644 --- a/extensions/source/propctrlr/modulepcr.cxx +++ b/extensions/source/propctrlr/modulepcr.cxx @@ -23,23 +23,6 @@ namespace pcr { - PcrModule::PcrModule() - { - } - - PcrModule& PcrModule::getInstance() - { - static PcrModule* pModule = new PcrModule; - return *pModule; - /* yes, in theory, this is a resource leak, since the PcrModule - will never be cleaned up. However, using a non-heap instance of PcrModule - would not work: It would be cleaned up when the module is unloaded. - This might happen (and is likely to happen) *after* the tools-library - has been unloaded. However, the module's dtor is where we would delete - our resource manager (in case not all our clients de-registered) - which - would call into the already-unloaded tools-library. */ - } - OUString PcrRes(const char* pId) { return Translate::get(pId, Translate::Create("pcr")); diff --git a/extensions/source/propctrlr/modulepcr.hxx b/extensions/source/propctrlr/modulepcr.hxx index d29c2fd2c969..ee44cc6bbad3 100644 --- a/extensions/source/propctrlr/modulepcr.hxx +++ b/extensions/source/propctrlr/modulepcr.hxx @@ -20,21 +20,10 @@ #ifndef INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MODULEPCR_HXX #define INCLUDED_EXTENSIONS_SOURCE_PROPCTRLR_MODULEPCR_HXX -#include <comphelper/componentmodule.hxx> +#include <rtl/ustring.hxx> namespace pcr { - /* -------------------------------------------------------------------- */ - class PcrModule : public ::comphelper::OModule - { - friend struct CreateModuleClass; - typedef ::comphelper::OModule BaseClass; - public: - static PcrModule& getInstance(); - private: - PcrModule(); - }; - OUString PcrRes(const char* pId); } // namespace pcr diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx index 49e876b0a232..99447d5c8a3f 100644 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ b/extensions/source/propctrlr/objectinspectormodel.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/ucb/AlreadyInitializedException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> namespace pcr diff --git a/include/comphelper/componentmodule.hxx b/include/comphelper/componentmodule.hxx index 78d71138d519..1d52cfd067b9 100644 --- a/include/comphelper/componentmodule.hxx +++ b/include/comphelper/componentmodule.hxx @@ -34,45 +34,6 @@ namespace comphelper { - /** factory declaration - */ - typedef css::uno::Reference< css::lang::XSingleComponentFactory > (*FactoryInstantiation) - ( - ::cppu::ComponentFactoryFunc _pFactoryFunc, - OUString const& _rComponentName, - css::uno::Sequence< OUString > const & _rServiceNames, - rtl_ModuleCount* - ); - - - //= ComponentDescription - - struct COMPHELPER_DLLPUBLIC ComponentDescription - { - /// the implementation name of the component - OUString const sImplementationName; - /// the services supported by the component implementation - css::uno::Sequence< OUString > const aSupportedServices; - /// the function to create an instance of the component - ::cppu::ComponentFactoryFunc const pComponentCreationFunc; - /// the function to create a factory for the component (usually <code>::cppu::createSingleComponentFactory</code>) - FactoryInstantiation const pFactoryCreationFunc; - - ComponentDescription( - const OUString& _rImplementationName, - const css::uno::Sequence< OUString >& _rSupportedServices, - ::cppu::ComponentFactoryFunc _pComponentCreationFunc, - FactoryInstantiation _pFactoryCreationFunc - ) - :sImplementationName( _rImplementationName ) - ,aSupportedServices( _rSupportedServices ) - ,pComponentCreationFunc( _pComponentCreationFunc ) - ,pFactoryCreationFunc( _pFactoryCreationFunc ) - { - } - }; - - //= OModule class OModuleImpl; @@ -89,10 +50,6 @@ namespace comphelper virtual ~OModule(); - /** registers a component given by ComponentDescription - */ - void registerImplementation( const ComponentDescription& _rComp ); - private: OModule( const OModule& ) = delete; OModule& operator=( const OModule& ) = delete; diff --git a/include/comphelper/servicedecl.hxx b/include/comphelper/servicedecl.hxx index 8a25d8e5a911..6cd24699cd2b 100644 --- a/include/comphelper/servicedecl.hxx +++ b/include/comphelper/servicedecl.hxx @@ -140,188 +140,9 @@ template <bool> struct with_args; /// @internal namespace detail { -template <typename ImplT> -class OwnServiceImpl - : public ImplT -{ - typedef ImplT BaseT; - -public: - OwnServiceImpl( const OwnServiceImpl& ) = delete; - OwnServiceImpl& operator=( const OwnServiceImpl& ) = delete; - OwnServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const& args, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {} - OwnServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - : BaseT(xContext), m_rServiceDecl(rServiceDecl) {} - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override { - return m_rServiceDecl.getImplementationName(); - } - virtual sal_Bool SAL_CALL supportsService( OUString const& name ) override { - return m_rServiceDecl.supportsService(name); - } - virtual css::uno::Sequence< OUString> - SAL_CALL getSupportedServiceNames() override { - return m_rServiceDecl.getSupportedServiceNames(); - } - -private: - ServiceDecl const& m_rServiceDecl; -}; - -template <typename ImplT> -class ServiceImpl final : public OwnServiceImpl< ::cppu::ImplInheritanceHelper<ImplT,css::lang::XServiceInfo> > -{ -typedef OwnServiceImpl< ::cppu::ImplInheritanceHelper<ImplT,css::lang::XServiceInfo> > ServiceImpl_BASE; -public: - ServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const& args, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - : ServiceImpl_BASE(rServiceDecl, args, xContext) {} - ServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - : ServiceImpl_BASE(rServiceDecl, xContext) {} -}; - -template <typename ImplT> -class InheritingServiceImpl final : public OwnServiceImpl< ImplT > -{ -typedef OwnServiceImpl< ImplT > ServiceImpl_BASE; -public: - InheritingServiceImpl( - ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const& args, - css::uno::Reference<css::uno::XComponentContext> const& xContext ) - : ServiceImpl_BASE(rServiceDecl, args, xContext) {} -}; - -template <typename ServiceImplT> -struct PostProcessDefault { - css::uno::Reference<css::uno::XInterface> - operator()( ServiceImplT * p ) const { - return static_cast<css::lang::XServiceInfo *>(p); - } -}; - -template <typename ImplT, typename PostProcessFuncT, typename WithArgsT> -struct CreateFunc; - -template <typename ImplT, typename PostProcessFuncT> -struct CreateFunc<ImplT, PostProcessFuncT, with_args<false> > { - PostProcessFuncT const m_postProcessFunc; - explicit CreateFunc( PostProcessFuncT const& postProcessFunc ) - : m_postProcessFunc(postProcessFunc) {} - - css::uno::Reference<css::uno::XInterface> - operator()( ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const&, - css::uno::Reference<css::uno::XComponentContext> - const& xContext ) const - { - return m_postProcessFunc( - new ImplT( rServiceDecl, xContext ) ); - } -}; - -template <typename ImplT, typename PostProcessFuncT> -struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > { - PostProcessFuncT const m_postProcessFunc; - explicit CreateFunc( PostProcessFuncT const& postProcessFunc ) - : m_postProcessFunc(postProcessFunc) {} - - css::uno::Reference<css::uno::XInterface> - operator()( ServiceDecl const& rServiceDecl, - css::uno::Sequence<css::uno::Any> const& args, - css::uno::Reference<css::uno::XComponentContext> - const& xContext ) const - { - return m_postProcessFunc( - new ImplT( rServiceDecl, args, xContext ) ); - } -}; } // namespace detail -/** Defines a service implementation class. - - @tpl ImplT_ service implementation class - @WithArgsT whether the implementation class ctor expects arguments - (uno::Sequence<uno::Any>, uno::Reference<uno::XComponentContext>) - or just (uno::Reference<uno::XComponentContext>) -*/ -template <typename ImplT_, typename WithArgsT = with_args<false> > -struct serviceimpl_base { - typedef ImplT_ ImplT; - - detail::CreateFuncF const m_createFunc; - - typedef detail::PostProcessDefault<ImplT> PostProcessDefaultT; - - /** Default ctor. Implementation class without args, expecting - component context as single argument. - */ - serviceimpl_base() : m_createFunc( - detail::CreateFunc<ImplT, PostProcessDefaultT, WithArgsT>( - PostProcessDefaultT() ) ) {} - - /** Ctor to pass a post processing function/functor. - - @tpl PostProcessDefaultT let your compiler deduce this - @param postProcessFunc function/functor that gets the yet unacquired - ImplT_ pointer returning a - uno::Reference<uno::XInterface> - */ - template <typename PostProcessFuncT> - explicit serviceimpl_base( PostProcessFuncT const& postProcessFunc ) - : m_createFunc( detail::CreateFunc<ImplT, PostProcessFuncT, WithArgsT>( - postProcessFunc ) ) {} -}; - -template <typename ImplT_, typename WithArgsT = with_args<false> > -struct class_ : public serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT > -{ - typedef serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT > baseT; - /** Default ctor. Implementation class without args, expecting - component context as single argument. - */ - class_() : baseT() {} - template <typename PostProcessFuncT> - /** Ctor to pass a post processing function/functor. - - @tpl PostProcessDefaultT let your compiler deduce this - @param postProcessFunc function/functor that gets the yet unacquired - ImplT_ pointer returning a - uno::Reference<uno::XInterface> - */ - explicit class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} -}; - -template <typename ImplT_, typename WithArgsT = with_args<false> > -struct inheritingClass_ : public serviceimpl_base< detail::InheritingServiceImpl<ImplT_>, WithArgsT > -{ - typedef serviceimpl_base< detail::InheritingServiceImpl<ImplT_>, WithArgsT > baseT; - /** Default ctor. Implementation class without args, expecting - component context as single argument. - */ - inheritingClass_() : baseT() {} - template <typename PostProcessFuncT> - /** Ctor to pass a post processing function/functor. - - @tpl PostProcessDefaultT let your compiler deduce this - @param postProcessFunc function/functor that gets the yet unacquired - ImplT_ pointer returning a - uno::Reference<uno::XInterface> - */ - explicit inheritingClass_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {} -}; COMPHELPER_DLLPUBLIC void* component_getFactoryHelper( const char* pImplName, diff --git a/include/sfx2/sfxmodelfactory.hxx b/include/sfx2/sfxmodelfactory.hxx index 1096eca788b1..4d166c4d4eed 100644 --- a/include/sfx2/sfxmodelfactory.hxx +++ b/include/sfx2/sfxmodelfactory.hxx @@ -47,29 +47,6 @@ namespace o3tl namespace sfx2 { - typedef css::uno::Reference< css::uno::XInterface > ( * SfxModelFactoryFunc ) ( - const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory, - SfxModelFlags _nCreationFlags - ); - - - //= createSfxModelFactory - - /** creates a XSingleServiceFactory which can be used to created instances - of classes derived from SfxBaseModel - - In opposite to the default implementations from module cppuhelper, this - factory evaluates certain creation arguments (passed to createInstanceWithArguments) - and passes them to the factory function of the derived class. - */ - css::uno::Reference< css::lang::XSingleServiceFactory > - SFX2_DLLPUBLIC createSfxModelFactory( - const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxServiceFactory, - const OUString& _rImplementationName, - const SfxModelFactoryFunc _pComponentFactoryFunc, - const css::uno::Sequence< OUString >& _rServiceNames - ); - /** * Intended to be called from UNO constructor functions * This evaluates certain creation arguments (passed to createInstanceWithArguments) diff --git a/include/vbahelper/helperdecl.hxx b/include/vbahelper/helperdecl.hxx deleted file mode 100644 index 4d46d4ea1a4a..000000000000 --- a/include/vbahelper/helperdecl.hxx +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_VBAHELPER_HELPERDECL_HXX -#define INCLUDED_VBAHELPER_HELPERDECL_HXX - -#include <comphelper/servicedecl.hxx> - -namespace comphelper::service_decl { -template <typename ImplT_, typename WithArgsT = with_args<false> > -struct vba_service_class_ : public serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > -{ - typedef serviceimpl_base< detail::OwnServiceImpl<ImplT_>, WithArgsT > baseT; - /** Default ctor. Implementation class without args, expecting - component context as single argument. - */ - vba_service_class_() : baseT() {} -}; - -} // namespace comphelper::service_decl - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/pch/precompiled_vbaobj.hxx b/sc/inc/pch/precompiled_vbaobj.hxx index 31aa4e7660cb..ae93f9bf6540 100644 --- a/sc/inc/pch/precompiled_vbaobj.hxx +++ b/sc/inc/pch/precompiled_vbaobj.hxx @@ -300,7 +300,6 @@ #include <tools/diagnose_ex.h> #include <tools/urlobj.hxx> #include <unotools/eventcfg.hxx> -#include <vbahelper/helperdecl.hxx> #include <vbahelper/vbaaccesshelper.hxx> #include <vbahelper/vbacollectionimpl.hxx> #include <vbahelper/vbahelper.hxx> diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index bb59a92c0ebb..af9af62e5d3d 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -76,7 +76,6 @@ #include <cellsuno.hxx> #include <unonames.hxx> #include <docsh.hxx> -#include <vbahelper/helperdecl.hxx> #include "excelvbahelper.hxx" #include <basic/sbxobj.hxx> diff --git a/sc/source/ui/vba/vbahyperlink.cxx b/sc/source/ui/vba/vbahyperlink.cxx index 74a512bb6bda..9b5140cd0fb1 100644 --- a/sc/source/ui/vba/vbahyperlink.cxx +++ b/sc/source/ui/vba/vbahyperlink.cxx @@ -20,7 +20,6 @@ #include <sal/config.h> #include "vbahyperlink.hxx" -#include <vbahelper/helperdecl.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/frame/XModel.hpp> diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 1ea6f81d4055..91f6956a267d 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -19,8 +19,6 @@ #include "vbarange.hxx" -#include <vbahelper/helperdecl.hxx> - #include <comphelper/types.hxx> #include <cppuhelper/exc_hlp.hxx> #include <o3tl/any.hxx> diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index 6f9d5291db61..ec76e2aca68b 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -16,7 +16,6 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vbahelper/helperdecl.hxx> #include "excelvbahelper.hxx" #include "vbawindow.hxx" #include "vbaworksheets.hxx" diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx index b41a7ed72b01..d5fbb6b0e070 100644 --- a/sc/source/ui/vba/vbaworkbook.cxx +++ b/sc/source/ui/vba/vbaworkbook.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vbahelper/helperdecl.hxx> #include <tools/urlobj.hxx> #include <com/sun/star/util/XProtectable.hpp> diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index afb977df2152..4b66c0a776ff 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vbahelper/helperdecl.hxx> - #include "vbaworksheet.hxx" #include "vbanames.hxx" diff --git a/sfx2/source/doc/sfxmodelfactory.cxx b/sfx2/source/doc/sfxmodelfactory.cxx index fbb1b24382de..556b3f00f5bf 100644 --- a/sfx2/source/doc/sfxmodelfactory.cxx +++ b/sfx2/source/doc/sfxmodelfactory.cxx @@ -52,80 +52,6 @@ namespace sfx2 using ::com::sun::star::lang::XInitialization; - //= SfxModelFactory - declaration - - typedef ::cppu::WeakImplHelper < XSingleServiceFactory - , XServiceInfo - > SfxModelFactory_Base; - - namespace { - - /** implements a XSingleServiceFactory which can be used to created instances - of classes derived from SfxBaseModel - - In opposite to the default implementations from module cppuhelper, this - factory evaluates certain creation arguments (passed to createInstanceWithArguments) - and passes them to the factory function of the derived class. - */ - class SfxModelFactory : public SfxModelFactory_Base - { - public: - SfxModelFactory( - const Reference< XMultiServiceFactory >& _rxServiceFactory, - const OUString& _rImplementationName, - const SfxModelFactoryFunc _pComponentFactoryFunc, - const Sequence< OUString >& _rServiceNames - ); - - // XSingleServiceFactory - virtual Reference< XInterface > SAL_CALL createInstance( ) override; - virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& aArguments ) override; - - static css::uno::Reference<css::uno::XInterface> create( - const css::uno::Sequence<css::uno::Any> & rxArgs, - std::function<css::uno::Reference<css::uno::XInterface>(SfxModelFlags)> creationFunc); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - - protected: - virtual ~SfxModelFactory() override; - - private: - const Reference< XMultiServiceFactory > m_xServiceFactory; - const OUString m_sImplementationName; - const Sequence< OUString > m_aServiceNames; - const SfxModelFactoryFunc m_pComponentFactoryFunc; - }; - - } - - //= SfxModelFactory - implementation - - - SfxModelFactory::SfxModelFactory( const Reference< XMultiServiceFactory >& _rxServiceFactory, - const OUString& _rImplementationName, const SfxModelFactoryFunc _pComponentFactoryFunc, - const Sequence< OUString >& _rServiceNames ) - :m_xServiceFactory( _rxServiceFactory ) - ,m_sImplementationName( _rImplementationName ) - ,m_aServiceNames( _rServiceNames ) - ,m_pComponentFactoryFunc( _pComponentFactoryFunc ) - { - } - - - SfxModelFactory::~SfxModelFactory() - { - } - - - Reference< XInterface > SAL_CALL SfxModelFactory::createInstance( ) - { - return createInstanceWithArguments( Sequence< Any >() ); - } - namespace { @@ -148,18 +74,9 @@ namespace sfx2 } - Reference< XInterface > SAL_CALL SfxModelFactory::createInstanceWithArguments( const Sequence< Any >& _rArguments ) - { - return create(_rArguments, - [&](SfxModelFlags _nCreationFlags) - { - return m_pComponentFactoryFunc(m_xServiceFactory, _nCreationFlags).get(); - }); - } - - css::uno::Reference<css::uno::XInterface> SfxModelFactory::create( - const css::uno::Sequence<css::uno::Any> & _rArguments, - std::function<css::uno::Reference<css::uno::XInterface>(SfxModelFlags)> creationFunc) + css::uno::Reference<css::uno::XInterface> createSfxModelInstance( + const css::uno::Sequence<css::uno::Any> & _rArguments, + std::function<css::uno::Reference<css::uno::XInterface>(SfxModelFlags)> creationFunc) { ::comphelper::NamedValueCollection aArgs( _rArguments ); const bool bEmbeddedObject = aArgs.getOrDefault( "EmbeddedObject", false ); @@ -196,34 +113,7 @@ namespace sfx2 return xInstance; } - OUString SAL_CALL SfxModelFactory::getImplementationName( ) - { - return m_sImplementationName; - } - - sal_Bool SAL_CALL SfxModelFactory::supportsService( const OUString& _rServiceName ) - { - return cppu::supportsService(this, _rServiceName); - } - - Sequence< OUString > SAL_CALL SfxModelFactory::getSupportedServiceNames( ) - { - return m_aServiceNames; - } - - css::uno::Reference<css::uno::XInterface> createSfxModelInstance( - const css::uno::Sequence<css::uno::Any> & rxArgs, - std::function<css::uno::Reference<css::uno::XInterface>(SfxModelFlags)> creationFunc) - { - return SfxModelFactory::create(rxArgs, creationFunc); - } - Reference< XSingleServiceFactory > createSfxModelFactory( const Reference< XMultiServiceFactory >& _rxServiceFactory, - const OUString& _rImplementationName, const SfxModelFactoryFunc _pComponentFactoryFunc, - const Sequence< OUString >& _rServiceNames ) - { - return new SfxModelFactory( _rxServiceFactory, _rImplementationName, _pComponentFactoryFunc, _rServiceNames ); - } } // namespace sfx2 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index beb74b865e98..fa93e0bcd10f 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -43,7 +43,6 @@ #include <ooo/vba/word/WdSaveFormat.hpp> #include <ooo/vba/word/XDocumentOutgoing.hpp> -#include <vbahelper/helperdecl.hxx> #include "wordvbahelper.hxx" #include <docsh.hxx> #include "vbatemplate.hxx" diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx index 7041b3b24d7b..7f37f92d5ef6 100644 --- a/sw/source/ui/vba/vbaglobals.cxx +++ b/sw/source/ui/vba/vbaglobals.cxx @@ -16,7 +16,6 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vbahelper/helperdecl.hxx> #include "vbaglobals.hxx" #include <sal/log.hxx> diff --git a/sw/source/ui/vba/vbawrapformat.cxx b/sw/source/ui/vba/vbawrapformat.cxx index a8c1d69729f9..0e77d3c58341 100644 --- a/sw/source/ui/vba/vbawrapformat.cxx +++ b/sw/source/ui/vba/vbawrapformat.cxx @@ -26,7 +26,6 @@ #include <com/sun/star/text/WrapTextMode.hpp> #include <basic/sberrors.hxx> #include <vbahelper/vbahelper.hxx> -#include <vbahelper/helperdecl.hxx> using namespace ooo::vba; using namespace com::sun::star; diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index e2719bc135e9..a76f67543d61 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -16,7 +16,6 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vbahelper/helperdecl.hxx> #include "vbauserform.hxx" #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XControlContainer.hpp> |