LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/slidesorter/shell - SlideSorterViewShell.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 251 0.8 %
Date: 2012-12-27 Functions: 3 53 5.7 %
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 "SlideSorterViewShell.hxx"
      22             : #include "ViewShellImplementation.hxx"
      23             : 
      24             : #include "SlideSorter.hxx"
      25             : #include "controller/SlideSorterController.hxx"
      26             : #include "controller/SlsClipboard.hxx"
      27             : #include "controller/SlsFocusManager.hxx"
      28             : #include "controller/SlsScrollBarManager.hxx"
      29             : #include "controller/SlsPageSelector.hxx"
      30             : #include "controller/SlsSlotManager.hxx"
      31             : #include "controller/SlsCurrentSlideManager.hxx"
      32             : #include "controller/SlsSelectionManager.hxx"
      33             : #include "controller/SlsSelectionFunction.hxx"
      34             : #include "controller/SlsProperties.hxx"
      35             : #include "view/SlideSorterView.hxx"
      36             : #include "view/SlsLayouter.hxx"
      37             : #include "model/SlideSorterModel.hxx"
      38             : #include "model/SlsPageEnumeration.hxx"
      39             : #include "model/SlsPageDescriptor.hxx"
      40             : #include "framework/FrameworkHelper.hxx"
      41             : #include "ViewShellBase.hxx"
      42             : #include "drawdoc.hxx"
      43             : #include "app.hrc"
      44             : #include "glob.hrc"
      45             : #include "sdattr.hrc"
      46             : #include "sdresid.hxx"
      47             : #include "AccessibleSlideSorterView.hxx"
      48             : #include "DrawDocShell.hxx"
      49             : #include "FrameView.hxx"
      50             : #include "SdUnoSlideView.hxx"
      51             : #include "ViewShellManager.hxx"
      52             : #include "Window.hxx"
      53             : #include <sfx2/app.hxx>
      54             : #include <sfx2/msg.hxx>
      55             : #include <sfx2/objface.hxx>
      56             : #include <sfx2/viewfrm.hxx>
      57             : #include <sfx2/bindings.hxx>
      58             : #include <sfx2/dispatch.hxx>
      59             : #include <sfx2/request.hxx>
      60             : #include <svx/svxids.hrc>
      61             : #include <com/sun/star/drawing/framework/XControllerManager.hpp>
      62             : #include <com/sun/star/drawing/framework/ResourceId.hpp>
      63             : #include <cppuhelper/bootstrap.hxx>
      64             : #include <comphelper/processfactory.hxx>
      65             : 
      66             : using namespace ::sd::slidesorter;
      67             : #define SlideSorterViewShell
      68             : #include "sdslots.hxx"
      69             : 
      70             : using namespace ::com::sun::star;
      71             : using namespace ::com::sun::star::uno;
      72             : using namespace ::com::sun::star::drawing::framework;
      73             : 
      74             : using ::sd::framework::FrameworkHelper;
      75             : 
      76             : namespace sd { namespace slidesorter {
      77             : 
      78             : 
      79           9 : SFX_IMPL_INTERFACE(SlideSorterViewShell, SfxShell, SdResId(STR_SLIDESORTERVIEWSHELL))
      80             : {
      81           3 : }
      82             : 
      83             : 
      84             : 
      85           0 : TYPEINIT1(SlideSorterViewShell, ViewShell);
      86             : 
      87             : 
      88             : 
      89           0 : ::boost::shared_ptr<SlideSorterViewShell> SlideSorterViewShell::Create (
      90             :     SfxViewFrame* pFrame,
      91             :     ViewShellBase& rViewShellBase,
      92             :     ::Window* pParentWindow,
      93             :     FrameView* pFrameViewArgument,
      94             :     const bool bIsCenterPane)
      95             : {
      96             :     (void)bIsCenterPane;
      97             : 
      98           0 :     ::boost::shared_ptr<SlideSorterViewShell> pViewShell;
      99             :     try
     100             :     {
     101             :         pViewShell.reset(
     102           0 :             new SlideSorterViewShell(pFrame,rViewShellBase,pParentWindow,pFrameViewArgument));
     103           0 :         pViewShell->Initialize();
     104           0 :         if (pViewShell->mpSlideSorter.get() == NULL)
     105           0 :             pViewShell.reset();
     106             :     }
     107           0 :     catch(Exception&)
     108             :     {
     109           0 :         pViewShell.reset();
     110             :     }
     111           0 :     return pViewShell;
     112             : }
     113             : 
     114             : 
     115             : 
     116             : 
     117           0 : SlideSorterViewShell::SlideSorterViewShell (
     118             :     SfxViewFrame* pFrame,
     119             :     ViewShellBase& rViewShellBase,
     120             :     ::Window* pParentWindow,
     121             :     FrameView* pFrameViewArgument)
     122             :     : ViewShell (pFrame, pParentWindow, rViewShellBase),
     123             :       mpSlideSorter(),
     124           0 :       mbIsArrangeGUIElementsPending(true)
     125             : {
     126           0 :     meShellType = ST_SLIDE_SORTER;
     127             : 
     128           0 :     if (pFrameViewArgument != NULL)
     129           0 :         mpFrameView = pFrameViewArgument;
     130             :     else
     131           0 :         mpFrameView = new FrameView(GetDoc());
     132           0 :     GetFrameView()->Connect();
     133             : 
     134           0 :     SetName (rtl::OUString("SlideSorterViewShell"));
     135             : 
     136           0 :     pParentWindow->SetStyle(pParentWindow->GetStyle() | WB_DIALOGCONTROL);
     137           0 : }
     138             : 
     139             : 
     140             : 
     141             : 
     142           0 : SlideSorterViewShell::~SlideSorterViewShell (void)
     143             : {
     144           0 :     DisposeFunctions();
     145             : 
     146             :     try
     147             :     {
     148           0 :         ::sd::Window* pWindow = GetActiveWindow();
     149           0 :         if (pWindow!=NULL)
     150             :         {
     151             :             ::com::sun::star::uno::Reference<
     152             :                 ::com::sun::star::lang::XComponent> xComponent (
     153             :                     pWindow->GetAccessible(false),
     154           0 :                     ::com::sun::star::uno::UNO_QUERY);
     155           0 :             if (xComponent.is())
     156           0 :                 xComponent->dispose();
     157             :         }
     158             :     }
     159           0 :     catch( ::com::sun::star::uno::Exception& )
     160             :     {
     161             :         OSL_FAIL("sd::SlideSorterViewShell::~SlideSorterViewShell(), exception caught!" );
     162             :     }
     163           0 :     GetFrameView()->Disconnect();
     164           0 : }
     165             : 
     166             : 
     167             : 
     168             : 
     169             : 
     170           0 : void SlideSorterViewShell::Initialize (void)
     171             : {
     172             :     mpSlideSorter = SlideSorter::CreateSlideSorter(
     173             :         *this,
     174             :         mpContentWindow,
     175             :         mpHorizontalScrollBar,
     176             :         mpVerticalScrollBar,
     177           0 :         mpScrollBarBox);
     178           0 :     mpView = &mpSlideSorter->GetView();
     179             : 
     180           0 :     doShow();
     181             : 
     182           0 :     SetPool( &GetDoc()->GetPool() );
     183           0 :     SetUndoManager( GetDoc()->GetDocSh()->GetUndoManager() );
     184             : 
     185             :     // For accessibility we have to shortly hide the content window.
     186             :     // This triggers the construction of a new accessibility object for
     187             :     // the new view shell.  (One is created earlier while the construtor
     188             :     // of the base class is executed.  At that time the correct
     189             :     // accessibility object can not be constructed.)
     190           0 :     SharedSdWindow pWindow (mpSlideSorter->GetContentWindow());
     191           0 :     if (pWindow)
     192             :     {
     193           0 :         pWindow->Hide();
     194           0 :         pWindow->Show();
     195           0 :     }
     196           0 : }
     197             : 
     198             : 
     199             : 
     200             : 
     201           0 : void SlideSorterViewShell::Init (bool bIsMainViewShell)
     202             : {
     203           0 :     ViewShell::Init(bIsMainViewShell);
     204             : 
     205           0 :     mpSlideSorter->GetModel().UpdatePageList();
     206             : 
     207           0 :     if (mpContentWindow.get() != NULL)
     208           0 :         mpContentWindow->SetViewShell(this);
     209           0 : }
     210             : 
     211             : 
     212             : 
     213             : 
     214           0 : SlideSorterViewShell* SlideSorterViewShell::GetSlideSorter (ViewShellBase& rBase)
     215             : {
     216           0 :     SlideSorterViewShell* pViewShell = NULL;
     217             : 
     218             :     // Test the center, left, and then the right pane for showing a slide sorter.
     219             :     ::rtl::OUString aPaneURLs[] = {
     220             :         FrameworkHelper::msCenterPaneURL,
     221             :         FrameworkHelper::msFullScreenPaneURL,
     222             :         FrameworkHelper::msLeftImpressPaneURL,
     223             :         FrameworkHelper::msRightPaneURL,
     224           0 :         ::rtl::OUString()};
     225             : 
     226             :     try
     227             :     {
     228           0 :         ::boost::shared_ptr<FrameworkHelper> pFrameworkHelper (FrameworkHelper::Instance(rBase));
     229           0 :         if (pFrameworkHelper->IsValid())
     230           0 :             for (int i=0; pViewShell==NULL && !aPaneURLs[i].isEmpty(); ++i)
     231             :             {
     232             :                 pViewShell = dynamic_cast<SlideSorterViewShell*>(
     233           0 :                     pFrameworkHelper->GetViewShell(aPaneURLs[i]).get());
     234           0 :             }
     235             :     }
     236           0 :     catch (RuntimeException&)
     237             :     {}
     238             : 
     239           0 :     return pViewShell;
     240             : }
     241             : 
     242             : 
     243             : 
     244             : 
     245           0 : Reference<drawing::XDrawSubController> SlideSorterViewShell::CreateSubController (void)
     246             : {
     247           0 :     Reference<drawing::XDrawSubController> xSubController;
     248             : 
     249           0 :     if (IsMainViewShell())
     250             :     {
     251             :         // Create uno controller for the main view shell.
     252             :         xSubController = Reference<drawing::XDrawSubController>(
     253             :             new SdUnoSlideView (
     254           0 :                 *mpSlideSorter));
     255             :     }
     256             : 
     257           0 :     return xSubController;
     258             : }
     259             : 
     260             : 
     261             : 
     262             : 
     263             : /** If there is a valid controller then create a new instance of
     264             :     <type>AccessibleSlideSorterView</type>.  Otherwise delegate this call
     265             :     to the base class to return a default object (probably an empty
     266             :     reference).
     267             : */
     268             : ::com::sun::star::uno::Reference<
     269             :     ::com::sun::star::accessibility::XAccessible>
     270           0 :     SlideSorterViewShell::CreateAccessibleDocumentView (::sd::Window* pWindow)
     271             : {
     272             :     // When the view is not set then the initialization is not yet complete
     273             :     // and we can not yet provide an accessibility object.
     274           0 :     if (mpView == NULL || mpSlideSorter.get() == NULL)
     275           0 :         return NULL;
     276             : 
     277             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     278             : 
     279             :     ::accessibility::AccessibleSlideSorterView *pAccessibleView =
     280             :     new ::accessibility::AccessibleSlideSorterView(
     281           0 :         *mpSlideSorter.get(),
     282             :         pWindow->GetAccessibleParentWindow()->GetAccessible(),
     283           0 :         pWindow);
     284             : 
     285           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> xRet(pAccessibleView);
     286             : 
     287           0 :     pAccessibleView->Init();
     288             : 
     289           0 :     return xRet;
     290             : }
     291             : 
     292             : 
     293             : 
     294             : 
     295           0 : SlideSorter& SlideSorterViewShell::GetSlideSorter (void) const
     296             : {
     297             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     298           0 :     return *mpSlideSorter;
     299             : }
     300             : 
     301             : 
     302             : 
     303             : 
     304           0 : bool SlideSorterViewShell::RelocateToParentWindow (::Window* pParentWindow)
     305             : {
     306             :     OSL_ASSERT(mpSlideSorter);
     307           0 :     if ( ! mpSlideSorter)
     308           0 :         return false;
     309             : 
     310           0 :     if (pParentWindow == NULL)
     311           0 :         WriteFrameViewData();
     312           0 :     const bool bSuccess (mpSlideSorter->RelocateToWindow(pParentWindow));
     313           0 :     if (pParentWindow != NULL)
     314           0 :         ReadFrameViewData(mpFrameView);
     315             : 
     316           0 :     return bSuccess;
     317             : }
     318             : 
     319             : 
     320             : 
     321             : 
     322           0 : ::svl::IUndoManager* SlideSorterViewShell::ImpGetUndoManager (void) const
     323             : {
     324           0 :     SfxShell* pObjectBar = GetViewShellBase().GetViewShellManager()->GetTopShell();
     325           0 :     if (pObjectBar != NULL)
     326             :     {
     327             :         // When it exists then return the undo manager of the currently
     328             :         // active object bar.  The object bar is missing when the
     329             :         // SlideSorterViewShell is not the main view shell.
     330           0 :         return pObjectBar->GetUndoManager();
     331             :     }
     332             :     else
     333             :     {
     334             :         // Return the undo manager of this  shell when there is no object or
     335             :         // tool bar.
     336           0 :         return const_cast<SlideSorterViewShell*>(this)->GetUndoManager();
     337             :     }
     338             : }
     339             : 
     340             : 
     341             : 
     342             : 
     343           0 : void SlideSorterViewShell::GetFocus (void)
     344             : {
     345             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     346           0 :     mpSlideSorter->GetController().GetFocusManager().ShowFocus();
     347           0 : }
     348             : 
     349             : 
     350             : 
     351             : 
     352           0 : void SlideSorterViewShell::LoseFocus (void)
     353             : {
     354             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     355           0 :     mpSlideSorter->GetController().GetFocusManager().HideFocus();
     356           0 : }
     357             : 
     358             : 
     359             : 
     360             : 
     361           0 : SdPage* SlideSorterViewShell::getCurrentPage(void) const
     362             : {
     363             :     // since SlideSorterViewShell::GetActualPage() currently also
     364             :     // returns master pages, which is a wrong behaviour for GetActualPage(),
     365             :     // we can just use that for now
     366           0 :     return const_cast<SlideSorterViewShell*>(this)->GetActualPage();
     367             : }
     368             : 
     369             : 
     370             : 
     371             : 
     372           0 : SdPage* SlideSorterViewShell::GetActualPage (void)
     373             : {
     374           0 :     SdPage* pCurrentPage = NULL;
     375             : 
     376             :     // 1. Try to get the current page from the view shell in the center pane
     377             :     // (if we are that not ourself).
     378           0 :     if ( ! IsMainViewShell())
     379             :     {
     380           0 :         ::boost::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell();
     381           0 :         if (pMainViewShell.get() != NULL)
     382           0 :             pCurrentPage = pMainViewShell->GetActualPage();
     383             :     }
     384             : 
     385           0 :     if (pCurrentPage == NULL)
     386             :     {
     387             :         model::SharedPageDescriptor pDescriptor (
     388           0 :             mpSlideSorter->GetController().GetCurrentSlideManager()->GetCurrentSlide());
     389           0 :         if (pDescriptor.get() != NULL)
     390           0 :             pCurrentPage = pDescriptor->GetPage();
     391             :     }
     392             : 
     393             :     if (pCurrentPage == NULL)
     394             :     {
     395             : 
     396             :     }
     397             : 
     398           0 :     return pCurrentPage;
     399             : }
     400             : 
     401             : 
     402             : 
     403             : 
     404           0 : void SlideSorterViewShell::GetMenuState ( SfxItemSet& rSet)
     405             : {
     406           0 :     ViewShell::GetMenuState(rSet);
     407             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     408           0 :     mpSlideSorter->GetController().GetSlotManager()->GetMenuState(rSet);
     409           0 : }
     410             : 
     411             : 
     412             : 
     413             : 
     414           0 : void SlideSorterViewShell::GetClipboardState ( SfxItemSet& rSet)
     415             : {
     416           0 :     ViewShell::GetMenuState(rSet);
     417             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     418           0 :     mpSlideSorter->GetController().GetSlotManager()->GetClipboardState(rSet);
     419           0 : }
     420             : 
     421             : 
     422             : 
     423             : 
     424           0 : void SlideSorterViewShell::ExecCtrl (SfxRequest& rRequest)
     425             : {
     426             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     427           0 :     mpSlideSorter->GetController().ExecCtrl(rRequest);
     428           0 : }
     429             : 
     430             : 
     431             : 
     432             : 
     433           0 : void SlideSorterViewShell::GetCtrlState (SfxItemSet& rSet)
     434             : {
     435             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     436           0 :     mpSlideSorter->GetController().GetCtrlState(rSet);
     437           0 : }
     438             : 
     439             : 
     440             : 
     441             : 
     442           0 : void SlideSorterViewShell::FuSupport (SfxRequest& rRequest)
     443             : {
     444             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     445           0 :     mpSlideSorter->GetController().FuSupport(rRequest);
     446           0 : }
     447             : 
     448             : 
     449             : 
     450             : 
     451             : /** We have to handle those slot calls here that need to have access to
     452             :     private or protected members and methods of this class.
     453             : */
     454           0 : void SlideSorterViewShell::FuTemporary (SfxRequest& rRequest)
     455             : {
     456             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     457           0 :     switch (rRequest.GetSlot())
     458             :     {
     459             :         case SID_MODIFYPAGE:
     460             :         {
     461           0 :             SdPage* pCurrentPage = GetActualPage();
     462           0 :             if (pCurrentPage != NULL)
     463             :                 mpImpl->ProcessModifyPageSlot (
     464             :                     rRequest,
     465             :                     pCurrentPage,
     466           0 :                     mpSlideSorter->GetModel().GetPageType());
     467           0 :             Cancel();
     468           0 :             rRequest.Done ();
     469             :         }
     470           0 :         break;
     471             : 
     472             :         default:
     473           0 :             mpSlideSorter->GetController().FuTemporary(rRequest);
     474           0 :             break;
     475             :     }
     476           0 : }
     477             : 
     478             : 
     479             : 
     480             : 
     481           0 : void SlideSorterViewShell::GetStatusBarState (SfxItemSet& rSet)
     482             : {
     483             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     484           0 :     mpSlideSorter->GetController().GetStatusBarState(rSet);
     485           0 : }
     486             : 
     487             : 
     488             : 
     489             : 
     490           0 : void SlideSorterViewShell::FuPermanent (SfxRequest& rRequest)
     491             : {
     492             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     493           0 :     mpSlideSorter->GetController().FuPermanent(rRequest);
     494           0 : }
     495             : 
     496             : 
     497             : 
     498             : 
     499           0 : void SlideSorterViewShell::GetAttrState (SfxItemSet& rSet)
     500             : {
     501             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     502           0 :     mpSlideSorter->GetController().GetAttrState(rSet);
     503           0 : }
     504             : 
     505             : 
     506             : 
     507             : 
     508           0 : void SlideSorterViewShell::ExecStatusBar (SfxRequest& rRequest)
     509             : {
     510             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     511           0 :     mpSlideSorter->GetController().ExecStatusBar(rRequest);
     512           0 : }
     513             : 
     514             : 
     515             : 
     516             : 
     517           0 : void SlideSorterViewShell::Paint (
     518             :     const Rectangle& rBBox,
     519             :     ::sd::Window* pWindow)
     520             : {
     521           0 :     SetActiveWindow (pWindow);
     522             :     OSL_ASSERT(mpSlideSorter);
     523           0 :     if (mpSlideSorter)
     524           0 :         mpSlideSorter->GetController().Paint(rBBox,pWindow);
     525           0 : }
     526             : 
     527             : 
     528             : 
     529             : 
     530           0 : void SlideSorterViewShell::ArrangeGUIElements (void)
     531             : {
     532           0 :     if (IsActive())
     533             :     {
     534             :         OSL_ASSERT(mpSlideSorter.get()!=NULL);
     535           0 :         mpSlideSorter->ArrangeGUIElements(maViewPos, maViewSize);
     536           0 :         mbIsArrangeGUIElementsPending = false;
     537             :     }
     538             :     else
     539           0 :         mbIsArrangeGUIElementsPending = true;
     540           0 : }
     541             : 
     542             : 
     543             : 
     544             : 
     545           0 : void SlideSorterViewShell::Activate (sal_Bool bIsMDIActivate)
     546             : {
     547           0 :     ViewShell::Activate(bIsMDIActivate);
     548           0 :     if (mbIsArrangeGUIElementsPending)
     549           0 :         ArrangeGUIElements();
     550           0 : }
     551             : 
     552             : 
     553             : 
     554             : 
     555           0 : SvBorder SlideSorterViewShell::GetBorder (bool )
     556             : {
     557             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     558           0 :     return mpSlideSorter->GetBorder();
     559             : }
     560             : 
     561             : 
     562             : 
     563             : 
     564           0 : void SlideSorterViewShell::Command (
     565             :     const CommandEvent& rEvent,
     566             :     ::sd::Window* pWindow)
     567             : {
     568             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     569           0 :     if ( ! mpSlideSorter->GetController().Command (rEvent, pWindow))
     570           0 :         ViewShell::Command (rEvent, pWindow);
     571           0 : }
     572             : 
     573             : 
     574             : 
     575             : 
     576           0 : void SlideSorterViewShell::ReadFrameViewData (FrameView* pFrameView)
     577             : {
     578             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     579           0 :     if (pFrameView != NULL)
     580             :     {
     581           0 :         view::SlideSorterView& rView (mpSlideSorter->GetView());
     582             : 
     583           0 :         sal_uInt16 nSlidesPerRow (pFrameView->GetSlidesPerRow());
     584           0 :         if (nSlidesPerRow > 0
     585           0 :             && rView.GetOrientation() == view::Layouter::GRID
     586           0 :             && IsMainViewShell())
     587             :         {
     588           0 :             rView.GetLayouter().SetColumnCount(nSlidesPerRow,nSlidesPerRow);
     589             :         }
     590           0 :         if (IsMainViewShell())
     591           0 :             mpSlideSorter->GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(
     592           0 :                 mpFrameView->GetSelectedPage());
     593           0 :         mpSlideSorter->GetController().Rearrange(true);
     594             : 
     595             :         // DrawMode for 'main' window
     596           0 :         if (GetActiveWindow()->GetDrawMode() != pFrameView->GetDrawMode() )
     597           0 :             GetActiveWindow()->SetDrawMode( pFrameView->GetDrawMode() );
     598             :     }
     599             : 
     600             :     // When this slide sorter is not displayed in the main window then we do
     601             :     // not share the same frame view and have to find other ways to acquire
     602             :     // certain values.
     603           0 :     if ( ! IsMainViewShell())
     604             :     {
     605           0 :         ::boost::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell();
     606           0 :         if (pMainViewShell.get() != NULL)
     607           0 :             mpSlideSorter->GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(
     608           0 :                 pMainViewShell->getCurrentPage());
     609             :     }
     610           0 : }
     611             : 
     612             : 
     613             : 
     614             : 
     615           0 : void SlideSorterViewShell::WriteFrameViewData (void)
     616             : {
     617             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     618           0 :     if (mpFrameView != NULL)
     619             :     {
     620           0 :         view::SlideSorterView& rView (mpSlideSorter->GetView());
     621           0 :         mpFrameView->SetSlidesPerRow((sal_uInt16)rView.GetLayouter().GetColumnCount());
     622             : 
     623             :         // DrawMode for 'main' window
     624           0 :         if( mpFrameView->GetDrawMode() != GetActiveWindow()->GetDrawMode() )
     625           0 :             mpFrameView->SetDrawMode( GetActiveWindow()->GetDrawMode() );
     626             : 
     627           0 :         SdPage* pActualPage = GetActualPage();
     628           0 :         if (pActualPage != NULL)
     629             :         {
     630           0 :             if (IsMainViewShell())
     631           0 :                 mpFrameView->SetSelectedPage((pActualPage->GetPageNum()- 1) / 2);
     632             :             // else
     633             :             // The slide sorter is not expected to switch the current page
     634             :             // other then by double clicks.  That is handled seperatly.
     635             :         }
     636             :         else
     637             :         {
     638             :             // We have no current page to set but at least we can make sure
     639             :             // that the index of the frame view has a legal value.
     640           0 :             if (mpFrameView->GetSelectedPage() >= mpSlideSorter->GetModel().GetPageCount())
     641           0 :                 mpFrameView->SetSelectedPage((sal_uInt16)mpSlideSorter->GetModel().GetPageCount()-1);
     642             :         }
     643             :     }
     644           0 : }
     645             : 
     646             : 
     647             : 
     648             : 
     649           0 : void SlideSorterViewShell::SetZoom (long int )
     650             : {
     651             :     // Ignored.
     652             :     // The zoom scale is adapted internally to fit a number of columns in
     653             :     // the window.
     654           0 : }
     655             : 
     656             : 
     657             : 
     658             : 
     659           0 : void SlideSorterViewShell::SetZoomRect (const Rectangle& rZoomRect)
     660             : {
     661             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     662           0 :     Size aPageSize (mpSlideSorter->GetView().GetLayouter().GetPageObjectSize());
     663             : 
     664           0 :     Rectangle aRect(rZoomRect);
     665             : 
     666           0 :     if (aRect.GetWidth()  < aPageSize.Width())
     667             :     {
     668           0 :         long nWidthDiff  = (aPageSize.Width() - aRect.GetWidth()) / 2;
     669             : 
     670           0 :         aRect.Left() -= nWidthDiff;
     671           0 :         aRect.Right() += nWidthDiff;
     672             : 
     673           0 :         if (aRect.Left() < 0)
     674             :         {
     675           0 :             aRect.SetPos(Point(0, aRect.Top()));
     676             :         }
     677             :     }
     678             : 
     679           0 :     if (aRect.GetHeight()  < aPageSize.Height())
     680             :     {
     681           0 :         long nHeightDiff  = (aPageSize.Height() - aRect.GetHeight()) / 2;
     682             : 
     683           0 :         aRect.Top() -= nHeightDiff;
     684           0 :         aRect.Bottom() += nHeightDiff;
     685             : 
     686           0 :         if (aRect.Top() < 0)
     687             :         {
     688           0 :             aRect.SetPos(Point(aRect.Left(), 0));
     689             :         }
     690             :     }
     691             : 
     692           0 :     ViewShell::SetZoomRect(aRect);
     693             : 
     694           0 :     GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOM );
     695           0 :     GetViewFrame()->GetBindings().Invalidate( SID_ATTR_ZOOMSLIDER );
     696           0 : }
     697             : 
     698             : 
     699             : 
     700             : 
     701           0 : void SlideSorterViewShell::UpdateScrollBars (void)
     702             : {
     703             :     // Do not call the overwritten method of the base class: We do all the
     704             :     // scroll bar setup by ourselves.
     705           0 :     mpSlideSorter->GetController().GetScrollBarManager().UpdateScrollBars (false);
     706           0 : }
     707             : 
     708             : 
     709             : 
     710             : 
     711           0 : void SlideSorterViewShell::StartDrag (
     712             :     const Point& rDragPt,
     713             :     ::Window* pWindow )
     714             : {
     715             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     716           0 :     mpSlideSorter->GetController().GetClipboard().StartDrag (
     717             :         rDragPt,
     718           0 :         pWindow);
     719           0 : }
     720             : 
     721             : 
     722             : 
     723             : 
     724           0 : void SlideSorterViewShell::DragFinished (
     725             :     sal_Int8 nDropAction)
     726             : {
     727             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     728           0 :     mpSlideSorter->GetController().GetClipboard().DragFinished (nDropAction);
     729           0 : }
     730             : 
     731             : 
     732             : 
     733             : 
     734           0 : sal_Int8 SlideSorterViewShell::AcceptDrop (
     735             :     const AcceptDropEvent& rEvt,
     736             :     DropTargetHelper& rTargetHelper,
     737             :     ::sd::Window* pTargetWindow,
     738             :     sal_uInt16 nPage,
     739             :     sal_uInt16 nLayer)
     740             : {
     741             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     742           0 :     return mpSlideSorter->GetController().GetClipboard().AcceptDrop (
     743             :         rEvt,
     744             :         rTargetHelper,
     745             :         pTargetWindow,
     746             :         nPage,
     747           0 :         nLayer);
     748             : }
     749             : 
     750             : 
     751             : 
     752             : 
     753           0 : sal_Int8 SlideSorterViewShell::ExecuteDrop (
     754             :     const ExecuteDropEvent& rEvt,
     755             :     DropTargetHelper& rTargetHelper,
     756             :     ::sd::Window* pTargetWindow,
     757             :     sal_uInt16 nPage,
     758             :     sal_uInt16 nLayer)
     759             : {
     760             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     761           0 :     return mpSlideSorter->GetController().GetClipboard().ExecuteDrop (
     762             :         rEvt,
     763             :         rTargetHelper,
     764             :         pTargetWindow,
     765             :         nPage,
     766           0 :         nLayer);
     767             : }
     768             : 
     769             : 
     770             : 
     771             : 
     772             : ::boost::shared_ptr<SlideSorterViewShell::PageSelection>
     773           0 :     SlideSorterViewShell::GetPageSelection (void) const
     774             : {
     775             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     776           0 :     return mpSlideSorter->GetController().GetPageSelector().GetPageSelection();
     777             : }
     778             : 
     779             : 
     780             : 
     781             : 
     782           0 : void SlideSorterViewShell::SetPageSelection (
     783             :     const ::boost::shared_ptr<PageSelection>& rSelection)
     784             : {
     785             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     786           0 :     mpSlideSorter->GetController().GetPageSelector().SetPageSelection(rSelection);
     787           0 : }
     788             : 
     789             : 
     790             : 
     791             : 
     792           0 : void SlideSorterViewShell::AddSelectionChangeListener (
     793             :     const Link& rCallback)
     794             : {
     795             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     796           0 :     mpSlideSorter->GetController().GetSelectionManager()->AddSelectionChangeListener(rCallback);
     797           0 : }
     798             : 
     799             : 
     800             : 
     801             : 
     802           0 : void SlideSorterViewShell::RemoveSelectionChangeListener (
     803             :     const Link& rCallback)
     804             : {
     805             :     OSL_ASSERT(mpSlideSorter.get()!=NULL);
     806           0 :     mpSlideSorter->GetController().GetSelectionManager()->RemoveSelectionChangeListener(rCallback);
     807           0 : }
     808             : 
     809             : 
     810             : 
     811             : } } // end of namespace ::sd::slidesorter
     812             : 
     813             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10