LCOV - code coverage report
Current view: top level - svx/source/tbxctrls - verttexttbxctrl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 39 44 88.6 %
Date: 2012-08-25 Functions: 9 10 90.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 33 70 47.1 %

           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                 :            : 
      30                 :            : #include <svx/dialmgr.hxx>
      31                 :            : #include <svx/dialogs.hrc>
      32                 :            : #include <svx/verttexttbxctrl.hxx>
      33                 :            : #include <svl/languageoptions.hxx>
      34                 :            : #include <sfx2/app.hxx>
      35                 :            : #include <svl/eitem.hxx>
      36                 :            : #include <vcl/toolbox.hxx>
      37                 :            : #include <rtl/ustring.hxx>
      38                 :            : 
      39         [ +  - ]:       2220 : SFX_IMPL_TOOLBOX_CONTROL(SvxCTLTextTbxCtrl, SfxBoolItem);
      40         [ +  - ]:       1173 : SFX_IMPL_TOOLBOX_CONTROL(SvxVertTextTbxCtrl, SfxBoolItem);
      41                 :            : 
      42                 :       1922 : SvxCTLTextTbxCtrl::SvxCTLTextTbxCtrl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
      43                 :       1922 :     SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
      44                 :            : {
      45                 :       1922 :     SetVert(sal_False);
      46 [ +  - ][ +  - ]:       1922 :     addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CTLFontState" )));
      47                 :       1922 : }
      48                 :            : 
      49                 :        527 : SvxVertTextTbxCtrl::SvxVertTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
      50                 :        527 :     SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
      51                 :            : {
      52                 :        527 :     SetVert(sal_True);
      53 [ +  - ][ +  - ]:        527 :     addStatusListener( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:VerticalTextState" )));
      54                 :        527 : }
      55                 :            : 
      56                 :            : /* ---------------------------------------------------------------------------*/
      57                 :       2449 : SvxVertCTLTextTbxCtrl::SvxVertCTLTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
      58                 :            :     SfxToolBoxControl( nSlotId, nId, rTbx ),
      59                 :       2449 :     bCheckVertical(sal_True)
      60                 :            : {
      61                 :       2449 : }
      62                 :            : 
      63                 :       2449 : SvxVertCTLTextTbxCtrl::~SvxVertCTLTextTbxCtrl( )
      64                 :            : {
      65         [ -  + ]:       2449 : }
      66                 :            : 
      67                 :      10946 : void SvxVertCTLTextTbxCtrl::StateChanged(
      68                 :            :     sal_uInt16 nSID,
      69                 :            :     SfxItemState eState,
      70                 :            :     const SfxPoolItem* pState )
      71                 :            : {
      72         [ +  - ]:      10946 :     SvtLanguageOptions aLangOptions;
      73                 :      10946 :     sal_Bool bCalc = sal_False;
      74 [ +  - ][ +  - ]:      10946 :     sal_Bool bVisible = GetToolBox().IsItemVisible(GetId());
                 [ +  - ]
      75                 :      10946 :     sal_Bool bEnabled = sal_False;
      76         [ +  + ]:      10946 :     if ( nSID == SID_VERTICALTEXT_STATE )
      77         [ +  - ]:        639 :         bEnabled = aLangOptions.IsVerticalTextEnabled();
      78         [ +  + ]:      10307 :     else if ( nSID == SID_CTLFONT_STATE )
      79         [ +  - ]:       4834 :         bEnabled = aLangOptions.IsCTLFontEnabled();
      80                 :            :     else
      81                 :            :     {
      82         [ +  - ]:       5473 :         SfxToolBoxControl::StateChanged(nSID, eState, pState);
      83                 :      10946 :         return;
      84                 :            :     }
      85                 :            : 
      86         [ -  + ]:       5473 :     if(bEnabled)
      87                 :            :     {
      88         [ #  # ]:          0 :         if(!bVisible)
      89                 :            :         {
      90 [ #  # ][ #  # ]:          0 :             GetToolBox().ShowItem( GetId(), sal_True );
                 [ #  # ]
      91                 :          0 :             bCalc = sal_True;
      92                 :            :         }
      93                 :            :     }
      94         [ +  + ]:       5473 :     else if(bVisible)
      95                 :            :     {
      96 [ +  - ][ +  - ]:       2409 :         GetToolBox().HideItem( GetId() );
                 [ +  - ]
      97                 :       2409 :         bCalc = sal_True;
      98                 :            :     }
      99         [ +  + ]:       5473 :     if(bCalc)
     100                 :            :     {
     101         [ +  - ]:       2409 :         ToolBox& rTbx = GetToolBox();
     102         [ +  - ]:       2409 :         Window* pParent = rTbx.GetParent();
     103         [ +  - ]:       2409 :         WindowType nWinType = pParent->GetType();
     104         [ -  + ]:       2409 :         if(WINDOW_FLOATINGWINDOW == nWinType)
     105                 :            :         {
     106         [ #  # ]:          0 :             Size aSize(rTbx.CalcWindowSizePixel());
     107         [ #  # ]:          0 :             rTbx.SetPosSizePixel( Point(), aSize );
     108         [ #  # ]:       5473 :             pParent->SetOutputSizePixel( aSize );
     109                 :            :         }
     110 [ +  - ][ +  + ]:      10946 :     }
     111                 :            : }
     112                 :            : 
     113                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10