Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/chart2/source/controller/dialogs/dlg_ObjectProperties.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 <cstddef>
23
24
#include <dlg_ObjectProperties.hxx>
25
#include "tp_AxisLabel.hxx"
26
#include "tp_DataLabel.hxx"
27
#include "tp_LegendPosition.hxx"
28
#include "tp_PointGeometry.hxx"
29
#include "tp_Scale.hxx"
30
#include "tp_AxisPositions.hxx"
31
#include "tp_ErrorBars.hxx"
32
#include "tp_Trendline.hxx"
33
#include "tp_SeriesToAxis.hxx"
34
#include "tp_TitleRotation.hxx"
35
#include "tp_PolarOptions.hxx"
36
#include "tp_DataPointOption.hxx"
37
#include "tp_DataTable.hxx"
38
#include "tp_ChartColorPalette.hxx"
39
#include <ViewElementListProvider.hxx>
40
#include <ChartType.hxx>
41
#include <ChartTypeHelper.hxx>
42
#include <ObjectNameProvider.hxx>
43
#include <DataSeries.hxx>
44
#include <DiagramHelper.hxx>
45
#include <Diagram.hxx>
46
#include <NumberFormatterWrapper.hxx>
47
#include <Axis.hxx>
48
#include <AxisHelper.hxx>
49
#include <ExplicitCategoriesProvider.hxx>
50
#include <ChartModel.hxx>
51
#include <CommonConverters.hxx>
52
#include <RegressionCalculationHelper.hxx>
53
#include <BaseCoordinateSystem.hxx>
54
55
#include <com/sun/star/chart2/AxisType.hpp>
56
#include <svl/intitem.hxx>
57
#include <svl/ctloptions.hxx>
58
59
#include <svx/svxids.hrc>
60
61
#include <svx/drawitem.hxx>
62
#include <svx/ofaitem.hxx>
63
#include <svx/svxgraphicitem.hxx>
64
65
#include <svx/dialogs.hrc>
66
#include <editeng/flstitem.hxx>
67
68
#include <svx/flagsdef.hxx>
69
#include <svx/numinf.hxx>
70
71
#include <svl/cjkoptions.hxx>
72
#include <utility>
73
#include <comphelper/diagnose_ex.hxx>
74
75
#include <vcl/tabs.hrc>
76
77
namespace chart
78
{
79
80
using namespace ::com::sun::star;
81
using namespace ::com::sun::star::chart2;
82
using ::com::sun::star::uno::Reference;
83
using ::com::sun::star::uno::Sequence;
84
using ::com::sun::star::uno::Exception;
85
using ::com::sun::star::beans::XPropertySet;
86
87
ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( OUString aObjectCID )
88
0
        : m_aObjectCID(std::move( aObjectCID ))
89
0
        , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
90
0
        , m_bAffectsMultipleObjects(false)
91
0
        , m_bHasGeometryProperties(false)
92
0
        , m_bHasStatisticProperties(false)
93
0
        , m_bProvidesSecondaryYAxis(false)
94
0
        , m_bProvidesOverlapAndGapWidth(false)
95
0
        , m_bProvidesBarConnectors(false)
96
0
        , m_bHasAreaProperties(false)
97
0
        , m_bHasSymbolProperties(false)
98
0
        , m_bHasNumberProperties(false)
99
0
        , m_bProvidesStartingAngle(false)
100
0
        , m_bProvidesMissingValueTreatments(false)
101
0
        , m_bIsPieChartDataPoint(false)
102
0
        , m_bHasScaleProperties(false)
103
0
        , m_bCanAxisLabelsBeStaggered(false)
104
0
        , m_bSupportingAxisPositioning(false)
105
0
        , m_bShowAxisOrigin(false)
106
0
        , m_bIsCrossingAxisIsCategoryAxis(false)
107
0
        , m_bSupportingCategoryPositioning(false)
108
0
        , m_bComplexCategoriesAxis( false )
109
0
        , m_nNbPoints( 0 )
110
0
{
111
0
    std::u16string_view aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
112
0
    m_bAffectsMultipleObjects = (aParticleID == u"ALLELEMENTS");
113
0
}
114
ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
115
0
{
116
0
}
117
118
void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartModel>& xChartModel )
119
0
{
120
0
    m_xChartDocument = xChartModel;
121
0
    rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
122
0
    rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
123
0
    rtl::Reference< ChartType > xChartType = xChartModel->getChartTypeOfSeries( xSeries );
124
0
    sal_Int32 nDimensionCount = 0;
125
0
    if (xDiagram)
126
0
        nDimensionCount = xDiagram->getDimension();
127
128
0
    bool bHasSeriesProperties = (m_eObjectType==OBJECTTYPE_DATA_SERIES);
129
0
    bool bHasDataPointproperties = (m_eObjectType==OBJECTTYPE_DATA_POINT);
130
131
0
    if( bHasSeriesProperties || bHasDataPointproperties )
132
0
    {
133
0
        m_bHasGeometryProperties = xChartType->isSupportingGeometryProperties(nDimensionCount );
134
0
        m_bHasAreaProperties     = xChartType->isSupportingAreaProperties(nDimensionCount);
135
0
        m_bHasSymbolProperties   = xChartType->isSupportingSymbolProperties(nDimensionCount);
136
0
        m_bIsPieChartDataPoint   = bHasDataPointproperties && xChartType->isSupportingStartingAngle();
137
138
0
        if( bHasSeriesProperties )
139
0
        {
140
0
            m_bHasStatisticProperties =  xChartType->isSupportingStatisticProperties(nDimensionCount);
141
0
            m_bProvidesSecondaryYAxis =  xChartType->isSupportingSecondaryAxis(nDimensionCount);
142
0
            m_bProvidesOverlapAndGapWidth =  xChartType->isSupportingOverlapAndGapWidthProperties(nDimensionCount);
143
0
            m_bProvidesBarConnectors =  xChartType->isSupportingBarConnectors(nDimensionCount);
144
0
            m_bProvidesStartingAngle = xChartType->isSupportingStartingAngle();
145
146
0
            m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
147
0
                                            .hasElements();
148
0
        }
149
0
    }
150
151
0
    if( m_eObjectType == OBJECTTYPE_DATA_ERRORS_X ||
152
0
        m_eObjectType == OBJECTTYPE_DATA_ERRORS_Y ||
153
0
        m_eObjectType == OBJECTTYPE_DATA_ERRORS_Z)
154
0
        m_bHasStatisticProperties = true;
155
156
0
    if( m_eObjectType == OBJECTTYPE_AXIS )
157
0
    {
158
        //show scale properties only for a single axis not for multiselection
159
0
        m_bHasScaleProperties = !m_bAffectsMultipleObjects;
160
161
0
        if( m_bHasScaleProperties )
162
0
        {
163
0
            rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel );
164
0
            if( xAxis.is() )
165
0
            {
166
                //no scale page for series axis
167
0
                ScaleData aData( xAxis->getScaleData() );
168
0
                if( aData.AxisType == chart2::AxisType::SERIES )
169
0
                    m_bHasScaleProperties = false;
170
0
                if( aData.AxisType != chart2::AxisType::SERIES )
171
0
                    m_bHasNumberProperties = true;
172
173
                //is the crossing main axis a category axes?:
174
0
                rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
175
0
                rtl::Reference< Axis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
176
0
                if( xCrossingMainAxis.is() )
177
0
                {
178
0
                    ScaleData aScale( xCrossingMainAxis->getScaleData() );
179
0
                    m_bIsCrossingAxisIsCategoryAxis = ( aScale.AxisType == chart2::AxisType::CATEGORY  );
180
0
                    if( m_bIsCrossingAxisIsCategoryAxis )
181
0
                    {
182
0
                        if (xChartModel)
183
0
                            m_aCategories = DiagramHelper::getExplicitSimpleCategories( *xChartModel );
184
0
                    }
185
0
                }
186
187
0
                sal_Int32 nCooSysIndex=0;
188
0
                sal_Int32 nDimensionIndex=0;
189
0
                sal_Int32 nAxisIndex=0;
190
0
                if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
191
0
                {
192
0
                    xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex );
193
                    //show positioning controls only if they make sense
194
0
                    m_bSupportingAxisPositioning = xChartType.is() ? xChartType->isSupportingAxisPositioning(nDimensionCount, nDimensionIndex) : true;
195
196
                    //show axis origin only for secondary y axis
197
0
                    if( nDimensionIndex==1 && nAxisIndex==1 && xChartType.is() && xChartType->isSupportingBaseValue())
198
0
                        m_bShowAxisOrigin = true;
199
200
0
                    if ( nDimensionIndex == 0 && ( aData.AxisType == chart2::AxisType::CATEGORY || aData.AxisType == chart2::AxisType::DATE ) )
201
0
                    {
202
0
                        if (xChartModel)
203
0
                        {
204
0
                            ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *xChartModel );
205
0
                            m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories();
206
0
                        }
207
208
0
                        if (!m_bComplexCategoriesAxis)
209
0
                            m_bSupportingCategoryPositioning = xChartType.is() && xChartType->isSupportingCategoryPositioning(nDimensionCount);
210
0
                    }
211
0
                }
212
0
            }
213
0
        }
214
215
        //no staggering of labels for 3D axis
216
0
        m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
217
0
    }
218
219
0
    if( m_eObjectType == OBJECTTYPE_DATA_CURVE )
220
0
    {
221
0
        const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSeqs( xSeries->getDataSequences2());
222
0
        Sequence< double > aXValues, aYValues;
223
0
        bool bXValuesFound = false, bYValuesFound = false;
224
0
        m_nNbPoints = 0;
225
0
        for( std::size_t i=0;
226
0
             ! (bXValuesFound && bYValuesFound) && i<aDataSeqs.size();
227
0
             ++i )
228
0
        {
229
0
            try
230
0
            {
231
0
                Reference< data::XDataSequence > xSeq( aDataSeqs[i]->getValues());
232
0
                Reference< XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
233
0
                OUString aRole;
234
0
                if( xProp->getPropertyValue( u"Role"_ustr ) >>= aRole )
235
0
                {
236
0
                    if( !bXValuesFound && aRole == "values-x" )
237
0
                    {
238
0
                        aXValues = DataSequenceToDoubleSequence( xSeq );
239
0
                        bXValuesFound = true;
240
0
                    }
241
0
                    else if( !bYValuesFound && aRole == "values-y" )
242
0
                    {
243
0
                        aYValues = DataSequenceToDoubleSequence( xSeq );
244
0
                        bYValuesFound = true;
245
0
                    }
246
0
                }
247
0
            }
248
0
            catch( const Exception & )
249
0
            {
250
0
                DBG_UNHANDLED_EXCEPTION("chart2");
251
0
            }
252
0
        }
253
0
        if( !bXValuesFound && bYValuesFound )
254
0
        {
255
            // initialize with 1, 2, ...
256
            //first category (index 0) matches with real number 1.0
257
0
            aXValues.realloc( aYValues.getLength() );
258
0
            auto pXValues = aXValues.getArray();
259
0
            for( sal_Int32 i=0; i<aXValues.getLength(); ++i )
260
0
                pXValues[i] = i+1;
261
0
            bXValuesFound = true;
262
0
        }
263
264
0
        if( bXValuesFound && bYValuesFound &&
265
0
            aXValues.hasElements() &&
266
0
            aYValues.hasElements() )
267
0
        {
268
0
            RegressionCalculationHelper::tDoubleVectorPair aValues(
269
0
                RegressionCalculationHelper::cleanup( aXValues, aYValues, RegressionCalculationHelper::isValid()));
270
0
            m_nNbPoints = aValues.second.size();
271
0
        }
272
0
    }
