[Libreoffice-commits] .: 3 commits - sw/source writerfilter/debug_setup.mk writerfilter/inc writerfilter/source
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Tue Nov 8 08:06:33 PST 2011
sw/source/core/access/accmap.cxx | 1
sw/source/core/tox/toxhlp.cxx | 1
sw/source/core/unocore/unotext.cxx | 8 +
sw/source/ui/config/optpage.cxx | 2
writerfilter/debug_setup.mk | 2
writerfilter/inc/resourcemodel/TableManager.hxx | 64 +++++++--------
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 4
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 15 +--
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2
9 files changed, 55 insertions(+), 44 deletions(-)
New commits:
commit 0e26bd20978cbdd7c59368044c2a21b98ffba164
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Tue Nov 8 14:39:31 2011 +0100
writerfilter import, fixed the shapes import
In some cases like an OLE object inside a textbox, the imported document
was empty. This was due to unremoved text context in dmapper.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index b65cb21..0f90573 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -188,7 +188,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bIsColumnBreakDeferred( false ),
m_bIsPageBreakDeferred( false ),
m_bIsInShape( false ),
- m_bShapeContextAdded( false ),
+ m_bRemovedLastAnchored( false ),
m_pLastSectionContext( ),
m_nCurrentTabStopIndex( 0 ),
m_sCurrentParaStyleId(),
@@ -928,6 +928,8 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
// this is normal: the shape is already attached
}
m_aAnchoredStack.pop( );
+ m_aTextAppendStack.pop( );
+ m_bRemovedLastAnchored = true;
}
// Get the end of paragraph character inserted
@@ -1065,10 +1067,10 @@ void DomainMapper_Impl::appendOLE( const ::rtl::OUString& rStreamName, OLEHandle
// gives a better ( visually ) result
xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ANCHOR_TYPE ), uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) );
// remove ( if valid ) associated shape ( used for graphic replacement )
- if ( m_bShapeContextAdded )
+ if ( m_aAnchoredStack.size() > 0 )
{
if ( lcl_removeShape( m_xTextDocument, pOLEHandler->getShape(), m_aAnchoredStack, m_aTextAppendStack ) )
- m_bShapeContextAdded = false; // ensure PopShapeContext processing doesn't pop the append stack
+ m_bRemovedLastAnchored = true; // ensure PopShapeContext processing doesn't pop the append stack
}
//
@@ -1080,7 +1082,6 @@ void DomainMapper_Impl::appendOLE( const ::rtl::OUString& rStreamName, OLEHandle
(void)rEx;
OSL_FAIL( "Exception in creation of OLE object" );
}
-
}
@@ -1373,7 +1374,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
{
// Add the shape to the text append stack
m_aTextAppendStack.push( uno::Reference< text::XTextAppend >( xShape, uno::UNO_QUERY_THROW ) );
- m_bShapeContextAdded = true;
+ m_bRemovedLastAnchored = false;
// Add the shape to the anchored objects stack
uno::Reference< text::XTextContent > xTxtContent( xShape, uno::UNO_QUERY_THROW );
@@ -1418,11 +1419,11 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
void DomainMapper_Impl::PopShapeContext()
{
- if ( m_bShapeContextAdded )
+ if ( !m_bRemovedLastAnchored && m_aAnchoredStack.size() > 0 )
{
RemoveLastParagraph();
m_aTextAppendStack.pop();
- m_bShapeContextAdded = false;
+ m_aAnchoredStack.pop();
}
m_bIsInShape = false;
}
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index b9e9af1..e3b3fa1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -295,7 +295,7 @@ private:
bool m_bIsColumnBreakDeferred;
bool m_bIsPageBreakDeferred;
bool m_bIsInShape;
- bool m_bShapeContextAdded;
+ bool m_bRemovedLastAnchored;
LineNumberSettings m_aLineNumberSettings;
commit b32bcaf10a0dd0b901c6c330097b88fa1c2e9675
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Fri Nov 4 12:23:59 2011 +0100
sw, writerfilter: fixed debug builds and output dmapper table messages
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 4c03c4c..0b1916c 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -31,6 +31,7 @@
#include <rtl/ref.hxx>
+#include <rtl/strbuf.hxx>
#include <cppuhelper/weakref.hxx>
#include <vcl/window.hxx>
#include <svx/svdmodel.hxx>
diff --git a/sw/source/core/tox/toxhlp.cxx b/sw/source/core/tox/toxhlp.cxx
index e283232..9e9b261 100644
--- a/sw/source/core/tox/toxhlp.cxx
+++ b/sw/source/core/tox/toxhlp.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/i18n/XExtendedIndexEntrySupplier.hpp>
+#include <rtl/strbuf.hxx>
#include <tools/string.hxx>
#include <toxwrap.hxx>
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 8c35224..77e89af 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1775,7 +1775,7 @@ SwTestTabPage::SwTestTabPage( Window* pParent,
lcl_SetPosSize(aTest9CBox , Point(116, 53), Size(74 , 10));
lcl_SetPosSize(aTest10CBox , Point(116, 66), Size(74 , 10));
- aTestFL.SetText(rtl::OUString(RTL_CONSTASCII_STRINGPARAM("Settings only for testpurposes", RTL_TEXTENCODING_ASCII_US));
+ aTestFL.SetText(rtl::OUString::createFromAscii("Settings only for testpurposes"));
aTest1CBox .SetText( C2S("unused"));
aTest2CBox .SetText( C2S("dynamic"));
aTest3CBox .SetText( C2S("No calm" ));
diff --git a/writerfilter/debug_setup.mk b/writerfilter/debug_setup.mk
index e1d0a08..a618171 100644
--- a/writerfilter/debug_setup.mk
+++ b/writerfilter/debug_setup.mk
@@ -10,5 +10,7 @@ $(if $(filter-out 0 1,$(strip $(gb_DEBUGLEVEL))),\
-DDEBUG_IMPORT \
-DDEBUG_LOGGING \
-DDEBUG_DMAPPER_PROPERTY_MAP \
+ -DDEBUG_DMAPPER_TABLE_HANDLER \
+ -DDEBUG_TABLE \
)
endef
diff --git a/writerfilter/inc/resourcemodel/TableManager.hxx b/writerfilter/inc/resourcemodel/TableManager.hxx
index 36a9b86..04084d7 100644
--- a/writerfilter/inc/resourcemodel/TableManager.hxx
+++ b/writerfilter/inc/resourcemodel/TableManager.hxx
@@ -625,11 +625,11 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::cellDepth(sal_uInt32 nDepth)
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
{
mpTableLogger->startElement("tablemanager.cellDepth");
mpTableLogger->attribute("depth", nDepth);
- mpTableLogger->endElement("tablemanager.cellDepth");
+ mpTableLogger->endElement();
}
#endif
@@ -640,7 +640,7 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::inCell()
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
mpTableLogger->element("tablemanager.inCell");
#endif
setInCell(true);
@@ -653,7 +653,7 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::endCell()
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
mpTableLogger->element("tablemanager.endCell");
#endif
@@ -664,7 +664,7 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::endRow()
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
mpTableLogger->element("tablemanager.endRow");
#endif
@@ -682,11 +682,11 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::handle(const T & rHandle)
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get())
+ if (mpTableLogger)
{
mpTableLogger->startElement("tablemanager.handle");
mpTableLogger->chars(toString(rHandle));
- mpTableLogger->endElement("tablemanager.handle");
+ mpTableLogger->endElement();
}
#endif
@@ -697,7 +697,7 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::startLevel()
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
{
typename TableData<T, PropertiesPointer>::Pointer_t pTableData;
@@ -711,7 +711,7 @@ void TableManager<T, PropertiesPointer>::startLevel()
mpTableLogger->attribute("openCell",
pTableData->isCellOpen() ? "yes" : "no");
- mpTableLogger->endElement("tablemanager.startLevel");
+ mpTableLogger->endElement();
}
#endif
@@ -732,7 +732,7 @@ void TableManager<T, PropertiesPointer>::endLevel()
mTableDataStack.pop();
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
{
typename TableData<T, PropertiesPointer>::Pointer_t pTableData;
@@ -746,7 +746,7 @@ void TableManager<T, PropertiesPointer>::endLevel()
mpTableLogger->attribute("openCell",
pTableData->isCellOpen() ? "yes" : "no");
- mpTableLogger->endElement("tablemanager.endLevel");
+ mpTableLogger->endElement();
}
#endif
}
@@ -845,7 +845,7 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::handle0x7()
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
mpTableLogger->startElement("tablemanager.handle0x7");
#endif
@@ -858,8 +858,8 @@ void TableManager<T, PropertiesPointer>::handle0x7()
endRow();
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
- mpTableLogger->endElement("tablemanager.handle0x7");
+ if (mpTableLogger != NULL)
+ mpTableLogger->endElement();
#endif
}
@@ -891,7 +891,7 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::cellProps(PropertiesPointer pProps)
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
mpTableLogger->startElement("tablemanager.cellProps");
#endif
@@ -901,8 +901,8 @@ void TableManager<T, PropertiesPointer>::cellProps(PropertiesPointer pProps)
setCellProps(pProps);
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
- mpTableLogger->endElement("tablemanager.cellProps");
+ if (mpTableLogger != NULL)
+ mpTableLogger->endElement();
#endif
}
@@ -911,15 +911,15 @@ void TableManager<T, PropertiesPointer>::cellPropsByCell
(unsigned int i, PropertiesPointer pProps)
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
mpTableLogger->startElement("tablemanager.cellPropsByCell");
#endif
mTableDataStack.top()->insertCellProperties(i, pProps);
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
- mpTableLogger->endElement("tablemanager.cellPropsByCell");
+ if (mpTableLogger != NULL)
+ mpTableLogger->endElement();
#endif
}
@@ -927,7 +927,7 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::insertRowProps(PropertiesPointer pProps)
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
mpTableLogger->startElement("tablemanager.insertRowProps");
#endif
@@ -937,8 +937,8 @@ void TableManager<T, PropertiesPointer>::insertRowProps(PropertiesPointer pProps
setRowProps(pProps);
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
- mpTableLogger->endElement("tablemanager.insertRowProps");
+ if (mpTableLogger != NULL)
+ mpTableLogger->endElement();
#endif
}
@@ -946,7 +946,7 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::insertTableProps(PropertiesPointer pProps)
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
mpTableLogger->startElement("tablemanager.insertTableProps");
#endif
@@ -956,8 +956,8 @@ void TableManager<T, PropertiesPointer>::insertTableProps(PropertiesPointer pPro
setTableProps(pProps);
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
- mpTableLogger->endElement("tablemanager.insertTableProps");
+ if (mpTableLogger != NULL)
+ mpTableLogger->endElement();
#endif
}
@@ -965,7 +965,7 @@ template <typename T, typename PropertiesPointer>
void TableManager<T, PropertiesPointer>::resolveCurrentTable()
{
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
+ if (mpTableLogger != NULL)
mpTableLogger->startElement("tablemanager.resolveCurrentTable");
#endif
@@ -1016,8 +1016,8 @@ void TableManager<T, PropertiesPointer>::resolveCurrentTable()
clearData();
#ifdef DEBUG_TABLE
- if (mpTableLogger.get() != NULL)
- mpTableLogger->endElement("tablemanager.resolveCurrentTable");
+ if (mpTableLogger != NULL)
+ mpTableLogger->endElement();
#endif
}
@@ -1049,7 +1049,7 @@ void TableManager<T, PropertiesPointer>::openCell
#ifdef DEBUG_TABLE
mpTableLogger->startElement("tablemanager.openCell");
mpTableLogger->chars(toString(rHandle));
- mpTableLogger->endElement("tablemanager.openCell");
+ mpTableLogger->endElement();
#endif
if (mTableDataStack.size() > 0)
@@ -1068,7 +1068,7 @@ void TableManager<T, PropertiesPointer>::closeCell
#ifdef DEBUG_TABLE
mpTableLogger->startElement("tablemanager.closeCell");
mpTableLogger->chars(toString(rHandle));
- mpTableLogger->endElement("tablemanager.closeCell");
+ mpTableLogger->endElement();
#endif
if (mTableDataStack.size() > 0)
@@ -1101,7 +1101,7 @@ void TableManager<T, PropertiesPointer>::ensureOpenCell(PropertiesPointer pProp
}
}
#ifdef DEBUG_TABLE
- mpTableLogger->endElement("tablemanager.ensureOpenCell");
+ mpTableLogger->endElement();
#endif
}
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 31f8c20..55ae016 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -719,9 +719,11 @@ void DomainMapperTableHandler::endTable()
m_xTableRange = xTable->getAnchor( );
}
}
- catch (lang::IllegalArgumentException)
+ catch ( lang::IllegalArgumentException &e )
{
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
+ fprintf( stderr, "Conversion to table error: %s\n",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
dmapper_logger->chars("failed to import table!");
#endif
}
commit 0ec5a0d1829ee201bc634699fc19259bfd6ffd10
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Fri Nov 4 12:23:09 2011 +0100
Added some messages to exceptions to make them usable for debugging
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 594c3cf..2886b36 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1794,7 +1794,9 @@ void SwXText::Impl::ConvertCell(
{
if (rCell.getLength() != 2)
{
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii( "rCell needs to contain 2 elements" ),
+ uno::Reference< text::XTextCopy >( &m_rThis ), sal_Int16( 2 ) );
}
const uno::Reference<text::XTextRange> xStartRange = rCell[0];
const uno::Reference<text::XTextRange> xEndRange = rCell[1];
@@ -1807,7 +1809,9 @@ void SwXText::Impl::ConvertCell(
if (!::sw::XTextRangeToSwPaM(aStartCellPam, xStartRange) ||
!::sw::XTextRangeToSwPaM(aEndCellPam, xEndRange))
{
- throw lang::IllegalArgumentException();
+ throw lang::IllegalArgumentException(
+ rtl::OUString::createFromAscii( "Start or End range cannot be resolved to a SwPaM" ),
+ uno::Reference< text::XTextCopy >( &m_rThis ), sal_Int16( 2 ) );
}
SwNodeRange aTmpRange(aStartCellPam.Start()->nNode,
More information about the Libreoffice-commits
mailing list