You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2012/08/20 13:46:47 UTC

svn commit: r1374979 [26/29] - in /incubator/ooo/branches/writer001: ./ ext_libraries/apr-util/ ext_libraries/apr-util/prj/ ext_libraries/apr/ ext_libraries/coinmp/ ext_libraries/hunspell/ ext_libraries/serf/ ext_libraries/serf/prj/ ext_sources/ extras...

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svggnode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svggnode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svggnode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svggnode.cxx Mon Aug 20 11:46:19 2012
@@ -51,9 +51,8 @@ namespace svgio
         const SvgStyleAttributes* SvgGNode::getSvgStyleAttributes() const
         {
             static rtl::OUString aClassStr(rtl::OUString::createFromAscii("g"));
-            maSvgStyleAttributes.checkForCssStyle(aClassStr);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(aClassStr, maSvgStyleAttributes);
         }
 
         void SvgGNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgimagenode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgimagenode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgimagenode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgimagenode.cxx Mon Aug 20 11:46:19 2012
@@ -70,9 +70,8 @@ namespace svgio
         const SvgStyleAttributes* SvgImageNode::getSvgStyleAttributes() const
         {
             static rtl::OUString aClassStr(rtl::OUString::createFromAscii("image"));
-            maSvgStyleAttributes.checkForCssStyle(aClassStr);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(aClassStr, maSvgStyleAttributes);
         }
 
         void SvgImageNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svglinenode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svglinenode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svglinenode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svglinenode.cxx Mon Aug 20 11:46:19 2012
@@ -53,9 +53,8 @@ namespace svgio
         const SvgStyleAttributes* SvgLineNode::getSvgStyleAttributes() const
         {
             static rtl::OUString aClassStr(rtl::OUString::createFromAscii("line"));
-            maSvgStyleAttributes.checkForCssStyle(aClassStr);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(aClassStr, maSvgStyleAttributes);
         }
 
         void SvgLineNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgmarkernode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgmarkernode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgmarkernode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgmarkernode.cxx Mon Aug 20 11:46:19 2012
@@ -56,9 +56,8 @@ namespace svgio
         const SvgStyleAttributes* SvgMarkerNode::getSvgStyleAttributes() const
         {
             static rtl::OUString aClassStr(rtl::OUString::createFromAscii("marker"));
-            maSvgStyleAttributes.checkForCssStyle(aClassStr);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(aClassStr, maSvgStyleAttributes);
         }
 
         void SvgMarkerNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgnode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgnode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgnode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgnode.cxx Mon Aug 20 11:46:19 2012
@@ -41,6 +41,103 @@ namespace svgio
             return 0;
         }
 
+        const SvgStyleAttributes* SvgNode::checkForCssStyle(const rtl::OUString& rClassStr, const SvgStyleAttributes& rOriginal) const
+        {
+            if(maCssStyleVector.empty()) // #120435# Evaluate for CSS styles only once, this cannot change
+            {
+                const SvgDocument& rDocument = getDocument();
+
+                if(rDocument.hasSvgStyleAttributesById())
+                {
+                    if(getClass())
+                    {
+                        // find all referenced CSS styles, a list of entries is allowed
+                        const rtl::OUString* pClassList = getClass();
+                        const sal_Int32 nLen(pClassList->getLength());
+                        sal_Int32 nPos(0);
+                        const SvgStyleAttributes* pNew = 0;
+
+                        skip_char(*pClassList, sal_Unicode(' '), nPos, nLen);
+    
+                        while(nPos < nLen)
+                        {
+                            rtl::OUStringBuffer aTokenValue;
+                        
+                            copyToLimiter(*pClassList, sal_Unicode(' '), nPos, aTokenValue, nLen);
+                            skip_char(*pClassList, sal_Unicode(' '), nPos, nLen);
+
+                            rtl::OUString aId(rtl::OUString::createFromAscii("."));
+                            const rtl::OUString aOUTokenValue(aTokenValue.makeStringAndClear());
+                        
+                            // look for CSS style common to token
+                            aId = aId + aOUTokenValue;
+                            pNew = rDocument.findSvgStyleAttributesById(aId);
+    
+                            if(!pNew && rClassStr.getLength())
+                            {
+                                // look for CSS style common to class.token
+                                aId = rClassStr + aId;
+                    
+                                pNew = rDocument.findSvgStyleAttributesById(aId);
+                            }
+                        
+                            if(pNew)
+                            {
+                                const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew);
+                            }
+                        }
+                    }
+                
+                    if(maCssStyleVector.empty() && getId())
+                    {
+                        // if none found, search for CSS style equal to Id
+                        const SvgStyleAttributes* pNew = rDocument.findSvgStyleAttributesById(*getId());
+
+                        if(pNew)
+                        {
+                            const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew);
+                        }
+                    }
+
+                    if(maCssStyleVector.empty() && rClassStr.getLength())
+                    {
+                        // if none found, search for CSS style equal to class type
+                        const SvgStyleAttributes* pNew = rDocument.findSvgStyleAttributesById(rClassStr);
+                    
+                        if(pNew)
+                        {
+                            const_cast< SvgNode* >(this)->maCssStyleVector.push_back(pNew);
+                        }
+                    }
+                }
+            }
+
+            if(maCssStyleVector.empty())
+            {
+                return &rOriginal;
+            }
+            else
+            {
+                // set CssStyleParent at maCssStyleVector members to hang them in front of
+                // the existing style. Build a style chain, reset parent of original for security.
+                // Repeated style requests should only be issued from sub-Text nodes and I'm not 
+                // sure if in-between text nodes may build other chains (should not happen). But
+                // it's only a re-chaining with pointers (cheap), so allow to do it every time.
+                SvgStyleAttributes* pCurrent = const_cast< SvgStyleAttributes* >(&rOriginal);
+                pCurrent->setCssStyleParent(0);
+
+                for(sal_uInt32 a(0); a < maCssStyleVector.size(); a++)
+                {
+                    SvgStyleAttributes* pCandidate = const_cast< SvgStyleAttributes* >(maCssStyleVector[maCssStyleVector.size() - a - 1]);
+
+                    pCandidate->setCssStyleParent(pCurrent);
+                    pCurrent = pCandidate;
+                }
+
+                return pCurrent;
+            }
+        }
+
         SvgNode::SvgNode(
             SVGToken aType,
             SvgDocument& rDocument,
@@ -52,7 +149,8 @@ namespace svgio
             maChildren(),
             mpId(0),
             mpClass(0),
-            maXmlSpace(XmlSpace_notset)
+            maXmlSpace(XmlSpace_notset),
+            maCssStyleVector()
         {
             OSL_ENSURE(SVGTokenUnknown != maType, "SvgNode with unknown type created (!)");
             

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpathnode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpathnode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpathnode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpathnode.cxx Mon Aug 20 11:46:19 2012
@@ -51,9 +51,8 @@ namespace svgio
         const SvgStyleAttributes* SvgPathNode::getSvgStyleAttributes() const
         {
             static rtl::OUString aClassStr(rtl::OUString::createFromAscii("path"));
-            maSvgStyleAttributes.checkForCssStyle(aClassStr);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(aClassStr, maSvgStyleAttributes);
         }
 
         void SvgPathNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpatternnode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpatternnode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpatternnode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpatternnode.cxx Mon Aug 20 11:46:19 2012
@@ -70,9 +70,8 @@ namespace svgio
         const SvgStyleAttributes* SvgPatternNode::getSvgStyleAttributes() const
         {
             static rtl::OUString aClassStr(rtl::OUString::createFromAscii("pattern"));
-            maSvgStyleAttributes.checkForCssStyle(aClassStr);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(aClassStr, maSvgStyleAttributes);
         }
 
         void SvgPatternNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpolynode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpolynode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpolynode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgpolynode.cxx Mon Aug 20 11:46:19 2012
@@ -54,9 +54,8 @@ namespace svgio
         {
             static rtl::OUString aClassStrA(rtl::OUString::createFromAscii("polygon"));
             static rtl::OUString aClassStrB(rtl::OUString::createFromAscii("polyline"));
-            maSvgStyleAttributes.checkForCssStyle(mbIsPolyline? aClassStrB : aClassStrA);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(mbIsPolyline? aClassStrB : aClassStrA, maSvgStyleAttributes);
         }
 
         void SvgPolyNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgrectnode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgrectnode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgrectnode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgrectnode.cxx Mon Aug 20 11:46:19 2012
@@ -55,9 +55,8 @@ namespace svgio
         const SvgStyleAttributes* SvgRectNode::getSvgStyleAttributes() const
         {
             static rtl::OUString aClassStr(rtl::OUString::createFromAscii("rect"));
-            maSvgStyleAttributes.checkForCssStyle(aClassStr);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(aClassStr, maSvgStyleAttributes);
         }
 
         void SvgRectNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgstyleattributes.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgstyleattributes.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgstyleattributes.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgstyleattributes.cxx Mon Aug 20 11:46:19 2012
@@ -212,56 +212,14 @@ namespace svgio
             }
         }
 
