diff options
Diffstat (limited to 'oox/inc/oox/drawingml')
-rw-r--r-- | oox/inc/oox/drawingml/chart/axisconverter.hxx | 9 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/chartcontextbase.hxx | 15 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/converterbase.hxx | 59 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/modelbase.hxx | 19 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/plotareaconverter.hxx | 3 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/plotareamodel.hxx | 1 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/seriesconverter.hxx | 12 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/titlecontext.hxx | 15 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/titleconverter.hxx | 3 | ||||
-rw-r--r-- | oox/inc/oox/drawingml/chart/titlemodel.hxx | 18 |
10 files changed, 101 insertions, 53 deletions
diff --git a/oox/inc/oox/drawingml/chart/axisconverter.hxx b/oox/inc/oox/drawingml/chart/axisconverter.hxx index 4e8f86279133..925fa1fe8b4f 100644 --- a/oox/inc/oox/drawingml/chart/axisconverter.hxx +++ b/oox/inc/oox/drawingml/chart/axisconverter.hxx @@ -41,15 +41,6 @@ namespace chart { // ============================================================================ -const sal_Int32 API_PRIM_AXESSET = 0; -const sal_Int32 API_SECN_AXESSET = 1; - -const sal_Int32 API_X_AXIS = 0; -const sal_Int32 API_Y_AXIS = 1; -const sal_Int32 API_Z_AXIS = 2; - -// ============================================================================ - struct AxisModel; class TypeGroupConverter; diff --git a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx index 470596a5228e..f034b4b6e6bb 100644 --- a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx +++ b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx @@ -79,6 +79,21 @@ public: // ============================================================================ +struct LayoutModel; + +/** Handler for a chart layout context (c:layout element). + */ +class LayoutContext : public ContextBase< LayoutModel > +{ +public: + explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel ); + virtual ~LayoutContext(); + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); +}; + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx index 23f5a5ff9266..c937c6e94900 100644 --- a/oox/inc/oox/drawingml/chart/converterbase.hxx +++ b/oox/inc/oox/drawingml/chart/converterbase.hxx @@ -32,9 +32,12 @@ #include "oox/drawingml/chart/objectformatter.hxx" namespace com { namespace sun { namespace star { + namespace awt { struct Rectangle; } namespace awt { struct Size; } namespace lang { class XMultiServiceFactory; } namespace chart2 { class XChartDocument; } + namespace chart2 { class XTitle; } + namespace drawing { class XShape; } } } } namespace oox { namespace core { @@ -45,13 +48,21 @@ namespace oox { namespace drawingml { namespace chart { -// ============================================================================ - class ChartConverter; -class ObjectFormatter; struct ChartSpaceModel; struct ConverterData; +// ============================================================================ + +const sal_Int32 API_PRIM_AXESSET = 0; +const sal_Int32 API_SECN_AXESSET = 1; + +const sal_Int32 API_X_AXIS = 0; +const sal_Int32 API_Y_AXIS = 1; +const sal_Int32 API_Z_AXIS = 2; + +// ============================================================================ + class ConverterRoot { public: @@ -63,12 +74,6 @@ public: const ::com::sun::star::awt::Size& rChartSize ); virtual ~ConverterRoot(); - /** Creates an instance for the passed service name, using the passed service factory. */ - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - createInstance( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxFactory, - const ::rtl::OUString& rServiceName ); - /** Creates an instance for the passed service name, using the process service factory. */ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createInstance( const ::rtl::OUString& rServiceName ) const; @@ -86,12 +91,24 @@ protected: /** Returns the object formatter. */ ObjectFormatter& getFormatter() const; + /** Registers a title object and its layout data, needed for conversion of + the title position using the old Chart1 API. */ + void registerTitleLayout( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle >& rxTitle, + const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType, + sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 ); + /** Converts the positions of the main title and all axis titles. */ + void convertTitlePositions(); + private: ::boost::shared_ptr< ConverterData > mxData; }; // ============================================================================ +/** Base class of all converter classes. Holds a reference to a model structure + of the specified type. + */ template< typename ModelType > class ConverterBase : public ConverterRoot { @@ -109,6 +126,30 @@ protected: // ============================================================================ +/** A layout converter calculates positions and sizes for various chart objects. + */ +class LayoutConverter : public ConverterBase< LayoutModel > +{ +public: + explicit LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel ); + virtual ~LayoutConverter(); + + /** Tries to calculate the absolute position and size from the contained + OOXML layout model. Returns true, if returned rectangle is valid. */ + bool calcAbsRectangle( ::com::sun::star::awt::Rectangle& orRect ) const; + + /** Tries to set the position from the contained OOXML layout model. + Returns true, if a manual position could be calculated. */ + bool convertFromModel( PropertySet& rPropSet ); + /** Tries to set the position from the contained OOXML layout model. + Returns true, if a manual position could be calculated. */ + bool convertFromModel( + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, + double fRotationAngle ); +}; + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/inc/oox/drawingml/chart/modelbase.hxx b/oox/inc/oox/drawingml/chart/modelbase.hxx index 113d6f686fd1..d34970025abd 100644 --- a/oox/inc/oox/drawingml/chart/modelbase.hxx +++ b/oox/inc/oox/drawingml/chart/modelbase.hxx @@ -114,6 +114,25 @@ struct NumberFormat // ============================================================================ +struct LayoutModel +{ + double mfX; /// Left position of this object. + double mfY; /// Top position of this object. + double mfW; /// Width of this object. + double mfH; /// Height of this object. + sal_Int32 mnXMode; /// Mode for left position. + sal_Int32 mnYMode; /// Mode for top position. + sal_Int32 mnWMode; /// Mode for width. + sal_Int32 mnHMode; /// Mode for height. + sal_Int32 mnTarget; /// Layout target for plot area. + bool mbAutoLayout; /// True = automatic positioning. + + explicit LayoutModel(); + ~LayoutModel(); +}; + +// ============================================================================ + } // namespace chart } // namespace drawingml } // namespace oox diff --git a/oox/inc/oox/drawingml/chart/plotareaconverter.hxx b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx index b2583b2e57a1..e35afb633b92 100644 --- a/oox/inc/oox/drawingml/chart/plotareaconverter.hxx +++ b/oox/inc/oox/drawingml/chart/plotareaconverter.hxx @@ -83,6 +83,8 @@ public: /** Converts the OOXML plot area model to a chart2 diagram. */ void convertFromModel( View3DModel& rView3DModel ); + /** Converts the manual plot area position and size, if set. */ + void convertPositionFromModel(); /** Returns the automatic chart title if the chart contains only one series. */ inline const ::rtl::OUString& getAutomaticTitle() const { return maAutoTitle; } @@ -95,6 +97,7 @@ private: ::rtl::OUString maAutoTitle; bool mb3dChart; bool mbWall3dChart; + bool mbPieChart; }; // ============================================================================ diff --git a/oox/inc/oox/drawingml/chart/plotareamodel.hxx b/oox/inc/oox/drawingml/chart/plotareamodel.hxx index 2dfe1c33f4e3..c5793717defc 100644 --- a/oox/inc/oox/drawingml/chart/plotareamodel.hxx +++ b/oox/inc/oox/drawingml/chart/plotareamodel.hxx @@ -31,7 +31,6 @@ #include "oox/drawingml/shape.hxx" #include "oox/drawingml/chart/axismodel.hxx" #include "oox/drawingml/chart/seriesmodel.hxx" -#include "oox/drawingml/chart/titlemodel.hxx" #include "oox/drawingml/chart/typegroupmodel.hxx" namespace oox { diff --git a/oox/inc/oox/drawingml/chart/seriesconverter.hxx b/oox/inc/oox/drawingml/chart/seriesconverter.hxx index 7f6a08655b17..fd3ca207d7c0 100644 --- a/oox/inc/oox/drawingml/chart/seriesconverter.hxx +++ b/oox/inc/oox/drawingml/chart/seriesconverter.hxx @@ -100,6 +100,18 @@ private: // ============================================================================ +class TrendlineLabelConverter : public ConverterBase< TrendlineLabelModel > +{ +public: + explicit TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel ); + virtual ~TrendlineLabelConverter(); + + /** Converts the OOXML trendline label. */ + void convertFromModel( PropertySet& rPropSet ); +}; + +// ============================================================================ + class TrendlineConverter : public ConverterBase< TrendlineModel > { public: diff --git a/oox/inc/oox/drawingml/chart/titlecontext.hxx b/oox/inc/oox/drawingml/chart/titlecontext.hxx index b5743cc78f42..b3fec5d93203 100644 --- a/oox/inc/oox/drawingml/chart/titlecontext.hxx +++ b/oox/inc/oox/drawingml/chart/titlecontext.hxx @@ -36,21 +36,6 @@ namespace chart { // ============================================================================ -struct LayoutModel; - -/** Handler for a chart layout context (c:layout element). - */ -class LayoutContext : public ContextBase< LayoutModel > -{ -public: - explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel ); - virtual ~LayoutContext(); - - virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); -}; - -// ============================================================================ - struct TextModel; /** Handler for a chart text context (c:tx element). diff --git a/oox/inc/oox/drawingml/chart/titleconverter.hxx b/oox/inc/oox/drawingml/chart/titleconverter.hxx index d1fcfcfcfebc..d153e9f3e760 100644 --- a/oox/inc/oox/drawingml/chart/titleconverter.hxx +++ b/oox/inc/oox/drawingml/chart/titleconverter.hxx @@ -84,7 +84,8 @@ public: /** Creates a title text object and attaches it at the passed interface. */ void convertFromModel( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitled >& rxTitled, - const ::rtl::OUString& rAutoTitle, ObjectType eObjType ); + const ::rtl::OUString& rAutoTitle, ObjectType eObjType, + sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 ); }; // ============================================================================ diff --git a/oox/inc/oox/drawingml/chart/titlemodel.hxx b/oox/inc/oox/drawingml/chart/titlemodel.hxx index f5d46957b450..f80837249809 100644 --- a/oox/inc/oox/drawingml/chart/titlemodel.hxx +++ b/oox/inc/oox/drawingml/chart/titlemodel.hxx @@ -37,24 +37,6 @@ namespace chart { // ============================================================================ -struct LayoutModel -{ - double mfX; /// Left position of this object. - double mfY; /// Top position of this object. - double mfW; /// Width of this object. - double mfH; /// Height of this object. - sal_Int32 mnXMode; /// Mode for left position. - sal_Int32 mnYMode; /// Mode for top position. - sal_Int32 mnWMode; /// Mode for width. - sal_Int32 mnHMode; /// Mode for height. - sal_Int32 mnTarget; /// Layout target for plot area. - - explicit LayoutModel(); - ~LayoutModel(); -}; - -// ============================================================================ - struct TextModel { typedef ModelRef< DataSequenceModel > DataSequenceRef; |