[Libreoffice-commits] core.git: 2 commits - cui/source cui/uiconfig solenv/sanitizers sw/inc sw/source sw/uiconfig

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Mar 2 13:05:57 UTC 2019


 cui/source/customize/SvxToolbarConfigPage.cxx |    9 
 cui/source/customize/cfg.cxx                  |  277 +++++++++-----------------
 cui/source/inc/cfg.hxx                        |   29 +-
 cui/uiconfig/ui/iconselectordialog.ui         |   36 ++-
 solenv/sanitizers/ui/modules/swriter.suppr    |    4 
 sw/inc/swabstdlg.hxx                          |    2 
 sw/source/ui/dialog/abstract.cxx              |   21 -
 sw/source/ui/dialog/swdlgfact.cxx             |   15 -
 sw/source/ui/dialog/swdlgfact.hxx             |   10 
 sw/source/uibase/app/docsh2.cxx               |    2 
 sw/source/uibase/inc/abstract.hxx             |   11 -
 sw/uiconfig/swriter/ui/abstractdialog.ui      |   26 +-
 12 files changed, 195 insertions(+), 247 deletions(-)

New commits:
commit 91548e11b37f52aed476996d7d97ad2b45e43ed5
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 1 17:22:49 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Mar 2 14:05:50 2019 +0100

    weld SvxIconSelectorDialog
    
    and use a ValueSet here instead of the odd toolbar use
    
    Change-Id: Ic2e78664ebde31751055d2c9fec66c7dabe8d05f
    Reviewed-on: https://gerrit.libreoffice.org/68598
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 6775c37e4a86..56c9c85c6734 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -557,15 +557,14 @@ IMPL_LINK( SvxToolbarConfigPage, ModifyItemHdl, MenuButton *, pButton, void )
         // TODO: Add a GetSelectionPos() method to the SvTreeListBox class
         sal_uInt16 nSelectionPos = m_pContentsListBox->GetModel()->GetAbsPos( pActEntry );
 
-        ScopedVclPtr<SvxIconSelectorDialog> pIconDialog(
-            VclPtr<SvxIconSelectorDialog>::Create( nullptr,
+        SvxIconSelectorDialog aIconDialog(GetDialogFrameWeld(),
                 GetSaveInData()->GetImageManager(),
-                GetSaveInData()->GetParentImageManager() ));
+                GetSaveInData()->GetParentImageManager());
 
-        if ( pIconDialog->Execute() == RET_OK )
+        if (aIconDialog.run() == RET_OK)
         {
             css::uno::Reference< css::graphic::XGraphic > newgraphic =
-                pIconDialog->GetSelectedIcon();
+                aIconDialog.GetSelectedIcon();
 
             if ( newgraphic.is() )
             {
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index cb5b083dddc4..45301ee71b60 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2841,30 +2841,20 @@ SvxNewToolbarDialog::~SvxNewToolbarDialog()
 * The SvxIconSelectorDialog class
 *
 *******************************************************************************/
-SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
+SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow,
     const uno::Reference< css::ui::XImageManager >& rXImageManager,
-    const uno::Reference< css::ui::XImageManager >& rXParentImageManager )
-    :
-    ModalDialog          ( pWindow, "IconSelector", "cui/ui/iconselectordialog.ui" ),
-    m_nNextId            ( 0 ),
-    m_xImageManager      ( rXImageManager ),
-    m_xParentImageManager( rXParentImageManager )
-{
-    get(pTbSymbol, "symbolsToolbar");
-    get(pFtNote, "noteLabel");
-    get(pBtnImport, "importButton");
-    get(pBtnDelete, "deleteButton");
-
-    Size aTbSize = pTbSymbol->LogicToPixel(Size(160, 80), MapMode(MapUnit::MapAppFont));
-    pTbSymbol->set_width_request(aTbSize.Width());
-    pTbSymbol->set_height_request(aTbSize.Height());
-    pTbSymbol->SetStyle(pTbSymbol->GetStyle() | WB_SCROLL);
-    pTbSymbol->SetLineSpacing(true);
-
+    const uno::Reference< css::ui::XImageManager >& rXParentImageManager)
+    : GenericDialogController(pWindow, "cui/ui/iconselectordialog.ui", "IconSelector")
+    , m_xImageManager(rXImageManager)
+    , m_xParentImageManager(rXParentImageManager)
+    , m_xTbSymbol(new SvtValueSet(m_xBuilder->weld_scrolled_window("symbolswin")))
+    , m_xTbSymbolWin(new weld::CustomWeld(*m_xBuilder, "symbolsToolbar", *m_xTbSymbol))
+    , m_xFtNote(m_xBuilder->weld_label("noteLabel"))
+    , m_xBtnImport(m_xBuilder->weld_button("importButton"))
+    , m_xBtnDelete(m_xBuilder->weld_button("deleteButton"))
+{
     typedef std::unordered_map< OUString, bool > ImageInfo;
 
-    pTbSymbol->SetPageScroll( true );
-
     m_nExpectedSize = 16;
     if (SvxConfigPageHelper::GetImageType() & css::ui::ImageType::SIZE_LARGE)
         m_nExpectedSize = 26;
@@ -2873,9 +2863,18 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
 
     if ( m_nExpectedSize != 16 )
     {
-        pFtNote->SetText( SvxConfigPageHelper::replaceSixteen( pFtNote->GetText(), m_nExpectedSize ) );
+        m_xFtNote->set_label(SvxConfigPageHelper::replaceSixteen(m_xFtNote->get_label(), m_nExpectedSize));
     }
 
+    m_xTbSymbol->SetStyle(m_xTbSymbol->GetStyle() | WB_VSCROLL);
+    m_xTbSymbol->SetColCount(11);
+    m_xTbSymbol->SetLineCount(5);
+    m_xTbSymbol->SetItemWidth(m_nExpectedSize);
+    m_xTbSymbol->SetItemHeight(m_nExpectedSize);
+    m_xTbSymbol->SetExtraSpacing(6);
+    Size aSize(m_xTbSymbol->CalcWindowSizePixel(Size(m_nExpectedSize, m_nExpectedSize), 11, 5));
+    m_xTbSymbol->set_size_request(aSize.Width(), aSize.Height());
+
     uno::Reference< uno::XComponentContext > xComponentContext =
         ::comphelper::getProcessComponentContext();
 
@@ -2899,7 +2898,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
     }
     else
     {
-        pBtnImport->Enable( false );
+        m_xBtnImport->set_sensitive(false);
     }
 
     aDirectory += "soffice.cfg/import";
@@ -2930,7 +2929,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
         for ( sal_Int32 n = 0; n < names.getLength(); ++n )
             aImageInfo1.emplace( names[n], false );
     }
