[Libreoffice-commits] .: oox/source

Lennard Wasserthal at nefkom.net
Thu Jan 31 09:38:48 PST 2013


 oox/source/drawingml/customshapepresets4.cxx |  217 +++++++++++++++++++++++++++
 oox/source/export/shapes.cxx                 |    1 
 2 files changed, 218 insertions(+)

New commits:
commit d9a18176d6b56119aa91699cd3aa102e36a7805c
Author: Lennard <Wasserthal at nefkom.net>
Date:   Thu Dec 27 22:12:56 2012 +0100

    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 at nefkom.net>
    
    Conflicts:
    	oox/source/drawingml/customshapepresets4.cxx
    
    Change-Id: I8b9ce3ae1aef7894ab04b9857e90831d715ec1d5
    Reviewed-on: https://gerrit.libreoffice.org/1492
    Reviewed-by: Petr Mladek <pmladek at suse.cz>
    Tested-by: Petr Mladek <pmladek at suse.cz>

diff --git a/oox/source/drawingml/customshapepresets4.cxx b/oox/source/drawingml/customshapepresets4.cxx
index f7a112d..f79fb8e 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 6aa3b0d..41d505a 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" },


More information about the Libreoffice-commits mailing list