[Libreoffice-commits] .: writerfilter/source
David Tardon
dtardon at kemper.freedesktop.org
Sat Jan 15 01:50:49 PST 2011
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 129 ++++++---------
1 file changed, 52 insertions(+), 77 deletions(-)
New commits:
commit 13bb1600378671f50c4784451df4b9b76fd7bc4f
Author: David Tardon <dtardon at redhat.com>
Date: Sat Jan 15 10:45:19 2011 +0100
use css::table::BorderLine2
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index ace17aa..582c9d6 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -303,7 +303,30 @@ struct WRITERFILTER_DLLPRIVATE TableInfo
}
};
-
+
+namespace
+{
+
+bool lcl_extractTableBorderProperty(PropertyMapPtr pTableProperties, const PropertyIds nId, TableInfo& rInfo, table::BorderLine2& rLine)
+{
+ PropertyMap::iterator aTblBorderIter = pTableProperties->find( PropertyDefinition(nId, false) );
+ if( aTblBorderIter != pTableProperties->end() )
+ {
+ OSL_VERIFY(aTblBorderIter->second >>= rLine);
+
+ rInfo.pTableBorders->Insert( nId, false, uno::makeAny( rLine ) );
+ PropertyMap::iterator pIt = rInfo.pTableDefaults->find( PropertyDefinition( nId, false ) );
+ if ( pIt != rInfo.pTableDefaults->end( ) )
+ rInfo.pTableDefaults->erase( pIt );
+
+ return true;
+ }
+
+ return false;
+}
+
+}
+
TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo & rInfo)
{
// will receive the table style if any
@@ -392,89 +415,41 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
//table border settings
table::TableBorder aTableBorder;
-
- PropertyMap::iterator aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_TOP_BORDER, false) );
- if( aTblBorderIter != m_aTableProperties->end() )
- {
- aTblBorderIter->second >>= aTableBorder.TopLine;
- aTableBorder.IsTopLineValid = true;
- m_aTableProperties->erase( aTblBorderIter );
-
- rInfo.pTableBorders->Insert( PROP_TOP_BORDER, false,
- uno::makeAny( aTableBorder.TopLine ) );
- PropertyMap::iterator pIt = rInfo.pTableDefaults->find( PropertyDefinition( PROP_TOP_BORDER, false ) );
- if ( pIt != rInfo.pTableDefaults->end( ) )
- rInfo.pTableDefaults->erase( pIt );
+ table::BorderLine2 aBorderLine;
+
+ if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_TOP_BORDER, rInfo, aBorderLine))
+ {
+ aTableBorder.TopLine = aBorderLine;
+ aTableBorder.IsTopLineValid = sal_True;
}
- aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_BOTTOM_BORDER, false) );
- if( aTblBorderIter != m_aTableProperties->end() )
- {
- aTblBorderIter->second >>= aTableBorder.BottomLine;
- aTableBorder.IsBottomLineValid = true;
- m_aTableProperties->erase( aTblBorderIter );
-
- rInfo.pTableBorders->Insert( PROP_BOTTOM_BORDER, false,
- uno::makeAny( aTableBorder.BottomLine));
- PropertyMap::iterator pIt = rInfo.pTableDefaults->find( PropertyDefinition( PROP_BOTTOM_BORDER, false ) );
- if ( pIt != rInfo.pTableDefaults->end( ) )
- rInfo.pTableDefaults->erase( pIt );
+ if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_BOTTOM_BORDER, rInfo, aBorderLine))
+ {
+ aTableBorder.BottomLine = aBorderLine;
+ aTableBorder.IsBottomLineValid = sal_True;
}
- aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_LEFT_BORDER, false) );
- if( aTblBorderIter != m_aTableProperties->end() )
- {
- aTblBorderIter->second >>= aTableBorder.LeftLine;
- aTableBorder.IsLeftLineValid = true;
- m_aTableProperties->erase( aTblBorderIter );
-
- rInfo.pTableBorders->Insert( PROP_LEFT_BORDER, false,
- uno::makeAny( aTableBorder.LeftLine ) );
- PropertyMap::iterator pIt = rInfo.pTableDefaults->find( PropertyDefinition( PROP_LEFT_BORDER, false ) );
- if ( pIt != rInfo.pTableDefaults->end( ) )
- rInfo.pTableDefaults->erase( pIt );
+ if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_LEFT_BORDER, rInfo, aBorderLine))
+ {
+ aTableBorder.LeftLine = aBorderLine;
+ aTableBorder.IsLeftLineValid = sal_True;
}
- aTblBorderIter = m_aTableProperties->find( PropertyDefinition(PROP_RIGHT_BORDER, false) );
- if( aTblBorderIter != m_aTableProperties->end() )
- {
- aTblBorderIter->second >>= aTableBorder.RightLine;
- aTableBorder.IsRightLineValid = true;
- m_aTableProperties->erase( aTblBorderIter );
-
- rInfo.pTableBorders->Insert( PROP_RIGHT_BORDER, false,
- uno::makeAny( aTableBorder.RightLine ) );
- PropertyMap::iterator pIt = rInfo.pTableDefaults->find( PropertyDefinition( PROP_RIGHT_BORDER, false ) );
- if ( pIt != rInfo.pTableDefaults->end( ) )
- rInfo.pTableDefaults->erase( pIt );
+ if (lcl_extractTableBorderProperty(m_aTableProperties, PROP_RIGHT_BORDER, rInfo, aBorderLine))
+ {
+ aTableBorder.RightLine = aBorderLine;
+ aTableBorder.IsRightLineValid = sal_True;
}
- aTblBorderIter = m_aTableProperties->find( PropertyDefinition(META_PROP_HORIZONTAL_BORDER, false) );
- if( aTblBorderIter != m_aTableProperties->end() )
- {
- aTblBorderIter->second >>= aTableBorder.HorizontalLine;
- aTableBorder.IsHorizontalLineValid = true;
- m_aTableProperties->erase( aTblBorderIter );
-
- rInfo.pTableBorders->Insert
- (META_PROP_HORIZONTAL_BORDER, false,
- uno::makeAny( aTableBorder.HorizontalLine ) );
- PropertyMap::iterator pIt = rInfo.pTableDefaults->find( PropertyDefinition( META_PROP_HORIZONTAL_BORDER, false ) );
- if ( pIt != rInfo.pTableDefaults->end( ) )
- rInfo.pTableDefaults->erase( pIt );
+ if (lcl_extractTableBorderProperty(m_aTableProperties, META_PROP_HORIZONTAL_BORDER, rInfo, aBorderLine))
+ {
+ aTableBorder.HorizontalLine = aBorderLine;
+ aTableBorder.IsHorizontalLineValid = sal_True;
}
- aTblBorderIter = m_aTableProperties->find( PropertyDefinition(META_PROP_VERTICAL_BORDER, false) );
- if( aTblBorderIter != m_aTableProperties->end() )
- {
- aTblBorderIter->second >>= aTableBorder.VerticalLine;
- aTableBorder.IsVerticalLineValid = true;
- m_aTableProperties->erase( aTblBorderIter );
-
- rInfo.pTableBorders->Insert
- (META_PROP_VERTICAL_BORDER, false,
- uno::makeAny( aTableBorder.VerticalLine ) );
- PropertyMap::iterator pIt = rInfo.pTableDefaults->find( PropertyDefinition( META_PROP_VERTICAL_BORDER, false ) );
- if ( pIt != rInfo.pTableDefaults->end( ) )
- rInfo.pTableDefaults->erase( pIt );
+ if (lcl_extractTableBorderProperty(m_aTableProperties, META_PROP_VERTICAL_BORDER, rInfo, aBorderLine))
+ {
+ aTableBorder.VerticalLine = aBorderLine;
+ aTableBorder.IsVerticalLineValid = sal_True;
}
+
aTableBorder.Distance = 0;
- aTableBorder.IsDistanceValid = false;
+ aTableBorder.IsDistanceValid = sal_False;
m_aTableProperties->Insert( PROP_TABLE_BORDER, false, uno::makeAny( aTableBorder ) );
More information about the Libreoffice-commits
mailing list