Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : :
21 : : #include <svl/eitem.hxx>
22 : : #include <vcl/decoview.hxx>
23 : :
24 : : #include <vcl/svapp.hxx>
25 : : #include <vcl/timer.hxx>
26 : : #include <rtl/instance.hxx>
27 : : #include <toolkit/helper/vclunohelper.hxx>
28 : : #include <comphelper/processfactory.hxx>
29 : :
30 : : #include <sfx2/dockwin.hxx>
31 : : #include <sfx2/bindings.hxx>
32 : : #include <sfx2/viewfrm.hxx>
33 : : #include <sfx2/dispatch.hxx>
34 : : #include "workwin.hxx"
35 : : #include "splitwin.hxx"
36 : : #include <sfx2/viewsh.hxx>
37 : : #include "sfx2/sfxhelp.hxx"
38 : : #include <sfx2/objsh.hxx>
39 : : #include <sfx2/msgpool.hxx>
40 : :
41 : : #include <com/sun/star/frame/XController.hpp>
42 : : #include <com/sun/star/lang/XUnoTunnel.hpp>
43 : : #include <com/sun/star/lang/XSingleComponentFactory.hpp>
44 : : #include <com/sun/star/awt/XWindow.hpp>
45 : : #include <com/sun/star/uno/XComponentContext.hpp>
46 : : #include <com/sun/star/frame/XModuleManager.hpp>
47 : : #include <com/sun/star/container/XNameAccess.hpp>
48 : :
49 : : #define MAX_TOGGLEAREA_WIDTH 20
50 : : #define MAX_TOGGLEAREA_HEIGHT 20
51 : :
52 : : using namespace ::com::sun::star;
53 : :
54 : : // implemented in 'sfx2/source/appl/childwin.cxx'
55 : : extern sal_Bool GetPosSizeFromString( const String& rStr, Point& rPos, Size& rSize );
56 : : extern sal_Bool GetSplitSizeFromString( const String& rStr, Size& rSize );
57 : :
58 : : // If you want to change the number you also have to:
59 : : // - Add new slot ids to sfxsids.hrc
60 : : // - Add new slots to frmslots.sdi
61 : : // - Add new slot definitions to sfx.sdi
62 : : static const int NUM_OF_DOCKINGWINDOWS = 10;
63 : :
64 : : class SfxTitleDockingWindow : public SfxDockingWindow
65 : : {
66 : : Window* m_pWrappedWindow;
67 : :
68 : : public:
69 : : SfxTitleDockingWindow(
70 : : SfxBindings* pBindings ,
71 : : SfxChildWindow* pChildWin ,
72 : : Window* pParent ,
73 : : WinBits nBits);
74 : : virtual ~SfxTitleDockingWindow();
75 : :
76 : 0 : Window* GetWrappedWindow() const { return m_pWrappedWindow; }
77 : : void SetWrappedWindow(Window* const pWindow);
78 : :
79 : : virtual void StateChanged( StateChangedType nType );
80 : : virtual long Notify( NotifyEvent& rNEvt );
81 : : virtual void Resize();
82 : : virtual void Resizing( Size& rSize );
83 : : virtual sal_Bool Close();
84 : : };
85 : :
86 : : namespace
87 : : {
88 : 0 : struct WindowState
89 : : {
90 : : ::rtl::OUString sTitle;
91 : : };
92 : : }
93 : :
94 : 0 : static bool lcl_getWindowState( const uno::Reference< container::XNameAccess >& xWindowStateMgr, const ::rtl::OUString& rResourceURL, WindowState& rWindowState )
95 : : {
96 : 0 : bool bResult = false;
97 : :
98 : : try
99 : : {
100 : 0 : uno::Any a;
101 [ # # ]: 0 : uno::Sequence< beans::PropertyValue > aWindowState;
102 [ # # ][ # # ]: 0 : a = xWindowStateMgr->getByName( rResourceURL );
103 [ # # ][ # # ]: 0 : if ( a >>= aWindowState )
104 : : {
105 [ # # ]: 0 : for ( sal_Int32 n = 0; n < aWindowState.getLength(); n++ )
106 : : {
107 [ # # ][ # # ]: 0 : if ( aWindowState[n].Name == "UIName" )
108 : : {
109 [ # # ]: 0 : aWindowState[n].Value >>= rWindowState.sTitle;
110 : : }
111 : : }
112 : : }
113 : :
114 [ # # ][ # # ]: 0 : bResult = true;
115 : : }
116 : 0 : catch ( container::NoSuchElementException& )
117 : : {
118 : 0 : bResult = false;
119 : : }
120 : :
121 : 0 : return bResult;
122 : : }
123 : :
124 : 0 : SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
125 : : sal_uInt16 nId ,
126 : : SfxBindings* pBindings ,
127 : : SfxChildWinInfo* pInfo )
128 : 0 : : SfxChildWindow( pParentWnd , nId )
129 : : {
130 [ # # ]: 0 : uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
131 [ # # ]: 0 : const rtl::OUString aDockWindowResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/dockingwindow/" ));
132 : :
133 : : SfxTitleDockingWindow* pTitleDockWindow = new SfxTitleDockingWindow( pBindings, this, pParentWnd,
134 [ # # ][ # # ]: 0 : WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
135 : 0 : pWindow = pTitleDockWindow;
136 : 0 : eChildAlignment = SFX_ALIGN_NOALIGNMENT;
137 : :
138 : : // Use factory manager to retrieve XWindow factory. That can be used to instanciate
139 : : // the real window factory.
140 : : uno::Reference< lang::XSingleComponentFactory > xFactoryMgr(
141 [ # # ]: 0 : xServiceManager->createInstance(
142 : : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
143 : 0 : "com.sun.star.ui.WindowContentFactoryManager"))),
144 [ # # ][ # # ]: 0 : uno::UNO_QUERY );
[ # # ]
145 : :
146 [ # # ]: 0 : if (xFactoryMgr.is())
147 : : {
148 : 0 : SfxDispatcher* pDispatcher = pBindings->GetDispatcher();
149 [ # # ][ # # ]: 0 : uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
[ # # ][ # # ]
150 [ # # ]: 0 : uno::Sequence< uno::Any > aArgs(2);
151 : 0 : beans::PropertyValue aPropValue;
152 [ # # ]: 0 : aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
153 [ # # ]: 0 : aPropValue.Value = uno::makeAny( xFrame );
154 [ # # ][ # # ]: 0 : aArgs[0] <<= aPropValue;
155 [ # # ]: 0 : aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ));
156 : :
157 : : // create a resource URL from the nId provided by the sfx2
158 : 0 : ::rtl::OUString aResourceURL( aDockWindowResourceURL );
159 : 0 : aResourceURL += ::rtl::OUString::valueOf(sal_Int32(nId));
160 [ # # ]: 0 : aPropValue.Value = uno::makeAny( aResourceURL );
161 [ # # ][ # # ]: 0 : aArgs[1] <<= aPropValue;
162 : :
163 : 0 : uno::Reference< awt::XWindow > xWindow;
164 : : try
165 : : {
166 [ # # ]: 0 : uno::Reference< beans::XPropertySet > xProps( xServiceManager, uno::UNO_QUERY );
167 : 0 : uno::Reference< uno::XComponentContext > xContext;
168 : :
169 [ # # ]: 0 : if ( xProps.is() )
170 [ # # ][ # # ]: 0 : xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
[ # # ][ # # ]
171 [ # # ]: 0 : if ( xContext.is() )
172 : : {
173 : : xWindow = uno::Reference< awt::XWindow>(
174 [ # # ]: 0 : xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
175 [ # # ][ # # ]: 0 : uno::UNO_QUERY );
[ # # ]
176 : : }
177 : :
178 [ # # ][ # # ]: 0 : static uno::WeakReference< frame::XModuleManager > m_xModuleManager;
[ # # ][ # # ]
179 : :
180 [ # # ]: 0 : uno::Reference< frame::XModuleManager > xModuleManager( m_xModuleManager );
181 [ # # ]: 0 : if ( !xModuleManager.is() )
182 : : {
183 : : xModuleManager = uno::Reference< frame::XModuleManager >(
184 [ # # ]: 0 : xServiceManager->createInstance(
185 : 0 : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))),
186 [ # # ][ # # ]: 0 : uno::UNO_QUERY );
[ # # ][ # # ]
187 [ # # ]: 0 : m_xModuleManager = xModuleManager;
188 : : }
189 : :
190 [ # # ][ # # ]: 0 : static uno::WeakReference< container::XNameAccess > m_xWindowStateConfiguration;
[ # # ][ # # ]
191 : :
192 [ # # ]: 0 : uno::Reference< container::XNameAccess > xWindowStateConfiguration( m_xWindowStateConfiguration );
193 [ # # ]: 0 : if ( !xWindowStateConfiguration.is() )
194 : : {
195 : : xWindowStateConfiguration = uno::Reference< container::XNameAccess >(
196 [ # # ]: 0 : xServiceManager->createInstance(
197 : 0 : rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.WindowStateConfiguration" ))),
198 [ # # ][ # # ]: 0 : uno::UNO_QUERY );
[ # # ][ # # ]
199 [ # # ]: 0 : m_xWindowStateConfiguration = xWindowStateConfiguration;
200 : : }
201 : :
202 [ # # ][ # # ]: 0 : ::rtl::OUString sModuleIdentifier = xModuleManager->identify( xFrame );
203 : :
204 : : uno::Reference< container::XNameAccess > xModuleWindowState(
205 [ # # ]: 0 : xWindowStateConfiguration->getByName( sModuleIdentifier ),
206 [ # # ][ # # ]: 0 : uno::UNO_QUERY );
207 [ # # ]: 0 : if ( xModuleWindowState.is() )
208 : : {
209 : 0 : WindowState aDockWinState;
210 [ # # ][ # # ]: 0 : if ( lcl_getWindowState( xModuleWindowState, aResourceURL, aDockWinState ))
211 [ # # ][ # # ]: 0 : pTitleDockWindow->SetText( aDockWinState.sTitle );
[ # # ]
212 [ # # # # ]: 0 : }
213 : : }
214 [ # # ]: 0 : catch ( beans::UnknownPropertyException& )
215 : : {
216 : : }
217 [ # # ]: 0 : catch ( uno::RuntimeException& )
218 : : {
219 : : }
220 [ # # ]: 0 : catch ( uno::Exception& )
221 : : {
222 : : }
223 : :
224 [ # # ]: 0 : Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow);
225 [ # # ]: 0 : if ( pContentWindow )
226 [ # # ][ # # ]: 0 : pContentWindow->SetStyle( pContentWindow->GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
227 [ # # ][ # # ]: 0 : pTitleDockWindow->SetWrappedWindow(pContentWindow);
228 : : }
229 : :
230 [ # # ]: 0 : pWindow->SetOutputSizePixel( Size( 270, 240 ) );
231 : :
232 [ # # ]: 0 : ( ( SfxDockingWindow* ) pWindow )->Initialize( pInfo );
233 [ # # ]: 0 : SetHideNotDelete( sal_True );
234 : 0 : }
235 : :
236 : 0 : SfxChildWindow* SfxDockingWrapper::CreateImpl(
237 : : Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo )
238 : : {
239 [ # # ]: 0 : SfxChildWindow *pWin = new SfxDockingWrapper(pParent, nId, pBindings, pInfo);
240 : 0 : return pWin;
241 : : }
242 : :
243 : 233 : void SfxDockingWrapper::RegisterChildWindow (sal_Bool bVis, SfxModule *pMod, sal_uInt16 nFlags)
244 : : {
245 : : // pre-register a couple of docking windows
246 [ + + ]: 2563 : for (int i=0; i < NUM_OF_DOCKINGWINDOWS; i++ )
247 : : {
248 : 2330 : sal_uInt16 nID = sal_uInt16(SID_DOCKWIN_START+i);
249 [ + - ]: 2330 : SfxChildWinFactory *pFact = new SfxChildWinFactory( SfxDockingWrapper::CreateImpl, nID, 0xffff );
250 : 2330 : pFact->aInfo.nFlags |= nFlags;
251 : 2330 : pFact->aInfo.bVisible = bVis;
252 : 2330 : SfxChildWindow::RegisterChildWindow(pMod, pFact);
253 : : }
254 : 233 : }
255 : :
256 : 0 : SfxChildWinInfo SfxDockingWrapper::GetInfo() const
257 : : {
258 : 0 : SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
259 [ # # ]: 0 : ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo );
260 : 0 : return aInfo;
261 : : };
262 : :
263 : 0 : SfxTitleDockingWindow::SfxTitleDockingWindow( SfxBindings* pBind ,
264 : : SfxChildWindow* pChildWin ,
265 : : Window* pParent ,
266 : : WinBits nBits ) :
267 : : SfxDockingWindow( pBind ,
268 : : pChildWin ,
269 : : pParent ,
270 : : nBits ),
271 : 0 : m_pWrappedWindow(0)
272 : : {
273 : 0 : }
274 : :
275 : 0 : SfxTitleDockingWindow::~SfxTitleDockingWindow()
276 : : {
277 [ # # ][ # # ]: 0 : delete m_pWrappedWindow;
278 [ # # ]: 0 : }
279 : :
280 : 0 : void SfxTitleDockingWindow::SetWrappedWindow( Window* const pWindow )
281 : : {
282 : 0 : m_pWrappedWindow = pWindow;
283 [ # # ]: 0 : if (m_pWrappedWindow)
284 : : {
285 : 0 : m_pWrappedWindow->SetParent(this);
286 [ # # ]: 0 : m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
287 : 0 : m_pWrappedWindow->Show();
288 : : }
289 : 0 : }
290 : :
291 : 0 : long SfxTitleDockingWindow::Notify( NotifyEvent& rNEvt )
292 : : {
293 : 0 : return SfxDockingWindow::Notify( rNEvt );
294 : : }
295 : :
296 : 0 : void SfxTitleDockingWindow::StateChanged( StateChangedType nType )
297 : : {
298 [ # # ]: 0 : if ( nType == STATE_CHANGE_INITSHOW )
299 : : {
300 : 0 : Window* pWindow = GetWrappedWindow();
301 [ # # ]: 0 : if ( pWindow )
302 : : {
303 [ # # ]: 0 : pWindow->SetSizePixel( GetOutputSizePixel() );
304 : 0 : pWindow->Show();
305 : : }
306 : : }
307 : :
308 : 0 : SfxDockingWindow::StateChanged(nType);
309 : 0 : }
310 : :
311 : 0 : void SfxTitleDockingWindow::Resize()
312 : : {
313 : 0 : SfxDockingWindow::Resize();
314 [ # # ]: 0 : if (m_pWrappedWindow)
315 [ # # ]: 0 : m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
316 : 0 : }
317 : :
318 : 0 : void SfxTitleDockingWindow::Resizing( Size &rSize )
319 : : {
320 : 0 : SfxDockingWindow::Resizing( rSize );
321 [ # # ]: 0 : if (m_pWrappedWindow)
322 [ # # ]: 0 : m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
323 : 0 : }
324 : :
325 : 0 : sal_Bool SfxTitleDockingWindow::Close()
326 : : {
327 : 0 : return SfxDockingWindow::Close();
328 : : }
329 : :
330 : : namespace
331 : : {
332 : : struct ChildrenRegisteredMap : public rtl::Static< bool, ChildrenRegisteredMap > {};
333 : : }
334 : :
335 : 0 : static bool lcl_checkDockingWindowID( sal_uInt16 nID )
336 : : {
337 [ # # ][ # # ]: 0 : if (nID < SID_DOCKWIN_START || nID >= sal_uInt16(SID_DOCKWIN_START+NUM_OF_DOCKINGWINDOWS))
338 : 0 : return false;
339 : : else
340 : 0 : return true;
341 : : }
342 : :
343 : 0 : static SfxWorkWindow* lcl_getWorkWindowFromXFrame( const uno::Reference< frame::XFrame >& rFrame )
344 : : {
345 : : // We need to find the corresponding SfxFrame of our XFrame
346 : 0 : SfxFrame* pFrame = SfxFrame::GetFirst();
347 : 0 : SfxFrame* pXFrame = 0;
348 [ # # ]: 0 : while ( pFrame )
349 : : {
350 [ # # ]: 0 : uno::Reference< frame::XFrame > xViewShellFrame( pFrame->GetFrameInterface() );
351 [ # # ][ # # ]: 0 : if ( xViewShellFrame == rFrame )
352 : : {
353 : 0 : pXFrame = pFrame;
354 : : break;
355 : : }
356 : : else
357 [ # # ][ # # ]: 0 : pFrame = SfxFrame::GetNext( *pFrame );
358 : 0 : }
359 : :
360 : : // If we have a SfxFrame we can retrieve the work window (Sfx layout manager for docking windows)
361 [ # # ]: 0 : if ( pXFrame )
362 : 0 : return pXFrame->GetWorkWindow_Impl();
363 : : else
364 : 0 : return NULL;
365 : : }
366 : :
367 : : /*
368 : : Factory function used by the framework layout manager to "create" a docking window with a special name.
369 : : The string rDockingWindowName MUST BE a valid ID! The ID is pre-defined by a certain slot range located
370 : : in sfxsids.hrc (currently SID_DOCKWIN_START = 9800).
371 : : */
372 : 0 : void SAL_CALL SfxDockingWindowFactory( const uno::Reference< frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName )
373 : : {
374 [ # # ]: 0 : SolarMutexGuard aGuard;
375 : 0 : sal_uInt16 nID = sal_uInt16(rDockingWindowName.toInt32());
376 : :
377 : : // Check the range of the provided ID otherwise nothing will happen
378 [ # # ]: 0 : if ( lcl_checkDockingWindowID( nID ))
379 : : {
380 [ # # ]: 0 : SfxWorkWindow* pWorkWindow = lcl_getWorkWindowFromXFrame( rFrame );
381 [ # # ]: 0 : if ( pWorkWindow )
382 : : {
383 [ # # ]: 0 : SfxChildWindow* pChildWindow = pWorkWindow->GetChildWindow_Impl(nID);
384 [ # # ]: 0 : if ( !pChildWindow )
385 : : {
386 : : // Register window at the workwindow child window list
387 [ # # ]: 0 : pWorkWindow->SetChildWindow_Impl( nID, true, false );
388 : : }
389 : : }
390 [ # # ]: 0 : }
391 : 0 : }
392 : :
393 : : /*
394 : : Function used by the framework layout manager to determine the visibility state of a docking window with
395 : : a special name. The string rDockingWindowName MUST BE a valid ID! The ID is pre-defined by a certain slot
396 : : range located in sfxsids.hrc (currently SID_DOCKWIN_START = 9800).
397 : : */
398 : 0 : bool SAL_CALL IsDockingWindowVisible( const uno::Reference< frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName )
399 : : {
400 [ # # ]: 0 : SolarMutexGuard aGuard;
401 : :
402 : 0 : sal_uInt16 nID = sal_uInt16(rDockingWindowName.toInt32());
403 : :
404 : : // Check the range of the provided ID otherwise nothing will happen
405 [ # # ]: 0 : if ( lcl_checkDockingWindowID( nID ))
406 : : {
407 [ # # ]: 0 : SfxWorkWindow* pWorkWindow = lcl_getWorkWindowFromXFrame( rFrame );
408 [ # # ]: 0 : if ( pWorkWindow )
409 : : {
410 [ # # ]: 0 : SfxChildWindow* pChildWindow = pWorkWindow->GetChildWindow_Impl(nID);
411 [ # # ]: 0 : if ( pChildWindow )
412 : 0 : return true;
413 : : }
414 : : }
415 : :
416 [ # # ]: 0 : return false;
417 : : }
418 : :
419 : 624 : class SfxDockingWindow_Impl
420 : : {
421 : : friend class SfxDockingWindow;
422 : :
423 : : SfxChildAlignment eLastAlignment;
424 : : SfxChildAlignment eDockAlignment;
425 : : sal_Bool bConstructed;
426 : : Size aMinSize;
427 : : SfxSplitWindow* pSplitWin;
428 : : sal_Bool bSplitable;
429 : : Timer aMoveTimer;
430 : :
431 : : // The following members are only valid in the time from startDocking to
432 : : // EndDocking:
433 : : sal_Bool bEndDocked;
434 : : Size aSplitSize;
435 : : long nHorizontalSize;
436 : : long nVerticalSize;
437 : : sal_uInt16 nLine;
438 : : sal_uInt16 nPos;
439 : : sal_uInt16 nDockLine;
440 : : sal_uInt16 nDockPos;
441 : : sal_Bool bNewLine;
442 : : sal_Bool bDockingPrevented;
443 : : rtl::OString aWinState;
444 : :
445 : 936 : SfxChildAlignment GetLastAlignment() const
446 : 936 : { return eLastAlignment; }
447 : 898 : void SetLastAlignment(SfxChildAlignment eAlign)
448 : 898 : { eLastAlignment = eAlign; }
449 : 100 : SfxChildAlignment GetDockAlignment() const
450 : 100 : { return eDockAlignment; }
451 : 312 : void SetDockAlignment(SfxChildAlignment eAlign)
452 : 312 : { eDockAlignment = eAlign; }
453 : : };
454 : :
455 : : //-------------------------------------------------------------------------
456 : :
457 : 602 : void SfxDockingWindow::Resize()
458 : :
459 : : /* [Description]
460 : :
461 : : This virtual method of the class FloatingWindow keeps track of changes in
462 : : FloatingSize. If this method is overridden by a derived class,
463 : : then the SfxFloatingWindow: Resize() must also be called.
464 : : */
465 : : {
466 : 602 : DockingWindow::Resize();
467 : 602 : Invalidate();
468 [ + - ][ + + ]: 602 : if ( pImp->bConstructed && pMgr )
469 : : {
470 [ - + ]: 100 : if ( IsFloatingMode() )
471 : : {
472 : : // start timer for saving window status information
473 : 0 : pImp->aMoveTimer.Start();
474 : : }
475 : : else
476 : : {
477 [ + - ]: 100 : Size aSize( GetSizePixel() );
478 [ + - - ]: 100 : switch ( pImp->GetDockAlignment() )
479 : : {
480 : : case SFX_ALIGN_LEFT:
481 : : case SFX_ALIGN_FIRSTLEFT:
482 : : case SFX_ALIGN_LASTLEFT:
483 : : case SFX_ALIGN_RIGHT:
484 : : case SFX_ALIGN_FIRSTRIGHT:
485 : : case SFX_ALIGN_LASTRIGHT:
486 : 100 : pImp->nHorizontalSize = aSize.Width();
487 : 100 : pImp->aSplitSize = aSize;
488 : 100 : break;
489 : : case SFX_ALIGN_TOP:
490 : : case SFX_ALIGN_LOWESTTOP:
491 : : case SFX_ALIGN_HIGHESTTOP:
492 : : case SFX_ALIGN_BOTTOM:
493 : : case SFX_ALIGN_HIGHESTBOTTOM:
494 : : case SFX_ALIGN_LOWESTBOTTOM:
495 : 0 : pImp->nVerticalSize = aSize.Height();
496 : 0 : pImp->aSplitSize = aSize;
497 : 0 : break;
498 : : default:
499 : 100 : break;
500 : : }
501 : : }
502 : : }
503 : 602 : }
504 : :
505 : : //-------------------------------------------------------------------------
506 : :
507 : 0 : sal_Bool SfxDockingWindow::PrepareToggleFloatingMode()
508 : :
509 : : /* [Description]
510 : :
511 : : This virtual method of the class DockingWindow makes it possible to
512 : : intervene in the switching of the floating mode.
513 : : If this method is overridden by a derived class,
514 : : then the SfxDockingWindow::PrepareToggleFloatingMode() must be called
515 : : afterwards, if not FALSE is returned.
516 : : */
517 : :
518 : : {
519 [ # # ]: 0 : if (!pImp->bConstructed)
520 : 0 : return sal_True;
521 : :
522 [ # # ][ # # ]: 0 : if ( (Application::IsInModalMode() && IsFloatingMode()) || !pMgr )
[ # # ][ # # ]
523 : 0 : return sal_False;
524 : :
525 [ # # ]: 0 : if ( pImp->bDockingPrevented )
526 : 0 : return sal_False;
527 : :
528 [ # # ]: 0 : if (!IsFloatingMode())
529 : : {
530 : : // Test, if FloatingMode is permitted.
531 [ # # ]: 0 : if ( CheckAlignment(GetAlignment(),SFX_ALIGN_NOALIGNMENT) != SFX_ALIGN_NOALIGNMENT )
532 : 0 : return sal_False;
533 : :
534 [ # # ]: 0 : if ( pImp->pSplitWin )
535 : : {
536 : : // The DockingWindow is inside a SplitWindow and will be teared of.
537 : 0 : pImp->pSplitWin->RemoveWindow(this/*, sal_False*/);
538 : 0 : pImp->pSplitWin = 0;
539 : : }
540 : : }
541 [ # # ]: 0 : else if ( pMgr )
542 : : {
543 : 0 : pImp->aWinState = GetFloatingWindow()->GetWindowState();
544 : :
545 : : // Test if it is allowed to dock,
546 [ # # ]: 0 : if (CheckAlignment(GetAlignment(),pImp->GetLastAlignment()) == SFX_ALIGN_NOALIGNMENT)
547 : 0 : return sal_False;
548 : :
549 : : // Test, if the Workwindow allows for docking at the moment.
550 : 0 : SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl();
551 [ # # ][ # # ]: 0 : if ( !pWorkWin->IsDockingAllowed() || !pWorkWin->IsInternalDockingAllowed() )
[ # # ]
552 : 0 : return sal_False;
553 : : }
554 : :
555 : 0 : return sal_True;
556 : : }
557 : :
558 : : //-------------------------------------------------------------------------
559 : :
560 : 0 : void SfxDockingWindow::ToggleFloatingMode()
561 : :
562 : : /* [Description]
563 : :
564 : : This virtual method of the DockingWindow class sets the internal data of
565 : : the SfxDockingWindow and ensures the correct alignment on the parent window.
566 : : Through PrepareToggleFloatMode and Initialize it is ensured that
567 : : pImp-> GetLastAlignment() always delivers an allowed alignment. If this
568 : : method is overloaded from a derived class, then first the
569 : : SfxDockingWindow:: ToggleFloatingMode() must be called.
570 : : */
571 : : {
572 [ # # ][ # # ]: 0 : if ( !pImp->bConstructed || !pMgr )
573 : 0 : return; // No Handler call
574 : :
575 : : // Remember old alignment and then switch.
576 : : // SV has already switched, but the alignment SfxDockingWindow is still
577 : : // the old one. What I was before?
578 : 0 : SfxChildAlignment eLastAlign = GetAlignment();
579 : :
580 : 0 : SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl();
581 : 0 : SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW;
582 [ # # ]: 0 : if ( pImp->bSplitable )
583 : 0 : eIdent = SFX_CHILDWIN_SPLITWINDOW;
584 : :
585 [ # # ]: 0 : if (IsFloatingMode())
586 : : {
587 : 0 : SetAlignment(SFX_ALIGN_NOALIGNMENT);
588 [ # # ]: 0 : if ( !pImp->aWinState.isEmpty() )
589 : 0 : GetFloatingWindow()->SetWindowState( pImp->aWinState );
590 : : else
591 [ # # ]: 0 : GetFloatingWindow()->SetOutputSizePixel( GetFloatingSize() );
592 : : }
593 : : else
594 : : {
595 [ # # ]: 0 : if (pImp->GetDockAlignment() == eLastAlign)
596 : : {
597 : : // If ToggleFloatingMode was called, but the DockAlignment still
598 : : // is unchanged, then this means that it must have been a toggling
599 : : // through DClick, so use last alignment
600 : 0 : SetAlignment (pImp->GetLastAlignment());
601 [ # # ]: 0 : if ( !pImp->bSplitable )
602 [ # # ]: 0 : SetSizePixel( CalcDockingSize(GetAlignment()) );
603 : : }
604 : : else
605 : : {
606 : :
607 : : // Toggling was triggered by dragging
608 : 0 : pImp->nLine = pImp->nDockLine;
609 : 0 : pImp->nPos = pImp->nDockPos;
610 : 0 : SetAlignment (pImp->GetDockAlignment());
611 : : }
612 : :
613 [ # # ]: 0 : if ( pImp->bSplitable )
614 : : {
615 : : // The DockingWindow is now in a SplitWindow
616 : 0 : pImp->pSplitWin = pWorkWin->GetSplitWindow_Impl(GetAlignment());
617 : :
618 : : // The LastAlignment is still the last docked
619 : 0 : SfxSplitWindow *pSplit = pWorkWin->GetSplitWindow_Impl(pImp->GetLastAlignment());
620 : :
621 : : DBG_ASSERT( pSplit, "LastAlignment is not correct!" );
622 [ # # ][ # # ]: 0 : if ( pSplit && pSplit != pImp->pSplitWin )
623 : 0 : pSplit->ReleaseWindow_Impl(this);
624 [ # # ]: 0 : if ( pImp->GetDockAlignment() == eLastAlign )
625 : 0 : pImp->pSplitWin->InsertWindow( this, pImp->aSplitSize );
626 : : else
627 : 0 : pImp->pSplitWin->InsertWindow( this, pImp->aSplitSize, pImp->nLine, pImp->nPos, pImp->bNewLine );
628 [ # # ]: 0 : if ( !pImp->pSplitWin->IsFadeIn() )
629 : 0 : pImp->pSplitWin->FadeIn();
630 : : }
631 : : }
632 : :
633 : : // Keep the old alignment for the next toggle; set it only now due to the
634 : : // unregister SplitWindow!
635 : 0 : pImp->SetLastAlignment(eLastAlign);
636 : :
637 : : // Reset DockAlignment, if EndDocking is still called
638 : 0 : pImp->SetDockAlignment(GetAlignment());
639 : :
640 : : // Dock or undock SfxChildWindow correctly.
641 [ # # ]: 0 : if ( pMgr )
642 : 0 : pWorkWin->ConfigChild_Impl( eIdent, SFX_TOGGLEFLOATMODE, pMgr->GetType() );
643 : : }
644 : :
645 : : //-------------------------------------------------------------------------
646 : :
647 : 0 : void SfxDockingWindow::StartDocking()
648 : :
649 : : /* [Description]
650 : :
651 : : This virtual method of the DockingWindow class takes the inner and outer
652 : : docking rectangle from the parent window. If this method is overloaded by a
653 : : a derived class, then SfxDockingWindow:StartDocking() has to be called at
654 : : the end.
655 : : */
656 : : {
657 [ # # ][ # # ]: 0 : if ( !pImp->bConstructed || !pMgr )
658 : 0 : return;
659 : 0 : SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW;
660 [ # # ]: 0 : if ( pImp->bSplitable )
661 : 0 : eIdent = SFX_CHILDWIN_SPLITWINDOW;
662 : 0 : SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl();
663 : 0 : pWorkWin->ConfigChild_Impl( eIdent, SFX_SETDOCKINGRECTS, pMgr->GetType() );
664 : 0 : pImp->SetDockAlignment(GetAlignment());
665 : :
666 [ # # ]: 0 : if ( pImp->pSplitWin )
667 : : {
668 : : // Get the current docking data
669 : 0 : pImp->pSplitWin->GetWindowPos(this, pImp->nLine, pImp->nPos);
670 : 0 : pImp->nDockLine = pImp->nLine;
671 : 0 : pImp->nDockPos = pImp->nPos;
672 : 0 : pImp->bNewLine = sal_False;
673 : : }
674 : : }
675 : :
676 : : //-------------------------------------------------------------------------
677 : :
678 : 0 : sal_Bool SfxDockingWindow::Docking( const Point& rPos, Rectangle& rRect )
679 : :
680 : : /* [Description]
681 : :
682 : : This virtual method of the DockingWindow class calculates the current
683 : : tracking rectangle. For this purpose the method CalcAlignment(RPOs, rRect)
684 : : is used, the behavior can be influenced by the derived classes (see below).
685 : : This method should if possible not be overwritten.
686 : : */
687 : : {
688 [ # # ]: 0 : if ( Application::IsInModalMode() )
689 : 0 : return sal_True;
690 : :
691 [ # # ][ # # ]: 0 : if ( !pImp->bConstructed || !pMgr )
692 : : {
693 [ # # ]: 0 : rRect.SetSize( Size() );
694 : 0 : return IsFloatingMode();
695 : : }
696 : :
697 : 0 : SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl();
698 [ # # ][ # # ]: 0 : if ( pImp->bDockingPrevented || !pWorkWin->IsInternalDockingAllowed() )
[ # # ]
699 : 0 : return sal_False;
700 : :
701 : 0 : sal_Bool bFloatMode = sal_False;
702 : :
703 [ # # ][ # # ]: 0 : if ( GetOuterRect().IsInside( rPos ) && !IsDockingPrevented() )
[ # # ]
704 : : {
705 : : // Mouse within OuterRect: calculate Alignment and Rectangle
706 : 0 : SfxChildAlignment eAlign = CalcAlignment(rPos, rRect);
707 [ # # ]: 0 : if (eAlign == SFX_ALIGN_NOALIGNMENT)
708 : 0 : bFloatMode = sal_True;
709 : 0 : pImp->SetDockAlignment(eAlign);
710 : : }
711 : : else
712 : : {
713 : : // Mouse is not within OuterRect: must be FloatingWindow
714 : : // Is this allowed?
715 [ # # ]: 0 : if (CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_NOALIGNMENT) != SFX_ALIGN_NOALIGNMENT)
716 : 0 : return sal_False;
717 : 0 : bFloatMode = sal_True;
718 [ # # ]: 0 : if ( SFX_ALIGN_NOALIGNMENT != pImp->GetDockAlignment() )
719 : : {
720 : : // Due to a bug the rRect may only be changed when the
721 : : // alignment is changed!
722 : 0 : pImp->SetDockAlignment(SFX_ALIGN_NOALIGNMENT);
723 [ # # ]: 0 : rRect.SetSize(CalcDockingSize(SFX_ALIGN_NOALIGNMENT));
724 : : }
725 : : }
726 : :
727 [ # # ]: 0 : if ( !pImp->bSplitable )
728 : : {
729 : : // For individually docked window the position is set through the
730 : : // alignment and the docking rectangle.
731 [ # # ]: 0 : Size aSize = rRect.GetSize();
732 : 0 : Point aPos;
733 : :
734 [ # # # # : 0 : switch ( pImp->GetDockAlignment() )
# ]
735 : : {
736 : : case SFX_ALIGN_LEFT:
737 : : case SFX_ALIGN_FIRSTLEFT:
738 : : case SFX_ALIGN_LASTLEFT:
739 : 0 : aPos = aInnerRect.TopLeft();
740 [ # # ]: 0 : if ( pImp->GetDockAlignment() == GetAlignment() )
741 : 0 : aPos.X() -= aSize.Width();
742 : 0 : break;
743 : :
744 : : case SFX_ALIGN_TOP:
745 : : case SFX_ALIGN_LOWESTTOP:
746 : : case SFX_ALIGN_HIGHESTTOP:
747 : 0 : aPos = Point(aOuterRect.Left(), aInnerRect.Top());
748 [ # # ]: 0 : if ( pImp->GetDockAlignment() == GetAlignment() )
749 : 0 : aPos.Y() -= aSize.Height();
750 : 0 : break;
751 : :
752 : : case SFX_ALIGN_RIGHT:
753 : : case SFX_ALIGN_FIRSTRIGHT:
754 : : case SFX_ALIGN_LASTRIGHT:
755 [ # # ]: 0 : aPos = Point(aInnerRect.Right() - rRect.GetSize().Width(),
756 : 0 : aInnerRect.Top());
757 [ # # ]: 0 : if ( pImp->GetDockAlignment() == GetAlignment() )
758 : 0 : aPos.X() += aSize.Width();
759 : 0 : break;
760 : :
761 : : case SFX_ALIGN_BOTTOM:
762 : : case SFX_ALIGN_HIGHESTBOTTOM:
763 : : case SFX_ALIGN_LOWESTBOTTOM:
764 : 0 : aPos = Point(aOuterRect.Left(),
765 [ # # ]: 0 : aInnerRect.Bottom() - rRect.GetSize().Height());
766 [ # # ]: 0 : if ( pImp->GetDockAlignment() == GetAlignment() )
767 : 0 : aPos.Y() += aSize.Height();
768 : 0 : break;
769 : : default:
770 : 0 : break;
771 : : }
772 : :
773 : 0 : rRect.SetPos(aPos);
774 : : }
775 : :
776 : 0 : return bFloatMode;
777 : : }
778 : :
779 : : //-------------------------------------------------------------------------
780 : :
781 : 0 : void SfxDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode )
782 : :
783 : : /* [Description]
784 : :
785 : : Virtual method of the DockingWindow class ensures the correct alignment on
786 : : the parent window. If this method is overloaded by a derived class, then
787 : : SfxDockingWindow::EndDocking() must be called first.
788 : : */
789 : : {
790 [ # # ][ # # ]: 0 : if ( !pImp->bConstructed || IsDockingCanceled() || !pMgr )
[ # # ][ # # ]
791 : 0 : return;
792 : :
793 : 0 : SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl();
794 : 0 : sal_Bool bReArrange = sal_False;
795 [ # # ]: 0 : if ( pImp->bSplitable )
796 : : {
797 : : // If the alignment changes and the window is in a docked state in a
798 : : // SplitWindow, then it must be re-registered. If it is docked again,
799 : : // PrepareToggleFloatingMode() and ToggleFloatingMode() preform the
800 : : // re-registered
801 [ # # ]: 0 : if ( !bFloatMode )
802 : 0 : bReArrange = sal_True;
803 : : }
804 : :
805 [ # # ]: 0 : if ( bReArrange )
806 : : {
807 [ # # ]: 0 : if ( GetAlignment() != pImp->GetDockAlignment() )
808 : : {
809 : : // before Show() is called must the reassignment have been made,
810 : : // therefore the base class can not be called
811 [ # # ][ # # ]: 0 : if ( IsFloatingMode() || !pImp->bSplitable )
[ # # ]
812 : 0 : Show( sal_False, SHOW_NOFOCUSCHANGE );
813 : :
814 : : // Set the size for toggling.
815 : 0 : pImp->aSplitSize = rRect.GetSize();
816 [ # # ]: 0 : if ( IsFloatingMode() )
817 : : {
818 : 0 : SetFloatingMode( bFloatMode );
819 [ # # ][ # # ]: 0 : if ( IsFloatingMode() || !pImp->bSplitable )
[ # # ]
820 : 0 : Show( sal_True, SHOW_NOFOCUSCHANGE );
821 : : }
822 : : else
823 : : {
824 : 0 : pImp->pSplitWin->RemoveWindow(this,sal_False);
825 : 0 : pImp->nLine = pImp->nDockLine;
826 : 0 : pImp->nPos = pImp->nDockPos;
827 : 0 : pImp->pSplitWin->ReleaseWindow_Impl(this);
828 : 0 : pImp->pSplitWin = pWorkWin->GetSplitWindow_Impl(pImp->GetDockAlignment());
829 : 0 : pImp->pSplitWin->InsertWindow( this, pImp->aSplitSize, pImp->nDockLine, pImp->nDockPos, pImp->bNewLine );
830 [ # # ]: 0 : if ( !pImp->pSplitWin->IsFadeIn() )
831 : 0 : pImp->pSplitWin->FadeIn();
832 : : }
833 : : }
834 [ # # ][ # # ]: 0 : else if ( pImp->nLine != pImp->nDockLine || pImp->nPos != pImp->nDockPos || pImp->bNewLine )
[ # # ]
835 : : {
836 : : // Moved within Splitwindows
837 [ # # ]: 0 : if ( pImp->nLine != pImp->nDockLine )
838 : 0 : pImp->aSplitSize = rRect.GetSize();
839 : 0 : pImp->pSplitWin->MoveWindow( this, pImp->aSplitSize, pImp->nDockLine, pImp->nDockPos, pImp->bNewLine );
840 : : }
841 : : }
842 : : else
843 : : {
844 : 0 : pImp->bEndDocked = sal_True;
845 : 0 : DockingWindow::EndDocking(rRect, bFloatMode);
846 : 0 : pImp->bEndDocked = sal_False;
847 : : }
848 : :
849 [ # # ]: 0 : SetAlignment( IsFloatingMode() ? SFX_ALIGN_NOALIGNMENT : pImp->GetDockAlignment() );
850 : : }
851 : :
852 : : //-------------------------------------------------------------------------
853 : :
854 : 0 : void SfxDockingWindow::Resizing( Size& /*rSize*/ )
855 : :
856 : : /* [Description]
857 : :
858 : : Virtual method of the DockingWindow class. Here, the interactive resize in
859 : : FloatingMode can be influenced, for example by only allowing for discrete
860 : : values for width and / or height. The base implementation prevents that the
861 : : output size is smaller than one set with SetMinOutputSizePixel().
862 : : */
863 : :
864 : : {
865 : :
866 : 0 : }
867 : :
868 : : //-------------------------------------------------------------------------
869 : :
870 : 2 : SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW,
871 : : Window* pParent, WinBits nWinBits) :
872 : : DockingWindow (pParent, nWinBits),
873 : : pBindings(pBindinx),
874 : : pMgr(pCW),
875 [ + - ][ + - ]: 2 : pImp(NULL)
876 : :
877 : : /* [Description]
878 : :
879 : : Constructor for the SfxDockingWindow class. A SfxChildWindow will be
880 : : required because the docking is implemented in Sfx through SfxChildWindows.
881 : : */
882 : :
883 : : {
884 [ - + ][ + - ]: 2 : if ( !GetHelpId().isEmpty() )
885 : : {
886 [ # # ][ # # ]: 0 : SetUniqueId( GetHelpId() );
887 [ # # ]: 0 : SetHelpId("");
888 : : }
889 : : else
890 : : {
891 [ + - ]: 2 : SfxViewFrame* pViewFrame = pBindings->GetDispatcher()->GetFrame();
892 [ + - ][ + - ]: 2 : SfxSlotPool* pSlotPool = pViewFrame->GetObjectShell()->GetModule()->GetSlotPool();
[ + - ]
893 [ + - ]: 2 : const SfxSlot* pSlot = pSlotPool->GetSlot( pCW->GetType() );
894 [ + - ]: 2 : if ( pSlot )
895 : : {
896 : 2 : rtl::OString aCmd("SFXDOCKINGWINDOW_");
897 : 2 : aCmd += pSlot->GetUnoName();
898 [ + - ]: 2 : SetUniqueId( aCmd );
899 : : }
900 : : }
901 : :
902 [ + - ][ + - ]: 2 : pImp = new SfxDockingWindow_Impl;
903 : 2 : pImp->bConstructed = sal_False;
904 : 2 : pImp->pSplitWin = 0;
905 : 2 : pImp->bEndDocked = sal_False;
906 : 2 : pImp->bDockingPrevented = sal_False;
907 : :
908 : 2 : pImp->bSplitable = sal_True;
909 : :
910 : : // Initially set to default, the alignment is set in the subclass
911 : 2 : pImp->nLine = pImp->nDockLine = 0;
912 : 2 : pImp->nPos = pImp->nDockPos = 0;
913 : 2 : pImp->bNewLine = sal_False;
914 : 2 : pImp->SetLastAlignment(SFX_ALIGN_NOALIGNMENT);
915 [ + - ]: 2 : pImp->aMoveTimer.SetTimeout(50);
916 [ + - ]: 2 : pImp->aMoveTimer.SetTimeoutHdl(LINK(this,SfxDockingWindow,TimerHdl));
917 : 2 : }
918 : :
919 : : //-------------------------------------------------------------------------
920 : :
921 : 310 : SfxDockingWindow::SfxDockingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW,
922 : : Window* pParent, const ResId& rResId) :
923 : : DockingWindow(pParent, rResId),
924 : : pBindings(pBindinx),
925 : : pMgr(pCW),
926 [ + - ][ + - ]: 310 : pImp(NULL)
927 : :
928 : : /* [Description]
929 : :
930 : : Constructor for the SfxDockingWindow class. A SfxChildWindow will be
931 : : required because the docking is implemented in Sfx through SfxChildWindows.
932 : : */
933 : :
934 : : {
935 [ + - ][ + - ]: 310 : if ( !GetHelpId().isEmpty() )
936 : : {
937 [ + - ][ + - ]: 310 : SetUniqueId( GetHelpId() );
938 [ + - ]: 310 : SetHelpId("");
939 : : }
940 : : else
941 : : {
942 [ # # ]: 0 : SfxViewFrame* pViewFrame = pBindings->GetDispatcher()->GetFrame();
943 [ # # ][ # # ]: 0 : SfxSlotPool* pSlotPool = pViewFrame->GetObjectShell()->GetModule()->GetSlotPool();
[ # # ]
944 [ # # ]: 0 : const SfxSlot* pSlot = pSlotPool->GetSlot( pCW->GetType() );
945 [ # # ]: 0 : if ( pSlot )
946 : : {
947 : 0 : rtl::OString aCmd("SFXDOCKINGWINDOW_");
948 : 0 : aCmd += pSlot->GetUnoName();
949 [ # # ]: 0 : SetUniqueId( aCmd );
950 : : }
951 : : }
952 : :
953 [ + - ][ + - ]: 310 : pImp = new SfxDockingWindow_Impl;
954 : 310 : pImp->bConstructed = sal_False;
955 : 310 : pImp->pSplitWin = 0;
956 : 310 : pImp->bEndDocked = sal_False;
957 : 310 : pImp->bDockingPrevented = sal_False;
958 : :
959 : 310 : pImp->bSplitable = sal_True;
960 : :
961 : : // Initially set to default, the alignment is set in the subclass
962 : 310 : pImp->nLine = pImp->nDockLine = 0;
963 : 310 : pImp->nPos = pImp->nDockPos = 0;
964 : 310 : pImp->bNewLine = sal_False;
965 : 310 : pImp->SetLastAlignment(SFX_ALIGN_NOALIGNMENT);
966 [ + - ]: 310 : pImp->aMoveTimer.SetTimeout(50);
967 [ + - ]: 310 : pImp->aMoveTimer.SetTimeoutHdl(LINK(this,SfxDockingWindow,TimerHdl));
968 : 310 : }
969 : :
970 : : //-------------------------------------------------------------------------
971 : :
972 : 312 : void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo)
973 : : /* [Description]
974 : :
975 : : Initialization of the SfxDockingDialog class via a SfxChildWinInfo.
976 : : The initialization is done only in a 2nd step after the constructor, this
977 : : constructor should be called from the derived class or from the
978 : : SfxChildWindows.
979 : : */
980 : : {
981 [ - + ]: 312 : if ( !pMgr )
982 : : {
983 : 0 : pImp->SetDockAlignment( SFX_ALIGN_NOALIGNMENT );
984 : 0 : pImp->bConstructed = sal_True;
985 : 312 : return;
986 : : }
987 : :
988 [ + + ]: 312 : if ( pInfo->nFlags & SFX_CHILDWIN_FORCEDOCK )
989 : 2 : pImp->bDockingPrevented = sal_True;
990 : :
991 : 312 : pImp->aSplitSize = GetOutputSizePixel();
992 [ + + ]: 312 : if ( !GetFloatingSize().Width() )
993 : : {
994 [ + - ]: 310 : Size aMinSize( GetMinOutputSizePixel() );
995 : 310 : SetFloatingSize( pImp->aSplitSize );
996 [ - + ]: 310 : if ( pImp->aSplitSize.Width() < aMinSize.Width() )
997 : 0 : pImp->aSplitSize.Width() = aMinSize.Width();
998 [ - + ]: 310 : if ( pImp->aSplitSize.Height() < aMinSize.Height() )
999 : 310 : pImp->aSplitSize.Height() = aMinSize.Height();
1000 : : }
1001 : :
1002 : 312 : sal_Bool bVertHorzRead( sal_False );
1003 [ + + ]: 312 : if ( pInfo->aExtraString.Len() )
1004 : : {
1005 : : // get information about alignment, split size and position in SplitWindow
1006 [ + - ]: 274 : String aStr;
1007 [ + - ]: 274 : sal_uInt16 nPos = pInfo->aExtraString.SearchAscii("AL:");
1008 [ + - ]: 274 : if ( nPos != STRING_NOTFOUND )
1009 : : {
1010 : : // alignment information
1011 [ + - ]: 274 : sal_uInt16 n1 = pInfo->aExtraString.Search('(', nPos);
1012 [ + - ]: 274 : if ( n1 != STRING_NOTFOUND )
1013 : : {
1014 [ + - ]: 274 : sal_uInt16 n2 = pInfo->aExtraString.Search(')', n1);
1015 [ + - ]: 274 : if ( n2 != STRING_NOTFOUND )
1016 : : {
1017 : : // extract alignment information from extrastring
1018 [ + - ][ + - ]: 274 : aStr = pInfo->aExtraString.Copy(nPos, n2 - nPos + 1);
[ + - ]
1019 [ + - ]: 274 : pInfo->aExtraString.Erase(nPos, n2 - nPos + 1);
1020 [ + - ]: 274 : aStr.Erase(nPos, n1-nPos+1);
1021 : : }
1022 : : }
1023 : : }
1024 : :
1025 [ + - ]: 274 : if ( aStr.Len() )
1026 : : {
1027 : : // accept window state only if alignment is also set
1028 : 274 : pImp->aWinState = pInfo->aWinState;
1029 : :
1030 : : // check for valid alignment
1031 [ + - ]: 274 : SfxChildAlignment eLocalAlignment = (SfxChildAlignment) (sal_uInt16) aStr.ToInt32();
1032 [ - + ]: 274 : if ( pImp->bDockingPrevented )
1033 : : // docking prevented, ignore old configuration and take alignment from default
1034 [ # # ]: 0 : aStr.Erase();
1035 : : else
1036 [ + - ]: 274 : SetAlignment( eLocalAlignment );
1037 : :
1038 [ + - ]: 274 : SfxChildAlignment eAlign = CheckAlignment(GetAlignment(),GetAlignment());
1039 [ - + ]: 274 : if ( eAlign != GetAlignment() )
1040 : : {
1041 : : OSL_FAIL("Invalid Alignment!");
1042 [ # # ]: 0 : SetAlignment( eAlign );
1043 [ # # ]: 0 : aStr.Erase();
1044 : : }
1045 : :
1046 : : // get last alignment (for toggeling)
1047 [ + - ]: 274 : nPos = aStr.Search(',');
1048 [ + - ]: 274 : if ( nPos != STRING_NOTFOUND )
1049 : : {
1050 [ + - ]: 274 : aStr.Erase(0, nPos+1);
1051 [ + - ]: 274 : pImp->SetLastAlignment( (SfxChildAlignment) (sal_uInt16) aStr.ToInt32() );
1052 : : }
1053 : :
1054 [ + - ]: 274 : nPos = aStr.Search(',');
1055 [ + - ]: 274 : if ( nPos != STRING_NOTFOUND )
1056 : : {
1057 : : // get split size and position in SplitWindow
1058 : 274 : Point aPos;
1059 [ + - ]: 274 : aStr.Erase(0, nPos+1);
1060 [ + - ][ + - ]: 274 : if ( GetPosSizeFromString( aStr, aPos, pImp->aSplitSize ) )
1061 : : {
1062 : 274 : pImp->nLine = pImp->nDockLine = (sal_uInt16) aPos.X();
1063 : 274 : pImp->nPos = pImp->nDockPos = (sal_uInt16) aPos.Y();
1064 : 274 : pImp->nVerticalSize = pImp->aSplitSize.Height();
1065 : 274 : pImp->nHorizontalSize = pImp->aSplitSize.Width();
1066 [ + - ][ + - ]: 274 : if ( GetSplitSizeFromString( aStr, pImp->aSplitSize ))
1067 : 274 : bVertHorzRead = sal_True;
1068 : : }
1069 : : }
1070 : : }
1071 : : else {
1072 : : OSL_FAIL( "Information is missing!" );
1073 [ + - ]: 274 : }
1074 : : }
1075 : :
1076 [ + + ]: 312 : if ( !bVertHorzRead )
1077 : : {
1078 : 38 : pImp->nVerticalSize = pImp->aSplitSize.Height();
1079 : 38 : pImp->nHorizontalSize = pImp->aSplitSize.Width();
1080 : : }
1081 : :
1082 : 312 : SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl();
1083 [ + - ]: 312 : if ( GetAlignment() != SFX_ALIGN_NOALIGNMENT )
1084 : : {
1085 : : // check if SfxWorkWindow is able to allow docking at its border
1086 [ - + ][ + - : 936 : if (
+ - - + #
# ]
1087 : 312 : !pWorkWin->IsDockingAllowed() ||
1088 : 312 : !pWorkWin->IsInternalDockingAllowed() ||
1089 : 312 : ( (GetFloatStyle() & WB_STANDALONE) && Application::IsInModalMode()) )
1090 : : {
1091 : 0 : SetAlignment( SFX_ALIGN_NOALIGNMENT );
1092 : : }
1093 : : }
1094 : :
1095 : : // detect floating mode
1096 : : // toggeling mode will not execute code in handlers, because pImp->bConstructed is not set yet
1097 : 312 : sal_Bool bFloatMode = IsFloatingMode();
1098 [ - + ]: 312 : if ( bFloatMode != ((GetAlignment() == SFX_ALIGN_NOALIGNMENT)) )
1099 : : {
1100 : 0 : bFloatMode = !bFloatMode;
1101 : 0 : SetFloatingMode( bFloatMode );
1102 [ # # ]: 0 : if ( bFloatMode )
1103 : : {
1104 [ # # ]: 0 : if ( !pImp->aWinState.isEmpty() )
1105 : 0 : GetFloatingWindow()->SetWindowState( pImp->aWinState );
1106 : : else
1107 [ # # ]: 0 : GetFloatingWindow()->SetOutputSizePixel( GetFloatingSize() );
1108 : : }
1109 : : }
1110 : :
1111 [ - + ]: 312 : if ( IsFloatingMode() )
1112 : : {
1113 : : // validate last alignment
1114 : 0 : SfxChildAlignment eLastAlign = pImp->GetLastAlignment();
1115 [ # # ]: 0 : if ( eLastAlign == SFX_ALIGN_NOALIGNMENT)
1116 : 0 : eLastAlign = CheckAlignment(eLastAlign, SFX_ALIGN_LEFT);
1117 [ # # ]: 0 : if ( eLastAlign == SFX_ALIGN_NOALIGNMENT)
1118 : 0 : eLastAlign = CheckAlignment(eLastAlign, SFX_ALIGN_RIGHT);
1119 [ # # ]: 0 : if ( eLastAlign == SFX_ALIGN_NOALIGNMENT)
1120 : 0 : eLastAlign = CheckAlignment(eLastAlign, SFX_ALIGN_TOP);
1121 [ # # ]: 0 : if ( eLastAlign == SFX_ALIGN_NOALIGNMENT)
1122 : 0 : eLastAlign = CheckAlignment(eLastAlign, SFX_ALIGN_BOTTOM);
1123 : 0 : pImp->SetLastAlignment(eLastAlign);
1124 : : }
1125 : : else
1126 : : {
1127 : : // docked window must have NOALIGNMENT as last alignment
1128 : 312 : pImp->SetLastAlignment(SFX_ALIGN_NOALIGNMENT);
1129 : :
1130 [ + - ]: 312 : if ( pImp->bSplitable )
1131 : : {
1132 : 312 : pImp->pSplitWin = pWorkWin->GetSplitWindow_Impl(GetAlignment());
1133 : 312 : pImp->pSplitWin->InsertWindow(this, pImp->aSplitSize);
1134 : : }
1135 : : else
1136 : : {
1137 : : //?????? Currently not supported
1138 : : // Window is docked individually; size is calculated.
1139 : : // It must therefore be initialized with the DloatingSize if
1140 : : // someone relies on it that a reasonable size is set
1141 [ # # ]: 0 : SetSizePixel(GetFloatingSize());
1142 [ # # ]: 0 : SetSizePixel(CalcDockingSize(GetAlignment()));
1143 : : }
1144 : : }
1145 : :
1146 : : // save alignment
1147 : 312 : pImp->SetDockAlignment( GetAlignment() );
1148 : : }
1149 : :
1150 : 312 : void SfxDockingWindow::Initialize_Impl()
1151 : : {
1152 [ - + ]: 312 : if ( !pMgr )
1153 : : {
1154 : 0 : pImp->bConstructed = sal_True;
1155 : 312 : return;
1156 : : }
1157 : :
1158 : 312 : FloatingWindow* pFloatWin = GetFloatingWindow();
1159 : 312 : sal_Bool bSet = sal_False;
1160 [ - + ]: 312 : if ( pFloatWin )
1161 : : {
1162 : 0 : bSet = !pFloatWin->IsDefaultPos();
1163 : : }
1164 : : else
1165 : : {
1166 [ + - ]: 312 : Point aPos = GetFloatingPos();
1167 [ + + ]: 312 : if ( aPos != Point() )
1168 : 312 : bSet = sal_True;
1169 : : }
1170 : :
1171 [ + + ]: 312 : if ( !bSet)
1172 : : {
1173 [ + - ]: 192 : SfxViewFrame *pFrame = pBindings->GetDispatcher_Impl()->GetFrame();
1174 [ + - ]: 192 : Window* pEditWin = pFrame->GetViewShell()->GetWindow();
1175 [ + - ][ + - ]: 192 : Point aPos = pEditWin->OutputToScreenPixel( pEditWin->GetPosPixel() );
1176 [ + - ][ + - ]: 192 : aPos = GetParent()->ScreenToOutputPixel( aPos );
1177 [ + - ]: 192 : SetFloatingPos( aPos );
1178 : : }
1179 : :
1180 [ - + ]: 312 : if ( pFloatWin )
1181 : : {
1182 : : // initialize floating window
1183 [ # # ]: 0 : if ( pImp->aWinState.isEmpty() )
1184 : : // window state never set before, get if from defaults
1185 : 0 : pImp->aWinState = pFloatWin->GetWindowState();
1186 : :
1187 : : // trick: use VCL method SetWindowState to adjust position and size
1188 : 0 : pFloatWin->SetWindowState( pImp->aWinState );
1189 : :
1190 : : // remember floating size for calculating alignment and tracking rectangle
1191 : 0 : SetFloatingSize( pFloatWin->GetSizePixel() );
1192 : :
1193 : : }
1194 : :
1195 : : // allow calling of docking handlers
1196 : 312 : pImp->bConstructed = sal_True;
1197 : : }
1198 : :
1199 : : //-------------------------------------------------------------------------
1200 : :
1201 : 936 : void SfxDockingWindow::FillInfo(SfxChildWinInfo& rInfo) const
1202 : :
1203 : : /* [Description]
1204 : :
1205 : : Fills a SfxChildWinInfo with specific data from SfxDockingWindow,
1206 : : so that it can be written in the INI file. It is assumed that rinfo
1207 : : receives all other possible relevant data in the ChildWindow class.
1208 : : Insertions are marked with size and the ZoomIn flag.
1209 : : If this method is overridden, the base implementation must be called first.
1210 : : */
1211 : :
1212 : : {
1213 [ - + ]: 936 : if ( !pMgr )
1214 : 936 : return;
1215 : :
1216 [ - + ][ # # ]: 936 : if ( GetFloatingWindow() && pImp->bConstructed )
[ - + ]
1217 : 0 : pImp->aWinState = GetFloatingWindow()->GetWindowState();
1218 : :
1219 : 936 : rInfo.aWinState = pImp->aWinState;
1220 [ + - ]: 936 : rInfo.aExtraString = DEFINE_CONST_UNICODE("AL:(");
1221 [ + - ]: 936 : rInfo.aExtraString += String::CreateFromInt32((sal_uInt16) GetAlignment());
1222 : 936 : rInfo.aExtraString += ',';
1223 [ + - ]: 936 : rInfo.aExtraString += String::CreateFromInt32 ((sal_uInt16) pImp->GetLastAlignment());
1224 [ + - ]: 936 : if ( pImp->bSplitable )
1225 : : {
1226 : 936 : Point aPos(pImp->nLine, pImp->nPos);
1227 [ + - ]: 936 : rInfo.aExtraString += ',';
1228 [ + - ][ + - ]: 936 : rInfo.aExtraString += String::CreateFromInt32( aPos.X() );
[ + - ]
1229 [ + - ]: 936 : rInfo.aExtraString += '/';
1230 [ + - ][ + - ]: 936 : rInfo.aExtraString += String::CreateFromInt32( aPos.Y() );
[ + - ]
1231 [ + - ]: 936 : rInfo.aExtraString += '/';
1232 [ + - ][ + - ]: 936 : rInfo.aExtraString += String::CreateFromInt32( pImp->nHorizontalSize );
[ + - ]
1233 [ + - ]: 936 : rInfo.aExtraString += '/';
1234 [ + - ][ + - ]: 936 : rInfo.aExtraString += String::CreateFromInt32( pImp->nVerticalSize );
[ + - ]
1235 [ + - ]: 936 : rInfo.aExtraString += ',';
1236 [ + - ][ + - ]: 936 : rInfo.aExtraString += String::CreateFromInt32( pImp->aSplitSize.Width() );
[ + - ]
1237 [ + - ]: 936 : rInfo.aExtraString += ';';
1238 [ + - ][ + - ]: 936 : rInfo.aExtraString += String::CreateFromInt32( pImp->aSplitSize.Height() );
[ + - ]
1239 : : }
1240 : :
1241 : 936 : rInfo.aExtraString += ')';
1242 : : }
1243 : :
1244 : : //-------------------------------------------------------------------------
1245 : :
1246 : 312 : SfxDockingWindow::~SfxDockingWindow()
1247 : : {
1248 [ + - ]: 312 : ReleaseChildWindow_Impl();
1249 [ + - ][ + - ]: 312 : delete pImp;
1250 [ - + ]: 312 : }
1251 : :
1252 : 312 : void SfxDockingWindow::ReleaseChildWindow_Impl()
1253 : : {
1254 [ + - ][ + - ]: 312 : if ( pMgr && pMgr->GetFrame() == pBindings->GetActiveFrame() )
[ + - ][ + - ]
[ + + ][ + - ]
[ + - ][ + +
# # # # ]
1255 [ + - ]: 2 : pBindings->SetActiveFrame( NULL );
1256 : :
1257 [ + - ][ + - ]: 312 : if ( pMgr && pImp->pSplitWin && pImp->pSplitWin->IsItemValid( GetType() ) )
[ + - ][ + - ]
1258 : 312 : pImp->pSplitWin->RemoveWindow(this);
1259 : :
1260 : 312 : pMgr=NULL;
1261 : 312 : }
1262 : :
1263 : : //-------------------------------------------------------------------------
1264 : :
1265 : 0 : SfxChildAlignment SfxDockingWindow::CalcAlignment(const Point& rPos, Rectangle& rRect)
1266 : :
1267 : : /* [Description]
1268 : :
1269 : : This method calculates a resulting alignment for the given mouse position
1270 : : and tracking rectangle. When changing the alignment it can also be that
1271 : : the tracking rectangle is changed, so that an altered rectangle is
1272 : : returned. The user of this class can influence behaviour of this method,
1273 : : and thus the behavior of his DockinWindow class when docking where the
1274 : : called virtual method:
1275 : :
1276 : : SfxDockingWindow :: CalcDockingSize (SfxChildAlignment eAlign)
1277 : :
1278 : : is overridden (see below).
1279 : : */
1280 : :
1281 : : {
1282 : : // calculate hypothetical sizes for different modes
1283 [ # # ]: 0 : Size aFloatingSize(CalcDockingSize(SFX_ALIGN_NOALIGNMENT));
1284 [ # # ]: 0 : Size aVerticalSize(CalcDockingSize(SFX_ALIGN_LEFT));
1285 [ # # ]: 0 : Size aHorizontalSize(CalcDockingSize(SFX_ALIGN_TOP));
1286 : :
1287 : : // check if docking is permitted
1288 [ # # ]: 0 : SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl();
1289 [ # # ]: 0 : if ( !pWorkWin->IsDockingAllowed() )
1290 : : {
1291 [ # # ]: 0 : rRect.SetSize( aFloatingSize );
1292 : 0 : return pImp->GetDockAlignment();
1293 : : }
1294 : :
1295 : : // calculate borders to shrink inner area before checking for intersection with tracking rectangle
1296 : : long nLRBorder, nTBBorder;
1297 [ # # ]: 0 : if ( pImp->bSplitable )
1298 : : {
1299 : : // take the smaller size of docked and floating mode
1300 : 0 : Size aSize = pImp->aSplitSize;
1301 [ # # ]: 0 : if ( GetFloatingSize().Height() < aSize.Height() )
1302 : 0 : aSize.Height() = GetFloatingSize().Height();
1303 [ # # ]: 0 : if ( GetFloatingSize().Width() < aSize.Width() )
1304 : 0 : aSize.Width() = GetFloatingSize().Width();
1305 : :
1306 : 0 : nLRBorder = aSize.Width();
1307 : 0 : nTBBorder = aSize.Height();
1308 : : }
1309 : : else
1310 : : {
1311 : 0 : nLRBorder = aVerticalSize.Width();
1312 : 0 : nTBBorder = aHorizontalSize.Height();
1313 : : }
1314 : :
1315 : : // limit border to predefined constant values
1316 [ # # ]: 0 : if ( nLRBorder > MAX_TOGGLEAREA_WIDTH )
1317 : 0 : nLRBorder = MAX_TOGGLEAREA_WIDTH;
1318 [ # # ]: 0 : if ( nTBBorder > MAX_TOGGLEAREA_WIDTH )
1319 : 0 : nTBBorder = MAX_TOGGLEAREA_WIDTH;
1320 : :
1321 : : // shrink area for floating mode if possible
1322 : 0 : Rectangle aInRect = GetInnerRect();
1323 [ # # ][ # # ]: 0 : if ( aInRect.GetWidth() > nLRBorder )
1324 : 0 : aInRect.Left() += nLRBorder/2;
1325 [ # # ][ # # ]: 0 : if ( aInRect.GetWidth() > nLRBorder )
1326 : 0 : aInRect.Right() -= nLRBorder/2;
1327 [ # # ][ # # ]: 0 : if ( aInRect.GetHeight() > nTBBorder )
1328 : 0 : aInRect.Top() += nTBBorder/2;
1329 [ # # ][ # # ]: 0 : if ( aInRect.GetHeight() > nTBBorder )
1330 : 0 : aInRect.Bottom() -= nTBBorder/2;
1331 : :
1332 : : // calculate alignment resulting from docking rectangle
1333 : 0 : sal_Bool bBecomesFloating = sal_False;
1334 : 0 : SfxChildAlignment eDockAlign = pImp->GetDockAlignment();
1335 : 0 : Rectangle aDockingRect( rRect );
1336 [ # # ][ # # ]: 0 : if ( !IsFloatingMode() )
1337 : : {
1338 : : // don't use tracking rectangle for alignment check, because it will be too large
1339 : : // to get a floating mode as result - switch to floating size
1340 : : // so the calculation only depends on the position of the rectangle, not the current
1341 : : // docking state of the window
1342 [ # # ]: 0 : aDockingRect.SetSize( GetFloatingSize() );
1343 : :
1344 : : // in this mode docking is never done by keyboard, so it's OK to use the mouse position
1345 [ # # ][ # # ]: 0 : aDockingRect.SetPos( pWorkWin->GetWindow()->OutputToScreenPixel( pWorkWin->GetWindow()->GetPointerPosPixel() ) );
1346 : : }
1347 : :
1348 : 0 : Point aPos = aDockingRect.TopLeft();
1349 [ # # ]: 0 : Rectangle aIntersect = GetOuterRect().GetIntersection( aDockingRect );
1350 [ # # ][ # # ]: 0 : if ( aIntersect.IsEmpty() )
1351 : : // docking rectangle completely outside docking area -> floating mode
1352 : 0 : bBecomesFloating = sal_True;
1353 : : else
1354 : : {
1355 : : // create a small test rect around the mouse position and use this one
1356 : : // instead of the passed rRect to not dock too easily or by accident
1357 [ # # ]: 0 : Rectangle aSmallDockingRect;
1358 [ # # ]: 0 : aSmallDockingRect.SetSize( Size( MAX_TOGGLEAREA_WIDTH, MAX_TOGGLEAREA_HEIGHT ) );
1359 : 0 : Point aNewPos(rPos);
1360 [ # # ]: 0 : aNewPos.X() -= aSmallDockingRect.GetWidth()/2;
1361 [ # # ]: 0 : aNewPos.Y() -= aSmallDockingRect.GetHeight()/2;
1362 : 0 : aSmallDockingRect.SetPos(rPos);
1363 [ # # ]: 0 : Rectangle aIntersectRect = aInRect.GetIntersection( aSmallDockingRect );
1364 [ # # ][ # # ]: 0 : if ( aIntersectRect == aSmallDockingRect )
1365 : : // docking rectangle completely inside (shrinked) inner area -> floating mode
1366 : 0 : bBecomesFloating = sal_True;
1367 : : }
1368 : :
1369 [ # # ]: 0 : if ( bBecomesFloating )
1370 : : {
1371 [ # # ]: 0 : eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_NOALIGNMENT);
1372 : : }
1373 : : else
1374 : : {
1375 : : // docking rectangle is in the "sensible area"
1376 : 0 : Point aInPosTL( aPos.X()-aInRect.Left(), aPos.Y()-aInRect.Top() );
1377 [ # # ][ # # ]: 0 : Point aInPosBR( aPos.X()-aInRect.Left() + aDockingRect.GetWidth(), aPos.Y()-aInRect.Top() + aDockingRect.GetHeight() );
1378 [ # # ]: 0 : Size aInSize = aInRect.GetSize();
1379 : 0 : sal_Bool bNoChange = sal_False;
1380 : :
1381 : : // check if alignment is still unchanged
1382 [ # # # # : 0 : switch ( GetAlignment() )
# ]
1383 : : {
1384 : : case SFX_ALIGN_LEFT:
1385 : : case SFX_ALIGN_FIRSTLEFT:
1386 : : case SFX_ALIGN_LASTLEFT:
1387 [ # # ]: 0 : if (aInPosTL.X() <= 0)
1388 : : {
1389 : 0 : eDockAlign = GetAlignment();
1390 : 0 : bNoChange = sal_True;
1391 : : }
1392 : 0 : break;
1393 : : case SFX_ALIGN_TOP:
1394 : : case SFX_ALIGN_LOWESTTOP:
1395 : : case SFX_ALIGN_HIGHESTTOP:
1396 [ # # ]: 0 : if ( aInPosTL.Y() <= 0)
1397 : : {
1398 : 0 : eDockAlign = GetAlignment();
1399 : 0 : bNoChange = sal_True;
1400 : : }
1401 : 0 : break;
1402 : : case SFX_ALIGN_RIGHT:
1403 : : case SFX_ALIGN_FIRSTRIGHT:
1404 : : case SFX_ALIGN_LASTRIGHT:
1405 [ # # ]: 0 : if ( aInPosBR.X() >= aInSize.Width())
1406 : : {
1407 : 0 : eDockAlign = GetAlignment();
1408 : 0 : bNoChange = sal_True;
1409 : : }
1410 : 0 : break;
1411 : : case SFX_ALIGN_BOTTOM:
1412 : : case SFX_ALIGN_LOWESTBOTTOM:
1413 : : case SFX_ALIGN_HIGHESTBOTTOM:
1414 [ # # ]: 0 : if ( aInPosBR.Y() >= aInSize.Height())
1415 : : {
1416 : 0 : eDockAlign = GetAlignment();
1417 : 0 : bNoChange = sal_True;
1418 : : }
1419 : 0 : break;
1420 : : default:
1421 : 0 : break;
1422 : : }
1423 : :
1424 [ # # ]: 0 : if ( !bNoChange )
1425 : : {
1426 : : // alignment will change, test alignment according to distance of the docking rectangles edges
1427 : 0 : sal_Bool bForbidden = sal_True;
1428 [ # # ]: 0 : if ( aInPosTL.X() <= 0)
1429 : : {
1430 [ # # ]: 0 : eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_LEFT);
1431 : : bForbidden = ( eDockAlign != SFX_ALIGN_LEFT &&
1432 : : eDockAlign != SFX_ALIGN_FIRSTLEFT &&
1433 [ # # ][ # # ]: 0 : eDockAlign != SFX_ALIGN_LASTLEFT );
[ # # ]
1434 : : }
1435 : :
1436 [ # # ][ # # ]: 0 : if ( bForbidden && aInPosTL.Y() <= 0)
[ # # ]
1437 : : {
1438 [ # # ]: 0 : eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_TOP);
1439 : : bForbidden = ( eDockAlign != SFX_ALIGN_TOP &&
1440 : : eDockAlign != SFX_ALIGN_HIGHESTTOP &&
1441 [ # # ][ # # ]: 0 : eDockAlign != SFX_ALIGN_LOWESTTOP );
[ # # ]
1442 : : }
1443 : :
1444 [ # # ][ # # ]: 0 : if ( bForbidden && aInPosBR.X() >= aInSize.Width())
[ # # ]
1445 : : {
1446 [ # # ]: 0 : eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_RIGHT);
1447 : : bForbidden = ( eDockAlign != SFX_ALIGN_RIGHT &&
1448 : : eDockAlign != SFX_ALIGN_FIRSTRIGHT &&
1449 [ # # ][ # # ]: 0 : eDockAlign != SFX_ALIGN_LASTRIGHT );
[ # # ]
1450 : : }
1451 : :
1452 [ # # ][ # # ]: 0 : if ( bForbidden && aInPosBR.Y() >= aInSize.Height())
[ # # ]
1453 : : {
1454 [ # # ]: 0 : eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_BOTTOM);
1455 : : bForbidden = ( eDockAlign != SFX_ALIGN_BOTTOM &&
1456 : : eDockAlign != SFX_ALIGN_HIGHESTBOTTOM &&
1457 [ # # ][ # # ]: 0 : eDockAlign != SFX_ALIGN_LOWESTBOTTOM );
[ # # ]
1458 : : }
1459 : :
1460 : : // the calculated alignment was rejected by the window -> take floating mode
1461 [ # # ]: 0 : if ( bForbidden )
1462 [ # # ]: 0 : eDockAlign = CheckAlignment(pImp->GetDockAlignment(),SFX_ALIGN_NOALIGNMENT);
1463 : : }
1464 : : }
1465 : :
1466 [ # # ]: 0 : if ( eDockAlign == SFX_ALIGN_NOALIGNMENT )
1467 : : {
1468 : : // In the FloatingMode the tracking rectangle will get the floating
1469 : : // size. Due to a bug the rRect may only be changed when the
1470 : : // alignment is changed!
1471 [ # # ]: 0 : if ( eDockAlign != pImp->GetDockAlignment() )
1472 [ # # ]: 0 : aDockingRect.SetSize( aFloatingSize );
1473 : : }
1474 [ # # ]: 0 : else if ( pImp->bSplitable )
1475 : : {
1476 : : sal_uInt16 nLine, nPos;
1477 [ # # ]: 0 : SfxSplitWindow *pSplitWin = pWorkWin->GetSplitWindow_Impl(eDockAlign);
1478 [ # # ]: 0 : aPos = pSplitWin->ScreenToOutputPixel( aPos );
1479 [ # # ][ # # ]: 0 : if ( pSplitWin->GetWindowPos( aPos, nLine, nPos ) )
1480 : : {
1481 : : // mouse over splitwindow, get line and position
1482 : 0 : pImp->nDockLine = nLine;
1483 : 0 : pImp->nDockPos = nPos;
1484 : 0 : pImp->bNewLine = sal_False;
1485 : : }
1486 : : else
1487 : : {
1488 : : if ( 0 )
1489 : : {
1490 : : // mouse touches outer border -> treated as floating mode
1491 : : eDockAlign = SFX_ALIGN_NOALIGNMENT;
1492 : : aDockingRect.SetSize( aFloatingSize );
1493 : : rRect = aDockingRect;
1494 : : return eDockAlign;
1495 : : }
1496 : :
1497 : : // mouse touches inner border -> create new line
1498 [ # # ][ # # ]: 0 : if ( eDockAlign == GetAlignment() && pImp->pSplitWin &&
[ # # ][ # # ]
[ # # ]
1499 [ # # ][ # # ]: 0 : pImp->nLine == pImp->pSplitWin->GetLineCount()-1 && pImp->pSplitWin->GetWindowCount(pImp->nLine) == 1 )
1500 : : {
1501 : : // if this window is the only one in the last line, it can't be docked as new line in the same splitwindow
1502 : 0 : pImp->nDockLine = pImp->nLine;
1503 : 0 : pImp->nDockPos = pImp->nPos;
1504 : 0 : pImp->bNewLine = sal_False;
1505 : : }
1506 : : else
1507 : : {
1508 : : // create new line
1509 [ # # ]: 0 : pImp->nDockLine = pSplitWin->GetLineCount();
1510 : 0 : pImp->nDockPos = 0;
1511 : 0 : pImp->bNewLine = sal_True;
1512 : : }
1513 : : }
1514 : :
1515 [ # # ][ # # ]: 0 : sal_Bool bChanged = pImp->nLine != pImp->nDockLine || pImp->nPos != pImp->nDockPos || eDockAlign != GetAlignment();
[ # # ]
1516 [ # # ][ # # ]: 0 : if ( !bChanged && !IsFloatingMode() )
[ # # ][ # # ]
1517 : : {
1518 : : // window only sightly moved, no change of any property
1519 [ # # ]: 0 : rRect.SetSize( pImp->aSplitSize );
1520 : 0 : rRect.SetPos( aDockingRect.TopLeft() );
1521 : 0 : return eDockAlign;
1522 : : }
1523 : :
1524 : : // calculate new size and position
1525 : 0 : Size aSize;
1526 : 0 : Point aPoint = aDockingRect.TopLeft();
1527 [ # # ]: 0 : Size aInnerSize = GetInnerRect().GetSize();
1528 [ # # ][ # # ]: 0 : if ( eDockAlign == SFX_ALIGN_LEFT || eDockAlign == SFX_ALIGN_RIGHT )
1529 : : {
1530 [ # # ]: 0 : if ( pImp->bNewLine )
1531 : : {
1532 : : // set height to height of free area
1533 : 0 : aSize.Height() = aInnerSize.Height();
1534 : 0 : aSize.Width() = pImp->nHorizontalSize;
1535 [ # # ]: 0 : if ( eDockAlign == SFX_ALIGN_LEFT )
1536 : : {
1537 : 0 : aPoint = aInnerRect.TopLeft();
1538 : : }
1539 : : else
1540 : : {
1541 [ # # ]: 0 : aPoint = aInnerRect.TopRight();
1542 : 0 : aPoint.X() -= aSize.Width();
1543 : : }
1544 : : }
1545 : : else
1546 : : {
1547 : : // get width from splitwindow
1548 [ # # ]: 0 : aSize.Width() = pSplitWin->GetLineSize(nLine);
1549 : 0 : aSize.Height() = pImp->aSplitSize.Height();
1550 : : }
1551 : : }
1552 : : else
1553 : : {
1554 [ # # ]: 0 : if ( pImp->bNewLine )
1555 : : {
1556 : : // set width to width of free area
1557 : 0 : aSize.Width() = aInnerSize.Width();
1558 : 0 : aSize.Height() = pImp->nVerticalSize;
1559 [ # # ]: 0 : if ( eDockAlign == SFX_ALIGN_TOP )
1560 : : {
1561 : 0 : aPoint = aInnerRect.TopLeft();
1562 : : }
1563 : : else
1564 : : {
1565 [ # # ]: 0 : aPoint = aInnerRect.BottomLeft();
1566 : 0 : aPoint.Y() -= aSize.Height();
1567 : : }
1568 : : }
1569 : : else
1570 : : {
1571 : : // get height from splitwindow
1572 [ # # ]: 0 : aSize.Height() = pSplitWin->GetLineSize(nLine);
1573 : 0 : aSize.Width() = pImp->aSplitSize.Width();
1574 : : }
1575 : : }
1576 : :
1577 [ # # ]: 0 : aDockingRect.SetSize( aSize );
1578 : 0 : aDockingRect.SetPos( aPoint );
1579 : : }
1580 : : else
1581 : : {
1582 : : // window can be docked, but outside our splitwindows
1583 : : // tracking rectangle only needs to be modified if alignment was changed
1584 [ # # ]: 0 : if ( eDockAlign != pImp->GetDockAlignment() )
1585 : : {
1586 [ # # # # : 0 : switch ( eDockAlign )
# ]
1587 : : {
1588 : : case SFX_ALIGN_LEFT:
1589 : : case SFX_ALIGN_RIGHT:
1590 : : case SFX_ALIGN_FIRSTLEFT:
1591 : 0 : aDockingRect.SetPos( aInnerRect.TopLeft() );
1592 [ # # ]: 0 : aDockingRect.SetSize( aVerticalSize );
1593 : 0 : break;
1594 : : case SFX_ALIGN_LASTLEFT:
1595 : : case SFX_ALIGN_FIRSTRIGHT:
1596 : : case SFX_ALIGN_LASTRIGHT:
1597 : : {
1598 [ # # ]: 0 : Point aPt( aInnerRect.TopRight() );
1599 [ # # ]: 0 : aPt.X() -= aDockingRect.GetWidth();
1600 : 0 : aDockingRect.SetPos( aPt );
1601 [ # # ]: 0 : aDockingRect.SetSize( aVerticalSize );
1602 : : break;
1603 : : }
1604 : :
1605 : : case SFX_ALIGN_TOP:
1606 : : case SFX_ALIGN_BOTTOM:
1607 : : case SFX_ALIGN_LOWESTTOP:
1608 : 0 : aDockingRect.SetPos( aInnerRect.TopLeft() );
1609 [ # # ]: 0 : aDockingRect.SetSize( aHorizontalSize );
1610 : 0 : break;
1611 : : case SFX_ALIGN_HIGHESTTOP:
1612 : : case SFX_ALIGN_LOWESTBOTTOM:
1613 : : case SFX_ALIGN_HIGHESTBOTTOM:
1614 : : {
1615 [ # # ]: 0 : Point aPt( aInnerRect.BottomLeft() );
1616 [ # # ]: 0 : aPt.Y() -= aDockingRect.GetHeight();
1617 : 0 : aDockingRect.SetPos( aPt );
1618 [ # # ]: 0 : aDockingRect.SetSize( aHorizontalSize );
1619 : : break;
1620 : : }
1621 : : default:
1622 : 0 : break;
1623 : : }
1624 : : }
1625 : : }
1626 : :
1627 : 0 : rRect = aDockingRect;
1628 : 0 : return eDockAlign;
1629 : : }
1630 : :
1631 : : //-------------------------------------------------------------------------
1632 : :
1633 : 0 : Size SfxDockingWindow::CalcDockingSize(SfxChildAlignment eAlign)
1634 : :
1635 : : /* [Description]
1636 : :
1637 : : Virtual method of the SfxDockingWindow class. This method determines how
1638 : : the size of the DockingWindows changes depending on the alignment. The base
1639 : : implementation uses the floating mode, the size of the marked Floating
1640 : : Size. For horizontal alignment, the width will be the width of the outer
1641 : : DockingRectangle, with vertical alignment the height will be the height of
1642 : : the inner DockingRectangle (resulting from the order in which the SFX child
1643 : : windows are displayed). The other size is set to the current floating-size,
1644 : : this could changed by a to intervening derived class. The docking size must
1645 : : be the same for Left/Right and Top/Bottom.
1646 : : */
1647 : :
1648 : : {
1649 : : // Note: if the resizing is also possible in the docked state, then the
1650 : : // Floating-size does also have to be adjusted?
1651 : :
1652 : 0 : Size aSize = GetFloatingSize();
1653 [ # # # # ]: 0 : switch (eAlign)
1654 : : {
1655 : : case SFX_ALIGN_TOP:
1656 : : case SFX_ALIGN_BOTTOM:
1657 : : case SFX_ALIGN_LOWESTTOP:
1658 : : case SFX_ALIGN_HIGHESTTOP:
1659 : : case SFX_ALIGN_LOWESTBOTTOM:
1660 : : case SFX_ALIGN_HIGHESTBOTTOM:
1661 : 0 : aSize.Width() = aOuterRect.Right() - aOuterRect.Left();
1662 : 0 : break;
1663 : : case SFX_ALIGN_LEFT:
1664 : : case SFX_ALIGN_RIGHT:
1665 : : case SFX_ALIGN_FIRSTLEFT:
1666 : : case SFX_ALIGN_LASTLEFT:
1667 : : case SFX_ALIGN_FIRSTRIGHT:
1668 : : case SFX_ALIGN_LASTRIGHT:
1669 : 0 : aSize.Height() = aInnerRect.Bottom() - aInnerRect.Top();
1670 : 0 : break;
1671 : : case SFX_ALIGN_NOALIGNMENT:
1672 : 0 : break;
1673 : : default:
1674 : 0 : break;
1675 : : }
1676 : :
1677 : 0 : return aSize;
1678 : : }
1679 : :
1680 : : //-------------------------------------------------------------------------
1681 : :
1682 : 124 : SfxChildAlignment SfxDockingWindow::CheckAlignment(SfxChildAlignment,
1683 : : SfxChildAlignment eAlign)
1684 : :
1685 : : /* [Description]
1686 : :
1687 : : Virtual method of the SfxDockingWindow class. Here a derived class can
1688 : : disallow certain alignments. The base implementation does not
1689 : : prohibit alignment.
1690 : : */
1691 : :
1692 : : {
1693 : 124 : return eAlign;
1694 : : }
1695 : :
1696 : : //-------------------------------------------------------------------------
1697 : :
1698 : 0 : sal_Bool SfxDockingWindow::Close()
1699 : :
1700 : : /* [Description]
1701 : :
1702 : : The window is closed when the ChildWindow is destroyed by running the
1703 : : ChildWindow-slots. If this is method is overridden by a derived class
1704 : : method, then the SfxDockingDialogWindow: Close() must be called afterwards
1705 : : if the Close() was not cancelled with "return sal_False".
1706 : : */
1707 : : {
1708 : : // Execute with Parameters, since Toggle is ignored by some ChildWindows.
1709 [ # # ]: 0 : if ( !pMgr )
1710 : 0 : return sal_True;
1711 : :
1712 [ # # ]: 0 : SfxBoolItem aValue( pMgr->GetType(), sal_False);
1713 : : pBindings->GetDispatcher_Impl()->Execute(
1714 [ # # ]: 0 : pMgr->GetType(), SFX_CALLMODE_RECORD | SFX_CALLMODE_ASYNCHRON, &aValue, 0L );
1715 [ # # ]: 0 : return sal_True;
1716 : : }
1717 : :
1718 : : //-------------------------------------------------------------------------
1719 : :
1720 : 443 : void SfxDockingWindow::Paint(const Rectangle& /*rRect*/)
1721 : :
1722 : : /* [Description]
1723 : :
1724 : : Returns a boundary line to the docked edge and a frame when the Window is in
1725 : : a docked state. In this way SVLOOK is considered.
1726 : : */
1727 : :
1728 : : {
1729 [ - + ][ # # ]: 443 : if ( pImp->bSplitable || IsFloatingMode() )
[ # # ][ - + ]
1730 : 443 : return;
1731 : :
1732 : : Rectangle aRect = Rectangle(Point(0, 0),
1733 [ # # ][ # # ]: 0 : GetOutputSizePixel());
1734 [ # # # # : 0 : switch (GetAlignment())
# ]
1735 : : {
1736 : : case SFX_ALIGN_TOP:
1737 : : {
1738 [ # # ][ # # ]: 0 : DrawLine(aRect.BottomLeft(), aRect.BottomRight());
[ # # ]
1739 : 0 : aRect.Bottom()--;
1740 : 0 : break;
1741 : : }
1742 : :
1743 : : case SFX_ALIGN_BOTTOM:
1744 : : {
1745 [ # # ][ # # ]: 0 : DrawLine(aRect.TopLeft(), aRect.TopRight());
1746 : 0 : aRect.Top()++;
1747 : 0 : break;
1748 : : }
1749 : :
1750 : : case SFX_ALIGN_LEFT:
1751 : : {
1752 [ # # ][ # # ]: 0 : DrawLine(aRect.TopRight(), aRect.BottomRight());
[ # # ]
1753 : 0 : aRect.Right()--;
1754 : 0 : break;
1755 : : }
1756 : :
1757 : : case SFX_ALIGN_RIGHT:
1758 : : {
1759 [ # # ][ # # ]: 0 : DrawLine(aRect.TopLeft(), aRect.BottomLeft());
1760 : 0 : aRect.Left()++;
1761 : 0 : break;
1762 : : }
1763 : : default:
1764 : 0 : break;
1765 : : }
1766 : :
1767 : 0 : DecorationView aView( this );
1768 [ # # ]: 443 : aView.DrawFrame( aRect, FRAME_DRAW_OUT );
1769 : : }
1770 : :
1771 : : //-------------------------------------------------------------------------
1772 : :
1773 : 120 : void SfxDockingWindow::SetMinOutputSizePixel( const Size& rSize )
1774 : :
1775 : : /* [Description]
1776 : :
1777 : : With this method, a minimal OutputSize be can set, that is queried in
1778 : : the Resizing()-Handler.
1779 : : */
1780 : :
1781 : : {
1782 : 120 : pImp->aMinSize = rSize;
1783 : 120 : DockingWindow::SetMinOutputSizePixel( rSize );
1784 : 120 : }
1785 : :
1786 : : //-------------------------------------------------------------------------
1787 : :
1788 : 310 : Size SfxDockingWindow::GetMinOutputSizePixel() const
1789 : :
1790 : : /* [Description]
1791 : :
1792 : : Set the minimum size which is returned.
1793 : : */
1794 : :
1795 : : {
1796 : 310 : return pImp->aMinSize;
1797 : : }
1798 : :
1799 : : //-------------------------------------------------------------------------
1800 : :
1801 : 2298 : long SfxDockingWindow::Notify( NotifyEvent& rEvt )
1802 : : {
1803 [ + + ]: 2298 : if ( rEvt.GetType() == EVENT_GETFOCUS )
1804 : : {
1805 [ + - ][ + - ]: 107 : pBindings->SetActiveFrame( pMgr->GetFrame() );
1806 : :
1807 [ + - ]: 107 : if ( pImp->pSplitWin )
1808 [ + - ]: 107 : pImp->pSplitWin->SetActiveWindow_Impl( this );
1809 : : else
1810 [ # # ]: 0 : pMgr->Activate_Impl();
1811 : :
1812 : 107 : Window* pWindow = rEvt.GetWindow();
1813 : 107 : rtl::OString sHelpId;
1814 [ + + ][ + + ]: 249 : while ( sHelpId.isEmpty() && pWindow )
[ + + ]
1815 : : {
1816 [ + - ]: 142 : sHelpId = pWindow->GetHelpId();
1817 [ + - ]: 142 : pWindow = pWindow->GetParent();
1818 : : }
1819 : :
1820 [ + + ]: 107 : if ( !sHelpId.isEmpty() )
1821 [ + - ][ + - ]: 103 : SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), sHelpId );
[ + - ]
1822 : :
1823 : : // In VCL Notify goes first to the window itself, also call the
1824 : : // base class, otherwise the parent learns nothing
1825 : : // if ( rEvt.GetWindow() == this ) PB: #i74693# not necessary any longer
1826 [ + - ]: 107 : DockingWindow::Notify( rEvt );
1827 : 107 : return sal_True;
1828 : : }
1829 [ - + ]: 2191 : else if( rEvt.GetType() == EVENT_KEYINPUT )
1830 : : {
1831 : : // First, allow KeyInput for Dialog functions
1832 [ # # ][ # # ]: 0 : if ( !DockingWindow::Notify( rEvt ) && SfxViewShell::Current() )
[ # # ]
1833 : : // then also for valid global accelerators.
1834 : 0 : return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() );
1835 : 0 : return sal_True;
1836 : : }
1837 [ + + ][ + + ]: 2191 : else if ( rEvt.GetType() == EVENT_LOSEFOCUS && !HasChildPathFocus() )
[ + + ]
1838 : : {
1839 [ + - ]: 2 : pBindings->SetActiveFrame( NULL );
1840 : 2 : pMgr->Deactivate_Impl();
1841 : : }
1842 : :
1843 : 2298 : return DockingWindow::Notify( rEvt );
1844 : : }
1845 : :
1846 : :
1847 : 312 : sal_uInt16 SfxDockingWindow::GetWinBits_Impl() const
1848 : : {
1849 : 312 : sal_uInt16 nBits = 0;
1850 : 312 : return nBits;
1851 : : }
1852 : :
1853 : : //-------------------------------------------------------------------------
1854 : :
1855 : 0 : void SfxDockingWindow::SetItemSize_Impl( const Size& rSize )
1856 : : {
1857 : 0 : pImp->aSplitSize = rSize;
1858 : :
1859 : 0 : SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl();
1860 : 0 : SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW;
1861 [ # # ]: 0 : if ( pImp->bSplitable )
1862 : 0 : eIdent = SFX_CHILDWIN_SPLITWINDOW;
1863 : 0 : pWorkWin->ConfigChild_Impl( eIdent, SFX_ALIGNDOCKINGWINDOW, pMgr->GetType() );
1864 : 0 : }
1865 : :
1866 : 0 : void SfxDockingWindow::Disappear_Impl()
1867 : : {
1868 [ # # ][ # # ]: 0 : if ( pImp->pSplitWin && pImp->pSplitWin->IsItemValid( GetType() ) )
[ # # ]
1869 : 0 : pImp->pSplitWin->RemoveWindow(this);
1870 : 0 : }
1871 : :
1872 : 468 : void SfxDockingWindow::Reappear_Impl()
1873 : : {
1874 [ + - ][ - + ]: 468 : if ( pImp->pSplitWin && !pImp->pSplitWin->IsItemValid( GetType() ) )
[ - + ]
1875 : : {
1876 : 0 : pImp->pSplitWin->InsertWindow( this, pImp->aSplitSize );
1877 : : }
1878 : 468 : }
1879 : :
1880 : 158 : sal_Bool SfxDockingWindow::IsAutoHide_Impl() const
1881 : : {
1882 [ + - ]: 158 : if ( pImp->pSplitWin )
1883 : 158 : return !pImp->pSplitWin->IsFadeIn();
1884 : : else
1885 : 158 : return sal_False;
1886 : : }
1887 : :
1888 : 0 : void SfxDockingWindow::AutoShow( sal_Bool bShow )
1889 : : {
1890 : 0 : AutoShow_Impl(bShow);
1891 : 0 : }
1892 : :
1893 : 0 : void SfxDockingWindow::AutoShow_Impl( sal_Bool bShow )
1894 : : {
1895 [ # # ]: 0 : if ( pImp->pSplitWin )
1896 : : {
1897 [ # # ]: 0 : if ( bShow )
1898 : 0 : pImp->pSplitWin->FadeIn();
1899 : : else
1900 : 0 : pImp->pSplitWin->FadeOut();
1901 : : }
1902 : 0 : }
1903 : :
1904 : 624 : void SfxDockingWindow::FadeIn( sal_Bool /*bFadeIn*/ )
1905 : : {
1906 : 624 : }
1907 : :
1908 : 994 : void SfxDockingWindow::StateChanged( StateChangedType nStateChange )
1909 : : {
1910 [ + + ]: 994 : if ( nStateChange == STATE_CHANGE_INITSHOW )
1911 : 312 : Initialize_Impl();
1912 : :
1913 : 994 : DockingWindow::StateChanged( nStateChange );
1914 : 994 : }
1915 : :
1916 : 412 : void SfxDockingWindow::Move()
1917 : : {
1918 [ + - ]: 412 : if ( pImp )
1919 : 412 : pImp->aMoveTimer.Start();
1920 : 412 : }
1921 : :
1922 : 286 : IMPL_LINK_NOARG(SfxDockingWindow, TimerHdl)
1923 : : {
1924 : 286 : pImp->aMoveTimer.Stop();
1925 [ - + ][ - + ]: 286 : if ( IsReallyVisible() && IsFloatingMode() )
[ + - ]
1926 : : {
1927 [ # # ]: 0 : if( !GetFloatingWindow()->IsRollUp() )
1928 : 0 : SetFloatingSize( GetOutputSizePixel() );
1929 : 0 : pImp->aWinState = GetFloatingWindow()->GetWindowState();
1930 : 0 : SfxChildIdentifier eIdent = SFX_CHILDWIN_DOCKINGWINDOW;
1931 [ # # ]: 0 : if ( pImp->bSplitable )
1932 : 0 : eIdent = SFX_CHILDWIN_SPLITWINDOW;
1933 : 0 : SfxWorkWindow *pWorkWin = pBindings->GetWorkWindow_Impl();
1934 : 0 : pWorkWin->ConfigChild_Impl( eIdent, SFX_ALIGNDOCKINGWINDOW, pMgr->GetType() );
1935 : : }
1936 : 286 : return 0;
1937 : : }
1938 : :
1939 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|