Lines 172-180
Link Here
|
172 |
Writer& OutWW8_SwGrfNode( Writer& rWrt, SwCntntNode& rNode ) |
172 |
Writer& OutWW8_SwGrfNode( Writer& rWrt, SwCntntNode& rNode ) |
173 |
{ |
173 |
{ |
174 |
SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt; |
174 |
SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt; |
175 |
rWW8Wrt.OutGrf( rNode.GetGrfNode() ); |
175 |
ASSERT(rWW8Wrt.mpParentFrame, "frame not set!"); |
176 |
|
176 |
if (rWW8Wrt.mpParentFrame) |
177 |
rWW8Wrt.pFib->fHasPic = 1; |
177 |
{ |
|
|
178 |
rWW8Wrt.OutGrf(*rWW8Wrt.mpParentFrame); |
179 |
rWW8Wrt.pFib->fHasPic = 1; |
180 |
} |
178 |
|
181 |
|
179 |
return rWrt; |
182 |
return rWrt; |
180 |
} |
183 |
} |
Lines 259-409
Link Here
|
259 |
{ |
262 |
{ |
260 |
using namespace ww; |
263 |
using namespace ww; |
261 |
SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt; |
264 |
SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt; |
262 |
if( !(rWW8Wrt.GetIniFlags() & WWFL_NO_OLE ) ) |
265 |
BYTE *pSpecOLE; |
|
|
266 |
BYTE *pDataAdr; |
267 |
short nSize; |
268 |
static BYTE aSpecOLE_WW8[] = { |
269 |
0x03, 0x6a, 0, 0, 0, 0, // sprmCPicLocation |
270 |
0x0a, 0x08, 1, // sprmCFOLE2 |
271 |
0x56, 0x08, 1 // sprmCFObj |
272 |
}; |
273 |
static BYTE aSpecOLE_WW6[] = { |
274 |
68, 4, 0, 0, 0, 0, // sprmCPicLocation (len is 4) |
275 |
75, 1, // sprmCFOLE2 |
276 |
118, 1 // sprmCFObj |
277 |
}; |
278 |
|
279 |
if( rWW8Wrt.bWrtWW8 ) |
263 |
{ |
280 |
{ |
264 |
BYTE *pSpecOLE; |
281 |
pSpecOLE = aSpecOLE_WW8; |
265 |
BYTE *pDataAdr; |
282 |
nSize = sizeof( aSpecOLE_WW8 ); |
266 |
short nSize; |
283 |
} |
267 |
static BYTE aSpecOLE_WW8[] = { |
284 |
else |
268 |
0x03, 0x6a, 0, 0, 0, 0, // sprmCPicLocation |
285 |
{ |
269 |
0x0a, 0x08, 1, // sprmCFOLE2 |
286 |
pSpecOLE = aSpecOLE_WW6; |
270 |
0x56, 0x08, 1 // sprmCFObj |
287 |
nSize = sizeof( aSpecOLE_WW6 ); |
271 |
}; |
288 |
} |
272 |
static BYTE aSpecOLE_WW6[] = { |
289 |
pDataAdr = pSpecOLE + 2; //WW6 sprm is 1 but has 1 byte len as well. |
273 |
68, 4, 0, 0, 0, 0, // sprmCPicLocation (len is 4) |
290 |
SwOLENode *pOLENd = rNode.GetOLENode(); |
274 |
75, 1, // sprmCFOLE2 |
|
|
275 |
118, 1 // sprmCFObj |
276 |
}; |
277 |
|
291 |
|
278 |
if( rWW8Wrt.bWrtWW8 ) |
292 |
SvStorageRef xObjStg = rWW8Wrt.GetStorage().OpenStorage( |
279 |
{ |
293 |
CREATE_CONST_ASC(SL::aObjectPool), STREAM_READWRITE | |
280 |
pSpecOLE = aSpecOLE_WW8; |
294 |
STREAM_SHARE_DENYALL ); |
281 |
nSize = sizeof( aSpecOLE_WW8 ); |
295 |
|
282 |
} |
296 |
if( xObjStg.Is() ) |
283 |
else |
297 |
{ |
284 |
{ |
298 |
SvInPlaceObjectRef xObj(pOLENd->GetOLEObj().GetOleRef()); |
285 |
pSpecOLE = aSpecOLE_WW6; |
299 |
if( xObj.Is() ) |
286 |
nSize = sizeof( aSpecOLE_WW6 ); |
300 |
{ |
287 |
} |
301 |
SvInPlaceObject *pObj = &xObj; |
288 |
pDataAdr = pSpecOLE + 2; //WW6 sprm is 1 but has 1 byte len as well. |
302 |
UINT32 nPictureId = (UINT32)pObj; |
289 |
SwOLENode *pOLENd = rNode.GetOLENode(); |
303 |
Set_UInt32(pDataAdr, nPictureId); |
|
|
304 |
|
305 |
WW8OleMap *pMap = new WW8OleMap(nPictureId); |
306 |
bool bDuplicate = false; |
307 |
WW8OleMaps &rOleMap = rWW8Wrt.GetOLEMap(); |
308 |
USHORT nPos; |
309 |
if ( rOleMap.Seek_Entry(pMap, &nPos) ) |
310 |
{ |
311 |
bDuplicate = true; |
312 |
delete pMap; |
313 |
} |
314 |
else if( 0 == rOleMap.Insert( pMap) ) |
315 |
delete pMap; |
290 |
|
316 |
|
291 |
SvStorageRef xObjStg = rWW8Wrt.GetStorage().OpenStorage( |
317 |
String sStorageName( '_' ); |
292 |
CREATE_CONST_ASC(SL::aObjectPool), STREAM_READWRITE | |
318 |
sStorageName += String::CreateFromInt32( nPictureId ); |
293 |
STREAM_SHARE_DENYALL ); |
319 |
SvStorageRef xOleStg = xObjStg->OpenStorage( sStorageName, |
294 |
|
320 |
STREAM_READWRITE| STREAM_SHARE_DENYALL ); |
295 |
if( xObjStg.Is() ) |
321 |
if( xOleStg.Is() ) |
296 |
{ |
322 |
{ |
297 |
SvInPlaceObjectRef xObj(pOLENd->GetOLEObj().GetOleRef()); |
323 |
/* |
298 |
if( xObj.Is() ) |
324 |
If this object storage has been written already don't |
299 |
{ |
325 |
waste time rewriting it |
300 |
SvInPlaceObject *pObj = &xObj; |
326 |
*/ |
301 |
UINT32 nPictureId = (UINT32)pObj; |
327 |
if (!bDuplicate) |
302 |
Set_UInt32(pDataAdr, nPictureId); |
328 |
rWW8Wrt.GetOLEExp().ExportOLEObject(*pObj, *xOleStg); |
303 |
|
329 |
|
304 |
WW8OleMap *pMap = new WW8OleMap(nPictureId); |
330 |
// write as embedded field - the other things will be done |
305 |
bool bDuplicate = false; |
331 |
// in the escher export |
306 |
WW8OleMaps &rOleMap = rWW8Wrt.GetOLEMap(); |
332 |
String sServer(FieldString(eEMBED)); |
307 |
USHORT nPos; |
333 |
sServer += xOleStg->GetUserName(); |
308 |
if ( rOleMap.Seek_Entry(pMap, &nPos) ) |
334 |
sServer += ' '; |
309 |
{ |
335 |
|
310 |
bDuplicate = true; |
336 |
rWW8Wrt.OutField(0, eEMBED, sServer, WRITEFIELD_START | |
311 |
delete pMap; |
337 |
WRITEFIELD_CMD_START | WRITEFIELD_CMD_END); |
312 |
} |
338 |
|
313 |
else if( 0 == rOleMap.Insert( pMap) ) |
339 |
rWW8Wrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(), |
314 |
delete pMap; |
340 |
nSize, pSpecOLE ); |
|
|
341 |
|
342 |
bool bEndCR = true; |
343 |
/* |
344 |
In the word filter we only need a preview image for |
345 |
floating images, and then only (the usual case) if the |
346 |
object doesn't contain enough information to reconstruct |
347 |
what we need. |
348 |
|
349 |
We don't need a graphic for inline objects, so we don't |
350 |
even need the overhead of a graphic in that case. |
351 |
*/ |
352 |
bool bGraphicNeeded = false; |
315 |
|
353 |
|
316 |
String sStorageName( '_' ); |
354 |
if (rWW8Wrt.mpParentFrame) |
317 |
sStorageName += String::CreateFromInt32( nPictureId ); |
|
|
318 |
SvStorageRef xOleStg = xObjStg->OpenStorage( sStorageName, |
319 |
STREAM_READWRITE| STREAM_SHARE_DENYALL ); |
320 |
if( xOleStg.Is() ) |
321 |
{ |
355 |
{ |
322 |
/* |
356 |
bGraphicNeeded = true; |
323 |
If this object storage has been written already don't |
|
|
324 |
waste time rewriting it |
325 |
*/ |
326 |
if (!bDuplicate) |
327 |
rWW8Wrt.GetOLEExp().ExportOLEObject(*pObj, *xOleStg); |
328 |
|
329 |
// write as embedded field - the other things will be done |
330 |
// in the escher export |
331 |
String sServer(FieldString(eEMBED)); |
332 |
sServer += xOleStg->GetUserName(); |
333 |
sServer += ' '; |
334 |
|
335 |
rWW8Wrt.OutField(0, eEMBED, sServer, WRITEFIELD_START | |
336 |
WRITEFIELD_CMD_START | WRITEFIELD_CMD_END); |
337 |
|
357 |
|
338 |
rWW8Wrt.pChpPlc->AppendFkpEntry( rWrt.Strm().Tell(), |
358 |
if (rWW8Wrt.mpParentFrame->IsInline()) |
339 |
nSize, pSpecOLE ); |
|
|
340 |
|
341 |
bool bEndCR = true; |
342 |
/* |
343 |
In the word filter we only need a preview image for |
344 |
floating images, and then only (the usual case) if the |
345 |
object doesn't contain enough information to reconstruct |
346 |
what we need. |
347 |
|
348 |
We don't need a graphic for inline objects, so we don't |
349 |
even need the overhead of a graphic in that case. |
350 |
*/ |
351 |
bool bGraphicNeeded = false; |
352 |
|
353 |
if (rWW8Wrt.pFlyFmt) |
354 |
{ |
359 |
{ |
355 |
bGraphicNeeded = true; |
360 |
const SwAttrSet& rSet = |
356 |
|
361 |
rWW8Wrt.mpParentFrame->GetFrmFmt().GetAttrSet(); |
357 |
const SwAttrSet& rSet = rWW8Wrt.pFlyFmt->GetAttrSet(); |
362 |
bEndCR = false; |
358 |
if (rSet.GetAnchor(false).GetAnchorId() == FLY_IN_CNTNT) |
363 |
bGraphicNeeded = rWW8Wrt.TestOleNeedsGraphic(rSet, |
359 |
{ |
364 |
xOleStg, xObjStg, sStorageName, pOLENd); |
360 |
bEndCR = false; |
|
|
361 |
bGraphicNeeded = rWW8Wrt.TestOleNeedsGraphic(rSet, |
362 |
xOleStg, xObjStg, sStorageName, pOLENd); |
363 |
} |
364 |
} |
365 |
} |
|
|
366 |
} |
365 |
|
367 |
|
366 |
if (!bGraphicNeeded) |
368 |
if (!bGraphicNeeded) |
367 |
rWW8Wrt.WriteChar(0x1); |
369 |
rWW8Wrt.WriteChar(0x1); |
368 |
else |
370 |
else |
369 |
{ |
371 |
{ |
370 |
/* |
372 |
/* |
371 |
##897## |
373 |
##897## |
372 |
We need to insert the graphic representation of |
374 |
We need to insert the graphic representation of |
373 |
this object for the inline case, otherwise word |
375 |
this object for the inline case, otherwise word |
374 |
has no place to find the dimensions of the ole |
376 |
has no place to find the dimensions of the ole |
375 |
object, and will not be able to draw it |
377 |
object, and will not be able to draw it |
376 |
*/ |
378 |
*/ |
377 |
rWW8Wrt.OutGrf(rNode.GetOLENode()); |
379 |
rWW8Wrt.OutGrf(*rWW8Wrt.mpParentFrame); |
378 |
} |
380 |
} |
379 |
|
381 |
|
380 |
rWW8Wrt.OutField(0, eEMBED, aEmptyStr, |
382 |
rWW8Wrt.OutField(0, eEMBED, aEmptyStr, |
381 |
WRITEFIELD_END | WRITEFIELD_CLOSE); |
383 |
WRITEFIELD_END | WRITEFIELD_CLOSE); |
382 |
|
384 |
|
383 |
if (bEndCR) //No newline in inline case |
385 |
if (bEndCR) //No newline in inline case |
384 |
rWW8Wrt.WriteCR(); |
386 |
rWW8Wrt.WriteCR(); |
385 |
} |
|
|
386 |
} |
387 |
} |
387 |
} |
388 |
} |
388 |
else //Only for the case that ole objects are not to be exported |
|
|
389 |
rWW8Wrt.OutGrf( rNode.GetOLENode() ); |
390 |
} |
389 |
} |
391 |
return rWrt; |
390 |
return rWrt; |
392 |
} |
391 |
} |
393 |
|
392 |
|
394 |
void SwWW8Writer::OutGrf( const SwNoTxtNode* pNd ) |
393 |
void SwWW8Writer::OutGrf(const sw::Frame &rFrame) |
395 |
{ |
394 |
{ |
396 |
if( nIniFlags & WWFL_NO_GRAF ) |
|
|
397 |
return; // Iniflags: kein Grafik-Export |
398 |
|
399 |
if( !pFlyFmt ) // Grafik mit eigenem Frame ( eigentlich immer ) |
400 |
{ |
401 |
ASSERT( !this, "+Grafik ohne umgebenden Fly" ); |
402 |
return ; |
403 |
} |
404 |
|
405 |
// GrfNode fuer spaeteres rausschreiben der Grafik merken |
395 |
// GrfNode fuer spaeteres rausschreiben der Grafik merken |
406 |
pGrf->Insert( pNd, pFlyFmt ); |
396 |
pGrf->Insert(rFrame); |
407 |
|
397 |
|
408 |
pChpPlc->AppendFkpEntry( pStrm->Tell(), pO->Count(), pO->GetData() ); |
398 |
pChpPlc->AppendFkpEntry( pStrm->Tell(), pO->Count(), pO->GetData() ); |
409 |
pO->Remove( 0, pO->Count() ); // leeren |
399 |
pO->Remove( 0, pO->Count() ); // leeren |
Lines 413-422
Link Here
|
413 |
BYTE aArr[ 18 ]; |
403 |
BYTE aArr[ 18 ]; |
414 |
BYTE* pArr = aArr; |
404 |
BYTE* pArr = aArr; |
415 |
|
405 |
|
416 |
RndStdIds eAn = pFlyFmt->GetAttrSet().GetAnchor(false).GetAnchorId(); |
406 |
const SwFrmFmt &rFlyFmt = rFrame.GetFrmFmt(); |
|
|
407 |
RndStdIds eAn = rFlyFmt.GetAttrSet().GetAnchor(false).GetAnchorId(); |
417 |
if( eAn == FLY_IN_CNTNT ) |
408 |
if( eAn == FLY_IN_CNTNT ) |
418 |
{ |
409 |
{ |
419 |
SwVertOrient eVert = pFlyFmt->GetVertOrient().GetVertOrient(); |
410 |
SwVertOrient eVert = rFlyFmt.GetVertOrient().GetVertOrient(); |
420 |
if ((eVert == VERT_CHAR_CENTER) || (eVert == VERT_LINE_CENTER)) |
411 |
if ((eVert == VERT_CHAR_CENTER) || (eVert == VERT_LINE_CENTER)) |
421 |
{ |
412 |
{ |
422 |
bool bVert = false; |
413 |
bool bVert = false; |
Lines 430-436
Link Here
|
430 |
} |
421 |
} |
431 |
if (!bVert) |
422 |
if (!bVert) |
432 |
{ |
423 |
{ |
433 |
SwTwips nHeight = pFlyFmt->GetFrmSize().GetHeight(); |
424 |
SwTwips nHeight = rFlyFmt.GetFrmSize().GetHeight(); |
434 |
nHeight/=20; //nHeight was in twips, want it in half points, but |
425 |
nHeight/=20; //nHeight was in twips, want it in half points, but |
435 |
//then half of total height. |
426 |
//then half of total height. |
436 |
long nFontHeight = ((const SvxFontHeightItem&) |
427 |
long nFontHeight = ((const SvxFontHeightItem&) |
Lines 480-486
Link Here
|
480 |
bool bOldGrf = bOutGrf; |
471 |
bool bOldGrf = bOutGrf; |
481 |
bOutGrf = true; |
472 |
bOutGrf = true; |
482 |
|
473 |
|
483 |
Out_SwFmt(*pFlyFmt, false, false, true); // Fly-Attrs |
474 |
Out_SwFmt(rFrame.GetFrmFmt(), false, false, true); // Fly-Attrs |
484 |
|
475 |
|
485 |
bOutGrf = bOldGrf; |
476 |
bOutGrf = bOldGrf; |
486 |
pPapPlc->AppendFkpEntry( pStrm->Tell(), pO->Count(), pO->GetData() ); |
477 |
pPapPlc->AppendFkpEntry( pStrm->Tell(), pO->Count(), pO->GetData() ); |
Lines 488-539
Link Here
|
488 |
} |
479 |
} |
489 |
} |
480 |
} |
490 |
|
481 |
|
491 |
static Size lcl_GetSwappedInSize(const SwNoTxtNode& rNd) |
482 |
void SwWW8WrGrf::Insert(const sw::Frame &rFly) |
492 |
{ |
483 |
{ |
493 |
Size aGrTwipSz(rNd.GetTwipSize()); |
484 |
const SwNoTxtNode *pNd = |
494 |
//JP 05.12.98: falls die Grafik noch nie angezeigt wurde und es sich |
485 |
rFly.GetContent() ? rFly.GetContent()->GetNoTxtNode() : 0; |
495 |
// um eine gelinkte handelt, so ist keine Size gesetzt. In |
|
|
496 |
// diesem Fall sollte man sie mal reinswappen. |
497 |
if ( |
498 |
(!aGrTwipSz.Width() || !aGrTwipSz.Height()) && |
499 |
rNd.IsGrfNode() && |
500 |
GRAPHIC_NONE != ((const SwGrfNode&)rNd).GetGrf().GetType() |
501 |
) |
502 |
{ |
503 |
((SwGrfNode&)rNd).SwapIn(); |
504 |
aGrTwipSz = rNd.GetTwipSize(); |
505 |
} |
506 |
|
507 |
return aGrTwipSz; |
508 |
} |
509 |
|
486 |
|
510 |
void SwWW8WrGrf::Insert( const SwNoTxtNode* pNd, const SwFlyFrmFmt* pFly ) |
|
|
511 |
{ |
512 |
UINT16 nWidth; |
487 |
UINT16 nWidth; |
513 |
UINT16 nHeight; |
488 |
UINT16 nHeight; |
514 |
if( rWrt.nFlyWidth > 0 && rWrt.nFlyHeight > 0 ) |
489 |
if (rWrt.nFlyWidth > 0 && rWrt.nFlyHeight > 0) |
515 |
{ |
490 |
{ |
516 |
nWidth = (UINT16)rWrt.nFlyWidth; |
491 |
nWidth = rWrt.nFlyWidth; |
517 |
nHeight = (UINT16)rWrt.nFlyHeight; |
492 |
nHeight = rWrt.nFlyHeight; |
518 |
} |
493 |
} |
519 |
else if (pNd) |
494 |
else |
520 |
{ |
495 |
{ |
521 |
Size aGrTwipSz(lcl_GetSwappedInSize(*pNd)); |
496 |
Size aSize(rFly.GetSize()); |
522 |
nWidth = (UINT16)aGrTwipSz.Width(); |
497 |
nWidth = aSize.Width(); |
523 |
nHeight = (UINT16)aGrTwipSz.Height(); |
498 |
nHeight = aSize.Height(); |
524 |
} |
499 |
} |
525 |
|
500 |
maDetails.push_back(GraphicDetails(rFly, nWidth, nHeight)); |
526 |
maDetails.push_back(GraphicDetails(pNd, pFly, nWidth, nHeight)); |
|
|
527 |
} |
501 |
} |
528 |
|
502 |
|
529 |
void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const SwNoTxtNode* pNd, |
503 |
void SwWW8WrGrf::WritePICFHeader(SvStream& rStrm, const sw::Frame &rFly, |
530 |
const SwFlyFrmFmt* pFly, UINT16 mm, UINT16 nWidth, UINT16 nHeight) |
504 |
UINT16 mm, UINT16 nWidth, UINT16 nHeight, const SwAttrSet* pAttrSet) |
531 |
{ |
505 |
{ |
532 |
INT16 nXSizeAdd = 0, nYSizeAdd = 0; |
506 |
INT16 nXSizeAdd = 0, nYSizeAdd = 0; |
533 |
INT16 nCropL = 0, nCropR = 0, nCropT = 0, nCropB = 0; |
507 |
INT16 nCropL = 0, nCropR = 0, nCropT = 0, nCropB = 0; |
534 |
|
508 |
|
535 |
// Crop-AttributInhalt in Header schreiben ( falls vorhanden ) |
509 |
// Crop-AttributInhalt in Header schreiben ( falls vorhanden ) |
536 |
const SwAttrSet* pAttrSet = pNd->GetpSwAttrSet(); |
|
|
537 |
const SfxPoolItem* pItem; |
510 |
const SfxPoolItem* pItem; |
538 |
if (pAttrSet && (SFX_ITEM_ON |
511 |
if (pAttrSet && (SFX_ITEM_ON |
539 |
== pAttrSet->GetItemState(RES_GRFATR_CROPGRF, false, &pItem))) |
512 |
== pAttrSet->GetItemState(RES_GRFATR_CROPGRF, false, &pItem))) |
Lines 547-615
Link Here
|
547 |
nYSizeAdd -= (INT16)( rCr.GetTop() + rCr.GetBottom() ); |
520 |
nYSizeAdd -= (INT16)( rCr.GetTop() + rCr.GetBottom() ); |
548 |
} |
521 |
} |
549 |
|
522 |
|
550 |
Size aGrTwipSz(lcl_GetSwappedInSize(*pNd)); |
523 |
Size aGrTwipSz(rFly.GetSize()); |
551 |
bool bWrtWW8 = rWrt.bWrtWW8; |
524 |
bool bWrtWW8 = rWrt.bWrtWW8; |
552 |
UINT16 nHdrLen = bWrtWW8 ? 0x44 : 0x3A; |
525 |
UINT16 nHdrLen = bWrtWW8 ? 0x44 : 0x3A; |
553 |
|
526 |
|
554 |
BYTE aArr[ 0x44 ] = { 0 }; |
527 |
BYTE aArr[ 0x44 ] = { 0 }; |
555 |
|
528 |
|
556 |
BYTE* pArr = aArr + 0x2E; //Do borders first |
529 |
BYTE* pArr = aArr + 0x2E; //Do borders first |
557 |
if( pFly ) |
530 |
|
|
|
531 |
const SwAttrSet& rAttrSet = rFly.GetFrmFmt().GetAttrSet(); |
532 |
if (SFX_ITEM_ON == rAttrSet.GetItemState(RES_BOX, false, &pItem)) |
558 |
{ |
533 |
{ |
559 |
const SwAttrSet& rAttrSet = pFly->GetAttrSet(); |
534 |
const SvxBoxItem* pBox = (const SvxBoxItem*)pItem; |
560 |
if (SFX_ITEM_ON == rAttrSet.GetItemState(RES_BOX, false, &pItem)) |
535 |
if( pBox ) |
561 |
{ |
536 |
{ |
562 |
const SvxBoxItem* pBox = (const SvxBoxItem*)pItem; |
537 |
bool bShadow = false; // Shadow ? |
563 |
if( pBox ) |
538 |
const SvxShadowItem* pSI = |
|
|
539 |
sw::util::HasItem<SvxShadowItem>(rAttrSet, RES_SHADOW); |
540 |
if (pSI) |
564 |
{ |
541 |
{ |
565 |
bool bShadow = false; // Shadow ? |
542 |
bShadow = (pSI->GetLocation() != SVX_SHADOW_NONE) && |
566 |
const SvxShadowItem* pSI = |
543 |
(pSI->GetWidth() != 0); |
567 |
sw::util::HasItem<SvxShadowItem>(rAttrSet, RES_SHADOW); |
544 |
} |
568 |
if (pSI) |
545 |
|
|
|
546 |
BYTE aLnArr[4] = { BOX_LINE_TOP, BOX_LINE_LEFT, |
547 |
BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; |
548 |
for( BYTE i = 0; i < 4; ++i ) |
549 |
{ |
550 |
const SvxBorderLine* pLn = pBox->GetLine( aLnArr[ i ] ); |
551 |
WW8_BRC aBrc; |
552 |
if (pLn) |
569 |
{ |
553 |
{ |
570 |
bShadow = (pSI->GetLocation() != SVX_SHADOW_NONE) && |
554 |
aBrc = rWrt.TranslateBorderLine( *pLn, |
571 |
(pSI->GetWidth() != 0); |
555 |
pBox->GetDistance( aLnArr[ i ] ), bShadow ); |
572 |
} |
556 |
} |
573 |
|
557 |
|
574 |
BYTE aLnArr[4] = { BOX_LINE_TOP, BOX_LINE_LEFT, |
558 |
//use importer logic to determine how large the exported |
575 |
BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; |
559 |
//border will really be in word and adjust accordingly |
576 |
for( BYTE i = 0; i < 4; ++i ) |
560 |
short nSpacing; |
|
|
561 |
short nThick = aBrc.DetermineBorderProperties(!bWrtWW8, |
562 |
&nSpacing); |
563 |
switch (aLnArr[ i ]) |
577 |
{ |
564 |
{ |
578 |
const SvxBorderLine* pLn = pBox->GetLine( aLnArr[ i ] ); |
565 |
case BOX_LINE_TOP: |
579 |
WW8_BRC aBrc; |
566 |
case BOX_LINE_BOTTOM: |
580 |
if (pLn) |
567 |
nHeight -= bShadow ? nThick*2 : nThick; |
581 |
{ |
568 |
nHeight -= nSpacing; |
582 |
aBrc = rWrt.TranslateBorderLine( *pLn, |
569 |
break; |
583 |
pBox->GetDistance( aLnArr[ i ] ), bShadow ); |
570 |
case BOX_LINE_LEFT: |
584 |
} |
571 |
case BOX_LINE_RIGHT: |
|
|
572 |
default: |
573 |
nWidth -= bShadow ? nThick*2 : nThick; |
574 |
nWidth -= nSpacing; |
575 |
break; |
576 |
} |
577 |
memcpy( pArr, &aBrc.aBits1, 2); |
578 |
pArr+=2; |
585 |
|
579 |
|
586 |
//use importer logic to determine how large the exported |
580 |
if( bWrtWW8 ) |
587 |
//border will really be in word and adjust accordingly |
581 |
{ |
588 |
short nSpacing; |
582 |
memcpy( pArr, &aBrc.aBits2, 2); |
589 |
short nThick = aBrc.DetermineBorderProperties(!bWrtWW8, |
|
|
590 |
&nSpacing); |
591 |
switch (aLnArr[ i ]) |
592 |
{ |
593 |
case BOX_LINE_TOP: |
594 |
case BOX_LINE_BOTTOM: |
595 |
nHeight -= bShadow ? nThick*2 : nThick; |
596 |
nHeight -= nSpacing; |
597 |
break; |
598 |
case BOX_LINE_LEFT: |
599 |
case BOX_LINE_RIGHT: |
600 |
default: |
601 |
nWidth -= bShadow ? nThick*2 : nThick; |
602 |
nWidth -= nSpacing; |
603 |
break; |
604 |
} |
605 |
memcpy( pArr, &aBrc.aBits1, 2); |
606 |
pArr+=2; |
583 |
pArr+=2; |
607 |
|
|
|
608 |
if( bWrtWW8 ) |
609 |
{ |
610 |
memcpy( pArr, &aBrc.aBits2, 2); |
611 |
pArr+=2; |
612 |
} |
613 |
} |
584 |
} |
614 |
} |
585 |
} |
615 |
} |
586 |
} |
Lines 662-675
Link Here
|
662 |
rStrm.Write( aArr, nHdrLen ); |
633 |
rStrm.Write( aArr, nHdrLen ); |
663 |
} |
634 |
} |
664 |
|
635 |
|
665 |
void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode* pGrfNd, |
636 |
void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd, |
666 |
const SwFlyFrmFmt* pFly, UINT16 nWidth, UINT16 nHeight) |
637 |
const sw::Frame &rFly, UINT16 nWidth, UINT16 nHeight) |
667 |
{ |
638 |
{ |
668 |
if (pGrfNd->IsLinkedFile()) // Linked File |
639 |
if (rGrfNd.IsLinkedFile()) // Linked File |
669 |
{ |
640 |
{ |
670 |
String aFileN, aFiltN; |
641 |
String aFileN, aFiltN; |
671 |
UINT16 mm; |
642 |
UINT16 mm; |
672 |
pGrfNd->GetFileFilterNms( &aFileN, &aFiltN ); |
643 |
rGrfNd.GetFileFilterNms( &aFileN, &aFiltN ); |
673 |
|
644 |
|
674 |
aFileN = INetURLObject::AbsToRel( aFileN, INetURLObject::WAS_ENCODED, |
645 |
aFileN = INetURLObject::AbsToRel( aFileN, INetURLObject::WAS_ENCODED, |
675 |
INetURLObject::DECODE_UNAMBIGUOUS); |
646 |
INetURLObject::DECODE_UNAMBIGUOUS); |
Lines 686-710
Link Here
|
686 |
// else |
657 |
// else |
687 |
mm = 94; // 94 = BMP, GIF |
658 |
mm = 94; // 94 = BMP, GIF |
688 |
|
659 |
|
689 |
WritePICFHeader(rStrm, pGrfNd, pFly, mm, nWidth, nHeight); // Header |
660 |
WritePICFHeader(rStrm, rFly, mm, nWidth, nHeight, |
|
|
661 |
rGrfNd.GetpSwAttrSet()); |
690 |
rStrm << (BYTE)aFileN.Len(); // Pascal-String schreiben |
662 |
rStrm << (BYTE)aFileN.Len(); // Pascal-String schreiben |
691 |
SwWW8Writer::WriteString8(rStrm, aFileN, false, |
663 |
SwWW8Writer::WriteString8(rStrm, aFileN, false, |
692 |
RTL_TEXTENCODING_MS_1252); |
664 |
RTL_TEXTENCODING_MS_1252); |
693 |
} |
665 |
} |
694 |
else // Embedded File oder DDE oder so was |
666 |
else // Embedded File oder DDE oder so was |
695 |
{ |
667 |
{ |
696 |
if (rWrt.bWrtWW8 && pFly) |
668 |
if (rWrt.bWrtWW8) |
697 |
{ |
669 |
{ |
698 |
WritePICFHeader(rStrm, pGrfNd, pFly, 0x64, nWidth, nHeight); |
670 |
WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight, |
|
|
671 |
rGrfNd.GetpSwAttrSet()); |
699 |
SwBasicEscherEx aInlineEscher(&rStrm, rWrt); |
672 |
SwBasicEscherEx aInlineEscher(&rStrm, rWrt); |
700 |
aInlineEscher.WriteGrfFlyFrame(*pFly, 0x401); |
673 |
aInlineEscher.WriteGrfFlyFrame(rFly.GetFrmFmt(), 0x401); |
701 |
aInlineEscher.WritePictures(); |
674 |
aInlineEscher.WritePictures(); |
702 |
} |
675 |
} |
703 |
else |
676 |
else |
704 |
{ |
677 |
{ |
705 |
Graphic& rGrf = (Graphic&)(pGrfNd->GetGrf()); |
678 |
Graphic& rGrf = const_cast<Graphic&>(rGrfNd.GetGrf()); |
706 |
bool bSwapped = rGrf.IsSwapOut() ? true : false; |
679 |
bool bSwapped = rGrf.IsSwapOut() ? true : false; |
707 |
((SwGrfNode*)pGrfNd)->SwapIn(); // immer ueber den Node einswappen! |
680 |
// immer ueber den Node einswappen! |
|
|
681 |
const_cast<SwGrfNode&>(rGrfNd).SwapIn(); |
708 |
|
682 |
|
709 |
GDIMetaFile aMeta; |
683 |
GDIMetaFile aMeta; |
710 |
switch (rGrf.GetType()) |
684 |
switch (rGrf.GetType()) |
Lines 727-733
Link Here
|
727 |
return; |
701 |
return; |
728 |
} |
702 |
} |
729 |
|
703 |
|
730 |
WritePICFHeader(rStrm, pGrfNd, pFly, 8, nWidth, nHeight); |
704 |
WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight, |
|
|
705 |
rGrfNd.GetpSwAttrSet()); |
731 |
WriteWindowMetafileBits(rStrm, aMeta); |
706 |
WriteWindowMetafileBits(rStrm, aMeta); |
732 |
|
707 |
|
733 |
if (bSwapped) |
708 |
if (bSwapped) |
Lines 736-758
Link Here
|
736 |
} |
711 |
} |
737 |
} |
712 |
} |
738 |
|
713 |
|
739 |
void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const SwNoTxtNode* pNd, |
714 |
void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem) |
740 |
const SwFlyFrmFmt* pFly, UINT16 nWidth, UINT16 nHeight) |
|
|
741 |
{ |
715 |
{ |
742 |
if (!pNd || (!pNd->IsGrfNode() && !pNd->IsOLENode())) |
716 |
UINT16 nWidth = rItem.mnWid; |
743 |
return; |
717 |
UINT16 nHeight = rItem.mnHei; |
744 |
|
|
|
745 |
UINT32 nPos = rStrm.Tell(); // Grafik-Anfang merken |
718 |
UINT32 nPos = rStrm.Tell(); // Grafik-Anfang merken |
746 |
|
719 |
|
747 |
if (pNd->IsGrfNode()) |
720 |
const sw::Frame &rFly = rItem.maFly; |
748 |
WriteGrfFromGrfNode(rStrm, pNd->GetGrfNode(), pFly, nWidth, nHeight); |
721 |
switch (rFly.GetWriterType()) |
749 |
else if (pNd->IsOLENode()) |
|
|
750 |
{ |
722 |
{ |
751 |
#ifdef OLE_PREVIEW_AS_EMF |
723 |
case sw::Frame::eGraphic: |
752 |
if (!rWrt.bWrtWW8) |
|
|
753 |
{ |
724 |
{ |
|
|
725 |
const SwNode *pNode = rItem.maFly.GetContent(); |
726 |
const SwGrfNode *pNd = pNode ? pNode->GetGrfNode() : 0; |
727 |
ASSERT(pNd, "Impossible"); |
728 |
if (pNd) |
729 |
WriteGrfFromGrfNode(rStrm, *pNd, rItem.maFly, nWidth, nHeight); |
730 |
} |
731 |
break; |
732 |
case sw::Frame::eOle: |
733 |
{ |
734 |
#ifdef OLE_PREVIEW_AS_EMF |
735 |
const SwNode *pNode = rItem.maFly.GetContent(); |
736 |
const SwOLENode *pNd = pNode ? pNode->GetOLENode() : 0; |
737 |
ASSERT(pNd, "Impossible"); |
738 |
if (!rWrt.bWrtWW8) |
739 |
{ |
740 |
SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd); |
741 |
ASSERT( pOleNd, " Wer hat den OleNode versteckt ?" ); |
742 |
SwOLEObj& rSObj= pOleNd->GetOLEObj(); |
743 |
const SvInPlaceObjectRef rObj( rSObj.GetOleRef() ); |
744 |
|
745 |
GDIMetaFile aMtf; |
746 |
rObj->GetGDIMetaFile(aMtf); |
747 |
|
748 |
aMtf.WindStart(); |
749 |
aMtf.Play(Application::GetDefaultDevice(), Point(0, 0), |
750 |
Size(2880, 2880)); |
751 |
|
752 |
WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight, |
753 |
pNd->GetpSwAttrSet()); |
754 |
WriteWindowMetafileBits(rStrm, aMtf); |
755 |
} |
756 |
else |
757 |
{ |
758 |
//Convert this ole2 preview in ww8+ to an EMF for better unicode |
759 |
//support (note that at this moment this breaks StarSymbol |
760 |
//using graphics because I need to embed starsymbol in exported |
761 |
//documents. |
762 |
WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight, |
763 |
pNd->GetpSwAttrSet()); |
764 |
SwBasicEscherEx aInlineEscher(&rStrm, rWrt); |
765 |
aInlineEscher.WriteOLEFlyFrame(rFly.GetFrmFmt(), 0x401); |
766 |
aInlineEscher.WritePictures(); |
767 |
} |
768 |
#else |
754 |
// cast away const |
769 |
// cast away const |
755 |
SwOLENode *pOleNd = ((SwNoTxtNode*)pNd)->GetOLENode(); |
770 |
SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd); |
756 |
ASSERT( pOleNd, " Wer hat den OleNode versteckt ?" ); |
771 |
ASSERT( pOleNd, " Wer hat den OleNode versteckt ?" ); |
757 |
SwOLEObj& rSObj= pOleNd->GetOLEObj(); |
772 |
SwOLEObj& rSObj= pOleNd->GetOLEObj(); |
758 |
const SvInPlaceObjectRef rObj( rSObj.GetOleRef() ); |
773 |
const SvInPlaceObjectRef rObj( rSObj.GetOleRef() ); |
Lines 760-801
Link Here
|
760 |
GDIMetaFile aMtf; |
775 |
GDIMetaFile aMtf; |
761 |
rObj->GetGDIMetaFile(aMtf); |
776 |
rObj->GetGDIMetaFile(aMtf); |
762 |
|
777 |
|
|
|
778 |
Size aS(aMtf.GetPrefSize()); |
763 |
aMtf.WindStart(); |
779 |
aMtf.WindStart(); |
764 |
aMtf.Play(Application::GetDefaultDevice(), Point(0, 0), |
780 |
aMtf.Play(Application::GetDefaultDevice(), Point(0, 0), |
765 |
Size(2880, 2880)); |
781 |
Size(2880, 2880)); |
766 |
|
|
|
767 |
WritePICFHeader(rStrm, pNd, pFly, 8, nWidth, nHeight); // Header |
768 |
WriteWindowMetafileBits(rStrm, aMtf); |
769 |
} |
770 |
else |
771 |
{ |
772 |
//Convert this ole2 preview in ww8+ to an EMF for better unicode |
773 |
//support (note that at this moment this breaks StarSymbol |
774 |
//using graphics because I need to embed starsymbol in exported |
775 |
//documents. |
776 |
WritePICFHeader(rStrm, pNd, pFly, 0x64, nWidth, nHeight); |
777 |
SwBasicEscherEx aInlineEscher(&rStrm, rWrt); |
778 |
aInlineEscher.WriteOLEFlyFrame(*pFly, 0x401); |
779 |
aInlineEscher.WritePictures(); |
780 |
} |
781 |
#else |
782 |
// cast away const |
783 |
SwOLENode *pOleNd = ((SwNoTxtNode*)pNd)->GetOLENode(); |
784 |
ASSERT( pOleNd, " Wer hat den OleNode versteckt ?" ); |
785 |
SwOLEObj& rSObj= pOleNd->GetOLEObj(); |
786 |
const SvInPlaceObjectRef rObj( rSObj.GetOleRef() ); |
787 |
|
788 |
GDIMetaFile aMtf; |
789 |
rObj->GetGDIMetaFile(aMtf); |
790 |
|
791 |
Size aS(aMtf.GetPrefSize()); |
792 |
aMtf.WindStart(); |
793 |
aMtf.Play(Application::GetDefaultDevice(), Point(0, 0), |
794 |
Size(2880, 2880)); |
795 |
|
782 |
|
796 |
WritePICFHeader( rStrm, pNd, pFly, 8, nWidth, nHeight ); // Header |
783 |
WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight, |
797 |
WriteWindowMetafileBits( rStrm, aMtf ); // eigentliche Grafik |
784 |
pNd->GetpSwAttrSet()); |
|
|
785 |
WriteWindowMetafileBits(rStrm, aMtf); |
798 |
#endif |
786 |
#endif |
|
|
787 |
} |
788 |
break; |
789 |
case sw::Frame::eDrawing: |
790 |
case sw::Frame::eTxtBox: |
791 |
ASSERT(rWrt.bWrtWW8, |
792 |
"You can't try and export these in WW8 format, a filter bug"); |
793 |
/* |
794 |
#i3958# We only export an empty dummy picture frame here, this is |
795 |
what word does the escher export should contain an anchored to |
796 |
character element which is drawn over this dummy and the whole |
797 |
shebang surrounded with a SHAPE field. This isn't *my* hack :-), |
798 |
its what word does. |
799 |
*/ |
800 |
if (rWrt.bWrtWW8) |
801 |
{ |
802 |
WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight); |
803 |
SwBasicEscherEx aInlineEscher(&rStrm, rWrt); |
804 |
aInlineEscher.WriteEmptyFlyFrame(rFly.GetFrmFmt(), 0x401); |
805 |
} |
806 |
break; |
807 |
default: |
808 |
ASSERT(!this, |
809 |
"Some inline export not implemented, remind cmc before we ship :-)"); |
810 |
break; |
799 |
} |
811 |
} |
800 |
|
812 |
|
801 |
UINT32 nPos2 = rStrm.Tell(); // Ende merken |
813 |
UINT32 nPos2 = rStrm.Tell(); // Ende merken |
Lines 819-826
Link Here
|
819 |
myiter aEnd = maDetails.end(); |
831 |
myiter aEnd = maDetails.end(); |
820 |
for (myiter aIter = maDetails.begin(); aIter != aEnd; ++aIter) |
832 |
for (myiter aIter = maDetails.begin(); aIter != aEnd; ++aIter) |
821 |
{ |
833 |
{ |
822 |
const SwNoTxtNode* pNd = aIter->mpNd; |
|
|
823 |
|
824 |
UINT32 nPos = rStrm.Tell(); // auf 4 Bytes alignen |
834 |
UINT32 nPos = rStrm.Tell(); // auf 4 Bytes alignen |
825 |
if( nPos & 0x3 ) |
835 |
if( nPos & 0x3 ) |
826 |
SwWW8Writer::FillCount( rStrm, 4 - ( nPos & 0x3 ) ); |
836 |
SwWW8Writer::FillCount( rStrm, 4 - ( nPos & 0x3 ) ); |
Lines 839-846
Link Here
|
839 |
if (!bDuplicated) |
849 |
if (!bDuplicated) |
840 |
{ |
850 |
{ |
841 |
aIter->mnPos = rStrm.Tell(); |
851 |
aIter->mnPos = rStrm.Tell(); |
842 |
WriteGraphicNode(rStrm, pNd, aIter->mpFly, aIter->mnWid, |
852 |
WriteGraphicNode(rStrm, *aIter); |
843 |
aIter->mnHei); |
|
|
844 |
} |
853 |
} |
845 |
} |
854 |
} |
846 |
} |
855 |
} |