LCOV - code coverage report
Current view: top level - libreoffice/chart2/source/controller/dialogs - tp_TitleRotation.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 37 2.7 %
Date: 2012-12-27 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             : //.............................................................................
      33             : namespace chart
      34             : {
      35             : //.............................................................................
      36             : 
      37           0 : SchAlignmentTabPage::SchAlignmentTabPage(Window* pWindow,
      38             :                                          const SfxItemSet& rInAttrs, bool bWithRotation) :
      39             :     SfxTabPage(pWindow, SchResId(TP_ALIGNMENT), rInAttrs),
      40             :     aFlAlign        ( this, SchResId( FL_ALIGN ) ),
      41             :     aCtrlDial       ( this, SchResId( CTR_DIAL ) ),
      42             :     aFtRotate       ( this, SchResId( FT_DEGREES ) ),
      43             :     aNfRotate       ( this, SchResId( NF_ORIENT ) ),
      44             :     aCbStacked      ( this, SchResId( BTN_TXTSTACKED ) ),
      45             :     aOrientHlp      ( aCtrlDial, aNfRotate, aCbStacked ),
      46             :     aFtTextDirection( this, SchResId( FT_TEXTDIR ) ),
      47           0 :     aLbTextDirection( this, SchResId( LB_TEXTDIR ), &aFtTextDirection )
      48             : {
      49           0 :     FreeResource();
      50             : 
      51           0 :     aCbStacked.EnableTriState( sal_False );
      52           0 :     aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
      53             : 
      54           0 :     if( !bWithRotation )
      55             :     {
      56           0 :         aOrientHlp.Hide();
      57           0 :         Point aMove( 0, aCtrlDial.GetPosPixel().Y() - aFtTextDirection.GetPosPixel().Y() );
      58           0 :         aFtTextDirection.SetPosPixel( aFtTextDirection.GetPosPixel() + aMove );
      59           0 :         aLbTextDirection.SetPosPixel( aLbTextDirection.GetPosPixel() + aMove );
      60             : 
      61           0 :         aLbTextDirection.SetHelpId( HID_SCH_TEXTDIRECTION_EQUATION );
      62             :     }
      63           0 : }
      64             : 
      65           0 : SchAlignmentTabPage::~SchAlignmentTabPage()
      66             : {
      67           0 : }
      68             : 
      69           0 : SfxTabPage* SchAlignmentTabPage::Create(Window* pParent,
      70             :                                         const SfxItemSet& rInAttrs)
      71             : {
      72           0 :     return new SchAlignmentTabPage(pParent, rInAttrs);
      73             : }
      74             : 
      75           0 : SfxTabPage* SchAlignmentTabPage::CreateWithoutRotation(Window* pParent,
      76             :                                         const SfxItemSet& rInAttrs)
      77             : {
      78           0 :     return new SchAlignmentTabPage(pParent, rInAttrs, false);
      79             : }
      80             : 
      81           0 : sal_Bool SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs)
      82             : {
      83             :     //Since 04/1998 text can be rotated by an arbitrary angle: SCHATTR_TEXT_DEGREES
      84           0 :     bool bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
      85           0 :     rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
      86             : 
      87           0 :     sal_Int32 nDegrees = bStacked ? 0 : aCtrlDial.GetRotation();
      88           0 :     rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
      89             : 
      90           0 :     SvxFrameDirection aDirection( aLbTextDirection.GetSelectEntryValue() );
      91           0 :     rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, aDirection ) );
      92             : 
      93           0 :     return sal_True;
      94             : }
      95             : 
      96           0 : void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs)
      97             : {
      98           0 :     const SfxPoolItem* pItem = GetItem( rInAttrs, SCHATTR_TEXT_DEGREES );
      99             : 
     100           0 :     sal_Int32 nDegrees = pItem ? ((const SfxInt32Item*)pItem)->GetValue() : 0;
     101           0 :     aCtrlDial.SetRotation( nDegrees );
     102             : 
     103           0 :     pItem = GetItem( rInAttrs, SCHATTR_TEXT_STACKED );
     104           0 :     bool bStacked = pItem && ((const SfxBoolItem*)pItem)->GetValue();
     105           0 :     aOrientHlp.SetStackedState( bStacked ? STATE_CHECK : STATE_NOCHECK );
     106             : 
     107             : 
     108           0 :     if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pItem) == SFX_ITEM_SET)
     109           0 :         aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pItem)->GetValue()) );
     110           0 : }
     111             : 
     112             : //.............................................................................
     113           3 : } //namespace chart
     114             : //.............................................................................
     115             : 
     116             : 
     117             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10