Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1492
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/92/1492/1
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.
Change-Id: I8b9ce3ae1aef7894ab04b9857e90831d715ec1d5
Signed-off-by: Lennard <Wasserthal@nefkom.net>
---
M oox/source/drawingml/customshapepresets4.cxx
M oox/source/export/shapes.cxx
2 files changed, 218 insertions(+), 0 deletions(-)
diff --git a/oox/source/drawingml/customshapepresets4.cxx
b/oox/source/drawingml/customshapepresets4.cxx
index 4aee3a2d..81f7688 100644
--- a/oox/source/drawingml/customshapepresets4.cxx
+++ b/oox/source/drawingml/customshapepresets4.cxx
@@ -1652,6 +1652,222 @@
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 = CREATE_OUSTRING ("adj1");
+ }
+ {
+ Any aAny ((sal_Int32) 50000);
+ aAdjSequence [1].Value = aAny;
+ aAdjSequence [1].Name = CREATE_OUSTRING ("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 = CREATE_OUSTRING ("Position");
+ static const CustomShapeProvider::ParameterPairData aData =
+ {
+ EnhancedCustomShapeParameterType::EQUATION,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 8, 14
+ };
+ aPropSequence [0].Value = makeAny (createParameterPair(&aData));
+ }
+ {
+ aPropSequence [1].Name = CREATE_OUSTRING ("RangeXMaximum");
+ EnhancedCustomShapeParameter aParameter;
+ Any aAny ((sal_Int32) 100000);
+ aParameter.Value = aAny;
+ aParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aPropSequence [1].Value = makeAny (aParameter);
+ }
+ {
+ aPropSequence [2].Name = CREATE_OUSTRING ("RangeXMinimum");
+ EnhancedCustomShapeParameter aParameter;
+ Any aAny ((sal_Int32) 0);
+ aParameter.Value = aAny;
+ aParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aPropSequence [2].Value = makeAny (aParameter);
+ }
+ {
+ aPropSequence [3].Name = CREATE_OUSTRING ("RefX");
+ Any aAny ((sal_Int32) 0);
+ aPropSequence [3].Value = makeAny (aAny);
+ }
+ aPropSequenceSequence [0] = aPropSequence;
+ }
+ {
+ Sequence< PropertyValue > aPropSequence (4);
+ {
+ aPropSequence [0].Name = CREATE_OUSTRING ("Position");
+ static const CustomShapeProvider::ParameterPairData aData =
+ {
+ EnhancedCustomShapeParameterType::NORMAL,
+ EnhancedCustomShapeParameterType::EQUATION,
+ 0, 5
+ };
+ aPropSequence [0].Value = makeAny (createParameterPair(&aData));
+ }
+ {
+ aPropSequence [1].Name = CREATE_OUSTRING ("RangeYMaximum");
+ EnhancedCustomShapeParameter aParameter;
+ Any aAny ((sal_Int32) 1);
+ aParameter.Value = aAny;
+ aParameter.Type = EnhancedCustomShapeParameterType::EQUATION;
+ aPropSequence [1].Value = makeAny (aParameter);
+ }
+ {
+ aPropSequence [2].Name = CREATE_OUSTRING ("RangeYMinimum");
+ EnhancedCustomShapeParameter aParameter;
+ Any aAny ((sal_Int32) 0);
+ aParameter.Value = aAny;
+ aParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
+ aPropSequence [2].Value = makeAny (aParameter);
+ }
+ {
+ aPropSequence [3].Name = CREATE_OUSTRING ("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 = CREATE_OUSTRING ("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 = CREATE_OUSTRING ("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 = CREATE_OUSTRING ("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 ] <<= CREATE_OUSTRING("ooxml-upArrow");
+
+ return aPropertyMap;
+ }
+};
class ShapeCcurvedDownArrow : public CustomShapeProvider
{
virtual PropertyMap getProperties()
@@ -8476,6 +8692,7 @@
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( OUString(
RTL_CONSTASCII_USTRINGPARAM( "flowChartMerge" ) ) ) ] = new ShapeCflowChartMerge();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( OUString(
RTL_CONSTASCII_USTRINGPARAM( "line" ) ) ) ] = new ShapeCline();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( OUString(
RTL_CONSTASCII_USTRINGPARAM( "downArrow" ) ) ) ] = new ShapeCdownArrow();
+ maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( OUString(
RTL_CONSTASCII_USTRINGPARAM( "upArrow" ) ) ) ] = new ShapeCupArrow();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( OUString(
RTL_CONSTASCII_USTRINGPARAM( "curvedDownArrow" ) ) ) ] = new ShapeCcurvedDownArrow();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( OUString(
RTL_CONSTASCII_USTRINGPARAM( "actionButtonReturn" ) ) ) ] = new ShapeCactionButtonReturn();
maPresetsMap [ StaticTokenMap::get().getTokenFromUnicode( OUString(
RTL_CONSTASCII_USTRINGPARAM( "flowChartInputOutput" ) ) ) ] = new ShapeCflowChartInputOutput();
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 87b8e55..1a4d8f1 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -439,6 +439,7 @@
{ "ooxml-flowChartMerge", "flowChartMerge" },
{ "ooxml-line", "line" },
{ "ooxml-downArrow", "downArrow" },
+ { "ooxml-upArrow", "upArrow" },
{ "ooxml-curvedDownArrow", "curvedDownArrow" },
{ "ooxml-actionButtonReturn", "actionButtonReturn" },
{ "ooxml-flowChartInputOutput", "flowChartInputOutput" },
--
To view, visit https://gerrit.libreoffice.org/1492
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8b9ce3ae1aef7894ab04b9857e90831d715ec1d5
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Lennard Wasserthal <Wasserthal@nefkom.net>
Context
- [PATCH] fdo#56976 fixes up Arrow import bug · Lennard Wasserthal (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.