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>
41ff12d537SAndre Fischer
42ff12d537SAndre Fischer
43ff12d537SAndre Fischer using namespace ::com::sun::star;
44ff12d537SAndre Fischer using namespace ::com::sun::star::uno;
45ff12d537SAndre Fischer
46ff12d537SAndre Fischer
47ff12d537SAndre Fischer
4822de8995SAndre Fischer
49ff12d537SAndre Fischer namespace sfx2 { namespace sidebar {
5022de8995SAndre Fischer
TabBar(Window * pParentWindow,const Reference<frame::XFrame> & rxFrame,const::boost::function<void (const::rtl::OUString &)> & rDeckActivationFunctor,const PopupMenuProvider & rPopupMenuProvider)51ff12d537SAndre Fischer TabBar::TabBar (
52ff12d537SAndre Fischer Window* pParentWindow,
53ff12d537SAndre Fischer const Reference<frame::XFrame>& rxFrame,
5495a18594SAndre Fischer const ::boost::function<void(const ::rtl::OUString&)>& rDeckActivationFunctor,
5595a18594SAndre Fischer const PopupMenuProvider& rPopupMenuProvider)
5665908a7eSAndre Fischer : Window(pParentWindow, WB_DIALOGCONTROL),
57ff12d537SAndre Fischer mxFrame(rxFrame),
58ff12d537SAndre Fischer mpMenuButton(ControlFactory::CreateMenuButton(this)),
59ff12d537SAndre Fischer maItems(),
60ff12d537SAndre Fischer maDeckActivationFunctor(rDeckActivationFunctor),
61ff12d537SAndre Fischer maPopupMenuProvider(rPopupMenuProvider)
6222de8995SAndre Fischer {
63b9e67834SAndre Fischer SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
64ff12d537SAndre Fischer
65ff12d537SAndre Fischer mpMenuButton->SetModeImage(
667a32b0c8SAndre Fischer Theme::GetImage(Theme::Image_TabBarMenu),
67ff12d537SAndre Fischer Theme::IsHighContrastMode()
68ff12d537SAndre Fischer ? BMP_COLOR_HIGHCONTRAST
69ff12d537SAndre Fischer : BMP_COLOR_NORMAL);
70ff12d537SAndre Fischer mpMenuButton->SetClickHdl(LINK(this, TabBar, OnToolboxClicked));
7195a18594SAndre Fischer Layout();
727a32b0c8SAndre Fischer
737a32b0c8SAndre Fischer #ifdef DEBUG
747a32b0c8SAndre Fischer SetText(A2S("TabBar"));
757a32b0c8SAndre Fischer #endif
7622de8995SAndre Fischer }
7722de8995SAndre Fischer
7822de8995SAndre Fischer
7922de8995SAndre Fischer
8022de8995SAndre Fischer
~TabBar(void)8122de8995SAndre Fischer TabBar::~TabBar (void)
8222de8995SAndre Fischer {
8322de8995SAndre Fischer }
8422de8995SAndre Fischer
8522de8995SAndre Fischer
8622de8995SAndre Fischer
8722de8995SAndre Fischer
Paint(const Rectangle & rUpdateArea)8822de8995SAndre Fischer void TabBar::Paint (const Rectangle& rUpdateArea)
8922de8995SAndre Fischer {
90ff12d537SAndre Fischer Window::Paint(rUpdateArea);
91ff12d537SAndre Fischer
92b9e67834SAndre Fischer const sal_Int32 nHorizontalPadding (Theme::GetInteger(Theme::Int_TabMenuSeparatorPadding));
93b9e67834SAndre Fischer SetLineColor(Theme::GetColor(Theme::Color_TabMenuSeparator));
94ff12d537SAndre Fischer DrawLine(
95ff12d537SAndre Fischer Point(nHorizontalPadding, mnMenuSeparatorY),
96ff12d537SAndre Fischer Point(GetSizePixel().Width()-nHorizontalPadding, mnMenuSeparatorY));
9722de8995SAndre Fischer }
9822de8995SAndre Fischer
9922de8995SAndre Fischer
10022de8995SAndre Fischer
10122de8995SAndre Fischer
GetDefaultWidth(void)10222de8995SAndre Fischer sal_Int32 TabBar::GetDefaultWidth (void)
10322de8995SAndre Fischer {
104b9e67834SAndre Fischer return Theme::GetInteger(Theme::Int_TabItemWidth)
105b9e67834SAndre Fischer + Theme::GetInteger(Theme::Int_TabBarLeftPadding)
106b9e67834SAndre Fischer + Theme::GetInteger(Theme::Int_TabBarRightPadding);
107ff12d537SAndre Fischer }
108ff12d537SAndre Fischer
109ff12d537SAndre Fischer
110ff12d537SAndre Fischer
111ff12d537SAndre Fischer
SetDecks(const ResourceManager::DeckContextDescriptorContainer & rDecks)112ff12d537SAndre Fischer void TabBar::SetDecks (
11313e1c3b4SAndre Fischer const ResourceManager::DeckContextDescriptorContainer& rDecks)
114ff12d537SAndre Fischer {
115ff12d537SAndre Fischer // Remove the current buttons.
116ff12d537SAndre Fischer {
1177a32b0c8SAndre Fischer for(ItemContainer::iterator
118ff12d537SAndre Fischer iItem(maItems.begin()), iEnd(maItems.end());
119ff12d537SAndre Fischer iItem!=iEnd;
120ff12d537SAndre Fischer ++iItem)
121ff12d537SAndre Fischer {
1227a32b0c8SAndre Fischer iItem->mpButton.reset();
123ff12d537SAndre Fischer }
124ff12d537SAndre Fischer maItems.clear();
125ff12d537SAndre Fischer }
126ff12d537SAndre Fischer
12713e1c3b4SAndre Fischer maItems.resize(rDecks.size());
128ff12d537SAndre Fischer sal_Int32 nIndex (0);
12913e1c3b4SAndre Fischer for (ResourceManager::DeckContextDescriptorContainer::const_iterator
13013e1c3b4SAndre Fischer iDeck(rDecks.begin()),
13113e1c3b4SAndre Fischer iEnd(rDecks.end());
13213e1c3b4SAndre Fischer iDeck!=iEnd;
13313e1c3b4SAndre Fischer ++iDeck)
134ff12d537SAndre Fischer {
13513e1c3b4SAndre Fischer const DeckDescriptor* pDescriptor = ResourceManager::Instance().GetDeckDescriptor(iDeck->msId);
13695a18594SAndre Fischer if (pDescriptor == NULL)
13795a18594SAndre Fischer {
13895a18594SAndre Fischer OSL_ASSERT(pDescriptor!=NULL);
13995a18594SAndre Fischer continue;
14095a18594SAndre Fischer }
14195a18594SAndre Fischer
142ff12d537SAndre Fischer Item& rItem (maItems[nIndex++]);
14395a18594SAndre Fischer rItem.msDeckId = pDescriptor->msId;
1447a32b0c8SAndre Fischer rItem.mpButton.reset(CreateTabItem(*pDescriptor));
145ff12d537SAndre Fischer rItem.mpButton->SetClickHdl(LINK(&rItem, TabBar::Item, HandleClick));
146ff12d537SAndre Fischer rItem.maDeckActivationFunctor = maDeckActivationFunctor;
147ff12d537SAndre Fischer rItem.mbIsHiddenByDefault = false;
14895a18594SAndre Fischer rItem.mbIsHidden = ! pDescriptor->mbIsEnabled;
14913e1c3b4SAndre Fischer
15013e1c3b4SAndre Fischer rItem.mpButton->Enable(iDeck->mbIsEnabled);
151ff12d537SAndre Fischer }
152ff12d537SAndre Fischer
153ff12d537SAndre Fischer UpdateButtonIcons();
154ff12d537SAndre Fischer Layout();
155ff12d537SAndre Fischer }
156ff12d537SAndre Fischer
157ff12d537SAndre Fischer
158ff12d537SAndre Fischer
159ff12d537SAndre Fischer
UpdateButtonIcons(void)160ff12d537SAndre Fischer void TabBar::UpdateButtonIcons (void)
161ff12d537SAndre Fischer {
162ff12d537SAndre Fischer const BmpColorMode eColorMode (
163ff12d537SAndre Fischer Theme::IsHighContrastMode()
164ff12d537SAndre Fischer ? BMP_COLOR_HIGHCONTRAST
165ff12d537SAndre Fischer : BMP_COLOR_NORMAL);
166ff12d537SAndre Fischer
1677a32b0c8SAndre Fischer mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu), eColorMode);
168ff12d537SAndre Fischer
169ff12d537SAndre Fischer for(ItemContainer::const_iterator
170ff12d537SAndre Fischer iItem(maItems.begin()), iEnd(maItems.end());
171ff12d537SAndre Fischer iItem!=iEnd;
172ff12d537SAndre Fischer ++iItem)
173ff12d537SAndre Fischer {
17495a18594SAndre Fischer const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
17595a18594SAndre Fischer if (pDeckDescriptor != NULL)
17695a18594SAndre Fischer iItem->mpButton->SetModeImage(
17795a18594SAndre Fischer GetItemImage(*pDeckDescriptor),
17895a18594SAndre Fischer eColorMode);
179ff12d537SAndre Fischer }
18095a18594SAndre Fischer
18195a18594SAndre Fischer Invalidate();
182ff12d537SAndre Fischer }
183ff12d537SAndre Fischer
184ff12d537SAndre Fischer
185ff12d537SAndre Fischer
186ff12d537SAndre Fischer
Layout(void)187ff12d537SAndre Fischer void TabBar::Layout (void)
188ff12d537SAndre Fischer {
189b9e67834SAndre Fischer const SvBorder aPadding (
190b9e67834SAndre Fischer Theme::GetInteger(Theme::Int_TabBarLeftPadding),
191b9e67834SAndre Fischer Theme::GetInteger(Theme::Int_TabBarTopPadding),
192b9e67834SAndre Fischer Theme::GetInteger(Theme::Int_TabBarRightPadding),
193b9e67834SAndre Fischer Theme::GetInteger(Theme::Int_TabBarBottomPadding));
194ff12d537SAndre Fischer sal_Int32 nX (aPadding.Top());
195ff12d537SAndre Fischer sal_Int32 nY (aPadding.Left());
196b9e67834SAndre Fischer const Size aTabItemSize (
197b9e67834SAndre Fischer Theme::GetInteger(Theme::Int_TabItemWidth),
198b9e67834SAndre Fischer Theme::GetInteger(Theme::Int_TabItemHeight));
199ff12d537SAndre Fischer
20095a18594SAndre Fischer // Place the menu button and the separator.
201*b862c97cSHerbert Dürr if( bool(mpMenuButton))
202ff12d537SAndre Fischer {
203ff12d537SAndre Fischer mpMenuButton->SetPosSizePixel(
204ff12d537SAndre Fischer Point(nX,nY),
205b9e67834SAndre Fischer aTabItemSize);
206ff12d537SAndre Fischer mpMenuButton->Show();
207b9e67834SAndre Fischer nY += mpMenuButton->GetSizePixel().Height() + 1 + Theme::GetInteger(Theme::Int_TabMenuPadding);
208b9e67834SAndre Fischer mnMenuSeparatorY = nY - Theme::GetInteger(Theme::Int_TabMenuPadding)/2 - 1;
209ff12d537SAndre Fischer }
21095a18594SAndre Fischer
21195a18594SAndre Fischer // Place the deck selection buttons.
212ff12d537SAndre Fischer for(ItemContainer::const_iterator
213ff12d537SAndre Fischer iItem(maItems.begin()), iEnd(maItems.end());
214ff12d537SAndre Fischer iItem!=iEnd;
215ff12d537SAndre Fischer ++iItem)
216ff12d537SAndre Fischer {
21795a18594SAndre Fischer Button& rButton (*iItem->mpButton);
21895a18594SAndre Fischer rButton.Show( ! iItem->mbIsHidden);
21995a18594SAndre Fischer
220ff12d537SAndre Fischer if (iItem->mbIsHidden)
221ff12d537SAndre Fischer continue;
222ff12d537SAndre Fischer
223ff12d537SAndre Fischer // Place and size the icon.
224ff12d537SAndre Fischer rButton.SetPosSizePixel(
225ff12d537SAndre Fischer Point(nX,nY),
226b9e67834SAndre Fischer aTabItemSize);
227ff12d537SAndre Fischer rButton.Show();
228ff12d537SAndre Fischer
229ff12d537SAndre Fischer nY += rButton.GetSizePixel().Height() + 1 + aPadding.Bottom();
230ff12d537SAndre Fischer }
231ff12d537SAndre Fischer Invalidate();
232ff12d537SAndre Fischer }
233ff12d537SAndre Fischer
234ff12d537SAndre Fischer
235ff12d537SAndre Fischer
236ff12d537SAndre Fischer
HighlightDeck(const::rtl::OUString & rsDeckId)237ff12d537SAndre Fischer void TabBar::HighlightDeck (const ::rtl::OUString& rsDeckId)
238ff12d537SAndre Fischer {
2393091fa8aSAndre Fischer for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
2403091fa8aSAndre Fischer iItem!=iEnd;
2413091fa8aSAndre Fischer ++iItem)
2423091fa8aSAndre Fischer {
2433091fa8aSAndre Fischer if (iItem->msDeckId.equals(rsDeckId))
2443091fa8aSAndre Fischer iItem->mpButton->Check(sal_True);
2453091fa8aSAndre Fischer else
2463091fa8aSAndre Fischer iItem->mpButton->Check(sal_False);
2473091fa8aSAndre Fischer }
24813e1c3b4SAndre Fischer }
24913e1c3b4SAndre Fischer
25013e1c3b4SAndre Fischer
25113e1c3b4SAndre Fischer
25213e1c3b4SAndre Fischer
GetItemForId(const::rtl::OUString & rsDeckId)25313e1c3b4SAndre Fischer TabBar::Item* TabBar::GetItemForId (const ::rtl::OUString& rsDeckId)
25413e1c3b4SAndre Fischer {
25513e1c3b4SAndre Fischer for (ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
256ff12d537SAndre Fischer iItem!=iEnd;
257ff12d537SAndre Fischer ++iItem)
258ff12d537SAndre Fischer {
25995a18594SAndre Fischer if (iItem->msDeckId.equals(rsDeckId))
26013e1c3b4SAndre Fischer return &*iItem;
261ff12d537SAndre Fischer }
26213e1c3b4SAndre Fischer return NULL;
263ff12d537SAndre Fischer }
264ff12d537SAndre Fischer
265ff12d537SAndre Fischer
266ff12d537SAndre Fischer
267ff12d537SAndre Fischer
DataChanged(const DataChangedEvent & rDataChangedEvent)268ff12d537SAndre Fischer void TabBar::DataChanged (const DataChangedEvent& rDataChangedEvent)
269ff12d537SAndre Fischer {
27095a18594SAndre Fischer SetBackground(Theme::GetPaint(Theme::Paint_TabBarBackground).GetWallpaper());
27195a18594SAndre Fischer UpdateButtonIcons();
27295a18594SAndre Fischer
27395a18594SAndre Fischer Window::DataChanged(rDataChangedEvent);
274ff12d537SAndre Fischer }
275ff12d537SAndre Fischer
276ff12d537SAndre Fischer
277ff12d537SAndre Fischer
278ff12d537SAndre Fischer
Notify(NotifyEvent &)2795c37a1f2SAndre Fischer long TabBar::Notify (NotifyEvent&)
280101538fcSAndre Fischer {
281101538fcSAndre Fischer return sal_False;
282101538fcSAndre Fischer }
283101538fcSAndre Fischer
284101538fcSAndre Fischer
285101538fcSAndre Fischer
286101538fcSAndre Fischer
CreateTabItem(const DeckDescriptor & rDeckDescriptor)287ff12d537SAndre Fischer RadioButton* TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor)
288ff12d537SAndre Fischer {
289ff12d537SAndre Fischer RadioButton* pItem = ControlFactory::CreateTabItem(this);
290ff12d537SAndre Fischer pItem->SetHelpText(rDeckDescriptor.msHelpText);
291ff12d537SAndre Fischer pItem->SetQuickHelpText(rDeckDescriptor.msHelpText);
292ff12d537SAndre Fischer
293ff12d537SAndre Fischer return pItem;
29422de8995SAndre Fischer }
29522de8995SAndre Fischer
29622de8995SAndre Fischer
297ff12d537SAndre Fischer
GetItemImage(const DeckDescriptor & rDeckDescriptor) const298ff12d537SAndre Fischer Image TabBar::GetItemImage (const DeckDescriptor& rDeckDescriptor) const
299ff12d537SAndre Fischer {
300b9e67834SAndre Fischer return Tools::GetImage(
301b9e67834SAndre Fischer rDeckDescriptor.msIconURL,
302b9e67834SAndre Fischer rDeckDescriptor.msHighContrastIconURL,
303b9e67834SAndre Fischer mxFrame);
304ff12d537SAndre Fischer }
305ff12d537SAndre Fischer
306ff12d537SAndre Fischer
307ff12d537SAndre Fischer
308ff12d537SAndre Fischer
309ff12d537SAndre Fischer
IMPL_LINK(TabBar::Item,HandleClick,Button *,EMPTYARG)31095a18594SAndre Fischer IMPL_LINK(TabBar::Item, HandleClick, Button*, EMPTYARG)
311ff12d537SAndre Fischer {
312007f1c2bSHerbert Dürr try
313007f1c2bSHerbert Dürr {
314007f1c2bSHerbert Dürr maDeckActivationFunctor(msDeckId);
315007f1c2bSHerbert Dürr }
316007f1c2bSHerbert Dürr catch( const ::com::sun::star::uno::Exception&) {} // workaround for #i123198#
317007f1c2bSHerbert Dürr
31895a18594SAndre Fischer return 1;
319ff12d537SAndre Fischer }
320ff12d537SAndre Fischer
321ff12d537SAndre Fischer
322ff12d537SAndre Fischer
323ff12d537SAndre Fischer
GetDeckIdForIndex(const sal_Int32 nIndex) const32495a18594SAndre Fischer const ::rtl::OUString TabBar::GetDeckIdForIndex (const sal_Int32 nIndex) const
325ff12d537SAndre Fischer {
32695a18594SAndre Fischer if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
327ff12d537SAndre Fischer throw RuntimeException();
328ff12d537SAndre Fischer else
32995a18594SAndre Fischer return maItems[nIndex].msDeckId;
330ff12d537SAndre Fischer }
331ff12d537SAndre Fischer
332ff12d537SAndre Fischer
333ff12d537SAndre Fischer
334ff12d537SAndre Fischer
ToggleHideFlag(const sal_Int32 nIndex)335ff12d537SAndre Fischer void TabBar::ToggleHideFlag (const sal_Int32 nIndex)
336ff12d537SAndre Fischer {
33795a18594SAndre Fischer if (nIndex<0 || static_cast<size_t>(nIndex)>=maItems.size())
338ff12d537SAndre Fischer throw RuntimeException();
339ff12d537SAndre Fischer else
340ff12d537SAndre Fischer {
341ff12d537SAndre Fischer maItems[nIndex].mbIsHidden = ! maItems[nIndex].mbIsHidden;
34295a18594SAndre Fischer ResourceManager::Instance().SetIsDeckEnabled(
34395a18594SAndre Fischer maItems[nIndex].msDeckId,
34495a18594SAndre Fischer maItems[nIndex].mbIsHidden);
345ff12d537SAndre Fischer Layout();
346ff12d537SAndre Fischer }
347ff12d537SAndre Fischer }
348ff12d537SAndre Fischer
349ff12d537SAndre Fischer
350ff12d537SAndre Fischer
351ff12d537SAndre Fischer
RestoreHideFlags(void)352ff12d537SAndre Fischer void TabBar::RestoreHideFlags (void)
353ff12d537SAndre Fischer {
354ff12d537SAndre Fischer bool bNeedsLayout (false);
355ff12d537SAndre Fischer for(ItemContainer::iterator iItem(maItems.begin()),iEnd(maItems.end());
356ff12d537SAndre Fischer iItem!=iEnd;
357ff12d537SAndre Fischer ++iItem)
358ff12d537SAndre Fischer {
359ff12d537SAndre Fischer if (iItem->mbIsHidden != iItem->mbIsHiddenByDefault)
360ff12d537SAndre Fischer {
361ff12d537SAndre Fischer iItem->mbIsHidden = iItem->mbIsHiddenByDefault;
362ff12d537SAndre Fischer bNeedsLayout = true;
363ff12d537SAndre Fischer }
364ff12d537SAndre Fischer }
365ff12d537SAndre Fischer if (bNeedsLayout)
366ff12d537SAndre Fischer Layout();
367ff12d537SAndre Fischer }
368ff12d537SAndre Fischer
369ff12d537SAndre Fischer
370ff12d537SAndre Fischer
371ff12d537SAndre Fischer
UpdateFocusManager(FocusManager & rFocusManager)37265908a7eSAndre Fischer void TabBar::UpdateFocusManager (FocusManager& rFocusManager)
37365908a7eSAndre Fischer {
37465908a7eSAndre Fischer ::std::vector<Button*> aButtons;
37565908a7eSAndre Fischer aButtons.reserve(maItems.size()+1);
37665908a7eSAndre Fischer
37765908a7eSAndre Fischer aButtons.push_back(mpMenuButton.get());
37865908a7eSAndre Fischer for(ItemContainer::const_iterator
37965908a7eSAndre Fischer iItem(maItems.begin()), iEnd(maItems.end());
38065908a7eSAndre Fischer iItem!=iEnd;
38165908a7eSAndre Fischer ++iItem)
38265908a7eSAndre Fischer {
38365908a7eSAndre Fischer aButtons.push_back(iItem->mpButton.get());
38465908a7eSAndre Fischer }
38565908a7eSAndre Fischer rFocusManager.SetButtons(aButtons);
38665908a7eSAndre Fischer }
38765908a7eSAndre Fischer
38865908a7eSAndre Fischer
38965908a7eSAndre Fischer
39065908a7eSAndre Fischer
IMPL_LINK(TabBar,OnToolboxClicked,void *,EMPTYARG)39195a18594SAndre Fischer IMPL_LINK(TabBar, OnToolboxClicked, void*, EMPTYARG)
392ff12d537SAndre Fischer {
393a2f41a4aSAndre Fischer if ( ! mpMenuButton)
394a2f41a4aSAndre Fischer return 0;
395a2f41a4aSAndre Fischer
396be6d8c25SAndre Fischer ::std::vector<DeckMenuData> aMenuData;
397a2f41a4aSAndre Fischer
39895a18594SAndre Fischer for(ItemContainer::const_iterator iItem(maItems.begin()),iEnd(maItems.end());
39995a18594SAndre Fischer iItem!=iEnd;
40095a18594SAndre Fischer ++iItem)
40195a18594SAndre Fischer {
40295a18594SAndre Fischer const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
40395a18594SAndre Fischer if (pDeckDescriptor != NULL)
40495a18594SAndre Fischer {
405be6d8c25SAndre Fischer DeckMenuData aData;
406be6d8c25SAndre Fischer aData.msDisplayName = pDeckDescriptor->msTitle;
407be6d8c25SAndre Fischer aData.msDeckId = pDeckDescriptor->msId;
408be6d8c25SAndre Fischer aData.mbIsCurrentDeck = iItem->mpButton->IsChecked();
409be6d8c25SAndre Fischer aData.mbIsActive = !iItem->mbIsHidden;
410be6d8c25SAndre Fischer aData.mbIsEnabled = iItem->mpButton->IsEnabled();
411be6d8c25SAndre Fischer
412be6d8c25SAndre Fischer aMenuData.push_back(aData);
41395a18594SAndre Fischer }
41495a18594SAndre Fischer }
41595a18594SAndre Fischer
416ff12d537SAndre Fischer maPopupMenuProvider(
417ff12d537SAndre Fischer Rectangle(
418ff12d537SAndre Fischer mpMenuButton->GetPosPixel(),
41995a18594SAndre Fischer mpMenuButton->GetSizePixel()),
420be6d8c25SAndre Fischer aMenuData);
421a2f41a4aSAndre Fischer mpMenuButton->Check(sal_False);
422ff12d537SAndre Fischer
423ff12d537SAndre Fischer return 0;
424ff12d537SAndre Fischer }
425ff12d537SAndre Fischer
426ff12d537SAndre Fischer
427ff12d537SAndre Fischer
428ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
429