1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include <tools/time.hxx>
35 #include <salframe.hxx>
38 #include <vcl/event.hxx>
39 #include <vcl/floatwin.hxx>
40 #include <vcl/dockwin.hxx>
41 #include <vcl/toolbox.hxx>
42 #include <vcl/svapp.hxx>
43 #include <vcl/timer.hxx>
44 #include <vcl/lineinfo.hxx>
45 #include <vcl/unowrap.hxx>
48 // =======================================================================
50 #define DOCKWIN_FLOATSTYLES (WB_SIZEABLE | WB_MOVEABLE | WB_CLOSEABLE | WB_STANDALONE | WB_PINABLE | WB_ROLLABLE )
52 // =======================================================================
55 // =======================================================================
57 class ImplDockFloatWin2
: public FloatingWindow
60 ImplDockingWindowWrapper
* mpDockWin
;
61 sal_uLong mnLastTicks
;
67 sal_uLong mnLastUserEvent
;
69 DECL_LINK(DockingHdl
, void *);
70 DECL_LINK(DockTimerHdl
, void *);
71 DECL_LINK(EndDockTimerHdl
, void *);
73 ImplDockFloatWin2( Window
* pParent
, WinBits nWinBits
,
74 ImplDockingWindowWrapper
* pDockingWin
);
78 virtual void Resize();
79 virtual void TitleButtonClick( sal_uInt16 nButton
);
82 virtual void PopupModeEnd();
83 virtual void Resizing( Size
& rSize
);
84 virtual sal_Bool
Close();
85 using Window::SetPosSizePixel
;
86 virtual void SetPosSizePixel( long nX
, long nY
,
87 long nWidth
, long nHeight
,
88 sal_uInt16 nFlags
= WINDOW_POSSIZE_ALL
);
90 sal_uLong
GetLastTicks() const { return mnLastTicks
; }
93 // =======================================================================
95 ImplDockFloatWin2::ImplDockFloatWin2( Window
* pParent
, WinBits nWinBits
,
96 ImplDockingWindowWrapper
* pDockingWin
) :
97 FloatingWindow( pParent
, nWinBits
),
98 mpDockWin( pDockingWin
),
99 mnLastTicks( Time::GetSystemTicks() ),
100 mbInMove( sal_False
),
103 // Daten vom DockingWindow uebernehmen
106 SetSettings( pDockingWin
->GetWindow()->GetSettings() );
107 Enable( pDockingWin
->GetWindow()->IsEnabled(), sal_False
);
108 EnableInput( pDockingWin
->GetWindow()->IsInputEnabled(), sal_False
);
109 AlwaysEnableInput( pDockingWin
->GetWindow()->IsAlwaysEnableInput(), sal_False
);
110 EnableAlwaysOnTop( pDockingWin
->GetWindow()->IsAlwaysOnTopEnabled() );
111 SetActivateMode( pDockingWin
->GetWindow()->GetActivateMode() );
114 SetBackground( GetSettings().GetStyleSettings().GetFaceColor() );
116 maDockTimer
.SetTimeoutHdl( LINK( this, ImplDockFloatWin2
, DockTimerHdl
) );
117 maDockTimer
.SetTimeout( 50 );
118 maEndDockTimer
.SetTimeoutHdl( LINK( this, ImplDockFloatWin2
, EndDockTimerHdl
) );
119 maEndDockTimer
.SetTimeout( 50 );
122 // -----------------------------------------------------------------------
124 ImplDockFloatWin2::~ImplDockFloatWin2()
126 if( mnLastUserEvent
)
127 Application::RemoveUserEvent( mnLastUserEvent
);
130 // -----------------------------------------------------------------------
132 IMPL_LINK_NOARG(ImplDockFloatWin2
, DockTimerHdl
)
134 DBG_ASSERT( mpDockWin
->IsFloatingMode(), "docktimer called but not floating" );
137 PointerState aState
= GetPointerState();
139 if( aState
.mnState
& KEY_MOD1
)
141 // i43499 CTRL disables docking now
142 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
143 if( aState
.mnState
& ( MOUSE_LEFT
| MOUSE_MIDDLE
| MOUSE_RIGHT
) )
146 else if( ! ( aState
.mnState
& ( MOUSE_LEFT
| MOUSE_MIDDLE
| MOUSE_RIGHT
) ) )
148 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
149 mpDockWin
->EndDocking( maDockRect
, sal_False
);
153 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect
, SHOWTRACK_BIG
| SHOWTRACK_WINDOW
);
160 IMPL_LINK_NOARG(ImplDockFloatWin2
, EndDockTimerHdl
)
162 DBG_ASSERT( mpDockWin
->IsFloatingMode(), "enddocktimer called but not floating" );
164 maEndDockTimer
.Stop();
165 PointerState aState
= GetPointerState();
166 if( ! ( aState
.mnState
& ( MOUSE_LEFT
| MOUSE_MIDDLE
| MOUSE_RIGHT
) ) )
168 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
169 mpDockWin
->EndDocking( maDockRect
, sal_True
);
173 maEndDockTimer
.Start();
180 IMPL_LINK_NOARG(ImplDockFloatWin2
, DockingHdl
)
182 // called during move of a floating window
185 Window
*pDockingArea
= mpDockWin
->GetWindow()->GetParent();
186 PointerState aState
= pDockingArea
->GetPointerState();
188 sal_Bool bRealMove
= sal_True
;
189 if( GetStyle() & WB_OWNERDRAWDECORATION
)
191 // for windows with ownerdraw decoration
192 // we allow docking only when the window was moved
193 // by dragging its caption
194 // and ignore move request due to resizing
195 Window
*pBorder
= GetWindow( WINDOW_BORDER
);
196 if( pBorder
!= this )
199 Rectangle
aBorderRect( aPt
, pBorder
->GetSizePixel() );
200 sal_Int32 nLeft
, nTop
, nRight
, nBottom
;
201 GetBorder( nLeft
, nTop
, nRight
, nBottom
);
202 // limit borderrect to the caption part only and without the resizing borders
203 aBorderRect
.nBottom
= aBorderRect
.nTop
+ nTop
;
204 aBorderRect
.nLeft
+= nLeft
;
205 aBorderRect
.nRight
-= nRight
;
207 PointerState aBorderState
= pBorder
->GetPointerState();
208 if( aBorderRect
.IsInside( aBorderState
.maPos
) )
209 bRealMove
= sal_True
;
211 bRealMove
= sal_False
;
215 if( mpDockWin
->IsDockable() &&
216 mpDockWin
->GetWindow()->IsVisible() &&
217 (Time::GetSystemTicks() - mnLastTicks
> 500) &&
218 ( aState
.mnState
& ( MOUSE_LEFT
| MOUSE_MIDDLE
| MOUSE_RIGHT
) ) &&
219 !(aState
.mnState
& KEY_MOD1
) && // i43499 CTRL disables docking now
222 maDockPos
= Point( pDockingArea
->OutputToScreenPixel( pDockingArea
->AbsoluteScreenToOutputPixel( OutputToAbsoluteScreenPixel( Point() ) ) ) );
223 maDockRect
= Rectangle( maDockPos
, mpDockWin
->GetSizePixel() );
225 // mouse pos in screen pixels
226 Point aMousePos
= pDockingArea
->OutputToScreenPixel( aState
.maPos
);
228 if( ! mpDockWin
->IsDocking() )
229 mpDockWin
->StartDocking( aMousePos
, maDockRect
);
231 sal_Bool bFloatMode
= mpDockWin
->Docking( aMousePos
, maDockRect
);
235 // indicates that the window could be docked at maDockRect
236 maDockRect
.SetPos( mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->ScreenToOutputPixel(
237 maDockRect
.TopLeft() ) );
238 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect
, SHOWTRACK_BIG
| SHOWTRACK_WINDOW
);
239 maEndDockTimer
.Stop();
240 DockTimerHdl( this );
244 mpDockWin
->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
246 EndDockTimerHdl( this );
249 mbInMove
= sal_False
;
252 // -----------------------------------------------------------------------
254 void ImplDockFloatWin2::Move()
260 FloatingWindow::Move();
261 mpDockWin
->GetWindow()->Move();
264 * note: the window should only dock if KEY_MOD1 is pressed
265 * and the user releases all mouse buttons. The real problem here
266 * is that we don't get mouse events (at least not on X)
267 * if the mouse is on the decoration. So we have to start an
268 * awkward timer based process that polls the modifier/buttons
269 * to see whether they are in the right condition shortly after the
272 if( ! mnLastUserEvent
)
273 mnLastUserEvent
= Application::PostUserEvent( LINK( this, ImplDockFloatWin2
, DockingHdl
) );
276 // -----------------------------------------------------------------------
278 void ImplDockFloatWin2::Resize()
280 // forwarding of resize only required if we have no borderwindow ( GetWindow() then returns 'this' )
281 if( GetWindow( WINDOW_BORDER
) == this )
283 FloatingWindow::Resize();
284 Size
aSize( GetSizePixel() );
285 mpDockWin
->GetWindow()->ImplPosSizeWindow( 0, 0, aSize
.Width(), aSize
.Height(), WINDOW_POSSIZE_POSSIZE
); // is this needed ???
289 void ImplDockFloatWin2::SetPosSizePixel( long nX
, long nY
,
290 long nWidth
, long nHeight
,
293 FloatingWindow::SetPosSizePixel( nX
, nY
, nWidth
, nHeight
, nFlags
);
296 // -----------------------------------------------------------------------
299 void ImplDockFloatWin2::TitleButtonClick( sal_uInt16 nButton
)
301 FloatingWindow::TitleButtonClick( nButton
);
302 mpDockWin
->TitleButtonClick( nButton
);
305 // -----------------------------------------------------------------------
307 void ImplDockFloatWin2::Pin()
309 FloatingWindow::Pin();
313 // -----------------------------------------------------------------------
315 void ImplDockFloatWin2::Roll()
317 FloatingWindow::Roll();
321 // -----------------------------------------------------------------------
323 void ImplDockFloatWin2::PopupModeEnd()
325 FloatingWindow::PopupModeEnd();
326 mpDockWin
->PopupModeEnd();
329 // -----------------------------------------------------------------------
331 void ImplDockFloatWin2::Resizing( Size
& rSize
)
333 FloatingWindow::Resizing( rSize
);
334 mpDockWin
->Resizing( rSize
);
337 // -----------------------------------------------------------------------
339 sal_Bool
ImplDockFloatWin2::Close()
341 return mpDockWin
->Close();
344 // =======================================================================
346 DockingManager::DockingManager()
350 DockingManager::~DockingManager()
352 ::std::vector
< ImplDockingWindowWrapper
* >::iterator p
;
353 p
= mDockingWindows
.begin();
354 for(; p
!= mDockingWindows
.end(); ++p
)
358 mDockingWindows
.clear();
361 ImplDockingWindowWrapper
* DockingManager::GetDockingWindowWrapper( const Window
*pWindow
)
363 ::std::vector
< ImplDockingWindowWrapper
* >::iterator p
;
364 p
= mDockingWindows
.begin();
365 while( p
!= mDockingWindows
.end() )
367 if( (*p
)->mpDockingWindow
== pWindow
)
375 sal_Bool
DockingManager::IsDockable( const Window
*pWindow
)
377 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
380 if( pWindow->HasDockingHandler() )
383 return (pWrapper
!= NULL
);
386 sal_Bool
DockingManager::IsFloating( const Window
*pWindow
)
388 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
390 return pWrapper
->IsFloatingMode();
395 sal_Bool
DockingManager::IsLocked( const Window
*pWindow
)
397 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
398 if( pWrapper
&& pWrapper
->IsLocked() )
404 void DockingManager::Lock( const Window
*pWindow
)
406 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
411 void DockingManager::Unlock( const Window
*pWindow
)
413 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
418 void DockingManager::SetFloatingMode( const Window
*pWindow
, sal_Bool bFloating
)
420 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
422 pWrapper
->SetFloatingMode( bFloating
);
425 void DockingManager::StartPopupMode( ToolBox
*pParentToolBox
, const Window
*pWindow
, sal_uLong nFlags
)
427 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
429 pWrapper
->StartPopupMode( pParentToolBox
, nFlags
);
432 void DockingManager::StartPopupMode( ToolBox
*pParentToolBox
, const Window
*pWindow
)
434 StartPopupMode( pParentToolBox
, pWindow
, FLOATWIN_POPUPMODE_ALLOWTEAROFF
|
435 FLOATWIN_POPUPMODE_NOFOCUSCLOSE
|
436 FLOATWIN_POPUPMODE_ALLMOUSEBUTTONCLOSE
|
437 FLOATWIN_POPUPMODE_NOMOUSEUPCLOSE
);
440 sal_Bool
DockingManager::IsInPopupMode( const Window
*pWindow
)
442 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
443 if( pWrapper
&& pWrapper
->IsInPopupMode() )
449 // -----------------------------------------------------------------------
451 void DockingManager::EndPopupMode( const Window
*pWin
)
453 ImplDockingWindowWrapper
*pWrapper
= GetDockingWindowWrapper( pWin
);
454 if( pWrapper
&& pWrapper
->GetFloatingWindow() && pWrapper
->GetFloatingWindow()->IsInPopupMode() )
455 pWrapper
->GetFloatingWindow()->EndPopupMode();
458 // -----------------------------------------------------------------------
460 void DockingManager::AddWindow( const Window
*pWindow
)
462 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
466 pWrapper
= new ImplDockingWindowWrapper( pWindow
);
468 mDockingWindows
.push_back( pWrapper
);
471 void DockingManager::RemoveWindow( const Window
*pWindow
)
473 ::std::vector
< ImplDockingWindowWrapper
* >::iterator p
;
474 p
= mDockingWindows
.begin();
475 while( p
!= mDockingWindows
.end() )
477 if( (*p
)->mpDockingWindow
== pWindow
)
480 mDockingWindows
.erase( p
);
488 void DockingManager::SetPosSizePixel( Window
*pWindow
, long nX
, long nY
,
489 long nWidth
, long nHeight
,
492 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
494 pWrapper
->SetPosSizePixel( nX
, nY
, nWidth
, nHeight
, nFlags
);
497 Rectangle
DockingManager::GetPosSizePixel( const Window
*pWindow
)
500 ImplDockingWindowWrapper
* pWrapper
= GetDockingWindowWrapper( pWindow
);
502 aRect
= Rectangle( pWrapper
->GetPosPixel(), pWrapper
->GetSizePixel() );
507 // =======================================================================
508 // special floating window for popup mode
509 // main purpose: provides tear-off area for undocking
510 // =======================================================================
512 // if TEAROFF_DASHED defined a single dashed line is used
513 // otherwise multiple smaller lines will be painted
514 //#define TEAROFF_DASHED
516 // size of the drag area
517 #ifdef TEAROFF_DASHED
518 #define POPUP_DRAGBORDER 2
519 #define POPUP_DRAGGRIP 5
521 #define POPUP_DRAGBORDER 3
522 #define POPUP_DRAGGRIP 5
524 #define POPUP_DRAGHEIGHT (POPUP_DRAGGRIP+POPUP_DRAGBORDER+POPUP_DRAGBORDER)
525 #define POPUP_DRAGWIDTH 20
527 class ImplPopupFloatWin
: public FloatingWindow
530 ImplDockingWindowWrapper
* mpDockingWin
;
531 sal_Bool mbHighlight
;
533 bool mbTrackingEnabled
;
535 Point maTearOffPosition
;
538 void ImplSetBorder();
541 ImplPopupFloatWin( Window
* pParent
, ImplDockingWindowWrapper
* pDockingWin
, bool bHasGrip
);
542 ~ImplPopupFloatWin();
544 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> CreateAccessible();
545 virtual void Paint( const Rectangle
& rRect
);
546 virtual void MouseMove( const MouseEvent
& rMEvt
);
547 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
548 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
549 virtual void Tracking( const TrackingEvent
& rTEvt
);
550 virtual void Resize();
551 virtual Window
* GetPreferredKeyInputWindow();
553 Rectangle
GetDragRect() const;
554 Point
GetToolboxPosition() const;
555 Point
GetTearOffPosition() const;
559 bool hasGrip() const { return mbHasGrip
; }
562 ImplPopupFloatWin::ImplPopupFloatWin( Window
* pParent
, ImplDockingWindowWrapper
* pDockingWin
, bool bHasGrip
) :
563 FloatingWindow( pParent
, WB_NOBORDER
| WB_SYSTEMWINDOW
| WB_NOSHADOW
)
565 mpWindowImpl
->mbToolbarFloatingWindow
= sal_True
; // indicate window type, required for accessibility
566 // which should not see this window as a toplevel window
567 mpDockingWin
= pDockingWin
;
568 mbHighlight
= sal_False
;
569 mbMoving
= sal_False
;
570 mbTrackingEnabled
= sal_False
;
571 mbGripAtBottom
= sal_True
;
572 mbHasGrip
= bHasGrip
;
577 ImplPopupFloatWin::~ImplPopupFloatWin()
582 ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
> ImplPopupFloatWin::CreateAccessible()
584 // switch off direct accessibilty support for this window
586 // this is to avoid appearance of this window as standalone window in the accessibility hierarchy
587 // as this window is only used as a helper for subtoolbars that are not teared-off, the parent toolbar
588 // has to provide accessibility support (as implemented in the toolkit)
589 // so the contained toolbar should appear as child of the correponsing toolbar item of the parent toolbar
590 return ::com::sun::star::uno::Reference
< ::com::sun::star::accessibility::XAccessible
>();
593 Window
* ImplPopupFloatWin::GetPreferredKeyInputWindow()
595 if( mpWindowImpl
->mpClientWindow
)
596 return mpWindowImpl
->mpClientWindow
;
598 return FloatingWindow::GetPreferredKeyInputWindow();
602 void ImplPopupFloatWin::ImplSetBorder()
604 // although we have no border in the sense of a borderwindow
605 // we're using a special border for the grip
606 // by setting those members the method SetOutputSizePixel() can
607 // be used to set the proper window size
608 mpWindowImpl
->mnTopBorder
= 1;
610 mpWindowImpl
->mnTopBorder
+= POPUP_DRAGHEIGHT
+2;
611 mpWindowImpl
->mnBottomBorder
= 1;
612 mpWindowImpl
->mnLeftBorder
= 1;
613 mpWindowImpl
->mnRightBorder
= 1;
616 void ImplPopupFloatWin::Resize()
618 // the borderview overwrites the border during resize so restore it
622 Rectangle
ImplPopupFloatWin::GetDragRect() const
627 aRect
= Rectangle( 1,1, GetOutputSizePixel().Width()-1, 2+POPUP_DRAGHEIGHT
);
630 int height
= GetOutputSizePixel().Height();
631 aRect
.Top() = height
- 3 - POPUP_DRAGHEIGHT
;
632 aRect
.Bottom() = aRect
.Top() + 1 + POPUP_DRAGHEIGHT
;
638 Point
ImplPopupFloatWin::GetToolboxPosition() const
640 // return inner position where a toolbox could be placed
641 Point
aPt( 1, 1 + ((mbGripAtBottom
|| !hasGrip()) ? 0 : GetDragRect().getHeight()) ); // grip + border
646 Point
ImplPopupFloatWin::GetTearOffPosition() const
648 Point
aPt( maTearOffPosition
);
649 //aPt += GetToolboxPosition(); // remove 'decoration'
653 void ImplPopupFloatWin::DrawBorder()
657 Rectangle
aRect( aPt
, GetOutputSizePixel() );
659 Region
oldClipRgn( GetClipRegion( ) );
660 Region
aClipRgn( aRect
);
661 Rectangle
aItemClipRect( ImplGetItemEdgeClipRect() );
662 if( !aItemClipRect
.IsEmpty() )
664 aItemClipRect
.SetPos( AbsoluteScreenToOutputPixel( aItemClipRect
.TopLeft() ) );
666 // draw the excluded border part with the background color of a toolbox
667 SetClipRegion( Region( aItemClipRect
) );
668 SetLineColor( GetSettings().GetStyleSettings().GetFaceColor() );
671 aClipRgn
.Exclude( aItemClipRect
);
672 SetClipRegion( aClipRgn
);
674 SetLineColor( GetSettings().GetStyleSettings().GetShadowColor() );
676 SetClipRegion( oldClipRgn
);
679 void ImplPopupFloatWin::DrawGrip()
681 sal_Bool bLinecolor
= IsLineColor();
682 Color aLinecolor
= GetLineColor();
683 sal_Bool bFillcolor
= IsFillColor();
684 Color aFillcolor
= GetFillColor();
687 Rectangle
aRect( GetDragRect() );
688 aRect
.nTop
+= POPUP_DRAGBORDER
;
689 aRect
.nBottom
-= POPUP_DRAGBORDER
;
696 DrawSelectionBackground( aRect
, 2, sal_False
, sal_True
, sal_False
);
700 SetFillColor( GetSettings().GetStyleSettings().GetFaceColor() );
705 if( !ToolBox::AlwaysLocked() ) // no grip if toolboxes are locked
707 #ifdef TEAROFF_DASHED
708 // draw single dashed line
709 LineInfo
aLineInfo( LINE_DASH
);
710 aLineInfo
.SetDistance( 4 );
711 aLineInfo
.SetDashLen( 12 );
712 aLineInfo
.SetDashCount( 1 );
714 aRect
.nLeft
+=2; aRect
.nRight
-=2;
717 aRect
.nBottom
= aRect
.nTop
;
718 SetLineColor( GetSettings().GetStyleSettings().GetDarkShadowColor() );
719 DrawLine( aRect
.TopLeft(), aRect
.TopRight(), aLineInfo
);
723 aRect
.nTop
++; aRect
.nBottom
++;
724 SetLineColor( GetSettings().GetStyleSettings().GetLightColor() );
725 DrawLine( aRect
.TopLeft(), aRect
.TopRight(), aLineInfo
);
729 // draw several grip lines
730 SetFillColor( GetSettings().GetStyleSettings().GetShadowColor() );
732 aRect
.nBottom
= aRect
.nTop
;
734 int width
= POPUP_DRAGWIDTH
;
735 while( width
>= aRect
.getWidth() )
738 width
= aRect
.getWidth();
739 //aRect.nLeft = aRect.nLeft + (aRect.getWidth() - width) / 2;
740 aRect
.nLeft
= (aRect
.nLeft
+ aRect
.nRight
- width
) / 2;
741 aRect
.nRight
= aRect
.nLeft
+ width
;
744 while( i
< POPUP_DRAGGRIP
)
755 SetLineColor( aLinecolor
);
759 SetFillColor( aFillcolor
);
764 void ImplPopupFloatWin::Paint( const Rectangle
& )
767 Rectangle
aRect( aPt
, GetOutputSizePixel() );
768 DrawWallpaper( aRect
, Wallpaper( GetSettings().GetStyleSettings().GetFaceGradientColor() ) );
774 void ImplPopupFloatWin::MouseMove( const MouseEvent
& rMEvt
)
776 Point aMousePos
= rMEvt
.GetPosPixel();
778 if( !ToolBox::AlwaysLocked() ) // no tear off if locking is enabled
780 if( mbTrackingEnabled
&& rMEvt
.IsLeft() && GetDragRect().IsInside( aMousePos
) )
784 StartTracking( STARTTRACK_NOKEYCANCEL
);
787 if( !mbHighlight
&& GetDragRect().IsInside( aMousePos
) )
789 mbHighlight
= sal_True
;
792 if( mbHighlight
&& ( rMEvt
.IsLeaveWindow() || !GetDragRect().IsInside( aMousePos
) ) )
794 mbHighlight
= sal_False
;
800 void ImplPopupFloatWin::MouseButtonUp( const MouseEvent
& rMEvt
)
802 mbTrackingEnabled
= false;
803 FloatingWindow::MouseButtonUp( rMEvt
);
806 void ImplPopupFloatWin::MouseButtonDown( const MouseEvent
& rMEvt
)
808 Point aMousePos
= rMEvt
.GetPosPixel();
809 if( GetDragRect().IsInside( aMousePos
) )
811 // get mouse pos at a static window to have a fixed reference point
812 PointerState aState
= GetParent()->GetPointerState();
813 if (ImplHasMirroredGraphics() && IsRTLEnabled())
814 ImplMirrorFramePos(aState
.maPos
);
815 maTearOffPosition
= GetWindow( WINDOW_BORDER
)->GetPosPixel();
816 maDelta
= aState
.maPos
- maTearOffPosition
;
817 mbTrackingEnabled
= true;
821 mbTrackingEnabled
= false;
825 void ImplPopupFloatWin::Tracking( const TrackingEvent
& rTEvt
)
829 if ( rTEvt
.IsTrackingEnded() )
831 mbMoving
= sal_False
;
832 EndPopupMode( FLOATWIN_POPUPMODEEND_TEAROFF
);
834 else if ( !rTEvt
.GetMouseEvent().IsSynthetic() )
836 // move the window according to mouse pos
837 PointerState aState
= GetParent()->GetPointerState();
838 if (ImplHasMirroredGraphics() && IsRTLEnabled())
839 ImplMirrorFramePos(aState
.maPos
);
840 maTearOffPosition
= aState
.maPos
- maDelta
;
841 GetWindow( WINDOW_BORDER
)->SetPosPixel( maTearOffPosition
);
847 // =======================================================================
849 ImplDockingWindowWrapper::ImplDockingWindowWrapper( const Window
*pWindow
)
853 mpDockingWindow
= (Window
*) pWindow
;
854 mpParent
= pWindow
->GetParent();
855 mbDockable
= sal_True
;
856 mbLocked
= sal_False
;
857 mnFloatBits
= WB_BORDER
| WB_CLOSEABLE
| WB_SIZEABLE
| (pWindow
->GetStyle() & DOCKWIN_FLOATSTYLES
);
858 DockingWindow
*pDockWin
= dynamic_cast< DockingWindow
* > ( mpDockingWindow
);
860 mnFloatBits
= pDockWin
->GetFloatStyle();
862 // must be enabled in Window::Notify to prevent permanent docking during mouse move
863 mbStartDockingEnabled
= sal_False
;
866 ImplDockingWindowWrapper::~ImplDockingWindowWrapper()
868 if ( IsFloatingMode() )
870 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
871 SetFloatingMode( sal_False
);
875 // -----------------------------------------------------------------------
877 sal_Bool
ImplDockingWindowWrapper::ImplStartDocking( const Point
& rPos
)
882 if( !mbStartDockingEnabled
)
886 maMouseStart
= maMouseOff
;
887 mbDocking
= sal_True
;
888 mbLastFloatMode
= IsFloatingMode();
889 mbStartFloat
= mbLastFloatMode
;
891 // FloatingBorder berechnen
892 FloatingWindow
* pWin
;
896 pWin
= new ImplDockFloatWin2( mpParent
, mnFloatBits
, NULL
);
897 pWin
->GetBorder( mnDockLeft
, mnDockTop
, mnDockRight
, mnDockBottom
);
901 Point aPos
= GetWindow()->ImplOutputToFrame( Point() );
902 Size aSize
= GetWindow()->GetOutputSizePixel();
905 mnTrackWidth
= aSize
.Width();
906 mnTrackHeight
= aSize
.Height();
908 if ( mbLastFloatMode
)
910 maMouseOff
.X() += mnDockLeft
;
911 maMouseOff
.Y() += mnDockTop
;
912 mnTrackX
-= mnDockLeft
;
913 mnTrackY
-= mnDockTop
;
914 mnTrackWidth
+= mnDockLeft
+mnDockRight
;
915 mnTrackHeight
+= mnDockTop
+mnDockBottom
;
918 Window
*pDockingArea
= GetWindow()->GetParent();
919 Window::PointerState aState
= pDockingArea
->GetPointerState();
921 // mouse pos in screen pixels
922 Point aMousePos
= pDockingArea
->OutputToScreenPixel( aState
.maPos
);
923 Point aDockPos
= Point( pDockingArea
->AbsoluteScreenToOutputPixel( GetWindow()->OutputToAbsoluteScreenPixel( GetWindow()->GetPosPixel() ) ) );
924 Rectangle
aDockRect( aDockPos
, GetWindow()->GetSizePixel() );
925 StartDocking( aMousePos
, aDockRect
);
927 GetWindow()->ImplUpdateAll();
928 GetWindow()->ImplGetFrameWindow()->ImplUpdateAll();
930 GetWindow()->StartTracking( STARTTRACK_KEYMOD
);
934 // =======================================================================
936 void ImplDockingWindowWrapper::ImplInitData()
938 mpDockingWindow
= NULL
;
940 //GetWindow()->mpWindowImpl->mbDockWin = sal_True; // TODO: must be eliminated
942 mbDockCanceled
= sal_False
;
943 mbFloatPrevented
= sal_False
;
944 mbDocking
= sal_False
;
946 mbRollUp
= sal_False
;
947 mbDockBtn
= sal_False
;
948 mbHideBtn
= sal_False
;
949 maMaxOutSize
= Size( SHRT_MAX
, SHRT_MAX
);
952 // -----------------------------------------------------------------------
954 void ImplDockingWindowWrapper::Tracking( const TrackingEvent
& rTEvt
)
956 // used during docking of a currently docked window
959 if ( rTEvt
.IsTrackingEnded() )
961 mbDocking
= sal_False
;
962 GetWindow()->HideTracking();
963 if ( rTEvt
.IsTrackingCanceled() )
965 mbDockCanceled
= sal_True
;
966 EndDocking( Rectangle( Point( mnTrackX
, mnTrackY
), Size( mnTrackWidth
, mnTrackHeight
) ), mbLastFloatMode
);
967 mbDockCanceled
= sal_False
;
970 EndDocking( Rectangle( Point( mnTrackX
, mnTrackY
), Size( mnTrackWidth
, mnTrackHeight
) ), mbLastFloatMode
);
972 // Docking only upon non-synthetic MouseEvents
973 else if ( !rTEvt
.GetMouseEvent().IsSynthetic() || rTEvt
.GetMouseEvent().IsModifierChanged() )
975 Point aMousePos
= rTEvt
.GetMouseEvent().GetPosPixel();
976 Point aFrameMousePos
= GetWindow()->ImplOutputToFrame( aMousePos
);
977 Size aFrameSize
= GetWindow()->ImplGetFrameWindow()->GetOutputSizePixel();
978 if ( aFrameMousePos
.X() < 0 )
979 aFrameMousePos
.X() = 0;
980 if ( aFrameMousePos
.Y() < 0 )
981 aFrameMousePos
.Y() = 0;
982 if ( aFrameMousePos
.X() > aFrameSize
.Width()-1 )
983 aFrameMousePos
.X() = aFrameSize
.Width()-1;
984 if ( aFrameMousePos
.Y() > aFrameSize
.Height()-1 )
985 aFrameMousePos
.Y() = aFrameSize
.Height()-1;
986 aMousePos
= GetWindow()->ImplFrameToOutput( aFrameMousePos
);
987 aMousePos
.X() -= maMouseOff
.X();
988 aMousePos
.Y() -= maMouseOff
.Y();
989 Point aPos
= GetWindow()->ImplOutputToFrame( aMousePos
);
990 Rectangle
aTrackRect( aPos
, Size( mnTrackWidth
, mnTrackHeight
) );
991 Rectangle aCompRect
= aTrackRect
;
992 aPos
.X() += maMouseOff
.X();
993 aPos
.Y() += maMouseOff
.Y();
995 sal_Bool bFloatMode
= Docking( aPos
, aTrackRect
);
997 mbFloatPrevented
= sal_False
;
998 if ( mbLastFloatMode
!= bFloatMode
)
1002 aTrackRect
.Left() -= mnDockLeft
;
1003 aTrackRect
.Top() -= mnDockTop
;
1004 aTrackRect
.Right() += mnDockRight
;
1005 aTrackRect
.Bottom() += mnDockBottom
;
1009 if ( aCompRect
== aTrackRect
)
1011 aTrackRect
.Left() += mnDockLeft
;
1012 aTrackRect
.Top() += mnDockTop
;
1013 aTrackRect
.Right() -= mnDockRight
;
1014 aTrackRect
.Bottom() -= mnDockBottom
;
1017 mbLastFloatMode
= bFloatMode
;
1020 sal_uInt16 nTrackStyle
;
1022 nTrackStyle
= SHOWTRACK_OBJECT
;
1024 nTrackStyle
= SHOWTRACK_BIG
;
1025 Rectangle aShowTrackRect
= aTrackRect
;
1026 aShowTrackRect
.SetPos( GetWindow()->ImplFrameToOutput( aShowTrackRect
.TopLeft() ) );
1028 GetWindow()->ShowTracking( aShowTrackRect
, nTrackStyle
);
1030 // Maus-Offset neu berechnen, da Rechteck veraendert werden
1032 maMouseOff
.X() = aPos
.X() - aTrackRect
.Left();
1033 maMouseOff
.Y() = aPos
.Y() - aTrackRect
.Top();
1035 mnTrackX
= aTrackRect
.Left();
1036 mnTrackY
= aTrackRect
.Top();
1037 mnTrackWidth
= aTrackRect
.GetWidth();
1038 mnTrackHeight
= aTrackRect
.GetHeight();
1044 // -----------------------------------------------------------------------
1046 void ImplDockingWindowWrapper::StartDocking( const Point
& rPoint
, Rectangle
& rRect
)
1048 DockingData
data( rPoint
, rRect
, IsFloatingMode() );
1050 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_STARTDOCKING
, &data
);
1051 mbDocking
= sal_True
;
1054 // -----------------------------------------------------------------------
1056 sal_Bool
ImplDockingWindowWrapper::Docking( const Point
& rPoint
, Rectangle
& rRect
)
1058 DockingData
data( rPoint
, rRect
, IsFloatingMode() );
1060 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_DOCKING
, &data
);
1061 rRect
= data
.maTrackRect
;
1062 return data
.mbFloating
;
1065 // -----------------------------------------------------------------------
1067 void ImplDockingWindowWrapper::EndDocking( const Rectangle
& rRect
, sal_Bool bFloatMode
)
1069 Rectangle
aRect( rRect
);
1071 if ( !IsDockingCanceled() )
1073 sal_Bool bShow
= sal_False
;
1074 if ( bFloatMode
!= IsFloatingMode() )
1076 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1077 SetFloatingMode( bFloatMode
);
1081 // #i44800# always use outputsize - as in all other places
1082 mpFloatWin
->SetOutputSizePixel( aRect
.GetSize() );
1083 mpFloatWin
->SetPosPixel( aRect
.TopLeft() );
1088 Point aPos
= aRect
.TopLeft();
1089 aPos
= GetWindow()->GetParent()->ScreenToOutputPixel( aPos
);
1090 GetWindow()->SetPosSizePixel( aPos
, aRect
.GetSize() );
1094 GetWindow()->Show( sal_True
, SHOW_NOFOCUSCHANGE
| SHOW_NOACTIVATE
);
1097 EndDockingData
data( aRect
, IsFloatingMode(), IsDockingCanceled() );
1098 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_ENDDOCKING
, &data
);
1100 mbDocking
= sal_False
;
1102 // must be enabled in Window::Notify to prevent permanent docking during mouse move
1103 mbStartDockingEnabled
= sal_False
;
1106 // -----------------------------------------------------------------------
1108 sal_Bool
ImplDockingWindowWrapper::PrepareToggleFloatingMode()
1110 sal_Bool bFloating
= sal_True
;
1111 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_PREPARETOGGLEFLOATING
, &bFloating
);
1115 // -----------------------------------------------------------------------
1117 sal_Bool
ImplDockingWindowWrapper::Close()
1123 // -----------------------------------------------------------------------
1125 void ImplDockingWindowWrapper::ToggleFloatingMode()
1127 // notify dockingwindow/toolbox
1128 // note: this must be done *before* notifying the
1129 // listeners to have the toolbox in the proper state
1130 if( GetWindow()->ImplIsDockingWindow() )
1131 ((DockingWindow
*) GetWindow())->ToggleFloatingMode();
1133 // now notify listeners
1134 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_TOGGLEFLOATING
);
1136 // must be enabled in Window::Notify to prevent permanent docking during mouse move
1137 mbStartDockingEnabled
= sal_False
;
1140 // -----------------------------------------------------------------------
1142 void ImplDockingWindowWrapper::TitleButtonClick( sal_uInt16 nType
)
1144 if( nType
== TITLE_BUTTON_MENU
)
1146 ToolBox
*pToolBox
= dynamic_cast< ToolBox
* >( GetWindow() );
1149 pToolBox
->ExecuteCustomMenu();
1152 if( nType
== TITLE_BUTTON_DOCKING
)
1154 SetFloatingMode( !IsFloatingMode() );
1158 // -----------------------------------------------------------------------
1160 void ImplDockingWindowWrapper::Pin()
1165 // -----------------------------------------------------------------------
1167 void ImplDockingWindowWrapper::Roll()
1172 // -----------------------------------------------------------------------
1174 void ImplDockingWindowWrapper::PopupModeEnd()
1179 // -----------------------------------------------------------------------
1181 void ImplDockingWindowWrapper::Resizing( Size
& rSize
)
1183 // TODO: add virtual Resizing() to class Window, so we can get rid of class DockingWindow
1184 DockingWindow
*pDockingWindow
= dynamic_cast< DockingWindow
* >( GetWindow() );
1185 if( pDockingWindow
)
1186 pDockingWindow
->Resizing( rSize
);
1189 // -----------------------------------------------------------------------
1191 void ImplDockingWindowWrapper::ShowTitleButton( sal_uInt16 nButton
, sal_Bool bVisible
)
1194 mpFloatWin
->ShowTitleButton( nButton
, bVisible
);
1197 if ( nButton
== TITLE_BUTTON_DOCKING
)
1198 mbDockBtn
= bVisible
;
1199 else // if ( nButton == TITLE_BUTTON_HIDE )
1200 mbHideBtn
= bVisible
;
1204 // -----------------------------------------------------------------------
1206 void ImplDockingWindowWrapper::StartPopupMode( ToolBox
*pParentToolBox
, sal_uLong nFlags
)
1208 // do nothing if window is floating
1209 if( IsFloatingMode() )
1212 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1214 // prepare reparenting
1215 Window
* pRealParent
= GetWindow()->GetWindow( WINDOW_PARENT
);
1216 mpOldBorderWin
= GetWindow()->GetWindow( WINDOW_BORDER
);
1217 if( mpOldBorderWin
== GetWindow() )
1218 mpOldBorderWin
= NULL
; // no border window found
1220 // the new parent for popup mode
1221 ImplPopupFloatWin
* pWin
= new ImplPopupFloatWin( mpParent
, this, (nFlags
& FLOATWIN_POPUPMODE_ALLOWTEAROFF
) != 0 );
1223 pWin
->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper
, PopupModeEnd
) );
1224 pWin
->SetText( GetWindow()->GetText() );
1226 pWin
->SetOutputSizePixel( GetWindow()->GetSizePixel() );
1228 GetWindow()->mpWindowImpl
->mpBorderWindow
= NULL
;
1229 GetWindow()->mpWindowImpl
->mnLeftBorder
= 0;
1230 GetWindow()->mpWindowImpl
->mnTopBorder
= 0;
1231 GetWindow()->mpWindowImpl
->mnRightBorder
= 0;
1232 GetWindow()->mpWindowImpl
->mnBottomBorder
= 0;
1234 // position toolbox below dragrect
1235 GetWindow()->SetPosPixel( pWin
->GetToolboxPosition() );
1237 // reparent borderwindow and window
1238 if ( mpOldBorderWin
)
1239 mpOldBorderWin
->SetParent( pWin
);
1240 GetWindow()->SetParent( pWin
);
1242 // correct border window pointers
1243 GetWindow()->mpWindowImpl
->mpBorderWindow
= pWin
;
1244 pWin
->mpWindowImpl
->mpClientWindow
= GetWindow();
1245 GetWindow()->mpWindowImpl
->mpRealParent
= pRealParent
;
1247 // set mpFloatWin not until all window positioning is done !!!
1248 // (SetPosPixel etc. check for valid mpFloatWin pointer)
1251 // if the subtoolbar was opened via keyboard make sure that key events
1252 // will go into subtoolbar
1253 if( pParentToolBox
->IsKeyEvent() )
1254 nFlags
|= FLOATWIN_POPUPMODE_GRABFOCUS
;
1256 mpFloatWin
->StartPopupMode( pParentToolBox
, nFlags
);
1257 GetWindow()->Show();
1259 if( pParentToolBox
->IsKeyEvent() )
1261 // send HOME key to subtoolbar in order to select first item
1262 KeyEvent
aEvent( 0, KeyCode( KEY_HOME
) );
1263 mpFloatWin
->GetPreferredKeyInputWindow()->KeyInput( aEvent
);
1267 IMPL_LINK_NOARG(ImplDockingWindowWrapper
, PopupModeEnd
)
1269 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1271 // set parameter for handler before destroying floating window
1272 ImplPopupFloatWin
*pPopupFloatWin
= (ImplPopupFloatWin
*) mpFloatWin
;
1273 EndPopupModeData
aData( pPopupFloatWin
->GetTearOffPosition(), mpFloatWin
->IsPopupModeTearOff() );
1275 // before deleting change parent back, so we can delete the floating window alone
1276 Window
* pRealParent
= GetWindow()->GetWindow( WINDOW_PARENT
);
1277 GetWindow()->mpWindowImpl
->mpBorderWindow
= NULL
;
1278 if ( mpOldBorderWin
)
1280 GetWindow()->SetParent( mpOldBorderWin
);
1281 ((ImplBorderWindow
*)mpOldBorderWin
)->GetBorder(
1282 GetWindow()->mpWindowImpl
->mnLeftBorder
, GetWindow()->mpWindowImpl
->mnTopBorder
,
1283 GetWindow()->mpWindowImpl
->mnRightBorder
, GetWindow()->mpWindowImpl
->mnBottomBorder
);
1284 mpOldBorderWin
->Resize();
1286 GetWindow()->mpWindowImpl
->mpBorderWindow
= mpOldBorderWin
;
1287 GetWindow()->SetParent( pRealParent
);
1288 GetWindow()->mpWindowImpl
->mpRealParent
= pRealParent
;
1293 // call handler - which will destroy the window and thus the wrapper as well !
1294 GetWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_ENDPOPUPMODE
, &aData
);
1300 sal_Bool
ImplDockingWindowWrapper::IsInPopupMode() const
1302 if( GetFloatingWindow() )
1303 return GetFloatingWindow()->IsInPopupMode();
1308 // -----------------------------------------------------------------------
1310 void ImplDockingWindowWrapper::SetFloatingMode( sal_Bool bFloatMode
)
1312 // do nothing if window is docked and locked
1313 if( !IsFloatingMode() && IsLocked() )
1316 if ( IsFloatingMode() != bFloatMode
)
1318 if ( PrepareToggleFloatingMode() )
1320 sal_Bool bVisible
= GetWindow()->IsVisible();
1324 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1326 maDockPos
= GetWindow()->GetPosPixel();
1328 Window
* pRealParent
= GetWindow()->GetWindow( WINDOW_PARENT
);
1329 mpOldBorderWin
= GetWindow()->GetWindow( WINDOW_BORDER
);
1330 if( mpOldBorderWin
== mpDockingWindow
)
1331 mpOldBorderWin
= NULL
; // no border window found
1333 ImplDockFloatWin2
* pWin
=
1334 new ImplDockFloatWin2(
1336 mnFloatBits
& ( WB_MOVEABLE
| WB_SIZEABLE
| WB_CLOSEABLE
) ?
1337 mnFloatBits
| WB_SYSTEMWINDOW
1338 | WB_OWNERDRAWDECORATION
1342 GetWindow()->mpWindowImpl
->mpBorderWindow
= NULL
;
1343 GetWindow()->mpWindowImpl
->mnLeftBorder
= 0;
1344 GetWindow()->mpWindowImpl
->mnTopBorder
= 0;
1345 GetWindow()->mpWindowImpl
->mnRightBorder
= 0;
1346 GetWindow()->mpWindowImpl
->mnBottomBorder
= 0;
1348 // Falls Parent zerstoert wird, muessen wir auch vom
1349 // BorderWindow den Parent umsetzen
1350 if ( mpOldBorderWin
)
1351 mpOldBorderWin
->SetParent( pWin
);
1352 GetWindow()->SetParent( pWin
);
1353 pWin
->SetPosPixel( Point() );
1355 GetWindow()->mpWindowImpl
->mpBorderWindow
= pWin
;
1356 pWin
->mpWindowImpl
->mpClientWindow
= mpDockingWindow
;
1357 GetWindow()->mpWindowImpl
->mpRealParent
= pRealParent
;
1359 pWin
->SetText( GetWindow()->GetText() );
1360 pWin
->SetOutputSizePixel( GetWindow()->GetSizePixel() );
1361 pWin
->SetPosPixel( maFloatPos
);
1362 // DockingDaten ans FloatingWindow weiterreichen
1363 pWin
->ShowTitleButton( TITLE_BUTTON_DOCKING
, mbDockBtn
);
1364 pWin
->ShowTitleButton( TITLE_BUTTON_HIDE
, mbHideBtn
);
1365 pWin
->SetPin( mbPined
);
1370 pWin
->SetRollUpOutputSizePixel( maRollUpOutSize
);
1371 pWin
->SetMinOutputSizePixel( maMinOutSize
);
1372 pWin
->SetMaxOutputSizePixel( maMaxOutSize
);
1377 GetWindow()->Show( sal_True
, SHOW_NOFOCUSCHANGE
| SHOW_NOACTIVATE
);
1379 ToggleFloatingMode();
1383 GetWindow()->Show( sal_False
, SHOW_NOFOCUSCHANGE
);
1385 // FloatingDaten wird im FloatingWindow speichern
1386 maFloatPos
= mpFloatWin
->GetPosPixel();
1387 mbDockBtn
= mpFloatWin
->IsTitleButtonVisible( TITLE_BUTTON_DOCKING
);
1388 mbHideBtn
= mpFloatWin
->IsTitleButtonVisible( TITLE_BUTTON_HIDE
);
1389 mbPined
= mpFloatWin
->IsPined();
1390 mbRollUp
= mpFloatWin
->IsRollUp();
1391 maRollUpOutSize
= mpFloatWin
->GetRollUpOutputSizePixel();
1392 maMinOutSize
= mpFloatWin
->GetMinOutputSizePixel();
1393 maMaxOutSize
= mpFloatWin
->GetMaxOutputSizePixel();
1395 Window
* pRealParent
= GetWindow()->GetWindow( WINDOW_PARENT
); //mpWindowImpl->mpRealParent;
1396 GetWindow()->mpWindowImpl
->mpBorderWindow
= NULL
;
1397 if ( mpOldBorderWin
)
1399 GetWindow()->SetParent( mpOldBorderWin
);
1400 ((ImplBorderWindow
*)mpOldBorderWin
)->GetBorder(
1401 GetWindow()->mpWindowImpl
->mnLeftBorder
, GetWindow()->mpWindowImpl
->mnTopBorder
,
1402 GetWindow()->mpWindowImpl
->mnRightBorder
, GetWindow()->mpWindowImpl
->mnBottomBorder
);
1403 mpOldBorderWin
->Resize();
1405 GetWindow()->mpWindowImpl
->mpBorderWindow
= mpOldBorderWin
;
1406 GetWindow()->SetParent( pRealParent
);
1407 GetWindow()->mpWindowImpl
->mpRealParent
= pRealParent
;
1409 delete static_cast<ImplDockFloatWin2
*>(mpFloatWin
);
1411 GetWindow()->SetPosPixel( maDockPos
);
1414 GetWindow()->Show();
1416 ToggleFloatingMode();
1423 // -----------------------------------------------------------------------
1425 void ImplDockingWindowWrapper::SetFloatStyle( WinBits nStyle
)
1427 mnFloatBits
= nStyle
;
1430 // -----------------------------------------------------------------------
1432 WinBits
ImplDockingWindowWrapper::GetFloatStyle() const
1437 // -----------------------------------------------------------------------
1439 void ImplDockingWindowWrapper::SetPosSizePixel( long nX
, long nY
,
1440 long nWidth
, long nHeight
,
1444 mpFloatWin
->SetPosSizePixel( nX
, nY
, nWidth
, nHeight
, nFlags
);
1446 GetWindow()->SetPosSizePixel( nX
, nY
, nWidth
, nHeight
, nFlags
);
1449 // -----------------------------------------------------------------------
1451 Point
ImplDockingWindowWrapper::GetPosPixel() const
1454 return mpFloatWin
->GetPosPixel();
1456 return mpDockingWindow
->GetPosPixel();
1459 // -----------------------------------------------------------------------
1461 Size
ImplDockingWindowWrapper::GetSizePixel() const
1464 return mpFloatWin
->GetSizePixel();
1466 return mpDockingWindow
->GetSizePixel();
1469 // -----------------------------------------------------------------------
1470 // old inlines from DockingWindow
1471 // -----------------------------------------------------------------------
1473 void ImplDockingWindowWrapper::SetMinOutputSizePixel( const Size
& rSize
)
1476 mpFloatWin
->SetMinOutputSizePixel( rSize
);
1477 maMinOutSize
= rSize
;
1480 void ImplDockingWindowWrapper::SetMaxOutputSizePixel( const Size
& rSize
)
1483 mpFloatWin
->SetMaxOutputSizePixel( rSize
);
1484 maMaxOutSize
= rSize
;
1487 sal_Bool
ImplDockingWindowWrapper::IsFloatingMode() const
1489 return (mpFloatWin
!= NULL
);
1493 void ImplDockingWindowWrapper::SetDragArea( const Rectangle
& rRect
)
1498 Rectangle
ImplDockingWindowWrapper::GetDragArea() const
1503 void ImplDockingWindowWrapper::Lock()
1505 mbLocked
= sal_True
;
1506 // only toolbars support locking
1507 ToolBox
*pToolBox
= dynamic_cast< ToolBox
* >( GetWindow() );
1509 pToolBox
->Lock( mbLocked
);
1512 void ImplDockingWindowWrapper::Unlock()
1514 mbLocked
= sal_False
;
1515 // only toolbars support locking
1516 ToolBox
*pToolBox
= dynamic_cast< ToolBox
* >( GetWindow() );
1518 pToolBox
->Lock( mbLocked
);
1521 sal_Bool
ImplDockingWindowWrapper::IsLocked() const
1526 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */