Update ooo320-m1
[ooovba.git] / chart2 / source / controller / dialogs / tp_TitleRotation.cxx
blob6733d9e08c3acf09cc2b3be00d1592916939fb7d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tp_TitleRotation.cxx,v $
10 * $Revision: 1.11.72.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "tp_TitleRotation.hxx"
35 #include "ResId.hxx"
36 #include "TabPages.hrc"
37 #include "chartview/ChartSfxItemIds.hxx"
38 #include "HelpIds.hrc"
39 #include <svx/eeitem.hxx>
40 #include <svx/frmdiritem.hxx>
42 // header for class SfxInt32Item
43 #include <svtools/intitem.hxx>
45 //.............................................................................
46 namespace chart
48 //.............................................................................
50 SchAlignmentTabPage::SchAlignmentTabPage(Window* pWindow,
51 const SfxItemSet& rInAttrs, bool bWithRotation) :
52 SfxTabPage(pWindow, SchResId(TP_ALIGNMENT), rInAttrs),
53 aFlAlign ( this, SchResId( FL_ALIGN ) ),
54 aCtrlDial ( this, SchResId( CTR_DIAL ) ),
55 aFtRotate ( this, SchResId( FT_DEGREES ) ),
56 aNfRotate ( this, SchResId( NF_ORIENT ) ),
57 aCbStacked ( this, SchResId( BTN_TXTSTACKED ) ),
58 aOrientHlp ( aCtrlDial, aNfRotate, aCbStacked ),
59 aFtTextDirection( this, SchResId( FT_TEXTDIR ) ),
60 aLbTextDirection( this, SchResId( LB_TEXTDIR ), &aFtTextDirection )
62 FreeResource();
64 aCbStacked.EnableTriState( FALSE );
65 aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
67 if( !bWithRotation )
69 aOrientHlp.Hide();
70 Point aMove( 0, aCtrlDial.GetPosPixel().Y() - aFtTextDirection.GetPosPixel().Y() );
71 aFtTextDirection.SetPosPixel( aFtTextDirection.GetPosPixel() + aMove );
72 aLbTextDirection.SetPosPixel( aLbTextDirection.GetPosPixel() + aMove );
74 aLbTextDirection.SetHelpId( HID_SCH_TEXTDIRECTION_EQUATION );
78 SchAlignmentTabPage::~SchAlignmentTabPage()
82 SfxTabPage* SchAlignmentTabPage::Create(Window* pParent,
83 const SfxItemSet& rInAttrs)
85 return new SchAlignmentTabPage(pParent, rInAttrs);
88 SfxTabPage* SchAlignmentTabPage::CreateWithoutRotation(Window* pParent,
89 const SfxItemSet& rInAttrs)
91 return new SchAlignmentTabPage(pParent, rInAttrs, false);
94 BOOL SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs)
96 //Seit 4/1998 koennen Texte frei gedreht werden: SCHATTR_TEXT_DEGREES
97 bool bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
98 rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
100 sal_Int32 nDegrees = bStacked ? 0 : aCtrlDial.GetRotation();
101 rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
103 SvxFrameDirection aDirection( aLbTextDirection.GetSelectEntryValue() );
104 rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, aDirection ) );
106 return TRUE;
109 void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs)
111 const SfxPoolItem* pItem = GetItem( rInAttrs, SCHATTR_TEXT_DEGREES );
113 sal_Int32 nDegrees = pItem ? ((const SfxInt32Item*)pItem)->GetValue() : 0;
114 aCtrlDial.SetRotation( nDegrees );
116 pItem = GetItem( rInAttrs, SCHATTR_TEXT_STACKED );
117 bool bStacked = pItem && ((const SfxBoolItem*)pItem)->GetValue();
118 aOrientHlp.SetStackedState( bStacked ? STATE_CHECK : STATE_NOCHECK );
121 if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, TRUE, &pItem) == SFX_ITEM_SET)
122 aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pItem)->GetValue()) );
125 //.............................................................................
126 } //namespace chart
127 //.............................................................................