oox/inc/oox/vml/vmlshape.hxx | 1 oox/source/token/properties.txt | 1 oox/source/vml/vmlshape.cxx | 19 +++++++++++ oox/source/vml/vmlshapecontext.cxx | 3 + sw/source/core/text/porrst.cxx | 10 +++--- sw/source/core/text/txtfrm.cxx | 11 ++---- writerfilter/inc/resourcemodel/TableManager.hxx | 4 +- writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 24 +++++++++++++-- writerfilter/source/dmapper/DomainMapperTableHandler.hxx | 2 - writerfilter/source/doctok/WW8ResourceModelImpl.cxx | 4 +- writerfilter/source/filter/ImportFilter.cxx | 14 ++++++++ writerfilter/source/resourcemodel/resourcemodel.cxx | 4 +- 12 files changed, 76 insertions(+), 21 deletions(-)
New commits: commit 53b7f7df0617bcbd7bbef9a34ef53e5097eb16dc Author: Pierre-Eric Pelloux-Prayer <pierre-e...@lanedo.com> Date: Thu Sep 20 11:49:29 2012 +0200 docx import: position table using tblInd OR tblCellMar Previously cell-margin was unconditionnaly used to compute table position. Office only does so on top-level tables and if tblInd is missing. Change-Id: I183647bcf090d5822b3f2e04e097c8bbd277168d diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx index bb72934..c601adf 100644 --- a/writerfilter/inc/resourcemodel/TableManager.hxx +++ b/writerfilter/inc/resourcemodel/TableManager.hxx @@ -62,7 +62,7 @@ public: /** Handle end of table. */ - virtual void endTable() = 0; + virtual void endTable(unsigned int nestedTableLevel) = 0; /** Handle start of row. @@ -994,7 +994,7 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable() mpTableDataHandler->endRow(); } - mpTableDataHandler->endTable(); + mpTableDataHandler->endTable(mTableDataStack.size() - 1); } catch (uno::Exception const& e) { diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index fbdabd9..dce337d 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -262,6 +262,7 @@ struct WRITERFILTER_DLLPRIVATE TableInfo sal_Int32 nRightBorderDistance; sal_Int32 nTopBorderDistance; sal_Int32 nBottomBorderDistance; + sal_Int32 nNestLevel; PropertyMapPtr pTableDefaults; PropertyMapPtr pTableBorders; TableStyleSheetEntry* pTableStyle; @@ -272,6 +273,7 @@ struct WRITERFILTER_DLLPRIVATE TableInfo , nRightBorderDistance(DEF_BORDER_DIST) , nTopBorderDistance(0) , nBottomBorderDistance(0) + , nNestLevel(0) , pTableDefaults(new PropertyMap) , pTableBorders(new PropertyMap) , pTableStyle(NULL) @@ -433,7 +435,24 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo lcl_debug_TableBorder(aTableBorder); #endif - m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( nLeftMargin - nGapHalf - rInfo.nLeftBorderDistance)); + // Mimic Office behavior : if tlbInd is defined, use it place table. + // Otherwise, top-level table's position depends w:tblCellMar attribute (but not nested tables) + if (nLeftMargin) + { + m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( nLeftMargin - nGapHalf)); + } + else + { + // TODO: top-level position depends on w:tblCellMar attribute, not w:cellMar + if (rInfo.nNestLevel > 1) + { + m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( - nGapHalf)); + } + else + { + m_aTableProperties->Insert( PROP_LEFT_MARGIN, false, uno::makeAny( - nGapHalf - rInfo.nLeftBorderDistance)); + } + } m_aTableProperties->getValue( TablePropertyMap::TABLE_WIDTH, nTableWidth ); if( nTableWidth > 0 ) @@ -672,13 +691,14 @@ RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties() return aRowProperties; } -void DomainMapperTableHandler::endTable() +void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) { #ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("tablehandler.endTable"); #endif TableInfo aTableInfo; + aTableInfo.nNestLevel = nestedTableLevel; aTableInfo.pTableStyle = endTableGetTableStyle(aTableInfo); // expands to uno::Sequence< Sequence< beans::PropertyValues > > diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx index 0ccd71c..ea4c421 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx @@ -78,7 +78,7 @@ public: virtual void startTable(unsigned int nRows, unsigned int nDepth, TablePropertyMapPtr pProps); - virtual void endTable(); + virtual void endTable(unsigned int nestedTableLevel); virtual void startRow(unsigned int nCells, TablePropertyMapPtr pProps); virtual void endRow(); virtual void startCell(const Handle_t & start, TablePropertyMapPtr pProps); diff --git a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx index 2b585ba..70016d5 100644 --- a/writerfilter/source/doctok/WW8ResourceModelImpl.cxx +++ b/writerfilter/source/doctok/WW8ResourceModelImpl.cxx @@ -44,7 +44,7 @@ public: typedef boost::shared_ptr<WW8TableDataHandler> Pointer_t; virtual void startTable(unsigned int nRows, unsigned int nDepth, TablePropsPointer_t pProps); - virtual void endTable(); + virtual void endTable(unsigned int nestedTableLevel); virtual void startRow(unsigned int nCols, TablePropsPointer_t pProps); virtual void endRow(); @@ -68,7 +68,7 @@ void WW8TableDataHandler::startTable(unsigned int nRows, unsigned int nDepth, output.addItem(tmpStr); } -void WW8TableDataHandler::endTable() +void WW8TableDataHandler::endTable(unsigned int /*nestedTableLevel*/) { output.addItem("</tabledata.table>"); } diff --git a/writerfilter/source/resourcemodel/resourcemodel.cxx b/writerfilter/source/resourcemodel/resourcemodel.cxx index 24f5798..1c9d89b 100644 --- a/writerfilter/source/resourcemodel/resourcemodel.cxx +++ b/writerfilter/source/resourcemodel/resourcemodel.cxx @@ -101,7 +101,7 @@ public: typedef boost::shared_ptr<WW8TableDataHandler> Pointer_t; virtual void startTable(unsigned int nRows, unsigned int nDepth, TablePropsRef_t pProps); - virtual void endTable(); + virtual void endTable(unsigned int nestedTableLevel); virtual void startRow(unsigned int nCols, TablePropsRef_t pProps); virtual void endRow(); @@ -125,7 +125,7 @@ void WW8TableDataHandler::startTable(unsigned int nRows, unsigned int nDepth, output.addItem(tmpStr); } -void WW8TableDataHandler::endTable() +void WW8TableDataHandler::endTable(unsigned int /*nestedTableLevel*/) { output.addItem("</tabledata.table>"); } commit 064ae986a0aa55db9f3ee829a7c83bf2ac65c77f Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Wed Sep 19 16:19:49 2012 +0200 n#779627: fixed the collapse empty cell paragraphs compat option This option didn't work if the paragraph to collapse had an alignment or spacing defined. This fix was needed to properly import docx/doc files Change-Id: I6b3522905714fe3def7d87cd82cca84746310793 diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index a89a373..037dd13 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -307,6 +307,8 @@ sal_Bool SwTxtFrm::FormatEmpty() { OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTxtFrm::FormatEmpty with swapped frame" ); + bool bCollapse = EmptyHeight( ) == 1 && this->IsCollapse( ); + if ( HasFollow() || GetTxtNode()->GetpSwpHints() || 0 != GetTxtNode()->GetNumRule() || GetTxtNode()->HasHiddenCharAttribute( true ) || @@ -314,14 +316,14 @@ sal_Bool SwTxtFrm::FormatEmpty() return sal_False; const SwAttrSet& aSet = GetTxtNode()->GetSwAttrSet(); const SvxAdjust nAdjust = aSet.GetAdjust().GetAdjust(); - if( ( ( ! IsRightToLeft() && ( SVX_ADJUST_LEFT != nAdjust ) ) || + if( !bCollapse && ( ( ( ! IsRightToLeft() && ( SVX_ADJUST_LEFT != nAdjust ) ) || ( IsRightToLeft() && ( SVX_ADJUST_RIGHT != nAdjust ) ) ) || - aSet.GetRegister().GetValue() ) + aSet.GetRegister().GetValue() ) ) return sal_False; const SvxLineSpacingItem &rSpacing = aSet.GetLineSpacing(); - if( SVX_LINE_SPACE_MIN == rSpacing.GetLineSpaceRule() || + if( !bCollapse && ( SVX_LINE_SPACE_MIN == rSpacing.GetLineSpaceRule() || SVX_LINE_SPACE_FIX == rSpacing.GetLineSpaceRule() || - aSet.GetLRSpace().IsAutoFirst() ) + aSet.GetLRSpace().IsAutoFirst() ) ) return sal_False; else { diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 1005969..c8a7b82 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -2058,7 +2058,7 @@ KSHORT SwTxtFrm::GetParHeight() const KSHORT nRet = (KSHORT)Prt().SSize().Height(); if( IsUndersized() ) { - if( IsEmpty() ) + if( IsEmpty() || GetTxt().Len() == 0 ) nRet = (KSHORT)EmptyHeight(); else ++nRet; @@ -2323,13 +2323,10 @@ void SwTxtFrm::_CalcHeightOfLastLine( const bool _bUseFont ) else { bool bCalcHeightOfLastLine = true; - if ( !HasPara() ) + if ( ( !HasPara() && IsEmpty( ) ) || GetTxt().Len( ) == 0 ) { - if ( IsEmpty() ) - { - mnHeightOfLastLine = EmptyHeight(); - bCalcHeightOfLastLine = false; - } + mnHeightOfLastLine = EmptyHeight(); + bCalcHeightOfLastLine = false; } if ( bCalcHeightOfLastLine ) commit 355d25eac764713f4d52eac801ade6e2ff1deab0 Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Wed Sep 19 16:19:37 2012 +0200 n#779627: added quite some compat options from the ww8 filter on writerfilter Change-Id: I9e8dee39f63a08517eb654e33747bd8c95d84b59 diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx index 4aaab65..2eef1c1 100644 --- a/writerfilter/source/filter/ImportFilter.cxx +++ b/writerfilter/source/filter/ImportFilter.cxx @@ -172,6 +172,20 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >& uno::Reference< lang::XMultiServiceFactory > xFactory( xDoc, uno::UNO_QUERY ); uno::Reference< beans::XPropertySet > xSettings( xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY ); + xSettings->setPropertyValue( "AddFrameOffsets", uno::makeAny( sal_True ) ); + xSettings->setPropertyValue( "UseOldNumbering", uno::makeAny( sal_False ) ); + xSettings->setPropertyValue( "IgnoreFirstLineIndentInNumbering", uno::makeAny( sal_False ) ); + xSettings->setPropertyValue( "DoNotResetParaAttrsForNumFont", uno::makeAny( sal_False ) ); + xSettings->setPropertyValue( "UseFormerLineSpacing", uno::makeAny( sal_False ) ); + xSettings->setPropertyValue( "AddParaSpacingToTableCells", uno::makeAny( sal_True ) ); + xSettings->setPropertyValue( "UseFormerObjectPositioning", uno::makeAny( sal_False ) ); + xSettings->setPropertyValue( "ConsiderTextWrapOnObjPos", uno::makeAny( sal_True ) ); + xSettings->setPropertyValue( "UseFormerTextWrapping", uno::makeAny( sal_False ) ); + xSettings->setPropertyValue( "TableRowKeep", uno::makeAny( sal_True ) ); + xSettings->setPropertyValue( "IgnoreTabsAndBlanksForLineCalculation", uno::makeAny( sal_True ) ); + xSettings->setPropertyValue( "InvertBorderSpacing", uno::makeAny( sal_True ) ); + xSettings->setPropertyValue( "CollapseEmptyCellPara", uno::makeAny( sal_True ) ); + xSettings->setPropertyValue( "TabOverflow", uno::makeAny( sal_True ) ); xSettings->setPropertyValue( "UnbreakableNumberings", uno::makeAny( sal_True ) ); // Don't load the default style definitions to avoid weird mix commit 27ad84a9e75d414e4c5bce6ace5a96dc5af6868f Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Mon Sep 17 17:42:00 2012 +0200 n#779627: support for arcsize value in VML Change-Id: If03f36d30a7861f5d14ed3142e339d52da0bdce0 diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx index 5bdc2b5..a09192a 100644 --- a/oox/inc/oox/vml/vmlshape.hxx +++ b/oox/inc/oox/vml/vmlshape.hxx @@ -77,6 +77,7 @@ struct ShapeTypeModel sal_Bool mbAutoHeight; ///< If true, the height value is a minimum value (mostly used for textboxes) sal_Bool mbVisible; ///< Visible or Hidden ::rtl::OUString maWrapStyle; ///< Wrapping mode for text. + ::rtl::OUString maArcsize; ///< round rectangles arc size StrokeModel maStrokeModel; ///< Border line formatting. FillModel maFillModel; ///< Shape fill formatting. diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 8d5ab7d..5967337 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -101,6 +101,7 @@ CopyBack CopyFormulas CopyOutputData CopyStyles +CornerRadius CrossoverPosition CrossoverValue CursorPositionX diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index fecade9..c9096eb 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <algorithm> + #include "oox/vml/vmlshape.hxx" #include <com/sun/star/beans/PropertyValues.hpp> @@ -502,7 +504,22 @@ Reference<XShape> RectangleShape::implConvertAndInsert(const Reference<XShapes>& return SimpleShape::createPictureObject(rxShapes, rShapeRect, aGraphicPath); // default: try to create a rectangle shape - return SimpleShape::implConvertAndInsert(rxShapes, rShapeRect); + Reference<XShape> xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect); + rtl::OUString sArcsize = maTypeModel.maArcsize; + if ( !sArcsize.isEmpty( ) ) + { + sal_Unicode cLastChar = sArcsize[sArcsize.getLength() - 1]; + sal_Int32 nValue = sArcsize.copy( 0, sArcsize.getLength() - 1 ).toInt32( ); + // Get the smallest half-side + double size = std::min( rShapeRect.Height, rShapeRect.Width ) / 2.0; + sal_Int32 nRadius = 0; + if ( cLastChar == 'f' ) + nRadius = size * nValue / 65536; + else if ( cLastChar == '%' ) + nRadius = size * nValue / 100; + PropertySet( xShape ).setAnyProperty( PROP_CornerRadius, makeAny( nRadius ) ); + } + return xShape; } // ============================================================================ diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx index 88998d1..165aee5 100644 --- a/oox/source/vml/vmlshapecontext.cxx +++ b/oox/source/vml/vmlshapecontext.cxx @@ -280,6 +280,9 @@ ShapeTypeContext::ShapeTypeContext( ContextHandler2Helper& rParent, ShapeType& r // fill settings (may be overridden by v:fill element later) mrTypeModel.maFillModel.moFilled = lclDecodeBool( rAttribs, XML_filled ); mrTypeModel.maFillModel.moColor = rAttribs.getString( XML_fillcolor ); + + // For roundrect we may have a arcsize attribute to read + mrTypeModel.maArcsize = rAttribs.getString( XML_arcsize,rtl::OUString( ) ); } ContextHandlerRef ShapeTypeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits