Lines 47-123
Link Here
|
47 |
|
47 |
|
48 |
void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo ) |
48 |
void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo ) |
49 |
{ |
49 |
{ |
50 |
// nur bei Selektion |
50 |
// only on a selection |
51 |
if( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark()) |
51 |
if ( !rPam.HasMark() || *rPam.GetPoint() == *rPam.GetMark()) |
52 |
return; |
52 |
return; |
53 |
|
53 |
|
54 |
// besteht eine Selection in einer Tabelle ? |
54 |
// besteht eine Selection in einer Tabelle ? |
55 |
// dann nur den Inhalt der selektierten Boxen loeschen |
55 |
// dann nur den Inhalt der selektierten Boxen loeschen |
56 |
// jetzt gibt es 2 Faelle die beachtet werden muessen: |
56 |
// jetzt gibt es 2 Faelle die beachtet werden muessen: |
57 |
// 1. Point und Mark stehen in einer Box, Selection normal loeschen |
57 |
// 1. Point und Mark stehen in einer Box, Selection normal loeschen |
58 |
// 2. Point und Mark stehen in unterschiedlichen Boxen, alle |
58 |
// 2. Point und Mark stehen in unterschiedlichen Boxen, alle |
59 |
// selektierten Boxen suchen in den Inhalt loeschen |
59 |
// selektierten Boxen suchen in den Inhalt loeschen |
60 |
|
60 |
|
61 |
//Comment:If the point is outside of a table and the mark point is in the a table cell, |
61 |
if( rPam.GetNode()->FindTableNode() && |
62 |
// should go throw the following code |
62 |
rPam.GetNode()->StartOfSectionNode() != rPam.GetNode(sal_False)->StartOfSectionNode() ) |
63 |
if( (rPam.GetNode()->FindTableNode() || rPam.GetNode(sal_False)->FindTableNode()) && |
63 |
{ |
64 |
rPam.GetNode()->StartOfSectionNode() != |
64 |
// in Tabellen das Undo gruppieren |
65 |
rPam.GetNode(sal_False)->StartOfSectionNode() ) |
65 |
if( pUndo && !*pUndo ) |
66 |
{ |
|
|
67 |
// in Tabellen das Undo gruppieren |
68 |
if( pUndo && !*pUndo ) |
69 |
{ |
66 |
{ |
70 |
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); |
67 |
GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); |
71 |
*pUndo = sal_True; |
68 |
*pUndo = sal_True; |
72 |
} |
69 |
} |
73 |
SwPaM aDelPam( *rPam.Start() ); |
70 |
SwPaM aDelPam( *rPam.Start() ); |
74 |
const SwPosition* pEndSelPos = rPam.End(); |
71 |
const SwPosition* pEndSelPos = rPam.End(); |
75 |
do { |
72 |
do { |
76 |
aDelPam.SetMark(); |
73 |
aDelPam.SetMark(); |
77 |
SwNode* pNd = aDelPam.GetNode(); |
74 |
SwNode* pNd = aDelPam.GetNode(); |
78 |
//Comment:If the point is outside of table, select the table start node as the end node of current selection node |
75 |
const SwNode& rEndNd = *pNd->EndOfSectionNode(); |
79 |
const SwNode& rEndNd = !rPam.GetNode()->FindTableNode() && !pNd->FindTableNode()? |
76 |
if( pEndSelPos->nNode.GetIndex() <= rEndNd.GetIndex() ) |
80 |
*(SwNode*)(rPam.GetNode(sal_False)->FindTableNode()) |
77 |
{ |
81 |
: |
78 |
*aDelPam.GetPoint() = *pEndSelPos; |
82 |
*pNd->EndOfSectionNode(); |
79 |
pEndSelPos = 0; // Pointer als Flag missbrauchen |
83 |
if( pEndSelPos->nNode.GetIndex() <= rEndNd.GetIndex() ) |
80 |
} |
84 |
{ |
81 |
else |
85 |
*aDelPam.GetPoint() = *pEndSelPos; |
82 |
{ |
86 |
pEndSelPos = 0; // Pointer als Flag missbrauchen |
83 |
// dann ans Ende der Section |
87 |
} |
84 |
aDelPam.GetPoint()->nNode = rEndNd; |
88 |
else |
85 |
aDelPam.Move( fnMoveBackward, fnGoCntnt ); |
89 |
{ |
86 |
} |
90 |
// dann ans Ende der Section |
87 |
// geschuetze Boxen ueberspringen ! |
91 |
aDelPam.GetPoint()->nNode = rEndNd; |
88 |
//For i117395, in some situation, the node would be hidden or invisible, which makes the frame of it unavailable |
92 |
aDelPam.Move( fnMoveBackward, fnGoCntnt ); |
89 |
//So verify it before use it. |
93 |
} |
90 |
SwCntntFrm* pFrm = NULL; |
94 |
// geschuetze Boxen ueberspringen ! |
91 |
if( !pNd->IsCntntNode() || |
95 |
//For i117395, in some situation, the node would be hidden or invisible, which makes the frame of it unavailable |
92 |
!((pFrm=((SwCntntNode*)pNd)->getLayoutFrm( GetLayout() ))!=NULL && pFrm->IsProtected()) ) |
96 |
//So verify it before use it. |
93 |
{ |
97 |
SwCntntFrm* pFrm = NULL; |
94 |
// alles loeschen |
98 |
if( !pNd->IsCntntNode() || |
95 |
GetDoc()->DeleteAndJoin( aDelPam ); |
99 |
!((pFrm=((SwCntntNode*)pNd)->getLayoutFrm( GetLayout() ))!=NULL && pFrm->IsProtected()) ) |
96 |
SaveTblBoxCntnt( aDelPam.GetPoint() ); |
100 |
{ |
97 |
} |
101 |
// alles loeschen |
98 |
|
102 |
GetDoc()->DeleteAndJoin( aDelPam ); |
99 |
if( !pEndSelPos ) // am Ende der Selection |
103 |
SaveTblBoxCntnt( aDelPam.GetPoint() ); |
100 |
break; |
104 |
} |
101 |
aDelPam.DeleteMark(); |
105 |
|
102 |
aDelPam.Move( fnMoveForward, fnGoCntnt ); // naechste Box |
106 |
if( !pEndSelPos ) // am Ende der Selection |
103 |
} while( pEndSelPos ); |
107 |
break; |
104 |
} |
108 |
aDelPam.DeleteMark(); |
105 |
else |
109 |
aDelPam.Move( fnMoveForward, fnGoCntnt ); // naechste Box |
106 |
{ |
110 |
} while( pEndSelPos ); |
107 |
// alles loeschen |
111 |
} |
108 |
GetDoc()->DeleteAndJoin( rPam ); |
112 |
else |
109 |
SaveTblBoxCntnt( rPam.GetPoint() ); |
113 |
{ |
110 |
} |
114 |
// alles loeschen |
111 |
|
115 |
GetDoc()->DeleteAndJoin( rPam ); |
112 |
// Selection wird nicht mehr benoetigt. |
116 |
SaveTblBoxCntnt( rPam.GetPoint() ); |
113 |
rPam.DeleteMark(); |
117 |
} |
|
|
118 |
|
119 |
// Selection wird nicht mehr benoetigt. |
120 |
rPam.DeleteMark(); |
121 |
} |
114 |
} |
122 |
|
115 |
|
123 |
|
116 |
|