[Libreoffice-commits] .: 2 commits - starmath/source sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sun Sep 2 05:57:24 PDT 2012
starmath/source/cursor.cxx | 23 +++++++++++++----------
sw/inc/editsh.hxx | 17 ++++++-----------
sw/source/core/edit/edws.cxx | 14 +++++---------
sw/source/ui/docvw/edtwin.cxx | 10 +++++-----
sw/source/ui/shells/basesh.cxx | 2 +-
sw/source/ui/uiview/viewmdi.cxx | 4 ++--
sw/source/ui/wrtsh/delete.cxx | 18 +++++++++---------
sw/source/ui/wrtsh/move.cxx | 2 +-
sw/source/ui/wrtsh/select.cxx | 26 +++++++++++++-------------
sw/source/ui/wrtsh/wrtsh1.cxx | 8 ++++----
10 files changed, 59 insertions(+), 65 deletions(-)
New commits:
commit 35e13d1f5403076c752879ecbe17b2f451b188d9
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Sun Sep 2 16:05:21 2012 +0400
expand ACT_KONTEXT and MV_KONTEXT macros, rename kontext to context
Change-Id: I7783e60cc048dfbd99976881afca317ad1326d66
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 0122900..58d8bef 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -968,26 +968,21 @@ inline const sfx2::LinkManager& SwEditShell::GetLinkManager() const
{ return ((SwEditShell*)this)->GetLinkManager(); }
/// Class for automated call of Start- and EndAction().
-class SwActKontext {
+class SwActContext {
SwEditShell *pSh;
public:
- SwActKontext(SwEditShell *pShell);
- ~SwActKontext();
+ SwActContext(SwEditShell *pShell);
+ ~SwActContext();
};
-#define ACT_KONTEXT(x) SwActKontext _aActKontext_(x)
-
/// Class for automated call of Start- and EndCrsrMove().
-class SwMvKontext {
+class SwMvContext {
SwEditShell *pSh;
public:
- SwMvKontext(SwEditShell *pShell );
- ~SwMvKontext();
+ SwMvContext(SwEditShell *pShell);
+ ~SwMvContext();
};
-#define MV_KONTEXT(x) SwMvKontext _aMvKontext_(x)
-
-
#endif
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 4f267fe..018e275 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -206,31 +206,27 @@ sal_Bool SwEditShell::HasOtherCnt() const
******************************************************************************/
-SwActKontext::SwActKontext(SwEditShell *pShell)
+SwActContext::SwActContext(SwEditShell *pShell)
: pSh(pShell)
{
pSh->StartAction();
}
-SwActKontext::~SwActKontext()
+SwActContext::~SwActContext()
{
pSh->EndAction();
}
-/******************************************************************************
- * Klasse fuer den automatisierten Aufruf von Start- und
- * EndCrsrMove();
- ******************************************************************************/
-
-SwMvKontext::SwMvKontext(SwEditShell *pShell ) : pSh(pShell)
+SwMvContext::SwMvContext(SwEditShell *pShell)
+ : pSh(pShell)
{
pSh->SttCrsrMove();
}
-SwMvKontext::~SwMvKontext()
+SwMvContext::~SwMvContext()
{
pSh->EndCrsrMove();
}
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 777f072..812d7bd 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -3435,7 +3435,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
{ // only temporary generate Move-Kontext because otherwise
// the query to the content form doesn't work!!!
- MV_KONTEXT( &rSh );
+ SwMvContext aMvContext( &rSh );
nTmpSetCrsr = rSh.SetCursor(&aDocPos, bOnlyText);
bValidCrsrPos = !(CRSR_POSCHG & nTmpSetCrsr);
bCallBase = sal_False;
@@ -3459,7 +3459,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
nSelType & nsSelectionType::SEL_GRF ||
rSh.IsObjSelectable( aDocPos ) )
{
- MV_KONTEXT( &rSh );
+ SwMvContext aMvContext( &rSh );
if( !rSh.IsFrmSelected() )
rSh.GotoNextFly();
rSh.EnterSelFrmMode();
@@ -4210,7 +4210,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
bNoInterrupt = sal_False;
{ // create only temporary move context because otherwise
// the query to the content form doesn't work!!!
- MV_KONTEXT( &rSh );
+ SwMvContext aMvContext( &rSh );
const Point aDocPos( PixelToLogic( aStartPos ) );
bValidCrsrPos = !(CRSR_POSCHG & rSh.SetCursor(&aDocPos, false));
}
@@ -5402,7 +5402,7 @@ sal_Bool SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos )
{
{ // create only temporary move context because otherwise
// the query against the content form doesn't work!!!
- MV_KONTEXT( &rSh );
+ SwMvContext aMvContext( &rSh );
rSh.SetCursor(&aDocPos, false);
bRet = sal_True;
}
@@ -5413,7 +5413,7 @@ sal_Bool SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos )
if( nSelType == nsSelectionType::SEL_OLE ||
nSelType == nsSelectionType::SEL_GRF )
{
- MV_KONTEXT( &rSh );
+ SwMvContext aMvContext( &rSh );
if( !rSh.IsFrmSelected() )
rSh.GotoNextFly();
rSh.EnterSelFrmMode();
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
index 099e96f..af0cc97 100644
--- a/sw/source/ui/shells/basesh.cxx
+++ b/sw/source/ui/shells/basesh.cxx
@@ -665,7 +665,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
if (rSh.HasMark())
{
- MV_KONTEXT(&rSh);
+ SwMvContext aMvContext(&rSh);
if (rSh.IsCrsrPtAtEnd())
rSh.SwapPam();
rSh.ClearMark();
diff --git a/sw/source/ui/uiview/viewmdi.cxx b/sw/source/ui/uiview/viewmdi.cxx
index 27949cf..0152251 100644
--- a/sw/source/ui/uiview/viewmdi.cxx
+++ b/sw/source/ui/uiview/viewmdi.cxx
@@ -84,7 +84,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
pWrtShell->LockPaint();
{
- ACT_KONTEXT(pWrtShell);
+ SwActContext aActContext(pWrtShell);
long nFac = nFactor;
@@ -222,7 +222,7 @@ void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, sal_Bool bViewO
{
- ACT_KONTEXT(pWrtShell);
+ SwActContext aActContext(pWrtShell);
if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly )
{
diff --git a/sw/source/ui/wrtsh/delete.cxx b/sw/source/ui/wrtsh/delete.cxx
index 08604a4..a220189 100644
--- a/sw/source/ui/wrtsh/delete.cxx
+++ b/sw/source/ui/wrtsh/delete.cxx
@@ -99,7 +99,7 @@ sal_Bool SwWrtShell::TryRemoveIndent()
long SwWrtShell::DelLine()
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
ResetCursorStack();
// alten Cursor merken
Push();
@@ -170,10 +170,10 @@ long SwWrtShell::DelLeft()
{
if( !IsBlockMode() || HasSelection() )
{
- //OS: wieder einmal Basic: ACT_KONTEXT muss vor
+ //OS: wieder einmal Basic: SwActContext muss vor
//EnterStdMode verlassen werden!
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
ResetCursorStack();
Delete();
UpdateAttr();
@@ -265,10 +265,10 @@ long SwWrtShell::DelRight()
{
if( !IsBlockMode() || HasSelection() )
{
- //OS: wieder einmal Basic: ACT_KONTEXT muss vor
+ //OS: wieder einmal Basic: SwActContext muss vor
//EnterStdMode verlassen werden!
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
ResetCursorStack();
Delete();
UpdateAttr();
@@ -418,7 +418,7 @@ long SwWrtShell::DelRight()
long SwWrtShell::DelToEndOfPara()
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
ResetCursorStack();
Push();
SetMark();
@@ -438,7 +438,7 @@ long SwWrtShell::DelToEndOfPara()
long SwWrtShell::DelToStartOfPara()
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
ResetCursorStack();
Push();
SetMark();
@@ -489,7 +489,7 @@ long SwWrtShell::DelNxtWord()
{
if(IsEndOfDoc())
return 0;
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
ResetCursorStack();
EnterStdMode();
SetMark();
@@ -515,7 +515,7 @@ long SwWrtShell::DelPrvWord()
{
if(IsStartOfDoc())
return 0;
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
ResetCursorStack();
EnterStdMode();
SetMark();
diff --git a/sw/source/ui/wrtsh/move.cxx b/sw/source/ui/wrtsh/move.cxx
index 89d10bd..9ee0f41 100644
--- a/sw/source/ui/wrtsh/move.cxx
+++ b/sw/source/ui/wrtsh/move.cxx
@@ -763,7 +763,7 @@ sal_Bool SwWrtShell::SelectTxtAttr( sal_uInt16 nWhich, const SwTxtAttr* pAttr )
{
sal_Bool bRet;
{
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
SttSelect();
bRet = SwCrsrShell::SelectTxtAttr( nWhich, sal_False, pAttr );
}
diff --git a/sw/source/ui/wrtsh/select.cxx b/sw/source/ui/wrtsh/select.cxx
index c89fe0a..c228aa1 100644
--- a/sw/source/ui/wrtsh/select.cxx
+++ b/sw/source/ui/wrtsh/select.cxx
@@ -71,7 +71,7 @@ void SwWrtShell::Invalidate()
sal_Bool SwWrtShell::SelNearestWrd()
{
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
if( !IsInWrd() && !IsEndWrd() && !IsSttWrd() )
PrvWrd();
if( IsEndWrd() )
@@ -85,7 +85,7 @@ sal_Bool SwWrtShell::SelWrd(const Point *pPt, sal_Bool )
{
sal_Bool bRet;
{
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
SttSelect();
bRet = SwCrsrShell::SelectWord( pPt );
}
@@ -102,7 +102,7 @@ sal_Bool SwWrtShell::SelWrd(const Point *pPt, sal_Bool )
void SwWrtShell::SelSentence(const Point *pPt, sal_Bool )
{
{
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
ClearMark();
SwCrsrShell::GoStartSentence();
SttSelect();
@@ -118,7 +118,7 @@ void SwWrtShell::SelSentence(const Point *pPt, sal_Bool )
void SwWrtShell::SelPara(const Point *pPt, sal_Bool )
{
{
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
ClearMark();
SwCrsrShell::MovePara( fnParaCurr, fnParaStart );
SttSelect();
@@ -139,7 +139,7 @@ long SwWrtShell::SelAll()
{
if(bBlockMode)
LeaveBlockMode();
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
sal_Bool bMoveTable = sal_False;
SwPosition *pStartPos = 0;
SwPosition *pEndPos = 0;
@@ -320,7 +320,7 @@ long SwWrtShell::SetCrsr(const Point *pPt, sal_Bool bTextOnly)
long SwWrtShell::SetCrsrKillSel(const Point *pPt, sal_Bool bTextOnly )
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
ResetSelect(pPt,sal_False);
return SwCrsrShell::SetCrsr(*pPt, bTextOnly);
}
@@ -350,14 +350,14 @@ long SwWrtShell::ResetSelect(const Point *,sal_Bool)
}
else
{
- /* ACT_KONTEXT() macht eine Action auf -
+ /* SwActContext macht eine Action auf -
um im Basicablauf keine Probleme mit der
Shellumschaltung zu bekommen, darf
GetChgLnk().Call() erst nach
EndAction() gerufen werden.
*/
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
bSelWrd = bSelLn = sal_False;
KillPams();
ClearMark();
@@ -447,7 +447,7 @@ inline sal_Bool operator<(const Point &rP1,const Point &rP2)
long SwWrtShell::ExtSelWrd(const Point *pPt, sal_Bool )
{
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
if( IsTableMode() )
return 1;
@@ -509,7 +509,7 @@ long SwWrtShell::ExtSelWrd(const Point *pPt, sal_Bool )
long SwWrtShell::ExtSelLn(const Point *pPt, sal_Bool )
{
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
SwCrsrShell::SetCrsr(*pPt);
if( IsTableMode() )
return 1;
@@ -569,12 +569,12 @@ void SwWrtShell::EnterStdMode()
}
else
{
- /* ACT_KONTEXT() opens and action which has to be
+ /* SwActContext opens and action which has to be
closed prior to the call of
GetChgLnk().Call()
*/
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
bSelWrd = bSelLn = sal_False;
if( !IsRetainSelection() )
KillPams();
@@ -888,7 +888,7 @@ long SwWrtShell::EndDrag(const Point * /*pPt*/, sal_Bool )
// #i32329# Enhanced table selection
sal_Bool SwWrtShell::SelectTableRowCol( const Point& rPt, const Point* pEnd, bool bRowDrag )
{
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
SttSelect();
if(SelTblRowCol( rPt, pEnd, bRowDrag ))
{
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index 723cb4c..813a9f5 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -176,7 +176,7 @@ void SwWrtShell::Edit()
sal_Bool SwWrtShell::IsEndWrd()
{
- MV_KONTEXT(this);
+ SwMvContext aMvContext(this);
if(IsEndPara() && !IsSttPara())
return sal_True;
@@ -896,7 +896,7 @@ void SwWrtShell::InsertPageBreak(const String *pPageDesc, sal_uInt16 nPgNum )
ResetCursorStack();
if( CanInsert() )
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
StartUndo(UNDO_UI_INSERT_PAGE_BREAK);
if ( !IsCrsrInTbl() )
@@ -951,7 +951,7 @@ void SwWrtShell::InsertLineBreak()
void SwWrtShell::InsertColumnBreak()
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
ResetCursorStack();
if( CanInsert() )
{
@@ -1015,7 +1015,7 @@ void SwWrtShell::SplitNode( sal_Bool bAutoFmt, sal_Bool bCheckTableStart )
ResetCursorStack();
if( CanInsert() )
{
- ACT_KONTEXT(this);
+ SwActContext aActContext(this);
rView.GetEditWin().FlushInBuffer();
sal_Bool bHasSel = HasSelection();
commit 3e317451e319734d7e45cc431bd4b68ffe1a08f6
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date: Sun Sep 2 15:04:08 2012 +0400
crash with safe iterators: attempt to decrement a past-the-end iterator
Change-Id: I4c81125e67c23fb05e98fc6b2f47ed3e49dd29c3
diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx
index ed81f1e..9edb83e 100644
--- a/starmath/source/cursor.cxx
+++ b/starmath/source/cursor.cxx
@@ -205,18 +205,21 @@ void SmCursor::DeletePrev(OutputDevice* pDev){
//Line to merge things into, so we can delete pLine
SmNode* pMergeLine = pLineParent->GetSubNode(nLineOffset-1);
OSL_ENSURE(pMergeLine, "pMergeLine cannot be NULL!");
+ SmCaretPos PosAfterDelete;
//Convert first line to list
SmNodeList *pLineList = NodeToList(pMergeLine);
- //Find iterator to patch
- SmNodeList::iterator patchPoint = pLineList->end();
- --patchPoint;
- //Convert second line to list
- NodeToList(pLine, pLineList);
- //Patch the line list
- ++patchPoint;
- SmCaretPos PosAfterDelete = PatchLineList(pLineList, patchPoint);
- //Parse the line
- pLine = SmNodeListParser().Parse(pLineList);
+ if(!pLineList->empty()){
+ //Find iterator to patch
+ SmNodeList::iterator patchPoint = pLineList->end();
+ --patchPoint;
+ //Convert second line to list
+ NodeToList(pLine, pLineList);
+ //Patch the line list
+ ++patchPoint;
+ PosAfterDelete = PatchLineList(pLineList, patchPoint);
+ //Parse the line
+ pLine = SmNodeListParser().Parse(pLineList);
+ }
delete pLineList;
pLineParent->SetSubNode(nLineOffset-1, pLine);
//Delete the removed line slot
More information about the Libreoffice-commits
mailing list