1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include "precompiled_sd.hxx"
23 
24 #include "NavigatorWrapper.hxx"
25 #include "navigatr.hrc"
26 #include "ViewShellBase.hxx"
27 
28 #include <sfx2/sidebar/Theme.hxx>
29 
30 #include <boost/bind.hpp>
31 
32 
33 namespace sd { namespace sidebar {
34 
35 NavigatorWrapper::NavigatorWrapper (
36     ::Window* pParent,
37     sd::ViewShellBase& rViewShellBase,
38     SfxBindings* pBindings)
39     : Control(pParent, 0),
40       mrViewShellBase(rViewShellBase),
41       maNavigator(
42         this,
43         NULL,
44         SdResId(FLT_NAVIGATOR),
45         pBindings,
46         ::boost::bind(&NavigatorWrapper::UpdateNavigator, this))
47 {
48     maNavigator.SetPosSizePixel(
49         Point(0,0),
50         GetSizePixel());
51     maNavigator.SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
52     maNavigator.Show();
53 }
54 
55 
56 
57 
58 NavigatorWrapper::~NavigatorWrapper (void)
59 {
60 }
61 
62 
63 
64 
65 void NavigatorWrapper::Resize (void)
66 {
67     maNavigator.SetSizePixel(GetSizePixel());
68 }
69 
70 
71 
72 
73 css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth)
74 {
75     (void)nWidth;
76 
77     return css::ui::LayoutSize(-1,-1,-1);
78 }
79 
80 
81 
82 
83 void NavigatorWrapper::UpdateNavigator (void)
84 {
85     maNavigator.InitTreeLB(mrViewShellBase.GetDocument());
86 }
87 
88 
89 
90 
91 void NavigatorWrapper::GetFocus (void)
92 {
93     maNavigator.GrabFocus();
94 }
95 
96 
97 
98 } } // end of namespace sd::sidebar
99