LCOV - code coverage report
Current view: top level - libreoffice/reportdesign/source/ui/inc - CondFormat.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 4 0.0 %
Date: 2012-12-27 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             : 
      20             : #ifndef RPTUI_CONDFORMAT_HXX
      21             : #define RPTUI_CONDFORMAT_HXX
      22             : 
      23             : #include "ModuleHelper.hxx"
      24             : 
      25             : #include <com/sun/star/report/XReportControlModel.hpp>
      26             : 
      27             : #include <vcl/dialog.hxx>
      28             : #include <vcl/button.hxx>
      29             : #include <vcl/fixed.hxx>
      30             : #include <vcl/scrbar.hxx>
      31             : 
      32             : #include <boost/shared_ptr.hpp>
      33             : #include <boost/noncopyable.hpp>
      34             : 
      35             : #include <vector>
      36             : 
      37             : // .............................................................................
      38             : namespace rptui
      39             : {
      40             : // .............................................................................
      41             : 
      42             :     #define MAX_CONDITIONS  (size_t)3
      43             : 
      44             :     class OReportController;
      45             :     class Condition;
      46             : 
      47             :     //=========================================================================
      48             :     //= IConditionalFormatAction
      49             :     //=========================================================================
      50           0 :     class SAL_NO_VTABLE IConditionalFormatAction
      51             :     {
      52             :     public:
      53             :         virtual void            addCondition( size_t _nAddAfterIndex ) = 0;
      54             :         virtual void            deleteCondition( size_t _nCondIndex ) = 0;
      55             :         virtual void            applyCommand( size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color _aColor ) = 0;
      56             :         virtual void            moveConditionUp( size_t _nCondIndex ) = 0;
      57             :         virtual void            moveConditionDown( size_t _nCondIndex ) = 0;
      58             :         virtual ::rtl::OUString getDataField() const = 0;
      59             : 
      60             :     protected:
      61           0 :         ~IConditionalFormatAction() {}
      62             :     };
      63             : 
      64             :     /*************************************************************************
      65             :     |*
      66             :     |* Conditional formatting dialog
      67             :     |*
      68             :     \************************************************************************/
      69             :     class ConditionalFormattingDialog  :public ModalDialog
      70             :                                         ,public IConditionalFormatAction
      71             :                                         ,private ::boost::noncopyable
      72             :     {
      73             :         typedef ::boost::shared_ptr< Condition >    ConditionPtr;
      74             :         typedef ::std::vector< ConditionPtr >       Conditions;
      75             : 
      76             :         OModuleClient   m_aModuleClient;
      77             :         Window          m_aConditionPlayground;
      78             :         Conditions      m_aConditions;
      79             :         FixedLine       m_aSeparator;
      80             :         OKButton        m_aPB_OK;
      81             :         CancelButton    m_aPB_CANCEL;
      82             :         HelpButton      m_aPB_Help;
      83             :         ScrollBar       m_aCondScroll;
      84             : 
      85             :         ::rptui::OReportController&                         m_rController;
      86             :         ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel >
      87             :                                                             m_xFormatConditions;
      88             :         ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel >
      89             :                                                             m_xCopy;
      90             : 
      91             :         bool    m_bDeletingCondition;
      92             : 
      93             :     public:
      94             :         ConditionalFormattingDialog(
      95             :             Window* pParent,
      96             :             const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel>& _xHoldAlive,
      97             :             ::rptui::OReportController& _rController
      98             :         );
      99             :         virtual ~ConditionalFormattingDialog();
     100             : 
     101             :         // Dialog overridables
     102             :         virtual short   Execute();
     103             : 
     104             :         // IConditionalFormatAction overridables
     105             :         virtual void addCondition( size_t _nAddAfterIndex );
     106             :         virtual void deleteCondition( size_t _nCondIndex );
     107             :         virtual void applyCommand( size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color _aColor );
     108             :         virtual void moveConditionUp( size_t _nCondIndex );
     109             :         virtual void moveConditionDown( size_t _nCondIndex );
     110             :         virtual ::rtl::OUString getDataField() const;
     111             : 
     112             :     protected:
     113             :         virtual long        PreNotify( NotifyEvent& rNEvt );
     114             : 
     115             :     private:
     116             :         DECL_LINK( OnScroll, ScrollBar* );
     117             : 
     118             :     private:
     119             :         /// returns the current number of conditions
     120           0 :         size_t  impl_getConditionCount() const { return m_aConditions.size(); }
     121             : 
     122             :         /** adds a condition
     123             :             @param _nNewCondIndex
     124             :                 the index of the to-be-inserted condition
     125             :         */
     126             :         void    impl_addCondition_nothrow( size_t _nNewCondIndex );
     127             : 
     128             :         /// deletes the condition with the given index
     129             :         void    impl_deleteCondition_nothrow( size_t _nCondIndex );
     130             : 
     131             :         /// moves the condition with the given index one position
     132             :         void    impl_moveCondition_nothrow( size_t _nCondIndex, bool _bMoveUp );
     133             : 
     134             :         /// does the dialog layouting
     135             :         void    impl_layoutAll();
     136             : 
     137             :         /// does the layout for the condition windows
     138             :         void    impl_layoutConditions( Point& _out_rBelowLastVisible );
     139             : 
     140             :         /// called when the number of conditions has changed in any way
     141             :         void    impl_conditionCountChanged();
     142             : 
     143             :         /// initializes the conditions from m_xCopy
     144             :         void    impl_initializeConditions();
     145             : 
     146             :         /// tells all our Condition instances their new index
     147             :         void    impl_updateConditionIndicies();
     148             : 
     149             :         /// returns the number of the condition which has the (child path) focus
     150             :         size_t  impl_getFocusedConditionIndex( sal_Int32 _nFallBackIfNone ) const;
     151             : 
     152             :         /// returns the index of the first visible condition
     153             :         size_t  impl_getFirstVisibleConditionIndex() const;
     154             : 
     155             :         /// returns the index of the last visible condition
     156             :         size_t  impl_getLastVisibleConditionIndex() const;
     157             : 
     158             :         /// determines the width of a Condition
     159             :         long    impl_getConditionWidth() const;
     160             : 
     161             :         /// focuses the condition with the given index, making it visible if necessary
     162             :         void    impl_focusCondition( size_t _nCondIndex );
     163             : 
     164             :         /// updates the scrollbar range. (does not update the scrollbar visibility)
     165             :         void    impl_updateScrollBarRange();
     166             : 
     167             :         /// determines whether we need a scrollbar for the conditions
     168           0 :         bool    impl_needScrollBar() const { return m_aConditions.size() > MAX_CONDITIONS; }
     169             : 
     170             :         /// scrolls the condition with the given index to the top position
     171             :         void    impl_scrollTo( size_t _nTopCondIndex );
     172             : 
     173             :         /// ensures the condition with the given index is visible
     174             :         void    impl_ensureConditionVisible( size_t _nCondIndex );
     175             :     };
     176             : 
     177             : // .............................................................................
     178             : } // namespace rptui
     179             : // .............................................................................
     180             : 
     181             : #endif // RPTUI_CONDFORMAT_HXX
     182             : 
     183             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10