Kaydet (Commit) c8cf6766 authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

use helpers some more

Change-Id: Ia448046b41d6d7594b1ff6f630dbbd4217e13732
üst b878c2b8
...@@ -2108,9 +2108,7 @@ uno::Reference< table::XTableColumns > SwXTextTable::getColumns(void) throw( un ...@@ -2108,9 +2108,7 @@ uno::Reference< table::XTableColumns > SwXTextTable::getColumns(void) throw( un
uno::Reference<table::XCell> SwXTextTable::getCellByName(const OUString& sCellName) throw( uno::RuntimeException, std::exception ) uno::Reference<table::XCell> SwXTextTable::getCellByName(const OUString& sCellName) throw( uno::RuntimeException, std::exception )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
SwFrmFmt* pFmt(GetFrmFmt()); SwFrmFmt* pFmt = lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
if(!pFmt)
throw uno::RuntimeException();
SwTable* pTable = SwTable::FindTable(pFmt); SwTable* pTable = SwTable::FindTable(pFmt);
SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTblBox(sCellName)); SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTblBox(sCellName));
if(!pBox) if(!pBox)
...@@ -2136,9 +2134,7 @@ uno::Reference<text::XTextTableCursor> SwXTextTable::createCursorByCellName(cons ...@@ -2136,9 +2134,7 @@ uno::Reference<text::XTextTableCursor> SwXTextTable::createCursorByCellName(cons
throw (uno::RuntimeException, std::exception) throw (uno::RuntimeException, std::exception)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
SwFrmFmt* pFmt(GetFrmFmt()); SwFrmFmt* pFmt = lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
if(!pFmt)
throw uno::RuntimeException();
uno::Reference<text::XTextTableCursor> xRet; uno::Reference<text::XTextTableCursor> xRet;
SwTable* pTable = SwTable::FindTable(pFmt); SwTable* pTable = SwTable::FindTable(pFmt);
SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTblBox(sCellName)); SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTblBox(sCellName));
...@@ -2230,18 +2226,14 @@ uno::Reference<text::XTextRange> SwXTextTable::getAnchor(void) ...@@ -2230,18 +2226,14 @@ uno::Reference<text::XTextRange> SwXTextTable::getAnchor(void)
throw( uno::RuntimeException, std::exception ) throw( uno::RuntimeException, std::exception )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
SwFrmFmt* pFmt(GetFrmFmt()); SwFrmFmt* pFmt = lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
if(!pFmt)
throw uno::RuntimeException();
return new SwXTextRange(*pFmt); return new SwXTextRange(*pFmt);
} }
void SwXTextTable::dispose(void) throw( uno::RuntimeException, std::exception ) void SwXTextTable::dispose(void) throw( uno::RuntimeException, std::exception )
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
SwFrmFmt* pFmt = GetFrmFmt(); SwFrmFmt* pFmt = lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
if(!pFmt)
throw uno::RuntimeException();
SwTable* pTable = SwTable::FindTable(pFmt); SwTable* pTable = SwTable::FindTable(pFmt);
SwSelBoxes aSelBoxes; SwSelBoxes aSelBoxes;
for(auto& rBox : pTable->GetTabSortBoxes() ) for(auto& rBox : pTable->GetTabSortBoxes() )
...@@ -2345,31 +2337,24 @@ uno::Reference<table::XCellRange> SwXTextTable::getCellRangeByName(const OUStrin ...@@ -2345,31 +2337,24 @@ uno::Reference<table::XCellRange> SwXTextTable::getCellRangeByName(const OUStrin
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
uno::Reference< table::XCellRange > aRef; uno::Reference< table::XCellRange > aRef;
SwFrmFmt* pFmt(GetFrmFmt()); SwFrmFmt* pFmt = lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
if(pFmt) SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFmt), static_cast<cppu::OWeakObject*>(this));
{ sal_Int32 nPos = 0;
SwTable* pTable = SwTable::FindTable( pFmt ); const OUString sTLName(sRange.getToken(0, ':', nPos));
if(!pTable->IsTblComplex()) const OUString sBRName(sRange.getToken(0, ':', nPos));
{ if(sTLName.isEmpty() || sBRName.isEmpty())
sal_Int32 nPos = 0; throw uno::RuntimeException();
const OUString sTLName(sRange.getToken(0, ':', nPos)); SwRangeDescriptor aDesc;
const OUString sBRName(sRange.getToken(0, ':', nPos)); aDesc.nTop = aDesc.nLeft = aDesc.nBottom = aDesc.nRight = -1;
if(sTLName.isEmpty() || sBRName.isEmpty()) sw_GetCellPosition(sTLName, aDesc.nLeft, aDesc.nTop );
throw uno::RuntimeException(); sw_GetCellPosition(sBRName, aDesc.nRight, aDesc.nBottom );
SwRangeDescriptor aDesc;
aDesc.nTop = aDesc.nLeft = aDesc.nBottom = aDesc.nRight = -1; // we should normalize the range now (e.g. A5:C1 will become A1:C5)
sw_GetCellPosition(sTLName, aDesc.nLeft, aDesc.nTop ); // since (depending on what is done later) it will be troublesome
sw_GetCellPosition(sBRName, aDesc.nRight, aDesc.nBottom ); // elsewhere when the cursor in the implementation does not
// point to the top-left and bottom-right cells
// we should normalize the range now (e.g. A5:C1 will become A1:C5) aDesc.Normalize();
// since (depending on what is done later) it will be troublesome return GetRangeByName(pFmt, pTable, sTLName, sBRName, aDesc);
// elsewhere when the cursor in the implementation does not
// point to the top-left and bottom-right cells
aDesc.Normalize();
return GetRangeByName(pFmt, pTable, sTLName, sBRName, aDesc);
}
}
throw uno::RuntimeException();
} }
uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXTextTable::getDataArray() uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXTextTable::getDataArray()
...@@ -2573,32 +2558,24 @@ void SwXTextTable::autoFormat(const OUString& sAutoFmtName) ...@@ -2573,32 +2558,24 @@ void SwXTextTable::autoFormat(const OUString& sAutoFmtName)
std::exception) std::exception)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
SwFrmFmt* pFmt = GetFrmFmt(); SwFrmFmt* pFmt = lcl_EnsureCoreConnected(GetFrmFmt(), static_cast<cppu::OWeakObject*>(this));
if(pFmt) SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFmt), static_cast<cppu::OWeakObject*>(this));
{ SwTableAutoFmtTbl aAutoFmtTbl;
SwTable* pTable = SwTable::FindTable( pFmt ); aAutoFmtTbl.Load();
if(!pTable->IsTblComplex()) for (size_t i = aAutoFmtTbl.size(); i;)
if( sAutoFmtName == aAutoFmtTbl[ --i ].GetName() )
{ {
SwTableAutoFmtTbl aAutoFmtTbl; SwSelBoxes aBoxes;
aAutoFmtTbl.Load(); const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
for (size_t i = aAutoFmtTbl.size(); i;) for (size_t n = 0; n < rTBoxes.size(); ++n)
if( sAutoFmtName == aAutoFmtTbl[ --i ].GetName() ) {
{ SwTableBox* pBox = rTBoxes[ n ];
SwSelBoxes aBoxes; aBoxes.insert( pBox );
const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes(); }
for (size_t n = 0; n < rTBoxes.size(); ++n) UnoActionContext aContext( pFmt->GetDoc() );
{ pFmt->GetDoc()->SetTableAutoFmt( aBoxes, aAutoFmtTbl[i] );
SwTableBox* pBox = rTBoxes[ n ]; break;
aBoxes.insert( pBox );
}
UnoActionContext aContext( pFmt->GetDoc() );
pFmt->GetDoc()->SetTableAutoFmt( aBoxes, aAutoFmtTbl[i] );
break;
}
} }
}
else
throw uno::RuntimeException();
} }
uno::Reference< beans::XPropertySetInfo > SwXTextTable::getPropertySetInfo(void) throw( uno::RuntimeException, std::exception ) uno::Reference< beans::XPropertySetInfo > SwXTextTable::getPropertySetInfo(void) throw( uno::RuntimeException, std::exception )
...@@ -3622,24 +3599,16 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) ...@@ -3622,24 +3599,16 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName)
} }
void SwXCellRange::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) void SwXCellRange::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
{ { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
OSL_FAIL("not implemented");
}
void SwXCellRange::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) void SwXCellRange::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
{ { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
OSL_FAIL("not implemented");
}
void SwXCellRange::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) void SwXCellRange::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
{ { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
OSL_FAIL("not implemented");
}
void SwXCellRange::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception ) void SwXCellRange::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception )
{ { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
OSL_FAIL("not implemented");
}
void SwXCellRange::GetDataSequence( void SwXCellRange::GetDataSequence(
uno::Sequence< uno::Any > *pAnySeq, //-> first pointer != 0 is used uno::Sequence< uno::Any > *pAnySeq, //-> first pointer != 0 is used
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment