1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_chart2.hxx"
26 #include "tp_LegendPosition.hxx"
27 #include "ResId.hxx"
28 #include "TabPages.hrc"
29 #include "res_LegendPosition.hxx"
30 #include "chartview/ChartSfxItemIds.hxx"
31 #include "NoWarningThisInCTOR.hxx"
32 #include <svx/chrtitem.hxx>
33 #include <editeng/eeitem.hxx>
34 #include <editeng/frmdiritem.hxx>
35
36 //.............................................................................
37 namespace chart
38 {
39 //.............................................................................
40
SchLegendPosTabPage(Window * pWindow,const SfxItemSet & rInAttrs)41 SchLegendPosTabPage::SchLegendPosTabPage(Window* pWindow,
42 const SfxItemSet& rInAttrs)
43 : SfxTabPage( pWindow, SchResId(TP_LEGEND_POS), rInAttrs )
44 , aGrpLegend( this, SchResId(GRP_LEGEND) )
45 , m_apLegendPositionResources( new LegendPositionResources(this) )
46 , m_aFlTextOrient( this, SchResId( FL_LEGEND_TEXTORIENT ) )
47 , m_aFtTextDirection( this, SchResId( FT_LEGEND_TEXTDIR ) )
48 , m_aLbTextDirection( this, SchResId( LB_LEGEND_TEXTDIR ), &m_aFlTextOrient, &m_aFtTextDirection )
49 {
50 m_apLegendPositionResources->SetAccessibleRelationMemberOf(&aGrpLegend);
51 FreeResource();
52 }
53
~SchLegendPosTabPage()54 SchLegendPosTabPage::~SchLegendPosTabPage()
55 {
56 }
57
Create(Window * pWindow,const SfxItemSet & rOutAttrs)58 SfxTabPage* SchLegendPosTabPage::Create(Window* pWindow,
59 const SfxItemSet& rOutAttrs)
60 {
61 return new SchLegendPosTabPage(pWindow, rOutAttrs);
62 }
63
FillItemSet(SfxItemSet & rOutAttrs)64 sal_Bool SchLegendPosTabPage::FillItemSet(SfxItemSet& rOutAttrs)
65 {
66 m_apLegendPositionResources->writeToItemSet(rOutAttrs);
67
68 if( m_aLbTextDirection.GetSelectEntryCount() > 0 )
69 rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLbTextDirection.GetSelectEntryValue() ) );
70
71 return sal_True;
72 }
73
Reset(const SfxItemSet & rInAttrs)74 void SchLegendPosTabPage::Reset(const SfxItemSet& rInAttrs)
75 {
76 m_apLegendPositionResources->initFromItemSet(rInAttrs);
77
78 const SfxPoolItem* pPoolItem = 0;
79 if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET )
80 m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
81 }
82
83 //.............................................................................
84 } //namespace chart
85 //.............................................................................
86