[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 2 commits - svl/inc svl/source sw/inc sw/source
Oliver-Rainer Wittmann
orw at apache.org
Wed Jun 26 07:07:34 PDT 2013
svl/inc/svl/undo.hxx | 2
svl/source/undo/undo.cxx | 21 +++++++-
sw/inc/IDocumentUndoRedo.hxx | 6 +-
sw/source/core/edit/edundo.cxx | 17 ++++--
sw/source/core/inc/UndoManager.hxx | 7 +-
sw/source/core/layout/trvlfrm.cxx | 77 ++++++++++++------------------
sw/source/core/undo/docundo.cxx | 20 ++++++-
sw/source/filter/ww8/ww8par6.cxx | 94 ++++++++++++++++++++-----------------
sw/source/ui/shells/textsh1.cxx | 5 +
9 files changed, 147 insertions(+), 102 deletions(-)
New commits:
commit 0881a1fb1ec2b1ee59a4bf62a666fc8c1fab498b
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Wed Jun 26 13:04:54 2013 +0000
121977: WW8 import: apply grid property values, if grid is active and if the values make sense.
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 248b02b..2329ea9 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -230,14 +230,6 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection)
nTextareaHeight -= rUL.GetUpper();
nTextareaHeight -= rUL.GetLower();
- SwTwips nTextareaWidth = rFmt.GetFrmSize().GetWidth();
- const SvxLRSpaceItem &rLR = ItemGet<SvxLRSpaceItem>(rFmt, RES_LR_SPACE);
- nTextareaWidth -= rLR.GetLeft();
- nTextareaWidth -= rLR.GetRight();
-
- if (rSection.IsVertical())
- std::swap(nTextareaHeight, nTextareaWidth);
-
SwTextGridItem aGrid;
aGrid.SetDisplayGrid(false);
aGrid.SetPrintGrid(false);
@@ -275,46 +267,66 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrmFmt &rFmt, const wwSection &rSection)
rDoc.SetDefaultPageMode( bSquaredMode );
aGrid.SetSquaredMode( bSquaredMode );
- //sep.dyaLinePitch
- sal_Int32 nLinePitch = rSection.maSep.dyaLinePitch;
-
- //Get the size of word's default styles font
- sal_uInt32 nCharWidth=240;
- for (sal_uInt16 nI = 0; nI < pStyles->GetCount(); ++nI)
+ if ( eType != GRID_NONE )
{
- if (pCollA[nI].bValid && pCollA[nI].pFmt &&
- pCollA[nI].GetWWStyleId() == 0)
+
+ //sep.dyaLinePitch
+ const sal_Int32 nLinePitch = rSection.maSep.dyaLinePitch;
+
+ //Get the size of word's default styles font
+ sal_uInt32 nCharWidth=240;
+ for (sal_uInt16 nI = 0; nI < pStyles->GetCount(); ++nI)
{
- nCharWidth = ItemGet<SvxFontHeightItem>(*(pCollA[nI].pFmt),
- RES_CHRATR_CJK_FONTSIZE).GetHeight();
- break;
+ if (pCollA[nI].bValid && pCollA[nI].pFmt &&
+ pCollA[nI].GetWWStyleId() == 0)
+ {
+ nCharWidth = ItemGet<SvxFontHeightItem>(*(pCollA[nI].pFmt),
+ RES_CHRATR_CJK_FONTSIZE).GetHeight();
+ break;
+ }
}
- }
- //dxtCharSpace
- if (rSection.maSep.dxtCharSpace)
- {
- sal_uInt32 nCharSpace = rSection.maSep.dxtCharSpace;
- //main lives in top 20 bits, and is signed.
- sal_Int32 nMain = (nCharSpace & 0xFFFFF000);
- nMain/=0x1000;
- nCharWidth += nMain*20;
+ //dxtCharSpace
+ if (rSection.maSep.dxtCharSpace)
+ {
+ sal_uInt32 nCharSpace = rSection.maSep.dxtCharSpace;
+ //main lives in top 20 bits, and is signed.
+ sal_Int32 nMain = (nCharSpace & 0xFFFFF000);
+ nMain/=0x1000;
+ nCharWidth += nMain*20;
+
+ int nFraction = (nCharSpace & 0x00000FFF);
+ nFraction = (nFraction*20)/0xFFF;
+ nCharWidth += nFraction;
+ }
- int nFraction = (nCharSpace & 0x00000FFF);
- nFraction = (nFraction*20)/0xFFF;
- nCharWidth += nFraction;
- }
+ SwTwips nTextareaWidth = rFmt.GetFrmSize().GetWidth();
+ {
+ const SvxLRSpaceItem &rLR = ItemGet<SvxLRSpaceItem>(rFmt, RES_LR_SPACE);
+ nTextareaWidth -= rLR.GetLeft();
+ nTextareaWidth -= rLR.GetRight();
- aGrid.SetBaseWidth( writer_cast<sal_uInt16>(nCharWidth));
- aGrid.SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));
- aGrid.SetBaseHeight(writer_cast<sal_uInt16>(nLinePitch));
+ if (rSection.IsVertical())
+ std::swap(nTextareaHeight, nTextareaWidth);
+ }
- // ruby height is not supported in ww8
- //sal_Int32 nRubyHeight = nLinePitch - nCharWidth;
- //if (nRubyHeight < 0)
- // nRubyHeight = 0;
- sal_Int32 nRubyHeight = 0;
- aGrid.SetRubyHeight(writer_cast<sal_uInt16>(nRubyHeight));
+ // only apply sensible grid property values
+ if ( nLinePitch > 0
+ && nCharWidth > 0
+ && nTextareaHeight > nLinePitch )
+ {
+ aGrid.SetBaseWidth( writer_cast<sal_uInt16>(nCharWidth));
+ aGrid.SetLines(writer_cast<sal_uInt16>(nTextareaHeight/nLinePitch));
+ aGrid.SetBaseHeight(writer_cast<sal_uInt16>(nLinePitch));
+ }
+
+ // ruby height is not supported in ww8
+ //sal_Int32 nRubyHeight = nLinePitch - nCharWidth;
+ //if (nRubyHeight < 0)
+ // nRubyHeight = 0;
+ sal_Int32 nRubyHeight = 0;
+ aGrid.SetRubyHeight(writer_cast<sal_uInt16>(nRubyHeight));
+ }
rFmt.SetFmtAttr(aGrid);
}
commit 4207db473430e02a65a5f4d57db6e46a8db29a19
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date: Wed Jun 26 12:15:55 2013 +0000
121751: - restore cursor/selection on Undo/Redo language change for all text
- group intrinsic actions of language change for all text into one Undo action
- secure <SwRootFrm::CalcRects(..)> - catch NULL pointer
- correct <CursorGuard> - really restore the cursor
diff --git a/svl/inc/svl/undo.hxx b/svl/inc/svl/undo.hxx
index d738f2b..885ca1c 100644
--- a/svl/inc/svl/undo.hxx
+++ b/svl/inc/svl/undo.hxx
@@ -242,6 +242,7 @@ namespace svl
virtual size_t GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const = 0;
virtual UniString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
+ virtual SfxUndoAction* GetRedoAction( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const = 0;
virtual sal_Bool Undo() = 0;
virtual sal_Bool Redo() = 0;
@@ -360,6 +361,7 @@ public:
virtual SfxUndoAction* GetUndoAction( size_t nNo=0 ) const;
virtual size_t GetRedoActionCount( bool const i_currentLevel = CurrentLevel ) const;
virtual UniString GetRedoActionComment( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
+ virtual SfxUndoAction* GetRedoAction( size_t nNo=0, bool const i_currentLevel = CurrentLevel ) const;
virtual sal_Bool Undo();
virtual sal_Bool Redo();
virtual void Clear();
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 09a60ae..6faeb95 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -831,11 +831,30 @@ size_t SfxUndoManager::ImplGetRedoActionCount_Lock( bool const i_currentLevel )
//------------------------------------------------------------------------
+SfxUndoAction* SfxUndoManager::GetRedoAction( size_t nNo, bool const i_currentLevel ) const
+{
+ UndoManagerGuard aGuard( *m_pData );
+
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
+ if ( (pUndoArray->nCurUndoAction + nNo) > pUndoArray->aUndoActions.size() )
+ {
+ return NULL;
+ }
+ return pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction;
+}
+
+//------------------------------------------------------------------------
+
XubString SfxUndoManager::GetRedoActionComment( size_t nNo, bool const i_currentLevel ) const
{
+ String sComment;
UndoManagerGuard aGuard( *m_pData );
const SfxUndoArray* pUndoArray = i_currentLevel ? m_pData->pActUndoArray : m_pData->pUndoArray;
- return pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction->GetComment();
+ if ( (pUndoArray->nCurUndoAction + nNo) < pUndoArray->aUndoActions.size() )
+ {
+ sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction->GetComment();
+ }
+ return sComment;
}
//------------------------------------------------------------------------
diff --git a/sw/inc/IDocumentUndoRedo.hxx b/sw/inc/IDocumentUndoRedo.hxx
index b873b4c..dffa613 100644
--- a/sw/inc/IDocumentUndoRedo.hxx
+++ b/sw/inc/IDocumentUndoRedo.hxx
@@ -160,11 +160,13 @@ public:
*/
virtual sal_Bool Redo() = 0;
- /** Get comment of first Redo action.
+ /** Get Id and comment of first Redo action.
@param o_pStr if not 0, receives comment of first Redo action.
+ @param o_pId if not 0, receives Id of first Redo action.
@return true if there is a Redo action, false if none
*/
- virtual bool GetFirstRedoInfo(::rtl::OUString *const o_pStr) const = 0;
+ virtual bool GetFirstRedoInfo(::rtl::OUString *const o_pStr,
+ SwUndoId *const o_pId = 0) const = 0;
/** Get comments of Redo actions.
@return comments of all top-level Redo actions.
diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx
index ce2f5d6..db8f9d3 100644
--- a/sw/source/core/edit/edundo.cxx
+++ b/sw/source/core/edit/edundo.cxx
@@ -113,12 +113,12 @@ bool SwEditShell::Undo(sal_uInt16 const nCount)
SetMark(); // Bound1 und Bound2 in den gleichen Node
ClearMark();
- // JP 02.04.98: Cursor merken - beim Auto-Format/-Korrektur
- // soll dieser wieder an die Position
SwUndoId nLastUndoId(UNDO_EMPTY);
- GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId);
- bool bRestoreCrsr = 1 == nCount && (UNDO_AUTOFORMAT == nLastUndoId ||
- UNDO_AUTOCORRECT == nLastUndoId );
+ GetLastUndoInfo(0, & nLastUndoId);
+ const bool bRestoreCrsr = nCount == 1
+ && ( UNDO_AUTOFORMAT == nLastUndoId
+ || UNDO_AUTOCORRECT == nLastUndoId
+ || UNDO_SETDEFTATTR == nLastUndoId );
Push();
//JP 18.09.97: gesicherten TabellenBoxPtr zerstoeren, eine autom.
@@ -172,6 +172,11 @@ bool SwEditShell::Redo(sal_uInt16 const nCount)
SetMark(); // Bound1 und Bound2 in den gleichen Node
ClearMark();
+ SwUndoId nFirstRedoId(UNDO_EMPTY);
+ GetDoc()->GetIDocumentUndoRedo().GetFirstRedoInfo(0, & nFirstRedoId);
+ const bool bRestoreCrsr = nCount == 1 && UNDO_SETDEFTATTR == nFirstRedoId;
+ Push();
+
//JP 18.09.97: gesicherten TabellenBoxPtr zerstoeren, eine autom.
// Erkennung darf nur noch fuer die neue "Box" erfolgen!
ClearTblBoxCntnt();
@@ -190,6 +195,8 @@ bool SwEditShell::Redo(sal_uInt16 const nCount)
.getStr());
}
+ Pop( !bRestoreCrsr );
+
GetDoc()->SetRedlineMode( eOld );
GetDoc()->CompressRedlines();
diff --git a/sw/source/core/inc/UndoManager.hxx b/sw/source/core/inc/UndoManager.hxx
index 7f76cf8..fce2e3e 100644
--- a/sw/source/core/inc/UndoManager.hxx
+++ b/sw/source/core/inc/UndoManager.hxx
@@ -57,17 +57,16 @@ public:
virtual void UnLockUndoNoModifiedPosition();
virtual void SetUndoNoResetModified();
virtual bool IsUndoNoResetModified() const;
-// virtual bool Undo();
virtual SwUndoId StartUndo(SwUndoId const eUndoId,
SwRewriter const*const pRewriter);
virtual SwUndoId EndUndo(SwUndoId const eUndoId,
SwRewriter const*const pRewriter);
virtual void DelAllUndoObj();
virtual bool GetLastUndoInfo(::rtl::OUString *const o_pStr,
- SwUndoId *const o_pId) const;
+ SwUndoId *const o_pId) const;
virtual SwUndoComments_t GetUndoComments() const;
-// virtual bool Redo();
- virtual bool GetFirstRedoInfo(::rtl::OUString *const o_pStr) const;
+ virtual bool GetFirstRedoInfo(::rtl::OUString *const o_pStr,
+ SwUndoId *const o_pId = 0) const;
virtual SwUndoComments_t GetRedoComments() const;
virtual bool Repeat(::sw::RepeatContext & rContext,
sal_uInt16 const nRepeatCnt);
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index b768315..43fbbfe 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -2008,35 +2008,19 @@ inline void Sub( SwRegionRects& rRegion, const SwRect& rRect )
void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
{
SwPosition *pStartPos = rCrsr.Start(),
- *pEndPos = rCrsr.GetPoint() == pStartPos ?
- rCrsr.GetMark() : rCrsr.GetPoint();
+ *pEndPos = rCrsr.GetPoint() == pStartPos ? rCrsr.GetMark() : rCrsr.GetPoint();
ViewShell *pSh = GetCurrShell();
-// --> FME 2004-06-08 #i12836# enhanced pdf
SwRegionRects aRegion( pSh && !pSh->GetViewOptions()->IsPDFExport() ?
pSh->VisArea() :
Frm() );
-// <--
if( !pStartPos->nNode.GetNode().IsCntntNode() ||
!pStartPos->nNode.GetNode().GetCntntNode()->getLayoutFrm(this) ||
( pStartPos->nNode != pEndPos->nNode &&
( !pEndPos->nNode.GetNode().IsCntntNode() ||
!pEndPos->nNode.GetNode().GetCntntNode()->getLayoutFrm(this) ) ) )
{
- /* For SelectAll we will need something like this later on...
- const SwFrm* pPageFrm = GetLower();
- while( pPageFrm )
- {
- SwRect aTmp( pPageFrm->Prt() );
- aTmp.Pos() += pPageFrm->Frm().Pos();
- Sub( aRegion, aTmp );
- pPageFrm = pPageFrm->GetNext();
- }
- aRegion.Invert();
- rCrsr.Remove( 0, rCrsr.Count() );
- rCrsr.Insert( &aRegion, 0 );
- */
return;
}
@@ -2058,7 +2042,11 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
const SwAnchoredObject* pObj = pStartFrm->FindFlyFrm();
aSortObjs.Insert( *(const_cast<SwAnchoredObject*>(pObj)) );
const SwAnchoredObject* pObj2 = pEndFrm->FindFlyFrm();
- aSortObjs.Insert( *(const_cast<SwAnchoredObject*>(pObj2)) );
+ ASSERT( pObj2 != NULL, "SwRootFrm::CalcFrmRects(..) - FlyFrame missing - looks like an invalid selection" );
+ if ( pObj2 != NULL && pObj2 != pObj )
+ {
+ aSortObjs.Insert( *(const_cast<SwAnchoredObject*>(pObj2)) );
+ }
}
//Fall 4: Tabellenselection
@@ -2093,7 +2081,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
break;
ASSERT( pEndLFrm->GetType() == pSttLFrm->GetType(),
- "Selection ueber unterschiedliche Inhalte" );
+ "Selection ueber unterschiedliche Inhalte" );
switch( pSttLFrm->GetType() )
{
case FRM_HEADER:
@@ -2116,11 +2104,11 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
{
const SwTabFrm* pTabFrm = (SwTabFrm*)pSttLFrm;
if( ( pTabFrm->GetFollow() ||
- ((SwTabFrm*)pEndLFrm)->GetFollow() ) &&
+ ((SwTabFrm*)pEndLFrm)->GetFollow() ) &&
pTabFrm->GetTable()->GetRowsToRepeat() > 0 &&
pTabFrm->GetLower() != ((SwTabFrm*)pEndLFrm)->GetLower() &&
( lcl_IsInRepeatedHeadline( pStartFrm ) ||
- lcl_IsInRepeatedHeadline( pEndFrm ) ) )
+ lcl_IsInRepeatedHeadline( pEndFrm ) ) )
{
// End- auf den Start-CntntFrame setzen
if( pStartPos == rCrsr.GetPoint() )
@@ -2150,10 +2138,11 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
SwRect aStFrm ( pStartFrm->UnionFrm( sal_True ) );
aStFrm.Intersection( pStartFrm->PaintArea() );
- SwRect aEndFrm( pStartFrm == pEndFrm ? aStFrm :
- pEndFrm->UnionFrm( sal_True ) );
+ SwRect aEndFrm( pStartFrm == pEndFrm ? aStFrm : pEndFrm->UnionFrm( sal_True ) );
if( pStartFrm != pEndFrm )
+ {
aEndFrm.Intersection( pEndFrm->PaintArea() );
+ }
SWRECTFN( pStartFrm )
const sal_Bool bR2L = pStartFrm->IsRightToLeft();
const sal_Bool bEndR2L = pEndFrm->IsRightToLeft();
@@ -2174,8 +2163,8 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
// BiDi-Portions are swimming against the current.
const sal_Bool bPorR2L = ( MT_BIDI == pSt2Pos->nMultiType ) ?
- ! bR2L :
- bR2L;
+ ! bR2L :
+ bR2L;
if( MT_BIDI == pSt2Pos->nMultiType &&
(pSt2Pos->aPortion2.*fnRect->fnGetWidth)() )
@@ -2425,9 +2414,9 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
{
OutputDevice* pOut = pSh->GetOut();
long nCrsrWidth = pOut->GetSettings().GetStyleSettings().
- GetCursorSize();
+ GetCursorSize();
(aTmp.*fnRect->fnSetWidth)( pOut->PixelToLogic(
- Size( nCrsrWidth, 0 ) ).Width() );
+ Size( nCrsrWidth, 0 ) ).Width() );
}
aTmp.Intersection( aStFrm );
Sub( aRegion, aTmp );
@@ -2444,9 +2433,9 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
else
{
lLeft = (pStartFrm->Frm().*fnRect->fnGetLeft)() +
- (pStartFrm->Prt().*fnRect->fnGetLeft)();
+ (pStartFrm->Prt().*fnRect->fnGetLeft)();
lRight = (pStartFrm->Frm().*fnRect->fnGetLeft)() +
- (pStartFrm->Prt().*fnRect->fnGetRight)();
+ (pStartFrm->Prt().*fnRect->fnGetRight)();
}
if( lLeft < (aStFrm.*fnRect->fnGetLeft)() )
lLeft = (aStFrm.*fnRect->fnGetLeft)();
@@ -2502,17 +2491,13 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
//Now the frames between, if there are any
sal_Bool bBody = pStartFrm->IsInDocBody();
const SwTableBox* pCellBox = pStartFrm->GetUpper()->IsCellFrm() ?
- ((SwCellFrm*)pStartFrm->GetUpper())->GetTabBox() : 0;
+ ((SwCellFrm*)pStartFrm->GetUpper())->GetTabBox() : 0;
const SwCntntFrm *pCntnt = pStartFrm->GetNextCntntFrm();
SwRect aPrvRect;
- // --> OD 2006-01-24 #123908# - introduce robust code:
- // The stacktrace issue reveals that <pCntnt> could be NULL.
- // One root cause found by AMA - see #130650#
ASSERT( pCntnt,
- "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" );
+ "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" );
while ( pCntnt && pCntnt != pEndFrm )
- // <--
{
if ( pCntnt->IsInFly() )
{
@@ -2524,7 +2509,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
// If pStartFrm is inside a SwCellFrm, consider only frames which are inside the
// same cell frame (or its follow cell)
const SwTableBox* pTmpCellBox = pCntnt->GetUpper()->IsCellFrm() ?
- ((SwCellFrm*)pCntnt->GetUpper())->GetTabBox() : 0;
+ ((SwCellFrm*)pCntnt->GetUpper())->GetTabBox() : 0;
if ( bBody == pCntnt->IsInDocBody() &&
( !pCellBox || pCellBox == pTmpCellBox ) )
{
@@ -2549,10 +2534,8 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
}
}
pCntnt = pCntnt->GetNextCntntFrm();
- // --> OD 2006-01-24 #123908#
ASSERT( pCntnt,
- "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" );
- // <--
+ "<SwRootFrm::CalcFrmRects(..)> - no content frame. This is a serious defect -> please inform OD" );
}
if ( aPrvRect.HasArea() )
Sub( aRegion, aPrvRect );
@@ -2562,7 +2545,7 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
bRev = pEndFrm->IsReverse();
//Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
fnRect = bVert ? ( bRev ? fnRectVL2R : ( pEndFrm->IsVertLR() ? fnRectVertL2R : fnRectVert ) ) :
- ( bRev ? fnRectB2T : fnRectHori );
+ ( bRev ? fnRectB2T : fnRectHori );
nTmpTwips = (aEndRect.*fnRect->fnGetTop)();
if( (aEndFrm.*fnRect->fnGetTop)() != nTmpTwips )
{
@@ -2578,7 +2561,6 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
Sub( aRegion, aSubRect );
}
-// aRegion.Compress( sal_False );
aRegion.Invert();
delete pSt2Pos;
delete pEnd2Pos;
@@ -2606,8 +2588,8 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
const SwVirtFlyDrawObj* pObj = pFly->GetVirtDrawObj();
const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround();
if ( !pFly->IsAnLower( pStartFrm ) &&
- (rSur.GetSurround() != SURROUND_THROUGHT &&
- !rSur.IsContour()) )
+ (rSur.GetSurround() != SURROUND_THROUGHT &&
+ !rSur.IsContour()) )
{
if ( aSortObjs.Contains( *pAnchoredObj ) )
continue;
@@ -2617,13 +2599,18 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, sal_Bool bIsTblMode )
for ( sal_uInt16 k = 0; bSub && k < aSortObjs.Count(); ++k )
{
ASSERT( aSortObjs[k]->ISA(SwFlyFrm),
- "<SwRootFrm::CalcFrmRects(..)> - object in <aSortObjs> of unexcepted type" );
+ "<SwRootFrm::CalcFrmRects(..)> - object in <aSortObjs> of unexcepted type" );
const SwFlyFrm* pTmp = static_cast<SwFlyFrm*>(aSortObjs[k]);
do
- { if ( nPos < pTmp->GetVirtDrawObj()->GetOrdNumDirect() )
+ {
+ if ( nPos < pTmp->GetVirtDrawObj()->GetOrdNumDirect() )
+ {
bSub = sal_False;
+ }
else
+ {
pTmp = pTmp->GetAnchorFrm()->FindFlyFrm();
+ }
} while ( bSub && pTmp );
}
if ( bSub )
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index f2731fb..462c335 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -341,16 +341,28 @@ SwUndoComments_t UndoManager::GetUndoComments() const
/**************** REDO ******************/
-bool UndoManager::GetFirstRedoInfo(::rtl::OUString *const o_pStr) const
+bool UndoManager::GetFirstRedoInfo(::rtl::OUString *const o_pStr,
+ SwUndoId *const o_pId) const
{
if (!SdrUndoManager::GetRedoActionCount(CurrentLevel))
{
return false;
}
+ SfxUndoAction *const pAction( SdrUndoManager::GetRedoAction(0, CurrentLevel) );
+ if ( pAction == NULL )
+ {
+ return false;
+ }
+
if (o_pStr)
{
- *o_pStr = SdrUndoManager::GetRedoActionComment(0, CurrentLevel);
+ *o_pStr = pAction->GetComment();
+ }
+ if (o_pId)
+ {
+ sal_uInt16 const nId(pAction->GetId());
+ *o_pId = static_cast<SwUndoId>(nId);
}
return true;
@@ -452,7 +464,7 @@ public:
{
if (m_bSaveCursor)
{
- m_rShell.Pop();
+ m_rShell.Pop( sal_False );
}
}
private:
@@ -477,7 +489,7 @@ bool UndoManager::impl_DoUndoRedo(UndoOrRedo_t const undoOrRedo)
// in case the model has controllers locked, the Undo should not
// change the view cursors!
bool const bSaveCursors(pEditShell->CursorsLocked());
- CursorGuard(*pEditShell, bSaveCursors);
+ CursorGuard aCursorGuard(*pEditShell, bSaveCursors);
if (!bSaveCursors)
{
// (in case Undo was called via API) clear the cursors:
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index 1601c3c..4b35b36 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -343,6 +343,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
rWrtSh.StartAction();
// prevent view from jumping because of (temporary) selection changes
rWrtSh.LockView( sal_True );
+
// save selection for later restoration
rWrtSh.Push();
@@ -392,12 +393,16 @@ void SwTextShell::Execute(SfxRequest &rReq)
rWrtSh.SelAll();
rWrtSh.ExtendedSelectAll();
}
+
+ rWrtSh.StartUndo( ( !bForParagraph && !bForSelection ) ? UNDO_SETDEFTATTR : UNDO_EMPTY );
if (aNewLangTxt == aStrNone)
SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet );
else if (aNewLangTxt == aStrResetLangs)
SwLangHelper::ResetLanguages( rWrtSh, bForSelection );
else
SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet );
+ rWrtSh.EndUndo();
+
}
// restore selection...
More information about the Libreoffice-commits
mailing list