1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: workwin.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sfx2.hxx"
40 #include <sfx2/docfile.hxx>
41 #include <sfx2/objsh.hxx>
42 #include <sfx2/app.hxx>
43 #include "workwin.hxx"
44 #include <sfx2/topfrm.hxx>
45 #include "arrdecl.hxx"
46 #include <sfx2/viewfrm.hxx>
47 #include <sfx2/module.hxx>
48 #include <sfx2/dispatch.hxx>
49 #include <sfx2/dockwin.hxx>
50 #include <sfx2/viewsh.hxx>
51 #include "splitwin.hxx"
52 #include <sfx2/msgpool.hxx>
53 #include "sfxresid.hxx"
54 #include <sfx2/objsh.hxx>
55 #include <sfx2/request.hxx> // SFX_ITEMSET_SET
56 #include <vcl/taskpanelist.hxx>
57 #include <vcl/toolbox.hxx>
58 #include <tools/rcid.h>
59 #include <toolkit/helper/vclunohelper.hxx>
60 #include <svtools/itempool.hxx>
61 #include <svtools/itemiter.hxx>
62 #include <svtools/whiter.hxx>
63 #include <svtools/intitem.hxx>
64 #ifndef _SFXEITEM_HXX //autogen
65 #include <svtools/eitem.hxx>
67 #include <com/sun/star/ui/XUIElement.hpp>
68 #include <com/sun/star/frame/XLayoutManager.hpp>
69 #include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp>
70 #include <com/sun/star/frame/LayoutManagerEvents.hpp>
71 #include <com/sun/star/beans/XPropertySet.hpp>
72 #include <com/sun/star/awt/XWindow.hpp>
73 #include <com/sun/star/lang/DisposedException.hpp>
75 using namespace ::com::sun::star
;
76 using namespace ::com::sun::star::uno
;
77 namespace css
= ::com::sun::star
;
85 static const ResIdToResName pToolBarResToName
[] =
87 { 558, "fullscreenbar" },
88 { 560, "standardbar", },
89 { 18001, "formsnavigationbar" },
90 { 18002, "formsfilterbar" },
91 { 18003, "formtextobjectbar" },
92 { 18004, "formcontrols" },
93 { 18005, "moreformcontrols" },
94 { 18006, "formdesign" },
95 { 20050, "toolbar" }, //math
96 { 30001, "objectbar" }, //chart
97 { 30513, "toolbar" }, //chart
98 { 25005, "textobjectbar" }, //calc
99 { 25053, "drawobjectbar" },
100 { 25054, "graphicobjectbar" },
101 { 25001, "formatobjectbar" },
102 { 25006, "previewbar" },
103 { 25035, "toolbar" }, //calc
104 { 23015, "bezierobjectbar" }, //draw/impress
105 { 23019, "gluepointsobjectbar" },
106 { 23030, "graphicobjectbar" },
107 { 23013, "drawingobjectbar" }, //impress
108 { 23016, "textobjectbar" }, //impress
109 { 23028, "textobjectbar" }, //draw
110 { 23011, "toolbar" }, //impress
111 { 23020, "optionsbar" },
112 { 23021, "commontaskbar" },
113 { 23025, "toolbar" }, //draw
114 { 23026, "optionsbar" },
115 { 23027, "drawingobjectbar" }, //draw
116 { 23017, "outlinetoolbar" }, //impress
117 { 23012, "slideviewtoolbar" },
118 { 23014, "slideviewobjectbar" },
119 { 23283, "bezierobjectbar" }, //writer
120 { 23269, "drawingobjectbar" },
121 { 23270, "drawtextobjectbar" },
122 { 23267, "frameobjectbar" },
123 { 23268, "graphicobjectbar" },
124 { 23271, "numobjectbar" },
125 { 23272, "oleobjectbar" },
126 { 23266, "tableobjectbar" },
127 { 23265, "textobjectbar" },
128 { 20631, "previewobjectbar" }, //writer
129 { 20402, "toolbar" }, //web
130 { 20403, "textobjectbar" },
131 { 23273, "toolbar" }, //writer
132 { 20408, "frameobjectbar" }, //web
133 { 20410, "graphicobjectbar" },
134 { 20411, "oleobjectbar" },
135 { 14850, "macrobar" },
136 { 10987, "fontworkobjectbar" }, //global
137 { 10986, "extrusionobjectbar" },
138 { 23022, "formsobjectbar" },
139 { 23310, "viewerbar" }, //writer (plugin)
140 { 25000, "viewerbar" }, //calc (plugin)
141 { 23023, "viewerbar" }, //impress(plugin)
142 { 23024, "viewerbar" }, //draw (plugin)
143 { 23031, "mediaobjectbar" }, //draw/impress
144 { 25060, "mediaobjectbar" }, //calc
145 { 23311, "mediaobjectbar" }, //writer
149 DBG_NAME(SfxWorkWindow
)
151 //SV_IMPL_OBJARR( SfxObjectBarArr_Impl, SfxObjectBar_Impl );
153 //====================================================================
154 // Sortiert die Children nach ihrem Alignment
155 // Reihenfolge entspricht der im enum SfxChildAlignment (->CHILDWIN.HXX).
158 // Hilfe, um die "Anderungen am Alignment kompatibal zu machen!
161 SFX_IMPL_XINTERFACE_3( LayoutManagerListener
, OWeakObject
, ::com::sun::star::frame::XLayoutManagerListener
, ::com::sun::star::lang::XEventListener
, ::com::sun::star::lang::XComponent
)
162 SFX_IMPL_XTYPEPROVIDER_3( LayoutManagerListener
, ::com::sun::star::frame::XLayoutManagerListener
, ::com::sun::star::lang::XEventListener
, ::com::sun::star::lang::XComponent
)
164 LayoutManagerListener::LayoutManagerListener(
165 SfxWorkWindow
* pWrkWin
) :
166 m_bHasFrame( sal_False
),
167 m_pWrkWin( pWrkWin
),
168 m_aLayoutManagerPropName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))
172 LayoutManagerListener::~LayoutManagerListener()
176 void LayoutManagerListener::setFrame( const css::uno::Reference
< css::frame::XFrame
>& xFrame
)
178 ::vos::OGuard
aGuard( Application::GetSolarMutex() );
179 if ( m_pWrkWin
&& !m_bHasFrame
)
182 m_bHasFrame
= sal_True
;
186 css::uno::Reference
< css::beans::XPropertySet
> xPropSet( xFrame
, UNO_QUERY
);
187 css::uno::Reference
< css::frame::XLayoutManagerEventBroadcaster
> xLayoutManager
;
192 Any aValue
= xPropSet
->getPropertyValue( m_aLayoutManagerPropName
);
193 aValue
>>= xLayoutManager
;
195 if ( xLayoutManager
.is() )
196 xLayoutManager
->addLayoutManagerEventListener(
197 css::uno::Reference
< css::frame::XLayoutManagerListener
>(
198 static_cast< OWeakObject
* >( this ), css::uno::UNO_QUERY
));
200 xPropSet
= css::uno::Reference
< css::beans::XPropertySet
>( xLayoutManager
, UNO_QUERY
);
203 aValue
= xPropSet
->getPropertyValue(
204 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LockCount" )) );
205 aValue
>>= m_pWrkWin
->m_nLock
;
208 catch ( css::lang::DisposedException
& )
211 catch ( css::uno::RuntimeException
& e
)
215 catch ( css::uno::Exception
& )
223 //---------------------------------------------------------------------------------------------------------
225 //---------------------------------------------------------------------------------------------------------
226 void SAL_CALL
LayoutManagerListener::addEventListener(
227 const css::uno::Reference
< css::lang::XEventListener
>& )
228 throw (::com::sun::star::uno::RuntimeException
)
230 // do nothing, only internal class
233 void SAL_CALL
LayoutManagerListener::removeEventListener(
234 const css::uno::Reference
< css::lang::XEventListener
>& )
235 throw (::com::sun::star::uno::RuntimeException
)
237 // do nothing, only internal class
240 void SAL_CALL
LayoutManagerListener::dispose()
241 throw( css::uno::RuntimeException
)
243 ::vos::OGuard
aGuard( Application::GetSolarMutex() );
248 css::uno::Reference
< css::frame::XFrame
> xFrame( m_xFrame
.get(), css::uno::UNO_QUERY
);
251 m_xFrame
= css::uno::Reference
< css::frame::XFrame
>();
252 m_bHasFrame
= sal_False
;
254 css::uno::Reference
< css::beans::XPropertySet
> xPropSet( xFrame
, css::uno::UNO_QUERY
);
255 css::uno::Reference
< css::frame::XLayoutManagerEventBroadcaster
> xLayoutManager
;
260 css::uno::Any aValue
= xPropSet
->getPropertyValue( m_aLayoutManagerPropName
);
261 aValue
>>= xLayoutManager
;
263 // remove as listener from layout manager
264 if ( xLayoutManager
.is() )
265 xLayoutManager
->removeLayoutManagerEventListener(
266 css::uno::Reference
< css::frame::XLayoutManagerListener
>(
267 static_cast< OWeakObject
* >( this ), css::uno::UNO_QUERY
));
269 catch ( css::lang::DisposedException
& )
272 catch ( css::uno::RuntimeException
& e
)
276 catch ( css::uno::Exception
& )
283 //---------------------------------------------------------------------------------------------------------
285 //---------------------------------------------------------------------------------------------------------
286 void SAL_CALL
LayoutManagerListener::disposing(
287 const css::lang::EventObject
& )
288 throw( css::uno::RuntimeException
)
290 ::vos::OGuard
aGuard( Application::GetSolarMutex() );
292 m_bHasFrame
= sal_False
;
293 m_xFrame
= css::uno::Reference
< css::frame::XFrame
>();
296 //---------------------------------------------------------------------------------------------------------
297 // XLayoutManagerEventListener
298 //---------------------------------------------------------------------------------------------------------
299 void SAL_CALL
LayoutManagerListener::layoutEvent(
300 const css::lang::EventObject
&,
301 ::sal_Int16 eLayoutEvent
,
302 const css::uno::Any
& )
303 throw (css::uno::RuntimeException
)
305 ::vos::OGuard
aGuard( Application::GetSolarMutex() );
308 if ( eLayoutEvent
== css::frame::LayoutManagerEvents::VISIBLE
)
310 m_pWrkWin
->MakeVisible_Impl( TRUE
);
311 m_pWrkWin
->ShowChilds_Impl();
312 m_pWrkWin
->ArrangeChilds_Impl( TRUE
);
314 else if ( eLayoutEvent
== css::frame::LayoutManagerEvents::INVISIBLE
)
316 m_pWrkWin
->MakeVisible_Impl( FALSE
);
317 m_pWrkWin
->HideChilds_Impl();
318 m_pWrkWin
->ArrangeChilds_Impl( TRUE
);
320 else if ( eLayoutEvent
== css::frame::LayoutManagerEvents::LOCK
)
322 m_pWrkWin
->Lock_Impl( TRUE
);
324 else if ( eLayoutEvent
== css::frame::LayoutManagerEvents::UNLOCK
)
326 m_pWrkWin
->Lock_Impl( FALSE
);
331 //====================================================================
333 typedef std::hash_map
< sal_Int32
, rtl::OUString
> ToolBarResIdToResourceURLMap
;
335 static sal_Bool bMapInitialized
= sal_False
;
336 static ToolBarResIdToResourceURLMap aResIdToResourceURLMap
;
338 static rtl::OUString
GetResourceURLFromResId( USHORT nResId
)
340 if ( !bMapInitialized
)
342 osl::MutexGuard
aGuard( osl::Mutex::getGlobalMutex() ) ;
343 if ( !bMapInitialized
)
345 sal_Int32
nIndex( 0 );
346 while ( pToolBarResToName
[nIndex
].nId
!= 0 )
348 rtl::OUString
aResourceURL( rtl::OUString::createFromAscii( pToolBarResToName
[nIndex
].pName
));
349 aResIdToResourceURLMap
.insert( ToolBarResIdToResourceURLMap::value_type(
350 sal_Int32( pToolBarResToName
[nIndex
].nId
), aResourceURL
));
353 bMapInitialized
= sal_True
;
357 ToolBarResIdToResourceURLMap::const_iterator pIter
= aResIdToResourceURLMap
.find( nResId
);
358 if ( pIter
!= aResIdToResourceURLMap
.end() )
359 return pIter
->second
;
361 return rtl::OUString();
364 BOOL
IsAppWorkWinToolbox_Impl( USHORT nPos
)
368 case SFX_OBJECTBAR_APPLICATION
:
369 case SFX_OBJECTBAR_MACRO
:
370 case SFX_OBJECTBAR_FULLSCREEN
:
377 USHORT
TbxMatch( USHORT nPos
)
381 case SFX_OBJECTBAR_APPLICATION
:
383 case SFX_OBJECTBAR_OPTIONS
:
385 case SFX_OBJECTBAR_MACRO
:
387 case SFX_OBJECTBAR_OBJECT
:
389 case SFX_OBJECTBAR_TOOLS
:
391 case SFX_OBJECTBAR_FULLSCREEN
:
392 case SFX_OBJECTBAR_COMMONTASK
:
393 case SFX_OBJECTBAR_RECORDING
:
400 USHORT
ChildAlignValue(SfxChildAlignment eAlign
)
406 case SFX_ALIGN_HIGHESTTOP
:
409 case SFX_ALIGN_LOWESTBOTTOM
:
412 case SFX_ALIGN_FIRSTLEFT
:
415 case SFX_ALIGN_LASTRIGHT
:
421 case SFX_ALIGN_RIGHT
:
424 case SFX_ALIGN_FIRSTRIGHT
:
427 case SFX_ALIGN_LASTLEFT
:
433 case SFX_ALIGN_BOTTOM
:
436 case SFX_ALIGN_TOOLBOXTOP
:
439 case SFX_ALIGN_TOOLBOXBOTTOM
:
442 case SFX_ALIGN_LOWESTTOP
:
445 case SFX_ALIGN_HIGHESTBOTTOM
:
448 case SFX_ALIGN_TOOLBOXLEFT
:
451 case SFX_ALIGN_TOOLBOXRIGHT
:
454 case SFX_ALIGN_NOALIGNMENT
:
455 break; // -Wall not handled...
461 USHORT
ChildTravelValue( SfxChildAlignment eAlign
)
467 case SFX_ALIGN_FIRSTLEFT
:
473 case SFX_ALIGN_LASTLEFT
:
476 case SFX_ALIGN_TOOLBOXLEFT
:
479 case SFX_ALIGN_HIGHESTTOP
:
485 case SFX_ALIGN_TOOLBOXTOP
:
488 case SFX_ALIGN_LOWESTTOP
:
491 case SFX_ALIGN_HIGHESTBOTTOM
:
494 case SFX_ALIGN_TOOLBOXBOTTOM
:
497 case SFX_ALIGN_BOTTOM
:
500 case SFX_ALIGN_LOWESTBOTTOM
:
503 case SFX_ALIGN_TOOLBOXRIGHT
:
506 case SFX_ALIGN_FIRSTRIGHT
:
509 case SFX_ALIGN_RIGHT
:
512 case SFX_ALIGN_LASTRIGHT
:
515 case SFX_ALIGN_NOALIGNMENT
:
516 break; // -Wall not handled.
522 void SfxWorkWindow::Sort_Impl()
524 aSortedList
.Remove(0, aSortedList
.Count());
525 for (USHORT i
=0; i
<pChilds
->Count(); i
++)
527 SfxChild_Impl
*pCli
= (*pChilds
)[i
];
531 for (k
=0; k
<aSortedList
.Count(); k
++)
532 // if ( (*pChilds)[aSortedList[k]]->eAlign > pCli->eAlign )
533 if (ChildAlignValue((*pChilds
)[aSortedList
[k
]]->eAlign
) >
534 ChildAlignValue(pCli
->eAlign
))
536 aSortedList
.Insert (i
,k
);
544 //====================================================================
545 // ctor f"ur workwin eines Frames
547 SfxFrameWorkWin_Impl::SfxFrameWorkWin_Impl( Window
*pWin
, SfxFrame
*pFrm
, SfxFrame
* pMaster
)
550 pFrm
->GetCurrentViewFrame()->GetBindings(),
551 pFrm
->GetParentFrame() ? pFrm
->GetParentFrame()->GetWorkWindow_Impl() : NULL
)
552 , pMasterFrame( pMaster
)
555 pConfigShell
= pFrm
->GetCurrentViewFrame();
556 if ( pConfigShell
&& pConfigShell
->GetObjectShell() )
558 bShowStatusBar
= ( !pConfigShell
->GetObjectShell()->IsInPlaceActive() );
559 bDockingAllowed
= sal_True
;
560 bInternalDockingAllowed
= sal_True
;
563 // Die ben"otigten SplitWindows (je eins f"ur jede Seite) werden erzeugt
564 for ( USHORT n
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
566 // Die SplitWindows sind direkte ChildWindows des WorkWindows und enthalten
567 // die angedockten Fenster.
569 SfxChildAlignment eAlign
=
570 ( n
== SFX_SPLITWINDOWS_LEFT
? SFX_ALIGN_LEFT
:
571 n
== SFX_SPLITWINDOWS_RIGHT
? SFX_ALIGN_RIGHT
:
572 n
== SFX_SPLITWINDOWS_TOP
? SFX_ALIGN_TOP
:
574 SfxSplitWindow
*pSplitWin
= new SfxSplitWindow(pWorkWin
, eAlign
, this, pParent
==0 );
575 pSplit
[n
] = pSplitWin
;
578 //nOrigMode = SFX_VISIBILITY_CLIENT;
579 nOrigMode
= SFX_VISIBILITY_STANDARD
;
580 nUpdateMode
= SFX_VISIBILITY_STANDARD
;
583 //====================================================================
584 // ctor der Basisklasse
586 SfxWorkWindow::SfxWorkWindow( Window
*pWin
, SfxBindings
& rB
, SfxWorkWindow
* pParentWorkwin
) :
587 pParent( pParentWorkwin
),
595 bDockingAllowed(TRUE
),
596 bInternalDockingAllowed(TRUE
),
597 bAllChildsVisible(TRUE
),
598 bIsFullScreen( FALSE
),
599 bShowStatusBar( TRUE
),
601 m_aStatusBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )),
602 m_aLayoutManagerPropName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )),
603 m_aTbxTypeName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/" )),
604 m_aProgressBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/progressbar/progressbar" ))
606 DBG_CTOR(SfxWorkWindow
, 0);
607 DBG_ASSERT (pBindings
, "Keine Bindings!");
609 pBindings
->SetWorkWindow_Impl( this );
611 pChildWins
= new SfxChildWindows_Impl
;
612 pChilds
= new SfxChildList_Impl
;
614 // F"ur die ObjectBars wird ein fester Platz in der ChildList reserviert,
615 // damit sie immer in einer definierten Reihenfolge kommen.
616 SfxChild_Impl
* pChild
=0;
617 for (USHORT n
=0; n
< SFX_OBJECTBAR_MAX
; ++n
)
618 pChilds
->Insert(0,pChild
);
620 // create and initialize layout manager listener
621 Reference
< com::sun::star::frame::XFrame
> xFrame
= GetFrameInterface();
622 LayoutManagerListener
* pLayoutManagerListener
= new LayoutManagerListener( this );
623 m_xLayoutManagerListener
= css::uno::Reference
< css::lang::XComponent
>(
624 static_cast< cppu::OWeakObject
* >( pLayoutManagerListener
),
625 css::uno::UNO_QUERY
);
626 pLayoutManagerListener
->setFrame( xFrame
);
629 //====================================================================
632 SfxWorkWindow::~SfxWorkWindow()
634 DBG_DTOR(SfxWorkWindow
, 0);
636 // SplitWindows l"oschen
637 for ( USHORT n
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
639 SfxSplitWindow
*p
= pSplit
[n
];
640 if (p
->GetWindowCount())
641 ReleaseChild_Impl(*p
);
645 // Hilfsstruktur f"ur Child-Windows l"oschen
646 DBG_ASSERT( pChilds
->Count() == 0, "dangling childs" );
650 if ( m_xLayoutManagerListener
.is() )
651 m_xLayoutManagerListener
->dispose();
654 SystemWindow
* SfxWorkWindow::GetTopWindow() const
656 Window
* pRet
= pWorkWin
;
657 while ( pRet
&& !pRet
->IsSystemWindow() )
658 pRet
= pRet
->GetParent();
659 return (SystemWindow
*) pRet
;
662 void SfxWorkWindow::Lock_Impl( BOOL bLock
)
670 DBG_ERROR("Lock count underflow!");
675 ArrangeChilds_Impl();
678 void SfxWorkWindow::ChangeWindow_Impl( Window
*pNew
)
680 Window
*pOld
= pWorkWin
;
682 for ( USHORT nPos
= 0; nPos
< pChilds
->Count(); ++nPos
)
684 SfxChild_Impl
*pCli
= (*pChilds
)[nPos
];
685 if ( pCli
&& pCli
->pWin
&& pCli
->pWin
->GetParent() == pOld
)
687 pCli
->pWin
->SetParent( pNew
);
692 void SfxWorkWindow::SaveStatus_Impl()
694 USHORT nCount
= pChildWins
->Count();
695 for ( USHORT n
=0; n
<nCount
; n
++ )
697 SfxChildWin_Impl
* pCW
= (*pChildWins
)[n
];
698 SfxChildWindow
*pChild
= pCW
->pWin
;
701 USHORT nFlags
= pCW
->aInfo
.nFlags
;
702 pCW
->aInfo
= pChild
->GetInfo();
703 pCW
->aInfo
.nFlags
|= nFlags
;
704 SaveStatus_Impl(pChild
, pCW
->aInfo
);
709 //--------------------------------------------------------------------
710 // Hilfsmethode zum Freigeben der Childlisten. Wenn danach nicht der dtor
711 // aufgerufen wird, sondern weiter gearbeitet wird, mu\s wie im ctor von
712 // SfxWorkWindow noch Platz f"ur die Objectbars und SplitWindows reserviert
715 void SfxWorkWindow::DeleteControllers_Impl()
717 DBG_CHKTHIS(SfxWorkWindow
, 0);
719 // SplitWindows locken (d.h. Resize-Reaktion an den
720 // DockingWindows unterdr"ucken)
722 for ( n
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
724 SfxSplitWindow
*p
= pSplit
[n
];
725 if (p
->GetWindowCount())
729 // Child-Windows l"oschen
730 for ( n
=0; n
<pChildWins
->Count(); )
732 SfxChildWin_Impl
* pCW
= (*pChildWins
)[n
];
733 pChildWins
->Remove(n
);
734 SfxChildWindow
*pChild
= pCW
->pWin
;
738 USHORT nFlags = pCW->aInfo.nFlags;
739 pCW->aInfo = pChild->GetInfo();
740 pCW->aInfo.nFlags |= nFlags;
741 SaveStatus_Impl(pChild, pCW->aInfo);
745 // Wenn das ChildWindow ein direktes Childfenster ist und nicht
746 // in einem SplitWindow liegt, am WorkWindow abmelden.
747 // Nach TH ist eine Abmeldung am Splitwindow nicht erforderlich,
748 // wenn dieses auch gleich mit zerst"ort wird (s.u.).
750 ReleaseChild_Impl(*pChild
->GetWindow());
752 pWorkWin
->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChild
->GetWindow() );
758 // ATTENTION: The array itself is cleared after this loop!!
759 // Therefore we have to set every array entry to zero as it could be
760 // accessed by calling pChild->Destroy().
761 // See task 128307 (Windows)
762 // Window::NotifyAllChilds() calls SfxWorkWindow::DataChanged_Impl for
763 // 8-bit displays (WM_QUERYPALETTECHANGED message due to focus change)!!
764 //(*pChildWins)[n] = 0;
767 //pChildWins->Remove((USHORT)0, nCount);
769 Reference
< com::sun::star::frame::XFrame
> xFrame
= GetFrameInterface();
770 Reference
< com::sun::star::beans::XPropertySet
> xPropSet( xFrame
, UNO_QUERY
);
771 Reference
< ::com::sun::star::frame::XLayoutManager
> xLayoutManager
;
776 Any aValue
= xPropSet
->getPropertyValue( m_aLayoutManagerPropName
);
777 aValue
>>= xLayoutManager
;
784 if ( xLayoutManager
.is() )
786 xLayoutManager
->reset();
788 // StatusBar l"oschen
789 ResetStatusBar_Impl();
791 // ObjectBars l"oschen( zuletzt, damit pChilds nicht tote Pointer enh"alt )
792 for ( USHORT i
= 0; i
< aObjBarList
.size(); i
++ )
794 // Nicht jede Position mu\s belegt sein
795 USHORT nId
= aObjBarList
[i
].nId
;
797 aObjBarList
[i
].nId
= 0;
801 // ObjectBars werden alle auf einmal released, da sie einen
802 // festen zusammenh"angenden Bereich im Array pChilds belegen
803 pChilds
->Remove(0, SFX_OBJECTBAR_MAX
);
809 //====================================================================
810 // Virtuelle Methode zum Anordnen der Childfenster.
812 void SfxWorkWindow::ArrangeChilds_Impl( BOOL
/*bForce*/)
817 void SfxFrameWorkWin_Impl::ArrangeChilds_Impl( BOOL bForce
)
819 if ( pFrame
->IsClosing_Impl() || ( m_nLock
&& !bForce
))
822 SfxInPlaceClient
*pClient
= 0;
823 SfxViewFrame
*pF
= pFrame
->GetCurrentViewFrame();
824 if ( pF
&& pF
->GetViewShell() )
825 pClient
= pF
->GetViewShell()->GetIPClient();
830 aClientArea
= GetTopRect_Impl();
831 if ( aClientArea
.IsEmpty() )
837 if ( IsVisible_Impl() )
838 aBorder
= Arrange_Impl();
841 // Wenn das aktuelle Dokument der Applikation einen IPClient enth"alt, mu\s
842 // dem dazugeh"origen Objekt durch SetTopToolFramePixel der zur Verf"ugung
843 // stehende Platz zugeteilt werden. Das Objekt zeigt dann seine UITools an
844 // und setzt den App-Border(->SfxInPlaceEnv_Impl::ArrangeChilds_Impl()).
845 // Anderenfalls wird hier direkt der AppBorder gesetzt, um evtl. den Border
846 // zu "uberschreiben, den bisher ein Objekt aus einem anderen Dokument
848 // Das Objekt setzt, wenn es seine UI-Tools wegnimmt, den SetAppBorder nicht,
849 // damit kein ObjectBar-Zappeln entsteht.
850 // (->SfxInPlaceEnv_Impl::ArrangeChilds_Impl())
852 pMasterFrame
->SetToolSpaceBorderPixel_Impl( aBorder
);
854 ArrangeAutoHideWindows( NULL
);
857 //--------------------------------------------------------------------
859 SvBorder
SfxWorkWindow::Arrange_Impl()
863 Diese Methode ordnet alle sichtbaren ChildFenster so an, da\s die angedockten
864 Fenster nach der Sorierreihenfolge von au\sen nach innen aneinander
865 gesetzt werden. Wenn ein an sich sichtbares Fenster nicht mehr in die
866 noch freie ClientArea pa\st, wird es auf "nicht sichtbar" gesetzt.
870 DBG_CHKTHIS(SfxWorkWindow
, 0);
872 aClientArea
= GetTopRect_Impl();
873 aUpperClientArea
= aClientArea
;
884 Rectangle
aTmp( aClientArea
);
886 for ( USHORT n
=0; n
<aSortedList
.Count(); ++n
)
888 SfxChild_Impl
* pCli
= (*pChilds
)[aSortedList
[n
]];
892 // Zun"achst nehmen wir an, da\s das Fenster Platz hat
893 pCli
->nVisible
|= CHILD_FITS_IN
;
895 // Nicht sichtbare Fenster "uberspringen
896 if (pCli
->nVisible
!= CHILD_VISIBLE
)
902 aSize
= pCli
->pWin
->GetSizePixel();
904 SvBorder aTemp
= aBorder
;
905 BOOL bAllowHiding
= TRUE
;
906 switch ( pCli
->eAlign
)
908 case SFX_ALIGN_HIGHESTTOP
:
910 case SFX_ALIGN_TOOLBOXTOP
:
911 case SFX_ALIGN_LOWESTTOP
:
912 aSize
.Width() = aTmp
.GetWidth();
913 if ( pCli
->pWin
->GetType() == WINDOW_SPLITWINDOW
)
914 aSize
= ((SplitWindow
*)(pCli
->pWin
))->CalcLayoutSizePixel( aSize
);
915 bAllowHiding
= FALSE
;
916 aBorder
.Top() += aSize
.Height();
917 aPos
= aTmp
.TopLeft();
918 aTmp
.Top() += aSize
.Height();
919 if ( pCli
->eAlign
== SFX_ALIGN_HIGHESTTOP
)
920 aUpperClientArea
.Top() += aSize
.Height();
923 case SFX_ALIGN_LOWESTBOTTOM
:
924 case SFX_ALIGN_BOTTOM
:
925 case SFX_ALIGN_TOOLBOXBOTTOM
:
926 case SFX_ALIGN_HIGHESTBOTTOM
:
927 aSize
.Width() = aTmp
.GetWidth();
928 if ( pCli
->pWin
->GetType() == WINDOW_SPLITWINDOW
)
929 aSize
= ((SplitWindow
*)(pCli
->pWin
))->CalcLayoutSizePixel( aSize
);
930 aBorder
.Bottom() += aSize
.Height();
931 aPos
= aTmp
.BottomLeft();
932 aPos
.Y() -= (aSize
.Height()-1);
933 aTmp
.Bottom() -= aSize
.Height();
934 if ( pCli
->eAlign
== SFX_ALIGN_LOWESTBOTTOM
)
935 aUpperClientArea
.Bottom() -= aSize
.Height();
938 case SFX_ALIGN_FIRSTLEFT
:
940 case SFX_ALIGN_LASTLEFT
:
941 case SFX_ALIGN_TOOLBOXLEFT
:
942 aSize
.Height() = aTmp
.GetHeight();
943 if ( pCli
->pWin
->GetType() == WINDOW_SPLITWINDOW
)
944 aSize
= ((SplitWindow
*)(pCli
->pWin
))->CalcLayoutSizePixel( aSize
);
945 bAllowHiding
= FALSE
;
946 aBorder
.Left() += aSize
.Width();
947 aPos
= aTmp
.TopLeft();
948 aTmp
.Left() += aSize
.Width();
949 if ( pCli
->eAlign
!= SFX_ALIGN_TOOLBOXLEFT
)
950 aUpperClientArea
.Left() += aSize
.Width();
953 case SFX_ALIGN_FIRSTRIGHT
:
954 case SFX_ALIGN_RIGHT
:
955 case SFX_ALIGN_LASTRIGHT
:
956 case SFX_ALIGN_TOOLBOXRIGHT
:
957 aSize
.Height() = aTmp
.GetHeight();
958 if ( pCli
->pWin
->GetType() == WINDOW_SPLITWINDOW
)
959 aSize
= ((SplitWindow
*)(pCli
->pWin
))->CalcLayoutSizePixel( aSize
);
960 aBorder
.Right() += aSize
.Width();
961 aPos
= aTmp
.TopRight();
962 aPos
.X() -= (aSize
.Width()-1);
963 aTmp
.Right() -= aSize
.Width();
964 if ( pCli
->eAlign
!= SFX_ALIGN_TOOLBOXRIGHT
)
965 aUpperClientArea
.Right() -= aSize
.Width();
969 pCli
->aSize
= pCli
->pWin
->GetSizePixel();
970 pCli
->bResize
= FALSE
;
974 pCli
->pWin
->SetPosSizePixel( aPos
, aSize
);
975 pCli
->bResize
= FALSE
;
977 if( bAllowHiding
&& !RequestTopToolSpacePixel_Impl( aBorder
) )
979 pCli
->nVisible
^= CHILD_FITS_IN
;
984 if ( aClientArea
.GetWidth() >= aBorder
.Left() + aBorder
.Right() )
986 aClientArea
.Left() += aBorder
.Left();
987 aClientArea
.Right() -= aBorder
.Right();
991 aBorder
.Left() = aClientArea
.Left();
992 aBorder
.Right() = aClientArea
.Right();
993 aClientArea
.Right() = aClientArea
.Left() = aTmp
.Left();
996 if ( aClientArea
.GetHeight() >= aBorder
.Top() + aBorder
.Bottom() )
998 aClientArea
.Top() += aBorder
.Top();
999 aClientArea
.Bottom() -= aBorder
.Bottom();
1003 aBorder
.Top() = aClientArea
.Top();
1004 aBorder
.Bottom() = aClientArea
.Bottom();
1005 aClientArea
.Top() = aClientArea
.Bottom() = aTmp
.Top();
1008 return IsDockingAllowed() ? aBorder
: SvBorder();
1011 //--------------------------------------------------------------------
1012 // Close-Handler: die Konfiguration der ChildWindows wird gespeichert.
1015 void SfxWorkWindow::Close_Impl()
1017 for (USHORT n
=0; n
<pChildWins
->Count(); n
++)
1019 SfxChildWin_Impl
*pCW
= (*pChildWins
)[n
];
1020 SfxChildWindow
*pChild
= pCW
->pWin
;
1023 USHORT nFlags
= pCW
->aInfo
.nFlags
;
1024 pCW
->aInfo
= pChild
->GetInfo();
1025 pCW
->aInfo
.nFlags
|= nFlags
;
1026 SaveStatus_Impl(pChild
, pCW
->aInfo
);
1031 BOOL
SfxWorkWindow::PrepareClose_Impl()
1033 for (USHORT n
=0; n
<pChildWins
->Count(); n
++)
1035 SfxChildWin_Impl
*pCW
= (*pChildWins
)[n
];
1036 SfxChildWindow
*pChild
= pCW
->pWin
;
1037 if ( pChild
&& !pChild
->QueryClose() )
1044 //--------------------------------------------------------------------
1046 SfxChild_Impl
* SfxWorkWindow::RegisterChild_Impl( Window
& rWindow
,
1047 SfxChildAlignment eAlign
, BOOL bCanGetFocus
)
1049 DBG_CHKTHIS(SfxWorkWindow
, 0);
1050 DBG_ASSERT( pChilds
->Count() < 255, "too many childs" );
1051 DBG_ASSERT( SfxChildAlignValid(eAlign
), "invalid align" );
1052 DBG_ASSERT( !FindChild_Impl(rWindow
), "child registered more than once" );
1055 if ( rWindow
.GetParent() != pWorkWin
)
1056 rWindow
.SetParent( pWorkWin
);
1058 SfxChild_Impl
*pChild
= new SfxChild_Impl(rWindow
, rWindow
.GetSizePixel(),
1059 eAlign
, rWindow
.IsVisible());
1060 pChild
->bCanGetFocus
= bCanGetFocus
;
1062 pChilds
->Insert(pChilds
->Count(), pChild
);
1065 return (*pChilds
)[pChilds
->Count()-1];
1068 //--------------------------------------------------------------------
1070 void SfxWorkWindow::AlignChild_Impl( Window
& rWindow
,
1071 const Size
& rNewSize
,
1072 SfxChildAlignment eAlign
)
1074 DBG_CHKTHIS(SfxWorkWindow
, 0);
1075 // DBG_ASSERT( pChilds, "aligning unregistered child" );
1076 DBG_ASSERT( SfxChildAlignValid(eAlign
), "invalid align" );
1078 SfxChild_Impl
*pChild
= FindChild_Impl(rWindow
);
1081 if (pChild
->eAlign
!= eAlign
)
1084 pChild
->eAlign
= eAlign
;
1085 pChild
->aSize
= rNewSize
;
1086 pChild
->bResize
= TRUE
;
1089 DBG_ERROR( "aligning unregistered child" );
1093 //--------------------------------------------------------------------
1095 void SfxWorkWindow::ReleaseChild_Impl( Window
& rWindow
)
1097 DBG_CHKTHIS(SfxWorkWindow
, 0);
1098 // DBG_ASSERT( pChilds, "releasing unregistered child" );
1100 SfxChild_Impl
*pChild
= 0;
1102 for ( nPos
= 0; nPos
< pChilds
->Count(); ++nPos
)
1104 pChild
= (*pChilds
)[nPos
];
1106 if ( pChild
->pWin
== &rWindow
)
1110 if ( nPos
< pChilds
->Count() )
1114 pChilds
->Remove(nPos
);
1118 DBG_ERROR( "releasing unregistered child" );
1122 //--------------------------------------------------------------------
1124 SfxChild_Impl
* SfxWorkWindow::FindChild_Impl( const Window
& rWindow
) const
1126 DBG_CHKTHIS(SfxWorkWindow
, 0);
1128 SfxChild_Impl
*pChild
= 0;
1129 USHORT nCount
= pChilds
->Count();
1130 for ( USHORT nPos
= 0; nPos
< nCount
; ++nPos
)
1132 pChild
= (*pChilds
)[nPos
];
1134 if ( pChild
->pWin
== &rWindow
)
1141 //--------------------------------------------------------------------
1143 void SfxWorkWindow::ShowChilds_Impl()
1145 DBG_CHKTHIS(SfxWorkWindow
, 0);
1147 bool bInvisible
= ( !IsVisible_Impl() || ( !pWorkWin
->IsReallyVisible() && !pWorkWin
->IsReallyShown() ));
1149 SfxChild_Impl
*pCli
= 0;
1150 for ( USHORT nPos
= 0; nPos
< pChilds
->Count(); ++nPos
)
1152 SfxChildWin_Impl
* pCW
= 0;
1153 pCli
= (*pChilds
)[nPos
];
1155 if ( pCli
&& pCli
->pWin
)
1157 // We have to find the SfxChildWin_Impl to retrieve the
1158 // SFX_CHILDWIN flags that can influence visibility.
1159 for (USHORT n
=0; n
<pChildWins
->Count(); n
++)
1161 SfxChildWin_Impl
* pCWin
= (*pChildWins
)[n
];
1162 SfxChild_Impl
* pChild
= pCWin
->pCli
;
1163 if ( pChild
== pCli
)
1170 bool bVisible( !bInvisible
);
1173 // Check flag SFX_CHILDWIN_NEVERHIDE that forces us to show
1174 // the child window even in situations where no child window is
1176 sal_uInt16 nFlags
= pCW
->aInfo
.nFlags
;
1177 bVisible
= !bInvisible
|| ( bInvisible
& (( nFlags
& SFX_CHILDWIN_NEVERHIDE
) != 0 ));
1180 if ( CHILD_VISIBLE
== (pCli
->nVisible
& CHILD_VISIBLE
) && bVisible
)
1182 USHORT nFlags
= pCli
->bSetFocus
? 0 : SHOW_NOFOCUSCHANGE
| SHOW_NOACTIVATE
;
1183 switch ( pCli
->pWin
->GetType() )
1185 case RSC_DOCKINGWINDOW
:
1186 ((DockingWindow
*)pCli
->pWin
)->Show( TRUE
, nFlags
);
1188 case RSC_SPLITWINDOW
:
1189 ((SplitWindow
*)pCli
->pWin
)->Show( TRUE
, nFlags
);
1192 pCli
->pWin
->Show( TRUE
, nFlags
);
1196 pCli
->bSetFocus
= FALSE
;
1200 switch ( pCli
->pWin
->GetType() )
1202 case RSC_DOCKINGWINDOW
:
1203 ((DockingWindow
*)pCli
->pWin
)->Hide();
1214 //--------------------------------------------------------------------
1216 void SfxWorkWindow::HideChilds_Impl()
1218 SfxChild_Impl
*pChild
= 0;
1219 for ( USHORT nPos
= pChilds
->Count(); nPos
> 0; --nPos
)
1221 pChild
= (*pChilds
)[nPos
-1];
1222 if (pChild
&& pChild
->pWin
)
1224 switch ( pChild
->pWin
->GetType() )
1226 case RSC_DOCKINGWINDOW
:
1227 ((DockingWindow
*)pChild
->pWin
)->Hide();
1230 pChild
->pWin
->Hide();
1237 //------------------------------------------------------------------------
1239 void SfxWorkWindow::ResetObjectBars_Impl()
1242 for ( n
= 0; n
< aObjBarList
.size(); n
++ )
1243 aObjBarList
[n
].bDestroy
= sal_True
;
1245 for ( n
= 0; n
< pChildWins
->Count(); ++n
)
1246 (*pChildWins
)[n
]->nId
= 0;
1249 void SfxWorkWindow::NextObjectBar_Impl( USHORT
)
1253 USHORT
SfxWorkWindow::HasNextObjectBar_Impl( USHORT
, String
* )
1258 //------------------------------------------------------------------------
1260 void SfxWorkWindow::SetObjectBar_Impl( USHORT nPos
, sal_uInt32 nResId
,
1261 SfxInterface
* pIFace
, const String
*pName
)
1263 DBG_ASSERT( (nPos
& SFX_POSITION_MASK
) < SFX_OBJECTBAR_MAX
,
1264 "object bar position overflow" );
1266 USHORT nRealPos
= nPos
& SFX_POSITION_MASK
;
1267 if ( pParent
&& IsAppWorkWinToolbox_Impl( nRealPos
) )
1269 pParent
->SetObjectBar_Impl( nPos
, nResId
, pIFace
, pName
);
1273 SfxObjectBar_Impl aObjBar
;
1274 aObjBar
.pIFace
= pIFace
;
1275 aObjBar
.nId
= sal::static_int_cast
<USHORT
>(nResId
);
1276 aObjBar
.nPos
= nRealPos
;
1277 aObjBar
.nMode
= (nPos
& SFX_VISIBILITY_MASK
);
1279 aObjBar
.aName
= *pName
;
1281 aObjBar
.aName
.Erase();
1283 for ( USHORT n
=0; n
<aObjBarList
.size(); n
++ )
1285 if ( aObjBarList
[n
].nId
== aObjBar
.nId
)
1287 aObjBarList
[n
] = aObjBar
;
1292 aObjBarList
.push_back( aObjBar
);
1295 //------------------------------------------------------------------------
1297 FASTBOOL
SfxWorkWindow::KnowsObjectBar_Impl( USHORT nPos
) const
1301 Stellt fest, ob an der betreffenden Position "uberhaupt eine
1302 Objektleiste zur Verf"ugung stehen w"urde. Ist unabh"agig davon,
1303 ob diese tats"achlich ein- oder ausgeschaltet ist.
1307 USHORT nRealPos
= nPos
& SFX_POSITION_MASK
;
1308 if ( pParent
&& IsAppWorkWinToolbox_Impl( nRealPos
) )
1309 return pParent
->KnowsObjectBar_Impl( nPos
);
1311 for ( USHORT n
=0; n
<aObjBarList
.size(); n
++ )
1313 if ( aObjBarList
[n
].nPos
== nRealPos
)
1320 //------------------------------------------------------------------------
1322 BOOL
SfxWorkWindow::IsVisible_Impl( USHORT nMode
) const
1324 switch( nUpdateMode
)
1326 case SFX_VISIBILITY_STANDARD
:
1328 case SFX_VISIBILITY_UNVISIBLE
:
1330 case SFX_VISIBILITY_PLUGSERVER
:
1331 case SFX_VISIBILITY_PLUGCLIENT
:
1332 case SFX_VISIBILITY_CLIENT
:
1333 case SFX_VISIBILITY_SERVER
:
1334 return !!(nMode
& nUpdateMode
);
1336 return !!(nMode
& nOrigMode
) ||
1337 nOrigMode
== SFX_VISIBILITY_STANDARD
;
1341 Window
* SfxWorkWindow::GetObjectBar_Impl( USHORT
, sal_uInt32
)
1346 //------------------------------------------------------------------------
1347 void SfxFrameWorkWin_Impl::UpdateObjectBars_Impl()
1349 if ( pFrame
->IsClosing_Impl() )
1352 SfxWorkWindow
*pWork
= pParent
;
1355 pWork
->SfxWorkWindow::UpdateObjectBars_Impl();
1356 pWork
= pWork
->GetParent_Impl();
1359 SfxWorkWindow::UpdateObjectBars_Impl();
1361 // if ( pTask->IsActive() )
1366 pWork
->ArrangeChilds_Impl();
1367 pWork
= pWork
->GetParent_Impl();
1370 ArrangeChilds_Impl( FALSE
);
1375 pWork
->ShowChilds_Impl();
1376 pWork
= pWork
->GetParent_Impl();
1385 Reference
< ::com::sun::star::task::XStatusIndicator
> SfxWorkWindow::GetStatusIndicator()
1387 Reference
< com::sun::star::beans::XPropertySet
> xPropSet( GetFrameInterface(), UNO_QUERY
);
1388 Reference
< ::com::sun::star::frame::XLayoutManager
> xLayoutManager
;
1389 Reference
< com::sun::star::task::XStatusIndicator
> xStatusIndicator
;
1391 if ( xPropSet
.is() )
1393 Any aValue
= xPropSet
->getPropertyValue( m_aLayoutManagerPropName
);
1394 aValue
>>= xLayoutManager
;
1395 if ( xLayoutManager
.is() )
1397 xLayoutManager
->createElement( m_aProgressBarResName
);
1398 xLayoutManager
->showElement( m_aProgressBarResName
);
1400 Reference
< ::com::sun::star::ui::XUIElement
> xProgressBar
=
1401 xLayoutManager
->getElement( m_aProgressBarResName
);
1402 if ( xProgressBar
.is() )
1404 xStatusIndicator
= Reference
< ::com::sun::star::task::XStatusIndicator
>(
1405 xProgressBar
->getRealInterface(), UNO_QUERY
);
1410 return xStatusIndicator
;
1413 //------------------------------------------------------------------------
1415 sal_Bool
SfxWorkWindow::IsPluginMode( SfxObjectShell
* pObjShell
)
1417 if ( pObjShell
&& pObjShell
->GetMedium() )
1419 SFX_ITEMSET_ARG( pObjShell
->GetMedium()->GetItemSet(), pViewOnlyItem
, SfxBoolItem
, SID_VIEWONLY
, sal_False
);
1420 if ( pViewOnlyItem
&& pViewOnlyItem
->GetValue() )
1427 //------------------------------------------------------------------------
1429 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
> SfxWorkWindow::GetFrameInterface()
1431 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
> xFrame
;
1433 SfxDispatcher
* pDispatcher( GetBindings().GetDispatcher() );
1436 SfxViewFrame
* pFrame
= pDispatcher
->GetFrame();
1437 if ( pFrame
&& pFrame
->GetFrame() )
1438 xFrame
= pFrame
->GetFrame()->GetFrameInterface();
1444 //------------------------------------------------------------------------
1446 void SfxWorkWindow::UpdateObjectBars_Impl()
1448 // SplitWindows locken (d.h. Resize-Reaktion an den
1449 // DockingWindows unterdr"ucken)
1451 for ( n
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
1453 SfxSplitWindow
*p
= pSplit
[n
];
1454 if (p
->GetWindowCount())
1458 // was man so "ofters braucht, merkt man sich (spart Code und Laufzeit)
1461 Reference
< com::sun::star::beans::XPropertySet
> xPropSet( GetFrameInterface(), UNO_QUERY
);
1462 Reference
< ::com::sun::star::frame::XLayoutManager
> xLayoutManager
;
1464 if ( xPropSet
.is() )
1466 Any aValue
= xPropSet
->getPropertyValue( m_aLayoutManagerPropName
);
1467 aValue
>>= xLayoutManager
;
1470 if ( !xLayoutManager
.is() )
1473 sal_Bool
bPluginMode( sal_False
);
1474 SfxDispatcher
* pDispatcher( GetBindings().GetDispatcher() );
1478 SfxViewFrame
* pFrame
= pDispatcher
->GetFrame();
1480 bPluginMode
= IsPluginMode( pFrame
->GetObjectShell() );
1483 // "uber alle Toolboxen iterieren
1484 xLayoutManager
->lock();
1485 for ( n
= 0; n
< aObjBarList
.size(); ++n
)
1487 USHORT nId
= aObjBarList
[n
].nId
;
1488 sal_Bool bDestroy
= aObjBarList
[n
].bDestroy
;
1490 // die Modi bestimmen, f"ur die die ToolBox gilt
1491 USHORT nTbxMode
= aObjBarList
[n
].nMode
;
1492 FASTBOOL bFullScreenTbx
= SFX_VISIBILITY_FULLSCREEN
==
1493 ( nTbxMode
& SFX_VISIBILITY_FULLSCREEN
);
1494 nTbxMode
&= ~SFX_VISIBILITY_FULLSCREEN
;
1495 nTbxMode
&= ~SFX_VISIBILITY_VIEWER
;
1497 // wird in diesem Kontext eine ToolBox gefordert?
1498 FASTBOOL bModesMatching
= ( nUpdateMode
&& ( nTbxMode
& nUpdateMode
) == nUpdateMode
);
1501 rtl::OUString
aTbxId( m_aTbxTypeName
);
1502 aTbxId
+= GetResourceURLFromResId( aObjBarList
[n
].nId
);
1503 xLayoutManager
->destroyElement( aTbxId
);
1505 else if ( nId
!= 0 && ( ( bModesMatching
&& !bIsFullScreen
) ||
1506 ( bIsFullScreen
&& bFullScreenTbx
) ) )
1508 rtl::OUString
aTbxId( m_aTbxTypeName
);
1509 aTbxId
+= GetResourceURLFromResId( aObjBarList
[n
].nId
);
1510 if ( !IsDockingAllowed() && !xLayoutManager
->isElementFloating( aTbxId
))
1511 xLayoutManager
->destroyElement( aTbxId
);
1514 xLayoutManager
->requestElement( aTbxId
);
1516 xLayoutManager
->lockWindow( aTbxId
);
1519 else if ( nId
!= 0 )
1521 // ggf. Toolbox an dieser Position l"oschen
1522 rtl::OUString
aTbxId( m_aTbxTypeName
);
1523 aTbxId
+= GetResourceURLFromResId( aObjBarList
[n
].nId
);
1524 xLayoutManager
->destroyElement( aTbxId
);
1528 UpdateStatusBar_Impl();
1530 // unlocking automatically forces Layout
1531 xLayoutManager
->unlock();
1533 UpdateChildWindows_Impl();
1535 // SplitWindows wieder ent-locken
1536 for ( n
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
1538 SfxSplitWindow
*p
= pSplit
[n
];
1539 if (p
->GetWindowCount())
1544 void SfxWorkWindow::UpdateChildWindows_Impl()
1546 // alle vorhandenen oder in den Kontext gekommenen ChildWindows
1547 for ( USHORT n
=0; n
<pChildWins
->Count(); n
++ )
1549 SfxChildWin_Impl
*pCW
= (*pChildWins
)[n
];
1550 SfxChildWindow
*pChildWin
= pCW
->pWin
;
1551 BOOL bCreate
= FALSE
;
1552 if ( pCW
->nId
&& !pCW
->bDisabled
&& (pCW
->aInfo
.nFlags
& SFX_CHILDWIN_ALWAYSAVAILABLE
|| IsVisible_Impl( pCW
->nVisibility
) ) )
1554 // Im Kontext ist ein geeignetes ChildWindow erlaubt;
1555 // ist es auch eingeschaltet ?
1556 if ( pChildWin
== 0 && pCW
->bCreate
)
1558 // Internal docking is only used for embedding into another
1559 // container. We force the floating state of all floatable
1561 if ( !bInternalDockingAllowed
)
1563 // Special case for all non-floatable child windows. We have
1564 // to prevent the creation here!
1565 bCreate
= !( pCW
->aInfo
.nFlags
& SFX_CHILDWIN_FORCEDOCK
);
1567 else if ( !IsDockingAllowed() || bIsFullScreen
) // || !bInternalDocking )
1569 // im PresentationMode oder FullScreen nur FloatingWindows
1570 SfxChildAlignment eAlign
;
1571 if ( pCW
->aInfo
.GetExtraData_Impl( &eAlign
) )
1572 bCreate
= ( eAlign
== SFX_ALIGN_NOALIGNMENT
);
1577 // Momentan kein Fenster da, aber es ist eingeschaltet; Fenster
1578 // und ggf. Context erzeugen
1580 CreateChildWin_Impl( pCW
, FALSE
);
1582 if ( !bAllChildsVisible
)
1585 pCW
->pCli
->nVisible
&= ~CHILD_ACTIVE
;
1588 else if ( pChildWin
)
1590 // Fenster existiert schon; soll es auch sichtbar sein ?
1591 if ( ( !bIsFullScreen
|| pChildWin
->GetAlignment() == SFX_ALIGN_NOALIGNMENT
) && bAllChildsVisible
)
1593 // Updatemode ist kompatibel; auf jeden Fall wieder einschalten
1597 // Fenster ist direktes Child
1598 if ( bAllChildsVisible
&& ( (IsDockingAllowed() && bInternalDockingAllowed
) || pCW
->pCli
->eAlign
== SFX_ALIGN_NOALIGNMENT
) )
1599 pCW
->pCli
->nVisible
|= CHILD_NOT_HIDDEN
;
1601 else if ( pCW
->bCreate
&& IsDockingAllowed() && bInternalDockingAllowed
)
1602 // Fenster liegt in einem SplitWindow
1603 ((SfxDockingWindow
*)pChildWin
->GetWindow())->Reappear_Impl();
1605 if ( pCW
->nInterfaceId
!= pChildWin
->GetContextId() )
1606 pChildWin
->CreateContext( pCW
->nInterfaceId
, GetBindings() );
1611 if ( pChildWin
&& !bCreate
)
1613 if ( !pChildWin
->QueryClose() || pChildWin
->IsHideNotDelete() || Application::IsUICaptured() )
1617 if ( pCW
->pCli
->nVisible
& CHILD_NOT_HIDDEN
)
1618 pCW
->pCli
->nVisible
^= CHILD_NOT_HIDDEN
;
1621 ((SfxDockingWindow
*)pChildWin
->GetWindow())->Disappear_Impl();
1624 RemoveChildWin_Impl( pCW
);
1629 void SfxWorkWindow::CreateChildWin_Impl( SfxChildWin_Impl
*pCW
, BOOL bSetFocus
)
1631 if ( pCW
->aInfo
.bVisible
!= 42 )
1632 pCW
->aInfo
.bVisible
= TRUE
;
1634 SfxChildWindow
*pChildWin
= SfxChildWindow::CreateChildWindow( pCW
->nId
, pWorkWin
, &GetBindings(), pCW
->aInfo
);
1638 bSetFocus
= pChildWin
->WantsFocus();
1639 pChildWin
->SetWorkWindow_Impl( this );
1641 // Enable-Status richtig setzen
1642 pChildWin
->GetWindow()->EnableInput( pCW
->bEnable
&&
1643 ( pWorkWin
->IsInputEnabled() /* || pChildWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT */ ) );
1645 // Zumindest der ExtraString wird beim Auswerten ver"andert, also neu holen
1646 SfxChildWinInfo aInfo
= pChildWin
->GetInfo();
1647 pCW
->aInfo
.aExtraString
= aInfo
.aExtraString
;
1648 pCW
->aInfo
.bVisible
= aInfo
.bVisible
;
1649 pCW
->aInfo
.nFlags
|= aInfo
.nFlags
;
1651 // Nein !! Sonst kann man keine Fenster defaultmaessig ausschalten ( Partwindow! )
1652 // pCW->aInfo.bVisible = TRUE;
1654 // Erzeugung war erfolgreich
1655 GetBindings().Invalidate(pCW
->nId
);
1657 USHORT nPos
= pChildWin
->GetPosition();
1658 if (nPos
!= CHILDWIN_NOPOS
)
1660 DBG_ASSERT(nPos
< SFX_OBJECTBAR_MAX
, "Illegal objectbar position!");
1661 if ((*pChilds
)[TbxMatch(nPos
)])// &&
1662 // pChildWin->GetAlignment() == (*pChilds)[nPos]->eAlign )
1664 // ChildWindow ersetzt ObjectBar
1665 (*pChilds
)[TbxMatch(nPos
)]->nVisible
^= CHILD_NOT_HIDDEN
;
1669 // make childwin keyboard accessible
1670 pWorkWin
->GetSystemWindow()->GetTaskPaneList()->AddWindow( pChildWin
->GetWindow() );
1672 pCW
->pWin
= pChildWin
;
1674 if ( pChildWin
->GetAlignment() == SFX_ALIGN_NOALIGNMENT
|| pChildWin
->GetWindow()->GetParent() == pWorkWin
)
1676 // Das Fenster ist entweder nicht angedockt oder au\serhalb
1677 // eines SplitWindows angedockt und mu\s daher explizit als
1678 // Child registriert werden
1679 pCW
->pCli
= RegisterChild_Impl(*(pChildWin
->GetWindow()), pChildWin
->GetAlignment(), pChildWin
->CanGetFocus());
1680 pCW
->pCli
->nVisible
= CHILD_VISIBLE
;
1681 if ( pChildWin
->GetAlignment() != SFX_ALIGN_NOALIGNMENT
&& bIsFullScreen
)
1682 pCW
->pCli
->nVisible
^= CHILD_ACTIVE
;
1683 pCW
->pCli
->bSetFocus
= bSetFocus
;
1687 // Ein angedocktes Fenster, dessen Parent nicht das WorkWindow ist,
1688 // mu\s in einem SplitWindow liegen und daher nicht explizit
1689 // registriert werden.
1690 // Das passiert aber schon bei der Initialisierung des
1691 // SfxDockingWindows!
1694 if ( pCW
->nInterfaceId
!= pChildWin
->GetContextId() )
1695 pChildWin
->CreateContext( pCW
->nInterfaceId
, GetBindings() );
1697 // Information in der INI-Datei sichern
1698 SaveStatus_Impl(pChildWin
, pCW
->aInfo
);
1702 void SfxWorkWindow::RemoveChildWin_Impl( SfxChildWin_Impl
*pCW
)
1704 USHORT nId
= pCW
->nSaveId
;
1705 SfxChildWindow
*pChildWin
= pCW
->pWin
;
1707 // vorhandenes Fenster geht aus dem Kontext und wird daher entfernt
1708 USHORT nPos
= pChildWin
->GetPosition();
1709 if (nPos
!= CHILDWIN_NOPOS
)
1712 // ChildWindow "uberlagert einen ObjectBar
1713 DBG_ASSERT(nPos < SFX_OBJECTBAR_MAX, "Illegal objectbar position!");
1714 if ((*pChilds)[TbxMatch(nPos)] &&
1715 (aObjBars[nPos].nMode & nUpdateMode) ) //&&
1716 // pChildWin->GetAlignment() == (*pChilds)[nPos]->eAlign )
1718 // ObjectBar war "uberlagert; jetzt wieder anzeigen
1719 (*pChilds)[TbxMatch(nPos)]->nVisible ^= CHILD_NOT_HIDDEN;
1724 // Information in der INI-Datei sichern
1725 USHORT nFlags
= pCW
->aInfo
.nFlags
;
1726 pCW
->aInfo
= pChildWin
->GetInfo();
1727 pCW
->aInfo
.nFlags
|= nFlags
;
1728 SaveStatus_Impl(pChildWin
, pCW
->aInfo
);
1734 // ChildWindow ist ein direktes ChildWindow und mu\s sich daher
1735 // beim WorkWindow abmelden
1737 ReleaseChild_Impl(*pChildWin
->GetWindow());
1741 // ChildWindow liegt in einem SplitWindow und meldet sich
1742 // selbst im dtor dort ab
1745 pWorkWin
->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( pChildWin
->GetWindow() );
1747 pChildWin
->Destroy();
1749 GetBindings().Invalidate( nId
);
1752 void SfxWorkWindow::ResetStatusBar_Impl()
1757 //--------------------------------------------------------------------
1758 void SfxWorkWindow::SetStatusBar_Impl( sal_uInt32 nResId
, SfxShell
*, SfxBindings
& )
1760 if ( nResId
&& bShowStatusBar
&& IsVisible_Impl() )
1761 aStatBar
.nId
= sal::static_int_cast
<USHORT
>(nResId
);
1764 #define SFX_ITEMTYPE_STATBAR 4
1766 void SfxWorkWindow::SetTempStatusBar_Impl( BOOL bSet
)
1768 if ( aStatBar
.bTemp
!= bSet
&& bShowStatusBar
&& IsVisible_Impl() )
1771 BOOL bReset
= FALSE
;
1772 if ( bSet
&& !aStatBar
.nId
)
1775 SetStatusBar_Impl( SFX_ITEMTYPE_STATBAR
, SFX_APP(), GetBindings() );
1778 if ( aStatBar
.nId
&& aStatBar
.bOn
&& !bIsFullScreen
)
1781 aStatBar
.bTemp
= bSet
;
1782 if ( !bOn
|| bReset
|| (!bSet
&& aStatBar
.nId
) )
1784 // Nur was tun, wenn die Temp-Einstellung wirklich was bewirkt
1785 UpdateStatusBar_Impl();
1786 ArrangeChilds_Impl();
1791 ResetStatusBar_Impl();
1795 void SfxWorkWindow::UpdateStatusBar_Impl()
1797 Reference
< ::com::sun::star::beans::XPropertySet
> xPropSet( GetFrameInterface(), UNO_QUERY
);
1798 Reference
< ::com::sun::star::frame::XLayoutManager
> xLayoutManager
;
1800 Any aValue
= xPropSet
->getPropertyValue( m_aLayoutManagerPropName
);
1801 aValue
>>= xLayoutManager
;
1803 // keine Statusleiste, wenn keine Id gew"unscht oder bei FullScreenView
1804 // oder wenn ausgeschaltet
1805 if ( aStatBar
.nId
&& IsDockingAllowed() && bInternalDockingAllowed
&& bShowStatusBar
&&
1806 ( (aStatBar
.bOn
&& !bIsFullScreen
) || aStatBar
.bTemp
) )
1808 // Id hat sich ge"andert, also passenden Statusbarmanager erzeugen,
1809 // dieser "ubernimmt die aktuelle Statusleiste;
1810 if ( xLayoutManager
.is() )
1811 xLayoutManager
->requestElement( m_aStatusBarResName
);
1815 // Aktuelle StatusBar vernichten
1816 // Der Manager erzeugt die Statusleiste nur, er zerst"ort sie
1818 if ( xLayoutManager
.is() )
1819 xLayoutManager
->destroyElement( m_aStatusBarResName
);
1823 //------------------------------------------------------------------------
1825 void SfxWorkWindow::SetObjectBarVisibility_Impl( USHORT nMask )
1829 case SFX_VISIBILITY_UNVISIBLE:
1830 case SFX_VISIBILITY_STANDARD:
1831 case SFX_VISIBILITY_CLIENT:
1832 case SFX_VISIBILITY_SERVER:
1835 if (nMask != nUpdateMode)
1836 nUpdateMode = nMask;
1839 void SfxWorkWindow::MakeVisible_Impl( BOOL bVis
)
1842 nOrigMode
= SFX_VISIBILITY_STANDARD
;
1844 nOrigMode
= SFX_VISIBILITY_UNVISIBLE
;
1846 if ( nOrigMode
!= nUpdateMode
)
1847 nUpdateMode
= nOrigMode
;
1850 BOOL
SfxWorkWindow::IsVisible_Impl()
1852 return nOrigMode
!= SFX_VISIBILITY_UNVISIBLE
;
1855 //------------------------------------------------------------------------
1856 void SfxWorkWindow::HidePopups_Impl(BOOL bHide
, BOOL bParent
, USHORT nId
)
1858 for ( USHORT n
= 0; n
< pChildWins
->Count(); ++n
)
1860 SfxChildWindow
*pCW
= (*pChildWins
)[n
]->pWin
;
1861 if (pCW
&& pCW
->GetAlignment() == SFX_ALIGN_NOALIGNMENT
&& pCW
->GetType() != nId
)
1863 Window
*pWin
= pCW
->GetWindow();
1864 SfxChild_Impl
*pChild
= FindChild_Impl(*pWin
);
1867 pChild
->nVisible
&= ~CHILD_ACTIVE
;
1872 pChild
->nVisible
|= CHILD_ACTIVE
;
1873 if ( CHILD_VISIBLE
== (pChild
->nVisible
& CHILD_VISIBLE
) )
1874 pCW
->Show( SHOW_NOFOCUSCHANGE
| SHOW_NOACTIVATE
);
1879 if ( bParent
&& pParent
)
1880 pParent
->HidePopups_Impl( bHide
, bParent
, nId
);
1883 //------------------------------------------------------------------------
1885 void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild
,
1886 SfxDockingConfig eConfig
, USHORT nId
)
1888 SfxDockingWindow
* pDockWin
=0;
1889 USHORT nPos
= USHRT_MAX
;
1891 SfxChildWin_Impl
*pCW
= 0;
1893 if ( eChild
== SFX_CHILDWIN_OBJECTBAR
)
1899 // configure direct childwindow
1900 for (USHORT n
=0; n
<pChildWins
->Count(); n
++)
1902 pCW
= (*pChildWins
)[n
];
1903 SfxChildWindow
*pChild
= pCW
->pWin
;
1906 if ( pChild
->GetType() == nId
)
1908 if ( pChild
->GetWindow()->GetType() == RSC_DOCKINGWINDOW
)
1909 // it's a DockingWindow
1910 pDockWin
= (SfxDockingWindow
*) pChild
->GetWindow();
1912 // FloatingWindow or ModelessDialog
1913 pWin
= pChild
->GetWindow();
1921 if ( eChild
== SFX_CHILDWIN_DOCKINGWINDOW
|| pDockWin
->GetAlignment() == SFX_ALIGN_NOALIGNMENT
)
1923 if ( eChild
== SFX_CHILDWIN_SPLITWINDOW
&& eConfig
== SFX_TOGGLEFLOATMODE
)
1925 // DockingWindow was dragged out of a SplitWindow
1926 pCW
->pCli
= RegisterChild_Impl(*pDockWin
, pDockWin
->GetAlignment(), pCW
->pWin
->CanGetFocus());
1927 pCW
->pCli
->nVisible
= CHILD_VISIBLE
;
1934 SfxSplitWindow
*pSplitWin
= GetSplitWindow_Impl(pDockWin
->GetAlignment());
1936 // configure DockingWindow inside a SplitWindow
1937 if ( eConfig
== SFX_TOGGLEFLOATMODE
)
1939 // DockingWindow was dragged into a SplitWindow
1941 ReleaseChild_Impl(*pDockWin
);
1944 pWin
= pSplitWin
->GetSplitWindow();
1945 if ( pSplitWin
->GetWindowCount() == 1 )
1946 ((SplitWindow
*)pWin
)->Show( TRUE
, SHOW_NOFOCUSCHANGE
| SHOW_NOACTIVATE
);
1950 DBG_ASSERT( pCW
, "Unknown window!" );
1951 if ( !pCW
&& pParent
)
1953 pParent
->ConfigChild_Impl( eChild
, eConfig
, nId
);
1959 // windows may have been registered and released without an update until now
1962 SfxChild_Impl
*pChild
= 0;
1964 for ( n
=0; n
<aSortedList
.Count(); ++n
)
1966 pChild
= (*pChilds
)[aSortedList
[n
]];
1968 if ( pChild
->pWin
== pWin
)
1972 if ( n
< aSortedList
.Count() )
1973 // sometimes called while toggeling float mode
1974 nPos
= aSortedList
[n
];
1978 case SFX_SETDOCKINGRECTS
:
1980 if ( nPos
== USHRT_MAX
)
1983 // SfxChild_Impl *pChild = (*pChilds)[nPos];
1984 Rectangle
aOuterRect( GetTopRect_Impl() );
1985 aOuterRect
.SetPos( pWorkWin
->OutputToScreenPixel( aOuterRect
.TopLeft() ));
1986 Rectangle
aInnerRect( aOuterRect
);
1987 BOOL bTbx
= (eChild
== SFX_CHILDWIN_OBJECTBAR
);
1989 // Das gerade betroffene Fenster wird bei der Berechnung des
1990 // inneren Rechtecks mit eingeschlossen!
1991 for ( USHORT m
=0; m
<aSortedList
.Count(); ++m
)
1993 USHORT i
=aSortedList
[m
];
1994 SfxChild_Impl
* pCli
= (*pChilds
)[i
];
1996 if ( pCli
&& pCli
->nVisible
== CHILD_VISIBLE
&& pCli
->pWin
)
1998 switch ( pCli
->eAlign
)
2001 // Objekt-Toolboxen kommen immer zuletzt
2002 //if ( bTbx || i <= nPos)
2003 aInnerRect
.Top() += pCli
->aSize
.Height();
2006 case SFX_ALIGN_TOOLBOXTOP
:
2007 // Toolbox geht nur vor, wenn nicht h"ohere Position
2008 if ( bTbx
&& i
<= nPos
)
2009 aInnerRect
.Top() += pCli
->aSize
.Height();
2012 case SFX_ALIGN_HIGHESTTOP
:
2014 aInnerRect
.Top() += pCli
->aSize
.Height();
2017 case SFX_ALIGN_LOWESTTOP
:
2018 // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist
2020 aInnerRect
.Top() += pCli
->aSize
.Height();
2023 case SFX_ALIGN_BOTTOM
:
2024 // Objekt-Toolboxen kommen immer zuletzt
2025 //if ( bTbx || i <= nPos)
2026 aInnerRect
.Bottom() -= pCli
->aSize
.Height();
2029 case SFX_ALIGN_TOOLBOXBOTTOM
:
2030 // Toolbox geht nur vor, wenn nicht h"ohere Position
2031 if ( bTbx
&& i
<= nPos
)
2032 aInnerRect
.Bottom() -= pCli
->aSize
.Height();
2035 case SFX_ALIGN_LOWESTBOTTOM
:
2037 aInnerRect
.Bottom() -= pCli
->aSize
.Height();
2040 case SFX_ALIGN_HIGHESTBOTTOM
:
2041 // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist
2043 aInnerRect
.Bottom() -= pCli
->aSize
.Height();
2046 case SFX_ALIGN_LEFT
:
2047 // Toolboxen kommen immer zuletzt
2048 //if (bTbx || i <= nPos)
2049 aInnerRect
.Left() += pCli
->aSize
.Width();
2052 case SFX_ALIGN_TOOLBOXLEFT
:
2053 // Toolboxen kommen immer zuletzt
2054 if (bTbx
&& i
<= nPos
)
2055 aInnerRect
.Left() += pCli
->aSize
.Width();
2058 case SFX_ALIGN_FIRSTLEFT
:
2060 aInnerRect
.Left() += pCli
->aSize
.Width();
2063 case SFX_ALIGN_LASTLEFT
:
2064 // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist
2066 aInnerRect
.Left() += pCli
->aSize
.Width();
2068 case SFX_ALIGN_RIGHT
:
2069 // Toolboxen kommen immer zuletzt
2070 //if (bTbx || i <= nPos)
2071 aInnerRect
.Right() -= pCli
->aSize
.Width();
2074 case SFX_ALIGN_TOOLBOXRIGHT
:
2075 // Toolboxen kommen immer zuletzt
2076 if (bTbx
&& i
<= nPos
)
2077 aInnerRect
.Right() -= pCli
->aSize
.Width();
2080 case SFX_ALIGN_FIRSTRIGHT
:
2081 // Wird nur mitgez"ahlt, wenn es das aktuelle Fenster ist
2083 aInnerRect
.Right() -= pCli
->aSize
.Width();
2086 case SFX_ALIGN_LASTRIGHT
:
2088 aInnerRect
.Right() -= pCli
->aSize
.Width();
2097 pDockWin
->SetDockingRects(aOuterRect
, aInnerRect
);
2101 case SFX_MOVEDOCKINGWINDOW
:
2102 case SFX_ALIGNDOCKINGWINDOW
:
2103 case SFX_TOGGLEFLOATMODE
:
2105 if ( nPos
== USHRT_MAX
&& !pCW
)
2108 SfxChildAlignment eAlign
= SFX_ALIGN_NOALIGNMENT
;
2109 SfxChild_Impl
*pCli
= ( nPos
!= USHRT_MAX
) ? (*pChilds
)[nPos
] : 0;
2110 if ( pCli
&& pDockWin
)
2112 eAlign
= pDockWin
->GetAlignment();
2113 if ( eChild
== SFX_CHILDWIN_DOCKINGWINDOW
|| eAlign
== SFX_ALIGN_NOALIGNMENT
)
2115 // configuration inside the SplitWindow, no change for the SplitWindows' configuration
2116 pCli
->bResize
= TRUE
;
2117 pCli
->aSize
= pDockWin
->GetSizePixel();
2123 if( pCli
->eAlign
!= eAlign
)
2126 pCli
->eAlign
= eAlign
;
2129 ArrangeChilds_Impl();
2133 if ( pCW
&& pCW
->pWin
)
2135 // store changed configuration
2136 USHORT nFlags
= pCW
->aInfo
.nFlags
;
2137 pCW
->aInfo
= pCW
->pWin
->GetInfo();
2138 pCW
->aInfo
.nFlags
|= nFlags
;
2139 if ( eConfig
!= SFX_MOVEDOCKINGWINDOW
)
2140 SaveStatus_Impl( pCW
->pWin
, pCW
->aInfo
);
2149 //--------------------------------------------------------------------
2151 void SfxWorkWindow::SetChildWindowVisible_Impl( sal_uInt32 lId
, BOOL bEnabled
, USHORT nMode
)
2153 USHORT nInter
= (USHORT
) ( lId
>> 16 );
2154 USHORT nId
= (USHORT
) ( lId
& 0xFFFF );
2156 SfxChildWin_Impl
*pCW
=NULL
;
2157 SfxWorkWindow
*pWork
= pParent
;
2159 // Den obersten parent nehmen; ChildWindows werden immer am WorkWindow
2160 // der Task bzw. des Frames oder am AppWorkWindow angemeldet
2161 while ( pWork
&& pWork
->pParent
)
2162 pWork
= pWork
->pParent
;
2166 // Dem Parent schon bekannt ?
2167 USHORT nCount
= pWork
->pChildWins
->Count();
2168 for (USHORT n
=0; n
<nCount
; n
++)
2169 if ((*pWork
->pChildWins
)[n
]->nSaveId
== nId
)
2171 pCW
= (*pWork
->pChildWins
)[n
];
2178 // Kein Parent oder dem Parent noch unbekannt, dann bei mir suchen
2179 USHORT nCount
= pChildWins
->Count();
2180 for (USHORT n
=0; n
<nCount
; n
++)
2181 if ((*pChildWins
)[n
]->nSaveId
== nId
)
2183 pCW
= (*pChildWins
)[n
];
2190 // Ist neu, also initialisieren; je nach Flag beim Parent oder bei
2192 pCW
= new SfxChildWin_Impl( lId
);
2194 InitializeChild_Impl( pCW
);
2195 if ( pWork
&& !( pCW
->aInfo
.nFlags
& SFX_CHILDWIN_TASK
) )
2196 pWork
->pChildWins
->Insert( pWork
->pChildWins
->Count(), pCW
);
2198 pChildWins
->Insert( pChildWins
->Count(), pCW
);
2203 pCW
->nInterfaceId
= nInter
;
2204 pCW
->nVisibility
= nMode
;
2205 pCW
->bEnable
= bEnabled
;
2208 pCW
->pWin
->GetWindow()->EnableInput( bEnabled
&&
2209 ( pWorkWin
->IsInputEnabled() /* || pCW->pWin->GetAlignment() == SFX_ALIGN_NOALIGNMENT */ ) );
2211 pCW
->nVisibility
= nMode
;
2214 //--------------------------------------------------------------------
2215 // Der An/Aus-Status eines ChildWindows wird umgeschaltet.
2217 void SfxWorkWindow::ToggleChildWindow_Impl(USHORT nId
, BOOL bSetFocus
)
2219 USHORT nCount
= pChildWins
->Count();
2221 for (n
=0; n
<nCount
; n
++)
2222 if ((*pChildWins
)[n
]->nId
== nId
)
2227 // Das Fenster ist schon bekannt
2228 SfxChildWin_Impl
*pCW
= (*pChildWins
)[n
];
2229 SfxChildWindow
*pChild
= pCW
->pWin
;
2231 bool bCreationAllowed( sal_True
);
2232 if ( !bInternalDockingAllowed
)
2234 // Special case for all non-floatable child windows. We have
2235 // to prevent the creation here!
2236 bCreationAllowed
= !( pCW
->aInfo
.nFlags
& SFX_CHILDWIN_FORCEDOCK
);
2239 if ( pChild
&& pCW
->bCreate
&& bCreationAllowed
)
2241 if ( pChild
->QueryClose() )
2243 if ( pChild
&& pChild
->IsHideAtToggle() )
2245 pCW
->bCreate
= !pCW
->bCreate
;
2246 ShowChildWindow_Impl( nId
, pCW
->bCreate
, bSetFocus
);
2250 // Fenster soll ausgeschaltet werdem
2251 pCW
->bCreate
= FALSE
;
2252 pChild
->SetVisible_Impl( FALSE
);
2253 RemoveChildWin_Impl( pCW
);
2257 else if ( pCW
->bCreate
&& bCreationAllowed
)
2259 pCW
->bCreate
= FALSE
;
2261 else if ( bCreationAllowed
)
2263 pCW
->bCreate
= TRUE
;
2267 ShowChildWindow_Impl( nId
, pCW
->bCreate
, bSetFocus
);
2272 CreateChildWin_Impl( pCW
, bSetFocus
);
2274 // Erzeugung war erfolglos
2275 pCW
->bCreate
= FALSE
;
2279 ArrangeChilds_Impl();
2282 if ( pCW
->bCreate
&& bCreationAllowed
)
2286 SfxDockingWindow
*pDock
=
2287 (SfxDockingWindow
*) pCW
->pWin
->GetWindow();
2288 if ( pDock
->IsAutoHide_Impl() )
2289 pDock
->AutoShow_Impl();
2297 pParent
->ToggleChildWindow_Impl( nId
, bSetFocus
);
2302 nCount
= pChildWins
->Count();
2303 for (n
=0; n
<nCount
; n
++)
2304 if ((*pChildWins
)[n
]->nSaveId
== nId
)
2309 DBG_ERROR("ChildWindow ist nicht im Kontext!");
2313 DBG_ERROR("ChildWindow ist nicht registriert!");
2318 //--------------------------------------------------------------------
2320 BOOL
SfxWorkWindow::HasChildWindow_Impl(USHORT nId
)
2322 USHORT nCount
= pChildWins
->Count();
2324 for (n
=0; n
<nCount
; n
++)
2325 if ((*pChildWins
)[n
]->nSaveId
== nId
)
2330 SfxChildWin_Impl
*pCW
= (*pChildWins
)[n
];
2331 SfxChildWindow
*pChild
= pCW
->pWin
;
2332 return ( pChild
&& pCW
->bCreate
);
2336 return pParent
->HasChildWindow_Impl( nId
);
2341 BOOL
SfxWorkWindow::IsFloating( USHORT nId
)
2343 SfxChildWin_Impl
*pCW
=NULL
;
2344 SfxWorkWindow
*pWork
= pParent
;
2346 // Den obersten parent nehmen; ChildWindows werden immer am WorkWindow
2347 // der Task bzw. des Frames oder am AppWorkWindow angemeldet
2348 while ( pWork
&& pWork
->pParent
)
2349 pWork
= pWork
->pParent
;
2353 // Dem Parent schon bekannt ?
2354 USHORT nCount
= pWork
->pChildWins
->Count();
2355 for (USHORT n
=0; n
<nCount
; n
++)
2356 if ((*pWork
->pChildWins
)[n
]->nSaveId
== nId
)
2358 pCW
= (*pWork
->pChildWins
)[n
];
2365 // Kein Parent oder dem Parent noch unbekannt, dann bei mir suchen
2366 USHORT nCount
= pChildWins
->Count();
2367 for (USHORT n
=0; n
<nCount
; n
++)
2368 if ((*pChildWins
)[n
]->nSaveId
== nId
)
2370 pCW
= (*pChildWins
)[n
];
2377 // Ist neu, also initialisieren; je nach Flag beim Parent oder bei
2379 pCW
= new SfxChildWin_Impl( nId
);
2380 pCW
->bEnable
= FALSE
;
2382 pCW
->nVisibility
= 0;
2383 InitializeChild_Impl( pCW
);
2384 if ( pWork
&& !( pCW
->aInfo
.nFlags
& SFX_CHILDWIN_TASK
) )
2385 pWork
->pChildWins
->Insert( pWork
->pChildWins
->Count(), pCW
);
2387 pChildWins
->Insert( pChildWins
->Count(), pCW
);
2390 SfxChildAlignment eAlign
;
2391 if ( pCW
->aInfo
.GetExtraData_Impl( &eAlign
) )
2392 return( eAlign
== SFX_ALIGN_NOALIGNMENT
);
2397 //--------------------------------------------------------------------
2399 BOOL
SfxWorkWindow::KnowsChildWindow_Impl(USHORT nId
)
2401 SfxChildWin_Impl
*pCW
=0;
2402 USHORT nCount
= pChildWins
->Count();
2404 for (n
=0; n
<nCount
; n
++)
2406 pCW
= (*pChildWins
)[n
];
2407 if ( pCW
->nSaveId
== nId
)
2413 if ( !(pCW
->aInfo
.nFlags
& SFX_CHILDWIN_ALWAYSAVAILABLE
) && !IsVisible_Impl( pCW
->nVisibility
) )
2415 return pCW
->bEnable
;
2418 return pParent
->KnowsChildWindow_Impl( nId
);
2423 //--------------------------------------------------------------------
2425 void SfxWorkWindow::SetChildWindow_Impl(USHORT nId
, BOOL bOn
, BOOL bSetFocus
)
2427 SfxChildWin_Impl
*pCW
=NULL
;
2428 SfxWorkWindow
*pWork
= pParent
;
2430 // Den obersten parent nehmen; ChildWindows werden immer am WorkWindow
2431 // der Task bzw. des Frames oder am AppWorkWindow angemeldet
2432 while ( pWork
&& pWork
->pParent
)
2433 pWork
= pWork
->pParent
;
2437 // Dem Parent schon bekannt ?
2438 USHORT nCount
= pWork
->pChildWins
->Count();
2439 for (USHORT n
=0; n
<nCount
; n
++)
2440 if ((*pWork
->pChildWins
)[n
]->nSaveId
== nId
)
2442 pCW
= (*pWork
->pChildWins
)[n
];
2449 // Kein Parent oder dem Parent noch unbekannt, dann bei mir suchen
2450 USHORT nCount
= pChildWins
->Count();
2451 for (USHORT n
=0; n
<nCount
; n
++)
2452 if ((*pChildWins
)[n
]->nSaveId
== nId
)
2454 pCW
= (*pChildWins
)[n
];
2462 // Ist neu, also initialisieren; je nach Flag beim Parent oder bei
2464 pCW
= new SfxChildWin_Impl( nId
);
2465 InitializeChild_Impl( pCW
);
2466 if ( !pWork
|| pCW
->aInfo
.nFlags
& SFX_CHILDWIN_TASK
)
2468 pWork
->pChildWins
->Insert( pWork
->pChildWins
->Count(), pCW
);
2471 if ( pCW
->bCreate
!= bOn
)
2472 pWork
->ToggleChildWindow_Impl(nId
,bSetFocus
);
2475 //--------------------------------------------------------------------
2477 void SfxWorkWindow::ShowChildWindow_Impl(USHORT nId
, BOOL bVisible
, BOOL bSetFocus
)
2479 USHORT nCount
= pChildWins
->Count();
2480 SfxChildWin_Impl
* pCW
=0;
2482 for (n
=0; n
<nCount
; n
++)
2484 pCW
= (*pChildWins
)[n
];
2485 if (pCW
->nId
== nId
)
2491 SfxChildWindow
*pChildWin
= pCW
->pWin
;
2494 // pCW->bCreate = bVisible;
2499 pCW
->pCli
->bSetFocus
= bSetFocus
;
2500 pCW
->pCli
->nVisible
= CHILD_VISIBLE
;
2501 pChildWin
->Show( bSetFocus
&& pChildWin
->WantsFocus() ? 0 : SHOW_NOFOCUSCHANGE
| SHOW_NOACTIVATE
);
2504 ((SfxDockingWindow
*)pChildWin
->GetWindow())->Reappear_Impl();
2511 pCW
->pCli
->nVisible
= CHILD_VISIBLE
^ CHILD_NOT_HIDDEN
;
2515 ((SfxDockingWindow
*)pChildWin
->GetWindow())->Disappear_Impl();
2519 ArrangeChilds_Impl();
2522 else if ( bVisible
)
2524 SetChildWindow_Impl( nId
, TRUE
, bSetFocus
);
2525 pChildWin
= pCW
->pWin
;
2530 pChildWin
->SetVisible_Impl( bVisible
);
2531 USHORT nFlags
= pCW
->aInfo
.nFlags
;
2532 pCW
->aInfo
= pChildWin
->GetInfo();
2533 pCW
->aInfo
.nFlags
|= nFlags
;
2534 if ( !pCW
->bCreate
)
2535 SaveStatus_Impl( pChildWin
, pCW
->aInfo
);
2543 pParent
->ShowChildWindow_Impl( nId
, bVisible
, bSetFocus
);
2548 nCount
= pChildWins
->Count();
2549 for (n
=0; n
<nCount
; n
++)
2550 if ((*pChildWins
)[n
]->nSaveId
== nId
)
2555 DBG_ERROR("ChildWindow ist nicht im Kontext!");
2559 DBG_ERROR("ChildWindow ist nicht registriert!");
2564 //--------------------------------------------------------------------
2566 SfxChildWindow
* SfxWorkWindow::GetChildWindow_Impl(USHORT nId
)
2568 USHORT nCount
= pChildWins
->Count();
2570 for (n
=0; n
<nCount
; n
++)
2571 if ((*pChildWins
)[n
]->nSaveId
== nId
)
2575 return (*pChildWins
)[n
]->pWin
;
2577 return pParent
->GetChildWindow_Impl( nId
);
2581 //------------------------------------------------------------------------
2583 void SfxWorkWindow::ResetChildWindows_Impl()
2586 // pParent->ResetChildWindows_Impl();
2588 for ( USHORT n
= 0; n
< pChildWins
->Count(); ++n
)
2590 (*pChildWins
)[n
]->nId
= 0;
2591 (*pChildWins
)[n
]->bEnable
= FALSE
;
2595 //------------------------------------------------------------------------
2596 // Virtuelle Methode, die die Gr"o\se der Fl"ache (client area) des parent
2597 // windows liefert, in der Child-Fenster angeordnet werden k"onnen.
2598 // in der ClientArea des parent findet.
2600 Rectangle
SfxWorkWindow::GetTopRect_Impl()
2602 return Rectangle (Point(), pWorkWin
->GetOutputSizePixel() );
2605 //------------------------------------------------------------------------
2606 // Virtuelle Methode, die die Gr"o\se der Fl"ache (client area) des parent
2607 // windows liefert, in der Child-Fenster angeordnet werden k"onnen.
2608 // in der ClientArea des parent findet.
2610 Rectangle
SfxFrameWorkWin_Impl::GetTopRect_Impl()
2612 return pMasterFrame
->GetTopOuterRectPixel_Impl();
2615 //------------------------------------------------------------------------
2616 // Virtuelle Methode, um herauszufinden, ob ein Child-Fenster noch Platz
2617 // in der ClientArea des parent findet.
2619 BOOL
SfxWorkWindow::RequestTopToolSpacePixel_Impl( SvBorder aBorder
)
2621 if ( !IsDockingAllowed() ||
2622 aClientArea
.GetWidth() < aBorder
.Left() + aBorder
.Right() ||
2623 aClientArea
.GetHeight() < aBorder
.Top() + aBorder
.Bottom() )
2629 void SfxWorkWindow::SaveStatus_Impl(SfxChildWindow
*pChild
, const SfxChildWinInfo
&rInfo
)
2631 // Den Status vom Presentation mode wollen wir nicht sichern
2632 if ( IsDockingAllowed() && bInternalDockingAllowed
)
2633 pChild
->SaveStatus(rInfo
);
2636 void SfxWorkWindow::InitializeChild_Impl(SfxChildWin_Impl
*pCW
)
2638 SfxChildWinFactory
* pFact
=0;
2639 SfxApplication
*pApp
= SFX_APP();
2641 SfxChildWinFactArr_Impl
&rFactories
= pApp
->GetChildWinFactories_Impl();
2642 for ( USHORT nFactory
= 0; nFactory
< rFactories
.Count(); ++nFactory
)
2644 pFact
= rFactories
[nFactory
];
2645 if ( pFact
->nId
== pCW
->nSaveId
)
2647 pCW
->aInfo
= pFact
->aInfo
;
2648 SfxChildWindow::InitializeChildWinFactory_Impl(
2649 pCW
->nSaveId
, pCW
->aInfo
);
2650 pCW
->bCreate
= pCW
->aInfo
.bVisible
;
2651 USHORT nFlags
= pFact
->aInfo
.nFlags
;
2652 if ( nFlags
& SFX_CHILDWIN_TASK
)
2653 pCW
->aInfo
.nFlags
|= SFX_CHILDWIN_TASK
;
2654 if ( nFlags
& SFX_CHILDWIN_CANTGETFOCUS
)
2655 pCW
->aInfo
.nFlags
|= SFX_CHILDWIN_CANTGETFOCUS
;
2656 if ( nFlags
& SFX_CHILDWIN_FORCEDOCK
)
2657 pCW
->aInfo
.nFlags
|= SFX_CHILDWIN_FORCEDOCK
;
2658 pFact
->aInfo
= pCW
->aInfo
;
2664 SfxDispatcher
*pDisp
= pBindings
->GetDispatcher_Impl();
2665 SfxModule
*pMod
= pDisp
? SfxModule::GetActiveModule( pDisp
->GetFrame() ) :0;
2668 SfxChildWinFactArr_Impl
*pFactories
= pMod
->GetChildWinFactories_Impl();
2671 SfxChildWinFactArr_Impl
&rFactories
= *pFactories
;
2672 for ( USHORT nFactory
= 0; nFactory
< rFactories
.Count(); ++nFactory
)
2674 pFact
= rFactories
[nFactory
];
2675 if ( pFact
->nId
== pCW
->nSaveId
)
2677 pCW
->aInfo
= pFact
->aInfo
;
2678 SfxChildWindow::InitializeChildWinFactory_Impl(
2679 pCW
->nSaveId
, pCW
->aInfo
);
2680 pCW
->bCreate
= pCW
->aInfo
.bVisible
;
2681 USHORT nFlags
= pFact
->aInfo
.nFlags
;
2682 if ( nFlags
& SFX_CHILDWIN_TASK
)
2683 pCW
->aInfo
.nFlags
|= SFX_CHILDWIN_TASK
;
2684 if ( nFlags
& SFX_CHILDWIN_CANTGETFOCUS
)
2685 pCW
->aInfo
.nFlags
|= SFX_CHILDWIN_CANTGETFOCUS
;
2686 if ( nFlags
& SFX_CHILDWIN_FORCEDOCK
)
2687 pCW
->aInfo
.nFlags
|= SFX_CHILDWIN_FORCEDOCK
;
2688 if ( nFlags
& SFX_CHILDWIN_ALWAYSAVAILABLE
)
2689 pCW
->aInfo
.nFlags
|= SFX_CHILDWIN_ALWAYSAVAILABLE
;
2690 pFact
->aInfo
= pCW
->aInfo
;
2698 SfxStatBar_Impl* SfxWorkWindow::GetStatusBar_Impl()
2703 SfxSplitWindow
* SfxWorkWindow::GetSplitWindow_Impl( SfxChildAlignment eAlign
)
2710 case SFX_ALIGN_BOTTOM
:
2713 case SFX_ALIGN_LEFT
:
2716 case SFX_ALIGN_RIGHT
:
2724 void SfxWorkWindow::MakeChildsVisible_Impl( BOOL bVis
)
2727 pParent
->MakeChildsVisible_Impl( bVis
);
2729 bAllChildsVisible
= bVis
;
2734 for ( USHORT n
=0; n
<aSortedList
.Count(); ++n
)
2736 SfxChild_Impl
* pCli
= (*pChilds
)[aSortedList
[n
]];
2737 if ( (pCli
->eAlign
== SFX_ALIGN_NOALIGNMENT
) || (IsDockingAllowed() && bInternalDockingAllowed
) )
2738 pCli
->nVisible
|= CHILD_ACTIVE
;
2745 for ( USHORT n
=0; n
<aSortedList
.Count(); ++n
)
2747 SfxChild_Impl
* pCli
= (*pChilds
)[aSortedList
[n
]];
2748 pCli
->nVisible
&= ~CHILD_ACTIVE
;
2753 BOOL
SfxWorkWindow::IsAutoHideMode( const SfxSplitWindow
*pSplitWin
)
2755 for ( USHORT n
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
2757 if ( pSplit
[n
] != pSplitWin
&& pSplit
[n
]->IsAutoHide( TRUE
) )
2764 void SfxWorkWindow::EndAutoShow_Impl( Point aPos
)
2767 pParent
->EndAutoShow_Impl( aPos
);
2769 for ( USHORT n
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
2771 SfxSplitWindow
*p
= pSplit
[n
];
2772 if ( p
&& p
->IsAutoHide() )
2774 Point aLocalPos
= p
->ScreenToOutputPixel( aPos
);
2775 Point aEmptyPoint
= Point();
2776 Rectangle
aRect( aEmptyPoint
, p
->GetSizePixel() );
2777 if ( !aRect
.IsInside( aLocalPos
) )
2783 void SfxWorkWindow::ArrangeAutoHideWindows( SfxSplitWindow
*pActSplitWin
)
2789 pParent
->ArrangeAutoHideWindows( pActSplitWin
);
2791 Rectangle
aArea( aUpperClientArea
);
2792 for ( USHORT n
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
2794 // Es werden entweder Dummyfenster oder Fenster im AutoShow-Modus
2795 // ( nicht gepinned, FadeIn ) behandelt.
2796 // Nur das "ubergebene Fenster darf unsichtbar sein, denn vielleicht
2797 // soll daf"ur gerade die Gr"o\se berechnet werden, bevor es angezeigt
2799 SfxSplitWindow
* pSplitWin
= pSplit
[n
];
2800 BOOL bDummyWindow
= !pSplitWin
->IsFadeIn();
2801 Window
*pDummy
= pSplitWin
->GetSplitWindow();
2802 Window
*pWin
= bDummyWindow
? pDummy
: pSplitWin
;
2803 if ( (pSplitWin
->IsPinned() && !bDummyWindow
) || (!pWin
->IsVisible() && pActSplitWin
!= pSplitWin
) )
2806 // Breite und Position des Dummy-Fensters als Ausgangspunkt
2807 Size aSize
= pDummy
->GetSizePixel();
2808 Point aPos
= pDummy
->GetPosPixel();
2814 // Linkes SplitWindow
2815 // Breite vom Fenster selbst holen, wenn nicht das DummyWindow
2816 if ( !bDummyWindow
)
2817 aSize
.Width() = pSplitWin
->GetSizePixel().Width();
2819 // Wenn links ein Window sichtbar ist, beginnt der freie
2820 // Bereich rechts davon bzw. bei der Client area
2821 long nLeft
= aPos
.X() + aSize
.Width();
2822 if ( nLeft
> aArea
.Left() )
2823 aArea
.Left() = nLeft
;
2828 // Rechtes SplitWindow
2829 // Position um Differenz der Breiten korrigieren
2830 aPos
.X() += aSize
.Width();
2832 // Breite vom Fenster selbst holen, wenn nicht das DummyWindow
2833 if ( !bDummyWindow
)
2834 aSize
.Width() = pSplitWin
->GetSizePixel().Width();
2836 aPos
.X() -= aSize
.Width();
2838 // Wenn links schon ein Fenster aufgeklappt ist, darf
2839 // das rechte nicht dar"uber gehen
2840 if ( aPos
.X() < aArea
.Left() )
2842 aPos
.X() = aArea
.Left();
2843 aSize
.Width() = aArea
.GetWidth();
2846 // Wenn rechts ein Window sichtbar ist, endet der freie
2847 // Bereich links davon bzw. bei der Client area
2848 long nRight
= aPos
.X();
2849 if ( nRight
< aArea
.Right() )
2850 aArea
.Right() = nRight
;
2855 // Oberes SplitWindow
2856 // H"ohe vom Fenster selbst holen, wenn nicht das DummyWindow
2857 if ( !bDummyWindow
)
2858 aSize
.Height() = pSplitWin
->GetSizePixel().Height();
2860 // Breite anpassen, je nachdem ob links oder rechts
2861 // schon ein Fenster aufgeklappt ist
2862 aPos
.X() = aArea
.Left();
2863 aSize
.Width() = aArea
.GetWidth();
2865 // Wenn oben ein Window sichtbar ist, beginnt der freie
2866 // Bereich darunter bzw. bei der Client Area
2867 long nTop
= aPos
.Y() + aSize
.Height();
2868 if ( nTop
> aArea
.Top() )
2874 // Das untere SplitWindow
2875 // Position um Differenz der H"ohen korrigieren
2876 aPos
.Y() += aSize
.Height();
2878 // H"ohe vom Fenster selbst holen, wenn nicht das DummmyWindow
2879 if ( !bDummyWindow
)
2880 aSize
.Height() = pSplitWin
->GetSizePixel().Height();
2882 aPos
.Y() -= aSize
.Height();
2884 // Breite anpassen, je nachdem ob links oder rechts
2885 // schon ein Fenster aufgeklappt ist
2886 aPos
.X() = aArea
.Left();
2887 aSize
.Width() = aArea
.GetWidth();
2889 // Wenn oben schon ein Fenster aufgeklappt ist, darf
2890 // das untere nicht dar"uber gehen
2891 if ( aPos
.Y() < aArea
.Top() )
2893 aPos
.Y() = aArea
.Top();
2894 aSize
.Height() = aArea
.GetHeight();
2901 if ( !bDummyWindow
)
2902 // Das FadeIn-Window ist ein Float, dessen Koordinaten in
2903 // Screenkoordinaten gesetzt werden
2904 pSplitWin
->SetPosSizePixel( pWorkWin
->OutputToScreenPixel(aPos
), aSize
);
2906 // Das angedockte DummyWindow
2907 pDummy
->SetPosSizePixel( aPos
, aSize
);
2911 Rectangle
SfxWorkWindow::GetFreeArea( BOOL bAutoHide
) const
2915 Rectangle
aArea( aClientArea
);
2916 for ( USHORT n
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
2918 if ( pSplit
[n
]->IsPinned() || !pSplit
[n
]->IsVisible() )
2921 Size aSize
= pSplit
[n
]->GetSizePixel();
2925 aArea
.Left() += aSize
.Width();
2928 aArea
.Right() -= aSize
.Width();
2931 aArea
.Top() += aSize
.Height();
2934 aArea
.Bottom() -= aSize
.Height();
2945 SfxChildWinController_Impl::SfxChildWinController_Impl( USHORT nID
, SfxWorkWindow
*pWork
)
2946 : SfxControllerItem( nID
, pWork
->GetBindings() )
2950 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> SfxWorkWindow::CreateDispatch( const String
& )
2952 return ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
>();
2955 void SfxChildWinController_Impl::StateChanged(
2956 USHORT nSID
, SfxItemState eState
, const SfxPoolItem
* )
2958 pWorkwin
->DisableChildWindow_Impl( nSID
, eState
== SFX_ITEM_DISABLED
);
2961 void SfxWorkWindow::DisableChildWindow_Impl( USHORT nId
, BOOL bDisable
)
2963 USHORT nCount
= pChildWins
->Count();
2965 for (n
=0; n
<nCount
; n
++)
2966 if ((*pChildWins
)[n
]->nSaveId
== nId
)
2968 if ( n
<nCount
&& (*pChildWins
)[n
]->bDisabled
!= bDisable
)
2970 (*pChildWins
)[n
]->bDisabled
= bDisable
;
2971 UpdateChildWindows_Impl();
2972 ArrangeChilds_Impl();
2977 void SfxWorkWindow::SetActiveChild_Impl( Window
*pChild
)
2979 pActiveChild
= pChild
;
2982 Window
* SfxWorkWindow::GetActiveChild_Impl()
2984 return pActiveChild
;
2987 BOOL
SfxWorkWindow::ActivateNextChild_Impl( BOOL bForward
)
2989 // Alle Kinder gem"a\s Liste sortieren
2991 for ( USHORT i
=SFX_OBJECTBAR_MAX
; i
<pChilds
->Count(); i
++)
2993 SfxChild_Impl
*pCli
= (*pChilds
)[i
];
2994 if ( pCli
&& pCli
->bCanGetFocus
&& pCli
->pWin
)
2997 for (k
=0; k
<aList
.Count(); k
++)
2998 if ( ChildTravelValue((*pChilds
)[aList
[k
]]->eAlign
) > ChildTravelValue(pCli
->eAlign
) )
3004 if ( aList
.Count() == 0 )
3007 USHORT nTopValue
= ChildTravelValue( SFX_ALIGN_LOWESTTOP
);
3008 for ( USHORT i
=0; i
<aList
.Count(); i
++ )
3010 SfxChild_Impl
* pCli
= (*pChilds
)[aList
[i
]];
3011 if ( pCli
->pWin
&& ChildTravelValue( pCli
->eAlign
) > nTopValue
)
3015 USHORT n
= bForward
? 0 : aList
.Count()-1;
3016 SfxChild_Impl
*pAct
=NULL
;
3019 // Das aktive Fenster suchen
3020 for ( n
=0; n
<aList
.Count(); n
++ )
3022 SfxChild_Impl
* pCli
= (*pChilds
)[aList
[n
]];
3023 if ( pCli
&& pCli
->pWin
&& ( pCli
->pWin
== pActiveChild
|| !pActiveChild
) )
3031 // dummy entries for the container window
3032 aList
.Insert( 0xFFFF, 0 );
3033 aList
.Insert( 0xFFFF, aList
.Count() );
3037 for ( USHORT i
=0; i
<SFX_SPLITWINDOWS_MAX
; i
++ )
3039 // Eventuell ist pAct ein Splitwindow
3040 SfxSplitWindow
*p
= pSplit
[i
];
3041 if ( pAct
->pWin
== p
)
3043 if( p
->ActivateNextChild_Impl( bForward
) )
3049 // pAct ist ein direktes ChildWindow
3050 // mit dem Nachfolger bzw. Vorg"anger des aktiven Fensters weitermachen
3056 if ( n
== 0 || n
== aList
.Count()-1 )
3062 SfxChild_Impl
* pCli
= (*pChilds
)[aList
[n
]];
3065 SfxChild_Impl
* pNext
= pCli
;
3066 for ( USHORT i
=0; n
<SFX_SPLITWINDOWS_MAX
; n
++ )
3068 // Eventuell ist pNext ein Splitwindow
3069 SfxSplitWindow
*p
= pSplit
[i
];
3070 if ( pNext
->pWin
== p
)
3072 // Das erste/letzte Fenster dort aktivieren
3073 p
->SetActiveWindow_Impl( NULL
);
3075 if( p
->ActivateNextChild_Impl( bForward
) )
3083 pNext
->pWin
->GrabFocus();
3084 pActiveChild
= pNext
->pWin
;
3094 if ( n
== 0 || n
== aList
.Count()-1 )
3101 void SfxWorkWindow::SetObjectBarCustomizeMode_Impl( BOOL
)
3105 void SfxWorkWindow::DataChanged_Impl( const DataChangedEvent
& )
3108 USHORT nCount
= pChildWins
->Count();
3109 for (n
=0; n
<nCount
; n
++)
3111 SfxChildWin_Impl
*pCW
= (*pChildWins
)[n
];
3112 if ( pCW
&& pCW
->pWin
)
3113 pCW
->pWin
->GetWindow()->UpdateSettings( Application::GetSettings() );
3116 ArrangeChilds_Impl();