xref: /AOO42X/main/sfx2/source/sidebar/Sidebar.cxx (revision 055746153e5cd78346b485d23b1c8e3408d513f1)
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_sfx2.hxx"
23 
24 #include "sfx2/sidebar/Sidebar.hxx"
25 #include "SidebarController.hxx"
26 #include "ResourceManager.hxx"
27 
28 using namespace css;
29 using namespace cssu;
30 
31 namespace sfx2 { namespace sidebar {
32 
ShowPanel(const::rtl::OUString & rsPanelId,const Reference<frame::XFrame> & rxFrame)33 void Sidebar::ShowPanel (
34     const ::rtl::OUString& rsPanelId,
35     const Reference<frame::XFrame>& rxFrame)
36 {
37     SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
38     const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
39     if (pController!=NULL && pPanelDescriptor != NULL)
40     {
41         // This should be a lot more sophisticated:
42         // - Make the deck switching asynchronous
43         // - Make sure that the panel is visible and expanded after
44         //   the switch.
45         // - Make sure to use a context that really shows the panel
46         //
47         // All that is not necessary for the current use cases so let's
48         // keep it simple for the time being.
49         pController->RequestSwitchToDeck(pPanelDescriptor->msDeckId);
50     }
51 }
52 
ShowDeck(const::rtl::OUString & rsDeckId,const Reference<frame::XFrame> & rxFrame)53 void Sidebar::ShowDeck (
54     const ::rtl::OUString& rsDeckId,
55     const Reference<frame::XFrame>& rxFrame)
56 {
57     SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
58     if (pController != NULL)
59         pController->RequestSwitchToDeck(rsDeckId);
60 }
61 
62 } } // end of namespace sfx2::sidebar
63 
64 /* vim: set noet sw=4 ts=4: */
65