[Libreoffice-commits] core.git: 7 commits - sw/source
Philipp Riemer
ruderphilipp at gmail.com
Thu Sep 26 02:25:29 PDT 2013
sw/source/core/docnode/nodes.cxx | 871 ++++++++++++++++----------------------
sw/source/core/layout/trvlfrm.cxx | 19
sw/source/core/text/porfly.cxx | 90 +--
sw/source/core/unocore/unotbl.cxx | 364 ++++++++-------
4 files changed, 583 insertions(+), 761 deletions(-)
New commits:
commit 69c4a8bae5caadc4ff53660dd3f2b938f6dc1734
Author: Philipp Riemer <ruderphilipp at gmail.com>
Date: Thu Sep 26 11:23:53 2013 +0200
cleanup method declarations
Change-Id: I751f94994cf51c01c56a10702c1d0d5f21ba6b45
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index fa882d0..d0d036a 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -104,9 +104,8 @@ extern void sw_GetTblBoxColStr( sal_uInt16 nCol, String& rNm );
#define UNO_TABLE_COLUMN_SUM 10000
-static void
-lcl_SendChartEvent(::cppu::OWeakObject & rSource,
- ::cppu::OInterfaceContainerHelper & rListeners)
+static void lcl_SendChartEvent(::cppu::OWeakObject & rSource,
+ ::cppu::OInterfaceContainerHelper & rListeners)
{
//TODO: find appropriate settings of the Event
chart::ChartDataChangeEvent event;
@@ -120,9 +119,8 @@ lcl_SendChartEvent(::cppu::OWeakObject & rSource,
& chart::XChartDataChangeEventListener::chartDataChanged, event);
}
-static void
-lcl_SendChartEvent(::cppu::OWeakObject & rSource,
- ::cppu::OMultiTypeInterfaceContainerHelper & rListeners)
+static void lcl_SendChartEvent(::cppu::OWeakObject & rSource,
+ ::cppu::OMultiTypeInterfaceContainerHelper & rListeners)
{
::cppu::OInterfaceContainerHelper *const pContainer(rListeners.getContainer(
chart::XChartDataChangeEventListener::static_type()));
@@ -145,7 +143,9 @@ static bool lcl_LineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSv
return bRet;
}
-static void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEntry* pEntry, const uno::Any& aValue)
+static void lcl_SetSpecialProperty(SwFrmFmt* pFmt,
+ const SfxItemPropertySimpleEntry* pEntry,
+ const uno::Any& aValue)
throw (lang::IllegalArgumentException)
{
// special treatment for "non-items"
@@ -347,8 +347,8 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
* @param [IN,OUT] rRow (0-based)
*/
//TODO: potential for throwing proper exceptions instead of having every caller to check for errors
-void sw_GetCellPosition( const String &rCellName,
- sal_Int32 &rColumn, sal_Int32 &rRow)
+void sw_GetCellPosition(const String &rCellName,
+ sal_Int32 &rColumn, sal_Int32 &rRow)
{
rColumn = rRow = -1; // default return values indicating failure
xub_StrLen nLen = rCellName.Len();
@@ -1959,7 +1959,7 @@ sal_Bool SwTableProperties_Impl::GetProperty(sal_uInt16 nWhichId, sal_uInt16 nMe
return aAnyMap.FillValue( nWhichId, nMemberId, rpAny );
}
-void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc)
+void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc)
{
SfxItemSet aSet(rDoc.GetAttrPool(),
RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
@@ -2228,7 +2228,7 @@ uno::Reference< table::XTableColumns > SwXTextTable::getColumns(void) throw( un
return xRet;
}
-uno::Reference< table::XCell > SwXTextTable::getCellByName(const OUString& CellName) throw( uno::RuntimeException )
+uno::Reference< table::XCell > SwXTextTable::getCellByName(const OUString& CellName) throw( uno::RuntimeException )
{
SolarMutexGuard aGuard;
uno::Reference< table::XCell > xRet;
@@ -2271,7 +2271,7 @@ uno::Sequence< OUString > SwXTextTable::getCellNames(void) throw( uno::RuntimeEx
return uno::Sequence< OUString >();
}
-uno::Reference< text::XTextTableCursor > SwXTextTable::createCursorByCellName(const OUString& CellName)
+uno::Reference< text::XTextTableCursor > SwXTextTable::createCursorByCellName(const OUString& CellName)
throw( uno::RuntimeException )
{
SolarMutexGuard aGuard;
commit abb9edd8630ff64729b42acb572bad78ec16cb8e
Author: Philipp Riemer <ruderphilipp at gmail.com>
Date: Thu Sep 26 11:22:00 2013 +0200
whitespace work
Change-Id: I3581dc5e9e3b756ac8fcdf6cdb2dec896b75e467
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 30cc462..995c232 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -341,10 +341,10 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
if( rNds.GetDoc() != GetDoc() )
rNds.GetDoc()->SetFieldsDirty( true, NULL, 0 );
-
if( bNewFrms )
bNewFrms = &GetDoc()->GetNodes() == (const SwNodes*)&rNds &&
GetDoc()->GetCurrentViewShell(); //swmod 071108//swmod 071225
+
if( bNewFrms )
{
// Frames besorgen:
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 3e5141c..9b9205e 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -114,7 +114,6 @@ namespace {
}
}
-
//For SwFlyFrm::GetCrsrOfst
class SwCrsrOszControl
{
@@ -136,11 +135,13 @@ public:
}
return bRet;
}
+
void Entry( const SwFlyFrm *pFly )
{
if ( !pEntry )
pEntry = pStk1 = pFly;
}
+
void Exit( const SwFlyFrm *pFly )
{
if ( pFly == pEntry )
@@ -1644,7 +1645,6 @@ sal_Bool SwRootFrm::IsDummyPage( sal_uInt16 nPageNum ) const
return pPage ? pPage->IsEmptyPage() : sal_True;
}
-
/** Is the Frm or rather the Section in which it lies protected?
*
* Also Fly in Fly in ... and Footnotes
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 5fc39c4..cf824b4 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -234,7 +234,6 @@ void SwFlyCntPortion::Paint( const SwTxtPaintInfo &rInf ) const
if( !GetFlyFrm()->IsCompletePaint() )
aRect._Intersection( aRepaintRect );
-
// GetFlyFrm() may change the layout mode at the output device.
{
SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() );
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 8acdf61..fa882d0 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -17,8 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-
// STL includes
#include <list>
#include <vector>
@@ -174,6 +172,7 @@ static void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEn
}
}
break;
+
case FN_TABLE_IS_RELATIVE_WIDTH:
case FN_TABLE_WIDTH:
case FN_TABLE_RELATIVE_WIDTH:
@@ -208,6 +207,7 @@ static void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEn
pFmt->GetDoc()->SetAttr(aSz, *pFmt);
}
break;
+
case RES_PAGEDESC:
{
OUString sPageStyle;
@@ -222,6 +222,7 @@ static void lcl_SetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimpleEn
pFmt->GetDoc()->SetAttr(aDesc, *pFmt);
}
break;
+
default:
throw lang::IllegalArgumentException();
}
@@ -246,6 +247,7 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
aRet <<= (sal_Int32)nRepeat;
}
break;
+
case FN_TABLE_WIDTH:
case FN_TABLE_IS_RELATIVE_WIDTH:
case FN_TABLE_RELATIVE_WIDTH:
@@ -262,6 +264,7 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
}
}
break;
+
case RES_PAGEDESC:
{
const SfxItemSet& rSet = pFmt->GetAttrSet();
@@ -278,9 +281,11 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
aRet <<= OUString(sPDesc);
}
break;
+
case RES_ANCHOR :
aRet <<= text::TextContentAnchorType_AT_PARAGRAPH;
break;
+
case FN_UNO_ANCHOR_TYPES :
{
uno::Sequence<text::TextContentAnchorType> aTypes(1);
@@ -289,14 +294,17 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
aRet <<= aTypes;
}
break;
+
case FN_UNO_WRAP :
{
aRet <<= text::WrapTextMode_NONE;
}
break;
+
case FN_PARAM_LINK_DISPLAY_NAME :
aRet <<= pFmt->GetName();
break;
+
case FN_UNO_REDLINE_NODE_START:
case FN_UNO_REDLINE_NODE_END:
{
@@ -545,7 +553,6 @@ void sw_NormalizeRange(String &rCell1, String &rCell2)
rCell1 = sw_GetCellName( std::min(nCol1, nCol2), std::min(nRow1, nRow2) );
rCell2 = sw_GetCellName( std::max(nCol1, nCol2), std::max(nRow1, nRow2) );
}
-
}
void SwRangeDescriptor::Normalize()
@@ -1209,7 +1216,6 @@ uno::Reference< container::XEnumeration > SwXCell::createEnumeration(void) thro
uno::Type SAL_CALL SwXCell::getElementType(void) throw( uno::RuntimeException )
{
return ::getCppuType((const uno::Reference<text::XTextRange>*)0);
-
}
sal_Bool SwXCell::hasElements(void) throw( uno::RuntimeException )
@@ -1323,12 +1329,10 @@ SwXTextTableRow::SwXTextTableRow(SwFrmFmt* pFmt, SwTableLine* pLn) :
m_pPropSet(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_TABLE_ROW)),
pLine(pLn)
{
-
}
SwXTextTableRow::~SwXTextTableRow()
{
-
}
uno::Reference< beans::XPropertySetInfo > SwXTextTableRow::getPropertySetInfo(void) throw( uno::RuntimeException )
@@ -1379,6 +1383,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName,
pDoc->SetAttr(aFrmSize, *pLn->ClaimFrmFmt());
}
break;
+
case FN_UNO_TABLE_COLUMN_SEPARATORS:
{
UnoActionContext aContext(pDoc);
@@ -1386,6 +1391,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName,
lcl_SetTblSeparators(aValue, pTable2, pLine->GetTabBoxes()[0], sal_True, pDoc);
}
break;
+
default:
{
SwFrmFmt* pLnFmt = pLn->ClaimFrmFmt();
@@ -1429,11 +1435,13 @@ uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName) throw(
aRet <<= (sal_Int32)(TWIP_TO_MM100(rSize.GetSize().Height()));
}
break;
+
case FN_UNO_TABLE_COLUMN_SEPARATORS:
{
lcl_GetTblSeparators(aRet, pTable, pLine->GetTabBoxes()[0], sal_True);
}
break;
+
default:
{
const SwAttrSet& rSet = pLn->GetFrmFmt()->GetAttrSet();
@@ -1933,7 +1941,6 @@ public:
void ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc);
};
-
SwTableProperties_Impl::SwTableProperties_Impl()
{
}
@@ -2436,7 +2443,6 @@ uno::Reference< table::XCell > SwXTextTable::getCellByPosition(sal_Int32 nColum
if(!aRef.is())
throw lang::IndexOutOfBoundsException();
return aRef;
-
}
uno::Reference< table::XCellRange > SwXTextTable::GetRangeByName(SwFrmFmt* pFmt, SwTable* pTable,
@@ -2722,6 +2728,7 @@ void SwXTextTable::setData(const uno::Sequence< uno::Sequence< double > >& rData
aRuntime.Message = "Table too complex";
throw aRuntime;
}
+
SwFrmFmt* pFmt = GetFrmFmt();
if(pFmt )
{
@@ -2769,6 +2776,7 @@ uno::Sequence< OUString > SwXTextTable::getRowDescriptions(void) throw( uno::Run
throw aRuntime;
}
uno::Sequence< OUString > aRet(bFirstColumnAsLabel ? nRowCount - 1 : nRowCount);
+
SwFrmFmt* pFmt = GetFrmFmt();
if(pFmt)
{
@@ -3045,6 +3053,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
setName( sName );
}
break;
+
case FN_UNO_RANGE_ROW_LABEL:
{
sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
@@ -3055,6 +3064,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
}
}
break;
+
case FN_UNO_RANGE_COL_LABEL:
{
sal_Bool bTmp = *(sal_Bool*)aValue.getValue();
@@ -3065,6 +3075,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
}
}
break;
+
case FN_UNO_TABLE_BORDER:
case FN_UNO_TABLE_BORDER2:
{
@@ -3139,8 +3150,6 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
pUnoCrsr->Move( fnMoveForward, fnGoNode );
pUnoCrsr->SetRemainInSection( sal_False );
-
-
const SwTableBox* pBRBox = lcl_FindCornerTableBox(rLines, false);
pUnoCrsr->SetMark();
pUnoCrsr->GetPoint()->nNode = *pBRBox->GetSttNd();
@@ -3184,6 +3193,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
delete pUnoCrsr;
}
break;
+
case FN_UNO_TABLE_BORDER_DISTANCES:
{
table::TableBorderDistances aTableBorderDistances;
@@ -3234,6 +3244,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL);
}
break;
+
case FN_UNO_TABLE_COLUMN_SEPARATORS:
{
UnoActionContext aContext(pFmt->GetDoc());
@@ -3241,7 +3252,9 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
lcl_SetTblSeparators(aValue, pTable, pTable->GetTabLines()[0]->GetTabBoxes()[0], sal_False, pFmt->GetDoc());
}
break;
+
case FN_UNO_TABLE_COLUMN_RELATIVE_SUM:/*_readonly_*/ break;
+
default:
{
SwAttrSet aSet(pFmt->GetAttrSet());
@@ -3284,24 +3297,28 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be
aRet <<= getName();
}
break;
+
case FN_UNO_ANCHOR_TYPES:
case FN_UNO_TEXT_WRAP:
case FN_UNO_ANCHOR_TYPE:
::sw::GetDefaultTextContentValue(
aRet, OUString(), pEntry->nWID);
break;
+
case FN_UNO_RANGE_ROW_LABEL:
{
sal_Bool bTemp = bFirstRowAsLabel;
aRet.setValue(&bTemp, ::getCppuBooleanType());
}
break;
+
case FN_UNO_RANGE_COL_LABEL:
{
sal_Bool bTemp = bFirstColumnAsLabel;
aRet.setValue(&bTemp, ::getCppuBooleanType());
}
break;
+
case FN_UNO_TABLE_BORDER:
case FN_UNO_TABLE_BORDER2:
{
@@ -3386,6 +3403,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be
delete pUnoCrsr;
}
break;
+
case FN_UNO_TABLE_BORDER_DISTANCES :
{
table::TableBorderDistances aTableBorderDistances( 0, sal_True, 0, sal_True, 0, sal_True, 0, sal_True ) ;
@@ -3449,18 +3467,22 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be
aRet <<= aTableBorderDistances;
}
break;
+
case FN_UNO_TABLE_COLUMN_SEPARATORS:
{
SwTable* pTable = SwTable::FindTable( pFmt );
lcl_GetTblSeparators(aRet, pTable, pTable->GetTabLines()[0]->GetTabBoxes()[0], sal_False);
}
break;
+
case FN_UNO_TABLE_COLUMN_RELATIVE_SUM:
aRet <<= (sal_Int16) UNO_TABLE_COLUMN_SUM;
break;
+
case RES_ANCHOR:
// AnchorType is readonly and might be void (no return value)
break;
+
case FN_UNO_TEXT_SECTION:
{
SwTable* pTable = SwTable::FindTable( pFmt );
@@ -3475,6 +3497,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be
}
}
break;
+
default:
{
const SwAttrSet& rSet = pFmt->GetAttrSet();
@@ -3796,7 +3819,6 @@ uno::Reference< table::XCellRange > SwXCellRange::getCellRangeByPosition(
if(!aRet.is())
throw lang::IndexOutOfBoundsException();
return aRet;
-
}
uno::Reference< table::XCellRange > SwXCellRange::getCellRangeByName(const OUString& rRange)
@@ -4553,7 +4575,6 @@ sal_Bool SwXCellRange::isNotANumber(double /*fNumber*/) throw( uno::RuntimeExcep
{
OSL_FAIL("not implemented");
return sal_False;
-
}
double SwXCellRange::getNotANumber(void) throw( uno::RuntimeException )
commit e324251a1a58b05d30f98cc740f9922f6eeade36
Author: Philipp Riemer <ruderphilipp at gmail.com>
Date: Thu Sep 26 11:20:30 2013 +0200
added code hints
Change-Id: Icce7ee8e10539d43f5686275930041a8b699b1c3
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index ae5c895..30cc462 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1665,6 +1665,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
rNodes.IsDocNodes() ? SWFMTFLD_INSERTED : SWFMTFLD_REMOVED ) );
}
+///@see SwNodes::_MoveNodes (TODO: seems to be C&P programming here)
void SwNodes::_CopyNodes( const SwNodeRange& rRange,
const SwNodeIndex& rIndex, sal_Bool bNewFrms, sal_Bool bTblInsDummyNode ) const
{
@@ -1969,6 +1970,7 @@ SwCntntNode* SwNodes::GoNextSection( SwNodeIndex * pIdx,
return 0;
}
+///@see SwNodes::GoNextSection (TODO: seems to be C&P programming here)
SwCntntNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx,
int bSkipHidden, int bSkipProtect ) const
{
@@ -2168,6 +2170,7 @@ void SwNodes::ForEach( const SwNodeIndex& rStart, const SwNodeIndex& rEnd,
namespace {
+//TODO: seems to be not/wrongly used
struct TempBigPtrEntry : public BigPtrEntry
{
TempBigPtrEntry() {}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 423bbb7..8acdf61 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -338,6 +338,7 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
* @param [IN,OUT] rColumn (0-based)
* @param [IN,OUT] rRow (0-based)
*/
+//TODO: potential for throwing proper exceptions instead of having every caller to check for errors
void sw_GetCellPosition( const String &rCellName,
sal_Int32 &rColumn, sal_Int32 &rRow)
{
@@ -918,6 +919,7 @@ OUString SwXCell::getFormula(void) throw( uno::RuntimeException )
return sRet;
}
+///@see sw_setValue (TODO: seems to be C&P programming here)
void SwXCell::setFormula(const OUString& rFormula) throw( uno::RuntimeException )
{
SolarMutexGuard aGuard;
@@ -4382,6 +4384,7 @@ void SwXCellRange::setData(const uno::Sequence< uno::Sequence< double > >& rData
}
}
+///@see SwXTextTable::getRowDescriptions (TODO: seems to be C&P programming here)
uno::Sequence< OUString > SwXCellRange::getRowDescriptions(void)
throw( uno::RuntimeException )
{
@@ -4422,6 +4425,7 @@ uno::Sequence< OUString > SwXCellRange::getRowDescriptions(void)
return aRet;
}
+///@see SwXTextTable::setRowDescriptions (TODO: seems to be C&P programming here)
void SwXCellRange::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc)
throw( uno::RuntimeException )
{
@@ -4456,6 +4460,7 @@ void SwXCellRange::setRowDescriptions(const uno::Sequence< OUString >& rRowDesc)
}
}
+///@see SwXTextTable::setColumnDescriptions (TODO: seems to be C&P programming here)
uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void)
throw( uno::RuntimeException )
{
@@ -4496,6 +4501,7 @@ uno::Sequence< OUString > SwXCellRange::getColumnDescriptions(void)
return aRet;
}
+///@see SwXTextTable::setColumnDescriptions (TODO: seems to be C&P programming here)
void SwXCellRange::setColumnDescriptions(const uno::Sequence< OUString >& ColumnDesc)
throw( uno::RuntimeException )
{
@@ -4664,6 +4670,7 @@ sal_Int32 SwXTableRows::getCount(void) throw( uno::RuntimeException )
return nRet;
}
+///@see SwXCell::CreateXCell (TODO: seems to be C&P programming here)
uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
{
@@ -4924,6 +4931,7 @@ sal_Bool SwXTableColumns::hasElements(void) throw( uno::RuntimeException )
return sal_True;
}
+///@see SwXTableRows::insertByIndex (TODO: seems to be C&P programming here)
void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
{
SolarMutexGuard aGuard;
@@ -4977,6 +4985,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( u
}
}
+///@see SwXTableRows::removeByIndex (TODO: seems to be C&P programming here)
void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( uno::RuntimeException )
{
SolarMutexGuard aGuard;
commit 582860942b036f814064f91443e9a2397aa77c9d
Author: Philipp Riemer <ruderphilipp at gmail.com>
Date: Thu Sep 26 11:18:11 2013 +0200
remove commented-out code
Change-Id: I1893ee58431ccf7d5d6b375c46333b73b9f92ede
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 2820432..ae5c895 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2050,7 +2050,7 @@ SwNode* SwNodes::FindPrvNxtFrmNode( SwNodeIndex& rFrmIdx,
SwSectionNode* pSectNd = pSttNd->IsSectionNode()
? pSttNd->StartOfSectionNode()->FindSectionNode()
: pSttNd->FindSectionNode();
- if( !( pSectNd && pSectNd->GetSection().CalcHiddenFlag()/*IsHiddenFlag()*/ ) )
+ if( !( pSectNd && pSectNd->GetSection().CalcHiddenFlag() ) )
{
// in a table in table situation we have to assure that we don't leave the
// outer table cell when the inner table is looking for a PrvNxt...
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 8c1b6ea..423bbb7 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1008,11 +1008,6 @@ uno::Reference< text::XTextCursor > SwXCell::createTextCursor(void) throw( uno:
SwUnoCrsr *const pUnoCrsr = pXCursor->GetCursor();
pUnoCrsr->Move(fnMoveForward, fnGoNode);
aRef = static_cast<text::XWordCursor*>(pXCursor);
-// // no Cursor in protected sections
-// SwCrsrSaveState aSave( *pUnoCrsr );
-// if(pUnoCrsr->IsInProtectTable( sal_True ) ||
-// pUnoCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ))
-// throw( uno::RuntimeException() );
}
else
throw uno::RuntimeException();
@@ -1205,11 +1200,6 @@ uno::Reference< container::XEnumeration > SwXCell::createEnumeration(void) thro
pSttNd, pTable);
aRef = pEnum;
-// // no Cursor in protected sections
-// SwCrsrSaveState aSave( *pUnoCrsr );
-// if(pUnoCrsr->IsInProtectTable( sal_True ) ||
-// pUnoCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS ))
-// throw( uno::RuntimeException() );
}
return aRef;
}
@@ -2124,11 +2114,6 @@ void SwTableProperties_Impl::ApplyTblAttr(const SwTable& rTbl, SwDoc& rDoc)
aSet.Put(aSp);
}
- //TODO: folgende Propertiers noch impl.
-// FN_UNO_RANGE_ROW_LABEL
-// FN_UNO_RANGE_COL_LABEL
-// FN_UNO_TABLE_BORDER
-
if(aSet.Count())
{
rDoc.SetAttr( aSet, *rTbl.GetFrmFmt() );
@@ -2597,13 +2582,7 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXTextTable::getDataArray()
// check if table box value item is set
SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
bool bIsNum = pBoxFmt->GetItemState( RES_BOXATR_VALUE, sal_False ) == SFX_ITEM_SET;
- //const SfxPoolItem* pItem;
- //SwDoc* pDoc = pXCell->GetDoc();
- //sal_Bool bIsText = (SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
- // || pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue())
- // || ((SwTblBoxNumFormat*)pItem)->GetValue() == NUMBERFORMAT_TEXT);
-
- if(!bIsNum/*bIsText*/)
+ if(!bIsNum)
pColArray[nCol] <<= lcl_getString(*pXCell);
else
pColArray[nCol] <<= sw_getValue(*pXCell);
@@ -3851,8 +3830,6 @@ void SwXCellRange::setPropertyValue(const OUString& rPropertyName,
SwFrmFmt* pFmt = GetFrmFmt();
if(pFmt)
{
- /* ASK OLIVER
- lcl_FormatTable(pFmt);*/
const SfxItemPropertySimpleEntry* pEntry =
m_pPropSet->getPropertyMap().getByName(rPropertyName);
if(pEntry)
@@ -3968,8 +3945,6 @@ uno::Any SwXCellRange::getPropertyValue(const OUString& rPropertyName) throw( be
SwFrmFmt* pFmt = GetFrmFmt();
if(pFmt)
{
- /* ASK OLIVER
- lcl_FormatTable(pFmt);*/
const SfxItemPropertySimpleEntry* pEntry =
m_pPropSet->getPropertyMap().getByName(rPropertyName);
if(pEntry)
@@ -4130,8 +4105,7 @@ void SwXCellRange::GetDataSequence(
{
// check if table box value item is set
bool bIsNum = pBox->GetFrmFmt()->GetItemState( RES_BOXATR_VALUE, sal_False ) == SFX_ITEM_SET;
- //sal_uLong nNdPos = pBox->IsValidNumTxtNd( sal_True );
- if (!bIsNum/* && ULONG_MAX == nNdPos*/)
+ if (!bIsNum)
pAnyData[nDtaCnt++] <<= lcl_getString(*pXCell);
else
pAnyData[nDtaCnt++] <<= sw_getValue(*pXCell);
@@ -4249,13 +4223,7 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray()
// check if table box value item is set
SwFrmFmt* pBoxFmt = pBox->GetFrmFmt();
bool bIsNum = pBoxFmt->GetItemState( RES_BOXATR_VALUE, sal_False ) == SFX_ITEM_SET;
- //const SfxPoolItem* pItem;
- //SwDoc* pDoc = pXCell->GetDoc();
- //sal_Bool bIsText = (SFX_ITEM_SET != pBoxFmt->GetAttrSet().GetItemState(RES_BOXATR_FORMAT, sal_True, &pItem)
- // || pDoc->GetNumberFormatter()->IsTextFormat(((SwTblBoxNumFormat*)pItem)->GetValue())
- // || ((SwTblBoxNumFormat*)pItem)->GetValue() == NUMBERFORMAT_TEXT);
-
- if(!bIsNum/*bIsText*/)
+ if(!bIsNum)
pColArray[nCol] <<= lcl_getString(*pXCell);
else
pColArray[nCol] <<= sw_getValue(*pXCell);
commit 20259c594043b08204c43428a17286616a6f58cb
Author: Philipp Riemer <ruderphilipp at gmail.com>
Date: Thu Sep 26 11:15:41 2013 +0200
work on existing comments
Change-Id: I35bd6c4eb15316de86f7fd85c81173a0e4ffc136
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 6c39ade..2820432 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -255,7 +255,6 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
// special treatment for fields
if( pHts && pHts->Count() )
{
- // this looks fishy if pDestDoc != 0
bool const bToUndo = !pDestDoc &&
GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds);
for( sal_uInt16 i = pHts->Count(); i; )
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 926dcae..3e5141c 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1042,17 +1042,6 @@ sal_uInt16 SwRootFrm::SetCurrPage( SwCursor* pToSet, sal_uInt16 nPageNum )
return 0;
}
-/*************************************************************************
-|*
-|* SwCntntFrm::StartxxPage(), EndxxPage()
-|*
-|* Description: Cursor at the beginning/end of the current/previous/next
-|* page. All six methods call GetFrmInPage() using the according
-|* parameters. Two parameters define the direction: one defines the
-|* page, the other one the beginning/end.
-|* For the determination of the page and the Cntnt (begin/end) the
-|* following functions are going to be used.
-|*************************************************************************/
SwCntntFrm *GetFirstSub( const SwLayoutFrm *pLayout )
{
return ((SwPageFrm*)pLayout)->FindFirstBodyCntnt();
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index a713057..5fc39c4 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -247,7 +247,6 @@ void SwFlyCntPortion::Paint( const SwTxtPaintInfo &rInf ) const
// Being in const method should not be a problem.
((SwTxtPaintInfo&)rInf).SelectFont();
- // I want to know if this can really happen. So here comes a new
OSL_ENSURE( ! rInf.GetVsh() || rInf.GetVsh()->GetOut() == rInf.GetOut(),
"SwFlyCntPortion::Paint: Outdev has changed" );
if( rInf.GetVsh() )
@@ -305,13 +304,12 @@ SwFlyCntPortion::SwFlyCntPortion( const SwTxtFrm& rFrm,
// after setting the RefPoints, the ascent needs to be recalculated because it is dependent on RelPos.
// OD 29.07.2003 #110978# - use new datatype for parameter <nFlags>
+/// @param rBase CAUTION:needs to be an absolute value
void SwFlyCntPortion::SetBase( const SwTxtFrm& rFrm, const Point &rBase,
long nLnAscent, long nLnDescent,
long nFlyAsc, long nFlyDesc,
objectpositioning::AsCharFlags nFlags )
{
- // Note: rBase have to be an absolute value
-
// OD 28.10.2003 #113049# - use new class to position object
// determine drawing object
SdrObject* pSdrObj = 0L;
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index ee3985f..8c1b6ea 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -325,17 +325,19 @@ static uno::Any lcl_GetSpecialProperty(SwFrmFmt* pFmt, const SfxItemPropertySimp
return aRet;
}
-// returns the position for the cell with the specified name
-// (note that the indices rColumn and rRow are 0 based here)
-// Also since the implementations of tables does not really have
-// columns using this function is appropriate only for tables
-// that are not complex (i.e. where IsTblComplex() returns false).
-//
-// returns: both indices for column and row (all >= 0) if everything was Ok.
-// At least one value < 0 if sth was wrong.
-//
-// Sample for naming scheme of cell in a single row (in groups a 26):
-// A1..Z1, a1..z1, AA1..AZ1, Aa1..Az1, BA1..BZ1, Ba1..Bz1, ...
+/** get position of a cell with a given name
+ *
+ * If everything was OK, the indices for column and row are changed (both >= 0).
+ * In case of errors, at least one of them is < 0.
+ *
+ * Also since the implementations of tables does not really have columns using
+ * this function is appropriate only for tables that are not complex (i.e.
+ * where IsTblComplex() returns false).
+ *
+ * @param rCellName e.g. A1..Z1, a1..z1, AA1..AZ1, Aa1..Az1, BA1..BZ1, Ba1..Bz1, ...
+ * @param [IN,OUT] rColumn (0-based)
+ * @param [IN,OUT] rRow (0-based)
+ */
void sw_GetCellPosition( const String &rCellName,
sal_Int32 &rColumn, sal_Int32 &rRow)
{
@@ -381,14 +383,15 @@ void sw_GetCellPosition( const String &rCellName,
OSL_ENSURE( rColumn != -1 && rRow != -1, "failed to get column or row index" );
}
-// arguments: must be non-empty strings with valid cell names
-//
-// returns: -1 if first cell < second cell
-// 0 if both cells are equal
-// +1 if the first cell > second cell
-//
-// Note: this function probably also make sense only
-// for cell names of non-complex tables
+/** compare position of two cells (check rows first)
+ *
+ * @note this function probably also make sense only
+ * for cell names of non-complex tables
+ *
+ * @param rCellName1 e.g. "A1" (non-empty string with valid cell name)
+ * @param rCellName2 e.g. "A1" (non-empty string with valid cell name)
+ * @return -1 if cell_1 < cell_2; 0 if both cells are equal; +1 if cell_1 > cell_2
+ */
int sw_CompareCellsByRowFirst( const String &rCellName1, const String &rCellName2 )
{
sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
@@ -403,14 +406,15 @@ int sw_CompareCellsByRowFirst( const String &rCellName1, const String &rCellName
return +1;
}
-// arguments: must be non-empty strings with valid cell names
-//
-// returns: -1 if first cell < second cell
-// 0 if both cells are equal
-// +1 if the first cell > second cell
-//
-// Note: this function probably also make sense only
-// for cell names of non-complex tables
+/** compare position of two cells (check columns first)
+ *
+ * @note this function probably also make sense only
+ * for cell names of non-complex tables
+ *
+ * @param rCellName1 e.g. "A1" (non-empty string with valid cell name)
+ * @param rCellName2 e.g. "A1" (non-empty string with valid cell name)
+ * @return -1 if cell_1 < cell_2; 0 if both cells are equal; +1 if cell_1 > cell_2
+ */
int sw_CompareCellsByColFirst( const String &rCellName1, const String &rCellName2 )
{
sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
@@ -425,14 +429,19 @@ int sw_CompareCellsByColFirst( const String &rCellName1, const String &rCellName
return +1;
}
-// arguments: must be non-empty strings with valid cell names
-//
-// returns: -1 if first cell range < second cell range
-// 0 if both cell ranges are identical
-// +1 if the first cell range > second cell range
-//
-// Note: this function probably also make sense only
-// for cell names of non-complex tables
+/** compare position of two cell ranges
+ *
+ * @note this function probably also make sense only
+ * for cell names of non-complex tables
+ *
+ * @param rRange1StartCell e.g. "A1" (non-empty string with valid cell name)
+ * @param rRange1EndCell e.g. "A1" (non-empty string with valid cell name)
+ * @param rRange2StartCell e.g. "A1" (non-empty string with valid cell name)
+ * @param rRange2EndCell e.g. "A1" (non-empty string with valid cell name)
+ * @param bCmpColsFirst if <true> position in columns will be compared first before rows
+ *
+ * @return -1 if cell_range_1 < cell_range_2; 0 if both cell ranges are equal; +1 if cell_range_1 > cell_range_2
+ */
int sw_CompareCellRanges(
const String &rRange1StartCell, const String &rRange1EndCell,
const String &rRange2StartCell, const String &rRange2EndCell,
@@ -453,8 +462,12 @@ int sw_CompareCellRanges(
return +1;
}
-// returns the cell name for the cell at the specified position
-// (note that the indices nColumn and nRow are 0 based here)
+/** get cell name at a specified coordinate
+ *
+ * @param nColumn column index (0-based)
+ * @param nRow row index (0-based)
+ * @return the cell name
+ */
String sw_GetCellName( sal_Int32 nColumn, sal_Int32 nRow )
{
#if OSL_DEBUG_LEVEL > 0
@@ -482,8 +495,7 @@ String sw_GetCellName( sal_Int32 nColumn, sal_Int32 nRow )
/** Find the top left or bottom right corner box in given table.
Consider nested lines when finding the box.
- @param i_pTable the table
-
+ @param rTableLines the table
@param i_bTopLeft if true, find top left box, otherwise find bottom
right box
*/
@@ -513,14 +525,16 @@ const SwTableBox* lcl_FindCornerTableBox(const SwTableLines& rTableLines, const
return pBox;
}
-// start cell should be in the upper-left corner of the range and
-// end cell in the lower-right.
-// I.e. from the four possible representation
-// A1:C5, C5:A1, A5:C1, C1:A5
-// only A1:C5 is the one to use
-void sw_NormalizeRange(
- String &rCell1, // will hold the upper-left cell of the range upon return
- String &rCell2 ) // will hold the lower-right cell of the range upon return
+/** cleanup order in a range
+ *
+ * Sorts the input to a uniform format. I.e. for the four possible representation
+ * A1:C5, C5:A1, A5:C1, C1:A5
+ * the result will be always A1:C5.
+ *
+ * @param [IN,OUT] rCell1 cell name (will be modified to upper-left corner), e.g. "A1" (non-empty string with valid cell name)
+ * @param [IN,OUT] rCell2 cell name (will be modified to lower-right corner), e.g. "A1" (non-empty string with valid cell name)
+ */
+void sw_NormalizeRange(String &rCell1, String &rCell2)
{
sal_Int32 nCol1 = -1, nRow1 = -1, nCol2 = -1, nRow2 = -1;
sw_GetCellPosition( rCell1, nCol1, nRow1 );
@@ -650,7 +664,7 @@ static void lcl_SetTblSeparators(const uno::Any& rVal, SwTable* pTable, SwTableB
pTable->GetTabCols( aOldCols, pBox, sal_False, bRow );
sal_uInt16 nOldCount = aOldCols.Count();
- //there's no use in setting tab cols if there's only one column
+ // there is no use in setting tab cols if there is only one column
if( !nOldCount )
return;
@@ -689,7 +703,7 @@ static inline OUString lcl_getString( SwXCell &rCell )
return rCell.getString();
}
-/* non UNO function call to set string in SwXCell */
+/* non UNO function call to set string in SwXCell */
void sw_setString( SwXCell &rCell, const OUString &rTxt,
sal_Bool bKeepNumberFmt = sal_False )
{
@@ -1015,7 +1029,7 @@ uno::Reference< text::XTextCursor > SwXCell::createTextCursorByRange(const uno:
&& ::sw::XTextRangeToSwPaM(aPam, xTextPosition))
{
const SwStartNode* pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
- //skip sections
+ // skip sections
SwStartNode* p1 = aPam.GetNode()->StartOfSectionNode();
while(p1->IsSectionNode())
p1 = p1->StartOfSectionNode();
@@ -1249,7 +1263,12 @@ SwXCell* SwXCell::CreateXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, SwTable *pTab
return pRet;
}
-/* does box exist in given table? */
+/** search if a box exists in a table
+ *
+ * @param pTable the table to search in
+ * @param pBox2 box model to find
+ * @return the box if existent in pTable, 0 (!!!) if not found
+ */
SwTableBox* SwXCell::FindBox(SwTable* pTable, SwTableBox* pBox2)
{
// check if nFndPos happens to point to the right table box
@@ -2678,7 +2697,7 @@ uno::Sequence< uno::Sequence< double > > SwXTextTable::getData(void)
aRuntime.Message = "Table too complex";
throw aRuntime;
}
- //
+
SwFrmFmt* pFmt = GetFrmFmt();
uno::Sequence< uno::Sequence< double > > aRowSeq(bFirstRowAsLabel ? nRowCount - 1 : nRowCount);
if(pFmt)
@@ -3459,7 +3478,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName) throw( be
aRet <<= (sal_Int16) UNO_TABLE_COLUMN_SUM;
break;
case RES_ANCHOR:
- //AnchorType ist readonly und maybevoid und wird nicht geliefert
+ // AnchorType is readonly and might be void (no return value)
break;
case FN_UNO_TEXT_SECTION:
{
@@ -4187,12 +4206,11 @@ void SwXCellRange::GetDataSequence(
pDblSeq->realloc( nDtaCnt );
}
+///@see SwXCellRange::getData
+///@see SwXCellRange::GetDataSequence
uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray()
throw (uno::RuntimeException)
{
- // see SwXCellRange::getData also
- // also see SwXCellRange::GetDataSequence
-
SolarMutexGuard aGuard;
sal_Int16 nRowCount = getRowCount();
sal_Int16 nColCount = getColumnCount();
@@ -4249,12 +4267,11 @@ uno::Sequence< uno::Sequence< uno::Any > > SAL_CALL SwXCellRange::getDataArray()
return aRowSeq;
}
+///@see SwXCellRange::setData
void SAL_CALL SwXCellRange::setDataArray(
const uno::Sequence< uno::Sequence< uno::Any > >& rArray )
throw (uno::RuntimeException)
{
- // see SwXCellRange::setData also
-
SolarMutexGuard aGuard;
sal_Int16 nRowCount = getRowCount();
sal_Int16 nColCount = getColumnCount();
commit ba665a9957955e8306aa5554d8ce59b56751ea02
Author: Philipp Riemer <ruderphilipp at gmail.com>
Date: Thu Sep 26 11:08:37 2013 +0200
fdo#62475: remove visual noise
Change-Id: I287eeb68ee23931f0592190bad47a86cb4b8efac
diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 1d8b017..a713057 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -47,9 +47,6 @@ void SwFlyPortion::Paint( const SwTxtPaintInfo& ) const
{
}
-/*************************************************************************
- * virtual SwFlyPortion::Format()
- *************************************************************************/
sal_Bool SwFlyPortion::Format( SwTxtFormatInfo &rInf )
{
OSL_ENSURE( Fix() >= rInf.X(), "SwFlyPortion::Format" );
@@ -95,9 +92,6 @@ sal_Bool SwFlyPortion::Format( SwTxtFormatInfo &rInf )
return sal_False;
}
-/*************************************************************************
- * virtual SwFlyCntPortion::Format()
- *************************************************************************/
sal_Bool SwFlyCntPortion::Format( SwTxtFormatInfo &rInf )
{
sal_Bool bFull = rInf.Width() < rInf.X() + PrtWidth();
@@ -184,9 +178,6 @@ void SwTxtFrm::MoveFlyInCnt( SwTxtFrm *pNew, xub_StrLen nStart, xub_StrLen nEnd
}
}
-/*************************************************************************
- * SwTxtFrm::CalcFlyPos()
- *************************************************************************/
xub_StrLen SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch )
{
SwpHints* pHints = GetTxtNode()->GetpSwpHints();
@@ -210,9 +201,6 @@ xub_StrLen SwTxtFrm::CalcFlyPos( SwFrmFmt* pSearch )
return *pFound->GetStart();
}
-/*************************************************************************
- * virtual SwFlyCntPortion::Paint()
- *************************************************************************/
void SwFlyCntPortion::Paint( const SwTxtPaintInfo &rInf ) const
{
if( bDraw )
@@ -395,10 +383,6 @@ void SwFlyCntPortion::SetBase( const SwTxtFrm& rFrm, const Point &rBase,
}
}
-/*************************************************************************
- * virtual SwFlyCntPortion::GetFlyCrsrOfst()
- *************************************************************************/
-
xub_StrLen SwFlyCntPortion::GetFlyCrsrOfst( const KSHORT nOfst,
const Point &rPoint, SwPosition *pPos, SwCrsrMoveState* pCMS ) const
{
@@ -413,10 +397,6 @@ xub_StrLen SwFlyCntPortion::GetFlyCrsrOfst( const KSHORT nOfst,
return 0;
}
-/*************************************************************************
- * virtual SwFlyCntPortion::GetCrsrOfst()
- *************************************************************************/
-
xub_StrLen SwFlyCntPortion::GetCrsrOfst( const KSHORT nOfst ) const
{
// OSL_ENSURE( !this, "SwFlyCntPortion::GetCrsrOfst: use GetFlyCrsrOfst()" );
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 4116db6..ee3985f 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -752,9 +752,6 @@ void sw_setValue( SwXCell &rCell, double nVal )
}
}
-/******************************************************************
- * SwXCell
- ******************************************************************/
TYPEINIT1(SwXCell, SwClient);
SwXCell::SwXCell(SwFrmFmt* pTblFmt, SwTableBox* pBx, size_t const nPos) :
@@ -1291,9 +1288,6 @@ uno::Sequence< OUString > SwXCell::getSupportedServiceNames(void) throw( uno::Ru
return aRet;
}
-/******************************************************************
- * SwXTextTableRow
- ******************************************************************/
OUString SwXTextTableRow::getImplementationName(void) throw( uno::RuntimeException )
{
return OUString("SwXTextTableRow");
@@ -1478,9 +1472,8 @@ SwTableLine* SwXTextTableRow::FindLine(SwTable* pTable, SwTableLine* pLine)
return pRet;
}
-/******************************************************************
- * SwXTextTableCursor
- ******************************************************************/
+// SwXTextTableCursor
+
OUString SwXTextTableCursor::getImplementationName(void) throw( uno::RuntimeException )
{
return OUString("SwXTextTableCursor");
@@ -1901,9 +1894,7 @@ void SwXTextTableCursor::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNe
ClientModify(this, pOld, pNew);
}
-/******************************************************************
- * SwXTextTable
- ******************************************************************/
+// SwXTextTable
class SwXTextTable::Impl
{
@@ -1916,6 +1907,8 @@ public:
Impl() : m_Listeners(m_Mutex) { }
};
+// SwTableProperties_Impl
+
class SwTableProperties_Impl
{
SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
@@ -4641,9 +4634,8 @@ void SwXCellRange::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
}
}
-/******************************************************************
- * SwXTableRows
- ******************************************************************/
+// SwXTableRows
+
OUString SwXTableRows::getImplementationName(void) throw( uno::RuntimeException )
{
return OUString("SwXTableRows");
@@ -4857,9 +4849,8 @@ void SwXTableRows::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
ClientModify(this, pOld, pNew);
}
-/******************************************************************
- * SwXTableColumns
- ******************************************************************/
+// SwXTableColumns
+
OUString SwXTableColumns::getImplementationName(void) throw( uno::RuntimeException )
{
return OUString("SwXTableColumns");
commit 1043e4cb3ae68d5684d5725bd743097890ff7eb3
Author: Philipp Riemer <ruderphilipp at gmail.com>
Date: Thu Sep 26 11:01:05 2013 +0200
fdo#39468: Translate German comments
Change-Id: I2cda597bd1ccfef1234ae818716016056f44eac2
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index e3cc86c..6c39ade 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -43,22 +43,21 @@
typedef std::vector<SwStartNode*> SwSttNdPtrs;
-// Funktion zum bestimmen des hoechsten Levels innerhalb des Bereiches
+// function to determine the highest level in the given range
sal_uInt16 HighestLevel( SwNodes & rNodes, const SwNodeRange & rRange );
-/*******************************************************************
-|* SwNodes::SwNodes
-|*
-|* Beschreibung
-|* Konstruktor; legt die vier Grundsektions (PostIts,
-|* Inserts, Icons, Inhalt) an
-*******************************************************************/
+/** Constructor
+ *
+ * creates the base sections (PostIts, Inserts, AutoText, RedLines, Content)
+ *
+ * @param pDocument TODO: provide documentation
+ */
SwNodes::SwNodes( SwDoc* pDocument )
: pRoot( 0 ), pMyDoc( pDocument )
{
bInNodesDel = bInDelUpdOutl = bInDelUpdNum = sal_False;
- OSL_ENSURE( pMyDoc, "in welchem Doc stehe ich denn?" );
+ OSL_ENSURE( pMyDoc, "in which Doc am I?" );
sal_uLong nPos = 0;
SwStartNode* pSttNd = new SwStartNode( *this, nPos++ );
@@ -82,17 +81,12 @@ SwNodes::SwNodes( SwDoc* pDocument )
pOutlineNds = new SwOutlineNodes;
}
-/*******************************************************************
-|*
-|* SwNodes::~SwNodes
-|*
-|* Beschreibung
-|* dtor, loescht alle Nodes, deren Pointer in diesem dynamischen
-|* Array sind. Ist kein Problem, da Nodes ausserhalb dieses
-|* Arrays nicht erzeugt werden koennen und somit auch nicht
-|* in mehreren drin sein koennen
-|*
-*******************************************************************/
+/** Destructor
+ *
+ * Deletes all nodes whose pointer are in a dynamic array. This should be no
+ * problem as nodes cannot be created outside this array and, thus, cannot be
+ * part of multiple arrays.
+ */
SwNodes::~SwNodes()
{
delete pOutlineNds;
@@ -111,33 +105,33 @@ SwNodes::~SwNodes()
}
}
- // jetzt muessen alle SwNodeIndizies abgemeldet sein!!!
+ // here, all SwNodeIndices must be unregistered
delete pEndOfContent;
}
void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
SwNodeIndex& rInsPos, sal_Bool bNewFrms )
{
- // im UndoBereich brauchen wir keine Frames
+ // no need for frames in the UndoArea
SwNodes& rNds = rInsPos.GetNodes();
const SwNode* pPrevInsNd = rNds[ rInsPos.GetIndex() -1 ];
- //JP 03.02.99: alle Felder als invalide erklaeren, aktu. erfolgt im
- // Idle-Handler des Docs
+ // declare all fields as invalid, updating will happen
+ // in the idle-handler of the doc
if( GetDoc()->SetFieldsDirty( true, &rDelPos.GetNode(), nSz ) &&
rNds.GetDoc() != GetDoc() )
rNds.GetDoc()->SetFieldsDirty( true, NULL, 0 );
- //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen
+ // NEVER include nodes from the RedLineArea
sal_uLong nNd = rInsPos.GetIndex();
bool bInsOutlineIdx = !(
rNds.GetEndOfRedlines().StartOfSectionNode()->GetIndex() < nNd &&
nNd < rNds.GetEndOfRedlines().GetIndex() );
- if( &rNds == this ) // im gleichen Nodes-Array -> moven !!
+ if( &rNds == this ) // if in the same node array -> move
{
- // wird von vorne nach hinten gemovt, so wird nach vorne immer
- // nachgeschoben, d.H. die Loeschposition ist immer gleich
+ // Move order: from front to back, so that new entries are added at
+ // first position, thus, deletion position stays the same
sal_uInt16 nDiff = rDelPos.GetIndex() < rInsPos.GetIndex() ? 0 : 1;
for( sal_uLong n = rDelPos.GetIndex(); nSz; n += nDiff, --nSz )
@@ -203,7 +197,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
{
SwNode* pNd = &rDelPos.GetNode();
- // NoTextNode muessen ihre Persitenten Daten mitnehmen
+ // NoTextNode keep their persistent data
if( pNd->IsNoTxtNode() )
{
if( bSavePersData )
@@ -219,7 +213,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
pOutlineNds->erase( pNd );
}
- // muss die Rule kopiere werden?
+ // copy rules if needed
if( pDestDoc )
{
const SwNumRule* pNumRule = pTxtNd->GetNumRule();
@@ -234,14 +228,13 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
}
}
else
- // wenns ins UndoNodes-Array gemoved wird, sollten die
- // Numerierungen auch aktualisiert werden.
+ // if movement into the UndoNodes-array, update numbering
pTxtNd->InvalidateNumRule();
pTxtNd->RemoveFromList();
}
- RemoveNode( rDelPos.GetIndex(), 1, sal_False ); // Indizies verschieben !!
+ RemoveNode( rDelPos.GetIndex(), 1, sal_False ); // move indices
SwCntntNode * pCNd = pNd->GetCntntNode();
rNds.InsertNode( pNd, aInsPos );
@@ -259,7 +252,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
pTxtNd->AddToList();
- // Sonderbehandlung fuer die Felder!
+ // special treatment for fields
if( pHts && pHts->Count() )
{
// this looks fishy if pDestDoc != 0
@@ -335,8 +328,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
}
else
{
- // in unterschiedliche Docs gemoved ?
- // dann die Daten wieder persistent machen
+ // Moved into different Docs? Persist data again!
if( pCNd->IsNoTxtNode() && bRestPersData )
((SwNoTxtNode*)pCNd)->RestorePersistentData();
}
@@ -344,8 +336,8 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
}
}
- //JP 03.02.99: alle Felder als invalide erklaeren, aktu. erfolgt im
- // Idle-Handler des Docs
+ // declare all fields as invalid, updating will happen
+ // in the idle-handler of the doc
GetDoc()->SetFieldsDirty( true, NULL, 0 );
if( rNds.GetDoc() != GetDoc() )
rNds.GetDoc()->SetFieldsDirty( true, NULL, 0 );
@@ -364,7 +356,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
if( !pFrmNd && aFrmNdIdx > rNds.GetEndOfExtras().GetIndex() )
{
- OSL_ENSURE( !this, "ob das so richtig ist ??" );
+ OSL_ENSURE( !this, "here, something wrong happened" );
aFrmNdIdx = rNds.GetEndOfContent();
pFrmNd = rNds.GoPrevSection( &aFrmNdIdx, sal_True, sal_False );
if( pFrmNd && !((SwCntntNode*)pFrmNd)->GetDepends() )
@@ -390,23 +382,22 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
}
}
-/***********************************************************************
-|*
-|* SwNodes::Move
-|*
-|* Beschreibung
-|* Move loescht die Node-Pointer ab und einschliesslich der Startposition
-|* bis zu und ausschliesslich der Endposition und fuegt sie an
-|* der vor der Zielposition ein.
-|* Wenn das Ziel vor dem ersten oder dem letzten zu bewegenden Element oder
-|* dazwischen liegt, geschieht nichts.
-|* Wenn der zu bewegende Bereich leer ist oder das Ende vor
-|* dem Anfang liegt, geschieht nichts.
-|*
-|* Allg.: aRange beschreibt den Bereich -exklusive- aEnd !!
-|* ( 1.Node: aStart, letzer Node: aEnd-1 !! )
-|*
-***********************************************************************/
+// TODO: provide documentation
+/** move the node pointer
+ *
+ * Move the node pointer from "(inclusive) start position to (exclusive) end
+ * position" to target position.
+ * If the target is in front of the first or in the area between first and
+ * last element to move, nothing happens.
+ * If the area to move is empty or the end position is before the start
+ * position, nothing happens.
+ *
+ * @param aRange range to move (excluding end node)
+ * @param rNodes
+ * @param aIndex
+ * @param bNewFrms
+ * @return
+ */
sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
const SwNodeIndex& aIndex, sal_Bool bNewFrms )
{
@@ -418,14 +409,14 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
SwNodeRange aRg( aRange );
- // "einfache" StartNodes oder EndNodes ueberspringen
+ // skip "simple" start or end nodes
while( ND_STARTNODE == (pAktNode = &aRg.aStart.GetNode())->GetNodeType()
|| ( pAktNode->IsEndNode() &&
!pAktNode->pStartOfSection->IsSectionNode() ) )
aRg.aStart++;
aRg.aStart--;
- // falls aEnd-1 auf keinem ContentNode steht, dann suche den vorherigen
+ // if aEnd-1 points to no ContentNode, search previous one
aRg.aEnd--;
while( ( (( pAktNode = &aRg.aEnd.GetNode())->GetStartNode() &&
!pAktNode->IsSectionNode() ) ||
@@ -434,8 +425,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
aRg.aEnd > aRg.aStart )
aRg.aEnd--;
-
- // wird im selben Array's verschoben, dann ueberpruefe die Einfuegepos.
+ // if in same array, check insertion position
if( aRg.aStart >= aRg.aEnd )
return sal_False;
@@ -447,34 +437,34 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
return sal_False;
}
- sal_uInt16 nLevel = 0; // Level-Counter
- sal_uLong nInsPos = 0; // Cnt fuer das TmpArray
+ sal_uInt16 nLevel = 0; // level counter
+ sal_uLong nInsPos = 0; // counter for tmp array
- // das Array bildet einen Stack, es werden alle StartOfSelction's gesichert
+ // array as a stack, storing all StartOfSelections
SwSttNdPtrs aSttNdStack;
- // setze den Start-Index
+ // set start index
SwNodeIndex aIdx( aIndex );
SwStartNode* pStartNode = aIdx.GetNode().pStartOfSection;
aSttNdStack.insert( aSttNdStack.begin(), pStartNode );
- SwNodeRange aOrigInsPos( aIdx, -1, aIdx ); // Originale Insert Pos
+ SwNodeRange aOrigInsPos( aIdx, -1, aIdx ); // original insertion position
- //JP 16.01.98: SectionNodes: DelFrms/MakeFrms beim obersten SectionNode!
+ // call DelFrms/MakeFrms for the upmost SectionNode
sal_uInt16 nSectNdCnt = 0;
sal_Bool bSaveNewFrms = bNewFrms;
- // bis alles verschoben ist
+ // continue until everything has been moved
while( aRg.aStart < aRg.aEnd )
switch( (pAktNode = &aRg.aEnd.GetNode())->GetNodeType() )
{
case ND_ENDNODE:
{
- if( nInsPos ) // verschieb schon mal alle bis hier her
+ if( nInsPos ) // move everything until here
{
- // loeschen und kopieren. ACHTUNG: die Indizies ab
- // "aRg.aEnd+1" werden mit verschoben !!
+ // delete and copy. CAUTION: all indices after
+ // "aRg.aEnd+1" will be moved as well!
SwNodeIndex aSwIndex( aRg.aEnd, 1 );
ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
aIdx -= nInsPos;
@@ -486,24 +476,24 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
{
SwTableNode* pTblNd = (SwTableNode*)pSttNd;
- // dann bewege die gesamte Tabelle/den Bereich !!
+ // move the whole table/range
nInsPos = (aRg.aEnd.GetIndex() -
pSttNd->GetIndex() )+1;
aRg.aEnd -= nInsPos;
- //JP 12.03.99: 63293 - Nodes vom RedlineBereich NIE aufnehmen
+ // NEVER include nodes from the RedLineArea
sal_uLong nNd = aIdx.GetIndex();
bool bInsOutlineIdx = !( rNodes.GetEndOfRedlines().
StartOfSectionNode()->GetIndex() < nNd &&
nNd < rNodes.GetEndOfRedlines().GetIndex() );
if( bNewFrms )
- // loesche erstmal die Frames
+ // delete all frames
pTblNd->DelFrms();
- if( &rNodes == this ) // in sich selbst moven ??
+ if( &rNodes == this ) // move into self?
{
- // dann bewege alle Start/End/ContentNodes. Loesche
- // bei den ContentNodes auch die Frames !!
+ // move all Start/End/ContentNodes
+ // ContentNodes: delete also the frames!
pTblNd->pStartOfSection = aIdx.GetNode().pStartOfSection;
for( sal_uLong n = 0; n < nInsPos; ++n )
{
@@ -536,15 +526,15 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
}
else
{
- // StartNode holen
+ // get StartNode
// Even aIdx points to a startnode, we need the startnode
// of the environment of aIdx (#i80941)
SwStartNode* pSttNode = aIdx.GetNode().pStartOfSection;
- // Hole alle Boxen mit Inhalt. Deren Indizies auf die
- // StartNodes muessen umgemeldet werden !!
- // (Array kopieren und alle gefunden wieder loeschen;
- // erleichtert das suchen!!)
+ // get all boxes with content because their indices
+ // pointing to the StartNodes need to be reset
+ // (copying the array and deleting all found ones eases
+ // searching)
SwNodeIndex aMvIdx( aRg.aEnd, 1 );
for( sal_uLong n = 0; n < nInsPos; ++n )
{
@@ -552,8 +542,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
const bool bOutlNd = pNd->IsTxtNode() &&
static_cast<SwTxtNode*>(pNd)->IsOutline();
- // loesche die Gliederungs-Indizies aus
- // dem alten Nodes-Array
+ // delete outline indices from old node array
if( bOutlNd )
pOutlineNds->erase( pNd );
@@ -561,9 +550,9 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
pNd->pStartOfSection = pSttNode;
rNodes.InsertNode( pNd, aIdx );
- // setze bei Start/EndNodes die richtigen Indizies
+ // set correct indices in Start/EndNodes
if( bInsOutlineIdx && bOutlNd )
- // und setze sie im neuen Nodes-Array
+ // and put them into the new node array
rNodes.pOutlineNds->insert( pNd );
else if( pNd->IsStartNode() )
pSttNode = (SwStartNode*)pNd;
@@ -608,35 +597,32 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
}
else if( pSttNd->GetIndex() < aRg.aStart.GetIndex() )
{
- // SectionNode: es wird nicht die gesamte Section
- // verschoben, also bewege nur die
- // ContentNodes
- // StartNode: erzeuge an der Postion eine neue Section
+ // SectionNode: not the whole section will be moved, thus,
+ // move only the ContentNodes
+ // StartNode: create a new section at the given position
do { // middle check loop
if( !pSttNd->IsSectionNode() )
{
- // Start und EndNode an der InsertPos erzeugen
+ // create StartNode and EndNode at InsertPos
SwStartNode* pTmp = new SwStartNode( aIdx,
ND_STARTNODE,
-/*?? welcher NodeTyp ??*/
- SwNormalStartNode );
+/*?? NodeType ??*/ SwNormalStartNode );
- nLevel++; // den Index auf StartNode auf den Stack
+ nLevel++; // put the index to StartNode on the stack
aSttNdStack.insert( aSttNdStack.begin() + nLevel, pTmp );
- // noch den EndNode erzeugen
+ // create EndNode
new SwEndNode( aIdx, *pTmp );
}
else if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(
rNodes))
{
- // im UndoNodes-Array spendieren wir einen
- // Platzhalter
+ // use placeholder in UndoNodes array
new SwDummySectionNode( aIdx );
}
else
{
- // JP 18.5.2001: neue Section anlegen?? Bug 70454
+ // JP 18.5.2001 (Bug 70454) creating new section?
aRg.aEnd--;
break;
@@ -648,10 +634,10 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
}
else
{
- // Start und EndNode komplett verschieben
-// s. u. SwIndex aOldStt( pSttNd->theIndex );
-//JP 21.05.97: sollte der Start genau der Start des Bereiches sein, so muss
-// der Node auf jedenfall noch besucht werden!
+ // move StartNode and EndNode in total
+
+ // if Start is exactly the Start of the area,
+ // then the Node needs to be re-visited
if( &aRg.aStart.GetNode() == pSttNd )
--aRg.aStart;
@@ -662,7 +648,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
RemoveNode( aRg.aEnd.GetIndex(), 1, sal_False ); // EndNode loeschen
sal_uLong nSttPos = pSttNd->GetIndex();
- // dieser StartNode wird spaeter wieder entfernt!
+ // this StartNode will be removed later
SwStartNode* pTmpSttNd = new SwStartNode( *this, nSttPos+1 );
pTmpSttNd->pStartOfSection = pSttNd->pStartOfSection;
@@ -676,10 +662,10 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
aRg.aEnd--;
- nLevel++; // den Index auf StartNode auf den Stack
+ nLevel++; // put the index pointing to the StartNode onto the stack
aSttNdStack.insert( aSttNdStack.begin() + nLevel, pSttNd );
- // SectionNode muss noch ein paar Indizies ummelden
+ // reset remaining indices if SectionNode
if( pSctNd )
{
pSctNd->NodesArrChgd();
@@ -694,12 +680,11 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
if( !nLevel &&
GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNodes))
{
- // dann muss an der akt. InsPos ein SectionDummyNode
- // eingefuegt werden
- if( nInsPos ) // verschieb schon mal alle bis hier her
+ // here, a SectionDummyNode needs to be inserted at the current position
+ if( nInsPos ) // move everything until here
{
- // loeschen und kopieren. ACHTUNG: die Indizies ab
- // "aRg.aEnd+1" werden mit verschoben !!
+ // delete and copy. CAUTION: all indices after
+ // "aRg.aEnd+1" will be moved as well!
SwNodeIndex aSwIndex( aRg.aEnd, 1 );
ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
aIdx -= nInsPos;
@@ -710,7 +695,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
aIdx--;
break;
}
- // kein break !!
+ // no break !!
case ND_TABLENODE:
case ND_STARTNODE:
{
@@ -722,9 +707,9 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
break;
}
- if( !nLevel ) // es wird eine Stufe runter gestuft
+ if( !nLevel ) // level is decreasing
{
- // erzeuge die Runterstufung
+ // create decrease
SwNodeIndex aTmpSIdx( aOrigInsPos.aStart, 1 );
SwStartNode* pTmpStt = new SwStartNode( aTmpSIdx,
ND_STARTNODE,
@@ -737,7 +722,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
aTmpEIdx--;
++aTmpSIdx;
- // setze die StartOfSection richtig
+ // set correct StartOfSection
aRg.aEnd++;
{
SwNodeIndex aCntIdx( aRg.aEnd );
@@ -745,7 +730,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
aCntIdx.GetNode().pStartOfSection = pTmpStt;
}
- // Setze auch bei allen runtergestuften den richtigen StartNode
+ // also set correct StartNode for all decreased nodes
while( aTmpSIdx < aTmpEIdx )
if( 0 != (( pAktNode = &aTmpEIdx.GetNode())->GetEndNode()) )
aTmpEIdx = pAktNode->StartOfSectionIndex();
@@ -755,28 +740,28 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
aTmpEIdx--;
}
- aIdx--; // hinter den eingefuegten StartNode
- aRg.aEnd--; // vor den StartNode
- // kopiere jetzt das Array. ACHTUNG: die Indizies ab
- // "aRg.aEnd+1" werden mit verschoben !!
+ aIdx--; // after the inserted StartNode
+ aRg.aEnd--; // before StartNode
+ // copy array. CAUTION: all indices after
+ // "aRg.aEnd+1" will be moved as well!
SwNodeIndex aSwIndex( aRg.aEnd, 1 );
ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
aIdx -= nInsPos+1;
nInsPos = 0;
}
- else // es wurden alle Nodes innerhalb eines
- { // Start- und End-Nodes verschoben
+ else // all nodes between StartNode and EndNode were moved
+ {
OSL_ENSURE( pAktNode == aSttNdStack[nLevel] ||
( pAktNode->IsStartNode() &&
aSttNdStack[nLevel]->IsSectionNode()),
- "falscher StartNode" );
+ "wrong StartNode" );
SwNodeIndex aSwIndex( aRg.aEnd, 1 );
ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
- aIdx -= nInsPos+1; // vor den eingefuegten StartNode
+ aIdx -= nInsPos+1; // before inserted StartNode
nInsPos = 0;
- // loesche nur noch den Pointer aus dem Nodes-Array.
+ // remove pointer from node array
RemoveNode( aRg.aEnd.GetIndex(), 1, sal_True );
aRg.aEnd--;
@@ -787,11 +772,11 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
pSectNd->MakeFrms( &aTmp );
bNewFrms = bSaveNewFrms;
}
- aSttNdStack.erase( aSttNdStack.begin() + nLevel ); // vom Stack loeschen
+ aSttNdStack.erase( aSttNdStack.begin() + nLevel ); // remove from stack
nLevel--;
}
- // loesche alle entstehenden leeren Start-/End-Node-Paare
+ // delete all resulting empty start/end node pairs
SwNode* pTmpNode = (*this)[ aRg.aEnd.GetIndex()+1 ]->GetEndNode();
if( pTmpNode && ND_STARTNODE == (pAktNode = &aRg.aEnd.GetNode())
->GetNodeType() && pAktNode->StartOfSectionIndex() &&
@@ -819,21 +804,20 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
case ND_SECTIONDUMMY:
if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this))
{
- if( &rNodes == this ) // innerhalb vom UndoNodesArray
+ if( &rNodes == this ) // inside UndoNodesArray
{
- // mit verschieben
+ // move everything
pAktNode->pStartOfSection = aSttNdStack[ nLevel ];
nInsPos++;
}
- else // in ein "normales" Nodes-Array verschieben
+ else // move into "normal" node array
{
- // dann muss an der akt. InsPos auch ein SectionNode
- // (Start/Ende) stehen; dann diesen ueberspringen.
- // Andernfalls nicht weiter beachten.
- if( nInsPos ) // verschieb schon mal alle bis hier her
+ // than a SectionNode (start/end) is needed at the current
+ // InsPos; if so skip it, otherwise ignore current node
+ if( nInsPos ) // move everything until here
{
- // loeschen und kopieren. ACHTUNG: die Indizies ab
- // "aRg.aEnd+1" werden mit verschoben !!
+ // delete and copy. CAUTION: all indices after
+ // "aRg.aEnd+1" will be moved as well!
SwNodeIndex aSwIndex( aRg.aEnd, 1 );
ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
aIdx -= nInsPos;
@@ -842,38 +826,37 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
SwNode* pTmpNd = &aIdx.GetNode();
if( pTmpNd->IsSectionNode() ||
pTmpNd->StartOfSectionNode()->IsSectionNode() )
- aIdx--; // ueberspringen
+ aIdx--; // skip
}
}
else {
- OSL_FAIL( "wie kommt diser Node ins Nodes-Array??" );
+ OSL_FAIL( "How can this node be in the node array?" );
}
aRg.aEnd--;
break;
default:
- OSL_FAIL( "was ist das fuer ein Node??" );
+ OSL_FAIL( "Unknown node type" );
break;
}
- if( nInsPos ) // kopiere den Rest
+ if( nInsPos ) // copy remaining rest
{
- // der Rest muesste so stimmen
+ // rest should be ok
SwNodeIndex aSwIndex( aRg.aEnd, 1 );
ChgNode( aSwIndex, nInsPos, aIdx, bNewFrms );
}
- aRg.aEnd++; // wieder exklusive Ende
+ aRg.aEnd++; // again, exclusive end
- // loesche alle leeren Start-/End-Node-Paare
+ // delete all resulting empty start/end node pairs
if( ( pAktNode = &aRg.aStart.GetNode())->GetStartNode() &&
pAktNode->StartOfSectionIndex() &&
aRg.aEnd.GetNode().GetEndNode() )
DelNodes( aRg.aStart, 2 );
- // rufe jetzt noch das Update fuer die Gliederung/Nummerierung auf
+ // initialize numbering update
aOrigInsPos.aStart++;
- // im gleichen Nodes-Array verschoben ??,
- // dann von oben nach unten das Update aufrufen !!
+ // Moved in same node array? Then call update top down!
if( this == &rNodes &&
aRg.aEnd.GetIndex() >= aOrigInsPos.aStart.GetIndex() )
{
@@ -889,45 +872,22 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
return sal_True;
}
-/*******************************************************************
-|*
-|* SwNodes::SectionDown
-|*
-|* Beschreibung
-|* SectionDown() legt ein Paar von Start- und EndSection-Node
-|* (andere Nodes koennen dazwischen liegen) an.
-|*
-|* Zustand des SRange beim Verlassen der Funktion: nStart ist der
-|* Index des ersten Node hinter dem Start Section Node, nEnd ist
-|* der Index des End Section Nodes. Beispiel: Wird Insert Section
-|* mehrmals hintereinander aufgerufen, so werden mehrere
-|* unmittelbar geschachtelte Sections (keine Content Nodes
-|* zwischen Start- bzw. End Nodes) angelegt.
-|*
-|* Allg.: aRange beschreibt den Bereich -exklusive- aEnd !!
-|* ( 1.Node: aStart, letzer Node: aEnd-1 !! )
-|*
-|* Parameter
-|* SwRange &rRange
-|* IO:
-|* IN
-|* rRange.aStart: Einfuegeposition des StartNodes
-|* rRange.aEnd: Einfuegeposition des EndNodes
-|* OUT
-|* rRange.aStart: steht hinter dem eingefuegten Startnode
-|* rRange.aEnd: steht auf dem eingefuegen Endnode
-|*
-|* Ausnahmen
-|* 1. SRange-Anfang und SRange-Ende muessen auf dem gleichen Level sein
-|* 2. duerfen nicht auf dem obersten Level sein
-|* Ist dies nicht der Fall, wird die
-|* Funktion durch Aufruf von ERR_RAISE verlassen.
-|*
-|* Debug-Funktionen
-|* die Debugging Tools geben rRange beim Eintritt und beim
-|* Verlassen der Funktion aus
-|*
-*******************************************************************/
+/** create a start/end section pair
+ *
+ * Other nodes might be in between.
+ *
+ * After this method call, the start node of pRange will be pointing to the
+ * first node after the start section node and the end node will be the index
+ * of the end section node. If this method is called multiple times with the
+ * same input, multiple sections containing the previous ones will be created
+ * (no content nodes between start or end node).
+ *
+ * @note Start and end node of the range must be on the same level but MUST
+ * NOT be on the top level.
+ *
+ * @param [IN,OUT] pRange the range (excl. end)
+ * @param eSttNdTyp type of the start node
+ */
void SwNodes::SectionDown(SwNodeRange *pRange, SwStartNodeType eSttNdTyp )
{
if( pRange->aStart >= pRange->aEnd ||
@@ -935,32 +895,32 @@ void SwNodes::SectionDown(SwNodeRange *pRange, SwStartNodeType eSttNdTyp )
!CheckNodesRange( pRange->aStart, pRange->aEnd ))
return;
- // Ist der Anfang vom Bereich vor oder auf einem EndNode, so loesche
- // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes enstehen.
- // Bei anderen Nodes wird eine neuer StartNode eingefuegt
+ // If the beginning of a range is before or at a start node position, so
+ // delete it, otherwise empty S/E or E/S nodes would be created.
+ // For other nodes, create a new start node.
SwNode * pAktNode = &pRange->aStart.GetNode();
SwNodeIndex aTmpIdx( *pAktNode->StartOfSectionNode() );
if( pAktNode->GetEndNode() )
- DelNodes( pRange->aStart, 1 ); // verhinder leere Section
+ DelNodes( pRange->aStart, 1 ); // prevent empty section
else
{
- // fuege einen neuen StartNode ein
+ // insert a new StartNode
SwNode* pSttNd = new SwStartNode( pRange->aStart, ND_STARTNODE, eSttNdTyp );
pRange->aStart = *pSttNd;
aTmpIdx = pRange->aStart;
}
- // Ist das Ende vom Bereich vor oder auf einem StartNode, so loesche
- // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes enstehen
- // Bei anderen Nodes wird eine neuer EndNode eingefuegt
+ // If the end of a range is before or at a StartNode, so delete it,
+ // otherwise empty S/E or E/S nodes would be created.
+ // For other nodes, insert a new end node.
pRange->aEnd--;
if( pRange->aEnd.GetNode().GetStartNode() )
DelNodes( pRange->aEnd, 1 );
else
{
pRange->aEnd++;
- // fuege einen neuen EndNode ein
+ // insert a new EndNode
new SwEndNode( pRange->aEnd, *pRange->aStart.GetNode().GetStartNode() );
}
pRange->aEnd--;
@@ -968,37 +928,18 @@ void SwNodes::SectionDown(SwNodeRange *pRange, SwStartNodeType eSttNdTyp )
SectionUpDown( aTmpIdx, pRange->aEnd );
}
-/*******************************************************************
-|*
-|* SwNodes::SectionUp
-|*
-|* Beschreibung
-|* Der von rRange umspannte Bereich wird auf die naechst hoehere
-|* Ebene gehoben. Das geschieht dadurch, dass bei
-|* rRange.aStart ein Endnode und bei rRange.aEnd ein
-|* Startnode eingefuegt wird. Die Indices fuer den Bereich
-|* innerhalb von rRange werden geupdated.
-|*
-|* Allg.: aRange beschreibt den Bereich -exklusive- aEnd !!
-|* ( 1.Node: aStart, letzer Node: aEnd-1 !! )
-|*
-|* Parameter
-|* SwRange &rRange
-|* IO:
-|* IN
-|* rRange.aStart: Anfang des hoeher zubewegenden Bereiches
-|* rRange.aEnd: der 1.Node hinter dem Bereich
-|* OUT
-|* rRange.aStart: an der ersten Position innerhalb des
-|* hochbewegten Bereiches
-|* rRange.aEnd: an der letzten Position innerhalb des
-|* hochbewegten Bereiches
-|*
-|* Debug-Funktionen
-|* die Debugging Tools geben rRange beim Eintritt und beim
-|* Verlassen der Funktion aus
-|*
-*******************************************************************/
+/** increase level of the given range
+ *
+ * The range contained in pRange will be lifted to the next higher level.
+ * This is done by adding a end node at pRange.start and a start node at
+ * pRange.end. Furthermore all indices for this range will be updated.
+ *
+ * After this method call, the start node of pRange will be pointing to the
+ * first node inside the lifted range and the end node will be pointing to the
+ * last position inside the lifted range.
+ *
+ * @param [IN,OUT] pRange the range of nodes where the level should be increased
+ */
void SwNodes::SectionUp(SwNodeRange *pRange)
{
if( pRange->aStart >= pRange->aEnd ||
@@ -1007,9 +948,9 @@ void SwNodes::SectionUp(SwNodeRange *pRange)
!( HighestLevel( *this, *pRange ) > 1 ))
return;
- // Ist der Anfang vom Bereich vor oder auf einem StartNode, so loesche
- // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes enstehen.
- // Bei anderen Nodes wird eine neuer EndNode eingefuegt
+ // If the beginning of a range is before or at a start node position, so
+ // delete it, otherwise empty S/E or E/S nodes would be created.
+ // For other nodes, create a new start node.
SwNode * pAktNode = &pRange->aStart.GetNode();
SwNodeIndex aIdx( *pAktNode->StartOfSectionNode() );
if( pAktNode->IsStartNode() ) // selbst StartNode
@@ -1017,7 +958,7 @@ void SwNodes::SectionUp(SwNodeRange *pRange)
SwEndNode* pEndNd = pRange->aEnd.GetNode().GetEndNode();
if( pAktNode == pEndNd->pStartOfSection )
{
- // dann wurde paarig aufgehoben, also nur die im Berich neu anpassen
+ // there was a pairwise reset, adjust only those in the range
SwStartNode* pTmpSttNd = pAktNode->pStartOfSection;
RemoveNode( pRange->aStart.GetIndex(), 1, sal_True );
RemoveNode( pRange->aEnd.GetIndex(), 1, sal_True );
@@ -1036,21 +977,21 @@ void SwNodes::SectionUp(SwNodeRange *pRange)
}
DelNodes( pRange->aStart, 1 );
}
- else if( aIdx == pRange->aStart.GetIndex()-1 ) // vor StartNode
+ else if( aIdx == pRange->aStart.GetIndex()-1 ) // before StartNode
DelNodes( aIdx, 1 );
else
new SwEndNode( pRange->aStart, *aIdx.GetNode().GetStartNode() );
- // Ist das Ende vom Bereich vor oder auf einem StartNode, so loesche
- // diesen, denn sonst wuerden leere S/E-Nodes oder E/S-Nodes entstehen
- // Bei anderen Nodes wird eine neuer EndNode eingefuegt
+ // If the end of a range is before or at a StartNode, so delete it,
+ // otherwise empty S/E or E/S nodes would be created.
+ // For other nodes, insert a new end node.
SwNodeIndex aTmpIdx( pRange->aEnd );
if( pRange->aEnd.GetNode().IsEndNode() )
DelNodes( pRange->aEnd, 1 );
else
{
pAktNode = new SwStartNode( pRange->aEnd );
-/*?? welcher NodeTyp ??*/
+/*?? which NodeType ??*/
aTmpIdx = *pRange->aEnd.GetNode().EndOfSectionNode();
pRange->aEnd--;
}
@@ -1058,31 +999,27 @@ void SwNodes::SectionUp(SwNodeRange *pRange)
SectionUpDown( aIdx, aTmpIdx );
}
-/*************************************************************************
-|*
-|* SwNodes::SectionUpDown()
-|*
-|* Beschreibung
-|* Methode setzt die Indizies die bei SectionUp oder SectionDwon
-|* veraendert wurden wieder richtig, sodass die Ebenen wieder
-|* Konsistent sind.
-|*
-|* Parameter
-|* SwIndex & aStart StartNode !!!
-|* SwIndex & aEnd EndPunkt
-|*
-*************************************************************************/
+/** correct indices after movement
+ *
+ * Update all indices after movement so that the levels are consistent again.
+ *
+ * @param aStart index of the start node
+ * @param aEnd index of the end point
+ *
+ * @see SwNodes::SectionUp
+ * @see SwNodes::SectionDown
+ */
void SwNodes::SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEnd )
{
SwNode * pAktNode;
SwNodeIndex aTmpIdx( aStart, +1 );
- // das Array bildet einen Stack, es werden alle StartOfSelction's gesichert
+ // array forms a stack, holding all StartOfSelections
SwSttNdPtrs aSttNdStack;
SwStartNode* pTmp = aStart.GetNode().GetStartNode();
aSttNdStack.push_back( pTmp );
- // durchlaufe bis der erste zu aendernde Start-Node gefunden wurde
- // ( Es wird vom eingefuegten EndNode bis nach vorne die Indexe gesetzt )
+ // loop until the first start node that needs to be change was found
+ // (the indices are updated from the end node backwards to the start)
for( ;; ++aTmpIdx )
{
pAktNode = &aTmpIdx.GetNode();
@@ -1099,87 +1036,70 @@ void SwNodes::SectionUpDown( const SwNodeIndex & aStart, const SwNodeIndex & aEn
pSttNd->pEndOfSection = (SwEndNode*)pAktNode;
aSttNdStack.pop_back();
if( !aSttNdStack.empty() )
- continue; // noch genuegend EndNodes auf dem Stack
+ continue; // still enough EndNodes on the stack
- else if( aTmpIdx < aEnd ) // Uebergewicht an StartNodes
- // ist das Ende noch nicht erreicht, so hole den Start von
- // der uebergeordneten Section
+ else if( aTmpIdx < aEnd ) // too many StartNodes
+ // if the end is not reached, yet, get the start of the section above
{
aSttNdStack.insert( aSttNdStack.begin(), pSttNd->pStartOfSection );
}
- else // wenn ueber den Bereich hinaus, dann Ende
+ else // finished, as soon as out of the range
break;
}
}
}
-/*******************************************************************
-|*
-|* SwNodes::Delete
-|*
-|* Beschreibung
-|* Spezielle Implementierung der Delete-Funktion des
-|* variablen Array. Diese spezielle Implementierung ist
-|* notwendig, da durch das Loeschen von Start- bzw.
-|* Endnodes Inkonsistenzen entstehen koennen. Diese werden
-|* durch diese Funktion beseitigt.
-|*
-|* Parameter
-|* IN
-|* SwIndex &rIndex bezeichnet die Position, an der
-|* geloescht wird
-|* rIndex ist nach Aufruf der Funktion unveraendert (Kopie?!)
-|* sal_uInt16 nNodes bezeichnet die Anzahl der zu loeschenden
-|* Nodes; ist auf 1 defaulted
-|*
-|* Debug-Funktionen
-|* geben beim Eintritt in die Funktion Position und Anzahl
-|* der zu loeschenden Nodes aus.
-|*
-*******************************************************************/
+/** delete nodes
+ *
+ * This is a specific implementation of a delete function for a variable array.
+ * It is necessary as there might be inconsistencies after deleting start or
+ * end nodes. This method can clean those up.
+ *
+ * @param rIndex position to delete at (unchanged afterwards)
+ * @param nNodes number of nodes to delete (default: 1)
+ */
void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
{
- sal_uInt16 nLevel = 0; // Level-Counter
+ sal_uInt16 nLevel = 0; // level counter
SwNode * pAktNode;
sal_uLong nCnt = Count() - rIndex.GetIndex() - 1;
if( nCnt > nNodes ) nCnt = nNodes;
- if( nCnt == 0 ) // keine Anzahl -> return
+ if( nCnt == 0 ) // no count -> return
return;
SwNodeRange aRg( rIndex, 0, rIndex, nCnt-1 );
- // ueberprufe ob rIndex..rIndex + nCnt ueber einen Bereich hinausragt !!
+ // check if [rIndex..rIndex + nCnt] is larger than the range
if( ( !aRg.aStart.GetNode().StartOfSectionIndex() &&
!aRg.aStart.GetIndex() ) ||
! CheckNodesRange( aRg.aStart, aRg.aEnd ) )
return;
-
- // falls aEnd auf keinem ContentNode steht, dann suche den vorherigen
+ // if aEnd is not on a ContentNode, search the previous one
while( ( pAktNode = &aRg.aEnd.GetNode())->GetStartNode() ||
( pAktNode->GetEndNode() &&
!pAktNode->pStartOfSection->IsTableNode() ))
aRg.aEnd--;
nCnt = 0;
- // Start erhoehen, damit auf < abgefragt wird. ( bei <= kann es zu
- // Problemen fuehren; ist aEnd == aStart und wird aEnd geloscht,
- // so ist aEnd <= aStart
+//TODO: check/improve comment
+ // increase start so that we are able to use "<" (using "<=" might cause
+ // problems if aEnd == aStart and aEnd is deleted, so aEnd <= aStart)
aRg.aStart--;
sal_Bool bSaveInNodesDel = bInNodesDel;
bInNodesDel = sal_True;
bool bUpdateOutline = false;
- // bis alles geloescht ist
+ // loop until everything is deleted
while( aRg.aStart < aRg.aEnd )
{
pAktNode = &aRg.aEnd.GetNode();
if( pAktNode->GetEndNode() )
{
- // die gesamte Section loeschen ?
+ // delete the whole section?
if( pAktNode->StartOfSectionIndex() > aRg.aStart.GetIndex() )
{
SwTableNode* pTblNd = pAktNode->pStartOfSection->GetTableNode();
@@ -1197,7 +1117,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
if (pTxtNode->IsOutline() &&
pOutlineNds->Seek_Entry( pNd, &nIdxPos ))
{
- // loesche die Gliederungs-Indizies.
+ // remove outline indices
pOutlineNds->erase(nIdxPos);
bUpdateOutline = true;
}
@@ -1214,52 +1134,53 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
}
else
{
- RemoveNode( aRg.aEnd.GetIndex()+1, nCnt, sal_True ); // loesche
+ RemoveNode( aRg.aEnd.GetIndex()+1, nCnt, sal_True ); // delete
nCnt = 0;
- aRg.aEnd--; // vor den EndNode
+ aRg.aEnd--; // before the EndNode
nLevel++;
}
}
- else if( pAktNode->GetStartNode() ) // StartNode gefunden
+ else if( pAktNode->GetStartNode() ) // found StartNode
{
- if( nLevel == 0 ) // es wird eine Stufe runter gestuft
+ if( nLevel == 0 ) // decrease one level
{
if( nCnt )
{
- // loesche jetzt das Array
+ // now delete array
aRg.aEnd++;
RemoveNode( aRg.aEnd.GetIndex(), nCnt, sal_True );
nCnt = 0;
}
}
- else // es werden alle Nodes Innerhalb eines Start- und
- { // End-Nodes geloescht, loesche mit Start/EndNode
- RemoveNode( aRg.aEnd.GetIndex(), nCnt + 2, sal_True ); // loesche Array
+ else // remove all nodes between start and end node (incl. both)
+ {
+ RemoveNode( aRg.aEnd.GetIndex(), nCnt + 2, sal_True ); // delete array
nCnt = 0;
nLevel--;
}
- // nach dem loeschen kann aEnd auf einem EndNode stehen
- // loesche alle leeren Start-/End-Node-Paare
+ // after deletion, aEnd might point to a EndNode...
+ // delete all empty start/end node pairs
SwNode* pTmpNode = aRg.aEnd.GetNode().GetEndNode();
aRg.aEnd--;
while( pTmpNode &&
( pAktNode = &aRg.aEnd.GetNode())->GetStartNode() &&
pAktNode->StartOfSectionIndex() )
{
- // loesche den EndNode und StartNode
+ // remove end and start node
DelNodes( aRg.aEnd, 2 );
pTmpNode = aRg.aEnd.GetNode().GetEndNode();
aRg.aEnd--;
}
}
- else // normaler Node, also ins TmpArray einfuegen
+ else // "normal" node, so insert into TmpArray
{
SwTxtNode* pTxtNd = pAktNode->GetTxtNode();
if( pTxtNd )
{
if( pTxtNd->IsOutline())
- { // loesche die Gliederungs-Indizies.
+ {
+ // delete outline indices
pOutlineNds->erase( pTxtNd );
bUpdateOutline = true;
}
@@ -1275,15 +1196,15 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
aRg.aEnd++;
if( nCnt != 0 )
- RemoveNode( aRg.aEnd.GetIndex(), nCnt, sal_True ); // loesche den Rest
+ RemoveNode( aRg.aEnd.GetIndex(), nCnt, sal_True ); // delete the rest
- // loesche alle leeren Start-/End-Node-Paare
+ // delete all empty start/end node pairs
while( aRg.aEnd.GetNode().GetEndNode() &&
( pAktNode = &aRg.aStart.GetNode())->GetStartNode() &&
pAktNode->StartOfSectionIndex() )
- // aber ja keinen der heiligen 5.
+ // but none of the holy 5. (???)
{
- DelNodes( aRg.aStart, 2 ); // loesche den Start- und EndNode
+ DelNodes( aRg.aStart, 2 ); // delete start and end node
aRg.aStart--;
}
@@ -1291,7 +1212,7 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
if( !bInNodesDel )
{
- // rufe jetzt noch das Update fuer die Gliederung/Nummerierung auf
+ // update numbering
if( bUpdateOutline || bInDelUpdOutl )
{
UpdtOutlineIdx( aRg.aEnd.GetNode() );
@@ -1306,66 +1227,42 @@ void SwNodes::Delete(const SwNodeIndex &rIndex, sal_uLong nNodes)
}
}
-/*******************************************************************
-|*
-|* SwNodes::GetSectionLevel
-|*
-|* Beschreibung
-|* Die Funktion liefert den Sectionlevel an der durch
-|* aIndex bezeichneten Position. Die Funktion ruft die
-|* GetSectionlevel-Funktion des durch aIndex bezeichneten
-|* Nodes. Diese ist eine virtuelle Funktion, die fuer
-|* Endnodes speziell implementiert werden musste.
-|* Die Sectionlevels werden ermittelt, indem rekursiv durch
-|* die Nodesstruktur (jeweils zum naechsten theEndOfSection)
-|* gegangen wird, bis die oberste Ebene erreicht ist
-|* (theEndOfSection == 0)
-|*
-|* Parameter
-|* aIndex bezeichnet die Position des Nodes, dessen
-|* Sectionlevel ermittelt werden soll. Hier wird eine Kopie
-|* uebergeben, da eine Veraenderung der Variablen in der
-|* rufenden Funktion nicht wuenschenswert ist.
-|*
-|* Ausnahmen
-|* Der erste Node im Array sollte immer ein Startnode sein.
-|* Dieser erfaehrt in der Funktion SwNodes::GetSectionLevel()
-|* eine Sonderbehandlung; es wird davon ausgegangen, dass der
-|* erste Node auch ein Startnode ist.
-|*
-*******************************************************************/
+/** get section level at the given position
+ *
+ * @note The first node in an array should always be a start node.
+ * Because of this, there is a special treatment here based on the
+ * assumption that this is true in this context as well.
+ *
+ * @param rIdx position of the node
+ * @return section level at the given position
+ */
sal_uInt16 SwNodes::GetSectionLevel(const SwNodeIndex &rIdx) const {
- // Sonderbehandlung 1. Node
+ // special treatment for 1st Node
if(rIdx == 0) return 1;
- /*
- * Keine Rekursion! - hier wird das SwNode::GetSectionLevel
- * aufgerufen
- */
+ // no recursion! This calles a SwNode::GetSectionLevel (missing "s")
return rIdx.GetNode().GetSectionLevel();
}
void SwNodes::GoStartOfSection(SwNodeIndex *pIdx) const
{
- // hinter den naechsten Startnode
+ // after the next start node
SwNodeIndex aTmp( *pIdx->GetNode().StartOfSectionNode(), +1 );
- // steht der Index auf keinem ContentNode, dann gehe dahin. Ist aber
- // kein weiterer vorhanden, dann lasse den Index an alter Pos stehen !!!
+ // If index points to no ContentNode, than go to one.
+ // If there is no further available, do not change the index' position!
while( !aTmp.GetNode().IsCntntNode() )
- { // gehe vom StartNode ( es kann nur ein StartNode sein ! ) an sein
- // Ende
+ { // go from this StartNode (can only be one) to its end
if( *pIdx <= aTmp )
- return; // FEHLER: Steht schon hinter der Sektion
+ return; // ERROR: already after the section
aTmp = aTmp.GetNode().EndOfSectionIndex()+1;
if( *pIdx <= aTmp )
- return; // FEHLER: Steht schon hinter der Sektion
+ return; // ERROR: already after the section
}
- (*pIdx) = aTmp; // steht auf einem ContentNode
+ (*pIdx) = aTmp; // is on a ContentNode
}
void SwNodes::GoEndOfSection(SwNodeIndex *pIdx) const
{
- // falls er vor einem Endnode steht --> nichts tun
if( !pIdx->GetNode().IsEndNode() )
(*pIdx) = *pIdx->GetNode().EndOfSectionNode();
}
@@ -1404,33 +1301,20 @@ SwCntntNode* SwNodes::GoPrevious(SwNodeIndex *pIdx) const
return (SwCntntNode*)pNd;
}
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list