Hi chensuchun,

On 02/02/07 02:52, [EMAIL PROTECTED] wrote:
When a table is formated with thick lines around the table and thin lines insidethe table, if you ask OO.o to add a row at the end of the table it's createdwith a thick line between it and the rest of the table instead of respecting the"thick lines around the table, thin lines inside" rule. I want to fix it as "thick lines around the table ,thin lines inside"after insert rows at the end of the table,but I find it is difficult to get SvxBoxInfoItem of the table in function BOOL lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara ).
so I modify the insert-operation source code (in file 
sw/source/ui/shells/tabsh.cxx) as following:
case FN_TABLE_INSERT_COL: case FN_TABLE_INSERT_ROW: { ///-->get the SvxBoxInfoItem of the table before insert SfxItemSet aCoreSet( GetPool(), aUITableAttrRange); ::lcl_TableParamToItemSet( aCoreSet, rSh ); SvxBoxInfoItem aBoxInfo((const SvxBoxInfoItem&) aCoreSet.Get(SID_ATTR_BORDER_INNER)); ///<--End ///do the insert operation BOOL bColumn = rReq.GetSlot() == FN_TABLE_INSERT_COL; USHORT nCount = 0; BOOL bAfter = TRUE; if (pItem) { nCount = ((const SfxInt16Item* )pItem)->GetValue(); if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_INSERT_AFTER, TRUE, &pItem)) bAfter = ((const SfxBoolItem* )pItem)->GetValue(); } else if( !rReq.IsAPI() ) ++nCount; if( nCount ) { if( bColumn ) rSh.InsertCol( nCount, bAfter ); else if ( !rSh.IsInRepeatedHeadline() ) rSh.InsertRow( nCount, bAfter ); bCallDone = TRUE; ///-->after inserting,reset the table border according to the SvxBoxInfoItem /// get before SfxItemSet aSet( GetPool(), RES_BOX, RES_BOX,
                        SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
0); aSet.Put( aBoxInfo ); ItemSetToTableParam( aSet, rSh ); ///<-- break; } nSlot = bColumn ? FN_TABLE_INSERT_COL_DLG : FN_TABLE_INSERT_ROW_DLG; } Is this modification right,or it would cause other problem or affect other operation?How to solve this problem if the modification is wrong ? Thanks for help or advices!

cool, your code already looks quite good. I made some little modifications in order to generate only one undo event for this action:


case FN_TABLE_INSERT_COL:
case FN_TABLE_INSERT_ROW:
{
    BOOL bColumn = rReq.GetSlot() == FN_TABLE_INSERT_COL;
    USHORT nCount = 0;
    BOOL bAfter = TRUE;
    if (pItem)
    {
        nCount = ((const SfxInt16Item* )pItem)->GetValue();
        if(SFX_ITEM_SET ==                      
           pArgs->GetItemState(FN_PARAM_INSERT_AFTER, TRUE, pItem))
            bAfter = ((const SfxBoolItem* )pItem)->GetValue();
    }
    else if( !rReq.IsAPI() )
        ++nCount;

    if( nCount )
    {
        ///-->get the SvxBoxInfoItem of the table before insert
        SfxItemSet aCoreSet( GetPool(), aUITableAttrRange);
        ::lcl_TableParamToItemSet( aCoreSet, rSh );
        bool bSetInnerBorders = false;
        sal_uInt16 nUndoId = 0;
        ///<--End

        if( bColumn )
        {
            rSh.StartUndo( UNDO_TABLE_INSCOL );
            rSh.InsertCol( nCount, bAfter );
            bSetInnerBorders = true;
            nUndoId = UNDO_TABLE_INSCOL;
        }
        else if ( !rSh.IsInRepeatedHeadline() )
        {
            rSh.StartUndo( UNDO_TABLE_INSROW );
            rSh.InsertRow( nCount, bAfter );
            bSetInnerBorders = true;
            nUndoId = UNDO_TABLE_INSROW;
        }

        bCallDone = TRUE;

       ///-->after inserting,reset the inner table borders
       if ( bSetInnerBorders )
       {
            SvxBoxInfoItem aBoxInfo((const SvxBoxInfoItem&)
                aCoreSet.Get(SID_ATTR_BORDER_INNER));
            SfxItemSet aSet( GetPool(), SID_ATTR_BORDER_INNER,          
                                        SID_ATTR_BORDER_INNER, 0);
            aSet.Put( aBoxInfo );
            ItemSetToTableParam( aSet, rSh );
            rSh.EndUndo( nUndoId );
       }
       ///<--

       break;
    }

    nSlot = bColumn ? FN_TABLE_INSERT_COL_DLG : FN_TABLE_INSERT_ROW_DLG;
}

I suggest you submit an issuezilla issue for this, set the type to "PATCH", attach this patch and sent it to me (fme).

Thank you for your contribution,

Frank

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

  • [dev] RE:[dev]... cokecola13574
    • Re: [dev]... Frank Meies - Sun Germany - Development - Software Engineer

Reply via email to