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 -// ----------------------------------------------------------------------------
91 -// defines for tokens with specific namespaces, can be used in switch/cases
92 -#define A_TOKEN( token ) (::oox::NMSP_DRAWINGML | XML_##token)
93 -#define AX_TOKEN( token ) (::oox::NMSP_AX | XML_##token)
94 -#define C_TOKEN( token ) (::oox::NMSP_CHART | XML_##token)
95 -#define O_TOKEN( token ) (::oox::NMSP_OFFICE | XML_##token)
96 -#define PPT_TOKEN( token ) (::oox::NMSP_PPT | XML_##token)
97 -#define R_TOKEN( token ) (::oox::NMSP_RELATIONSHIPS | XML_##token)
98 -#define VML_TOKEN( token ) (::oox::NMSP_VML | XML_##token)
99 -#define VMLX_TOKEN( token ) (::oox::NMSP_VML_XLS | XML_##token)
100 -#define XDR_TOKEN( token ) (::oox::NMSP_XDR | XML_##token)
101 -#define XLS_TOKEN( token ) (::oox::NMSP_XLS | XML_##token)
102 -#define XM_TOKEN( token ) (::oox::NMSP_XM | XML_##token)
103 -#define XML_TOKEN( token ) (::oox::NMSP_XML | XML_##token)
105 -// ============================================================================
109 -#endif // OOX_CORE_NAMESPACES_HXX
111 diff --git oox/prj/d.lst oox/prj/d.lst
112 index 50ec059..2c9d8d5 100644
115 @@ -18,6 +18,7 @@ mkdir: %_DEST%\inc%_EXT%\oox\vml
116 ..\%__SRC%\inc\tokens.hxx %_DEST%\inc%_EXT%\oox\core\tokens.hxx
118 ..\source\token\tokens.txt %_DEST%\inc%_EXT%\oox\token.txt
119 +..\source\token\namespaces.txt %_DEST%\inc%_EXT%\oox\namespaces.txt
120 ..\inc\oox\dllapi.h %_DEST%\inc%_EXT%\oox\dllapi.h
121 ..\inc\oox\helper\binarystreambase.hxx %_DEST%\inc%_EXT%\oox\helper\binarystreambase.hxx
122 ..\inc\oox\helper\helper.hxx %_DEST%\inc%_EXT%\oox\helper\helper.hxx
123 diff --git oox/source/core/filterbase.cxx oox/source/core/filterbase.cxx
124 index c5b4233..f2f9ef0 100644
125 --- oox/source/core/filterbase.cxx
126 +++ oox/source/core/filterbase.cxx
127 @@ -600,7 +600,7 @@ sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rMediaDes
129 setMediaDescriptor( rMediaDescSeq );
130 DocumentOpenedGuard aOpenedGuard( mxImpl->maFileUrl );
131 - if( aOpenedGuard.isValid() )
132 + if( aOpenedGuard.isValid() || !mxImpl->maFileUrl.getLength() )
134 mxImpl->initializeFilter();
135 switch( mxImpl->meDirection )
136 diff --git oox/source/shape/ShapeContextHandler.cxx oox/source/shape/ShapeContextHandler.cxx
137 index e57decf..71c2558 100644
138 --- oox/source/shape/ShapeContextHandler.cxx
139 +++ oox/source/shape/ShapeContextHandler.cxx
141 #include "oox/vml/vmlshapecontainer.hxx"
142 #include "tokens.hxx"
146 +using namespace std;
149 namespace oox { namespace shape {
151 using namespace ::com::sun::star;
152 @@ -91,6 +96,9 @@ ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element )
153 uno::Reference<xml::sax::XFastContextHandler>
154 ShapeContextHandler::getDrawingShapeContext()
157 + clog << "ShapeContextHandler::getDrawingShapeContext" << endl;
159 if (!mxDrawingFragmentHandler.is())
161 mpDrawing.reset( new oox::vml::Drawing( *mxFilterBase, mxDrawPage, oox::vml::VMLDRAWING_WORD ) );
162 @@ -110,6 +118,7 @@ ShapeContextHandler::getContextHandler()
164 switch (mnStartToken & NMSP_MASK)
168 xResult.set(getDrawingShapeContext());
170 @@ -180,6 +189,9 @@ ShapeContextHandler::createFastChildContext
171 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
172 throw (uno::RuntimeException, xml::sax::SAXException)
175 + clog << "ShapeContextHandler::createFastChildContext" << endl;
177 uno::Reference< xml::sax::XFastContextHandler > xResult;
178 uno::Reference< xml::sax::XFastContextHandler > xContextHandler(getContextHandler());
180 diff --git oox/source/token/gennamespaces.pl oox/source/token/gennamespaces.pl
182 index 0000000..1772f86
184 +++ oox/source/token/gennamespaces.pl
186 +$ARGV0 = shift @ARGV;
187 +$ARGV1 = shift @ARGV;
189 +open ( NAMESPACES, $ARGV0 ) || die "can't open namespaces file: $!";
192 +open ( HXX, ">$ARGV1" ) or die "can't open namespaces.hxx file: $!";
194 +print ( HXX "#ifndef OOX_NAMESPACES_HXX\n" );
195 +print ( HXX "#define OOX_NAMESPACES_HXX\n\n" );
196 +print ( HXX "#include <sal/types.h>\n\n" );
197 +print ( HXX "namespace oox {\n\n" );
201 +while ( <NAMESPACES> )
207 + # Start a new group
208 + print ( HXX "\n" );
212 + elsif ( $_ =~ m/^[^#]/ )
214 + # Neither an empty line nor a comment
215 + $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Invalid namespace token $_";
218 + $no = $group*10 + $i;
219 + print ( HXX "const sal_Int32 $id = $no << 16;\n" );
223 +close ( NAMESPACES );
225 +print ( HXX "\nconst sal_Int32 TOKEN_MASK = SAL_MAX_UINT16;\n" );
226 +print ( HXX "const sal_Int32 NMSP_MASK = SAL_MAX_INT16 << 16;\n" );
228 +print ( HXX "/** Returns the token identifier of the passed element without namespace. */\n" );
229 +print ( HXX "inline sal_Int32 getToken( sal_Int32 nElement ) { return nElement & TOKEN_MASK; }\n\n" );
231 +print ( HXX "/** Returns the namespace of the passed element without token identifier. */\n" );
232 +print ( HXX "inline sal_Int32 getNamespace( sal_Int32 nElement ) { return nElement & NMSP_MASK; }\n\n" );
234 +print ( HXX "// defines for tokens with specific namespaces, can be used in switch/cases\n\n" );
235 +print ( HXX "#define A_TOKEN( token ) (::oox::NMSP_DRAWINGML | XML_##token)\n" );
236 +print ( HXX "#define AX_TOKEN( token ) (::oox::NMSP_AX | XML_##token)\n" );
237 +print ( HXX "#define C_TOKEN( token ) (::oox::NMSP_CHART | XML_##token)\n" );
238 +print ( HXX "#define O_TOKEN( token ) (::oox::NMSP_OFFICE | XML_##token)\n" );
239 +print ( HXX "#define PPT_TOKEN( token ) (::oox::NMSP_PPT | XML_##token)\n" );
240 +print ( HXX "#define R_TOKEN( token ) (::oox::NMSP_RELATIONSHIPS | XML_##token)\n" );
241 +print ( HXX "#define VML_TOKEN( token ) (::oox::NMSP_VML | XML_##token)\n" );
242 +print ( HXX "#define VMLX_TOKEN( token ) (::oox::NMSP_VML_XLS | XML_##token)\n" );
243 +print ( HXX "#define XDR_TOKEN( token ) (::oox::NMSP_XDR | XML_##token)\n" );
244 +print ( HXX "#define XLS_TOKEN( token ) (::oox::NMSP_XLS | XML_##token)\n" );
245 +print ( HXX "#define XM_TOKEN( token ) (::oox::NMSP_XM | XML_##token)\n" );
246 +print ( HXX "#define XML_TOKEN( token ) (::oox::NMSP_XML | XML_##token)\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 3cce788..1aa0fed 100644
253 --- oox/source/token/makefile.mk
254 +++ oox/source/token/makefile.mk
255 @@ -51,16 +51,26 @@ SLOFILES = \
259 -$(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/propertywords.inc $(INCCOM)$/properties.hxx :
260 +$(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/propertywords.inc $(INCCOM)$/properties.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 $(AUGMENT_LIBRARY_PATH) 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 $(MISC)$/do_properties $(do_phony) : properties.txt genproperties.pl $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc
284 $(PERL) genproperties.pl properties.txt $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc && $(TOUCH) $@
285 diff --git oox/source/token/namespaces.txt oox/source/token/namespaces.txt
287 index 0000000..63ca76e
289 +++ oox/source/token/namespaces.txt
293 +PACKAGE_RELATIONSHIPS
329 +# Document properties
337 +# Other elements: used by writerfilter
339 diff --git sw/source/core/doc/docredln.cxx sw/source/core/doc/docredln.cxx
340 index 75d0dd1..ec6e88f 100644
341 --- sw/source/core/doc/docredln.cxx
342 +++ sw/source/core/doc/docredln.cxx
343 @@ -312,6 +312,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
345 SwRedline aCopy( *pNewRedl );
347 + bool bError = true;
348 _CHECK_REDLINE( this )
350 if( IsRedlineOn() && !IsShowOriginal( eRedlineMode ) &&
351 @@ -431,6 +432,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
352 pRedlineTbl->Insert( pRedl );
358 else if( (( POS_BEFORE == eCmpPos &&
359 @@ -446,6 +448,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
360 pRedlineTbl->Remove( n );
361 pRedlineTbl->Insert( pRedl );
366 else if ( POS_OUTSIDE == eCmpPos )
367 @@ -1108,7 +1111,8 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
371 - delete pNewRedl, pNewRedl = 0;
372 + // TODO Check if there is any side effect
373 + //delete pNewRedl, pNewRedl = 0;
377 @@ -1271,7 +1275,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
379 _CHECK_REDLINE( this )
381 - return 0 != pNewRedl;
382 + return ( 0 != pNewRedl ) || !bError;
385 void SwDoc::CompressRedlines()
386 diff --git sw/source/core/docnode/ndtbl.cxx sw/source/core/docnode/ndtbl.cxx
387 index b173454..1cf706f 100644
388 --- sw/source/core/docnode/ndtbl.cxx
389 +++ sw/source/core/docnode/ndtbl.cxx
390 @@ -1323,7 +1323,8 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >
391 SwTxtNode& rTxtNode = static_cast<SwTxtNode&>(rNode);
392 // setze den bei allen TextNode in der Tabelle den TableNode
394 - rTxtNode.pStartOfSection = pTblNd;
395 +// FIXME: this is setting wrong node StartOfSections in nested tables.
396 +// rTxtNode.pStartOfSection = pTblNd;
397 // remove PageBreaks/PageDesc/ColBreak
398 const SwAttrSet* pSet = rTxtNode.GetpSwAttrSet();
400 @@ -1402,7 +1403,6 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >
401 aCellNodeIdx = SwNodeIndex( *aCellNodeIdx.GetNode().EndOfSectionNode() );
405 // Section der Box zuweisen
406 pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
407 pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ );
408 diff --git sw/source/core/unocore/unocrsrhelper.cxx sw/source/core/unocore/unocrsrhelper.cxx
409 index b3d17e8..08c22ac 100644
410 --- sw/source/core/unocore/unocrsrhelper.cxx
411 +++ sw/source/core/unocore/unocrsrhelper.cxx
412 @@ -1032,9 +1032,11 @@ void makeRedline( SwPaM& rPaM,
415 SwRedline* pRedline = new SwRedline( aRedlineData, rPaM );
416 + RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( );
418 pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
419 bool bRet = pRedlineAccess->AppendRedline( pRedline, false );
420 - pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_NONE);
421 + pRedlineAccess->SetRedlineMode_intern( nPrevMode );
423 throw lang::IllegalArgumentException();
425 diff --git sw/source/core/unocore/unodraw.cxx sw/source/core/unocore/unodraw.cxx
426 index 0abfc68..a88f0a2 100644
427 --- sw/source/core/unocore/unodraw.cxx
428 +++ sw/source/core/unocore/unodraw.cxx
429 @@ -2117,6 +2117,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
430 OTextCursorHelper* pCursor = 0;
431 SwXTextPortion* pPortion = 0;
433 + SwXParagraph* pParagraph = 0;
435 pRange = reinterpret_cast< SwXTextRange * >(
436 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
437 @@ -2126,6 +2127,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
438 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
439 pPortion = reinterpret_cast< SwXTextPortion * >(
440 sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextPortion::getUnoTunnelId()) ));
441 + pParagraph = reinterpret_cast< SwXParagraph * >(
442 + sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) );
445 pDoc = pRange->GetDoc();
446 @@ -2137,6 +2140,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
448 pDoc = pPortion->GetCursor()->GetDoc();
450 + else if ( !pDoc && pParagraph && pParagraph->GetTxtNode( ) )
451 + pDoc = pParagraph->GetTxtNode( )->GetDoc( );
455 diff --git sw/source/core/unocore/unoobj2.cxx sw/source/core/unocore/unoobj2.cxx
456 index 36dd9cc..0cf7fe8 100644
457 --- sw/source/core/unocore/unoobj2.cxx
458 +++ sw/source/core/unocore/unoobj2.cxx
459 @@ -1192,6 +1192,12 @@ SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt) :
460 m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)),
463 + SwTable* pTable = SwTable::FindTable( &rTblFmt );
464 + SwTableNode* pTblNode = pTable->GetTableNode( );
465 + SwPosition aPosition( *pTblNode );
466 + SwPaM aPam( aPosition );
468 + _CreateNewBookmark( aPam );
471 SwXTextRange::~SwXTextRange()
472 diff --git sw/source/core/unocore/unotext.cxx sw/source/core/unocore/unotext.cxx
473 index 73d08d7..0373d88 100644
474 --- sw/source/core/unocore/unotext.cxx
475 +++ sw/source/core/unocore/unotext.cxx
482 using namespace ::com::sun::star;
483 using ::rtl::OUString;
485 @@ -1827,19 +1829,11 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
487 if(aStartCellPam.Start()->nNode < aEndCellPam.End()->nNode)
489 - const SwNode& rStartNode = aStartCellPam.Start()->nNode.GetNode();
490 - if(!rStartNode.IsTxtNode() ||
491 - !aEndCellPam.End()->nNode.GetNode().IsTxtNode())
493 - //start and end of the cell must be on a SwTxtNode
497 // increment on each StartNode and decrement on each EndNode
498 // we must reach zero at the end and must not go below zero
499 long nOpenNodeBlock = 0;
500 SwNodeIndex aCellIndex = aStartCellPam.Start()->nNode;
501 - while( ++aCellIndex < aEndCellPam.End()->nNode.GetIndex())
502 + while( aCellIndex < aEndCellPam.End()->nNode.GetIndex())
504 if( aCellIndex.GetNode().IsStartNode() )
506 @@ -1850,6 +1844,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
512 if( nOpenNodeBlock != 0)
514 @@ -1895,7 +1890,9 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
522 //now check if there's a need to insert another paragraph break
523 if( aEndCellPam.End()->nContent.GetIndex() < aEndCellPam.End()->nNode.GetNode().GetTxtNode()->Len())
524 @@ -1952,7 +1949,22 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
525 const beans::PropertyValue* pTableProperties = rTableProperties.getConstArray();
526 sal_Int32 nProperty = 0;
527 for( ; nProperty < rTableProperties.getLength(); ++nProperty)
528 - xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value );
532 + xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value );
534 + catch ( const uno::Exception e )
537 + std::clog << "Exception when setting property: ";
538 + std::clog << rtl::OUStringToOString( pTableProperties[nProperty].Name, RTL_TEXTENCODING_UTF8 ).getStr( );
539 + std::clog << ". Message: ";
540 + std::clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( );
541 + std::clog << std::endl;
546 //apply row properties
547 uno::Reference< table::XTableRows > xRows = xRet->getRows();
548 @@ -2009,6 +2021,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
553 //apply cell properties
554 for( nRow = 0; nRow < rCellProperties.getLength(); ++nRow)
556 @@ -2021,7 +2034,8 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
557 uno::Reference< beans::XPropertySet > xCell( pTextTable->getCellByPosition(nCell, nRow), uno::UNO_QUERY );
558 for( nProperty = 0; nProperty < nCellProperties; ++nProperty)
560 - if(aCellProperties[nProperty].Name.equalsAsciiL(
561 + const OUString& rName = aCellProperties[nProperty].Name;
562 + if( rName.equalsAsciiL(
563 RTL_CONSTASCII_STRINGPARAM ( "VerticalMerge")))
565 //determine left border position
566 @@ -2084,8 +2098,24 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
571 - xCell->setPropertyValue(aCellProperties[nProperty].Name, aCellProperties[nProperty].Value);
576 + xCell->setPropertyValue(rName, aCellProperties[nProperty].Value);
578 + catch ( const uno::Exception e )
580 + // Apply the paragraph and char properties to the cell's content
581 + uno::Reference< text::XText > xCellText( xCell, uno::UNO_QUERY );
582 + uno::Reference< text::XTextCursor > xCellCurs = xCellText->createTextCursor( );
583 + xCellCurs->gotoStart( false );
584 + xCellCurs->gotoEnd( true );
586 + uno::Reference< beans::XPropertySet > xCellTextProps( xCellCurs, uno::UNO_QUERY );
587 + xCellTextProps->setPropertyValue( rName, aCellProperties[nProperty].Value );
593 diff --git writerfilter/inc/dmapper/DomainMapper.hxx writerfilter/inc/dmapper/DomainMapper.hxx
594 index 7d16243..e0873f7 100644
595 --- writerfilter/inc/dmapper/DomainMapper.hxx
596 +++ writerfilter/inc/dmapper/DomainMapper.hxx
597 @@ -109,6 +109,9 @@ public:
598 virtual void endParagraphGroup();
599 virtual void startCharacterGroup();
600 virtual void endCharacterGroup();
601 + virtual void startShape( ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
602 + virtual void endShape( );
604 virtual void text(const sal_uInt8 * data, size_t len);
605 virtual void utext(const sal_uInt8 * data, size_t len);
606 virtual void props(writerfilter::Reference<Properties>::Pointer_t ref);
607 @@ -120,8 +123,8 @@ public:
609 void sprm( Sprm& sprm, ::boost::shared_ptr<PropertyMap> pContext, SprmType = SPRM_DEFAULT );
611 - void PushStyleSheetProperties( ::boost::shared_ptr<PropertyMap> pStyleProperties );
612 - void PopStyleSheetProperties();
613 + void PushStyleSheetProperties( ::boost::shared_ptr<PropertyMap> pStyleProperties, bool bAffectTableMngr = false );
614 + void PopStyleSheetProperties( bool bAffectTableMngr = false );
616 void PushListProperties( ::boost::shared_ptr<PropertyMap> pListProperties );
617 void PopListProperties();
618 diff --git writerfilter/inc/resourcemodel/TableData.hxx writerfilter/inc/resourcemodel/TableData.hxx
619 index 3d3076e..a43f253 100644
620 --- writerfilter/inc/resourcemodel/TableData.hxx
621 +++ writerfilter/inc/resourcemodel/TableData.hxx
622 @@ -276,6 +276,11 @@ class WRITERFILTER_DLLPUBLIC TableData
623 typedef ::std::vector<RowPointer_t> Rows;
626 + the table properties
628 + PropertiesPointer mpTableProps;
631 the data of the rows of the table
634 @@ -349,6 +354,22 @@ public:
635 mpRow->insertCellProperties(i, pProps);
638 + void insertTableProperties( PropertiesPointer pProps )
640 + if ( mpTableProps.get( ) )
641 + mpTableProps->insert( pProps );
643 + mpTableProps = pProps;
647 + Return the table properties.
649 + PropertiesPointer getTableProperties( )
651 + return mpTableProps;
655 Return number of rows in the table.
657 diff --git writerfilter/inc/resourcemodel/TableManager.hxx writerfilter/inc/resourcemodel/TableManager.hxx
658 index 54169d9..24e9aec 100644
659 --- writerfilter/inc/resourcemodel/TableManager.hxx
660 +++ writerfilter/inc/resourcemodel/TableManager.hxx
661 @@ -103,6 +103,11 @@ public:
662 @param rT end handle of cell
664 virtual void endCell(const T & rT) = 0;
666 + virtual T* getTable( )
672 template <typename T, typename PropertiesPointer>
673 @@ -151,16 +156,16 @@ class TableManager
675 properties of the current cell
677 - PropertiesPointer mpCellProps;
678 + vector< PropertiesPointer > mpCellProps;
681 properties of the current row
683 - PropertiesPointer mpRowProps;
684 + vector< PropertiesPointer > mpRowProps;
687 - properties of the current table
690 + properties of the current table: don't use them directly.
692 PropertiesPointer mpTableProps;
695 @@ -168,6 +173,7 @@ class TableManager
703 @@ -231,7 +237,6 @@ protected:
705 virtual void clearData();
710 virtual ~TableManager(){}
711 @@ -351,7 +356,7 @@ public:
712 template <typename T, typename PropertiesPointer>
713 TableManager<T, PropertiesPointer>::TableManager()
714 : mbRowEnd(false), mbInCell(false), mbCellEnd(false), mnTableDepthNew(0),
716 + mnTableDepth(0), mpInnerTable( NULL )
720 @@ -398,19 +403,30 @@ void TableManager<T, PropertiesPointer>::handle(const T & rHandle)
721 template <typename T, typename PropertiesPointer>
722 void TableManager<T, PropertiesPointer>::startLevel()
725 + std::clog << "TableManager::startLevel()" << std::endl;
727 typename TableData<T, PropertiesPointer>::Pointer_t pTableData
728 (new TableData<T, PropertiesPointer>(mTableDataStack.size()));
730 mTableDataStack.push(pTableData);
732 + PropertiesPointer pEmptyProps;
733 + cellProps( pEmptyProps );
736 template <typename T, typename PropertiesPointer>
737 void TableManager<T, PropertiesPointer>::endLevel()
740 + std::clog << "TableManager::endLevel()" << std::endl;
742 if (mpTableDataHandler.get() != NULL)
743 resolveCurrentTable();
745 mTableDataStack.pop();
747 + if ( mpCellProps.size( ) > 0 )
748 + mpCellProps.pop_back( );
751 template <typename T, typename PropertiesPointer>
752 @@ -426,12 +442,6 @@ template <typename T, typename PropertiesPointer>
753 void TableManager<T, PropertiesPointer>::endParagraphGroup()
755 sal_Int32 nTableDepthDifference = mnTableDepthNew - mnTableDepth;
756 - while (nTableDepthDifference > 0)
760 - --nTableDepthDifference;
762 while (nTableDepthDifference < 0)
765 @@ -447,14 +457,23 @@ void TableManager<T, PropertiesPointer>::endParagraphGroup()
769 - pTableData->endRow(mpRowProps);
770 - mpRowProps.reset();
771 + pTableData->endRow( mpRowProps.back( ) );
772 + mpRowProps.back( ).reset();
776 + else if ( mbInCell )
778 if (! pTableData->isCellOpen())
779 - pTableData->addCell(mCurHandle, mpCellProps);
781 + if ( mpInnerTable )
783 + pTableData->addCell( *mpInnerTable, mpCellProps.back( ) );
784 + mpInnerTable = NULL;
788 + pTableData->addCell( mCurHandle, mpCellProps.back( ) );
794 @@ -462,7 +481,8 @@ void TableManager<T, PropertiesPointer>::endParagraphGroup()
795 pTableData->endCell(mCurHandle);
798 - mpCellProps.reset();
799 + if ( mpCellProps.size( ) > 0 )
800 + mpCellProps.back().reset( );
803 template <typename T, typename PropertiesPointer>
804 @@ -538,10 +558,15 @@ void TableManager<T, PropertiesPointer>::utext(const sal_uInt8 * data, size_t le
805 template <typename T, typename PropertiesPointer>
806 void TableManager<T, PropertiesPointer>::cellProps(PropertiesPointer pProps)
808 - if(mpCellProps.get())
809 - mpCellProps->insert( pProps );
810 + if ( mpCellProps.size( ) == mTableDataStack.size( ) )
812 + if ( mpCellProps.back( ).get( ) )
813 + mpCellProps.back()->insert( pProps );
815 + mpCellProps.back( ) = pProps;
818 - mpCellProps = pProps;
819 + mpCellProps.push_back( pProps );
822 template <typename T, typename PropertiesPointer>
823 @@ -554,19 +579,24 @@ void TableManager<T, PropertiesPointer>::cellPropsByCell
824 template <typename T, typename PropertiesPointer>
825 void TableManager<T, PropertiesPointer>::insertRowProps(PropertiesPointer pProps)
827 - if( mpRowProps.get() )
828 - mpRowProps->insert( pProps );
829 + if ( mpRowProps.size( ) == ( mTableDataStack.size( ) - 1 ) )
831 + if( mpRowProps.back( ).get( ) )
832 + mpRowProps.back( )->insert( pProps );
834 + mpRowProps.back( ) = pProps;
837 - mpRowProps = pProps;
838 + mpRowProps.push_back( pProps );
841 template <typename T, typename PropertiesPointer>
842 void TableManager<T, PropertiesPointer>::insertTableProps(PropertiesPointer pProps)
844 - if( mpTableProps.get() )
845 - mpTableProps->insert( pProps );
847 - mpTableProps = pProps;
848 + typename TableData<T, PropertiesPointer>::Pointer_t
849 + pTableData = mTableDataStack.top();
851 + pTableData->insertTableProperties( pProps );
854 template <typename T, typename PropertiesPointer>
855 @@ -579,7 +609,7 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable()
857 unsigned int nRows = pTableData->getRowCount();
859 - mpTableDataHandler->startTable(nRows, pTableData->getDepth(), mpTableProps);
860 + mpTableDataHandler->startTable(nRows, pTableData->getDepth(), pTableData->getTableProperties( ) );
862 for (unsigned int nRow = 0; nRow < nRows; ++nRow)
864 @@ -602,8 +632,12 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable()
867 mpTableDataHandler->endTable();
869 + // The inner table has to be stored only if there is something in the stack
870 + // The 0 depth is the dummy table for the whole stream
871 + if ( pTableData->getDepth( ) > 1 )
872 + mpInnerTable = mpTableDataHandler->getTable( );
874 - mpTableProps.reset();
878 diff --git writerfilter/inc/resourcemodel/WW8ResourceModel.hxx writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
879 index 76c08d1..29d176f 100644
880 --- writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
881 +++ writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
884 #include <boost/shared_ptr.hpp>
885 #include <sal/types.h>
886 +#include <com/sun/star/drawing/XShape.hpp>
887 #include <com/sun/star/uno/Any.hxx>
888 #include <WriterFilterDllApi.hxx>
889 #include <resourcemodel/OutputWithDepth.hxx>
890 @@ -220,6 +221,13 @@ public:
891 virtual void endCharacterGroup() = 0;
896 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) = 0;
898 + virtual void endShape( ) = 0;
901 Receives 8-bit per character text.
903 @param data buffer containing the text
904 diff --git writerfilter/source/dmapper/BorderHandler.cxx writerfilter/source/dmapper/BorderHandler.cxx
905 index c3ed4ed..a7679a8 100644
906 --- writerfilter/source/dmapper/BorderHandler.cxx
907 +++ writerfilter/source/dmapper/BorderHandler.cxx
908 @@ -137,6 +137,8 @@ void BorderHandler::sprm(Sprm & rSprm)
909 pProperties->resolve(*this);
910 ConversionHelper::MakeBorderLine( m_nLineWidth, m_nLineType, m_nLineColor,
911 m_aBorderLines[rSprm.getId() - NS_ooxml::LN_CT_TblBorders_top], m_bOOXML );
913 + m_aFilledLines[ rSprm.getId( ) - NS_ooxml::LN_CT_TblBorders_top] = true;
917 @@ -161,7 +163,11 @@ PropertyMapPtr BorderHandler::getProperties()
918 if( m_bOOXML || m_nCurrentBorderPosition )
920 for( sal_Int32 nProp = 0; nProp < BORDER_COUNT; ++nProp)
921 - pPropertyMap->Insert( aPropNames[nProp], false, uno::makeAny( m_aBorderLines[nProp] ) );
923 + if ( m_aFilledLines[nProp] ) {
924 + pPropertyMap->Insert( aPropNames[nProp], false, uno::makeAny( m_aBorderLines[nProp] ) );
930 diff --git writerfilter/source/dmapper/BorderHandler.hxx writerfilter/source/dmapper/BorderHandler.hxx
931 index cc2c263..53fa912 100644
932 --- writerfilter/source/dmapper/BorderHandler.hxx
933 +++ writerfilter/source/dmapper/BorderHandler.hxx
934 @@ -63,6 +63,7 @@ private:
935 sal_Int32 m_nLineDistance;
938 + bool m_aFilledLines[BORDER_COUNT];
939 ::com::sun::star::table::BorderLine m_aBorderLines[BORDER_COUNT];
942 diff --git writerfilter/source/dmapper/CellColorHandler.cxx writerfilter/source/dmapper/CellColorHandler.cxx
943 index f97ee4d..fc931f4 100644
944 --- writerfilter/source/dmapper/CellColorHandler.cxx
945 +++ writerfilter/source/dmapper/CellColorHandler.cxx
946 @@ -110,6 +110,11 @@ void CellColorHandler::attribute(Id rName, Value & rVal)
950 + case NS_ooxml::LN_CT_Shd_themeFill:
951 + case NS_ooxml::LN_CT_Shd_themeFillTint:
952 + case NS_ooxml::LN_CT_Shd_themeFillShade:
956 OSL_ENSURE( false, "unknown attribute");
958 diff --git writerfilter/source/dmapper/ConversionHelper.cxx writerfilter/source/dmapper/ConversionHelper.cxx
959 index b05c771..2a04148 100644
960 --- writerfilter/source/dmapper/ConversionHelper.cxx
961 +++ writerfilter/source/dmapper/ConversionHelper.cxx
962 @@ -275,6 +275,10 @@ void MakeBorderLine( sal_Int32 nLineThickness, sal_Int32 nLineType,
964 eCodeIdx = double1;// 60 Twips for us
973 @@ -305,7 +309,8 @@ void MakeBorderLine( sal_Int32 nLineThickness, sal_Int32 nLineType,
974 /*13*/ { DOUBLE_LINE7_OUT, DOUBLE_LINE7_IN, DOUBLE_LINE7_DIST },
975 /*14*/ { DOUBLE_LINE8_OUT, DOUBLE_LINE8_IN, DOUBLE_LINE8_DIST },
976 /*15*/ { DOUBLE_LINE9_OUT, DOUBLE_LINE9_IN, DOUBLE_LINE9_DIST },
977 - /*16*/ { DOUBLE_LINE10_OUT,DOUBLE_LINE10_IN,DOUBLE_LINE10_DIST}
978 + /*16*/ { DOUBLE_LINE10_OUT,DOUBLE_LINE10_IN,DOUBLE_LINE10_DIST},
982 rToFill.Color = nLineColor;
983 diff --git writerfilter/source/dmapper/DomainMapper.cxx writerfilter/source/dmapper/DomainMapper.cxx
984 index 48a460e..173da5f 100644
985 --- writerfilter/source/dmapper/DomainMapper.cxx
986 +++ writerfilter/source/dmapper/DomainMapper.cxx
988 * for a copy of the LGPLv3 License.
990 ************************************************************************/
991 +#include "PageBordersHandler.hxx"
993 #include <dmapper/DomainMapper.hxx>
994 #include <DomainMapper_Impl.hxx>
995 #include <ConversionHelper.hxx>
996 @@ -180,6 +182,10 @@ DomainMapper::~DomainMapper()
997 uno::Reference< document::XEventBroadcaster > xBroadcaster(xIndexesSupplier, uno::UNO_QUERY);
998 xBroadcaster->addEventListener(uno::Reference< document::XEventListener >(new ModelEventListener));
1002 + // Apply the document settings after everything else
1003 + m_pImpl->GetSettingsTable()->ApplyProperties( m_pImpl->GetTextDocument( ) );
1005 catch( const uno::Exception& rEx )
1007 @@ -555,8 +561,8 @@ void DomainMapper::attribute(Id nName, Value & val)
1008 //if the style is a user defined style then it must have an ISTD - built-in styles might not have it
1009 StyleSheetTablePtr pStyleSheets = m_pImpl->GetStyleSheetTable();
1010 ::rtl::OUString sValue = ::rtl::OUString::valueOf(nIntValue, 16);
1011 - const StyleSheetEntry* pEntry = pStyleSheets->FindStyleSheetByISTD(sValue);
1013 + const StyleSheetEntryPtr pEntry = pStyleSheets->FindStyleSheetByISTD(sValue);
1014 + if( pEntry.get( ) )
1016 bool bParaStyle = (pEntry->nStyleTypeCode == STYLE_TYPE_PARA);
1018 @@ -1885,12 +1891,12 @@ void DomainMapper::attribute(Id nName, Value & val)
1019 /* WRITERFILTERSTATUS: done: 80, planned: 0.5, spent: 0.2 */
1020 //TODO: autospacing depends on some document property (called fDontUseHTMLAutoSpacing in old ww8 filter) 100 or 280 twip
1021 //and should be set to 0 on start of page
1022 - m_pImpl->GetTopContext()->Insert( PROP_TOP_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) );
1023 + m_pImpl->GetTopContext()->Insert( PROP_PARA_TOP_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) );
1025 case NS_ooxml::LN_CT_Spacing_afterAutospacing:
1026 /* WRITERFILTERSTATUS: done: 80, planned: 0.5, spent: 0.2 */
1027 //TODO: autospacing depends on some document property (called fDontUseHTMLAutoSpacing in old ww8 filter) 100 or 280 twip
1028 - m_pImpl->GetTopContext()->Insert( PROP_BOTTOM_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) );
1029 + m_pImpl->GetTopContext()->Insert( PROP_PARA_BOTTOM_MARGIN, false, uno::makeAny( AUTO_PARA_SPACING ) );
1031 case NS_ooxml::LN_CT_SmartTagRun_uri:
1032 case NS_ooxml::LN_CT_SmartTagRun_element:
1033 @@ -1929,13 +1935,6 @@ void DomainMapper::attribute(Id nName, Value & val)
1034 //afterwards the adding of the binary data.
1035 m_pImpl->GetGraphicImport( IMPORT_AS_DETECTED_INLINE )->attribute(nName, val);
1036 m_pImpl->ImportGraphic( val.getProperties(), IMPORT_AS_DETECTED_INLINE );
1037 - if( m_pImpl->IsInShapeContext() )
1039 - //imported text from temporary shape needs to be copied to the real shape
1040 - uno::Reference< drawing::XShape > xShape;
1041 - val.getAny() >>= xShape;
1042 - m_pImpl->CopyTemporaryShapeText( xShape );
1046 case NS_ooxml::LN_CT_FramePr_dropCap:
1047 @@ -2093,19 +2092,12 @@ void DomainMapper::attribute(Id nName, Value & val)
1049 case NS_ooxml::LN_CT_Markup_id:
1050 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1051 - m_pImpl->SetCurrentRedlineId( sStringValue );
1052 + m_pImpl->SetCurrentRedlineId( nIntValue );
1054 case NS_ooxml::LN_token:
1055 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1056 m_pImpl->SetCurrentRedlineToken( nIntValue );
1058 - case NS_ooxml::LN_mark_shape:
1059 - /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1061 - m_pImpl->PopShapeContext();
1063 - m_pImpl->PushShapeContext();
1065 case NS_ooxml::LN_CT_LineNumber_countBy:
1066 /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
1067 case NS_ooxml::LN_CT_LineNumber_restart:
1068 @@ -2147,6 +2139,9 @@ void DomainMapper::attribute(Id nName, Value & val)
1069 case NS_ooxml::LN_CT_Color_themeShade:
1072 + case NS_ooxml::LN_endtrackchange:
1073 + m_pImpl->RemoveCurrentRedline( );
1077 #if OSL_DEBUG_LEVEL > 0
1078 @@ -2628,6 +2623,15 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1079 break; // sprmPPropRMark
1080 case NS_sprm::LN_POutLvl:
1081 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
1083 + if( m_pImpl->IsStyleSheetImport() )
1085 + sal_Int16 nLvl = static_cast< sal_Int16 >( nIntValue );
1087 + StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
1088 + pStyleSheetPropertyMap->SetOutlineLevel( nLvl );
1091 break; // sprmPOutLvl
1092 case NS_sprm::LN_PFBiDi:
1093 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
1094 @@ -3880,6 +3884,20 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1098 + case NS_ooxml::LN_EG_SectPrContents_pgBorders:
1100 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1101 + if( pProperties.get( ) && pSectionContext )
1103 + PageBordersHandlerPtr pHandler( new PageBordersHandler );
1104 + pProperties->resolve( *pHandler );
1106 + // Set the borders to the context and apply them to the styles
1107 + pHandler->SetBorders( pSectionContext );
1108 + pSectionContext->SetBorderParams( pHandler->GetDisplayOffset( ) );
1113 case NS_ooxml::LN_CT_PPrBase_pStyle:
1115 @@ -3889,20 +3907,31 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1116 const ::rtl::OUString sConvertedStyleName = pStyleTable->ConvertStyleName( sStringValue, true );
1117 if (m_pImpl->GetTopContext() && m_pImpl->GetTopContextType() != CONTEXT_SECTION)
1118 m_pImpl->GetTopContext()->Insert( PROP_PARA_STYLE_NAME, true, uno::makeAny( sConvertedStyleName ));
1119 - const StyleSheetEntry* pEntry = pStyleTable->FindStyleSheetByISTD(sStringValue);
1120 + const StyleSheetEntryPtr pEntry = pStyleTable->FindStyleSheetByISTD(sStringValue);
1121 //apply numbering to paragraph if it was set at the style
1122 - OSL_ENSURE( pEntry, "no style sheet found" );
1123 + OSL_ENSURE( pEntry.get(), "no style sheet found" );
1124 const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0);
1126 if( pStyleSheetProperties && pStyleSheetProperties->GetListId() >= 0 )
1127 - rContext->Insert( PROP_NUMBERING_RULES, true, uno::makeAny(m_pImpl->GetListTable()->GetNumberingRules(pStyleSheetProperties->GetListId())), false);
1128 + rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny(
1129 + m_pImpl->GetListTable( )->GetStyleName( pStyleSheetProperties->GetListId( ) ) ), false);
1131 if( pStyleSheetProperties && pStyleSheetProperties->GetListLevel() >= 0 )
1132 rContext->Insert( PROP_NUMBERING_LEVEL, true, uno::makeAny(pStyleSheetProperties->GetListLevel()), false);
1135 case NS_ooxml::LN_EG_RPrBase_rStyle:
1136 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1137 - if (m_pImpl->GetTopContext())
1138 - m_pImpl->GetTopContext()->Insert( PROP_CHAR_STYLE_NAME, true, uno::makeAny( m_pImpl->GetStyleSheetTable()->ConvertStyleName( sStringValue, true )));
1140 + rtl::OUString sConvertedName( m_pImpl->GetStyleSheetTable()->ConvertStyleName( sStringValue, true ) );
1141 + // First check if the style exists in the document.
1142 + StyleSheetEntryPtr pEntry = m_pImpl->GetStyleSheetTable( )->FindStyleSheetByStyleName( sConvertedName );
1143 + bool bExists = pEntry.get( ) && ( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR );
1145 + // Add the property if the style exists
1146 + if ( bExists && m_pImpl->GetTopContext() )
1147 + m_pImpl->GetTopContext()->Insert( PROP_CHAR_STYLE_NAME, true, uno::makeAny( sConvertedName ) );
1150 case NS_ooxml::LN_CT_TblPrBase_tblCellMar: //cell margins
1151 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
1152 @@ -3970,7 +3999,7 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1153 m_pImpl->ResetGraphicImport();
1154 // todo: It's a shape, now start shape import
1160 case NS_ooxml::LN_EG_RPrBase_vertAlign:
1161 @@ -4039,16 +4068,16 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1165 + case NS_ooxml::LN_paratrackchange:
1166 + m_pImpl->StartParaChange( );
1167 case NS_ooxml::LN_trackchange:
1168 /* WRITERFILTERSTATUS: done: 100, planned: 5, spent: 0 */
1169 case NS_ooxml::LN_EG_RPrContent_rPrChange:
1170 /* WRITERFILTERSTATUS: done: 100, planned: 5, spent: 0 */
1172 + m_pImpl->AddNewRedline( );
1173 resolveSprmProps( rSprm );
1174 // now the properties author, date and id should be available
1175 - ::rtl::OUString sAuthor = m_pImpl->GetCurrentRedlineAuthor();
1176 - ::rtl::OUString sDate = m_pImpl->GetCurrentRedlineDate();
1177 - ::rtl::OUString sId = m_pImpl->GetCurrentRedlineId();
1178 sal_Int32 nToken = m_pImpl->GetCurrentRedlineToken();
1179 switch( nToken & 0xffff )
1181 @@ -4057,6 +4086,7 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1182 case ooxml::OOXML_del : break;
1183 default: OSL_ENSURE( false, "redline token other than mod, ins or del" );
1185 + m_pImpl->EndParaChange( );
1188 case NS_ooxml::LN_CT_RPrChange_rPr:
1189 @@ -4065,16 +4095,22 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1190 /* WRITERFILTERSTATUS: done: 0, planned: 4, spent: 0 */
1191 case NS_ooxml::LN_object:
1194 + clog << "DomainMapper: LN_object" << endl;
1196 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1197 - if( pProperties.get())
1198 + if( pProperties.get( ) )
1200 OLEHandlerPtr pOLEHandler( new OLEHandler );
1201 pProperties->resolve(*pOLEHandler);
1202 - ::rtl::OUString sStreamName = pOLEHandler->copyOLEOStream( m_pImpl->GetTextDocument() );
1203 - if(sStreamName.getLength())
1204 + if ( pOLEHandler->isOLEObject( ) )
1206 - m_pImpl->appendOLE( sStreamName, pOLEHandler );
1208 + ::rtl::OUString sStreamName = pOLEHandler->copyOLEOStream( m_pImpl->GetTextDocument() );
1209 + if( sStreamName.getLength() )
1211 + m_pImpl->appendOLE( sStreamName, pOLEHandler );
1217 @@ -4102,7 +4138,6 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
1218 case NS_ooxml::LN_CT_Lvl_pStyle:
1219 //TODO: numbering style should apply current numbering level - not yet supported
1224 #if OSL_DEBUG_LEVEL > 0
1225 @@ -4228,19 +4263,36 @@ void DomainMapper::endParagraphGroup()
1229 +void DomainMapper::startShape( uno::Reference< drawing::XShape > xShape )
1231 + m_pImpl->PushShapeContext( xShape );
1234 +void DomainMapper::endShape( )
1236 + m_pImpl->PopShapeContext( );
1239 /*-- 13.06.2007 16:15:55---------------------------------------------------
1241 -----------------------------------------------------------------------*/
1242 -void DomainMapper::PushStyleSheetProperties( PropertyMapPtr pStyleProperties )
1243 +void DomainMapper::PushStyleSheetProperties( PropertyMapPtr pStyleProperties, bool bAffectTableMngr )
1245 m_pImpl->PushStyleProperties( pStyleProperties );
1246 + if ( bAffectTableMngr )
1247 + m_pImpl->getTableManager( ).SetStyleProperties( pStyleProperties );
1249 /*-- 13.06.2007 16:15:55---------------------------------------------------
1251 -----------------------------------------------------------------------*/
1252 -void DomainMapper::PopStyleSheetProperties()
1253 +void DomainMapper::PopStyleSheetProperties( bool bAffectTableMngr )
1255 m_pImpl->PopProperties( CONTEXT_STYLESHEET );
1256 + if ( bAffectTableMngr )
1258 + PropertyMapPtr emptyPtr;
1259 + m_pImpl->getTableManager( ).SetStyleProperties( emptyPtr );
1262 /*-- 28.01.2008 14:52:33---------------------------------------------------
1264 @@ -4487,10 +4539,13 @@ void DomainMapper::table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
1266 case NS_ooxml::LN_NUMBERING:
1267 case NS_rtf::LN_LISTTABLE:
1268 - /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
1270 + /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
1272 - //the same for list tables
1273 - ref->resolve( *m_pImpl->GetListTable() );
1274 + //the same for list tables
1275 + ref->resolve( *m_pImpl->GetListTable() );
1276 + m_pImpl->GetListTable( )->CreateNumberingRules( );
1279 case NS_rtf::LN_LFOTABLE:
1280 /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
1281 @@ -4500,6 +4555,9 @@ void DomainMapper::table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
1282 case NS_ooxml::LN_THEMETABLE:
1283 ref->resolve ( *m_pImpl->GetThemeTable() );
1285 + case NS_ooxml::LN_SETTINGS:
1286 + ref->resolve( *m_pImpl->GetSettingsTable( ) );
1289 OSL_ENSURE( false, "which table is to be filled here?");
1291 diff --git writerfilter/source/dmapper/DomainMapperTableHandler.cxx writerfilter/source/dmapper/DomainMapperTableHandler.cxx
1292 index 8f6febe..5f2efa4 100644
1293 --- writerfilter/source/dmapper/DomainMapperTableHandler.cxx
1294 +++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx
1295 @@ -68,7 +68,22 @@ static void lcl_printProperties( PropertyMapPtr pProps )
1297 rtl::OUString aOUStr = rPropSupplier.GetName( aMapIter->first.eId );
1298 rtl::OString aOStr(aOUStr.getStr(), aOUStr.getLength(), RTL_TEXTENCODING_ASCII_US );
1299 - clog << aOStr.getStr() << '-';
1300 + clog << aOStr.getStr();
1302 + table::BorderLine aLine;
1304 + if ( aMapIter->second >>= aLine )
1306 + clog << ": BorderLine ( Color: " << aLine.Color;
1307 + clog << ", Inner: " << aLine.InnerLineWidth;
1308 + clog << ", Outer: " << aLine.OuterLineWidth << ") ";
1310 + else if ( aMapIter->second >>= nColor )
1312 + clog << ": Color ( " << nColor << " ) ";
1319 @@ -106,21 +121,121 @@ void DomainMapperTableHandler::startTable(unsigned int nRows,
1320 /*-- 22.02.2008 10:18:37---------------------------------------------------
1322 -----------------------------------------------------------------------*/
1323 -PropertyMapPtr lcl_SearchParentStyleSheetAndMergeProperties(const StyleSheetEntry* pStyleSheet, StyleSheetTablePtr pStyleSheetTable)
1324 +PropertyMapPtr lcl_SearchParentStyleSheetAndMergeProperties(const StyleSheetEntryPtr pStyleSheet, StyleSheetTablePtr pStyleSheetTable)
1326 PropertyMapPtr pRet;
1327 if( pStyleSheet->sBaseStyleIdentifier.getLength())
1329 - const StyleSheetEntry* pParentStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( pStyleSheet->sBaseStyleIdentifier );
1330 + const StyleSheetEntryPtr pParentStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( pStyleSheet->sBaseStyleIdentifier );
1331 pRet = lcl_SearchParentStyleSheetAndMergeProperties( pParentStyleSheet, pStyleSheetTable );
1335 pRet.reset( new PropertyMap );
1338 pRet->insert( pStyleSheet->pProperties, true );
1342 +void lcl_mergeBorder( PropertyIds nId, PropertyMapPtr pOrig, PropertyMapPtr pDest )
1344 + PropertyDefinition aDef( nId, false );
1345 + PropertyMap::iterator pOrigIt = pOrig->find( aDef );
1347 + if ( pOrigIt != pOrig->end( ) )
1349 + pDest->Insert( nId, false, pOrigIt->second, false );
1353 +void lcl_computeCellBorders( PropertyMapPtr pTableBorders, PropertyMapPtr pCellProps,
1354 + sal_Int32 nCell, sal_Int32 nRow, bool bIsEndCol, bool bIsEndRow )
1356 + PropertyDefinition aVertPDef( META_PROP_VERTICAL_BORDER, false );
1357 + PropertyDefinition aHorizPDef( META_PROP_HORIZONTAL_BORDER, false );
1359 + PropertyMap::iterator aVerticalIter = pCellProps->find( aVertPDef );
1360 + PropertyMap::iterator aHorizontalIter = pCellProps->find( aHorizPDef );
1362 + // Handle the vertical and horizontal borders
1363 + bool bHasVert = ( aVerticalIter != pCellProps->end( ) );
1364 + uno::Any aVertProp;
1367 + aVerticalIter = pTableBorders->find( aVertPDef );
1368 + bHasVert = ( aVerticalIter != pTableBorders->end( ) );
1370 + aVertProp = aVerticalIter->second;
1374 + aVertProp = aVerticalIter->second;
1375 + pCellProps->erase( aVerticalIter );
1378 + bool bHasHoriz = ( aHorizontalIter != pCellProps->end( ) );
1379 + uno::Any aHorizProp;
1382 + aHorizontalIter = pTableBorders->find( aHorizPDef );
1383 + bHasHoriz = ( aHorizontalIter != pTableBorders->end( ) );
1385 + aHorizProp = aHorizontalIter->second;
1389 + aHorizProp = aHorizontalIter->second;
1390 + pCellProps->erase( aHorizontalIter );
1395 + lcl_mergeBorder( PROP_LEFT_BORDER, pTableBorders, pCellProps );
1397 + pCellProps->Insert( PROP_RIGHT_BORDER, false, aVertProp, false );
1402 + lcl_mergeBorder( PROP_RIGHT_BORDER, pTableBorders, pCellProps );
1404 + pCellProps->Insert( PROP_LEFT_BORDER, false, aVertProp, false );
1407 + if ( nCell > 0 && !bIsEndCol )
1411 + pCellProps->Insert( PROP_RIGHT_BORDER, false, aVertProp, false );
1412 + pCellProps->Insert( PROP_LEFT_BORDER, false, aVertProp, false );
1418 + lcl_mergeBorder( PROP_TOP_BORDER, pTableBorders, pCellProps );
1420 + pCellProps->Insert( PROP_BOTTOM_BORDER, false, aHorizProp, false );
1425 + lcl_mergeBorder( PROP_BOTTOM_BORDER, pTableBorders, pCellProps );
1427 + pCellProps->Insert( PROP_TOP_BORDER, false, aHorizProp, false );
1430 + if ( nRow > 0 && !bIsEndRow )
1434 + pCellProps->Insert( PROP_TOP_BORDER, false, aHorizProp, false );
1435 + pCellProps->Insert( PROP_BOTTOM_BORDER, false, aHorizProp, false );
1440 void DomainMapperTableHandler::endTable()
1442 #if OSL_DEBUG_LEVEL > 1
1443 @@ -140,7 +255,7 @@ void DomainMapperTableHandler::endTable()
1446 const beans::PropertyValues aDebugTbl = m_aTableProperties->GetPropertyValues();
1447 - for( sal_Int32 nDebug = 0; nDebug < nTblPropSize; ++nDebug)
1448 + for( sal_uInt32 nDebug = 0; nDebug < nTblPropSize; ++nDebug)
1450 const ::rtl::OUString sName = aDebugTbl[nDebug].Name;
1452 @@ -148,6 +263,7 @@ void DomainMapperTableHandler::endTable()
1454 m_aTableProperties->Invalidate();
1455 sNames += ::rtl::OUString(' ');
1456 + clog << "Props: " << rtl::OUStringToOString( sNames, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
1460 @@ -156,6 +272,13 @@ void DomainMapperTableHandler::endTable()
1461 sal_Int32 nLeftBorderDistance, nRightBorderDistance, nTopBorderDistance, nBottomBorderDistance;
1462 nLeftBorderDistance = nRightBorderDistance = DEF_BORDER_DIST;
1463 nTopBorderDistance = nBottomBorderDistance = 0;
1465 + PropertyMapPtr pTableDefaults( new PropertyMap );
1466 + PropertyMapPtr pTableBorders( new PropertyMap );
1468 + // will receive the table style if any
1469 + TableStyleSheetEntry* pTableStyle = NULL;
1471 if( m_aTableProperties.get() )
1473 //create properties from the table attributes
1474 @@ -169,35 +292,31 @@ void DomainMapperTableHandler::endTable()
1475 m_aTableProperties->find( PropertyDefinition( META_PROP_TABLE_STYLE_NAME, false ) );
1476 if(aTableStyleIter != m_aTableProperties->end())
1478 - //TODO: apply table style properties recursively
1479 + // Apply table style properties recursively
1480 ::rtl::OUString sTableStyleName;
1481 aTableStyleIter->second >>= sTableStyleName;
1482 StyleSheetTablePtr pStyleSheetTable = m_rDMapper_Impl.GetStyleSheetTable();
1483 - const StyleSheetEntry* pStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( sTableStyleName );
1484 + const StyleSheetEntryPtr pStyleSheet = pStyleSheetTable->FindStyleSheetByISTD( sTableStyleName );
1485 + pTableStyle = static_cast<TableStyleSheetEntry*>( pStyleSheet.get( ) );
1486 + m_aTableProperties->erase( aTableStyleIter );
1490 - PropertyMapPtr pMergedProperties = lcl_SearchParentStyleSheetAndMergeProperties(pStyleSheet, pStyleSheetTable);
1492 - PropertyMap::const_iterator aStylePropIter =
1493 - pMergedProperties->find(PropertyDefinition( META_PROP_CELL_MAR_TOP, false ) );
1494 - if( aStylePropIter != pMergedProperties->end() )
1495 - aStylePropIter->second >>= nTopBorderDistance;
1496 + // First get the style properties, then the table ones
1497 + PropertyMapPtr pTableProps( m_aTableProperties );
1498 + TablePropertyMapPtr pEmptyProps( new TablePropertyMap );
1500 - aStylePropIter = pMergedProperties->find(PropertyDefinition( META_PROP_CELL_MAR_BOTTOM, false ) );
1501 - if( aStylePropIter != pMergedProperties->end() )
1502 - aStylePropIter->second >>= nBottomBorderDistance;
1504 - aStylePropIter = pMergedProperties->find(PropertyDefinition( META_PROP_CELL_MAR_LEFT, false ) );
1505 - if( aStylePropIter != pMergedProperties->end() )
1506 - aStylePropIter->second >>= nLeftBorderDistance;
1508 - aStylePropIter = pMergedProperties->find(PropertyDefinition( META_PROP_CELL_MAR_RIGHT, false ) );
1509 - if( aStylePropIter != pMergedProperties->end() )
1510 - aStylePropIter->second >>= nRightBorderDistance;
1511 + m_aTableProperties = pEmptyProps;
1513 + PropertyMapPtr pMergedProperties = lcl_SearchParentStyleSheetAndMergeProperties(pStyleSheet, pStyleSheetTable);
1515 + m_aTableProperties->insert( pMergedProperties );
1516 + m_aTableProperties->insert( pTableProps );
1518 - m_aTableProperties->erase( aTableStyleIter );
1521 + // Set the table default attributes for the cells
1522 + pTableDefaults->insert( m_aTableProperties );
1524 m_aTableProperties->getValue( TablePropertyMap::GAP_HALF, nGapHalf );
1525 m_aTableProperties->getValue( TablePropertyMap::LEFT_MARGIN, nLeftMargin );
1526 @@ -228,6 +347,11 @@ void DomainMapperTableHandler::endTable()
1527 aTblBorderIter->second >>= aTableBorder.TopLine;
1528 aTableBorder.IsTopLineValid = true;
1529 m_aTableProperties->erase( aTblBorderIter );
1531 + pTableBorders->Insert( PROP_TOP_BORDER, false, uno::makeAny( aTableBorder.TopLine ) );
1532 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( PROP_TOP_BORDER, false ) );
1533 + if ( pIt != pTableDefaults->end( ) )
1534 + pTableDefaults->erase( pIt );
1536 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_BOTTOM_BORDER, false) );
1537 if( aTblBorderIter != m_aTableProperties->end() )
1538 @@ -235,6 +359,11 @@ void DomainMapperTableHandler::endTable()
1539 aTblBorderIter->second >>= aTableBorder.BottomLine;
1540 aTableBorder.IsBottomLineValid = true;
1541 m_aTableProperties->erase( aTblBorderIter );
1543 + pTableBorders->Insert( PROP_BOTTOM_BORDER, false, uno::makeAny( aTableBorder.BottomLine ) );
1544 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( PROP_BOTTOM_BORDER, false ) );
1545 + if ( pIt != pTableDefaults->end( ) )
1546 + pTableDefaults->erase( pIt );
1548 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_LEFT_BORDER, false) );
1549 if( aTblBorderIter != m_aTableProperties->end() )
1550 @@ -242,6 +371,11 @@ void DomainMapperTableHandler::endTable()
1551 aTblBorderIter->second >>= aTableBorder.LeftLine;
1552 aTableBorder.IsLeftLineValid = true;
1553 m_aTableProperties->erase( aTblBorderIter );
1555 + pTableBorders->Insert( PROP_LEFT_BORDER, false, uno::makeAny( aTableBorder.LeftLine ) );
1556 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( PROP_LEFT_BORDER, false ) );
1557 + if ( pIt != pTableDefaults->end( ) )
1558 + pTableDefaults->erase( pIt );
1560 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_RIGHT_BORDER, false) );
1561 if( aTblBorderIter != m_aTableProperties->end() )
1562 @@ -249,6 +383,11 @@ void DomainMapperTableHandler::endTable()
1563 aTblBorderIter->second >>= aTableBorder.RightLine;
1564 aTableBorder.IsRightLineValid = true;
1565 m_aTableProperties->erase( aTblBorderIter );
1567 + pTableBorders->Insert( PROP_RIGHT_BORDER, false, uno::makeAny( aTableBorder.RightLine ) );
1568 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( PROP_RIGHT_BORDER, false ) );
1569 + if ( pIt != pTableDefaults->end( ) )
1570 + pTableDefaults->erase( pIt );
1572 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(META_PROP_HORIZONTAL_BORDER, false) );
1573 if( aTblBorderIter != m_aTableProperties->end() )
1574 @@ -256,6 +395,11 @@ void DomainMapperTableHandler::endTable()
1575 aTblBorderIter->second >>= aTableBorder.HorizontalLine;
1576 aTableBorder.IsHorizontalLineValid = true;
1577 m_aTableProperties->erase( aTblBorderIter );
1579 + pTableBorders->Insert( META_PROP_HORIZONTAL_BORDER, false, uno::makeAny( aTableBorder.HorizontalLine ) );
1580 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( META_PROP_HORIZONTAL_BORDER, false ) );
1581 + if ( pIt != pTableDefaults->end( ) )
1582 + pTableDefaults->erase( pIt );
1584 aTblBorderIter = m_aTableProperties->find( PropertyDefinition(META_PROP_VERTICAL_BORDER, false) );
1585 if( aTblBorderIter != m_aTableProperties->end() )
1586 @@ -263,10 +407,15 @@ void DomainMapperTableHandler::endTable()
1587 aTblBorderIter->second >>= aTableBorder.VerticalLine;
1588 aTableBorder.IsVerticalLineValid = true;
1589 m_aTableProperties->erase( aTblBorderIter );
1591 + pTableBorders->Insert( META_PROP_VERTICAL_BORDER, false, uno::makeAny( aTableBorder.VerticalLine ) );
1592 + PropertyMap::iterator pIt = pTableDefaults->find( PropertyDefinition( META_PROP_VERTICAL_BORDER, false ) );
1593 + if ( pIt != pTableDefaults->end( ) )
1594 + pTableDefaults->erase( pIt );
1596 aTableBorder.Distance = 0;
1597 aTableBorder.IsDistanceValid = false;
1600 m_aTableProperties->Insert( PROP_TABLE_BORDER, false, uno::makeAny( aTableBorder ) );
1602 m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( nLeftMargin - nGapHalf - nLeftBorderDistance));
1603 @@ -284,18 +433,26 @@ void DomainMapperTableHandler::endTable()
1604 m_aTableProperties->find( PropertyDefinition( PROP_HEADER_ROW_COUNT, false ) );
1605 if( aRepeatIter == m_aTableProperties->end() )
1606 m_aTableProperties->Insert( PROP_HEADER_ROW_COUNT, false, uno::makeAny( (sal_Int32)0 ));
1608 + // Remove the PROP_HEADER_ROW_COUNT from the table default to avoid
1609 + // propagating it to the cells
1610 + PropertyMap::iterator aDefaultRepeatIt =
1611 + pTableDefaults->find( PropertyDefinition( PROP_HEADER_ROW_COUNT, false ) );
1612 + if ( aDefaultRepeatIt != pTableDefaults->end( ) )
1613 + pTableDefaults->erase( aDefaultRepeatIt );
1615 aTableProperties = m_aTableProperties->GetPropertyValues();
1619 // expands to uno::Sequence< Sequence< beans::PropertyValues > >
1620 CellPropertyValuesSeq_t aCellProperties( m_aCellProperties.size() );
1622 // std::vector< std::vector<PropertyMapPtr> > m_aCellProperties
1623 PropertyMapVector2::const_iterator aRowOfCellsIterator = m_aCellProperties.begin();
1624 PropertyMapVector2::const_iterator aRowOfCellsIteratorEnd = m_aCellProperties.end();
1625 + PropertyMapVector2::const_iterator aLastRowIterator = m_aCellProperties.end() - 1;
1629 //it's a uno::Sequence< beans::PropertyValues >*
1630 RowPropertyValuesSeq_t* pCellProperties = aCellProperties.getArray();
1631 while( aRowOfCellsIterator != aRowOfCellsIteratorEnd )
1632 @@ -303,67 +460,72 @@ void DomainMapperTableHandler::endTable()
1633 //aRowOfCellsIterator points to a vector of PropertyMapPtr
1634 PropertyMapVector1::const_iterator aCellIterator = aRowOfCellsIterator->begin();
1635 PropertyMapVector1::const_iterator aCellIteratorEnd = aRowOfCellsIterator->end();
1637 - //contains the default border of the line
1638 - PropertyMapPtr aCellBorders( new PropertyMap );
1640 + PropertyMapVector1::const_iterator aLastCellIterator = aRowOfCellsIterator->end() - 1;
1642 + // Get the row style properties
1643 + sal_Int32 nRowStyleMask = sal_Int32( 0 );
1644 + PropertyMapPtr pRowProps = m_aRowProperties[nRow];
1645 + if ( pRowProps.get( ) )
1647 + PropertyMap::iterator pTcCnfStyleIt = pRowProps->find( PropertyDefinition( PROP_CNF_STYLE, true ) );
1648 + if ( pTcCnfStyleIt != pRowProps->end( ) )
1650 + if ( pTableStyle )
1652 + rtl::OUString sMask;
1653 + pTcCnfStyleIt->second >>= sMask;
1654 + nRowStyleMask = sMask.toInt32( 2 );
1656 + pRowProps->erase( pTcCnfStyleIt );
1660 sal_Int32 nCell = 0;
1661 pCellProperties[nRow].realloc( aRowOfCellsIterator->size() );
1662 beans::PropertyValues* pSingleCellProperties = pCellProperties[nRow].getArray();
1663 while( aCellIterator != aCellIteratorEnd )
1665 - //TODO: aCellIterator contains HorizontalBorder and VerticalBorder
1666 - // they have to be removed, depending on the position of the cell they
1667 - // have to be moved to BottomBorder/RightBorder respectively
1668 + PropertyMapPtr pAllCellProps( new PropertyMap );
1670 + bool bIsEndCol = aCellIterator == aLastCellIterator;
1671 + bool bIsEndRow = aRowOfCellsIterator == aLastRowIterator;
1673 //aCellIterator points to a PropertyMapPtr;
1674 if( aCellIterator->get() )
1676 - if( nCell && aCellBorders->size() )
1678 - //now apply the default border
1679 - //TODO: This overwrites the existing values!
1680 - aCellIterator->get()->insert( aCellBorders, false );
1684 - const PropertyMap::iterator aVerticalIter =
1685 - aCellIterator->get()->find( PropertyDefinition(META_PROP_VERTICAL_BORDER, false) );
1686 - const PropertyMap::iterator aHorizontalIter =
1687 - aCellIterator->get()->find( PropertyDefinition(META_PROP_HORIZONTAL_BORDER, false) );
1688 - const PropertyMap::const_iterator aRightIter =
1689 - aCellIterator->get()->find( PropertyDefinition(PROP_RIGHT_BORDER, false) );
1690 - const PropertyMap::const_iterator aBottomIter =
1691 - aCellIterator->get()->find( PropertyDefinition(PROP_BOTTOM_BORDER, false) );
1693 - if( aVerticalIter != aCellIterator->get()->end())
1694 + if ( pTableDefaults->size( ) )
1695 + pAllCellProps->insert( pTableDefaults );
1697 + // Fill the cell properties with the ones of the style
1698 + sal_Int32 nCellStyleMask = 0;
1699 + const PropertyMap::iterator aCnfStyleIter =
1700 + aCellIterator->get()->find( PropertyDefinition( PROP_CNF_STYLE, false ) );
1701 + if ( aCnfStyleIter != aCellIterator->get( )->end( ) )
1704 - aCellBorders->insert(*aVerticalIter);
1705 - aCellIterator->get()->erase( aVerticalIter );
1706 + if ( pTableStyle ) {
1707 + rtl::OUString sMask;
1708 + aCnfStyleIter->second >>= sMask;
1709 + nCellStyleMask = sMask.toInt32( 2 );
1711 + aCellIterator->get( )->erase( aCnfStyleIter );
1713 - if( aHorizontalIter != aCellIterator->get()->end())
1715 + if ( pTableStyle )
1718 - aCellBorders->insert(*aHorizontalIter);
1719 - aCellIterator->get()->erase( aHorizontalIter );
1720 + PropertyMapPtr pStyleProps = pTableStyle->GetProperties( nCellStyleMask + nRowStyleMask );
1721 + pAllCellProps->insert( pStyleProps );
1723 - //fill the additional borders into the line default border
1726 - const PropertyMap::const_iterator aLeftIter =
1727 - aCellIterator->get()->find( PropertyDefinition(PROP_RIGHT_BORDER, false) );
1728 - if(aLeftIter != aCellIterator->get()->end())
1729 - aCellBorders->insert(*aLeftIter);
1730 - if(aRightIter != aCellIterator->get()->end())
1731 - aCellBorders->insert(*aRightIter);
1732 - const PropertyMap::const_iterator aTopIter =
1733 - aCellIterator->get()->find( PropertyDefinition(PROP_TOP_BORDER, false) );
1734 - if(aTopIter != aCellIterator->get()->end())
1735 - aCellBorders->insert(*aTopIter);
1736 - if(aBottomIter != aCellIterator->get()->end())
1737 - aCellBorders->insert(*aBottomIter);
1741 + // Then add the cell properties
1742 + pAllCellProps->insert( *aCellIterator );
1743 + aCellIterator->get( )->swap( *pAllCellProps.get( ) );
1746 + clog << "Cell #" << nCell << ", Row #" << nRow << endl;
1749 + lcl_computeCellBorders( pTableBorders, *aCellIterator, nCell, nRow, bIsEndCol, bIsEndRow );
1751 //now set the default left+right border distance TODO: there's an sprm containing the default distance!
1752 const PropertyMap::const_iterator aLeftDistanceIter =
1753 aCellIterator->get()->find( PropertyDefinition(PROP_LEFT_BORDER_DISTANCE, false) );
1754 @@ -410,7 +572,7 @@ void DomainMapperTableHandler::endTable()
1756 sNames += ::rtl::OUString('-');
1758 - sNames += ::rtl::OUString(' ');
1759 + sNames += ::rtl::OUString('\n');
1763 @@ -479,11 +641,15 @@ void DomainMapperTableHandler::endTable()
1764 (void) nCellPropertiesProperties;
1765 ++nCellPropertiesProperties;
1768 - m_xText->convertToTable(*m_pTableSeq,
1769 + clog << "Converting table" << endl;
1772 + uno::Reference<text::XTextTable> xTable = m_xText->convertToTable(*m_pTableSeq,
1777 + m_xTableRange = xTable->getAnchor( );
1779 catch (lang::IllegalArgumentException e)
1781 @@ -491,7 +657,14 @@ void DomainMapperTableHandler::endTable()
1782 clog << "failed to import table!" << endl;
1785 +#if OSL_DEBUG_LEVEL > 1
1786 + catch ( uno::Exception e )
1788 + clog << "Caught an other exception: " << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
1793 m_aTableProperties.reset();
1794 m_aCellProperties.clear();
1795 m_aRowProperties.clear();
1796 @@ -529,7 +702,15 @@ void DomainMapperTableHandler::startCell(const Handle_t & start,
1797 TablePropertyMapPtr pProps )
1799 sal_uInt32 nRow = m_aRowProperties.size();
1800 - m_aCellProperties[nRow - 1].push_back( pProps );
1801 + if ( pProps.get( ) )
1802 + m_aCellProperties[nRow - 1].push_back( pProps );
1805 + // Adding an empty cell properties map to be able to get
1806 + // the table defaults properties
1807 + TablePropertyMapPtr pEmptyProps( new TablePropertyMap( ) );
1808 + m_aCellProperties[nRow - 1].push_back( pEmptyProps );
1811 #if OSL_DEBUG_LEVEL > 1
1812 clog << "<table.cell>";
1813 diff --git writerfilter/source/dmapper/DomainMapperTableHandler.hxx writerfilter/source/dmapper/DomainMapperTableHandler.hxx
1814 index d0e4382..833dd3c 100644
1815 --- writerfilter/source/dmapper/DomainMapperTableHandler.hxx
1816 +++ writerfilter/source/dmapper/DomainMapperTableHandler.hxx
1817 @@ -66,6 +66,8 @@ class DomainMapperTableHandler : public TableDataHandler<Handle_t , TablePropert
1818 RowSequencePointer_t m_pRowSeq;
1819 TableSequencePointer_t m_pTableSeq;
1821 + Handle_t m_xTableRange;
1824 PropertyMapVector2 m_aCellProperties;
1825 PropertyMapVector1 m_aRowProperties;
1826 @@ -87,6 +89,11 @@ public:
1827 virtual void endRow();
1828 virtual void startCell(const Handle_t & start, TablePropertyMapPtr pProps);
1829 virtual void endCell(const Handle_t & end);
1831 + virtual Handle_t* getTable( )
1833 + return &m_xTableRange;
1838 diff --git writerfilter/source/dmapper/DomainMapperTableManager.cxx writerfilter/source/dmapper/DomainMapperTableManager.cxx
1839 index 4367f90..5790e9f 100644
1840 --- writerfilter/source/dmapper/DomainMapperTableManager.cxx
1841 +++ writerfilter/source/dmapper/DomainMapperTableManager.cxx
1842 @@ -56,14 +56,18 @@ DomainMapperTableManager::DomainMapperTableManager(bool bOOXML) :
1843 m_nCellBorderIndex(0),
1846 - m_bOOXML( bOOXML )
1847 + m_bOOXML( bOOXML ),
1848 + m_pTablePropsHandler( new TablePropertiesHandler( bOOXML ) )
1850 + m_pTablePropsHandler->SetTableManager( this );
1852 /*-- 23.04.2007 14:57:49---------------------------------------------------
1854 -----------------------------------------------------------------------*/
1855 DomainMapperTableManager::~DomainMapperTableManager()
1857 + if ( m_pTablePropsHandler )
1858 + delete m_pTablePropsHandler, m_pTablePropsHandler = NULL;
1860 /*-- 23.04.2007 15:25:37---------------------------------------------------
1862 @@ -73,39 +77,17 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
1863 bool bRet = DomainMapperTableManager_Base_t::sprm(rSprm);
1866 + bRet = m_pTablePropsHandler->sprm( rSprm );
1872 sal_uInt32 nSprmId = rSprm.getId();
1873 Value::Pointer_t pValue = rSprm.getValue();
1874 sal_Int32 nIntValue = ((pValue.get() != NULL) ? pValue->getInt() : 0);
1875 - /* WRITERFILTERSTATUS: table: table_sprmdata */
1877 + switch ( nSprmId )
1879 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
1880 - case NS_ooxml::LN_CT_TrPrBase_jc: //90706
1881 - /* WRITERFILTERSTATUS: done: 1, planned: 0.5, spent: 0.5 */
1882 - case NS_ooxml::LN_CT_TblPrBase_jc:
1883 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
1884 - case 0x5400: // sprmTJc
1886 - //table justification 0: left, 1: center, 2: right
1887 - sal_Int16 nOrient = ConversionHelper::convertTableJustification( nIntValue );
1888 - TablePropertyMapPtr pTableMap( new TablePropertyMap );
1889 - pTableMap->setValue( TablePropertyMap::HORI_ORIENT, nOrient );
1890 - insertTableProps( pTableMap );
1893 - /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
1894 - case 0x9601: // sprmTDxaLeft
1896 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1897 - case 0x9602: // sprmTDxaGapHalf
1899 - //m_nGapHalf = ConversionHelper::convertTwipToMM100( nIntValue );
1900 - TablePropertyMapPtr pPropMap( new TablePropertyMap );
1901 - pPropMap->setValue( TablePropertyMap::GAP_HALF, ConversionHelper::convertTwipToMM100( nIntValue ) );
1902 - insertTableProps(pPropMap);
1905 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1906 case 0xf661: //sprmTTRLeft left table indent
1907 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1908 @@ -136,32 +118,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
1912 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
1913 - case NS_ooxml::LN_CT_TrPrBase_trHeight: //90703
1915 - //contains unit and value
1916 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1917 - if( pProperties.get())
1918 - { //contains attributes x2902 (LN_unit) and x17e2 (LN_trleft)
1919 - MeasureHandlerPtr pMeasureHandler( new MeasureHandler );
1920 - pProperties->resolve(*pMeasureHandler);
1921 - TablePropertyMapPtr pPropMap( new TablePropertyMap );
1922 - pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() ));
1923 - pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(pMeasureHandler->getMeasureValue() ));
1924 - insertRowProps(pPropMap);
1928 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1929 - case 0x3403: // sprmTFCantSplit
1930 - case NS_sprm::LN_TCantSplit: // 0x3644
1932 - //row can't break across pages if nIntValue == 1
1933 - TablePropertyMapPtr pPropMap( new TablePropertyMap );
1934 - pPropMap->Insert( PROP_IS_SPLIT_ALLOWED, false, uno::makeAny(sal_Bool( nIntValue == 1 ? sal_False : sal_True ) ));
1935 - insertRowProps(pPropMap);
1938 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1939 case 0x3404:// sprmTTableHeader
1940 case NS_ooxml::LN_CT_TrPrBase_tblHeader: //90704
1941 @@ -178,23 +134,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
1942 m_nHeaderRepeat = -1;
1944 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1945 - case 0x9407: // sprmTDyaRowHeight
1947 - // table row height - negative values indicate 'exact height' - positive 'at least'
1948 - TablePropertyMapPtr pPropMap( new TablePropertyMap );
1949 - bool bMinHeight = true;
1950 - sal_Int16 nHeight = static_cast<sal_Int16>( nIntValue );
1953 - bMinHeight = false;
1956 - pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny(bMinHeight ? text::SizeType::MIN : text::SizeType::FIX ));
1957 - pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(ConversionHelper::convertTwipToMM100( nHeight )));
1958 - insertRowProps(pPropMap);
1961 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1962 case 0xd608: // TDefTable
1964 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1965 @@ -226,22 +165,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
1968 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1969 - case NS_ooxml::LN_CT_TcPrBase_vAlign://90694
1971 - sal_Int16 nVertOrient = text::VertOrientation::NONE;
1972 - switch( nIntValue ) //0 - top 1 - center 3 - bottom
1974 - case 1: nVertOrient = text::VertOrientation::CENTER; break;
1975 - case 3: nVertOrient = text::VertOrientation::BOTTOM; break;
1978 - TablePropertyMapPtr pCellPropMap( new TablePropertyMap() );
1979 - pCellPropMap->Insert( PROP_VERT_ORIENT, false, uno::makeAny( nVertOrient ) );
1980 - //todo: in ooxml import the value of m_ncell is wrong
1981 - cellProps( pCellPropMap );
1984 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1985 case 0xD605: // sprmTTableBorders
1987 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1988 @@ -256,70 +179,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
1992 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
1993 - case NS_ooxml::LN_CT_TblPrBase_tblBorders: //table borders, might be defined in table style
1995 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
1996 - if( pProperties.get())
1998 - BorderHandlerPtr pBorderHandler( new BorderHandler(m_bOOXML) );
1999 - pProperties->resolve(*pBorderHandler);
2000 - TablePropertyMapPtr pTablePropMap( new TablePropertyMap );
2001 - pTablePropMap->insert( pBorderHandler->getProperties() );
2002 - insertTableProps( pTablePropMap );
2006 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2007 - case NS_ooxml::LN_CT_TcPrBase_tcBorders ://cell borders
2008 - //contains CT_TcBorders_left, right, top, bottom
2010 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2011 - if( pProperties.get())
2013 - //in OOXML there's one set of borders at each cell (if there is any)
2014 - TDefTableHandlerPtr pTDefTableHandler( new TDefTableHandler( m_bOOXML ));
2015 - pProperties->resolve( *pTDefTableHandler );
2016 - TablePropertyMapPtr pCellPropMap( new TablePropertyMap );
2017 - pTDefTableHandler->fillCellProperties( 0, pCellPropMap );
2018 - cellProps( pCellPropMap );
2022 - case NS_ooxml::LN_CT_TblPrBase_shd:
2024 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2025 - if( pProperties.get())
2027 - CellColorHandlerPtr pCellColorHandler( new CellColorHandler);
2028 - pProperties->resolve( *pCellColorHandler );
2029 - TablePropertyMapPtr pTablePropMap( new TablePropertyMap );
2030 - insertTableProps( pCellColorHandler->getProperties() );
2034 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2035 - case 0xd61a : // sprmTCellTopColor
2036 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2037 - case 0xd61b : // sprmTCellLeftColor
2038 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2039 - case 0xd61c : // sprmTCellBottomColor
2040 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2041 - case 0xd61d : // sprmTCellRightColor
2042 - /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2043 - case NS_ooxml::LN_CT_TcPrBase_shd:
2045 - // each color sprm contains as much colors as cells are in a row
2046 - //LN_CT_TcPrBase_shd: cell shading contains: LN_CT_Shd_val, LN_CT_Shd_fill, LN_CT_Shd_color
2047 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2048 - if( pProperties.get())
2050 - CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
2051 - pProperties->resolve( *pCellColorHandler );
2052 - cellProps( pCellColorHandler->getProperties());
2056 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
2057 case 0xd632 : //sprmTNewSpacing
2058 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
2059 @@ -356,7 +215,6 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2060 case 0xf618 : //unknown
2063 -//OOXML table properties
2064 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2065 case NS_ooxml::LN_CT_TblPrBase_tblStyle: //table style name
2067 @@ -368,34 +226,10 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2069 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2070 case NS_ooxml::LN_CT_TblGridBase_gridCol:
2074 - m_aTableGrid.push_back( ConversionHelper::convertTwipToMM100( nIntValue ) );
2076 + getCurrentGrid()->push_back( ConversionHelper::convertTwipToMM100( nIntValue ) );
2079 - /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
2080 - case NS_ooxml::LN_CT_TblPrBase_tblCellMar: //cell margins
2082 - //contains LN_CT_TblCellMar_top, LN_CT_TblCellMar_left, LN_CT_TblCellMar_bottom, LN_CT_TblCellMar_right
2083 - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
2084 - if( pProperties.get())
2086 - CellMarginHandlerPtr pCellMarginHandler( new CellMarginHandler );
2087 - pProperties->resolve( *pCellMarginHandler );
2088 - TablePropertyMapPtr pMarginProps( new TablePropertyMap );
2089 - if( pCellMarginHandler->m_bTopMarginValid )
2090 - pMarginProps->setValue( TablePropertyMap::CELL_MAR_TOP, pCellMarginHandler->m_nTopMargin );
2091 - if( pCellMarginHandler->m_bBottomMarginValid )
2092 - pMarginProps->setValue( TablePropertyMap::CELL_MAR_BOTTOM, pCellMarginHandler->m_nBottomMargin );
2093 - if( pCellMarginHandler->m_bLeftMarginValid )
2094 - pMarginProps->setValue( TablePropertyMap::CELL_MAR_LEFT, pCellMarginHandler->m_nLeftMargin );
2095 - if( pCellMarginHandler->m_bRightMarginValid )
2096 - pMarginProps->setValue( TablePropertyMap::CELL_MAR_RIGHT, pCellMarginHandler->m_nRightMargin );
2097 - insertTableProps(pMarginProps);
2101 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2102 case NS_ooxml::LN_CT_TcPrBase_vMerge : //vertical merge
2104 @@ -408,25 +242,84 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
2105 /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
2106 case NS_ooxml::LN_CT_TcPrBase_gridSpan: //number of grid positions spanned by this cell
2109 + clog << "GridSpan: " << nIntValue << endl;
2111 //the cell width is determined by its position in the table grid
2112 //it takes 'gridSpan' grid elements
2113 - if( m_aGridSpans.size() < m_nCell)
2114 + IntVectorPtr pCurrentSpans = getCurrentSpans( );
2115 + if( pCurrentSpans->size() < m_nCell)
2117 //fill missing elements with '1'
2118 - m_aGridSpans.insert( m_aGridSpans.end(), m_nCell - m_aGridSpans.size(), 1 );
2120 - m_aGridSpans.push_back( nIntValue );
2121 + pCurrentSpans->insert( pCurrentSpans->end(), m_nCell - pCurrentSpans->size(), 1 );
2123 + pCurrentSpans->push_back( nIntValue );
2126 /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
2127 - case NS_ooxml::LN_CT_TblPrBase_tblLook: break; //todo: table look specifier
2128 + case NS_ooxml::LN_CT_TblPrBase_tblLook:
2129 + break; //todo: table look specifier
2130 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
2131 - case NS_ooxml::LN_CT_TcPrBase_tcW: break; //fixed column width is not supported
2132 - default: bRet = false;
2133 + case NS_ooxml::LN_CT_TcPrBase_tcW:
2134 + break; //fixed column width is not supported
2135 + case NS_ooxml::LN_CT_TrPrBase_cnfStyle:
2137 + TablePropertyMapPtr pProps( new TablePropertyMap );
2138 + pProps->Insert( PROP_CNF_STYLE, true, uno::makeAny( pValue->getString( ) ) );
2139 + insertRowProps( pProps );
2142 + case NS_ooxml::LN_CT_PPrBase_cnfStyle:
2143 + // TODO cnfStyle on a paragraph
2145 + case NS_ooxml::LN_CT_TcPrBase_cnfStyle:
2147 + TablePropertyMapPtr pProps( new TablePropertyMap );
2148 + pProps->Insert( PROP_CNF_STYLE, true, uno::makeAny( pValue->getString( ) ) );
2149 + cellProps( pProps );
2152 + case NS_ooxml::LN_tblStart:
2164 +boost::shared_ptr< vector<sal_Int32> > DomainMapperTableManager::getCurrentGrid( )
2166 + return m_aTableGrid.back( );
2169 +boost::shared_ptr< vector< sal_Int32 > > DomainMapperTableManager::getCurrentSpans( )
2171 + return m_aGridSpans.back( );
2174 +void DomainMapperTableManager::startLevel( )
2176 + DomainMapperTableManager_Base_t::startLevel( );
2178 + IntVectorPtr pNewGrid( new vector<sal_Int32> );
2179 + IntVectorPtr pNewSpans( new vector<sal_Int32> );
2180 + m_aTableGrid.push_back( pNewGrid );
2181 + m_aGridSpans.push_back( pNewSpans );
2182 + m_nTableWidth = 0;
2185 +void DomainMapperTableManager::endLevel( )
2187 + m_aTableGrid.pop_back( );
2188 + m_aGridSpans.pop_back( );
2190 + DomainMapperTableManager_Base_t::endLevel( );
2193 /*-- 02.05.2007 14:36:26---------------------------------------------------
2195 -----------------------------------------------------------------------*/
2196 @@ -439,10 +332,11 @@ void DomainMapperTableManager::endOfCellAction()
2197 -----------------------------------------------------------------------*/
2198 void DomainMapperTableManager::endOfRowAction()
2200 - if(!m_nRow && !m_nTableWidth && m_aTableGrid.size())
2201 + IntVectorPtr pTableGrid = getCurrentGrid( );
2202 + if(!m_nTableWidth && pTableGrid->size())
2204 - ::std::vector<sal_Int32>::const_iterator aCellIter = m_aTableGrid.begin();
2205 - while( aCellIter != m_aTableGrid.end() )
2206 + ::std::vector<sal_Int32>::const_iterator aCellIter = pTableGrid->begin();
2207 + while( aCellIter != pTableGrid->end() )
2208 m_nTableWidth += *aCellIter++;
2209 if( m_nTableWidth > 0)
2211 @@ -452,18 +346,20 @@ void DomainMapperTableManager::endOfRowAction()
2212 insertTableProps(pPropMap);
2215 - if( m_aGridSpans.size() < m_nCell)
2217 + IntVectorPtr pCurrentSpans = getCurrentSpans( );
2218 + if( pCurrentSpans->size() < m_nCell)
2220 //fill missing elements with '1'
2221 - m_aGridSpans.insert( m_aGridSpans.end(), m_nCell - m_aGridSpans.size(), 1 );
2222 + pCurrentSpans->insert( pCurrentSpans->end( ), m_nCell - pCurrentSpans->size(), 1 );
2224 //calculate number of used grids - it has to match the size of m_aTableGrid
2226 - ::std::vector<sal_Int32>::const_iterator aGridSpanIter = m_aGridSpans.begin();
2227 - for( ; aGridSpanIter != m_aGridSpans.end(); ++aGridSpanIter)
2228 + ::std::vector<sal_Int32>::const_iterator aGridSpanIter = pCurrentSpans->begin();
2229 + for( ; aGridSpanIter != pCurrentSpans->end(); ++aGridSpanIter)
2230 nGrids += *aGridSpanIter;
2232 - if( m_aTableGrid.size() == nGrids )
2233 + if( pTableGrid->size() == nGrids )
2235 //determine table width
2236 double nFullWidth = m_nTableWidth;
2237 @@ -473,13 +369,15 @@ void DomainMapperTableManager::endOfRowAction()
2238 text::TableColumnSeparator* pSeparators = aSeparators.getArray();
2239 sal_Int16 nLastRelPos = 0;
2240 sal_uInt32 nBorderGridIndex = 0;
2242 + ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( );
2243 for( sal_uInt32 nBorder = 0; nBorder < m_nCell - 1; ++nBorder )
2245 - sal_Int32 nGridCount = m_aGridSpans[nBorder];
2246 + sal_Int32 nGridCount = *aSpansIter;
2247 double fGridWidth = 0.;
2250 - fGridWidth += m_aTableGrid[nBorderGridIndex++];
2251 + fGridWidth += (*pTableGrid.get())[nBorderGridIndex++];
2252 }while( --nGridCount );
2255 @@ -488,6 +386,7 @@ void DomainMapperTableManager::endOfRowAction()
2256 pSeparators[nBorder].Position = nRelPos + nLastRelPos;
2257 pSeparators[nBorder].IsVisible = sal_True;
2258 nLastRelPos = nLastRelPos + nRelPos;
2261 TablePropertyMapPtr pPropMap( new TablePropertyMap );
2262 pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, false, uno::makeAny( aSeparators ) );
2263 @@ -497,7 +396,7 @@ void DomainMapperTableManager::endOfRowAction()
2266 m_nCellBorderIndex = 0;
2267 - m_aGridSpans.clear();
2268 + pCurrentSpans->clear();
2270 /*-- 18.06.2007 10:34:37---------------------------------------------------
2272 @@ -505,8 +404,6 @@ void DomainMapperTableManager::endOfRowAction()
2273 void DomainMapperTableManager::clearData()
2275 m_nRow = m_nCell = m_nCellBorderIndex = m_nHeaderRepeat = m_nTableWidth = 0;
2276 - m_aTableGrid.clear();
2277 - m_aGridSpans.clear();
2278 m_sTableStyleName = ::rtl::OUString();
2279 m_pTableStyleTextProperies.reset();
2281 @@ -521,10 +418,10 @@ void lcl_CopyTextProperties(PropertyMapPtr pToFill,
2282 //fill base style properties first, recursively
2283 if( pStyleSheetEntry->sBaseStyleIdentifier.getLength())
2285 - const StyleSheetEntry* pParentStyleSheet =
2286 + const StyleSheetEntryPtr pParentStyleSheet =
2287 pStyleSheetTable->FindStyleSheetByISTD(pStyleSheetEntry->sBaseStyleIdentifier);
2288 OSL_ENSURE( pParentStyleSheet, "table style not found" );
2289 - lcl_CopyTextProperties( pToFill, pParentStyleSheet, pStyleSheetTable);
2290 + lcl_CopyTextProperties( pToFill, pParentStyleSheet.get( ), pStyleSheetTable);
2293 PropertyMap::const_iterator aPropIter = pStyleSheetEntry->pProperties->begin();
2294 @@ -541,10 +438,10 @@ void DomainMapperTableManager::CopyTextProperties(PropertyMapPtr pContext, Style
2295 if( !m_pTableStyleTextProperies.get())
2297 m_pTableStyleTextProperies.reset( new PropertyMap );
2298 - const StyleSheetEntry* pStyleSheetEntry = pStyleSheetTable->FindStyleSheetByISTD(
2299 + const StyleSheetEntryPtr pStyleSheetEntry = pStyleSheetTable->FindStyleSheetByISTD(
2301 OSL_ENSURE( pStyleSheetEntry, "table style not found" );
2302 - lcl_CopyTextProperties(m_pTableStyleTextProperies, pStyleSheetEntry, pStyleSheetTable);
2303 + lcl_CopyTextProperties(m_pTableStyleTextProperies, pStyleSheetEntry.get( ), pStyleSheetTable);
2305 pContext->insert( m_pTableStyleTextProperies );
2307 diff --git writerfilter/source/dmapper/DomainMapperTableManager.hxx writerfilter/source/dmapper/DomainMapperTableManager.hxx
2308 index c183252..d301acf 100644
2309 --- writerfilter/source/dmapper/DomainMapperTableManager.hxx
2310 +++ writerfilter/source/dmapper/DomainMapperTableManager.hxx
2312 #ifndef INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
2313 #define INCLUDED_DOMAIN_MAPPER_TABLE_MANAGER_HXX
2315 +#include "TablePropertiesHandler.hxx"
2317 #include <resourcemodel/TableManager.hxx>
2318 #include <PropertyMap.hxx>
2319 #include <StyleSheetTable.hxx>
2322 namespace writerfilter {
2324 -typedef ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > Handle_t;
2325 -typedef TableManager<Handle_t , TablePropertyMapPtr > DomainMapperTableManager_Base_t;
2327 class DomainMapperTableManager : public DomainMapperTableManager_Base_t
2329 + typedef boost::shared_ptr< std::vector<sal_Int32> > IntVectorPtr;
2333 sal_uInt32 m_nCellBorderIndex; //borders are provided for all cells and need counting
2334 @@ -51,9 +54,12 @@ class DomainMapperTableManager : public DomainMapperTableManager_Base_t
2335 ::rtl::OUString m_sTableStyleName;
2336 PropertyMapPtr m_pTableStyleTextProperies;
2338 - ::std::vector<sal_Int32> m_aTableGrid;
2339 - ::std::vector<sal_Int32> m_aGridSpans;
2340 + ::std::vector< IntVectorPtr > m_aTableGrid;
2341 + ::std::vector< IntVectorPtr > m_aGridSpans;
2343 + TablePropertiesHandler *m_pTablePropsHandler;
2344 + PropertyMapPtr m_pStyleProps;
2346 virtual void clearData();
2349 @@ -61,15 +67,56 @@ public:
2350 DomainMapperTableManager(bool bOOXML);
2351 virtual ~DomainMapperTableManager();
2353 + // use this method to avoid adding the properties for the table
2354 + // but in the provided properties map.
2355 + inline void SetStyleProperties( PropertyMapPtr pProperties ) { m_pStyleProps = pProperties; };
2357 virtual bool sprm(Sprm & rSprm);
2359 + virtual void startLevel( );
2360 + virtual void endLevel( );
2362 virtual void endOfCellAction();
2363 virtual void endOfRowAction();
2365 + IntVectorPtr getCurrentGrid( );
2366 + IntVectorPtr getCurrentSpans( );
2368 const ::rtl::OUString& getTableStyleName() const { return m_sTableStyleName; }
2369 /// copy the text properties of the table style and its parent into pContext
2370 void CopyTextProperties(PropertyMapPtr pContext, StyleSheetTablePtr pStyleSheetTable);
2372 + inline virtual void cellProps(TablePropertyMapPtr pProps)
2374 + if ( m_pStyleProps.get( ) )
2375 + m_pStyleProps->insert( pProps, true );
2377 + DomainMapperTableManager_Base_t::cellProps( pProps );
2380 + inline virtual void cellPropsByCell(unsigned int i, TablePropertyMapPtr pProps)
2382 + if ( m_pStyleProps.get( ) )
2383 + m_pStyleProps->insert( pProps, true );
2385 + DomainMapperTableManager_Base_t::cellPropsByCell( i, pProps );
2388 + inline virtual void insertRowProps(TablePropertyMapPtr pProps)
2390 + if ( m_pStyleProps.get( ) )
2391 + m_pStyleProps->insert( pProps, true );
2393 + DomainMapperTableManager_Base_t::insertRowProps( pProps );
2396 + inline virtual void insertTableProps(TablePropertyMapPtr pProps)
2398 + if ( m_pStyleProps.get( ) )
2399 + m_pStyleProps->insert( pProps, true );
2401 + DomainMapperTableManager_Base_t::insertTableProps( pProps );
2406 diff --git writerfilter/source/dmapper/DomainMapper_Impl.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx
2407 index 2d8acbc..dfa3c60 100644
2408 --- writerfilter/source/dmapper/DomainMapper_Impl.cxx
2409 +++ writerfilter/source/dmapper/DomainMapper_Impl.cxx
2411 #include <com/sun/star/beans/XPropertyState.hpp>
2412 #include <com/sun/star/container/XIndexReplace.hpp>
2413 #include <com/sun/star/container/XNamed.hpp>
2414 +#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
2415 +#include <com/sun/star/drawing/XShapes.hpp>
2416 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
2417 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
2418 #include <com/sun/star/style/LineNumberPosition.hpp>
2420 #include <com/sun/star/text/ReferenceFieldPart.hpp>
2421 #include <com/sun/star/text/ReferenceFieldSource.hpp>
2422 #include <com/sun/star/text/SizeType.hpp>
2423 +#include <com/sun/star/text/TextContentAnchorType.hpp>
2424 #include <com/sun/star/text/WrapTextMode.hpp>
2425 #include <com/sun/star/text/XDependentTextField.hpp>
2426 #include <com/sun/star/text/XParagraphCursor.hpp>
2428 #include <com/sun/star/util/XNumberFormats.hpp>
2429 #include <rtl/ustrbuf.hxx>
2430 #include <rtl/string.h>
2432 +#include <tools/string.hxx>
2433 #ifdef DEBUG_DOMAINMAPPER
2434 #include <resourcemodel/QNameToString.hxx>
2435 #include <resourcemodel/util.hxx>
2437 #include <ooxml/OOXMLFastTokens.hxx>
2440 +#include <com/sun/star/lang/XServiceInfo.hpp>
2445 @@ -393,6 +401,8 @@ DomainMapper_Impl::DomainMapper_Impl(
2446 m_bIsFirstSection( true ),
2447 m_bIsColumnBreakDeferred( false ),
2448 m_bIsPageBreakDeferred( false ),
2449 + m_bIsInShape( false ),
2450 + m_bShapeContextAdded( false ),
2451 m_TableManager( eDocumentType == DOCUMENT_OOXML ),
2452 m_nCurrentTabStopIndex( 0 ),
2453 m_sCurrentParaStyleId(),
2454 @@ -401,7 +411,7 @@ DomainMapper_Impl::DomainMapper_Impl(
2455 m_bLineNumberingSet( false ),
2456 m_bIsInFootnoteProperties( true ),
2457 m_bIsCustomFtnMark( false ),
2458 - n_CurrentRedlineToken( ooxml::OOXML_mod )
2459 + m_bIsParaChange( false )
2462 uno::Reference< text::XTextAppend > xBodyTextAppend = uno::Reference< text::XTextAppend >( m_xBodyText, uno::UNO_QUERY );
2463 @@ -685,13 +695,13 @@ uno::Sequence< style::TabStop > DomainMapper_Impl::GetCurrentTabStopAndClear()
2464 -----------------------------------------------------------------------*/
2465 uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId)
2467 - const StyleSheetEntry* pEntry = 0;
2468 + StyleSheetEntryPtr pEntry;
2469 if( m_bInStyleSheetImport )
2470 pEntry = GetStyleSheetTable()->FindParentStyleSheet(::rtl::OUString());
2473 GetStyleSheetTable()->FindStyleSheetByISTD(GetCurrentParaStyleId());
2475 + while(pEntry.get( ) )
2477 //is there a tab stop set?
2478 if(pEntry->pProperties)
2479 @@ -725,10 +735,10 @@ void DomainMapper_Impl::deferBreak( BreakType deferredBreakType)
2480 switch (deferredBreakType)
2483 - m_bIsColumnBreakDeferred = true;
2484 + m_bIsColumnBreakDeferred = true;
2487 - m_bIsPageBreakDeferred = true;
2488 + m_bIsPageBreakDeferred = true;
2492 @@ -831,11 +841,15 @@ void lcl_AddRangeAndStyle(
2493 /*-------------------------------------------------------------------------
2495 -----------------------------------------------------------------------*/
2496 -//define some default frame width - 10cm ATM
2497 -#define DEFAULT_FRAME_MIN_WIDTH 10000
2498 +//define some default frame width - 0cm ATM: this allow the frame to be wrapped around the text
2499 +#define DEFAULT_FRAME_MIN_WIDTH 0
2501 void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
2504 + clog << "finishParagraph" << endl;
2507 ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pPropertyMap.get() );
2508 TextAppendContext& rAppendContext = m_aTextAppendStack.top();
2509 uno::Reference< text::XTextAppend > xTextAppend = rAppendContext.xTextAppend;
2510 @@ -903,11 +917,11 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
2514 - const StyleSheetEntry* pParaStyle =
2515 + StyleSheetEntryPtr pParaStyle =
2516 m_pStyleSheetTable->FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties->GetParaStyleName());
2518 uno::Sequence< beans::PropertyValue > aFrameProperties(pParaStyle ? 15: 0);
2520 + if ( pParaStyle.get( ) )
2522 const ParagraphProperties* pStyleProperties = dynamic_cast<const ParagraphProperties*>( pParaStyle->pProperties.get() );
2523 beans::PropertyValue* pFrameProperties = aFrameProperties.getArray();
2524 @@ -1045,14 +1059,34 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
2525 uno::Reference< text::XTextRange > xTextRange =
2526 xTextAppend->finishParagraph( aProperties );
2527 m_TableManager.handle(xTextRange);
2533 + // Set the anchor of the objects to the created paragraph
2534 + while ( m_aAnchoredStack.size( ) > 0 && !m_bIsInShape )
2536 + uno::Reference< text::XTextContent > xObj = m_aAnchoredStack.top( );
2540 + rtl::OUString sText( xTextRange->getString( ) );
2542 + xObj->attach( xTextRange );
2544 + catch ( uno::RuntimeException& )
2546 + // this is normal: the shape is already attached
2548 + m_aAnchoredStack.pop( );
2551 + // Get the end of paragraph character inserted
2552 + uno::Reference< text::XTextCursor > xCur = xTextRange->getText( )->createTextCursor( );
2553 + xCur->gotoEnd( false );
2554 + xCur->goLeft( 1 , true );
2555 + uno::Reference< text::XTextRange > xParaEnd( xCur, uno::UNO_QUERY );
2556 + CheckParaRedline( xParaEnd );
2558 if( !bKeepLastParagraphProperties )
2559 rAppendContext.pLastParagraphProperties = pToBeSavedProperties;
2562 catch(const lang::IllegalArgumentException& rIllegal)
2564 @@ -1062,7 +1096,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
2565 catch(const uno::Exception& rEx)
2568 - OSL_ENSURE( false, "ArgumentException in DomainMapper_Impl::finishParagraph" );
2569 + //OSL_ENSURE( false, "ArgumentException in DomainMapper_Impl::finishParagraph" );
2573 @@ -1099,35 +1133,7 @@ void DomainMapper_Impl::appendTextPortion( const ::rtl::OUString& rString, Prope
2574 uno::Reference< text::XTextRange > xTextRange =
2575 xTextAppend->appendTextPortion
2576 (rString, pPropertyMap->GetPropertyValues());
2577 - if( m_CurrentRedlineDate.getLength() )
2581 - ::rtl::OUString sType;
2582 - PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
2583 - switch(n_CurrentRedlineToken & 0xffff)
2585 - case ooxml::OOXML_mod : sType = rPropNameSupplier.GetName( PROP_FORMAT ); break;
2586 - case ooxml::OOXML_ins : sType = rPropNameSupplier.GetName( PROP_INSERT ); break;
2587 - case ooxml::OOXML_del : sType = rPropNameSupplier.GetName( PROP_DELETE ); break;
2589 - uno::Reference< text::XRedline > xRedline( xTextRange, uno::UNO_QUERY_THROW );
2590 - beans::PropertyValues aRedlineProperties( 2 );
2591 - beans::PropertyValue* pRedlineProperties = aRedlineProperties.getArray();
2592 - pRedlineProperties[0].Name = rPropNameSupplier.GetName( PROP_REDLINE_AUTHOR );
2593 - pRedlineProperties[0].Value <<= m_CurrentRedlineAuthor;
2594 - pRedlineProperties[1].Name = rPropNameSupplier.GetName( PROP_REDLINE_DATE_TIME );
2595 - pRedlineProperties[1].Value <<= lcl_DateStringToDateTime( m_CurrentRedlineDate );
2596 - xRedline->makeRedline( sType, aRedlineProperties);
2599 - catch( const uno::Exception& rEx )
2602 - OSL_ENSURE( false, "Exception in makeRedline" );
2604 - ResetRedlineProperties();
2606 + CheckRedline( xTextRange );
2608 //m_TableManager.handle(xTextRange);
2610 @@ -1167,6 +1173,7 @@ void DomainMapper_Impl::appendTextContent(
2615 /*-- 24.04.2008 08:38:07---------------------------------------------------
2617 -----------------------------------------------------------------------*/
2618 @@ -1368,9 +1375,11 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote )
2619 aFontProps->Insert(PROP_CHAR_FONT_NAME, true, uno::makeAny( pTopContext->GetFootnoteFontName() ));
2620 aFontProperties = aFontProps->GetPropertyValues();
2623 appendTextContent( uno::Reference< text::XTextContent >( xFootnoteText, uno::UNO_QUERY_THROW ), aFontProperties );
2624 m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xFootnoteText, uno::UNO_QUERY_THROW ));
2626 + // Redlines for the footnote anchor
2627 + CheckRedline( xFootnote->getAnchor( ) );
2629 catch( uno::Exception& )
2631 @@ -1378,6 +1387,87 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote )
2635 +void DomainMapper_Impl::CreateRedline( uno::Reference< text::XTextRange > xRange, RedlineParamsPtr& pRedline )
2637 + if ( pRedline.get( ) )
2640 + clog << "REDLINE: Writing redline: " << pRedline->m_nId << endl;
2644 + ::rtl::OUString sType;
2645 + PropertyNameSupplier & rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier( );
2646 + switch ( pRedline->m_nToken & 0xffff )
2648 + case ooxml::OOXML_mod:
2649 + sType = rPropNameSupplier.GetName( PROP_FORMAT );
2651 + case ooxml::OOXML_ins:
2652 + sType = rPropNameSupplier.GetName( PROP_INSERT );
2654 + case ooxml::OOXML_del:
2655 + sType = rPropNameSupplier.GetName( PROP_DELETE );
2658 + uno::Reference < text::XRedline > xRedline( xRange, uno::UNO_QUERY_THROW );
2659 + beans::PropertyValues aRedlineProperties( 2 );
2660 + beans::PropertyValue * pRedlineProperties = aRedlineProperties.getArray( );
2661 + pRedlineProperties[0].Name = rPropNameSupplier.GetName( PROP_REDLINE_AUTHOR );
2662 + pRedlineProperties[0].Value <<= pRedline->m_sAuthor;
2663 + pRedlineProperties[1].Name = rPropNameSupplier.GetName( PROP_REDLINE_DATE_TIME );
2664 + pRedlineProperties[1].Value <<= lcl_DateStringToDateTime( pRedline->m_sDate );
2666 + xRedline->makeRedline( sType, aRedlineProperties );
2668 + catch( const uno::Exception & rEx )
2671 + clog << "REDLINE: error - " << rtl::OUStringToOString( rEx.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
2674 + OSL_ENSURE( false, "Exception in makeRedline" );
2679 +void DomainMapper_Impl::CheckParaRedline( uno::Reference< text::XTextRange > xRange )
2681 + if ( m_pParaRedline.get( ) )
2683 + CreateRedline( xRange, m_pParaRedline );
2684 + ResetParaRedline( );
2688 +void DomainMapper_Impl::CheckRedline( uno::Reference< text::XTextRange > xRange )
2690 + vector<RedlineParamsPtr>::iterator pIt = m_aRedlines.begin( );
2691 + vector< RedlineParamsPtr > aCleaned;
2692 + for (; pIt != m_aRedlines.end( ); pIt++ )
2694 + CreateRedline( xRange, *pIt );
2696 + // Adding the non-mod redlines to the temporary vector
2697 + if ( pIt->get( ) && ( ( *pIt )->m_nToken & 0xffff ) != ooxml::OOXML_mod )
2699 + aCleaned.push_back( *pIt );
2703 + m_aRedlines.swap( aCleaned );
2706 +void DomainMapper_Impl::StartParaChange( )
2708 + m_bIsParaChange = true;
2711 +void DomainMapper_Impl::EndParaChange( )
2713 + m_bIsParaChange = false;
2716 /*-- 22.12.2008 13:45:15---------------------------------------------------
2718 -----------------------------------------------------------------------*/
2719 @@ -1416,57 +1506,58 @@ void DomainMapper_Impl::PopAnnotation()
2720 m_xAnnotationField.clear();
2723 -/*-- 20.03.2008 09:01:58---------------------------------------------------
2725 - -----------------------------------------------------------------------*/
2726 -void DomainMapper_Impl::PushShapeContext()
2727 +void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape > xShape )
2731 + clog << "PushShapeContext" << endl;
2733 + m_bIsInShape = true;
2736 - uno::Reference< text::XText > xTemporaryShape( GetTextFactory()->createInstance(
2737 - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape") )),
2738 - uno::UNO_QUERY_THROW );
2739 - uno::Reference< text::XTextAppend > xShapeAppend( xTemporaryShape, uno::UNO_QUERY );
2740 - //insert into the document
2741 - uno::Reference< text::XTextContent > xShapeContent( xTemporaryShape, uno::UNO_QUERY_THROW );
2742 - xShapeContent->attach( GetBodyText()->getStart() );
2743 - m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xShapeAppend, uno::UNO_QUERY_THROW ));
2745 - catch( uno::Exception& )
2746 + // Add the shape to the text append stack
2747 + m_aTextAppendStack.push( uno::Reference< text::XTextAppend >( xShape, uno::UNO_QUERY_THROW ) );
2748 + m_bShapeContextAdded = true;
2750 + // Add the shape to the anchored objects stack
2751 + uno::Reference< text::XTextContent > xTxtContent( xShape, uno::UNO_QUERY_THROW );
2752 + m_aAnchoredStack.push( xTxtContent );
2754 + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
2756 + uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW );
2757 + xProps->setPropertyValue(
2758 + rPropNameSupplier.GetName( PROP_ANCHOR_TYPE ),
2759 + uno::makeAny( text::TextContentAnchorType_AT_PARAGRAPH ) );
2760 + xProps->setPropertyValue(
2761 + rPropNameSupplier.GetName( PROP_OPAQUE ),
2762 + uno::makeAny( true ) );
2764 + catch ( const uno::Exception& e )
2766 - OSL_ENSURE( false, "exception in DomainMapper_Impl::PushShapeContext" );
2768 + clog << "Exception when adding shape: ";
2769 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( );
2775 /*-- 20.03.2008 09:01:59---------------------------------------------------
2777 -----------------------------------------------------------------------*/
2778 void DomainMapper_Impl::PopShapeContext()
2780 - m_xTemporaryShape = uno::Reference< drawing::XShape >( m_aTextAppendStack.top().xTextAppend, uno::UNO_QUERY );
2781 - m_aTextAppendStack.pop();
2783 -/*-- 20.03.2008 12:31:58---------------------------------------------------
2785 - -----------------------------------------------------------------------*/
2786 -void DomainMapper_Impl::CopyTemporaryShapeText( uno::Reference< drawing::XShape > xShape )
2788 - uno::Reference< text::XTextCopy >xShapeText( xShape, uno::UNO_QUERY );
2789 - uno::Reference< text::XTextCopy >xTempShapeText( m_xTemporaryShape, uno::UNO_QUERY );
2790 - if( xShapeText.is() && xTempShapeText.is() )
2792 - xShapeText->copyText( xTempShapeText );
2796 - uno::Reference< lang::XComponent >xTemp( m_xTemporaryShape, uno::UNO_QUERY );
2800 - catch( const uno::Exception& )
2802 + clog << "PopShapeContext" << endl;
2805 + if ( m_bShapeContextAdded )
2807 + m_aTextAppendStack.pop();
2808 + m_bShapeContextAdded = false;
2810 - m_xTemporaryShape = uno::Reference< drawing::XShape >();
2812 + m_bIsInShape = false;
2814 /*-- 12.09.2006 08:07:55---------------------------------------------------
2816 @@ -2952,6 +3043,7 @@ void DomainMapper_Impl::CloseFieldCommand()
2817 bool bHyperlinks = false;
2818 bool bFromOutline = false;
2819 bool bFromEntries = false;
2820 + sal_Int16 nMaxLevel = 10;
2821 ::rtl::OUString sTemplate;
2822 ::rtl::OUString sChapterNoSeparator;
2823 // \a Builds a table of figures but does not include the captions's label and number
2824 @@ -3001,6 +3093,10 @@ void DomainMapper_Impl::CloseFieldCommand()
2825 if( lcl_FindInCommand( pContext->GetCommand(), 'o', sValue ))
2827 bFromOutline = true;
2828 + UniString sParam( sValue );
2829 + xub_StrLen nIndex = 0;
2830 + sParam.GetToken( 0, '-', nIndex );
2831 + nMaxLevel = sal_Int16( sParam.Copy( nIndex ).ToInt32( ) );
2833 // \p Defines the separator between the table entry and its page number
2834 if( lcl_FindInCommand( pContext->GetCommand(), 'p', sValue ))
2835 @@ -3048,6 +3144,7 @@ void DomainMapper_Impl::CloseFieldCommand()
2836 xTOC->setPropertyValue(rPropNameSupplier.GetName( PROP_TITLE ), uno::makeAny(::rtl::OUString()));
2837 if( !bTableOfFigures )
2839 + xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_LEVEL ), uno::makeAny( nMaxLevel ) );
2840 xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_CREATE_FROM_OUTLINE ), uno::makeAny( bFromOutline ));
2841 xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_CREATE_FROM_MARKS ), uno::makeAny( bFromEntries ));
2842 if( sTemplate.getLength() )
2843 @@ -3531,14 +3628,98 @@ bool DomainMapper_Impl::ExecuteFrameConversion()
2848 +void DomainMapper_Impl::AddNewRedline( )
2850 + RedlineParamsPtr pNew( new RedlineParams );
2851 + pNew->m_nToken = ooxml::OOXML_mod;
2852 + if ( !m_bIsParaChange )
2855 + clog << "REDLINE: Adding a new redline to stack" << endl;
2857 + m_aRedlines.push_back( pNew );
2862 + clog << "REDLINE: Setting a new paragraph redline" << endl;
2864 + m_pParaRedline.swap( pNew );
2868 +RedlineParamsPtr DomainMapper_Impl::GetTopRedline( )
2870 + RedlineParamsPtr pResult;
2871 + if ( !m_bIsParaChange && m_aRedlines.size( ) > 0 )
2872 + pResult = m_aRedlines.back( );
2873 + else if ( m_bIsParaChange )
2874 + pResult = m_pParaRedline;
2878 +sal_Int32 DomainMapper_Impl::GetCurrentRedlineToken( )
2880 + sal_Int32 nToken = 0;
2881 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
2882 + if ( pCurrent.get( ) )
2883 + nToken = pCurrent->m_nToken;
2887 +void DomainMapper_Impl::SetCurrentRedlineAuthor( rtl::OUString sAuthor )
2889 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
2890 + if ( pCurrent.get( ) )
2891 + pCurrent->m_sAuthor = sAuthor;
2894 +void DomainMapper_Impl::SetCurrentRedlineDate( rtl::OUString sDate )
2896 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
2897 + if ( pCurrent.get( ) )
2898 + pCurrent->m_sDate = sDate;
2901 +void DomainMapper_Impl::SetCurrentRedlineId( sal_Int32 sId )
2903 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
2904 + if ( pCurrent.get( ) )
2905 + pCurrent->m_nId = sId;
2908 +void DomainMapper_Impl::SetCurrentRedlineToken( sal_Int32 nToken )
2910 + RedlineParamsPtr pCurrent( GetTopRedline( ) );
2911 + if ( pCurrent.get( ) )
2912 + pCurrent->m_nToken = nToken;
2915 /*-- 19.03.2008 11:35:38---------------------------------------------------
2917 -----------------------------------------------------------------------*/
2918 -void DomainMapper_Impl::ResetRedlineProperties()
2919 +void DomainMapper_Impl::RemoveCurrentRedline( )
2921 - m_CurrentRedlineAuthor = m_CurrentRedlineDate = m_CurrentRedlineId = ::rtl::OUString();
2922 - n_CurrentRedlineToken = ooxml::OOXML_mod;
2923 + if ( m_aRedlines.size( ) > 0 )
2926 + clog << "REDLINE: Removing back redline" << endl;
2928 + m_aRedlines.pop_back( );
2932 +void DomainMapper_Impl::ResetParaRedline( )
2934 + if ( m_pParaRedline.get( ) )
2937 + clog << "REDLINE: Cleaning the para redline" << endl;
2939 + RedlineParamsPtr pEmpty;
2940 + m_pParaRedline.swap( pEmpty );
2945 diff --git writerfilter/source/dmapper/DomainMapper_Impl.hxx writerfilter/source/dmapper/DomainMapper_Impl.hxx
2946 index f4dfaf0..b120a96 100644
2947 --- writerfilter/source/dmapper/DomainMapper_Impl.hxx
2948 +++ writerfilter/source/dmapper/DomainMapper_Impl.hxx
2950 #include <com/sun/star/text/XTextCursor.hpp>
2951 #include <com/sun/star/text/XTextAppend.hpp>
2952 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
2953 +#include <com/sun/star/text/XTextFrame.hpp>
2954 #include <com/sun/star/style/TabStop.hpp>
2955 #include <com/sun/star/container/XNameContainer.hpp>
2958 #include <LFOTable.hxx>
2959 #include <StyleSheetTable.hxx>
2960 #include <ThemeTable.hxx>
2961 +#include <SettingsTable.hxx>
2962 #include <GraphicImport.hxx>
2963 #include <OLEHandler.hxx>
2965 @@ -177,6 +179,7 @@ typedef std::stack<ContextType> ContextStack;
2966 typedef std::stack<PropertyMapPtr> PropertyStack;
2967 typedef std::stack< TextAppendContext > TextAppendStack;
2968 typedef std::stack<FieldContextPtr> FieldStack;
2969 +typedef std::stack< com::sun::star::uno::Reference< com::sun::star::text::XTextContent > > TextContentStack;
2971 /*-- 18.07.2006 08:49:08---------------------------------------------------
2973 @@ -225,6 +228,15 @@ struct BookmarkInsertPosition
2977 +struct RedlineParams
2979 + ::rtl::OUString m_sAuthor;
2980 + ::rtl::OUString m_sDate;
2982 + sal_Int32 m_nToken;
2984 +typedef boost::shared_ptr< RedlineParams > RedlineParamsPtr;
2986 /*-- 03.03.2008 11:01:38---------------------------------------------------
2988 -----------------------------------------------------------------------*/
2989 @@ -267,12 +279,17 @@ private:
2991 TextAppendStack m_aTextAppendStack;
2996 FieldStack m_aFieldStack;
2998 bool m_bSetUserFieldContent;
2999 bool m_bIsFirstSection;
3000 bool m_bIsColumnBreakDeferred;
3001 bool m_bIsPageBreakDeferred;
3002 + bool m_bIsInShape;
3003 + bool m_bShapeContextAdded;
3005 LineNumberSettings m_aLineNumberSettings;
3007 @@ -293,6 +310,7 @@ private:
3008 StyleSheetTablePtr m_pStyleSheetTable;
3009 ThemeTablePtr m_pThemeTable;
3010 GraphicImportPtr m_pGraphicImport;
3011 + SettingsTablePtr m_pSettingsTable;
3013 PropertyMapPtr m_pTopContext;
3015 @@ -311,14 +329,11 @@ private:
3016 ::com::sun::star::uno::Reference< text::XTextRange > m_xFrameStartRange;
3017 ::com::sun::star::uno::Reference< text::XTextRange > m_xFrameEndRange;
3020 - ::rtl::OUString m_CurrentRedlineAuthor;
3021 - ::rtl::OUString m_CurrentRedlineDate;
3022 - ::rtl::OUString m_CurrentRedlineId;
3023 - sal_Int32 n_CurrentRedlineToken;
3025 + std::vector< RedlineParamsPtr > m_aRedlines;
3026 + RedlineParamsPtr m_pParaRedline;
3027 + bool m_bIsParaChange;
3030 - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xTemporaryShape;
3033 uno::Reference< beans::XPropertySet > m_xAnnotationField;
3034 @@ -357,6 +372,15 @@ public:
3036 void SetDocumentSettingsProperty( const ::rtl::OUString& rPropName, const uno::Any& rValue );
3038 + void CreateRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange, RedlineParamsPtr& pRedline );
3040 + void CheckParaRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange );
3042 + void CheckRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange );
3044 + void StartParaChange( );
3045 + void EndParaChange( );
3047 void deferBreak( BreakType deferredBreakType );
3048 bool isBreakDeferred( BreakType deferredBreakType );
3049 void clearDeferredBreaks();
3050 @@ -412,6 +436,13 @@ public:
3051 return m_pThemeTable;
3054 + SettingsTablePtr GetSettingsTable( )
3056 + if ( !m_pSettingsTable )
3057 + m_pSettingsTable.reset( new SettingsTable );
3058 + return m_pSettingsTable;
3061 GraphicImportPtr GetGraphicImport( GraphicImportType eGraphicImportType );
3062 void ResetGraphicImport();
3063 // this method deletes the current m_pGraphicImport after import
3064 @@ -432,10 +463,8 @@ public:
3065 void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;}
3066 bool IsAnyTableImport()const { return m_bInAnyTableImport;}
3068 - void PushShapeContext();
3069 + void PushShapeContext( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
3070 void PopShapeContext();
3071 - bool IsInShapeContext() const { return m_xTemporaryShape.is(); }
3072 - void CopyTemporaryShapeText( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
3074 void PushPageHeader(SectionPropertyMap::PageType eType);
3075 void PushPageFooter(SectionPropertyMap::PageType eType);
3076 @@ -495,19 +524,17 @@ public:
3078 bool ExecuteFrameConversion();
3080 - ::rtl::OUString GetCurrentRedlineAuthor() const { return m_CurrentRedlineAuthor; }
3081 - void SetCurrentRedlineAuthor( const ::rtl::OUString& rSet ) { m_CurrentRedlineAuthor = rSet; }
3083 - ::rtl::OUString GetCurrentRedlineDate() const { return m_CurrentRedlineDate; }
3084 - void SetCurrentRedlineDate( const ::rtl::OUString& rSet ) { m_CurrentRedlineDate = rSet; }
3086 - ::rtl::OUString GetCurrentRedlineId() const { return m_CurrentRedlineId; }
3087 - void SetCurrentRedlineId( const ::rtl::OUString& rSet ) { m_CurrentRedlineId = rSet; }
3088 + void AddNewRedline( );
3090 - sal_Int32 GetCurrentRedlineToken() const { return n_CurrentRedlineToken; }
3091 - void SetCurrentRedlineToken(sal_Int32 nSet) { n_CurrentRedlineToken = nSet; }
3092 + RedlineParamsPtr GetTopRedline( );
3094 - void ResetRedlineProperties();
3095 + sal_Int32 GetCurrentRedlineToken( );
3096 + void SetCurrentRedlineAuthor( rtl::OUString sAuthor );
3097 + void SetCurrentRedlineDate( rtl::OUString sDate );
3098 + void SetCurrentRedlineId( sal_Int32 nId );
3099 + void SetCurrentRedlineToken( sal_Int32 nToken );
3100 + void RemoveCurrentRedline( );
3101 + void ResetParaRedline( );
3104 } //namespace dmapper
3105 diff --git writerfilter/source/dmapper/FontTable.cxx writerfilter/source/dmapper/FontTable.cxx
3106 index 7e3251d..16be55d 100644
3107 --- writerfilter/source/dmapper/FontTable.cxx
3108 +++ writerfilter/source/dmapper/FontTable.cxx
3109 @@ -647,6 +647,15 @@ void FontTable::substream(Id, ::writerfilter::Reference<Stream>::Pointer_t)
3110 void FontTable::info(const string& )
3114 +void FontTable::startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > )
3118 +void FontTable::endShape( )
3122 /*-- 21.06.2006 11:21:38---------------------------------------------------
3124 -----------------------------------------------------------------------*/
3125 diff --git writerfilter/source/dmapper/FontTable.hxx writerfilter/source/dmapper/FontTable.hxx
3126 index 498e816..f6e8859 100644
3127 --- writerfilter/source/dmapper/FontTable.hxx
3128 +++ writerfilter/source/dmapper/FontTable.hxx
3129 @@ -98,6 +98,8 @@ public:
3130 virtual void substream(Id name,
3131 ::writerfilter::Reference<Stream>::Pointer_t ref);
3132 virtual void info(const string & info);
3133 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
3134 + virtual void endShape( );
3136 const FontEntry* getFontEntry(sal_uInt32 nIndex);
3138 diff --git writerfilter/source/dmapper/GraphicHelpers.cxx writerfilter/source/dmapper/GraphicHelpers.cxx
3139 new file mode 100644
3140 index 0000000..a9508c5
3142 +++ writerfilter/source/dmapper/GraphicHelpers.cxx
3144 +#include "ConversionHelper.hxx"
3145 +#include "GraphicHelpers.hxx"
3147 +#include <ooxml/resourceids.hxx>
3149 +#include <com/sun/star/text/HoriOrientation.hpp>
3150 +#include <com/sun/star/text/VertOrientation.hpp>
3151 +#include <com/sun/star/text/RelOrientation.hpp>
3152 +#include <com/sun/star/text/WrapTextMode.hpp>
3154 +#include <iostream>
3155 +using namespace std;
3157 +namespace writerfilter {
3158 +namespace dmapper {
3160 +using namespace com::sun::star;
3162 +PositionHandler::PositionHandler( ) :
3165 + m_nOrient = text::VertOrientation::NONE;
3166 + m_nRelation = text::RelOrientation::FRAME;
3170 +PositionHandler::~PositionHandler( )
3174 +void PositionHandler::attribute( Id aName, Value& rVal )
3176 + sal_Int32 nIntValue = rVal.getInt( );
3179 + case NS_ooxml::LN_CT_PosV_relativeFrom:
3181 + // TODO There are some other unhandled values
3182 + static Id pVertRelValues[] =
3184 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_margin,
3185 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page,
3186 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_paragraph,
3187 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_line
3190 + static sal_Int16 pVertRelations[] =
3192 + text::RelOrientation::PAGE_PRINT_AREA,
3193 + text::RelOrientation::PAGE_FRAME,
3194 + text::RelOrientation::FRAME,
3195 + text::RelOrientation::TEXT_LINE
3198 + for ( int i = 0; i < 4; i++ )
3200 + if ( pVertRelValues[i] == sal_uInt32( nIntValue ) )
3201 + m_nRelation = pVertRelations[i];
3205 + case NS_ooxml::LN_CT_PosH_relativeFrom:
3207 + // TODO There are some other unhandled values
3208 + static Id pHoriRelValues[] =
3210 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_margin,
3211 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page,
3212 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_column,
3213 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_character
3216 + static sal_Int16 pHoriRelations[] =
3218 + text::RelOrientation::PAGE_PRINT_AREA,
3219 + text::RelOrientation::PAGE_FRAME,
3220 + text::RelOrientation::FRAME,
3221 + text::RelOrientation::CHAR,
3224 + for ( int i = 0; i < 4; i++ )
3226 + if ( pHoriRelValues[i] == sal_uInt32( nIntValue ) )
3227 + m_nRelation = pHoriRelations[i];
3235 +void PositionHandler::sprm( Sprm& rSprm )
3237 + Value::Pointer_t pValue = rSprm.getValue();
3238 + sal_Int32 nIntValue = pValue->getInt();
3240 + switch ( rSprm.getId( ) )
3242 + case NS_ooxml::LN_CT_PosV_align:
3244 + static Id pVertValues[] =
3246 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_top,
3247 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_bottom,
3248 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_center,
3249 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_inside,
3250 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignV_outside
3253 + static sal_Int16 pVertOrients[] =
3255 + text::VertOrientation::TOP,
3256 + text::VertOrientation::BOTTOM,
3257 + text::VertOrientation::CENTER,
3258 + text::VertOrientation::NONE,
3259 + text::VertOrientation::NONE
3262 + for ( int i = 0; i < 5; i++ )
3264 + if ( pVertValues[i] == sal_uInt32( nIntValue ) )
3265 + m_nOrient = pVertOrients[i];
3269 + case NS_ooxml::LN_CT_PosH_align:
3271 + static Id pHoriValues[] =
3273 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_left,
3274 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_right,
3275 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_center,
3276 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_inside,
3277 + NS_ooxml::LN_Value_wordprocessingDrawing_ST_AlignH_outside
3280 + static sal_Int16 pHoriOrients[] =
3282 + text::HoriOrientation::LEFT,
3283 + text::HoriOrientation::RIGHT,
3284 + text::HoriOrientation::CENTER,
3285 + text::HoriOrientation::INSIDE,
3286 + text::HoriOrientation::OUTSIDE
3289 + for ( int i = 0; i < 5; i++ )
3291 + if ( pHoriValues[i] == sal_uInt32( nIntValue ) )
3292 + m_nOrient = pHoriOrients[i];
3296 + case NS_ooxml::LN_CT_PosH_posOffset:
3297 + case NS_ooxml::LN_CT_PosV_posOffset:
3298 + m_nPosition = ConversionHelper::convertEMUToMM100( nIntValue );
3303 +WrapHandler::WrapHandler( ) :
3310 +WrapHandler::~WrapHandler( )
3314 +void WrapHandler::attribute( Id aName, Value& rVal )
3318 + case NS_ooxml::LN_CT_Wrap_type:
3319 + m_nType = sal_Int32( rVal.getInt( ) );
3321 + case NS_ooxml::LN_CT_Wrap_side:
3322 + m_nSide = sal_Int32( rVal.getInt( ) );
3328 +void WrapHandler::sprm( Sprm& )
3332 +sal_Int32 WrapHandler::getWrapMode( )
3334 + sal_Int32 nMode = com::sun::star::text::WrapTextMode_NONE;
3336 + switch ( m_nType )
3338 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_square:
3339 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_tight:
3341 + switch ( m_nSide )
3343 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapSide_left:
3344 + nMode = com::sun::star::text::WrapTextMode_LEFT;
3346 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapSide_right:
3347 + nMode = com::sun::star::text::WrapTextMode_RIGHT;
3350 + nMode = com::sun::star::text::WrapTextMode_PARALLEL;
3354 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_through:
3355 + nMode = com::sun::star::text::WrapTextMode_THROUGHT;
3357 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_topAndBottom:
3358 + case NS_ooxml::LN_Value_vml_wordprocessingDrawing_ST_WrapType_none:
3360 + nMode = com::sun::star::text::WrapTextMode_NONE;
3367 diff --git writerfilter/source/dmapper/GraphicHelpers.hxx writerfilter/source/dmapper/GraphicHelpers.hxx
3368 new file mode 100644
3369 index 0000000..5142c8b
3371 +++ writerfilter/source/dmapper/GraphicHelpers.hxx
3373 +#ifndef INCLUDED_GRAPHICHELPERS_HXX
3374 +#define INCLUDED_GRAPHICHELPERS_HXX
3376 +#include "PropertyMap.hxx"
3378 +#include <WriterFilterDllApi.hxx>
3379 +#include <resourcemodel/WW8ResourceModel.hxx>
3381 +#include <boost/shared_ptr.hpp>
3383 +namespace writerfilter {
3387 +class WRITERFILTER_DLLPRIVATE PositionHandler: public Properties
3390 + PositionHandler( );
3391 + ~PositionHandler( );
3393 + sal_Int16 m_nOrient;
3394 + sal_Int16 m_nRelation;
3395 + sal_Int32 m_nPosition;
3397 + virtual void attribute( Id aName, Value& rVal );
3398 + virtual void sprm( Sprm& rSprm );
3400 +typedef boost::shared_ptr<PositionHandler> PositionHandlerPtr;
3402 +class WRITERFILTER_DLLPRIVATE WrapHandler: public Properties
3408 + sal_Int32 m_nType;
3409 + sal_Int32 m_nSide;
3411 + sal_Int32 getWrapMode( );
3413 + virtual void attribute( Id aName, Value& rVal );
3414 + virtual void sprm( Sprm& rSprm );
3416 +typedef boost::shared_ptr<WrapHandler> WrapHandlerPtr;
3421 diff --git writerfilter/source/dmapper/GraphicImport.cxx writerfilter/source/dmapper/GraphicImport.cxx
3422 index c234d69..31519f8 100644
3423 --- writerfilter/source/dmapper/GraphicImport.cxx
3424 +++ writerfilter/source/dmapper/GraphicImport.cxx
3427 ************************************************************************/
3429 -#include <GraphicImport.hxx>
3430 +#include "GraphicImport.hxx"
3431 +#include "GraphicHelpers.hxx"
3433 #include <dmapper/DomainMapper.hxx>
3434 #include <PropertyMap.hxx>
3435 #include <doctok/resourceids.hxx>
3436 @@ -995,35 +997,79 @@ void GraphicImport::attribute(Id nName, Value & val)
3437 case NS_ooxml::LN_shape:
3438 /* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
3440 - val.getAny() >>= m_xShape;
3442 - if (m_xShape.is())
3444 - uno::Reference< beans::XPropertySet > xShapeProps
3445 - (m_xShape, uno::UNO_QUERY_THROW);
3447 - PropertyNameSupplier& rPropNameSupplier =
3448 - PropertyNameSupplier::GetPropertyNameSupplier();
3449 - xShapeProps->setPropertyValue
3450 - (rPropNameSupplier.GetName(PROP_ANCHOR_TYPE),
3452 - (text::TextContentAnchorType_AS_CHARACTER));
3453 - xShapeProps->setPropertyValue
3454 - (rPropNameSupplier.GetName(PROP_TEXT_RANGE),
3456 - (m_pImpl->rDomainMapper.GetCurrentTextRange()));
3458 - awt::Point aPoint(m_xShape->getPosition());
3459 - awt::Size aSize(m_xShape->getSize());
3461 - if (m_pImpl->isXSizeValid())
3462 - aSize.Width = m_pImpl->getXSize();
3463 - if (m_pImpl->isYSizeValis())
3464 - aSize.Height = m_pImpl->getYSize();
3466 - m_xShape->setSize(aSize);
3468 - m_pImpl->bIsGraphic = true;
3469 + uno::Reference< drawing::XShape> xShape;
3470 + val.getAny( ) >>= xShape;
3472 + if ( xShape.is( ) )
3474 + // Is it a graphic image
3475 + bool bUseShape = true;
3478 + uno::Reference< beans::XPropertySet > xShapeProps
3479 + ( xShape, uno::UNO_QUERY_THROW );
3481 + rtl::OUString sUrl;
3482 + xShapeProps->getPropertyValue( rtl::OUString::createFromAscii( "GraphicURL" ) ) >>= sUrl;
3484 + ::com::sun::star::beans::PropertyValues aMediaProperties( 1 );
3485 + aMediaProperties[0].Name = rtl::OUString::createFromAscii( "URL" );
3486 + aMediaProperties[0].Value <<= sUrl;
3488 + m_xGraphicObject = createGraphicObject( aMediaProperties );
3490 + bUseShape = !m_xGraphicObject.is( );
3494 + // Define the object size
3495 + uno::Reference< beans::XPropertySet > xGraphProps( m_xGraphicObject,
3497 + awt::Size aSize = xShape->getSize( );
3498 + xGraphProps->setPropertyValue( rtl::OUString::createFromAscii( "Height" ),
3499 + uno::makeAny( aSize.Height ) );
3500 + xGraphProps->setPropertyValue( rtl::OUString::createFromAscii( "Width" ),
3501 + uno::makeAny( aSize.Width ) );
3504 + catch( const beans::UnknownPropertyException e )
3506 + // It isn't a graphic image
3510 + m_xShape = xShape;
3513 + if ( m_xShape.is( ) )
3515 + uno::Reference< beans::XPropertySet > xShapeProps
3516 + (m_xShape, uno::UNO_QUERY_THROW);
3519 + PropertyNameSupplier& rPropNameSupplier =
3520 + PropertyNameSupplier::GetPropertyNameSupplier();
3521 + xShapeProps->setPropertyValue
3522 + (rPropNameSupplier.GetName(PROP_ANCHOR_TYPE),
3524 + (text::TextContentAnchorType_AS_CHARACTER));
3525 + xShapeProps->setPropertyValue
3526 + (rPropNameSupplier.GetName(PROP_TEXT_RANGE),
3528 + (m_pImpl->rDomainMapper.GetCurrentTextRange()));
3530 + awt::Point aPoint(m_xShape->getPosition());
3531 + awt::Size aSize(m_xShape->getSize());
3533 + if (m_pImpl->isXSizeValid())
3534 + aSize.Width = m_pImpl->getXSize();
3535 + if (m_pImpl->isYSizeValis())
3536 + aSize.Height = m_pImpl->getYSize();
3538 + m_xShape->setSize(aSize);
3540 + m_pImpl->bIsGraphic = true;
3545 @@ -1769,8 +1815,6 @@ void GraphicImport::sprm(Sprm & rSprm)
3546 case NS_ooxml::LN_CT_NonVisualGraphicFrameProperties_graphicFrameLocks:// 90657
3547 case NS_ooxml::LN_CT_Inline_a_graphic:// 90915
3548 case NS_ooxml::LN_CT_Anchor_simplePos_elem: // 90975;
3549 - case NS_ooxml::LN_CT_Anchor_positionH: // 90976;
3550 - case NS_ooxml::LN_CT_Anchor_positionV: // 90977;
3551 case NS_ooxml::LN_CT_Anchor_extent: // 90978;
3552 case NS_ooxml::LN_CT_Anchor_effectExtent: // 90979;
3553 case NS_ooxml::LN_EG_WrapType_wrapSquare: // 90945;
3554 @@ -1791,6 +1835,36 @@ void GraphicImport::sprm(Sprm & rSprm)
3558 + case NS_ooxml::LN_CT_Anchor_positionH: // 90976;
3560 + // Use a special handler for the positionning
3561 + PositionHandlerPtr pHandler( new PositionHandler );
3562 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3563 + if( pProperties.get( ) )
3565 + pProperties->resolve( *pHandler );
3567 + m_pImpl->nHoriRelation = pHandler->m_nRelation;
3568 + m_pImpl->nHoriOrient = pHandler->m_nOrient;
3569 + m_pImpl->nLeftPosition = pHandler->m_nPosition;
3573 + case NS_ooxml::LN_CT_Anchor_positionV: // 90977;
3575 + // Use a special handler for the positionning
3576 + PositionHandlerPtr pHandler( new PositionHandler );
3577 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3578 + if( pProperties.get( ) )
3580 + pProperties->resolve( *pHandler );
3582 + m_pImpl->nVertRelation = pHandler->m_nRelation;
3583 + m_pImpl->nVertOrient = pHandler->m_nOrient;
3584 + m_pImpl->nTopPosition = pHandler->m_nPosition;
3591 @@ -1858,11 +1932,9 @@ void lcl_CalcCrop( sal_Int32& nCrop, sal_Int32 nRef )
3592 + (((nCrop & 0xffff) * nRef ) >> 16);
3595 -/*-- 01.11.2006 09:45:02---------------------------------------------------
3597 - -----------------------------------------------------------------------*/
3598 -void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Reference<Properties>::Pointer_t /*ref*/)
3599 +uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const beans::PropertyValues& aMediaProperties )
3601 + uno::Reference< text::XTextContent > xGraphicObject;
3604 uno::Reference< graphic::XGraphicProvider > xGraphicProvider(
3605 @@ -1870,28 +1942,22 @@ void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Referen
3606 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")),
3607 m_xComponentContext),
3608 uno::UNO_QUERY_THROW );
3609 - uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len, m_pImpl->bIsBitmap );
3611 - PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
3613 - ::com::sun::star::beans::PropertyValues aMediaProperties( 1 );
3614 - aMediaProperties[0].Name = rPropNameSupplier.GetName(PROP_INPUT_STREAM);
3615 - aMediaProperties[0].Value <<= xIStream;
3617 uno::Reference< graphic::XGraphic > xGraphic = xGraphicProvider->queryGraphic( aMediaProperties );
3622 - clog << "Graphic loaded" << endl;
3623 + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
3625 uno::Reference< beans::XPropertySet > xGraphicObjectProperties(
3626 m_xTextFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextGraphicObject"))),
3627 - uno::UNO_QUERY_THROW);
3628 + uno::UNO_QUERY_THROW);
3629 xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_GRAPHIC), uno::makeAny( xGraphic ));
3630 xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_ANCHOR_TYPE),
3631 uno::makeAny( m_pImpl->eGraphicImportType == IMPORT_AS_SHAPE || m_pImpl->eGraphicImportType == IMPORT_AS_DETECTED_ANCHOR ?
3632 text::TextContentAnchorType_AT_CHARACTER :
3633 text::TextContentAnchorType_AS_CHARACTER ));
3634 - m_xGraphicObject = uno::Reference< text::XTextContent >( xGraphicObjectProperties, uno::UNO_QUERY_THROW );
3635 + xGraphicObject = uno::Reference< text::XTextContent >( xGraphicObjectProperties, uno::UNO_QUERY_THROW );
3637 //shapes have only one border, PICF might have four
3638 table::BorderLine aBorderLine;
3639 @@ -2083,11 +2149,28 @@ void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Referen
3643 - catch( const uno::Exception& )
3644 + catch( const uno::Exception& e )
3646 - clog << __FILE__ << __LINE__ << " failed!" << endl;
3647 + clog << __FILE__ << ":" << __LINE__ << " failed. Message :" ;
3648 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
3650 + return xGraphicObject;
3653 +/*-- 01.11.2006 09:45:02---------------------------------------------------
3655 + -----------------------------------------------------------------------*/
3656 +void GraphicImport::data(const sal_uInt8* buf, size_t len, writerfilter::Reference<Properties>::Pointer_t /*ref*/)
3658 + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
3660 + ::com::sun::star::beans::PropertyValues aMediaProperties( 1 );
3661 + aMediaProperties[0].Name = rPropNameSupplier.GetName(PROP_INPUT_STREAM);
3663 + uno::Reference< io::XInputStream > xIStream = new XInputStreamHelper( buf, len, m_pImpl->bIsBitmap );
3664 + aMediaProperties[0].Value <<= xIStream;
3666 + m_xGraphicObject = createGraphicObject( aMediaProperties );
3668 /*-- 01.11.2006 09:45:03---------------------------------------------------
3670 @@ -2161,6 +2244,15 @@ void GraphicImport::substream(Id /*name*/, ::writerfilter::Reference<Stream>::Po
3671 void GraphicImport::info(const string & /*info*/)
3675 +void GraphicImport::startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > /*xShape*/ )
3679 +void GraphicImport::endShape( )
3683 /*-- 09.08.2007 10:17:00---------------------------------------------------
3685 -----------------------------------------------------------------------*/
3686 diff --git writerfilter/source/dmapper/GraphicImport.hxx writerfilter/source/dmapper/GraphicImport.hxx
3687 index 99daac9..6ff1c3f 100644
3688 --- writerfilter/source/dmapper/GraphicImport.hxx
3689 +++ writerfilter/source/dmapper/GraphicImport.hxx
3690 @@ -51,6 +51,11 @@ namespace com{ namespace sun { namespace star {
3696 + class PropertyValue;
3697 + typedef ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > PropertyValues;
3701 namespace writerfilter {
3702 @@ -79,6 +84,9 @@ class WRITERFILTER_DLLPRIVATE GraphicImport : public Properties, public Table
3704 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> m_xShape;
3705 void ProcessShapeOptions(Value & val);
3707 + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > createGraphicObject(
3708 + const ::com::sun::star::beans::PropertyValues& aMediaProperties );
3711 explicit GraphicImport(::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > xComponentContext,
3712 @@ -112,6 +120,8 @@ public:
3713 virtual void substream(Id name,
3714 ::writerfilter::Reference<Stream>::Pointer_t ref);
3715 virtual void info(const string & info);
3716 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
3717 + virtual void endShape( );
3719 ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > GetGraphicObject();
3720 bool IsGraphic() const;
3721 diff --git writerfilter/source/dmapper/ListTable.cxx writerfilter/source/dmapper/ListTable.cxx
3722 index fefbcc1..3cee1f8 100644
3723 --- writerfilter/source/dmapper/ListTable.cxx
3724 +++ writerfilter/source/dmapper/ListTable.cxx
3726 #include <resourcemodel/WW8ResourceModel.hxx>
3728 #include <com/sun/star/container/XIndexReplace.hpp>
3729 +#include <com/sun/star/container/XNameContainer.hpp>
3730 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
3731 #include <com/sun/star/style/NumberingType.hpp>
3732 +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
3733 #include <com/sun/star/text/HoriOrientation.hpp>
3734 +#include <com/sun/star/text/PositionAndSpaceMode.hpp>
3737 #define NUMBERING_MAX_LEVELS 10
3738 @@ -139,6 +142,7 @@ class ListPropertyMap : public PropertyMap
3739 ::rtl::OUString sRGBXchNums; //LN_RGBXCHNUMS
3740 sal_Int32 nXChFollow; //LN_IXCHFOLLOW
3741 ::rtl::OUString sBulletChar;
3742 + sal_Int32 nTabstop;
3746 @@ -150,6 +154,7 @@ public:
3752 ~ListPropertyMap(){}
3754 @@ -187,6 +192,8 @@ uno::Sequence< beans::PropertyValue > ListPropertyMap::GetPropertyValuesList( P
3755 if( nNumberFormat == style::NumberingType::CHAR_SPECIAL && sBulletChar.getLength() )
3756 aNumberingProperties.push_back( MAKE_PROPVAL(PROP_BULLET_CHAR, sBulletChar.copy(0,1)));
3758 + aNumberingProperties.push_back( MAKE_PROPVAL( PROP_LISTTAB_STOP_POSITION, nTabstop ) );
3760 //TODO: handling of nFLegal?
3761 //TODO: nFNoRestart lower levels do not restart when higher levels are incremented, like:
3763 @@ -215,6 +222,9 @@ uno::Sequence< beans::PropertyValue > ListPropertyMap::GetPropertyValuesList( P
3765 switch( aMapIter->first.eId )
3768 + case PROP_INDENT_AT:
3769 + case PROP_FIRST_LINE_INDENT:
3770 case PROP_FIRST_LINE_OFFSET:
3771 case PROP_LEFT_MARGIN:
3772 aNumberingProperties.push_back(
3773 @@ -818,22 +828,27 @@ void ListTable::attribute(Id nName, Value & rVal)
3774 case NS_ooxml::LN_CT_Ind_left:
3775 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
3776 m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
3777 - PROP_LEFT_MARGIN, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
3778 + PROP_INDENT_AT, true, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ));
3780 case NS_ooxml::LN_CT_Ind_hanging:
3781 /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
3782 m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
3783 - PROP_FIRST_LINE_OFFSET, true, uno::makeAny( - ConversionHelper::convertTwipToMM100(nIntValue ) ));
3784 + PROP_FIRST_LINE_INDENT, true, uno::makeAny( - ConversionHelper::convertTwipToMM100( nIntValue ) ));
3786 + case NS_ooxml::LN_CT_Ind_firstLine:
3787 + /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
3788 + m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
3789 + PROP_FIRST_LINE_INDENT, true, uno::makeAny( ConversionHelper::convertTwipToMM100( nIntValue ) ));
3791 -// case NS_ooxml::LN_CT_Ind_firstLine:
3792 -// /* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
3793 -// m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
3794 -// PROP_FIRST_LINE_OFFSET, true, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
3796 case NS_ooxml::LN_CT_Lvl_ilvl: //overrides previous level - unsupported
3797 case NS_ooxml::LN_CT_Lvl_tplc: //template code - unsupported
3798 case NS_ooxml::LN_CT_Lvl_tentative: //marks level as unused in the document - unsupported
3799 - case NS_ooxml::LN_CT_Ind_firstLine: //todo: first line indent in numbering not yet supported
3801 + case NS_ooxml::LN_CT_TabStop_pos:
3803 + //no paragraph attributes in ListTable char style sheets
3804 + m_pImpl->m_pCurrentEntry->pCurrentProperties->nTabstop = ConversionHelper::convertTwipToMM100( nIntValue );
3809 @@ -955,7 +970,17 @@ void ListTable::sprm(Sprm & rSprm)
3812 case NS_ooxml::LN_CT_Lvl_lvlJc:
3815 + static sal_Int16 aWWAlignments[ ] =
3817 + text::HoriOrientation::LEFT,
3818 + text::HoriOrientation::CENTER,
3819 + text::HoriOrientation::RIGHT
3821 + m_pImpl->m_pCurrentEntry->pCurrentProperties->Insert(
3822 + PROP_ADJUST, true, uno::makeAny( aWWAlignments[ nIntValue ] ) );
3823 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3826 case NS_ooxml::LN_CT_Lvl_pPr:
3827 case NS_ooxml::LN_CT_PPrBase_ind:
3828 @@ -967,7 +992,12 @@ void ListTable::sprm(Sprm & rSprm)
3831 case NS_ooxml::LN_CT_PPrBase_tabs:
3832 - //no paragraph attributes in ListTable char style sheets
3833 + case NS_ooxml::LN_CT_Tabs_tab:
3835 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
3836 + if(pProperties.get())
3837 + pProperties->resolve(*this);
3840 case NS_ooxml::LN_CT_Lvl_suff:
3841 //todo: currently unsupported suffix
3842 @@ -1057,105 +1087,181 @@ sal_uInt32 ListTable::size() const
3844 return m_pImpl->m_aListEntries.size();
3846 -/*-- 26.06.2006 10:33:56---------------------------------------------------
3848 - -----------------------------------------------------------------------*/
3849 -uno::Reference< container::XIndexReplace > ListTable::GetNumberingRules(sal_Int32 nListId)
3850 +rtl::OUString ListTable::GetStyleName( sal_Int32 nListId )
3852 + rtl::OUString sStyleName( rtl::OUString::createFromAscii( "WWNum" ) );
3853 + sStyleName += rtl::OUString::valueOf( nListId + 1 );
3855 + return sStyleName;
3858 +void ListTable::CreateNumberingRules( )
3860 uno::Reference< container::XIndexReplace > xRet;
3861 std::vector< ListEntryPtr >::const_iterator aIt = m_pImpl->m_aListEntries.begin();
3862 std::vector< ListEntryPtr >::const_iterator aEndIt = m_pImpl->m_aListEntries.end();
3864 + uno::Reference< container::XNameContainer > xStyles;
3868 + uno::Reference< style::XStyleFamiliesSupplier > xFamilies( m_pImpl->m_xFactory, uno::UNO_QUERY_THROW );
3869 + uno::Any oFamily = xFamilies->getStyleFamilies( )->getByName( rtl::OUString::createFromAscii( "NumberingStyles" ) );
3871 + oFamily >>= xStyles;
3873 + catch ( const uno::Exception )
3877 for(; aIt != aEndIt; ++aIt)
3879 - if((*aIt)->nListId == nListId)
3880 + if( !(*aIt)->m_xNumRules.is() && m_pImpl->m_xFactory.is() && xStyles.is( ) )
3882 - if( !(*aIt)->m_xNumRules.is() && m_pImpl->m_xFactory.is())
3886 + // Create the numbering style
3887 + uno::Reference< beans::XPropertySet > xStyle (
3888 + m_pImpl->m_xFactory->createInstance(
3889 + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.NumberingStyle"))),
3890 + uno::UNO_QUERY_THROW );
3892 + rtl::OUString sStyleName = GetStyleName( ( *aIt )->nListId );
3894 + clog << "Creating numbering style: ";
3895 + clog << rtl::OUStringToOString( sStyleName, RTL_TEXTENCODING_UTF8 ).getStr( );
3899 + xStyles->insertByName( sStyleName, makeAny( xStyle ) );
3901 + uno::Any oStyle = xStyles->getByName( sStyleName );
3902 + xStyle.set( oStyle, uno::UNO_QUERY_THROW );
3904 + PropertyNameSupplier& aPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
3905 + uno::Any aRules = xStyle->getPropertyValue( aPropNameSupplier.GetName( PROP_NUMBERING_RULES ) );
3906 + aRules >>= ( *aIt )->m_xNumRules;
3908 + //now fill the numbering levels appropriately
3909 + ::std::vector< ListPropertyMapPtr >::const_iterator aIter = (*aIt)->aLevelProperties.begin();
3910 + ::std::vector< ListPropertyMapPtr >::const_iterator aEnd = (*aIt)->aLevelProperties.end();
3911 + sal_Int32 nLevel = 0;
3912 + while(aIter != aEnd)
3914 - (*aIt)->m_xNumRules = uno::Reference< container::XIndexReplace >(
3915 - m_pImpl->m_xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules"))),
3916 - uno::UNO_QUERY_THROW);
3918 - //now fill the numbering levels appropriately
3919 - ::std::vector< ListPropertyMapPtr >::const_iterator aIter = (*aIt)->aLevelProperties.begin();
3920 - ::std::vector< ListPropertyMapPtr >::const_iterator aEnd = (*aIt)->aLevelProperties.end();
3921 - sal_Int32 nLevel = 0;
3922 - PropertyNameSupplier& aPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
3923 - while(aIter != aEnd)
3924 + PropertyValueVector_t aCharStyleProperties;
3925 + uno::Sequence< beans::PropertyValue> aValues = (*aIter)->GetPropertyValuesList(aCharStyleProperties);
3926 + if( aCharStyleProperties.size() )
3928 - PropertyValueVector_t aCharStyleProperties;
3929 - uno::Sequence< beans::PropertyValue> aValues = (*aIter)->GetPropertyValuesList(aCharStyleProperties);
3930 - if( aCharStyleProperties.size() )
3932 - //create (or find) a character style containing the character attributes of the symbol
3933 - //and apply it to the numbering level
3934 - ::rtl::OUString sStyle = m_pImpl->m_rDMapper.getOrCreateCharStyle( aCharStyleProperties );
3935 - aValues.realloc( aValues.getLength() + 1);
3936 - aValues[aValues.getLength() - 1].Name = aPropNameSupplier.GetName( PROP_CHAR_STYLE_NAME );
3937 - aValues[aValues.getLength() - 1].Value <<= sStyle;
3939 - //now parse the text to find %n from %1 to %nLevel+1
3940 - //everything before the first % and the last %x is prefix and suffix
3941 - ::rtl::OUString sLevelText( (*aIter)->sBulletChar );
3942 - sal_Int32 nCurrentIndex = 0;
3943 - sal_Int32 nFound = sLevelText.indexOf( '%', nCurrentIndex );
3946 - ::rtl::OUString sPrefix = sLevelText.copy( 0, nFound );
3947 - aValues.realloc( aValues.getLength() + 1 );
3948 - aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL(PROP_PREFIX, sPrefix);
3949 - sLevelText = sLevelText.copy( nFound );
3951 - sal_Int32 nMinLevel = nLevel;
3952 - //now the text should either be empty or start with %
3954 - while( nFound >= 0 )
3955 + //create (or find) a character style containing the character attributes of the symbol
3956 + //and apply it to the numbering level
3957 + ::rtl::OUString sStyle = m_pImpl->m_rDMapper.getOrCreateCharStyle( aCharStyleProperties );
3958 + aValues.realloc( aValues.getLength() + 1);
3959 + aValues[aValues.getLength() - 1].Name = aPropNameSupplier.GetName( PROP_CHAR_STYLE_NAME );
3960 + aValues[aValues.getLength() - 1].Value <<= sStyle;
3962 + //now parse the text to find %n from %1 to %nLevel+1
3963 + //everything before the first % and the last %x is prefix and suffix
3964 + ::rtl::OUString sLevelText( (*aIter)->sBulletChar );
3965 + sal_Int32 nCurrentIndex = 0;
3966 + sal_Int32 nFound = sLevelText.indexOf( '%', nCurrentIndex );
3969 + ::rtl::OUString sPrefix = sLevelText.copy( 0, nFound );
3970 + aValues.realloc( aValues.getLength() + 1 );
3971 + aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL(PROP_PREFIX, sPrefix);
3972 + sLevelText = sLevelText.copy( nFound );
3974 + sal_Int32 nMinLevel = nLevel;
3975 + //now the text should either be empty or start with %
3977 + while( nFound >= 0 )
3979 + if( sLevelText.getLength() > 1 )
3981 - if( sLevelText.getLength() > 1 )
3982 + sal_Unicode cLevel = sLevelText.getStr()[1];
3983 + if( cLevel >= '1' && cLevel <= '9' )
3985 - sal_Unicode cLevel = sLevelText.getStr()[1];
3986 - if( cLevel >= '1' && cLevel <= '9' )
3988 - if( cLevel - '1' < nMinLevel )
3989 - nMinLevel = cLevel - '1';
3990 - //remove first char - next char is removed later
3991 - sLevelText = sLevelText.copy( 1 );
3994 - //remove old '%' or number
3995 - sLevelText = sLevelText.copy( 1 );
3996 - nCurrentIndex = 0;
3997 - nFound = sLevelText.indexOf( '%', nCurrentIndex );
3998 - //remove the text before the next %
4000 - sLevelText = sLevelText.copy( nFound -1 );
4002 - if( nMinLevel < nLevel )
4004 - aValues.realloc( aValues.getLength() + 1);
4005 - aValues[ aValues.getLength() - 1 ] =
4006 - MAKE_PROPVAL(PROP_PARENT_NUMBERING, sal_Int16( nLevel - nMinLevel ));
4008 - if( sLevelText.getLength() )
4010 - aValues.realloc( aValues.getLength() + 1);
4011 - aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL(PROP_SUFFIX, sLevelText);
4012 + if( cLevel - '1' < nMinLevel )
4013 + nMinLevel = cLevel - '1';
4014 + //remove first char - next char is removed later
4015 + sLevelText = sLevelText.copy( 1 );
4019 - (*aIt)->m_xNumRules->replaceByIndex(nLevel, uno::makeAny(aValues));
4023 + //remove old '%' or number
4024 + sLevelText = sLevelText.copy( 1 );
4025 + nCurrentIndex = 0;
4026 + nFound = sLevelText.indexOf( '%', nCurrentIndex );
4027 + //remove the text before the next %
4029 + sLevelText = sLevelText.copy( nFound -1 );
4031 + if( nMinLevel < nLevel )
4033 + aValues.realloc( aValues.getLength() + 1);
4034 + aValues[ aValues.getLength() - 1 ] =
4035 + MAKE_PROPVAL(PROP_PARENT_NUMBERING, sal_Int16( nLevel - nMinLevel + 1));
4037 + aValues.realloc( aValues.getLength() + 1);
4038 + aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL(PROP_SUFFIX, sLevelText);
4041 - catch( const uno::Exception& rEx)
4042 + aValues.realloc( aValues.getLength() + 1);
4043 + aValues[ aValues.getLength() - 1 ] = MAKE_PROPVAL( PROP_POSITION_AND_SPACE_MODE,
4044 + sal_Int16( text::PositionAndSpaceMode::LABEL_ALIGNMENT ) );
4047 + clog << endl << "Numbering rule properties - " << nLevel << endl;
4048 + for ( sal_Int32 i = 0, len = aValues.getLength( ); i < len; i++ )
4051 - OSL_ENSURE( false, "ListTable::GetNumberingRules");
4052 + beans::PropertyValue aVal = aValues[i];
4053 + clog << " " << rtl::OUStringToOString( aVal.Name, RTL_TEXTENCODING_UTF8 ).getStr( );
4055 + rtl::OUString sVal;
4057 + if ( aVal.Value >>= sVal )
4059 + clog << rtl::OUStringToOString( sVal, RTL_TEXTENCODING_UTF8 ).getStr( );
4061 + else if ( aVal.Value >>= nVal )
4069 + (*aIt)->m_xNumRules->replaceByIndex(nLevel, uno::makeAny(aValues));
4074 + // Create the numbering style for these rules
4075 + rtl::OUString sNumRulesName = aPropNameSupplier.GetName( PROP_NUMBERING_RULES );
4076 + xStyle->setPropertyValue(
4078 + uno::makeAny( ( *aIt )->m_xNumRules ) );
4080 + catch( const uno::Exception& rEx)
4083 + OSL_ENSURE( false, "ListTable::CreateNumberingRules");
4089 +/*-- 26.06.2006 10:33:56---------------------------------------------------
4091 + -----------------------------------------------------------------------*/
4092 +uno::Reference< container::XIndexReplace > ListTable::GetNumberingRules(sal_Int32 nListId)
4094 + uno::Reference< container::XIndexReplace > xRet;
4095 + std::vector< ListEntryPtr >::const_iterator aIt = m_pImpl->m_aListEntries.begin();
4096 + std::vector< ListEntryPtr >::const_iterator aEndIt = m_pImpl->m_aListEntries.end();
4097 + for(; aIt != aEndIt; ++aIt)
4099 + if((*aIt)->nListId == nListId)
4101 xRet = (*aIt)->m_xNumRules;
4104 diff --git writerfilter/source/dmapper/ListTable.hxx writerfilter/source/dmapper/ListTable.hxx
4105 index c42515a..65cc216 100644
4106 --- writerfilter/source/dmapper/ListTable.hxx
4107 +++ writerfilter/source/dmapper/ListTable.hxx
4108 @@ -78,6 +78,8 @@ public:
4109 // writerfilter::Reference<Properties>::Pointer_t ref);
4111 sal_uInt32 size() const;
4112 + rtl::OUString GetStyleName( sal_Int32 nListId );
4113 + void CreateNumberingRules( );
4114 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace >
4115 GetNumberingRules(sal_Int32 nListId);
4117 diff --git writerfilter/source/dmapper/OLEHandler.cxx writerfilter/source/dmapper/OLEHandler.cxx
4118 index 465410e..491a1c3 100644
4119 --- writerfilter/source/dmapper/OLEHandler.cxx
4120 +++ writerfilter/source/dmapper/OLEHandler.cxx
4122 ************************************************************************/
4123 #include <OLEHandler.hxx>
4124 #include <PropertyMap.hxx>
4125 +#include "GraphicHelpers.hxx"
4127 #include <doctok/resourceids.hxx>
4128 #include <ooxml/resourceids.hxx>
4129 #include <com/sun/star/beans/PropertyValue.hpp>
4130 @@ -54,7 +56,8 @@ using namespace ::com::sun::star;
4131 -----------------------------------------------------------------------*/
4132 OLEHandler::OLEHandler() :
4139 /*-- 23.04.2008 10:46:14---------------------------------------------------
4140 @@ -108,15 +111,28 @@ void OLEHandler::attribute(Id rName, Value & rVal)
4141 rVal.getAny() >>= xTempShape;
4142 if( xTempShape.is() )
4144 - m_aShapeSize = xTempShape->getSize();
4145 - m_aShapePosition = xTempShape->getPosition();
4146 + m_xShape.set( xTempShape );
4150 + m_aShapeSize = xTempShape->getSize();
4151 + m_aShapePosition = xTempShape->getPosition();
4153 uno::Reference< beans::XPropertySet > xShapeProps( xTempShape, uno::UNO_QUERY_THROW );
4154 - xShapeProps->getPropertyValue( PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_BITMAP ) ) >>= m_xReplacement;
4155 + PropertyNameSupplier& rNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
4157 + xShapeProps->getPropertyValue( rNameSupplier.GetName( PROP_BITMAP ) ) >>= m_xReplacement;
4159 + xShapeProps->setPropertyValue(
4160 + rNameSupplier.GetName( PROP_SURROUND ),
4161 + uno::makeAny( m_nWrapMode ) );
4163 - catch( const uno::Exception& )
4164 + catch( const uno::Exception& e )
4167 + clog << "Exception in OLE Handler: ";
4168 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
4173 @@ -142,8 +158,39 @@ void OLEHandler::sprm(Sprm & rSprm)
4177 + case NS_ooxml::LN_wrap_wrap:
4179 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
4180 + if ( pProperties.get( ) )
4182 + WrapHandlerPtr pHandler( new WrapHandler );
4183 + pProperties->resolve( *pHandler );
4185 + m_nWrapMode = pHandler->getWrapMode( );
4189 + uno::Reference< beans::XPropertySet > xShapeProps( m_xShape, uno::UNO_QUERY_THROW );
4190 + PropertyNameSupplier& rNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
4192 + xShapeProps->setPropertyValue(
4193 + rNameSupplier.GetName( PROP_SURROUND ),
4194 + uno::makeAny( m_nWrapMode ) );
4196 + catch( const uno::Exception& e )
4199 + clog << "Exception in OLE Handler: ";
4200 + clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
4208 OSL_ENSURE( false, "unknown attribute");
4212 /*-- 23.04.2008 11:15:19---------------------------------------------------
4213 @@ -152,9 +199,10 @@ void OLEHandler::sprm(Sprm & rSprm)
4214 ::rtl::OUString OLEHandler::copyOLEOStream( uno::Reference< text::XTextDocument > xTextDocument )
4216 ::rtl::OUString sRet;
4217 - if( !m_xInputStream.is() )
4218 + if( !m_xInputStream.is( ) )
4223 uno::Reference < lang::XMultiServiceFactory > xFactory(xTextDocument, uno::UNO_QUERY_THROW);
4224 uno::Reference< document::XEmbeddedObjectResolver > xEmbeddedResolver(
4225 xFactory->createInstance(
4226 diff --git writerfilter/source/dmapper/OLEHandler.hxx writerfilter/source/dmapper/OLEHandler.hxx
4227 index c56358a..d65035f 100644
4228 --- writerfilter/source/dmapper/OLEHandler.hxx
4229 +++ writerfilter/source/dmapper/OLEHandler.hxx
4231 #include <com/sun/star/awt/Size.hpp>
4232 #include <com/sun/star/awt/Point.hpp>
4234 +#include <com/sun/star/drawing/XShape.hpp>
4236 namespace com{ namespace sun{ namespace star{
4238 class XEmbeddedObject;
4239 @@ -72,6 +74,9 @@ class WRITERFILTER_DLLPRIVATE OLEHandler : public Properties
4241 sal_Int32 m_nDxaOrig;
4242 sal_Int32 m_nDyaOrig;
4243 + sal_Int32 m_nWrapMode;
4245 + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xShape;
4247 ::com::sun::star::awt::Size m_aShapeSize;
4248 ::com::sun::star::awt::Point m_aShapePosition;
4249 @@ -87,6 +92,10 @@ public:
4250 virtual void attribute(Id Name, Value & val);
4251 virtual void sprm(Sprm & sprm);
4253 + inline ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getShape( ) { return m_xShape; };
4255 + inline bool isOLEObject( ) { return m_xInputStream.is( ); };
4257 ::rtl::OUString copyOLEOStream( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > xTextDocument );
4259 ::com::sun::star::awt::Size getSize() const { return m_aShapeSize;}
4260 diff --git writerfilter/source/dmapper/PageBordersHandler.cxx writerfilter/source/dmapper/PageBordersHandler.cxx
4261 new file mode 100644
4262 index 0000000..5280697
4264 +++ writerfilter/source/dmapper/PageBordersHandler.cxx
4266 +#include "PageBordersHandler.hxx"
4268 +#include <ooxml/resourceids.hxx>
4270 +namespace writerfilter {
4271 +namespace dmapper {
4273 +_PgBorder::_PgBorder( ) :
4275 + m_ePos( BORDER_RIGHT )
4279 +_PgBorder::~_PgBorder( )
4283 +PageBordersHandler::PageBordersHandler( ) :
4289 +PageBordersHandler::~PageBordersHandler( )
4293 +void PageBordersHandler::attribute( Id eName, Value& rVal )
4295 + int nIntValue = rVal.getInt( );
4298 + case NS_ooxml::LN_CT_PageBorders_display:
4300 + switch ( nIntValue )
4303 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_allPages:
4306 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_firstPage:
4309 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderDisplay_notFirstPage:
4315 + case NS_ooxml::LN_CT_PageBorders_offsetFrom:
4317 + switch ( nIntValue )
4320 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderOffset_page:
4323 + case NS_ooxml::LN_Value_wordprocessingml_ST_PageBorderOffset_text:
4333 +void PageBordersHandler::sprm( Sprm& rSprm )
4335 + switch ( rSprm.getId( ) )
4337 + case NS_ooxml::LN_CT_PageBorders_top:
4338 + case NS_ooxml::LN_CT_PageBorders_left:
4339 + case NS_ooxml::LN_CT_PageBorders_bottom:
4340 + case NS_ooxml::LN_CT_PageBorders_right:
4342 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
4343 + if( pProperties.get())
4345 + BorderHandlerPtr pBorderHandler( new BorderHandler( true ) );
4346 + pProperties->resolve(*pBorderHandler);
4347 + BorderPosition ePos = BorderPosition( 0 );
4348 + switch( rSprm.getId( ) )
4350 + case NS_ooxml::LN_CT_PageBorders_top:
4351 + ePos = BORDER_TOP;
4353 + case NS_ooxml::LN_CT_PageBorders_left:
4354 + ePos = BORDER_LEFT;
4356 + case NS_ooxml::LN_CT_PageBorders_bottom:
4357 + ePos = BORDER_BOTTOM;
4359 + case NS_ooxml::LN_CT_PageBorders_right:
4360 + ePos = BORDER_RIGHT;
4365 + _PgBorder aPgBorder;
4366 + aPgBorder.m_rLine = pBorderHandler->getBorderLine( );
4367 + aPgBorder.m_nDistance = pBorderHandler->getLineDistance( );
4368 + aPgBorder.m_ePos = ePos;
4369 + m_aBorders.push_back( aPgBorder );
4377 +void PageBordersHandler::SetBorders( SectionPropertyMap* pSectContext )
4379 + for ( int i = 0, length = m_aBorders.size( ); i < length; i++ )
4381 + _PgBorder aBorder = m_aBorders[i];
4382 + pSectContext->SetBorder( aBorder.m_ePos, aBorder.m_nDistance, aBorder.m_rLine );
4387 diff --git writerfilter/source/dmapper/PageBordersHandler.hxx writerfilter/source/dmapper/PageBordersHandler.hxx
4388 new file mode 100644
4389 index 0000000..5f501d2
4391 +++ writerfilter/source/dmapper/PageBordersHandler.hxx
4393 +#ifndef INCLUDED_PAGEBORDERSHANDLER_HXX
4394 +#define INCLUDED_PAGEBORDERSHANDLER_HXX
4396 +#include "BorderHandler.hxx"
4397 +#include "PropertyMap.hxx"
4399 +#include <WriterFilterDllApi.hxx>
4400 +#include <resourcemodel/WW8ResourceModel.hxx>
4401 +#include <boost/shared_ptr.hpp>
4403 +#include <com/sun/star/table/BorderLine.hpp>
4407 +using namespace std;
4409 +namespace writerfilter {
4410 +namespace dmapper {
4415 + com::sun::star::table::BorderLine m_rLine;
4416 + sal_Int32 m_nDistance;
4417 + BorderPosition m_ePos;
4423 +class WRITERFILTER_DLLPRIVATE PageBordersHandler : public Properties
4427 + // See implementation of SectionPropertyMap::ApplyBorderToPageStyles
4428 + sal_Int32 m_nDisplay;
4429 + sal_Int32 m_nOffset;
4430 + vector<_PgBorder> m_aBorders;
4433 + PageBordersHandler( );
4434 + ~PageBordersHandler( );
4437 + virtual void attribute( Id eName, Value& rVal );
4438 + virtual void sprm( Sprm& rSprm );
4440 + inline sal_Int32 GetDisplayOffset( )
4442 + return ( m_nOffset << 5 ) + m_nDisplay;
4444 + void SetBorders( SectionPropertyMap* pSectContext );
4446 +typedef boost::shared_ptr< PageBordersHandler > PageBordersHandlerPtr;
4451 diff --git writerfilter/source/dmapper/PropertyIds.cxx writerfilter/source/dmapper/PropertyIds.cxx
4452 index f74cb57..bc76be7 100644
4453 --- writerfilter/source/dmapper/PropertyIds.cxx
4454 +++ writerfilter/source/dmapper/PropertyIds.cxx
4455 @@ -315,9 +315,12 @@ const rtl::OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
4456 case PROP_STREAM_NAME: sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamName")); break;
4457 case PROP_BITMAP : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Bitmap")); break;
4458 case PROP_IS_DATE : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsDate")); break;
4459 -// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
4460 -// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
4461 -// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
4462 + case PROP_CNF_STYLE : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CnfStyle")); break;
4463 + case PROP_INDENT_AT : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IndentAt")); break;
4464 + case PROP_FIRST_LINE_INDENT : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent")); break;
4465 + case PROP_NUMBERING_STYLE_NAME : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName")); break;
4466 + case PROP_LISTTAB_STOP_POSITION : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition")); break;
4467 + case PROP_POSITION_AND_SPACE_MODE : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionAndSpaceMode")); break;
4468 // case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
4469 // case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
4470 // case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
4471 diff --git writerfilter/source/dmapper/PropertyIds.hxx writerfilter/source/dmapper/PropertyIds.hxx
4472 index c9acac7..cdbcf75 100644
4473 --- writerfilter/source/dmapper/PropertyIds.hxx
4474 +++ writerfilter/source/dmapper/PropertyIds.hxx
4475 @@ -278,6 +278,12 @@ enum PropertyIds
4476 /*239*/ ,PROP_STREAM_NAME
4477 /*240*/ ,PROP_BITMAP
4478 /*241*/ ,PROP_IS_DATE
4479 +/*242*/ ,PROP_CNF_STYLE
4480 +/*243*/ ,PROP_INDENT_AT
4481 +/*244*/ ,PROP_FIRST_LINE_INDENT
4482 +/*245*/ ,PROP_NUMBERING_STYLE_NAME
4483 +/*246*/ ,PROP_LISTTAB_STOP_POSITION
4484 +/*247*/ ,PROP_POSITION_AND_SPACE_MODE
4486 struct PropertyNameSupplier_Impl;
4487 class PropertyNameSupplier
4488 diff --git writerfilter/source/dmapper/PropertyMap.cxx writerfilter/source/dmapper/PropertyMap.cxx
4489 index 7ccf38d..861ea92 100644
4490 --- writerfilter/source/dmapper/PropertyMap.cxx
4491 +++ writerfilter/source/dmapper/PropertyMap.cxx
4492 @@ -176,6 +176,7 @@ void PropertyMap::insertTableProperties( const PropertyMap* )
4493 -----------------------------------------------------------------------*/
4494 SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
4495 m_bIsFirstSection( bIsFirstSection )
4496 + ,m_nBorderParams( 0 )
4497 ,m_bTitlePage( false )
4498 ,m_nColumnCount( 0 )
4499 ,m_nColumnDistance( 1249 )
4500 @@ -377,21 +378,6 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
4501 sal_Int32 nOffsetFrom = (nValue & 0x00E0) >> 5;
4502 //sal_Int32 bPageDepth = (nValue & 0x0018) >> 3; //unused infromation: 0 - in front 1 - in back
4503 //todo: negative spacing (from ww8par6.cxx)
4504 - if( nOffsetFrom == 1 )
4507 -// if (aBox.GetLeft())
4509 -// nDist = aBox.GetDistance(BOX_LINE_LEFT);
4510 -// lcl_MakeSafeNegativeSpacing( ) sets the distance to 0 if > SHRT_MAX
4512 -// aBox.SetDistance(lcl_MakeSafeNegativeSpacing(static_cast<USHORT>(aLR.GetLeft() - nDist)), BOX_LINE_LEFT);
4513 -// aSizeArray[WW8_LEFT] =
4514 -// aSizeArray[WW8_LEFT] - nDist + aBox.GetDistance(BOX_LINE_LEFT);
4516 - //the same for right, top, bottom
4519 switch( nValue & 0x07)
4521 case 0: /*all styles*/
4522 @@ -422,8 +408,16 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
4523 PROP_LEFT_BORDER_DISTANCE,
4524 PROP_RIGHT_BORDER_DISTANCE,
4525 PROP_TOP_BORDER_DISTANCE,
4526 - PROP_BOTTOM_BORDER_DISTANCE,
4527 + PROP_BOTTOM_BORDER_DISTANCE
4529 + static const PropertyIds aMarginIds[4] =
4532 + PROP_RIGHT_MARGIN,
4534 + PROP_BOTTOM_MARGIN
4537 PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
4538 for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder)
4540 @@ -436,19 +430,38 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
4542 if( m_nBorderDistances[nBorder] >= 0 )
4544 - const ::rtl::OUString sBorderDistanceName = rPropNameSupplier.GetName( aBorderDistanceIds[nBorder] );
4545 - xFirst->setPropertyValue( sBorderDistanceName, uno::makeAny( m_nBorderDistances[nBorder] ));
4546 + SetBorderDistance( xFirst, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
4547 + m_nBorderDistances[nBorder], nOffsetFrom );
4549 - xSecond->setPropertyValue( sBorderDistanceName, uno::makeAny( m_nBorderDistances[nBorder] ));
4550 + SetBorderDistance( xSecond, aMarginIds[nBorder], aBorderDistanceIds[nBorder],
4551 + m_nBorderDistances[nBorder], nOffsetFrom );
4556 -// rContext->Insert( aBorderIds[nId - 0x702B], uno::makeAny( aBorderLine ));
4557 -// rContext->Insert( aBorderDistanceIds[nId - 0x702B], uno::makeAny( nLineDistance) );
4559 -// uno::Reference< beans::XPropertySet > xStyle = GetPageStyle( ePageType );
4560 +void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > xStyle,
4561 + PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom )
4563 + PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
4565 + sal_Int32 nDist = nDistance;
4566 + if( nOffsetFrom == 1 )
4568 + const ::rtl::OUString sMarginName = rPropNameSupplier.GetName( eMarginId );
4569 + uno::Any aMargin = xStyle->getPropertyValue( sMarginName );
4570 + sal_Int32 nMargin;
4571 + aMargin >>= nMargin;
4573 + // Change the margins with the border distance
4574 + xStyle->setPropertyValue( sMarginName, uno::makeAny( nDistance ) );
4576 + // Set the distance to ( Margin - distance )
4577 + nDist = nMargin - nDistance;
4579 + const ::rtl::OUString sBorderDistanceName = rPropNameSupplier.GetName( eDistId );
4580 + xStyle->setPropertyValue( sBorderDistanceName, uno::makeAny( nDist ));
4583 /*-- 14.12.2006 12:50:06---------------------------------------------------
4585 -----------------------------------------------------------------------*/
4586 @@ -726,8 +739,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
4588 sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
4589 //todo: is '0' the right index here?
4590 - const StyleSheetEntry* pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(::rtl::OUString::valueOf(static_cast<sal_Int32>(0), 16));
4592 + const StyleSheetEntryPtr pEntry = rDM_Impl.GetStyleSheetTable()->FindStyleSheetByISTD(::rtl::OUString::valueOf(static_cast<sal_Int32>(0), 16));
4593 + if( pEntry.get( ) )
4595 PropertyMap::iterator aElement_ = pEntry->pProperties->find(PropertyDefinition( PROP_CHAR_HEIGHT_ASIAN, false ));
4596 if( aElement_ != pEntry->pProperties->end())
4597 @@ -766,6 +779,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
4598 uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle(
4599 rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true );
4600 _ApplyProperties( xFirstPageStyle );
4602 sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0;
4604 xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) );
4605 @@ -773,6 +787,9 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
4606 xFollowPageStyle->setPropertyValue(
4607 rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ));
4610 + ApplyBorderToPageStyles( rDM_Impl.GetPageStyles( ), rDM_Impl.GetTextFactory( ), m_nBorderParams );
4614 // if( m_xStartingRange.is() )
4615 @@ -877,7 +894,8 @@ StyleSheetPropertyMap::StyleSheetPropertyMap() :
4616 mbCT_TblWidth_wSet( false ),
4617 mbCT_TblWidth_typeSet( false ),
4620 + mnListLevel( -1 ),
4621 + mnOutlineLevel( -1 )
4624 /*-- 14.06.2007 13:57:43---------------------------------------------------
4625 diff --git writerfilter/source/dmapper/PropertyMap.hxx writerfilter/source/dmapper/PropertyMap.hxx
4626 index c6736fe..526f902 100644
4627 --- writerfilter/source/dmapper/PropertyMap.hxx
4628 +++ writerfilter/source/dmapper/PropertyMap.hxx
4629 @@ -158,6 +158,7 @@ class SectionPropertyMap : public PropertyMap
4631 ::com::sun::star::table::BorderLine* m_pBorderLines[4];
4632 sal_Int32 m_nBorderDistances[4];
4633 + sal_Int32 m_nBorderParams;
4636 sal_Int16 m_nColumnCount;
4637 @@ -202,6 +203,9 @@ class SectionPropertyMap : public PropertyMap
4638 bool HasHeader( bool bFirstPage ) const;
4639 bool HasFooter( bool bFirstPage ) const;
4641 + void SetBorderDistance( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle,
4642 + PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom );
4645 explicit SectionPropertyMap(bool bIsFirstSection);
4646 ~SectionPropertyMap();
4647 @@ -227,6 +231,7 @@ public:
4650 void SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const ::com::sun::star::table::BorderLine& rBorderLine );
4651 + void SetBorderParams( sal_Int32 nSet ) { m_nBorderParams = nSet; }
4653 void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; }
4654 void SetColumnDistance( sal_Int32 nDist ) { m_nColumnDistance = nDist; }
4655 @@ -376,6 +381,9 @@ typedef boost::shared_ptr<ParagraphProperties> ParagraphPropertiesPtr;
4656 /*-- 14.06.2007 12:12:34---------------------------------------------------
4657 property map of a stylesheet
4658 -----------------------------------------------------------------------*/
4660 +#define WW_OUTLINE_MAX sal_Int16( 9 )
4662 class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
4665 @@ -405,6 +413,8 @@ class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
4668 sal_Int16 mnListLevel;
4670 + sal_Int16 mnOutlineLevel;
4672 explicit StyleSheetPropertyMap();
4673 ~StyleSheetPropertyMap();
4674 @@ -479,6 +489,12 @@ public:
4675 sal_Int16 GetListLevel() const { return mnListLevel; }
4676 void SetListLevel(sal_Int16 nLevel) { mnListLevel = nLevel; }
4678 + sal_Int16 GetOutlineLevel() const { return mnOutlineLevel; }
4679 + void SetOutlineLevel(sal_Int16 nLevel)
4681 + if ( nLevel < WW_OUTLINE_MAX )
4682 + mnOutlineLevel = nLevel;
4685 /*-- 27.12.2007 12:38:06---------------------------------------------------
4687 diff --git writerfilter/source/dmapper/SettingsTable.cxx writerfilter/source/dmapper/SettingsTable.cxx
4688 new file mode 100644
4689 index 0000000..8811ea1
4691 +++ writerfilter/source/dmapper/SettingsTable.cxx
4693 +#include "SettingsTable.hxx"
4695 +#include <ooxml/resourceids.hxx>
4697 +#include <com/sun/star/beans/XPropertySet.hpp>
4698 +#include <com/sun/star/text/XTextDocument.hpp>
4701 +#include <iostream>
4704 +using namespace com::sun::star;
4705 +using namespace rtl;
4707 +namespace writerfilter {
4708 +namespace dmapper {
4710 +SettingsTable_Impl::SettingsTable_Impl( ) :
4711 + m_bRecordChanges( false )
4715 +SettingsTable_Impl::~SettingsTable_Impl( )
4719 +SettingsTable::SettingsTable( ) :
4720 + m_pImpl( new SettingsTable_Impl )
4724 +SettingsTable::~SettingsTable( )
4726 + delete m_pImpl, m_pImpl = NULL;
4729 +void SettingsTable::attribute( Id nName, Value& rVal )
4732 + clog << "SettingsTable::attribute( )" << endl;
4736 +void SettingsTable::sprm( Sprm& rSprm )
4738 + switch ( rSprm.getId( ) )
4740 + case NS_ooxml::LN_CT_Settings_trackRevisions:
4742 + m_pImpl->m_bRecordChanges = bool(rSprm.getValue( )->getInt( ) );
4748 + clog << __FILE__ << ":" << __LINE__;
4749 + clog << ": unknown SPRM: " << rSprm.getName( ) << endl;
4755 +void SettingsTable::entry( int nPos, writerfilter::Reference<Properties>::Pointer_t pRef )
4758 + fprintf( stderr, "SettingsTable::entry( ), pos: %d\n", nPos );
4760 + pRef->resolve( *this );
4763 +void SettingsTable::resolveSprmProps( Sprm& rSprm )
4765 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
4766 + if( pProperties.get())
4767 + pProperties->resolve(*this);
4770 +void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
4772 + uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
4774 + // Record changes value
4775 + xDocProps->setPropertyValue( OUString::createFromAscii( "RecordChanges" ), uno::makeAny( m_pImpl->m_bRecordChanges ) );
4779 diff --git writerfilter/source/dmapper/SettingsTable.hxx writerfilter/source/dmapper/SettingsTable.hxx
4780 new file mode 100644
4781 index 0000000..6a5e8b9
4783 +++ writerfilter/source/dmapper/SettingsTable.hxx
4785 +#ifndef INCLUDED_SETTINGSTABLE_HXX
4786 +#define INCLUDED_SETTINGSTABLE_HXX
4788 +#include <WriterFilterDllApi.hxx>
4789 +#include <resourcemodel/WW8ResourceModel.hxx>
4791 +#include <com/sun/star/text/XTextDocument.hpp>
4793 +namespace writerfilter {
4796 +using namespace std;
4798 +struct SettingsTable_Impl
4801 + bool m_bRecordChanges;
4803 + SettingsTable_Impl( );
4804 + ~SettingsTable_Impl( );
4807 +class WRITERFILTER_DLLPRIVATE SettingsTable: public Properties, public Table
4810 + SettingsTable_Impl* m_pImpl;
4813 + ~SettingsTable( );
4816 + virtual void attribute(Id Name, Value & val);
4817 + virtual void sprm(Sprm & sprm);
4820 + virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
4822 + void resolveSprmProps( Sprm& rSprm );
4824 + void ApplyProperties( com::sun::star::uno::Reference< com::sun::star::text::XTextDocument > xDoc );
4826 +typedef boost::shared_ptr< SettingsTable > SettingsTablePtr;
4832 diff --git writerfilter/source/dmapper/StyleSheetTable.cxx writerfilter/source/dmapper/StyleSheetTable.cxx
4833 index 20efc0a..9bf05a8 100644
4834 --- writerfilter/source/dmapper/StyleSheetTable.cxx
4835 +++ writerfilter/source/dmapper/StyleSheetTable.cxx
4837 #include <StyleSheetTable.hxx>
4838 #include <dmapper/DomainMapper.hxx>
4839 #include <ConversionHelper.hxx>
4840 +#include <TblStylePrHandler.hxx>
4841 #include <BorderHandler.hxx>
4842 #include <doctok/resourceids.hxx>
4843 #include <ooxml/resourceids.hxx>
4845 #include <com/sun/star/beans/XPropertyState.hpp>
4846 #include <com/sun/star/beans/PropertyValue.hpp>
4847 #include <com/sun/star/container/XNameContainer.hpp>
4848 +#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
4849 #include <com/sun/star/text/XTextDocument.hpp>
4850 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
4851 #include <com/sun/star/style/XStyle.hpp>
4852 @@ -70,6 +72,175 @@ StyleSheetEntry::StyleSheetEntry() :
4856 +TableStyleSheetEntry::TableStyleSheetEntry( StyleSheetEntry& rEntry, StyleSheetTable* pStyles ):
4857 + StyleSheetEntry( ),
4858 + m_pStyleSheet( pStyles )
4860 + bIsDefaultStyle = rEntry.bIsDefaultStyle;
4861 + bInvalidHeight = rEntry.bInvalidHeight;
4862 + bHasUPE = rEntry.bHasUPE;
4863 + nStyleTypeCode = STYLE_TYPE_TABLE;
4864 + sBaseStyleIdentifier = rEntry.sBaseStyleIdentifier;
4865 + sNextStyleIdentifier = rEntry.sNextStyleIdentifier;
4866 + sStyleName = rEntry.sStyleName;
4867 + sStyleName1 = rEntry.sStyleName1;
4869 + m_nColBandSize = 1;
4870 + m_nRowBandSize = 1;
4873 +TableStyleSheetEntry::~TableStyleSheetEntry( )
4875 + m_pStyleSheet = NULL;
4878 +void TableStyleSheetEntry::AddTblStylePr( TblStyleType nType, PropertyMapPtr pProps )
4880 + static TblStyleType pTypesToFix[] =
4882 + TBL_STYLE_FIRSTROW,
4883 + TBL_STYLE_LASTROW,
4884 + TBL_STYLE_FIRSTCOL,
4888 + static PropertyIds pPropsToCheck[] =
4890 + PROP_BOTTOM_BORDER,
4892 + PROP_RIGHT_BORDER,
4899 + if ( nType == pTypesToFix[i] )
4901 + PropertyIds nChecked = pPropsToCheck[i];
4902 + PropertyMap::iterator pCheckedIt = pProps->find( PropertyDefinition( nChecked, false ) );
4904 + PropertyIds nInsideProp = ( i < 2 ) ? META_PROP_HORIZONTAL_BORDER : META_PROP_VERTICAL_BORDER;
4905 + PropertyMap::iterator pInsideIt = pProps->find( PropertyDefinition( nInsideProp, false ) );
4907 + bool bHasChecked = pCheckedIt != pProps->end( );
4908 + bool bHasInside = pInsideIt != pProps->end( );
4910 + if ( bHasChecked && bHasInside )
4912 + // In this case, remove the inside border
4913 + pProps->erase( pInsideIt );
4916 + i = 4; // Stop looping stupidly
4921 + // Append the tblStylePr
4922 + m_aStyles[nType] = pProps;
4925 +PropertyMapPtr TableStyleSheetEntry::GetProperties( sal_Int32 nMask )
4927 + PropertyMapPtr pProps( new PropertyMap );
4929 + // First get the parent properties
4930 + StyleSheetEntryPtr pEntry = m_pStyleSheet->FindParentStyleSheet( sBaseStyleIdentifier );
4932 + if ( pEntry.get( ) )
4934 + TableStyleSheetEntry* pParent = static_cast<TableStyleSheetEntry *>( pEntry.get( ) );
4935 + pProps->insert( pParent->GetProperties( nMask ) );
4938 + // And finally get the mask ones
4939 + pProps->insert( GetLocalPropertiesFromMask( nMask ) );
4944 +void lcl_mergeProps( PropertyMapPtr pToFill, PropertyMapPtr pToAdd, TblStyleType nStyleId )
4946 + static PropertyIds pPropsToCheck[] =
4948 + PROP_BOTTOM_BORDER,
4950 + PROP_RIGHT_BORDER,
4954 + bool pRemoveInside[] =
4956 + ( nStyleId == TBL_STYLE_FIRSTROW ),
4957 + ( nStyleId == TBL_STYLE_LASTROW ),
4958 + ( nStyleId == TBL_STYLE_LASTCOL ),
4959 + ( nStyleId == TBL_STYLE_FIRSTCOL )
4962 + for ( int i = 0 ; i < 7; i++ )
4964 + PropertyIds nId = pPropsToCheck[i];
4965 + PropertyDefinition aProp( nId, false );
4966 + PropertyMap::iterator pIt = pToAdd->find( aProp );
4968 + if ( pIt != pToAdd->end( ) )
4970 + PropertyMap::iterator pDestIt = pToFill->find( aProp );
4972 + if ( pRemoveInside[i] )
4974 + // Remove the insideH and insideV depending on the cell pos
4975 + PropertyIds nInsideProp = ( i < 2 ) ? META_PROP_HORIZONTAL_BORDER : META_PROP_VERTICAL_BORDER;
4976 + pDestIt = pToFill->find( PropertyDefinition( nInsideProp, false ) );
4977 + if ( pDestIt != pToFill->end( ) )
4978 + pToFill->erase( pDestIt );
4983 + pToFill->insert( pToAdd );
4986 +PropertyMapPtr TableStyleSheetEntry::GetLocalPropertiesFromMask( sal_Int32 nMask )
4988 + // Order from right to left
4989 + static TblStyleType aBitsOrder[] =
4995 + TBL_STYLE_BAND2HORZ,
4996 + TBL_STYLE_BAND1HORZ,
4997 + TBL_STYLE_BAND2VERT,
4998 + TBL_STYLE_BAND1VERT,
4999 + TBL_STYLE_LASTCOL,
5000 + TBL_STYLE_FIRSTCOL,
5001 + TBL_STYLE_LASTROW,
5002 + TBL_STYLE_FIRSTROW
5005 + // Get the properties applying according to the mask
5006 + PropertyMapPtr pProps( new PropertyMap( ) );
5010 + TblStyleType nStyleId = aBitsOrder[nBit];
5011 + TblStylePrs::iterator pIt = m_aStyles.find( nStyleId );
5013 + short nTestBit = 1 << nBit;
5014 + sal_Int32 nBitMask = sal_Int32( nTestBit );
5015 + if ( ( nMask & nBitMask ) && ( pIt != m_aStyles.end( ) ) )
5016 + lcl_mergeProps( pProps, pIt->second, nStyleId );
5020 + while ( nBit < 12 );
5025 /*-- 06.02.2008 11:30:46---------------------------------------------------
5027 -----------------------------------------------------------------------*/
5028 @@ -92,8 +263,8 @@ struct StyleSheetTable_Impl
5029 DomainMapper& m_rDMapper;
5030 uno::Reference< text::XTextDocument> m_xTextDocument;
5031 uno::Reference< beans::XPropertySet> m_xTextDefaults;
5032 - std::vector< StyleSheetEntry > m_aStyleSheetEntries;
5033 - StyleSheetEntry *m_pCurrentEntry;
5034 + std::vector< StyleSheetEntryPtr > m_aStyleSheetEntries;
5035 + StyleSheetEntryPtr m_pCurrentEntry;
5036 PropertyMapPtr m_pDefaultParaProps, m_pDefaultCharProps;
5037 PropertyMapPtr m_pCurrentProps;
5038 StringPairMap_t m_aStyleNameMap;
5039 @@ -110,7 +281,7 @@ struct StyleSheetTable_Impl
5040 StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> xTextDocument ) :
5041 m_rDMapper( rDMapper ),
5042 m_xTextDocument( xTextDocument ),
5043 - m_pCurrentEntry(0),
5044 + m_pCurrentEntry(),
5045 m_pDefaultParaProps(new PropertyMap),
5046 m_pDefaultCharProps(new PropertyMap)
5048 @@ -659,13 +830,23 @@ void StyleSheetTable::attribute(Id Name, Value & val)
5049 // case NS_rtf::LN_STYLESHEET: break;
5050 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5051 case NS_ooxml::LN_CT_Style_type:
5053 /* defaults should be set at the service "com.sun.star.text.Defaults"
5055 *(m_pImpl->m_pCurrentEntry->pProperties) = *(m_pImpl->m_pDefaultParaProps);
5056 else if (nIntValue == 2)
5057 *(m_pImpl->m_pCurrentEntry->pProperties) = *(m_pImpl->m_pDefaultCharProps);*/
5058 - m_pImpl->m_pCurrentEntry->nStyleTypeCode = (StyleType)nIntValue;
5059 + StyleType nType = ( StyleType ) nIntValue;
5060 + if ( nType == STYLE_TYPE_TABLE )
5062 + StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
5063 + TableStyleSheetEntryPtr pTableEntry( new TableStyleSheetEntry( *pEntry.get( ), this ) );
5064 + m_pImpl->m_pCurrentEntry = pTableEntry;
5067 + m_pImpl->m_pCurrentEntry->nStyleTypeCode = (StyleType)nIntValue;
5070 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5071 case NS_ooxml::LN_CT_Style_default:
5072 m_pImpl->m_pCurrentEntry->bIsDefaultStyle = (nIntValue != 0);
5073 @@ -707,7 +888,7 @@ void StyleSheetTable::sprm(Sprm & rSprm)
5075 rtl::OUString sStringValue = pValue.get() ? pValue->getString() : rtl::OUString();
5076 //printf ( "StyleSheetTable::sprm(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)nSprmId, (unsigned int)nIntValue, ::rtl::OUStringToOString(sStringValue, RTL_TEXTENCODING_DONTKNOW).getStr());
5079 /* WRITERFILTERSTATUS: table: StyleSheetTable_sprm */
5082 @@ -753,13 +934,28 @@ void StyleSheetTable::sprm(Sprm & rSprm)
5083 case NS_ooxml::LN_CT_Style_rsid:
5084 /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
5085 case NS_ooxml::LN_CT_Style_trPr:
5086 - /* WRITERFILTERSTATUS: done: 0, planned: 0, spent: 0 */
5087 - case NS_ooxml::LN_CT_Style_tcPr:
5089 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5090 - case NS_ooxml::LN_CT_Style_tblPr: //contains table properties
5091 - /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5092 case NS_ooxml::LN_CT_Style_tblStylePr: //contains to table properties
5094 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5095 + if( pProperties.get())
5097 + TblStylePrHandlerPtr pTblStylePrHandler( new TblStylePrHandler( m_pImpl->m_rDMapper ) );
5098 + pProperties->resolve( *pTblStylePrHandler );
5100 + // Add the properties to the table style
5101 + TblStyleType nType = pTblStylePrHandler->getType( );
5102 + PropertyMapPtr pProps = pTblStylePrHandler->getProperties( );
5103 + StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
5104 + TableStyleSheetEntry* pTableEntry = static_cast<TableStyleSheetEntry*>( pEntry.get( ) );
5105 + pTableEntry->AddTblStylePr( nType, pProps );
5109 + case NS_ooxml::LN_CT_Style_tcPr:
5110 + /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5111 + case NS_ooxml::LN_CT_Style_tblPr: //contains table properties
5112 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5113 case NS_ooxml::LN_CT_DocDefaults_pPrDefault:
5114 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5115 @@ -805,14 +1001,35 @@ void StyleSheetTable::sprm(Sprm & rSprm)
5119 - /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5120 + case NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize:
5121 + case NS_ooxml::LN_CT_TblPrBase_tblStyleColBandSize:
5123 + StyleSheetEntry* pEntry = m_pImpl->m_pCurrentEntry.get( );
5124 + TableStyleSheetEntry *pTEntry = static_cast<TableStyleSheetEntry*>( pEntry );
5127 + if ( nSprmId == NS_ooxml::LN_CT_TblPrBase_tblStyleRowBandSize )
5128 + pTEntry->m_nRowBandSize = nIntValue;
5130 + pTEntry->m_nColBandSize = nIntValue;
5134 + /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5135 case NS_ooxml::LN_CT_Style_pPr:
5136 /* WRITERFILTERSTATUS: done: 100, planned: 0, spent: 0 */
5137 case NS_ooxml::LN_CT_Style_rPr:
5139 if (!m_pImpl->m_pCurrentEntry)
5141 - m_pImpl->m_rDMapper.sprm( rSprm, m_pImpl->m_pCurrentEntry->pProperties );
5142 + TablePropertiesHandlerPtr pTblHandler( new TablePropertiesHandler( true ) );
5143 + pTblHandler->SetProperties( m_pImpl->m_pCurrentEntry->pProperties );
5144 + if ( !pTblHandler->sprm( rSprm ) )
5146 + m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pCurrentEntry->pProperties );
5147 + m_pImpl->m_rDMapper.sprm( rSprm );
5148 + m_pImpl->m_rDMapper.PopStyleSheetProperties( );
5152 /*-- 19.06.2006 12:04:33---------------------------------------------------
5153 @@ -823,7 +1040,8 @@ void StyleSheetTable::entry(int /*pos*/, writerfilter::Reference<Properties>::Po
5154 //create a new style entry
5155 // printf("StyleSheetTable::entry(...)\n");
5156 OSL_ENSURE( !m_pImpl->m_pCurrentEntry, "current entry has to be NULL here");
5157 - m_pImpl->m_pCurrentEntry = new StyleSheetEntry;
5158 + StyleSheetEntryPtr pNewEntry( new StyleSheetEntry );
5159 + m_pImpl->m_pCurrentEntry = pNewEntry;
5160 m_pImpl->m_rDMapper.PushStyleSheetProperties( m_pImpl->m_pCurrentEntry->pProperties );
5161 ref->resolve(*this);
5162 //append it to the table
5163 @@ -831,13 +1049,14 @@ void StyleSheetTable::entry(int /*pos*/, writerfilter::Reference<Properties>::Po
5164 if( !m_pImpl->m_rDMapper.IsOOXMLImport() || m_pImpl->m_pCurrentEntry->sStyleName.getLength() >0)
5166 m_pImpl->m_pCurrentEntry->sConvertedStyleName = ConvertStyleName( m_pImpl->m_pCurrentEntry->sStyleName );
5167 - m_pImpl->m_aStyleSheetEntries.push_back( *m_pImpl->m_pCurrentEntry );
5168 + m_pImpl->m_aStyleSheetEntries.push_back( m_pImpl->m_pCurrentEntry );
5172 //TODO: this entry contains the default settings - they have to be added to the settings
5174 - m_pImpl->m_pCurrentEntry = 0;
5175 + StyleSheetEntryPtr pEmptyEntry;
5176 + m_pImpl->m_pCurrentEntry = pEmptyEntry;
5178 /*-- 21.06.2006 15:34:49---------------------------------------------------
5180 @@ -910,16 +1129,17 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
5181 xStyleFamilies->getByName(rPropNameSupplier.GetName( PROP_PARAGRAPH_STYLES )) >>= xParaStyles;
5182 if(xCharStyles.is() && xParaStyles.is())
5184 - std::vector< StyleSheetEntry >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
5185 + std::vector< StyleSheetEntryPtr >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
5186 while( aIt != m_pImpl->m_aStyleSheetEntries.end() )
5188 - if( aIt->nStyleTypeCode == STYLE_TYPE_CHAR || aIt->nStyleTypeCode == STYLE_TYPE_PARA )
5189 + StyleSheetEntryPtr pEntry = *aIt;
5190 + if( pEntry->nStyleTypeCode == STYLE_TYPE_CHAR || pEntry->nStyleTypeCode == STYLE_TYPE_PARA )
5192 - bool bParaStyle = aIt->nStyleTypeCode == STYLE_TYPE_PARA;
5193 + bool bParaStyle = pEntry->nStyleTypeCode == STYLE_TYPE_PARA;
5194 bool bInsert = false;
5195 uno::Reference< container::XNameContainer > xStyles = bParaStyle ? xParaStyles : xCharStyles;
5196 uno::Reference< style::XStyle > xStyle;
5197 - ::rtl::OUString sConvertedStyleName = ConvertStyleName( aIt->sStyleName );
5198 + ::rtl::OUString sConvertedStyleName = ConvertStyleName( pEntry->sStyleName );
5199 if(xStyles->hasByName( sConvertedStyleName ))
5200 xStyles->getByName( sConvertedStyleName ) >>= xStyle;
5202 @@ -931,12 +1151,13 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
5203 rPropNameSupplier.GetName( PROP_SERVICE_CHAR_STYLE )),
5204 uno::UNO_QUERY_THROW);
5206 - if( aIt->sBaseStyleIdentifier.getLength() )
5207 + if( pEntry->sBaseStyleIdentifier.getLength() )
5211 //TODO: Handle cases where a paragraph <> character style relation is needed
5212 - xStyle->setParentStyle(ConvertStyleName( aIt->sBaseStyleIdentifier ));
5213 + StyleSheetEntryPtr pParent = FindStyleSheetByISTD( pEntry->sBaseStyleIdentifier );
5214 + xStyle->setParentStyle(ConvertStyleName( pParent->sStyleName ));
5216 catch( const uno::RuntimeException& )
5218 @@ -955,43 +1176,71 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
5220 uno::Any aTwoHundredFortyTwip = uno::makeAny(12.);
5221 // font size to 240 twip (12 pts) for all if not set
5222 - aIt->pProperties->Insert(PROP_CHAR_HEIGHT, true, aTwoHundredFortyTwip, false);
5223 + pEntry->pProperties->Insert(PROP_CHAR_HEIGHT, true, aTwoHundredFortyTwip, false);
5224 // western font not already set -> apply first font
5225 const FontEntry* pWesternFontEntry = rFontTable->getFontEntry( 0 );
5226 rtl::OUString sWesternFontName = pWesternFontEntry->sFontName;
5227 - aIt->pProperties->Insert(PROP_CHAR_FONT_NAME, true, uno::makeAny( sWesternFontName ), false);
5228 + pEntry->pProperties->Insert(PROP_CHAR_FONT_NAME, true, uno::makeAny( sWesternFontName ), false);
5230 // CJK ... apply second font
5231 const FontEntry* pCJKFontEntry = rFontTable->getFontEntry( 2 );
5232 - aIt->pProperties->Insert(PROP_CHAR_FONT_NAME_ASIAN, true, uno::makeAny( pCJKFontEntry->sFontName ), false);
5233 - aIt->pProperties->Insert(PROP_CHAR_HEIGHT_ASIAN, true, aTwoHundredFortyTwip, false);
5234 + pEntry->pProperties->Insert(PROP_CHAR_FONT_NAME_ASIAN, true, uno::makeAny( pCJKFontEntry->sFontName ), false);
5235 + pEntry->pProperties->Insert(PROP_CHAR_HEIGHT_ASIAN, true, aTwoHundredFortyTwip, false);
5236 // CTL ... apply third font, if available
5237 if( nFontCount > 3 )
5239 const FontEntry* pCTLFontEntry = rFontTable->getFontEntry( 3 );
5240 - aIt->pProperties->Insert(PROP_CHAR_FONT_NAME_COMPLEX, true, uno::makeAny( pCTLFontEntry->sFontName ), false);
5241 - aIt->pProperties->Insert(PROP_CHAR_HEIGHT_COMPLEX, true, aTwoHundredFortyTwip, false);
5242 + pEntry->pProperties->Insert(PROP_CHAR_FONT_NAME_COMPLEX, true, uno::makeAny( pCTLFontEntry->sFontName ), false);
5243 + pEntry->pProperties->Insert(PROP_CHAR_HEIGHT_COMPLEX, true, aTwoHundredFortyTwip, false);
5246 // Widow/Orphan -> set both to two if not already set
5247 uno::Any aTwo = uno::makeAny(sal_Int8(2));
5248 - aIt->pProperties->Insert(PROP_PARA_WIDOWS, true, aTwo, false);
5249 - aIt->pProperties->Insert(PROP_PARA_ORPHANS, true, aTwo, false);
5250 + pEntry->pProperties->Insert(PROP_PARA_WIDOWS, true, aTwo, false);
5251 + pEntry->pProperties->Insert(PROP_PARA_ORPHANS, true, aTwo, false);
5252 // Left-to-right direction if not already set
5253 - aIt->pProperties->Insert(PROP_WRITING_MODE, true, uno::makeAny( sal_Int16(text::WritingMode_LR_TB) ), false);
5254 + pEntry->pProperties->Insert(PROP_WRITING_MODE, true, uno::makeAny( sal_Int16(text::WritingMode_LR_TB) ), false);
5255 // font color COL_AUTO if not already set
5256 - aIt->pProperties->Insert(PROP_CHAR_COLOR, true, uno::makeAny( sal_Int32(0xffffffff) ), false);
5257 + pEntry->pProperties->Insert(PROP_CHAR_COLOR, true, uno::makeAny( sal_Int32(0xffffffff) ), false);
5260 - uno::Sequence< beans::PropertyValue > aPropValues = aIt->pProperties->GetPropertyValues();
5261 + uno::Sequence< beans::PropertyValue > aPropValues = pEntry->pProperties->GetPropertyValues();
5262 bool bAddFollowStyle = false;
5263 - if(bParaStyle && !aIt->sNextStyleIdentifier.getLength() )
5264 + if(bParaStyle && !pEntry->sNextStyleIdentifier.getLength() )
5266 bAddFollowStyle = true;
5268 //remove Left/RightMargin values from TOX heading styles
5271 + // Set the outline levels
5272 + const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0);
5273 + if ( pStyleSheetProperties && pStyleSheetProperties->GetOutlineLevel( ) >= 0 )
5275 + sal_Int16 nLvl = pStyleSheetProperties->GetOutlineLevel( );
5276 + uno::Reference< text::XChapterNumberingSupplier > xOutlines ( m_pImpl->m_xTextDocument,
5277 + uno::UNO_QUERY_THROW );
5278 + uno::Reference< container::XIndexReplace > xRules = xOutlines->getChapterNumberingRules( );
5279 + uno::Any aLevel = xRules->getByIndex( nLvl );
5280 + uno::Sequence< beans::PropertyValue > aLevelProps;
5281 + aLevel >>= aLevelProps;
5283 + sal_Int32 nLen = aLevelProps.getLength( );
5285 + bool bPropFound = false;
5286 + rtl::OUString sPropName( rtl::OUString::createFromAscii( "HeadingStyleName" ) );
5287 + while ( i < nLen && !bPropFound )
5289 + if ( aLevelProps[i].Name.equals( sPropName ) )
5291 + aLevelProps[i].Value = uno::makeAny( ConvertStyleName( pEntry->sStyleName ) );
5292 + bPropFound = true;
5296 + xRules->replaceByIndex( nLvl, uno::makeAny( aLevelProps ) );
5299 uno::Reference< beans::XPropertyState >xState( xStyle, uno::UNO_QUERY_THROW );
5300 if( sConvertedStyleName.equalsAscii( "Contents Heading" ) ||
5301 sConvertedStyleName.equalsAscii( "User Index Heading" ) ||
5302 @@ -1028,24 +1277,27 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
5304 if(bAddFollowStyle || aPropValues.getLength())
5306 - const beans::PropertyValue* pPropValues = aPropValues.getConstArray();
5307 PropValVector aSortedPropVals;
5308 for( sal_Int32 nProp = 0; nProp < aPropValues.getLength(); ++nProp)
5310 - aSortedPropVals.Insert( pPropValues[nProp] );
5311 + // Don't add the style name properties
5312 + bool bIsParaStyleName = aPropValues[nProp].Name.equalsAscii( "ParaStyleName" );
5313 + bool bIsCharStyleName = aPropValues[nProp].Name.equalsAscii( "CharStyleName" );
5314 + if ( !bInsert && !bIsParaStyleName && !bIsCharStyleName )
5315 + aSortedPropVals.Insert( aPropValues[nProp] );
5319 //find the name of the Next style
5320 - std::vector< StyleSheetEntry >::iterator aNextStyleIt = m_pImpl->m_aStyleSheetEntries.begin();
5321 + std::vector< StyleSheetEntryPtr >::iterator aNextStyleIt = m_pImpl->m_aStyleSheetEntries.begin();
5322 for( ; aNextStyleIt != m_pImpl->m_aStyleSheetEntries.end(); ++aNextStyleIt )
5324 - if( aNextStyleIt->sStyleName.getLength() &&
5325 - aNextStyleIt->sStyleName == aIt->sNextStyleIdentifier)
5326 + if( ( *aNextStyleIt )->sStyleName.getLength() &&
5327 + ( *aNextStyleIt )->sStyleName == pEntry->sNextStyleIdentifier)
5329 beans::PropertyValue aNew;
5330 aNew.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FollowStyle"));
5331 - aNew.Value = uno::makeAny(ConvertStyleName( aNextStyleIt->sStyleIdentifierD ));
5332 + aNew.Value = uno::makeAny(ConvertStyleName( ( *aNextStyleIt )->sStyleIdentifierD ));
5333 aSortedPropVals.Insert( aNew );
5336 @@ -1084,14 +1336,14 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
5337 /*-- 22.06.2006 15:56:56---------------------------------------------------
5339 -----------------------------------------------------------------------*/
5340 -const StyleSheetEntry* StyleSheetTable::FindStyleSheetByISTD(const ::rtl::OUString& sIndex)
5341 +const StyleSheetEntryPtr StyleSheetTable::FindStyleSheetByISTD(const ::rtl::OUString& sIndex)
5343 - const StyleSheetEntry* pRet = 0;
5344 + StyleSheetEntryPtr pRet;
5345 for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
5347 - if( m_pImpl->m_aStyleSheetEntries[nPos].sStyleIdentifierD == sIndex)
5348 + if( m_pImpl->m_aStyleSheetEntries[nPos]->sStyleIdentifierD == sIndex)
5350 - pRet = &m_pImpl->m_aStyleSheetEntries[nPos];
5351 + pRet = m_pImpl->m_aStyleSheetEntries[nPos];
5355 @@ -1100,14 +1352,14 @@ const StyleSheetEntry* StyleSheetTable::FindStyleSheetByISTD(const ::rtl::OUStri
5356 /*-- 28.12.2007 14:45:45---------------------------------------------------
5358 -----------------------------------------------------------------------*/
5359 -const StyleSheetEntry* StyleSheetTable::FindStyleSheetByStyleName(const ::rtl::OUString& sIndex)
5360 +const StyleSheetEntryPtr StyleSheetTable::FindStyleSheetByStyleName(const ::rtl::OUString& sIndex)
5362 - const StyleSheetEntry* pRet = 0;
5363 + StyleSheetEntryPtr pRet;
5364 for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
5366 - if( m_pImpl->m_aStyleSheetEntries[nPos].sStyleName == sIndex)
5367 + if( m_pImpl->m_aStyleSheetEntries[nPos]->sStyleName == sIndex)
5369 - pRet = &m_pImpl->m_aStyleSheetEntries[nPos];
5370 + pRet = m_pImpl->m_aStyleSheetEntries[nPos];
5374 @@ -1116,14 +1368,14 @@ const StyleSheetEntry* StyleSheetTable::FindStyleSheetByStyleName(const ::rtl::O
5375 /*-- 28.12.2007 14:45:45---------------------------------------------------
5377 -----------------------------------------------------------------------*/
5378 -const StyleSheetEntry* StyleSheetTable::FindStyleSheetByConvertedStyleName(const ::rtl::OUString& sIndex)
5379 +const StyleSheetEntryPtr StyleSheetTable::FindStyleSheetByConvertedStyleName(const ::rtl::OUString& sIndex)
5381 - const StyleSheetEntry* pRet = 0;
5382 + StyleSheetEntryPtr pRet;
5383 for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
5385 - if( m_pImpl->m_aStyleSheetEntries[nPos].sConvertedStyleName == sIndex)
5386 + if( m_pImpl->m_aStyleSheetEntries[nPos]->sConvertedStyleName == sIndex)
5388 - pRet = &m_pImpl->m_aStyleSheetEntries[nPos];
5389 + pRet = m_pImpl->m_aStyleSheetEntries[nPos];
5393 @@ -1133,23 +1385,17 @@ const StyleSheetEntry* StyleSheetTable::FindStyleSheetByConvertedStyleName(const
5394 /*-- 17.07.2006 11:47:00---------------------------------------------------
5396 -----------------------------------------------------------------------*/
5397 -const StyleSheetEntry* StyleSheetTable::FindParentStyleSheet(::rtl::OUString sBaseStyle)
5398 +const StyleSheetEntryPtr StyleSheetTable::FindParentStyleSheet(::rtl::OUString sBaseStyle)
5400 if( !sBaseStyle.getLength() )
5403 + StyleSheetEntryPtr pEmptyPtr;
5406 if( m_pImpl->m_pCurrentEntry)
5407 sBaseStyle = m_pImpl->m_pCurrentEntry->sBaseStyleIdentifier;
5409 - const StyleSheetEntry* pRet = 0;
5410 - for( sal_uInt32 nPos = 0; nPos < m_pImpl->m_aStyleSheetEntries.size(); ++nPos )
5412 - if( m_pImpl->m_aStyleSheetEntries[nPos].sStyleIdentifierD == sBaseStyle )
5414 - pRet = &m_pImpl->m_aStyleSheetEntries[nPos];
5419 + return FindStyleSheetByISTD( sBaseStyle );
5421 /*-- 21.12.2006 15:58:23---------------------------------------------------
5423 @@ -1187,12 +1433,12 @@ static const sal_Char *aStyleNamePairs[] =
5424 "Index 1", "Index 1",
5425 "Index 2", "Index 2",
5426 "Index 3", "Index 3",
5439 "TOC 1", "Contents 1",
5440 "TOC 2", "Contents 2",
5441 "TOC 3", "Contents 3",
5442 @@ -1222,46 +1468,46 @@ static const sal_Char *aStyleNamePairs[] =
5443 "TOC7", "Contents 7",
5444 "TOC8", "Contents 8",
5445 "TOC9", "Contents 9",
5446 - "Normal Indent", 0,
5447 + "Normal Indent", "",
5448 "Footnote Text", "Footnote",
5449 - "Annotation Text", 0,
5450 + "Annotation Text", "",
5455 "Index Heading", "Index Heading",
5457 - "Table of Figures", 0,
5459 + "Table of Figures", "",
5460 "Envelope Address", "Addressee",
5461 "Envelope Return", "Sender",
5462 "Footnote Reference", "Footnote anchor",
5463 - "Annotation Reference", 0,
5464 + "Annotation Reference", "",
5465 "Line Number", "Line numbering",
5466 "Page Number", "Page Number",
5467 "Endnote Reference", "Endnote anchor",
5468 "Endnote Text", "Endnote Symbol",
5469 - "Table of Authorities", 0,
5472 + "Table of Authorities", "",
5474 + "TOA Heading", "",
5481 - "List Bullet 2", 0,
5482 - "List Bullet 3", 0,
5483 - "List Bullet 4", 0,
5484 - "List Bullet 5", 0,
5486 - "List Number 2", 0,
5487 - "List Number 3", 0,
5488 - "List Number 4", 0,
5489 - "List Number 5", 0,
5494 + "List Bullet", "",
5495 + "List Bullet 2", "",
5496 + "List Bullet 3", "",
5497 + "List Bullet 4", "",
5498 + "List Bullet 5", "",
5499 + "List Number", "",
5500 + "List Number 2", "",
5501 + "List Number 3", "",
5502 + "List Number 4", "",
5503 + "List Number 5", "",
5507 "Signature", "Signature",
5508 - "Default Paragraph Font", 0,
5509 + "Default Paragraph Font", "",
5510 "DefaultParagraphFont", "Default Paragraph Font",
5511 "Body Text", "Text body",
5512 "BodyText", "Text body",
5513 @@ -1269,29 +1515,29 @@ static const sal_Char *aStyleNamePairs[] =
5514 "Body Text Indent", "Text body indent",
5515 "BodyTextIndent", "Text body indent",
5516 "BodyTextIndent2", "Text body indent2",
5517 - "List Continue", 0,
5518 - "List Continue 2", 0,
5519 - "List Continue 3", 0,
5520 - "List Continue 4", 0,
5521 - "List Continue 5", 0,
5522 - "Message Header", 0,
5523 + "List Continue", "",
5524 + "List Continue 2", "",
5525 + "List Continue 3", "",
5526 + "List Continue 4", "",
5527 + "List Continue 5", "",
5528 + "Message Header", "",
5529 "Subtitle", "Subtitle",
5534 "Body Text First Indent", "Body Text Indent",
5535 - "Body Text First Indent 2", 0,
5536 - "Note Heading", 0,
5539 - "Body Text Indent 2", 0,
5540 - "Body Text Indent 3", 0,
5542 + "Body Text First Indent 2", "",
5543 + "Note Heading", "",
5544 + "Body Text 2", "",
5545 + "Body Text 3", "",
5546 + "Body Text Indent 2", "",
5547 + "Body Text Indent 3", "",
5549 "Hyperlink", "Internet link",
5550 "Followed Hyperlink", "Visited Internet Link",
5551 "Strong", "Strong Emphasis",
5552 "Emphasis", "Emphasis",
5553 - "Document Map", 0,
5555 + "Document Map", "",
5557 "NoList", "No List",
5558 "AbstractHeading", "Abstract Heading",
5559 "AbstractBody", "Abstract Body",
5560 @@ -1307,12 +1553,12 @@ static const sal_Char *aStyleNamePairs[] =
5561 if( bExtendedSearch )
5563 //search for the rWWName in the IdentifierD of the existing styles and convert the sStyleName member
5564 - std::vector< StyleSheetEntry >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
5565 + std::vector< StyleSheetEntryPtr >::iterator aIt = m_pImpl->m_aStyleSheetEntries.begin();
5566 //TODO: performance issue - put styles list into a map sorted by it's sStyleIdentifierD members
5567 while( aIt != m_pImpl->m_aStyleSheetEntries.end() )
5569 - if( rWWName == aIt->sStyleIdentifierD )
5570 - sRet = aIt->sStyleName;
5571 + if( rWWName == ( *aIt )->sStyleIdentifierD )
5572 + sRet = ( *aIt )->sStyleName;
5576 diff --git writerfilter/source/dmapper/StyleSheetTable.hxx writerfilter/source/dmapper/StyleSheetTable.hxx
5577 index 2cab554..9c01dbc 100644
5578 --- writerfilter/source/dmapper/StyleSheetTable.hxx
5579 +++ writerfilter/source/dmapper/StyleSheetTable.hxx
5581 #ifndef INCLUDED_STYLESHEETTABLE_HXX
5582 #define INCLUDED_STYLESHEETTABLE_HXX
5584 +#include "TblStylePrHandler.hxx"
5586 #include <WriterFilterDllApi.hxx>
5587 #include <dmapper/DomainMapper.hxx>
5588 #include <com/sun/star/lang/XComponent.hpp>
5589 @@ -41,6 +43,7 @@ namespace com{ namespace sun { namespace star { namespace text{
5590 class XTextDocument;
5594 namespace writerfilter {
5597 @@ -72,6 +75,9 @@ struct StyleSheetEntry
5598 ::rtl::OUString sConvertedStyleName;
5602 +typedef boost::shared_ptr<StyleSheetEntry> StyleSheetEntryPtr;
5605 class WRITERFILTER_DLLPRIVATE StyleSheetTable :
5607 @@ -92,11 +98,11 @@ public:
5608 virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
5610 void ApplyStyleSheets( FontTablePtr rFontTable );
5611 - const StyleSheetEntry* FindStyleSheetByISTD(const ::rtl::OUString& sIndex);
5612 - const StyleSheetEntry* FindStyleSheetByStyleName(const ::rtl::OUString& rIndex);
5613 - const StyleSheetEntry* FindStyleSheetByConvertedStyleName(const ::rtl::OUString& rIndex);
5614 + const StyleSheetEntryPtr FindStyleSheetByISTD(const ::rtl::OUString& sIndex);
5615 + const StyleSheetEntryPtr FindStyleSheetByStyleName(const ::rtl::OUString& rIndex);
5616 + const StyleSheetEntryPtr FindStyleSheetByConvertedStyleName(const ::rtl::OUString& rIndex);
5617 // returns the parent of the one with the given name - if empty the parent of the current style sheet is returned
5618 - const StyleSheetEntry* FindParentStyleSheet(::rtl::OUString sBaseStyle);
5619 + const StyleSheetEntryPtr FindParentStyleSheet(::rtl::OUString sBaseStyle);
5621 ::rtl::OUString ConvertStyleName( const ::rtl::OUString& rWWName, bool bExtendedSearch = false );
5622 ::rtl::OUString GetStyleIdFromIndex(const sal_uInt32 sti);
5623 @@ -110,6 +116,38 @@ private:
5625 typedef boost::shared_ptr< StyleSheetTable > StyleSheetTablePtr;
5628 +class WRITERFILTER_DLLPRIVATE TableStyleSheetEntry :
5629 + public StyleSheetEntry
5632 + typedef std::map<TblStyleType, PropertyMapPtr> TblStylePrs;
5634 + StyleSheetTable* m_pStyleSheet;
5635 + TblStylePrs m_aStyles;
5639 + short m_nColBandSize;
5640 + short m_nRowBandSize;
5642 + // Adds a new tblStylePr to the table style entry. This method
5643 + // fixes some possible properties conflicts, like borders ones.
5644 + void AddTblStylePr( TblStyleType nType, PropertyMapPtr pProps );
5646 + // Gets all the properties
5647 + // + corresponding to the mask,
5648 + // + from the parent styles
5649 + PropertyMapPtr GetProperties( sal_Int32 nMask );
5651 + TableStyleSheetEntry( StyleSheetEntry& aEntry, StyleSheetTable* pStyles );
5652 + ~TableStyleSheetEntry( );
5655 + PropertyMapPtr GetLocalPropertiesFromMask( sal_Int32 nMask );
5657 +typedef boost::shared_ptr<TableStyleSheetEntry> TableStyleSheetEntryPtr;
5662 diff --git writerfilter/source/dmapper/TDefTableHandler.cxx writerfilter/source/dmapper/TDefTableHandler.cxx
5663 index d695299..1ef9e8a 100644
5664 --- writerfilter/source/dmapper/TDefTableHandler.cxx
5665 +++ writerfilter/source/dmapper/TDefTableHandler.cxx
5666 @@ -155,6 +155,11 @@ void TDefTableHandler::attribute(Id rName, Value & rVal)
5667 case NS_rtf::LN_UNUSED2_15: // 0x2877
5670 + case NS_ooxml::LN_CT_Border_themeColor:
5671 + case NS_ooxml::LN_CT_Border_themeTint:
5672 + case NS_ooxml::LN_CT_Border_themeShade:
5676 OSL_ENSURE(false, "unknown attribute");
5678 @@ -199,6 +204,12 @@ void TDefTableHandler::localResolve(Id rName, writerfilter::Reference<Properties
5679 case NS_rtf::LN_BRCRIGHT:
5680 m_aRightBorderLines.push_back(aBorderLine);
5682 + case NS_ooxml::LN_CT_TcBorders_insideH:
5683 + m_aInsideHBorderLines.push_back(aBorderLine);
5685 + case NS_ooxml::LN_CT_TcBorders_insideV:
5686 + m_aInsideVBorderLines.push_back(aBorderLine);
5691 @@ -219,6 +230,10 @@ void TDefTableHandler::sprm(Sprm & rSprm)
5692 case NS_ooxml::LN_CT_TcBorders_bottom:
5693 /* WRITERFILTERSTATUS: done: 1, planned: 0, spent: 0 */
5694 case NS_ooxml::LN_CT_TcBorders_right:
5695 + case NS_ooxml::LN_CT_TcBorders_insideH:
5696 + case NS_ooxml::LN_CT_TcBorders_insideV:
5697 + case NS_ooxml::LN_CT_TcBorders_tl2br:
5698 + case NS_ooxml::LN_CT_TcBorders_tr2bl:
5700 writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5701 localResolve( rSprm.getId(), pProperties );
5702 @@ -281,6 +296,10 @@ void TDefTableHandler::fillCellProperties(
5703 pCellProperties->Insert( PROP_BOTTOM_BORDER, false, uno::makeAny( m_aBottomBorderLines[nCell] ) );
5704 if( m_aRightBorderLines.size() > nCell )
5705 pCellProperties->Insert( PROP_RIGHT_BORDER, false, uno::makeAny( m_aRightBorderLines[nCell] ) );
5706 + if( m_aInsideHBorderLines.size() > nCell )
5707 + pCellProperties->Insert( META_PROP_HORIZONTAL_BORDER, false, uno::makeAny( m_aInsideHBorderLines[nCell] ) );
5708 + if( m_aInsideVBorderLines.size() > nCell )
5709 + pCellProperties->Insert( META_PROP_VERTICAL_BORDER, false, uno::makeAny( m_aInsideVBorderLines[nCell] ) );
5711 /*-- 09.05.2007 13:14:17---------------------------------------------------
5713 diff --git writerfilter/source/dmapper/TDefTableHandler.hxx writerfilter/source/dmapper/TDefTableHandler.hxx
5714 index f5a720c..22e2682 100644
5715 --- writerfilter/source/dmapper/TDefTableHandler.hxx
5716 +++ writerfilter/source/dmapper/TDefTableHandler.hxx
5717 @@ -56,6 +56,10 @@ private:
5718 ::std::vector< ::com::sun::star::table::BorderLine > m_aRightBorderLines;
5719 ::std::vector< ::com::sun::star::table::BorderLine > m_aTopBorderLines;
5720 ::std::vector< ::com::sun::star::table::BorderLine > m_aBottomBorderLines;
5721 + ::std::vector< ::com::sun::star::table::BorderLine > m_aInsideHBorderLines;
5722 + ::std::vector< ::com::sun::star::table::BorderLine > m_aInsideVBorderLines;
5723 + ::std::vector< ::com::sun::star::table::BorderLine > m_aTl2brBorderLines;
5724 + ::std::vector< ::com::sun::star::table::BorderLine > m_aTr2blBorderLines;
5726 //values of the current border
5727 sal_Int32 m_nLineWidth;
5728 diff --git writerfilter/source/dmapper/TablePropertiesHandler.cxx writerfilter/source/dmapper/TablePropertiesHandler.cxx
5729 new file mode 100644
5730 index 0000000..e7bc423
5732 +++ writerfilter/source/dmapper/TablePropertiesHandler.cxx
5734 +#include "BorderHandler.hxx"
5735 +#include "CellColorHandler.hxx"
5736 +#include "CellMarginHandler.hxx"
5737 +#include "ConversionHelper.hxx"
5738 +#include "MeasureHandler.hxx"
5739 +#include "TablePropertiesHandler.hxx"
5740 +#include "TDefTableHandler.hxx"
5742 +#include <ooxml/resourceids.hxx>
5743 +#include <doctok/sprmids.hxx>
5745 +#include <com/sun/star/text/SizeType.hpp>
5746 +#include <com/sun/star/text/VertOrientation.hpp>
5749 +namespace writerfilter {
5750 +namespace dmapper {
5752 + TablePropertiesHandler::TablePropertiesHandler( bool bOOXML ) :
5753 + m_pTableManager( NULL ),
5754 + m_bOOXML( bOOXML )
5759 + TablePropertiesHandler::~TablePropertiesHandler( )
5761 + // Do not delete the table manager... this will be done somewhere else
5762 + m_pTableManager = NULL;
5765 + bool TablePropertiesHandler::sprm(Sprm & rSprm)
5768 + sal_uInt32 nSprmId = rSprm.getId();
5769 + Value::Pointer_t pValue = rSprm.getValue();
5770 + sal_Int32 nIntValue = ((pValue.get() != NULL) ? pValue->getInt() : 0);
5771 + /* WRITERFILTERSTATUS: table: table_sprmdata */
5774 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
5775 + case NS_ooxml::LN_CT_TrPrBase_jc: //90706
5776 + /* WRITERFILTERSTATUS: done: 1, planned: 0.5, spent: 0.5 */
5777 + case NS_ooxml::LN_CT_TblPrBase_jc:
5778 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
5779 + case 0x5400: // sprmTJc
5781 + //table justification 0: left, 1: center, 2: right
5782 + sal_Int16 nOrient = ConversionHelper::convertTableJustification( nIntValue );
5783 + TablePropertyMapPtr pTableMap( new TablePropertyMap );
5784 + pTableMap->setValue( TablePropertyMap::HORI_ORIENT, nOrient );
5785 + insertTableProps( pTableMap );
5788 + /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
5789 + case 0x9601: // sprmTDxaLeft
5791 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5792 + case 0x9602: // sprmTDxaGapHalf
5794 + //m_nGapHalf = ConversionHelper::convertTwipToMM100( nIntValue );
5795 + TablePropertyMapPtr pPropMap( new TablePropertyMap );
5796 + pPropMap->setValue( TablePropertyMap::GAP_HALF, ConversionHelper::convertTwipToMM100( nIntValue ) );
5797 + insertTableProps(pPropMap);
5800 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 2 */
5801 + case NS_ooxml::LN_CT_TrPrBase_trHeight: //90703
5803 + //contains unit and value
5804 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5805 + if( pProperties.get())
5806 + { //contains attributes x2902 (LN_unit) and x17e2 (LN_trleft)
5807 + MeasureHandlerPtr pMeasureHandler( new MeasureHandler );
5808 + pProperties->resolve(*pMeasureHandler);
5809 + TablePropertyMapPtr pPropMap( new TablePropertyMap );
5810 + pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny( pMeasureHandler->GetRowHeightSizeType() ));
5811 + pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(pMeasureHandler->getMeasureValue() ));
5812 + insertRowProps(pPropMap);
5816 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5817 + case 0x3403: // sprmTFCantSplit
5818 + case NS_sprm::LN_TCantSplit: // 0x3644
5820 + //row can't break across pages if nIntValue == 1
5821 + TablePropertyMapPtr pPropMap( new TablePropertyMap );
5822 + pPropMap->Insert( PROP_IS_SPLIT_ALLOWED, false, uno::makeAny(sal_Bool( nIntValue == 1 ? sal_False : sal_True ) ));
5823 + insertRowProps(pPropMap);
5826 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5827 + case 0x9407: // sprmTDyaRowHeight
5829 + // table row height - negative values indicate 'exact height' - positive 'at least'
5830 + TablePropertyMapPtr pPropMap( new TablePropertyMap );
5831 + bool bMinHeight = true;
5832 + sal_Int16 nHeight = static_cast<sal_Int16>( nIntValue );
5835 + bMinHeight = false;
5838 + pPropMap->Insert( PROP_SIZE_TYPE, false, uno::makeAny(bMinHeight ? text::SizeType::MIN : text::SizeType::FIX ));
5839 + pPropMap->Insert( PROP_HEIGHT, false, uno::makeAny(ConversionHelper::convertTwipToMM100( nHeight )));
5840 + insertRowProps(pPropMap);
5843 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5844 + case NS_ooxml::LN_CT_TcPrBase_vAlign://90694
5846 + sal_Int16 nVertOrient = text::VertOrientation::NONE;
5847 + switch( nIntValue ) //0 - top 1 - center 3 - bottom
5849 + case 1: nVertOrient = text::VertOrientation::CENTER; break;
5850 + case 3: nVertOrient = text::VertOrientation::BOTTOM; break;
5853 + TablePropertyMapPtr pCellPropMap( new TablePropertyMap() );
5854 + pCellPropMap->Insert( PROP_VERT_ORIENT, false, uno::makeAny( nVertOrient ) );
5855 + //todo: in ooxml import the value of m_ncell is wrong
5856 + cellProps( pCellPropMap );
5859 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5860 + case NS_ooxml::LN_CT_TblPrBase_tblBorders: //table borders, might be defined in table style
5862 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5863 + if( pProperties.get())
5865 + BorderHandlerPtr pBorderHandler( new BorderHandler(m_bOOXML) );
5866 + pProperties->resolve(*pBorderHandler);
5867 + TablePropertyMapPtr pTablePropMap( new TablePropertyMap );
5868 + pTablePropMap->insert( pBorderHandler->getProperties() );
5869 + insertTableProps( pTablePropMap );
5873 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5874 + case NS_ooxml::LN_CT_TcPrBase_tcBorders ://cell borders
5875 + //contains CT_TcBorders_left, right, top, bottom
5877 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5878 + if( pProperties.get())
5880 + //in OOXML there's one set of borders at each cell (if there is any)
5881 + TDefTableHandlerPtr pTDefTableHandler( new TDefTableHandler( m_bOOXML ));
5882 + pProperties->resolve( *pTDefTableHandler );
5883 + TablePropertyMapPtr pCellPropMap( new TablePropertyMap );
5884 + pTDefTableHandler->fillCellProperties( 0, pCellPropMap );
5885 + cellProps( pCellPropMap );
5889 + case NS_ooxml::LN_CT_TblPrBase_shd:
5891 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5892 + if( pProperties.get())
5894 + CellColorHandlerPtr pCellColorHandler( new CellColorHandler);
5895 + pProperties->resolve( *pCellColorHandler );
5896 + TablePropertyMapPtr pTablePropMap( new TablePropertyMap );
5897 + insertTableProps( pCellColorHandler->getProperties() );
5901 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5902 + case 0xd61a : // sprmTCellTopColor
5903 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5904 + case 0xd61b : // sprmTCellLeftColor
5905 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5906 + case 0xd61c : // sprmTCellBottomColor
5907 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5908 + case 0xd61d : // sprmTCellRightColor
5909 + /* WRITERFILTERSTATUS: done: 1, planned: 2, spent: 0 */
5910 + case NS_ooxml::LN_CT_TcPrBase_shd:
5912 + // each color sprm contains as much colors as cells are in a row
5913 + //LN_CT_TcPrBase_shd: cell shading contains: LN_CT_Shd_val, LN_CT_Shd_fill, LN_CT_Shd_color
5914 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5915 + if( pProperties.get())
5917 + CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
5918 + pProperties->resolve( *pCellColorHandler );
5919 + cellProps( pCellColorHandler->getProperties());
5923 +//OOXML table properties
5924 + /* WRITERFILTERSTATUS: done: 0, planned: 2, spent: 0 */
5925 + case NS_ooxml::LN_CT_TblPrBase_tblCellMar: //cell margins
5927 + //contains LN_CT_TblCellMar_top, LN_CT_TblCellMar_left, LN_CT_TblCellMar_bottom, LN_CT_TblCellMar_right
5928 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
5929 + if( pProperties.get())
5931 + CellMarginHandlerPtr pCellMarginHandler( new CellMarginHandler );
5932 + pProperties->resolve( *pCellMarginHandler );
5933 + TablePropertyMapPtr pMarginProps( new TablePropertyMap );
5934 + if( pCellMarginHandler->m_bTopMarginValid )
5935 + pMarginProps->setValue( TablePropertyMap::CELL_MAR_TOP, pCellMarginHandler->m_nTopMargin );
5936 + if( pCellMarginHandler->m_bBottomMarginValid )
5937 + pMarginProps->setValue( TablePropertyMap::CELL_MAR_BOTTOM, pCellMarginHandler->m_nBottomMargin );
5938 + if( pCellMarginHandler->m_bLeftMarginValid )
5939 + pMarginProps->setValue( TablePropertyMap::CELL_MAR_LEFT, pCellMarginHandler->m_nLeftMargin );
5940 + if( pCellMarginHandler->m_bRightMarginValid )
5941 + pMarginProps->setValue( TablePropertyMap::CELL_MAR_RIGHT, pCellMarginHandler->m_nRightMargin );
5942 + insertTableProps(pMarginProps);
5946 + default: bRet = false;
5951 diff --git writerfilter/source/dmapper/TablePropertiesHandler.hxx writerfilter/source/dmapper/TablePropertiesHandler.hxx
5952 new file mode 100644
5953 index 0000000..9c91b41
5955 +++ writerfilter/source/dmapper/TablePropertiesHandler.hxx
5957 +#ifndef INCLUDED_TABLEPROPERTIESHANDLER_HXX
5958 +#define INCLUDED_TABLEPROPERTIESHANDLER_HXX
5960 +#include <PropertyMap.hxx>
5962 +#include <resourcemodel/TableManager.hxx>
5963 +#include <WriterFilterDllApi.hxx>
5964 +#include <resourcemodel/WW8ResourceModel.hxx>
5966 +#include <boost/shared_ptr.hpp>
5970 +namespace writerfilter {
5971 +namespace dmapper {
5973 +using namespace std;
5975 +typedef ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > Handle_t;
5976 +typedef TableManager<Handle_t , TablePropertyMapPtr > DomainMapperTableManager_Base_t;
5978 +class TablePropertiesHandler
5981 + vector< PropertyMapPtr > m_rPropertiesStack;
5982 + PropertyMapPtr m_pCurrentProperties;
5983 + DomainMapperTableManager_Base_t *m_pTableManager;
5987 + TablePropertiesHandler( bool bOOXML );
5988 + virtual ~TablePropertiesHandler( );
5990 + bool sprm(Sprm & sprm);
5992 + inline void SetTableManager( DomainMapperTableManager_Base_t *pTableManager )
5994 + m_pTableManager = pTableManager;
5997 + inline void SetProperties( PropertyMapPtr pProperties )
5999 + m_pCurrentProperties = pProperties;
6004 + inline void cellProps( TablePropertyMapPtr pProps )
6006 + if ( m_pTableManager )
6007 + m_pTableManager->cellProps( pProps );
6009 + m_pCurrentProperties->insert( pProps, true );
6012 + inline void cellPropsByCell( unsigned int i, TablePropertyMapPtr pProps )
6014 + if ( m_pTableManager )
6015 + m_pTableManager->cellPropsByCell( i, pProps );
6017 + m_pCurrentProperties->insert( pProps, true );
6020 + inline void insertRowProps( TablePropertyMapPtr pProps )
6022 + if ( m_pTableManager )
6023 + m_pTableManager->insertRowProps( pProps );
6025 + m_pCurrentProperties->insert( pProps, true );
6028 + inline void insertTableProps( TablePropertyMapPtr pProps )
6030 + if ( m_pTableManager )
6031 + m_pTableManager->insertTableProps( pProps );
6033 + m_pCurrentProperties->insert( pProps, true );
6036 +typedef boost::shared_ptr<TablePropertiesHandler> TablePropertiesHandlerPtr;
6041 diff --git writerfilter/source/dmapper/TblStylePrHandler.cxx writerfilter/source/dmapper/TblStylePrHandler.cxx
6042 new file mode 100644
6043 index 0000000..8f901ec
6045 +++ writerfilter/source/dmapper/TblStylePrHandler.cxx
6047 +#include <TblStylePrHandler.hxx>
6048 +#include <PropertyMap.hxx>
6049 +#include <ooxml/resourceids.hxx>
6051 +namespace writerfilter {
6052 +namespace dmapper {
6054 +TblStylePrHandler::TblStylePrHandler( DomainMapper & rDMapper ) :
6055 + m_rDMapper( rDMapper ),
6056 + m_pTablePropsHandler( new TablePropertiesHandler( true ) ),
6057 + m_nType( TBL_STYLE_UNKNOWN ),
6058 + m_pProperties( new PropertyMap )
6062 +TblStylePrHandler::~TblStylePrHandler( )
6064 + delete m_pTablePropsHandler, m_pTablePropsHandler = NULL;
6067 +void TblStylePrHandler::attribute(Id rName, Value & rVal)
6071 + case NS_ooxml::LN_CT_TblStyleOverrideType:
6073 + // The tokenid should be the same in the model.xml than
6074 + // in the TblStyleType enum
6075 + m_nType = TblStyleType( rVal.getInt( ) );
6081 +void TblStylePrHandler::sprm(Sprm & rSprm)
6083 + Value::Pointer_t pValue = rSprm.getValue();
6084 + switch ( rSprm.getId( ) )
6086 + case NS_ooxml::LN_CT_PPrBase:
6087 + case NS_ooxml::LN_EG_RPrBase:
6088 + case NS_ooxml::LN_CT_TblPrBase:
6089 + case NS_ooxml::LN_CT_TrPrBase:
6090 + case NS_ooxml::LN_CT_TcPrBase:
6091 + resolveSprmProps( rSprm );
6094 + // Tables specific properties have to handled here
6095 + m_pTablePropsHandler->SetProperties( m_pProperties );
6096 + bool bRet = m_pTablePropsHandler->sprm( rSprm );
6100 + // The DomainMapper can handle some of the properties
6101 + m_rDMapper.PushStyleSheetProperties( m_pProperties, true );
6102 + m_rDMapper.sprm( rSprm );
6103 + m_rDMapper.PopStyleSheetProperties( true );
6108 +void TblStylePrHandler::resolveSprmProps(Sprm & rSprm)
6110 + writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
6111 + if( pProperties.get())
6112 + pProperties->resolve(*this);
6116 diff --git writerfilter/source/dmapper/TblStylePrHandler.hxx writerfilter/source/dmapper/TblStylePrHandler.hxx
6117 new file mode 100644
6118 index 0000000..4b1298e
6120 +++ writerfilter/source/dmapper/TblStylePrHandler.hxx
6122 +#ifndef INCLUDED_TBLSTYLEPRHANDLER_HXX
6123 +#define INCLUDED_TBLSTYLEPRHANDLER_HXX
6125 +#include "TablePropertiesHandler.hxx"
6127 +#include <dmapper/DomainMapper.hxx>
6128 +#include <WriterFilterDllApi.hxx>
6129 +#include <resourcemodel/WW8ResourceModel.hxx>
6130 +#include <boost/shared_ptr.hpp>
6132 +namespace writerfilter {
6133 +namespace dmapper {
6135 +class DomainMapper;
6140 + TBL_STYLE_UNKNOWN,
6141 + TBL_STYLE_WHOLETABLE,
6142 + TBL_STYLE_FIRSTROW,
6143 + TBL_STYLE_LASTROW,
6144 + TBL_STYLE_FIRSTCOL,
6145 + TBL_STYLE_LASTCOL,
6146 + TBL_STYLE_BAND1VERT,
6147 + TBL_STYLE_BAND2VERT,
6148 + TBL_STYLE_BAND1HORZ,
6149 + TBL_STYLE_BAND2HORZ,
6156 +class WRITERFILTER_DLLPRIVATE TblStylePrHandler : public Properties
6159 + DomainMapper & m_rDMapper;
6160 + TablePropertiesHandler * m_pTablePropsHandler;
6162 + TblStyleType m_nType;
6163 + PropertyMapPtr m_pProperties;
6166 + TblStylePrHandler( DomainMapper & rDMapper );
6167 + virtual ~TblStylePrHandler( );
6170 + virtual void attribute(Id Name, Value & val);
6171 + virtual void sprm(Sprm & sprm);
6173 + inline PropertyMapPtr getProperties() { return m_pProperties; };
6174 + inline TblStyleType getType() { return m_nType; };
6178 + void resolveSprmProps(Sprm & rSprm);
6181 +typedef boost::shared_ptr< TblStylePrHandler > TblStylePrHandlerPtr;
6186 diff --git writerfilter/source/dmapper/makefile.mk writerfilter/source/dmapper/makefile.mk
6187 index e799892..5f42164 100644
6188 --- writerfilter/source/dmapper/makefile.mk
6189 +++ writerfilter/source/dmapper/makefile.mk
6190 @@ -43,6 +43,9 @@ ENABLE_EXCEPTIONS=TRUE
6191 # --- Files -------------------------------------
6193 SLOFILES= $(SLO)$/BorderHandler.obj \
6194 + $(SLO)$/TblStylePrHandler.obj \
6195 + $(SLO)$/GraphicHelpers.obj \
6196 + $(SLO)$/TablePropertiesHandler.obj \
6197 $(SLO)$/CellColorHandler.obj \
6198 $(SLO)$/CellMarginHandler.obj \
6199 $(SLO)$/SectionColumnHandler.obj \
6200 @@ -60,9 +63,11 @@ SLOFILES= $(SLO)$/BorderHandler.obj \
6201 $(SLO)$/PropertyIds.obj \
6202 $(SLO)$/StyleSheetTable.obj \
6203 $(SLO)$/TDefTableHandler.obj \
6204 - $(SLO)$/ThemeTable.obj \
6205 + $(SLO)$/ThemeTable.obj \
6206 + $(SLO)$/SettingsTable.obj \
6207 $(SLO)$/ModelEventListener.obj\
6208 - $(SLO)$/OLEHandler.obj
6209 + $(SLO)$/OLEHandler.obj \
6210 + $(SLO)$/PageBordersHandler.obj
6212 # --- Targets ----------------------------------
6214 diff --git writerfilter/source/ooxml/OOXMLFastContextHandler.cxx writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
6215 index 7a6418d..162ada2 100644
6216 --- writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
6217 +++ writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
6218 @@ -1869,6 +1869,16 @@ void OOXMLFastContextHandlerTextTable::lcl_startFastElement
6219 throw (uno::RuntimeException, xml::sax::SAXException)
6223 + boost::shared_ptr<OOXMLPropertySet> pProps( new OOXMLPropertySetImpl );
6225 + OOXMLValue::Pointer_t pVal
6226 + (new OOXMLIntegerValue(mnTableDepth));
6227 + OOXMLProperty::Pointer_t pProp
6228 + (new OOXMLPropertyImpl(NS_ooxml::LN_tblStart, pVal, OOXMLPropertyImpl::SPRM));
6229 + pProps->add(pProp);
6231 + mpParserState->setCharacterProperties(pProps);
6233 startAction(Element);
6235 @@ -1954,10 +1964,9 @@ void SAL_CALL ShapesNoAdd::remove(const uno::Reference< drawing::XShape > & xSha
6237 OOXMLFastContextHandlerShape::OOXMLFastContextHandlerShape
6238 (OOXMLFastContextHandler * pContext)
6239 -: OOXMLFastContextHandlerProperties(pContext)
6240 +: OOXMLFastContextHandlerProperties(pContext), m_bShapeSent( false )
6242 uno::Reference<uno::XComponentContext> xContext(getComponentContext());
6246 uno::Reference<XMultiComponentFactory> rServiceManager
6247 @@ -2008,7 +2017,9 @@ void OOXMLFastContextHandlerShape::lcl_startFastElement
6248 startAction(Element);
6250 if (mrShapeContext.is())
6252 mrShapeContext->startFastElement(Element, Attribs);
6256 void SAL_CALL OOXMLFastContextHandlerShape::startUnknownElement
6257 @@ -2029,28 +2040,43 @@ void OOXMLFastContextHandlerShape::setToken(Token_t nToken)
6258 mrShapeContext->setStartToken(nToken);
6261 -void OOXMLFastContextHandlerShape::lcl_endFastElement
6263 - throw (uno::RuntimeException, xml::sax::SAXException)
6264 +void OOXMLFastContextHandlerShape::sendShape( Token_t Element )
6266 - if (mrShapeContext.is())
6267 + if ( mrShapeContext.is() && !m_bShapeSent )
6269 - mrShapeContext->endFastElement(Element);
6271 uno::Reference<drawing::XShape> xShape(mrShapeContext->getShape());
6275 - awt::Point aPoint(xShape->getPosition());
6276 - awt::Size aSize(xShape->getSize());
6278 OOXMLValue::Pointer_t
6279 pValue(new OOXMLShapeValue(xShape));
6280 newProperty(NS_ooxml::LN_shape, pValue);
6281 + m_bShapeSent = true;
6283 + bool bIsPicture = Element == ( NS_picture | OOXML_pic );
6285 + // Notify the dmapper that the shape is ready to use
6286 + if ( !bIsPicture )
6287 + mpStream->startShape( xShape );
6292 +void OOXMLFastContextHandlerShape::lcl_endFastElement
6294 + throw (uno::RuntimeException, xml::sax::SAXException)
6296 + if (mrShapeContext.is())
6298 + mrShapeContext->endFastElement(Element);
6299 + sendShape( Element );
6302 OOXMLFastContextHandlerProperties::lcl_endFastElement(Element);
6304 + // Ending the shape should be the last thing to do
6305 + bool bIsPicture = Element == ( NS_picture | OOXML_pic );
6306 + if ( !bIsPicture )
6307 + mpStream->endShape( );
6310 void SAL_CALL OOXMLFastContextHandlerShape::endUnknownElement
6311 @@ -2091,6 +2117,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
6312 pWrapper->addNamespace(NS_wordprocessingml);
6313 pWrapper->addNamespace(NS_vml_wordprocessingDrawing);
6314 pWrapper->addNamespace(NS_office);
6315 + pWrapper->addToken( NS_vml|OOXML_textbox );
6317 xContextHandler.set(pWrapper);
6319 @@ -2098,6 +2125,7 @@ OOXMLFastContextHandlerShape::lcl_createFastChildContext
6320 xContextHandler.set(this);
6325 return xContextHandler;
6327 @@ -2207,6 +2235,11 @@ void OOXMLFastContextHandlerWrapper::addNamespace(const Id & nId)
6328 mMyNamespaces.insert(nId);
6331 +void OOXMLFastContextHandlerWrapper::addToken( Token_t Token )
6333 + mMyTokens.insert( Token );
6336 void OOXMLFastContextHandlerWrapper::lcl_startFastElement
6338 const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
6339 @@ -2251,7 +2284,9 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
6340 debug_logger->endElement("Wrapper-createChildContext");
6343 - if (mMyNamespaces.find(nNameSpace) != mMyNamespaces.end())
6344 + bool bInNamespaces = mMyNamespaces.find(nNameSpace) != mMyNamespaces.end();
6345 + bool bInTokens = mMyTokens.find( Element ) != mMyTokens.end( );
6346 + if ( bInNamespaces )
6347 xResult.set(createFromStart(Element, Attribs));
6348 else if (mxContext.is())
6350 @@ -2264,6 +2299,12 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
6357 + OOXMLFastContextHandlerShape* pShapeCtx = (OOXMLFastContextHandlerShape*)mpParent;
6358 + pShapeCtx->sendShape( Element );
6363 diff --git writerfilter/source/ooxml/OOXMLFastContextHandler.hxx writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
6364 index 33ad4b4..0958671 100644
6365 --- writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
6366 +++ writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
6367 @@ -558,6 +558,9 @@ protected:
6369 class OOXMLFastContextHandlerShape: public OOXMLFastContextHandlerProperties
6372 + bool m_bShapeSent;
6375 explicit OOXMLFastContextHandlerShape
6376 (OOXMLFastContextHandler * pContext);
6377 @@ -585,6 +588,9 @@ public:
6378 virtual void setToken(Token_t nToken);
6380 virtual ResourceEnum_t getResource() const { return SHAPE; }
6382 + void sendShape( Token_t Element );
6385 typedef uno::Reference<XFastShapeContextHandler> ShapeContextRef;
6386 ShapeContextRef mrShapeContext;
6387 @@ -649,6 +655,7 @@ public:
6388 virtual ResourceEnum_t getResource() const;
6390 void addNamespace(const Id & nId);
6391 + void addToken( Token_t Element );
6393 virtual void newProperty(const Id & rId, OOXMLValue::Pointer_t pVal);
6394 virtual void setPropertySet(OOXMLPropertySet::Pointer_t pPropertySet);
6395 @@ -683,6 +690,7 @@ protected:
6397 uno::Reference<XFastContextHandler> mxContext;
6398 set<Id> mMyNamespaces;
6399 + set<Token_t> mMyTokens;
6400 OOXMLPropertySet::Pointer_t mpPropertySet;
6402 OOXMLFastContextHandler * getFastContextHandler() const;
6403 diff --git writerfilter/source/ooxml/makefile.mk writerfilter/source/ooxml/makefile.mk
6404 index b30c7cc..73f1641 100644
6405 --- writerfilter/source/ooxml/makefile.mk
6406 +++ writerfilter/source/ooxml/makefile.mk
6407 @@ -151,6 +151,8 @@ OOXMLGPERFFASTTOKENXSL=gperffasttokenhandler.xsl
6409 OOXMLRESOURCEIDSHXX=$(OOXMLHXXOUTDIR)$/resourceids.hxx
6411 +NSPROCESS=namespace_preprocess.pl
6413 TOKENXML=$(OOXMLCXXOUTDIR)$/token.xml
6414 TOKENXMLTMP=$(OOXMLCXXOUTDIR)$/token.tmp
6416 @@ -162,6 +164,7 @@ OOXMLVALUESHXX=$(OOXMLCXXOUTDIR)$/OOXMLvalues.hxx
6417 OOXMLVALUESCXX=$(OOXMLCXXOUTDIR)$/OOXMLvalues.cxx
6418 GPERFFASTTOKENHXX=$(OOXMLHXXOUTDIR)$/gperffasttoken.hxx
6419 MODELPROCESSED=$(MISC)$/model_preprocessed.xml
6420 +NSXSL=$(MISC)$/namespacesmap.xsl
6423 $(OOXMLFASTRESOURCESHXX) \
6424 @@ -186,9 +189,15 @@ $(TOKENXMLTMP): $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/token.txt
6425 $(TOKENXML): tokenxmlheader $(TOKENXMLTMP) tokenxmlfooter
6426 @$(TYPE) tokenxmlheader $(TOKENXMLTMP) tokenxmlfooter > $@
6428 -$(MODELPROCESSED): $(OOXMLPREPROCESSXSL) $(OOXMLMODEL)
6429 +$(MISC)$/$(OOXMLPREPROCESSXSL): $(OOXMLPREPROCESSXSL)
6430 + $(COPY) $(PWD)$/$(OOXMLPREPROCESSXSL) $(MISC)
6432 +$(NSXSL) : $(OOXMLMODEL) $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/namespaces.txt $(NSPROCESS)
6433 + $(PERL) $(NSPROCESS) $(SOLARVER)$/$(INPATH)$/inc$(UPDMINOREXT)$/oox$/namespaces.txt > $@
6435 +$(MODELPROCESSED): $(NSXSL) $(MISC)$/$(OOXMLPREPROCESSXSL) $(OOXMLMODEL)
6436 @echo "Making: " $(@:f)
6437 - $(COMMAND_ECHO)$(XSLTPROC) $(OOXMLPREPROCESSXSL) $(OOXMLMODEL) > $@
6438 + $(COMMAND_ECHO)$(XSLTPROC) $(NSXSL) $(OOXMLMODEL) > $@
6440 $(OOXMLHXXOUTDIRCREATED):
6441 @$(MKDIRHIER) $(OOXMLHXXOUTDIR)
6442 diff --git writerfilter/source/ooxml/model.xml writerfilter/source/ooxml/model.xml
6443 index d6c1949..add4a80 100644
6444 --- writerfilter/source/ooxml/model.xml
6445 +++ writerfilter/source/ooxml/model.xml
6447 <?xml version="1.0"?>
6448 <model xmlns:rng="http://relaxng.org/ns/structure/1.0">
6449 - <namespace-alias name="http://www.w3.org/XML/1998/namespace" alias="xml" id="1"/>
6450 - <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships" alias="relationships" id="3"/>
6451 - <namespace-alias name="urn:schemas-microsoft-com:office:office" alias="office" id="32"/>
6452 - <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" alias="theme" id="14"/>
6453 - <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" alias="wordprocessingDrawing" id="24"/>
6454 - <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/main" alias="drawingml" id="21"/>
6455 - <namespace-alias name="urn:schemas-microsoft-com:vml" alias="vml" id="31"/>
6456 - <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/picture" alias="picture" id="25"/>
6457 - <namespace-alias name="urn:schemas-microsoft-com:office:word" alias="vml_wordprocessingDrawing" id="33"/>
6458 - <namespace-alias name="http://schemas.openxmlformats.org/wordprocessingml/2006/main" alias="wordprocessingml" id="60"/>
6459 - <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/math" alias="math" id="61"/>
6460 - <namespace-alias name="http://schemas.openxmlformats.org/schemaLibrary/2006/main" alias="schemaLibrary" id="62"/>
6461 - <namespace-alias name="http://sprm" alias="sprm" id="99"/>
6462 + <namespace-alias name="http://www.w3.org/XML/1998/namespace" alias="xml" id="XML"/>
6463 + <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships" alias="relationships" id="RELATIONSHIPS"/>
6464 + <namespace-alias name="urn:schemas-microsoft-com:office:office" alias="office" id="OFFICE"/>
6465 + <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" alias="theme" id="THEME"/>
6466 + <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" alias="wordprocessingDrawing" id="DOC_DRAWINGML"/>
6467 + <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/main" alias="drawingml" id="DRAWINGML"/>
6468 + <namespace-alias name="urn:schemas-microsoft-com:vml" alias="vml" id="VML"/>
6469 + <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/picture" alias="picture" id="PICTURE"/>
6470 + <namespace-alias name="urn:schemas-microsoft-com:office:word" alias="vml_wordprocessingDrawing" id="VML_DOC"/>
6471 + <namespace-alias name="http://schemas.openxmlformats.org/wordprocessingml/2006/main" alias="wordprocessingml" id="DOC"/>
6472 + <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/math" alias="math" id="MATH"/>
6473 + <namespace-alias name="http://schemas.openxmlformats.org/schemaLibrary/2006/main" alias="schemaLibrary" id="SML"/>
6474 + <namespace-alias name="http://sprm" alias="sprm" id="SPRM"/>
6475 <token tokenid="ooxml:shape"/>
6476 <token tokenid="ooxml:token"/>
6477 <token tokenid="ooxml:inputstream"/>
6478 <token tokenid="ooxml:trackchange"/>
6479 <token tokenid="ooxml:object"/>
6480 + <token tokenid="ooxml:tblStart"/>
6481 <namespace name="dml-stylesheet" url="http://schemas.openxmlformats.org/drawingml/2006/main" file="dml-stylesheet.rng">
6482 <start name="theme"/>
6483 <start name="themeOverride"/>
6484 @@ -6505,11 +6506,17 @@
6488 + <define name="CT_PositionOffset">
6489 + <ref name="ST_PositionOffset"/>
6491 <define name="ST_PositionOffset">
6493 <xs:documentation>Absolute Position Offset Value</xs:documentation>
6496 + <define name="CT_AlignH">
6497 + <ref name="ST_AlignH"/>
6499 <define name="ST_AlignH">
6501 <xs:documentation>Relative Horizontal Alignment Positions</xs:documentation>
6502 @@ -6553,10 +6560,10 @@
6503 <define name="CT_PosH">
6505 <element name="align">
6506 - <ref name="ST_AlignH"/>
6507 + <ref name="CT_AlignH"/>
6509 <element name="posOffset">
6510 - <ref name="ST_PositionOffset"/>
6511 + <ref name="CT_PositionOffset"/>
6514 <attribute name="relativeFrom">
6515 @@ -6564,6 +6571,9 @@
6516 <xs:documentation>Horizontal Position Relative Base</xs:documentation>
6519 + <define name="CT_AlignV">
6520 + <ref name="ST_AlignV"/>
6522 <define name="ST_AlignV">
6524 <xs:documentation>Vertical Alignment Definition</xs:documentation>
6525 @@ -6607,10 +6617,10 @@
6526 <define name="CT_PosV">
6528 <element name="align">
6529 - <ref name="ST_AlignV"/>
6530 + <ref name="CT_AlignV"/>
6532 <element name="posOffset">
6533 - <ref name="ST_PositionOffset"/>
6534 + <ref name="CT_PositionOffset"/>
6537 <attribute name="relativeFrom">
6538 @@ -6793,6 +6803,7 @@
6539 <element name="wrapTopAndBottom" tokenid="ooxml:EG_WrapType_wrapTopAndBottom"/>
6541 <resource name="ST_PositionOffset" resource="Integer" generated="yes"/>
6542 + <resource name="CT_PositionOffset" resource="IntegerValue"/>
6543 <resource name="ST_AlignH" resource="List" generated="yes">
6544 <value name="left" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_left">left</value>
6545 <value name="right" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_right">right</value>
6546 @@ -6800,6 +6811,7 @@
6547 <value name="inside" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_inside">inside</value>
6548 <value name="outside" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignH_outside">outside</value>
6550 + <resource name="CT_AlignH" resource="ListValue"/>
6551 <resource name="ST_RelFromH" resource="List" generated="yes">
6552 <value name="margin" tokenid="ooxml:Value_wordprocessingDrawing_ST_RelFromH_margin">margin</value>
6553 <value name="page" tokenid="ooxml:Value_wordprocessingDrawing_ST_RelFromH_page">page</value>
6554 @@ -6815,6 +6827,7 @@
6555 <element name="posOffset" tokenid="ooxml:CT_PosH_posOffset"/>
6556 <attribute name="relativeFrom" tokenid="ooxml:CT_PosH_relativeFrom"/>
6558 + <resource name="CT_AlignV" resource="ListValue"/>
6559 <resource name="ST_AlignV" resource="List" generated="yes">
6560 <value name="top" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignV_top">top</value>
6561 <value name="bottom" tokenid="ooxml:Value_wordprocessingDrawing_ST_AlignV_bottom">bottom</value>
6562 @@ -8326,8 +8339,6 @@
6563 <element name="nvPicPr" tokenid="ooxml:CT_Picture_nvPicPr"/>
6564 <element name="blipFill" tokenid="ooxml:CT_Picture_blipFill"/>
6565 <element name="spPr" tokenid="ooxml:CT_Picture_spPr"/>
6566 - <action name="start" action="mark" sendtokenid="ooxml:mark_shape" value="0"/>
6567 - <action name="end" action="mark" sendtokenid="ooxml:mark_shape" value="1"/>
6569 <resource name="pic" resource="Properties">
6570 <element name="pic" tokenid="ooxml:pic_pic"/>
6571 @@ -15471,19 +15482,19 @@
6574 <attribute name="zOrder">
6576 + <ref name="ST_PageBorderZOrder"/>
6577 <xs:documentation>Z-Ordering of Page Border</xs:documentation>
6581 <attribute name="display">
6583 + <ref name="ST_PageBorderDisplay"/>
6584 <xs:documentation>Pages to Display Page Borders</xs:documentation>
6588 <attribute name="offsetFrom">
6590 + <ref name="ST_PageBorderOffset"/>
6591 <xs:documentation>Page Border Positioning</xs:documentation>
6594 @@ -16563,15 +16574,18 @@
6598 + <define name="CT_ParaTrackChange">
6599 + <ref name="CT_TrackChange"/>
6601 <define name="EG_ParaRPrTrackChanges">
6603 <element name="ins">
6604 - <ref name="CT_TrackChange"/>
6605 + <ref name="CT_ParaTrackChange"/>
6609 <element name="del">
6610 - <ref name="CT_TrackChange"/>
6611 + <ref name="CT_ParaTrackChange"/>
6615 @@ -17550,7 +17564,7 @@
6617 <define name="CT_Cnf">
6618 <attribute name="val">
6620 + <ref name="ST_Cnf"/>
6621 <xs:documentation>Conditional Formatting Bit Mask</xs:documentation>
6624 @@ -19867,16 +19881,16 @@
6628 - <define name="CT_TblStylePr">
6629 + <define name="CT_Style_tblStylePr">
6632 <element name="pPr">
6633 - <ref name="CT_PPr"/>
6634 + <ref name="CT_PPrBase"/>
6638 <element name="rPr">
6639 - <ref name="CT_RPr"/>
6640 + <ref name="EG_RPrBase"/>
6644 @@ -19886,20 +19900,29 @@
6647 <element name="trPr">
6648 - <ref name="CT_TrPr"/>
6649 + <ref name="CT_TrPrBase"/>
6653 <element name="tcPr">
6654 - <ref name="CT_TcPr"/>
6655 + <ref name="CT_TcPrBase"/>
6659 <attribute name="type">
6661 + <ref name="ST_TblStyleOverrideType"/>
6662 <xs:documentation>Table Style Conditional Formatting Type</xs:documentation>
6665 + <define name="CT_Style_TblPr">
6666 + <ref name="CT_TblPrBase"/>
6668 + <define name="CT_Style_TrPr">
6669 + <ref name="CT_TrPrBase"/>
6671 + <define name="CT_Style_TcPr">
6672 + <ref name="CT_TcPrBase"/>
6674 <define name="ST_StyleType">
6676 <xs:documentation>Style Types</xs:documentation>
6677 @@ -19999,12 +20022,12 @@
6680 <element name="pPr">
6681 - <ref name="CT_PPr"/>
6682 + <ref name="CT_PPrBase"/>
6686 <element name="rPr">
6687 - <ref name="CT_RPr"/>
6688 + <ref name="EG_RPrBase"/>
6692 @@ -20014,17 +20037,17 @@
6695 <element name="trPr">
6696 - <ref name="CT_TrPr"/>
6697 + <ref name="CT_TrPrBase"/>
6701 <element name="tcPr">
6702 - <ref name="CT_TcPr"/>
6703 + <ref name="CT_TcPrBase"/>
6707 <element name="tblStylePr">
6708 - <ref name="CT_TblStylePr"/>
6709 + <ref name="CT_Style_tblStylePr"/>
6713 @@ -21617,6 +21640,11 @@
6714 <attribute name="author" tokenid="ooxml:CT_TrackChange_author"/>
6715 <attribute name="date" tokenid="ooxml:CT_TrackChange_date"/>
6717 + <resource name="CT_ParaTrackChange" resource="Properties">
6718 + <action name="start" action="tokenproperty"/>
6719 + <action name="start" action="propagateCharacterPropertiesAsSet" sendtokenid="ooxml:paratrackchange"/>
6720 + <action name="start" action="clearProps"/>
6722 <resource name="CT_CellMergeTrackChange" resource="Properties">
6723 <attribute name="vMerge" tokenid="ooxml:CT_CellMergeTrackChange_vMerge"/>
6724 <attribute name="vMergeOrig" tokenid="ooxml:CT_CellMergeTrackChange_vMergeOrig"/>
6725 @@ -21681,6 +21709,7 @@
6726 <action name="start" action="tokenproperty"/>
6727 <action name="start" action="propagateCharacterPropertiesAsSet" sendtokenid="ooxml:trackchange"/>
6728 <action name="start" action="clearProps"/>
6729 + <action name="end" action="mark" sendtokenid="ooxml:endtrackchange"/>
6731 <resource name="CT_NumPr" resource="Properties">
6732 <kind name="paragraph"/>
6733 @@ -21775,8 +21804,6 @@
6734 <resource name="CT_Picture" resource="Shape">
6735 <element name="movie" tokenid="ooxml:CT_Picture_movie"/>
6736 <element name="control" tokenid="ooxml:CT_Picture_control"/>
6737 - <action name="start" action="mark" sendtokenid="ooxml:mark_shape" value="0"/>
6738 - <action name="end" action="mark" sendtokenid="ooxml:mark_shape" value="1"/>
6739 <action name="end" action="sendPropertiesWithId" sendtokenid="ooxml:object"/>
6740 <action name="end" action="clearProps"/>
6742 @@ -22251,6 +22278,8 @@
6743 <resource name="CT_RPrOriginal" resource="Properties"/>
6744 <resource name="CT_ParaRPrOriginal" resource="Properties"/>
6745 <resource name="CT_ParaRPr" resource="Properties">
6746 + <element name="ins" tokenid="ooxml:CT_ParaRPr_ins"/>
6747 + <element name="del" tokenid="ooxml:CT_ParaRPr_del"/>
6748 <element name="rPrChange" tokenid="ooxml:CT_ParaRPr_rPrChange"/>
6750 <resource name="ST_RubyAlign" resource="List" generated="yes">
6751 @@ -22863,20 +22892,20 @@
6752 <element name="num" tokenid="ooxml:CT_Numbering_num"/>
6753 <element name="numIdMacAtCleanup" tokenid="ooxml:CT_Numbering_numIdMacAtCleanup"/>
6755 - <resource name="ST_TblStyleOverrideType" resource="List" generated="yes">
6756 - <value name="wholeTable" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_wholeTable">wholeTable</value>
6757 - <value name="firstRow" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_firstRow">firstRow</value>
6758 - <value name="lastRow" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_lastRow">lastRow</value>
6759 - <value name="firstCol" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_firstCol">firstCol</value>
6760 - <value name="lastCol" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_lastCol">lastCol</value>
6761 - <value name="band1Vert" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_band1Vert">band1Vert</value>
6762 - <value name="band2Vert" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_band2Vert">band2Vert</value>
6763 - <value name="band1Horz" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_band1Horz">band1Horz</value>
6764 - <value name="band2Horz" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_band2Horz">band2Horz</value>
6765 - <value name="neCell" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_neCell">neCell</value>
6766 - <value name="nwCell" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_nwCell">nwCell</value>
6767 - <value name="seCell" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_seCell">seCell</value>
6768 - <value name="swCell" tokenid="ooxml:Value_wordprocessingml_ST_TblStyleOverrideType_swCell">swCell</value>
6769 + <resource name="ST_TblStyleOverrideType" resource="List">
6770 + <value tokenid="1">wholeTable</value>
6771 + <value tokenid="2">firstRow</value>
6772 + <value tokenid="3">lastRow</value>
6773 + <value tokenid="4">firstCol</value>
6774 + <value tokenid="5">lastCol</value>
6775 + <value tokenid="6">band1Vert</value>
6776 + <value tokenid="7">band2Vert</value>
6777 + <value tokenid="8">band1Horz</value>
6778 + <value tokenid="9">band2Horz</value>
6779 + <value tokenid="10">neCell</value>
6780 + <value tokenid="11">nwCell</value>
6781 + <value tokenid="12">seCell</value>
6782 + <value tokenid="13">swCell</value>
6784 <resource name="ST_StyleType" resource="List">
6785 <value tokenid="1">paragraph</value>
6786 @@ -22884,6 +22913,14 @@
6787 <value tokenid="3">table</value>
6788 <value tokenid="4">numbering</value>
6790 + <resource name="CT_Style_tblStylePr" resource="Properties">
6791 + <element name="pPr" tokenid="ooxml:CT_PPrBase"/>
6792 + <element name="rPr" tokenid="ooxml:EG_RPrBase"/>
6793 + <element name="tblPr" tokenid="ooxml:CT_TblPrBase"/>
6794 + <element name="trPr" tokenid="ooxml:CT_TrPrBase"/>
6795 + <element name="tcPr" tokenid="ooxml:CT_TcPrBase"/>
6796 + <attribute name="type" tokenid="ooxml:CT_TblStyleOverrideType"/>
6798 <resource name="CT_Style" resource="Properties">
6799 <element name="name" tokenid="ooxml:CT_Style_name"/>
6800 <element name="aliases" tokenid="ooxml:CT_Style_aliases"/>
6801 diff --git writerfilter/source/ooxml/modelpreprocess.xsl writerfilter/source/ooxml/modelpreprocess.xsl
6802 index 51efa93..90376fc 100644
6803 --- writerfilter/source/ooxml/modelpreprocess.xsl
6804 +++ writerfilter/source/ooxml/modelpreprocess.xsl
6806 <xsl:apply-templates/>
6810 \ No newline at end of file
6812 diff --git writerfilter/source/ooxml/namespace_preprocess.pl writerfilter/source/ooxml/namespace_preprocess.pl
6813 new file mode 100644
6814 index 0000000..2685423
6816 +++ writerfilter/source/ooxml/namespace_preprocess.pl
6818 +$ARGV0 = shift @ARGV;
6821 +<?xml version="1.0"?>
6822 +<xsl:stylesheet version="1.0"
6823 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
6824 + <xsl:output method="xml"/>
6826 + <xsl:include href="./modelpreprocess.xsl"/>
6828 + <xsl:template match="namespace-alias[\@id]">
6829 + <xsl:variable name="value">
6830 + <xsl:call-template name="getnamespaceid">
6831 + <xsl:with-param name="id" select="\@id" />
6832 + </xsl:call-template>
6835 + <xsl:apply-templates select="@*"/>
6836 + <xsl:attribute name="id">
6837 + <xsl:value-of select="\$value"/>
6842 + <xsl:template name="getnamespaceid">
6843 + <xsl:param name='id'/>
6848 +# print the mapping
6849 +open ( NAMESPACES, $ARGV0 ) || die "can't open namespace file: $!";
6852 +while ( <NAMESPACES> )
6856 + if ( $_ =~ m/^$/ )
6858 + # Start a new group
6862 + elsif ( $_ =~ m/^[^#]/ )
6864 + # Neither an empty line nor a comment
6865 + $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Invalid namespace token $_";
6867 + $no = $group*10 + $i;
6869 + <xsl:when test="\$id = '$_'">
6870 + <xsl:text>$no</xsl:text>
6883 diff --git writerfilter/source/ooxml/resourcestools.xsl writerfilter/source/ooxml/resourcestools.xsl
6884 index 9b17e4d..7296cbd 100644
6885 --- writerfilter/source/ooxml/resourcestools.xsl
6886 +++ writerfilter/source/ooxml/resourcestools.xsl
6888 match="rng:define" use="ancestor::rng:grammar/@application"/>
6890 <xsl:key name="namespace-aliases" match="//namespace-alias" use="@name"/>
6892 + <!-- Tiny template helping devs to debug -->
6893 + <xsl:template name="dbg_path">
6894 + <xsl:text>/*</xsl:text>
6895 + <xsl:for-each select="ancestor::*">
6896 + <xsl:value-of select="name(.)"/>
6897 + <xsl:text>/</xsl:text>
6899 + <xsl:value-of select="name(.)"/>
6900 + <xsl:text>[@name=</xsl:text>
6901 + <xsl:value-of select="@name"/>
6902 + <xsl:text>]</xsl:text>
6903 + <xsl:text>*/</xsl:text>
6906 <xsl:template name="licenseheader">
6908 @@ -398,7 +412,7 @@ public:
6909 Generate switch body for createFastChildContext
6911 <xsl:template name="switchbodycreatechildcontext">
6912 - <xsl:for-each select=".//rng:element[@name]">
6913 + <xsl:for-each select=".//rng:element[@name]">
6914 <xsl:call-template name="caselabelfasttoken"/>
6915 <xsl:variable name="createstatement">
6916 <xsl:call-template name="fastelementcreatestatement"/>
6917 @@ -1543,6 +1557,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
6922 + <xsl:template name="fastcharactersstringvalue">
6925 + msValue = sText;</xsl:text>
6928 <xsl:template name="fastattributesstringvalue">
6929 <xsl:for-each select=".//rng:attribute">
6930 @@ -1555,6 +1575,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
6931 <xsl:text>);</xsl:text>
6935 + <xsl:template name="fastcharactersintvalue">
6938 + mnValue = sText.toInt32();</xsl:text>
6941 <xsl:template name="fastattributesintvalue">
6942 <xsl:for-each select=".//rng:attribute">
6943 @@ -1568,6 +1594,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
6947 + <xsl:template name="fastcharactershexvalue">
6950 + mnValue = sText.toInt32(16);</xsl:text>
6953 <xsl:template name="fastattributeshexvalue">
6954 <xsl:for-each select=".//rng:attribute">
6956 @@ -1580,6 +1612,12 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
6960 + <xsl:template name="fastcharactersboolvalue">
6963 + setValue( sText );</xsl:text>
6966 <xsl:template name="fastattributesboolvalue">
6967 <xsl:for-each select=".//rng:attribute">
6969 @@ -1592,6 +1630,35 @@ uno::Reference < xml::sax::XFastParser > OOXMLStreamImpl::getFastParser()
6973 + <xsl:template name="fastcharacterslistvalue">
6974 + <xsl:variable name="bodywithns">
6975 + <xsl:for-each select="rng:ref">
6976 + <xsl:variable name="refname" select="@name"/>
6977 + <xsl:variable name="refns">
6978 + <xsl:call-template name="searchdefinenamespace">
6979 + <xsl:with-param name="name" select="@name"/>
6980 + </xsl:call-template>
6982 + <xsl:variable name="valname">
6983 + <xsl:for-each select="/model/namespace[@name=substring-before($refns, ':')]">
6984 + <xsl:for-each select="./rng:grammar/rng:define[@name=substring-after($refns, ':')]">
6985 + <xsl:call-template name="valuenamefordefine"/>
6990 + mpValue = OOXMLValue::Pointer_t (new </xsl:text>
6991 + <xsl:value-of select="$valname"/>
6992 + <xsl:text>( sText ) );</xsl:text>
6995 + <xsl:if test="string-length($bodywithns) > 0">
6998 + <xsl:value-of select="$bodywithns"/>
7002 <xsl:template name="fastattributeslistvalue">
7003 <xsl:for-each select=".//rng:attribute">
7004 <xsl:variable name="myfasttoken">
7005 @@ -1739,9 +1806,9 @@ void </xsl:text>
7011 <xsl:template name="fastelementcreatestatement">
7012 - <xsl:for-each select=".//rng:ref">
7013 + <xsl:for-each select=".//rng:ref">
7015 <xsl:when test="@name='BUILT_IN_ANY_TYPE'">
7016 <xsl:text>createFromStart(Element, Attribs)</xsl:text>
7017 @@ -1999,6 +2066,29 @@ void </xsl:text>
7019 <xsl:template name="fastcharactersbody">
7020 <xsl:variable name="name" select="@name"/>
7021 + <!-- ST values as text -->
7022 + <xsl:variable name="resource">
7023 + <xsl:call-template name="contextresource"/>
7026 + <xsl:when test="$resource = 'StringValue'">
7027 + <xsl:call-template name="fastcharactersstringvalue"/>
7029 + <xsl:when test="$resource = 'IntegerValue'">
7030 + <xsl:call-template name="fastcharactersintvalue"/>
7032 + <xsl:when test="$resource = 'HexValue'">
7033 + <xsl:call-template name="fastcharactershexvalue"/>
7035 + <xsl:when test="$resource = 'BooleanValue'">
7036 + <xsl:call-template name="fastcharactersboolvalue"/>
7038 + <xsl:when test="$resource = 'ListValue'">
7039 + <xsl:call-template name="fastcharacterslistvalue"/>
7043 + <!-- characters action -->
7044 <xsl:for-each select="ancestor::namespace/resource[@name = $name]//action[@name='characters']">
7045 <xsl:call-template name="chooseaction"/>
7047 diff --git writerfilter/source/resourcemodel/WW8Analyzer.cxx writerfilter/source/resourcemodel/WW8Analyzer.cxx
7048 index 0bcf198..a3d70cf 100644
7049 --- writerfilter/source/resourcemodel/WW8Analyzer.cxx
7050 +++ writerfilter/source/resourcemodel/WW8Analyzer.cxx
7051 @@ -168,6 +168,14 @@ void WW8Analyzer::info(const string & /*info*/)
7055 +void WW8Analyzer::startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > /*xShape*/ )
7059 +void WW8Analyzer::endShape( )
7063 void WW8Analyzer::dumpStats(ostream & o) const
7066 diff --git writerfilter/source/resourcemodel/WW8Analyzer.hxx writerfilter/source/resourcemodel/WW8Analyzer.hxx
7067 index e437ed9..763d531 100644
7068 --- writerfilter/source/resourcemodel/WW8Analyzer.hxx
7069 +++ writerfilter/source/resourcemodel/WW8Analyzer.hxx
7070 @@ -92,6 +92,8 @@ public:
7071 virtual void substream(Id name,
7072 writerfilter::Reference<Stream>::Pointer_t ref);
7073 virtual void info(const string & info);
7074 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
7075 + virtual void endShape( );
7077 void dumpStats(ostream & o) const;
7079 diff --git writerfilter/source/resourcemodel/resourcemodel.cxx writerfilter/source/resourcemodel/resourcemodel.cxx
7080 index f311d36..60bb007 100644
7081 --- writerfilter/source/resourcemodel/resourcemodel.cxx
7082 +++ writerfilter/source/resourcemodel/resourcemodel.cxx
7083 @@ -266,6 +266,16 @@ void WW8StreamHandler::endCharacterGroup()
7085 output.addItem("</character-group>");
7088 +void WW8StreamHandler::startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > /*xShape*/ )
7090 + output.addItem("<shape>");
7093 +void WW8StreamHandler::endShape( )
7095 + output.addItem( "</shape>" );
7098 void WW8StreamHandler::text(const sal_uInt8 * data, size_t len)
7100 diff --git writerfilter/source/resourcemodel/resourcemodel.hxx writerfilter/source/resourcemodel/resourcemodel.hxx
7101 index 3d5bfa9..dcd90bc 100644
7102 --- writerfilter/source/resourcemodel/resourcemodel.hxx
7103 +++ writerfilter/source/resourcemodel/resourcemodel.hxx
7104 @@ -50,6 +50,9 @@ public:
7105 virtual void props(writerfilter::Reference<Properties>::Pointer_t ref);
7106 virtual void table(Id name,
7107 writerfilter::Reference<Table>::Pointer_t ref);
7109 + virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
7110 + virtual void endShape( );
7112 virtual void substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref);