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 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 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. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 #include <svx/sdr/overlay/overlaypolypolygon.hxx> 27 #include <vcl/salbtype.hxx> 28 #include <vcl/outdev.hxx> 29 #include <basegfx/matrix/b2dhommatrix.hxx> 30 #include <basegfx/polygon/b2dpolypolygontools.hxx> 31 #include <svx/sdr/overlay/overlaymanager.hxx> 32 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> 33 34 ////////////////////////////////////////////////////////////////////////////// 35 36 namespace sdr 37 { 38 namespace overlay 39 { createOverlayObjectPrimitive2DSequence()40 drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStripedAndFilled::createOverlayObjectPrimitive2DSequence() 41 { 42 drawinglayer::primitive2d::Primitive2DSequence aRetval; 43 44 if(getOverlayManager()) 45 { 46 const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); 47 const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); 48 const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel()); 49 const drawinglayer::primitive2d::Primitive2DReference aStriped( 50 new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D( 51 getLinePolyPolygon(), 52 aRGBColorA, 53 aRGBColorB, 54 fStripeLengthPixel)); 55 56 aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aStriped, 1); 57 58 const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; 59 const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor()); 60 const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01); 61 62 const drawinglayer::primitive2d::Primitive2DReference aFilled( 63 new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D( 64 getLinePolyPolygon(), 65 aHilightColor, 66 fTransparence, 67 3.0, 68 false)); 69 70 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFilled); 71 } 72 73 return aRetval; 74 } 75 stripeDefinitionHasChanged()76 void OverlayPolyPolygonStripedAndFilled::stripeDefinitionHasChanged() 77 { 78 // react on OverlayManager's stripe definition change 79 objectChange(); 80 } 81 OverlayPolyPolygonStripedAndFilled(const basegfx::B2DPolyPolygon & rLinePolyPolygon)82 OverlayPolyPolygonStripedAndFilled::OverlayPolyPolygonStripedAndFilled( 83 const basegfx::B2DPolyPolygon& rLinePolyPolygon) 84 : OverlayObject(Color(COL_BLACK)), 85 maLinePolyPolygon(rLinePolyPolygon) 86 { 87 } 88 ~OverlayPolyPolygonStripedAndFilled()89 OverlayPolyPolygonStripedAndFilled::~OverlayPolyPolygonStripedAndFilled() 90 { 91 } 92 setLinePolyPolygon(const basegfx::B2DPolyPolygon & rNew)93 void OverlayPolyPolygonStripedAndFilled::setLinePolyPolygon(const basegfx::B2DPolyPolygon& rNew) 94 { 95 if(rNew != maLinePolyPolygon) 96 { 97 // remember new value 98 maLinePolyPolygon = rNew; 99 100 // register change (after change) 101 objectChange(); 102 } 103 } 104 } // end of namespace overlay 105 } // end of namespace sdr 106 107 ////////////////////////////////////////////////////////////////////////////// 108 // eof 109