Week #4 Report - GSoC - 100 Paper Cuts

Bayram Çiçek mail at bayramcicek.com.tr
Mon Jul 5 08:35:36 UTC 2021


Dear LibreOffice Community,

GSoC progress for week #4.

 > Blog Posts:

Blog post for week #2: 
https://bayramcicek.com.tr/libreoffice-dev/2021/07/04/week-02-gsoc.html 
<https://bayramcicek.com.tr/libreoffice-dev/2021/07/04/week-02-gsoc.html>

Blog post for week #3 and #4: 
https://bayramcicek.com.tr/libreoffice-dev/2021/07/05/week-03-04-gsoc.html 
<https://bayramcicek.com.tr/libreoffice-dev/2021/07/05/week-03-04-gsoc.html>

 > Group selection works with Drawing objects, but doesn't work with 
raster images / Writer

Writer can group shapes(rectangles, circles), text boxes and draw 
images(from Draw/Calc); but this feature does not work on raster images 
because images in Writer handled as Frame objects(Graphics/holding 
images/bitmaps).

Last 2 weeks, I was working on "drawing objects" to understand how 
grouping works. I worked mainly on debugging and finding why raster 
images does not group with shapes. Here is what I found:

/(All code pointers are in the blog post)/

 > All selected objects store in /rMrkList/ list:
/const SdrMarkList &rMrkList = pDView->GetMarkedObjectList();/

 > In /SwFEShell::SelectObj/,/SAL_DEBUG( rMrkList.GetMarkDescription() 
)/ returns:

For shapes: "/shapes/"
For 2+ shapes: "/2 shapes/"
For draw images: "/Image with transparency/"
For text box: "/Text Frame/"
For raster images: "/[Drawing object]/"

"/[Drawing object]/" defined as /STR_ObjNameSingulNONE/. This means 
/GetMarkDescription()/ doesn't know what the raster images?

 > Contents by position:

Shape : /OBJCNT_SIMPLE/
Raster images : /OBJCNT_GRF/

 > Selection Type:

Shape : /SelectionType::DrawObject/
Raster images : /SelectionType::Graphic  (CNT_GRF)/

 > Selecting raster images via /SHIFT+CLICK /add them in /rMrkList/, but 
only /1/ of them:

While shapes added normally on the /rMrkList/, raster images added only 
once, then be /unmarked/, because /::GetFlyFromMarked( &rMrkList, this 
)/ always returns an address which is caused to execute 
/pDView->UnmarkAll()/.

 > Frame is not accessible

Another interesting issue is when trying to add(select) a raster image 
to the shape list (unmarking disabled) debugging warns /"warn: /*...*/ 
frame is not accessible"./

/SwAccessibleMap::InvalidateCursorPosition/:

/bool bShapeSelected = false;//
//// ...//
//            else if( pFESh->IsObjSelected() > 0 )//
//            {//
//                bShapeSelected = true;//
//                aFrameOrObj = static_cast<const SwFrame *>( nullptr );//
//            }//
//// ... //
//    OSL_ENSURE( bShapeSelected || 
aFrameOrObj.IsAccessible(GetShell()->IsPreview()),//
//            "frame is not accessible" );/

"/pFESh->IsObjSelected()/" should return /GetMarkCount()/, not /0/. 
Otherwise /bShapeSelected/ stays /false/ and /OSL_ENSURE/ warns /"frame 
is not accessible"/:

/size_t SwFEShell::IsObjSelected() const//
//{//
//    if ( IsFrameSelected() || !Imp()->HasDrawView() )//
//        return 0;//
//    return Imp()->GetDrawView()->GetMarkedObjectList().GetMarkCount();//
//}//
////
//bool SwFEShell::IsFrameSelected() const//
//{//
//    if ( !Imp()->HasDrawView() )//
//        return false;//
//    else//
//        return nullptr != ::GetFlyFromMarked( 
&Imp()->GetDrawView()->GetMarkedObjectList(),//
//const_cast<SwFEShell*>(this) );//
//}/

When selecting raster images, in /SwFEShell::IsFrameSelected()/:

/    return nullptr != ::GetFlyFromMarked(/*..*/);/

/GetFlyFromMarked/ should return false 0(null) (as like shapes do), not 
an /address/ which make/nullptr != 0x01... true./

I also looked at /Draw/ and /Calc/ to see how images are handled. Images 
are converted a drawing objects and have the same attributes like 
shapes. But in Writer, images have different attributes and handling.

 > Summary of last 2 weeks

     - Tried to understand how shapes grouped together
     - Debugging

 > Next week TO-DO:

     - Make raster images selectable(group) with SHIFT+CLICK

Please let me know if you have any suggestions about group selection of 
raster images.

Thank you all.

-- 

Regards,
Bayram Çiçek

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20210705/08494843/attachment.htm>


More information about the LibreOffice mailing list