1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <tools/time.hxx>
26 #include <salframe.hxx>
29 #include <vcl/event.hxx>
30 #include <vcl/floatwin.hxx>
31 #include <vcl/dockwin.hxx>
32 #include <vcl/toolbox.hxx>
33 #include <vcl/svapp.hxx>
34 #include <vcl/timer.hxx>
35 #include <vcl/lineinfo.hxx>
36 #include <vcl/unowrap.hxx>
39 // =======================================================================
41 #define DOCKWIN_FLOATSTYLES (WB_SIZEABLE | WB_MOVEABLE | WB_CLOSEABLE | WB_STANDALONE | WB_PINABLE | WB_ROLLABLE )
43 // =======================================================================
46 // =======================================================================
48 class ImplDockFloatWin2
: public FloatingWindow
51 ImplDockingWindowWrapper
* mpDockWin
;
52 sal_uLong mnLastTicks
;
58 sal_uLong mnLastUserEvent
;
60 DECL_LINK(DockingHdl
, void *);
61 DECL_LINK(DockTimerHdl
, void *);
62 DECL_LINK(EndDockTimerHdl
, void *);
64 ImplDockFloatWin2( Window
* pParent
, WinBits nWinBits
,
65 ImplDockingWindowWrapper
* pDockingWin
);
69 virtual void Resize();
70 virtual void TitleButtonClick( sal_uInt16 nButton
);
73 virtual void PopupModeEnd();
74 virtual void Resizing( Size
& rSize
);
75 virtual sal_Bool
Close();
76 virtual void setPosSizePixel( long nX
, long nY
,
77 long nWidth
, long nHeight
,
78 sal_uInt16 nFlags
= WINDOW_POSSIZE_ALL
);
80 sal_uLong
GetLastTicks() const { return mnLastTicks
; }
83 // =======================================================================
85 ImplDockFloatWin2::ImplDockFloatWin2( Window
* pParent
, WinBits nWinBits
,
86 ImplDockingWindowWrapper
* pDockingWin
) :
87 FloatingWindow( pParent
, nWinBits
),
88 mpDockWin( pDockingWin
),
89 mnLastTicks( Time::GetSystemTicks() ),
90 mbInMove( sal_False
),
93 // Daten vom DockingWindow uebernehmen
96 SetSettings( pDockingWin
->GetWindow()->GetSettings() );
97 Enable( pDockingWin
->GetWindow()->IsEnabled(), sal_False
);
98 EnableInput( pDockingWin
->GetWindow()->IsInputEnabled(), sal_False
);
99 AlwaysEnableInput( pDockingWin
->GetWindow()->IsAlwaysEnableInput(), sal_False
);
100 EnableAlwaysOnTop( pDockingWin
->GetWindow()->IsAlwaysOnTopEnabled() );
101 SetActivateMode( pDockingWin
->GetWindow()->GetActivateMode() );
104 SetBackground( GetSettings().GetStyleSettings().GetFaceColor() );
106 maDockTimer
.SetTimeoutHdl( LINK( this, ImplDockFloatWin2
, DockTimerHdl
) );
107 maDockTimer
.SetTimeout( 50 );
108 maEndDockTimer
.SetTimeoutHdl( LINK( this, ImplDockFloatWin2
, EndDockTimerHdl
) );
109 maEndDockTimer
.SetTimeout( 50 );
112 // -----------------------------------------------------------------------
114 ImplDockFloatWin2::~ImplDockFloatWin2()
116 if( mnLastUserEvent
)
117 Application::RemoveUserEvent( mnLastUserEvent
);
120 // -----------------------------------------------------------------------
122 IMPL_LINK_NOARG(ImplDockFloatWin2
, DockTimerHdl
)
124 DBG_ASSERT( mpDockWin
->IsFloatingMode(), "docktimer called but not floating" );
127 PointerState aState
= GetPointerState();
129 if( aState
.mnState
& KEY_MOD1
)
131 // i43499 CTRL disables docking now
132 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
133 if( aState
.mnState
& ( MOUSE_LEFT
| MOUSE_MIDDLE
| MOUSE_RIGHT
) )
136 else if( ! ( aState
.mnState
& ( MOUSE_LEFT
| MOUSE_MIDDLE
| MOUSE_RIGHT
) ) )
138 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
139 mpDockWin
->EndDocking( maDockRect
, sal_False
);
143 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect
, SHOWTRACK_BIG
| SHOWTRACK_WINDOW
);
150 IMPL_LINK_NOARG(ImplDockFloatWin2
, EndDockTimerHdl
)
152 DBG_ASSERT( mpDockWin
->IsFloatingMode(), "enddocktimer called but not floating" );
154 maEndDockTimer
.Stop();
155 PointerState aState
= GetPointerState();
156 if( ! ( aState
.mnState
& ( MOUSE_LEFT
| MOUSE_MIDDLE
| MOUSE_RIGHT
) ) )
158 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
159 mpDockWin
->EndDocking( maDockRect
, sal_True
);
163 maEndDockTimer
.Start();
170 IMPL_LINK_NOARG(ImplDockFloatWin2
, DockingHdl
)
172 // called during move of a floating window
175 Window
*pDockingArea
= mpDockWin
->GetWindow()->GetParent();
176 PointerState aState
= pDockingArea
->GetPointerState();
178 sal_Bool bRealMove
= sal_True
;
179 if( GetStyle() & WB_OWNERDRAWDECORATION
)
181 // for windows with ownerdraw decoration
182 // we allow docking only when the window was moved
183 // by dragging its caption
184 // and ignore move request due to resizing
185 Window
*pBorder
= GetWindow( WINDOW_BORDER
);
186 if( pBorder
!= this )
189 Rectangle
aBorderRect( aPt
, pBorder
->GetSizePixel() );
190 sal_Int32 nLeft
, nTop
, nRight
, nBottom
;
191 GetBorder( nLeft
, nTop
, nRight
, nBottom
);
192 // limit borderrect to the caption part only and without the resizing borders
193 aBorderRect
.Bottom() = aBorderRect
.Top() + nTop
;
194 aBorderRect
.Left() += nLeft
;
195 aBorderRect
.Right() -= nRight
;
197 PointerState aBorderState
= pBorder
->GetPointerState();
198 if( aBorderRect
.IsInside( aBorderState
.maPos
) )
199 bRealMove
= sal_True
;
201 bRealMove
= sal_False
;
205 if( mpDockWin
->IsDockable() &&
206 mpDockWin
->GetWindow()->IsVisible() &&
207 (Time::GetSystemTicks() - mnLastTicks
> 500) &&
208 ( aState
.mnState
& ( MOUSE_LEFT
| MOUSE_MIDDLE
| MOUSE_RIGHT
) ) &&
209 !(aState
.mnState
& KEY_MOD1
) && // i43499 CTRL disables docking now
212 maDockPos
= Point( pDockingArea
->OutputToScreenPixel( pDockingArea
->AbsoluteScreenToOutputPixel( OutputToAbsoluteScreenPixel( Point() ) ) ) );
213 maDockRect
= Rectangle( maDockPos
, mpDockWin
->GetSizePixel() );
215 // mouse pos in screen pixels
216 Point aMousePos
= pDockingArea
->OutputToScreenPixel( aState
.maPos
);
218 if( ! mpDockWin
->IsDocking() )
219 mpDockWin
->StartDocking( aMousePos
, maDockRect
);
221 sal_Bool bFloatMode
= mpDockWin
->Docking( aMousePos
, maDockRect
);
225 // indicates that the window could be docked at maDockRect
226 maDockRect
.SetPos( mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->ScreenToOutputPixel(
227 maDockRect
.TopLeft() ) );
228 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect
, SHOWTRACK_BIG
| SHOWTRACK_WINDOW
);
229 maEndDockTimer
.Stop();
230 DockTimerHdl( this );
234 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
236 EndDockTimerHdl( this );
239 mbInMove
= sal_False
;
242 // -----------------------------------------------------------------------
244 void ImplDockFloatWin2::Move()
250 FloatingWindow::Move();
251 mpDockWin
->GetWindow()->Move();
254 * note: the window should only dock if KEY_MOD1 is pressed
255 * and the user releases all mouse buttons. The real problem here
256 * is that we don't get mouse events (at least not on X)
257 * if the mouse is on the decoration. So we have to start an
258 * awkward timer based process that polls the modifier/buttons
259 * to see whether they are in the right condition shortly after the
262 if( ! mnLastUserEvent
)
263 mnLastUserEvent
= Application::PostUserEvent( LINK( this, ImplDockFloatWin2
, DockingHdl
) );
266 // -----------------------------------------------------------------------
268 void ImplDockFloatWin2::Resize()
270 // forwarding of resize only required if we have no borderwindow ( GetWindow() then returns 'this' )
271 if( GetWindow( WINDOW_BORDER
) == this )
273 FloatingWindow::Resize();
274 Size
aSize( GetSizePixel() );
275 mpDockWin
->GetWindow()->ImplPosSizeWindow( 0, 0, aSize
.Width(), aSize
.Height(), WINDOW_POSSIZE_POSSIZE
); // is this needed ???
279 void ImplDockFloatWin2::setPosSizePixel( long nX
, long nY
,
280 long nWidth
, long nHeight
,
283 FloatingWindow::setPosSizePixel( nX
, nY
, nWidth
, nHeight
, nFlags
);
286 // -----------------------------------------------------------------------
289 void ImplDockFloatWin2::TitleButtonClick( sal_uInt16 nButton
)
291 FloatingWindow::TitleButtonClick( nButton
);
292 mpDockWin
->TitleButtonClick( nButton
);
295 // -----------------------------------------------------------------------
297 void ImplDockFloatWin2::Pin()
299 FloatingWindow::Pin();
303 // -----------------------------------------------------------------------
305 void ImplDockFloatWin2::Roll()
307 FloatingWindow::Roll();
311 // -----------------------------------------------------------------------
313 void ImplDockFloatWin2::PopupModeEnd()
315 FloatingWindow::PopupModeEnd();
316 mpDockWin
->PopupModeEnd();
319 // -----------------------------------------------------------------------
321 void ImplDockFloatWin2::Resizing( Size
& rSize
)
323 FloatingWindow::Resizing( rSize
);
324 mpDockWin
->Resizing( rSize
);
327 // -----------------------------------------------------------------------
329 sal_Bool
ImplDockFloatWin2::Close()
331 return mpDockWin
->Close();
334 // =======================================================================
336 DockingManager::DockingManager()
340 DockingManager::~DockingManager()
342 ::std::vector
< ImplDockingWindowWrapper
* >::iterator p
;
343 p
= mDockingWindows
.begin();
344 for(; p
!= mDockingWindows
.end(); ++p
)
348 mDockingWindows
.clear();
351 ImplDockingWindowWrapper
* DockingManager::GetDockingWindowWrapper( const Window
*pWindow
)
353 ::std::vector
< ImplDockingWindowWrapper
* >::iterator p
;
354 p
= mDockingWindows
.begin();
355 while( p
!= mDockingWindows
.end() )
357 if( (*p
)->mpDockingWindow
== pWindow
)
365 sal_Bool
DockingManager::IsDockable( const Window
*pWindow
)
367 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
370 if( pWindow->HasDockingHandler() )
373 return (pWrapper
!= NULL
);
376 sal_Bool
DockingManager::IsFloating( const Window
*pWindow
)
378 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
380 return pWrapper
->IsFloatingMode();
385 sal_Bool
DockingManager::IsLocked( const Window
*pWindow
)
387 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
388 if( pWrapper
&& pWrapper
->IsLocked() )
394 void DockingManager::Lock( const Window
*pWindow
)
396 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
401 void DockingManager::Unlock( const Window
*pWindow
)
403 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
408 void DockingManager::SetFloatingMode( const Window
*pWindow
, sal_Bool bFloating
)
410 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
412 pWrapper
->SetFloatingMode( bFloating
);
415 void DockingManager::StartPopupMode( ToolBox
*pParentToolBox
, const Window
*pWindow
, sal_uLong nFlags
)
417 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
419 pWrapper
->StartPopupMode( pParentToolBox
, nFlags
);
422 void DockingManager::StartPopupMode( ToolBox
*pParentToolBox
, const Window
*pWindow
)
424 StartPopupMode( pParentToolBox
, pWindow
, FLOATWIN_POPUPMODE_ALLOWTEAROFF
|
425 FLOATWIN_POPUPMODE_NOFOCUSCLOSE
|
426 FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE
|
427 FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE
);
430 sal_Bool
DockingManager::IsInPopupMode( const Window
*pWindow
)
432 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
433 if( pWrapper
&& pWrapper
->IsInPopupMode() )
439 // -----------------------------------------------------------------------
441 void DockingManager::EndPopupMode( const Window
*pWin
)
443 ImplDockingWindowWrapper
*pWrapper
= GetDockingWindowWrapper( pWin
);
444 if( pWrapper
&& pWrapper
->GetFloatingWindow() && pWrapper
->GetFloatingWindow()->IsInPopupMode() )
445 pWrapper
->GetFloatingWindow()->EndPopupMode();
448 // -----------------------------------------------------------------------
450 void DockingManager::AddWindow( const Window
*pWindow
)
452 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
456 pWrapper
= new ImplDockingWindowWrapper( pWindow
);
458 mDockingWindows
.push_back( pWrapper
);
461 void DockingManager::RemoveWindow( const Window
*pWindow
)
463 ::std::vector
< ImplDockingWindowWrapper
* >::iterator p
;
464 p
= mDockingWindows
.begin();
465 while( p
!= mDockingWindows
.end() )
467 if( (*p
)->mpDockingWindow
== pWindow
)
470 mDockingWindows
.erase( p
);
478 void DockingManager::SetPosSizePixel( Window
*pWindow
, long nX
, long nY
,
479 long nWidth
, long nHeight
,
482 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
484 pWrapper
->setPosSizePixel( nX
, nY
, nWidth
, nHeight
, nFlags
);
487 Rectangle
DockingManager::GetPosSizePixel( const Window
*pWindow
)
490 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
492 aRect
= Rectangle( pWrapper
->GetPosPixel(), pWrapper
->GetSizePixel() );
497 // =======================================================================
498 // special floating window for popup mode
499 // main purpose: provides tear-off area for undocking
500 // =======================================================================
502 // if TEAROFF_DASHED defined a single dashed line is used
503 // otherwise multiple smaller lines will be painted
504 //#define TEAROFF_DASHED
506 // size of the drag area
507 #ifdef TEAROFF_DASHED
508 #define POPUP_DRAGBORDER 2
509 #define POPUP_DRAGGRIP 5
511 #define POPUP_DRAGBORDER 3
512 #define POPUP_DRAGGRIP 5
514 #define POPUP_DRAGHEIGHT (POPUP_DRAGGRIP+POPUP_DRAGBORDER+POPUP_DRAGBORDER)
515 #define POPUP_DRAGWIDTH 20
517 class ImplPopupFloatWin
: public FloatingWindow
520 ImplDockingWindowWrapper
* mpDockingWin
;
521 sal_Bool mbHighlight
;
523 bool mbTrackingEnabled
;
525 Point maTearOffPosition
;
528 void ImplSetBorder();
531 ImplPopupFloatWin( Window
* pParent
, ImplDockingWindowWrapper
* pDockingWin
, bool bHasGrip
);
532 ~ImplPopupFloatWin();
534 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> CreateAccessible();
535 virtual void Paint( const Rectangle
& rRect
);
536 virtual void MouseMove( const MouseEvent
& rMEvt
);
537 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
538 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
539 virtual void Tracking( const TrackingEvent
& rTEvt
);
540 virtual void Resize();
541 virtual Window
* GetPreferredKeyInputWindow();
543 Rectangle
GetDragRect() const;
544 Point
GetToolboxPosition() const;
545 Point
GetTearOffPosition() const;
549 bool hasGrip() const { return mbHasGrip
; }
552 ImplPopupFloatWin::ImplPopupFloatWin( Window
* pParent
, ImplDockingWindowWrapper
* pDockingWin
, bool bHasGrip
) :
553 FloatingWindow( pParent
, WB_NOBORDER
| WB_SYSTEMWINDOW
| WB_NOSHADOW
)
555 mpWindowImpl
->mbToolbarFloatingWindow
= sal_True
; // indicate window type, required for accessibility
556 // which should not see this window as a toplevel window
557 mpDockingWin
= pDockingWin
;
558 mbHighlight
= sal_False
;
559 mbMoving
= sal_False
;
560 mbTrackingEnabled
= sal_False
;
561 mbGripAtBottom
= sal_True
;
562 mbHasGrip
= bHasGrip
;
567 ImplPopupFloatWin::~ImplPopupFloatWin()
572 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> ImplPopupFloatWin::CreateAccessible()
574 // switch off direct accessibilty support for this window
576 // this is to avoid appearance of this window as standalone window in the accessibility hierarchy
577 // as this window is only used as a helper for subtoolbars that are not teared-off, the parent toolbar
578 // has to provide accessibility support (as implemented in the toolkit)
579 // so the contained toolbar should appear as child of the correponsing toolbar item of the parent toolbar
580 return ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>();
583 Window
* ImplPopupFloatWin::GetPreferredKeyInputWindow()
585 if( mpWindowImpl
->mpClientWindow
)
586 return mpWindowImpl
->mpClientWindow
;
588 return FloatingWindow::GetPreferredKeyInputWindow();
592 void ImplPopupFloatWin::ImplSetBorder()
594 // although we have no border in the sense of a borderwindow
595 // we're using a special border for the grip
596 // by setting those members the method SetOutputSizePixel() can
597 // be used to set the proper window size
598 mpWindowImpl
->mnTopBorder
= 1;
600 mpWindowImpl
->mnTopBorder
+= POPUP_DRAGHEIGHT
+2;
601 mpWindowImpl
->mnBottomBorder
= 1;
602 mpWindowImpl
->mnLeftBorder
= 1;
603 mpWindowImpl
->mnRightBorder
= 1;
606 void ImplPopupFloatWin::Resize()
608 // the borderview overwrites the border during resize so restore it
612 Rectangle
ImplPopupFloatWin::GetDragRect() const
617 aRect
= Rectangle( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT
);
620 int height
= GetOutputSizePixel().Height();
621 aRect
.Top() = height
- 3 - POPUP_DRAGHEIGHT
;
622 aRect
.Bottom() = aRect
.Top() + 1 + POPUP_DRAGHEIGHT
;
628 Point
ImplPopupFloatWin::GetToolboxPosition() const
630 // return inner position where a toolbox could be placed
631 Point
aPt( 1, 1 + ((mbGripAtBottom
|| !hasGrip()) ? 0 : GetDragRect().getHeight()) ); // grip + border
636 Point
ImplPopupFloatWin::GetTearOffPosition() const
638 Point
aPt( maTearOffPosition
);
639 //aPt += GetToolboxPosition(); // remove 'decoration'
643 void ImplPopupFloatWin::DrawBorder()
647 Rectangle
aRect( aPt
, GetOutputSizePixel() );
649 Region
oldClipRgn( GetClipRegion( ) );
650 Region
aClipRgn( aRect
);
651 Rectangle
aItemClipRect( ImplGetItemEdgeClipRect() );
652 if( !aItemClipRect
.IsEmpty() )
654 aItemClipRect
.SetPos( AbsoluteScreenToOutputPixel( aItemClipRect
.TopLeft() ) );
656 // draw the excluded border part with the background color of a toolbox
657 SetClipRegion( Region( aItemClipRect
) );
658 SetLineColor( GetSettings().GetStyleSettings().GetFaceColor() );
661 aClipRgn
.Exclude( aItemClipRect
);
662 SetClipRegion( aClipRgn
);
664 SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
666 SetClipRegion( oldClipRgn
);
669 void ImplPopupFloatWin::DrawGrip()
671 sal_Bool bLinecolor
= IsLineColor();
672 Color aLinecolor
= GetLineColor();
673 sal_Bool bFillcolor
= IsFillColor();
674 Color aFillcolor
= GetFillColor();
677 Rectangle
aRect( GetDragRect() );
678 aRect
.Top() += POPUP_DRAGBORDER
;
679 aRect
.Bottom() -= POPUP_DRAGBORDER
;
686 DrawSelectionBackground( aRect
, 2, sal_False
, sal_True
, sal_False
);
690 SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() );
695 if( !ToolBox::AlwaysLocked() ) // no grip if toolboxes are locked
697 #ifdef TEAROFF_DASHED
698 // draw single dashed line
699 LineInfo
aLineInfo( LINE_DASH
);
700 aLineInfo
.SetDistance( 4 );
701 aLineInfo
.SetDashLen( 12 );
702 aLineInfo
.SetDashCount( 1 );
708 aRect
.Bottom() = aRect
.Top();
709 SetLineColor( GetSettings().GetStyleSettings().GetDarkShadowColor() );
710 DrawLine( aRect
.TopLeft(), aRect
.TopRight(), aLineInfo
);
716 SetLineColor( GetSettings().GetStyleSettings().GetLightColor() );
717 DrawLine( aRect
.TopLeft(), aRect
.TopRight(), aLineInfo
);
721 // draw several grip lines
722 SetFillColor( GetSettings().GetStyleSettings().GetShadowColor() );
724 aRect
.Bottom() = aRect
.Top();
726 int width
= POPUP_DRAGWIDTH
;
727 while( width
>= aRect
.getWidth() )
730 width
= aRect
.getWidth();
731 //aRect.nLeft = aRect.nLeft + (aRect.getWidth() - width) / 2;
732 aRect
.Left() = (aRect
.Left() + aRect
.Right() - width
) / 2;
733 aRect
.Right() = aRect
.Left() + width
;
736 while( i
< POPUP_DRAGGRIP
)
747 SetLineColor( aLinecolor
);
751 SetFillColor( aFillcolor
);
756 void ImplPopupFloatWin::Paint( const Rectangle
& )
759 Rectangle
aRect( aPt
, GetOutputSizePixel() );
760 DrawWallpaper( aRect
, Wallpaper( GetSettings().GetStyleSettings().GetFaceGradientColor() ) );
766 void ImplPopupFloatWin::MouseMove( const MouseEvent
& rMEvt
)
768 Point aMousePos
= rMEvt
.GetPosPixel();
770 if( !ToolBox::AlwaysLocked() ) // no tear off if locking is enabled
772 if( mbTrackingEnabled
&& rMEvt
.IsLeft() && GetDragRect().IsInside( aMousePos
) )
776 StartTracking( STARTTRACK_NOKEYCANCEL
);
779 if( !mbHighlight
&& GetDragRect().IsInside( aMousePos
) )
781 mbHighlight
= sal_True
;
784 if( mbHighlight
&& ( rMEvt
.IsLeaveWindow() || !GetDragRect().IsInside( aMousePos
) ) )
786 mbHighlight
= sal_False
;
792 void ImplPopupFloatWin::MouseButtonUp( const MouseEvent
& rMEvt
)
794 mbTrackingEnabled
= false;
795 FloatingWindow::MouseButtonUp( rMEvt
);
798 void ImplPopupFloatWin::MouseButtonDown( const MouseEvent
& rMEvt
)
800 Point aMousePos
= rMEvt
.GetPosPixel();
801 if( GetDragRect().IsInside( aMousePos
) )
803 // get mouse pos at a static window to have a fixed reference point
804 PointerState aState
= GetParent()->GetPointerState();
805 if (ImplHasMirroredGraphics() && IsRTLEnabled())
806 ImplMirrorFramePos(aState
.maPos
);
807 maTearOffPosition
= GetWindow( WINDOW_BORDER
)->GetPosPixel();
808 maDelta
= aState
.maPos
- maTearOffPosition
;
809 mbTrackingEnabled
= true;
813 mbTrackingEnabled
= false;
817 void ImplPopupFloatWin::Tracking( const TrackingEvent
& rTEvt
)
821 if ( rTEvt
.IsTrackingEnded() )
823 mbMoving
= sal_False
;
824 EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF
);
826 else if ( !rTEvt
.GetMouseEvent().IsSynthetic() )
828 // move the window according to mouse pos
829 PointerState aState
= GetParent()->GetPointerState();
830 if (ImplHasMirroredGraphics() && IsRTLEnabled())
831 ImplMirrorFramePos(aState
.maPos
);
832 maTearOffPosition
= aState
.maPos
- maDelta
;
833 GetWindow( WINDOW_BORDER
)->SetPosPixel( maTearOffPosition
);
839 // =======================================================================
841 ImplDockingWindowWrapper::ImplDockingWindowWrapper( const Window
*pWindow
)
845 mpDockingWindow
= (Window
*) pWindow
;
846 mpParent
= pWindow
->GetParent();
847 mbDockable
= sal_True
;
848 mbLocked
= sal_False
;
849 mnFloatBits
= WB_BORDER
| WB_CLOSEABLE
| WB_SIZEABLE
| (pWindow
->GetStyle() & DOCKWIN_FLOATSTYLES
);
850 DockingWindow
*pDockWin
= dynamic_cast< DockingWindow
* > ( mpDockingWindow
);
852 mnFloatBits
= pDockWin
->GetFloatStyle();
854 // must be enabled in Window::Notify to prevent permanent docking during mouse move
855 mbStartDockingEnabled
= sal_False
;
858 ImplDockingWindowWrapper::~ImplDockingWindowWrapper()
860 if ( IsFloatingMode() )
862 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
863 SetFloatingMode( sal_False
);
867 // -----------------------------------------------------------------------
869 sal_Bool
ImplDockingWindowWrapper::ImplStartDocking( const Point
& rPos
)
874 if( !mbStartDockingEnabled
)
878 maMouseStart
= maMouseOff
;
879 mbDocking
= sal_True
;
880 mbLastFloatMode
= IsFloatingMode();
881 mbStartFloat
= mbLastFloatMode
;
883 // FloatingBorder berechnen
884 FloatingWindow
* pWin
;
888 pWin
= new ImplDockFloatWin2( mpParent
, mnFloatBits
, NULL
);
889 pWin
->GetBorder( mnDockLeft
, mnDockTop
, mnDockRight
, mnDockBottom
);
893 Point aPos
= GetWindow()->ImplOutputToFrame( Point() );
894 Size aSize
= GetWindow()->GetOutputSizePixel();
897 mnTrackWidth
= aSize
.Width();
898 mnTrackHeight
= aSize
.Height();
900 if ( mbLastFloatMode
)
902 maMouseOff
.X() += mnDockLeft
;
903 maMouseOff
.Y() += mnDockTop
;
904 mnTrackX
-= mnDockLeft
;
905 mnTrackY
-= mnDockTop
;
906 mnTrackWidth
+= mnDockLeft
+mnDockRight
;
907 mnTrackHeight
+= mnDockTop
+mnDockBottom
;
910 Window
*pDockingArea
= GetWindow()->GetParent();
911 Window::PointerState aState
= pDockingArea
->GetPointerState();
913 // mouse pos in screen pixels
914 Point aMousePos
= pDockingArea
->OutputToScreenPixel( aState
.maPos
);
915 Point aDockPos
= Point( pDockingArea
->AbsoluteScreenToOutputPixel( GetWindow()->OutputToAbsoluteScreenPixel( GetWindow()->GetPosPixel() ) ) );
916 Rectangle
aDockRect( aDockPos
, GetWindow()->GetSizePixel() );
917 StartDocking( aMousePos
, aDockRect
);
919 GetWindow()->ImplUpdateAll();
920 GetWindow()->ImplGetFrameWindow()->ImplUpdateAll();
922 GetWindow()->StartTracking( STARTTRACK_KEYMOD
);
926 // =======================================================================
928 void ImplDockingWindowWrapper::ImplInitData()
930 mpDockingWindow
= NULL
;
932 //GetWindow()->mpWindowImpl->mbDockWin = sal_True; // TODO: must be eliminated
934 mbDockCanceled
= sal_False
;
935 mbFloatPrevented
= sal_False
;
936 mbDocking
= sal_False
;
938 mbRollUp
= sal_False
;
939 mbDockBtn
= sal_False
;
940 mbHideBtn
= sal_False
;
941 maMaxOutSize
= Size( SHRT_MAX
, SHRT_MAX
);
944 // -----------------------------------------------------------------------
946 void ImplDockingWindowWrapper::Tracking( const TrackingEvent
& rTEvt
)
948 // used during docking of a currently docked window
951 if ( rTEvt
.IsTrackingEnded() )
953 mbDocking
= sal_False
;
954 GetWindow()->HideTracking();
955 if ( rTEvt
.IsTrackingCanceled() )
957 mbDockCanceled
= sal_True
;
958 EndDocking( Rectangle( Point( mnTrackX
, mnTrackY
), Size( mnTrackWidth
, mnTrackHeight
) ), mbLastFloatMode
);
959 mbDockCanceled
= sal_False
;
962 EndDocking( Rectangle( Point( mnTrackX
, mnTrackY
), Size( mnTrackWidth
, mnTrackHeight
) ), mbLastFloatMode
);
964 // Docking only upon non-synthetic MouseEvents
965 else if ( !rTEvt
.GetMouseEvent().IsSynthetic() || rTEvt
.GetMouseEvent().IsModifierChanged() )
967 Point aMousePos
= rTEvt
.GetMouseEvent().GetPosPixel();
968 Point aFrameMousePos
= GetWindow()->ImplOutputToFrame( aMousePos
);
969 Size aFrameSize
= GetWindow()->ImplGetFrameWindow()->GetOutputSizePixel();
970 if ( aFrameMousePos
.X() < 0 )
971 aFrameMousePos
.X() = 0;
972 if ( aFrameMousePos
.Y() < 0 )
973 aFrameMousePos
.Y() = 0;
974 if ( aFrameMousePos
.X() > aFrameSize
.Width()-1 )
975 aFrameMousePos
.X() = aFrameSize
.Width()-1;
976 if ( aFrameMousePos
.Y() > aFrameSize
.Height()-1 )
977 aFrameMousePos
.Y() = aFrameSize
.Height()-1;
978 aMousePos
= GetWindow()->ImplFrameToOutput( aFrameMousePos
);
979 aMousePos
.X() -= maMouseOff
.X();
980 aMousePos
.Y() -= maMouseOff
.Y();
981 Point aPos
= GetWindow()->ImplOutputToFrame( aMousePos
);
982 Rectangle
aTrackRect( aPos
, Size( mnTrackWidth
, mnTrackHeight
) );
983 Rectangle aCompRect
= aTrackRect
;
984 aPos
.X() += maMouseOff
.X();
985 aPos
.Y() += maMouseOff
.Y();
987 sal_Bool bFloatMode
= Docking( aPos
, aTrackRect
);
989 mbFloatPrevented
= sal_False
;
990 if ( mbLastFloatMode
!= bFloatMode
)
994 aTrackRect
.Left() -= mnDockLeft
;
995 aTrackRect
.Top() -= mnDockTop
;
996 aTrackRect
.Right() += mnDockRight
;
997 aTrackRect
.Bottom() += mnDockBottom
;
1001 if ( aCompRect
== aTrackRect
)
1003 aTrackRect
.Left() += mnDockLeft
;
1004 aTrackRect
.Top() += mnDockTop
;
1005 aTrackRect
.Right() -= mnDockRight
;
1006 aTrackRect
.Bottom() -= mnDockBottom
;
1009 mbLastFloatMode
= bFloatMode
;
1012 sal_uInt16 nTrackStyle
;
1014 nTrackStyle
= SHOWTRACK_OBJECT
;
1016 nTrackStyle
= SHOWTRACK_BIG
;
1017 Rectangle aShowTrackRect
= aTrackRect
;
1018 aShowTrackRect
.SetPos( GetWindow()->ImplFrameToOutput( aShowTrackRect
.TopLeft() ) );
1020 GetWindow()->ShowTracking( aShowTrackRect
, nTrackStyle
);
1022 // Maus-Offset neu berechnen, da Rechteck veraendert werden
1024 maMouseOff
.X() = aPos
.X() - aTrackRect
.Left();
1025 maMouseOff
.Y() = aPos
.Y() - aTrackRect
.Top();
1027 mnTrackX
= aTrackRect
.Left();
1028 mnTrackY
= aTrackRect
.Top();
1029 mnTrackWidth
= aTrackRect
.GetWidth();
1030 mnTrackHeight
= aTrackRect
.GetHeight();
1036 // -----------------------------------------------------------------------
1038 void ImplDockingWindowWrapper::StartDocking( const Point
& rPoint
, Rectangle
& rRect
)
1040 DockingData
data( rPoint
, rRect
, IsFloatingMode() );
1042 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_STARTDOCKING
, &data
);
1043 mbDocking
= sal_True
;
1046 // -----------------------------------------------------------------------
1048 sal_Bool
ImplDockingWindowWrapper::Docking( const Point
& rPoint
, Rectangle
& rRect
)
1050 DockingData
data( rPoint
, rRect
, IsFloatingMode() );
1052 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_DOCKING
, &data
);
1053 rRect
= data
.maTrackRect
;
1054 return data
.mbFloating
;
1057 // -----------------------------------------------------------------------
1059 void ImplDockingWindowWrapper::EndDocking( const Rectangle
& rRect
, sal_Bool bFloatMode
)
1061 Rectangle
aRect( rRect
);
1063 if ( !IsDockingCanceled() )
1065 sal_Bool bShow
= sal_False
;
1066 if ( bFloatMode
!= IsFloatingMode() )
1068 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1069 SetFloatingMode( bFloatMode
);
1073 // #i44800# always use outputsize - as in all other places
1074 mpFloatWin
->SetOutputSizePixel( aRect
.GetSize() );
1075 mpFloatWin
->SetPosPixel( aRect
.TopLeft() );
1080 Point aPos
= aRect
.TopLeft();
1081 aPos
= GetWindow()->GetParent()->ScreenToOutputPixel( aPos
);
1082 GetWindow()->SetPosSizePixel( aPos
, aRect
.GetSize() );
1086 GetWindow()->Show( sal_True
, SHOW_NOFOCUSCHANGE
| SHOW_NOACTIVATE
);
1089 EndDockingData
data( aRect
, IsFloatingMode(), IsDockingCanceled() );
1090 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_ENDDOCKING
, &data
);
1092 mbDocking
= sal_False
;
1094 // must be enabled in Window::Notify to prevent permanent docking during mouse move
1095 mbStartDockingEnabled
= sal_False
;
1098 // -----------------------------------------------------------------------
1100 sal_Bool
ImplDockingWindowWrapper::PrepareToggleFloatingMode()
1102 sal_Bool bFloating
= sal_True
;
1103 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_PREPARETOGGLEFLOATING
, &bFloating
);
1107 // -----------------------------------------------------------------------
1109 sal_Bool
ImplDockingWindowWrapper::Close()
1115 // -----------------------------------------------------------------------
1117 void ImplDockingWindowWrapper::ToggleFloatingMode()
1119 // notify dockingwindow/toolbox
1120 // note: this must be done *before* notifying the
1121 // listeners to have the toolbox in the proper state
1122 if( GetWindow()->ImplIsDockingWindow() )
1123 ((DockingWindow
*) GetWindow())->ToggleFloatingMode();
1125 // now notify listeners
1126 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_TOGGLEFLOATING
);
1128 // must be enabled in Window::Notify to prevent permanent docking during mouse move
1129 mbStartDockingEnabled
= sal_False
;
1132 // -----------------------------------------------------------------------
1134 void ImplDockingWindowWrapper::TitleButtonClick( sal_uInt16 nType
)
1136 if( nType
== TITLE_BUTTON_MENU
)
1138 ToolBox
*pToolBox
= dynamic_cast< ToolBox
* >( GetWindow() );
1141 pToolBox
->ExecuteCustomMenu();
1144 if( nType
== TITLE_BUTTON_DOCKING
)
1146 SetFloatingMode( !IsFloatingMode() );
1150 // -----------------------------------------------------------------------
1152 void ImplDockingWindowWrapper::Pin()
1157 // -----------------------------------------------------------------------
1159 void ImplDockingWindowWrapper::Roll()
1164 // -----------------------------------------------------------------------
1166 void ImplDockingWindowWrapper::PopupModeEnd()
1171 // -----------------------------------------------------------------------
1173 void ImplDockingWindowWrapper::Resizing( Size
& rSize
)
1175 // TODO: add virtual Resizing() to class Window, so we can get rid of class DockingWindow
1176 DockingWindow
*pDockingWindow
= dynamic_cast< DockingWindow
* >( GetWindow() );
1177 if( pDockingWindow
)
1178 pDockingWindow
->Resizing( rSize
);
1181 // -----------------------------------------------------------------------
1183 void ImplDockingWindowWrapper::ShowTitleButton( sal_uInt16 nButton
, sal_Bool bVisible
)
1186 mpFloatWin
->ShowTitleButton( nButton
, bVisible
);
1189 if ( nButton
== TITLE_BUTTON_DOCKING
)
1190 mbDockBtn
= bVisible
;
1191 else // if ( nButton == TITLE_BUTTON_HIDE )
1192 mbHideBtn
= bVisible
;
1196 // -----------------------------------------------------------------------
1198 void ImplDockingWindowWrapper::StartPopupMode( ToolBox
*pParentToolBox
, sal_uLong nFlags
)
1200 // do nothing if window is floating
1201 if( IsFloatingMode() )
1204 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1206 // prepare reparenting
1207 Window
* pRealParent
= GetWindow()->GetWindow( WINDOW_PARENT
);
1208 mpOldBorderWin
= GetWindow()->GetWindow( WINDOW_BORDER
);
1209 if( mpOldBorderWin
== GetWindow() )
1210 mpOldBorderWin
= NULL
; // no border window found
1212 // the new parent for popup mode
1213 ImplPopupFloatWin
* pWin
= new ImplPopupFloatWin( mpParent
, this, (nFlags
& FLOATWIN_POPUPMODE_ALLOWTEAROFF
) != 0 );
1215 pWin
->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper
, PopupModeEnd
) );
1216 pWin
->SetText( GetWindow()->GetText() );
1218 pWin
->SetOutputSizePixel( GetWindow()->GetSizePixel() );
1220 GetWindow()->mpWindowImpl
->mpBorderWindow
= NULL
;
1221 GetWindow()->mpWindowImpl
->mnLeftBorder
= 0;
1222 GetWindow()->mpWindowImpl
->mnTopBorder
= 0;
1223 GetWindow()->mpWindowImpl
->mnRightBorder
= 0;
1224 GetWindow()->mpWindowImpl
->mnBottomBorder
= 0;
1226 // position toolbox below dragrect
1227 GetWindow()->SetPosPixel( pWin
->GetToolboxPosition() );
1229 // reparent borderwindow and window
1230 if ( mpOldBorderWin
)
1231 mpOldBorderWin
->SetParent( pWin
);
1232 GetWindow()->SetParent( pWin
);
1234 // correct border window pointers
1235 GetWindow()->mpWindowImpl
->mpBorderWindow
= pWin
;
1236 pWin
->mpWindowImpl
->mpClientWindow
= GetWindow();
1237 GetWindow()->mpWindowImpl
->mpRealParent
= pRealParent
;
1239 // set mpFloatWin not until all window positioning is done !!!
1240 // (SetPosPixel etc. check for valid mpFloatWin pointer)
1243 // if the subtoolbar was opened via keyboard make sure that key events
1244 // will go into subtoolbar
1245 if( pParentToolBox
->IsKeyEvent() )
1246 nFlags
|= FLOATWIN_POPUPMODE_GRABFOCUS
;
1248 mpFloatWin
->StartPopupMode( pParentToolBox
, nFlags
);
1249 GetWindow()->Show();
1251 if( pParentToolBox
->IsKeyEvent() )
1253 // send HOME key to subtoolbar in order to select first item
1254 KeyEvent
aEvent( 0, KeyCode( KEY_HOME
) );
1255 mpFloatWin
->GetPreferredKeyInputWindow()->KeyInput( aEvent
);
1259 IMPL_LINK_NOARG(ImplDockingWindowWrapper
, PopupModeEnd
)
1261 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1263 // set parameter for handler before destroying floating window
1264 ImplPopupFloatWin
*pPopupFloatWin
= (ImplPopupFloatWin
*) mpFloatWin
;
1265 EndPopupModeData
aData( pPopupFloatWin
->GetTearOffPosition(), mpFloatWin
->IsPopupModeTearOff() );
1267 // before deleting change parent back, so we can delete the floating window alone
1268 Window
* pRealParent
= GetWindow()->GetWindow( WINDOW_PARENT
);
1269 GetWindow()->mpWindowImpl
->mpBorderWindow
= NULL
;
1270 if ( mpOldBorderWin
)
1272 GetWindow()->SetParent( mpOldBorderWin
);
1273 ((ImplBorderWindow
*)mpOldBorderWin
)->GetBorder(
1274 GetWindow()->mpWindowImpl
->mnLeftBorder
, GetWindow()->mpWindowImpl
->mnTopBorder
,
1275 GetWindow()->mpWindowImpl
->mnRightBorder
, GetWindow()->mpWindowImpl
->mnBottomBorder
);
1276 mpOldBorderWin
->Resize();
1278 GetWindow()->mpWindowImpl
->mpBorderWindow
= mpOldBorderWin
;
1279 GetWindow()->SetParent( pRealParent
);
1280 GetWindow()->mpWindowImpl
->mpRealParent
= pRealParent
;
1285 // call handler - which will destroy the window and thus the wrapper as well !
1286 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_ENDPOPUPMODE
, &aData
);
1292 sal_Bool
ImplDockingWindowWrapper::IsInPopupMode() const
1294 if( GetFloatingWindow() )
1295 return GetFloatingWindow()->IsInPopupMode();
1300 // -----------------------------------------------------------------------
1302 void ImplDockingWindowWrapper::SetFloatingMode( sal_Bool bFloatMode
)
1304 // do nothing if window is docked and locked
1305 if( !IsFloatingMode() && IsLocked() )
1308 if ( IsFloatingMode() != bFloatMode
)
1310 if ( PrepareToggleFloatingMode() )
1312 sal_Bool bVisible
= GetWindow()->IsVisible();
1316 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1318 maDockPos
= GetWindow()->GetPosPixel();
1320 Window
* pRealParent
= GetWindow()->GetWindow( WINDOW_PARENT
);
1321 mpOldBorderWin
= GetWindow()->GetWindow( WINDOW_BORDER
);
1322 if( mpOldBorderWin
== mpDockingWindow
)
1323 mpOldBorderWin
= NULL
; // no border window found
1325 ImplDockFloatWin2
* pWin
=
1326 new ImplDockFloatWin2(
1328 mnFloatBits
& ( WB_MOVEABLE
| WB_SIZEABLE
| WB_CLOSEABLE
) ?
1329 mnFloatBits
| WB_SYSTEMWINDOW
1330 | WB_OWNERDRAWDECORATION
1334 GetWindow()->mpWindowImpl
->mpBorderWindow
= NULL
;
1335 GetWindow()->mpWindowImpl
->mnLeftBorder
= 0;
1336 GetWindow()->mpWindowImpl
->mnTopBorder
= 0;
1337 GetWindow()->mpWindowImpl
->mnRightBorder
= 0;
1338 GetWindow()->mpWindowImpl
->mnBottomBorder
= 0;
1340 // Falls Parent zerstoert wird, muessen wir auch vom
1341 // BorderWindow den Parent umsetzen
1342 if ( mpOldBorderWin
)
1343 mpOldBorderWin
->SetParent( pWin
);
1344 GetWindow()->SetParent( pWin
);
1345 pWin
->SetPosPixel( Point() );
1347 GetWindow()->mpWindowImpl
->mpBorderWindow
= pWin
;
1348 pWin
->mpWindowImpl
->mpClientWindow
= mpDockingWindow
;
1349 GetWindow()->mpWindowImpl
->mpRealParent
= pRealParent
;
1351 pWin
->SetText( GetWindow()->GetText() );
1352 pWin
->SetOutputSizePixel( GetWindow()->GetSizePixel() );
1353 pWin
->SetPosPixel( maFloatPos
);
1354 // DockingDaten ans FloatingWindow weiterreichen
1355 pWin
->ShowTitleButton( TITLE_BUTTON_DOCKING
, mbDockBtn
);
1356 pWin
->ShowTitleButton( TITLE_BUTTON_HIDE
, mbHideBtn
);
1357 pWin
->SetPin( mbPined
);
1362 pWin
->SetRollUpOutputSizePixel( maRollUpOutSize
);
1363 pWin
->SetMinOutputSizePixel( maMinOutSize
);
1364 pWin
->SetMaxOutputSizePixel( maMaxOutSize
);
1369 GetWindow()->Show( sal_True
, SHOW_NOFOCUSCHANGE
| SHOW_NOACTIVATE
);
1371 ToggleFloatingMode();
1375 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1377 // FloatingDaten wird im FloatingWindow speichern
1378 maFloatPos
= mpFloatWin
->GetPosPixel();
1379 mbDockBtn
= mpFloatWin
->IsTitleButtonVisible( TITLE_BUTTON_DOCKING
);
1380 mbHideBtn
= mpFloatWin
->IsTitleButtonVisible( TITLE_BUTTON_HIDE
);
1381 mbPined
= mpFloatWin
->IsPined();
1382 mbRollUp
= mpFloatWin
->IsRollUp();
1383 maRollUpOutSize
= mpFloatWin
->GetRollUpOutputSizePixel();
1384 maMinOutSize
= mpFloatWin
->GetMinOutputSizePixel();
1385 maMaxOutSize
= mpFloatWin
->GetMaxOutputSizePixel();
1387 Window
* pRealParent
= GetWindow()->GetWindow( WINDOW_PARENT
); //mpWindowImpl->mpRealParent;
1388 GetWindow()->mpWindowImpl
->mpBorderWindow
= NULL
;
1389 if ( mpOldBorderWin
)
1391 GetWindow()->SetParent( mpOldBorderWin
);
1392 ((ImplBorderWindow
*)mpOldBorderWin
)->GetBorder(
1393 GetWindow()->mpWindowImpl
->mnLeftBorder
, GetWindow()->mpWindowImpl
->mnTopBorder
,
1394 GetWindow()->mpWindowImpl
->mnRightBorder
, GetWindow()->mpWindowImpl
->mnBottomBorder
);
1395 mpOldBorderWin
->Resize();
1397 GetWindow()->mpWindowImpl
->mpBorderWindow
= mpOldBorderWin
;
1398 GetWindow()->SetParent( pRealParent
);
1399 GetWindow()->mpWindowImpl
->mpRealParent
= pRealParent
;
1401 delete static_cast<ImplDockFloatWin2
*>(mpFloatWin
);
1403 GetWindow()->SetPosPixel( maDockPos
);
1406 GetWindow()->Show();
1408 ToggleFloatingMode();
1415 // -----------------------------------------------------------------------
1417 void ImplDockingWindowWrapper::SetFloatStyle( WinBits nStyle
)
1419 mnFloatBits
= nStyle
;
1422 // -----------------------------------------------------------------------
1424 WinBits
ImplDockingWindowWrapper::GetFloatStyle() const
1429 // -----------------------------------------------------------------------
1431 void ImplDockingWindowWrapper::setPosSizePixel( long nX
, long nY
,
1432 long nWidth
, long nHeight
,
1436 mpFloatWin
->setPosSizePixel( nX
, nY
, nWidth
, nHeight
, nFlags
);
1438 GetWindow()->setPosSizePixel( nX
, nY
, nWidth
, nHeight
, nFlags
);
1441 // -----------------------------------------------------------------------
1443 Point
ImplDockingWindowWrapper::GetPosPixel() const
1446 return mpFloatWin
->GetPosPixel();
1448 return mpDockingWindow
->GetPosPixel();
1451 // -----------------------------------------------------------------------
1453 Size
ImplDockingWindowWrapper::GetSizePixel() const
1456 return mpFloatWin
->GetSizePixel();
1458 return mpDockingWindow
->GetSizePixel();
1461 // -----------------------------------------------------------------------
1462 // old inlines from DockingWindow
1463 // -----------------------------------------------------------------------
1465 void ImplDockingWindowWrapper::SetMinOutputSizePixel( const Size
& rSize
)
1468 mpFloatWin
->SetMinOutputSizePixel( rSize
);
1469 maMinOutSize
= rSize
;
1472 void ImplDockingWindowWrapper::SetMaxOutputSizePixel( const Size
& rSize
)
1475 mpFloatWin
->SetMaxOutputSizePixel( rSize
);
1476 maMaxOutSize
= rSize
;
1479 sal_Bool
ImplDockingWindowWrapper::IsFloatingMode() const
1481 return (mpFloatWin
!= NULL
);
1485 void ImplDockingWindowWrapper::SetDragArea( const Rectangle
& rRect
)
1490 Rectangle
ImplDockingWindowWrapper::GetDragArea() const
1495 void ImplDockingWindowWrapper::Lock()
1497 mbLocked
= sal_True
;
1498 // only toolbars support locking
1499 ToolBox
*pToolBox
= dynamic_cast< ToolBox
* >( GetWindow() );
1501 pToolBox
->Lock( mbLocked
);
1504 void ImplDockingWindowWrapper::Unlock()
1506 mbLocked
= sal_False
;
1507 // only toolbars support locking
1508 ToolBox
*pToolBox
= dynamic_cast< ToolBox
* >( GetWindow() );
1510 pToolBox
->Lock( mbLocked
);
1513 sal_Bool
ImplDockingWindowWrapper::IsLocked() const
1518 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */