LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - browserlistbox.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 6 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _EXTENSIONS_PROPCTRLR_BROWSERLISTBOX_HXX_
      30                 :            : #define _EXTENSIONS_PROPCTRLR_BROWSERLISTBOX_HXX_
      31                 :            : 
      32                 :            : #include "browserline.hxx"
      33                 :            : #include "modulepcr.hxx"
      34                 :            : #include "pcrcommon.hxx"
      35                 :            : 
      36                 :            : #include <com/sun/star/inspection/XPropertyControl.hpp>
      37                 :            : #include <com/sun/star/inspection/XPropertyHandler.hpp>
      38                 :            : #include <vcl/scrbar.hxx>
      39                 :            : #include <vcl/lstbox.hxx>
      40                 :            : #include <vcl/button.hxx>
      41                 :            : #include <tools/link.hxx>
      42                 :            : #include <rtl/ref.hxx>
      43                 :            : 
      44                 :            : #include <set>
      45                 :            : #include <vector>
      46                 :            : #include <boost/unordered_map.hpp>
      47                 :            : #include <boost/shared_ptr.hpp>
      48                 :            : 
      49                 :            : //............................................................................
      50                 :            : namespace pcr
      51                 :            : {
      52                 :            : //............................................................................
      53                 :            : 
      54                 :            :     class IPropertyLineListener;
      55                 :            :     class IPropertyControlObserver;
      56                 :            :     struct OLineDescriptor;
      57                 :            :     class InspectorHelpWindow;
      58                 :            :     class PropertyControlContext_Impl;
      59                 :            : 
      60                 :            :     //========================================================================
      61                 :            :     //= administrative structures for OBrowserListBox
      62                 :            :     //========================================================================
      63                 :            :     typedef ::boost::shared_ptr< OBrowserLine > BrowserLinePointer;
      64                 :          0 :     struct ListBoxLine
      65                 :            :     {
      66                 :            :         ::rtl::OUString                         aName;
      67                 :            :         BrowserLinePointer                      pLine;
      68                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >
      69                 :            :                                                 xHandler;
      70                 :            : 
      71                 :          0 :         ListBoxLine( const ::rtl::OUString& rName, BrowserLinePointer _pLine, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _rxHandler )
      72                 :            :             : aName( rName ),
      73                 :            :               pLine( _pLine ),
      74                 :          0 :               xHandler( _rxHandler )
      75                 :            :         {
      76                 :          0 :         }
      77                 :            :     };
      78                 :            :     typedef ::std::vector< ListBoxLine > ListBoxLines;
      79                 :            : 
      80                 :            :     //========================================================================
      81                 :            :     //= IControlContext
      82                 :            :     //========================================================================
      83                 :            :     /** non-UNO version of XPropertyControlContext
      84                 :            :     */
      85                 :          0 :     class SAL_NO_VTABLE IControlContext
      86                 :            :     {
      87                 :            :     public:
      88                 :            :         virtual void SAL_CALL focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException) = 0;
      89                 :            :         virtual void SAL_CALL valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException) = 0;
      90                 :            :         virtual void SAL_CALL activateNextControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& CurrentControl ) throw (::com::sun::star::uno::RuntimeException) = 0;
      91                 :            : 
      92                 :            :     protected:
      93                 :          0 :         ~IControlContext() {}
      94                 :            :     };
      95                 :            : 
      96                 :            :     //========================================================================
      97                 :            :     //= OBrowserListBox
      98                 :            :     //========================================================================
      99                 :            :     class OBrowserListBox   :public Control
     100                 :            :                             ,public IButtonClickListener
     101                 :            :                             ,public IControlContext
     102                 :            :                             ,public PcrClient
     103                 :            :     {
     104                 :            :     protected:
     105                 :            :         Window                      m_aLinesPlayground;
     106                 :            :         ScrollBar                   m_aVScroll;
     107                 :            :         ::std::auto_ptr< InspectorHelpWindow >
     108                 :            :                                     m_pHelpWindow;
     109                 :            :         ListBoxLines                m_aLines;
     110                 :            :         IPropertyLineListener*      m_pLineListener;
     111                 :            :         IPropertyControlObserver*   m_pControlObserver;
     112                 :            :         long                        m_nYOffset;
     113                 :            :         long                        m_nCurrentPreferredHelpHeight;
     114                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
     115                 :            :                                     m_xActiveControl;
     116                 :            :         sal_uInt16                  m_nTheNameSize;
     117                 :            :         sal_uInt16                  m_nRowHeight;
     118                 :            :         ::std::set< sal_uInt16 >    m_aOutOfDateLines;
     119                 :            :         sal_Bool                    m_bIsActive : 1;
     120                 :            :         sal_Bool                    m_bUpdate : 1;
     121                 :            :         ::rtl::Reference< PropertyControlContext_Impl >
     122                 :            :                                     m_pControlContextImpl;
     123                 :            : 
     124                 :            :     protected:
     125                 :            :         void    PositionLine( sal_uInt16 _nIndex );
     126                 :            :         void    UpdatePosNSize();
     127                 :            :         void    UpdatePlayGround();
     128                 :            :         void    UpdateVScroll();
     129                 :            :         void    ShowEntry(sal_uInt16 nPos);
     130                 :            :         void    MoveThumbTo(sal_Int32 nNewThumbPos);
     131                 :            :         void    Resize();
     132                 :            : 
     133                 :            :     public:
     134                 :            :                                     OBrowserListBox( Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL );
     135                 :            : 
     136                 :            :                                     ~OBrowserListBox();
     137                 :            : 
     138                 :            :         void                        UpdateAll();
     139                 :            : 
     140                 :            :         void                        ActivateListBox( sal_Bool _bActive );
     141                 :            : 
     142                 :            :         sal_uInt16                  CalcVisibleLines();
     143                 :            :         void                        EnableUpdate();
     144                 :            :         void                        DisableUpdate();
     145                 :            :         long                        Notify( NotifyEvent& _rNEvt );
     146                 :            :         long                        PreNotify( NotifyEvent& _rNEvt );
     147                 :            : 
     148                 :            :         void                        SetListener( IPropertyLineListener* _pListener );
     149                 :            :         void                        SetObserver( IPropertyControlObserver* _pObserver );
     150                 :            : 
     151                 :            :         void                        EnableHelpSection( bool _bEnable );
     152                 :            :         bool                        HasHelpSection() const;
     153                 :            :         void                        SetHelpText( const ::rtl::OUString& _rHelpText );
     154                 :            :         void                        SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines );
     155                 :            : 
     156                 :            :         void                        Clear();
     157                 :            : 
     158                 :            :         sal_uInt16                  InsertEntry( const OLineDescriptor&, sal_uInt16 nPos = EDITOR_LIST_APPEND );
     159                 :            :         sal_Bool                    RemoveEntry( const ::rtl::OUString& _rName );
     160                 :            :         void                        ChangeEntry( const OLineDescriptor&, sal_uInt16 nPos );
     161                 :            : 
     162                 :            :         void                        SetPropertyValue( const ::rtl::OUString& rEntryName, const ::com::sun::star::uno::Any& rValue, bool _bUnknownValue );
     163                 :            :         sal_uInt16                  GetPropertyPos( const ::rtl::OUString& rEntryName ) const;
     164                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
     165                 :            :                                     GetPropertyControl( const ::rtl::OUString& rEntryName );
     166                 :            :         void                        EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable );
     167                 :            :         void                        EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable );
     168                 :            : 
     169                 :            :         sal_Int32                   GetMinimumWidth();
     170                 :            :         sal_Int32                   GetMinimumHeight();
     171                 :            : 
     172                 :            : 
     173                 :            :         sal_Bool    IsModified( ) const;
     174                 :            :         void        CommitModified( );
     175                 :            : 
     176                 :            :     protected:
     177                 :            :         // IControlContext
     178                 :            :         virtual void SAL_CALL focusGained( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException);
     179                 :            :         virtual void SAL_CALL valueChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& Control ) throw (::com::sun::star::uno::RuntimeException);
     180                 :            :         virtual void SAL_CALL activateNextControl( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& CurrentControl ) throw (::com::sun::star::uno::RuntimeException);
     181                 :            : 
     182                 :            :         // IButtonClickListener
     183                 :            :         void    buttonClicked( OBrowserLine* _pLine, sal_Bool _bPrimary );
     184                 :            : 
     185                 :            :         using Window::SetHelpText;
     186                 :            :     private:
     187                 :            :         DECL_LINK( ScrollHdl, ScrollBar* );
     188                 :            : 
     189                 :            :         /** retrieves the index of a given control in our line list
     190                 :            :             @param _rxControl
     191                 :            :                 The control to lookup. Must denote a control of one of the lines in ->m_aLines
     192                 :            :         */
     193                 :            :         sal_uInt16  impl_getControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >& _rxControl ) const;
     194                 :            : 
     195                 :            :         /** sets the given property value at the given control, after converting it as necessary
     196                 :            :             @param _rLine
     197                 :            :                 The line whose at which the value is to be set.
     198                 :            :             @param _rPropertyValue
     199                 :            :                 the property value to set. If it's not compatible with the control value,
     200                 :            :                 it will be converted, using <member>XPropertyHandler::convertToControlValue</member>
     201                 :            :         */
     202                 :            :         void        impl_setControlAsPropertyValue( const ListBoxLine& _rLine, const ::com::sun::star::uno::Any& _rPropertyValue );
     203                 :            : 
     204                 :            :         /** retrieves the value for the given control, as a property value, after converting it as necessary
     205                 :            :             @param _rLine
     206                 :            :                 The line whose at which the value is to be set.
     207                 :            :         */
     208                 :            :         ::com::sun::star::uno::Any
     209                 :            :                     impl_getControlAsPropertyValue( const ListBoxLine& _rLine ) const;
     210                 :            : 
     211                 :            :         /** retrieves the ->BrowserLinePointer for a given entry name
     212                 :            :             @param  _rEntryName
     213                 :            :                 the name whose line is to be looked up
     214                 :            :             @param  _out_rpLine
     215                 :            :                 contains, upon return, the found browser line, if any
     216                 :            :             @return
     217                 :            :                 <TRUE/> if and only if a non-<NULL/> line for the given entry name could be
     218                 :            :                 found.
     219                 :            :         */
     220                 :            :         bool        impl_getBrowserLineForName( const ::rtl::OUString& _rEntryName, BrowserLinePointer& _out_rpLine ) const;
     221                 :            : 
     222                 :            :         /** returns the preferred height (in pixels) of the help section, or 0 if we
     223                 :            :             currently don't have a help section
     224                 :            :         */
     225                 :            :         long        impl_getPrefererredHelpHeight();
     226                 :            : 
     227                 :            :     private:
     228                 :            :         using Window::Activate;
     229                 :            :     };
     230                 :            : 
     231                 :            : //............................................................................
     232                 :            : } // namespace pcr
     233                 :            : //............................................................................
     234                 :            : 
     235                 :            : #endif // _EXTENSIONS_PROPCTRLR_BROWSERLISTBOX_HXX_
     236                 :            : 
     237                 :            : 
     238                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10