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

Generated by: LCOV version 1.11