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 
2413e1c3b4SAndre Fischer #include "TabBar.hxx"
257a32b0c8SAndre Fischer #include "sfx2/sidebar/SidebarChildWindow.hxx"
2622de8995SAndre Fischer #include "SidebarDockingWindow.hxx"
2722de8995SAndre Fischer #include "sfx2/sfxsids.hrc"
2822de8995SAndre Fischer #include "helpid.hrc"
2922de8995SAndre Fischer #include "sfx2/dockwin.hxx"
30d29c2fc2SAndre Fischer #include <sfx2/sidebar/ResourceDefinitions.hrc>
3122de8995SAndre Fischer 
3222de8995SAndre Fischer 
337a32b0c8SAndre Fischer namespace sfx2 { namespace sidebar {
3422de8995SAndre Fischer 
3522de8995SAndre Fischer 
3622de8995SAndre Fischer SFX_IMPL_DOCKINGWINDOW(SidebarChildWindow, SID_SIDEBAR);
3722de8995SAndre Fischer 
3822de8995SAndre Fischer 
SidebarChildWindow(Window * pParentWindow,sal_uInt16 nId,SfxBindings * pBindings,SfxChildWinInfo * pInfo)3922de8995SAndre Fischer SidebarChildWindow::SidebarChildWindow (
4045da7d5eSAndre Fischer     Window* pParentWindow,
4122de8995SAndre Fischer     sal_uInt16 nId,
4222de8995SAndre Fischer     SfxBindings* pBindings,
4345da7d5eSAndre Fischer     SfxChildWinInfo* pInfo)
4445da7d5eSAndre Fischer     : SfxChildWindow(pParentWindow, nId)
4522de8995SAndre Fischer {
4622de8995SAndre Fischer     this->pWindow = new SidebarDockingWindow(
4722de8995SAndre Fischer         pBindings,
4822de8995SAndre Fischer         *this,
4945da7d5eSAndre Fischer         pParentWindow,
5022de8995SAndre Fischer         WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
5122de8995SAndre Fischer     eChildAlignment = SFX_ALIGN_RIGHT;
5222de8995SAndre Fischer 
5322de8995SAndre Fischer     this->pWindow->SetHelpId(HID_SIDEBAR_WINDOW);
5413e1c3b4SAndre Fischer     this->pWindow->SetOutputSizePixel(Size(GetDefaultWidth(this->pWindow), 450));
5522de8995SAndre Fischer 
5613e1c3b4SAndre Fischer     SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(this->pWindow);
5745da7d5eSAndre Fischer     if (pDockingParent != NULL)
5845da7d5eSAndre Fischer         pDockingParent->Initialize(pInfo);
5922de8995SAndre Fischer     SetHideNotDelete(sal_True);
6022de8995SAndre Fischer 
6122de8995SAndre Fischer     this->pWindow->Show();
6222de8995SAndre Fischer }
6322de8995SAndre Fischer 
6422de8995SAndre Fischer 
6513e1c3b4SAndre Fischer 
6613e1c3b4SAndre Fischer 
~SidebarChildWindow(void)67*e4bfc5b7SAndre Fischer SidebarChildWindow::~SidebarChildWindow (void)
68*e4bfc5b7SAndre Fischer {
69*e4bfc5b7SAndre Fischer }
70*e4bfc5b7SAndre Fischer 
71*e4bfc5b7SAndre Fischer 
72*e4bfc5b7SAndre Fischer 
73*e4bfc5b7SAndre Fischer 
GetDefaultWidth(Window * pWindow)7413e1c3b4SAndre Fischer sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow)
7513e1c3b4SAndre Fischer {
7613e1c3b4SAndre Fischer     if (pWindow != NULL)
7713e1c3b4SAndre Fischer     {
7813e1c3b4SAndre Fischer         // Width of the paragraph panel.
7913e1c3b4SAndre Fischer         const static sal_Int32 nMaxPropertyPageWidth (115);
8013e1c3b4SAndre Fischer 
8113e1c3b4SAndre Fischer         return pWindow->LogicToPixel(Point(nMaxPropertyPageWidth,1), MAP_APPFONT).X()
8213e1c3b4SAndre Fischer             + TabBar::GetDefaultWidth();
8313e1c3b4SAndre Fischer     }
8413e1c3b4SAndre Fischer     else
8513e1c3b4SAndre Fischer         return 0;
8613e1c3b4SAndre Fischer }
8713e1c3b4SAndre Fischer 
8813e1c3b4SAndre Fischer 
897a32b0c8SAndre Fischer } } // end of namespace sfx2::sidebar
90