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