Index: svtools/inc/imagemgr.hxx =================================================================== RCS file: /cvs/util/svtools/inc/imagemgr.hxx,v --- svtools/inc/imagemgr.hxx 11 Apr 2002 09:59:41 -0000 1.5 +++ svtools/inc/imagemgr.hxx 22 Dec 2004 18:08:18 -0000 @@ -70,6 +70,8 @@ #ifndef _IMAGE_HXX #include #endif +#include +#include class INetURLObject; @@ -125,6 +127,8 @@ public: static String GetDescription( const INetURLObject& rObject ); static String GetFileDescription( const INetURLObject& rObject ); static String GetFolderDescription( const svtools::VolumeInfo& rInfo ); + + static std::list< BitmapEx > GetIcons( sal_Int16 nIconIndex ); }; #endif Index: svtools/source/misc/imagemgr.cxx =================================================================== RCS file: /cvs/util/svtools/source/misc/imagemgr.cxx,v --- svtools/source/misc/imagemgr.cxx 29 Nov 2004 12:08:37 -0000 1.34 +++ svtools/source/misc/imagemgr.cxx 22 Dec 2004 18:08:18 -0000 @@ -944,3 +944,45 @@ String SvFileInformationManager::GetFold return sDescription; } +std::list< BitmapEx > SvFileInformationManager::GetIcons( sal_Int16 nIconIndex ) +{ + USHORT nImageId = IMG_FILE; + switch( nIconIndex ) + { +#define MAP(a,b) \ + case a: nImageId = b; break + + MAP( ICON_DEFAULT, IMG_FILE ); // ?? + MAP( ICON_SO_DEFAULT, IMG_FILE ); // ?? + MAP( ICON_TEXT_DOCUMENT, IMG_WRITER ); + MAP( ICON_TEXT_TEMPLATE, IMG_WRITERTEMPLATE ); + MAP( ICON_SPREADSHEET_DOCUMENT, IMG_CALC ); + MAP( ICON_SPREADSHEET_TEMPLATE, IMG_CALCTEMPLATE ); + MAP( ICON_DRAWING_DOCUMENT, IMG_DRAW ); + MAP( ICON_DRAWING_TEMPLATE, IMG_DRAWTEMPLATE ); + MAP( ICON_PRESENTATION_DOCUMENT, IMG_IMPRESS ); + MAP( ICON_PRESENTATION_TEMPLATE, IMG_IMPRESSTEMPLATE ); + MAP( ICON_PRESENTATION_COMPRESSED, IMG_IMPRESSPACKED ); + MAP( ICON_GLOBAL_DOCUMENT, IMG_GLOBAL_DOC ); + MAP( ICON_HTML_DOCUMENT, IMG_HTML ); + MAP( ICON_CHART_DOCUMENT, IMG_CHART ); + MAP( ICON_DATABASE_DOCUMENT, IMG_DATABASE ); + MAP( ICON_MATH_DOCUMENT, IMG_MATH ); + MAP( ICON_TEMPLATE, IMG_NEWFROMTEMPLATE ); + MAP( ICON_MACROLIBRARY, IMG_MACROLIB ); + MAP( ICON_PLAYER, IMG_DXF ); // !! + MAP( ICON_SETUP, IMG_TASK ); // !! + } + + std::list< BitmapEx > aList; + + BOOL bHighContrast = FALSE; // should be done at the theme level + + Image aSmall = GetImageFromList_Impl( nImageId, FALSE, bHighContrast ); + aList.push_back( aSmall.GetBitmapEx() ); + + Image aLarge = GetImageFromList_Impl( nImageId, TRUE, bHighContrast ); + aList.push_back( aLarge.GetBitmapEx() ); + + return aList; +} Index: sfx2/source/view/topfrm.cxx =================================================================== RCS file: /cvs/framework/sfx2/source/view/topfrm.cxx,v --- sfx2/source/view/topfrm.cxx 26 Nov 2004 14:38:48 -0000 1.68 +++ sfx2/source/view/topfrm.cxx 19 Jan 2005 21:54:36 -0000 @@ -111,6 +111,9 @@ #ifndef _SFXRECTITEM_HXX //autogen #include #endif +#ifndef _SVTOOLS_IMAGEMGR_HXX +#include +#endif #ifndef _SFXINTITEM_HXX //autogen #include #endif @@ -573,7 +576,12 @@ SfxTopFrame* SfxTopFrame::Create( SfxObj if( SvtModuleOptions::ClassifyFactoryByName( aDocServiceName, eFactory ) ) { WorkWindow* pWorkWindow = (WorkWindow*)pWindow; +//#ifdef UNX + pWorkWindow->SetIcon( SvFileInformationManager::GetIcons( + (sal_Int16) SvtModuleOptions().GetFactoryIcon( eFactory ) ) ); +//#else pWorkWindow->SetIcon( (sal_uInt16) SvtModuleOptions().GetFactoryIcon( eFactory ) ); +//#endif } } } Index: framework/source/services/frame.cxx =================================================================== RCS file: /cvs/framework/framework/source/services/frame.cxx,v --- framework/source/services/frame.cxx 26 Nov 2004 14:33:19 -0000 1.79 +++ framework/source/services/frame.cxx 19 Jan 2005 21:55:04 -0000 @@ -263,6 +263,10 @@ #include #endif +#ifndef _SVTOOLS_IMAGEMGR_HXX +#include +#endif + #ifdef ENABLE_ASSERTIONS #ifndef _RTL_STRBUF_HXX_ #include @@ -3111,8 +3115,12 @@ void Frame::implts_setIconOnWindow() ) { WorkWindow* pWorkWindow = (WorkWindow*)pWindow; +//#ifdef UNX + pWorkWindow->SetIcon( SvFileInformationManager::GetIcons( (sal_Int16) nIcon ) ); +//#else pWorkWindow->SetIcon( (sal_uInt16)nIcon ); +//#endif } aSolarGuard.clear(); /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ } Index: vcl/inc/syswin.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/syswin.hxx,v --- vcl/inc/syswin.hxx 9 Sep 2004 16:17:35 -0000 1.14 +++ vcl/inc/syswin.hxx 19 Jan 2005 21:56:01 -0000 @@ -69,6 +69,9 @@ #include #endif +#include +#include + class ModalDialog; class MenuBar; class TaskPaneList; @@ -242,8 +245,9 @@ public: virtual void Roll(); virtual void Resizing( Size& rSize ); - void SetIcon( USHORT nIcon ); - USHORT GetIcon() const { return mnIcon; } + void SetIcon( USHORT nIcon ); // Deprecated + USHORT GetIcon() const { return mnIcon; } // Is this ever used !? + void SetIcon( std::list< BitmapEx > aIcons ); void SetZLevel( BYTE nLevel ); BYTE GetZLevel() const; Index: vcl/inc/salframe.hxx =================================================================== RCS file: /cvs/gsl/vcl/inc/salframe.hxx,v --- vcl/inc/salframe.hxx 13 Oct 2004 08:48:47 -0000 1.22 +++ vcl/inc/salframe.hxx 19 Jan 2005 21:56:02 -0000 @@ -209,6 +209,7 @@ public: virtual void SetTitle( const XubString& rTitle ) = 0; virtual void SetIcon( USHORT nIcon ) = 0; + virtual void SetIcon( std::list< SalBitmap * > &rIcons ) = 0; virtual void SetMenu( SalMenu *pSalMenu ) = 0; virtual void DrawMenuBar() = 0; Index: vcl/source/window/syswin.cxx =================================================================== RCS file: /cvs/gsl/vcl/source/window/syswin.cxx,v --- vcl/source/window/syswin.cxx 3 Dec 2004 14:16:36 -0000 1.39 +++ vcl/source/window/syswin.cxx 19 Jan 2005 21:56:03 -0000 @@ -103,8 +103,14 @@ #ifndef _SV_TASKPANELIST_HXX #include #endif +#ifndef _SV_BITMAP_HXX +#include +#endif +#ifndef _SV_IMPBMP_HXX +#include +#endif #include using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; @@ -348,6 +353,42 @@ void SystemWindow::SetIcon( USHORT nIcon if ( pWindow->mpWindowImpl->mbFrame ) pWindow->mpWindowImpl->mpFrame->SetIcon( nIcon ); + } +} + +// ----------------------------------------------------------------------- + +void SystemWindow::SetIcon( std::list< BitmapEx > aIcons ) +{ + std::list< BitmapEx >::iterator it; + std::list< Bitmap > aAllocatedBitmaps; + std::list< SalBitmap * > aSalIcons; + + for( it = aIcons.begin(); it != aIcons.end(); it++) + { + Bitmap aBitmap( it->GetBitmap() ); + Bitmap aAlpha( it->GetAlpha().GetBitmap() ); + if( !aAlpha ) + { + fprintf( stderr, "skipping non-alpha Window icon" ); + continue; + } + aBitmap.Convert( BMP_CONVERSION_24BIT ); + aAllocatedBitmaps.push_back( aBitmap ); + aAllocatedBitmaps.push_back( aAlpha ); + aSalIcons.push_back( aBitmap.ImplGetImpBitmap()->ImplGetSalBitmap() ); + aSalIcons.push_back( aAlpha.ImplGetImpBitmap()->ImplGetSalBitmap() ); + } + + if ( !mbSysChild ) + { + const Window* pWindow = this; + while ( pWindow->mpWindowImpl->mpBorderWindow ) + pWindow = pWindow->mpWindowImpl->mpBorderWindow; + + if ( pWindow->mpWindowImpl->mbFrame ) + pWindow->mpWindowImpl->mpFrame->SetIcon( aSalIcons ); + } } Index: vcl/unx/inc/salframe.h =================================================================== RCS file: /cvs/gsl/vcl/unx/inc/salframe.h,v --- vcl/unx/inc/salframe.h 13 Oct 2004 08:58:19 -0000 1.42 +++ vcl/unx/inc/salframe.h 19 Jan 2005 21:56:03 -0000 @@ -240,6 +240,7 @@ public: virtual void SetTitle( const XubString& rTitle ); virtual void SetIcon( USHORT nIcon ); + virtual void SetIcon( std::list< SalBitmap * > &rIcons ); virtual void SetMenu( SalMenu* pMenu ); virtual void DrawMenuBar(); Index: vcl/unx/gtk/window/gtkframe.cxx =================================================================== RCS file: /cvs/gsl/vcl/unx/gtk/window/gtkframe.cxx,v --- vcl/unx/gtk/window/gtkframe.cxx 16 Nov 2004 15:19:08 -0000 1.17 +++ vcl/unx/gtk/window/gtkframe.cxx 19 Jan 2005 21:56:04 -0000 @@ -74,6 +74,9 @@ #include #include +#include + +#include #if OSL_DEBUG_LEVEL > 1 #include @@ -519,6 +522,7 @@ void GtkSalFrame::SetIcon( USHORT nIcon ) { +#if 0 if( m_nStyle & SAL_FRAME_STYLE_CHILD || ! m_pWindow ) return; @@ -549,6 +553,81 @@ g_list_foreach( pPixbufs, (GFunc) g_object_unref, NULL ); g_list_free( pPixbufs ); +#endif +} + +static inline BYTE * +getRow( BitmapBuffer *pBuffer, ULONG nRow ) +{ + if( BMP_SCANLINE_ADJUSTMENT( pBuffer->mnFormat ) == BMP_FORMAT_TOP_DOWN ) + return pBuffer->mpBits + nRow * pBuffer->mnScanlineSize; + else + return pBuffer->mpBits + ( pBuffer->mnHeight - nRow - 1 ) * pBuffer->mnScanlineSize; +} + +static GdkPixbuf * +bitmapToPixbuf( SalBitmap *pSalBitmap, SalBitmap *pSalAlpha ) +{ + g_return_val_if_fail( pSalBitmap != NULL, NULL ); + g_return_val_if_fail( pSalAlpha != NULL, NULL ); + + BitmapBuffer *pBitmap = pSalBitmap->AcquireBuffer( TRUE ); + g_return_val_if_fail( pBitmap != NULL, NULL ); + g_return_val_if_fail( pBitmap->mnBitCount == 24, NULL ); + + BitmapBuffer *pAlpha = pSalAlpha->AcquireBuffer( TRUE ); + g_return_val_if_fail( pAlpha != NULL, NULL ); + g_return_val_if_fail( pAlpha->mnBitCount == 8, NULL ); + + Size aSize = pSalBitmap->GetSize(); + g_return_val_if_fail( pSalAlpha->GetSize() == aSize, NULL ); + + ULONG nX, nY; + guchar *pPixbufData = (guchar *)g_malloc (4 * aSize.Width() * aSize.Height() ); + guchar *pDestData = pPixbufData; + + for( nY = 0; nY < pBitmap->mnHeight; nY++ ) + { + BYTE *pData = getRow( pBitmap, nY ); + BYTE *pAlphaData = getRow( pAlpha, nY ); + + for( nX = 0; nX < pBitmap->mnWidth; nX++ ) + { + *pDestData++ = *pData++; + *pDestData++ = *pData++; + *pDestData++ = *pData++; + *pDestData++ = 255 - *pAlphaData++; + } + } + + pSalBitmap->ReleaseBuffer( pBitmap, TRUE ); + pSalAlpha->ReleaseBuffer( pAlpha, TRUE ); + + return gdk_pixbuf_new_from_data( pPixbufData, + GDK_COLORSPACE_RGB, TRUE, 8, + aSize.Width(), aSize.Height(), + aSize.Width() * 4, + (GdkPixbufDestroyNotify) g_free, + NULL ); +} + +void GtkSalFrame::SetIcon( std::list< SalBitmap * > &rIcons ) +{ + std::list< SalBitmap * >::iterator it; + GdkPixbuf *pBuf; + GList *pIcons = NULL; + + for( it = rIcons.begin(); it != rIcons.end(); it++) + { + SalBitmap *pBitmap = *it; + it++; + SalBitmap *pAlpha = *it; + + if( ( pBuf = bitmapToPixbuf( pBitmap, pAlpha ) ) ) + pIcons = g_list_prepend( pIcons, pBuf ); + } + + gtk_window_set_icon_list( m_pWindow, pIcons ); } void GtkSalFrame::SetMenu( SalMenu* pSalMenu ) Index: vcl/unx/inc/plugins/gtk/gtkframe.hxx =================================================================== RCS file: /cvs/gsl/vcl/unx/inc/plugins/gtk/gtkframe.hxx,v --- vcl/unx/inc/plugins/gtk/gtkframe.hxx 22 Nov 2004 10:13:44 -0000 1.10 +++ vcl/unx/inc/plugins/gtk/gtkframe.hxx 19 Jan 2005 21:56:04 -0000 @@ -212,6 +212,7 @@ class GtkSalFrame : public SalFrame void SetDefaultSize(); void setAutoLock( bool bLock ); void setScreenSaverTimeout( int nTimeout ); + void hardIMReset(); GdkNativeWindow findTopLevelSystemWindow( GdkNativeWindow aWindow ); @@ -261,6 +262,7 @@ public: virtual void SetTitle( const XubString& rTitle ); virtual void SetIcon( USHORT nIcon ); + virtual void SetIcon( std::list< SalBitmap * > &rIcons ); virtual void SetMenu( SalMenu *pSalMenu ); virtual void DrawMenuBar(); Index: vcl/unx/source/window/salframe.cxx =================================================================== RCS file: /cvs/gsl/vcl/unx/source/window/salframe.cxx,v --- vcl/unx/source/window/salframe.cxx 26 Nov 2004 16:15:10 -0000 1.185 +++ vcl/unx/source/window/salframe.cxx 24 Jan 2005 11:49:15 -0000 @@ -878,6 +878,11 @@ void X11SalFrame::Enable( BOOL bEnable ) // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +void X11SalFrame::SetIcon( std::list< SalBitmap * > &rIcons ) +{ + // Dummy +} + void X11SalFrame::SetIcon( USHORT nIcon ) { if ( !( nStyle_ & (SAL_FRAME_STYLE_CHILD|SAL_FRAME_STYLE_FLOAT) ) )