Coverage Report

Created: 2026-08-14 10:22

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