Branch data 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_AxisLabel.hxx"
21 : :
22 : : #include "ResId.hxx"
23 : : #include "TabPages.hrc"
24 : : #include "chartview/ChartSfxItemIds.hxx"
25 : : #include "NoWarningThisInCTOR.hxx"
26 : :
27 : : // header for SvxChartTextOrientItem / SvxChartTextOrderItem
28 : : #include <svx/chrtitem.hxx>
29 : :
30 : : // header for SfxInt32Item
31 : : #include <svl/intitem.hxx>
32 : : #include <editeng/eeitem.hxx>
33 : : #include <editeng/frmdiritem.hxx>
34 : :
35 : : //.............................................................................
36 : : namespace chart
37 : : {
38 : : //.............................................................................
39 : :
40 : 0 : SchAxisLabelTabPage::SchAxisLabelTabPage( Window* pParent, const SfxItemSet& rInAttrs ) :
41 : : SfxTabPage( pParent, SchResId( TP_AXIS_LABEL ), rInAttrs ),
42 : :
43 : : aCbShowDescription( this, SchResId( CB_AXIS_LABEL_SCHOW_DESCR ) ),
44 : :
45 : : aFlOrder( this, SchResId( FL_AXIS_LABEL_ORDER ) ),
46 : : aRbSideBySide( this, SchResId( RB_AXIS_LABEL_SIDEBYSIDE ) ),
47 : : aRbUpDown( this, SchResId( RB_AXIS_LABEL_UPDOWN ) ),
48 : : aRbDownUp( this, SchResId( RB_AXIS_LABEL_DOWNUP ) ),
49 : : aRbAuto( this, SchResId( RB_AXIS_LABEL_AUTOORDER ) ),
50 : :
51 : : aFlSeparator( this, SchResId( FL_SEPARATOR ) ),
52 : : aFlTextFlow( this, SchResId( FL_AXIS_LABEL_TEXTFLOW ) ),
53 : : aCbTextOverlap( this, SchResId( CB_AXIS_LABEL_TEXTOVERLAP ) ),
54 : : aCbTextBreak( this, SchResId( CB_AXIS_LABEL_TEXTBREAK ) ),
55 : :
56 : : aFlOrient( this, SchResId( FL_AXIS_LABEL_ORIENTATION ) ),
57 : : aCtrlDial( this, SchResId( CT_AXIS_LABEL_DIAL ) ),
58 : : aFtRotate( this, SchResId( FT_AXIS_LABEL_DEGREES ) ),
59 : : aNfRotate( this, SchResId( NF_AXIS_LABEL_ORIENT ) ),
60 : : aCbStacked( this, SchResId( PB_AXIS_LABEL_TEXTSTACKED ) ),
61 : : aOrientHlp( aCtrlDial, aNfRotate, aCbStacked ),
62 : :
63 : : m_aFtTextDirection( this, SchResId( FT_AXIS_TEXTDIR ) ),
64 : : m_aLbTextDirection( this, SchResId( LB_AXIS_TEXTDIR ), &m_aFtTextDirection ),
65 : :
66 : : m_bShowStaggeringControls( true ),
67 : :
68 : : m_nInitialDegrees( 0 ),
69 : : m_bHasInitialDegrees( true ),
70 : : m_bInitialStacking( false ),
71 : : m_bHasInitialStacking( true ),
72 [ # # ][ # # ]: 0 : m_bComplexCategories( false )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
73 : : {
74 [ # # ]: 0 : FreeResource();
75 : :
76 [ # # ]: 0 : aCbStacked.EnableTriState( sal_False );
77 [ # # ]: 0 : aOrientHlp.AddDependentWindow( aFlOrient );
78 [ # # ]: 0 : aOrientHlp.AddDependentWindow( aFtRotate, STATE_CHECK );
79 : :
80 [ # # ]: 0 : aCbShowDescription.SetClickHdl( LINK( this, SchAxisLabelTabPage, ToggleShowLabel ) );
81 : :
82 : : // Make the fixed line separator vertical.
83 [ # # ][ # # ]: 0 : aFlSeparator.SetStyle (aFlSeparator.GetStyle() | WB_VERT);
84 : :
85 : 0 : Construct();
86 : 0 : }
87 : :
88 [ # # ][ # # ]: 0 : SchAxisLabelTabPage::~SchAxisLabelTabPage()
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
89 [ # # ]: 0 : {}
90 : :
91 : 0 : void SchAxisLabelTabPage::Construct()
92 : : {
93 : 0 : }
94 : :
95 : :
96 : 0 : SfxTabPage* SchAxisLabelTabPage::Create( Window* pParent, const SfxItemSet& rAttrs )
97 : : {
98 [ # # ]: 0 : return new SchAxisLabelTabPage( pParent, rAttrs );
99 : : }
100 : :
101 : 0 : sal_Bool SchAxisLabelTabPage::FillItemSet( SfxItemSet& rOutAttrs )
102 : : {
103 : 0 : bool bStacked = false;
104 [ # # ]: 0 : if( aOrientHlp.GetStackedState() != STATE_DONTKNOW )
105 : : {
106 : 0 : bStacked = aOrientHlp.GetStackedState() == STATE_CHECK;
107 [ # # ][ # # ]: 0 : if( !m_bHasInitialStacking || (bStacked != m_bInitialStacking) )
108 [ # # ]: 0 : rOutAttrs.Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
109 : : }
110 : :
111 [ # # ]: 0 : if( aCtrlDial.HasRotation() )
112 : : {
113 [ # # ]: 0 : sal_Int32 nDegrees = bStacked ? 0 : aCtrlDial.GetRotation();
114 [ # # ][ # # ]: 0 : if( !m_bHasInitialDegrees || (nDegrees != m_nInitialDegrees) )
115 [ # # ]: 0 : rOutAttrs.Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) );
116 : : }
117 : :
118 [ # # ]: 0 : if( m_bShowStaggeringControls )
119 : : {
120 : 0 : SvxChartTextOrder eOrder = CHTXTORDER_SIDEBYSIDE;
121 : 0 : bool bRadioButtonChecked = true;
122 : :
123 [ # # ]: 0 : if( aRbUpDown.IsChecked())
124 : 0 : eOrder = CHTXTORDER_UPDOWN;
125 [ # # ]: 0 : else if( aRbDownUp.IsChecked())
126 : 0 : eOrder = CHTXTORDER_DOWNUP;
127 [ # # ]: 0 : else if( aRbAuto.IsChecked())
128 : 0 : eOrder = CHTXTORDER_AUTO;
129 [ # # ]: 0 : else if( aRbSideBySide.IsChecked())
130 : 0 : eOrder = CHTXTORDER_SIDEBYSIDE;
131 : : else
132 : 0 : bRadioButtonChecked = false;
133 : :
134 [ # # ]: 0 : if( bRadioButtonChecked )
135 [ # # ]: 0 : rOutAttrs.Put( SvxChartTextOrderItem( eOrder, SCHATTR_AXIS_LABEL_ORDER ));
136 : : }
137 : :
138 [ # # ]: 0 : if( aCbTextOverlap.GetState() != STATE_DONTKNOW )
139 [ # # ]: 0 : rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_LABEL_OVERLAP, aCbTextOverlap.IsChecked() ) );
140 [ # # ]: 0 : if( aCbTextBreak.GetState() != STATE_DONTKNOW )
141 [ # # ]: 0 : rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_LABEL_BREAK, aCbTextBreak.IsChecked() ) );
142 [ # # ]: 0 : if( aCbShowDescription.GetState() != STATE_DONTKNOW )
143 [ # # ]: 0 : rOutAttrs.Put( SfxBoolItem( SCHATTR_AXIS_SHOWDESCR, aCbShowDescription.IsChecked() ) );
144 : :
145 [ # # ]: 0 : if( m_aLbTextDirection.GetSelectEntryCount() > 0 )
146 [ # # ]: 0 : rOutAttrs.Put( SfxInt32Item( EE_PARA_WRITINGDIR, m_aLbTextDirection.GetSelectEntryValue() ) );
147 : :
148 : 0 : return sal_True;
149 : : }
150 : :
151 : 0 : void SchAxisLabelTabPage::Reset( const SfxItemSet& rInAttrs )
152 : : {
153 : 0 : const SfxPoolItem* pPoolItem = NULL;
154 : 0 : SfxItemState aState = SFX_ITEM_UNKNOWN;
155 : :
156 : : // show description ----------
157 [ # # ]: 0 : aState = rInAttrs.GetItemState( SCHATTR_AXIS_SHOWDESCR, sal_False, &pPoolItem );
158 [ # # ]: 0 : if( aState == SFX_ITEM_DONTCARE )
159 : : {
160 [ # # ]: 0 : aCbShowDescription.EnableTriState( sal_True );
161 [ # # ]: 0 : aCbShowDescription.SetState( STATE_DONTKNOW );
162 : : }
163 : : else
164 : : {
165 [ # # ]: 0 : aCbShowDescription.EnableTriState( sal_False );
166 : 0 : sal_Bool bCheck = sal_False;
167 [ # # ]: 0 : if( aState == SFX_ITEM_SET )
168 : 0 : bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
169 [ # # ]: 0 : aCbShowDescription.Check( bCheck );
170 : :
171 [ # # ]: 0 : if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
172 [ # # ]: 0 : aCbShowDescription.Hide();
173 : : }
174 : :
175 : : // Rotation as orient item or in degrees ----------
176 : :
177 : : // check new degree item
178 : 0 : m_nInitialDegrees = 0;
179 [ # # ]: 0 : aState = rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, sal_False, &pPoolItem );
180 [ # # ]: 0 : if( aState == SFX_ITEM_SET )
181 : 0 : m_nInitialDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
182 : :
183 : 0 : m_bHasInitialDegrees = aState != SFX_ITEM_DONTCARE;
184 [ # # ]: 0 : if( m_bHasInitialDegrees )
185 [ # # ]: 0 : aCtrlDial.SetRotation( m_nInitialDegrees );
186 : : else
187 [ # # ]: 0 : aCtrlDial.SetNoRotation();
188 : :
189 : : // check stacked item
190 : 0 : m_bInitialStacking = false;
191 [ # # ]: 0 : aState = rInAttrs.GetItemState( SCHATTR_TEXT_STACKED, sal_False, &pPoolItem );
192 [ # # ]: 0 : if( aState == SFX_ITEM_SET )
193 : 0 : m_bInitialStacking = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
194 : :
195 : 0 : m_bHasInitialStacking = aState != SFX_ITEM_DONTCARE;
196 [ # # ]: 0 : if( m_bHasInitialDegrees )
197 [ # # ][ # # ]: 0 : aOrientHlp.SetStackedState( m_bInitialStacking ? STATE_CHECK : STATE_NOCHECK );
198 : : else
199 [ # # ]: 0 : aOrientHlp.SetStackedState( STATE_DONTKNOW );
200 : :
201 [ # # ][ # # ]: 0 : if( rInAttrs.GetItemState( EE_PARA_WRITINGDIR, sal_True, &pPoolItem ) == SFX_ITEM_SET )
202 [ # # ]: 0 : m_aLbTextDirection.SelectEntryValue( SvxFrameDirection(((const SvxFrameDirectionItem*)pPoolItem)->GetValue()) );
203 : :
204 : : // Text overlap ----------
205 [ # # ]: 0 : aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_OVERLAP, sal_False, &pPoolItem );
206 [ # # ]: 0 : if( aState == SFX_ITEM_DONTCARE )
207 : : {
208 [ # # ]: 0 : aCbTextOverlap.EnableTriState( sal_True );
209 [ # # ]: 0 : aCbTextOverlap.SetState( STATE_DONTKNOW );
210 : : }
211 : : else
212 : : {
213 [ # # ]: 0 : aCbTextOverlap.EnableTriState( sal_False );
214 : 0 : sal_Bool bCheck = sal_False;
215 [ # # ]: 0 : if( aState == SFX_ITEM_SET )
216 : 0 : bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
217 [ # # ]: 0 : aCbTextOverlap.Check( bCheck );
218 : :
219 [ # # ]: 0 : if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
220 [ # # ]: 0 : aCbTextOverlap.Hide();
221 : : }
222 : :
223 : : // text break ----------
224 [ # # ]: 0 : aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_BREAK, sal_False, &pPoolItem );
225 [ # # ]: 0 : if( aState == SFX_ITEM_DONTCARE )
226 : : {
227 [ # # ]: 0 : aCbTextBreak.EnableTriState( sal_True );
228 [ # # ]: 0 : aCbTextBreak.SetState( STATE_DONTKNOW );
229 : : }
230 : : else
231 : : {
232 [ # # ]: 0 : aCbTextBreak.EnableTriState( sal_False );
233 : 0 : sal_Bool bCheck = sal_False;
234 [ # # ]: 0 : if( aState == SFX_ITEM_SET )
235 : 0 : bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue();
236 [ # # ]: 0 : aCbTextBreak.Check( bCheck );
237 : :
238 [ # # ]: 0 : if( ( aState & SFX_ITEM_DEFAULT ) == 0 )
239 : : {
240 [ # # ]: 0 : aCbTextBreak.Hide();
241 [ # # ][ # # ]: 0 : if( ! aCbTextOverlap.IsVisible() )
242 [ # # ]: 0 : aFlTextFlow.Hide();
243 : : }
244 : : }
245 : :
246 : : // text order ----------
247 [ # # ]: 0 : if( m_bShowStaggeringControls )
248 : : {
249 [ # # ]: 0 : aState = rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_ORDER, sal_False, &pPoolItem );
250 [ # # ]: 0 : if( aState == SFX_ITEM_SET )
251 : : {
252 : 0 : SvxChartTextOrder eOrder = static_cast< const SvxChartTextOrderItem * >( pPoolItem )->GetValue();
253 : :
254 [ # # # # : 0 : switch( eOrder )
# ]
255 : : {
256 : : case CHTXTORDER_SIDEBYSIDE:
257 [ # # ]: 0 : aRbSideBySide.Check();
258 : 0 : break;
259 : : case CHTXTORDER_UPDOWN:
260 [ # # ]: 0 : aRbUpDown.Check();
261 : 0 : break;
262 : : case CHTXTORDER_DOWNUP:
263 [ # # ]: 0 : aRbDownUp.Check();
264 : 0 : break;
265 : : case CHTXTORDER_AUTO:
266 [ # # ]: 0 : aRbAuto.Check();
267 : 0 : break;
268 : : }
269 : : }
270 : : }
271 : :
272 [ # # ]: 0 : ToggleShowLabel( (void*)0 );
273 : 0 : }
274 : :
275 : 0 : void SchAxisLabelTabPage::ShowStaggeringControls( sal_Bool bShowStaggeringControls )
276 : : {
277 : 0 : m_bShowStaggeringControls = bShowStaggeringControls;
278 : :
279 [ # # ]: 0 : if( !m_bShowStaggeringControls )
280 : : {
281 : 0 : aRbSideBySide.Hide();
282 : 0 : aRbUpDown.Hide();
283 : 0 : aRbDownUp.Hide();
284 : 0 : aRbAuto.Hide();
285 : 0 : aFlOrder.Hide();
286 : : }
287 : 0 : }
288 : :
289 : 0 : void SchAxisLabelTabPage::SetComplexCategories( bool bComplexCategories )
290 : : {
291 : 0 : m_bComplexCategories = bComplexCategories;
292 : 0 : }
293 : :
294 : : // event handling routines
295 : : // -----------------------
296 : :
297 : 0 : IMPL_LINK_NOARG(SchAxisLabelTabPage, ToggleShowLabel)
298 : : {
299 : 0 : sal_Bool bEnable = ( aCbShowDescription.GetState() != STATE_NOCHECK );
300 : :
301 : 0 : aOrientHlp.Enable( bEnable );
302 : 0 : aFlOrder.Enable( bEnable );
303 : 0 : aRbSideBySide.Enable( bEnable );
304 : 0 : aRbUpDown.Enable( bEnable );
305 : 0 : aRbDownUp.Enable( bEnable );
306 : 0 : aRbAuto.Enable( bEnable );
307 : :
308 : 0 : aFlTextFlow.Enable( bEnable );
309 [ # # ][ # # ]: 0 : aCbTextOverlap.Enable( bEnable && !m_bComplexCategories );
310 : 0 : aCbTextBreak.Enable( bEnable );
311 : :
312 : 0 : m_aFtTextDirection.Enable( bEnable );
313 : 0 : m_aLbTextDirection.Enable( bEnable );
314 : :
315 : 0 : return 0L;
316 : : }
317 : : //.............................................................................
318 : : } //namespace chart
319 : : //.............................................................................
320 : :
321 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|