LibreOffice Module chart2 (master) 1
ChartElementsPanel.cxx
Go to the documentation of this file.
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 <com/sun/star/chart2/LegendPosition.hpp>
21#include <com/sun/star/chart/ChartLegendExpansion.hpp>
22
23#include <vcl/svapp.hxx>
24
26#include <ChartController.hxx>
28
29#include <Legend.hxx>
30#include <LegendHelper.hxx>
31#include <ChartModelHelper.hxx>
32#include <AxisHelper.hxx>
33#include <DiagramHelper.hxx>
34#include <Diagram.hxx>
35#include <ChartType.hxx>
36#include <ChartTypeHelper.hxx>
37#include <ChartModel.hxx>
39
40
41using namespace css;
42using namespace css::uno;
43
44namespace chart::sidebar {
45
46namespace {
47
48enum class GridType
49{
50 VERT_MAJOR,
51 VERT_MINOR,
52 HOR_MAJOR,
53 HOR_MINOR
54};
55
56enum class AxisType
57{
58 X_MAIN,
59 Y_MAIN,
60 Z_MAIN,
61 X_SECOND,
62 Y_SECOND
63};
64
65ChartModel* getChartModel(const css::uno::Reference<css::frame::XModel>& xModel)
66{
67 ChartModel* pModel = dynamic_cast<ChartModel*>(xModel.get());
68
69 return pModel;
70}
71
72bool isLegendVisible(const css::uno::Reference<css::frame::XModel>& xModel)
73{
74 ChartModel* pModel = getChartModel(xModel);
75 if (!pModel)
76 return false;
77
79 if( xLegendProp.is())
80 {
81 try
82 {
83 bool bShow = false;
84 if( xLegendProp->getPropertyValue( "Show") >>= bShow )
85 {
86 return bShow;
87 }
88 }
89 catch(const uno::Exception &)
90 {
91 }
92 }
93
94 return false;
95}
96
97void setLegendVisible(const css::uno::Reference<css::frame::XModel>& xModel, bool bVisible)
98{
99 ChartModel* pModel = getChartModel(xModel);
100 if (!pModel)
101 return;
102
103 if (bVisible)
105 else
107}
108
109bool isLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel)
110{
111 ChartModel* pModel = getChartModel(xModel);
112 if (!pModel)
113 return false;
114
116 if( xLegendProp.is())
117 {
118 try
119 {
120 bool bOverlay = false;
121 if(xLegendProp->getPropertyValue("Overlay") >>= bOverlay)
122 {
123 return bOverlay;
124 }
125 }
126 catch(const uno::Exception &)
127 {
128 }
129 }
130
131 return false;
132}
133
134void setLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel, bool bOverlay)
135{
136 ChartModel* pModel = getChartModel(xModel);
137 if (!pModel)
138 return;
139
140 rtl::Reference<Legend> xLegendProp = LegendHelper::getLegend(*pModel);
141 if (!xLegendProp.is())
142 return;
143
144 xLegendProp->setPropertyValue("Overlay", css::uno::Any(bOverlay));
145}
146
147bool isTitleVisible(const rtl::Reference<::chart::ChartModel>& xModel, TitleHelper::eTitleType eTitle)
148{
149 rtl::Reference<Title> xTitle = TitleHelper::getTitle(eTitle, xModel);
150 if (!xTitle.is())
151 return false;
152
153 css::uno::Any aAny = xTitle->getPropertyValue("Visible");
154 bool bVisible = aAny.get<bool>();
155 return bVisible;
156}
157
158bool isGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType eType)
159{
160 rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram());
161 if(xDiagram.is())
162 {
163 sal_Int32 nDimensionIndex = 0;
164 if (eType == GridType::HOR_MAJOR || eType == GridType::HOR_MINOR)
165 nDimensionIndex = 1;
166
167 bool bMajor = (eType == GridType::HOR_MAJOR || eType == GridType::VERT_MAJOR);
168
169 bool bHasGrid = AxisHelper::isGridShown(nDimensionIndex, 0, bMajor, xDiagram);
170 return bHasGrid;
171 }
172 return false;
173}
174
175void setGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType eType, bool bVisible)
176{
177 rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram());
178 if(!xDiagram.is())
179 return;
180
181 sal_Int32 nDimensionIndex = 0;
182 if (eType == GridType::HOR_MAJOR || eType == GridType::HOR_MINOR)
183 nDimensionIndex = 1;
184 sal_Int32 nCooSysIndex = 0;
185
186 bool bMajor = (eType == GridType::HOR_MAJOR || eType == GridType::VERT_MAJOR);
187
188 if (bVisible)
189 AxisHelper::showGrid(nDimensionIndex, nCooSysIndex, bMajor,
190 xDiagram);
191 else
192 AxisHelper::hideGrid(nDimensionIndex, nCooSysIndex, bMajor, xDiagram);
193}
194
195bool isAxisVisible(const rtl::Reference<::chart::ChartModel>& xModel, AxisType eType)
196{
197 rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram());
198 if(xDiagram.is())
199 {
200 sal_Int32 nDimensionIndex = 0;
201 if (eType == AxisType::Y_MAIN || eType == AxisType::Y_SECOND)
202 nDimensionIndex = 1;
203 else if (eType == AxisType::Z_MAIN)
204 nDimensionIndex = 2;
205
206 bool bMajor = (eType != AxisType::X_SECOND && eType != AxisType::Y_SECOND);
207
208 bool bHasAxis = AxisHelper::isAxisShown(nDimensionIndex, bMajor, xDiagram);
209 return bHasAxis;
210 }
211 return false;
212}
213
214void setAxisVisible(const rtl::Reference<::chart::ChartModel>& xModel, AxisType eType, bool bVisible)
215{
216 rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram());
217 if(!xDiagram.is())
218 return;
219
220 sal_Int32 nDimensionIndex = 0;
221 if (eType == AxisType::Y_MAIN || eType == AxisType::Y_SECOND)
222 nDimensionIndex = 1;
223 else if (eType == AxisType::Z_MAIN)
224 nDimensionIndex = 2;
225
226 bool bMajor = (eType != AxisType::X_SECOND && eType != AxisType::Y_SECOND);
227
228 if (bVisible)
229 AxisHelper::showAxis(nDimensionIndex, bMajor, xDiagram, comphelper::getProcessComponentContext());
230 else
231 AxisHelper::hideAxis(nDimensionIndex, bMajor, xDiagram);
232}
233
234sal_Int32 getLegendPos(const css::uno::Reference<css::frame::XModel>& xModel)
235{
236 ChartModel* pModel = getChartModel(xModel);
237 if (!pModel)
238 return -1;
239
241 if (!xLegendProp.is())
242 return -1;
243
244 chart2::LegendPosition eLegendPos = chart2::LegendPosition_LINE_END;
245 xLegendProp->getPropertyValue("AnchorPosition") >>= eLegendPos;
246 switch(eLegendPos)
247 {
248 case chart2::LegendPosition_LINE_START:
249 return 3;
250 case chart2::LegendPosition_LINE_END:
251 return 0;
252 case chart2::LegendPosition_PAGE_START:
253 return 1;
254 case chart2::LegendPosition_PAGE_END:
255 return 2;
256 default:
257 return -1;
258 }
259}
260
261void setLegendPos(const css::uno::Reference<css::frame::XModel>& xModel, sal_Int32 nPos)
262{
263 ChartModel* pModel = getChartModel(xModel);
264 if (!pModel)
265 return;
266
268 if (!xLegendProp.is())
269 return;
270
271 chart2::LegendPosition eLegendPos = chart2::LegendPosition_LINE_END;
272 css::chart::ChartLegendExpansion eExpansion = css::chart::ChartLegendExpansion_HIGH;
273 switch(nPos)
274 {
275 case 1:
276 eLegendPos = chart2::LegendPosition_PAGE_START;
277 eExpansion = css::chart::ChartLegendExpansion_WIDE;
278 break;
279 case 3:
280 eLegendPos = chart2::LegendPosition_LINE_START;
281 break;
282 case 0:
283 eLegendPos = chart2::LegendPosition_LINE_END;
284 break;
285 case 2:
286 eLegendPos = chart2::LegendPosition_PAGE_END;
287 eExpansion = css::chart::ChartLegendExpansion_WIDE;
288 break;
289 default:
290 assert(false);
291 }
292
293 xLegendProp->setPropertyValue("AnchorPosition", css::uno::Any(eLegendPos));
294 xLegendProp->setPropertyValue("Expansion", css::uno::Any(eExpansion));
295 xLegendProp->setPropertyValue("RelativePosition", uno::Any());
296}
297
298}
299
301 weld::Widget* pParent, ChartController* pController)
302 : PanelLayout(pParent, "ChartElementsPanel", "modules/schart/ui/sidebarelements.ui")
303 , mxCBTitle(m_xBuilder->weld_check_button("checkbutton_title"))
304 , mxEditTitle(m_xBuilder->weld_entry("edit_title"))
305 , mxCBSubtitle(m_xBuilder->weld_check_button("checkbutton_subtitle"))
306 , mxEditSubtitle(m_xBuilder->weld_entry("edit_subtitle"))
307 , mxCBXAxis(m_xBuilder->weld_check_button("checkbutton_x_axis"))
308 , mxCBXAxisTitle(m_xBuilder->weld_check_button("checkbutton_x_axis_title"))
309 , mxCBYAxis(m_xBuilder->weld_check_button("checkbutton_y_axis"))
310 , mxCBYAxisTitle(m_xBuilder->weld_check_button("checkbutton_y_axis_title"))
311 , mxCBZAxis(m_xBuilder->weld_check_button("checkbutton_z_axis"))
312 , mxCBZAxisTitle(m_xBuilder->weld_check_button("checkbutton_z_axis_title"))
313 , mxCB2ndXAxis(m_xBuilder->weld_check_button("checkbutton_2nd_x_axis"))
314 , mxCB2ndXAxisTitle(m_xBuilder->weld_check_button("checkbutton_2nd_x_axis_title"))
315 , mxCB2ndYAxis(m_xBuilder->weld_check_button("checkbutton_2nd_y_axis"))
316 , mxCB2ndYAxisTitle(m_xBuilder->weld_check_button("checkbutton_2nd_y_axis_title"))
317 , mxCBLegend(m_xBuilder->weld_check_button("checkbutton_legend"))
318 , mxCBLegendNoOverlay(m_xBuilder->weld_check_button("checkbutton_no_overlay"))
319 , mxCBGridVerticalMajor(m_xBuilder->weld_check_button("checkbutton_gridline_vertical_major"))
320 , mxCBGridHorizontalMajor(m_xBuilder->weld_check_button("checkbutton_gridline_horizontal_major"))
321 , mxCBGridVerticalMinor(m_xBuilder->weld_check_button("checkbutton_gridline_vertical_minor"))
322 , mxCBGridHorizontalMinor(m_xBuilder->weld_check_button("checkbutton_gridline_horizontal_minor"))
323 , mxTextTitle(m_xBuilder->weld_label("text_title"))
324 , mxTextSubTitle(m_xBuilder->weld_label("text_subtitle"))
325 , mxLBAxis(m_xBuilder->weld_label("label_axes"))
326 , mxLBGrid(m_xBuilder->weld_label("label_gri"))
327 , mxLBLegendPosition(m_xBuilder->weld_combo_box("comboboxtext_legend"))
328 , mxBoxLegend(m_xBuilder->weld_widget("box_legend"))
329 , mxModel(pController->getChartModel())
331 , mbModelValid(true)
332{
333 maTextTitle = mxTextTitle->get_label();
334 maTextSubTitle = mxTextSubTitle->get_label();
335
336 Initialize();
337}
338
340{
341 doUpdateModel(nullptr);
342
343 mxCBTitle.reset();
344 mxEditTitle.reset();
345 mxCBSubtitle.reset();
346 mxEditSubtitle.reset();
347 mxCBXAxis.reset();
348 mxCBXAxisTitle.reset();
349 mxCBYAxis.reset();
350 mxCBYAxisTitle.reset();
351 mxCBZAxis.reset();
352 mxCBZAxisTitle.reset();
353 mxCB2ndXAxis.reset();
354 mxCB2ndXAxisTitle.reset();
355 mxCB2ndYAxis.reset();
356 mxCB2ndYAxisTitle.reset();
357 mxCBLegend.reset();
358 mxCBLegendNoOverlay.reset();
359 mxCBGridVerticalMajor.reset();
361 mxCBGridVerticalMinor.reset();
363
364 mxLBLegendPosition.reset();
365 mxBoxLegend.reset();
366
367 mxLBAxis.reset();
368 mxLBGrid.reset();
369
370 mxTextTitle.reset();
371 mxTextSubTitle.reset();
372}
373
375{
376 mxModel->addModifyListener(mxListener);
377 updateData();
378
379 Link<weld::Toggleable&,void> aLink = LINK(this, ChartElementsPanel, CheckBoxHdl);
380 mxCBTitle->connect_toggled(aLink);
381 mxCBSubtitle->connect_toggled(aLink);
382 mxCBXAxis->connect_toggled(aLink);
383 mxCBXAxisTitle->connect_toggled(aLink);
384 mxCBYAxis->connect_toggled(aLink);
385 mxCBYAxisTitle->connect_toggled(aLink);
386 mxCBZAxis->connect_toggled(aLink);
387 mxCBZAxisTitle->connect_toggled(aLink);
388 mxCB2ndXAxis->connect_toggled(aLink);
389 mxCB2ndXAxisTitle->connect_toggled(aLink);
390 mxCB2ndYAxis->connect_toggled(aLink);
391 mxCB2ndYAxisTitle->connect_toggled(aLink);
392 mxCBLegend->connect_toggled(aLink);
393 mxCBLegendNoOverlay->connect_toggled(aLink);
394 mxCBGridVerticalMajor->connect_toggled(aLink);
395 mxCBGridHorizontalMajor->connect_toggled(aLink);
396 mxCBGridVerticalMinor->connect_toggled(aLink);
397 mxCBGridHorizontalMinor->connect_toggled(aLink);
398
399 mxLBLegendPosition->connect_changed(LINK(this, ChartElementsPanel, LegendPosHdl));
400
401 Link<weld::Entry&, void> aEditLink = LINK(this, ChartElementsPanel, EditHdl);
402 mxEditTitle->connect_changed(aEditLink);
403 mxEditSubtitle->connect_changed(aEditLink);
404}
405
406namespace {
407
409{
410 rtl::Reference<Diagram > xDiagram = xModel->getFirstChartDiagram();
411 if (!xDiagram.is())
412 return nullptr;
413
414 const std::vector<rtl::Reference<BaseCoordinateSystem>> & xCooSysSequence(xDiagram->getBaseCoordinateSystems());
415
416 if (xCooSysSequence.empty())
417 return nullptr;
418
419 const std::vector<rtl::Reference<ChartType>> & xChartTypeSequence(xCooSysSequence[0]->getChartTypes2());
420
421 if (xChartTypeSequence.empty())
422 return nullptr;
423
424 return xChartTypeSequence[0];
425}
426
427}
428
430{
431 if (!mbModelValid)
432 return;
433
434 rtl::Reference< Diagram > xDiagram(mxModel->getFirstChartDiagram());
435 sal_Int32 nDimension = 0;
436 if (xDiagram)
437 nDimension = xDiagram->getDimension();
438 SolarMutexGuard aGuard;
439
440 mxCBLegend->set_active(isLegendVisible(mxModel));
441 mxCBLegendNoOverlay->set_sensitive(isLegendVisible(mxModel));
442 mxCBLegendNoOverlay->set_active(!isLegendOverlay(mxModel));
443 mxBoxLegend->set_sensitive(isLegendVisible(mxModel));
444
445 bool hasTitle = isTitleVisible(mxModel, TitleHelper::MAIN_TITLE);
446 mxCBTitle->set_active(hasTitle);
447
448 OUString title = mxEditTitle->get_text();
450 if (title != newTitle)
451 mxEditTitle->set_text(newTitle);
452 if (mxEditTitle->get_sensitive() != hasTitle)
453 mxEditTitle->set_sensitive(hasTitle);
454
455 bool hasSubtitle = isTitleVisible(mxModel, TitleHelper::SUB_TITLE);
456 mxCBSubtitle->set_active(hasSubtitle);
457
458 OUString subtitle = mxEditSubtitle->get_text();
460 if (subtitle != newSubtitle)
461 mxEditSubtitle->set_text(newSubtitle);
462 if (mxEditSubtitle->get_sensitive() != hasSubtitle)
463 mxEditSubtitle->set_sensitive(hasSubtitle);
464
465 mxCBXAxisTitle->set_active(isTitleVisible(mxModel, TitleHelper::X_AXIS_TITLE));
466 mxCBYAxisTitle->set_active(isTitleVisible(mxModel, TitleHelper::Y_AXIS_TITLE));
467 mxCBZAxisTitle->set_active(isTitleVisible(mxModel, TitleHelper::Z_AXIS_TITLE));
470 mxCBGridVerticalMajor->set_active(isGridVisible(mxModel, GridType::VERT_MAJOR));
471 mxCBGridHorizontalMajor->set_active(isGridVisible(mxModel, GridType::HOR_MAJOR));
472 mxCBGridVerticalMinor->set_active(isGridVisible(mxModel, GridType::VERT_MINOR));
473 mxCBGridHorizontalMinor->set_active(isGridVisible(mxModel, GridType::HOR_MINOR));
474 mxCBXAxis->set_active(isAxisVisible(mxModel, AxisType::X_MAIN));
475 mxCBYAxis->set_active(isAxisVisible(mxModel, AxisType::Y_MAIN));
476 mxCBZAxis->set_active(isAxisVisible(mxModel, AxisType::Z_MAIN));
477 mxCB2ndXAxis->set_active(isAxisVisible(mxModel, AxisType::X_SECOND));
478 mxCB2ndYAxis->set_active(isAxisVisible(mxModel, AxisType::Y_SECOND));
479
480 bool bSupportsMainAxis = ChartTypeHelper::isSupportingMainAxis(
481 getChartType(mxModel), 0, 0);
482 if (bSupportsMainAxis)
483 {
484 mxCBXAxis->show();
485 mxCBYAxis->show();
486 mxCBZAxis->show();
487 mxCBXAxisTitle->show();
488 mxCBYAxisTitle->show();
489 mxCBZAxisTitle->show();
490 mxCBGridVerticalMajor->show();
491 mxCBGridVerticalMinor->show();
494 mxLBAxis->show();
495 mxLBGrid->show();
496 }
497 else
498 {
499 mxCBXAxis->hide();
500 mxCBYAxis->hide();
501 mxCBZAxis->hide();
502 mxCBXAxisTitle->hide();
503 mxCBYAxisTitle->hide();
504 mxCBZAxisTitle->hide();
505 mxCBGridVerticalMajor->hide();
506 mxCBGridVerticalMinor->hide();
509 mxLBAxis->hide();
510 mxLBGrid->hide();
511 }
512
513 if (nDimension == 3)
514 {
515 mxCBZAxis->set_sensitive(true);
516 mxCBZAxisTitle->set_sensitive(true);
517 }
518 else
519 {
520 mxCBZAxis->set_sensitive(false);
521 mxCBZAxisTitle->set_sensitive(false);
522 }
523
524 mxLBLegendPosition->set_active(getLegendPos(mxModel));
525}
526
527std::unique_ptr<PanelLayout> ChartElementsPanel::Create (
528 weld::Widget* pParent,
529 ChartController* pController)
530{
531 if (pParent == nullptr)
532 throw lang::IllegalArgumentException("no parent Window given to ChartElementsPanel::Create", nullptr, 0);
533 return std::make_unique<ChartElementsPanel>(pParent, pController);
534}
535
537{
539 updateData();
540}
541
543 const vcl::EnumContext& rContext)
544{
545 if(maContext == rContext)
546 {
547 // Nothing to do.
548 return;
549 }
550
551 maContext = rContext;
552 updateData();
553}
554
556{
557 mbModelValid = false;
558}
559
561{
562 if (mbModelValid)
563 {
564 mxModel->removeModifyListener(mxListener);
565 }
566
567 mxModel = xModel;
568 mbModelValid = mxModel.is();
569
570 if (!mbModelValid)
571 return;
572
573 mxModel->addModifyListener(mxListener);
574}
575
576void ChartElementsPanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
577{
578 ::chart::ChartModel* pModel = dynamic_cast<::chart::ChartModel*>(xModel.get());
579 assert(!xModel || pModel);
580 doUpdateModel(pModel);
581}
582
583IMPL_LINK(ChartElementsPanel, CheckBoxHdl, weld::Toggleable&, rCheckBox, void)
584{
585 bool bChecked = rCheckBox.get_active();
586 if (&rCheckBox == mxCBTitle.get())
587 setTitleVisible(TitleHelper::MAIN_TITLE, bChecked);
588 else if (&rCheckBox == mxCBSubtitle.get())
589 setTitleVisible(TitleHelper::SUB_TITLE, bChecked);
590 else if (&rCheckBox == mxCBXAxis.get())
591 setAxisVisible(mxModel, AxisType::X_MAIN, bChecked);
592 else if (&rCheckBox == mxCBXAxisTitle.get())
593 setTitleVisible(TitleHelper::X_AXIS_TITLE, bChecked);
594 else if (&rCheckBox == mxCBYAxis.get())
595 setAxisVisible(mxModel, AxisType::Y_MAIN, bChecked);
596 else if (&rCheckBox == mxCBYAxisTitle.get())
597 setTitleVisible(TitleHelper::Y_AXIS_TITLE, bChecked);
598 else if (&rCheckBox == mxCBZAxis.get())
599 setAxisVisible(mxModel, AxisType::Z_MAIN, bChecked);
600 else if (&rCheckBox == mxCBZAxisTitle.get())
601 setTitleVisible(TitleHelper::Z_AXIS_TITLE, bChecked);
602 else if (&rCheckBox == mxCB2ndXAxis.get())
603 setAxisVisible(mxModel, AxisType::X_SECOND, bChecked);
604 else if (&rCheckBox == mxCB2ndXAxisTitle.get())
605 setTitleVisible(TitleHelper::SECONDARY_X_AXIS_TITLE, bChecked);
606 else if (&rCheckBox == mxCB2ndYAxis.get())
607 setAxisVisible(mxModel, AxisType::Y_SECOND, bChecked);
608 else if (&rCheckBox == mxCB2ndYAxisTitle.get())
609 setTitleVisible(TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked);
610 else if (&rCheckBox == mxCBLegend.get())
611 {
612 mxBoxLegend->set_sensitive(bChecked);
613 mxCBLegendNoOverlay->set_sensitive(bChecked);
614 setLegendVisible(mxModel, bChecked);
615 }
616 else if (&rCheckBox == mxCBLegendNoOverlay.get())
617 setLegendOverlay(mxModel, !bChecked);
618 else if (&rCheckBox == mxCBGridVerticalMajor.get())
619 setGridVisible(mxModel, GridType::VERT_MAJOR, bChecked);
620 else if (&rCheckBox == mxCBGridHorizontalMajor.get())
621 setGridVisible(mxModel, GridType::HOR_MAJOR, bChecked);
622 else if (&rCheckBox == mxCBGridVerticalMinor.get())
623 setGridVisible(mxModel, GridType::VERT_MINOR, bChecked);
624 else if (&rCheckBox == mxCBGridHorizontalMinor.get())
625 setGridVisible(mxModel, GridType::HOR_MINOR, bChecked);
626
627 updateData();
628}
629
631{
632 // title or subtitle?
634 if (&rEdit == mxEditSubtitle.get())
635 aTitleType = TitleHelper::SUB_TITLE;
636
637 // set it
638 OUString aText(rEdit.get_text());
640}
641
643{
644 sal_Int32 nPos = mxLBLegendPosition->get_active();
645 setLegendPos(mxModel, nPos);
646}
647
649{
650 if (bVisible)
651 {
652 OUString aText = eTitle == TitleHelper::SUB_TITLE ? maTextSubTitle : maTextTitle;
654 }
655 else
656 {
658 }
659}
660
661} // end of namespace ::chart::sidebar
662
663/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nPos
css::uno::Reference< css::frame::XModel2 > mxModel
virtual void DataChanged(const DataChangedEvent &rEvent)
static bool isAxisShown(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:635
static void hideAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:461
static void hideGrid(sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:493
static void showAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram, const css::uno::Reference< css::uno::XComponentContext > &xContext, ReferenceSizeProvider *pRefSizeProvider=nullptr)
Definition: AxisHelper.cxx:392
static bool isGridShown(sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:525
static void showGrid(sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid, const rtl::Reference< ::chart::Diagram > &xDiagram)
Definition: AxisHelper.cxx:414
static bool isSupportingMainAxis(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex)
static rtl::Reference< ::chart::Legend > getLegend(ChartModel &rModel, const css::uno::Reference< css::uno::XComponentContext > &xContext=nullptr, bool bCreate=false)
static rtl::Reference< ::chart::Legend > showLegend(ChartModel &rModel, const css::uno::Reference< css::uno::XComponentContext > &xContext)
static void hideLegend(ChartModel &rModel)
static rtl::Reference< ::chart::Title > createOrShowTitle(eTitleType nTitleIndex, const OUString &rTitleText, const rtl::Reference< ::chart::ChartModel > &xModel, const css::uno::Reference< css::uno::XComponentContext > &xContex)
static void hideTitle(eTitleType nTitleIndex, const rtl::Reference< ::chart::ChartModel > &xModel)
static rtl::Reference< ::chart::Title > getTitle(eTitleType nTitleIndex, ChartModel &rModel)
static OUString getCompleteString(const rtl::Reference< ::chart::Title > &xTitle)
static void setCompleteString(const OUString &rNewText, const rtl::Reference< ::chart::Title > &xTitle, const css::uno::Reference< css::uno::XComponentContext > &xContext, const float *pDefaultCharHeight=nullptr)
std::unique_ptr< weld::CheckButton > mxCB2ndXAxisTitle
std::unique_ptr< weld::ComboBox > mxLBLegendPosition
virtual void updateModel(css::uno::Reference< css::frame::XModel > xModel) override
std::unique_ptr< weld::CheckButton > mxCB2ndXAxis
void doUpdateModel(rtl::Reference<::chart::ChartModel > xModel)
std::unique_ptr< weld::CheckButton > mxCBXAxisTitle
std::unique_ptr< weld::Widget > mxBoxLegend
void setTitleVisible(TitleHelper::eTitleType eTitle, bool bVisible)
virtual void HandleContextChange(const vcl::EnumContext &rContext) override
std::unique_ptr< weld::CheckButton > mxCBSubtitle
virtual void DataChanged(const DataChangedEvent &rEvent) override
std::unique_ptr< weld::CheckButton > mxCBTitle
std::unique_ptr< weld::CheckButton > mxCB2ndYAxisTitle
rtl::Reference<::chart::ChartModel > mxModel
std::unique_ptr< weld::CheckButton > mxCBGridHorizontalMinor
std::unique_ptr< weld::CheckButton > mxCBGridHorizontalMajor
std::unique_ptr< weld::CheckButton > mxCBYAxis
std::unique_ptr< weld::CheckButton > mxCBZAxisTitle
std::unique_ptr< weld::Label > mxLBGrid
ChartElementsPanel(weld::Widget *pParent, ChartController *pController)
css::uno::Reference< css::util::XModifyListener > mxListener
std::unique_ptr< weld::CheckButton > mxCBLegend
std::unique_ptr< weld::CheckButton > mxCBGridVerticalMajor
std::unique_ptr< weld::CheckButton > mxCBXAxis
std::unique_ptr< weld::Label > mxTextSubTitle
std::unique_ptr< weld::CheckButton > mxCBYAxisTitle
std::unique_ptr< weld::Label > mxLBAxis
std::unique_ptr< weld::CheckButton > mxCB2ndYAxis
std::unique_ptr< weld::Entry > mxEditSubtitle
std::unique_ptr< weld::CheckButton > mxCBLegendNoOverlay
std::unique_ptr< weld::Entry > mxEditTitle
std::unique_ptr< weld::CheckButton > mxCBGridVerticalMinor
static std::unique_ptr< PanelLayout > Create(weld::Widget *pParent, ChartController *pController)
std::unique_ptr< weld::Label > mxTextTitle
std::unique_ptr< weld::CheckButton > mxCBZAxis
Reference< script::XScriptListener > mxListener
DocumentType eType
IMPL_LINK_NOARG(ChartAxisPanel, ListBoxHdl, weld::ComboBox &, void)
IMPL_LINK(ChartAxisPanel, CheckBoxHdl, weld::Toggleable &, rCheckbox, void)
Reference< XComponentContext > getProcessComponentContext()
AxisType
Reference< XModel > xModel
bool bVisible