summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2009-11-04 13:54:00 +0100
committerMichael Stahl <mst@openoffice.org>2009-11-04 13:54:00 +0100
commit1d73fc3b6154851b462131f99179de434b09c20d (patch)
tree856441dc9e100d5bb8647df832b7d48d82b7e49a
parent34f0e624c9d647dbde99e492a948aa4aad0caad4 (diff)
#i97570#: SwReader::Read(): also create UNDO object for frames anchored AT char
-rw-r--r--sw/inc/undobj.hxx5
-rw-r--r--sw/source/core/undo/undobj.cxx26
-rw-r--r--sw/source/filter/basflt/shellio.cxx28
3 files changed, 45 insertions, 14 deletions
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index aaafa3fca76a..daefe85aa09a 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -206,6 +206,11 @@ namespace nsDelCntntType
const DelCntntType DELCNT_CHKNOCNTNT = 0x80;
}
+/// will DelCntntIndex destroy a frame anchored at character at rAnchorPos?
+bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
+ SwPosition const & rStart, SwPosition const & rEnd,
+ DelCntntType const nDelCntntType = nsDelCntntType::DELCNT_ALL);
+
// diese Klasse muss in ein Undo-Object vererbt werden, wenn dieses Inhalt
// fuers Redo/Undo ... speichert
class SwUndoSaveCntnt
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 87522d4d59f8..3b090e875ea8 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -666,14 +666,9 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark,
{
if( !pHistory )
pHistory = new SwHistory;
- if( pAPos->nNode < pEnd->nNode &&
- ( ( nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType ) ||
- ( pStt->nNode < pAPos->nNode || !pStt->nContent.GetIndex() ) ) )
+ if (IsDestroyFrameAnchoredAtChar(
+ *pAPos, *pStt, *pEnd, nDelCntntType))
{
- // Here we identified the objects to destroy:
- // - anchored between start and end of the selection
- // - anchored in start of the selection with "CheckNoContent"
- // - anchored in start of sel. and the selection start at pos 0
pHistory->Add( *pFmt, nChainInsPos );
n = n >= rSpzArr.Count() ? rSpzArr.Count() : n+1;
}
@@ -1388,3 +1383,20 @@ String DenoteSpecialCharacters(const String & rStr)
return aResult;
}
+
+bool IsDestroyFrameAnchoredAtChar(SwPosition const & rAnchorPos,
+ SwPosition const & rStart, SwPosition const & rEnd,
+ DelCntntType const nDelCntntType)
+{
+
+ // Here we identified the objects to destroy:
+ // - anchored between start and end of the selection
+ // - anchored in start of the selection with "CheckNoContent"
+ // - anchored in start of sel. and the selection start at pos 0
+ return (rAnchorPos.nNode < rEnd.nNode)
+ && ( (nsDelCntntType::DELCNT_CHKNOCNTNT & nDelCntntType)
+ || (rStart.nNode < rAnchorPos.nNode)
+ || !rStart.nContent.GetIndex()
+ );
+}
+
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 75551f2f3b8d..10e6183fb3ea 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -235,13 +235,27 @@ ULONG SwReader::Read( const Reader& rOptions )
const SwFmtAnchor& rAnchor = pFrmFmt->GetAnchor();
if( USHRT_MAX == aFlyFrmArr.GetPos( pFrmFmt) )
{
- if( FLY_PAGE == rAnchor.GetAnchorId() ||
- ( FLY_AT_CNTNT == rAnchor.GetAnchorId() &&
- rAnchor.GetCntntAnchor() &&
- ( pUndoPam->GetPoint()->nNode ==
- rAnchor.GetCntntAnchor()->nNode ||
- pUndoPam->GetMark()->nNode ==
- rAnchor.GetCntntAnchor()->nNode ) ) )
+ SwPosition const*const pFrameAnchor(
+ rAnchor.GetCntntAnchor());
+ if ( (FLY_PAGE == rAnchor.GetAnchorId())
+ || ( pFrameAnchor
+ && ( ( (FLY_AT_CNTNT == rAnchor.GetAnchorId())
+ && ( (pUndoPam->GetPoint()->nNode ==
+ pFrameAnchor->nNode)
+ || (pUndoPam->GetMark()->nNode ==
+ pFrameAnchor->nNode)
+ )
+ )
+ // #i97570# also check frames anchored AT char
+ || ( (FLY_AUTO_CNTNT == rAnchor.GetAnchorId())
+ && !IsDestroyFrameAnchoredAtChar(
+ *pFrameAnchor,
+ *pUndoPam->GetPoint(),
+ *pUndoPam->GetMark())
+ )
+ )
+ )
+ )
{
if( bChkHeaderFooter &&
FLY_AT_CNTNT == rAnchor.GetAnchorId() &&