1*cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*cde9e8dcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*cde9e8dcSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*cde9e8dcSAndrew Rist * distributed with this work for additional information
6*cde9e8dcSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*cde9e8dcSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*cde9e8dcSAndrew Rist * "License"); you may not use this file except in compliance
9*cde9e8dcSAndrew Rist * with the License. You may obtain a copy of the License at
10*cde9e8dcSAndrew Rist *
11*cde9e8dcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*cde9e8dcSAndrew Rist *
13*cde9e8dcSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*cde9e8dcSAndrew Rist * software distributed under the License is distributed on an
15*cde9e8dcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*cde9e8dcSAndrew Rist * KIND, either express or implied. See the License for the
17*cde9e8dcSAndrew Rist * specific language governing permissions and limitations
18*cde9e8dcSAndrew Rist * under the License.
19*cde9e8dcSAndrew Rist *
20*cde9e8dcSAndrew Rist *************************************************************/
21*cde9e8dcSAndrew Rist
22*cde9e8dcSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir #include "tp_TitleRotation.hxx"
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include "ResId.hxx"
29cdf0e10cSrcweir #include "TabPages.hrc"
30cdf0e10cSrcweir #include "chartview/ChartSfxItemIds.hxx"
31cdf0e10cSrcweir #include "HelpIds.hrc"
32cdf0e10cSrcweir #include <editeng/eeitem.hxx>
33cdf0e10cSrcweir #include <editeng/frmdiritem.hxx>
34cdf0e10cSrcweir
35cdf0e10cSrcweir // header for class SfxInt32Item
36cdf0e10cSrcweir #include <svl/intitem.hxx>
37cdf0e10cSrcweir
38cdf0e10cSrcweir //.............................................................................
39cdf0e10cSrcweir namespace chart
40cdf0e10cSrcweir {
41cdf0e10cSrcweir //.............................................................................
42cdf0e10cSrcweir
SchAlignmentTabPage(Window * pWindow,const SfxItemSet & rInAttrs,bool bWithRotation)43cdf0e10cSrcweir SchAlignmentTabPage::SchAlignmentTabPage(Window* pWindow,
44cdf0e10cSrcweir const SfxItemSet& rInAttrs, bool bWithRotation) :
45cdf0e10cSrcweir SfxTabPage(pWindow, SchResId(TP_ALIGNMENT), rInAttrs),
46cdf0e10cSrcweir aFlAlign ( this, SchResId( FL_ALIGN ) ),
47cdf0e10cSrcweir aCtrlDial ( this, SchResId( CTR_DIAL ) ),
48cdf0e10cSrcweir aFtRotate ( this, SchResId( FT_DEGREES ) ),
49cdf0e10cSrcweir aNfRotate ( this, SchResId( NF_ORIENT ) ),
50cdf0e10cSrcweir aCbStacked ( this, SchResId( BTN_TXTSTACKED ) ),
51cdf0e10cSrcweir aOrientHlp ( aCtrlDial, aNfRotate, aCbStacked ),
52cdf0e10cSrcweir aFtTextDirection( this, SchResId( FT_TEXTDIR ) ),
53cdf0e10cSrcweir aLbTextDirection( this, SchResId( LB_TEXTDIR ), &aFtTextDirection )
54cdf0e10cSrcweir {
55cdf0e10cSrcweir FreeResource();
56cdf0e10cSrcweir
57cdf0e10cSrcweir aCbStacked.EnableTriState( sal_False );
58cdf0e10cSrcweir aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
59cdf0e10cSrcweir
60cdf0e10cSrcweir if( !bWithRotation )
61cdf0e10cSrcweir {
62cdf0e10cSrcweir aOrientHlp.Hide();
63cdf0e10cSrcweir Point aMove( 0, aCtrlDial.GetPosPixel().Y() - aFtTextDirection.GetPosPixel().Y() );
64cdf0e10cSrcweir aFtTextDirection.SetPosPixel( aFtTextDirection.GetPosPixel() + aMove );
65cdf0e10cSrcweir aLbTextDirection.SetPosPixel( aLbTextDirection.GetPosPixel() + aMove );
66cdf0e10cSrcweir
67cdf0e10cSrcweir aLbTextDirection.SetHelpId( HID_SCH_TEXTDIRECTION_EQUATION );
68cdf0e10cSrcweir }
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
~SchAlignmentTabPage()71cdf0e10cSrcweir SchAlignmentTabPage::~SchAlignmentTabPage()
72cdf0e10cSrcweir {
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rInAttrs)75cdf0e10cSrcweir SfxTabPage* SchAlignmentTabPage::Create(Window* pParent,
76cdf0e10cSrcweir const SfxItemSet& rInAttrs)
77cdf0e10cSrcweir {
78cdf0e10cSrcweir return new SchAlignmentTabPage(pParent, rInAttrs);
79cdf0e10cSrcweir }
80cdf0e10cSrcweir
CreateWithoutRotation(Window * pParent,const SfxItemSet & rInAttrs)81cdf0e10cSrcweir SfxTabPage* SchAlignmentTabPage::CreateWithoutRotation(Window* pParent,
82cdf0e10cSrcweir const SfxItemSet& rInAttrs)
83cdf0e10cSrcweir {
84cdf0e10cSrcweir return new SchAlignmentTabPage(pParent, rInAttrs, false);
85cdf0e10cSrcweir }
86cdf0e10cSrcweir
FillItemSet(SfxItemSet & rOutAttrs)87cdf0e10cSrcweir sal_Bool SchAlignmentTabPage::FillItemSet(SfxItemSet& rOutAttrs)
88cdf0e10cSrcweir {
89cdf0e10cSrcweir //Seit 4/1998 koennen Texte frei gedreht werden: SCHATTR_TEXT_DEGREES
90cdf0e10cSrcweir bool bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
91cdf0e10cSrcweir rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
92cdf0e10cSrcweir
93cdf0e10cSrcweir sal_Int32 nDegrees = bStacked ? 0 : aCtrlDial.GetRotation();
94cdf0e10cSrcweir rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
95cdf0e10cSrcweir
96cdf0e10cSrcweir SvxFrameDirection aDirection( aLbTextDirection.GetSelectEntryValue() );
97cdf0e10cSrcweir rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, aDirection ) );
98cdf0e10cSrcweir
99cdf0e10cSrcweir return sal_True;
100cdf0e10cSrcweir }
101cdf0e10cSrcweir
Reset(const SfxItemSet & rInAttrs)102cdf0e10cSrcweir void SchAlignmentTabPage::Reset(const SfxItemSet& rInAttrs)
103cdf0e10cSrcweir {
104cdf0e10cSrcweir const SfxPoolItem* pItem = GetItem( rInAttrs, SCHATTR_TEXT_DEGREES );
105cdf0e10cSrcweir
106cdf0e10cSrcweir sal_Int32 nDegrees = pItem ? ((const SfxInt32Item*)pItem)->GetValue() : 0;
107cdf0e10cSrcweir aCtrlDial.SetRotation( nDegrees );
108cdf0e10cSrcweir
109cdf0e10cSrcweir pItem = GetItem( rInAttrs, SCHATTR_TEXT_STACKED );
110cdf0e10cSrcweir bool bStacked = pItem && ((const SfxBoolItem*)pItem)->GetValue();
111cdf0e10cSrcweir aOrientHlp.SetStackedState( bStacked ? STATE_CHECK : STATE_NOCHECK );
112cdf0e10cSrcweir
113cdf0e10cSrcweir
114cdf0e10cSrcweir if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pItem) == SFX_ITEM_SET)
115cdf0e10cSrcweir aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pItem)->GetValue()) );
116cdf0e10cSrcweir }
117cdf0e10cSrcweir
118cdf0e10cSrcweir //.............................................................................
119cdf0e10cSrcweir } //namespace chart
120cdf0e10cSrcweir //.............................................................................
121cdf0e10cSrcweir
122cdf0e10cSrcweir
123