1d119d52dSAndrew Rist /**************************************************************
23b720757SAriel Constenla-Haile *
3d119d52dSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d119d52dSAndrew Rist * or more contributor license agreements. See the NOTICE file
5d119d52dSAndrew Rist * distributed with this work for additional information
6d119d52dSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7d119d52dSAndrew Rist * to you under the Apache License, Version 2.0 (the
8d119d52dSAndrew Rist * "License"); you may not use this file except in compliance
9d119d52dSAndrew Rist * with the License. You may obtain a copy of the License at
103b720757SAriel Constenla-Haile *
11d119d52dSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
123b720757SAriel Constenla-Haile *
13d119d52dSAndrew Rist * Unless required by applicable law or agreed to in writing,
14d119d52dSAndrew Rist * software distributed under the License is distributed on an
15d119d52dSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d119d52dSAndrew Rist * KIND, either express or implied. See the License for the
17d119d52dSAndrew Rist * specific language governing permissions and limitations
18d119d52dSAndrew Rist * under the License.
193b720757SAriel Constenla-Haile *
20d119d52dSAndrew Rist *************************************************************/
21d119d52dSAndrew Rist
22d119d52dSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sfx2.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #ifdef SOLARIS
28cdf0e10cSrcweir // HACK: prevent conflict between STLPORT and Workshop headers on Solaris 8
29cdf0e10cSrcweir #include <ctime>
30cdf0e10cSrcweir #endif
31cdf0e10cSrcweir
32cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
33cdf0e10cSrcweir
34cdf0e10cSrcweir #ifndef _WRKWIN_HXX //autogen
35cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir #include <unotools/viewoptions.hxx>
38cdf0e10cSrcweir #ifndef GCC
39cdf0e10cSrcweir #endif
40cdf0e10cSrcweir
41cdf0e10cSrcweir #include <vcl/timer.hxx>
42cdf0e10cSrcweir
43cdf0e10cSrcweir #include "splitwin.hxx"
44cdf0e10cSrcweir #include "workwin.hxx"
45cdf0e10cSrcweir #include <sfx2/dockwin.hxx>
46cdf0e10cSrcweir #include <sfx2/app.hxx>
47cdf0e10cSrcweir #include "dialog.hrc"
48cdf0e10cSrcweir #include "sfx2/sfxresid.hxx"
49cdf0e10cSrcweir #include <sfx2/mnumgr.hxx>
50cdf0e10cSrcweir #include "virtmenu.hxx"
51cdf0e10cSrcweir #include <sfx2/msgpool.hxx>
52cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
53cdf0e10cSrcweir
54*01e38eabSOliver-Rainer Wittmann #include <vector>
55*01e38eabSOliver-Rainer Wittmann #include <utility>
56*01e38eabSOliver-Rainer Wittmann
57cdf0e10cSrcweir using namespace ::com::sun::star::uno;
58cdf0e10cSrcweir using namespace ::rtl;
59cdf0e10cSrcweir
60cdf0e10cSrcweir #define VERSION 1
61cdf0e10cSrcweir #define nPixel 30L
62cdf0e10cSrcweir #define USERITEM_NAME OUString::createFromAscii( "UserItem" )
63cdf0e10cSrcweir
64*01e38eabSOliver-Rainer Wittmann namespace {
65*01e38eabSOliver-Rainer Wittmann // helper class to deactivate UpdateMode, if needed, for the life time of an instance
66*01e38eabSOliver-Rainer Wittmann class DeactivateUpdateMode
67*01e38eabSOliver-Rainer Wittmann {
68*01e38eabSOliver-Rainer Wittmann public:
DeactivateUpdateMode(SfxSplitWindow & rSplitWindow)69*01e38eabSOliver-Rainer Wittmann explicit DeactivateUpdateMode( SfxSplitWindow& rSplitWindow )
70*01e38eabSOliver-Rainer Wittmann : mrSplitWindow( rSplitWindow )
71*01e38eabSOliver-Rainer Wittmann , mbUpdateMode( rSplitWindow.IsUpdateMode() )
72*01e38eabSOliver-Rainer Wittmann {
73*01e38eabSOliver-Rainer Wittmann if ( mbUpdateMode )
74*01e38eabSOliver-Rainer Wittmann {
75*01e38eabSOliver-Rainer Wittmann mrSplitWindow.SetUpdateMode( sal_False );
76*01e38eabSOliver-Rainer Wittmann }
77*01e38eabSOliver-Rainer Wittmann }
78*01e38eabSOliver-Rainer Wittmann
~DeactivateUpdateMode(void)79*01e38eabSOliver-Rainer Wittmann ~DeactivateUpdateMode( void )
80*01e38eabSOliver-Rainer Wittmann {
81*01e38eabSOliver-Rainer Wittmann if ( mbUpdateMode )
82*01e38eabSOliver-Rainer Wittmann {
83*01e38eabSOliver-Rainer Wittmann mrSplitWindow.SetUpdateMode( sal_True );
84*01e38eabSOliver-Rainer Wittmann }
85*01e38eabSOliver-Rainer Wittmann }
86*01e38eabSOliver-Rainer Wittmann
87*01e38eabSOliver-Rainer Wittmann private:
88*01e38eabSOliver-Rainer Wittmann SfxSplitWindow& mrSplitWindow;
89*01e38eabSOliver-Rainer Wittmann const sal_Bool mbUpdateMode;
90*01e38eabSOliver-Rainer Wittmann };
91*01e38eabSOliver-Rainer Wittmann }
92*01e38eabSOliver-Rainer Wittmann
93cdf0e10cSrcweir struct SfxDock_Impl
94cdf0e10cSrcweir {
95cdf0e10cSrcweir sal_uInt16 nType;
963b720757SAriel Constenla-Haile SfxDockingWindow* pWin; // SplitWindow hat dieses Fenster
97cdf0e10cSrcweir sal_Bool bNewLine;
983b720757SAriel Constenla-Haile sal_Bool bHide; // SplitWindow hatte dieses Fenster
99cdf0e10cSrcweir long nSize;
100cdf0e10cSrcweir };
101cdf0e10cSrcweir
102cdf0e10cSrcweir typedef SfxDock_Impl* SfxDockPtr;
103cdf0e10cSrcweir SV_DECL_PTRARR_DEL( SfxDockArr_Impl, SfxDockPtr, 4, 4)
104cdf0e10cSrcweir SV_IMPL_PTRARR( SfxDockArr_Impl, SfxDockPtr);
105cdf0e10cSrcweir
106cdf0e10cSrcweir class SfxEmptySplitWin_Impl : public SplitWindow
107cdf0e10cSrcweir {
108cdf0e10cSrcweir /* [Beschreibung]
109cdf0e10cSrcweir
1103b720757SAriel Constenla-Haile Das SfxEmptySplitWin_Impldow ist ein leeres SplitWindow, das das SfxSplitWindow
1113b720757SAriel Constenla-Haile im AutoHide-Modus ersetzt. Es dient nur als Platzhalter, um MouseMoves
1123b720757SAriel Constenla-Haile zu empfangen und ggf. das eigentlichte SplitWindow einzublenden
113cdf0e10cSrcweir */
114cdf0e10cSrcweir friend class SfxSplitWindow;
115cdf0e10cSrcweir
116cdf0e10cSrcweir SfxSplitWindow* pOwner;
117cdf0e10cSrcweir sal_Bool bFadeIn;
118cdf0e10cSrcweir sal_Bool bAutoHide;
119cdf0e10cSrcweir sal_Bool bSplit;
120cdf0e10cSrcweir sal_Bool bEndAutoHide;
121cdf0e10cSrcweir Timer aTimer;
122cdf0e10cSrcweir Point aLastPos;
123cdf0e10cSrcweir sal_uInt16 nState;
124cdf0e10cSrcweir
SfxEmptySplitWin_Impl(SfxSplitWindow * pParent)125cdf0e10cSrcweir SfxEmptySplitWin_Impl( SfxSplitWindow *pParent )
126cdf0e10cSrcweir : SplitWindow( pParent->GetParent(), WinBits( WB_BORDER | WB_3DLOOK ) )
127cdf0e10cSrcweir , pOwner( pParent )
128cdf0e10cSrcweir , bFadeIn( sal_False )
129cdf0e10cSrcweir , bAutoHide( sal_False )
130cdf0e10cSrcweir , bSplit( sal_False )
131cdf0e10cSrcweir , bEndAutoHide( sal_False )
132cdf0e10cSrcweir , nState( 1 )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir aTimer.SetTimeoutHdl(
135cdf0e10cSrcweir LINK(pOwner, SfxSplitWindow, TimerHdl ) );
136cdf0e10cSrcweir aTimer.SetTimeout( 200 );
137cdf0e10cSrcweir // EnableDrop( sal_True );
138cdf0e10cSrcweir SetAlign( pOwner->GetAlign() );
139cdf0e10cSrcweir Actualize();
140cdf0e10cSrcweir ShowAutoHideButton( pOwner->IsAutoHideButtonVisible() );
141cdf0e10cSrcweir ShowFadeInHideButton( sal_True );
142cdf0e10cSrcweir }
143cdf0e10cSrcweir
~SfxEmptySplitWin_Impl()144cdf0e10cSrcweir ~SfxEmptySplitWin_Impl()
145cdf0e10cSrcweir {
146cdf0e10cSrcweir aTimer.Stop();
147cdf0e10cSrcweir }
148cdf0e10cSrcweir
149cdf0e10cSrcweir virtual void MouseMove( const MouseEvent& );
150cdf0e10cSrcweir virtual void AutoHide();
151cdf0e10cSrcweir virtual void FadeIn();
152cdf0e10cSrcweir void Actualize();
153cdf0e10cSrcweir };
154cdf0e10cSrcweir
Actualize()155cdf0e10cSrcweir void SfxEmptySplitWin_Impl::Actualize()
156cdf0e10cSrcweir {
157cdf0e10cSrcweir Size aSize( pOwner->GetSizePixel() );
158cdf0e10cSrcweir switch ( pOwner->GetAlign() )
159cdf0e10cSrcweir {
160cdf0e10cSrcweir case WINDOWALIGN_LEFT:
161cdf0e10cSrcweir case WINDOWALIGN_RIGHT:
162cdf0e10cSrcweir aSize.Width() = GetFadeInSize();
163cdf0e10cSrcweir break;
164cdf0e10cSrcweir case WINDOWALIGN_TOP:
165cdf0e10cSrcweir case WINDOWALIGN_BOTTOM:
166cdf0e10cSrcweir aSize.Height() = GetFadeInSize();
167cdf0e10cSrcweir break;
168cdf0e10cSrcweir }
169cdf0e10cSrcweir
170cdf0e10cSrcweir SetSizePixel( aSize );
171cdf0e10cSrcweir }
172cdf0e10cSrcweir
AutoHide()173cdf0e10cSrcweir void SfxEmptySplitWin_Impl::AutoHide()
174cdf0e10cSrcweir {
175cdf0e10cSrcweir pOwner->SetPinned_Impl( !pOwner->bPinned );
176cdf0e10cSrcweir pOwner->SaveConfig_Impl();
177cdf0e10cSrcweir bAutoHide = sal_True;
178cdf0e10cSrcweir FadeIn();
179cdf0e10cSrcweir }
180cdf0e10cSrcweir
FadeIn()181cdf0e10cSrcweir void SfxEmptySplitWin_Impl::FadeIn()
182cdf0e10cSrcweir {
183cdf0e10cSrcweir if (!bAutoHide )
184cdf0e10cSrcweir bAutoHide = IsFadeNoButtonMode();
185cdf0e10cSrcweir pOwner->SetFadeIn_Impl( sal_True );
186cdf0e10cSrcweir pOwner->Show_Impl();
187cdf0e10cSrcweir if ( bAutoHide )
188cdf0e10cSrcweir {
1893b720757SAriel Constenla-Haile // Timer zum Schlie\sen aufsetzen; der Aufrufer mu\s selbst sicherstellen,
1903b720757SAriel Constenla-Haile // da\s das Window nicht gleich wieder zu geht ( z.B. durch Setzen des
1913b720757SAriel Constenla-Haile // Focus oder einen modal mode )
192cdf0e10cSrcweir aLastPos = GetPointerPosPixel();
193cdf0e10cSrcweir aTimer.Start();
194cdf0e10cSrcweir }
195cdf0e10cSrcweir else
196cdf0e10cSrcweir pOwner->SaveConfig_Impl();
197cdf0e10cSrcweir }
198cdf0e10cSrcweir
199cdf0e10cSrcweir //-------------------------------------------------------------------------
200cdf0e10cSrcweir
MouseButtonDown(const MouseEvent & rMEvt)201cdf0e10cSrcweir void SfxSplitWindow::MouseButtonDown( const MouseEvent& rMEvt )
202cdf0e10cSrcweir {
203cdf0e10cSrcweir if ( rMEvt.GetClicks() != 2 )
204cdf0e10cSrcweir SplitWindow::MouseButtonDown( rMEvt );
205cdf0e10cSrcweir }
206cdf0e10cSrcweir
MouseMove(const MouseEvent & rMEvt)207cdf0e10cSrcweir void SfxEmptySplitWin_Impl::MouseMove( const MouseEvent& rMEvt )
208cdf0e10cSrcweir {
209cdf0e10cSrcweir SplitWindow::MouseMove( rMEvt );
210cdf0e10cSrcweir }
211cdf0e10cSrcweir
212cdf0e10cSrcweir //-------------------------------------------------------------------------
213cdf0e10cSrcweir
SfxSplitWindow(Window * pParent,SfxChildAlignment eAl,SfxWorkWindow * pW,sal_Bool bWithButtons,WinBits nBits)214cdf0e10cSrcweir SfxSplitWindow::SfxSplitWindow( Window* pParent, SfxChildAlignment eAl,
215cdf0e10cSrcweir SfxWorkWindow *pW, sal_Bool bWithButtons, WinBits nBits )
216cdf0e10cSrcweir
217cdf0e10cSrcweir /* [Beschreibung]
218cdf0e10cSrcweir
219cdf0e10cSrcweir Ein SfxSplitWindow verbirgt die rekursive Struktur des SV-Splitwindows
220cdf0e10cSrcweir nach au\sen, indem es einen tabellenartigen Aufbau mit Zeilen und Spalten
221cdf0e10cSrcweir ( also maximale Rekursionstiefe 2 ) simuliert.
222cdf0e10cSrcweir Au\erdem sichert es die Persistenz der Anordnung der SfxDockingWindows.
223cdf0e10cSrcweir */
224cdf0e10cSrcweir
225cdf0e10cSrcweir : SplitWindow ( pParent, nBits | WB_HIDE ),
226cdf0e10cSrcweir eAlign(eAl),
227cdf0e10cSrcweir pWorkWin(pW),
228cdf0e10cSrcweir pDockArr( new SfxDockArr_Impl ),
229cdf0e10cSrcweir bLocked(sal_False),
230cdf0e10cSrcweir bPinned(sal_True),
231cdf0e10cSrcweir pEmptyWin(NULL),
232cdf0e10cSrcweir pActive(NULL)
233cdf0e10cSrcweir {
234cdf0e10cSrcweir if ( bWithButtons )
235cdf0e10cSrcweir {
236cdf0e10cSrcweir ShowAutoHideButton( sal_False ); // no autohide button (pin) anymore
237cdf0e10cSrcweir ShowFadeOutButton( sal_True );
238cdf0e10cSrcweir }
239cdf0e10cSrcweir
240cdf0e10cSrcweir // SV-Alignment setzen
241cdf0e10cSrcweir WindowAlign eTbxAlign;
242cdf0e10cSrcweir switch ( eAlign )
243cdf0e10cSrcweir {
244cdf0e10cSrcweir case SFX_ALIGN_LEFT:
245cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_LEFT;
246cdf0e10cSrcweir break;
247cdf0e10cSrcweir case SFX_ALIGN_RIGHT:
248cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_RIGHT;
249cdf0e10cSrcweir break;
250cdf0e10cSrcweir case SFX_ALIGN_TOP:
251cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_TOP;
252cdf0e10cSrcweir break;
253cdf0e10cSrcweir case SFX_ALIGN_BOTTOM:
254cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_BOTTOM;
255cdf0e10cSrcweir bPinned = sal_True;
256cdf0e10cSrcweir break;
257cdf0e10cSrcweir default:
258cdf0e10cSrcweir eTbxAlign = WINDOWALIGN_TOP; // some sort of default...
259cdf0e10cSrcweir break; // -Wall lots not handled..
260cdf0e10cSrcweir }
261cdf0e10cSrcweir
262cdf0e10cSrcweir SetAlign (eTbxAlign);
263cdf0e10cSrcweir pEmptyWin = new SfxEmptySplitWin_Impl( this );
264cdf0e10cSrcweir if ( bPinned )
265cdf0e10cSrcweir {
266cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_True;
267cdf0e10cSrcweir pEmptyWin->nState = 2;
268cdf0e10cSrcweir }
269cdf0e10cSrcweir
270cdf0e10cSrcweir if ( bWithButtons )
271cdf0e10cSrcweir {
272cdf0e10cSrcweir // Konfiguration einlesen
273cdf0e10cSrcweir String aWindowId = String::CreateFromAscii("SplitWindow");
274cdf0e10cSrcweir aWindowId += String::CreateFromInt32( (sal_Int32) eTbxAlign );
275cdf0e10cSrcweir SvtViewOptions aWinOpt( E_WINDOW, aWindowId );
276cdf0e10cSrcweir String aWinData;
277cdf0e10cSrcweir Any aUserItem = aWinOpt.GetUserItem( USERITEM_NAME );
278cdf0e10cSrcweir OUString aTemp;
279cdf0e10cSrcweir if ( aUserItem >>= aTemp )
280cdf0e10cSrcweir aWinData = String( aTemp );
281cdf0e10cSrcweir if ( aWinData.Len() && aWinData.GetChar( (sal_uInt16) 0 ) == 'V' )
282cdf0e10cSrcweir {
283cdf0e10cSrcweir pEmptyWin->nState = (sal_uInt16) aWinData.GetToken( 1, ',' ).ToInt32();
284cdf0e10cSrcweir if ( pEmptyWin->nState & 2 )
285cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_True;
286cdf0e10cSrcweir //bPinned = !( pEmptyWin->nState & 1 );
287cdf0e10cSrcweir bPinned = sal_True; // always assume pinned - floating mode not used anymore
288cdf0e10cSrcweir
289cdf0e10cSrcweir sal_uInt16 i=2;
290cdf0e10cSrcweir sal_uInt16 nCount = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32();
291cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir SfxDock_Impl *pDock = new SfxDock_Impl;
294cdf0e10cSrcweir pDock->pWin = 0;
295cdf0e10cSrcweir pDock->bNewLine = sal_False;
296cdf0e10cSrcweir pDock->bHide = sal_True;
297cdf0e10cSrcweir pDock->nType = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32();
298cdf0e10cSrcweir if ( !pDock->nType )
299cdf0e10cSrcweir {
300cdf0e10cSrcweir // K"onnte NewLine bedeuten
301cdf0e10cSrcweir pDock->nType = (sal_uInt16) aWinData.GetToken(i++, ',').ToInt32();
302cdf0e10cSrcweir if ( !pDock->nType )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir // Lesefehler
305cdf0e10cSrcweir delete pDock;
306cdf0e10cSrcweir break;
307cdf0e10cSrcweir }
308cdf0e10cSrcweir else
309cdf0e10cSrcweir pDock->bNewLine = sal_True;
310cdf0e10cSrcweir }
311cdf0e10cSrcweir
312cdf0e10cSrcweir pDockArr->Insert(pDock,n);
313cdf0e10cSrcweir }
314cdf0e10cSrcweir }
315cdf0e10cSrcweir }
316cdf0e10cSrcweir else
317cdf0e10cSrcweir {
318cdf0e10cSrcweir bPinned = sal_True;
319cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_True;
320cdf0e10cSrcweir pEmptyWin->nState = 2;
321cdf0e10cSrcweir }
322cdf0e10cSrcweir
323cdf0e10cSrcweir SetAutoHideState( !bPinned );
324cdf0e10cSrcweir pEmptyWin->SetAutoHideState( !bPinned );
325cdf0e10cSrcweir }
326cdf0e10cSrcweir
327cdf0e10cSrcweir //-------------------------------------------------------------------------
328cdf0e10cSrcweir
~SfxSplitWindow()329cdf0e10cSrcweir SfxSplitWindow::~SfxSplitWindow()
330cdf0e10cSrcweir {
331cdf0e10cSrcweir if ( !pWorkWin->GetParent_Impl() )
332cdf0e10cSrcweir SaveConfig_Impl();
333cdf0e10cSrcweir
334cdf0e10cSrcweir if ( pEmptyWin )
335cdf0e10cSrcweir {
336cdf0e10cSrcweir // pOwner auf NULL setzen, sonst versucht pEmptyWin, nochmal zu
337cdf0e10cSrcweir // l"oschen; es wird n"amlich von au\sen immer das Fenster deleted,
338cdf0e10cSrcweir // das gerade angedockt ist
339cdf0e10cSrcweir pEmptyWin->pOwner = NULL;
340cdf0e10cSrcweir delete pEmptyWin;
341cdf0e10cSrcweir }
342cdf0e10cSrcweir
343cdf0e10cSrcweir delete pDockArr;
344cdf0e10cSrcweir }
345cdf0e10cSrcweir
SaveConfig_Impl()346cdf0e10cSrcweir void SfxSplitWindow::SaveConfig_Impl()
347cdf0e10cSrcweir {
348cdf0e10cSrcweir // Konfiguration abspeichern
349cdf0e10cSrcweir String aWinData('V');
350cdf0e10cSrcweir aWinData += String::CreateFromInt32( VERSION );
351cdf0e10cSrcweir aWinData += ',';
352cdf0e10cSrcweir aWinData += String::CreateFromInt32( pEmptyWin->nState );
353cdf0e10cSrcweir aWinData += ',';
354cdf0e10cSrcweir
355cdf0e10cSrcweir sal_uInt16 nCount = 0;
356cdf0e10cSrcweir sal_uInt16 n;
357cdf0e10cSrcweir for ( n=0; n<pDockArr->Count(); n++ )
358cdf0e10cSrcweir {
359cdf0e10cSrcweir SfxDock_Impl *pDock = (*pDockArr)[n];
360cdf0e10cSrcweir if ( pDock->bHide || pDock->pWin )
361cdf0e10cSrcweir nCount++;
362cdf0e10cSrcweir }
363cdf0e10cSrcweir
364cdf0e10cSrcweir aWinData += String::CreateFromInt32( nCount );
365cdf0e10cSrcweir
366cdf0e10cSrcweir for ( n=0; n<pDockArr->Count(); n++ )
367cdf0e10cSrcweir {
368cdf0e10cSrcweir SfxDock_Impl *pDock = (*pDockArr)[n];
369cdf0e10cSrcweir if ( !pDock->bHide && !pDock->pWin )
370cdf0e10cSrcweir continue;
371cdf0e10cSrcweir if ( pDock->bNewLine )
372cdf0e10cSrcweir aWinData += DEFINE_CONST_UNICODE(",0");
373cdf0e10cSrcweir aWinData += ',';
374cdf0e10cSrcweir aWinData += String::CreateFromInt32( pDock->nType);
375cdf0e10cSrcweir }
376cdf0e10cSrcweir
377cdf0e10cSrcweir String aWindowId = String::CreateFromAscii("SplitWindow");
378cdf0e10cSrcweir aWindowId += String::CreateFromInt32( (sal_Int32) GetAlign() );
379cdf0e10cSrcweir SvtViewOptions aWinOpt( E_WINDOW, aWindowId );
380cdf0e10cSrcweir aWinOpt.SetUserItem( USERITEM_NAME, makeAny( OUString( aWinData ) ) );
381cdf0e10cSrcweir }
382cdf0e10cSrcweir
383cdf0e10cSrcweir //-------------------------------------------------------------------------
384cdf0e10cSrcweir
StartSplit()385cdf0e10cSrcweir void SfxSplitWindow::StartSplit()
386cdf0e10cSrcweir {
387cdf0e10cSrcweir long nSize = 0;
388cdf0e10cSrcweir Size aSize = GetSizePixel();
389cdf0e10cSrcweir
390cdf0e10cSrcweir if ( pEmptyWin )
391cdf0e10cSrcweir {
392cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_True;
393cdf0e10cSrcweir pEmptyWin->bSplit = sal_True;
394cdf0e10cSrcweir }
395cdf0e10cSrcweir
396cdf0e10cSrcweir Rectangle aRect = pWorkWin->GetFreeArea( !bPinned );
397cdf0e10cSrcweir switch ( GetAlign() )
398cdf0e10cSrcweir {
399cdf0e10cSrcweir case WINDOWALIGN_LEFT:
400cdf0e10cSrcweir case WINDOWALIGN_RIGHT:
401cdf0e10cSrcweir nSize = aSize.Width() + aRect.GetWidth();
402cdf0e10cSrcweir break;
403cdf0e10cSrcweir case WINDOWALIGN_TOP:
404cdf0e10cSrcweir case WINDOWALIGN_BOTTOM:
405cdf0e10cSrcweir nSize = aSize.Height() + aRect.GetHeight();
406cdf0e10cSrcweir break;
407cdf0e10cSrcweir }
408cdf0e10cSrcweir
409cdf0e10cSrcweir SetMaxSizePixel( nSize );
410cdf0e10cSrcweir }
411cdf0e10cSrcweir
412cdf0e10cSrcweir //-------------------------------------------------------------------------
413cdf0e10cSrcweir
SplitResize()414cdf0e10cSrcweir void SfxSplitWindow::SplitResize()
415cdf0e10cSrcweir {
416cdf0e10cSrcweir if ( bPinned )
417cdf0e10cSrcweir {
418cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl();
419cdf0e10cSrcweir pWorkWin->ShowChilds_Impl();
420cdf0e10cSrcweir }
421cdf0e10cSrcweir else
422cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this );
423cdf0e10cSrcweir }
424cdf0e10cSrcweir
425cdf0e10cSrcweir //-------------------------------------------------------------------------
426cdf0e10cSrcweir
Split()427cdf0e10cSrcweir void SfxSplitWindow::Split()
428cdf0e10cSrcweir {
429*01e38eabSOliver-Rainer Wittmann if ( pEmptyWin )
430*01e38eabSOliver-Rainer Wittmann pEmptyWin->bSplit = sal_False;
431cdf0e10cSrcweir
432*01e38eabSOliver-Rainer Wittmann SplitWindow::Split();
433cdf0e10cSrcweir
434*01e38eabSOliver-Rainer Wittmann std::vector< std::pair< sal_uInt16, long > > aNewOrgSizes;
435cdf0e10cSrcweir
436*01e38eabSOliver-Rainer Wittmann sal_uInt16 nCount = pDockArr->Count();
437*01e38eabSOliver-Rainer Wittmann for ( sal_uInt16 n=0; n<nCount; n++ )
438*01e38eabSOliver-Rainer Wittmann {
439*01e38eabSOliver-Rainer Wittmann SfxDock_Impl *pD = (*pDockArr)[n];
440*01e38eabSOliver-Rainer Wittmann if ( pD->pWin )
441*01e38eabSOliver-Rainer Wittmann {
442*01e38eabSOliver-Rainer Wittmann const sal_uInt16 nId = pD->nType;
443*01e38eabSOliver-Rainer Wittmann const long nSize = GetItemSize( nId, SWIB_FIXED );
444*01e38eabSOliver-Rainer Wittmann const long nSetSize = GetItemSize( GetSet( nId ) );
445*01e38eabSOliver-Rainer Wittmann Size aSize;
446cdf0e10cSrcweir
447*01e38eabSOliver-Rainer Wittmann if ( IsHorizontal() )
448*01e38eabSOliver-Rainer Wittmann {
449*01e38eabSOliver-Rainer Wittmann aSize.Width() = nSize;
450*01e38eabSOliver-Rainer Wittmann aSize.Height() = nSetSize;
451*01e38eabSOliver-Rainer Wittmann }
452*01e38eabSOliver-Rainer Wittmann else
453*01e38eabSOliver-Rainer Wittmann {
454*01e38eabSOliver-Rainer Wittmann aSize.Width() = nSetSize;
455*01e38eabSOliver-Rainer Wittmann aSize.Height() = nSize;
456*01e38eabSOliver-Rainer Wittmann }
457cdf0e10cSrcweir
458*01e38eabSOliver-Rainer Wittmann pD->pWin->SetItemSize_Impl( aSize );
459*01e38eabSOliver-Rainer Wittmann
460*01e38eabSOliver-Rainer Wittmann aNewOrgSizes.push_back( std::pair< sal_uInt16, long >( nId, nSize ) );
461*01e38eabSOliver-Rainer Wittmann }
462*01e38eabSOliver-Rainer Wittmann }
463*01e38eabSOliver-Rainer Wittmann
464*01e38eabSOliver-Rainer Wittmann // workaround insuffiency of <SplitWindow> regarding dock layouting:
465*01e38eabSOliver-Rainer Wittmann // apply FIXED item size as 'original' item size to improve layouting of undock-dock-cycle of a window
466*01e38eabSOliver-Rainer Wittmann {
467*01e38eabSOliver-Rainer Wittmann DeactivateUpdateMode aDeactivateUpdateMode( *this );
468*01e38eabSOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aNewOrgSizes.size(); ++i )
469*01e38eabSOliver-Rainer Wittmann {
470*01e38eabSOliver-Rainer Wittmann SetItemSize( aNewOrgSizes[i].first, aNewOrgSizes[i].second );
471*01e38eabSOliver-Rainer Wittmann }
472*01e38eabSOliver-Rainer Wittmann }
473*01e38eabSOliver-Rainer Wittmann
474*01e38eabSOliver-Rainer Wittmann SaveConfig_Impl();
475cdf0e10cSrcweir }
476cdf0e10cSrcweir
477cdf0e10cSrcweir //-------------------------------------------------------------------------
478cdf0e10cSrcweir
InsertWindow(SfxDockingWindow * pDockWin,const Size & rSize)479cdf0e10cSrcweir void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize)
480cdf0e10cSrcweir
481cdf0e10cSrcweir /* [Beschreibung]
482cdf0e10cSrcweir
4833b720757SAriel Constenla-Haile Zum Einf"ugen von SfxDockingWindows kann auch keine Position "ubergeben
4843b720757SAriel Constenla-Haile werden. Das SfxSplitWindow sucht dann die zuletzt gemerkte zu dem
4853b720757SAriel Constenla-Haile "ubergebenen SfxDockingWindow heraus oder h"angt es als letztes neu an.
486cdf0e10cSrcweir
487cdf0e10cSrcweir */
488cdf0e10cSrcweir {
4893b720757SAriel Constenla-Haile short nLine = -1; // damit erstes Fenster nLine auf 0 hochsetzen kann
490cdf0e10cSrcweir sal_uInt16 nL;
491cdf0e10cSrcweir sal_uInt16 nPos = 0;
492cdf0e10cSrcweir sal_Bool bNewLine = sal_True;
493cdf0e10cSrcweir sal_Bool bSaveConfig = sal_False;
494cdf0e10cSrcweir SfxDock_Impl *pFoundDock=0;
495cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count();
496cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ )
497cdf0e10cSrcweir {
498cdf0e10cSrcweir SfxDock_Impl *pDock = (*pDockArr)[n];
499cdf0e10cSrcweir if ( pDock->bNewLine )
500cdf0e10cSrcweir {
5013b720757SAriel Constenla-Haile // Das Fenster er"offnet eine neue Zeile
502cdf0e10cSrcweir if ( pFoundDock )
5033b720757SAriel Constenla-Haile // Aber hinter dem gerade eingef"ugten Fenster
504cdf0e10cSrcweir break;
505cdf0e10cSrcweir
5063b720757SAriel Constenla-Haile // Neue Zeile
507cdf0e10cSrcweir nPos = 0;
508cdf0e10cSrcweir bNewLine = sal_True;
509cdf0e10cSrcweir }
510cdf0e10cSrcweir
511cdf0e10cSrcweir if ( pDock->pWin )
512cdf0e10cSrcweir {
5133b720757SAriel Constenla-Haile // Es gibt an dieser Stelle gerade ein Fenster
514cdf0e10cSrcweir if ( bNewLine && !pFoundDock )
515cdf0e10cSrcweir {
5163b720757SAriel Constenla-Haile // Bisher ist nicht bekannt, in welcher realen Zeile es liegt
517cdf0e10cSrcweir GetWindowPos( pDock->pWin, nL, nPos );
518cdf0e10cSrcweir nLine = (short) nL;
519cdf0e10cSrcweir }
520cdf0e10cSrcweir
521cdf0e10cSrcweir if ( !pFoundDock )
522cdf0e10cSrcweir {
5233b720757SAriel Constenla-Haile // Fenster liegt vor dem eingef"ugten
524cdf0e10cSrcweir nPos++;
525cdf0e10cSrcweir }
526cdf0e10cSrcweir
5273b720757SAriel Constenla-Haile // Zeile ist schon er"offnet
528cdf0e10cSrcweir bNewLine = sal_False;
529cdf0e10cSrcweir if ( pFoundDock )
530cdf0e10cSrcweir break;
531cdf0e10cSrcweir }
532cdf0e10cSrcweir
533cdf0e10cSrcweir if ( pDock->nType == pDockWin->GetType() )
534cdf0e10cSrcweir {
5353b720757SAriel Constenla-Haile DBG_ASSERT( !pFoundDock && !pDock->pWin, "Fenster ist schon vorhanden!");
536cdf0e10cSrcweir pFoundDock = pDock;
537cdf0e10cSrcweir if ( !bNewLine )
538cdf0e10cSrcweir break;
539cdf0e10cSrcweir else
540cdf0e10cSrcweir {
5413b720757SAriel Constenla-Haile // Es wurde zuletzt eine neue Reihe gestartet, aber noch kein
5423b720757SAriel Constenla-Haile // darin liegendes Fenster gefunden; daher weitersuchen, ob noch
5433b720757SAriel Constenla-Haile // ein Fenster in dieser Zeile folgt, um bNewLine korrekt zu setzen.
5443b720757SAriel Constenla-Haile // Dabei darf aber nLine oder nPos nicht mehr ver"andert werden!
545cdf0e10cSrcweir nLine++;
546cdf0e10cSrcweir }
547cdf0e10cSrcweir }
548cdf0e10cSrcweir }
549cdf0e10cSrcweir
550cdf0e10cSrcweir if ( !pFoundDock )
551cdf0e10cSrcweir {
552cdf0e10cSrcweir // Nicht gefunden, am Ende einf"ugen
553cdf0e10cSrcweir pFoundDock = new SfxDock_Impl;
554cdf0e10cSrcweir pFoundDock->bHide = sal_True;
555cdf0e10cSrcweir pDockArr->Insert( pFoundDock, nCount );
556cdf0e10cSrcweir pFoundDock->nType = pDockWin->GetType();
557cdf0e10cSrcweir nLine++;
558cdf0e10cSrcweir nPos = 0;
559cdf0e10cSrcweir bNewLine = sal_True;
560cdf0e10cSrcweir pFoundDock->bNewLine = bNewLine;
561cdf0e10cSrcweir bSaveConfig = sal_True;
562cdf0e10cSrcweir }
563cdf0e10cSrcweir
564cdf0e10cSrcweir pFoundDock->pWin = pDockWin;
565cdf0e10cSrcweir pFoundDock->bHide = sal_False;
566cdf0e10cSrcweir InsertWindow_Impl( pFoundDock, rSize, nLine, nPos, bNewLine );
567cdf0e10cSrcweir if ( bSaveConfig )
568cdf0e10cSrcweir SaveConfig_Impl();
569cdf0e10cSrcweir }
570cdf0e10cSrcweir
571cdf0e10cSrcweir //-------------------------------------------------------------------------
572cdf0e10cSrcweir
ReleaseWindow_Impl(SfxDockingWindow * pDockWin,sal_Bool bSave)573cdf0e10cSrcweir void SfxSplitWindow::ReleaseWindow_Impl(SfxDockingWindow *pDockWin, sal_Bool bSave)
574cdf0e10cSrcweir
575cdf0e10cSrcweir /* [Beschreibung]
576cdf0e10cSrcweir
5773b720757SAriel Constenla-Haile Das DockingWindow wird nicht mehr in den internen Daten gespeichert.
578cdf0e10cSrcweir */
579cdf0e10cSrcweir
580cdf0e10cSrcweir {
581cdf0e10cSrcweir SfxDock_Impl *pDock=0;
582cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count();
583cdf0e10cSrcweir sal_Bool bFound = sal_False;
584cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ )
585cdf0e10cSrcweir {
586cdf0e10cSrcweir pDock = (*pDockArr)[n];
587cdf0e10cSrcweir if ( pDock->nType == pDockWin->GetType() )
588cdf0e10cSrcweir {
589cdf0e10cSrcweir if ( pDock->bNewLine && n<nCount-1 )
590cdf0e10cSrcweir (*pDockArr)[n+1]->bNewLine = sal_True;
591cdf0e10cSrcweir
592cdf0e10cSrcweir // Fenster hat schon eine Position, die vergessen wir
593cdf0e10cSrcweir bFound = sal_True;
594cdf0e10cSrcweir pDockArr->Remove(n);
595cdf0e10cSrcweir break;
596cdf0e10cSrcweir }
597cdf0e10cSrcweir }
598cdf0e10cSrcweir
599cdf0e10cSrcweir if ( bFound )
600cdf0e10cSrcweir delete pDock;
601cdf0e10cSrcweir
602cdf0e10cSrcweir if ( bSave )
603cdf0e10cSrcweir SaveConfig_Impl();
604cdf0e10cSrcweir }
605cdf0e10cSrcweir
606cdf0e10cSrcweir //-------------------------------------------------------------------------
607cdf0e10cSrcweir
MoveWindow(SfxDockingWindow * pDockWin,const Size & rSize,sal_uInt16 nLine,sal_uInt16 nPos,sal_Bool bNewLine)608cdf0e10cSrcweir void SfxSplitWindow::MoveWindow( SfxDockingWindow* pDockWin, const Size& rSize,
609cdf0e10cSrcweir sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine)
610cdf0e10cSrcweir
611cdf0e10cSrcweir /* [Beschreibung]
612cdf0e10cSrcweir
613cdf0e10cSrcweir Das DockingWindow wird innerhalb des Splitwindows verschoben.
614cdf0e10cSrcweir
615cdf0e10cSrcweir */
616cdf0e10cSrcweir
617cdf0e10cSrcweir {
618cdf0e10cSrcweir sal_uInt16 nL, nP;
619cdf0e10cSrcweir GetWindowPos( pDockWin, nL, nP );
620cdf0e10cSrcweir
621cdf0e10cSrcweir if ( nLine > nL && GetItemCount( GetItemId( nL, 0 ) ) == 1 )
622cdf0e10cSrcweir {
623cdf0e10cSrcweir // Wenn das letzte Fenster aus seiner Zeile entfernt wird, rutscht
624cdf0e10cSrcweir // alles eine Zeile nach vorne!
625cdf0e10cSrcweir nLine--;
626cdf0e10cSrcweir }
627cdf0e10cSrcweir /*
628cdf0e10cSrcweir else if ( nLine == nL && nPos > nP )
629cdf0e10cSrcweir {
630cdf0e10cSrcweir nPos--;
631cdf0e10cSrcweir }
632cdf0e10cSrcweir */
633cdf0e10cSrcweir RemoveWindow( pDockWin );
634cdf0e10cSrcweir InsertWindow( pDockWin, rSize, nLine, nPos, bNewLine );
635cdf0e10cSrcweir }
636cdf0e10cSrcweir
637cdf0e10cSrcweir //-------------------------------------------------------------------------
638cdf0e10cSrcweir
InsertWindow(SfxDockingWindow * pDockWin,const Size & rSize,sal_uInt16 nLine,sal_uInt16 nPos,sal_Bool bNewLine)639cdf0e10cSrcweir void SfxSplitWindow::InsertWindow( SfxDockingWindow* pDockWin, const Size& rSize,
640cdf0e10cSrcweir sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine)
641cdf0e10cSrcweir
642cdf0e10cSrcweir /* [Beschreibung]
643cdf0e10cSrcweir
644cdf0e10cSrcweir Das DockingWindow wird in dieses Splitwindow geschoben und soll die
645cdf0e10cSrcweir "ubergebene Position und Gr"o\se haben.
646cdf0e10cSrcweir
647cdf0e10cSrcweir */
648cdf0e10cSrcweir {
649cdf0e10cSrcweir ReleaseWindow_Impl( pDockWin, sal_False );
650cdf0e10cSrcweir SfxDock_Impl *pDock = new SfxDock_Impl;
651cdf0e10cSrcweir pDock->bHide = sal_False;
652cdf0e10cSrcweir pDock->nType = pDockWin->GetType();
653cdf0e10cSrcweir pDock->bNewLine = bNewLine;
654cdf0e10cSrcweir pDock->pWin = pDockWin;
655cdf0e10cSrcweir
6563b720757SAriel Constenla-Haile DBG_ASSERT( nPos==0 || !bNewLine, "Falsche Paramenter!");
657cdf0e10cSrcweir if ( bNewLine )
658cdf0e10cSrcweir nPos = 0;
659cdf0e10cSrcweir
6603b720757SAriel Constenla-Haile // Das Fenster mu\s vor dem ersten Fenster eingef"ugt werden, das die
6613b720757SAriel Constenla-Haile // gleiche oder eine gr"o\sere Position hat als pDockWin.
6620abcfe85SEric Bachard sal_uInt16 nCount = pDockArr->Count();
663cdf0e10cSrcweir
6643b720757SAriel Constenla-Haile // Wenn gar kein Fenster gefunden wird, wird als erstes eingef"ugt
665cdf0e10cSrcweir sal_uInt16 nInsertPos = 0;
666cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ )
667cdf0e10cSrcweir {
668cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[n];
669cdf0e10cSrcweir
670cdf0e10cSrcweir if (pD->pWin)
671cdf0e10cSrcweir {
672cdf0e10cSrcweir // Ein angedocktes Fenster wurde gefunden
673cdf0e10cSrcweir // Wenn kein geeignetes Fenster hinter der gew"unschten Einf"ugeposition
674cdf0e10cSrcweir // gefunden wird, wird am Ende eingef"ugt
675cdf0e10cSrcweir nInsertPos = nCount;
676cdf0e10cSrcweir sal_uInt16 nL=0, nP=0;
677cdf0e10cSrcweir GetWindowPos( pD->pWin, nL, nP );
678cdf0e10cSrcweir
679cdf0e10cSrcweir if ( (nL == nLine && nP == nPos) || nL > nLine )
680cdf0e10cSrcweir {
6813b720757SAriel Constenla-Haile DBG_ASSERT( nL == nLine || bNewLine || nPos > 0, "Falsche Parameter!" );
682cdf0e10cSrcweir if ( nL == nLine && nPos == 0 && !bNewLine )
683cdf0e10cSrcweir {
6843b720757SAriel Constenla-Haile DBG_ASSERT(pD->bNewLine, "Keine neue Zeile?");
685cdf0e10cSrcweir
686cdf0e10cSrcweir // Das Fenster wird auf nPos==0 eingeschoben
687cdf0e10cSrcweir pD->bNewLine = sal_False;
688cdf0e10cSrcweir pDock->bNewLine = sal_True;
689cdf0e10cSrcweir }
690cdf0e10cSrcweir
6913b720757SAriel Constenla-Haile nInsertPos = n;
692cdf0e10cSrcweir break;
693cdf0e10cSrcweir }
694cdf0e10cSrcweir }
695cdf0e10cSrcweir }
696cdf0e10cSrcweir
697cdf0e10cSrcweir pDockArr->Insert(pDock, nInsertPos);
698cdf0e10cSrcweir InsertWindow_Impl( pDock, rSize, nLine, nPos, bNewLine );
699cdf0e10cSrcweir SaveConfig_Impl();
700cdf0e10cSrcweir }
701cdf0e10cSrcweir
702cdf0e10cSrcweir //-------------------------------------------------------------------------
703cdf0e10cSrcweir
InsertWindow_Impl(SfxDock_Impl * pDock,const Size & rSize,sal_uInt16 nLine,sal_uInt16 nPos,sal_Bool bNewLine)704cdf0e10cSrcweir void SfxSplitWindow::InsertWindow_Impl( SfxDock_Impl* pDock,
705cdf0e10cSrcweir const Size& rSize,
706cdf0e10cSrcweir sal_uInt16 nLine, sal_uInt16 nPos, sal_Bool bNewLine)
707cdf0e10cSrcweir
708cdf0e10cSrcweir /* [Beschreibung]
709cdf0e10cSrcweir
710cdf0e10cSrcweir F"ugt ein DockingWindow ein und veranla\st die Neuberechnung der Gr"o\se
711cdf0e10cSrcweir des Splitwindows.
712cdf0e10cSrcweir */
713cdf0e10cSrcweir
714cdf0e10cSrcweir {
715cdf0e10cSrcweir SfxDockingWindow* pDockWin = pDock->pWin;
716cdf0e10cSrcweir
717cdf0e10cSrcweir sal_uInt16 nItemBits = pDockWin->GetWinBits_Impl();
718cdf0e10cSrcweir
719cdf0e10cSrcweir long nWinSize, nSetSize;
720cdf0e10cSrcweir if ( IsHorizontal() )
721cdf0e10cSrcweir {
722cdf0e10cSrcweir nWinSize = rSize.Width();
723cdf0e10cSrcweir nSetSize = rSize.Height();
724cdf0e10cSrcweir }
725cdf0e10cSrcweir else
726cdf0e10cSrcweir {
727cdf0e10cSrcweir nSetSize = rSize.Width();
728cdf0e10cSrcweir nWinSize = rSize.Height();
729cdf0e10cSrcweir }
730cdf0e10cSrcweir
731cdf0e10cSrcweir pDock->nSize = nWinSize;
732cdf0e10cSrcweir
733*01e38eabSOliver-Rainer Wittmann DeactivateUpdateMode* pDeactivateUpdateMode = new DeactivateUpdateMode( *this );
734cdf0e10cSrcweir
735cdf0e10cSrcweir if ( bNewLine || nLine == GetItemCount( 0 ) )
736cdf0e10cSrcweir {
737cdf0e10cSrcweir // Es soll nicht in eine vorhandene Zeile eingef"ugt werden, sondern
738cdf0e10cSrcweir // eine neue erzeugt werden
739cdf0e10cSrcweir
740cdf0e10cSrcweir sal_uInt16 nId = 1;
741cdf0e10cSrcweir for ( sal_uInt16 n=0; n<GetItemCount(0); n++ )
742cdf0e10cSrcweir {
743cdf0e10cSrcweir if ( GetItemId(n) >= nId )
744cdf0e10cSrcweir nId = GetItemId(n)+1;
745cdf0e10cSrcweir }
746cdf0e10cSrcweir
747cdf0e10cSrcweir // Eine neue nLine-te Zeile erzeugen
748cdf0e10cSrcweir sal_uInt16 nBits = nItemBits;
749cdf0e10cSrcweir if ( GetAlign() == WINDOWALIGN_TOP || GetAlign() == WINDOWALIGN_BOTTOM )
750cdf0e10cSrcweir nBits |= SWIB_COLSET;
751cdf0e10cSrcweir InsertItem( nId, nSetSize, nLine, 0, nBits );
752cdf0e10cSrcweir }
753cdf0e10cSrcweir
754cdf0e10cSrcweir // In Zeile mit Position nLine das Fenster einf"ugen
755cdf0e10cSrcweir // ItemWindowSize auf "Prozentual" setzen, da SV dann das Umgr"o\sern
756cdf0e10cSrcweir // so macht, wie man erwartet; "Pixel" macht eigentlich nur Sinn, wenn
757cdf0e10cSrcweir // auch Items mit prozentualen oder relativen Gr"o\sen dabei sind.
758cdf0e10cSrcweir nItemBits |= SWIB_PERCENTSIZE;
759cdf0e10cSrcweir bLocked = sal_True;
760cdf0e10cSrcweir sal_uInt16 nSet = GetItemId( nLine );
761cdf0e10cSrcweir InsertItem( pDockWin->GetType(), pDockWin, nWinSize, nPos, nSet, nItemBits );
762cdf0e10cSrcweir
763cdf0e10cSrcweir // Splitwindows werden im SFX einmal angelegt und beim Einf"ugen des ersten
764cdf0e10cSrcweir // DockingWindows sichtbar gemacht.
765cdf0e10cSrcweir if ( GetItemCount( 0 ) == 1 && GetItemCount( 1 ) == 1 )
766cdf0e10cSrcweir {
767cdf0e10cSrcweir // Das Neuarrangieren am WorkWindow und ein Show() auf das SplitWindow
768cdf0e10cSrcweir // wird vom SfxDockingwindow veranla\st (->SfxWorkWindow::ConfigChild_Impl)
769cdf0e10cSrcweir if ( !bPinned && !IsFloatingMode() )
770cdf0e10cSrcweir {
771cdf0e10cSrcweir bPinned = sal_True;
772cdf0e10cSrcweir sal_Bool bFadeIn = ( pEmptyWin->nState & 2 ) != 0;
773cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_False;
774cdf0e10cSrcweir SetPinned_Impl( sal_False );
775cdf0e10cSrcweir pEmptyWin->Actualize();
776cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" );
777cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE;
778cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl();
779cdf0e10cSrcweir if ( bFadeIn )
780cdf0e10cSrcweir FadeIn();
781cdf0e10cSrcweir }
782cdf0e10cSrcweir else
783cdf0e10cSrcweir {
784cdf0e10cSrcweir sal_Bool bFadeIn = ( pEmptyWin->nState & 2 ) != 0;
785cdf0e10cSrcweir pEmptyWin->bFadeIn = sal_False;
786cdf0e10cSrcweir pEmptyWin->Actualize();
787cdf0e10cSrcweir #ifdef DBG_UTIL
788cdf0e10cSrcweir if ( !bPinned || !pEmptyWin->bFadeIn )
789cdf0e10cSrcweir {
790cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering empty Splitwindow" );
791cdf0e10cSrcweir }
792cdf0e10cSrcweir else
793cdf0e10cSrcweir {
794cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::InsertWindow_Impl - registering real Splitwindow" );
795cdf0e10cSrcweir }
796cdf0e10cSrcweir #endif
797cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *GetSplitWindow(), eAlign, sal_True )->nVisible = CHILD_VISIBLE;
798cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl();
799cdf0e10cSrcweir if ( bFadeIn )
800cdf0e10cSrcweir FadeIn();
801cdf0e10cSrcweir }
802cdf0e10cSrcweir
803cdf0e10cSrcweir pWorkWin->ShowChilds_Impl();
804cdf0e10cSrcweir }
805cdf0e10cSrcweir
806*01e38eabSOliver-Rainer Wittmann delete pDeactivateUpdateMode;
807*01e38eabSOliver-Rainer Wittmann bLocked = sal_False;
808*01e38eabSOliver-Rainer Wittmann
809*01e38eabSOliver-Rainer Wittmann // workaround insuffiency of <SplitWindow> regarding dock layouting:
810*01e38eabSOliver-Rainer Wittmann // apply FIXED item size as 'original' item size to improve layouting of undock-dock-cycle of a window
811*01e38eabSOliver-Rainer Wittmann {
812*01e38eabSOliver-Rainer Wittmann std::vector< std::pair< sal_uInt16, long > > aNewOrgSizes;
813*01e38eabSOliver-Rainer Wittmann // get FIXED item sizes
814*01e38eabSOliver-Rainer Wittmann sal_uInt16 nCount = pDockArr->Count();
815*01e38eabSOliver-Rainer Wittmann for ( sal_uInt16 n=0; n<nCount; n++ )
816*01e38eabSOliver-Rainer Wittmann {
817*01e38eabSOliver-Rainer Wittmann SfxDock_Impl *pD = (*pDockArr)[n];
818*01e38eabSOliver-Rainer Wittmann if ( pD->pWin )
819*01e38eabSOliver-Rainer Wittmann {
820*01e38eabSOliver-Rainer Wittmann const sal_uInt16 nId = pD->nType;
821*01e38eabSOliver-Rainer Wittmann const long nSize = GetItemSize( nId, SWIB_FIXED );
822*01e38eabSOliver-Rainer Wittmann aNewOrgSizes.push_back( std::pair< sal_uInt16, long >( nId, nSize ) );
823*01e38eabSOliver-Rainer Wittmann }
824*01e38eabSOliver-Rainer Wittmann }
825*01e38eabSOliver-Rainer Wittmann // apply new item sizes
826*01e38eabSOliver-Rainer Wittmann DeactivateUpdateMode aDeactivateUpdateMode( *this );
827*01e38eabSOliver-Rainer Wittmann for ( sal_uInt16 i = 0; i < aNewOrgSizes.size(); ++i )
828*01e38eabSOliver-Rainer Wittmann {
829*01e38eabSOliver-Rainer Wittmann SetItemSize( aNewOrgSizes[i].first, aNewOrgSizes[i].second );
830*01e38eabSOliver-Rainer Wittmann }
831*01e38eabSOliver-Rainer Wittmann }
832cdf0e10cSrcweir }
833cdf0e10cSrcweir
834cdf0e10cSrcweir //-------------------------------------------------------------------------
835cdf0e10cSrcweir
RemoveWindow(SfxDockingWindow * pDockWin,sal_Bool bHide)836cdf0e10cSrcweir void SfxSplitWindow::RemoveWindow( SfxDockingWindow* pDockWin, sal_Bool bHide )
837cdf0e10cSrcweir
838cdf0e10cSrcweir /* [Beschreibung]
839cdf0e10cSrcweir
840cdf0e10cSrcweir Entfernt ein DockingWindow. Wenn es das letzte war, wird das SplitWindow
841cdf0e10cSrcweir gehidet.
842cdf0e10cSrcweir */
843cdf0e10cSrcweir {
844cdf0e10cSrcweir sal_uInt16 nSet = GetSet( pDockWin->GetType() );
845cdf0e10cSrcweir
846cdf0e10cSrcweir // Splitwindows werden im SFX einmal angelegt und nach dem Entfernen
847cdf0e10cSrcweir // des letzten DockingWindows unsichtbar gemacht.
848cdf0e10cSrcweir if ( GetItemCount( nSet ) == 1 && GetItemCount( 0 ) == 1 )
849cdf0e10cSrcweir {
850cdf0e10cSrcweir // Das Neuarrangieren am WorkWindow wird vom SfxDockingwindow
851cdf0e10cSrcweir // veranla\st!
852cdf0e10cSrcweir Hide();
853cdf0e10cSrcweir pEmptyWin->aTimer.Stop();
854cdf0e10cSrcweir sal_uInt16 nRealState = pEmptyWin->nState;
855cdf0e10cSrcweir FadeOut_Impl();
856cdf0e10cSrcweir pEmptyWin->Hide();
857cdf0e10cSrcweir #ifdef DBG_UTIL
858cdf0e10cSrcweir if ( !bPinned || !pEmptyWin->bFadeIn )
859cdf0e10cSrcweir {
860cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::RemoveWindow - releasing empty Splitwindow" );
861cdf0e10cSrcweir }
862cdf0e10cSrcweir else
863cdf0e10cSrcweir {
864cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::RemoveWindow - releasing real Splitwindow" );
865cdf0e10cSrcweir }
866cdf0e10cSrcweir #endif
867cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *GetSplitWindow() );
868cdf0e10cSrcweir pEmptyWin->nState = nRealState;
869cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this );
870cdf0e10cSrcweir }
871cdf0e10cSrcweir
872cdf0e10cSrcweir SfxDock_Impl *pDock=0;
873cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count();
874cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ )
875cdf0e10cSrcweir {
876cdf0e10cSrcweir pDock = (*pDockArr)[n];
877cdf0e10cSrcweir if ( pDock->nType == pDockWin->GetType() )
878cdf0e10cSrcweir {
879cdf0e10cSrcweir pDock->pWin = 0;
880cdf0e10cSrcweir pDock->bHide = bHide;
881cdf0e10cSrcweir break;
882cdf0e10cSrcweir }
883cdf0e10cSrcweir }
884cdf0e10cSrcweir
885cdf0e10cSrcweir // Fenster removen, und wenn es das letzte der Zeile war, auch die Zeile
886cdf0e10cSrcweir // ( Zeile = ItemSet )
887*01e38eabSOliver-Rainer Wittmann DeactivateUpdateMode* pDeactivateUpdateMode = new DeactivateUpdateMode( *this );
888*01e38eabSOliver-Rainer Wittmann bLocked = sal_True;
889cdf0e10cSrcweir
890cdf0e10cSrcweir RemoveItem( pDockWin->GetType() );
891cdf0e10cSrcweir
892cdf0e10cSrcweir if ( nSet && !GetItemCount( nSet ) )
893cdf0e10cSrcweir RemoveItem( nSet );
894cdf0e10cSrcweir
895*01e38eabSOliver-Rainer Wittmann delete pDeactivateUpdateMode;
896*01e38eabSOliver-Rainer Wittmann bLocked = sal_False;
897cdf0e10cSrcweir };
898cdf0e10cSrcweir
899cdf0e10cSrcweir //-------------------------------------------------------------------------
900cdf0e10cSrcweir
GetWindowPos(const SfxDockingWindow * pWindow,sal_uInt16 & rLine,sal_uInt16 & rPos) const901cdf0e10cSrcweir sal_Bool SfxSplitWindow::GetWindowPos( const SfxDockingWindow* pWindow,
902cdf0e10cSrcweir sal_uInt16& rLine, sal_uInt16& rPos ) const
903cdf0e10cSrcweir /* [Beschreibung]
904cdf0e10cSrcweir
905cdf0e10cSrcweir Liefert die Id des Itemsets und die des Items f"ur das "ubergebene
906cdf0e10cSrcweir DockingWindow in der alten Zeilen/Spalten-Bezeichnung zur"uck.
907cdf0e10cSrcweir */
908cdf0e10cSrcweir
909cdf0e10cSrcweir {
910cdf0e10cSrcweir sal_uInt16 nSet = GetSet ( pWindow->GetType() );
911cdf0e10cSrcweir if ( nSet == SPLITWINDOW_ITEM_NOTFOUND )
912cdf0e10cSrcweir return sal_False;
913cdf0e10cSrcweir
914cdf0e10cSrcweir rPos = GetItemPos( pWindow->GetType(), nSet );
915cdf0e10cSrcweir rLine = GetItemPos( nSet );
916cdf0e10cSrcweir return sal_True;
917cdf0e10cSrcweir }
918cdf0e10cSrcweir
919cdf0e10cSrcweir //-------------------------------------------------------------------------
920cdf0e10cSrcweir
GetWindowPos(const Point & rTestPos,sal_uInt16 & rLine,sal_uInt16 & rPos) const921cdf0e10cSrcweir sal_Bool SfxSplitWindow::GetWindowPos( const Point& rTestPos,
922cdf0e10cSrcweir sal_uInt16& rLine, sal_uInt16& rPos ) const
923cdf0e10cSrcweir /* [Beschreibung]
924cdf0e10cSrcweir
925cdf0e10cSrcweir Liefert die Id des Itemsets und die des Items f"ur das DockingWindow
926cdf0e10cSrcweir an der "ubergebenen Position in der alten Zeilen/Spalten-Bezeichnung
927cdf0e10cSrcweir zur"uck.
928cdf0e10cSrcweir */
929cdf0e10cSrcweir
930cdf0e10cSrcweir {
931cdf0e10cSrcweir sal_uInt16 nId = GetItemId( rTestPos );
932cdf0e10cSrcweir if ( nId == 0 )
933cdf0e10cSrcweir return sal_False;
934cdf0e10cSrcweir
935cdf0e10cSrcweir sal_uInt16 nSet = GetSet ( nId );
936cdf0e10cSrcweir rPos = GetItemPos( nId, nSet );
937cdf0e10cSrcweir rLine = GetItemPos( nSet );
938cdf0e10cSrcweir return sal_True;
939cdf0e10cSrcweir }
940cdf0e10cSrcweir
941cdf0e10cSrcweir //-------------------------------------------------------------------------
942cdf0e10cSrcweir
GetLineCount() const943cdf0e10cSrcweir sal_uInt16 SfxSplitWindow::GetLineCount() const
944cdf0e10cSrcweir
945cdf0e10cSrcweir /* [Beschreibung]
946cdf0e10cSrcweir
947cdf0e10cSrcweir Liefert die Zeilenzahl = Zahl der Sub-Itemsets im Root-Set.
948cdf0e10cSrcweir */
949cdf0e10cSrcweir {
950cdf0e10cSrcweir return GetItemCount( 0 );
951cdf0e10cSrcweir }
952cdf0e10cSrcweir
953cdf0e10cSrcweir //-------------------------------------------------------------------------
954cdf0e10cSrcweir
GetLineSize(sal_uInt16 nLine) const955cdf0e10cSrcweir long SfxSplitWindow::GetLineSize( sal_uInt16 nLine ) const
956cdf0e10cSrcweir
957cdf0e10cSrcweir /* [Beschreibung]
958cdf0e10cSrcweir
959cdf0e10cSrcweir Liefert die "Zeilenh"ohe" des nLine-ten Itemsets.
960cdf0e10cSrcweir */
961cdf0e10cSrcweir {
962cdf0e10cSrcweir sal_uInt16 nId = GetItemId( nLine );
963cdf0e10cSrcweir return GetItemSize( nId );
964cdf0e10cSrcweir }
965cdf0e10cSrcweir
966cdf0e10cSrcweir //-------------------------------------------------------------------------
967cdf0e10cSrcweir
GetWindowCount(sal_uInt16 nLine) const968cdf0e10cSrcweir sal_uInt16 SfxSplitWindow::GetWindowCount( sal_uInt16 nLine ) const
969cdf0e10cSrcweir
970cdf0e10cSrcweir /* [Beschreibung]
971cdf0e10cSrcweir
972cdf0e10cSrcweir Liefert die
973cdf0e10cSrcweir */
974cdf0e10cSrcweir {
975cdf0e10cSrcweir sal_uInt16 nId = GetItemId( nLine );
976cdf0e10cSrcweir return GetItemCount( nId );
977cdf0e10cSrcweir }
978cdf0e10cSrcweir
979cdf0e10cSrcweir //-------------------------------------------------------------------------
980cdf0e10cSrcweir
GetWindowCount() const981cdf0e10cSrcweir sal_uInt16 SfxSplitWindow::GetWindowCount() const
982cdf0e10cSrcweir
983cdf0e10cSrcweir /* [Beschreibung]
984cdf0e10cSrcweir
985cdf0e10cSrcweir Liefert die Gesamtzahl aller Fenstert
986cdf0e10cSrcweir */
987cdf0e10cSrcweir {
988cdf0e10cSrcweir return GetItemCount( 0 );
989cdf0e10cSrcweir }
990cdf0e10cSrcweir
991cdf0e10cSrcweir //-------------------------------------------------------------------------
992cdf0e10cSrcweir
Command(const CommandEvent & rCEvt)993cdf0e10cSrcweir void SfxSplitWindow::Command( const CommandEvent& rCEvt )
994cdf0e10cSrcweir {
995cdf0e10cSrcweir SplitWindow::Command( rCEvt );
996cdf0e10cSrcweir }
997cdf0e10cSrcweir
998cdf0e10cSrcweir //-------------------------------------------------------------------------
999cdf0e10cSrcweir
IMPL_LINK(SfxSplitWindow,TimerHdl,Timer *,pTimer)1000cdf0e10cSrcweir IMPL_LINK( SfxSplitWindow, TimerHdl, Timer*, pTimer)
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir if ( pTimer )
1003cdf0e10cSrcweir pTimer->Stop();
1004cdf0e10cSrcweir
1005cdf0e10cSrcweir if ( CursorIsOverRect( sal_False ) || !pTimer )
1006cdf0e10cSrcweir {
1007cdf0e10cSrcweir // Wenn der Mauszeiger innerhalb des Fensters liegt, SplitWindow anzeigen
1008cdf0e10cSrcweir // und Timer zum Schlie\sen aufsetzen
1009cdf0e10cSrcweir pEmptyWin->bAutoHide = sal_True;
1010cdf0e10cSrcweir if ( !IsVisible() )
1011cdf0e10cSrcweir pEmptyWin->FadeIn();
1012cdf0e10cSrcweir
1013cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel();
1014cdf0e10cSrcweir pEmptyWin->aTimer.Start();
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir else if ( pEmptyWin->bAutoHide )
1017cdf0e10cSrcweir {
1018cdf0e10cSrcweir if ( GetPointerPosPixel() != pEmptyWin->aLastPos )
1019cdf0e10cSrcweir {
1020cdf0e10cSrcweir // Die Maus wurd innerhalb der Timerlaugzeit bewegt, also erst einmal
1021cdf0e10cSrcweir // nichts tun
1022cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel();
1023cdf0e10cSrcweir pEmptyWin->aTimer.Start();
1024cdf0e10cSrcweir return 0L;
1025cdf0e10cSrcweir }
1026cdf0e10cSrcweir
1027cdf0e10cSrcweir // Speziell f"ur TF_AUTOSHOW_ON_MOUSEMOVE :
1028cdf0e10cSrcweir // Wenn das Fenster nicht sichtbar ist, gibt es nichts zu tun
1029cdf0e10cSrcweir // (Benutzer ist einfach mit der Maus "uber pEmptyWin gefahren)
1030cdf0e10cSrcweir if ( IsVisible() )
1031cdf0e10cSrcweir {
1032cdf0e10cSrcweir pEmptyWin->bEndAutoHide = sal_False;
1033cdf0e10cSrcweir if ( !Application::IsInModalMode() &&
1034cdf0e10cSrcweir !PopupMenu::IsInExecute() &&
1035cdf0e10cSrcweir !pEmptyWin->bSplit && !HasChildPathFocus( sal_True ) )
1036cdf0e10cSrcweir {
1037cdf0e10cSrcweir // W"ahrend ein modaler Dialog oder ein Popupmenu offen sind
1038cdf0e10cSrcweir // oder w"ahrend des Splittens auf keinen Fall zumachen; auch
1039cdf0e10cSrcweir // solange eines der Children den Focus hat, bleibt das
1040cdf0e10cSrcweir // das Fenster offen
1041cdf0e10cSrcweir pEmptyWin->bEndAutoHide = sal_True;
1042cdf0e10cSrcweir }
1043cdf0e10cSrcweir
1044cdf0e10cSrcweir if ( pEmptyWin->bEndAutoHide )
1045cdf0e10cSrcweir {
1046cdf0e10cSrcweir // Von mir aus kann Schlu\s sein mit AutoShow
1047cdf0e10cSrcweir // Aber vielleicht will noch ein anderes SfxSplitWindow offen bleiben,
1048cdf0e10cSrcweir // dann bleiben auch alle anderen offen
1049cdf0e10cSrcweir if ( !pWorkWin->IsAutoHideMode( this ) )
1050cdf0e10cSrcweir {
1051cdf0e10cSrcweir FadeOut_Impl();
1052cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this );
1053cdf0e10cSrcweir }
1054cdf0e10cSrcweir else
1055cdf0e10cSrcweir {
1056cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel();
1057cdf0e10cSrcweir pEmptyWin->aTimer.Start();
1058cdf0e10cSrcweir }
1059cdf0e10cSrcweir }
1060cdf0e10cSrcweir else
1061cdf0e10cSrcweir {
1062cdf0e10cSrcweir pEmptyWin->aLastPos = GetPointerPosPixel();
1063cdf0e10cSrcweir pEmptyWin->aTimer.Start();
1064cdf0e10cSrcweir }
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir }
1067cdf0e10cSrcweir
1068cdf0e10cSrcweir return 0L;
1069cdf0e10cSrcweir }
1070cdf0e10cSrcweir
1071cdf0e10cSrcweir //-------------------------------------------------------------------------
1072cdf0e10cSrcweir
CursorIsOverRect(sal_Bool bForceAdding) const1073cdf0e10cSrcweir sal_Bool SfxSplitWindow::CursorIsOverRect( sal_Bool bForceAdding ) const
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir sal_Bool bVisible = IsVisible();
1076cdf0e10cSrcweir
1077cdf0e10cSrcweir // Auch das kollabierte SplitWindow ber"ucksichtigen
1078cdf0e10cSrcweir Point aPos = pEmptyWin->GetParent()->OutputToScreenPixel( pEmptyWin->GetPosPixel() );
1079cdf0e10cSrcweir Size aSize = pEmptyWin->GetSizePixel();
1080cdf0e10cSrcweir
1081cdf0e10cSrcweir if ( bForceAdding )
1082cdf0e10cSrcweir {
1083cdf0e10cSrcweir // Um +/- ein paar Pixel erweitern, sonst ist es zu nerv"os
1084cdf0e10cSrcweir aPos.X() -= nPixel;
1085cdf0e10cSrcweir aPos.Y() -= nPixel;
1086cdf0e10cSrcweir aSize.Width() += 2 * nPixel;
1087cdf0e10cSrcweir aSize.Height() += 2 * nPixel;
1088cdf0e10cSrcweir }
1089cdf0e10cSrcweir
1090cdf0e10cSrcweir Rectangle aRect( aPos, aSize );
1091cdf0e10cSrcweir
1092cdf0e10cSrcweir if ( bVisible )
1093cdf0e10cSrcweir {
1094cdf0e10cSrcweir Point aVisPos = GetPosPixel();
1095cdf0e10cSrcweir Size aVisSize = GetSizePixel();
1096cdf0e10cSrcweir
1097cdf0e10cSrcweir // Um +/- ein paar Pixel erweitern, sonst ist es zu nerv"os
1098cdf0e10cSrcweir aVisPos.X() -= nPixel;
1099cdf0e10cSrcweir aVisPos.Y() -= nPixel;
1100cdf0e10cSrcweir aVisSize.Width() += 2 * nPixel;
1101cdf0e10cSrcweir aVisSize.Height() += 2 * nPixel;
1102cdf0e10cSrcweir
1103cdf0e10cSrcweir Rectangle aVisRect( aVisPos, aVisSize );
1104cdf0e10cSrcweir aRect = aRect.GetUnion( aVisRect );
1105cdf0e10cSrcweir }
1106cdf0e10cSrcweir
1107cdf0e10cSrcweir if ( aRect.IsInside( OutputToScreenPixel( ((Window*)this)->GetPointerPosPixel() ) ) )
1108cdf0e10cSrcweir return sal_True;
1109cdf0e10cSrcweir return sal_False;
1110cdf0e10cSrcweir }
1111cdf0e10cSrcweir
1112cdf0e10cSrcweir //-------------------------------------------------------------------------
1113cdf0e10cSrcweir
GetSplitWindow()1114cdf0e10cSrcweir SplitWindow* SfxSplitWindow::GetSplitWindow()
1115cdf0e10cSrcweir {
1116cdf0e10cSrcweir if ( !bPinned || !pEmptyWin->bFadeIn )
1117cdf0e10cSrcweir return pEmptyWin;
1118cdf0e10cSrcweir return this;
1119cdf0e10cSrcweir }
1120cdf0e10cSrcweir
1121cdf0e10cSrcweir //-------------------------------------------------------------------------
IsFadeIn() const1122cdf0e10cSrcweir sal_Bool SfxSplitWindow::IsFadeIn() const
1123cdf0e10cSrcweir {
1124cdf0e10cSrcweir return pEmptyWin->bFadeIn;
1125cdf0e10cSrcweir }
1126cdf0e10cSrcweir
IsAutoHide(sal_Bool bSelf) const1127cdf0e10cSrcweir sal_Bool SfxSplitWindow::IsAutoHide( sal_Bool bSelf ) const
1128cdf0e10cSrcweir {
1129cdf0e10cSrcweir return bSelf ? pEmptyWin->bAutoHide && !pEmptyWin->bEndAutoHide : pEmptyWin->bAutoHide;
1130cdf0e10cSrcweir }
1131cdf0e10cSrcweir
1132cdf0e10cSrcweir //-------------------------------------------------------------------------
1133cdf0e10cSrcweir
SetPinned_Impl(sal_Bool bOn)1134cdf0e10cSrcweir void SfxSplitWindow::SetPinned_Impl( sal_Bool bOn )
1135cdf0e10cSrcweir {
1136cdf0e10cSrcweir if ( bPinned == bOn )
1137cdf0e10cSrcweir return;
1138cdf0e10cSrcweir
1139cdf0e10cSrcweir bPinned = bOn;
1140cdf0e10cSrcweir if ( GetItemCount( 0 ) == 0 )
1141cdf0e10cSrcweir return;
1142cdf0e10cSrcweir
1143cdf0e10cSrcweir if ( !bOn )
1144cdf0e10cSrcweir {
1145cdf0e10cSrcweir pEmptyWin->nState |= 1;
1146cdf0e10cSrcweir if ( pEmptyWin->bFadeIn )
1147cdf0e10cSrcweir {
1148cdf0e10cSrcweir // Ersatzfenster anmelden
1149cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing real Splitwindow" );
1150cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *this );
1151cdf0e10cSrcweir Hide();
1152cdf0e10cSrcweir pEmptyWin->Actualize();
1153cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - registering empty Splitwindow" );
1154cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE;
1155cdf0e10cSrcweir }
1156cdf0e10cSrcweir
1157cdf0e10cSrcweir Point aPos( GetPosPixel() );
1158cdf0e10cSrcweir aPos = GetParent()->OutputToScreenPixel( aPos );
1159cdf0e10cSrcweir SetFloatingPos( aPos );
1160cdf0e10cSrcweir SetFloatingMode( sal_True );
1161cdf0e10cSrcweir GetFloatingWindow()->SetOutputSizePixel( GetOutputSizePixel() );
1162cdf0e10cSrcweir
1163cdf0e10cSrcweir if ( pEmptyWin->bFadeIn )
1164cdf0e10cSrcweir Show();
1165cdf0e10cSrcweir }
1166cdf0e10cSrcweir else
1167cdf0e10cSrcweir {
1168cdf0e10cSrcweir pEmptyWin->nState &= ~1;
1169cdf0e10cSrcweir SetOutputSizePixel( GetFloatingWindow()->GetOutputSizePixel() );
1170cdf0e10cSrcweir SetFloatingMode( sal_False );
1171cdf0e10cSrcweir
1172cdf0e10cSrcweir if ( pEmptyWin->bFadeIn )
1173cdf0e10cSrcweir {
1174cdf0e10cSrcweir // Ersatzfenster abmelden
1175cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - releasing empty Splitwindow" );
1176cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *pEmptyWin );
1177cdf0e10cSrcweir pEmptyWin->Hide();
1178cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetPinned_Impl - registering real Splitwindow" );
1179cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE;
1180cdf0e10cSrcweir }
1181cdf0e10cSrcweir }
1182cdf0e10cSrcweir
1183cdf0e10cSrcweir SetAutoHideState( !bPinned );
1184cdf0e10cSrcweir pEmptyWin->SetAutoHideState( !bPinned );
1185cdf0e10cSrcweir }
1186cdf0e10cSrcweir
1187cdf0e10cSrcweir //-------------------------------------------------------------------------
1188cdf0e10cSrcweir
SetFadeIn_Impl(sal_Bool bOn)1189cdf0e10cSrcweir void SfxSplitWindow::SetFadeIn_Impl( sal_Bool bOn )
1190cdf0e10cSrcweir {
1191cdf0e10cSrcweir if ( bOn == pEmptyWin->bFadeIn )
1192cdf0e10cSrcweir return;
1193cdf0e10cSrcweir
1194cdf0e10cSrcweir if ( GetItemCount( 0 ) == 0 )
1195cdf0e10cSrcweir return;
1196cdf0e10cSrcweir
1197cdf0e10cSrcweir pEmptyWin->bFadeIn = bOn;
1198cdf0e10cSrcweir if ( bOn )
1199cdf0e10cSrcweir {
1200cdf0e10cSrcweir pEmptyWin->nState |= 2;
1201cdf0e10cSrcweir if ( IsFloatingMode() )
1202cdf0e10cSrcweir {
1203cdf0e10cSrcweir // FloatingWindow ist nicht sichtbar, also anzeigen
1204cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this );
1205cdf0e10cSrcweir Show();
1206cdf0e10cSrcweir }
1207cdf0e10cSrcweir else
1208cdf0e10cSrcweir {
1209cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing empty Splitwindow" );
1210cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *pEmptyWin );
1211cdf0e10cSrcweir pEmptyWin->Hide();
1212cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering real Splitwindow" );
1213cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *this, eAlign, sal_True )->nVisible = CHILD_VISIBLE;
1214cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl();
1215cdf0e10cSrcweir pWorkWin->ShowChilds_Impl();
1216cdf0e10cSrcweir }
1217cdf0e10cSrcweir }
1218cdf0e10cSrcweir else
1219cdf0e10cSrcweir {
1220cdf0e10cSrcweir pEmptyWin->bAutoHide = sal_False;
1221cdf0e10cSrcweir pEmptyWin->nState &= ~2;
1222cdf0e10cSrcweir if ( !IsFloatingMode() )
1223cdf0e10cSrcweir {
1224cdf0e10cSrcweir // Das Fenster "schwebt" nicht, soll aber ausgeblendet werden,
1225cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - releasing real Splitwindow" );
1226cdf0e10cSrcweir pWorkWin->ReleaseChild_Impl( *this );
1227cdf0e10cSrcweir Hide();
1228cdf0e10cSrcweir pEmptyWin->Actualize();
1229cdf0e10cSrcweir DBG_TRACE( "SfxSplitWindow::SetFadeIn_Impl - registering empty Splitwindow" );
1230cdf0e10cSrcweir pWorkWin->RegisterChild_Impl( *pEmptyWin, eAlign, sal_True )->nVisible = CHILD_VISIBLE;
1231cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl();
1232cdf0e10cSrcweir pWorkWin->ShowChilds_Impl();
1233cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this );
1234cdf0e10cSrcweir }
1235cdf0e10cSrcweir else
1236cdf0e10cSrcweir {
1237cdf0e10cSrcweir Hide();
1238cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this );
1239cdf0e10cSrcweir }
1240cdf0e10cSrcweir }
1241cdf0e10cSrcweir }
1242cdf0e10cSrcweir
AutoHide()1243cdf0e10cSrcweir void SfxSplitWindow::AutoHide()
1244cdf0e10cSrcweir {
1245cdf0e10cSrcweir // Wenn dieser Handler am "echten" SplitWindow aufgerufen wird, ist es
1246cdf0e10cSrcweir // entweder angedockt und soll "schwebend" angezeigt werden oder umgekehrt
1247cdf0e10cSrcweir if ( !bPinned )
1248cdf0e10cSrcweir {
1249cdf0e10cSrcweir // Es "schwebt", also wieder andocken
1250cdf0e10cSrcweir SetPinned_Impl( sal_True );
1251cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl();
1252cdf0e10cSrcweir }
1253cdf0e10cSrcweir else
1254cdf0e10cSrcweir {
1255cdf0e10cSrcweir // In den "Schwebezustand" bringen
1256cdf0e10cSrcweir SetPinned_Impl( sal_False );
1257cdf0e10cSrcweir pWorkWin->ArrangeChilds_Impl();
1258cdf0e10cSrcweir pWorkWin->ArrangeAutoHideWindows( this );
1259cdf0e10cSrcweir }
1260cdf0e10cSrcweir
1261cdf0e10cSrcweir pWorkWin->ShowChilds_Impl();
1262cdf0e10cSrcweir SaveConfig_Impl();
1263cdf0e10cSrcweir }
1264cdf0e10cSrcweir
FadeOut_Impl()1265cdf0e10cSrcweir void SfxSplitWindow::FadeOut_Impl()
1266cdf0e10cSrcweir {
1267cdf0e10cSrcweir if ( pEmptyWin->aTimer.IsActive() )
1268cdf0e10cSrcweir {
1269cdf0e10cSrcweir pEmptyWin->bAutoHide = sal_False;
1270cdf0e10cSrcweir pEmptyWin->aTimer.Stop();
1271cdf0e10cSrcweir }
1272cdf0e10cSrcweir
1273cdf0e10cSrcweir SetFadeIn_Impl( sal_False );
1274cdf0e10cSrcweir Show_Impl();
1275cdf0e10cSrcweir }
1276cdf0e10cSrcweir
FadeOut()1277cdf0e10cSrcweir void SfxSplitWindow::FadeOut()
1278cdf0e10cSrcweir {
1279cdf0e10cSrcweir FadeOut_Impl();
1280cdf0e10cSrcweir SaveConfig_Impl();
1281cdf0e10cSrcweir }
1282cdf0e10cSrcweir
FadeIn()1283cdf0e10cSrcweir void SfxSplitWindow::FadeIn()
1284cdf0e10cSrcweir {
1285cdf0e10cSrcweir SetFadeIn_Impl( sal_True );
1286cdf0e10cSrcweir Show_Impl();
1287cdf0e10cSrcweir }
1288cdf0e10cSrcweir
Show_Impl()1289cdf0e10cSrcweir void SfxSplitWindow::Show_Impl()
1290cdf0e10cSrcweir {
1291cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count();
1292cdf0e10cSrcweir for ( sal_uInt16 n=0; n<nCount; n++ )
1293cdf0e10cSrcweir {
1294cdf0e10cSrcweir SfxDock_Impl *pDock = (*pDockArr)[n];
1295cdf0e10cSrcweir if ( pDock->pWin )
1296cdf0e10cSrcweir pDock->pWin->FadeIn( pEmptyWin->bFadeIn );
1297cdf0e10cSrcweir }
1298cdf0e10cSrcweir }
1299cdf0e10cSrcweir /*
1300cdf0e10cSrcweir void SfxSplitWindow::Pin_Impl( sal_Bool bPin )
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir if ( bPinned != bPin )
1303cdf0e10cSrcweir AutoHide();
1304cdf0e10cSrcweir }
1305cdf0e10cSrcweir */
ActivateNextChild_Impl(sal_Bool bForward)1306cdf0e10cSrcweir sal_Bool SfxSplitWindow::ActivateNextChild_Impl( sal_Bool bForward )
1307cdf0e10cSrcweir {
1308cdf0e10cSrcweir // Wenn kein pActive, auf erstes bzw. letztes Fenster gehen ( bei !bForward wird erst in der loop dekrementiert )
1309cdf0e10cSrcweir sal_uInt16 nCount = pDockArr->Count();
1310cdf0e10cSrcweir sal_uInt16 n = bForward ? 0 : nCount;
1311cdf0e10cSrcweir
1312cdf0e10cSrcweir // Wenn Focus innerhalb, dann ein Fenster vor oder zur"uck, wenn m"oglich
1313cdf0e10cSrcweir if ( pActive )
1314cdf0e10cSrcweir {
1315cdf0e10cSrcweir // Aktives Fenster ermitteln
1316cdf0e10cSrcweir for ( n=0; n<nCount; n++ )
1317cdf0e10cSrcweir {
1318cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[n];
1319cdf0e10cSrcweir if ( pD->pWin && pD->pWin->HasChildPathFocus() )
1320cdf0e10cSrcweir break;
1321cdf0e10cSrcweir }
1322cdf0e10cSrcweir
1323cdf0e10cSrcweir if ( bForward )
1324cdf0e10cSrcweir // ein Fenster weiter ( wenn dann n>nCount, wird die Schleife unten gar nicht durchlaufen )
1325cdf0e10cSrcweir n++;
1326cdf0e10cSrcweir }
1327cdf0e10cSrcweir
1328cdf0e10cSrcweir if ( bForward )
1329cdf0e10cSrcweir {
1330cdf0e10cSrcweir // N"achstes Fenster suchen
1331cdf0e10cSrcweir for ( sal_uInt16 nNext=n; nNext<nCount; nNext++ )
1332cdf0e10cSrcweir {
1333cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[nNext];
1334cdf0e10cSrcweir if ( pD->pWin )
1335cdf0e10cSrcweir {
1336cdf0e10cSrcweir pD->pWin->GrabFocus();
1337cdf0e10cSrcweir return sal_True;
1338cdf0e10cSrcweir }
1339cdf0e10cSrcweir }
1340cdf0e10cSrcweir }
1341cdf0e10cSrcweir else
1342cdf0e10cSrcweir {
1343cdf0e10cSrcweir // Vorheriges Fenster suchen
1344cdf0e10cSrcweir for ( sal_uInt16 nNext=n; nNext--; )
1345cdf0e10cSrcweir {
1346cdf0e10cSrcweir SfxDock_Impl *pD = (*pDockArr)[nNext];
1347cdf0e10cSrcweir if ( pD->pWin )
1348cdf0e10cSrcweir {
1349cdf0e10cSrcweir pD->pWin->GrabFocus();
1350cdf0e10cSrcweir return sal_True;
1351cdf0e10cSrcweir }
1352cdf0e10cSrcweir }
1353cdf0e10cSrcweir }
1354cdf0e10cSrcweir
1355cdf0e10cSrcweir return sal_False;
1356cdf0e10cSrcweir }
1357cdf0e10cSrcweir
SetActiveWindow_Impl(SfxDockingWindow * pWin)1358cdf0e10cSrcweir void SfxSplitWindow::SetActiveWindow_Impl( SfxDockingWindow* pWin )
1359cdf0e10cSrcweir {
1360cdf0e10cSrcweir pActive = pWin;
1361cdf0e10cSrcweir pWorkWin->SetActiveChild_Impl( this );
1362cdf0e10cSrcweir }
1363cdf0e10cSrcweir
1364cdf0e10cSrcweir
1365