LCOV - code coverage report
Current view: top level - chart2/source/controller/dialogs - tp_TitleRotation.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 55 1.8 %
Date: 2015-06-13 12:38:46 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             : 
      20             : #include "tp_TitleRotation.hxx"
      21             : 
      22             : #include "ResId.hxx"
      23             : #include "ResourceIds.hrc"
      24             : #include "chartview/ChartSfxItemIds.hxx"
      25             : #include "HelpIds.hrc"
      26             : 
      27             : #include <editeng/eeitem.hxx>
      28             : #include <editeng/frmdiritem.hxx>
      29             : #include <svl/intitem.hxx>
      30             : 
      31             : namespace chart
      32             : {
      33             : 
      34           0 : SchAlignmentTabPage::SchAlignmentTabPage(vcl::Window* pWindow,
      35             :                                          const SfxItemSet& rInAttrs, bool bWithRotation) :
      36           0 :     SfxTabPage(pWindow, "TitleRotationTabPage","modules/schart/ui/titlerotationtabpage.ui", &rInAttrs)
      37             : {
      38           0 :     get(m_pCtrlDial,"dialCtrl");
      39           0 :     get(m_pFtRotate,"degreeL");
      40           0 :     get(m_pNfRotate,"OrientDegree");
      41           0 :     get(m_pCbStacked,"stackedCB");
      42           0 :     get(m_pFtTextDirection,"textdirL");
      43           0 :     get(m_pLbTextDirection,"textdirLB");
      44           0 :     get(m_pFtABCD,"labelABCD");
      45           0 :     m_pCtrlDial->SetText(m_pFtABCD->GetText());
      46           0 :     m_pOrientHlp = new svx::OrientationHelper(*m_pCtrlDial, *m_pNfRotate, *m_pCbStacked);
      47             : 
      48           0 :     m_pCbStacked->EnableTriState( false );
      49           0 :     m_pOrientHlp->Enable( true );
      50           0 :     m_pOrientHlp->AddDependentWindow( *m_pFtRotate, TRISTATE_TRUE );
      51             : 
      52           0 :     if( !bWithRotation )
      53             :     {
      54           0 :         m_pOrientHlp->Hide();
      55             :     }
      56           0 : }
      57             : 
      58           0 : SchAlignmentTabPage::~SchAlignmentTabPage()
      59             : {
      60           0 :     disposeOnce();
      61           0 : }
      62             : 
      63           0 : void SchAlignmentTabPage::dispose()
      64             : {
      65           0 :     delete m_pOrientHlp;
      66           0 :     m_pOrientHlp = NULL;
      67           0 :     m_pCtrlDial.clear();
      68           0 :     m_pFtRotate.clear();
      69           0 :     m_pNfRotate.clear();
      70           0 :     m_pCbStacked.clear();
      71           0 :     m_pFtTextDirection.clear();
      72           0 :     m_pLbTextDirection.clear();
      73           0 :     m_pFtABCD.clear();
      74           0 :     SfxTabPage::dispose();
      75           0 : }
      76             : 
      77           0 : VclPtr<SfxTabPage> SchAlignmentTabPage::Create(vcl::Window* pParent,
      78             :                                                const SfxItemSet* rInAttrs)
      79             : {
      80           0 :     return VclPtr<SchAlignmentTabPage>::Create(pParent, *rInAttrs);
      81             : }
      82             : 
      83           0 : VclPtr<SfxTabPage> SchAlignmentTabPage::CreateWithoutRotation(vcl::Window* pParent,
      84             :                                                               const SfxItemSet* rInAttrs)
      85             : {
      86           0 :     return VclPtr<SchAlignmentTabPage>::Create(pParent, *rInAttrs, false);
      87             : }
      88             : 
      89           0 : bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs)
      90             : {
      91             :     //Since 04/1998 text can be rotated by an arbitrary angle: SCHATTR_TEXT_DEGREES
      92           0 :     bool bStacked = m_pOrientHlp->GetStackedState() == TRISTATE_TRUE;
      93           0 :     rOutAttrs->Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
      94             : 
      95           0 :     sal_Int32 nDegrees = bStacked ? 0 : m_pCtrlDial->GetRotation();
      96           0 :     rOutAttrs->Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
      97             : 
      98           0 :     SvxFrameDirection aDirection( m_pLbTextDirection->GetSelectEntryValue() );
      99           0 :     rOutAttrs->Put( SvxFrameDirectionItem( aDirection, EE_PARA_WRITINGDIR ) );
     100             : 
     101           0 :     return true;
     102             : }
     103             : 
     104           0 : void SchAlignmentTabPage::Reset(const SfxItemSet* rInAttrs)
     105             : {
     106           0 :     const SfxPoolItem* pItem = GetItem( *rInAttrs, SCHATTR_TEXT_DEGREES );
     107             : 
     108           0 :     sal_Int32 nDegrees = pItem ? static_cast<const SfxInt32Item*>(pItem)->GetValue() : 0;
     109           0 :     m_pCtrlDial->SetRotation( nDegrees );
     110             : 
     111           0 :     pItem = GetItem( *rInAttrs, SCHATTR_TEXT_STACKED );
     112           0 :     bool bStacked = pItem && static_cast<const SfxBoolItem*>(pItem)->GetValue();
     113           0 :     m_pOrientHlp->SetStackedState( bStacked ? TRISTATE_TRUE : TRISTATE_FALSE );
     114             : 
     115           0 :     if( rInAttrs->GetItemState(EE_PARA_WRITINGDIR, true, &pItem) == SfxItemState::SET)
     116           0 :         m_pLbTextDirection->SelectEntryValue( SvxFrameDirection(static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue()) );
     117           0 : }
     118             : 
     119          57 : } //namespace chart
     120             : 
     121             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11