summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/source/dialog/taskpane.cxx30
-rw-r--r--sfx2/workben/custompanel/WriterWindowState.xcu3
-rw-r--r--sfx2/workben/custompanel/makefile.mk14
-rw-r--r--sfx2/workben/custompanel/manifest.xml2
-rw-r--r--sfx2/workben/custompanel/panel.pngbin0 -> 202 bytes
5 files changed, 45 insertions, 4 deletions
diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx
index c7d91df1ce6b..4023842f2d15 100644
--- a/sfx2/source/dialog/taskpane.cxx
+++ b/sfx2/source/dialog/taskpane.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/awt/XWindowPeer.hpp>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
/** === end UNO includes === **/
#include <comphelper/componentcontext.hxx>
@@ -84,6 +85,8 @@ namespace sfx2
using ::com::sun::star::frame::XModuleManager;
using ::com::sun::star::frame::XFrame;
using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::graphic::XGraphicProvider;
+ using ::com::sun::star::graphic::XGraphic;
/** === end UNO using === **/
namespace PosSize = ::com::sun::star::awt::PosSize;
@@ -240,6 +243,29 @@ namespace sfx2
}
//--------------------------------------------------------------------------------------------------------------
+ Image lcl_getPanelImage( const ::utl::OConfigurationNode& i_rPanelConfigNode )
+ {
+ const ::rtl::OUString sImageURL( ::comphelper::getString( i_rPanelConfigNode.getNodeValue( "ImageURL" ) ) );
+ if ( sImageURL.getLength() )
+ {
+ try
+ {
+ const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW );
+
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", sImageURL );
+
+ const Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_SET_THROW );
+ return Image( xGraphic );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ return Image();
+ }
}
//==================================================================================================================
@@ -374,6 +400,7 @@ namespace sfx2
//------------------------------------------------------------------------------------------------------------------
CustomToolPanel::CustomToolPanel( const ::utl::OConfigurationNode& i_rPanelWindowState )
:m_sUIName( ::comphelper::getString( i_rPanelWindowState.getNodeValue( "UIName" ) ) )
+ ,m_aPanelImage( lcl_getPanelImage( i_rPanelWindowState ) )
,m_sResourceURL( i_rPanelWindowState.getLocalName() )
,m_aCustomPanel()
,m_bAttemptedCreation( false )
@@ -422,8 +449,7 @@ namespace sfx2
//------------------------------------------------------------------------------------------------------------------
Image CustomToolPanel::GetImage() const
{
- // TODO: read from configuration
- return Image();
+ return m_aPanelImage;
}
//------------------------------------------------------------------------------------------------------------------
diff --git a/sfx2/workben/custompanel/WriterWindowState.xcu b/sfx2/workben/custompanel/WriterWindowState.xcu
index 1110d8a6fdaa..79f71e8736f8 100644
--- a/sfx2/workben/custompanel/WriterWindowState.xcu
+++ b/sfx2/workben/custompanel/WriterWindowState.xcu
@@ -9,6 +9,9 @@
<prop oor:name="Visible" oor:type="xs:boolean">
<value>true</value>
</prop>
+ <prop oor:name="ImageURL" oor:type="xs:string">
+ <value>vnd.sun.star.extension://UPDATED_IDENTIFIER/panel.png</value>
+ </prop>
</node>
</node>
</node>
diff --git a/sfx2/workben/custompanel/makefile.mk b/sfx2/workben/custompanel/makefile.mk
index b31625b1b9ab..c90fcc6cf444 100644
--- a/sfx2/workben/custompanel/makefile.mk
+++ b/sfx2/workben/custompanel/makefile.mk
@@ -82,13 +82,23 @@ COMPONENT_XCU = \
$(EXTENSIONDIR)/Factories.xcu
COMPONENT_LIBRARIES = \
- $(EXTENSIONDIR)$/$(SHL1TARGET)$(DLLPOST)
+ $(EXTENSIONDIR)/$(SHL1TARGET)$(DLLPOST)
+
+COMPONENT_IMAGES= \
+ $(EXTENSIONDIR)/panel.png
# ........ dependencies for packaging the extension ........
-EXTENSION_PACKDEPS=makefile.mk
+EXTENSION_PACKDEPS=makefile.mk $(COMPONENT_IMAGES)
# --- Targets ------------------------------------------------------
.INCLUDE : extension_pre.mk
.INCLUDE : target.mk
.INCLUDE : extension_post.mk
+$(EXTENSIONDIR)/%.png : ./%.png
+ @@-$(MKDIRHIER) $(@:d)
+ @$(COPY) $< $@ > $(NULLDEV)
+
+$(EXTENSIONDIR)/WriterWindowState.xcu: ./WriterWindowState.xcu
+ @@-$(MKDIRHIER) $(@:d)
+ $(COMMAND_ECHO)$(TYPE) ./WriterWindowState.xcu | sed s/UPDATED_IDENTIFIER/$(IMPLEMENTATION_IDENTIFIER)/ > $(EXTENSIONDIR)/WriterWindowState.xcu
diff --git a/sfx2/workben/custompanel/manifest.xml b/sfx2/workben/custompanel/manifest.xml
index b57e3a8fbe0d..1089f8b6fd59 100644
--- a/sfx2/workben/custompanel/manifest.xml
+++ b/sfx2/workben/custompanel/manifest.xml
@@ -7,4 +7,6 @@
manifest:full-path="WriterWindowState.xcu"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
manifest:full-path="Factories.xcu"/>
+ <!-- <manifest:file-entry manifest:media-type="image/png"
+ manifest:full-path="panel.png"/>-->
</manifest:manifest>
diff --git a/sfx2/workben/custompanel/panel.png b/sfx2/workben/custompanel/panel.png
new file mode 100644
index 000000000000..2438714af8a6
--- /dev/null
+++ b/sfx2/workben/custompanel/panel.png
Binary files differ