writerfilter07: debugging code in domain mapper

This commit is contained in:
Henning Brinkmann 2010-02-10 14:18:27 +01:00
parent 44fbecc83e
commit 55794d87ee
4 changed files with 94 additions and 58 deletions

View file

@ -35,6 +35,10 @@
#include <com/sun/star/text/HoriOrientation.hpp>
#include <dmapperLoggers.hxx>
#ifdef DEBUG_DOMAINMAPPER
#include <PropertyMapHelper.hxx>
#endif
namespace writerfilter {
namespace dmapper {
@ -688,49 +692,8 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
++nRow;
++aRowOfCellsIterator;
}
#ifdef DEBUG_DOMAINMAPPER
//-->debug cell properties of all rows
{
dmapper_logger->startElement("cellProps.table");
::rtl::OUString sNames;
for( sal_Int32 nDebugRow = 0; nDebugRow < aCellProperties.getLength(); ++nDebugRow)
{
dmapper_logger->startElement("cellProps.row");
dmapper_logger->attribute("n", nDebugRow);
const uno::Sequence< beans::PropertyValues > aDebugCurrentRow = aCellProperties[nDebugRow];
sal_Int32 nDebugCells = aDebugCurrentRow.getLength();
(void) nDebugCells;
for( sal_Int32 nDebugCell = 0; nDebugCell < nDebugCells; ++nDebugCell)
{
dmapper_logger->startElement("cellProps.cell");
dmapper_logger->attribute("n", nDebugCell);
const uno::Sequence< beans::PropertyValue >& aDebugCellProperties = aDebugCurrentRow[nDebugCell];
sal_Int32 nDebugCellProperties = aDebugCellProperties.getLength();
for( sal_Int32 nDebugProperty = 0; nDebugProperty < nDebugCellProperties; ++nDebugProperty)
{
const ::rtl::OUString sName = aDebugCellProperties[nDebugProperty].Name;
dmapper_logger->startElement("cellProps.property");
dmapper_logger->attribute("name", sName);
dmapper_logger->endElement("cellProps.property");
sNames += sName;
sNames += ::rtl::OUString('-');
}
sNames += ::rtl::OUString('+');
dmapper_logger->endElement("cellProps.cell");
}
sNames += ::rtl::OUString('|');
dmapper_logger->endElement("cellProps.row");
}
dmapper_logger->endElement("cellProps.table");
(void)sNames;
}
//--<
dmapper_logger->endElement("getCellProperties");
#endif
@ -739,12 +702,19 @@ CellPropertyValuesSeq_t DomainMapperTableHandler::endTableGetCellProperties(Tabl
RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties()
{
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->startElement("getRowProperties");
#endif
RowPropertyValuesSeq_t aRowProperties( m_aRowProperties.size() );
PropertyMapVector1::const_iterator aRowIter = m_aRowProperties.begin();
PropertyMapVector1::const_iterator aRowIterEnd = m_aRowProperties.end();
sal_Int32 nRow = 0;
while( aRowIter != aRowIterEnd )
{
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->startElement("rowProps.row");
#endif
if( aRowIter->get() )
{
//set default to 'break across pages"
@ -752,11 +722,22 @@ RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties()
aRowIter->get()->Insert( PROP_IS_SPLIT_ALLOWED, false, uno::makeAny(sal_True ) );
aRowProperties[nRow] = aRowIter->get()->GetPropertyValues();
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->addTag((*aRowIter)->toTag());
dmapper_logger->addTag(lcl_PropertyValuesToTag(aRowProperties[nRow]));
#endif
}
++nRow;
++aRowIter;
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->endElement("rowProps.row");
#endif
}
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->endElement("getRowProperties");
#endif
return aRowProperties;
}
@ -773,22 +754,15 @@ void DomainMapperTableHandler::endTable()
CellPropertyValuesSeq_t aCellProperties = endTableGetCellProperties(aTableInfo);
RowPropertyValuesSeq_t aRowProperties = endTableGetRowProperties();
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->addTag(lcl_PropertyValueSeqToTag(aRowProperties));
#endif
if (m_pTableSeq->getLength() > 0)
{
try
{
#ifdef DEBUG_DOMAINMAPPER
{
sal_Int32 nCellPropertiesRows = aCellProperties.getLength();
sal_Int32 nCellPropertiesCells = aCellProperties[0].getLength();
sal_Int32 nCellPropertiesProperties = aCellProperties[0][0].getLength();
(void) nCellPropertiesRows;
(void) nCellPropertiesCells;
(void) nCellPropertiesProperties;
++nCellPropertiesProperties;
}
#endif
uno::Reference<text::XTextTable> xTable = m_xText->convertToTable(*m_pTableSeq,
aCellProperties,
aRowProperties,

View file

@ -147,7 +147,7 @@ XMLTag::Pointer_t PropertyMap::toTag()
switch (aMapIter->first.eId)
{
case PROP_TABLE_COLUMN_SEPARATORS:
pTag->addTag(lcl_TableColumnSeparatorsToTag(aMapIter));
pTag->addTag(lcl_TableColumnSeparatorsToTag(aMapIter->second));
break;
default:
break;

View file

@ -39,10 +39,10 @@ namespace dmapper
using namespace ::com::sun::star;
XMLTag::Pointer_t lcl_TableColumnSeparatorsToTag(PropertyMap::iterator aIter)
XMLTag::Pointer_t lcl_TableColumnSeparatorsToTag(uno::Any & rTableColumnSeparators)
{
uno::Sequence<text::TableColumnSeparator> aSeq;
aIter->second >>= aSeq;
rTableColumnSeparators >>= aSeq;
XMLTag::Pointer_t pResult(new XMLTag("property.TableColumnSeparators"));
@ -60,5 +60,60 @@ XMLTag::Pointer_t lcl_TableColumnSeparatorsToTag(PropertyMap::iterator aIter)
return pResult;
}
XMLTag::Pointer_t lcl_PropertyValuesToTag(beans::PropertyValues & rValues)
{
XMLTag::Pointer_t pResult(new XMLTag("propertyValues"));
beans::PropertyValue * pValues = rValues.getArray();
for (sal_Int32 n = 0; n < rValues.getLength(); ++n)
{
XMLTag::Pointer_t pTag(new XMLTag("propertyValue"));
pTag->addAttr("name", pValues[n].Name);
if (pValues[n].Name.equalsAscii("TableColumnSeparators"))
{
pTag->addTag(lcl_TableColumnSeparatorsToTag(pValues[n].Value));
}
pResult->addTag(pTag);
}
return pResult;
}
XMLTag::Pointer_t lcl_PropertyValueSeqToTag(PropertyValueSeq_t & rPropValSeq)
{
XMLTag::Pointer_t pResult(new XMLTag("PropertyValueSeq"));
beans::PropertyValues * pValues = rPropValSeq.getArray();
for (sal_Int32 n = 0; n < rPropValSeq.getLength(); ++n)
{
XMLTag::Pointer_t pTag(lcl_PropertyValuesToTag(pValues[n]));
pResult->addTag(pTag);
}
return pResult;
}
XMLTag::Pointer_t lcl_PropertyValueSeqSeqToTag(PropertyValueSeqSeq_t rPropValSeqSeq)
{
XMLTag::Pointer_t pResult(new XMLTag("PropertyValueSeq"));
PropertyValueSeq_t * pValues = rPropValSeqSeq.getArray();
for (sal_Int32 n = 0; n < rPropValSeqSeq.getLength(); ++n)
{
XMLTag::Pointer_t pTag(lcl_PropertyValueSeqToTag(pValues[n]));
pResult->addTag(pTag);
}
return pResult;
}
}
}

View file

@ -29,13 +29,20 @@
************************************************************************/
#include "PropertyMap.hxx"
#include <com/sun/star/beans/PropertyValues.hpp>
namespace writerfilter
{
namespace dmapper
{
XMLTag::Pointer_t lcl_TableColumnSeparatorsToTag(PropertyMap::iterator aIter);
XMLTag::Pointer_t lcl_TableColumnSeparatorsToTag(uno::Any & rTableColumnSeparators);
XMLTag::Pointer_t lcl_PropertyValuesToTag(beans::PropertyValues & rValues);
typedef uno::Sequence<beans::PropertyValues> PropertyValueSeq_t;
XMLTag::Pointer_t lcl_PropertyValueSeqToTag(PropertyValueSeq_t & rPropValSeq);
typedef uno::Sequence<PropertyValueSeq_t> PropertyValueSeqSeq_t;
XMLTag::Pointer_t lcl_PropertyValueSeqSeqToTag(PropertyValueSeqSeq_t & rPropValSeqSeq);
}
}