-    sal_uInt16 nId = 1;
+
     uno::Sequence< OUString > name( 1 );
     for (auto const& elem : aImageInfo1)
     {
@@ -2938,15 +2937,9 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
         uno::Sequence< uno::Reference< graphic::XGraphic> > graphics = m_xImportedImageManager->getImages( SvxConfigPageHelper::GetImageType(), name );
         if ( graphics.getLength() > 0 )
         {
-            Image img = Image( graphics[ 0 ] );
-            pTbSymbol->InsertItem( nId, img, elem.first );
-
-            graphics[ 0 ]->acquire();
-
-            pTbSymbol->SetItemData(
-                nId, static_cast< void * > ( graphics[ 0 ].get() ) );
-
-            ++nId;
+            m_aGraphics.push_back(graphics[0]);
+            Image img = Image(graphics[0]);
+            m_xTbSymbol->InsertItem(m_aGraphics.size(), img, elem.first);
         }
     }
 
@@ -2990,113 +2983,65 @@ SvxIconSelectorDialog::SvxIconSelectorDialog( vcl::Window *pWindow,
 
         if ( graphics.getLength() > 0 )
         {
-            Image img = Image( graphics[ 0 ] );
-            if ( !img.GetBitmapEx().IsEmpty() )
+            Image img = Image(graphics[0]);
+            if (!img.GetBitmapEx().IsEmpty())
             {
-                pTbSymbol->InsertItem( nId, img, elem.first );
-
-                uno::Reference< graphic::XGraphic > xGraphic = graphics[ 0 ];
-
-                if ( xGraphic.is() )
-                    xGraphic->acquire();
-
-                pTbSymbol->SetItemData(
-                    nId, static_cast< void * > ( xGraphic.get() ) );
-
-                ++nId;
+                m_aGraphics.push_back(graphics[0]);
+                m_xTbSymbol->InsertItem(m_aGraphics.size(), img, elem.first);
             }
         }
     }
 
