LibreOffice Module sd (master) 1
CustomAnimationList.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#pragma once
21
22#include <sal/config.h>
23
24#include <memory>
25
26#include <vcl/transfer.hxx>
27#include <vcl/weld.hxx>
29
30namespace com::sun::star::drawing { class XShape; }
31
32struct ImplSVEvent;
33
34namespace sd {
35
36typedef std::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr;
37
39{
40public:
41 virtual void onSelect() = 0;
42 virtual void onDoubleClick() = 0;
43 virtual void onContextMenu(const OUString &rIdent) = 0;
44 virtual void onDragNDropComplete( std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore ) = 0;
46};
47
48class CustomAnimationList;
49class CustomAnimationListEntryItem;
50
51class CustomAnimationListDropTarget : public DropTargetHelper
52{
53private:
55
56 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
57 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
58
59public:
61};
62
64{
67
68public:
69 explicit CustomAnimationList(std::unique_ptr<weld::TreeView> xTreeView,
70 std::unique_ptr<weld::Label> xLabel,
71 std::unique_ptr<weld::Widget> xScrolledWindow);
72 virtual ~CustomAnimationList();
73
74 // methods
75
78 void select( const CustomAnimationEffectPtr& pEffect );
79
81 void update( const MainSequencePtr& pMainSequence );
82
83 void update();
84
86
87 // events
88 void onSelectionChanged(const css::uno::Any& rSelection);
89
90 void Select();
91
92 virtual void notify_change() override;
93
94 bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const;
95 bool isVisible( const CustomAnimationEffectPtr& pEffect ) const;
96
97 // clears all entries from the listbox
98 void clear();
99
101 {
102 mpController = pController;
103 };
104
107
108 void set_sensitive(bool bSensitive) { mxTreeView->set_sensitive(bSensitive); }
109 int get_height_rows(int nRows) { return mxTreeView->get_height_rows(nRows); }
110 int get_approximate_digit_width() const { return mxTreeView->get_approximate_digit_width(); }
111 void set_size_request(int nWidth, int nHeight)
112 {
113 mxTreeView->set_size_request(nWidth, nHeight);
114 mxEmptyLabel->set_size_request(nWidth, nHeight);
115 }
116 void unselect_all() { mxTreeView->unselect_all(); }
118
119 DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
120 DECL_LINK(ExpandHdl, const weld::TreeIter&, bool);
121 DECL_LINK(PostExpandHdl, void*, void);
122 DECL_LINK(CollapseHdl, const weld::TreeIter&, bool);
123 DECL_LINK(PostCollapseHdl, void*, void);
124
125private:
126 std::unique_ptr<weld::TreeView> mxTreeView;
128 std::unique_ptr<weld::Label> mxEmptyLabel;
129 std::unique_ptr<weld::Widget> mxEmptyLabelParent;
130 std::vector<std::unique_ptr<CustomAnimationListEntryItem>> mxEntries;
131 std::vector<std::unique_ptr<weld::TreeIter>> lastSelectedEntries;
132
134
135 DECL_LINK(SelectHdl, weld::TreeView&, void);
136 DECL_LINK(CommandHdl, const CommandEvent&, bool);
137 DECL_LINK(DoubleClickHdl, weld::TreeView&, bool);
138 DECL_LINK(DragBeginHdl, bool&, bool);
141
142 void ExecuteContextMenuAction(const OUString& rSelectedPopupEntry);
143
145 void append( CustomAnimationEffectPtr pEffect );
146
148
150
151 css::uno::Reference< css::drawing::XShape > mxLastTargetShape;
152 sal_Int32 mnLastGroupId;
155
156 std::unique_ptr<weld::TreeIter> mxLastParentEntry;
157
158 // drag & drop
159 std::unique_ptr<weld::TreeIter> mxDndEffectDragging;
160 std::vector<std::unique_ptr<weld::TreeIter>> mDndEffectsSelected;
161};
162
163OUString getPropertyName( sal_Int32 nPropertyType );
164
165OUString getShapeDescription( const css::uno::Reference< css::drawing::XShape >& xShape, bool bWithText );
166
167}
168
169/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CustomAnimationListDropTarget(CustomAnimationList &rTreeView)
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
virtual void notify_change() override
void onSelectionChanged(const css::uno::Any &rSelection)
std::vector< std::unique_ptr< weld::TreeIter > > lastSelectedEntries
DECL_LINK(PostCollapseHdl, void *, void)
void select(const CustomAnimationEffectPtr &pEffect)
selects or deselects the given effect.
std::vector< std::unique_ptr< weld::TreeIter > > mDndEffectsSelected
void ExecuteContextMenuAction(const OUString &rSelectedPopupEntry)
DECL_LINK(CollapseHdl, const weld::TreeIter &, bool)
bool isVisible(const CustomAnimationEffectPtr &pEffect) const
void set_size_request(int nWidth, int nHeight)
DECL_LINK(DoubleClickHdl, weld::TreeView &, bool)
std::unique_ptr< weld::Label > mxEmptyLabel
DECL_LINK(CommandHdl, const CommandEvent &, bool)
sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
std::unique_ptr< weld::TreeView > mxTreeView
DECL_LINK(DragBeginHdl, bool &, bool)
DECL_STATIC_LINK(CustomAnimationList, CustomGetSizeHdl, weld::TreeView::get_size_args, Size)
std::vector< std::unique_ptr< CustomAnimationListEntryItem > > mxEntries
CustomAnimationListDropTarget maDropTargetHelper
CustomAnimationList(std::unique_ptr< weld::TreeView > xTreeView, std::unique_ptr< weld::Label > xLabel, std::unique_ptr< weld::Widget > xScrolledWindow)
DECL_LINK(KeyInputHdl, const KeyEvent &, bool)
bool isExpanded(const CustomAnimationEffectPtr &pEffect) const
std::unique_ptr< weld::TreeIter > mxLastParentEntry
DECL_LINK(SelectHdl, weld::TreeView &, void)
DECL_LINK(ExpandHdl, const weld::TreeIter &, bool)
void append(CustomAnimationEffectPtr pEffect)
appends the given effect to the list
DECL_STATIC_LINK(CustomAnimationList, CustomRenderHdl, weld::TreeView::render_args, void)
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
EffectSequence getSelection() const
std::unique_ptr< weld::TreeIter > mxDndEffectDragging
ICustomAnimationListController * mpController
void setController(ICustomAnimationListController *pController)
DECL_LINK(PostExpandHdl, void *, void)
css::uno::Reference< css::drawing::XShape > mxLastTargetShape
void set_sensitive(bool bSensitive)
std::unique_ptr< weld::Widget > mxEmptyLabelParent
virtual void onContextMenu(const OUString &rIdent)=0
virtual void onDragNDropComplete(std::vector< CustomAnimationEffectPtr > pEffectsDragged, CustomAnimationEffectPtr pEffectInsertBefore)=0
this listener is implemented by UI components to track changes in the animation core
std::tuple< vcl::RenderContext &, const tools::Rectangle &, bool, const OUString & > render_args
std::pair< vcl::RenderContext &, const OUString & > get_size_args
std::list< CustomAnimationEffectPtr > EffectSequence
std::shared_ptr< MainSequence > MainSequencePtr
OUString getShapeDescription(const Reference< XShape > &xShape, bool bWithText)
OUString getPropertyName(sal_Int32 nPropertyType)
std::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr
signed char sal_Int8