Lines 2-10
Link Here
|
2 |
* |
2 |
* |
3 |
* $RCSfile: rtffly.cxx,v $ |
3 |
* $RCSfile: rtffly.cxx,v $ |
4 |
* |
4 |
* |
5 |
* $Revision: 1.13 $ |
5 |
* $Revision: 1.12.120.4 $ |
6 |
* |
6 |
* |
7 |
* last change: $Author: obo $ $Date: 2004/01/13 16:49:58 $ |
7 |
* last change: $Author: cmc $ $Date: 2004/01/23 15:10:30 $ |
8 |
* |
8 |
* |
9 |
* The Contents of this file are made available subject to the terms of |
9 |
* The Contents of this file are made available subject to the terms of |
10 |
* either of the following licenses |
10 |
* either of the following licenses |
Lines 172-186
Link Here
|
172 |
#ifndef _FLTINI_HXX |
172 |
#ifndef _FLTINI_HXX |
173 |
#include <fltini.hxx> |
173 |
#include <fltini.hxx> |
174 |
#endif |
174 |
#endif |
175 |
#ifndef __SGI_STL_DEQUE |
175 |
#ifndef _TBLSEL_HXX |
176 |
#include <deque> |
176 |
#include <tblsel.hxx> |
177 |
#endif |
177 |
#endif |
178 |
#ifndef __SGI_STL_MAP |
178 |
#include <swcrsr.hxx> |
|
|
179 |
|
180 |
#include <deque> |
179 |
#include <map> |
181 |
#include <map> |
180 |
#endif |
|
|
181 |
#ifndef __SGI_STL_UTILITY |
182 |
#include <utility> |
182 |
#include <utility> |
183 |
#endif |
183 |
#include <stack> |
184 |
|
184 |
|
185 |
#define ANCHOR(p) ((SwFmtAnchor*)p) |
185 |
#define ANCHOR(p) ((SwFmtAnchor*)p) |
186 |
|
186 |
|
Lines 190-202
Link Here
|
190 |
SV_IMPL_PTRARR( SwFlySaveArr, SwFlySave* ) |
190 |
SV_IMPL_PTRARR( SwFlySaveArr, SwFlySave* ) |
191 |
|
191 |
|
192 |
inline const SwFmtFrmSize GetFrmSize(const SfxItemSet& rSet, BOOL bInP=TRUE) |
192 |
inline const SwFmtFrmSize GetFrmSize(const SfxItemSet& rSet, BOOL bInP=TRUE) |
193 |
{ |
193 |
{ return (const SwFmtFrmSize&)rSet.Get( RES_FRM_SIZE,bInP); } |
194 |
return (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE,bInP); |
194 |
|
|
|
195 |
|
196 |
rtfFrame::rtfFrame(const SwPaM &rPaM) |
197 |
: mnSttNd(rPaM.GetPoint()->nNode), mnEndNd(mnSttNd), |
198 |
mnSttCnt(rPaM.GetPoint()->nContent.GetIndex()), mnEndCnt(mnSttCnt) |
199 |
{ |
200 |
} |
201 |
|
202 |
void rtfFrame::setend(const SwPaM &rPaM, const APOProperties &rApoProps) |
203 |
{ |
204 |
maApoProps = rApoProps; |
205 |
mnEndNd = rPaM.GetPoint()->nNode; |
206 |
mnEndCnt = rPaM.GetPoint()->nContent.GetIndex(); |
207 |
} |
208 |
|
209 |
void rtfFrame::ConvertToItemSet(SfxItemSet &rSet) const |
210 |
{ |
211 |
/* |
212 |
A positive number indicates the minimum height of the frame and a negative |
213 |
number indicates the exact height of the frame. |
214 |
*/ |
215 |
SwTwips nHeight = maApoProps.absh; |
216 |
SwFrmSize eSize = maApoProps.absh < 0 ? ATT_FIX_SIZE : ATT_MIN_SIZE; |
217 |
if (eSize == ATT_FIX_SIZE) |
218 |
nHeight = -nHeight; |
219 |
|
220 |
/* |
221 |
A value of zero indicates that the height of the frame adjusts to the |
222 |
contents of the frame. This is the default for frames where no height is |
223 |
given. |
224 |
*/ |
225 |
if (nHeight < MINFLY) |
226 |
nHeight = MINFLY; |
227 |
rSet.Put(SwFmtFrmSize(eSize, maApoProps.absw, nHeight)); |
228 |
|
229 |
SwRelationOrient eHoriRel; |
230 |
switch (maApoProps.eHoriRel) |
231 |
{ |
232 |
case phmrg: |
233 |
//Use the margin as the horizontal reference frame. |
234 |
eHoriRel = REL_PG_PRTAREA; |
235 |
break; |
236 |
case phpg: |
237 |
//Use the page as the horizontal reference frame. |
238 |
eHoriRel = REL_PG_FRAME; |
239 |
break; |
240 |
//Use the column as the horizontal reference frame, This is the |
241 |
//default if no horizontal reference frame is given. |
242 |
case phcol: |
243 |
default: |
244 |
eHoriRel = PRTAREA; |
245 |
break; |
246 |
} |
247 |
|
248 |
SwHoriOrient eHoriOri; |
249 |
switch (maApoProps.eHoriOri) |
250 |
{ |
251 |
case posxnone: |
252 |
eHoriOri = HORI_NONE; |
253 |
break; |
254 |
case posxc: |
255 |
//Centers the frame horizontally within the reference frame. |
256 |
eHoriOri = HORI_CENTER; |
257 |
break; |
258 |
case posxi: |
259 |
//Positions the paragraph horizontally inside the reference frame. |
260 |
eHoriOri = HORI_LEFT; |
261 |
break; |
262 |
case posxo: |
263 |
//Positions the paragraph horizontally outside the reference frame. |
264 |
eHoriOri = HORI_RIGHT; |
265 |
break; |
266 |
case posxr: |
267 |
//Positions the paragraph to the right within the reference frame. |
268 |
eHoriOri = HORI_RIGHT; |
269 |
break; |
270 |
case posxl: |
271 |
default: |
272 |
//Positions the paragraph to the left within the reference frame. |
273 |
//This is the default if no horizontal positioning information is |
274 |
//given. |
275 |
eHoriOri = HORI_LEFT; |
276 |
break; |
277 |
} |
278 |
|
279 |
using namespace sw::util; |
280 |
rSet.Put(SwFmtHoriOrient(MakeSafePositioningValue(maApoProps.posx), |
281 |
eHoriOri, eHoriRel)); |
282 |
|
283 |
SwRelationOrient eVertRel; |
284 |
switch (maApoProps.eVertRel) |
285 |
{ |
286 |
case pvmrg: |
287 |
default: |
288 |
//Positions the reference frame vertically relative to the margin. |
289 |
//This is the default if no vertical frame positioning information |
290 |
//is given. |
291 |
eVertRel = REL_PG_PRTAREA; |
292 |
break; |
293 |
case pvpg: |
294 |
//Positions the reference frame vertically relative to the page. |
295 |
eVertRel = REL_PG_FRAME; |
296 |
break; |
297 |
case pvpara: |
298 |
//Positions the reference frame vertically relative to the top left |
299 |
//corner of the next unframed paragraph in the RTF stream. |
300 |
eVertRel = PRTAREA; |
301 |
break; |
302 |
} |
303 |
|
304 |
SwVertOrient eVertOri; |
305 |
switch (maApoProps.eVertOri) |
306 |
{ |
307 |
case posynone: |
308 |
eVertOri = VERT_NONE; |
309 |
break; |
310 |
case posyil: |
311 |
//Positions the paragraph vertically to be in-line. |
312 |
eVertOri = VERT_NONE; /*???*/ |
313 |
break; |
314 |
case posyt: |
315 |
//Positions the paragraph at the top of the reference frame. |
316 |
eVertOri = VERT_TOP; |
317 |
break; |
318 |
case posyc: |
319 |
//Centers the paragraph vertically within the reference frame. |
320 |
eVertOri = VERT_CENTER; |
321 |
break; |
322 |
case posyb: |
323 |
//Positions the paragraph at the bottom of the reference frame. |
324 |
eVertOri = VERT_BOTTOM; |
325 |
break ; |
326 |
case posyin: |
327 |
//Positions the paragraph vertically inside the reference frame. |
328 |
eVertOri = VERT_TOP; |
329 |
break; |
330 |
case posyout: |
331 |
//Positions the paragraph vertically outside the reference frame. |
332 |
eVertOri = VERT_BOTTOM; |
333 |
break; |
334 |
} |
335 |
|
336 |
rSet.Put(SwFmtVertOrient(MakeSafePositioningValue(maApoProps.posy), |
337 |
eVertOri, eVertRel)); |
338 |
|
339 |
//Prevents text from flowing around the positioned object. |
340 |
if (maApoProps.nowrap) |
341 |
rSet.Put(SwFmtSurround(SURROUND_NONE)); |
342 |
|
343 |
//horizontal distance in twips from text on both sides of the frame. |
344 |
rSet.Put(SvxLRSpaceItem(maApoProps.dfrmtxtx, maApoProps.dfrmtxtx)); |
345 |
//vertical distance in twips from text on both sides of the frame. |
346 |
rSet.Put(SvxULSpaceItem(maApoProps.dfrmtxty, maApoProps.dfrmtxty)); |
347 |
|
348 |
SvxFrameDirection eDir; |
349 |
switch (maApoProps.eFlow) |
350 |
{ |
351 |
case frmtxlrtb: |
352 |
default: |
353 |
//Frame box flows from left to right and top to bottom (default). |
354 |
eDir = FRMDIR_HORI_LEFT_TOP; |
355 |
break; |
356 |
case frmtxtbrl: |
357 |
//Frame box flows right to left and top to bottom. |
358 |
eDir = FRMDIR_HORI_RIGHT_TOP; |
359 |
break; |
360 |
case frmtxbtlr: |
361 |
//Frame box flows left to right and bottom to top. |
362 |
eDir = FRMDIR_HORI_LEFT_TOP; /*???*/ |
363 |
break; |
364 |
case frmtxlrtbv: |
365 |
//Frame box flows left to right and top to bottom, vertical. |
366 |
eDir = FRMDIR_VERT_TOP_LEFT; |
367 |
break; |
368 |
case frmtxtbrlv: |
369 |
//Frame box flows top to bottom and right to left, vertical. |
370 |
eDir = FRMDIR_VERT_TOP_RIGHT; |
371 |
break; |
372 |
} |
373 |
rSet.Put(SvxFrameDirectionItem(eDir)); |
195 |
} |
374 |
} |
196 |
|
375 |
|
197 |
SwFlySave::SwFlySave(const SwPaM& rPam, SfxItemSet& rSet) |
376 |
SwFlySave::SwFlySave( const SwPaM& rPam, SfxItemSet& rSet ) |
198 |
: aFlySet(rSet), nSttNd(rPam.GetPoint()->nNode), nEndNd(nSttNd), nEndCnt(0), |
377 |
: aFlySet( rSet ), |
199 |
nPageWidth(ATT_MIN_SIZE), nDropLines(0), nDropAnchor(0) |
378 |
nSttNd( rPam.GetPoint()->nNode ), nEndNd( nSttNd ), |
|
|
379 |
nEndCnt( 0 ), nPageWidth( ATT_MIN_SIZE ), |
380 |
nDropLines( 0 ), nDropAnchor( 0 ) |
200 |
{ |
381 |
{ |
201 |
} |
382 |
} |
202 |
|
383 |
|
Lines 328-346
Link Here
|
328 |
} |
509 |
} |
329 |
} |
510 |
} |
330 |
|
511 |
|
331 |
void SwRTFParser::SetFlysInDoc() |
512 |
void rtfFrameManager::MakeFlyFrames(const SwRTFParser &rReader) const |
332 |
{ |
513 |
{ |
333 |
// !! von Oben abarbeiten, CntntPos ist kein Index ! |
514 |
bool bHack = false; |
334 |
SwNodes & rNds = pDoc->GetNodes(); |
515 |
bHack = bHack; |
335 |
typedef std::pair<SwFlyFrmFmt*, SwFmtAnchor> frameEntry; |
516 |
if (bHack) |
336 |
typedef std::deque<frameEntry> rtfframesAtIndex; |
517 |
return; |
337 |
typedef std::map<const SwNode*, rtfframesAtIndex> rtfFmtMap; |
518 |
|
338 |
rtfFmtMap aPrevFmts; |
519 |
//No paragraphs in document at all |
|
|
520 |
mycIter aEnd = maFrames.end(); |
521 |
mycIter aIter = maFrames.begin(); |
522 |
if (aIter == aEnd) |
523 |
return; |
524 |
|
525 |
APOProperties aNone; //Default Ctor for APO is "No apo properties" |
339 |
|
526 |
|
340 |
SwFrmFmt* pParent = pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME ); |
527 |
SwPosition aAnchorPos(*rReader.pPam->GetPoint()); |
341 |
for( USHORT n = 0; n < aFlyArr.Count(); ++n ) |
528 |
for (; aIter != aEnd; ++aIter) |
|
|
529 |
{ |
530 |
//Find the first not apo paragraph to make as the default anchor |
531 |
//location, if no others will be found |
532 |
if (aIter->maApoProps == aNone) |
533 |
{ |
534 |
aAnchorPos = SwPosition(aIter->mnSttNd); |
535 |
break; |
536 |
} |
537 |
} |
538 |
|
539 |
SwFrmFmt* pParent = rReader.pDoc->GetFrmFmtFromPool(RES_POOLFRM_FRAME); |
540 |
std::stack<SwNodeIndex> aToRemove; |
541 |
for (aIter = maFrames.begin(); aIter != aEnd; ++aIter) |
542 |
{ |
543 |
if (aIter->maApoProps == aNone) |
544 |
continue; |
545 |
|
546 |
//Find the next non apo paragraph to use an an anchor if one exists |
547 |
for (mycIter aNext = aIter+1; aNext != aEnd; ++aNext) |
548 |
{ |
549 |
if (aNext->maApoProps == aNone && aNext->mnSttNd.GetNode().IsTxtNode()) |
550 |
{ |
551 |
aAnchorPos = SwPosition(aNext->mnSttNd); |
552 |
break; |
553 |
} |
554 |
} |
555 |
|
556 |
//Nothing here to make into a frame, i.e. final txtnode was deleted |
557 |
if (!aIter->mnSttNd.GetNode().IsTxtNode()) |
558 |
continue; |
559 |
|
560 |
SwPaM aSelection(aIter->mnSttNd, aIter->mnSttCnt, aIter->mnEndNd, |
561 |
aIter->mnEndCnt); |
562 |
|
563 |
SfxItemSet aSet(rReader.pDoc->GetAttrPool(), RES_FRMATR_BEGIN, |
564 |
RES_FRMATR_END-1); |
565 |
if (!rReader.IsNewDoc()) |
566 |
Reader::ResetFrmFmtAttrs(aSet); |
567 |
|
568 |
aIter->ConvertToItemSet(aSet); |
569 |
|
570 |
#if 0 |
571 |
SwCntntNode *pStartNd = aSelection.GetCntntNode(); //Point |
572 |
SwCntntFrm *pStart = pStartNd->GetFrm(); |
573 |
SwCntntNode *pMarkNd = aSelection.GetCntntNode(false); //Mark |
574 |
SwCntntFrm *pMark = pMarkNd->GetFrm(); |
575 |
|
576 |
SwSelBoxes aBoxes; |
577 |
GetTblSel(pStart, pMark, aBoxes); |
578 |
|
579 |
|
580 |
SwFlyFrmFmt* pFmt = rReader.pDoc->MakeFlyAndMove(aSelection, aSet, |
581 |
&aBoxes, pParent); |
582 |
|
583 |
#else |
584 |
#if 0 |
585 |
SwTableCursor aTest(*aSelection.GetPoint()); |
586 |
const SwSelBoxes &rBoxes = aTest.GetBoxes(); |
587 |
|
588 |
SwFlyFrmFmt* pFmt = rReader.pDoc->MakeFlyAndMove(aSelection, aSet, |
589 |
&rBoxes, pParent); |
590 |
#else |
591 |
const SwTableSortBoxes *pBoxes = 0; |
592 |
if (SwTableNode* pTblNd = aSelection.GetNode()->FindTableNode()) |
593 |
{ |
594 |
pTblNd->DelFrms(); |
595 |
SwNodeIndex aIdx(*pTblNd->EndOfSectionNode(), 1); |
596 |
pTblNd->MakeFrms(&aIdx ); |
597 |
|
598 |
pBoxes = &(pTblNd->GetTable().GetTabSortBoxes()); |
599 |
} |
600 |
SwFlyFrmFmt* pFmt = rReader.pDoc->MakeFlyAndMove(aSelection, aSet, |
601 |
(const SwSelBoxes*)pBoxes, pParent); |
602 |
#endif |
603 |
#endif |
604 |
ASSERT(pFmt, "inserting a frame failed!"); |
605 |
if (!pFmt) |
606 |
continue; |
607 |
|
608 |
SwFmtAnchor aAnchor(FLY_AUTO_CNTNT); |
609 |
aAnchor.SetAnchor(&aAnchorPos); |
610 |
pFmt->SetAttr(aAnchor); |
611 |
aToRemove.push(aIter->mnSttNd); |
612 |
|
613 |
if (aIter->maApoProps.absw == 0) |
614 |
{ |
615 |
SfxItemSet aFlySet(pFmt->GetAttrSet()); |
616 |
SwFmtFrmSize aSize((const SwFmtFrmSize&)(aFlySet.Get(RES_FRM_SIZE))); |
617 |
aFlySet.ClearItem(RES_FRM_SIZE); |
618 |
|
619 |
Size aPgSize; |
620 |
rReader.GetPageSize(aPgSize); |
621 |
|
622 |
CalculateFlySize(aFlySet, aAnchorPos.nNode, aPgSize.Width()); |
623 |
|
624 |
SwFmtFrmSize aNewSize((const SwFmtFrmSize&)(aFlySet.Get(RES_FRM_SIZE))); |
625 |
aSize.SetWidth(aNewSize.GetWidth()); |
626 |
pFmt->SetAttr(aSize); |
627 |
} |
628 |
} |
629 |
|
630 |
bHack = bHack; |
631 |
if (bHack) |
632 |
return; |
633 |
|
634 |
while (!aToRemove.empty()) |
635 |
{ |
636 |
SwPaM aPaM(aToRemove.top()); |
637 |
rReader.pDoc->DelFullPara(aPaM); |
638 |
aToRemove.pop(); |
639 |
} |
640 |
} |
641 |
|
642 |
void SwRTFParser::SetFlysInDoc() |
643 |
{ |
644 |
SwFrmFmt* pParent = pDoc->GetFrmFmtFromPool(RES_POOLFRM_FRAME); |
645 |
for (USHORT n = 0; n < aFlyArr.Count(); ++n) |
342 |
{ |
646 |
{ |
343 |
SwFlySave* pFlySave = aFlyArr[ n ]; |
647 |
SwFlySave* pFlySave = aFlyArr[n]; |
344 |
|
648 |
|
345 |
ASSERT( !pFlySave->nSttNd.GetNode().FindFlyStartNode(), |
649 |
ASSERT( !pFlySave->nSttNd.GetNode().FindFlyStartNode(), |
346 |
"Content vom Fly steht in einem Fly" ); |
650 |
"Content vom Fly steht in einem Fly" ); |
Lines 351-369
Link Here
|
351 |
// Absatz das Absatz Attribut setzen. Ggfs noch die |
655 |
// Absatz das Absatz Attribut setzen. Ggfs noch die |
352 |
// FontSize zuruecksetzen, damit das DropCap nicht zu |
656 |
// FontSize zuruecksetzen, damit das DropCap nicht zu |
353 |
// groá wird. |
657 |
// groá wird. |
354 |
if( pFlySave->nDropAnchor ) |
658 |
if (pFlySave->nDropAnchor) |
355 |
{ |
659 |
{ |
356 |
SwTxtNode* pSttNd = pFlySave->nSttNd.GetNode().GetTxtNode(), |
660 |
SwTxtNode* pSttNd = pFlySave->nSttNd.GetNode().GetTxtNode(), |
357 |
* pEndNd = pFlySave->nEndNd.GetNode().GetTxtNode(); |
661 |
* pEndNd = pFlySave->nEndNd.GetNode().GetTxtNode(); |
358 |
if( pSttNd && pEndNd && |
662 |
if (pSttNd && pEndNd && |
359 |
pSttNd->GetIndex() + 1 == pEndNd->GetIndex() ) |
663 |
pSttNd->GetIndex() + 1 == pEndNd->GetIndex()) |
360 |
{ |
664 |
{ |
361 |
BOOL bJoined; |
665 |
bool bJoined; |
362 |
{ |
666 |
{ |
363 |
SwPaM aTmp( *pEndNd, 0, *pSttNd, pSttNd->GetTxt().Len() ); |
667 |
SwPaM aTmp( *pEndNd, 0, *pSttNd, pSttNd->GetTxt().Len() ); |
364 |
bJoined = pDoc->DeleteAndJoin( aTmp ); |
668 |
bJoined = pDoc->DeleteAndJoin( aTmp ); |
365 |
} |
669 |
} |
366 |
if( bJoined ) |
670 |
if (bJoined) |
367 |
{ |
671 |
{ |
368 |
SwFmtDrop aDropCap; |
672 |
SwFmtDrop aDropCap; |
369 |
aDropCap.GetLines() = (BYTE)pFlySave->nDropLines; |
673 |
aDropCap.GetLines() = (BYTE)pFlySave->nDropLines; |
Lines 378-596
Link Here
|
378 |
continue; |
682 |
continue; |
379 |
} |
683 |
} |
380 |
|
684 |
|
381 |
// liegt Ende und Start vom Naechsten im gleichen Node, dann muss |
685 |
SwPosition aPos(pFlySave->nSttNd); |
382 |
// gesplittet werden |
686 |
SwFmtAnchor aAnchor((const SwFmtAnchor&)pFlySave->aFlySet.Get(RES_ANCHOR)); |
383 |
if( n + 1 < aFlyArr.Count() && pFlySave->nEndCnt && |
687 |
aAnchor.SetAnchor(&aPos); |
384 |
pFlySave->nEndNd == aFlyArr[ n + 1 ]->nSttNd ) |
688 |
pFlySave->aFlySet.Put(aAnchor); |
385 |
{ |
|
|
386 |
SwCntntNode* pCNd = rNds[ pFlySave->nEndNd ]->GetCntntNode(); |
387 |
if( pCNd ) |
388 |
{ |
389 |
SwPosition aPos( pFlySave->nEndNd, |
390 |
SwIndex( pCNd, pFlySave->nEndCnt )); |
391 |
pDoc->SplitNode( aPos ); |
392 |
pFlySave->nEndNd--; |
393 |
} |
394 |
else |
395 |
pFlySave->nEndCnt = 0; |
396 |
} |
397 |
|
398 |
// verschiebe den Inhalt von diesem Anchor in den Auto-TextBereich |
399 |
// und erzeuge dadurch den richtigen SwG-Rahmen |
400 |
SwNodeRange aRg(pFlySave->nSttNd, 0, pFlySave->nEndNd, 0); |
401 |
//Make a new section, unless there is no content at all |
402 |
bool bMakeEmptySection = aRg.aStart < aRg.aEnd || ((aRg.aStart == aRg.aEnd) && pFlySave->nEndCnt); |
403 |
|
404 |
{ |
405 |
// Nur TextNodes koennen in Tabellen stehen !! |
406 |
const SwNode* pNd = &pFlySave->nSttNd.GetNode(); |
407 |
if( pNd->IsNoTxtNode() ) |
408 |
{ |
409 |
// die Size muss noch korrigiert werden! |
410 |
nAktPageDesc = 0; // Standart PageDesc |
411 |
if( SFX_ITEM_SET != pFlySave->aFlySet.GetItemState( |
412 |
RES_FRM_SIZE, FALSE ) ) |
413 |
_SetPictureSize( *(SwNoTxtNode*)pNd, aRg.aStart, |
414 |
pFlySave->aFlySet ); |
415 |
if( 0 != ( pNd = pNd->FindTableNode() ) ) |
416 |
pFlySave->SetFlySize( *(SwTableNode*)pNd ); |
417 |
} |
418 |
else |
419 |
{ |
420 |
// TabelleNodes beachten |
421 |
pNd = pNd->FindTableNode(); |
422 |
if( pNd ) // am Anfang eine Tabelle, -> Bereich auf TabStart |
423 |
aRg.aStart = *pNd; |
424 |
|
425 |
if( bMakeEmptySection ) |
426 |
{ |
427 |
pNd = &aRg.aEnd.GetNode(); |
428 |
ULONG nSectEnd = pNd->EndOfSectionIndex()+1; |
429 |
|
430 |
if (!pNd->IsTableNode() && (pNd = pNd->FindTableNode())) |
431 |
{ |
432 |
const SwNode* pTblBxNd; |
433 |
// Ende der Tabelle ist hinter dieser Box ?? |
434 |
if( pNd->EndOfSectionIndex() == nSectEnd ) |
435 |
aRg.aEnd = nSectEnd+1; |
436 |
// is the end in the first box of the table, then |
437 |
// move before the table (Bug 67663) |
438 |
else if( 0 != ( pTblBxNd = aRg.aEnd.GetNode(). |
439 |
FindTableBoxStartNode()) && |
440 |
pTblBxNd->GetIndex() - 1 == pNd->GetIndex()) |
441 |
aRg.aEnd = *pNd; |
442 |
else |
443 |
{ |
444 |
// Tabelle ist noch groesser, also splitte sie hier. |
445 |
rNds.SplitTable( aRg.aEnd, TRUE ); |
446 |
aRg.aEnd = pNd->EndOfSectionIndex() + 1; |
447 |
} |
448 |
} |
449 |
} |
450 |
} |
451 |
} |
452 |
|
453 |
// vorm verschieben muss sich der Index auf die alte Position |
454 |
// gemerkt werden, der Index wird mit verschoben !!! |
455 |
|
456 |
SwNodeIndex aTmpIdx( rNds.GetEndOfAutotext() ); |
457 |
SwStartNode* pSttNd = bMakeEmptySection |
458 |
? rNds.MakeEmptySection( aTmpIdx, SwFlyStartNode ) |
459 |
: rNds.MakeTextSection( aTmpIdx, SwFlyStartNode, |
460 |
(SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() ); |
461 |
|
462 |
// das ist die Verankerungs-Position (fuers Layout!) |
463 |
pFlySave->nSttNd = aRg.aStart.GetIndex()-1; |
464 |
if( bMakeEmptySection ) |
465 |
{ |
466 |
// check: the move does not clear the surrounded section. If all |
467 |
// nodes moved away, then create a new TxtNode |
468 |
{ |
469 |
SwNodeIndex aPrev( aRg.aStart, -1 ); |
470 |
if( aPrev.GetNode().IsStartNode() && |
471 |
aPrev.GetNode().EndOfSectionNode() == &aRg.aEnd.GetNode()) |
472 |
{ |
473 |
// create new txtnode, because the section does never be empty |
474 |
pDoc->GetNodes().MakeTxtNode( aRg.aEnd, |
475 |
(SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() ); |
476 |
aRg.aEnd--; |
477 |
} |
478 |
} |
479 |
aTmpIdx = *pSttNd->EndOfSectionNode(); |
480 |
pDoc->Move( aRg, aTmpIdx ); |
481 |
} |
482 |
|
483 |
pFlySave->aFlySet.Put( SwFmtCntnt( pSttNd )); |
484 |
|
485 |
CalculateFlySize( pFlySave->aFlySet, pFlySave->nSttNd, |
486 |
pFlySave->nPageWidth ); |
487 |
|
689 |
|
488 |
// if the section only contains one Node and this has a |
690 |
SwFlyFrmFmt* pFmt = 0; |
489 |
// border or backgorund, then put it to the frame |
|
|
490 |
// Not in our own RTF-Format! |
491 |
if( pSttNd->GetIndex() + 2 == pSttNd->EndOfSectionIndex() && |
492 |
!bSwPageDesc ) |
493 |
{ |
494 |
SwTxtNode* pSrcNd = pDoc->GetNodes()[ pSttNd->GetIndex() + 1 ] |
495 |
->GetTxtNode(); |
496 |
if( pSrcNd && pSrcNd->GetpSwAttrSet() ) |
497 |
{ |
498 |
SfxItemSet aTmpSet( pDoc->GetAttrPool(), |
499 |
RES_BACKGROUND, RES_BOX ); |
500 |
aTmpSet.Put( *pSrcNd->GetpSwAttrSet() ); |
501 |
if( aTmpSet.Count() ) |
502 |
{ |
503 |
pFlySave->aFlySet.Put( aTmpSet ); |
504 |
pSrcNd->ResetAttr( RES_BACKGROUND, RES_BOX ); |
505 |
} |
506 |
} |
507 |
} |
508 |
|
509 |
SwFlyFrmFmt* pFmt = pDoc->MakeFlyFrmFmt( aEmptyStr, pParent ); |
510 |
pFmt->SetAttr( pFlySave->aFlySet ); |
511 |
const SwFmtAnchor& rAnchor = pFmt->GetAnchor(); |
512 |
if( FLY_IN_CNTNT != rAnchor.GetAnchorId() ) |
513 |
{ |
514 |
// korrigiere noch den Absatz, ist immer der vorhergehende ! |
515 |
// JP 20.09.95: wenn es diesen gibt! (DocAnfang!) |
516 |
|
517 |
//JP 02.08.99: that is wrong. The anchor is ever the NEXT! |
518 |
//JP 05.08.99: there are an Bug in the ExportFilter which will |
519 |
// be fixed in the Version 517 - by SWG-Export |
520 |
// the fly will be after the paragraph - but in RTF |
521 |
// the flys will be before the paragraph. |
522 |
if( !bSwPageDesc || 5430 < GetVersionNo() ) |
523 |
pFlySave->nSttNd++; |
524 |
|
525 |
// if( !pFlySave->nSttNd.GetNode().IsCntntNode() ) |
526 |
{ |
527 |
// Seitenumbrueche in den Bodybereich verschieben! |
528 |
SwCntntNode* pSrcNd = aRg.aStart.GetNode().GetCntntNode(); |
529 |
SwCntntNode* pDstNd = pFlySave->nSttNd.GetNode().GetCntntNode(); |
530 |
if( !pDstNd ) |
531 |
pDstNd = pDoc->GetNodes().GoNext( &pFlySave->nSttNd ); |
532 |
|
533 |
::lcl_CpyBreakAttrs( pSrcNd, pDstNd, &pFlySave->nSttNd ); |
534 |
} |
535 |
|
536 |
const SwNodeIndex aSttNd(*pSttNd); |
537 |
SwNodeIndex aEndNd(*pSttNd->EndOfSectionNode()); |
538 |
aEndNd--; |
539 |
|
540 |
SwPosition aPos( pFlySave->nSttNd ); |
541 |
SwFmtAnchor aAnchor(rAnchor); |
542 |
aAnchor.SetAnchor(&aPos); |
543 |
|
544 |
const SwNode *pCurrentAnchor = &(pFlySave->nSttNd.GetNode()); |
545 |
aPrevFmts[pCurrentAnchor].push_back(frameEntry(pFmt, aAnchor)); |
546 |
|
547 |
while (aEndNd > aSttNd) |
548 |
{ |
549 |
typedef rtfframesAtIndex::iterator myIter; |
550 |
rtfframesAtIndex &rDeque = aPrevFmts[&(aEndNd.GetNode())]; |
551 |
myIter aEnd = rDeque.end(); |
552 |
for (myIter aIter = rDeque.begin(); aIter != aEnd; ++aIter) |
553 |
{ |
554 |
aIter->second.SetAnchor(&aPos); |
555 |
aPrevFmts[pCurrentAnchor].push_back(*aIter); |
556 |
} |
557 |
rDeque.clear(); |
558 |
aEndNd--; |
559 |
} |
560 |
} |
561 |
delete pFlySave; |
562 |
} |
563 |
|
564 |
typedef rtfFmtMap::reverse_iterator myriter; |
565 |
myriter aEnd = aPrevFmts.rend(); |
566 |
for(myriter aIter = aPrevFmts.rbegin(); aIter != aEnd; ++aIter) |
567 |
{ |
568 |
rtfframesAtIndex &rDeque = aIter->second; |
569 |
typedef rtfframesAtIndex::iterator myIter; |
570 |
myIter aQEnd = rDeque.end(); |
571 |
for (myIter aQIter = rDeque.begin(); aQIter != aQEnd; ++aQIter) |
572 |
{ |
691 |
{ |
573 |
frameEntry &rEntry = *aQIter; |
692 |
SwPaM aRegion(pFlySave->nSttNd, 0, pFlySave->nEndNd, pFlySave->nEndCnt); |
574 |
SwFlyFrmFmt *pFrm = rEntry.first; |
693 |
pFmt = pDoc->MakeFlyAndMove(aRegion, pFlySave->aFlySet, 0, pParent); |
575 |
SwFmtAnchor &rAnchor = rEntry.second; |
|
|
576 |
pFrm->SetAttr(rAnchor); |
577 |
} |
694 |
} |
578 |
} |
695 |
ASSERT(pFmt, "Format missing"); |
|
|
696 |
if (pFmt) |
697 |
{ |
698 |
SwAttrSet aFlySet(pFmt->GetAttrSet()); |
699 |
CalculateFlySize(aFlySet, pFlySave->nSttNd, pFlySave->nPageWidth ); |
700 |
pFmt->SetAttr(aFlySet); |
701 |
} |
702 |
delete pFlySave; |
703 |
} |
579 |
|
704 |
|
580 |
aFlyArr.Remove(0, aFlyArr.Count()); |
705 |
aFlyArr.Remove(0, aFlyArr.Count()); |
581 |
} |
706 |
} |
582 |
|
707 |
|
583 |
// clips the text box to the min or max position if it is outside our min or max boundry |
708 |
bool APOProperties::HandleToken(int nToken, long nTokenValue) |
584 |
long SwRTFParser::GetSafePos(long nPos) |
|
|
585 |
{ |
709 |
{ |
586 |
if(nPos > SHRT_MAX) |
710 |
bool bHandled = true; |
587 |
nPos = SHRT_MAX; |
711 |
switch (nToken) |
588 |
else if(nPos < SHRT_MIN) |
712 |
{ |
589 |
nPos = SHRT_MIN; |
713 |
case RTF_ABSW: |
590 |
|
714 |
absw = nTokenValue; |
591 |
return nPos; |
715 |
break; |
|
|
716 |
case RTF_ABSH: |
717 |
absh = nTokenValue; |
718 |
break; |
719 |
case RTF_PHMRG: |
720 |
eHoriRel = phmrg; |
721 |
break; |
722 |
case RTF_PHPG: |
723 |
eHoriRel = phpg; |
724 |
break; |
725 |
case RTF_PHCOL: |
726 |
eHoriRel = phcol; |
727 |
break; |
728 |
case RTF_POSX: |
729 |
case RTF_POSNEGX: |
730 |
eHoriOri = posxnone; |
731 |
posx = nTokenValue; |
732 |
break; |
733 |
case RTF_POSXC: |
734 |
eHoriOri = posxc; |
735 |
break; |
736 |
case RTF_POSXI: |
737 |
eHoriOri = posxi; |
738 |
break; |
739 |
case RTF_POSXO: |
740 |
eHoriOri = posxo; |
741 |
break; |
742 |
case RTF_POSXR: |
743 |
eHoriOri = posxr; |
744 |
case RTF_POSXL: |
745 |
eHoriOri = posxl; |
746 |
break; |
747 |
case RTF_PVMRG: |
748 |
eVertRel = pvmrg; |
749 |
break; |
750 |
case RTF_PVPG: |
751 |
eVertRel = pvpg; |
752 |
break; |
753 |
case RTF_PVPARA: |
754 |
eVertRel = pvpara; |
755 |
break; |
756 |
case RTF_POSY: |
757 |
case RTF_POSNEGY: |
758 |
posy = nTokenValue; |
759 |
break; |
760 |
case RTF_POSYIL: |
761 |
eVertOri = posyil; |
762 |
break; |
763 |
case RTF_POSYT: |
764 |
eVertOri = posyt; |
765 |
break; |
766 |
case RTF_POSYC: |
767 |
eVertOri = posyc; |
768 |
break; |
769 |
case RTF_POSYB: |
770 |
eVertOri = posyb; |
771 |
break; |
772 |
case RTF_POSYIN: |
773 |
eVertOri = posyin; |
774 |
break; |
775 |
case RTF_POSYOUT: |
776 |
eVertOri = posyout; |
777 |
break; |
778 |
case RTF_ABSLOCK: |
779 |
abslock = nTokenValue ? true : false; |
780 |
break; |
781 |
case RTF_NOWRAP: |
782 |
nowrap = true; |
783 |
break; |
784 |
case RTF_DXFRTEXT: |
785 |
dfrmtxtx = dfrmtxty = nTokenValue; |
786 |
break; |
787 |
case RTF_DFRMTXTX: |
788 |
dfrmtxtx = nTokenValue; |
789 |
break; |
790 |
case RTF_DFRMTXTY: |
791 |
dfrmtxty = nTokenValue; |
792 |
break; |
793 |
case RTF_DROPCAPLI: |
794 |
dropcapli = nTokenValue; |
795 |
break; |
796 |
case RTF_DROPCAPT: |
797 |
dropcapt = static_cast<dropcap>(nTokenValue); |
798 |
break; |
799 |
case RTF_ABSNOOVRLP: |
800 |
absnoovrlp = nTokenValue ? true : false; |
801 |
break; |
802 |
case RTF_FRMTXLRTB: |
803 |
eFlow = frmtxlrtb; |
804 |
break; |
805 |
case RTF_FRMTXTBRL: |
806 |
eFlow = frmtxtbrl; |
807 |
break; |
808 |
case RTF_FRMTXBTLR: |
809 |
eFlow = frmtxbtlr; |
810 |
break; |
811 |
case RTF_FRMTXLRTBV: |
812 |
eFlow = frmtxlrtbv; |
813 |
break; |
814 |
case RTF_FRMTXTBRLV: |
815 |
eFlow = frmtxtbrlv; |
816 |
break; |
817 |
default: |
818 |
bHandled = false; |
819 |
break; |
820 |
} |
821 |
return bHandled; |
592 |
} |
822 |
} |
593 |
|
823 |
|
|
|
824 |
#if 0 |
825 |
|
594 |
void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet ) |
826 |
void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet ) |
595 |
{ |
827 |
{ |
596 |
// ein Set fuer die FrmFmt-Attribute |
828 |
// ein Set fuer die FrmFmt-Attribute |
Lines 605-611
Link Here
|
605 |
// RTF-Defaults setzen: |
837 |
// RTF-Defaults setzen: |
606 |
SwFmtAnchor aAnchor(FLY_PAGE); |
838 |
SwFmtAnchor aAnchor(FLY_PAGE); |
607 |
|
839 |
|
608 |
SwFmtHoriOrient aHori( 0, HORI_LEFT, /*FRAME*/REL_PG_PRTAREA ); |
840 |
SwFmtHoriOrient aHori( 0, HORI_LEFT, REL_PG_PRTAREA ); |
609 |
SwFmtVertOrient aVert( 0, VERT_TOP, REL_PG_PRTAREA ); |
841 |
SwFmtVertOrient aVert( 0, VERT_TOP, REL_PG_PRTAREA ); |
610 |
SvxFrameDirectionItem aFrmDir( FRMDIR_HORI_LEFT_TOP ); |
842 |
SvxFrameDirectionItem aFrmDir( FRMDIR_HORI_LEFT_TOP ); |
611 |
|
843 |
|
Lines 707-713
Link Here
|
707 |
|
939 |
|
708 |
case RTF_POSNEGX: |
940 |
case RTF_POSNEGX: |
709 |
case RTF_POSX: aHori.SetHoriOrient( HORI_NONE ); |
941 |
case RTF_POSX: aHori.SetHoriOrient( HORI_NONE ); |
710 |
aHori.SetPos( GetSafePos((long)nTokenValue) ); |
942 |
aHori.SetPos(MakeSafePositioningValue(nTokenValue)); |
711 |
break; |
943 |
break; |
712 |
case RTF_POSXC: aHori.SetHoriOrient( HORI_CENTER ); break; |
944 |
case RTF_POSXC: aHori.SetHoriOrient( HORI_CENTER ); break; |
713 |
case RTF_POSXI: aHori.SetHoriOrient( HORI_LEFT ); |
945 |
case RTF_POSXI: aHori.SetHoriOrient( HORI_LEFT ); |
Lines 721-727
Link Here
|
721 |
|
953 |
|
722 |
case RTF_POSNEGY: |
954 |
case RTF_POSNEGY: |
723 |
case RTF_POSY: aVert.SetVertOrient( VERT_NONE ); |
955 |
case RTF_POSY: aVert.SetVertOrient( VERT_NONE ); |
724 |
aVert.SetPos( GetSafePos((long)nTokenValue) ); |
956 |
aVert.SetPos(MakeSafePositioningValue(nTokenValue)); |
725 |
break; |
957 |
break; |
726 |
case RTF_POSYT: aVert.SetVertOrient( VERT_TOP ); break; |
958 |
case RTF_POSYT: aVert.SetVertOrient( VERT_TOP ); break; |
727 |
case RTF_POSYB: aVert.SetVertOrient( VERT_BOTTOM ); break; |
959 |
case RTF_POSYB: aVert.SetVertOrient( VERT_BOTTOM ); break; |
Lines 987-1004
Link Here
|
987 |
nToken = GetNextToken(); |
1219 |
nToken = GetNextToken(); |
988 |
} while( bWeiter && IsParserWorking() ); |
1220 |
} while( bWeiter && IsParserWorking() ); |
989 |
|
1221 |
|
990 |
#if 0 |
|
|
991 |
if( !bReadSwFly && ( FRAME == aVert.GetRelationOrient() || |
992 |
//JP 21.07.99: for Bug 67630 - it read into Header od Footer, set |
993 |
// never the anchor to Page. Because it is then only |
994 |
// on the first used page . |
995 |
( FLY_PAGE == aAnchor.GetAnchorId() && |
996 |
pPam->GetPoint()->nNode < pDoc->GetNodes().GetEndOfExtras() && |
997 |
( pPam->GetNode()->FindHeaderStartNode() || |
998 |
pPam->GetNode()->FindFooterStartNode() )) )) |
999 |
aAnchor.SetType( FLY_AT_CNTNT ); |
1000 |
#endif |
1001 |
|
1002 |
pSet->Put( aAnchor ); |
1222 |
pSet->Put( aAnchor ); |
1003 |
pSet->Put( aHori ); |
1223 |
pSet->Put( aHori ); |
1004 |
pSet->Put( aVert ); |
1224 |
pSet->Put( aVert ); |
Lines 1023-1038
Link Here
|
1023 |
nTmp *= USHRT_MAX; |
1243 |
nTmp *= USHRT_MAX; |
1024 |
nTmp /= nWidth; |
1244 |
nTmp /= nWidth; |
1025 |
pCol->SetWishWidth( USHORT(nTmp) ); |
1245 |
pCol->SetWishWidth( USHORT(nTmp) ); |
1026 |
/* |
|
|
1027 |
JP 07.07.95: der Dialog kennt nur eine Breite fuer alle Spalten |
1028 |
darum hier nicht weiter beachten |
1029 |
nTmp = aColumns[ n+1 ]; |
1030 |
if( nTmp ) |
1031 |
pCol->SetRight( USHORT(nTmp) ); |
1032 |
else |
1033 |
pCol->SetRight( 0 ); |
1034 |
pCol->SetLeft( 0 ); |
1035 |
*/ |
1036 |
} |
1246 |
} |
1037 |
} |
1247 |
} |
1038 |
pSet->Put( aCol ); |
1248 |
pSet->Put( aCol ); |
Lines 1043-1050
Link Here
|
1043 |
|
1253 |
|
1044 |
// ein neues FlyFormat anlegen oder das alte benutzen ? |
1254 |
// ein neues FlyFormat anlegen oder das alte benutzen ? |
1045 |
// (teste ob es die selben Attribute besitzt!) |
1255 |
// (teste ob es die selben Attribute besitzt!) |
1046 |
SwFlySave* pFlySave; |
|
|
1047 |
USHORT nFlyArrCnt = aFlyArr.Count(); |
1256 |
USHORT nFlyArrCnt = aFlyArr.Count(); |
|
|
1257 |
SwFlySave* pFlySavePrev = nFlyArrCnt ? aFlyArr[nFlyArrCnt-1] : 0; |
1258 |
SwFlySave* pFlySave = pFlySavePrev; |
1048 |
/* |
1259 |
/* |
1049 |
#i5263# |
1260 |
#i5263# |
1050 |
There were not enough frame properties found to actually justify creating |
1261 |
There were not enough frame properties found to actually justify creating |
Lines 1052-1273
Link Here
|
1052 |
*/ |
1263 |
*/ |
1053 |
if (nAppliedProps) |
1264 |
if (nAppliedProps) |
1054 |
{ |
1265 |
{ |
1055 |
if( !nFlyArrCnt || |
1266 |
if (!pFlySavePrev || !pFlySavePrev->IsEqualFly(*pPam, aSet)) |
1056 |
!( pFlySave = aFlyArr[ nFlyArrCnt-1 ])->IsEqualFly( *pPam, aSet )) |
|
|
1057 |
{ |
1267 |
{ |
1058 |
pFlySave = new SwFlySave( *pPam, aSet ); |
1268 |
pFlySave = new SwFlySave(*pPam, aSet); |
1059 |
Size aPgSize; |
1269 |
Size aPgSize; |
1060 |
GetPageSize( aPgSize ); |
1270 |
GetPageSize( aPgSize ); |
1061 |
pFlySave->nPageWidth = aPgSize.Width(); |
1271 |
pFlySave->nPageWidth = aPgSize.Width(); |
1062 |
|
1272 |
if(nDropCapAnchor) |
1063 |
if( nDropCapAnchor ) |
|
|
1064 |
{ |
1273 |
{ |
1065 |
pFlySave->nDropAnchor = nDropCapAnchor; |
1274 |
pFlySave->nDropAnchor = nDropCapAnchor; |
1066 |
pFlySave->nDropLines = nDropCapLines; |
1275 |
pFlySave->nDropLines = nDropCapLines; |
1067 |
} |
1276 |
} |
1068 |
if (nFlyArrCnt >0){ |
1277 |
if (pFlySavePrev) |
1069 |
SwFlySave* pFlySavePrev = aFlyArr[nFlyArrCnt-1]; |
1278 |
{ |
1070 |
if (pFlySave->nSttNd.GetIndex() < pFlySavePrev->nEndNd.GetIndex()) |
1279 |
if (pFlySave->nSttNd.GetIndex() < pFlySavePrev->nEndNd.GetIndex()) |
1071 |
{ |
|
|
1072 |
pFlySavePrev->nEndNd=pFlySave->nSttNd; |
1280 |
pFlySavePrev->nEndNd=pFlySave->nSttNd; |
1073 |
} |
|
|
1074 |
} |
1281 |
} |
1075 |
aFlyArr.Insert( pFlySave, nFlyArrCnt++ ); |
1282 |
aFlyArr.Insert(pFlySave, nFlyArrCnt++); |
1076 |
} |
1283 |
} |
1077 |
} |
1284 |
} |
1078 |
|
1285 |
|
1079 |
SetPardTokenRead( FALSE ); |
1286 |
if (pFlySave) |
1080 |
const SwTableNode* pTblNd = pPam->GetNode()->FindTableNode(); |
|
|
1081 |
|
1082 |
while( !IsPardTokenRead() && IsParserWorking() ) |
1083 |
{ |
1084 |
if( RTF_PARD == nToken || nOpenBrakets > GetOpenBrakets() ) |
1085 |
break; |
1086 |
|
1087 |
NextToken( nToken ); |
1088 |
|
1089 |
if( !IsPardTokenRead() ) |
1090 |
{ |
1091 |
nToken = GetNextToken(); |
1092 |
|
1093 |
// BUG 22036: kommt zwischen Fly-Attributen ein unbekanntes, |
1094 |
// dann erzeuge nie 2 FlyFrames, sondern fasse |
1095 |
// beide zusammen !!! |
1096 |
while( RTF_APOCTL == ( nToken & ~(0xff | RTF_SWGDEFS) )) |
1097 |
{ |
1098 |
if( RTF_FLY_INPARA == nToken ) |
1099 |
break; |
1100 |
|
1101 |
if( RTF_IGNOREFLAG == SkipToken( -1 ) ) |
1102 |
{ |
1103 |
if( '{' == SkipToken( -1 ) ) |
1104 |
nToken = '{'; |
1105 |
else |
1106 |
SkipToken( 2 ); |
1107 |
} |
1108 |
else |
1109 |
SkipToken( 1 ); |
1110 |
|
1111 |
ReadFly( nToken, pFlySave ? &pFlySave->aFlySet : 0); |
1112 |
nToken = GetNextToken(); |
1113 |
} |
1114 |
} |
1115 |
} |
1116 |
|
1117 |
/* |
1118 |
#i5263# |
1119 |
There were enough frame properties found to actually justify creating |
1120 |
an absolutely positioned frame. |
1121 |
*/ |
1122 |
if (!nAppliedProps) |
1123 |
{ |
1287 |
{ |
1124 |
bReadSwFly = FALSE; |
1288 |
pFlySave->nEndNd = pPam->GetPoint()->nNode; |
1125 |
SkipToken( -1 ); |
1289 |
pFlySave->nEndCnt = pPam->GetPoint()->nContent.GetIndex(); |
1126 |
return; |
|
|
1127 |
} |
1290 |
} |
1128 |
|
1291 |
bReadSwFly = false; |
1129 |
if( pTblNd && !pPam->GetPoint()->nContent.GetIndex() && |
1292 |
SkipToken(-1); |
1130 |
pTblNd->EndOfSectionIndex() + 1 == |
|
|
1131 |
pPam->GetPoint()->nNode.GetIndex() ) |
1132 |
{ |
1133 |
// nicht mehr in der Tabelle, sondern dahinter ? |
1134 |
// Dann aber wieder zurueck in die Tabelle |
1135 |
pPam->Move( fnMoveBackward ); |
1136 |
} |
1137 |
else |
1138 |
pTblNd = 0; |
1139 |
|
1140 |
// wurde garnichts eingefuegt? |
1141 |
if( !pTblNd && |
1142 |
pPam->GetPoint()->nNode == pFlySave->nSttNd && |
1143 |
!pPam->GetPoint()->nContent.GetIndex() ) |
1144 |
{ |
1145 |
// // dann erzeuge mindestens einen leeren TextNode |
1146 |
// pDoc->AppendTxtNode(*pPam); |
1147 |
// dann zerstoere den FlySave wieder. |
1148 |
aFlyArr.DeleteAndDestroy( --nFlyArrCnt ); |
1149 |
|
1150 |
} |
1151 |
else |
1152 |
{ |
1153 |
FASTBOOL bMovePaM = 0 != pTblNd; |
1154 |
|
1155 |
pFlySave->nEndNd = pPam->GetPoint()->nNode; |
1156 |
pFlySave->nEndCnt = pPam->GetPoint()->nContent.GetIndex(); |
1157 |
|
1158 |
if( bMovePaM ) |
1159 |
pPam->Move( fnMoveForward ); |
1160 |
|
1161 |
pTblNd = pFlySave->nSttNd.GetNode().FindTableNode(); |
1162 |
if( pTblNd && !pFlySave->nEndCnt && |
1163 |
pTblNd == pFlySave->nEndNd.GetNode().FindTableNode() ) |
1164 |
{ |
1165 |
// dann teste mal, ob das \pard nicht zu spaet kam und |
1166 |
// eigentlich in die vorherige Zelle gehoert |
1167 |
const SwStartNode* pSttBoxNd = pFlySave->nSttNd.GetNode(). |
1168 |
FindTableBoxStartNode(), |
1169 |
* pEndBoxNd = pFlySave->nEndNd.GetNode(). |
1170 |
FindTableBoxStartNode(); |
1171 |
if( pSttBoxNd && pEndBoxNd && |
1172 |
bMovePaM ? ( pSttBoxNd == pEndBoxNd ) |
1173 |
: ( pSttBoxNd->EndOfSectionIndex() + 1 == |
1174 |
pEndBoxNd->GetIndex() && |
1175 |
pEndBoxNd->GetIndex() + 1 == |
1176 |
pFlySave->nEndNd.GetIndex() )) |
1177 |
{ |
1178 |
// dann gehoert das Ende in die vorherige Box! |
1179 |
SwPosition aPos( *pPam->GetPoint() ); |
1180 |
pPam->GetPoint()->nNode = *pSttBoxNd->EndOfSectionNode(); |
1181 |
pPam->Move( fnMoveBackward, fnGoNode ); |
1182 |
|
1183 |
DelLastNode(); |
1184 |
|
1185 |
pPam->GetPoint()->nNode = *pSttBoxNd->EndOfSectionNode(); |
1186 |
pPam->Move( fnMoveBackward, fnGoNode ); |
1187 |
|
1188 |
pFlySave->nEndNd = pPam->GetPoint()->nNode; |
1189 |
pFlySave->nEndCnt = pPam->GetPoint()->nContent.GetIndex(); |
1190 |
|
1191 |
*pPam->GetPoint() = aPos; |
1192 |
} |
1193 |
} |
1194 |
else if( !bReadSwFly && !pFlySave->nEndCnt && |
1195 |
pFlySave->nSttNd.GetIndex() + 1 == pFlySave->nEndNd.GetIndex() && |
1196 |
pFlySave->nSttNd.GetNode().IsTxtNode() ) |
1197 |
{ |
1198 |
|
1199 |
SwTxtNode* pTxtNd = pFlySave->nSttNd.GetNode().GetTxtNode(); |
1200 |
SwTxtFlyCnt* pFlyCnt; |
1201 |
if( 1 == pTxtNd->GetTxt().Len() && |
1202 |
0 != ( pFlyCnt = (SwTxtFlyCnt*)pTxtNd->GetTxtAttr( |
1203 |
0, RES_TXTATR_FLYCNT )) && |
1204 |
pFlyCnt->GetFlyCnt().GetFrmFmt() ) |
1205 |
{ |
1206 |
// then move the content into the surrounded fly |
1207 |
SwFrmFmt* pFlyFmt = pFlyCnt->GetFlyCnt().GetFrmFmt(); |
1208 |
const SwNodeIndex* pFlySNd = pFlyFmt->GetCntnt().GetCntntIdx(); |
1209 |
SwNodeRange aRg( *pFlySNd, 1, |
1210 |
*pFlySNd->GetNode().EndOfSectionNode(), 0 ); |
1211 |
|
1212 |
// merge the itemsets |
1213 |
SwFmtFrmSize aSz1( (SwFmtFrmSize&)pFlyFmt->GetAttrSet(). |
1214 |
Get( RES_FRM_SIZE )); |
1215 |
SwFmtFrmSize aSz2( (SwFmtFrmSize&)pFlySave->aFlySet. |
1216 |
Get( RES_FRM_SIZE )); |
1217 |
// if |
1218 |
if( !aRg.aStart.GetNode().IsNoTxtNode() || |
1219 |
!aSz1.GetHeight() || !aSz1.GetWidth() || |
1220 |
!aSz2.GetHeight() || !aSz2.GetWidth() || |
1221 |
( aSz1.GetHeight() == aSz2.GetHeight() && |
1222 |
aSz1.GetWidth() == aSz2.GetWidth() ) ) |
1223 |
{ |
1224 |
SfxItemSet aDiffs( pFlyFmt->GetAttrSet() ); |
1225 |
aDiffs.ClearItem( RES_ANCHOR ); |
1226 |
aDiffs.ClearItem( RES_FRM_SIZE ); |
1227 |
aDiffs.ClearItem( RES_CNTNT ); |
1228 |
aDiffs.Differentiate( pFlySave->aFlySet ); |
1229 |
pFlySave->aFlySet.Put( aDiffs ); |
1230 |
|
1231 |
BOOL bSet = FALSE; |
1232 |
if( aSz1.GetHeight() && !aSz2.GetHeight() ) |
1233 |
{ |
1234 |
bSet = TRUE; |
1235 |
aSz2.SetHeight( aSz1.GetHeight() ); |
1236 |
} |
1237 |
if( aSz1.GetWidth() && !aSz2.GetWidth() ) |
1238 |
{ |
1239 |
bSet = TRUE; |
1240 |
aSz2.SetWidth( aSz1.GetWidth() ); |
1241 |
} |
1242 |
if( bSet ) |
1243 |
pFlySave->aFlySet.Put( aSz2 ); |
1244 |
|
1245 |
// move any PageBreak/Desc Attr to the next Para |
1246 |
{ |
1247 |
SwCntntNode* pSrcNd = pFlySave->nSttNd.GetNode().GetCntntNode(); |
1248 |
SwCntntNode* pDstNd = pFlySave->nEndNd.GetNode().GetCntntNode(); |
1249 |
|
1250 |
::lcl_CpyBreakAttrs( pSrcNd, pDstNd, &pFlySave->nEndNd ); |
1251 |
} |
1252 |
|
1253 |
// create new txtnode, because the section does never be empty |
1254 |
pDoc->GetNodes().MakeTxtNode( aRg.aStart, |
1255 |
(SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() ); |
1256 |
|
1257 |
SwNodeIndex aTmp( pFlySave->nSttNd, +1 ); |
1258 |
pDoc->Move( aRg, aTmp ); |
1259 |
|
1260 |
// now delete the redundant txtnode |
1261 |
pDoc->GetNodes().Delete( pFlySave->nSttNd, 1 ); |
1262 |
} |
1263 |
} |
1264 |
} |
1265 |
} |
1266 |
|
1267 |
bReadSwFly = FALSE; |
1268 |
SkipToken( -1 ); |
1269 |
} |
1293 |
} |
1270 |
|
1294 |
#endif |
1271 |
|
1295 |
|
1272 |
void SwRTFParser::InsPicture( const String& rGrfNm, const Graphic* pGrf, |
1296 |
void SwRTFParser::InsPicture( const String& rGrfNm, const Graphic* pGrf, |
1273 |
const SvxRTFPictureType* pPicType ) |
1297 |
const SvxRTFPictureType* pPicType ) |
Lines 1473-1479
Link Here
|
1473 |
rSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aSize.Width(), aSize.Height() )); |
1497 |
rSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aSize.Width(), aSize.Height() )); |
1474 |
} |
1498 |
} |
1475 |
|
1499 |
|
1476 |
void SwRTFParser::GetPageSize( Size& rSize ) |
1500 |
void SwRTFParser::GetPageSize(Size& rSize) const |
1477 |
{ |
1501 |
{ |
1478 |
ASSERT(!maSegments.empty(), "not possible"); |
1502 |
ASSERT(!maSegments.empty(), "not possible"); |
1479 |
if (maSegments.empty()) |
1503 |
if (maSegments.empty()) |