273
274
     //create gui name for this object
275
0
    if( !m_bAffectsMultipleObjects && m_eObjectType == OBJECTTYPE_AXIS )
276
0
    {
277
0
        m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
278
0
    }
279
0
    else if( !m_bAffectsMultipleObjects && ( m_eObjectType == OBJECTTYPE_GRID || m_eObjectType == OBJECTTYPE_SUBGRID ) )
280
0
    {
281
0
        m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
282
0
    }
283
0
    else if( !m_bAffectsMultipleObjects && m_eObjectType == OBJECTTYPE_TITLE )
284
0
    {
285
0
        m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
286
0
    }
287
0
    else
288
0
    {
289
0
        switch( m_eObjectType )
290
0
        {
291
0
            case OBJECTTYPE_DATA_POINT:
292
0
            case OBJECTTYPE_DATA_LABEL:
293
0
            case OBJECTTYPE_DATA_LABELS:
294
0
            case OBJECTTYPE_DATA_ERRORS_X:
295
0
            case OBJECTTYPE_DATA_ERRORS_Y:
296
0
            case OBJECTTYPE_DATA_ERRORS_Z:
297
0
            case OBJECTTYPE_DATA_AVERAGE_LINE:
298
0
            case OBJECTTYPE_DATA_CURVE:
299
0
            case OBJECTTYPE_DATA_CURVE_EQUATION:
300
0
                if( m_bAffectsMultipleObjects )
301
0
                    m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
302
0
                else
303
0
                    m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
304
0
                break;
305
0
            default:
306
0
                m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
307
0
                break;
308
0
        }
309
0
    }
310
0
}
311
312
const sal_uInt16 nNoArrowNoShadowDlg    = 1101;
313
314
void SchAttribTabDlg::setSymbolInformation( SfxItemSet&& rSymbolShapeProperties,
315
                std::optional<Graphic> oAutoSymbolGraphic )
316
0
{
317
0
    m_oSymbolShapeProperties.emplace(std::move(rSymbolShapeProperties));
318
0
    m_oAutoSymbolGraphic = std::move(oAutoSymbolGraphic);
319
0
}
320
321
void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
322
0
{
323
0
    m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
324
0
}
325
326
SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
327
                                 const SfxItemSet* pAttr,
328
                                 const ObjectPropertiesDialogParameter& rDialogParameter,
329
                                 const ViewElementListProvider* pViewElementListProvider,
330
                                 const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier)
331
0
    : SfxTabDialogController(pParent, u"modules/schart/ui/attributedialog.ui"_ustr, u"AttributeDialog"_ustr, pAttr)
332
0
    , m_rParameter(rDialogParameter)
333
0
    , m_pViewElementListProvider( pViewElementListProvider )
334
0
    , m_pNumberFormatter(nullptr)
335
0
    , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
336
0
    , m_bOKPressed(false)
337
0
{
338
0
    NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
339
0
    m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
340
341
0
    m_xDialog->set_title(rDialogParameter.getLocalizedName());
342
343
0
    ObjectType eType = rDialogParameter.getObjectType();
344
0
    switch (eType)
345
0
    {
346
0
        case OBJECTTYPE_TITLE:
347
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_BORDER.aLabel), RID_SVXPAGE_LINE,
348
0
                       RID_M + RID_TAB_BORDER.sIconName);
349
0
            AddTabPage(u"area"_ustr, TabResId(RID_TAB_AREA.aLabel), RID_SVXPAGE_AREA,
350
0
                       RID_M + RID_TAB_AREA.sIconName);
351
0
            AddTabPage(u"transparent"_ustr, TabResId(RID_TAB_TRANSPARENCE.aLabel), RID_SVXPAGE_TRANSPARENCE,
352
0
                       RID_M + RID_TAB_TRANSPARENCE.sIconName);
353
0
            AddTabPage(u"fontname"_ustr, TabResId(RID_TAB_FONT.aLabel), RID_SVXPAGE_CHAR_NAME,
354
0
                       RID_M + RID_TAB_FONT.sIconName);
355
0
            AddTabPage(u"effects"_ustr, TabResId(RID_TAB_FONTEFFECTS.aLabel), RID_SVXPAGE_CHAR_EFFECTS,
356
0
                       RID_M + RID_TAB_FONTEFFECTS.sIconName);
357
0
            AddTabPage(u"alignment"_ustr, TabResId(RID_TAB_ALIGNMENT.aLabel), SchAlignmentTabPage::Create,
358
0
                       RID_M + RID_TAB_ALIGNMENT.sIconName);
359
0
            if( SvtCJKOptions::IsAsianTypographyEnabled() )
360
0
                AddTabPage(u"asian"_ustr, TabResId(RID_TAB_ASIANTYPO.aLabel), RID_SVXPAGE_PARA_ASIAN,
361
0
                           RID_M + RID_TAB_ASIANTYPO.sIconName);
362
0
            break;
363
364
0
        case OBJECTTYPE_LEGEND:
365
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_BORDER.aLabel), RID_SVXPAGE_LINE,
366
0
                       RID_M + RID_TAB_BORDER.sIconName);
367
0
            AddTabPage(u"area"_ustr, TabResId(RID_TAB_AREA.aLabel), RID_SVXPAGE_AREA,
368
0
                       RID_M + RID_TAB_AREA.sIconName);
369
0
            AddTabPage(u"transparent"_ustr, TabResId(RID_TAB_TRANSPARENCE.aLabel), RID_SVXPAGE_TRANSPARENCE,
370
0
                       RID_M + RID_TAB_TRANSPARENCE.sIconName);
371
0
            AddTabPage(u"colorpalette"_ustr, TabResId(RID_TAB_COLORPALETTE.aLabel), ChartColorPaletteTabPage::Create,
372
0
                       RID_M + RID_TAB_COLORPALETTE.sIconName);
373
0
            AddTabPage(u"fontname"_ustr, TabResId(RID_TAB_FONT.aLabel), RID_SVXPAGE_CHAR_NAME,
374
0
                       RID_M + RID_TAB_FONT.sIconName);
375
0
            AddTabPage(u"effects"_ustr, TabResId(RID_TAB_FONTEFFECTS.aLabel), RID_SVXPAGE_CHAR_EFFECTS,
376
0
                       RID_M + RID_TAB_FONTEFFECTS.sIconName);
377
0
            AddTabPage(u"legendpos"_ustr, TabResId(RID_TAB_CHART_LEGENDPOS.aLabel), SchLegendPosTabPage::Create,
378
0
                       RID_M + RID_TAB_CHART_LEGENDPOS.sIconName);
379
0
            if (SvtCJKOptions::IsAsianTypographyEnabled())
380
0
                AddTabPage(u"asian"_ustr, TabResId(RID_TAB_ASIANTYPO.aLabel), RID_SVXPAGE_PARA_ASIAN,
381
0
                           RID_M + RID_TAB_ASIANTYPO.sIconName);
382
0
            break;
383
384
0
        case OBJECTTYPE_DATA_SERIES:
385
0
        case OBJECTTYPE_DATA_POINT:
386
0
            if (m_rParameter.ProvidesSecondaryYAxis() || m_rParameter.ProvidesOverlapAndGapWidth() || m_rParameter.ProvidesMissingValueTreatments())
387
0
                AddTabPage(u"options"_ustr, TabResId(RID_TAB_CHART_OPTIONS.aLabel), SchOptionTabPage::Create,
388
0
                           RID_M + RID_TAB_CHART_OPTIONS.sIconName);
389
0
            if (m_rParameter.ProvidesStartingAngle())
390
0
                AddTabPage(u"polaroptions"_ustr, TabResId(RID_TAB_CHART_OPTIONS.aLabel), PolarOptionsTabPage::Create,
391
0
                           RID_M + RID_TAB_CHART_OPTIONS.sIconName);
392
0
            if (m_rParameter.IsPieChartDataPoint())
393
0
                AddTabPage(u"datapointoption"_ustr, TabResId(RID_TAB_CHART_OPTIONS.aLabel), DataPointOptionTabPage::Create,
394
0
                           RID_M + RID_TAB_CHART_OPTIONS.sIconName);
395
396
0
            if (m_rParameter.HasGeometryProperties())
397
0
                AddTabPage(u"layout"_ustr, TabResId(RID_TAB_CHART_LAYOUT.aLabel), SchLayoutTabPage::Create,
398
0
                           RID_M + RID_TAB_CHART_LAYOUT.sIconName);
399
400
0
            if (m_rParameter.HasAreaProperties())
401
0
            {
402
0
                AddTabPage(u"area"_ustr, TabResId(RID_TAB_AREA.aLabel), RID_SVXPAGE_AREA,
403
0
                           RID_M + RID_TAB_AREA.sIconName);
404
0
                AddTabPage(u"transparent"_ustr, TabResId(RID_TAB_TRANSPARENCE.aLabel), RID_SVXPAGE_TRANSPARENCE,
405
0
                           RID_M + RID_TAB_TRANSPARENCE.sIconName);
406
0
                AddTabPage(u"border"_ustr, TabResId(RID_TAB_BORDER.aLabel), RID_SVXPAGE_LINE,
407
0
                        RID_M + RID_TAB_BORDER.sIconName);
408
0
            }
409
0
            else
410
0
                AddTabPage(u"border"_ustr, TabResId(RID_TAB_LINE.aLabel), RID_SVXPAGE_LINE,
411
0
                           RID_M + RID_TAB_LINE.sIconName);
412
413
0
            AddTabPage(u"colorpalette"_ustr, TabResId(RID_TAB_COLORPALETTE.aLabel), ChartColorPaletteTabPage::Create,
414
0
                       RID_M + RID_TAB_COLORPALETTE.sIconName);
415
0
            break;
416
417
0
        case OBJECTTYPE_DATA_LABEL:
418
0
        case OBJECTTYPE_DATA_LABELS:
419
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_BORDER.aLabel), RID_SVXPAGE_LINE,
420
0
                       RID_M + RID_TAB_BORDER.sIconName);
421
0
            AddTabPage(u"datalabels"_ustr, TabResId(RID_TAB_CHART_DATALABEL.aLabel), DataLabelsTabPage::Create,
422
0
                       RID_M + RID_TAB_CHART_DATALABEL.sIconName);
423
0
            AddTabPage(u"fontname"_ustr, TabResId(RID_TAB_FONT.aLabel), RID_SVXPAGE_CHAR_NAME,
424
0
                       RID_M + RID_TAB_FONT.sIconName);
425
0
            AddTabPage(u"effects"_ustr, TabResId(RID_TAB_FONTEFFECTS.aLabel), RID_SVXPAGE_CHAR_EFFECTS,
426
0
                       RID_M + RID_TAB_FONTEFFECTS.sIconName);
427
0
            if( SvtCJKOptions::IsAsianTypographyEnabled() )
428
0
                AddTabPage(u"asian"_ustr, TabResId(RID_TAB_ASIANTYPO.aLabel), RID_SVXPAGE_PARA_ASIAN,
429
0
                           RID_M + RID_TAB_ASIANTYPO.sIconName);
430
431
0
            break;
432
433
0
        case OBJECTTYPE_AXIS:
434
0
        {
435
0
            if (m_rParameter.HasScaleProperties())
436
0
            {
437
0
                AddTabPage(u"scale"_ustr, TabResId(RID_TAB_CHART_SCALE.aLabel), ScaleTabPage::Create,
438
0
                           RID_M + RID_TAB_CHART_SCALE.sIconName);
439
                //no positioning page for z axes so far as the tickmarks are not shown so far
440
0
                AddTabPage(u"axispos"_ustr, TabResId(RID_TAB_CHART_POSITIONING.aLabel), AxisPositionsTabPage::Create,
441
0
                           RID_M + RID_TAB_CHART_POSITIONING.sIconName);
442
0
            }
443
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_BORDER.aLabel), RID_SVXPAGE_LINE,
444
0
                       RID_M + RID_TAB_BORDER.sIconName);
445
0
            AddTabPage(u"axislabel"_ustr, TabResId(RID_TAB_CHART_AXISLABEL.aLabel), SchAxisLabelTabPage::Create,
446
0
                       RID_M + RID_TAB_CHART_AXISLABEL.sIconName);
447
0
            if (m_rParameter.HasNumberProperties())
