1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/svapp.hxx> 28cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 29cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 30cdf0e10cSrcweir #include <avmedia/mediaplayer.hxx> 31cdf0e10cSrcweir #include "helpid.hrc" 32cdf0e10cSrcweir #include "galbrws2.hxx" 33cdf0e10cSrcweir #include "svx/galtheme.hxx" 34cdf0e10cSrcweir #include "svx/galmisc.hxx" 35cdf0e10cSrcweir #include "svx/galctrl.hxx" 36cdf0e10cSrcweir #include "editeng/AccessibleStringWrap.hxx" 37cdf0e10cSrcweir #include <editeng/svxfont.hxx> 38cdf0e10cSrcweir #include "galobj.hxx" 39cdf0e10cSrcweir #include <avmedia/mediawindow.hxx> 40cdf0e10cSrcweir #include "gallery.hrc" 41cdf0e10cSrcweir #include <svtools/filter.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir // ----------- 44cdf0e10cSrcweir // - Defines - 45cdf0e10cSrcweir // ----------- 46cdf0e10cSrcweir 47cdf0e10cSrcweir #define GALLERY_BRWBOX_TITLE 1 48cdf0e10cSrcweir #define GALLERY_BRWBOX_PATH 2 49cdf0e10cSrcweir 50cdf0e10cSrcweir // ------------------ 51cdf0e10cSrcweir // - GalleryPreview - 52cdf0e10cSrcweir // ------------------ 53cdf0e10cSrcweir DBG_NAME(GalleryPreview) 54cdf0e10cSrcweir 55cdf0e10cSrcweir GalleryPreview::GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme ) : 56cdf0e10cSrcweir Window( pParent, WB_TABSTOP | WB_BORDER ), 57cdf0e10cSrcweir DropTargetHelper( this ), 58cdf0e10cSrcweir DragSourceHelper( this ), 59cdf0e10cSrcweir mpTheme( pTheme ) 60cdf0e10cSrcweir { 61cdf0e10cSrcweir DBG_CTOR(GalleryPreview,NULL); 62cdf0e10cSrcweir 63cdf0e10cSrcweir SetHelpId( HID_GALLERY_WINDOW ); 64cdf0e10cSrcweir InitSettings(); 65cdf0e10cSrcweir } 66cdf0e10cSrcweir 67cdf0e10cSrcweir // ------------------------------------------------------------------------ 68cdf0e10cSrcweir 69cdf0e10cSrcweir GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId ) : 70cdf0e10cSrcweir Window( pParent, rResId ), 71cdf0e10cSrcweir DropTargetHelper( this ), 72cdf0e10cSrcweir DragSourceHelper( this ), 73cdf0e10cSrcweir mpTheme( NULL ) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir DBG_CTOR(GalleryPreview,NULL); 76cdf0e10cSrcweir 77cdf0e10cSrcweir SetHelpId( HID_GALLERY_PREVIEW ); 78cdf0e10cSrcweir InitSettings(); 79cdf0e10cSrcweir } 80cdf0e10cSrcweir 81cdf0e10cSrcweir // ------------------------------------------------------------------------ 82cdf0e10cSrcweir 83cdf0e10cSrcweir GalleryPreview::~GalleryPreview() 84cdf0e10cSrcweir { 85cdf0e10cSrcweir 86cdf0e10cSrcweir DBG_DTOR(GalleryPreview,NULL); 87cdf0e10cSrcweir } 88cdf0e10cSrcweir 89cdf0e10cSrcweir 90cdf0e10cSrcweir bool GalleryPreview::SetGraphic( const INetURLObject& _aURL ) 91cdf0e10cSrcweir { 92cdf0e10cSrcweir bool bRet = true; 93cdf0e10cSrcweir Graphic aGraphic; 94cdf0e10cSrcweir if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir aGraphic = BitmapEx( GAL_RESID( RID_SVXBMP_GALLERY_MEDIA ) ); 97cdf0e10cSrcweir } 98cdf0e10cSrcweir else 99cdf0e10cSrcweir { 100cdf0e10cSrcweir GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter(); 101cdf0e10cSrcweir GalleryProgress aProgress( pFilter ); 102cdf0e10cSrcweir if( pFilter->ImportGraphic( aGraphic, _aURL, GRFILTER_FORMAT_DONTKNOW ) ) 103cdf0e10cSrcweir bRet = false; 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir SetGraphic( aGraphic ); 107cdf0e10cSrcweir Invalidate(); 108cdf0e10cSrcweir return bRet; 109cdf0e10cSrcweir } 110cdf0e10cSrcweir 111cdf0e10cSrcweir // ------------------------------------------------------------------------ 112cdf0e10cSrcweir 113cdf0e10cSrcweir void GalleryPreview::InitSettings() 114cdf0e10cSrcweir { 115cdf0e10cSrcweir SetBackground( Wallpaper( GALLERY_BG_COLOR ) ); 116cdf0e10cSrcweir SetControlBackground( GALLERY_BG_COLOR ); 117cdf0e10cSrcweir SetControlForeground( GALLERY_FG_COLOR ); 118cdf0e10cSrcweir } 119cdf0e10cSrcweir 120cdf0e10cSrcweir // ----------------------------------------------------------------------- 121cdf0e10cSrcweir 122cdf0e10cSrcweir void GalleryPreview::DataChanged( const DataChangedEvent& rDCEvt ) 123cdf0e10cSrcweir { 124cdf0e10cSrcweir if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) 125cdf0e10cSrcweir InitSettings(); 126cdf0e10cSrcweir else 127cdf0e10cSrcweir Window::DataChanged( rDCEvt ); 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir // ------------------------------------------------------------------------ 131cdf0e10cSrcweir 132cdf0e10cSrcweir sal_Bool GalleryPreview::ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const 133cdf0e10cSrcweir { 134cdf0e10cSrcweir const Size aWinSize( GetOutputSizePixel() ); 135cdf0e10cSrcweir Size aNewSize( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) ); 136cdf0e10cSrcweir sal_Bool bRet = sal_False; 137cdf0e10cSrcweir 138cdf0e10cSrcweir if( aNewSize.Width() && aNewSize.Height() ) 139cdf0e10cSrcweir { 140cdf0e10cSrcweir // scale to fit window 141cdf0e10cSrcweir const double fGrfWH = (double) aNewSize.Width() / aNewSize.Height(); 142cdf0e10cSrcweir const double fWinWH = (double) aWinSize.Width() / aWinSize.Height(); 143cdf0e10cSrcweir 144cdf0e10cSrcweir if ( fGrfWH < fWinWH ) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir aNewSize.Width() = (long) ( aWinSize.Height() * fGrfWH ); 147cdf0e10cSrcweir aNewSize.Height()= aWinSize.Height(); 148cdf0e10cSrcweir } 149cdf0e10cSrcweir else 150cdf0e10cSrcweir { 151cdf0e10cSrcweir aNewSize.Width() = aWinSize.Width(); 152cdf0e10cSrcweir aNewSize.Height()= (long) ( aWinSize.Width() / fGrfWH); 153cdf0e10cSrcweir } 154cdf0e10cSrcweir 155cdf0e10cSrcweir const Point aNewPos( ( aWinSize.Width() - aNewSize.Width() ) >> 1, 156cdf0e10cSrcweir ( aWinSize.Height() - aNewSize.Height() ) >> 1 ); 157cdf0e10cSrcweir 158cdf0e10cSrcweir rResultRect = Rectangle( aNewPos, aNewSize ); 159cdf0e10cSrcweir bRet = sal_True; 160cdf0e10cSrcweir } 161cdf0e10cSrcweir 162cdf0e10cSrcweir return bRet; 163cdf0e10cSrcweir } 164cdf0e10cSrcweir 165cdf0e10cSrcweir // ------------------------------------------------------------------------ 166cdf0e10cSrcweir 167cdf0e10cSrcweir void GalleryPreview::Paint( const Rectangle& rRect ) 168cdf0e10cSrcweir { 169cdf0e10cSrcweir Window::Paint( rRect ); 170cdf0e10cSrcweir 171cdf0e10cSrcweir if( ImplGetGraphicCenterRect( aGraphicObj.GetGraphic(), aPreviewRect ) ) 172cdf0e10cSrcweir { 173cdf0e10cSrcweir const Point aPos( aPreviewRect.TopLeft() ); 174cdf0e10cSrcweir const Size aSize( aPreviewRect.GetSize() ); 175cdf0e10cSrcweir 176cdf0e10cSrcweir if( aGraphicObj.IsAnimated() ) 177cdf0e10cSrcweir aGraphicObj.StartAnimation( this, aPos, aSize ); 178cdf0e10cSrcweir else 179cdf0e10cSrcweir aGraphicObj.Draw( this, aPos, aSize ); 180cdf0e10cSrcweir } 181cdf0e10cSrcweir } 182cdf0e10cSrcweir 183cdf0e10cSrcweir // ------------------------------------------------------------------------ 184cdf0e10cSrcweir 185cdf0e10cSrcweir void GalleryPreview::MouseButtonDown( const MouseEvent& rMEvt ) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir if( mpTheme && ( rMEvt.GetClicks() == 2 ) ) 188cdf0e10cSrcweir ( (GalleryBrowser2*) GetParent() )->TogglePreview( this ); 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir // ------------------------------------------------------------------------ 192cdf0e10cSrcweir 193cdf0e10cSrcweir void GalleryPreview::Command(const CommandEvent& rCEvt ) 194cdf0e10cSrcweir { 195cdf0e10cSrcweir Window::Command( rCEvt ); 196cdf0e10cSrcweir 197cdf0e10cSrcweir if( mpTheme && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) ) 198cdf0e10cSrcweir ( (GalleryBrowser2*) GetParent() )->ShowContextMenu( this, 199cdf0e10cSrcweir ( rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : NULL ) ); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir 202cdf0e10cSrcweir // ------------------------------------------------------------------------ 203cdf0e10cSrcweir 204cdf0e10cSrcweir void GalleryPreview::KeyInput( const KeyEvent& rKEvt ) 205cdf0e10cSrcweir { 206cdf0e10cSrcweir if( mpTheme ) 207cdf0e10cSrcweir { 208cdf0e10cSrcweir GalleryBrowser2* pBrowser = static_cast< GalleryBrowser2* >( GetParent() ); 209cdf0e10cSrcweir 210cdf0e10cSrcweir switch( rKEvt.GetKeyCode().GetCode() ) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir case( KEY_BACKSPACE ): 213cdf0e10cSrcweir pBrowser->TogglePreview( this ); 214cdf0e10cSrcweir break; 215cdf0e10cSrcweir 216cdf0e10cSrcweir case( KEY_HOME ): 217cdf0e10cSrcweir pBrowser->Travel( GALLERYBROWSERTRAVEL_FIRST ); 218cdf0e10cSrcweir break; 219cdf0e10cSrcweir 220cdf0e10cSrcweir case( KEY_END ): 221cdf0e10cSrcweir pBrowser->Travel( GALLERYBROWSERTRAVEL_LAST ); 222cdf0e10cSrcweir break; 223cdf0e10cSrcweir 224cdf0e10cSrcweir case( KEY_LEFT ): 225cdf0e10cSrcweir case( KEY_UP ): 226cdf0e10cSrcweir pBrowser->Travel( GALLERYBROWSERTRAVEL_PREVIOUS ); 227cdf0e10cSrcweir break; 228cdf0e10cSrcweir 229cdf0e10cSrcweir case( KEY_RIGHT ): 230cdf0e10cSrcweir case( KEY_DOWN ): 231cdf0e10cSrcweir pBrowser->Travel( GALLERYBROWSERTRAVEL_NEXT ); 232cdf0e10cSrcweir break; 233cdf0e10cSrcweir 234cdf0e10cSrcweir default: 235cdf0e10cSrcweir { 236cdf0e10cSrcweir if( !pBrowser->KeyInput( rKEvt, this ) ) 237cdf0e10cSrcweir Window::KeyInput( rKEvt ); 238cdf0e10cSrcweir } 239cdf0e10cSrcweir break; 240cdf0e10cSrcweir } 241cdf0e10cSrcweir } 242cdf0e10cSrcweir else 243cdf0e10cSrcweir Window::KeyInput( rKEvt ); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir 246cdf0e10cSrcweir // ------------------------------------------------------------------------ 247cdf0e10cSrcweir 248cdf0e10cSrcweir sal_Int8 GalleryPreview::AcceptDrop( const AcceptDropEvent& rEvt ) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir sal_Int8 nRet; 251cdf0e10cSrcweir 252cdf0e10cSrcweir if( mpTheme ) 253cdf0e10cSrcweir nRet = ( (GalleryBrowser2*) GetParent() )->AcceptDrop( *this, rEvt ); 254cdf0e10cSrcweir else 255cdf0e10cSrcweir nRet = DND_ACTION_NONE; 256cdf0e10cSrcweir 257cdf0e10cSrcweir return nRet; 258cdf0e10cSrcweir } 259cdf0e10cSrcweir 260cdf0e10cSrcweir // ------------------------------------------------------------------------ 261cdf0e10cSrcweir 262cdf0e10cSrcweir sal_Int8 GalleryPreview::ExecuteDrop( const ExecuteDropEvent& rEvt ) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir sal_Int8 nRet; 265cdf0e10cSrcweir 266cdf0e10cSrcweir if( mpTheme ) 267cdf0e10cSrcweir nRet = ( (GalleryBrowser2*) GetParent() )->ExecuteDrop( *this, rEvt ); 268cdf0e10cSrcweir else 269cdf0e10cSrcweir nRet = DND_ACTION_NONE; 270cdf0e10cSrcweir 271cdf0e10cSrcweir return nRet; 272cdf0e10cSrcweir } 273cdf0e10cSrcweir 274cdf0e10cSrcweir // ------------------------------------------------------------------------ 275cdf0e10cSrcweir 276cdf0e10cSrcweir void GalleryPreview::StartDrag( sal_Int8, const Point& ) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir if( mpTheme ) 279cdf0e10cSrcweir ( (GalleryBrowser2*) GetParent() )->StartDrag( this ); 280cdf0e10cSrcweir } 281cdf0e10cSrcweir 282cdf0e10cSrcweir // ------------------------------------------------------------------------ 283cdf0e10cSrcweir 284cdf0e10cSrcweir void GalleryPreview::PreviewMedia( const INetURLObject& rURL ) 285cdf0e10cSrcweir { 286cdf0e10cSrcweir if( rURL.GetProtocol() != INET_PROT_NOT_VALID ) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir ::avmedia::MediaFloater* pFloater = AVMEDIA_MEDIAWINDOW(); 289cdf0e10cSrcweir 290cdf0e10cSrcweir if( !pFloater ) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_AVMEDIA_PLAYER, SFX_CALLMODE_SYNCHRON ); 293cdf0e10cSrcweir pFloater = AVMEDIA_MEDIAWINDOW(); 294cdf0e10cSrcweir } 295cdf0e10cSrcweir 296cdf0e10cSrcweir if( pFloater ) 297cdf0e10cSrcweir pFloater->setURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), true ); 298cdf0e10cSrcweir } 299cdf0e10cSrcweir } 300cdf0e10cSrcweir 301cdf0e10cSrcweir // ------------------------------------------------------------------------ 302cdf0e10cSrcweir 303*35726d9dSArmin Le Grand void drawTransparenceBackground(OutputDevice& rOut, const Point& rPos, const Size& rSize) 304*35726d9dSArmin Le Grand { 305*35726d9dSArmin Le Grand const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); 306*35726d9dSArmin Le Grand 307*35726d9dSArmin Le Grand if(rStyleSettings.GetUIPreviewUsesCheckeredBackground()) 3086dd94783SArmin Le Grand { 3096dd94783SArmin Le Grand // draw checkered background 3106dd94783SArmin Le Grand static const sal_uInt32 nLen(8); 3116dd94783SArmin Le Grand static const Color aW(COL_WHITE); 3126dd94783SArmin Le Grand static const Color aG(0xef, 0xef, 0xef); 3136dd94783SArmin Le Grand 3146dd94783SArmin Le Grand rOut.DrawCheckered(rPos, rSize, nLen, aW, aG); 3156dd94783SArmin Le Grand } 316*35726d9dSArmin Le Grand else 317*35726d9dSArmin Le Grand { 318*35726d9dSArmin Le Grand rOut.SetLineColor(); 319*35726d9dSArmin Le Grand rOut.SetFillColor(rStyleSettings.GetFieldColor()); 320*35726d9dSArmin Le Grand rOut.DrawRect(Rectangle(rPos, rSize)); 321*35726d9dSArmin Le Grand } 322*35726d9dSArmin Le Grand } 3236dd94783SArmin Le Grand 324cdf0e10cSrcweir // ------------------- 325cdf0e10cSrcweir // - GalleryIconView - 326cdf0e10cSrcweir // ------------------- 327cdf0e10cSrcweir DBG_NAME(GalleryIconView) 328cdf0e10cSrcweir 329cdf0e10cSrcweir GalleryIconView::GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme ) : 330cdf0e10cSrcweir ValueSet( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_VSCROLL | WB_FLATVALUESET ), 331cdf0e10cSrcweir DropTargetHelper( this ), 332cdf0e10cSrcweir DragSourceHelper( this ), 333cdf0e10cSrcweir mpTheme ( pTheme ) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir DBG_CTOR(GalleryIconView,NULL); 336cdf0e10cSrcweir EnableFullItemMode( sal_False ); 337cdf0e10cSrcweir 338cdf0e10cSrcweir SetHelpId( HID_GALLERY_WINDOW ); 339cdf0e10cSrcweir InitSettings(); 340cdf0e10cSrcweir SetExtraSpacing( 2 ); 341cdf0e10cSrcweir SetItemWidth( S_THUMB + 6 ); 342cdf0e10cSrcweir SetItemHeight( S_THUMB + 6 ); 343cdf0e10cSrcweir } 344cdf0e10cSrcweir 345cdf0e10cSrcweir // ------------------------------------------------------------------------ 346cdf0e10cSrcweir 347cdf0e10cSrcweir GalleryIconView::~GalleryIconView() 348cdf0e10cSrcweir { 349cdf0e10cSrcweir 350cdf0e10cSrcweir DBG_DTOR(GalleryIconView,NULL); 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir // ------------------------------------------------------------------------ 354cdf0e10cSrcweir 355cdf0e10cSrcweir void GalleryIconView::InitSettings() 356cdf0e10cSrcweir { 357cdf0e10cSrcweir SetBackground( Wallpaper( GALLERY_BG_COLOR ) ); 358cdf0e10cSrcweir SetControlBackground( GALLERY_BG_COLOR ); 359cdf0e10cSrcweir SetControlForeground( GALLERY_FG_COLOR ); 360cdf0e10cSrcweir SetColor( GALLERY_BG_COLOR ); 361cdf0e10cSrcweir } 362cdf0e10cSrcweir 363cdf0e10cSrcweir // ----------------------------------------------------------------------- 364cdf0e10cSrcweir 365cdf0e10cSrcweir void GalleryIconView::DataChanged( const DataChangedEvent& rDCEvt ) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) 368cdf0e10cSrcweir InitSettings(); 369cdf0e10cSrcweir else 370cdf0e10cSrcweir ValueSet::DataChanged( rDCEvt ); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir // ------------------------------------------------------------------------ 374cdf0e10cSrcweir 375cdf0e10cSrcweir void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt ) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir const sal_uInt16 nId = rUDEvt.GetItemId(); 378cdf0e10cSrcweir 379cdf0e10cSrcweir if( nId && mpTheme ) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir SgaObject* pObj = mpTheme->AcquireObject( nId - 1 ); 382cdf0e10cSrcweir 383cdf0e10cSrcweir if( pObj ) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir const Rectangle& rRect = rUDEvt.GetRect(); 386cdf0e10cSrcweir OutputDevice* pDev = rUDEvt.GetDevice(); 387cdf0e10cSrcweir Graphic aGraphic; 3886dd94783SArmin Le Grand bool bTransparent(false); 389cdf0e10cSrcweir 390cdf0e10cSrcweir if( pObj->IsThumbBitmap() ) 391cdf0e10cSrcweir { 3926dd94783SArmin Le Grand BitmapEx aBitmapEx; 393cdf0e10cSrcweir 394cdf0e10cSrcweir if( pObj->GetObjKind() == SGA_OBJ_SOUND ) 3956dd94783SArmin Le Grand { 3966dd94783SArmin Le Grand Bitmap aTemp = pObj->GetThumbBmp().GetBitmap(); 397cdf0e10cSrcweir 3986dd94783SArmin Le Grand aTemp.Replace( COL_LIGHTMAGENTA, COL_WHITE ); 3996dd94783SArmin Le Grand aBitmapEx = BitmapEx(aTemp); 400cdf0e10cSrcweir } 401cdf0e10cSrcweir else 4026dd94783SArmin Le Grand { 4036dd94783SArmin Le Grand aBitmapEx = pObj->GetThumbBmp(); 4046dd94783SArmin Le Grand bTransparent = aBitmapEx.IsTransparent(); 4056dd94783SArmin Le Grand } 4066dd94783SArmin Le Grand 4076dd94783SArmin Le Grand if( ( pDev->GetBitCount() <= 8 ) && ( aBitmapEx.GetBitCount() >= 8 ) ) 4086dd94783SArmin Le Grand { 4096dd94783SArmin Le Grand aBitmapEx.Dither( BMP_DITHER_FLOYD ); 4106dd94783SArmin Le Grand } 4116dd94783SArmin Le Grand 4126dd94783SArmin Le Grand aGraphic = aBitmapEx; 4136dd94783SArmin Le Grand } 4146dd94783SArmin Le Grand else 4156dd94783SArmin Le Grand { 416cdf0e10cSrcweir aGraphic = pObj->GetThumbMtf(); 4176dd94783SArmin Le Grand bTransparent = true; 4186dd94783SArmin Le Grand } 419cdf0e10cSrcweir 420cdf0e10cSrcweir Size aSize( aGraphic.GetSizePixel( pDev ) ); 421cdf0e10cSrcweir 422cdf0e10cSrcweir if ( aSize.Width() && aSize.Height() ) 423cdf0e10cSrcweir { 424cdf0e10cSrcweir if( ( aSize.Width() > rRect.GetWidth() ) || ( aSize.Height() > rRect.GetHeight() ) ) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir Point aNewPos; 427cdf0e10cSrcweir const double fBmpWH = (double) aSize.Width() / aSize.Height(); 428cdf0e10cSrcweir const double fThmpWH = (double) rRect.GetWidth() / rRect.GetHeight(); 429cdf0e10cSrcweir 430cdf0e10cSrcweir // Bitmap an Thumbgroesse anpassen 431cdf0e10cSrcweir if ( fBmpWH < fThmpWH ) 432cdf0e10cSrcweir { 433cdf0e10cSrcweir aSize.Width() = (long) ( rRect.GetHeight() * fBmpWH ); 434cdf0e10cSrcweir aSize.Height()= rRect.GetHeight(); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir else 437cdf0e10cSrcweir { 438cdf0e10cSrcweir aSize.Width() = rRect.GetWidth(); 439cdf0e10cSrcweir aSize.Height()= (long) ( rRect.GetWidth() / fBmpWH ); 440cdf0e10cSrcweir } 441cdf0e10cSrcweir } 442cdf0e10cSrcweir 443cdf0e10cSrcweir const Point aPos( ( ( rRect.GetWidth() - aSize.Width() ) >> 1 ) + rRect.Left(), 444cdf0e10cSrcweir ( ( rRect.GetHeight() - aSize.Height() ) >> 1 ) + rRect.Top() ); 445cdf0e10cSrcweir 4466dd94783SArmin Le Grand if(bTransparent) 4476dd94783SArmin Le Grand { 4486dd94783SArmin Le Grand // draw checkered background 449*35726d9dSArmin Le Grand drawTransparenceBackground(*pDev, aPos, aSize); 4506dd94783SArmin Le Grand } 4516dd94783SArmin Le Grand 452cdf0e10cSrcweir aGraphic.Draw( pDev, aPos, aSize ); 453cdf0e10cSrcweir } 454cdf0e10cSrcweir 455cdf0e10cSrcweir SetItemText( nId, GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE) ); 456cdf0e10cSrcweir mpTheme->ReleaseObject( pObj ); 457cdf0e10cSrcweir } 458cdf0e10cSrcweir } 459cdf0e10cSrcweir } 460cdf0e10cSrcweir 461cdf0e10cSrcweir // ------------------------------------------------------------------------ 462cdf0e10cSrcweir 463cdf0e10cSrcweir void GalleryIconView::MouseButtonDown( const MouseEvent& rMEvt ) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir ValueSet::MouseButtonDown( rMEvt ); 466cdf0e10cSrcweir 467cdf0e10cSrcweir if( rMEvt.GetClicks() == 2 ) 468cdf0e10cSrcweir ( (GalleryBrowser2*) GetParent() )->TogglePreview( this, &rMEvt.GetPosPixel() ); 469cdf0e10cSrcweir } 470cdf0e10cSrcweir 471cdf0e10cSrcweir // ------------------------------------------------------------------------ 472cdf0e10cSrcweir 473cdf0e10cSrcweir void GalleryIconView::Command( const CommandEvent& rCEvt ) 474cdf0e10cSrcweir { 475cdf0e10cSrcweir ValueSet::Command( rCEvt ); 476cdf0e10cSrcweir 477cdf0e10cSrcweir if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) 478cdf0e10cSrcweir { 479cdf0e10cSrcweir ( (GalleryBrowser2*) GetParent() )->ShowContextMenu( this, 480cdf0e10cSrcweir ( rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : NULL ) ); 481cdf0e10cSrcweir } 482cdf0e10cSrcweir } 483cdf0e10cSrcweir 484cdf0e10cSrcweir // ------------------------------------------------------------------------ 485cdf0e10cSrcweir 486cdf0e10cSrcweir void GalleryIconView::KeyInput( const KeyEvent& rKEvt ) 487cdf0e10cSrcweir { 488cdf0e10cSrcweir if( !mpTheme || !static_cast< GalleryBrowser2* >( GetParent() )->KeyInput( rKEvt, this ) ) 489cdf0e10cSrcweir ValueSet::KeyInput( rKEvt ); 490cdf0e10cSrcweir } 491cdf0e10cSrcweir 492cdf0e10cSrcweir // ------------------------------------------------------------------------ 493cdf0e10cSrcweir 494cdf0e10cSrcweir sal_Int8 GalleryIconView::AcceptDrop( const AcceptDropEvent& rEvt ) 495cdf0e10cSrcweir { 496cdf0e10cSrcweir return( static_cast< GalleryBrowser2* >( GetParent() )->AcceptDrop( *this, rEvt ) ); 497cdf0e10cSrcweir } 498cdf0e10cSrcweir 499cdf0e10cSrcweir // ------------------------------------------------------------------------ 500cdf0e10cSrcweir 501cdf0e10cSrcweir sal_Int8 GalleryIconView::ExecuteDrop( const ExecuteDropEvent& rEvt ) 502cdf0e10cSrcweir { 503cdf0e10cSrcweir return( static_cast< GalleryBrowser2* >( GetParent() )->ExecuteDrop( *this, rEvt ) ); 504cdf0e10cSrcweir } 505cdf0e10cSrcweir 506cdf0e10cSrcweir // ------------------------------------------------------------------------ 507cdf0e10cSrcweir 508cdf0e10cSrcweir void GalleryIconView::StartDrag( sal_Int8, const Point& ) 509cdf0e10cSrcweir { 510cdf0e10cSrcweir const CommandEvent aEvt( GetPointerPosPixel(), COMMAND_STARTDRAG, sal_True ); 511cdf0e10cSrcweir Region aRegion; 512cdf0e10cSrcweir 513cdf0e10cSrcweir // call this to initiate dragging for ValueSet 514cdf0e10cSrcweir ValueSet::StartDrag( aEvt, aRegion ); 515cdf0e10cSrcweir static_cast< GalleryBrowser2* >( GetParent() )->StartDrag( this ); 516cdf0e10cSrcweir } 517cdf0e10cSrcweir 518cdf0e10cSrcweir // ------------------- 519cdf0e10cSrcweir // - GalleryListView - 520cdf0e10cSrcweir // ------------------- 521cdf0e10cSrcweir DBG_NAME(GalleryListView) 522cdf0e10cSrcweir 523cdf0e10cSrcweir GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme ) : 524cdf0e10cSrcweir BrowseBox( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER ), 525cdf0e10cSrcweir mpTheme( pTheme ), 526cdf0e10cSrcweir mnCurRow( 0 ), 527cdf0e10cSrcweir mbInit( sal_False ) 528cdf0e10cSrcweir { 529cdf0e10cSrcweir DBG_CTOR(GalleryListView,NULL); 530cdf0e10cSrcweir 531cdf0e10cSrcweir SetHelpId( HID_GALLERY_WINDOW ); 532cdf0e10cSrcweir 533cdf0e10cSrcweir InitSettings(); 534cdf0e10cSrcweir 535cdf0e10cSrcweir SetMode( BROWSER_AUTO_VSCROLL | BROWSER_AUTOSIZE_LASTCOL ); 536cdf0e10cSrcweir SetDataRowHeight( 28 ); 537cdf0e10cSrcweir InsertDataColumn( GALLERY_BRWBOX_TITLE, String( GAL_RESID( RID_SVXSTR_GALLERY_TITLE ) ), 256 ); 538cdf0e10cSrcweir InsertDataColumn( GALLERY_BRWBOX_PATH, String( GAL_RESID( RID_SVXSTR_GALLERY_PATH ) ), 256 ); 539cdf0e10cSrcweir } 540cdf0e10cSrcweir 541cdf0e10cSrcweir // ------------------------------------------------------------------------ 542cdf0e10cSrcweir 543cdf0e10cSrcweir GalleryListView::~GalleryListView() 544cdf0e10cSrcweir { 545cdf0e10cSrcweir 546cdf0e10cSrcweir DBG_DTOR(GalleryListView,NULL); 547cdf0e10cSrcweir } 548cdf0e10cSrcweir 549cdf0e10cSrcweir // ------------------------------------------------------------------------ 550cdf0e10cSrcweir 551cdf0e10cSrcweir void GalleryListView::InitSettings() 552cdf0e10cSrcweir { 553cdf0e10cSrcweir SetBackground( Wallpaper( GALLERY_BG_COLOR ) ); 554cdf0e10cSrcweir SetControlBackground( GALLERY_BG_COLOR ); 555cdf0e10cSrcweir SetControlForeground( GALLERY_FG_COLOR ); 556cdf0e10cSrcweir } 557cdf0e10cSrcweir 558cdf0e10cSrcweir // ----------------------------------------------------------------------- 559cdf0e10cSrcweir 560cdf0e10cSrcweir void GalleryListView::DataChanged( const DataChangedEvent& rDCEvt ) 561cdf0e10cSrcweir { 562cdf0e10cSrcweir if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) 563cdf0e10cSrcweir InitSettings(); 564cdf0e10cSrcweir else 565cdf0e10cSrcweir BrowseBox::DataChanged( rDCEvt ); 566cdf0e10cSrcweir } 567cdf0e10cSrcweir 568cdf0e10cSrcweir // ------------------------------------------------------------------------ 569cdf0e10cSrcweir 570cdf0e10cSrcweir sal_Bool GalleryListView::SeekRow( long nRow ) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir mnCurRow = nRow; 573cdf0e10cSrcweir return sal_True; 574cdf0e10cSrcweir } 575cdf0e10cSrcweir 576cdf0e10cSrcweir // ----------------------------------------------------------------------------- 577cdf0e10cSrcweir 578cdf0e10cSrcweir String GalleryListView::GetCellText(long _nRow, sal_uInt16 nColumnId) const 579cdf0e10cSrcweir { 580cdf0e10cSrcweir String sRet; 581cdf0e10cSrcweir if( mpTheme && ( _nRow < static_cast< long >( mpTheme->GetObjectCount() ) ) ) 582cdf0e10cSrcweir { 583cdf0e10cSrcweir SgaObject* pObj = mpTheme->AcquireObject( _nRow ); 584cdf0e10cSrcweir 585cdf0e10cSrcweir if( pObj ) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir sRet = GalleryBrowser2::GetItemText( *mpTheme, *pObj, 588cdf0e10cSrcweir ( GALLERY_BRWBOX_TITLE == nColumnId ) ? GALLERY_ITEM_TITLE : GALLERY_ITEM_PATH ); 589cdf0e10cSrcweir 590cdf0e10cSrcweir mpTheme->ReleaseObject( pObj ); 591cdf0e10cSrcweir } 592cdf0e10cSrcweir } 593cdf0e10cSrcweir 594cdf0e10cSrcweir return sRet;; 595cdf0e10cSrcweir } 596cdf0e10cSrcweir 597cdf0e10cSrcweir // ----------------------------------------------------------------------------- 598cdf0e10cSrcweir 599cdf0e10cSrcweir Rectangle GalleryListView::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) 600cdf0e10cSrcweir { 601cdf0e10cSrcweir DBG_ASSERT(_nColumnPos >= 0 && _nColumnPos <= USHRT_MAX, "GalleryListView::GetFieldCharacterBounds: _nColumnId overflow"); 602cdf0e10cSrcweir Rectangle aRect; 603cdf0e10cSrcweir if ( SeekRow(_nRow) ) 604cdf0e10cSrcweir { 605cdf0e10cSrcweir SvxFont aFont( GetFont() ); 606cdf0e10cSrcweir AccessibleStringWrap aStringWrap( *this, aFont, GetCellText(_nRow, sal::static_int_cast<sal_uInt16>( GetColumnId( sal::static_int_cast<sal_uInt16>(_nColumnPos) ) ) ) ); 607cdf0e10cSrcweir 608cdf0e10cSrcweir // get the bounds inside the string 609cdf0e10cSrcweir aStringWrap.GetCharacterBounds(nIndex, aRect); 610cdf0e10cSrcweir 611cdf0e10cSrcweir // offset to 612cdf0e10cSrcweir } 613cdf0e10cSrcweir return aRect; 614cdf0e10cSrcweir } 615cdf0e10cSrcweir 616cdf0e10cSrcweir // ----------------------------------------------------------------------------- 617cdf0e10cSrcweir 618cdf0e10cSrcweir sal_Int32 GalleryListView::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir DBG_ASSERT(_nColumnPos >= 0 && _nColumnPos <= USHRT_MAX, "GalleryListView::GetFieldIndexAtPoint: _nColumnId overflow"); 621cdf0e10cSrcweir sal_Int32 nRet = -1; 622cdf0e10cSrcweir if ( SeekRow(_nRow) ) 623cdf0e10cSrcweir { 624cdf0e10cSrcweir SvxFont aFont( GetFont() ); 625cdf0e10cSrcweir AccessibleStringWrap aStringWrap( *this, aFont, GetCellText(_nRow, sal::static_int_cast<sal_uInt16>(GetColumnId(sal::static_int_cast<sal_uInt16>(_nColumnPos)))) ); 626cdf0e10cSrcweir nRet = aStringWrap.GetIndexAtPoint(_rPoint); 627cdf0e10cSrcweir } 628cdf0e10cSrcweir return nRet; 629cdf0e10cSrcweir } 630cdf0e10cSrcweir 631cdf0e10cSrcweir // ------------------------------------------------------------------------ 632cdf0e10cSrcweir 633cdf0e10cSrcweir void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const 634cdf0e10cSrcweir { 635cdf0e10cSrcweir rDev.Push( PUSH_CLIPREGION ); 636cdf0e10cSrcweir rDev.IntersectClipRegion( rRect ); 637cdf0e10cSrcweir 638cdf0e10cSrcweir if( mpTheme && ( mnCurRow < mpTheme->GetObjectCount() ) ) 639cdf0e10cSrcweir { 640cdf0e10cSrcweir SgaObject* pObj = mpTheme->AcquireObject( mnCurRow ); 641cdf0e10cSrcweir 642cdf0e10cSrcweir if( pObj ) 643cdf0e10cSrcweir { 644cdf0e10cSrcweir const long nTextPosY = rRect.Top() + ( ( rRect.GetHeight() - rDev.GetTextHeight() ) >> 1 ); 645cdf0e10cSrcweir 646cdf0e10cSrcweir if( GALLERY_BRWBOX_TITLE == nColumnId ) 647cdf0e10cSrcweir { 648cdf0e10cSrcweir Rectangle aOutputRect( rRect.TopLeft(), Size( rRect.GetHeight(), rRect.GetHeight() ) ); 649cdf0e10cSrcweir GraphicObject aGrfObj; 6506dd94783SArmin Le Grand bool bTransparent(false); 651cdf0e10cSrcweir 652cdf0e10cSrcweir if( pObj->GetObjKind() == SGA_OBJ_SOUND ) 6536dd94783SArmin Le Grand { 654cdf0e10cSrcweir aGrfObj = Graphic( BitmapEx( GAL_RESID( RID_SVXBMP_GALLERY_MEDIA ) ) ); 6556dd94783SArmin Le Grand } 656cdf0e10cSrcweir else if( pObj->IsThumbBitmap() ) 6576dd94783SArmin Le Grand { 6586dd94783SArmin Le Grand const BitmapEx aBitmapEx(pObj->GetThumbBmp()); 6596dd94783SArmin Le Grand 6606dd94783SArmin Le Grand bTransparent = aBitmapEx.IsTransparent(); 6616dd94783SArmin Le Grand aGrfObj = Graphic(aBitmapEx); 6626dd94783SArmin Le Grand } 663cdf0e10cSrcweir else 6646dd94783SArmin Le Grand { 665cdf0e10cSrcweir aGrfObj = Graphic( pObj->GetThumbMtf() ); 6666dd94783SArmin Le Grand bTransparent = true; 6676dd94783SArmin Le Grand } 668cdf0e10cSrcweir 669cdf0e10cSrcweir Size aSize( rDev.LogicToPixel( aGrfObj.GetPrefSize(), aGrfObj.GetPrefMapMode() ) ); 670cdf0e10cSrcweir 671cdf0e10cSrcweir if( aSize.Width() && aSize.Height() ) 672cdf0e10cSrcweir { 673cdf0e10cSrcweir if( ( aSize.Width() > aOutputRect.GetWidth() ) || ( aSize.Height() > aOutputRect.GetHeight() ) ) 674cdf0e10cSrcweir { 675cdf0e10cSrcweir Point aNewPos; 676cdf0e10cSrcweir const double fBmpWH = (double) aSize.Width() / aSize.Height(); 677cdf0e10cSrcweir const double fThmpWH = (double) aOutputRect.GetWidth() / aOutputRect.GetHeight(); 678cdf0e10cSrcweir 679cdf0e10cSrcweir // Bitmap an Thumbgroesse anpassen 680cdf0e10cSrcweir if ( fBmpWH < fThmpWH ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir aSize.Width() = (long) ( aOutputRect.GetHeight() * fBmpWH ); 683cdf0e10cSrcweir aSize.Height()= aOutputRect.GetHeight(); 684cdf0e10cSrcweir } 685cdf0e10cSrcweir else 686cdf0e10cSrcweir { 687cdf0e10cSrcweir aSize.Width() = aOutputRect.GetWidth(); 688cdf0e10cSrcweir aSize.Height()= (long) ( aOutputRect.GetWidth() / fBmpWH ); 689cdf0e10cSrcweir } 690cdf0e10cSrcweir } 691cdf0e10cSrcweir 692cdf0e10cSrcweir aSize.Width() = Max( aSize.Width(), 4L ); 693cdf0e10cSrcweir aSize.Height() = Max( aSize.Height(), 4L ); 694cdf0e10cSrcweir 695cdf0e10cSrcweir const Point aPos( ( ( aOutputRect.GetWidth() - aSize.Width() ) >> 1 ) + aOutputRect.Left(), 696cdf0e10cSrcweir ( ( aOutputRect.GetHeight() - aSize.Height() ) >> 1 ) + aOutputRect.Top() ); 697cdf0e10cSrcweir 6986dd94783SArmin Le Grand if(bTransparent) 6996dd94783SArmin Le Grand { 7006dd94783SArmin Le Grand // draw checkered background 701*35726d9dSArmin Le Grand drawTransparenceBackground(rDev, aPos, aSize); 7026dd94783SArmin Le Grand } 7036dd94783SArmin Le Grand 704cdf0e10cSrcweir aGrfObj.Draw( &rDev, aPos, aSize ); 705cdf0e10cSrcweir } 706cdf0e10cSrcweir 707cdf0e10cSrcweir rDev.DrawText( Point( aOutputRect.Right() + 6, nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE ) ); 708cdf0e10cSrcweir } 709cdf0e10cSrcweir else if( GALLERY_BRWBOX_PATH == nColumnId ) 710cdf0e10cSrcweir rDev.DrawText( Point( rRect.Left(), nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_PATH ) ); 711cdf0e10cSrcweir 712cdf0e10cSrcweir mpTheme->ReleaseObject( pObj ); 713cdf0e10cSrcweir } 714cdf0e10cSrcweir } 715cdf0e10cSrcweir 716cdf0e10cSrcweir rDev.Pop(); 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir // ------------------------------------------------------------------------ 720cdf0e10cSrcweir 721cdf0e10cSrcweir void GalleryListView::Command( const CommandEvent& rCEvt ) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir BrowseBox::Command( rCEvt ); 724cdf0e10cSrcweir 725cdf0e10cSrcweir if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir const Point* pPos = NULL; 728cdf0e10cSrcweir 729cdf0e10cSrcweir if( rCEvt.IsMouseEvent() && ( GetRowAtYPosPixel( rCEvt.GetMousePosPixel().Y() ) != BROWSER_ENDOFSELECTION ) ) 730cdf0e10cSrcweir pPos = &rCEvt.GetMousePosPixel(); 731cdf0e10cSrcweir 732cdf0e10cSrcweir ( (GalleryBrowser2*) GetParent() )->ShowContextMenu( this, pPos ); 733cdf0e10cSrcweir } 734cdf0e10cSrcweir } 735cdf0e10cSrcweir 736cdf0e10cSrcweir // ------------------------------------------------------------------------ 737cdf0e10cSrcweir 738cdf0e10cSrcweir void GalleryListView::KeyInput( const KeyEvent& rKEvt ) 739cdf0e10cSrcweir { 740cdf0e10cSrcweir if( !mpTheme || !static_cast< GalleryBrowser2* >( GetParent() )->KeyInput( rKEvt, this ) ) 741cdf0e10cSrcweir BrowseBox::KeyInput( rKEvt ); 742cdf0e10cSrcweir } 743cdf0e10cSrcweir 744cdf0e10cSrcweir // ------------------------------------------------------------------------ 745cdf0e10cSrcweir 746cdf0e10cSrcweir void GalleryListView::DoubleClick( const BrowserMouseEvent& rEvt ) 747cdf0e10cSrcweir { 748cdf0e10cSrcweir BrowseBox::DoubleClick( rEvt ); 749cdf0e10cSrcweir 750cdf0e10cSrcweir if( rEvt.GetRow() != BROWSER_ENDOFSELECTION ) 751cdf0e10cSrcweir ( (GalleryBrowser2*) GetParent() )->TogglePreview( this, &rEvt.GetPosPixel() ); 752cdf0e10cSrcweir } 753cdf0e10cSrcweir 754cdf0e10cSrcweir // ------------------------------------------------------------------------ 755cdf0e10cSrcweir 756cdf0e10cSrcweir void GalleryListView::Select() 757cdf0e10cSrcweir { 758cdf0e10cSrcweir if( maSelectHdl.IsSet() ) 759cdf0e10cSrcweir maSelectHdl.Call( this ); 760cdf0e10cSrcweir } 761cdf0e10cSrcweir 762cdf0e10cSrcweir // ------------------------------------------------------------------------ 763cdf0e10cSrcweir 764cdf0e10cSrcweir sal_Int8 GalleryListView::AcceptDrop( const BrowserAcceptDropEvent& ) 765cdf0e10cSrcweir { 766cdf0e10cSrcweir sal_Int8 nRet = DND_ACTION_NONE; 767cdf0e10cSrcweir 768cdf0e10cSrcweir if( mpTheme && !mpTheme->IsReadOnly() && !mpTheme ->IsImported() ) 769cdf0e10cSrcweir { 770cdf0e10cSrcweir if( !mpTheme->IsDragging() ) 771cdf0e10cSrcweir nRet = DND_ACTION_COPY; 772cdf0e10cSrcweir else 773cdf0e10cSrcweir nRet = DND_ACTION_COPY; 774cdf0e10cSrcweir } 775cdf0e10cSrcweir 776cdf0e10cSrcweir return nRet; 777cdf0e10cSrcweir } 778cdf0e10cSrcweir 779cdf0e10cSrcweir // ------------------------------------------------------------------------ 780cdf0e10cSrcweir 781cdf0e10cSrcweir sal_Int8 GalleryListView::ExecuteDrop( const BrowserExecuteDropEvent& rEvt ) 782cdf0e10cSrcweir { 783cdf0e10cSrcweir ExecuteDropEvent aEvt( rEvt ); 784cdf0e10cSrcweir 785cdf0e10cSrcweir aEvt.maPosPixel.Y() += GetTitleHeight(); 786cdf0e10cSrcweir 787cdf0e10cSrcweir return( ( (GalleryBrowser2*) GetParent() )->ExecuteDrop( *this, aEvt ) ); 788cdf0e10cSrcweir } 789cdf0e10cSrcweir 790cdf0e10cSrcweir // ------------------------------------------------------------------------ 791cdf0e10cSrcweir 792cdf0e10cSrcweir void GalleryListView::StartDrag( sal_Int8, const Point& rPosPixel ) 793cdf0e10cSrcweir { 794cdf0e10cSrcweir ( (GalleryBrowser2*) GetParent() )->StartDrag( this, &rPosPixel ); 795cdf0e10cSrcweir } 796