LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - browserline.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 232 0.0 %
Date: 2012-08-25 Functions: 0 36 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                 :            : #include "browserline.hxx"
      30                 :            : 
      31                 :            : #include <com/sun/star/uno/XComponentContext.hpp>
      32                 :            : #include <com/sun/star/inspection/PropertyLineElement.hpp>
      33                 :            : #include <com/sun/star/graphic/GraphicProvider.hpp>
      34                 :            : #include <com/sun/star/graphic/XGraphicProvider.hpp>
      35                 :            : 
      36                 :            : #include <comphelper/componentcontext.hxx>
      37                 :            : #include <comphelper/processfactory.hxx>
      38                 :            : #include <comphelper/string.hxx>
      39                 :            : #include <tools/debug.hxx>
      40                 :            : #include <tools/diagnose_ex.h>
      41                 :            : #include <toolkit/helper/vclunohelper.hxx>
      42                 :            : #include <vcl/svapp.hxx>
      43                 :            : 
      44                 :            : //............................................................................
      45                 :            : namespace pcr
      46                 :            : {
      47                 :            : //............................................................................
      48                 :            : 
      49                 :            :     /** === begin UNO using === **/
      50                 :            :     using ::com::sun::star::uno::Reference;
      51                 :            :     using ::com::sun::star::uno::XComponentContext;
      52                 :            :     using ::com::sun::star::inspection::XPropertyControl;
      53                 :            :     using ::com::sun::star::inspection::XPropertyControlContext;
      54                 :            :     using ::com::sun::star::uno::UNO_QUERY_THROW;
      55                 :            :     using ::com::sun::star::uno::Exception;
      56                 :            :     using ::com::sun::star::graphic::GraphicProvider;
      57                 :            :     using ::com::sun::star::graphic::XGraphicProvider;
      58                 :            :     using ::com::sun::star::uno::Sequence;
      59                 :            :     using ::com::sun::star::beans::PropertyValue;
      60                 :            :     using ::com::sun::star::graphic::XGraphic;
      61                 :            :     /** === end UNO using === **/
      62                 :            : 
      63                 :            :     namespace PropertyLineElement = ::com::sun::star::inspection::PropertyLineElement;
      64                 :            : 
      65                 :            :     //==================================================================
      66                 :            :     //= OBrowserLine
      67                 :            :     //==================================================================
      68                 :            :     DBG_NAME(OBrowserLine)
      69                 :            :     //------------------------------------------------------------------
      70                 :            : 
      71                 :          0 :     OBrowserLine::OBrowserLine( const ::rtl::OUString& _rEntryName, Window* pParent )
      72                 :            :             :m_sEntryName( _rEntryName )
      73                 :            :             ,m_aFtTitle(pParent)
      74                 :            :             ,m_pControlWindow( NULL )
      75                 :            :             ,m_pBrowseButton(NULL)
      76                 :            :             ,m_pAdditionalBrowseButton( NULL )
      77                 :            :             ,m_pClickListener( NULL )
      78                 :            :             ,m_pTheParent(pParent)
      79                 :            :             ,m_nNameWidth(0)
      80                 :            :             ,m_nEnableFlags( 0xFFFF )
      81                 :            :             ,m_bIndentTitle( false )
      82                 :          0 :             ,m_bReadOnly( false )
      83                 :            :     {
      84                 :            :         DBG_CTOR(OBrowserLine,NULL);
      85                 :          0 :         m_aFtTitle.Show();
      86                 :          0 :     }
      87                 :            : 
      88                 :            :     //------------------------------------------------------------------
      89                 :          0 :     OBrowserLine::~OBrowserLine()
      90                 :            :     {
      91                 :          0 :         implHideBrowseButton( true, false );
      92                 :          0 :         implHideBrowseButton( false, false );
      93                 :            : 
      94                 :            :         DBG_DTOR(OBrowserLine,NULL);
      95                 :          0 :     }
      96                 :            : 
      97                 :            :     //------------------------------------------------------------------
      98                 :          0 :     void OBrowserLine::IndentTitle( bool _bIndent )
      99                 :            :     {
     100                 :          0 :         if ( m_bIndentTitle != _bIndent )
     101                 :            :         {
     102                 :          0 :             m_bIndentTitle = _bIndent;
     103                 :          0 :             impl_layoutComponents();
     104                 :            :         }
     105                 :          0 :     }
     106                 :            : 
     107                 :            :     //------------------------------------------------------------------
     108                 :          0 :     void OBrowserLine::SetComponentHelpIds( const rtl::OString& _rHelpId, const rtl::OString& _sPrimaryButtonId, const rtl::OString& _sSecondaryButtonId )
     109                 :            :     {
     110                 :          0 :         if ( m_pControlWindow )
     111                 :          0 :             m_pControlWindow->SetHelpId( _rHelpId );
     112                 :            : 
     113                 :          0 :         if ( m_pBrowseButton )
     114                 :            :         {
     115                 :          0 :             m_pBrowseButton->SetHelpId( _rHelpId );
     116                 :          0 :             m_pBrowseButton->SetUniqueId( _sPrimaryButtonId );
     117                 :            : 
     118                 :          0 :             if ( m_pAdditionalBrowseButton )
     119                 :            :             {
     120                 :          0 :                 m_pAdditionalBrowseButton->SetHelpId( _rHelpId );
     121                 :          0 :                 m_pAdditionalBrowseButton->SetUniqueId( _sSecondaryButtonId );
     122                 :            :             }
     123                 :            :         }
     124                 :          0 :     }
     125                 :            : 
     126                 :            :     //------------------------------------------------------------------
     127                 :          0 :     void OBrowserLine::setControl( const Reference< XPropertyControl >& _rxControl )
     128                 :            :     {
     129                 :          0 :         m_xControl = _rxControl;
     130                 :          0 :         m_pControlWindow = m_xControl.is() ? VCLUnoHelper::GetWindow( _rxControl->getControlWindow() ) : NULL;
     131                 :            :         DBG_ASSERT( m_pControlWindow, "OBrowserLine::setControl: setting NULL controls/windows is not allowed!" );
     132                 :            : 
     133                 :          0 :         if ( m_pControlWindow )
     134                 :            :         {
     135                 :          0 :             m_pControlWindow->SetParent( m_pTheParent );
     136                 :          0 :             m_pControlWindow->Show();
     137                 :            :         }
     138                 :          0 :         impl_layoutComponents();
     139                 :          0 :     }
     140                 :            : 
     141                 :            :     //------------------------------------------------------------------
     142                 :          0 :     Window* OBrowserLine::GetRefWindow()
     143                 :            :     {
     144                 :          0 :         Window* pRefWindow=&m_aFtTitle;
     145                 :            : 
     146                 :          0 :         if(m_pBrowseButton)
     147                 :            :         {
     148                 :          0 :             pRefWindow=(Window*)m_pBrowseButton;
     149                 :            :         }
     150                 :          0 :         else if ( m_pControlWindow )
     151                 :            :         {
     152                 :          0 :             pRefWindow = m_pControlWindow;
     153                 :            :         }
     154                 :          0 :         return pRefWindow;
     155                 :            :     }
     156                 :            : 
     157                 :            :     //------------------------------------------------------------------
     158                 :          0 :     void OBrowserLine::SetTabOrder(Window* pRefWindow, sal_uInt16 nFlags )
     159                 :            :     {
     160                 :          0 :         m_aFtTitle.SetZOrder(pRefWindow,nFlags);
     161                 :          0 :         if ( m_pControlWindow )
     162                 :          0 :             m_pControlWindow->SetZOrder( (Window*)&m_aFtTitle, WINDOW_ZORDER_BEHIND );
     163                 :            : 
     164                 :          0 :         if ( m_pBrowseButton )
     165                 :          0 :             m_pBrowseButton->SetZOrder( m_pControlWindow, WINDOW_ZORDER_BEHIND );
     166                 :            : 
     167                 :          0 :         if ( m_pAdditionalBrowseButton )
     168                 :          0 :             m_pAdditionalBrowseButton->SetZOrder( m_pBrowseButton, WINDOW_ZORDER_BEHIND );
     169                 :          0 :     }
     170                 :            : 
     171                 :            :     //------------------------------------------------------------------
     172                 :          0 :     sal_Bool OBrowserLine::GrabFocus()
     173                 :            :     {
     174                 :          0 :         sal_Bool bRes=sal_False;
     175                 :            : 
     176                 :          0 :         if ( m_pControlWindow && m_pControlWindow->IsEnabled() )
     177                 :            :         {
     178                 :          0 :             m_pControlWindow->GrabFocus();
     179                 :          0 :             bRes = sal_True;
     180                 :            :         }
     181                 :          0 :         else if ( m_pAdditionalBrowseButton && m_pAdditionalBrowseButton->IsEnabled() )
     182                 :            :         {
     183                 :          0 :             m_pAdditionalBrowseButton->GrabFocus();
     184                 :          0 :             bRes = sal_True;
     185                 :            :         }
     186                 :          0 :         else if ( m_pBrowseButton && m_pBrowseButton->IsEnabled() )
     187                 :            :         {
     188                 :          0 :             m_pBrowseButton->GrabFocus();
     189                 :          0 :             bRes = sal_True;
     190                 :            :         }
     191                 :          0 :         return bRes;
     192                 :            :     }
     193                 :            : 
     194                 :            :     //------------------------------------------------------------------
     195                 :          0 :     void OBrowserLine::SetPosSizePixel( Point _rPos, Size _rSize )
     196                 :            :     {
     197                 :          0 :         m_aLinePos = _rPos;
     198                 :          0 :         m_aOutputSize = _rSize;
     199                 :            : 
     200                 :          0 :         impl_layoutComponents();
     201                 :          0 :     }
     202                 :            : 
     203                 :            :     //------------------------------------------------------------------
     204                 :          0 :     void OBrowserLine::Show(sal_Bool bFlag)
     205                 :            :     {
     206                 :          0 :         m_aFtTitle.Show(bFlag);
     207                 :          0 :         if ( m_pControlWindow )
     208                 :          0 :             m_pControlWindow->Show( bFlag );
     209                 :          0 :         if ( m_pBrowseButton )
     210                 :          0 :             m_pBrowseButton->Show( bFlag );
     211                 :          0 :         if ( m_pAdditionalBrowseButton )
     212                 :          0 :             m_pAdditionalBrowseButton->Show( bFlag );
     213                 :          0 :     }
     214                 :            : 
     215                 :            :     //------------------------------------------------------------------
     216                 :          0 :     void OBrowserLine::Hide()
     217                 :            :     {
     218                 :          0 :         Show(sal_False);
     219                 :          0 :     }
     220                 :            : 
     221                 :            :     //------------------------------------------------------------------
     222                 :          0 :     sal_Bool OBrowserLine::IsVisible()
     223                 :            :     {
     224                 :          0 :         return m_aFtTitle.IsVisible();
     225                 :            :     }
     226                 :            : 
     227                 :            :     //------------------------------------------------------------------
     228                 :          0 :     void OBrowserLine::impl_layoutComponents()
     229                 :            :     {
     230                 :            :         {
     231                 :          0 :             Point aTitlePos( m_aLinePos.X(), m_aLinePos.Y() + 8 );
     232                 :          0 :             Size aTitleSize( m_nNameWidth - 3, m_aOutputSize.Height() );
     233                 :            : 
     234                 :          0 :             if ( m_bIndentTitle )
     235                 :            :             {
     236                 :          0 :                 Size aIndent( m_pTheParent->LogicToPixel( Size( 8, 0 ), MAP_APPFONT ) );
     237                 :          0 :                 aTitlePos.X() += aIndent.Width();
     238                 :          0 :                 aTitleSize.Width() -= aIndent.Width();
     239                 :            :             }
     240                 :          0 :             m_aFtTitle.SetPosSizePixel( aTitlePos, aTitleSize );
     241                 :            :         }
     242                 :            : 
     243                 :          0 :         sal_Int32 nBrowseButtonSize = m_aOutputSize.Height() - 4;
     244                 :            : 
     245                 :          0 :         if ( m_pControlWindow )
     246                 :            :         {
     247                 :          0 :             Point aControlPos( m_aLinePos.X() + m_nNameWidth, m_aLinePos.Y() + 2 );
     248                 :          0 :             m_pControlWindow->SetPosPixel( aControlPos );
     249                 :            : 
     250                 :          0 :             Size aControlSize( m_aOutputSize.Width() - 4 - m_nNameWidth - nBrowseButtonSize - 4, m_pControlWindow->GetSizePixel().Height() );
     251                 :          0 :             if ( m_pAdditionalBrowseButton )
     252                 :          0 :                 aControlSize.Width() -= nBrowseButtonSize + 4;
     253                 :          0 :             m_pControlWindow->SetSizePixel( aControlSize );
     254                 :            :         }
     255                 :            : 
     256                 :          0 :         if ( m_pBrowseButton )
     257                 :            :         {
     258                 :          0 :             Point aButtonPos( m_aOutputSize.Width() - 4 - nBrowseButtonSize, m_aLinePos.Y() + 2 );
     259                 :          0 :             Size aButtonSize( nBrowseButtonSize, nBrowseButtonSize );
     260                 :          0 :             m_pBrowseButton->SetPosSizePixel( aButtonPos, aButtonSize );
     261                 :            : 
     262                 :          0 :             if ( m_pAdditionalBrowseButton )
     263                 :            :             {
     264                 :          0 :                 aButtonPos.X() -= nBrowseButtonSize + 4;
     265                 :          0 :                 m_pAdditionalBrowseButton->SetPosSizePixel( aButtonPos, aButtonSize );
     266                 :            :             }
     267                 :            :         }
     268                 :          0 :     }
     269                 :            : 
     270                 :            :     //------------------------------------------------------------------
     271                 :          0 :     void OBrowserLine::SetTitle(const XubString& _rNewTtile )
     272                 :            :     {
     273                 :          0 :         if ( GetTitle() == _rNewTtile )
     274                 :          0 :             return;
     275                 :            :         // #99102# --------------
     276                 :          0 :         m_aFtTitle.SetText( _rNewTtile );
     277                 :          0 :         if ( m_pControlWindow )
     278                 :          0 :             m_pControlWindow->SetAccessibleName( _rNewTtile );
     279                 :          0 :         if ( m_pBrowseButton )
     280                 :          0 :             m_pBrowseButton->SetAccessibleName( _rNewTtile );
     281                 :          0 :         FullFillTitleString();
     282                 :            :     }
     283                 :            : 
     284                 :            :     // #99102# ---------------------------------------------------------
     285                 :          0 :     void OBrowserLine::FullFillTitleString()
     286                 :            :     {
     287                 :          0 :         if( m_pTheParent )
     288                 :            :         {
     289                 :          0 :             String aText = m_aFtTitle.GetText();
     290                 :            : 
     291                 :          0 :             while( m_pTheParent->GetTextWidth( aText ) < m_nNameWidth )
     292                 :          0 :                         aText.AppendAscii("...........");
     293                 :            : 
     294                 :            :             // for Issue 69452
     295                 :          0 :             if (Application::GetSettings().GetLayoutRTL())
     296                 :            :             {
     297                 :          0 :                 sal_Unicode cRTL_mark = 0x200F;
     298                 :          0 :                 aText.Append(cRTL_mark);
     299                 :            :             }
     300                 :            : 
     301                 :          0 :             m_aFtTitle.SetText(aText);
     302                 :            :         }
     303                 :          0 :     }
     304                 :            : 
     305                 :            :     //------------------------------------------------------------------
     306                 :          0 :     XubString OBrowserLine::GetTitle() const
     307                 :            :     {
     308                 :          0 :         rtl::OUString sDisplayName = m_aFtTitle.GetText();
     309                 :            : 
     310                 :            :         // for Issue 69452
     311                 :          0 :         if (Application::GetSettings().GetLayoutRTL())
     312                 :            :         {
     313                 :          0 :             sal_Unicode cRTL_mark = 0x200F;
     314                 :          0 :             sDisplayName = comphelper::string::stripEnd(sDisplayName, cRTL_mark);
     315                 :            :         }
     316                 :            : 
     317                 :          0 :         sDisplayName = comphelper::string::stripEnd(sDisplayName, '.');
     318                 :            : 
     319                 :          0 :         return sDisplayName;
     320                 :            :     }
     321                 :            : 
     322                 :            :     //------------------------------------------------------------------
     323                 :          0 :     void OBrowserLine::SetReadOnly( bool _bReadOnly )
     324                 :            :     {
     325                 :          0 :         if ( m_bReadOnly != _bReadOnly )
     326                 :            :         {
     327                 :          0 :             m_bReadOnly = _bReadOnly;
     328                 :          0 :             implUpdateEnabledDisabled();
     329                 :            :         }
     330                 :          0 :     }
     331                 :            : 
     332                 :            :     //------------------------------------------------------------------
     333                 :            :     namespace
     334                 :            :     {
     335                 :          0 :         void implSetBitIfAffected( sal_uInt16& _nEnabledBits, sal_Int16 _nAffectedMask, sal_Int16 _nTestBit, bool _bSet )
     336                 :            :         {
     337                 :          0 :             if ( _nAffectedMask & _nTestBit )
     338                 :            :             {
     339                 :          0 :                 if ( _bSet )
     340                 :          0 :                     _nEnabledBits |= _nTestBit;
     341                 :            :                 else
     342                 :          0 :                     _nEnabledBits &= ~_nTestBit;
     343                 :            :             }
     344                 :          0 :         }
     345                 :            : 
     346                 :          0 :         void implEnable( Window* _pWindow, sal_uInt16 _nEnabledBits, sal_uInt16 _nMatchBits  )
     347                 :            :         {
     348                 :          0 :             if ( _pWindow )
     349                 :          0 :                 _pWindow->Enable( ( _nEnabledBits & _nMatchBits ) == _nMatchBits );
     350                 :          0 :         }
     351                 :            : 
     352                 :          0 :         void implEnable( Window* _pWindow, bool _bEnable )
     353                 :            :         {
     354                 :          0 :             if ( _pWindow )
     355                 :          0 :                 _pWindow->Enable( _bEnable );
     356                 :          0 :         }
     357                 :            :     }
     358                 :            : 
     359                 :            :     //------------------------------------------------------------------
     360                 :          0 :     void OBrowserLine::implUpdateEnabledDisabled()
     361                 :            :     {
     362                 :          0 :         implEnable( &m_aFtTitle,                m_nEnableFlags, PropertyLineElement::CompleteLine );
     363                 :          0 :         if ( m_pControlWindow )
     364                 :          0 :             implEnable( m_pControlWindow,       m_nEnableFlags, PropertyLineElement::CompleteLine | PropertyLineElement::InputControl );
     365                 :            : 
     366                 :          0 :         if ( m_bReadOnly )
     367                 :            :         {
     368                 :          0 :             implEnable( m_pBrowseButton,            false );
     369                 :          0 :             implEnable( m_pAdditionalBrowseButton,  false );
     370                 :            :         }
     371                 :            :         else
     372                 :            :         {
     373                 :          0 :             implEnable( m_pBrowseButton,            m_nEnableFlags, PropertyLineElement::CompleteLine | PropertyLineElement::PrimaryButton );
     374                 :          0 :             implEnable( m_pAdditionalBrowseButton,  m_nEnableFlags, PropertyLineElement::CompleteLine | PropertyLineElement::SecondaryButton );
     375                 :            :         }
     376                 :          0 :     }
     377                 :            : 
     378                 :            :     //------------------------------------------------------------------
     379                 :          0 :     void OBrowserLine::EnablePropertyLine( bool _bEnable )
     380                 :            :     {
     381                 :          0 :         implSetBitIfAffected( m_nEnableFlags, PropertyLineElement::CompleteLine, PropertyLineElement::CompleteLine, _bEnable );
     382                 :          0 :         implUpdateEnabledDisabled();
     383                 :          0 :     }
     384                 :            : 
     385                 :            :     //------------------------------------------------------------------
     386                 :          0 :     void OBrowserLine::EnablePropertyControls( sal_Int16 _nControls, bool _bEnable )
     387                 :            :     {
     388                 :          0 :         implSetBitIfAffected( m_nEnableFlags, _nControls, PropertyLineElement::InputControl, _bEnable );
     389                 :          0 :         implSetBitIfAffected( m_nEnableFlags, _nControls, PropertyLineElement::PrimaryButton, _bEnable );
     390                 :          0 :         implSetBitIfAffected( m_nEnableFlags, _nControls, PropertyLineElement::SecondaryButton, _bEnable );
     391                 :          0 :         implUpdateEnabledDisabled();
     392                 :          0 :     }
     393                 :            : 
     394                 :            :     //------------------------------------------------------------------
     395                 :          0 :     PushButton& OBrowserLine::impl_ensureButton( bool _bPrimary )
     396                 :            :     {
     397                 :          0 :         PushButton*& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton;
     398                 :            : 
     399                 :          0 :         if ( !rpButton )
     400                 :            :         {
     401                 :          0 :             rpButton = new PushButton( m_pTheParent, WB_NOPOINTERFOCUS );
     402                 :          0 :             rpButton->SetGetFocusHdl( LINK( this, OBrowserLine, OnButtonFocus ) );
     403                 :          0 :             rpButton->SetClickHdl( LINK( this, OBrowserLine, OnButtonClicked ) );
     404                 :          0 :             rpButton->SetText(rtl::OUString("..."));
     405                 :            :         }
     406                 :            : 
     407                 :          0 :         rpButton->Show();
     408                 :            : 
     409                 :          0 :         impl_layoutComponents();
     410                 :            : 
     411                 :          0 :         return *rpButton;
     412                 :            :     }
     413                 :            : 
     414                 :            :     //------------------------------------------------------------------
     415                 :          0 :     void OBrowserLine::impl_getImagesFromURL_nothrow( const ::rtl::OUString& _rImageURL, Image& _out_rImage )
     416                 :            :     {
     417                 :            :         try
     418                 :            :         {
     419                 :          0 :             Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
     420                 :          0 :             Reference< XGraphicProvider > xGraphicProvider( GraphicProvider::create(xContext) );
     421                 :            : 
     422                 :          0 :             Sequence< PropertyValue > aMediaProperties(1);
     423                 :          0 :             aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
     424                 :          0 :             aMediaProperties[0].Value <<= _rImageURL;
     425                 :            : 
     426                 :          0 :             Reference< XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties ), UNO_QUERY_THROW );
     427                 :          0 :             _out_rImage = Image( xGraphic );
     428                 :            :         }
     429                 :          0 :         catch( const Exception& )
     430                 :            :         {
     431                 :            :             DBG_UNHANDLED_EXCEPTION();
     432                 :            :         }
     433                 :          0 :     }
     434                 :            : 
     435                 :            :     //------------------------------------------------------------------
     436                 :          0 :     void OBrowserLine::ShowBrowseButton( const ::rtl::OUString& _rImageURL, sal_Bool _bPrimary )
     437                 :            :     {
     438                 :          0 :         PushButton& rButton( impl_ensureButton( _bPrimary ) );
     439                 :            : 
     440                 :            :         OSL_PRECOND( !_rImageURL.isEmpty(), "OBrowserLine::ShowBrowseButton: use the other version if you don't have an image!" );
     441                 :          0 :         Image aImage;
     442                 :          0 :         impl_getImagesFromURL_nothrow( _rImageURL, aImage );
     443                 :            : 
     444                 :          0 :         rButton.SetModeImage( aImage );
     445                 :          0 :    }
     446                 :            : 
     447                 :            :     //------------------------------------------------------------------
     448                 :          0 :     void OBrowserLine::ShowBrowseButton( const Image& _rImage, sal_Bool _bPrimary )
     449                 :            :     {
     450                 :          0 :         PushButton& rButton( impl_ensureButton( _bPrimary ) );
     451                 :          0 :         if ( !!_rImage )
     452                 :          0 :             rButton.SetModeImage( _rImage );
     453                 :          0 :     }
     454                 :            : 
     455                 :            :     //------------------------------------------------------------------
     456                 :          0 :     void OBrowserLine::ShowBrowseButton( sal_Bool _bPrimary )
     457                 :            :     {
     458                 :          0 :         impl_ensureButton( _bPrimary );
     459                 :          0 :     }
     460                 :            : 
     461                 :            :     //------------------------------------------------------------------
     462                 :          0 :     void OBrowserLine::implHideBrowseButton( sal_Bool _bPrimary, bool _bReLayout )
     463                 :            :     {
     464                 :          0 :         PushButton*& rpButton = _bPrimary ? m_pBrowseButton : m_pAdditionalBrowseButton;
     465                 :            : 
     466                 :          0 :         if ( rpButton )
     467                 :            :         {
     468                 :          0 :             rpButton->Hide();
     469                 :          0 :             delete rpButton;
     470                 :          0 :             rpButton = NULL;
     471                 :            :         }
     472                 :            : 
     473                 :          0 :         if ( _bReLayout )
     474                 :          0 :             impl_layoutComponents();
     475                 :          0 :     }
     476                 :            : 
     477                 :            :     //------------------------------------------------------------------
     478                 :          0 :     void OBrowserLine::HideBrowseButton( sal_Bool _bPrimary )
     479                 :            :     {
     480                 :          0 :         implHideBrowseButton( _bPrimary, true );
     481                 :          0 :     }
     482                 :            : 
     483                 :            :     //------------------------------------------------------------------
     484                 :          0 :     void OBrowserLine::SetTitleWidth(sal_uInt16 nWidth)
     485                 :            :     {
     486                 :          0 :         if (m_nNameWidth != nWidth+10)
     487                 :            :         {
     488                 :          0 :             m_nNameWidth = nWidth+10;
     489                 :          0 :             impl_layoutComponents();
     490                 :            :         }
     491                 :            :         // #99102# ---------
     492                 :          0 :         FullFillTitleString();
     493                 :          0 :     }
     494                 :            : 
     495                 :            :     //------------------------------------------------------------------
     496                 :          0 :     void OBrowserLine::SetClickListener( IButtonClickListener* _pListener )
     497                 :            :     {
     498                 :          0 :         m_pClickListener = _pListener;
     499                 :          0 :     }
     500                 :            : 
     501                 :            :     //------------------------------------------------------------------
     502                 :          0 :     IMPL_LINK( OBrowserLine, OnButtonClicked, PushButton*, _pButton )
     503                 :            :     {
     504                 :          0 :         if ( m_pClickListener )
     505                 :          0 :             m_pClickListener->buttonClicked( this, _pButton == m_pBrowseButton );
     506                 :            : 
     507                 :          0 :         return 0L;
     508                 :            :     }
     509                 :            : 
     510                 :            :     //------------------------------------------------------------------
     511                 :          0 :     IMPL_LINK( OBrowserLine, OnButtonFocus, PushButton*, /*pPB*/ )
     512                 :            :     {
     513                 :          0 :         if ( m_xControl.is() )
     514                 :            :         {
     515                 :            :             try
     516                 :            :             {
     517                 :          0 :                 Reference< XPropertyControlContext > xContext( m_xControl->getControlContext(), UNO_QUERY_THROW );
     518                 :          0 :                 xContext->focusGained( m_xControl );
     519                 :            :             }
     520                 :          0 :             catch( const Exception& )
     521                 :            :             {
     522                 :            :                 DBG_UNHANDLED_EXCEPTION();
     523                 :            :             }
     524                 :            :         }
     525                 :          0 :         return 0;
     526                 :            :     }
     527                 :            : //............................................................................
     528                 :            : } // namespace pcr
     529                 :            : //............................................................................
     530                 :            : 
     531                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10