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 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 #include "PaneChildWindows.hxx"
27 #include "PaneDockingWindow.hrc"
28 #include "PaneDockingWindow.hxx"
29 #include "ViewShellBase.hxx"
30 #include "framework/FrameworkHelper.hxx"
31 #include "app.hrc"
32 #include "strings.hrc"
33 #include "sdresid.hxx"
34 
35 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
36 #include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
37 
38 #include <sfx2/app.hxx>
39 #include <sfx2/dockwin.hxx>
40 #include <sfx2/bindings.hxx>
41 #include <sfx2/dispatch.hxx>
42 #include <tools/diagnose_ex.h>
43 
44 namespace sd {
45 
46 using ::com::sun::star::uno::Reference;
47 using ::com::sun::star::drawing::framework::XResourceId;
48 using ::com::sun::star::drawing::framework::XConfigurationController;
49 using ::com::sun::star::drawing::framework::ResourceActivationMode_ADD;
50 using ::com::sun::star::drawing::framework::ResourceActivationMode_REPLACE;
51 
SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow,SID_LEFT_PANE_IMPRESS)52 SFX_IMPL_DOCKINGWINDOW(LeftPaneImpressChildWindow, SID_LEFT_PANE_IMPRESS)
53 SFX_IMPL_DOCKINGWINDOW(LeftPaneDrawChildWindow, SID_LEFT_PANE_DRAW)
54 
55 //===== PaneChildWindow =======================================================
56 
57 PaneChildWindow::PaneChildWindow (
58     ::Window* pParentWindow,
59     sal_uInt16 nId,
60     SfxBindings* pBindings,
61     SfxChildWinInfo* pInfo,
62     const sal_uInt16 nDockWinTitleResId,
63     const sal_uInt16 nTitleBarResId,
64     SfxChildAlignment eAlignment)
65     : SfxChildWindow (pParentWindow, nId)
66 {
67     pWindow = new PaneDockingWindow (
68         pBindings,
69         this,
70         pParentWindow,
71         SdResId( nDockWinTitleResId ),
72         String( SdResId( nTitleBarResId ) ) );
73     eChildAlignment = eAlignment;
74     static_cast<SfxDockingWindow*>(pWindow)->Initialize(pInfo);
75     SetHideNotDelete(sal_True);
76 
77     ViewShellBase* pBase = ViewShellBase::GetViewShellBase(pBindings->GetDispatcher()->GetFrame());
78     if (pBase != NULL)
79     {
80         framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
81     }
82 }
83 
84 
85 
86 
~PaneChildWindow(void)87 PaneChildWindow::~PaneChildWindow (void)
88 {
89     ViewShellBase* pBase = NULL;
90     PaneDockingWindow* pDockingWindow = dynamic_cast<PaneDockingWindow*>(pWindow);
91     if (pDockingWindow != NULL)
92         pBase = ViewShellBase::GetViewShellBase(
93             pDockingWindow->GetBindings().GetDispatcher()->GetFrame());
94     if (pBase != NULL)
95         framework::FrameworkHelper::Instance(*pBase)->UpdateConfiguration();
96 }
97 
98 
99 
100 
101 
102 
103 //===== LeftPaneImpressChildWindow ============================================
104 
LeftPaneImpressChildWindow(::Window * pParentWindow,sal_uInt16 nId,SfxBindings * pBindings,SfxChildWinInfo * pInfo)105 LeftPaneImpressChildWindow::LeftPaneImpressChildWindow (
106     ::Window* pParentWindow,
107     sal_uInt16 nId,
108     SfxBindings* pBindings,
109     SfxChildWinInfo* pInfo)
110     : PaneChildWindow(
111         pParentWindow,
112         nId,
113         pBindings,
114         pInfo,
115         FLT_LEFT_PANE_IMPRESS_DOCKING_WINDOW,
116         STR_LEFT_PANE_IMPRESS_TITLE,
117         SFX_ALIGN_LEFT)
118 {
119 }
120 
121 
122 
123 
124 //===== LeftPaneDrawChildWindow ===============================================
125 
LeftPaneDrawChildWindow(::Window * pParentWindow,sal_uInt16 nId,SfxBindings * pBindings,SfxChildWinInfo * pInfo)126 LeftPaneDrawChildWindow::LeftPaneDrawChildWindow (
127     ::Window* pParentWindow,
128     sal_uInt16 nId,
129     SfxBindings* pBindings,
130     SfxChildWinInfo* pInfo)
131     : PaneChildWindow(
132         pParentWindow,
133         nId,
134         pBindings,
135         pInfo,
136         FLT_LEFT_PANE_DRAW_DOCKING_WINDOW,
137         STR_LEFT_PANE_DRAW_TITLE,
138         SFX_ALIGN_LEFT)
139 {
140 }
141 
142 
143 } // end of namespace ::sd
144