diff options
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r-- | sw/source/core/unocore/unocrsrhelper.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unoport.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 1 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 54 |
6 files changed, 56 insertions, 18 deletions
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/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 04d073a09df3..7071eb59731d 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -719,10 +719,6 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion: aResult.Result = beans::TolerantPropertySetResultType::SUCCESS; aResultVector.push_back( aResult ); } - // this assertion should never occur! - DBG_ASSERT( !aResultVector.size() || aResult.Result != beans::TolerantPropertySetResultType::UNKNOWN_FAILURE, - "unknown failure while retrieving property" ); - } } catch (beans::UnknownPropertyException &) diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index b49816d9c9e3..a8426cf8b438 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -831,7 +831,6 @@ lcl_ExportHints( case RES_TXTATR_AUTOFMT: case RES_TXTATR_INETFMT: case RES_TXTATR_CHARFMT: - case RES_TXTATR_UNKNOWN_CONTAINER: break; // these are handled as properties of a "Text" portion default: DBG_ERROR("unknown attribute"); 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 ); + } + } } } } |