Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "NavigatorWrapper.hxx"
21 : #include "navigatr.hrc"
22 : #include "ViewShellBase.hxx"
23 :
24 : #include <sfx2/sidebar/Theme.hxx>
25 :
26 : #include <boost/bind.hpp>
27 :
28 : namespace sd { namespace sidebar {
29 :
30 0 : NavigatorWrapper::NavigatorWrapper (
31 : vcl::Window* pParent,
32 : sd::ViewShellBase& rViewShellBase,
33 : SfxBindings* pBindings)
34 : : Control(pParent, 0),
35 : mrViewShellBase(rViewShellBase),
36 : maNavigator(VclPtr<SdNavigatorWin>::Create(
37 : this,
38 : nullptr,
39 : SdResId(FLT_NAVIGATOR),
40 0 : pBindings))
41 : {
42 0 : maNavigator->SetUpdateRequestFunctor(::boost::bind(&NavigatorWrapper::UpdateNavigator, this));
43 0 : maNavigator->SetPosSizePixel(
44 : Point(0,0),
45 0 : GetSizePixel());
46 0 : maNavigator->SetBackground(sfx2::sidebar::Theme::GetWallpaper(sfx2::sidebar::Theme::Paint_PanelBackground));
47 0 : maNavigator->Show();
48 0 : }
49 :
50 0 : NavigatorWrapper::~NavigatorWrapper()
51 : {
52 0 : disposeOnce();
53 0 : }
54 :
55 0 : void NavigatorWrapper::dispose()
56 : {
57 0 : maNavigator.disposeAndClear();
58 0 : Control::dispose();
59 0 : }
60 :
61 0 : void NavigatorWrapper::Resize()
62 : {
63 0 : maNavigator->SetSizePixel(GetSizePixel());
64 0 : }
65 :
66 0 : css::ui::LayoutSize NavigatorWrapper::GetHeightForWidth (const sal_Int32 nWidth)
67 : {
68 : (void)nWidth;
69 :
70 0 : return css::ui::LayoutSize(-1,-1,-1);
71 : }
72 :
73 0 : void NavigatorWrapper::UpdateNavigator()
74 : {
75 0 : maNavigator->InitTreeLB(mrViewShellBase.GetDocument());
76 0 : }
77 :
78 0 : void NavigatorWrapper::GetFocus()
79 : {
80 0 : if (maNavigator)
81 0 : maNavigator->GrabFocus();
82 : else
83 0 : Control::GetFocus();
84 0 : }
85 :
86 66 : } } // end of namespace sd::sidebar
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|