xref: /trunk/main/sfx2/source/sidebar/TabBar.cxx (revision 549760eabef7046a021eb562805aa3542b2e9b62)
122de8995SAndre Fischer /**************************************************************
222de8995SAndre Fischer  *
322de8995SAndre Fischer  * Licensed to the Apache Software Foundation (ASF) under one
422de8995SAndre Fischer  * or more contributor license agreements.  See the NOTICE file
522de8995SAndre Fischer  * distributed with this work for additional information
622de8995SAndre Fischer  * regarding copyright ownership.  The ASF licenses this file
722de8995SAndre Fischer  * to you under the Apache License, Version 2.0 (the
822de8995SAndre Fischer  * "License"); you may not use this file except in compliance
922de8995SAndre Fischer  * with the License.  You may obtain a copy of the License at
1022de8995SAndre Fischer  *
1122de8995SAndre Fischer  *   http://www.apache.org/licenses/LICENSE-2.0
1222de8995SAndre Fischer  *
1322de8995SAndre Fischer  * Unless required by applicable law or agreed to in writing,
1422de8995SAndre Fischer  * software distributed under the License is distributed on an
1522de8995SAndre Fischer  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1622de8995SAndre Fischer  * KIND, either express or implied.  See the License for the
1722de8995SAndre Fischer  * specific language governing permissions and limitations
1822de8995SAndre Fischer  * under the License.
1922de8995SAndre Fischer  *
2022de8995SAndre Fischer  *************************************************************/
2122de8995SAndre Fischer 
2222de8995SAndre Fischer #include "precompiled_sfx2.hxx"
2322de8995SAndre Fischer 
2422de8995SAndre Fischer #include "TabBar.hxx"
25ff12d537SAndre Fischer #include "TabItem.hxx"
2695a18594SAndre Fischer #include "sidebar/ControlFactory.hxx"
27ff12d537SAndre Fischer #include "DeckDescriptor.hxx"
28ff12d537SAndre Fischer #include "Paint.hxx"
29b9e67834SAndre Fischer #include "sfx2/sidebar/Theme.hxx"
30f35c6d02SAndre Fischer #include "sfx2/sidebar/Tools.hxx"
3165908a7eSAndre Fischer #include "FocusManager.hxx"
32ff12d537SAndre Fischer 
3322de8995SAndre Fischer #include <vcl/gradient.hxx>
34ff12d537SAndre Fischer #include <vcl/image.hxx>
357a32b0c8SAndre Fischer #include <vcl/wrkwin.hxx>
36ff12d537SAndre Fischer #include <comphelper/processfactory.hxx>
37ff12d537SAndre Fischer #include <comphelper/componentcontext.hxx>
3895a18594SAndre Fischer #include <tools/svborder.hxx>
39ff12d537SAndre Fischer 
40ff12d537SAndre Fischer #include <com/sun/star/graphic/XGraphicProvider.hpp>
4122de8995SAndre Fischer 
42ff12d537SAndre Fischer using namespace ::com::sun::star;
43ff12d537SAndre Fischer using namespace ::com::sun::star::uno;
4422de8995SAndre Fischer 
45ff12d537SAndre Fischer namespace sfx2 { namespace sidebar {
46ff12d537SAndre Fischer 
TabBar(Window * pParentWindow,const Reference<frame::XFrame> & rxFrame,const::boost::function<void (const::rtl::OUString &)> & rDeckActivationFunctor,const PopupMenuProvider & rPopupMenuProvider)47ff12d537SAndre Fischer TabBar::TabBar (
48ff12d537SAndre Fischer     Window* pParentWindow,
49ff12d537SAndre Fischer     const Reference<frame::XFrame>& rxFrame,
5095a18594SAndre Fischer     const ::boost::function<void(const ::rtl::OUString&)>& rDeckActivationFunctor,
5195a18594SAndre Fischer     const PopupMenuProvider& rPopupMenuProvider)
5265908a7eSAndre Fischer     : Window(pParentWindow, WB_DIALOGCONTROL),
53ff12d537SAndre Fischer       mxFrame(rxFrame),
54ff12d537SAndre Fischer       mpMenuButton(ControlFactory::CreateMenuButton(this)),
55ff12d537SAndre Fischer       maItems(),
56ff12d537SAndre Fischer       maDeckActivationFunctor(rDeckActivationFunctor),
57ff12d537SAndre Fischer       maPopupMenuProvider(rPopupMenuProvider)
5822de8995SAndre Fischer {
59b9e67834SAndre Fischer     SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
60ff12d537SAndre Fischer 
61ff12d537SAndre Fischer     mpMenuButton->SetModeImage(
627a32b0c8SAndre Fischer         Theme::GetImage(Theme::Image_TabBarMenu),
63ff12d537SAndre Fischer         Theme::IsHighContrastMode()
64ff12d537SAndre Fischer             ? BMP_COLOR_HIGHCONTRAST
65ff12d537SAndre Fischer             : BMP_COLOR_NORMAL);
66ff12d537SAndre Fischer     mpMenuButton->SetClickHdl(LINK(this, TabBar, OnToolboxClicked));
6795a18594SAndre Fischer     Layout();
687a32b0c8SAndre Fischer 
697a32b0c8SAndre Fischer #ifdef DEBUG
707a32b0c8SAndre Fischer     SetText(A2S("TabBar"));
717a32b0c8SAndre Fischer #endif
7222de8995SAndre Fischer }
7322de8995SAndre Fischer 
~TabBar(void)7422de8995SAndre Fischer TabBar::~TabBar (void)
7522de8995SAndre Fischer {
7622de8995SAndre Fischer }
7722de8995SAndre Fischer 
Paint(const Rectangle & rUpdateArea)7822de8995SAndre Fischer void TabBar::Paint (const Rectangle& rUpdateArea)
7922de8995SAndre Fischer {
80ff12d537SAndre Fischer     Window::Paint(rUpdateArea);
81ff12d537SAndre Fischer 
82b9e67834SAndre Fischer     const sal_Int32 nHorizontalPadding (Theme::GetInteger(Theme::Int_TabMenuSeparatorPadding));
83b9e67834SAndre Fischer     SetLineColor(Theme::GetColor(Theme::Color_TabMenuSeparator));
84ff12d537SAndre Fischer     DrawLine(
85ff12d537SAndre Fischer         Point(nHorizontalPadding, mnMenuSeparatorY),
86ff12d537SAndre Fischer         Point(GetSizePixel().Width()-nHorizontalPadding, mnMenuSeparatorY));
8722de8995SAndre Fischer }
8822de8995SAndre Fischer 
GetDefaultWidth(void)8922de8995SAndre Fischer sal_Int32 TabBar::GetDefaultWidth (void)
9022de8995SAndre Fischer {
91b9e67834SAndre Fischer     return Theme::GetInteger(Theme::Int_TabItemWidth)
92b9e67834SAndre Fischer         + Theme::GetInteger(Theme::Int_TabBarLeftPadding)
93b9e67834SAndre Fischer         + Theme::GetInteger(Theme::Int_TabBarRightPadding);
9422de8995SAndre Fischer }
9522de8995SAndre Fischer 
SetDecks(const ResourceManager::DeckContextDescriptorContainer & rDecks)96ff12d537SAndre Fischer void TabBar::SetDecks (
9713e1c3b4SAndre Fischer     const ResourceManager::DeckContextDescriptorContainer& rDecks)
98ff12d537SAndre Fischer {
99ff12d537SAndre Fischer     // Remove the current buttons.
100ff12d537SAndre Fischer     {
1017a32b0c8SAndre Fischer         for(ItemContainer::iterator
102ff12d537SAndre Fischer                 iItem(maItems.begin()), iEnd(maItems.end());
103ff12d537SAndre Fischer             iItem!=iEnd;
104ff12d537SAndre Fischer             ++iItem)
105ff12d537SAndre Fischer         {
1067a32b0c8SAndre Fischer             iItem->mpButton.reset();
107ff12d537SAndre Fischer         }
108ff12d537SAndre Fischer         maItems.clear();
109ff12d537SAndre Fischer     }
110ff12d537SAndre Fischer 
11113e1c3b4SAndre Fischer     maItems.resize(rDecks.size());
112ff12d537SAndre Fischer     sal_Int32 nIndex (0);
11313e1c3b4SAndre Fischer     for (ResourceManager::DeckContextDescriptorContainer::const_iterator
11413e1c3b4SAndre Fischer              iDeck(rDecks.begin()),
11513e1c3b4SAndre Fischer              iEnd(rDecks.end());
11613e1c3b4SAndre Fischer          iDeck!=iEnd;
11713e1c3b4SAndre Fischer          ++iDeck)
118ff12d537SAndre Fischer     {
11913e1c3b4SAndre Fischer         const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(iDeck->msId);
12095a18594SAndre Fischer         if (pDescriptor == NULL)
12195a18594SAndre Fischer         {
12295a18594SAndre Fischer             OSL_ASSERT(pDescriptor!=NULL);
12395a18594SAndre Fischer             continue;
12495a18594SAndre Fischer         }
12595a18594SAndre Fischer 
126ff12d537SAndre Fischer         Item& rItem (maItems[nIndex++]);
12795a18594SAndre Fischer         rItem.msDeckId = pDescriptor->msId;
1287a32b0c8SAndre Fischer         rItem.mpButton.reset(CreateTabItem(*pDescriptor));
129ff12d537SAndre Fischer         rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick));
130ff12d537SAndre Fischer         rItem.maDeckActivationFunctor = maDeckActivationFunctor;
131ff12d537SAndre Fischer         rItem.mbIsHiddenByDefault = false;
13295a18594SAndre Fischer         rItem.mbIsHidden = ! pDescriptor->mbIsEnabled;
13313e1c3b4SAndre Fischer 
13413e1c3b4SAndre Fischer         rItem.mpButton->Enable(iDeck->mbIsEnabled);
135ff12d537SAndre Fischer     }
136ff12d537SAndre Fischer 
137ff12d537SAndre Fischer     UpdateButtonIcons();
138ff12d537SAndre Fischer     Layout();
139ff12d537SAndre Fischer }
140ff12d537SAndre Fischer 
UpdateButtonIcons(void)141ff12d537SAndre Fischer void TabBar::UpdateButtonIcons (void)
142ff12d537SAndre Fischer {
143ff12d537SAndre Fischer     const BmpColorMode eColorMode (
144ff12d537SAndre Fischer         Theme::IsHighContrastMode()
145ff12d537SAndre Fischer             ? BMP_COLOR_HIGHCONTRAST
146ff12d537SAndre Fischer             : BMP_COLOR_NORMAL);
147ff12d537SAndre Fischer 
1487a32b0c8SAndre Fischer     mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu), eColorMode);
149ff12d537SAndre Fischer 
150ff12d537SAndre Fischer     for(ItemContainer::const_iterator
151ff12d537SAndre Fischer             iItem(maItems.begin()), iEnd(maItems.end());
152ff12d537SAndre Fischer         iItem!=iEnd;
153ff12d537SAndre Fischer         ++iItem)
154ff12d537SAndre Fischer     {
15595a18594SAndre Fischer         const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
15695a18594SAndre Fischer         if (pDeckDescriptor != NULL)
157ff12d537SAndre Fischer             iItem->mpButton->SetModeImage(
15895a18594SAndre Fischer                 GetItemImage(*pDeckDescriptor),
159ff12d537SAndre Fischer                 eColorMode);
160ff12d537SAndre Fischer     }
16195a18594SAndre Fischer 
16295a18594SAndre Fischer     Invalidate();
163ff12d537SAndre Fischer }
164ff12d537SAndre Fischer 
Layout(void)165ff12d537SAndre Fischer void TabBar::Layout (void)
166ff12d537SAndre Fischer {
167b9e67834SAndre Fischer     const SvBorder aPadding (
168b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_TabBarLeftPadding),
169b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_TabBarTopPadding),
170b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_TabBarRightPadding),
171b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_TabBarBottomPadding));
172ff12d537SAndre Fischer     sal_Int32 nX (aPadding.Top());
173ff12d537SAndre Fischer     sal_Int32 nY (aPadding.Left());
174b9e67834SAndre Fischer     const Size aTabItemSize (
175b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_TabItemWidth),
176b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_TabItemHeight));
177ff12d537SAndre Fischer 
17895a18594SAndre Fischer     // Place the menu button and the separator.
179b862c97cSHerbert Dürr     if( bool(mpMenuButton))
180ff12d537SAndre Fischer     {
181ff12d537SAndre Fischer         mpMenuButton->SetPosSizePixel(
182ff12d537SAndre Fischer             Point(nX,nY),
183b9e67834SAndre Fischer             aTabItemSize);
184ff12d537SAndre Fischer         mpMenuButton->Show();
185b9e67834SAndre Fischer         nY += mpMenuButton->GetSizePixel().Height() + 1 + Theme::GetInteger(Theme::Int_TabMenuPadding);
186b9e67834SAndre Fischer         mnMenuSeparatorY = nY - Theme::GetInteger(Theme::Int_TabMenuPadding)/2 - 1;
187ff12d537SAndre Fischer     }
188ff12d537SAndre Fischer 
18995a18594SAndre Fischer     // Place the deck selection buttons.
190ff12d537SAndre Fischer     for(ItemContainer::const_iterator
191ff12d537SAndre Fischer             iItem(maItems.begin()), iEnd(maItems.end());
192ff12d537SAndre Fischer         iItem!=iEnd;
193ff12d537SAndre Fischer         ++iItem)
194ff12d537SAndre Fischer     {
19595a18594SAndre Fischer         Button& rButton (*iItem->mpButton);
19695a18594SAndre Fischer         rButton.Show( ! iItem->mbIsHidden);
19795a18594SAndre Fischer 
198ff12d537SAndre Fischer         if (iItem->mbIsHidden)
199ff12d537SAndre Fischer             continue;
200ff12d537SAndre Fischer 
201ff12d537SAndre Fischer         // Place and size the icon.
202ff12d537SAndre Fischer         rButton.SetPosSizePixel(
203ff12d537SAndre Fischer             Point(nX,nY),
204b9e67834SAndre Fischer             aTabItemSize);
205ff12d537SAndre Fischer         rButton.Show();
206ff12d537SAndre Fischer 
207ff12d537SAndre Fischer         nY += rButton.GetSizePixel().Height() + 1 + aPadding.Bottom();
208ff12d537SAndre Fischer     }
209ff12d537SAndre Fischer     Invalidate();
210ff12d537SAndre Fischer }
211ff12d537SAndre Fischer 
HighlightDeck(const::rtl::OUString & rsDeckId)212ff12d537SAndre Fischer void TabBar::HighlightDeck (const ::rtl::OUString& rsDeckId)
213ff12d537SAndre Fischer {
2143091fa8aSAndre Fischer     for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
2153091fa8aSAndre Fischer          iItem!=iEnd;
2163091fa8aSAndre Fischer          ++iItem)
2173091fa8aSAndre Fischer     {
2183091fa8aSAndre Fischer         if (iItem->msDeckId.equals(rsDeckId))
2193091fa8aSAndre Fischer             iItem->mpButton->Check(sal_True);
2203091fa8aSAndre Fischer         else
2213091fa8aSAndre Fischer             iItem->mpButton->Check(sal_False);
2223091fa8aSAndre Fischer     }
22313e1c3b4SAndre Fischer }
22413e1c3b4SAndre Fischer 
GetItemForId(const::rtl::OUString & rsDeckId)22513e1c3b4SAndre Fischer TabBar::Item* TabBar::GetItemForId (const ::rtl::OUString& rsDeckId)
22613e1c3b4SAndre Fischer {
22713e1c3b4SAndre Fischer     for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
228ff12d537SAndre Fischer          iItem!=iEnd;
229ff12d537SAndre Fischer          ++iItem)
230ff12d537SAndre Fischer     {
23195a18594SAndre Fischer         if (iItem->msDeckId.equals(rsDeckId))
23213e1c3b4SAndre Fischer             return &*iItem;
233ff12d537SAndre Fischer     }
23413e1c3b4SAndre Fischer     return NULL;
235ff12d537SAndre Fischer }
236ff12d537SAndre Fischer 
DataChanged(const DataChangedEvent & rDataChangedEvent)237ff12d537SAndre Fischer void TabBar::DataChanged (const DataChangedEvent& rDataChangedEvent)
238ff12d537SAndre Fischer {
23995a18594SAndre Fischer     SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
240ff12d537SAndre Fischer     UpdateButtonIcons();
24195a18594SAndre Fischer 
242ff12d537SAndre Fischer     Window::DataChanged(rDataChangedEvent);
243ff12d537SAndre Fischer }
244ff12d537SAndre Fischer 
Notify(NotifyEvent &)2455c37a1f2SAndre Fischer long TabBar::Notify (NotifyEvent&)
246101538fcSAndre Fischer {
247101538fcSAndre Fischer     return sal_False;
248101538fcSAndre Fischer }
249101538fcSAndre Fischer 
CreateTabItem(const DeckDescriptor & rDeckDescriptor)250ff12d537SAndre Fischer RadioButton* TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor)
251ff12d537SAndre Fischer {
252ff12d537SAndre Fischer     RadioButton* pItem = ControlFactory::CreateTabItem(this);
253ff12d537SAndre Fischer     pItem->SetHelpText(rDeckDescriptor.msHelpText);
254ff12d537SAndre Fischer     pItem->SetQuickHelpText(rDeckDescriptor.msHelpText);
255ff12d537SAndre Fischer 
256ff12d537SAndre Fischer     return pItem;
257ff12d537SAndre Fischer }
258ff12d537SAndre Fischer 
GetItemImage(const DeckDescriptor & rDeckDescriptor) const259ff12d537SAndre Fischer Image TabBar::GetItemImage (const DeckDescriptor& rDeckDescriptor) const
260ff12d537SAndre Fischer {
261b9e67834SAndre Fischer     return Tools::GetImage(
262b9e67834SAndre Fischer         rDeckDescriptor.msIconURL,
263b9e67834SAndre Fischer         rDeckDescriptor.msHighContrastIconURL,
264b9e67834SAndre Fischer         mxFrame);
265ff12d537SAndre Fischer }
266ff12d537SAndre Fischer 
IMPL_LINK(TabBar::Item,HandleClick,Button *,EMPTYARG)26795a18594SAndre Fischer IMPL_LINK(TabBar::Item, HandleClick, Button*, EMPTYARG)
268ff12d537SAndre Fischer {
269007f1c2bSHerbert Dürr     try
270007f1c2bSHerbert Dürr     {
27195a18594SAndre Fischer         maDeckActivationFunctor(msDeckId);
272007f1c2bSHerbert Dürr     }
273007f1c2bSHerbert Dürr     catch( const ::com::sun::star::uno::Exception&) {} // workaround for #i123198#
274007f1c2bSHerbert Dürr 
275ff12d537SAndre Fischer     return 1;
276ff12d537SAndre Fischer }
277ff12d537SAndre Fischer 
GetDeckIdForIndex(const sal_Int32 nIndex) const27895a18594SAndre Fischer const ::rtl::OUString TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const
279ff12d537SAndre Fischer {
28095a18594SAndre Fischer     if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
281ff12d537SAndre Fischer         throw RuntimeException();
282ff12d537SAndre Fischer     else
28395a18594SAndre Fischer         return maItems[nIndex].msDeckId;
284ff12d537SAndre Fischer }
285ff12d537SAndre Fischer 
ToggleHideFlag(const sal_Int32 nIndex)286ff12d537SAndre Fischer void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
287ff12d537SAndre Fischer {
28895a18594SAndre Fischer     if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
289ff12d537SAndre Fischer         throw RuntimeException();
290ff12d537SAndre Fischer     else
291ff12d537SAndre Fischer     {
292ff12d537SAndre Fischer         maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden;
29395a18594SAndre Fischer         ResourceManager::Instance().SetIsDeckEnabled(
29495a18594SAndre Fischer             maItems[nIndex].msDeckId,
29595a18594SAndre Fischer             maItems[nIndex].mbIsHidden);
296ff12d537SAndre Fischer         Layout();
297ff12d537SAndre Fischer     }
298ff12d537SAndre Fischer }
299ff12d537SAndre Fischer 
RestoreHideFlags(void)300ff12d537SAndre Fischer void TabBar::RestoreHideFlags (void)
301ff12d537SAndre Fischer {
302ff12d537SAndre Fischer     bool bNeedsLayout (false);
303ff12d537SAndre Fischer     for(ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
304ff12d537SAndre Fischer         iItem!=iEnd;
305ff12d537SAndre Fischer         ++iItem)
306ff12d537SAndre Fischer     {
307ff12d537SAndre Fischer         if (iItem->mbIsHidden != iItem->mbIsHiddenByDefault)
308ff12d537SAndre Fischer         {
309ff12d537SAndre Fischer             iItem->mbIsHidden = iItem->mbIsHiddenByDefault;
310ff12d537SAndre Fischer             bNeedsLayout = true;
311ff12d537SAndre Fischer         }
312ff12d537SAndre Fischer     }
313ff12d537SAndre Fischer     if (bNeedsLayout)
314ff12d537SAndre Fischer         Layout();
315ff12d537SAndre Fischer }
316ff12d537SAndre Fischer 
UpdateFocusManager(FocusManager & rFocusManager)31765908a7eSAndre Fischer void TabBar::UpdateFocusManager (FocusManager& rFocusManager)
31865908a7eSAndre Fischer {
31965908a7eSAndre Fischer     ::std::vector<Button*> aButtons;
32065908a7eSAndre Fischer     aButtons.reserve(maItems.size()+1);
32165908a7eSAndre Fischer 
32265908a7eSAndre Fischer     aButtons.push_back(mpMenuButton.get());
32365908a7eSAndre Fischer     for(ItemContainer::const_iterator
32465908a7eSAndre Fischer             iItem(maItems.begin()), iEnd(maItems.end());
32565908a7eSAndre Fischer         iItem!=iEnd;
32665908a7eSAndre Fischer         ++iItem)
32765908a7eSAndre Fischer     {
32865908a7eSAndre Fischer         aButtons.push_back(iItem->mpButton.get());
32965908a7eSAndre Fischer     }
33065908a7eSAndre Fischer     rFocusManager.SetButtons(aButtons);
33165908a7eSAndre Fischer }
33265908a7eSAndre Fischer 
IMPL_LINK(TabBar,OnToolboxClicked,void *,EMPTYARG)33395a18594SAndre Fischer IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
334ff12d537SAndre Fischer {
335a2f41a4aSAndre Fischer     if ( ! mpMenuButton)
336a2f41a4aSAndre Fischer         return 0;
337a2f41a4aSAndre Fischer 
338be6d8c25SAndre Fischer     ::std::vector<DeckMenuData> aMenuData;
33995a18594SAndre Fischer 
34095a18594SAndre Fischer     for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
34195a18594SAndre Fischer         iItem!=iEnd;
34295a18594SAndre Fischer         ++iItem)
34395a18594SAndre Fischer     {
34495a18594SAndre Fischer         const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
34595a18594SAndre Fischer         if (pDeckDescriptor != NULL)
34695a18594SAndre Fischer         {
347be6d8c25SAndre Fischer             DeckMenuData aData;
348be6d8c25SAndre Fischer             aData.msDisplayName = pDeckDescriptor->msTitle;
349be6d8c25SAndre Fischer             aData.msDeckId = pDeckDescriptor->msId;
350be6d8c25SAndre Fischer             aData.mbIsCurrentDeck = iItem->mpButton->IsChecked();
351be6d8c25SAndre Fischer             aData.mbIsActive = !iItem->mbIsHidden;
352be6d8c25SAndre Fischer             aData.mbIsEnabled = iItem->mpButton->IsEnabled();
35395a18594SAndre Fischer 
354be6d8c25SAndre Fischer             aMenuData.push_back(aData);
35595a18594SAndre Fischer         }
35695a18594SAndre Fischer     }
35795a18594SAndre Fischer 
358ff12d537SAndre Fischer     maPopupMenuProvider(
359ff12d537SAndre Fischer         Rectangle(
360ff12d537SAndre Fischer             mpMenuButton->GetPosPixel(),
36195a18594SAndre Fischer             mpMenuButton->GetSizePixel()),
362be6d8c25SAndre Fischer         aMenuData);
363a2f41a4aSAndre Fischer     mpMenuButton->Check(sal_False);
364ff12d537SAndre Fischer 
365ff12d537SAndre Fischer     return 0;
366ff12d537SAndre Fischer }
367ff12d537SAndre Fischer 
368ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
369*549760eaSmseidel 
370*549760eaSmseidel /* vim: set noet sw=4 ts=4: */
371