-    pBtnDelete->Enable( false );
-    pTbSymbol->SetSelectHdl( LINK(this, SvxIconSelectorDialog, SelectHdl) );
-    pBtnImport->SetClickHdl( LINK(this, SvxIconSelectorDialog, ImportHdl) );
-    pBtnDelete->SetClickHdl( LINK(this, SvxIconSelectorDialog, DeleteHdl) );
-
-    m_nNextId = pTbSymbol->GetItemCount()+1;
-        //TODO: ToolBox::ImplToolItems::size_type -> sal_uInt16!
+    m_xBtnDelete->set_sensitive( false );
+    m_xTbSymbol->SetSelectHdl( LINK(this, SvxIconSelectorDialog, SelectHdl) );
+    m_xBtnImport->connect_clicked( LINK(this, SvxIconSelectorDialog, ImportHdl) );
+    m_xBtnDelete->connect_clicked( LINK(this, SvxIconSelectorDialog, DeleteHdl) );
 }
 
 SvxIconSelectorDialog::~SvxIconSelectorDialog()
 {
-    disposeOnce();
-}
-
-void SvxIconSelectorDialog::dispose()
-{
-    if (pTbSymbol)
-    {
-        ToolBox::ImplToolItems::size_type nCount = pTbSymbol->GetItemCount();
-
-        for (ToolBox::ImplToolItems::size_type n = 0; n < nCount; ++n )
-        {
-            sal_uInt16 nId = pTbSymbol->GetItemId(n);
-
-            uno::XInterface* xi = static_cast< uno::XInterface* >(
-                pTbSymbol->GetItemData( nId ) );
-
-            if ( xi != nullptr )
-            xi->release();
-        }
-    }
-
-    pTbSymbol.clear();
-    pFtNote.clear();
-    pBtnImport.clear();
-    pBtnDelete.clear();
-    ModalDialog::dispose();
 }
 
 uno::Reference< graphic::XGraphic> SvxIconSelectorDialog::GetSelectedIcon()
 {
-    uno::Reference< graphic::XGraphic > result;
+    uno::Reference<graphic::XGraphic> result;
+
+    sal_uInt16 nId = m_xTbSymbol->GetSelectedItemId();
 
-    sal_uInt16 nId;
-    for ( ToolBox::ImplToolItems::size_type n = 0; n < pTbSymbol->GetItemCount(); ++n )
+    if (nId)
     {
-        nId = pTbSymbol->GetItemId( n );
-        if ( pTbSymbol->IsItemChecked( nId ) )
-        {
-            result.set( static_cast< graphic::XGraphic* >( pTbSymbol->GetItemData( nId ) ) );
-        }
+        result = m_aGraphics[nId - 1];
     }
 
     return result;
 }
 
-IMPL_LINK_NOARG( SvxIconSelectorDialog, SelectHdl, ToolBox *, void )
+IMPL_LINK_NOARG(SvxIconSelectorDialog, SelectHdl, SvtValueSet*, void)
 {
-    ToolBox::ImplToolItems::size_type nCount = pTbSymbol->GetItemCount();
+    sal_uInt16 nId = m_xTbSymbol->GetSelectedItemId();
 
-    for (ToolBox::ImplToolItems::size_type n = 0; n < nCount; ++n )
+    if (!nId)
     {
-        sal_uInt16 nId = pTbSymbol->GetItemId( n );
-
-        if ( pTbSymbol->IsItemChecked( nId ) )
-        {
-            pTbSymbol->CheckItem( nId, false );
-        }
+        m_xBtnDelete->set_sensitive(false);
+        return;
     }
 
-    sal_uInt16 nId = pTbSymbol->GetCurItemId();
-    pTbSymbol->CheckItem( nId );
-
-    OUString aSelImageText = pTbSymbol->GetItemText( nId );
-    if ( m_xImportedImageManager->hasImage( SvxConfigPageHelper::GetImageType(), aSelImageText ) )
+    OUString aSelImageText = m_xTbSymbol->GetItemText(nId);
+    if (m_xImportedImageManager->hasImage(SvxConfigPageHelper::GetImageType(), aSelImageText))
     {
-        pBtnDelete->Enable();
+        m_xBtnDelete->set_sensitive(true);
     }
     else
     {
-        pBtnDelete->Enable( false );
+        m_xBtnDelete->set_sensitive(false);
     }
 }
 
-IMPL_LINK_NOARG( SvxIconSelectorDialog, ImportHdl, Button *, void)
+IMPL_LINK_NOARG(SvxIconSelectorDialog, ImportHdl, weld::Button&, void)
 {
     sfx2::FileDialogHelper aImportDialog(
         css::ui::dialogs::TemplateDescription::FILEOPEN_LINK_PREVIEW,
-        FileDialogFlags::Graphic | FileDialogFlags::MultiSelection, GetFrameWeld());
+        FileDialogFlags::Graphic | FileDialogFlags::MultiSelection, m_xDialog.get());
 
     // disable the link checkbox in the dialog
     uno::Reference< css::ui::dialogs::XFilePickerControlAccess >
