LCOV - code coverage report
Current view: top level - dbaccess/source/ui/misc - ToolBoxHelper.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 45 0.0 %
Date: 2014-04-14 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <dbaccess/ToolBoxHelper.hxx>
      21             : #include <vcl/toolbox.hxx>
      22             : #include <vcl/svapp.hxx>
      23             : #include <svtools/miscopt.hxx>
      24             : #include "UITools.hxx"
      25             : #include <svtools/imgdef.hxx>
      26             : #include <vcl/event.hxx>
      27             : #include <vcl/settings.hxx>
      28             : 
      29             : namespace dbaui
      30             : {
      31           0 :     OToolBoxHelper::OToolBoxHelper()
      32             :         : m_nSymbolsSize(-1 )
      33           0 :         , m_pToolBox(NULL)
      34             :     {
      35             : 
      36             :         OSL_ENSURE(m_nSymbolsSize != SvtMiscOptions().GetCurrentSymbolsSize(),"SymbolsSize should not be identical");
      37           0 :         SvtMiscOptions().AddListenerLink( LINK( this, OToolBoxHelper, ConfigOptionsChanged ) );
      38           0 :         Application::AddEventListener( LINK( this, OToolBoxHelper, SettingsChanged ) );
      39           0 :     }
      40           0 :     OToolBoxHelper::~OToolBoxHelper()
      41             :     {
      42           0 :         SvtMiscOptions().RemoveListenerLink( LINK( this, OToolBoxHelper, ConfigOptionsChanged ) );
      43           0 :         Application::RemoveEventListener( LINK( this, OToolBoxHelper, SettingsChanged ) );
      44           0 :     }
      45             : 
      46           0 :     void OToolBoxHelper::checkImageList()
      47             :     {
      48           0 :         if ( m_pToolBox )
      49             :         {
      50           0 :             sal_Int16 nCurSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize();
      51           0 :             if ( nCurSymbolsSize != m_nSymbolsSize )
      52             :             {
      53           0 :                 m_nSymbolsSize  = nCurSymbolsSize;
      54             : 
      55           0 :                 m_pToolBox->SetImageList( getImageList(m_nSymbolsSize) );
      56           0 :                 Size aTbOldSize = m_pToolBox->GetSizePixel();
      57           0 :                 adjustToolBoxSize(m_pToolBox);
      58           0 :                 Size aTbNewSize = m_pToolBox->GetSizePixel();
      59           0 :                 resizeControls(Size(aTbNewSize.Width() - aTbOldSize.Width(),
      60           0 :                                     aTbNewSize.Height() - aTbOldSize.Height())
      61           0 :                                 );
      62             :             }
      63             :         }
      64           0 :     }
      65           0 :     IMPL_LINK(OToolBoxHelper, ConfigOptionsChanged, SvtMiscOptions*, /*_pOptions*/)
      66             :     {
      67           0 :         if ( m_pToolBox )
      68             :         {
      69           0 :             SvtMiscOptions aOptions;
      70             :             // check if imagelist changed
      71           0 :             checkImageList();
      72           0 :             if ( aOptions.GetToolboxStyle() != m_pToolBox->GetOutStyle() )
      73           0 :                 m_pToolBox->SetOutStyle(aOptions.GetToolboxStyle());
      74             :         }
      75             : 
      76           0 :         return 0L;
      77             :     }
      78           0 :     IMPL_LINK(OToolBoxHelper, SettingsChanged, VclWindowEvent*, _pEvt)
      79             :     {
      80           0 :         if ( m_pToolBox && _pEvt && _pEvt->GetId() == VCLEVENT_APPLICATION_DATACHANGED )
      81             :         {
      82           0 :             DataChangedEvent* pData = reinterpret_cast<DataChangedEvent*>(_pEvt->GetData());
      83           0 :             if ( pData && ((( pData->GetType() == DATACHANGED_SETTINGS  )   ||
      84           0 :             ( pData->GetType() == DATACHANGED_DISPLAY   ))  &&
      85           0 :             ( pData->GetFlags() & SETTINGS_STYLE        )))
      86             :                 // check if imagelist changed
      87           0 :                 checkImageList();
      88             :         }
      89             : 
      90           0 :         return 0L;
      91             :     }
      92           0 :     void OToolBoxHelper::setToolBox(ToolBox* _pTB)
      93             :     {
      94           0 :         sal_Bool bFirstTime = (m_pToolBox == NULL);
      95           0 :         m_pToolBox = _pTB;
      96           0 :         if ( m_pToolBox )
      97             :         {
      98           0 :             ConfigOptionsChanged(NULL);
      99           0 :             if ( bFirstTime )
     100           0 :                 adjustToolBoxSize(m_pToolBox);
     101             :         }
     102           0 :     }
     103             : } // namespace
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10