22#include <com/sun/star/chart/MissingValueTreatment.hpp>
23#include <com/sun/star/chart/XChartDocument.hpp>
24#include <com/sun/star/chart2/XChartDocument.hpp>
25#include <com/sun/star/chart2/XChartType.hpp>
26#include <com/sun/star/chart2/XChartTypeContainer.hpp>
27#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
28#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
29#include <com/sun/star/chart2/XTitled.hpp>
30#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
33#include <oox/token/properties.hxx>
34#include <oox/token/tokens.hxx>
43using ::com::sun::star::uno::Reference;
44using ::com::sun::star::uno::Exception;
45using ::com::sun::star::uno::UNO_QUERY;
46using ::com::sun::star::uno::UNO_QUERY_THROW;
47using ::com::sun::star::uno::Any;
48using ::com::sun::star::drawing::XDrawPageSupplier;
49using ::com::sun::star::drawing::XShapes;
50using ::com::sun::star::chart2::XDiagram;
51using ::com::sun::star::chart2::XTitled;
84 if ( !xCooSysSequence.hasElements() )
90 if ( !xChartTypeSequence.hasElements() )
95 if ( xCT->getChartType() !=
"com.sun.star.chart2.LineChartType" )
105 bool bHasNoGapBlankValue =
false;
106 bool bHasEmptyCell =
false;
108 for (
const auto& rDataSeries : aDataSeriesSeq)
110 uno::Reference<chart2::data::XDataSource> xDSrc(rDataSeries, uno::UNO_QUERY);
114 const uno::Sequence<Reference<chart2::data::XLabeledDataSequence> > aDataSeqs = xDSrc->getDataSequences();
115 for (
const auto& rDataSeq : aDataSeqs)
125 xPropSet->getPropertyValue(
"Role") >>= aRoleName;
126 if (aRoleName ==
"values-y")
128 const uno::Sequence<uno::Any>
aData = xValues->getData();
129 for (
const auto& rVal :
aData)
135 else if (rVal >>= sStr)
136 bHasNoGapBlankValue =
true;
138 bHasEmptyCell =
true;
144 return bHasNoGapBlankValue && !bHasEmptyCell;
186 if( aAutoTitle.isEmpty() )
187 aAutoTitle =
OoxResId(STR_DIAGRAM_TITLE);
207 using namespace ::com::sun::star::chart::MissingValueTreatment;
208 sal_Int32 nMissingValues = LEAVE_GAP;
211 bool bIsMonthBasedTimeUnit =
false;
215 bIsMonthBasedTimeUnit =
mrModel.
mxPlotArea->maAxes[0]->monBaseTimeUnit.value() == XML_months;
220 case XML_gap: nMissingValues = LEAVE_GAP;
break;
221 case XML_zero: nMissingValues = USE_ZERO;
break;
222 case XML_span: nMissingValues = CONTINUE;
break;
227 nMissingValues = USE_ZERO;
235 namespace cssc = ::com::sun::star::chart;
237 if( xChart1Doc.is() )
258 awt::Point aShapesOffset( 0, 0 );
259 if( rxExternalPage.is() )
261 xShapes = rxExternalPage;
263 aShapesOffset = rChartPos;
268 xShapes.set( xDrawPageSupp->getDrawPage(), UNO_QUERY_THROW );
276 bool bOleSupport = rxExternalPage.is();
279 if( aChartSize.Width <= 0 || aChartSize.Height <= 0 )
294 aProps.
setProperty( PROP_DisableDataTableDialog ,
true );
295 aProps.
setProperty( PROP_DisableComplexChartTypes ,
true );
A wrapper for a UNO property set.
bool setProperty(sal_Int32 nPropId, const Type &rValue)
Puts the passed value into the property set.
bool importFragment(const rtl::Reference< FragmentHandler > &rxHandler)
Imports a fragment using the passed fragment handler, which contains the full path to the fragment st...
bool isMSO2007Document() const
virtual void createDataProvider(const css::uno::Reference< css::chart2::XChartDocument > &rxChartDoc)
Creates an internal data provider.
Handler for a chart drawing fragment (c:userShapes root element).
virtual ~ChartSpaceConverter() override
ChartSpaceConverter(const ConverterRoot &rParent, ChartSpaceModel &rModel)
void convertFromModel(const css::uno::Reference< css::drawing::XShapes > &rxExternalPage, const css::awt::Point &rChartPos)
Converts the contained OOXML chart model to a chart2 document.
Base class of all converter classes.
ChartSpaceModel & mrModel
::oox::core::XmlFilterBase & getFilter() const
Returns the filter object of the imported/exported document.
css::uno::Reference< css::chart2::XChartDocument > const & getChartDocument() const
Returns the API chart document model.
ChartConverter & getChartConverter() const
Returns the chart converter.
const css::awt::Size & getChartSize() const
Returns the position and size of the chart shape in 1/100 mm.
void convertTitlePositions()
Converts the positions of the main title and all axis titles.
ObjectFormatter & getFormatter() const
Returns the object formatter.
static css::awt::Size getDefaultPageSize()
Returns the default position and size of the chart shape in 1/100 mm.
void convertFromModel(const css::uno::Reference< css::chart2::XDiagram > &rxDiagram)
Creates a legend object and attaches it at the passed diagram.
ModelType & getOrCreate()
bool isWall3dChart() const
Returns true, if chart type supports wall and floor format in 3D mode.
const OUString & getAutomaticTitle() const
Returns the automatic chart title if the chart contains only one series.
void convertFromModel(View3DModel &rView3DModel)
Converts the OOXML plot area model to a chart2 diagram.
void convertPositionFromModel()
Converts the manual plot area position and size, if set.
void convertFromModel(const css::uno::Reference< css::chart2::XTitled > &rxTitled, const OUString &rAutoTitle, ObjectType eObjType, sal_Int32 nMainIdx=-1, sal_Int32 nSubIdx=-1)
Creates a title text object and attaches it at the passed interface.
void convertFromModel(const css::uno::Reference< css::chart2::XDiagram > &rxDiagram, ObjectType eObjType)
Converts the OOXML wall/floor model to a chart2 diagram.
static bool lcl_useWorkaroundForNoGapInOOXML(Reference< chart2::XChartDocument > const &xChartDoc)
@ OBJECTTYPE_FLOOR
Background and side wall in 3D charts.
@ OBJECTTYPE_WALL
Plot area containing axes and data series in 3D charts.
@ OBJECTTYPE_CHARTTITLE
Chart background.
OUString OoxResId(TranslateId aId)
PlotAreaRef mxPlotArea
Global chart text formatting.
bool mbPivotChart
True = show labels over chart maximum.
OUString maDrawingPath
Chart legend.
LegendRef mxLegend
Chart main title.
TitleRef mxTitle
3D settings.
bool mbAutoTitleDel
Index to default formatting.
bool mbPlotVisOnly
True = automatic title deleted manually.
WallFloorRef mxBackWall
Floor formatting in 3D charts.
sal_Int32 mnDispBlanksAs
Path to embedded charts.
View3DRef mxView3D
Side wall formatting in 3D charts.
WallFloorRef mxFloor
Plot area of the chart.
OUString maSheetPath
Path to drawing fragment with embedded shapes.
constexpr OUStringLiteral PROP_ExternalData
constexpr OUStringLiteral PROP_IncludeHiddenCells
constexpr OUStringLiteral PROP_MissingValueTreatment