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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 22 09:16:47 UTC 2021


 extensions/source/bibliography/toolbar.cxx           |    4 +--
 extensions/source/propctrlr/formcomponenthandler.cxx |   10 ++++-----
 extensions/source/propctrlr/propcontroller.cxx       |   20 +++++++++----------
 extensions/source/scanner/scanunx.cxx                |    5 +---
 4 files changed, 19 insertions(+), 20 deletions(-)

New commits:
commit 7be139f114f5f14588e06f8224b0b978db833de2
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Sun Feb 21 20:02:40 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Feb 22 10:16:08 2021 +0100

    loplugin:refcounting in extensions
    
    Change-Id: Ie4e4c771542ce38ce8197667f6374cc191a44ee9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111286
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index ae054801d8db..ea8ae0eeaee8 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -295,8 +295,8 @@ void BibToolBar::InitListener()
     util::URL aQueryURL;
     aQueryURL.Complete = ".uno:Bib/MenuFilter";
     xTrans->parseStrict( aQueryURL);
-    BibToolBarListener* pQuery=new BibTBQueryMenuListener(this, aQueryURL.Complete, nTBC_BT_AUTOFILTER);
-    xDisp->addStatusListener(uno::Reference< frame::XStatusListener > (pQuery),aQueryURL);
+    rtl::Reference<BibToolBarListener> pQuery=new BibTBQueryMenuListener(this, aQueryURL.Complete, nTBC_BT_AUTOFILTER);
+    xDisp->addStatusListener(pQuery, aQueryURL);
 
     for(ToolBox::ImplToolItems::size_type nPos=0;nPos<nCount;nPos++)
     {
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index fd555b4867ad..1fd26057a110 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -992,7 +992,7 @@ namespace pcr
         {
             std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/urlcontrol.ui", m_xContext));
             auto pURLBox = std::make_unique<SvtURLBox>(xBuilder->weld_combo_box("urlcontrol"));
-            auto pControl = new OFileUrlControl(std::move(pURLBox), std::move(xBuilder), false);
+            rtl::Reference<OFileUrlControl> pControl = new OFileUrlControl(std::move(pURLBox), std::move(xBuilder), false);
             pControl->SetModifyHandler();
             aDescriptor.Control = pControl;
 
@@ -1095,7 +1095,7 @@ namespace pcr
                     {
                         std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/formattedsample.ui", m_xContext));
                         auto pContainer = xBuilder->weld_container("formattedsample");
-                        auto pControl = new OFormatSampleControl(std::move(pContainer), std::move(xBuilder), false);
+                        rtl::Reference<OFormatSampleControl> pControl = new OFormatSampleControl(std::move(pContainer), std::move(xBuilder), false);
                         pControl->SetModifyHandler();
 
                         pControl->SetFormatSupplier(pSupplier);
@@ -1110,7 +1110,7 @@ namespace pcr
                         auto pSpinButton = xBuilder->weld_formatted_spin_button("formattedcontrol");
                         // for ui-testing try and distinguish different instances of this formatted control
                         pSpinButton->set_buildable_name(pSpinButton->get_buildable_name() + "-" + aDescriptor.DisplayName.toUtf8());
-                        auto pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false);
+                        rtl::Reference<OFormattedNumericControl> pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false);
                         pControl->SetModifyHandler();
 
                         FormatDescription aDesc;
@@ -1151,7 +1151,7 @@ namespace pcr
             auto pSpinButton = xBuilder->weld_formatted_spin_button("formattedcontrol");
             // for ui-testing try and distinguish different instances of this formatted control
             pSpinButton->set_buildable_name(pSpinButton->get_buildable_name() + "-" + aDescriptor.DisplayName.toUtf8());
-            auto pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false);
+            rtl::Reference<OFormattedNumericControl> pControl = new OFormattedNumericControl(std::move(pSpinButton), std::move(xBuilder), false);
             pControl->SetModifyHandler();
             aDescriptor.Control = pControl;
 
