LibreOffice Module sfx2 (master) 1
uiobject.cxx
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
10#include "uiobject.hxx"
12
13namespace sfx2::sidebar
14{
16 : WindowUIObject(xTabBar)
17 , mxTabBar(xTabBar)
18{
19}
20
22{
24 OUString rsHighlightedTabsIds;
25 for (auto const& item : mxTabBar->maItems)
26 {
27 if (item->mxButton->get_item_active("toggle"))
28 {
29 if (!rsHighlightedTabsIds.isEmpty())
30 rsHighlightedTabsIds += ",";
31 rsHighlightedTabsIds += item->msDeckId;
32 }
33 }
34 aMap["HighlightedTabsIds"] = rsHighlightedTabsIds;
35 return aMap;
36}
37
38void TabBarUIObject::execute(const OUString& rAction, const StringMap& rParameters)
39{
40 if (rAction == "CLICK")
41 {
42 if (rParameters.find("POS") != rParameters.end())
43 mxTabBar->pParentSidebarController->OpenThenToggleDeck(
44 mxTabBar->GetDeckIdForIndex(rParameters.find("POS")->second.toInt32()));
45 }
46 else
47 WindowUIObject::execute(rAction, rParameters);
48}
49
50std::unique_ptr<UIObject> TabBarUIObject::create(vcl::Window* pWindow)
51{
52 TabBar* pTabBar = dynamic_cast<TabBar*>(pWindow);
53 assert(pTabBar);
54 return std::unique_ptr<UIObject>(new TabBarUIObject(pTabBar));
55}
56
57OUString TabBarUIObject::get_name() const { return "TabBarUIObject"; }
58
59} // namespace sidebar
60
61/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual StringMap get_state() override
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
TabBarUIObject(const VclPtr< TabBar > &xTabBar)
Definition: uiobject.cxx:15
virtual OUString get_name() const override
Definition: uiobject.cxx:57
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
Definition: uiobject.cxx:50
virtual void execute(const OUString &rAction, const StringMap &rParameters) override
Definition: uiobject.cxx:38
VclPtr< sfx2::sidebar::TabBar > mxTabBar
Definition: uiobject.hxx:17
virtual StringMap get_state() override
Definition: uiobject.cxx:21
The tab bar is the container for the individual tabs.
Definition: TabBar.hxx:41
HashMap_OWString_Interface aMap
std::map< OUString, OUString > StringMap