EnhancedCustomShape3d.cxx (f6e50924) EnhancedCustomShape3d.cxx (70d3707a)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 412 unchanged lines hidden (view full) ---

421
422 E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 10 : fDepth );
423 p3DObj->NbcSetLayer( pShape2d->GetLayer() );
424 p3DObj->SetMergedItemSet( aSet );
425 if ( bIsPlaceholderObject )
426 aPlaceholderObjectList.push_back( p3DObj );
427 else if ( bUseTwoFillStyles )
428 {
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 412 unchanged lines hidden (view full) ---

421
422 E3dCompoundObject* p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 10 : fDepth );
423 p3DObj->NbcSetLayer( pShape2d->GetLayer() );
424 p3DObj->SetMergedItemSet( aSet );
425 if ( bIsPlaceholderObject )
426 aPlaceholderObjectList.push_back( p3DObj );
427 else if ( bUseTwoFillStyles )
428 {
429 Bitmap aFillBmp;
429 BitmapEx aFillBmp;
430 sal_Bool bFillBmpTile = ((XFillBmpTileItem&)p3DObj->GetMergedItem( XATTR_FILLBMP_TILE )).GetValue();
431 if ( bFillBmpTile )
432 {
430 sal_Bool bFillBmpTile = ((XFillBmpTileItem&)p3DObj->GetMergedItem( XATTR_FILLBMP_TILE )).GetValue();
431 if ( bFillBmpTile )
432 {
433 const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem( XATTR_FILLBITMAP );
434 const XOBitmap& rXOBmp = rBmpItm.GetBitmapValue();
435 aFillBmp = rXOBmp.GetBitmap();
433 const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP);
434 aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
436 Size aLogicalSize = aFillBmp.GetPrefSize();
437 if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL )
438 aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM );
439 else
440 aLogicalSize = OutputDevice::LogicToLogic( aLogicalSize, aFillBmp.GetPrefMapMode(), MAP_100TH_MM );
441 aLogicalSize.Width() *= 5; ;// :-( nice scaling, look at engine3d/obj3d.cxx
442 aLogicalSize.Height() *= 5;
443 aFillBmp.SetPrefSize( aLogicalSize );
444 aFillBmp.SetPrefMapMode( MAP_100TH_MM );
435 Size aLogicalSize = aFillBmp.GetPrefSize();
436 if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL )
437 aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM );
438 else
439 aLogicalSize = OutputDevice::LogicToLogic( aLogicalSize, aFillBmp.GetPrefMapMode(), MAP_100TH_MM );
440 aLogicalSize.Width() *= 5; ;// :-( nice scaling, look at engine3d/obj3d.cxx
441 aLogicalSize.Height() *= 5;
442 aFillBmp.SetPrefSize( aLogicalSize );
443 aFillBmp.SetPrefMapMode( MAP_100TH_MM );
445 p3DObj->SetMergedItem( XFillBitmapItem( String(), aFillBmp ) );
444 p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
446 }
447 else
448 {
449 if ( aSnapRect != aBoundRect )
450 {
445 }
446 else
447 {
448 if ( aSnapRect != aBoundRect )
449 {
451 const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem( XATTR_FILLBITMAP );
452 const XOBitmap& rXOBmp = rBmpItm.GetBitmapValue();
453 aFillBmp = rXOBmp.GetBitmap();
450 const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP);
451 aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx();
454 Size aBmpSize( aFillBmp.GetSizePixel() );
455 double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth();
456 double fYScale = (double)aBoundRect.GetHeight() / (double)aSnapRect.GetHeight();
457
458 Point aPt( (sal_Int32)( (double)( aBoundRect.Left() - aSnapRect.Left() )* (double)aBmpSize.Width() / (double)aSnapRect.GetWidth() ),
459 (sal_Int32)( (double)( aBoundRect.Top() - aSnapRect.Top() ) * (double)aBmpSize.Height() / (double)aSnapRect.GetHeight() ) );
460 Size aSize( (sal_Int32)( aBmpSize.Width() * fXScale ),
461 (sal_Int32)( aBmpSize.Height() * fYScale ) );
462 Rectangle aCropRect( aPt, aSize );
463 aFillBmp.Crop( aCropRect );
452 Size aBmpSize( aFillBmp.GetSizePixel() );
453 double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth();
454 double fYScale = (double)aBoundRect.GetHeight() / (double)aSnapRect.GetHeight();
455
456 Point aPt( (sal_Int32)( (double)( aBoundRect.Left() - aSnapRect.Left() )* (double)aBmpSize.Width() / (double)aSnapRect.GetWidth() ),
457 (sal_Int32)( (double)( aBoundRect.Top() - aSnapRect.Top() ) * (double)aBmpSize.Height() / (double)aSnapRect.GetHeight() ) );
458 Size aSize( (sal_Int32)( aBmpSize.Width() * fXScale ),
459 (sal_Int32)( aBmpSize.Height() * fYScale ) );
460 Rectangle aCropRect( aPt, aSize );
461 aFillBmp.Crop( aCropRect );
464 p3DObj->SetMergedItem( XFillBitmapItem( String(), aFillBmp ) );
462 p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
465 }
466 }
467 pScene->Insert3DObj( p3DObj );
468 p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, fDepth );
469 p3DObj->NbcSetLayer( pShape2d->GetLayer() );
470 p3DObj->SetMergedItemSet( aSet );
471 if ( bUseExtrusionColor )
472 p3DObj->SetMergedItem( XFillColorItem( String(), ((XSecondaryFillColorItem&)pCustomShape->GetMergedItem( XATTR_SECONDARYFILLCOLOR )).GetColorValue() ) );

--- 5 unchanged lines hidden (view full) ---

478 p3DObj->NbcSetLayer( pShape2d->GetLayer() );
479 p3DObj->SetMergedItemSet( aSet );
480
481 basegfx::B3DHomMatrix aFrontTransform( p3DObj->GetTransform() );
482 aFrontTransform.translate( 0.0, 0.0, fDepth );
483 p3DObj->NbcSetTransform( aFrontTransform );
484
485 if ( ( eFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
463 }
464 }
465 pScene->Insert3DObj( p3DObj );
466 p3DObj = new E3dExtrudeObj( a3DDefaultAttr, aPolyPoly, fDepth );
467 p3DObj->NbcSetLayer( pShape2d->GetLayer() );
468 p3DObj->SetMergedItemSet( aSet );
469 if ( bUseExtrusionColor )
470 p3DObj->SetMergedItem( XFillColorItem( String(), ((XSecondaryFillColorItem&)pCustomShape->GetMergedItem( XATTR_SECONDARYFILLCOLOR )).GetColorValue() ) );

--- 5 unchanged lines hidden (view full) ---

476 p3DObj->NbcSetLayer( pShape2d->GetLayer() );
477 p3DObj->SetMergedItemSet( aSet );
478
479 basegfx::B3DHomMatrix aFrontTransform( p3DObj->GetTransform() );
480 aFrontTransform.translate( 0.0, 0.0, fDepth );
481 p3DObj->NbcSetTransform( aFrontTransform );
482
483 if ( ( eFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() )
486 p3DObj->SetMergedItem( XFillBitmapItem( String(), aFillBmp ) );
484 {
485 p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp)));
486 }
487 }
488 else if ( eFillStyle == XFILL_NONE )
489 {
490 XLineColorItem& rLineColor = (XLineColorItem&)p3DObj->GetMergedItem( XATTR_LINECOLOR );
491 p3DObj->SetMergedItem( XFillColorItem( String(), rLineColor.GetColorValue() ) );
492 p3DObj->SetMergedItem( Svx3DDoubleSidedItem( sal_True ) );
493 p3DObj->SetMergedItem( Svx3DCloseFrontItem( sal_False ) );
494 p3DObj->SetMergedItem( Svx3DCloseBackItem( sal_False ) );

--- 254 unchanged lines hidden ---
487 }
488 else if ( eFillStyle == XFILL_NONE )
489 {
490 XLineColorItem& rLineColor = (XLineColorItem&)p3DObj->GetMergedItem( XATTR_LINECOLOR );
491 p3DObj->SetMergedItem( XFillColorItem( String(), rLineColor.GetColorValue() ) );
492 p3DObj->SetMergedItem( Svx3DDoubleSidedItem( sal_True ) );
493 p3DObj->SetMergedItem( Svx3DCloseFrontItem( sal_False ) );
494 p3DObj->SetMergedItem( Svx3DCloseBackItem( sal_False ) );

--- 254 unchanged lines hidden ---