/src/libreoffice/chart2/source/controller/dialogs/res_DataLabel.cxx
Line | Count | Source |
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 <sal/config.h> |
21 | | |
22 | | #include <string_view> |
23 | | |
24 | | #include "res_DataLabel.hxx" |
25 | | |
26 | | #include <TextDirectionListBox.hxx> |
27 | | #include <chartview/ChartSfxItemIds.hxx> |
28 | | #include "dlg_NumberFormat.hxx" |
29 | | |
30 | | #include <svx/numinf.hxx> |
31 | | #include <svl/eitem.hxx> |
32 | | #include <svl/intitem.hxx> |
33 | | #include <svl/stritem.hxx> |
34 | | #include <svl/ilstitem.hxx> |
35 | | #include <editeng/eeitem.hxx> |
36 | | #include <editeng/frmdiritem.hxx> |
37 | | #include <svx/sdangitm.hxx> |
38 | | #include <svx/svxids.hrc> |
39 | | #include <osl/diagnose.h> |
40 | | |
41 | | namespace chart |
42 | | { |
43 | | |
44 | | namespace |
45 | | { |
46 | | |
47 | | const std::u16string_view our_aLBEntryMap[] = {u" ", u", ", u"; ", u"\n", u". "}; |
48 | | |
49 | | bool lcl_ReadNumberFormatFromItemSet( const SfxItemSet& rSet, TypedWhichId<SfxUInt32Item> nValueWhich, TypedWhichId<SfxBoolItem> nSourceFormatWhich, sal_uInt32& rnFormatKeyOut, bool& rbSourceFormatOut, bool& rbSourceFormatMixedStateOut ) |
50 | 0 | { |
51 | 0 | bool bSet = false; |
52 | 0 | if( const SfxUInt32Item* pNumItem = rSet.GetItemIfSet( nValueWhich ) ) |
53 | 0 | { |
54 | 0 | rnFormatKeyOut = pNumItem->GetValue(); |
55 | 0 | bSet = true; |
56 | 0 | } |
57 | |
|
58 | 0 | rbSourceFormatMixedStateOut=true; |
59 | 0 | if( const SfxBoolItem * pBoolItem = rSet.GetItemIfSet( nSourceFormatWhich ) ) |
60 | 0 | { |
61 | 0 | rbSourceFormatOut = pBoolItem->GetValue(); |
62 | 0 | rbSourceFormatMixedStateOut=false; |
63 | 0 | } |
64 | 0 | return bSet; |
65 | 0 | } |
66 | | |
67 | | void lcl_setBoolItemToCheckBox(const SfxItemSet& rInAttrs, TypedWhichId<SfxBoolItem> nWhichId, weld::CheckButton& rCheckbox, weld::TriStateEnabled& rTriState) |
68 | 0 | { |
69 | 0 | if( const SfxBoolItem* pPoolItem = rInAttrs.GetItemIfSet(nWhichId) ) |
70 | 0 | { |
71 | 0 | rCheckbox.set_active(pPoolItem->GetValue()); |
72 | 0 | rTriState.bTriStateEnabled = false; |
73 | 0 | } |
74 | 0 | else |
75 | 0 | { |
76 | 0 | rCheckbox.set_state(TRISTATE_INDET); |
77 | 0 | rTriState.bTriStateEnabled = true; |
78 | 0 | } |
79 | 0 | } |
80 | | |
81 | | }//end anonymous namespace |
82 | | |
83 | | DataLabelResources::DataLabelResources(weld::Builder* pBuilder, weld::Window* pParent, const SfxItemSet& rInAttrs) |
84 | 0 | : m_pNumberFormatter(nullptr) |
85 | 0 | , m_bNumberFormatMixedState(true) |
86 | 0 | , m_bPercentFormatMixedState(true) |
87 | 0 | , m_nNumberFormatForValue(0) |
88 | 0 | , m_nNumberFormatForPercent(11) |
89 | 0 | , m_bSourceFormatMixedState(true) |
90 | 0 | , m_bPercentSourceMixedState(true) |
91 | 0 | , m_bSourceFormatForValue(true) |
92 | 0 | , m_bSourceFormatForPercent(true) |
93 | 0 | , m_pWindow(pParent) |
94 | 0 | , m_pPool(rInAttrs.GetPool()) |
95 | 0 | , m_xCBNumber(pBuilder->weld_check_button(u"CB_VALUE_AS_NUMBER"_ustr)) |
96 | 0 | , m_xPB_NumberFormatForValue(pBuilder->weld_button(u"PB_NUMBERFORMAT"_ustr)) |
97 | 0 | , m_xCBPercent(pBuilder->weld_check_button(u"CB_VALUE_AS_PERCENTAGE"_ustr)) |
98 | 0 | , m_xPB_NumberFormatForPercent(pBuilder->weld_button(u"PB_PERCENT_NUMBERFORMAT"_ustr)) |
99 | 0 | , m_xFT_NumberFormatForPercent(pBuilder->weld_label(u"STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE"_ustr)) |
100 | 0 | , m_xCBCategory(pBuilder->weld_check_button(u"CB_CATEGORY"_ustr)) |
101 | 0 | , m_xCBSymbol(pBuilder->weld_check_button(u"CB_SYMBOL"_ustr)) |
102 | 0 | , m_xCBDataSeries(pBuilder->weld_check_button(u"CB_DATA_SERIES_NAME"_ustr)) |
103 | 0 | , m_xCBWrapText(pBuilder->weld_check_button(u"CB_WRAP_TEXT"_ustr)) |
104 | 0 | , m_xLB_Separator(pBuilder->weld_combo_box(u"LB_TEXT_SEPARATOR"_ustr)) |
105 | 0 | , m_xLB_LabelPlacement(pBuilder->weld_combo_box(u"LB_LABEL_PLACEMENT"_ustr)) |
106 | 0 | , m_xBxOrientation(pBuilder->weld_widget(u"boxORIENTATION"_ustr)) |
107 | 0 | , m_xFT_Dial(pBuilder->weld_label(u"CT_LABEL_DIAL"_ustr)) |
108 | 0 | , m_xNF_Degrees(pBuilder->weld_metric_spin_button(u"NF_LABEL_DEGREES"_ustr, FieldUnit::DEGREE)) |
109 | 0 | , m_xBxTextDirection(pBuilder->weld_widget(u"boxTXT_DIRECTION"_ustr)) |
110 | 0 | , m_aLB_TextDirection(pBuilder->weld_combo_box(u"LB_LABEL_TEXTDIR"_ustr)) |
111 | 0 | , m_xDC_Dial(new svx::DialControl) |
112 | 0 | , m_xDC_DialWin(new weld::CustomWeld(*pBuilder, u"CT_DIAL"_ustr, *m_xDC_Dial)) |
113 | 0 | , m_xCBCustomLeaderLines(pBuilder->weld_check_button(u"CB_CUSTOM_LEADER_LINES"_ustr)) |
114 | 0 | { |
115 | 0 | m_xDC_Dial->SetText(m_xFT_Dial->get_label()); |
116 | | |
117 | | //fill label placement list |
118 | 0 | std::map< sal_Int32, OUString > aPlacementToStringMap; |
119 | 0 | for( sal_Int32 nEnum=0; nEnum<m_xLB_LabelPlacement->get_count(); ++nEnum ) |
120 | 0 | aPlacementToStringMap[nEnum] = m_xLB_LabelPlacement->get_text(static_cast<sal_uInt16>(nEnum)); |
121 | | |
122 | |
|
123 | 0 | std::vector< sal_Int32 > aAvailablePlacementList; |
124 | 0 | if( const SfxIntegerListItem* pPlacementsItem = rInAttrs.GetItemIfSet(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS) ) |
125 | 0 | aAvailablePlacementList = pPlacementsItem->GetList(); |
126 | |
|
127 | 0 | m_xLB_LabelPlacement->clear(); |
128 | 0 | for( size_t nN=0; nN<aAvailablePlacementList.size(); ++nN ) |
129 | 0 | { |
130 | 0 | sal_uInt16 nListBoxPos = static_cast<sal_uInt16>( nN ); |
131 | 0 | sal_Int32 nPlacement = aAvailablePlacementList[nN]; |
132 | 0 | m_aPlacementToListBoxMap[nPlacement]=nListBoxPos; |
133 | 0 | m_aListBoxToPlacementMap[nListBoxPos]=nPlacement; |
134 | 0 | m_xLB_LabelPlacement->append_text( aPlacementToStringMap[nPlacement] ); |
135 | 0 | } |
136 | | |
137 | | //some click handler |
138 | 0 | m_xPB_NumberFormatForValue->connect_clicked( LINK( this, DataLabelResources, NumberFormatDialogHdl ) ); |
139 | 0 | m_xPB_NumberFormatForPercent->connect_clicked( LINK( this, DataLabelResources, NumberFormatDialogHdl ) ); |
140 | 0 | m_xCBNumber->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); |
141 | 0 | m_xCBPercent->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); |
142 | 0 | m_xCBCategory->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); |
143 | 0 | m_xCBSymbol->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); |
144 | 0 | m_xCBDataSeries->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); |
145 | 0 | m_xCBWrapText->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); |
146 | 0 | m_xCBCustomLeaderLines->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); |
147 | |
|
148 | 0 | m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState ); |
149 | 0 | m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState); |
150 | |
|
151 | 0 | if( const SfxBoolItem* pNoPercentValueItem = rInAttrs.GetItemIfSet(SCHATTR_DATADESCR_NO_PERCENTVALUE) ) |
152 | 0 | { |
153 | 0 | bool bForbidPercentValue = pNoPercentValueItem->GetValue(); |
154 | 0 | if( bForbidPercentValue ) |
155 | 0 | m_xCBPercent->set_sensitive(false); |
156 | 0 | } |
157 | |
|
158 | 0 | m_xDC_Dial->SetLinkedField(m_xNF_Degrees.get()); |
159 | 0 | } |
160 | | |
161 | | DataLabelResources::~DataLabelResources() |
162 | 0 | { |
163 | 0 | } |
164 | | |
165 | | void DataLabelResources::SetNumberFormatter( SvNumberFormatter* pFormatter ) |
166 | 0 | { |
167 | 0 | m_pNumberFormatter = pFormatter; |
168 | 0 | } |
169 | | |
170 | | IMPL_LINK(DataLabelResources, NumberFormatDialogHdl, weld::Button&, rButton, void) |
171 | 0 | { |
172 | 0 | if( !m_pPool || !m_pNumberFormatter ) |
173 | 0 | { |
174 | 0 | OSL_FAIL("Missing item pool or number formatter"); |
175 | 0 | return; |
176 | 0 | } |
177 | | |
178 | 0 | if (&rButton == m_xPB_NumberFormatForValue.get() && !m_xCBNumber->get_active()) |
179 | 0 | { |
180 | 0 | m_xCBNumber->set_active(true); |
181 | 0 | m_aNumberState.bTriStateEnabled = false; |
182 | 0 | } |
183 | 0 | else if (&rButton == m_xPB_NumberFormatForPercent.get() && !m_xCBPercent->get_active()) |
184 | 0 | { |
185 | 0 | m_xCBPercent->set_active(true); |
186 | 0 | m_aPercentState.bTriStateEnabled = false; |
187 | 0 | } |
188 | |
|
189 | 0 | SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool ); |
190 | 0 | aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, SID_ATTR_NUMBERFORMAT_INFO)); |
191 | |
|
192 | 0 | bool bPercent = (&rButton == m_xPB_NumberFormatForPercent.get()); |
193 | |
|
194 | 0 | sal_uInt32& rnFormatKey = bPercent ? m_nNumberFormatForPercent : m_nNumberFormatForValue; |
195 | 0 | bool& rUseSourceFormat = bPercent ? m_bSourceFormatForPercent : m_bSourceFormatForValue; |
196 | 0 | bool& rbMixedState = bPercent ? m_bPercentFormatMixedState : m_bNumberFormatMixedState; |
197 | 0 | bool& rbSourceMixedState = bPercent ? m_bPercentSourceMixedState : m_bSourceFormatMixedState; |
198 | |
|
199 | 0 | if(!rbMixedState) |
200 | 0 | aNumberSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, rnFormatKey )); |
201 | 0 | aNumberSet.Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, rUseSourceFormat )); |
202 | |
|
203 | 0 | NumberFormatDialog aDlg(m_pWindow, aNumberSet); |
204 | 0 | if( bPercent ) |
205 | 0 | aDlg.set_title(m_xFT_NumberFormatForPercent->get_label()); |
206 | 0 | if (aDlg.run() != RET_OK) |
207 | 0 | return; |
208 | | |
209 | 0 | const SfxItemSet* pResult = aDlg.GetOutputItemSet(); |
210 | 0 | if( pResult ) |
211 | 0 | { |
212 | 0 | bool bOldSource = rUseSourceFormat; |
213 | 0 | sal_uInt32 nOldFormat = rnFormatKey; |
214 | 0 | bool bOldMixedState = rbMixedState || rbSourceMixedState; |
215 | |
|
216 | 0 | rbMixedState = !lcl_ReadNumberFormatFromItemSet( *pResult, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, rnFormatKey, rUseSourceFormat, rbSourceMixedState ); |
217 | | |
218 | | //todo this maybe can be removed when the numberformatter dialog does handle mixed state for source format correctly |
219 | 0 | if( bOldMixedState && bOldSource == rUseSourceFormat && nOldFormat == rnFormatKey ) |
220 | 0 | rbMixedState = rbSourceMixedState = true; |
221 | 0 | } |
222 | 0 | } |
223 | | |
224 | | IMPL_LINK(DataLabelResources, CheckHdl, weld::Toggleable&, rToggle, void) |
225 | 0 | { |
226 | 0 | if (&rToggle == m_xCBNumber.get()) |
227 | 0 | m_aNumberState.CheckButtonToggled(*m_xCBNumber); |
228 | 0 | else if (&rToggle == m_xCBPercent.get()) |
229 | 0 | m_aPercentState.CheckButtonToggled(*m_xCBPercent); |
230 | 0 | else if (&rToggle == m_xCBCategory.get()) |
231 | 0 | m_aCategoryState.CheckButtonToggled(*m_xCBCategory); |
232 | 0 | else if (&rToggle == m_xCBSymbol.get()) |
233 | 0 | m_aSymbolState.CheckButtonToggled(*m_xCBSymbol); |
234 | 0 | else if (&rToggle == m_xCBDataSeries.get()) |
235 | 0 | m_aDataSeriesState.CheckButtonToggled(*m_xCBDataSeries); |
236 | 0 | else if (&rToggle == m_xCBWrapText.get()) |
237 | 0 | m_aWrapTextState.CheckButtonToggled(*m_xCBWrapText); |
238 | 0 | else if (&rToggle == m_xCBCustomLeaderLines.get()) |
239 | 0 | m_aCustomLeaderLinesState.CheckButtonToggled(*m_xCBCustomLeaderLines); |
240 | 0 | EnableControls(); |
241 | 0 | } |
242 | | |
243 | | void DataLabelResources::EnableControls() |
244 | 0 | { |
245 | 0 | m_xCBSymbol->set_sensitive( m_xCBNumber->get_active() || (m_xCBPercent->get_active() && m_xCBPercent->get_sensitive()) |
246 | 0 | || m_xCBCategory->get_active() || m_xCBDataSeries->get_active()); |
247 | |
|
248 | 0 | m_xCBWrapText->set_sensitive( m_xCBNumber->get_active() || (m_xCBPercent->get_active() && m_xCBPercent->get_sensitive()) |
249 | 0 | || m_xCBCategory->get_active() || m_xCBDataSeries->get_active() ); |
250 | | |
251 | | // Enable or disable separator, placement and direction based on the check |
252 | | // box states. Note that the check boxes are tri-state. |
253 | 0 | { |
254 | 0 | tools::Long nNumberOfCheckedLabelParts = 0; |
255 | 0 | if (m_xCBNumber->get_state() != TRISTATE_FALSE) |
256 | 0 | ++nNumberOfCheckedLabelParts; |
257 | 0 | if (m_xCBPercent->get_state() != TRISTATE_FALSE && m_xCBPercent->get_sensitive()) |
258 | 0 | ++nNumberOfCheckedLabelParts; |
259 | 0 | if (m_xCBCategory->get_state() != TRISTATE_FALSE) |
260 | 0 | ++nNumberOfCheckedLabelParts; |
261 | 0 | if (m_xCBDataSeries->get_state() != TRISTATE_FALSE) |
262 | 0 | ++nNumberOfCheckedLabelParts; |
263 | |
|
264 | 0 | m_xLB_Separator->set_sensitive( nNumberOfCheckedLabelParts > 1 ); |
265 | |
|
266 | 0 | bool bEnableTextDir = nNumberOfCheckedLabelParts > 0; |
267 | 0 | m_xBxTextDirection->set_sensitive( bEnableTextDir ); |
268 | 0 | bool bEnablePlacement = nNumberOfCheckedLabelParts > 0 && m_xLB_LabelPlacement->get_count()>1; |
269 | 0 | m_xLB_LabelPlacement->set_sensitive( bEnablePlacement ); |
270 | 0 | } |
271 | |
|
272 | 0 | m_xPB_NumberFormatForValue->set_sensitive( m_pNumberFormatter && m_xCBNumber->get_active() ); |
273 | 0 | m_xPB_NumberFormatForPercent->set_sensitive( m_pNumberFormatter && m_xCBPercent->get_active() && m_xCBPercent->get_sensitive() ); |
274 | |
|
275 | 0 | bool bEnableRotation = (m_xCBNumber->get_active() || m_xCBPercent->get_active() |
276 | 0 | || m_xCBCategory->get_active() || m_xCBDataSeries->get_active()); |
277 | 0 | m_xBxOrientation->set_sensitive(bEnableRotation); |
278 | 0 | } |
279 | | |
280 | | void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const |
281 | 0 | { |
282 | 0 | if( m_xCBNumber->get_active() ) |
283 | 0 | { |
284 | 0 | if( !m_bNumberFormatMixedState ) |
285 | 0 | rOutAttrs->Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, m_nNumberFormatForValue )); |
286 | 0 | if( !m_bSourceFormatMixedState ) |
287 | 0 | rOutAttrs->Put( SfxBoolItem( SID_ATTR_NUMBERFORMAT_SOURCE, m_bSourceFormatForValue )); |
288 | 0 | } |
289 | 0 | if( m_xCBPercent->get_active() ) |
290 | 0 | { |
291 | 0 | if( !m_bPercentFormatMixedState ) |
292 | 0 | rOutAttrs->Put( SfxUInt32Item( SCHATTR_PERCENT_NUMBERFORMAT_VALUE, m_nNumberFormatForPercent )); |
293 | 0 | if( !m_bPercentSourceMixedState ) |
294 | 0 | rOutAttrs->Put( SfxBoolItem( SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_bSourceFormatForPercent )); |
295 | 0 | } |
296 | |
|
297 | 0 | if( m_xCBNumber->get_state()!= TRISTATE_INDET ) |
298 | 0 | rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_NUMBER, m_xCBNumber->get_active() ) ); |
299 | 0 | if( m_xCBPercent->get_state()!= TRISTATE_INDET ) |
300 | 0 | rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_PERCENTAGE, m_xCBPercent->get_active() ) ); |
301 | 0 | if( m_xCBCategory->get_state()!= TRISTATE_INDET ) |
302 | 0 | rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_CATEGORY, m_xCBCategory->get_active() ) ); |
303 | 0 | if( m_xCBSymbol->get_state()!= TRISTATE_INDET ) |
304 | 0 | rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_xCBSymbol->get_active()) ); |
305 | 0 | if( m_xCBDataSeries->get_state()!= TRISTATE_INDET ) |
306 | 0 | rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME, m_xCBDataSeries->get_active()) ); |
307 | 0 | if( m_xCBWrapText->get_state()!= TRISTATE_INDET ) |
308 | 0 | rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_WRAP_TEXT, m_xCBWrapText->get_active()) ); |
309 | 0 | if( m_xCBCustomLeaderLines->get_state() != TRISTATE_INDET ) |
310 | 0 | rOutAttrs->Put(SfxBoolItem( SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, m_xCBCustomLeaderLines->get_active()) ); |
311 | |
|
312 | 0 | auto const aSep = our_aLBEntryMap[m_xLB_Separator->get_active()]; |
313 | 0 | rOutAttrs->Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, OUString(aSep)) ); |
314 | |
|
315 | 0 | std::map< sal_uInt16, sal_Int32 >::const_iterator aIt( m_aListBoxToPlacementMap.find(m_xLB_LabelPlacement->get_active()) ); |
316 | 0 | if(aIt!=m_aListBoxToPlacementMap.end()) |
317 | 0 | { |
318 | 0 | sal_Int32 nValue = aIt->second; |
319 | 0 | rOutAttrs->Put( SfxInt32Item( SCHATTR_DATADESCR_PLACEMENT, nValue ) ); |
320 | 0 | } |
321 | |
|
322 | 0 | if (m_aLB_TextDirection.get_active() != -1) |
323 | 0 | rOutAttrs->Put( SvxFrameDirectionItem( m_aLB_TextDirection.get_active_id(), EE_PARA_WRITINGDIR ) ); |
324 | |
|
325 | 0 | if( m_xDC_Dial->IsVisible() ) |
326 | 0 | { |
327 | 0 | Degree100 nDegrees = m_xDC_Dial->GetRotation(); |
328 | 0 | rOutAttrs->Put(SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) ); |
329 | 0 | } |
330 | 0 | } |
331 | | |
332 | | void DataLabelResources::Reset(const SfxItemSet& rInAttrs) |
333 | 0 | { |
334 | | // default state |
335 | 0 | m_xCBSymbol->set_sensitive( false ); |
336 | |
|
337 | 0 | lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_NUMBER, *m_xCBNumber, m_aNumberState ); |
338 | 0 | lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_PERCENTAGE, *m_xCBPercent, m_aPercentState ); |
339 | 0 | lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, *m_xCBCategory, m_aCategoryState ); |
340 | 0 | lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, *m_xCBSymbol, m_aSymbolState ); |
341 | 0 | lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME, *m_xCBDataSeries, m_aDataSeriesState ); |
342 | 0 | lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_WRAP_TEXT, *m_xCBWrapText, m_aWrapTextState ); |
343 | 0 | lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, *m_xCBCustomLeaderLines, m_aCustomLeaderLinesState ); |
344 | |
|
345 | 0 | m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState ); |
346 | 0 | m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState); |
347 | |
|
348 | 0 | if( const SfxStringItem* pSeparatorItem = rInAttrs.GetItemIfSet(SCHATTR_DATADESCR_SEPARATOR) ) |
349 | 0 | for(size_t i=0; i < std::size(our_aLBEntryMap); ++i ) |
350 | 0 | { |
351 | 0 | if( our_aLBEntryMap[i] == pSeparatorItem->GetValue()) |
352 | 0 | m_xLB_Separator->set_active( i ); |
353 | 0 | } |
354 | 0 | else |
355 | 0 | m_xLB_Separator->set_active( 0 ); |
356 | |
|
357 | 0 | if( const SfxInt32Item* pPlacementItem = rInAttrs.GetItemIfSet(SCHATTR_DATADESCR_PLACEMENT) ) |
358 | 0 | { |
359 | 0 | sal_Int32 nPlacement = pPlacementItem->GetValue(); |
360 | 0 | std::map< sal_Int32, sal_uInt16 >::const_iterator aIt( m_aPlacementToListBoxMap.find(nPlacement) ); |
361 | 0 | if(aIt!=m_aPlacementToListBoxMap.end()) |
362 | 0 | { |
363 | 0 | sal_uInt16 nPos = aIt->second; |
364 | 0 | m_xLB_LabelPlacement->set_active( nPos ); |
365 | 0 | } |
366 | 0 | else |
367 | 0 | m_xLB_LabelPlacement->set_active(-1); |
368 | 0 | } |
369 | 0 | else |
370 | 0 | m_xLB_LabelPlacement->set_active(-1); |
371 | |
|
372 | 0 | if( const SvxFrameDirectionItem* pDirectionItem = rInAttrs.GetItemIfSet(EE_PARA_WRITINGDIR) ) |
373 | 0 | m_aLB_TextDirection.set_active_id( pDirectionItem->GetValue() ); |
374 | |
|
375 | 0 | if( const SdrAngleItem* pAngleItem = rInAttrs.GetItemIfSet( SCHATTR_TEXT_DEGREES ) ) |
376 | 0 | { |
377 | 0 | Degree100 nDegrees = pAngleItem->GetValue(); |
378 | 0 | m_xDC_Dial->SetRotation( nDegrees ); |
379 | 0 | } |
380 | 0 | else |
381 | 0 | m_xDC_Dial->SetRotation( 0_deg100 ); |
382 | |
|
383 | 0 | EnableControls(); |
384 | 0 | } |
385 | | |
386 | | } //namespace chart |
387 | | |
388 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |