1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: galctrl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_GALCTRL_HXX_
32 #define _SVX_GALCTRL_HXX_
34 #include <vcl/dialog.hxx>
35 #include <vcl/graph.hxx>
36 #include <vcl/fixed.hxx>
37 #include <vcl/group.hxx>
38 #include <vcl/button.hxx>
39 #include <vcl/lstbox.hxx>
40 #include <vcl/menu.hxx>
41 #include <vcl/edit.hxx>
42 #include <vcl/combobox.hxx>
43 #include <vcl/sound.hxx>
44 #include <svtools/slstitm.hxx>
45 #include <svtools/transfer.hxx>
46 #include <svtools/valueset.hxx>
47 #include <svtools/brwbox.hxx>
48 #include <goodies/grfmgr.hxx>
49 #include "galmisc.hxx"
50 #include "svx/svxdllapi.h"
57 class GalleryBrowser2
;
63 class SVX_DLLPUBLIC GalleryPreview
: public Window
, public DropTargetHelper
, public DragSourceHelper
67 GraphicObject aGraphicObj
;
68 Rectangle aPreviewRect
;
69 GalleryTheme
* mpTheme
;
71 SVX_DLLPRIVATE BOOL
ImplGetGraphicCenterRect( const Graphic
& rGraphic
, Rectangle
& rResultRect
) const;
72 SVX_DLLPRIVATE
void InitSettings();
75 SVX_DLLPRIVATE
virtual void Paint(const Rectangle
& rRect
);
76 SVX_DLLPRIVATE
virtual void MouseButtonDown(const MouseEvent
& rMEvt
);
77 SVX_DLLPRIVATE
virtual void Command(const CommandEvent
& rCEvt
);
78 SVX_DLLPRIVATE
virtual void KeyInput( const KeyEvent
& rKEvt
);
79 SVX_DLLPRIVATE
virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
83 SVX_DLLPRIVATE
virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
84 SVX_DLLPRIVATE
virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
87 SVX_DLLPRIVATE
virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
);
89 DECL_LINK( MenuSelectHdl
, Menu
* );
93 GalleryPreview( GalleryBrowser2
* pParent
, GalleryTheme
* pTheme
);
94 GalleryPreview( Window
* pParent
, const ResId
& rResId
);
97 void SetGraphic( const Graphic
& rGraphic
) { aGraphicObj
.SetGraphic( rGraphic
); }
98 void PreviewMedia( const INetURLObject
& rURL
);
101 // -------------------
102 // - GalleryIconView -
103 // -------------------
105 class GalleryIconView
: public ValueSet
, public DropTargetHelper
, public DragSourceHelper
107 using ValueSet::StartDrag
;
111 GalleryTheme
* mpTheme
;
116 virtual void UserDraw( const UserDrawEvent
& rUDEvt
);
119 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
120 virtual void Command( const CommandEvent
& rCEvt
);
121 virtual void KeyInput( const KeyEvent
& rKEvt
);
122 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
125 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
126 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
129 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
);
133 GalleryIconView( GalleryBrowser2
* pParent
, GalleryTheme
* pTheme
);
137 // -------------------
138 // - GalleryListView -
139 // -------------------
141 class GalleryListView
: public BrowseBox
143 using BrowseBox::AcceptDrop
;
144 using BrowseBox::ExecuteDrop
;
149 GalleryTheme
* mpTheme
;
156 virtual BOOL
SeekRow( long nRow
);
157 virtual void PaintField( OutputDevice
& rDev
, const Rectangle
& rRect
, USHORT nColumnId
) const;
158 virtual void DoubleClick( const BrowserMouseEvent
& rEvt
);
159 virtual void Select();
160 virtual sal_Int8
AcceptDrop( const BrowserAcceptDropEvent
& rEvt
);
161 virtual sal_Int8
ExecuteDrop( const BrowserExecuteDropEvent
& rEvt
);
162 virtual void KeyInput( const KeyEvent
& rKEvt
);
165 virtual void Command( const CommandEvent
& rCEvt
);
166 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
169 virtual void StartDrag( sal_Int8 nAction
, const Point
& rPosPixel
);
173 GalleryListView( GalleryBrowser2
* pParent
, GalleryTheme
* pTheme
);
176 void SetSelectHdl( const Link
& rSelectHdl
) { maSelectHdl
= rSelectHdl
; }
178 /** GetCellText returns the text at the given position
180 the number of the row
184 the text out of the cell
186 virtual String
GetCellText(long _nRow
, USHORT _nColId
) const;
188 // from IAccessibleTableProvider
189 virtual Rectangle
GetFieldCharacterBounds(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,sal_Int32 nIndex
);
190 virtual sal_Int32
GetFieldIndexAtPoint(sal_Int32 _nRow
,sal_Int32 _nColumnPos
,const Point
& _rPoint
);
193 #endif // _SVX_GALCTRL_HXX_