About shapeexport.cxx in xmloff
Caolán McNamara
caolanm at redhat.com
Thu Nov 1 14:24:13 PDT 2012
On Thu, 2012-11-01 at 02:51 -0700, julien2412 wrote:
> Why shouldn't we uncomment case 3?
> "nDisplay" could be equalled to "3" and "eDisplayToken" is
> "XML_TOKEN_INVALID" by default
XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID;
...
switch( (bVisible << 1) | bPrintable )
{
case 0: eDisplayToken = XML_NONE; break;
case 1: eDisplayToken = XML_PRINTER; break;
case 2: eDisplayToken = XML_SCREEN; break;
// case 3: eDisplayToken = XML_ALWAYS break; this is the default
}
...
if( eDisplayToken != XML_TOKEN_INVALID )
mrExport.AddAttribute(XML_NAMESPACE_DRAW_EXT, XML_DISPLAY,
eDisplayToken );
The idea just seems to be that the default behaviour for that tag is
that if no xml-display attribute is set, then the importer is to act as
if xml-always was present. So its a little size optimization to not
export the attribute if it equals the default value.
For clarity, if you wanted, you could change the initial
XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID;
to
XMLTokenEnum eDisplayToken = XML_ALWAYS;
and change
if( eDisplayToken != XML_TOKEN_INVALID )
to
if( eDisplayToken != XML_ALWAYS )
C.
More information about the LibreOffice
mailing list