|
|
69cc7b |
From 8daa13abb5ebec4d0b867f1d56ebc8516ae3bb71 Mon Sep 17 00:00:00 2001
|
|
|
69cc7b |
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
|
69cc7b |
Date: Tue, 9 May 2017 13:27:06 +0100
|
|
|
69cc7b |
Subject: [PATCH 2/2] Resolves: tdf#62702 allow ole objects to be inserted as
|
|
|
69cc7b |
icons
|
|
|
69cc7b |
|
|
|
69cc7b |
under windows on "create new", "further objects" you get the
|
|
|
69cc7b |
native windows insert object dialog which has the "Display As Icon"
|
|
|
69cc7b |
option, but on Linux etc (or using our own dialog) there isn't that
|
|
|
69cc7b |
option
|
|
|
69cc7b |
|
|
|
69cc7b |
so add a "Display as icon" checkbox in our own dialog and generate
|
|
|
69cc7b |
an icon through SvFileInformationManager::GetImage
|
|
|
69cc7b |
|
|
|
69cc7b |
Change-Id: I0a400189031900bd1e387465ec4ba57847cb5394
|
|
|
69cc7b |
(cherry picked from commit f505f95d466d4d3348f41dfd93e5c243d15c6c71)
|
|
|
69cc7b |
---
|
|
|
69cc7b |
cui/source/dialogs/insdlg.cxx | 16 +++++
|
|
|
69cc7b |
cui/source/inc/insdlg.hxx | 1 +
|
|
|
69cc7b |
cui/uiconfig/ui/insertoleobject.ui | 131 +++++++++++++++++++++----------------
|
|
|
69cc7b |
3 files changed, 90 insertions(+), 58 deletions(-)
|
|
|
69cc7b |
|
|
|
69cc7b |
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
|
|
|
69cc7b |
index 47af495..ac404bb 100644
|
|
|
69cc7b |
--- a/cui/source/dialogs/insdlg.cxx
|
|
|
69cc7b |
+++ b/cui/source/dialogs/insdlg.cxx
|
|
|
69cc7b |
@@ -34,6 +34,7 @@
|
|
|
69cc7b |
|
|
|
69cc7b |
#include "insdlg.hxx"
|
|
|
69cc7b |
#include <dialmgr.hxx>
|
|
|
69cc7b |
+#include <svtools/imagemgr.hxx>
|
|
|
69cc7b |
#include <svtools/sores.hxx>
|
|
|
69cc7b |
|
|
|
69cc7b |
#include <tools/urlobj.hxx>
|
|
|
69cc7b |
@@ -164,6 +165,7 @@ SvInsertOleDlg::SvInsertOleDlg
|
|
|
69cc7b |
get(m_pEdFilepath, "urled");
|
|
|
69cc7b |
get(m_pBtnFilepath, "urlbtn");
|
|
|
69cc7b |
get(m_pCbFilelink, "linktofile");
|
|
|
69cc7b |
+ get(m_pCbAsIcon, "asicon");
|
|
|
69cc7b |
m_pLbObjecttype->SetDoubleClickHdl( LINK( this, SvInsertOleDlg, DoubleClickHdl ) );
|
|
|
69cc7b |
m_pBtnFilepath->SetClickHdl( LINK( this, SvInsertOleDlg, BrowseHdl ) );
|
|
|
69cc7b |
Link<Button*,void> aLink( LINK( this, SvInsertOleDlg, RadioHdl ) );
|
|
|
69cc7b |
@@ -188,6 +190,7 @@ void SvInsertOleDlg::dispose()
|
|
|
69cc7b |
m_pEdFilepath.clear();
|
|
|
69cc7b |
m_pBtnFilepath.clear();
|
|
|
69cc7b |
m_pCbFilelink.clear();
|
|
|
69cc7b |
+ m_pCbAsIcon.clear();
|
|
|
69cc7b |
InsertObjectDialog_Impl::dispose();
|
|
|
69cc7b |
}
|
|
|
69cc7b |
|
|
|
69cc7b |
@@ -328,6 +331,19 @@ short SvInsertOleDlg::Execute()
|
|
|
69cc7b |
aErr = aErr.replaceFirst( "%", aFileName );
|
|
|
69cc7b |
ScopedVclPtrInstance<MessageDialog>(this, aErr)->Execute();
|
|
|
69cc7b |
}
|
|
|
69cc7b |
+ else
|
|
|
69cc7b |
+ {
|
|
|
69cc7b |
+ if (m_pCbAsIcon->IsChecked())
|
|
|
69cc7b |
+ {
|
|
|
69cc7b |
+ //something nice here I guess would be to write the filename into
|
|
|
69cc7b |
+ //the image with this icon above it
|
|
|
69cc7b |
+ Image aImage = SvFileInformationManager::GetImage(aURL, true);
|
|
|
69cc7b |
+ SvMemoryStream aTemp;
|
|
|
69cc7b |
+ WriteDIBBitmapEx(aImage.GetBitmapEx(), aTemp);
|
|
|
69cc7b |
+ m_aIconMetaFile = Sequence<sal_Int8>(static_cast<const sal_Int8*>(aTemp.GetData()), aTemp.Seek(STREAM_SEEK_TO_END));
|
|
|
69cc7b |
+ m_aIconMediaType = "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"";
|
|
|
69cc7b |
+ }
|
|
|
69cc7b |
+ }
|
|
|
69cc7b |
}
|
|
|
69cc7b |
}
|
|
|
69cc7b |
|
|
|
69cc7b |
diff --git a/cui/source/inc/insdlg.hxx b/cui/source/inc/insdlg.hxx
|
|
|
69cc7b |
index cd6a45a..4b42774 100644
|
|
|
69cc7b |
--- a/cui/source/inc/insdlg.hxx
|
|
|
69cc7b |
+++ b/cui/source/inc/insdlg.hxx
|
|
|
69cc7b |
@@ -64,6 +64,7 @@ class SvInsertOleDlg : public InsertObjectDialog_Impl
|
|
|
69cc7b |
VclPtr<Edit> m_pEdFilepath;
|
|
|
69cc7b |
VclPtr<PushButton> m_pBtnFilepath;
|
|
|
69cc7b |
VclPtr<CheckBox> m_pCbFilelink;
|
|
|
69cc7b |
+ VclPtr<CheckBox> m_pCbAsIcon;
|
|
|
69cc7b |
const SvObjectServerList* m_pServers;
|
|
|
69cc7b |
|
|
|
69cc7b |
css::uno::Sequence< sal_Int8 > m_aIconMetaFile;
|
|
|
69cc7b |
diff --git a/cui/uiconfig/ui/insertoleobject.ui b/cui/uiconfig/ui/insertoleobject.ui
|
|
|
69cc7b |
index 5ddf229..1aaeecb 100644
|
|
|
69cc7b |
--- a/cui/uiconfig/ui/insertoleobject.ui
|
|
|
69cc7b |
+++ b/cui/uiconfig/ui/insertoleobject.ui
|
|
|
69cc7b |
@@ -1,5 +1,5 @@
|
|
|
69cc7b |
|
|
|
69cc7b |
-
|
|
|
69cc7b |
+
|
|
|
69cc7b |
<interface>
|
|
|
69cc7b |
<requires lib="gtk+" version="3.0"/>
|
|
|
69cc7b |
<object class="GtkDialog" id="InsertOLEObjectDialog">
|
|
|
69cc7b |
@@ -12,6 +12,63 @@
|
|
|
69cc7b |
<property name="can_focus">False</property>
|
|
|
69cc7b |
<property name="orientation">vertical</property>
|
|
|
69cc7b |
<property name="spacing">12</property>
|
|
|
69cc7b |
+ <child internal-child="action_area">
|
|
|
69cc7b |
+ <object class="GtkButtonBox" id="dialog-action_area1">
|
|
|
69cc7b |
+ <property name="can_focus">False</property>
|
|
|
69cc7b |
+ <property name="layout_style">end</property>
|
|
|
69cc7b |
+ <child>
|
|
|
69cc7b |
+ <object class="GtkButton" id="ok">
|
|
|
69cc7b |
+ <property name="label">gtk-ok</property>
|
|
|
69cc7b |
+ <property name="visible">True</property>
|
|
|
69cc7b |
+ <property name="can_focus">True</property>
|
|
|
69cc7b |
+ <property name="can_default">True</property>
|
|
|
69cc7b |
+ <property name="has_default">True</property>
|
|
|
69cc7b |
+ <property name="receives_default">True</property>
|
|
|
69cc7b |
+ <property name="use_stock">True</property>
|
|
|
69cc7b |
+ </object>
|
|
|
69cc7b |
+ <packing>
|
|
|
69cc7b |
+ <property name="expand">False</property>
|
|
|
69cc7b |
+ <property name="fill">True</property>
|
|
|
69cc7b |
+ <property name="position">0</property>
|
|
|
69cc7b |
+ </packing>
|
|
|
69cc7b |
+ </child>
|
|
|
69cc7b |
+ <child>
|
|
|
69cc7b |
+ <object class="GtkButton" id="cancel">
|
|
|
69cc7b |
+ <property name="label">gtk-cancel</property>
|
|
|
69cc7b |
+ <property name="visible">True</property>
|
|
|
69cc7b |
+ <property name="can_focus">True</property>
|
|
|
69cc7b |
+ <property name="receives_default">True</property>
|
|
|
69cc7b |
+ <property name="use_stock">True</property>
|
|
|
69cc7b |
+ </object>
|
|
|
69cc7b |
+ <packing>
|
|
|
69cc7b |
+ <property name="expand">False</property>
|
|
|
69cc7b |
+ <property name="fill">True</property>
|
|
|
69cc7b |
+ <property name="position">1</property>
|
|
|
69cc7b |
+ </packing>
|
|
|
69cc7b |
+ </child>
|
|
|
69cc7b |
+ <child>
|
|
|
69cc7b |
+ <object class="GtkButton" id="help">
|
|
|
69cc7b |
+ <property name="label">gtk-help</property>
|
|
|
69cc7b |
+ <property name="visible">True</property>
|
|
|
69cc7b |
+ <property name="can_focus">True</property>
|
|
|
69cc7b |
+ <property name="receives_default">True</property>
|
|
|
69cc7b |
+ <property name="use_stock">True</property>
|
|
|
69cc7b |
+ </object>
|
|
|
69cc7b |
+ <packing>
|
|
|
69cc7b |
+ <property name="expand">False</property>
|
|
|
69cc7b |
+ <property name="fill">True</property>
|
|
|
69cc7b |
+ <property name="position">2</property>
|
|
|
69cc7b |
+ <property name="secondary">True</property>
|
|
|
69cc7b |
+ </packing>
|
|
|
69cc7b |
+ </child>
|
|
|
69cc7b |
+ </object>
|
|
|
69cc7b |
+ <packing>
|
|
|
69cc7b |
+ <property name="expand">False</property>
|
|
|
69cc7b |
+ <property name="fill">True</property>
|
|
|
69cc7b |
+ <property name="pack_type">end</property>
|
|
|
69cc7b |
+ <property name="position">1</property>
|
|
|
69cc7b |
+ </packing>
|
|
|
69cc7b |
+ </child>
|
|
|
69cc7b |
<child>
|
|
|
69cc7b |
<object class="GtkBox" id="box1">
|
|
|
69cc7b |
<property name="width_request">400</property>
|
|
|
69cc7b |
@@ -162,6 +219,21 @@
|
|
|
69cc7b |
<property name="top_attach">1</property>
|
|
|
69cc7b |
</packing>
|
|
|
69cc7b |
</child>
|
|
|
69cc7b |
+ <child>
|
|
|
69cc7b |
+ <object class="GtkCheckButton" id="asicon">
|
|
|
69cc7b |
+ <property name="label" translatable="yes">Display as icon</property>
|
|
|
69cc7b |
+ <property name="visible">True</property>
|
|
|
69cc7b |
+ <property name="can_focus">True</property>
|
|
|
69cc7b |
+ <property name="receives_default">False</property>
|
|
|
69cc7b |
+ <property name="xalign">0</property>
|
|
|
69cc7b |
+ <property name="draw_indicator">True</property>
|
|
|
69cc7b |
+ </object>
|
|
|
69cc7b |
+ <packing>
|
|
|
69cc7b |
+ <property name="left_attach">0</property>
|
|
|
69cc7b |
+ <property name="top_attach">2</property>
|
|
|
69cc7b |
+ <property name="width">2</property>
|
|
|
69cc7b |
+ </packing>
|
|
|
69cc7b |
+ </child>
|
|
|
69cc7b |
</object>
|
|
|
69cc7b |
</child>
|
|
|
69cc7b |
</object>
|
|
|
69cc7b |
@@ -191,63 +263,6 @@
|
|
|
69cc7b |
<property name="position">0</property>
|
|
|
69cc7b |
</packing>
|
|
|
69cc7b |
</child>
|
|
|
69cc7b |
- <child internal-child="action_area">
|
|
|
69cc7b |
- <object class="GtkButtonBox" id="dialog-action_area1">
|
|
|
69cc7b |
- <property name="can_focus">False</property>
|
|
|
69cc7b |
- <property name="layout_style">end</property>
|
|
|
69cc7b |
- <child>
|
|
|
69cc7b |
- <object class="GtkButton" id="ok">
|
|
|
69cc7b |
- <property name="label">gtk-ok</property>
|
|
|
69cc7b |
- <property name="visible">True</property>
|
|
|
69cc7b |
- <property name="can_focus">True</property>
|
|
|
69cc7b |
- <property name="can_default">True</property>
|
|
|
69cc7b |
- <property name="has_default">True</property>
|
|
|
69cc7b |
- <property name="receives_default">True</property>
|
|
|
69cc7b |
- <property name="use_stock">True</property>
|
|
|
69cc7b |
- </object>
|
|
|
69cc7b |
- <packing>
|
|
|
69cc7b |
- <property name="expand">False</property>
|
|
|
69cc7b |
- <property name="fill">True</property>
|
|
|
69cc7b |
- <property name="position">0</property>
|
|
|
69cc7b |
- </packing>
|
|
|
69cc7b |
- </child>
|
|
|
69cc7b |
- <child>
|
|
|
69cc7b |
- <object class="GtkButton" id="cancel">
|
|
|
69cc7b |
- <property name="label">gtk-cancel</property>
|
|
|
69cc7b |
- <property name="visible">True</property>
|
|
|
69cc7b |
- <property name="can_focus">True</property>
|
|
|
69cc7b |
- <property name="receives_default">True</property>
|
|
|
69cc7b |
- <property name="use_stock">True</property>
|
|
|
69cc7b |
- </object>
|
|
|
69cc7b |
- <packing>
|
|
|
69cc7b |
- <property name="expand">False</property>
|
|
|
69cc7b |
- <property name="fill">True</property>
|
|
|
69cc7b |
- <property name="position">1</property>
|
|
|
69cc7b |
- </packing>
|
|
|
69cc7b |
- </child>
|
|
|
69cc7b |
- <child>
|
|
|
69cc7b |
- <object class="GtkButton" id="help">
|
|
|
69cc7b |
- <property name="label">gtk-help</property>
|
|
|
69cc7b |
- <property name="visible">True</property>
|
|
|
69cc7b |
- <property name="can_focus">True</property>
|
|
|
69cc7b |
- <property name="receives_default">True</property>
|
|
|
69cc7b |
- <property name="use_stock">True</property>
|
|
|
69cc7b |
- </object>
|
|
|
69cc7b |
- <packing>
|
|
|
69cc7b |
- <property name="expand">False</property>
|
|
|
69cc7b |
- <property name="fill">True</property>
|
|
|
69cc7b |
- <property name="position">2</property>
|
|
|
69cc7b |
- <property name="secondary">True</property>
|
|
|
69cc7b |
- </packing>
|
|
|
69cc7b |
- </child>
|
|
|
69cc7b |
- </object>
|
|
|
69cc7b |
- <packing>
|
|
|
69cc7b |
- <property name="expand">False</property>
|
|
|
69cc7b |
- <property name="fill">True</property>
|
|
|
69cc7b |
- <property name="pack_type">end</property>
|
|
|
69cc7b |
- <property name="position">1</property>
|
|
|
69cc7b |
- </packing>
|
|
|
69cc7b |
- </child>
|
|
|
69cc7b |
</object>
|
|
|
69cc7b |
</child>
|
|
|
69cc7b |
<action-widgets>
|
|
|
69cc7b |
--
|
|
|
69cc7b |
2.9.3
|
|
|
69cc7b |
|