1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 
31 #include "res_DataLabel.hxx"
32 #include "res_DataLabel_IDs.hrc"
33 
34 #include "Strings.hrc"
35 #include "ResId.hxx"
36 #include "chartview/ChartSfxItemIds.hxx"
37 #include "NoWarningThisInCTOR.hxx"
38 #include "dlg_NumberFormat.hxx"
39 
40 // header for class SvxNumberInfoItem
41 #include <svx/numinf.hxx>
42 #include <svl/eitem.hxx>
43 // for SfxUInt32Item
44 #include <svl/intitem.hxx>
45 // header for class SfxStringItem
46 #include <svl/stritem.hxx>
47 //SfxIntegerListItem
48 #include <svl/ilstitem.hxx>
49 #include <editeng/eeitem.hxx>
50 #include <editeng/frmdiritem.hxx>
51 
52 // header for define RET_OK
53 #include <vcl/msgbox.hxx>
54 #include <svx/svxids.hrc>
55 // header for SvNumberFormatter
56 #include <svl/zforlist.hxx>
57 #include <svtools/controldims.hrc>
58 
59 
60 //.............................................................................
61 namespace chart
62 {
63 //.............................................................................
64 
65 namespace
66 {
67 
68 bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, sal_uInt16 nValueWhich, sal_uInt16 nSourceFormatWhich, sal_uLong& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut )
69 {
70     bool bSet = false;
71     const SfxPoolItem *pItem1 = NULL;
72     if( rSet.GetItemState( nValueWhich, sal_True, &pItem1 ) == SFX_ITEM_SET )
73     {
74         const SfxUInt32Item * pNumItem = dynamic_cast< const SfxUInt32Item * >( pItem1 );
75         if( pNumItem )
76         {
77             rnFormatKeyOut = pNumItem->GetValue();
78             bSet = true;
79         }
80     }
81 
82     rbSourceFormatMixedStateOut=true;
83     const SfxPoolItem *pItem2 = NULL;
84     if( rSet.GetItemState( nSourceFormatWhich, sal_True, &pItem2 ) == SFX_ITEM_SET )
85     {
86         const SfxBoolItem * pBoolItem = dynamic_cast< const SfxBoolItem * >( pItem2 );
87         if( pBoolItem )
88         {
89             rbSourceFormatOut = pBoolItem->GetValue();
90             rbSourceFormatMixedStateOut=false;
91         }
92     }
93     return bSet;
94 }
95 
96 void lcl_setBoolItemToCheckBox( const SfxItemSet& rInAttrs, sal_uInt16 nWhichId, CheckBox& rCheckbox )
97 {
98     rCheckbox.EnableTriState( sal_False );
99 
100     const SfxPoolItem *pPoolItem = NULL;
101     if( rInAttrs.GetItemState(nWhichId, sal_True, &pPoolItem) == SFX_ITEM_SET )
102         rCheckbox.Check( ((const SfxBoolItem*)pPoolItem)->GetValue() );
103     else
104     {
105         rCheckbox.EnableTriState( sal_True );
106         rCheckbox.SetState( STATE_DONTKNOW );
107     }
108 }
109 
110 }//end anonymous namespace
111 
112 DataLabelResources::DataLabelResources( Window* pWindow, const SfxItemSet& rInAttrs )
113     : m_aCBNumber(pWindow, SchResId(CB_VALUE_AS_NUMBER)),
114     m_aPB_NumberFormatForValue(pWindow, SchResId(PB_NUMBERFORMAT)),
115     m_aCBPercent(pWindow, SchResId(CB_VALUE_AS_PERCENTAGE)),
116     m_aPB_NumberFormatForPercent(pWindow, SchResId(PB_PERCENT_NUMBERFORMAT)),
117     m_aCBCategory(pWindow, SchResId(CB_CATEGORY)),
118     m_aCBSymbol(pWindow, SchResId(CB_SYMBOL)),
119     m_aSeparatorResources(pWindow),
120     m_aFT_LabelPlacement(pWindow, SchResId(FT_LABEL_PLACEMENT)),
121     m_aLB_LabelPlacement(pWindow, SchResId(LB_LABEL_PLACEMENT)),
122     m_aFL_Rotate(pWindow, SchResId(FL_LABEL_ROTATE)),
123     m_aDC_Dial(pWindow, SchResId(CT_LABEL_DIAL)),
124     m_aFT_Degrees(pWindow, SchResId(FT_LABEL_DEGREES)),
125     m_aNF_Degrees(pWindow, SchResId(NF_LABEL_DEGREES)),
126     m_aFT_TextDirection(pWindow, SchResId(FT_LABEL_TEXTDIR)),
127     m_aLB_TextDirection(pWindow, SchResId(LB_LABEL_TEXTDIR), &m_aFT_TextDirection),
128     m_pNumberFormatter(0),
129     m_bNumberFormatMixedState(true),
130     m_bPercentFormatMixedState(true),
131     m_nNumberFormatForValue(0),
132     m_nNumberFormatForPercent(11),
133     m_bSourceFormatMixedState(true),
134     m_bPercentSourceMixedState(true),
135     m_bSourceFormatForValue(true),
136     m_bSourceFormatForPercent(true),
137     m_pWindow(pWindow),
138     m_pPool(rInAttrs.GetPool())
139 {
140     //fill label placement list
141     std::map< sal_Int32, XubString > aPlacementToStringMap;
142     for( sal_Int32 nEnum=0; nEnum<m_aLB_LabelPlacement.GetEntryCount(); ++nEnum )
143         aPlacementToStringMap[nEnum]=m_aLB_LabelPlacement.GetEntry(static_cast<sal_uInt16>(nEnum));
144 
145     ::com::sun::star::uno::Sequence < sal_Int32 > aAvailabelPlacementList;
146     const SfxPoolItem *pPoolItem = NULL;
147     if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, sal_True, &pPoolItem) == SFX_ITEM_SET )
148         aAvailabelPlacementList =((const SfxIntegerListItem*)pPoolItem)->GetConstSequence();
149 
150     m_aLB_LabelPlacement.Clear();
151     for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN )
152     {
153         sal_uInt16 nListBoxPos = static_cast<sal_uInt16>( nN );
154         sal_Int32 nPlacement = aAvailabelPlacementList[nN];
155         m_aPlacementToListBoxMap[nPlacement]=nListBoxPos;
156         m_aListBoxToPlacementMap[nListBoxPos]=nPlacement;
157         m_aLB_LabelPlacement.InsertEntry( aPlacementToStringMap[nPlacement] );
158     }
159     m_aLB_LabelPlacement.SetDropDownLineCount(m_aLB_LabelPlacement.GetEntryCount());
160 
161     //replace&resize push buttons and resize checkboxes
162     Size aControlDistance( pWindow->LogicToPixel( Size(RSC_SP_CTRL_DESC_X,RSC_SP_CTRL_GROUP_Y), MapMode(MAP_APPFONT) ) );
163     long nPBWidth = ::std::max( m_aPB_NumberFormatForPercent.CalcMinimumSize().getWidth(), m_aPB_NumberFormatForValue.CalcMinimumSize().getWidth() )
164         + 20; //the min with is to small to fit, hm... so add alittle
165     long nCBXWidth = ::std::max( m_aCBNumber.CalcMinimumSize().getWidth(), m_aCBPercent.CalcMinimumSize().getWidth() );
166     long nNewPBXPos = m_aCBNumber.GetPosPixel().X() + nCBXWidth + aControlDistance.Width();
167     long nPageWidth = pWindow->LogicToPixel( Size(260,185), MapMode(MAP_APPFONT) ).getWidth();
168     if( nNewPBXPos + nPBWidth > nPageWidth )
169     {
170         if( nPBWidth > nPageWidth/2 )
171             nPBWidth = nPageWidth/2;
172         nNewPBXPos = nPageWidth-nPBWidth;
173         nCBXWidth = nPageWidth-m_aCBNumber.GetPosPixel().X()-nPBWidth-aControlDistance.Width();
174     }
175     m_aPB_NumberFormatForValue.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForValue.GetPosPixel().Y() ) );
176     m_aPB_NumberFormatForPercent.SetPosPixel( Point( nNewPBXPos, m_aPB_NumberFormatForPercent.GetPosPixel().Y() ) );
177 
178     Size aPBSize( m_aPB_NumberFormatForPercent.GetSizePixel() );
179     aPBSize.setWidth( nPBWidth );
180     m_aPB_NumberFormatForValue.SetSizePixel( aPBSize );
181     m_aPB_NumberFormatForPercent.SetSizePixel( aPBSize );
182 
183     Size aCBSize( m_aCBNumber.GetSizePixel() );
184     aCBSize.setWidth(nCBXWidth);
185     m_aCBNumber.SetSizePixel( aCBSize );
186     m_aCBPercent.SetSizePixel( aCBSize );
187 
188     //place and align separator and label placement listboxes
189     Size aSize( m_aFT_LabelPlacement.GetSizePixel() );
190     aSize.setWidth( m_aFT_LabelPlacement.CalcMinimumSize().getWidth() );
191     m_aFT_LabelPlacement.SetSizePixel(aSize);
192 
193     long nWantedMinLeftBorder = m_aFT_LabelPlacement.GetPosPixel().X() + aSize.getWidth () + aControlDistance.Width();
194 
195     m_aSeparatorResources.PositionBelowControl(m_aCBSymbol);
196     m_aSeparatorResources.AlignListBoxWidthAndXPos( nWantedMinLeftBorder, -1, m_aLB_LabelPlacement.CalcMinimumSize().getWidth() );
197     m_aSeparatorResources.Show(true);
198 
199     aSize = m_aLB_LabelPlacement.GetSizePixel();
200     aSize.setWidth( m_aSeparatorResources.GetCurrentListBoxSize().getWidth() );
201     m_aLB_LabelPlacement.SetSizePixel(aSize);
202     m_aLB_LabelPlacement.SetPosPixel( Point( m_aSeparatorResources.GetCurrentListBoxPosition().X(), m_aLB_LabelPlacement.GetPosPixel().Y() ) );
203 
204     //some click handler
205     m_aPB_NumberFormatForValue.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
206     m_aPB_NumberFormatForPercent.SetClickHdl( LINK( this, DataLabelResources, NumberFormatDialogHdl ) );
207     m_aCBNumber.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
208     m_aCBPercent.SetClickHdl( LINK( this, DataLabelResources, CheckHdl ));
209     m_aCBCategory.SetClickHdl(  LINK( this, DataLabelResources, CheckHdl ));
210     m_aCBSymbol.SetClickHdl(  LINK( this, DataLabelResources, CheckHdl ));
211 
212     m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
213     m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState);
214 
215     if( rInAttrs.GetItemState(SCHATTR_DATADESCR_NO_PERCENTVALUE, sal_True, &pPoolItem) == SFX_ITEM_SET )
216     {
217         bool bForbidPercentValue = (static_cast< const SfxBoolItem & >( rInAttrs.Get( SCHATTR_DATADESCR_NO_PERCENTVALUE )).GetValue() );
218         if( bForbidPercentValue )
219             m_aCBPercent.Enable(false);
220     }
221 
222     m_aDC_Dial.SetLinkedField( &m_aNF_Degrees );
223 }
224 
225 DataLabelResources::~DataLabelResources()
226 {
227 }
228 
229 void DataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter )
230 {
231     m_pNumberFormatter = pFormatter;
232 }
233 
234 IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, PushButton *, pButton )
235 {
236     if( !m_pPool || !m_pNumberFormatter )
237     {
238         DBG_ERROR("Missing item pool or number formatter");
239         return 1;
240     }
241 
242     if( pButton == &m_aPB_NumberFormatForValue && !m_aCBNumber.IsChecked())
243         m_aCBNumber.Check();
244     else if( pButton == &m_aPB_NumberFormatForPercent && !m_aCBPercent.IsChecked())
245         m_aCBPercent.Check();
246 
247     SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool );
248     aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO));
249 
250     bool bPercent = ( pButton == &m_aPB_NumberFormatForPercent );
251 
252     sal_uLong& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue;
253     bool& rUseSourceFormat = bPercent ? m_bSourceFormatForPercent : m_bSourceFormatForValue;
254     bool& rbMixedState = bPercent ? m_bPercentFormatMixedState : m_bNumberFormatMixedState;
255     bool& rbSourceMixedState = bPercent ? m_bPercentSourceMixedState : m_bSourceFormatMixedState;
256 
257     if(!rbMixedState)
258         aNumberSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, rnFormatKey ));
259     aNumberSet.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, rUseSourceFormat ));
260 
261     NumberFormatDialog aDlg(m_pWindow, aNumberSet);
262     if( bPercent )
263         aDlg.SetText( String( SchResId( STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE ) ) );
264     if( RET_OK == aDlg.Execute() )
265     {
266         const SfxItemSet* pResult = aDlg.GetOutputItemSet();
267         if( pResult )
268         {
269             bool bOldSource = rUseSourceFormat;
270             sal_uLong nOldFormat = rnFormatKey;
271             bool bOldMixedState = rbMixedState || rbSourceMixedState;
272 
273             rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState );
274 
275             //todo this maybe can be removed when the numberformatter dialog does handle mixed state for source format correctly
276             if( bOldMixedState && bOldSource == rUseSourceFormat && nOldFormat == rnFormatKey )
277                 rbMixedState = rbSourceMixedState = true;
278         }
279     }
280     return 0;
281 }
282 
283 IMPL_LINK( DataLabelResources, CheckHdl, CheckBox*, pBox )
284 {
285     if( pBox )
286         pBox->EnableTriState( sal_False );
287     EnableControls();
288     return 0;
289 }
290 
291 void DataLabelResources::EnableControls()
292 {
293     m_aCBSymbol.Enable( m_aCBNumber.IsChecked() || (m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled()) || m_aCBCategory.IsChecked() );
294 
295     //enable separator
296     {
297         long nNumberOfCheckedLabelParts = 0;
298         if( m_aCBNumber.IsChecked() )
299             ++nNumberOfCheckedLabelParts;
300         if( m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() )
301             ++nNumberOfCheckedLabelParts;
302         if( m_aCBCategory.IsChecked() )
303             ++nNumberOfCheckedLabelParts;
304         m_aSeparatorResources.Enable( nNumberOfCheckedLabelParts > 1 );
305         bool bEnableTextDir = nNumberOfCheckedLabelParts > 0;
306         m_aFT_TextDirection.Enable( bEnableTextDir );
307         m_aLB_TextDirection.Enable( bEnableTextDir );
308         bool bEnablePlacement = nNumberOfCheckedLabelParts > 0 && m_aLB_LabelPlacement.GetEntryCount()>1;
309         m_aFT_LabelPlacement.Enable( bEnablePlacement );
310         m_aLB_LabelPlacement.Enable( bEnablePlacement );
311     }
312 
313     m_aPB_NumberFormatForValue.Enable( m_pNumberFormatter && m_aCBNumber.IsChecked() );
314     m_aPB_NumberFormatForPercent.Enable( m_pNumberFormatter && m_aCBPercent.IsChecked() && m_aCBPercent.IsEnabled() );
315 
316     bool bEnableRotation = ( m_aCBNumber.IsChecked() || m_aCBPercent.IsChecked() || m_aCBCategory.IsChecked() );
317     m_aFL_Rotate.Enable( bEnableRotation );
318     m_aDC_Dial.Enable( bEnableRotation );
319     m_aFT_Degrees.Enable( bEnableRotation );
320     m_aNF_Degrees.Enable( bEnableRotation );
321 }
322 
323 sal_Bool DataLabelResources::FillItemSet( SfxItemSet& rOutAttrs ) const
324 {
325     if( m_aCBNumber.IsChecked() )
326     {
327         if( !m_bNumberFormatMixedState )
328             rOutAttrs.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, m_nNumberFormatForValue ));
329         if( !m_bSourceFormatMixedState )
330             rOutAttrs.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, m_bSourceFormatForValue ));
331     }
332     if( m_aCBPercent.IsChecked() )
333     {
334         if( !m_bPercentFormatMixedState )
335             rOutAttrs.Put( SfxUInt32Item( SCHATTR_PERCENT_NUMBERFORMAT_VALUE, m_nNumberFormatForPercent ));
336         if( !m_bPercentSourceMixedState )
337             rOutAttrs.Put( SfxBoolItem( SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_bSourceFormatForPercent ));
338     }
339 
340     if( m_aCBNumber.GetState()!= STATE_DONTKNOW )
341         rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber.IsChecked() ) );
342     if( m_aCBPercent.GetState()!= STATE_DONTKNOW )
343         rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent.IsChecked() ) );
344     if( m_aCBCategory.GetState()!= STATE_DONTKNOW )
345         rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory.IsChecked() ) );
346     if( m_aCBSymbol.GetState()!= STATE_DONTKNOW )
347         rOutAttrs.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol.IsChecked()) );
348 
349     rOutAttrs.Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, m_aSeparatorResources.GetValue() ) );
350     ::std::map< sal_uInt16, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_aLB_LabelPlacement.GetSelectEntryPos()) );
351     if(aIt!=m_aListBoxToPlacementMap.end())
352     {
353         sal_Int32 nValue = aIt->second;
354         rOutAttrs.Put( SfxInt32Item( SCHATTR_DATADESCR_PLACEMENT, nValue ) );
355     }
356 
357     if( m_aLB_TextDirection.GetSelectEntryCount() > 0 )
358         rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLB_TextDirection.GetSelectEntryValue() ) );
359 
360     if( m_aDC_Dial.IsVisible() )
361     {
362         sal_Int32 nDegrees = m_aDC_Dial.GetRotation();
363         rOutAttrs.Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
364     }
365 
366     return sal_True;
367 }
368 
369 void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
370 {
371     // default state
372     m_aCBSymbol.Enable( sal_False );
373 
374     lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, m_aCBNumber );
375     lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_aCBPercent );
376     lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, m_aCBCategory );
377     lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, m_aCBSymbol );
378 
379     m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState );
380     m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent ,  m_bPercentSourceMixedState);
381 
382     const SfxPoolItem *pPoolItem = NULL;
383     if( rInAttrs.GetItemState(SCHATTR_DATADESCR_SEPARATOR, sal_True, &pPoolItem) == SFX_ITEM_SET )
384         m_aSeparatorResources.SetValue( ((const SfxStringItem*)pPoolItem)->GetValue() );
385     else
386         m_aSeparatorResources.SetDefault();
387 
388     if( rInAttrs.GetItemState(SCHATTR_DATADESCR_PLACEMENT, sal_True, &pPoolItem) == SFX_ITEM_SET )
389     {
390         sal_Int32 nPlacement = ((const SfxInt32Item*)pPoolItem)->GetValue();
391         ::std::map< sal_Int32, sal_uInt16 >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) );
392         if(aIt!=m_aPlacementToListBoxMap.end())
393         {
394             sal_uInt16 nPos = aIt->second;
395             m_aLB_LabelPlacement.SelectEntryPos( nPos );
396         }
397         else
398             m_aLB_LabelPlacement.SetNoSelection();
399     }
400     else
401         m_aLB_LabelPlacement.SetNoSelection();
402 
403     if( rInAttrs.GetItemState(EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET )
404         m_aLB_TextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
405 
406     if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, sal_True, &pPoolItem ) == SFX_ITEM_SET )
407     {
408         sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
409         m_aDC_Dial.SetRotation( nDegrees );
410     }
411     else
412     m_aDC_Dial.SetRotation( 0 );
413 
414     EnableControls();
415 }
416 
417 //.............................................................................
418 } //namespace chart
419 //.............................................................................
420