[Libreoffice-commits] core.git: cui/source cui/uiconfig dbaccess/uiconfig filter/uiconfig include/svtools svtools/source vcl/source vcl/unx
Caolán McNamara
caolanm at redhat.com
Thu May 17 08:13:46 UTC 2018
cui/source/options/optjava.cxx | 150 +++++++++---------------
cui/source/options/optjava.hxx | 36 ++---
cui/uiconfig/ui/javaclasspathdialog.ui | 55 +++++++--
dbaccess/uiconfig/ui/sqlexception.ui | 4
filter/uiconfig/ui/warnpdfdialog.ui | 4
include/svtools/imagemgr.hxx | 7 -
svtools/source/misc/imagemgr.cxx | 201 +++++++++++++++++----------------
vcl/source/app/salvtables.cxx | 19 +--
vcl/unx/gtk3/gtk3gtkinst.cxx | 54 +++++++-
9 files changed, 295 insertions(+), 235 deletions(-)
New commits:
commit 61964fc19da92ad5ff988fc071a94da61434fb7d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue May 15 20:59:00 2018 +0100
weld SvxJavaClassPathDlg
Change-Id: I3938a05d96cb1fc171611e54fa34f780ba569268
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 4d847ebaa9eb..23a5a9f5f299 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -111,7 +111,6 @@ public:
SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet& rSet )
: SfxTabPage(pParent, "OptAdvancedPage", "cui/ui/optadvancedpage.ui", &rSet)
- , m_pPathDlg(nullptr)
, m_aResetIdle("cui options SvxJavaOptionsPage Reset")
, xDialogListener(new ::svt::DialogClosedListener())
{
@@ -184,7 +183,7 @@ void SvxJavaOptionsPage::dispose()
{
m_pJavaList.disposeAndClear();
m_xParamDlg.reset();
- m_pPathDlg.disposeAndClear();
+ m_xPathDlg.reset();
ClearJavaInfo();
#if HAVE_FEATURE_JAVA
m_aAddedInfos.clear();
@@ -304,26 +303,26 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl, Button*, void)
#if HAVE_FEATURE_JAVA
OUString sClassPath;
- if ( !m_pPathDlg )
+ if ( !m_xPathDlg )
{
- m_pPathDlg = VclPtr<SvxJavaClassPathDlg>::Create( this );
+ m_xPathDlg.reset(new SvxJavaClassPathDlg(GetFrameWeld()));
javaFrameworkError eErr = jfw_getUserClassPath( &m_pClassPath );
if ( JFW_E_NONE == eErr )
{
sClassPath = m_pClassPath;
- m_pPathDlg->SetClassPath( sClassPath );
+ m_xPathDlg->SetClassPath( sClassPath );
}
}
else
- sClassPath = m_pPathDlg->GetClassPath();
+ sClassPath = m_xPathDlg->GetClassPath();
- m_pPathDlg->SetFocus();
- if ( m_pPathDlg->Execute() == RET_OK )
+ m_xPathDlg->SetFocus();
+ if (m_xPathDlg->run() == RET_OK)
{
- if ( m_pPathDlg->GetClassPath() != sClassPath )
+ if (m_xPathDlg->GetClassPath() != sClassPath)
{
- sClassPath = m_pPathDlg->GetClassPath();
+ sClassPath = m_xPathDlg->GetClassPath();
if ( jfw_isVMRunning() )
{
RequestRestart( svtools::RESTART_REASON_ASSIGNING_FOLDERS );
@@ -331,7 +330,7 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, ClassPathHdl_Impl, Button*, void)
}
}
else
- m_pPathDlg->SetClassPath( sClassPath );
+ m_xPathDlg->SetClassPath( sClassPath );
#else
(void) this;
#endif
@@ -602,10 +601,10 @@ bool SvxJavaOptionsPage::FillItemSet( SfxItemSet* /*rCoreSet*/ )
bModified = true;
}
- if ( m_pPathDlg )
+ if (m_xPathDlg)
{
- OUString sPath( m_pPathDlg->GetClassPath() );
- if ( m_pPathDlg->GetOldPath() != sPath )
+ OUString sPath(m_xPathDlg->GetClassPath());
+ if (m_xPathDlg->GetOldPath() != sPath)
{
eErr = jfw_setUserClassPath( sPath );
SAL_WARN_IF(JFW_E_NONE != eErr, "cui.options", "SvxJavaOptionsPage::FillItemSet(): error in jfw_setUserClassPath");
@@ -849,56 +848,37 @@ void SvxJavaParameterDlg::SetParameters( std::vector< OUString > const & rParams
// class SvxJavaClassPathDlg ---------------------------------------------
-SvxJavaClassPathDlg::SvxJavaClassPathDlg(vcl::Window* pParent)
- : ModalDialog(pParent, "JavaClassPath", "cui/ui/javaclasspathdialog.ui")
+SvxJavaClassPathDlg::SvxJavaClassPathDlg(weld::Window* pParent)
+ : GenericDialogController(pParent, "cui/ui/javaclasspathdialog.ui", "JavaClassPath")
+ , m_xPathList(m_xBuilder->weld_tree_view("paths"))
+ , m_xAddArchiveBtn(m_xBuilder->weld_button("archive"))
+ , m_xAddPathBtn(m_xBuilder->weld_button("folder"))
+ , m_xRemoveBtn(m_xBuilder->weld_button("remove"))
{
- get( m_pPathList, "paths");
- m_pPathList->SetDropDownLineCount(8);
- m_pPathList->set_width_request(m_pPathList->approximate_char_width() * 54);
- get( m_pAddArchiveBtn, "archive");
- get( m_pAddPathBtn, "folder");
- get( m_pRemoveBtn, "remove");
-
- m_pAddArchiveBtn->SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddArchiveHdl_Impl ) );
- m_pAddPathBtn->SetClickHdl( LINK( this, SvxJavaClassPathDlg, AddPathHdl_Impl ) );
- m_pRemoveBtn->SetClickHdl( LINK( this, SvxJavaClassPathDlg, RemoveHdl_Impl ) );
- m_pPathList->SetSelectHdl( LINK( this, SvxJavaClassPathDlg, SelectHdl_Impl ) );
+ m_xPathList->set_size_request(m_xPathList->get_approximate_digit_width() * 54,
+ m_xPathList->get_height_rows(8));
+ m_xAddArchiveBtn->connect_clicked( LINK( this, SvxJavaClassPathDlg, AddArchiveHdl_Impl ) );
+ m_xAddPathBtn->connect_clicked( LINK( this, SvxJavaClassPathDlg, AddPathHdl_Impl ) );
+ m_xRemoveBtn->connect_clicked( LINK( this, SvxJavaClassPathDlg, RemoveHdl_Impl ) );
+ m_xPathList->connect_changed( LINK( this, SvxJavaClassPathDlg, SelectHdl_Impl ) );
// set initial focus to path list
- m_pPathList->GrabFocus();
+ m_xPathList->grab_focus();
}
-
SvxJavaClassPathDlg::~SvxJavaClassPathDlg()
{
- disposeOnce();
-}
-
-void SvxJavaClassPathDlg::dispose()
-{
- if (m_pPathList)
- {
- sal_Int32 i, nCount = m_pPathList->GetEntryCount();
- for ( i = 0; i < nCount; ++i )
- delete static_cast< OUString* >( m_pPathList->GetEntryData(i) );
- m_pPathList = nullptr;
- }
- m_pPathList.clear();
- m_pAddArchiveBtn.clear();
- m_pAddPathBtn.clear();
- m_pRemoveBtn.clear();
- ModalDialog::dispose();
}
-IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, weld::Button&, void)
{
- sfx2::FileDialogHelper aDlg(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, GetFrameWeld());
+ sfx2::FileDialogHelper aDlg(TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE, m_xDialog.get());
aDlg.SetTitle( CuiResId( RID_SVXSTR_ARCHIVE_TITLE ) );
aDlg.AddFilter( CuiResId( RID_SVXSTR_ARCHIVE_HEADLINE ), "*.jar;*.zip" );
OUString sFolder;
- if ( m_pPathList->GetSelectedEntryCount() > 0 )
+ if (m_xPathList->count_selected_rows() > 0)
{
- INetURLObject aObj( m_pPathList->GetSelectedEntry(), FSysStyle::Detect );
+ INetURLObject aObj(m_xPathList->get_selected_text(), FSysStyle::Detect);
sFolder = aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
}
else
@@ -911,14 +891,14 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, Button*, void)
OUString sFile = aURL.getFSysPath( FSysStyle::Detect );
if ( !IsPathDuplicate( sURL ) )
{
- sal_Int32 nPos = m_pPathList->InsertEntry( sFile, SvFileInformationManager::GetImage( aURL ) );
- m_pPathList->SelectEntryPos( nPos );
+ m_xPathList->append("", sFile, SvFileInformationManager::GetImageId(aURL));
+ m_xPathList->select(m_xPathList->n_children() - 1);
}
else
{
OUString sMsg( CuiResId( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
sMsg = sMsg.replaceFirst( "%1", sFile );
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::Ok, sMsg));
xBox->run();
}
@@ -926,16 +906,15 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddArchiveHdl_Impl, Button*, void)
EnableRemoveButton();
}
-
-IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, weld::Button&, void)
{
Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
OUString sOldFolder;
- if ( m_pPathList->GetSelectedEntryCount() > 0 )
+ if (m_xPathList->count_selected_rows() > 0)
{
- INetURLObject aObj( m_pPathList->GetSelectedEntry(), FSysStyle::Detect );
+ INetURLObject aObj(m_xPathList->get_selected_text(), FSysStyle::Detect);
sOldFolder = aObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
}
else
@@ -948,14 +927,14 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, Button*, void)
OUString sNewFolder = aURL.getFSysPath( FSysStyle::Detect );
if ( !IsPathDuplicate( sFolderURL ) )
{
- sal_Int32 nPos = m_pPathList->InsertEntry( sNewFolder, SvFileInformationManager::GetImage( aURL ) );
- m_pPathList->SelectEntryPos( nPos );
+ m_xPathList->append("", sNewFolder, SvFileInformationManager::GetImageId(aURL));
+ m_xPathList->select(m_xPathList->n_children() - 1);
}
else
{
OUString sMsg( CuiResId( RID_SVXSTR_MULTIFILE_DBL_ERR ) );
sMsg = sMsg.replaceFirst( "%1", sNewFolder );
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::Ok, sMsg));
xBox->run();
}
@@ -963,40 +942,37 @@ IMPL_LINK_NOARG(SvxJavaClassPathDlg, AddPathHdl_Impl, Button*, void)
EnableRemoveButton();
}
-
-IMPL_LINK_NOARG(SvxJavaClassPathDlg, RemoveHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxJavaClassPathDlg, RemoveHdl_Impl, weld::Button&, void)
{
- sal_Int32 nPos = m_pPathList->GetSelectedEntryPos();
- if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ int nPos = m_xPathList->get_selected_index();
+ if (nPos != -1)
{
- m_pPathList->RemoveEntry( nPos );
- sal_Int32 nCount = m_pPathList->GetEntryCount();
- if ( nCount )
+ m_xPathList->remove(nPos);
+ int nCount = m_xPathList->n_children();
+ if (nCount)
{
- if ( nPos >= nCount )
- nPos = ( nCount - 1 );
- m_pPathList->SelectEntryPos( nPos );
+ if (nPos >= nCount)
+ nPos = nCount - 1;
+ m_xPathList->select( nPos );
}
}
EnableRemoveButton();
}
-
-IMPL_LINK_NOARG(SvxJavaClassPathDlg, SelectHdl_Impl, ListBox&, void)
+IMPL_LINK_NOARG(SvxJavaClassPathDlg, SelectHdl_Impl, weld::TreeView&, void)
{
EnableRemoveButton();
}
-
bool SvxJavaClassPathDlg::IsPathDuplicate( const OUString& _rPath )
{
bool bRet = false;
INetURLObject aFileObj( _rPath );
- sal_Int32 nCount = m_pPathList->GetEntryCount();
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ int nCount = m_xPathList->n_children();
+ for (int i = 0; i < nCount; ++i)
{
- INetURLObject aOtherObj( m_pPathList->GetEntry(i), FSysStyle::Detect );
+ INetURLObject aOtherObj(m_xPathList->get_text(i), FSysStyle::Detect);
if ( aOtherObj == aFileObj )
{
bRet = true;
@@ -1007,42 +983,36 @@ bool SvxJavaClassPathDlg::IsPathDuplicate( const OUString& _rPath )
return bRet;
}
-
OUString SvxJavaClassPathDlg::GetClassPath() const
{
OUString sPath;
- sal_Int32 nCount = m_pPathList->GetEntryCount();
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ int nCount = m_xPathList->n_children();
+ for (int i = 0; i < nCount; ++i)
{
- if ( !sPath.isEmpty() )
+ if (!sPath.isEmpty())
sPath += OUStringLiteral1(CLASSPATH_DELIMITER);
- OUString* pFullPath = static_cast< OUString* >( m_pPathList->GetEntryData(i) );
- if ( pFullPath )
- sPath += *pFullPath;
- else
- sPath += m_pPathList->GetEntry(i);
+ sPath += m_xPathList->get_text(i);
}
return sPath;
}
-
void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath )
{
if ( m_sOldPath.isEmpty() )
m_sOldPath = _rPath;
- m_pPathList->Clear();
+ m_xPathList->clear();
sal_Int32 nIdx = 0;
do
{
OUString sToken = _rPath.getToken( 0, CLASSPATH_DELIMITER, nIdx );
INetURLObject aURL( sToken, FSysStyle::Detect );
OUString sPath = aURL.getFSysPath( FSysStyle::Detect );
- m_pPathList->InsertEntry( sPath, SvFileInformationManager::GetImage( aURL ) );
+ m_xPathList->append("", sPath, SvFileInformationManager::GetImageId(aURL));
}
while (nIdx>=0);
// select first entry
- m_pPathList->SelectEntryPos(0);
- SelectHdl_Impl( *m_pPathList );
+ m_xPathList->select(0);
+ SelectHdl_Impl(*m_xPathList);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index 96e2b89a58fc..f6e715915aa6 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -29,6 +29,7 @@
#include <vcl/lstbox.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
+#include <vcl/weld.hxx>
#include <sfx2/tabdlg.hxx>
#include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
#include <svtools/dialogclosedlistener.hxx>
@@ -64,7 +65,7 @@ private:
VclPtr<PushButton> m_pExpertConfigBtn;
std::unique_ptr<SvxJavaParameterDlg> m_xParamDlg;
- VclPtr<SvxJavaClassPathDlg> m_pPathDlg;
+ std::unique_ptr<SvxJavaClassPathDlg> m_xPathDlg;
VclPtr<OfaTreeOptionsDialog> m_pParentDlg;
#if HAVE_FEATURE_JAVA
@@ -176,34 +177,33 @@ public:
// class SvxJavaClassPathDlg ---------------------------------------------
-class SvxJavaClassPathDlg : public ModalDialog
+class SvxJavaClassPathDlg : public weld::GenericDialogController
{
private:
- VclPtr<ListBox> m_pPathList;
- VclPtr<PushButton> m_pAddArchiveBtn;
- VclPtr<PushButton> m_pAddPathBtn;
- VclPtr<PushButton> m_pRemoveBtn;
+ std::unique_ptr<weld::TreeView> m_xPathList;
+ std::unique_ptr<weld::Button> m_xAddArchiveBtn;
+ std::unique_ptr<weld::Button> m_xAddPathBtn;
+ std::unique_ptr<weld::Button> m_xRemoveBtn;
OUString m_sOldPath;
- DECL_LINK(AddArchiveHdl_Impl, Button*, void);
- DECL_LINK(AddPathHdl_Impl, Button*, void);
- DECL_LINK(RemoveHdl_Impl, Button*, void);
- DECL_LINK(SelectHdl_Impl, ListBox&, void);
-
- bool IsPathDuplicate( const OUString& _rPath );
- void EnableRemoveButton()
- { m_pRemoveBtn->Enable(
- m_pPathList->GetSelectedEntryPos() != LISTBOX_ENTRY_NOTFOUND ); }
+ DECL_LINK(AddArchiveHdl_Impl, weld::Button&, void);
+ DECL_LINK(AddPathHdl_Impl, weld::Button&, void);
+ DECL_LINK(RemoveHdl_Impl, weld::Button&, void);
+ DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
+ bool IsPathDuplicate(const OUString& _rPath);
+ void EnableRemoveButton()
+ {
+ m_xRemoveBtn->set_sensitive(m_xPathList->get_selected_index() != -1);
+ }
public:
- explicit SvxJavaClassPathDlg( vcl::Window* pParent );
+ explicit SvxJavaClassPathDlg(weld::Window* pParent);
virtual ~SvxJavaClassPathDlg() override;
- virtual void dispose() override;
const OUString& GetOldPath() const { return m_sOldPath; }
- void SetFocus() { m_pPathList->GrabFocus(); }
+ void SetFocus() { m_xPathList->grab_focus(); }
OUString GetClassPath() const;
void SetClassPath( const OUString& _rPath );
diff --git a/cui/uiconfig/ui/javaclasspathdialog.ui b/cui/uiconfig/ui/javaclasspathdialog.ui
index e14fbbf56dbd..7dd2d20145bf 100644
--- a/cui/uiconfig/ui/javaclasspathdialog.ui
+++ b/cui/uiconfig/ui/javaclasspathdialog.ui
@@ -1,12 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
<interface domain="cui">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkListStore" id="liststore1">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ <!-- column-name image -->
+ <column type="GdkPixbuf"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="JavaClassPath">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="javaclasspathdialog|JavaClassPath">Class Path</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 internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
@@ -89,10 +102,10 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="javaclasspathdialog|label1">A_ssigned folders and archives</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">paths:border</property>
+ <property name="mnemonic_widget">paths</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -101,21 +114,44 @@
</packing>
</child>
<child>
- <object class="GtkScrolledWindow" id="scrolledwindow2">
- <property name="width_request">1</property>
+ <object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTreeView" id="paths:border">
+ <object class="GtkTreeView" id="paths">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hexpand">True</property>
<property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
<child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection4"/>
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="pixbuf">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
</object>
</child>
@@ -202,5 +238,8 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
diff --git a/dbaccess/uiconfig/ui/sqlexception.ui b/dbaccess/uiconfig/ui/sqlexception.ui
index 4d2d6117774c..7e0b751afd18 100644
--- a/dbaccess/uiconfig/ui/sqlexception.ui
+++ b/dbaccess/uiconfig/ui/sqlexception.ui
@@ -9,7 +9,7 @@
<!-- column-name id -->
<column type="gchararray"/>
<!-- column-name image -->
- <column type="gchararray"/>
+ <column type="GdkPixbuf"/>
</columns>
</object>
<object class="GtkDialog" id="SQLExceptionDialog">
@@ -137,7 +137,7 @@
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
<attributes>
- <attribute name="icon-name">2</attribute>
+ <attribute name="pixbuf">2</attribute>
</attributes>
</child>
</object>
diff --git a/filter/uiconfig/ui/warnpdfdialog.ui b/filter/uiconfig/ui/warnpdfdialog.ui
index 4c474715f427..c63953a39967 100644
--- a/filter/uiconfig/ui/warnpdfdialog.ui
+++ b/filter/uiconfig/ui/warnpdfdialog.ui
@@ -9,7 +9,7 @@
<!-- column-name id -->
<column type="gchararray"/>
<!-- column-name image -->
- <column type="gchararray"/>
+ <column type="GdkPixbuf"/>
</columns>
</object>
<object class="GtkMessageDialog" id="WarnPDFDialog">
@@ -92,7 +92,7 @@
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
<attributes>
- <attribute name="icon-name">2</attribute>
+ <attribute name="pixbuf">2</attribute>
</attributes>
</child>
</object>
diff --git a/include/svtools/imagemgr.hxx b/include/svtools/imagemgr.hxx
index 47f3df355799..9db1b30ab1a7 100644
--- a/include/svtools/imagemgr.hxx
+++ b/include/svtools/imagemgr.hxx
@@ -20,8 +20,9 @@
#ifndef INCLUDED_SVTOOLS_IMAGEMGR_HXX
#define INCLUDED_SVTOOLS_IMAGEMGR_HXX
-#include <svtools/svtdllapi.h>
+#include <rtl/ustring.hxx>
#include <sal/types.h>
+#include <svtools/svtdllapi.h>
enum class SvImageId {
NONE = 0,
@@ -79,9 +80,6 @@ enum class SvImageId {
class Image;
-namespace rtl {
- class OUString;
-};
class INetURLObject;
namespace svtools {
@@ -121,6 +119,7 @@ private:
static rtl::OUString GetDescription_Impl( const INetURLObject& rObject, bool bDetectFolder );
public:
+ SVT_DLLPUBLIC static OUString GetImageId( const INetURLObject& rURL, bool bBig = false );
SVT_DLLPUBLIC static Image GetImage( const INetURLObject& rURL, bool bBig = false );
SVT_DLLPUBLIC static Image GetFileImage( const INetURLObject& rURL );
SVT_DLLPUBLIC static Image GetImageNoDefault( const INetURLObject& rURL, bool bBig = false );
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx
index 31357e2558c5..ed6ee671ef7c 100644
--- a/svtools/source/misc/imagemgr.cxx
+++ b/svtools/source/misc/imagemgr.cxx
@@ -479,104 +479,104 @@ static const char* GetFolderDescriptionId_Impl( const OUString& rURL )
return pRet;
}
-static Image GetImageFromList_Impl( SvImageId nImageId, bool bBig )
+static OUString GetImageNameFromList_Impl( SvImageId nImageId, bool bBig )
{
if (bBig)
{
switch (nImageId)
{
case SvImageId::Impress:
- return Image(BitmapEx(BMP_IMPRESS_LC));
+ return OUString(BMP_IMPRESS_LC);
case SvImageId::Bitmap:
- return Image(BitmapEx(BMP_BITMAP_LC));
+ return OUString(BMP_BITMAP_LC);
case SvImageId::Calc:
- return Image(BitmapEx(BMP_CALC_LC));
+ return OUString(BMP_CALC_LC);
case SvImageId::CalcTemplate:
- return Image(BitmapEx(BMP_CALCTEMPLATE_LC));
+ return OUString(BMP_CALCTEMPLATE_LC);
case SvImageId::Database:
- return Image(BitmapEx(BMP_DATABASE_LC));
+ return OUString(BMP_DATABASE_LC);
case SvImageId::ImpressTemplate:
- return Image(BitmapEx(BMP_IMPRESSTEMPLATE_LC));
+ return OUString(BMP_IMPRESSTEMPLATE_LC);
case SvImageId::GIF:
- return Image(BitmapEx(BMP_GIF_LC));
+ return OUString(BMP_GIF_LC);
case SvImageId::HTML:
- return Image(BitmapEx(BMP_HTML_LC));
+ return OUString(BMP_HTML_LC);
case SvImageId::JPG:
- return Image(BitmapEx(BMP_JPG_LC));
+ return OUString(BMP_JPG_LC);
case SvImageId::Math:
- return Image(BitmapEx(BMP_MATH_LC));
+ return OUString(BMP_MATH_LC);
case SvImageId::MathTemplate:
- return Image(BitmapEx(BMP_MATHTEMPLATE_LC));
+ return OUString(BMP_MATHTEMPLATE_LC);
case SvImageId::File:
- return Image(BitmapEx(BMP_FILE_LC));
+ return OUString(BMP_FILE_LC);
case SvImageId::PCD:
- return Image(BitmapEx(BMP_PCD_LC));
+ return OUString(BMP_PCD_LC);
case SvImageId::PCT:
- return Image(BitmapEx(BMP_PCT_LC));
+ return OUString(BMP_PCT_LC);
case SvImageId::PCX:
- return Image(BitmapEx(BMP_PCX_LC));
+ return OUString(BMP_PCX_LC);
case SvImageId::SIM:
- return Image(BitmapEx(BMP_SIM_LC));
+ return OUString(BMP_SIM_LC);
case SvImageId::TextFile:
- return Image(BitmapEx(BMP_TEXTFILE_LC));
+ return OUString(BMP_TEXTFILE_LC);
case SvImageId::TIFF:
- return Image(BitmapEx(BMP_TIFF_LC));
+ return OUString(BMP_TIFF_LC);
case SvImageId::WMF:
- return Image(BitmapEx(BMP_WMF_LC));
+ return OUString(BMP_WMF_LC);
case SvImageId::Writer:
- return Image(BitmapEx(BMP_WRITER_LC));
+ return OUString(BMP_WRITER_LC);
case SvImageId::WriterTemplate:
- return Image(BitmapEx(BMP_WRITERTEMPLATE_LC));
+ return OUString(BMP_WRITERTEMPLATE_LC);
case SvImageId::FixedDevice:
- return Image(BitmapEx(BMP_FIXEDDEV_LC));
+ return OUString(BMP_FIXEDDEV_LC);
case SvImageId::RemoveableDevice:
- return Image(BitmapEx(BMP_REMOVABLEDEV_LC));
+ return OUString(BMP_REMOVABLEDEV_LC);
case SvImageId::CDRomDevice:
- return Image(BitmapEx(BMP_CDROMDEV_LC));
+ return OUString(BMP_CDROMDEV_LC);
case SvImageId::NetworkDevice:
- return Image(BitmapEx(BMP_NETWORKDEV_LC));
+ return OUString(BMP_NETWORKDEV_LC);
case SvImageId::Table:
- return Image(BitmapEx(BMP_TABLE_LC));
+ return OUString(BMP_TABLE_LC);
case SvImageId::Folder:
- return Image(BitmapEx(BMP_FOLDER_LC));
+ return OUString(BMP_FOLDER_LC);
case SvImageId::DXF:
- return Image(BitmapEx(BMP_DXF_LC));
+ return OUString(BMP_DXF_LC);
case SvImageId::MET:
- return Image(BitmapEx(BMP_MET_LC));
+ return OUString(BMP_MET_LC);
case SvImageId::PNG:
- return Image(BitmapEx(BMP_PNG_LC));
+ return OUString(BMP_PNG_LC);
case SvImageId::SVM:
- return Image(BitmapEx(BMP_SVM_LC));
+ return OUString(BMP_SVM_LC);
case SvImageId::GlobalDoc:
- return Image(BitmapEx(BMP_GLOBAL_DOC_LC));
+ return OUString(BMP_GLOBAL_DOC_LC);
case SvImageId::Draw:
- return Image(BitmapEx(BMP_DRAW_LC));
+ return OUString(BMP_DRAW_LC);
case SvImageId::DrawTemplate:
- return Image(BitmapEx(BMP_DRAWTEMPLATE_LC));
+ return OUString(BMP_DRAWTEMPLATE_LC);
case SvImageId::OO_DatabaseDoc:
- return Image(BitmapEx(BMP_OO_DATABASE_DOC_LC));
+ return OUString(BMP_OO_DATABASE_DOC_LC);
case SvImageId::OO_DrawDoc:
- return Image(BitmapEx(BMP_OO_DRAW_DOC_LC));
+ return OUString(BMP_OO_DRAW_DOC_LC);
case SvImageId::OO_MathDoc:
- return Image(BitmapEx(BMP_OO_MATH_DOC_LC));
+ return OUString(BMP_OO_MATH_DOC_LC);
case SvImageId::OO_GlobalDoc:
- return Image(BitmapEx(BMP_OO_GLOBAL_DOC_LC));
+ return OUString(BMP_OO_GLOBAL_DOC_LC);
case SvImageId::OO_ImpressDoc:
- return Image(BitmapEx(BMP_OO_IMPRESS_DOC_LC));
+ return OUString(BMP_OO_IMPRESS_DOC_LC);
case SvImageId::OO_CalcDoc:
- return Image(BitmapEx(BMP_OO_CALC_DOC_LC));
+ return OUString(BMP_OO_CALC_DOC_LC);
case SvImageId::OO_WriterDoc:
- return Image(BitmapEx(BMP_OO_WRITER_DOC_LC));
+ return OUString(BMP_OO_WRITER_DOC_LC);
case SvImageId::OO_DrawTemplate:
- return Image(BitmapEx(BMP_OO_DRAW_TEMPLATE_LC));
+ return OUString(BMP_OO_DRAW_TEMPLATE_LC);
case SvImageId::OO_ImpressTemplate:
- return Image(BitmapEx(BMP_OO_IMPRESS_TEMPLATE_LC));
+ return OUString(BMP_OO_IMPRESS_TEMPLATE_LC);
case SvImageId::OO_CalcTemplate:
- return Image(BitmapEx(BMP_OO_CALC_TEMPLATE_LC));
+ return OUString(BMP_OO_CALC_TEMPLATE_LC);
case SvImageId::OO_WriterTemplate:
- return Image(BitmapEx(BMP_OO_WRITER_TEMPLATE_LC));
+ return OUString(BMP_OO_WRITER_TEMPLATE_LC);
case SvImageId::Extension:
- return Image(BitmapEx(BMP_EXTENSION_LC));
+ return OUString(BMP_EXTENSION_LC);
default: break;
}
}
@@ -585,102 +585,110 @@ static Image GetImageFromList_Impl( SvImageId nImageId, bool bBig )
switch (nImageId)
{
case SvImageId::Impress:
- return Image(BitmapEx(BMP_IMPRESS_SC));
+ return OUString(BMP_IMPRESS_SC);
case SvImageId::Bitmap:
- return Image(BitmapEx(BMP_BITMAP_SC));
+ return OUString(BMP_BITMAP_SC);
case SvImageId::Calc:
- return Image(BitmapEx(BMP_CALC_SC));
+ return OUString(BMP_CALC_SC);
case SvImageId::CalcTemplate:
- return Image(BitmapEx(BMP_CALCTEMPLATE_SC));
+ return OUString(BMP_CALCTEMPLATE_SC);
case SvImageId::Database:
- return Image(BitmapEx(BMP_DATABASE_SC));
+ return OUString(BMP_DATABASE_SC);
case SvImageId::ImpressTemplate:
- return Image(BitmapEx(BMP_IMPRESSTEMPLATE_SC));
+ return OUString(BMP_IMPRESSTEMPLATE_SC);
case SvImageId::GIF:
- return Image(BitmapEx(BMP_GIF_SC));
+ return OUString(BMP_GIF_SC);
case SvImageId::HTML:
- return Image(BitmapEx(BMP_HTML_SC));
+ return OUString(BMP_HTML_SC);
case SvImageId::JPG:
- return Image(BitmapEx(BMP_JPG_SC));
+ return OUString(BMP_JPG_SC);
case SvImageId::Math:
- return Image(BitmapEx(BMP_MATH_SC));
+ return OUString(BMP_MATH_SC);
case SvImageId::MathTemplate:
- return Image(BitmapEx(BMP_MATHTEMPLATE_SC));
+ return OUString(BMP_MATHTEMPLATE_SC);
case SvImageId::File:
- return Image(BitmapEx(BMP_FILE_SC));
+ return OUString(BMP_FILE_SC);
case SvImageId::PCD:
- return Image(BitmapEx(BMP_PCD_SC));
+ return OUString(BMP_PCD_SC);
case SvImageId::PCT:
- return Image(BitmapEx(BMP_PCT_SC));
+ return OUString(BMP_PCT_SC);
case SvImageId::PCX:
- return Image(BitmapEx(BMP_PCX_SC));
+ return OUString(BMP_PCX_SC);
case SvImageId::SIM:
- return Image(BitmapEx(BMP_SIM_SC));
+ return OUString(BMP_SIM_SC);
case SvImageId::TextFile:
- return Image(BitmapEx(BMP_TEXTFILE_SC));
+ return OUString(BMP_TEXTFILE_SC);
case SvImageId::TIFF:
- return Image(BitmapEx(BMP_TIFF_SC));
+ return OUString(BMP_TIFF_SC);
case SvImageId::WMF:
- return Image(BitmapEx(BMP_WMF_SC));
+ return OUString(BMP_WMF_SC);
case SvImageId::Writer:
- return Image(BitmapEx(BMP_WRITER_SC));
+ return OUString(BMP_WRITER_SC);
case SvImageId::WriterTemplate:
- return Image(BitmapEx(BMP_WRITERTEMPLATE_SC));
+ return OUString(BMP_WRITERTEMPLATE_SC);
case SvImageId::FixedDevice:
- return Image(BitmapEx(BMP_FIXEDDEV_SC));
+ return OUString(BMP_FIXEDDEV_SC);
case SvImageId::RemoveableDevice:
- return Image(BitmapEx(BMP_REMOVABLEDEV_SC));
+ return OUString(BMP_REMOVABLEDEV_SC);
case SvImageId::CDRomDevice:
- return Image(BitmapEx(BMP_CDROMDEV_SC));
+ return OUString(BMP_CDROMDEV_SC);
case SvImageId::NetworkDevice:
- return Image(BitmapEx(BMP_NETWORKDEV_SC));
+ return OUString(BMP_NETWORKDEV_SC);
case SvImageId::Table:
- return Image(BitmapEx(BMP_TABLE_SC));
+ return OUString(BMP_TABLE_SC);
case SvImageId::Folder:
// if not bBig, then return our new small folder image (256 colors)
- return Image(BitmapEx(RID_BMP_FOLDER));
+ return OUString(RID_BMP_FOLDER);
case SvImageId::DXF:
- return Image(BitmapEx(BMP_DXF_SC));
+ return OUString(BMP_DXF_SC);
case SvImageId::MET:
- return Image(BitmapEx(BMP_MET_SC));
+ return OUString(BMP_MET_SC);
case SvImageId::PNG:
- return Image(BitmapEx(BMP_PNG_SC));
+ return OUString(BMP_PNG_SC);
case SvImageId::SVM:
- return Image(BitmapEx(BMP_SVM_SC));
+ return OUString(BMP_SVM_SC);
case SvImageId::GlobalDoc:
- return Image(BitmapEx(BMP_GLOBAL_DOC_SC));
+ return OUString(BMP_GLOBAL_DOC_SC);
case SvImageId::Draw:
- return Image(BitmapEx(BMP_DRAW_SC));
+ return OUString(BMP_DRAW_SC);
case SvImageId::DrawTemplate:
- return Image(BitmapEx(BMP_DRAWTEMPLATE_SC));
+ return OUString(BMP_DRAWTEMPLATE_SC);
case SvImageId::OO_DatabaseDoc:
- return Image(BitmapEx(BMP_OO_DATABASE_DOC_SC));
+ return OUString(BMP_OO_DATABASE_DOC_SC);
case SvImageId::OO_DrawDoc:
- return Image(BitmapEx(BMP_OO_DRAW_DOC_SC));
+ return OUString(BMP_OO_DRAW_DOC_SC);
case SvImageId::OO_MathDoc:
- return Image(BitmapEx(BMP_OO_MATH_DOC_SC));
+ return OUString(BMP_OO_MATH_DOC_SC);
case SvImageId::OO_GlobalDoc:
- return Image(BitmapEx(BMP_OO_GLOBAL_DOC_SC));
+ return OUString(BMP_OO_GLOBAL_DOC_SC);
case SvImageId::OO_ImpressDoc:
- return Image(BitmapEx(BMP_OO_IMPRESS_DOC_SC));
+ return OUString(BMP_OO_IMPRESS_DOC_SC);
case SvImageId::OO_CalcDoc:
- return Image(BitmapEx(BMP_OO_CALC_DOC_SC));
+ return OUString(BMP_OO_CALC_DOC_SC);
case SvImageId::OO_WriterDoc:
- return Image(BitmapEx(BMP_OO_WRITER_DOC_SC));
+ return OUString(BMP_OO_WRITER_DOC_SC);
case SvImageId::OO_DrawTemplate:
- return Image(BitmapEx(BMP_OO_DRAW_TEMPLATE_SC));
+ return OUString(BMP_OO_DRAW_TEMPLATE_SC);
case SvImageId::OO_ImpressTemplate:
- return Image(BitmapEx(BMP_OO_IMPRESS_TEMPLATE_SC));
+ return OUString(BMP_OO_IMPRESS_TEMPLATE_SC);
case SvImageId::OO_CalcTemplate:
- return Image(BitmapEx(BMP_OO_CALC_TEMPLATE_SC));
+ return OUString(BMP_OO_CALC_TEMPLATE_SC);
case SvImageId::OO_WriterTemplate:
- return Image(BitmapEx(BMP_OO_WRITER_TEMPLATE_SC));
+ return OUString(BMP_OO_WRITER_TEMPLATE_SC);
case SvImageId::Extension:
- return Image(BitmapEx(BMP_EXTENSION_SC));
+ return OUString(BMP_EXTENSION_SC);
default: break;
}
}
+ return OUString();
+}
+
+static Image GetImageFromList_Impl( SvImageId nImageId, bool bBig )
+{
+ OUString sImageName(GetImageNameFromList_Impl(nImageId, bBig));
+ if (!sImageName.isEmpty())
+ return Image(BitmapEx(sImageName));
return Image();
}
@@ -749,6 +757,13 @@ OUString SvFileInformationManager::GetDescription_Impl( const INetURLObject& rOb
return sDescription;
}
+OUString SvFileInformationManager::GetImageId(const INetURLObject& rObject, bool bBig)
+{
+ SvImageId nImage = GetImageId_Impl( rObject, true );
+ DBG_ASSERT( nImage != SvImageId::NONE, "invalid ImageId" );
+ return GetImageNameFromList_Impl(nImage, bBig);
+}
+
Image SvFileInformationManager::GetImage( const INetURLObject& rObject, bool bBig )
{
SvImageId nImage = GetImageId_Impl( rObject, true );
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 4f5c0850418c..9556fcd8c659 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1313,14 +1313,19 @@ public:
nInsertedAt = m_xTreeView->InsertEntry(rStr, pos == -1 ? COMBOBOX_APPEND : pos);
else
{
- assert((rImage == "dialog-warning" || rImage == "dialog-error" || rImage == "dialog-information") && "unknown stock image");
Image aImage;
- if (rImage == "dialog-warning")
- aImage = Image(BitmapEx(IMG_WARN));
- else if (rImage == "dialog-error")
- aImage = Image(BitmapEx(IMG_ERROR));
- else if (rImage == "dialog-information")
- aImage = Image(BitmapEx(IMG_INFO));
+ if (rImage.lastIndexOf('.') != rImage.getLength() - 4)
+ {
+ assert((rImage == "dialog-warning" || rImage == "dialog-error" || rImage == "dialog-information") && "unknown stock image");
+ if (rImage == "dialog-warning")
+ aImage = Image(BitmapEx(IMG_WARN));
+ else if (rImage == "dialog-error")
+ aImage = Image(BitmapEx(IMG_ERROR));
+ else if (rImage == "dialog-information")
+ aImage = Image(BitmapEx(IMG_INFO));
+ }
+ else
+ aImage = Image(BitmapEx(rImage));
nInsertedAt = m_xTreeView->InsertEntry(rStr, aImage, pos == -1 ? COMBOBOX_APPEND : pos);
}
m_xTreeView->SetEntryData(nInsertedAt, new OUString(rId));
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 8ffa151cd4b7..a8214280624c 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3000,6 +3000,24 @@ namespace
g_free(pStr);
return found;
}
+
+ GdkPixbuf* load_icon_by_name(const OUString& rIconName, const OUString& rIconTheme, const OUString& rUILang)
+ {
+ GdkPixbuf* pixbuf = nullptr;
+ auto xMemStm = ImageTree::get().getImageStream(rIconName, rIconTheme, rUILang);
+ if (xMemStm)
+ {
+ GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new();
+ gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()),
+ xMemStm->Seek(STREAM_SEEK_TO_END), nullptr);
+ gdk_pixbuf_loader_close(pixbuf_loader, nullptr);
+ pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader);
+ if (pixbuf)
+ g_object_ref(pixbuf);
+ g_object_unref(pixbuf_loader);
+ }
+ return pixbuf;
+ }
}
class GtkInstanceTreeView : public GtkInstanceContainer, public virtual weld::TreeView
@@ -3073,13 +3091,33 @@ public:
}
else
{
- assert((rImage == "dialog-warning" || rImage == "dialog-error" || rImage == "dialog-information") && "unknown stock image");
+ GdkPixbuf* pixbuf = nullptr;
+
+ if (rImage.lastIndexOf('.') != rImage.getLength() - 4)
+ {
+ assert((rImage == "dialog-warning" || rImage == "dialog-error" || rImage == "dialog-information") && "unknown stock image");
+
+ GError *error = nullptr;
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
+ pixbuf = gtk_icon_theme_load_icon(icon_theme, OUStringToOString(rImage, RTL_TEXTENCODING_UTF8).getStr(),
+ 16, GTK_ICON_LOOKUP_USE_BUILTIN, &error);
+ }
+ else
+ {
+ const AllSettings& rSettings = Application::GetSettings();
+ pixbuf = load_icon_by_name(rImage,
+ rSettings.GetStyleSettings().DetermineIconTheme(),
+ rSettings.GetUILanguageTag().getBcp47());
+ }
gtk_list_store_set(m_pListStore, &iter,
0, OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(),
1, OUStringToOString(rId, RTL_TEXTENCODING_UTF8).getStr(),
- 2, OUStringToOString(rImage, RTL_TEXTENCODING_UTF8).getStr(),
+ 2, pixbuf,
-1);
+
+ if (pixbuf)
+ g_object_unref(pixbuf);
}
enable_notify_events();
}
@@ -4349,17 +4387,11 @@ private:
if (icon_name)
{
OUString aIconName(icon_name, strlen(icon_name), RTL_TEXTENCODING_UTF8);
- auto xMemStm = ImageTree::get().getImageStream(aIconName, m_aIconTheme, m_aUILang);
- if (xMemStm)
+ GdkPixbuf* pixbuf = load_icon_by_name(aIconName, m_aIconTheme, m_aUILang);
+ if (pixbuf)
{
- GdkPixbufLoader *pixbuf_loader = gdk_pixbuf_loader_new();
- gdk_pixbuf_loader_write(pixbuf_loader, static_cast<const guchar*>(xMemStm->GetData()),
- xMemStm->Seek(STREAM_SEEK_TO_END), nullptr);
- gdk_pixbuf_loader_close(pixbuf_loader, nullptr);
- GdkPixbuf* pixbuf = gdk_pixbuf_loader_get_pixbuf(pixbuf_loader);
-
gtk_image_set_from_pixbuf(pImage, pixbuf);
- g_object_unref(pixbuf_loader);
+ g_object_unref(pixbuf);
}
}
}
More information about the Libreoffice-commits
mailing list