To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=48589
                  Issue #:|48589
                  Summary:|incorrect glue points mapping
                Component:|xml
                  Version:|680m95
                 Platform:|All
                      URL:|
               OS/Version:|All
                   Status:|NEW
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|DEFECT
                 Priority:|P3
             Subcomponent:|code
              Assigned to:|jsi
              Reported by:|jeongkyu





------- Additional comments from [EMAIL PROTECTED] Tue May  3 00:11:12 -0700 
2005 -------
There was a bug report about glue point loss in Korean community forum (see
http://oooko.ncity.net/forums/files/connection_109.gif ). I researched the bug
and found glue point mapping seems to be incorrect in 680m95.

Here is steps to reproduce the bug.
1. Open draw.
2. Place two circles from basic shapes.
3. Place straight connector between two circles with target glue point at
NE(north east) point.
4. Save drawing and close file.
5. Open the file again.
6. Confirm  the target glue point is at N point instead of NE point.

When I took a look at the context.xml, index of the end glue point was 12. By
playing with 'end-glue-point' value in the xml file, I found glue point indices
 are mapped like 

    [5]
 [6]   [12]
[7]     [11]
 [8]   [10]
    [9]
.

So, the index 12 is valid. However, this id was ignored when OO.o loaded the
example file. Actually, getGluePointId() returned -1 instead of 12 in
restoreConnections(). 

(In xmloff/source/draw/shapeimport.cxx) 
void XMLShapeImportHelper::restoreConnections()
{
...
  sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId :
getGluePointId( xShape, rHint.nDestGlueId );
...
}

With further research, I found the reason of the behavior is in incorrect
mapping of glue points pairs. 

(In xmloff/source/draw/ximpcustomshape.cxx) 
void XMLEnhancedCustomShapeContext::StartElement(...)
{
...
  case EAS_glue_points :
  {
    sal_Int32 i, nPairs = GetEnhancedParameterPairSequence( maPath, rValue,
EAS_GluePoints );
    for ( i = 0; i < nPairs; i++ )
      GetImport().GetShapeImport()->addGluePointMapping( mrxShape, i + 4, i + 4 
);
  }
...
}

The above code creates ID mapping for the circle from 4 to 11, which should be 5
to 12. To fix this issue, we just need to start mapping from 5. In other words,
following modifications are necessary.

(In xmloff/source/draw/shapeimport.cxx) 
void XMLShapeImportHelper::restoreConnections()
{
...
--  sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId :
getGluePointId( xShape, rHint.nDestGlueId );
++  sal_Int32 nGlueId = rHint.nDestGlueId < 5 ? rHint.nDestGlueId :
getGluePointId( xShape, rHint.nDestGlueId );

(In xmloff/source/draw/ximpcustomshape.cxx) 
void XMLEnhancedCustomShapeContext::StartElement(...)
{
...
  for ( i = 0; i < nPairs; i++ )
--  GetImport().GetShapeImport()->addGluePointMapping( mrxShape, i + 4, i + 4 );
++  GetImport().GetShapeImport()->addGluePointMapping( mrxShape, i + 5, i + 5 );

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to