xref: /trunk/main/sfx2/source/sidebar/Sidebar.cxx (revision 549760eabef7046a021eb562805aa3542b2e9b62)
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 
243091fa8aSAndre Fischer #include "sfx2/sidebar/Sidebar.hxx"
253091fa8aSAndre 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 
ShowPanel(const::rtl::OUString & rsPanelId,const Reference<frame::XFrame> & rxFrame)333091fa8aSAndre Fischer void Sidebar::ShowPanel (
343091fa8aSAndre Fischer     const ::rtl::OUString& rsPanelId,
353091fa8aSAndre Fischer     const Reference<frame::XFrame>& rxFrame)
3622de8995SAndre Fischer {
373091fa8aSAndre Fischer     SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
383091fa8aSAndre Fischer     const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
393091fa8aSAndre Fischer     if (pController!=NULL && pPanelDescriptor != NULL)
403091fa8aSAndre Fischer     {
413091fa8aSAndre Fischer         // This should be a lot more sophisticated:
423091fa8aSAndre Fischer         // - Make the deck switching asynchronous
433091fa8aSAndre Fischer         // - Make sure that the panel is visible and expanded after
443091fa8aSAndre Fischer         //   the switch.
453091fa8aSAndre Fischer         // - Make sure to use a context that really shows the panel
463091fa8aSAndre Fischer         //
47*549760eaSmseidel         // All that is not necessary for the current use cases so let's
483091fa8aSAndre Fischer         // keep it simple for the time being.
493091fa8aSAndre Fischer         pController->RequestSwitchToDeck(pPanelDescriptor->msDeckId);
503091fa8aSAndre Fischer     }
5122de8995SAndre Fischer }
5222de8995SAndre Fischer 
ShowDeck(const::rtl::OUString & rsDeckId,const Reference<frame::XFrame> & rxFrame)533091fa8aSAndre Fischer void Sidebar::ShowDeck (
543091fa8aSAndre Fischer     const ::rtl::OUString& rsDeckId,
553091fa8aSAndre Fischer     const Reference<frame::XFrame>& rxFrame)
5622de8995SAndre Fischer {
573091fa8aSAndre Fischer     SidebarController* pController = SidebarController::GetSidebarControllerForFrame(rxFrame);
583091fa8aSAndre Fischer     if (pController != NULL)
593091fa8aSAndre Fischer         pController->RequestSwitchToDeck(rsDeckId);
6022de8995SAndre Fischer }
6122de8995SAndre Fischer 
62ff12d537SAndre Fischer } } // end of namespace sfx2::sidebar
63*549760eaSmseidel 
64*549760eaSmseidel /* vim: set noet sw=4 ts=4: */
65