diff options
-rw-r--r-- | sw/inc/unoport.hxx | 10 | ||||
-rw-r--r-- | sw/inc/unotbl.hxx | 9 | ||||
-rw-r--r-- | sw/source/core/unocore/unoport.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 48 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 43 |
5 files changed, 78 insertions, 48 deletions
diff --git a/sw/inc/unoport.hxx b/sw/inc/unoport.hxx index 8e558c70b349..008efb2cf18f 100644 --- a/sw/inc/unoport.hxx +++ b/sw/inc/unoport.hxx @@ -2,9 +2,9 @@ * * $RCSfile: unoport.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: os $ $Date: 2001-07-04 07:31:58 $ + * last change: $Author: dvo $ $Date: 2001-08-21 12:56:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -173,8 +173,8 @@ protected: ::com::sun::star::uno::Any *pValues, sal_Int32 nLength ); public: - SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent, SwTextPortionType eType ); - SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent, SwFrmFmt& rFmt ); + SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > & rParent, SwTextPortionType eType ); + SwXTextPortion(const SwUnoCrsr* pPortionCrsr, ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > & rParent, SwFrmFmt& rFmt ); virtual ~SwXTextPortion(); //XTextRange @@ -264,7 +264,7 @@ class SwXRubyPortion : public SwXTextPortion public: SwXRubyPortion(const SwUnoCrsr* pPortionCrsr, SwTxtRuby& rAttr, - ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParent, + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > & rParent, sal_Bool bEnd ); ~SwXRubyPortion(); }; diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index e8040a12ec02..c0563f88f2c3 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: unotbl.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: mib $ $Date: 2001-06-12 07:15:52 $ + * last change: $Author: dvo $ $Date: 2001-08-21 12:56:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -130,6 +130,9 @@ class SwXCell : public SwXCellBaseClass, SwTableBox* pBox; // only set in non-XML import const SwStartNode* pStartNode; // only set in XML import + // table position where pBox was found last + sal_uInt16 nFndPos; + protected: virtual const SwStartNode *GetStartNode() const; virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createCursor(); @@ -193,7 +196,7 @@ public: SwTableBox* GetTblBox()const {return pBox;} static SwXCell* CreateXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, const String* pCellName = 0); - static SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox); + SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox); SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } }; diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx index 4c45291bd10a..e95cbabd6ca1 100644 --- a/sw/source/core/unocore/unoport.cxx +++ b/sw/source/core/unocore/unoport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoport.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: os $ $Date: 2001-07-04 07:31:58 $ + * last change: $Author: dvo $ $Date: 2001-08-21 12:56:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -150,12 +150,12 @@ SwFmtFld* SwXTextPortion::GetFldFmt(sal_Bool bInit) /*-- 11.12.98 09:56:55--------------------------------------------------- -----------------------------------------------------------------------*/ -SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< XText > xParent, +SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< XText > & rParent, SwTextPortionType eType) : aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXTPORTION_EXTENSIONS)), aLstnrCntnr( (XTextRange*)this), pFmtFld(0), - xParentText(xParent), + xParentText(rParent), ePortionType(eType), pFrameFmt(0), aFrameDepend(this, 0), @@ -182,12 +182,12 @@ SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< XT /* -----------------24.03.99 16:30------------------- * * --------------------------------------------------*/ -SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< XText > xParent, +SwXTextPortion::SwXTextPortion(const SwUnoCrsr* pPortionCrsr, uno::Reference< XText > & rParent, SwFrmFmt& rFmt ) : aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXTPORTION_EXTENSIONS)), aLstnrCntnr( (XTextRange*)this), pFrameFmt(&rFmt), - xParentText(xParent), + xParentText(rParent), ePortionType(PORTION_FRAME), pFmtFld(0), aFrameDepend(this, &rFmt), @@ -917,9 +917,9 @@ void SwXTextPortion::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) ---------------------------------------------------------------------------*/ SwXRubyPortion::SwXRubyPortion(const SwUnoCrsr* pPortionCrsr, SwTxtRuby& rAttr, - Reference< XText > xParent, + Reference< XText > & rParent, sal_Bool bEnd ) : - SwXTextPortion(pPortionCrsr, xParent, bEnd ? PORTION_RUBY_END : PORTION_RUBY_START ) + SwXTextPortion(pPortionCrsr, rParent, bEnd ? PORTION_RUBY_END : PORTION_RUBY_START ) { if(!bEnd) { diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 314fc1b4d534..fa94b3584e26 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoportenum.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: dvo $ $Date: 2001-08-16 12:37:04 $ + * last change: $Author: dvo $ $Date: 2001-08-21 12:56:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -633,10 +633,12 @@ Reference<XTextRange> lcl_ExportHints(SwpHints* pHints, //----------------------------------------------------------------------------- void lcl_FillBookmarkArray(SwDoc& rDoc,SwUnoCrsr& rUnoCrsr, SwXBookmarkPortionArr& rBkmArr ) { + const SwBookmarks& rMarks = rDoc.GetBookmarks(); + sal_uInt16 nArrLen = rMarks.Count(); + if ( nArrLen > 0 ) + { const SwNodeIndex nOwnNode = rUnoCrsr.GetPoint()->nNode; //search for all bookmarks that start or end in this paragraph - const SwBookmarks& rMarks = rDoc.GetBookmarks(); - sal_uInt16 nArrLen = rMarks.Count(); for( sal_uInt16 n = 0; n < nArrLen; ++n ) { SwBookmark* pMark = rMarks.GetObject( n ); @@ -667,30 +669,36 @@ void lcl_FillBookmarkArray(SwDoc& rDoc,SwUnoCrsr& rUnoCrsr, SwXBookmarkPortionAr rBkmArr.Insert(pBkmPtr); } } + } } //----------------------------------------------------------------------------- void lcl_FillRedlineArray(SwDoc& rDoc,SwUnoCrsr& rUnoCrsr, SwXRedlinePortionArr& rRedArr ) { const SwRedlineTbl& rRedTbl = rDoc.GetRedlineTbl(); - const SwPosition* pStart = rUnoCrsr.GetPoint(); - const SwNodeIndex nOwnNode = pStart->nNode; - SwRedlineMode eRedMode = rDoc.GetRedlineMode(); + USHORT nRedTblCount = rRedTbl.Count(); - for(USHORT nRed = 0; nRed < rRedTbl.Count(); nRed++) + if ( nRedTblCount > 0 ) { - const SwRedline* pRedline = rRedTbl[nRed]; - const SwPosition* pRedStart = pRedline->Start(); - const SwNodeIndex nRedNode = pRedStart->nNode; - SwRedlineType nType = pRedline->GetType(); - if(nOwnNode == nRedNode) - { - SwXRedlinePortion_ImplPtr pToInsert = new SwXRedlinePortion_Impl(pRedline, TRUE); - rRedArr.Insert(pToInsert); - } - if(pRedline->HasMark() && pRedline->End()->nNode == nOwnNode) + const SwPosition* pStart = rUnoCrsr.GetPoint(); + const SwNodeIndex nOwnNode = pStart->nNode; + SwRedlineMode eRedMode = rDoc.GetRedlineMode(); + + for(USHORT nRed = 0; nRed < nRedTblCount; nRed++) { - SwXRedlinePortion_ImplPtr pToInsert = new SwXRedlinePortion_Impl(pRedline, FALSE); - rRedArr.Insert(pToInsert); + const SwRedline* pRedline = rRedTbl[nRed]; + const SwPosition* pRedStart = pRedline->Start(); + const SwNodeIndex nRedNode = pRedStart->nNode; + SwRedlineType nType = pRedline->GetType(); + if(nOwnNode == nRedNode) + { + SwXRedlinePortion_ImplPtr pToInsert = new SwXRedlinePortion_Impl(pRedline, TRUE); + rRedArr.Insert(pToInsert); + } + if(pRedline->HasMark() && pRedline->End()->nNode == nOwnNode) + { + SwXRedlinePortion_ImplPtr pToInsert = new SwXRedlinePortion_Impl(pRedline, FALSE); + rRedArr.Insert(pToInsert); + } } } } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index a31d21b94c1a..c6a9c529e589 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unotbl.cxx,v $ * - * $Revision: 1.33 $ + * $Revision: 1.34 $ * - * last change: $Author: mtg $ $Date: 2001-08-16 12:28:58 $ + * last change: $Author: dvo $ $Date: 2001-08-21 12:56:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -712,7 +712,8 @@ SwXCell::SwXCell(SwFrmFmt* pTblFmt, SwTableBox* pBx, const String& rCellName) : pBox(pBx), pStartNode(0), aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_CELL)), - SwClient(pTblFmt) + SwClient(pTblFmt), + nFndPos(USHRT_MAX) { } /* -----------------------------09.08.00 15:59-------------------------------- @@ -723,7 +724,8 @@ SwXCell::SwXCell(SwFrmFmt* pTblFmt, const SwStartNode& rStartNode) : pBox(0), pStartNode(&rStartNode), aPropSet(aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TABLE_CELL)), - SwClient(pTblFmt) + SwClient(pTblFmt), + nFndPos(USHRT_MAX) { } @@ -815,9 +817,9 @@ void SAL_CALL SwXCell::release( ) throw() uno::Any SAL_CALL SwXCell::queryInterface( const uno::Type& aType ) throw (RuntimeException) { - uno::Any aRet = SwXText::queryInterface(aType); + uno::Any aRet = SwXCellBaseClass::queryInterface(aType); if(aRet.getValueType() == ::getCppuVoidType()) - aRet = SwXCellBaseClass::queryInterface(aType); + aRet = SwXText::queryInterface(aType); return aRet; } /*-- 11.12.98 10:56:24--------------------------------------------------- @@ -848,10 +850,16 @@ sal_Bool SwXCell::IsValid() else { SwTable* pTable = SwTable::FindTable( pTblFmt ); - String sTmpCell(sCellName); - sTmpCell.ToUpperAscii(); - const SwTableBox* pFoundBox = sTmpCell.Len() ? - pTable->GetTblBox( sTmpCell ) : SwXCell::FindBox(pTable, pBox); + const SwTableBox* pFoundBox ; + if( sCellName.Len() ) + { + String sTmpCell(sCellName); + sTmpCell.ToUpperAscii(); + pFoundBox = pTable->GetTblBox( sTmpCell ); + } + else + pFoundBox = FindBox(pTable, pBox); + if(pFoundBox != pBox) pBox = 0; } @@ -1175,7 +1183,9 @@ SwXCell* SwXCell::CreateXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, const String* if(pTblFmt && pBox) { SwTable* pTable = SwTable::FindTable( pTblFmt ); - SwTableBox* pFoundBox = SwXCell::FindBox(pTable, pBox); + SwTableBox* pFoundBox = + pTable->GetTabSortBoxes().Seek_Entry( pBox ) ? pBox : NULL; + //wenn es die Box gibt, dann wird auch eine Zelle zurueckgegeben if(pFoundBox) { @@ -1202,8 +1212,17 @@ SwXCell* SwXCell::CreateXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, const String* * --------------------------------------------------*/ SwTableBox* SwXCell::FindBox(SwTable* pTable, SwTableBox* pBox) { - if( pTable->GetTabSortBoxes().Seek_Entry( pBox )) + // check if nFndPos happens to point to the right table box + if( nFndPos < pTable->GetTabSortBoxes().Count() && + pBox == pTable->GetTabSortBoxes()[ nFndPos ] ) + return pBox; + + // if not, seek the entry (and return, if successful) + if( pTable->GetTabSortBoxes().Seek_Entry( pBox, &nFndPos )) return pBox; + + // box not found: reset nFndPos pointer + nFndPos = USHRT_MAX; return 0; } /* -----------------------------19.04.00 15:20-------------------------------- |