@@ -3118,35 +3063,26 @@ IMPL_LINK_NOARG( SvxIconSelectorDialog, ImportHdl, Button *, void)
     }
 }
 
-IMPL_LINK_NOARG( SvxIconSelectorDialog, DeleteHdl, Button *, void )
+IMPL_LINK_NOARG(SvxIconSelectorDialog, DeleteHdl, weld::Button&, void)
 {
     OUString message = CuiResId( RID_SVXSTR_DELETE_ICON_CONFIRM );
 
-    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+    std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_xDialog.get(),
                                                VclMessageType::Warning, VclButtonsType::OkCancel,
                                                message));
     if (xWarn->run() == RET_OK)
     {
-        ToolBox::ImplToolItems::size_type nCount = pTbSymbol->GetItemCount();
+        sal_uInt16 nId = m_xTbSymbol->GetSelectedItemId();
 
-        for (ToolBox::ImplToolItems::size_type n = 0; n < nCount; ++n )
+        OUString aSelImageText = m_xTbSymbol->GetItemText( nId );
+        uno::Sequence< OUString > URLs { aSelImageText };
+        m_xTbSymbol->RemoveItem(nId);
+        m_xImportedImageManager->removeImages( SvxConfigPageHelper::GetImageType(), URLs );
+        uno::Reference< css::ui::XUIConfigurationPersistence >
+            xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
+        if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
         {
-            sal_uInt16 nId = pTbSymbol->GetItemId( n );
-
-            if ( pTbSymbol->IsItemChecked( nId ) )
-            {
-                OUString aSelImageText = pTbSymbol->GetItemText( nId );
-                uno::Sequence< OUString > URLs { aSelImageText };
-                pTbSymbol->RemoveItem( pTbSymbol->GetItemPos( nId ) );
-                m_xImportedImageManager->removeImages( SvxConfigPageHelper::GetImageType(), URLs );
-                uno::Reference< css::ui::XUIConfigurationPersistence >
-                    xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
-                if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
-                {
-                    xConfigPersistence->store();
-                }
-                break;
-            }
+            xConfigPersistence->store();
         }
     }
 }
@@ -3185,17 +3121,19 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
     }
 
     bool   bResult( false );
