You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by or...@apache.org on 2014/07/04 16:37:42 UTC
svn commit: r1607867 - in /openoffice/branches/AOO410: ./ main/
main/xmloff/source/text/txtimppr.cxx
Author: orw
Date: Fri Jul 4 14:37:41 2014
New Revision: 1607867
URL: http://svn.apache.org/r1607867
Log:
124107: ODF import - ignore fo:margin="100%" for paragraph styles as core attributes are not able to treat it correctly.
The result is the same - value are inherited from parent
cherry-picked from trunk
Modified:
openoffice/branches/AOO410/ (props changed)
openoffice/branches/AOO410/main/ (props changed)
openoffice/branches/AOO410/main/xmloff/source/text/txtimppr.cxx
Propchange: openoffice/branches/AOO410/
------------------------------------------------------------------------------
Merged /openoffice/trunk:r1607836
Propchange: openoffice/branches/AOO410/main/
------------------------------------------------------------------------------
Merged /openoffice/trunk/main:r1607836
Modified: openoffice/branches/AOO410/main/xmloff/source/text/txtimppr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/xmloff/source/text/txtimppr.cxx?rev=1607867&r1=1607866&r2=1607867&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/xmloff/source/text/txtimppr.cxx (original)
+++ openoffice/branches/AOO410/main/xmloff/source/text/txtimppr.cxx Fri Jul 4 14:37:41 2014
@@ -312,9 +312,11 @@ void XMLTextImportPropertyMapper::finish
XMLPropertyState* pVertOrientRelAsChar = 0;
XMLPropertyState* pBackTransparency = NULL; // transparency in %
XMLPropertyState* pBackTransparent = NULL; // transparency as boolean
+
XMLPropertyState* pAllParaMargin = 0;
XMLPropertyState* pParaMargins[4] = { 0, 0, 0, 0 };
::std::auto_ptr<XMLPropertyState> pNewParaMargins[4];
+
XMLPropertyState* pAllMargin = 0;
XMLPropertyState* pMargins[4] = { 0, 0, 0, 0 };
::std::auto_ptr<XMLPropertyState> pNewMargins[4];
@@ -385,21 +387,42 @@ void XMLTextImportPropertyMapper::finish
bHasAnyWidth = sal_True; break;
case CTF_BACKGROUND_TRANSPARENCY: pBackTransparency = property; break;
case CTF_BACKGROUND_TRANSPARENT: pBackTransparent = property; break;
+
case CTF_PARAMARGINALL:
+ pAllParaMargin = property;
+ break;
case CTF_PARAMARGINALL_REL:
- pAllParaMargin = property; break;
+ {
+ sal_uInt32 nValue;
+ property->maValue >>= nValue;
+ // treat fo:margin="100%" as it is not exisiting as the
+ // corresponding core attribute classes - <SvxULSpaceItem> and
+ // <SvxLRSpaceItem> - are not able to treat such a value correctly.
+ // The result will be the same as the values will be inherited
+ // from parent, when the no margin attribute is given.
+ if ( nValue != 100 )
+ {
+ pAllParaMargin = property;
+ }
+ }
+ break;
+
case CTF_PARALEFTMARGIN:
case CTF_PARALEFTMARGIN_REL:
pParaMargins[XML_LINE_LEFT] = property; break;
+
case CTF_PARARIGHTMARGIN:
case CTF_PARARIGHTMARGIN_REL:
pParaMargins[XML_LINE_RIGHT] = property; break;
+
case CTF_PARATOPMARGIN:
case CTF_PARATOPMARGIN_REL:
pParaMargins[XML_LINE_TOP] = property; break;
+
case CTF_PARABOTTOMMARGIN:
case CTF_PARABOTTOMMARGIN_REL:
pParaMargins[XML_LINE_BOTTOM] = property; break;
+
case CTF_MARGINALL:
pAllMargin = property; break;
case CTF_MARGINLEFT:
@@ -428,7 +451,8 @@ void XMLTextImportPropertyMapper::finish
for (sal_uInt16 i = 0; i < 4; i++)
{
- if (pAllParaMargin && !pParaMargins[i])
+ if ( pAllParaMargin != NULL
+ && pParaMargins[i] == NULL )
{
#ifdef DBG_UTIL
sal_Int16 nTmp = getPropertySetMapper()->GetEntryContextId(
@@ -437,9 +461,12 @@ void XMLTextImportPropertyMapper::finish
nTmp <= CTF_PARABOTTOMMARGIN_REL,
"wrong property context id" );
#endif
- pNewParaMargins[i].reset(new XMLPropertyState(
- pAllParaMargin->mnIndex + (2*i) + 2, pAllParaMargin->maValue));
+ // IMPORTANT NOTE: the index calculation depends on the right order in the property map
+ pNewParaMargins[i].reset(
+ new XMLPropertyState( pAllParaMargin->mnIndex + (2*i) + 2,
+ pAllParaMargin->maValue ) );
}
+
if (pAllMargin && !pMargins[i])
{
#ifdef DBG_UTIL
@@ -448,8 +475,10 @@ void XMLTextImportPropertyMapper::finish
OSL_ENSURE( nTmp >= CTF_MARGINLEFT && nTmp <= CTF_MARGINBOTTOM,
"wrong property context id" );
#endif
- pNewMargins[i].reset(new XMLPropertyState(
- pAllMargin->mnIndex + i + 1, pAllMargin->maValue));
+ // IMPORTANT NOTE: the index calculation depends on the right order in the property map
+ pNewMargins[i].reset(
+ new XMLPropertyState( pAllMargin->mnIndex + i + 1,
+ pAllMargin->maValue ) );
}
if( pAllBorderDistance && !pBorderDistances[i] )
{