xref: /AOO41X/main/sfx2/source/sidebar/Deck.cxx (revision 3ce09a58b0d6873449cda31e55c66dba2dbc8f7f)
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"
29*8a1a651aSAndre 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 
4522de8995SAndre Fischer 
46ff12d537SAndre Fischer namespace sfx2 { namespace sidebar {
47ff12d537SAndre Fischer 
48ff12d537SAndre Fischer 
49ff12d537SAndre Fischer namespace {
50ff12d537SAndre Fischer     static const sal_Int32 MinimalPanelHeight (25);
51ff12d537SAndre Fischer }
52ff12d537SAndre Fischer 
53ff12d537SAndre Fischer 
Deck(const DeckDescriptor & rDeckDescriptor,Window * pParentWindow,const::boost::function<void (void)> & rCloserAction)5422de8995SAndre Fischer Deck::Deck (
5522de8995SAndre Fischer     const DeckDescriptor& rDeckDescriptor,
567a32b0c8SAndre Fischer     Window* pParentWindow,
577a32b0c8SAndre Fischer     const ::boost::function<void(void)>& rCloserAction)
5865908a7eSAndre Fischer     : Window(pParentWindow, 0),
5922de8995SAndre Fischer       msId(rDeckDescriptor.msId),
60ff12d537SAndre Fischer       maIcon(),
61ff12d537SAndre Fischer       msIconURL(rDeckDescriptor.msIconURL),
62ff12d537SAndre Fischer       msHighContrastIconURL(rDeckDescriptor.msHighContrastIconURL),
63b9e67834SAndre Fischer       maPanels(),
647a32b0c8SAndre Fischer       mpTitleBar(new DeckTitleBar(rDeckDescriptor.msTitle, this, rCloserAction)),
657a32b0c8SAndre Fischer       mpScrollClipWindow(new Window(this)),
667a32b0c8SAndre Fischer       mpScrollContainer(new ScrollContainerWindow(mpScrollClipWindow.get())),
677a32b0c8SAndre Fischer       mpFiller(new Window(this)),
687a32b0c8SAndre Fischer       mpVerticalScrollBar(new ScrollBar(this))
6922de8995SAndre Fischer {
7022de8995SAndre Fischer     SetBackground(Wallpaper());
717a32b0c8SAndre Fischer 
727a32b0c8SAndre Fischer     mpScrollClipWindow->SetBackground(Wallpaper());
7365908a7eSAndre Fischer     mpScrollClipWindow->Show();
7465908a7eSAndre Fischer 
7565908a7eSAndre Fischer     mpScrollContainer->SetStyle(mpScrollContainer->GetStyle() | WB_DIALOGCONTROL);
767a32b0c8SAndre Fischer     mpScrollContainer->SetBackground(Wallpaper());
7765908a7eSAndre Fischer     mpScrollContainer->Show();
787a32b0c8SAndre Fischer 
797a32b0c8SAndre Fischer     mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, HandleVerticalScrollBarChange));
807a32b0c8SAndre Fischer 
817a32b0c8SAndre Fischer #ifdef DEBUG
827a32b0c8SAndre Fischer     SetText(A2S("Deck"));
837a32b0c8SAndre Fischer     mpScrollClipWindow->SetText(A2S("ScrollClipWindow"));
847a32b0c8SAndre Fischer     mpFiller->SetText(A2S("Filler"));
857a32b0c8SAndre Fischer     mpVerticalScrollBar->SetText(A2S("VerticalScrollBar"));
867a32b0c8SAndre Fischer #endif
8722de8995SAndre Fischer }
8822de8995SAndre Fischer 
8922de8995SAndre Fischer 
9022de8995SAndre Fischer 
9122de8995SAndre Fischer 
~Deck(void)9222de8995SAndre Fischer Deck::~Deck (void)
9322de8995SAndre Fischer {
94ff12d537SAndre Fischer     Dispose();
95f120fe41SAndre Fischer 
96f120fe41SAndre Fischer     // We have to explicitly trigger the destruction of panels.
97f120fe41SAndre Fischer     // Otherwise that is done by one of our base class destructors
98f120fe41SAndre Fischer     // without updating maPanels.
99f120fe41SAndre Fischer     maPanels.clear();
100ff12d537SAndre Fischer }
101ff12d537SAndre Fischer 
102ff12d537SAndre Fischer 
103ff12d537SAndre Fischer 
104ff12d537SAndre Fischer 
Dispose(void)105ff12d537SAndre Fischer void Deck::Dispose (void)
106ff12d537SAndre Fischer {
107f120fe41SAndre Fischer     SharedPanelContainer aPanels;
108ff12d537SAndre Fischer     aPanels.swap(maPanels);
109f120fe41SAndre Fischer     for (SharedPanelContainer::iterator
110ff12d537SAndre Fischer              iPanel(aPanels.begin()),
111ff12d537SAndre Fischer              iEnd(aPanels.end());
112ff12d537SAndre Fischer          iPanel!=iEnd;
113ff12d537SAndre Fischer          ++iPanel)
114ff12d537SAndre Fischer     {
115f120fe41SAndre Fischer 		if (*iPanel)
116f120fe41SAndre Fischer         {
117ff12d537SAndre Fischer 			(*iPanel)->Dispose();
118f120fe41SAndre Fischer             OSL_ASSERT(iPanel->unique());
119f120fe41SAndre Fischer             iPanel->reset();
120f120fe41SAndre Fischer         }
121ff12d537SAndre Fischer     }
1227a32b0c8SAndre Fischer 
1237a32b0c8SAndre Fischer     mpTitleBar.reset();
1247a32b0c8SAndre Fischer     mpFiller.reset();
1257a32b0c8SAndre Fischer     mpVerticalScrollBar.reset();
12622de8995SAndre Fischer }
12722de8995SAndre Fischer 
12822de8995SAndre Fischer 
12922de8995SAndre Fischer 
13022de8995SAndre Fischer 
GetId(void) const13122de8995SAndre Fischer const ::rtl::OUString& Deck::GetId (void) const
13222de8995SAndre Fischer {
13322de8995SAndre Fischer     return msId;
13422de8995SAndre Fischer }
13522de8995SAndre Fischer 
13622de8995SAndre Fischer 
13722de8995SAndre Fischer 
13822de8995SAndre Fischer 
GetTitleBar(void) const1397a32b0c8SAndre Fischer DeckTitleBar* Deck::GetTitleBar (void) const
14022de8995SAndre Fischer {
1417a32b0c8SAndre Fischer     return mpTitleBar.get();
14222de8995SAndre Fischer }
14322de8995SAndre Fischer 
14422de8995SAndre Fischer 
14522de8995SAndre Fischer 
14622de8995SAndre Fischer 
GetContentArea(void) const147ff12d537SAndre Fischer Rectangle Deck::GetContentArea (void) const
14822de8995SAndre Fischer {
149ff12d537SAndre Fischer     const Size aWindowSize (GetSizePixel());
150b9e67834SAndre Fischer     const int nBorderSize (Theme::GetInteger(Theme::Int_DeckBorderSize));
151ff12d537SAndre Fischer 
152ff12d537SAndre Fischer     return Rectangle(
153b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_DeckLeftPadding) + nBorderSize,
154b9e67834SAndre Fischer         Theme::GetInteger(Theme::Int_DeckTopPadding) + nBorderSize,
155b9e67834SAndre Fischer         aWindowSize.Width() - 1 - Theme::GetInteger(Theme::Int_DeckRightPadding) - nBorderSize,
156b9e67834SAndre Fischer         aWindowSize.Height() - 1 - Theme::GetInteger(Theme::Int_DeckBottomPadding) - nBorderSize);
15722de8995SAndre Fischer }
15822de8995SAndre Fischer 
15922de8995SAndre Fischer 
160ff12d537SAndre Fischer 
161ff12d537SAndre Fischer 
GetIconURL(const bool bIsHighContrastModeActive) const162ff12d537SAndre Fischer ::rtl::OUString Deck::GetIconURL (const bool bIsHighContrastModeActive) const
163ff12d537SAndre Fischer {
164ff12d537SAndre Fischer     if (bIsHighContrastModeActive)
165ff12d537SAndre Fischer         return msHighContrastIconURL;
166ff12d537SAndre Fischer     else
167ff12d537SAndre Fischer         return msIconURL;
168ff12d537SAndre Fischer }
169ff12d537SAndre Fischer 
170ff12d537SAndre Fischer 
171ff12d537SAndre Fischer 
172ff12d537SAndre Fischer 
Paint(const Rectangle & rUpdateArea)173ff12d537SAndre Fischer void Deck::Paint (const Rectangle& rUpdateArea)
174ff12d537SAndre Fischer {
17595a18594SAndre Fischer     (void) rUpdateArea;
17695a18594SAndre Fischer 
177ff12d537SAndre Fischer     const Size aWindowSize (GetSizePixel());
178b9e67834SAndre Fischer     const SvBorder aPadding (
179b9e67834SAndre Fischer             Theme::GetInteger(Theme::Int_DeckLeftPadding),
180b9e67834SAndre Fischer             Theme::GetInteger(Theme::Int_DeckTopPadding),
181b9e67834SAndre Fischer             Theme::GetInteger(Theme::Int_DeckRightPadding),
182b9e67834SAndre Fischer             Theme::GetInteger(Theme::Int_DeckBottomPadding));
183ff12d537SAndre Fischer 
184ff12d537SAndre Fischer     // Paint deck background outside the border.
185b9e67834SAndre Fischer     Rectangle aBox(
186ff12d537SAndre Fischer         0,
187ff12d537SAndre Fischer         0,
188ff12d537SAndre Fischer         aWindowSize.Width() - 1,
189b9e67834SAndre Fischer         aWindowSize.Height() - 1);
190ff12d537SAndre Fischer     DrawHelper::DrawBorder(
191ff12d537SAndre Fischer         *this,
192b9e67834SAndre Fischer         aBox,
193b9e67834SAndre Fischer         aPadding,
194b9e67834SAndre Fischer         Theme::GetPaint(Theme::Paint_DeckBackground),
195b9e67834SAndre Fischer         Theme::GetPaint(Theme::Paint_DeckBackground));
196b9e67834SAndre Fischer 
197b9e67834SAndre Fischer     // Paint the border.
198b9e67834SAndre Fischer     const int nBorderSize (Theme::GetInteger(Theme::Int_DeckBorderSize));
199b9e67834SAndre Fischer     aBox.Left() += aPadding.Left();
200b9e67834SAndre Fischer     aBox.Top() += aPadding.Top();
201b9e67834SAndre Fischer     aBox.Right() -= aPadding.Right();
202b9e67834SAndre Fischer     aBox.Bottom() -= aPadding.Bottom();
203b9e67834SAndre Fischer     const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder));
204b9e67834SAndre Fischer     DrawHelper::DrawBorder(
205b9e67834SAndre Fischer         *this,
206b9e67834SAndre Fischer         aBox,
207ff12d537SAndre Fischer         SvBorder(nBorderSize, nBorderSize, nBorderSize, nBorderSize),
208b9e67834SAndre Fischer         rHorizontalBorderPaint,
209b9e67834SAndre Fischer         Theme::GetPaint(Theme::Paint_VerticalBorder));
210b9e67834SAndre Fischer }
211b9e67834SAndre Fischer 
212b9e67834SAndre Fischer 
213b9e67834SAndre Fischer 
214b9e67834SAndre Fischer 
DataChanged(const DataChangedEvent & rEvent)215b9e67834SAndre Fischer void Deck::DataChanged (const DataChangedEvent& rEvent)
216b9e67834SAndre Fischer {
217b9e67834SAndre Fischer     (void)rEvent;
218b9e67834SAndre Fischer     RequestLayout();
219ff12d537SAndre Fischer }
220ff12d537SAndre Fischer 
221ff12d537SAndre Fischer 
222ff12d537SAndre Fischer 
223ff12d537SAndre Fischer 
Notify(NotifyEvent & rEvent)2243fac691dSAndre Fischer long Deck::Notify (NotifyEvent& rEvent)
2253fac691dSAndre Fischer {
226a1fa6b52SAndre Fischer     if (rEvent.GetType() == EVENT_COMMAND)
227a1fa6b52SAndre Fischer     {
2283fac691dSAndre Fischer         CommandEvent* pCommandEvent = reinterpret_cast<CommandEvent*>(rEvent.GetData());
229a1fa6b52SAndre Fischer         if (pCommandEvent != NULL)
2303fac691dSAndre Fischer             switch (pCommandEvent->GetCommand())
2313fac691dSAndre Fischer             {
2323fac691dSAndre Fischer                 case COMMAND_WHEEL:
233a1fa6b52SAndre Fischer                     return ProcessWheelEvent(pCommandEvent, rEvent)
234a1fa6b52SAndre Fischer                         ? sal_True
235a1fa6b52SAndre Fischer                         : sal_False;
236a1fa6b52SAndre Fischer 
237a1fa6b52SAndre Fischer                 default:
238a1fa6b52SAndre Fischer                     break;
239a1fa6b52SAndre Fischer             }
240a1fa6b52SAndre Fischer     }
241a1fa6b52SAndre Fischer 
242a1fa6b52SAndre Fischer     return Window::Notify(rEvent);
243a1fa6b52SAndre Fischer }
244a1fa6b52SAndre Fischer 
245a1fa6b52SAndre Fischer 
246a1fa6b52SAndre Fischer 
247a1fa6b52SAndre Fischer 
ProcessWheelEvent(CommandEvent * pCommandEvent,NotifyEvent & rEvent)248a1fa6b52SAndre Fischer bool Deck::ProcessWheelEvent (
249a1fa6b52SAndre Fischer     CommandEvent* pCommandEvent,
250a1fa6b52SAndre Fischer     NotifyEvent& rEvent)
2513fac691dSAndre Fischer {
252a1fa6b52SAndre Fischer     if ( ! mpVerticalScrollBar)
253a1fa6b52SAndre Fischer         return false;
254a1fa6b52SAndre Fischer     if ( ! mpVerticalScrollBar->IsVisible())
255a1fa6b52SAndre Fischer         return false;
2563fac691dSAndre Fischer 
257a1fa6b52SAndre Fischer     // Ignore all wheel commands from outside the vertical scroll bar.
258a1fa6b52SAndre Fischer     // Otherwise after a scroll we might land on a spin field and
259a1fa6b52SAndre Fischer     // subsequent wheel events would change the value of that control.
2603fac691dSAndre Fischer     if (rEvent.GetWindow() != mpVerticalScrollBar.get())
261a1fa6b52SAndre Fischer         return true;
2623fac691dSAndre Fischer 
263a1fa6b52SAndre Fischer     // Get the wheel data and check that it describes a valid vertical
264a1fa6b52SAndre Fischer     // scroll.
2653fac691dSAndre Fischer     const CommandWheelData* pData = pCommandEvent->GetWheelData();
2663fac691dSAndre Fischer     if (pData==NULL
2673fac691dSAndre Fischer         || pData->GetModifier()
2683fac691dSAndre Fischer         || pData->GetMode() != COMMAND_WHEEL_SCROLL
2693fac691dSAndre Fischer         || pData->IsHorz())
270a1fa6b52SAndre Fischer         return false;
2713fac691dSAndre Fischer 
2723fac691dSAndre Fischer     // Execute the actual scroll action.
2733fac691dSAndre Fischer     long nDelta = pData->GetDelta();
2743fac691dSAndre Fischer     mpVerticalScrollBar->DoScroll(
2753fac691dSAndre Fischer         mpVerticalScrollBar->GetThumbPos() - nDelta);
276a1fa6b52SAndre Fischer     return true;
2773fac691dSAndre Fischer }
2783fac691dSAndre Fischer 
2793fac691dSAndre Fischer 
2803fac691dSAndre Fischer 
2813fac691dSAndre Fischer 
SetPanels(const SharedPanelContainer & rPanels)282f120fe41SAndre Fischer void Deck::SetPanels (const SharedPanelContainer& rPanels)
283ff12d537SAndre Fischer {
284f120fe41SAndre Fischer     maPanels = rPanels;
285ff12d537SAndre Fischer 
286ff12d537SAndre Fischer     RequestLayout();
287ff12d537SAndre Fischer }
288ff12d537SAndre Fischer 
289ff12d537SAndre Fischer 
290ff12d537SAndre Fischer 
291ff12d537SAndre Fischer 
GetPanels(void) const292f120fe41SAndre Fischer const SharedPanelContainer& Deck::GetPanels (void) const
293f120fe41SAndre Fischer {
294f120fe41SAndre Fischer     return maPanels;
295f120fe41SAndre Fischer }
296f120fe41SAndre Fischer 
297f120fe41SAndre Fischer 
298f120fe41SAndre Fischer 
299f120fe41SAndre Fischer 
RequestLayout(void)300ff12d537SAndre Fischer void Deck::RequestLayout (void)
301ff12d537SAndre Fischer {
3027a32b0c8SAndre Fischer     DeckLayouter::LayoutDeck(
3037a32b0c8SAndre Fischer         GetContentArea(),
3047a32b0c8SAndre Fischer         maPanels,
3057a32b0c8SAndre Fischer         *GetTitleBar(),
3067a32b0c8SAndre Fischer         *mpScrollClipWindow,
3077a32b0c8SAndre Fischer         *mpScrollContainer,
3087a32b0c8SAndre Fischer         *mpFiller,
3097a32b0c8SAndre Fischer         *mpVerticalScrollBar);
310ff12d537SAndre Fischer }
311ff12d537SAndre Fischer 
312ff12d537SAndre Fischer 
313ff12d537SAndre Fischer 
314ff12d537SAndre Fischer 
GetPanelParentWindow(void)3157a32b0c8SAndre Fischer ::Window* Deck::GetPanelParentWindow (void)
316ff12d537SAndre Fischer {
3177a32b0c8SAndre Fischer     return mpScrollContainer.get();
3187a32b0c8SAndre Fischer }
319ff12d537SAndre Fischer 
320b9e67834SAndre Fischer 
3217a32b0c8SAndre Fischer 
3227a32b0c8SAndre Fischer 
ShowPanel(const Panel & rPanel)32352d13b84SAndre Fischer void Deck::ShowPanel (const Panel& rPanel)
32452d13b84SAndre Fischer {
32552d13b84SAndre Fischer     if (mpVerticalScrollBar && mpVerticalScrollBar->IsVisible())
32652d13b84SAndre Fischer     {
32752d13b84SAndre Fischer         // Get vertical extent of the panel.
32852d13b84SAndre Fischer         sal_Int32 nPanelTop (rPanel.GetPosPixel().Y());
32952d13b84SAndre Fischer         const sal_Int32 nPanelBottom (nPanelTop + rPanel.GetSizePixel().Height() - 1);
33052d13b84SAndre Fischer         // Add the title bar into the extent.
33152d13b84SAndre Fischer         if (rPanel.GetTitleBar() != NULL && rPanel.GetTitleBar()->IsVisible())
33252d13b84SAndre Fischer             nPanelTop = rPanel.GetTitleBar()->GetPosPixel().Y();
33352d13b84SAndre Fischer 
33452d13b84SAndre Fischer         // Determine what the new thumb position should be like.
33552d13b84SAndre Fischer         // When the whole panel does not fit then make its top visible
33652d13b84SAndre Fischer         // and it off at the bottom.
33752d13b84SAndre Fischer         sal_Int32 nNewThumbPos (mpVerticalScrollBar->GetThumbPos());
33852d13b84SAndre Fischer         if (nPanelBottom >= nNewThumbPos+mpVerticalScrollBar->GetVisibleSize())
33952d13b84SAndre Fischer             nNewThumbPos = nPanelBottom - mpVerticalScrollBar->GetVisibleSize();
34052d13b84SAndre Fischer         if (nPanelTop < nNewThumbPos)
34152d13b84SAndre Fischer             nNewThumbPos = nPanelTop;
34252d13b84SAndre Fischer 
34352d13b84SAndre Fischer         mpVerticalScrollBar->SetThumbPos(nNewThumbPos);
34452d13b84SAndre Fischer         mpScrollContainer->SetPosPixel(
34552d13b84SAndre Fischer             Point(
34652d13b84SAndre Fischer                 mpScrollContainer->GetPosPixel().X(),
34752d13b84SAndre Fischer                 -nNewThumbPos));
34852d13b84SAndre Fischer 
34952d13b84SAndre Fischer     }
35052d13b84SAndre Fischer }
35152d13b84SAndre Fischer 
35252d13b84SAndre Fischer 
35352d13b84SAndre Fischer 
35452d13b84SAndre Fischer 
GetWindowClassification(const Window * pWindow)3557a32b0c8SAndre Fischer const char* GetWindowClassification (const Window* pWindow)
356ff12d537SAndre Fischer {
3577a32b0c8SAndre Fischer     const String& rsName (pWindow->GetText());
3587a32b0c8SAndre Fischer     if (rsName.Len() > 0)
3597a32b0c8SAndre Fischer     {
3607a32b0c8SAndre Fischer         return ::rtl::OUStringToOString(rsName, RTL_TEXTENCODING_ASCII_US).getStr();
361ff12d537SAndre Fischer     }
362ff12d537SAndre Fischer     else
363ff12d537SAndre Fischer     {
3647a32b0c8SAndre Fischer         static char msWindow[] = "window";
3657a32b0c8SAndre Fischer         return msWindow;
366ff12d537SAndre Fischer     }
367ff12d537SAndre Fischer }
368ff12d537SAndre Fischer 
369ff12d537SAndre Fischer 
PrintWindowSubTree(Window * pRoot,int nIndentation)3707a32b0c8SAndre Fischer void Deck::PrintWindowSubTree (Window* pRoot, int nIndentation)
371ff12d537SAndre Fischer {
37245da7d5eSAndre Fischer     static const char* sIndentation = "                                                                  ";
3737a32b0c8SAndre Fischer     const Point aLocation (pRoot->GetPosPixel());
3747a32b0c8SAndre Fischer     const Size aSize (pRoot->GetSizePixel());
3757a32b0c8SAndre Fischer     const char* sClassification = GetWindowClassification(pRoot);
3767a32b0c8SAndre Fischer     const char* sVisible = pRoot->IsVisible() ? "visible" : "hidden";
3777a32b0c8SAndre Fischer     OSL_TRACE("%s%x %s %s +%d+%d x%dx%d",
3787a32b0c8SAndre Fischer         sIndentation+strlen(sIndentation)-nIndentation*4,
3797a32b0c8SAndre Fischer         pRoot,
3807a32b0c8SAndre Fischer         sClassification,
3817a32b0c8SAndre Fischer         sVisible,
3827a32b0c8SAndre Fischer         aLocation.X(),aLocation.Y(),
3837a32b0c8SAndre Fischer         aSize.Width(),aSize.Height());
384b9e67834SAndre Fischer 
3857a32b0c8SAndre Fischer     const sal_uInt16 nChildCount (pRoot->GetChildCount());
3867a32b0c8SAndre Fischer     for (sal_uInt16 nIndex=0; nIndex<nChildCount; ++nIndex)
3877a32b0c8SAndre Fischer         PrintWindowSubTree(pRoot->GetChild(nIndex), nIndentation+1);
3887a32b0c8SAndre Fischer }
389ff12d537SAndre Fischer 
3907a32b0c8SAndre Fischer 
3917a32b0c8SAndre Fischer 
3927a32b0c8SAndre Fischer 
PrintWindowTree(void)3937a32b0c8SAndre Fischer void Deck::PrintWindowTree (void)
394ff12d537SAndre Fischer {
3957a32b0c8SAndre Fischer     PrintWindowSubTree(this, 0);
3967a32b0c8SAndre Fischer }
39795a18594SAndre Fischer 
398ff12d537SAndre Fischer 
399ff12d537SAndre Fischer 
4007a32b0c8SAndre Fischer 
PrintWindowTree(const::std::vector<Panel * > & rPanels)4017a32b0c8SAndre Fischer void Deck::PrintWindowTree (const ::std::vector<Panel*>& rPanels)
402ff12d537SAndre Fischer {
4037a32b0c8SAndre Fischer     (void)rPanels;
4047a32b0c8SAndre Fischer 
4057a32b0c8SAndre Fischer     PrintWindowTree();
4067a32b0c8SAndre Fischer }
4077a32b0c8SAndre Fischer 
4087a32b0c8SAndre Fischer 
4097a32b0c8SAndre Fischer 
4107a32b0c8SAndre Fischer 
IMPL_LINK(Deck,HandleVerticalScrollBarChange,void *,EMPTYARG)4117a32b0c8SAndre Fischer IMPL_LINK(Deck, HandleVerticalScrollBarChange,void*, EMPTYARG)
412ff12d537SAndre Fischer {
4137a32b0c8SAndre Fischer     const sal_Int32 nYOffset (-mpVerticalScrollBar->GetThumbPos());
4147a32b0c8SAndre Fischer     mpScrollContainer->SetPosPixel(
4157a32b0c8SAndre Fischer         Point(
4167a32b0c8SAndre Fischer             mpScrollContainer->GetPosPixel().X(),
4177a32b0c8SAndre Fischer             nYOffset));
4187a32b0c8SAndre Fischer     return sal_True;
4197a32b0c8SAndre Fischer }
4207a32b0c8SAndre Fischer 
4217a32b0c8SAndre Fischer 
4227a32b0c8SAndre Fischer 
4237a32b0c8SAndre Fischer 
4247a32b0c8SAndre Fischer //----- Deck::ScrollContainerWindow -------------------------------------------
4257a32b0c8SAndre Fischer 
ScrollContainerWindow(Window * pParentWindow)4267a32b0c8SAndre Fischer Deck::ScrollContainerWindow::ScrollContainerWindow (Window* pParentWindow)
4277a32b0c8SAndre Fischer     : Window(pParentWindow),
4287a32b0c8SAndre Fischer       maSeparators()
42995a18594SAndre Fischer {
4307a32b0c8SAndre Fischer #ifdef DEBUG
4317a32b0c8SAndre Fischer     SetText(A2S("ScrollContainerWindow"));
4327a32b0c8SAndre Fischer #endif
433ff12d537SAndre Fischer }
4347a32b0c8SAndre Fischer 
4357a32b0c8SAndre Fischer 
4367a32b0c8SAndre Fischer 
4377a32b0c8SAndre Fischer 
~ScrollContainerWindow(void)4387a32b0c8SAndre Fischer Deck::ScrollContainerWindow::~ScrollContainerWindow (void)
439ff12d537SAndre Fischer {
44095a18594SAndre Fischer }
4417a32b0c8SAndre Fischer 
4427a32b0c8SAndre Fischer 
4437a32b0c8SAndre Fischer 
4447a32b0c8SAndre Fischer 
Paint(const Rectangle & rUpdateArea)4457a32b0c8SAndre Fischer void Deck::ScrollContainerWindow::Paint (const Rectangle& rUpdateArea)
44695a18594SAndre Fischer {
4477a32b0c8SAndre Fischer     (void)rUpdateArea;
448ff12d537SAndre Fischer 
4497a32b0c8SAndre Fischer     // Paint the separators.
4507a32b0c8SAndre Fischer     const sal_Int32 nSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
4517a32b0c8SAndre Fischer     const sal_Int32 nLeft  (0);
4527a32b0c8SAndre Fischer     const sal_Int32 nRight (GetSizePixel().Width()-1);
4537a32b0c8SAndre Fischer     const sfx2::sidebar::Paint& rHorizontalBorderPaint (Theme::GetPaint(Theme::Paint_HorizontalBorder));
4547a32b0c8SAndre Fischer     for (::std::vector<sal_Int32>::const_iterator iY(maSeparators.begin()), iEnd(maSeparators.end());
4557a32b0c8SAndre Fischer          iY!=iEnd;
4567a32b0c8SAndre Fischer          ++iY)
457ff12d537SAndre Fischer     {
4587a32b0c8SAndre Fischer         DrawHelper::DrawHorizontalLine(
4597a32b0c8SAndre Fischer             *this,
4607a32b0c8SAndre Fischer             nLeft,
4617a32b0c8SAndre Fischer             nRight,
4627a32b0c8SAndre Fischer             *iY,
4637a32b0c8SAndre Fischer             nSeparatorHeight,
4647a32b0c8SAndre Fischer             rHorizontalBorderPaint);
4657a32b0c8SAndre Fischer     }
466ff12d537SAndre Fischer }
467ff12d537SAndre Fischer 
4687a32b0c8SAndre Fischer 
4697a32b0c8SAndre Fischer 
4707a32b0c8SAndre Fischer 
SetSeparators(const::std::vector<sal_Int32> & rSeparators)4717a32b0c8SAndre Fischer void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>& rSeparators)
472ff12d537SAndre Fischer {
4737a32b0c8SAndre Fischer     maSeparators = rSeparators;
474ff12d537SAndre Fischer }
475ff12d537SAndre Fischer 
4763fac691dSAndre Fischer 
477ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
478