ooo-build r12749 - in trunk: . patches/dev300



Author: freuter
Date: Mon Jun  2 07:04:40 2008
New Revision: 12749
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12749&view=rev

Log:
Better conformance to DIS26300 (ODF). See #n396280.

Added:
   trunk/patches/dev300/xmloff_dis26300_conformance.diff
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Mon Jun  2 07:04:40 2008
@@ -2261,6 +2261,8 @@
 # to waste for time with this fix but to focus on the refactoring
 sw-nested-positionned-tables-ww8-import-fix.diff, n#376688, flr
 
+xmloff_dis26300_conformance.diff, n#396280, flr
+
 [ InternalMesaHeaders ]
 internal-mesa-headers-config_office.diff, fridrich
 internal-mesa-headers-slideshow.diff, fridrich

Added: trunk/patches/dev300/xmloff_dis26300_conformance.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/xmloff_dis26300_conformance.diff	Mon Jun  2 07:04:40 2008
@@ -0,0 +1,337 @@
+diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
+index f382d48..e3061fa 100644
+--- sw/source/filter/xml/xmltbli.cxx
++++ sw/source/filter/xml/xmltbli.cxx
+@@ -2867,7 +2867,7 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
+ 		bFirstSection = sal_False;
+ 		OUString sStyleName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+ 		GetImport().GetTextImport()->SetStyleAndAttrs( GetImport(),
+-			GetImport().GetTextImport()->GetCursor(), sStyleName, sal_True );
++			GetImport().GetTextImport()->GetCursor(), sStyleName, rtl::OUString(), sal_True );
+ 	}
+ 	else
+ 	{
+diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
+index 97e8b6b..e5576fc 100644
+--- xmloff/inc/xmloff/txtimp.hxx
++++ xmloff/inc/xmloff/txtimp.hxx
+@@ -641,6 +641,7 @@ public:
+ 			const ::com::sun::star::uno::Reference <
+ 				::com::sun::star::text::XTextCursor >& rCursor,
+ 			const ::rtl::OUString& rStyleName,
++			const ::rtl::OUString& rClassNames,
+ 			sal_Bool bPara,
+             sal_Bool bOutlineLevelAttrFound = sal_False,
+             sal_Int8 nOutlineLevel = -1,
+diff --git a/xmloff/inc/xmloff/xmlimp.hxx b/xmloff/inc/xmloff/xmlimp.hxx
+index 99507e7..83e4461 100644
+--- xmloff/inc/xmloff/xmlimp.hxx
++++ xmloff/inc/xmloff/xmlimp.hxx
+@@ -270,6 +270,12 @@ public:
+ 	static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ 	static SvXMLImport* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw();
+ 
++
++        SvXMLImportContext *getTopContext();
++        SvXMLImportContext *createUnknownContext( USHORT nPrefix,
++						  const ::rtl::OUString& rLocalName,
++						  const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
++
+ 	// ::com::sun::star::xml::sax::XDocumentHandler
+ 	virtual void SAL_CALL startDocument(void)
+ 		throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
+index fe927eb..fb15e70 100644
+--- xmloff/inc/xmloff/xmltoken.hxx
++++ xmloff/inc/xmloff/xmltoken.hxx
+@@ -1400,6 +1400,7 @@ namespace xmloff { namespace token {
+         XML_PRINTABLE,
+         XML_PRINTED_BY,
+         XML_PROCEEDINGS,
++	XML_PROCESS_CONTENT,
+         XML_PRODUCT,
+         XML_PROJECTION,
+         XML_PROPERTIES,
+@@ -1689,6 +1690,7 @@ namespace xmloff { namespace token {
+         XML_STRUCTURE_PROTECTED,
+         XML_STYLE,
+         XML_STYLE_NAME,
++        XML_CLASS_NAMES,
+         XML_STYLES,
+         XML_STYLESHEET,
+         XML_SUB_TABLE,
+diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
+index 910f12b..e4714d5 100644
+--- xmloff/source/core/xmlimp.cxx
++++ xmloff/source/core/xmlimp.cxx
+@@ -780,6 +780,42 @@ void SAL_CALL SvXMLImport::startElement( const OUString& rName,
+ 	mpContexts->Insert( pContext, nCount );
+ }
+ 
++SvXMLImportContext *SvXMLImport::getTopContext() {
++    USHORT nCount = mpContexts->Count();
++    if (nCount>0) {
++	SvXMLImportContext *pContext = (*mpContexts)[nCount-1];
++	return pContext;
++    } else {
++	return NULL;
++    }		   
++}
++
++SvXMLImportContext *SvXMLImport::createUnknownContext( USHORT nPrefix,
++					  const ::rtl::OUString& rLocalName,
++					  const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
++{
++    bool bProcessContent=true;
++    sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
++    for(sal_Int16 a=0; a < nAttrCount; a++)
++    {
++	const OUString& rAttrName = xAttrList->getNameByIndex(a);
++	OUString aLocalName;
++	sal_uInt16 _nPrefix = GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
++	const OUString aValue( xAttrList->getValueByIndex(a) );
++	if (_nPrefix==XML_NAMESPACE_OFFICE && IsXMLToken( aLocalName, XML_PROCESS_CONTENT ) ) {
++	    bProcessContent=!aValue.equalsIgnoreAsciiCaseAscii("false");
++	}
++    }
++    SvXMLImportContext *ret=NULL;
++    if (bProcessContent) {
++	ret=getTopContext();
++    }
++    if (ret==NULL) {
++	ret=new SvXMLImportContext( *this, nPrefix, rLocalName );
++    }
++    return ret;
++}
++
+ void SAL_CALL SvXMLImport::endElement( const OUString&
+ #ifndef PRODUCT
+ rName
+diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
+index 0817e86..8e55b5f 100644
+--- xmloff/source/core/xmltoken.cxx
++++ xmloff/source/core/xmltoken.cxx
+@@ -1408,6 +1408,7 @@ namespace xmloff { namespace token {
+         TOKEN( "printable",                       XML_PRINTABLE ),
+         TOKEN( "printed-by",                      XML_PRINTED_BY ),
+         TOKEN( "proceedings",                     XML_PROCEEDINGS ),
++        TOKEN( "process-content",                 XML_PROCESS_CONTENT ),
+         TOKEN( "product",                         XML_PRODUCT ),
+         TOKEN( "projection",                      XML_PROJECTION ),
+         TOKEN( "properties",                      XML_PROPERTIES ),
+@@ -1697,6 +1698,7 @@ namespace xmloff { namespace token {
+         TOKEN( "structure-protected",             XML_STRUCTURE_PROTECTED ),
+         TOKEN( "style",                           XML_STYLE ),
+         TOKEN( "style-name",                      XML_STYLE_NAME ),
++        TOKEN( "class-names",                     XML_CLASS_NAMES ),
+         TOKEN( "styles",                          XML_STYLES ),
+         TOKEN( "stylesheet",                      XML_STYLESHEET ),
+         TOKEN( "sub-table",                       XML_SUB_TABLE ),
+diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
+index d6d3880..ed22434 100644
+--- xmloff/source/draw/shapeimport.cxx
++++ xmloff/source/draw/shapeimport.cxx
+@@ -876,8 +876,8 @@ SvXMLShapeContext* XMLShapeImportHelper::CreateGroupChildContext(
+ // 			break;
+ // 		}
+ 		// add other shapes here...
+-		default:
+-			return new SvXMLShapeContext( rImport, p_nPrefix, rLocalName, bTemporaryShape );
++	    default: 
++		return NULL; // no shape context...
+ 	}
+ 
+ 	// now parse the attribute list and call the child context for each unknown attribute
+diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
+index 69d52a9..58c9e57 100644
+--- xmloff/source/text/txtimp.cxx
++++ xmloff/source/text/txtimp.cxx
+@@ -443,6 +443,8 @@ static __FAR_DATA SvXMLTokenMapEntry aTextPAttrTokenMap[] =
+ 	{ XML_NAMESPACE_TEXT, XML_IS_LIST_HEADER,XML_TOK_TEXT_P_IS_LIST_HEADER },
+ 	{ XML_NAMESPACE_TEXT, XML_RESTART_NUMBERING,XML_TOK_TEXT_P_RESTART_NUMBERING },
+ 	{ XML_NAMESPACE_TEXT, XML_START_VALUE,XML_TOK_TEXT_P_START_VALUE },
++	
++	{ XML_NAMESPACE_TEXT, XML_CLASS_NAMES,	XML_TOK_TEXT_P_CLASS_NAMES },
+ 	XML_TOKEN_MAP_END
+ };
+ 
+@@ -992,6 +994,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
+ 		SvXMLImport& rImport,
+ 		const Reference < XTextCursor >& rCursor,
+ 		const OUString& rStyleName,
++		const OUString& rClassNames,
+ 		sal_Bool bPara,
+         sal_Bool bOutlineLevelAttrFound,
+         sal_Int8 nOutlineLevel,
+@@ -1174,8 +1177,11 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
+ 	}
+ 
+ 	// hard paragraph properties
+-	if( pStyle )
+-	{
++        sal_Int32 nTokenIndex = 0;
++	rtl::OUString aToken;
++	do {
++#if 1
++	    if (pStyle) {
+ 		pStyle->FillPropertySet( xPropSet );
+ 		if( bPara && pStyle->HasMasterPageName() &&
+ 			xPropSetInfo->hasPropertyByName( sPageDescName ) )
+@@ -1237,7 +1243,19 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
+ 				}
+ 			}
+ 		}
+-	}
++	    }
++	    aToken = rClassNames.getToken( 0, ' ', nTokenIndex );
++	    if (aToken.getLength() && xAutoStyles.Is() )
++	    {
++		pStyle = PTR_CAST( XMLTextStyleContext,
++				   ((SvXMLStylesContext *)&xAutoStyles)->
++				   FindStyleChildContext( nFamily, aToken, sal_True ) );
++	    } else {
++		pStyle=NULL;
++		aToken=rtl::OUString();
++	    }
++#endif
++	} while (pStyle!=NULL || aToken.getLength()>0);
+ 
+     // outline level; set after list style has been set
+     // --> OD 2005-08-25 #i53198#
+@@ -1973,8 +1991,9 @@ SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext(
+ 		}
+ 	}
+ 
+-//	if( !pContext )
+-//		pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
++	if (pContext==NULL) {
++	    pContext=rImport.createUnknownContext(nPrefix, rLocalName, xAttrList);
++	}
+ 
+ 	// handle open redlines
+ 	if ( (XML_TOK_TEXT_CHANGE != nToken) &&
+diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
+index 91d27e6..237cc3e 100644
+--- xmloff/source/text/txtparai.cxx
++++ xmloff/source/text/txtparai.cxx
+@@ -1529,23 +1529,22 @@ SvXMLImportContext *XMLImpSpanContext_Impl::CreateChildContext(
+             SvXMLShapeContext* pShapeContext = rImport.GetShapeImport()->CreateGroupChildContext(
+                 rImport, nPrefix, rLocalName, xAttrList, xShapes );
+             pContext = pShapeContext;
+-            // OD 2004-04-20 #i26791# - keep shape in a text frame hint to
+-            // adjust its anchor position, if its at-character anchored
+-            Reference < XTextRange > xAnchorPos =
+-                rImport.GetTextImport()->GetCursor()->getStart();
+-            rHints.Insert( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ),
+-                           rHints.Count() );
++	    if (pContext) {
++		// OD 2004-04-20 #i26791# - keep shape in a text frame hint to
++		// adjust its anchor position, if its at-character anchored	    
++		Reference < XTextRange > xAnchorPos =
++		    rImport.GetTextImport()->GetCursor()->getStart();
++		rHints.Insert( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ),
++			       rHints.Count() );
++	    }
+         }
+ 		if( !pContext )
+ 		{
+-			// ignore unknown content
+-			pContext =
+-				new SvXMLImportContext( rImport, nPrefix, rLocalName );
++		    pContext=rImport.createUnknownContext(nPrefix, rLocalName, xAttrList);
+ 		}
+ 		// Behind fields, shapes and any unknown content blanks aren't ignored
+ 		rIgnoreLeadingSpace = sal_False;
+ 	}
+-
+ 	return pContext;
+ }
+ 
+@@ -1602,7 +1601,7 @@ XMLParaContext::XMLParaContext(
+ 	const SvXMLTokenMap& rTokenMap =
+ 		GetImport().GetTextImport()->GetTextPAttrTokenMap();
+ 
+-	OUString aCondStyleName, sClassNames;
++	OUString sStyleName, aCondStyleName, sClassNames;
+ 
+ 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ 	for( sal_Int16 i=0; i < nAttrCount; i++ )
+@@ -1668,18 +1667,24 @@ XMLParaContext::XMLParaContext(
+             break;
+ 		}
+ 	}
+-
++	m_sClassNames = sClassNames;
+ 	if( aCondStyleName.getLength() )
+-		sStyleName = aCondStyleName;
+-	else if( sClassNames.getLength() )
+-	{
+-		sal_Int32 nDummy = 0;
+-		sStyleName = sClassNames.getToken( 0, ' ', nDummy );
++	    m_sStyleName = aCondStyleName;
++	else {
++	    m_sStyleName = sStyleName;
++	}
++	if (m_sStyleName.getLength()==0 && sClassNames.getLength()>0) {
++	    // so when we only have class names make sure the first styles
++	    // of the class names is the style name
++	    sal_Int32 nDummy = 0;
++	    m_sStyleName = m_sClassNames.getToken( 0, ' ', nDummy );
++	    m_sClassNames = m_sClassNames.copy(m_sStyleName.getLength()+1);
+ 	}
+ }
+ 
+ XMLParaContext::~XMLParaContext()
+ {
++    rtl::OUString sStyleName = m_sStyleName;
+ 	UniReference < XMLTextImportHelper > xTxtImport(
+ 		GetImport().GetTextImport());
+     Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() );
+@@ -1718,6 +1723,7 @@ XMLParaContext::~XMLParaContext()
+         // because of side effects of method <SetStyleAndAttrs(..)>
+         xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
+                                       sCellParaStyleName,
++				      OUString(),
+                                       sal_True,
+                                       sal_False, -1, // suppress outline handling
+                                       sal_False );   // suppress list attributes handling
+@@ -1732,6 +1738,7 @@ XMLParaContext::~XMLParaContext()
+     // --> OD 2007-07-25 #i73509# - add paramter <mbOutlineLevelAttrFound>
+     sStyleName = xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
+                                                sStyleName,
++					       m_sClassNames,
+                                                sal_True,
+                                                mbOutlineLevelAttrFound,
+                                                bHeading ? nOutlineLevel : -1 );
+@@ -1794,7 +1801,7 @@ XMLParaContext::~XMLParaContext()
+ 							((XMLStyleHint_Impl *)pHint)->GetStyleName();
+ 					if( rStyleName.getLength() )
+ 						xTxtImport->SetStyleAndAttrs( GetImport(),
+-													  xAttrCursor, rStyleName,
++									      xAttrCursor, rStyleName, OUString(), 
+                                                       sal_False );
+ 				}
+ 				break;
+@@ -1965,7 +1972,7 @@ SvXMLImportContext *XMLParaContext::CreateChildContext(
+ void XMLParaContext::Characters( const OUString& rChars )
+ {
+ 	OUString sChars =
+-		GetImport().GetTextImport()->ConvertStarFonts( rChars, sStyleName,
++		GetImport().GetTextImport()->ConvertStarFonts( rChars, m_sStyleName,
+ 													   nStarFontsConvFlags,
+ 													   sal_True, GetImport() );
+ 	GetImport().GetTextImport()->InsertString( sChars, bIgnoreLeadingSpace );
+diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
+index bfbfc08..db44166 100644
+--- xmloff/source/text/txtparai.hxx
++++ xmloff/source/text/txtparai.hxx
+@@ -58,7 +58,8 @@ class XMLParaContext : public SvXMLImportContext
+ {
+ 	::com::sun::star::uno::Reference <
+ 		::com::sun::star::text::XTextRange > xStart;	// xub_StrLen nStart;
+-	::rtl::OUString				sStyleName;
++	::rtl::OUString				m_sStyleName;
++	::rtl::OUString				m_sClassNames;
+ 	::rtl::OUString				sId;
+ 	sal_Int8 				nOutlineLevel;
+ 	XMLHints_Impl			*pHints;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]