Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / svx / inc / galbrws2.hxx
blobb71de0299855ce5cb7dd9d41f117d465fdbfaa05
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SVX_INC_GALBRWS2_HXX
21 #define INCLUDED_SVX_INC_GALBRWS2_HXX
23 #include <vcl/button.hxx>
24 #include <vcl/fixed.hxx>
25 #include <vcl/timer.hxx>
26 #include <vcl/toolbox.hxx>
27 #include <vcl/transfer.hxx>
28 #include <svl/lstner.hxx>
29 #include <svx/galctrl.hxx>
30 #include <svtools/miscopt.hxx>
32 #include <com/sun/star/frame/XDispatch.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <com/sun/star/util/XURLTransformer.hpp>
37 enum GalleryBrowserMode
39 GALLERYBROWSERMODE_NONE = 0,
40 GALLERYBROWSERMODE_ICON = 1,
41 GALLERYBROWSERMODE_LIST = 2,
42 GALLERYBROWSERMODE_PREVIEW = 3
46 enum class GalleryBrowserTravel
48 First, Last, Previous, Next
51 enum class GalleryItemFlags {
52 Title = 0x0002,
53 Path = 0x0004
55 namespace o3tl
57 template<> struct typed_flags<GalleryItemFlags> : is_typed_flags<GalleryItemFlags, 0x0006> {};
61 class GalleryToolBox : public ToolBox
63 private:
65 virtual void KeyInput( const KeyEvent& rKEvt ) override;
67 public:
69 GalleryToolBox( GalleryBrowser2* pParent );
73 class Gallery;
74 class GalleryTheme;
75 class GalleryIconView;
76 class GalleryListView;
77 class GalleryPreview;
78 class Menu;
79 class SgaObject;
80 struct DispatchInfo;
82 namespace svx { namespace sidebar { class GalleryControl; } }
84 class GalleryBrowser2 : public Control, public SfxListener
86 friend class GalleryBrowser;
87 friend class svx::sidebar::GalleryControl;
88 using Window::KeyInput;
90 private:
92 SvtMiscOptions maMiscOptions;
93 Gallery* mpGallery;
94 GalleryTheme* mpCurTheme;
95 VclPtr<GalleryIconView> mpIconView;
96 VclPtr<GalleryListView> mpListView;
97 VclPtr<GalleryPreview> mpPreview;
98 VclPtr<GalleryToolBox> maViewBox;
99 VclPtr<FixedLine> maSeparator;
100 VclPtr<FixedText> maInfoBar;
101 sal_uInt32 mnCurActionPos;
102 GalleryBrowserMode meMode;
103 GalleryBrowserMode meLastMode;
105 css::uno::Reference< css::uno::XComponentContext > m_xContext;
106 css::uno::Reference< css::util::XURLTransformer > m_xTransformer;
108 void InitSettings();
110 void ImplUpdateViews( sal_uInt16 nSelectionId );
111 void ImplUpdateInfoBar();
112 sal_uInt32 ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
113 void ImplSelectItemId(sal_uInt32 nItemId);
115 // Control
116 virtual void Resize() override;
117 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
119 // SfxListener
120 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
122 DECL_LINK( SelectObjectHdl, GalleryListView*, void );
123 DECL_LINK( SelectObjectValueSetHdl, ValueSet*, void );
124 DECL_LINK( SelectTbxHdl, ToolBox*, void );
125 DECL_LINK( MiscHdl, LinkParamNone*, void );
127 private:
129 static GalleryBrowserMode meInitMode;
131 public:
133 static OUString GetItemText( const SgaObject& rObj, GalleryItemFlags nItemTextFlags );
135 public:
137 GalleryBrowser2(vcl::Window* pParent, Gallery* pGallery);
138 virtual ~GalleryBrowser2() override;
139 virtual void dispose() override;
141 void SelectTheme( const OUString& rThemeName );
143 GalleryBrowserMode GetMode() const { return meMode; }
144 void SetMode( GalleryBrowserMode eMode );
146 vcl::Window* GetViewWindow() const;
148 void Travel( GalleryBrowserTravel eTravel );
150 INetURLObject GetURL() const;
151 OUString GetFilterName() const;
153 sal_Int8 AcceptDrop( DropTargetHelper& rTarget );
154 sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
155 void StartDrag( const Point* pDragPoint = nullptr );
156 void TogglePreview();
157 void ShowContextMenu( const Point* pContextPoint );
158 bool KeyInput( const KeyEvent& rEvt, vcl::Window* pWindow );
160 static css::uno::Reference< css::frame::XFrame > GetFrame();
161 const css::uno::Reference< css::util::XURLTransformer >& GetURLTransformer() const { return m_xTransformer; }
163 void Execute(const OString &rIdent);
164 void DispatchAdd(const css::uno::Reference<css::frame::XDispatch> &rxDispatch,
165 const css::util::URL &rURL);
167 DECL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, void*, void );
170 #endif
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */