xref: /aoo41x/main/sfx2/source/sidebar/Sidebar.cxx (revision 3091fa8a)
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 
24*3091fa8aSAndre Fischer #include "sfx2/sidebar/Sidebar.hxx"
25*3091fa8aSAndre Fischer #include "SidebarController.hxx"
26ff12d537SAndre Fischer #include "ResourceManager.hxx"
2722de8995SAndre Fischer 
2822de8995SAndre Fischer using namespace css;
2922de8995SAndre Fischer using namespace cssu;
3022de8995SAndre Fischer 
31ff12d537SAndre Fischer namespace sfx2 { namespace sidebar {
3222de8995SAndre Fischer 
3322de8995SAndre Fischer 
ShowPanel(const::rtl::OUString & rsPanelId,const Reference<frame::XFrame> & rxFrame)34*3091fa8aSAndre Fischer void Sidebar::ShowPanel (
35*3091fa8aSAndre Fischer     const ::rtl::OUString& rsPanelId,
36*3091fa8aSAndre Fischer     const Reference<frame::XFrame>& rxFrame)
3722de8995SAndre Fischer {
38*3091fa8aSAndre Fischer     SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
39*3091fa8aSAndre Fischer     const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
40*3091fa8aSAndre Fischer     if (pController!=NULL && pPanelDescriptor != NULL)
41*3091fa8aSAndre Fischer     {
42*3091fa8aSAndre Fischer         // This should be a lot more sophisticated:
43*3091fa8aSAndre Fischer         // - Make the deck switching asynchronous
44*3091fa8aSAndre Fischer         // - Make sure that the panel is visible and expanded after
45*3091fa8aSAndre Fischer         // the switch.
46*3091fa8aSAndre Fischer         // - Make sure to use a context that really shows the panel
47*3091fa8aSAndre Fischer         //
48*3091fa8aSAndre Fischer         // All that is not necessary for the current use cases so lets
49*3091fa8aSAndre Fischer         // keep it simple for the time being.
50*3091fa8aSAndre Fischer         pController->RequestSwitchToDeck(pPanelDescriptor->msDeckId);
51*3091fa8aSAndre Fischer     }
5222de8995SAndre Fischer }
5322de8995SAndre Fischer 
5422de8995SAndre Fischer 
55ff12d537SAndre Fischer 
56ff12d537SAndre Fischer 
ShowDeck(const::rtl::OUString & rsDeckId,const Reference<frame::XFrame> & rxFrame)57*3091fa8aSAndre Fischer void Sidebar::ShowDeck (
58*3091fa8aSAndre Fischer     const ::rtl::OUString& rsDeckId,
59*3091fa8aSAndre Fischer     const Reference<frame::XFrame>& rxFrame)
60ff12d537SAndre Fischer {
61*3091fa8aSAndre Fischer     SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
62*3091fa8aSAndre Fischer     if (pController != NULL)
63*3091fa8aSAndre Fischer         pController->RequestSwitchToDeck(rsDeckId);
64ff12d537SAndre Fischer }
65ff12d537SAndre Fischer 
66ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
67