summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorLennard <Wasserthal@nefkom.net>2012-12-27 22:12:56 +0100
committerPetr Mladek <pmladek@suse.cz>2013-01-31 17:38:27 +0000
commitd9a18176d6b56119aa91699cd3aa102e36a7805c (patch)
treed4d1453d67a700ef6711bf3fec6fe2e7ffb6f8b5 /oox
parentaf331776895c1c3d036040599501d3f08a4d5562 (diff)
fdo#56976 fixes up Arrow import bug
Importing an LibreOffice upArrow from an pptx document caused it and several custom shapes go down the drain. That was perhaps a memory violation because the procedure to generate it in working memory was missing. This patch gets you that procedure. Note it cannot be manipulated yet. Signed-off-by: Lennard <Wasserthal@nefkom.net> Conflicts: oox/source/drawingml/customshapepresets4.cxx Change-Id: I8b9ce3ae1aef7894ab04b9857e90831d715ec1d5 Reviewed-on: https://gerrit.libreoffice.org/1492 Reviewed-by: Petr Mladek <pmladek@suse.cz> Tested-by: Petr Mladek <pmladek@suse.cz>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/customshapepresets4.cxx217
-rw-r--r--oox/source/export/shapes.cxx1
2 files changed, 218 insertions, 0 deletions
diff --git a/oox/source/drawingml/customshapepresets4.cxx b/oox/source/drawingml/customshapepresets4.cxx
index f7a112da8070..f79fb8e53e5f 100644
--- a/oox/source/drawingml/customshapepresets4.cxx
+++ b/oox/source/drawingml/customshapepresets4.cxx
@@ -1651,6 +1651,222 @@ class ShapeCdownArrow : public CustomShapeProvider
return aPropertyMap;
}
};
+class ShapeCupArrow : public CustomShapeProvider
+{
+ virtual PropertyMap getProperties()
+ {
+ PropertyMap aPropertyMap;
+
+ {
+ Sequence< EnhancedCustomShapeAdjustmentValue > aAdjSequence (2);
+ {
+ Any aAny ((sal_Int32) 50000);
+ aAdjSequence [0].Value = aAny;
+ aAdjSequence [0].Name = "adj1";
+ }
+ {
+ Any aAny ((sal_Int32) 50000);
+ aAdjSequence [1].Value = aAny;
+ aAdjSequence [1].Name = "adj2";
+ }
+ aPropertyMap [PROP_AdjustmentValues] <<= aAdjSequence;
+ }
+ {
+ static const char *aStrings[] = {
+ "min(logwidth,logheight)",
+ "100000*logheight/?0 ",
+ "if(0-$0 ,0,if(100000-$0 ,$0 ,100000))",
+ "if(0-$1 ,0,if(?1 -$1 ,$1 ,?1 ))",
+ "?0 *?3 /100000",
+ "0+?4 -0",
+ "logwidth*?2 /200000",
+ "logwidth/2",
+ "?7 +0-?6 ",
+ "?7 +?6 -0",
+ "logwidth/2",
+ "?8 *?4 /?10 ",
+ "?5 +0 -?11",
+ "logwidth",
+ "logheight"
+ };
+ aPropertyMap [PROP_Equations] <<= createStringSequence( SAL_N_ELEMENTS( aStrings ), aStrings );
+ }
+ {
+ Sequence< Sequence < PropertyValue > > aPropSequenceSequence (2);
+ {
+ Sequence< PropertyValue > aPropSequence (4);
+ {
+ aPropSequence [0].Name = "Position";
+ static const CustomShapeProvider::ParameterPairData aData =
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 8, 14
+ };
+ aPropSequence [0].Value = makeAny (createParameterPair(&aData));
+ }
+ {
+ aPropSequence [1].Name = "RangeXMaximum";
+ EnhancedCustomShapeParameter aParameter;
+ Any aAny ((sal_Int32) 100000);
+ aParameter.Value = aAny;
+ aParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aPropSequence [1].Value = makeAny (aParameter);
+ }
+ {
+ aPropSequence [2].Name = "RangeXMinimum";
+ EnhancedCustomShapeParameter aParameter;
+ Any aAny ((sal_Int32) 0);
+ aParameter.Value = aAny;
+ aParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aPropSequence [2].Value = makeAny (aParameter);
+ }
+ {
+ aPropSequence [3].Name = "RefX";
+ Any aAny ((sal_Int32) 0);
+ aPropSequence [3].Value = makeAny (aAny);
+ }
+ aPropSequenceSequence [0] = aPropSequence;
+ }
+ {
+ Sequence< PropertyValue > aPropSequence (4);
+ {
+ aPropSequence [0].Name = "Position";
+ static const CustomShapeProvider::ParameterPairData aData =
+ {
+ EnhancedCustomShapeParameterType::NORMAL,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 0, 5
+ };
+ aPropSequence [0].Value = makeAny (createParameterPair(&aData));
+ }
+ {
+ aPropSequence [1].Name = "RangeYMaximum";
+ EnhancedCustomShapeParameter aParameter;
+ Any aAny ((sal_Int32) 1);
+ aParameter.Value = aAny;
+ aParameter.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aPropSequence [1].Value = makeAny (aParameter);
+ }
+ {
+ aPropSequence [2].Name = "RangeYMinimum";
+ EnhancedCustomShapeParameter aParameter;
+ Any aAny ((sal_Int32) 0);
+ aParameter.Value = aAny;
+ aParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aPropSequence [2].Value = makeAny (aParameter);
+ }
+ {
+ aPropSequence [3].Name = "RefY";
+ Any aAny ((sal_Int32) 1);
+ aPropSequence [3].Value = makeAny (aAny);
+ }
+ aPropSequenceSequence [1] = aPropSequence;
+ }
+ aPropertyMap [PROP_Handles] <<= aPropSequenceSequence;
+ }
+ {
+ aPropertyMap [PROP_MirroredX] <<= Any ((sal_Bool) sal_False);
+ }
+ {
+ aPropertyMap [PROP_MirroredY] <<= Any ((sal_Bool) sal_False);
+ }
+ {
+ Sequence< PropertyValue > aPropSequence (3);
+ {
+ aPropSequence [0].Name = "Coordinates";
+ static const CustomShapeProvider::ParameterPairData aData[] = {
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 8, 5
+ },
+ {
+ EnhancedCustomShapeParameterType::NORMAL,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 0, 5
+ },
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::NORMAL,
+ 7, 0
+ },
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 13, 5
+ },
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 9, 5
+ },
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 9, 14
+ },
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 8, 14
+ }
+ };
+ aPropSequence [0].Value = makeAny (createParameterPairSequence(SAL_N_ELEMENTS(aData), aData));
+ }
+ {
+ aPropSequence [1].Name = "Segments";
+ static const sal_uInt16 nValues[] = {
+ // Command, Count
+ 1,1,
+ 2,6,
+ 4,0,
+ 5,0
+ };
+ aPropSequence [1].Value = makeAny (createSegmentSequence( SAL_N_ELEMENTS( nValues ), nValues ));
+ }
+ {
+ aPropSequence [2].Name = "TextFrames";
+ Sequence< EnhancedCustomShapeTextFrame > aTextFrameSeq (1);
+ {
+ EnhancedCustomShapeTextFrame aTextFrame;
+ {
+ static const CustomShapeProvider::ParameterPairData aData =
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 8, 12
+ };
+ aTextFrame.TopLeft = createParameterPair(&aData);
+ }
+ {
+ static const CustomShapeProvider::ParameterPairData aData =
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 9, 13
+ };
+ aTextFrame.BottomRight = createParameterPair(&aData);
+ }
+ aTextFrameSeq [0] = aTextFrame;
+ }
+ aPropSequence [2].Value = makeAny (aTextFrameSeq);
+ }
+ aPropertyMap [PROP_Path] <<= aPropSequence;
+ }
+ {
+ awt::Rectangle aRectangle;
+ aRectangle.X = 0;
+ aRectangle.Y = 0;
+ aRectangle.Width = 0;
+ aRectangle.Height = 0;
+ aPropertyMap [PROP_ViewBox] <<= aRectangle;
+ }
+ aPropertyMap [ PROP_Type ] <<= OUString("ooxml-upArrow");
+
+ return aPropertyMap;
+ }
+};
class ShapeCcurvedDownArrow : public CustomShapeProvider
{
virtual PropertyMap getProperties()
@@ -8475,6 +8691,7 @@ void CustomShapeProperties::initializePresetsMap4()
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( "flowChartMerge" ) ] = new ShapeCflowChartMerge();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( "line" ) ] = new ShapeCline();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( "downArrow" ) ] = new ShapeCdownArrow();
+ maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( "upArrow" ) ] = new ShapeCupArrow();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( "curvedDownArrow" ) ] = new ShapeCcurvedDownArrow();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( "actionButtonReturn" ) ] = new ShapeCactionButtonReturn();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( "flowChartInputOutput" ) ] = new ShapeCflowChartInputOutput();
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 6aa3b0dba939..41d505a5df48 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -435,6 +435,7 @@ static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[]
{ "ooxml-flowChartMerge", "flowChartMerge" },
{ "ooxml-line", "line" },
{ "ooxml-downArrow", "downArrow" },
+ { "ooxml-upArrow", "upArrow" },
{ "ooxml-curvedDownArrow", "curvedDownArrow" },
{ "ooxml-actionButtonReturn", "actionButtonReturn" },
{ "ooxml-flowChartInputOutput", "flowChartInputOutput" },