1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SVX_GALBRWS2_HXX_
21 #define _SVX_GALBRWS2_HXX_
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"
33 // ----------------------
34 // - GalleryBrowserMode -
35 // ----------------------
37 enum GalleryBrowserMode
39 GALLERYBROWSERMODE_NONE
= 0,
40 GALLERYBROWSERMODE_ICON
= 1,
41 GALLERYBROWSERMODE_LIST
= 2,
42 GALLERYBROWSERMODE_PREVIEW
= 3
49 enum GalleryBrowserTravel
51 GALLERYBROWSERTRAVEL_CURRENT
= 0,
52 GALLERYBROWSERTRAVEL_FIRST
= 1,
53 GALLERYBROWSERTRAVEL_LAST
= 2,
54 GALLERYBROWSERTRAVEL_PREVIOUS
= 3,
55 GALLERYBROWSERTRAVEL_NEXT
= 4
58 // ------------------------
59 // - GalleryItemTextFlags -
60 // ------------------------
62 #define GALLERY_ITEM_THEMENAME 0x00000001
63 #define GALLERY_ITEM_TITLE 0x00000002
64 #define GALLERY_ITEM_PATH 0x00000004
70 class GalleryToolBox
: public ToolBox
74 virtual void KeyInput( const KeyEvent
& rKEvt
);
78 GalleryToolBox( GalleryBrowser2
* pParent
);
82 // -------------------
83 // - GalleryBrowser2 -
84 // -------------------
88 class GalleryIconView
;
89 class GalleryListView
;
94 namespace svx
{ namespace sidebar
{ class GalleryControl
; } }
96 class GalleryBrowser2
: public Control
, public SfxListener
98 friend class GalleryBrowser
;
99 friend class svx::sidebar::GalleryControl
;
100 using Control::Notify
;
101 using Window::KeyInput
;
105 SvtMiscOptions maMiscOptions
;
107 GalleryTheme
* mpCurTheme
;
108 GalleryIconView
* mpIconView
;
109 GalleryListView
* mpListView
;
110 GalleryPreview
* mpPreview
;
111 GalleryToolBox maViewBox
;
112 FixedLine maSeparator
;
114 Point maDragStartPos
;
115 sal_uIntPtr mnCurActionPos
;
116 GalleryBrowserMode meMode
;
117 GalleryBrowserMode meLastMode
;
118 sal_Bool mbCurActionIsLinkage
;
122 void ImplUpdateViews( sal_uInt16 nSelectionId
);
123 void ImplUpdateInfoBar();
124 sal_uIntPtr
ImplGetSelectedItemId( const Point
* pSelPosPixel
, Point
& rSelPos
);
125 void ImplSelectItemId( sal_uIntPtr nItemId
);
126 void ImplExecute( sal_uInt16 nId
);
129 virtual void Resize();
130 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
133 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
135 DECL_LINK( MenuSelectHdl
, Menu
* pMenu
);
136 DECL_LINK( SelectObjectHdl
, void* );
137 DECL_LINK( SelectTbxHdl
, ToolBox
* );
138 DECL_LINK( MiscHdl
, void* );
142 static GalleryBrowserMode meInitMode
;
146 static String
GetItemText( const GalleryTheme
& rTheme
, const SgaObject
& rObj
, sal_uIntPtr nItemTextFlags
);
150 GalleryBrowser2( Window
* pParent
, const ResId
& rResId
, Gallery
* pGallery
);
153 void SelectTheme( const String
& rThemeName
);
155 GalleryBrowserMode
GetMode() const { return meMode
; }
156 void SetMode( GalleryBrowserMode eMode
);
158 Window
* GetViewWindow() const;
160 void Travel( GalleryBrowserTravel eTravel
);
162 INetURLObject
GetURL() const;
163 String
GetFilterName() const;
164 Graphic
GetGraphic() const;
165 sal_Bool
IsLinkage() const;
167 sal_Int8
AcceptDrop( DropTargetHelper
& rTarget
, const AcceptDropEvent
& rEvt
);
168 sal_Int8
ExecuteDrop( DropTargetHelper
& rTarget
, const ExecuteDropEvent
& rEvt
);
169 void StartDrag( Window
* pWindow
, const Point
* pDragPoint
= NULL
);
170 void TogglePreview( Window
* pWindow
, const Point
* pPreviewPoint
= NULL
);
171 void ShowContextMenu( Window
* pWindow
, const Point
* pContextPoint
= NULL
);
172 sal_Bool
KeyInput( const KeyEvent
& rEvt
, Window
* pWindow
);
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */