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/.
10 #include "uiobject.hxx"
11 #include <sfx2/sidebar/SidebarController.hxx>
13 namespace sfx2::sidebar
15 TabBarUIObject::TabBarUIObject(const VclPtr
<TabBar
>& xTabBar
)
16 : WindowUIObject(xTabBar
)
21 StringMap
TabBarUIObject::get_state()
23 StringMap aMap
= WindowUIObject::get_state();
24 OUString rsHighlightedTabsIds
;
25 for (auto const& item
: mxTabBar
->maItems
)
27 if (item
->mxButton
->get_item_active("toggle"))
29 if (!rsHighlightedTabsIds
.isEmpty())
30 rsHighlightedTabsIds
+= ",";
31 rsHighlightedTabsIds
+= item
->msDeckId
;
34 aMap
["HighlightedTabsIds"] = rsHighlightedTabsIds
;
38 void TabBarUIObject::execute(const OUString
& rAction
, const StringMap
& rParameters
)
40 if (rAction
== "CLICK")
42 if (rParameters
.find("POS") != rParameters
.end())
43 mxTabBar
->pParentSidebarController
->OpenThenToggleDeck(
44 mxTabBar
->GetDeckIdForIndex(rParameters
.find("POS")->second
.toInt32()));
47 WindowUIObject::execute(rAction
, rParameters
);
50 std::unique_ptr
<UIObject
> TabBarUIObject::create(vcl::Window
* pWindow
)
52 TabBar
* pTabBar
= dynamic_cast<TabBar
*>(pWindow
);
54 return std::unique_ptr
<UIObject
>(new TabBarUIObject(pTabBar
));
57 OUString
TabBarUIObject::get_name() const { return "TabBarUIObject"; }
59 } // namespace sidebar
61 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */