LCOV - code coverage report
Current view: top level - svx/source/sidebar/paragraph - ParaBulletsControl.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 54 1.9 %
Date: 2014-11-03 Functions: 2 10 20.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             : #include "ParaBulletsControl.hxx"
      20             : #include "ParaPropertyPanel.hrc"
      21             : #include <sfx2/sidebar/ResourceDefinitions.hrc>
      22             : #include <svx/dialogs.hrc>
      23             : #include <svx/dialmgr.hxx>
      24             : #include <unotools/viewoptions.hxx>
      25             : #include <editeng/kernitem.hxx>
      26             : #include <sfx2/bindings.hxx>
      27             : #include <sfx2/dispatch.hxx>
      28             : #include <sfx2/sidebar/Theme.hxx>
      29             : #include <svtools/unitconv.hxx>
      30             : #include <svx/nbdtmg.hxx>
      31             : #include <svx/nbdtmgfact.hxx>
      32             : #include <vcl/settings.hxx>
      33             : 
      34             : namespace svx { namespace sidebar {
      35             : 
      36           0 : ParaBulletsControl::ParaBulletsControl(
      37             :     vcl::Window* pParent,
      38             :     svx::sidebar::ParaPropertyPanel& rPanel )
      39           0 :     : PopupControl( pParent,SVX_RES(RID_POPUPPANEL_PARAPAGE_BULLETS) )
      40           0 :     , maBulletsVS( this,SVX_RES(VS_VALUES) )
      41           0 :     , maMoreButton( this,SVX_RES(CB_BULLET_MORE) )
      42             :     , mrParaPropertyPanel( rPanel )
      43           0 :     , mpBindings( mrParaPropertyPanel.GetBindings() )
      44             : {
      45           0 :     FreeResource();
      46             : 
      47           0 :     maBulletsVS.SetColCount(3);
      48           0 :     maBulletsVS.SetLineCount(3);
      49           0 :     maBulletsVS.SetStyle( maBulletsVS.GetStyle() | WB_ITEMBORDER |WB_NO_DIRECTSELECT);
      50           0 :     maBulletsVS.SetExtraSpacing(BULLET_IMAGE_SPACING);
      51           0 :     maBulletsVS.SetItemWidth(BULLET_IMAGE_WIDTH);
      52           0 :     maBulletsVS.SetItemHeight(BULLET_IMAGE_HEIGHT);
      53           0 :     maBulletsVS.InsertItem( DEFAULT_NONE );
      54           0 :     for( sal_uInt16 nVSIdx = 1; nVSIdx <= DEFAULT_BULLET_TYPES; ++nVSIdx )
      55             :     {
      56           0 :         maBulletsVS.InsertItem( nVSIdx );
      57             :     }
      58             : 
      59           0 :     maBulletsVS.SetItemText( DEFAULT_NONE, SVX_RESSTR( RID_SVXSTR_NUMBULLET_NONE ));
      60           0 :     NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
      61           0 :     if ( pBullets )
      62             :     {
      63           0 :         for( sal_uInt16 nIndex = 0; nIndex < DEFAULT_BULLET_TYPES; ++nIndex )
      64             :         {
      65           0 :             maBulletsVS.SetItemText( nIndex + 1, pBullets->GetDescription(nIndex) );
      66             :         }
      67             :     }
      68             : 
      69           0 :     maBulletsVS.Show();
      70           0 :     maBulletsVS.SetSelectHdl(LINK(this, ParaBulletsControl, BulletSelectHdl_Impl));
      71             : 
      72           0 :     maBulletsVS.SetColor( GetSettings().GetStyleSettings().GetHighContrastMode()
      73           0 :                           ? GetSettings().GetStyleSettings().GetMenuColor()
      74           0 :                           : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );
      75           0 :     maBulletsVS.SetBackground( GetSettings().GetStyleSettings().GetHighContrastMode()
      76           0 :                                ? GetSettings().GetStyleSettings().GetMenuColor()
      77           0 :                                : sfx2::sidebar::Theme::GetColor( sfx2::sidebar::Theme::Paint_PanelBackground ) );
      78             : 
      79           0 :     maMoreButton.SetClickHdl(LINK(this, ParaBulletsControl, MoreButtonClickHdl_Impl));
      80             : 
      81           0 : }
      82             : 
      83             : 
      84           0 : ParaBulletsControl::~ParaBulletsControl()
      85             : {
      86           0 : }
      87             : 
      88             : 
      89           0 : void ParaBulletsControl::UpdateValueSet()
      90             : {
      91           0 :     maBulletsVS.StateChanged(StateChangedType::STYLE);
      92           0 :     maBulletsVS.StateChanged(StateChangedType::INITSHOW);
      93             : 
      94           0 :     const sal_uInt16 nTypeIndex = mrParaPropertyPanel.GetBulletTypeIndex();
      95           0 :     if ( nTypeIndex != (sal_uInt16)0xFFFF )
      96           0 :         maBulletsVS.SelectItem( nTypeIndex );
      97             :     else
      98             :     {
      99           0 :         maBulletsVS.SelectItem(0);
     100             :     }
     101           0 :     maMoreButton.GrabFocus();
     102           0 : }
     103             : 
     104             : 
     105           0 : IMPL_LINK(ParaBulletsControl, BulletSelectHdl_Impl, ValueSet*, EMPTYARG)
     106             : {
     107           0 :     const sal_uInt16 nIdx = maBulletsVS.GetSelectItemId();
     108           0 :     SfxUInt16Item aItem( FN_SVX_SET_BULLET, nIdx );
     109           0 :     if (mpBindings)
     110           0 :         mpBindings->GetDispatcher()->Execute( FN_SVX_SET_BULLET, SfxCallMode::RECORD, &aItem, 0L );
     111             : 
     112           0 :     mrParaPropertyPanel.EndBulletsPopupMode();
     113             : 
     114           0 :     return 0;
     115             : }
     116             : 
     117             : 
     118           0 : IMPL_LINK(ParaBulletsControl, MoreButtonClickHdl_Impl, void*, EMPTYARG)
     119             : {
     120           0 :     if (mpBindings)
     121           0 :         mpBindings->GetDispatcher()->Execute( SID_OUTLINE_BULLET, SfxCallMode::ASYNCHRON );
     122             : 
     123           0 :     mrParaPropertyPanel.EndBulletsPopupMode();
     124             : 
     125           0 :     return 0;
     126             : }
     127             : 
     128         594 : }} // end of namespace sidebar
     129             : 
     130             : 
     131             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10