xref: /aoo42x/main/sfx2/source/sidebar/Sidebar.cxx (revision 3091fa8a)
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 
33 
ShowPanel(const::rtl::OUString & rsPanelId,const Reference<frame::XFrame> & rxFrame)34 void Sidebar::ShowPanel (
35     const ::rtl::OUString& rsPanelId,
36     const Reference<frame::XFrame>& rxFrame)
37 {
38     SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
39     const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
40     if (pController!=NULL && pPanelDescriptor != NULL)
41     {
42         // This should be a lot more sophisticated:
43         // - Make the deck switching asynchronous
44         // - Make sure that the panel is visible and expanded after
45         // the switch.
46         // - Make sure to use a context that really shows the panel
47         //
48         // All that is not necessary for the current use cases so lets
49         // keep it simple for the time being.
50         pController->RequestSwitchToDeck(pPanelDescriptor->msDeckId);
51     }
52 }
53 
54 
55 
56 
ShowDeck(const::rtl::OUString & rsDeckId,const Reference<frame::XFrame> & rxFrame)57 void Sidebar::ShowDeck (
58     const ::rtl::OUString& rsDeckId,
59     const Reference<frame::XFrame>& rxFrame)
60 {
61     SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
62     if (pController != NULL)
63         pController->RequestSwitchToDeck(rsDeckId);
64 }
65 
66 } } // end of namespace sfx2::sidebar
67