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: brkdlg.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_sd.hxx"
34 #ifdef SD_DLLIMPLEMENTATION
35 #undef SD_DLLIMPLEMENTATION
38 #include "BreakDlg.hxx"
39 #include <sfx2/progress.hxx>
41 #include <svx/svdedtv.hxx>
42 #include <svx/svdetc.hxx>
43 #include <sfx2/app.hxx>
44 #include <vcl/msgbox.hxx>
48 #include "sdresid.hxx"
50 #include "drawview.hxx"
51 #include "strings.hrc"
52 #include "DrawDocShell.hxx"
56 /*************************************************************************
58 |* Dialog zum aufbrechen von Metafiles
60 \************************************************************************/
66 ULONG nSumActionCount
,
68 : SfxModalDialog ( pWindow
, SdResId( DLG_BREAK
) ),
69 aFtObjInfo ( this, SdResId( FT_OBJ_INFO
) ),
70 aFtActInfo ( this, SdResId( FT_ACT_INFO
) ),
71 aFtInsInfo ( this, SdResId( FT_INS_INFO
) ),
72 aFiObjInfo ( this, SdResId( FI_OBJ_INFO
) ),
73 aFiActInfo ( this, SdResId( FI_ACT_INFO
) ),
74 aFiInsInfo ( this, SdResId( FI_INS_INFO
) ),
75 aBtnCancel ( this, SdResId( BTN_CANCEL
) ),
76 aLink ( LINK( this, BreakDlg
, UpDate
)),
79 aBtnCancel
.SetClickHdl( LINK( this, BreakDlg
, CancelButtonHdl
));
81 mpProgress
= new SfxProgress( pShell
, String(SdResId(STR_BREAK_METAFILE
)), nSumActionCount
*3 );
83 pProgrInfo
= new SvdProgressInfo( &aLink
);
84 // jede Action wird in DoImport() 3mal bearbeitet
85 pProgrInfo
->Init( nSumActionCount
*3, nObjCount
);
102 // Control-Handler fuer den Abbruch Button
103 IMPL_LINK( BreakDlg
, CancelButtonHdl
, void *, EMPTYARG
)
106 aBtnCancel
.Disable();
110 // Die UpDate Methode muss regelmaessig von der Arbeitsfunktion
111 // ausgeuehrt werden.
112 // Beim ersten aufruf wird die gesamtanzahl der actions uebergeben.
113 // Jeder weitere sollte die bearbeiteten actions seit dem letzten aufruf von
116 IMPL_LINK( BreakDlg
, UpDate
, void*, nInit
)
120 if(pProgrInfo
== NULL
)
123 // Statuszeile updaten oder Fehlermeldung?
124 if(nInit
== (void*)1L)
126 ErrorBox
aErrBox( this, WB_OK
, String( SdResId( STR_BREAK_FAIL
) ) );
132 mpProgress
->SetState( pProgrInfo
->GetSumCurAction() );
135 // Welches Oject wird gerade angezeigt?
136 String info
= UniString::CreateFromInt32( pProgrInfo
->GetCurObj() );
137 info
.Append( sal_Unicode('/') );
138 info
.Append( UniString::CreateFromInt32( pProgrInfo
->GetObjCount() ) );
139 aFiObjInfo
.SetText(info
);
141 // Wieviele Actions sind schon aufgebrochen?
142 if(pProgrInfo
->GetActionCount() == 0)
144 aFiActInfo
.SetText( aEmptyStr
);
148 info
= UniString::CreateFromInt32( pProgrInfo
->GetCurAction() );
149 info
.Append( sal_Unicode('/') );
150 info
.Append( UniString::CreateFromInt32( pProgrInfo
->GetActionCount() ) );
151 aFiActInfo
.SetText(info
);
154 // Und erst eingefuegt????
155 if(pProgrInfo
->GetInsertCount() == 0)
157 aFiInsInfo
.SetText( aEmptyStr
);
161 info
= UniString::CreateFromInt32( pProgrInfo
->GetCurInsert() );
162 info
.Append( sal_Unicode('/') );
163 info
.Append( UniString::CreateFromInt32( pProgrInfo
->GetInsertCount() ) );
164 aFiInsInfo
.SetText(info
);
167 Application::Reschedule();
168 return( bCancel
?0L:1L );
171 // Oeffnet den Modalen Dialog und startet einen Timer der die Arbeitsfunktion
172 // nach oeffnen des Dialogs ausfuehrt
173 short BreakDlg::Execute()
175 aTimer
.SetTimeout( 10 );
176 aTimer
.SetTimeoutHdl( LINK( this, BreakDlg
, InitialUpdate
) );
179 return SfxModalDialog::Execute();
182 // Linkmethode welche die Arbeitsfunktion startet
183 IMPL_LINK( BreakDlg
, InitialUpdate
, Timer
*, EMPTYARG
)
185 pDrView
->DoImportMarkedMtf(pProgrInfo
);
190 } // end of namespace sd