svdhdl.cxx (8185c382) svdhdl.cxx (414a0e15)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 2282 unchanged lines hidden (view full) ---

2291 }
2292 return pRet;
2293}
2294
2295// --------------------------------------------------------------------
2296// SdrCropHdl
2297// --------------------------------------------------------------------
2298
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 2282 unchanged lines hidden (view full) ---

2291 }
2292 return pRet;
2293}
2294
2295// --------------------------------------------------------------------
2296// SdrCropHdl
2297// --------------------------------------------------------------------
2298
2299SdrCropHdl::SdrCropHdl(const Point& rPnt, SdrHdlKind eNewKind)
2300: SdrHdl( rPnt, eNewKind )
2299SdrCropHdl::SdrCropHdl(
2300 const Point& rPnt,
2301 SdrHdlKind eNewKind,
2302 double fShearX,
2303 double fRotation)
2304: SdrHdl(rPnt, eNewKind),
2305 mfShearX(fShearX),
2306 mfRotation(fRotation)
2301{
2302}
2303
2304// --------------------------------------------------------------------
2305
2306BitmapEx SdrCropHdl::GetHandlesBitmap( bool bIsFineHdl, bool bIsHighContrast )
2307{
2308 if( bIsHighContrast )

--- 91 unchanged lines hidden (view full) ---

2400 if(rPageWindow.GetPaintWindow().OutputToWindow())
2401 {
2402 if(rPageWindow.GetOverlayManager())
2403 {
2404 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
2405
2406 ::sdr::overlay::OverlayObject* pOverlayObject = 0L;
2407
2307{
2308}
2309
2310// --------------------------------------------------------------------
2311
2312BitmapEx SdrCropHdl::GetHandlesBitmap( bool bIsFineHdl, bool bIsHighContrast )
2313{
2314 if( bIsHighContrast )

--- 91 unchanged lines hidden (view full) ---

2406 if(rPageWindow.GetPaintWindow().OutputToWindow())
2407 {
2408 if(rPageWindow.GetOverlayManager())
2409 {
2410 basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
2411
2412 ::sdr::overlay::OverlayObject* pOverlayObject = 0L;
2413
2408 // animate focused handles
2409 if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
2410 {
2411 if( nHdlSize >= 2 )
2412 nHdlSize = 1;
2414 // animate focused handles
2415 if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
2416 {
2417 if( nHdlSize >= 2 )
2418 nHdlSize = 1;
2413
2419
2414 BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
2420 BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
2415
2421
2416 const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
2422 const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
2417
2423
2418 pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(aPosition, aBmpEx1, aBmpEx2, nBlinkTime,
2419 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2420 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2421 (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
2422 (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
2423 }
2424 else
2425 {
2426 // create centered handle as default
2427 pOverlayObject = new ::sdr::overlay::OverlayBitmapEx(aPosition, aBmpEx1,
2428 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2429 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1);
2430 }
2424 pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(
2425 aPosition,
2426 aBmpEx1,
2427 aBmpEx2,
2428 nBlinkTime,
2429 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2430 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2431 (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
2432 (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1,
2433 mfShearX,
2434 mfRotation);
2435 }
2436 else
2437 {
2438 // create centered handle as default
2439 pOverlayObject = new ::sdr::overlay::OverlayBitmapEx(
2440 aPosition,
2441 aBmpEx1,
2442 (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
2443 (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
2444 0.0,
2445 mfShearX,
2446 mfRotation);
2447 }
2431
2432 // OVERLAYMANAGER
2433 if(pOverlayObject)
2434 {
2435 rPageWindow.GetOverlayManager()->add(*pOverlayObject);
2436 maOverlayGroup.append(*pOverlayObject);
2437 }
2438 }
2439 }
2440 }
2441 }
2442}
2443
2444////////////////////////////////////////////////////////////////////////////////////////////////////
2448
2449 // OVERLAYMANAGER
2450 if(pOverlayObject)
2451 {
2452 rPageWindow.GetOverlayManager()->add(*pOverlayObject);
2453 maOverlayGroup.append(*pOverlayObject);
2454 }
2455 }
2456 }
2457 }
2458 }
2459}
2460
2461////////////////////////////////////////////////////////////////////////////////////////////////////
2462// with the correction of crop handling I could get rid of the extra mirroring flag, adapted stuff
2463// accordingly
2445
2446SdrCropViewHdl::SdrCropViewHdl(
2447 const basegfx::B2DHomMatrix& rObjectTransform,
2448 const Graphic& rGraphic,
2449 double fCropLeft,
2450 double fCropTop,
2451 double fCropRight,
2464
2465SdrCropViewHdl::SdrCropViewHdl(
2466 const basegfx::B2DHomMatrix& rObjectTransform,
2467 const Graphic& rGraphic,
2468 double fCropLeft,
2469 double fCropTop,
2470 double fCropRight,
2452 double fCropBottom,
2453 bool bExtraMirrorXFromGraphic)
2471 double fCropBottom)
2454: SdrHdl(Point(), HDL_USER),
2455 maObjectTransform(rObjectTransform),
2456 maGraphic(rGraphic),
2457 mfCropLeft(fCropLeft),
2458 mfCropTop(fCropTop),
2459 mfCropRight(fCropRight),
2472: SdrHdl(Point(), HDL_USER),
2473 maObjectTransform(rObjectTransform),
2474 maGraphic(rGraphic),
2475 mfCropLeft(fCropLeft),
2476 mfCropTop(fCropTop),
2477 mfCropRight(fCropRight),
2460 mfCropBottom(fCropBottom),
2461 mbExtraMirrorXFromGraphic(bExtraMirrorXFromGraphic)
2478 mfCropBottom(fCropBottom)
2462{
2463}
2464
2465void SdrCropViewHdl::CreateB2dIAObject()
2466{
2467 GetRidOfIAObject();
2468 SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
2469 SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;

--- 35 unchanged lines hidden (view full) ---

2505 double fCropLeft(mfCropLeft);
2506 double fCropTop(mfCropTop);
2507 double fCropRight(mfCropRight);
2508 double fCropBottom(mfCropBottom);
2509
2510 if(bMirroredX)
2511 {
2512 aScale.setX(-aScale.getX());
2479{
2480}
2481
2482void SdrCropViewHdl::CreateB2dIAObject()
2483{
2484 GetRidOfIAObject();
2485 SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
2486 SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;

--- 35 unchanged lines hidden (view full) ---

2522 double fCropLeft(mfCropLeft);
2523 double fCropTop(mfCropTop);
2524 double fCropRight(mfCropRight);
2525 double fCropBottom(mfCropBottom);
2526
2527 if(bMirroredX)
2528 {
2529 aScale.setX(-aScale.getX());
2513 fCropLeft = mfCropRight;
2514 fCropRight = mfCropLeft;
2515 }
2516
2517 if(bMirroredY)
2518 {
2519 aScale.setY(-aScale.getY());
2530 }
2531
2532 if(bMirroredY)
2533 {
2534 aScale.setY(-aScale.getY());
2520 fCropTop = mfCropBottom;
2521 fCropBottom = mfCropTop;
2522 }
2523
2524 // create target translate and scale
2525 const basegfx::B2DVector aTargetScale(
2526 aScale.getX() + fCropRight + fCropLeft,
2527 aScale.getY() + fCropBottom + fCropTop);
2528 const basegfx::B2DVector aTargetTranslate(
2529 aTranslate.getX() - fCropLeft,

--- 48 unchanged lines hidden (view full) ---

2578 }
2579
2580 // transform to object coordinates to prepare for clip
2581 aCropPolyPolygon.transform(maObjectTransform);
2582 aGraphicOutlinePolygon.transform(maObjectTransform);
2583
2584 // create cropped transformation
2585 basegfx::B2DHomMatrix aCroppedTransform;
2535 }
2536
2537 // create target translate and scale
2538 const basegfx::B2DVector aTargetScale(
2539 aScale.getX() + fCropRight + fCropLeft,
2540 aScale.getY() + fCropBottom + fCropTop);
2541 const basegfx::B2DVector aTargetTranslate(
2542 aTranslate.getX() - fCropLeft,

--- 48 unchanged lines hidden (view full) ---

2591 }
2592
2593 // transform to object coordinates to prepare for clip
2594 aCropPolyPolygon.transform(maObjectTransform);
2595 aGraphicOutlinePolygon.transform(maObjectTransform);
2596
2597 // create cropped transformation
2598 basegfx::B2DHomMatrix aCroppedTransform;
2586 const bool bCombinedMirrorX(mbExtraMirrorXFromGraphic || bMirroredX);
2599 const bool bCombinedMirrorX(bMirroredX);
2587
2588 aCroppedTransform.scale(
2600
2601 aCroppedTransform.scale(
2589 bCombinedMirrorX ? -aCropped.getWidth() : aCropped.getWidth(),
2590 bMirroredY ? -aCropped.getHeight() : aCropped.getHeight());
2602 aCropped.getWidth(),
2603 aCropped.getHeight());
2591 aCroppedTransform.translate(
2604 aCroppedTransform.translate(
2592 bCombinedMirrorX ? aCropped.getMaxX() : aCropped.getMinX(),
2593 bMirroredY ? aCropped.getMaxY() : aCropped.getMinY());
2605 aCropped.getMinX(),
2606 aCropped.getMinY());
2594 aCroppedTransform = maObjectTransform * aCroppedTransform;
2595
2596 // prepare graphic primitive (tranformed)
2597 const drawinglayer::primitive2d::Primitive2DReference aGraphic(
2598 new drawinglayer::primitive2d::GraphicPrimitive2D(
2599 aCroppedTransform,
2600 maGraphic));
2601

--- 54 unchanged lines hidden ---
2607 aCroppedTransform = maObjectTransform * aCroppedTransform;
2608
2609 // prepare graphic primitive (tranformed)
2610 const drawinglayer::primitive2d::Primitive2DReference aGraphic(
2611 new drawinglayer::primitive2d::GraphicPrimitive2D(
2612 aCroppedTransform,
2613 maGraphic));
2614

--- 54 unchanged lines hidden ---