@@ -1285,7 +1285,7 @@ namespace pcr
             {
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/numericfield.ui", m_xContext));
                 auto pSpinButton = xBuilder->weld_metric_spin_button("numericfield", FieldUnit::MILLISECOND);
-                auto pControl = new ONumericControl(std::move(pSpinButton), std::move(xBuilder), bReadOnly);
+                rtl::Reference<ONumericControl> pControl = new ONumericControl(std::move(pSpinButton), std::move(xBuilder), bReadOnly);
                 pControl->SetModifyHandler();
                 pControl->setMinValue( Optional< double >( true, 0 ) );
                 pControl->setMaxValue( Optional< double >( true, std::numeric_limits< double >::max() ) );
diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx
index 6f9ff0e547e6..bde1e1f56e3e 100644
--- a/extensions/source/propctrlr/propcontroller.cxx
+++ b/extensions/source/propctrlr/propcontroller.cxx
@@ -693,7 +693,7 @@ namespace pcr
                 bool bMultiLineTextField = ControlType == PropertyControlType::MultiLineTextField;
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/multiline.ui", m_xContext));
                 auto pContainer = xBuilder->weld_container("multiline");
-                auto pControl = new OMultilineEditControl(std::move(pContainer), std::move(xBuilder),
+                rtl::Reference<OMultilineEditControl> pControl = new OMultilineEditControl(std::move(pContainer), std::move(xBuilder),
                                                           bMultiLineTextField ? eMultiLineText : eStringList, bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
@@ -704,7 +704,7 @@ namespace pcr
             {
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/listbox.ui", m_xContext));
                 auto pComboBox = xBuilder->weld_combo_box("listbox");
-                auto pControl = new OListboxControl(std::move(pComboBox), std::move(xBuilder), bCreateReadOnly);
+                rtl::Reference<OListboxControl> pControl = new OListboxControl(std::move(pComboBox), std::move(xBuilder), bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
                 break;
@@ -714,7 +714,7 @@ namespace pcr
             {
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/combobox.ui", m_xContext));
                 auto pComboBox = xBuilder->weld_combo_box("combobox");
-                auto pControl = new OComboboxControl(std::move(pComboBox), std::move(xBuilder), bCreateReadOnly);
+                rtl::Reference<OComboboxControl> pControl = new OComboboxControl(std::move(pComboBox), std::move(xBuilder), bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
                 break;
@@ -726,7 +726,7 @@ namespace pcr
                 bool bCharacterField = ControlType == PropertyControlType::CharacterField;
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/textfield.ui", m_xContext));
                 auto pEntry = xBuilder->weld_entry("textfield");
-                auto pControl = new OEditControl(std::move(pEntry), std::move(xBuilder), bCharacterField, bCreateReadOnly);
+                rtl::Reference<OEditControl> pControl = new OEditControl(std::move(pEntry), std::move(xBuilder), bCharacterField, bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
                 break;
@@ -736,7 +736,7 @@ namespace pcr
             {
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/numericfield.ui", m_xContext));
                 auto pSpinButton = xBuilder->weld_metric_spin_button("numericfield", FieldUnit::NONE);
-                auto pControl = new ONumericControl(std::move(pSpinButton), std::move(xBuilder), bCreateReadOnly);
+                rtl::Reference<ONumericControl> pControl = new ONumericControl(std::move(pSpinButton), std::move(xBuilder), bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
                 break;
@@ -746,7 +746,7 @@ namespace pcr
             {
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/datetimefield.ui", m_xContext));
                 auto pContainer = xBuilder->weld_container("datetimefield");
-                auto pControl = new ODateTimeControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly);
+                rtl::Reference<ODateTimeControl> pControl = new ODateTimeControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
                 break;
@@ -756,7 +756,7 @@ namespace pcr
             {
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/datefield.ui", m_xContext));
                 auto pMenuButton = xBuilder->weld_menu_button("datefield");
-                auto pControl = new ODateControl(std::make_unique<SvtCalendarBox>(std::move(pMenuButton)), std::move(xBuilder), bCreateReadOnly);
+                rtl::Reference<ODateControl> pControl = new ODateControl(std::make_unique<SvtCalendarBox>(std::move(pMenuButton)), std::move(xBuilder), bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
                 break;
@@ -766,7 +766,7 @@ namespace pcr
             {
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/timefield.ui", m_xContext));
                 auto pTimeSpinButton = xBuilder->weld_formatted_spin_button("timefield");
-                auto pControl = new OTimeControl(std::move(pTimeSpinButton), std::move(xBuilder), bCreateReadOnly);
+                rtl::Reference<OTimeControl> pControl = new OTimeControl(std::move(pTimeSpinButton), std::move(xBuilder), bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
                 break;
@@ -777,7 +777,7 @@ namespace pcr
                 weld::Window* pTopLevel = PropertyHandlerHelper::getDialogParentFrame(m_xContext);
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/colorlistbox.ui", m_xContext));
                 auto pMenuButton = xBuilder->weld_menu_button("colorlistbox");
-                auto pControl = new OColorControl(std::make_unique<ColorListBox>(std::move(pMenuButton), pTopLevel), std::move(xBuilder), bCreateReadOnly);
+                rtl::Reference<OColorControl> pControl = new OColorControl(std::make_unique<ColorListBox>(std::move(pMenuButton), pTopLevel), std::move(xBuilder), bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
                 break;
@@ -787,7 +787,7 @@ namespace pcr
             {
                 std::unique_ptr<weld::Builder> xBuilder(PropertyHandlerHelper::makeBuilder("modules/spropctrlr/ui/hyperlinkfield.ui", m_xContext));
                 auto pContainer = xBuilder->weld_container("hyperlinkfield");
-                auto pControl = new OHyperlinkControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly);
+                rtl::Reference<OHyperlinkControl> pControl = new OHyperlinkControl(std::move(pContainer), std::move(xBuilder), bCreateReadOnly);
                 pControl->SetModifyHandler();
                 xControl = pControl;
                 break;
diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx
index 6a81f5fbf6e3..44787d46d0e6 100644
--- a/extensions/source/scanner/scanunx.cxx
+++ b/extensions/source/scanner/scanunx.cxx
@@ -157,10 +157,9 @@ void ScannerThread::run()
     osl_setThreadName("ScannerThread");
 
     osl::MutexGuard         aGuard( m_pHolder->m_aProtector );
-    BitmapTransporter*  pTransporter = new BitmapTransporter;
-    Reference< XInterface >   aIf( static_cast< OWeakObject* >( pTransporter ) );
+    rtl::Reference<BitmapTransporter> pTransporter = new BitmapTransporter;
 
-    m_pHolder->m_xBitmap.set( aIf, UNO_QUERY );
+    m_pHolder->m_xBitmap = pTransporter;
 
     m_pHolder->m_bBusy = true;
     if( m_pHolder->m_aSane.IsOpen() )


More information about the Libreoffice-commits mailing list