i'm study the impress part in OOo source code, now i want to understand how
to play the odp file by slide, and i write some codes to test how to play a
odp file:

    // bootstrap UNO
    uno::Reference< lang::XMultiServiceFactory > xFactory;
    try
    {
        uno::Reference< uno::XComponentContext > xCtx =
::cppu::defaultBootstrap_InitialComponentContext();
        xFactory = uno::Reference< lang::XMultiServiceFactory >(
xCtx->getServiceManager(),

uno::UNO_QUERY );
        if( xFactory.is() )
            ::comphelper::setProcessServiceFactory( xFactory );
    }
    catch( uno::RuntimeException& )
    {
        throw;
    }
    catch( uno::Exception& )
    {
        OSL_ENSURE( false,
                    rtl::OUStringToOString(
                        comphelper::anyToString( cppu::getCaughtException()
),
                        RTL_TEXTENCODING_UTF8 ).getStr() );
    }

    if( !xFactory.is() )
    {
        OSL_TRACE( "Could not bootstrap UNO, installation must be in
disorder. Exiting.\n" );
        exit( 1 );
    }

 // Create UCB.
  uno::Sequence< uno::Any > aArgs( 2 );
 aArgs[ 0 ] <<= rtl::OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL
);
 aArgs[ 1 ] <<= rtl::OUString::createFromAscii(
UCB_CONFIGURATION_KEY2_OFFICE );
 ::ucbhelper::ContentBroker::initialize( xFactory, aArgs )

 // init the sddll
 SdDLL::Init();

 // open the test odp file
 SfxMedium *pMedium = NULL;
 pMedium = new SfxMedium(TESTODP_FILENAME, STREAM_READ, FALSE );

 // new the drawdocshell
 SfxObjectShell* lpObjShell = new
::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD);

 lpObjShell->DoInitNew(pMedium);

 WorkWindow* pWorkWindow = new WorkWindow (
        NULL,
        WB_CLIPCHILDREN);
    pWorkWindow->StartPresentationMode (
        TRUE,
        PRESENTATION_NOFULLSCREEN);

    pWorkWindow->SetBackground(Wallpaper(COL_BLACK));
 SfxTopFrame *lpTopFrame = SfxTopFrame::Create(pObjShell, &pWorkWindow);
 sd::PresentationViewShellBase *lpViewShellBase =
(sd::PresentationViewShellBase*)(sd::PresentationViewShellBase::CreateInstance(lpTopFrame->GetCurrentViewFrame(),
NULL));
 sd::DrawViewShell *lpDrawViewShell = new
sd::DrawViewShell(lpTopFrame->GetCurrentViewFrame(), *lpViewShellBase,
lpViewShellBase->GetViewWindow() );
 sd::DrawView *lpView = lpDrawViewShell->GetDrawView();

 sd::Slideshow *lpSlideShow = NULL;
 lpSlideShow = new sd::Slideshow(lpDrawViewShell, (sd::View*)lpView,
((sd::DrawDocShell*)pObjShell )->GetDoc(),
lpViewShellBase->GetViewWindow());
 lpSlideShow->startShow();


 pWorkWindow->Show();

and i complie the codes, it runs, the slideshow window and slides didn't pop
up, is there something wrong with the codes, who can tell me what is wrong
whth it, thanks very much!

Reply via email to