[Libreoffice] [PATCH] format clipboard

Maxime de Roucy mderoucy at linagora.com
Fri Mar 16 02:16:27 PDT 2012


Here a copy of the mail I send to Cedric Bosdonnat… forgot to add the
list as "Cc:".

Hello

Thanks you for asking me…

When you select a cell in Writer the selection type is a mix of
nsSelectionType::SEL_TBL_CELLS, nsSelectionType::SEL_TBL and
nsSelectionType::SEL_TXT.
So when the lcl_CreateEmptyItemSet function is called directly with the
nSelectionType (from rWrtShell.GetSelectionType()) the if statement
"nSelectionType == nsSelectionType::SEL_TBL" is false.

So in the SwFormatClipboard::Copy function there is another statement : 



________________________________________________________________________


	if( nSelectionType & nsSelectionType::SEL_TBL_CELLS )//only copy table attributes if really cells are selected (not only text in tables)
	{
		m_pTableItemSet = lcl_CreateEmptyItemSet( nsSelectionType::SEL_TBL, rPool );
		lcl_getTableAttributes( *m_pTableItemSet, rWrtShell );
	}


________________________________________________________________________



That call lcl_CreateEmptyItemSet with just nsSelectionType::SEL_TBL if
the real selection type contain nsSelectionType::SEL_TBL_CELLS.

I found this way of doing a bit confusing and as tables parameters are
handle separately in the whole format paintbrush code I thought that
replacing : 



________________________________________________________________________


	m_pTableItemSet = lcl_CreateEmptyItemSet( nsSelectionType::SEL_TBL, rPool );


________________________________________________________________________



by : 



________________________________________________________________________


	m_pTableItemSet = new SfxItemSet(rPool,
		SID_ATTR_BORDER_INNER,  SID_ATTR_BORDER_SHADOW, //SID_ATTR_BORDER_OUTER is inbetween
		RES_BACKGROUND,         RES_SHADOW, //RES_BOX is inbetween
		SID_ATTR_BRUSH_ROW,     SID_ATTR_BRUSH_TABLE,
		RES_BREAK,              RES_BREAK,
		RES_PAGEDESC,           RES_PAGEDESC,
		RES_LAYOUT_SPLIT,       RES_LAYOUT_SPLIT,
		RES_ROW_SPLIT,          RES_ROW_SPLIT,
		RES_KEEP,               RES_KEEP,
		RES_FRAMEDIR,           RES_FRAMEDIR,
		FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE,
		FN_TABLE_BOX_TEXTORIENTATION, FN_TABLE_BOX_TEXTORIENTATION,
		FN_TABLE_SET_VERT_ALIGN, FN_TABLE_SET_VERT_ALIGN,
		0);


________________________________________________________________________



was not irrelevant.

After this replacement was made there where no reasons keeping the
"nSelectionType == nsSelectionType::SEL_TBL" block in the
lcl_CreateEmptyItemSet function.

I hope I answered your question.

BEWARE : this patch need the first patch
0001-add-GetCurParAttr-and-GetPaMParAttr-in-SwEditShell from my preview
mail
http://lists.freedesktop.org/archives/libreoffice/2012-March/028157.html

Regards

Maxime de Roucy

-- 
Maxime de Roucy
Groupe LINAGORA - OSSA
80 rue Roque de Fillol
92800 PUTEAUX
Tel. : 0 810 251 251




Le jeudi 15 mars 2012 à 17:06 +0100, Cedric Bosdonnat a écrit : 

> Hi Maxime,
> 
> On Wed, 2012-03-14 at 16:50 +0100, Maxime de Roucy wrote:
> > Here is some new patchs on the format clipboard. The first just add some
> > comment in the formatclipboard.hxx file. The second one depend on
> > modifications I made in the previous patch
> > 0001-add-GetCurParAttr-and-GetPaMParAttr-in-SwEditShell.patch which is
> > itself dependant of the patch
> > 0004-SwEditShell-use-of-the-STL-swap-function.patch which is waiting for
> > moderator approval to be published in the mailing list.
> 
> I pushed the first patch to the master branch... but there is something
> weird in the second patch. Why did you remove the case where
> nSelectionType is a table selection?
> 
> I'll push the second patch once that question is clarified.
> 
> --
> Cedric
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120316/e9667275/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120316/e9667275/attachment-0001.pgp>


More information about the LibreOffice mailing list