xref: /aoo42x/main/svx/inc/galbrws2.hxx (revision 3334a7e6)
1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SVX_GALBRWS2_HXX_
25cdf0e10cSrcweir #define _SVX_GALBRWS2_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <vcl/lstbox.hxx>
28cdf0e10cSrcweir #include <vcl/button.hxx>
29cdf0e10cSrcweir #include <vcl/fixed.hxx>
30cdf0e10cSrcweir #include <vcl/timer.hxx>
31cdf0e10cSrcweir #include <vcl/toolbox.hxx>
32cdf0e10cSrcweir #include <svtools/transfer.hxx>
33cdf0e10cSrcweir #include <svl/lstner.hxx>
34cdf0e10cSrcweir #include <svtools/miscopt.hxx>
35cdf0e10cSrcweir #include "svx/galbrws.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir // ----------------------
38cdf0e10cSrcweir // - GalleryBrowserMode -
39cdf0e10cSrcweir // ----------------------
40cdf0e10cSrcweir 
41cdf0e10cSrcweir enum GalleryBrowserMode
42cdf0e10cSrcweir {
43cdf0e10cSrcweir     GALLERYBROWSERMODE_NONE = 0,
44cdf0e10cSrcweir     GALLERYBROWSERMODE_ICON = 1,
45cdf0e10cSrcweir     GALLERYBROWSERMODE_LIST = 2,
46cdf0e10cSrcweir     GALLERYBROWSERMODE_PREVIEW = 3
47cdf0e10cSrcweir };
48cdf0e10cSrcweir 
49cdf0e10cSrcweir // -----------------
50cdf0e10cSrcweir // - GalleryTravel -
51cdf0e10cSrcweir // -----------------
52cdf0e10cSrcweir 
53cdf0e10cSrcweir enum GalleryBrowserTravel
54cdf0e10cSrcweir {
55cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_CURRENT = 0,
56cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_FIRST = 1,
57cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_LAST = 2,
58cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_PREVIOUS = 3,
59cdf0e10cSrcweir     GALLERYBROWSERTRAVEL_NEXT = 4
60cdf0e10cSrcweir };
61cdf0e10cSrcweir 
62cdf0e10cSrcweir // ------------------------
63cdf0e10cSrcweir // - GalleryItemTextFlags -
64cdf0e10cSrcweir // ------------------------
65cdf0e10cSrcweir 
66cdf0e10cSrcweir #define GALLERY_ITEM_THEMENAME  0x00000001
67cdf0e10cSrcweir #define GALLERY_ITEM_TITLE      0x00000002
68cdf0e10cSrcweir #define GALLERY_ITEM_PATH       0x00000004
69cdf0e10cSrcweir 
70cdf0e10cSrcweir // ------------------
71cdf0e10cSrcweir // - GalleryToolBox -
72cdf0e10cSrcweir // ------------------
73cdf0e10cSrcweir 
74cdf0e10cSrcweir class GalleryToolBox : public ToolBox
75cdf0e10cSrcweir {
76cdf0e10cSrcweir private:
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     virtual void    KeyInput( const KeyEvent& rKEvt );
79cdf0e10cSrcweir 
80cdf0e10cSrcweir public:
81cdf0e10cSrcweir 
82cdf0e10cSrcweir                     GalleryToolBox( GalleryBrowser2* pParent );
83cdf0e10cSrcweir                     ~GalleryToolBox();
84cdf0e10cSrcweir };
85cdf0e10cSrcweir 
86cdf0e10cSrcweir // -------------------
87cdf0e10cSrcweir // - GalleryBrowser2 -
88cdf0e10cSrcweir // -------------------
89cdf0e10cSrcweir 
90cdf0e10cSrcweir class Gallery;
91cdf0e10cSrcweir class GalleryTheme;
92cdf0e10cSrcweir class GalleryIconView;
93cdf0e10cSrcweir class GalleryListView;
94cdf0e10cSrcweir class GalleryPreview;
95cdf0e10cSrcweir class Menu;
96cdf0e10cSrcweir class SgaObject;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir class GalleryBrowser2 : public Control, public SfxListener
99cdf0e10cSrcweir {
100cdf0e10cSrcweir 	friend class GalleryBrowser;
101cdf0e10cSrcweir 	using Control::Notify;
102cdf0e10cSrcweir 	using Window::KeyInput;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir private:
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	SvtMiscOptions		maMiscOptions;
107cdf0e10cSrcweir 	Gallery*			mpGallery;
108cdf0e10cSrcweir 	GalleryTheme*		mpCurTheme;
109cdf0e10cSrcweir 	GalleryIconView*	mpIconView;
110cdf0e10cSrcweir 	GalleryListView*	mpListView;
111cdf0e10cSrcweir 	GalleryPreview*		mpPreview;
112cdf0e10cSrcweir     GalleryToolBox      maViewBox;
113cdf0e10cSrcweir     FixedLine           maSeparator;
114cdf0e10cSrcweir 	FixedText			maInfoBar;
115cdf0e10cSrcweir 	Point				maDragStartPos;
116cdf0e10cSrcweir 	sal_uIntPtr				mnCurActionPos;
117cdf0e10cSrcweir     GalleryBrowserMode  meMode;
118cdf0e10cSrcweir     GalleryBrowserMode  meLastMode;
119cdf0e10cSrcweir 	sal_Bool				mbCurActionIsLinkage;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     void                InitSettings();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	void				ImplUpdateViews( sal_uInt16 nSelectionId );
124cdf0e10cSrcweir 	void				ImplUpdateInfoBar();
125cdf0e10cSrcweir     sal_uIntPtr               ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
126cdf0e10cSrcweir     void                ImplSelectItemId( sal_uIntPtr nItemId );
127cdf0e10cSrcweir     void                ImplExecute( sal_uInt16 nId );
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 	// Control
130cdf0e10cSrcweir 	virtual void		Resize();
131cdf0e10cSrcweir     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	// SfxListener
134cdf0e10cSrcweir 	virtual void		Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 						DECL_LINK( MenuSelectHdl, Menu* pMenu );
137cdf0e10cSrcweir 						DECL_LINK( SelectObjectHdl, void* );
138cdf0e10cSrcweir 						DECL_LINK( SelectTbxHdl, ToolBox* );
139cdf0e10cSrcweir 						DECL_LINK( MiscHdl, void* );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir private:
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     static GalleryBrowserMode meInitMode;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir public:
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 	static String		GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags );
148cdf0e10cSrcweir 
149cdf0e10cSrcweir public:
150cdf0e10cSrcweir 
151cdf0e10cSrcweir 						GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
152cdf0e10cSrcweir 						~GalleryBrowser2();
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 	void				SelectTheme( const String& rThemeName );
155cdf0e10cSrcweir 
156cdf0e10cSrcweir     GalleryBrowserMode  GetMode() const { return meMode; }
157cdf0e10cSrcweir     void                SetMode( GalleryBrowserMode eMode );
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     Window*             GetViewWindow() const;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir     void                Travel( GalleryBrowserTravel eTravel );
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	INetURLObject		GetURL() const;
164cdf0e10cSrcweir 	String				GetFilterName() const;
165cdf0e10cSrcweir 	Graphic				GetGraphic() const;
166cdf0e10cSrcweir 	sal_Bool				GetVCDrawModel( FmFormModel& rModel ) const;
167cdf0e10cSrcweir 	sal_Bool				IsLinkage() const;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	sal_Int8			AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& rEvt );
170cdf0e10cSrcweir 	sal_Int8			ExecuteDrop( DropTargetHelper& rTarget, const ExecuteDropEvent& rEvt );
171cdf0e10cSrcweir     void                StartDrag( Window* pWindow, const Point* pDragPoint = NULL );
172cdf0e10cSrcweir     void                TogglePreview( Window* pWindow, const Point* pPreviewPoint = NULL );
173cdf0e10cSrcweir     void                ShowContextMenu( Window* pWindow, const Point* pContextPoint = NULL );
174cdf0e10cSrcweir     sal_Bool                KeyInput( const KeyEvent& rEvt, Window* pWindow );
175cdf0e10cSrcweir };
176cdf0e10cSrcweir 
177cdf0e10cSrcweir #endif
178