sdrattributecreator.cxx (6b9bd1de) | sdrattributecreator.cxx (e7d68668) |
---|---|
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 --- 633 unchanged lines hidden (view full) --- 642 { 643 // no content if no size 644 OSL_ENSURE(false, "Graphic has no size in SfxItemSet (!)"); 645 return attribute::SdrFillGraphicAttribute(); 646 } 647 648 // convert size and MapMode to destination logical size and MapMode 649 const MapUnit aDestinationMapUnit((MapUnit)rSet.GetPool()->GetMetric(0)); | 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 --- 633 unchanged lines hidden (view full) --- 642 { 643 // no content if no size 644 OSL_ENSURE(false, "Graphic has no size in SfxItemSet (!)"); 645 return attribute::SdrFillGraphicAttribute(); 646 } 647 648 // convert size and MapMode to destination logical size and MapMode 649 const MapUnit aDestinationMapUnit((MapUnit)rSet.GetPool()->GetMetric(0)); |
650 basegfx::B2DVector aGraphicLogicSize(aGraphic.GetPrefSize().Width(), aGraphic.GetPrefSize().Height()); |
|
650 651 if(aGraphic.GetPrefMapMode() != aDestinationMapUnit) 652 { 653 // #i100360# for MAP_PIXEL, LogicToLogic will not work properly, 654 // so fallback to Application::GetDefaultDevice() | 651 652 if(aGraphic.GetPrefMapMode() != aDestinationMapUnit) 653 { 654 // #i100360# for MAP_PIXEL, LogicToLogic will not work properly, 655 // so fallback to Application::GetDefaultDevice() |
656 Size aNewSize(0, 0); 657 |
|
655 if(MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit()) 656 { | 658 if(MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit()) 659 { |
657 aGraphic.SetPrefSize( 658 Application::GetDefaultDevice()->PixelToLogic( 659 aGraphic.GetPrefSize(), 660 aDestinationMapUnit)); | 660 aNewSize = Application::GetDefaultDevice()->PixelToLogic( 661 aGraphic.GetPrefSize(), 662 aDestinationMapUnit); |
661 } 662 else 663 { | 663 } 664 else 665 { |
664 aGraphic.SetPrefSize( 665 OutputDevice::LogicToLogic( 666 aGraphic.GetPrefSize(), 667 aGraphic.GetPrefMapMode(), 668 aDestinationMapUnit)); | 666 aNewSize = OutputDevice::LogicToLogic( 667 aGraphic.GetPrefSize(), 668 aGraphic.GetPrefMapMode(), 669 aDestinationMapUnit); |
669 } | 670 } |
671 672 // #124002# do not set new size using SetPrefSize at the graphic, this will lead to problems. 673 // Instead, adapt the GraphicLogicSize which will be used for further decompositions 674 aGraphicLogicSize = basegfx::B2DVector(aNewSize.Width(), aNewSize.Height()); |
|
670 } 671 672 // get size 673 const basegfx::B2DVector aSize( 674 (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEX))).GetValue(), 675 (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEY))).GetValue()); 676 const basegfx::B2DVector aOffset( 677 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETX))).GetValue(), 678 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETY))).GetValue()); 679 const basegfx::B2DVector aOffsetPosition( 680 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(), 681 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue()); 682 683 return attribute::SdrFillGraphicAttribute( 684 aGraphic, | 675 } 676 677 // get size 678 const basegfx::B2DVector aSize( 679 (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEX))).GetValue(), 680 (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEY))).GetValue()); 681 const basegfx::B2DVector aOffset( 682 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETX))).GetValue(), 683 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETY))).GetValue()); 684 const basegfx::B2DVector aOffsetPosition( 685 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(), 686 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue()); 687 688 return attribute::SdrFillGraphicAttribute( 689 aGraphic, |
690 aGraphicLogicSize, |
|
685 aSize, 686 aOffset, 687 aOffsetPosition, 688 RectPointToB2DVector((RECT_POINT)((const SfxEnumItem&)(rSet.Get(XATTR_FILLBMP_POS))).GetValue()), 689 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(), 690 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(), 691 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue()); 692 } --- 384 unchanged lines hidden --- | 691 aSize, 692 aOffset, 693 aOffsetPosition, 694 RectPointToB2DVector((RECT_POINT)((const SfxEnumItem&)(rSet.Get(XATTR_FILLBMP_POS))).GetValue()), 695 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(), 696 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(), 697 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue()); 698 } --- 384 unchanged lines hidden --- |