Author: alg
Date: Fri Oct 25 16:25:48 2013
New Revision: 1535773

URL: http://svn.apache.org/r1535773
Log:
in-between commit with changes to MS binary format stuff, Calc overlay, circle 
type cleanup, rotated obejct export for word

Modified:
    openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.cxx
    openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.hxx
    openoffice/branches/alg/aw080/main/sc/source/ui/view/tabview5.cxx
    openoffice/branches/alg/aw080/main/svx/inc/svx/svdocirc.hxx
    openoffice/branches/alg/aw080/main/svx/source/sdr/overlay/overlaymanager.cxx
    openoffice/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx
    openoffice/branches/alg/aw080/main/sw/source/filter/ww8/wrtw8esh.cxx
    openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx

Modified: openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.cxx?rev=1535773&r1=1535772&r2=1535773&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.cxx 
(original)
+++ openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.cxx Fri 
Oct 25 16:25:48 2013
@@ -166,7 +166,6 @@ void ImplEESdrWriter::ImplHandleRotation
         const basegfx::B2DPoint 
aCurrentCenter(ImplMapB2DPoint(rMat.getB2DHomMatrix() * basegfx::B2DPoint(0.5, 
0.5)));
         const basegfx::B2DPoint 
aObjectRangeCenter(rObj.getObjectRange().getCenter());
         basegfx::B2DRange aObjectRange(rObj.getObjectRange());
-        bool bChanged(false);
 
         if(!aCurrentCenter.equal(aObjectRangeCenter))
         {
@@ -175,7 +174,6 @@ void ImplEESdrWriter::ImplHandleRotation
                     aCurrentCenter - aObjectRangeCenter));
 
             aObjectRange.transform(aAdaptToCenterRotation);
-            bChanged = true;
         }
 
         // do use inverted rotation here: The old model format (in which the 
value is here)
@@ -199,7 +197,6 @@ void ImplEESdrWriter::ImplHandleRotation
                     F_PI2));
 
             aObjectRange.transform(aMirrorDiagonal);
-            bChanged = true;
         }
 
         rObj.setObjectRange(aObjectRange);
@@ -1551,4 +1548,29 @@ bool ImplEESdrObject::ImplHasText() cons
        return xXText.is() && xXText->getString().getLength();
 }
 
+void ImplEESdrObject::setObjectRange(const basegfx::B2DRange& rObjectRange)
+{ 
+    maObjectRange = rObjectRange; 
+}
+
+const basegfx::B2DRange& ImplEESdrObject::getObjectRange() const 
+{ 
+    return maObjectRange; 
+}
+
+sal_Int32 ImplEESdrObject::GetAngle() const
+{ 
+    return mnAngle; 
+}
+
+void ImplEESdrObject::SetAngle(sal_Int32 nVal)
+{ 
+    mnAngle = nVal; 
+}
+
+basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& 
ImplEESdrObject::getTransform() 
+{ 
+    return maObjTrans; 
+}
+
 // eof

Modified: openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.hxx?rev=1535773&r1=1535772&r2=1535773&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.hxx 
(original)
+++ openoffice/branches/alg/aw080/main/filter/source/msfilter/eschesdo.hxx Fri 
Oct 25 16:25:48 2013
@@ -74,11 +74,11 @@ public:
        const String&           GetType() const                 { return mType; 
}
        void                            SetType( const String& rS ) { mType = 
rS; }
 
-    void setObjectRange(const basegfx::B2DRange& rObjectRange) { maObjectRange 
= rObjectRange; }
-    const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
+    void setObjectRange(const basegfx::B2DRange& rObjectRange);
+    const basegfx::B2DRange& getObjectRange() const;
 
-       sal_Int32                               GetAngle() const                
{ return mnAngle; }
-       void                            SetAngle( sal_Int32 nVal )      { 
mnAngle = nVal; }
+    sal_Int32 GetAngle() const;
+    void SetAngle(sal_Int32 nVal);
 
        sal_uInt32                              GetTextSize() const     { 
return mnTextSize; }
 
@@ -93,7 +93,7 @@ public:
        sal_uInt32                              ImplGetText();
        bool                            ImplHasText() const;
 
-    basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& getTransform() { 
return maObjTrans; }
+    basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& getTransform();
 };
 
 

