LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - browserlistbox.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 6 0.0 %
Date: 2014-04-14 Functions: 0 7 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 _EXTENSIONS_PROPCTRLR_BROWSERLISTBOX_HXX_
      21             : #define _EXTENSIONS_PROPCTRLR_BROWSERLISTBOX_HXX_
      22             : 
      23             : #include "browserline.hxx"
      24             : #include "modulepcr.hxx"
      25             : #include "pcrcommon.hxx"
      26             : 
      27             : #include <com/sun/star/inspection/XPropertyControl.hpp>
      28             : #include <com/sun/star/inspection/XPropertyHandler.hpp>
      29             : #include <vcl/scrbar.hxx>
      30             : #include <vcl/lstbox.hxx>
      31             : #include <vcl/button.hxx>
      32             : #include <tools/link.hxx>
      33             : #include <rtl/ref.hxx>
      34             : 
      35             : #include <set>
      36             : #include <vector>
      37             : #include <boost/unordered_map.hpp>
      38             : #include <boost/shared_ptr.hpp>
      39             : 
      40             : 
      41             : namespace pcr
      42             : {
      43             : 
      44             : 
      45             :     class IPropertyLineListener;
      46             :     class IPropertyControlObserver;
      47             :     struct OLineDescriptor;
      48             :     class InspectorHelpWindow;
      49             :     class PropertyControlContext_Impl;
      50             : 
      51             : 
      52             :     //= administrative structures for OBrowserListBox
      53             : 
      54             :     typedef ::boost::shared_ptr< OBrowserLine > BrowserLinePointer;
      55           0 :     struct ListBoxLine
      56             :     {
      57             :         OUString                         aName;
      58             :         BrowserLinePointer                      pLine;
      59             :         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >
      60             :                                                 xHandler;
      61             : 
      62           0 :         ListBoxLine( const OUString& rName, BrowserLinePointer _pLine, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _rxHandler )
      63             :             : aName( rName ),
      64             :               pLine( _pLine ),
      65           0 :               xHandler( _rxHandler )
      66             :         {
      67           0 :         }
      68             :     };
      69             :     typedef ::std::vector< ListBoxLine > ListBoxLines;
      70             : 
      71             : 
      72             :     //= IControlContext
      73             : 
      74             :     /** non-UNO version of XPropertyControlContext
      75             :     */
      76           0 :     class SAL_NO_VTABLE IControlContext
      77             :     {
      78             :     public:
      79             :         virtual void SAL_CALL focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException) = 0;
      80             :         virtual void SAL_CALL valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException) = 0;
      81             :         virtual void SAL_CALL activateNextControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& CurrentControl ) throw (::com::sun::star::uno::RuntimeException) = 0;
      82             : 
      83             :     protected:
      84           0 :         ~IControlContext() {}
      85             :     };
      86             : 
      87             : 
      88             :     //= OBrowserListBox
      89             : 
      90             :     class OBrowserListBox   :public Control
      91             :                             ,public IButtonClickListener
      92             :                             ,public IControlContext
      93             :                             ,public PcrClient
      94             :     {
      95             :     protected:
      96             :         Window                      m_aLinesPlayground;
      97             :         ScrollBar                   m_aVScroll;
      98             :         ::std::auto_ptr< InspectorHelpWindow >
      99             :                                     m_pHelpWindow;
     100             :         ListBoxLines                m_aLines;
     101             :         IPropertyLineListener*      m_pLineListener;
     102             :         IPropertyControlObserver*   m_pControlObserver;
     103             :         long                        m_nYOffset;
     104             :         long                        m_nCurrentPreferredHelpHeight;
     105             :         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
     106             :                                     m_xActiveControl;
     107             :         sal_uInt16                  m_nTheNameSize;
     108             :         sal_uInt16                  m_nRowHeight;
     109             :         ::std::set< sal_uInt16 >    m_aOutOfDateLines;
     110             :         sal_Bool                    m_bIsActive : 1;
     111             :         sal_Bool                    m_bUpdate : 1;
     112             :         ::rtl::Reference< PropertyControlContext_Impl >
     113             :                                     m_pControlContextImpl;
     114             : 
     115             :     protected:
     116             :         void    PositionLine( sal_uInt16 _nIndex );
     117             :         void    UpdatePosNSize();
     118             :         void    UpdatePlayGround();
     119             :         void    UpdateVScroll();
     120             :         void    ShowEntry(sal_uInt16 nPos);
     121             :         void    MoveThumbTo(sal_Int32 nNewThumbPos);
     122             :         void    Resize() SAL_OVERRIDE;
     123             : 
     124             :     public:
     125             :                                     OBrowserListBox( Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL );
     126             : 
     127             :                                     virtual ~OBrowserListBox();
     128             : 
     129             :         void                        UpdateAll();
     130             : 
     131             :         void                        ActivateListBox( sal_Bool _bActive );
     132             : 
     133             :         sal_uInt16                  CalcVisibleLines();
     134             :         void                        EnableUpdate();
     135             :         void                        DisableUpdate();
     136             :         bool                        Notify( NotifyEvent& _rNEvt ) SAL_OVERRIDE;
     137             :         virtual bool                PreNotify( NotifyEvent& _rNEvt ) SAL_OVERRIDE;
     138             : 
     139             :         void                        SetListener( IPropertyLineListener* _pListener );
     140             :         void                        SetObserver( IPropertyControlObserver* _pObserver );
     141             : 
     142             :         void                        EnableHelpSection( bool _bEnable );
     143             :         bool                        HasHelpSection() const;
     144             :         void                        SetHelpText( const OUString& _rHelpText );
     145             :         void                        SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines );
     146             : 
     147             :         void                        Clear();
     148             : 
     149             :         sal_uInt16                  InsertEntry( const OLineDescriptor&, sal_uInt16 nPos = EDITOR_LIST_APPEND );
     150             :         sal_Bool                    RemoveEntry( const OUString& _rName );
     151             :         void                        ChangeEntry( const OLineDescriptor&, sal_uInt16 nPos );
     152             : 
     153             :         void                        SetPropertyValue( const OUString& rEntryName, const ::com::sun::star::uno::Any& rValue, bool _bUnknownValue );
     154             :         sal_uInt16                  GetPropertyPos( const OUString& rEntryName ) const;
     155             :         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
     156             :                                     GetPropertyControl( const OUString& rEntryName );
     157             :         void                        EnablePropertyControls( const OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable );
     158             :         void                        EnablePropertyLine( const OUString& _rEntryName, bool _bEnable );
     159             : 
     160             :         sal_Int32                   GetMinimumWidth();
     161             :         sal_Int32                   GetMinimumHeight();
     162             : 
     163             : 
     164             :         sal_Bool    IsModified( ) const;
     165             :         void        CommitModified( );
     166             : 
     167             :     protected:
     168             :         // IControlContext
     169             :         virtual void SAL_CALL focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     170             :         virtual void SAL_CALL valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     171             :         virtual void SAL_CALL activateNextControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& CurrentControl ) throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
     172             : 
     173             :         // IButtonClickListener
     174             :         void    buttonClicked( OBrowserLine* _pLine, sal_Bool _bPrimary ) SAL_OVERRIDE;
     175             : 
     176             :         using Window::SetHelpText;
     177             :     private:
     178             :         DECL_LINK( ScrollHdl, ScrollBar* );
     179             : 
     180             :         /** retrieves the index of a given control in our line list
     181             :             @param _rxControl
     182             :                 The control to lookup. Must denote a control of one of the lines in ->m_aLines
     183             :         */
     184             :         sal_uInt16  impl_getControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ) const;
     185             : 
     186             :         /** sets the given property value at the given control, after converting it as necessary
     187             :             @param _rLine
     188             :                 The line whose at which the value is to be set.
     189             :             @param _rPropertyValue
     190             :                 the property value to set. If it's not compatible with the control value,
     191             :                 it will be converted, using <member>XPropertyHandler::convertToControlValue</member>
     192             :         */
     193             :         void        impl_setControlAsPropertyValue( const ListBoxLine& _rLine, const ::com::sun::star::uno::Any& _rPropertyValue );
     194             : 
     195             :         /** retrieves the value for the given control, as a property value, after converting it as necessary
     196             :             @param _rLine
     197             :                 The line whose at which the value is to be set.
     198             :         */
     199             :         ::com::sun::star::uno::Any
     200             :                     impl_getControlAsPropertyValue( const ListBoxLine& _rLine ) const;
     201             : 
     202             :         /** retrieves the ->BrowserLinePointer for a given entry name
     203             :             @param  _rEntryName
     204             :                 the name whose line is to be looked up
     205             :             @param  _out_rpLine
     206             :                 contains, upon return, the found browser line, if any
     207             :             @return
     208             :                 <TRUE/> if and only if a non-<NULL/> line for the given entry name could be
     209             :                 found.
     210             :         */
     211             :         bool        impl_getBrowserLineForName( const OUString& _rEntryName, BrowserLinePointer& _out_rpLine ) const;
     212             : 
     213             :         /** returns the preferred height (in pixels) of the help section, or 0 if we
     214             :             currently don't have a help section
     215             :         */
     216             :         long        impl_getPrefererredHelpHeight();
     217             : 
     218             :     private:
     219             :         using Window::Activate;
     220             :     };
     221             : 
     222             : 
     223             : } // namespace pcr
     224             : 
     225             : 
     226             : #endif // _EXTENSIONS_PROPCTRLR_BROWSERLISTBOX_HXX_
     227             : 
     228             : 
     229             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10