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