-    ToolBox::ImplToolItems::size_type nCount = pTbSymbol->GetItemCount();
-    for (ToolBox::ImplToolItems::size_type n = 0; n < nCount; ++n )
+    size_t nCount = m_xTbSymbol->GetItemCount();
+    for (size_t n = 0; n < nCount; ++n)
     {
-        sal_uInt16 nId = pTbSymbol->GetItemId( n );
+        sal_uInt16 nId = m_xTbSymbol->GetItemId( n );
 
-        if ( pTbSymbol->GetItemText( nId ) == aURL )
+        if ( m_xTbSymbol->GetItemText( nId ) == aURL )
         {
             try
             {
                 // replace/insert image with provided URL
-                pTbSymbol->RemoveItem( pTbSymbol->GetItemPos( nId ) );
+                size_t nPos = nId - 1;
+                assert(nPos == m_xTbSymbol->GetItemPos(nId));
+                m_xTbSymbol->RemoveItem(nId);
                 aMediaProps[0].Value <<= aURL;
 
                 Image aImage( xGraphic );
@@ -3205,9 +3143,9 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
                     BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize);
                     aImage = Image( aBitmapex);
                 }
-                pTbSymbol->InsertItem( nId,aImage, aURL, ToolBoxItemBits::NONE, 0 ); //modify
+                m_xTbSymbol->InsertItem(nId, aImage, aURL, nPos); //modify
 
-                xGraphic = Graphic(aImage.GetBitmapEx()).GetXGraphic();
+                m_aGraphics[nPos] = Graphic(aImage.GetBitmapEx()).GetXGraphic();
 
                 URLs[0] = aURL;
                 aImportGraph[ 0 ] = xGraphic;
@@ -3279,7 +3217,7 @@ void SvxIconSelectorDialog::ImportGraphics(
         {
             aIndex = rPaths[0].lastIndexOf( '/' );
             aIconName = rPaths[0].copy( aIndex+1 );
-            SvxIconReplacementDialog aDlg(GetFrameWeld(), aIconName, false);
+            SvxIconReplacementDialog aDlg(m_xDialog.get(), aIconName, false);
             ret = aDlg.run();
             if ( ret == 2 )
             {
@@ -3308,7 +3246,7 @@ void SvxIconSelectorDialog::ImportGraphics(
             {
                 aIndex = rPaths[i].lastIndexOf( '/' );
                 aIconName = rPaths[i].copy( aIndex+1 );
-                SvxIconReplacementDialog aDlg(GetFrameWeld(), aIconName, true);
+                SvxIconReplacementDialog aDlg(m_xDialog.get(), aIconName, true);
                 ret = aDlg.run();
                 if ( ret == 2 )
                 {
@@ -3357,8 +3295,8 @@ void SvxIconSelectorDialog::ImportGraphics(
             message.append(fPath).append(rejected[i]).append("\n");
         }
 
-        SvxIconChangeDialog aDialog(GetFrameWeld(), message.makeStringAndClear());
-        (void)aDialog.run();
+        SvxIconChangeDialog aDialog(m_xDialog.get(), message.makeStringAndClear());
+        aDialog.run();
     }
 }
 
@@ -3366,9 +3304,6 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
 {
     bool result = false;
 
-    sal_uInt16 nId = m_nNextId;
-    ++m_nNextId;
-
     uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
     aMediaProps[0].Name = "URL";
 
@@ -3385,47 +3320,43 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
         xGraphic = m_xGraphProvider->queryGraphic( aMediaProps );
         if ( xGraphic.is() )
         {
-                bool bOK = true;
+            bool bOK = true;
 
-                a >>= aSize;
-                if ( 0 == aSize.Width || 0 == aSize.Height )
-                    bOK = false;
+            a >>= aSize;
+            if ( 0 == aSize.Width || 0 == aSize.Height )
+                bOK = false;
 
-                Image aImage( xGraphic );
-
-                if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
-                {
-                    BitmapEx aBitmap = aImage.GetBitmapEx();
-                    BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize);
-                    aImage = Image( aBitmapex);
-                }
-                if ( bOK && !!aImage )
-                {
-                    pTbSymbol->InsertItem( nId, aImage, aURL, ToolBoxItemBits::NONE, 0 );
+            Image aImage( xGraphic );
 
-                    xGraphic = Graphic(aImage.GetBitmapEx()).GetXGraphic();
-                    xGraphic->acquire();
-
-                    pTbSymbol->SetItemData(
-                        nId, static_cast< void * > ( xGraphic.get() ) );
-                    uno::Sequence<OUString> aImportURL { aURL };
-                    uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
-                    aImportGraph[ 0 ] = xGraphic;
-                    m_xImportedImageManager->insertImages( SvxConfigPageHelper::GetImageType(), aImportURL, aImportGraph );
-                    uno::Reference< css::ui::XUIConfigurationPersistence >
-                    xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
+            if ( bOK && ((aSize.Width != m_nExpectedSize) || (aSize.Height != m_nExpectedSize)) )
+            {
+                BitmapEx aBitmap = aImage.GetBitmapEx();
+                BitmapEx aBitmapex = BitmapEx::AutoScaleBitmap(aBitmap, m_nExpectedSize);
+                aImage = Image( aBitmapex);
+            }
+            if ( bOK && !!aImage )
+            {
+                m_aGraphics.push_back(Graphic(aImage.GetBitmapEx()).GetXGraphic());
+                m_xTbSymbol->InsertItem(m_aGraphics.size(), aImage, aURL);
 
-                    if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
-                    {
-                        xConfigPersistence->store();
-                    }
+                uno::Sequence<OUString> aImportURL { aURL };
+                uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
+                aImportGraph[ 0 ] = xGraphic;
+                m_xImportedImageManager->insertImages( SvxConfigPageHelper::GetImageType(), aImportURL, aImportGraph );
+                uno::Reference< css::ui::XUIConfigurationPersistence >
+                xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
 
-                    result = true;
-                }
-                else
+                if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
                 {
-                    SAL_WARN("cui.customize", "could not create Image from XGraphic");
+                    xConfigPersistence->store();
                 }
+
+                result = true;
+            }
+            else
+            {
+                SAL_WARN("cui.customize", "could not create Image from XGraphic");
+            }
         }
         else
         {
diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx
index 0fe406e7c722..5734d1dc47cc 100644
--- a/cui/source/inc/cfg.hxx
+++ b/cui/source/inc/cfg.hxx
@@ -29,6 +29,7 @@
 #include <vcl/treelistbox.hxx>
 #include <svtools/svmedit2.hxx>
 #include <svtools/svmedit.hxx>
+#include <svtools/valueset.hxx>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XIndexContainer.hpp>
@@ -583,15 +584,9 @@ public:
     }
 };
 
-class SvxIconSelectorDialog : public ModalDialog
+class SvxIconSelectorDialog : public weld::GenericDialogController
 {
 private:
-    VclPtr<ToolBox>        pTbSymbol;
-    VclPtr<FixedText>      pFtNote;
-    VclPtr<PushButton>     pBtnImport;
-    VclPtr<PushButton>     pBtnDelete;
-    sal_uInt16      m_nNextId;
-
     sal_Int32       m_nExpectedSize;
 
     css::uno::Reference<
@@ -606,6 +601,14 @@ private:
     css::uno::Reference<
         css::graphic::XGraphicProvider > m_xGraphProvider;
 
+    std::vector<css::uno::Reference<css::graphic::XGraphic>> m_aGraphics;
+
+    std::unique_ptr<SvtValueSet> m_xTbSymbol;
+    std::unique_ptr<weld::CustomWeld> m_xTbSymbolWin;
+    std::unique_ptr<weld::Label>      m_xFtNote;
+    std::unique_ptr<weld::Button>     m_xBtnImport;
+    std::unique_ptr<weld::Button>     m_xBtnDelete;
+
     bool ReplaceGraphicItem( const OUString& aURL );
 
     bool ImportGraphic( const OUString& aURL );
@@ -615,20 +618,18 @@ private:
 public:
 
     SvxIconSelectorDialog(
-        vcl::Window *pWindow,
+        weld::Window *pWindow,
         const css::uno::Reference< css::ui::XImageManager >& rXImageManager,
-        const css::uno::Reference< css::ui::XImageManager >& rXParentImageManager
-            );
+        const css::uno::Reference< css::ui::XImageManager >& rXParentImageManager);
 
     virtual ~SvxIconSelectorDialog() override;
-    virtual void dispose() override;
 
     css::uno::Reference< css::graphic::XGraphic >
         GetSelectedIcon();
 
-    DECL_LINK( SelectHdl, ToolBox *, void );
-    DECL_LINK( ImportHdl, Button *, void );
-    DECL_LINK( DeleteHdl, Button *, void );
+    DECL_LINK(SelectHdl, SvtValueSet*, void);
+    DECL_LINK(ImportHdl, weld::Button&, void);
+    DECL_LINK(DeleteHdl, weld::Button&, void);
 };
 
 //added for issue83555
diff --git a/cui/uiconfig/ui/iconselectordialog.ui b/cui/uiconfig/ui/iconselectordialog.ui
index b0b8ff2700ce..a12fee076901 100644
--- a/cui/uiconfig/ui/iconselectordialog.ui
+++ b/cui/uiconfig/ui/iconselectordialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="IconSelector">
@@ -9,7 +9,13 @@
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="iconselectordialog|IconSelector">Change Icon</property>
     <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -106,11 +112,27 @@
                         <property name="top_padding">6</property>
                         <property name="left_padding">12</property>
                         <child>
-                          <object class="GtkToolbar" id="symbolsToolbar">
+                          <object class="GtkScrolledWindow" id="symbolswin">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="vexpand">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hscrollbar_policy">never</property>
+                            <property name="vscrollbar_policy">never</property>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <object class="GtkViewport">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <child>
+                                  <object class="GtkDrawingArea" id="symbolsToolbar">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
+                                    <property name="hexpand">True</property>
+                                    <property name="vexpand">True</property>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>
@@ -187,12 +209,12 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="halign">start</property>
-                <property name="xalign">0</property>
-                <property name="yalign">0</property>
                 <property name="label" translatable="yes" context="iconselectordialog|noteLabel">Note:
 The size of an icon should be 16x16 pixel to achieve best quality.
 Different sized icons will be scaled automatically.</property>
                 <property name="wrap">True</property>
+                <property name="xalign">0</property>
+                <property name="yalign">0</property>
               </object>
               <packing>
                 <property name="expand">False</property>
commit 0887551123df339cb6e5a2fdad470963c6dc1229
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Mar 1 16:20:40 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Mar 2 14:05:35 2019 +0100

    weld SwInsertAbstractDlg
    
    Change-Id: Ib3e9d0a7ff7e0fd3b0cf7bf492ca2bf59788fa2a
    Reviewed-on: https://gerrit.libreoffice.org/68594
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/solenv/sanitizers/ui/modules/swriter.suppr b/solenv/sanitizers/ui/modules/swriter.suppr
index 27a4d9d9db2c..2c7b4fac20bf 100644
--- a/solenv/sanitizers/ui/modules/swriter.suppr
+++ b/solenv/sanitizers/ui/modules/swriter.suppr
@@ -1,8 +1,4 @@
-sw/uiconfig/swriter/ui/abstractdialog.ui://GtkLabel[@id='label2'] orphan-label
-sw/uiconfig/swriter/ui/abstractdialog.ui://GtkLabel[@id='label3'] orphan-label
 sw/uiconfig/swriter/ui/abstractdialog.ui://GtkLabel[@id='label4'] orphan-label
-sw/uiconfig/swriter/ui/abstractdialog.ui://GtkSpinButton[@id='outlines'] no-labelled-by
-sw/uiconfig/swriter/ui/abstractdialog.ui://GtkSpinButton[@id='paras'] no-labelled-by
 sw/uiconfig/swriter/ui/addentrydialog.ui://GtkEntry[@id='entry'] no-labelled-by
 sw/uiconfig/swriter/ui/addressblockdialog.ui://GtkButton[@id='toaddr'] button-no-label
 sw/uiconfig/swriter/ui/alreadyexistsdialog.ui://GtkEntry[@id='edit1'] no-labelled-by
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 0eac3d69da38..bba0b4be2359 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -369,7 +369,7 @@ public:
     virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings,
         SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) = 0;
 
-    virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() = 0;
+    virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg(weld::Window* pParent) = 0;
     virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) = 0;
     virtual VclPtr<AbstractSwAsciiFilterDlg>  CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh,
                                                                 SvStream* pStream) = 0;
