LibreOffice Module chart2 (master) 1
DataBrowser.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 <svl/zforlist.hxx>
21
22#include "DataBrowser.hxx"
23#include "DataBrowserModel.hxx"
24#include <strings.hrc>
25#include <DataSeries.hxx>
26#include <DataSeriesHelper.hxx>
27#include <DiagramHelper.hxx>
28#include <CommonConverters.hxx>
31#include <ResId.hxx>
32#include <bitmaps.hlst>
33#include <helpids.h>
34#include <ChartModel.hxx>
35#include <ChartType.hxx>
36
37#include <vcl/weld.hxx>
38#include <vcl/settings.hxx>
39#include <vcl/svapp.hxx>
40#include <vcl/virdev.hxx>
41#include <o3tl/safeint.hxx>
42#include <osl/diagnose.h>
43#include <svl/numformat.hxx>
45
46#include <com/sun/star/container/XIndexReplace.hpp>
47
48#include <algorithm>
49#include <limits>
50
51
52using namespace ::com::sun::star;
53using ::com::sun::star::uno::Reference;
54
55using namespace ::svt;
56
57namespace
58{
59/* BrowserMode::COLUMNSELECTION : single cells may be selected rather than only
60 entire rows
61 BrowserMode::(H|V)LINES : show horizontal or vertical grid-lines
62 BrowserMode::AUTO_(H|V)SCROLL : scroll automated horizontally or vertically when
63 cursor is moved beyond the edge of the dialog
64 BrowserMode::HIDESELECT : Do not mark the current row with selection color
65 (usually blue)
66 ! BrowserMode::HIDECURSOR would prevent flickering in edit fields, but navigating
67 with shift up/down, and entering non-editable cells would be problematic,
68 e.g. the first cell, or when being in read-only mode
69*/
70const BrowserMode BrowserStdFlags = BrowserMode::COLUMNSELECTION |
71 BrowserMode::HLINES | BrowserMode::VLINES |
72 BrowserMode::AUTO_HSCROLL | BrowserMode::AUTO_VSCROLL |
73 BrowserMode::HIDESELECT;
74
75sal_Int32 lcl_getColumnInData( sal_uInt16 nCol )
76{
77 return static_cast< sal_Int32 >( nCol ) - 1;
78}
79
80} // anonymous namespace
81
82namespace chart
83{
84
85namespace impl
86{
87
89{
90public:
91 explicit SeriesHeaderEdit(std::unique_ptr<weld::Entry> xControl);
92
93 void setStartColumn( sal_Int32 nStartColumn );
94 sal_Int32 getStartColumn() const { return m_nStartColumn;}
95 void SetShowWarningBox( bool bShowWarning );
96
97 OUString GetText() const { return m_xControl->get_text(); }
98 void SetText(const OUString& rText) { m_xControl->set_text(rText); }
99
100 bool HasFocus() const { return m_xControl->has_focus(); }
101
102 void set_size_request(int nWidth, int nHeight) { m_xControl->set_size_request(nWidth, nHeight); }
103 void set_margin_start(int nLeft) { m_xControl->set_margin_start(nLeft); }
104
107
108private:
109 DECL_LINK(NameEdited, weld::Entry&, void);
110 DECL_LINK(NameFocusIn, weld::Widget&, void);
111 DECL_LINK(MousePressHdl, const MouseEvent&, bool);
112
113 std::unique_ptr<weld::Entry> m_xControl;
116 sal_Int32 m_nStartColumn;
118};
119
120SeriesHeaderEdit::SeriesHeaderEdit(std::unique_ptr<weld::Entry> xControl)
121 : m_xControl(std::move(xControl))
122 , m_nStartColumn(0)
123 , m_bShowWarningBox(false)
124{
126 m_xControl->connect_changed(LINK(this, SeriesHeaderEdit, NameEdited));
127 m_xControl->connect_focus_in(LINK(this, SeriesHeaderEdit, NameFocusIn));
128 m_xControl->connect_mouse_press(LINK(this, SeriesHeaderEdit, MousePressHdl));
129}
130
132{
133 m_aModifyHdl.Call(*this);
134}
135
137{
138 m_aFocusInHdl.Call(*this);
139}
140
141void SeriesHeaderEdit::setStartColumn( sal_Int32 nStartColumn )
142{
143 m_nStartColumn = nStartColumn;
144}
145
146void SeriesHeaderEdit::SetShowWarningBox( bool bShowWarning )
147{
148 m_bShowWarningBox = bShowWarning;
149}
150
151IMPL_LINK_NOARG(SeriesHeaderEdit, MousePressHdl, const MouseEvent&, bool)
152{
153 if (m_bShowWarningBox)
154 {
155 std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_xControl.get(),
156 VclMessageType::Warning, VclButtonsType::Ok,
157 SchResId(STR_INVALID_NUMBER)));
158 xWarn->run();
159 }
160
161 return false;
162}
163
165{
166public:
167 explicit SeriesHeader(weld::Container* pParent, weld::Container* pColorParent);
169
170 void SetColor( const Color & rCol );
171 void SetPos();
172 void SetWidth( sal_Int32 nWidth );
173 void SetChartType( const rtl::Reference< ::chart::ChartType > & xChartType,
174 bool bSwapXAndYAxis );
175 void SetSeriesName( const OUString & rName );
176 void SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol );
177
178 void SetPixelWidth( sal_Int32 nWidth );
179
180 sal_Int32 GetStartColumn() const { return m_nStartCol;}
181 sal_Int32 GetEndColumn() const { return m_nEndCol;}
182
183 static const sal_Int32 nSymbolHeight = 10;
184 static const sal_Int32 nSymbolDistance = 2;
185
187
188 void Show();
189 void Hide();
190
194 void applyChanges();
195
197
199
200 bool HasFocus() const;
201
202private:
204
205 std::unique_ptr<weld::Builder> m_xBuilder1;
206 std::unique_ptr<weld::Builder> m_xBuilder2;
207
210
211 std::unique_ptr<weld::Container> m_xContainer1;
212 std::unique_ptr<weld::Container> m_xContainer2;
213 std::unique_ptr<weld::Image> m_spSymbol;
214 std::unique_ptr<SeriesHeaderEdit> m_spSeriesName;
215 std::unique_ptr<weld::Image> m_spColorBar;
219
220 void notifyChanges();
221 DECL_LINK( ImplUpdateDataHdl, Timer*, void );
222 DECL_LINK( SeriesNameEdited, SeriesHeaderEdit&, void );
223
224 static OUString GetChartTypeImage(
225 const rtl::Reference< ::chart::ChartType > & xChartType,
226 bool bSwapXAndYAxis
227 );
228
230 sal_Int32 m_nWidth;
232};
233
235 : m_aUpdateDataTimer( "SeriesHeader UpdateDataTimer" )
236 , m_xBuilder1(Application::CreateBuilder(pParent, "modules/schart/ui/columnfragment.ui"))
237 , m_xBuilder2(Application::CreateBuilder(pColorParent, "modules/schart/ui/imagefragment.ui"))
238 , m_pParent(pParent)
239 , m_pColorParent(pColorParent)
240 , m_xContainer1(m_xBuilder1->weld_container("container"))
241 , m_xContainer2(m_xBuilder2->weld_container("container"))
242 , m_spSymbol(m_xBuilder1->weld_image("image"))
243 , m_spSeriesName(new SeriesHeaderEdit(m_xBuilder1->weld_entry("entry")))
244 , m_spColorBar(m_xBuilder2->weld_image("image"))
245 , m_xDevice(Application::GetDefaultDevice())
246 , m_nStartCol( 0 )
247 , m_nEndCol( 0 )
248 , m_nWidth( 42 )
249 , m_bSeriesNameChangePending( false )
250{
251 m_aUpdateDataTimer.SetInvokeHandler(LINK(this, SeriesHeader, ImplUpdateDataHdl));
253
254 m_spSeriesName->SetModifyHdl(LINK(this, SeriesHeader, SeriesNameEdited));
255 Show();
256}
257
259{
261 m_pParent->move(m_xContainer1.get(), nullptr);
262 m_pColorParent->move(m_xContainer2.get(), nullptr);
263}
264
266{
269}
270
272{
274 {
276 }
277}
278
279void SeriesHeader::SetColor( const Color & rCol )
280{
281 m_aColor = rCol;
282}
283
285{
286 // chart type symbol
288 aSize = m_xDevice->LogicToPixel(aSize, MapMode(MapUnit::MapAppFont));
289 m_spSymbol->set_size_request(aSize.Width(), aSize.Height());
290
291 // series name edit field
292 m_spSeriesName->set_margin_start(2);
293
294 sal_Int32 nHeightPx = m_xDevice->LogicToPixel(Size(0, 12), MapMode(MapUnit::MapAppFont)).Height();
295 m_spSeriesName->set_size_request(m_nWidth - aSize.Width() - 2, nHeightPx);
296
297 // color bar
298 nHeightPx = m_xDevice->LogicToPixel(Size(0, 3), MapMode(MapUnit::MapAppFont)).Height();
299 m_spColorBar->set_size_request(m_nWidth, nHeightPx);
300
301 ScopedVclPtr<VirtualDevice> xVirDev(m_spColorBar->create_virtual_device());
302 xVirDev->SetOutputSizePixel(Size(m_nWidth, nHeightPx));
303 xVirDev->SetFillColor(m_aColor);
304 xVirDev->SetLineColor(m_aColor);
305 xVirDev->DrawRect(tools::Rectangle(Point(0, 0), aSize));
306 m_spColorBar->set_image(xVirDev.get());
307}
308
309void SeriesHeader::SetWidth( sal_Int32 nWidth )
310{
311 m_nWidth = nWidth;
312 SetPos();
313}
314
315void SeriesHeader::SetPixelWidth( sal_Int32 nWidth )
316{
317 SetWidth(nWidth);
318}
319
321 const rtl::Reference< ChartType > & xChartType,
322 bool bSwapXAndYAxis
323)
324{
325 m_spSymbol->set_from_icon_name( GetChartTypeImage( xChartType, bSwapXAndYAxis ) );
326}
327
328void SeriesHeader::SetSeriesName( const OUString & rName )
329{
330 m_spSeriesName->SetText(rName);
331}
332
333void SeriesHeader::SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol )
334{
335 m_nStartCol = nStartCol;
336 m_nEndCol = std::max(nEndCol, nStartCol);
337 m_spSeriesName->setStartColumn( nStartCol );
338}
339
341{
342 m_xContainer1->show();
343 m_xContainer2->show();
344}
345
347{
348 m_xContainer1->hide();
349 m_xContainer2->hide();
350}
351
353{
354 m_aChangeLink = rLink;
355}
356
357IMPL_LINK_NOARG(SeriesHeader, ImplUpdateDataHdl, Timer*, void)
358{
359 notifyChanges();
360}
361
363{
364 m_bSeriesNameChangePending = true;
365 m_aUpdateDataTimer.Start();
366}
367
369{
370 m_spSeriesName->SetGetFocusHdl( rLink );
371}
372
374{
375 return m_spSeriesName->HasFocus();
376}
377
379 const rtl::Reference< ChartType > & xChartType,
380 bool bSwapXAndYAxis
381)
382{
383 OUString aResult;
384 if( !xChartType.is())
385 return aResult;
386 OUString aChartTypeName( xChartType->getChartType());
387
388 if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_AREA )
389 {
390 aResult = BMP_TYPE_AREA;
391 }
392 else if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_COLUMN )
393 {
394 if( bSwapXAndYAxis )
395 aResult = BMP_TYPE_BAR;
396 else
397 aResult = BMP_TYPE_COLUMN;
398 }
399 else if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_LINE )
400 {
401 aResult = BMP_TYPE_LINE;
402 }
403 else if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_SCATTER )
404 {
405 aResult = BMP_TYPE_XY;
406 }
407 else if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
408 {
409 aResult = BMP_TYPE_PIE;
410 }
411 else if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_NET
412 || aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET )
413 {
414 aResult = BMP_TYPE_NET;
415 }
416 else if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK )
417 {
418 // @todo: correct image for candle-stick type
419 aResult = BMP_TYPE_STOCK;
420 }
421 else if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE )
422 {
423 aResult = BMP_TYPE_BUBBLE;
424 }
425
426 return aResult;
427}
428
429} // namespace impl
430
431namespace
432{
433
439bool lcl_SeriesHeaderHasFocus(
440 const std::vector< std::shared_ptr< ::chart::impl::SeriesHeader > > & rSeriesHeader,
441 sal_Int32 * pOutIndex = nullptr )
442{
443 sal_Int32 nIndex = 0;
444 for (auto const& elem : rSeriesHeader)
445 {
446 if(elem->HasFocus())
447 {
448 if( pOutIndex )
449 *pOutIndex = nIndex;
450 return true;
451 }
452 ++nIndex;
453 }
454 return false;
455}
456
457sal_Int32 lcl_getColumnInDataOrHeader(
458 sal_uInt16 nCol, const std::vector< std::shared_ptr< ::chart::impl::SeriesHeader > > & rSeriesHeader )
459{
460 sal_Int32 nColIdx = 0;
461 bool bHeaderHasFocus( lcl_SeriesHeaderHasFocus( rSeriesHeader, &nColIdx ));
462
463 if( bHeaderHasFocus )
464 nColIdx = lcl_getColumnInData( static_cast< sal_uInt16 >( rSeriesHeader[nColIdx]->GetStartColumn()));
465 else
466 nColIdx = lcl_getColumnInData( nCol );
467
468 return nColIdx;
469}
470
471} // anonymous namespace
472
473DataBrowser::DataBrowser(const css::uno::Reference<css::awt::XWindow> &rParent,
474 weld::Container* pColumns, weld::Container* pColors) :
475 ::svt::EditBrowseBox(VCLUnoHelper::GetWindow(rParent),
477 WB_BORDER | WB_TABSTOP, BrowserStdFlags ),
478 m_nSeekRow( 0 ),
479 m_bIsReadOnly( false ),
480 m_bDataValid( true ),
481 m_aNumberEditField(VclPtr<FormattedControl>::Create(&EditBrowseBox::GetDataWindow(), false)),
482 m_aTextEditField(VclPtr<EditControl>::Create(&EditBrowseBox::GetDataWindow())),
483 m_pColumnsWin(pColumns),
484 m_pColorsWin(pColors),
485 m_rNumberEditController( new ::svt::FormattedFieldCellController( m_aNumberEditField.get() )),
486 m_rTextEditController( new ::svt::EditCellController( m_aTextEditField.get() ))
487{
488 Formatter& rFormatter = m_aNumberEditField->get_formatter();
489 rFormatter.SetDefaultValue( std::numeric_limits<double>::quiet_NaN() );
490 rFormatter.TreatAsNumber( true );
491 RenewTable();
492}
493
495{
496 disposeOnce();
497}
498
500{
501 m_aSeriesHeaders.clear();
505}
506
508{
509 return ! IsReadOnly()
510 && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ));
511}
512
514{
515 return ! IsReadOnly();
516}
517
519{
520 return ! IsReadOnly()
521 && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
522 && ( GetCurRow() >= 0 )
523 && ( GetRowCount() > 1 );
524}
525
527{
528 // if a series header has the focus
529 if( lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
530 return true;
531
532 return ! IsReadOnly()
533 && ( GetCurColumnId() > 1 )
534 && ( ColCount() > 2 );
535}
536
538{
539 return ! IsReadOnly()
540 && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
541 && ( GetCurRow() > 0 )
542 && ( GetCurRow() <= GetRowCount() - 1 );
543}
544
546{
547 return ! IsReadOnly()
548 && ( !lcl_SeriesHeaderHasFocus( m_aSeriesHeaders ))
549 && ( GetCurRow() >= 0 )
550 && ( GetCurRow() < GetRowCount() - 1 );
551}
552
554{
555 // if a series header (except the last one) has the focus
556 {
557 sal_Int32 nColIndex(0);
558 if( lcl_SeriesHeaderHasFocus( m_aSeriesHeaders, &nColIndex ))
559 return (o3tl::make_unsigned( nColIndex ) <= (m_aSeriesHeaders.size() - 1)) && (static_cast< sal_uInt32 >( nColIndex ) != 0);
560 }
561
562 sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
563 return ! IsReadOnly()
564 && ( nColIdx > 1 )
565 && ( nColIdx <= ColCount() - 2 )
567 && !m_apDataBrowserModel->isCategoriesColumn( nColIdx );
568}
569
571{
572 // if a series header (except the last one) has the focus
573 {
574 sal_Int32 nColIndex(0);
575 if( lcl_SeriesHeaderHasFocus( m_aSeriesHeaders, &nColIndex ))
576 return (o3tl::make_unsigned( nColIndex ) < (m_aSeriesHeaders.size() - 1));
577 }
578
579 sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
580 return ! IsReadOnly()
581 && ( nColIdx > 0 )
582 && ( nColIdx < ColCount()-2 )
584 && !m_apDataBrowserModel->isCategoriesColumn( nColIdx );
585}
586
588{
589 for( const auto& spHeader : m_aSeriesHeaders )
590 spHeader->applyChanges();
591 m_aSeriesHeaders.clear();
592}
593
595{
597 return;
598
599 sal_Int32 nOldRow = GetCurRow();
600 sal_uInt16 nOldColId = GetCurColumnId();
601
602 bool bLastUpdateMode = GetUpdateMode();
603 SetUpdateMode( false );
604
605 if( IsModified() )
606 SaveModified();
607
609
611 RowRemoved( 1, GetRowCount() );
612
613 // for row numbers
614 InsertHandleColumn( static_cast< sal_uInt16 >(
615 GetDataWindow().LogicToPixel( Size( 42, 0 )).getWidth() ));
616
617 OUString aDefaultSeriesName(SchResId(STR_COLUMN_LABEL));
618 replaceParamterInString( aDefaultSeriesName, u"%COLUMNNUMBER", OUString::number( 24 ) );
619 sal_Int32 nColumnWidth = GetDataWindow().GetTextWidth( aDefaultSeriesName )
620 + GetDataWindow().LogicToPixel(Point(8 + impl::SeriesHeader::GetRelativeAppFontXPosForNameField(), 0), MapMode(MapUnit::MapAppFont)).X();
621 sal_Int32 nColumnCount = m_apDataBrowserModel->getColumnCount();
622 // nRowCount is a member of a base class
623 sal_Int32 nRowCountLocal = m_apDataBrowserModel->getMaxRowCount();
624 for( sal_Int32 nColIdx=1; nColIdx<=nColumnCount; ++nColIdx )
625 {
626 InsertDataColumn( static_cast< sal_uInt16 >( nColIdx ), GetColString( nColIdx ), nColumnWidth );
627 }
628
629 RowInserted( 1, nRowCountLocal );
630 GoToRow( std::min( nOldRow, GetRowCount() - 1 ));
631 GoToColumnId( std::min( nOldColId, static_cast< sal_uInt16 >( ColCount() - 1 )));
632
633 // fill series headers
634 clearHeaders();
635 const DataBrowserModel::tDataHeaderVector& aHeaders( m_apDataBrowserModel->getDataHeaders());
636 Link<impl::SeriesHeaderEdit&,void> aFocusLink( LINK( this, DataBrowser, SeriesHeaderGotFocus ));
637 Link<impl::SeriesHeaderEdit&,void> aSeriesHeaderChangedLink( LINK( this, DataBrowser, SeriesHeaderChanged ));
638
639 for (auto const& elemHeader : aHeaders)
640 {
641 auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, m_pColorsWin );
642 Color nColor;
643 // @todo: Set "DraftColor", i.e. interpolated colors for gradients, bitmaps, etc.
644 if( elemHeader.m_xDataSeries.is() &&
645 ( elemHeader.m_xDataSeries->getPropertyValue( "Color" ) >>= nColor ))
646 spHeader->SetColor( nColor );
647 spHeader->SetChartType( elemHeader.m_xChartType, elemHeader.m_bSwapXAndYAxis );
648 spHeader->SetSeriesName(
649 elemHeader.m_xDataSeries->getLabelForRole(
650 elemHeader.m_xChartType.is() ?
651 elemHeader.m_xChartType->getRoleOfSequenceForSeriesLabel() :
652 OUString("values-y")));
653 // index is 1-based, as 0 is for the column that contains the row-numbers
654 spHeader->SetRange( elemHeader.m_nStartColumn + 1, elemHeader.m_nEndColumn + 1 );
655 spHeader->SetGetFocusHdl( aFocusLink );
656 spHeader->SetEditChangedHdl( aSeriesHeaderChangedLink );
657 m_aSeriesHeaders.push_back( spHeader );
658 }
659
661 SetUpdateMode( bLastUpdateMode );
662 ActivateCell();
663 Invalidate();
664}
665
666OUString DataBrowser::GetColString( sal_Int32 nColumnId ) const
667{
668 OSL_ASSERT(m_apDataBrowserModel);
669 if( nColumnId > 0 )
670 return m_apDataBrowserModel->getRoleOfColumn( nColumnId - 1 );
671 return OUString();
672}
673
674OUString DataBrowser::GetCellText( sal_Int32 nRow, sal_uInt16 nColumnId ) const
675{
676 OUString aResult;
677
678 if( nColumnId == 0 )
679 {
680 aResult = OUString::number(nRow + 1);
681 }
682 else if( nRow >= 0 && m_apDataBrowserModel)
683 {
684 sal_Int32 nColIndex = static_cast< sal_Int32 >( nColumnId ) - 1;
685
686 if( m_apDataBrowserModel->getCellType( nColIndex ) == DataBrowserModel::NUMBER )
687 {
688 double fData( m_apDataBrowserModel->getCellNumber( nColIndex, nRow ));
689
690 if( ! std::isnan( fData ) &&
692 {
693 bool bColorChanged = false;
694 Color nLabelColor;
695 aResult = m_spNumberFormatterWrapper->getFormattedString(
696 GetNumberFormatKey( nColumnId ),
697 fData, nLabelColor, bColorChanged );
698 }
699 }
700 else if( m_apDataBrowserModel->getCellType( nColIndex ) == DataBrowserModel::TEXTORDATE )
701 {
702 uno::Any aAny = m_apDataBrowserModel->getCellAny( nColIndex, nRow );
703 OUString aText;
704 double fDouble=0.0;
705 if( aAny>>=aText )
706 aResult = aText;
707 else if( aAny>>=fDouble )
708 {
709 if( ! std::isnan( fDouble ) && m_spNumberFormatterWrapper )
710 {
711 // If a numberformat was available here we could directly
712 // obtain the corresponding edit format in
713 // getDateTimeInputNumberFormat() instead of doing the
714 // guess work.
715 sal_Int32 nNumberFormat = DiagramHelper::getDateTimeInputNumberFormat(
716 m_xChartDoc, fDouble );
717 Color nLabelColor;
718 bool bColorChanged = false;
719 aResult = m_spNumberFormatterWrapper->getFormattedString(
720 nNumberFormat, fDouble, nLabelColor, bColorChanged );
721 }
722 }
723 }
724 else
725 {
726 OSL_ASSERT( m_apDataBrowserModel->getCellType( nColIndex ) == DataBrowserModel::TEXT );
727 aResult = m_apDataBrowserModel->getCellText( nColIndex, nRow );
728 }
729 }
730
731 return aResult;
732}
733
734double DataBrowser::GetCellNumber( sal_Int32 nRow, sal_uInt16 nColumnId ) const
735{
736 if(( nColumnId >= 1 ) && ( nRow >= 0 ) && m_apDataBrowserModel)
737 {
738 return m_apDataBrowserModel->getCellNumber(
739 static_cast< sal_Int32 >( nColumnId ) - 1, nRow );
740 }
741
742 return std::numeric_limits<double>::quiet_NaN();
743}
744
746{
747 bool bLastUpdateMode = GetUpdateMode();
748 SetUpdateMode( false );
749
752 SetUpdateMode( bLastUpdateMode );
753}
754
755void DataBrowser::SetReadOnly( bool bNewState )
756{
757 if( m_bIsReadOnly != bNewState )
758 {
759 m_bIsReadOnly = bNewState;
760 Invalidate();
762 }
763}
764
766{
767 EditBrowseBox::CursorMoved();
768
769 if( GetUpdateMode() )
770 m_aCursorMovedHdlLink.Call( this );
771}
772
774{
775 if( !m_bDataValid )
777 else
778 EditBrowseBox::MouseButtonDown( rEvt );
779}
780
782{
783 std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
784 VclMessageType::Warning, VclButtonsType::Ok,
785 SchResId(STR_INVALID_NUMBER)));
786 xWarn->run();
787}
788
790{
791 std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
792 VclMessageType::Question, VclButtonsType::YesNo,
793 SchResId(STR_DATA_EDITOR_INCORRECT_INPUT)));
794 return xQueryBox->run() == RET_YES;
795}
796
798{
799 bool bValid = true;
800 const sal_Int32 nCol = lcl_getColumnInData( GetCurColumnId());
801
802 if( m_apDataBrowserModel->getCellType( nCol ) == DataBrowserModel::NUMBER )
803 {
804 sal_uInt32 nDummy = 0;
805 double fDummy = 0.0;
806 OUString aText(m_aNumberEditField->get_widget().get_text());
807
808 if( !aText.isEmpty() &&
810 m_spNumberFormatterWrapper->getSvNumberFormatter() &&
811 ! m_spNumberFormatterWrapper->getSvNumberFormatter()->IsNumberFormat(
812 aText, nDummy, fDummy ))
813 {
814 bValid = false;
815 }
816 }
817
818 return bValid;
819}
820
822{
824 m_aCursorMovedHdlLink.Call( this );
825}
826
828 const rtl::Reference<::chart::ChartModel> & xChartDoc )
829{
830 m_xChartDoc = xChartDoc;
831
834 std::make_shared<NumberFormatterWrapper>(m_xChartDoc);
835
836 Formatter& rFormatter = m_aNumberEditField->get_formatter();
837 rFormatter.SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() );
838
839 RenewTable();
840
841 const sal_Int32 nColCnt = m_apDataBrowserModel->getColumnCount();
842 const sal_Int32 nRowCnt = m_apDataBrowserModel->getMaxRowCount();
843 if( nRowCnt && nColCnt )
844 {
845 GoToRow( 0 );
846 GoToColumnId( 1 );
847 }
848}
849
851{
852 sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
853
854 if( nColIdx >= 0 && m_apDataBrowserModel)
855 {
856 // save changes made to edit-field
857 if( IsModified() )
858 SaveModified();
859
860 m_apDataBrowserModel->insertDataSeries( nColIdx );
861 RenewTable();
862 }
863}
864
866{
867 sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
868
869 if( nColIdx >= 0 && m_apDataBrowserModel)
870 {
871 // save changes made to edit-field
872 if( IsModified() )
873 SaveModified();
874
875 m_apDataBrowserModel->insertComplexCategoryLevel( nColIdx );
876 RenewTable();
877 }
878}
879
881{
882 sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
883
884 if( nColIdx >= 0 && m_apDataBrowserModel)
885 {
886 // save changes made to edit-field
887 if( IsModified() )
888 SaveModified();
889
890 m_bDataValid = true;
891 m_apDataBrowserModel->removeDataSeriesOrComplexCategoryLevel( nColIdx );
892 RenewTable();
893 }
894}
895
897{
898 sal_Int32 nRowIdx = GetCurRow();
899
900 if( nRowIdx >= 0 && m_apDataBrowserModel)
901 {
902 // save changes made to edit-field
903 if( IsModified() )
904 SaveModified();
905
906 m_apDataBrowserModel->insertDataPointForAllSeries( nRowIdx );
907 RenewTable();
908 }
909}
910
912{
913 sal_Int32 nRowIdx = GetCurRow();
914
915 if( nRowIdx >= 0 && m_apDataBrowserModel)
916 {
917 // save changes made to edit-field
918 if( IsModified() )
919 SaveModified();
920
921 m_bDataValid = true;
922 m_apDataBrowserModel->removeDataPointForAllSeries( nRowIdx );
923 RenewTable();
924 }
925}
926
928{
929 sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
930
931 if( !(nColIdx > 0 && m_apDataBrowserModel))
932 return;
933
934 // save changes made to edit-field
935 if( IsModified() )
936 SaveModified();
937
938 m_apDataBrowserModel->swapDataSeries( nColIdx - 1 );
939
940 // keep cursor in swapped column
941 if(( 0 < GetCurColumnId() ) && ( GetCurColumnId() <= ColCount() - 1 ))
942 {
944 }
945 RenewTable();
946}
947
949{
950 sal_Int32 nColIdx = lcl_getColumnInDataOrHeader( GetCurColumnId(), m_aSeriesHeaders );
951
952 if( !(nColIdx >= 0 && m_apDataBrowserModel))
953 return;
954
955 // save changes made to edit-field
956 if( IsModified() )
957 SaveModified();
958
959 m_apDataBrowserModel->swapDataSeries( nColIdx );
960
961 // keep cursor in swapped column
962 if( GetCurColumnId() < ColCount() - 1 )
963 {
965 }
966 RenewTable();
967}
968
970{
971 sal_Int32 nRowIdx = GetCurRow();
972
973 if( !(nRowIdx > 0 && m_apDataBrowserModel))
974 return;
975
976 // save changes made to edit-field
977 if( IsModified() )
978 SaveModified();
979
980 m_apDataBrowserModel->swapDataPointForAllSeries( nRowIdx - 1 );
981
982 // keep cursor in swapped row
983 if(( 0 < GetCurRow() ) && ( GetCurRow() <= GetRowCount() - 1 ))
984 {
986 }
987 RenewTable();
988}
989
991{
992 sal_Int32 nRowIdx = GetCurRow();
993
994 if( !(nRowIdx >= 0 && m_apDataBrowserModel))
995 return;
996
997 // save changes made to edit-field
998 if( IsModified() )
999 SaveModified();
1000
1001 m_apDataBrowserModel->swapDataPointForAllSeries( nRowIdx );
1002
1003 // keep cursor in swapped row
1004 if( GetCurRow() < GetRowCount() - 1 )
1005 {
1007 }
1008 RenewTable();
1009}
1010
1012{
1013 m_aCursorMovedHdlLink = rLink;
1014}
1015
1016// implementations for ::svt::EditBrowseBox (pure virtual methods)
1018 OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId ) const
1019{
1020 Point aPos( rRect.TopLeft());
1021 aPos.AdjustX(1 );
1022
1023 OUString aText = GetCellText( m_nSeekRow, nColumnId );
1024 Size TxtSize( GetDataWindow().GetTextWidth( aText ), GetDataWindow().GetTextHeight());
1025
1026 // clipping
1027 if( aPos.X() < rRect.Right() || aPos.X() + TxtSize.Width() > rRect.Right() ||
1028 aPos.Y() < rRect.Top() || aPos.Y() + TxtSize.Height() > rRect.Bottom())
1029 rDev.SetClipRegion(vcl::Region(rRect));
1030
1031 // allow for a disabled control ...
1032 bool bEnabled = IsEnabled();
1033 Color aOriginalColor = rDev.GetTextColor();
1034 if( ! bEnabled )
1035 rDev.SetTextColor( GetSettings().GetStyleSettings().GetDisableColor() );
1036
1037 // draw the text
1038 rDev.DrawText( aPos, aText );
1039
1040 // reset the color (if necessary)
1041 if( ! bEnabled )
1042 rDev.SetTextColor( aOriginalColor );
1043
1044 if( rDev.IsClipRegion())
1045 rDev.SetClipRegion();
1046}
1047
1048bool DataBrowser::SeekRow( sal_Int32 nRow )
1049{
1050 if( ! EditBrowseBox::SeekRow( nRow ))
1051 return false;
1052
1053 if( nRow < 0 )
1054 m_nSeekRow = - 1;
1055 else
1056 m_nSeekRow = nRow;
1057
1058 return true;
1059}
1060
1061bool DataBrowser::IsTabAllowed( bool bForward ) const
1062{
1063 sal_Int32 nRow = GetCurRow();
1064 sal_Int32 nCol = GetCurColumnId();
1065
1066 // column 0 is header-column
1067 sal_Int32 nBadCol = bForward
1068 ? GetColumnCount() - 1
1069 : 1;
1070 sal_Int32 nBadRow = bForward
1071 ? GetRowCount() - 1
1072 : 0;
1073
1074 if( !m_bDataValid )
1075 {
1076 const_cast< DataBrowser* >( this )->ShowWarningBox();
1077 return false;
1078 }
1079
1080 return ( nRow != nBadRow ||
1081 nCol != nBadCol );
1082}
1083
1084::svt::CellController* DataBrowser::GetController( sal_Int32 /*nRow*/, sal_uInt16 nCol )
1085{
1086 if( m_bIsReadOnly )
1087 return nullptr;
1088
1089 if( CellContainsNumbers( nCol ))
1090 {
1091 Formatter& rFormatter = m_aNumberEditField->get_formatter();
1092 rFormatter.UseInputStringForFormatting();
1093 rFormatter.SetFormatKey( GetNumberFormatKey( nCol ));
1095 }
1096
1097 return m_rTextEditController.get();
1098}
1099
1101 ::svt::CellControllerRef& rController, sal_Int32 nRow, sal_uInt16 nCol )
1102{
1103 if( rController == m_rTextEditController )
1104 {
1105 OUString aText( GetCellText( nRow, nCol ) );
1106 weld::Entry& rEntry = m_aTextEditField->get_widget();
1107 rEntry.set_text(aText);
1108 rEntry.select_region(0, -1);
1109 }
1110 else if( rController == m_rNumberEditController )
1111 {
1112 // treat invalid and empty text as Nan
1113 Formatter& rFormatter = m_aNumberEditField->get_formatter();
1114 rFormatter.EnableNotANumber( true );
1115 if( std::isnan( GetCellNumber( nRow, nCol )))
1116 rFormatter.SetTextValue( OUString());
1117 else
1118 rFormatter.SetValue( GetCellNumber( nRow, nCol ) );
1119 weld::Entry& rEntry = m_aNumberEditField->get_widget();
1120 rEntry.select_region(0, -1);
1121 }
1122 else
1123 {
1124 OSL_FAIL( "Invalid Controller" );
1125 }
1126}
1127
1128bool DataBrowser::CellContainsNumbers( sal_uInt16 nCol ) const
1129{
1131 return false;
1132 return m_apDataBrowserModel->getCellType( lcl_getColumnInData( nCol )) == DataBrowserModel::NUMBER;
1133}
1134
1135sal_uInt32 DataBrowser::GetNumberFormatKey( sal_uInt16 nCol ) const
1136{
1138 return 0;
1139 return m_apDataBrowserModel->getNumberFormatKey( lcl_getColumnInData( nCol ) );
1140}
1141
1142bool DataBrowser::isDateTimeString( const OUString& aInputString, double& fOutDateTimeValue )
1143{
1144 sal_uInt32 nNumberFormat=0;
1145 SvNumberFormatter* pSvNumberFormatter = m_spNumberFormatterWrapper ? m_spNumberFormatterWrapper->getSvNumberFormatter() : nullptr;
1146 if( !aInputString.isEmpty() && pSvNumberFormatter && pSvNumberFormatter->IsNumberFormat( aInputString, nNumberFormat, fOutDateTimeValue ) )
1147 {
1148 SvNumFormatType nType = pSvNumberFormatter->GetType( nNumberFormat);
1149 return (nType & SvNumFormatType::DATE) || (nType & SvNumFormatType::TIME);
1150 }
1151 return false;
1152}
1153
1155{
1156 if( ! IsModified() )
1157 return true;
1158
1159 bool bChangeValid = true;
1160
1161 const sal_Int32 nRow = GetCurRow();
1162 const sal_Int32 nCol = lcl_getColumnInData( GetCurColumnId());
1163
1164 OSL_ENSURE( nRow >= 0 || nCol >= 0, "This cell should not be modified!" );
1165
1166 SvNumberFormatter* pSvNumberFormatter = m_spNumberFormatterWrapper ? m_spNumberFormatterWrapper->getSvNumberFormatter() : nullptr;
1167 switch( m_apDataBrowserModel->getCellType( nCol ))
1168 {
1170 {
1171 sal_uInt32 nDummy = 0;
1172 double fDummy = 0.0;
1173 OUString aText(m_aNumberEditField->get_widget().get_text());
1174 // an empty string is valid, if no numberformatter exists, all
1175 // values are treated as valid
1176 if( !aText.isEmpty() && pSvNumberFormatter &&
1177 ! pSvNumberFormatter->IsNumberFormat( aText, nDummy, fDummy ) )
1178 {
1179 bChangeValid = false;
1180 }
1181 else
1182 {
1183 Formatter& rFormatter = m_aNumberEditField->get_formatter();
1184 double fData = rFormatter.GetValue();
1185 bChangeValid = m_apDataBrowserModel->setCellNumber( nCol, nRow, fData );
1186 }
1187 }
1188 break;
1190 {
1191 weld::Entry& rEntry = m_aTextEditField->get_widget();
1192 OUString aText(rEntry.get_text());
1193 double fValue = 0.0;
1194 bChangeValid = false;
1195 if( isDateTimeString( aText, fValue ) )
1196 bChangeValid = m_apDataBrowserModel->setCellAny( nCol, nRow, uno::Any( fValue ) );
1197 if(!bChangeValid)
1198 bChangeValid = m_apDataBrowserModel->setCellAny( nCol, nRow, uno::Any( aText ) );
1199 }
1200 break;
1202 {
1203 weld::Entry& rEntry = m_aTextEditField->get_widget();
1204 OUString aText(rEntry.get_text());
1205 bChangeValid = m_apDataBrowserModel->setCellText( nCol, nRow, aText );
1206 }
1207 break;
1208 }
1209
1210 // the first valid change changes this to true
1211 if( bChangeValid )
1212 {
1215 if( pCtrl )
1216 pCtrl->SaveValue();
1217 }
1218
1219 return bChangeValid;
1220}
1221
1223{
1224 SaveModified();
1225
1226 // apply changes made to series headers
1227 for( const auto& spHeader : m_aSeriesHeaders )
1228 spHeader->applyChanges();
1229
1230 if( m_bDataValid )
1231 return true;
1232 else
1233 return ShowQueryBox();
1234}
1235
1236void DataBrowser::ColumnResized( sal_uInt16 nColId )
1237{
1238 bool bLastUpdateMode = GetUpdateMode();
1239 SetUpdateMode( false );
1240
1241 EditBrowseBox::ColumnResized( nColId );
1243 SetUpdateMode( bLastUpdateMode );
1244}
1245
1247{
1248 bool bLastUpdateMode = GetUpdateMode();
1249 SetUpdateMode( false );
1250
1251 EditBrowseBox::EndScroll();
1253
1254 SetUpdateMode( bLastUpdateMode );
1255}
1256
1258{
1259 clearHeaders();
1260 DataBrowserModel::tDataHeaderVector aHeaders( m_apDataBrowserModel->getDataHeaders());
1261 Link<impl::SeriesHeaderEdit&,void> aFocusLink( LINK( this, DataBrowser, SeriesHeaderGotFocus ));
1262 Link<impl::SeriesHeaderEdit&,void> aSeriesHeaderChangedLink( LINK( this, DataBrowser, SeriesHeaderChanged ));
1263
1264 for (auto const& elemHeader : aHeaders)
1265 {
1266 auto spHeader = std::make_shared<impl::SeriesHeader>( m_pColumnsWin, m_pColorsWin );
1267 Color nColor;
1268 if( elemHeader.m_xDataSeries.is() &&
1269 ( elemHeader.m_xDataSeries->getPropertyValue( "Color" ) >>= nColor ))
1270 spHeader->SetColor( nColor );
1271 spHeader->SetChartType( elemHeader.m_xChartType, elemHeader.m_bSwapXAndYAxis );
1272 spHeader->SetSeriesName(
1273 elemHeader.m_xDataSeries->getLabelForRole(
1274 elemHeader.m_xChartType.is() ?
1275 elemHeader.m_xChartType->getRoleOfSequenceForSeriesLabel() :
1276 OUString( "values-y")));
1277 spHeader->SetRange( elemHeader.m_nStartColumn + 1, elemHeader.m_nEndColumn + 1 );
1278 spHeader->SetGetFocusHdl( aFocusLink );
1279 spHeader->SetEditChangedHdl( aSeriesHeaderChangedLink );
1280 m_aSeriesHeaders.push_back( spHeader );
1281 }
1282
1284}
1285
1287{
1288 sal_uInt16 nColCount = GetColumnCount();
1289 sal_uInt32 nCurrentPos = GetPosPixel().getX();
1290 sal_uInt32 nMaxPos = nCurrentPos + GetOutputSizePixel().getWidth();
1291 sal_uInt32 nStartPos = nCurrentPos;
1292
1293 // width of header column
1294 nCurrentPos += GetColumnWidth( 0 );
1295
1297 weld::Container* pColorWin = m_pColorsWin;
1298 pWin->set_margin_start(nCurrentPos);
1299 pColorWin->set_margin_start(nCurrentPos);
1300
1301 tSeriesHeaderContainer::iterator aIt( m_aSeriesHeaders.begin());
1302 sal_uInt16 i = GetFirstVisibleColNumber();
1303 while( (aIt != m_aSeriesHeaders.end()) && ((*aIt)->GetStartColumn() < i) )
1304 {
1305 (*aIt)->Hide();
1306 ++aIt;
1307 }
1308 for( ; i < nColCount && aIt != m_aSeriesHeaders.end(); ++i )
1309 {
1310 if( (*aIt)->GetStartColumn() == i )
1311 nStartPos = nCurrentPos;
1312
1313 nCurrentPos += (GetColumnWidth( i ));
1314
1315 if( (*aIt)->GetEndColumn() == i )
1316 {
1317 if( nStartPos < nMaxPos )
1318 {
1319 (*aIt)->SetPixelWidth( nCurrentPos - nStartPos );
1320 (*aIt)->Show();
1321
1322 if (pWin)
1323 {
1324 pWin->set_margin_start(nStartPos);
1325 pColorWin->set_margin_start(nStartPos);
1326 pWin = pColorWin = nullptr;
1327 }
1328
1329 }
1330 else
1331 (*aIt)->Hide();
1332 ++aIt;
1333 }
1334 }
1335}
1336
1337IMPL_LINK( DataBrowser, SeriesHeaderGotFocus, impl::SeriesHeaderEdit&, rEdit, void )
1338{
1339 rEdit.SetShowWarningBox( !m_bDataValid );
1340
1341 if( !m_bDataValid )
1342 GoToCell( 0, 0 );
1343 else
1344 {
1345 MakeFieldVisible( GetCurRow(), static_cast< sal_uInt16 >( rEdit.getStartColumn()) );
1346 ActivateCell();
1347 m_aCursorMovedHdlLink.Call( this );
1348 }
1349}
1350
1351IMPL_LINK( DataBrowser, SeriesHeaderChanged, impl::SeriesHeaderEdit&, rEdit, void )
1352{
1354 m_apDataBrowserModel->getDataSeriesByColumn( rEdit.getStartColumn() - 1 );
1355 if( !xSeries.is())
1356 return;
1357
1358 rtl::Reference< ChartType > xChartType(
1359 m_apDataBrowserModel->getHeaderForSeries( xSeries ).m_xChartType );
1360 if( xChartType.is())
1361 {
1363 DataSeriesHelper::getDataSequenceByRole( xSeries, xChartType->getRoleOfSequenceForSeriesLabel());
1364 if( xLabeledSeq.is())
1365 {
1366 Reference< container::XIndexReplace > xIndexReplace( xLabeledSeq->getLabel(), uno::UNO_QUERY );
1367 if( xIndexReplace.is())
1368 xIndexReplace->replaceByIndex(
1369 0, uno::Any( rEdit.GetText()));
1370 }
1371 }
1372}
1373
1374} // namespace chart
1375
1376/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define BROWSER_CURSORDOWN
#define BROWSER_CURSORLEFT
BrowserMode
#define BROWSER_CURSORRIGHT
#define BROWSER_CURSORUP
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
void RowRemoved(sal_Int32 nRow, sal_Int32 nNumRows=1, bool bDoPaint=true)
void SetUpdateMode(bool bUpdate)
bool GoToColumnId(sal_uInt16 nColId)
BrowserDataWin & GetDataWindow() const
void InsertDataColumn(sal_uInt16 nItemId, const OUString &rText, tools::Long nSize, HeaderBarItemBits nBits=HeaderBarItemBits::STDSTYLE, sal_uInt16 nPos=HEADERBAR_APPEND)
bool GoToRow(sal_Int32 nRow)
sal_Int32 GetCurRow() const
sal_uInt16 ColCount() const
void InsertHandleColumn(sal_uLong nWidth)
void RowModified(sal_Int32 nRow, sal_uInt16 nColId=BROWSER_INVALIDID)
sal_uInt16 GetCurColumnId() const
bool GetUpdateMode() const
void RowInserted(sal_Int32 nRow, sal_Int32 nNumRows=1, bool bDoPaint=true, bool bKeepSelection=false)
sal_uInt16 GetFirstVisibleColNumber() const
virtual sal_Int32 GetRowCount() const override
sal_uLong GetColumnWidth(sal_uInt16 nColumnId) const
void RemoveColumns()
sal_uInt16 GetColumnCount() const override
void SetTextValue(const OUString &rText)
void SetValue(double dVal)
void UseInputStringForFormatting()
void TreatAsNumber(bool bDoSo)
void SetFormatter(SvNumberFormatter *pFormatter, bool bResetFormat=true)
void SetFormatKey(sal_uLong nFormatKey)
void SetDefaultValue(double dDefault)
void EnableNotANumber(bool _bEnable)
double GetValue()
bool IsClipRegion() const
void SetTextColor(const Color &rColor)
void SetClipRegion()
const Color & GetTextColor() const
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
constexpr tools::Long Y() const
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SvNumFormatType GetType(sal_uInt32 nFIndex) const
bool IsNumberFormat(const OUString &sString, sal_uInt32 &F_Index, double &fOutNumber, SvNumInputOptions eInputOptions=SvNumInputOptions::NONE)
void Stop()
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
void disposeAndClear()
reference_type * get() const
std::vector< tDataHeader > tDataHeaderVector
weld::Container * m_pColorsWin
virtual bool IsTabAllowed(bool bForward) const override
tSeriesHeaderContainer m_aSeriesHeaders
virtual ::svt::CellController * GetController(sal_Int32 nRow, sal_uInt16 nCol) override
::svt::CellControllerRef m_rTextEditController
note: m_aTextEditField must precede this member!
virtual bool SaveModified() override
virtual void CursorMoved() override
bool MayMoveDownRows() const
DataBrowser(const css::uno::Reference< css::awt::XWindow > &rParent, weld::Container *pColumns, weld::Container *pColors)
double GetCellNumber(sal_Int32 nRow, sal_uInt16 nColumnId) const
returns the number in the given cell.
bool MayDeleteRow() const
bool IsDataValid() const
sal_uInt32 GetNumberFormatKey(sal_uInt16 nCol) const
virtual void ColumnResized(sal_uInt16 nColId) override
weld::Container * m_pColumnsWin
::svt::CellControllerRef m_rNumberEditController
note: m_aNumberEditField must precede this member!
OUString GetColString(sal_Int32 nColumnId) const
bool CellContainsNumbers(sal_uInt16 nCol) const
bool MayMoveUpRows() const
bool MayMoveRightColumns() const
void SetCursorMovedHdl(const Link< DataBrowser *, void > &rLink)
bool MayDeleteColumn() const
virtual OUString GetCellText(sal_Int32 nRow, sal_uInt16 nColId) const override
GetCellText returns the text at the given position.
virtual void PaintCell(OutputDevice &rDev, const tools::Rectangle &rRect, sal_uInt16 nColumnId) const override
void ImplAdjustHeaderControls()
virtual void Resize() override
virtual bool SeekRow(sal_Int32 nRow) override
bool isDateTimeString(const OUString &aInputString, double &fOutDateTimeValue)
virtual void EndScroll() override
bool IsReadOnly() const
Definition: DataBrowser.hxx:99
void SetReadOnly(bool bNewState)
virtual void MouseButtonDown(const BrowserMouseEvent &rEvt) override
sal_Int32 m_nSeekRow
the row that is currently painted
Link< DataBrowser *, void > m_aCursorMovedHdlLink
virtual void InitController(::svt::CellControllerRef &rController, sal_Int32 nRow, sal_uInt16 nCol) override
std::shared_ptr< NumberFormatterWrapper > m_spNumberFormatterWrapper
virtual ~DataBrowser() override
std::unique_ptr< DataBrowserModel > m_apDataBrowserModel
bool MayMoveLeftColumns() const
VclPtr< svt::EditControl > m_aTextEditField
rtl::Reference<::chart::ChartModel > m_xChartDoc
virtual void dispose() override
bool EndEditing()
confirms all pending changes to be ready to be closed
void SetDataFromModel(const rtl::Reference<::chart::ChartModel > &xChartDoc)
virtual void CellModified() override
bool MayInsertColumn() const
bool MayInsertRow() const
VclPtr< svt::FormattedControl > m_aNumberEditField
static sal_Int32 getDateTimeInputNumberFormat(const css::uno::Reference< css::util::XNumberFormatsSupplier > &xNumberFormatsSupplier, double fNumber)
void set_size_request(int nWidth, int nHeight)
void SetGetFocusHdl(const Link< SeriesHeaderEdit &, void > &rLink)
std::unique_ptr< weld::Entry > m_xControl
sal_Int32 getStartColumn() const
Definition: DataBrowser.cxx:94
Link< SeriesHeaderEdit &, void > m_aFocusInHdl
void SetShowWarningBox(bool bShowWarning)
Link< SeriesHeaderEdit &, void > m_aModifyHdl
DECL_LINK(MousePressHdl, const MouseEvent &, bool)
void SetModifyHdl(const Link< SeriesHeaderEdit &, void > &rLink)
void SetText(const OUString &rText)
Definition: DataBrowser.cxx:98
DECL_LINK(NameFocusIn, weld::Widget &, void)
DECL_LINK(NameEdited, weld::Entry &, void)
SeriesHeaderEdit(std::unique_ptr< weld::Entry > xControl)
void setStartColumn(sal_Int32 nStartColumn)
void set_margin_start(int nLeft)
weld::Container * m_pColorParent
static const sal_Int32 nSymbolHeight
void SetWidth(sal_Int32 nWidth)
sal_Int32 GetStartColumn() const
DECL_LINK(ImplUpdateDataHdl, Timer *, void)
std::unique_ptr< weld::Container > m_xContainer1
std::unique_ptr< weld::Image > m_spSymbol
void SetRange(sal_Int32 nStartCol, sal_Int32 nEndCol)
void SetColor(const Color &rCol)
weld::Container * m_pParent
void SetChartType(const rtl::Reference< ::chart::ChartType > &xChartType, bool bSwapXAndYAxis)
VclPtr< OutputDevice > m_xDevice
void SetGetFocusHdl(const Link< SeriesHeaderEdit &, void > &rLink)
static sal_Int32 GetRelativeAppFontXPosForNameField()
void applyChanges()
call this before destroying the class.
void SetPixelWidth(sal_Int32 nWidth)
void SetSeriesName(const OUString &rName)
sal_Int32 GetEndColumn() const
std::unique_ptr< weld::Builder > m_xBuilder2
DECL_LINK(SeriesNameEdited, SeriesHeaderEdit &, void)
void SetEditChangedHdl(const Link< SeriesHeaderEdit &, void > &rLink)
std::unique_ptr< SeriesHeaderEdit > m_spSeriesName
SeriesHeader(weld::Container *pParent, weld::Container *pColorParent)
Link< SeriesHeaderEdit &, void > m_aChangeLink
static const sal_Int32 nSymbolDistance
std::unique_ptr< weld::Container > m_xContainer2
static OUString GetChartTypeImage(const rtl::Reference< ::chart::ChartType > &xChartType, bool bSwapXAndYAxis)
std::unique_ptr< weld::Builder > m_xBuilder1
std::unique_ptr< weld::Image > m_spColorBar
virtual void SaveValue()=0
virtual void Dispatch(sal_uInt16 nId)
virtual void DeactivateCell(bool bUpdate=true)
virtual void Resize() override
virtual bool IsModified() const
virtual void dispose() override
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr tools::Long Right() const
constexpr tools::Long Bottom() const
T * get() const
virtual void move(weld::Widget *pWidget, weld::Container *pNewParent)=0
virtual void select_region(int nStartPos, int nEndPos)=0
virtual void set_text(const OUString &rText)=0
virtual OUString get_text() const=0
virtual void set_margin_start(int nMargin)=0
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
float u
EditBrowseBoxFlags
constexpr OUStringLiteral HID_SCH_DATA_SERIES_LABEL
Definition: helpids.h:30
sal_Int32 nIndex
OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSequence > getDataSequenceByRole(const css::uno::Reference< css::chart2::data::XDataSource > &xSource, const OUString &aRole, bool bMatchPrefix=false)
Retrieves the data sequence in the given data source that matches the given role.
IMPL_LINK_NOARG(SeriesHeaderEdit, NameEdited, weld::Entry &, void)
OOO_DLLPUBLIC_CHARTTOOLS bool replaceParamterInString(OUString &rInOutResourceString, std::u16string_view rParamToReplace, std::u16string_view rReplaceWith)
OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(TranslateId aId)
Definition: ResId.cxx:24
IMPL_LINK(StackingResourceGroup, StackingChangeHdl, weld::Toggleable &, rRadio, void)
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
QPRO_FUNC_TYPE nType
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_COLUMN
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_PIE
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_SCATTER
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_AREA
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_LINE
constexpr OUStringLiteral CHART2_SERVICE_NAME_CHARTTYPE_NET
#define EDIT_UPDATEDATA_TIMEOUT
RET_YES
Reference< XControl > m_xControl
WinBits const WB_BORDER
WinBits const WB_TABSTOP
SvNumFormatType