1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <tools/string.hxx>
23 #include <tools/stream.hxx>
24 #include <vcl/msgbox.hxx>
25 #include <vcl/svapp.hxx>
26 #include <progress.hxx>
28 #include <padialog.hrc>
30 using namespace padmin
;
32 ProgressDialog::ProgressDialog( Window
* pParent
,
34 int nMin
, int nMax
) :
35 ModelessDialog( pParent
, PaResId( RID_PROGRESS_DLG
) ),
36 maOperation( this, PaResId( RID_PROGRESS_OPERATION_TXT
) ),
37 maFilename( this, PaResId( RID_PROGRESS_FILENAME_TXT
) ),
38 maProgressTxt( this, PaResId( RID_PROGRESS_PROGRESS_TXT
) ),
39 maCancelButton( this, PaResId( RID_PROGRESS_BTN_CANCEL
) ),
40 maProgressBar( this, PaResId( RID_PROGRESS_STATUSBAR
) ),
45 maFilename
.SetStyle( maFilename
.GetStyle() | WB_PATHELLIPSIS
);
48 Point aPos
= maProgressBar
.GetPosPixel();
49 Size aSize
= maProgressBar
.GetSizePixel();
50 Size aMySize
= GetOutputSizePixel();
51 aMySize
.Height() = aPos
.Y() + aSize
.Height() + 5;
52 SetOutputSizePixel( aMySize
);
55 maCancelButton
.SetClickHdl( LINK( this, ProgressDialog
, ClickBtnHdl
) );
59 ProgressDialog::~ProgressDialog()
63 void ProgressDialog::startOperation( const String
& rOperation
)
65 maOperation
.SetText( rOperation
);
66 maProgressBar
.SetValue( 0 );
72 void ProgressDialog::setValue( int nValue
)
74 maProgressBar
.SetValue( nValue
* 100 / ( mnMax
- mnMin
) );
75 Application::Reschedule();
78 void ProgressDialog::setFilename( const String
& rFilename
)
80 maFilename
.SetText( rFilename
);
85 IMPL_LINK( ProgressDialog
, ClickBtnHdl
, Button
*, pButton
)
87 if( pButton
== &maCancelButton
)
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */