LCOV - code coverage report
Current view: top level - reportdesign/source/ui/inc - ScrollHelper.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef RPTUI_SCROLLHELPER_HXX
      20             : #define RPTUI_SCROLLHELPER_HXX
      21             : 
      22             : #include <vcl/scrbar.hxx>
      23             : #include <com/sun/star/report/XSection.hpp>
      24             : #include <comphelper/propmultiplex.hxx>
      25             : #include "ReportDefines.hxx"
      26             : #include <svtools/colorcfg.hxx>
      27             : #include <svx/svdedtv.hxx>
      28             : #include "cppuhelper/basemutex.hxx"
      29             : #include <rtl/ref.hxx>
      30             : #include <boost/shared_ptr.hpp>
      31             : #include <vcl/dockwin.hxx>
      32             : #include <MarkedSection.hxx>
      33             : #include "ReportWindow.hxx"
      34             : 
      35             : namespace rptui
      36             : {
      37             :     class ODesignView;
      38             :     class OReportWindow;
      39             :     class OSectionView;
      40             : 
      41             :     /** This class defines the scrollable area of the report design. It includes
      42             :         the h-ruler and the sections, and end marker. Not the start marker.
      43             :     */
      44             :     typedef Window OScrollWindowHelper_BASE;
      45             :     class OScrollWindowHelper :     public ::cppu::BaseMutex
      46             :                                 ,   public OScrollWindowHelper_BASE/*TabPage*/
      47             :                                 ,   public ::comphelper::OPropertyChangeListener
      48             :                                     , public IMarkedSection
      49             :     {
      50             :     private:
      51             :         ScrollBar           m_aHScroll;
      52             :         ScrollBar           m_aVScroll;
      53             :         ScrollBarBox        m_aCornerWin;       // window in the bottom right corner
      54             :         Size                m_aTotalPixelSize;
      55             :         ODesignView*        m_pParent;
      56             :         OReportWindow       m_aReportWindow;
      57             :         ::rtl::Reference<comphelper::OPropertyChangeMultiplexer >
      58             :                             m_pReportDefintionMultiPlexer; // listener for property changes
      59             : 
      60             :         DECL_LINK( ScrollHdl, ScrollBar*);
      61             :         Size ResizeScrollBars();
      62             :         void ImplInitSettings();
      63             :         void impl_initScrollBar( ScrollBar& _rScrollBar ) const;
      64             : 
      65             :         OScrollWindowHelper(OScrollWindowHelper&);
      66             :         void operator =(OScrollWindowHelper&);
      67             :     protected:
      68             :         virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
      69             :         // window
      70             :         virtual void            Resize() SAL_OVERRIDE;
      71             :         virtual bool            Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
      72             :         // OPropertyChangeListener
      73             :         virtual void            _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
      74             :     public:
      75             :         OScrollWindowHelper( ODesignView* _pReportDesignView);
      76             :         virtual ~OScrollWindowHelper();
      77             : 
      78             :         /** late ctor
      79             :         */
      80             :         void                    initialize();
      81             : 
      82           0 :         inline Point            getThumbPos() const { return Point(m_aHScroll.GetThumbPos(),m_aVScroll.GetThumbPos())/*m_aScrollOffset*/; }
      83             :         inline const OReportWindow& getReportWindow() const { return m_aReportWindow; }
      84             :         void                    setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight);
      85           0 :         inline Size             getTotalSize() const { return m_aTotalPixelSize; }
      86           0 :         inline ScrollBar*       GetHScroll() { return &m_aHScroll; }
      87           0 :         inline ScrollBar*       GetVScroll() { return &m_aVScroll; }
      88             : 
      89             :         // forwards
      90             :         void                    SetMode( DlgEdMode _eMode );
      91             :         void                    SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType = OUString());
      92             :         OUString           GetInsertObjString() const;
      93             :         void                    setGridSnap(sal_Bool bOn);
      94             :         void                    setDragStripes(sal_Bool bOn);
      95             :         /** copies the current selection in this section
      96             :         */
      97             :         void Copy();
      98             : 
      99             :         /** returns if paste is allowed
     100             :         *
     101             :         * \return <TRUE/> if paste is allowed
     102             :         */
     103             :         sal_Bool IsPasteAllowed() const;
     104             : 
     105             :         /** paste a new control in this section
     106             :         */
     107             :         void Paste();
     108             : 
     109             :         /** Deletes the current selection in this section
     110             :         *
     111             :         */
     112             :         void Delete();
     113             : 
     114             :         /** All objects will be marked.
     115             :         */
     116             :         void SelectAll(const sal_uInt16 _nObjectType);
     117             : 
     118             :         /** returns <TRUE/> when a object is marked
     119             :         */
     120             :         sal_Bool HasSelection() const;
     121             : 
     122             :         /** removes the section at the given position.
     123             :         *
     124             :         * \param _nPosition Zero based.
     125             :         */
     126             :         void                    removeSection(sal_uInt16 _nPosition);
     127             : 
     128             :         /** adds a new section at position _nPosition.
     129             :             If the section is <NULL/> nothing happens.
     130             :             If the position is grater than the current elements, the section will be appended.
     131             :         */
     132             :         void                    addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
     133             :                                     ,const OUString& _sColorEntry
     134             :                                     ,sal_uInt16 _nPosition = USHRT_MAX);
     135             : 
     136             :         sal_uInt16                  getSectionCount() const;
     137             : 
     138             :         /** turns the grid on or off
     139             :         *
     140             :         * \param _bVisible
     141             :         */
     142             :         void                    toggleGrid(sal_Bool _bVisible);
     143             : 
     144             :         /** unmark all objects on the views without the given one.
     145             :         *
     146             :         * @param _pSectionView The view where the objects should not be unmarked.
     147             :         */
     148             :         void                    unmarkAllObjects(OSectionView* _pSectionView);
     149             : 
     150             :         /** shows or hides the ruler.
     151             :         */
     152             :         void                    showRuler(sal_Bool _bShow);
     153             : 
     154             :         /** calculate the max width of the markers
     155             :         *
     156             :         * @param _bWithEnd  if <TRUE/> the end marker will be used for calculation as well otherwise not.
     157             :         * \return the max width
     158             :         */
     159             :         sal_Int32               getMaxMarkerWidth(sal_Bool _bWithEnd) const;
     160             : 
     161             :         /** checks if the keycode is known by the child windows
     162             :             @param  _rCode  the keycode
     163             :             @return <TRUE/> if the keycode is handled otherwise <FALSE/>
     164             :         */
     165             :         sal_Bool                handleKeyEvent(const KeyEvent& _rEvent);
     166             : 
     167             :         /** the section as marked or not marked
     168             :             @param  _pSectionView   the section where to set the marked flag
     169             :             @param  _bMark  the marked flag
     170             :         */
     171             :         void                    setMarked(OSectionView* _pSectionView,sal_Bool _bMark);
     172             :         void                    setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark);
     173             :         void                    setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark);
     174             : 
     175             :         // IMarkedSection
     176             :         ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
     177             :         ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
     178             :         virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;
     179             : 
     180             : 
     181             :         /** fills the positions of all collapsed sections.
     182             :         *
     183             :         * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
     184             :         */
     185             :         void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
     186             : 
     187             :         /** collpase all sections given by their position
     188             :         *
     189             :         * \param _aCollpasedSections The position of the sections which should be collapsed.
     190             :         */
     191             :         void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
     192             : 
     193             :         /** align all marked objects in all sections
     194             :         *
     195             :         * \param eHor
     196             :         * \param eVert
     197             :         * \param bBoundRects
     198             :         */
     199             :         void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false);
     200             : 
     201             :         sal_uInt32 getMarkedObjectCount() const;
     202             : 
     203             :         /** zoom the ruler and view windows
     204             :         */
     205             :         void zoom(const Fraction& _aZoom);
     206             : 
     207             :         /** fills the vector with all selected control models
     208             :             /param  _rSelection The vector will be filled and will not be cleared before.
     209             :         */
     210             :         void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
     211             : 
     212             :         /** calculates the zoom factor.
     213             :             @param  _eType  which kind of zoom is needed
     214             :         */
     215             :         sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
     216             :     };
     217             : }
     218             : #endif // RPTUI_SCROLLHELPER_HXX
     219             : 
     220             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10