update dev300-m57
[ooovba.git] / applied_patches / 0630-xmloff_dis26300_conformance.diff
blobdfaacfa0148c52b89f22d7718fb6ea5ad84868a3
1 --- sw/source/filter/xml/xmltbli.cxx.old 2009-04-02 10:50:08.000000000 +0000
2 +++ sw/source/filter/xml/xmltbli.cxx 2009-04-06 16:42:18.000000000 +0000
3 @@ -2792,7 +2792,7 @@ const SwStartNode *SwXMLTableContext::In
4 bFirstSection = sal_False;
5 OUString sStyleName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
6 GetImport().GetTextImport()->SetStyleAndAttrs( GetImport(),
7 - GetImport().GetTextImport()->GetCursor(), sStyleName, sal_True );
8 + GetImport().GetTextImport()->GetCursor(), sStyleName, rtl::OUString(), sal_True );
10 else
12 --- xmloff/inc/xmloff/txtimp.hxx.old 2009-04-02 10:36:09.000000000 +0000
13 +++ xmloff/inc/xmloff/txtimp.hxx 2009-04-06 16:42:18.000000000 +0000
14 @@ -630,6 +630,7 @@ public:
15 const ::com::sun::star::uno::Reference <
16 ::com::sun::star::text::XTextCursor >& rCursor,
17 const ::rtl::OUString& rStyleName,
18 + const ::rtl::OUString& rClassNames,
19 sal_Bool bPara,
20 sal_Bool bOutlineLevelAttrFound = sal_False,
21 sal_Int8 nOutlineLevel = -1,
22 --- xmloff/inc/xmloff/xmlimp.hxx.old 2009-04-02 10:36:09.000000000 +0000
23 +++ xmloff/inc/xmloff/xmlimp.hxx 2009-04-06 16:42:18.000000000 +0000
24 @@ -211,6 +211,12 @@ public:
25 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
26 static SvXMLImport* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ) throw();
29 + SvXMLImportContext *getTopContext();
30 + SvXMLImportContext *createUnknownContext( USHORT nPrefix,
31 + const ::rtl::OUString& rLocalName,
32 + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
34 // ::com::sun::star::xml::sax::XDocumentHandler
35 virtual void SAL_CALL startDocument(void)
36 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
37 --- xmloff/inc/xmloff/xmltoken.hxx.old 2009-04-06 16:41:51.000000000 +0000
38 +++ xmloff/inc/xmloff/xmltoken.hxx 2009-04-06 16:42:18.000000000 +0000
39 @@ -1400,6 +1400,7 @@ namespace xmloff { namespace token {
40 XML_PRINTABLE,
41 XML_PRINTED_BY,
42 XML_PROCEEDINGS,
43 + XML_PROCESS_CONTENT,
44 XML_PRODUCT,
45 XML_PROJECTION,
46 XML_PROPERTIES,
47 @@ -1689,6 +1690,7 @@ namespace xmloff { namespace token {
48 XML_STRUCTURE_PROTECTED,
49 XML_STYLE,
50 XML_STYLE_NAME,
51 + XML_CLASS_NAMES,
52 XML_STYLES,
53 XML_STYLESHEET,
54 XML_SUB_TABLE,
55 --- xmloff/source/core/xmlimp.cxx.old 2009-04-06 16:41:46.000000000 +0000
56 +++ xmloff/source/core/xmlimp.cxx 2009-04-06 16:42:18.000000000 +0000
57 @@ -718,6 +718,42 @@ void SAL_CALL SvXMLImport::startElement(
58 mpContexts->Insert( pContext, nCount );
61 +SvXMLImportContext *SvXMLImport::getTopContext() {
62 + USHORT nCount = mpContexts->Count();
63 + if (nCount>0) {
64 + SvXMLImportContext *pContext = (*mpContexts)[nCount-1];
65 + return pContext;
66 + } else {
67 + return NULL;
68 + }
71 +SvXMLImportContext *SvXMLImport::createUnknownContext( USHORT nPrefix,
72 + const ::rtl::OUString& rLocalName,
73 + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
75 + bool bProcessContent=true;
76 + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
77 + for(sal_Int16 a=0; a < nAttrCount; a++)
78 + {
79 + const OUString& rAttrName = xAttrList->getNameByIndex(a);
80 + OUString aLocalName;
81 + sal_uInt16 _nPrefix = GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName);
82 + const OUString aValue( xAttrList->getValueByIndex(a) );
83 + if (_nPrefix==XML_NAMESPACE_OFFICE && IsXMLToken( aLocalName, XML_PROCESS_CONTENT ) ) {
84 + bProcessContent=!aValue.equalsIgnoreAsciiCaseAscii("false");
85 + }
86 + }
87 + SvXMLImportContext *ret=NULL;
88 + if (bProcessContent) {
89 + ret=getTopContext();
90 + }
91 + if (ret==NULL) {
92 + ret=new SvXMLImportContext( *this, nPrefix, rLocalName );
93 + }
94 + return ret;
97 void SAL_CALL SvXMLImport::endElement( const OUString&
98 #ifndef PRODUCT
99 rName
100 --- xmloff/source/core/xmltoken.cxx.old 2009-04-06 16:41:51.000000000 +0000
101 +++ xmloff/source/core/xmltoken.cxx 2009-04-06 16:42:18.000000000 +0000
102 @@ -1408,6 +1408,7 @@ namespace xmloff { namespace token {
103 TOKEN( "printable", XML_PRINTABLE ),
104 TOKEN( "printed-by", XML_PRINTED_BY ),
105 TOKEN( "proceedings", XML_PROCEEDINGS ),
106 + TOKEN( "process-content", XML_PROCESS_CONTENT ),
107 TOKEN( "product", XML_PRODUCT ),
108 TOKEN( "projection", XML_PROJECTION ),
109 TOKEN( "properties", XML_PROPERTIES ),
110 @@ -1697,6 +1698,7 @@ namespace xmloff { namespace token {
111 TOKEN( "structure-protected", XML_STRUCTURE_PROTECTED ),
112 TOKEN( "style", XML_STYLE ),
113 TOKEN( "style-name", XML_STYLE_NAME ),
114 + TOKEN( "class-names", XML_CLASS_NAMES ),
115 TOKEN( "styles", XML_STYLES ),
116 TOKEN( "stylesheet", XML_STYLESHEET ),
117 TOKEN( "sub-table", XML_SUB_TABLE ),
118 --- xmloff/source/draw/shapeimport.cxx.old 2009-04-02 10:36:08.000000000 +0000
119 +++ xmloff/source/draw/shapeimport.cxx 2009-04-06 16:42:18.000000000 +0000
120 @@ -834,8 +834,8 @@ SvXMLShapeContext* XMLShapeImportHelper:
121 return new SdXMLShapeLinkContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes );
123 // add other shapes here...
124 - default:
125 - return new SvXMLShapeContext( rImport, p_nPrefix, rLocalName, bTemporaryShape );
126 + default:
127 + return NULL; // no shape context...
130 // now parse the attribute list and call the child context for each unknown attribute
131 --- xmloff/source/text/txtimp.cxx.old 2009-04-02 10:36:05.000000000 +0000
132 +++ xmloff/source/text/txtimp.cxx 2009-04-06 16:42:18.000000000 +0000
133 @@ -336,6 +336,8 @@ static __FAR_DATA SvXMLTokenMapEntry aTe
134 { XML_NAMESPACE_TEXT, XML_IS_LIST_HEADER,XML_TOK_TEXT_P_IS_LIST_HEADER },
135 { XML_NAMESPACE_TEXT, XML_RESTART_NUMBERING,XML_TOK_TEXT_P_RESTART_NUMBERING },
136 { XML_NAMESPACE_TEXT, XML_START_VALUE,XML_TOK_TEXT_P_START_VALUE },
138 + { XML_NAMESPACE_TEXT, XML_CLASS_NAMES, XML_TOK_TEXT_P_CLASS_NAMES },
139 XML_TOKEN_MAP_END
142 @@ -931,6 +933,7 @@ OUString XMLTextImportHelper::SetStyleAn
143 SvXMLImport& rImport,
144 const Reference < XTextCursor >& rCursor,
145 const OUString& rStyleName,
146 + const OUString& rClassNames,
147 sal_Bool bPara,
148 sal_Bool bOutlineLevelAttrFound,
149 sal_Int8 nOutlineLevel,
150 @@ -1158,8 +1161,11 @@ OUString XMLTextImportHelper::SetStyleAn
153 // hard paragraph properties
154 - if( pStyle )
156 + sal_Int32 nTokenIndex = 0;
157 + rtl::OUString aToken;
158 + do {
159 +#if 1
160 + if (pStyle) {
161 pStyle->FillPropertySet( xPropSet );
162 if( bPara && pStyle->HasMasterPageName() &&
163 xPropSetInfo->hasPropertyByName( sPageDescName ) )
164 @@ -1221,7 +1227,19 @@ OUString XMLTextImportHelper::SetStyleAn
170 + aToken = rClassNames.getToken( 0, ' ', nTokenIndex );
171 + if (aToken.getLength() && xAutoStyles.Is() )
173 + pStyle = PTR_CAST( XMLTextStyleContext,
174 + ((SvXMLStylesContext *)&xAutoStyles)->
175 + FindStyleChildContext( nFamily, aToken, sal_True ) );
176 + } else {
177 + pStyle=NULL;
178 + aToken=rtl::OUString();
180 +#endif
181 + } while (pStyle!=NULL || aToken.getLength()>0);
183 // outline level; set after list style has been set
184 // --> OD 2005-08-25 #i53198#
185 @@ -1996,8 +2014,9 @@ SvXMLImportContext *XMLTextImportHelper:
189 -// if( !pContext )
190 -// pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
191 + if (pContext==NULL) {
192 + pContext=rImport.createUnknownContext(nPrefix, rLocalName, xAttrList);
195 // handle open redlines
196 if ( (XML_TOK_TEXT_CHANGE != nToken) &&
197 --- xmloff/source/text/txtparai.cxx.old 2009-04-02 10:36:05.000000000 +0000
198 +++ xmloff/source/text/txtparai.cxx 2009-04-06 16:42:18.000000000 +0000
199 @@ -1599,23 +1599,22 @@ SvXMLImportContext *XMLImpSpanContext_Im
200 SvXMLShapeContext* pShapeContext = rImport.GetShapeImport()->CreateGroupChildContext(
201 rImport, nPrefix, rLocalName, xAttrList, xShapes );
202 pContext = pShapeContext;
203 - // OD 2004-04-20 #i26791# - keep shape in a text frame hint to
204 - // adjust its anchor position, if its at-character anchored
205 - Reference < XTextRange > xAnchorPos =
206 - rImport.GetTextImport()->GetCursor()->getStart();
207 - rHints.Insert( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ),
208 - rHints.Count() );
209 + if (pContext) {
210 + // OD 2004-04-20 #i26791# - keep shape in a text frame hint to
211 + // adjust its anchor position, if its at-character anchored
212 + Reference < XTextRange > xAnchorPos =
213 + rImport.GetTextImport()->GetCursor()->getStart();
214 + rHints.Insert( new XMLDrawHint_Impl( pShapeContext, xAnchorPos ),
215 + rHints.Count() );
218 if( !pContext )
220 - // ignore unknown content
221 - pContext =
222 - new SvXMLImportContext( rImport, nPrefix, rLocalName );
223 + pContext=rImport.createUnknownContext(nPrefix, rLocalName, xAttrList);
225 // Behind fields, shapes and any unknown content blanks aren't ignored
226 rIgnoreLeadingSpace = sal_False;
229 return pContext;
232 @@ -1672,7 +1671,7 @@ XMLParaContext::XMLParaContext(
233 const SvXMLTokenMap& rTokenMap =
234 GetImport().GetTextImport()->GetTextPAttrTokenMap();
236 - OUString aCondStyleName, sClassNames;
237 + OUString sStyleName, aCondStyleName, sClassNames;
239 sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
240 for( sal_Int16 i=0; i < nAttrCount; i++ )
241 @@ -1742,18 +1741,24 @@ XMLParaContext::XMLParaContext(
242 break;
246 + m_sClassNames = sClassNames;
247 if( aCondStyleName.getLength() )
248 - sStyleName = aCondStyleName;
249 - else if( sClassNames.getLength() )
251 - sal_Int32 nDummy = 0;
252 - sStyleName = sClassNames.getToken( 0, ' ', nDummy );
253 + m_sStyleName = aCondStyleName;
254 + else {
255 + m_sStyleName = sStyleName;
257 + if (m_sStyleName.getLength()==0 && sClassNames.getLength()>0) {
258 + // so when we only have class names make sure the first styles
259 + // of the class names is the style name
260 + sal_Int32 nDummy = 0;
261 + m_sStyleName = m_sClassNames.getToken( 0, ' ', nDummy );
262 + m_sClassNames = m_sClassNames.copy(m_sStyleName.getLength()+1);
266 XMLParaContext::~XMLParaContext()
268 + rtl::OUString sStyleName = m_sStyleName;
269 UniReference < XMLTextImportHelper > xTxtImport(
270 GetImport().GetTextImport());
271 Reference < XTextRange > xCrsrRange( xTxtImport->GetCursorAsRange() );
272 @@ -1812,6 +1817,7 @@ XMLParaContext::~XMLParaContext()
273 // because of side effects of method <SetStyleAndAttrs(..)>
274 xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
275 sCellParaStyleName,
276 + OUString(),
277 sal_True,
278 sal_False, -1, // suppress outline handling
279 sal_False ); // suppress list attributes handling
280 @@ -1826,6 +1832,7 @@ XMLParaContext::~XMLParaContext()
281 // --> OD 2007-07-25 #i73509# - add paramter <mbOutlineLevelAttrFound>
282 sStyleName = xTxtImport->SetStyleAndAttrs( GetImport(), xAttrCursor,
283 sStyleName,
284 + m_sClassNames,
285 sal_True,
286 mbOutlineLevelAttrFound,
287 bHeading ? nOutlineLevel : -1 );
288 @@ -1888,7 +1895,7 @@ XMLParaContext::~XMLParaContext()
289 ((XMLStyleHint_Impl *)pHint)->GetStyleName();
290 if( rStyleName.getLength() )
291 xTxtImport->SetStyleAndAttrs( GetImport(),
292 - xAttrCursor, rStyleName,
293 + xAttrCursor, rStyleName, OUString(),
294 sal_False );
296 break;
297 @@ -2059,7 +2066,7 @@ SvXMLImportContext *XMLParaContext::Crea
298 void XMLParaContext::Characters( const OUString& rChars )
300 OUString sChars =
301 - GetImport().GetTextImport()->ConvertStarFonts( rChars, sStyleName,
302 + GetImport().GetTextImport()->ConvertStarFonts( rChars, m_sStyleName,
303 nStarFontsConvFlags,
304 sal_True, GetImport() );
305 GetImport().GetTextImport()->InsertString( sChars, bIgnoreLeadingSpace );
306 --- xmloff/source/text/txtparai.hxx.old 2009-04-02 10:36:05.000000000 +0000
307 +++ xmloff/source/text/txtparai.hxx 2009-04-06 16:42:18.000000000 +0000
308 @@ -48,7 +48,8 @@ class XMLParaContext : public SvXMLImpor
310 ::com::sun::star::uno::Reference <
311 ::com::sun::star::text::XTextRange > xStart; // xub_StrLen nStart;
312 - ::rtl::OUString sStyleName;
313 + ::rtl::OUString m_sStyleName;
314 + ::rtl::OUString m_sClassNames;
315 ::rtl::OUString sId;
316 ::rtl::OUString sXmlId;
317 sal_Int8 nOutlineLevel;