-        void SvgStyleAttributes::checkForCssStyle(const rtl::OUString& rClassStr) const
-        {
-            if(!mpCssStyleParent)
-            {
-                const SvgDocument& rDocument = mrOwner.getDocument();
-                const SvgStyleAttributes* pNew = 0;
-
-                if(rDocument.hasSvgStyleAttributesById())
-                {
-                    if(mrOwner.getClass())
-                    {
-                        rtl::OUString aId(rtl::OUString::createFromAscii("."));
-                        aId = aId + *mrOwner.getClass();
-                        pNew = rDocument.findSvgStyleAttributesById(aId);
-
-                        if(!pNew && rClassStr.getLength())
-                        {
-                            aId = rClassStr + aId;
-                    
-                            pNew = rDocument.findSvgStyleAttributesById(aId);
-                        }
-                    }
-
-                    if(!pNew && mrOwner.getId())
-                    {
-                        pNew = rDocument.findSvgStyleAttributesById(*mrOwner.getId());
-                    }
-
-                    if(!pNew && rClassStr.getLength())
-                    {
-                        pNew = rDocument.findSvgStyleAttributesById(rClassStr);
-                    }
-                    
-                    if(pNew)
-                    {
-                        // found css style, set as parent
-                        const_cast< SvgStyleAttributes* >(this)->mpCssStyleParent = pNew;
-                    }
-                }
-            }
-        }
-
         const SvgStyleAttributes* SvgStyleAttributes::getParentStyle() const 
         { 
-            if(mpCssStyleParent)
+            if(getCssStyleParent())
             {
-                return mpCssStyleParent;
+                return getCssStyleParent();
             }
 
-            if(mrOwner.getParent()) 
+            if(mrOwner.getParent())
             {
                 return mrOwner.getParent()->getSvgStyleAttributes(); 
             }
@@ -1068,8 +1026,8 @@ namespace svgio
             {
                 basegfx::B2DPolyPolygon aPath(rPath);
                 const bool bNeedToCheckClipRule(SVGTokenPath == mrOwner.getType() || SVGTokenPolygon == mrOwner.getType());
-                const bool bClipPathIsNonzero(!bIsLine && bNeedToCheckClipRule && mbIsClipPathContent && mbClipRule);
-                const bool bFillRuleIsNonzero(!bIsLine && bNeedToCheckClipRule && !mbIsClipPathContent && getFillRule());
+                const bool bClipPathIsNonzero(!bIsLine && bNeedToCheckClipRule && mbIsClipPathContent && FillRule_nonzero == maClipRule);
+                const bool bFillRuleIsNonzero(!bIsLine && bNeedToCheckClipRule && !mbIsClipPathContent && FillRule_nonzero == getFillRule());
 
                 if(bClipPathIsNonzero || bFillRuleIsNonzero)
                 {
@@ -1203,10 +1161,9 @@ namespace svgio
             mpMarkerMidXLink(0),
             maMarkerEndXLink(),
             mpMarkerEndXLink(0),
-            maFillRule(true),
-            maFillRuleSet(false),
-            mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType()),
-            mbClipRule(true)
+            maFillRule(FillRule_notset),
+            maClipRule(FillRule_nonzero),
+            mbIsClipPathContent(SVGTokenClipPathNode == mrOwner.getType())
         {
             if(!mbIsClipPathContent)
             {
@@ -1273,13 +1230,11 @@ namespace svgio
                     {
                         if(aContent.match(commonStrings::aStrNonzero))
                         {
-                            maFillRule = true;
-                            maFillRuleSet = true;
+                            maFillRule = FillRule_nonzero;
                         }
                         else if(aContent.match(commonStrings::aStrEvenOdd))
                         {
-                            maFillRule = false;
-                            maFillRuleSet = true;
+                            maFillRule = FillRule_evenodd;
                         }
                     }
                     break;
@@ -1790,11 +1745,11 @@ namespace svgio
                     {
                         if(aContent.match(commonStrings::aStrNonzero))
                         {
-                            mbClipRule = true;
+                            maClipRule = FillRule_nonzero;
                         }
                         else if(aContent.match(commonStrings::aStrEvenOdd))
                         {
-                            mbClipRule = false;
+                            maClipRule = FillRule_evenodd;
                         }
                     }
                     break;
@@ -2048,9 +2003,9 @@ namespace svgio
             return SvgNumber(1.0); 
         }
 
-        bool SvgStyleAttributes::getFillRule() const
+        const FillRule SvgStyleAttributes::getFillRule() const
         {
-            if(maFillRuleSet)
+            if(FillRule_notset != maFillRule)
             {
                 return maFillRule;
             }
@@ -2063,20 +2018,7 @@ namespace svgio
             }
 
             // default is NonZero
-            return true; 
-        }
-
-        void SvgStyleAttributes::setFillRule(const bool* pFillRule)
-        {
-            if(pFillRule)
-            {
-                maFillRuleSet = true;
-                maFillRule = *pFillRule;
-            }
-            else
-            {
-                maFillRuleSet = false;
-            }
+            return FillRule_nonzero; 
         }
 
         const SvgNumberVector& SvgStyleAttributes::getStrokeDasharray() const

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgtextnode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgtextnode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgtextnode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgtextnode.cxx Mon Aug 20 11:46:19 2012
@@ -55,9 +55,8 @@ namespace svgio
         const SvgStyleAttributes* SvgTextNode::getSvgStyleAttributes() const
         {
             static rtl::OUString aClassStr(rtl::OUString::createFromAscii("text"));
-            maSvgStyleAttributes.checkForCssStyle(aClassStr);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(aClassStr, maSvgStyleAttributes);
         }
 
         void SvgTextNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgusenode.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgusenode.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgusenode.cxx (original)
+++ incubator/ooo/branches/writer001/main/svgio/source/svgreader/svgusenode.cxx Mon Aug 20 11:46:19 2012
@@ -54,9 +54,8 @@ namespace svgio
         const SvgStyleAttributes* SvgUseNode::getSvgStyleAttributes() const
         {
             static rtl::OUString aClassStr(rtl::OUString::createFromAscii("use"));
-            maSvgStyleAttributes.checkForCssStyle(aClassStr);
 
-            return &maSvgStyleAttributes;
+            return checkForCssStyle(aClassStr, maSvgStyleAttributes);
         }
 
         void SvgUseNode::parseAttribute(const rtl::OUString& rTokenName, SVGToken aSVGToken, const rtl::OUString& aContent)

Modified: incubator/ooo/branches/writer001/main/svl/inc/svl/style.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svl/inc/svl/style.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svl/inc/svl/style.hxx (original)
+++ incubator/ooo/branches/writer001/main/svl/inc/svl/style.hxx Mon Aug 20 11:46:19 2012
@@ -19,33 +19,27 @@
  * 
  *************************************************************/
 
-
-
 #ifndef _SFXSTYLE_HXX
 #define _SFXSTYLE_HXX
 
 #include <com/sun/star/style/XStyle.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
-
 #include <rtl/ref.hxx>
 #include <vector>
 #include <comphelper/weak.hxx>
 #include <cppuhelper/implbase2.hxx>
-#include "svl/svldllapi.h"
+#include <svl/svldllapi.h>
 #include <rsc/rscsfx.hxx>
 #include <tools/string.hxx>
 #include <svl/hint.hxx>
 #include <svl/lstner.hxx>
 #include <svl/brdcst.hxx>
 #include <svl/poolitem.hxx>
-
-#ifndef _SFX_STYLE_HRC
 #include <svl/style.hrc>
-#endif
+#include <boost/shared_ptr.hpp>
 
 class SfxItemSet;
 class SfxItemPool;
-
 class SfxStyleSheetBasePool;
 class SvStream;
 
@@ -199,6 +193,7 @@ private:
 friend class SfxStyleSheetBasePool;
 };
 
+typedef ::boost::shared_ptr< SfxStyleSheetIterator > SfxStyleSheetIteratorPtr;
 //=========================================================================
 
 class SfxStyleSheetBasePool_Impl;
@@ -238,7 +233,7 @@ public:
 	SfxItemPool& 				GetPool();
 	const SfxItemPool& 			GetPool() const;
 
-	virtual SfxStyleSheetIterator* CreateIterator(SfxStyleFamily, sal_uInt16 nMask);
+	virtual SfxStyleSheetIteratorPtr CreateIterator(SfxStyleFamily, sal_uInt16 nMask);
 	virtual sal_uInt16 				Count();
 	virtual SfxStyleSheetBase*	operator[](sal_uInt16 nIdx);
 

Modified: incubator/ooo/branches/writer001/main/svl/source/items/style.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svl/source/items/style.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svl/source/items/style.cxx (original)
+++ incubator/ooo/branches/writer001/main/svl/source/items/style.cxx Mon Aug 20 11:46:19 2012
@@ -121,11 +121,9 @@ SfxStyleSheetHint::SfxStyleSheetHint
 
 class SfxStyleSheetBasePool_Impl
 {
-  public:
+public:
 	SfxStyles aStyles;
-	SfxStyleSheetIterator *pIter;
-	SfxStyleSheetBasePool_Impl() : pIter(0){}
-	~SfxStyleSheetBasePool_Impl(){delete pIter;}
+	SfxStyleSheetIteratorPtr pIter;
 };
 
 
@@ -583,13 +581,12 @@ void SfxStyleSheetBasePool::Replace(
 
 SfxStyleSheetIterator& SfxStyleSheetBasePool::GetIterator_Impl()
 {
-	SfxStyleSheetIterator*& rpIter = pImp->pIter;
-	if( !rpIter || (rpIter->GetSearchMask() != nMask) || (rpIter->GetSearchFamily() != nSearchFamily) )
+	if( !pImp->pIter || (pImp->pIter->GetSearchMask() != nMask) || (pImp->pIter->GetSearchFamily() != nSearchFamily) )
 	{
-		delete rpIter;
-		rpIter = CreateIterator( nSearchFamily, nMask );
+		pImp->pIter = CreateIterator( nSearchFamily, nMask );
 	}
-	return *rpIter;
+
+    return *pImp->pIter;
 }
 
 
@@ -668,13 +665,13 @@ String SfxStyleSheetBasePool::GetStreamN
 
 
 
-SfxStyleSheetIterator* SfxStyleSheetBasePool::CreateIterator
+SfxStyleSheetIteratorPtr SfxStyleSheetBasePool::CreateIterator
 (
  SfxStyleFamily eFam,
  sal_uInt16 mask
 )
 {
-	return new SfxStyleSheetIterator(this,eFam,mask);
+	return SfxStyleSheetIteratorPtr(new SfxStyleSheetIterator(this,eFam,mask));
 }
 
 

Modified: incubator/ooo/branches/writer001/main/svtools/source/edit/textdoc.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svtools/source/edit/textdoc.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svtools/source/edit/textdoc.cxx (original)
+++ incubator/ooo/branches/writer001/main/svtools/source/edit/textdoc.cxx Mon Aug 20 11:46:19 2012
@@ -34,9 +34,6 @@ SV_IMPL_PTRARR( TextCharAttribs, TextCha
 // Vergleichmethode wird von QuickSort gerufen...
 
 EXTERN_C
-#if defined( PM2 ) && (!defined( CSET ) && !defined ( MTW ) && !defined( WTC ))
-int _stdcall
-#else
 #ifdef WNT
 #if _MSC_VER >= 1200
 int __cdecl
@@ -46,7 +43,6 @@ int _cdecl
 #else
 int
 #endif
-#endif
 
 CompareStart( const void* pFirst, const void* pSecond )
 {

Modified: incubator/ooo/branches/writer001/main/svtools/source/filter/filter.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svtools/source/filter/filter.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svtools/source/filter/filter.cxx (original)
+++ incubator/ooo/branches/writer001/main/svtools/source/filter/filter.cxx Mon Aug 20 11:46:19 2012
@@ -1157,7 +1157,7 @@ void GraphicFilter::ImplInit()
 
     if( bUseConfig )
     {
-#if defined WNT
+#if defined WNT || defined OS2
         rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/program"));
 #else
         rtl::OUString url(RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/program"));
@@ -2065,9 +2065,11 @@ sal_uInt16 GraphicFilter::ExportGraphic(
                         {
                             ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > xSaxWriter( xMgr->createInstance(
                                 ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" ) ), ::com::sun::star::uno::UNO_QUERY );
-
-                            ::com::sun::star::uno::Reference< ::com::sun::star::svg::XSVGWriter > xSVGWriter( xMgr->createInstance(
-                                ::rtl::OUString::createFromAscii( "com.sun.star.svg.SVGWriter" ) ), ::com::sun::star::uno::UNO_QUERY );
+							
+							com::sun::star::uno::Sequence< com::sun::star::uno::Any > aArguments( 1 );
+							aArguments[ 0 ] <<= aConfigItem.GetFilterData();
+                            ::com::sun::star::uno::Reference< ::com::sun::star::svg::XSVGWriter > xSVGWriter( xMgr->createInstanceWithArguments(
+                                ::rtl::OUString::createFromAscii( "com.sun.star.svg.SVGWriter" ), aArguments ), ::com::sun::star::uno::UNO_QUERY );
 
                             if( xSaxWriter.is() && xSVGWriter.is() )
                             {

Modified: incubator/ooo/branches/writer001/main/svtools/source/filter/jpeg/jpeg.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svtools/source/filter/jpeg/jpeg.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svtools/source/filter/jpeg/jpeg.cxx (original)
+++ incubator/ooo/branches/writer001/main/svtools/source/filter/jpeg/jpeg.cxx Mon Aug 20 11:46:19 2012
@@ -48,6 +48,14 @@ using namespace ::com::sun::star;
 
 #define JPEGMINREAD 512
 
+namespace {
+    // Arbitrary maximal size (256M) of bitmaps after they have been decoded.
+    // It is used to prevent excessive swapping due to large buffers in
+    // virtual memory.
+    // May have to be tuned if it turns out to be too large or too small.
+    static const sal_uInt64 MAX_BITMAP_BYTE_SIZE = sal_uInt64(256 * 1024 * 1024);
+}
+
 // -------------
 // - (C-Calls) -
 // -------------
@@ -335,11 +343,25 @@ void* JPEGReader::CreateBitmap( void* pP
                         ((JPEGCreateBitmapParam*)pParam)->nHeight );
     sal_Bool    bGray = ((JPEGCreateBitmapParam*)pParam)->bGray != 0;
 
-	void* pBmpBuf = NULL;
+    void* pBmpBuf = NULL;
 
-	if( pAcc )
-		aBmp.ReleaseAccess( pAcc );
+    if( pAcc )
+    {
+        aBmp.ReleaseAccess( pAcc );
+        aBmp = Bitmap();
+        pAcc = NULL;
+    }
 
+    // Check if the bitmap is untypically large.
+    if (aSize.Width()<=0
+        || aSize.Height()<=0
+        || sal_uInt64(aSize.Width())*sal_uInt64(aSize.Height())*(bGray?1:3) > MAX_BITMAP_BYTE_SIZE)
+    {
+        // Do not try to acquire resources for the large bitmap or to
+        // read the bitmap into memory.
+        return NULL;
+    }
+    
 	if( bGray )
 	{
 		BitmapPalette aGrayPal( 256 );
@@ -354,7 +376,7 @@ void* JPEGReader::CreateBitmap( void* pP
 	}
 	else
 		aBmp = Bitmap( aSize, 24 );
-   
+
     if ( bSetLogSize )
     {
         unsigned long nUnit = ((JPEGCreateBitmapParam*)pParam)->density_unit;
@@ -376,8 +398,8 @@ void* JPEGReader::CreateBitmap( void* pP
 	
     pAcc = aBmp.AcquireWriteAccess();
 
-	if( pAcc )
-	{
+    if( pAcc )
+    {
         long nAlignedWidth;
 
 		const sal_uLong nFormat = pAcc->GetScanlineFormat();
@@ -402,13 +424,14 @@ void* JPEGReader::CreateBitmap( void* pP
         if ( pBmpBuf == 0 )
         {
             aBmp.ReleaseAccess( pAcc );
+            aBmp = Bitmap();
             pAcc = NULL;
         }
 
         ((JPEGCreateBitmapParam*)pParam)->nAlignedWidth = nAlignedWidth;
-	}
+    }
 
-	return pBmpBuf;
+    return pBmpBuf;
 }
 
 // ------------------------------------------------------------------------

Modified: incubator/ooo/branches/writer001/main/svtools/source/filter/jpeg/jpegc.c
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svtools/source/filter/jpeg/jpegc.c?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svtools/source/filter/jpeg/jpegc.c (original)
+++ incubator/ooo/branches/writer001/main/svtools/source/filter/jpeg/jpegc.c Mon Aug 20 11:46:19 2012
@@ -196,7 +196,15 @@ void ReadJPEG( void* pJPEGReader, void* 
 		}
 	}
 
-	jpeg_finish_decompress( &cinfo );
+    if ( pDIB )
+    {
+        jpeg_finish_decompress( &cinfo );
+    }
+    else
+    {
+        jpeg_abort_decompress( &cinfo );
+    }
+
 	if (pScanLineBuffer!=NULL) {
 	    rtl_freeMemory( pScanLineBuffer );
 	    pScanLineBuffer=NULL;

Modified: incubator/ooo/branches/writer001/main/svtools/source/filter/sgvspln.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svtools/source/filter/sgvspln.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svtools/source/filter/sgvspln.cxx (original)
+++ incubator/ooo/branches/writer001/main/svtools/source/filter/sgvspln.cxx Mon Aug 20 11:46:19 2012
@@ -29,10 +29,6 @@
 
 #include <tools/poly.hxx>
 
-#if defined( PM2 ) && defined( __BORLANDC__ )
-#pragma option -Od
-#endif
-
 extern "C" {
 
 /*.pn 277 */

Modified: incubator/ooo/branches/writer001/main/svtools/source/filter/sgvtext.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svtools/source/filter/sgvtext.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svtools/source/filter/sgvtext.cxx (original)
+++ incubator/ooo/branches/writer001/main/svtools/source/filter/sgvtext.cxx Mon Aug 20 11:46:19 2012
@@ -613,7 +613,7 @@ sal_uInt16 SetTextContext(OutputDevice& 
 		switch (Atr.GetFont()) {
 		  case 92500: case 92501: case 92504: case 92505:
 		  {
-#if defined(WNT) || defined(PM2)
+#if defined(WNT) || defined(OS2)
 			  FNam=String::CreateFromAscii( "Times New Roman" );  // CG Times ist unter Windows und OS/2 Times New Roman
 #else
 			  FNam=String::CreateFromAscii( "Times" );            // ansonsten ist das einfach Times

Modified: incubator/ooo/branches/writer001/main/svtools/source/filter/wmf/enhwmf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svtools/source/filter/wmf/enhwmf.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svtools/source/filter/wmf/enhwmf.cxx (original)
+++ incubator/ooo/branches/writer001/main/svtools/source/filter/wmf/enhwmf.cxx Mon Aug 20 11:46:19 2012
@@ -168,6 +168,21 @@ static float GetSwapFloat( SvStream& rSt
 }
 #endif
 
+struct BLENDFUNCTION{
+	unsigned char aBlendOperation;
+	unsigned char aBlendFlags;
+	unsigned char aSrcConstantAlpha;
+	unsigned char aAlphaFormat;
+
+	friend SvStream& operator>>( SvStream& rIn, BLENDFUNCTION& rBlendFun );
+};
+
+SvStream& operator>>( SvStream& rIn, BLENDFUNCTION& rBlendFun )
+{
+	rIn >> rBlendFun.aBlendOperation >> rBlendFun.aBlendFlags >> 
+		     rBlendFun.aSrcConstantAlpha >> rBlendFun.aAlphaFormat;
+    return rIn;
+}
 SvStream& operator>>( SvStream& rIn, XForm& rXForm )
 {
 	if ( sizeof( float ) != 4 )
@@ -321,8 +336,6 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
 
 			case EMR_POLYPOLYLINE :
 			{
-				sal_uInt16*	pnPoints;
-
 				sal_Int32	i, nPoly;
 				pWMF->SeekRel( 0x10 );
 
@@ -334,9 +347,9 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
 				{
 					if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof(sal_uInt16) ) <= ( nEndPos - pWMF->Tell() ) )
 					{
-						pnPoints = new sal_uInt16[ nPoly ];
+						sal_uInt16*	pnPoints = new sal_uInt16[ nPoly ];
 
-						for ( i = 0; i < nPoly; i++ )
+						for ( i = 0; i < nPoly && !pWMF->IsEof(); i++ )
 						{
 							*pWMF >> nPoints;
 							pnPoints[ i ] = (sal_uInt16)nPoints;
@@ -362,45 +375,55 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
 
 			case EMR_POLYPOLYGON :
 			{
-				sal_uInt16*	pnPoints;
-				Point*	pPtAry;
-
-				sal_uInt32	i, nPoly, nGesPoints;
+				sal_uInt32 nPoly(0);
+				sal_uInt32 nGesPoints(0);
+                sal_uInt32 nReadPoints(0);
 				pWMF->SeekRel( 0x10 );
 
 				// Anzahl der Polygone:
 				*pWMF >> nPoly >> nGesPoints;
 
-				if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) )
+				if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(sal_uInt16) )  && !pWMF->IsEof() )
 				{
 					if ( ( nPoly * sizeof(sal_uInt16) ) <= ( nEndPos - pWMF->Tell() ) )
 					{
-						pnPoints = new sal_uInt16[ nPoly ];
+        				sal_uInt32 i(0);
+						sal_uInt16*	pnPoints = new sal_uInt16[ nPoly ];
 		
-						for ( i = 0; i < nPoly; i++ )
+						for ( i = 0; i < nPoly && !pWMF->IsEof(); i++ )
 						{
 							*pWMF >> nPoints;
 							pnPoints[ i ] = (sal_uInt16)nPoints;
 						}
 
-						if ( ( nGesPoints * (sizeof(sal_uInt32)+sizeof(sal_uInt32)) ) <= ( nEndPos - pWMF->Tell() ) )
+						if ( ( nGesPoints * (sizeof(sal_uInt32)+sizeof(sal_uInt32)) ) <= ( nEndPos - pWMF->Tell() ) && !pWMF->IsEof())
 						{
-							// Polygonpunkte holen:
-							pPtAry  = new Point[ nGesPoints ];
-			
-							for ( i = 0; i < nGesPoints; i++ )
-							{
-								*pWMF >> nX32 >> nY32;
-								pPtAry[ i ] = Point( nX32, nY32 );
-							}
-							// PolyPolygon Actions erzeugen
-							PolyPolygon aPolyPoly( (sal_uInt16)nPoly, pnPoints, pPtAry );
-							pOut->DrawPolyPolygon( aPolyPoly, bRecordPath );
-							delete[] pPtAry;
+                            PolyPolygon aPolyPoly(nPoly, nPoly);
+
+						    for ( i = 0; i < nPoly && !pWMF->IsEof(); i++ )
+						    {
+                                const sal_uInt16 nPointCount(pnPoints[i]);
+                				Point* pPtAry = new Point[nPointCount];
+
+                                for(sal_uInt16 j(0); j < nPointCount && !pWMF->IsEof(); j++)
+                                {
+								    *pWMF >> nX32 >> nY32;
+								    pPtAry[ j ] = Point( nX32, nY32 );
+                                    nReadPoints++;
+                                }
+
+                                aPolyPoly.Insert(Polygon(nPointCount, pPtAry));
+                                delete[] pPtAry;
+                            }
+
+                            pOut->DrawPolyPolygon( aPolyPoly, bRecordPath );
 						}
-						delete[] pnPoints;
+
+                        delete[] pnPoints;
 					}
 				}
+
+                OSL_ENSURE(nReadPoints == nGesPoints, "The number Points processed from EMR_POLYPOLYGON is unequal imported number (!)");
 			}
 			break;
 
@@ -805,7 +828,63 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
 				pOut->SetClipPath( aPolyPoly, iMode, sal_False );
 	        }
             break;
+			case EMR_ALPHABLEND:
+			{
+			   sal_Int32	xDest, yDest, cxDest, cyDest; 
+			      
+			   BLENDFUNCTION aFunc;
+			   sal_Int32  xSrc, ySrc;
+			   XForm	xformSrc;
+			   sal_uInt32	BkColorSrc,iUsageSrc ,offBmiSrc,cbBmiSrc,offBitsSrc,cbBitsSrc ,cxSrc,cySrc ;
+
+			   sal_uInt32	nStart = pWMF->Tell() - 8;
+				pWMF->SeekRel( 0x10 );
+
+				*pWMF >> xDest >> yDest >> cxDest >> cyDest >> aFunc >> xSrc >> ySrc
+						>> xformSrc >> BkColorSrc >> iUsageSrc >> offBmiSrc >> cbBmiSrc
+							>> offBitsSrc >> cbBitsSrc >>cxSrc>>cySrc ;
 
+				sal_uInt32	dwRop = SRCAND|SRCINVERT;
+
+				Bitmap		aBitmap;
+				Rectangle	aRect( Point( xDest, yDest ), Size( cxDest+1, cyDest+1 ) );
+
+				if ( (cbBitsSrc > (SAL_MAX_UINT32 - 14)) || ((SAL_MAX_UINT32 - 14) - cbBitsSrc < cbBmiSrc) )
+			        bStatus = sal_False;
+				else
+				{
+					sal_uInt32 nSize = cbBmiSrc + cbBitsSrc + 14;
+					if ( nSize <= ( nEndPos - nStartPos ) )
+					{
+						char* pBuf = new char[ nSize ];
+						SvMemoryStream aTmp( pBuf, nSize, STREAM_READ | STREAM_WRITE );
+						aTmp.ObjectOwnsMemory( sal_True );
+						aTmp << (sal_uInt8)'B'
+							 << (sal_uInt8)'M'
+							 << (sal_uInt32)cbBitsSrc
+							 << (sal_uInt16)0
+							 << (sal_uInt16)0
+							 << (sal_uInt32)cbBmiSrc + 14;
+						pWMF->Seek( nStart + offBmiSrc );
+						pWMF->Read( pBuf + 14, cbBmiSrc );
+						pWMF->Seek( nStart + offBitsSrc );
+						pWMF->Read( pBuf + 14 + cbBmiSrc, cbBitsSrc );
+						aTmp.Seek( 0 );
+						aBitmap.Read( aTmp, sal_True );
+						// test if it is sensible to crop
+						if ( ( cxSrc > 0 ) && ( cySrc > 0 ) && 
+							( xSrc >= 0 ) && ( ySrc >= 0 ) &&
+                                ( xSrc + static_cast< sal_Int32 >(cxSrc) <= static_cast< sal_Int32 >(aBitmap.GetSizePixel().Width()) ) &&
+                                    ( ySrc + static_cast< sal_Int32 >(cySrc) <= static_cast< sal_Int32 >(aBitmap.GetSizePixel().Height()) ) )
+						{
+							Rectangle aCropRect( Point( xSrc, ySrc ), Size( cxSrc, cySrc ) );
+							aBitmap.Crop( aCropRect );
+						}
+ 						aBmpSaveList.Insert( new BSaveStruct( aBitmap, aRect, dwRop ), LIST_APPEND );
+					}
+				}
+			}
+			break;
 			case EMR_BITBLT :	// PASSTHROUGH INTENDED
 			case EMR_STRETCHBLT :
 			{
@@ -1133,41 +1212,55 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
 
 			case EMR_POLYPOLYGON16 :
 			{
-				sal_uInt16*	pnPoints;
-				Point*	pPtAry;
-
-				sal_uInt32	i, nPoly, nGesPoints;
+				sal_uInt32 nPoly(0);
+                sal_uInt32 nGesPoints(0);
 				pWMF->SeekRel( 0x10 );
 				// Anzahl der Polygone:
 				*pWMF >> nPoly >> nGesPoints;
-				if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(sal_uInt16) ) )
+                sal_uInt32 nReadPoints(0);
+				
+                if ( ( nGesPoints < SAL_MAX_UINT32 / sizeof(Point) ) && ( nPoly < SAL_MAX_UINT32 / sizeof(sal_uInt16) )  && !pWMF->IsEof() )
 				{
 					if ( ( static_cast< sal_uInt32 >( nPoly ) * sizeof( sal_uInt16 ) ) <= ( nEndPos - pWMF->Tell() ) )
 					{
-						pnPoints = new sal_uInt16[ nPoly ];
-						for ( i = 0; i < nPoly; i++ )
+                        sal_uInt32 i(0);
+						sal_uInt16*	pnPoints = new sal_uInt16[ nPoly ];
+						
+                        for ( i = 0; i < nPoly && !pWMF->IsEof(); i++ )
 						{
 							*pWMF >> nPoints;
 							pnPoints[ i ] = (sal_uInt16)nPoints;
 						}
-						if ( ( nGesPoints * (sizeof(sal_uInt16)+sizeof(sal_uInt16)) ) <= ( nEndPos - pWMF->Tell() ) )
+						
+                        if ( ( nGesPoints * (sizeof(sal_uInt16)+sizeof(sal_uInt16)) ) <= ( nEndPos - pWMF->Tell() )  && !pWMF->IsEof() )
 						{
-							// Polygonpunkte holen:
-							pPtAry  = new Point[ nGesPoints ];
-							for ( i = 0; i < nGesPoints; i++ )
-							{
-								*pWMF >> nX16 >> nY16;
-								pPtAry[ i ] = Point( nX16, nY16 );
-							}
+                            PolyPolygon aPolyPoly(nPoly, nPoly);
+
+						    for ( i = 0; i < nPoly && !pWMF->IsEof(); i++ )
+						    {
+                                const sal_uInt16 nPointCount(pnPoints[i]);
+                				Point* pPtAry = new Point[nPointCount];
+
+                                for(sal_uInt16 b(0); b < nPointCount && !pWMF->IsEof(); b++)
+                                {
+								    *pWMF >> nX16 >> nY16;
+								    pPtAry[b] = Point( nX16, nY16 );
+                                    nReadPoints++;
+                                }
+                                
+                                aPolyPoly.Insert(Polygon(nPointCount, pPtAry));
+                                delete[] pPtAry;
+                            }
 			
-							// PolyPolygon Actions erzeugen
-							PolyPolygon aPolyPoly( (sal_uInt16)nPoly, pnPoints, pPtAry );
+							// create PolyPolygon actions
 							pOut->DrawPolyPolygon( aPolyPoly, bRecordPath );
-							delete[] pPtAry;
 						}
-						delete[] pnPoints;
+						
+                        delete[] pnPoints;
 					}
 				}
+
+                OSL_ENSURE(nReadPoints == nGesPoints, "The number Points processed from EMR_POLYPOLYGON16 is unequal imported number (!)");
 			}
 			break;
 
@@ -1187,7 +1280,46 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
                 }
             }
             break;
+			case EMR_CREATEDIBPATTERNBRUSHPT :
+			{
+				sal_uInt32	nTmp32;
+				sal_uInt32  nOffset;
+				*pWMF >> nIndex;
+				Bitmap	aBmp;
+				BitmapReadAccess* pBmp;
+				sal_uInt32	nRed = 0, nGreen = 0, nBlue = 0, nCount = 1;
+
+				*pWMF >> nTmp32;
+				*pWMF >> nOffset;
+				for ( sal_uInt32 i = 0; i < (nOffset - 20)/4; i ++ )
+				{
+					*pWMF >> nTmp32;
+				}
 
+				aBmp.Read( *pWMF, sal_False );
+				pBmp = aBmp.AcquireReadAccess();
+				if ( pBmp )
+				{
+					for ( sal_Int32 y = 0; y < pBmp->Height(); y++ )
+					{
+						for ( sal_Int32 x = 0; x < pBmp->Width(); x++ )
+						{
+							const BitmapColor aColor( pBmp->GetColor( y, x ) );						
+							
+							nRed += aColor.GetRed();
+							nGreen += aColor.GetGreen();
+							nBlue += aColor.GetBlue();
+						}
+					}
+					nCount = pBmp->Height() * pBmp->Width();
+					if ( !nCount )
+						nCount++;
+					aBmp.ReleaseAccess( pBmp );
+				}
+				Color aColor( (sal_Char)( nRed / nCount ), (sal_Char)( nGreen / nCount ), (sal_Char)( nBlue / nCount ) );
+				pOut->CreateObject( nIndex, GDI_BRUSH, new WinMtfFillStyle( aColor, sal_False ) );
+			}
+			break;
 
 #ifdef WIN_MTF_ASSERT
             default :                           WinMtfAssertHandler( "Unknown Meta Action" );       break;
@@ -1207,7 +1339,6 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
 			case EMR_ANGLEARC :     	        WinMtfAssertHandler( "AngleArc" );                  break;
 			case EMR_SETCOLORADJUSTMENT :       WinMtfAssertHandler( "SetColorAdjustment" );	    break;
 			case EMR_POLYDRAW16 :		        WinMtfAssertHandler( "PolyDraw16" );                break;
-			case EMR_CREATEDIBPATTERNBRUSHPT :  WinMtfAssertHandler( "CreateDibPatternBrushPt" );   break;
 			case EMR_POLYTEXTOUTA : 		    WinMtfAssertHandler( "PolyTextOutA" );              break;
 			case EMR_POLYTEXTOUTW :			    WinMtfAssertHandler( "PolyTextOutW" );              break;
 			case EMR_CREATECOLORSPACE :         WinMtfAssertHandler( "CreateColorSpace" );	        break;
@@ -1225,7 +1356,6 @@ sal_Bool EnhWMFReader::ReadEnhWMF()
             case EMR_COLORCORRECTPALETTE :      WinMtfAssertHandler( "ColorCorrectPalette" );       break;
             case EMR_SETICMPROFILEA :           WinMtfAssertHandler( "SetICMProfileA" );            break;
             case EMR_SETICMPROFILEW :           WinMtfAssertHandler( "SetICMProfileW" );            break;
-            case EMR_ALPHABLEND :               WinMtfAssertHandler( "Alphablend" );                break;
             case EMR_TRANSPARENTBLT :           WinMtfAssertHandler( "TransparenBlt" );             break;
             case EMR_TRANSPARENTDIB :           WinMtfAssertHandler( "TransparenDib" );             break;
             case EMR_GRADIENTFILL :             WinMtfAssertHandler( "GradientFill" );              break;

Modified: incubator/ooo/branches/writer001/main/svtools/source/filter/wmf/winwmf.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svtools/source/filter/wmf/winwmf.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svtools/source/filter/wmf/winwmf.cxx (original)
+++ incubator/ooo/branches/writer001/main/svtools/source/filter/wmf/winwmf.cxx Mon Aug 20 11:46:19 2012
@@ -330,28 +330,39 @@ void WMFReader::ReadRecordParams( sal_uI
 
 		case W_META_POLYPOLYGON:
 		{
-			sal_uInt16	i, nPoly, nPoints;
-			sal_uInt16*	pnPoints;
-			Point*	pPtAry;
-			// Anzahl der Polygone:
-			*pWMF >> nPoly;
-			// Anzahl der Punkte eines jeden Polygons holen, Gesammtzahl der Punkte ermitteln:
-			pnPoints = new sal_uInt16[ nPoly ];
-			nPoints = 0;
-			for( i = 0; i < nPoly; i++ )
-			{
-				*pWMF >> pnPoints[i];
-				nPoints = nPoints + pnPoints[i];
-			}
-			// Polygonpunkte holen:
-			pPtAry  = (Point*) new char[ nPoints * sizeof(Point) ];
-			for ( i = 0; i < nPoints; i++ )
-				pPtAry[ i ] = ReadPoint();
-			// PolyPolygon Actions erzeugen
-			PolyPolygon aPolyPoly( nPoly, pnPoints, pPtAry );
-			pOut->DrawPolyPolygon( aPolyPoly );
-			delete[] (char*) pPtAry;
-			delete[] pnPoints;
+            sal_uInt16 nPolyCount(0);
+
+            // get number of polygons
+            *pWMF >> nPolyCount;
+
+            if(nPolyCount && !pWMF->IsEof())
+            {
+    			sal_uInt16*	pnPoints = new sal_uInt16[nPolyCount];
+                sal_uInt16 a(0);
+                PolyPolygon aPolyPoly(nPolyCount, nPolyCount);
+
+                for(a = 0; a < nPolyCount && !pWMF->IsEof(); a++)
+                {
+                    *pWMF >> pnPoints[a];
+                }
+
+                for(a = 0; a < nPolyCount && !pWMF->IsEof(); a++)
+                {
+                    const sal_uInt16 nPointCount(pnPoints[a]);
+        			Point* pPtAry = new Point[nPointCount];
+
+                    for(sal_uInt16 b(0); b < nPointCount && !pWMF->IsEof(); b++)
+                    {
+                        pPtAry[b] = ReadPoint();
+                    }
+
+                    aPolyPoly.Insert(Polygon(nPointCount, pPtAry));
+                    delete[] pPtAry;
+                }
+
+                delete[] pnPoints;
+    			pOut->DrawPolyPolygon(aPolyPoly);
+            }
 		}
 		break;
 

Modified: incubator/ooo/branches/writer001/main/svtools/source/misc/embedhlp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svtools/source/misc/embedhlp.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svtools/source/misc/embedhlp.cxx (original)
+++ incubator/ooo/branches/writer001/main/svtools/source/misc/embedhlp.cxx Mon Aug 20 11:46:19 2012
@@ -482,11 +482,18 @@ void EmbeddedObjectRef::GetReplacement( 
 
 Graphic* EmbeddedObjectRef::GetGraphic( ::rtl::OUString* pMediaType ) const
 {
-    if ( mpImp->bNeedUpdate )
-        // bNeedUpdate will be set to false while retrieving new replacement
-        const_cast < EmbeddedObjectRef* >(this)->GetReplacement( sal_True );
-    else if ( !mpImp->pGraphic )
-        const_cast < EmbeddedObjectRef* >(this)->GetReplacement( sal_False );
+    try
+    {
+        if ( mpImp->bNeedUpdate )
+            // bNeedUpdate will be set to false while retrieving new replacement
+            const_cast < EmbeddedObjectRef* >(this)->GetReplacement( sal_True );
+        else if ( !mpImp->pGraphic )
+            const_cast < EmbeddedObjectRef* >(this)->GetReplacement( sal_False );
+    }
+	catch( uno::Exception& )
+	{
+		OSL_ENSURE( sal_False, "Something went wrong on getting the graphic!" );
+	}
 
     if ( mpImp->pGraphic && pMediaType )
         *pMediaType = mpImp->aMediaType;
@@ -589,6 +596,7 @@ Graphic* EmbeddedObjectRef::GetHCGraphic
 		}
 		catch ( uno::Exception& )
 		{
+    		OSL_ENSURE( sal_False, "Something went wrong on getting the high contrast graphic!" );
 		}
 
 		if ( xInStream.is() )

Modified: incubator/ooo/branches/writer001/main/svx/Library_svxcore.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/Library_svxcore.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/Library_svxcore.mk (original)
+++ incubator/ooo/branches/writer001/main/svx/Library_svxcore.mk Mon Aug 20 11:46:19 2012
@@ -299,6 +299,7 @@ $(eval $(call gb_Library_add_exception_o
     svx/source/svdraw/gradtrns \
     svx/source/svdraw/polypolygoneditor \
     svx/source/svdraw/sdrcomment \
+    svx/source/svdraw/sdrundomanager \
     svx/source/svdraw/sdrhittesthelper \
     svx/source/svdraw/sdrmasterpagedescriptor \
     svx/source/svdraw/sdrpagewindow \

Modified: incubator/ooo/branches/writer001/main/svx/Package_inc.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/Package_inc.mk?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/Package_inc.mk (original)
+++ incubator/ooo/branches/writer001/main/svx/Package_inc.mk Mon Aug 20 11:46:19 2012
@@ -376,6 +376,7 @@ $(eval $(call gb_Package_add_file,svx_in
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/AccessibleShapeInfo.hxx,svx/AccessibleShapeInfo.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/numvset.hxx,svx/numvset.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrcomment.hxx,svx/sdrcomment.hxx))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdrundomanager.hxx,svx/sdrundomanager.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/txenctab.hxx,svx/txenctab.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svdorect.hxx,svx/svdorect.hxx))
 $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xftshit.hxx,svx/xftshit.hxx))

Modified: incubator/ooo/branches/writer001/main/svx/inc/svx/EnhancedCustomShape2d.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/inc/svx/EnhancedCustomShape2d.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/inc/svx/EnhancedCustomShape2d.hxx (original)
+++ incubator/ooo/branches/writer001/main/svx/inc/svx/EnhancedCustomShape2d.hxx Mon Aug 20 11:46:19 2012
@@ -199,9 +199,9 @@ class EnhancedCustomShape2d : public Sfx
 		double						GetEquationValueAsDouble( const sal_Int32 nIndex ) const;
 		sal_Int32					GetAdjustValueAsInteger( const sal_Int32 nIndex, const sal_Int32 nDefault = 0 ) const;
 
-		SVX_DLLPUBLIC static rtl::OUString		GetEquation( const sal_uInt16 nFlags, sal_Int16 nPara1, sal_Int16 nPara2, sal_Int16 nPara3 );
+		SVX_DLLPUBLIC static rtl::OUString		GetEquation( const sal_uInt16 nFlags, sal_Int32 nPara1, sal_Int32 nPara2, sal_Int32 nPara3 );
 
-		static void					AppendEnhancedCustomShapeEquationParameter( rtl::OUString& rParameter, const sal_Int16 nPara, const sal_Bool bIsSpecialValue );
+		static void					AppendEnhancedCustomShapeEquationParameter( rtl::OUString& rParameter, const sal_Int32 nPara, const sal_Bool bIsSpecialValue );
 
 		static void					SetEnhancedCustomShapeEquationParameter( com::sun::star::drawing::EnhancedCustomShapeParameter&
 										rParameter, const sal_Int16 nPara, const sal_Bool bIsSpecialValue );

Modified: incubator/ooo/branches/writer001/main/svx/inc/svx/EnhancedCustomShapeGeometry.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/inc/svx/EnhancedCustomShapeGeometry.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/inc/svx/EnhancedCustomShapeGeometry.hxx (original)
+++ incubator/ooo/branches/writer001/main/svx/inc/svx/EnhancedCustomShapeGeometry.hxx Mon Aug 20 11:46:19 2012
@@ -35,7 +35,7 @@ struct SvxMSDffVertPair
 struct SvxMSDffCalculationData
 {
 	sal_uInt16	nFlags;
-	sal_Int16	nVal[ 3 ];
+	sal_Int32	nVal[ 3 ];
 };
 struct SvxMSDffTextRectangles
 {

Modified: incubator/ooo/branches/writer001/main/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx (original)
+++ incubator/ooo/branches/writer001/main/svx/inc/svx/sdr/primitive2d/sdrattributecreator.hxx Mon Aug 20 11:46:19 2012
@@ -25,6 +25,7 @@
 #define INCLUDED_SDR_PRIMITIVE2D_SDRATTRIBUTECREATOR_HXX
 
 #include <sal/types.h>
+#include <svx/svxdllapi.h>
 
 //////////////////////////////////////////////////////////////////////////////
 // predefines
@@ -59,10 +60,10 @@ namespace drawinglayer
 	namespace primitive2d
 	{
 		// SdrAttribute creators
-		attribute::SdrLineAttribute createNewSdrLineAttribute(
+		attribute::SdrLineAttribute SVX_DLLPUBLIC createNewSdrLineAttribute(
 			const SfxItemSet& rSet);
 
-		attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute(
+		attribute::SdrLineStartEndAttribute SVX_DLLPUBLIC createNewSdrLineStartEndAttribute(
 			const SfxItemSet& rSet, 
 			double fWidth);
 

Modified: incubator/ooo/branches/writer001/main/svx/inc/svx/svdedxv.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/inc/svx/svdedxv.hxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/inc/svx/svdedxv.hxx (original)
+++ incubator/ooo/branches/writer001/main/svx/inc/svx/svdedxv.hxx Mon Aug 20 11:46:19 2012
@@ -42,6 +42,7 @@ class EditStatus;
 class EditFieldInfo;
 class ImpSdrEditPara;
 struct PasteOrDropInfos;
+class SdrUndoManager;
 
 namespace com { namespace sun { namespace star { namespace uno {
 	class Any;
@@ -101,7 +102,7 @@ protected:
 	Link						aOldCalcFieldValueLink; // Zum rufen des alten Handlers
 	Point						aMacroDownPos;
 
-	sal_uInt16						nMacroTol;
+	sal_uInt16					nMacroTol;
 
 	unsigned					bTextEditDontDelete : 1;   // Outliner und View bei SdrEndTextEdit nicht deleten (f. Rechtschreibpruefung)
 	unsigned					bTextEditOnlyOneView : 1;  // Nur eine OutlinerView (f. Rechtschreibpruefung)
@@ -114,9 +115,17 @@ protected:
 	rtl::Reference< sdr::SelectionController > mxLastSelectionController;
 
 private:
+    ::svl::IUndoManager* mpOldTextEditUndoManager;
+
 	SVX_DLLPRIVATE void ImpClearVars();
 
 protected:
+    // central method to get an SdrUndoManager for enhanced TextEdit. Default will
+    // try to return a dynamic_casted GetModel()->GetSdrUndoManager(). Applications
+    // which want to use this feature will need to overload this virtual method,
+    // provide their document UndoManager and derive it from SdrUndoManager.
+    virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const;
+
 	OutlinerView* ImpFindOutlinerView(Window* pWin) const;
 
 	// Eine neue OutlinerView auf dem Heap anlegen und alle erforderlichen Parameter setzen.
@@ -134,7 +143,10 @@ protected:
 	DECL_LINK(ImpOutlinerStatusEventHdl,EditStatus*);
 	DECL_LINK(ImpOutlinerCalcFieldValueHdl,EditFieldInfo*);
 
-	void ImpMacroUp(const Point& rUpPos);
+    // link for EndTextEditHdl
+	DECL_LINK(EndTextEditHdl, SdrUndoManager*);
+
+    void ImpMacroUp(const Point& rUpPos);
 	void ImpMacroDown(const Point& rDownPos);
 
    	DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );

Modified: incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShape2d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShape2d.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShape2d.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShape2d.cxx Mon Aug 20 11:46:19 2012
@@ -89,7 +89,7 @@ void EnhancedCustomShape2d::SetEnhancedC
 	rParameter.Value <<= nNewValue;
 }
 
-rtl::OUString EnhancedCustomShape2d::GetEquation( const sal_uInt16 nFlags, sal_Int16 nP1, sal_Int16 nP2, sal_Int16 nP3 )
+rtl::OUString EnhancedCustomShape2d::GetEquation( const sal_uInt16 nFlags, sal_Int32 nP1, sal_Int32 nP2, sal_Int32 nP3 )
 {
 	rtl::OUString aEquation;
 	sal_Bool b1Special = ( nFlags & 0x2000 ) != 0;
@@ -335,7 +335,7 @@ rtl::OUString EnhancedCustomShape2d::Get
 	return aEquation;
 }
 
-void EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( rtl::OUString& rParameter, const sal_Int16 nPara, const sal_Bool bIsSpecialValue )
+void EnhancedCustomShape2d::AppendEnhancedCustomShapeEquationParameter( rtl::OUString& rParameter, const sal_Int32 nPara, const sal_Bool bIsSpecialValue )
 {
 	if ( bIsSpecialValue )
 	{
@@ -1497,14 +1497,16 @@ void EnhancedCustomShape2d::CreateSubPat
 
 				case ANGLEELLIPSE :
 				{
-					if(aNewB2DPolygon.count() > 1L)
+					if ( nPntCount )
 					{
-						// #i76201# Add conversion to closed polygon when first and last points are equal
-						basegfx::tools::checkClosed(aNewB2DPolygon);
-						aNewB2DPolyPolygon.append(aNewB2DPolygon);
+						if(aNewB2DPolygon.count() > 1L)
+						{
+							// #i76201# Add conversion to closed polygon when first and last points are equal
+							basegfx::tools::checkClosed(aNewB2DPolygon);
+							aNewB2DPolyPolygon.append(aNewB2DPolygon);
+						}
+						aNewB2DPolygon.clear();
 					}
-
-					aNewB2DPolygon.clear();
 				}
 				case ANGLEELLIPSETO :
 				{

Modified: incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShape3d.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShape3d.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShape3d.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShape3d.cxx Mon Aug 20 11:46:19 2012
@@ -56,6 +56,12 @@
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
 #include <basegfx/range/b2drange.hxx>
+#include <svx/sdr/primitive2d/sdrattributecreator.hxx>
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <svx/xlnwtit.hxx>
+#include <svx/xlntrit.hxx>
+#include <svx/xfltrit.hxx>
 
 #define ITEMVALUE(ItemSet,Id,Cast)  ((const Cast&)(ItemSet).Get(Id)).GetValue()
 using namespace com::sun::star;
@@ -394,15 +400,61 @@ SdrObject* EnhancedCustomShape3d::Create
 			sal_Bool bIsPlaceholderObject = (((XFillStyleItem&)pNext->GetMergedItem( XATTR_FILLSTYLE )).GetValue() == XFILL_NONE )
 										&& (((XLineStyleItem&)pNext->GetMergedItem( XATTR_LINESTYLE )).GetValue() == XLINE_NONE );
 			basegfx::B2DPolyPolygon aPolyPoly;
+    		SfxItemSet aLocalSet(aSet);
+            XFillStyle aLocalFillStyle(eFillStyle);
 
 			if ( pNext->ISA( SdrPathObj ) )
 			{
-				aPolyPoly = ((SdrPathObj*)pNext)->GetPathPoly();
+            	const SfxItemSet& rSet = pNext->GetMergedItemSet();
+			    const drawinglayer::attribute::SdrLineAttribute aLine(
+                    drawinglayer::primitive2d::createNewSdrLineAttribute(rSet));
+                bool bNeedToConvertToContour(0.0 <= aLine.getWidth() || 0.0 != aLine.getFullDotDashLen());
+
+                if(!bNeedToConvertToContour && !aLine.isDefault())
+                {
+    			    const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd(
+                        drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(rSet, aLine.getWidth()));
 
-				if(aPolyPoly.areControlPointsUsed())
-				{
-					aPolyPoly = basegfx::tools::adaptiveSubdivideByAngle(aPolyPoly);
-				}
+                    if((aLineStartEnd.getStartWidth() && aLineStartEnd.isStartActive()) 
+                        || (aLineStartEnd.getEndWidth() && aLineStartEnd.isEndActive()))
+                    {
+                        bNeedToConvertToContour = true;
+                    }
+                }
+
+                if(bNeedToConvertToContour)
+                {
+                	SdrObject* pNewObj = pNext->ConvertToContourObj(const_cast< SdrObject* >(pNext));
+                    SdrPathObj* pNewPathObj = dynamic_cast< SdrPathObj* >(pNewObj);
+
+                    if(pNewPathObj)
+                    {
+                        aPolyPoly = pNewPathObj->GetPathPoly();
+
+                        if(aPolyPoly.isClosed())
+                        {
+                            // correct item properties from line to fill style
+				            aLocalSet.Put(XLineWidthItem(0));
+				            aLocalSet.Put(XLineStyleItem(XLINE_NONE));
+				            aLocalSet.Put(XFillColorItem(XubString(), ((const XLineColorItem&)(aLocalSet.Get(XATTR_LINECOLOR))).GetColorValue()));
+				            aLocalSet.Put(XFillStyleItem(XFILL_SOLID));
+				            aLocalSet.Put(XFillTransparenceItem(((const XLineTransparenceItem&)(aLocalSet.Get(XATTR_LINETRANSPARENCE))).GetValue()));
+                            aLocalFillStyle = XFILL_SOLID;
+                        }
+                        else
+                        {
+                            // correct item properties to hairlines
+				            aLocalSet.Put(XLineWidthItem(0));
+				            aLocalSet.Put(XLineStyleItem(XLINE_SOLID));
+                        }
+                    }
+
+                    SdrObject::Free(pNewObj);
+                }
+                else
+                {
+                    aPolyPoly = ((SdrPathObj*)pNext)->GetPathPoly();
+                }
 			}
 			else
 			{
@@ -415,13 +467,18 @@ SdrObject* EnhancedCustomShape3d::Create
 
 			if( aPolyPoly.count() )
 			{
-				const basegfx::B2DRange aTempRange(basegfx::tools::getRange(aPolyPoly));
+			    if(aPolyPoly.areControlPointsUsed())
+			    {
+				    aPolyPoly = basegfx::tools::adaptiveSubdivideByAngle(aPolyPoly);
+			    }
+				
+                const basegfx::B2DRange aTempRange(basegfx::tools::getRange(aPolyPoly));
                 const Rectangle aBoundRect(basegfx::fround(aTempRange.getMinX()), basegfx::fround(aTempRange.getMinY()), basegfx::fround(aTempRange.getMaxX()), basegfx::fround(aTempRange.getMaxY()));
 				aBoundRect2d.Union( aBoundRect );
 
 				E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 10 : fDepth );
 				p3DObj->NbcSetLayer( pShape2d->GetLayer() );
-				p3DObj->SetMergedItemSet( aSet );
+				p3DObj->SetMergedItemSet( aLocalSet );
 				if ( bIsPlaceholderObject )
 					aPlaceholderObjectList.push_back( p3DObj );
 				else if ( bUseTwoFillStyles )
@@ -465,7 +522,7 @@ SdrObject* EnhancedCustomShape3d::Create
 					pScene->Insert3DObj( p3DObj );
 					p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, fDepth );
 					p3DObj->NbcSetLayer( pShape2d->GetLayer() );
-					p3DObj->SetMergedItemSet( aSet );
+					p3DObj->SetMergedItemSet( aLocalSet );
 					if ( bUseExtrusionColor )
 						p3DObj->SetMergedItem( XFillColorItem( String(), ((XSecondaryFillColorItem&)pCustomShape->GetMergedItem( XATTR_SECONDARYFILLCOLOR )).GetColorValue() ) );
 					p3DObj->SetMergedItem( XFillStyleItem( XFILL_SOLID ) );
@@ -474,18 +531,18 @@ SdrObject* EnhancedCustomShape3d::Create
 					pScene->Insert3DObj( p3DObj );
 					p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, 10 );
 					p3DObj->NbcSetLayer( pShape2d->GetLayer() );
-					p3DObj->SetMergedItemSet( aSet );
+					p3DObj->SetMergedItemSet( aLocalSet );
 					
 					basegfx::B3DHomMatrix aFrontTransform( p3DObj->GetTransform() );
 					aFrontTransform.translate( 0.0, 0.0, fDepth );
 					p3DObj->NbcSetTransform( aFrontTransform );
 
-					if ( ( eFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
+					if ( ( aLocalFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
                     {
 						p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
                     }
 				}
-				else if ( eFillStyle == XFILL_NONE )
+				else if ( aLocalFillStyle == XFILL_NONE )
 				{
 					XLineColorItem& rLineColor = (XLineColorItem&)p3DObj->GetMergedItem( XATTR_LINECOLOR );
 					p3DObj->SetMergedItem( XFillColorItem( String(), rLineColor.GetColorValue() ) );

Modified: incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx Mon Aug 20 11:46:19 2012
@@ -264,7 +264,7 @@ static const SvxMSDffTextRectangles mso_
 };
 static const SvxMSDffVertPair mso_sptRightTriangleGluePoints[] =
 {
-	{ 10800, 0 }, { 5400, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 16200, 10800 }
+	{ 0, 0 }, { 0, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 10800, 10800 }
 };
 static const mso_CustomShape msoRightTriangle =
 {
@@ -497,7 +497,7 @@ static const SvxMSDffTextRectangles mso_
 };
 static const SvxMSDffVertPair mso_sptIsocelesTriangleGluePoints[] =
 {
-	{ 10800, 0 }, { 1 MSO_I, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 7 MSO_I, 10800 }
+	{ 0 MSO_I, 0 }, { 1 MSO_I, 10800 }, { 0, 21600 }, { 10800, 21600 }, { 21600, 21600 }, { 7 MSO_I, 10800 }
 };
 static const SvxMSDffHandle mso_sptIsocelesTriangleHandle[] =
 {
@@ -4507,7 +4507,292 @@ static const mso_CustomShape msoRibbon =
 	(SvxMSDffVertPair*)mso_sptRibbonGluePoints, sizeof( mso_sptRibbonGluePoints ) / sizeof( SvxMSDffVertPair ),
 	(SvxMSDffHandle*)mso_sptRibbonHandle, sizeof( mso_sptRibbonHandle ) / sizeof( SvxMSDffHandle )
 };
-
+//msosptEllipseRibbon
+//svg path = ar@9@38@8@37,0@27@0@26@9@13@8@4@0@25@22@25@9@38@8@37@22@26@3@27l@7@40@3,wa@9@35@8@10@3,0@21@33@9@36@8@1@21@31@20@31@9@35@8@10@20@33,,l@5@40xewr@9@36@8@1@20@31@0@32nfl@20@33ear@9@36@8@1@21@31@22@32nfl@21@33em@0@26nfl@0@32em@22@26nfl@22@32e
+//odp path = A ?f9 ?f38 ?f8 ?f37 0 ?f27 ?f0 ?f26 ?f9 ?f13 ?f8 ?f4 ?f0 ?f25 ?f22 ?f25 ?f9 ?f38 ?f8 ?f37 ?f22 ?f26 ?f3 ?f27 L ?f7 ?f40 ?f3 0 W ?f9 ?f35 ?f8 ?f10 ?f3 0 ?f21 ?f33 ?f9 ?f36 ?f8 ?f1 ?f21 ?f31 ?f20 ?f31 ?f9 ?f35 ?f8 ?f10 ?f20 ?f33 0 0 L ?f5 ?f40 Z N W ?f9 ?f36 ?f8 ?f1 ?f20 ?f31 ?f0 ?f32 F L ?f20 ?f33 N A ?f9 ?f36 ?f8 ?f1 ?f21 ?f31 ?f22 ?f32 F L ?f21 ?f33 N M ?f0 ?f26 F L ?f0 ?f32 N M ?f22 ?f26 F L ?f22 ?f32 N
+static const SvxMSDffVertPair mso_sptEllipseRibbonVert[] =		
+{	
+	{ 9 MSO_I , 38 MSO_I },
+	{ 8 MSO_I , 37 MSO_I },
+	{ 0 , 27 MSO_I },
+	{ 0 MSO_I , 26 MSO_I },
+	{ 9 MSO_I , 13 MSO_I },
+	{ 8 MSO_I , 4 MSO_I },
+	{ 0 MSO_I , 25 MSO_I },
+	{ 22 MSO_I , 25 MSO_I },
+	{ 9 MSO_I , 38 MSO_I },
+	{ 8 MSO_I , 37 MSO_I },
+	{ 22 MSO_I , 26 MSO_I },
+	{ 3 MSO_I , 27 MSO_I },
+	{ 7 MSO_I , 40 MSO_I },
+	{ 3 MSO_I , 0 },
+	{ 9 MSO_I , 35 MSO_I },
+	{ 8 MSO_I , 10 MSO_I },
+	{ 3 MSO_I , 0 },
+	{ 21 MSO_I , 33 MSO_I },
+	{ 9 MSO_I , 36 MSO_I },
+	{ 8 MSO_I , 1 MSO_I },
+	{ 21 MSO_I , 31 MSO_I },
+	{ 20 MSO_I , 31 MSO_I },
+	{ 9 MSO_I , 35 MSO_I },
+	{ 8 MSO_I , 10 MSO_I },
+	{ 20 MSO_I , 33 MSO_I },
+	{ 0 , 0 },
+	{ 5 MSO_I , 40 MSO_I },
+	{ 9 MSO_I , 36 MSO_I },
+	{ 8 MSO_I , 1 MSO_I },
+	{ 20 MSO_I , 31 MSO_I },
+	{ 0 MSO_I , 32 MSO_I },
+	{ 20 MSO_I , 33 MSO_I },
+	{ 9 MSO_I , 36 MSO_I },
+	{ 8 MSO_I , 1 MSO_I },
+	{ 21 MSO_I , 31 MSO_I },
+	{ 22 MSO_I , 32 MSO_I },
+	{ 21 MSO_I , 33 MSO_I },
+	{ 0 MSO_I , 26 MSO_I },
+	{ 0 MSO_I , 32 MSO_I },
+	{ 22 MSO_I , 26 MSO_I },
+	{ 22 MSO_I , 32 MSO_I }
+};
+
+static const sal_uInt16 mso_sptEllipseRibbonSegm[] =
+{
+	0xa30c /*ar*/,0x0002/*l*/,0xa50c/*wa*/,0x0001/*l*/,
+	0x6001/*x*/, 0x8000/*e*/,0xa504/*wr*/,0xaa00/*nf*/, 
+	0x0001/*l*/, 0x8000/*e*/,0xa304/*ar*/,0xaa00/*nf*/,
+	0x0001/*l*/, 0x8000/*e*/,0x4000/*m*/,0xaa00/*nf*/,
+	0x0001/*l*/, 0x8000/*e*/,0x4000/*m*/,0xaa00/*nf*/,
+	0x0001/*l*/, 0x8000/*e*/
+};
+
+static const SvxMSDffCalculationData mso_sptEllipseRibbonCalc[] =
+{
+	{ 0x2000 , { DFF_Prop_adjustValue , 0 , 0 } }, //val #0
+	{ 0x2000 , { DFF_Prop_adjust2Value , 0 , 0 } }, //val #1
+	{ 0x2000 , { DFF_Prop_adjust3Value , 0 , 0 } }, //val #2
+	{ 0x2000 , { DFF_Prop_geoRight , 0 , 0 } }, //val width
+	{ 0x2000 , { DFF_Prop_geoBottom , 0 , 0 } }, //val height
+	{ 0x2001 , { DFF_Prop_geoRight , 1 , 8 } }, //prod width 1 8
+	{ 0x2001 , { DFF_Prop_geoRight , 1 , 2 } }, //prod width 1 2
+	{ 0x2001 , { DFF_Prop_geoRight , 7 , 8 } }, //prod width 7 8
+	{ 0x2001 , { DFF_Prop_geoRight , 3 , 2 } }, //prod width 3 2
+	{ 0x8000 , { 0 , 0 , 0x406 } }, //sum 0 0 @6
+	{ 0xa000 , { DFF_Prop_geoBottom , 0 , DFF_Prop_adjust3Value } }, //sum height 0 #2
+	{ 0x2001 , { 0x40a , 30573 , 4096 } }, //prod @10 30573 4096
+	{ 0x2001 , { 0x40b , 2 , 1 } }, //prod @11 2 1
+	{ 0xa000 , { DFF_Prop_geoBottom , 0 , 0x40c } }, //sum height 0 @12
+	{ 0x6000 , { 0x40b , DFF_Prop_adjust3Value , 0 } }, //sum @11 #2 0
+	{ 0xe000 , { 0x40b , DFF_Prop_geoBottom , DFF_Prop_adjust2Value } }, //sum @11 height #1
+	{ 0xa000 , { DFF_Prop_geoBottom , 0 , DFF_Prop_adjust2Value } }, //sum height 0 #1
+	{ 0x2001 , { 0x410 , 1 , 2 } }, //prod @16 1 2
+	{ 0x6000 , { 0x40b , 0x411 , 0 } }, //sum @11 @17 0
+	{ 0xe000 , { 0x40e , DFF_Prop_adjust2Value , DFF_Prop_geoBottom } }, //sum @14 #1 height
+	{ 0x6000 , { DFF_Prop_adjustValue , 0x405 , 0 } }, //sum #0 @5 0
+	{ 0xa000 , { DFF_Prop_geoRight , 0 , 0x414 } }, //sum width 0 @20
+	{ 0xa000 , { DFF_Prop_geoRight , 0 , DFF_Prop_adjustValue } }, //sum width 0 #0
+	{ 0xa000 , { 0x406 , 0 , DFF_Prop_adjustValue } }, //sum @6 0 #0
+	{ 0xe00f , { 0x417 , DFF_Prop_geoRight , 0x40b } }, //ellipse @23 width @11
+	{ 0xe000 , { 0x418 , DFF_Prop_geoBottom , 0x40b } }, //sum @24 height @11
+	{ 0xe000 , { 0x419 , 0x40b , 0x413 } }, //sum @25 @11 @19
+	{ 0xe000 , { DFF_Prop_adjust3Value , 0x40b , 0x413 } }, //sum #2 @11 @19
+	{ 0x2001 , { 0x40b , 2391 , 32768 } }, //prod @11 2391 32768
+	{ 0xa000 , { 0x406 , 0 , 0x414 } }, //sum @6 0 @20
+	{ 0xe00f , { 0x41d , DFF_Prop_geoRight , 0x40b } }, //ellipse @29 width @11
+	{ 0xe000 , { DFF_Prop_adjust2Value , 0x41e , 0x40b } }, //sum #1 @30 @11
+	{ 0xe000 , { 0x419 , DFF_Prop_adjust2Value , DFF_Prop_geoBottom } }, //sum @25 #1 height
+	{ 0xe000 , { DFF_Prop_geoBottom , 0x41e , 0x40e } }, //sum height @30 @14
+	{ 0x6000 , { 0x40b , 0x40e , 0 } }, //sum @11 @14 0
+	{ 0xa000 , { DFF_Prop_geoBottom , 0 , 0x422 } }, //sum height 0 @34
+	{ 0xe000 , { 0x423 , 0x413 , 0x40b } }, //sum @35 @19 @11
+	{ 0xe000 , { 0x40a , 0x40f , 0x40b } }, //sum @10 @15 @11
+	{ 0xe000 , { 0x423 , 0x40f , 0x40b } }, //sum @35 @15 @11
+	{ 0xe000 , { 0x41c , 0x40e , 0x412 } }, //sum @28 @14 @18
+	{ 0xa000 , { DFF_Prop_geoBottom , 0 , 0x427 } }, //sum height 0 @39
+	{ 0xa000 , { 0x413 , 0 , 0x412 } }, //sum @19 0 @18
+	{ 0x2001 , { 0x429 , 2 , 3 } }, //prod @41 2 3
+	{ 0xa000 , { DFF_Prop_adjust2Value , 0 , 0x42a } }, //sum #1 0 @42
+	{ 0xa000 , { DFF_Prop_adjust3Value , 0 , 0x42a } }, //sum #2 0 @42
+	{ 0x2004 , { 0x42c , 20925 , 0 } }, //min @44 20925
+	{ 0x2001 , { DFF_Prop_geoRight , 3 , 8 } }, //prod width 3 8
+	{ 0x2000 , { 0x42e , 0 , 4 } }, //sum @46 0 4
+};
+
+static const SvxMSDffTextRectangles mso_sptEllipseRibbonTextRect[] =
+{//@0,@1,@22,@25
+	{ { 0 MSO_I, 1 MSO_I }, { 22 MSO_I, 25 MSO_I } }
+};
+
+static const sal_Int32 mso_sptEllipseRibbonDefault[] =
+{ 
+	3,5400,5400,18900 
+};
+
+static const SvxMSDffHandle mso_sptEllipseRibbonHandle[] =
+{
+//position="#0,bottomRight" xrange="@5,@47
+//position="center,#1" yrange="@10,@43
+//position="topLeft,#2" yrange="@27,@45
+	{   MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL| MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+		0x100, 21600, 0, 0, 0x8/*5+3*/, 0x32/*47+3*/, 0x80000000, 0x7fffffff },
+	{	MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+		10800, 0x101, 0, 0, 0x80000000, 0x7fffffff,0xd/*10+3*/, 0x2e /*43+3*/ },
+	{	MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+		0, 0x102, 0, 0, 0x80000000, 0x7fffffff,0x1e/*27+3*/, 0x30 /*45+3*/ }
+};
+
+static const mso_CustomShape msosptEllipseRibbon =
+{
+	(SvxMSDffVertPair*)mso_sptEllipseRibbonVert, sizeof( mso_sptEllipseRibbonVert ) / sizeof( SvxMSDffVertPair ),
+	(sal_uInt16*)mso_sptEllipseRibbonSegm, sizeof( mso_sptEllipseRibbonSegm ) >> 1,
+	(SvxMSDffCalculationData*)mso_sptEllipseRibbonCalc, sizeof( mso_sptEllipseRibbonCalc ) / sizeof( SvxMSDffCalculationData ),
+	(sal_Int32*)mso_sptEllipseRibbonDefault,
+	(SvxMSDffTextRectangles*)mso_sptEllipseRibbonTextRect, sizeof( mso_sptEllipseRibbonTextRect ) / sizeof( SvxMSDffTextRectangles ),
+	21600, 21600,
+	0x80000000, 0x80000000,
+	NULL, 0,
+	(SvxMSDffHandle*)mso_sptEllipseRibbonHandle, sizeof( mso_sptEllipseRibbonHandle ) / sizeof( SvxMSDffHandle )
+};
+
+//msosptEllipseRibbon2
+//svg path = wr@9@34@8@35,0@24@0@23@9,0@8@11@0@22@19@22@9@34@8@35@19@23@3@24l@7@36@3@4at@9@31@8@32@3@4@18@30@9@1@8@33@18@28@17@28@9@31@8@32@17@30,0@4l@5@36xear@9@1@8@33@17@28@0@29nfl@17@30ewr@9@1@8@33@18@28@19@29nfl@18@30em@0@23nfl@0@29em@19@23nfl@19@29e
+static const SvxMSDffVertPair mso_sptEllipseRibbon2Vert[] =		
+{
+	{ 9 MSO_I , 34 MSO_I },
+	{ 8 MSO_I , 35 MSO_I },
+	{ 0 , 24 MSO_I },
+	{ 0 MSO_I , 23 MSO_I },
+	{ 9 MSO_I , 0 },
+	{ 8 MSO_I , 11 MSO_I },
+	{ 0 MSO_I , 22 MSO_I },
+	{ 19 MSO_I , 22 MSO_I },
+	{ 9 MSO_I , 34 MSO_I },
+	{ 8 MSO_I , 35 MSO_I },
+	{ 19 MSO_I , 23 MSO_I },
+	{ 3 MSO_I , 24 MSO_I },
+	{ 7 MSO_I , 36 MSO_I },
+	{ 3 MSO_I , 4 MSO_I },
+	{ 9 MSO_I , 31 MSO_I },
+	{ 8 MSO_I , 32 MSO_I },
+	{ 3 MSO_I , 4 MSO_I },
+	{ 18 MSO_I , 30 MSO_I },
+	{ 9 MSO_I , 1 MSO_I },
+	{ 8 MSO_I , 33 MSO_I },
+	{ 18 MSO_I , 28 MSO_I },
+	{ 17 MSO_I , 28 MSO_I },
+	{ 9 MSO_I , 31 MSO_I },
+	{ 8 MSO_I , 32 MSO_I },
+	{ 17 MSO_I , 30 MSO_I },
+	{ 0 , 4l MSO_I },
+	{ 5 MSO_I , 36 MSO_I },
+	{ 9 MSO_I , 1 MSO_I },
+	{ 8 MSO_I , 33 MSO_I },
+	{ 17 MSO_I , 28 MSO_I },
+	{ 0 MSO_I , 29 MSO_I },
+	{ 17 MSO_I , 30 MSO_I },
+	{ 9 MSO_I , 1 MSO_I },
+	{ 8 MSO_I , 33 MSO_I },
+	{ 18 MSO_I , 28 MSO_I },
+	{ 19 MSO_I , 29 MSO_I },
+	{ 18 MSO_I , 30 MSO_I },
+	{ 0 MSO_I , 23 MSO_I },
+	{ 0 MSO_I , 29 MSO_I },
+	{ 19 MSO_I , 23 MSO_I },
+	{ 19 MSO_I , 29 MSO_I }
+};
+static const sal_uInt16 mso_sptEllipseRibbon2Segm[] =
+{
+	0xa50c/*wr*/,0x0002/*l*/,0xa30c/*at*/,0x0001/*l*/,
+	0x6001/*x*/, 0x8000/*e*/,0xa304/*ar*/,0xaa00/*nf*/, 
+	0x0001/*l*/, 0x8000/*e*/,0xa504/*wr*/,0xaa00/*nf*/,
+	0x0001/*l*/, 0x8000/*e*/,0x4000/*m*/,0xaa00/*nf*/,
+	0x0001/*l*/, 0x8000/*e*/,0x4000/*m*/,0xaa00/*nf*/,
+	0x0001/*l*/, 0x8000/*e*/
+};
+
+static const SvxMSDffCalculationData mso_sptEllipseRibbon2Calc[] =
+{
+	{ 0x2000 , { DFF_Prop_adjustValue , 0 , 0 } }, //val #0
+	{ 0x2000 , { DFF_Prop_adjust2Value , 0 , 0 } }, //val #1
+	{ 0x2000 , { DFF_Prop_adjust3Value , 0 , 0 } }, //val #2
+	{ 0x2000 , { DFF_Prop_geoRight , 0 , 0 } }, //val width
+	{ 0x2000 , { DFF_Prop_geoBottom , 0 , 0 } }, //val height
+	{ 0x2001 , { DFF_Prop_geoRight , 1 , 8 } }, //prod width 1 8
+	{ 0x2001 , { DFF_Prop_geoRight , 1 , 2 } }, //prod width 1 2
+	{ 0x2001 , { DFF_Prop_geoRight , 7 , 8 } }, //prod width 7 8
+	{ 0x2001 , { DFF_Prop_geoRight , 3 , 2 } }, //prod width 3 2
+	{ 0x8000 , { 0 , 0 , 0x406 } }, //sum 0 0 @6
+	{ 0x2001 , { DFF_Prop_adjust3Value , 30573 , 4096 } }, //prod #2 30573 4096
+	{ 0x2001 , { 0x40a , 2 , 1 } }, //prod @10 2 1
+	{ 0xe000 , { 0x40a , DFF_Prop_geoBottom , DFF_Prop_adjust3Value } }, //sum @10 height #2
+	{ 0x6000 , { 0x40a , DFF_Prop_adjust2Value , 0 } }, //sum @10 #1 0
+	{ 0x2001 , { DFF_Prop_adjust2Value , 1 , 2 } }, //prod #1 1 2
+	{ 0x6000 , { 0x40a , 0x40e , 0 } }, //sum @10 @14 0
+	{ 0xa000 , { 0x40c , 0 , DFF_Prop_adjust2Value } }, //sum @12 0 #1
+	{ 0x6000 , { DFF_Prop_adjustValue , 0x405 , 0 } }, //sum #0 @5 0
+	{ 0xa000 , { DFF_Prop_geoRight , 0 , 0x411 } }, //sum width 0 @17
+	{ 0xa000 , { DFF_Prop_geoRight , 0 , DFF_Prop_adjustValue } }, //sum width 0 #0
+	{ 0xa000 , { 0x406 , 0 , DFF_Prop_adjustValue } }, //sum @6 0 #0
+	{ 0xe00f , { 0x414 , DFF_Prop_geoRight , 0x40a } }, //ellipse @20 width @10
+	{ 0xa000 , { 0x40a , 0 , 0x415 } }, //sum @10 0 @21
+	{ 0xe000 , { 0x416 , 0x410 , 0x40a } }, //sum @22 @16 @10
+	{ 0xe000 , { DFF_Prop_adjust3Value , 0x410 , 0x40a } }, //sum #2 @16 @10
+	{ 0x2001 , { 0x40a , 2391 , 32768 } }, //prod @10 2391 32768
+	{ 0xa000 , { 0x406 , 0 , 0x411 } }, //sum @6 0 @17
+	{ 0xe00f , { 0x41a , DFF_Prop_geoRight , 0x40a } }, //ellipse @26 width @10
+	{ 0xe000 , { 0x40a , DFF_Prop_adjust2Value , 0x41b } }, //sum @10 #1 @27
+	{ 0x6000 , { 0x416 , DFF_Prop_adjust2Value , 0 } }, //sum @22 #1 0
+	{ 0xa000 , { 0x40c , 0 , 0x41b } }, //sum @12 0 @27
+	{ 0xa000 , { DFF_Prop_geoBottom , 0 , DFF_Prop_adjust3Value } }, //sum height 0 #2
+	{ 0x6000 , { 0x40a , 0x40c , 0 } }, //sum @10 @12 0
+	{ 0xe000 , { 0x420 , 0x40a , 0x410 } }, //sum @32 @10 @16
+	{ 0xe000 , { 0x41f , 0x40a , 0x40d } }, //sum @31 @10 @13
+	{ 0xe000 , { 0x420 , 0x40a , 0x40d } }, //sum @32 @10 @13
+	{ 0xe000 , { 0x419 , 0x40c , 0x40f } }, //sum @25 @12 @15
+	{ 0xa000 , { 0x410 , 0 , 0x40f } }, //sum @16 0 @15
+	{ 0x2001 , { 0x425 , 2 , 3 } }, //prod @37 2 3
+	{ 0x6000 , { 0x401 , 0x426 , 0 } }, //sum @1 @38 0
+	{ 0x6000 , { DFF_Prop_adjust3Value , 0x426 , 0 } }, //sum #2 @38 0
+	{ 0x2005 , { 0x428 , 675 , 0 } }, //max @40 675
+	{ 0x2001 , { DFF_Prop_geoRight , 3 , 8 } }, //prod width 3 8
+	{ 0x2000 , { 0x42a , 0 , 4 } } //sum @42 0 4
+};
+
+static const SvxMSDffTextRectangles mso_sptEllipseRibbon2TextRect[] =
+{//@0,@22,@19,@1
+	{ { 0 MSO_I, 22 MSO_I }, { 19 MSO_I, 1 MSO_I } }
+};
+
+static const sal_Int32 mso_sptEllipseRibbon2Default[] =
+{ 
+	3,5400,16200,2700
+};
+
+static const SvxMSDffHandle mso_sptEllipseRibbon2Handle[] =
+{
+//position="#0,topLeft" xrange="@5,@43
+//position="center,#1" yrange="@39,@31
+//position="topLeft,#2" yrange="@41,@24
+	{   MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_X_MAX_IS_SPECIAL| MSDFF_HANDLE_FLAGS_RANGE_X_MIN_IS_SPECIAL,
+		0x100, 0, 0, 0, 0x8/*5+3*/, 0x2e/*43+3*/, 0x80000000, 0x7fffffff },
+	{	MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+		10800, 0x101, 0, 0, 0x80000000, 0x7fffffff,0x2a/*39+3*/, 0x22 /*31+3*/ },
+	{	MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+		0, 0x102, 0, 0, 0x80000000, 0x7fffffff,0x2c/*41+3*/, 0x1b /*24+3*/ }
+};
+
+static const mso_CustomShape msosptEllipseRibbon2 =
+{
+	(SvxMSDffVertPair*)mso_sptEllipseRibbon2Vert, sizeof( mso_sptEllipseRibbon2Vert ) / sizeof( SvxMSDffVertPair ),
+	(sal_uInt16*)mso_sptEllipseRibbon2Segm, sizeof( mso_sptEllipseRibbon2Segm ) >> 1,
+	(SvxMSDffCalculationData*)mso_sptEllipseRibbon2Calc, sizeof( mso_sptEllipseRibbon2Calc ) / sizeof( SvxMSDffCalculationData ),
+	(sal_Int32*)mso_sptEllipseRibbon2Default,
+	(SvxMSDffTextRectangles*)mso_sptEllipseRibbon2TextRect, sizeof( mso_sptEllipseRibbon2TextRect ) / sizeof( SvxMSDffTextRectangles ),
+	21600, 21600,
+	0x80000000, 0x80000000,
+	NULL, 0,
+	(SvxMSDffHandle*)mso_sptEllipseRibbon2Handle, sizeof( mso_sptEllipseRibbon2Handle ) / sizeof( SvxMSDffHandle )
+};
+// End
 static const SvxMSDffVertPair mso_sptVerticalScrollVert[] =	// adjustment1 : 0 - 5400
 {
 	{ 1 MSO_I, 21600 }, { 0, 11 MSO_I }, { 1 MSO_I, 12 MSO_I }, { 0 MSO_I, 12 MSO_I },
@@ -6177,16 +6462,62 @@ static const mso_CustomShape msoTextChev
 	NULL, 0,
 	(SvxMSDffHandle*)mso_sptTextChevronInvertedHandle, sizeof( mso_sptTextChevronInvertedHandle ) / sizeof( SvxMSDffHandle )
 };
-
+//V 0 0 21600 ?f2 0 ?f0 21600 ?f0 
+//W 0 0 21600 ?f2 21600 ?f0 0 ?f0 N 
+//V 0 ?f3 21600 21600 0 ?f1 21600 ?f1 
+//W 0 ?f3 21600 21600 21600 ?f1 0 ?f1 N
+//mso_sptTextRingInside
+static const SvxMSDffVertPair mso_sptTextRingInsideVert[] =
+{
+	{ 0, 0 }, { 21600, 2 MSO_I }, { 0, 0 MSO_I },{ 21600, 0 MSO_I },//V
+	{ 0, 0 }, { 21600, 2 MSO_I }, { 21600, 0 MSO_I },{ 0, 0 MSO_I },//W
+	{ 0, 3 MSO_I }, { 21600, 21600 }, { 0, 1 MSO_I },{ 21600, 1 MSO_I },//V
+	{ 0, 3 MSO_I }, { 21600, 21600 }, { 21600, 1 MSO_I },{ 0, 1 MSO_I }//W
+};
+static const SvxMSDffCalculationData mso_sptTextRingInsideCalc[] =	// adjustment1 : 6629 - 14971
+{
+	{ 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
+	{ 0x8000, { 21600, 0, 0x400 } },
+	{ 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, //$0
+	{ 0x8000, { 21600, 0, DFF_Prop_adjustValue } }//21600-$0
+};
+static const sal_uInt16 mso_sptTextRingInsideSegm[] =
+{
+	0xa604, 0xa504,0x8000,
+	0xa604, 0xa504,0x8000
+};
+static const SvxMSDffHandle mso_sptTextRingInsideHandle[] =
+{
+	{	MSDFF_HANDLE_FLAGS_RANGE| MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
+		10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 10800, 21600 }
+};
+static const mso_CustomShape msoTextRingInside =
+{
+	(SvxMSDffVertPair*)mso_sptTextRingInsideVert, sizeof( mso_sptTextRingInsideVert ) / sizeof( SvxMSDffVertPair ),
+	(sal_uInt16*)mso_sptTextRingInsideSegm, sizeof( mso_sptTextRingInsideSegm ) >> 1,
+	(SvxMSDffCalculationData*)mso_sptTextRingInsideCalc, sizeof( mso_sptTextRingInsideCalc ) / sizeof( SvxMSDffCalculationData ),
+	(sal_Int32*)mso_sptDefault13500,
+	(SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
+	21600, 21600,
+	0x80000000, 0x80000000,
+	NULL, 0,
+	(SvxMSDffHandle*)mso_sptTextRingInsideHandle, sizeof( mso_sptTextRingInsideHandle ) / sizeof( SvxMSDffHandle )
+};
+//mso_sptTextRingOutside
+//path = U 10800 ?f0 21600 ?f2 180 539 N U 10800 ?f1 21600 ?f2 180 539 N
 static const SvxMSDffVertPair mso_sptTextRingOutsideVert[] =
 {
-	{ 10800, 0 MSO_I }, { 10800, 0 MSO_I }, { 180, 359 },
-	{ 10800, 1 MSO_I }, { 10800, 0 MSO_I }, { 180, 359 }
+	{ 10800, 0 MSO_I }, { 21600, 2 MSO_I }, { 180, 539},//U
+	{ 10800, 1 MSO_I }, { 21600, 2 MSO_I }, { 180, 539 }//U
+	//{ 10800, 0 MSO_I }, { 10800, 0 MSO_I }, { 180, 359 },
+	//{ 10800, 1 MSO_I }, { 10800, 0 MSO_I }, { 180, 359 }
 };
 static const SvxMSDffCalculationData mso_sptTextRingOutsideCalc[] =	// adjustment1 : 6629 - 14971
 {
 	{ 0x2001, { DFF_Prop_adjustValue, 1, 2 } },
-	{ 0x8000, { 21600, 0, 0x400 } }
+	{ 0x8000, { 21600, 0, 0x400 } },
+	{ 0x2000, { DFF_Prop_adjustValue, 0, 0 } }, //$0
+	{ 0x8000, { 21600, 0, DFF_Prop_adjustValue } }//21600-$0
 };
 static const sal_uInt16 mso_sptTextRingOutsideSegm[] =
 {
@@ -6195,7 +6526,7 @@ static const sal_uInt16 mso_sptTextRingO
 };
 static const SvxMSDffHandle mso_sptTextRingOutsideHandle[] =
 {
-	{	MSDFF_HANDLE_FLAGS_RANGE,
+	{	MSDFF_HANDLE_FLAGS_RANGE | MSDFF_HANDLE_FLAGS_RANGE_Y_MAX_IS_SPECIAL | MSDFF_HANDLE_FLAGS_RANGE_Y_MIN_IS_SPECIAL,
 		10800, 0x100, 10800, 10800, 0x80000000, 0x7fffffff, 10800, 21600 }
 };
 static const mso_CustomShape msoTextRingOutside =
@@ -6203,7 +6534,7 @@ static const mso_CustomShape msoTextRing
 	(SvxMSDffVertPair*)mso_sptTextRingOutsideVert, sizeof( mso_sptTextRingOutsideVert ) / sizeof( SvxMSDffVertPair ),
 	(sal_uInt16*)mso_sptTextRingOutsideSegm, sizeof( mso_sptTextRingOutsideSegm ) >> 1,
 	(SvxMSDffCalculationData*)mso_sptTextRingOutsideCalc, sizeof( mso_sptTextRingOutsideCalc ) / sizeof( SvxMSDffCalculationData ),
-	(sal_Int32*)mso_sptDefault16200,
+	(sal_Int32*)mso_sptDefault13500,
 	(SvxMSDffTextRectangles*)mso_sptFontWorkTextRect, sizeof( mso_sptFontWorkTextRect ) / sizeof( SvxMSDffTextRectangles ),
 	21600, 21600,
 	0x80000000, 0x80000000,
@@ -7964,6 +8295,7 @@ const mso_CustomShape* GetCustomShapeCon
 	switch( eSpType )
 	{
 		case mso_sptArc :						pCustomShape = &msoArc; break;
+		case mso_sptLine:						pCustomShape = &msoStraightConnector1; break;
 		case mso_sptRectangle :					pCustomShape = &msoRectangle; break;
 		case mso_sptParallelogram :				pCustomShape = &msoParallelogram; break;
 		case mso_sptTrapezoid :					pCustomShape = &msoTrapezoid; break;
@@ -8047,8 +8379,8 @@ const mso_CustomShape* GetCustomShapeCon
 		case mso_sptSeal32 :					pCustomShape = &msoSeal32; break;
 		case mso_sptRibbon2 :					pCustomShape = &msoRibbon2; break;
 		case mso_sptRibbon :					pCustomShape = &msoRibbon; break;
-		case mso_sptEllipseRibbon2 :			pCustomShape = &msoRibbon2; break;	// SJ: TODO
-		case mso_sptEllipseRibbon :				pCustomShape = &msoRibbon; break;	// SJ: TODO
+		case mso_sptEllipseRibbon2 :			pCustomShape = &msosptEllipseRibbon2; break;	// SJ: TODO
+		case mso_sptEllipseRibbon :				pCustomShape = &msosptEllipseRibbon; break;	// SJ: TODO
 		case mso_sptVerticalScroll :			pCustomShape = &msoVerticalScroll;	break;
 		case mso_sptHorizontalScroll :			pCustomShape = &msoHorizontalScroll; break;
 		case mso_sptFlowChartProcess :			pCustomShape = &msoFlowChartProcess; break;
@@ -8133,7 +8465,7 @@ const mso_CustomShape* GetCustomShapeCon
 		case mso_sptTextTriangleInverted :		pCustomShape = &msoTextTriangleInverted; break;
 		case mso_sptTextChevron :				pCustomShape = &msoTextChevron; break;
 		case mso_sptTextChevronInverted :		pCustomShape = &msoTextChevronInverted; break;
-		case mso_sptTextRingInside :			pCustomShape = &msoTextRingOutside; break;	// SJ: TODO->the orientation of the ellipse needs to be changed
+		case mso_sptTextRingInside :			pCustomShape = &msoTextRingInside; break;	// SJ: TODO->the orientation of the ellipse needs to be changed
 		case mso_sptTextRingOutside :			pCustomShape = &msoTextRingOutside; break;
 		case mso_sptTextFadeRight :				pCustomShape = &msoTextFadeRight; break;
 		case mso_sptTextFadeLeft :				pCustomShape = &msoTextFadeLeft; break;

Modified: incubator/ooo/branches/writer001/main/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/branches/writer001/main/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx?rev=1374979&r1=1374978&r2=1374979&view=diff
==============================================================================
--- incubator/ooo/branches/writer001/main/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx (original)
+++ incubator/ooo/branches/writer001/main/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx Mon Aug 20 11:46:19 2012
@@ -134,6 +134,7 @@ namespace sdr
 					        125.0, // 1.25 mm
 					        45.0 * F_PI180, // 45 degree diagonal
 					        Color(COL_BLACK).getBColor(), // black color
+                            3, // same default as VCL, a minimum of three discrete units (pixels) offset
 					        false); // no filling
 
 				        const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D(