summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2013-10-25 15:25:48 +0000
committerArmin Le Grand <alg@apache.org>2013-10-25 15:25:48 +0000
commit6b40671cdcb58fcf8f0c7af4b49cb94a7b53cd97 (patch)
tree95dc1c0c0e04374553e6ec1b0aa04d2875862ea5
parenteeef513fcae5d1986ca8b710058f8ce93a3f7b57 (diff)
in-between commit with changes to MS binary format stuff, Calc overlay, circle type cleanup, rotated obejct export for word
-rw-r--r--filter/source/msfilter/eschesdo.cxx28
-rw-r--r--filter/source/msfilter/eschesdo.hxx10
-rw-r--r--sc/source/ui/view/tabview5.cxx24
-rw-r--r--svx/inc/svx/svdocirc.hxx8
-rw-r--r--svx/source/sdr/overlay/overlaymanager.cxx10
-rw-r--r--svx/source/unodraw/unoshape.cxx8
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx84
-rw-r--r--xmloff/source/draw/ximpshap.cxx4
8 files changed, 152 insertions, 24 deletions
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index 07cc76bd603c..44eff1e5b019 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -166,7 +166,6 @@ void ImplEESdrWriter::ImplHandleRotation( ImplEESdrObject& rObj, EscherPropertyC
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( ImplEESdrObject& rObj, EscherPropertyC
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( ImplEESdrObject& rObj, EscherPropertyC
F_PI2));
aObjectRange.transform(aMirrorDiagonal);
- bChanged = true;
}
rObj.setObjectRange(aObjectRange);
@@ -1551,4 +1548,29 @@ bool ImplEESdrObject::ImplHasText() const
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
diff --git a/filter/source/msfilter/eschesdo.hxx b/filter/source/msfilter/eschesdo.hxx
index 5ddc2e567f8f..6ac1af9ea717 100644
--- a/filter/source/msfilter/eschesdo.hxx
+++ b/filter/source/msfilter/eschesdo.hxx
@@ -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();
};
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index bdae1555457b..8ca42dd5ff60 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -171,35 +171,51 @@ __EXPORT ScTabView::~ScTabView()
DELETEZ(pInputHintWindow);
- if (pDrawView)
+ if(pDrawView)
{
- for (i=0; i<4; i++)
- if (pGridWin[i])
+ for(i=0; i<4; i++)
+ {
+ if(pGridWin[i])
{
pDrawView->VCRemoveWin(pGridWin[i]);
pDrawView->DeleteWindowFromPaintView(pGridWin[i]);
}
+ }
+
+ delete pDrawView;
+ pDrawView = 0;
}
delete pSelEngine;
+ pSelEngine = 0;
for (i=0; i<4; i++)
+ {
delete pGridWin[i];
+ pGridWin[i] = 0;
+ }
delete pHdrSelEng;
+ pHdrSelEng = 0;
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 pHSplitter;
+ pHSplitter = 0;
delete pVSplitter;
-
+ pVSplitter = 0;
delete pTabControl;
+ pTabControl = 0;
}
void ScTabView::MakeDrawView( sal_uInt8 nForceDesignMode )
diff --git a/svx/inc/svx/svdocirc.hxx b/svx/inc/svx/svdocirc.hxx
index 681a1eba80e1..3104ae7cb48c 100644
--- a/svx/inc/svx/svdocirc.hxx
+++ b/svx/inc/svx/svdocirc.hxx
@@ -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
};
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx
index 3bc6632977be..abdea4594ad4 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -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);
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 09b29afd37b3..9fbd9d12b1aa 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -3286,16 +3286,16 @@ bool SvxShape::getPropertyValueImpl( const ::rtl::OUString&, const SfxItemProper
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( const ::rtl::OUString&, const SfxItemProper
eKind = drawing::CircleKind_ARC;
break;
}
- case CircleType_Segment:
+ case CircleType_Sector:
{
eKind = drawing::CircleKind_SECTION;
break;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 63fa2da132b3..4355fcdc7148 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -715,6 +715,8 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
// <--
Point aObjPos;
+ double fObjectRotation(0);
+
if (RES_FLYFRMFMT == rFmt.Which())
{
SwRect aLayRect(rFmt.FindLayoutRect(false, &aObjPos));
@@ -740,7 +742,36 @@ void PlcDrawObj::WritePlc( WW8Export& rWrt ) const
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& rWrt ) const
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);
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 09b73db45f61..30b45bf702ac 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -1236,8 +1236,8 @@ void SdXMLEllipseShapeContext::StartElement(const uno::Reference< xml::sax::XAtt
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);