Modified: openoffice/branches/alg/aw080/main/sc/source/ui/view/tabview5.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sc/source/ui/view/tabview5.cxx?rev=1535773&r1=1535772&r2=1535773&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/sc/source/ui/view/tabview5.cxx (original)
+++ openoffice/branches/alg/aw080/main/sc/source/ui/view/tabview5.cxx Fri Oct 
25 16:25:48 2013
@@ -171,35 +171,51 @@ __EXPORT ScTabView::~ScTabView()
 
        DELETEZ(pInputHintWindow);
 
-       if (pDrawView)
-       {
-               for (i=0; i<4; i++)
-                       if (pGridWin[i])
-                       {
-                               pDrawView->VCRemoveWin(pGridWin[i]);
-                               
pDrawView->DeleteWindowFromPaintView(pGridWin[i]);
-                       }
-       }
+    if(pDrawView)
+    {
+        for(i=0; i<4; i++)
+        {
+            if(pGridWin[i])
+            {
+                pDrawView->VCRemoveWin(pGridWin[i]);
+                pDrawView->DeleteWindowFromPaintView(pGridWin[i]);
+            }
+        }
 
-       delete pSelEngine;
+        delete pDrawView;
+        pDrawView = 0;
+    }
 
-       for (i=0; i<4; i++)
-               delete pGridWin[i];
+    delete pSelEngine;
+    pSelEngine = 0;
 
-       delete pHdrSelEng;
+    for (i=0; i<4; i++)
+    {
+        delete pGridWin[i];
+        pGridWin[i] = 0;
+    }
 
-       for (i=0; i<2; i++)
-       {
-               delete pColBar[i];
-               delete pRowBar[i];
-               delete pColOutline[i];
-               delete pRowOutline[i];
-       }
+    delete pHdrSelEng;
+    pHdrSelEng = 0;
 
-       delete pHSplitter;
-       delete pVSplitter;
+    for (i=0; i<2; i++)
+    {
+        delete pColBar[i];
+        pColBar[i] = 0;
+        delete pRowBar[i];
+        pRowBar[i] = 0;
+        delete pColOutline[i];
+        pColOutline[i] = 0;
+        delete pRowOutline[i];
+        pRowOutline[i] = 0;
+    }
 
-       delete pTabControl;
+    delete pHSplitter;
+    pHSplitter = 0;
+    delete pVSplitter;
+    pVSplitter = 0;
+    delete pTabControl;
+    pTabControl = 0;
 }
 
 void ScTabView::MakeDrawView( sal_uInt8 nForceDesignMode )

Modified: openoffice/branches/alg/aw080/main/svx/inc/svx/svdocirc.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/inc/svx/svdocirc.hxx?rev=1535773&r1=1535772&r2=1535773&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/inc/svx/svdocirc.hxx (original)
+++ openoffice/branches/alg/aw080/main/svx/inc/svx/svdocirc.hxx Fri Oct 25 
16:25:48 2013
@@ -33,10 +33,10 @@
 enum SdrCircleObjType
 {
        /// basic types the circle may have
-       CircleType_Circle = 0,                  // old OBJ_CIRC
-       CircleType_Sector,                              // old OBJ_SECT
-       CircleType_Arc,                                 // old OBJ_CARC
-       CircleType_Segment,                             // old OBJ_CCUT
+       CircleType_Circle = 0,                  // old OBJ_CIRC -> 
drawing::CircleKind_FULL
+       CircleType_Sector,                              // old OBJ_SECT -> 
drawing::CircleKind_SECTION
+       CircleType_Arc,                                 // old OBJ_CARC -> 
drawing::CircleKind_ARC
+       CircleType_Segment,                             // old OBJ_CCUT -> 
drawing::CircleKind_CUT
 };
 
 //////////////////////////////////////////////////////////////////////////////

