1 diff --git oox/inc/oox/core/namespaces.hxx oox/inc/oox/core/namespaces.hxx
2 deleted file mode 100644
4 --- oox/inc/oox/core/namespaces.hxx
7 -/*************************************************************************
9 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11 - * Copyright 2008 by Sun Microsystems, Inc.
13 - * OpenOffice.org - a multi-platform office productivity suite
15 - * $RCSfile: namespaces.hxx,v $
16 - * $Revision: 1.5.4.1 $
18 - * This file is part of OpenOffice.org.
20 - * OpenOffice.org is free software: you can redistribute it and/or modify
21 - * it under the terms of the GNU Lesser General Public License version 3
22 - * only, as published by the Free Software Foundation.
24 - * OpenOffice.org is distributed in the hope that it will be useful,
25 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 - * GNU Lesser General Public License version 3 for more details
28 - * (a copy is included in the LICENSE file that accompanied this code).
30 - * You should have received a copy of the GNU Lesser General Public License
31 - * version 3 along with OpenOffice.org. If not, see
32 - * <http://www.openoffice.org/license.html>
33 - * for a copy of the LGPLv3 License.
35 - ************************************************************************/
37 -#ifndef OOX_CORE_NAMESPACES_HXX
38 -#define OOX_CORE_NAMESPACES_HXX
40 -#include <sal/types.h>
44 -// ============================================================================
47 -const sal_Int32 NMSP_XML = 1 << 16;
48 -const sal_Int32 NMSP_PACKAGE_RELATIONSHIPS = 2 << 16;
49 -const sal_Int32 NMSP_RELATIONSHIPS = 3 << 16;
50 -const sal_Int32 NMSP_CONTENT_TYPES = 4 << 16;
52 -const sal_Int32 NMSP_ACTIVATION = 12 << 16;
54 -const sal_Int32 NMSP_DRAWINGML = 21 << 16;
55 -const sal_Int32 NMSP_DIAGRAM = 22 << 16;
56 -const sal_Int32 NMSP_CHART = 23 << 16;
58 -const sal_Int32 NMSP_VML = 31 << 16;
59 -const sal_Int32 NMSP_OFFICE = 32 << 16;
60 -const sal_Int32 NMSP_VML_DOC = 33 << 16; // Word VML
61 -const sal_Int32 NMSP_VML_XLS = 34 << 16; // Excel VML
62 -const sal_Int32 NMSP_VML_PPT = 35 << 16; // PowerPoint VML
63 -const sal_Int32 NMSP_AX = 36 << 16; // ActiveX (for OCX form controls)
65 -const sal_Int32 NMSP_XLS = 41 << 16;
66 -const sal_Int32 NMSP_XDR = 42 << 16; // SpreadsheetDrawingML
67 -const sal_Int32 NMSP_XM = 43 << 16; // Macro sheet
69 -const sal_Int32 NMSP_PPT = 51 << 16;
70 -// Document properties
71 -const sal_Int32 NMSP_COREPR = 61 << 16;
72 -const sal_Int32 NMSP_DC = 62 << 16;
73 -const sal_Int32 NMSP_DCTERMS = 63 << 16;
74 -const sal_Int32 NMSP_EXTPR = 64 << 16;
75 -const sal_Int32 NMSP_CUSTPR = 65 << 16;
76 -const sal_Int32 NMSP_VT = 66 << 16;
78 -// ----------------------------------------------------------------------------
80 -const sal_Int32 TOKEN_MASK = SAL_MAX_UINT16;
81 -const sal_Int32 NMSP_MASK = SAL_MAX_INT16 << 16;
83 -/** Returns the token identifier of the passed element without namespace. */
84 -inline sal_Int32 getToken( sal_Int32 nElement ) { return nElement & TOKEN_MASK; }
86 -/** Returns the namespace of the passed element without token identifier. */
87 -inline sal_Int32 getNamespace( sal_Int32 nElement ) { return nElement & NMSP_MASK; }
89 -// ============================================================================
93 -#endif // OOX_CORE_NAMESPACES_HXX
95 diff --git oox/inc/oox/vml/shape.hxx oox/inc/oox/vml/shape.hxx
96 index ce2c3ea..6ff095c 100644
97 --- oox/inc/oox/vml/shape.hxx
98 +++ oox/inc/oox/vml/shape.hxx
99 @@ -72,9 +72,17 @@ class Shape
100 sal_Int32 mnCoordWidth;
101 sal_Int32 mnCoordHeight;
103 + sal_Int32 mnZOrder;
104 + bool mbContainsText;
106 - ::boost::optional< sal_Int32 > moFilled;
107 - ::boost::optional< rtl::OUString > moFillColor;
108 + ::boost::optional< sal_Bool > moFilled;
109 + ::boost::optional< sal_Int32 > moFillType;
110 + ::boost::optional< sal_Int32 > moFillColor;
111 + ::boost::optional< rtl::OUString > moFillImageUrl;
112 + sal_Int32 meFillImageMode;
114 + ::boost::optional< sal_Int32 > moStrokeColor;
115 + ::boost::optional< sal_Int32 > moStrokeWeight;
117 rtl::OUString msGraphicURL;
118 rtl::OUString msImageTitle;
119 @@ -96,12 +104,19 @@ class Shape
120 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
121 const ::com::sun::star::awt::Rectangle* pShapeRect );
123 + void updateShape( );
127 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
128 createAndInsert( const ::oox::core::XmlFilterBase& rFilterBase, const ::oox::vml::Shape& rShape,
129 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
130 const ::com::sun::star::awt::Rectangle* pShapeRect );
132 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
133 + createAndInsertFrame( const ::oox::core::XmlFilterBase& rFilterBase, const ::oox::vml::Shape& rShape,
134 + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
135 + const ::com::sun::star::awt::Rectangle* pShapeRect );
137 void addChilds( const ::oox::core::XmlFilterBase& rFilterBase, const ::oox::vml::Drawing& rDrawing,
138 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
139 diff --git oox/prj/d.lst oox/prj/d.lst
140 index 2bf664a..48d59a7 100644
143 @@ -17,6 +17,7 @@ mkdir: %_DEST%\inc%_EXT%\oox\drawingml\table
145 ..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
146 ..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt
147 +..\source\token\namespaces.txt %_DEST%\inc%_EXT%\oox\namespaces.txt
148 ..\inc\oox\core\filterbase.hxx %_DEST%\inc%_EXT%\oox\core\filterbase.hxx
149 ..\inc\oox\core\relations.hxx %_DEST%\inc%_EXT%\oox\core\relations.hxx
150 ..\%__SRC%\inc\tokens.hxx %_DEST%\inc%_EXT%\oox\core\tokens.hxx
151 diff --git oox/source/shape/ShapeContextHandler.cxx oox/source/shape/ShapeContextHandler.cxx
152 index d7b2784..470eac3 100644
153 --- oox/source/shape/ShapeContextHandler.cxx
154 +++ oox/source/shape/ShapeContextHandler.cxx
156 #include "oox/vml/drawingfragmenthandler.hxx"
157 #include "tokens.hxx"
161 +using namespace std;
164 namespace oox { namespace shape {
166 using namespace ::com::sun::star;
167 @@ -89,6 +94,9 @@ ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element )
168 uno::Reference<xml::sax::XFastContextHandler>
169 ShapeContextHandler::getDrawingShapeContext()
172 + clog << "ShapeContextHandler::getDrawingShapeContext" << endl;
174 if (!mxDrawingFragmentHandler.is())
176 mpDrawing.reset( new oox::vml::Drawing() );
177 @@ -108,6 +116,7 @@ ShapeContextHandler::getContextHandler()
179 switch (mnStartToken & NMSP_MASK)
183 xResult.set(getDrawingShapeContext());
185 @@ -178,6 +187,9 @@ ShapeContextHandler::createFastChildContext
186 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
187 throw (uno::RuntimeException, xml::sax::SAXException)
190 + clog << "ShapeContextHandler::createFastChildContext" << endl;
192 uno::Reference< xml::sax::XFastContextHandler > xResult;
193 uno::Reference< xml::sax::XFastContextHandler > xContextHandler(getContextHandler());
195 diff --git oox/source/token/gennamespaces.pl oox/source/token/gennamespaces.pl
197 index 0000000..8c2ede6
199 +++ oox/source/token/gennamespaces.pl
201 +$ARGV0 = shift @ARGV;
202 +$ARGV1 = shift @ARGV;
204 +open ( NAMESPACES, $ARGV0 ) || die "can't open namespaces file: $!";
207 +open ( HXX, ">$ARGV1" ) or die "can't open namespaces.hxx file: $!";
209 +print ( HXX "#ifndef OOX_NAMESPACES_HXX\n" );
210 +print ( HXX "#define OOX_NAMESPACES_HXX\n\n" );
211 +print ( HXX "#include <sal/types.h>\n\n" );
212 +print ( HXX "namespace oox {\n\n" );
216 +while ( <NAMESPACES> )
222 + # Start a new group
223 + print ( HXX "\n" );
227 + elsif ( $_ =~ m/^[^#]/ )
229 + # Neither an empty line nor a comment
230 + $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Invalid namespace token $_";
233 + $no = $group*10 + $i;
234 + print ( HXX "const sal_Int32 $id = $no << 16;\n" );
238 +close ( NAMESPACES );
240 +print ( HXX "\nconst sal_Int32 TOKEN_MASK = SAL_MAX_UINT16;\n" );
241 +print ( HXX "const sal_Int32 NMSP_MASK = SAL_MAX_INT16 << 16;\n" );
243 +print ( HXX "/** Returns the token identifier of the passed element without namespace. */\n" );
244 +print ( HXX "inline sal_Int32 getToken( sal_Int32 nElement ) { return nElement & TOKEN_MASK; }\n\n" );
246 +print ( HXX "/** Returns the namespace of the passed element without token identifier. */\n" );
247 +print ( HXX "inline sal_Int32 getNamespace( sal_Int32 nElement ) { return nElement & NMSP_MASK; }\n\n" );
249 +print ( HXX "} // namespace oox\n\n" );
250 +print ( HXX "#endif // OOX_NAMESPACES_HXX\n" );
251 diff --git oox/source/token/makefile.mk oox/source/token/makefile.mk
252 index bd1a4e3..4174830 100644
253 --- oox/source/token/makefile.mk
254 +++ oox/source/token/makefile.mk
255 @@ -50,14 +50,24 @@ SLOFILES = \
259 -$(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx :
260 +$(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/oox$/core$/namespaces.hxx :
261 @@noop $(assign do_phony:=.PHONY)
263 $(MISC)$/do_tokens $(do_phony) : tokens.txt gentoken.pl $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx
264 - $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@
265 + $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@
268 + $(MKDIR) $(INCCOM)$/oox
270 +$(INCCOM)$/oox$/core: $(INCCOM)$/oox
271 + $(MKDIR) $(INCCOM)$/oox$/core
273 +$(MISC)$/do_namespaces $(do_phony) : namespaces.txt gennamespaces.pl
274 + $(MKDIRHIER) $(INCCOM)$/oox$/core
275 + $(PERL) gennamespaces.pl namespaces.txt $(INCCOM)$/oox$/core$/namespaces.hxx && $(TOUCH) $@
277 $(INCCOM)$/tokens.inc : $(MISC)$/tokens.gperf $(MISC)$/do_tokens
278 gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokens.inc
280 -$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(MISC)$/do_tokens
281 +$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/oox$/core$/namespaces.hxx $(MISC)$/do_tokens $(MISC)$/do_namespaces
283 diff --git oox/source/token/namespaces.txt oox/source/token/namespaces.txt
285 index 0000000..63ca76e
287 +++ oox/source/token/namespaces.txt
291 +PACKAGE_RELATIONSHIPS
327 +# Document properties
335 +# Other elements: used by writerfilter
337 diff --git oox/source/vml/vmldrawingfragmenthandler.cxx oox/source/vml/vmldrawingfragmenthandler.cxx
338 index a1dfb2e..802e82f 100644
339 --- oox/source/vml/vmldrawingfragmenthandler.cxx
340 +++ oox/source/vml/vmldrawingfragmenthandler.cxx
342 #include "oox/core/contexthandler.hxx"
343 #include <com/sun/star/beans/XMultiPropertySet.hpp>
344 #include <com/sun/star/container/XNamed.hpp>
345 +#include <com/sun/star/drawing/BitmapMode.hpp>
346 +#include <com/sun/star/drawing/FillStyle.hpp>
347 #include <com/sun/star/drawing/PointSequence.hpp>
348 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
349 #include "oox/core/namespaces.hxx"
350 #include "tokens.hxx"
354 +using namespace std;
358 using ::rtl::OUString;
359 using namespace ::com::sun::star;
360 using namespace ::oox::core;
361 @@ -50,6 +58,85 @@ using namespace ::com::sun::star::container;
363 namespace oox { namespace vml {
365 +static sal_Int32 getColor( const rtl::OUString& rColor )
368 + rtl::OUString sValue ( rColor.getToken( 0, ' ', nId ) );
370 + static const rtl::OUString aColorNames[] =
372 + rtl::OUString::createFromAscii( "Black" ),
373 + rtl::OUString::createFromAscii( "Silver" ),
374 + rtl::OUString::createFromAscii( "Gray" ),
375 + rtl::OUString::createFromAscii( "White" ),
376 + rtl::OUString::createFromAscii( "Maroon" ),
377 + rtl::OUString::createFromAscii( "Red" ),
378 + rtl::OUString::createFromAscii( "Purple" ),
379 + rtl::OUString::createFromAscii( "Fuchsia" ),
380 + rtl::OUString::createFromAscii( "Green" ),
381 + rtl::OUString::createFromAscii( "Lime" ),
382 + rtl::OUString::createFromAscii( "Olive" ),
383 + rtl::OUString::createFromAscii( "Yellow" ),
384 + rtl::OUString::createFromAscii( "Navy" ),
385 + rtl::OUString::createFromAscii( "Blue" ),
386 + rtl::OUString::createFromAscii( "Teal" ),
387 + rtl::OUString::createFromAscii( "Aqua" )
390 + static const rtl::OUString aColorValues[] =
392 + rtl::OUString::createFromAscii( "000000" ),
393 + rtl::OUString::createFromAscii( "C0C0C0" ),
394 + rtl::OUString::createFromAscii( "808080" ),
395 + rtl::OUString::createFromAscii( "FFFFFF" ),
396 + rtl::OUString::createFromAscii( "800000" ),
397 + rtl::OUString::createFromAscii( "FF0000" ),
398 + rtl::OUString::createFromAscii( "800080" ),
399 + rtl::OUString::createFromAscii( "FF00FF" ),
400 + rtl::OUString::createFromAscii( "008000" ),
401 + rtl::OUString::createFromAscii( "00FF00" ),
402 + rtl::OUString::createFromAscii( "808000" ),
403 + rtl::OUString::createFromAscii( "FFFF00" ),
404 + rtl::OUString::createFromAscii( "000080" ),
405 + rtl::OUString::createFromAscii( "0000FF" ),
406 + rtl::OUString::createFromAscii( "008080" ),
407 + rtl::OUString::createFromAscii( "00FFFF" )
410 + rtl::OUString sHexValue;
411 + if ( sValue.compareToAscii( "#", 1 ) == 0 )
413 + // Removes the # of the hexa value if needed
414 + sHexValue = sValue.copy( 1 );
416 + // Check if the color is 6 or 3 chars long
417 + if ( sHexValue.getLength( ) == 3 )
419 + // All the characters have to be doubled
420 + OUString sRed = sHexValue.copy( 0, 1 );
421 + OUString sGreen = sHexValue.copy( 1, 1 );
422 + OUString sBlue = sHexValue.copy( 2, 1 );
424 + sHexValue = sRed + sRed + sGreen + sGreen + sGreen + sBlue + sBlue;
429 + // Convert the color name into an hexa value
431 + while ( sHexValue.getLength( ) == 0 && i < 16 )
433 + if ( sValue.equalsIgnoreAsciiCase( aColorNames[i] ) )
435 + sHexValue = aColorValues[i];
441 + return sHexValue.toInt32( sal_Int16( 16 ) );
444 static sal_Int32 getMeasure( const rtl::OUString& rVal )
446 double fVal = rVal.toDouble();
447 @@ -67,6 +154,30 @@ static sal_Int32 getMeasure( const rtl::OUString& rVal )
448 return static_cast< sal_Int32 >( fVal );
451 +static OUString getRelId( const Reference< XFastAttributeList >& xAttribs )
453 + static const sal_Int32 aTokens[] =
455 + NMSP_RELATIONSHIPS | XML_id,
456 + NMSP_OFFICE | XML_relid,
457 + NMSP_RELATIONSHIPS | XML_href
460 + // Look for the relation id
464 + while ( ( i < 3 ) && ( sId.getLength( ) == 0 ) )
466 + OUString sValue( xAttribs->getOptionalValue( aTokens[i] ) );
467 + if ( sValue.getLength( ) > 0 )
476 static void ApplyCoreAttributes( const Reference< XFastAttributeList >& xAttribs, Shape& rShape )
478 @@ -96,6 +207,7 @@ static void ApplyCoreAttributes( const Reference< XFastAttributeList >& xAttribs
479 static const ::rtl::OUString sHeight( RTL_CONSTASCII_USTRINGPARAM( "height" ) );
480 static const ::rtl::OUString sMarginLeft( RTL_CONSTASCII_USTRINGPARAM( "margin-left" ) );
481 static const ::rtl::OUString sMarginTop( RTL_CONSTASCII_USTRINGPARAM( "margin-top" ) );
482 + static const ::rtl::OUString sZIndex( RTL_CONSTASCII_USTRINGPARAM( "z-index" ) );
483 if ( aName == sPosition )
484 rShape.msPosition = aVal;
485 else if ( aName == sLeft )
486 @@ -110,6 +222,8 @@ static void ApplyCoreAttributes( const Reference< XFastAttributeList >& xAttribs
487 rShape.maPosition.X = getMeasure( aVal );
488 else if ( aName == sMarginTop )
489 rShape.maPosition.Y = getMeasure( aVal );
490 + else if ( aName == sZIndex )
491 + rShape.mnZOrder = aVal.toInt32( );
495 @@ -147,8 +261,22 @@ static void ApplyShapeAttributes( const Reference< XFastAttributeList >& xAttrib
496 rShape.mnStroked = xAttribs->getOptionalValueToken( XML_stroked, 0 );
497 if ( xAttribs->hasAttribute( XML_filled ) )
498 rShape.moFilled = ::boost::optional< sal_Bool >( aAttributeList.getBool( XML_filled, sal_False ) );
500 if ( xAttribs->hasAttribute( XML_fillcolor ) )
501 - rShape.moFillColor = ::boost::optional< rtl::OUString >( xAttribs->getOptionalValue( XML_fillcolor ) );
503 + rShape.moFillColor = ::boost::optional< sal_Int32 >( getColor( xAttribs->getOptionalValue( XML_fillcolor ) ) );
504 + rShape.moFillType = ::boost::optional< sal_Int32 >( drawing::FillStyle_SOLID );
507 + if ( xAttribs->hasAttribute( XML_strokecolor ) )
508 + rShape.moStrokeColor = ::boost::optional< sal_Int32 >( getColor( xAttribs->getOptionalValue( XML_strokecolor ) ) );
510 + rShape.moStrokeColor = ::boost::optional< sal_Int32 >( 0 );
512 + if ( xAttribs->hasAttribute( XML_strokeweight ) )
513 + rShape.moStrokeWeight = ::boost::optional< sal_Int32 >( getMeasure( xAttribs->getOptionalValue( XML_strokeweight ) ) );
515 + rShape.moStrokeColor = ::boost::optional< sal_Int32 >( getMeasure( OUString::createFromAscii( "1pt" ) ) );
518 //--------------------------------------------------------------------------------------------------------------
519 @@ -160,7 +288,7 @@ public:
520 sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, Shape& rShape );
521 virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 Element,
522 const Reference< XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, RuntimeException);
528 @@ -180,11 +308,22 @@ Reference< XFastContextHandler > BasicShapeContext::createFastChildContext( sal_
530 case NMSP_VML|XML_imagedata:
532 - OUString aRelId( xAttribs->getOptionalValue( NMSP_OFFICE|XML_relid ) );
533 - mrShape.msGraphicURL = getFragmentPathFromRelId( aRelId );
534 + // A picture in a custom shape isn't shown
535 + if ( mrShape.msServiceName.equalsAscii( "com.sun.star.drawing.CustomShape" ) )
536 + mrShape.msServiceName = OUString::createFromAscii( "com.sun.star.drawing.RectangleShape" );
538 + OUString aRelId( getRelId( xAttribs ) );
539 + OUString sUrl( getFragmentPathFromRelId( aRelId ) );
540 + mrShape.moFillImageUrl = ::boost::optional< OUString >( sUrl );
541 + mrShape.moFillType = ::boost::optional< sal_Int32 > ( drawing::FillStyle_BITMAP );
542 mrShape.msImageTitle = xAttribs->getOptionalValue( NMSP_OFFICE|XML_title );
545 + case NMSP_VML|XML_textbox:
547 + mrShape.mbContainsText = true;
553 @@ -316,6 +455,7 @@ public:
554 sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, Shape& rShape );
555 virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 Element,
556 const Reference< XFastAttributeList >& Attribs ) throw (SAXException, RuntimeException);
557 + void ApplyFillAttributes( const Reference< XFastAttributeList >& xAttribs );
560 ShapeContext::ShapeContext( ContextHandler& rParent,
561 @@ -331,17 +471,68 @@ Reference< XFastContextHandler > ShapeContext::createFastChildContext( sal_Int32
562 throw (SAXException, RuntimeException)
564 Reference< XFastContextHandler > xRet;
565 -// switch( aElementToken )
568 + switch( aElementToken )
570 + case NMSP_VML|XML_fill:
572 + ApplyFillAttributes( xAttribs );
576 xRet = BasicShapeContext::createFastChildContext( aElementToken, xAttribs );
586 +void ShapeContext::ApplyFillAttributes( const Reference< XFastAttributeList >& xAttribs )
589 + if ( xAttribs->hasAttribute( XML_type ) )
591 + OUString sType = xAttribs->getValue( XML_type );
593 + if ( sType.equalsIgnoreAsciiCaseAscii( "frame" ) ||
594 + sType.equalsIgnoreAsciiCaseAscii( "tile" ) )
596 + mrShape.moFillType = ::boost::optional< sal_Int32 >( drawing::FillStyle_BITMAP );
597 + mrShape.moFilled = ::boost::optional< sal_Bool >( sal_True );
599 + // TODO Its a picture
600 + if ( sType.equalsIgnoreAsciiCaseAscii( "frame" ) )
601 + mrShape.meFillImageMode = com::sun::star::drawing::BitmapMode_STRETCH;
603 + mrShape.meFillImageMode = com::sun::star::drawing::BitmapMode_REPEAT;
605 + if ( xAttribs->hasAttribute( NMSP_RELATIONSHIPS|XML_id ) )
607 + OUString aRelId( getRelId( xAttribs ) );
608 + OUString sUrl = getFragmentPathFromRelId( aRelId );
609 + mrShape.moFillImageUrl = ::boost::optional< OUString >( sUrl );
612 + else if ( sType.equalsIgnoreAsciiCaseAscii( "gradient" ) ||
613 + sType.equalsIgnoreAsciiCaseAscii( "grandientradial" ) )
615 + // TODO Its a gradient
616 + mrShape.moFillType = ::boost::optional< sal_Int32 >( drawing::FillStyle_GRADIENT );
618 + else if ( sType.equalsIgnoreAsciiCaseAscii( "solid" ) )
620 + // TODO Its a solid
621 + mrShape.moFillType = ::boost::optional< sal_Int32 >( drawing::FillStyle_SOLID );
623 + else if ( sType.equalsIgnoreAsciiCaseAscii( "pattern" ) )
625 + // TODO Its a Hatch
626 + mrShape.moFillType = ::boost::optional< sal_Int32 >( drawing::FillStyle_HATCH );
632 //--------------------------------------------------------------------------------------------------------------
634 class GroupShapeContext : public BasicShapeContext
635 @@ -365,9 +556,9 @@ GroupShapeContext::GroupShapeContext( ContextHandler& rParent,
637 AttributeList aAttributeList( xAttribs );
638 if ( xAttribs->hasAttribute( XML_filled ) )
639 - rShape.moFilled = ::boost::optional< sal_Bool >( aAttributeList.getBool( XML_filled, sal_False ) );
640 + rShape.moFilled = ::boost::optional< sal_Int32>( aAttributeList.getBool( XML_filled, sal_False ) );
641 if ( xAttribs->hasAttribute( XML_fillcolor ) )
642 - rShape.moFillColor = ::boost::optional< rtl::OUString >( xAttribs->getOptionalValue( XML_fillcolor ) );
643 + rShape.moFillColor = ::boost::optional< sal_Int32 >( getColor( xAttribs->getOptionalValue( XML_fillcolor ) ) );
644 ApplyCoreAttributes( xAttribs, rShape );
646 Reference< XFastContextHandler > GroupShapeContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs )
647 @@ -397,6 +588,10 @@ DrawingFragmentHandler::~DrawingFragmentHandler()
648 std::vector< ShapePtr >& rShapes, std::vector< ShapePtr >& rShapeTypes )
649 throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException )
652 + clog << "DrawingFragmentHandler::StaticCreateContext" << endl;
655 static const ::rtl::OUString sCustomShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.CustomShape" ) );
657 Reference< XFastContextHandler > xRet;
658 @@ -502,6 +697,9 @@ DrawingFragmentHandler::~DrawingFragmentHandler()
659 Reference< XFastContextHandler > DrawingFragmentHandler::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs )
660 throw (SAXException, RuntimeException)
663 + clog << "DrawingFragmentHandler::createFastChildContext" << endl;
665 return aElementToken == XML_xml
666 ? getFastContextHandler()
667 : StaticCreateContext( *this, aElementToken, xAttribs, mrShapes, mrShapeTypes );
668 diff --git oox/source/vml/vmlshape.cxx oox/source/vml/vmlshape.cxx
669 index e06c984..ab892ed 100644
670 --- oox/source/vml/vmlshape.cxx
671 +++ oox/source/vml/vmlshape.cxx
673 #include <rtl/ustring.hxx>
674 #include "oox/vml/shape.hxx"
675 #include "oox/core/xmlfilterbase.hxx"
676 +#include <com/sun/star/awt/XBitmap.hpp>
677 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
678 +#include <com/sun/star/drawing/FillStyle.hpp>
679 +#include <com/sun/star/graphic/XGraphicProvider.hpp>
680 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
681 +#include <com/sun/star/beans/PropertyValues.hpp>
682 #include <com/sun/star/beans/XPropertySet.hpp>
683 -#include <com/sun/star/drawing/FillStyle.hpp>
684 +#include <com/sun/star/text/HoriOrientation.hpp>
685 +#include <com/sun/star/text/VertOrientation.hpp>
686 +#include <com/sun/star/text/RelOrientation.hpp>
687 +#include <com/sun/star/text/SizeType.hpp>
688 +#include <com/sun/star/text/XTextDocument.hpp>
689 +#include <com/sun/star/text/XTextFrame.hpp>
693 +using namespace std;
696 +using rtl::OUString;
697 using namespace com::sun::star;
699 namespace oox { namespace vml {
700 @@ -45,7 +60,14 @@ Shape::Shape( const rtl::OUString& rServiceName )
705 +, mbContainsText( false )
707 + // By default all the shapes are filled
708 + moFilled = ::boost::optional< sal_Bool > ( sal_True );
710 + sal_Int32 nWhite = OUString::createFromAscii( "FFFFFF" ).toInt32( sal_Int16( 16 ) );
711 + moFillColor = ::boost::optional< sal_Int32 > ( nWhite );
715 @@ -67,16 +89,26 @@ void Shape::applyAttributes( const vml::Shape& rSource )
716 mnCoordHeight = rSource.mnCoordHeight;
717 if ( rSource.mnStroked )
718 mnStroked = rSource.mnStroked;
719 - if ( rSource.moFilled )
720 - moFilled = rSource.moFilled;
721 + if ( rSource.moFilled )
722 + moFilled = rSource.moFilled;
723 + if ( rSource.moFillType )
724 + moFillType = rSource.moFillType;
725 + if ( rSource.moFillImageUrl )
726 + moFillImageUrl = rSource.moFillImageUrl;
727 if ( rSource.moFillColor )
728 moFillColor = rSource.moFillColor;
729 if ( rSource.maPath.Name.getLength() )
730 maPath = rSource.maPath;
731 if ( rSource.msPosition.getLength() )
732 msPosition = rSource.msPosition;
733 + if ( rSource.moStrokeColor )
734 + moStrokeColor = rSource.moStrokeColor;
735 + if ( rSource.moStrokeWeight )
736 + moStrokeWeight = rSource.moStrokeWeight;
737 maPosition = rSource.maPosition;
738 maSize = rSource.maSize;
739 + meFillImageMode = rSource.meFillImageMode;
740 + mbContainsText = rSource.mbContainsText;
743 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > Shape::createAndInsert(
744 @@ -85,13 +117,15 @@ void Shape::applyAttributes( const vml::Shape& rSource )
745 const awt::Rectangle* pShapeRect )
747 uno::Reference< drawing::XShape > xShape;
749 if ( rShape.msServiceName )
753 uno::Reference< lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), uno::UNO_QUERY_THROW );
754 xShape.set( xServiceFact->createInstance( rShape.msServiceName ), uno::UNO_QUERY_THROW );
755 - rxShapes->add( xShape );
756 + rxShapes->add( xShape );
758 awt::Point aPosition;
761 @@ -113,13 +147,54 @@ void Shape::applyAttributes( const vml::Shape& rSource )
763 if ( maPath.Name.getLength() )
764 xPropSet->setPropertyValue( maPath.Name, maPath.Value );
766 + moFillType = ::boost::optional< sal_Int32 >( drawing::FillStyle_NONE );
768 ::rtl::OUString sFillStyle( rtl::OUString::createFromAscii( "FillStyle" ) );
770 - xPropSet->setPropertyValue( sFillStyle, uno::Any( *moFilled ? drawing::FillStyle_SOLID : drawing::FillStyle_NONE ) );
771 + xPropSet->setPropertyValue( sFillStyle, uno::Any( *moFillType ) );
773 + if ( moFillImageUrl )
776 + uno::Reference< io::XInputStream > xInputStream( rFilterBase.openInputStream( *moFillImageUrl ), uno::UNO_QUERY_THROW );
778 + // load the fill bitmap into an XGraphic with the GraphicProvider
779 + static const rtl::OUString sGraphicProvider = rtl::OUString::createFromAscii( "com.sun.star.graphic.GraphicProvider" );
780 + uno::Reference< graphic::XGraphicProvider > xGraphicProvider(
781 + rFilterBase.getGlobalFactory()->createInstance( sGraphicProvider ), uno::UNO_QUERY_THROW );
783 + static const rtl::OUString sInputStream = rtl::OUString::createFromAscii( "InputStream" );
784 + beans::PropertyValues aMediaProperties(1);
785 + aMediaProperties[0].Name = sInputStream;
786 + aMediaProperties[0].Value <<= xInputStream;
788 + uno::Reference< awt::XBitmap > xBitmap( xGraphicProvider->queryGraphic( aMediaProperties ),
789 + uno::UNO_QUERY_THROW );
790 + xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "FillBitmap" ), uno::Any( xBitmap ) );
792 + // Set the bitmap fill size/repeat properties
793 + xPropSet->setPropertyValue( rtl::OUString::createFromAscii( "FillBitmapMode" ), uno::Any( meFillImageMode ) );
796 + ::rtl::OUString sFillColor( rtl::OUString::createFromAscii( "FillColor" ) );
798 + xPropSet->setPropertyValue( sFillColor, uno::Any( *moFillColor ) );
800 + ::rtl::OUString sLineColor( rtl::OUString::createFromAscii( "LineColor" ) );
801 + if ( moStrokeColor )
802 + xPropSet->setPropertyValue( sLineColor, uno::Any( *moStrokeColor ) );
804 + ::rtl::OUString sLineWidth( rtl::OUString::createFromAscii( "LineWidth" ) );
805 + if ( moStrokeWeight )
806 + xPropSet->setPropertyValue( sLineWidth, uno::Any( *moStrokeWeight ) );
808 - catch ( uno::Exception& )
809 + catch ( uno::Exception& e )
812 + clog << "Exception when setting shape properties: ";
813 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( );
817 ::rtl::OUString rServiceName( rtl::OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) );
818 if ( rShape.msShapeType.getLength() && ( msServiceName == rServiceName ) )
819 @@ -130,13 +205,88 @@ void Shape::applyAttributes( const vml::Shape& rSource )
823 - catch( uno::Exception& )
824 + catch( uno::Exception& e )
827 + clog << "Exception thrown when creating shape: ";
828 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
835 +::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > Shape::createAndInsertFrame(
836 + const ::oox::core::XmlFilterBase& rFilterBase, const ::oox::vml::Shape& rShape,
837 + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
838 + const awt::Rectangle* pShapeRect )
840 + uno::Reference< drawing::XShape > xShape;
841 + static const OUString sFrameService( OUString::createFromAscii( "com.sun.star.text.TextFrame" ) );
845 + uno::Reference< lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), uno::UNO_QUERY_THROW );
846 + uno::Reference< text::XTextFrame > xFrame ( xServiceFact->createInstance( sFrameService ), uno::UNO_QUERY_THROW );
847 + xShape.set( xFrame, uno::UNO_QUERY_THROW );
849 + // Set all the properties to the frame
850 + awt::Point aPosition;
854 + aPosition.X = pShapeRect->X;
855 + aPosition.Y = pShapeRect->Y;
856 + aSize.Width = pShapeRect->Width;
857 + aSize.Height = pShapeRect->Height;
861 + aPosition = maPosition;
865 + uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
868 + xProps->setPropertyValue( OUString::createFromAscii( "SizeType" ), uno::Any( text::SizeType::FIX ) );
869 + xProps->setPropertyValue( OUString::createFromAscii( "FrameIsAutomaticHeight" ), uno::Any( sal_False ) );
870 + xProps->setPropertyValue( OUString::createFromAscii( "Height" ), uno::Any( aSize.Height ) );
871 + xProps->setPropertyValue( OUString::createFromAscii( "Width" ), uno::Any( aSize.Width ) );
874 + xProps->setPropertyValue( OUString::createFromAscii( "HoriOrientPosition" ), uno::Any( aPosition.X ) );
875 + xProps->setPropertyValue( OUString::createFromAscii( "HoriOrientRelation" ),
876 + uno::Any( text::RelOrientation::FRAME ) );
877 + xProps->setPropertyValue( OUString::createFromAscii( "HoriOrient" ),
878 + uno::Any( text::HoriOrientation::NONE ) );
880 + xProps->setPropertyValue( OUString::createFromAscii( "VertOrientPosition" ), uno::Any( aPosition.Y ) );
881 + xProps->setPropertyValue( OUString::createFromAscii( "VertOrientRelation" ),
882 + uno::Any( text::RelOrientation::FRAME ) );
883 + xProps->setPropertyValue( OUString::createFromAscii( "VertOrient" ),
884 + uno::Any( text::VertOrientation::NONE ) );
887 + // Anchor the frame into the document
888 + uno::Reference< text::XTextDocument > xDoc( rFilterBase.getModel( ), uno::UNO_QUERY_THROW );
889 + uno::Reference< text::XTextContent > xCtnt( xShape, uno::UNO_QUERY_THROW );
890 + xCtnt->attach( xDoc->getText( )->getStart( ) );
894 + catch ( uno::Exception& e )
897 + clog << "Exception during TextFrame creation: ";
898 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( );
906 void Shape::addChilds( const ::oox::core::XmlFilterBase& rFilterBase, const ::oox::vml::Drawing& rDrawing,
907 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
908 const awt::Rectangle& rClientRect )
909 @@ -212,7 +362,14 @@ void Shape::addShape( const ::oox::core::XmlFilterBase& rFilterBase, const ::oox
910 aShape.applyAttributes( *this );
913 - uno::Reference< drawing::XShape > xShape( createAndInsert( rFilterBase, aShape, rxShapes, pShapeRect ) );
914 + static const OUString sRectService( OUString::createFromAscii( "com.sun.star.drawing.RectangleShape" ) );
915 + bool bIsRectangle = msServiceName.equals( sRectService );
917 + uno::Reference< drawing::XShape > xShape;
918 + if ( mbContainsText && bIsRectangle )
919 + xShape.set( createAndInsertFrame( rFilterBase, aShape, rxShapes, pShapeRect ) );
921 + xShape.set( createAndInsert( rFilterBase, aShape, rxShapes, pShapeRect ) );
923 // creating GroupShape if possible
924 uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
925 @@ -232,4 +389,9 @@ void Shape::addShape( const ::oox::core::XmlFilterBase& rFilterBase, const ::oox
929 +void Shape::updateShape( )
931 + // TODO Apply the shape attributes to the already added shape
935 diff --git sw/source/core/doc/docredln.cxx sw/source/core/doc/docredln.cxx
936 index fd13119..86b6267 100644
937 --- sw/source/core/doc/docredln.cxx
938 +++ sw/source/core/doc/docredln.cxx
939 @@ -312,6 +312,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
941 SwRedline aCopy( *pNewRedl );
943 + bool bError = true;
944 _CHECK_REDLINE( this )
946 if( IsRedlineOn() && !IsShowOriginal( eRedlineMode ) &&
947 @@ -431,6 +432,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
948 pRedlineTbl->Insert( pRedl );
954 else if( (( POS_BEFORE == eCmpPos &&
955 @@ -446,6 +448,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
956 pRedlineTbl->Remove( n );
957 pRedlineTbl->Insert( pRedl );
962 else if ( POS_OUTSIDE == eCmpPos )
963 @@ -1108,7 +1111,8 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
967 - delete pNewRedl, pNewRedl = 0;
968 + // TODO Check if there is any side effect
969 + //delete pNewRedl, pNewRedl = 0;
973 @@ -1271,7 +1275,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
975 _CHECK_REDLINE( this )
977 - return 0 != pNewRedl;
978 + return ( 0 != pNewRedl ) || !bError;
981 void SwDoc::CompressRedlines()
982 diff --git sw/source/core/docnode/ndtbl.cxx sw/source/core/docnode/ndtbl.cxx
983 index 7d67c27..744ab3b 100644
984 --- sw/source/core/docnode/ndtbl.cxx
985 +++ sw/source/core/docnode/ndtbl.cxx
986 @@ -1327,7 +1327,8 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >
987 SwTxtNode& rTxtNode = static_cast<SwTxtNode&>(rNode);
988 // setze den bei allen TextNode in der Tabelle den TableNode
990 - rTxtNode.pStartOfSection = pTblNd;
991 +// FIXME: this is setting wrong node StartOfSections in nested tables.
992 +// rTxtNode.pStartOfSection = pTblNd;
993 // remove PageBreaks/PageDesc/ColBreak
994 const SwAttrSet* pSet = rTxtNode.GetpSwAttrSet();
996 @@ -1406,7 +1407,6 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >
997 aCellNodeIdx = SwNodeIndex( *aCellNodeIdx.GetNode().EndOfSectionNode() );
1001 // Section der Box zuweisen
1002 pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
1003 pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ );
1004 diff --git sw/source/core/unocore/unocrsrhelper.cxx sw/source/core/unocore/unocrsrhelper.cxx
1005 index 89ca76b..ea7bdc4 100644
1006 --- sw/source/core/unocore/unocrsrhelper.cxx
1007 +++ sw/source/core/unocore/unocrsrhelper.cxx
1008 @@ -1015,9 +1015,11 @@ void makeRedline( SwPaM& rPaM,
1011 SwRedline* pRedline = new SwRedline( aRedlineData, rPaM );
1012 + RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( );
1014 pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
1015 bool bRet = pRedlineAccess->AppendRedline( pRedline, false );
1016 - pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_NONE);
1017 + pRedlineAccess->SetRedlineMode_intern( nPrevMode );
1019 throw lang::IllegalArgumentException();
1021 diff --git sw/source/core/unocore/unodraw.cxx sw/source/core/unocore/unodraw.cxx
1022 index 1c809ee..aea5c37 100644
1023 --- sw/source/core/unocore/unodraw.cxx
1024 +++ sw/source/core/unocore/unodraw.cxx
1025 @@ -1977,6 +1977,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
1026 OTextCursorHelper* pCursor = 0;
1027 SwXTextPortion* pPortion = 0;
1029 + SwXParagraph* pParagraph = 0;
1031 pRange = reinterpret_cast< SwXTextRange * >(
1032 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
1033 @@ -1986,6 +1987,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
1034 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
1035 pPortion = reinterpret_cast< SwXTextPortion * >(
1036 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextPortion::getUnoTunnelId()) ));
1037 + pParagraph = reinterpret_cast< SwXParagraph * >(
1038 + sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) );
1041 pDoc = pRange->GetDoc();
1042 @@ -1995,6 +1998,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
1043 pDoc = pCursor->GetDoc();
1044 else if ( !pDoc && pPortion && pPortion->GetCrsr() )
1045 pDoc = pPortion->GetCrsr()->GetDoc();
1046 + else if ( !pDoc && pParagraph )
1047 + pDoc = pParagraph->GetCrsr( )->GetDoc( );
1051 diff --git sw/source/core/unocore/unoobj2.cxx sw/source/core/unocore/unoobj2.cxx
1052 index 715fed4..12d4d27 100644
1053 --- sw/source/core/unocore/unoobj2.cxx
1054 +++ sw/source/core/unocore/unoobj2.cxx
1055 @@ -1249,6 +1249,12 @@ SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt) :
1056 aObjectDepend(this, &rTblFmt),
1057 aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_CURSOR))
1059 + SwTable* pTable = SwTable::FindTable( &rTblFmt );
1060 + SwTableNode* pTblNode = pTable->GetTableNode( );
1061 + SwPosition aPosition( *pTblNode );
1062 + SwPaM aPam( aPosition );
1064 + _CreateNewBookmark( aPam );
1067 /*-- 10.12.98 12:54:44---------------------------------------------------
1068 diff --git sw/source/core/unocore/unotext.cxx sw/source/core/unocore/unotext.cxx
1069 index fe6139d..fab01f9 100644
1070 --- sw/source/core/unocore/unotext.cxx
1071 +++ sw/source/core/unocore/unotext.cxx
1076 +#include <iostream>
1078 using namespace ::com::sun::star;
1079 using ::rtl::OUString;
1081 @@ -256,8 +258,8 @@ void SwXText::insertString(const uno::Reference< text::XTextRange > & xTextRange
1082 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
1085 - if(pRange && pRange->GetDoc() == GetDoc() ||
1086 - pCursor && pCursor->GetDoc() == GetDoc())
1087 + if( ( pRange && pRange->GetDoc() == GetDoc() ) ||
1088 + ( pCursor && pCursor->GetDoc() == GetDoc() ) )
1090 const SwStartNode* pOwnStartNode = GetStartNode();
1092 @@ -1871,18 +1873,11 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
1093 if(aStartCellPam.Start()->nNode < aEndCellPam.End()->nNode)
1095 const SwNode& rStartNode = aStartCellPam.Start()->nNode.GetNode();
1096 - if(!rStartNode.IsTxtNode() ||
1097 - !aEndCellPam.End()->nNode.GetNode().IsTxtNode())
1099 - //start and end of the cell must be on a SwTxtNode
1103 // increment on each StartNode and decrement on each EndNode
1104 // we must reach zero at the end and must not go below zero
1105 long nOpenNodeBlock = 0;
1106 SwNodeIndex aCellIndex = aStartCellPam.Start()->nNode;
1107 - while( ++aCellIndex < aEndCellPam.End()->nNode.GetIndex())
1108 + while( aCellIndex < aEndCellPam.End()->nNode.GetIndex())
1110 if( aCellIndex.GetNode().IsStartNode() )
1112 @@ -1893,6 +1888,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
1118 if( nOpenNodeBlock != 0)
1120 @@ -1938,7 +1934,9 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
1121 //node border anyway
1128 //now check if there's a need to insert another paragraph break
1129 if( aEndCellPam.End()->nContent.GetIndex() < aEndCellPam.End()->nNode.GetNode().GetTxtNode()->Len())
1130 @@ -1995,7 +1993,22 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
1131 const beans::PropertyValue* pTableProperties = rTableProperties.getConstArray();
1132 sal_Int32 nProperty = 0;
1133 for( ; nProperty < rTableProperties.getLength(); ++nProperty)
1134 - xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value );
1138 + xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value );
1140 + catch ( const uno::Exception e )
1143 + std::clog << "Exception when setting property: ";
1144 + std::clog << rtl::OUStringToOString( pTableProperties[nProperty].Name, RTL_TEXTENCODING_UTF8 ).getStr( );
1145 + std::clog << ". Message: ";
1146 + std::clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( );
1147 + std::clog << std::endl;
1152 //apply row properties
1153 uno::Reference< table::XTableRows > xRows = xRet->getRows();
1154 @@ -2052,6 +2065,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
1159 //apply cell properties
1160 for( nRow = 0; nRow < rCellProperties.getLength(); ++nRow)
1162 @@ -2064,7 +2078,8 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
1163 uno::Reference< beans::XPropertySet > xCell( pTextTable->getCellByPosition(nCell, nRow), uno::UNO_QUERY );
1164 for( nProperty = 0; nProperty < nCellProperties; ++nProperty)
1166 - if(aCellProperties[nProperty].Name.equalsAsciiL(
1167 + const OUString& rName = aCellProperties[nProperty].Name;
1168 + if( rName.equalsAsciiL(
1169 RTL_CONSTASCII_STRINGPARAM ( "VerticalMerge")))
1171 //determine left border position
1172 @@ -2127,8 +2142,24 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
1177 - xCell->setPropertyValue(aCellProperties[nProperty].Name, aCellProperties[nProperty].Value);
1182 + xCell->setPropertyValue(rName, aCellProperties[nProperty].Value);
1184 + catch ( const uno::Exception e )
1186 + // Apply the paragraph and char properties to the cell's content
1187 + uno::Reference< text::XText > xCellText( xCell, uno::UNO_QUERY );
1188 + uno::Reference< text::XTextCursor > xCellCurs = xCellText->createTextCursor( );
1189 + xCellCurs->gotoStart( false );
1190 + xCellCurs->gotoEnd( true );
1192 + uno::Reference< beans::XPropertySet > xCellTextProps( xCellCurs, uno::UNO_QUERY );
1193 + xCellTextProps->setPropertyValue( rName, aCellProperties[nProperty].Value );
1199 @@ -2166,30 +2197,6 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
1205 - bool bIllegalException = false;
1206 - bool bRuntimeException = false;
1207 - ::rtl::OUString sMessage;
1208 - pDoc->StartUndo(UNDO_START, NULL);
1209 - pDoc->EndUndo(UNDO_START, NULL);
1210 - if( bIllegalException || bRuntimeException )
1212 - SwUndoIter aUndoIter( pFirstPaM.get(), UNDO_EMPTY );
1213 - pDoc->Undo(aUndoIter);
1214 - if(bIllegalException)
1216 - lang::IllegalArgumentException aEx;
1217 - aEx.Message = sMessage;
1220 - else //if(bRuntimeException)
1222 - uno::RuntimeException aEx;
1223 - aEx.Message = sMessage;
1230 diff --git writerfilter/inc/dmapper/DomainMapper.hxx writerfilter/inc/dmapper/DomainMapper.hxx
1231 index 7d16243..3f2ad51 100644
1232 --- writerfilter/inc/dmapper/DomainMapper.hxx
1233 +++ writerfilter/inc/dmapper/DomainMapper.hxx
1234 @@ -66,6 +66,7 @@ using namespace std;
1237 class DomainMapper_Impl;
1240 // different context types require different sprm handling (e.g. names)
1242 @@ -107,8 +108,12 @@ public:
1243 virtual void endSectionGroup();
1244 virtual void startParagraphGroup();
1245 virtual void endParagraphGroup();
1246 + virtual void markLastParagraphInSection();
1247 virtual void startCharacterGroup();
1248 virtual void endCharacterGroup();
1249 + virtual void startShape( ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
1250 + virtual void endShape( );
1252 virtual void text(const sal_uInt8 * data, size_t len);
1253 virtual void utext(const sal_uInt8 * data, size_t len);
1254 virtual void props(writerfilter::Reference<Properties>::Pointer_t ref);
1255 @@ -120,8 +125,8 @@ public:
1257 void sprm( Sprm& sprm, ::boost::shared_ptr<PropertyMap> pContext, SprmType = SPRM_DEFAULT );
1259 - void PushStyleSheetProperties( ::boost::shared_ptr<PropertyMap> pStyleProperties );
1260 - void PopStyleSheetProperties();
1261 + void PushStyleSheetProperties( ::boost::shared_ptr<PropertyMap> pStyleProperties, bool bAffectTableMngr = false );
1262 + void PopStyleSheetProperties( bool bAffectTableMngr = false );
1264 void PushListProperties( ::boost::shared_ptr<PropertyMap> pListProperties );
1265 void PopListProperties();
1266 @@ -132,6 +137,7 @@ public:
1267 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetCurrentTextRange();
1269 ::rtl::OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties );
1270 + boost::shared_ptr< ListTable > GetListTable( );
1273 void handleUnderlineType(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext);
1274 diff --git writerfilter/inc/resourcemodel/TableData.hxx writerfilter/inc/resourcemodel/TableData.hxx
1275 index 3d3076e..a43f253 100644
1276 --- writerfilter/inc/resourcemodel/TableData.hxx
1277 +++ writerfilter/inc/resourcemodel/TableData.hxx
1278 @@ -276,6 +276,11 @@ class WRITERFILTER_DLLPUBLIC TableData
1279 typedef ::std::vector<RowPointer_t> Rows;
1282 + the table properties
1284 + PropertiesPointer mpTableProps;
1287 the data of the rows of the table
1290 @@ -349,6 +354,22 @@ public:
1291 mpRow->insertCellProperties(i, pProps);
1294 + void insertTableProperties( PropertiesPointer pProps )
1296 + if ( mpTableProps.get( ) )
1297 + mpTableProps->insert( pProps );
1299 + mpTableProps = pProps;
1303 + Return the table properties.
1305 + PropertiesPointer getTableProperties( )
1307 + return mpTableProps;
1311 Return number of rows in the table.
1313 diff --git writerfilter/inc/resourcemodel/TableManager.hxx writerfilter/inc/resourcemodel/TableManager.hxx
1314 index 54169d9..24e9aec 100644
1315 --- writerfilter/inc/resourcemodel/TableManager.hxx
1316 +++ writerfilter/inc/resourcemodel/TableManager.hxx
1317 @@ -103,6 +103,11 @@ public:
1318 @param rT end handle of cell
1320 virtual void endCell(const T & rT) = 0;
1322 + virtual T* getTable( )
1328 template <typename T, typename PropertiesPointer>
1329 @@ -151,16 +156,16 @@ class TableManager
1331 properties of the current cell
1333 - PropertiesPointer mpCellProps;
1334 + vector< PropertiesPointer > mpCellProps;
1337 properties of the current row
1339 - PropertiesPointer mpRowProps;
1340 + vector< PropertiesPointer > mpRowProps;
1343 - properties of the current table
1346 + properties of the current table: don't use them directly.
1348 PropertiesPointer mpTableProps;
1351 @@ -168,6 +173,7 @@ class TableManager
1359 @@ -231,7 +237,6 @@ protected:
1361 virtual void clearData();
1366 virtual ~TableManager(){}
1367 @@ -351,7 +356,7 @@ public:
1368 template <typename T, typename PropertiesPointer>
1369 TableManager<T, PropertiesPointer>::TableManager()
1370 : mbRowEnd(false), mbInCell(false), mbCellEnd(false), mnTableDepthNew(0),
1372 + mnTableDepth(0), mpInnerTable( NULL )
1376 @@ -398,19 +403,30 @@ void TableManager<T, PropertiesPointer>::handle(const T & rHandle)
1377 template <typename T, typename PropertiesPointer>
1378 void TableManager<T, PropertiesPointer>::startLevel()
1381 + std::clog << "TableManager::startLevel()" << std::endl;
1383 typename TableData<T, PropertiesPointer>::Pointer_t pTableData
1384 (new TableData<T, PropertiesPointer>(mTableDataStack.size()));
1386 mTableDataStack.push(pTableData);
1388 + PropertiesPointer pEmptyProps;
1389 + cellProps( pEmptyProps );
1392 template <typename T, typename PropertiesPointer>
1393 void TableManager<T, PropertiesPointer>::endLevel()
1396 + std::clog << "TableManager::endLevel()" << std::endl;
1398 if (mpTableDataHandler.get() != NULL)
1399 resolveCurrentTable();
1401 mTableDataStack.pop();
1403 + if ( mpCellProps.size( ) > 0 )
1404 + mpCellProps.pop_back( );
1407 template <typename T, typename PropertiesPointer>
1408 @@ -426,12 +442,6 @@ template <typename T, typename PropertiesPointer>
1409 void TableManager<T, PropertiesPointer>::endParagraphGroup()
1411 sal_Int32 nTableDepthDifference = mnTableDepthNew - mnTableDepth;
1412 - while (nTableDepthDifference > 0)
1416 - --nTableDepthDifference;
1418 while (nTableDepthDifference < 0)
1421 @@ -447,14 +457,23 @@ void TableManager<T, PropertiesPointer>::endParagraphGroup()
1425 - pTableData->endRow(mpRowProps);
1426 - mpRowProps.reset();
1427 + pTableData->endRow( mpRowProps.back( ) );
1428 + mpRowProps.back( ).reset();
1431 - else if (mbInCell)
1432 + else if ( mbInCell )
1434 if (! pTableData->isCellOpen())
1435 - pTableData->addCell(mCurHandle, mpCellProps);
1437 + if ( mpInnerTable )
1439 + pTableData->addCell( *mpInnerTable, mpCellProps.back( ) );
1440 + mpInnerTable = NULL;
1444 + pTableData->addCell( mCurHandle, mpCellProps.back( ) );
1450 @@ -462,7 +481,8 @@ void TableManager<T, PropertiesPointer>::endParagraphGroup()
1451 pTableData->endCell(mCurHandle);
1454 - mpCellProps.reset();
1455 + if ( mpCellProps.size( ) > 0 )
1456 + mpCellProps.back().reset( );
1459 template <typename T, typename PropertiesPointer>
1460 @@ -538,10 +558,15 @@ void TableManager<T, PropertiesPointer>::utext(const sal_uInt8 * data, size_t le
1461 template <typename T, typename PropertiesPointer>
1462 void TableManager<T, PropertiesPointer>::cellProps(PropertiesPointer pProps)
1464 - if(mpCellProps.get())
1465 - mpCellProps->insert( pProps );
1466 + if ( mpCellProps.size( ) == mTableDataStack.size( ) )
1468 + if ( mpCellProps.back( ).get( ) )
1469 + mpCellProps.back()->insert( pProps );
1471 + mpCellProps.back( ) = pProps;
1474 - mpCellProps = pProps;
1475 + mpCellProps.push_back( pProps );
1478 template <typename T, typename PropertiesPointer>
1479 @@ -554,19 +579,24 @@ void TableManager<T, PropertiesPointer>::cellPropsByCell
1480 template <typename T, typename PropertiesPointer>
1481 void TableManager<T, PropertiesPointer>::insertRowProps(PropertiesPointer pProps)
1483 - if( mpRowProps.get() )
1484 - mpRowProps->insert( pProps );
1485 + if ( mpRowProps.size( ) == ( mTableDataStack.size( ) - 1 ) )
1487 + if( mpRowProps.back( ).get( ) )
1488 + mpRowProps.back( )->insert( pProps );
1490 + mpRowProps.back( ) = pProps;
1493 - mpRowProps = pProps;
1494 + mpRowProps.push_back( pProps );
1497 template <typename T, typename PropertiesPointer>
1498 void TableManager<T, PropertiesPointer>::insertTableProps(PropertiesPointer pProps)
1500 - if( mpTableProps.get() )
1501 - mpTableProps->insert( pProps );
1503 - mpTableProps = pProps;
1504 + typename TableData<T, PropertiesPointer>::Pointer_t
1505 + pTableData = mTableDataStack.top();
1507 + pTableData->insertTableProperties( pProps );
1510 template <typename T, typename PropertiesPointer>
1511 @@ -579,7 +609,7 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable()
1513 unsigned int nRows = pTableData->getRowCount();
1515 - mpTableDataHandler->startTable(nRows, pTableData->getDepth(), mpTableProps);
1516 + mpTableDataHandler->startTable(nRows, pTableData->getDepth(), pTableData->getTableProperties( ) );
1518 for (unsigned int nRow = 0; nRow < nRows; ++nRow)
1520 @@ -602,8 +632,12 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable()
1523 mpTableDataHandler->endTable();
1525 + // The inner table has to be stored only if there is something in the stack
1526 + // The 0 depth is the dummy table for the whole stream
1527 + if ( pTableData->getDepth( ) > 1 )
1528 + mpInnerTable = mpTableDataHandler->getTable( );
1530 - mpTableProps.reset();
1534 diff --git writerfilter/inc/resourcemodel/WW8ResourceModel.hxx writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
1535 index 76c08d1..d506f38 100644
1536 --- writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
1537 +++ writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
1540 #include <boost/shared_ptr.hpp>
1541 #include <sal/types.h>
1542 +#include <com/sun/star/drawing/XShape.hpp>
1543 #include <com/sun/star/uno/Any.hxx>
1544 #include <WriterFilterDllApi.hxx>
1545 #include <resourcemodel/OutputWithDepth.hxx>
1546 @@ -208,6 +209,8 @@ public:
1547 Receives end mark for group with the same paragraph properties.
1549 virtual void endParagraphGroup() = 0;
1551 + virtual void markLastParagraphInSection( ) { };
1554 Receives start mark for group with the same character properties.
1555 @@ -220,6 +223,13 @@ public:
1556 virtual void endCharacterGroup() = 0;
1561 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) = 0;
1563 + virtual void endShape( ) = 0;
1566 Receives 8-bit per character text.
1568 @param data buffer containing the text
1569 diff --git writerfilter/source/dmapper/BorderHandler.cxx writerfilter/source/dmapper/BorderHandler.cxx
1570 index c3ed4ed..a7679a8 100644
1571 --- writerfilter/source/dmapper/BorderHandler.cxx
1572 +++ writerfilter/source/dmapper/BorderHandler.cxx
1573 @@ -137,6 +137,8 @@ void BorderHandler::sprm(Sprm & rSprm)
1574 pProperties->resolve(*this);
1575 ConversionHelper::MakeBorderLine( m_nLineWidth, m_nLineType, m_nLineColor,
1576 m_aBorderLines[rSprm.getId() - NS_ooxml::LN_CT_TblBorders_top], m_bOOXML );
1578 + m_aFilledLines[ rSprm.getId( ) - NS_ooxml::LN_CT_TblBorders_top] = true;
1582 @@ -161,7 +163,11 @@ PropertyMapPtr BorderHandler::getProperties()
1583 if( m_bOOXML || m_nCurrentBorderPosition )
1585 for( sal_Int32 nProp = 0; nProp < BORDER_COUNT; ++nProp)
1586 - pPropertyMap->Insert( aPropNames[nProp], false, uno::makeAny( m_aBorderLines[nProp] ) );
1588 + if ( m_aFilledLines[nProp] ) {
1589 + pPropertyMap->Insert( aPropNames[nProp], false, uno::makeAny( m_aBorderLines[nProp] ) );
1593 return pPropertyMap;
1595 diff --git writerfilter/source/dmapper/BorderHandler.hxx writerfilter/source/dmapper/BorderHandler.hxx
1596 index cc2c263..53fa912 100644
1597 --- writerfilter/source/dmapper/BorderHandler.hxx
1598 +++ writerfilter/source/dmapper/BorderHandler.hxx
1599 @@ -63,6 +63,7 @@ private:
1600 sal_Int32 m_nLineDistance;
1603 + bool m_aFilledLines[BORDER_COUNT];
1604 ::com::sun::star::table::BorderLine m_aBorderLines[BORDER_COUNT];
1607 diff --git writerfilter/source/dmapper/CellColorHandler.cxx writerfilter/source/dmapper/CellColorHandler.cxx
1608 index f97ee4d..fc931f4 100644
1609 --- writerfilter/source/dmapper/CellColorHandler.cxx
1610 +++ writerfilter/source/dmapper/CellColorHandler.cxx
1611 @@ -110,6 +110,11 @@ void CellColorHandler::attribute(Id rName, Value & rVal)
1615 + case NS_ooxml::LN_CT_Shd_themeFill:
1616 + case NS_ooxml::LN_CT_Shd_themeFillTint:
1617 + case NS_ooxml::LN_CT_Shd_themeFillShade:
1621 OSL_ENSURE( false, "unknown attribute");
1623 diff --git writerfilter/source/dmapper/ConversionHelper.cxx writerfilter/source/dmapper/ConversionHelper.cxx
1624 index 18196b3..a3bde53 100644
1625 --- writerfilter/source/dmapper/ConversionHelper.cxx
1626 +++ writerfilter/source/dmapper/ConversionHelper.cxx
1627 @@ -276,6 +276,10 @@ void MakeBorderLine( sal_Int32 nLineThickness, sal_Int32 nLineType,
1629 eCodeIdx = double1;// 60 Twips for us
1638 @@ -306,7 +310,8 @@ void MakeBorderLine( sal_Int32 nLineThickness, sal_Int32 nLineType,
1639 /*13*/ { DOUBLE_LINE7_OUT, DOUBLE_LINE7_IN, DOUBLE_LINE7_DIST },
1640 /*14*/ { DOUBLE_LINE8_OUT, DOUBLE_LINE8_IN, DOUBLE_LINE8_DIST },
1641 /*15*/ { DOUBLE_LINE9_OUT, DOUBLE_LINE9_IN, DOUBLE_LINE9_DIST },
1642 - /*16*/ { DOUBLE_LINE10_OUT,DOUBLE_LINE10_IN,DOUBLE_LINE10_DIST}
1643 + /*16*/ { DOUBLE_LINE10_OUT,DOUBLE_LINE10_IN,DOUBLE_LINE10_DIST},
1644 + /*17*/ { 0, 0, 0 }
1647 rToFill.Color = nLineColor;
1648 diff --git writerfilter/source/dmapper/DomainMapper.cxx writerfilter/source/dmapper/DomainMapper.cxx
1649 index 5758176..0379b34 100644
1650 --- writerfilter/source/dmapper/DomainMapper.cxx
1651 +++ writerfilter/source/dmapper/DomainMapper.cxx
1653 * for a copy of the LGPLv3 License.
1655 ************************************************************************/
1656 +#include "PageBordersHandler.hxx"
1658 #include <dmapper/DomainMapper.hxx>
1659 #include <DomainMapper_Impl.hxx>
1660 #include <ConversionHelper.hxx>
1661 +#include <ListTable.hxx>
1662 #include <ThemeTable.hxx>
1663 #include <ModelEventListener.hxx>
1664 #include <MeasureHandler.hxx>
1665 @@ -179,6 +182,10 @@ DomainMapper::~DomainMapper()
1666 uno::Reference< document::XEventBroadcaster > xBroadcaster(xIndexesSupplier, uno::UNO_QUERY);
1667 xBroadcaster->addEventListener(uno::Reference< document::XEventListener >(new ModelEventListener));
1671 + // Apply the document settings after everything else
1672 + m_pImpl->GetSettingsTable()->ApplyProperties( m_pImpl->GetTextDocument( ) );
1674 catch( const uno::Exception& rEx )
1676 @@ -554,8 +561,8 @@ void DomainMapper::attribute(Id nName, Value & val)
1677 //if the style is a user defined style then it must have an ISTD - built-in styles might not have it
1678 StyleSheetTablePtr pStyleSheets = m_pImpl->GetStyleSheetTable();
1679 ::rtl::OUString sValue = ::rtl::OUString::valueOf(nIntValue, 16);
1680 - const StyleSheetEntry* pEntry = pStyleSheets->FindStyleSheetByISTD(sValue);
1682 + const StyleSheetEntryPtr pEntry = pStyleSheets->FindStyleSheetByISTD(sValue);
1683 + if( pEntry.get( ) )
1685 bool bParaStyle = (pEntry->nStyleTypeCode == STYLE_TYPE_PARA);
1687 @@ -1884,12 +1891,12 @@ void DomainMapper::attribute(Id nName, Value & val)
1688 /* WRITERFILTERSTATUS: done: 80, planned: 0.5, spent: 0.2 */
1689 //TODO: autospacing depends on some document property (called fDontUseHTMLAutoSpacing in old ww8 filter) 100 or 280 twip
1690 //and should be set to 0 on start of page
1691 - m_pImpl->GetTopContext()->Insert( PROP_TOP_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) );
1692 + m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) );
1694 case NS_ooxml::LN_CT_Spacing_afterAutospacing:
1695 /* WRITERFILTERSTATUS: done: 80, planned: 0.5, spent: 0.2 */
1696 //TODO: autospacing depends on some document property (called fDontUseHTMLAutoSpacing in old ww8 filter) 100 or 280 twip
1697 - m_pImpl->GetTopContext()->Insert( PROP_BOTTOM_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) );
1698 + m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) );
1700 case NS_ooxml::LN_CT_SmartTagRun_uri:
1701 case NS_ooxml::LN_CT_SmartTagRun_element:
1702 @@ -1928,13 +1935,6 @@ void DomainMapper::attribute(Id nName, Value & val)
1703 //afterwards the adding of the binary data.
1704 m_pImpl->GetGraphicImport( IMPORT_AS_DETECTED_INLINE )->attribute(nName, val);
1705 m_pImpl->ImportGraphic( val.getProperties(), IMPORT_AS_DETECTED_INLINE );
1706 - if( m_pImpl->IsInShapeContext() )
1708 - //imported text from temporary shape needs to be copied to the real shape
1709 - uno::Reference< drawing::XShape > xShape;
1710 - val.getAny() >>= xShape;
1711 - m_pImpl->CopyTemporaryShapeText( xShape );
1715 case NS_ooxml::LN_CT_FramePr_dropCap:
1716 @@ -2092,19 +2092,12 @@ void DomainMapper::attribute(Id nName, Value & val)
1718 case NS_ooxml::LN_CT_Markup_id:
1719 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1720 - m_pImpl->SetCurrentRedlineId( sStringValue );
1721 + m_pImpl->SetCurrentRedlineId( nIntValue );
1723 case NS_ooxml::LN_token:
1724 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1725 m_pImpl->SetCurrentRedlineToken( nIntValue );
1727 - case NS_ooxml::LN_mark_shape:
1728 - /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1730 - m_pImpl->PopShapeContext();
1732 - m_pImpl->PushShapeContext();
1734 case NS_ooxml::LN_CT_LineNumber_countBy:
1735 /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
1736 case NS_ooxml::LN_CT_LineNumber_restart:
1737 @@ -2146,6 +2139,9 @@ void DomainMapper::attribute(Id nName, Value & val)
1738 case NS_ooxml::LN_CT_Color_themeShade:
1741 + case NS_ooxml::LN_endtrackchange:
1742 + m_pImpl->RemoveCurrentRedline( );
1746 #if OSL_DEBUG_LEVEL > 0
1747 @@ -2627,6 +2623,15 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1748 break; // sprmPPropRMark
1749 case NS_sprm::LN_POutLvl:
1750 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
1752 + if( m_pImpl->IsStyleSheetImport() )
1754 + sal_Int16 nLvl = static_cast< sal_Int16 >( nIntValue );
1756 + StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
1757 + pStyleSheetPropertyMap->SetOutlineLevel( nLvl );
1760 break; // sprmPOutLvl
1761 case NS_sprm::LN_PFBiDi:
1762 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
1763 @@ -3876,6 +3881,20 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1767 + case NS_ooxml::LN_EG_SectPrContents_pgBorders:
1769 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1770 + if( pProperties.get( ) && pSectionContext )
1772 + PageBordersHandlerPtr pHandler( new PageBordersHandler );
1773 + pProperties->resolve( *pHandler );
1775 + // Set the borders to the context and apply them to the styles
1776 + pHandler->SetBorders( pSectionContext );
1777 + pSectionContext->SetBorderParams( pHandler->GetDisplayOffset( ) );
1782 case NS_ooxml::LN_CT_PPrBase_pStyle:
1784 @@ -3885,20 +3904,31 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1785 const ::rtl::OUString sConvertedStyleName = pStyleTable->ConvertStyleName( sStringValue, true );
1786 if (m_pImpl->GetTopContext() && m_pImpl->GetTopContextType() != CONTEXT_SECTION)
1787 m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, true, uno::makeAny( sConvertedStyleName ));
1788 - const StyleSheetEntry* pEntry = pStyleTable->FindStyleSheetByISTD(sStringValue);
1789 + const StyleSheetEntryPtr pEntry = pStyleTable->FindStyleSheetByISTD(sStringValue);
1790 //apply numbering to paragraph if it was set at the style
1791 - OSL_ENSURE( pEntry, "no style sheet found" );
1792 + OSL_ENSURE( pEntry.get(), "no style sheet found" );
1793 const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0);
1795 if( pStyleSheetProperties && pStyleSheetProperties->GetListId() >= 0 )
1796 - rContext->Insert( PROP_NUMBERING_RULES, true, uno::makeAny(m_pImpl->GetListTable()->GetNumberingRules(pStyleSheetProperties->GetListId())), false);
1797 + rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny(
1798 + m_pImpl->GetListTable( )->GetStyleName( pStyleSheetProperties->GetListId( ) ) ), false);
1800 if( pStyleSheetProperties && pStyleSheetProperties->GetListLevel() >= 0 )
1801 rContext->Insert( PROP_NUMBERING_LEVEL, true, uno::makeAny(pStyleSheetProperties->GetListLevel()), false);
1804 case NS_ooxml::LN_EG_RPrBase_rStyle:
1805 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1806 - if (m_pImpl->GetTopContext())
1807 - m_pImpl->GetTopContext()->Insert( PROP_CHAR_STYLE_NAME, true, uno::makeAny( m_pImpl->GetStyleSheetTable()->ConvertStyleName( sStringValue, true )));
1809 + rtl::OUString sConvertedName( m_pImpl->GetStyleSheetTable()->ConvertStyleName( sStringValue, true ) );
1810 + // First check if the style exists in the document.
1811 + StyleSheetEntryPtr pEntry = m_pImpl->GetStyleSheetTable( )->FindStyleSheetByStyleName( sConvertedName );
1812 + bool bExists = pEntry.get( ) && ( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR );
1814 + // Add the property if the style exists
1815 + if ( bExists && m_pImpl->GetTopContext() )
1816 + m_pImpl->GetTopContext()->Insert( PROP_CHAR_STYLE_NAME, true, uno::makeAny( sConvertedName ) );
1819 case NS_ooxml::LN_CT_TblPrBase_tblCellMar: //cell margins
1820 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1821 @@ -3966,7 +3996,7 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1822 m_pImpl->ResetGraphicImport();
1823 // todo: It's a shape, now start shape import
1829 case NS_ooxml::LN_EG_RPrBase_vertAlign:
1830 @@ -4035,16 +4065,16 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1834 + case NS_ooxml::LN_paratrackchange:
1835 + m_pImpl->StartParaChange( );
1836 case NS_ooxml::LN_trackchange:
1837 /* WRITERFILTERSTATUS: done: 100, planned: 5, spent: 0 */
1838 case NS_ooxml::LN_EG_RPrContent_rPrChange:
1839 /* WRITERFILTERSTATUS: done: 100, planned: 5, spent: 0 */
1841 + m_pImpl->AddNewRedline( );
1842 resolveSprmProps( rSprm );
1843 // now the properties author, date and id should be available
1844 - ::rtl::OUString sAuthor = m_pImpl->GetCurrentRedlineAuthor();
1845 - ::rtl::OUString sDate = m_pImpl->GetCurrentRedlineDate();
1846 - ::rtl::OUString sId = m_pImpl->GetCurrentRedlineId();
1847 sal_Int32 nToken = m_pImpl->GetCurrentRedlineToken();
1848 switch( nToken & 0xffff )
1850 @@ -4053,6 +4083,7 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1851 case ooxml::OOXML_del : break;
1852 default: OSL_ENSURE( false, "redline token other than mod, ins or del" );
1854 + m_pImpl->EndParaChange( );
1857 case NS_ooxml::LN_CT_RPrChange_rPr:
1858 @@ -4061,16 +4092,22 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1859 /* WRITERFILTERSTATUS: done: 0, planned: 4, spent: 0 */
1860 case NS_ooxml::LN_object:
1863 + clog << "DomainMapper: LN_object" << endl;
1865 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1866 - if( pProperties.get())
1867 + if( pProperties.get( ) )
1869 OLEHandlerPtr pOLEHandler( new OLEHandler );
1870 pProperties->resolve(*pOLEHandler);
1871 - ::rtl::OUString sStreamName = pOLEHandler->copyOLEOStream( m_pImpl->GetTextDocument() );
1872 - if(sStreamName.getLength())
1873 + if ( pOLEHandler->isOLEObject( ) )
1875 - m_pImpl->appendOLE( sStreamName, pOLEHandler );
1877 + ::rtl::OUString sStreamName = pOLEHandler->copyOLEOStream( m_pImpl->GetTextDocument() );
1878 + if( sStreamName.getLength() )
1880 + m_pImpl->appendOLE( sStreamName, pOLEHandler );
1886 @@ -4098,7 +4135,6 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1887 case NS_ooxml::LN_CT_Lvl_pStyle:
1888 //TODO: numbering style should apply current numbering level - not yet supported
1893 #if OSL_DEBUG_LEVEL > 0
1894 @@ -4106,7 +4142,10 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1895 sMessage += ::rtl::OString::valueOf( sal_Int32( nSprmId ), 10 );
1896 sMessage += ::rtl::OString(" / 0x");
1897 sMessage += ::rtl::OString::valueOf( sal_Int32( nSprmId ), 16 );
1898 - OSL_ENSURE( false, sMessage.getStr()); //
1899 + sMessage += ::rtl::OString(" / ");
1900 + sMessage += ::rtl::OString( rSprm.getName( ).c_str( ) );
1901 + clog << sMessage.getStr( ) << endl;
1902 +// OSL_ENSURE( false, sMessage.getStr()); //
1906 @@ -4183,38 +4222,6 @@ void DomainMapper::startParagraphGroup()
1907 -----------------------------------------------------------------------*/
1908 void DomainMapper::endParagraphGroup()
1910 - //handle unprocessed deferred breaks
1911 - PropertyMapPtr pParaProperties = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
1912 - if( pParaProperties->hasEmptyPropertyValues() )
1914 - PropertyMap::const_iterator aIter = pParaProperties->find(PropertyDefinition( PROP_BREAK_TYPE , false ) );
1915 - if( aIter != pParaProperties->end() )
1917 - style::BreakType eType;
1918 - aIter->second >>= eType;
1919 - bool bPage = false;
1920 - bool bColumn = false;
1921 - if( eType == style::BreakType_PAGE_BEFORE )
1923 - else if( eType == style::BreakType_COLUMN_BEFORE )
1926 - if( bPage || bColumn )
1930 - uno::Reference< beans::XPropertySet > xRangeProperties( m_pImpl->GetTopTextAppend()->getEnd(), uno::UNO_QUERY_THROW );
1931 - xRangeProperties->setPropertyValue(
1932 - PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_BREAK_TYPE),
1933 - uno::makeAny( bPage ? style::BreakType_PAGE_BEFORE : style::BreakType_COLUMN_BEFORE));
1935 - catch( const uno::Exception& )
1942 m_pImpl->PopProperties(CONTEXT_PARAGRAPH);
1943 m_pImpl->getTableManager().endParagraphGroup();
1944 //frame conversion has to be executed after table conversion
1945 @@ -4224,19 +4231,44 @@ void DomainMapper::endParagraphGroup()
1949 +void DomainMapper::markLastParagraphInSection( )
1951 +#ifdef DEBUG_DOMAINMAPPER
1952 + dmapper_logger->element( "markLastParagraphInSection" );
1954 + m_pImpl->SetIsLastParagraphInSection( true );
1957 +void DomainMapper::startShape( uno::Reference< drawing::XShape > xShape )
1959 + m_pImpl->PushShapeContext( xShape );
1962 +void DomainMapper::endShape( )
1964 + m_pImpl->PopShapeContext( );
1967 /*-- 13.06.2007 16:15:55---------------------------------------------------
1969 -----------------------------------------------------------------------*/
1970 -void DomainMapper::PushStyleSheetProperties( PropertyMapPtr pStyleProperties )
1971 +void DomainMapper::PushStyleSheetProperties( PropertyMapPtr pStyleProperties, bool bAffectTableMngr )
1973 m_pImpl->PushStyleProperties( pStyleProperties );
1974 + if ( bAffectTableMngr )
1975 + m_pImpl->getTableManager( ).SetStyleProperties( pStyleProperties );
1977 /*-- 13.06.2007 16:15:55---------------------------------------------------
1979 -----------------------------------------------------------------------*/
1980 -void DomainMapper::PopStyleSheetProperties()
1981 +void DomainMapper::PopStyleSheetProperties( bool bAffectTableMngr )
1983 m_pImpl->PopProperties( CONTEXT_STYLESHEET );
1984 + if ( bAffectTableMngr )
1986 + PropertyMapPtr emptyPtr;
1987 + m_pImpl->getTableManager( ).SetStyleProperties( emptyPtr );
1990 /*-- 28.01.2008 14:52:33---------------------------------------------------
1992 @@ -4483,10 +4515,13 @@ void DomainMapper::table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
1994 case NS_ooxml::LN_NUMBERING:
1995 case NS_rtf::LN_LISTTABLE:
1996 - /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
1998 + /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
2000 - //the same for list tables
2001 - ref->resolve( *m_pImpl->GetListTable() );
2002 + //the same for list tables
2003 + ref->resolve( *m_pImpl->GetListTable() );
2004 + m_pImpl->GetListTable( )->CreateNumberingRules( );
2007 case NS_rtf::LN_LFOTABLE:
2008 /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
2009 @@ -4496,6 +4531,9 @@ void DomainMapper::table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
2010 case NS_ooxml::LN_THEMETABLE:
2011 ref->resolve ( *m_pImpl->GetThemeTable() );
2013 + case NS_ooxml::LN_SETTINGS:
2014 + ref->resolve( *m_pImpl->GetSettingsTable( ) );
2017 OSL_ENSURE( false, "which table is to be filled here?");
2019 @@ -4514,6 +4552,7 @@ void DomainMapper::substream(Id rName, ::writerfilter::Reference<Stream>::Pointe
2020 dmapper_logger->startElement("substream");
2023 + m_pImpl->appendTableManager( );
2024 m_pImpl->getTableManager().startLevel();
2027 @@ -4581,8 +4620,9 @@ void DomainMapper::substream(Id rName, ::writerfilter::Reference<Stream>::Pointe
2028 m_pImpl->PopAnnotation();
2033 m_pImpl->getTableManager().endLevel();
2034 + m_pImpl->popTableManager( );
2036 #ifdef DEBUG_DOMAINMAPPER
2037 dmapper_logger->endElement("substream");
2038 @@ -4818,5 +4858,10 @@ uno::Reference< text::XTextRange > DomainMapper::GetCurrentTextRange()
2039 return pStyleSheets->getOrCreateCharStyle( rCharProperties );
2042 +ListTablePtr DomainMapper::GetListTable( )
2044 + return m_pImpl->GetListTable( );
2047 } //namespace dmapper
2048 } //namespace writerfilter
2049 diff --git writerfilter/source/dmapper/DomainMapperTableHandler.cxx writerfilter/source/dmapper/DomainMapperTableHandler.cxx
2050 index 8f6febe..5f2efa4 100644
2051 --- writerfilter/source/dmapper/DomainMapperTableHandler.cxx
2052 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx
2053 @@ -68,7 +68,22 @@ static void lcl_printProperties( PropertyMapPtr pProps )
2055 rtl::OUString aOUStr = rPropSupplier.GetName( aMapIter->first.eId );
2056 rtl::OString aOStr(aOUStr.getStr(), aOUStr.getLength(), RTL_TEXTENCODING_ASCII_US );
2057 - clog << aOStr.getStr() << '-';
2058 + clog << aOStr.getStr();
2060 + table::BorderLine aLine;
2062 + if ( aMapIter->second >>= aLine )
2064 + clog << ": BorderLine ( Color: " << aLine.Color;
2065 + clog << ", Inner: " << aLine.InnerLineWidth;
2066 + clog << ", Outer: " << aLine.OuterLineWidth << ") ";
2068 + else if ( aMapIter->second >>= nColor )
2070 + clog << ": Color ( " << nColor << " ) ";
2077 @@ -106,21 +121,121 @@ void DomainMapperTableHandler::startTable(unsigned int nRows,
2078 /*-- 22.02.2008 10:18:37---------------------------------------------------
2080 -----------------------------------------------------------------------*/
2081 -PropertyMapPtr lcl_SearchParentStyleSheetAndMergeProperties(const StyleSheetEntry* pStyleSheet, StyleSheetTablePtr pStyleSheetTable)
2082 +PropertyMapPtr lcl_SearchParentStyleSheetAndMergeProperties(const StyleSheetEntryPtr pStyleSheet, StyleSheetTablePtr pStyleSheetTable)
2084 PropertyMapPtr pRet;
2085 if( pStyleSheet->sBaseStyleIdentifier.getLength())
2087 - const StyleSheetEntry* pParentStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( pStyleSheet->sBaseStyleIdentifier );
2088 + const StyleSheetEntryPtr pParentStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( pStyleSheet->sBaseStyleIdentifier );
2089 pRet = lcl_SearchParentStyleSheetAndMergeProperties( pParentStyleSheet, pStyleSheetTable );
2093 pRet.reset( new PropertyMap );
2096 pRet->insert( pStyleSheet->pProperties, true );
2100 +void lcl_mergeBorder( PropertyIds nId, PropertyMapPtr pOrig, PropertyMapPtr pDest )
2102 + PropertyDefinition aDef( nId, false );
2103 + PropertyMap::iterator pOrigIt = pOrig->find( aDef );
2105 + if ( pOrigIt != pOrig->end( ) )
2107 + pDest->Insert( nId, false, pOrigIt->second, false );
2111 +void lcl_computeCellBorders( PropertyMapPtr pTableBorders, PropertyMapPtr pCellProps,
2112 + sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow )
2114 + PropertyDefinition aVertPDef( META_PROP_VERTICAL_BORDER, false );
2115 + PropertyDefinition aHorizPDef( META_PROP_HORIZONTAL_BORDER, false );
2117 + PropertyMap::iterator aVerticalIter = pCellProps->find( aVertPDef );
2118 + PropertyMap::iterator aHorizontalIter = pCellProps->find( aHorizPDef );
2120 + // Handle the vertical and horizontal borders
2121 + bool bHasVert = ( aVerticalIter != pCellProps->end( ) );
2122 + uno::Any aVertProp;
2125 + aVerticalIter = pTableBorders->find( aVertPDef );
2126 + bHasVert = ( aVerticalIter != pTableBorders->end( ) );
2128 + aVertProp = aVerticalIter->second;
2132 + aVertProp = aVerticalIter->second;
2133 + pCellProps->erase( aVerticalIter );
2136 + bool bHasHoriz = ( aHorizontalIter != pCellProps->end( ) );
2137 + uno::Any aHorizProp;
2140 + aHorizontalIter = pTableBorders->find( aHorizPDef );
2141 + bHasHoriz = ( aHorizontalIter != pTableBorders->end( ) );
2143 + aHorizProp = aHorizontalIter->second;
2147 + aHorizProp = aHorizontalIter->second;
2148 + pCellProps->erase( aHorizontalIter );
2153 + lcl_mergeBorder( PROP_LEFT_BORDER, pTableBorders, pCellProps );
2155 + pCellProps->Insert( PROP_RIGHT_BORDER, false, aVertProp, false );
2160 + lcl_mergeBorder( PROP_RIGHT_BORDER, pTableBorders, pCellProps );
2162 + pCellProps->Insert( PROP_LEFT_BORDER, false, aVertProp, false );
2165 + if ( nCell > 0 && !bIsEndCol )
2169 + pCellProps->Insert( PROP_RIGHT_BORDER, false, aVertProp, false );
2170 + pCellProps->Insert( PROP_LEFT_BORDER, false, aVertProp, false );
2176 + lcl_mergeBorder( PROP_TOP_BORDER, pTableBorders, pCellProps );
2178 + pCellProps->Insert( PROP_BOTTOM_BORDER, false, aHorizProp, false );
2183 + lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps );
2185 + pCellProps->Insert( PROP_TOP_BORDER, false, aHorizProp, false );
2188 + if ( nRow > 0 && !bIsEndRow )
2192 + pCellProps->Insert( PROP_TOP_BORDER, false, aHorizProp, false );
2193 + pCellProps->Insert( PROP_BOTTOM_BORDER, false, aHorizProp, false );
2198 void DomainMapperTableHandler::endTable()
2200 #if OSL_DEBUG_LEVEL > 1
2201 @@ -140,7 +255,7 @@ void DomainMapperTableHandler::endTable()
2204 const beans::PropertyValues aDebugTbl = m_aTableProperties->GetPropertyValues();
2205 - for( sal_Int32 nDebug = 0; nDebug < nTblPropSize; ++nDebug)
2206 + for( sal_uInt32 nDebug = 0; nDebug < nTblPropSize; ++nDebug)
2208 const ::rtl::OUString sName = aDebugTbl[nDebug].Name;
2210 @@ -148,6 +263,7 @@ void DomainMapperTableHandler::endTable()
2212 m_aTableProperties->Invalidate();
2213 sNames += ::rtl::OUString(' ');
2214 + clog << "Props: " << rtl::OUStringToOString( sNames, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
2218 @@ -156,6 +272,13 @@ void DomainMapperTableHandler::endTable()
2219 sal_Int32 nLeftBorderDistance, nRightBorderDistance, nTopBorderDistance, nBottomBorderDistance;
2220 nLeftBorderDistance = nRightBorderDistance = DEF_BORDER_DIST;
2221 nTopBorderDistance = nBottomBorderDistance = 0;
2223 + PropertyMapPtr pTableDefaults( new PropertyMap );
2224 + PropertyMapPtr pTableBorders( new PropertyMap );
2226 + // will receive the table style if any
2227 + TableStyleSheetEntry* pTableStyle = NULL;
2229 if( m_aTableProperties.get() )
2231 //create properties from the table attributes
2232 @@ -169,35 +292,31 @@ void DomainMapperTableHandler::endTable()
2233 m_aTableProperties->find( PropertyDefinition( META_PROP_TABLE_STYLE_NAME, false ) );
2234 if(aTableStyleIter != m_aTableProperties->end())
2236 - //TODO: apply table style properties recursively
2237 + // Apply table style properties recursively
2238 ::rtl::OUString sTableStyleName;
2239 aTableStyleIter->second >>= sTableStyleName;
2240 StyleSheetTablePtr pStyleSheetTable = m_rDMapper_Impl.GetStyleSheetTable();
2241 - const StyleSheetEntry* pStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( sTableStyleName );
2242 + const StyleSheetEntryPtr pStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( sTableStyleName );
2243 + pTableStyle = static_cast<TableStyleSheetEntry*>( pStyleSheet.get( ) );
2244 + m_aTableProperties->erase( aTableStyleIter );
2248 - PropertyMapPtr pMergedProperties = lcl_SearchParentStyleSheetAndMergeProperties(pStyleSheet, pStyleSheetTable);
2250 - PropertyMap::const_iterator aStylePropIter =
2251 - pMergedProperties->find(PropertyDefinition( META_PROP_CELL_MAR_TOP, false ) );
2252 - if( aStylePropIter != pMergedProperties->end() )
2253 - aStylePropIter->second >>= nTopBorderDistance;
2254 + // First get the style properties, then the table ones
2255 + PropertyMapPtr pTableProps( m_aTableProperties );
2256 + TablePropertyMapPtr pEmptyProps( new TablePropertyMap );
2258 - aStylePropIter = pMergedProperties->find(PropertyDefinition( META_PROP_CELL_MAR_BOTTOM, false ) );
2259 - if( aStylePropIter != pMergedProperties->end() )
2260 - aStylePropIter->second >>= nBottomBorderDistance;
2262 - aStylePropIter = pMergedProperties->find(PropertyDefinition( META_PROP_CELL_MAR_LEFT, false ) );
2263 - if( aStylePropIter != pMergedProperties->end() )
2264 - aStylePropIter->second >>= nLeftBorderDistance;
2266 - aStylePropIter = pMergedProperties->find(PropertyDefinition( META_PROP_CELL_MAR_RIGHT, false ) );
2267 - if( aStylePropIter != pMergedProperties->end() )
2268 - aStylePropIter->second >>= nRightBorderDistance;
2269 + m_aTableProperties = pEmptyProps;
2271 + PropertyMapPtr pMergedProperties = lcl_SearchParentStyleSheetAndMergeProperties(pStyleSheet, pStyleSheetTable);
2273 + m_aTableProperties->insert( pMergedProperties );
2274 + m_aTableProperties->insert( pTableProps );
2276 - m_aTableProperties->erase( aTableStyleIter );
2279 + // Set the table default attributes for the cells
2280 + pTableDefaults->insert( m_aTableProperties );
2282 m_aTableProperties->getValue( TablePropertyMap::GAP_HALF, nGapHalf );
2283 m_aTableProperties->getValue( TablePropertyMap::LEFT_MARGIN, nLeftMargin );
2284 @@ -228,6 +347,11 @@ void DomainMapperTableHandler::endTable()
2285 aTblBorderIter->second >>= aTableBorder.TopLine;
2286 aTableBorder.IsTopLineValid = true;
2287 m_aTableProperties->erase( aTblBorderIter );
2289 + pTableBorders->Insert( PROP_TOP_BORDER, false, uno::makeAny( aTableBorder.TopLine ) );
2290 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( PROP_TOP_BORDER, false ) );
2291 + if ( pIt != pTableDefaults->end( ) )
2292 + pTableDefaults->erase( pIt );
2294 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_BOTTOM_BORDER, false) );
2295 if( aTblBorderIter != m_aTableProperties->end() )
2296 @@ -235,6 +359,11 @@ void DomainMapperTableHandler::endTable()
2297 aTblBorderIter->second >>= aTableBorder.BottomLine;
2298 aTableBorder.IsBottomLineValid = true;
2299 m_aTableProperties->erase( aTblBorderIter );
2301 + pTableBorders->Insert( PROP_BOTTOM_BORDER, false, uno::makeAny( aTableBorder.BottomLine ) );
2302 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( PROP_BOTTOM_BORDER, false ) );
2303 + if ( pIt != pTableDefaults->end( ) )
2304 + pTableDefaults->erase( pIt );
2306 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_LEFT_BORDER, false) );
2307 if( aTblBorderIter != m_aTableProperties->end() )
2308 @@ -242,6 +371,11 @@ void DomainMapperTableHandler::endTable()
2309 aTblBorderIter->second >>= aTableBorder.LeftLine;
2310 aTableBorder.IsLeftLineValid = true;
2311 m_aTableProperties->erase( aTblBorderIter );
2313 + pTableBorders->Insert( PROP_LEFT_BORDER, false, uno::makeAny( aTableBorder.LeftLine ) );
2314 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( PROP_LEFT_BORDER, false ) );
2315 + if ( pIt != pTableDefaults->end( ) )
2316 + pTableDefaults->erase( pIt );
2318 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_RIGHT_BORDER, false) );
2319 if( aTblBorderIter != m_aTableProperties->end() )
2320 @@ -249,6 +383,11 @@ void DomainMapperTableHandler::endTable()
2321 aTblBorderIter->second >>= aTableBorder.RightLine;
2322 aTableBorder.IsRightLineValid = true;
2323 m_aTableProperties->erase( aTblBorderIter );
2325 + pTableBorders->Insert( PROP_RIGHT_BORDER, false, uno::makeAny( aTableBorder.RightLine ) );
2326 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( PROP_RIGHT_BORDER, false ) );
2327 + if ( pIt != pTableDefaults->end( ) )
2328 + pTableDefaults->erase( pIt );
2330 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(META_PROP_HORIZONTAL_BORDER, false) );
2331 if( aTblBorderIter != m_aTableProperties->end() )
2332 @@ -256,6 +395,11 @@ void DomainMapperTableHandler::endTable()
2333 aTblBorderIter->second >>= aTableBorder.HorizontalLine;
2334 aTableBorder.IsHorizontalLineValid = true;
2335 m_aTableProperties->erase( aTblBorderIter );
2337 + pTableBorders->Insert( META_PROP_HORIZONTAL_BORDER, false, uno::makeAny( aTableBorder.HorizontalLine ) );
2338 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( META_PROP_HORIZONTAL_BORDER, false ) );
2339 + if ( pIt != pTableDefaults->end( ) )
2340 + pTableDefaults->erase( pIt );
2342 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(META_PROP_VERTICAL_BORDER, false) );
2343 if( aTblBorderIter != m_aTableProperties->end() )
2344 @@ -263,10 +407,15 @@ void DomainMapperTableHandler::endTable()
2345 aTblBorderIter->second >>= aTableBorder.VerticalLine;
2346 aTableBorder.IsVerticalLineValid = true;
2347 m_aTableProperties->erase( aTblBorderIter );
2349 + pTableBorders->Insert( META_PROP_VERTICAL_BORDER, false, uno::makeAny( aTableBorder.VerticalLine ) );
2350 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( META_PROP_VERTICAL_BORDER, false ) );
2351 + if ( pIt != pTableDefaults->end( ) )
2352 + pTableDefaults->erase( pIt );
2354 aTableBorder.Distance = 0;
2355 aTableBorder.IsDistanceValid = false;
2358 m_aTableProperties->Insert( PROP_TABLE_BORDER, false, uno::makeAny( aTableBorder ) );
2360 m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( nLeftMargin - nGapHalf - nLeftBorderDistance));
2361 @@ -284,18 +433,26 @@ void DomainMapperTableHandler::endTable()
2362 m_aTableProperties->find( PropertyDefinition( PROP_HEADER_ROW_COUNT, false ) );
2363 if( aRepeatIter == m_aTableProperties->end() )
2364 m_aTableProperties->Insert( PROP_HEADER_ROW_COUNT, false, uno::makeAny( (sal_Int32)0 ));
2366 + // Remove the PROP_HEADER_ROW_COUNT from the table default to avoid
2367 + // propagating it to the cells
2368 + PropertyMap::iterator aDefaultRepeatIt =
2369 + pTableDefaults->find( PropertyDefinition( PROP_HEADER_ROW_COUNT, false ) );
2370 + if ( aDefaultRepeatIt != pTableDefaults->end( ) )
2371 + pTableDefaults->erase( aDefaultRepeatIt );
2373 aTableProperties = m_aTableProperties->GetPropertyValues();
2377 // expands to uno::Sequence< Sequence< beans::PropertyValues > >
2378 CellPropertyValuesSeq_t aCellProperties( m_aCellProperties.size() );
2380 // std::vector< std::vector<PropertyMapPtr> > m_aCellProperties
2381 PropertyMapVector2::const_iterator aRowOfCellsIterator = m_aCellProperties.begin();
2382 PropertyMapVector2::const_iterator aRowOfCellsIteratorEnd = m_aCellProperties.end();
2383 + PropertyMapVector2::const_iterator aLastRowIterator = m_aCellProperties.end() - 1;
2387 //it's a uno::Sequence< beans::PropertyValues >*
2388 RowPropertyValuesSeq_t* pCellProperties = aCellProperties.getArray();
2389 while( aRowOfCellsIterator != aRowOfCellsIteratorEnd )
2390 @@ -303,67 +460,72 @@ void DomainMapperTableHandler::endTable()
2391 //aRowOfCellsIterator points to a vector of PropertyMapPtr
2392 PropertyMapVector1::const_iterator aCellIterator = aRowOfCellsIterator->begin();
2393 PropertyMapVector1::const_iterator aCellIteratorEnd = aRowOfCellsIterator->end();
2395 - //contains the default border of the line
2396 - PropertyMapPtr aCellBorders( new PropertyMap );
2398 + PropertyMapVector1::const_iterator aLastCellIterator = aRowOfCellsIterator->end() - 1;
2400 + // Get the row style properties
2401 + sal_Int32 nRowStyleMask = sal_Int32( 0 );
2402 + PropertyMapPtr pRowProps = m_aRowProperties[nRow];
2403 + if ( pRowProps.get( ) )
2405 + PropertyMap::iterator pTcCnfStyleIt = pRowProps->find( PropertyDefinition( PROP_CNF_STYLE, true ) );
2406 + if ( pTcCnfStyleIt != pRowProps->end( ) )
2408 + if ( pTableStyle )
2410 + rtl::OUString sMask;
2411 + pTcCnfStyleIt->second >>= sMask;
2412 + nRowStyleMask = sMask.toInt32( 2 );
2414 + pRowProps->erase( pTcCnfStyleIt );
2418 sal_Int32 nCell = 0;
2419 pCellProperties[nRow].realloc( aRowOfCellsIterator->size() );
2420 beans::PropertyValues* pSingleCellProperties = pCellProperties[nRow].getArray();
2421 while( aCellIterator != aCellIteratorEnd )
2423 - //TODO: aCellIterator contains HorizontalBorder and VerticalBorder
2424 - // they have to be removed, depending on the position of the cell they
2425 - // have to be moved to BottomBorder/RightBorder respectively
2426 + PropertyMapPtr pAllCellProps( new PropertyMap );
2428 + bool bIsEndCol = aCellIterator == aLastCellIterator;
2429 + bool bIsEndRow = aRowOfCellsIterator == aLastRowIterator;
2431 //aCellIterator points to a PropertyMapPtr;
2432 if( aCellIterator->get() )
2434 - if( nCell && aCellBorders->size() )
2436 - //now apply the default border
2437 - //TODO: This overwrites the existing values!
2438 - aCellIterator->get()->insert( aCellBorders, false );
2442 - const PropertyMap::iterator aVerticalIter =
2443 - aCellIterator->get()->find( PropertyDefinition(META_PROP_VERTICAL_BORDER, false) );
2444 - const PropertyMap::iterator aHorizontalIter =
2445 - aCellIterator->get()->find( PropertyDefinition(META_PROP_HORIZONTAL_BORDER, false) );
2446 - const PropertyMap::const_iterator aRightIter =
2447 - aCellIterator->get()->find( PropertyDefinition(PROP_RIGHT_BORDER, false) );
2448 - const PropertyMap::const_iterator aBottomIter =
2449 - aCellIterator->get()->find( PropertyDefinition(PROP_BOTTOM_BORDER, false) );
2451 - if( aVerticalIter != aCellIterator->get()->end())
2452 + if ( pTableDefaults->size( ) )
2453 + pAllCellProps->insert( pTableDefaults );
2455 + // Fill the cell properties with the ones of the style
2456 + sal_Int32 nCellStyleMask = 0;
2457 + const PropertyMap::iterator aCnfStyleIter =
2458 + aCellIterator->get()->find( PropertyDefinition( PROP_CNF_STYLE, false ) );
2459 + if ( aCnfStyleIter != aCellIterator->get( )->end( ) )
2462 - aCellBorders->insert(*aVerticalIter);
2463 - aCellIterator->get()->erase( aVerticalIter );
2464 + if ( pTableStyle ) {
2465 + rtl::OUString sMask;
2466 + aCnfStyleIter->second >>= sMask;
2467 + nCellStyleMask = sMask.toInt32( 2 );
2469 + aCellIterator->get( )->erase( aCnfStyleIter );
2471 - if( aHorizontalIter != aCellIterator->get()->end())
2473 + if ( pTableStyle )
2476 - aCellBorders->insert(*aHorizontalIter);
2477 - aCellIterator->get()->erase( aHorizontalIter );
2478 + PropertyMapPtr pStyleProps = pTableStyle->GetProperties( nCellStyleMask + nRowStyleMask );
2479 + pAllCellProps->insert( pStyleProps );
2481 - //fill the additional borders into the line default border
2484 - const PropertyMap::const_iterator aLeftIter =
2485 - aCellIterator->get()->find( PropertyDefinition(PROP_RIGHT_BORDER, false) );
2486 - if(aLeftIter != aCellIterator->get()->end())
2487 - aCellBorders->insert(*aLeftIter);
2488 - if(aRightIter != aCellIterator->get()->end())
2489 - aCellBorders->insert(*aRightIter);
2490 - const PropertyMap::const_iterator aTopIter =
2491 - aCellIterator->get()->find( PropertyDefinition(PROP_TOP_BORDER, false) );
2492 - if(aTopIter != aCellIterator->get()->end())
2493 - aCellBorders->insert(*aTopIter);
2494 - if(aBottomIter != aCellIterator->get()->end())
2495 - aCellBorders->insert(*aBottomIter);
2499 + // Then add the cell properties
2500 + pAllCellProps->insert( *aCellIterator );
2501 + aCellIterator->get( )->swap( *pAllCellProps.get( ) );
2504 + clog << "Cell #" << nCell << ", Row #" << nRow << endl;
2507 + lcl_computeCellBorders( pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow );
2509 //now set the default left+right border distance TODO: there's an sprm containing the default distance!
2510 const PropertyMap::const_iterator aLeftDistanceIter =
2511 aCellIterator->get()->find( PropertyDefinition(PROP_LEFT_BORDER_DISTANCE, false) );
2512 @@ -410,7 +572,7 @@ void DomainMapperTableHandler::endTable()
2514 sNames += ::rtl::OUString('-');
2516 - sNames += ::rtl::OUString(' ');
2517 + sNames += ::rtl::OUString('\n');
2521 @@ -479,11 +641,15 @@ void DomainMapperTableHandler::endTable()
2522 (void) nCellPropertiesProperties;
2523 ++nCellPropertiesProperties;
2526 - m_xText->convertToTable(*m_pTableSeq,
2527 + clog << "Converting table" << endl;
2530 + uno::Reference<text::XTextTable> xTable = m_xText->convertToTable(*m_pTableSeq,
2535 + m_xTableRange = xTable->getAnchor( );
2537 catch (lang::IllegalArgumentException e)
2539 @@ -491,7 +657,14 @@ void DomainMapperTableHandler::endTable()
2540 clog << "failed to import table!" << endl;
2543 +#if OSL_DEBUG_LEVEL > 1
2544 + catch ( uno::Exception e )
2546 + clog << "Caught an other exception: " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
2551 m_aTableProperties.reset();
2552 m_aCellProperties.clear();
2553 m_aRowProperties.clear();
2554 @@ -529,7 +702,15 @@ void DomainMapperTableHandler::startCell(const Handle_t & start,
2555 TablePropertyMapPtr pProps )
2557 sal_uInt32 nRow = m_aRowProperties.size();
2558 - m_aCellProperties[nRow - 1].push_back( pProps );
2559 + if ( pProps.get( ) )
2560 + m_aCellProperties[nRow - 1].push_back( pProps );
2563 + // Adding an empty cell properties map to be able to get
2564 + // the table defaults properties
2565 + TablePropertyMapPtr pEmptyProps( new TablePropertyMap( ) );
2566 + m_aCellProperties[nRow - 1].push_back( pEmptyProps );
2569 #if OSL_DEBUG_LEVEL > 1
2570 clog << "<table.cell>";
2571 diff --git writerfilter/source/dmapper/DomainMapperTableHandler.hxx writerfilter/source/dmapper/DomainMapperTableHandler.hxx
2572 index d0e4382..833dd3c 100644
2573 --- writerfilter/source/dmapper/DomainMapperTableHandler.hxx
2574 +++ writerfilter/source/dmapper/DomainMapperTableHandler.hxx
2575 @@ -66,6 +66,8 @@ class DomainMapperTableHandler : public TableDataHandler<Handle_t , TablePropert
2576 RowSequencePointer_t m_pRowSeq;
2577 TableSequencePointer_t m_pTableSeq;
2579 + Handle_t m_xTableRange;
2582 PropertyMapVector2 m_aCellProperties;
2583 PropertyMapVector1 m_aRowProperties;
2584 @@ -87,6 +89,11 @@ public:
2585 virtual void endRow();
2586 virtual void startCell(const Handle_t & start, TablePropertyMapPtr pProps);
2587 virtual void endCell(const Handle_t & end);
2589 + virtual Handle_t* getTable( )
2591 + return &m_xTableRange;
2596 diff --git writerfilter/source/dmapper/DomainMapperTableManager.cxx writerfilter/source/dmapper/DomainMapperTableManager.cxx
2597 index 4367f90..5790e9f 100644
2598 --- writerfilter/source/dmapper/DomainMapperTableManager.cxx
2599 +++ writerfilter/source/dmapper/DomainMapperTableManager.cxx
2600 @@ -56,14 +56,18 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) :
2601 m_nCellBorderIndex(0),
2604 - m_bOOXML( bOOXML )
2605 + m_bOOXML( bOOXML ),
2606 + m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) )
2608 + m_pTablePropsHandler->SetTableManager( this );
2610 /*-- 23.04.2007 14:57:49---------------------------------------------------
2612 -----------------------------------------------------------------------*/
2613 DomainMapperTableManager::~DomainMapperTableManager()
2615 + if ( m_pTablePropsHandler )
2616 + delete m_pTablePropsHandler, m_pTablePropsHandler = NULL;
2618 /*-- 23.04.2007 15:25:37---------------------------------------------------
2620 @@ -73,39 +77,17 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2621 bool bRet = DomainMapperTableManager_Base_t::sprm(rSprm);
2624 + bRet = m_pTablePropsHandler->sprm( rSprm );
2630 sal_uInt32 nSprmId = rSprm.getId();
2631 Value::Pointer_t pValue = rSprm.getValue();
2632 sal_Int32 nIntValue = ((pValue.get() != NULL) ? pValue->getInt() : 0);
2633 - /* WRITERFILTERSTATUS: table: table_sprmdata */
2635 + switch ( nSprmId )
2637 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
2638 - case NS_ooxml::LN_CT_TrPrBase_jc: //90706
2639 - /* WRITERFILTERSTATUS: done: 1, planned: 0.5, spent: 0.5 */
2640 - case NS_ooxml::LN_CT_TblPrBase_jc:
2641 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
2642 - case 0x5400: // sprmTJc
2644 - //table justification 0: left, 1: center, 2: right
2645 - sal_Int16 nOrient = ConversionHelper::convertTableJustification( nIntValue );
2646 - TablePropertyMapPtr pTableMap( new TablePropertyMap );
2647 - pTableMap->setValue( TablePropertyMap::HORI_ORIENT, nOrient );
2648 - insertTableProps( pTableMap );
2651 - /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
2652 - case 0x9601: // sprmTDxaLeft
2654 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2655 - case 0x9602: // sprmTDxaGapHalf
2657 - //m_nGapHalf = ConversionHelper::convertTwipToMM100( nIntValue );
2658 - TablePropertyMapPtr pPropMap( new TablePropertyMap );
2659 - pPropMap->setValue( TablePropertyMap::GAP_HALF, ConversionHelper::convertTwipToMM100( nIntValue ) );
2660 - insertTableProps(pPropMap);
2663 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2664 case 0xf661: //sprmTTRLeft left table indent
2665 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2666 @@ -136,32 +118,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2670 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
2671 - case NS_ooxml::LN_CT_TrPrBase_trHeight: //90703
2673 - //contains unit and value
2674 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2675 - if( pProperties.get())
2676 - { //contains attributes x2902 (LN_unit) and x17e2 (LN_trleft)
2677 - MeasureHandlerPtr pMeasureHandler( new MeasureHandler );
2678 - pProperties->resolve(*pMeasureHandler);
2679 - TablePropertyMapPtr pPropMap( new TablePropertyMap );
2680 - pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() ));
2681 - pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(pMeasureHandler->getMeasureValue() ));
2682 - insertRowProps(pPropMap);
2686 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2687 - case 0x3403: // sprmTFCantSplit
2688 - case NS_sprm::LN_TCantSplit: // 0x3644
2690 - //row can't break across pages if nIntValue == 1
2691 - TablePropertyMapPtr pPropMap( new TablePropertyMap );
2692 - pPropMap->Insert( PROP_IS_SPLIT_ALLOWED, false, uno::makeAny(sal_Bool( nIntValue == 1 ? sal_False : sal_True ) ));
2693 - insertRowProps(pPropMap);
2696 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2697 case 0x3404:// sprmTTableHeader
2698 case NS_ooxml::LN_CT_TrPrBase_tblHeader: //90704
2699 @@ -178,23 +134,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2700 m_nHeaderRepeat = -1;
2702 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2703 - case 0x9407: // sprmTDyaRowHeight
2705 - // table row height - negative values indicate 'exact height' - positive 'at least'
2706 - TablePropertyMapPtr pPropMap( new TablePropertyMap );
2707 - bool bMinHeight = true;
2708 - sal_Int16 nHeight = static_cast<sal_Int16>( nIntValue );
2711 - bMinHeight = false;
2714 - pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny(bMinHeight ? text::SizeType::MIN : text::SizeType::FIX ));
2715 - pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(ConversionHelper::convertTwipToMM100( nHeight )));
2716 - insertRowProps(pPropMap);
2719 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2720 case 0xd608: // TDefTable
2722 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2723 @@ -226,22 +165,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2726 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2727 - case NS_ooxml::LN_CT_TcPrBase_vAlign://90694
2729 - sal_Int16 nVertOrient = text::VertOrientation::NONE;
2730 - switch( nIntValue ) //0 - top 1 - center 3 - bottom
2732 - case 1: nVertOrient = text::VertOrientation::CENTER; break;
2733 - case 3: nVertOrient = text::VertOrientation::BOTTOM; break;
2736 - TablePropertyMapPtr pCellPropMap( new TablePropertyMap() );
2737 - pCellPropMap->Insert( PROP_VERT_ORIENT, false, uno::makeAny( nVertOrient ) );
2738 - //todo: in ooxml import the value of m_ncell is wrong
2739 - cellProps( pCellPropMap );
2742 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2743 case 0xD605: // sprmTTableBorders
2745 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2746 @@ -256,70 +179,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2750 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2751 - case NS_ooxml::LN_CT_TblPrBase_tblBorders: //table borders, might be defined in table style
2753 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2754 - if( pProperties.get())
2756 - BorderHandlerPtr pBorderHandler( new BorderHandler(m_bOOXML) );
2757 - pProperties->resolve(*pBorderHandler);
2758 - TablePropertyMapPtr pTablePropMap( new TablePropertyMap );
2759 - pTablePropMap->insert( pBorderHandler->getProperties() );
2760 - insertTableProps( pTablePropMap );
2764 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2765 - case NS_ooxml::LN_CT_TcPrBase_tcBorders ://cell borders
2766 - //contains CT_TcBorders_left, right, top, bottom
2768 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2769 - if( pProperties.get())
2771 - //in OOXML there's one set of borders at each cell (if there is any)
2772 - TDefTableHandlerPtr pTDefTableHandler( new TDefTableHandler( m_bOOXML ));
2773 - pProperties->resolve( *pTDefTableHandler );
2774 - TablePropertyMapPtr pCellPropMap( new TablePropertyMap );
2775 - pTDefTableHandler->fillCellProperties( 0, pCellPropMap );
2776 - cellProps( pCellPropMap );
2780 - case NS_ooxml::LN_CT_TblPrBase_shd:
2782 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2783 - if( pProperties.get())
2785 - CellColorHandlerPtr pCellColorHandler( new CellColorHandler);
2786 - pProperties->resolve( *pCellColorHandler );
2787 - TablePropertyMapPtr pTablePropMap( new TablePropertyMap );
2788 - insertTableProps( pCellColorHandler->getProperties() );
2792 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2793 - case 0xd61a : // sprmTCellTopColor
2794 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2795 - case 0xd61b : // sprmTCellLeftColor
2796 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2797 - case 0xd61c : // sprmTCellBottomColor
2798 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2799 - case 0xd61d : // sprmTCellRightColor
2800 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2801 - case NS_ooxml::LN_CT_TcPrBase_shd:
2803 - // each color sprm contains as much colors as cells are in a row
2804 - //LN_CT_TcPrBase_shd: cell shading contains: LN_CT_Shd_val, LN_CT_Shd_fill, LN_CT_Shd_color
2805 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2806 - if( pProperties.get())
2808 - CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
2809 - pProperties->resolve( *pCellColorHandler );
2810 - cellProps( pCellColorHandler->getProperties());
2814 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
2815 case 0xd632 : //sprmTNewSpacing
2816 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
2817 @@ -356,7 +215,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2818 case 0xf618 : //unknown
2821 -//OOXML table properties
2822 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2823 case NS_ooxml::LN_CT_TblPrBase_tblStyle: //table style name
2825 @@ -368,34 +226,10 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2827 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2828 case NS_ooxml::LN_CT_TblGridBase_gridCol:
2832 - m_aTableGrid.push_back( ConversionHelper::convertTwipToMM100( nIntValue ) );
2834 + getCurrentGrid()->push_back( ConversionHelper::convertTwipToMM100( nIntValue ) );
2837 - /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
2838 - case NS_ooxml::LN_CT_TblPrBase_tblCellMar: //cell margins
2840 - //contains LN_CT_TblCellMar_top, LN_CT_TblCellMar_left, LN_CT_TblCellMar_bottom, LN_CT_TblCellMar_right
2841 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2842 - if( pProperties.get())
2844 - CellMarginHandlerPtr pCellMarginHandler( new CellMarginHandler );
2845 - pProperties->resolve( *pCellMarginHandler );
2846 - TablePropertyMapPtr pMarginProps( new TablePropertyMap );
2847 - if( pCellMarginHandler->m_bTopMarginValid )
2848 - pMarginProps->setValue( TablePropertyMap::CELL_MAR_TOP, pCellMarginHandler->m_nTopMargin );
2849 - if( pCellMarginHandler->m_bBottomMarginValid )
2850 - pMarginProps->setValue( TablePropertyMap::CELL_MAR_BOTTOM, pCellMarginHandler->m_nBottomMargin );
2851 - if( pCellMarginHandler->m_bLeftMarginValid )
2852 - pMarginProps->setValue( TablePropertyMap::CELL_MAR_LEFT, pCellMarginHandler->m_nLeftMargin );
2853 - if( pCellMarginHandler->m_bRightMarginValid )
2854 - pMarginProps->setValue( TablePropertyMap::CELL_MAR_RIGHT, pCellMarginHandler->m_nRightMargin );
2855 - insertTableProps(pMarginProps);
2859 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2860 case NS_ooxml::LN_CT_TcPrBase_vMerge : //vertical merge
2862 @@ -408,25 +242,84 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2863 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2864 case NS_ooxml::LN_CT_TcPrBase_gridSpan: //number of grid positions spanned by this cell
2867 + clog << "GridSpan: " << nIntValue << endl;
2869 //the cell width is determined by its position in the table grid
2870 //it takes 'gridSpan' grid elements
2871 - if( m_aGridSpans.size() < m_nCell)
2872 + IntVectorPtr pCurrentSpans = getCurrentSpans( );
2873 + if( pCurrentSpans->size() < m_nCell)
2875 //fill missing elements with '1'
2876 - m_aGridSpans.insert( m_aGridSpans.end(), m_nCell - m_aGridSpans.size(), 1 );
2878 - m_aGridSpans.push_back( nIntValue );
2879 + pCurrentSpans->insert( pCurrentSpans->end(), m_nCell - pCurrentSpans->size(), 1 );
2881 + pCurrentSpans->push_back( nIntValue );
2884 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
2885 - case NS_ooxml::LN_CT_TblPrBase_tblLook: break; //todo: table look specifier
2886 + case NS_ooxml::LN_CT_TblPrBase_tblLook:
2887 + break; //todo: table look specifier
2888 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
2889 - case NS_ooxml::LN_CT_TcPrBase_tcW: break; //fixed column width is not supported
2890 - default: bRet = false;
2891 + case NS_ooxml::LN_CT_TcPrBase_tcW:
2892 + break; //fixed column width is not supported
2893 + case NS_ooxml::LN_CT_TrPrBase_cnfStyle:
2895 + TablePropertyMapPtr pProps( new TablePropertyMap );
2896 + pProps->Insert( PROP_CNF_STYLE, true, uno::makeAny( pValue->getString( ) ) );
2897 + insertRowProps( pProps );
2900 + case NS_ooxml::LN_CT_PPrBase_cnfStyle:
2901 + // TODO cnfStyle on a paragraph
2903 + case NS_ooxml::LN_CT_TcPrBase_cnfStyle:
2905 + TablePropertyMapPtr pProps( new TablePropertyMap );
2906 + pProps->Insert( PROP_CNF_STYLE, true, uno::makeAny( pValue->getString( ) ) );
2907 + cellProps( pProps );
2910 + case NS_ooxml::LN_tblStart:
2922 +boost::shared_ptr< vector<sal_Int32> > DomainMapperTableManager::getCurrentGrid( )
2924 + return m_aTableGrid.back( );
2927 +boost::shared_ptr< vector< sal_Int32 > > DomainMapperTableManager::getCurrentSpans( )
2929 + return m_aGridSpans.back( );
2932 +void DomainMapperTableManager::startLevel( )
2934 + DomainMapperTableManager_Base_t::startLevel( );
2936 + IntVectorPtr pNewGrid( new vector<sal_Int32> );
2937 + IntVectorPtr pNewSpans( new vector<sal_Int32> );
2938 + m_aTableGrid.push_back( pNewGrid );
2939 + m_aGridSpans.push_back( pNewSpans );
2940 + m_nTableWidth = 0;
2943 +void DomainMapperTableManager::endLevel( )
2945 + m_aTableGrid.pop_back( );
2946 + m_aGridSpans.pop_back( );
2948 + DomainMapperTableManager_Base_t::endLevel( );
2951 /*-- 02.05.2007 14:36:26---------------------------------------------------
2953 -----------------------------------------------------------------------*/
2954 @@ -439,10 +332,11 @@ void DomainMapperTableManager::endOfCellAction()
2955 -----------------------------------------------------------------------*/
2956 void DomainMapperTableManager::endOfRowAction()
2958 - if(!m_nRow && !m_nTableWidth && m_aTableGrid.size())
2959 + IntVectorPtr pTableGrid = getCurrentGrid( );
2960 + if(!m_nTableWidth && pTableGrid->size())
2962 - ::std::vector<sal_Int32>::const_iterator aCellIter = m_aTableGrid.begin();
2963 - while( aCellIter != m_aTableGrid.end() )
2964 + ::std::vector<sal_Int32>::const_iterator aCellIter = pTableGrid->begin();
2965 + while( aCellIter != pTableGrid->end() )
2966 m_nTableWidth += *aCellIter++;
2967 if( m_nTableWidth > 0)
2969 @@ -452,18 +346,20 @@ void DomainMapperTableManager::endOfRowAction()
2970 insertTableProps(pPropMap);
2973 - if( m_aGridSpans.size() < m_nCell)
2975 + IntVectorPtr pCurrentSpans = getCurrentSpans( );
2976 + if( pCurrentSpans->size() < m_nCell)
2978 //fill missing elements with '1'
2979 - m_aGridSpans.insert( m_aGridSpans.end(), m_nCell - m_aGridSpans.size(), 1 );
2980 + pCurrentSpans->insert( pCurrentSpans->end( ), m_nCell - pCurrentSpans->size(), 1 );
2982 //calculate number of used grids - it has to match the size of m_aTableGrid
2984 - ::std::vector<sal_Int32>::const_iterator aGridSpanIter = m_aGridSpans.begin();
2985 - for( ; aGridSpanIter != m_aGridSpans.end(); ++aGridSpanIter)
2986 + ::std::vector<sal_Int32>::const_iterator aGridSpanIter = pCurrentSpans->begin();
2987 + for( ; aGridSpanIter != pCurrentSpans->end(); ++aGridSpanIter)
2988 nGrids += *aGridSpanIter;
2990 - if( m_aTableGrid.size() == nGrids )
2991 + if( pTableGrid->size() == nGrids )
2993 //determine table width
2994 double nFullWidth = m_nTableWidth;
2995 @@ -473,13 +369,15 @@ void DomainMapperTableManager::endOfRowAction()
2996 text::TableColumnSeparator* pSeparators = aSeparators.getArray();
2997 sal_Int16 nLastRelPos = 0;
2998 sal_uInt32 nBorderGridIndex = 0;
3000 + ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( );
3001 for( sal_uInt32 nBorder = 0; nBorder < m_nCell - 1; ++nBorder )
3003 - sal_Int32 nGridCount = m_aGridSpans[nBorder];
3004 + sal_Int32 nGridCount = *aSpansIter;
3005 double fGridWidth = 0.;
3008 - fGridWidth += m_aTableGrid[nBorderGridIndex++];
3009 + fGridWidth += (*pTableGrid.get())[nBorderGridIndex++];
3010 }while( --nGridCount );
3013 @@ -488,6 +386,7 @@ void DomainMapperTableManager::endOfRowAction()
3014 pSeparators[nBorder].Position = nRelPos + nLastRelPos;
3015 pSeparators[nBorder].IsVisible = sal_True;
3016 nLastRelPos = nLastRelPos + nRelPos;
3019 TablePropertyMapPtr pPropMap( new TablePropertyMap );
3020 pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, false, uno::makeAny( aSeparators ) );
3021 @@ -497,7 +396,7 @@ void DomainMapperTableManager::endOfRowAction()
3024 m_nCellBorderIndex = 0;
3025 - m_aGridSpans.clear();
3026 + pCurrentSpans->clear();
3028 /*-- 18.06.2007 10:34:37---------------------------------------------------
3030 @@ -505,8 +404,6 @@ void DomainMapperTableManager::endOfRowAction()
3031 void DomainMapperTableManager::clearData()
3033 m_nRow = m_nCell = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = 0;
3034 - m_aTableGrid.clear();
3035 - m_aGridSpans.clear();
3036 m_sTableStyleName = ::rtl::OUString();
3037 m_pTableStyleTextProperies.reset();
3039 @@ -521,10 +418,10 @@ void lcl_CopyTextProperties(PropertyMapPtr pToFill,
3040 //fill base style properties first, recursively
3041 if( pStyleSheetEntry->sBaseStyleIdentifier.getLength())
3043 - const StyleSheetEntry* pParentStyleSheet =
3044 + const StyleSheetEntryPtr pParentStyleSheet =
3045 pStyleSheetTable->FindStyleSheetByISTD(pStyleSheetEntry->sBaseStyleIdentifier);
3046 OSL_ENSURE( pParentStyleSheet, "table style not found" );
3047 - lcl_CopyTextProperties( pToFill, pParentStyleSheet, pStyleSheetTable);
3048 + lcl_CopyTextProperties( pToFill, pParentStyleSheet.get( ), pStyleSheetTable);
3051 PropertyMap::const_iterator aPropIter = pStyleSheetEntry->pProperties->begin();
3052 @@ -541,10 +438,10 @@ void DomainMapperTableManager::CopyTextProperties(PropertyMapPtr pContext, Style
3053 if( !m_pTableStyleTextProperies.get())
3055 m_pTableStyleTextProperies.reset( new PropertyMap );
3056 - const StyleSheetEntry* pStyleSheetEntry = pStyleSheetTable->FindStyleSheetByISTD(
3057 + const StyleSheetEntryPtr pStyleSheetEntry = pStyleSheetTable->FindStyleSheetByISTD(
3059 OSL_ENSURE( pStyleSheetEntry, "table style not found" );
3060 - lcl_CopyTextProperties(m_pTableStyleTextProperies, pStyleSheetEntry, pStyleSheetTable);
3061 + lcl_CopyTextProperties(m_pTableStyleTextProperies, pStyleSheetEntry.get( ), pStyleSheetTable);
3063 pContext->insert( m_pTableStyleTextProperies );
3065 diff --git writerfilter/source/dmapper/DomainMapperTableManager.hxx writerfilter/source/dmapper/DomainMapperTableManager.hxx
3066 index c183252..d301acf 100644
3067 --- writerfilter/source/dmapper/DomainMapperTableManager.hxx
3068 +++ writerfilter/source/dmapper/DomainMapperTableManager.hxx
3070 #ifndef INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
3071 #define INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
3073 +#include "TablePropertiesHandler.hxx"
3075 #include <resourcemodel/TableManager.hxx>
3076 #include <PropertyMap.hxx>
3077 #include <StyleSheetTable.hxx>
3080 namespace writerfilter {
3082 -typedef ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > Handle_t;
3083 -typedef TableManager<Handle_t , TablePropertyMapPtr > DomainMapperTableManager_Base_t;
3085 class DomainMapperTableManager : public DomainMapperTableManager_Base_t
3087 + typedef boost::shared_ptr< std::vector<sal_Int32> > IntVectorPtr;
3091 sal_uInt32 m_nCellBorderIndex; //borders are provided for all cells and need counting
3092 @@ -51,9 +54,12 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t
3093 ::rtl::OUString m_sTableStyleName;
3094 PropertyMapPtr m_pTableStyleTextProperies;
3096 - ::std::vector<sal_Int32> m_aTableGrid;
3097 - ::std::vector<sal_Int32> m_aGridSpans;
3098 + ::std::vector< IntVectorPtr > m_aTableGrid;
3099 + ::std::vector< IntVectorPtr > m_aGridSpans;
3101 + TablePropertiesHandler *m_pTablePropsHandler;
3102 + PropertyMapPtr m_pStyleProps;
3104 virtual void clearData();
3107 @@ -61,15 +67,56 @@ public:
3108 DomainMapperTableManager(bool bOOXML);
3109 virtual ~DomainMapperTableManager();
3111 + // use this method to avoid adding the properties for the table
3112 + // but in the provided properties map.
3113 + inline void SetStyleProperties( PropertyMapPtr pProperties ) { m_pStyleProps = pProperties; };
3115 virtual bool sprm(Sprm & rSprm);
3117 + virtual void startLevel( );
3118 + virtual void endLevel( );
3120 virtual void endOfCellAction();
3121 virtual void endOfRowAction();
3123 + IntVectorPtr getCurrentGrid( );
3124 + IntVectorPtr getCurrentSpans( );
3126 const ::rtl::OUString& getTableStyleName() const { return m_sTableStyleName; }
3127 /// copy the text properties of the table style and its parent into pContext
3128 void CopyTextProperties(PropertyMapPtr pContext, StyleSheetTablePtr pStyleSheetTable);
3130 + inline virtual void cellProps(TablePropertyMapPtr pProps)
3132 + if ( m_pStyleProps.get( ) )
3133 + m_pStyleProps->insert( pProps, true );
3135 + DomainMapperTableManager_Base_t::cellProps( pProps );
3138 + inline virtual void cellPropsByCell(unsigned int i, TablePropertyMapPtr pProps)
3140 + if ( m_pStyleProps.get( ) )
3141 + m_pStyleProps->insert( pProps, true );
3143 + DomainMapperTableManager_Base_t::cellPropsByCell( i, pProps );
3146 + inline virtual void insertRowProps(TablePropertyMapPtr pProps)
3148 + if ( m_pStyleProps.get( ) )
3149 + m_pStyleProps->insert( pProps, true );
3151 + DomainMapperTableManager_Base_t::insertRowProps( pProps );
3154 + inline virtual void insertTableProps(TablePropertyMapPtr pProps)
3156 + if ( m_pStyleProps.get( ) )
3157 + m_pStyleProps->insert( pProps, true );
3159 + DomainMapperTableManager_Base_t::insertTableProps( pProps );
3164 diff --git writerfilter/source/dmapper/DomainMapper_Impl.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx
3165 index 051a2b8..0c8c037 100644
3166 --- writerfilter/source/dmapper/DomainMapper_Impl.cxx
3167 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx
3169 #include <com/sun/star/beans/XPropertyState.hpp>
3170 #include <com/sun/star/container/XIndexReplace.hpp>
3171 #include <com/sun/star/container/XNamed.hpp>
3172 +#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
3173 +#include <com/sun/star/drawing/XShapes.hpp>
3174 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
3175 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
3176 #include <com/sun/star/style/LineNumberPosition.hpp>
3178 #include <com/sun/star/text/ReferenceFieldPart.hpp>
3179 #include <com/sun/star/text/ReferenceFieldSource.hpp>
3180 #include <com/sun/star/text/SizeType.hpp>
3181 +#include <com/sun/star/text/TextContentAnchorType.hpp>
3182 #include <com/sun/star/text/WrapTextMode.hpp>
3183 #include <com/sun/star/text/XDependentTextField.hpp>
3184 #include <com/sun/star/text/XParagraphCursor.hpp>
3186 #include <com/sun/star/util/XNumberFormats.hpp>
3187 #include <rtl/ustrbuf.hxx>
3188 #include <rtl/string.h>
3190 +#include <tools/string.hxx>
3191 #ifdef DEBUG_DOMAINMAPPER
3192 #include <resourcemodel/QNameToString.hxx>
3193 #include <resourcemodel/util.hxx>
3195 #include <ooxml/OOXMLFastTokens.hxx>
3198 +#include <com/sun/star/lang/XServiceInfo.hpp>
3203 @@ -393,7 +401,8 @@ DomainMapper_Impl::DomainMapper_Impl(
3204 m_bIsFirstSection( true ),
3205 m_bIsColumnBreakDeferred( false ),
3206 m_bIsPageBreakDeferred( false ),
3207 - m_TableManager( eDocumentType == DOCUMENT_OOXML ),
3208 + m_bIsInShape( false ),
3209 + m_bShapeContextAdded( false ),
3210 m_nCurrentTabStopIndex( 0 ),
3211 m_sCurrentParaStyleId(),
3212 m_bInStyleSheetImport( false ),
3213 @@ -401,8 +410,11 @@ DomainMapper_Impl::DomainMapper_Impl(
3214 m_bLineNumberingSet( false ),
3215 m_bIsInFootnoteProperties( true ),
3216 m_bIsCustomFtnMark( false ),
3217 - n_CurrentRedlineToken( ooxml::OOXML_mod )
3218 + m_bIsParaChange( false ),
3219 + m_bParaChanged( false ),
3220 + m_bIsLastParaInSection( false )
3222 + appendTableManager( );
3224 uno::Reference< text::XTextAppend > xBodyTextAppend = uno::Reference< text::XTextAppend >( m_xBodyText, uno::UNO_QUERY );
3225 m_aTextAppendStack.push(xBodyTextAppend);
3226 @@ -411,17 +423,20 @@ DomainMapper_Impl::DomainMapper_Impl(
3227 uno::Reference< text::XTextAppendAndConvert > xBodyTextAppendAndConvert( m_xBodyText, uno::UNO_QUERY );
3228 TableDataHandler_t::Pointer_t pTableHandler
3229 (new DomainMapperTableHandler(xBodyTextAppendAndConvert, *this));
3230 - m_TableManager.setHandler(pTableHandler);
3231 + getTableManager( ).setHandler(pTableHandler);
3233 - m_TableManager.startLevel();
3234 + getTableManager( ).startLevel();
3236 /*-- 01.09.2006 10:22:28---------------------------------------------------
3238 -----------------------------------------------------------------------*/
3239 DomainMapper_Impl::~DomainMapper_Impl()
3241 - m_TableManager.endLevel();
3242 + RemoveLastParagraph( );
3243 + getTableManager( ).endLevel();
3244 + popTableManager( );
3247 /*-------------------------------------------------------------------------
3249 -----------------------------------------------------------------------*/
3250 @@ -474,6 +489,28 @@ void DomainMapper_Impl::SetDocumentSettingsProperty( const ::rtl::OUString& rPro
3255 +void DomainMapper_Impl::RemoveLastParagraph( )
3257 + uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
3260 + uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor();
3261 + xCursor->gotoEnd(false);
3262 + xCursor->goLeft( 1, true );
3263 + xCursor->setString(::rtl::OUString());
3265 + catch( const uno::Exception& rEx)
3271 +void DomainMapper_Impl::SetIsLastParagraphInSection( bool bIsLast )
3273 + m_bIsLastParaInSection = bIsLast;
3276 /*-------------------------------------------------------------------------
3278 -----------------------------------------------------------------------*/
3279 @@ -524,6 +561,7 @@ void DomainMapper_Impl::PushListProperties(PropertyMapPtr pListProperties)
3280 void DomainMapper_Impl::PopProperties(ContextType eId)
3282 OSL_ENSURE(!m_aPropertyStacks[eId].empty(), "section stack already empty");
3284 m_aPropertyStacks[eId].pop();
3285 m_aContextStack.pop();
3286 if(!m_aContextStack.empty() && !m_aPropertyStacks[m_aContextStack.top()].empty())
3287 @@ -685,13 +723,13 @@ uno::Sequence< style::TabStop > DomainMapper_Impl::GetCurrentTabStopAndClear()
3288 -----------------------------------------------------------------------*/
3289 uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId)
3291 - const StyleSheetEntry* pEntry = 0;
3292 + StyleSheetEntryPtr pEntry;
3293 if( m_bInStyleSheetImport )
3294 pEntry = GetStyleSheetTable()->FindParentStyleSheet(::rtl::OUString());
3297 GetStyleSheetTable()->FindStyleSheetByISTD(GetCurrentParaStyleId());
3299 + while(pEntry.get( ) )
3301 //is there a tab stop set?
3302 if(pEntry->pProperties)
3303 @@ -725,10 +763,10 @@ void DomainMapper_Impl::deferBreak( BreakType deferredBreakType)
3304 switch (deferredBreakType)
3307 - m_bIsColumnBreakDeferred = true;
3308 + m_bIsColumnBreakDeferred = true;
3311 - m_bIsPageBreakDeferred = true;
3312 + m_bIsPageBreakDeferred = true;
3316 @@ -831,16 +869,20 @@ void lcl_AddRangeAndStyle(
3317 /*-------------------------------------------------------------------------
3319 -----------------------------------------------------------------------*/
3320 -//define some default frame width - 10cm ATM
3321 -#define DEFAULT_FRAME_MIN_WIDTH 10000
3322 +//define some default frame width - 0cm ATM: this allow the frame to be wrapped around the text
3323 +#define DEFAULT_FRAME_MIN_WIDTH 0
3325 void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
3328 + clog << "finishParagraph" << endl;
3331 ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pPropertyMap.get() );
3332 TextAppendContext& rAppendContext = m_aTextAppendStack.top();
3333 uno::Reference< text::XTextAppend > xTextAppend = rAppendContext.xTextAppend;
3334 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
3335 - if(xTextAppend.is() && ! m_TableManager.isIgnore())
3336 + if(xTextAppend.is() && ! getTableManager( ).isIgnore())
3340 @@ -903,11 +945,11 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
3344 - const StyleSheetEntry* pParaStyle =
3345 + StyleSheetEntryPtr pParaStyle =
3346 m_pStyleSheetTable->FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties->GetParaStyleName());
3348 uno::Sequence< beans::PropertyValue > aFrameProperties(pParaStyle ? 15: 0);
3350 + if ( pParaStyle.get( ) )
3352 const ParagraphProperties* pStyleProperties = dynamic_cast<const ParagraphProperties*>( pParaStyle->pProperties.get() );
3353 beans::PropertyValue* pFrameProperties = aFrameProperties.getArray();
3354 @@ -1044,15 +1086,41 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
3356 uno::Reference< text::XTextRange > xTextRange =
3357 xTextAppend->finishParagraph( aProperties );
3358 - m_TableManager.handle(xTextRange);
3362 + getTableManager( ).handle(xTextRange);
3364 + // Set the anchor of the objects to the created paragraph
3365 + while ( m_aAnchoredStack.size( ) > 0 && !m_bIsInShape )
3367 + uno::Reference< text::XTextContent > xObj = m_aAnchoredStack.top( );
3370 + xObj->attach( xTextRange );
3372 + catch ( uno::RuntimeException& )
3374 + // this is normal: the shape is already attached
3376 + m_aAnchoredStack.pop( );
3379 + // Get the end of paragraph character inserted
3380 + uno::Reference< text::XTextCursor > xCur = xTextRange->getText( )->createTextCursor( );
3381 + xCur->gotoEnd( false );
3382 + xCur->goLeft( 1 , true );
3383 + uno::Reference< text::XTextRange > xParaEnd( xCur, uno::UNO_QUERY );
3384 + CheckParaRedline( xParaEnd );
3386 + // Remove the last empty section paragraph if needed
3387 + if ( m_bIsLastParaInSection && !m_bParaChanged )
3389 + RemoveLastParagraph( );
3390 + m_bIsLastParaInSection = false;
3393 + m_bParaChanged = false;
3395 if( !bKeepLastParagraphProperties )
3396 rAppendContext.pLastParagraphProperties = pToBeSavedProperties;
3399 catch(const lang::IllegalArgumentException& rIllegal)
3401 @@ -1062,7 +1130,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
3402 catch(const uno::Exception& rEx)
3405 - OSL_ENSURE( false, "ArgumentException in DomainMapper_Impl::finishParagraph" );
3406 + //OSL_ENSURE( false, "ArgumentException in DomainMapper_Impl::finishParagraph" );
3410 @@ -1091,45 +1159,23 @@ util::DateTime lcl_DateStringToDateTime( const ::rtl::OUString& rDateTime )
3412 void DomainMapper_Impl::appendTextPortion( const ::rtl::OUString& rString, PropertyMapPtr pPropertyMap )
3415 + clog << "DomainMapper_Impl::appendTextPortion( ) - ";
3416 + clog << rtl::OUStringToOString( rString, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
3418 uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
3419 - if(xTextAppend.is() && ! m_TableManager.isIgnore())
3420 + if(xTextAppend.is() && ! getTableManager( ).isIgnore())
3424 uno::Reference< text::XTextRange > xTextRange =
3425 xTextAppend->appendTextPortion
3426 (rString, pPropertyMap->GetPropertyValues());
3427 - if( m_CurrentRedlineDate.getLength() )
3431 - ::rtl::OUString sType;
3432 - PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
3433 - switch(n_CurrentRedlineToken & 0xffff)
3435 - case ooxml::OOXML_mod : sType = rPropNameSupplier.GetName( PROP_FORMAT ); break;
3436 - case ooxml::OOXML_ins : sType = rPropNameSupplier.GetName( PROP_INSERT ); break;
3437 - case ooxml::OOXML_del : sType = rPropNameSupplier.GetName( PROP_DELETE ); break;
3439 - uno::Reference< text::XRedline > xRedline( xTextRange, uno::UNO_QUERY_THROW );
3440 - beans::PropertyValues aRedlineProperties( 2 );
3441 - beans::PropertyValue* pRedlineProperties = aRedlineProperties.getArray();
3442 - pRedlineProperties[0].Name = rPropNameSupplier.GetName( PROP_REDLINE_AUTHOR );
3443 - pRedlineProperties[0].Value <<= m_CurrentRedlineAuthor;
3444 - pRedlineProperties[1].Name = rPropNameSupplier.GetName( PROP_REDLINE_DATE_TIME );
3445 - pRedlineProperties[1].Value <<= lcl_DateStringToDateTime( m_CurrentRedlineDate );
3446 - xRedline->makeRedline( sType, aRedlineProperties);
3447 + CheckRedline( xTextRange );
3450 - catch( const uno::Exception& rEx )
3453 - OSL_ENSURE( false, "Exception in makeRedline" );
3455 - ResetRedlineProperties();
3457 + m_bParaChanged = true;
3459 - //m_TableManager.handle(xTextRange);
3460 + //getTableManager( ).handle(xTextRange);
3462 catch(const lang::IllegalArgumentException& rEx)
3464 @@ -1153,7 +1199,7 @@ void DomainMapper_Impl::appendTextContent(
3466 uno::Reference< text::XTextAppendAndConvert > xTextAppendAndConvert( m_aTextAppendStack.top().xTextAppend, uno::UNO_QUERY );
3467 OSL_ENSURE( xTextAppendAndConvert.is(), "trying to append a text content without XTextAppendAndConvert" );
3468 - if(xTextAppendAndConvert.is() && ! m_TableManager.isIgnore())
3469 + if(xTextAppendAndConvert.is() && ! getTableManager( ).isIgnore())
3473 @@ -1167,6 +1213,7 @@ void DomainMapper_Impl::appendTextContent(
3478 /*-- 24.04.2008 08:38:07---------------------------------------------------
3480 -----------------------------------------------------------------------*/
3481 @@ -1319,18 +1366,7 @@ void DomainMapper_Impl::PopPageHeaderFooter()
3483 //header and footer always have an empty paragraph at the end
3484 //this has to be removed
3485 - uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
3488 - uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor();
3489 - xCursor->gotoEnd(false);
3490 - xCursor->goLeft( 1, true );
3491 - xCursor->setString(::rtl::OUString());
3493 - catch( const uno::Exception& rEx)
3497 + RemoveLastParagraph( );
3498 m_aTextAppendStack.pop();
3500 /*-- 24.05.2007 14:22:28---------------------------------------------------
3501 @@ -1351,31 +1387,99 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote )
3503 xFootnote->setLabel( ::rtl::OUString( pTopContext->GetFootnoteSymbol() ) );
3505 - FontTablePtr pFontTable = GetFontTable();
3506 - uno::Sequence< beans::PropertyValue > aFontProperties;
3507 - if( pFontTable && pTopContext->GetFootnoteFontId() >= 0 && pFontTable->size() > (size_t)pTopContext->GetFootnoteFontId() )
3509 + appendTextContent( uno::Reference< text::XTextContent >( xFootnoteText, uno::UNO_QUERY_THROW ),
3510 + pTopContext->GetPropertyValues( ) );
3511 + m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xFootnoteText, uno::UNO_QUERY_THROW ));
3513 + // Redlines for the footnote anchor
3514 + CheckRedline( xFootnote->getAnchor( ) );
3516 + catch( uno::Exception& )
3518 + OSL_ENSURE( false, "exception in PushFootOrEndnote" );
3522 +void DomainMapper_Impl::CreateRedline( uno::Reference< text::XTextRange > xRange, RedlineParamsPtr& pRedline )
3524 + if ( pRedline.get( ) )
3527 + clog << "REDLINE: Writing redline: " << pRedline->m_nId << endl;
3531 - const FontEntry* pFontEntry = pFontTable->getFontEntry(sal_uInt32(pTopContext->GetFootnoteFontId()));
3532 - PropertyMapPtr aFontProps( new PropertyMap );
3533 - aFontProps->Insert(PROP_CHAR_FONT_NAME, true, uno::makeAny( pFontEntry->sFontName ));
3534 - aFontProps->Insert(PROP_CHAR_FONT_CHAR_SET, true, uno::makeAny( (sal_Int16)pFontEntry->nTextEncoding ));
3535 - aFontProps->Insert(PROP_CHAR_FONT_PITCH, true, uno::makeAny( pFontEntry->nPitchRequest ));
3536 - aFontProperties = aFontProps->GetPropertyValues();
3537 + ::rtl::OUString sType;
3538 + PropertyNameSupplier & rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier( );
3539 + switch ( pRedline->m_nToken & 0xffff )
3541 + case ooxml::OOXML_mod:
3542 + sType = rPropNameSupplier.GetName( PROP_FORMAT );
3544 + case ooxml::OOXML_ins:
3545 + sType = rPropNameSupplier.GetName( PROP_INSERT );
3547 + case ooxml::OOXML_del:
3548 + sType = rPropNameSupplier.GetName( PROP_DELETE );
3551 + uno::Reference < text::XRedline > xRedline( xRange, uno::UNO_QUERY_THROW );
3552 + beans::PropertyValues aRedlineProperties( 2 );
3553 + beans::PropertyValue * pRedlineProperties = aRedlineProperties.getArray( );
3554 + pRedlineProperties[0].Name = rPropNameSupplier.GetName( PROP_REDLINE_AUTHOR );
3555 + pRedlineProperties[0].Value <<= pRedline->m_sAuthor;
3556 + pRedlineProperties[1].Name = rPropNameSupplier.GetName( PROP_REDLINE_DATE_TIME );
3557 + pRedlineProperties[1].Value <<= lcl_DateStringToDateTime( pRedline->m_sDate );
3559 + xRedline->makeRedline( sType, aRedlineProperties );
3561 - else if(pTopContext->GetFootnoteFontName().getLength())
3562 + catch( const uno::Exception & rEx )
3564 - PropertyMapPtr aFontProps( new PropertyMap );
3565 - aFontProps->Insert(PROP_CHAR_FONT_NAME, true, uno::makeAny( pTopContext->GetFootnoteFontName() ));
3566 - aFontProperties = aFontProps->GetPropertyValues();
3568 + clog << "REDLINE: error - " << rtl::OUStringToOString( rEx.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
3571 + OSL_ENSURE( false, "Exception in makeRedline" );
3576 - appendTextContent( uno::Reference< text::XTextContent >( xFootnoteText, uno::UNO_QUERY_THROW ), aFontProperties );
3577 - m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xFootnoteText, uno::UNO_QUERY_THROW ));
3578 +void DomainMapper_Impl::CheckParaRedline( uno::Reference< text::XTextRange > xRange )
3580 + if ( m_pParaRedline.get( ) )
3582 + CreateRedline( xRange, m_pParaRedline );
3583 + ResetParaRedline( );
3585 - catch( uno::Exception& )
3588 +void DomainMapper_Impl::CheckRedline( uno::Reference< text::XTextRange > xRange )
3590 + vector<RedlineParamsPtr>::iterator pIt = m_aRedlines.begin( );
3591 + vector< RedlineParamsPtr > aCleaned;
3592 + for (; pIt != m_aRedlines.end( ); pIt++ )
3594 - OSL_ENSURE( false, "exception in PushFootOrEndnote" );
3595 + CreateRedline( xRange, *pIt );
3597 + // Adding the non-mod redlines to the temporary vector
3598 + if ( pIt->get( ) && ( ( *pIt )->m_nToken & 0xffff ) != ooxml::OOXML_mod )
3600 + aCleaned.push_back( *pIt );
3604 + m_aRedlines.swap( aCleaned );
3607 +void DomainMapper_Impl::StartParaChange( )
3609 + m_bIsParaChange = true;
3612 +void DomainMapper_Impl::EndParaChange( )
3614 + m_bIsParaChange = false;
3617 /*-- 22.12.2008 13:45:15---------------------------------------------------
3618 @@ -1416,57 +1520,58 @@ void DomainMapper_Impl::PopAnnotation()
3619 m_xAnnotationField.clear();
3622 -/*-- 20.03.2008 09:01:58---------------------------------------------------
3624 - -----------------------------------------------------------------------*/
3625 -void DomainMapper_Impl::PushShapeContext()
3626 +void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape > xShape )
3630 + clog << "PushShapeContext" << endl;
3632 + m_bIsInShape = true;
3635 - uno::Reference< text::XText > xTemporaryShape( GetTextFactory()->createInstance(
3636 - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape") )),
3637 - uno::UNO_QUERY_THROW );
3638 - uno::Reference< text::XTextAppend > xShapeAppend( xTemporaryShape, uno::UNO_QUERY );
3639 - //insert into the document
3640 - uno::Reference< text::XTextContent > xShapeContent( xTemporaryShape, uno::UNO_QUERY_THROW );
3641 - xShapeContent->attach( GetBodyText()->getStart() );
3642 - m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xShapeAppend, uno::UNO_QUERY_THROW ));
3644 - catch( uno::Exception& )
3645 + // Add the shape to the text append stack
3646 + m_aTextAppendStack.push( uno::Reference< text::XTextAppend >( xShape, uno::UNO_QUERY_THROW ) );
3647 + m_bShapeContextAdded = true;
3649 + // Add the shape to the anchored objects stack
3650 + uno::Reference< text::XTextContent > xTxtContent( xShape, uno::UNO_QUERY_THROW );
3651 + m_aAnchoredStack.push( xTxtContent );
3653 + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
3655 + uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
3656 + xProps->setPropertyValue(
3657 + rPropNameSupplier.GetName( PROP_ANCHOR_TYPE ),
3658 + uno::makeAny( text::TextContentAnchorType_AT_PARAGRAPH ) );
3659 + xProps->setPropertyValue(
3660 + rPropNameSupplier.GetName( PROP_OPAQUE ),
3661 + uno::makeAny( true ) );
3663 + catch ( const uno::Exception& e )
3665 - OSL_ENSURE( false, "exception in DomainMapper_Impl::PushShapeContext" );
3667 + clog << "Exception when adding shape: ";
3668 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( );
3674 /*-- 20.03.2008 09:01:59---------------------------------------------------
3676 -----------------------------------------------------------------------*/
3677 void DomainMapper_Impl::PopShapeContext()
3679 - m_xTemporaryShape = uno::Reference< drawing::XShape >( m_aTextAppendStack.top().xTextAppend, uno::UNO_QUERY );
3680 - m_aTextAppendStack.pop();
3682 -/*-- 20.03.2008 12:31:58---------------------------------------------------
3684 - -----------------------------------------------------------------------*/
3685 -void DomainMapper_Impl::CopyTemporaryShapeText( uno::Reference< drawing::XShape > xShape )
3687 - uno::Reference< text::XTextCopy >xShapeText( xShape, uno::UNO_QUERY );
3688 - uno::Reference< text::XTextCopy >xTempShapeText( m_xTemporaryShape, uno::UNO_QUERY );
3689 - if( xShapeText.is() && xTempShapeText.is() )
3691 - xShapeText->copyText( xTempShapeText );
3695 - uno::Reference< lang::XComponent >xTemp( m_xTemporaryShape, uno::UNO_QUERY );
3699 - catch( const uno::Exception& )
3701 + clog << "PopShapeContext" << endl;
3704 + if ( m_bShapeContextAdded )
3706 + m_aTextAppendStack.pop();
3707 + m_bShapeContextAdded = false;
3709 - m_xTemporaryShape = uno::Reference< drawing::XShape >();
3711 + m_bIsInShape = false;
3713 /*-- 12.09.2006 08:07:55---------------------------------------------------
3715 @@ -2952,6 +3057,7 @@ void DomainMapper_Impl::CloseFieldCommand()
3716 bool bHyperlinks = false;
3717 bool bFromOutline = false;
3718 bool bFromEntries = false;
3719 + sal_Int16 nMaxLevel = 10;
3720 ::rtl::OUString sTemplate;
3721 ::rtl::OUString sChapterNoSeparator;
3722 // \a Builds a table of figures but does not include the captions's label and number
3723 @@ -3001,6 +3107,10 @@ void DomainMapper_Impl::CloseFieldCommand()
3724 if( lcl_FindInCommand( pContext->GetCommand(), 'o', sValue ))
3726 bFromOutline = true;
3727 + UniString sParam( sValue );
3728 + xub_StrLen nIndex = 0;
3729 + sParam.GetToken( 0, '-', nIndex );
3730 + nMaxLevel = sal_Int16( sParam.Copy( nIndex ).ToInt32( ) );
3732 // \p Defines the separator between the table entry and its page number
3733 if( lcl_FindInCommand( pContext->GetCommand(), 'p', sValue ))
3734 @@ -3048,6 +3158,7 @@ void DomainMapper_Impl::CloseFieldCommand()
3735 xTOC->setPropertyValue(rPropNameSupplier.GetName( PROP_TITLE ), uno::makeAny(::rtl::OUString()));
3736 if( !bTableOfFigures )
3738 + xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_LEVEL ), uno::makeAny( nMaxLevel ) );
3739 xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_CREATE_FROM_OUTLINE ), uno::makeAny( bFromOutline ));
3740 xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_CREATE_FROM_MARKS ), uno::makeAny( bFromEntries ));
3741 if( sTemplate.getLength() )
3742 @@ -3531,14 +3642,98 @@ bool DomainMapper_Impl::ExecuteFrameConversion()
3747 +void DomainMapper_Impl::AddNewRedline( )
3749 + RedlineParamsPtr pNew( new RedlineParams );
3750 + pNew->m_nToken = ooxml::OOXML_mod;
3751 + if ( !m_bIsParaChange )
3754 + clog << "REDLINE: Adding a new redline to stack" << endl;
3756 + m_aRedlines.push_back( pNew );
3761 + clog << "REDLINE: Setting a new paragraph redline" << endl;
3763 + m_pParaRedline.swap( pNew );
3767 +RedlineParamsPtr DomainMapper_Impl::GetTopRedline( )
3769 + RedlineParamsPtr pResult;
3770 + if ( !m_bIsParaChange && m_aRedlines.size( ) > 0 )
3771 + pResult = m_aRedlines.back( );
3772 + else if ( m_bIsParaChange )
3773 + pResult = m_pParaRedline;
3777 +sal_Int32 DomainMapper_Impl::GetCurrentRedlineToken( )
3780 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
3781 + if ( pCurrent.get( ) )
3782 + nToken = pCurrent->m_nToken;
3786 +void DomainMapper_Impl::SetCurrentRedlineAuthor( rtl::OUString sAuthor )
3788 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
3789 + if ( pCurrent.get( ) )
3790 + pCurrent->m_sAuthor = sAuthor;
3793 +void DomainMapper_Impl::SetCurrentRedlineDate( rtl::OUString sDate )
3795 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
3796 + if ( pCurrent.get( ) )
3797 + pCurrent->m_sDate = sDate;
3800 +void DomainMapper_Impl::SetCurrentRedlineId( sal_Int32 sId )
3802 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
3803 + if ( pCurrent.get( ) )
3804 + pCurrent->m_nId = sId;
3807 +void DomainMapper_Impl::SetCurrentRedlineToken( sal_Int32 nToken )
3809 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
3810 + if ( pCurrent.get( ) )
3811 + pCurrent->m_nToken = nToken;
3814 /*-- 19.03.2008 11:35:38---------------------------------------------------
3816 -----------------------------------------------------------------------*/
3817 -void DomainMapper_Impl::ResetRedlineProperties()
3818 +void DomainMapper_Impl::RemoveCurrentRedline( )
3820 - m_CurrentRedlineAuthor = m_CurrentRedlineDate = m_CurrentRedlineId = ::rtl::OUString();
3821 - n_CurrentRedlineToken = ooxml::OOXML_mod;
3822 + if ( m_aRedlines.size( ) > 0 )
3825 + clog << "REDLINE: Removing back redline" << endl;
3827 + m_aRedlines.pop_back( );
3831 +void DomainMapper_Impl::ResetParaRedline( )
3833 + if ( m_pParaRedline.get( ) )
3836 + clog << "REDLINE: Cleaning the para redline" << endl;
3838 + RedlineParamsPtr pEmpty;
3839 + m_pParaRedline.swap( pEmpty );
3844 diff --git writerfilter/source/dmapper/DomainMapper_Impl.hxx writerfilter/source/dmapper/DomainMapper_Impl.hxx
3845 index f4dfaf0..ab0a561 100644
3846 --- writerfilter/source/dmapper/DomainMapper_Impl.hxx
3847 +++ writerfilter/source/dmapper/DomainMapper_Impl.hxx
3849 #include <com/sun/star/text/XTextCursor.hpp>
3850 #include <com/sun/star/text/XTextAppend.hpp>
3851 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
3852 +#include <com/sun/star/text/XTextFrame.hpp>
3853 #include <com/sun/star/style/TabStop.hpp>
3854 #include <com/sun/star/container/XNameContainer.hpp>
3857 #include <LFOTable.hxx>
3858 #include <StyleSheetTable.hxx>
3859 #include <ThemeTable.hxx>
3860 +#include <SettingsTable.hxx>
3861 #include <GraphicImport.hxx>
3862 #include <OLEHandler.hxx>
3864 @@ -177,6 +179,7 @@ typedef std::stack<ContextType> ContextStack;
3865 typedef std::stack<PropertyMapPtr> PropertyStack;
3866 typedef std::stack< TextAppendContext > TextAppendStack;
3867 typedef std::stack<FieldContextPtr> FieldStack;
3868 +typedef std::stack< com::sun::star::uno::Reference< com::sun::star::text::XTextContent > > TextContentStack;
3870 /*-- 18.07.2006 08:49:08---------------------------------------------------
3872 @@ -225,6 +228,15 @@ struct BookmarkInsertPosition
3876 +struct RedlineParams
3878 + ::rtl::OUString m_sAuthor;
3879 + ::rtl::OUString m_sDate;
3881 + sal_Int32 m_nToken;
3883 +typedef boost::shared_ptr< RedlineParams > RedlineParamsPtr;
3885 /*-- 03.03.2008 11:01:38---------------------------------------------------
3887 -----------------------------------------------------------------------*/
3888 @@ -267,12 +279,17 @@ private:
3890 TextAppendStack m_aTextAppendStack;
3895 FieldStack m_aFieldStack;
3897 bool m_bSetUserFieldContent;
3898 bool m_bIsFirstSection;
3899 bool m_bIsColumnBreakDeferred;
3900 bool m_bIsPageBreakDeferred;
3901 + bool m_bIsInShape;
3902 + bool m_bShapeContextAdded;
3904 LineNumberSettings m_aLineNumberSettings;
3906 @@ -281,7 +298,8 @@ private:
3907 _PageMar m_aPageMargins;
3910 - DomainMapperTableManager m_TableManager;
3911 + // TableManagers are stacked: one for each stream to avoid any confusion
3912 + std::stack< boost::shared_ptr< DomainMapperTableManager > > m_aTableManagers;
3914 //each context needs a stack of currently used attributes
3916 @@ -293,6 +311,7 @@ private:
3917 StyleSheetTablePtr m_pStyleSheetTable;
3918 ThemeTablePtr m_pThemeTable;
3919 GraphicImportPtr m_pGraphicImport;
3920 + SettingsTablePtr m_pSettingsTable;
3922 PropertyMapPtr m_pTopContext;
3924 @@ -311,14 +330,14 @@ private:
3925 ::com::sun::star::uno::Reference< text::XTextRange > m_xFrameStartRange;
3926 ::com::sun::star::uno::Reference< text::XTextRange > m_xFrameEndRange;
3929 - ::rtl::OUString m_CurrentRedlineAuthor;
3930 - ::rtl::OUString m_CurrentRedlineDate;
3931 - ::rtl::OUString m_CurrentRedlineId;
3932 - sal_Int32 n_CurrentRedlineToken;
3934 + std::vector< RedlineParamsPtr > m_aRedlines;
3935 + RedlineParamsPtr m_pParaRedline;
3936 + bool m_bIsParaChange;
3938 + bool m_bParaChanged;
3939 + bool m_bIsLastParaInSection;
3942 - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xTemporaryShape;
3945 uno::Reference< beans::XPropertySet > m_xAnnotationField;
3946 @@ -357,6 +376,18 @@ public:
3948 void SetDocumentSettingsProperty( const ::rtl::OUString& rPropName, const uno::Any& rValue );
3950 + void CreateRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange, RedlineParamsPtr& pRedline );
3952 + void CheckParaRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange );
3954 + void CheckRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange );
3956 + void StartParaChange( );
3957 + void EndParaChange( );
3959 + void RemoveLastParagraph( );
3960 + void SetIsLastParagraphInSection( bool bIsLast );
3962 void deferBreak( BreakType deferredBreakType );
3963 bool isBreakDeferred( BreakType deferredBreakType );
3964 void clearDeferredBreaks();
3965 @@ -412,6 +443,13 @@ public:
3966 return m_pThemeTable;
3969 + SettingsTablePtr GetSettingsTable( )
3971 + if ( !m_pSettingsTable )
3972 + m_pSettingsTable.reset( new SettingsTable );
3973 + return m_pSettingsTable;
3976 GraphicImportPtr GetGraphicImport( GraphicImportType eGraphicImportType );
3977 void ResetGraphicImport();
3978 // this method deletes the current m_pGraphicImport after import
3979 @@ -432,10 +470,8 @@ public:
3980 void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;}
3981 bool IsAnyTableImport()const { return m_bInAnyTableImport;}
3983 - void PushShapeContext();
3984 + void PushShapeContext( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
3985 void PopShapeContext();
3986 - bool IsInShapeContext() const { return m_xTemporaryShape.is(); }
3987 - void CopyTemporaryShapeText( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
3989 void PushPageHeader(SectionPropertyMap::PageType eType);
3990 void PushPageFooter(SectionPropertyMap::PageType eType);
3991 @@ -466,7 +502,25 @@ public:
3993 void AddBookmark( const ::rtl::OUString& rBookmarkName, const ::rtl::OUString& rId );
3995 - DomainMapperTableManager& getTableManager() { return m_TableManager; }
3996 + DomainMapperTableManager& getTableManager()
3998 + boost::shared_ptr< DomainMapperTableManager > pMngr = m_aTableManagers.top();
3999 + return *pMngr.get( );
4002 + void appendTableManager( )
4004 + boost::shared_ptr< DomainMapperTableManager > pMngr(
4005 + new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML ) );
4006 + m_aTableManagers.push( pMngr );
4009 + void popTableManager( )
4011 + if ( m_aTableManagers.size( ) > 0 )
4012 + m_aTableManagers.pop( );
4016 void SetLineNumbering( sal_Int32 nLnnMod, sal_Int32 nLnc, sal_Int32 ndxaLnn );
4017 bool IsLineNumberingSet() const {return m_bLineNumberingSet;}
4018 @@ -495,19 +549,17 @@ public:
4020 bool ExecuteFrameConversion();
4022 - ::rtl::OUString GetCurrentRedlineAuthor() const { return m_CurrentRedlineAuthor; }
4023 - void SetCurrentRedlineAuthor( const ::rtl::OUString& rSet ) { m_CurrentRedlineAuthor = rSet; }
4025 - ::rtl::OUString GetCurrentRedlineDate() const { return m_CurrentRedlineDate; }
4026 - void SetCurrentRedlineDate( const ::rtl::OUString& rSet ) { m_CurrentRedlineDate = rSet; }
4028 - ::rtl::OUString GetCurrentRedlineId() const { return m_CurrentRedlineId; }
4029 - void SetCurrentRedlineId( const ::rtl::OUString& rSet ) { m_CurrentRedlineId = rSet; }
4030 + void AddNewRedline( );
4032 - sal_Int32 GetCurrentRedlineToken() const { return n_CurrentRedlineToken; }
4033 - void SetCurrentRedlineToken(sal_Int32 nSet) { n_CurrentRedlineToken = nSet; }
4034 + RedlineParamsPtr GetTopRedline( );
4036 - void ResetRedlineProperties();
4037 + sal_Int32 GetCurrentRedlineToken( );
4038 + void SetCurrentRedlineAuthor( rtl::OUString sAuthor );
4039 + void SetCurrentRedlineDate( rtl::OUString sDate );
4040 + void SetCurrentRedlineId( sal_Int32 nId );
4041 + void SetCurrentRedlineToken( sal_Int32 nToken );
4042 + void RemoveCurrentRedline( );
4043 + void ResetParaRedline( );
4046 } //namespace dmapper
4047 diff --git writerfilter/source/dmapper/FontTable.cxx writerfilter/source/dmapper/FontTable.cxx
4048 index 7e3251d..16be55d 100644
4049 --- writerfilter/source/dmapper/FontTable.cxx
4050 +++ writerfilter/source/dmapper/FontTable.cxx
4051 @@ -647,6 +647,15 @@ void FontTable::substream(Id, ::writerfilter::Reference<Stream>::Pointer_t)
4052 void FontTable::info(const string& )
4056 +void FontTable::startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > )
4060 +void FontTable::endShape( )
4064 /*-- 21.06.2006 11:21:38---------------------------------------------------
4066 -----------------------------------------------------------------------*/
4067 diff --git writerfilter/source/dmapper/FontTable.hxx writerfilter/source/dmapper/FontTable.hxx
4068 index 498e816..f6e8859 100644
4069 --- writerfilter/source/dmapper/FontTable.hxx
4070 +++ writerfilter/source/dmapper/FontTable.hxx
4071 @@ -98,6 +98,8 @@ public:
4072 virtual void substream(Id name,
4073 ::writerfilter::Reference<Stream>::Pointer_t ref);
4074 virtual void info(const string & info);
4075 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
4076 + virtual void endShape( );
4078 const FontEntry* getFontEntry(sal_uInt32 nIndex);
4080 diff --git writerfilter/source/dmapper/GraphicHelpers.cxx writerfilter/source/dmapper/GraphicHelpers.cxx
4081 new file mode 100644
4082 index 0000000..a9508c5
4084 +++ writerfilter/source/dmapper/GraphicHelpers.cxx
4086 +#include "ConversionHelper.hxx"
4087 +#include "GraphicHelpers.hxx"
4089 +#include <ooxml/resourceids.hxx>
4091 +#include <com/sun/star/text/HoriOrientation.hpp>
4092 +#include <com/sun/star/text/VertOrientation.hpp>
4093 +#include <com/sun/star/text/RelOrientation.hpp>
4094 +#include <com/sun/star/text/WrapTextMode.hpp>
4096 +#include <iostream>
4097 +using namespace std;
4099 +namespace writerfilter {
4100 +namespace dmapper {
4102 +using namespace com::sun::star;
4104 +PositionHandler::PositionHandler( ) :
4107 + m_nOrient = text::VertOrientation::NONE;
4108 + m_nRelation = text::RelOrientation::FRAME;
4112 +PositionHandler::~PositionHandler( )
4116 +void PositionHandler::attribute( Id aName, Value& rVal )
4118 + sal_Int32 nIntValue = rVal.getInt( );
4121 + case NS_ooxml::LN_CT_PosV_relativeFrom:
4123 + // TODO There are some other unhandled values
4124 + static Id pVertRelValues[] =
4126 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin,
4127 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page,
4128 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph,
4129 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line
4132 + static sal_Int16 pVertRelations[] =
4134 + text::RelOrientation::PAGE_PRINT_AREA,
4135 + text::RelOrientation::PAGE_FRAME,
4136 + text::RelOrientation::FRAME,
4137 + text::RelOrientation::TEXT_LINE
4140 + for ( int i = 0; i < 4; i++ )
4142 + if ( pVertRelValues[i] == sal_uInt32( nIntValue ) )
4143 + m_nRelation = pVertRelations[i];
4147 + case NS_ooxml::LN_CT_PosH_relativeFrom:
4149 + // TODO There are some other unhandled values
4150 + static Id pHoriRelValues[] =
4152 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_margin,
4153 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page,
4154 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_column,
4155 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_character
4158 + static sal_Int16 pHoriRelations[] =
4160 + text::RelOrientation::PAGE_PRINT_AREA,
4161 + text::RelOrientation::PAGE_FRAME,
4162 + text::RelOrientation::FRAME,
4163 + text::RelOrientation::CHAR,
4166 + for ( int i = 0; i < 4; i++ )
4168 + if ( pHoriRelValues[i] == sal_uInt32( nIntValue ) )
4169 + m_nRelation = pHoriRelations[i];
4177 +void PositionHandler::sprm( Sprm& rSprm )
4179 + Value::Pointer_t pValue = rSprm.getValue();
4180 + sal_Int32 nIntValue = pValue->getInt();
4182 + switch ( rSprm.getId( ) )
4184 + case NS_ooxml::LN_CT_PosV_align:
4186 + static Id pVertValues[] =
4188 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_top,
4189 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_bottom,
4190 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_center,
4191 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_inside,
4192 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_outside
4195 + static sal_Int16 pVertOrients[] =
4197 + text::VertOrientation::TOP,
4198 + text::VertOrientation::BOTTOM,
4199 + text::VertOrientation::CENTER,
4200 + text::VertOrientation::NONE,
4201 + text::VertOrientation::NONE
4204 + for ( int i = 0; i < 5; i++ )
4206 + if ( pVertValues[i] == sal_uInt32( nIntValue ) )
4207 + m_nOrient = pVertOrients[i];
4211 + case NS_ooxml::LN_CT_PosH_align:
4213 + static Id pHoriValues[] =
4215 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_left,
4216 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_right,
4217 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_center,
4218 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_inside,
4219 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_outside
4222 + static sal_Int16 pHoriOrients[] =
4224 + text::HoriOrientation::LEFT,
4225 + text::HoriOrientation::RIGHT,
4226 + text::HoriOrientation::CENTER,
4227 + text::HoriOrientation::INSIDE,
4228 + text::HoriOrientation::OUTSIDE
4231 + for ( int i = 0; i < 5; i++ )
4233 + if ( pHoriValues[i] == sal_uInt32( nIntValue ) )
4234 + m_nOrient = pHoriOrients[i];
4238 + case NS_ooxml::LN_CT_PosH_posOffset:
4239 + case NS_ooxml::LN_CT_PosV_posOffset:
4240 + m_nPosition = ConversionHelper::convertEMUToMM100( nIntValue );
4245 +WrapHandler::WrapHandler( ) :
4252 +WrapHandler::~WrapHandler( )
4256 +void WrapHandler::attribute( Id aName, Value& rVal )
4260 + case NS_ooxml::LN_CT_Wrap_type:
4261 + m_nType = sal_Int32( rVal.getInt( ) );
4263 + case NS_ooxml::LN_CT_Wrap_side:
4264 + m_nSide = sal_Int32( rVal.getInt( ) );
4270 +void WrapHandler::sprm( Sprm& )
4274 +sal_Int32 WrapHandler::getWrapMode( )
4276 + sal_Int32 nMode = com::sun::star::text::WrapTextMode_NONE;
4278 + switch ( m_nType )
4280 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_square:
4281 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_tight:
4283 + switch ( m_nSide )
4285 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapSide_left:
4286 + nMode = com::sun::star::text::WrapTextMode_LEFT;
4288 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapSide_right:
4289 + nMode = com::sun::star::text::WrapTextMode_RIGHT;
4292 + nMode = com::sun::star::text::WrapTextMode_PARALLEL;
4296 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_through:
4297 + nMode = com::sun::star::text::WrapTextMode_THROUGHT;
4299 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_topAndBottom:
4300 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_none:
4302 + nMode = com::sun::star::text::WrapTextMode_NONE;
4309 diff --git writerfilter/source/dmapper/GraphicHelpers.hxx writerfilter/source/dmapper/GraphicHelpers.hxx
4310 new file mode 100644
4311 index 0000000..5142c8b
4313 +++ writerfilter/source/dmapper/GraphicHelpers.hxx
4315 +#ifndef INCLUDED_GRAPHICHELPERS_HXX
4316 +#define INCLUDED_GRAPHICHELPERS_HXX
4318 +#include "PropertyMap.hxx"
4320 +#include <WriterFilterDllApi.hxx>
4321 +#include <resourcemodel/WW8ResourceModel.hxx>
4323 +#include <boost/shared_ptr.hpp>
4325 +namespace writerfilter {
4329 +class WRITERFILTER_DLLPRIVATE PositionHandler: public Properties
4332 + PositionHandler( );
4333 + ~PositionHandler( );
4335 + sal_Int16 m_nOrient;
4336 + sal_Int16 m_nRelation;
4337 + sal_Int32 m_nPosition;
4339 + virtual void attribute( Id aName, Value& rVal );
4340 + virtual void sprm( Sprm& rSprm );
4342 +typedef boost::shared_ptr<PositionHandler> PositionHandlerPtr;
4344 +class WRITERFILTER_DLLPRIVATE WrapHandler: public Properties
4350 + sal_Int32 m_nType;
4351 + sal_Int32 m_nSide;
4353 + sal_Int32 getWrapMode( );
4355 + virtual void attribute( Id aName, Value& rVal );
4356 + virtual void sprm( Sprm& rSprm );
4358 +typedef boost::shared_ptr<WrapHandler> WrapHandlerPtr;
4363 diff --git writerfilter/source/dmapper/GraphicImport.cxx writerfilter/source/dmapper/GraphicImport.cxx
4364 index c234d69..31519f8 100644
4365 --- writerfilter/source/dmapper/GraphicImport.cxx
4366 +++ writerfilter/source/dmapper/GraphicImport.cxx
4369 ************************************************************************/
4371 -#include <GraphicImport.hxx>
4372 +#include "GraphicImport.hxx"
4373 +#include "GraphicHelpers.hxx"
4375 #include <dmapper/DomainMapper.hxx>
4376 #include <PropertyMap.hxx>
4377 #include <doctok/resourceids.hxx>
4378 @@ -995,35 +997,79 @@ void GraphicImport::attribute(Id nName, Value & val)
4379 case NS_ooxml::LN_shape:
4380 /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
4382 - val.getAny() >>= m_xShape;
4384 - if (m_xShape.is())
4386 - uno::Reference< beans::XPropertySet > xShapeProps
4387 - (m_xShape, uno::UNO_QUERY_THROW);
4389 - PropertyNameSupplier& rPropNameSupplier =
4390 - PropertyNameSupplier::GetPropertyNameSupplier();
4391 - xShapeProps->setPropertyValue
4392 - (rPropNameSupplier.GetName(PROP_ANCHOR_TYPE),
4394 - (text::TextContentAnchorType_AS_CHARACTER));
4395 - xShapeProps->setPropertyValue
4396 - (rPropNameSupplier.GetName(PROP_TEXT_RANGE),
4398 - (m_pImpl->rDomainMapper.GetCurrentTextRange()));
4400 - awt::Point aPoint(m_xShape->getPosition());
4401 - awt::Size aSize(m_xShape->getSize());
4403 - if (m_pImpl->isXSizeValid())
4404 - aSize.Width = m_pImpl->getXSize();
4405 - if (m_pImpl->isYSizeValis())
4406 - aSize.Height = m_pImpl->getYSize();
4408 - m_xShape->setSize(aSize);
4410 - m_pImpl->bIsGraphic = true;
4411 + uno::Reference< drawing::XShape> xShape;
4412 + val.getAny( ) >>= xShape;
4414 + if ( xShape.is( ) )
4416 + // Is it a graphic image
4417 + bool bUseShape = true;
4420 + uno::Reference< beans::XPropertySet > xShapeProps
4421 + ( xShape, uno::UNO_QUERY_THROW );
4423 + rtl::OUString sUrl;
4424 + xShapeProps->getPropertyValue( rtl::OUString::createFromAscii( "GraphicURL" ) ) >>= sUrl;
4426 + ::com::sun::star::beans::PropertyValues aMediaProperties( 1 );
4427 + aMediaProperties[0].Name = rtl::OUString::createFromAscii( "URL" );
4428 + aMediaProperties[0].Value <<= sUrl;
4430 + m_xGraphicObject = createGraphicObject( aMediaProperties );
4432 + bUseShape = !m_xGraphicObject.is( );
4436 + // Define the object size
4437 + uno::Reference< beans::XPropertySet > xGraphProps( m_xGraphicObject,
4439 + awt::Size aSize = xShape->getSize( );
4440 + xGraphProps->setPropertyValue( rtl::OUString::createFromAscii( "Height" ),
4441 + uno::makeAny( aSize.Height ) );
4442 + xGraphProps->setPropertyValue( rtl::OUString::createFromAscii( "Width" ),
4443 + uno::makeAny( aSize.Width ) );
4446 + catch( const beans::UnknownPropertyException e )
4448 + // It isn't a graphic image
4452 + m_xShape = xShape;
4455 + if ( m_xShape.is( ) )
4457 + uno::Reference< beans::XPropertySet > xShapeProps
4458 + (m_xShape, uno::UNO_QUERY_THROW);
4461 + PropertyNameSupplier& rPropNameSupplier =
4462 + PropertyNameSupplier::GetPropertyNameSupplier();
4463 + xShapeProps->setPropertyValue
4464 + (rPropNameSupplier.GetName(PROP_ANCHOR_TYPE),
4466 + (text::TextContentAnchorType_AS_CHARACTER));
4467 + xShapeProps->setPropertyValue
4468 + (rPropNameSupplier.GetName(PROP_TEXT_RANGE),
4470 + (m_pImpl->rDomainMapper.GetCurrentTextRange()));
4472 + awt::Point aPoint(m_xShape->getPosition());
4473 + awt::Size aSize(m_xShape->getSize());
4475 + if (m_pImpl->isXSizeValid())
4476 + aSize.Width = m_pImpl->getXSize();
4477 + if (m_pImpl->isYSizeValis())
4478 + aSize.Height = m_pImpl->getYSize();
4480 + m_xShape->setSize(aSize);
4482 + m_pImpl->bIsGraphic = true;
4487 @@ -1769,8 +1815,6 @@ void GraphicImport::sprm(Sprm & rSprm)
4488 case NS_ooxml::LN_CT_NonVisualGraphicFrameProperties_graphicFrameLocks:// 90657
4489 case NS_ooxml::LN_CT_Inline_a_graphic:// 90915
4490 case NS_ooxml::LN_CT_Anchor_simplePos_elem: // 90975;
4491 - case NS_ooxml::LN_CT_Anchor_positionH: // 90976;
4492 - case NS_ooxml::LN_CT_Anchor_positionV: // 90977;
4493 case NS_ooxml::LN_CT_Anchor_extent: // 90978;
4494 case NS_ooxml::LN_CT_Anchor_effectExtent: // 90979;
4495 case NS_ooxml::LN_EG_WrapType_wrapSquare: // 90945;
4496 @@ -1791,6 +1835,36 @@ void GraphicImport::sprm(Sprm & rSprm)
4500 + case NS_ooxml::LN_CT_Anchor_positionH: // 90976;
4502 + // Use a special handler for the positionning
4503 + PositionHandlerPtr pHandler( new PositionHandler );
4504 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
4505 + if( pProperties.get( ) )
4507 + pProperties->resolve( *pHandler );
4509 + m_pImpl->nHoriRelation = pHandler->m_nRelation;
4510 + m_pImpl->nHoriOrient = pHandler->m_nOrient;
4511 + m_pImpl->nLeftPosition = pHandler->m_nPosition;
4515 + case NS_ooxml::LN_CT_Anchor_positionV: // 90977;
4517 + // Use a special handler for the positionning
4518 + PositionHandlerPtr pHandler( new PositionHandler );
4519 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
4520 + if( pProperties.get( ) )
4522 + pProperties->resolve( *pHandler );
4524 + m_pImpl->nVertRelation = pHandler->m_nRelation;
4525 + m_pImpl->nVertOrient = pHandler->m_nOrient;
4526 + m_pImpl->nTopPosition = pHandler->m_nPosition;
4533 @@ -1858,11 +1932,9 @@ void lcl_CalcCrop( sal_Int32& nCrop, sal_Int32 nRef )
4534 + (((nCrop & 0xffff) * nRef ) >> 16);
4537 -/*-- 01.11.2006 09:45:02---------------------------------------------------
4539 - -----------------------------------------------------------------------*/
4540 -void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Reference<Properties>::Pointer_t /*ref*/)
4541 +uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const beans::PropertyValues& aMediaProperties )
4543 + uno::Reference< text::XTextContent > xGraphicObject;
4546 uno::Reference< graphic::XGraphicProvider > xGraphicProvider(
4547 @@ -1870,28 +1942,22 @@ void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Referen
4548 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")),
4549 m_xComponentContext),
4550 uno::UNO_QUERY_THROW );
4551 - uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len, m_pImpl->bIsBitmap );
4553 - PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
4555 - ::com::sun::star::beans::PropertyValues aMediaProperties( 1 );
4556 - aMediaProperties[0].Name = rPropNameSupplier.GetName(PROP_INPUT_STREAM);
4557 - aMediaProperties[0].Value <<= xIStream;
4559 uno::Reference< graphic::XGraphic > xGraphic = xGraphicProvider->queryGraphic( aMediaProperties );
4564 - clog << "Graphic loaded" << endl;
4565 + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
4567 uno::Reference< beans::XPropertySet > xGraphicObjectProperties(
4568 m_xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextGraphicObject"))),
4569 - uno::UNO_QUERY_THROW);
4570 + uno::UNO_QUERY_THROW);
4571 xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_GRAPHIC), uno::makeAny( xGraphic ));
4572 xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_ANCHOR_TYPE),
4573 uno::makeAny( m_pImpl->eGraphicImportType == IMPORT_AS_SHAPE || m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR ?
4574 text::TextContentAnchorType_AT_CHARACTER :
4575 text::TextContentAnchorType_AS_CHARACTER ));
4576 - m_xGraphicObject = uno::Reference< text::XTextContent >( xGraphicObjectProperties, uno::UNO_QUERY_THROW );
4577 + xGraphicObject = uno::Reference< text::XTextContent >( xGraphicObjectProperties, uno::UNO_QUERY_THROW );
4579 //shapes have only one border, PICF might have four
4580 table::BorderLine aBorderLine;
4581 @@ -2083,11 +2149,28 @@ void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Referen
4585 - catch( const uno::Exception& )
4586 + catch( const uno::Exception& e )
4588 - clog << __FILE__ << __LINE__ << " failed!" << endl;
4589 + clog << __FILE__ << ":" << __LINE__ << " failed. Message :" ;
4590 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
4592 + return xGraphicObject;
4595 +/*-- 01.11.2006 09:45:02---------------------------------------------------
4597 + -----------------------------------------------------------------------*/
4598 +void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Reference<Properties>::Pointer_t /*ref*/)
4600 + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
4602 + ::com::sun::star::beans::PropertyValues aMediaProperties( 1 );
4603 + aMediaProperties[0].Name = rPropNameSupplier.GetName(PROP_INPUT_STREAM);
4605 + uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len, m_pImpl->bIsBitmap );
4606 + aMediaProperties[0].Value <<= xIStream;
4608 + m_xGraphicObject = createGraphicObject( aMediaProperties );
4610 /*-- 01.11.2006 09:45:03---------------------------------------------------
4612 @@ -2161,6 +2244,15 @@ void GraphicImport::substream(Id /*name*/, ::writerfilter::Reference<Stream>::Po
4613 void GraphicImport::info(const string & /*info*/)
4617 +void GraphicImport::startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > /*xShape*/ )
4621 +void GraphicImport::endShape( )
4625 /*-- 09.08.2007 10:17:00---------------------------------------------------
4627 -----------------------------------------------------------------------*/
4628 diff --git writerfilter/source/dmapper/GraphicImport.hxx writerfilter/source/dmapper/GraphicImport.hxx
4629 index 99daac9..6ff1c3f 100644
4630 --- writerfilter/source/dmapper/GraphicImport.hxx
4631 +++ writerfilter/source/dmapper/GraphicImport.hxx
4632 @@ -51,6 +51,11 @@ namespace com{ namespace sun { namespace star {
4638 + class PropertyValue;
4639 + typedef ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > PropertyValues;
4643 namespace writerfilter {
4644 @@ -79,6 +84,9 @@ class WRITERFILTER_DLLPRIVATE GraphicImport : public Properties, public Table
4646 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> m_xShape;
4647 void ProcessShapeOptions(Value & val);
4649 + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > createGraphicObject(
4650 + const ::com::sun::star::beans::PropertyValues& aMediaProperties );
4653 explicit GraphicImport(::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > xComponentContext,
4654 @@ -112,6 +120,8 @@ public:
4655 virtual void substream(Id name,
4656 ::writerfilter::Reference<Stream>::Pointer_t ref);
4657 virtual void info(const string & info);
4658 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
4659 + virtual void endShape( );
4661 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > GetGraphicObject();
4662 bool IsGraphic() const;
4663 diff --git writerfilter/source/dmapper/ListTable.cxx writerfilter/source/dmapper/ListTable.cxx
4664 index e965cf8..4255104 100644
4665 --- writerfilter/source/dmapper/ListTable.cxx
4666 +++ writerfilter/source/dmapper/ListTable.cxx
4668 #include <resourcemodel/WW8ResourceModel.hxx>
4670 #include <com/sun/star/container/XIndexReplace.hpp>
4671 +#include <com/sun/star/container/XNameContainer.hpp>
4672 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
4673 #include <com/sun/star/style/NumberingType.hpp>
4674 +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
4675 #include <com/sun/star/text/HoriOrientation.hpp>
4676 +#include <com/sun/star/text/PositionAndSpaceMode.hpp>
4679 #define NUMBERING_MAX_LEVELS 10
4680 @@ -139,6 +142,7 @@ class ListPropertyMap : public PropertyMap
4681 ::rtl::OUString sRGBXchNums; //LN_RGBXCHNUMS
4682 sal_Int32 nXChFollow; //LN_IXCHFOLLOW
4683 ::rtl::OUString sBulletChar;
4684 + sal_Int32 nTabstop;
4688 @@ -150,6 +154,7 @@ public:
4694 ~ListPropertyMap(){}
4696 @@ -187,6 +192,8 @@ uno::Sequence< beans::PropertyValue > ListPropertyMap::GetPropertyValuesList( P
4697 if( nNumberFormat == style::NumberingType::CHAR_SPECIAL && sBulletChar.getLength() )
4698 aNumberingProperties.push_back( MAKE_PROPVAL(PROP_BULLET_CHAR, sBulletChar.copy(0,1)));
4700 + aNumberingProperties.push_back( MAKE_PROPVAL( PROP_LISTTAB_STOP_POSITION, nTabstop ) );
4702 //TODO: handling of nFLegal?
4703 //TODO: nFNoRestart lower levels do not restart when higher levels are incremented, like:
4705 @@ -215,6 +222,9 @@ uno::Sequence< beans::PropertyValue > ListPropertyMap::GetPropertyValuesList( P
4707 switch( aMapIter->first.eId )
4710 + case PROP_INDENT_AT:
4711 + case PROP_FIRST_LINE_INDENT:
4712 case PROP_FIRST_LINE_OFFSET:
4713 case PROP_LEFT_MARGIN:
4714 aNumberingProperties.push_back(
4715 @@ -818,22 +828,27 @@ void ListTable::attribute(Id nName, Value & rVal)
4716 case NS_ooxml::LN_CT_Ind_left:
4717 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
4718 m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
4719 - PROP_LEFT_MARGIN, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
4720 + PROP_INDENT_AT, true, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ));
4722 case NS_ooxml::LN_CT_Ind_hanging:
4723 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
4724 m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
4725 - PROP_FIRST_LINE_OFFSET, true, uno::makeAny( - ConversionHelper::convertTwipToMM100(nIntValue ) ));
4726 + PROP_FIRST_LINE_INDENT, true, uno::makeAny( - ConversionHelper::convertTwipToMM100( nIntValue ) ));
4728 + case NS_ooxml::LN_CT_Ind_firstLine:
4729 + /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
4730 + m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
4731 + PROP_FIRST_LINE_INDENT, true, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ));
4733 -// case NS_ooxml::LN_CT_Ind_firstLine:
4734 -// /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
4735 -// m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
4736 -// PROP_FIRST_LINE_OFFSET, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
4738 case NS_ooxml::LN_CT_Lvl_ilvl: //overrides previous level - unsupported
4739 case NS_ooxml::LN_CT_Lvl_tplc: //template code - unsupported
4740 case NS_ooxml::LN_CT_Lvl_tentative: //marks level as unused in the document - unsupported
4741 - case NS_ooxml::LN_CT_Ind_firstLine: //todo: first line indent in numbering not yet supported
4743 + case NS_ooxml::LN_CT_TabStop_pos:
4745 + //no paragraph attributes in ListTable char style sheets
4746 + m_pImpl->m_pCurrentEntry->pCurrentProperties->nTabstop = ConversionHelper::convertTwipToMM100( nIntValue );
4751 @@ -955,7 +970,17 @@ void ListTable::sprm(Sprm & rSprm)
4754 case NS_ooxml::LN_CT_Lvl_lvlJc:
4757 + static sal_Int16 aWWAlignments[ ] =
4759 + text::HoriOrientation::LEFT,
4760 + text::HoriOrientation::CENTER,
4761 + text::HoriOrientation::RIGHT
4763 + m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
4764 + PROP_ADJUST, true, uno::makeAny( aWWAlignments[ nIntValue ] ) );
4765 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
4768 case NS_ooxml::LN_CT_Lvl_pPr:
4769 case NS_ooxml::LN_CT_PPrBase_ind:
4770 @@ -967,7 +992,12 @@ void ListTable::sprm(Sprm & rSprm)
4773 case NS_ooxml::LN_CT_PPrBase_tabs:
4774 - //no paragraph attributes in ListTable char style sheets
4775 + case NS_ooxml::LN_CT_Tabs_tab:
4777 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
4778 + if(pProperties.get())
4779 + pProperties->resolve(*this);
4782 case NS_ooxml::LN_CT_Lvl_suff:
4783 //todo: currently unsupported suffix
4784 @@ -1057,105 +1087,181 @@ sal_uInt32 ListTable::size() const
4786 return m_pImpl->m_aListEntries.size();
4788 -/*-- 26.06.2006 10:33:56---------------------------------------------------
4790 - -----------------------------------------------------------------------*/
4791 -uno::Reference< container::XIndexReplace > ListTable::GetNumberingRules(sal_Int32 nListId)
4792 +rtl::OUString ListTable::GetStyleName( sal_Int32 nListId )
4794 + rtl::OUString sStyleName( rtl::OUString::createFromAscii( "WWNum" ) );
4795 + sStyleName += rtl::OUString::valueOf( nListId + 1 );
4797 + return sStyleName;
4800 +void ListTable::CreateNumberingRules( )
4802 uno::Reference< container::XIndexReplace > xRet;
4803 std::vector< ListEntryPtr >::const_iterator aIt = m_pImpl->m_aListEntries.begin();
4804 std::vector< ListEntryPtr >::const_iterator aEndIt = m_pImpl->m_aListEntries.end();
4806 + uno::Reference< container::XNameContainer > xStyles;
4810 + uno::Reference< style::XStyleFamiliesSupplier > xFamilies( m_pImpl->m_xFactory, uno::UNO_QUERY_THROW );
4811 + uno::Any oFamily = xFamilies->getStyleFamilies( )->getByName( rtl::OUString::createFromAscii( "NumberingStyles" ) );
4813 + oFamily >>= xStyles;
4815 + catch ( const uno::Exception )
4819 for(; aIt != aEndIt; ++aIt)
4821 - if((*aIt)->nListId == nListId)
4822 + if( !(*aIt)->m_xNumRules.is() && m_pImpl->m_xFactory.is() && xStyles.is( ) )
4824 - if( !(*aIt)->m_xNumRules.is() && m_pImpl->m_xFactory.is())
4828 + // Create the numbering style
4829 + uno::Reference< beans::XPropertySet > xStyle (
4830 + m_pImpl->m_xFactory->createInstance(
4831 + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.NumberingStyle"))),
4832 + uno::UNO_QUERY_THROW );
4834 + rtl::OUString sStyleName = GetStyleName( ( *aIt )->nListId );
4836 + clog << "Creating numbering style: ";
4837 + clog << rtl::OUStringToOString( sStyleName, RTL_TEXTENCODING_UTF8 ).getStr( );
4841 + xStyles->insertByName( sStyleName, makeAny( xStyle ) );
4843 + uno::Any oStyle = xStyles->getByName( sStyleName );
4844 + xStyle.set( oStyle, uno::UNO_QUERY_THROW );
4846 + PropertyNameSupplier& aPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
4847 + uno::Any aRules = xStyle->getPropertyValue( aPropNameSupplier.GetName( PROP_NUMBERING_RULES ) );
4848 + aRules >>= ( *aIt )->m_xNumRules;
4850 + //now fill the numbering levels appropriately
4851 + ::std::vector< ListPropertyMapPtr >::const_iterator aIter = (*aIt)->aLevelProperties.begin();
4852 + ::std::vector< ListPropertyMapPtr >::const_iterator aEnd = (*aIt)->aLevelProperties.end();
4853 + sal_Int32 nLevel = 0;
4854 + while(aIter != aEnd)
4856 - (*aIt)->m_xNumRules = uno::Reference< container::XIndexReplace >(
4857 - m_pImpl->m_xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules"))),
4858 - uno::UNO_QUERY_THROW);
4860 - //now fill the numbering levels appropriately
4861 - ::std::vector< ListPropertyMapPtr >::const_iterator aIter = (*aIt)->aLevelProperties.begin();
4862 - ::std::vector< ListPropertyMapPtr >::const_iterator aEnd = (*aIt)->aLevelProperties.end();
4863 - sal_Int32 nLevel = 0;
4864 - PropertyNameSupplier& aPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
4865 - while(aIter != aEnd)
4866 + PropertyValueVector_t aCharStyleProperties;
4867 + uno::Sequence< beans::PropertyValue> aValues = (*aIter)->GetPropertyValuesList(aCharStyleProperties);
4868 + if( aCharStyleProperties.size() )
4870 - PropertyValueVector_t aCharStyleProperties;
4871 - uno::Sequence< beans::PropertyValue> aValues = (*aIter)->GetPropertyValuesList(aCharStyleProperties);
4872 - if( aCharStyleProperties.size() )
4874 - //create (or find) a character style containing the character attributes of the symbol
4875 - //and apply it to the numbering level
4876 - ::rtl::OUString sStyle = m_pImpl->m_rDMapper.getOrCreateCharStyle( aCharStyleProperties );
4877 - aValues.realloc( aValues.getLength() + 1);
4878 - aValues[aValues.getLength() - 1].Name = aPropNameSupplier.GetName( PROP_CHAR_STYLE_NAME );
4879 - aValues[aValues.getLength() - 1].Value <<= sStyle;
4881 - //now parse the text to find %n from %1 to %nLevel+1
4882 - //everything before the first % and the last %x is prefix and suffix
4883 - ::rtl::OUString sLevelText( (*aIter)->sBulletChar );
4884 - sal_Int32 nCurrentIndex = 0;
4885 - sal_Int32 nFound = sLevelText.indexOf( '%', nCurrentIndex );
4888 - ::rtl::OUString sPrefix = sLevelText.copy( 0, nFound );
4889 - aValues.realloc( aValues.getLength() + 1 );
4890 - aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL(PROP_PREFIX, sPrefix);
4891 - sLevelText = sLevelText.copy( nFound );
4893 - sal_Int32 nMinLevel = nLevel;
4894 - //now the text should either be empty or start with %
4896 - while( nFound >= 0 )
4897 + //create (or find) a character style containing the character attributes of the symbol
4898 + //and apply it to the numbering level
4899 + ::rtl::OUString sStyle = m_pImpl->m_rDMapper.getOrCreateCharStyle( aCharStyleProperties );
4900 + aValues.realloc( aValues.getLength() + 1);
4901 + aValues[aValues.getLength() - 1].Name = aPropNameSupplier.GetName( PROP_CHAR_STYLE_NAME );
4902 + aValues[aValues.getLength() - 1].Value <<= sStyle;
4904 + //now parse the text to find %n from %1 to %nLevel+1
4905 + //everything before the first % and the last %x is prefix and suffix
4906 + ::rtl::OUString sLevelText( (*aIter)->sBulletChar );
4907 + sal_Int32 nCurrentIndex = 0;
4908 + sal_Int32 nFound = sLevelText.indexOf( '%', nCurrentIndex );
4911 + ::rtl::OUString sPrefix = sLevelText.copy( 0, nFound );
4912 + aValues.realloc( aValues.getLength() + 1 );
4913 + aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL(PROP_PREFIX, sPrefix);
4914 + sLevelText = sLevelText.copy( nFound );
4916 + sal_Int32 nMinLevel = nLevel;
4917 + //now the text should either be empty or start with %
4919 + while( nFound >= 0 )
4921 + if( sLevelText.getLength() > 1 )
4923 - if( sLevelText.getLength() > 1 )
4924 + sal_Unicode cLevel = sLevelText.getStr()[1];
4925 + if( cLevel >= '1' && cLevel <= '9' )
4927 - sal_Unicode cLevel = sLevelText.getStr()[1];
4928 - if( cLevel >= '1' && cLevel <= '9' )
4930 - if( cLevel - '1' < nMinLevel )
4931 - nMinLevel = cLevel - '1';
4932 - //remove first char - next char is removed later
4933 - sLevelText = sLevelText.copy( 1 );
4936 - //remove old '%' or number
4937 - sLevelText = sLevelText.copy( 1 );
4938 - nCurrentIndex = 0;
4939 - nFound = sLevelText.indexOf( '%', nCurrentIndex );
4940 - //remove the text before the next %
4942 - sLevelText = sLevelText.copy( nFound -1 );
4944 - if( nMinLevel < nLevel )
4946 - aValues.realloc( aValues.getLength() + 1);
4947 - aValues[ aValues.getLength() - 1 ] =
4948 - MAKE_PROPVAL(PROP_PARENT_NUMBERING, sal_Int16( nLevel - nMinLevel ));
4950 - if( sLevelText.getLength() )
4952 - aValues.realloc( aValues.getLength() + 1);
4953 - aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL(PROP_SUFFIX, sLevelText);
4954 + if( cLevel - '1' < nMinLevel )
4955 + nMinLevel = cLevel - '1';
4956 + //remove first char - next char is removed later
4957 + sLevelText = sLevelText.copy( 1 );
4961 - (*aIt)->m_xNumRules->replaceByIndex(nLevel, uno::makeAny(aValues));
4965 + //remove old '%' or number
4966 + sLevelText = sLevelText.copy( 1 );
4967 + nCurrentIndex = 0;
4968 + nFound = sLevelText.indexOf( '%', nCurrentIndex );
4969 + //remove the text before the next %
4971 + sLevelText = sLevelText.copy( nFound -1 );
4973 + if( nMinLevel < nLevel )
4975 + aValues.realloc( aValues.getLength() + 1);
4976 + aValues[ aValues.getLength() - 1 ] =
4977 + MAKE_PROPVAL(PROP_PARENT_NUMBERING, sal_Int16( nLevel - nMinLevel + 1));
4979 + aValues.realloc( aValues.getLength() + 1);
4980 + aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL(PROP_SUFFIX, sLevelText);
4983 - catch( const uno::Exception& rEx)
4984 + aValues.realloc( aValues.getLength() + 1);
4985 + aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL( PROP_POSITION_AND_SPACE_MODE,
4986 + sal_Int16( text::PositionAndSpaceMode::LABEL_ALIGNMENT ) );
4989 + clog << endl << "Numbering rule properties - " << nLevel << endl;
4990 + for ( sal_Int32 i = 0, len = aValues.getLength( ); i < len; i++ )
4993 - OSL_ENSURE( false, "ListTable::GetNumberingRules");
4994 + beans::PropertyValue aVal = aValues[i];
4995 + clog << " " << rtl::OUStringToOString( aVal.Name, RTL_TEXTENCODING_UTF8 ).getStr( );
4997 + rtl::OUString sVal;
4999 + if ( aVal.Value >>= sVal )
5001 + clog << rtl::OUStringToOString( sVal, RTL_TEXTENCODING_UTF8 ).getStr( );
5003 + else if ( aVal.Value >>= nVal )
5011 + (*aIt)->m_xNumRules->replaceByIndex(nLevel, uno::makeAny(aValues));
5016 + // Create the numbering style for these rules
5017 + rtl::OUString sNumRulesName = aPropNameSupplier.GetName( PROP_NUMBERING_RULES );
5018 + xStyle->setPropertyValue(
5020 + uno::makeAny( ( *aIt )->m_xNumRules ) );
5022 + catch( const uno::Exception& rEx)
5025 + OSL_ENSURE( false, "ListTable::CreateNumberingRules");
5031 +/*-- 26.06.2006 10:33:56---------------------------------------------------
5033 + -----------------------------------------------------------------------*/
5034 +uno::Reference< container::XIndexReplace > ListTable::GetNumberingRules(sal_Int32 nListId)
5036 + uno::Reference< container::XIndexReplace > xRet;
5037 + std::vector< ListEntryPtr >::const_iterator aIt = m_pImpl->m_aListEntries.begin();
5038 + std::vector< ListEntryPtr >::const_iterator aEndIt = m_pImpl->m_aListEntries.end();
5039 + for(; aIt != aEndIt; ++aIt)
5041 + if((*aIt)->nListId == nListId)
5043 xRet = (*aIt)->m_xNumRules;
5046 diff --git writerfilter/source/dmapper/ListTable.hxx writerfilter/source/dmapper/ListTable.hxx
5047 index c42515a..65cc216 100644
5048 --- writerfilter/source/dmapper/ListTable.hxx
5049 +++ writerfilter/source/dmapper/ListTable.hxx
5050 @@ -78,6 +78,8 @@ public:
5051 // writerfilter::Reference<Properties>::Pointer_t ref);
5053 sal_uInt32 size() const;
5054 + rtl::OUString GetStyleName( sal_Int32 nListId );
5055 + void CreateNumberingRules( );
5056 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace >
5057 GetNumberingRules(sal_Int32 nListId);
5059 diff --git writerfilter/source/dmapper/OLEHandler.cxx writerfilter/source/dmapper/OLEHandler.cxx
5060 index 48ae2fe..9a70000 100644
5061 --- writerfilter/source/dmapper/OLEHandler.cxx
5062 +++ writerfilter/source/dmapper/OLEHandler.cxx
5064 ************************************************************************/
5065 #include <OLEHandler.hxx>
5066 #include <PropertyMap.hxx>
5067 +#include "GraphicHelpers.hxx"
5069 #include <doctok/resourceids.hxx>
5070 #include <ooxml/resourceids.hxx>
5071 #include <com/sun/star/beans/PropertyValue.hpp>
5072 @@ -54,7 +56,8 @@ using namespace ::com::sun::star;
5073 -----------------------------------------------------------------------*/
5074 OLEHandler::OLEHandler() :
5081 /*-- 23.04.2008 10:46:14---------------------------------------------------
5082 @@ -108,15 +111,28 @@ void OLEHandler::attribute(Id rName, Value & rVal)
5083 rVal.getAny() >>= xTempShape;
5084 if( xTempShape.is() )
5086 - m_aShapeSize = xTempShape->getSize();
5087 - m_aShapePosition = xTempShape->getPosition();
5088 + m_xShape.set( xTempShape );
5092 + m_aShapeSize = xTempShape->getSize();
5093 + m_aShapePosition = xTempShape->getPosition();
5095 uno::Reference< beans::XPropertySet > xShapeProps( xTempShape, uno::UNO_QUERY_THROW );
5096 - xShapeProps->getPropertyValue( PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_BITMAP ) ) >>= m_xReplacement;
5097 + PropertyNameSupplier& rNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
5099 + xShapeProps->getPropertyValue( rNameSupplier.GetName( PROP_BITMAP ) ) >>= m_xReplacement;
5101 + xShapeProps->setPropertyValue(
5102 + rNameSupplier.GetName( PROP_SURROUND ),
5103 + uno::makeAny( m_nWrapMode ) );
5105 - catch( const uno::Exception& )
5106 + catch( const uno::Exception& e )
5109 + clog << "Exception in OLE Handler: ";
5110 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
5115 @@ -142,8 +158,39 @@ void OLEHandler::sprm(Sprm & rSprm)
5119 + case NS_ooxml::LN_wrap_wrap:
5121 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5122 + if ( pProperties.get( ) )
5124 + WrapHandlerPtr pHandler( new WrapHandler );
5125 + pProperties->resolve( *pHandler );
5127 + m_nWrapMode = pHandler->getWrapMode( );
5131 + uno::Reference< beans::XPropertySet > xShapeProps( m_xShape, uno::UNO_QUERY_THROW );
5132 + PropertyNameSupplier& rNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
5134 + xShapeProps->setPropertyValue(
5135 + rNameSupplier.GetName( PROP_SURROUND ),
5136 + uno::makeAny( m_nWrapMode ) );
5138 + catch( const uno::Exception& e )
5141 + clog << "Exception in OLE Handler: ";
5142 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
5150 OSL_ENSURE( false, "unknown attribute");
5154 /*-- 23.04.2008 11:15:19---------------------------------------------------
5155 @@ -152,9 +199,10 @@ void OLEHandler::sprm(Sprm & rSprm)
5156 ::rtl::OUString OLEHandler::copyOLEOStream( uno::Reference< text::XTextDocument > xTextDocument )
5158 ::rtl::OUString sRet;
5159 - if( !m_xInputStream.is() )
5160 + if( !m_xInputStream.is( ) )
5165 uno::Reference < lang::XMultiServiceFactory > xFactory(xTextDocument, uno::UNO_QUERY_THROW);
5166 uno::Reference< document::XEmbeddedObjectResolver > xEmbeddedResolver(
5167 xFactory->createInstance(
5168 diff --git writerfilter/source/dmapper/OLEHandler.hxx writerfilter/source/dmapper/OLEHandler.hxx
5169 index c56358a..d65035f 100644
5170 --- writerfilter/source/dmapper/OLEHandler.hxx
5171 +++ writerfilter/source/dmapper/OLEHandler.hxx
5173 #include <com/sun/star/awt/Size.hpp>
5174 #include <com/sun/star/awt/Point.hpp>
5176 +#include <com/sun/star/drawing/XShape.hpp>
5178 namespace com{ namespace sun{ namespace star{
5180 class XEmbeddedObject;
5181 @@ -72,6 +74,9 @@ class WRITERFILTER_DLLPRIVATE OLEHandler : public Properties
5183 sal_Int32 m_nDxaOrig;
5184 sal_Int32 m_nDyaOrig;
5185 + sal_Int32 m_nWrapMode;
5187 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xShape;
5189 ::com::sun::star::awt::Size m_aShapeSize;
5190 ::com::sun::star::awt::Point m_aShapePosition;
5191 @@ -87,6 +92,10 @@ public:
5192 virtual void attribute(Id Name, Value & val);
5193 virtual void sprm(Sprm & sprm);
5195 + inline ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getShape( ) { return m_xShape; };
5197 + inline bool isOLEObject( ) { return m_xInputStream.is( ); };
5199 ::rtl::OUString copyOLEOStream( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > xTextDocument );
5201 ::com::sun::star::awt::Size getSize() const { return m_aShapeSize;}
5202 diff --git writerfilter/source/dmapper/PageBordersHandler.cxx writerfilter/source/dmapper/PageBordersHandler.cxx
5203 new file mode 100644
5204 index 0000000..5280697
5206 +++ writerfilter/source/dmapper/PageBordersHandler.cxx
5208 +#include "PageBordersHandler.hxx"
5210 +#include <ooxml/resourceids.hxx>
5212 +namespace writerfilter {
5213 +namespace dmapper {
5215 +_PgBorder::_PgBorder( ) :
5217 + m_ePos( BORDER_RIGHT )
5221 +_PgBorder::~_PgBorder( )
5225 +PageBordersHandler::PageBordersHandler( ) :
5231 +PageBordersHandler::~PageBordersHandler( )
5235 +void PageBordersHandler::attribute( Id eName, Value& rVal )
5237 + int nIntValue = rVal.getInt( );
5240 + case NS_ooxml::LN_CT_PageBorders_display:
5242 + switch ( nIntValue )
5245 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_allPages:
5248 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_firstPage:
5251 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_notFirstPage:
5257 + case NS_ooxml::LN_CT_PageBorders_offsetFrom:
5259 + switch ( nIntValue )
5262 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderOffset_page:
5265 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderOffset_text:
5275 +void PageBordersHandler::sprm( Sprm& rSprm )
5277 + switch ( rSprm.getId( ) )
5279 + case NS_ooxml::LN_CT_PageBorders_top:
5280 + case NS_ooxml::LN_CT_PageBorders_left:
5281 + case NS_ooxml::LN_CT_PageBorders_bottom:
5282 + case NS_ooxml::LN_CT_PageBorders_right:
5284 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5285 + if( pProperties.get())
5287 + BorderHandlerPtr pBorderHandler( new BorderHandler( true ) );
5288 + pProperties->resolve(*pBorderHandler);
5289 + BorderPosition ePos = BorderPosition( 0 );
5290 + switch( rSprm.getId( ) )
5292 + case NS_ooxml::LN_CT_PageBorders_top:
5293 + ePos = BORDER_TOP;
5295 + case NS_ooxml::LN_CT_PageBorders_left:
5296 + ePos = BORDER_LEFT;
5298 + case NS_ooxml::LN_CT_PageBorders_bottom:
5299 + ePos = BORDER_BOTTOM;
5301 + case NS_ooxml::LN_CT_PageBorders_right:
5302 + ePos = BORDER_RIGHT;
5307 + _PgBorder aPgBorder;
5308 + aPgBorder.m_rLine = pBorderHandler->getBorderLine( );
5309 + aPgBorder.m_nDistance = pBorderHandler->getLineDistance( );
5310 + aPgBorder.m_ePos = ePos;
5311 + m_aBorders.push_back( aPgBorder );
5319 +void PageBordersHandler::SetBorders( SectionPropertyMap* pSectContext )
5321 + for ( int i = 0, length = m_aBorders.size( ); i < length; i++ )
5323 + _PgBorder aBorder = m_aBorders[i];
5324 + pSectContext->SetBorder( aBorder.m_ePos, aBorder.m_nDistance, aBorder.m_rLine );
5329 diff --git writerfilter/source/dmapper/PageBordersHandler.hxx writerfilter/source/dmapper/PageBordersHandler.hxx
5330 new file mode 100644
5331 index 0000000..5f501d2
5333 +++ writerfilter/source/dmapper/PageBordersHandler.hxx
5335 +#ifndef INCLUDED_PAGEBORDERSHANDLER_HXX
5336 +#define INCLUDED_PAGEBORDERSHANDLER_HXX
5338 +#include "BorderHandler.hxx"
5339 +#include "PropertyMap.hxx"
5341 +#include <WriterFilterDllApi.hxx>
5342 +#include <resourcemodel/WW8ResourceModel.hxx>
5343 +#include <boost/shared_ptr.hpp>
5345 +#include <com/sun/star/table/BorderLine.hpp>
5349 +using namespace std;
5351 +namespace writerfilter {
5352 +namespace dmapper {
5357 + com::sun::star::table::BorderLine m_rLine;
5358 + sal_Int32 m_nDistance;
5359 + BorderPosition m_ePos;
5365 +class WRITERFILTER_DLLPRIVATE PageBordersHandler : public Properties
5369 + // See implementation of SectionPropertyMap::ApplyBorderToPageStyles
5370 + sal_Int32 m_nDisplay;
5371 + sal_Int32 m_nOffset;
5372 + vector<_PgBorder> m_aBorders;
5375 + PageBordersHandler( );
5376 + ~PageBordersHandler( );
5379 + virtual void attribute( Id eName, Value& rVal );
5380 + virtual void sprm( Sprm& rSprm );
5382 + inline sal_Int32 GetDisplayOffset( )
5384 + return ( m_nOffset << 5 ) + m_nDisplay;
5386 + void SetBorders( SectionPropertyMap* pSectContext );
5388 +typedef boost::shared_ptr< PageBordersHandler > PageBordersHandlerPtr;
5393 diff --git writerfilter/source/dmapper/PropertyIds.cxx writerfilter/source/dmapper/PropertyIds.cxx
5394 index f74cb57..9e54c06 100644
5395 --- writerfilter/source/dmapper/PropertyIds.cxx
5396 +++ writerfilter/source/dmapper/PropertyIds.cxx
5397 @@ -315,9 +315,13 @@ const rtl::OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
5398 case PROP_STREAM_NAME: sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")); break;
5399 case PROP_BITMAP : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Bitmap")); break;
5400 case PROP_IS_DATE : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsDate")); break;
5401 -// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
5402 -// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
5403 -// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
5404 + case PROP_CNF_STYLE : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CnfStyle")); break;
5405 + case PROP_INDENT_AT : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IndentAt")); break;
5406 + case PROP_FIRST_LINE_INDENT : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent")); break;
5407 + case PROP_NUMBERING_STYLE_NAME : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName")); break;
5408 + case PROP_OUTLINE_LEVEL : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutlineLevel")); break;
5409 + case PROP_LISTTAB_STOP_POSITION : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition")); break;
5410 + case PROP_POSITION_AND_SPACE_MODE : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionAndSpaceMode")); break;
5411 // case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
5412 // case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
5413 // case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
5414 diff --git writerfilter/source/dmapper/PropertyIds.hxx writerfilter/source/dmapper/PropertyIds.hxx
5415 index c9acac7..b46e502 100644
5416 --- writerfilter/source/dmapper/PropertyIds.hxx
5417 +++ writerfilter/source/dmapper/PropertyIds.hxx
5418 @@ -278,6 +278,13 @@ enum PropertyIds
5419 /*239*/ ,PROP_STREAM_NAME
5420 /*240*/ ,PROP_BITMAP
5421 /*241*/ ,PROP_IS_DATE
5422 +/*242*/ ,PROP_CNF_STYLE
5423 +/*243*/ ,PROP_INDENT_AT
5424 +/*244*/ ,PROP_FIRST_LINE_INDENT
5425 +/*245*/ ,PROP_NUMBERING_STYLE_NAME
5426 +/*246*/ ,PROP_OUTLINE_LEVEL
5427 +/*247*/ ,PROP_LISTTAB_STOP_POSITION
5428 +/*248*/ ,PROP_POSITION_AND_SPACE_MODE
5430 struct PropertyNameSupplier_Impl;
5431 class PropertyNameSupplier
5432 diff --git writerfilter/source/dmapper/PropertyMap.cxx writerfilter/source/dmapper/PropertyMap.cxx
5433 index 0ca1023..01f2cf4 100644
5434 --- writerfilter/source/dmapper/PropertyMap.cxx
5435 +++ writerfilter/source/dmapper/PropertyMap.cxx
5437 #include <com/sun/star/beans/PropertyValue.hpp>
5438 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
5439 #include <com/sun/star/table/BorderLine.hpp>
5440 +#include <com/sun/star/container/XEnumeration.hpp>
5441 +#include <com/sun/star/container/XEnumerationAccess.hpp>
5442 #include <com/sun/star/container/XNameContainer.hpp>
5443 #include <com/sun/star/style/BreakType.hpp>
5444 #include <com/sun/star/text/RelOrientation.hpp>
5445 @@ -175,6 +177,7 @@ void PropertyMap::insertTableProperties( const PropertyMap* )
5446 -----------------------------------------------------------------------*/
5447 SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
5448 m_bIsFirstSection( bIsFirstSection )
5449 + ,m_nBorderParams( 0 )
5450 ,m_bTitlePage( false )
5451 ,m_nColumnCount( 0 )
5452 ,m_nColumnDistance( 1249 )
5453 @@ -375,32 +378,21 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
5454 sal_Int32 nOffsetFrom = (nValue & 0x00E0) >> 5;
5455 //sal_Int32 bPageDepth = (nValue & 0x0018) >> 3; //unused infromation: 0 - in front 1 - in back
5456 //todo: negative spacing (from ww8par6.cxx)
5457 - if( nOffsetFrom == 1 )
5460 -// if (aBox.GetLeft())
5462 -// nDist = aBox.GetDistance(BOX_LINE_LEFT);
5463 -// lcl_MakeSafeNegativeSpacing( ) sets the distance to 0 if > SHRT_MAX
5465 -// aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<USHORT>(aLR.GetLeft() - nDist)), BOX_LINE_LEFT);
5466 -// aSizeArray[WW8_LEFT] =
5467 -// aSizeArray[WW8_LEFT] - nDist + aBox.GetDistance(BOX_LINE_LEFT);
5469 - //the same for right, top, bottom
5472 switch( nValue & 0x07)
5474 case 0: /*all styles*/
5475 - xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
5476 - xSecond = GetPageStyle( xPageStyles, xTextFactory, true );
5477 + if ( m_sFollowPageStyleName.getLength( ) > 0 )
5478 + xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
5479 + if ( m_sFirstPageStyleName.getLength( ) > 0 )
5480 + xSecond = GetPageStyle( xPageStyles, xTextFactory, true );
5482 case 1: /*first page*/
5483 - xFirst = GetPageStyle( xPageStyles, xTextFactory, true );
5484 + if ( m_sFirstPageStyleName.getLength( ) > 0 )
5485 + xFirst = GetPageStyle( xPageStyles, xTextFactory, true );
5487 case 2: /*left and right*/
5488 - xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
5489 + if ( m_sFollowPageStyleName.getLength( ) > 0 )
5490 + xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
5492 case 3: //whole document?
5493 //todo: how to apply a border to the whole document - find all sections or access all page styles?
5494 @@ -420,8 +412,16 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
5495 PROP_LEFT_BORDER_DISTANCE,
5496 PROP_RIGHT_BORDER_DISTANCE,
5497 PROP_TOP_BORDER_DISTANCE,
5498 - PROP_BOTTOM_BORDER_DISTANCE,
5499 + PROP_BOTTOM_BORDER_DISTANCE
5501 + static const PropertyIds aMarginIds[4] =
5504 + PROP_RIGHT_MARGIN,
5506 + PROP_BOTTOM_MARGIN
5509 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
5510 for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder)
5512 @@ -434,19 +434,38 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
5514 if( m_nBorderDistances[nBorder] >= 0 )
5516 - const ::rtl::OUString sBorderDistanceName = rPropNameSupplier.GetName( aBorderDistanceIds[nBorder] );
5517 - xFirst->setPropertyValue( sBorderDistanceName, uno::makeAny( m_nBorderDistances[nBorder] ));
5518 + SetBorderDistance( xFirst, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
5519 + m_nBorderDistances[nBorder], nOffsetFrom );
5521 - xSecond->setPropertyValue( sBorderDistanceName, uno::makeAny( m_nBorderDistances[nBorder] ));
5522 + SetBorderDistance( xSecond, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
5523 + m_nBorderDistances[nBorder], nOffsetFrom );
5528 -// rContext->Insert( aBorderIds[nId - 0x702B], uno::makeAny( aBorderLine ));
5529 -// rContext->Insert( aBorderDistanceIds[nId - 0x702B], uno::makeAny( nLineDistance) );
5531 -// uno::Reference< beans::XPropertySet > xStyle = GetPageStyle( ePageType );
5532 +void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > xStyle,
5533 + PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom )
5535 + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
5537 + sal_Int32 nDist = nDistance;
5538 + if( nOffsetFrom == 1 )
5540 + const ::rtl::OUString sMarginName = rPropNameSupplier.GetName( eMarginId );
5541 + uno::Any aMargin = xStyle->getPropertyValue( sMarginName );
5542 + sal_Int32 nMargin;
5543 + aMargin >>= nMargin;
5545 + // Change the margins with the border distance
5546 + xStyle->setPropertyValue( sMarginName, uno::makeAny( nDistance ) );
5548 + // Set the distance to ( Margin - distance )
5549 + nDist = nMargin - nDistance;
5551 + const ::rtl::OUString sBorderDistanceName = rPropNameSupplier.GetName( eDistId );
5552 + xStyle->setPropertyValue( sBorderDistanceName, uno::makeAny( nDist ));
5555 /*-- 14.12.2006 12:50:06---------------------------------------------------
5557 -----------------------------------------------------------------------*/
5558 @@ -724,8 +743,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
5560 sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
5561 //todo: is '0' the right index here?
5562 - const StyleSheetEntry* pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(::rtl::OUString::valueOf(static_cast<sal_Int32>(0), 16));
5564 + const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(::rtl::OUString::valueOf(static_cast<sal_Int32>(0), 16));
5565 + if( pEntry.get( ) )
5567 PropertyMap::iterator aElement_ = pEntry->pProperties->find(PropertyDefinition( PROP_CHAR_HEIGHT_ASIAN, false ));
5568 if( aElement_ != pEntry->pProperties->end())
5569 @@ -764,6 +783,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
5570 uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle(
5571 rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true );
5572 _ApplyProperties( xFirstPageStyle );
5574 sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0;
5576 xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) );
5577 @@ -771,6 +791,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
5578 xFollowPageStyle->setPropertyValue(
5579 rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ));
5582 + ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams );
5585 // if( m_xStartingRange.is() )
5586 @@ -778,28 +800,24 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
5587 //now apply this break at the first paragraph of this section
5588 uno::Reference< beans::XPropertySet > xRangeProperties;
5589 if( m_bIsFirstSection )
5590 - xRangeProperties = uno::Reference< beans::XPropertySet >( rDM_Impl.GetBodyText()->getStart(), uno::UNO_QUERY_THROW );
5592 + uno::Reference< container::XEnumerationAccess > xEnumAccess( rDM_Impl.GetBodyText( ), uno::UNO_QUERY_THROW );
5593 + uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration( );
5594 + xRangeProperties = uno::Reference< beans::XPropertySet >( xEnum->nextElement( ), uno::UNO_QUERY_THROW );
5597 xRangeProperties = uno::Reference< beans::XPropertySet >( m_xStartingRange, uno::UNO_QUERY_THROW );
5599 0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */
5600 - if( m_nBreakType == 2 || m_nBreakType == 3)
5602 - xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_BREAK_TYPE),
5603 - uno::makeAny( m_nBreakType == 2 ? style::BreakType_COLUMN_AFTER : style::BreakType_PAGE_AFTER ) );
5607 - xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
5608 - uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ));
5609 + xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
5610 + uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ));
5611 // todo: page breaks with odd/even page numbering are not available - find out current page number to check how to change the number
5612 // or add even/odd page break types
5613 - if(m_bPageNoRestart || m_nPageNumber >= 0)
5615 - sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
5616 - xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_NUMBER_OFFSET ),
5617 - uno::makeAny( nPageNumber ));
5619 + if(m_bPageNoRestart || m_nPageNumber >= 0)
5621 + sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
5622 + xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_NUMBER_OFFSET ),
5623 + uno::makeAny( nPageNumber ));
5627 @@ -875,7 +893,8 @@ StyleSheetPropertyMap::StyleSheetPropertyMap() :
5628 mbCT_TblWidth_wSet( false ),
5629 mbCT_TblWidth_typeSet( false ),
5632 + mnListLevel( -1 ),
5633 + mnOutlineLevel( -1 )
5636 /*-- 14.06.2007 13:57:43---------------------------------------------------
5637 diff --git writerfilter/source/dmapper/PropertyMap.hxx writerfilter/source/dmapper/PropertyMap.hxx
5638 index c6736fe..526f902 100644
5639 --- writerfilter/source/dmapper/PropertyMap.hxx
5640 +++ writerfilter/source/dmapper/PropertyMap.hxx
5641 @@ -158,6 +158,7 @@ class SectionPropertyMap : public PropertyMap
5643 ::com::sun::star::table::BorderLine* m_pBorderLines[4];
5644 sal_Int32 m_nBorderDistances[4];
5645 + sal_Int32 m_nBorderParams;
5648 sal_Int16 m_nColumnCount;
5649 @@ -202,6 +203,9 @@ class SectionPropertyMap : public PropertyMap
5650 bool HasHeader( bool bFirstPage ) const;
5651 bool HasFooter( bool bFirstPage ) const;
5653 + void SetBorderDistance( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle,
5654 + PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom );
5657 explicit SectionPropertyMap(bool bIsFirstSection);
5658 ~SectionPropertyMap();
5659 @@ -227,6 +231,7 @@ public:
5662 void SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const ::com::sun::star::table::BorderLine& rBorderLine );
5663 + void SetBorderParams( sal_Int32 nSet ) { m_nBorderParams = nSet; }
5665 void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; }
5666 void SetColumnDistance( sal_Int32 nDist ) { m_nColumnDistance = nDist; }
5667 @@ -376,6 +381,9 @@ typedef boost::shared_ptr<ParagraphProperties> ParagraphPropertiesPtr;
5668 /*-- 14.06.2007 12:12:34---------------------------------------------------
5669 property map of a stylesheet
5670 -----------------------------------------------------------------------*/
5672 +#define WW_OUTLINE_MAX sal_Int16( 9 )
5674 class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
5677 @@ -405,6 +413,8 @@ class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
5680 sal_Int16 mnListLevel;
5682 + sal_Int16 mnOutlineLevel;
5684 explicit StyleSheetPropertyMap();
5685 ~StyleSheetPropertyMap();
5686 @@ -479,6 +489,12 @@ public:
5687 sal_Int16 GetListLevel() const { return mnListLevel; }
5688 void SetListLevel(sal_Int16 nLevel) { mnListLevel = nLevel; }
5690 + sal_Int16 GetOutlineLevel() const { return mnOutlineLevel; }
5691 + void SetOutlineLevel(sal_Int16 nLevel)
5693 + if ( nLevel < WW_OUTLINE_MAX )
5694 + mnOutlineLevel = nLevel;
5697 /*-- 27.12.2007 12:38:06---------------------------------------------------
5699 diff --git writerfilter/source/dmapper/SettingsTable.cxx writerfilter/source/dmapper/SettingsTable.cxx
5700 new file mode 100644
5701 index 0000000..6facbf9
5703 +++ writerfilter/source/dmapper/SettingsTable.cxx
5705 +#include "SettingsTable.hxx"
5707 +#include <ooxml/resourceids.hxx>
5709 +#include <com/sun/star/beans/XPropertySet.hpp>
5710 +#include <com/sun/star/text/XTextDocument.hpp>
5713 +#include <iostream>
5716 +using namespace com::sun::star;
5717 +using namespace rtl;
5719 +namespace writerfilter {
5720 +namespace dmapper {
5722 +SettingsTable_Impl::SettingsTable_Impl( ) :
5723 + m_bRecordChanges( false )
5727 +SettingsTable_Impl::~SettingsTable_Impl( )
5731 +SettingsTable::SettingsTable( ) :
5732 + m_pImpl( new SettingsTable_Impl )
5736 +SettingsTable::~SettingsTable( )
5738 + delete m_pImpl, m_pImpl = NULL;
5741 +void SettingsTable::attribute( Id nName, Value& rVal )
5744 + clog << "SettingsTable::attribute( )" << endl;
5748 +void SettingsTable::sprm( Sprm& rSprm )
5750 + switch ( rSprm.getId( ) )
5752 + case NS_ooxml::LN_CT_Settings_trackRevisions:
5754 + m_pImpl->m_bRecordChanges = bool(rSprm.getValue( )->getInt( ) );
5760 + clog << __FILE__ << ":" << __LINE__;
5761 + clog << ": unknown SPRM: " << rSprm.getName( ) << endl;
5767 +void SettingsTable::entry( int nPos, writerfilter::Reference<Properties>::Pointer_t pRef )
5770 + clog << "SettingsTable::entry( ), pos: " << nPos << endl;
5772 + pRef->resolve( *this );
5775 +void SettingsTable::resolveSprmProps( Sprm& rSprm )
5777 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5778 + if( pProperties.get())
5779 + pProperties->resolve(*this);
5782 +void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
5784 + uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
5786 + // Record changes value
5787 + xDocProps->setPropertyValue( OUString::createFromAscii( "RecordChanges" ), uno::makeAny( m_pImpl->m_bRecordChanges ) );
5791 diff --git writerfilter/source/dmapper/SettingsTable.hxx writerfilter/source/dmapper/SettingsTable.hxx
5792 new file mode 100644
5793 index 0000000..6a5e8b9
5795 +++ writerfilter/source/dmapper/SettingsTable.hxx
5797 +#ifndef INCLUDED_SETTINGSTABLE_HXX
5798 +#define INCLUDED_SETTINGSTABLE_HXX
5800 +#include <WriterFilterDllApi.hxx>
5801 +#include <resourcemodel/WW8ResourceModel.hxx>
5803 +#include <com/sun/star/text/XTextDocument.hpp>
5805 +namespace writerfilter {
5808 +using namespace std;
5810 +struct SettingsTable_Impl
5813 + bool m_bRecordChanges;
5815 + SettingsTable_Impl( );
5816 + ~SettingsTable_Impl( );
5819 +class WRITERFILTER_DLLPRIVATE SettingsTable: public Properties, public Table
5822 + SettingsTable_Impl* m_pImpl;
5825 + ~SettingsTable( );
5828 + virtual void attribute(Id Name, Value & val);
5829 + virtual void sprm(Sprm & sprm);
5832 + virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
5834 + void resolveSprmProps( Sprm& rSprm );
5836 + void ApplyProperties( com::sun::star::uno::Reference< com::sun::star::text::XTextDocument > xDoc );
5838 +typedef boost::shared_ptr< SettingsTable > SettingsTablePtr;
5844 diff --git writerfilter/source/dmapper/StyleSheetTable.cxx writerfilter/source/dmapper/StyleSheetTable.cxx
5845 index 20efc0a..e67cffd 100644
5846 --- writerfilter/source/dmapper/StyleSheetTable.cxx
5847 +++ writerfilter/source/dmapper/StyleSheetTable.cxx
5849 ************************************************************************/
5850 #include <StyleSheetTable.hxx>
5851 #include <dmapper/DomainMapper.hxx>
5852 +#include <ListTable.hxx>
5853 #include <ConversionHelper.hxx>
5854 +#include <TblStylePrHandler.hxx>
5855 #include <BorderHandler.hxx>
5856 #include <doctok/resourceids.hxx>
5857 #include <ooxml/resourceids.hxx>
5859 #include <com/sun/star/beans/XPropertyState.hpp>
5860 #include <com/sun/star/beans/PropertyValue.hpp>
5861 #include <com/sun/star/container/XNameContainer.hpp>
5862 +#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
5863 #include <com/sun/star/text/XTextDocument.hpp>
5864 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
5865 #include <com/sun/star/style/XStyle.hpp>
5866 @@ -70,6 +73,175 @@ StyleSheetEntry::StyleSheetEntry() :
5870 +TableStyleSheetEntry::TableStyleSheetEntry( StyleSheetEntry& rEntry, StyleSheetTable* pStyles ):
5871 + StyleSheetEntry( ),
5872 + m_pStyleSheet( pStyles )
5874 + bIsDefaultStyle = rEntry.bIsDefaultStyle;
5875 + bInvalidHeight = rEntry.bInvalidHeight;
5876 + bHasUPE = rEntry.bHasUPE;
5877 + nStyleTypeCode = STYLE_TYPE_TABLE;
5878 + sBaseStyleIdentifier = rEntry.sBaseStyleIdentifier;
5879 + sNextStyleIdentifier = rEntry.sNextStyleIdentifier;
5880 + sStyleName = rEntry.sStyleName;
5881 + sStyleName1 = rEntry.sStyleName1;
5883 + m_nColBandSize = 1;
5884 + m_nRowBandSize = 1;
5887 +TableStyleSheetEntry::~TableStyleSheetEntry( )
5889 + m_pStyleSheet = NULL;
5892 +void TableStyleSheetEntry::AddTblStylePr( TblStyleType nType, PropertyMapPtr pProps )
5894 + static TblStyleType pTypesToFix[] =
5896 + TBL_STYLE_FIRSTROW,
5897 + TBL_STYLE_LASTROW,
5898 + TBL_STYLE_FIRSTCOL,
5902 + static PropertyIds pPropsToCheck[] =
5904 + PROP_BOTTOM_BORDER,
5906 + PROP_RIGHT_BORDER,
5913 + if ( nType == pTypesToFix[i] )
5915 + PropertyIds nChecked = pPropsToCheck[i];
5916 + PropertyMap::iterator pCheckedIt = pProps->find( PropertyDefinition( nChecked, false ) );
5918 + PropertyIds nInsideProp = ( i < 2 ) ? META_PROP_HORIZONTAL_BORDER : META_PROP_VERTICAL_BORDER;
5919 + PropertyMap::iterator pInsideIt = pProps->find( PropertyDefinition( nInsideProp, false ) );
5921 + bool bHasChecked = pCheckedIt != pProps->end( );
5922 + bool bHasInside = pInsideIt != pProps->end( );
5924 + if ( bHasChecked && bHasInside )
5926 + // In this case, remove the inside border
5927 + pProps->erase( pInsideIt );
5930 + i = 4; // Stop looping stupidly
5935 + // Append the tblStylePr
5936 + m_aStyles[nType] = pProps;
5939 +PropertyMapPtr TableStyleSheetEntry::GetProperties( sal_Int32 nMask )
5941 + PropertyMapPtr pProps( new PropertyMap );
5943 + // First get the parent properties
5944 + StyleSheetEntryPtr pEntry = m_pStyleSheet->FindParentStyleSheet( sBaseStyleIdentifier );
5946 + if ( pEntry.get( ) )
5948 + TableStyleSheetEntry* pParent = static_cast<TableStyleSheetEntry *>( pEntry.get( ) );
5949 + pProps->insert( pParent->GetProperties( nMask ) );
5952 + // And finally get the mask ones
5953 + pProps->insert( GetLocalPropertiesFromMask( nMask ) );
5958 +void lcl_mergeProps( PropertyMapPtr pToFill, PropertyMapPtr pToAdd, TblStyleType nStyleId )
5960 + static PropertyIds pPropsToCheck[] =
5962 + PROP_BOTTOM_BORDER,
5964 + PROP_RIGHT_BORDER,
5968 + bool pRemoveInside[] =
5970 + ( nStyleId == TBL_STYLE_FIRSTROW ),
5971 + ( nStyleId == TBL_STYLE_LASTROW ),
5972 + ( nStyleId == TBL_STYLE_LASTCOL ),
5973 + ( nStyleId == TBL_STYLE_FIRSTCOL )
5976 + for ( int i = 0 ; i < 7; i++ )
5978 + PropertyIds nId = pPropsToCheck[i];
5979 + PropertyDefinition aProp( nId, false );
5980 + PropertyMap::iterator pIt = pToAdd->find( aProp );
5982 + if ( pIt != pToAdd->end( ) )
5984 + PropertyMap::iterator pDestIt = pToFill->find( aProp );
5986 + if ( pRemoveInside[i] )
5988 + // Remove the insideH and insideV depending on the cell pos
5989 + PropertyIds nInsideProp = ( i < 2 ) ? META_PROP_HORIZONTAL_BORDER : META_PROP_VERTICAL_BORDER;
5990 + pDestIt = pToFill->find( PropertyDefinition( nInsideProp, false ) );
5991 + if ( pDestIt != pToFill->end( ) )
5992 + pToFill->erase( pDestIt );
5997 + pToFill->insert( pToAdd );
6000 +PropertyMapPtr TableStyleSheetEntry::GetLocalPropertiesFromMask( sal_Int32 nMask )
6002 + // Order from right to left
6003 + static TblStyleType aBitsOrder[] =
6009 + TBL_STYLE_BAND2HORZ,
6010 + TBL_STYLE_BAND1HORZ,
6011 + TBL_STYLE_BAND2VERT,
6012 + TBL_STYLE_BAND1VERT,
6013 + TBL_STYLE_LASTCOL,
6014 + TBL_STYLE_FIRSTCOL,
6015 + TBL_STYLE_LASTROW,
6016 + TBL_STYLE_FIRSTROW
6019 + // Get the properties applying according to the mask
6020 + PropertyMapPtr pProps( new PropertyMap( ) );
6024 + TblStyleType nStyleId = aBitsOrder[nBit];
6025 + TblStylePrs::iterator pIt = m_aStyles.find( nStyleId );
6027 + short nTestBit = 1 << nBit;
6028 + sal_Int32 nBitMask = sal_Int32( nTestBit );
6029 + if ( ( nMask & nBitMask ) && ( pIt != m_aStyles.end( ) ) )
6030 + lcl_mergeProps( pProps, pIt->second, nStyleId );
6034 + while ( nBit < 12 );
6039 /*-- 06.02.2008 11:30:46---------------------------------------------------
6041 -----------------------------------------------------------------------*/
6042 @@ -92,8 +264,8 @@ struct StyleSheetTable_Impl
6043 DomainMapper& m_rDMapper;
6044 uno::Reference< text::XTextDocument> m_xTextDocument;
6045 uno::Reference< beans::XPropertySet> m_xTextDefaults;
6046 - std::vector< StyleSheetEntry > m_aStyleSheetEntries;
6047 - StyleSheetEntry *m_pCurrentEntry;
6048 + std::vector< StyleSheetEntryPtr > m_aStyleSheetEntries;
6049 + StyleSheetEntryPtr m_pCurrentEntry;
6050 PropertyMapPtr m_pDefaultParaProps, m_pDefaultCharProps;
6051 PropertyMapPtr m_pCurrentProps;
6052 StringPairMap_t m_aStyleNameMap;
6053 @@ -110,7 +282,7 @@ struct StyleSheetTable_Impl
6054 StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> xTextDocument ) :
6055 m_rDMapper( rDMapper ),
6056 m_xTextDocument( xTextDocument ),
6057 - m_pCurrentEntry(0),
6058 + m_pCurrentEntry(),
6059 m_pDefaultParaProps(new PropertyMap),
6060 m_pDefaultCharProps(new PropertyMap)
6062 @@ -659,13 +831,23 @@ void StyleSheetTable::attribute(Id Name, Value & val)
6063 // case NS_rtf::LN_STYLESHEET: break;
6064 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6065 case NS_ooxml::LN_CT_Style_type:
6067 /* defaults should be set at the service "com.sun.star.text.Defaults"
6069 *(m_pImpl->m_pCurrentEntry->pProperties) = *(m_pImpl->m_pDefaultParaProps);
6070 else if (nIntValue == 2)
6071 *(m_pImpl->m_pCurrentEntry->pProperties) = *(m_pImpl->m_pDefaultCharProps);*/
6072 - m_pImpl->m_pCurrentEntry->nStyleTypeCode = (StyleType)nIntValue;
6073 + StyleType nType = ( StyleType ) nIntValue;
6074 + if ( nType == STYLE_TYPE_TABLE )
6076 + StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
6077 + TableStyleSheetEntryPtr pTableEntry( new TableStyleSheetEntry( *pEntry.get( ), this ) );
6078 + m_pImpl->m_pCurrentEntry = pTableEntry;
6081 + m_pImpl->m_pCurrentEntry->nStyleTypeCode = (StyleType)nIntValue;
6084 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6085 case NS_ooxml::LN_CT_Style_default:
6086 m_pImpl->m_pCurrentEntry->bIsDefaultStyle = (nIntValue != 0);
6087 @@ -707,7 +889,7 @@ void StyleSheetTable::sprm(Sprm & rSprm)
6089 rtl::OUString sStringValue = pValue.get() ? pValue->getString() : rtl::OUString();
6090 //printf ( "StyleSheetTable::sprm(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)nSprmId, (unsigned int)nIntValue, ::rtl::OUStringToOString(sStringValue, RTL_TEXTENCODING_DONTKNOW).getStr());
6093 /* WRITERFILTERSTATUS: table: StyleSheetTable_sprm */
6096 @@ -753,13 +935,28 @@ void StyleSheetTable::sprm(Sprm & rSprm)
6097 case NS_ooxml::LN_CT_Style_rsid:
6098 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
6099 case NS_ooxml::LN_CT_Style_trPr:
6100 - /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
6101 - case NS_ooxml::LN_CT_Style_tcPr:
6103 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6104 - case NS_ooxml::LN_CT_Style_tblPr: //contains table properties
6105 - /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6106 case NS_ooxml::LN_CT_Style_tblStylePr: //contains to table properties
6108 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
6109 + if( pProperties.get())
6111 + TblStylePrHandlerPtr pTblStylePrHandler( new TblStylePrHandler( m_pImpl->m_rDMapper ) );
6112 + pProperties->resolve( *pTblStylePrHandler );
6114 + // Add the properties to the table style
6115 + TblStyleType nType = pTblStylePrHandler->getType( );
6116 + PropertyMapPtr pProps = pTblStylePrHandler->getProperties( );
6117 + StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
6118 + TableStyleSheetEntry* pTableEntry = static_cast<TableStyleSheetEntry*>( pEntry.get( ) );
6119 + pTableEntry->AddTblStylePr( nType, pProps );
6123 + case NS_ooxml::LN_CT_Style_tcPr:
6124 + /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6125 + case NS_ooxml::LN_CT_Style_tblPr: //contains table properties
6126 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6127 case NS_ooxml::LN_CT_DocDefaults_pPrDefault:
6128 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6129 @@ -805,14 +1002,35 @@ void StyleSheetTable::sprm(Sprm & rSprm)
6133 - /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6134 + case NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize:
6135 + case NS_ooxml::LN_CT_TblPrBase_tblStyleColBandSize:
6137 + StyleSheetEntry* pEntry = m_pImpl->m_pCurrentEntry.get( );
6138 + TableStyleSheetEntry *pTEntry = static_cast<TableStyleSheetEntry*>( pEntry );
6141 + if ( nSprmId == NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize )
6142 + pTEntry->m_nRowBandSize = nIntValue;
6144 + pTEntry->m_nColBandSize = nIntValue;
6148 + /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6149 case NS_ooxml::LN_CT_Style_pPr:
6150 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
6151 case NS_ooxml::LN_CT_Style_rPr:
6153 if (!m_pImpl->m_pCurrentEntry)
6155 - m_pImpl->m_rDMapper.sprm( rSprm, m_pImpl->m_pCurrentEntry->pProperties );
6156 + TablePropertiesHandlerPtr pTblHandler( new TablePropertiesHandler( true ) );
6157 + pTblHandler->SetProperties( m_pImpl->m_pCurrentEntry->pProperties );
6158 + if ( !pTblHandler->sprm( rSprm ) )
6160 + m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pCurrentEntry->pProperties );
6161 + m_pImpl->m_rDMapper.sprm( rSprm );
6162 + m_pImpl->m_rDMapper.PopStyleSheetProperties( );
6166 /*-- 19.06.2006 12:04:33---------------------------------------------------
6167 @@ -823,7 +1041,8 @@ void StyleSheetTable::entry(int /*pos*/, writerfilter::Reference<Properties>::Po
6168 //create a new style entry
6169 // printf("StyleSheetTable::entry(...)\n");
6170 OSL_ENSURE( !m_pImpl->m_pCurrentEntry, "current entry has to be NULL here");
6171 - m_pImpl->m_pCurrentEntry = new StyleSheetEntry;
6172 + StyleSheetEntryPtr pNewEntry( new StyleSheetEntry );
6173 + m_pImpl->m_pCurrentEntry = pNewEntry;
6174 m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pCurrentEntry->pProperties );
6175 ref->resolve(*this);
6176 //append it to the table
6177 @@ -831,13 +1050,14 @@ void StyleSheetTable::entry(int /*pos*/, writerfilter::Reference<Properties>::Po
6178 if( !m_pImpl->m_rDMapper.IsOOXMLImport() || m_pImpl->m_pCurrentEntry->sStyleName.getLength() >0)
6180 m_pImpl->m_pCurrentEntry->sConvertedStyleName = ConvertStyleName( m_pImpl->m_pCurrentEntry->sStyleName );
6181 - m_pImpl->m_aStyleSheetEntries.push_back( *m_pImpl->m_pCurrentEntry );
6182 + m_pImpl->m_aStyleSheetEntries.push_back( m_pImpl->m_pCurrentEntry );
6186 //TODO: this entry contains the default settings - they have to be added to the settings
6188 - m_pImpl->m_pCurrentEntry = 0;
6189 + StyleSheetEntryPtr pEmptyEntry;
6190 + m_pImpl->m_pCurrentEntry = pEmptyEntry;
6192 /*-- 21.06.2006 15:34:49---------------------------------------------------
6194 @@ -910,16 +1130,17 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
6195 xStyleFamilies->getByName(rPropNameSupplier.GetName( PROP_PARAGRAPH_STYLES )) >>= xParaStyles;
6196 if(xCharStyles.is() && xParaStyles.is())
6198 - std::vector< StyleSheetEntry >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
6199 + std::vector< StyleSheetEntryPtr >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
6200 while( aIt != m_pImpl->m_aStyleSheetEntries.end() )
6202 - if( aIt->nStyleTypeCode == STYLE_TYPE_CHAR || aIt->nStyleTypeCode == STYLE_TYPE_PARA )
6203 + StyleSheetEntryPtr pEntry = *aIt;
6204 + if( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR || pEntry->nStyleTypeCode == STYLE_TYPE_PARA )
6206 - bool bParaStyle = aIt->nStyleTypeCode == STYLE_TYPE_PARA;
6207 + bool bParaStyle = pEntry->nStyleTypeCode == STYLE_TYPE_PARA;
6208 bool bInsert = false;
6209 uno::Reference< container::XNameContainer > xStyles = bParaStyle ? xParaStyles : xCharStyles;
6210 uno::Reference< style::XStyle > xStyle;
6211 - ::rtl::OUString sConvertedStyleName = ConvertStyleName( aIt->sStyleName );
6212 + ::rtl::OUString sConvertedStyleName = ConvertStyleName( pEntry->sStyleName );
6213 if(xStyles->hasByName( sConvertedStyleName ))
6214 xStyles->getByName( sConvertedStyleName ) >>= xStyle;
6216 @@ -931,12 +1152,13 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
6217 rPropNameSupplier.GetName( PROP_SERVICE_CHAR_STYLE )),
6218 uno::UNO_QUERY_THROW);
6220 - if( aIt->sBaseStyleIdentifier.getLength() )
6221 + if( pEntry->sBaseStyleIdentifier.getLength() )
6225 //TODO: Handle cases where a paragraph <> character style relation is needed
6226 - xStyle->setParentStyle(ConvertStyleName( aIt->sBaseStyleIdentifier ));
6227 + StyleSheetEntryPtr pParent = FindStyleSheetByISTD( pEntry->sBaseStyleIdentifier );
6228 + xStyle->setParentStyle(ConvertStyleName( pParent->sStyleName ));
6230 catch( const uno::RuntimeException& )
6232 @@ -955,43 +1177,103 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
6234 uno::Any aTwoHundredFortyTwip = uno::makeAny(12.);
6235 // font size to 240 twip (12 pts) for all if not set
6236 - aIt->pProperties->Insert(PROP_CHAR_HEIGHT, true, aTwoHundredFortyTwip, false);
6237 + pEntry->pProperties->Insert(PROP_CHAR_HEIGHT, true, aTwoHundredFortyTwip, false);
6238 // western font not already set -> apply first font
6239 const FontEntry* pWesternFontEntry = rFontTable->getFontEntry( 0 );
6240 rtl::OUString sWesternFontName = pWesternFontEntry->sFontName;
6241 - aIt->pProperties->Insert(PROP_CHAR_FONT_NAME, true, uno::makeAny( sWesternFontName ), false);
6242 + pEntry->pProperties->Insert(PROP_CHAR_FONT_NAME, true, uno::makeAny( sWesternFontName ), false);
6244 // CJK ... apply second font
6245 const FontEntry* pCJKFontEntry = rFontTable->getFontEntry( 2 );
6246 - aIt->pProperties->Insert(PROP_CHAR_FONT_NAME_ASIAN, true, uno::makeAny( pCJKFontEntry->sFontName ), false);
6247 - aIt->pProperties->Insert(PROP_CHAR_HEIGHT_ASIAN, true, aTwoHundredFortyTwip, false);
6248 + pEntry->pProperties->Insert(PROP_CHAR_FONT_NAME_ASIAN, true, uno::makeAny( pCJKFontEntry->sFontName ), false);
6249 + pEntry->pProperties->Insert(PROP_CHAR_HEIGHT_ASIAN, true, aTwoHundredFortyTwip, false);
6250 // CTL ... apply third font, if available
6251 if( nFontCount > 3 )
6253 const FontEntry* pCTLFontEntry = rFontTable->getFontEntry( 3 );
6254 - aIt->pProperties->Insert(PROP_CHAR_FONT_NAME_COMPLEX, true, uno::makeAny( pCTLFontEntry->sFontName ), false);
6255 - aIt->pProperties->Insert(PROP_CHAR_HEIGHT_COMPLEX, true, aTwoHundredFortyTwip, false);
6256 + pEntry->pProperties->Insert(PROP_CHAR_FONT_NAME_COMPLEX, true, uno::makeAny( pCTLFontEntry->sFontName ), false);
6257 + pEntry->pProperties->Insert(PROP_CHAR_HEIGHT_COMPLEX, true, aTwoHundredFortyTwip, false);
6260 // Widow/Orphan -> set both to two if not already set
6261 uno::Any aTwo = uno::makeAny(sal_Int8(2));
6262 - aIt->pProperties->Insert(PROP_PARA_WIDOWS, true, aTwo, false);
6263 - aIt->pProperties->Insert(PROP_PARA_ORPHANS, true, aTwo, false);
6264 + pEntry->pProperties->Insert(PROP_PARA_WIDOWS, true, aTwo, false);
6265 + pEntry->pProperties->Insert(PROP_PARA_ORPHANS, true, aTwo, false);
6266 // Left-to-right direction if not already set
6267 - aIt->pProperties->Insert(PROP_WRITING_MODE, true, uno::makeAny( sal_Int16(text::WritingMode_LR_TB) ), false);
6268 + pEntry->pProperties->Insert(PROP_WRITING_MODE, true, uno::makeAny( sal_Int16(text::WritingMode_LR_TB) ), false);
6269 // font color COL_AUTO if not already set
6270 - aIt->pProperties->Insert(PROP_CHAR_COLOR, true, uno::makeAny( sal_Int32(0xffffffff) ), false);
6271 + pEntry->pProperties->Insert(PROP_CHAR_COLOR, true, uno::makeAny( sal_Int32(0xffffffff) ), false);
6274 - uno::Sequence< beans::PropertyValue > aPropValues = aIt->pProperties->GetPropertyValues();
6275 + uno::Sequence< beans::PropertyValue > aPropValues = pEntry->pProperties->GetPropertyValues();
6276 bool bAddFollowStyle = false;
6277 - if(bParaStyle && !aIt->sNextStyleIdentifier.getLength() )
6278 + if(bParaStyle && !pEntry->sNextStyleIdentifier.getLength() )
6280 bAddFollowStyle = true;
6282 //remove Left/RightMargin values from TOX heading styles
6285 + // Set the outline levels
6286 + const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0);
6287 + if ( pStyleSheetProperties )
6289 + aPropValues.realloc( aPropValues.getLength( ) + 1 );
6291 + beans::PropertyValue aLvlVal( rPropNameSupplier.GetName( PROP_OUTLINE_LEVEL ), 0,
6292 + uno::makeAny( sal_Int16( pStyleSheetProperties->GetOutlineLevel( ) + 1 ) ),
6293 + beans::PropertyState_DIRECT_VALUE );
6294 + aPropValues[ aPropValues.getLength( ) - 1 ] = aLvlVal;
6296 + if ( pStyleSheetProperties->GetOutlineLevel( ) == 0 )
6298 + aPropValues.realloc( aPropValues.getLength( ) + 1 );
6299 + beans::PropertyValue aStyleVal( rPropNameSupplier.GetName( PROP_NUMBERING_STYLE_NAME ), 0,
6300 + uno::makeAny( rtl::OUString::createFromAscii( "" ) ),
6301 + beans::PropertyState_DIRECT_VALUE );
6302 + aPropValues[ aPropValues.getLength( ) - 1 ] = aStyleVal;
6306 + if ( pStyleSheetProperties && pStyleSheetProperties->GetOutlineLevel( ) >= 0 )
6308 + ListTablePtr pListTable = m_pImpl->m_rDMapper.GetListTable( );
6309 + sal_Int32 nNumId = pStyleSheetProperties->GetListId( );
6310 + uno::Reference< container::XIndexReplace> xStyleRules = pListTable->GetNumberingRules( nNumId );
6312 + sal_Int16 nLvl = pStyleSheetProperties->GetOutlineLevel( );
6313 + uno::Reference< text::XChapterNumberingSupplier > xOutlines ( m_pImpl->m_xTextDocument,
6314 + uno::UNO_QUERY_THROW );
6316 + uno::Reference< container::XIndexReplace > xRules = xOutlines->getChapterNumberingRules( );
6317 + if ( xStyleRules.is( ) )
6319 + for ( sal_Int32 i = 0, nCount = xStyleRules->getCount( ); i < nCount; i++ )
6321 + xRules->replaceByIndex( i, xStyleRules->getByIndex( i ) );
6325 + uno::Any aLevel = xRules->getByIndex( nLvl );
6326 + uno::Sequence< beans::PropertyValue > aLevelProps;
6327 + aLevel >>= aLevelProps;
6329 + sal_Int32 nLen = aLevelProps.getLength( );
6331 + bool bPropFound = false;
6332 + rtl::OUString sPropName( rtl::OUString::createFromAscii( "HeadingStyleName" ) );
6333 + while ( i < nLen && !bPropFound )
6335 + if ( aLevelProps[i].Name.equals( sPropName ) )
6337 + aLevelProps[i].Value = uno::makeAny( ConvertStyleName( pEntry->sStyleName ) );
6338 + bPropFound = true;
6342 + xRules->replaceByIndex( nLvl, uno::makeAny( aLevelProps ) );
6345 uno::Reference< beans::XPropertyState >xState( xStyle, uno::UNO_QUERY_THROW );
6346 if( sConvertedStyleName.equalsAscii( "Contents Heading" ) ||
6347 sConvertedStyleName.equalsAscii( "User Index Heading" ) ||
6348 @@ -1028,24 +1310,27 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
6350 if(bAddFollowStyle || aPropValues.getLength())
6352 - const beans::PropertyValue* pPropValues = aPropValues.getConstArray();
6353 PropValVector aSortedPropVals;
6354 for( sal_Int32 nProp = 0; nProp < aPropValues.getLength(); ++nProp)
6356 - aSortedPropVals.Insert( pPropValues[nProp] );
6357 + // Don't add the style name properties
6358 + bool bIsParaStyleName = aPropValues[nProp].Name.equalsAscii( "ParaStyleName" );
6359 + bool bIsCharStyleName = aPropValues[nProp].Name.equalsAscii( "CharStyleName" );
6360 + if ( !bInsert && !bIsParaStyleName && !bIsCharStyleName )
6361 + aSortedPropVals.Insert( aPropValues[nProp] );
6365 //find the name of the Next style
6366 - std::vector< StyleSheetEntry >::iterator aNextStyleIt = m_pImpl->m_aStyleSheetEntries.begin();
6367 + std::vector< StyleSheetEntryPtr >::iterator aNextStyleIt = m_pImpl->m_aStyleSheetEntries.begin();
6368 for( ; aNextStyleIt != m_pImpl->m_aStyleSheetEntries.end(); ++aNextStyleIt )
6370 - if( aNextStyleIt->sStyleName.getLength() &&
6371 - aNextStyleIt->sStyleName == aIt->sNextStyleIdentifier)
6372 + if( ( *aNextStyleIt )->sStyleName.getLength() &&
6373 + ( *aNextStyleIt )->sStyleName == pEntry->sNextStyleIdentifier)
6375 beans::PropertyValue aNew;
6376 aNew.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FollowStyle"));
6377 - aNew.Value = uno::makeAny(ConvertStyleName( aNextStyleIt->sStyleIdentifierD ));
6378 + aNew.Value = uno::makeAny(ConvertStyleName( ( *aNextStyleIt )->sStyleIdentifierD ));
6379 aSortedPropVals.Insert( aNew );
6382 @@ -1084,14 +1369,14 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
6383 /*-- 22.06.2006 15:56:56---------------------------------------------------
6385 -----------------------------------------------------------------------*/
6386 -const StyleSheetEntry* StyleSheetTable::FindStyleSheetByISTD(const ::rtl::OUString& sIndex)
6387 +const StyleSheetEntryPtr StyleSheetTable::FindStyleSheetByISTD(const ::rtl::OUString& sIndex)
6389 - const StyleSheetEntry* pRet = 0;
6390 + StyleSheetEntryPtr pRet;
6391 for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
6393 - if( m_pImpl->m_aStyleSheetEntries[nPos].sStyleIdentifierD == sIndex)
6394 + if( m_pImpl->m_aStyleSheetEntries[nPos]->sStyleIdentifierD == sIndex)
6396 - pRet = &m_pImpl->m_aStyleSheetEntries[nPos];
6397 + pRet = m_pImpl->m_aStyleSheetEntries[nPos];
6401 @@ -1100,14 +1385,14 @@ const StyleSheetEntry* StyleSheetTable::FindStyleSheetByISTD(const ::rtl::OUStri
6402 /*-- 28.12.2007 14:45:45---------------------------------------------------
6404 -----------------------------------------------------------------------*/
6405 -const StyleSheetEntry* StyleSheetTable::FindStyleSheetByStyleName(const ::rtl::OUString& sIndex)
6406 +const StyleSheetEntryPtr StyleSheetTable::FindStyleSheetByStyleName(const ::rtl::OUString& sIndex)
6408 - const StyleSheetEntry* pRet = 0;
6409 + StyleSheetEntryPtr pRet;
6410 for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
6412 - if( m_pImpl->m_aStyleSheetEntries[nPos].sStyleName == sIndex)
6413 + if( m_pImpl->m_aStyleSheetEntries[nPos]->sStyleName == sIndex)
6415 - pRet = &m_pImpl->m_aStyleSheetEntries[nPos];
6416 + pRet = m_pImpl->m_aStyleSheetEntries[nPos];
6420 @@ -1116,14 +1401,14 @@ const StyleSheetEntry* StyleSheetTable::FindStyleSheetByStyleName(const ::rtl::O
6421 /*-- 28.12.2007 14:45:45---------------------------------------------------
6423 -----------------------------------------------------------------------*/
6424 -const StyleSheetEntry* StyleSheetTable::FindStyleSheetByConvertedStyleName(const ::rtl::OUString& sIndex)
6425 +const StyleSheetEntryPtr StyleSheetTable::FindStyleSheetByConvertedStyleName(const ::rtl::OUString& sIndex)
6427 - const StyleSheetEntry* pRet = 0;
6428 + StyleSheetEntryPtr pRet;
6429 for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
6431 - if( m_pImpl->m_aStyleSheetEntries[nPos].sConvertedStyleName == sIndex)
6432 + if( m_pImpl->m_aStyleSheetEntries[nPos]->sConvertedStyleName == sIndex)
6434 - pRet = &m_pImpl->m_aStyleSheetEntries[nPos];
6435 + pRet = m_pImpl->m_aStyleSheetEntries[nPos];
6439 @@ -1133,23 +1418,17 @@ const StyleSheetEntry* StyleSheetTable::FindStyleSheetByConvertedStyleName(const
6440 /*-- 17.07.2006 11:47:00---------------------------------------------------
6442 -----------------------------------------------------------------------*/
6443 -const StyleSheetEntry* StyleSheetTable::FindParentStyleSheet(::rtl::OUString sBaseStyle)
6444 +const StyleSheetEntryPtr StyleSheetTable::FindParentStyleSheet(::rtl::OUString sBaseStyle)
6446 if( !sBaseStyle.getLength() )
6449 + StyleSheetEntryPtr pEmptyPtr;
6452 if( m_pImpl->m_pCurrentEntry)
6453 sBaseStyle = m_pImpl->m_pCurrentEntry->sBaseStyleIdentifier;
6455 - const StyleSheetEntry* pRet = 0;
6456 - for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
6458 - if( m_pImpl->m_aStyleSheetEntries[nPos].sStyleIdentifierD == sBaseStyle )
6460 - pRet = &m_pImpl->m_aStyleSheetEntries[nPos];
6465 + return FindStyleSheetByISTD( sBaseStyle );
6467 /*-- 21.12.2006 15:58:23---------------------------------------------------
6469 @@ -1187,12 +1466,12 @@ static const sal_Char *aStyleNamePairs[] =
6470 "Index 1", "Index 1",
6471 "Index 2", "Index 2",
6472 "Index 3", "Index 3",
6485 "TOC 1", "Contents 1",
6486 "TOC 2", "Contents 2",
6487 "TOC 3", "Contents 3",
6488 @@ -1222,46 +1501,46 @@ static const sal_Char *aStyleNamePairs[] =
6489 "TOC7", "Contents 7",
6490 "TOC8", "Contents 8",
6491 "TOC9", "Contents 9",
6492 - "Normal Indent", 0,
6493 + "Normal Indent", "",
6494 "Footnote Text", "Footnote",
6495 - "Annotation Text", 0,
6496 + "Annotation Text", "",
6501 "Index Heading", "Index Heading",
6503 - "Table of Figures", 0,
6505 + "Table of Figures", "",
6506 "Envelope Address", "Addressee",
6507 "Envelope Return", "Sender",
6508 "Footnote Reference", "Footnote anchor",
6509 - "Annotation Reference", 0,
6510 + "Annotation Reference", "",
6511 "Line Number", "Line numbering",
6512 "Page Number", "Page Number",
6513 "Endnote Reference", "Endnote anchor",
6514 "Endnote Text", "Endnote Symbol",
6515 - "Table of Authorities", 0,
6518 + "Table of Authorities", "",
6520 + "TOA Heading", "",
6527 - "List Bullet 2", 0,
6528 - "List Bullet 3", 0,
6529 - "List Bullet 4", 0,
6530 - "List Bullet 5", 0,
6532 - "List Number 2", 0,
6533 - "List Number 3", 0,
6534 - "List Number 4", 0,
6535 - "List Number 5", 0,
6540 + "List Bullet", "",
6541 + "List Bullet 2", "",
6542 + "List Bullet 3", "",
6543 + "List Bullet 4", "",
6544 + "List Bullet 5", "",
6545 + "List Number", "",
6546 + "List Number 2", "",
6547 + "List Number 3", "",
6548 + "List Number 4", "",
6549 + "List Number 5", "",
6553 "Signature", "Signature",
6554 - "Default Paragraph Font", 0,
6555 + "Default Paragraph Font", "",
6556 "DefaultParagraphFont", "Default Paragraph Font",
6557 "Body Text", "Text body",
6558 "BodyText", "Text body",
6559 @@ -1269,29 +1548,29 @@ static const sal_Char *aStyleNamePairs[] =
6560 "Body Text Indent", "Text body indent",
6561 "BodyTextIndent", "Text body indent",
6562 "BodyTextIndent2", "Text body indent2",
6563 - "List Continue", 0,
6564 - "List Continue 2", 0,
6565 - "List Continue 3", 0,
6566 - "List Continue 4", 0,
6567 - "List Continue 5", 0,
6568 - "Message Header", 0,
6569 + "List Continue", "",
6570 + "List Continue 2", "",
6571 + "List Continue 3", "",
6572 + "List Continue 4", "",
6573 + "List Continue 5", "",
6574 + "Message Header", "",
6575 "Subtitle", "Subtitle",
6580 "Body Text First Indent", "Body Text Indent",
6581 - "Body Text First Indent 2", 0,
6582 - "Note Heading", 0,
6585 - "Body Text Indent 2", 0,
6586 - "Body Text Indent 3", 0,
6588 + "Body Text First Indent 2", "",
6589 + "Note Heading", "",
6590 + "Body Text 2", "",
6591 + "Body Text 3", "",
6592 + "Body Text Indent 2", "",
6593 + "Body Text Indent 3", "",
6595 "Hyperlink", "Internet link",
6596 "Followed Hyperlink", "Visited Internet Link",
6597 "Strong", "Strong Emphasis",
6598 "Emphasis", "Emphasis",
6599 - "Document Map", 0,
6601 + "Document Map", "",
6603 "NoList", "No List",
6604 "AbstractHeading", "Abstract Heading",
6605 "AbstractBody", "Abstract Body",
6606 @@ -1307,12 +1586,12 @@ static const sal_Char *aStyleNamePairs[] =
6607 if( bExtendedSearch )
6609 //search for the rWWName in the IdentifierD of the existing styles and convert the sStyleName member
6610 - std::vector< StyleSheetEntry >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
6611 + std::vector< StyleSheetEntryPtr >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
6612 //TODO: performance issue - put styles list into a map sorted by it's sStyleIdentifierD members
6613 while( aIt != m_pImpl->m_aStyleSheetEntries.end() )
6615 - if( rWWName == aIt->sStyleIdentifierD )
6616 - sRet = aIt->sStyleName;
6617 + if( rWWName == ( *aIt )->sStyleIdentifierD )
6618 + sRet = ( *aIt )->sStyleName;
6622 diff --git writerfilter/source/dmapper/StyleSheetTable.hxx writerfilter/source/dmapper/StyleSheetTable.hxx
6623 index 2cab554..9c01dbc 100644
6624 --- writerfilter/source/dmapper/StyleSheetTable.hxx
6625 +++ writerfilter/source/dmapper/StyleSheetTable.hxx
6627 #ifndef INCLUDED_STYLESHEETTABLE_HXX
6628 #define INCLUDED_STYLESHEETTABLE_HXX
6630 +#include "TblStylePrHandler.hxx"
6632 #include <WriterFilterDllApi.hxx>
6633 #include <dmapper/DomainMapper.hxx>
6634 #include <com/sun/star/lang/XComponent.hpp>
6635 @@ -41,6 +43,7 @@ namespace com{ namespace sun { namespace star { namespace text{
6636 class XTextDocument;
6640 namespace writerfilter {
6643 @@ -72,6 +75,9 @@ struct StyleSheetEntry
6644 ::rtl::OUString sConvertedStyleName;
6648 +typedef boost::shared_ptr<StyleSheetEntry> StyleSheetEntryPtr;
6651 class WRITERFILTER_DLLPRIVATE StyleSheetTable :
6653 @@ -92,11 +98,11 @@ public:
6654 virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
6656 void ApplyStyleSheets( FontTablePtr rFontTable );
6657 - const StyleSheetEntry* FindStyleSheetByISTD(const ::rtl::OUString& sIndex);
6658 - const StyleSheetEntry* FindStyleSheetByStyleName(const ::rtl::OUString& rIndex);
6659 - const StyleSheetEntry* FindStyleSheetByConvertedStyleName(const ::rtl::OUString& rIndex);
6660 + const StyleSheetEntryPtr FindStyleSheetByISTD(const ::rtl::OUString& sIndex);
6661 + const StyleSheetEntryPtr FindStyleSheetByStyleName(const ::rtl::OUString& rIndex);
6662 + const StyleSheetEntryPtr FindStyleSheetByConvertedStyleName(const ::rtl::OUString& rIndex);
6663 // returns the parent of the one with the given name - if empty the parent of the current style sheet is returned
6664 - const StyleSheetEntry* FindParentStyleSheet(::rtl::OUString sBaseStyle);
6665 + const StyleSheetEntryPtr FindParentStyleSheet(::rtl::OUString sBaseStyle);
6667 ::rtl::OUString ConvertStyleName( const ::rtl::OUString& rWWName, bool bExtendedSearch = false );
6668 ::rtl::OUString GetStyleIdFromIndex(const sal_uInt32 sti);
6669 @@ -110,6 +116,38 @@ private:
6671 typedef boost::shared_ptr< StyleSheetTable > StyleSheetTablePtr;
6674 +class WRITERFILTER_DLLPRIVATE TableStyleSheetEntry :
6675 + public StyleSheetEntry
6678 + typedef std::map<TblStyleType, PropertyMapPtr> TblStylePrs;
6680 + StyleSheetTable* m_pStyleSheet;
6681 + TblStylePrs m_aStyles;
6685 + short m_nColBandSize;
6686 + short m_nRowBandSize;
6688 + // Adds a new tblStylePr to the table style entry. This method
6689 + // fixes some possible properties conflicts, like borders ones.
6690 + void AddTblStylePr( TblStyleType nType, PropertyMapPtr pProps );
6692 + // Gets all the properties
6693 + // + corresponding to the mask,
6694 + // + from the parent styles
6695 + PropertyMapPtr GetProperties( sal_Int32 nMask );
6697 + TableStyleSheetEntry( StyleSheetEntry& aEntry, StyleSheetTable* pStyles );
6698 + ~TableStyleSheetEntry( );
6701 + PropertyMapPtr GetLocalPropertiesFromMask( sal_Int32 nMask );
6703 +typedef boost::shared_ptr<TableStyleSheetEntry> TableStyleSheetEntryPtr;
6708 diff --git writerfilter/source/dmapper/TDefTableHandler.cxx writerfilter/source/dmapper/TDefTableHandler.cxx
6709 index d695299..1ef9e8a 100644
6710 --- writerfilter/source/dmapper/TDefTableHandler.cxx
6711 +++ writerfilter/source/dmapper/TDefTableHandler.cxx
6712 @@ -155,6 +155,11 @@ void TDefTableHandler::attribute(Id rName, Value & rVal)
6713 case NS_rtf::LN_UNUSED2_15: // 0x2877
6716 + case NS_ooxml::LN_CT_Border_themeColor:
6717 + case NS_ooxml::LN_CT_Border_themeTint:
6718 + case NS_ooxml::LN_CT_Border_themeShade:
6722 OSL_ENSURE(false, "unknown attribute");
6724 @@ -199,6 +204,12 @@ void TDefTableHandler::localResolve(Id rName, writerfilter::Reference<Properties
6725 case NS_rtf::LN_BRCRIGHT:
6726 m_aRightBorderLines.push_back(aBorderLine);
6728 + case NS_ooxml::LN_CT_TcBorders_insideH:
6729 + m_aInsideHBorderLines.push_back(aBorderLine);
6731 + case NS_ooxml::LN_CT_TcBorders_insideV:
6732 + m_aInsideVBorderLines.push_back(aBorderLine);
6737 @@ -219,6 +230,10 @@ void TDefTableHandler::sprm(Sprm & rSprm)
6738 case NS_ooxml::LN_CT_TcBorders_bottom:
6739 /* WRITERFILTERSTATUS: done: 1, planned: 0, spent: 0 */
6740 case NS_ooxml::LN_CT_TcBorders_right:
6741 + case NS_ooxml::LN_CT_TcBorders_insideH:
6742 + case NS_ooxml::LN_CT_TcBorders_insideV:
6743 + case NS_ooxml::LN_CT_TcBorders_tl2br:
6744 + case NS_ooxml::LN_CT_TcBorders_tr2bl:
6746 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
6747 localResolve( rSprm.getId(), pProperties );
6748 @@ -281,6 +296,10 @@ void TDefTableHandler::fillCellProperties(
6749 pCellProperties->Insert( PROP_BOTTOM_BORDER, false, uno::makeAny( m_aBottomBorderLines[nCell] ) );
6750 if( m_aRightBorderLines.size() > nCell )
6751 pCellProperties->Insert( PROP_RIGHT_BORDER, false, uno::makeAny( m_aRightBorderLines[nCell] ) );
6752 + if( m_aInsideHBorderLines.size() > nCell )
6753 + pCellProperties->Insert( META_PROP_HORIZONTAL_BORDER, false, uno::makeAny( m_aInsideHBorderLines[nCell] ) );
6754 + if( m_aInsideVBorderLines.size() > nCell )
6755 + pCellProperties->Insert( META_PROP_VERTICAL_BORDER, false, uno::makeAny( m_aInsideVBorderLines[nCell] ) );
6757 /*-- 09.05.2007 13:14:17---------------------------------------------------
6759 diff --git writerfilter/source/dmapper/TDefTableHandler.hxx writerfilter/source/dmapper/TDefTableHandler.hxx
6760 index f5a720c..22e2682 100644
6761 --- writerfilter/source/dmapper/TDefTableHandler.hxx
6762 +++ writerfilter/source/dmapper/TDefTableHandler.hxx
6763 @@ -56,6 +56,10 @@ private:
6764 ::std::vector< ::com::sun::star::table::BorderLine > m_aRightBorderLines;
6765 ::std::vector< ::com::sun::star::table::BorderLine > m_aTopBorderLines;
6766 ::std::vector< ::com::sun::star::table::BorderLine > m_aBottomBorderLines;
6767 + ::std::vector< ::com::sun::star::table::BorderLine > m_aInsideHBorderLines;
6768 + ::std::vector< ::com::sun::star::table::BorderLine > m_aInsideVBorderLines;
6769 + ::std::vector< ::com::sun::star::table::BorderLine > m_aTl2brBorderLines;
6770 + ::std::vector< ::com::sun::star::table::BorderLine > m_aTr2blBorderLines;
6772 //values of the current border
6773 sal_Int32 m_nLineWidth;
6774 diff --git writerfilter/source/dmapper/TablePropertiesHandler.cxx writerfilter/source/dmapper/TablePropertiesHandler.cxx
6775 new file mode 100644
6776 index 0000000..e7bc423
6778 +++ writerfilter/source/dmapper/TablePropertiesHandler.cxx
6780 +#include "BorderHandler.hxx"
6781 +#include "CellColorHandler.hxx"
6782 +#include "CellMarginHandler.hxx"
6783 +#include "ConversionHelper.hxx"
6784 +#include "MeasureHandler.hxx"
6785 +#include "TablePropertiesHandler.hxx"
6786 +#include "TDefTableHandler.hxx"
6788 +#include <ooxml/resourceids.hxx>
6789 +#include <doctok/sprmids.hxx>
6791 +#include <com/sun/star/text/SizeType.hpp>
6792 +#include <com/sun/star/text/VertOrientation.hpp>
6795 +namespace writerfilter {
6796 +namespace dmapper {
6798 + TablePropertiesHandler::TablePropertiesHandler( bool bOOXML ) :
6799 + m_pTableManager( NULL ),
6800 + m_bOOXML( bOOXML )
6805 + TablePropertiesHandler::~TablePropertiesHandler( )
6807 + // Do not delete the table manager... this will be done somewhere else
6808 + m_pTableManager = NULL;
6811 + bool TablePropertiesHandler::sprm(Sprm & rSprm)
6814 + sal_uInt32 nSprmId = rSprm.getId();
6815 + Value::Pointer_t pValue = rSprm.getValue();
6816 + sal_Int32 nIntValue = ((pValue.get() != NULL) ? pValue->getInt() : 0);
6817 + /* WRITERFILTERSTATUS: table: table_sprmdata */
6820 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
6821 + case NS_ooxml::LN_CT_TrPrBase_jc: //90706
6822 + /* WRITERFILTERSTATUS: done: 1, planned: 0.5, spent: 0.5 */
6823 + case NS_ooxml::LN_CT_TblPrBase_jc:
6824 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
6825 + case 0x5400: // sprmTJc
6827 + //table justification 0: left, 1: center, 2: right
6828 + sal_Int16 nOrient = ConversionHelper::convertTableJustification( nIntValue );
6829 + TablePropertyMapPtr pTableMap( new TablePropertyMap );
6830 + pTableMap->setValue( TablePropertyMap::HORI_ORIENT, nOrient );
6831 + insertTableProps( pTableMap );
6834 + /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
6835 + case 0x9601: // sprmTDxaLeft
6837 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6838 + case 0x9602: // sprmTDxaGapHalf
6840 + //m_nGapHalf = ConversionHelper::convertTwipToMM100( nIntValue );
6841 + TablePropertyMapPtr pPropMap( new TablePropertyMap );
6842 + pPropMap->setValue( TablePropertyMap::GAP_HALF, ConversionHelper::convertTwipToMM100( nIntValue ) );
6843 + insertTableProps(pPropMap);
6846 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
6847 + case NS_ooxml::LN_CT_TrPrBase_trHeight: //90703
6849 + //contains unit and value
6850 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
6851 + if( pProperties.get())
6852 + { //contains attributes x2902 (LN_unit) and x17e2 (LN_trleft)
6853 + MeasureHandlerPtr pMeasureHandler( new MeasureHandler );
6854 + pProperties->resolve(*pMeasureHandler);
6855 + TablePropertyMapPtr pPropMap( new TablePropertyMap );
6856 + pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() ));
6857 + pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(pMeasureHandler->getMeasureValue() ));
6858 + insertRowProps(pPropMap);
6862 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6863 + case 0x3403: // sprmTFCantSplit
6864 + case NS_sprm::LN_TCantSplit: // 0x3644
6866 + //row can't break across pages if nIntValue == 1
6867 + TablePropertyMapPtr pPropMap( new TablePropertyMap );
6868 + pPropMap->Insert( PROP_IS_SPLIT_ALLOWED, false, uno::makeAny(sal_Bool( nIntValue == 1 ? sal_False : sal_True ) ));
6869 + insertRowProps(pPropMap);
6872 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6873 + case 0x9407: // sprmTDyaRowHeight
6875 + // table row height - negative values indicate 'exact height' - positive 'at least'
6876 + TablePropertyMapPtr pPropMap( new TablePropertyMap );
6877 + bool bMinHeight = true;
6878 + sal_Int16 nHeight = static_cast<sal_Int16>( nIntValue );
6881 + bMinHeight = false;
6884 + pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny(bMinHeight ? text::SizeType::MIN : text::SizeType::FIX ));
6885 + pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(ConversionHelper::convertTwipToMM100( nHeight )));
6886 + insertRowProps(pPropMap);
6889 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6890 + case NS_ooxml::LN_CT_TcPrBase_vAlign://90694
6892 + sal_Int16 nVertOrient = text::VertOrientation::NONE;
6893 + switch( nIntValue ) //0 - top 1 - center 3 - bottom
6895 + case 1: nVertOrient = text::VertOrientation::CENTER; break;
6896 + case 3: nVertOrient = text::VertOrientation::BOTTOM; break;
6899 + TablePropertyMapPtr pCellPropMap( new TablePropertyMap() );
6900 + pCellPropMap->Insert( PROP_VERT_ORIENT, false, uno::makeAny( nVertOrient ) );
6901 + //todo: in ooxml import the value of m_ncell is wrong
6902 + cellProps( pCellPropMap );
6905 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6906 + case NS_ooxml::LN_CT_TblPrBase_tblBorders: //table borders, might be defined in table style
6908 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
6909 + if( pProperties.get())
6911 + BorderHandlerPtr pBorderHandler( new BorderHandler(m_bOOXML) );
6912 + pProperties->resolve(*pBorderHandler);
6913 + TablePropertyMapPtr pTablePropMap( new TablePropertyMap );
6914 + pTablePropMap->insert( pBorderHandler->getProperties() );
6915 + insertTableProps( pTablePropMap );
6919 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6920 + case NS_ooxml::LN_CT_TcPrBase_tcBorders ://cell borders
6921 + //contains CT_TcBorders_left, right, top, bottom
6923 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
6924 + if( pProperties.get())
6926 + //in OOXML there's one set of borders at each cell (if there is any)
6927 + TDefTableHandlerPtr pTDefTableHandler( new TDefTableHandler( m_bOOXML ));
6928 + pProperties->resolve( *pTDefTableHandler );
6929 + TablePropertyMapPtr pCellPropMap( new TablePropertyMap );
6930 + pTDefTableHandler->fillCellProperties( 0, pCellPropMap );
6931 + cellProps( pCellPropMap );
6935 + case NS_ooxml::LN_CT_TblPrBase_shd:
6937 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
6938 + if( pProperties.get())
6940 + CellColorHandlerPtr pCellColorHandler( new CellColorHandler);
6941 + pProperties->resolve( *pCellColorHandler );
6942 + TablePropertyMapPtr pTablePropMap( new TablePropertyMap );
6943 + insertTableProps( pCellColorHandler->getProperties() );
6947 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6948 + case 0xd61a : // sprmTCellTopColor
6949 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6950 + case 0xd61b : // sprmTCellLeftColor
6951 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6952 + case 0xd61c : // sprmTCellBottomColor
6953 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6954 + case 0xd61d : // sprmTCellRightColor
6955 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
6956 + case NS_ooxml::LN_CT_TcPrBase_shd:
6958 + // each color sprm contains as much colors as cells are in a row
6959 + //LN_CT_TcPrBase_shd: cell shading contains: LN_CT_Shd_val, LN_CT_Shd_fill, LN_CT_Shd_color
6960 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
6961 + if( pProperties.get())
6963 + CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
6964 + pProperties->resolve( *pCellColorHandler );
6965 + cellProps( pCellColorHandler->getProperties());
6969 +//OOXML table properties
6970 + /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
6971 + case NS_ooxml::LN_CT_TblPrBase_tblCellMar: //cell margins
6973 + //contains LN_CT_TblCellMar_top, LN_CT_TblCellMar_left, LN_CT_TblCellMar_bottom, LN_CT_TblCellMar_right
6974 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
6975 + if( pProperties.get())
6977 + CellMarginHandlerPtr pCellMarginHandler( new CellMarginHandler );
6978 + pProperties->resolve( *pCellMarginHandler );
6979 + TablePropertyMapPtr pMarginProps( new TablePropertyMap );
6980 + if( pCellMarginHandler->m_bTopMarginValid )
6981 + pMarginProps->setValue( TablePropertyMap::CELL_MAR_TOP, pCellMarginHandler->m_nTopMargin );
6982 + if( pCellMarginHandler->m_bBottomMarginValid )
6983 + pMarginProps->setValue( TablePropertyMap::CELL_MAR_BOTTOM, pCellMarginHandler->m_nBottomMargin );
6984 + if( pCellMarginHandler->m_bLeftMarginValid )
6985 + pMarginProps->setValue( TablePropertyMap::CELL_MAR_LEFT, pCellMarginHandler->m_nLeftMargin );
6986 + if( pCellMarginHandler->m_bRightMarginValid )
6987 + pMarginProps->setValue( TablePropertyMap::CELL_MAR_RIGHT, pCellMarginHandler->m_nRightMargin );
6988 + insertTableProps(pMarginProps);
6992 + default: bRet = false;
6997 diff --git writerfilter/source/dmapper/TablePropertiesHandler.hxx writerfilter/source/dmapper/TablePropertiesHandler.hxx
6998 new file mode 100644
6999 index 0000000..9c91b41
7001 +++ writerfilter/source/dmapper/TablePropertiesHandler.hxx
7003 +#ifndef INCLUDED_TABLEPROPERTIESHANDLER_HXX
7004 +#define INCLUDED_TABLEPROPERTIESHANDLER_HXX
7006 +#include <PropertyMap.hxx>
7008 +#include <resourcemodel/TableManager.hxx>
7009 +#include <WriterFilterDllApi.hxx>
7010 +#include <resourcemodel/WW8ResourceModel.hxx>
7012 +#include <boost/shared_ptr.hpp>
7016 +namespace writerfilter {
7017 +namespace dmapper {
7019 +using namespace std;
7021 +typedef ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > Handle_t;
7022 +typedef TableManager<Handle_t , TablePropertyMapPtr > DomainMapperTableManager_Base_t;
7024 +class TablePropertiesHandler
7027 + vector< PropertyMapPtr > m_rPropertiesStack;
7028 + PropertyMapPtr m_pCurrentProperties;
7029 + DomainMapperTableManager_Base_t *m_pTableManager;
7033 + TablePropertiesHandler( bool bOOXML );
7034 + virtual ~TablePropertiesHandler( );
7036 + bool sprm(Sprm & sprm);
7038 + inline void SetTableManager( DomainMapperTableManager_Base_t *pTableManager )
7040 + m_pTableManager = pTableManager;
7043 + inline void SetProperties( PropertyMapPtr pProperties )
7045 + m_pCurrentProperties = pProperties;
7050 + inline void cellProps( TablePropertyMapPtr pProps )
7052 + if ( m_pTableManager )
7053 + m_pTableManager->cellProps( pProps );
7055 + m_pCurrentProperties->insert( pProps, true );
7058 + inline void cellPropsByCell( unsigned int i, TablePropertyMapPtr pProps )
7060 + if ( m_pTableManager )
7061 + m_pTableManager->cellPropsByCell( i, pProps );
7063 + m_pCurrentProperties->insert( pProps, true );
7066 + inline void insertRowProps( TablePropertyMapPtr pProps )
7068 + if ( m_pTableManager )
7069 + m_pTableManager->insertRowProps( pProps );
7071 + m_pCurrentProperties->insert( pProps, true );
7074 + inline void insertTableProps( TablePropertyMapPtr pProps )
7076 + if ( m_pTableManager )
7077 + m_pTableManager->insertTableProps( pProps );
7079 + m_pCurrentProperties->insert( pProps, true );
7082 +typedef boost::shared_ptr<TablePropertiesHandler> TablePropertiesHandlerPtr;
7087 diff --git writerfilter/source/dmapper/TblStylePrHandler.cxx writerfilter/source/dmapper/TblStylePrHandler.cxx
7088 new file mode 100644
7089 index 0000000..8f901ec
7091 +++ writerfilter/source/dmapper/TblStylePrHandler.cxx
7093 +#include <TblStylePrHandler.hxx>
7094 +#include <PropertyMap.hxx>
7095 +#include <ooxml/resourceids.hxx>
7097 +namespace writerfilter {
7098 +namespace dmapper {
7100 +TblStylePrHandler::TblStylePrHandler( DomainMapper & rDMapper ) :
7101 + m_rDMapper( rDMapper ),
7102 + m_pTablePropsHandler( new TablePropertiesHandler( true ) ),
7103 + m_nType( TBL_STYLE_UNKNOWN ),
7104 + m_pProperties( new PropertyMap )
7108 +TblStylePrHandler::~TblStylePrHandler( )
7110 + delete m_pTablePropsHandler, m_pTablePropsHandler = NULL;
7113 +void TblStylePrHandler::attribute(Id rName, Value & rVal)
7117 + case NS_ooxml::LN_CT_TblStyleOverrideType:
7119 + // The tokenid should be the same in the model.xml than
7120 + // in the TblStyleType enum
7121 + m_nType = TblStyleType( rVal.getInt( ) );
7127 +void TblStylePrHandler::sprm(Sprm & rSprm)
7129 + Value::Pointer_t pValue = rSprm.getValue();
7130 + switch ( rSprm.getId( ) )
7132 + case NS_ooxml::LN_CT_PPrBase:
7133 + case NS_ooxml::LN_EG_RPrBase:
7134 + case NS_ooxml::LN_CT_TblPrBase:
7135 + case NS_ooxml::LN_CT_TrPrBase:
7136 + case NS_ooxml::LN_CT_TcPrBase:
7137 + resolveSprmProps( rSprm );
7140 + // Tables specific properties have to handled here
7141 + m_pTablePropsHandler->SetProperties( m_pProperties );
7142 + bool bRet = m_pTablePropsHandler->sprm( rSprm );
7146 + // The DomainMapper can handle some of the properties
7147 + m_rDMapper.PushStyleSheetProperties( m_pProperties, true );
7148 + m_rDMapper.sprm( rSprm );
7149 + m_rDMapper.PopStyleSheetProperties( true );
7154 +void TblStylePrHandler::resolveSprmProps(Sprm & rSprm)
7156 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
7157 + if( pProperties.get())
7158 + pProperties->resolve(*this);
7162 diff --git writerfilter/source/dmapper/TblStylePrHandler.hxx writerfilter/source/dmapper/TblStylePrHandler.hxx
7163 new file mode 100644
7164 index 0000000..4b1298e
7166 +++ writerfilter/source/dmapper/TblStylePrHandler.hxx
7168 +#ifndef INCLUDED_TBLSTYLEPRHANDLER_HXX
7169 +#define INCLUDED_TBLSTYLEPRHANDLER_HXX
7171 +#include "TablePropertiesHandler.hxx"
7173 +#include <dmapper/DomainMapper.hxx>
7174 +#include <WriterFilterDllApi.hxx>
7175 +#include <resourcemodel/WW8ResourceModel.hxx>
7176 +#include <boost/shared_ptr.hpp>
7178 +namespace writerfilter {
7179 +namespace dmapper {
7181 +class DomainMapper;
7186 + TBL_STYLE_UNKNOWN,
7187 + TBL_STYLE_WHOLETABLE,
7188 + TBL_STYLE_FIRSTROW,
7189 + TBL_STYLE_LASTROW,
7190 + TBL_STYLE_FIRSTCOL,
7191 + TBL_STYLE_LASTCOL,
7192 + TBL_STYLE_BAND1VERT,
7193 + TBL_STYLE_BAND2VERT,
7194 + TBL_STYLE_BAND1HORZ,
7195 + TBL_STYLE_BAND2HORZ,
7202 +class WRITERFILTER_DLLPRIVATE TblStylePrHandler : public Properties
7205 + DomainMapper & m_rDMapper;
7206 + TablePropertiesHandler * m_pTablePropsHandler;
7208 + TblStyleType m_nType;
7209 + PropertyMapPtr m_pProperties;
7212 + TblStylePrHandler( DomainMapper & rDMapper );
7213 + virtual ~TblStylePrHandler( );
7216 + virtual void attribute(Id Name, Value & val);
7217 + virtual void sprm(Sprm & sprm);
7219 + inline PropertyMapPtr getProperties() { return m_pProperties; };
7220 + inline TblStyleType getType() { return m_nType; };
7224 + void resolveSprmProps(Sprm & rSprm);
7227 +typedef boost::shared_ptr< TblStylePrHandler > TblStylePrHandlerPtr;
7232 diff --git writerfilter/source/dmapper/makefile.mk writerfilter/source/dmapper/makefile.mk
7233 index 012b45d..5f42164 100644
7234 --- writerfilter/source/dmapper/makefile.mk
7235 +++ writerfilter/source/dmapper/makefile.mk
7236 @@ -43,6 +43,9 @@ ENABLE_EXCEPTIONS=TRUE
7237 # --- Files -------------------------------------
7239 SLOFILES= $(SLO)$/BorderHandler.obj \
7240 + $(SLO)$/TblStylePrHandler.obj \
7241 + $(SLO)$/GraphicHelpers.obj \
7242 + $(SLO)$/TablePropertiesHandler.obj \
7243 $(SLO)$/CellColorHandler.obj \
7244 $(SLO)$/CellMarginHandler.obj \
7245 $(SLO)$/SectionColumnHandler.obj \
7246 @@ -60,9 +63,11 @@ SLOFILES= $(SLO)$/BorderHandler.obj \
7247 $(SLO)$/PropertyIds.obj \
7248 $(SLO)$/StyleSheetTable.obj \
7249 $(SLO)$/TDefTableHandler.obj \
7250 - $(SLO)$/ThemeTable.obj \
7251 + $(SLO)$/ThemeTable.obj \
7252 + $(SLO)$/SettingsTable.obj \
7253 $(SLO)$/ModelEventListener.obj\
7254 - $(SLO)$/OLEHandler.obj
7255 + $(SLO)$/OLEHandler.obj \
7256 + $(SLO)$/PageBordersHandler.obj
7258 # --- Targets ----------------------------------
7260 diff --git writerfilter/source/ooxml/OOXMLDocumentImpl.cxx writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
7261 index 542cf81..41a3e6c 100644
7262 --- writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
7263 +++ writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
7264 @@ -48,7 +48,7 @@ using namespace ::std;
7266 OOXMLDocumentImpl::OOXMLDocumentImpl
7267 (OOXMLStream::Pointer_t pStream)
7268 -: mpStream(pStream), mXNoteType(0)
7269 +: mpStream(pStream), mXNoteType(0), mbIsSubstream( false )
7273 @@ -138,6 +138,7 @@ OOXMLDocumentImpl::getSubStream(const rtl::OUString & rId)
7274 writerfilter::Reference<Stream>::Pointer_t pRet( pTemp = new OOXMLDocumentImpl(pStream) );
7275 pTemp->setModel(mxModel);
7276 pTemp->setShapes(mxShapes);
7277 + pTemp->setIsSubstream( true );
7281 @@ -317,6 +318,7 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
7282 pDocHandler->setStream(&rStream);
7283 pDocHandler->setDocument(this);
7284 pDocHandler->setXNoteId(msXNoteId);
7285 + pDocHandler->setIsSubstream( mbIsSubstream );
7286 uno::Reference < xml::sax::XFastDocumentHandler > xDocumentHandler
7288 uno::Reference < xml::sax::XFastTokenHandler > xTokenHandler
7289 diff --git writerfilter/source/ooxml/OOXMLDocumentImpl.hxx writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
7290 index 7d736b3..5f8cad7 100644
7291 --- writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
7292 +++ writerfilter/source/ooxml/OOXMLDocumentImpl.hxx
7293 @@ -53,6 +53,8 @@ class OOXMLDocumentImpl : public OOXMLDocument
7294 uno::Reference<frame::XModel> mxModel;
7295 uno::Reference<drawing::XShapes> mxShapes;
7297 + bool mbIsSubstream;
7300 virtual void resolveFastSubStream(Stream & rStream,
7301 OOXMLStream::StreamType_t nType);
7302 @@ -69,6 +71,8 @@ protected:
7304 const rtl::OUString & rNoteId);
7306 + void setIsSubstream( bool bSubstream ) { mbIsSubstream = bSubstream; };
7309 OOXMLDocumentImpl(OOXMLStream::Pointer_t pStream);
7310 virtual ~OOXMLDocumentImpl();
7311 diff --git writerfilter/source/ooxml/OOXMLFastContextHandler.cxx writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
7312 index c6e81d5..5e168cd 100644
7313 --- writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
7314 +++ writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
7315 @@ -752,6 +752,7 @@ void OOXMLFastContextHandler::setLastParagraphInSection()
7318 mpParserState->setLastParagraphInSection(true);
7319 + mpStream->markLastParagraphInSection( );
7322 void OOXMLFastContextHandler::newProperty
7323 @@ -1869,6 +1870,16 @@ void OOXMLFastContextHandlerTextTable::lcl_startFastElement
7324 throw (uno::RuntimeException, xml::sax::SAXException)
7328 + boost::shared_ptr<OOXMLPropertySet> pProps( new OOXMLPropertySetImpl );
7330 + OOXMLValue::Pointer_t pVal
7331 + (new OOXMLIntegerValue(mnTableDepth));
7332 + OOXMLProperty::Pointer_t pProp
7333 + (new OOXMLPropertyImpl(NS_ooxml::LN_tblStart, pVal, OOXMLPropertyImpl::SPRM));
7334 + pProps->add(pProp);
7336 + mpParserState->setCharacterProperties(pProps);
7338 startAction(Element);
7340 @@ -1954,7 +1965,7 @@ void SAL_CALL ShapesNoAdd::remove(const uno::Reference< drawing::XShape > & xSha
7342 OOXMLFastContextHandlerShape::OOXMLFastContextHandlerShape
7343 (OOXMLFastContextHandler * pContext)
7344 -: OOXMLFastContextHandlerProperties(pContext)
7345 +: OOXMLFastContextHandlerProperties(pContext), m_bShapeSent( false )
7347 uno::Reference<uno::XComponentContext> xContext(getComponentContext());
7349 @@ -2010,7 +2021,9 @@ void OOXMLFastContextHandlerShape::lcl_startFastElement
7350 startAction(Element);
7352 if (mrShapeContext.is())
7354 mrShapeContext->startFastElement(Element, Attribs);
7358 void SAL_CALL OOXMLFastContextHandlerShape::startUnknownElement
7359 @@ -2031,28 +2044,43 @@ void OOXMLFastContextHandlerShape::setToken(Token_t nToken)
7360 mrShapeContext->setStartToken(nToken);
7363 -void OOXMLFastContextHandlerShape::lcl_endFastElement
7365 - throw (uno::RuntimeException, xml::sax::SAXException)
7366 +void OOXMLFastContextHandlerShape::sendShape( Token_t Element )
7368 - if (mrShapeContext.is())
7369 + if ( mrShapeContext.is() && !m_bShapeSent )
7371 - mrShapeContext->endFastElement(Element);
7373 uno::Reference<drawing::XShape> xShape(mrShapeContext->getShape());
7377 - awt::Point aPoint(xShape->getPosition());
7378 - awt::Size aSize(xShape->getSize());
7380 OOXMLValue::Pointer_t
7381 pValue(new OOXMLShapeValue(xShape));
7382 newProperty(NS_ooxml::LN_shape, pValue);
7383 + m_bShapeSent = true;
7385 + bool bIsPicture = Element == ( NS_picture | OOXML_pic );
7387 + // Notify the dmapper that the shape is ready to use
7388 + if ( !bIsPicture )
7389 + mpStream->startShape( xShape );
7394 +void OOXMLFastContextHandlerShape::lcl_endFastElement
7396 + throw (uno::RuntimeException, xml::sax::SAXException)
7398 + if (mrShapeContext.is())
7400 + mrShapeContext->endFastElement(Element);
7401 + sendShape( Element );
7404 OOXMLFastContextHandlerProperties::lcl_endFastElement(Element);
7406 + // Ending the shape should be the last thing to do
7407 + bool bIsPicture = Element == ( NS_picture | OOXML_pic );
7408 + if ( !bIsPicture )
7409 + mpStream->endShape( );
7412 void SAL_CALL OOXMLFastContextHandlerShape::endUnknownElement
7413 @@ -2093,6 +2121,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
7414 pWrapper->addNamespace(NS_wordprocessingml);
7415 pWrapper->addNamespace(NS_vml_wordprocessingDrawing);
7416 pWrapper->addNamespace(NS_office);
7417 + pWrapper->addToken( NS_vml|OOXML_textbox );
7419 xContextHandler.set(pWrapper);
7421 @@ -2100,6 +2129,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
7422 xContextHandler.set(this);
7427 return xContextHandler;
7429 @@ -2209,6 +2239,11 @@ void OOXMLFastContextHandlerWrapper::addNamespace(const Id & nId)
7430 mMyNamespaces.insert(nId);
7433 +void OOXMLFastContextHandlerWrapper::addToken( Token_t Token )
7435 + mMyTokens.insert( Token );
7438 void OOXMLFastContextHandlerWrapper::lcl_startFastElement
7440 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
7441 @@ -2253,7 +2288,9 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
7442 debug_logger->endElement("Wrapper-createChildContext");
7445 - if (mMyNamespaces.find(nNameSpace) != mMyNamespaces.end())
7446 + bool bInNamespaces = mMyNamespaces.find(nNameSpace) != mMyNamespaces.end();
7447 + bool bInTokens = mMyTokens.find( Element ) != mMyTokens.end( );
7448 + if ( bInNamespaces )
7449 xResult.set(createFromStart(Element, Attribs));
7450 else if (mxContext.is())
7452 @@ -2266,6 +2303,12 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
7459 + OOXMLFastContextHandlerShape* pShapeCtx = (OOXMLFastContextHandlerShape*)mpParent;
7460 + pShapeCtx->sendShape( Element );
7465 diff --git writerfilter/source/ooxml/OOXMLFastContextHandler.hxx writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
7466 index 33ad4b4..0958671 100644
7467 --- writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
7468 +++ writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
7469 @@ -558,6 +558,9 @@ protected:
7471 class OOXMLFastContextHandlerShape: public OOXMLFastContextHandlerProperties
7474 + bool m_bShapeSent;
7477 explicit OOXMLFastContextHandlerShape
7478 (OOXMLFastContextHandler * pContext);
7479 @@ -585,6 +588,9 @@ public:
7480 virtual void setToken(Token_t nToken);
7482 virtual ResourceEnum_t getResource() const { return SHAPE; }
7484 + void sendShape( Token_t Element );
7487 typedef uno::Reference<XFastShapeContextHandler> ShapeContextRef;
7488 ShapeContextRef mrShapeContext;
7489 @@ -649,6 +655,7 @@ public:
7490 virtual ResourceEnum_t getResource() const;
7492 void addNamespace(const Id & nId);
7493 + void addToken( Token_t Element );
7495 virtual void newProperty(const Id & rId, OOXMLValue::Pointer_t pVal);
7496 virtual void setPropertySet(OOXMLPropertySet::Pointer_t pPropertySet);
7497 @@ -683,6 +690,7 @@ protected:
7499 uno::Reference<XFastContextHandler> mxContext;
7500 set<Id> mMyNamespaces;
7501 + set<Token_t> mMyTokens;
7502 OOXMLPropertySet::Pointer_t mpPropertySet;
7504 OOXMLFastContextHandler * getFastContextHandler() const;
7505 diff --git writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
7506 index 2557387..71a0065 100644
7507 --- writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
7508 +++ writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx
7509 @@ -225,4 +225,9 @@ void OOXMLFastDocumentHandler::setXNoteId(const ::rtl::OUString & rXNoteId)
7510 msXNoteId = rXNoteId;
7513 +void OOXMLFastDocumentHandler::setIsSubstream( bool bSubstream )
7515 + getContextHandler( )->getParserState( )->setInSectionGroup( bSubstream );
7519 diff --git writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
7520 index c7dfefe..b8ed9a5 100644
7521 --- writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
7522 +++ writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx
7523 @@ -100,6 +100,8 @@ public:
7525 OOXMLParserState::Pointer_t getParserState() const;
7527 + void setIsSubstream( bool bSubstream );
7530 OOXMLFastDocumentHandler(OOXMLFastDocumentHandler &); // not defined
7531 void operator =(OOXMLFastDocumentHandler &); // not defined
7532 diff --git writerfilter/source/ooxml/makefile.mk writerfilter/source/ooxml/makefile.mk
7533 index 29df82f..35f7db7 100644
7534 --- writerfilter/source/ooxml/makefile.mk
7535 +++ writerfilter/source/ooxml/makefile.mk
7536 @@ -151,6 +151,8 @@ OOXMLGPERFFASTTOKENXSL=gperffasttokenhandler.xsl
7538 OOXMLRESOURCEIDSHXX=$(OOXMLHXXOUTDIR)$/resourceids.hxx
7540 +NSPROCESS=namespace_preprocess.pl
7542 TOKENXML=$(OOXMLCXXOUTDIR)$/token.xml
7543 TOKENXMLTMP=$(OOXMLCXXOUTDIR)$/token.tmp
7545 @@ -162,6 +164,7 @@ OOXMLVALUESHXX=$(OOXMLCXXOUTDIR)$/OOXMLvalues.hxx
7546 OOXMLVALUESCXX=$(OOXMLCXXOUTDIR)$/OOXMLvalues.cxx
7547 GPERFFASTTOKENHXX=$(OOXMLHXXOUTDIR)$/gperffasttoken.hxx
7548 MODELPROCESSED=$(MISC)$/model_preprocessed.xml
7549 +NSXSL=$(MISC)$/namespacesmap.xsl
7552 $(OOXMLFASTRESOURCESHXX) \
7553 @@ -192,8 +195,12 @@ $(TOKENXMLTMP): $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/token.txt
7554 $(TOKENXML): tokenxmlheader $(TOKENXMLTMP) tokenxmlfooter
7555 $(TYPE) tokenxmlheader $(TOKENXMLTMP) tokenxmlfooter > $@
7557 -$(MODELPROCESSED): $(OOXMLPREPROCESSXSL) $(OOXMLMODEL)
7558 - $(XSLTPROC) $(OOXMLPREPROCESSXSL) $(OOXMLMODEL) > $@
7559 +$(NSXSL) : $(OOXMLMODEL) $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/namespaces.txt $(OOXMLPREPROCESSXSL) $(NSPROCESS)
7560 + $(PERL) $(NSPROCESS) $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/namespaces.txt $(PWD)$/$(OOXMLPREPROCESSXSL) > $@
7563 +$(MODELPROCESSED): $(NSXSL) $(OOXMLPREPROCESSXSL) $(OOXMLMODEL)
7564 + $(XSLTPROC) $(NSXSL) $(OOXMLMODEL) > $@
7566 $(OOXMLHXXOUTDIRCREATED):
7567 $(MKDIRHIER) $(OOXMLHXXOUTDIR)
7568 diff --git writerfilter/source/ooxml/model.xml writerfilter/source/ooxml/model.xml
7569 index 8eadd58..7d07b6a 100644
7570 --- writerfilter/source/ooxml/model.xml
7571 +++ writerfilter/source/ooxml/model.xml
7573 <?xml version="1.0"?>
7574 <model xmlns:rng="http://relaxng.org/ns/structure/1.0">
7575 - <namespace-alias name="http://www.w3.org/XML/1998/namespace" alias="xml" id="1"/>
7576 - <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships" alias="relationships" id="3"/>
7577 - <namespace-alias name="urn:schemas-microsoft-com:office:office" alias="office" id="11"/>
7578 - <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" alias="theme" id="14"/>
7579 - <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" alias="wordprocessingDrawing" id="15"/>
7580 - <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/main" alias="drawingml" id="21"/>
7581 - <namespace-alias name="urn:schemas-microsoft-com:vml" alias="vml" id="24"/>
7582 - <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/picture" alias="picture" id="25"/>
7583 - <namespace-alias name="urn:schemas-microsoft-com:office:word" alias="vml_wordprocessingDrawing" id="32"/>
7584 - <namespace-alias name="http://schemas.openxmlformats.org/wordprocessingml/2006/main" alias="wordprocessingml" id="60"/>
7585 - <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/math" alias="math" id="61"/>
7586 - <namespace-alias name="http://schemas.openxmlformats.org/schemaLibrary/2006/main" alias="schemaLibrary" id="62"/>
7587 - <namespace-alias name="http://sprm" alias="sprm" id="99"/>
7588 + <namespace-alias name="http://www.w3.org/XML/1998/namespace" alias="xml" id="XML"/>
7589 + <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships" alias="relationships" id="RELATIONSHIPS"/>
7590 + <namespace-alias name="urn:schemas-microsoft-com:office:office" alias="office" id="OFFICE"/>
7591 + <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" alias="theme" id="THEME"/>
7592 + <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" alias="wordprocessingDrawing" id="DOC_DRAWINGML"/>
7593 + <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/main" alias="drawingml" id="DRAWINGML"/>
7594 + <namespace-alias name="urn:schemas-microsoft-com:vml" alias="vml" id="VML"/>
7595 + <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/picture" alias="picture" id="PICTURE"/>
7596 + <namespace-alias name="urn:schemas-microsoft-com:office:word" alias="vml_wordprocessingDrawing" id="VML_DOC"/>
7597 + <namespace-alias name="http://schemas.openxmlformats.org/wordprocessingml/2006/main" alias="wordprocessingml" id="DOC"/>
7598 + <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/math" alias="math" id="MATH"/>
7599 + <namespace-alias name="http://schemas.openxmlformats.org/schemaLibrary/2006/main" alias="schemaLibrary" id="SML"/>
7600 + <namespace-alias name="http://sprm" alias="sprm" id="SPRM"/>
7601 <token tokenid="ooxml:shape"/>
7602 <token tokenid="ooxml:token"/>
7603 <token tokenid="ooxml:inputstream"/>
7604 <token tokenid="ooxml:trackchange"/>
7605 <token tokenid="ooxml:object"/>
7606 + <token tokenid="ooxml:tblStart"/>
7607 <namespace name="dml-stylesheet" url="http://schemas.openxmlformats.org/drawingml/2006/main" file="dml-stylesheet.rng">
7608 <start name="theme"/>
7609 <start name="themeOverride"/>
7610 @@ -6505,11 +6506,17 @@
7614 + <define name="CT_PositionOffset">
7615 + <ref name="ST_PositionOffset"/>
7617 <define name="ST_PositionOffset">
7619 <xs:documentation>Absolute Position Offset Value</xs:documentation>
7622 + <define name="CT_AlignH">
7623 + <ref name="ST_AlignH"/>
7625 <define name="ST_AlignH">
7627 <xs:documentation>Relative Horizontal Alignment Positions</xs:documentation>
7628 @@ -6553,10 +6560,10 @@
7629 <define name="CT_PosH">
7631 <element name="align">
7632 - <ref name="ST_AlignH"/>
7633 + <ref name="CT_AlignH"/>
7635 <element name="posOffset">
7636 - <ref name="ST_PositionOffset"/>
7637 + <ref name="CT_PositionOffset"/>
7640 <attribute name="relativeFrom">
7641 @@ -6564,6 +6571,9 @@
7642 <xs:documentation>Horizontal Position Relative Base</xs:documentation>
7645 + <define name="CT_AlignV">
7646 + <ref name="ST_AlignV"/>
7648 <define name="ST_AlignV">
7650 <xs:documentation>Vertical Alignment Definition</xs:documentation>
7651 @@ -6607,10 +6617,10 @@
7652 <define name="CT_PosV">
7654 <element name="align">
7655 - <ref name="ST_AlignV"/>
7656 + <ref name="CT_AlignV"/>
7658 <element name="posOffset">
7659 - <ref name="ST_PositionOffset"/>
7660 + <ref name="CT_PositionOffset"/>
7663 <attribute name="relativeFrom">
7664 @@ -6793,6 +6803,7 @@
7665 <element name="wrapTopAndBottom" tokenid="ooxml:EG_WrapType_wrapTopAndBottom"/>
7667 <resource name="ST_PositionOffset" resource="Integer" generated="yes"/>
7668 + <resource name="CT_PositionOffset" resource="IntegerValue"/>
7669 <resource name="ST_AlignH" resource="List" generated="yes">
7670 <value name="left" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_left">left</value>
7671 <value name="right" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_right">right</value>
7672 @@ -6800,6 +6811,7 @@
7673 <value name="inside" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_inside">inside</value>
7674 <value name="outside" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_outside">outside</value>
7676 + <resource name="CT_AlignH" resource="ListValue"/>
7677 <resource name="ST_RelFromH" resource="List" generated="yes">
7678 <value name="margin" tokenid="ooxml:Value_wordprocessingDrawing_ST_RelFromH_margin">margin</value>
7679 <value name="page" tokenid="ooxml:Value_wordprocessingDrawing_ST_RelFromH_page">page</value>
7680 @@ -6815,6 +6827,7 @@
7681 <element name="posOffset" tokenid="ooxml:CT_PosH_posOffset"/>
7682 <attribute name="relativeFrom" tokenid="ooxml:CT_PosH_relativeFrom"/>
7684 + <resource name="CT_AlignV" resource="ListValue"/>
7685 <resource name="ST_AlignV" resource="List" generated="yes">
7686 <value name="top" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignV_top">top</value>
7687 <value name="bottom" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignV_bottom">bottom</value>
7688 @@ -8326,8 +8339,6 @@
7689 <element name="nvPicPr" tokenid="ooxml:CT_Picture_nvPicPr"/>
7690 <element name="blipFill" tokenid="ooxml:CT_Picture_blipFill"/>
7691 <element name="spPr" tokenid="ooxml:CT_Picture_spPr"/>
7692 - <action name="start" action="mark" sendtokenid="ooxml:mark_shape" value="0"/>
7693 - <action name="end" action="mark" sendtokenid="ooxml:mark_shape" value="1"/>
7695 <resource name="pic" resource="Properties">
7696 <element name="pic" tokenid="ooxml:pic_pic"/>
7697 @@ -15471,19 +15482,19 @@
7700 <attribute name="zOrder">
7702 + <ref name="ST_PageBorderZOrder"/>
7703 <xs:documentation>Z-Ordering of Page Border</xs:documentation>
7707 <attribute name="display">
7709 + <ref name="ST_PageBorderDisplay"/>
7710 <xs:documentation>Pages to Display Page Borders</xs:documentation>
7714 <attribute name="offsetFrom">
7716 + <ref name="ST_PageBorderOffset"/>
7717 <xs:documentation>Page Border Positioning</xs:documentation>
7720 @@ -16563,15 +16574,18 @@
7724 + <define name="CT_ParaTrackChange">
7725 + <ref name="CT_TrackChange"/>
7727 <define name="EG_ParaRPrTrackChanges">
7729 <element name="ins">
7730 - <ref name="CT_TrackChange"/>
7731 + <ref name="CT_ParaTrackChange"/>
7735 <element name="del">
7736 - <ref name="CT_TrackChange"/>
7737 + <ref name="CT_ParaTrackChange"/>
7741 @@ -17550,7 +17564,7 @@
7743 <define name="CT_Cnf">
7744 <attribute name="val">
7746 + <ref name="ST_Cnf"/>
7747 <xs:documentation>Conditional Formatting Bit Mask</xs:documentation>
7750 @@ -19867,16 +19881,16 @@
7754 - <define name="CT_TblStylePr">
7755 + <define name="CT_Style_tblStylePr">
7758 <element name="pPr">
7759 - <ref name="CT_PPr"/>
7760 + <ref name="CT_PPrBase"/>
7764 <element name="rPr">
7765 - <ref name="CT_RPr"/>
7766 + <ref name="EG_RPrBase"/>
7770 @@ -19886,20 +19900,29 @@
7773 <element name="trPr">
7774 - <ref name="CT_TrPr"/>
7775 + <ref name="CT_TrPrBase"/>
7779 <element name="tcPr">
7780 - <ref name="CT_TcPr"/>
7781 + <ref name="CT_TcPrBase"/>
7785 <attribute name="type">
7787 + <ref name="ST_TblStyleOverrideType"/>
7788 <xs:documentation>Table Style Conditional Formatting Type</xs:documentation>
7791 + <define name="CT_Style_TblPr">
7792 + <ref name="CT_TblPrBase"/>
7794 + <define name="CT_Style_TrPr">
7795 + <ref name="CT_TrPrBase"/>
7797 + <define name="CT_Style_TcPr">
7798 + <ref name="CT_TcPrBase"/>
7800 <define name="ST_StyleType">
7802 <xs:documentation>Style Types</xs:documentation>
7803 @@ -19999,12 +20022,12 @@
7806 <element name="pPr">
7807 - <ref name="CT_PPr"/>
7808 + <ref name="CT_PPrBase"/>
7812 <element name="rPr">
7813 - <ref name="CT_RPr"/>
7814 + <ref name="EG_RPrBase"/>
7818 @@ -20014,17 +20037,17 @@
7821 <element name="trPr">
7822 - <ref name="CT_TrPr"/>
7823 + <ref name="CT_TrPrBase"/>
7827 <element name="tcPr">
7828 - <ref name="CT_TcPr"/>
7829 + <ref name="CT_TcPrBase"/>
7833 <element name="tblStylePr">
7834 - <ref name="CT_TblStylePr"/>
7835 + <ref name="CT_Style_tblStylePr"/>
7839 @@ -21617,6 +21640,11 @@
7840 <attribute name="author" tokenid="ooxml:CT_TrackChange_author"/>
7841 <attribute name="date" tokenid="ooxml:CT_TrackChange_date"/>
7843 + <resource name="CT_ParaTrackChange" resource="Properties">
7844 + <action name="start" action="tokenproperty"/>
7845 + <action name="start" action="propagateCharacterPropertiesAsSet" sendtokenid="ooxml:paratrackchange"/>
7846 + <action name="start" action="clearProps"/>
7848 <resource name="CT_CellMergeTrackChange" resource="Properties">
7849 <attribute name="vMerge" tokenid="ooxml:CT_CellMergeTrackChange_vMerge"/>
7850 <attribute name="vMergeOrig" tokenid="ooxml:CT_CellMergeTrackChange_vMergeOrig"/>
7851 @@ -21681,6 +21709,7 @@
7852 <action name="start" action="tokenproperty"/>
7853 <action name="start" action="propagateCharacterPropertiesAsSet" sendtokenid="ooxml:trackchange"/>
7854 <action name="start" action="clearProps"/>
7855 + <action name="end" action="mark" sendtokenid="ooxml:endtrackchange"/>
7857 <resource name="CT_NumPr" resource="Properties">
7858 <kind name="paragraph"/>
7859 @@ -21775,8 +21804,6 @@
7860 <resource name="CT_Picture" resource="Shape">
7861 <element name="movie" tokenid="ooxml:CT_Picture_movie"/>
7862 <element name="control" tokenid="ooxml:CT_Picture_control"/>
7863 - <action name="start" action="mark" sendtokenid="ooxml:mark_shape" value="0"/>
7864 - <action name="end" action="mark" sendtokenid="ooxml:mark_shape" value="1"/>
7865 <action name="end" action="sendPropertiesWithId" sendtokenid="ooxml:object"/>
7866 <action name="end" action="clearProps"/>
7868 @@ -22021,18 +22048,13 @@
7869 <resource xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" name="CT_HdrFtrRef" resource="Properties">
7870 <attribute name="type" tokenid="ooxml:CT_HdrFtrRef_type"/>
7871 <attribute name="r:id" tokenid="ooxml:CT_HdrFtrRef_id"/>
7872 - <action name="end" action="endCharacterGroup"/>
7873 - <action name="end" action="endParagraphGroup"/>
7874 <action name="end" action="handleHdrFtr"/>
7876 <resource name="EG_HdrFtrReferences" resource="Properties">
7877 <element name="headerReference" tokenid="ooxml:EG_HdrFtrReferences_headerReference"/>
7878 <element name="footerReference" tokenid="ooxml:EG_HdrFtrReferences_footerReference"/>
7880 - <resource name="CT_HdrFtr" resource="Stream">
7881 - <action name="start" action="startSectionGroup"/>
7882 - <action name="end" action="endSectionGroup"/>
7884 + <resource name="CT_HdrFtr" resource="Stream"/>
7885 <resource name="EG_SectPrContents" resource="Properties">
7886 <element name="bidi" tokenid="ooxml:EG_SectPrContents_bidi"/>
7887 <element name="cols" tokenid="ooxml:EG_SectPrContents_cols"/>
7888 @@ -22251,6 +22273,8 @@
7889 <resource name="CT_RPrOriginal" resource="Properties"/>
7890 <resource name="CT_ParaRPrOriginal" resource="Properties"/>
7891 <resource name="CT_ParaRPr" resource="Properties">
7892 + <element name="ins" tokenid="ooxml:CT_ParaRPr_ins"/>
7893 + <element name="del" tokenid="ooxml:CT_ParaRPr_del"/>
7894 <element name="rPrChange" tokenid="ooxml:CT_ParaRPr_rPrChange"/>
7896 <resource name="ST_RubyAlign" resource="List" generated="yes">
7897 @@ -22863,20 +22887,20 @@
7898 <element name="num" tokenid="ooxml:CT_Numbering_num"/>
7899 <element name="numIdMacAtCleanup" tokenid="ooxml:CT_Numbering_numIdMacAtCleanup"/>
7901 - <resource name="ST_TblStyleOverrideType" resource="List" generated="yes">
7902 - <value name="wholeTable" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_wholeTable">wholeTable</value>
7903 - <value name="firstRow" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_firstRow">firstRow</value>
7904 - <value name="lastRow" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_lastRow">lastRow</value>
7905 - <value name="firstCol" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_firstCol">firstCol</value>
7906 - <value name="lastCol" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_lastCol">lastCol</value>
7907 - <value name="band1Vert" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_band1Vert">band1Vert</value>
7908 - <value name="band2Vert" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_band2Vert">band2Vert</value>
7909 - <value name="band1Horz" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_band1Horz">band1Horz</value>
7910 - <value name="band2Horz" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_band2Horz">band2Horz</value>
7911 - <value name="neCell" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_neCell">neCell</value>
7912 - <value name="nwCell" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_nwCell">nwCell</value>
7913 - <value name="seCell" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_seCell">seCell</value>
7914 - <value name="swCell" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_swCell">swCell</value>
7915 + <resource name="ST_TblStyleOverrideType" resource="List">
7916 + <value tokenid="1">wholeTable</value>
7917 + <value tokenid="2">firstRow</value>
7918 + <value tokenid="3">lastRow</value>
7919 + <value tokenid="4">firstCol</value>
7920 + <value tokenid="5">lastCol</value>
7921 + <value tokenid="6">band1Vert</value>
7922 + <value tokenid="7">band2Vert</value>
7923 + <value tokenid="8">band1Horz</value>
7924 + <value tokenid="9">band2Horz</value>
7925 + <value tokenid="10">neCell</value>
7926 + <value tokenid="11">nwCell</value>
7927 + <value tokenid="12">seCell</value>
7928 + <value tokenid="13">swCell</value>
7930 <resource name="ST_StyleType" resource="List">
7931 <value tokenid="1">paragraph</value>
7932 @@ -22884,6 +22908,14 @@
7933 <value tokenid="3">table</value>
7934 <value tokenid="4">numbering</value>
7936 + <resource name="CT_Style_tblStylePr" resource="Properties">
7937 + <element name="pPr" tokenid="ooxml:CT_PPrBase"/>
7938 + <element name="rPr" tokenid="ooxml:EG_RPrBase"/>
7939 + <element name="tblPr" tokenid="ooxml:CT_TblPrBase"/>
7940 + <element name="trPr" tokenid="ooxml:CT_TrPrBase"/>
7941 + <element name="tcPr" tokenid="ooxml:CT_TcPrBase"/>
7942 + <attribute name="type" tokenid="ooxml:CT_TblStyleOverrideType"/>
7944 <resource name="CT_Style" resource="Properties">
7945 <element name="name" tokenid="ooxml:CT_Style_name"/>
7946 <element name="aliases" tokenid="ooxml:CT_Style_aliases"/>
7947 diff --git writerfilter/source/ooxml/modelpreprocess.xsl writerfilter/source/ooxml/modelpreprocess.xsl
7948 index 51efa93..90376fc 100644
7949 --- writerfilter/source/ooxml/modelpreprocess.xsl
7950 +++ writerfilter/source/ooxml/modelpreprocess.xsl
7952 <xsl:apply-templates/>
7956 \ No newline at end of file
7958 diff --git writerfilter/source/ooxml/namespace_preprocess.pl writerfilter/source/ooxml/namespace_preprocess.pl
7959 new file mode 100644
7960 index 0000000..f354cdb
7962 +++ writerfilter/source/ooxml/namespace_preprocess.pl
7964 +$ARGV0 = shift @ARGV;
7965 +$ARGV1 = shift @ARGV;
7968 +<?xml version="1.0"?>
7969 +<xsl:stylesheet version="1.0"
7970 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
7971 + <xsl:output method="xml"/>
7973 + <xsl:include href="$ARGV1"/>
7975 + <xsl:template match="namespace-alias[\@id]">
7976 + <xsl:variable name="value">
7977 + <xsl:call-template name="getnamespaceid">
7978 + <xsl:with-param name="id" select="\@id" />
7979 + </xsl:call-template>
7982 + <xsl:apply-templates select="@*"/>
7983 + <xsl:attribute name="id">
7984 + <xsl:value-of select="\$value"/>
7989 + <xsl:template name="getnamespaceid">
7990 + <xsl:param name='id'/>
7995 +# print the mapping
7996 +open ( NAMESPACES, $ARGV0 ) || die "can't open namespace file: $!";
7999 +while ( <NAMESPACES> )
8003 + if ( $_ =~ m/^$/ )
8005 + # Start a new group
8009 + elsif ( $_ =~ m/^[^#]/ )
8011 + # Neither an empty line nor a comment
8012 + $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Invalid namespace token $_";
8014 + $no = $group*10 + $i;
8016 + <xsl:when test="\$id = '$_'">
8017 + <xsl:text>$no</xsl:text>
8030 diff --git writerfilter/source/ooxml/resourcestools.xsl writerfilter/source/ooxml/resourcestools.xsl
8031 index 9b17e4d..7296cbd 100644
8032 --- writerfilter/source/ooxml/resourcestools.xsl
8033 +++ writerfilter/source/ooxml/resourcestools.xsl
8035 match="rng:define" use="ancestor::rng:grammar/@application"/>
8037 <xsl:key name="namespace-aliases" match="//namespace-alias" use="@name"/>
8039 + <!-- Tiny template helping devs to debug -->
8040 + <xsl:template name="dbg_path">
8041 + <xsl:text>/*</xsl:text>
8042 + <xsl:for-each select="ancestor::*">
8043 + <xsl:value-of select="name(.)"/>
8044 + <xsl:text>/</xsl:text>
8046 + <xsl:value-of select="name(.)"/>
8047 + <xsl:text>[@name=</xsl:text>
8048 + <xsl:value-of select="@name"/>
8049 + <xsl:text>]</xsl:text>
8050 + <xsl:text>*/</xsl:text>
8053 <xsl:template name="licenseheader">
8055 @@ -398,7 +412,7 @@ public:
8056 Generate switch body for createFastChildContext
8058 <xsl:template name="switchbodycreatechildcontext">
8059 - <xsl:for-each select=".//rng:element[@name]">
8060 + <xsl:for-each select=".//rng:element[@name]">
8061 <xsl:call-template name="caselabelfasttoken"/>
8062 <xsl:variable name="createstatement">
8063 <xsl:call-template name="fastelementcreatestatement"/>
8064 @@ -1543,6 +1557,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
8069 + <xsl:template name="fastcharactersstringvalue">
8072 + msValue = sText;</xsl:text>
8075 <xsl:template name="fastattributesstringvalue">
8076 <xsl:for-each select=".//rng:attribute">
8077 @@ -1555,6 +1575,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
8078 <xsl:text>);</xsl:text>
8082 + <xsl:template name="fastcharactersintvalue">
8085 + mnValue = sText.toInt32();</xsl:text>
8088 <xsl:template name="fastattributesintvalue">
8089 <xsl:for-each select=".//rng:attribute">
8090 @@ -1568,6 +1594,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
8094 + <xsl:template name="fastcharactershexvalue">
8097 + mnValue = sText.toInt32(16);</xsl:text>
8100 <xsl:template name="fastattributeshexvalue">
8101 <xsl:for-each select=".//rng:attribute">
8103 @@ -1580,6 +1612,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
8107 + <xsl:template name="fastcharactersboolvalue">
8110 + setValue( sText );</xsl:text>
8113 <xsl:template name="fastattributesboolvalue">
8114 <xsl:for-each select=".//rng:attribute">
8116 @@ -1592,6 +1630,35 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
8120 + <xsl:template name="fastcharacterslistvalue">
8121 + <xsl:variable name="bodywithns">
8122 + <xsl:for-each select="rng:ref">
8123 + <xsl:variable name="refname" select="@name"/>
8124 + <xsl:variable name="refns">
8125 + <xsl:call-template name="searchdefinenamespace">
8126 + <xsl:with-param name="name" select="@name"/>
8127 + </xsl:call-template>
8129 + <xsl:variable name="valname">
8130 + <xsl:for-each select="/model/namespace[@name=substring-before($refns, ':')]">
8131 + <xsl:for-each select="./rng:grammar/rng:define[@name=substring-after($refns, ':')]">
8132 + <xsl:call-template name="valuenamefordefine"/>
8137 + mpValue = OOXMLValue::Pointer_t (new </xsl:text>
8138 + <xsl:value-of select="$valname"/>
8139 + <xsl:text>( sText ) );</xsl:text>
8142 + <xsl:if test="string-length($bodywithns) > 0">
8145 + <xsl:value-of select="$bodywithns"/>
8149 <xsl:template name="fastattributeslistvalue">
8150 <xsl:for-each select=".//rng:attribute">
8151 <xsl:variable name="myfasttoken">
8152 @@ -1739,9 +1806,9 @@ void </xsl:text>
8158 <xsl:template name="fastelementcreatestatement">
8159 - <xsl:for-each select=".//rng:ref">
8160 + <xsl:for-each select=".//rng:ref">
8162 <xsl:when test="@name='BUILT_IN_ANY_TYPE'">
8163 <xsl:text>createFromStart(Element, Attribs)</xsl:text>
8164 @@ -1999,6 +2066,29 @@ void </xsl:text>
8166 <xsl:template name="fastcharactersbody">
8167 <xsl:variable name="name" select="@name"/>
8168 + <!-- ST values as text -->
8169 + <xsl:variable name="resource">
8170 + <xsl:call-template name="contextresource"/>
8173 + <xsl:when test="$resource = 'StringValue'">
8174 + <xsl:call-template name="fastcharactersstringvalue"/>
8176 + <xsl:when test="$resource = 'IntegerValue'">
8177 + <xsl:call-template name="fastcharactersintvalue"/>
8179 + <xsl:when test="$resource = 'HexValue'">
8180 + <xsl:call-template name="fastcharactershexvalue"/>
8182 + <xsl:when test="$resource = 'BooleanValue'">
8183 + <xsl:call-template name="fastcharactersboolvalue"/>
8185 + <xsl:when test="$resource = 'ListValue'">
8186 + <xsl:call-template name="fastcharacterslistvalue"/>
8190 + <!-- characters action -->
8191 <xsl:for-each select="ancestor::namespace/resource[@name = $name]//action[@name='characters']">
8192 <xsl:call-template name="chooseaction"/>
8194 diff --git writerfilter/source/resourcemodel/TagLogger.cxx writerfilter/source/resourcemodel/TagLogger.cxx
8195 index ff23dfc..97f3f28 100644
8196 --- writerfilter/source/resourcemodel/TagLogger.cxx
8197 +++ writerfilter/source/resourcemodel/TagLogger.cxx
8198 @@ -273,7 +273,7 @@ namespace writerfilter
8200 fileName += "/writerfilter.";
8202 - fileName += ".tmp";
8203 + fileName += ".xml";
8205 ofstream dumpStream(fileName.c_str());
8206 aIt->second->output(dumpStream);
8207 diff --git writerfilter/source/resourcemodel/WW8Analyzer.cxx writerfilter/source/resourcemodel/WW8Analyzer.cxx
8208 index 0bcf198..a3d70cf 100644
8209 --- writerfilter/source/resourcemodel/WW8Analyzer.cxx
8210 +++ writerfilter/source/resourcemodel/WW8Analyzer.cxx
8211 @@ -168,6 +168,14 @@ void WW8Analyzer::info(const string & /*info*/)
8215 +void WW8Analyzer::startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > /*xShape*/ )
8219 +void WW8Analyzer::endShape( )
8223 void WW8Analyzer::dumpStats(ostream & o) const
8226 diff --git writerfilter/source/resourcemodel/WW8Analyzer.hxx writerfilter/source/resourcemodel/WW8Analyzer.hxx
8227 index e437ed9..763d531 100644
8228 --- writerfilter/source/resourcemodel/WW8Analyzer.hxx
8229 +++ writerfilter/source/resourcemodel/WW8Analyzer.hxx
8230 @@ -92,6 +92,8 @@ public:
8231 virtual void substream(Id name,
8232 writerfilter::Reference<Stream>::Pointer_t ref);
8233 virtual void info(const string & info);
8234 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
8235 + virtual void endShape( );
8237 void dumpStats(ostream & o) const;
8239 diff --git writerfilter/source/resourcemodel/resourcemodel.cxx writerfilter/source/resourcemodel/resourcemodel.cxx
8240 index 7b4bdf8..d0ae060 100644
8241 --- writerfilter/source/resourcemodel/resourcemodel.cxx
8242 +++ writerfilter/source/resourcemodel/resourcemodel.cxx
8243 @@ -266,6 +266,16 @@ void WW8StreamHandler::endCharacterGroup()
8245 output.addItem("</character-group>");
8248 +void WW8StreamHandler::startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > /*xShape*/ )
8250 + output.addItem("<shape>");
8253 +void WW8StreamHandler::endShape( )
8255 + output.addItem( "</shape>" );
8258 void WW8StreamHandler::text(const sal_uInt8 * data, size_t len)
8260 diff --git writerfilter/source/resourcemodel/resourcemodel.hxx writerfilter/source/resourcemodel/resourcemodel.hxx
8261 index eb2a2a4..14c73f0 100644
8262 --- writerfilter/source/resourcemodel/resourcemodel.hxx
8263 +++ writerfilter/source/resourcemodel/resourcemodel.hxx
8264 @@ -50,6 +50,9 @@ public:
8265 virtual void props(writerfilter::Reference<Properties>::Pointer_t ref);
8266 virtual void table(Id name,
8267 writerfilter::Reference<Table>::Pointer_t ref);
8269 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
8270 + virtual void endShape( );
8272 virtual void substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref);