xref: /trunk/main/sfx2/source/sidebar/Deck.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 "Deck.hxx"
2522de8995SAndre Fischer #include "DeckDescriptor.hxx"
267a32b0c8SAndre Fischer #include "DeckLayouter.hxx"
27ff12d537SAndre Fischer #include "DrawHelper.hxx"
28ff12d537SAndre Fischer #include "DeckTitleBar.hxx"
298a1a651aSAndre Fischer #include "PanelTitleBar.hxx"
30b9e67834SAndre Fischer #include "Paint.hxx"
31ff12d537SAndre Fischer #include "Panel.hxx"
327a32b0c8SAndre Fischer #include "ToolBoxBackground.hxx"
33f35c6d02SAndre Fischer #include "sfx2/sidebar/Tools.hxx"
34b9e67834SAndre Fischer #include "sfx2/sidebar/Theme.hxx"
35ff12d537SAndre Fischer 
367a32b0c8SAndre Fischer #include <vcl/dockwin.hxx>
377a32b0c8SAndre Fischer #include <vcl/scrbar.hxx>
3895a18594SAndre Fischer #include <tools/svborder.hxx>
3922de8995SAndre Fischer 
407a32b0c8SAndre Fischer #include <boost/bind.hpp>
417a32b0c8SAndre Fischer 
427a32b0c8SAndre Fischer using namespace ::com::sun::star;
437a32b0c8SAndre Fischer using namespace ::com::sun::star::uno;
447a32b0c8SAndre Fischer 
45ff12d537SAndre Fischer namespace sfx2 { namespace sidebar {
46ff12d537SAndre Fischer 
47ff12d537SAndre Fischer namespace {
48ff12d537SAndre Fischer     static const sal_Int32 MinimalPanelHeight (25);
49ff12d537SAndre Fischer }
50ff12d537SAndre Fischer 
Deck(const DeckDescriptor & rDeckDescriptor,Window * pParentWindow,const::boost::function<void (void)> & rCloserAction)5122de8995SAndre Fischer Deck::Deck (
5222de8995SAndre Fischer     const DeckDescriptor& rDeckDescriptor,
537a32b0c8SAndre Fischer     Window* pParentWindow,
547a32b0c8SAndre Fischer     const ::boost::function<void(void)>& rCloserAction)
5565908a7eSAndre Fischer     : Window(pParentWindow, 0),
5622de8995SAndre Fischer       msId(rDeckDescriptor.msId),
57ff12d537SAndre Fischer       maIcon(),
58ff12d537SAndre Fischer       msIconURL(rDeckDescriptor.msIconURL),
59ff12d537SAndre Fischer       msHighContrastIconURL(rDeckDescriptor.msHighContrastIconURL),
60b9e67834SAndre Fischer       maPanels(),
617a32b0c8SAndre Fischer       mpTitleBar(new DeckTitleBar(rDeckDescriptor.msTitle, this, rCloserAction)),
627a32b0c8SAndre Fischer       mpScrollClipWindow(new Window(this)),
637a32b0c8SAndre Fischer       mpScrollContainer(new ScrollContainerWindow(mpScrollClipWindow.get())),
647a32b0c8SAndre Fischer       mpFiller(new Window(this)),
657a32b0c8SAndre Fischer       mpVerticalScrollBar(new ScrollBar(this))
6622de8995SAndre Fischer {
6722de8995SAndre Fischer     SetBackground(Wallpaper());
687a32b0c8SAndre Fischer 
697a32b0c8SAndre Fischer     mpScrollClipWindow->SetBackground(Wallpaper());
7065908a7eSAndre Fischer     mpScrollClipWindow->Show();
7165908a7eSAndre Fischer 
7265908a7eSAndre Fischer     mpScrollContainer->SetStyle(mpScrollContainer->GetStyle() | WB_DIALOGCONTROL);
737a32b0c8SAndre Fischer     mpScrollContainer->SetBackground(Wallpaper());
7465908a7eSAndre Fischer     mpScrollContainer->Show();
757a32b0c8SAndre Fischer 
767a32b0c8SAndre Fischer     mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, HandleVerticalScrollBarChange));
777a32b0c8SAndre Fischer 
787a32b0c8SAndre Fischer #ifdef DEBUG
797a32b0c8SAndre Fischer     SetText(A2S("Deck"));
807a32b0c8SAndre Fischer     mpScrollClipWindow->SetText(A2S("ScrollClipWindow"));
817a32b0c8SAndre Fischer     mpFiller->SetText(A2S("Filler"));
827a32b0c8SAndre Fischer     mpVerticalScrollBar->SetText(A2S("VerticalScrollBar"));
837a32b0c8SAndre Fischer #endif
8422de8995SAndre Fischer }
8522de8995SAndre Fischer 
~Deck(void)8622de8995SAndre Fischer Deck::~Deck (void)
8722de8995SAndre Fischer {
88ff12d537SAndre Fischer     Dispose();
89f120fe41SAndre Fischer 
90f120fe41SAndre Fischer     // We have to explicitly trigger the destruction of panels.
91f120fe41SAndre Fischer     // Otherwise that is done by one of our base class destructors
92f120fe41SAndre Fischer     // without updating maPanels.
93f120fe41SAndre Fischer     maPanels.clear();
94ff12d537SAndre Fischer }
95ff12d537SAndre Fischer 
Dispose(void)96ff12d537SAndre Fischer void Deck::Dispose (void)
97ff12d537SAndre Fischer {
98f120fe41SAndre Fischer     SharedPanelContainer aPanels;
99ff12d537SAndre Fischer     aPanels.swap(maPanels);
100f120fe41SAndre Fischer     for (SharedPanelContainer::iterator
101ff12d537SAndre Fischer             iPanel(aPanels.begin()),
102ff12d537SAndre Fischer             iEnd(aPanels.end());
103ff12d537SAndre Fischer          iPanel!=iEnd;
104ff12d537SAndre Fischer          ++iPanel)
105ff12d537SAndre Fischer     {
106f120fe41SAndre Fischer         if (*iPanel)
107f120fe41SAndre Fischer         {
108ff12d537SAndre Fischer             (*iPanel)->Dispose();
109f120fe41SAndre Fischer             OSL_ASSERT(iPanel->unique());
110f120fe41SAndre Fischer             iPanel->reset();
111f120fe41SAndre Fischer         }
112ff12d537SAndre Fischer     }
1137a32b0c8SAndre Fischer 
1147a32b0c8SAndre Fischer     mpTitleBar.reset();
1157a32b0c8SAndre Fischer     mpFiller.reset();
1167a32b0c8SAndre Fischer     mpVerticalScrollBar.reset();
11722de8995SAndre Fischer }
11822de8995SAndre Fischer 
GetId(void) const11922de8995SAndre Fischer const ::rtl::OUString& Deck::GetId (void) const
12022de8995SAndre Fischer {
12122de8995SAndre Fischer     return msId;
12222de8995SAndre Fischer }
12322de8995SAndre Fischer 
GetTitleBar(void) const1247a32b0c8SAndre Fischer DeckTitleBar* Deck::GetTitleBar (void) const
12522de8995SAndre Fischer {
1267a32b0c8SAndre Fischer     return mpTitleBar.get();
12722de8995SAndre Fischer }
12822de8995SAndre Fischer 
GetContentArea(void) const129ff12d537SAndre Fischer Rectangle Deck::GetContentArea (void) const
13022de8995SAndre Fischer {
131ff12d537SAndre Fischer     const Size aWindowSize (GetSizePixel());
132b9e67834SAndre Fischer     const int nBorderSize (Theme::GetInteger(Theme::Int_DeckBorderSize));
133ff12d537SAndre Fischer 
134ff12d537SAndre Fischer     return Rectangle(
135b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_DeckLeftPadding) + nBorderSize,
136b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_DeckTopPadding) + nBorderSize,
137b9e67834SAndre Fischer         aWindowSize.Width() - 1 - Theme::GetInteger(Theme::Int_DeckRightPadding) - nBorderSize,
138b9e67834SAndre Fischer         aWindowSize.Height() - 1 - Theme::GetInteger(Theme::Int_DeckBottomPadding) - nBorderSize);
13922de8995SAndre Fischer }
14022de8995SAndre Fischer 
GetIconURL(const bool bIsHighContrastModeActive) const141ff12d537SAndre Fischer ::rtl::OUString Deck::GetIconURL (const bool bIsHighContrastModeActive) const
142ff12d537SAndre Fischer {
143ff12d537SAndre Fischer     if (bIsHighContrastModeActive)
144ff12d537SAndre Fischer         return msHighContrastIconURL;
145ff12d537SAndre Fischer     else
146ff12d537SAndre Fischer         return msIconURL;
147ff12d537SAndre Fischer }
148ff12d537SAndre Fischer 
Paint(const Rectangle & rUpdateArea)149ff12d537SAndre Fischer void Deck::Paint (const Rectangle& rUpdateArea)
150ff12d537SAndre Fischer {
15195a18594SAndre Fischer     (void) rUpdateArea;
15295a18594SAndre Fischer 
153ff12d537SAndre Fischer     const Size aWindowSize (GetSizePixel());
154b9e67834SAndre Fischer     const SvBorder aPadding (
155b9e67834SAndre Fischer             Theme::GetInteger(Theme::Int_DeckLeftPadding),
156b9e67834SAndre Fischer             Theme::GetInteger(Theme::Int_DeckTopPadding),
157b9e67834SAndre Fischer             Theme::GetInteger(Theme::Int_DeckRightPadding),
158b9e67834SAndre Fischer             Theme::GetInteger(Theme::Int_DeckBottomPadding));
159ff12d537SAndre Fischer 
160ff12d537SAndre Fischer     // Paint deck background outside the border.
161b9e67834SAndre Fischer     Rectangle aBox(
162ff12d537SAndre Fischer         0,
163ff12d537SAndre Fischer         0,
164ff12d537SAndre Fischer         aWindowSize.Width() - 1,
165b9e67834SAndre Fischer         aWindowSize.Height() - 1);
166ff12d537SAndre Fischer     DrawHelper::DrawBorder(
167ff12d537SAndre Fischer         *this,
168b9e67834SAndre Fischer         aBox,
169b9e67834SAndre Fischer         aPadding,
170b9e67834SAndre Fischer         Theme::GetPaint(Theme::Paint_DeckBackground),
171b9e67834SAndre Fischer         Theme::GetPaint(Theme::Paint_DeckBackground));
172b9e67834SAndre Fischer 
173b9e67834SAndre Fischer     // Paint the border.
174b9e67834SAndre Fischer     const int nBorderSize (Theme::GetInteger(Theme::Int_DeckBorderSize));
175b9e67834SAndre Fischer     aBox.Left() += aPadding.Left();
176b9e67834SAndre Fischer     aBox.Top() += aPadding.Top();
177b9e67834SAndre Fischer     aBox.Right() -= aPadding.Right();
178b9e67834SAndre Fischer     aBox.Bottom() -= aPadding.Bottom();
179b9e67834SAndre Fischer     const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder));
180b9e67834SAndre Fischer     DrawHelper::DrawBorder(
181b9e67834SAndre Fischer         *this,
182b9e67834SAndre Fischer         aBox,
183ff12d537SAndre Fischer         SvBorder(nBorderSize, nBorderSize, nBorderSize, nBorderSize),
184b9e67834SAndre Fischer         rHorizontalBorderPaint,
185b9e67834SAndre Fischer         Theme::GetPaint(Theme::Paint_VerticalBorder));
186b9e67834SAndre Fischer }
187b9e67834SAndre Fischer 
DataChanged(const DataChangedEvent & rEvent)188b9e67834SAndre Fischer void Deck::DataChanged (const DataChangedEvent& rEvent)
189b9e67834SAndre Fischer {
190b9e67834SAndre Fischer     (void)rEvent;
191b9e67834SAndre Fischer     RequestLayout();
192ff12d537SAndre Fischer }
193ff12d537SAndre Fischer 
Notify(NotifyEvent & rEvent)1943fac691dSAndre Fischer long Deck::Notify (NotifyEvent& rEvent)
1953fac691dSAndre Fischer {
196a1fa6b52SAndre Fischer     if (rEvent.GetType() == EVENT_COMMAND)
197a1fa6b52SAndre Fischer     {
1983fac691dSAndre Fischer         CommandEvent* pCommandEvent = reinterpret_cast<CommandEvent*>(rEvent.GetData());
199a1fa6b52SAndre Fischer         if (pCommandEvent != NULL)
2003fac691dSAndre Fischer             switch (pCommandEvent->GetCommand())
2013fac691dSAndre Fischer             {
2023fac691dSAndre Fischer                 case COMMAND_WHEEL:
203a1fa6b52SAndre Fischer                     return ProcessWheelEvent(pCommandEvent, rEvent)
204a1fa6b52SAndre Fischer                         ? sal_True
205a1fa6b52SAndre Fischer                         : sal_False;
206a1fa6b52SAndre Fischer 
207a1fa6b52SAndre Fischer                 default:
208a1fa6b52SAndre Fischer                     break;
209a1fa6b52SAndre Fischer             }
210a1fa6b52SAndre Fischer     }
211a1fa6b52SAndre Fischer 
212a1fa6b52SAndre Fischer     return Window::Notify(rEvent);
213a1fa6b52SAndre Fischer }
214a1fa6b52SAndre Fischer 
ProcessWheelEvent(CommandEvent * pCommandEvent,NotifyEvent & rEvent)215a1fa6b52SAndre Fischer bool Deck::ProcessWheelEvent (
216a1fa6b52SAndre Fischer     CommandEvent* pCommandEvent,
217a1fa6b52SAndre Fischer     NotifyEvent& rEvent)
2183fac691dSAndre Fischer {
219a1fa6b52SAndre Fischer     if ( ! mpVerticalScrollBar)
220a1fa6b52SAndre Fischer         return false;
221a1fa6b52SAndre Fischer     if ( ! mpVerticalScrollBar->IsVisible())
222a1fa6b52SAndre Fischer         return false;
2233fac691dSAndre Fischer 
224a1fa6b52SAndre Fischer     // Ignore all wheel commands from outside the vertical scroll bar.
225a1fa6b52SAndre Fischer     // Otherwise after a scroll we might land on a spin field and
226a1fa6b52SAndre Fischer     // subsequent wheel events would change the value of that control.
2273fac691dSAndre Fischer     if (rEvent.GetWindow() != mpVerticalScrollBar.get())
228a1fa6b52SAndre Fischer         return true;
2293fac691dSAndre Fischer 
230a1fa6b52SAndre Fischer     // Get the wheel data and check that it describes a valid vertical
231a1fa6b52SAndre Fischer     // scroll.
2323fac691dSAndre Fischer     const CommandWheelData* pData = pCommandEvent->GetWheelData();
2333fac691dSAndre Fischer     if (pData==NULL
2343fac691dSAndre Fischer         || pData->GetModifier()
2353fac691dSAndre Fischer         || pData->GetMode() != COMMAND_WHEEL_SCROLL
2363fac691dSAndre Fischer         || pData->IsHorz())
237a1fa6b52SAndre Fischer         return false;
2383fac691dSAndre Fischer 
2393fac691dSAndre Fischer     // Execute the actual scroll action.
2403fac691dSAndre Fischer     long nDelta = pData->GetDelta();
2413fac691dSAndre Fischer     mpVerticalScrollBar->DoScroll(
2423fac691dSAndre Fischer         mpVerticalScrollBar->GetThumbPos() - nDelta);
243a1fa6b52SAndre Fischer     return true;
2443fac691dSAndre Fischer }
2453fac691dSAndre Fischer 
SetPanels(const SharedPanelContainer & rPanels)246f120fe41SAndre Fischer void Deck::SetPanels (const SharedPanelContainer& rPanels)
247ff12d537SAndre Fischer {
248f120fe41SAndre Fischer     maPanels = rPanels;
249ff12d537SAndre Fischer 
250ff12d537SAndre Fischer     RequestLayout();
251ff12d537SAndre Fischer }
252ff12d537SAndre Fischer 
GetPanels(void) const253f120fe41SAndre Fischer const SharedPanelContainer& Deck::GetPanels (void) const
254f120fe41SAndre Fischer {
255f120fe41SAndre Fischer     return maPanels;
256f120fe41SAndre Fischer }
257f120fe41SAndre Fischer 
RequestLayout(void)258ff12d537SAndre Fischer void Deck::RequestLayout (void)
259ff12d537SAndre Fischer {
2607a32b0c8SAndre Fischer     DeckLayouter::LayoutDeck(
2617a32b0c8SAndre Fischer         GetContentArea(),
2627a32b0c8SAndre Fischer         maPanels,
2637a32b0c8SAndre Fischer         *GetTitleBar(),
2647a32b0c8SAndre Fischer         *mpScrollClipWindow,
2657a32b0c8SAndre Fischer         *mpScrollContainer,
2667a32b0c8SAndre Fischer         *mpFiller,
2677a32b0c8SAndre Fischer         *mpVerticalScrollBar);
268ff12d537SAndre Fischer }
269ff12d537SAndre Fischer 
GetPanelParentWindow(void)2707a32b0c8SAndre Fischer ::Window* Deck::GetPanelParentWindow (void)
271ff12d537SAndre Fischer {
2727a32b0c8SAndre Fischer     return mpScrollContainer.get();
2737a32b0c8SAndre Fischer }
274ff12d537SAndre Fischer 
ShowPanel(const Panel & rPanel)27552d13b84SAndre Fischer void Deck::ShowPanel (const Panel& rPanel)
27652d13b84SAndre Fischer {
27752d13b84SAndre Fischer     if (mpVerticalScrollBar && mpVerticalScrollBar->IsVisible())
27852d13b84SAndre Fischer     {
27952d13b84SAndre Fischer         // Get vertical extent of the panel.
28052d13b84SAndre Fischer         sal_Int32 nPanelTop (rPanel.GetPosPixel().Y());
28152d13b84SAndre Fischer         const sal_Int32 nPanelBottom (nPanelTop + rPanel.GetSizePixel().Height() - 1);
28252d13b84SAndre Fischer         // Add the title bar into the extent.
28352d13b84SAndre Fischer         if (rPanel.GetTitleBar() != NULL && rPanel.GetTitleBar()->IsVisible())
28452d13b84SAndre Fischer             nPanelTop = rPanel.GetTitleBar()->GetPosPixel().Y();
28552d13b84SAndre Fischer 
28652d13b84SAndre Fischer         // Determine what the new thumb position should be like.
28752d13b84SAndre Fischer         // When the whole panel does not fit then make its top visible
28852d13b84SAndre Fischer         // and it off at the bottom.
28952d13b84SAndre Fischer         sal_Int32 nNewThumbPos (mpVerticalScrollBar->GetThumbPos());
29052d13b84SAndre Fischer         if (nPanelBottom >= nNewThumbPos+mpVerticalScrollBar->GetVisibleSize())
29152d13b84SAndre Fischer             nNewThumbPos = nPanelBottom - mpVerticalScrollBar->GetVisibleSize();
29252d13b84SAndre Fischer         if (nPanelTop < nNewThumbPos)
29352d13b84SAndre Fischer             nNewThumbPos = nPanelTop;
29452d13b84SAndre Fischer 
29552d13b84SAndre Fischer         mpVerticalScrollBar->SetThumbPos(nNewThumbPos);
29652d13b84SAndre Fischer         mpScrollContainer->SetPosPixel(
29752d13b84SAndre Fischer             Point(
29852d13b84SAndre Fischer                 mpScrollContainer->GetPosPixel().X(),
29952d13b84SAndre Fischer                 -nNewThumbPos));
30052d13b84SAndre Fischer     }
30152d13b84SAndre Fischer }
30252d13b84SAndre Fischer 
GetWindowClassification(const Window * pWindow)3037a32b0c8SAndre Fischer const char* GetWindowClassification (const Window* pWindow)
304ff12d537SAndre Fischer {
3057a32b0c8SAndre Fischer     const String& rsName (pWindow->GetText());
3067a32b0c8SAndre Fischer     if (rsName.Len() > 0)
3077a32b0c8SAndre Fischer     {
3087a32b0c8SAndre Fischer         return ::rtl::OUStringToOString(rsName, RTL_TEXTENCODING_ASCII_US).getStr();
309ff12d537SAndre Fischer     }
310ff12d537SAndre Fischer     else
311ff12d537SAndre Fischer     {
3127a32b0c8SAndre Fischer         static char msWindow[] = "window";
3137a32b0c8SAndre Fischer         return msWindow;
314ff12d537SAndre Fischer     }
315ff12d537SAndre Fischer }
316ff12d537SAndre Fischer 
PrintWindowSubTree(Window * pRoot,int nIndentation)3177a32b0c8SAndre Fischer void Deck::PrintWindowSubTree (Window* pRoot, int nIndentation)
318ff12d537SAndre Fischer {
31945da7d5eSAndre Fischer     static const char* sIndentation = "                                                                  ";
3207a32b0c8SAndre Fischer     const Point aLocation (pRoot->GetPosPixel());
3217a32b0c8SAndre Fischer     const Size aSize (pRoot->GetSizePixel());
3227a32b0c8SAndre Fischer     const char* sClassification = GetWindowClassification(pRoot);
3237a32b0c8SAndre Fischer     const char* sVisible = pRoot->IsVisible() ? "visible" : "hidden";
3247a32b0c8SAndre Fischer     OSL_TRACE("%s%x %s %s +%d+%d x%dx%d",
3257a32b0c8SAndre Fischer         sIndentation+strlen(sIndentation)-nIndentation*4,
3267a32b0c8SAndre Fischer         pRoot,
3277a32b0c8SAndre Fischer         sClassification,
3287a32b0c8SAndre Fischer         sVisible,
3297a32b0c8SAndre Fischer         aLocation.X(),aLocation.Y(),
3307a32b0c8SAndre Fischer         aSize.Width(),aSize.Height());
331b9e67834SAndre Fischer 
3327a32b0c8SAndre Fischer     const sal_uInt16 nChildCount (pRoot->GetChildCount());
3337a32b0c8SAndre Fischer     for (sal_uInt16 nIndex=0; nIndex<nChildCount; ++nIndex)
3347a32b0c8SAndre Fischer         PrintWindowSubTree(pRoot->GetChild(nIndex), nIndentation+1);
3357a32b0c8SAndre Fischer }
336ff12d537SAndre Fischer 
PrintWindowTree(void)3377a32b0c8SAndre Fischer void Deck::PrintWindowTree (void)
338ff12d537SAndre Fischer {
3397a32b0c8SAndre Fischer     PrintWindowSubTree(this, 0);
3407a32b0c8SAndre Fischer }
34195a18594SAndre Fischer 
PrintWindowTree(const::std::vector<Panel * > & rPanels)3427a32b0c8SAndre Fischer void Deck::PrintWindowTree (const ::std::vector<Panel*>& rPanels)
343ff12d537SAndre Fischer {
3447a32b0c8SAndre Fischer     (void)rPanels;
3457a32b0c8SAndre Fischer 
3467a32b0c8SAndre Fischer     PrintWindowTree();
3477a32b0c8SAndre Fischer }
3487a32b0c8SAndre Fischer 
IMPL_LINK(Deck,HandleVerticalScrollBarChange,void *,EMPTYARG)3497a32b0c8SAndre Fischer IMPL_LINK(Deck, HandleVerticalScrollBarChange,void*, EMPTYARG)
350ff12d537SAndre Fischer {
3517a32b0c8SAndre Fischer     const sal_Int32 nYOffset (-mpVerticalScrollBar->GetThumbPos());
3527a32b0c8SAndre Fischer     mpScrollContainer->SetPosPixel(
3537a32b0c8SAndre Fischer         Point(
3547a32b0c8SAndre Fischer             mpScrollContainer->GetPosPixel().X(),
3557a32b0c8SAndre Fischer             nYOffset));
3567a32b0c8SAndre Fischer     return sal_True;
3577a32b0c8SAndre Fischer }
3587a32b0c8SAndre Fischer 
3597a32b0c8SAndre Fischer //----- Deck::ScrollContainerWindow -------------------------------------------
3607a32b0c8SAndre Fischer 
ScrollContainerWindow(Window * pParentWindow)3617a32b0c8SAndre Fischer Deck::ScrollContainerWindow::ScrollContainerWindow (Window* pParentWindow)
3627a32b0c8SAndre Fischer     : Window(pParentWindow),
3637a32b0c8SAndre Fischer       maSeparators()
36495a18594SAndre Fischer {
3657a32b0c8SAndre Fischer #ifdef DEBUG
3667a32b0c8SAndre Fischer     SetText(A2S("ScrollContainerWindow"));
3677a32b0c8SAndre Fischer #endif
368ff12d537SAndre Fischer }
3697a32b0c8SAndre Fischer 
~ScrollContainerWindow(void)3707a32b0c8SAndre Fischer Deck::ScrollContainerWindow::~ScrollContainerWindow (void)
371ff12d537SAndre Fischer {
37295a18594SAndre Fischer }
3737a32b0c8SAndre Fischer 
Paint(const Rectangle & rUpdateArea)3747a32b0c8SAndre Fischer void Deck::ScrollContainerWindow::Paint (const Rectangle& rUpdateArea)
37595a18594SAndre Fischer {
3767a32b0c8SAndre Fischer     (void)rUpdateArea;
377ff12d537SAndre Fischer 
3787a32b0c8SAndre Fischer     // Paint the separators.
3797a32b0c8SAndre Fischer     const sal_Int32 nSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
3807a32b0c8SAndre Fischer     const sal_Int32 nLeft (0);
3817a32b0c8SAndre Fischer     const sal_Int32 nRight (GetSizePixel().Width()-1);
3827a32b0c8SAndre Fischer     const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder));
3837a32b0c8SAndre Fischer     for (::std::vector<sal_Int32>::const_iterator iY(maSeparators.begin()), iEnd(maSeparators.end());
3847a32b0c8SAndre Fischer          iY!=iEnd;
3857a32b0c8SAndre Fischer          ++iY)
386ff12d537SAndre Fischer     {
3877a32b0c8SAndre Fischer         DrawHelper::DrawHorizontalLine(
3887a32b0c8SAndre Fischer             *this,
3897a32b0c8SAndre Fischer             nLeft,
3907a32b0c8SAndre Fischer             nRight,
3917a32b0c8SAndre Fischer             *iY,
3927a32b0c8SAndre Fischer             nSeparatorHeight,
3937a32b0c8SAndre Fischer             rHorizontalBorderPaint);
3947a32b0c8SAndre Fischer     }
395ff12d537SAndre Fischer }
396ff12d537SAndre Fischer 
SetSeparators(const::std::vector<sal_Int32> & rSeparators)3977a32b0c8SAndre Fischer void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>& rSeparators)
398ff12d537SAndre Fischer {
3997a32b0c8SAndre Fischer     maSeparators = rSeparators;
400ff12d537SAndre Fischer }
401ff12d537SAndre Fischer 
402ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
403*549760eaSmseidel 
404*549760eaSmseidel /* vim: set noet sw=4 ts=4: */
405