sdrolecontentprimitive2d.cxx (f6e50924) | sdrolecontentprimitive2d.cxx (34b4c3b7) |
---|---|
1/************************************************************** | 1/************************************************************** |
2 * | 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 9 * with the License. You may obtain a copy of the License at | 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 9 * with the License. You may obtain a copy of the License at |
10 * | 10 * |
11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * | 12 * |
13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
19 * | 19 * |
20 *************************************************************/ 21 22 23 24#include "precompiled_svx.hxx" 25#include <svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx> 26#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> 27#include <svx/svdoole2.hxx> --- 15 unchanged lines hidden (view full) --- 43 { 44 Primitive2DSequence aRetval; 45 const SdrOle2Obj* pSource = (mpSdrOle2Obj.is() ? static_cast< SdrOle2Obj* >(mpSdrOle2Obj.get()) : 0); 46 bool bScaleContent(false); 47 Graphic aGraphic; 48 49 if(pSource) 50 { | 20 *************************************************************/ 21 22 23 24#include "precompiled_svx.hxx" 25#include <svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx> 26#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> 27#include <svx/svdoole2.hxx> --- 15 unchanged lines hidden (view full) --- 43 { 44 Primitive2DSequence aRetval; 45 const SdrOle2Obj* pSource = (mpSdrOle2Obj.is() ? static_cast< SdrOle2Obj* >(mpSdrOle2Obj.get()) : 0); 46 bool bScaleContent(false); 47 Graphic aGraphic; 48 49 if(pSource) 50 { |
51 Graphic* pOLEGraphic = (getHighContrast()) | 51 Graphic* pOLEGraphic = (getHighContrast()) |
52 ? pSource->getEmbeddedObjectRef().GetHCGraphic() 53 : pSource->GetGraphic(); 54 55 if(pOLEGraphic) 56 { 57 aGraphic = *pOLEGraphic; 58 bScaleContent = pSource->IsEmptyPresObj(); 59 } 60 } 61 62 if(GRAPHIC_NONE == aGraphic.GetType()) 63 { | 52 ? pSource->getEmbeddedObjectRef().GetHCGraphic() 53 : pSource->GetGraphic(); 54 55 if(pOLEGraphic) 56 { 57 aGraphic = *pOLEGraphic; 58 bScaleContent = pSource->IsEmptyPresObj(); 59 } 60 } 61 62 if(GRAPHIC_NONE == aGraphic.GetType()) 63 { |
64 // no source, use fallback ressource emty OLE graphic 65 const Bitmap aEmptyOLEBitmap(SdrOle2Obj::GetEmtyOLEReplacementBitmap()); | 64 // no source, use fallback resource empty OLE graphic 65 const Bitmap aEmptyOLEBitmap(SdrOle2Obj::GetEmptyOLEReplacementBitmap()); |
66 aGraphic = Graphic(aEmptyOLEBitmap); 67 bScaleContent = true; 68 } 69 70 if(GRAPHIC_NONE != aGraphic.GetType()) 71 { 72 const GraphicObject aGraphicObject(aGraphic); 73 const GraphicAttr aGraphicAttr; 74 drawinglayer::primitive2d::Primitive2DSequence xOLEContent; | 66 aGraphic = Graphic(aEmptyOLEBitmap); 67 bScaleContent = true; 68 } 69 70 if(GRAPHIC_NONE != aGraphic.GetType()) 71 { 72 const GraphicObject aGraphicObject(aGraphic); 73 const GraphicAttr aGraphicAttr; 74 drawinglayer::primitive2d::Primitive2DSequence xOLEContent; |
75 | 75 |
76 if(bScaleContent) 77 { 78 // get transformation atoms 79 basegfx::B2DVector aScale, aTranslate; 80 double fRotate, fShearX; 81 getObjectTransform().decompose(aScale, aTranslate, fRotate, fShearX); 82 83 // get PrefSize from the graphic in 100th mm --- 16 unchanged lines hidden (view full) --- 100 // if content fits into frame, create it 101 basegfx::B2DHomMatrix aInnerObjectMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix( 102 aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY)); 103 aInnerObjectMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) 104 * aInnerObjectMatrix; 105 106 const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( 107 new drawinglayer::primitive2d::GraphicPrimitive2D( | 76 if(bScaleContent) 77 { 78 // get transformation atoms 79 basegfx::B2DVector aScale, aTranslate; 80 double fRotate, fShearX; 81 getObjectTransform().decompose(aScale, aTranslate, fRotate, fShearX); 82 83 // get PrefSize from the graphic in 100th mm --- 16 unchanged lines hidden (view full) --- 100 // if content fits into frame, create it 101 basegfx::B2DHomMatrix aInnerObjectMatrix(basegfx::tools::createScaleTranslateB2DHomMatrix( 102 aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY)); 103 aInnerObjectMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate) 104 * aInnerObjectMatrix; 105 106 const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( 107 new drawinglayer::primitive2d::GraphicPrimitive2D( |
108 aInnerObjectMatrix, 109 aGraphicObject, | 108 aInnerObjectMatrix, 109 aGraphicObject, |
110 aGraphicAttr)); 111 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive); 112 } 113 } 114 else 115 { 116 // create graphic primitive for content 117 const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( 118 new drawinglayer::primitive2d::GraphicPrimitive2D( | 110 aGraphicAttr)); 111 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive); 112 } 113 } 114 else 115 { 116 // create graphic primitive for content 117 const drawinglayer::primitive2d::Primitive2DReference aGraphicPrimitive( 118 new drawinglayer::primitive2d::GraphicPrimitive2D( |
119 getObjectTransform(), 120 aGraphicObject, | 119 getObjectTransform(), 120 aGraphicObject, |
121 aGraphicAttr)); 122 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive); 123 } 124 125 // a standard gray outline is created for scaled content 126 if(bScaleContent) 127 { 128 const svtools::ColorConfig aColorConfig; --- 12 unchanged lines hidden (view full) --- 141 } 142 143 // get graphic and check scale content state 144 return aRetval; 145 } 146 147 SdrOleContentPrimitive2D::SdrOleContentPrimitive2D( 148 const SdrOle2Obj& rSdrOle2Obj, | 121 aGraphicAttr)); 122 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aGraphicPrimitive); 123 } 124 125 // a standard gray outline is created for scaled content 126 if(bScaleContent) 127 { 128 const svtools::ColorConfig aColorConfig; --- 12 unchanged lines hidden (view full) --- 141 } 142 143 // get graphic and check scale content state 144 return aRetval; 145 } 146 147 SdrOleContentPrimitive2D::SdrOleContentPrimitive2D( 148 const SdrOle2Obj& rSdrOle2Obj, |
149 const basegfx::B2DHomMatrix& rObjectTransform, | 149 const basegfx::B2DHomMatrix& rObjectTransform, |
150 sal_uInt32 nGraphicVersion, 151 bool bHighContrast) 152 : BufferedDecompositionPrimitive2D(), 153 mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)), 154 maObjectTransform(rObjectTransform), 155 mnGraphicVersion(nGraphicVersion), 156 mbHighContrast(bHighContrast) 157 { 158 } 159 160 bool SdrOleContentPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 161 { 162 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 163 { 164 const SdrOleContentPrimitive2D& rCompare = (SdrOleContentPrimitive2D&)rPrimitive; 165 const bool bBothNot(!mpSdrOle2Obj.is() && !rCompare.mpSdrOle2Obj.is()); | 150 sal_uInt32 nGraphicVersion, 151 bool bHighContrast) 152 : BufferedDecompositionPrimitive2D(), 153 mpSdrOle2Obj(const_cast< SdrOle2Obj* >(&rSdrOle2Obj)), 154 maObjectTransform(rObjectTransform), 155 mnGraphicVersion(nGraphicVersion), 156 mbHighContrast(bHighContrast) 157 { 158 } 159 160 bool SdrOleContentPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 161 { 162 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 163 { 164 const SdrOleContentPrimitive2D& rCompare = (SdrOleContentPrimitive2D&)rPrimitive; 165 const bool bBothNot(!mpSdrOle2Obj.is() && !rCompare.mpSdrOle2Obj.is()); |
166 const bool bBothAndEqual(mpSdrOle2Obj.is() && rCompare.mpSdrOle2Obj.is() | 166 const bool bBothAndEqual(mpSdrOle2Obj.is() && rCompare.mpSdrOle2Obj.is() |
167 && mpSdrOle2Obj.get() == rCompare.mpSdrOle2Obj.get()); | 167 && mpSdrOle2Obj.get() == rCompare.mpSdrOle2Obj.get()); |
168 | 168 |
169 return ((bBothNot || bBothAndEqual) 170 && getObjectTransform() == rCompare.getObjectTransform() 171 172 // #i104867# to find out if the Graphic content of the 173 // OLE has changed, use GraphicVersion number 174 && getGraphicVersion() == rCompare.getGraphicVersion() 175 176 && getHighContrast() == rCompare.getHighContrast()); 177 } 178 179 return false; 180 } 181 182 basegfx::B2DRange SdrOleContentPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const 183 { 184 basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0); 185 aRange.transform(getObjectTransform()); | 169 return ((bBothNot || bBothAndEqual) 170 && getObjectTransform() == rCompare.getObjectTransform() 171 172 // #i104867# to find out if the Graphic content of the 173 // OLE has changed, use GraphicVersion number 174 && getGraphicVersion() == rCompare.getGraphicVersion() 175 176 && getHighContrast() == rCompare.getHighContrast()); 177 } 178 179 return false; 180 } 181 182 basegfx::B2DRange SdrOleContentPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const 183 { 184 basegfx::B2DRange aRange(0.0, 0.0, 1.0, 1.0); 185 aRange.transform(getObjectTransform()); |
186 | 186 |
187 return aRange; 188 } 189 190 // provide unique ID 191 ImplPrimitrive2DIDBlock(SdrOleContentPrimitive2D, PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D) 192 193 } // end of namespace primitive2d 194} // end of namespace drawinglayer 195 | 187 return aRange; 188 } 189 190 // provide unique ID 191 ImplPrimitrive2DIDBlock(SdrOleContentPrimitive2D, PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D) 192 193 } // end of namespace primitive2d 194} // end of namespace drawinglayer 195 |
196////////////////////////////////////////////////////////////////////////////// 197// eof | 196/* vim: set noet sw=4 ts=4: */ |