LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - propertyeditor.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 248 0.0 %
Date: 2012-08-25 Functions: 0 46 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 "propertyeditor.hxx"
      30                 :            : #include "browserpage.hxx"
      31                 :            : #include "linedescriptor.hxx"
      32                 :            : 
      33                 :            : #include <tools/debug.hxx>
      34                 :            : 
      35                 :            : //............................................................................
      36                 :            : namespace pcr
      37                 :            : {
      38                 :            : //............................................................................
      39                 :            : 
      40                 :            :     #define LAYOUT_BORDER_LEFT      3
      41                 :            :     #define LAYOUT_BORDER_TOP       3
      42                 :            :     #define LAYOUT_BORDER_RIGHT     3
      43                 :            :     #define LAYOUT_BORDER_BOTTOM    3
      44                 :            : 
      45                 :            :     /** === begin UNO using === **/
      46                 :            :     using ::com::sun::star::uno::Any;
      47                 :            :     using ::com::sun::star::inspection::XPropertyControl;
      48                 :            :     using ::com::sun::star::uno::Reference;
      49                 :            :     /** === end UNO using === **/
      50                 :            : 
      51                 :            :     //==================================================================
      52                 :            :     // class OPropertyEditor
      53                 :            :     //==================================================================
      54                 :            :     DBG_NAME(OPropertyEditor)
      55                 :            :     //------------------------------------------------------------------
      56                 :          0 :     OPropertyEditor::OPropertyEditor( Window* pParent, WinBits nWinStyle)
      57                 :            :             :Control(pParent, nWinStyle)
      58                 :            :             ,m_aTabControl( this )
      59                 :            :             ,m_nNextId(1)
      60                 :            :             ,m_bHasHelpSection( false )
      61                 :            :             ,m_nMinHelpLines( 0 )
      62                 :          0 :             ,m_nMaxHelpLines( 0 )
      63                 :            :     {
      64                 :            :         DBG_CTOR(OPropertyEditor,NULL);
      65                 :            : 
      66                 :          0 :         m_aTabControl.Show();
      67                 :          0 :         m_aTabControl.SetDeactivatePageHdl(LINK(this, OPropertyEditor, OnPageDeactivate));
      68                 :          0 :         m_aTabControl.SetActivatePageHdl(LINK(this, OPropertyEditor, OnPageActivate));
      69                 :          0 :         m_aTabControl.SetBackground(GetBackground());
      70                 :          0 :         m_aTabControl.SetPaintTransparent(sal_True);
      71                 :          0 :     }
      72                 :            : 
      73                 :            :     //------------------------------------------------------------------
      74                 :          0 :     OPropertyEditor::~OPropertyEditor()
      75                 :            :     {
      76                 :          0 :         Hide();
      77                 :          0 :         ClearAll();
      78                 :            :         DBG_DTOR(OPropertyEditor,NULL);
      79                 :          0 :     }
      80                 :            : 
      81                 :            :     //------------------------------------------------------------------
      82                 :          0 :     void OPropertyEditor::ClearAll()
      83                 :            :     {
      84                 :          0 :         m_nNextId=1;
      85                 :          0 :         sal_uInt16 nCount = m_aTabControl.GetPageCount();
      86                 :          0 :         for(long i = nCount-1; i >= 0; --i)
      87                 :            :         {
      88                 :          0 :             sal_uInt16 nID = m_aTabControl.GetPageId((sal_uInt16)i);
      89                 :          0 :             OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
      90                 :          0 :             if (pPage)
      91                 :            :             {
      92                 :          0 :                 pPage->EnableInput(sal_False);
      93                 :          0 :                 m_aTabControl.RemovePage(nID);
      94                 :          0 :                 delete pPage;
      95                 :            :             }
      96                 :            :         }
      97                 :          0 :         m_aTabControl.Clear();
      98                 :            : 
      99                 :            :         {
     100                 :          0 :             MapStringToPageId aEmpty;
     101                 :          0 :             m_aPropertyPageIds.swap( aEmpty );
     102                 :            :         }
     103                 :            : 
     104                 :          0 :         while ( !m_aHiddenPages.empty() )
     105                 :            :         {
     106                 :          0 :             delete m_aHiddenPages.begin()->second.pPage;
     107                 :          0 :             m_aHiddenPages.erase( m_aHiddenPages.begin() );
     108                 :            :         }
     109                 :          0 :     }
     110                 :            : 
     111                 :            :     //------------------------------------------------------------------
     112                 :          0 :     sal_Int32 OPropertyEditor::getMinimumHeight()
     113                 :            :     {
     114                 :          0 :         sal_Int32 nMinHeight( LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM );
     115                 :            : 
     116                 :          0 :         if ( m_aTabControl.GetPageCount() > 0 )
     117                 :            :         {
     118                 :          0 :             sal_uInt16 nFirstID = m_aTabControl.GetPageId( 0 );
     119                 :            : 
     120                 :            :             // reserve space for the tabs themself
     121                 :          0 :             Rectangle aTabArea( m_aTabControl.GetTabBounds( nFirstID ) );
     122                 :          0 :             nMinHeight += aTabArea.GetHeight();
     123                 :            : 
     124                 :            :             // ask the page how much it requires
     125                 :          0 :             OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nFirstID ) );
     126                 :          0 :             if ( pPage )
     127                 :          0 :                 nMinHeight += pPage->getMinimumHeight();
     128                 :            :         }
     129                 :            :         else
     130                 :          0 :             nMinHeight += 250;  // arbitrary ...
     131                 :            : 
     132                 :          0 :         return nMinHeight;
     133                 :            :     }
     134                 :            : 
     135                 :            :     //------------------------------------------------------------------
     136                 :          0 :     sal_Int32 OPropertyEditor::getMinimumWidth()
     137                 :            :     {
     138                 :          0 :         sal_uInt16 nCount = m_aTabControl.GetPageCount();
     139                 :          0 :         sal_Int32 nPageMinWidth = 0;
     140                 :          0 :         for(long i = nCount-1; i >= 0; --i)
     141                 :            :         {
     142                 :          0 :             sal_uInt16 nID = m_aTabControl.GetPageId((sal_uInt16)i);
     143                 :          0 :             OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
     144                 :          0 :             if (pPage)
     145                 :            :             {
     146                 :          0 :                 sal_Int32 nCurPageMinWidth = pPage->getMinimumWidth();
     147                 :          0 :                 if( nCurPageMinWidth > nPageMinWidth )
     148                 :          0 :                     nPageMinWidth = nCurPageMinWidth;
     149                 :            :             }
     150                 :            :         }
     151                 :          0 :         return nPageMinWidth+6;
     152                 :            :     }
     153                 :            : 
     154                 :            :     //------------------------------------------------------------------
     155                 :          0 :     void OPropertyEditor::CommitModified()
     156                 :            :     {
     157                 :            :         // commit all of my pages, if necessary
     158                 :            : 
     159                 :          0 :         sal_uInt16 nCount = m_aTabControl.GetPageCount();
     160                 :          0 :         for ( sal_uInt16 i=0; i<nCount; ++i )
     161                 :            :         {
     162                 :          0 :             sal_uInt16 nID = m_aTabControl.GetPageId( i );
     163                 :          0 :             OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nID ) );
     164                 :            : 
     165                 :          0 :             if ( pPage && pPage->getListBox().IsModified() )
     166                 :          0 :                 pPage->getListBox().CommitModified();
     167                 :            :         }
     168                 :          0 :     }
     169                 :            : 
     170                 :            :     //------------------------------------------------------------------
     171                 :          0 :     void OPropertyEditor::GetFocus()
     172                 :            :     {
     173                 :          0 :         m_aTabControl.GrabFocus();
     174                 :          0 :     }
     175                 :            : 
     176                 :            :     //------------------------------------------------------------------
     177                 :          0 :     OBrowserPage* OPropertyEditor::getPage( const ::rtl::OUString& _rPropertyName )
     178                 :            :     {
     179                 :          0 :         OBrowserPage* pPage = NULL;
     180                 :          0 :         MapStringToPageId::const_iterator aPropertyPageIdPos = m_aPropertyPageIds.find( _rPropertyName );
     181                 :          0 :         if ( aPropertyPageIdPos != m_aPropertyPageIds.end() )
     182                 :          0 :             pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( aPropertyPageIdPos->second ) );
     183                 :          0 :         return pPage;
     184                 :            :     }
     185                 :            : 
     186                 :            :     //------------------------------------------------------------------
     187                 :          0 :     const OBrowserPage* OPropertyEditor::getPage( const ::rtl::OUString& _rPropertyName ) const
     188                 :            :     {
     189                 :          0 :         return const_cast< OPropertyEditor* >( this )->getPage( _rPropertyName );
     190                 :            :     }
     191                 :            : 
     192                 :            :     //------------------------------------------------------------------
     193                 :          0 :     OBrowserPage* OPropertyEditor::getPage( sal_uInt16& _rPageId )
     194                 :            :     {
     195                 :          0 :         return static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( _rPageId ) );
     196                 :            :     }
     197                 :            : 
     198                 :            :     //------------------------------------------------------------------
     199                 :          0 :     const OBrowserPage* OPropertyEditor::getPage( sal_uInt16& _rPageId ) const
     200                 :            :     {
     201                 :          0 :         return const_cast< OPropertyEditor* >( this )->getPage( _rPageId );
     202                 :            :     }
     203                 :            : 
     204                 :            :     //------------------------------------------------------------------
     205                 :          0 :     void OPropertyEditor::Resize()
     206                 :            :     {
     207                 :            :         Rectangle aPlayground(
     208                 :            :             Point( LAYOUT_BORDER_LEFT, LAYOUT_BORDER_TOP ),
     209                 :            :             Size(
     210                 :          0 :                 GetOutputSizePixel().Width() - LAYOUT_BORDER_LEFT - LAYOUT_BORDER_RIGHT,
     211                 :          0 :                 GetOutputSizePixel().Height() - LAYOUT_BORDER_TOP - LAYOUT_BORDER_BOTTOM
     212                 :            :             )
     213                 :          0 :         );
     214                 :            : 
     215                 :          0 :         Rectangle aTabArea( aPlayground );
     216                 :          0 :         m_aTabControl.SetPosSizePixel( aTabArea.TopLeft(), aTabArea.GetSize() );
     217                 :          0 :     }
     218                 :            : 
     219                 :            :     //------------------------------------------------------------------
     220                 :          0 :     sal_uInt16 OPropertyEditor::AppendPage( const String & _rText, const rtl::OString& _rHelpId )
     221                 :            :     {
     222                 :            :         // obtain a new id
     223                 :          0 :         sal_uInt16 nId = m_nNextId++;
     224                 :            :         // insert the id
     225                 :          0 :         m_aTabControl.InsertPage(nId, _rText);
     226                 :            : 
     227                 :            :         // create a new page
     228                 :          0 :         OBrowserPage* pPage = new OBrowserPage(&m_aTabControl);
     229                 :          0 :         pPage->SetText( _rText );
     230                 :            :         // some knittings
     231                 :          0 :         pPage->SetSizePixel(m_aTabControl.GetTabPageSizePixel());
     232                 :          0 :         pPage->getListBox().SetListener(m_pListener);
     233                 :          0 :         pPage->getListBox().SetObserver(m_pObserver);
     234                 :          0 :         pPage->getListBox().EnableHelpSection( m_bHasHelpSection );
     235                 :          0 :         pPage->getListBox().SetHelpLineLimites( m_nMinHelpLines, m_nMaxHelpLines );
     236                 :          0 :         pPage->SetHelpId( _rHelpId );
     237                 :            : 
     238                 :            :         // immediately activate the page
     239                 :          0 :         m_aTabControl.SetTabPage(nId, pPage);
     240                 :          0 :         m_aTabControl.SetCurPageId(nId);
     241                 :            : 
     242                 :          0 :         return nId;
     243                 :            :     }
     244                 :            : 
     245                 :            :     //------------------------------------------------------------------
     246                 :          0 :     void OPropertyEditor::SetHelpId( const rtl::OString& rHelpId )
     247                 :            :     {
     248                 :          0 :         Control::SetHelpId("");
     249                 :          0 :         m_aTabControl.SetHelpId(rHelpId);
     250                 :          0 :     }
     251                 :            : 
     252                 :            :     //------------------------------------------------------------------
     253                 :          0 :     void OPropertyEditor::RemovePage(sal_uInt16 nID)
     254                 :            :     {
     255                 :          0 :         OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
     256                 :            : 
     257                 :          0 :         if (pPage)
     258                 :          0 :             pPage->EnableInput(sal_False);
     259                 :          0 :         m_aTabControl.RemovePage(nID);
     260                 :          0 :         if (pPage)
     261                 :          0 :             delete pPage;
     262                 :          0 :     }
     263                 :            : 
     264                 :            :     //------------------------------------------------------------------
     265                 :          0 :     void OPropertyEditor::SetPage(sal_uInt16 nId)
     266                 :            :     {
     267                 :          0 :         m_aTabControl.SetCurPageId(nId);
     268                 :          0 :     }
     269                 :            : 
     270                 :            :     //------------------------------------------------------------------
     271                 :          0 :     sal_uInt16 OPropertyEditor::GetCurPage()
     272                 :            :     {
     273                 :          0 :         if(m_aTabControl.GetPageCount()>0)
     274                 :          0 :             return m_aTabControl.GetCurPageId();
     275                 :            :         else
     276                 :          0 :             return 0;
     277                 :            :     }
     278                 :            : 
     279                 :            :     //------------------------------------------------------------------
     280                 :          0 :     void OPropertyEditor::Update(const ::std::mem_fun_t<void,OBrowserListBox>& _aUpdateFunction)
     281                 :            :     {
     282                 :            :         // forward this to all our pages
     283                 :          0 :         sal_uInt16 nCount = m_aTabControl.GetPageCount();
     284                 :          0 :         for (sal_uInt16 i=0;i<nCount;++i)
     285                 :            :         {
     286                 :          0 :             sal_uInt16 nID = m_aTabControl.GetPageId(i);
     287                 :          0 :             OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
     288                 :          0 :             if (pPage)
     289                 :          0 :                 _aUpdateFunction(&pPage->getListBox());
     290                 :            :         }
     291                 :          0 :     }
     292                 :            :     //------------------------------------------------------------------
     293                 :          0 :     void OPropertyEditor::EnableUpdate()
     294                 :            :     {
     295                 :          0 :         Update(::std::mem_fun(&OBrowserListBox::EnableUpdate));
     296                 :          0 :     }
     297                 :            :     //------------------------------------------------------------------
     298                 :          0 :     void OPropertyEditor::DisableUpdate()
     299                 :            :     {
     300                 :          0 :         Update(::std::mem_fun(&OBrowserListBox::DisableUpdate));
     301                 :          0 :     }
     302                 :            : 
     303                 :            :     //------------------------------------------------------------------
     304                 :          0 :     void OPropertyEditor::forEachPage( PageOperation _pOperation, const void* _pArgument )
     305                 :            :     {
     306                 :          0 :         sal_uInt16 nCount = m_aTabControl.GetPageCount();
     307                 :          0 :         for ( sal_uInt16 i=0; i<nCount; ++i )
     308                 :            :         {
     309                 :          0 :             sal_uInt16 nID = m_aTabControl.GetPageId(i);
     310                 :          0 :             OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nID ) );
     311                 :          0 :             if ( !pPage )
     312                 :          0 :                 continue;
     313                 :          0 :             (this->*_pOperation)( *pPage, _pArgument );
     314                 :            :         }
     315                 :          0 :     }
     316                 :            : 
     317                 :            :     //------------------------------------------------------------------
     318                 :          0 :     void OPropertyEditor::setPageLineListener( OBrowserPage& _rPage, const void* )
     319                 :            :     {
     320                 :          0 :         _rPage.getListBox().SetListener( m_pListener );
     321                 :          0 :     }
     322                 :            : 
     323                 :            :     //------------------------------------------------------------------
     324                 :          0 :     void OPropertyEditor::SetLineListener(IPropertyLineListener* _pListener)
     325                 :            :     {
     326                 :          0 :         m_pListener = _pListener;
     327                 :          0 :         forEachPage( &OPropertyEditor::setPageLineListener );
     328                 :          0 :     }
     329                 :            : 
     330                 :            :     //------------------------------------------------------------------
     331                 :          0 :     void OPropertyEditor::setPageControlObserver( OBrowserPage& _rPage, const void* )
     332                 :            :     {
     333                 :          0 :         _rPage.getListBox().SetObserver( m_pObserver );
     334                 :          0 :     }
     335                 :            : 
     336                 :            :     //------------------------------------------------------------------
     337                 :          0 :     void OPropertyEditor::SetControlObserver( IPropertyControlObserver* _pObserver )
     338                 :            :     {
     339                 :          0 :         m_pObserver = _pObserver;
     340                 :          0 :         forEachPage( &OPropertyEditor::setPageControlObserver );
     341                 :          0 :     }
     342                 :            : 
     343                 :            :     //------------------------------------------------------------------
     344                 :          0 :     void OPropertyEditor::EnableHelpSection( bool _bEnable )
     345                 :            :     {
     346                 :          0 :         m_bHasHelpSection = _bEnable;
     347                 :          0 :         forEachPage( &OPropertyEditor::enableHelpSection );
     348                 :          0 :     }
     349                 :            : 
     350                 :            :     //------------------------------------------------------------------
     351                 :          0 :     bool OPropertyEditor::HasHelpSection() const
     352                 :            :     {
     353                 :          0 :         return m_bHasHelpSection;
     354                 :            :     }
     355                 :            : 
     356                 :            :     //------------------------------------------------------------------
     357                 :          0 :     void OPropertyEditor::SetHelpText( const ::rtl::OUString& _rHelpText )
     358                 :            :     {
     359                 :          0 :         forEachPage( &OPropertyEditor::setHelpSectionText, &_rHelpText );
     360                 :          0 :     }
     361                 :            : 
     362                 :            :     //------------------------------------------------------------------
     363                 :          0 :     void OPropertyEditor::SetHelpLineLimites( sal_Int32 _nMinLines, sal_Int32 _nMaxLines )
     364                 :            :     {
     365                 :          0 :         m_nMinHelpLines = _nMinLines;
     366                 :          0 :         m_nMaxHelpLines = _nMaxLines;
     367                 :          0 :         forEachPage( &OPropertyEditor::setHelpLineLimits );
     368                 :          0 :     }
     369                 :            : 
     370                 :            :     //------------------------------------------------------------------
     371                 :          0 :     void OPropertyEditor::enableHelpSection( OBrowserPage& _rPage, const void* )
     372                 :            :     {
     373                 :          0 :         _rPage.getListBox().EnableHelpSection( m_bHasHelpSection );
     374                 :          0 :     }
     375                 :            : 
     376                 :            :     //------------------------------------------------------------------
     377                 :          0 :     void OPropertyEditor::setHelpSectionText( OBrowserPage& _rPage, const void* _pPointerToOUString )
     378                 :            :     {
     379                 :            :         OSL_ENSURE( _pPointerToOUString, "OPropertyEditor::setHelpSectionText: invalid argument!" );
     380                 :          0 :         if ( !_pPointerToOUString )
     381                 :          0 :             return;
     382                 :            : 
     383                 :          0 :         const ::rtl::OUString& rText( *(const ::rtl::OUString*)_pPointerToOUString );
     384                 :          0 :         _rPage.getListBox().SetHelpText( rText );
     385                 :            :     }
     386                 :            : 
     387                 :            :     //------------------------------------------------------------------
     388                 :          0 :     void OPropertyEditor::setHelpLineLimits( OBrowserPage& _rPage, const void* )
     389                 :            :     {
     390                 :          0 :         _rPage.getListBox().SetHelpLineLimites( m_nMinHelpLines, m_nMaxHelpLines );
     391                 :          0 :     }
     392                 :            : 
     393                 :            :     //------------------------------------------------------------------
     394                 :          0 :     sal_uInt16 OPropertyEditor::InsertEntry( const OLineDescriptor& rData, sal_uInt16 _nPageId, sal_uInt16 nPos )
     395                 :            :     {
     396                 :            :         // let the current page handle this
     397                 :          0 :         OBrowserPage* pPage = getPage( _nPageId );
     398                 :            :         DBG_ASSERT( pPage, "OPropertyEditor::InsertEntry: don't have such a page!" );
     399                 :          0 :         if ( !pPage )
     400                 :          0 :             return LISTBOX_ENTRY_NOTFOUND;
     401                 :            : 
     402                 :          0 :         sal_uInt16 nEntry = pPage->getListBox().InsertEntry( rData, nPos );
     403                 :            : 
     404                 :            :         OSL_ENSURE( m_aPropertyPageIds.find( rData.sName ) == m_aPropertyPageIds.end(),
     405                 :            :             "OPropertyEditor::InsertEntry: property already present in the map!" );
     406                 :          0 :         m_aPropertyPageIds.insert( MapStringToPageId::value_type( rData.sName, _nPageId ) );
     407                 :            : 
     408                 :          0 :         return nEntry;
     409                 :            :     }
     410                 :            : 
     411                 :            :     //------------------------------------------------------------------
     412                 :          0 :     void OPropertyEditor::RemoveEntry( const ::rtl::OUString& _rName )
     413                 :            :     {
     414                 :          0 :         OBrowserPage* pPage = getPage( _rName );
     415                 :          0 :         if ( pPage )
     416                 :            :         {
     417                 :          0 :             OSL_VERIFY( pPage->getListBox().RemoveEntry( _rName ) );
     418                 :            : 
     419                 :            :             OSL_ENSURE( m_aPropertyPageIds.find( _rName ) != m_aPropertyPageIds.end(),
     420                 :            :                 "OPropertyEditor::RemoveEntry: property not present in the map!" );
     421                 :          0 :             m_aPropertyPageIds.erase( _rName );
     422                 :            :         }
     423                 :          0 :     }
     424                 :            : 
     425                 :            :     //------------------------------------------------------------------
     426                 :          0 :     void OPropertyEditor::ChangeEntry( const OLineDescriptor& rData )
     427                 :            :     {
     428                 :          0 :         OBrowserPage* pPage = getPage( rData.sName );
     429                 :          0 :         if ( pPage )
     430                 :          0 :             pPage->getListBox().ChangeEntry( rData, EDITOR_LIST_REPLACE_EXISTING );
     431                 :          0 :     }
     432                 :            : 
     433                 :            :     //------------------------------------------------------------------
     434                 :          0 :     void OPropertyEditor::SetPropertyValue( const ::rtl::OUString& rEntryName, const Any& _rValue, bool _bUnknownValue )
     435                 :            :     {
     436                 :          0 :         OBrowserPage* pPage = getPage( rEntryName );
     437                 :          0 :         if ( pPage )
     438                 :          0 :             pPage->getListBox().SetPropertyValue( rEntryName, _rValue, _bUnknownValue );
     439                 :          0 :     }
     440                 :            : 
     441                 :            :     //------------------------------------------------------------------
     442                 :          0 :     sal_uInt16 OPropertyEditor::GetPropertyPos( const ::rtl::OUString& rEntryName ) const
     443                 :            :     {
     444                 :          0 :         sal_uInt16 nVal=LISTBOX_ENTRY_NOTFOUND;
     445                 :          0 :         const OBrowserPage* pPage = getPage( rEntryName );
     446                 :          0 :         if ( pPage )
     447                 :          0 :             nVal = pPage->getListBox().GetPropertyPos( rEntryName );
     448                 :          0 :         return nVal;
     449                 :            :     }
     450                 :            : 
     451                 :            :     //------------------------------------------------------------------
     452                 :          0 :     void OPropertyEditor::ShowPropertyPage( sal_uInt16 _nPageId, bool _bShow )
     453                 :            :     {
     454                 :          0 :         if ( !_bShow )
     455                 :            :         {
     456                 :          0 :             sal_uInt16 nPagePos = m_aTabControl.GetPagePos( _nPageId );
     457                 :          0 :             if ( TAB_PAGE_NOTFOUND == nPagePos )
     458                 :          0 :                 return;
     459                 :            :             DBG_ASSERT( m_aHiddenPages.find( _nPageId ) == m_aHiddenPages.end(), "OPropertyEditor::ShowPropertyPage: page already hidden!" );
     460                 :            : 
     461                 :          0 :             m_aHiddenPages[ _nPageId ] = HiddenPage( nPagePos, m_aTabControl.GetTabPage( _nPageId ) );
     462                 :          0 :             m_aTabControl.RemovePage( _nPageId );
     463                 :            :         }
     464                 :            :         else
     465                 :            :         {
     466                 :          0 :             ::std::map< sal_uInt16, HiddenPage >::iterator aPagePos = m_aHiddenPages.find( _nPageId );
     467                 :          0 :             if ( aPagePos == m_aHiddenPages.end() )
     468                 :            :                 return;
     469                 :            : 
     470                 :          0 :             aPagePos->second.pPage->SetSizePixel( m_aTabControl.GetTabPageSizePixel() );
     471                 :          0 :             m_aTabControl.InsertPage( aPagePos->first, aPagePos->second.pPage->GetText(), aPagePos->second.nPos );
     472                 :          0 :             m_aTabControl.SetTabPage( aPagePos->first, aPagePos->second.pPage );
     473                 :            : 
     474                 :          0 :             m_aHiddenPages.erase( aPagePos );
     475                 :            :         }
     476                 :            :     }
     477                 :            : 
     478                 :            :     //------------------------------------------------------------------
     479                 :          0 :     void OPropertyEditor::EnablePropertyControls( const ::rtl::OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable )
     480                 :            :     {
     481                 :          0 :         for ( sal_uInt16 i = 0; i < m_aTabControl.GetPageCount(); ++i )
     482                 :            :         {
     483                 :          0 :             OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( m_aTabControl.GetPageId( i ) ) );
     484                 :          0 :             if ( pPage )
     485                 :          0 :                 pPage->getListBox().EnablePropertyControls( _rEntryName, _nControls, _bEnable );
     486                 :            :         }
     487                 :          0 :     }
     488                 :            : 
     489                 :            :     //------------------------------------------------------------------
     490                 :          0 :     void OPropertyEditor::EnablePropertyLine( const ::rtl::OUString& _rEntryName, bool _bEnable )
     491                 :            :     {
     492                 :          0 :         for ( sal_uInt16 i = 0; i < m_aTabControl.GetPageCount(); ++i )
     493                 :            :         {
     494                 :          0 :             OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( m_aTabControl.GetPageId( i ) ) );
     495                 :          0 :             if ( pPage )
     496                 :          0 :                 pPage->getListBox().EnablePropertyLine( _rEntryName, _bEnable );
     497                 :            :         }
     498                 :          0 :     }
     499                 :            : 
     500                 :            :     //------------------------------------------------------------------
     501                 :          0 :     Reference< XPropertyControl > OPropertyEditor::GetPropertyControl(const ::rtl::OUString& rEntryName)
     502                 :            :     {
     503                 :          0 :         Reference< XPropertyControl > xControl;
     504                 :            :         // let the current page handle this
     505                 :          0 :         OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(m_aTabControl.GetCurPageId()));
     506                 :          0 :         if (pPage)
     507                 :          0 :             xControl = pPage->getListBox().GetPropertyControl(rEntryName);
     508                 :          0 :         return xControl;
     509                 :            :     }
     510                 :            : 
     511                 :            :     //------------------------------------------------------------------
     512                 :          0 :     IMPL_LINK_NOARG(OPropertyEditor, OnPageActivate)
     513                 :            :     {
     514                 :          0 :         if (m_aPageActivationHandler.IsSet())
     515                 :          0 :             m_aPageActivationHandler.Call(NULL);
     516                 :          0 :         return 0L;
     517                 :            :     }
     518                 :            : 
     519                 :            :     //------------------------------------------------------------------
     520                 :          0 :     IMPL_LINK_NOARG(OPropertyEditor, OnPageDeactivate)
     521                 :            :     {
     522                 :            :         // commit the data on the current (to-be-decativated) tab page
     523                 :            :         // (79404)
     524                 :          0 :         sal_Int32 nCurrentId = m_aTabControl.GetCurPageId();
     525                 :          0 :         OBrowserPage* pCurrentPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage((sal_uInt16)nCurrentId));
     526                 :          0 :         if ( !pCurrentPage )
     527                 :          0 :             return 1L;
     528                 :            : 
     529                 :          0 :         if ( pCurrentPage->getListBox().IsModified() )
     530                 :          0 :             pCurrentPage->getListBox().CommitModified();
     531                 :            : 
     532                 :          0 :         return 1L;
     533                 :            :     }
     534                 :            : 
     535                 :            : //............................................................................
     536                 :            : } // namespace pcr
     537                 :            : //............................................................................
     538                 :            : 
     539                 :            : 
     540                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10