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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 28 06:39:31 UTC 2019


 toolkit/source/helper/formpdfexport.cxx |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit c95b13c1ad9e01462180feb996ef4efb764eb879
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Mar 27 09:46:39 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Mar 28 07:39:03 2019 +0100

    return by unique_ptr from createDefaultWidget
    
    Change-Id: I2b2c944ed090173aba36395457a84985f0cf6665
    Reviewed-on: https://gerrit.libreoffice.org/69794
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx
index 3c8d7343a136..8b4a69b93861 100644
--- a/toolkit/source/helper/formpdfexport.cxx
+++ b/toolkit/source/helper/formpdfexport.cxx
@@ -86,20 +86,20 @@ namespace toolkitform
 
         /** (default-)creates a PDF widget according to a given FormComponentType
         */
-        vcl::PDFWriter::AnyWidget* createDefaultWidget( sal_Int16 _nFormComponentType )
+        std::unique_ptr<vcl::PDFWriter::AnyWidget> createDefaultWidget( sal_Int16 _nFormComponentType )
         {
             switch ( _nFormComponentType )
             {
             case FormComponentType::COMMANDBUTTON:
-                return new vcl::PDFWriter::PushButtonWidget;
+                return std::make_unique<vcl::PDFWriter::PushButtonWidget>();
             case FormComponentType::CHECKBOX:
-                return new vcl::PDFWriter::CheckBoxWidget;
+                return std::make_unique<vcl::PDFWriter::CheckBoxWidget>();
             case FormComponentType::RADIOBUTTON:
-                return new vcl::PDFWriter::RadioButtonWidget;
+                return std::make_unique<vcl::PDFWriter::RadioButtonWidget>();
             case FormComponentType::LISTBOX:
-                return new vcl::PDFWriter::ListBoxWidget;
+                return std::make_unique<vcl::PDFWriter::ListBoxWidget>();
             case FormComponentType::COMBOBOX:
-                return new vcl::PDFWriter::ComboBoxWidget;
+                return std::make_unique<vcl::PDFWriter::ComboBoxWidget>();
 
             case FormComponentType::TEXTFIELD:
             case FormComponentType::FILECONTROL:
@@ -108,7 +108,7 @@ namespace toolkitform
             case FormComponentType::NUMERICFIELD:
             case FormComponentType::CURRENCYFIELD:
             case FormComponentType::PATTERNFIELD:
-                return new vcl::PDFWriter::EditWidget;
+                return std::make_unique<vcl::PDFWriter::EditWidget>();
             }
             return nullptr;
         }
@@ -288,7 +288,7 @@ namespace toolkitform
         {
             Reference< XPropertySet > xModelProps( _rxControl->getModel(), UNO_QUERY );
             sal_Int16 nControlType = classifyFormControl( xModelProps );
-            Descriptor.reset( createDefaultWidget( nControlType ) );
+            Descriptor = createDefaultWidget( nControlType );
             if (!Descriptor)
                 // no PDF widget available for this
                 return Descriptor;


More information about the Libreoffice-commits mailing list