LCOV - code coverage report
Current view: top level - svx/source/tbxctrls - verttexttbxctrl.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 39 0.0 %
Date: 2014-04-14 Functions: 0 10 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             : 
      21             : #include <svx/dialmgr.hxx>
      22             : #include <svx/dialogs.hrc>
      23             : #include <svx/verttexttbxctrl.hxx>
      24             : #include <svl/languageoptions.hxx>
      25             : #include <sfx2/app.hxx>
      26             : #include <svl/eitem.hxx>
      27             : #include <vcl/toolbox.hxx>
      28             : #include <rtl/ustring.hxx>
      29             : 
      30           0 : SFX_IMPL_TOOLBOX_CONTROL(SvxCTLTextTbxCtrl, SfxBoolItem);
      31           0 : SFX_IMPL_TOOLBOX_CONTROL(SvxVertTextTbxCtrl, SfxBoolItem);
      32             : 
      33           0 : SvxCTLTextTbxCtrl::SvxCTLTextTbxCtrl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
      34           0 :     SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
      35             : {
      36           0 :     SetVert(false);
      37           0 :     addStatusListener( OUString( ".uno:CTLFontState" ));
      38           0 : }
      39             : 
      40           0 : SvxVertTextTbxCtrl::SvxVertTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
      41           0 :     SvxVertCTLTextTbxCtrl( nSlotId, nId, rTbx )
      42             : {
      43           0 :     SetVert(true);
      44           0 :     addStatusListener( OUString( ".uno:VerticalTextState" ));
      45           0 : }
      46             : 
      47             : /* ---------------------------------------------------------------------------*/
      48           0 : SvxVertCTLTextTbxCtrl::SvxVertCTLTextTbxCtrl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
      49             :     SfxToolBoxControl( nSlotId, nId, rTbx ),
      50           0 :     bCheckVertical(true)
      51             : {
      52           0 : }
      53             : 
      54           0 : SvxVertCTLTextTbxCtrl::~SvxVertCTLTextTbxCtrl( )
      55             : {
      56           0 : }
      57             : 
      58           0 : void SvxVertCTLTextTbxCtrl::StateChanged(
      59             :     sal_uInt16 nSID,
      60             :     SfxItemState eState,
      61             :     const SfxPoolItem* pState )
      62             : {
      63           0 :     SvtLanguageOptions aLangOptions;
      64           0 :     bool bCalc = false;
      65           0 :     sal_Bool bEnabled = sal_False;
      66           0 :     if ( nSID == SID_VERTICALTEXT_STATE )
      67           0 :         bEnabled = aLangOptions.IsVerticalTextEnabled();
      68           0 :     else if ( nSID == SID_CTLFONT_STATE )
      69           0 :         bEnabled = aLangOptions.IsCTLFontEnabled();
      70             :     else
      71             :     {
      72           0 :         SfxToolBoxControl::StateChanged(nSID, eState, pState);
      73           0 :         return;
      74             :     }
      75             : 
      76           0 :     if(!bEnabled)
      77             :     {
      78             :         // always hide if either IsVerticalTextEnabled or IsCTLFontEnabled
      79             :         // is false
      80           0 :         GetToolBox().HideItem( GetId() );
      81           0 :         bCalc = true;
      82             :     }
      83           0 :     if(bCalc)
      84             :     {
      85           0 :         ToolBox& rTbx = GetToolBox();
      86           0 :         Window* pParent = rTbx.GetParent();
      87           0 :         WindowType nWinType = pParent->GetType();
      88           0 :         if(WINDOW_FLOATINGWINDOW == nWinType)
      89             :         {
      90           0 :             Size aSize(rTbx.CalcWindowSizePixel());
      91           0 :             rTbx.SetPosSizePixel( Point(), aSize );
      92           0 :             pParent->SetOutputSizePixel( aSize );
      93             :         }
      94           0 :     }
      95             : }
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10