LibreOffice Module svx (master) 1
galbrws2.hxx
Go to the documentation of this file.
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 INCLUDED_SVX_INC_GALBRWS2_HXX
21#define INCLUDED_SVX_INC_GALBRWS2_HXX
22
23#include <vcl/transfer.hxx>
24#include <svl/lstner.hxx>
25#include <svx/galctrl.hxx>
26
27#include <com/sun/star/frame/XDispatch.hpp>
28#include <com/sun/star/frame/XFrame.hpp>
29#include <com/sun/star/uno/XComponentContext.hpp>
30#include <com/sun/star/util/XURLTransformer.hpp>
31
32
34{
39};
40
41
43{
45};
46
47enum class GalleryItemFlags {
48 Title = 0x0002,
49 Path = 0x0004
50};
51namespace o3tl
52{
53 template<> struct typed_flags<GalleryItemFlags> : is_typed_flags<GalleryItemFlags, 0x0006> {};
54}
55
56
57class Gallery;
58class GalleryDragDrop;
59class GalleryTheme;
60class GalleryIconView;
61class GalleryListView;
62class GalleryPreview;
64class Menu;
65class SgaObject;
66struct DispatchInfo;
67
68namespace svx::sidebar { class GalleryControl; }
69
70class GalleryBrowser2 final : public SfxListener
71{
72 friend class GalleryBrowser;
74
75private:
76
79 std::unique_ptr<GalleryIconView> mxIconView;
80 std::unique_ptr<weld::CustomWeld> mxIconViewWin;
81 std::unique_ptr<weld::TreeView> mxListView;
82 std::unique_ptr<GalleryDragDrop> mxDragDropTargetHelper;
83 std::unique_ptr<GalleryPreview> mxPreview;
84 std::unique_ptr<weld::CustomWeld> mxPreviewWin;
85 std::unique_ptr<weld::ToggleButton> mxIconButton;
86 std::unique_ptr<weld::ToggleButton> mxListButton;
87 std::unique_ptr<weld::Label> mxInfoBar;
90 sal_uInt32 mnCurActionPos;
93
94 css::uno::Reference< css::uno::XComponentContext > m_xContext;
95 css::uno::Reference< css::util::XURLTransformer > m_xTransformer;
96
97 void ImplUpdateViews( sal_uInt16 nSelectionId );
98 void ImplUpdateInfoBar();
99 sal_uInt32 ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
100 void ImplSelectItemId(sal_uInt32 nItemId);
101 void ImplUpdateSelection();
102 void UpdateRows(bool bVisibleOnly);
103
104 // SfxListener
105 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
106
107 DECL_LINK( SelectObjectHdl, weld::TreeView&, void );
108 DECL_LINK( SelectObjectValueSetHdl, ValueSet*, void );
109 DECL_LINK( SelectTbxHdl, weld::Toggleable&, void );
110 DECL_LINK( PopupMenuHdl, const CommandEvent&, bool );
111 DECL_LINK( KeyInputHdl, const KeyEvent&, bool );
112 DECL_LINK( RowActivatedHdl, weld::TreeView&, bool );
113 DECL_LINK( DragBeginHdl, bool&, bool );
114 DECL_LINK( VisRowsScrolledHdl, weld::TreeView&, void );
115 DECL_LINK( SizeAllocHdl, const Size&, void );
116
117private:
118
120
121public:
122
123 static OUString GetItemText( const SgaObject& rObj, GalleryItemFlags nItemTextFlags );
124
125public:
126
127 GalleryBrowser2(weld::Builder& rBuilder, Gallery* pGallery);
129
130 void SelectTheme( std::u16string_view rThemeName );
131
133 void SetMode( GalleryBrowserMode eMode );
134
136
137 void Travel( GalleryBrowserTravel eTravel );
138
139 INetURLObject GetURL() const;
140 OUString GetFilterName() const;
141
142 sal_Int8 AcceptDrop( const DropTargetHelper& rTarget );
144 bool StartDrag();
145 void TogglePreview();
146 void ShowContextMenu(const CommandEvent& rCEvt);
147 bool KeyInput(const KeyEvent& rEvt);
148 bool ViewBoxHasFocus() const;
149
150 static css::uno::Reference< css::frame::XFrame > GetFrame();
151 const css::uno::Reference< css::util::XURLTransformer >& GetURLTransformer() const { return m_xTransformer; }
152
153 void Execute(std::string_view rIdent);
154 void DispatchAdd(const css::uno::Reference<css::frame::XDispatch> &rxDispatch,
155 const css::util::URL &rURL);
156
157 DECL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, void*, void );
158};
159
161{
162private:
164
165 virtual sal_Int8 AcceptDrop(const AcceptDropEvent& /*rEvt*/) override
166 {
167 return m_pParent->AcceptDrop(*this);
168 }
169
170 virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override
171 {
172 return m_pParent->ExecuteDrop(rEvt);
173 }
174
175public:
176 GalleryDragDrop(GalleryBrowser2* pParent, const css::uno::Reference<css::datatransfer::dnd::XDropTarget>& rDropTarget)
177 : DropTargetHelper(rDropTarget)
178 , m_pParent(pParent)
179 {
180 }
181};
182
183#endif
184
185/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString GetFilterName() const
Definition: galbrws2.cxx:1201
Size maPreviewSize
Definition: galbrws2.hxx:88
const css::uno::Reference< css::util::XURLTransformer > & GetURLTransformer() const
Definition: galbrws2.hxx:151
sal_Int8 AcceptDrop(const DropTargetHelper &rTarget)
Definition: galbrws2.cxx:426
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: galbrws2.hxx:94
friend class svx::sidebar::GalleryControl
Definition: galbrws2.hxx:73
void Travel(GalleryBrowserTravel eTravel)
Definition: galbrws2.cxx:726
static css::uno::Reference< css::frame::XFrame > GetFrame()
Definition: galbrws2.cxx:989
void ShowContextMenu(const CommandEvent &rCEvt)
Definition: galbrws2.cxx:489
static GalleryBrowserMode meInitMode
Definition: galbrws2.hxx:119
void TogglePreview()
Definition: galbrws2.cxx:483
std::unique_ptr< weld::CustomWeld > mxIconViewWin
Definition: galbrws2.hxx:80
DECL_LINK(PopupMenuHdl, const CommandEvent &, bool)
DECL_STATIC_LINK(GalleryBrowser2, AsyncDispatch_Impl, void *, void)
sal_uInt32 mnCurActionPos
Definition: galbrws2.hxx:90
Gallery * mpGallery
Definition: galbrws2.hxx:77
std::unique_ptr< weld::Label > mxInfoBar
Definition: galbrws2.hxx:87
DECL_LINK(RowActivatedHdl, weld::TreeView &, bool)
GalleryTheme * mpCurTheme
Definition: galbrws2.hxx:78
void UpdateRows(bool bVisibleOnly)
Definition: galbrws2.cxx:824
DECL_LINK(VisRowsScrolledHdl, weld::TreeView &, void)
void ImplUpdateSelection()
Definition: galbrws2.cxx:914
DECL_LINK(KeyInputHdl, const KeyEvent &, bool)
DECL_LINK(SelectObjectValueSetHdl, ValueSet *, void)
DECL_LINK(SizeAllocHdl, const Size &, void)
void SelectTheme(std::u16string_view rThemeName)
Definition: galbrws2.cxx:600
DECL_LINK(SelectTbxHdl, weld::Toggleable &, void)
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
Definition: galbrws2.cxx:451
GalleryBrowser2(weld::Builder &rBuilder, Gallery *pGallery)
Definition: galbrws2.cxx:333
bool ViewBoxHasFocus() const
Definition: galbrws2.cxx:516
rtl::Reference< GalleryTransferable > m_xHelper
Definition: galbrws2.hxx:89
void ImplSelectItemId(sal_uInt32 nItemId)
Definition: galbrws2.cxx:978
DECL_LINK(SelectObjectHdl, weld::TreeView &, void)
void ImplUpdateViews(sal_uInt16 nSelectionId)
Definition: galbrws2.cxx:775
std::unique_ptr< weld::TreeView > mxListView
Definition: galbrws2.hxx:81
weld::Widget * GetViewWindow() const
Definition: galbrws2.cxx:709
std::unique_ptr< weld::ToggleButton > mxListButton
Definition: galbrws2.hxx:86
void DispatchAdd(const css::uno::Reference< css::frame::XDispatch > &rxDispatch, const css::util::URL &rURL)
Definition: galbrws2.cxx:1002
bool StartDrag()
Definition: galbrws2.cxx:470
void ImplUpdateInfoBar()
Definition: galbrws2.cxx:907
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: galbrws2.cxx:406
void SetMode(GalleryBrowserMode eMode)
Definition: galbrws2.cxx:628
friend class GalleryBrowser
Definition: galbrws2.hxx:72
bool KeyInput(const KeyEvent &rEvt)
Definition: galbrws2.cxx:521
css::uno::Reference< css::util::XURLTransformer > m_xTransformer
Definition: galbrws2.hxx:95
static OUString GetItemText(const SgaObject &rObj, GalleryItemFlags nItemTextFlags)
Definition: galbrws2.cxx:1153
sal_uInt32 ImplGetSelectedItemId(const Point *pSelPosPixel, Point &rSelPos)
Definition: galbrws2.cxx:922
DECL_LINK(DragBeginHdl, bool &, bool)
INetURLObject GetURL() const
Definition: galbrws2.cxx:1191
std::unique_ptr< GalleryPreview > mxPreview
Definition: galbrws2.hxx:83
std::unique_ptr< weld::ToggleButton > mxIconButton
Definition: galbrws2.hxx:85
std::unique_ptr< GalleryDragDrop > mxDragDropTargetHelper
Definition: galbrws2.hxx:82
void Execute(std::string_view rIdent)
Definition: galbrws2.cxx:1089
GalleryBrowserMode GetMode() const
Definition: galbrws2.hxx:132
GalleryBrowserMode meMode
Definition: galbrws2.hxx:91
GalleryBrowserMode meLastMode
Definition: galbrws2.hxx:92
std::unique_ptr< weld::CustomWeld > mxPreviewWin
Definition: galbrws2.hxx:84
std::unique_ptr< GalleryIconView > mxIconView
Definition: galbrws2.hxx:79
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
Definition: galbrws2.hxx:170
GalleryDragDrop(GalleryBrowser2 *pParent, const css::uno::Reference< css::datatransfer::dnd::XDropTarget > &rDropTarget)
Definition: galbrws2.hxx:176
GalleryBrowser2 * m_pParent
Definition: galbrws2.hxx:163
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &) override
Definition: galbrws2.hxx:165
GalleryItemFlags
Definition: galbrws2.hxx:47
GalleryBrowserTravel
Definition: galbrws2.hxx:43
GalleryBrowserMode
Definition: galbrws2.hxx:34
@ GALLERYBROWSERMODE_PREVIEW
Definition: galbrws2.hxx:38
@ GALLERYBROWSERMODE_NONE
Definition: galbrws2.hxx:35
@ GALLERYBROWSERMODE_ICON
Definition: galbrws2.hxx:36
@ GALLERYBROWSERMODE_LIST
Definition: galbrws2.hxx:37
Title
signed char sal_Int8