Update ooo320-m1
[ooovba.git] / svx / inc / galctrl.hxx
blob56113321196d6605e86707de6a0c521385de2b4c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: galctrl.hxx,v $
10 * $Revision: 1.8 $
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"
52 // ------------
53 // - Forwards -
54 // ------------
56 class GalleryTheme;
57 class GalleryBrowser2;
59 // ------------------
60 // - GalleryPreview -
61 // ------------------
63 class SVX_DLLPUBLIC GalleryPreview : public Window, public DropTargetHelper, public DragSourceHelper
65 private:
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();
74 // Window
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 );
82 // DropTargetHelper
83 SVX_DLLPRIVATE virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
84 SVX_DLLPRIVATE virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
86 // DragSourceHelper
87 SVX_DLLPRIVATE virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
89 DECL_LINK( MenuSelectHdl, Menu* );
91 public:
93 GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme );
94 GalleryPreview( Window* pParent, const ResId& rResId );
95 ~GalleryPreview();
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;
109 private:
111 GalleryTheme* mpTheme;
113 void InitSettings();
115 // ValueSet
116 virtual void UserDraw( const UserDrawEvent& rUDEvt );
118 // Window
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 );
124 // DropTargetHelper
125 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
126 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
128 // DragSourceHelper
129 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
131 public:
133 GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
134 ~GalleryIconView();
137 // -------------------
138 // - GalleryListView -
139 // -------------------
141 class GalleryListView : public BrowseBox
143 using BrowseBox::AcceptDrop;
144 using BrowseBox::ExecuteDrop;
146 private:
148 Link maSelectHdl;
149 GalleryTheme* mpTheme;
150 ULONG mnCurRow;
151 BOOL mbInit;
153 void InitSettings();
155 // BrowseBox
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 );
164 // Window
165 virtual void Command( const CommandEvent& rCEvt );
166 virtual void DataChanged( const DataChangedEvent& rDCEvt );
168 // DragSourceHelper
169 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
171 public:
173 GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme );
174 ~GalleryListView();
176 void SetSelectHdl( const Link& rSelectHdl ) { maSelectHdl = rSelectHdl; }
178 /** GetCellText returns the text at the given position
179 @param _nRow
180 the number of the row
181 @param _nColId
182 the ID of the column
183 @return
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_