summaryrefslogtreecommitdiff
path: root/oox/inc/oox/drawingml
diff options
context:
space:
mode:
Diffstat (limited to 'oox/inc/oox/drawingml')
-rw-r--r--oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx5
-rw-r--r--oox/inc/oox/drawingml/chart/converterbase.hxx1
-rw-r--r--oox/inc/oox/drawingml/color.hxx8
-rw-r--r--oox/inc/oox/drawingml/drawingmltypes.hxx23
-rw-r--r--oox/inc/oox/drawingml/fillproperties.hxx55
-rw-r--r--oox/inc/oox/drawingml/lineproperties.hxx48
-rwxr-xr-xoox/inc/oox/drawingml/shapepropertymap.hxx148
7 files changed, 180 insertions, 108 deletions
diff --git a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
index 3ff545cda295..9b495c72365a 100644
--- a/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
+++ b/oox/inc/oox/drawingml/chart/chartdrawingfragment.hxx
@@ -72,8 +72,7 @@ public:
void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue );
/** Calculates the resulting shape anchor in EMUs. */
- ::com::sun::star::awt::Rectangle
- calcEmuLocation( const EmuRectangle& rEmuChartRect ) const;
+ EmuRectangle calcAnchorRectEmu( const EmuRectangle& rChartRect ) const;
private:
AnchorPosModel maFrom; /// Top-left position relative to chart object.
@@ -109,7 +108,7 @@ private:
mxDrawPage; /// Drawing page of this sheet.
::oox::drawingml::ShapePtr mxShape; /// Current top-level shape.
ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape.
- EmuRectangle maEmuChartRect; /// Position and size of the chart object for embedded shapes (in EMUs).
+ EmuRectangle maChartRectEmu; /// Position and size of the chart object for embedded shapes (in EMUs).
bool mbOleSupport; /// True = allow to insert OLE objects into the drawing page.
};
diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx
index 12c6c2294b32..c174dc40505a 100644
--- a/oox/inc/oox/drawingml/chart/converterbase.hxx
+++ b/oox/inc/oox/drawingml/chart/converterbase.hxx
@@ -34,7 +34,6 @@
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; }
diff --git a/oox/inc/oox/drawingml/color.hxx b/oox/inc/oox/drawingml/color.hxx
index 51e9501205cf..ae5b82022f59 100644
--- a/oox/inc/oox/drawingml/color.hxx
+++ b/oox/inc/oox/drawingml/color.hxx
@@ -92,10 +92,10 @@ public:
@param nPhClr Actual color for the phClr placeholder color used in theme style lists. */
sal_Int32 getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
- /** Returns true, if the color has a transparence set. */
- bool hasTransparence() const;
- /** Returns the transparence of the color (0 = opaque, 100 = full transparent). */
- sal_Int16 getTransparence() const;
+ /** Returns true, if the color is transparent. */
+ bool hasTransparency() const;
+ /** Returns the transparency of the color (0 = opaque, 100 = full transparent). */
+ sal_Int16 getTransparency() const;
private:
/** Internal helper for getColor(). */
diff --git a/oox/inc/oox/drawingml/drawingmltypes.hxx b/oox/inc/oox/drawingml/drawingmltypes.hxx
index f8bb4c91b5d5..f0b66de6c273 100644
--- a/oox/inc/oox/drawingml/drawingmltypes.hxx
+++ b/oox/inc/oox/drawingml/drawingmltypes.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include "oox/helper/helper.hxx"
namespace oox {
namespace drawingml {
@@ -150,6 +151,23 @@ IndexRange GetIndexRange( const ::com::sun::star::uno::Reference< ::com::sun::st
// ============================================================================
+const sal_Int32 EMU_PER_HMM = 360; /// 360 EMUs per 1/100 mm.
+
+/** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */
+inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
+{
+ return static_cast< sal_Int64 >( nValue ) * EMU_PER_HMM;
+}
+
+/** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
+inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
+{
+ return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + EMU_PER_HMM / 2) / EMU_PER_HMM, 0, SAL_MAX_INT32 );
+}
+
+// ============================================================================
+
+/** A structure for a point with 64-bit interger components. */
struct EmuPoint
{
sal_Int64 X;
@@ -161,6 +179,7 @@ struct EmuPoint
// ============================================================================
+/** A structure for a size with 64-bit interger components. */
struct EmuSize
{
sal_Int64 Width;
@@ -172,11 +191,15 @@ struct EmuSize
// ============================================================================
+/** A structure for a rectangle with 64-bit interger components. */
struct EmuRectangle : public EmuPoint, public EmuSize
{
inline explicit EmuRectangle() {}
inline explicit EmuRectangle( const EmuPoint& rPos, const EmuSize& rSize ) : EmuPoint( rPos ), EmuSize( rSize ) {}
inline explicit EmuRectangle( sal_Int64 nX, sal_Int64 nY, sal_Int64 nWidth, sal_Int64 nHeight ) : EmuPoint( nX, nY ), EmuSize( nWidth, nHeight ) {}
+
+ inline void setPos( const EmuPoint& rPos ) { static_cast< EmuPoint& >( *this ) = rPos; }
+ inline void setSize( const EmuSize& rSize ) { static_cast< EmuSize& >( *this ) = rSize; }
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx
index d62651ebdc20..9f0271e418e8 100644
--- a/oox/inc/oox/drawingml/fillproperties.hxx
+++ b/oox/inc/oox/drawingml/fillproperties.hxx
@@ -36,7 +36,6 @@
namespace oox {
class GraphicHelper;
- class ModelObjectHelper;
class PropertyMap;
class PropertySet;
}
@@ -44,38 +43,7 @@ namespace oox {
namespace oox {
namespace drawingml {
-// ============================================================================
-
-enum FillPropertyId
-{
- FillStyleId,
- FillColorId,
- FillTransparenceId,
- FillGradientId,
- FillBitmapUrlId,
- FillBitmapModeId,
- FillBitmapSizeXId,
- FillBitmapSizeYId,
- FillBitmapOffsetXId,
- FillBitmapOffsetYId,
- FillBitmapRectanglePointId,
- FillId_END
-};
-
-struct FillPropertyIds
-{
- const sal_Int32* mpnPropertyIds;
- bool mbNamedFillGradient;
- bool mbNamedFillBitmap;
-
- explicit FillPropertyIds(
- const sal_Int32* pnPropertyIds,
- bool bNamedFillGradient,
- bool bNamedFillBitmap );
-
- inline bool has( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
- inline sal_Int32 operator[]( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
-};
+class ShapePropertyMap;
// ============================================================================
@@ -147,8 +115,6 @@ struct FillProperties
PatternFillProperties maPatternProps; /// Properties for pattern fills.
BlipFillProperties maBlipProps; /// Properties for bitmap fills.
- static FillPropertyIds DEFAULT_IDS; /// Default fill property identifiers for shape fill.
-
/** Overwrites all members that are explicitly set in rSourceProps. */
void assignUsed( const FillProperties& rSourceProps );
@@ -158,19 +124,8 @@ struct FillProperties
/** Writes the properties to the passed property map. */
void pushToPropMap(
- PropertyMap& rPropMap,
- ModelObjectHelper& rModelObjHelper,
+ ShapePropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper,
- const FillPropertyIds& rPropIds = DEFAULT_IDS,
- sal_Int32 nShapeRotation = 0,
- sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
-
- /** Writes the properties to the passed property set. */
- void pushToPropSet(
- PropertySet& rPropSet,
- ModelObjectHelper& rModelObjHelper,
- const GraphicHelper& rGraphicHelper,
- const FillPropertyIds& rPropIds = DEFAULT_IDS,
sal_Int32 nShapeRotation = 0,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
};
@@ -189,12 +144,6 @@ struct GraphicProperties
PropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
-
- /** Writes the properties to the passed property set. */
- void pushToPropSet(
- PropertySet& rPropSet,
- const GraphicHelper& rGraphicHelper,
- sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/lineproperties.hxx b/oox/inc/oox/drawingml/lineproperties.hxx
index 0f034a89f65b..2ddb21d2fb93 100644
--- a/oox/inc/oox/drawingml/lineproperties.hxx
+++ b/oox/inc/oox/drawingml/lineproperties.hxx
@@ -35,40 +35,6 @@ namespace drawingml {
// ============================================================================
-enum LinePropertyId
-{
- LineStyleId,
- LineWidthId,
- LineColorId,
- LineTransparenceId,
- LineDashId,
- LineJointId,
- LineStartId,
- LineStartWidthId,
- LineStartCenterId,
- LineEndId,
- LineEndWidthId,
- LineEndCenterId,
- LineId_END
-};
-
-struct LinePropertyIds
-{
- const sal_Int32* mpnPropertyIds;
- bool mbNamedLineDash;
- bool mbNamedLineMarker;
-
- explicit LinePropertyIds(
- const sal_Int32* pnPropertyIds,
- bool bNamedLineDash,
- bool bNamedLineMarker );
-
- inline bool has( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
- inline sal_Int32 operator[]( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
-};
-
-// ============================================================================
-
struct LineArrowProperties
{
OptValue< sal_Int32 > moArrowType;
@@ -96,25 +62,13 @@ struct LineProperties
OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token).
OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token).
- static LinePropertyIds DEFAULT_IDS; /// Default line property identifiers.
-
/** Overwrites all members that are explicitly set in rSourceProps. */
void assignUsed( const LineProperties& rSourceProps );
/** Writes the properties to the passed property map. */
void pushToPropMap(
- PropertyMap& rPropMap,
- ModelObjectHelper& rModelObjHelper,
- const GraphicHelper& rGraphicHelper,
- const LinePropertyIds& rPropIds = DEFAULT_IDS,
- sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
-
- /** Writes the properties to the passed property map. */
- void pushToPropSet(
- PropertySet& rPropSet,
- ModelObjectHelper& rModelObjHelper,
+ ShapePropertyMap& rPropMap,
const GraphicHelper& rGraphicHelper,
- const LinePropertyIds& rPropIds = DEFAULT_IDS,
sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
};
diff --git a/oox/inc/oox/drawingml/shapepropertymap.hxx b/oox/inc/oox/drawingml/shapepropertymap.hxx
new file mode 100755
index 000000000000..e012d4b2a9ac
--- /dev/null
+++ b/oox/inc/oox/drawingml/shapepropertymap.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+#define OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+
+#include "oox/helper/propertymap.hxx"
+
+namespace oox { class ModelObjectHelper; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** Enumeration for various properties related to drawing shape formatting.
+
+ This is an abstraction for shape formatting properties that have different
+ names in various implementations, e.g. drawing shapes vs. chart objects.
+ */
+enum ShapePropertyId
+{
+ SHAPEPROP_LineStyle,
+ SHAPEPROP_LineWidth,
+ SHAPEPROP_LineColor,
+ SHAPEPROP_LineTransparency,
+ SHAPEPROP_LineDash, /// Explicit line dash or name of a line dash stored in a global container.
+ SHAPEPROP_LineJoint,
+ SHAPEPROP_LineStart, /// Explicit line start marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineStartWidth,
+ SHAPEPROP_LineStartCenter,
+ SHAPEPROP_LineEnd, /// Explicit line end marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineEndWidth,
+ SHAPEPROP_LineEndCenter,
+ SHAPEPROP_FillStyle,
+ SHAPEPROP_FillColor,
+ SHAPEPROP_FillTransparency,
+ SHAPEPROP_FillGradient, /// Explicit fill gradient or name of a fill gradient stored in a global container.
+ SHAPEPROP_FillBitmapUrl, /// Explicit fill bitmap URL or name of a fill bitmap URL stored in a global container.
+ SHAPEPROP_FillBitmapMode,
+ SHAPEPROP_FillBitmapSizeX,
+ SHAPEPROP_FillBitmapSizeY,
+ SHAPEPROP_FillBitmapOffsetX,
+ SHAPEPROP_FillBitmapOffsetY,
+ SHAPEPROP_FillBitmapRectanglePoint,
+ SHAPEPROP_END
+};
+
+// ============================================================================
+
+struct ShapePropertyInfo
+{
+ const sal_Int32* mpnPropertyIds; /// Pointer to array of property identifiers for all SHAPEPROP properties.
+ bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
+ bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
+ bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
+ bool mbNamedFillBitmapUrl; /// True = use named fill bitmap URL instead of explicit fill bitmap URL.
+
+ static ShapePropertyInfo DEFAULT; /// Default property info (used as default parameter of other methods).
+
+ explicit ShapePropertyInfo(
+ const sal_Int32* pnPropertyIds,
+ bool bNamedLineMarker,
+ bool bNamedLineDash,
+ bool bNamedFillGradient,
+ bool bNamedFillBitmapUrl );
+
+ inline bool has( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
+ inline sal_Int32 operator[]( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
+};
+
+// ============================================================================
+
+class ShapePropertyMap : public PropertyMap
+{
+public:
+ explicit ShapePropertyMap(
+ ModelObjectHelper& rModelObjHelper,
+ const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT );
+
+ /** Returns true, if the specified property is supported. */
+ bool supportsProperty( ShapePropertyId ePropId ) const;
+
+ /** Returns true, if named line markers are supported, and the specified
+ line marker has already been inserted into the marker table. */
+ bool hasNamedLineMarkerInTable( const ::rtl::OUString& rMarkerName ) const;
+
+ /** Sets the specified shape property to the passed value. */
+ bool setAnyProperty( ShapePropertyId ePropId, const ::com::sun::star::uno::Any& rValue );
+
+ /** Sets the specified shape property to the passed value. */
+ template< typename Type >
+ inline bool setProperty( ShapePropertyId ePropId, const Type& rValue )
+ { return setAnyProperty( ePropId, ::com::sun::star::uno::Any( rValue ) ); }
+
+ using PropertyMap::setAnyProperty;
+ using PropertyMap::setProperty;
+ using PropertyMap::operator[];
+
+private:
+ /** Sets an explicit line marker, or creates a named line marker. */
+ bool setLineMarker( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit line dash, or creates a named line dash. */
+ bool setLineDash( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill gradient, or creates a named fill gradient. */
+ bool setFillGradient( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill bitmap URL, or creates a named fill bitmap URL. */
+ bool setFillBitmapUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+
+ // not implemented, to prevent implicit conversion from enum to int
+ ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId );
+ const ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId ) const;
+
+private:
+ ModelObjectHelper& mrModelObjHelper;
+ ShapePropertyInfo maShapePropInfo;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif