LCOV - code coverage report
Current view: top level - reportdesign/source/ui/dlg - Condition.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 6 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             : 
      20             : #ifndef RPTUI_CONDITION_HXX
      21             : #define RPTUI_CONDITION_HXX
      22             : 
      23             : #include "conditionalexpression.hxx"
      24             : 
      25             : #include <com/sun/star/report/XFormatCondition.hpp>
      26             : 
      27             : #include <dbaccess/ToolBoxHelper.hxx>
      28             : 
      29             : #include <svx/fntctrl.hxx>
      30             : 
      31             : #include <vcl/fixed.hxx>
      32             : #include <vcl/lstbox.hxx>
      33             : #include <vcl/field.hxx>
      34             : #include <vcl/button.hxx>
      35             : #include <vcl/toolbox.hxx>
      36             : 
      37             : #include <memory>
      38             : 
      39             : namespace svx { class ToolboxButtonColorUpdater; }
      40             : 
      41             : namespace rptui
      42             : {
      43             :     class OColorPopup;
      44             :     class OReportController;
      45             :     class IConditionalFormatAction;
      46             :     class Condition;
      47             : 
      48             :     class ConditionField : public Edit
      49             :     {
      50             :         Condition*  m_pParent;
      51             :         Edit*       m_pSubEdit;
      52             :         PushButton  m_aFormula;
      53             : 
      54             :         DECL_LINK( OnFormula,   Button* );
      55             :     public:
      56             :         ConditionField( Condition* pParent, const ResId& rResId );
      57             :         virtual ~ConditionField();
      58             :         virtual void Resize() SAL_OVERRIDE;
      59             :     };
      60             : 
      61             : 
      62             :     //= Condition
      63             : 
      64             :     class Condition :public Control
      65             :                     ,public dbaui::OToolBoxHelper
      66             :     {
      67             :         ::rptui::OReportController& m_rController;
      68             :         IConditionalFormatAction&   m_rAction;
      69             :         FixedLine                   m_aHeader;
      70             :         ListBox                     m_aConditionType;
      71             :         ListBox                     m_aOperationList;
      72             :         ConditionField              m_aCondLHS;
      73             :         FixedText                   m_aOperandGlue;
      74             :         ConditionField              m_aCondRHS;
      75             :         ToolBox                     m_aActions;
      76             :         SvxFontPrevWindow           m_aPreview;
      77             :         ImageButton                 m_aMoveUp;
      78             :         ImageButton                 m_aMoveDown;
      79             :         PushButton                  m_aAddCondition;
      80             :         PushButton                  m_aRemoveCondition;
      81             :         OColorPopup*                m_pColorFloat;
      82             : 
      83             :         ::svx::ToolboxButtonColorUpdater*   m_pBtnUpdaterFontColor; // updates the color below the toolbar icon
      84             :         ::svx::ToolboxButtonColorUpdater*   m_pBtnUpdaterBackgroundColor;
      85             : 
      86             : 
      87             :         size_t                          m_nCondIndex;
      88             :         long                            m_nLastKnownWindowWidth;
      89             :         bool                            m_bInDestruction;
      90             : 
      91             :         ConditionalExpressions          m_aConditionalExpressions;
      92             : 
      93             :         DECL_LINK( OnFormatAction,      ToolBox* );
      94             :         DECL_LINK( DropdownClick,       ToolBox* );
      95             :         DECL_LINK( OnConditionAction,   Button* );
      96             : 
      97             :     public:
      98             :         Condition( Window* _pParent, IConditionalFormatAction& _rAction, ::rptui::OReportController& _rController );
      99             :         virtual ~Condition();
     100             : 
     101             :         /** will be called when the id of the image list is needed.
     102             :             @param  _eBitmapSet
     103             :                 <svtools/imgdef.hxx>
     104             :         */
     105             :         virtual ImageList getImageList(sal_Int16 _eBitmapSet) const SAL_OVERRIDE;
     106             : 
     107             :         /** will be called when the controls need to be resized.
     108             :         */
     109             :         virtual void resizeControls(const Size& _rDiff) SAL_OVERRIDE;
     110             : 
     111             :         /** sets the props at the control
     112             :             @param  _xCondition the source
     113             :         */
     114             :         void setCondition(const com::sun::star::uno::Reference< com::sun::star::report::XFormatCondition >& _xCondition);
     115             : 
     116             :         /** fills from the control
     117             :             _xCondition the destination
     118             :         */
     119             :         void fillFormatCondition(const com::sun::star::uno::Reference< com::sun::star::report::XFormatCondition >& _xCondition);
     120             : 
     121             :         /** updates the toolbar
     122             :             _xCondition the destination
     123             :         */
     124             :         void updateToolbar(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat >& _xCondition);
     125             : 
     126             :         /// tells the condition its new index within the dialog's condition array
     127             :         void setConditionIndex( size_t _nCondIndex, size_t _nCondCount );
     128             : 
     129             :         /// returns the condition's index within the dialog's condition array
     130           0 :         size_t  getConditionIndex() const { return m_nCondIndex; }
     131             : 
     132             :         /** determines whether the condition is actually empty
     133             :         */
     134             :         bool    isEmpty() const;
     135             : 
     136             :         /** forward to the parent class
     137             :         */
     138             :         void    ApplyCommand(sal_uInt16 _nCommandId, const ::Color& _aColor );
     139             : 
     140           0 :         inline ::rptui::OReportController& getController() const { return m_rController; }
     141             : 
     142             :     protected:
     143             :         virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
     144             :         virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     145             :         virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     146             :         virtual void Resize() SAL_OVERRIDE;
     147             :         virtual void GetFocus() SAL_OVERRIDE;
     148             : 
     149             :     private:
     150             :         void    impl_layoutAll();
     151             :         void    impl_layoutOperands();
     152             : 
     153             :         /// determines the rectangle to be occupied by the toolbar, including the border drawn around it
     154             :         Rectangle   impl_getToolBarBorderRect() const;
     155             : 
     156             :         inline  ConditionType
     157             :                     impl_getCurrentConditionType() const;
     158             : 
     159             :         inline  ComparisonOperation
     160             :                     impl_getCurrentComparisonOperation() const;
     161             : 
     162             :         void    impl_setCondition( const OUString& _rConditionFormula );
     163             : 
     164             :     private:
     165             :         DECL_LINK( OnTypeSelected, ListBox* );
     166             :         DECL_LINK( OnOperationSelected, ListBox* );
     167             :     };
     168             : 
     169             : 
     170           0 :     inline ConditionType Condition::impl_getCurrentConditionType() const
     171             :     {
     172           0 :         return sal::static_int_cast< ConditionType >( m_aConditionType.GetSelectEntryPos() );
     173             :     }
     174             : 
     175             : 
     176           0 :     inline ComparisonOperation Condition::impl_getCurrentComparisonOperation() const
     177             :     {
     178           0 :         return sal::static_int_cast< ComparisonOperation >( m_aOperationList.GetSelectEntryPos() );
     179             :     }
     180             : 
     181             : 
     182             : } // namespace rptui
     183             : 
     184             : #endif // RPTUI_CONDITION_HXX
     185             : 
     186             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10