LCOV - code coverage report
Current view: top level - sd/source/ui/framework/factories - BasicViewFactory.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 181 212 85.4 %
Date: 2014-04-11 Functions: 25 25 100.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 "BasicViewFactory.hxx"
      22             : 
      23             : #include "framework/ViewShellWrapper.hxx"
      24             : #include "framework/FrameworkHelper.hxx"
      25             : #include <com/sun/star/drawing/framework/XControllerManager.hpp>
      26             : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      27             : #include "framework/Pane.hxx"
      28             : #include "DrawController.hxx"
      29             : #include "DrawSubController.hxx"
      30             : #include "ViewShellBase.hxx"
      31             : #include "ViewShellManager.hxx"
      32             : #include "DrawDocShell.hxx"
      33             : #include "DrawViewShell.hxx"
      34             : #include "GraphicViewShell.hxx"
      35             : #include "OutlineViewShell.hxx"
      36             : #include "PresentationViewShell.hxx"
      37             : #include "SlideSorterViewShell.hxx"
      38             : #include "FrameView.hxx"
      39             : 
      40             : #include <sfx2/viewfrm.hxx>
      41             : #include <vcl/wrkwin.hxx>
      42             : #include <toolkit/helper/vclunohelper.hxx>
      43             : 
      44             : #include <boost/bind.hpp>
      45             : 
      46             : using namespace ::com::sun::star;
      47             : using namespace ::com::sun::star::uno;
      48             : using namespace ::com::sun::star::lang;
      49             : using namespace ::com::sun::star::drawing::framework;
      50             : 
      51             : using ::sd::framework::FrameworkHelper;
      52             : 
      53             : 
      54             : namespace sd { namespace framework {
      55             : 
      56             : 
      57          73 : Reference<XInterface> SAL_CALL BasicViewFactory_createInstance (
      58             :     const Reference<XComponentContext>& rxContext)
      59             : {
      60          73 :     return Reference<XInterface>(static_cast<XWeak*>(new BasicViewFactory(rxContext)));
      61             : }
      62             : 
      63             : 
      64             : 
      65             : 
      66          26 : OUString BasicViewFactory_getImplementationName (void) throw(RuntimeException)
      67             : {
      68          26 :     return OUString("com.sun.star.comp.Draw.framework.BasicViewFactory");
      69             : }
      70             : 
      71             : 
      72             : 
      73             : 
      74          11 : Sequence<OUString> SAL_CALL BasicViewFactory_getSupportedServiceNames (void)
      75             :     throw (RuntimeException)
      76             : {
      77          11 :     static const OUString sServiceName("com.sun.star.drawing.framework.BasicViewFactory");
      78          11 :     return Sequence<OUString>(&sServiceName, 1);
      79             : }
      80             : 
      81             : 
      82             : 
      83             : 
      84             : //===== ViewDescriptor ========================================================
      85             : 
      86         272 : class BasicViewFactory::ViewDescriptor
      87             : {
      88             : public:
      89             :     Reference<XResource> mxView;
      90             :     ::boost::shared_ptr<sd::ViewShell> mpViewShell;
      91             :     ViewShellWrapper* mpWrapper;
      92             :     Reference<XResourceId> mxViewId;
      93         132 :     static bool CompareView (const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor,
      94             :         const Reference<XResource>& rxView)
      95         132 :     { return rpDescriptor->mxView.get() == rxView.get(); }
      96             : };
      97             : 
      98             : 
      99             : 
     100             : 
     101             : 
     102             : //===== BasicViewFactory::ViewShellContainer ==================================
     103             : 
     104          73 : class BasicViewFactory::ViewShellContainer
     105             :     : public ::std::vector<boost::shared_ptr<ViewDescriptor> >
     106             : {
     107             : public:
     108          73 :     ViewShellContainer (void) {};
     109             : };
     110             : 
     111             : 
     112          73 : class BasicViewFactory::ViewCache
     113             :     : public ::std::vector<boost::shared_ptr<ViewDescriptor> >
     114             : {
     115             : public:
     116          73 :     ViewCache (void) {};
     117             : };
     118             : 
     119             : 
     120             : 
     121             : 
     122             : //===== ViewFactory ===========================================================
     123             : 
     124          73 : BasicViewFactory::BasicViewFactory (
     125             :     const Reference<XComponentContext>& rxContext)
     126             :     : BasicViewFactoryInterfaceBase(MutexOwner::maMutex),
     127             :       mxConfigurationController(),
     128           0 :       mpViewShellContainer(new ViewShellContainer()),
     129             :       mpBase(NULL),
     130             :       mpFrameView(NULL),
     131          73 :       mpWindow(new WorkWindow(NULL,WB_STDWORK)),
     132           0 :       mpViewCache(new ViewCache()),
     133         146 :       mxLocalPane(new Pane(Reference<XResourceId>(), mpWindow.get()))
     134             : {
     135             :     (void)rxContext;
     136          73 : }
     137             : 
     138             : 
     139             : 
     140             : 
     141         146 : BasicViewFactory::~BasicViewFactory (void)
     142             : {
     143         146 : }
     144             : 
     145             : 
     146             : 
     147             : 
     148          73 : void SAL_CALL BasicViewFactory::disposing (void)
     149             : {
     150             :     // Disconnect from the frame view.
     151          73 :     if (mpFrameView != NULL)
     152             :     {
     153          69 :         mpFrameView->Disconnect();
     154          69 :         mpFrameView = NULL;
     155             :     }
     156             : 
     157             :     // Relase the view cache.
     158          73 :     ViewShellContainer::const_iterator iView;
     159         136 :     for (iView=mpViewCache->begin(); iView!=mpViewCache->end(); ++iView)
     160             :     {
     161          63 :         ReleaseView(*iView, true);
     162             :     }
     163             : 
     164             :     // Release the view shell container.  At this point no one other than us
     165             :     // should hold references to the view shells (at the moment this is a
     166             :     // trivial requirement, because no one other then us holds a shared
     167             :     // pointer).
     168             :     //    ViewShellContainer::const_iterator iView;
     169          73 :     for (iView=mpViewShellContainer->begin(); iView!=mpViewShellContainer->end(); ++iView)
     170             :     {
     171             :         OSL_ASSERT((*iView)->mpViewShell.unique());
     172             :     }
     173          73 :     mpViewShellContainer.reset();
     174          73 : }
     175             : 
     176             : 
     177             : 
     178             : 
     179         209 : Reference<XResource> SAL_CALL BasicViewFactory::createResource (
     180             :     const Reference<XResourceId>& rxViewId)
     181             :     throw(RuntimeException, IllegalArgumentException, WrappedTargetException, std::exception)
     182             : {
     183         209 :     Reference<XResource> xView;
     184             :     const bool bIsCenterPane (
     185         209 :         rxViewId->isBoundToURL(FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT));
     186             : 
     187             :     // Get the pane for the anchor URL.
     188         418 :     Reference<XPane> xPane;
     189         209 :     if (mxConfigurationController.is())
     190         418 :         xPane = Reference<XPane>(mxConfigurationController->getResource(rxViewId->getAnchor()),
     191         209 :             UNO_QUERY);
     192             : 
     193             :     // For main views use the frame view of the last main view.
     194         209 :     ::sd::FrameView* pFrameView = NULL;
     195         209 :     if (xPane.is() && bIsCenterPane)
     196             :     {
     197          73 :         pFrameView = mpFrameView;
     198             :     }
     199             : 
     200             :     // Get Window pointer for XWindow of the pane.
     201         209 :     ::Window* pWindow = NULL;
     202         209 :     if (xPane.is())
     203         209 :         pWindow = VCLUnoHelper::GetWindow(xPane->getWindow());
     204             : 
     205             :     // Get the view frame.
     206         209 :     SfxViewFrame* pFrame = NULL;
     207         209 :     if (mpBase != NULL)
     208         209 :         pFrame = mpBase->GetViewFrame();
     209             : 
     210         209 :     if (pFrame != NULL && mpBase!=NULL && pWindow!=NULL)
     211             :     {
     212             :         // Try to get the view from the cache.
     213         136 :         ::boost::shared_ptr<ViewDescriptor> pDescriptor (GetViewFromCache(rxViewId, xPane));
     214             : 
     215             :         // When the requested view is not in the cache then create a new view.
     216         136 :         if (pDescriptor.get() == NULL)
     217             :         {
     218         136 :             pDescriptor = CreateView(rxViewId, *pFrame, *pWindow, xPane, pFrameView, bIsCenterPane);
     219             :         }
     220             : 
     221         132 :         if (pDescriptor.get() != NULL)
     222         132 :             xView = pDescriptor->mxView;
     223             : 
     224         132 :         mpViewShellContainer->push_back(pDescriptor);
     225             : 
     226         132 :         if (bIsCenterPane)
     227          69 :             ActivateCenterView(pDescriptor);
     228             :         else
     229          67 :             pWindow->Resize();
     230             :     }
     231             : 
     232         410 :     return xView;
     233             : }
     234             : 
     235             : 
     236             : 
     237             : 
     238         132 : void SAL_CALL BasicViewFactory::releaseResource (const Reference<XResource>& rxView)
     239             :     throw(RuntimeException, std::exception)
     240             : {
     241         132 :     if ( ! rxView.is())
     242           0 :         throw lang::IllegalArgumentException();
     243             : 
     244         132 :     if (rxView.is() && mpBase!=NULL)
     245             :     {
     246             :         ViewShellContainer::iterator iViewShell (
     247             :             ::std::find_if(
     248         132 :                 mpViewShellContainer->begin(),
     249         132 :                 mpViewShellContainer->end(),
     250         396 :                 ::boost::bind(&ViewDescriptor::CompareView, _1, rxView)));
     251         132 :         if (iViewShell != mpViewShellContainer->end())
     252             :         {
     253         132 :             ::boost::shared_ptr<ViewShell> pViewShell ((*iViewShell)->mpViewShell);
     254             : 
     255         264 :             if ((*iViewShell)->mxViewId->isBoundToURL(
     256         132 :                 FrameworkHelper::msCenterPaneURL, AnchorBindingMode_DIRECT))
     257             :             {
     258             :                 // Obtain a pointer to and connect to the frame view of the
     259             :                 // view.  The next view, that is created, will be
     260             :                 // initialized with this frame view.
     261          69 :                 if (mpFrameView == NULL)
     262             :                 {
     263          69 :                     mpFrameView = pViewShell->GetFrameView();
     264          69 :                     if (mpFrameView)
     265          69 :                         mpFrameView->Connect();
     266             :                 }
     267             : 
     268             :                 // With the view in the center pane the sub controller is
     269             :                 // released, too.
     270          69 :                 mpBase->GetDrawController().SetSubController(
     271         138 :                     Reference<drawing::XDrawSubController>());
     272             : 
     273          69 :                 SfxViewShell* pSfxViewShell = pViewShell->GetViewShell();
     274          69 :                 if (pSfxViewShell != NULL)
     275          69 :                     pSfxViewShell->DisconnectAllClients();
     276             :             }
     277             : 
     278         132 :             ReleaseView(*iViewShell);
     279             : 
     280         132 :             mpViewShellContainer->erase(iViewShell);
     281             :         }
     282             :         else
     283             :         {
     284           0 :             throw lang::IllegalArgumentException();
     285             :         }
     286             :     }
     287         132 : }
     288             : 
     289             : 
     290             : 
     291             : 
     292          73 : void SAL_CALL BasicViewFactory::initialize (const Sequence<Any>& aArguments)
     293             :     throw (Exception, RuntimeException, std::exception)
     294             : {
     295          73 :     if (aArguments.getLength() > 0)
     296             :     {
     297          73 :         Reference<XConfigurationController> xCC;
     298             :         try
     299             :         {
     300             :             // Get the XController from the first argument.
     301          73 :             Reference<frame::XController> xController (aArguments[0], UNO_QUERY_THROW);
     302             : 
     303             :             // Tunnel through the controller to obtain a ViewShellBase.
     304         146 :             Reference<lang::XUnoTunnel> xTunnel (xController, UNO_QUERY_THROW);
     305             :             ::sd::DrawController* pController = reinterpret_cast<sd::DrawController*>(
     306          73 :                 xTunnel->getSomething(sd::DrawController::getUnoTunnelId()));
     307          73 :             if (pController != NULL)
     308          73 :                 mpBase = pController->GetViewShellBase();
     309             : 
     310             :             // Register the factory for its supported views.
     311         146 :             Reference<XControllerManager> xCM (xController,UNO_QUERY_THROW);
     312          73 :             mxConfigurationController = xCM->getConfigurationController();
     313          73 :             if ( ! mxConfigurationController.is())
     314           0 :                 throw RuntimeException();
     315          73 :             mxConfigurationController->addResourceFactory(FrameworkHelper::msImpressViewURL, this);
     316          73 :             mxConfigurationController->addResourceFactory(FrameworkHelper::msDrawViewURL, this);
     317          73 :             mxConfigurationController->addResourceFactory(FrameworkHelper::msOutlineViewURL, this);
     318          73 :             mxConfigurationController->addResourceFactory(FrameworkHelper::msNotesViewURL, this);
     319          73 :             mxConfigurationController->addResourceFactory(FrameworkHelper::msHandoutViewURL, this);
     320          73 :             mxConfigurationController->addResourceFactory(FrameworkHelper::msPresentationViewURL, this);
     321         146 :             mxConfigurationController->addResourceFactory(FrameworkHelper::msSlideSorterURL, this);
     322             :         }
     323           0 :         catch (RuntimeException&)
     324             :         {
     325           0 :             mpBase = NULL;
     326           0 :             if (mxConfigurationController.is())
     327           0 :                 mxConfigurationController->removeResourceFactoryForReference(this);
     328           0 :             throw;
     329          73 :         }
     330             :     }
     331          73 : }
     332             : 
     333             : 
     334             : 
     335             : 
     336         136 : ::boost::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::CreateView (
     337             :     const Reference<XResourceId>& rxViewId,
     338             :     SfxViewFrame& rFrame,
     339             :     ::Window& rWindow,
     340             :     const Reference<XPane>& rxPane,
     341             :     FrameView* pFrameView,
     342             :     const bool bIsCenterPane)
     343             : {
     344         136 :     ::boost::shared_ptr<ViewDescriptor> pDescriptor (new ViewDescriptor());
     345             : 
     346         268 :     pDescriptor->mpViewShell = CreateViewShell(
     347             :         rxViewId,
     348             :         rFrame,
     349             :         rWindow,
     350             :         pFrameView,
     351         132 :         bIsCenterPane);
     352         132 :     pDescriptor->mxViewId = rxViewId;
     353             : 
     354         132 :     if (pDescriptor->mpViewShell.get() != NULL)
     355             :     {
     356         132 :         pDescriptor->mpViewShell->Init(bIsCenterPane);
     357         132 :         mpBase->GetViewShellManager()->ActivateViewShell(pDescriptor->mpViewShell.get());
     358             : 
     359         132 :         Reference<awt::XWindow> xWindow(rxPane->getWindow());
     360         132 :         pDescriptor->mpWrapper = new ViewShellWrapper(
     361         132 :             pDescriptor->mpViewShell,
     362             :             rxViewId,
     363         264 :             xWindow);
     364             : 
     365             :         // register ViewShellWrapper on pane window
     366         132 :         if (xWindow.is())
     367             :         {
     368         132 :             xWindow->addWindowListener(pDescriptor->mpWrapper);
     369         132 :             if (pDescriptor->mpViewShell != 0)
     370             :             {
     371         132 :                 pDescriptor->mpViewShell->Resize();
     372             :             }
     373             :         }
     374             : 
     375         132 :         pDescriptor->mxView.set( pDescriptor->mpWrapper->queryInterface( cppu::UnoType<XResource>::get() ), UNO_QUERY_THROW );
     376             :     }
     377             : 
     378         132 :     return pDescriptor;
     379             : }
     380             : 
     381             : 
     382             : 
     383             : 
     384         136 : ::boost::shared_ptr<ViewShell> BasicViewFactory::CreateViewShell (
     385             :     const Reference<XResourceId>& rxViewId,
     386             :     SfxViewFrame& rFrame,
     387             :     ::Window& rWindow,
     388             :     FrameView* pFrameView,
     389             :     const bool bIsCenterPane)
     390             : {
     391         136 :     ::boost::shared_ptr<ViewShell> pViewShell;
     392         272 :     const OUString& rsViewURL (rxViewId->getResourceURL());
     393         136 :     if (rsViewURL.equals(FrameworkHelper::msImpressViewURL))
     394             :     {
     395             :         pViewShell.reset(
     396             :             new DrawViewShell(
     397             :                 &rFrame,
     398             :                 *mpBase,
     399             :                 &rWindow,
     400             :                 PK_STANDARD,
     401          25 :                 pFrameView));
     402             :     }
     403         115 :     else if (rsViewURL.equals(FrameworkHelper::msDrawViewURL))
     404             :     {
     405             :         pViewShell.reset(
     406             :             new GraphicViewShell (
     407             :                 &rFrame,
     408             :                 *mpBase,
     409             :                 &rWindow,
     410          52 :                 pFrameView));
     411             :     }
     412          63 :     else if (rsViewURL.equals(FrameworkHelper::msOutlineViewURL))
     413             :     {
     414             :         pViewShell.reset(
     415             :             new OutlineViewShell (
     416             :                 &rFrame,
     417             :                 *mpBase,
     418             :                 &rWindow,
     419           0 :                 pFrameView));
     420             :     }
     421          63 :     else if (rsViewURL.equals(FrameworkHelper::msNotesViewURL))
     422             :     {
     423             :         pViewShell.reset(
     424             :             new DrawViewShell(
     425             :                 &rFrame,
     426             :                 *mpBase,
     427             :                 &rWindow,
     428             :                 PK_NOTES,
     429           0 :                 pFrameView));
     430             :     }
     431          63 :     else if (rsViewURL.equals(FrameworkHelper::msHandoutViewURL))
     432             :     {
     433             :         pViewShell.reset(
     434             :             new DrawViewShell(
     435             :                 &rFrame,
     436             :                 *mpBase,
     437             :                 &rWindow,
     438             :                 PK_HANDOUT,
     439           0 :                 pFrameView));
     440             :     }
     441          63 :     else if (rsViewURL.equals(FrameworkHelper::msPresentationViewURL))
     442             :     {
     443             :         pViewShell.reset(
     444             :             new PresentationViewShell(
     445             :                 &rFrame,
     446             :                 *mpBase,
     447             :                 &rWindow,
     448           0 :                 pFrameView));
     449             :     }
     450          63 :     else if (rsViewURL.equals(FrameworkHelper::msSlideSorterURL))
     451             :     {
     452         126 :         pViewShell = ::sd::slidesorter::SlideSorterViewShell::Create (
     453             :             &rFrame,
     454             :             *mpBase,
     455             :             &rWindow,
     456             :             pFrameView,
     457          63 :             bIsCenterPane);
     458             :     }
     459             : 
     460         264 :     return pViewShell;
     461             : }
     462             : 
     463             : 
     464             : 
     465             : 
     466         195 : void BasicViewFactory::ReleaseView (
     467             :     const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor,
     468             :     bool bDoNotCache)
     469             : {
     470         195 :     bool bIsCacheable (!bDoNotCache && IsCacheable(rpDescriptor));
     471             : 
     472         195 :     if (bIsCacheable)
     473             :     {
     474          63 :         Reference<XRelocatableResource> xResource (rpDescriptor->mxView, UNO_QUERY);
     475          63 :         if (xResource.is())
     476             :         {
     477          63 :             Reference<XResource> xNewAnchor (mxLocalPane, UNO_QUERY);
     478          63 :             if (xNewAnchor.is())
     479          63 :                 if (xResource->relocateToAnchor(xNewAnchor))
     480          63 :                     mpViewCache->push_back(rpDescriptor);
     481             :                 else
     482           0 :                     bIsCacheable = false;
     483             :             else
     484           0 :                 bIsCacheable = false;
     485             :         }
     486             :         else
     487             :         {
     488           0 :             bIsCacheable = false;
     489          63 :         }
     490             :     }
     491             : 
     492         195 :     if ( ! bIsCacheable)
     493             :     {
     494             :         // Shut down the current view shell.
     495         132 :         rpDescriptor->mpViewShell->Shutdown ();
     496         132 :         mpBase->GetDocShell()->Disconnect(rpDescriptor->mpViewShell.get());
     497         132 :         mpBase->GetViewShellManager()->DeactivateViewShell(rpDescriptor->mpViewShell.get());
     498             : 
     499         132 :         Reference<XComponent> xComponent (rpDescriptor->mxView, UNO_QUERY);
     500         132 :         if (xComponent.is())
     501         132 :             xComponent->dispose();
     502             :     }
     503         195 : }
     504             : 
     505             : 
     506             : 
     507             : 
     508         132 : bool BasicViewFactory::IsCacheable (const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor)
     509             : {
     510         132 :     bool bIsCacheable (false);
     511             : 
     512         132 :     Reference<XRelocatableResource> xResource (rpDescriptor->mxView, UNO_QUERY);
     513         132 :     if (xResource.is())
     514             :     {
     515         132 :         static ::std::vector<Reference<XResourceId> > maCacheableResources;
     516         132 :         if (maCacheableResources.empty() )
     517             :         {
     518          10 :             ::boost::shared_ptr<FrameworkHelper> pHelper (FrameworkHelper::Instance(*mpBase));
     519             : 
     520             :             // The slide sorter and the task panel are cacheable and relocatable.
     521          10 :             maCacheableResources.push_back(pHelper->CreateResourceId(
     522          10 :                 FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftDrawPaneURL));
     523          10 :             maCacheableResources.push_back(pHelper->CreateResourceId(
     524          10 :                 FrameworkHelper::msSlideSorterURL, FrameworkHelper::msLeftImpressPaneURL));
     525             :         }
     526             : 
     527         132 :         ::std::vector<Reference<XResourceId> >::const_iterator iId;
     528         282 :         for (iId=maCacheableResources.begin(); iId!=maCacheableResources.end(); ++iId)
     529             :         {
     530         213 :             if ((*iId)->compareTo(rpDescriptor->mxViewId) == 0)
     531             :             {
     532          63 :                 bIsCacheable = true;
     533          63 :                 break;
     534             :             }
     535             :         }
     536             :     }
     537             : 
     538         132 :     return bIsCacheable;
     539             : }
     540             : 
     541             : 
     542             : 
     543             : 
     544         136 : ::boost::shared_ptr<BasicViewFactory::ViewDescriptor> BasicViewFactory::GetViewFromCache (
     545             :     const Reference<XResourceId>& rxViewId,
     546             :     const Reference<XPane>& rxPane)
     547             : {
     548         136 :     ::boost::shared_ptr<ViewDescriptor> pDescriptor;
     549             : 
     550             :     // Search for the requested view in the cache.
     551         136 :     ViewCache::iterator iEntry;
     552         136 :     for (iEntry=mpViewCache->begin(); iEntry!=mpViewCache->end(); ++iEntry)
     553             :     {
     554           0 :         if ((*iEntry)->mxViewId->compareTo(rxViewId) == 0)
     555             :         {
     556           0 :             pDescriptor = *iEntry;
     557           0 :             mpViewCache->erase(iEntry);
     558           0 :             break;
     559             :         }
     560             :     }
     561             : 
     562             :     // When the view has been found then relocate it to the given pane and
     563             :     // remove it from the cache.
     564         136 :     if (pDescriptor.get() != NULL)
     565             :     {
     566           0 :         bool bRelocationSuccessfull (false);
     567           0 :         Reference<XRelocatableResource> xResource (pDescriptor->mxView, UNO_QUERY);
     568           0 :         if (xResource.is() && rxPane.is())
     569             :         {
     570           0 :             if (xResource->relocateToAnchor(rxPane))
     571           0 :                 bRelocationSuccessfull = true;
     572             :         }
     573             : 
     574           0 :         if ( ! bRelocationSuccessfull)
     575             :         {
     576           0 :             ReleaseView(pDescriptor, true);
     577           0 :             pDescriptor.reset();
     578           0 :         }
     579             :     }
     580             : 
     581         136 :     return pDescriptor;
     582             : }
     583             : 
     584             : 
     585             : 
     586             : 
     587          69 : void BasicViewFactory::ActivateCenterView (
     588             :     const ::boost::shared_ptr<ViewDescriptor>& rpDescriptor)
     589             : {
     590          69 :     mpBase->GetDocShell()->Connect(rpDescriptor->mpViewShell.get());
     591             : 
     592             :     // During the creation of the new sub-shell, resize requests were not
     593             :     // forwarded to it because it was not yet registered.  Therefore, we
     594             :     // have to request a resize now.
     595          69 :     rpDescriptor->mpViewShell->UIFeatureChanged();
     596          69 :     if (mpBase->GetDocShell()->IsInPlaceActive())
     597           0 :         mpBase->GetViewFrame()->Resize(true);
     598             : 
     599          69 :     mpBase->GetDrawController().SetSubController(
     600         138 :         rpDescriptor->mpViewShell->CreateSubController());
     601          69 : }
     602             : 
     603          48 : } } // end of namespace sd::framework
     604             : 
     605             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10