diff --git a/sw/source/ui/dialog/abstract.cxx b/sw/source/ui/dialog/abstract.cxx
index 07818448f870..a10ca895c2c8 100644
--- a/sw/source/ui/dialog/abstract.cxx
+++ b/sw/source/ui/dialog/abstract.cxx
@@ -22,34 +22,25 @@
 
 #include <abstract.hxx>
 
-SwInsertAbstractDlg::SwInsertAbstractDlg(vcl::Window* pParent)
-    : SfxModalDialog(pParent, "AbstractDialog",
-        "modules/swriter/ui/abstractdialog.ui")
+SwInsertAbstractDlg::SwInsertAbstractDlg(weld::Window* pParent)
+    : SfxDialogController(pParent, "modules/swriter/ui/abstractdialog.ui", "AbstractDialog")
+    , m_xLevelNF(m_xBuilder->weld_spin_button("outlines"))
+    , m_xParaNF(m_xBuilder->weld_spin_button("paras"))
 {
-    get(m_pLevelNF, "outlines");
-    get(m_pParaNF, "paras");
 }
 
 SwInsertAbstractDlg::~SwInsertAbstractDlg()
 {
-    disposeOnce();
-}
-
-void SwInsertAbstractDlg::dispose()
-{
-    m_pLevelNF.clear();
-    m_pParaNF.clear();
-    SfxModalDialog::dispose();
 }
 
 sal_uInt8 SwInsertAbstractDlg::GetLevel() const
 {
-    return static_cast<sal_uInt8>(m_pLevelNF->GetValue() - 1);
+    return static_cast<sal_uInt8>(m_xLevelNF->get_value() - 1);
 }
 
 sal_uInt8 SwInsertAbstractDlg::GetPara() const
 {
-    return static_cast<sal_uInt8>(m_pParaNF->GetValue());
+    return static_cast<sal_uInt8>(m_xParaNF->get_value());
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 378850eec989..042136c460e1 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -96,7 +96,11 @@ short AbstractSwWordCountFloatDlg_Impl::Execute()
     return m_xDlg->run();
 }
 
-IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl);
+short AbstractSwInsertAbstractDlg_Impl::Execute()
+{
+    return m_xDlg->run();
+}
+
 IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl);
 
 short SwAbstractSfxController_Impl::Execute()
@@ -297,12 +301,12 @@ void AbstractApplyTabController_Impl::SetApplyHdl( const Link<LinkParamNone*,voi
 
 sal_uInt8 AbstractSwInsertAbstractDlg_Impl::GetLevel() const
 {
-    return pDlg->GetLevel();
+    return m_xDlg->GetLevel();
 }
 
 sal_uInt8 AbstractSwInsertAbstractDlg_Impl::GetPara() const
 {
-    return pDlg->GetPara();
+    return m_xDlg->GetPara();
 }
 
 const SfxItemSet* SwAbstractSfxDialog_Impl::GetOutputItemSet() const
@@ -740,10 +744,9 @@ sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const
     return pDlg->GetRestartPage();
 }
 
-VclPtr<AbstractSwInsertAbstractDlg> SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg()
+VclPtr<AbstractSwInsertAbstractDlg> SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg(weld::Window* pParent)
 {
-    VclPtr<SwInsertAbstractDlg> pDlg = VclPtr<SwInsertAbstractDlg>::Create(nullptr);
-    return VclPtr<AbstractSwInsertAbstractDlg_Impl>::Create(pDlg);
+    return VclPtr<AbstractSwInsertAbstractDlg_Impl>::Create(std::make_unique<SwInsertAbstractDlg>(pParent));
 }
 
 VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwAddressAbstractDlg(vcl::Window* pParent,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index ee6e32ccb306..1e67b9b00189 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -89,7 +89,13 @@ public:
 
 class AbstractSwInsertAbstractDlg_Impl : public AbstractSwInsertAbstractDlg
 {
-    DECL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl,SwInsertAbstractDlg)
+    std::unique_ptr<SwInsertAbstractDlg> m_xDlg;
+public:
+    explicit AbstractSwInsertAbstractDlg_Impl(std::unique_ptr<SwInsertAbstractDlg> p)
+        : m_xDlg(std::move(p))
+    {
+    }
+    virtual short Execute() override;
     virtual sal_uInt8   GetLevel() const override ;
     virtual sal_uInt8   GetPara() const override ;
 };
