[ooo-build-commit] Branch 'ooo/master' - goodies/source

Jan Holesovsky kendy at kemper.freedesktop.org
Wed Aug 5 18:24:44 PDT 2009


 goodies/source/filter.vcl/idxf/dxf2mtf.cxx  |  181 ++++++++++++++++++++--------
 goodies/source/filter.vcl/idxf/dxf2mtf.hxx  |   10 -
 goodies/source/filter.vcl/idxf/dxfreprd.cxx |   12 +
 goodies/source/filter.vcl/idxf/dxfreprd.hxx |   10 +
 goodies/source/filter.vcl/idxf/dxfvec.cxx   |   29 ++++
 goodies/source/filter.vcl/idxf/dxfvec.hxx   |   34 +++++
 6 files changed, 217 insertions(+), 59 deletions(-)

New commits:
commit 8df38192672c85d22fceeeaf04b8238500380dc5
Author: Release Engineers <releng at openoffice.org>
Date:   Wed Aug 5 17:01:07 2009 +0000

    CWS-TOOLING: integrate CWS impress172
    2009-07-30 15:29:39 +0200 cl  r274492 : #i102921# remove reference to inssrc.obj which was moved to svx
    2009-07-29 11:40:35 +0200 wg  r274445 : i103869
    2009-07-22 14:39:13 +0200 sj  r274241 : #i102713# fixed cloud shape
    2009-07-07 15:28:04 +0200 sj  r273800 : fixed build problem
    2009-07-07 13:27:13 +0200 cl  r273792 : #i102921# moved insert col/rows dialog to svx
    2009-07-07 10:36:05 +0200 cl  r273782 : fixed compiler warnings
    2009-07-02 10:40:21 +0200 sj  r273626 : fixed build problem
    2009-07-02 10:27:56 +0200 cl  r273624 : fixed merge problem
    2009-07-02 10:27:19 +0200 cl  r273623 : fixed compiler warning
    2009-07-01 10:04:58 +0200 cl  r273550 : CWS-TOOLING: rebase CWS impress172 to trunk at 273468 (milestone: DEV300:m51)
    2009-06-30 16:22:02 +0200 cl  r273518 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 16:20:46 +0200 cl  r273517 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 16:20:28 +0200 cl  r273516 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 16:19:49 +0200 cl  r273515 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 16:19:28 +0200 cl  r273514 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 16:17:38 +0200 cl  r273513 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 15:45:44 +0200 cl  r273511 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 15:37:16 +0200 cl  r273510 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 15:33:47 +0200 cl  r273509 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 15:32:10 +0200 cl  r273508 : #i102921# added insert table row/col dialog for impress tables
    2009-06-30 15:30:05 +0200 cl  r273507 : #i102921# added insert table row/col dialog for impress tables
    2009-06-29 12:32:42 +0200 sj  r273465 : #158632# fixed textrange hyperlinks to specific pages, added slide names
    2009-06-24 15:17:59 +0200 sj  r273349 : #158636# fixed text range hyperlink to first/last slide
    2009-06-22 13:18:30 +0200 sj  r273224 : #158651# fixed header footer import
    2009-06-19 15:18:24 +0200 sj  r273160 : #158614# default text of presentation objects now cleared
    2009-06-16 15:54:19 +0200 sj  r273023 : #i101545# fixed crash - bracketing of graphic links has been done twice leading to a broken graphic state stack
    2009-06-15 16:26:26 +0200 sj  r272998 : #158635# importing bookmark interactions: firstslide, lastslide, nextslide, previousslide
    2009-06-15 16:25:26 +0200 sj  r272997 : #158635# added bookmark interactions: firstslide, lastslide, nextslide, previousslide
    2009-06-12 13:17:32 +0200 sj  r272915 : #i102713# fixed cloud shape
    2009-06-10 18:36:58 +0200 sj  r272833 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
    2009-06-08 19:52:28 +0200 sj  r272746 : #158674# fixed curvedleftarrow, curvedrightarrow, curveddownarrow, curveduparrow
    2009-06-04 15:28:32 +0200 cl  r272640 : #i102358# applied patch to remove warnings
    2009-06-04 14:39:45 +0200 cl  r272630 : #i99423# applied path to change impress wizard create button to open when opening exisitng documents
    2009-06-03 18:21:26 +0200 sj  r272601 : #158635# now using the correct paragraph bottom spacing. using font independent linespacing for impress text objects
    2009-06-03 15:47:27 +0200 cl  r272583 : #i101817# added color collection based on scribus
    2009-06-03 14:43:59 +0200 cl  r272580 : #i102163# use weak ref to SdrObject instead of listening to the model
    2009-06-03 12:39:29 +0200 cl  r272556 : #i93308# correct namespace for com.sun.star.text.textfields
    2009-06-03 12:27:00 +0200 cl  r272555 : #i93308# correct namespace for com.sun.star.text.textfields
    2009-06-03 11:33:44 +0200 cl  r272553 : #i23221# allow all settings (that make sense) for presentation styles
    2009-06-03 11:30:59 +0200 cl  r272552 : #i23221# allow all settings (that make sense) for presentation styles
    2009-06-03 11:30:22 +0200 cl  r272551 : #i23221# allow all settings (that make sense) for presentation styles
    2009-06-02 18:41:07 +0200 sj  r272527 : #i28358# applied patch (better conversion of dotted lines)
    2009-06-02 11:52:13 +0200 cl  r272491 : #i98668# applied patch to fix possible endless loop if exception occours
    2009-05-28 17:02:55 +0200 sj  r272416 : #i102336# retaining graphic file names unchanged
    2009-05-28 17:00:25 +0200 sj  r272415 : #i102336# retaining graphic file names unchanged
    2009-05-28 17:00:10 +0200 sj  r272414 : #i102336# retaining graphic file names unchanged
    2009-05-25 12:43:58 +0200 sj  r272232 : #i102069# added patch from thb (fixed rotated group objects)

