xref: /AOO41X/main/sdext/source/minimizer/informationdialog.cxx (revision e381ffea850759a618423acb35064a52cde0145f)
1c142477cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c142477cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c142477cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c142477cSAndrew Rist  * distributed with this work for additional information
6c142477cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c142477cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c142477cSAndrew Rist  * "License"); you may not use this file except in compliance
9c142477cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11c142477cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13c142477cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c142477cSAndrew Rist  * software distributed under the License is distributed on an
15c142477cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c142477cSAndrew Rist  * KIND, either express or implied.  See the License for the
17c142477cSAndrew Rist  * specific language governing permissions and limitations
18c142477cSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20c142477cSAndrew Rist  *************************************************************/
21c142477cSAndrew Rist 
22c142477cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sdext.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "informationdialog.hxx"
28cdf0e10cSrcweir #include "optimizationstats.hxx"
29cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
30cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphicProvider.hpp>
31cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphic.hpp>
32cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
33cdf0e10cSrcweir #include "com/sun/star/util/URL.hpp"
34cdf0e10cSrcweir #include "com/sun/star/util/XURLTransformer.hpp"
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #define DIALOG_WIDTH	240
37cdf0e10cSrcweir #define DIALOG_HEIGHT	80
38cdf0e10cSrcweir #define PAGE_POS_X		35
39cdf0e10cSrcweir #define PAGE_WIDTH		( DIALOG_WIDTH - PAGE_POS_X ) - 6
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 
42cdf0e10cSrcweir // ---------------------
43cdf0e10cSrcweir // - INFORMATIONDIALOG -
44cdf0e10cSrcweir // ---------------------
45cdf0e10cSrcweir 
46cdf0e10cSrcweir using namespace ::rtl;
47cdf0e10cSrcweir using namespace ::com::sun::star;
48cdf0e10cSrcweir using namespace ::com::sun::star::io;
49cdf0e10cSrcweir using namespace ::com::sun::star::ui;
50cdf0e10cSrcweir using namespace ::com::sun::star::awt;
51cdf0e10cSrcweir using namespace ::com::sun::star::uno;
52cdf0e10cSrcweir using namespace ::com::sun::star::util;
53cdf0e10cSrcweir using namespace ::com::sun::star::lang;
54cdf0e10cSrcweir using namespace ::com::sun::star::frame;
55cdf0e10cSrcweir using namespace ::com::sun::star::beans;
56cdf0e10cSrcweir using namespace ::com::sun::star::script;
57cdf0e10cSrcweir using namespace ::com::sun::star::container;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
61cdf0e10cSrcweir // -----------------------------------------------------------------------------
62cdf0e10cSrcweir 
63cdf0e10cSrcweir rtl::OUString InsertFixedText( InformationDialog& rInformationDialog, const rtl::OUString& rControlName, const OUString& rLabel,
64cdf0e10cSrcweir 								sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Bool bMultiLine, sal_Int16 nTabIndex )
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	OUString pNames[] = {
67cdf0e10cSrcweir 		TKGet( TK_Height ),
68cdf0e10cSrcweir 		TKGet( TK_Label ),
69cdf0e10cSrcweir 		TKGet( TK_MultiLine ),
70cdf0e10cSrcweir 		TKGet( TK_PositionX ),
71cdf0e10cSrcweir 		TKGet( TK_PositionY ),
72cdf0e10cSrcweir 		TKGet( TK_Step ),
73cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
74cdf0e10cSrcweir 		TKGet( TK_Width ) };
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	Any	pValues[] = {
77cdf0e10cSrcweir 		Any( nHeight ),
78cdf0e10cSrcweir 		Any( rLabel ),
79cdf0e10cSrcweir 		Any( bMultiLine ),
80cdf0e10cSrcweir 		Any( nXPos ),
81cdf0e10cSrcweir 		Any( nYPos ),
82cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
83cdf0e10cSrcweir 		Any( nTabIndex ),
84cdf0e10cSrcweir 		Any( nWidth ) };
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
89cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	rInformationDialog.insertFixedText( rControlName, aNames, aValues );
92cdf0e10cSrcweir 	return rControlName;
93cdf0e10cSrcweir }
94cdf0e10cSrcweir 
95*e381ffeaSAriel Constenla-Haile rtl::OUString InsertImage(
96*e381ffeaSAriel Constenla-Haile     InformationDialog& rInformationDialog,
97*e381ffeaSAriel Constenla-Haile     const OUString& rControlName,
98*e381ffeaSAriel Constenla-Haile     const OUString& rURL,
99*e381ffeaSAriel Constenla-Haile     sal_Int32 nPosX,
100*e381ffeaSAriel Constenla-Haile     sal_Int32 nPosY,
101*e381ffeaSAriel Constenla-Haile     sal_Int32 nWidth,
102*e381ffeaSAriel Constenla-Haile     sal_Int32 nHeight,
103*e381ffeaSAriel Constenla-Haile     sal_Bool bScale )
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	OUString pNames[] = {
106cdf0e10cSrcweir 		TKGet( TK_Border ),
107cdf0e10cSrcweir 		TKGet( TK_Height ),
108cdf0e10cSrcweir 		TKGet( TK_ImageURL ),
109cdf0e10cSrcweir 		TKGet( TK_PositionX ),
110cdf0e10cSrcweir 		TKGet( TK_PositionY ),
111cdf0e10cSrcweir 		TKGet( TK_ScaleImage ),
112cdf0e10cSrcweir 		TKGet( TK_Width ) };
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	Any	pValues[] = {
115cdf0e10cSrcweir 		Any( sal_Int16( 0 ) ),
116cdf0e10cSrcweir 		Any( nHeight ),
117cdf0e10cSrcweir 		Any( rURL ),
118cdf0e10cSrcweir 		Any( nPosX ),
119cdf0e10cSrcweir 		Any( nPosY ),
120*e381ffeaSAriel Constenla-Haile 		Any( bScale ),
121cdf0e10cSrcweir 		Any( nWidth ) };
122cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
125cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	rInformationDialog.insertImage( rControlName, aNames, aValues );
128cdf0e10cSrcweir 	return rControlName;
129cdf0e10cSrcweir }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir rtl::OUString InsertCheckBox( InformationDialog& rInformationDialog, const OUString& rControlName,
132cdf0e10cSrcweir 	const Reference< XItemListener > xItemListener, const OUString& rLabel,
133cdf0e10cSrcweir 		sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex )
134cdf0e10cSrcweir {
135cdf0e10cSrcweir 	OUString pNames[] = {
136cdf0e10cSrcweir 		TKGet( TK_Enabled ),
137cdf0e10cSrcweir 		TKGet( TK_Height ),
138cdf0e10cSrcweir 		TKGet( TK_Label ),
139cdf0e10cSrcweir 		TKGet( TK_PositionX ),
140cdf0e10cSrcweir 		TKGet( TK_PositionY ),
141cdf0e10cSrcweir 		TKGet( TK_Step ),
142cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
143cdf0e10cSrcweir 		TKGet( TK_Width ) };
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 	Any	pValues[] = {
146cdf0e10cSrcweir 		Any( sal_True ),
147cdf0e10cSrcweir 		Any( nHeight ),
148cdf0e10cSrcweir 		Any( rLabel ),
149cdf0e10cSrcweir 		Any( nXPos ),
150cdf0e10cSrcweir 		Any( nYPos ),
151cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
152cdf0e10cSrcweir 		Any( nTabIndex ),
153cdf0e10cSrcweir 		Any( nWidth ) };
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
158cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
159cdf0e10cSrcweir 
160cdf0e10cSrcweir 	Reference< XCheckBox > xCheckBox( rInformationDialog.insertCheckBox( rControlName, aNames, aValues ) );
161cdf0e10cSrcweir 	if ( xItemListener.is() )
162cdf0e10cSrcweir 		xCheckBox->addItemListener( xItemListener );
163cdf0e10cSrcweir 	return rControlName;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir 
166cdf0e10cSrcweir rtl::OUString InsertButton( InformationDialog& rInformationDialog, const OUString& rControlName, Reference< XActionListener >& xActionListener,
167cdf0e10cSrcweir 	sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nTabIndex, PPPOptimizerTokenEnum nResID )
168cdf0e10cSrcweir {
169cdf0e10cSrcweir 	OUString pNames[] = {
170cdf0e10cSrcweir 		TKGet( TK_Enabled ),
171cdf0e10cSrcweir 		TKGet( TK_Height ),
172cdf0e10cSrcweir 		TKGet( TK_Label ),
173cdf0e10cSrcweir 		TKGet( TK_PositionX ),
174cdf0e10cSrcweir 		TKGet( TK_PositionY ),
175cdf0e10cSrcweir 		TKGet( TK_PushButtonType ),
176cdf0e10cSrcweir 		TKGet( TK_Step ),
177cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
178cdf0e10cSrcweir 		TKGet( TK_Width ) };
179cdf0e10cSrcweir 
180cdf0e10cSrcweir 	Any	pValues[] = {
181cdf0e10cSrcweir 		Any( sal_True ),
182cdf0e10cSrcweir 		Any( nHeight ),
183cdf0e10cSrcweir 		Any( rInformationDialog.getString( nResID ) ),
184cdf0e10cSrcweir 		Any( nXPos ),
185cdf0e10cSrcweir 		Any( nYPos ),
186cdf0e10cSrcweir 		Any( static_cast< sal_Int16 >( PushButtonType_OK ) ),
187cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
188cdf0e10cSrcweir 		Any( nTabIndex ),
189cdf0e10cSrcweir 		Any( nWidth ) };
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
195cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	rInformationDialog.insertButton( rControlName, xActionListener, aNames, aValues );
198cdf0e10cSrcweir 	return rControlName;
199cdf0e10cSrcweir }
200cdf0e10cSrcweir 
201cdf0e10cSrcweir 
202cdf0e10cSrcweir static OUString ImpValueOfInMB( const sal_Int64& rVal )
203cdf0e10cSrcweir {
204cdf0e10cSrcweir 	double fVal( static_cast<double>( rVal ) );
205cdf0e10cSrcweir 	fVal /= ( 1 << 20 );
206cdf0e10cSrcweir 	fVal += 0.05;
207cdf0e10cSrcweir 	rtl::OUStringBuffer aVal( OUString::valueOf( fVal ) );
208cdf0e10cSrcweir 	sal_Int32 nX( OUString( aVal.getStr() ).indexOf( '.', 0 ) );
209cdf0e10cSrcweir 	if ( nX > 0 )
210cdf0e10cSrcweir 		aVal.setLength( nX + 2 );
211cdf0e10cSrcweir 	return aVal.makeStringAndClear();
212cdf0e10cSrcweir }
213cdf0e10cSrcweir 
214cdf0e10cSrcweir void InformationDialog::InitDialog()
215cdf0e10cSrcweir {
216cdf0e10cSrcweir 	sal_Int32 nDialogHeight = DIALOG_HEIGHT;
217cdf0e10cSrcweir 	if ( !maSaveAsURL.getLength() )
218cdf0e10cSrcweir 		nDialogHeight -= 22;
219cdf0e10cSrcweir 
220cdf0e10cSrcweir    // setting the dialog properties
221cdf0e10cSrcweir 	OUString pNames[] = {
222cdf0e10cSrcweir 		TKGet( TK_Closeable ),
223cdf0e10cSrcweir 		TKGet( TK_Height ),
224cdf0e10cSrcweir 		TKGet( TK_Moveable ),
225cdf0e10cSrcweir 		TKGet( TK_PositionX ),
226cdf0e10cSrcweir 		TKGet( TK_PositionY ),
227cdf0e10cSrcweir 		TKGet( TK_Title ),
228cdf0e10cSrcweir 		TKGet( TK_Width ) };
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 	Any	pValues[] = {
231cdf0e10cSrcweir 		Any( sal_True ),
232cdf0e10cSrcweir 		Any( nDialogHeight ),
233cdf0e10cSrcweir 		Any( sal_True ),
234cdf0e10cSrcweir 		Any( sal_Int32( 245 ) ),
235cdf0e10cSrcweir 		Any( sal_Int32( 115 ) ),
236cdf0e10cSrcweir 		Any( getString( STR_SUN_OPTIMIZATION_WIZARD2 ) ),
237cdf0e10cSrcweir 		Any( sal_Int32( DIALOG_WIDTH ) ) };
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
240cdf0e10cSrcweir 
241cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
242cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 	mxDialogModelMultiPropertySet->setPropertyValues( aNames, aValues );
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 	sal_Int64 nSource = mnSourceSize;
247cdf0e10cSrcweir 	sal_Int64 nDest   = mnDestSize;
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 	PPPOptimizerTokenEnum eInfoString( STR_INFO_1 );
250cdf0e10cSrcweir 	if ( mnSourceSize )
251cdf0e10cSrcweir 	{
252cdf0e10cSrcweir 		if ( mnDestSize )
253cdf0e10cSrcweir 			eInfoString = STR_INFO_1;
254cdf0e10cSrcweir 		else
255cdf0e10cSrcweir 		{
256cdf0e10cSrcweir 			eInfoString = STR_INFO_2;
257cdf0e10cSrcweir 			nDest = mnApproxSize;
258cdf0e10cSrcweir 		}
259cdf0e10cSrcweir 	}
260cdf0e10cSrcweir 	else if ( mnDestSize )
261cdf0e10cSrcweir 		eInfoString = STR_INFO_3;
262cdf0e10cSrcweir 	else
263cdf0e10cSrcweir 	{
264cdf0e10cSrcweir 		eInfoString = STR_INFO_4;
265cdf0e10cSrcweir 		nDest = mnApproxSize;
266cdf0e10cSrcweir 	}
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 	rtl::OUString aTitle;
269cdf0e10cSrcweir 	if ( maSaveAsURL.getLength() )
270cdf0e10cSrcweir 	{
271cdf0e10cSrcweir 		Reference< XURLTransformer > xURLTransformer( mxMSF->getServiceManager()->createInstanceWithContext(
272cdf0e10cSrcweir 				OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ), mxMSF ), UNO_QUERY );
273cdf0e10cSrcweir 		if ( xURLTransformer.is() )
274cdf0e10cSrcweir 		{
275cdf0e10cSrcweir 			util::URL aURL, aPresentationURL;
276cdf0e10cSrcweir 			aURL.Complete = maSaveAsURL;
277cdf0e10cSrcweir 			xURLTransformer->parseSmart( aURL, rtl::OUString() );
278cdf0e10cSrcweir 
279cdf0e10cSrcweir 			const OUString sFileProtocol( RTL_CONSTASCII_USTRINGPARAM( "file:///" ) );
280cdf0e10cSrcweir 			aPresentationURL.Complete = sFileProtocol.concat( aURL.Name );
281cdf0e10cSrcweir 			aTitle = xURLTransformer->getPresentation( aPresentationURL, sal_False );
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 			if ( aTitle.match( sFileProtocol, 0 ) )
284cdf0e10cSrcweir 				aTitle = aTitle.replaceAt( 0, sFileProtocol.getLength(), rtl::OUString() );
285cdf0e10cSrcweir 		}
286cdf0e10cSrcweir 	}
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 	OUString aInfoString( getString( eInfoString ) );
289cdf0e10cSrcweir 	const OUString aOldSizePlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%OLDFILESIZE" ) );
290cdf0e10cSrcweir 	const OUString aNewSizePlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%NEWFILESIZE" ) );
291cdf0e10cSrcweir 	const OUString aTitlePlaceholder( aTitle.getLength() ? OUString::createFromAscii( "%TITLE" ) : OUString::createFromAscii( "'%TITLE'" ) );
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 	sal_Int32 i = aInfoString.indexOf( aOldSizePlaceholder, 0 );
294cdf0e10cSrcweir 	if ( i >= 0 )
295cdf0e10cSrcweir 		aInfoString = aInfoString.replaceAt( i, aOldSizePlaceholder.getLength(), ImpValueOfInMB( nSource ) );
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 	sal_Int32 j = aInfoString.indexOf( aNewSizePlaceholder, 0 );
298cdf0e10cSrcweir 	if ( j >= 0 )
299cdf0e10cSrcweir 		aInfoString = aInfoString.replaceAt( j, aNewSizePlaceholder.getLength(), ImpValueOfInMB( nDest ) );
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 	sal_Int32 k = aInfoString.indexOf( aTitlePlaceholder, 0 );
302cdf0e10cSrcweir 	if ( k >= 0 )
303cdf0e10cSrcweir 		aInfoString = aInfoString.replaceAt( k, aTitlePlaceholder.getLength(), aTitle );
304cdf0e10cSrcweir 
305cdf0e10cSrcweir     com::sun::star::uno::Reference< com::sun::star::awt::XItemListener > xItemListener;
306*e381ffeaSAriel Constenla-Haile     InsertImage( *this,
307*e381ffeaSAriel Constenla-Haile                  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "aboutimage" ) ),
308*e381ffeaSAriel Constenla-Haile                  rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:standardimage/query" ) ),
309*e381ffeaSAriel Constenla-Haile                  5, 5, 25, 25, sal_False );
310cdf0e10cSrcweir 	InsertFixedText( *this, rtl::OUString( rtl::OUString::createFromAscii( "fixedtext" ) ), aInfoString, PAGE_POS_X, 6, PAGE_WIDTH, 24, sal_True, 0 );
311cdf0e10cSrcweir 	if ( maSaveAsURL.getLength() )
312cdf0e10cSrcweir 		InsertCheckBox(  *this, TKGet( TK_OpenNewDocument ), xItemListener, getString( STR_AUTOMATICALLY_OPEN ), PAGE_POS_X, 42, PAGE_WIDTH, 8, 1 );
313cdf0e10cSrcweir 	InsertButton( *this, rtl::OUString( rtl::OUString::createFromAscii( "button" ) ), mxActionListener, DIALOG_WIDTH / 2 - 25, nDialogHeight - 20, 50, 14, 2, STR_OK );
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 	sal_Bool bOpenNewDocument = mrbOpenNewDocument;
316cdf0e10cSrcweir 	setControlProperty( TKGet( TK_OpenNewDocument ), TKGet( TK_State ), Any( (sal_Int16)bOpenNewDocument ) );
317cdf0e10cSrcweir }
318cdf0e10cSrcweir 
319cdf0e10cSrcweir // -----------------------------------------------------------------------------
320cdf0e10cSrcweir 
321cdf0e10cSrcweir InformationDialog::InformationDialog( const Reference< XComponentContext > &rxMSF, Reference< XFrame >& rxFrame, const rtl::OUString& rSaveAsURL, sal_Bool& rbOpenNewDocument, const sal_Int64& rSourceSize, const sal_Int64& rDestSize, const sal_Int64& rApproxSize ) :
322cdf0e10cSrcweir 	UnoDialog( rxMSF, rxFrame ),
323cdf0e10cSrcweir 	ConfigurationAccess( rxMSF, NULL ),
324cdf0e10cSrcweir 	mxMSF( rxMSF ),
325cdf0e10cSrcweir 	mxFrame( rxFrame ),
326cdf0e10cSrcweir 	mxActionListener( new OKActionListener( *this ) ),
327cdf0e10cSrcweir 	mnSourceSize( rSourceSize ),
328cdf0e10cSrcweir 	mnDestSize( rDestSize ),
329cdf0e10cSrcweir 	mnApproxSize( rApproxSize ),
330cdf0e10cSrcweir 	mrbOpenNewDocument( rbOpenNewDocument ),
331cdf0e10cSrcweir 	maSaveAsURL( rSaveAsURL )
332cdf0e10cSrcweir {
333cdf0e10cSrcweir 	Reference< XFrame > xFrame( mxController->getFrame() );
334cdf0e10cSrcweir 	Reference< XWindow > xContainerWindow( xFrame->getContainerWindow() );
335cdf0e10cSrcweir 	Reference< XWindowPeer > xWindowPeer( xContainerWindow, UNO_QUERY_THROW );
336cdf0e10cSrcweir 	createWindowPeer( xWindowPeer );
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 	InitDialog();
339cdf0e10cSrcweir }
340cdf0e10cSrcweir 
341cdf0e10cSrcweir // -----------------------------------------------------------------------------
342cdf0e10cSrcweir 
343cdf0e10cSrcweir InformationDialog::~InformationDialog()
344cdf0e10cSrcweir {
345cdf0e10cSrcweir }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir // -----------------------------------------------------------------------------
348cdf0e10cSrcweir 
349cdf0e10cSrcweir sal_Bool InformationDialog::execute()
350cdf0e10cSrcweir {
351cdf0e10cSrcweir 	UnoDialog::execute();
352cdf0e10cSrcweir 
353cdf0e10cSrcweir 	if ( maSaveAsURL.getLength() )
354cdf0e10cSrcweir 	{
355cdf0e10cSrcweir 		sal_Int16 nInt16 = 0;
356cdf0e10cSrcweir 		Any aAny( getControlProperty( TKGet( TK_OpenNewDocument ), TKGet( TK_State ) ) );
357cdf0e10cSrcweir 		if ( aAny >>= nInt16 )
358cdf0e10cSrcweir 		{
359cdf0e10cSrcweir 			sal_Bool bOpenNewDocument = static_cast< sal_Bool >( nInt16 );
360cdf0e10cSrcweir 			mrbOpenNewDocument = bOpenNewDocument;
361cdf0e10cSrcweir 		}
362cdf0e10cSrcweir 	}
363cdf0e10cSrcweir 	return mbStatus;
364cdf0e10cSrcweir }
365cdf0e10cSrcweir 
366cdf0e10cSrcweir // -----------------------------------------------------------------------------
367cdf0e10cSrcweir 
368cdf0e10cSrcweir void OKActionListener::actionPerformed( const ActionEvent& rEvent )
369cdf0e10cSrcweir 	throw ( com::sun::star::uno::RuntimeException )
370cdf0e10cSrcweir {
371cdf0e10cSrcweir 	if ( rEvent.ActionCommand == rtl::OUString( rtl::OUString::createFromAscii( "button" ) ) )
372cdf0e10cSrcweir 	{
373cdf0e10cSrcweir 		mrInformationDialog.endExecute( sal_True );
374cdf0e10cSrcweir 	}
375cdf0e10cSrcweir }
376cdf0e10cSrcweir void OKActionListener::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
377cdf0e10cSrcweir 	throw ( com::sun::star::uno::RuntimeException )
378cdf0e10cSrcweir {
379cdf0e10cSrcweir }
380