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: progress.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 ************************************************************************/
33 #include <tools/string.hxx>
34 #include <tools/stream.hxx>
35 #include <tools/list.hxx>
36 #include <vcl/msgbox.hxx>
37 #include <vcl/svapp.hxx>
38 #include <progress.hxx>
40 #ifndef _PAD_PADIALOG_HRC_
41 #include <padialog.hrc>
44 using namespace padmin
;
46 ProgressDialog::ProgressDialog( Window
* pParent
,
48 int nMin
, int nMax
) :
49 ModelessDialog( pParent
, PaResId( RID_PROGRESS_DLG
) ),
50 maOperation( this, PaResId( RID_PROGRESS_OPERATION_TXT
) ),
51 maFilename( this, PaResId( RID_PROGRESS_FILENAME_TXT
) ),
52 maProgressTxt( this, PaResId( RID_PROGRESS_PROGRESS_TXT
) ),
53 maCancelButton( this, PaResId( RID_PROGRESS_BTN_CANCEL
) ),
54 maProgressBar( this, PaResId( RID_PROGRESS_STATUSBAR
) ),
59 maFilename
.SetStyle( maFilename
.GetStyle() | WB_PATHELLIPSIS
);
62 Point aPos
= maProgressBar
.GetPosPixel();
63 Size aSize
= maProgressBar
.GetSizePixel();
64 Size aMySize
= GetOutputSizePixel();
65 aMySize
.Height() = aPos
.Y() + aSize
.Height() + 5;
66 SetOutputSizePixel( aMySize
);
69 maCancelButton
.SetClickHdl( LINK( this, ProgressDialog
, ClickBtnHdl
) );
73 ProgressDialog::~ProgressDialog()
77 void ProgressDialog::startOperation( const String
& rOperation
)
79 maOperation
.SetText( rOperation
);
80 maProgressBar
.SetValue( 0 );
86 void ProgressDialog::setValue( int nValue
)
88 maProgressBar
.SetValue( nValue
* 100 / ( mnMax
- mnMin
) );
89 Application::Reschedule();
92 void ProgressDialog::setFilename( const String
& rFilename
)
94 maFilename
.SetText( rFilename
);
99 IMPL_LINK( ProgressDialog
, ClickBtnHdl
, Button
*, pButton
)
101 if( pButton
== &maCancelButton
)