Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <hintids.hxx>
31 : : #include <editeng/lrspitem.hxx>
32 : : #include <editeng/boxitem.hxx>
33 : : #include <editeng/frmdiritem.hxx>
34 : : #include <svtools/rtftoken.h>
35 : : #include <fmtfsize.hxx>
36 : : #include <fmtpdsc.hxx>
37 : : #include <ndtxt.hxx>
38 : : #include <doc.hxx>
39 : : #include <pam.hxx>
40 : : #include <swparrtf.hxx>
41 : : #include <swtable.hxx>
42 : : #include <tblsel.hxx>
43 : : #include <swtblfmt.hxx>
44 : : #include <wrtswtbl.hxx>
45 : : #include <tblenum.hxx>
46 : : #include <frmatr.hxx>
47 : : #include <fmtrowsplt.hxx>
48 : : #include <vector>
49 : :
50 : : using namespace ::com::sun::star;
51 : :
52 : : typedef std::vector<SwTableBoxFmt*> SwBoxFrmFmts;
53 : :
54 : : class SwShareBoxFmts;
55 : : extern void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* = 0,
56 : : sal_Bool = sal_True, const sal_Bool = sal_True, SwShareBoxFmts* = 0 );
57 : :
58 : : struct Row
59 : : {
60 : : bool mbUseLeftRowPad, mbUseRightRowPad, mbUseTopRowPad, mbUseBottomRowPad;
61 : : long mnLeftRowPad, mnRightRowPad, mnTopRowPad, mnBottomRowPad;
62 : : sal_uInt16 mnBrdDist;
63 : 0 : Row() :
64 : : mbUseLeftRowPad(false), mbUseRightRowPad(false),
65 : : mbUseTopRowPad(false), mbUseBottomRowPad(false),
66 : : mnLeftRowPad(0), mnRightRowPad(0), mnTopRowPad(0), mnBottomRowPad(0),
67 : 0 : mnBrdDist(MIN_BORDER_DIST)
68 : 0 : {}
69 : : };
70 : :
71 : 0 : static void SetRowBorder(SfxItemSet& rSet, const Row &rRow)
72 : : {
73 [ # # ][ # # ]: 0 : SvxBoxItem aBox((const SvxBoxItem&)rSet.Get(RES_BOX, false));
74 : : aBox.SetDistance( static_cast< sal_uInt16 >(rRow.mbUseLeftRowPad ? rRow.mnLeftRowPad : rRow.mnBrdDist),
75 [ # # ][ # # ]: 0 : BOX_LINE_LEFT);
76 : :
77 : : aBox.SetDistance( static_cast< sal_uInt16 >(rRow.mbUseRightRowPad ? rRow.mnRightRowPad : rRow.mnBrdDist),
78 [ # # ][ # # ]: 0 : BOX_LINE_RIGHT);
79 : :
80 : : aBox.SetDistance( static_cast< sal_uInt16 >(rRow.mbUseTopRowPad ? rRow.mnTopRowPad : 0),
81 [ # # ][ # # ]: 0 : BOX_LINE_TOP);
82 : :
83 : : aBox.SetDistance( static_cast< sal_uInt16 >(rRow.mbUseBottomRowPad ? rRow.mnBottomRowPad : 0),
84 [ # # ][ # # ]: 0 : BOX_LINE_BOTTOM);
85 : :
86 [ # # ][ # # ]: 0 : rSet.Put(aBox);
87 : 0 : }
88 : :
89 : 0 : void rtfSections::PrependedInlineNode(const SwPosition &rPos,
90 : : const SwNode &rNode)
91 : : {
92 : : OSL_ENSURE(!mrReader.IsNewDoc() || !maSegments.empty(),
93 : : "should not be possible, must be at least one segment in a new document");
94 [ # # ][ # # ]: 0 : if ((!maSegments.empty()) && (maSegments.back().maStart == rPos.nNode))
[ # # ]
95 [ # # ][ # # ]: 0 : maSegments.back().maStart = SwNodeIndex(rNode);
96 : 0 : }
97 : :
98 : 0 : bool SwRTFParser::IsBorderToken(int nToken)
99 : : {
100 : : /*
101 : : i30222 i28983
102 : : Our ability to sense border tokens is broken rtftoken.h is
103 : : organised in a way that ignores some border tokens. ReadBorderAttr
104 : : still doesn't support the more exotic borders but at least this
105 : : won't cause the parser to prematuerely exit the table
106 : : */
107 : 0 : bool bResult = false;
108 : :
109 : : bResult = (nToken >= RTF_BRDRDASHD && nToken <= RTF_BRDRTHTNMG) ||
110 [ # # ][ # # ]: 0 : (nToken >= RTF_BRDRTNTHSG && nToken <= RTF_BRDRWAVY);
[ # # ][ # # ]
111 : :
112 : 0 : return bResult;
113 : : }
114 : :
115 : 0 : void SwRTFParser::ReadTable( int nToken )
116 : : {
117 : 0 : nInsTblRow = USHRT_MAX;
118 : :
119 [ # # ]: 0 : if (CantUseTables())
120 : : {
121 : : // alle Tabellen-Tokens ueberlesen
122 [ # # ]: 0 : nToken = GetNextToken(); // RTF_TROWD ueberlesen
123 [ # # ]: 0 : do {
124 [ # # ][ # # ]: 0 : if( RTF_TABLEDEF != (nToken & ~(0xff | RTF_SWGDEFS)) &&
125 : : RTF_UNKNOWNCONTROL != nToken )
126 : : {
127 [ # # ]: 0 : SkipToken( -1 );
128 : 0 : break;
129 : : }
130 [ # # ]: 0 : nToken = GetNextToken();
131 : 0 : } while( IsParserWorking() );
132 : : return ;
133 : : }
134 : :
135 : : // verhinder Tabelle in Tabelle/Footnote
136 : 0 : SwTwips nTblSz = 0;
137 : 0 : int bReadNewCell = sal_False, bChkExistTbl = sal_False;
138 : :
139 : :
140 : : enum Limits {eMAXCELLS=64000};
141 : :
142 [ # # ]: 0 : std::vector<bool> aMergeBackup(aMergeBoxes);
143 : :
144 : : // kein TROWD aber ein TabellenToken -> zwischen TROWD und Tab.Token
145 : : // waren andere Zeichen (siehe Bug 27445.rtf)
146 [ # # ][ # # ]: 0 : if( RTF_TROWD == nToken || !pTableNode )
147 : : {
148 [ # # ]: 0 : if( RTF_TROWD == nToken )
149 [ # # ]: 0 : nToken = GetNextToken(); // RTF_TROWD ueberlesen
150 : :
151 : : // Flag for delete merged boxes
152 : 0 : aMergeBoxes.clear();
153 [ # # ]: 0 : aMergeBoxes.push_back(false);
154 : 0 : m_nCurrentBox = 0;
155 : :
156 : : // wenn schon in einer Tabellen, dann splitte oder benutze
157 : : // die bisherigen Boxen weiter
158 [ # # ]: 0 : bChkExistTbl = 0 != pPam->GetPoint()->nNode.GetNode().FindTableNode();
159 : : }
160 : : else
161 : : {
162 : 0 : bReadNewCell = sal_True;
163 : 0 : SwTableLines& rLns = pTableNode->GetTable().GetTabLines();
164 [ # # ]: 0 : SwTableLine* pLine = rLns.back();
165 : : // very robust to avoid crashes like bug 127425 + crash reports 118743
166 [ # # ]: 0 : if( pLine )
167 : : {
168 : 0 : sal_uInt16 nTmpBox = m_nCurrentBox;
169 [ # # ]: 0 : if( nTmpBox > pLine->GetTabBoxes().size() )
170 : 0 : nTmpBox = pLine->GetTabBoxes().size();
171 : :
172 [ # # ]: 0 : for (sal_uInt16 n = nTmpBox; n; )
173 : : {
174 : 0 : const SwTableBox *pTmp = pLine->GetTabBoxes()[ --n ];
175 [ # # ]: 0 : if( pTmp )
176 : : {
177 : 0 : const SwFrmFmt* pTmpFmt = pTmp->GetFrmFmt();
178 [ # # ]: 0 : if( pTmpFmt )
179 [ # # ]: 0 : nTblSz += pTmpFmt->GetFrmSize().GetWidth();
180 : : }
181 : : }
182 : : }
183 : : }
184 : :
185 : :
186 : 0 : sal_Int16 eAdjust = text::HoriOrientation::LEFT; // default fuer Tabellen
187 : 0 : SwTwips nLSpace = 0;
188 : 0 : Row aRow;
189 : :
190 : 0 : bool bUseLeftCellPad = false, bUseRightCellPad = false,
191 : 0 : bUseTopCellPad = false, bUseBottomCellPad = false;
192 : 0 : long nLeftCellPad = 0, nRightCellPad = 0, nTopCellPad = 0,
193 : 0 : nBottomCellPad = 0;
194 : :
195 : 0 : sal_Int16 eVerOrient = text::VertOrientation::NONE;
196 : 0 : long nLineHeight = 0;
197 [ # # ]: 0 : if (aMergeBoxes.empty()) // can this actually happen?
198 : : {
199 : : OSL_ASSERT(false);
200 [ # # ]: 0 : aMergeBoxes.push_back(sal_False);
201 : : }
202 [ # # ]: 0 : SwBoxFrmFmts aBoxFmts;
203 [ # # ]: 0 : SwTableBoxFmt* pBoxFmt = pDoc->MakeTableBoxFmt();
204 : 0 : SvxFrameDirection eDir = FRMDIR_HORI_LEFT_TOP;
205 : 0 : bool bCantSplit = false;
206 : :
207 : 0 : int bWeiter = sal_True;
208 [ # # # # ]: 0 : do {
[ # # ]
209 [ # # # # : 0 : switch( nToken )
# # # # #
# # # # #
# # # # #
# # # # #
# # # # #
# # # #
# ]
210 : : {
211 : : case RTF_TRPADDFL:
212 : 0 : aRow.mbUseLeftRowPad = (nTokenValue == 3) ? true : false;
213 : 0 : break;
214 : : case RTF_TRPADDFT:
215 : 0 : aRow.mbUseTopRowPad = (nTokenValue == 3) ? true : false;
216 : 0 : break;
217 : : case RTF_TRPADDFR:
218 : 0 : aRow.mbUseRightRowPad = (nTokenValue == 3) ? true : false;
219 : 0 : break;
220 : : case RTF_TRPADDFB:
221 : 0 : aRow.mbUseBottomRowPad = (nTokenValue == 3) ? true : false;
222 : 0 : break;
223 : : case RTF_TRPADDL:
224 : 0 : aRow.mnLeftRowPad = nTokenValue;
225 : 0 : break;
226 : : case RTF_TRPADDT:
227 : 0 : aRow.mnTopRowPad = nTokenValue;
228 : 0 : break;
229 : : case RTF_TRPADDR:
230 : 0 : aRow.mnRightRowPad = nTokenValue;
231 : 0 : break;
232 : : case RTF_TRPADDB:
233 : 0 : aRow.mnBottomRowPad = nTokenValue;
234 : 0 : break;
235 : :
236 : : case RTF_CLPADFL:
237 : 0 : bUseLeftCellPad = (nTokenValue == 3) ? true : false;
238 : 0 : break;
239 : : case RTF_CLPADFT:
240 : 0 : bUseTopCellPad = (nTokenValue == 3) ? true : false;
241 : 0 : break;
242 : : case RTF_CLPADFR:
243 : 0 : bUseRightCellPad = (nTokenValue == 3) ? true : false;
244 : 0 : break;
245 : : case RTF_CLPADFB:
246 : 0 : bUseBottomCellPad = (nTokenValue == 3) ? true : false;
247 : 0 : break;
248 : : case RTF_CLPADL:
249 : 0 : nLeftCellPad = nTokenValue;
250 : 0 : break;
251 : : case RTF_CLPADT:
252 : 0 : nTopCellPad = nTokenValue;
253 : 0 : break;
254 : : case RTF_CLPADR:
255 : 0 : nRightCellPad = nTokenValue;
256 : 0 : break;
257 : : case RTF_CLPADB:
258 : 0 : nBottomCellPad = nTokenValue;
259 : 0 : break;
260 : :
261 : : case RTF_TRRH:
262 : 0 : nLineHeight = nTokenValue;
263 : 0 : break;
264 : :
265 : : case RTF_CLMRG:
266 : : // would crash later on reading \cellx (#i112657#):
267 : : // the first cell cannot be merged with earlier ones.
268 [ # # ]: 0 : if (aMergeBoxes.size() > 1)
269 : : {
270 [ # # ]: 0 : aMergeBoxes.back() = sal_True;
271 : : }
272 : 0 : break;
273 : :
274 : : case RTF_CELLX:
275 [ # # ][ # # ]: 0 : if (!bTrowdRead && (aMergeBoxes.size() < (SAL_MAX_UINT16 - 1)))
[ # # ]
276 : : {
277 : 0 : SwTableBoxFmt* pFmt = pBoxFmt;
278 : 0 : SwTwips nSize = nTokenValue - nTblSz;
279 [ # # ][ # # ]: 0 : if( aMergeBoxes.back() )
280 : : {
281 : : // neue Zellen lesen und noch keine Formate vorhanden,
282 : : // dann benutze das der vorhergebende
283 [ # # ][ # # ]: 0 : if( bReadNewCell && aBoxFmts.empty() )
[ # # ]
284 : : {
285 : 0 : SwTableLines& rLns = pTableNode->GetTable().GetTabLines();
286 [ # # ]: 0 : SwTableLine* pLine = rLns.back();
287 [ # # ]: 0 : if (m_nCurrentBox != 0)
288 : : {
289 : 0 : --m_nCurrentBox;
290 : : }
291 [ # # ]: 0 : if (m_nCurrentBox < pLine->GetTabBoxes().size())
292 : : {
293 : : pFmt = static_cast<SwTableBoxFmt*>(
294 : 0 : pLine->GetTabBoxes()[m_nCurrentBox]->GetFrmFmt());
295 : : }
296 : : }
297 : : else
298 [ # # ]: 0 : pFmt = aBoxFmts.back();
299 : :
300 : : // #i73790# - method renamed
301 [ # # ]: 0 : pBoxFmt->ResetAllFmtAttr();
302 : :
303 [ # # ]: 0 : nSize += pFmt->GetFrmSize().GetWidth();
304 : : }
305 : : else
306 : : {
307 : : //
308 [ # # ]: 0 : if (nSize<=2*aRow.mnBrdDist) {
309 : 0 : aRow.mnRightRowPad=0;
310 : 0 : aRow.mbUseRightRowPad=sal_True;
311 : : }
312 [ # # ]: 0 : SetRowBorder((SfxItemSet&)pBoxFmt->GetAttrSet(), aRow);
313 [ # # ]: 0 : aBoxFmts.push_back( pBoxFmt );
314 [ # # ]: 0 : pBoxFmt = pDoc->MakeTableBoxFmt();
315 : : }
316 : :
317 [ # # ]: 0 : if( !nSize )
318 : 0 : nSize = COL_DFLT_WIDTH;
319 [ # # ][ # # ]: 0 : pFmt->SetFmtAttr( SwFmtFrmSize( ATT_VAR_SIZE, nSize, 0 ));
[ # # ]
320 : 0 : nTblSz = nTokenValue;
321 [ # # ]: 0 : aMergeBoxes.push_back(sal_False);
322 : :
323 [ # # ][ # # ]: 0 : SvxBoxItem aBox(pFmt->GetBox());
324 : :
325 [ # # ]: 0 : if (bUseRightCellPad)
326 [ # # ]: 0 : aBox.SetDistance( static_cast< sal_uInt16 >(nRightCellPad), BOX_LINE_RIGHT);
327 [ # # ]: 0 : if (bUseBottomCellPad)
328 [ # # ]: 0 : aBox.SetDistance( static_cast< sal_uInt16 >(nBottomCellPad), BOX_LINE_BOTTOM);
329 : :
330 : : //Yes, these are the wrong way around, there appears to
331 : : //be a bug in word where these are swapped.
332 [ # # ]: 0 : if (bUseLeftCellPad)
333 [ # # ]: 0 : aBox.SetDistance( static_cast< sal_uInt16 >(nLeftCellPad), BOX_LINE_TOP);
334 [ # # ]: 0 : if (bUseTopCellPad)
335 [ # # ]: 0 : aBox.SetDistance( static_cast< sal_uInt16 >(nTopCellPad), BOX_LINE_LEFT);
336 : :
337 : :
338 [ # # ]: 0 : pFmt->SetFmtAttr(aBox);
339 : :
340 : 0 : bUseLeftCellPad = false;
341 : 0 : bUseRightCellPad = false;
342 : 0 : bUseTopCellPad = false;
343 [ # # ]: 0 : bUseBottomCellPad = false;
344 : : }
345 : 0 : break;
346 : :
347 : : case RTF_TRGAPH:
348 : : //bug: RTF: wrong internal table cell margin imported (A13)
349 [ # # ]: 0 : aRow.mnBrdDist = (nTokenValue>0?(sal_uInt16)nTokenValue:0); // filter out negative values of \trgaph
350 : 0 : break;
351 : :
352 : 0 : case RTF_TRQL: eAdjust = text::HoriOrientation::LEFT; break;
353 : 0 : case RTF_TRQR: eAdjust = text::HoriOrientation::RIGHT; break;
354 : 0 : case RTF_TRQC: eAdjust = text::HoriOrientation::CENTER; break;
355 : :
356 : : // mit text::VertOrientation::TOP kommt der Dialog nicht klar!
357 : 0 : case RTF_CLVERTALT: eVerOrient = text::VertOrientation::NONE; break;
358 : :
359 : 0 : case RTF_CLVERTALC: eVerOrient = text::VertOrientation::CENTER; break;
360 : 0 : case RTF_CLVERTALB: eVerOrient = text::VertOrientation::BOTTOM; break;
361 : :
362 : : case RTF_TRLEFT:
363 [ # # ]: 0 : if( text::HoriOrientation::LEFT == eAdjust )
364 : 0 : eAdjust = text::HoriOrientation::LEFT_AND_WIDTH;
365 : 0 : nLSpace = nTokenValue;
366 : 0 : nTblSz = nTokenValue;
367 : 0 : break;
368 : :
369 : : case RTF_TRHDR:
370 : 0 : nRowsToRepeat++;
371 : 0 : break;
372 : :
373 : : case RTF_CLTXLRTB:
374 : : case RTF_CLTXTBRL:
375 : : case RTF_INTBL: // das wissen wir !
376 : : case RTF_CLMGF:
377 : : case RTF_CLVMGF:
378 : : case RTF_CLVMRG:
379 : 0 : break;
380 : : case RTF_LTRROW:
381 : 0 : eDir = FRMDIR_HORI_LEFT_TOP;
382 : 0 : break;
383 : : case RTF_RTLROW:
384 : 0 : eDir = FRMDIR_HORI_RIGHT_TOP;
385 : 0 : break;
386 : : case RTF_TRBRDRB:
387 : : case RTF_TRBRDRH:
388 : : case RTF_TRBRDRL:
389 : : case RTF_TRBRDRR:
390 : : case RTF_TRBRDRT:
391 : : case RTF_TRBRDRV:
392 : 0 : break;
393 : : case RTF_TRKEEP:
394 : 0 : bCantSplit = true;
395 : 0 : break;
396 : :
397 : : default:
398 [ # # ]: 0 : if( ( nToken & ~(0xff | RTF_TABLEDEF)) == RTF_SHADINGDEF )
399 : : {
400 [ # # ][ # # ]: 0 : if( aMergeBoxes.back() )
401 : 0 : break;
402 : : ReadBackgroundAttr( nToken,
403 [ # # ]: 0 : (SfxItemSet&)pBoxFmt->GetAttrSet(), sal_True );
404 : : }
405 [ # # # # ]: 0 : else if( ( nToken & ~(0xff | RTF_TABLEDEF) ) == RTF_BRDRDEF ||
[ # # ]
406 : 0 : IsBorderToken(nToken))
407 : : {
408 [ # # ][ # # ]: 0 : if( aMergeBoxes.back() )
409 : 0 : break;
410 : :
411 : 0 : SfxItemSet& rSet = (SfxItemSet&)pBoxFmt->GetAttrSet();
412 [ # # ]: 0 : if(!IsBorderToken( nToken ))
413 [ # # ]: 0 : ReadBorderAttr( nToken, rSet, sal_True );
414 : : else
415 [ # # ]: 0 : NextToken( nToken );
416 : : }
417 [ # # ]: 0 : else if( RTF_TABLEDEF != (nToken & ~(0xff | RTF_SWGDEFS)) )
418 : : {
419 [ # # ]: 0 : if( RTF_UNKNOWNCONTROL == nToken )
420 [ # # ]: 0 : NextToken( nToken );
421 : : else
422 : 0 : bWeiter = sal_False;
423 : : }
424 : 0 : break;
425 : : }
426 : :
427 [ # # ]: 0 : if( text::VertOrientation::NONE != eVerOrient )
428 : : {
429 [ # # ][ # # ]: 0 : if( !aMergeBoxes.back() )
430 [ # # ][ # # ]: 0 : pBoxFmt->SetFmtAttr( SwFmtVertOrient( 0, eVerOrient ));
[ # # ]
431 : 0 : eVerOrient = text::VertOrientation::NONE;
432 : : }
433 [ # # ]: 0 : if( bWeiter )
434 [ # # ]: 0 : nToken = GetNextToken();
435 : 0 : } while( bWeiter && IsParserWorking() );
436 : :
437 : : // das letzte temp. BoxFmt loeschen
438 [ # # ][ # # ]: 0 : delete pBoxFmt;
439 : :
440 : : // It has been recognized as not single box
441 [ # # ][ # # ]: 0 : if( m_nCurrentBox == aMergeBoxes.size()-1 || ( bReadNewCell && !pTableNode ))
[ # # ][ # # ]
442 : : {
443 [ # # ]: 0 : aMergeBoxes.insert(aMergeBoxes.begin(), aMergeBackup.begin(), aMergeBackup.end());
444 : : return;
445 : : }
446 : :
447 : 0 : nTblSz -= nLSpace;
448 : :
449 : 0 : int bNewTbl = sal_True;
450 : : SwTableLine* pNewLine;
451 : 0 : bTrowdRead=true;
452 : :
453 : : // lege eine neue Tabelle an oder erweiter die aktuelle um eine neue Line
454 : : // oder Box !
455 : : SwNode* pNd;
456 : :
457 [ # # ]: 0 : if( bChkExistTbl )
458 : : {
459 : : // es ist eine Tabelle vorhanden, teste mal ob die weiter benutzt
460 : : // werden kann oder ob sie abgesplittet und neu gefuellt werden
461 : : // muss.
462 [ # # ]: 0 : pTableNode = pPam->GetNode()->FindTableNode();
463 : :
464 : : // Cursor kann nur in der letzten Line stehen
465 : :
466 : : // das Attribut darf nicht ueber das Modify an der
467 : : // Tabelle gesetzt werden, denn sonst werden alle
468 : : // Boxen wieder auf 0 zurueck gesetzt !!!!!
469 : 0 : SwFrmFmt* pFmt = pTableNode->GetTable().GetFrmFmt();
470 [ # # ]: 0 : const SwFmtFrmSize& rTblSz = pFmt->GetFrmSize();
471 [ # # ]: 0 : const SwFmtHoriOrient& rHoriz = pFmt->GetHoriOrient();
472 : :
473 : 0 : const SwTableLines* pLns = &pTableNode->GetTable().GetTabLines();
474 : :
475 [ # # ]: 0 : if( 1 == pLns->size() )
476 : : {
477 [ # # ]: 0 : if( eAdjust != rHoriz.GetHoriOrient() )
478 : : {
479 : 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put( SwFmtHoriOrient( 0,
480 [ # # # # ]: 0 : eAdjust ) );
[ # # ]
481 : : }
482 [ # # ]: 0 : if( rTblSz.GetWidth() != nTblSz )
483 : : {
484 [ # # ]: 0 : SwFmtFrmSize aSz( rTblSz );
485 : 0 : aSz.SetWidth( nTblSz );
486 [ # # ][ # # ]: 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put( aSz );
487 : : }
488 : :
489 [ # # # # ]: 0 : if( text::HoriOrientation::LEFT_AND_WIDTH == eAdjust &&
[ # # ]
490 [ # # ]: 0 : nLSpace != pFmt->GetLRSpace().GetLeft() )
491 : : {
492 [ # # ]: 0 : SvxLRSpaceItem aL( RES_LR_SPACE ); aL.SetLeft( nLSpace );
493 [ # # ][ # # ]: 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put( aL );
494 : : }
495 : : }
496 [ # # # # : 0 : else if
# # ][ # # ]
[ # # # #
# # ]
497 : : (
498 : 0 : 1 < pLns->size() &&
499 : : (
500 : 0 : rTblSz.GetWidth() != nTblSz ||
501 : 0 : rHoriz.GetHoriOrient() != eAdjust ||
502 : : (
503 : : text::HoriOrientation::LEFT_AND_WIDTH == eAdjust &&
504 [ # # ]: 0 : nLSpace != pFmt->GetLRSpace().GetLeft()
505 : : ) ||
506 : 0 : pTableNode->GetTable().GetTabSortBoxes().size() >= eMAXCELLS
507 : : )
508 : : )
509 : : {
510 : : // Tabelle ab der PaM-Position splitten
511 : : // die vorherige Line!
512 : 0 : pNewLine = (*pLns)[ pLns->size() - 2 ];
513 [ # # ]: 0 : SwTableBox* pBox = pNewLine->GetTabBoxes().front();
514 [ # # ]: 0 : while( ( pLns = &pBox->GetTabLines() )->size() )
515 [ # # ][ # # ]: 0 : pBox = pLns->front()->GetTabBoxes().front();
516 : :
517 [ # # ]: 0 : SwNodeIndex aTmpIdx( *pBox->GetSttNd() );
518 [ # # ][ # # ]: 0 : pDoc->GetNodes().SplitTable( aTmpIdx, HEADLINE_NONE, sal_False );
519 [ # # ]: 0 : pTableNode = pPam->GetNode()->FindTableNode();
520 : 0 : pFmt = pTableNode->GetTable().GetFrmFmt();
521 : :
522 [ # # ]: 0 : SwFmtFrmSize aSz( rTblSz );
523 : 0 : aSz.SetWidth( nTblSz );
524 [ # # ]: 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put( aSz );
525 : 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put( SwFmtHoriOrient( 0,
526 [ # # # # ]: 0 : eAdjust ) );
[ # # ]
527 [ # # ][ # # ]: 0 : if( text::HoriOrientation::LEFT_AND_WIDTH == eAdjust && nLSpace )
528 : : {
529 [ # # ]: 0 : SvxLRSpaceItem aL( RES_LR_SPACE ); aL.SetLeft( nLSpace );
530 [ # # ][ # # ]: 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put( aL );
531 [ # # ][ # # ]: 0 : }
532 : : }
533 : :
534 : 0 : pLns = &pTableNode->GetTable().GetTabLines();
535 [ # # ]: 0 : pNewLine = pLns->back();
536 : :
537 : : // jetzt die Boxen abgleichen
538 : 0 : sal_uInt16 nBoxes = Min( pNewLine->GetTabBoxes().size(), aBoxFmts.size() );
539 : : sal_uInt16 n;
540 : :
541 [ # # ]: 0 : for( n = 0; n < nBoxes; ++n )
542 : : {
543 : 0 : SwTableBox* pBox = pNewLine->GetTabBoxes()[ n ];
544 [ # # ][ # # ]: 0 : *pBox->GetFrmFmt() = *aBoxFmts[ n ];
545 [ # # ][ # # ]: 0 : delete aBoxFmts[ n ];
[ # # ]
546 : : }
547 [ # # ][ # # ]: 0 : aBoxFmts.erase( aBoxFmts.begin(), aBoxFmts.begin() + n );
548 : :
549 [ # # ]: 0 : if( !aBoxFmts.empty() ) // es muessen noch neue zugefuegt werden
550 : : {
551 : 0 : m_nCurrentBox = n;
552 : : }
553 : : else // es mussen noch Boxen geloescht werden
554 : : {
555 : : // remove ContentIndex of other Bound
556 [ # # ][ # # ]: 0 : pPam->SetMark(); pPam->DeleteMark();
557 [ # # ]: 0 : while( n < pNewLine->GetTabBoxes().size() )
558 : 0 : _DeleteBox( pTableNode->GetTable(),
559 [ # # ]: 0 : pNewLine->GetTabBoxes()[ n ], 0, sal_False, sal_False );
560 : : }
561 : :
562 : 0 : pOldTblNd = pTableNode;
563 : 0 : bNewTbl = sal_False;
564 : : }
565 : : else
566 : : {
567 [ # # # # ]: 0 : if( !bReadNewCell && ( pNd = pDoc->GetNodes()[
[ # # # # ]
[ # # ]
568 : 0 : pPam->GetPoint()->nNode.GetIndex()-1 ])->IsEndNode() )
569 : : {
570 : 0 : pTableNode = pNd->StartOfSectionNode()->GetTableNode();
571 [ # # ]: 0 : if( pTableNode )
572 : : {
573 : : // dann test mal ob wirklich nur eine neue Line eingefuegt
574 : : // werden soll!
575 : 0 : SwTable &rTable = pTableNode->GetTable();
576 : 0 : SwFrmFmt* pFmt = rTable.GetFrmFmt();
577 [ # # ]: 0 : const SwFmtFrmSize& rTblSz = pFmt->GetFrmSize();
578 [ # # ]: 0 : const SwFmtHoriOrient& rHoriz = pFmt->GetHoriOrient();
579 [ # # ][ # # : 0 : if (
# # # # ]
580 : 0 : rTblSz.GetWidth() != nTblSz ||
581 : 0 : rHoriz.GetHoriOrient() != eAdjust ||
582 : 0 : rTable.GetTabSortBoxes().size() >= eMAXCELLS
583 : : )
584 : : {
585 : 0 : pTableNode = 0;
586 : : }
587 : : }
588 : : }
589 : :
590 [ # # ][ # # ]: 0 : if( pTableNode && !bForceNewTable)
591 : : {
592 : :
593 : : // das Attribut darf nicht ueber das Modify an der
594 : : // Tabelle gesetzt werden, denn sonst werden alle
595 : : // Boxen wieder auf 0 zurueck gesetzt !!!!!
596 : 0 : SwFrmFmt* pFmt = pTableNode->GetTable().GetFrmFmt();
597 [ # # ]: 0 : const SwFmtFrmSize& rTblSz = pFmt->GetFrmSize();
598 [ # # ]: 0 : if( rTblSz.GetWidth() < nTblSz )
599 : : {
600 [ # # ]: 0 : SwFmtFrmSize aSz( rTblSz );
601 : 0 : aSz.SetWidth( nTblSz );
602 [ # # ][ # # ]: 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put( aSz );
603 : : }
604 : :
605 : 0 : SwTableLines& rLns = pTableNode->GetTable().GetTabLines();
606 : :
607 [ # # ]: 0 : if( bReadNewCell )
608 [ # # ]: 0 : pNewLine = rLns.back();
609 : : else
610 : : {
611 : : pNewLine = new SwTableLine(
612 [ # # ]: 0 : (SwTableLineFmt*)rLns.back()->GetFrmFmt(),
613 [ # # ][ # # ]: 0 : aBoxFmts.size(), 0 );
614 [ # # ]: 0 : pNewLine->ClaimFrmFmt();
615 [ # # ]: 0 : pNewLine->GetFrmFmt()->ResetFmtAttr( RES_FRM_SIZE );
616 [ # # ]: 0 : rLns.push_back( pNewLine );
617 : : }
618 : 0 : bNewTbl = sal_False;
619 : : }
620 : : else
621 : : {
622 : 0 : bForceNewTable = false;
623 : : const SwTable *pTable =
624 : : pDoc->InsertTable(
625 : : SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 0 ),
626 [ # # ]: 0 : *pPam->GetPoint(), 1, 1, eAdjust, 0, 0, sal_False, sal_False );
627 : 0 : bContainsTablePara=true;
628 [ # # ][ # # ]: 0 : pTableNode = pTable ? pTable->GetTableNode() : 0;
629 : :
630 [ # # ]: 0 : if (pTableNode)
631 : : {
632 : 0 : maSegments.PrependedInlineNode(*pPam->GetPoint(),
633 [ # # ]: 0 : *pTableNode);
634 : : }
635 : : else
636 : : {
637 [ # # ]: 0 : SkipToken( -1 ); // zum Letzen gueltigen zurueck
638 : : return;
639 : : }
640 : :
641 : 0 : SwTableLines& rLns = pTableNode->GetTable().GetTabLines();
642 [ # # ]: 0 : pNewLine = rLns.back();
643 : :
644 : 0 : SwFrmFmt* pFmt = pTableNode->GetTable().GetFrmFmt();
645 [ # # ][ # # ]: 0 : SwFmtFrmSize aSz( pFmt->GetFrmSize() );
646 : 0 : aSz.SetWidth( nTblSz );
647 [ # # ]: 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put( aSz );
648 [ # # ][ # # ]: 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put(SvxFrameDirectionItem(eDir, RES_FRAMEDIR));
[ # # ]
649 : :
650 [ # # ][ # # ]: 0 : if( text::HoriOrientation::LEFT_AND_WIDTH == eAdjust && nLSpace )
651 : : {
652 [ # # ]: 0 : SvxLRSpaceItem aL( RES_LR_SPACE ); aL.SetLeft( nLSpace );
653 [ # # ][ # # ]: 0 : ((SfxItemSet&)pFmt->GetAttrSet()).Put( aL );
654 : : }
655 : :
656 : 0 : m_nCurrentBox = 0;
657 [ # # ]: 0 : pOldTblNd = pTableNode;
658 : : }
659 : : }
660 : :
661 [ # # ]: 0 : if( nLineHeight )
662 : : {
663 : : SwFrmSize eSize;
664 [ # # ]: 0 : if( 0 > nLineHeight )
665 : 0 : eSize = ATT_FIX_SIZE, nLineHeight = -nLineHeight;
666 : : else
667 : 0 : eSize = ATT_MIN_SIZE;
668 [ # # ][ # # ]: 0 : pNewLine->ClaimFrmFmt()->SetFmtAttr(SwFmtFrmSize(eSize, 0, nLineHeight));
[ # # ][ # # ]
669 : : }
670 : :
671 [ # # ][ # # ]: 0 : pNewLine->ClaimFrmFmt()->SetFmtAttr(SwFmtRowSplit(!bCantSplit));
[ # # ][ # # ]
672 : :
673 [ # # ]: 0 : if( !aBoxFmts.empty() )
674 : : {
675 : : // setze das default Style
676 : 0 : SwTxtFmtColl* pColl = NULL;
677 [ # # ]: 0 : std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find(0);
678 : :
679 [ # # ][ # # ]: 0 : if( iter == aTxtCollTbl.end() )
680 [ # # ]: 0 : pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
681 : : else
682 [ # # ]: 0 : pColl = iter->second;
683 : :
684 : 0 : sal_uInt16 nStt = 0;
685 [ # # ]: 0 : if( bNewTbl )
686 : : {
687 : 0 : SwTableBox* pBox = pNewLine->GetTabBoxes()[0];
688 : 0 : pBoxFmt = (SwTableBoxFmt*)pBox->GetFrmFmt();
689 [ # # ]: 0 : pBox->ForgetFrmFmt();
690 [ # # ][ # # ]: 0 : delete pBoxFmt;
691 [ # # ][ # # ]: 0 : pBox->RegisterToFormat( *aBoxFmts[0] );
692 [ # # ][ # # ]: 0 : SwTxtNode* pTNd = pDoc->GetNodes()[ pBox->GetSttIdx()+1 ]
693 [ # # ]: 0 : ->GetTxtNode();
694 : : OSL_ENSURE( pTNd, "wo ist der Textnode dieser Box?" );
695 [ # # ]: 0 : pTNd->ChgFmtColl( pColl );
696 : 0 : ++nStt;
697 : 0 : nRowsToRepeat=0;
698 : : }
699 : :
700 [ # # ]: 0 : for( ; nStt < aBoxFmts.size(); ++nStt )
701 : : {
702 [ # # ]: 0 : pDoc->GetNodes().InsBoxen( pTableNode, pNewLine,
703 [ # # ]: 0 : aBoxFmts[ nStt ],
704 : : // Formate fuer den TextNode der Box
705 : : pColl, 0,
706 [ # # ]: 0 : m_nCurrentBox + nStt, 1 );
707 : : }
708 : : }
709 : :
710 [ # # ]: 0 : if( bChkExistTbl )
711 : : {
712 : 0 : m_nCurrentBox = 0;
713 : : }
714 : :
715 [ # # ]: 0 : maInsertedTables.InsertTable(*pTableNode, *pPam);
716 : :
717 [ # # ]: 0 : SwNodeIndex aOldIdx(pPam->GetPoint()->nNode);
718 [ # # ]: 0 : SwNodeIdx aOldPos(aOldIdx);
719 [ # # ]: 0 : SwPaM aRg(*pPam);
720 : :
721 : 0 : bool bFailure = true;
722 [ # # ]: 0 : if (pNewLine)
723 : : {
724 : 0 : SwTableBoxes &rBoxes = pNewLine->GetTabBoxes();
725 [ # # ]: 0 : if (SwTableBox* pBox = ((m_nCurrentBox < rBoxes.size())
726 [ # # ]: 0 : ? rBoxes[m_nCurrentBox] : 0))
727 : : {
728 [ # # ]: 0 : if (const SwStartNode *pStart = pBox->GetSttNd())
729 : : {
730 [ # # ]: 0 : if (const SwEndNode *pEnd = pStart->EndOfSectionNode())
731 : : {
732 [ # # ]: 0 : pPam->GetPoint()->nNode = *pEnd;
733 [ # # ]: 0 : pPam->Move( fnMoveBackward, fnGoCntnt );
734 : 0 : bFailure = false;
735 : : }
736 : : }
737 : : }
738 : : }
739 : :
740 : : OSL_ENSURE(!bFailure, "RTF Table failure");
741 [ # # ]: 0 : if (bFailure)
742 : : {
743 [ # # ]: 0 : SkipToken( -1 ); // zum Letzen gueltigen zurueck
744 : : return;
745 : : }
746 : :
747 : : //It might be that there was content at this point which is not already in
748 : : //a table, but which is being followed by properties to place it into the
749 : : //table. If this is the case then move the para/char
750 : : //properties inside the table, and move any content of that paragraph into
751 : : //the table
752 [ # # ]: 0 : bool bInTable = aRg.GetPoint()->nNode.GetNode().FindTableNode();
753 [ # # ]: 0 : if (!bInTable)
754 : : {
755 [ # # ]: 0 : SwNodeIndex aNewIdx(pPam->GetPoint()->nNode);
756 [ # # ]: 0 : SwNodeIdx aNewPos(aNewIdx);
757 : :
758 [ # # ]: 0 : if (aRg.GetPoint()->nContent.GetIndex())
759 : : {
760 : : //If there is content in this node then move it entirely inside the
761 : : //table
762 [ # # ]: 0 : aRg.SetMark();
763 [ # # ][ # # ]: 0 : aRg.GetMark()->nContent.Assign(aRg.GetCntntNode(), 0);
764 : 0 : pDoc->MoveRange(aRg, *pPam->GetPoint(),
765 [ # # ]: 0 : IDocumentContentOperations::DOC_MOVEDEFAULT);
766 : : }
767 : :
768 : : //Update the attribute stack entries to reflect that the properties
769 : : //which were intended to be inside the tablerow are now left outside
770 : : //the table after the row was placed before the current insertion point
771 : 0 : SvxRTFItemStack& rAttrStk = GetAttrStack();
772 [ # # ]: 0 : for (size_t n = 0; n < rAttrStk.size(); ++n)
773 : : {
774 [ # # ]: 0 : SvxRTFItemStackType* pStk = rAttrStk[n];
775 [ # # ]: 0 : pStk->MoveFullNode(aOldPos, aNewPos);
776 [ # # ][ # # ]: 0 : }
777 : : }
778 [ # # ][ # # ]: 0 : SkipToken( -1 ); // zum Letzen gueltigen zurueck
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
779 : : }
780 : :
781 : : // in die naechste Box dieser Line (opt.: falls es nicht die letzte ist)
782 : 0 : void SwRTFParser::GotoNextBox()
783 : : {
784 : 0 : nInsTblRow = USHRT_MAX;
785 : :
786 : : OSL_ENSURE( pTableNode, "Kein Tabellennode, dann auch keine Box" );
787 : :
788 [ # # ]: 0 : if (!pTableNode)
789 : 0 : return;
790 : :
791 : 0 : SwTableLines& rLns = pTableNode->GetTable().GetTabLines();
792 : 0 : SwTableLine* pLine = rLns.back();
793 : 0 : SwTableBoxes& rBoxes = pLine->GetTabBoxes();
794 : 0 : SwTableBox* pBox = rBoxes.back();
795 : :
796 [ # # ]: 0 : if( ++m_nCurrentBox >= aMergeBoxes.size() )
797 : 0 : m_nCurrentBox = aMergeBoxes.size()-1;
798 : :
799 [ # # ]: 0 : if (!aMergeBoxes[ m_nCurrentBox ])
800 : : {
801 : 0 : int bMove = sal_True;
802 [ # # ]: 0 : if( pBox->GetSttIdx() > pPam->GetPoint()->nNode.GetIndex() )
803 : : {
804 : 0 : sal_uInt16 nRealBox = 0;
805 [ # # ]: 0 : for (sal_uInt16 nTmp = 0; nTmp < m_nCurrentBox; ++nTmp)
806 [ # # ]: 0 : if( !aMergeBoxes[ nTmp ] )
807 : 0 : ++nRealBox;
808 : :
809 [ # # ]: 0 : if( nRealBox < rBoxes.size() )
810 : : {
811 : 0 : pPam->GetPoint()->nNode = *rBoxes[ nRealBox ]->GetSttNd()->EndOfSectionNode();
812 : 0 : pPam->Move( fnMoveBackward, fnGoCntnt );
813 : 0 : bMove = sal_False;
814 : : }
815 : : }
816 : :
817 [ # # ][ # # ]: 0 : if( bMove && m_nCurrentBox + 1U == aMergeBoxes.size() )
[ # # ]
818 : : // dann hinter die Tabelle
819 : 0 : pPam->Move( fnMoveForward, fnGoNode );
820 : : }
821 [ # # ]: 0 : else if (pPam->GetPoint()->nNode.GetNode().IsCntntNode())
822 : : // dann in die vorherige ans Ende
823 : 0 : pPam->Move( fnMoveBackward, fnGoCntnt );
824 : : }
825 : :
826 : :
827 : 0 : void SwRTFParser::NewTblLine()
828 : : {
829 : 0 : nInsTblRow = USHRT_MAX;
830 : :
831 : : // erweiter die aktuelle um eine neue Line
832 : 0 : sal_Bool bMakeCopy = sal_False;
833 : 0 : SwNode* pNd = pDoc->GetNodes()[ pPam->GetPoint()->nNode.GetIndex()-1 ];
834 [ # # ][ # # ]: 0 : if( !pNd->IsEndNode() ||
[ # # ]
835 : 0 : !(pNd = pNd->StartOfSectionNode())->IsTableNode() )
836 : : {
837 [ # # ]: 0 : if( !pOldTblNd )
838 : 0 : return ;
839 : :
840 : 0 : bMakeCopy = sal_True;
841 : 0 : pNd = pOldTblNd;
842 : : }
843 : 0 : pTableNode = (SwTableNode*)pNd;
844 : :
845 : 0 : SwTableLines* pLns = &pTableNode->GetTable().GetTabLines();
846 : 0 : SwTableLine* pLine = pLns->back();
847 : 0 : SwTableBoxes& rBoxes = pLine->GetTabBoxes();
848 : 0 : SwTableBox* pBox = rBoxes.back();
849 : :
850 [ # # ]: 0 : if(nRowsToRepeat>0)
851 : 0 : pTableNode->GetTable().SetRowsToRepeat( nRowsToRepeat );
852 : :
853 [ # # # # ]: 0 : if( !bMakeCopy &&
[ # # ]
854 : 0 : 64000 < pTableNode->GetTable().GetTabSortBoxes().size() )
855 : : {
856 : 0 : bMakeCopy = sal_True; // spaetestens jetzt eine neue anfangen!
857 : : }
858 : :
859 [ # # ]: 0 : if( bMakeCopy )
860 : : {
861 : : // und die Selektion kopieren
862 [ # # ]: 0 : SwSelBoxes aBoxes;
863 [ # # ]: 0 : pTableNode->GetTable().SelLineFromBox( pBox, aBoxes );
864 : 0 : pTableNode->GetTable().MakeCopy( pDoc, *pPam->GetPoint(),
865 [ # # ]: 0 : aBoxes, sal_False );
866 : 0 : sal_uLong nNd = pPam->GetPoint()->nNode.GetIndex()-1;
867 [ # # ][ # # ]: 0 : pTableNode = pDoc->GetNodes()[ nNd ]->FindTableNode();
[ # # ]
868 : 0 : pOldTblNd = pTableNode;
869 : :
870 : 0 : nRowsToRepeat=0;
871 : 0 : pTableNode->GetTable().SetRowsToRepeat(nRowsToRepeat);
872 : 0 : pLns = &pTableNode->GetTable().GetTabLines();
873 : : }
874 : : else
875 : 0 : pTableNode->GetTable().AppendRow( pDoc );
876 : :
877 : 0 : pBox = pLns->back()->GetTabBoxes().front();
878 : :
879 : 0 : sal_uLong nOldPos = pPam->GetPoint()->nNode.GetIndex();
880 : 0 : pPam->GetPoint()->nNode = *pBox->GetSttNd();
881 : 0 : pPam->Move( fnMoveForward );
882 : 0 : m_nCurrentBox = 0;
883 : :
884 : : // alle Nodes in den Boxen auf die "default" Vorlage setzten
885 : : {
886 : 0 : SwTxtFmtColl* pColl = NULL;
887 [ # # ]: 0 : std::map<sal_Int32,SwTxtFmtColl*>::iterator iter = aTxtCollTbl.find( 0 );
888 : :
889 [ # # ][ # # ]: 0 : if( iter == aTxtCollTbl.end() )
890 [ # # ]: 0 : pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false );
891 : : else
892 [ # # ]: 0 : pColl = iter->second;
893 : :
894 [ # # ]: 0 : pPam->SetMark();
895 : :
896 [ # # ]: 0 : pLine = pLns->back();
897 [ # # ]: 0 : pBox = pLine->GetTabBoxes().back();
898 [ # # ]: 0 : pPam->GetPoint()->nNode = *pBox->GetSttNd()->EndOfSectionNode();
899 [ # # ]: 0 : pPam->Move( fnMoveBackward );
900 [ # # ]: 0 : pDoc->SetTxtFmtColl( *pPam, pColl );
901 : : // Bug 73940 - remove ALL attributes (NumRules/Break/etc.)
902 : : {
903 [ # # ]: 0 : SwNodeIndex aIdx( pPam->GetMark()->nNode );
904 : 0 : SwNodeIndex& rEndIdx = pPam->GetPoint()->nNode;
905 [ # # ]: 0 : while( aIdx <= rEndIdx )
906 : : {
907 : 0 : SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
908 [ # # ][ # # ]: 0 : if( pCNd && pCNd->HasSwAttrSet() )
[ # # ][ # # ]
909 [ # # ]: 0 : pCNd->ResetAllAttr();
910 [ # # ]: 0 : aIdx++;
911 [ # # ]: 0 : }
912 : : }
913 : 0 : pPam->Exchange();
914 [ # # ]: 0 : pPam->DeleteMark();
915 : : }
916 : :
917 : : // all attributes which will be displayed in new Box
918 : 0 : SvxRTFItemStack& rAttrStk = GetAttrStack();
919 : : const SvxRTFItemStackType* pStk;
920 [ # # ]: 0 : for( size_t n = 0; n < rAttrStk.size(); ++n )
921 [ # # # # ]: 0 : if( ( pStk = rAttrStk[ n ])->GetSttNodeIdx() == sal_uLong(nOldPos) &&
[ # # ]
922 : 0 : !pStk->GetSttCnt() )
923 [ # # ]: 0 : ((SvxRTFItemStackType*)pStk)->SetStartPos( SwxPosition( pPam ) );
924 : : }
925 : :
926 : 0 : void SwRTFParser::CheckInsNewTblLine()
927 : : {
928 [ # # ]: 0 : if( USHRT_MAX != nInsTblRow )
929 : : {
930 [ # # ][ # # ]: 0 : if( nInsTblRow > GetOpenBrakets() || IsPardTokenRead() )
[ # # ]
931 : 0 : nInsTblRow = USHRT_MAX;
932 [ # # ]: 0 : else if( !pTableNode ) // Tabelle nicht mehr vorhanden ?
933 : 0 : NewTblLine(); // evt. Line copieren
934 : : }
935 : 0 : }
936 : :
937 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|