LCOV - code coverage report
Current view: top level - sd/source/ui/app - sdmod1.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 429 0.0 %
Date: 2014-04-14 Functions: 0 17 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : 
      21             : #include <svl/lckbitem.hxx>
      22             : #include <sfx2/frame.hxx>
      23             : #include <sfx2/viewfrm.hxx>
      24             : #include <unotools/moduleoptions.hxx>
      25             : #include "framework/FrameworkHelper.hxx"
      26             : 
      27             : #include <svx/dialogs.hrc>
      28             : 
      29             : #include <editeng/langitem.hxx>
      30             : #include <editeng/editdata.hxx>
      31             : #include <vcl/msgbox.hxx>
      32             : #include <editeng/svxenum.hxx>
      33             : #include <sfx2/dispatch.hxx>
      34             : #include <sfx2/request.hxx>
      35             : #include <sfx2/printer.hxx>
      36             : #include <sfx2/docfile.hxx>
      37             : #include <editeng/paperinf.hxx>
      38             : #include <editeng/eeitem.hxx>
      39             : #include <unotools/useroptions.hxx>
      40             : #include <com/sun/star/uno/Sequence.h>
      41             : 
      42             : #include "app.hrc"
      43             : #include "glob.hrc"
      44             : #include "strings.hrc"
      45             : #include "res_bmp.hrc"
      46             : 
      47             : #include "sdmod.hxx"
      48             : #include "pres.hxx"
      49             : #include "optsitem.hxx"
      50             : #include "ViewShell.hxx"
      51             : #include "sdattr.hxx"
      52             : #include "sdpage.hxx"
      53             : #include "DrawDocShell.hxx"
      54             : #include "drawdoc.hxx"
      55             : #include "assclass.hxx"
      56             : #include "sdenumdef.hxx"
      57             : #include "sdresid.hxx"
      58             : #include "OutlineViewShell.hxx"
      59             : #include "ViewShellBase.hxx"
      60             : #include "FrameView.hxx"
      61             : #include "FactoryIds.hxx"
      62             : #include "sdabstdlg.hxx"
      63             : #include <boost/shared_ptr.hpp>
      64             : #include <boost/scoped_array.hpp>
      65             : #include "slideshow.hxx"
      66             : 
      67             : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      68             : #include <com/sun/star/document/XDocumentProperties.hpp>
      69             : 
      70             : 
      71             : using ::sd::framework::FrameworkHelper;
      72             : using ::com::sun::star::uno::Reference;
      73             : using ::com::sun::star::frame::XFrame;
      74             : using ::com::sun::star::uno::Sequence;
      75             : 
      76             : namespace {
      77             : 
      78           0 : class OutlineToImpressFinalizer
      79             : {
      80             : public:
      81             :     OutlineToImpressFinalizer (
      82             :         ::sd::ViewShellBase& rBase,
      83             :         SdDrawDocument& rDocument,
      84             :         SvLockBytes& rBytes);
      85           0 :     virtual ~OutlineToImpressFinalizer (void) {};
      86             :     void operator() (bool bEventSeen);
      87             : private:
      88             :     ::sd::ViewShellBase& mrBase;
      89             :     SdDrawDocument& mrDocument;
      90             :     ::boost::shared_ptr<SvMemoryStream> mpStream;
      91             : };
      92             : 
      93             : 
      94             : } //end of anonymous namespace
      95             : 
      96             : 
      97           0 : void SdModule::Execute(SfxRequest& rReq)
      98             : {
      99           0 :     const SfxItemSet* pSet = rReq.GetArgs();
     100           0 :     sal_uLong nSlotId = rReq.GetSlot();
     101             : 
     102           0 :     switch ( nSlotId )
     103             :     {
     104             :         case SID_NEWDOC:
     105             :         {
     106           0 :             SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface());
     107             :         }
     108           0 :         break;
     109             : 
     110             :         case SID_AUTOSPELL_CHECK:
     111             :         {
     112             :             // automatic spell checker
     113             :             const SfxPoolItem* pItem;
     114           0 :             if( pSet && SFX_ITEM_SET == pSet->GetItemState(
     115           0 :                         SID_AUTOSPELL_CHECK, false, &pItem ) )
     116             :             {
     117           0 :                 sal_Bool bOnlineSpelling = ( (const SfxBoolItem*) pItem )->GetValue();
     118             :                 // save at document:
     119           0 :                 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     120           0 :                 if( pDocSh )
     121             :                 {
     122           0 :                     SdDrawDocument* pDoc = pDocSh->GetDoc();
     123           0 :                     pDoc->SetOnlineSpell( bOnlineSpelling );
     124             :                 }
     125             :             }
     126             :         }
     127           0 :         break;
     128             : 
     129             :         case SID_ATTR_METRIC:
     130             :         {
     131             :             const SfxPoolItem* pItem;
     132           0 :             if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_METRIC, true, &pItem ) )
     133             :             {
     134           0 :                 FieldUnit eUnit = (FieldUnit)((const SfxUInt16Item*)pItem)->GetValue();
     135           0 :                 switch( eUnit )
     136             :                 {
     137             :                     case FUNIT_MM:      // only the units which are also in the dialog
     138             :                     case FUNIT_CM:
     139             :                     case FUNIT_INCH:
     140             :                     case FUNIT_PICA:
     141             :                     case FUNIT_POINT:
     142             :                         {
     143           0 :                             ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
     144           0 :                             if(pDocSh)
     145             :                             {
     146           0 :                                 DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
     147             : 
     148           0 :                                 PutItem( *pItem );
     149           0 :                                 SdOptions* pOptions = GetSdOptions( eDocType );
     150           0 :                                 if(pOptions)
     151           0 :                                     pOptions->SetMetric( (sal_uInt16)eUnit );
     152           0 :                                 rReq.Done();
     153             :                             }
     154             :                         }
     155           0 :                         break;
     156             :                     default:
     157           0 :                         break;
     158             :                     }
     159             :                 }
     160             : 
     161             :         }
     162           0 :         break;
     163             : 
     164             :         case SID_ATTR_LANGUAGE:
     165             :         case SID_ATTR_CHAR_CJK_LANGUAGE:
     166             :         case SID_ATTR_CHAR_CTL_LANGUAGE:
     167             :         {
     168             :             const SfxPoolItem* pItem;
     169           0 :             if( pSet &&
     170             :                 (
     171           0 :                 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_LANGUAGE, false, &pItem ) ||
     172           0 :                 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CJK_LANGUAGE, false, &pItem ) ||
     173           0 :                 SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_CHAR_CTL_LANGUAGE, false, &pItem )
     174             :                 )
     175             :               )
     176             :             {
     177             :                 // save at the document:
     178           0 :                 ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     179           0 :                 if ( pDocSh )
     180             :                 {
     181           0 :                     LanguageType eLanguage = ( (SvxLanguageItem*)pItem )->GetValue();
     182           0 :                     SdDrawDocument* pDoc = pDocSh->GetDoc();
     183             : 
     184           0 :                     if( nSlotId == SID_ATTR_CHAR_CJK_LANGUAGE )
     185           0 :                         pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE_CJK );
     186           0 :                     else if( nSlotId == SID_ATTR_CHAR_CTL_LANGUAGE )
     187           0 :                         pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE_CTL );
     188             :                     else
     189           0 :                         pDoc->SetLanguage( eLanguage, EE_CHAR_LANGUAGE );
     190             : 
     191           0 :                     if( pDoc->GetOnlineSpell() )
     192             :                     {
     193           0 :                         pDoc->StopOnlineSpelling();
     194           0 :                         pDoc->StartOnlineSpelling();
     195             :                     }
     196             :                 }
     197             :             }
     198             :         }
     199           0 :         break;
     200             : 
     201             :         case SID_SD_AUTOPILOT:
     202             :         case SID_NEWSD:
     203             :             {
     204           0 :                 SfxFrame* pFrame = ExecuteNewDocument( rReq );
     205             :                 // if a frame was created, set it as return value
     206           0 :                 if(pFrame)
     207           0 :                     rReq.SetReturnValue(SfxFrameItem(0, pFrame));
     208             :             }
     209             : 
     210           0 :             break;
     211             : 
     212             :         case SID_OPENHYPERLINK:
     213             :         case SID_OPENDOC:
     214             :         {
     215           0 :             sal_Bool bIntercept = sal_False;
     216           0 :             ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     217           0 :             if (pDocShell)
     218             :             {
     219           0 :                 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
     220           0 :                 if (pViewShell)
     221             :                 {
     222           0 :                     if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) )
     223             :                     {
     224             :                         // Prevent documents from opening while the slide
     225             :                         // show is running, except when this request comes
     226             :                         // from a shape interaction.
     227           0 :                         if (rReq.GetArgs() == NULL)
     228             :                         {
     229           0 :                             bIntercept = sal_True;
     230             :                         }
     231             :                     }
     232             :                 }
     233             :             }
     234             : 
     235           0 :             if (!bIntercept)
     236             :             {
     237           0 :                 SFX_APP()->ExecuteSlot(rReq, SFX_APP()->GetInterface());
     238             :             }
     239             :             else
     240             :             {
     241           0 :                 ErrorBox(NULL, WB_OK, SD_RESSTR(STR_CANT_PERFORM_IN_LIVEMODE)).Execute();
     242             : 
     243           0 :                 SFX_REQUEST_ARG( rReq, pLinkItem, SfxLinkItem, SID_DONELINK, false );
     244           0 :                 if( pLinkItem )
     245           0 :                     pLinkItem->GetValue().Call( 0 );
     246             :             }
     247             :         }
     248           0 :         break;
     249             : 
     250             :         case SID_OUTLINE_TO_IMPRESS:
     251           0 :             OutlineToImpress (rReq);
     252           0 :             break;
     253             : 
     254             :         default:
     255           0 :         break;
     256             :     }
     257           0 : }
     258             : 
     259             : 
     260           0 : void SdModule::OutlineToImpress (SfxRequest& rRequest)
     261             : {
     262           0 :     const SfxItemSet* pSet = rRequest.GetArgs();
     263             : 
     264           0 :     if (pSet)
     265             :     {
     266           0 :         SvLockBytes* pBytes = ((SfxLockBytesItem&) pSet->Get(SID_OUTLINE_TO_IMPRESS)).GetValue();
     267             : 
     268           0 :         if (pBytes)
     269             :         {
     270           0 :             SfxObjectShellLock xDocShell;
     271             :             ::sd::DrawDocShell* pDocSh;
     272           0 :             xDocShell = pDocSh = new ::sd::DrawDocShell(
     273           0 :                 SFX_CREATE_MODE_STANDARD, sal_False);
     274           0 :             if(pDocSh)
     275             :             {
     276           0 :                 pDocSh->DoInitNew(NULL);
     277           0 :                 SdDrawDocument* pDoc = pDocSh->GetDoc();
     278           0 :                 if(pDoc)
     279             :                 {
     280           0 :                     pDoc->CreateFirstPages();
     281           0 :                     pDoc->StopWorkStartupDelay();
     282             :                 }
     283             : 
     284           0 :                 SFX_REQUEST_ARG( rRequest, pFrmItem, SfxFrameItem, SID_DOCFRAME, false);
     285           0 :                 SfxViewFrame::LoadDocumentIntoFrame( *pDocSh, pFrmItem, ::sd::OUTLINE_FACTORY_ID );
     286             : 
     287           0 :                 ::sd::ViewShell* pViewSh = pDocSh->GetViewShell();
     288             : 
     289           0 :                 if (pViewSh && pDoc)
     290             :                 {
     291             :                     // AutoLayouts have to be finished
     292           0 :                     pDoc->StopWorkStartupDelay();
     293             : 
     294           0 :                     SfxViewFrame* pViewFrame = pViewSh->GetViewFrame();
     295             : 
     296             :                     // When the view frame has not been just created we have
     297             :                     // to switch synchronously to the outline view.
     298             :                     // (Otherwise the request will be ignored anyway.)
     299             :                     ::sd::ViewShellBase* pBase
     300           0 :                         = dynamic_cast< ::sd::ViewShellBase*>(pViewFrame->GetViewShell());
     301           0 :                     if (pBase != NULL)
     302             :                     {
     303             :                         ::boost::shared_ptr<FrameworkHelper> pHelper (
     304           0 :                             FrameworkHelper::Instance(*pBase));
     305             :                         pHelper->RequestView(
     306             :                             FrameworkHelper::msOutlineViewURL,
     307           0 :                             FrameworkHelper::msCenterPaneURL);
     308             : 
     309             :                         pHelper->RunOnResourceActivation(
     310             :                             FrameworkHelper::CreateResourceId(
     311             :                             FrameworkHelper::msOutlineViewURL,
     312             :                             FrameworkHelper::msCenterPaneURL),
     313           0 :                             OutlineToImpressFinalizer(*pBase, *pDoc, *pBytes));
     314             :                     }
     315             :                 }
     316           0 :             }
     317             :         }
     318             :     }
     319             : 
     320           0 :     rRequest.IsDone();
     321           0 : }
     322             : 
     323             : 
     324             : static bool bOnce = false;
     325             : 
     326           0 : void SdModule::GetState(SfxItemSet& rItemSet)
     327             : {
     328             :     // disable Autopilot during presentation
     329           0 :     if (rItemSet.GetItemState(SID_SD_AUTOPILOT) != SFX_ITEM_UNKNOWN)
     330             :     {
     331           0 :         if (!SvtModuleOptions().IsImpress())
     332             :         {
     333           0 :             rItemSet.DisableItem(SID_SD_AUTOPILOT);
     334             :         }
     335             :         else
     336             :         {
     337           0 :             ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     338           0 :             if (pDocShell)
     339             :             {
     340           0 :                 ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
     341           0 :                 if (pViewShell)
     342             :                 {
     343           0 :                     if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) )
     344             :                     {
     345           0 :                         rItemSet.DisableItem(SID_SD_AUTOPILOT);
     346             :                     }
     347             :                 }
     348             :             }
     349             :         }
     350             :     }
     351             : 
     352           0 :     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_METRIC ) )
     353             :     {
     354           0 :         ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current() );
     355           0 :         if(pDocSh)
     356             :         {
     357           0 :             DocumentType eDocType = pDocSh->GetDoc()->GetDocumentType();
     358             : 
     359           0 :             SdOptions* pOptions = GetSdOptions(eDocType);
     360           0 :             rItemSet.Put( SfxUInt16Item( SID_ATTR_METRIC, pOptions->GetMetric() ) );
     361             :         }
     362             :     }
     363             : 
     364             :     // state of SID_OPENDOC is determined by the base class
     365           0 :     if (rItemSet.GetItemState(SID_OPENDOC) != SFX_ITEM_UNKNOWN)
     366             :     {
     367           0 :         const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENDOC, SFX_APP()->GetInterface());
     368           0 :         if (pItem)
     369           0 :             rItemSet.Put(*pItem);
     370             :     }
     371             : 
     372             :     // state of SID_OPENHYPERLINK is determined by the base class
     373           0 :     if (rItemSet.GetItemState(SID_OPENHYPERLINK) != SFX_ITEM_UNKNOWN)
     374             :     {
     375           0 :         const SfxPoolItem* pItem = SFX_APP()->GetSlotState(SID_OPENHYPERLINK, SFX_APP()->GetInterface());
     376           0 :         if (pItem)
     377           0 :             rItemSet.Put(*pItem);
     378             :     }
     379             : 
     380           0 :     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_AUTOSPELL_CHECK ) )
     381             :     {
     382             :         ::sd::DrawDocShell* pDocSh =
     383           0 :               PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     384           0 :         if( pDocSh )
     385             :         {
     386           0 :             SdDrawDocument* pDoc = pDocSh->GetDoc();
     387           0 :             rItemSet.Put( SfxBoolItem( SID_AUTOSPELL_CHECK, pDoc->GetOnlineSpell() ) );
     388             :         }
     389             :     }
     390             : 
     391           0 :     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_LANGUAGE ) )
     392             :     {
     393           0 :         ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     394           0 :         if( pDocSh )
     395           0 :             rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE ), SID_ATTR_LANGUAGE ) );
     396             :     }
     397             : 
     398           0 :     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CJK_LANGUAGE ) )
     399             :     {
     400           0 :         ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     401           0 :         if( pDocSh )
     402           0 :             rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CJK ), SID_ATTR_CHAR_CJK_LANGUAGE ) );
     403             :     }
     404             : 
     405           0 :     if( SFX_ITEM_AVAILABLE == rItemSet.GetItemState( SID_ATTR_CHAR_CTL_LANGUAGE ) )
     406             :     {
     407           0 :         ::sd::DrawDocShell* pDocSh = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     408           0 :         if( pDocSh )
     409           0 :             rItemSet.Put( SvxLanguageItem( pDocSh->GetDoc()->GetLanguage( EE_CHAR_LANGUAGE_CTL ), SID_ATTR_CHAR_CTL_LANGUAGE ) );
     410             :     }
     411             : 
     412           0 :     if ( !bOnce )
     413             :     {
     414           0 :         ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     415           0 :         if( pDocShell ) // Impress or Draw ?
     416             :         {
     417           0 :             ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
     418             : 
     419           0 :             if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) )
     420             :             {
     421             :                 // add our event listener as soon as possible
     422           0 :                 Application::AddEventListener( LINK( this, SdModule, EventListenerHdl ) );
     423           0 :                 bOnce = true;
     424             :             }
     425             :         }
     426             :     }
     427           0 : }
     428             : 
     429           0 : IMPL_LINK( SdModule, EventListenerHdl, VclSimpleEvent*, pEvent )
     430             : {
     431           0 :     if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() )
     432             :     {
     433           0 :         const CommandEvent& rEvent = *(const CommandEvent*)static_cast<VclWindowEvent*>(pEvent)->GetData();
     434             : 
     435           0 :         if( rEvent.GetCommand() == COMMAND_MEDIA )
     436             :         {
     437           0 :             switch( rEvent.GetMediaCommand() )
     438             :             {
     439             :                 case MEDIA_COMMAND_PLAY:
     440             :                 {
     441           0 :                     ::sd::DrawDocShell* pDocShell = PTR_CAST(::sd::DrawDocShell, SfxObjectShell::Current());
     442           0 :                     if( pDocShell )  // Impress or Draw ?
     443             :                     {
     444           0 :                         ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
     445             : 
     446             :                         // #i97925# start the presentation if and only if an Impress document is focused
     447           0 :                         if( pViewShell && (pDocShell->GetDocumentType() == DOCUMENT_TYPE_IMPRESS) )
     448           0 :                             pViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION );
     449             :                     }
     450             :                 }
     451           0 :                     break;
     452             : 
     453             :                 default:
     454           0 :                     break;
     455             :             }
     456             :         }
     457             :     }
     458           0 :     return 0;
     459             : }
     460             : 
     461             : 
     462           0 : void SdModule::AddSummaryPage (SfxViewFrame* pViewFrame, SdDrawDocument* pDocument)
     463             : {
     464           0 :     if( !pViewFrame || !pViewFrame->GetDispatcher() || !pDocument )
     465           0 :         return;
     466             : 
     467             :     pViewFrame->GetDispatcher()->Execute(SID_SUMMARY_PAGE,
     468           0 :         SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
     469             : 
     470             :     OSL_ASSERT (pDocument!=NULL);
     471             : 
     472           0 :     sal_Int32 nPageCount = pDocument->GetSdPageCount (PK_STANDARD);
     473             : 
     474             :     // We need at least two pages: the summary page and one to use as
     475             :     // template to take the transition parameters from.
     476           0 :     if (nPageCount >= 2)
     477             :     {
     478             :         // Get a page from which to retrieve the transition parameters.
     479           0 :         SdPage* pTemplatePage = pDocument->GetSdPage (0, PK_STANDARD);
     480             :         OSL_ASSERT (pTemplatePage!=NULL);
     481             : 
     482             :         // The summary page, if it exists, is the last page.
     483             :         SdPage* pSummaryPage = pDocument->GetSdPage (
     484           0 :             (sal_uInt16)nPageCount-1, PK_STANDARD);
     485             :         OSL_ASSERT (pSummaryPage!=NULL);
     486             : 
     487             :         // Take the change mode of the template page as indication of the
     488             :         // document's kiosk mode.
     489           0 :         pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration());
     490           0 :         pSummaryPage->SetPresChange(pTemplatePage->GetPresChange());
     491           0 :         pSummaryPage->SetTime(pTemplatePage->GetTime());
     492           0 :         pSummaryPage->SetSound(pTemplatePage->IsSoundOn());
     493           0 :         pSummaryPage->SetSoundFile(pTemplatePage->GetSoundFile());
     494           0 :         pSummaryPage->setTransitionType(pTemplatePage->getTransitionType());
     495           0 :         pSummaryPage->setTransitionSubtype(pTemplatePage->getTransitionSubtype());
     496           0 :         pSummaryPage->setTransitionDirection(pTemplatePage->getTransitionDirection());
     497           0 :         pSummaryPage->setTransitionFadeColor(pTemplatePage->getTransitionFadeColor());
     498           0 :         pSummaryPage->setTransitionDuration(pTemplatePage->getTransitionDuration());
     499             :     }
     500             : }
     501             : 
     502           0 : SfxFrame* SdModule::CreateFromTemplate( const OUString& rTemplatePath, const Reference< XFrame >& i_rFrame )
     503             : {
     504           0 :     SfxFrame* pFrame = 0;
     505             : 
     506           0 :     SfxObjectShellLock xDocShell;
     507             : 
     508           0 :     SfxItemSet* pSet = new SfxAllItemSet( SFX_APP()->GetPool() );
     509           0 :     pSet->Put( SfxBoolItem( SID_TEMPLATE, true ) );
     510             : 
     511           0 :     sal_uLong lErr = SFX_APP()->LoadTemplate( xDocShell, rTemplatePath, true, pSet );
     512             : 
     513           0 :     SfxObjectShell* pDocShell = xDocShell;
     514             : 
     515           0 :     if( lErr )
     516             :     {
     517           0 :         ErrorHandler::HandleError(lErr);
     518             :     }
     519           0 :     else if( pDocShell )
     520             :     {
     521           0 :         SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pDocShell, i_rFrame );
     522             :         OSL_ENSURE( pViewFrame, "SdModule::CreateFromTemplate: no view frame - was the document really loaded?" );
     523           0 :         pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
     524             :     }
     525             : 
     526           0 :     return pFrame;
     527             : 
     528             : }
     529             : 
     530           0 : SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
     531             : {
     532           0 :     SfxFrame* pFrame = 0;
     533           0 :     if ( SvtModuleOptions().IsImpress() )
     534             :     {
     535           0 :         Reference< XFrame > xTargetFrame;
     536           0 :         SFX_REQUEST_ARG( rReq, pFrmItem, SfxUnoFrameItem, SID_FILLFRAME, false);
     537           0 :         if ( pFrmItem )
     538           0 :             xTargetFrame = pFrmItem->GetFrame();
     539             : 
     540           0 :         SfxViewFrame* pViewFrame = NULL;
     541             : 
     542           0 :         SdOptions* pOpt = GetSdOptions(DOCUMENT_TYPE_IMPRESS);
     543           0 :         bool bStartWithTemplate = pOpt->IsStartWithTemplate();
     544             : 
     545           0 :         bool bNewDocDirect = rReq.GetSlot() == SID_NEWSD;
     546           0 :         if( bNewDocDirect && !bStartWithTemplate )
     547             :         {
     548             :             //we start without wizard
     549             : 
     550             :             //check whether we should load a template document
     551           0 :             const OUString aServiceName( "com.sun.star.presentation.PresentationDocument" );
     552           0 :             OUString aStandardTemplate( SfxObjectFactory::GetStandardTemplate( aServiceName ) );
     553             : 
     554           0 :             if( !aStandardTemplate.isEmpty() )
     555             :             {
     556             :                 //load a template document
     557           0 :                 pFrame = CreateFromTemplate( aStandardTemplate, xTargetFrame );
     558             :             }
     559             :             else
     560             :             {
     561             :                 //create an empty document
     562           0 :                 pFrame = CreateEmptyDocument( DOCUMENT_TYPE_IMPRESS, xTargetFrame );
     563           0 :             }
     564             :         }
     565             :         else
     566             :         {
     567           0 :             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     568           0 :             boost::scoped_ptr< AbstractAssistentDlg > pPilotDlg( pFact ? pFact->CreateAssistentDlg( NULL, !bNewDocDirect ) : 0 );
     569             : 
     570             :             // Open the Pilot
     571           0 :             if( pPilotDlg.get() && pPilotDlg->Execute()==RET_OK )
     572             :             {
     573           0 :                 const OUString aDocPath( pPilotDlg->GetDocPath());
     574           0 :                 const sal_Bool bIsDocEmpty = pPilotDlg->IsDocEmpty();
     575             : 
     576             :                 // So that you can open the document without AutoLayout-Dialog
     577           0 :                 pOpt->SetStartWithTemplate(sal_False);
     578           0 :                 if(bNewDocDirect && !pPilotDlg->GetStartWithFlag())
     579           0 :                     bStartWithTemplate = false;
     580             : 
     581           0 :                 if( pPilotDlg->GetStartType() == ST_OPEN )
     582             :                 {
     583           0 :                     OUString aFileToOpen = aDocPath;
     584             : 
     585             :                     DBG_ASSERT( !aFileToOpen.isEmpty(), "The autopilot should have asked for a file itself already!" );
     586           0 :                     if (!aFileToOpen.isEmpty())
     587             :                     {
     588           0 :                         com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > aPasswrd( pPilotDlg->GetPassword() );
     589             : 
     590           0 :                         SfxStringItem aFile( SID_FILE_NAME, aFileToOpen );
     591           0 :                         SfxStringItem aReferer( SID_REFERER, OUString());
     592           0 :                         SfxUnoAnyItem aPassword( SID_ENCRYPTIONDATA, com::sun::star::uno::makeAny(aPasswrd) );
     593             : 
     594           0 :                         if ( xTargetFrame.is() )
     595             :                         {
     596           0 :                             SfxAllItemSet aSet( *rReq.GetArgs()->GetPool() );
     597           0 :                             aSet.Put( aFile );
     598           0 :                             aSet.Put( aReferer );
     599             :                             // Put the password into the request
     600             :                             // only if it is not empty.
     601           0 :                             if (aPasswrd.getLength() > 0)
     602           0 :                                 aSet.Put( aPassword );
     603             : 
     604           0 :                             const SfxPoolItem* pRet = SfxFrame::OpenDocumentSynchron( aSet, xTargetFrame );
     605           0 :                             const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet );
     606           0 :                             if ( pFrameItem && pFrameItem->GetFrame() )
     607           0 :                                 pFrame = &pFrameItem->GetFrame()->GetFrame();
     608             :                         }
     609             :                         else
     610             :                         {
     611           0 :                             SfxRequest aRequest (SID_OPENDOC, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool());
     612           0 :                             aRequest.AppendItem (aFile);
     613           0 :                             aRequest.AppendItem (aReferer);
     614             :                             // Put the password into the request
     615             :                             // only if it is not empty.
     616           0 :                             if (aPasswrd.getLength() > 0)
     617           0 :                                 aRequest.AppendItem (aPassword);
     618             :                             aRequest.AppendItem (SfxStringItem (
     619             :                                 SID_TARGETNAME,
     620           0 :                                 OUString("_default")));
     621             :                             try
     622             :                             {
     623           0 :                                 const SfxPoolItem* pRet = SFX_APP()->ExecuteSlot (aRequest);
     624           0 :                                 const SfxViewFrameItem* pFrameItem = PTR_CAST( SfxViewFrameItem, pRet );
     625           0 :                                 if ( pFrameItem )
     626           0 :                                     pFrame = &pFrameItem->GetFrame()->GetFrame();
     627             :                             }
     628           0 :                             catch (const ::com::sun::star::uno::Exception&)
     629             :                             {
     630             :                                 DBG_ASSERT (false, "caught IllegalArgumentException while loading document from Impress autopilot");
     631           0 :                             }
     632           0 :                         }
     633             :                     }
     634             : 
     635           0 :                     pOpt->SetStartWithTemplate(bStartWithTemplate);
     636           0 :                     if(bNewDocDirect && !bStartWithTemplate)
     637             :                     {
     638           0 :                         boost::scoped_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) );
     639           0 :                         if(pRet.get())
     640           0 :                             ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() );
     641             : 
     642           0 :                     }
     643             :                 }
     644             :                 else
     645             :                 {
     646           0 :                     SfxObjectShellLock xShell( pPilotDlg->GetDocument() );
     647           0 :                     SfxObjectShell* pShell = xShell;
     648           0 :                     if( pShell )
     649             :                     {
     650           0 :                         pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pShell, xTargetFrame );
     651             :                         DBG_ASSERT( pViewFrame, "no ViewFrame!!" );
     652           0 :                         pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
     653             : 
     654           0 :                         if(bNewDocDirect && !bStartWithTemplate)
     655             :                         {
     656           0 :                             boost::scoped_ptr< SfxItemSet > pRet( CreateItemSet( SID_SD_EDITOPTIONS ) );
     657           0 :                             if(pRet.get())
     658           0 :                                 ApplyItemSet( SID_SD_EDITOPTIONS, *pRet.get() );
     659             :                         }
     660             : 
     661           0 :                         if( pShell && pViewFrame )
     662             :                         {
     663             :                             ::sd::DrawDocShell* pDocShell =
     664           0 :                                   PTR_CAST(::sd::DrawDocShell,pShell);
     665           0 :                             SdDrawDocument* pDoc = pDocShell->GetDoc();
     666             : 
     667             :                             ::sd::ViewShellBase* pBase =
     668             :                                   ::sd::ViewShellBase::GetViewShellBase (
     669           0 :                                       pViewFrame);
     670             :                             OSL_ASSERT (pBase!=NULL);
     671           0 :                             ::boost::shared_ptr<sd::ViewShell> pViewSh = pBase->GetMainViewShell();
     672           0 :                             SdOptions* pOptions = GetSdOptions(pDoc->GetDocumentType());
     673             : 
     674           0 :                             if (pOptions && pViewSh.get())
     675             :                             {
     676             :                                 // The AutoPilot-document shall be open without its own options
     677           0 :                                 ::sd::FrameView* pFrameView = pViewSh->GetFrameView();
     678           0 :                                 pFrameView->Update(pOptions);
     679           0 :                                 pViewSh->ReadFrameViewData(pFrameView);
     680             :                             }
     681             : 
     682           0 :                             ChangeMedium( pDocShell, pViewFrame, pPilotDlg->GetOutputMedium() );
     683             : 
     684           0 :                             if(pPilotDlg->IsSummary())
     685           0 :                                 AddSummaryPage(pViewFrame, pDoc);
     686             : 
     687             :                             // empty document
     688           0 :                             if (aDocPath.isEmpty() && pViewFrame && pViewFrame->GetDispatcher())
     689             :                             {
     690           0 :                                 SfxBoolItem aIsChangedItem(SID_MODIFYPAGE, !bIsDocEmpty);
     691           0 :                                 SfxUInt32Item eAutoLayout( ID_VAL_WHATLAYOUT, (sal_uInt32) AUTOLAYOUT_TITLE );
     692             :                                 pViewFrame->GetDispatcher()->Execute(SID_MODIFYPAGE,
     693           0 :                                    SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD, &aIsChangedItem, &eAutoLayout, 0L);
     694             :                             }
     695             : 
     696             :                             // clear document info
     697             :                             using namespace ::com::sun::star;
     698             :                             uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
     699           0 :                                 pDocShell->GetModel(), uno::UNO_QUERY_THROW);
     700             :                             uno::Reference<document::XDocumentProperties>
     701           0 :                                 xDocProps(xDPS->getDocumentProperties());
     702             :                             DBG_ASSERT(xDocProps.is(), "no DocumentProperties");
     703           0 :                             xDocProps->resetUserData(
     704           0 :                                 SvtUserOptions().GetFullName() );
     705           0 :                             xDocProps->setTemplateName(xDocProps->getTitle());
     706           0 :                             xDocProps->setTemplateURL(pPilotDlg->GetDocPath());
     707             : 
     708           0 :                             pDoc->SetChanged(!bIsDocEmpty);
     709             : 
     710           0 :                             pDocShell->SetUseUserData(true);
     711             : 
     712             :                             // clear UNDO stack after autopilot
     713           0 :                             pDocShell->ClearUndoBuffer();
     714             :                         }
     715             :                     }
     716           0 :                     pOpt->SetStartWithTemplate(bStartWithTemplate);
     717           0 :                 }
     718           0 :             }
     719           0 :         }
     720             :     }
     721             : 
     722           0 :     return pFrame;
     723             : }
     724             : 
     725           0 : SfxFrame* SdModule::CreateEmptyDocument( DocumentType eDocType, const Reference< XFrame >& i_rFrame )
     726             : {
     727           0 :     SfxFrame* pFrame = 0;
     728             : 
     729           0 :     SfxObjectShellLock xDocShell;
     730             :     ::sd::DrawDocShell* pNewDocSh;
     731           0 :     xDocShell = pNewDocSh = new ::sd::DrawDocShell(SFX_CREATE_MODE_STANDARD,sal_False,eDocType);
     732           0 :     if(pNewDocSh)
     733             :     {
     734           0 :         pNewDocSh->DoInitNew(NULL);
     735           0 :         SdDrawDocument* pDoc = pNewDocSh->GetDoc();
     736           0 :         if(pDoc)
     737             :         {
     738           0 :             pDoc->CreateFirstPages();
     739           0 :             pDoc->StopWorkStartupDelay();
     740             :         }
     741             : 
     742           0 :         SfxViewFrame* pViewFrame = SfxViewFrame::LoadDocumentIntoFrame( *pNewDocSh, i_rFrame );
     743             :         OSL_ENSURE( pViewFrame, "SdModule::CreateEmptyDocument: no view frame - was the document really loaded?" );
     744           0 :         pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL;
     745             :     }
     746             : 
     747           0 :     return pFrame;
     748             : }
     749             : 
     750           0 : void SdModule::ChangeMedium( ::sd::DrawDocShell* pDocShell, SfxViewFrame* pViewFrame, const sal_Int32 eMedium )
     751             : {
     752           0 :     if( !pDocShell )
     753           0 :         return;
     754             : 
     755           0 :     SdDrawDocument* pDoc = pDocShell->GetDoc();
     756           0 :     if( !pDoc )
     757           0 :         return;
     758             : 
     759             :     // settings for the Outputmedium
     760           0 :     Size aNewSize;
     761           0 :     sal_uInt32 nLeft = 0;
     762           0 :     sal_uInt32 nRight = 0;
     763           0 :     sal_uInt32 nLower = 0;
     764           0 :     sal_uInt32 nUpper = 0;
     765           0 :     switch(eMedium)
     766             :     {
     767             :         case OUTPUT_PAGE:
     768             :         case OUTPUT_OVERHEAD:
     769             :         {
     770           0 :             SfxPrinter* pPrinter = pDocShell->GetPrinter(sal_True);
     771             : 
     772           0 :             if( pPrinter && pPrinter->IsValid())
     773             :             {
     774             :                 // Unfortunately, the printer does not provide an exact format
     775             :                 // like A4
     776           0 :                 Size aSize(pPrinter->GetPaperSize());
     777           0 :                 Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, MAP_100TH_MM, true);
     778             : 
     779           0 :                 if (ePaper != PAPER_USER)
     780             :                 {
     781             :                     // get correct size
     782           0 :                     aSize = SvxPaperInfo::GetPaperSize(ePaper, MAP_100TH_MM);
     783             :                 }
     784             : 
     785           0 :                 if (aSize.Height() > aSize.Width())
     786             :                 {
     787             :                      // always landscape
     788           0 :                      aNewSize.Width()  = aSize.Height();
     789           0 :                      aNewSize.Height() = aSize.Width();
     790             :                 }
     791             :                 else
     792             :                 {
     793           0 :                      aNewSize = aSize;
     794             :                 }
     795             :             }
     796             :             else
     797             :             {
     798           0 :                 aNewSize=Size(29700, 21000);
     799             :             }
     800             : 
     801           0 :             if (eMedium == OUTPUT_PAGE)
     802             :             {
     803           0 :                 nLeft =1000;
     804           0 :                 nRight=1000;
     805           0 :                 nUpper=1000;
     806           0 :                 nLower=1000;
     807             :             }
     808             :             else
     809             :             {
     810           0 :                 nLeft =0;
     811           0 :                 nRight=0;
     812           0 :                 nUpper=0;
     813           0 :                 nLower=0;
     814             :             }
     815             :         }
     816           0 :         break;
     817             : 
     818             :         case OUTPUT_SLIDE:
     819             :         {
     820           0 :             aNewSize = Size(27000, 18000);
     821           0 :             nLeft =0;
     822           0 :             nRight=0;
     823           0 :             nUpper=0;
     824           0 :             nLower=0;
     825             :         }
     826           0 :         break;
     827             : 
     828             :         case OUTPUT_WIDESCREEN:
     829             :         {
     830           0 :             aNewSize = Size(28000, 15750);
     831           0 :             nLeft =0;
     832           0 :             nRight=0;
     833           0 :             nUpper=0;
     834           0 :             nLower=0;
     835             :         }
     836           0 :         break;
     837             : 
     838             :         case OUTPUT_PRESENTATION:
     839             :         {
     840           0 :             aNewSize = Size(28000, 21000);
     841           0 :             nLeft =0;
     842           0 :             nRight=0;
     843           0 :             nUpper=0;
     844           0 :             nLower=0;
     845             :         }
     846           0 :         break;
     847             :     }
     848             : 
     849           0 :     sal_Bool bScaleAll = sal_True;
     850           0 :     sal_uInt16 nPageCnt = pDoc->GetMasterSdPageCount(PK_STANDARD);
     851             :     sal_uInt16 i;
     852             :     SdPage* pPage;
     853             : 
     854             :     // master pages first
     855           0 :     for (i = 0; i < nPageCnt; i++)
     856             :     {
     857           0 :         pPage = pDoc->GetMasterSdPage(i, PK_STANDARD);
     858             : 
     859           0 :         if (pPage)
     860             :         {
     861           0 :             if(eMedium != OUTPUT_ORIGINAL)
     862             :             {
     863           0 :                 Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
     864           0 :                 pPage->ScaleObjects(aNewSize, aBorderRect, bScaleAll);
     865           0 :                 pPage->SetSize(aNewSize);
     866           0 :                 pPage->SetBorder(nLeft, nUpper, nRight, nLower);
     867             :             }
     868           0 :             SdPage* pNotesPage = pDoc->GetMasterSdPage(i, PK_NOTES);
     869             :             DBG_ASSERT( pNotesPage, "Wrong page ordering!" );
     870           0 :             if( pNotesPage ) pNotesPage->CreateTitleAndLayout();
     871           0 :             pPage->CreateTitleAndLayout();
     872             :         }
     873             :     }
     874             : 
     875           0 :     nPageCnt = pDoc->GetSdPageCount(PK_STANDARD);
     876             : 
     877             :     // then slides
     878           0 :     for (i = 0; i < nPageCnt; i++)
     879             :     {
     880           0 :         pPage = pDoc->GetSdPage(i, PK_STANDARD);
     881             : 
     882           0 :         if (pPage)
     883             :         {
     884           0 :             if(eMedium != OUTPUT_ORIGINAL)
     885             :             {
     886           0 :                 Rectangle aBorderRect(nLeft, nUpper, nRight, nLower);
     887           0 :                 pPage->ScaleObjects(aNewSize, aBorderRect, bScaleAll);
     888           0 :                 pPage->SetSize(aNewSize);
     889           0 :                 pPage->SetBorder(nLeft, nUpper, nRight, nLower);
     890             :             }
     891           0 :             SdPage* pNotesPage = pDoc->GetSdPage(i, PK_NOTES);
     892             :             DBG_ASSERT( pNotesPage, "Wrong page ordering!" );
     893           0 :             if( pNotesPage ) pNotesPage->SetAutoLayout( pNotesPage->GetAutoLayout() );
     894           0 :             pPage->SetAutoLayout( pPage->GetAutoLayout() );
     895             :         }
     896             :     }
     897             : 
     898           0 :     SdPage* pHandoutPage = pDoc->GetSdPage(0, PK_HANDOUT);
     899           0 :     pHandoutPage->CreateTitleAndLayout(sal_True);
     900             : 
     901           0 :     if( (eMedium != OUTPUT_ORIGINAL) && pViewFrame && pViewFrame->GetDispatcher())
     902             :     {
     903           0 :         pViewFrame->GetDispatcher()->Execute(SID_SIZE_PAGE, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
     904             :     }
     905             : }
     906             : 
     907             : 
     908             : 
     909             : 
     910             : //===== OutlineToImpressFinalize ==============================================
     911             : 
     912             : namespace {
     913             : 
     914           0 : OutlineToImpressFinalizer::OutlineToImpressFinalizer (
     915             :     ::sd::ViewShellBase& rBase,
     916             :     SdDrawDocument& rDocument,
     917             :     SvLockBytes& rBytes)
     918             :     : mrBase(rBase),
     919             :       mrDocument(rDocument),
     920           0 :       mpStream()
     921             : {
     922             :     // The given stream has a lifetime shorter than this new
     923             :     // OutlineToImpressFinalizer object.  Therefore a local copy of the
     924             :     // stream is created.
     925           0 :     const SvStream* pStream (rBytes.GetStream());
     926           0 :     if (pStream != NULL)
     927             :     {
     928             :         // Create a memory stream and prepare to fill it with the content of
     929             :         // the original stream.
     930           0 :         mpStream.reset(new SvMemoryStream());
     931             :         static const sal_Size nBufferSize = 4096;
     932           0 :         ::boost::scoped_array<sal_Int8> pBuffer (new sal_Int8[nBufferSize]);
     933             : 
     934           0 :         sal_uInt64 nReadPosition(0);
     935           0 :         bool bLoop (true);
     936           0 :         while (bLoop)
     937             :         {
     938             :             // Read the next part of the original stream.
     939           0 :             sal_Size nReadByteCount (0);
     940             :             const ErrCode nErrorCode (
     941             :                 rBytes.ReadAt(
     942             :                     nReadPosition,
     943           0 :                     reinterpret_cast<void*>(pBuffer.get()),
     944             :                     nBufferSize,
     945           0 :                     &nReadByteCount));
     946             : 
     947             :             // Check the error code and stop copying the stream data when an
     948             :             // error has occurred.
     949           0 :             switch (nErrorCode)
     950             :             {
     951             :                 case ERRCODE_NONE:
     952           0 :                     if (nReadByteCount == 0)
     953           0 :                         bLoop = false;
     954           0 :                     break;
     955             :                 case ERRCODE_IO_PENDING:
     956           0 :                     break;
     957             : 
     958             :                 default:
     959           0 :                     bLoop = false;
     960           0 :                     nReadByteCount = 0;
     961           0 :                     break;
     962             :             }
     963             : 
     964             :             // Append the read bytes to the end of the memory stream.
     965           0 :             if (nReadByteCount > 0)
     966             :             {
     967           0 :                 mpStream->Write(reinterpret_cast<void*>(pBuffer.get()), nReadByteCount);
     968           0 :                 nReadPosition += nReadByteCount;
     969             :             }
     970             :         }
     971             : 
     972             :         // Rewind the memory stream so that in the operator() method its
     973             :         // content is properly read.
     974           0 :         mpStream->Seek(STREAM_SEEK_TO_BEGIN);
     975             :     }
     976           0 : }
     977             : 
     978             : 
     979             : 
     980             : 
     981           0 : void OutlineToImpressFinalizer::operator() (bool)
     982             : {
     983             :     // Fetch the new outline view shell.
     984             :     ::sd::OutlineViewShell* pOutlineShell
     985           0 :         = dynamic_cast<sd::OutlineViewShell*>(FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
     986             : 
     987           0 :     if (pOutlineShell != NULL && mpStream.get() != NULL)
     988             :     {
     989           0 :         sd::OutlineView* pView = static_cast<sd::OutlineView*>(pOutlineShell->GetView());
     990             :         // mba: the stream can't contain any relative URLs, because we don't
     991             :         // have any information about a BaseURL!
     992           0 :         if ( pOutlineShell->Read(*mpStream, OUString(), EE_FORMAT_RTF) == 0 )
     993             :         {
     994             :         }
     995             : 
     996             :         // Call UpdatePreview once for every slide to resync the
     997             :         // document with the outliner of the OutlineViewShell.
     998           0 :         sal_uInt16 nPageCount (mrDocument.GetSdPageCount(PK_STANDARD));
     999           0 :         for (sal_uInt16 nIndex=0; nIndex<nPageCount; nIndex++)
    1000             :         {
    1001           0 :             SdPage* pPage = mrDocument.GetSdPage(nIndex, PK_STANDARD);
    1002             :             // Make the page the actual page so that the
    1003             :             // following UpdatePreview() call accesses the
    1004             :             // correct paragraphs.
    1005           0 :             pView->SetActualPage(pPage);
    1006           0 :             pOutlineShell->UpdatePreview(pPage, true);
    1007             :         }
    1008             :         // Select the first slide.
    1009           0 :         SdPage* pPage = mrDocument.GetSdPage(0, PK_STANDARD);
    1010           0 :         pView->SetActualPage(pPage);
    1011           0 :         pOutlineShell->UpdatePreview(pPage, true);
    1012             :     }
    1013             : 
    1014             : 
    1015             :     // Undo-Stack needs to be cleared, else the user may remove the
    1016             :     // only drawpage and this is a state we cannot handle ATM.
    1017           0 :     ::sd::DrawDocShell* pDocShell = mrDocument.GetDocSh();
    1018           0 :     if( pDocShell )
    1019           0 :         pDocShell->ClearUndoBuffer();
    1020           0 : }
    1021             : 
    1022             : 
    1023           0 : } // end of anonymous namespace
    1024             : 
    1025             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10