1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLTOOLS_HXX
20 #define INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLTOOLS_HXX
22 #include <rtl/ustring.hxx>
23 #include <xmloff/xmltoken.hxx>
24 #include "transporttypes.hxx"
26 #include <com/sun/star/frame/XModel.hpp>
27 #include <com/sun/star/chart2/data/XLabeledDataSequence2.hpp>
29 namespace com
{ namespace sun
{ namespace star
{
32 class XRegressionCurve
;
39 class XMLPropStyleContext
;
40 class SvXMLStylesContext
;
45 bool isDocumentGeneratedWithOpenOfficeOlderThan2_0( const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
46 bool isDocumentGeneratedWithOpenOfficeOlderThan2_3( const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
47 bool isDocumentGeneratedWithOpenOfficeOlderThan2_4( const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
48 bool isDocumentGeneratedWithOpenOfficeOlderThan3_0( const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
49 bool isDocumentGeneratedWithOpenOfficeOlderThan3_3( const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
51 void setBuildIDAtImportInfo( const css::uno::Reference
< css::frame::XModel
>& xModel
52 , const css::uno::Reference
< css::beans::XPropertySet
>& xImportInfo
);
54 enum SchXMLChartTypeEnum
58 XML_CHART_CLASS_CIRCLE
,
60 XML_CHART_CLASS_SCATTER
,
61 XML_CHART_CLASS_RADAR
,
62 XML_CHART_CLASS_FILLED_RADAR
,
64 XML_CHART_CLASS_STOCK
,
65 XML_CHART_CLASS_BUBBLE
,
66 XML_CHART_CLASS_GL3DBAR
,
67 XML_CHART_CLASS_ADDIN
,
68 XML_CHART_CLASS_UNKNOWN
71 SchXMLChartTypeEnum
GetChartTypeEnum( const OUString
& rClassName
);
73 OUString
GetChartTypeByClassName(
74 const OUString
& rClassName
, bool bUseOldNames
);
76 ::xmloff::token::XMLTokenEnum
getTokenByChartType(
77 const OUString
& rChartTypeService
, bool bUseOldNames
);
79 OUString
GetNewChartTypeName( const OUString
& rOldChartTypeName
);
82 css::chart2::data::XLabeledDataSequence2
> GetNewLabeledDataSequence();
84 css::uno::Reference
< css::chart2::data::XDataSequence
> CreateDataSequence(
85 const OUString
& rRange
,
86 const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDoc
);
88 css::uno::Reference
< css::chart2::data::XDataSequence
> CreateDataSequenceWithoutConvert(
89 const OUString
& rRange
,
90 const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDoc
);
92 void CreateCategories(
93 const css::uno::Reference
< css::chart2::data::XDataProvider
> & xDataProvider
,
94 const css::uno::Reference
< css::chart2::XChartDocument
> & xNewDoc
,
95 const OUString
& rRangeAddress
,
96 sal_Int32 nCooSysIndex
,
97 sal_Int32 nDimensionIndex
,
98 tSchXMLLSequencesPerIndex
* pLSequencesPerIndex
= nullptr );
100 css::uno::Any
getPropertyFromContext( const OUString
& rPropertyName
, const XMLPropStyleContext
* pPropStyleContext
, const SvXMLStylesContext
* pStylesCtxt
);
102 void exportText( SvXMLExport
& rExport
, const OUString
& rText
, bool bConvertTabsLFs
);
104 void exportRangeToSomewhere( SvXMLExport
& rExport
, const OUString
& rValue
);
106 /** checks if the data sequence has the property "CachedXMLRange" (true for
107 internal data sequences), and if so sets this property to the range
110 void setXMLRangePropertyAtDataSequence(
111 const css::uno::Reference
< css::chart2::data::XDataSequence
> & xDataSequence
,
112 const OUString
& rXMLRange
);
114 /** checks if the data sequence has the property "CachedXMLRange" (true for
115 internal data sequences), and if so retrieves this property and applies
116 it to the range given in rOutXMLRange.
118 @param bClearProp If true, the property is reset to its default after it
119 was assigned to rOutXMLRange
121 @return true, if the property was found, assigned and is non-empty
123 bool getXMLRangePropertyFromDataSequence(
124 const css::uno::Reference
< css::chart2::data::XDataSequence
> & xDataSequence
,
125 OUString
& rOutXMLRange
,
126 bool bClearProp
= false );
128 css::uno::Reference
< css::chart2::data::XDataProvider
> getDataProviderFromParent( const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDoc
);
130 bool switchBackToDataProviderFromParent( const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDoc
131 , const tSchXMLLSequencesPerIndex
& rLSequencesPerIndex
);
134 const css::uno::Reference
< css::beans::XPropertySet
> & xSource
,
135 const css::uno::Reference
< css::beans::XPropertySet
> & xDestination
);
138 #endif // INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLTOOLS_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */