summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2009-10-28 15:40:57 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2009-10-28 15:40:57 +0000
commit81286906d0b76a3b6c4443378877828290c3e5f0 (patch)
tree3f0e634faa787cd1ed457268625ffbf4f558db76 /sw
parent850ec5b34c7d8d77061267f4f4020b9512269cc5 (diff)
CWS-TOOLING: integrate CWS writerfilter32bugfixes01
2009-10-16 10:25:35 +0200 os r276956 : warning fixed 2009-10-16 10:18:35 +0200 os r276954 : using namespace std removed from headers 2009-10-16 10:18:19 +0200 os r276953 : using namespace std removed from headers 2009-10-16 10:17:35 +0200 os r276952 : using namespace std removed from headers 2009-10-14 12:14:16 +0200 cedricbosdo r276890 : Fixed warnings 2009-10-09 08:36:35 +0200 cedricbosdo r276796 : Rebased to OOO320_m1 2009-10-05 11:32:53 +0200 cedricbosdo r276668 : * Fixed namespace_preprocess for windows build * Removed some unused variable * Set a default value for GetCurrentToken 2009-09-07 13:05:30 +0200 os r275892 : #i104155# support for empty URLs if called from writerfilter re-introduced 2009-09-04 14:36:14 +0200 cedricbosdo r275803 : CWS-TOOLING: rebase CWS writerfilter32bugfixes01 to trunk@275331 (milestone: DEV300:m56) 2009-05-15 17:36:28 +0200 cedricbosdo r271958 : Added file to test docx numbering import fixes 2009-05-15 17:28:27 +0200 cedricbosdo r271955 : * Implemented a VML import basis. * Fixed some docx numbering import bugs * Implemented docx outline style import 2009-03-16 11:42:06 +0100 hbrinkm r269515 : moved clog inside #ifdef 2009-03-13 18:30:14 +0100 cedricbosdo r269493 : Fixed a dummy paragraph ending problem 2009-03-13 13:57:58 +0100 cedricbosdo r269477 : Added the missing headers 2009-03-13 12:03:25 +0100 cedricbosdo r269466 : Fixed i#93786 and i#100176 2009-03-12 11:39:10 +0100 cedricbosdo r269377 : Fixed a crash in the redlines patch 2009-03-12 10:11:48 +0100 cedricbosdo r269362 : Fixes for the docx import 2009-03-12 10:10:37 +0100 cedricbosdo r269361 : docx import fixes for: + tables styles + pictures positionning + redlines Started to implement the docx settings.xml import
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/docredln.cxx8
-rw-r--r--sw/source/core/docnode/ndtbl.cxx4
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx4
-rw-r--r--sw/source/core/unocore/unodraw.cxx5
-rw-r--r--sw/source/core/unocore/unoobj2.cxx6
-rw-r--r--sw/source/core/unocore/unotext.cxx54
6 files changed, 64 insertions, 17 deletions
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index daeda48ccae3..6efd59452161 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -312,6 +312,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
#ifndef PRODUCT
SwRedline aCopy( *pNewRedl );
#endif
+ bool bError = true;
_CHECK_REDLINE( this )
if( IsRedlineOn() && !IsShowOriginal( eRedlineMode ) &&
@@ -431,6 +432,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
pRedlineTbl->Insert( pRedl );
}
+ bError = false;
bDelete = true;
}
else if( (( POS_BEFORE == eCmpPos &&
@@ -446,6 +448,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
pRedlineTbl->Remove( n );
pRedlineTbl->Insert( pRedl );
+ bError = false;
bDelete = true;
}
else if ( POS_OUTSIDE == eCmpPos )
@@ -1108,7 +1111,8 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
case POS_EQUAL:
case POS_INSIDE:
- delete pNewRedl, pNewRedl = 0;
+ // TODO Check if there is any side effect
+ //delete pNewRedl, pNewRedl = 0;
break;
case POS_OUTSIDE:
@@ -1271,7 +1275,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
}
_CHECK_REDLINE( this )
- return 0 != pNewRedl;
+ return ( 0 != pNewRedl ) || !bError;
}
void SwDoc::CompressRedlines()
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index a7e7675966c3..6407e505aa0c 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1322,7 +1322,8 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >
SwTxtNode& rTxtNode = static_cast<SwTxtNode&>(rNode);
// setze den bei allen TextNode in der Tabelle den TableNode
// als StartNode
- rTxtNode.pStartOfSection = pTblNd;
+// FIXME: this is setting wrong node StartOfSections in nested tables.
+// rTxtNode.pStartOfSection = pTblNd;
// remove PageBreaks/PageDesc/ColBreak
const SwAttrSet* pSet = rTxtNode.GetpSwAttrSet();
if( pSet )
@@ -1401,7 +1402,6 @@ SwTableNode* SwNodes::TextToTable( const std::vector< std::vector<SwNodeRange> >
aCellNodeIdx = SwNodeIndex( *aCellNodeIdx.GetNode().EndOfSectionNode() );
}
-
// Section der Box zuweisen
pBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
pLine->GetTabBoxes().C40_INSERT( SwTableBox, pBox, nBoxes++ );
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index 8c84dce7948a..194200bfad0c 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1032,9 +1032,11 @@ void makeRedline( SwPaM& rPaM,
}
SwRedline* pRedline = new SwRedline( aRedlineData, rPaM );
+ RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( );
+
pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
bool bRet = pRedlineAccess->AppendRedline( pRedline, false );
- pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_NONE);
+ pRedlineAccess->SetRedlineMode_intern( nPrevMode );
if( !bRet )
throw lang::IllegalArgumentException();
}
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 11b3eae5a16a..f8256a7ada0b 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -2117,6 +2117,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
OTextCursorHelper* pCursor = 0;
SwXTextPortion* pPortion = 0;
SwXText* pText = 0;
+ SwXParagraph* pParagraph = 0;
pRange = reinterpret_cast< SwXTextRange * >(
sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextRange::getUnoTunnelId()) ));
@@ -2126,6 +2127,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
pPortion = reinterpret_cast< SwXTextPortion * >(
sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXTextPortion::getUnoTunnelId()) ));
+ pParagraph = reinterpret_cast< SwXParagraph * >(
+ sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( SwXParagraph::getUnoTunnelId( ) ) ) );
if (pRange)
pDoc = pRange->GetDoc();
@@ -2137,6 +2140,8 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
{
pDoc = pPortion->GetCursor()->GetDoc();
}
+ else if ( !pDoc && pParagraph && pParagraph->GetTxtNode( ) )
+ pDoc = pParagraph->GetTxtNode( )->GetDoc( );
}
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index b7764778d31c..0d606ab2f50d 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1192,6 +1192,12 @@ SwXTextRange::SwXTextRange(SwFrmFmt& rTblFmt) :
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)),
pMark(NULL)
{
+ SwTable* pTable = SwTable::FindTable( &rTblFmt );
+ SwTableNode* pTblNode = pTable->GetTableNode( );
+ SwPosition aPosition( *pTblNode );
+ SwPaM aPam( aPosition );
+
+ _CreateNewBookmark( aPam );
}
SwXTextRange::~SwXTextRange()
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 56e3cbacd822..7ae4b209f49f 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -66,6 +66,8 @@
#include <memory>
#include <stdlib.h>
+#include <iostream>
+
using namespace ::com::sun::star;
using ::rtl::OUString;
@@ -1827,19 +1829,11 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
*/
if(aStartCellPam.Start()->nNode < aEndCellPam.End()->nNode)
{
- const SwNode& rStartNode = aStartCellPam.Start()->nNode.GetNode();
- if(!rStartNode.IsTxtNode() ||
- !aEndCellPam.End()->nNode.GetNode().IsTxtNode())
- {
- //start and end of the cell must be on a SwTxtNode
- bExcept = true;
- break;
- }
// increment on each StartNode and decrement on each EndNode
// we must reach zero at the end and must not go below zero
long nOpenNodeBlock = 0;
SwNodeIndex aCellIndex = aStartCellPam.Start()->nNode;
- while( ++aCellIndex < aEndCellPam.End()->nNode.GetIndex())
+ while( aCellIndex < aEndCellPam.End()->nNode.GetIndex())
{
if( aCellIndex.GetNode().IsStartNode() )
++nOpenNodeBlock;
@@ -1850,6 +1844,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
bExcept = true;
break;
}
+ ++aCellIndex;
}
if( nOpenNodeBlock != 0)
{
@@ -1895,7 +1890,9 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
//node border anyway
}
else
+ {
bExcept = true;
+ }
}
//now check if there's a need to insert another paragraph break
if( aEndCellPam.End()->nContent.GetIndex() < aEndCellPam.End()->nNode.GetNode().GetTxtNode()->Len())
@@ -1952,7 +1949,22 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
const beans::PropertyValue* pTableProperties = rTableProperties.getConstArray();
sal_Int32 nProperty = 0;
for( ; nProperty < rTableProperties.getLength(); ++nProperty)
- xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value );
+ {
+ try
+ {
+ xPrSet->setPropertyValue( pTableProperties[nProperty].Name, pTableProperties[nProperty].Value );
+ }
+ catch ( const uno::Exception e )
+ {
+#if DEBUG
+ std::clog << "Exception when setting property: ";
+ std::clog << rtl::OUStringToOString( pTableProperties[nProperty].Name, RTL_TEXTENCODING_UTF8 ).getStr( );
+ std::clog << ". Message: ";
+ std::clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( );
+ std::clog << std::endl;
+#endif
+ }
+ }
//apply row properties
uno::Reference< table::XTableRows > xRows = xRet->getRows();
@@ -2009,6 +2021,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
//--<
#endif
+
//apply cell properties
for( nRow = 0; nRow < rCellProperties.getLength(); ++nRow)
{
@@ -2021,7 +2034,8 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
uno::Reference< beans::XPropertySet > xCell( pTextTable->getCellByPosition(nCell, nRow), uno::UNO_QUERY );
for( nProperty = 0; nProperty < nCellProperties; ++nProperty)
{
- if(aCellProperties[nProperty].Name.equalsAsciiL(
+ const OUString& rName = aCellProperties[nProperty].Name;
+ if( rName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM ( "VerticalMerge")))
{
//determine left border position
@@ -2085,7 +2099,23 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
}
}
else
- xCell->setPropertyValue(aCellProperties[nProperty].Name, aCellProperties[nProperty].Value);
+ {
+ try
+ {
+ xCell->setPropertyValue(rName, aCellProperties[nProperty].Value);
+ }
+ catch ( const uno::Exception e )
+ {
+ // Apply the paragraph and char properties to the cell's content
+ uno::Reference< text::XText > xCellText( xCell, uno::UNO_QUERY );
+ uno::Reference< text::XTextCursor > xCellCurs = xCellText->createTextCursor( );
+ xCellCurs->gotoStart( false );
+ xCellCurs->gotoEnd( true );
+
+ uno::Reference< beans::XPropertySet > xCellTextProps( xCellCurs, uno::UNO_QUERY );
+ xCellTextProps->setPropertyValue( rName, aCellProperties[nProperty].Value );
+ }
+ }
}
}
}