Andre Fischer - Sun Microsystems Germany 写道:
> Hi Weike,
>
> Liang Weike wrote:
>   
>> Hi Andre,
>>
>> I tracked the issue step by step once more. Yes, you're right. The wrong
>> context leads to the issue. I think, the real problem occurs where the
>> method "SdrViewContext SdrView::GetContext() const" within svx module is
>> invoked. And it returns SDRCONTEXT_STANDARD rather than
>> SDRCONTEXT_GRAPHIC. The original and responsible code is strange from my
>> point of view. So I modify the code included in that method and the
>> changes are as follows:
>>
>> diff -uNr old/svx/source/svdraw/svdview.cxx
>> new/svx/source/svdraw/svdview.cxx
>> --- old/svx/source/svdraw/svdview.cxx 2007-11-16 11:50:26.000000000 +0800
>> +++ new/svx/source/svdraw/svdview.cxx 2007-11-16 11:49:36.000000000 +0800
>> @@ -1227,16 +1227,20 @@
>>
>> if( GetMarkedObjectCount() )
>> {
>> - BOOL bGraf = TRUE, bMedia = TRUE;
>> + BOOL bGraf = FALSE, bMedia = FALSE;
>>
>> - for( ULONG nMarkNum = 0; nMarkNum < nMarkAnz && ( bGraf || bMedia );
>> nMarkNum++ )
>> + for( ULONG nMarkNum = 0; nMarkNum < nMarkAnz; nMarkNum++ )
>> {
>> const SdrObject* pMarkObj = GetMarkedObjectByIndex( nMarkNum );
>>
>> - if( !pMarkObj->ISA( SdrGrafObj ) )
>> - bGraf = FALSE;
>> + if( pMarkObj->ISA( SdrGrafObj ) )
>> + bGraf = TRUE;
>> + else
>> + bGraf = FALSE;
>>
>> - if( !pMarkObj->ISA( SdrMediaObj ) )
>> + if( pMarkObj->ISA( SdrMediaObj ) )
>> + bMedia = TRUE;
>> + else
>> bMedia = FALSE;
>> }
>>
>> And now the code works well in my computer and the phenomenon of the
>> issue does not exist. So could you please help check it?
>>     
>
> It took me some time but now I think I understand the current
> implementation and your proposed changes:
>
> 1. If only one object is selected then both do the same thing (the same
> is true when no object is selected but that is a trivial case).
>
> 2. When two or more objects are selected then the current implementation
> returns SDRCONTEXT_GRAPHIC or SDRCONTEXT_MEDIA when all these objects
> are either graphic objects or media objects, respectively.
>
> 3. Your proposed changes return SDRCONTEXT_GRAPHIC or SDRCONTEXT_MEDIA
> when at least one object is a graphic object or a media object,
> respectively.
>
> The proposed changes do fix this issue but would lead to other problems.
>  What when the multi-selection does contain a normal shape, a graphic
> object, and a media object?  Which tool bar is to be shown in this case?
>
>
> I think that the real problem lies on more level deeper.  Why is there a
> multi selection after the conversion to bitmap in the first place?
> When the conversion is triggered then a bitmap object is created. It
> then replaces the rectangle (or whatever it was before) by calling the
> SdrEditView::ReplaceObjectAtView() method.  The replacement works as
> designed but the selection is not adapted accordingly.
>
> The set of selected objects is organized in the so called mark list.
> Selecting an object means inserting it into the mark list.  Removing an
> object from the mark list deselects it.  When ReplaceObjectAtView() is
> called then the new object is selected but the old object is not
> deslected: the mark list still holds a reference.
>
> Explicitly deselecting the old object fixes the issue:
>
>
> Index: svdedtv.cxx
> ===================================================================
> RCS file: /cvs/graphics/svx/source/svdraw/svdedtv.cxx,v
> retrieving revision 1.23
> diff -c -r1.23 svdedtv.cxx
> *** svdedtv.cxx       6 Jul 2007 07:39:35 -0000       1.23
> --- svdedtv.cxx       16 Nov 2007 09:46:38 -0000
> ***************
> *** 844,849 ****
> --- 844,850 ----
>   {
>       SdrObjList* pOL=pOldObj->GetObjList();
>
> AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoReplaceObject(*pOldObj,*pNewObj));
> +     MarkObj(pOldObj,&rPV,TRUE);
>       pOL->ReplaceObject(pNewObj,pOldObj->GetOrdNum());
>       if (bMark) MarkObj(pNewObj,&rPV);
>   }
>
>
> Have a nice weekend,
> Andre
>   
Hi Andre,

Thank you for your explanation.

Best regards,
Weike

Reply via email to