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: galbrws2.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_GALBRWS2_HXX_
32 #define _SVX_GALBRWS2_HXX_
34 #include <vcl/lstbox.hxx>
35 #include <vcl/button.hxx>
36 #include <vcl/fixed.hxx>
37 #include <vcl/timer.hxx>
38 #include <vcl/toolbox.hxx>
39 #include <svtools/transfer.hxx>
40 #include <svtools/lstner.hxx>
41 #include <svtools/miscopt.hxx>
42 #include "galbrws.hxx"
44 // ----------------------
45 // - GalleryBrowserMode -
46 // ----------------------
48 enum GalleryBrowserMode
50 GALLERYBROWSERMODE_NONE
= 0,
51 GALLERYBROWSERMODE_ICON
= 1,
52 GALLERYBROWSERMODE_LIST
= 2,
53 GALLERYBROWSERMODE_PREVIEW
= 3
60 enum GalleryBrowserTravel
62 GALLERYBROWSERTRAVEL_CURRENT
= 0,
63 GALLERYBROWSERTRAVEL_FIRST
= 1,
64 GALLERYBROWSERTRAVEL_LAST
= 2,
65 GALLERYBROWSERTRAVEL_PREVIOUS
= 3,
66 GALLERYBROWSERTRAVEL_NEXT
= 4
69 // ------------------------
70 // - GalleryItemTextFlags -
71 // ------------------------
73 #define GALLERY_ITEM_THEMENAME 0x00000001
74 #define GALLERY_ITEM_TITLE 0x00000002
75 #define GALLERY_ITEM_PATH 0x00000004
81 class GalleryToolBox
: public ToolBox
85 virtual void KeyInput( const KeyEvent
& rKEvt
);
89 GalleryToolBox( GalleryBrowser2
* pParent
);
93 // -------------------
94 // - GalleryBrowser2 -
95 // -------------------
99 class GalleryIconView
;
100 class GalleryListView
;
101 class GalleryPreview
;
105 class GalleryBrowser2
: public Control
, public SfxListener
107 friend class GalleryBrowser
;
108 using Control::Notify
;
109 using Window::KeyInput
;
113 SvtMiscOptions maMiscOptions
;
115 GalleryTheme
* mpCurTheme
;
116 GalleryIconView
* mpIconView
;
117 GalleryListView
* mpListView
;
118 GalleryPreview
* mpPreview
;
119 GalleryToolBox maViewBox
;
120 FixedLine maSeparator
;
122 Point maDragStartPos
;
123 ULONG mnCurActionPos
;
124 GalleryBrowserMode meMode
;
125 GalleryBrowserMode meLastMode
;
126 BOOL mbCurActionIsLinkage
;
130 void ImplUpdateViews( USHORT nSelectionId
);
131 void ImplUpdateInfoBar();
132 ULONG
ImplGetSelectedItemId( const Point
* pSelPosPixel
, Point
& rSelPos
);
133 void ImplSelectItemId( ULONG nItemId
);
134 void ImplExecute( USHORT nId
);
137 virtual void Resize();
138 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
141 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
143 DECL_LINK( MenuSelectHdl
, Menu
* pMenu
);
144 DECL_LINK( SelectObjectHdl
, void* );
145 DECL_LINK( SelectTbxHdl
, ToolBox
* );
146 DECL_LINK( MiscHdl
, void* );
150 static GalleryBrowserMode meInitMode
;
154 static String
GetItemText( const GalleryTheme
& rTheme
, const SgaObject
& rObj
, ULONG nItemTextFlags
);
158 GalleryBrowser2( GalleryBrowser
* pParent
, const ResId
& rResId
, Gallery
* pGallery
);
161 void SelectTheme( const String
& rThemeName
);
163 GalleryBrowserMode
GetMode() const { return meMode
; }
164 void SetMode( GalleryBrowserMode eMode
);
166 Window
* GetViewWindow() const;
168 void Travel( GalleryBrowserTravel eTravel
);
170 INetURLObject
GetURL() const;
171 String
GetFilterName() const;
172 Graphic
GetGraphic() const;
173 BOOL
GetVCDrawModel( FmFormModel
& rModel
) const;
174 BOOL
IsLinkage() const;
176 sal_Int8
AcceptDrop( DropTargetHelper
& rTarget
, const AcceptDropEvent
& rEvt
);
177 sal_Int8
ExecuteDrop( DropTargetHelper
& rTarget
, const ExecuteDropEvent
& rEvt
);
178 void StartDrag( Window
* pWindow
, const Point
* pDragPoint
= NULL
);
179 void TogglePreview( Window
* pWindow
, const Point
* pPreviewPoint
= NULL
);
180 void ShowContextMenu( Window
* pWindow
, const Point
* pContextPoint
= NULL
);
181 BOOL
KeyInput( const KeyEvent
& rEvt
, Window
* pWindow
);