448
0
                AddTabPage(u"numberformat"_ustr, TabResId(RID_TAB_NUMBERS.aLabel), RID_SVXPAGE_NUMBERFORMAT,
449
0
                           RID_M + RID_TAB_NUMBERS.sIconName);
450
0
            AddTabPage(u"fontname"_ustr, TabResId(RID_TAB_FONT.aLabel), RID_SVXPAGE_CHAR_NAME,
451
0
                       RID_M + RID_TAB_FONT.sIconName);
452
0
            AddTabPage(u"effects"_ustr, TabResId(RID_TAB_FONTEFFECTS.aLabel), RID_SVXPAGE_CHAR_EFFECTS,
453
0
                       RID_M + RID_TAB_FONTEFFECTS.sIconName);
454
0
            if( SvtCJKOptions::IsAsianTypographyEnabled() )
455
0
                AddTabPage(u"asian"_ustr, TabResId(RID_TAB_ASIANTYPO.aLabel), RID_SVXPAGE_PARA_ASIAN,
456
0
                           RID_M + RID_TAB_ASIANTYPO.sIconName);
457
0
            break;
458
0
        }
459
460
0
        case OBJECTTYPE_DATA_ERRORS_X:
461
0
            AddTabPage(u"xerrorbar"_ustr, TabResId(RID_TAB_CHART_ERROR_X.aLabel), ErrorBarsTabPage::Create,
462
0
                       RID_M  + RID_TAB_CHART_ERROR_X.sIconName);
463
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_LINE.aLabel), RID_SVXPAGE_LINE,
464
0
                       RID_M + RID_TAB_LINE.sIconName);
465
0
            break;
466
467
0
        case OBJECTTYPE_DATA_ERRORS_Y:
468
0
            AddTabPage(u"yerrorbar"_ustr, TabResId(RID_TAB_CHART_ERROR_Y.aLabel), ErrorBarsTabPage::Create,
469
0
                       RID_M  + RID_TAB_CHART_ERROR_Y.sIconName);
470
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_LINE.aLabel), RID_SVXPAGE_LINE,
471
0
                       RID_M + RID_TAB_LINE.sIconName);
472
0
            break;
473
474
0
        case OBJECTTYPE_DATA_ERRORS_Z:
475
0
            break;
476
477
0
        case OBJECTTYPE_GRID:
478
0
        case OBJECTTYPE_SUBGRID:
479
0
        case OBJECTTYPE_DATA_AVERAGE_LINE:
480
0
        case OBJECTTYPE_DATA_STOCK_RANGE:
481
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_LINE.aLabel), RID_SVXPAGE_LINE,
482
0
                       RID_M + RID_TAB_LINE.sIconName);
483
0
            break;
484
485
0
        case OBJECTTYPE_DATA_CURVE:
486
0
            AddTabPage(u"trendline"_ustr, TabResId(RID_TAB_CHART_TREND.aLabel), TrendlineTabPage::Create,
487
0
                       RID_M + RID_TAB_CHART_TREND.sIconName);
488
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_LINE.aLabel), RID_SVXPAGE_LINE,
489
0
                       RID_M + RID_TAB_LINE.sIconName);
490
0
            break;
491
492
0
        case OBJECTTYPE_DATA_STOCK_LOSS:
493
0
        case OBJECTTYPE_DATA_STOCK_GAIN:
494
0
        case OBJECTTYPE_PAGE:
495
0
        case OBJECTTYPE_DIAGRAM_FLOOR:
496
0
        case OBJECTTYPE_DIAGRAM_WALL:
497
0
        case OBJECTTYPE_DIAGRAM:
498
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_BORDER.aLabel), RID_SVXPAGE_LINE,
499
0
                       RID_M + RID_TAB_BORDER.sIconName);
500
0
            AddTabPage(u"area"_ustr, TabResId(RID_TAB_AREA.aLabel), RID_SVXPAGE_AREA,
501
0
                       RID_M + RID_TAB_AREA.sIconName);
502
0
            AddTabPage(u"transparent"_ustr, TabResId(RID_TAB_TRANSPARENCE.aLabel), RID_SVXPAGE_TRANSPARENCE,
503
0
                       RID_M + RID_TAB_TRANSPARENCE.sIconName);
504
0
            if (eType != OBJECTTYPE_DATA_STOCK_LOSS && eType != OBJECTTYPE_DATA_STOCK_GAIN)
505
0
                AddTabPage(u"colorpalette"_ustr, TabResId(RID_TAB_COLORPALETTE.aLabel), ChartColorPaletteTabPage::Create,
506
0
                           RID_M + RID_TAB_COLORPALETTE.sIconName);
507
508
0
            break;
509
510
0
        case OBJECTTYPE_LEGEND_ENTRY:
511
0
        case OBJECTTYPE_AXIS_UNITLABEL:
512
0
        case OBJECTTYPE_UNKNOWN:
513
            // nothing
514
0
            break;
515
0
        case OBJECTTYPE_DATA_TABLE:
