<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: dlgass.cxx,v $
 *
 *  $Revision: 1.39 $
 *
 *  last change: $Author: kz $ $Date: 2006-04-26 20:45:33 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifdef SD_DLLIMPLEMENTATION
#undef SD_DLLIMPLEMENTATION
#endif

#ifndef _COM_SUN_STAR_PRESENTATION_CLICKACTION_HPP_
#include <com/sun/star/presentation/ClickAction.hpp>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif

#ifndef _VOS_MUTEX_HXX_
#include <vos/mutex.hxx>
#endif

#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
#endif

#ifndef _SV_LSTBOX_HXX
#include <vcl/lstbox.hxx>
#endif

#ifndef _SV_COMBOBOX_HXX
#include <vcl/combobox.hxx>
#endif

#ifndef _SFXDOCTEMPL_HXX
#include <sfx2/doctempl.hxx>
#endif
#ifndef _SFXLSTNER_HXX
#include <svtools/lstner.hxx>
#endif

#ifndef _SFXDOCINF_HXX
#include <sfx2/docinf.hxx>
#endif

#ifndef _SFX_OBJSH_HXX
#include <sfx2/objsh.hxx>
#endif

#ifndef _EHDL_HXX
#include <svtools/ehdl.hxx>
#endif

#ifndef _SFXECODE_HXX
#include <svtools/sfxecode.hxx>
#endif

#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif

#ifndef _COM_SUN_STAR_PRESENTATION_FADEEFFECT_HPP_
#include <com/sun/star/presentation/FadeEffect.hpp>
#endif

#ifndef _SD_FADEDEF_H
#include <fadedef.h>
#endif

#ifndef _SFXSIDS_HRC
#include <sfx2/sfxsids.hrc>
#endif

#ifndef _UNDO_HXX
#include <svtools/undo.hxx>
#endif

#ifndef SD_DRAW_DOC_SHELL_HXX
#include "DrawDocShell.hxx"
#endif

#ifndef _SV_GDIMTF_HXX
#include <vcl/gdimtf.hxx>
#endif
#include <vcl/wintypes.hxx>

#ifndef _SD_DOCPREV_HXX_
#include "docprev.hxx"
#endif

#ifndef _SFXAPP_HXX
#include <sfx2/app.hxx>
#endif

#ifndef _SFXDOCFILE_HXX
#include <sfx2/docfile.hxx>
#endif

#ifndef _SFXDISPATCH_HXX
#include <sfx2/dispatch.hxx>
#endif

#ifndef _SFXREQUEST_HXX
#include <sfx2/request.hxx>
#endif

#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
#include <com/sun/star/sdbc/XResultSet.hpp>
#endif

#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif

#ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_
#include <com/sun/star/util/XCloseable.hpp>
#endif

#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_
#include <com/sun/star/uno/RuntimeException.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_XMODULEMANAGER_HPP_
#include <com/sun/star/frame/XModuleManager.hpp>
#endif

#ifndef _COM_SUN_STAR_UCB_XSIMPLEFILEACCESS_HPP_
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#endif

#ifndef _COM_SUN_STAR_UI_XMODULEUICONFIGURATIONMANAGERSUPPLIER_HPP_
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
#endif

#ifndef _COM_SUN_STAR_UI_XIMAGEMANAGER_HPP_
#include <com/sun/star/ui/XImageManager.hpp>
#endif

#ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX
#include <svtools/historyoptions.hxx>
#endif

#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif

#ifndef _OSL_FILE_HXX_
#include <osl/file.hxx>
#endif

#ifndef _FILEDLGHELPER_HXX
#include <sfx2/filedlghelper.hxx>
#endif

#include "sdpage.hxx"
#include "helpids.h"
#ifndef INC_ASSCLASS
#include "assclass.hxx"
#endif
#include "dlgass.hrc"
#ifndef INC_DLGASS
#include "dlgass.hxx"
#endif
#ifndef SD_DLGCTRLS_HXX
#include "dlgctrls.hxx"
#endif
#ifndef _SD_CFGID_HXX
#include "strings.hrc"
#endif
#ifndef _DATETIMEITEM_HXX
#include "dlgassim.hxx"
#endif
#ifndef _TEMPLATE_SCANNER_HXX
#include "TemplateScanner.hxx"
#endif
#ifndef SD_OUTPUT_DEVICE_UPDATER_HXX
#include "WindowUpdater.hxx"
#endif

#include <comphelper/processfactory.hxx>

using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::sd;


void InterpolateFixedBitmap( FixedBitmap * pBitmap )
{
    Bitmap aBmp( pBitmap->GetBitmap() );
    Size aSize = pBitmap->GetSizePixel();
    aBmp.Scale( aSize, BMP_SCALE_INTERPOLATE );
    pBitmap->SetBitmap( aBmp );
}


// ====================================================================
// ====================================================================

UINT32 PageHelpIds[] =
{
    HID_SD_AUTOPILOT_PAGE1,
    HID_SD_AUTOPILOT_PAGE2,
    HID_SD_AUTOPILOT_PAGE3,
    HID_SD_AUTOPILOT_PAGE4,
    HID_SD_AUTOPILOT_PAGE5
};

// ====================================================================

class PasswordEntry
{
public:
    String m_aPassword;
    String m_aPath;
};

DECLARE_LIST( PasswordEntryList, PasswordEntry * );

// ====================================================================

class AssistentDlgImpl : public SfxListener
{
public:
    AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, BOOL bAutoPilot  );
    ~AssistentDlgImpl();

    /// Local mutex used to serialize concurrent method calls.
    ::osl::Mutex m_aMutex;

    SfxObjectShellLock GetDocument();

    /** closes the current preview docshell */
    void CloseDocShell();

    /** Extract form the history list of recently used files the impress
        files and insert them into a listbox.
    */
    void    ScanDocmenu         (void);
    /** Flag that is set to TRUE after the recently used files have been
        scanned.
    */
    BOOL m_bRecentDocumentsReady;

    /** When the list of templates has not been scanned already this is done
        when this method is called.  That includes requesting the whole list
        of templates from UCB and extracting from that list the impress
        templates and layouts and storing them for later use in
        <member>m_aPresentList</member>.  Note that the first call to this
        method after installing a new Office may take some time.
    */
    void ProvideTemplates (void);

    /** This method transfers the template folders from the template scanner
        to the internal structures of this class.  On termination it sets
        the flag <member>m_bTemplatesReady</member> to <TRUE/> to indicate
        that the templates are available.
        @param rTemplateFolders
            This is a list of template folders.  This method takes ownership
            of the supplied entries by removing them from the list and
            transferring them to an internal structure.
    */
    void TemplateScanDone (std::vector<TemplateDir*>& rTemplateFolders);

    /** Flag that is set to TRUE after the impress templates have been
        scanned.
    */
    BOOL m_bTemplatesReady;

    /** Flag used to prevent nested or concurrent calls to the
        <member>UpdatePreview</memember> method.  A <TRUE/> value indicates
        that a preview update is currently active.
    */
    BOOL m_bPreviewUpdating;

    ::Window* m_pWindow;

    void SavePassword( SfxObjectShellLock xDoc, const String& rPath );
    void RestorePassword( SfxItemSet* pSet, const String& rPath );
    String GetPassword( const String rPath );
    void DeletePassords();

    PasswordEntryList m_aPasswordList;

    String m_aDocFile;
    String m_aLayoutFile;

    String GetDocFileName();
    String GetLayoutFileName();

    /// List of URLs of recently used impress files.
    std::vector<String*> m_aOpenFilesList;

    /// List of folders containing data about impress templates.
    std::vector<TemplateDir*> m_aPresentList;

    /// Currently selected template folder.
    TemplateDir* m_pTemplateRegion;

    /// Currently selected layout folder.
    TemplateDir* m_pLayoutRegion;

    // preview
    BOOL m_bUserDataDirty;
    Timer m_aPrevTimer;
    Timer m_aEffectPrevTimer;
    Timer m_aUpdatePageListTimer;
    Timer m_aStartScanTimer;

    SfxObjectShellLock xDocShell;

    ::std::auto_ptr<WindowUpdater> mpWindowUpdater;

    BOOL m_bPreview;
    USHORT m_nShowPage;
    BOOL m_bDocPreview;

    ULONG m_nTemplate;

    String m_aPageListFile;

    void UpdatePreview( BOOL bDocPreview );
    void UpdatePageList();
    void UpdateUserData();

    BOOL IsOwnFormat( const String& rPath );

    // dlg status
    void EndDialog( long nResult = 0 );

    void SetStartType( StartType eType );
    StartType GetStartType();

    void SelectTemplateRegion( const String& rRegion );
    void SelectLayoutRegion( const String& rRegion );

    void UpdatePage();
    void ChangePage();
    void LeavePage();

    String GetUiTextForCommand (const ::rtl::OUString& aCommandURL);
    Image GetUiIconForCommand (const ::rtl::OUString& aCommandURL);

    DECL_LINK( StartScanHdl, void * );
    DECL_LINK( SelectFileHdl, ListBox * );
    DECL_LINK( SelectRegionHdl, ListBox * );
    DECL_LINK( UpdatePreviewHdl, void * );
    DECL_LINK( UpdatePageListHdl, void * );
    DECL_LINK( StartTypeHdl, RadioButton * );
    DECL_LINK( SelectTemplateHdl, ListBox * );
    DECL_LINK( NextPageHdl, PushButton * );
    DECL_LINK( LastPageHdl, PushButton * );
    DECL_LINK( PreviewFlagHdl, CheckBox * );
    DECL_LINK( EffectPreviewHdl, Button * );
    DECL_LINK( SelectLayoutHdl, ListBox * );
    DECL_LINK( PageSelectHdl, Control * );
    DECL_LINK( PresTypeHdl, RadioButton * );
    DECL_LINK( UpdateUserDataHdl, Edit* );
    DECL_LINK( SelectEffectHdl, void* );
    DECL_LINK( OpenButtonHdl, Button * );

    // Common
    Assistent           m_aAssistentFunc;
    CheckBox            m_aPreviewFlag;
    CheckBox            m_aStartWithFlag;
    HelpButton          m_aHelpButton;
    CancelButton        m_aCancelButton;
    PushButton          m_aLastPageButton;
    PushButton          m_aNextPageButton;
    OKButton            m_aFinishButton;
    SdDocPreviewWin     m_aPreview;

    // Seite 1
    FixedBitmap*        m_pPage1FB;
    FixedLine*          m_pPage1ArtFL;
    RadioButton*        m_pPage1EmptyRB;
    RadioButton*        m_pPage1TemplateRB;
    ListBox*            m_pPage1RegionLB;
    ListBox*            m_pPage1TemplateLB;
    RadioButton*        m_pPage1OpenRB;
    ListBox*            m_pPage1OpenLB;
    PushButton*         m_pPage1OpenPB;

    // Seite 2
    FixedBitmap*        m_pPage2FB;
    FixedLine*          m_pPage2LayoutFL;
    ListBox*            m_pPage2RegionLB;
    ListBox*            m_pPage2LayoutLB;
    FixedLine*          m_pPage2OutTypesFL;
    RadioButton*        m_pPage2Medium1RB;
    RadioButton*        m_pPage2Medium2RB;
    RadioButton*        m_pPage2Medium3RB;
    RadioButton*        m_pPage2Medium4RB;
    RadioButton*        m_pPage2Medium5RB;

    // Seite 3
    FixedBitmap*        m_pPage3FB;
    FixedLine*          m_pPage3EffectFL;
    FixedText*          m_pPage3EffectFT;
    FadeEffectLB*       m_pPage3EffectLB;
    FixedText*          m_pPage3SpeedFT;
    ListBox*            m_pPage3SpeedLB;
    FixedLine*          m_pPage3PresTypeFL;
    RadioButton*        m_pPage3PresTypeLiveRB;
    RadioButton*        m_pPage3PresTypeKioskRB;
    FixedText*          m_pPage3PresTimeFT;
    TimeField*          m_pPage3PresTimeTMF;
    FixedText*          m_pPage3BreakFT;
    TimeField*          m_pPage3BreakTMF;
    CheckBox*           m_pPage3LogoCB;

    // Seite 4
    FixedBitmap*        m_pPage4FB;
    FixedLine*          m_pPage4PersonalFL;
    FixedText*          m_pPage4AskNameFT;
    Edit*               m_pPage4AskNameEDT;
    FixedText*          m_pPage4AskTopicFT;
    Edit*               m_pPage4AskTopicEDT;
    FixedText*          m_pPage4AskInfoFT;
    MultiLineEdit*      m_pPage4AskInfoEDT;

    // Seite 5
    FixedBitmap*        m_pPage5FB;
    FixedText*          m_pPage5PageListFT;
    SdPageListControl*  m_pPage5PageListCT;
    CheckBox*           m_pPage5SummaryCB;

};



// ====================================================================

AssistentDlgImpl::AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, BOOL bAutoPilot ) :
    m_aFinishButton(pWindow,SdResId(BUT_FINISH)),
    m_aHelpButton(pWindow,SdResId(BUT_HELP)),
    m_aCancelButton(pWindow,SdResId(BUT_CANCEL)),
    m_aNextPageButton(pWindow,SdResId(BUT_NEXT)),
    m_aLastPageButton(pWindow,SdResId(BUT_LAST)),
    m_aPreviewFlag(pWindow,SdResId(CB_PREVIEW)),
    m_aPreview(pWindow,SdResId(CT_PREVIEW)),
    m_aStartWithFlag(pWindow,SdResId(CB_STARTWITH)),
//  m_aBitmap(pWindow,SdResId(PAGE1_BMP)),
    m_pTemplateRegion(NULL),
    m_pLayoutRegion(NULL),
    m_bPreview(TRUE),
    m_bDocPreview(FALSE),
    m_nShowPage(0),
//  m_aPageListFile('?'),
    m_bUserDataDirty(FALSE),
    m_aAssistentFunc(5),
    xDocShell (NULL),
    mpWindowUpdater (new WindowUpdater())
{
    m_aPageListFile += sal_Unicode('?'),
    m_bRecentDocumentsReady = FALSE;
    m_bTemplatesReady = FALSE;
    m_bPreviewUpdating = FALSE;

    m_pWindow = pWindow;

    if(bAutoPilot)
        m_aStartWithFlag.Hide();
    else
        m_aAssistentFunc.InsertControl(1, &m_aStartWithFlag );

    //page1 wird initialisiert und an die Assistentenfunktionalitaet
    //uebergeben
    m_aAssistentFunc.InsertControl(1, &m_aPreview );
    m_aAssistentFunc.InsertControl(1, &m_aPreviewFlag );
    m_aAssistentFunc.InsertControl(1,
        m_pPage1FB = new FixedBitmap(pWindow,SdResId(FB_PAGE1)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1ArtFL = new FixedLine(pWindow,SdResId(FL_PAGE1_ARTGROUP)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1EmptyRB=new RadioButton(pWindow,SdResId(RB_PAGE1_EMPTY)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1TemplateRB=new RadioButton(pWindow,SdResId(RB_PAGE1_TEMPLATE)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1OpenRB=new RadioButton(pWindow,SdResId(RB_PAGE1_OPEN)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1RegionLB = new ListBox(pWindow,SdResId(LB_PAGE1_REGION)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1TemplateLB=new ListBox(pWindow,SdResId(LB_PAGE1_TEMPLATES)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1OpenPB=new PushButton(pWindow,SdResId(PB_PAGE1_OPEN)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1OpenLB=new ListBox(pWindow,SdResId(LB_PAGE1_OPEN)));

    // Align the button and list box displayed for the "open existing file"
    // radio button with the text of that radio button.
    {
        RadioButton aEmptyRB (m_pWindow);
        sal_Int32 nIndent (aEmptyRB.CalcMinimumSize(0).Width());
        sal_Int32 nLeft (m_pPage1OpenRB->GetPosPixel().X() + nIndent);
        sal_Int32 nWidth (m_pPage1OpenRB->GetSizePixel().Width() - nIndent);
        m_pPage1OpenPB->SetPosSizePixel(
            Point(nLeft, m_pPage1OpenPB->GetPosPixel().Y()),
            Size(m_pPage1OpenPB->GetSizePixel()));
        m_pPage1OpenLB->SetPosSizePixel(
            Point(nLeft, m_pPage1OpenLB->GetPosPixel().Y()),
            Size(nWidth, m_pPage1OpenLB->GetSizePixel().Height()));
    }

    // Set text and icon of the 'Open...' button.
    {
        String sText (GetUiTextForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open"))));
        // Remove the mnemonic and add a leading space so that icon and text
        // are not too close together.
        sText.SearchAndReplaceAll(String(RTL_CONSTASCII_STRINGPARAM("~")),String());
        sText.Insert(String(RTL_CONSTASCII_STRINGPARAM(" ")),0);
        m_pPage1OpenPB->SetText(sText);
        // Place icon left of text and both centered in the button.
        m_pPage1OpenPB->SetModeImage(
            GetUiIconForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open"))),
            BMP_COLOR_NORMAL);
        m_pPage1OpenPB->EnableImageDisplay(TRUE);
        m_pPage1OpenPB->EnableTextDisplay(TRUE);
        m_pPage1OpenPB->SetImageAlign(IMAGEALIGN_LEFT);
        m_pPage1OpenPB->SetStyle(m_pPage1OpenPB->GetStyle() | WB_CENTER);
    }

    // links&handler
    m_pPage1RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
    m_pPage1RegionLB->SetDropDownLineCount( 6 );
    m_pPage1TemplateLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectTemplateHdl));
    m_pPage1TemplateLB->InsertEntry(String(SdResId(STR_ISLOADING)));

    m_pPage1EmptyRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
    m_pPage1TemplateRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
    m_pPage1OpenRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
    m_pPage1OpenLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectFileHdl));
    m_pPage1OpenLB->SetDoubleClickHdl(rFinishLink);
    m_pPage1OpenPB->SetClickHdl(LINK(this,AssistentDlgImpl,OpenButtonHdl));
    //  m_pPage1OpenLB->InsertEntry(String(SdResId(STR_WIZARD_POSITION)));

    // Seite 2
    m_aAssistentFunc.InsertControl(2, &m_aPreview );
    m_aAssistentFunc.InsertControl(2, &m_aPreviewFlag );
    m_aAssistentFunc.InsertControl(2,
        m_pPage2FB = new FixedBitmap(pWindow,SdResId(FB_PAGE2)));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2LayoutFL = new FixedLine( pWindow, SdResId(FL_PAGE2_LAYOUT) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2RegionLB = new ListBox(pWindow,SdResId(LB_PAGE2_REGION) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2LayoutLB = new ListBox(pWindow,SdResId(LB_PAGE2_LAYOUT) ));

    m_aAssistentFunc.InsertControl(2,
        m_pPage2OutTypesFL = new FixedLine( pWindow, SdResId(FL_PAGE2_OUTPUTTYPES) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium5RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM5) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium3RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM3) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium4RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM4) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium1RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM1) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium2RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM2) ));
    m_pPage2Medium5RB->Check();

    m_pPage2RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
    m_pPage2RegionLB->SetDropDownLineCount( 6 );
    m_pPage2LayoutLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectLayoutHdl));
    m_pPage2LayoutLB->InsertEntry(String(SdResId(STR_ISLOADING)));

    // Seite 3
    m_aAssistentFunc.InsertControl(3, &m_aPreview );
    m_aAssistentFunc.InsertControl(3, &m_aPreviewFlag );
    m_aAssistentFunc.InsertControl(3,
        m_pPage3FB = new FixedBitmap(pWindow,SdResId(FB_PAGE3)));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3EffectFL = new FixedLine( pWindow, SdResId(FL_PAGE3_EFFECT) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3EffectFT = new FixedText( pWindow, SdResId(FT_PAGE3_EFFECT) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3EffectLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_EFFECT) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3SpeedFT = new FixedText( pWindow, SdResId(FT_PAGE3_SPEED) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3SpeedLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_SPEED) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTypeFL = new FixedLine( pWindow, SdResId(FL_PAGE3_PRESTYPE) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTypeLiveRB = new RadioButton( pWindow, SdResId(RB_PAGE3_LIVE) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTypeKioskRB = new RadioButton( pWindow, SdResId(RB_PAGE3_KIOSK) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTimeFT = new FixedText( pWindow, SdResId( FT_PAGE3_TIME) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTimeTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_TIME) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3BreakFT = new FixedText( pWindow, SdResId( FT_PAGE3_BREAK) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3BreakTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_BREAK) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3LogoCB = new CheckBox( pWindow, SdResId( CB_PAGE3_LOGO) ));

    m_pPage3EffectLB->Fill();
//  m_pPage3EffectLB->SelectEffect( presentation::FadeEffect_NONE );
    m_pPage3EffectLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
    m_pPage3EffectLB->SetDropDownLineCount( 12 );

    m_pPage3SpeedLB->InsertEntry( String( SdResId(STR_SLOW) ));
    m_pPage3SpeedLB->InsertEntry( String( SdResId(STR_MEDIUM) ));
    m_pPage3SpeedLB->InsertEntry( String( SdResId(STR_FAST) ));
    m_pPage3SpeedLB->SetDropDownLineCount( 3 );
    m_pPage3SpeedLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
    m_pPage3SpeedLB->SelectEntryPos( 1 );

    m_pPage3PresTypeLiveRB->Check();
    m_pPage3PresTypeLiveRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
    m_pPage3PresTypeKioskRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
    m_pPage3PresTimeTMF->SetFormat( TIMEF_SEC );
    m_pPage3PresTimeTMF->SetTime( Time( 0, 0, 10 ) );
    m_pPage3BreakTMF->SetFormat( TIMEF_SEC );
    m_pPage3BreakTMF->SetTime( Time( 0, 0, 10 ) );
    m_pPage3LogoCB->Check();

    // set cursor in timefield
    Edit *pEditPage3PresTimeTMF = m_pPage3PresTimeTMF->GetField();
    Edit *pEditPage3BreakTMF = m_pPage3BreakTMF->GetField();
    Selection aSel1( pEditPage3PresTimeTMF->GetMaxTextLen(), pEditPage3PresTimeTMF->GetMaxTextLen() );
    Selection aSel2( pEditPage3BreakTMF->GetMaxTextLen(), pEditPage3BreakTMF->GetMaxTextLen() );
    pEditPage3PresTimeTMF->SetSelection( aSel1 );
    pEditPage3BreakTMF->SetSelection( aSel2 );

    // Seite 4
    m_aAssistentFunc.InsertControl(4,
        m_pPage4FB = new FixedBitmap(pWindow,SdResId(FB_PAGE4)));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4PersonalFL = new FixedLine( pWindow, SdResId(FL_PAGE4_PERSONAL) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskNameFT   = new FixedText( pWindow, SdResId(FT_PAGE4_ASKNAME) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskNameEDT  = new Edit( pWindow, SdResId(EDT_PAGE4_ASKNAME) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskTopicFT= new FixedText( pWindow, SdResId(FT_PAGE4_ASKTOPIC) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskTopicEDT = new Edit( pWindow, SdResId(EDT_PAGE4_ASKTOPIC) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskInfoFT   = new FixedText( pWindow, SdResId(FT_PAGE4_ASKINFORMATION) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskInfoEDT  = new MultiLineEdit( pWindow, SdResId(EDT_PAGE4_ASKINFORMATION) ));

    m_pPage4AskNameEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
    m_pPage4AskTopicEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
    m_pPage4AskInfoEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));

    // page 5
    m_aAssistentFunc.InsertControl(5, &m_aPreview );
    m_aAssistentFunc.InsertControl(5, &m_aPreviewFlag );
    m_aAssistentFunc.InsertControl(5,
        m_pPage5FB = new FixedBitmap(pWindow,SdResId(FB_PAGE5)));
    m_aAssistentFunc.InsertControl(5,
        m_pPage5PageListFT = new FixedText( pWindow, SdResId( FT_PAGE5_PAGELIST ) ));
    m_aAssistentFunc.InsertControl(5,
        m_pPage5PageListCT = new SdPageListControl( pWindow, SdResId( CT_PAGE5_PAGELIST ) ));
    m_aAssistentFunc.InsertControl(5,
        m_pPage5SummaryCB  = new CheckBox( pWindow, SdResId( CB_PAGE5_SUMMARY ) ));

    m_pPage5PageListCT->SetSelectHdl(LINK(this,AssistentDlgImpl, PageSelectHdl));

    // generell
    if( !SfxApplication::IsPlugin() )
    {
        InterpolateFixedBitmap( m_pPage1FB );
        InterpolateFixedBitmap( m_pPage2FB );
        InterpolateFixedBitmap( m_pPage3FB );
        InterpolateFixedBitmap( m_pPage4FB );
        InterpolateFixedBitmap( m_pPage5FB );
    }
<commit_msg>INTEGRATION: CWS sfxcleanup (1.38.48); FILE MERGED 2006/04/28 12:12:16 mba 172.16.17.32: RESYNC: (1.38-1.39); FILE MERGED 2006/02/27 08:26:33 mba 172.16.17.32: #132394#: remove superfluous code<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: dlgass.cxx,v $
 *
 *  $Revision: 1.40 $
 *
 *  last change: $Author: rt $ $Date: 2006-05-02 15:05:42 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifdef SD_DLLIMPLEMENTATION
#undef SD_DLLIMPLEMENTATION
#endif

#ifndef _COM_SUN_STAR_PRESENTATION_CLICKACTION_HPP_
#include <com/sun/star/presentation/ClickAction.hpp>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif

#ifndef _VOS_MUTEX_HXX_
#include <vos/mutex.hxx>
#endif

#ifndef _SV_MSGBOX_HXX
#include <vcl/msgbox.hxx>
#endif

#ifndef _SV_LSTBOX_HXX
#include <vcl/lstbox.hxx>
#endif

#ifndef _SV_COMBOBOX_HXX
#include <vcl/combobox.hxx>
#endif

#ifndef _SFXDOCTEMPL_HXX
#include <sfx2/doctempl.hxx>
#endif
#ifndef _SFXLSTNER_HXX
#include <svtools/lstner.hxx>
#endif

#ifndef _SFXDOCINF_HXX
#include <sfx2/docinf.hxx>
#endif

#ifndef _SFX_OBJSH_HXX
#include <sfx2/objsh.hxx>
#endif

#ifndef _EHDL_HXX
#include <svtools/ehdl.hxx>
#endif

#ifndef _SFXECODE_HXX
#include <svtools/sfxecode.hxx>
#endif

#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif

#ifndef _COM_SUN_STAR_PRESENTATION_FADEEFFECT_HPP_
#include <com/sun/star/presentation/FadeEffect.hpp>
#endif

#ifndef _SD_FADEDEF_H
#include <fadedef.h>
#endif

#ifndef _SFXSIDS_HRC
#include <sfx2/sfxsids.hrc>
#endif

#ifndef _UNDO_HXX
#include <svtools/undo.hxx>
#endif

#ifndef SD_DRAW_DOC_SHELL_HXX
#include "DrawDocShell.hxx"
#endif

#ifndef _SV_GDIMTF_HXX
#include <vcl/gdimtf.hxx>
#endif
#include <vcl/wintypes.hxx>

#ifndef _SD_DOCPREV_HXX_
#include "docprev.hxx"
#endif

#ifndef _SFXAPP_HXX
#include <sfx2/app.hxx>
#endif

#ifndef _SFXDOCFILE_HXX
#include <sfx2/docfile.hxx>
#endif

#ifndef _SFXDISPATCH_HXX
#include <sfx2/dispatch.hxx>
#endif

#ifndef _SFXREQUEST_HXX
#include <sfx2/request.hxx>
#endif

#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
#include <com/sun/star/sdbc/XResultSet.hpp>
#endif

#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif

#ifndef _COM_SUN_STAR_UTIL_XCLOSEABLE_HPP_
#include <com/sun/star/util/XCloseable.hpp>
#endif

#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_
#include <com/sun/star/uno/RuntimeException.hpp>
#endif

#ifndef _COM_SUN_STAR_FRAME_XMODULEMANAGER_HPP_
#include <com/sun/star/frame/XModuleManager.hpp>
#endif

#ifndef _COM_SUN_STAR_UCB_XSIMPLEFILEACCESS_HPP_
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#endif

#ifndef _COM_SUN_STAR_UI_XMODULEUICONFIGURATIONMANAGERSUPPLIER_HPP_
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
#endif

#ifndef _COM_SUN_STAR_UI_XIMAGEMANAGER_HPP_
#include <com/sun/star/ui/XImageManager.hpp>
#endif

#ifndef INCLUDED_SVTOOLS_HISTORYOPTIONS_HXX
#include <svtools/historyoptions.hxx>
#endif

#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif

#ifndef _OSL_FILE_HXX_
#include <osl/file.hxx>
#endif

#ifndef _FILEDLGHELPER_HXX
#include <sfx2/filedlghelper.hxx>
#endif

#include "sdpage.hxx"
#include "helpids.h"
#ifndef INC_ASSCLASS
#include "assclass.hxx"
#endif
#include "dlgass.hrc"
#ifndef INC_DLGASS
#include "dlgass.hxx"
#endif
#ifndef SD_DLGCTRLS_HXX
#include "dlgctrls.hxx"
#endif
#ifndef _SD_CFGID_HXX
#include "strings.hrc"
#endif
#ifndef _DATETIMEITEM_HXX
#include "dlgassim.hxx"
#endif
#ifndef _TEMPLATE_SCANNER_HXX
#include "TemplateScanner.hxx"
#endif
#ifndef SD_OUTPUT_DEVICE_UPDATER_HXX
#include "WindowUpdater.hxx"
#endif

#include <comphelper/processfactory.hxx>

using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::sd;


void InterpolateFixedBitmap( FixedBitmap * pBitmap )
{
    Bitmap aBmp( pBitmap->GetBitmap() );
    Size aSize = pBitmap->GetSizePixel();
    aBmp.Scale( aSize, BMP_SCALE_INTERPOLATE );
    pBitmap->SetBitmap( aBmp );
}


// ====================================================================
// ====================================================================

UINT32 PageHelpIds[] =
{
    HID_SD_AUTOPILOT_PAGE1,
    HID_SD_AUTOPILOT_PAGE2,
    HID_SD_AUTOPILOT_PAGE3,
    HID_SD_AUTOPILOT_PAGE4,
    HID_SD_AUTOPILOT_PAGE5
};

// ====================================================================

class PasswordEntry
{
public:
    String m_aPassword;
    String m_aPath;
};

DECLARE_LIST( PasswordEntryList, PasswordEntry * );

// ====================================================================

class AssistentDlgImpl : public SfxListener
{
public:
    AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, BOOL bAutoPilot  );
    ~AssistentDlgImpl();

    /// Local mutex used to serialize concurrent method calls.
    ::osl::Mutex m_aMutex;

    SfxObjectShellLock GetDocument();

    /** closes the current preview docshell */
    void CloseDocShell();

    /** Extract form the history list of recently used files the impress
        files and insert them into a listbox.
    */
    void    ScanDocmenu         (void);
    /** Flag that is set to TRUE after the recently used files have been
        scanned.
    */
    BOOL m_bRecentDocumentsReady;

    /** When the list of templates has not been scanned already this is done
        when this method is called.  That includes requesting the whole list
        of templates from UCB and extracting from that list the impress
        templates and layouts and storing them for later use in
        <member>m_aPresentList</member>.  Note that the first call to this
        method after installing a new Office may take some time.
    */
    void ProvideTemplates (void);

    /** This method transfers the template folders from the template scanner
        to the internal structures of this class.  On termination it sets
        the flag <member>m_bTemplatesReady</member> to <TRUE/> to indicate
        that the templates are available.
        @param rTemplateFolders
            This is a list of template folders.  This method takes ownership
            of the supplied entries by removing them from the list and
            transferring them to an internal structure.
    */
    void TemplateScanDone (std::vector<TemplateDir*>& rTemplateFolders);

    /** Flag that is set to TRUE after the impress templates have been
        scanned.
    */
    BOOL m_bTemplatesReady;

    /** Flag used to prevent nested or concurrent calls to the
        <member>UpdatePreview</memember> method.  A <TRUE/> value indicates
        that a preview update is currently active.
    */
    BOOL m_bPreviewUpdating;

    ::Window* m_pWindow;

    void SavePassword( SfxObjectShellLock xDoc, const String& rPath );
    void RestorePassword( SfxItemSet* pSet, const String& rPath );
    String GetPassword( const String rPath );
    void DeletePassords();

    PasswordEntryList m_aPasswordList;

    String m_aDocFile;
    String m_aLayoutFile;

    String GetDocFileName();
    String GetLayoutFileName();

    /// List of URLs of recently used impress files.
    std::vector<String*> m_aOpenFilesList;

    /// List of folders containing data about impress templates.
    std::vector<TemplateDir*> m_aPresentList;

    /// Currently selected template folder.
    TemplateDir* m_pTemplateRegion;

    /// Currently selected layout folder.
    TemplateDir* m_pLayoutRegion;

    // preview
    BOOL m_bUserDataDirty;
    Timer m_aPrevTimer;
    Timer m_aEffectPrevTimer;
    Timer m_aUpdatePageListTimer;
    Timer m_aStartScanTimer;

    SfxObjectShellLock xDocShell;

    ::std::auto_ptr<WindowUpdater> mpWindowUpdater;

    BOOL m_bPreview;
    USHORT m_nShowPage;
    BOOL m_bDocPreview;

    ULONG m_nTemplate;

    String m_aPageListFile;

    void UpdatePreview( BOOL bDocPreview );
    void UpdatePageList();
    void UpdateUserData();

    BOOL IsOwnFormat( const String& rPath );

    // dlg status
    void EndDialog( long nResult = 0 );

    void SetStartType( StartType eType );
    StartType GetStartType();

    void SelectTemplateRegion( const String& rRegion );
    void SelectLayoutRegion( const String& rRegion );

    void UpdatePage();
    void ChangePage();
    void LeavePage();

    String GetUiTextForCommand (const ::rtl::OUString& aCommandURL);
    Image GetUiIconForCommand (const ::rtl::OUString& aCommandURL);

    DECL_LINK( StartScanHdl, void * );
    DECL_LINK( SelectFileHdl, ListBox * );
    DECL_LINK( SelectRegionHdl, ListBox * );
    DECL_LINK( UpdatePreviewHdl, void * );
    DECL_LINK( UpdatePageListHdl, void * );
    DECL_LINK( StartTypeHdl, RadioButton * );
    DECL_LINK( SelectTemplateHdl, ListBox * );
    DECL_LINK( NextPageHdl, PushButton * );
    DECL_LINK( LastPageHdl, PushButton * );
    DECL_LINK( PreviewFlagHdl, CheckBox * );
    DECL_LINK( EffectPreviewHdl, Button * );
    DECL_LINK( SelectLayoutHdl, ListBox * );
    DECL_LINK( PageSelectHdl, Control * );
    DECL_LINK( PresTypeHdl, RadioButton * );
    DECL_LINK( UpdateUserDataHdl, Edit* );
    DECL_LINK( SelectEffectHdl, void* );
    DECL_LINK( OpenButtonHdl, Button * );

    // Common
    Assistent           m_aAssistentFunc;
    CheckBox            m_aPreviewFlag;
    CheckBox            m_aStartWithFlag;
    HelpButton          m_aHelpButton;
    CancelButton        m_aCancelButton;
    PushButton          m_aLastPageButton;
    PushButton          m_aNextPageButton;
    OKButton            m_aFinishButton;
    SdDocPreviewWin     m_aPreview;

    // Seite 1
    FixedBitmap*        m_pPage1FB;
    FixedLine*          m_pPage1ArtFL;
    RadioButton*        m_pPage1EmptyRB;
    RadioButton*        m_pPage1TemplateRB;
    ListBox*            m_pPage1RegionLB;
    ListBox*            m_pPage1TemplateLB;
    RadioButton*        m_pPage1OpenRB;
    ListBox*            m_pPage1OpenLB;
    PushButton*         m_pPage1OpenPB;

    // Seite 2
    FixedBitmap*        m_pPage2FB;
    FixedLine*          m_pPage2LayoutFL;
    ListBox*            m_pPage2RegionLB;
    ListBox*            m_pPage2LayoutLB;
    FixedLine*          m_pPage2OutTypesFL;
    RadioButton*        m_pPage2Medium1RB;
    RadioButton*        m_pPage2Medium2RB;
    RadioButton*        m_pPage2Medium3RB;
    RadioButton*        m_pPage2Medium4RB;
    RadioButton*        m_pPage2Medium5RB;

    // Seite 3
    FixedBitmap*        m_pPage3FB;
    FixedLine*          m_pPage3EffectFL;
    FixedText*          m_pPage3EffectFT;
    FadeEffectLB*       m_pPage3EffectLB;
    FixedText*          m_pPage3SpeedFT;
    ListBox*            m_pPage3SpeedLB;
    FixedLine*          m_pPage3PresTypeFL;
    RadioButton*        m_pPage3PresTypeLiveRB;
    RadioButton*        m_pPage3PresTypeKioskRB;
    FixedText*          m_pPage3PresTimeFT;
    TimeField*          m_pPage3PresTimeTMF;
    FixedText*          m_pPage3BreakFT;
    TimeField*          m_pPage3BreakTMF;
    CheckBox*           m_pPage3LogoCB;

    // Seite 4
    FixedBitmap*        m_pPage4FB;
    FixedLine*          m_pPage4PersonalFL;
    FixedText*          m_pPage4AskNameFT;
    Edit*               m_pPage4AskNameEDT;
    FixedText*          m_pPage4AskTopicFT;
    Edit*               m_pPage4AskTopicEDT;
    FixedText*          m_pPage4AskInfoFT;
    MultiLineEdit*      m_pPage4AskInfoEDT;

    // Seite 5
    FixedBitmap*        m_pPage5FB;
    FixedText*          m_pPage5PageListFT;
    SdPageListControl*  m_pPage5PageListCT;
    CheckBox*           m_pPage5SummaryCB;

};



// ====================================================================

AssistentDlgImpl::AssistentDlgImpl( ::Window* pWindow, const Link& rFinishLink, BOOL bAutoPilot ) :
    m_aFinishButton(pWindow,SdResId(BUT_FINISH)),
    m_aHelpButton(pWindow,SdResId(BUT_HELP)),
    m_aCancelButton(pWindow,SdResId(BUT_CANCEL)),
    m_aNextPageButton(pWindow,SdResId(BUT_NEXT)),
    m_aLastPageButton(pWindow,SdResId(BUT_LAST)),
    m_aPreviewFlag(pWindow,SdResId(CB_PREVIEW)),
    m_aPreview(pWindow,SdResId(CT_PREVIEW)),
    m_aStartWithFlag(pWindow,SdResId(CB_STARTWITH)),
//  m_aBitmap(pWindow,SdResId(PAGE1_BMP)),
    m_pTemplateRegion(NULL),
    m_pLayoutRegion(NULL),
    m_bPreview(TRUE),
    m_bDocPreview(FALSE),
    m_nShowPage(0),
//  m_aPageListFile('?'),
    m_bUserDataDirty(FALSE),
    m_aAssistentFunc(5),
    xDocShell (NULL),
    mpWindowUpdater (new WindowUpdater())
{
    m_aPageListFile += sal_Unicode('?'),
    m_bRecentDocumentsReady = FALSE;
    m_bTemplatesReady = FALSE;
    m_bPreviewUpdating = FALSE;

    m_pWindow = pWindow;

    if(bAutoPilot)
        m_aStartWithFlag.Hide();
    else
        m_aAssistentFunc.InsertControl(1, &m_aStartWithFlag );

    //page1 wird initialisiert und an die Assistentenfunktionalitaet
    //uebergeben
    m_aAssistentFunc.InsertControl(1, &m_aPreview );
    m_aAssistentFunc.InsertControl(1, &m_aPreviewFlag );
    m_aAssistentFunc.InsertControl(1,
        m_pPage1FB = new FixedBitmap(pWindow,SdResId(FB_PAGE1)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1ArtFL = new FixedLine(pWindow,SdResId(FL_PAGE1_ARTGROUP)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1EmptyRB=new RadioButton(pWindow,SdResId(RB_PAGE1_EMPTY)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1TemplateRB=new RadioButton(pWindow,SdResId(RB_PAGE1_TEMPLATE)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1OpenRB=new RadioButton(pWindow,SdResId(RB_PAGE1_OPEN)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1RegionLB = new ListBox(pWindow,SdResId(LB_PAGE1_REGION)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1TemplateLB=new ListBox(pWindow,SdResId(LB_PAGE1_TEMPLATES)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1OpenPB=new PushButton(pWindow,SdResId(PB_PAGE1_OPEN)));
    m_aAssistentFunc.InsertControl(1,
        m_pPage1OpenLB=new ListBox(pWindow,SdResId(LB_PAGE1_OPEN)));

    // Align the button and list box displayed for the "open existing file"
    // radio button with the text of that radio button.
    {
        RadioButton aEmptyRB (m_pWindow);
        sal_Int32 nIndent (aEmptyRB.CalcMinimumSize(0).Width());
        sal_Int32 nLeft (m_pPage1OpenRB->GetPosPixel().X() + nIndent);
        sal_Int32 nWidth (m_pPage1OpenRB->GetSizePixel().Width() - nIndent);
        m_pPage1OpenPB->SetPosSizePixel(
            Point(nLeft, m_pPage1OpenPB->GetPosPixel().Y()),
            Size(m_pPage1OpenPB->GetSizePixel()));
        m_pPage1OpenLB->SetPosSizePixel(
            Point(nLeft, m_pPage1OpenLB->GetPosPixel().Y()),
            Size(nWidth, m_pPage1OpenLB->GetSizePixel().Height()));
    }

    // Set text and icon of the 'Open...' button.
    {
        String sText (GetUiTextForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open"))));
        // Remove the mnemonic and add a leading space so that icon and text
        // are not too close together.
        sText.SearchAndReplaceAll(String(RTL_CONSTASCII_STRINGPARAM("~")),String());
        sText.Insert(String(RTL_CONSTASCII_STRINGPARAM(" ")),0);
        m_pPage1OpenPB->SetText(sText);
        // Place icon left of text and both centered in the button.
        m_pPage1OpenPB->SetModeImage(
            GetUiIconForCommand(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:Open"))),
            BMP_COLOR_NORMAL);
        m_pPage1OpenPB->EnableImageDisplay(TRUE);
        m_pPage1OpenPB->EnableTextDisplay(TRUE);
        m_pPage1OpenPB->SetImageAlign(IMAGEALIGN_LEFT);
        m_pPage1OpenPB->SetStyle(m_pPage1OpenPB->GetStyle() | WB_CENTER);
    }

    // links&handler
    m_pPage1RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
    m_pPage1RegionLB->SetDropDownLineCount( 6 );
    m_pPage1TemplateLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectTemplateHdl));
    m_pPage1TemplateLB->InsertEntry(String(SdResId(STR_ISLOADING)));

    m_pPage1EmptyRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
    m_pPage1TemplateRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
    m_pPage1OpenRB->SetClickHdl(LINK(this,AssistentDlgImpl,StartTypeHdl));
    m_pPage1OpenLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectFileHdl));
    m_pPage1OpenLB->SetDoubleClickHdl(rFinishLink);
    m_pPage1OpenPB->SetClickHdl(LINK(this,AssistentDlgImpl,OpenButtonHdl));
    //  m_pPage1OpenLB->InsertEntry(String(SdResId(STR_WIZARD_POSITION)));

    // Seite 2
    m_aAssistentFunc.InsertControl(2, &m_aPreview );
    m_aAssistentFunc.InsertControl(2, &m_aPreviewFlag );
    m_aAssistentFunc.InsertControl(2,
        m_pPage2FB = new FixedBitmap(pWindow,SdResId(FB_PAGE2)));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2LayoutFL = new FixedLine( pWindow, SdResId(FL_PAGE2_LAYOUT) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2RegionLB = new ListBox(pWindow,SdResId(LB_PAGE2_REGION) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2LayoutLB = new ListBox(pWindow,SdResId(LB_PAGE2_LAYOUT) ));

    m_aAssistentFunc.InsertControl(2,
        m_pPage2OutTypesFL = new FixedLine( pWindow, SdResId(FL_PAGE2_OUTPUTTYPES) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium5RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM5) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium3RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM3) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium4RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM4) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium1RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM1) ));
    m_aAssistentFunc.InsertControl(2,
        m_pPage2Medium2RB = new RadioButton( pWindow, SdResId(RB_PAGE2_MEDIUM2) ));
    m_pPage2Medium5RB->Check();

    m_pPage2RegionLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectRegionHdl));
    m_pPage2RegionLB->SetDropDownLineCount( 6 );
    m_pPage2LayoutLB->SetSelectHdl(LINK(this,AssistentDlgImpl,SelectLayoutHdl));
    m_pPage2LayoutLB->InsertEntry(String(SdResId(STR_ISLOADING)));

    // Seite 3
    m_aAssistentFunc.InsertControl(3, &m_aPreview );
    m_aAssistentFunc.InsertControl(3, &m_aPreviewFlag );
    m_aAssistentFunc.InsertControl(3,
        m_pPage3FB = new FixedBitmap(pWindow,SdResId(FB_PAGE3)));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3EffectFL = new FixedLine( pWindow, SdResId(FL_PAGE3_EFFECT) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3EffectFT = new FixedText( pWindow, SdResId(FT_PAGE3_EFFECT) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3EffectLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_EFFECT) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3SpeedFT = new FixedText( pWindow, SdResId(FT_PAGE3_SPEED) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3SpeedLB = new FadeEffectLB( pWindow, SdResId(LB_PAGE3_SPEED) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTypeFL = new FixedLine( pWindow, SdResId(FL_PAGE3_PRESTYPE) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTypeLiveRB = new RadioButton( pWindow, SdResId(RB_PAGE3_LIVE) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTypeKioskRB = new RadioButton( pWindow, SdResId(RB_PAGE3_KIOSK) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTimeFT = new FixedText( pWindow, SdResId( FT_PAGE3_TIME) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3PresTimeTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_TIME) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3BreakFT = new FixedText( pWindow, SdResId( FT_PAGE3_BREAK) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3BreakTMF = new TimeField( pWindow, SdResId( TMF_PAGE3_BREAK) ));
    m_aAssistentFunc.InsertControl(3,
        m_pPage3LogoCB = new CheckBox( pWindow, SdResId( CB_PAGE3_LOGO) ));

    m_pPage3EffectLB->Fill();
//  m_pPage3EffectLB->SelectEffect( presentation::FadeEffect_NONE );
    m_pPage3EffectLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
    m_pPage3EffectLB->SetDropDownLineCount( 12 );

    m_pPage3SpeedLB->InsertEntry( String( SdResId(STR_SLOW) ));
    m_pPage3SpeedLB->InsertEntry( String( SdResId(STR_MEDIUM) ));
    m_pPage3SpeedLB->InsertEntry( String( SdResId(STR_FAST) ));
    m_pPage3SpeedLB->SetDropDownLineCount( 3 );
    m_pPage3SpeedLB->SetSelectHdl( LINK(this,AssistentDlgImpl,SelectEffectHdl ));
    m_pPage3SpeedLB->SelectEntryPos( 1 );

    m_pPage3PresTypeLiveRB->Check();
    m_pPage3PresTypeLiveRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
    m_pPage3PresTypeKioskRB->SetClickHdl( LINK(this,AssistentDlgImpl, PresTypeHdl ));
    m_pPage3PresTimeTMF->SetFormat( TIMEF_SEC );
    m_pPage3PresTimeTMF->SetTime( Time( 0, 0, 10 ) );
    m_pPage3BreakTMF->SetFormat( TIMEF_SEC );
    m_pPage3BreakTMF->SetTime( Time( 0, 0, 10 ) );
    m_pPage3LogoCB->Check();

    // set cursor in timefield
    Edit *pEditPage3PresTimeTMF = m_pPage3PresTimeTMF->GetField();
    Edit *pEditPage3BreakTMF = m_pPage3BreakTMF->GetField();
    Selection aSel1( pEditPage3PresTimeTMF->GetMaxTextLen(), pEditPage3PresTimeTMF->GetMaxTextLen() );
    Selection aSel2( pEditPage3BreakTMF->GetMaxTextLen(), pEditPage3BreakTMF->GetMaxTextLen() );
    pEditPage3PresTimeTMF->SetSelection( aSel1 );
    pEditPage3BreakTMF->SetSelection( aSel2 );

    // Seite 4
    m_aAssistentFunc.InsertControl(4,
        m_pPage4FB = new FixedBitmap(pWindow,SdResId(FB_PAGE4)));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4PersonalFL = new FixedLine( pWindow, SdResId(FL_PAGE4_PERSONAL) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskNameFT   = new FixedText( pWindow, SdResId(FT_PAGE4_ASKNAME) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskNameEDT  = new Edit( pWindow, SdResId(EDT_PAGE4_ASKNAME) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskTopicFT= new FixedText( pWindow, SdResId(FT_PAGE4_ASKTOPIC) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskTopicEDT = new Edit( pWindow, SdResId(EDT_PAGE4_ASKTOPIC) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskInfoFT   = new FixedText( pWindow, SdResId(FT_PAGE4_ASKINFORMATION) ));
    m_aAssistentFunc.InsertControl(4,
        m_pPage4AskInfoEDT  = new MultiLineEdit( pWindow, SdResId(EDT_PAGE4_ASKINFORMATION) ));

    m_pPage4AskNameEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
    m_pPage4AskTopicEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));
    m_pPage4AskInfoEDT->SetModifyHdl(LINK(this,AssistentDlgImpl,UpdateUserDataHdl));

    // page 5
    m_aAssistentFunc.InsertControl(5, &m_aPreview );
    m_aAssistentFunc.InsertControl(5, &m_aPreviewFlag );
    m_aAssistentFunc.InsertControl(5,
        m_pPage5FB = new FixedBitmap(pWindow,SdResId(FB_PAGE5)));
    m_aAssistentFunc.InsertControl(5,
        m_pPage5PageListFT = new FixedText( pWindow, SdResId( FT_PAGE5_PAGELIST ) ));
    m_aAssistentFunc.InsertControl(5,
        m_pPage5PageListCT = new SdPageListControl( pWindow, SdResId( CT_PAGE5_PAGELIST ) ));
    m_aAssistentFunc.InsertControl(5,
        m_pPage5SummaryCB  = new CheckBox( pWindow, SdResId( CB_PAGE5_SUMMARY ) ));

    m_pPage5PageListCT->SetSelectHdl(LINK(this,AssistentDlgImpl, PageSelectHdl));

    // generell
    InterpolateFixedBitmap( m_pPage1FB );
    InterpolateFixedBitmap( m_pPage2FB );
    InterpolateFixedBitmap( m_pPage3FB );
    InterpolateFixedBitmap( m_pPage4FB );
    InterpolateFixedBitmap( m_pPage5FB );

{'fraction_non_alphanumeric': 0.11319713993871297, 'fraction_numerical': 0.01673135852911134, 'mean_word_length': 4.055876884941128, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 227, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '93238', 'n_tokens_mistral': 18081, 'n_tokens_neox': 17319, 'n_words': 3037}