diff --git a/goodies/source/filter.vcl/idxf/dxf2mtf.cxx b/goodies/source/filter.vcl/idxf/dxf2mtf.cxx
index 5eb7c1e..720b2b2 100644
--- a/goodies/source/filter.vcl/idxf/dxf2mtf.cxx
+++ b/goodies/source/filter.vcl/idxf/dxf2mtf.cxx
@@ -91,41 +91,93 @@ long DXF2GDIMetaFile::GetEntityColor(const DXFBasicEntity & rE)
     return nColor;
 }
 
-
-PenStyle DXF2GDIMetaFile::LTypeToPStyle(const char * sLineType)
+DXFLineInfo DXF2GDIMetaFile::LTypeToDXFLineInfo(const char * sLineType)
 {
     const DXFLType * pLT;
-    PenStyle ePStyle;
+    DXFLineInfo aDXFLineInfo;
+
     pLT=pDXF->aTables.SearchLType(sLineType);
-    if (pLT==NULL) ePStyle=PEN_SOLID;
-    else if (pLT->nDashCount<=1) ePStyle=PEN_SOLID;
-    else if (pLT->nDashCount==2) {
-        if (fabs(pLT->fDash[0])*4<fabs(pLT->fPatternLength)) ePStyle=PEN_DOT;
-        else ePStyle=PEN_DASH;
-    }
-    else ePStyle=PEN_DASHDOT;
-    return ePStyle;
-}
+    if (pLT==NULL || pLT->nDashCount == 0) {
+        aDXFLineInfo.eStyle = LINE_SOLID;
+    }
+    else {
+        sal_Int32 i;
+        double x;
+        aDXFLineInfo.eStyle = LINE_DASH;
+        for (i=0; i < (pLT->nDashCount); i++) {
+            x = pLT->fDash[i] * pDXF->getGlobalLineTypeScale();
+// ####
+            // x = (sal_Int32) rTransform.TransLineWidth( pLT->fDash[i] * pDXF->getGlobalLineTypeScale() );
+            if ( x >= 0.0 ) {
+                if ( aDXFLineInfo.nDotCount == 0 ) { 
+                    aDXFLineInfo.nDotCount ++;
+                    aDXFLineInfo.fDotLen = x;
+                }
+                else if ( aDXFLineInfo.fDotLen == x ) {
+                    aDXFLineInfo.nDotCount ++;
+                }
+                else if ( aDXFLineInfo.nDashCount == 0 ) {
+                    aDXFLineInfo.nDashCount ++;
+                    aDXFLineInfo.fDashLen = x;
+                }
+                else if ( aDXFLineInfo.fDashLen == x ) {
+                    aDXFLineInfo.nDashCount ++;
+                }
+                else {
+                    // It is impossible to be converted.
+                }
+            }
+            else {
+                if ( aDXFLineInfo.fDistance == 0 ) {
+                    aDXFLineInfo.fDistance = -1 * x;
+                }
+                else {
+                    // It is impossible to be converted.
+                }
+            }
+
+        }
+    }
 
+#if 0
+    if (aDXFLineInfo.DashCount > 0 && aDXFLineInfo.DashLen == 0.0)
+        aDXFLineInfo.DashLen ( 1 );
+    if (aDXFLineInfo.DotCount > 0 && aDXFLineInfo.DotLen() == 0.0)
+        aDXFLineInfo.SetDotLen( 1 );
+    if (aDXFLineInfo.GetDashCount > 0 || aDXFLineInfo.GetDotCount > 0)
+        if (aDXFLineInfo.GetDistance() == 0)
+            aDXFLineInfo.SetDistance( 1 );
+#endif
 
-PenStyle DXF2GDIMetaFile::GetEntityPStyle(const DXFBasicEntity & rE)
+    return aDXFLineInfo;
+}
+
+DXFLineInfo DXF2GDIMetaFile::GetEntityDXFLineInfo(const DXFBasicEntity & rE)
 {
-    PenStyle ePStyle;
+    DXFLineInfo aDXFLineInfo;
     const DXFLayer * pLayer;
 
+    aDXFLineInfo.eStyle = LINE_SOLID;
+    aDXFLineInfo.fWidth = 0;
+    aDXFLineInfo.nDashCount = 0;
+    aDXFLineInfo.fDashLen = 0;
+    aDXFLineInfo.nDotCount = 0;
+    aDXFLineInfo.fDotLen = 0;
+    aDXFLineInfo.fDistance = 0;
+
     if (strcmp(rE.sLineType,"BYLAYER")==0) {
-        if (rE.sLayer[0]=='0' && rE.sLayer[1]==0) ePStyle=eParentLayerPStyle;
+        if (rE.sLayer[0]=='0' && rE.sLayer[1]==0) aDXFLineInfo=aParentLayerDXFLineInfo;
         else {
             pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
-            if (pLayer!=NULL) ePStyle=LTypeToPStyle(pLayer->sLineType);
-            else ePStyle=eParentLayerPStyle;
+            if (pLayer!=NULL) aDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
+            else aDXFLineInfo=aParentLayerDXFLineInfo;
         }
     }
     else if (strcmp(rE.sLineType,"BYBLOCK")==0) {
-        ePStyle=eBlockPStyle;
+        aDXFLineInfo=aBlockDXFLineInfo;
     }
-    else ePStyle=LTypeToPStyle(rE.sLineType);
-    return ePStyle;
+    else aDXFLineInfo=LTypeToDXFLineInfo(rE.sLineType);
+    return aDXFLineInfo;
 }
 
 
@@ -133,12 +185,10 @@ BOOL DXF2GDIMetaFile::SetLineAttribute(const DXFBasicEntity & rE, ULONG /*nWidth
 {
     long nColor;
     Color aColor;
-    PenStyle ePStyle;
 
     nColor=GetEntityColor(rE);
     if (nColor<0) return FALSE;
     aColor=ConvertColor((BYTE)nColor);
-    ePStyle=GetEntityPStyle(rE);
 
     if (aActLineColor!=aColor) {
         pVirDev->SetLineColor( aActLineColor = aColor );
@@ -202,12 +252,30 @@ BOOL DXF2GDIMetaFile::SetFontAttribute(const DXFBasicEntity & rE, short nAngle,
 
 void DXF2GDIMetaFile::DrawLineEntity(const DXFLineEntity & rE, const DXFTransform & rTransform)
 {
-
     if (SetLineAttribute(rE)) {
         Point aP0,aP1;
         rTransform.Transform(rE.aP0,aP0);
         rTransform.Transform(rE.aP1,aP1);
-        pVirDev->DrawLine(aP0,aP1);
+
+        DXFLineInfo aDXFLineInfo;
+        aDXFLineInfo=GetEntityDXFLineInfo(rE);
+        LineInfo aLineInfo;
+        aLineInfo = rTransform.Transform(aDXFLineInfo);
+
+#if 0
+        printf("%f\n", rTransform.TransLineWidth(1000.0));
+
+        // LINE_NONE = 0, LINE_SOLID = 1, LINE_DASH = 2, LineStyle_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
+        aLineInfo.SetStyle( LINE_DASH );
+        aLineInfo.SetWidth( 300 );
+        aLineInfo.SetDashCount( 2 );
+        aLineInfo.SetDashLen( 100 );
+        aLineInfo.SetDotCount( 1 );
+        aLineInfo.SetDotLen( 0 );
+        aLineInfo.SetDistance( 500 );
+#endif
+
+        pVirDev->DrawLine(aP0,aP1,aLineInfo);
         if (rE.fThickness!=0) {
             Point aP2,aP3;
             rTransform.Transform(rE.aP0+DXFVector(0,0,rE.fThickness),aP2);
@@ -426,23 +494,23 @@ void DXF2GDIMetaFile::DrawInsertEntity(const DXFInsertEntity & rE, const DXFTran
             rTransform
         );
         long nSavedBlockColor, nSavedParentLayerColor;
-        PenStyle eSavedBlockPStyle, eSavedParentLayerPStyle;
+        DXFLineInfo aSavedBlockDXFLineInfo, aSavedParentLayerDXFLineInfo;
         nSavedBlockColor=nBlockColor;
         nSavedParentLayerColor=nParentLayerColor;
-        eSavedBlockPStyle=eBlockPStyle;
-        eSavedParentLayerPStyle=eParentLayerPStyle;
+        aSavedBlockDXFLineInfo=aBlockDXFLineInfo;
+        aSavedParentLayerDXFLineInfo=aParentLayerDXFLineInfo;
         nBlockColor=GetEntityColor(rE);
-        eBlockPStyle=GetEntityPStyle(rE);
+        aBlockDXFLineInfo=GetEntityDXFLineInfo(rE);
         if (rE.sLayer[0]!='0' || rE.sLayer[1]!=0) {
             DXFLayer * pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
             if (pLayer!=NULL) {
                 nParentLayerColor=pLayer->nColor;
-                eParentLayerPStyle=LTypeToPStyle(pLayer->sLineType);
+                aParentLayerDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
             }
         }
         DrawEntities(*pB,aT,FALSE);
-        eBlockPStyle=eSavedBlockPStyle;
-        eParentLayerPStyle=eSavedParentLayerPStyle;
+        aBlockDXFLineInfo=aSavedBlockDXFLineInfo;
+        aParentLayerDXFLineInfo=aSavedParentLayerDXFLineInfo;
         nBlockColor=nSavedBlockColor;
         nParentLayerColor=nSavedParentLayerColor;
     }
@@ -540,6 +608,8 @@ void DXF2GDIMetaFile::DrawLWPolyLineEntity(const DXFLWPolyLineEntity & rE, const
                 pVirDev->DrawPolygon( aPoly );
             else
                 pVirDev->DrawPolyLine( aPoly );
+                // ####
+                //pVirDev->DrawPolyLine( aPoly, aDXFLineInfo );
         }
     }
 }
@@ -675,23 +745,23 @@ void DXF2GDIMetaFile::DrawDimensionEntity(const DXFDimensionEntity & rE, const D
             rTransform
         );
         long nSavedBlockColor, nSavedParentLayerColor;
-        PenStyle eSavedBlockPStyle, eSavedParentLayerPStyle;
+        DXFLineInfo aSavedBlockDXFLineInfo, aSavedParentLayerDXFLineInfo;
         nSavedBlockColor=nBlockColor;
         nSavedParentLayerColor=nParentLayerColor;
-        eSavedBlockPStyle=eBlockPStyle;
-        eSavedParentLayerPStyle=eParentLayerPStyle;
+        aSavedBlockDXFLineInfo=aBlockDXFLineInfo;
+        aSavedParentLayerDXFLineInfo=aParentLayerDXFLineInfo;
         nBlockColor=GetEntityColor(rE);
-        eBlockPStyle=GetEntityPStyle(rE);
+        aBlockDXFLineInfo=GetEntityDXFLineInfo(rE);
         if (rE.sLayer[0]!='0' || rE.sLayer[1]!=0) {
             DXFLayer * pLayer=pDXF->aTables.SearchLayer(rE.sLayer);
             if (pLayer!=NULL) {
                 nParentLayerColor=pLayer->nColor;
-                eParentLayerPStyle=LTypeToPStyle(pLayer->sLineType);
+                aParentLayerDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
             }
         }
         DrawEntities(*pB,aT,FALSE);
-        eBlockPStyle=eSavedBlockPStyle;
-        eParentLayerPStyle=eSavedParentLayerPStyle;
+        aBlockDXFLineInfo=aSavedBlockDXFLineInfo;
+        aParentLayerDXFLineInfo=aSavedParentLayerDXFLineInfo;
         nBlockColor=nSavedBlockColor;
         nParentLayerColor=nSavedParentLayerColor;
     }
@@ -801,16 +871,28 @@ BOOL DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF
     nMainEntitiesCount=CountEntities(pDXF->aEntities);
 
     nBlockColor=7;
-    eBlockPStyle=PEN_SOLID;
+    aBlockDXFLineInfo.eStyle = LINE_SOLID;
+    aBlockDXFLineInfo.fWidth = 0;
+    aBlockDXFLineInfo.nDashCount = 0;
+    aBlockDXFLineInfo.fDashLen = 0;
+    aBlockDXFLineInfo.nDotCount = 0;
+    aBlockDXFLineInfo.fDotLen = 0;
+    aBlockDXFLineInfo.fDistance = 0;
 
     pLayer=pDXF->aTables.SearchLayer("0");
     if (pLayer!=NULL) {
         nParentLayerColor=pLayer->nColor & 0xff;
-        eParentLayerPStyle=LTypeToPStyle(pLayer->sLineType);
+        aParentLayerDXFLineInfo=LTypeToDXFLineInfo(pLayer->sLineType);
     }
     else {
         nParentLayerColor=7;
-        eParentLayerPStyle=PEN_SOLID;
+        aParentLayerDXFLineInfo.eStyle = LINE_SOLID;
+        aParentLayerDXFLineInfo.fWidth = 0;
+        aParentLayerDXFLineInfo.nDashCount = 0;
+        aParentLayerDXFLineInfo.fDashLen = 0;
+        aParentLayerDXFLineInfo.nDotCount = 0;
+        aParentLayerDXFLineInfo.fDotLen = 0;
+        aParentLayerDXFLineInfo.fDistance = 0;
     }
 
     pVirDev->EnableOutput(FALSE);
@@ -837,14 +919,14 @@ BOOL DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF
                 fScale = 0;  // -Wall added this...
             }
             else {
-                if (fWidth<500.0 || fHeight<500.0 || fWidth>32767.0 || fHeight>32767.0) {
+//				if (fWidth<500.0 || fHeight<500.0 || fWidth>32767.0 || fHeight>32767.0) {
                     if (fWidth>fHeight)
                         fScale=10000.0/fWidth;
                     else
                         fScale=10000.0/fHeight;
-                }
-                else
-                    fScale=1.0;
+//				}
+//				else
+//					fScale=1.0;
                 aTransform=DXFTransform(fScale,-fScale,fScale,
                                         DXFVector(-pDXF->aBoundingBox.fMinX*fScale,
                                                    pDXF->aBoundingBox.fMaxY*fScale,
@@ -857,14 +939,14 @@ BOOL DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF
     else {
         fHeight=pVPort->fHeight;
         fWidth=fHeight*pVPort->fAspectRatio;
-        if (fWidth<500.0 || fHeight<500.0 || fWidth>32767.0 || fHeight>32767.0) {
+//		if (fWidth<500.0 || fHeight<500.0 || fWidth>32767.0 || fHeight>32767.0) {
             if (fWidth>fHeight)
                 fScale=10000.0/fWidth;
             else
                 fScale=10000.0/fHeight;
-        }
-        else
-            fScale=1.0;
+//		}
+//		else
+//			fScale=1.0;
         aTransform=DXFTransform(
             DXFTransform(pVPort->aDirection,pVPort->aTarget),
             DXFTransform(
@@ -894,7 +976,6 @@ BOOL DXF2GDIMetaFile::Convert(const DXFRepresentation & rDXF, GDIMetaFile & rMTF
     }
 
     delete pVirDev;
-
     return bStatus;
 }
 
diff --git a/goodies/source/filter.vcl/idxf/dxf2mtf.hxx b/goodies/source/filter.vcl/idxf/dxf2mtf.hxx
index 897bb27..ab3ecf8 100644
--- a/goodies/source/filter.vcl/idxf/dxf2mtf.hxx
+++ b/goodies/source/filter.vcl/idxf/dxf2mtf.hxx
@@ -33,6 +33,7 @@
 
 #include "dxfreprd.hxx"
 #include <vcl/font.hxx>
+#include <vcl/lineinfo.hxx>
 
 // MT: NOOLDSV, someone should change the code...
 enum PenStyle { PEN_NULL, PEN_SOLID, PEN_DOT, PEN_DASH, PEN_DASHDOT };
@@ -41,6 +42,7 @@ enum BrushStyle { BRUSH_NULL, BRUSH_SOLID, BRUSH_HORZ, BRUSH_VERT,
                   BRUSH_25, BRUSH_50, BRUSH_75,
                   BRUSH_BITMAP };
 
+
 class DXF2GDIMetaFile {
 private:
 
@@ -56,9 +58,9 @@ private:
     ULONG nMainEntitiesCount;
 
     long		nBlockColor;
-    PenStyle	eBlockPStyle;
+    DXFLineInfo	aBlockDXFLineInfo;
     long		nParentLayerColor;
-    PenStyle	eParentLayerPStyle;
+    DXFLineInfo	aParentLayerDXFLineInfo;
     Color		aActLineColor;
     Color		aActFillColor;
     Font		aActFont;
@@ -71,9 +73,9 @@ private:
 
     long GetEntityColor(const DXFBasicEntity & rE);
 
-    PenStyle LTypeToPStyle(const char * sLineType);
+    DXFLineInfo LTypeToDXFLineInfo(const char * sLineType);
 
-    PenStyle GetEntityPStyle(const DXFBasicEntity & rE);
+    DXFLineInfo GetEntityDXFLineInfo(const DXFBasicEntity & rE);
 
     BOOL SetLineAttribute(const DXFBasicEntity & rE, ULONG nWidth=0);
 
diff --git a/goodies/source/filter.vcl/idxf/dxfreprd.cxx b/goodies/source/filter.vcl/idxf/dxfreprd.cxx
index 544470c..0ec3d3f 100644
--- a/goodies/source/filter.vcl/idxf/dxfreprd.cxx
+++ b/goodies/source/filter.vcl/idxf/dxfreprd.cxx
@@ -142,7 +142,8 @@ void DXFPalette::SetColor(BYTE nIndex, BYTE nRed, BYTE nGreen, BYTE nBlue)
 
 DXFRepresentation::DXFRepresentation()
 {
-  setTextEncoding(RTL_TEXTENCODING_IBM_437);
+    setTextEncoding(RTL_TEXTENCODING_IBM_437);
+        setGlobalLineTypeScale(1.0);
 }
 
 
@@ -217,11 +218,18 @@ void DXFRepresentation::ReadHeader(DXFGroupReader & rDGR)
                                          // FIXME: we really need a whole table of 
                                          // $DWGCODEPAGE to encodings mappings
                                          if ( (strcmp(rDGR.GetS(),"ANSI_932")==0) ||
-                                              (strcmp(rDGR.GetS(),"DOS932")==0) )
+                          (strcmp(rDGR.GetS(),"ansi_932")==0) ||
+                                              (strcmp(rDGR.GetS(),"DOS932")==0) ||
+                                              (strcmp(rDGR.GetS(),"dos932")==0) )
                                          {
                                                  setTextEncoding(RTL_TEXTENCODING_MS_932);
                                          }
                                  }
+                 else if (strcmp(rDGR.GetS(),"$LTSCALE")==0)
+                                 {
+                                         rDGR.Read();
+                                         setGlobalLineTypeScale(getGlobalLineTypeScale() * rDGR.GetF());
+                                 }
                                  else rDGR.Read();
                          }
                  }
diff --git a/goodies/source/filter.vcl/idxf/dxfreprd.hxx b/goodies/source/filter.vcl/idxf/dxfreprd.hxx
index 57636b4..7b2632e 100644
--- a/goodies/source/filter.vcl/idxf/dxfreprd.hxx
+++ b/goodies/source/filter.vcl/idxf/dxfreprd.hxx
@@ -101,7 +101,9 @@ public:
     DXFEntities aEntities;
         // Die Entities (aus der Entities-Section) der DXF-Datei
 
-    rtl_TextEncoding mEnc;
+    rtl_TextEncoding mEnc;	// $DWGCODEPAGE
+
+    double mfGlobalLineTypeScale; // $LTSCALE
 
     DXFRepresentation();
     ~DXFRepresentation();
@@ -109,6 +111,9 @@ public:
         rtl_TextEncoding getTextEncoding() const;
         void setTextEncoding(rtl_TextEncoding aEnc);
 
+        double getGlobalLineTypeScale() const;
+        void setGlobalLineTypeScale(double fGlobalLineTypeScale);
+
     BOOL Read( SvStream & rIStream, USHORT nMinPercent, USHORT nMaxPercent);
         // Liesst die komplette DXF-Datei ein.
 
@@ -128,7 +133,8 @@ inline BYTE DXFPalette::GetGreen(BYTE nIndex) const { return pGreen[nIndex]; }
 inline BYTE DXFPalette::GetBlue(BYTE nIndex) const { return pBlue[nIndex]; }
 inline rtl_TextEncoding DXFRepresentation::getTextEncoding() const { return mEnc; }
 inline void DXFRepresentation::setTextEncoding(rtl_TextEncoding aEnc) { mEnc = aEnc; }
-
+inline double DXFRepresentation::getGlobalLineTypeScale() const { return mfGlobalLineTypeScale; }
+inline void DXFRepresentation::setGlobalLineTypeScale(double fGlobalLineTypeScale) { mfGlobalLineTypeScale = fGlobalLineTypeScale; }
 
 #endif
 
diff --git a/goodies/source/filter.vcl/idxf/dxfvec.cxx b/goodies/source/filter.vcl/idxf/dxfvec.cxx
index 405929e..c9b236e 100644
--- a/goodies/source/filter.vcl/idxf/dxfvec.cxx
+++ b/goodies/source/filter.vcl/idxf/dxfvec.cxx
@@ -206,6 +206,32 @@ BOOL DXFTransform::TransCircleToEllipse(double fRadius, double & rEx, double & r
     else return FALSE;
 }
 
+LineInfo DXFTransform::Transform(const DXFLineInfo& aDXFLineInfo) const
+{
+    double fex,fey,scale;
+
+    fex=sqrt(aMX.fx*aMX.fx + aMX.fy*aMX.fy);
+    fey=sqrt(aMY.fx*aMY.fx + aMY.fy*aMY.fy);
+    scale = (fex+fey)/2.0;
+
+    LineInfo aLineInfo;
+
+    aLineInfo.SetStyle( aDXFLineInfo.eStyle );
+    aLineInfo.SetWidth( (sal_Int32) (aDXFLineInfo.fWidth * scale + 0.5) );
+    aLineInfo.SetDashCount( static_cast< USHORT >( aDXFLineInfo.nDashCount ) );
+    aLineInfo.SetDashLen( (sal_Int32) (aDXFLineInfo.fDashLen * scale + 0.5) );
+    aLineInfo.SetDotCount( static_cast< USHORT >( aDXFLineInfo.nDotCount ) );
+    aLineInfo.SetDotLen( (sal_Int32) (aDXFLineInfo.fDotLen * scale + 0.5) );
+    aLineInfo.SetDistance( (sal_Int32) (aDXFLineInfo.fDistance * scale + 0.5) );
+    
+    if ( aLineInfo.GetDashCount() > 0 && aLineInfo.GetDashLen() == 0 )
+        aLineInfo.SetDashLen(1);
+
+    if ( aLineInfo.GetDotCount() > 0 && aLineInfo.GetDotLen() == 0 )
+        aLineInfo.SetDotLen(1);
+
+    return aLineInfo;
+}
 
 ULONG DXFTransform::TransLineWidth(double fW) const
 {
@@ -213,6 +239,8 @@ ULONG DXFTransform::TransLineWidth(double fW) const
 
     fex=sqrt(aMX.fx*aMX.fx + aMX.fy*aMX.fy);
     fey=sqrt(aMY.fx*aMY.fx + aMY.fy*aMY.fy);
+    // ###
+    // printf("fex=%f fey=%f\n", fex, fey);
     return (ULONG)(fabs(fW)*(fex+fey)/2.0+0.5);
 }
 
@@ -227,4 +255,3 @@ BOOL DXFTransform::Mirror() const
     if (aMZ.SProd(aMX*aMY)<0) return TRUE; else return FALSE;
 }
 
-
diff --git a/goodies/source/filter.vcl/idxf/dxfvec.hxx b/goodies/source/filter.vcl/idxf/dxfvec.hxx
index e07f3b9..f25a603 100644
--- a/goodies/source/filter.vcl/idxf/dxfvec.hxx
+++ b/goodies/source/filter.vcl/idxf/dxfvec.hxx
@@ -32,6 +32,37 @@
 #define _DXFVEC_HXX
 
 #include <tools/gen.hxx>
+#include <vcl/lineinfo.hxx>
+
+class DXFLineInfo {
+public:
+    LineStyle		eStyle;
+    double			fWidth;
+    sal_Int32		nDashCount;
+    double			fDashLen;
+    sal_Int32		nDotCount;
+    double			fDotLen;
+    double			fDistance;
+
+    DXFLineInfo() :
+        eStyle(LINE_SOLID),
+        fWidth(0),
+        nDashCount(0),
+        fDashLen(0),
+        nDotCount(0),
+        fDotLen(0),
+        fDistance(0) {}
+
+    DXFLineInfo(const DXFLineInfo& x) :
+        eStyle(x.eStyle),
+        fWidth(x.fWidth),
+        nDashCount(x.nDashCount),
+        fDashLen(x.fDashLen),
+        nDotCount(x.nDotCount),
+        fDotLen(x.fDotLen),
+        fDistance(x.fDistance) {}
+
+};
 
 
 //------------------------------------------------------------------------------
@@ -135,6 +166,9 @@ public:
     BOOL Mirror() const;
         // Liefert TRUE, wenn die Matrix ein Linkssystem bildet
 
+    LineInfo Transform(const DXFLineInfo& aDXFLineInfo) const;
+        // Transform to LineInfo
+
 private:
     DXFVector aMX;
     DXFVector aMY;


More information about the ooo-build-commit mailing list