@@ -587,7 +593,7 @@ public:
     virtual VclPtr<SfxAbstractDialog> CreateSwBackgroundDialog(weld::Window* pParent, const SfxItemSet& rSet) override;
     virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings,
         SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) override;
-    virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() override;
+    virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg(weld::Window* pParent) override;
     virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) override;
     virtual VclPtr<AbstractSwAsciiFilterDlg>  CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh,
                                                                 SvStream* pStream) override;
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 5f4f72a7da8c..8a1d56fe7dfd 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -768,7 +768,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
         case FN_ABSTRACT_NEWDOC:
         {
             SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-            ScopedVclPtr<AbstractSwInsertAbstractDlg> pDlg(pFact->CreateSwInsertAbstractDlg());
+            ScopedVclPtr<AbstractSwInsertAbstractDlg> pDlg(pFact->CreateSwInsertAbstractDlg(GetView()->GetViewFrame()->GetWindow().GetFrameWeld()));
             if(RET_OK == pDlg->Execute())
             {
                 sal_uInt8 nLevel = pDlg->GetLevel();
diff --git a/sw/source/uibase/inc/abstract.hxx b/sw/source/uibase/inc/abstract.hxx
index 1fc899b2b604..6d6f6ba60d03 100644
--- a/sw/source/uibase/inc/abstract.hxx
+++ b/sw/source/uibase/inc/abstract.hxx
@@ -21,17 +21,14 @@
 
 #include <sfx2/basedlgs.hxx>
 
-#include <vcl/field.hxx>
-
-class SwInsertAbstractDlg : public SfxModalDialog
+class SwInsertAbstractDlg : public SfxDialogController
 {
-    VclPtr<NumericField> m_pLevelNF;
-    VclPtr<NumericField> m_pParaNF;
+    std::unique_ptr<weld::SpinButton> m_xLevelNF;
+    std::unique_ptr<weld::SpinButton> m_xParaNF;
 
 public:
-    SwInsertAbstractDlg( vcl::Window* pParent );
+    SwInsertAbstractDlg(weld::Window* pParent);
     virtual ~SwInsertAbstractDlg() override;
-    virtual void dispose() override;
 
     sal_uInt8   GetLevel() const;
     sal_uInt8   GetPara() const;
diff --git a/sw/uiconfig/swriter/ui/abstractdialog.ui b/sw/uiconfig/swriter/ui/abstractdialog.ui
index c332b6ee0fef..bdf26fda47c1 100644
--- a/sw/uiconfig/swriter/ui/abstractdialog.ui
+++ b/sw/uiconfig/swriter/ui/abstractdialog.ui
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkAdjustment" id="adjustment1">
@@ -19,7 +20,13 @@
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="abstractdialog|AbstractDialog">Create AutoAbstract</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -71,6 +78,7 @@
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">2</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -110,15 +118,14 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes" context="abstractdialog|label2">Included outline levels</property>
                         <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">outlines</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -126,15 +133,14 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes" context="abstractdialog|label3">Paragraphs per level</property>
                         <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">paras</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -142,17 +148,17 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
-                        <property name="xalign">0</property>
                         <property name="label" translatable="yes" context="abstractdialog|label4">The abstract contains the selected number of paragraphs from the included outline levels.</property>
                         <property name="use_underline">True</property>
                         <property name="wrap">True</property>
+                        <property name="width_chars">52</property>
                         <property name="max_width_chars">52</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">2</property>
                         <property name="width">2</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -165,8 +171,6 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -179,8 +183,6 @@
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>


More information about the Libreoffice-commits mailing list