LCOV - code coverage report
Current view: top level - sd/source/ui/inc - SlideSorter.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 7 85.7 %
Date: 2014-11-03 Functions: 6 7 85.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             : #ifndef INCLUDED_SD_SOURCE_UI_INC_SLIDESORTER_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_INC_SLIDESORTER_HXX
      22             : 
      23             : #include "fupoor.hxx"
      24             : #include "Window.hxx"
      25             : #include <com/sun/star/frame/XController.hpp>
      26             : #include <cppuhelper/weakref.hxx>
      27             : #include <sfx2/viewfrm.hxx>
      28             : #include <boost/noncopyable.hpp>
      29             : #include <boost/shared_ptr.hpp>
      30             : #include <boost/scoped_ptr.hpp>
      31             : #include <boost/current_function.hpp>
      32             : 
      33             : class ScrollBar;
      34             : class ScrollBarBox;
      35             : namespace vcl { class Window; }
      36             : 
      37             : namespace sd {
      38             : class ViewShell;
      39             : class ViewShellBase;
      40             : class Window;
      41             : }
      42             : 
      43             : namespace sd { namespace slidesorter { namespace model {
      44             : class SlideSorterModel;
      45             : } } }
      46             : 
      47             : namespace sd { namespace slidesorter { namespace view {
      48             : class SlideSorterView;
      49             : class Theme;
      50             : } } }
      51             : 
      52             : namespace sd { namespace slidesorter { namespace controller {
      53             : class SlideSorterController;
      54             : class SlotManager;
      55             : class Properties;
      56             : } } }
      57             : 
      58             : typedef ::boost::shared_ptr<sd::Window> SharedSdWindow;
      59             : 
      60             : namespace sd { namespace slidesorter {
      61             : 
      62             : /** Show previews for all the slides in a document and allow the user to
      63             :     insert or delete slides and modify the order of the slides.
      64             : 
      65             :     This class is a facade for the model, view, and controller classes.
      66             :     It is a hub that allows access to the various parts of a slide sorter.
      67             : 
      68             :     Note that this class is not in its final state.
      69             : */
      70             : class SlideSorter
      71             :     : private ::boost::noncopyable
      72             : {
      73             :     friend class controller::SlotManager;
      74             : public:
      75             :     virtual ~SlideSorter (void);
      76             : 
      77             :     /** Return whether the called SlideSorter object is valid and calling
      78             :         its Get(Model,View,Controller) methods is safe.  When <FALSE/> is
      79             :         called then no other methods should be called.
      80             :         Calling this method should be necessary only during startup and
      81             :         shutdown (when that can be detected).
      82             :     */
      83           0 :     bool IsValid (void) const { return mbIsValid;}
      84             : 
      85             :     /** Create a new slide sorter that is strongly coupled to the given view
      86             :         shell.  Use this function for a slide sorter in the left pane.
      87             :         @param rViewShell
      88             :             Typically a SlideSorterViewShell object.
      89             :         @param rpContentWindow
      90             :             Typically the content window of the ViewShell.
      91             :         @param rpHorizontalScrollBar
      92             :             Typically the horizontal scroll bar of the ViewShell.
      93             :         @param rpVerticalScrollBar
      94             :             Typically the vertical scroll bar of the ViewShell.
      95             :         @param rpScrollBarBox
      96             :             The little square enclosed by the two scroll bars.  Typically
      97             :             the one from the ViewShell.
      98             :     */
      99             :     static ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
     100             :         ViewShell& rViewShell,
     101             :         const ::boost::shared_ptr<sd::Window>& rpContentWindow,
     102             :         const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
     103             :         const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
     104             :         const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
     105             : 
     106             :     /** Create a new slide sorter that is losely coupled to the given view
     107             :         shell.  The view shell may even be missing.
     108             :         @param rBase
     109             :             ViewShellBase object of the enclosing application.
     110             :         @param pViewShell
     111             :             Supply when at hand.
     112             :         @param rParentWindow
     113             :             The parent window of the internally created content window and
     114             :             scroll bars.
     115             :     */
     116             :     static ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
     117             :         ViewShellBase& rBase,
     118             :         ViewShell* pViewShell,
     119             :         ::vcl::Window& rParentWindow);
     120             : 
     121             :     /** Return the control of the vertical scroll bar.
     122             :     */
     123         797 :     ::boost::shared_ptr<ScrollBar> GetVerticalScrollBar (void) const { return mpVerticalScrollBar;}
     124             : 
     125             :     /** Return the control of the horizontal scroll bar.
     126             :     */
     127         545 :     ::boost::shared_ptr<ScrollBar> GetHorizontalScrollBar (void) const { return mpHorizontalScrollBar;}
     128             : 
     129             :     /** Return the scroll bar filler that paints the little square that is
     130             :         enclosed by the two scroll bars.
     131             :     */
     132         126 :     ::boost::shared_ptr<ScrollBarBox> GetScrollBarFiller (void) const { return mpScrollBarBox;}
     133             : 
     134             :     /** Return the content window.  This is a sibling and is geometrically
     135             :         enclosed by the scroll bars.
     136             :     */
     137      135432 :     SharedSdWindow GetContentWindow (void) const { return mpContentWindow;}
     138             : 
     139             :     model::SlideSorterModel& GetModel (void) const;
     140             : 
     141             :     view::SlideSorterView& GetView (void) const;
     142             : 
     143             :     controller::SlideSorterController& GetController (void) const;
     144             : 
     145             :     /** Return the view shell that was given at construction.
     146             :         @return
     147             :             May be empty.
     148             :     */
     149        2641 :     ViewShell* GetViewShell (void) const { return mpViewShell;}
     150             : 
     151             :     /** Return the XController object of the main view.
     152             :     */
     153             :     ::com::sun::star::uno::Reference<com::sun::star::frame::XController>
     154             :         GetXController (void) const;
     155             : 
     156             :     /** Return the ViewShellBase object.
     157             :         @return
     158             :             May be empty.
     159             :     */
     160        8702 :     ViewShellBase* GetViewShellBase (void) const { return mpViewShellBase;}
     161             : 
     162             :     void Paint (const Rectangle& rRepaintArea);
     163             : 
     164             :     /** Place and size the controls and windows.  You may want to call this
     165             :         method when something has changed that for instance affects the
     166             :         visibility state of the scroll bars.
     167             :     */
     168             :     void ArrangeGUIElements (
     169             :         const Point& rOffset,
     170             :         const Size& rSize);
     171             :     SvBorder GetBorder (void);
     172             : 
     173             :     bool RelocateToWindow (::vcl::Window* pWindow);
     174             : 
     175             :     /** Set the current function at the view shell or, when it is not
     176             :         present, set it at the content window.  This method supports the use
     177             :         of functions even when there is no SlideSorterViewShell.
     178             :     */
     179             :     void SetCurrentFunction (const rtl::Reference<FuPoor>& rpFunction);
     180             : 
     181             :     /** Return a collection of properties that are used throughout the slide
     182             :         sorter.
     183             :     */
     184             :     ::boost::shared_ptr<controller::Properties> GetProperties (void) const;
     185             : 
     186             :     /** Return the active theme which gives access to colors and fonts.
     187             :     */
     188             :     ::boost::shared_ptr<view::Theme> GetTheme (void) const;
     189             : 
     190             : protected:
     191             :     /** This virtual method makes it possible to create a specialization of
     192             :         the slide sorter view shell that works with its own implementation
     193             :         of model, view, and controller.  The default implementation simply
     194             :         calls the CreateModel(), CreateView(), and CreateController()
     195             :         methods in this order.
     196             :     */
     197             :     virtual void CreateModelViewController (void);
     198             : 
     199             :     /** Create the model for the view shell.  When called from the default
     200             :         implementation of CreateModelViewController() then neither view nor
     201             :         controller do exist.  Test their pointers when in doubt.
     202             :     */
     203             :     virtual model::SlideSorterModel* CreateModel (void);
     204             : 
     205             :     /** Create the view for the view shell.  When called from the default
     206             :         implementation of CreateModelViewController() then the model but not
     207             :         the controller does exist.  Test their pointers when in doubt.
     208             :     */
     209             :     virtual view::SlideSorterView* CreateView (void);
     210             : 
     211             :     /** Create the controller for the view shell.  When called from the default
     212             :         implementation of CreateModelViewController() then both the view and
     213             :         the controller do exist.  Test their pointers when in doubt.
     214             :     */
     215             :     virtual controller::SlideSorterController* CreateController (void);
     216             : 
     217             : private:
     218             :     bool mbIsValid;
     219             : 
     220             :     ::boost::scoped_ptr<controller::SlideSorterController> mpSlideSorterController;
     221             :     ::boost::scoped_ptr<model::SlideSorterModel> mpSlideSorterModel;
     222             :     ::boost::scoped_ptr<view::SlideSorterView> mpSlideSorterView;
     223             :     ::com::sun::star::uno::WeakReference<com::sun::star::frame::XController> mxControllerWeak;
     224             :     ViewShell* mpViewShell;
     225             :     ViewShellBase* mpViewShellBase;
     226             :     SharedSdWindow mpContentWindow;
     227             :     bool mbOwnesContentWindow;
     228             :     ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
     229             :     ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
     230             :     ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
     231             : 
     232             :     /** Set this flag to <TRUE/> to force a layout before the next paint.
     233             :     */
     234             :     bool mbLayoutPending;
     235             : 
     236             :     /** Some slide sorter wide properties that are used in different
     237             :         classes.
     238             :     */
     239             :     ::boost::shared_ptr<controller::Properties> mpProperties;
     240             :     ::boost::shared_ptr<view::Theme> mpTheme;
     241             : 
     242             :     SlideSorter (
     243             :         ViewShell& rViewShell,
     244             :         const ::boost::shared_ptr<sd::Window>& rpContentWindow,
     245             :         const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
     246             :         const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
     247             :         const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
     248             :     SlideSorter (
     249             :         ViewShellBase& rBase,
     250             :         ViewShell* pViewShell,
     251             :         ::vcl::Window& rParentWindow);
     252             : 
     253             :     void Init (void);
     254             :     /** Create the controls for the slide sorter.  This are the tab bar
     255             :        for switching the edit mode, the scroll bar, and the actual
     256             :        slide sorter view window.
     257             :        This method is usually called exactly one time from the
     258             :        constructor.
     259             :     */
     260             :     void SetupControls (::vcl::Window* pParentWindow);
     261             : 
     262             :     /** This method is usually called exactly one time from the
     263             :         constructor.
     264             :     */
     265             :     void SetupListeners (void);
     266             : 
     267             :     /** Release the listeners that have been installed in SetupListeners().
     268             :     */
     269             :     void ReleaseListeners (void);
     270             : };
     271             : 
     272             : } } // end of namespace ::sd::slidesorter
     273             : 
     274             : #endif
     275             : 
     276             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10