516
0
            AddTabPage(u"datatable"_ustr, TabResId(RID_TAB_CHART_TABLE.aLabel), DataTableTabPage::Create,
517
0
                       RID_M + RID_TAB_CHART_TABLE.sIconName);
518
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_BORDER.aLabel), RID_SVXPAGE_LINE,
519
0
                       RID_M + RID_TAB_BORDER.sIconName);
520
0
            AddTabPage(u"area"_ustr, TabResId(RID_TAB_AREA.aLabel), RID_SVXPAGE_AREA,
521
0
                       RID_M + RID_TAB_AREA.sIconName);
522
0
            AddTabPage(u"fontname"_ustr, TabResId(RID_TAB_FONT.aLabel), RID_SVXPAGE_CHAR_NAME,
523
0
                       RID_M + RID_TAB_FONT.sIconName);
524
0
            AddTabPage(u"effects"_ustr, TabResId(RID_TAB_FONTEFFECTS.aLabel), RID_SVXPAGE_CHAR_EFFECTS,
525
0
                       RID_M + RID_TAB_FONTEFFECTS.sIconName);
526
0
            break;
527
0
        case OBJECTTYPE_DATA_CURVE_EQUATION:
528
0
            AddTabPage(u"border"_ustr, TabResId(RID_TAB_BORDER.aLabel), RID_SVXPAGE_LINE,
529
0
                       RID_M + RID_TAB_BORDER.sIconName);
530
0
            AddTabPage(u"area"_ustr, TabResId(RID_TAB_AREA.aLabel), RID_SVXPAGE_AREA,
531
0
                       RID_M + RID_TAB_AREA.sIconName);
532
0
            AddTabPage(u"transparent"_ustr, TabResId(RID_TAB_TRANSPARENCE.aLabel), RID_SVXPAGE_TRANSPARENCE,
533
0
                       RID_M + RID_TAB_TRANSPARENCE.sIconName);
534
0
            AddTabPage(u"fontname"_ustr, TabResId(RID_TAB_FONT.aLabel), RID_SVXPAGE_CHAR_NAME,
535
0
                       RID_M + RID_TAB_FONT.sIconName);
536
0
            AddTabPage(u"effects"_ustr, TabResId(RID_TAB_FONTEFFECTS.aLabel), RID_SVXPAGE_CHAR_EFFECTS,
537
0
                       RID_M + RID_TAB_FONTEFFECTS.sIconName);
538
0
            AddTabPage(u"numberformat"_ustr, TabResId(RID_TAB_NUMBERS.aLabel), RID_SVXPAGE_NUMBERFORMAT,
539
0
                           RID_M + RID_TAB_NUMBERS.sIconName);
540
0
            if (SvtCTLOptions::IsCTLFontEnabled())
541
0
            {
542
                /*  When rotation is supported for equation text boxes, use
543
                    SchAlignmentTabPage::Create here. The special
544
                    SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
545
0
                AddTabPage(u"alignment"_ustr, TabResId(RID_TAB_ALIGNMENT.aLabel), SchAlignmentTabPage::CreateWithoutRotation,
546
0
                           RID_M + RID_TAB_ALIGNMENT.sIconName);
547
0
            }
548
0
            break;
549
0
        default:
550
0
            break;
551
0
    }
552
553
    // used to find out if user left the dialog with OK. When OK is pressed but
554
    // no changes were done, Cancel is returned by the SfxTabDialog. See method
555
    // DialogWasClosedWithOK.
556
0
    GetOKButton().connect_clicked(LINK(this, SchAttribTabDlg, OKPressed));
557
0
}
558
559
SchAttribTabDlg::~SchAttribTabDlg()
560
0
{
561
0
}
562
563
void SchAttribTabDlg::PageCreated(const OUString& rId, SfxTabPage &rPage)
564
0
{
565
0
    SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
566
0
    if (rId == "border")
567
0
    {
568
0
        aSet.Put (SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
569
0
        aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
570
0
        aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
571
0
        aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
572
0
        aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nNoArrowNoShadowDlg));
573
574
0
        if (m_rParameter.HasSymbolProperties())
575
0
        {
576
0
            aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
577
0
            if( m_oSymbolShapeProperties )
578
0
                aSet.Put(SfxTabDialogItem(SID_ATTR_SET, *m_oSymbolShapeProperties));
579
0
            if( m_oAutoSymbolGraphic )
580
0
                aSet.Put(SvxGraphicItem(*m_oAutoSymbolGraphic));
581
0
        }
582
0
        rPage.PageCreated(aSet);
583
0
    }
584
0
    else if (rId == "area")
585
0
    {
586
0
        aSet.Put(SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
587
0
        aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
588
0
        aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
589
0
        aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
590
0
        aSet.Put(SvxPatternListItem(m_pViewElementListProvider->GetPatternList(),SID_PATTERN_LIST));
591
0
        aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,0));
592
0
        aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nNoArrowNoShadowDlg));
593
0
        rPage.PageCreated(aSet);
594
0
    }
595
0
    else if (rId == "transparent")
596
0
    {
597
0
        aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
598
0
        aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nNoArrowNoShadowDlg));
599
0
        rPage.PageCreated(aSet);
600
0
    }
601
0
    else if (rId == "fontname")
602
0
    {
603
0
        aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST));
604
0
        rPage.PageCreated(aSet);
605
0
    }
606
0
    else if (rId == "effects")
607
0
    {
608
0
        aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
609
0
        rPage.PageCreated(aSet);
610
0
    }
611
0
    else if (rId == "axislabel")
612
0
    {
613
0
        bool bShowStaggeringControls = m_rParameter.CanAxisLabelsBeStaggered();
614
0
        auto & rLabelPage = static_cast<SchAxisLabelTabPage&>(rPage);
615
0
        rLabelPage.ShowStaggeringControls( bShowStaggeringControls );
616
0
        rLabelPage.SetComplexCategories(m_rParameter.IsComplexCategoriesAxis());
617
0
    }
618
0
    else if (rId == "axispos")
619
0
    {
620
0
        AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
621
0
        if(pPage)
622
0
        {
623
0
            pPage->SetNumFormatter( m_pNumberFormatter );
624
0
            if (m_rParameter.IsCrossingAxisIsCategoryAxis())
625
0
            {
626
0
                pPage->SetCrossingAxisIsCategoryAxis(m_rParameter.IsCrossingAxisIsCategoryAxis());
627
0
                pPage->SetCategories(m_rParameter.GetCategories());
628
0
            }
629
0
            pPage->SupportAxisPositioning(m_rParameter.IsSupportingAxisPositioning());
630
0
            pPage->SupportCategoryPositioning(m_rParameter.IsSupportingCategoryPositioning());
631
0
        }
632
0
    }
633
0
    else if (rId == "scale")
634
0
    {
635
0
        ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
636
0
        if(pScaleTabPage)
637
0
        {
638
0
            pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
639
0
            pScaleTabPage->ShowAxisOrigin(m_rParameter.ShowAxisOrigin());
640
0
        }
641
0
    }
642
0
    else if (rId == "datalabels")
643
0
    {
644
0
        DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
645
0
        if( pLabelPage )
646
0
            pLabelPage->SetNumberFormatter( m_pNumberFormatter );
647
0
    }
648
0
    else if (rId == "numberformat")
649
0
    {
650
0
        aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, SID_ATTR_NUMBERFORMAT_INFO));
651
0
        rPage.PageCreated(aSet);
652
0
    }
653
0
    else if (rId == "xerrorbar")
654
0
    {
655
0
        ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
656
0
        OSL_ASSERT( pTabPage );
657
0
        if( pTabPage )
658
0
        {
659
0
            pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
660
0
            pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_X );
661
0
            pTabPage->SetChartDocumentForRangeChoosing(m_rParameter.getDocument());
662
0
        }
663
0
    }
664
0
    else if (rId == "yerrorbar")
665
0
    {
666
0
        ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
667
0
        OSL_ASSERT( pTabPage );
668
0
        if( pTabPage )
669
0
        {
670
0
            pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
671
0
            pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
672
0
            pTabPage->SetChartDocumentForRangeChoosing(m_rParameter.getDocument());
673
0
        }
674
0
    }
675
0
    else if (rId == "options")
676
0
    {
677
0
        SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
678
0
        if (pTabPage)
679
0
            pTabPage->Init(m_rParameter.ProvidesSecondaryYAxis(),
680
0
                           m_rParameter.ProvidesOverlapAndGapWidth(),
681
0
                           m_rParameter.ProvidesBarConnectors());
682
0
    }
683
0
    else if (rId == "trendline")
684
0
    {
685
0
        TrendlineTabPage* pTrendlineTabPage = dynamic_cast< TrendlineTabPage* >( &rPage );
686
0
        if(pTrendlineTabPage)
687
0
        {
688
0
            pTrendlineTabPage->SetNumFormatter( m_pNumberFormatter );
689
0
            pTrendlineTabPage->SetNbPoints(m_rParameter.getNbPoints());
690
0
        }
691
0
    }
692
0
    else if (rId == "colorpalette")
693
0
    {
694
0
        auto* pColorPaletteTabPage = dynamic_cast<ChartColorPaletteTabPage*>( &rPage );
695
0
        if (pColorPaletteTabPage)
696
0
        {
697
0
            pColorPaletteTabPage->init(m_rParameter.getDocument());
698
0
        }
699
0
    }
700
0
}
701
702
IMPL_LINK(SchAttribTabDlg, OKPressed, weld::Button&, rButton, void)
703
0
{
704
0
    m_bOKPressed = true;
705
0
    OkHdl(rButton);
706
0
}
707
708
} //namespace chart
709
710
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */