1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file
5f6e50924SAndrew Rist * distributed with this work for additional information
6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist * software distributed under the License is distributed on an
15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the
17f6e50924SAndrew Rist * specific language governing permissions and limitations
18f6e50924SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20f6e50924SAndrew Rist *************************************************************/
21f6e50924SAndrew Rist
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_svx.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir #include <algorithm>
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <svx/svdhdl.hxx>
28cdf0e10cSrcweir #include <svx/svdpagv.hxx>
29cdf0e10cSrcweir #include <svx/svdetc.hxx>
30cdf0e10cSrcweir #include <svx/svdmrkv.hxx>
31cdf0e10cSrcweir #include <vcl/window.hxx>
32cdf0e10cSrcweir
33cdf0e10cSrcweir #include <vcl/virdev.hxx>
34cdf0e10cSrcweir #include <tools/poly.hxx>
35cdf0e10cSrcweir #include <vcl/bmpacc.hxx>
36cdf0e10cSrcweir
37cdf0e10cSrcweir #include <svx/sxekitm.hxx>
38cdf0e10cSrcweir #include "svx/svdstr.hrc"
39cdf0e10cSrcweir #include "svx/svdglob.hxx"
40cdf0e10cSrcweir
41cdf0e10cSrcweir #include <svx/svdmodel.hxx>
42cdf0e10cSrcweir #include "gradtrns.hxx"
43cdf0e10cSrcweir #include <svx/xflgrit.hxx>
44cdf0e10cSrcweir #include <svx/svdundo.hxx>
45cdf0e10cSrcweir #include <svx/dialmgr.hxx>
46cdf0e10cSrcweir #include <svx/xflftrit.hxx>
47cdf0e10cSrcweir
48cdf0e10cSrcweir // #105678#
49cdf0e10cSrcweir #include <svx/svdopath.hxx>
50cdf0e10cSrcweir #include <basegfx/vector/b2dvector.hxx>
51cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
52cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx>
53cdf0e10cSrcweir #include <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
54cdf0e10cSrcweir #include <svx/sdr/overlay/overlaybitmapex.hxx>
55cdf0e10cSrcweir #include <svx/sdr/overlay/overlayline.hxx>
56cdf0e10cSrcweir #include <svx/sdr/overlay/overlaytriangle.hxx>
571cd65da9SArmin Le Grand #include <svx/sdr/overlay/overlayrectangle.hxx>
58cdf0e10cSrcweir #include <svx/sdrpagewindow.hxx>
59cdf0e10cSrcweir #include <svx/sdrpaintwindow.hxx>
60cdf0e10cSrcweir #include <vcl/svapp.hxx>
61cdf0e10cSrcweir #include <svx/sdr/overlay/overlaypolypolygon.hxx>
62cdf0e10cSrcweir #include <vcl/lazydelete.hxx>
63cdf0e10cSrcweir
642376739dSArmin Le Grand #include <basegfx/polygon/b2dpolygontools.hxx>
652376739dSArmin Le Grand #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
662376739dSArmin Le Grand #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
672376739dSArmin Le Grand #include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
682376739dSArmin Le Grand #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
692376739dSArmin Le Grand #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
708185c382SArmin Le Grand #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
712376739dSArmin Le Grand
72cdf0e10cSrcweir // #i15222#
739ebd8e31Smseidel // Due to the resource problems in Win95/98 with bitmap resources I
749ebd8e31Smseidel // will change this handle bitmap providing class. Old version was splitting
75cdf0e10cSrcweir // and preparing all small handle bitmaps in device bitmap format, now this will
769ebd8e31Smseidel // be done on the fly. Thus, there is only the one big bitmap remembered. With
779ebd8e31Smseidel // three source bitmaps, this will be 3 system bitmap resources instead of hundreds.
78cdf0e10cSrcweir // The price for that needs to be evaluated. Maybe we will need another change here
79cdf0e10cSrcweir // if this is too expensive.
80cdf0e10cSrcweir class SdrHdlBitmapSet
81cdf0e10cSrcweir {
82cdf0e10cSrcweir // the bitmap holding all infos
83cdf0e10cSrcweir BitmapEx maMarkersBitmap;
84cdf0e10cSrcweir
85cdf0e10cSrcweir // the cropped Bitmaps for reusage
86cdf0e10cSrcweir ::std::vector< BitmapEx > maRealMarkers;
87cdf0e10cSrcweir
88cdf0e10cSrcweir // elpers
89cdf0e10cSrcweir BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle);
90cdf0e10cSrcweir
91cdf0e10cSrcweir public:
92cdf0e10cSrcweir SdrHdlBitmapSet(sal_uInt16 nResId);
93cdf0e10cSrcweir ~SdrHdlBitmapSet();
94cdf0e10cSrcweir
95cdf0e10cSrcweir const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd=0);
96cdf0e10cSrcweir };
97cdf0e10cSrcweir
984d196ef4Smseidel
99cdf0e10cSrcweir #define KIND_COUNT (14)
100cdf0e10cSrcweir #define INDEX_COUNT (6)
101e794b455Smseidel #define INDIVIDUAL_COUNT (6)
102cdf0e10cSrcweir
SdrHdlBitmapSet(sal_uInt16 nResId)103cdf0e10cSrcweir SdrHdlBitmapSet::SdrHdlBitmapSet(sal_uInt16 nResId)
1041059e62bSmseidel : maMarkersBitmap(ResId(nResId, *ImpGetResMgr())), // just use resource with alpha channel
1055198b0daSmseidel // 14 kinds (BitmapMarkerKind) use index [0..5], 6 extra
106cdf0e10cSrcweir maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir }
109cdf0e10cSrcweir
~SdrHdlBitmapSet()110cdf0e10cSrcweir SdrHdlBitmapSet::~SdrHdlBitmapSet()
111cdf0e10cSrcweir {
112cdf0e10cSrcweir }
113cdf0e10cSrcweir
impGetOrCreateTargetBitmap(sal_uInt16 nIndex,const Rectangle & rRectangle)114cdf0e10cSrcweir BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle)
115cdf0e10cSrcweir {
116cdf0e10cSrcweir BitmapEx& rTargetBitmap = maRealMarkers[nIndex];
117cdf0e10cSrcweir
118cdf0e10cSrcweir if(rTargetBitmap.IsEmpty())
119cdf0e10cSrcweir {
120cdf0e10cSrcweir rTargetBitmap = maMarkersBitmap;
121cdf0e10cSrcweir rTargetBitmap.Crop(rRectangle);
122cdf0e10cSrcweir }
123cdf0e10cSrcweir
124cdf0e10cSrcweir return rTargetBitmap;
125cdf0e10cSrcweir }
126cdf0e10cSrcweir
1271059e62bSmseidel // change getting of bitmap to use the big resource bitmap
GetBitmapEx(BitmapMarkerKind eKindOfMarker,sal_uInt16 nInd)128cdf0e10cSrcweir const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir // fill in size and source position in maMarkersBitmap
131cdf0e10cSrcweir const sal_uInt16 nYPos(nInd * 11);
132cdf0e10cSrcweir
133cdf0e10cSrcweir switch(eKindOfMarker)
134cdf0e10cSrcweir {
135cdf0e10cSrcweir default:
136cdf0e10cSrcweir {
137cdf0e10cSrcweir DBG_ERROR( "unknown kind of marker" );
138cdf0e10cSrcweir // no break here, return Rect_7x7 as default
139cdf0e10cSrcweir }
140cdf0e10cSrcweir case Rect_7x7:
141cdf0e10cSrcweir {
142cdf0e10cSrcweir return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, Rectangle(Point(0, nYPos), Size(7, 7)));
143cdf0e10cSrcweir }
144cdf0e10cSrcweir
145cdf0e10cSrcweir case Rect_9x9:
146cdf0e10cSrcweir {
147cdf0e10cSrcweir return impGetOrCreateTargetBitmap((1 * INDEX_COUNT) + nInd, Rectangle(Point(7, nYPos), Size(9, 9)));
148cdf0e10cSrcweir }
149cdf0e10cSrcweir
150cdf0e10cSrcweir case Rect_11x11:
151cdf0e10cSrcweir {
152cdf0e10cSrcweir return impGetOrCreateTargetBitmap((2 * INDEX_COUNT) + nInd, Rectangle(Point(16, nYPos), Size(11, 11)));
153cdf0e10cSrcweir }
154cdf0e10cSrcweir
155cdf0e10cSrcweir case Rect_13x13:
156cdf0e10cSrcweir {
157cdf0e10cSrcweir const sal_uInt16 nIndex((3 * INDEX_COUNT) + nInd);
158cdf0e10cSrcweir
159cdf0e10cSrcweir switch(nInd)
160cdf0e10cSrcweir {
161cdf0e10cSrcweir case 0:
162cdf0e10cSrcweir {
163cdf0e10cSrcweir return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 66), Size(13, 13)));
164cdf0e10cSrcweir }
165cdf0e10cSrcweir case 1:
166cdf0e10cSrcweir {
167cdf0e10cSrcweir return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 66), Size(13, 13)));
168cdf0e10cSrcweir }
169cdf0e10cSrcweir case 2:
170cdf0e10cSrcweir {
1714772d9afSArmin Le Grand return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 79), Size(13, 13)));
172cdf0e10cSrcweir }
173cdf0e10cSrcweir case 3:
174cdf0e10cSrcweir {
1754772d9afSArmin Le Grand return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 79), Size(13, 13)));
176cdf0e10cSrcweir }
177cdf0e10cSrcweir case 4:
178cdf0e10cSrcweir {
1794772d9afSArmin Le Grand return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 79), Size(13, 13)));
180cdf0e10cSrcweir }
181cdf0e10cSrcweir default: // case 5:
182cdf0e10cSrcweir {
183cdf0e10cSrcweir return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 66), Size(13, 13)));
184cdf0e10cSrcweir }
185cdf0e10cSrcweir }
186cdf0e10cSrcweir }
187cdf0e10cSrcweir
188cdf0e10cSrcweir case Circ_7x7:
1894772d9afSArmin Le Grand case Customshape_7x7:
190cdf0e10cSrcweir {
191cdf0e10cSrcweir return impGetOrCreateTargetBitmap((4 * INDEX_COUNT) + nInd, Rectangle(Point(27, nYPos), Size(7, 7)));
192cdf0e10cSrcweir }
193cdf0e10cSrcweir
194cdf0e10cSrcweir case Circ_9x9:
1954772d9afSArmin Le Grand case Customshape_9x9:
196cdf0e10cSrcweir {
197cdf0e10cSrcweir return impGetOrCreateTargetBitmap((5 * INDEX_COUNT) + nInd, Rectangle(Point(34, nYPos), Size(9, 9)));
198cdf0e10cSrcweir }
199cdf0e10cSrcweir
200cdf0e10cSrcweir case Circ_11x11:
2014772d9afSArmin Le Grand case Customshape_11x11:
202cdf0e10cSrcweir {
203cdf0e10cSrcweir return impGetOrCreateTargetBitmap((6 * INDEX_COUNT) + nInd, Rectangle(Point(43, nYPos), Size(11, 11)));
204cdf0e10cSrcweir }
205cdf0e10cSrcweir
206cdf0e10cSrcweir case Elli_7x9:
207cdf0e10cSrcweir {
208cdf0e10cSrcweir return impGetOrCreateTargetBitmap((7 * INDEX_COUNT) + nInd, Rectangle(Point(54, nYPos), Size(7, 9)));
209cdf0e10cSrcweir }
210cdf0e10cSrcweir
211cdf0e10cSrcweir case Elli_9x11:
212cdf0e10cSrcweir {
213cdf0e10cSrcweir return impGetOrCreateTargetBitmap((8 * INDEX_COUNT) + nInd, Rectangle(Point(61, nYPos), Size(9, 11)));
214cdf0e10cSrcweir }
215cdf0e10cSrcweir
216cdf0e10cSrcweir case Elli_9x7:
217cdf0e10cSrcweir {
218cdf0e10cSrcweir return impGetOrCreateTargetBitmap((9 * INDEX_COUNT) + nInd, Rectangle(Point(70, nYPos), Size(9, 7)));
219cdf0e10cSrcweir }
220cdf0e10cSrcweir
221cdf0e10cSrcweir case Elli_11x9:
222cdf0e10cSrcweir {
223cdf0e10cSrcweir return impGetOrCreateTargetBitmap((10 * INDEX_COUNT) + nInd, Rectangle(Point(79, nYPos), Size(11, 9)));
224cdf0e10cSrcweir }
225cdf0e10cSrcweir
226cdf0e10cSrcweir case RectPlus_7x7:
227cdf0e10cSrcweir {
228cdf0e10cSrcweir return impGetOrCreateTargetBitmap((11 * INDEX_COUNT) + nInd, Rectangle(Point(90, nYPos), Size(7, 7)));
229cdf0e10cSrcweir }
230cdf0e10cSrcweir
231cdf0e10cSrcweir case RectPlus_9x9:
232cdf0e10cSrcweir {
233cdf0e10cSrcweir return impGetOrCreateTargetBitmap((12 * INDEX_COUNT) + nInd, Rectangle(Point(97, nYPos), Size(9, 9)));
234cdf0e10cSrcweir }
235cdf0e10cSrcweir
236cdf0e10cSrcweir case RectPlus_11x11:
237cdf0e10cSrcweir {
238cdf0e10cSrcweir return impGetOrCreateTargetBitmap((13 * INDEX_COUNT) + nInd, Rectangle(Point(106, nYPos), Size(11, 11)));
239cdf0e10cSrcweir }
240cdf0e10cSrcweir
241cdf0e10cSrcweir case Crosshair:
242cdf0e10cSrcweir {
2435198b0daSmseidel return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 0, Rectangle(Point(0, 66), Size(13, 13)));
2445198b0daSmseidel }
2455198b0daSmseidel
2465198b0daSmseidel case Crosshair_Unselected:
2475198b0daSmseidel {
2485198b0daSmseidel return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(0, 79), Size(13, 13)));
249cdf0e10cSrcweir }
250cdf0e10cSrcweir
251cdf0e10cSrcweir case Glue:
252cdf0e10cSrcweir {
2534e278df9Smseidel return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, Rectangle(Point(13, 70), Size(11, 11)));
254cdf0e10cSrcweir }
255cdf0e10cSrcweir
2565db901c0Smseidel case Glue_Unselected:
2575db901c0Smseidel {
2584e278df9Smseidel return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(13, 81), Size(11, 11)));
2595db901c0Smseidel }
2605db901c0Smseidel
261cdf0e10cSrcweir case Anchor: // #101688# AnchorTR for SW
262cdf0e10cSrcweir case AnchorTR:
263cdf0e10cSrcweir {
2645198b0daSmseidel return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 4, Rectangle(Point(24, 68), Size(24, 24)));
265cdf0e10cSrcweir }
266cdf0e10cSrcweir
2671059e62bSmseidel // #98388# add AnchorPressed to be able to animate anchor control
268cdf0e10cSrcweir case AnchorPressed:
269cdf0e10cSrcweir case AnchorPressedTR:
270cdf0e10cSrcweir {
2715198b0daSmseidel return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 5, Rectangle(Point(48, 68), Size(24, 24)));
272cdf0e10cSrcweir }
273cdf0e10cSrcweir }
274cdf0e10cSrcweir
27586e1cf34SPedro Giffuni // cannot happen since all paths return something; return Rect_7x7 as default (see switch)
276cdf0e10cSrcweir return maRealMarkers[0];
277cdf0e10cSrcweir }
278cdf0e10cSrcweir
279cdf0e10cSrcweir
getSimpleSet()280*d0a36963Smseidel SdrHdlBitmapSet& getSimpleSet() // redirects to Fine Handles now
281cdf0e10cSrcweir {
282*d0a36963Smseidel static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aSimpleSet(new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS));
283cdf0e10cSrcweir return *aSimpleSet.get();
284cdf0e10cSrcweir }
285cdf0e10cSrcweir
getModernSet()286cdf0e10cSrcweir SdrHdlBitmapSet& getModernSet()
287cdf0e10cSrcweir {
288cdf0e10cSrcweir static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS));
289cdf0e10cSrcweir return *aModernSet.get();
290cdf0e10cSrcweir }
291cdf0e10cSrcweir
getHighContrastSet()292cdf0e10cSrcweir SdrHdlBitmapSet& getHighContrastSet()
293cdf0e10cSrcweir {
294cdf0e10cSrcweir static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS));
295cdf0e10cSrcweir return *aHighContrastSet.get();
296cdf0e10cSrcweir }
297cdf0e10cSrcweir
298cdf0e10cSrcweir
SdrHdl()299cdf0e10cSrcweir SdrHdl::SdrHdl():
300cdf0e10cSrcweir pObj(NULL),
301cdf0e10cSrcweir pPV(NULL),
302cdf0e10cSrcweir pHdlList(NULL),
303cdf0e10cSrcweir eKind(HDL_MOVE),
304cdf0e10cSrcweir nDrehWink(0),
305cdf0e10cSrcweir nObjHdlNum(0),
306cdf0e10cSrcweir nPolyNum(0),
307cdf0e10cSrcweir nPPntNum(0),
308cdf0e10cSrcweir nSourceHdlNum(0),
309cdf0e10cSrcweir bSelect(sal_False),
310cdf0e10cSrcweir b1PixMore(sal_False),
311cdf0e10cSrcweir bPlusHdl(sal_False),
312cdf0e10cSrcweir mbMoveOutside(false),
313cdf0e10cSrcweir mbMouseOver(false)
314cdf0e10cSrcweir {
315cdf0e10cSrcweir }
316cdf0e10cSrcweir
SdrHdl(const Point & rPnt,SdrHdlKind eNewKind)317cdf0e10cSrcweir SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind):
318cdf0e10cSrcweir pObj(NULL),
319cdf0e10cSrcweir pPV(NULL),
320cdf0e10cSrcweir pHdlList(NULL),
321cdf0e10cSrcweir aPos(rPnt),
322cdf0e10cSrcweir eKind(eNewKind),
323cdf0e10cSrcweir nDrehWink(0),
324cdf0e10cSrcweir nObjHdlNum(0),
325cdf0e10cSrcweir nPolyNum(0),
326cdf0e10cSrcweir nPPntNum(0),
327cdf0e10cSrcweir nSourceHdlNum(0),
328cdf0e10cSrcweir bSelect(sal_False),
329cdf0e10cSrcweir b1PixMore(sal_False),
330cdf0e10cSrcweir bPlusHdl(sal_False),
331cdf0e10cSrcweir mbMoveOutside(false),
332cdf0e10cSrcweir mbMouseOver(false)
333cdf0e10cSrcweir {
334cdf0e10cSrcweir }
335cdf0e10cSrcweir
~SdrHdl()336cdf0e10cSrcweir SdrHdl::~SdrHdl()
337cdf0e10cSrcweir {
338cdf0e10cSrcweir GetRidOfIAObject();
339cdf0e10cSrcweir }
340cdf0e10cSrcweir
Set1PixMore(sal_Bool bJa)341cdf0e10cSrcweir void SdrHdl::Set1PixMore(sal_Bool bJa)
342cdf0e10cSrcweir {
343cdf0e10cSrcweir if(b1PixMore != bJa)
344cdf0e10cSrcweir {
345cdf0e10cSrcweir b1PixMore = bJa;
346cdf0e10cSrcweir
347cdf0e10cSrcweir // create new display
348cdf0e10cSrcweir Touch();
349cdf0e10cSrcweir }
350cdf0e10cSrcweir }
351cdf0e10cSrcweir
SetMoveOutside(bool bMoveOutside)352cdf0e10cSrcweir void SdrHdl::SetMoveOutside( bool bMoveOutside )
353cdf0e10cSrcweir {
354cdf0e10cSrcweir if(mbMoveOutside != bMoveOutside)
355cdf0e10cSrcweir {
356cdf0e10cSrcweir mbMoveOutside = bMoveOutside;
357cdf0e10cSrcweir
358cdf0e10cSrcweir // create new display
359cdf0e10cSrcweir Touch();
360cdf0e10cSrcweir }
361cdf0e10cSrcweir }
362cdf0e10cSrcweir
SetDrehWink(long n)363cdf0e10cSrcweir void SdrHdl::SetDrehWink(long n)
364cdf0e10cSrcweir {
365cdf0e10cSrcweir if(nDrehWink != n)
366cdf0e10cSrcweir {
367cdf0e10cSrcweir nDrehWink = n;
368cdf0e10cSrcweir
369cdf0e10cSrcweir // create new display
370cdf0e10cSrcweir Touch();
371cdf0e10cSrcweir }
372cdf0e10cSrcweir }
373cdf0e10cSrcweir
SetPos(const Point & rPnt)374cdf0e10cSrcweir void SdrHdl::SetPos(const Point& rPnt)
375cdf0e10cSrcweir {
376cdf0e10cSrcweir if(aPos != rPnt)
377cdf0e10cSrcweir {
378cdf0e10cSrcweir // remember new position
379cdf0e10cSrcweir aPos = rPnt;
380cdf0e10cSrcweir
381cdf0e10cSrcweir // create new display
382cdf0e10cSrcweir Touch();
383cdf0e10cSrcweir }
384cdf0e10cSrcweir }
385cdf0e10cSrcweir
SetSelected(sal_Bool bJa)386cdf0e10cSrcweir void SdrHdl::SetSelected(sal_Bool bJa)
387cdf0e10cSrcweir {
388cdf0e10cSrcweir if(bSelect != bJa)
389cdf0e10cSrcweir {
390cdf0e10cSrcweir // remember new value
391cdf0e10cSrcweir bSelect = bJa;
392cdf0e10cSrcweir
393cdf0e10cSrcweir // create new display
394cdf0e10cSrcweir Touch();
395cdf0e10cSrcweir }
396cdf0e10cSrcweir }
397cdf0e10cSrcweir
SetHdlList(SdrHdlList * pList)398cdf0e10cSrcweir void SdrHdl::SetHdlList(SdrHdlList* pList)
399cdf0e10cSrcweir {
400cdf0e10cSrcweir if(pHdlList != pList)
401cdf0e10cSrcweir {
4021059e62bSmseidel // remember list
403cdf0e10cSrcweir pHdlList = pList;
404cdf0e10cSrcweir
4051059e62bSmseidel // now it's possible to create graphic representation
406cdf0e10cSrcweir Touch();
407cdf0e10cSrcweir }
408cdf0e10cSrcweir }
409cdf0e10cSrcweir
SetObj(SdrObject * pNewObj)410cdf0e10cSrcweir void SdrHdl::SetObj(SdrObject* pNewObj)
411cdf0e10cSrcweir {
412cdf0e10cSrcweir if(pObj != pNewObj)
413cdf0e10cSrcweir {
414cdf0e10cSrcweir // remember new object
415cdf0e10cSrcweir pObj = pNewObj;
416cdf0e10cSrcweir
417cdf0e10cSrcweir // graphic representation may have changed
418cdf0e10cSrcweir Touch();
419cdf0e10cSrcweir }
420cdf0e10cSrcweir }
421cdf0e10cSrcweir
Touch()422cdf0e10cSrcweir void SdrHdl::Touch()
423cdf0e10cSrcweir {
424cdf0e10cSrcweir // force update of graphic representation
425cdf0e10cSrcweir CreateB2dIAObject();
426cdf0e10cSrcweir }
427cdf0e10cSrcweir
GetRidOfIAObject()428cdf0e10cSrcweir void SdrHdl::GetRidOfIAObject()
429cdf0e10cSrcweir {
430cdf0e10cSrcweir //OLMaIAOGroup.Delete();
431cdf0e10cSrcweir
432cdf0e10cSrcweir // OVERLAYMANAGER
433cdf0e10cSrcweir maOverlayGroup.clear();
434cdf0e10cSrcweir }
435cdf0e10cSrcweir
CreateB2dIAObject()436cdf0e10cSrcweir void SdrHdl::CreateB2dIAObject()
437cdf0e10cSrcweir {
438cdf0e10cSrcweir // first throw away old one
439cdf0e10cSrcweir GetRidOfIAObject();
440cdf0e10cSrcweir
441cdf0e10cSrcweir if(pHdlList && pHdlList->GetView() && !pHdlList->GetView()->areMarkHandlesHidden())
442cdf0e10cSrcweir {
443cdf0e10cSrcweir BitmapColorIndex eColIndex = LightGreen;
444cdf0e10cSrcweir BitmapMarkerKind eKindOfMarker = Rect_7x7;
445cdf0e10cSrcweir
446cdf0e10cSrcweir sal_Bool bRot = pHdlList->IsRotateShear();
447cdf0e10cSrcweir if(pObj)
448cdf0e10cSrcweir eColIndex = (bSelect) ? Cyan : LightCyan;
449cdf0e10cSrcweir if(bRot)
450cdf0e10cSrcweir {
4519ebd8e31Smseidel // Rotation handles in red
452cdf0e10cSrcweir if(pObj && bSelect)
453cdf0e10cSrcweir eColIndex = Red;
454cdf0e10cSrcweir else
455cdf0e10cSrcweir eColIndex = LightRed;
456cdf0e10cSrcweir }
457cdf0e10cSrcweir
458cdf0e10cSrcweir switch(eKind)
459cdf0e10cSrcweir {
460cdf0e10cSrcweir case HDL_MOVE:
461cdf0e10cSrcweir {
462cdf0e10cSrcweir eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
463cdf0e10cSrcweir break;
464cdf0e10cSrcweir }
465cdf0e10cSrcweir case HDL_UPLFT:
466cdf0e10cSrcweir case HDL_UPRGT:
467cdf0e10cSrcweir case HDL_LWLFT:
468cdf0e10cSrcweir case HDL_LWRGT:
469cdf0e10cSrcweir {
4709ebd8e31Smseidel // Corner handles
471cdf0e10cSrcweir if(bRot)
472cdf0e10cSrcweir {
473cdf0e10cSrcweir eKindOfMarker = Circ_7x7;
474cdf0e10cSrcweir }
475cdf0e10cSrcweir else
476cdf0e10cSrcweir {
477cdf0e10cSrcweir eKindOfMarker = Rect_7x7;
478cdf0e10cSrcweir }
479cdf0e10cSrcweir break;
480cdf0e10cSrcweir }
481cdf0e10cSrcweir case HDL_UPPER:
482cdf0e10cSrcweir case HDL_LOWER:
483cdf0e10cSrcweir {
484cdf0e10cSrcweir // Upper/Lower handles
485cdf0e10cSrcweir if(bRot)
486cdf0e10cSrcweir {
487cdf0e10cSrcweir eKindOfMarker = Elli_9x7;
488cdf0e10cSrcweir }
489cdf0e10cSrcweir else
490cdf0e10cSrcweir {
491cdf0e10cSrcweir eKindOfMarker = Rect_7x7;
492cdf0e10cSrcweir }
493cdf0e10cSrcweir break;
494cdf0e10cSrcweir }
495cdf0e10cSrcweir case HDL_LEFT:
496cdf0e10cSrcweir case HDL_RIGHT:
497cdf0e10cSrcweir {
498cdf0e10cSrcweir // Left/Right handles
499cdf0e10cSrcweir if(bRot)
500cdf0e10cSrcweir {
501cdf0e10cSrcweir eKindOfMarker = Elli_7x9;
502cdf0e10cSrcweir }
503cdf0e10cSrcweir else
504cdf0e10cSrcweir {
505cdf0e10cSrcweir eKindOfMarker = Rect_7x7;
506cdf0e10cSrcweir }
507cdf0e10cSrcweir break;
508cdf0e10cSrcweir }
509cdf0e10cSrcweir case HDL_POLY:
510cdf0e10cSrcweir {
511cdf0e10cSrcweir if(bRot)
512cdf0e10cSrcweir {
513cdf0e10cSrcweir eKindOfMarker = (b1PixMore) ? Circ_9x9 : Circ_7x7;
514cdf0e10cSrcweir }
515cdf0e10cSrcweir else
516cdf0e10cSrcweir {
517cdf0e10cSrcweir eKindOfMarker = (b1PixMore) ? Rect_9x9 : Rect_7x7;
518cdf0e10cSrcweir }
519cdf0e10cSrcweir break;
520cdf0e10cSrcweir }
521cdf0e10cSrcweir case HDL_BWGT: // weight at poly
522cdf0e10cSrcweir {
523cdf0e10cSrcweir eKindOfMarker = Circ_7x7;
524cdf0e10cSrcweir break;
525cdf0e10cSrcweir }
526cdf0e10cSrcweir case HDL_CIRC:
527cdf0e10cSrcweir {
528cdf0e10cSrcweir eKindOfMarker = Rect_11x11;
529cdf0e10cSrcweir break;
530cdf0e10cSrcweir }
531cdf0e10cSrcweir case HDL_REF1:
532cdf0e10cSrcweir case HDL_REF2:
533cdf0e10cSrcweir {
534cdf0e10cSrcweir eKindOfMarker = Crosshair;
535cdf0e10cSrcweir break;
536cdf0e10cSrcweir }
5375198b0daSmseidel {
5385198b0daSmseidel eKindOfMarker = Crosshair_Unselected;
5395198b0daSmseidel break;
5405198b0daSmseidel }
541cdf0e10cSrcweir case HDL_GLUE:
542cdf0e10cSrcweir {
543cdf0e10cSrcweir eKindOfMarker = Glue;
544cdf0e10cSrcweir break;
545cdf0e10cSrcweir }
5465db901c0Smseidel case HDL_GLUE_UNSEL:
5475db901c0Smseidel {
5485db901c0Smseidel eKindOfMarker = Glue_Unselected;
5495db901c0Smseidel break;
5505db901c0Smseidel }
551cdf0e10cSrcweir case HDL_ANCHOR:
552cdf0e10cSrcweir {
553cdf0e10cSrcweir eKindOfMarker = Anchor;
554cdf0e10cSrcweir break;
555cdf0e10cSrcweir }
556cdf0e10cSrcweir case HDL_USER:
557cdf0e10cSrcweir {
558cdf0e10cSrcweir break;
559cdf0e10cSrcweir }
560cdf0e10cSrcweir // #101688# top right anchor for SW
561cdf0e10cSrcweir case HDL_ANCHOR_TR:
562cdf0e10cSrcweir {
563cdf0e10cSrcweir eKindOfMarker = AnchorTR;
564cdf0e10cSrcweir break;
565cdf0e10cSrcweir }
566cdf0e10cSrcweir
567cdf0e10cSrcweir // for SJ and the CustomShapeHandles:
568cdf0e10cSrcweir case HDL_CUSTOMSHAPE1:
569cdf0e10cSrcweir {
5705f27b83cSArmin Le Grand eKindOfMarker = (b1PixMore) ? Customshape_9x9 : Customshape_7x7;
571cdf0e10cSrcweir eColIndex = Yellow;
572cdf0e10cSrcweir break;
573cdf0e10cSrcweir }
574cdf0e10cSrcweir default:
575cdf0e10cSrcweir break;
576cdf0e10cSrcweir }
577cdf0e10cSrcweir
578cdf0e10cSrcweir SdrMarkView* pView = pHdlList->GetView();
579cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
580cdf0e10cSrcweir
581cdf0e10cSrcweir if(pPageView)
582cdf0e10cSrcweir {
583cdf0e10cSrcweir for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
584cdf0e10cSrcweir {
585cdf0e10cSrcweir // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
586cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
587cdf0e10cSrcweir
588cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
589cdf0e10cSrcweir {
590cdf0e10cSrcweir Point aMoveOutsideOffset(0, 0);
591cdf0e10cSrcweir
592cdf0e10cSrcweir // add offset if necessary
593cdf0e10cSrcweir if(pHdlList->IsMoveOutside() || mbMoveOutside)
594cdf0e10cSrcweir {
595cdf0e10cSrcweir OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
596cdf0e10cSrcweir Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
597cdf0e10cSrcweir
598cdf0e10cSrcweir if(eKind == HDL_UPLFT || eKind == HDL_UPPER || eKind == HDL_UPRGT)
599cdf0e10cSrcweir aMoveOutsideOffset.Y() -= aOffset.Width();
600cdf0e10cSrcweir if(eKind == HDL_LWLFT || eKind == HDL_LOWER || eKind == HDL_LWRGT)
601cdf0e10cSrcweir aMoveOutsideOffset.Y() += aOffset.Height();
602cdf0e10cSrcweir if(eKind == HDL_UPLFT || eKind == HDL_LEFT || eKind == HDL_LWLFT)
603cdf0e10cSrcweir aMoveOutsideOffset.X() -= aOffset.Width();
604cdf0e10cSrcweir if(eKind == HDL_UPRGT || eKind == HDL_RIGHT || eKind == HDL_LWRGT)
605cdf0e10cSrcweir aMoveOutsideOffset.X() += aOffset.Height();
606cdf0e10cSrcweir }
607cdf0e10cSrcweir
608cdf0e10cSrcweir if(rPageWindow.GetOverlayManager())
609cdf0e10cSrcweir {
610cdf0e10cSrcweir basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
611cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
612cdf0e10cSrcweir aPosition,
613cdf0e10cSrcweir eColIndex,
614cdf0e10cSrcweir eKindOfMarker,
615cdf0e10cSrcweir aMoveOutsideOffset);
616cdf0e10cSrcweir
617cdf0e10cSrcweir // OVERLAYMANAGER
618cdf0e10cSrcweir if(pNewOverlayObject)
619cdf0e10cSrcweir {
620cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
621cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
622cdf0e10cSrcweir }
623cdf0e10cSrcweir }
624cdf0e10cSrcweir }
625cdf0e10cSrcweir }
626cdf0e10cSrcweir }
627cdf0e10cSrcweir }
628cdf0e10cSrcweir }
629cdf0e10cSrcweir
GetNextBigger(BitmapMarkerKind eKnd) const630cdf0e10cSrcweir BitmapMarkerKind SdrHdl::GetNextBigger(BitmapMarkerKind eKnd) const
631cdf0e10cSrcweir {
632cdf0e10cSrcweir BitmapMarkerKind eRetval(eKnd);
633cdf0e10cSrcweir
634cdf0e10cSrcweir switch(eKnd)
635cdf0e10cSrcweir {
636cdf0e10cSrcweir case Rect_7x7: eRetval = Rect_9x9; break;
637cdf0e10cSrcweir case Rect_9x9: eRetval = Rect_11x11; break;
638cdf0e10cSrcweir case Rect_11x11: eRetval = Rect_13x13; break;
639cdf0e10cSrcweir //case Rect_13x13: eRetval = ; break;
640cdf0e10cSrcweir
641cdf0e10cSrcweir case Circ_7x7: eRetval = Circ_9x9; break;
642cdf0e10cSrcweir case Circ_9x9: eRetval = Circ_11x11; break;
643cdf0e10cSrcweir //case Circ_11x11: eRetval = ; break;
644cdf0e10cSrcweir
6454772d9afSArmin Le Grand case Customshape_7x7: eRetval = Customshape_9x9; break;
6464772d9afSArmin Le Grand case Customshape_9x9: eRetval = Customshape_11x11; break;
6474772d9afSArmin Le Grand //case Customshape_11x11: eRetval = ; break;
6484772d9afSArmin Le Grand
649cdf0e10cSrcweir case Elli_7x9: eRetval = Elli_9x11; break;
650cdf0e10cSrcweir //case Elli_9x11: eRetval = ; break;
651cdf0e10cSrcweir
652cdf0e10cSrcweir case Elli_9x7: eRetval = Elli_11x9; break;
653cdf0e10cSrcweir //case Elli_11x9: eRetval = ; break;
654cdf0e10cSrcweir
655cdf0e10cSrcweir case RectPlus_7x7: eRetval = RectPlus_9x9; break;
656cdf0e10cSrcweir case RectPlus_9x9: eRetval = RectPlus_11x11; break;
657cdf0e10cSrcweir //case RectPlus_11x11: eRetval = ; break;
658cdf0e10cSrcweir
659cdf0e10cSrcweir //case Crosshair: eRetval = ; break;
660cdf0e10cSrcweir //case Glue: eRetval = ; break;
661cdf0e10cSrcweir
6621059e62bSmseidel // #98388# let anchor blink with its pressed state
663cdf0e10cSrcweir case Anchor: eRetval = AnchorPressed; break;
664cdf0e10cSrcweir
665cdf0e10cSrcweir // #101688# same for AnchorTR
666cdf0e10cSrcweir case AnchorTR: eRetval = AnchorPressedTR; break;
667cdf0e10cSrcweir default:
668cdf0e10cSrcweir break;
669cdf0e10cSrcweir }
670cdf0e10cSrcweir
671cdf0e10cSrcweir return eRetval;
672cdf0e10cSrcweir }
673cdf0e10cSrcweir
674cdf0e10cSrcweir // #101928#
ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker,sal_uInt16 nInd,sal_Bool bFine,sal_Bool bIsHighContrast)675cdf0e10cSrcweir BitmapEx SdrHdl::ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd, sal_Bool bFine, sal_Bool bIsHighContrast)
676cdf0e10cSrcweir {
677cdf0e10cSrcweir if(bIsHighContrast)
678cdf0e10cSrcweir {
679cdf0e10cSrcweir return getHighContrastSet().GetBitmapEx(eKindOfMarker, nInd);
680cdf0e10cSrcweir }
681cdf0e10cSrcweir else
682cdf0e10cSrcweir {
683cdf0e10cSrcweir if(bFine)
684cdf0e10cSrcweir {
685cdf0e10cSrcweir return getModernSet().GetBitmapEx(eKindOfMarker, nInd);
686cdf0e10cSrcweir }
687cdf0e10cSrcweir else
688cdf0e10cSrcweir {
689cdf0e10cSrcweir return getSimpleSet().GetBitmapEx(eKindOfMarker, nInd);
690cdf0e10cSrcweir }
691cdf0e10cSrcweir }
692cdf0e10cSrcweir }
693cdf0e10cSrcweir
CreateOverlayObject(const basegfx::B2DPoint & rPos,BitmapColorIndex eColIndex,BitmapMarkerKind eKindOfMarker,Point aMoveOutsideOffset)694cdf0e10cSrcweir ::sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
695cdf0e10cSrcweir const basegfx::B2DPoint& rPos,
696cdf0e10cSrcweir BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset)
697cdf0e10cSrcweir {
698cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pRetval = 0L;
699cdf0e10cSrcweir sal_Bool bIsFineHdl(pHdlList->IsFineHdl());
700cdf0e10cSrcweir const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
701cdf0e10cSrcweir sal_Bool bIsHighContrast(rStyleSettings.GetHighContrastMode());
702cdf0e10cSrcweir
703cdf0e10cSrcweir // support bigger sizes
704cdf0e10cSrcweir sal_Bool bForceBiggerSize(sal_False);
705cdf0e10cSrcweir
706cdf0e10cSrcweir if(pHdlList->GetHdlSize() > 3)
707cdf0e10cSrcweir {
7084772d9afSArmin Le Grand switch(eKindOfMarker)
7094772d9afSArmin Le Grand {
7104772d9afSArmin Le Grand case Anchor:
7114772d9afSArmin Le Grand case AnchorPressed:
7124772d9afSArmin Le Grand case AnchorTR:
7134772d9afSArmin Le Grand case AnchorPressedTR:
7144772d9afSArmin Le Grand {
7154772d9afSArmin Le Grand // #121463# For anchor, do not simply make bigger because of HdlSize,
7164772d9afSArmin Le Grand // do it dependent of IsSelected() which Writer can set in drag mode
7174772d9afSArmin Le Grand if(IsSelected())
7184772d9afSArmin Le Grand {
719cdf0e10cSrcweir bForceBiggerSize = sal_True;
720cdf0e10cSrcweir }
7214772d9afSArmin Le Grand break;
7224772d9afSArmin Le Grand }
7234772d9afSArmin Le Grand default:
7244772d9afSArmin Le Grand {
7254772d9afSArmin Le Grand bForceBiggerSize = sal_True;
7264772d9afSArmin Le Grand break;
7274772d9afSArmin Le Grand }
7284772d9afSArmin Le Grand }
7294772d9afSArmin Le Grand }
730cdf0e10cSrcweir
731cdf0e10cSrcweir // #101928# ...for high contrast, too.
732cdf0e10cSrcweir if(!bForceBiggerSize && bIsHighContrast)
733cdf0e10cSrcweir {
734cdf0e10cSrcweir // #107925#
735cdf0e10cSrcweir // ...but not for anchors, else they will not blink when activated
736cdf0e10cSrcweir if(Anchor != eKindOfMarker && AnchorTR != eKindOfMarker)
737cdf0e10cSrcweir {
738cdf0e10cSrcweir bForceBiggerSize = sal_True;
739cdf0e10cSrcweir }
740cdf0e10cSrcweir }
741cdf0e10cSrcweir
742cdf0e10cSrcweir if(bForceBiggerSize)
743cdf0e10cSrcweir {
744cdf0e10cSrcweir eKindOfMarker = GetNextBigger(eKindOfMarker);
745cdf0e10cSrcweir }
746cdf0e10cSrcweir
747cdf0e10cSrcweir // #97016# II This handle has the focus, visualize it
748cdf0e10cSrcweir if(IsFocusHdl() && pHdlList && pHdlList->GetFocusHdl() == this)
749cdf0e10cSrcweir {
750cdf0e10cSrcweir // create animated handle
751cdf0e10cSrcweir BitmapMarkerKind eNextBigger = GetNextBigger(eKindOfMarker);
752cdf0e10cSrcweir
753cdf0e10cSrcweir if(eNextBigger == eKindOfMarker)
754cdf0e10cSrcweir {
755cdf0e10cSrcweir // this may happen for the not supported getting-bigger types.
756cdf0e10cSrcweir // Choose an alternative here
757cdf0e10cSrcweir switch(eKindOfMarker)
758cdf0e10cSrcweir {
759cdf0e10cSrcweir case Rect_13x13: eNextBigger = Rect_11x11; break;
760cdf0e10cSrcweir case Circ_11x11: eNextBigger = Elli_11x9; break;
761cdf0e10cSrcweir case Elli_9x11: eNextBigger = Elli_11x9; break;
762cdf0e10cSrcweir case Elli_11x9: eNextBigger = Elli_9x11; break;
763cdf0e10cSrcweir case RectPlus_11x11: eNextBigger = Rect_13x13; break;
764cdf0e10cSrcweir
765cdf0e10cSrcweir case Crosshair:
7665198b0daSmseidel eNextBigger = Crosshair_Unselected;
767cdf0e10cSrcweir break;
768cdf0e10cSrcweir
769cdf0e10cSrcweir case Glue:
7705db901c0Smseidel eNextBigger = Glue_Unselected;
771cdf0e10cSrcweir break;
772cdf0e10cSrcweir default:
773cdf0e10cSrcweir break;
774cdf0e10cSrcweir }
775cdf0e10cSrcweir }
776cdf0e10cSrcweir
777cdf0e10cSrcweir // create animated hdl
778cdf0e10cSrcweir // #101928# use ImpGetBitmapEx(...) now
779cdf0e10cSrcweir BitmapEx aBmpEx1 = ImpGetBitmapEx(eKindOfMarker, (sal_uInt16)eColIndex, bIsFineHdl, bIsHighContrast);
780cdf0e10cSrcweir BitmapEx aBmpEx2 = ImpGetBitmapEx(eNextBigger, (sal_uInt16)eColIndex, bIsFineHdl, bIsHighContrast);
781cdf0e10cSrcweir
782cdf0e10cSrcweir // #i53216# Use system cursor blink time. Use the unsigned value.
783cdf0e10cSrcweir const sal_uInt32 nBlinkTime((sal_uInt32)Application::GetSettings().GetStyleSettings().GetCursorBlinkTime());
784cdf0e10cSrcweir
785cdf0e10cSrcweir if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
786cdf0e10cSrcweir {
787cdf0e10cSrcweir // #98388# when anchor is used take upper left as reference point inside the handle
788cdf0e10cSrcweir pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime);
789cdf0e10cSrcweir }
790cdf0e10cSrcweir else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
791cdf0e10cSrcweir {
792cdf0e10cSrcweir // #101688# AnchorTR for SW, take top right as (0,0)
793cdf0e10cSrcweir pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
794cdf0e10cSrcweir (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1), 0,
795cdf0e10cSrcweir (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1), 0);
796cdf0e10cSrcweir }
797cdf0e10cSrcweir else
798cdf0e10cSrcweir {
799cdf0e10cSrcweir // create centered handle as default
800cdf0e10cSrcweir pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
801cdf0e10cSrcweir (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
802cdf0e10cSrcweir (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
803cdf0e10cSrcweir (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
804cdf0e10cSrcweir (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
805cdf0e10cSrcweir }
806cdf0e10cSrcweir }
807cdf0e10cSrcweir else
808cdf0e10cSrcweir {
809cdf0e10cSrcweir // create normal handle
810cdf0e10cSrcweir // #101928# use ImpGetBitmapEx(...) now
811cdf0e10cSrcweir BitmapEx aBmpEx = ImpGetBitmapEx(eKindOfMarker, (sal_uInt16)eColIndex, bIsFineHdl, bIsHighContrast);
812cdf0e10cSrcweir
813cdf0e10cSrcweir if(eKindOfMarker == Anchor || eKindOfMarker == AnchorPressed)
814cdf0e10cSrcweir {
815cdf0e10cSrcweir // #98388# upper left as reference point inside the handle for AnchorPressed, too
816cdf0e10cSrcweir pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx);
817cdf0e10cSrcweir }
818cdf0e10cSrcweir else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
819cdf0e10cSrcweir {
820cdf0e10cSrcweir // #101688# AnchorTR for SW, take top right as (0,0)
821cdf0e10cSrcweir pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
822cdf0e10cSrcweir (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1), 0);
823cdf0e10cSrcweir }
824cdf0e10cSrcweir else
825cdf0e10cSrcweir {
826cdf0e10cSrcweir sal_uInt16 nCenX((sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1L) >> 1);
827cdf0e10cSrcweir sal_uInt16 nCenY((sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1L) >> 1);
828cdf0e10cSrcweir
829cdf0e10cSrcweir if(aMoveOutsideOffset.X() > 0)
830cdf0e10cSrcweir {
831cdf0e10cSrcweir nCenX = 0;
832cdf0e10cSrcweir }
833cdf0e10cSrcweir else if(aMoveOutsideOffset.X() < 0)
834cdf0e10cSrcweir {
835cdf0e10cSrcweir nCenX = (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1);
836cdf0e10cSrcweir }
837cdf0e10cSrcweir
838cdf0e10cSrcweir if(aMoveOutsideOffset.Y() > 0)
839cdf0e10cSrcweir {
840cdf0e10cSrcweir nCenY = 0;
841cdf0e10cSrcweir }
842cdf0e10cSrcweir else if(aMoveOutsideOffset.Y() < 0)
843cdf0e10cSrcweir {
844cdf0e10cSrcweir nCenY = (sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1);
845cdf0e10cSrcweir }
846cdf0e10cSrcweir
847cdf0e10cSrcweir // create centered handle as default
848cdf0e10cSrcweir pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, nCenX, nCenY);
849cdf0e10cSrcweir }
850cdf0e10cSrcweir }
851cdf0e10cSrcweir
852cdf0e10cSrcweir return pRetval;
853cdf0e10cSrcweir }
854cdf0e10cSrcweir
IsHdlHit(const Point & rPnt) const855cdf0e10cSrcweir bool SdrHdl::IsHdlHit(const Point& rPnt) const
856cdf0e10cSrcweir {
857cdf0e10cSrcweir // OVERLAYMANAGER
858cdf0e10cSrcweir basegfx::B2DPoint aPosition(rPnt.X(), rPnt.Y());
859cdf0e10cSrcweir return maOverlayGroup.isHitLogic(aPosition);
860cdf0e10cSrcweir }
861cdf0e10cSrcweir
GetPointer() const862cdf0e10cSrcweir Pointer SdrHdl::GetPointer() const
863cdf0e10cSrcweir {
864cdf0e10cSrcweir PointerStyle ePtr=POINTER_MOVE;
865cdf0e10cSrcweir const sal_Bool bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT;
866cdf0e10cSrcweir const sal_Bool bRot=pHdlList!=NULL && pHdlList->IsRotateShear();
867cdf0e10cSrcweir const sal_Bool bDis=pHdlList!=NULL && pHdlList->IsDistortShear();
868cdf0e10cSrcweir if (bSize && pHdlList!=NULL && (bRot || bDis)) {
869cdf0e10cSrcweir switch (eKind) {
870cdf0e10cSrcweir case HDL_UPLFT: case HDL_UPRGT:
871cdf0e10cSrcweir case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break;
872cdf0e10cSrcweir case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break;
873cdf0e10cSrcweir case HDL_UPPER: case HDL_LOWER: ePtr=POINTER_HSHEAR; break;
874cdf0e10cSrcweir default:
875cdf0e10cSrcweir break;
876cdf0e10cSrcweir }
877cdf0e10cSrcweir } else {
878cdf0e10cSrcweir // Fuer Resize von gedrehten Rechtecken die Mauszeiger etwas mitdrehen
879cdf0e10cSrcweir if (bSize && nDrehWink!=0) {
880cdf0e10cSrcweir long nHdlWink=0;
881cdf0e10cSrcweir switch (eKind) {
882cdf0e10cSrcweir case HDL_LWRGT: nHdlWink=31500; break;
883cdf0e10cSrcweir case HDL_LOWER: nHdlWink=27000; break;
884cdf0e10cSrcweir case HDL_LWLFT: nHdlWink=22500; break;
885cdf0e10cSrcweir case HDL_LEFT : nHdlWink=18000; break;
886cdf0e10cSrcweir case HDL_UPLFT: nHdlWink=13500; break;
887cdf0e10cSrcweir case HDL_UPPER: nHdlWink=9000; break;
888cdf0e10cSrcweir case HDL_UPRGT: nHdlWink=4500; break;
889cdf0e10cSrcweir case HDL_RIGHT: nHdlWink=0; break;
890cdf0e10cSrcweir default:
891cdf0e10cSrcweir break;
892cdf0e10cSrcweir }
893cdf0e10cSrcweir nHdlWink+=nDrehWink+2249; // und etwas drauf (zum runden)
894cdf0e10cSrcweir while (nHdlWink<0) nHdlWink+=36000;
895cdf0e10cSrcweir while (nHdlWink>=36000) nHdlWink-=36000;
896cdf0e10cSrcweir nHdlWink/=4500;
897cdf0e10cSrcweir switch ((sal_uInt8)nHdlWink) {
898cdf0e10cSrcweir case 0: ePtr=POINTER_ESIZE; break;
899cdf0e10cSrcweir case 1: ePtr=POINTER_NESIZE; break;
900cdf0e10cSrcweir case 2: ePtr=POINTER_NSIZE; break;
901cdf0e10cSrcweir case 3: ePtr=POINTER_NWSIZE; break;
902cdf0e10cSrcweir case 4: ePtr=POINTER_WSIZE; break;
903cdf0e10cSrcweir case 5: ePtr=POINTER_SWSIZE; break;
904cdf0e10cSrcweir case 6: ePtr=POINTER_SSIZE; break;
905cdf0e10cSrcweir case 7: ePtr=POINTER_SESIZE; break;
906cdf0e10cSrcweir } // switch
907cdf0e10cSrcweir } else {
908cdf0e10cSrcweir switch (eKind) {
909cdf0e10cSrcweir case HDL_UPLFT: ePtr=POINTER_NWSIZE; break;
910cdf0e10cSrcweir case HDL_UPPER: ePtr=POINTER_NSIZE; break;
911cdf0e10cSrcweir case HDL_UPRGT: ePtr=POINTER_NESIZE; break;
912cdf0e10cSrcweir case HDL_LEFT : ePtr=POINTER_WSIZE; break;
913cdf0e10cSrcweir case HDL_RIGHT: ePtr=POINTER_ESIZE; break;
914cdf0e10cSrcweir case HDL_LWLFT: ePtr=POINTER_SWSIZE; break;
915cdf0e10cSrcweir case HDL_LOWER: ePtr=POINTER_SSIZE; break;
916cdf0e10cSrcweir case HDL_LWRGT: ePtr=POINTER_SESIZE; break;
917cdf0e10cSrcweir case HDL_POLY : ePtr=POINTER_MOVEPOINT; break;
918cdf0e10cSrcweir case HDL_CIRC : ePtr=POINTER_HAND; break;
919cdf0e10cSrcweir case HDL_REF1 : ePtr=POINTER_REFHAND; break;
920cdf0e10cSrcweir case HDL_REF2 : ePtr=POINTER_REFHAND; break;
921cdf0e10cSrcweir case HDL_BWGT : ePtr=POINTER_MOVEBEZIERWEIGHT; break;
922cdf0e10cSrcweir case HDL_GLUE : ePtr=POINTER_MOVEPOINT; break;
9235db901c0Smseidel case HDL_GLUE_UNSEL : ePtr=POINTER_MOVEPOINT; break;
924cdf0e10cSrcweir case HDL_CUSTOMSHAPE1 : ePtr=POINTER_HAND; break;
925cdf0e10cSrcweir default:
926cdf0e10cSrcweir break;
927cdf0e10cSrcweir }
928cdf0e10cSrcweir }
929cdf0e10cSrcweir }
930cdf0e10cSrcweir return Pointer(ePtr);
931cdf0e10cSrcweir }
932cdf0e10cSrcweir
933cdf0e10cSrcweir // #97016# II
IsFocusHdl() const934cdf0e10cSrcweir sal_Bool SdrHdl::IsFocusHdl() const
935cdf0e10cSrcweir {
936cdf0e10cSrcweir switch(eKind)
937cdf0e10cSrcweir {
9381059e62bSmseidel case HDL_UPLFT: // top left
9391059e62bSmseidel case HDL_UPPER: // top
9401059e62bSmseidel case HDL_UPRGT: // top right
9411059e62bSmseidel case HDL_LEFT: // left
9421059e62bSmseidel case HDL_RIGHT: // right
9431059e62bSmseidel case HDL_LWLFT: // bottom left
9441059e62bSmseidel case HDL_LOWER: // bottom
9451059e62bSmseidel case HDL_LWRGT: // bottom right
946cdf0e10cSrcweir {
9475db901c0Smseidel // if it's an activated TextEdit, it's moved to extended points
948cdf0e10cSrcweir if(pHdlList && pHdlList->IsMoveOutside())
949cdf0e10cSrcweir return sal_False;
950cdf0e10cSrcweir else
951cdf0e10cSrcweir return sal_True;
952cdf0e10cSrcweir }
953cdf0e10cSrcweir
954cdf0e10cSrcweir case HDL_MOVE: // Handle zum Verschieben des Objekts
955cdf0e10cSrcweir case HDL_POLY: // Punktselektion an Polygon oder Bezierkurve
956cdf0e10cSrcweir case HDL_BWGT: // Gewicht an einer Bezierkurve
957cdf0e10cSrcweir case HDL_CIRC: // Winkel an Kreissegmenten, Eckenradius am Rect
958cdf0e10cSrcweir case HDL_REF1: // Referenzpunkt 1, z.B. Rotationsmitte
959cdf0e10cSrcweir case HDL_REF2: // Referenzpunkt 2, z.B. Endpunkt der Spiegelachse
960cdf0e10cSrcweir //case HDL_MIRX: // Die Spiegelachse selbst
9615db901c0Smseidel case HDL_GLUE: // glue point
9625db901c0Smseidel case HDL_GLUE_UNSEL: // glue point unselected
963cdf0e10cSrcweir
964cdf0e10cSrcweir // #98388# do NOT activate here, let SW implement their own SdrHdl and
965cdf0e10cSrcweir // overload IsFocusHdl() there to make the anchor accessible
966cdf0e10cSrcweir //case HDL_ANCHOR: // anchor symbol (SD, SW)
967cdf0e10cSrcweir // #101688# same for AnchorTR
968cdf0e10cSrcweir //case HDL_ANCHOR_TR: // anchor symbol (SD, SW)
969cdf0e10cSrcweir
9701059e62bSmseidel //case HDL_TRNS: // interactive transparency
971cdf0e10cSrcweir //case HDL_GRAD: // interactive gradient
972cdf0e10cSrcweir //case HDL_COLR: // interactive color
973cdf0e10cSrcweir
974cdf0e10cSrcweir // for SJ and the CustomShapeHandles:
975cdf0e10cSrcweir case HDL_CUSTOMSHAPE1:
976cdf0e10cSrcweir
977cdf0e10cSrcweir case HDL_USER:
978cdf0e10cSrcweir {
979cdf0e10cSrcweir return sal_True;
980cdf0e10cSrcweir }
981cdf0e10cSrcweir
982cdf0e10cSrcweir default:
983cdf0e10cSrcweir {
984cdf0e10cSrcweir return sal_False;
985cdf0e10cSrcweir }
986cdf0e10cSrcweir }
987cdf0e10cSrcweir }
988cdf0e10cSrcweir
onMouseEnter(const MouseEvent &)989cdf0e10cSrcweir void SdrHdl::onMouseEnter(const MouseEvent& /*rMEvt*/)
990cdf0e10cSrcweir {
991cdf0e10cSrcweir }
992cdf0e10cSrcweir
onMouseLeave()993cdf0e10cSrcweir void SdrHdl::onMouseLeave()
994cdf0e10cSrcweir {
995cdf0e10cSrcweir }
996cdf0e10cSrcweir
isMouseOver() const997cdf0e10cSrcweir bool SdrHdl::isMouseOver() const
998cdf0e10cSrcweir {
999cdf0e10cSrcweir return mbMouseOver;
1000cdf0e10cSrcweir }
1001cdf0e10cSrcweir
10024d196ef4Smseidel
1003cdf0e10cSrcweir // class SdrHdlColor
1004cdf0e10cSrcweir
SdrHdlColor(const Point & rRef,Color aCol,const Size & rSize,sal_Bool bLum)1005cdf0e10cSrcweir SdrHdlColor::SdrHdlColor(const Point& rRef, Color aCol, const Size& rSize, sal_Bool bLum)
1006cdf0e10cSrcweir : SdrHdl(rRef, HDL_COLR),
1007cdf0e10cSrcweir aMarkerSize(rSize),
1008cdf0e10cSrcweir bUseLuminance(bLum)
1009cdf0e10cSrcweir {
1010cdf0e10cSrcweir if(IsUseLuminance())
1011cdf0e10cSrcweir aCol = GetLuminance(aCol);
1012cdf0e10cSrcweir
1013cdf0e10cSrcweir // remember color
1014cdf0e10cSrcweir aMarkerColor = aCol;
1015cdf0e10cSrcweir }
1016cdf0e10cSrcweir
~SdrHdlColor()1017cdf0e10cSrcweir SdrHdlColor::~SdrHdlColor()
1018cdf0e10cSrcweir {
1019cdf0e10cSrcweir }
1020cdf0e10cSrcweir
CreateB2dIAObject()1021cdf0e10cSrcweir void SdrHdlColor::CreateB2dIAObject()
1022cdf0e10cSrcweir {
1023cdf0e10cSrcweir // first throw away old one
1024cdf0e10cSrcweir GetRidOfIAObject();
1025cdf0e10cSrcweir
1026cdf0e10cSrcweir if(pHdlList)
1027cdf0e10cSrcweir {
1028cdf0e10cSrcweir SdrMarkView* pView = pHdlList->GetView();
1029cdf0e10cSrcweir
1030cdf0e10cSrcweir if(pView && !pView->areMarkHandlesHidden())
1031cdf0e10cSrcweir {
1032cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
1033cdf0e10cSrcweir
1034cdf0e10cSrcweir if(pPageView)
1035cdf0e10cSrcweir {
1036cdf0e10cSrcweir for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1037cdf0e10cSrcweir {
1038cdf0e10cSrcweir // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
1039cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1040cdf0e10cSrcweir
1041cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
1042cdf0e10cSrcweir {
1043cdf0e10cSrcweir if(rPageWindow.GetOverlayManager())
1044cdf0e10cSrcweir {
1045cdf0e10cSrcweir Bitmap aBmpCol(CreateColorDropper(aMarkerColor));
1046cdf0e10cSrcweir basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1047cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1048cdf0e10cSrcweir ::sdr::overlay::OverlayBitmapEx(
1049cdf0e10cSrcweir aPosition,
1050cdf0e10cSrcweir BitmapEx(aBmpCol),
1051cdf0e10cSrcweir (sal_uInt16)(aBmpCol.GetSizePixel().Width() - 1) >> 1,
1052cdf0e10cSrcweir (sal_uInt16)(aBmpCol.GetSizePixel().Height() - 1) >> 1
1053cdf0e10cSrcweir );
1054cdf0e10cSrcweir DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1055cdf0e10cSrcweir
1056cdf0e10cSrcweir // OVERLAYMANAGER
1057cdf0e10cSrcweir if(pNewOverlayObject)
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
1060cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
1061cdf0e10cSrcweir }
1062cdf0e10cSrcweir }
1063cdf0e10cSrcweir }
1064cdf0e10cSrcweir }
1065cdf0e10cSrcweir }
1066cdf0e10cSrcweir }
1067cdf0e10cSrcweir }
1068cdf0e10cSrcweir }
1069cdf0e10cSrcweir
CreateColorDropper(Color aCol)1070cdf0e10cSrcweir Bitmap SdrHdlColor::CreateColorDropper(Color aCol)
1071cdf0e10cSrcweir {
1072cdf0e10cSrcweir // get the Bitmap
1073cdf0e10cSrcweir Bitmap aRetval(aMarkerSize, 24);
1074cdf0e10cSrcweir aRetval.Erase(aCol);
1075cdf0e10cSrcweir
1076cdf0e10cSrcweir // get write access
1077cdf0e10cSrcweir BitmapWriteAccess* pWrite = aRetval.AcquireWriteAccess();
1078cdf0e10cSrcweir DBG_ASSERT(pWrite, "Got NO write access to a new Bitmap !!!");
1079cdf0e10cSrcweir
1080cdf0e10cSrcweir if(pWrite)
1081cdf0e10cSrcweir {
1082cdf0e10cSrcweir // draw outer border
1083cdf0e10cSrcweir sal_Int32 nWidth = aMarkerSize.Width();
1084cdf0e10cSrcweir sal_Int32 nHeight = aMarkerSize.Height();
1085cdf0e10cSrcweir
1086cdf0e10cSrcweir pWrite->SetLineColor(Color(COL_LIGHTGRAY));
1087cdf0e10cSrcweir pWrite->DrawLine(Point(0, 0), Point(0, nHeight - 1));
1088cdf0e10cSrcweir pWrite->DrawLine(Point(1, 0), Point(nWidth - 1, 0));
1089cdf0e10cSrcweir pWrite->SetLineColor(Color(COL_GRAY));
1090cdf0e10cSrcweir pWrite->DrawLine(Point(1, nHeight - 1), Point(nWidth - 1, nHeight - 1));
1091cdf0e10cSrcweir pWrite->DrawLine(Point(nWidth - 1, 1), Point(nWidth - 1, nHeight - 2));
1092cdf0e10cSrcweir
1093cdf0e10cSrcweir // draw lighter UpperLeft
1094cdf0e10cSrcweir const Color aLightColor(
1095cdf0e10cSrcweir (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetRed() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
1096cdf0e10cSrcweir (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetGreen() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
1097cdf0e10cSrcweir (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetBlue() + (sal_Int16)0x0040), (sal_Int16)0x00ff)));
1098cdf0e10cSrcweir pWrite->SetLineColor(aLightColor);
1099cdf0e10cSrcweir pWrite->DrawLine(Point(1, 1), Point(1, nHeight - 2));
1100cdf0e10cSrcweir pWrite->DrawLine(Point(2, 1), Point(nWidth - 2, 1));
1101cdf0e10cSrcweir
1102cdf0e10cSrcweir // draw darker LowerRight
1103cdf0e10cSrcweir const Color aDarkColor(
1104cdf0e10cSrcweir (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetRed() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
1105cdf0e10cSrcweir (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetGreen() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
1106cdf0e10cSrcweir (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetBlue() - (sal_Int16)0x0040), (sal_Int16)0x0000)));
1107cdf0e10cSrcweir pWrite->SetLineColor(aDarkColor);
1108cdf0e10cSrcweir pWrite->DrawLine(Point(2, nHeight - 2), Point(nWidth - 2, nHeight - 2));
1109cdf0e10cSrcweir pWrite->DrawLine(Point(nWidth - 2, 2), Point(nWidth - 2, nHeight - 3));
1110cdf0e10cSrcweir
1111cdf0e10cSrcweir // get rid of write access
1112cdf0e10cSrcweir delete pWrite;
1113cdf0e10cSrcweir }
1114cdf0e10cSrcweir
1115cdf0e10cSrcweir return aRetval;
1116cdf0e10cSrcweir }
1117cdf0e10cSrcweir
GetLuminance(const Color & rCol)1118cdf0e10cSrcweir Color SdrHdlColor::GetLuminance(const Color& rCol)
1119cdf0e10cSrcweir {
1120cdf0e10cSrcweir sal_uInt8 aLum = rCol.GetLuminance();
1121cdf0e10cSrcweir Color aRetval(aLum, aLum, aLum);
1122cdf0e10cSrcweir return aRetval;
1123cdf0e10cSrcweir }
1124cdf0e10cSrcweir
CallColorChangeLink()1125cdf0e10cSrcweir void SdrHdlColor::CallColorChangeLink()
1126cdf0e10cSrcweir {
1127cdf0e10cSrcweir aColorChangeHdl.Call(this);
1128cdf0e10cSrcweir }
1129cdf0e10cSrcweir
SetColor(Color aNew,sal_Bool bCallLink)1130cdf0e10cSrcweir void SdrHdlColor::SetColor(Color aNew, sal_Bool bCallLink)
1131cdf0e10cSrcweir {
1132cdf0e10cSrcweir if(IsUseLuminance())
1133cdf0e10cSrcweir aNew = GetLuminance(aNew);
1134cdf0e10cSrcweir
1135cdf0e10cSrcweir if(aMarkerColor != aNew)
1136cdf0e10cSrcweir {
1137cdf0e10cSrcweir // remember new color
1138cdf0e10cSrcweir aMarkerColor = aNew;
1139cdf0e10cSrcweir
1140cdf0e10cSrcweir // create new display
1141cdf0e10cSrcweir Touch();
1142cdf0e10cSrcweir
1143cdf0e10cSrcweir // tell about change
1144cdf0e10cSrcweir if(bCallLink)
1145cdf0e10cSrcweir CallColorChangeLink();
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir }
1148cdf0e10cSrcweir
SetSize(const Size & rNew)1149cdf0e10cSrcweir void SdrHdlColor::SetSize(const Size& rNew)
1150cdf0e10cSrcweir {
1151cdf0e10cSrcweir if(rNew != aMarkerSize)
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir // remember new size
1154cdf0e10cSrcweir aMarkerSize = rNew;
1155cdf0e10cSrcweir
1156cdf0e10cSrcweir // create new display
1157cdf0e10cSrcweir Touch();
1158cdf0e10cSrcweir }
1159cdf0e10cSrcweir }
1160cdf0e10cSrcweir
11614d196ef4Smseidel
1162cdf0e10cSrcweir // class SdrHdlGradient
1163cdf0e10cSrcweir
SdrHdlGradient(const Point & rRef1,const Point & rRef2,sal_Bool bGrad)1164cdf0e10cSrcweir SdrHdlGradient::SdrHdlGradient(const Point& rRef1, const Point& rRef2, sal_Bool bGrad)
1165cdf0e10cSrcweir : SdrHdl(rRef1, bGrad ? HDL_GRAD : HDL_TRNS),
1166cdf0e10cSrcweir pColHdl1(NULL),
1167cdf0e10cSrcweir pColHdl2(NULL),
1168cdf0e10cSrcweir a2ndPos(rRef2),
1169cdf0e10cSrcweir bGradient(bGrad)
1170cdf0e10cSrcweir {
1171cdf0e10cSrcweir }
1172cdf0e10cSrcweir
~SdrHdlGradient()1173cdf0e10cSrcweir SdrHdlGradient::~SdrHdlGradient()
1174cdf0e10cSrcweir {
1175cdf0e10cSrcweir }
1176cdf0e10cSrcweir
Set2ndPos(const Point & rPnt)1177cdf0e10cSrcweir void SdrHdlGradient::Set2ndPos(const Point& rPnt)
1178cdf0e10cSrcweir {
1179cdf0e10cSrcweir if(a2ndPos != rPnt)
1180cdf0e10cSrcweir {
1181cdf0e10cSrcweir // remember new position
1182cdf0e10cSrcweir a2ndPos = rPnt;
1183cdf0e10cSrcweir
1184cdf0e10cSrcweir // create new display
1185cdf0e10cSrcweir Touch();
1186cdf0e10cSrcweir }
1187cdf0e10cSrcweir }
1188cdf0e10cSrcweir
CreateB2dIAObject()1189cdf0e10cSrcweir void SdrHdlGradient::CreateB2dIAObject()
1190cdf0e10cSrcweir {
1191cdf0e10cSrcweir // first throw away old one
1192cdf0e10cSrcweir GetRidOfIAObject();
1193cdf0e10cSrcweir
1194cdf0e10cSrcweir if(pHdlList)
1195cdf0e10cSrcweir {
1196cdf0e10cSrcweir SdrMarkView* pView = pHdlList->GetView();
1197cdf0e10cSrcweir
1198cdf0e10cSrcweir if(pView && !pView->areMarkHandlesHidden())
1199cdf0e10cSrcweir {
1200cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
1201cdf0e10cSrcweir
1202cdf0e10cSrcweir if(pPageView)
1203cdf0e10cSrcweir {
1204cdf0e10cSrcweir for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1205cdf0e10cSrcweir {
1206cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1207cdf0e10cSrcweir
1208cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
1209cdf0e10cSrcweir {
1210cdf0e10cSrcweir if(rPageWindow.GetOverlayManager())
1211cdf0e10cSrcweir {
1212cdf0e10cSrcweir // striped line in between
1213cdf0e10cSrcweir basegfx::B2DVector aVec(a2ndPos.X() - aPos.X(), a2ndPos.Y() - aPos.Y());
1214cdf0e10cSrcweir double fVecLen = aVec.getLength();
1215cdf0e10cSrcweir double fLongPercentArrow = (1.0 - 0.05) * fVecLen;
1216cdf0e10cSrcweir double fHalfArrowWidth = (0.05 * 0.5) * fVecLen;
1217cdf0e10cSrcweir aVec.normalize();
1218cdf0e10cSrcweir basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX());
1219cdf0e10cSrcweir sal_Int32 nMidX = (sal_Int32)(aPos.X() + aVec.getX() * fLongPercentArrow);
1220cdf0e10cSrcweir sal_Int32 nMidY = (sal_Int32)(aPos.Y() + aVec.getY() * fLongPercentArrow);
1221cdf0e10cSrcweir Point aMidPoint(nMidX, nMidY);
1222cdf0e10cSrcweir
1223cdf0e10cSrcweir basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1224cdf0e10cSrcweir basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
1225cdf0e10cSrcweir
1226cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1227cdf0e10cSrcweir ::sdr::overlay::OverlayLineStriped(
1228cdf0e10cSrcweir aPosition, aMidPos
1229cdf0e10cSrcweir );
1230cdf0e10cSrcweir DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1231cdf0e10cSrcweir
1232cdf0e10cSrcweir pNewOverlayObject->setBaseColor(IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE));
1233cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
1234cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
1235cdf0e10cSrcweir
1236cdf0e10cSrcweir // arrowhead
1237cdf0e10cSrcweir Point aLeft(aMidPoint.X() + (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
1238cdf0e10cSrcweir aMidPoint.Y() + (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
1239cdf0e10cSrcweir Point aRight(aMidPoint.X() - (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
1240cdf0e10cSrcweir aMidPoint.Y() - (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
1241cdf0e10cSrcweir
1242cdf0e10cSrcweir basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
1243cdf0e10cSrcweir basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
1244cdf0e10cSrcweir basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
1245cdf0e10cSrcweir
1246cdf0e10cSrcweir pNewOverlayObject = new
1247cdf0e10cSrcweir ::sdr::overlay::OverlayTriangle(
1248cdf0e10cSrcweir aPositionLeft,
1249cdf0e10cSrcweir aPosition2,
1250cdf0e10cSrcweir aPositionRight,
1251cdf0e10cSrcweir IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)
1252cdf0e10cSrcweir );
1253cdf0e10cSrcweir DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1254cdf0e10cSrcweir
1255cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
1256cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
1257cdf0e10cSrcweir }
1258cdf0e10cSrcweir }
1259cdf0e10cSrcweir }
1260cdf0e10cSrcweir }
1261cdf0e10cSrcweir }
1262cdf0e10cSrcweir }
1263cdf0e10cSrcweir }
1264cdf0e10cSrcweir
1265cdf0e10cSrcweir IMPL_LINK(SdrHdlGradient, ColorChangeHdl, SdrHdl*, /*pHdl*/)
1266cdf0e10cSrcweir {
1267cdf0e10cSrcweir if(GetObj())
1268cdf0e10cSrcweir FromIAOToItem(GetObj(), sal_True, sal_True);
1269cdf0e10cSrcweir return 0;
1270cdf0e10cSrcweir }
1271cdf0e10cSrcweir
FromIAOToItem(SdrObject * _pObj,sal_Bool bSetItemOnObject,sal_Bool bUndo)1272cdf0e10cSrcweir void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, sal_Bool bSetItemOnObject, sal_Bool bUndo)
1273cdf0e10cSrcweir {
1274cdf0e10cSrcweir // from IAO positions and colors to gradient
1275cdf0e10cSrcweir const SfxItemSet& rSet = _pObj->GetMergedItemSet();
1276cdf0e10cSrcweir
1277cdf0e10cSrcweir GradTransformer aGradTransformer;
1278cdf0e10cSrcweir GradTransGradient aOldGradTransGradient;
1279cdf0e10cSrcweir GradTransGradient aGradTransGradient;
1280cdf0e10cSrcweir GradTransVector aGradTransVector;
1281cdf0e10cSrcweir
1282cdf0e10cSrcweir String aString;
1283cdf0e10cSrcweir
1284cdf0e10cSrcweir aGradTransVector.maPositionA = basegfx::B2DPoint(GetPos().X(), GetPos().Y());
1285cdf0e10cSrcweir aGradTransVector.maPositionB = basegfx::B2DPoint(Get2ndPos().X(), Get2ndPos().Y());
1286cdf0e10cSrcweir if(pColHdl1)
1287cdf0e10cSrcweir aGradTransVector.aCol1 = pColHdl1->GetColor();
1288cdf0e10cSrcweir if(pColHdl2)
1289cdf0e10cSrcweir aGradTransVector.aCol2 = pColHdl2->GetColor();
1290cdf0e10cSrcweir
1291cdf0e10cSrcweir if(IsGradient())
1292cdf0e10cSrcweir aOldGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
1293cdf0e10cSrcweir else
1294cdf0e10cSrcweir aOldGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue();
1295cdf0e10cSrcweir
1296cdf0e10cSrcweir // transform vector data to gradient
1297cdf0e10cSrcweir aGradTransformer.VecToGrad(aGradTransVector, aGradTransGradient, aOldGradTransGradient, _pObj, bMoveSingleHandle, bMoveFirstHandle);
1298cdf0e10cSrcweir
1299cdf0e10cSrcweir if(bSetItemOnObject)
1300cdf0e10cSrcweir {
1301cdf0e10cSrcweir SdrModel* pModel = _pObj->GetModel();
1302cdf0e10cSrcweir SfxItemSet aNewSet(pModel->GetItemPool());
1303cdf0e10cSrcweir
1304cdf0e10cSrcweir if(IsGradient())
1305cdf0e10cSrcweir {
1306cdf0e10cSrcweir aString = String();
1307cdf0e10cSrcweir XFillGradientItem aNewGradItem(aString, aGradTransGradient.aGradient);
1308cdf0e10cSrcweir aNewSet.Put(aNewGradItem);
1309cdf0e10cSrcweir }
1310cdf0e10cSrcweir else
1311cdf0e10cSrcweir {
1312cdf0e10cSrcweir aString = String();
1313cdf0e10cSrcweir XFillFloatTransparenceItem aNewTransItem(aString, aGradTransGradient.aGradient);
1314cdf0e10cSrcweir aNewSet.Put(aNewTransItem);
1315cdf0e10cSrcweir }
1316cdf0e10cSrcweir
1317cdf0e10cSrcweir if(bUndo && pModel->IsUndoEnabled())
1318cdf0e10cSrcweir {
1319cdf0e10cSrcweir pModel->BegUndo(SVX_RESSTR(IsGradient() ? SIP_XA_FILLGRADIENT : SIP_XA_FILLTRANSPARENCE));
1320cdf0e10cSrcweir pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*_pObj));
1321cdf0e10cSrcweir pModel->EndUndo();
1322cdf0e10cSrcweir }
1323cdf0e10cSrcweir
1324cdf0e10cSrcweir pObj->SetMergedItemSetAndBroadcast(aNewSet);
1325cdf0e10cSrcweir }
1326cdf0e10cSrcweir
1327cdf0e10cSrcweir // back transformation, set values on pIAOHandle
1328cdf0e10cSrcweir aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, _pObj);
1329cdf0e10cSrcweir
1330cdf0e10cSrcweir SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1331cdf0e10cSrcweir Set2ndPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1332cdf0e10cSrcweir if(pColHdl1)
1333cdf0e10cSrcweir {
1334cdf0e10cSrcweir pColHdl1->SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
1335cdf0e10cSrcweir pColHdl1->SetColor(aGradTransVector.aCol1);
1336cdf0e10cSrcweir }
1337cdf0e10cSrcweir if(pColHdl2)
1338cdf0e10cSrcweir {
1339cdf0e10cSrcweir pColHdl2->SetPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
1340cdf0e10cSrcweir pColHdl2->SetColor(aGradTransVector.aCol2);
1341cdf0e10cSrcweir }
1342cdf0e10cSrcweir }
1343cdf0e10cSrcweir
1344cdf0e10cSrcweir
~SdrHdlLine()1345cdf0e10cSrcweir SdrHdlLine::~SdrHdlLine() {}
1346cdf0e10cSrcweir
CreateB2dIAObject()1347cdf0e10cSrcweir void SdrHdlLine::CreateB2dIAObject()
1348cdf0e10cSrcweir {
1349cdf0e10cSrcweir // first throw away old one
1350cdf0e10cSrcweir GetRidOfIAObject();
1351cdf0e10cSrcweir
1352cdf0e10cSrcweir if(pHdlList)
1353cdf0e10cSrcweir {
1354cdf0e10cSrcweir SdrMarkView* pView = pHdlList->GetView();
1355cdf0e10cSrcweir
1356cdf0e10cSrcweir if(pView && !pView->areMarkHandlesHidden() && pHdl1 && pHdl2)
1357cdf0e10cSrcweir {
1358cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
1359cdf0e10cSrcweir
1360cdf0e10cSrcweir if(pPageView)
1361cdf0e10cSrcweir {
1362cdf0e10cSrcweir for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1363cdf0e10cSrcweir {
1364cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1365cdf0e10cSrcweir
1366cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
1367cdf0e10cSrcweir {
1368cdf0e10cSrcweir if(rPageWindow.GetOverlayManager())
1369cdf0e10cSrcweir {
1370cdf0e10cSrcweir basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1371cdf0e10cSrcweir basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
1372cdf0e10cSrcweir
1373cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1374cdf0e10cSrcweir ::sdr::overlay::OverlayLineStriped(
1375cdf0e10cSrcweir aPosition1,
1376cdf0e10cSrcweir aPosition2
1377cdf0e10cSrcweir );
1378cdf0e10cSrcweir DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1379cdf0e10cSrcweir
1380cdf0e10cSrcweir // OVERLAYMANAGER
1381cdf0e10cSrcweir if(pNewOverlayObject)
1382cdf0e10cSrcweir {
1383cdf0e10cSrcweir // color(?)
1384cdf0e10cSrcweir pNewOverlayObject->setBaseColor(Color(COL_LIGHTRED));
1385cdf0e10cSrcweir
1386cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
1387cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
1388cdf0e10cSrcweir }
1389cdf0e10cSrcweir }
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir }
1392cdf0e10cSrcweir }
1393cdf0e10cSrcweir }
1394cdf0e10cSrcweir }
1395cdf0e10cSrcweir }
1396cdf0e10cSrcweir
GetPointer() const1397cdf0e10cSrcweir Pointer SdrHdlLine::GetPointer() const
1398cdf0e10cSrcweir {
1399cdf0e10cSrcweir return Pointer(POINTER_REFHAND);
1400cdf0e10cSrcweir }
1401cdf0e10cSrcweir
1402cdf0e10cSrcweir
~SdrHdlBezWgt()1403cdf0e10cSrcweir SdrHdlBezWgt::~SdrHdlBezWgt() {}
1404cdf0e10cSrcweir
CreateB2dIAObject()1405cdf0e10cSrcweir void SdrHdlBezWgt::CreateB2dIAObject()
1406cdf0e10cSrcweir {
1407cdf0e10cSrcweir // call parent
1408cdf0e10cSrcweir SdrHdl::CreateB2dIAObject();
1409cdf0e10cSrcweir
1410cdf0e10cSrcweir // create lines
1411cdf0e10cSrcweir if(pHdlList)
1412cdf0e10cSrcweir {
1413cdf0e10cSrcweir SdrMarkView* pView = pHdlList->GetView();
1414cdf0e10cSrcweir
1415cdf0e10cSrcweir if(pView && !pView->areMarkHandlesHidden())
1416cdf0e10cSrcweir {
1417cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
1418cdf0e10cSrcweir
1419cdf0e10cSrcweir if(pPageView)
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1422cdf0e10cSrcweir {
1423cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1424cdf0e10cSrcweir
1425cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
1426cdf0e10cSrcweir {
1427cdf0e10cSrcweir if(rPageWindow.GetOverlayManager())
1428cdf0e10cSrcweir {
1429cdf0e10cSrcweir basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
1430cdf0e10cSrcweir basegfx::B2DPoint aPosition2(aPos.X(), aPos.Y());
1431cdf0e10cSrcweir
1432cdf0e10cSrcweir if(!aPosition1.equal(aPosition2))
1433cdf0e10cSrcweir {
1434cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pNewOverlayObject = new
1435cdf0e10cSrcweir ::sdr::overlay::OverlayLineStriped(
1436cdf0e10cSrcweir aPosition1,
1437cdf0e10cSrcweir aPosition2
1438cdf0e10cSrcweir );
1439cdf0e10cSrcweir DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1440cdf0e10cSrcweir
1441cdf0e10cSrcweir // OVERLAYMANAGER
1442cdf0e10cSrcweir if(pNewOverlayObject)
1443cdf0e10cSrcweir {
1444cdf0e10cSrcweir // line part is not hittable
1445cdf0e10cSrcweir pNewOverlayObject->setHittable(sal_False);
1446cdf0e10cSrcweir
1447cdf0e10cSrcweir // color(?)
1448cdf0e10cSrcweir pNewOverlayObject->setBaseColor(Color(COL_LIGHTBLUE));
1449cdf0e10cSrcweir
1450cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
1451cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
1452cdf0e10cSrcweir }
1453cdf0e10cSrcweir }
1454cdf0e10cSrcweir }
1455cdf0e10cSrcweir }
1456cdf0e10cSrcweir }
1457cdf0e10cSrcweir }
1458cdf0e10cSrcweir }
1459cdf0e10cSrcweir }
1460cdf0e10cSrcweir }
1461cdf0e10cSrcweir
1462cdf0e10cSrcweir
E3dVolumeMarker(const basegfx::B2DPolyPolygon & rWireframePoly)1463cdf0e10cSrcweir E3dVolumeMarker::E3dVolumeMarker(const basegfx::B2DPolyPolygon& rWireframePoly)
1464cdf0e10cSrcweir {
1465cdf0e10cSrcweir aWireframePoly = rWireframePoly;
1466cdf0e10cSrcweir }
1467cdf0e10cSrcweir
CreateB2dIAObject()1468cdf0e10cSrcweir void E3dVolumeMarker::CreateB2dIAObject()
1469cdf0e10cSrcweir {
1470cdf0e10cSrcweir // create lines
1471cdf0e10cSrcweir if(pHdlList)
1472cdf0e10cSrcweir {
1473cdf0e10cSrcweir SdrMarkView* pView = pHdlList->GetView();
1474cdf0e10cSrcweir
1475cdf0e10cSrcweir if(pView && !pView->areMarkHandlesHidden())
1476cdf0e10cSrcweir {
1477cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
1478cdf0e10cSrcweir
1479cdf0e10cSrcweir if(pPageView)
1480cdf0e10cSrcweir {
1481cdf0e10cSrcweir for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1482cdf0e10cSrcweir {
1483cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1484cdf0e10cSrcweir
1485cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
1486cdf0e10cSrcweir {
1487cdf0e10cSrcweir if(rPageWindow.GetOverlayManager() && aWireframePoly.count())
1488cdf0e10cSrcweir {
1489cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pNewOverlayObject = new
14901cd65da9SArmin Le Grand ::sdr::overlay::OverlayPolyPolygonStripedAndFilled(
14911cd65da9SArmin Le Grand aWireframePoly);
1492cdf0e10cSrcweir DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
1493cdf0e10cSrcweir
1494cdf0e10cSrcweir // OVERLAYMANAGER
1495cdf0e10cSrcweir if(pNewOverlayObject)
1496cdf0e10cSrcweir {
1497cdf0e10cSrcweir pNewOverlayObject->setBaseColor(Color(COL_BLACK));
1498cdf0e10cSrcweir
1499cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
1500cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
1501cdf0e10cSrcweir }
1502cdf0e10cSrcweir }
1503cdf0e10cSrcweir }
1504cdf0e10cSrcweir }
1505cdf0e10cSrcweir }
1506cdf0e10cSrcweir }
1507cdf0e10cSrcweir }
1508cdf0e10cSrcweir }
1509cdf0e10cSrcweir
1510cdf0e10cSrcweir
~ImpEdgeHdl()1511cdf0e10cSrcweir ImpEdgeHdl::~ImpEdgeHdl()
1512cdf0e10cSrcweir {
1513cdf0e10cSrcweir }
1514cdf0e10cSrcweir
CreateB2dIAObject()1515cdf0e10cSrcweir void ImpEdgeHdl::CreateB2dIAObject()
1516cdf0e10cSrcweir {
1517cdf0e10cSrcweir if(nObjHdlNum <= 1 && pObj)
1518cdf0e10cSrcweir {
1519cdf0e10cSrcweir // first throw away old one
1520cdf0e10cSrcweir GetRidOfIAObject();
1521cdf0e10cSrcweir
1522cdf0e10cSrcweir BitmapColorIndex eColIndex = LightCyan;
1523cdf0e10cSrcweir BitmapMarkerKind eKindOfMarker = Rect_7x7;
1524cdf0e10cSrcweir
1525cdf0e10cSrcweir if(pHdlList)
1526cdf0e10cSrcweir {
1527cdf0e10cSrcweir SdrMarkView* pView = pHdlList->GetView();
1528cdf0e10cSrcweir
1529cdf0e10cSrcweir if(pView && !pView->areMarkHandlesHidden())
1530cdf0e10cSrcweir {
1531cdf0e10cSrcweir const SdrEdgeObj* pEdge = (SdrEdgeObj*)pObj;
1532cdf0e10cSrcweir
1533cdf0e10cSrcweir if(pEdge->GetConnectedNode(nObjHdlNum == 0) != NULL)
1534cdf0e10cSrcweir eColIndex = LightRed;
1535cdf0e10cSrcweir
1536cdf0e10cSrcweir if(nPPntNum < 2)
1537cdf0e10cSrcweir {
1538cdf0e10cSrcweir // Handle with plus sign inside
1539cdf0e10cSrcweir eKindOfMarker = Circ_7x7;
1540cdf0e10cSrcweir }
1541cdf0e10cSrcweir
1542cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
1543cdf0e10cSrcweir
1544cdf0e10cSrcweir if(pPageView)
1545cdf0e10cSrcweir {
1546cdf0e10cSrcweir for(sal_uInt32 b(0); b < pPageView->PageWindowCount(); b++)
1547cdf0e10cSrcweir {
1548cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1549cdf0e10cSrcweir
1550cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
1551cdf0e10cSrcweir {
1552cdf0e10cSrcweir if(rPageWindow.GetOverlayManager())
1553cdf0e10cSrcweir {
1554cdf0e10cSrcweir basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1555cdf0e10cSrcweir
1556cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
1557cdf0e10cSrcweir aPosition,
1558cdf0e10cSrcweir eColIndex,
1559cdf0e10cSrcweir eKindOfMarker);
1560cdf0e10cSrcweir
1561cdf0e10cSrcweir // OVERLAYMANAGER
1562cdf0e10cSrcweir if(pNewOverlayObject)
1563cdf0e10cSrcweir {
1564cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
1565cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
1566cdf0e10cSrcweir }
1567cdf0e10cSrcweir }
1568cdf0e10cSrcweir }
1569cdf0e10cSrcweir }
1570cdf0e10cSrcweir }
1571cdf0e10cSrcweir }
1572cdf0e10cSrcweir }
1573cdf0e10cSrcweir }
1574cdf0e10cSrcweir else
1575cdf0e10cSrcweir {
1576cdf0e10cSrcweir // call parent
1577cdf0e10cSrcweir SdrHdl::CreateB2dIAObject();
1578cdf0e10cSrcweir }
1579cdf0e10cSrcweir }
1580cdf0e10cSrcweir
SetLineCode(SdrEdgeLineCode eCode)1581cdf0e10cSrcweir void ImpEdgeHdl::SetLineCode(SdrEdgeLineCode eCode)
1582cdf0e10cSrcweir {
1583cdf0e10cSrcweir if(eLineCode != eCode)
1584cdf0e10cSrcweir {
1585cdf0e10cSrcweir // remember new value
1586cdf0e10cSrcweir eLineCode = eCode;
1587cdf0e10cSrcweir
1588cdf0e10cSrcweir // create new display
1589cdf0e10cSrcweir Touch();
1590cdf0e10cSrcweir }
1591cdf0e10cSrcweir }
1592cdf0e10cSrcweir
GetPointer() const1593cdf0e10cSrcweir Pointer ImpEdgeHdl::GetPointer() const
1594cdf0e10cSrcweir {
1595cdf0e10cSrcweir SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
1596cdf0e10cSrcweir if (pEdge==NULL)
1597cdf0e10cSrcweir return SdrHdl::GetPointer();
1598cdf0e10cSrcweir if (nObjHdlNum<=1)
1599cdf0e10cSrcweir return Pointer(POINTER_MOVEPOINT); //Pointer(POINTER_DRAW_CONNECT);
1600cdf0e10cSrcweir if (IsHorzDrag())
1601cdf0e10cSrcweir return Pointer(POINTER_ESIZE);
1602cdf0e10cSrcweir else
1603cdf0e10cSrcweir return Pointer(POINTER_SSIZE);
1604cdf0e10cSrcweir }
1605cdf0e10cSrcweir
IsHorzDrag() const1606cdf0e10cSrcweir sal_Bool ImpEdgeHdl::IsHorzDrag() const
1607cdf0e10cSrcweir {
1608cdf0e10cSrcweir SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
1609cdf0e10cSrcweir if (pEdge==NULL)
1610cdf0e10cSrcweir return sal_False;
1611cdf0e10cSrcweir if (nObjHdlNum<=1)
1612cdf0e10cSrcweir return sal_False;
1613cdf0e10cSrcweir
1614cdf0e10cSrcweir SdrEdgeKind eEdgeKind = ((SdrEdgeKindItem&)(pEdge->GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
1615cdf0e10cSrcweir
1616cdf0e10cSrcweir const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
1617cdf0e10cSrcweir if (eEdgeKind==SDREDGE_ORTHOLINES || eEdgeKind==SDREDGE_BEZIER)
1618cdf0e10cSrcweir {
1619cdf0e10cSrcweir return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
1620cdf0e10cSrcweir }
1621cdf0e10cSrcweir else if (eEdgeKind==SDREDGE_THREELINES)
1622cdf0e10cSrcweir {
1623cdf0e10cSrcweir long nWink=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
1624cdf0e10cSrcweir if (nWink==0 || nWink==18000)
1625cdf0e10cSrcweir return sal_True;
1626cdf0e10cSrcweir else
1627cdf0e10cSrcweir return sal_False;
1628cdf0e10cSrcweir }
1629cdf0e10cSrcweir return sal_False;
1630cdf0e10cSrcweir }
1631cdf0e10cSrcweir
1632cdf0e10cSrcweir
~ImpMeasureHdl()1633cdf0e10cSrcweir ImpMeasureHdl::~ImpMeasureHdl()
1634cdf0e10cSrcweir {
1635cdf0e10cSrcweir }
1636cdf0e10cSrcweir
CreateB2dIAObject()1637cdf0e10cSrcweir void ImpMeasureHdl::CreateB2dIAObject()
1638cdf0e10cSrcweir {
1639cdf0e10cSrcweir // first throw away old one
1640cdf0e10cSrcweir GetRidOfIAObject();
1641cdf0e10cSrcweir
1642cdf0e10cSrcweir if(pHdlList)
1643cdf0e10cSrcweir {
1644cdf0e10cSrcweir SdrMarkView* pView = pHdlList->GetView();
1645cdf0e10cSrcweir
1646cdf0e10cSrcweir if(pView && !pView->areMarkHandlesHidden())
1647cdf0e10cSrcweir {
1648cdf0e10cSrcweir BitmapColorIndex eColIndex = LightCyan;
1649cdf0e10cSrcweir BitmapMarkerKind eKindOfMarker = Rect_9x9;
1650cdf0e10cSrcweir
1651cdf0e10cSrcweir if(nObjHdlNum > 1)
1652cdf0e10cSrcweir {
1653cdf0e10cSrcweir eKindOfMarker = Rect_7x7;
1654cdf0e10cSrcweir }
1655cdf0e10cSrcweir
1656cdf0e10cSrcweir if(bSelect)
1657cdf0e10cSrcweir {
1658cdf0e10cSrcweir eColIndex = Cyan;
1659cdf0e10cSrcweir }
1660cdf0e10cSrcweir
1661cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
1662cdf0e10cSrcweir
1663cdf0e10cSrcweir if(pPageView)
1664cdf0e10cSrcweir {
1665cdf0e10cSrcweir for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1666cdf0e10cSrcweir {
1667cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1668cdf0e10cSrcweir
1669cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
1670cdf0e10cSrcweir {
1671cdf0e10cSrcweir if(rPageWindow.GetOverlayManager())
1672cdf0e10cSrcweir {
1673cdf0e10cSrcweir basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
1674cdf0e10cSrcweir
1675cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
1676cdf0e10cSrcweir aPosition,
1677cdf0e10cSrcweir eColIndex,
1678cdf0e10cSrcweir eKindOfMarker);
1679cdf0e10cSrcweir
1680cdf0e10cSrcweir // OVERLAYMANAGER
1681cdf0e10cSrcweir if(pNewOverlayObject)
1682cdf0e10cSrcweir {
1683cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
1684cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
1685cdf0e10cSrcweir }
1686cdf0e10cSrcweir }
1687cdf0e10cSrcweir }
1688cdf0e10cSrcweir }
1689cdf0e10cSrcweir }
1690cdf0e10cSrcweir }
1691cdf0e10cSrcweir }
1692cdf0e10cSrcweir }
1693cdf0e10cSrcweir
GetPointer() const1694cdf0e10cSrcweir Pointer ImpMeasureHdl::GetPointer() const
1695cdf0e10cSrcweir {
1696cdf0e10cSrcweir switch (nObjHdlNum)
1697cdf0e10cSrcweir {
1698cdf0e10cSrcweir case 0: case 1: return Pointer(POINTER_HAND);
1699cdf0e10cSrcweir case 2: case 3: return Pointer(POINTER_MOVEPOINT);
17009ebd8e31Smseidel case 4: case 5: return SdrHdl::GetPointer(); // will be rotated accordingly
1701cdf0e10cSrcweir } // switch
1702cdf0e10cSrcweir return Pointer(POINTER_NOTALLOWED);
1703cdf0e10cSrcweir }
1704cdf0e10cSrcweir
1705cdf0e10cSrcweir
ImpTextframeHdl(const Rectangle & rRect)1706cdf0e10cSrcweir ImpTextframeHdl::ImpTextframeHdl(const Rectangle& rRect) :
1707cdf0e10cSrcweir SdrHdl(rRect.TopLeft(),HDL_MOVE),
1708cdf0e10cSrcweir maRect(rRect)
1709cdf0e10cSrcweir {
1710cdf0e10cSrcweir }
1711cdf0e10cSrcweir
CreateB2dIAObject()1712cdf0e10cSrcweir void ImpTextframeHdl::CreateB2dIAObject()
1713cdf0e10cSrcweir {
1714cdf0e10cSrcweir // first throw away old one
1715cdf0e10cSrcweir GetRidOfIAObject();
1716cdf0e10cSrcweir
1717cdf0e10cSrcweir if(pHdlList)
1718cdf0e10cSrcweir {
1719cdf0e10cSrcweir SdrMarkView* pView = pHdlList->GetView();
1720cdf0e10cSrcweir
1721cdf0e10cSrcweir if(pView && !pView->areMarkHandlesHidden())
1722cdf0e10cSrcweir {
1723cdf0e10cSrcweir SdrPageView* pPageView = pView->GetSdrPageView();
1724cdf0e10cSrcweir
1725cdf0e10cSrcweir if(pPageView)
1726cdf0e10cSrcweir {
1727cdf0e10cSrcweir for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
1728cdf0e10cSrcweir {
1729cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
1730cdf0e10cSrcweir
1731cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
1732cdf0e10cSrcweir {
1733cdf0e10cSrcweir if(rPageWindow.GetOverlayManager())
1734cdf0e10cSrcweir {
1735cdf0e10cSrcweir const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
1736cdf0e10cSrcweir const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
17371cd65da9SArmin Le Grand const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
17381cd65da9SArmin Le Grand const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
17391cd65da9SArmin Le Grand const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
1740cdf0e10cSrcweir
17411cd65da9SArmin Le Grand ::sdr::overlay::OverlayRectangle* pNewOverlayObject = new ::sdr::overlay::OverlayRectangle(
1742cdf0e10cSrcweir aTopLeft,
1743cdf0e10cSrcweir aBottomRight,
17441cd65da9SArmin Le Grand aHilightColor,
17451cd65da9SArmin Le Grand fTransparence,
1746cdf0e10cSrcweir 3.0,
1747cdf0e10cSrcweir 3.0,
17481cd65da9SArmin Le Grand nDrehWink * -F_PI18000,
17491cd65da9SArmin Le Grand 500,
17501cd65da9SArmin Le Grand true); // allow animation; the Handle is not shown at text edit time
17511cd65da9SArmin Le Grand
1752cdf0e10cSrcweir pNewOverlayObject->setHittable(false);
1753cdf0e10cSrcweir
1754cdf0e10cSrcweir // OVERLAYMANAGER
1755cdf0e10cSrcweir if(pNewOverlayObject)
1756cdf0e10cSrcweir {
1757cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
1758cdf0e10cSrcweir maOverlayGroup.append(*pNewOverlayObject);
1759cdf0e10cSrcweir }
1760cdf0e10cSrcweir }
1761cdf0e10cSrcweir }
1762cdf0e10cSrcweir }
1763cdf0e10cSrcweir }
1764cdf0e10cSrcweir }
1765cdf0e10cSrcweir }
1766cdf0e10cSrcweir }
1767cdf0e10cSrcweir
1768cdf0e10cSrcweir
1769cdf0e10cSrcweir class ImpSdrHdlListSorter: public ContainerSorter {
1770cdf0e10cSrcweir public:
ImpSdrHdlListSorter(Container & rNewCont)1771cdf0e10cSrcweir ImpSdrHdlListSorter(Container& rNewCont): ContainerSorter(rNewCont) {}
1772cdf0e10cSrcweir virtual int Compare(const void* pElem1, const void* pElem2) const;
1773cdf0e10cSrcweir };
1774cdf0e10cSrcweir
Compare(const void * pElem1,const void * pElem2) const1775cdf0e10cSrcweir int ImpSdrHdlListSorter::Compare(const void* pElem1, const void* pElem2) const
1776cdf0e10cSrcweir {
1777cdf0e10cSrcweir SdrHdlKind eKind1=((SdrHdl*)pElem1)->GetKind();
1778cdf0e10cSrcweir SdrHdlKind eKind2=((SdrHdl*)pElem2)->GetKind();
1779cdf0e10cSrcweir // Level 1: Erst normale Handles, dann Glue, dann User, dann Plushandles, dann Retpunkt-Handles
1780cdf0e10cSrcweir unsigned n1=1;
1781cdf0e10cSrcweir unsigned n2=1;
1782cdf0e10cSrcweir if (eKind1!=eKind2)
1783cdf0e10cSrcweir {
1784cdf0e10cSrcweir if (eKind1==HDL_REF1 || eKind1==HDL_REF2 || eKind1==HDL_MIRX) n1=5;
17855db901c0Smseidel else if (eKind1==HDL_GLUE || eKind1==HDL_GLUE_UNSEL) n1=2;
1786cdf0e10cSrcweir else if (eKind1==HDL_USER) n1=3;
1787cdf0e10cSrcweir else if (eKind1==HDL_SMARTTAG) n1=0;
1788cdf0e10cSrcweir if (eKind2==HDL_REF1 || eKind2==HDL_REF2 || eKind2==HDL_MIRX) n2=5;
17895db901c0Smseidel else if (eKind2==HDL_GLUE || eKind1==HDL_GLUE_UNSEL) n2=2;
1790cdf0e10cSrcweir else if (eKind2==HDL_USER) n2=3;
1791cdf0e10cSrcweir else if (eKind2==HDL_SMARTTAG) n2=0;
1792cdf0e10cSrcweir }
1793cdf0e10cSrcweir if (((SdrHdl*)pElem1)->IsPlusHdl()) n1=4;
1794cdf0e10cSrcweir if (((SdrHdl*)pElem2)->IsPlusHdl()) n2=4;
1795cdf0e10cSrcweir if (n1==n2)
1796cdf0e10cSrcweir {
1797cdf0e10cSrcweir // Level 2: PageView (Pointer)
1798cdf0e10cSrcweir SdrPageView* pPV1=((SdrHdl*)pElem1)->GetPageView();
1799cdf0e10cSrcweir SdrPageView* pPV2=((SdrHdl*)pElem2)->GetPageView();
1800cdf0e10cSrcweir if (pPV1==pPV2)
1801cdf0e10cSrcweir {
1802cdf0e10cSrcweir // Level 3: Position (x+y)
1803cdf0e10cSrcweir SdrObject* pObj1=((SdrHdl*)pElem1)->GetObj();
1804cdf0e10cSrcweir SdrObject* pObj2=((SdrHdl*)pElem2)->GetObj();
1805cdf0e10cSrcweir if (pObj1==pObj2)
1806cdf0e10cSrcweir {
1807cdf0e10cSrcweir sal_uInt32 nNum1=((SdrHdl*)pElem1)->GetObjHdlNum();
1808cdf0e10cSrcweir sal_uInt32 nNum2=((SdrHdl*)pElem2)->GetObjHdlNum();
1809cdf0e10cSrcweir if (nNum1==nNum2)
1810cdf0e10cSrcweir { // #48763#
1811cdf0e10cSrcweir if (eKind1==eKind2)
1812cdf0e10cSrcweir return (long)pElem1<(long)pElem2 ? -1 : 1; // Notloesung, um immer die gleiche Sortierung zu haben
1813cdf0e10cSrcweir return (sal_uInt16)eKind1<(sal_uInt16)eKind2 ? -1 : 1;
1814cdf0e10cSrcweir }
1815cdf0e10cSrcweir else
1816cdf0e10cSrcweir return nNum1<nNum2 ? -1 : 1;
1817cdf0e10cSrcweir }
1818cdf0e10cSrcweir else
1819cdf0e10cSrcweir {
1820cdf0e10cSrcweir return (long)pObj1<(long)pObj2 ? -1 : 1;
1821cdf0e10cSrcweir }
1822cdf0e10cSrcweir }
1823cdf0e10cSrcweir else
1824cdf0e10cSrcweir {
1825cdf0e10cSrcweir return (long)pPV1<(long)pPV2 ? -1 : 1;
1826cdf0e10cSrcweir }
1827cdf0e10cSrcweir }
1828cdf0e10cSrcweir else
1829cdf0e10cSrcweir {
1830cdf0e10cSrcweir return n1<n2 ? -1 : 1;
1831cdf0e10cSrcweir }
1832cdf0e10cSrcweir }
1833cdf0e10cSrcweir
GetView() const1834cdf0e10cSrcweir SdrMarkView* SdrHdlList::GetView() const
1835cdf0e10cSrcweir {
1836cdf0e10cSrcweir return pView;
1837cdf0e10cSrcweir }
1838cdf0e10cSrcweir
1839cdf0e10cSrcweir // #105678# Help struct for re-sorting handles
1840cdf0e10cSrcweir struct ImplHdlAndIndex
1841cdf0e10cSrcweir {
1842cdf0e10cSrcweir SdrHdl* mpHdl;
1843cdf0e10cSrcweir sal_uInt32 mnIndex;
1844cdf0e10cSrcweir };
1845cdf0e10cSrcweir
1846cdf0e10cSrcweir // #105678# Help method for sorting handles taking care of OrdNums, keeping order in
1847cdf0e10cSrcweir // single objects and re-sorting polygon handles intuitively
ImplSortHdlFunc(const void * pVoid1,const void * pVoid2)1848cdf0e10cSrcweir extern "C" int __LOADONCALLAPI ImplSortHdlFunc( const void* pVoid1, const void* pVoid2 )
1849cdf0e10cSrcweir {
1850cdf0e10cSrcweir const ImplHdlAndIndex* p1 = (ImplHdlAndIndex*)pVoid1;
1851cdf0e10cSrcweir const ImplHdlAndIndex* p2 = (ImplHdlAndIndex*)pVoid2;
1852cdf0e10cSrcweir
1853cdf0e10cSrcweir if(p1->mpHdl->GetObj() == p2->mpHdl->GetObj())
1854cdf0e10cSrcweir {
1855cdf0e10cSrcweir if(p1->mpHdl->GetObj() && p1->mpHdl->GetObj()->ISA(SdrPathObj))
1856cdf0e10cSrcweir {
1857cdf0e10cSrcweir // same object and a path object
1858cdf0e10cSrcweir if((p1->mpHdl->GetKind() == HDL_POLY || p1->mpHdl->GetKind() == HDL_BWGT)
1859cdf0e10cSrcweir && (p2->mpHdl->GetKind() == HDL_POLY || p2->mpHdl->GetKind() == HDL_BWGT))
1860cdf0e10cSrcweir {
1861cdf0e10cSrcweir // both handles are point or control handles
1862cdf0e10cSrcweir if(p1->mpHdl->GetPolyNum() == p2->mpHdl->GetPolyNum())
1863cdf0e10cSrcweir {
1864cdf0e10cSrcweir if(p1->mpHdl->GetPointNum() < p2->mpHdl->GetPointNum())
1865cdf0e10cSrcweir {
1866cdf0e10cSrcweir return -1;
1867cdf0e10cSrcweir }
1868cdf0e10cSrcweir else
1869cdf0e10cSrcweir {
1870cdf0e10cSrcweir return 1;
1871cdf0e10cSrcweir }
1872cdf0e10cSrcweir }
1873cdf0e10cSrcweir else if(p1->mpHdl->GetPolyNum() < p2->mpHdl->GetPolyNum())
1874cdf0e10cSrcweir {
1875cdf0e10cSrcweir return -1;
1876cdf0e10cSrcweir }
1877cdf0e10cSrcweir else
1878cdf0e10cSrcweir {
1879cdf0e10cSrcweir return 1;
1880cdf0e10cSrcweir }
1881cdf0e10cSrcweir }
1882cdf0e10cSrcweir }
1883cdf0e10cSrcweir }
1884cdf0e10cSrcweir else
1885cdf0e10cSrcweir {
1886cdf0e10cSrcweir if(!p1->mpHdl->GetObj())
1887cdf0e10cSrcweir {
1888cdf0e10cSrcweir return -1;
1889cdf0e10cSrcweir }
1890cdf0e10cSrcweir else if(!p2->mpHdl->GetObj())
1891cdf0e10cSrcweir {
1892cdf0e10cSrcweir return 1;
1893cdf0e10cSrcweir }
1894cdf0e10cSrcweir else
1895cdf0e10cSrcweir {
1896cdf0e10cSrcweir // different objects, use OrdNum for sort
1897cdf0e10cSrcweir const sal_uInt32 nOrdNum1 = p1->mpHdl->GetObj()->GetOrdNum();
1898cdf0e10cSrcweir const sal_uInt32 nOrdNum2 = p2->mpHdl->GetObj()->GetOrdNum();
1899cdf0e10cSrcweir
1900cdf0e10cSrcweir if(nOrdNum1 < nOrdNum2)
1901cdf0e10cSrcweir {
1902cdf0e10cSrcweir return -1;
1903cdf0e10cSrcweir }
1904cdf0e10cSrcweir else
1905cdf0e10cSrcweir {
1906cdf0e10cSrcweir return 1;
1907cdf0e10cSrcweir }
1908cdf0e10cSrcweir }
1909cdf0e10cSrcweir }
1910cdf0e10cSrcweir
1911cdf0e10cSrcweir // fallback to indices
1912cdf0e10cSrcweir if(p1->mnIndex < p2->mnIndex)
1913cdf0e10cSrcweir {
1914cdf0e10cSrcweir return -1;
1915cdf0e10cSrcweir }
1916cdf0e10cSrcweir else
1917cdf0e10cSrcweir {
1918cdf0e10cSrcweir return 1;
1919cdf0e10cSrcweir }
1920cdf0e10cSrcweir }
1921cdf0e10cSrcweir
19224d196ef4Smseidel
1923cdf0e10cSrcweir // #97016# II
1924cdf0e10cSrcweir
TravelFocusHdl(sal_Bool bForward)1925cdf0e10cSrcweir void SdrHdlList::TravelFocusHdl(sal_Bool bForward)
1926cdf0e10cSrcweir {
1927cdf0e10cSrcweir // security correction
1928cdf0e10cSrcweir if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex >= GetHdlCount())
1929cdf0e10cSrcweir mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1930cdf0e10cSrcweir
1931cdf0e10cSrcweir if(aList.Count())
1932cdf0e10cSrcweir {
1933cdf0e10cSrcweir // take care of old handle
1934cdf0e10cSrcweir const sal_uIntPtr nOldHdlNum(mnFocusIndex);
1935cdf0e10cSrcweir SdrHdl* pOld = GetHdl(nOldHdlNum);
1936cdf0e10cSrcweir //SDOsal_Bool bRefresh(sal_False);
1937cdf0e10cSrcweir
1938cdf0e10cSrcweir if(pOld)
1939cdf0e10cSrcweir {
1940cdf0e10cSrcweir // switch off old handle
1941cdf0e10cSrcweir mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
1942cdf0e10cSrcweir pOld->Touch();
1943cdf0e10cSrcweir //SDObRefresh = sal_True;
1944cdf0e10cSrcweir }
1945cdf0e10cSrcweir
1946cdf0e10cSrcweir // #105678# Alloc pointer array for sorted handle list
1947cdf0e10cSrcweir ImplHdlAndIndex* pHdlAndIndex = new ImplHdlAndIndex[aList.Count()];
1948cdf0e10cSrcweir
1949cdf0e10cSrcweir // #105678# build sorted handle list
1950cdf0e10cSrcweir sal_uInt32 a;
1951cdf0e10cSrcweir for( a = 0; a < aList.Count(); a++)
1952cdf0e10cSrcweir {
1953cdf0e10cSrcweir pHdlAndIndex[a].mpHdl = (SdrHdl*)aList.GetObject(a);
1954cdf0e10cSrcweir pHdlAndIndex[a].mnIndex = a;
1955cdf0e10cSrcweir }
1956cdf0e10cSrcweir
1957cdf0e10cSrcweir // #105678# qsort all entries
1958cdf0e10cSrcweir qsort(pHdlAndIndex, aList.Count(), sizeof(ImplHdlAndIndex), ImplSortHdlFunc);
1959cdf0e10cSrcweir
1960cdf0e10cSrcweir // #105678# look for old num in sorted array
1961cdf0e10cSrcweir sal_uIntPtr nOldHdl(nOldHdlNum);
1962cdf0e10cSrcweir
1963cdf0e10cSrcweir if(nOldHdlNum != CONTAINER_ENTRY_NOTFOUND)
1964cdf0e10cSrcweir {
1965cdf0e10cSrcweir for(a = 0; a < aList.Count(); a++)
1966cdf0e10cSrcweir {
1967cdf0e10cSrcweir if(pHdlAndIndex[a].mpHdl == pOld)
1968cdf0e10cSrcweir {
1969cdf0e10cSrcweir nOldHdl = a;
1970cdf0e10cSrcweir break;
1971cdf0e10cSrcweir }
1972cdf0e10cSrcweir }
1973cdf0e10cSrcweir }
1974cdf0e10cSrcweir
1975cdf0e10cSrcweir // #105678# build new HdlNum
1976cdf0e10cSrcweir sal_uIntPtr nNewHdl(nOldHdl);
1977cdf0e10cSrcweir
1978cdf0e10cSrcweir // #105678# do the focus travel
1979cdf0e10cSrcweir if(bForward)
1980cdf0e10cSrcweir {
1981cdf0e10cSrcweir if(nOldHdl != CONTAINER_ENTRY_NOTFOUND)
1982cdf0e10cSrcweir {
1983cdf0e10cSrcweir if(nOldHdl == aList.Count() - 1)
1984cdf0e10cSrcweir {
1985cdf0e10cSrcweir // end forward run
1986cdf0e10cSrcweir nNewHdl = CONTAINER_ENTRY_NOTFOUND;
1987cdf0e10cSrcweir }
1988cdf0e10cSrcweir else
1989cdf0e10cSrcweir {
1990cdf0e10cSrcweir // simply the next handle
1991cdf0e10cSrcweir nNewHdl++;
1992cdf0e10cSrcweir }
1993cdf0e10cSrcweir }
1994cdf0e10cSrcweir else
1995cdf0e10cSrcweir {
1996cdf0e10cSrcweir // start forward run at first entry
1997cdf0e10cSrcweir nNewHdl = 0;
1998cdf0e10cSrcweir }
1999cdf0e10cSrcweir }
2000cdf0e10cSrcweir else
2001cdf0e10cSrcweir {
2002cdf0e10cSrcweir if(nOldHdl == CONTAINER_ENTRY_NOTFOUND)
2003cdf0e10cSrcweir {
2004cdf0e10cSrcweir // start backward run at last entry
2005cdf0e10cSrcweir nNewHdl = aList.Count() - 1;
2006cdf0e10cSrcweir
2007cdf0e10cSrcweir }
2008cdf0e10cSrcweir else
2009cdf0e10cSrcweir {
2010cdf0e10cSrcweir if(nOldHdl == 0)
2011cdf0e10cSrcweir {
2012cdf0e10cSrcweir // end backward run
2013cdf0e10cSrcweir nNewHdl = CONTAINER_ENTRY_NOTFOUND;
2014cdf0e10cSrcweir }
2015cdf0e10cSrcweir else
2016cdf0e10cSrcweir {
2017cdf0e10cSrcweir // simply the previous handle
2018cdf0e10cSrcweir nNewHdl--;
2019cdf0e10cSrcweir }
2020cdf0e10cSrcweir }
2021cdf0e10cSrcweir }
2022cdf0e10cSrcweir
2023cdf0e10cSrcweir // #105678# build new HdlNum
2024cdf0e10cSrcweir sal_uInt32 nNewHdlNum(nNewHdl);
2025cdf0e10cSrcweir
2026cdf0e10cSrcweir // look for old num in sorted array
2027cdf0e10cSrcweir if(nNewHdl != CONTAINER_ENTRY_NOTFOUND)
2028cdf0e10cSrcweir {
2029cdf0e10cSrcweir SdrHdl* pNew = pHdlAndIndex[nNewHdl].mpHdl;
2030cdf0e10cSrcweir
2031cdf0e10cSrcweir for(a = 0; a < aList.Count(); a++)
2032cdf0e10cSrcweir {
2033cdf0e10cSrcweir if((SdrHdl*)aList.GetObject(a) == pNew)
2034cdf0e10cSrcweir {
2035cdf0e10cSrcweir nNewHdlNum = a;
2036cdf0e10cSrcweir break;
2037cdf0e10cSrcweir }
2038cdf0e10cSrcweir }
2039cdf0e10cSrcweir }
2040cdf0e10cSrcweir
2041cdf0e10cSrcweir // take care of next handle
2042cdf0e10cSrcweir if(nOldHdlNum != nNewHdlNum)
2043cdf0e10cSrcweir {
2044cdf0e10cSrcweir mnFocusIndex = nNewHdlNum;
2045cdf0e10cSrcweir SdrHdl* pNew = GetHdl(mnFocusIndex);
2046cdf0e10cSrcweir
2047cdf0e10cSrcweir if(pNew)
2048cdf0e10cSrcweir {
2049cdf0e10cSrcweir pNew->Touch();
2050cdf0e10cSrcweir //SDObRefresh = sal_True;
2051cdf0e10cSrcweir }
2052cdf0e10cSrcweir }
2053cdf0e10cSrcweir
2054cdf0e10cSrcweir // #105678# free mem again
2055cdf0e10cSrcweir delete [] pHdlAndIndex;
2056cdf0e10cSrcweir }
2057cdf0e10cSrcweir }
2058cdf0e10cSrcweir
GetFocusHdl() const2059cdf0e10cSrcweir SdrHdl* SdrHdlList::GetFocusHdl() const
2060cdf0e10cSrcweir {
2061cdf0e10cSrcweir if(mnFocusIndex != CONTAINER_ENTRY_NOTFOUND && mnFocusIndex < GetHdlCount())
2062cdf0e10cSrcweir return GetHdl(mnFocusIndex);
2063cdf0e10cSrcweir else
2064cdf0e10cSrcweir return 0L;
2065cdf0e10cSrcweir }
2066cdf0e10cSrcweir
SetFocusHdl(SdrHdl * pNew)2067cdf0e10cSrcweir void SdrHdlList::SetFocusHdl(SdrHdl* pNew)
2068cdf0e10cSrcweir {
2069cdf0e10cSrcweir if(pNew)
2070cdf0e10cSrcweir {
2071cdf0e10cSrcweir SdrHdl* pActual = GetFocusHdl();
2072cdf0e10cSrcweir
2073cdf0e10cSrcweir if(!pActual || pActual != pNew)
2074cdf0e10cSrcweir {
2075cdf0e10cSrcweir sal_uIntPtr nNewHdlNum = GetHdlNum(pNew);
2076cdf0e10cSrcweir
2077cdf0e10cSrcweir if(nNewHdlNum != CONTAINER_ENTRY_NOTFOUND)
2078cdf0e10cSrcweir {
2079cdf0e10cSrcweir //SDOsal_Bool bRefresh(sal_False);
2080cdf0e10cSrcweir mnFocusIndex = nNewHdlNum;
2081cdf0e10cSrcweir
2082cdf0e10cSrcweir if(pActual)
2083cdf0e10cSrcweir {
2084cdf0e10cSrcweir pActual->Touch();
2085cdf0e10cSrcweir //SDObRefresh = sal_True;
2086cdf0e10cSrcweir }
2087cdf0e10cSrcweir
2088cdf0e10cSrcweir if(pNew)
2089cdf0e10cSrcweir {
2090cdf0e10cSrcweir pNew->Touch();
2091cdf0e10cSrcweir //SDObRefresh = sal_True;
2092cdf0e10cSrcweir }
2093cdf0e10cSrcweir
2094cdf0e10cSrcweir //OLMif(bRefresh)
2095cdf0e10cSrcweir //OLM{
2096cdf0e10cSrcweir //OLM if(pView)
2097cdf0e10cSrcweir //OLM pView->RefreshAllIAOManagers();
2098cdf0e10cSrcweir //OLM}
2099cdf0e10cSrcweir }
2100cdf0e10cSrcweir }
2101cdf0e10cSrcweir }
2102cdf0e10cSrcweir }
2103cdf0e10cSrcweir
ResetFocusHdl()2104cdf0e10cSrcweir void SdrHdlList::ResetFocusHdl()
2105cdf0e10cSrcweir {
2106cdf0e10cSrcweir SdrHdl* pHdl = GetFocusHdl();
2107cdf0e10cSrcweir
2108cdf0e10cSrcweir mnFocusIndex = CONTAINER_ENTRY_NOTFOUND;
2109cdf0e10cSrcweir
2110cdf0e10cSrcweir if(pHdl)
2111cdf0e10cSrcweir {
2112cdf0e10cSrcweir pHdl->Touch();
2113cdf0e10cSrcweir }
2114cdf0e10cSrcweir }
2115cdf0e10cSrcweir
2116cdf0e10cSrcweir
SdrHdlList(SdrMarkView * pV)2117cdf0e10cSrcweir SdrHdlList::SdrHdlList(SdrMarkView* pV)
2118cdf0e10cSrcweir : mnFocusIndex(CONTAINER_ENTRY_NOTFOUND),
2119cdf0e10cSrcweir pView(pV),
2120cdf0e10cSrcweir aList(1024,32,32)
2121cdf0e10cSrcweir {
2122cdf0e10cSrcweir nHdlSize = 3;
2123cdf0e10cSrcweir bRotateShear = sal_False;
2124cdf0e10cSrcweir bMoveOutside = sal_False;
2125cdf0e10cSrcweir bDistortShear = sal_False;
21264772d9afSArmin Le Grand bFineHandles = sal_True; // new default: Handles are fine handles
2127cdf0e10cSrcweir }
2128cdf0e10cSrcweir
~SdrHdlList()2129cdf0e10cSrcweir SdrHdlList::~SdrHdlList()
2130cdf0e10cSrcweir {
2131cdf0e10cSrcweir Clear();
2132cdf0e10cSrcweir }
2133cdf0e10cSrcweir
SetHdlSize(sal_uInt16 nSiz)2134cdf0e10cSrcweir void SdrHdlList::SetHdlSize(sal_uInt16 nSiz)
2135cdf0e10cSrcweir {
2136cdf0e10cSrcweir if(nHdlSize != nSiz)
2137cdf0e10cSrcweir {
2138cdf0e10cSrcweir // remember new value
2139cdf0e10cSrcweir nHdlSize = nSiz;
2140cdf0e10cSrcweir
2141cdf0e10cSrcweir // propagate change to IAOs
2142cdf0e10cSrcweir for(sal_uInt32 i=0; i<GetHdlCount(); i++)
2143cdf0e10cSrcweir {
2144cdf0e10cSrcweir SdrHdl* pHdl = GetHdl(i);
2145cdf0e10cSrcweir pHdl->Touch();
2146cdf0e10cSrcweir }
2147cdf0e10cSrcweir }
2148cdf0e10cSrcweir }
2149cdf0e10cSrcweir
SetMoveOutside(sal_Bool bOn)2150cdf0e10cSrcweir void SdrHdlList::SetMoveOutside(sal_Bool bOn)
2151cdf0e10cSrcweir {
2152cdf0e10cSrcweir if(bMoveOutside != bOn)
2153cdf0e10cSrcweir {
2154cdf0e10cSrcweir // remember new value
2155cdf0e10cSrcweir bMoveOutside = bOn;
2156cdf0e10cSrcweir
2157cdf0e10cSrcweir // propagate change to IAOs
2158cdf0e10cSrcweir for(sal_uInt32 i=0; i<GetHdlCount(); i++)
2159cdf0e10cSrcweir {
2160cdf0e10cSrcweir SdrHdl* pHdl = GetHdl(i);
2161cdf0e10cSrcweir pHdl->Touch();
2162cdf0e10cSrcweir }
2163cdf0e10cSrcweir }
2164cdf0e10cSrcweir }
2165cdf0e10cSrcweir
SetRotateShear(sal_Bool bOn)2166cdf0e10cSrcweir void SdrHdlList::SetRotateShear(sal_Bool bOn)
2167cdf0e10cSrcweir {
2168cdf0e10cSrcweir bRotateShear = bOn;
2169cdf0e10cSrcweir }
2170cdf0e10cSrcweir
SetDistortShear(sal_Bool bOn)2171cdf0e10cSrcweir void SdrHdlList::SetDistortShear(sal_Bool bOn)
2172cdf0e10cSrcweir {
2173cdf0e10cSrcweir bDistortShear = bOn;
2174cdf0e10cSrcweir }
2175cdf0e10cSrcweir
SetFineHdl(sal_Bool bOn)2176cdf0e10cSrcweir void SdrHdlList::SetFineHdl(sal_Bool bOn)
2177cdf0e10cSrcweir {
2178cdf0e10cSrcweir if(bFineHandles != bOn)
2179cdf0e10cSrcweir {
2180cdf0e10cSrcweir // remember new state
2181cdf0e10cSrcweir bFineHandles = bOn;
2182cdf0e10cSrcweir
2183cdf0e10cSrcweir // propagate change to IAOs
2184cdf0e10cSrcweir for(sal_uInt32 i=0; i<GetHdlCount(); i++)
2185cdf0e10cSrcweir {
2186cdf0e10cSrcweir SdrHdl* pHdl = GetHdl(i);
2187cdf0e10cSrcweir pHdl->Touch();
2188cdf0e10cSrcweir }
2189cdf0e10cSrcweir }
2190cdf0e10cSrcweir }
2191cdf0e10cSrcweir
RemoveHdl(sal_uIntPtr nNum)2192cdf0e10cSrcweir SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum)
2193cdf0e10cSrcweir {
2194cdf0e10cSrcweir SdrHdl* pRetval = (SdrHdl*)aList.Remove(nNum);
2195cdf0e10cSrcweir
2196cdf0e10cSrcweir return pRetval;
2197cdf0e10cSrcweir }
2198cdf0e10cSrcweir
Clear()2199cdf0e10cSrcweir void SdrHdlList::Clear()
2200cdf0e10cSrcweir {
2201cdf0e10cSrcweir for (sal_uIntPtr i=0; i<GetHdlCount(); i++)
2202cdf0e10cSrcweir {
2203cdf0e10cSrcweir SdrHdl* pHdl=GetHdl(i);
2204cdf0e10cSrcweir delete pHdl;
2205cdf0e10cSrcweir }
2206cdf0e10cSrcweir aList.Clear();
2207cdf0e10cSrcweir
2208cdf0e10cSrcweir bRotateShear=sal_False;
2209cdf0e10cSrcweir bDistortShear=sal_False;
2210cdf0e10cSrcweir }
2211cdf0e10cSrcweir
Sort()2212cdf0e10cSrcweir void SdrHdlList::Sort()
2213cdf0e10cSrcweir {
2214cdf0e10cSrcweir // #97016# II: remember current focused handle
2215cdf0e10cSrcweir SdrHdl* pPrev = GetFocusHdl();
2216cdf0e10cSrcweir
2217cdf0e10cSrcweir ImpSdrHdlListSorter aSort(aList);
2218cdf0e10cSrcweir aSort.DoSort();
2219cdf0e10cSrcweir
2220cdf0e10cSrcweir // #97016# II: get now and compare
2221cdf0e10cSrcweir SdrHdl* pNow = GetFocusHdl();
2222cdf0e10cSrcweir
2223cdf0e10cSrcweir if(pPrev != pNow)
2224cdf0e10cSrcweir {
2225cdf0e10cSrcweir //SDOsal_Bool bRefresh(sal_False);
2226cdf0e10cSrcweir
2227cdf0e10cSrcweir if(pPrev)
2228cdf0e10cSrcweir {
2229cdf0e10cSrcweir pPrev->Touch();
2230cdf0e10cSrcweir //SDObRefresh = sal_True;
2231cdf0e10cSrcweir }
2232cdf0e10cSrcweir
2233cdf0e10cSrcweir if(pNow)
2234cdf0e10cSrcweir {
2235cdf0e10cSrcweir pNow->Touch();
2236cdf0e10cSrcweir //SDObRefresh = sal_True;
2237cdf0e10cSrcweir }
2238cdf0e10cSrcweir }
2239cdf0e10cSrcweir }
2240cdf0e10cSrcweir
GetHdlNum(const SdrHdl * pHdl) const2241cdf0e10cSrcweir sal_uIntPtr SdrHdlList::GetHdlNum(const SdrHdl* pHdl) const
2242cdf0e10cSrcweir {
2243cdf0e10cSrcweir if (pHdl==NULL)
2244cdf0e10cSrcweir return CONTAINER_ENTRY_NOTFOUND;
2245cdf0e10cSrcweir sal_uIntPtr nPos=aList.GetPos(pHdl);
2246cdf0e10cSrcweir return nPos;
2247cdf0e10cSrcweir }
2248cdf0e10cSrcweir
AddHdl(SdrHdl * pHdl,sal_Bool bAtBegin)2249cdf0e10cSrcweir void SdrHdlList::AddHdl(SdrHdl* pHdl, sal_Bool bAtBegin)
2250cdf0e10cSrcweir {
2251cdf0e10cSrcweir if (pHdl!=NULL)
2252cdf0e10cSrcweir {
2253cdf0e10cSrcweir if (bAtBegin)
2254cdf0e10cSrcweir {
2255cdf0e10cSrcweir aList.Insert(pHdl,sal_uIntPtr(0));
2256cdf0e10cSrcweir }
2257cdf0e10cSrcweir else
2258cdf0e10cSrcweir {
2259cdf0e10cSrcweir aList.Insert(pHdl,CONTAINER_APPEND);
2260cdf0e10cSrcweir }
2261cdf0e10cSrcweir pHdl->SetHdlList(this);
2262cdf0e10cSrcweir }
2263cdf0e10cSrcweir }
2264cdf0e10cSrcweir
IsHdlListHit(const Point & rPnt,sal_Bool bBack,sal_Bool bNext,SdrHdl * pHdl0) const2265cdf0e10cSrcweir SdrHdl* SdrHdlList::IsHdlListHit(const Point& rPnt, sal_Bool bBack, sal_Bool bNext, SdrHdl* pHdl0) const
2266cdf0e10cSrcweir {
2267cdf0e10cSrcweir SdrHdl* pRet=NULL;
2268cdf0e10cSrcweir sal_uIntPtr nAnz=GetHdlCount();
2269cdf0e10cSrcweir sal_uIntPtr nNum=bBack ? 0 : nAnz;
2270cdf0e10cSrcweir while ((bBack ? nNum<nAnz : nNum>0) && pRet==NULL)
2271cdf0e10cSrcweir {
2272cdf0e10cSrcweir if (!bBack)
2273cdf0e10cSrcweir nNum--;
2274cdf0e10cSrcweir SdrHdl* pHdl=GetHdl(nNum);
2275cdf0e10cSrcweir if (bNext)
2276cdf0e10cSrcweir {
2277cdf0e10cSrcweir if (pHdl==pHdl0)
2278cdf0e10cSrcweir bNext=sal_False;
2279cdf0e10cSrcweir }
2280cdf0e10cSrcweir else
2281cdf0e10cSrcweir {
2282cdf0e10cSrcweir if (pHdl->IsHdlHit(rPnt))
2283cdf0e10cSrcweir pRet=pHdl;
2284cdf0e10cSrcweir }
2285cdf0e10cSrcweir if (bBack)
2286cdf0e10cSrcweir nNum++;
2287cdf0e10cSrcweir }
2288cdf0e10cSrcweir return pRet;
2289cdf0e10cSrcweir }
2290cdf0e10cSrcweir
GetHdl(SdrHdlKind eKind1) const2291cdf0e10cSrcweir SdrHdl* SdrHdlList::GetHdl(SdrHdlKind eKind1) const
2292cdf0e10cSrcweir {
2293cdf0e10cSrcweir SdrHdl* pRet=NULL;
2294cdf0e10cSrcweir for (sal_uIntPtr i=0; i<GetHdlCount() && pRet==NULL; i++)
2295cdf0e10cSrcweir {
2296cdf0e10cSrcweir SdrHdl* pHdl=GetHdl(i);
2297cdf0e10cSrcweir if (pHdl->GetKind()==eKind1)
2298cdf0e10cSrcweir pRet=pHdl;
2299cdf0e10cSrcweir }
2300cdf0e10cSrcweir return pRet;
2301cdf0e10cSrcweir }
2302cdf0e10cSrcweir
2303cdf0e10cSrcweir // --------------------------------------------------------------------
2304cdf0e10cSrcweir // SdrCropHdl
2305cdf0e10cSrcweir // --------------------------------------------------------------------
2306cdf0e10cSrcweir
SdrCropHdl(const Point & rPnt,SdrHdlKind eNewKind,double fShearX,double fRotation)2307414a0e15SArmin Le Grand SdrCropHdl::SdrCropHdl(
2308414a0e15SArmin Le Grand const Point& rPnt,
2309414a0e15SArmin Le Grand SdrHdlKind eNewKind,
2310414a0e15SArmin Le Grand double fShearX,
2311414a0e15SArmin Le Grand double fRotation)
2312414a0e15SArmin Le Grand : SdrHdl(rPnt, eNewKind),
2313414a0e15SArmin Le Grand mfShearX(fShearX),
2314414a0e15SArmin Le Grand mfRotation(fRotation)
2315cdf0e10cSrcweir {
2316cdf0e10cSrcweir }
2317cdf0e10cSrcweir
2318cdf0e10cSrcweir // --------------------------------------------------------------------
2319cdf0e10cSrcweir
GetHandlesBitmap(bool bIsFineHdl,bool bIsHighContrast)2320cdf0e10cSrcweir BitmapEx SdrCropHdl::GetHandlesBitmap( bool bIsFineHdl, bool bIsHighContrast )
2321cdf0e10cSrcweir {
2322cdf0e10cSrcweir if( bIsHighContrast )
2323cdf0e10cSrcweir {
2324cdf0e10cSrcweir static BitmapEx* pHighContrastBitmap = 0;
2325cdf0e10cSrcweir if( pHighContrastBitmap == 0 )
2326cdf0e10cSrcweir pHighContrastBitmap = new BitmapEx(ResId(SIP_SA_ACCESSIBILITY_CROP_MARKERS, *ImpGetResMgr()));
2327cdf0e10cSrcweir return *pHighContrastBitmap;
2328cdf0e10cSrcweir }
2329cdf0e10cSrcweir else if( bIsFineHdl )
2330cdf0e10cSrcweir {
2331cdf0e10cSrcweir static BitmapEx* pModernBitmap = 0;
2332cdf0e10cSrcweir if( pModernBitmap == 0 )
2333cdf0e10cSrcweir pModernBitmap = new BitmapEx(ResId(SIP_SA_CROP_FINE_MARKERS, *ImpGetResMgr()));
2334cdf0e10cSrcweir return *pModernBitmap;
2335cdf0e10cSrcweir }
2336cdf0e10cSrcweir else
2337cdf0e10cSrcweir {
2338*d0a36963Smseidel static BitmapEx* pSimpleBitmap = 0; //redirects to Fine Handles now
2339cdf0e10cSrcweir if( pSimpleBitmap == 0 )
2340*d0a36963Smseidel pSimpleBitmap = new BitmapEx(ResId(SIP_SA_CROP_FINE_MARKERS, *ImpGetResMgr()));
2341cdf0e10cSrcweir return *pSimpleBitmap;
2342cdf0e10cSrcweir }
2343cdf0e10cSrcweir }
2344cdf0e10cSrcweir
2345cdf0e10cSrcweir // --------------------------------------------------------------------
2346cdf0e10cSrcweir
GetBitmapForHandle(const BitmapEx & rBitmap,int nSize)2347cdf0e10cSrcweir BitmapEx SdrCropHdl::GetBitmapForHandle( const BitmapEx& rBitmap, int nSize )
2348cdf0e10cSrcweir {
2349cdf0e10cSrcweir int nPixelSize = 0, nX = 0, nY = 0, nOffset = 0;
2350cdf0e10cSrcweir
2351cdf0e10cSrcweir if( nSize <= 3 )
2352cdf0e10cSrcweir {
2353cdf0e10cSrcweir nPixelSize = 13;
2354cdf0e10cSrcweir nOffset = 0;
2355cdf0e10cSrcweir }
2356cdf0e10cSrcweir else if( nSize <=4 )
2357cdf0e10cSrcweir {
2358cdf0e10cSrcweir nPixelSize = 17;
2359062a78fdSmseidel nOffset = 39;
2360cdf0e10cSrcweir }
2361cdf0e10cSrcweir else
2362cdf0e10cSrcweir {
2363cdf0e10cSrcweir nPixelSize = 21;
2364062a78fdSmseidel nOffset = 90;
2365cdf0e10cSrcweir }
2366cdf0e10cSrcweir
2367cdf0e10cSrcweir switch( eKind )
2368cdf0e10cSrcweir {
2369cdf0e10cSrcweir case HDL_UPLFT: nX = 0; nY = 0; break;
2370cdf0e10cSrcweir case HDL_UPPER: nX = 1; nY = 0; break;
2371cdf0e10cSrcweir case HDL_UPRGT: nX = 2; nY = 0; break;
2372cdf0e10cSrcweir case HDL_LEFT: nX = 0; nY = 1; break;
2373cdf0e10cSrcweir case HDL_RIGHT: nX = 2; nY = 1; break;
2374cdf0e10cSrcweir case HDL_LWLFT: nX = 0; nY = 2; break;
2375cdf0e10cSrcweir case HDL_LOWER: nX = 1; nY = 2; break;
2376cdf0e10cSrcweir case HDL_LWRGT: nX = 2; nY = 2; break;
2377cdf0e10cSrcweir default: break;
2378cdf0e10cSrcweir }
2379cdf0e10cSrcweir
2380062a78fdSmseidel Rectangle aSourceRect( Point( nX * (nPixelSize) + nOffset, nY * (nPixelSize)), Size(nPixelSize, nPixelSize) );
2381cdf0e10cSrcweir
2382cdf0e10cSrcweir BitmapEx aRetval(rBitmap);
2383cdf0e10cSrcweir aRetval.Crop(aSourceRect);
2384cdf0e10cSrcweir return aRetval;
2385cdf0e10cSrcweir }
2386cdf0e10cSrcweir
2387cdf0e10cSrcweir // --------------------------------------------------------------------
2388cdf0e10cSrcweir
CreateB2dIAObject()2389cdf0e10cSrcweir void SdrCropHdl::CreateB2dIAObject()
2390cdf0e10cSrcweir {
2391cdf0e10cSrcweir // first throw away old one
2392cdf0e10cSrcweir GetRidOfIAObject();
2393cdf0e10cSrcweir
2394cdf0e10cSrcweir SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
2395cdf0e10cSrcweir SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
2396cdf0e10cSrcweir
2397cdf0e10cSrcweir if( pPageView && !pView->areMarkHandlesHidden() )
2398cdf0e10cSrcweir {
2399cdf0e10cSrcweir sal_Bool bIsFineHdl(pHdlList->IsFineHdl());
2400cdf0e10cSrcweir const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2401cdf0e10cSrcweir sal_Bool bIsHighContrast(rStyleSettings.GetHighContrastMode());
2402cdf0e10cSrcweir int nHdlSize = pHdlList->GetHdlSize();
2403cdf0e10cSrcweir if( bIsHighContrast )
2404cdf0e10cSrcweir nHdlSize = 4;
2405cdf0e10cSrcweir
2406cdf0e10cSrcweir const BitmapEx aHandlesBitmap( GetHandlesBitmap( bIsFineHdl, bIsHighContrast ) );
2407cdf0e10cSrcweir BitmapEx aBmpEx1( GetBitmapForHandle( aHandlesBitmap, nHdlSize ) );
2408cdf0e10cSrcweir
2409cdf0e10cSrcweir for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
2410cdf0e10cSrcweir {
2411cdf0e10cSrcweir // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
2412cdf0e10cSrcweir const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
2413cdf0e10cSrcweir
2414cdf0e10cSrcweir if(rPageWindow.GetPaintWindow().OutputToWindow())
2415cdf0e10cSrcweir {
2416cdf0e10cSrcweir if(rPageWindow.GetOverlayManager())
2417cdf0e10cSrcweir {
2418cdf0e10cSrcweir basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
2419cdf0e10cSrcweir
2420cdf0e10cSrcweir ::sdr::overlay::OverlayObject* pOverlayObject = 0L;
2421cdf0e10cSrcweir
2422cdf0e10cSrcweir // animate focused handles
2423cdf0e10cSrcweir if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
2424cdf0e10cSrcweir {
2425cdf0e10cSrcweir if( nHdlSize >= 2 )
2426cdf0e10cSrcweir nHdlSize = 1;
2427cdf0e10cSrcweir
2428cdf0e10cSrcweir BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
2429cdf0e10cSrcweir
2430cdf0e10cSrcweir const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
2431cdf0e10cSrcweir
2432414a0e15SArmin Le Grand pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(
2433414a0e15SArmin Le Grand aPosition,
2434414a0e15SArmin Le Grand aBmpEx1,
2435414a0e15SArmin Le Grand aBmpEx2,
2436414a0e15SArmin Le Grand nBlinkTime,
2437cdf0e10cSrcweir (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2438cdf0e10cSrcweir (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2439cdf0e10cSrcweir (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
2440414a0e15SArmin Le Grand (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1,
2441414a0e15SArmin Le Grand mfShearX,
2442414a0e15SArmin Le Grand mfRotation);
2443cdf0e10cSrcweir }
2444cdf0e10cSrcweir else
2445cdf0e10cSrcweir {
2446cdf0e10cSrcweir // create centered handle as default
2447414a0e15SArmin Le Grand pOverlayObject = new ::sdr::overlay::OverlayBitmapEx(
2448414a0e15SArmin Le Grand aPosition,
2449414a0e15SArmin Le Grand aBmpEx1,
2450cdf0e10cSrcweir (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2451414a0e15SArmin Le Grand (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2452414a0e15SArmin Le Grand 0.0,
2453414a0e15SArmin Le Grand mfShearX,
2454414a0e15SArmin Le Grand mfRotation);
2455cdf0e10cSrcweir }
2456cdf0e10cSrcweir
2457cdf0e10cSrcweir // OVERLAYMANAGER
2458cdf0e10cSrcweir if(pOverlayObject)
2459cdf0e10cSrcweir {
2460cdf0e10cSrcweir rPageWindow.GetOverlayManager()->add(*pOverlayObject);
2461cdf0e10cSrcweir maOverlayGroup.append(*pOverlayObject);
2462cdf0e10cSrcweir }
2463cdf0e10cSrcweir }
2464cdf0e10cSrcweir }
2465cdf0e10cSrcweir }
2466cdf0e10cSrcweir }
2467cdf0e10cSrcweir }
2468cdf0e10cSrcweir
2469414a0e15SArmin Le Grand // with the correction of crop handling I could get rid of the extra mirroring flag, adapted stuff
2470414a0e15SArmin Le Grand // accordingly
24712376739dSArmin Le Grand
SdrCropViewHdl(const basegfx::B2DHomMatrix & rObjectTransform,const Graphic & rGraphic,double fCropLeft,double fCropTop,double fCropRight,double fCropBottom)24722376739dSArmin Le Grand SdrCropViewHdl::SdrCropViewHdl(
24732376739dSArmin Le Grand const basegfx::B2DHomMatrix& rObjectTransform,
24742376739dSArmin Le Grand const Graphic& rGraphic,
24752376739dSArmin Le Grand double fCropLeft,
24762376739dSArmin Le Grand double fCropTop,
24772376739dSArmin Le Grand double fCropRight,
2478414a0e15SArmin Le Grand double fCropBottom)
24792376739dSArmin Le Grand : SdrHdl(Point(), HDL_USER),
24802376739dSArmin Le Grand maObjectTransform(rObjectTransform),
24812376739dSArmin Le Grand maGraphic(rGraphic),
24822376739dSArmin Le Grand mfCropLeft(fCropLeft),
24832376739dSArmin Le Grand mfCropTop(fCropTop),
24842376739dSArmin Le Grand mfCropRight(fCropRight),
2485414a0e15SArmin Le Grand mfCropBottom(fCropBottom)
24862376739dSArmin Le Grand {
24872376739dSArmin Le Grand }
24882376739dSArmin Le Grand
CreateB2dIAObject()24892376739dSArmin Le Grand void SdrCropViewHdl::CreateB2dIAObject()
24902376739dSArmin Le Grand {
24912376739dSArmin Le Grand GetRidOfIAObject();
24922376739dSArmin Le Grand SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
24932376739dSArmin Le Grand SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
24942376739dSArmin Le Grand
24952376739dSArmin Le Grand if(pPageView && pView->areMarkHandlesHidden())
24962376739dSArmin Le Grand {
24972376739dSArmin Le Grand return;
24982376739dSArmin Le Grand }
24992376739dSArmin Le Grand
25002376739dSArmin Le Grand // decompose to have current translate and scale
25012376739dSArmin Le Grand basegfx::B2DVector aScale, aTranslate;
25022376739dSArmin Le Grand double fRotate, fShearX;
25032376739dSArmin Le Grand
25042376739dSArmin Le Grand maObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX);
25052376739dSArmin Le Grand
25062376739dSArmin Le Grand if(aScale.equalZero())
25072376739dSArmin Le Grand {
25082376739dSArmin Le Grand return;
25092376739dSArmin Le Grand }
25102376739dSArmin Le Grand
25112376739dSArmin Le Grand // detect 180 degree rotation, this is the same as mirrored in X and Y,
25122376739dSArmin Le Grand // thus change to mirroring. Prefer mirroring here. Use the equal call
25132376739dSArmin Le Grand // with getSmallValue here, the original which uses rtl::math::approxEqual
25142376739dSArmin Le Grand // is too correct here. Maybe this changes with enhanced precision in aw080
25152376739dSArmin Le Grand // to the better so that this can be reduced to the more precise call again
25162376739dSArmin Le Grand if(basegfx::fTools::equal(fabs(fRotate), F_PI, 0.000000001))
25172376739dSArmin Le Grand {
25182376739dSArmin Le Grand aScale.setX(aScale.getX() * -1.0);
25192376739dSArmin Le Grand aScale.setY(aScale.getY() * -1.0);
25202376739dSArmin Le Grand fRotate = 0.0;
25212376739dSArmin Le Grand }
25222376739dSArmin Le Grand
25232376739dSArmin Le Grand // remember mirroring, reset at Scale and adapt crop values for usage;
25242376739dSArmin Le Grand // mirroring can stay in the object transformation, so do not have to
25252376739dSArmin Le Grand // cope with it here (except later for the CroppedImage transformation,
25262376739dSArmin Le Grand // see below)
25272376739dSArmin Le Grand const bool bMirroredX(aScale.getX() < 0.0);
25282376739dSArmin Le Grand const bool bMirroredY(aScale.getY() < 0.0);
25292376739dSArmin Le Grand double fCropLeft(mfCropLeft);
25302376739dSArmin Le Grand double fCropTop(mfCropTop);
25312376739dSArmin Le Grand double fCropRight(mfCropRight);
25322376739dSArmin Le Grand double fCropBottom(mfCropBottom);
25332376739dSArmin Le Grand
25342376739dSArmin Le Grand if(bMirroredX)
25352376739dSArmin Le Grand {
25362376739dSArmin Le Grand aScale.setX(-aScale.getX());
25372376739dSArmin Le Grand }
25382376739dSArmin Le Grand
25392376739dSArmin Le Grand if(bMirroredY)
25402376739dSArmin Le Grand {
25412376739dSArmin Le Grand aScale.setY(-aScale.getY());
25422376739dSArmin Le Grand }
25432376739dSArmin Le Grand
25442376739dSArmin Le Grand // create target translate and scale
25452376739dSArmin Le Grand const basegfx::B2DVector aTargetScale(
25462376739dSArmin Le Grand aScale.getX() + fCropRight + fCropLeft,
25472376739dSArmin Le Grand aScale.getY() + fCropBottom + fCropTop);
25482376739dSArmin Le Grand const basegfx::B2DVector aTargetTranslate(
25492376739dSArmin Le Grand aTranslate.getX() - fCropLeft,
25502376739dSArmin Le Grand aTranslate.getY() - fCropTop);
25512376739dSArmin Le Grand
25522376739dSArmin Le Grand // create ranges to make comparisons
25532376739dSArmin Le Grand const basegfx::B2DRange aCurrentForCompare(
25542376739dSArmin Le Grand aTranslate.getX(), aTranslate.getY(),
25552376739dSArmin Le Grand aTranslate.getX() + aScale.getX(), aTranslate.getY() + aScale.getY());
25562376739dSArmin Le Grand basegfx::B2DRange aCropped(
25572376739dSArmin Le Grand aTargetTranslate.getX(), aTargetTranslate.getY(),
25582376739dSArmin Le Grand aTargetTranslate.getX() + aTargetScale.getX(), aTargetTranslate.getY() + aTargetScale.getY());
25592376739dSArmin Le Grand
25602376739dSArmin Le Grand if(aCropped.isEmpty())
25612376739dSArmin Le Grand {
25622376739dSArmin Le Grand // nothing to return since cropped content is completely empty
25632376739dSArmin Le Grand return;
25642376739dSArmin Le Grand }
25652376739dSArmin Le Grand
25662376739dSArmin Le Grand if(aCurrentForCompare.equal(aCropped))
25672376739dSArmin Le Grand {
25682376739dSArmin Le Grand // no crop at all
25692376739dSArmin Le Grand return;
25702376739dSArmin Le Grand }
25712376739dSArmin Le Grand
25722376739dSArmin Le Grand // back-transform to have values in unit coordinates
25732376739dSArmin Le Grand basegfx::B2DHomMatrix aBackToUnit;
25742376739dSArmin Le Grand aBackToUnit.translate(-aTranslate.getX(), -aTranslate.getY());
25752376739dSArmin Le Grand aBackToUnit.scale(
25762376739dSArmin Le Grand basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : 1.0 / aScale.getX(),
25772376739dSArmin Le Grand basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : 1.0 / aScale.getY());
25782376739dSArmin Le Grand
25792376739dSArmin Le Grand // transform cropped back to unit coordinates
25802376739dSArmin Le Grand aCropped.transform(aBackToUnit);
25812376739dSArmin Le Grand
25822376739dSArmin Le Grand // prepare crop PolyPolygon
25838185c382SArmin Le Grand basegfx::B2DPolygon aGraphicOutlinePolygon(
25842376739dSArmin Le Grand basegfx::tools::createPolygonFromRect(
25852376739dSArmin Le Grand aCropped));
25868185c382SArmin Le Grand basegfx::B2DPolyPolygon aCropPolyPolygon(aGraphicOutlinePolygon);
25872376739dSArmin Le Grand
25882376739dSArmin Le Grand // current range is unit range
25892376739dSArmin Le Grand basegfx::B2DRange aOverlap(0.0, 0.0, 1.0, 1.0);
25902376739dSArmin Le Grand
25912376739dSArmin Le Grand aOverlap.intersect(aCropped);
25922376739dSArmin Le Grand
25932376739dSArmin Le Grand if(!aOverlap.isEmpty())
25942376739dSArmin Le Grand {
25952376739dSArmin Le Grand aCropPolyPolygon.append(
25962376739dSArmin Le Grand basegfx::tools::createPolygonFromRect(
25972376739dSArmin Le Grand aOverlap));
25982376739dSArmin Le Grand }
25992376739dSArmin Le Grand
26002376739dSArmin Le Grand // transform to object coordinates to prepare for clip
26012376739dSArmin Le Grand aCropPolyPolygon.transform(maObjectTransform);
26028185c382SArmin Le Grand aGraphicOutlinePolygon.transform(maObjectTransform);
26032376739dSArmin Le Grand
26042376739dSArmin Le Grand // create cropped transformation
26052376739dSArmin Le Grand basegfx::B2DHomMatrix aCroppedTransform;
2606414a0e15SArmin Le Grand const bool bCombinedMirrorX(bMirroredX);
26072376739dSArmin Le Grand
26082376739dSArmin Le Grand aCroppedTransform.scale(
2609414a0e15SArmin Le Grand aCropped.getWidth(),
2610414a0e15SArmin Le Grand aCropped.getHeight());
26112376739dSArmin Le Grand aCroppedTransform.translate(
2612414a0e15SArmin Le Grand aCropped.getMinX(),
2613414a0e15SArmin Le Grand aCropped.getMinY());
26142376739dSArmin Le Grand aCroppedTransform = maObjectTransform * aCroppedTransform;
26152376739dSArmin Le Grand
261686e1cf34SPedro Giffuni // prepare graphic primitive (transformed)
26172376739dSArmin Le Grand const drawinglayer::primitive2d::Primitive2DReference aGraphic(
26182376739dSArmin Le Grand new drawinglayer::primitive2d::GraphicPrimitive2D(
26192376739dSArmin Le Grand aCroppedTransform,
26202376739dSArmin Le Grand maGraphic));
26212376739dSArmin Le Grand
26228185c382SArmin Le Grand // prepare outline polygon for whole graphic
26238185c382SArmin Le Grand const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
26248185c382SArmin Le Grand const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
26258185c382SArmin Le Grand const drawinglayer::primitive2d::Primitive2DReference aGraphicOutline(
26268185c382SArmin Le Grand new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
26278185c382SArmin Le Grand aGraphicOutlinePolygon,
26288185c382SArmin Le Grand aHilightColor));
26298185c382SArmin Le Grand
26308185c382SArmin Le Grand // combine these
26318185c382SArmin Le Grand drawinglayer::primitive2d::Primitive2DSequence aCombination(2);
26328185c382SArmin Le Grand aCombination[0] = aGraphic;
26338185c382SArmin Le Grand aCombination[1] = aGraphicOutline;
26348185c382SArmin Le Grand
26352376739dSArmin Le Grand // embed to MaskPrimitive2D
26362376739dSArmin Le Grand const drawinglayer::primitive2d::Primitive2DReference aMaskedGraphic(
26372376739dSArmin Le Grand new drawinglayer::primitive2d::MaskPrimitive2D(
26382376739dSArmin Le Grand aCropPolyPolygon,
26398185c382SArmin Le Grand aCombination));
26402376739dSArmin Le Grand
26412376739dSArmin Le Grand // embed to UnifiedTransparencePrimitive2D
26422376739dSArmin Le Grand const drawinglayer::primitive2d::Primitive2DReference aTransparenceMaskedGraphic(
26432376739dSArmin Le Grand new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
26442376739dSArmin Le Grand drawinglayer::primitive2d::Primitive2DSequence(&aMaskedGraphic, 1),
26452376739dSArmin Le Grand 0.8));
26462376739dSArmin Le Grand
26472376739dSArmin Le Grand const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aTransparenceMaskedGraphic, 1);
26482376739dSArmin Le Grand
26492376739dSArmin Le Grand for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
26502376739dSArmin Le Grand {
26512376739dSArmin Le Grand // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
26522376739dSArmin Le Grand const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
26532376739dSArmin Le Grand
26542376739dSArmin Le Grand if(rPageWindow.GetPaintWindow().OutputToWindow())
26552376739dSArmin Le Grand {
26562376739dSArmin Le Grand if(rPageWindow.GetOverlayManager())
26572376739dSArmin Le Grand {
26582376739dSArmin Le Grand ::sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence);
26592376739dSArmin Le Grand DBG_ASSERT(pNew, "Got NO new IAO!");
26602376739dSArmin Le Grand
26612376739dSArmin Le Grand if(pNew)
26622376739dSArmin Le Grand {
26632376739dSArmin Le Grand // only informative object, no hit
26642376739dSArmin Le Grand pNew->setHittable(false);
26652376739dSArmin Le Grand
26662376739dSArmin Le Grand rPageWindow.GetOverlayManager()->add(*pNew);
26672376739dSArmin Le Grand maOverlayGroup.append(*pNew);
26682376739dSArmin Le Grand }
26692376739dSArmin Le Grand }
26702376739dSArmin Le Grand }
26712376739dSArmin Le Grand }
26722376739dSArmin Le Grand }
26732376739dSArmin Le Grand
26744d196ef4Smseidel /* vim: set noet sw=4 ts=4: */
2675