char array should be null terminated
[LibreOffice.git] / svx / source / gallery2 / galctrl.cxx
blob667cc36574b81b6333cf21a42d7f2e16ffd4d31a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_svx.hxx"
32 #include <vcl/svapp.hxx>
33 #include <sfx2/viewfrm.hxx>
34 #include <sfx2/dispatch.hxx>
35 #include <avmedia/mediaplayer.hxx>
36 #include "helpid.hrc"
37 #include "galbrws2.hxx"
38 #include "svx/galtheme.hxx"
39 #include "svx/galmisc.hxx"
40 #include "svx/galctrl.hxx"
41 #include "editeng/AccessibleStringWrap.hxx"
42 #include <editeng/svxfont.hxx>
43 #include "galobj.hxx"
44 #include <avmedia/mediawindow.hxx>
45 #include "gallery.hrc"
46 #include <svtools/filter.hxx>
48 // -----------
49 // - Defines -
50 // -----------
52 #define GALLERY_BRWBOX_TITLE 1
53 #define GALLERY_BRWBOX_PATH 2
55 // ------------------
56 // - GalleryPreview -
57 // ------------------
59 GalleryPreview::GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme ) :
60 Window( pParent, WB_TABSTOP | WB_BORDER ),
61 DropTargetHelper( this ),
62 DragSourceHelper( this ),
63 mpTheme( pTheme )
65 SetHelpId( HID_GALLERY_WINDOW );
66 InitSettings();
69 // ------------------------------------------------------------------------
71 GalleryPreview::GalleryPreview( Window* pParent, const ResId & rResId ) :
72 Window( pParent, rResId ),
73 DropTargetHelper( this ),
74 DragSourceHelper( this ),
75 mpTheme( NULL )
77 SetHelpId( HID_GALLERY_PREVIEW );
78 InitSettings();
81 // ------------------------------------------------------------------------
83 GalleryPreview::~GalleryPreview()
88 bool GalleryPreview::SetGraphic( const INetURLObject& _aURL )
90 bool bRet = true;
91 Graphic aGraphic;
92 if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ) ) )
94 aGraphic = BitmapEx( GAL_RESID( RID_SVXBMP_GALLERY_MEDIA ) );
96 else
98 GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter();
99 GalleryProgress aProgress( &rFilter );
100 if( rFilter.ImportGraphic( aGraphic, _aURL, GRFILTER_FORMAT_DONTKNOW ) )
101 bRet = false;
104 SetGraphic( aGraphic );
105 Invalidate();
106 return bRet;
109 // ------------------------------------------------------------------------
111 void GalleryPreview::InitSettings()
113 SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
114 SetControlBackground( GALLERY_BG_COLOR );
115 SetControlForeground( GALLERY_FG_COLOR );
118 // -----------------------------------------------------------------------
120 void GalleryPreview::DataChanged( const DataChangedEvent& rDCEvt )
122 if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
123 InitSettings();
124 else
125 Window::DataChanged( rDCEvt );
128 // ------------------------------------------------------------------------
130 sal_Bool GalleryPreview::ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const
132 const Size aWinSize( GetOutputSizePixel() );
133 Size aNewSize( LogicToPixel( rGraphic.GetPrefSize(), rGraphic.GetPrefMapMode() ) );
134 sal_Bool bRet = sal_False;
136 if( aNewSize.Width() && aNewSize.Height() )
138 // scale to fit window
139 const double fGrfWH = (double) aNewSize.Width() / aNewSize.Height();
140 const double fWinWH = (double) aWinSize.Width() / aWinSize.Height();
142 if ( fGrfWH < fWinWH )
144 aNewSize.Width() = (long) ( aWinSize.Height() * fGrfWH );
145 aNewSize.Height()= aWinSize.Height();
147 else
149 aNewSize.Width() = aWinSize.Width();
150 aNewSize.Height()= (long) ( aWinSize.Width() / fGrfWH);
153 const Point aNewPos( ( aWinSize.Width() - aNewSize.Width() ) >> 1,
154 ( aWinSize.Height() - aNewSize.Height() ) >> 1 );
156 rResultRect = Rectangle( aNewPos, aNewSize );
157 bRet = sal_True;
160 return bRet;
163 // ------------------------------------------------------------------------
165 void GalleryPreview::Paint( const Rectangle& rRect )
167 Window::Paint( rRect );
169 if( ImplGetGraphicCenterRect( aGraphicObj.GetGraphic(), aPreviewRect ) )
171 const Point aPos( aPreviewRect.TopLeft() );
172 const Size aSize( aPreviewRect.GetSize() );
174 if( aGraphicObj.IsAnimated() )
175 aGraphicObj.StartAnimation( this, aPos, aSize );
176 else
177 aGraphicObj.Draw( this, aPos, aSize );
181 // ------------------------------------------------------------------------
183 void GalleryPreview::MouseButtonDown( const MouseEvent& rMEvt )
185 if( mpTheme && ( rMEvt.GetClicks() == 2 ) )
186 ( (GalleryBrowser2*) GetParent() )->TogglePreview( this );
189 // ------------------------------------------------------------------------
191 void GalleryPreview::Command(const CommandEvent& rCEvt )
193 Window::Command( rCEvt );
195 if( mpTheme && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) )
196 ( (GalleryBrowser2*) GetParent() )->ShowContextMenu( this,
197 ( rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : NULL ) );
200 // ------------------------------------------------------------------------
202 void GalleryPreview::KeyInput( const KeyEvent& rKEvt )
204 if( mpTheme )
206 GalleryBrowser2* pBrowser = static_cast< GalleryBrowser2* >( GetParent() );
208 switch( rKEvt.GetKeyCode().GetCode() )
210 case( KEY_BACKSPACE ):
211 pBrowser->TogglePreview( this );
212 break;
214 case( KEY_HOME ):
215 pBrowser->Travel( GALLERYBROWSERTRAVEL_FIRST );
216 break;
218 case( KEY_END ):
219 pBrowser->Travel( GALLERYBROWSERTRAVEL_LAST );
220 break;
222 case( KEY_LEFT ):
223 case( KEY_UP ):
224 pBrowser->Travel( GALLERYBROWSERTRAVEL_PREVIOUS );
225 break;
227 case( KEY_RIGHT ):
228 case( KEY_DOWN ):
229 pBrowser->Travel( GALLERYBROWSERTRAVEL_NEXT );
230 break;
232 default:
234 if( !pBrowser->KeyInput( rKEvt, this ) )
235 Window::KeyInput( rKEvt );
237 break;
240 else
241 Window::KeyInput( rKEvt );
244 // ------------------------------------------------------------------------
246 sal_Int8 GalleryPreview::AcceptDrop( const AcceptDropEvent& rEvt )
248 sal_Int8 nRet;
250 if( mpTheme )
251 nRet = ( (GalleryBrowser2*) GetParent() )->AcceptDrop( *this, rEvt );
252 else
253 nRet = DND_ACTION_NONE;
255 return nRet;
258 // ------------------------------------------------------------------------
260 sal_Int8 GalleryPreview::ExecuteDrop( const ExecuteDropEvent& rEvt )
262 sal_Int8 nRet;
264 if( mpTheme )
265 nRet = ( (GalleryBrowser2*) GetParent() )->ExecuteDrop( *this, rEvt );
266 else
267 nRet = DND_ACTION_NONE;
269 return nRet;
272 // ------------------------------------------------------------------------
274 void GalleryPreview::StartDrag( sal_Int8, const Point& )
276 if( mpTheme )
277 ( (GalleryBrowser2*) GetParent() )->StartDrag( this );
280 // ------------------------------------------------------------------------
282 void GalleryPreview::PreviewMedia( const INetURLObject& rURL )
284 if( rURL.GetProtocol() != INET_PROT_NOT_VALID )
286 ::avmedia::MediaFloater* pFloater = AVMEDIA_MEDIAWINDOW();
288 if( !pFloater )
290 SfxViewFrame::Current()->GetBindings().GetDispatcher()->Execute( SID_AVMEDIA_PLAYER, SFX_CALLMODE_SYNCHRON );
291 pFloater = AVMEDIA_MEDIAWINDOW();
294 if( pFloater )
295 pFloater->setURL( rURL.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ), true );
299 // ------------------------------------------------------------------------
301 // -------------------
302 // - GalleryIconView -
303 // -------------------
305 GalleryIconView::GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme ) :
306 ValueSet( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_VSCROLL | WB_FLATVALUESET ),
307 DropTargetHelper( this ),
308 DragSourceHelper( this ),
309 mpTheme ( pTheme )
311 EnableFullItemMode( sal_False );
313 SetHelpId( HID_GALLERY_WINDOW );
314 InitSettings();
315 SetExtraSpacing( 2 );
316 SetItemWidth( S_THUMB + 6 );
317 SetItemHeight( S_THUMB + 6 );
320 // ------------------------------------------------------------------------
322 GalleryIconView::~GalleryIconView()
326 // ------------------------------------------------------------------------
328 void GalleryIconView::InitSettings()
330 SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
331 SetControlBackground( GALLERY_BG_COLOR );
332 SetControlForeground( GALLERY_FG_COLOR );
333 SetColor( GALLERY_BG_COLOR );
336 // -----------------------------------------------------------------------
338 void GalleryIconView::DataChanged( const DataChangedEvent& rDCEvt )
340 if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
341 InitSettings();
342 else
343 ValueSet::DataChanged( rDCEvt );
346 // ------------------------------------------------------------------------
348 void GalleryIconView::UserDraw( const UserDrawEvent& rUDEvt )
350 const sal_uInt16 nId = rUDEvt.GetItemId();
352 if( nId && mpTheme )
354 SgaObject* pObj = mpTheme->AcquireObject( nId - 1 );
356 if( pObj )
358 const Rectangle& rRect = rUDEvt.GetRect();
359 OutputDevice* pDev = rUDEvt.GetDevice();
360 Graphic aGraphic;
362 if( pObj->IsThumbBitmap() )
364 Bitmap aBmp( pObj->GetThumbBmp() );
366 if( pObj->GetObjKind() == SGA_OBJ_SOUND )
367 aBmp.Replace( COL_LIGHTMAGENTA, COL_WHITE );
369 if( ( pDev->GetBitCount() <= 8 ) && ( aBmp.GetBitCount() >= 8 ) )
370 aBmp.Dither( BMP_DITHER_FLOYD );
372 aGraphic = aBmp;
374 else
375 aGraphic = pObj->GetThumbMtf();
377 Size aSize( aGraphic.GetSizePixel( pDev ) );
379 if ( aSize.Width() && aSize.Height() )
381 if( ( aSize.Width() > rRect.GetWidth() ) || ( aSize.Height() > rRect.GetHeight() ) )
383 Point aNewPos;
384 const double fBmpWH = (double) aSize.Width() / aSize.Height();
385 const double fThmpWH = (double) rRect.GetWidth() / rRect.GetHeight();
387 // Bitmap an Thumbgroesse anpassen
388 if ( fBmpWH < fThmpWH )
390 aSize.Width() = (long) ( rRect.GetHeight() * fBmpWH );
391 aSize.Height()= rRect.GetHeight();
393 else
395 aSize.Width() = rRect.GetWidth();
396 aSize.Height()= (long) ( rRect.GetWidth() / fBmpWH );
400 const Point aPos( ( ( rRect.GetWidth() - aSize.Width() ) >> 1 ) + rRect.Left(),
401 ( ( rRect.GetHeight() - aSize.Height() ) >> 1 ) + rRect.Top() );
403 aGraphic.Draw( pDev, aPos, aSize );
406 SetItemText( nId, GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_THEMENAME | GALLERY_ITEM_TITLE | GALLERY_ITEM_PATH ) );
407 mpTheme->ReleaseObject( pObj );
412 // ------------------------------------------------------------------------
414 void GalleryIconView::MouseButtonDown( const MouseEvent& rMEvt )
416 ValueSet::MouseButtonDown( rMEvt );
418 if( rMEvt.GetClicks() == 2 )
419 ( (GalleryBrowser2*) GetParent() )->TogglePreview( this, &rMEvt.GetPosPixel() );
422 // ------------------------------------------------------------------------
424 void GalleryIconView::Command( const CommandEvent& rCEvt )
426 ValueSet::Command( rCEvt );
428 if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
430 ( (GalleryBrowser2*) GetParent() )->ShowContextMenu( this,
431 ( rCEvt.IsMouseEvent() ? &rCEvt.GetMousePosPixel() : NULL ) );
435 // ------------------------------------------------------------------------
437 void GalleryIconView::KeyInput( const KeyEvent& rKEvt )
439 if( !mpTheme || !static_cast< GalleryBrowser2* >( GetParent() )->KeyInput( rKEvt, this ) )
440 ValueSet::KeyInput( rKEvt );
443 // ------------------------------------------------------------------------
445 sal_Int8 GalleryIconView::AcceptDrop( const AcceptDropEvent& rEvt )
447 return( static_cast< GalleryBrowser2* >( GetParent() )->AcceptDrop( *this, rEvt ) );
450 // ------------------------------------------------------------------------
452 sal_Int8 GalleryIconView::ExecuteDrop( const ExecuteDropEvent& rEvt )
454 return( static_cast< GalleryBrowser2* >( GetParent() )->ExecuteDrop( *this, rEvt ) );
457 // ------------------------------------------------------------------------
459 void GalleryIconView::StartDrag( sal_Int8, const Point& )
461 const CommandEvent aEvt( GetPointerPosPixel(), COMMAND_STARTDRAG, sal_True );
462 Region aRegion;
464 // call this to initiate dragging for ValueSet
465 ValueSet::StartDrag( aEvt, aRegion );
466 static_cast< GalleryBrowser2* >( GetParent() )->StartDrag( this );
469 // -------------------
470 // - GalleryListView -
471 // -------------------
473 GalleryListView::GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme ) :
474 BrowseBox( pParent, WB_TABSTOP | WB_3DLOOK | WB_BORDER ),
475 mpTheme( pTheme ),
476 mnCurRow( 0 ),
477 mbInit( sal_False )
479 SetHelpId( HID_GALLERY_WINDOW );
481 InitSettings();
483 SetMode( BROWSER_AUTO_VSCROLL | BROWSER_AUTOSIZE_LASTCOL );
484 SetDataRowHeight( 28 );
485 InsertDataColumn( GALLERY_BRWBOX_TITLE, String( GAL_RESID( RID_SVXSTR_GALLERY_TITLE ) ), 256 );
486 InsertDataColumn( GALLERY_BRWBOX_PATH, String( GAL_RESID( RID_SVXSTR_GALLERY_PATH ) ), 256 );
489 // ------------------------------------------------------------------------
491 GalleryListView::~GalleryListView()
495 // ------------------------------------------------------------------------
497 void GalleryListView::InitSettings()
499 SetBackground( Wallpaper( GALLERY_BG_COLOR ) );
500 SetControlBackground( GALLERY_BG_COLOR );
501 SetControlForeground( GALLERY_FG_COLOR );
504 // -----------------------------------------------------------------------
506 void GalleryListView::DataChanged( const DataChangedEvent& rDCEvt )
508 if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
509 InitSettings();
510 else
511 BrowseBox::DataChanged( rDCEvt );
514 // ------------------------------------------------------------------------
516 sal_Bool GalleryListView::SeekRow( long nRow )
518 mnCurRow = nRow;
519 return sal_True;
522 // -----------------------------------------------------------------------------
524 String GalleryListView::GetCellText(long _nRow, sal_uInt16 nColumnId) const
526 String sRet;
527 if( mpTheme && ( _nRow < static_cast< long >( mpTheme->GetObjectCount() ) ) )
529 SgaObject* pObj = mpTheme->AcquireObject( _nRow );
531 if( pObj )
533 sRet = GalleryBrowser2::GetItemText( *mpTheme, *pObj,
534 ( GALLERY_BRWBOX_TITLE == nColumnId ) ? GALLERY_ITEM_TITLE : GALLERY_ITEM_PATH );
536 mpTheme->ReleaseObject( pObj );
540 return sRet;;
543 // -----------------------------------------------------------------------------
545 Rectangle GalleryListView::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)
547 DBG_ASSERT(_nColumnPos >= 0 && _nColumnPos <= USHRT_MAX, "GalleryListView::GetFieldCharacterBounds: _nColumnId overflow");
548 Rectangle aRect;
549 if ( SeekRow(_nRow) )
551 SvxFont aFont( GetFont() );
552 AccessibleStringWrap aStringWrap( *this, aFont, GetCellText(_nRow, sal::static_int_cast<sal_uInt16>( GetColumnId( sal::static_int_cast<sal_uInt16>(_nColumnPos) ) ) ) );
554 // get the bounds inside the string
555 aStringWrap.GetCharacterBounds(nIndex, aRect);
557 // offset to
559 return aRect;
562 // -----------------------------------------------------------------------------
564 sal_Int32 GalleryListView::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
566 DBG_ASSERT(_nColumnPos >= 0 && _nColumnPos <= USHRT_MAX, "GalleryListView::GetFieldIndexAtPoint: _nColumnId overflow");
567 sal_Int32 nRet = -1;
568 if ( SeekRow(_nRow) )
570 SvxFont aFont( GetFont() );
571 AccessibleStringWrap aStringWrap( *this, aFont, GetCellText(_nRow, sal::static_int_cast<sal_uInt16>(GetColumnId(sal::static_int_cast<sal_uInt16>(_nColumnPos)))) );
572 nRet = aStringWrap.GetIndexAtPoint(_rPoint);
574 return nRet;
577 // ------------------------------------------------------------------------
579 void GalleryListView::PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const
581 rDev.Push( PUSH_CLIPREGION );
582 rDev.IntersectClipRegion( rRect );
584 if( mpTheme && ( mnCurRow < mpTheme->GetObjectCount() ) )
586 SgaObject* pObj = mpTheme->AcquireObject( mnCurRow );
588 if( pObj )
590 const long nTextPosY = rRect.Top() + ( ( rRect.GetHeight() - rDev.GetTextHeight() ) >> 1 );
592 if( GALLERY_BRWBOX_TITLE == nColumnId )
594 Rectangle aOutputRect( rRect.TopLeft(), Size( rRect.GetHeight(), rRect.GetHeight() ) );
595 GraphicObject aGrfObj;
597 if( pObj->GetObjKind() == SGA_OBJ_SOUND )
598 aGrfObj = Graphic( BitmapEx( GAL_RESID( RID_SVXBMP_GALLERY_MEDIA ) ) );
599 else if( pObj->IsThumbBitmap() )
600 aGrfObj = Graphic( pObj->GetThumbBmp() );
601 else
602 aGrfObj = Graphic( pObj->GetThumbMtf() );
604 Size aSize( rDev.LogicToPixel( aGrfObj.GetPrefSize(), aGrfObj.GetPrefMapMode() ) );
606 if( aSize.Width() && aSize.Height() )
608 if( ( aSize.Width() > aOutputRect.GetWidth() ) || ( aSize.Height() > aOutputRect.GetHeight() ) )
610 Point aNewPos;
611 const double fBmpWH = (double) aSize.Width() / aSize.Height();
612 const double fThmpWH = (double) aOutputRect.GetWidth() / aOutputRect.GetHeight();
614 // Bitmap an Thumbgroesse anpassen
615 if ( fBmpWH < fThmpWH )
617 aSize.Width() = (long) ( aOutputRect.GetHeight() * fBmpWH );
618 aSize.Height()= aOutputRect.GetHeight();
620 else
622 aSize.Width() = aOutputRect.GetWidth();
623 aSize.Height()= (long) ( aOutputRect.GetWidth() / fBmpWH );
627 aSize.Width() = Max( aSize.Width(), 4L );
628 aSize.Height() = Max( aSize.Height(), 4L );
630 const Point aPos( ( ( aOutputRect.GetWidth() - aSize.Width() ) >> 1 ) + aOutputRect.Left(),
631 ( ( aOutputRect.GetHeight() - aSize.Height() ) >> 1 ) + aOutputRect.Top() );
633 aGrfObj.Draw( &rDev, aPos, aSize );
636 rDev.DrawText( Point( aOutputRect.Right() + 6, nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_TITLE ) );
638 else if( GALLERY_BRWBOX_PATH == nColumnId )
639 rDev.DrawText( Point( rRect.Left(), nTextPosY ), GalleryBrowser2::GetItemText( *mpTheme, *pObj, GALLERY_ITEM_PATH ) );
641 mpTheme->ReleaseObject( pObj );
645 rDev.Pop();
648 // ------------------------------------------------------------------------
650 void GalleryListView::Command( const CommandEvent& rCEvt )
652 BrowseBox::Command( rCEvt );
654 if( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
656 const Point* pPos = NULL;
658 if( rCEvt.IsMouseEvent() && ( GetRowAtYPosPixel( rCEvt.GetMousePosPixel().Y() ) != BROWSER_ENDOFSELECTION ) )
659 pPos = &rCEvt.GetMousePosPixel();
661 ( (GalleryBrowser2*) GetParent() )->ShowContextMenu( this, pPos );
665 // ------------------------------------------------------------------------
667 void GalleryListView::KeyInput( const KeyEvent& rKEvt )
669 if( !mpTheme || !static_cast< GalleryBrowser2* >( GetParent() )->KeyInput( rKEvt, this ) )
670 BrowseBox::KeyInput( rKEvt );
673 // ------------------------------------------------------------------------
675 void GalleryListView::DoubleClick( const BrowserMouseEvent& rEvt )
677 BrowseBox::DoubleClick( rEvt );
679 if( rEvt.GetRow() != BROWSER_ENDOFSELECTION )
680 ( (GalleryBrowser2*) GetParent() )->TogglePreview( this, &rEvt.GetPosPixel() );
683 // ------------------------------------------------------------------------
685 void GalleryListView::Select()
687 if( maSelectHdl.IsSet() )
688 maSelectHdl.Call( this );
691 // ------------------------------------------------------------------------
693 sal_Int8 GalleryListView::AcceptDrop( const BrowserAcceptDropEvent& )
695 sal_Int8 nRet = DND_ACTION_NONE;
697 if( mpTheme && !mpTheme->IsReadOnly() && !mpTheme ->IsImported() )
698 nRet = DND_ACTION_COPY;
700 return nRet;
703 // ------------------------------------------------------------------------
705 sal_Int8 GalleryListView::ExecuteDrop( const BrowserExecuteDropEvent& rEvt )
707 ExecuteDropEvent aEvt( rEvt );
709 aEvt.maPosPixel.Y() += GetTitleHeight();
711 return( ( (GalleryBrowser2*) GetParent() )->ExecuteDrop( *this, aEvt ) );
714 // ------------------------------------------------------------------------
716 void GalleryListView::StartDrag( sal_Int8, const Point& rPosPixel )
718 ( (GalleryBrowser2*) GetParent() )->StartDrag( this, &rPosPixel );
721 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */