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

Generated by: LCOV version 1.11