diff options
author | obo <obo@openoffice.org> | 2010-06-14 15:48:08 +0200 |
---|---|---|
committer | obo <obo@openoffice.org> | 2010-06-14 15:48:08 +0200 |
commit | 17ae4c5cc34ac5c0543a4c56ecabcf5ac86f3422 (patch) | |
tree | 2d474a74a580d3406e93bfb6b5533843adb371e1 /svx | |
parent | d90357ca774dd72600c7498045d714375bb670ad (diff) | |
parent | b9eab08ec09621055a7366ef938b2c68cf2d0a97 (diff) |
CWS-TOOLING: integrate CWS aw081
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/svx/sdrmasterpagedescriptor.hxx | 2 | ||||
-rw-r--r-- | svx/inc/svx/svdpage.hxx | 1 | ||||
-rw-r--r-- | svx/source/engine3d/scene3d.cxx | 14 | ||||
-rw-r--r-- | svx/source/engine3d/view3d.cxx | 170 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx | 27 | ||||
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrpage.cxx | 16 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/sdrmasterpagedescriptor.cxx | 12 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdocirc.cxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdoedge.cxx | 41 | ||||
-rw-r--r-- | svx/source/svdraw/svdotextpathdecomposition.cxx | 104 | ||||
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 45 |
13 files changed, 248 insertions, 203 deletions
diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx index 8325d2a57fa1..612f2ab927ec 100644 --- a/svx/inc/svx/sdrmasterpagedescriptor.hxx +++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx @@ -89,8 +89,6 @@ namespace sdr // operators sal_Bool operator==(const MasterPageDescriptor& rCandidate) const; sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const; - - const SfxItemSet& getCorrectFillAttributes() const; }; } // end of namespace sdr diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx index 29cf17ec9180..c601fddef181 100644 --- a/svx/inc/svx/svdpage.hxx +++ b/svx/inc/svx/svdpage.hxx @@ -376,7 +376,6 @@ private: public: // construct/destruct SdrPageProperties(SdrPage& rSdrPage); - SdrPageProperties(const SdrPageProperties& rCandidate); virtual ~SdrPageProperties(); // Notify(...) from baseclass SfxListener diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index d799aec38eb7..036f700e6e96 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -336,8 +336,18 @@ UINT16 E3dScene::GetObjIdentifier() const void E3dScene::SetBoundRectDirty() { - // avoid resetting aOutRect which in case of this object is model data, - // not re-creatable view data + E3dScene* pScene = GetScene(); + + if(pScene == this) + { + // avoid resetting aOutRect which in case of a 3D scene used as 2d object + // is model data,not re-creatable view data + } + else + { + // if not the outmost scene it is used as group in 3d, call parent + E3dObject::SetBoundRectDirty(); + } } /************************************************************************* diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 97fee2250658..047faef2cb41 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -75,6 +75,7 @@ #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <basegfx/polygon/b2dpolypolygoncutter.hxx> #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() @@ -1066,77 +1067,39 @@ void E3dView::ConvertMarkedObjTo3D(BOOL bExtrude, basegfx::B2DPoint aPnt1, baseg struct E3dDepthNeighbour { - E3dDepthNeighbour* pNext; - E3dExtrudeObj* pObj; - - E3dDepthNeighbour() { pNext = NULL; pObj = NULL; } + E3dDepthNeighbour* mpNext; + E3dExtrudeObj* mpObj; + basegfx::B2DPolyPolygon maPreparedPolyPolygon; + + E3dDepthNeighbour() + : mpNext(0), + mpObj(0), + maPreparedPolyPolygon() + { + } }; struct E3dDepthLayer { - E3dDepthLayer* pDown; - E3dDepthNeighbour* pNext; - - E3dDepthLayer() { pDown = NULL; pNext = NULL; } - ~E3dDepthLayer() { while(pNext) { E3dDepthNeighbour* pSucc = pNext->pNext; delete pNext; pNext = pSucc; }} -}; - -bool ImpDoesOverlap(const basegfx::B2DPolygon& rPolygonA, const basegfx::B2DPolygon& rPolygonB) -{ - bool bRetval(false); - const basegfx::B2DRange aRangeA(basegfx::tools::getRange(rPolygonA)); - const basegfx::B2DRange aRangeB(basegfx::tools::getRange(rPolygonB)); + E3dDepthLayer* mpDown; + E3dDepthNeighbour* mpNext; - if(aRangeA.overlaps(aRangeB)) + E3dDepthLayer() + : mpDown(0), + mpNext(0) { - // A in B ? - if(basegfx::tools::isInside(rPolygonA, rPolygonB)) - return true; - - // B in A ? - if(basegfx::tools::isInside(rPolygonB, rPolygonA)) - return true; - - // A and B the same ? - if(basegfx::tools::isInside(rPolygonB, rPolygonA, true)) - return true; } - return bRetval; -} - -bool ImpDoesOverlap(const basegfx::B2DPolyPolygon& rPolyPolygonA, const basegfx::B2DPolyPolygon& rPolyPolygonB) -{ - bool bRetval(false); - const basegfx::B2DRange aRangeA(basegfx::tools::getRange(rPolyPolygonA)); - const basegfx::B2DRange aRangeB(basegfx::tools::getRange(rPolyPolygonB)); - - if(aRangeA.overlaps(aRangeB)) + ~E3dDepthLayer() { - const sal_uInt32 nCntA(rPolyPolygonA.count()); - const sal_uInt32 nCntB(rPolyPolygonB.count()); - - for(sal_uInt32 a(0L); !bRetval && a < nCntA; a++) + while(mpNext) { - const basegfx::B2DPolygon aPolygonA(rPolyPolygonA.getB2DPolygon(a)); - - if(aPolygonA.isClosed()) - { - for(sal_uInt32 b(0L); !bRetval && b < nCntB; b++) - { - const basegfx::B2DPolygon aPolygonB(rPolyPolygonB.getB2DPolygon(b)); - - if(aPolygonB.isClosed()) - { - bRetval = ImpDoesOverlap(aPolygonA, aPolygonB); - } - } - } + E3dDepthNeighbour* pSucc = mpNext->mpNext; + delete mpNext; + mpNext = pSucc; } } - - return bRetval; -} +}; void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) { @@ -1147,39 +1110,41 @@ void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) E3dDepthLayer* pBaseLayer = NULL; E3dDepthLayer* pLayer = NULL; INT32 nNumLayers = 0; - //SfxItemPool& rPool = pMod->GetItemPool(); while(aIter.IsMore()) { - E3dObject* pSubObj = (E3dObject*)aIter.Next(); + E3dExtrudeObj* pExtrudeObj = dynamic_cast< E3dExtrudeObj* >(aIter.Next()); - if(pSubObj && pSubObj->ISA(E3dExtrudeObj)) + if(pExtrudeObj) { - E3dExtrudeObj* pExtrudeObj = (E3dExtrudeObj*)pSubObj; - const basegfx::B2DPolyPolygon aExtrudePoly(pExtrudeObj->GetExtrudePolygon()); - + const basegfx::B2DPolyPolygon aExtrudePoly( + basegfx::tools::prepareForPolygonOperation(pExtrudeObj->GetExtrudePolygon())); const SfxItemSet& rLocalSet = pExtrudeObj->GetMergedItemSet(); - XFillStyle eLocalFillStyle = ITEMVALUE(rLocalSet, XATTR_FILLSTYLE, XFillStyleItem); - Color aLocalColor = ((const XFillColorItem&)(rLocalSet.Get(XATTR_FILLCOLOR))).GetColorValue(); + const XFillStyle eLocalFillStyle = ITEMVALUE(rLocalSet, XATTR_FILLSTYLE, XFillStyleItem); + const Color aLocalColor = ((const XFillColorItem&)(rLocalSet.Get(XATTR_FILLCOLOR))).GetColorValue(); - // ExtrudeObj einordnen + // sort in ExtrudeObj if(pLayer) { - // Gibt es eine Ueberschneidung mit einem Objekt dieses - // Layers? - BOOL bOverlap(FALSE); - E3dDepthNeighbour* pAct = pLayer->pNext; + // do we have overlap with an object of this layer? + bool bOverlap(false); + E3dDepthNeighbour* pAct = pLayer->mpNext; while(!bOverlap && pAct) { - // ueberlappen sich pAct->pObj und pExtrudeObj ? - const basegfx::B2DPolyPolygon aActPoly(pAct->pObj->GetExtrudePolygon()); - bOverlap = ImpDoesOverlap(aExtrudePoly, aActPoly); + // do pAct->mpObj and pExtrudeObj overlap? Check by + // using logical AND clipping + const basegfx::B2DPolyPolygon aAndPolyPolygon( + basegfx::tools::solvePolygonOperationAnd( + aExtrudePoly, + pAct->maPreparedPolyPolygon)); + + bOverlap = (0 != aAndPolyPolygon.count()); if(bOverlap) { // second ciriteria: is another fillstyle or color used? - const SfxItemSet& rCompareSet = pAct->pObj->GetMergedItemSet(); + const SfxItemSet& rCompareSet = pAct->mpObj->GetMergedItemSet(); XFillStyle eCompareFillStyle = ITEMVALUE(rCompareSet, XATTR_FILLSTYLE, XFillStyleItem); @@ -1201,71 +1166,74 @@ void E3dView::DoDepthArrange(E3dScene* pScene, double fDepth) } } - pAct = pAct->pNext; + pAct = pAct->mpNext; } if(bOverlap) { - // ja, beginne einen neuen Layer - pLayer->pDown = new E3dDepthLayer; - pLayer = pLayer->pDown; + // yes, start a new layer + pLayer->mpDown = new E3dDepthLayer; + pLayer = pLayer->mpDown; nNumLayers++; - pLayer->pNext = new E3dDepthNeighbour; - pLayer->pNext->pObj = pExtrudeObj; + pLayer->mpNext = new E3dDepthNeighbour; + pLayer->mpNext->mpObj = pExtrudeObj; + pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly; } else { - // nein, Objekt kann in aktuellen Layer + // no, add to current layer E3dDepthNeighbour* pNewNext = new E3dDepthNeighbour; - pNewNext->pObj = pExtrudeObj; - pNewNext->pNext = pLayer->pNext; - pLayer->pNext = pNewNext; + pNewNext->mpObj = pExtrudeObj; + pNewNext->maPreparedPolyPolygon = aExtrudePoly; + pNewNext->mpNext = pLayer->mpNext; + pLayer->mpNext = pNewNext; } } else { - // erster Layer ueberhaupt + // first layer ever pBaseLayer = new E3dDepthLayer; pLayer = pBaseLayer; nNumLayers++; - pLayer->pNext = new E3dDepthNeighbour; - pLayer->pNext->pObj = pExtrudeObj; + pLayer->mpNext = new E3dDepthNeighbour; + pLayer->mpNext->mpObj = pExtrudeObj; + pLayer->mpNext->maPreparedPolyPolygon = aExtrudePoly; } } } - // Anzahl Layer steht fest + // number of layers is done if(nNumLayers > 1) { - // Arrangement ist notwendig + // need to be arranged double fMinDepth = fDepth * 0.8; double fStep = (fDepth - fMinDepth) / (double)nNumLayers; pLayer = pBaseLayer; while(pLayer) { - // an pLayer entlangspazieren - E3dDepthNeighbour* pAct = pLayer->pNext; + // move along layer + E3dDepthNeighbour* pAct = pLayer->mpNext; while(pAct) { - // Anpassen - pAct->pObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5))); + // adapt extrude value + pAct->mpObj->SetMergedItem(SfxUInt32Item(SDRATTR_3DOBJ_DEPTH, sal_uInt32(fMinDepth + 0.5))); - // Naechster Eintrag - pAct = pAct->pNext; + // next + pAct = pAct->mpNext; } - // naechster Layer - pLayer = pLayer->pDown; + // next layer + pLayer = pLayer->mpDown; fMinDepth += fStep; } } - // angelegte Strukturen aufraeumen + // cleanup while(pBaseLayer) { - pLayer = pBaseLayer->pDown; + pLayer = pBaseLayer->mpDown; delete pBaseLayer; pBaseLayer = pLayer; } diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx index ba260e79bba9..cbe9c4a9c615 100644 --- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx +++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx @@ -61,11 +61,30 @@ namespace sdr drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const { drawinglayer::primitive2d::Primitive2DSequence xRetval; + drawinglayer::attribute::SdrFillAttribute aFill; + const SdrPage* pCorrectPage = &GetMasterPageDescriptor().GetOwnerPage(); + const SdrPageProperties* pCorrectProperties = &pCorrectPage->getSdrPageProperties(); - // build primitive from page fill attributes - const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes)); + if(XFILL_NONE == ((const XFillStyleItem&)pCorrectProperties->GetItemSet().Get(XATTR_FILLSTYLE)).GetValue()) + { + pCorrectPage = &GetMasterPageDescriptor().GetUsedPage(); + pCorrectProperties = &pCorrectPage->getSdrPageProperties(); + } + + if(pCorrectPage->IsMasterPage() && !pCorrectProperties->GetStyleSheet()) + { + // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets, + // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all + // MasterPages should have a StyleSheet excactly for this reason, but historically + // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). + pCorrectProperties = 0; + } + + if(pCorrectProperties) + { + // create page fill attributes when correct properties were identified + aFill = drawinglayer::primitive2d::createNewSdrFillAttribute(pCorrectProperties->GetItemSet()); + } if(!aFill.isDefault()) { diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index e486f978fafb..b80b6fcbba88 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -203,10 +203,18 @@ namespace sdr } else { - // build primitive from pObject's attributes - const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet(); - const drawinglayer::attribute::SdrFillAttribute aFill( - drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes)); + drawinglayer::attribute::SdrFillAttribute aFill; + + // #i110846# Suppress SdrPage FillStyle for MasterPages without StyleSheets, + // else the PoolDefault (XFILL_COLOR and Blue8) will be used. Normally, all + // MasterPages should have a StyleSheet excactly for this reason, but historically + // e.g. the Notes MasterPage has no StyleSheet set (and there maybe others). + if(rPage.getSdrPageProperties().GetStyleSheet()) + { + // create page fill attributes with correct properties + aFill = drawinglayer::primitive2d::createNewSdrFillAttribute( + rPage.getSdrPageProperties().GetItemSet()); + } if(!aFill.isDefault()) { diff --git a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx index ac9b6307dd05..2ceea2c69b7d 100644 --- a/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx @@ -51,13 +51,11 @@ namespace drawinglayer if(!getSdrLFSTAttribute().getFill().isDefault() && getUnitPolyPolygon().isClosed()) { - // take care for orientations - const basegfx::B2DPolyPolygon aOrientedUnitPolyPolygon( - basegfx::tools::correctOrientations(getUnitPolyPolygon())); - + // #i108255# no need to use correctOrientations here; target is + // straight visualisation appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolyPolygonFillPrimitive( - aOrientedUnitPolyPolygon, + getUnitPolyPolygon(), getTransform(), getSdrLFSTAttribute().getFill(), getSdrLFSTAttribute().getFillFloatTransGradient())); diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx index 6bcdd8f55856..67b2de8b693c 100644 --- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx +++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx @@ -113,18 +113,6 @@ namespace sdr || &maUsedPage != &rCandidate.maUsedPage || maVisibleLayers != rCandidate.maVisibleLayers); } - - const SfxItemSet& MasterPageDescriptor::getCorrectFillAttributes() const - { - const SfxItemSet& rOwnerPageAtributes = GetOwnerPage().getSdrPageProperties().GetItemSet(); - - if(XFILL_NONE != ((const XFillStyleItem&)rOwnerPageAtributes.Get(XATTR_FILLSTYLE)).GetValue()) - { - return rOwnerPageAtributes; - } - - return GetUsedPage().getSdrPageProperties().GetItemSet(); - } } // end of namespace sdr ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index 3b878ce93138..5eae04dbbc87 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -805,6 +805,12 @@ void SdrEditView::DeleteMarkedList(const SdrMarkList& rMark) void SdrEditView::DeleteMarkedObj() { + // #i110981# return when nothing is to be done at all + if(!GetMarkedObjectCount()) + { + return; + } + // moved breaking action and undo start outside loop BrkAction(); BegUndo(ImpGetResStr(STR_EditDelete),GetDescriptionOfMarkedObjects(),SDRREPFUNC_OBJ_DELETE); diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 12cdeac9ef85..4c600cba821f 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -239,8 +239,9 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c else { // mirror start, end for geometry creation since model coordinate system is mirrored in Y - const double fStart(((36000 - nEnd) % 36000) * F_PI18000); - const double fEnd(((36000 - nStart) % 36000) * F_PI18000); + // #i111715# increase numerical correctness by first dividing and not using F_PI1800 + const double fStart((((36000 - nEnd) % 36000) / 18000.0) * F_PI); + const double fEnd((((36000 - nStart) % 36000) / 18000.0) * F_PI); // create circle segment. This is not closed by default aCircPolygon = basegfx::tools::createPolygonFromEllipseSegment( diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index dc76855f05cc..6482c28befb9 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -1674,6 +1674,11 @@ void SdrEdgeObj::SetEdgeTrackPath( const basegfx::B2DPolyPolygon& rPoly ) *pEdgeTrack = XPolygon( rPoly.getB2DPolygon( 0 ) ); bEdgeTrackDirty = sal_False; bEdgeTrackUserDefined = sal_True; + + // #i110629# also set aRect and maSnapeRect dependent from pEdgeTrack + const Rectangle aPolygonBounds(pEdgeTrack->GetBoundRect()); + aRect = aPolygonBounds; + maSnapRect = aPolygonBounds; } } @@ -2206,17 +2211,31 @@ FASTBOOL SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, void SdrEdgeObj::NbcSetSnapRect(const Rectangle& rRect) { - Rectangle aOld(GetSnapRect()); - long nMulX = rRect.Right() - rRect.Left(); - long nDivX = aOld.Right() - aOld.Left(); - long nMulY = rRect.Bottom() - rRect.Top(); - long nDivY = aOld.Bottom() - aOld.Top(); - if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } - if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } - Fraction aX(nMulX, nDivX); - Fraction aY(nMulY, nDivY); - NbcResize(aOld.TopLeft(), aX, aY); - NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); + const Rectangle aOld(GetSnapRect()); + + if(aOld != rRect) + { + if(aRect.IsEmpty() && 0 == pEdgeTrack->GetPointCount()) + { + // #i110629# When initializing, do not scale on empty Rectangle; this + // will mirror the underlying text object (!) + aRect = rRect; + maSnapRect = rRect; + } + else + { + long nMulX = rRect.Right() - rRect.Left(); + long nDivX = aOld.Right() - aOld.Left(); + long nMulY = rRect.Bottom() - rRect.Top(); + long nDivY = aOld.Bottom() - aOld.Top(); + if ( nDivX == 0 ) { nMulX = 1; nDivX = 1; } + if ( nDivY == 0 ) { nMulY = 1; nDivY = 1; } + Fraction aX(nMulX, nDivX); + Fraction aY(nMulY, nDivY); + NbcResize(aOld.TopLeft(), aX, aY); + NbcMove(Size(rRect.Left() - aOld.Left(), rRect.Top() - aOld.Top())); + } + } } void SdrEdgeObj::NbcMove(const Size& rSiz) diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index f6780bd7c90d..031e8e9dd45b 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -107,15 +107,13 @@ namespace maLocale(rInfo.mpLocale ? *rInfo.mpLocale : ::com::sun::star::lang::Locale()), mbRTL(rInfo.mrFont.IsVertical() ? false : rInfo.IsRTL()) { - if(mnTextLength) + if(mnTextLength && rInfo.mpDXArray) { maDblDXArray.reserve(mnTextLength); - const sal_Int32 nFontWidth(0L == maFont.GetWidth() ? maFont.GetHeight() : maFont.GetWidth()); - const double fScaleFactor(0L != nFontWidth ? 1.0 / (double)nFontWidth : 1.0); for(xub_StrLen a(0); a < mnTextLength; a++) { - maDblDXArray.push_back((double)rInfo.mpDXArray[a] * fScaleFactor); + maDblDXArray.push_back((double)rInfo.mpDXArray[a]); } } } @@ -291,7 +289,8 @@ namespace const double fPolyLength(basegfx::tools::getLength(aPolygonCandidate)); double fPolyEnd(fPolyLength); double fPolyStart(0.0); - double fScaleFactor(1.0); + double fAutosizeScaleFactor(1.0); + bool bAutosizeScale(false); if(maSdrFormTextAttribute.getFormTextMirror()) { @@ -352,7 +351,8 @@ namespace // if scale, prepare scale factor between curve length and text length if(0.0 != fParagraphTextLength) { - fScaleFactor = (fPolyEnd - fPolyStart) / fParagraphTextLength; + fAutosizeScaleFactor = (fPolyEnd - fPolyStart) / fParagraphTextLength; + bAutosizeScale = true; } } } @@ -382,10 +382,10 @@ namespace // prepare portion length. Takes RTL sections into account. double fPortionLength(pCandidate->getDisplayLength(nUsedTextLength, nNextGlyphLen)); - if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) + if(bAutosizeScale) { - // when scaling, expand portion length - fPortionLength *= fScaleFactor; + // when autosize scaling, expand portion length + fPortionLength *= fAutosizeScaleFactor; } // create transformation @@ -397,10 +397,10 @@ namespace aNewTransformA.scale(aFontScaling.getX(), aFontScaling.getY()); // prepare scaling of text primitive - if(XFT_AUTOSIZE == maSdrFormTextAttribute.getFormTextAdjust()) + if(bAutosizeScale) { - // when scaling, expand text primitive scaling - aNewTransformA.scale(fScaleFactor, fScaleFactor); + // when autosize scaling, expand text primitive scaling to it + aNewTransformA.scale(fAutosizeScaleFactor, fAutosizeScaleFactor); } // eventually create shadow primitives from aDecomposition and add to rDecomposition @@ -497,17 +497,42 @@ namespace aNewTransformB.translate(aPerpendicular.getX(), aPerpendicular.getY()); } - // shadow primitive creation - if(bShadow) + if(pCandidate->getText().Len() && nNextGlyphLen) { - if(pCandidate->getText().Len() && nNextGlyphLen) + const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); + ::std::vector< double > aNewDXArray; + + if(nNextGlyphLen > 1 && pCandidate->getDoubleDXArray().size()) { + // copy DXArray for portion + aNewDXArray.insert( + aNewDXArray.begin(), + pCandidate->getDoubleDXArray().begin() + nPortionIndex, + pCandidate->getDoubleDXArray().begin() + (nPortionIndex + nNextGlyphLen)); + + if(nPortionIndex > 0) + { + // adapt to portion start + double fDXOffset= *(pCandidate->getDoubleDXArray().begin() + (nPortionIndex - 1)); + ::std::transform( + aNewDXArray.begin(), aNewDXArray.end(), + aNewDXArray.begin(), ::std::bind2nd(::std::minus<double>(), fDXOffset)); + } + + if(bAutosizeScale) + { + // when autosize scaling, adapt to DXArray, too + ::std::transform( + aNewDXArray.begin(), aNewDXArray.end(), + aNewDXArray.begin(), ::std::bind2nd(::std::multiplies<double>(), fAutosizeScaleFactor)); + } + } + + if(bShadow) + { + // shadow primitive creation const Color aShadowColor(maSdrFormTextAttribute.getFormTextShdwColor()); const basegfx::BColor aRGBShadowColor(aShadowColor.getBColor()); - const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); - const ::std::vector< double > aNewDXArray( - pCandidate->getDoubleDXArray().begin() + nPortionIndex, - pCandidate->getDoubleDXArray().begin() + nPortionIndex + nNextGlyphLen); drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( @@ -522,30 +547,25 @@ namespace mrShadowDecomposition.push_back(pNew); } - } - // primitive creation - if(pCandidate->getText().Len() && nNextGlyphLen) - { - const Color aColor(pCandidate->getFont().GetColor()); - const basegfx::BColor aRGBColor(aColor.getBColor()); - const xub_StrLen nPortionIndex(pCandidate->getPortionIndex(nUsedTextLength, nNextGlyphLen)); - const ::std::vector< double > aNewDXArray( - pCandidate->getDoubleDXArray().begin() + nPortionIndex, - pCandidate->getDoubleDXArray().begin() + nPortionIndex + nNextGlyphLen); - - drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = - new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( - aNewTransformB * aNewTransformA, - pCandidate->getText(), - nPortionIndex, - nNextGlyphLen, - aNewDXArray, - aCandidateFontAttribute, - pCandidate->getLocale(), - aRGBColor); - - mrDecomposition.push_back(pNew); + { + // primitive creation + const Color aColor(pCandidate->getFont().GetColor()); + const basegfx::BColor aRGBColor(aColor.getBColor()); + + drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pNew = + new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aNewTransformB * aNewTransformA, + pCandidate->getText(), + nPortionIndex, + nNextGlyphLen, + aNewDXArray, + aCandidateFontAttribute, + pCandidate->getLocale(), + aRGBColor); + + mrDecomposition.push_back(pNew); + } } // consume from portion // no += here, xub_StrLen is USHORT and the compiler will gererate a warning here diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 6dd816d429da..6cc3460875bb 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1221,18 +1221,6 @@ SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) } } -SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) -: SfxListener(), - mpSdrPage(rCandidate.mpSdrPage), - mpStyleSheet(0), - mpProperties(new SfxItemSet(*rCandidate.mpProperties)) -{ - if(rCandidate.GetStyleSheet()) - { - ImpAddStyleSheet(*rCandidate.GetStyleSheet()); - } -} - SdrPageProperties::~SdrPageProperties() { ImpRemoveStyleSheet(); @@ -1365,6 +1353,8 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) // Warning: this leads to slicing (see issue 93186) and has to be // removed as soon as possible. *this = rSrcPage; + OSL_ENSURE(mpSdrPageProperties, + "SdrPage::SdrPage: operator= did not create needed SdrPageProperties (!)"); // be careful and correct eListKind, a member of SdrObjList which // will be changed by the SdrOIbjList::operator= before... @@ -1382,8 +1372,6 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) mxUnoPage = NULL; xComponent->dispose(); } - - mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); } SdrPage::~SdrPage() @@ -1478,8 +1466,21 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; { - delete mpSdrPageProperties; - mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); + if(!mpSdrPageProperties) + { + mpSdrPageProperties = new SdrPageProperties(*this); + } + else + { + mpSdrPageProperties->ClearItem(0); + } + + if(!IsMasterPage()) + { + mpSdrPageProperties->PutItemSet(rSrcPage.getSdrPageProperties().GetItemSet()); + } + + mpSdrPageProperties->SetStyleSheet(rSrcPage.getSdrPageProperties().GetStyleSheet()); } // Now copy the contained obejcts (by cloning them) @@ -1659,7 +1660,17 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); - SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); + // create new SdrPageProperties with new model (due to SfxItemSet there) + // and copy ItemSet and StyleSheet + SdrPageProperties *pNew = new SdrPageProperties(*this); + + if(!IsMasterPage()) + { + pNew->PutItemSet(getSdrPageProperties().GetItemSet()); + } + + pNew->SetStyleSheet(getSdrPageProperties().GetStyleSheet()); + delete mpSdrPageProperties; mpSdrPageProperties = pNew; } |