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: status.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_basic.hxx"
39 #include <vcl/decoview.hxx>
41 StatusLine::StatusLine( BasicFrame
* p
)
45 // initialize TaskToolBox
46 TaskToolBox
* pTempTaskToolBox
= GetTaskToolBox();
47 pTempTaskToolBox
->SetActivateTaskHdl( LINK( this, StatusLine
, ActivateTask
) );
49 // initialize TaskStatusBar
50 TaskStatusBar
* pTempStatusBar
= GetStatusBar();
51 long nCharWidth
= GetTextWidth( '0' ); // We state: All numbers has the same width
52 pTempStatusBar
->InsertItem( ST_MESSAGE
, GetTextWidth( 'X' ) * 20, SIB_LEFT
| SIB_IN
| SIB_AUTOSIZE
);
53 pTempStatusBar
->InsertItem( ST_LINE
, 5*nCharWidth
);
54 pTempStatusBar
->InsertItem( ST_PROF
, GetTextWidth( 'X' ) * 10 );
55 pTempStatusBar
->InsertStatusField();
60 void StatusLine::Message( const String
& s
)
62 GetStatusBar()->SetItemText( ST_MESSAGE
, s
);
65 void StatusLine::Pos( const String
& s
)
67 GetStatusBar()->SetItemText( ST_LINE
, s
);
70 void StatusLine::SetProfileName( const String
& s
)
72 GetStatusBar()->SetItemText( ST_PROF
, s
);
76 IMPL_LINK( StatusLine
, ActivateTask
, TaskToolBox
*, pTTB
)
78 USHORT nFirstWinPos
=0;
79 MenuBar
* pMenu
= pFrame
->GetMenuBar();
80 PopupMenu
* pWinMenu
= pMenu
->GetPopupMenu( RID_APPWINDOW
);
82 while ( pWinMenu
->GetItemId( nFirstWinPos
) < RID_WIN_FILE1
&& nFirstWinPos
< pWinMenu
->GetItemCount() )
85 nFirstWinPos
+= pTTB
->GetItemPos( pTTB
->GetCurItemId() ) / 2;
88 x
= pTTB
->GetItemPos( pTTB
->GetCurItemId() );
89 x
= pWinMenu
->GetItemId( nFirstWinPos
);
90 x
= pWinMenu
->GetItemCount();
91 AppWin
* pWin
= pFrame
->FindWin( pWinMenu
->GetItemText( pWinMenu
->GetItemId( nFirstWinPos
) ).EraseAllChars( L
'~' ) );
94 pWin
->Minimize( FALSE
);
100 void StatusLine::LoadTaskToolBox()
102 USHORT nFirstWinPos
=0;
103 MenuBar
* pMenu
= pFrame
->GetMenuBar();
104 PopupMenu
* pWinMenu
= pMenu
->GetPopupMenu( RID_APPWINDOW
);
106 while ( pWinMenu
->GetItemId( nFirstWinPos
) < RID_WIN_FILE1
&& nFirstWinPos
< pWinMenu
->GetItemCount() )
109 TaskToolBox
* pTaskToolBox
= GetTaskToolBox();
111 pTaskToolBox
->StartUpdateTask();
113 while ( nFirstWinPos
< pWinMenu
->GetItemCount() )
114 { // There are windows
115 Window
* pWin
= pFrame
->FindWin( pWinMenu
->GetItemId( nFirstWinPos
) );
118 pTaskToolBox
->UpdateTask( Image(), pWin
->GetText(), pWin
== pFrame
->pList
->Last() && !( pFrame
->pList
->Last()->GetWinState() & TT_WIN_STATE_HIDE
) );
123 pTaskToolBox
->EndUpdateTask();