LCOV - code coverage report
Current view: top level - dbaccess/source/ui/misc - ToolBoxHelper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 45 0.0 %
Date: 2015-06-13 12:38:46 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           0 :                 setImageList(m_nSymbolsSize);
      55             : 
      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             : 
      66           0 :     IMPL_LINK(OToolBoxHelper, ConfigOptionsChanged, SvtMiscOptions*, /*_pOptions*/)
      67             :     {
      68           0 :         if ( m_pToolBox )
      69             :         {
      70           0 :             SvtMiscOptions aOptions;
      71             :             // check if imagelist changed
      72           0 :             checkImageList();
      73           0 :             if ( aOptions.GetToolboxStyle() != m_pToolBox->GetOutStyle() )
      74           0 :                 m_pToolBox->SetOutStyle(aOptions.GetToolboxStyle());
      75             :         }
      76             : 
      77           0 :         return 0L;
      78             :     }
      79           0 :     IMPL_LINK(OToolBoxHelper, SettingsChanged, VclWindowEvent*, _pEvt)
      80             :     {
      81           0 :         if ( m_pToolBox && _pEvt && _pEvt->GetId() == VCLEVENT_APPLICATION_DATACHANGED )
      82             :         {
      83           0 :             DataChangedEvent* pData = static_cast<DataChangedEvent*>(_pEvt->GetData());
      84           0 :             if ( pData && ((( pData->GetType() == DataChangedEventType::SETTINGS  )   ||
      85           0 :             ( pData->GetType() == DataChangedEventType::DISPLAY   ))  &&
      86           0 :             ( pData->GetFlags() & AllSettingsFlags::STYLE        )))
      87             :                 // check if imagelist changed
      88           0 :                 checkImageList();
      89             :         }
      90             : 
      91           0 :         return 0L;
      92             :     }
      93           0 :     void OToolBoxHelper::setToolBox(ToolBox* _pTB)
      94             :     {
      95           0 :         bool bFirstTime = (m_pToolBox == nullptr);
      96           0 :         m_pToolBox = _pTB;
      97           0 :         if ( m_pToolBox )
      98             :         {
      99           0 :             ConfigOptionsChanged(NULL);
     100           0 :             if ( bFirstTime )
     101           0 :                 adjustToolBoxSize(m_pToolBox);
     102             :         }
     103           0 :     }
     104             : } // namespace
     105             : 
     106             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11