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

Generated by: LCOV version 1.10