xref: /aoo42x/main/svx/inc/galbrws2.hxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SVX_GALBRWS2_HXX_
29*cdf0e10cSrcweir #define _SVX_GALBRWS2_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <vcl/lstbox.hxx>
32*cdf0e10cSrcweir #include <vcl/button.hxx>
33*cdf0e10cSrcweir #include <vcl/fixed.hxx>
34*cdf0e10cSrcweir #include <vcl/timer.hxx>
35*cdf0e10cSrcweir #include <vcl/toolbox.hxx>
36*cdf0e10cSrcweir #include <svtools/transfer.hxx>
37*cdf0e10cSrcweir #include <svl/lstner.hxx>
38*cdf0e10cSrcweir #include <svtools/miscopt.hxx>
39*cdf0e10cSrcweir #include "svx/galbrws.hxx"
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir // ----------------------
42*cdf0e10cSrcweir // - GalleryBrowserMode -
43*cdf0e10cSrcweir // ----------------------
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir enum GalleryBrowserMode
46*cdf0e10cSrcweir {
47*cdf0e10cSrcweir     GALLERYBROWSERMODE_NONE = 0,
48*cdf0e10cSrcweir     GALLERYBROWSERMODE_ICON = 1,
49*cdf0e10cSrcweir     GALLERYBROWSERMODE_LIST = 2,
50*cdf0e10cSrcweir     GALLERYBROWSERMODE_PREVIEW = 3
51*cdf0e10cSrcweir };
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir // -----------------
54*cdf0e10cSrcweir // - GalleryTravel -
55*cdf0e10cSrcweir // -----------------
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir enum GalleryBrowserTravel
58*cdf0e10cSrcweir {
59*cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_CURRENT = 0,
60*cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_FIRST = 1,
61*cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_LAST = 2,
62*cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_PREVIOUS = 3,
63*cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_NEXT = 4
64*cdf0e10cSrcweir };
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir // ------------------------
67*cdf0e10cSrcweir // - GalleryItemTextFlags -
68*cdf0e10cSrcweir // ------------------------
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir #define GALLERY_ITEM_THEMENAME  0x00000001
71*cdf0e10cSrcweir #define GALLERY_ITEM_TITLE      0x00000002
72*cdf0e10cSrcweir #define GALLERY_ITEM_PATH       0x00000004
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir // ------------------
75*cdf0e10cSrcweir // - GalleryToolBox -
76*cdf0e10cSrcweir // ------------------
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir class GalleryToolBox : public ToolBox
79*cdf0e10cSrcweir {
80*cdf0e10cSrcweir private:
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir     virtual void    KeyInput( const KeyEvent& rKEvt );
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir public:
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir                     GalleryToolBox( GalleryBrowser2* pParent );
87*cdf0e10cSrcweir                     ~GalleryToolBox();
88*cdf0e10cSrcweir };
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir // -------------------
91*cdf0e10cSrcweir // - GalleryBrowser2 -
92*cdf0e10cSrcweir // -------------------
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir class Gallery;
95*cdf0e10cSrcweir class GalleryTheme;
96*cdf0e10cSrcweir class GalleryIconView;
97*cdf0e10cSrcweir class GalleryListView;
98*cdf0e10cSrcweir class GalleryPreview;
99*cdf0e10cSrcweir class Menu;
100*cdf0e10cSrcweir class SgaObject;
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir class GalleryBrowser2 : public Control, public SfxListener
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir 	friend class GalleryBrowser;
105*cdf0e10cSrcweir 	using Control::Notify;
106*cdf0e10cSrcweir 	using Window::KeyInput;
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir private:
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	SvtMiscOptions		maMiscOptions;
111*cdf0e10cSrcweir 	Gallery*			mpGallery;
112*cdf0e10cSrcweir 	GalleryTheme*		mpCurTheme;
113*cdf0e10cSrcweir 	GalleryIconView*	mpIconView;
114*cdf0e10cSrcweir 	GalleryListView*	mpListView;
115*cdf0e10cSrcweir 	GalleryPreview*		mpPreview;
116*cdf0e10cSrcweir     GalleryToolBox      maViewBox;
117*cdf0e10cSrcweir     FixedLine           maSeparator;
118*cdf0e10cSrcweir 	FixedText			maInfoBar;
119*cdf0e10cSrcweir 	Point				maDragStartPos;
120*cdf0e10cSrcweir 	sal_uIntPtr				mnCurActionPos;
121*cdf0e10cSrcweir     GalleryBrowserMode  meMode;
122*cdf0e10cSrcweir     GalleryBrowserMode  meLastMode;
123*cdf0e10cSrcweir 	sal_Bool				mbCurActionIsLinkage;
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     void                InitSettings();
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 	void				ImplUpdateViews( sal_uInt16 nSelectionId );
128*cdf0e10cSrcweir 	void				ImplUpdateInfoBar();
129*cdf0e10cSrcweir     sal_uIntPtr               ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
130*cdf0e10cSrcweir     void                ImplSelectItemId( sal_uIntPtr nItemId );
131*cdf0e10cSrcweir     void                ImplExecute( sal_uInt16 nId );
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir 	// Control
134*cdf0e10cSrcweir 	virtual void		Resize();
135*cdf0e10cSrcweir     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 	// SfxListener
138*cdf0e10cSrcweir 	virtual void		Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 						DECL_LINK( MenuSelectHdl, Menu* pMenu );
141*cdf0e10cSrcweir 						DECL_LINK( SelectObjectHdl, void* );
142*cdf0e10cSrcweir 						DECL_LINK( SelectTbxHdl, ToolBox* );
143*cdf0e10cSrcweir 						DECL_LINK( MiscHdl, void* );
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir private:
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     static GalleryBrowserMode meInitMode;
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir public:
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	static String		GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags );
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir public:
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 						GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
156*cdf0e10cSrcweir 						~GalleryBrowser2();
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 	void				SelectTheme( const String& rThemeName );
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     GalleryBrowserMode  GetMode() const { return meMode; }
161*cdf0e10cSrcweir     void                SetMode( GalleryBrowserMode eMode );
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir     Window*             GetViewWindow() const;
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     void                Travel( GalleryBrowserTravel eTravel );
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 	INetURLObject		GetURL() const;
168*cdf0e10cSrcweir 	String				GetFilterName() const;
169*cdf0e10cSrcweir 	Graphic				GetGraphic() const;
170*cdf0e10cSrcweir 	sal_Bool				GetVCDrawModel( FmFormModel& rModel ) const;
171*cdf0e10cSrcweir 	sal_Bool				IsLinkage() const;
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 	sal_Int8			AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& rEvt );
174*cdf0e10cSrcweir 	sal_Int8			ExecuteDrop( DropTargetHelper& rTarget, const ExecuteDropEvent& rEvt );
175*cdf0e10cSrcweir     void                StartDrag( Window* pWindow, const Point* pDragPoint = NULL );
176*cdf0e10cSrcweir     void                TogglePreview( Window* pWindow, const Point* pPreviewPoint = NULL );
177*cdf0e10cSrcweir     void                ShowContextMenu( Window* pWindow, const Point* pContextPoint = NULL );
178*cdf0e10cSrcweir     sal_Bool                KeyInput( const KeyEvent& rEvt, Window* pWindow );
179*cdf0e10cSrcweir };
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir #endif
182