xref: /AOO41X/main/sw/source/ui/docvw/AnchorOverlayObject.cxx (revision efeef26f81c84063fb0a91bde3856d4a51172d90)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <AnchorOverlayObject.hxx>
28cdf0e10cSrcweir #include <SidebarWindowsConsts.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <swrect.hxx>
31cdf0e10cSrcweir #include <view.hxx>
32cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx>
33cdf0e10cSrcweir #include <svx/svdview.hxx>
34cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <sw_primitivetypes2d.hxx>
37cdf0e10cSrcweir #include <drawinglayer/primitive2d/primitivetools2d.hxx>
38cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
39cdf0e10cSrcweir #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
40cdf0e10cSrcweir #include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace sw { namespace sidebarwindows {
43cdf0e10cSrcweir 
44cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
45cdf0e10cSrcweir // helper class: Primitive for discrete visualisation
46cdf0e10cSrcweir 
47cdf0e10cSrcweir class AnchorPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D
48cdf0e10cSrcweir {
49cdf0e10cSrcweir private:
50cdf0e10cSrcweir     basegfx::B2DPolygon             maTriangle;
51cdf0e10cSrcweir     basegfx::B2DPolygon             maLine;
52cdf0e10cSrcweir     basegfx::B2DPolygon             maLineTop;
53cdf0e10cSrcweir     const AnchorState               maAnchorState;
54cdf0e10cSrcweir     basegfx::BColor                 maColor;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     // discrete line width
57cdf0e10cSrcweir     double                          mfLogicLineWidth;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir     // bitfield
60cdf0e10cSrcweir     bool                            mbShadow : 1;
61cdf0e10cSrcweir     bool                            mbLineSolid : 1;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir protected:
64cdf0e10cSrcweir     virtual drawinglayer::primitive2d::Primitive2DSequence create2DDecomposition(
65cdf0e10cSrcweir         const drawinglayer::geometry::ViewInformation2D& rViewInformation) const;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir public:
68cdf0e10cSrcweir     AnchorPrimitive( const basegfx::B2DPolygon& rTriangle,
69cdf0e10cSrcweir                      const basegfx::B2DPolygon& rLine,
70cdf0e10cSrcweir                      const basegfx::B2DPolygon& rLineTop,
71cdf0e10cSrcweir                      AnchorState aAnchorState,
72cdf0e10cSrcweir                      const basegfx::BColor& rColor,
73cdf0e10cSrcweir                      double fLogicLineWidth,
74cdf0e10cSrcweir                      bool bShadow,
75cdf0e10cSrcweir                      bool bLineSolid )
76cdf0e10cSrcweir     :   drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D(),
77cdf0e10cSrcweir         maTriangle(rTriangle),
78cdf0e10cSrcweir         maLine(rLine),
79cdf0e10cSrcweir         maLineTop(rLineTop),
80cdf0e10cSrcweir         maAnchorState(aAnchorState),
81cdf0e10cSrcweir         maColor(rColor),
82cdf0e10cSrcweir         mfLogicLineWidth(fLogicLineWidth),
83cdf0e10cSrcweir         mbShadow(bShadow),
84cdf0e10cSrcweir         mbLineSolid(bLineSolid)
85cdf0e10cSrcweir     {}
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     // data access
88cdf0e10cSrcweir     const basegfx::B2DPolygon& getTriangle() const { return maTriangle; }
89cdf0e10cSrcweir     const basegfx::B2DPolygon& getLine() const { return maLine; }
90cdf0e10cSrcweir     const basegfx::B2DPolygon& getLineTop() const { return maLineTop; }
91cdf0e10cSrcweir     AnchorState getAnchorState() const { return maAnchorState; }
92cdf0e10cSrcweir     const basegfx::BColor& getColor() const { return maColor; }
93cdf0e10cSrcweir     double getLogicLineWidth() const { return mfLogicLineWidth; }
94cdf0e10cSrcweir     bool getShadow() const { return mbShadow; }
95cdf0e10cSrcweir     bool getLineSolid() const { return mbLineSolid; }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     virtual bool operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir     DeclPrimitrive2DIDBlock()
100cdf0e10cSrcweir };
101cdf0e10cSrcweir 
102cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence AnchorPrimitive::create2DDecomposition(
103cdf0e10cSrcweir     const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const
104cdf0e10cSrcweir {
105cdf0e10cSrcweir     drawinglayer::primitive2d::Primitive2DSequence aRetval;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     if ( AS_TRI == maAnchorState ||
108cdf0e10cSrcweir          AS_ALL == maAnchorState ||
109cdf0e10cSrcweir          AS_START == maAnchorState )
110cdf0e10cSrcweir     {
111cdf0e10cSrcweir         // create triangle
112cdf0e10cSrcweir         const drawinglayer::primitive2d::Primitive2DReference aTriangle(
113cdf0e10cSrcweir             new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
114cdf0e10cSrcweir                 basegfx::B2DPolyPolygon(getTriangle()),
115cdf0e10cSrcweir                 getColor()));
116cdf0e10cSrcweir 
117cdf0e10cSrcweir         drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aTriangle);
118cdf0e10cSrcweir     }
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     if ( AS_ALL == maAnchorState ||
121cdf0e10cSrcweir          AS_START == maAnchorState )
122cdf0e10cSrcweir     {
123cdf0e10cSrcweir         // create line start
124cdf0e10cSrcweir         const drawinglayer::attribute::LineAttribute aLineAttribute(
125cdf0e10cSrcweir             getColor(),
126cdf0e10cSrcweir             getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
127cdf0e10cSrcweir 
128cdf0e10cSrcweir         if(getLineSolid())
129cdf0e10cSrcweir         {
130cdf0e10cSrcweir             const drawinglayer::primitive2d::Primitive2DReference aSolidLine(
131cdf0e10cSrcweir                 new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
132cdf0e10cSrcweir                     getLine(),
133cdf0e10cSrcweir                     aLineAttribute));
134cdf0e10cSrcweir 
135cdf0e10cSrcweir             drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aSolidLine);
136cdf0e10cSrcweir         }
137cdf0e10cSrcweir         else
138cdf0e10cSrcweir         {
139cdf0e10cSrcweir             ::std::vector< double > aDotDashArray;
140cdf0e10cSrcweir             const double fDistance(3.0 * 15.0);
141cdf0e10cSrcweir             const double fDashLen(5.0 * 15.0);
142cdf0e10cSrcweir 
143cdf0e10cSrcweir             aDotDashArray.push_back(fDashLen);
144cdf0e10cSrcweir             aDotDashArray.push_back(fDistance);
145cdf0e10cSrcweir 
146cdf0e10cSrcweir             const drawinglayer::attribute::StrokeAttribute aStrokeAttribute(
147cdf0e10cSrcweir                 aDotDashArray,
148cdf0e10cSrcweir                 fDistance + fDashLen);
149cdf0e10cSrcweir 
150cdf0e10cSrcweir             const drawinglayer::primitive2d::Primitive2DReference aStrokedLine(
151cdf0e10cSrcweir                 new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
152cdf0e10cSrcweir                     getLine(),
153cdf0e10cSrcweir                     aLineAttribute,
154cdf0e10cSrcweir                     aStrokeAttribute));
155cdf0e10cSrcweir 
156cdf0e10cSrcweir             drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aStrokedLine);
157cdf0e10cSrcweir         }
158cdf0e10cSrcweir     }
159cdf0e10cSrcweir 
160cdf0e10cSrcweir     if(aRetval.hasElements() && getShadow())
161cdf0e10cSrcweir     {
162cdf0e10cSrcweir         // shadow is only for triangle and line start, and in upper left
163cdf0e10cSrcweir         // and lower right direction, in different colors
164cdf0e10cSrcweir         const double fColorChange(20.0 / 255.0);
165cdf0e10cSrcweir         const basegfx::B3DTuple aColorChange(fColorChange, fColorChange, fColorChange);
166cdf0e10cSrcweir         basegfx::BColor aLighterColor(getColor() + aColorChange);
167cdf0e10cSrcweir         basegfx::BColor aDarkerColor(getColor() - aColorChange);
168cdf0e10cSrcweir 
169cdf0e10cSrcweir         aLighterColor.clamp();
170cdf0e10cSrcweir         aDarkerColor.clamp();
171cdf0e10cSrcweir 
172cdf0e10cSrcweir         // create shadow sequence
173cdf0e10cSrcweir         drawinglayer::primitive2d::Primitive2DSequence aShadows(2);
174cdf0e10cSrcweir         basegfx::B2DHomMatrix aTransform;
175cdf0e10cSrcweir 
176cdf0e10cSrcweir         aTransform.set(0, 2, -getDiscreteUnit());
177cdf0e10cSrcweir         aTransform.set(1, 2, -getDiscreteUnit());
178cdf0e10cSrcweir 
179cdf0e10cSrcweir         aShadows[0] = drawinglayer::primitive2d::Primitive2DReference(
180cdf0e10cSrcweir             new drawinglayer::primitive2d::ShadowPrimitive2D(
181cdf0e10cSrcweir                 aTransform,
182cdf0e10cSrcweir                 aLighterColor,
183cdf0e10cSrcweir                 aRetval));
184cdf0e10cSrcweir 
185cdf0e10cSrcweir         aTransform.set(0, 2, getDiscreteUnit());
186cdf0e10cSrcweir         aTransform.set(1, 2, getDiscreteUnit());
187cdf0e10cSrcweir 
188cdf0e10cSrcweir         aShadows[1] = drawinglayer::primitive2d::Primitive2DReference(
189cdf0e10cSrcweir             new drawinglayer::primitive2d::ShadowPrimitive2D(
190cdf0e10cSrcweir                 aTransform,
191cdf0e10cSrcweir                 aDarkerColor,
192cdf0e10cSrcweir                 aRetval));
193cdf0e10cSrcweir 
194cdf0e10cSrcweir         // add shadow before geometry to make it be proccessed first
195cdf0e10cSrcweir         const drawinglayer::primitive2d::Primitive2DSequence aTemporary(aRetval);
196cdf0e10cSrcweir 
197cdf0e10cSrcweir         aRetval = aShadows;
198cdf0e10cSrcweir         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aRetval, aTemporary);
199cdf0e10cSrcweir     }
200cdf0e10cSrcweir 
201cdf0e10cSrcweir     if ( AS_ALL == maAnchorState ||
202cdf0e10cSrcweir          AS_END == maAnchorState )
203cdf0e10cSrcweir     {
204cdf0e10cSrcweir         // LineTop has to be created, too, but uses no shadow, so add after
205cdf0e10cSrcweir         // the other parts are created
206cdf0e10cSrcweir         const drawinglayer::attribute::LineAttribute aLineAttribute(
207cdf0e10cSrcweir             getColor(),
208cdf0e10cSrcweir             getLogicLineWidth() / (basegfx::fTools::equalZero(getDiscreteUnit()) ? 1.0 : getDiscreteUnit()));
209cdf0e10cSrcweir 
210cdf0e10cSrcweir         const drawinglayer::primitive2d::Primitive2DReference aLineTop(
211cdf0e10cSrcweir             new drawinglayer::primitive2d::PolygonStrokePrimitive2D(
212cdf0e10cSrcweir                 getLineTop(),
213cdf0e10cSrcweir                 aLineAttribute));
214cdf0e10cSrcweir 
215cdf0e10cSrcweir         drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aLineTop);
216cdf0e10cSrcweir     }
217cdf0e10cSrcweir 
218cdf0e10cSrcweir     return aRetval;
219cdf0e10cSrcweir }
220cdf0e10cSrcweir 
221cdf0e10cSrcweir bool AnchorPrimitive::operator==( const drawinglayer::primitive2d::BasePrimitive2D& rPrimitive ) const
222cdf0e10cSrcweir {
223cdf0e10cSrcweir     if(drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
224cdf0e10cSrcweir     {
225cdf0e10cSrcweir         const AnchorPrimitive& rCompare = static_cast< const AnchorPrimitive& >(rPrimitive);
226cdf0e10cSrcweir 
227cdf0e10cSrcweir         return (getTriangle() == rCompare.getTriangle()
228cdf0e10cSrcweir             && getLine() == rCompare.getLine()
229cdf0e10cSrcweir             && getLineTop() == rCompare.getLineTop()
230cdf0e10cSrcweir             && getAnchorState() == rCompare.getAnchorState()
231cdf0e10cSrcweir             && getColor() == rCompare.getColor()
232cdf0e10cSrcweir             && getLogicLineWidth() == rCompare.getLogicLineWidth()
233cdf0e10cSrcweir             && getShadow() == rCompare.getShadow()
234cdf0e10cSrcweir             && getLineSolid() == rCompare.getLineSolid());
235cdf0e10cSrcweir     }
236cdf0e10cSrcweir 
237cdf0e10cSrcweir     return false;
238cdf0e10cSrcweir }
239cdf0e10cSrcweir 
240cdf0e10cSrcweir ImplPrimitrive2DIDBlock(AnchorPrimitive, PRIMITIVE2D_ID_SWSIDEBARANCHORPRIMITIVE)
241cdf0e10cSrcweir 
242cdf0e10cSrcweir /****** AnchorOverlayObject    ***********************************************************/
243cdf0e10cSrcweir /*static*/ AnchorOverlayObject* AnchorOverlayObject::CreateAnchorOverlayObject(
244cdf0e10cSrcweir                                                        SwView& rDocView,
245cdf0e10cSrcweir                                                        const SwRect& aAnchorRect,
246cdf0e10cSrcweir                                                        const long& aPageBorder,
247cdf0e10cSrcweir                                                        const Point& aLineStart,
248cdf0e10cSrcweir                                                        const Point& aLineEnd,
249cdf0e10cSrcweir                                                        const Color& aColorAnchor )
250cdf0e10cSrcweir {
251cdf0e10cSrcweir     AnchorOverlayObject* pAnchorOverlayObject( 0 );
252cdf0e10cSrcweir     if ( rDocView.GetDrawView() )
253cdf0e10cSrcweir     {
254cdf0e10cSrcweir         SdrPaintWindow* pPaintWindow = rDocView.GetDrawView()->GetPaintWindow(0);
255cdf0e10cSrcweir         if( pPaintWindow )
256cdf0e10cSrcweir         {
257cdf0e10cSrcweir             sdr::overlay::OverlayManager* pOverlayManager = pPaintWindow->GetOverlayManager();
258cdf0e10cSrcweir 
259cdf0e10cSrcweir             if ( pOverlayManager )
260cdf0e10cSrcweir             {
261cdf0e10cSrcweir                 pAnchorOverlayObject = new AnchorOverlayObject(
262cdf0e10cSrcweir                     basegfx::B2DPoint( aAnchorRect.Left() , aAnchorRect.Bottom()-5*15),
263cdf0e10cSrcweir                     basegfx::B2DPoint( aAnchorRect.Left()-5*15 , aAnchorRect.Bottom()+5*15),
264cdf0e10cSrcweir                     basegfx::B2DPoint( aAnchorRect.Left()+5*15 , aAnchorRect.Bottom()+5*15),
265cdf0e10cSrcweir                     basegfx::B2DPoint( aAnchorRect.Left(), aAnchorRect.Bottom()+2*15),
266cdf0e10cSrcweir                     basegfx::B2DPoint( aPageBorder ,aAnchorRect.Bottom()+2*15),
267cdf0e10cSrcweir                     basegfx::B2DPoint( aLineStart.X(),aLineStart.Y()),
268cdf0e10cSrcweir                     basegfx::B2DPoint( aLineEnd.X(),aLineEnd.Y()) ,
269cdf0e10cSrcweir                     aColorAnchor,
270cdf0e10cSrcweir                     false,
271cdf0e10cSrcweir                     false);
272cdf0e10cSrcweir                 pOverlayManager->add(*pAnchorOverlayObject);
273cdf0e10cSrcweir             }
274cdf0e10cSrcweir         }
275cdf0e10cSrcweir     }
276cdf0e10cSrcweir 
277cdf0e10cSrcweir     return pAnchorOverlayObject;
278cdf0e10cSrcweir }
279cdf0e10cSrcweir 
280cdf0e10cSrcweir /*static*/ void AnchorOverlayObject::DestroyAnchorOverlayObject( AnchorOverlayObject* pAnchor )
281cdf0e10cSrcweir {
282cdf0e10cSrcweir     if ( pAnchor )
283cdf0e10cSrcweir     {
284cdf0e10cSrcweir         if ( pAnchor->getOverlayManager() )
285cdf0e10cSrcweir         {
286cdf0e10cSrcweir             // remove this object from the chain
287cdf0e10cSrcweir             pAnchor->getOverlayManager()->remove(*pAnchor);
288cdf0e10cSrcweir         }
289cdf0e10cSrcweir         delete pAnchor;
290cdf0e10cSrcweir     }
291cdf0e10cSrcweir }
292cdf0e10cSrcweir 
293cdf0e10cSrcweir AnchorOverlayObject::AnchorOverlayObject( const basegfx::B2DPoint& rBasePos,
294cdf0e10cSrcweir                                           const basegfx::B2DPoint& rSecondPos,
295cdf0e10cSrcweir                                           const basegfx::B2DPoint& rThirdPos,
296cdf0e10cSrcweir                                           const basegfx::B2DPoint& rFourthPos,
297cdf0e10cSrcweir                                           const basegfx::B2DPoint& rFifthPos,
298cdf0e10cSrcweir                                           const basegfx::B2DPoint& rSixthPos,
299cdf0e10cSrcweir                                           const basegfx::B2DPoint& rSeventhPos,
300cdf0e10cSrcweir                                           const Color aBaseColor,
301cdf0e10cSrcweir                                           const bool bShadowedEffect,
302cdf0e10cSrcweir                                           const bool bLineSolid)
303cdf0e10cSrcweir     : OverlayObjectWithBasePosition( rBasePos, aBaseColor )
304cdf0e10cSrcweir     , maSecondPosition(rSecondPos)
305cdf0e10cSrcweir     , maThirdPosition(rThirdPos)
306cdf0e10cSrcweir     , maFourthPosition(rFourthPos)
307cdf0e10cSrcweir     , maFifthPosition(rFifthPos)
308cdf0e10cSrcweir     , maSixthPosition(rSixthPos)
309cdf0e10cSrcweir     , maSeventhPosition(rSeventhPos)
310cdf0e10cSrcweir     , maTriangle()
311cdf0e10cSrcweir     , maLine()
312cdf0e10cSrcweir     , maLineTop()
313cdf0e10cSrcweir     , mHeight(0)
314cdf0e10cSrcweir     , mAnchorState(AS_ALL)
315cdf0e10cSrcweir     , mbShadowedEffect(bShadowedEffect)
316cdf0e10cSrcweir     , mbLineSolid(bLineSolid)
317cdf0e10cSrcweir {
318cdf0e10cSrcweir }
319cdf0e10cSrcweir 
320cdf0e10cSrcweir AnchorOverlayObject::~AnchorOverlayObject()
321cdf0e10cSrcweir {
322cdf0e10cSrcweir }
323cdf0e10cSrcweir 
324cdf0e10cSrcweir void AnchorOverlayObject::implEnsureGeometry()
325cdf0e10cSrcweir {
326cdf0e10cSrcweir     if(!maTriangle.count())
327cdf0e10cSrcweir     {
328cdf0e10cSrcweir         maTriangle.append(getBasePosition());
329cdf0e10cSrcweir         maTriangle.append(GetSecondPosition());
330cdf0e10cSrcweir         maTriangle.append(GetThirdPosition());
331cdf0e10cSrcweir         maTriangle.setClosed(true);
332cdf0e10cSrcweir     }
333cdf0e10cSrcweir 
334cdf0e10cSrcweir     if(!maLine.count())
335cdf0e10cSrcweir     {
336cdf0e10cSrcweir         maLine.append(GetFourthPosition());
337cdf0e10cSrcweir         maLine.append(GetFifthPosition());
338cdf0e10cSrcweir         maLine.append(GetSixthPosition());
339cdf0e10cSrcweir     }
340cdf0e10cSrcweir 
341cdf0e10cSrcweir   if(!maLineTop.count())
342cdf0e10cSrcweir     {
343cdf0e10cSrcweir         maLineTop.append(GetSixthPosition());
344cdf0e10cSrcweir         maLineTop.append(GetSeventhPosition());
345cdf0e10cSrcweir     }
346cdf0e10cSrcweir }
347cdf0e10cSrcweir 
348cdf0e10cSrcweir void AnchorOverlayObject::implResetGeometry()
349cdf0e10cSrcweir {
350cdf0e10cSrcweir     maTriangle.clear();
351cdf0e10cSrcweir     maLine.clear();
352cdf0e10cSrcweir     maLineTop.clear();
353cdf0e10cSrcweir }
354cdf0e10cSrcweir 
355cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence AnchorOverlayObject::createOverlayObjectPrimitive2DSequence()
356cdf0e10cSrcweir {
357cdf0e10cSrcweir     implEnsureGeometry();
358cdf0e10cSrcweir 
359cdf0e10cSrcweir     const drawinglayer::primitive2d::Primitive2DReference aReference(
360cdf0e10cSrcweir         new AnchorPrimitive( maTriangle,
361cdf0e10cSrcweir                              maLine,
362cdf0e10cSrcweir                              maLineTop,
363cdf0e10cSrcweir                              GetAnchorState(),
364cdf0e10cSrcweir                              getBaseColor().getBColor(),
365cdf0e10cSrcweir                              ANCHORLINE_WIDTH * 15.0,
366cdf0e10cSrcweir                              getShadowedEffect(),
367cdf0e10cSrcweir                              getLineSolid()) );
368cdf0e10cSrcweir 
369cdf0e10cSrcweir     return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
370cdf0e10cSrcweir }
371cdf0e10cSrcweir 
372cdf0e10cSrcweir void AnchorOverlayObject::SetAllPosition( const basegfx::B2DPoint& rPoint1,
373cdf0e10cSrcweir                                           const basegfx::B2DPoint& rPoint2,
374cdf0e10cSrcweir                                           const basegfx::B2DPoint& rPoint3,
375cdf0e10cSrcweir                                           const basegfx::B2DPoint& rPoint4,
376cdf0e10cSrcweir                                           const basegfx::B2DPoint& rPoint5,
377cdf0e10cSrcweir                                           const basegfx::B2DPoint& rPoint6,
378cdf0e10cSrcweir                                           const basegfx::B2DPoint& rPoint7)
379cdf0e10cSrcweir {
380cdf0e10cSrcweir     if ( rPoint1 != getBasePosition() ||
381cdf0e10cSrcweir          rPoint2 != GetSecondPosition() ||
382cdf0e10cSrcweir          rPoint3 != GetThirdPosition() ||
383cdf0e10cSrcweir          rPoint4 != GetFourthPosition() ||
384cdf0e10cSrcweir          rPoint5 != GetFifthPosition() ||
385cdf0e10cSrcweir          rPoint6 != GetSixthPosition() ||
386cdf0e10cSrcweir          rPoint7 != GetSeventhPosition() )
387cdf0e10cSrcweir     {
388cdf0e10cSrcweir         maBasePosition = rPoint1;
389cdf0e10cSrcweir         maSecondPosition = rPoint2;
390cdf0e10cSrcweir         maThirdPosition = rPoint3;
391cdf0e10cSrcweir         maFourthPosition = rPoint4;
392cdf0e10cSrcweir         maFifthPosition = rPoint5;
393cdf0e10cSrcweir         maSixthPosition = rPoint6;
394cdf0e10cSrcweir         maSeventhPosition = rPoint7;
395cdf0e10cSrcweir 
396cdf0e10cSrcweir         implResetGeometry();
397cdf0e10cSrcweir         objectChange();
398cdf0e10cSrcweir     }
399cdf0e10cSrcweir }
400cdf0e10cSrcweir 
401cdf0e10cSrcweir void AnchorOverlayObject::SetSixthPosition(const basegfx::B2DPoint& rNew)
402cdf0e10cSrcweir {
403cdf0e10cSrcweir   if(rNew != maSixthPosition)
404cdf0e10cSrcweir   {
405cdf0e10cSrcweir       maSixthPosition = rNew;
406cdf0e10cSrcweir         implResetGeometry();
407cdf0e10cSrcweir       objectChange();
408cdf0e10cSrcweir   }
409cdf0e10cSrcweir }
410cdf0e10cSrcweir 
411cdf0e10cSrcweir void AnchorOverlayObject::SetSeventhPosition(const basegfx::B2DPoint& rNew)
412cdf0e10cSrcweir {
413cdf0e10cSrcweir   if(rNew != maSeventhPosition)
414cdf0e10cSrcweir   {
415cdf0e10cSrcweir       maSeventhPosition = rNew;
416cdf0e10cSrcweir         implResetGeometry();
417cdf0e10cSrcweir       objectChange();
418cdf0e10cSrcweir   }
419cdf0e10cSrcweir }
420cdf0e10cSrcweir 
421cdf0e10cSrcweir void AnchorOverlayObject::SetTriPosition(const basegfx::B2DPoint& rPoint1,const basegfx::B2DPoint& rPoint2,const basegfx::B2DPoint& rPoint3,
422cdf0e10cSrcweir                                   const basegfx::B2DPoint& rPoint4,const basegfx::B2DPoint& rPoint5)
423cdf0e10cSrcweir {
424cdf0e10cSrcweir     if(rPoint1 != getBasePosition()
425cdf0e10cSrcweir         || rPoint2 != GetSecondPosition()
426cdf0e10cSrcweir         || rPoint3 != GetThirdPosition()
427cdf0e10cSrcweir         || rPoint4 != GetFourthPosition()
428cdf0e10cSrcweir         || rPoint5 != GetFifthPosition())
429cdf0e10cSrcweir     {
430cdf0e10cSrcweir       maBasePosition = rPoint1;
431cdf0e10cSrcweir       maSecondPosition = rPoint2;
432cdf0e10cSrcweir       maThirdPosition = rPoint3;
433cdf0e10cSrcweir       maFourthPosition = rPoint4;
434cdf0e10cSrcweir       maFifthPosition = rPoint5;
435cdf0e10cSrcweir 
436cdf0e10cSrcweir       implResetGeometry();
437cdf0e10cSrcweir       objectChange();
438cdf0e10cSrcweir     }
439cdf0e10cSrcweir }
440cdf0e10cSrcweir 
441cdf0e10cSrcweir void AnchorOverlayObject::setLineSolid( const bool bNew )
442cdf0e10cSrcweir {
443cdf0e10cSrcweir   if ( bNew != getLineSolid() )
444cdf0e10cSrcweir   {
445cdf0e10cSrcweir       mbLineSolid = bNew;
446cdf0e10cSrcweir       objectChange();
447cdf0e10cSrcweir   }
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
450cdf0e10cSrcweir void AnchorOverlayObject::SetAnchorState( const AnchorState aState)
451cdf0e10cSrcweir {
452cdf0e10cSrcweir   if ( mAnchorState != aState)
453cdf0e10cSrcweir   {
454cdf0e10cSrcweir       mAnchorState = aState;
455cdf0e10cSrcweir       objectChange();
456cdf0e10cSrcweir   }
457cdf0e10cSrcweir }
458cdf0e10cSrcweir 
459cdf0e10cSrcweir } } // end of namespace sw::annotation
460cdf0e10cSrcweir 
461