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

Generated by: LCOV version 1.11