LCOV - code coverage report
Current view: top level - UnoControls/source/inc - progressmonitor.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 1 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 2 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_UNOCONTROLS_SOURCE_INC_PROGRESSMONITOR_HXX
      21             : #define INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSMONITOR_HXX
      22             : 
      23             : #include <com/sun/star/awt/XFileDialog.hpp>
      24             : #include <com/sun/star/awt/XTextComponent.hpp>
      25             : #include <com/sun/star/awt/XListBox.hpp>
      26             : #include <com/sun/star/awt/XProgressMonitor.hpp>
      27             : #include <com/sun/star/awt/TextAlign.hpp>
      28             : #include <com/sun/star/awt/XScrollBar.hpp>
      29             : #include <com/sun/star/awt/XVclContainerPeer.hpp>
      30             : #include <com/sun/star/awt/XTabControllerModel.hpp>
      31             : #include <com/sun/star/awt/XMessageBox.hpp>
      32             : #include <com/sun/star/awt/XTextEditField.hpp>
      33             : #include <com/sun/star/awt/Style.hpp>
      34             : #include <com/sun/star/awt/XTimeField.hpp>
      35             : #include <com/sun/star/awt/XVclWindowPeer.hpp>
      36             : #include <com/sun/star/awt/XControlModel.hpp>
      37             : #include <com/sun/star/awt/XSpinField.hpp>
      38             : #include <com/sun/star/awt/XUnoControlContainer.hpp>
      39             : #include <com/sun/star/awt/XTextLayoutConstrains.hpp>
      40             : #include <com/sun/star/awt/XNumericField.hpp>
      41             : #include <com/sun/star/awt/XButton.hpp>
      42             : #include <com/sun/star/awt/XTextArea.hpp>
      43             : #include <com/sun/star/awt/XImageButton.hpp>
      44             : #include <com/sun/star/awt/XFixedText.hpp>
      45             : #include <com/sun/star/awt/XControlContainer.hpp>
      46             : #include <com/sun/star/awt/XDialog.hpp>
      47             : #include <com/sun/star/awt/ScrollBarOrientation.hpp>
      48             : #include <com/sun/star/awt/XRadioButton.hpp>
      49             : #include <com/sun/star/awt/XCurrencyField.hpp>
      50             : #include <com/sun/star/awt/XPatternField.hpp>
      51             : #include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
      52             : #include <com/sun/star/awt/XTabController.hpp>
      53             : #include <com/sun/star/awt/XVclContainer.hpp>
      54             : #include <com/sun/star/awt/XDateField.hpp>
      55             : #include <com/sun/star/awt/XComboBox.hpp>
      56             : #include <com/sun/star/awt/XControl.hpp>
      57             : #include <com/sun/star/awt/XCheckBox.hpp>
      58             : #include <com/sun/star/awt/XLayoutConstrains.hpp>
      59             : #include <com/sun/star/awt/XProgressBar.hpp>
      60             : #include <rtl/ref.hxx>
      61             : 
      62             : #include <vector>
      63             : 
      64             : #include "basecontainercontrol.hxx"
      65             : 
      66             : namespace unocontrols{
      67             : 
      68             : class ProgressBar;
      69             : 
      70             : #define PROGRESSMONITOR_FREEBORDER                      10                                                      // border around and between the controls
      71             : #define FIXEDTEXT_SERVICENAME                           "com.sun.star.awt.UnoControlFixedText"
      72             : #define BUTTON_SERVICENAME                              "com.sun.star.awt.UnoControlButton"
      73             : #define FIXEDTEXT_MODELNAME                             "com.sun.star.awt.UnoControlFixedTextModel"
      74             : #define BUTTON_MODELNAME                                "com.sun.star.awt.UnoControlButtonModel"
      75             : #define CONTROLNAME_TEXT                                "Text"                                                  // identifier the control in container
      76             : #define CONTROLNAME_BUTTON                              "Button"                                                //              -||-
      77             : #define CONTROLNAME_PROGRESSBAR                         "ProgressBar"                                           //              -||-
      78             : #define DEFAULT_BUTTONLABEL                             "Abbrechen"
      79             : #define PROGRESSMONITOR_DEFAULT_TOPIC                   ""
      80             : #define PROGRESSMONITOR_DEFAULT_TEXT                    ""
      81             : #define PROGRESSMONITOR_LINECOLOR_BRIGHT                TRGB_COLORDATA( 0x00, 0xFF, 0xFF, 0xFF )                // white
      82             : #define PROGRESSMONITOR_LINECOLOR_SHADOW                TRGB_COLORDATA( 0x00, 0x00, 0x00, 0x00 )                // black
      83             : #define PROGRESSMONITOR_DEFAULT_WIDTH                   350
      84             : #define PROGRESSMONITOR_DEFAULT_HEIGHT                  100
      85             : 
      86             : //  structs, types
      87             : 
      88             : /// Item of TextList
      89           0 : struct IMPL_TextlistItem
      90             : {
      91             :     OUString sTopic;          /// Left site of textline in dialog
      92             :     OUString sText;          /// Right site of textline in dialog
      93             : };
      94             : 
      95             : //  class declaration
      96             : 
      97             : class ProgressMonitor   : public ::com::sun::star::awt::XLayoutConstrains
      98             :                         , public ::com::sun::star::awt::XButton
      99             :                         , public ::com::sun::star::awt::XProgressMonitor
     100             :                         , public BaseContainerControl
     101             : {
     102             : 
     103             : //  public methods
     104             : 
     105             : public:
     106             : 
     107             :     //  construct/destruct
     108             : 
     109             :     /**_______________________________________________________________________________________________________
     110             :         @short
     111             :         @descr
     112             : 
     113             :         @seealso
     114             : 
     115             :         @param
     116             : 
     117             :         @return
     118             : 
     119             :         @onerror
     120             :     */
     121             : 
     122             :     ProgressMonitor( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
     123             : 
     124             :     /**_______________________________________________________________________________________________________
     125             :         @short
     126             :         @descr
     127             : 
     128             :         @seealso
     129             : 
     130             :         @param
     131             : 
     132             :         @return
     133             : 
     134             :         @onerror
     135             :     */
     136             : 
     137             :     virtual ~ProgressMonitor();
     138             : 
     139             :     //  XInterface
     140             : 
     141             :     /**_______________________________________________________________________________________________________
     142             :         @short      give answer, if interface is supported
     143             :         @descr      The interfaces are searched by type.
     144             : 
     145             :         @seealso    XInterface
     146             : 
     147             :         @param      "rType" is the type of searched interface.
     148             : 
     149             :         @return     Any     information about found interface
     150             : 
     151             :         @onerror    A RuntimeException is thrown.
     152             :     */
     153             : 
     154             :     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
     155             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     156             : 
     157             :     /**_______________________________________________________________________________________________________
     158             :         @short      increment refcount
     159             :         @seealso    XInterface
     160             :         @seealso    release()
     161             :         @onerror    A RuntimeException is thrown.
     162             :     */
     163             : 
     164             :     virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     165             : 
     166             :     /**_______________________________________________________________________________________________________
     167             :         @short      decrement refcount
     168             :         @seealso    XInterface
     169             :         @seealso    acquire()
     170             :         @onerror    A RuntimeException is thrown.
     171             :     */
     172             : 
     173             :     virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     174             : 
     175             :     //  XTypeProvider
     176             : 
     177             :     /**_______________________________________________________________________________________________________
     178             :         @short      get information about supported interfaces
     179             :         @seealso    XTypeProvider
     180             :         @return     Sequence of types of all supported interfaces
     181             : 
     182             :         @onerror    A RuntimeException is thrown.
     183             :     */
     184             : 
     185             :     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     186             : 
     187             :     //  XAggregation
     188             : 
     189             :     /**_______________________________________________________________________________________________________
     190             :     */
     191             : 
     192             :     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& aType )
     193             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     194             : 
     195             :     //  XProgressMonitor
     196             : 
     197             :     /**_______________________________________________________________________________________________________
     198             :         @short      add topic to dialog
     199             :         @descr      Add a topic with a text in right textlist (used for FixedText-member).<BR>
     200             :                     ( "beforeProgress" fix the right list ). The dialog metric is recalculated.
     201             : 
     202             :         @seealso    removeText(), updateText()
     203             : 
     204             :         @param      sTopic              Name of topic<BR>
     205             :                                          [sTopic != "" && sTopic != NULL]
     206             :         @param      sText               Value of topic<BR>
     207             :                                          [sText != "" && sText != NULL]
     208             :         @param      bbeforeProgress     Position of topic<BR>
     209             :                                          [True => before progressbar / False => below progressbar]
     210             :         @onerror    DEBUG   = Assertion<BR>
     211             :                     RELEASE = nothing
     212             :     */
     213             : 
     214             :     virtual void SAL_CALL addText(
     215             :         const OUString& sTopic ,
     216             :         const OUString& sText ,
     217             :         sal_Bool bbeforeProgress
     218             :     ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     219             : 
     220             :     /**_______________________________________________________________________________________________________
     221             :     */
     222             : 
     223             :     virtual void SAL_CALL removeText(
     224             :         const OUString& sTopic ,
     225             :         sal_Bool bbeforeProgress
     226             :     ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     227             : 
     228             :     /**_______________________________________________________________________________________________________
     229             :     */
     230             : 
     231             :     virtual void SAL_CALL updateText(
     232             :         const OUString&  sTopic ,
     233             :         const OUString&  sText ,
     234             :         sal_Bool bbeforeProgress
     235             :     ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     236             : 
     237             :     //  XProgressBar
     238             : 
     239             :     /**_______________________________________________________________________________________________________
     240             :     */
     241             : 
     242             :     virtual void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     243             : 
     244             :     /**_______________________________________________________________________________________________________
     245             :     */
     246             : 
     247             :     virtual void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     248             : 
     249             :     /**_______________________________________________________________________________________________________
     250             :     */
     251             : 
     252             :     virtual void SAL_CALL setValue( sal_Int32 nValue ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     253             : 
     254             :     /**_______________________________________________________________________________________________________
     255             :     */
     256             : 
     257             :     virtual void SAL_CALL setRange( sal_Int32   nMin    ,
     258             :                                     sal_Int32   nMax    ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     259             : 
     260             :     /**_______________________________________________________________________________________________________
     261             :     */
     262             : 
     263             :     virtual sal_Int32 SAL_CALL getValue() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     264             : 
     265             :     //  XButton
     266             : 
     267             :     /**_______________________________________________________________________________________________________
     268             :     */
     269             : 
     270             :     virtual void SAL_CALL addActionListener(
     271             :         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& xListener
     272             :     ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     273             : 
     274             :     /**_______________________________________________________________________________________________________
     275             :     */
     276             : 
     277             :     virtual void SAL_CALL removeActionListener(
     278             :         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& xListener
     279             :     ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     280             : 
     281             :     /**_______________________________________________________________________________________________________
     282             :     */
     283             : 
     284             :     virtual void SAL_CALL setLabel( const OUString& sLabel ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     285             : 
     286             :     /**_______________________________________________________________________________________________________
     287             :     */
     288             : 
     289             :     virtual void SAL_CALL setActionCommand( const OUString& sCommand )
     290             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     291             : 
     292             :     //  XLayoutConstrains
     293             : 
     294             :     /**_______________________________________________________________________________________________________
     295             :     */
     296             : 
     297             :     virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     298             : 
     299             :     /**_______________________________________________________________________________________________________
     300             :     */
     301             : 
     302             :     virtual ::com::sun::star::awt::Size SAL_CALL getPreferredSize() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     303             : 
     304             :     /**_______________________________________________________________________________________________________
     305             :     */
     306             : 
     307             :     virtual ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize )
     308             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     309             : 
     310             :     //  XControl
     311             : 
     312             :     /**_______________________________________________________________________________________________________
     313             :     */
     314             : 
     315             :     virtual void SAL_CALL createPeer(
     316             :         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit     >& xToolkit ,
     317             :         const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer  >& xParent
     318             :     ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     319             : 
     320             :     /**_______________________________________________________________________________________________________
     321             :     */
     322             : 
     323             :     virtual sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel )
     324             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     325             : 
     326             :     /**_______________________________________________________________________________________________________
     327             :     */
     328             : 
     329             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel()
     330             :         throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     331             : 
     332             :     //  XComponent
     333             : 
     334             :     /**_______________________________________________________________________________________________________
     335             :     */
     336             : 
     337             :     virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     338             : 
     339             :     //  XWindow
     340             : 
     341             :     /**_______________________________________________________________________________________________________
     342             :     */
     343             : 
     344             :     virtual void SAL_CALL setPosSize(   sal_Int32   nX      ,
     345             :                                         sal_Int32   nY      ,
     346             :                                         sal_Int32   nWidth  ,
     347             :                                         sal_Int32   nHeight ,
     348             :                                         sal_Int16   nFlags  ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     349             : 
     350             :     //  BaseControl
     351             : 
     352             :     /**_______________________________________________________________________________________________________
     353             :     */
     354             : 
     355             :     static const ::com::sun::star::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
     356             : 
     357             :     /**_______________________________________________________________________________________________________
     358             :     */
     359             : 
     360             :     static const OUString impl_getStaticImplementationName();
     361             : 
     362             : //  protected methods
     363             : 
     364             : protected:
     365             : 
     366             :     /**_______________________________________________________________________________________________________
     367             :     */
     368             : 
     369             :     virtual void impl_paint( sal_Int32 nX ,
     370             :                              sal_Int32 nY ,
     371             :                              const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics ) SAL_OVERRIDE;
     372             : 
     373             : // private methods
     374             : 
     375             : private:
     376             :     using BaseControl::impl_recalcLayout;
     377             :     /**_______________________________________________________________________________________________________
     378             :     */
     379             : 
     380             :     void impl_recalcLayout();
     381             : 
     382             :     /**_______________________________________________________________________________________________________
     383             :     */
     384             : 
     385             :     void impl_rebuildFixedText();
     386             : 
     387             :     /**_______________________________________________________________________________________________________
     388             :     */
     389             : 
     390             :     void impl_cleanMemory();
     391             : 
     392             :     /**_______________________________________________________________________________________________________
     393             :     */
     394             : 
     395             :     IMPL_TextlistItem* impl_searchTopic( const OUString& sTopic , bool bbeforeProgress );
     396             : 
     397             : // debug methods
     398             : 
     399             : private:
     400             : 
     401             :     /**_______________________________________________________________________________________________________
     402             :     */
     403             : 
     404             :     #ifdef DBG_UTIL
     405             : 
     406             :     static bool impl_debug_checkParameter( const OUString& sTopic, const OUString& sText, bool bbeforeProgress );    // addText, updateText
     407             :     static bool impl_debug_checkParameter( const OUString& rTopic, bool bbeforeProgress );                              // removeText
     408             : 
     409             :     #endif
     410             : 
     411             : // private variables
     412             : 
     413             : private:
     414             :     ::std::vector < IMPL_TextlistItem* >        maTextlist_Top;         // Elements before progress
     415             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText >   m_xTopic_Top;   // (used, if parameter "beforeProgress"=true in "addText, updateText, removeText")
     416             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText >   m_xText_Top;
     417             : 
     418             :     ::std::vector < IMPL_TextlistItem* >        maTextlist_Bottom;      // Elements below of progress
     419             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText >   m_xTopic_Bottom;   // (used, if parameter "beforeProgress"=false in "addText, updateText, removeText")
     420             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText >   m_xText_Bottom;
     421             : 
     422             :     rtl::Reference<ProgressBar> m_xProgressBar;
     423             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton >      m_xButton;
     424             :     ::com::sun::star::awt::Rectangle                          m_a3DLine;
     425             : 
     426             : };  // class ProgressMonitor
     427             : 
     428             : }   // namespace unocontrols
     429             : 
     430             : #endif // INCLUDED_UNOCONTROLS_SOURCE_INC_PROGRESSMONITOR_HXX
     431             : 
     432             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11