Modified: 
openoffice/branches/alg/aw080/main/svx/source/sdr/overlay/overlaymanager.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/sdr/overlay/overlaymanager.cxx?rev=1535773&r1=1535772&r2=1535773&view=diff
==============================================================================
--- 
openoffice/branches/alg/aw080/main/svx/source/sdr/overlay/overlaymanager.cxx 
(original)
+++ 
openoffice/branches/alg/aw080/main/svx/source/sdr/overlay/overlaymanager.cxx 
Fri Oct 25 16:25:48 2013
@@ -155,7 +155,15 @@ namespace sdr
 
                                if(OUTDEV_WINDOW == 
getOutputDevice().GetOutDevType())
                                {
-                    aViewRange = getOutputDevice().GetLogicRange();
+                                       const Size 
aOutputSizePixel(getOutputDevice().GetOutputSizePixel());
+
+                    // only set when we *have* a output size, else let 
aViewRange
+                    // stay on empty
+                    if(aOutputSizePixel.Width() && aOutputSizePixel.Height())
+                    {
+                        aViewRange = basegfx::B2DRange(0.0, 0.0, 
aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight());
+                        
aViewRange.transform(getOutputDevice().GetInverseViewTransformation());
+                    }
                                }
 
                 OverlayManager* pThis = const_cast< OverlayManager* >(this);

Modified: openoffice/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx?rev=1535773&r1=1535772&r2=1535773&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx 
(original)
+++ openoffice/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx Fri Oct 
25 16:25:48 2013
@@ -3286,16 +3286,16 @@ bool SvxShape::getPropertyValueImpl( con
 
             if(pSdrCircObj)
                        {
-                               drawing::CircleKind eKind;
+                               drawing::CircleKind 
eKind(drawing::CircleKind_FULL);
 
                                switch(pSdrCircObj->GetSdrCircleObjType())
                                {
-                    case CircleType_Circle:
+                    default: // case CircleType_Circle:
                     {
                         eKind = drawing::CircleKind_FULL;
                         break;
                     }
-                    case CircleType_Sector:
+                    case CircleType_Segment:
                     {
                         eKind = drawing::CircleKind_CUT;
                         break;
@@ -3305,7 +3305,7 @@ bool SvxShape::getPropertyValueImpl( con
                         eKind = drawing::CircleKind_ARC;
                         break;
                     }
-                    case CircleType_Segment:
+                    case CircleType_Sector:
                     {
                         eKind = drawing::CircleKind_SECTION;
                         break;

Modified: openoffice/branches/alg/aw080/main/sw/source/filter/ww8/wrtw8esh.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/filter/ww8/wrtw8esh.cxx?rev=1535773&r1=1535772&r2=1535773&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/sw/source/filter/ww8/wrtw8esh.cxx 
(original)
+++ openoffice/branches/alg/aw080/main/sw/source/filter/ww8/wrtw8esh.cxx Fri 
Oct 25 16:25:48 2013
@@ -715,6 +715,8 @@ void PlcDrawObj::WritePlc( WW8Export& rW
             // <--
 
             Point aObjPos;
+            double fObjectRotation(0);
+
             if (RES_FLYFRMFMT == rFmt.Which())
             {
                 SwRect aLayRect(rFmt.FindLayoutRect(false, &aObjPos));
@@ -740,7 +742,36 @@ void PlcDrawObj::WritePlc( WW8Export& rW
                 ASSERT(pObj, "wo ist das SDR-Object?");
                 if (pObj)
                 {
-                    aRect = sdr::legacy::GetSnapRect(*pObj);
+                    // original used SnapRect, but the unrotated snap range is 
sufficient
+                    // here; for rotation a special treatment is needed 
anyways (see below)
+                    const basegfx::B2DRange aUnrotatedRange(
+                        pObj->getSdrObjectTranslate(),
+                        pObj->getSdrObjectTranslate() + 
pObj->getSdrObjectScale());
+
+                    // fill aRect with it
+                    aRect.Left() = basegfx::fround(aUnrotatedRange.getMinX());
+                    aRect.Top() = basegfx::fround(aUnrotatedRange.getMinY());
+                    aRect.Right() = basegfx::fround(aUnrotatedRange.getMaxX());
+                    aRect.Bottom() = 
basegfx::fround(aUnrotatedRange.getMaxY());
+
+                    // get ObjectRotation; prefer rotation over mirroring
+                    fObjectRotation = pObj->getSdrObjectRotate();
+                    bool bMirroredX(pObj->getSdrObjectScale().getX() < 0.0);
+                    bool bMirroredY(pObj->getSdrObjectScale().getY() < 0.0);
+
+                    // if mirror is X and Y, replace with 180 degree rotation. 
Prefer
+                    // rotation export over mirror export.
+                    if(bMirroredX && bMirroredY)
+                    {
+                        bMirroredX = bMirroredY = false;
+                        fObjectRotation += F_PI;
+                    }
+
+                    if(bMirroredX != bMirroredY)
+                    {
+                        // if one axis is mirrored, invert the rotation
+                        fObjectRotation = -fObjectRotation;
+                    }
                 }
             }
 
@@ -780,6 +811,57 @@ void PlcDrawObj::WritePlc( WW8Export& rW
                 nThick = 0;
             }
 
+            if(!basegfx::fTools::equalZero(fObjectRotation))
+            {
+                // we rotate around top-left, mS around center, so adapt 
position by
+                // correlating the two different centers of the objects
+                basegfx::B2DRange aUnrotatedRange(
+                    pObj->getSdrObjectTranslate(),
+                    pObj->getSdrObjectTranslate() + pObj->getSdrObjectScale());
+                const basegfx::B2DPoint 
aRealCenter(pObj->getSdrObjectTransformation() * basegfx::B2DPoint(0.5, 0.5));
+                const basegfx::B2DPoint 
aUnrotatedCenter(aUnrotatedRange.getCenter());
+
+                aUnrotatedRange.transform(
+                    basegfx::tools::createTranslateB2DHomMatrix(
+                        aRealCenter - aUnrotatedCenter));
+
+                // also need to correct by the SnapRect which was used for 
positioning;
+                // remove TopLeft of it and add aRect's adapted position
+                const basegfx::B2DRange aSnapRange(pObj->getSnapRange());
+
+                aUnrotatedRange.transform(
+                    basegfx::tools::createTranslateB2DHomMatrix(
+                        aRect.Left() - aSnapRange.getMinX(),
+                        aRect.Top() - aSnapRange.getMinY()));
+
+                // extract ObjectRotation in MS coordinates to decide if the
+                // ObjectRange needs to be 'mirrored diagonal', a special 
treatment
+                // for MS shapes in their formats
+                const sal_Int32 
nAngle(basegfx::fround(basegfx::snapToZeroRange(fObjectRotation / F_PI18000, 
36000.0)));
+
+                // adapt angle to MS format
+                sal_Int32 nMSAngle(nAngle * 655);
+                nMSAngle += 0x8000;
+                nMSAngle &=~0xffff; // round to full degrees
+
+                // detect if MS format needs a mirroring on diagonal
+                const bool bMirrorDiagonal((nMSAngle >= (45 << 16) && nMSAngle 
< (135 << 16)) || (nMSAngle >= (225 << 16) && nMSAngle < (315 << 16)));
+
+                if(bMirrorDiagonal)
+                {
+                    // in this range of rotation the object range is rotated, 
do this here, too
+                    aUnrotatedRange.transform(
+                        basegfx::tools::createRotateAroundPoint(
+                            aUnrotatedRange.getCenter(),
+                            F_PI2));
+                }
+
+                aRect.Left() = basegfx::fround(aUnrotatedRange.getMinX());
+                aRect.Top() = basegfx::fround(aUnrotatedRange.getMinY());
+                aRect.Right() = basegfx::fround(aUnrotatedRange.getMaxX());
+                aRect.Bottom() = basegfx::fround(aUnrotatedRange.getMaxY());
+            }
+
             // spid
             SwWW8Writer::WriteLong(*rWrt.pTableStrm, aIter->mnShapeId);
 

Modified: openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx?rev=1535773&r1=1535772&r2=1535773&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx 
(original)
+++ openoffice/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx Fri Oct 
25 16:25:48 2013
@@ -1236,8 +1236,8 @@ void SdXMLEllipseShapeContext::StartElem
 
         if(!basegfx::fTools::equalZero(mfCX)
             || !basegfx::fTools::equalZero(mfCY)
-            || !basegfx::fTools::equalZero(mfRX)
-            || !basegfx::fTools::equalZero(mfRY))
+            || !basegfx::fTools::equal(mfRX, 1.0)
+            || !basegfx::fTools::equal(mfRY, 1.0))
         {
             // #121972# center/radius is used, put to pos and size
             maObjectSize.setX(2.0 * mfRX);


Reply via email to