summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2009-01-29 15:12:23 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2009-01-29 15:12:23 +0000
commita7b0e29f388a7012b9e5b24b884837f12802dcf1 (patch)
tree21e7da105497599961cb05feb770efcbaae7d36c /svx/source
parentee8b216a2c5285fe8cf00a0b143fe47fabcdd9da (diff)
CWS-TOOLING: integrate CWS aw062_OOO310
2009-01-27 15:15:53 +0100 aw r266999 : #i97982# corrected small error in ObjectContactOfPageView::isOutputToPDFFile() 2009-01-15 16:02:22 +0100 aw r266378 : #i89872# corrected SdrModel::ImpSetUIUnit to not lose numeric information 2009-01-14 15:16:43 +0100 aw r266309 : #i98072# adde d text suppression for FontworkGallery AutoShapes in ViewContactOfSdrObjCustomShape::createViewIndependentPrimitive2DSequence 2009-01-14 12:35:32 +0100 aw r266283 : #i97878# added TRGetBaseGeometry/TRSetBaseGeometry implementations to SdrMeasureObj 2009-01-14 12:06:47 +0100 aw r266274 : #i97981# corrected the interpretation of bBehaveCompatibleToPaintVersion for line attribute in SdrOle2Primitive2D::createLocalDecomposition 2009-01-14 11:54:07 +0100 aw r266272 : #i97982# added #i97772# to have a correct ChartPrettyPainter output for ChartPrettyPainter 2009-01-14 11:53:13 +0100 aw r266271 : #i97982# added support for ChartPrettyPainter for PDF export 2009-01-13 16:19:19 +0100 aw r266234 : #i96708# adapted RenderBitmapPrimitive2D_self to work with metafile recording and PDF exporting
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/sdr/contact/objectcontact.cxx6
-rw-r--r--svx/source/sdr/contact/objectcontactofpageview.cxx6
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx7
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpage.cxx55
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofpageobj.cxx2
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx10
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx8
-rw-r--r--svx/source/sdr/primitive2d/sdrole2primitive2d.cxx47
-rw-r--r--svx/source/svdraw/svdmodel.cxx116
-rw-r--r--svx/source/svdraw/svdomeas.cxx130
10 files changed, 286 insertions, 101 deletions
diff --git a/svx/source/sdr/contact/objectcontact.cxx b/svx/source/sdr/contact/objectcontact.cxx
index 53dce5ee6a..435c08fba5 100644
--- a/svx/source/sdr/contact/objectcontact.cxx
+++ b/svx/source/sdr/contact/objectcontact.cxx
@@ -262,6 +262,12 @@ namespace sdr
return false;
}
+ // pdf export? Default is false
+ bool ObjectContact::isOutputToPDFFile() const
+ {
+ return false;
+ }
+
// gray display mode
bool ObjectContact::isDrawModeGray() const
{
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index 7434485bb8..fa42ffc532 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -403,6 +403,12 @@ namespace sdr
return (pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause());
}
+ // pdf export?
+ bool ObjectContactOfPageView::isOutputToPDFFile() const
+ {
+ return (0 != mrPageWindow.GetPaintWindow().GetOutputDevice().GetPDFWriter());
+ }
+
// gray display mode
bool ObjectContactOfPageView::isDrawModeGray() const
{
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 136971a353..caff1960d3 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -61,7 +61,12 @@ namespace sdr
if(pSdrText)
{
- drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute(rItemSet, *pSdrText);
+ // #i98072# Get shandow and text; eventually suppress the text if it's
+ // a TextPath FontworkGallery object
+ drawinglayer::attribute::SdrShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrShadowTextAttribute(
+ rItemSet,
+ *pSdrText,
+ GetCustomShapeObj().IsTextPath());
drawinglayer::primitive2d::Primitive2DSequence xGroup;
bool bHasText(pAttribute && pAttribute->getText());
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
index a8d767968a..c150681efb 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -197,36 +197,45 @@ namespace sdr
if(rPage.IsMasterPage())
{
- OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)");
-
- if(rPage.GetObjCount())
+ if(0 == rPage.GetPageNum())
+ {
+ // #i98063#
+ // filter MasterPage 0 since it's the HandoutPage. Thus, it's a
+ // MasterPage, but has no MPBGO, so there is nothing to do here.
+ }
+ else
{
- SdrObject* pObject = rPage.GetObj(0);
- OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)");
+ OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)");
- if(pObject && pObject->IsMasterPageBackgroundObject())
+ if(rPage.GetObjCount())
{
- // build primitive from pObject's attributes
- const SfxItemSet& rFillProperties = pObject->GetMergedItemSet();
- drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties);
+ SdrObject* pObject = rPage.GetObj(0);
+ OSL_ENSURE(pObject && pObject->IsMasterPageBackgroundObject(), "MasterPage with wrong MPBGO detected (!)");
- if(pFill)
+ if(pObject && pObject->IsMasterPageBackgroundObject())
{
- if(pFill->isVisible())
+ // build primitive from pObject's attributes
+ const SfxItemSet& rFillProperties = pObject->GetMergedItemSet();
+ drawinglayer::attribute::SdrFillAttribute* pFill = drawinglayer::primitive2d::createNewSdrFillAttribute(rFillProperties);
+
+ if(pFill)
{
- // direct model data is the page size, get and use it
- const basegfx::B2DRange aInnerRange(
- rPage.GetLftBorder(), rPage.GetUppBorder(),
- rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
- const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
- const basegfx::B2DHomMatrix aEmptyTransform;
- const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
- basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill));
-
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ if(pFill->isVisible())
+ {
+ // direct model data is the page size, get and use it
+ const basegfx::B2DRange aInnerRange(
+ rPage.GetLftBorder(), rPage.GetUppBorder(),
+ rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
+ const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
+ const basegfx::B2DHomMatrix aEmptyTransform;
+ const drawinglayer::primitive2d::Primitive2DReference xReference(drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aInnerPolgon), aEmptyTransform, *pFill));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+ delete pFill;
}
-
- delete pFill;
}
}
}
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index 6f904d8910..d4b0c692c1 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -85,6 +85,7 @@ namespace sdr
virtual bool isOutputToWindow() const;
virtual bool isOutputToVirtualDevice() const;
virtual bool isOutputToRecordingMetaFile() const;
+ virtual bool isOutputToPDFFile() const;
virtual bool isDrawModeGray() const;
virtual bool isDrawModeBlackWhite() const;
virtual bool isDrawModeHighContrast() const;
@@ -189,6 +190,7 @@ namespace sdr
bool PagePrimitiveExtractor::isOutputToWindow() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToWindow(); }
bool PagePrimitiveExtractor::isOutputToVirtualDevice() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToVirtualDevice(); }
bool PagePrimitiveExtractor::isOutputToRecordingMetaFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToRecordingMetaFile(); }
+ bool PagePrimitiveExtractor::isOutputToPDFFile() const { return mrViewObjectContactOfPageObj.GetObjectContact().isOutputToPDFFile(); }
bool PagePrimitiveExtractor::isDrawModeGray() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeGray(); }
bool PagePrimitiveExtractor::isDrawModeBlackWhite() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeBlackWhite(); }
bool PagePrimitiveExtractor::isDrawModeHighContrast() const { return mrViewObjectContactOfPageObj.GetObjectContact().isDrawModeHighContrast(); }
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index 9c273d3803..b11bc993f3 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -130,7 +130,15 @@ namespace sdr
// the original ChartPrettyPainter does not do it for VDEV
if(!bPrettyPrintingForBitmaps && bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice())
{
- bDoChartPrettyPrinting = false;
+ if(GetObjectContact().isOutputToPDFFile())
+ {
+ // #i97982#
+ // For PDF files, allow PrettyPrinting
+ }
+ else
+ {
+ bDoChartPrettyPrinting = false;
+ }
}
// the chart model is needed. Check if it's available
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index e4081bf8b2..56e4550b3e 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -602,14 +602,18 @@ namespace drawinglayer
return pRetval;
}
- attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText)
+ attribute::SdrShadowTextAttribute* createNewSdrShadowTextAttribute(const SfxItemSet& rSet, const SdrText& rText, bool bSuppressText)
{
attribute::SdrShadowTextAttribute* pRetval(0L);
attribute::SdrShadowAttribute* pShadow(0L);
attribute::SdrTextAttribute* pText(0L);
+ // #i98072# added option to suppress text
// look for text first
- pText = createNewSdrTextAttribute(rSet, rText);
+ if(!bSuppressText)
+ {
+ pText = createNewSdrTextAttribute(rSet, rText);
+ }
// try shadow
pShadow = createNewSdrShadowAttribute(rSet);
diff --git a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
index 0116e83788..cd2b7b7789 100644
--- a/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrole2primitive2d.cxx
@@ -66,32 +66,31 @@ namespace drawinglayer
}
// add line
- if(getSdrLFSTAttribute().getLine())
+ // #i97981# condition was inverse to purpose. When being compatible to paint version,
+ // border needs to be suppressed
+ if(!bBehaveCompatibleToPaintVersion && getSdrLFSTAttribute().getLine())
{
- if(bBehaveCompatibleToPaintVersion)
+ // if line width is given, polygon needs to be grown by half of it to make the
+ // outline to be outside of the bitmap
+ if(0.0 != getSdrLFSTAttribute().getLine()->getWidth())
{
- // if line width is given, polygon needs to be grown by half of it to make the
- // outline to be outside of the bitmap
- if(0.0 != getSdrLFSTAttribute().getLine()->getWidth())
- {
- // decompose to get scale
- basegfx::B2DVector aScale, aTranslate;
- double fRotate, fShearX;
- getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
-
- // create expanded range (add relative half line width to unit rectangle)
- double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5);
- double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
- double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
- const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY);
- basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange));
-
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
- }
- else
- {
- appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
- }
+ // decompose to get scale
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // create expanded range (add relative half line width to unit rectangle)
+ double fHalfLineWidth(getSdrLFSTAttribute().getLine()->getWidth() * 0.5);
+ double fScaleX(0.0 != aScale.getX() ? fHalfLineWidth / fabs(aScale.getX()) : 1.0);
+ double fScaleY(0.0 != aScale.getY() ? fHalfLineWidth / fabs(aScale.getY()) : 1.0);
+ const basegfx::B2DRange aExpandedRange(-fScaleX, -fScaleY, 1.0 + fScaleX, 1.0 + fScaleY);
+ basegfx::B2DPolygon aExpandedUnitOutline(basegfx::tools::createPolygonFromRect(aExpandedRange));
+
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aExpandedUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
+ }
+ else
+ {
+ appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, createPolygonLinePrimitive(aUnitOutline, getTransform(), *getSdrLFSTAttribute().getLine()));
}
}
else
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 3eda2b3150..601ae1cf26 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -976,17 +976,19 @@ void SdrModel::SetDefaultTabulator(USHORT nVal)
void SdrModel::ImpSetUIUnit()
{
- if (aUIScale.GetNumerator()==0 || aUIScale.GetDenominator()==0) aUIScale=Fraction(1,1);
- FASTBOOL bMapInch=IsInch(eObjUnit);
- FASTBOOL bMapMetr=IsMetric(eObjUnit);
- FASTBOOL bUIInch=IsInch(eUIUnit);
- FASTBOOL bUIMetr=IsMetric(eUIUnit);
- nUIUnitKomma=0;
- long nMul=1;
- long nDiv=1;
+ if(0 == aUIScale.GetNumerator() || 0 == aUIScale.GetDenominator())
+ {
+ aUIScale = Fraction(1,1);
+ }
+
+ // set start values
+ nUIUnitKomma = 0;
+ sal_Int64 nMul(1);
+ sal_Int64 nDiv(1);
- // Zunaechst normalisieren auf m bzw. "
- switch (eObjUnit) {
+ // normalize on meters resp. inch
+ switch (eObjUnit)
+ {
case MAP_100TH_MM : nUIUnitKomma+=5; break;
case MAP_10TH_MM : nUIUnitKomma+=4; break;
case MAP_MM : nUIUnitKomma+=3; break;
@@ -1010,7 +1012,8 @@ void SdrModel::ImpSetUIUnit()
// 1 pole = 5 1/2 yd = 198" = 5.029,2mm
// 1 yd = 3 ft = 36" = 914,4mm
// 1 ft = 12 " = 1" = 304,8mm
- switch (eUIUnit) {
+ switch (eUIUnit)
+ {
case FUNIT_NONE : break;
// Metrisch
case FUNIT_100TH_MM: nUIUnitKomma-=5; break;
@@ -1030,48 +1033,61 @@ void SdrModel::ImpSetUIUnit()
case FUNIT_PERCENT: nUIUnitKomma+=2; break;
} // switch
- if (bMapInch && bUIMetr) {
- nUIUnitKomma+=4;
- nMul*=254;
- }
- if (bMapMetr && bUIInch) {
- nUIUnitKomma-=4;
- nDiv*=254;
- }
-
- // Temporaere Fraction zum Kuerzen
- Fraction aTempFract(nMul,nDiv);
- nMul=aTempFract.GetNumerator();
- nDiv=aTempFract.GetDenominator();
- // Nun mit dem eingestellten Masstab verknuepfen
- BigInt nBigMul(nMul);
- BigInt nBigDiv(nDiv);
- BigInt nBig1000(1000);
- nBigMul*=aUIScale.GetDenominator();
- nBigDiv*=aUIScale.GetNumerator();
- while (nBigMul>nBig1000) {
+ // check if mapping is from metric to inch and adapt
+ const bool bMapInch(IsInch(eObjUnit));
+ const bool bUIMetr(IsMetric(eUIUnit));
+
+ if (bMapInch && bUIMetr)
+ {
+ nUIUnitKomma += 4;
+ nMul *= 254;
+ }
+
+ // check if mapping is from inch to metric and adapt
+ const bool bMapMetr(IsMetric(eObjUnit));
+ const bool bUIInch(IsInch(eUIUnit));
+
+ if (bMapMetr && bUIInch)
+ {
+ nUIUnitKomma -= 4;
+ nDiv *= 254;
+ }
+
+ // use temporary fraction for reduction (fallback to 32bit here),
+ // may need to be changed in the future, too
+ if(1 != nMul || 1 != nDiv)
+ {
+ const Fraction aTemp(static_cast< long >(nMul), static_cast< long >(nDiv));
+ nMul = aTemp.GetNumerator();
+ nDiv = aTemp.GetDenominator();
+ }
+
+ // #i89872# take Unit of Measurement into account
+ if(1 != aUIScale.GetDenominator() || 1 != aUIScale.GetNumerator())
+ {
+ // divide by UIScale
+ nMul *= aUIScale.GetDenominator();
+ nDiv *= aUIScale.GetNumerator();
+ }
+
+ // shorten trailing zeroes for dividend
+ while(0 == (nMul % 10))
+ {
nUIUnitKomma--;
- nBigMul/=10;
+ nMul /= 10;
}
- while (nBigDiv>nBig1000) {
+
+ // shorten trailing zeroes for divisor
+ while(0 == (nDiv % 10))
+ {
nUIUnitKomma++;
- nBigDiv/=10;
- }
- nMul=long(nBigMul);
- nDiv=long(nBigDiv);
- switch ((short)nMul) {
- case 10: nMul=1; nUIUnitKomma--; break;
- case 100: nMul=1; nUIUnitKomma-=2; break;
- case 1000: nMul=1; nUIUnitKomma-=3; break;
- } // switch
- switch ((short)nDiv) {
- case 10: nDiv=1; nUIUnitKomma++; break;
- case 100: nDiv=1; nUIUnitKomma+=2; break;
- case 1000: nDiv=1; nUIUnitKomma+=3; break;
- } // switch
- aUIUnitFact=Fraction(nMul,nDiv);
- bUIOnlyKomma=nMul==nDiv;
- TakeUnitStr(eUIUnit,aUIUnitStr);
+ nDiv /= 10;
+ }
+
+ // end preparations, set member values
+ aUIUnitFact = Fraction(sal_Int32(nMul), sal_Int32(nDiv));
+ bUIOnlyKomma = (nMul == nDiv);
+ TakeUnitStr(eUIUnit, aUIUnitStr);
}
void SdrModel::SetScaleUnit(MapUnit eMap, const Fraction& rFrac)
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index 580020d54b..51ada515a3 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -71,6 +71,7 @@
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1441,4 +1442,133 @@ USHORT SdrMeasureObj::GetOutlinerViewAnchorMode() const
return (USHORT)eRet;
}
+//////////////////////////////////////////////////////////////////////////////
+// #i97878#
+// TRGetBaseGeometry/TRSetBaseGeometry needs to be based on two positions,
+// same as line geometry in SdrPathObj. Thus needs to be overloaded and
+// implemented since currently it is derived from SdrTextObj which uses
+// a functionality based on SnapRect which is not useful here
+
+inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
+inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+
+sal_Bool SdrMeasureObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
+{
+ // handle the same as a simple line since the definition is based on two points
+ const basegfx::B2DRange aRange(aPt1.X(), aPt1.Y(), aPt2.X(), aPt2.Y());
+ basegfx::B2DTuple aScale(aRange.getRange());
+ basegfx::B2DTuple aTranslate(aRange.getMinimum());
+
+ // position maybe relative to anchorpos, convert
+ if( pModel->IsWriter() )
+ {
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ aTranslate -= basegfx::B2DTuple(GetAnchorPos().X(), GetAnchorPos().Y());
+ }
+ }
+
+ // force MapUnit to 100th mm
+ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // postion
+ aTranslate.setX(ImplTwipsToMM(aTranslate.getX()));
+ aTranslate.setY(ImplTwipsToMM(aTranslate.getY()));
+
+ // size
+ aScale.setX(ImplTwipsToMM(aScale.getX()));
+ aScale.setY(ImplTwipsToMM(aScale.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRGetBaseGeometry: Missing unit translation to 100th mm!");
+ }
+ }
+ }
+
+ // build return value matrix
+ rMatrix.identity();
+
+ if(!basegfx::fTools::equal(aScale.getX(), 1.0) || !basegfx::fTools::equal(aScale.getY(), 1.0))
+ {
+ rMatrix.scale(aScale.getX(), aScale.getY());
+ }
+
+ if(!aTranslate.equalZero())
+ {
+ rMatrix.translate(aTranslate.getX(), aTranslate.getY());
+ }
+
+ return sal_True;
+}
+
+void SdrMeasureObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/)
+{
+ // use given transformation to derive the two defining points from unit line
+ basegfx::B2DPoint aPosA(rMatrix * basegfx::B2DPoint(0.0, 0.0));
+ basegfx::B2DPoint aPosB(rMatrix * basegfx::B2DPoint(1.0, 0.0));
+
+ // force metric to pool metric
+ SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0);
+ if(eMapUnit != SFX_MAPUNIT_100TH_MM)
+ {
+ switch(eMapUnit)
+ {
+ case SFX_MAPUNIT_TWIP :
+ {
+ // position
+ aPosA.setX(ImplMMToTwips(aPosA.getX()));
+ aPosA.setY(ImplMMToTwips(aPosA.getY()));
+ aPosB.setX(ImplMMToTwips(aPosB.getX()));
+ aPosB.setY(ImplMMToTwips(aPosB.getY()));
+
+ break;
+ }
+ default:
+ {
+ DBG_ERROR("TRSetBaseGeometry: Missing unit translation to PoolMetric!");
+ }
+ }
+ }
+
+ if( pModel->IsWriter() )
+ {
+ // if anchor is used, make position relative to it
+ if(GetAnchorPos().X() || GetAnchorPos().Y())
+ {
+ const basegfx::B2DVector aAnchorOffset(GetAnchorPos().X(), GetAnchorPos().Y());
+
+ aPosA += aAnchorOffset;
+ aPosB += aAnchorOffset;
+ }
+ }
+
+ // derive new model data
+ const Point aNewPt1(basegfx::fround(aPosA.getX()), basegfx::fround(aPosA.getY()));
+ const Point aNewPt2(basegfx::fround(aPosB.getX()), basegfx::fround(aPosB.getY()));
+
+ if(aNewPt1 != aPt1 || aNewPt2 != aPt2)
+ {
+ // set model values and broadcast
+ Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
+
+ aPt1 = aNewPt1;
+ aPt2 = aNewPt2;
+
+ SetTextDirty();
+ ActionChanged();
+ SetChanged();
+ BroadcastObjectChange();
+ SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
// eof