You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ms...@apache.org on 2023/02/28 13:58:39 UTC
[openoffice] 01/02: Update svdhdl.cxx
This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch AOO41X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit ef96bc2447ac3bf50936ce6565c6043048a6c8c6
Author: mseidel <ms...@apache.org>
AuthorDate: Tue Feb 28 14:52:19 2023 +0100
Update svdhdl.cxx
---
main/svx/source/svdraw/svdhdl.cxx | 1455 +++++++++++++++++++------------------
1 file changed, 728 insertions(+), 727 deletions(-)
diff --git a/main/svx/source/svdraw/svdhdl.cxx b/main/svx/source/svdraw/svdhdl.cxx
index 73114443c6..8c85d1e63e 100644
--- a/main/svx/source/svdraw/svdhdl.cxx
+++ b/main/svx/source/svdraw/svdhdl.cxx
@@ -1,5 +1,5 @@
/**************************************************************
- *
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -7,16 +7,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- *
+ *
*************************************************************/
@@ -73,23 +73,23 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
// #i15222#
-// Due to the ressource problems in Win95/98 with bitmap ressources i
-// will change this handle bitmap provinging class. Old version was splitting
+// Due to the resource problems in Win95/98 with bitmap resources I
+// will change this handle bitmap providing class. Old version was splitting
// and preparing all small handle bitmaps in device bitmap format, now this will
-// be done on the fly. Thus, tehre is only the one big bitmap remembered. With
-// three source bitmaps, this will be 3 system bitmap ressources instead of hundreds.
+// be done on the fly. Thus, there is only the one big bitmap remembered. With
+// three source bitmaps, this will be 3 system bitmap resources instead of hundreds.
// The price for that needs to be evaluated. Maybe we will need another change here
// if this is too expensive.
class SdrHdlBitmapSet
{
// the bitmap holding all infos
- BitmapEx maMarkersBitmap;
+ BitmapEx maMarkersBitmap;
- // the cropped Bitmaps for reusage
- ::std::vector< BitmapEx > maRealMarkers;
+ // the cropped Bitmaps for reusage
+ ::std::vector< BitmapEx > maRealMarkers;
- // elpers
- BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle);
+ // elpers
+ BitmapEx& impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle);
public:
SdrHdlBitmapSet(sal_uInt16 nResId);
@@ -99,14 +99,14 @@ public:
};
////////////////////////////////////////////////////////////////////////////////////////////////////
-#define KIND_COUNT (14)
-#define INDEX_COUNT (6)
-#define INDIVIDUAL_COUNT (4)
+#define KIND_COUNT (14)
+#define INDEX_COUNT (6)
+#define INDIVIDUAL_COUNT (4)
SdrHdlBitmapSet::SdrHdlBitmapSet(sal_uInt16 nResId)
-: maMarkersBitmap(ResId(nResId, *ImpGetResMgr())), // just use ressource with alpha channel
- // 14 kinds (BitmapMarkerKind) use index [0..5], 4 extra
- maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT)
+: maMarkersBitmap(ResId(nResId, *ImpGetResMgr())), // just use resource with alpha channel
+ // 14 kinds (BitmapMarkerKind) use index [0..5], 4 extra
+ maRealMarkers((KIND_COUNT * INDEX_COUNT) + INDIVIDUAL_COUNT)
{
}
@@ -116,18 +116,18 @@ SdrHdlBitmapSet::~SdrHdlBitmapSet()
BitmapEx& SdrHdlBitmapSet::impGetOrCreateTargetBitmap(sal_uInt16 nIndex, const Rectangle& rRectangle)
{
- BitmapEx& rTargetBitmap = maRealMarkers[nIndex];
+ BitmapEx& rTargetBitmap = maRealMarkers[nIndex];
- if(rTargetBitmap.IsEmpty())
- {
- rTargetBitmap = maMarkersBitmap;
- rTargetBitmap.Crop(rRectangle);
- }
+ if(rTargetBitmap.IsEmpty())
+ {
+ rTargetBitmap = maMarkersBitmap;
+ rTargetBitmap.Crop(rRectangle);
+ }
- return rTargetBitmap;
+ return rTargetBitmap;
}
-// change getting of bitmap to use the big ressource bitmap
+// change getting of bitmap to use the big resource bitmap
const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd)
{
// fill in size and source position in maMarkersBitmap
@@ -135,194 +135,194 @@ const BitmapEx& SdrHdlBitmapSet::GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal
switch(eKindOfMarker)
{
- default:
+ default:
{
- DBG_ERROR( "unknown kind of marker" );
+ DBG_ERROR( "unknown kind of marker" );
// no break here, return Rect_7x7 as default
}
- case Rect_7x7:
+ case Rect_7x7:
{
- return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, Rectangle(Point(0, nYPos), Size(7, 7)));
+ return impGetOrCreateTargetBitmap((0 * INDEX_COUNT) + nInd, Rectangle(Point(0, nYPos), Size(7, 7)));
}
- case Rect_9x9:
+ case Rect_9x9:
{
return impGetOrCreateTargetBitmap((1 * INDEX_COUNT) + nInd, Rectangle(Point(7, nYPos), Size(9, 9)));
}
- case Rect_11x11:
+ case Rect_11x11:
{
return impGetOrCreateTargetBitmap((2 * INDEX_COUNT) + nInd, Rectangle(Point(16, nYPos), Size(11, 11)));
}
- case Rect_13x13:
+ case Rect_13x13:
{
- const sal_uInt16 nIndex((3 * INDEX_COUNT) + nInd);
+ const sal_uInt16 nIndex((3 * INDEX_COUNT) + nInd);
switch(nInd)
{
- case 0:
- {
- return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 66), Size(13, 13)));
- }
- case 1:
- {
- return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 66), Size(13, 13)));
- }
- case 2:
- {
- return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 79), Size(13, 13)));
- }
- case 3:
- {
- return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 79), Size(13, 13)));
- }
- case 4:
- {
- return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 79), Size(13, 13)));
- }
- default: // case 5:
- {
- return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 66), Size(13, 13)));
- }
+ case 0:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 66), Size(13, 13)));
+ }
+ case 1:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 66), Size(13, 13)));
+ }
+ case 2:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(72, 79), Size(13, 13)));
+ }
+ case 3:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(85, 79), Size(13, 13)));
+ }
+ case 4:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 79), Size(13, 13)));
+ }
+ default: // case 5:
+ {
+ return impGetOrCreateTargetBitmap(nIndex, Rectangle(Point(98, 66), Size(13, 13)));
+ }
}
}
- case Circ_7x7:
+ case Circ_7x7:
case Customshape_7x7:
{
return impGetOrCreateTargetBitmap((4 * INDEX_COUNT) + nInd, Rectangle(Point(27, nYPos), Size(7, 7)));
}
- case Circ_9x9:
+ case Circ_9x9:
case Customshape_9x9:
{
return impGetOrCreateTargetBitmap((5 * INDEX_COUNT) + nInd, Rectangle(Point(34, nYPos), Size(9, 9)));
}
- case Circ_11x11:
+ case Circ_11x11:
case Customshape_11x11:
{
return impGetOrCreateTargetBitmap((6 * INDEX_COUNT) + nInd, Rectangle(Point(43, nYPos), Size(11, 11)));
}
- case Elli_7x9:
+ case Elli_7x9:
{
return impGetOrCreateTargetBitmap((7 * INDEX_COUNT) + nInd, Rectangle(Point(54, nYPos), Size(7, 9)));
}
- case Elli_9x11:
+ case Elli_9x11:
{
return impGetOrCreateTargetBitmap((8 * INDEX_COUNT) + nInd, Rectangle(Point(61, nYPos), Size(9, 11)));
}
- case Elli_9x7:
+ case Elli_9x7:
{
return impGetOrCreateTargetBitmap((9 * INDEX_COUNT) + nInd, Rectangle(Point(70, nYPos), Size(9, 7)));
}
- case Elli_11x9:
+ case Elli_11x9:
{
return impGetOrCreateTargetBitmap((10 * INDEX_COUNT) + nInd, Rectangle(Point(79, nYPos), Size(11, 9)));
}
- case RectPlus_7x7:
+ case RectPlus_7x7:
{
return impGetOrCreateTargetBitmap((11 * INDEX_COUNT) + nInd, Rectangle(Point(90, nYPos), Size(7, 7)));
}
- case RectPlus_9x9:
+ case RectPlus_9x9:
{
return impGetOrCreateTargetBitmap((12 * INDEX_COUNT) + nInd, Rectangle(Point(97, nYPos), Size(9, 9)));
}
- case RectPlus_11x11:
+ case RectPlus_11x11:
{
return impGetOrCreateTargetBitmap((13 * INDEX_COUNT) + nInd, Rectangle(Point(106, nYPos), Size(11, 11)));
}
- case Crosshair:
+ case Crosshair:
{
return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 0, Rectangle(Point(0, 68), Size(15, 15)));
}
- case Glue:
+ case Glue:
{
return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 1, Rectangle(Point(15, 74), Size(9, 9)));
}
case Anchor: // #101688# AnchorTR for SW
- case AnchorTR:
+ case AnchorTR:
{
return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 2, Rectangle(Point(24, 68), Size(24, 24)));
}
- // #98388# add AnchorPressed to be able to aninate anchor control
- case AnchorPressed:
- case AnchorPressedTR:
+ // #98388# add AnchorPressed to be able to animate anchor control
+ case AnchorPressed:
+ case AnchorPressedTR:
{
return impGetOrCreateTargetBitmap((KIND_COUNT * INDEX_COUNT) + 3, Rectangle(Point(48, 68), Size(24, 24)));
}
}
- // cannot happen since all pathes return something; return Rect_7x7 as default (see switch)
- return maRealMarkers[0];
+ // cannot happen since all paths return something; return Rect_7x7 as default (see switch)
+ return maRealMarkers[0];
}
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrHdlBitmapSet& getSimpleSet()
{
- static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aSimpleSet(new SdrHdlBitmapSet(SIP_SA_MARKERS));
- return *aSimpleSet.get();
+ static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aSimpleSet(new SdrHdlBitmapSet(SIP_SA_MARKERS));
+ return *aSimpleSet.get();
}
SdrHdlBitmapSet& getModernSet()
{
- static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS));
- return *aModernSet.get();
+ static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet(new SdrHdlBitmapSet(SIP_SA_FINE_MARKERS));
+ return *aModernSet.get();
}
SdrHdlBitmapSet& getHighContrastSet()
{
- static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS));
- return *aHighContrastSet.get();
+ static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aHighContrastSet(new SdrHdlBitmapSet(SIP_SA_ACCESSIBILITY_MARKERS));
+ return *aHighContrastSet.get();
}
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrHdl::SdrHdl():
- pObj(NULL),
- pPV(NULL),
- pHdlList(NULL),
- eKind(HDL_MOVE),
- nDrehWink(0),
- nObjHdlNum(0),
- nPolyNum(0),
- nPPntNum(0),
- nSourceHdlNum(0),
- bSelect(sal_False),
- b1PixMore(sal_False),
- bPlusHdl(sal_False),
+ pObj(NULL),
+ pPV(NULL),
+ pHdlList(NULL),
+ eKind(HDL_MOVE),
+ nDrehWink(0),
+ nObjHdlNum(0),
+ nPolyNum(0),
+ nPPntNum(0),
+ nSourceHdlNum(0),
+ bSelect(sal_False),
+ b1PixMore(sal_False),
+ bPlusHdl(sal_False),
mbMoveOutside(false),
mbMouseOver(false)
{
}
SdrHdl::SdrHdl(const Point& rPnt, SdrHdlKind eNewKind):
- pObj(NULL),
- pPV(NULL),
- pHdlList(NULL),
- aPos(rPnt),
- eKind(eNewKind),
- nDrehWink(0),
- nObjHdlNum(0),
- nPolyNum(0),
- nPPntNum(0),
- nSourceHdlNum(0),
- bSelect(sal_False),
- b1PixMore(sal_False),
- bPlusHdl(sal_False),
+ pObj(NULL),
+ pPV(NULL),
+ pHdlList(NULL),
+ aPos(rPnt),
+ eKind(eNewKind),
+ nDrehWink(0),
+ nObjHdlNum(0),
+ nPolyNum(0),
+ nPPntNum(0),
+ nSourceHdlNum(0),
+ bSelect(sal_False),
+ b1PixMore(sal_False),
+ bPlusHdl(sal_False),
mbMoveOutside(false),
mbMouseOver(false)
{
@@ -333,33 +333,33 @@ SdrHdl::~SdrHdl()
GetRidOfIAObject();
}
-void SdrHdl::Set1PixMore(sal_Bool bJa)
-{
+void SdrHdl::Set1PixMore(sal_Bool bJa)
+{
if(b1PixMore != bJa)
{
- b1PixMore = bJa;
+ b1PixMore = bJa;
// create new display
Touch();
}
}
-void SdrHdl::SetMoveOutside( bool bMoveOutside )
-{
+void SdrHdl::SetMoveOutside( bool bMoveOutside )
+{
if(mbMoveOutside != bMoveOutside)
{
- mbMoveOutside = bMoveOutside;
+ mbMoveOutside = bMoveOutside;
// create new display
Touch();
}
}
-void SdrHdl::SetDrehWink(long n)
-{
+void SdrHdl::SetDrehWink(long n)
+{
if(nDrehWink != n)
{
- nDrehWink = n;
+ nDrehWink = n;
// create new display
Touch();
@@ -378,37 +378,37 @@ void SdrHdl::SetPos(const Point& rPnt)
}
}
-void SdrHdl::SetSelected(sal_Bool bJa)
-{
+void SdrHdl::SetSelected(sal_Bool bJa)
+{
if(bSelect != bJa)
{
// remember new value
- bSelect = bJa;
+ bSelect = bJa;
// create new display
Touch();
}
}
-void SdrHdl::SetHdlList(SdrHdlList* pList)
+void SdrHdl::SetHdlList(SdrHdlList* pList)
{
if(pHdlList != pList)
{
- // rememver list
+ // remember list
pHdlList = pList;
-
- // now its possible to create graphic representation
+
+ // now it's possible to create graphic representation
Touch();
}
}
-void SdrHdl::SetObj(SdrObject* pNewObj)
-{
+void SdrHdl::SetObj(SdrObject* pNewObj)
+{
if(pObj != pNewObj)
{
// remember new object
- pObj = pNewObj;
-
+ pObj = pNewObj;
+
// graphic representation may have changed
Touch();
}
@@ -438,17 +438,17 @@ void SdrHdl::CreateB2dIAObject()
BitmapColorIndex eColIndex = LightGreen;
BitmapMarkerKind eKindOfMarker = Rect_7x7;
- sal_Bool bRot = pHdlList->IsRotateShear();
- if(pObj)
- eColIndex = (bSelect) ? Cyan : LightCyan;
- if(bRot)
- {
- // Drehhandles in Rot
- if(pObj && bSelect)
+ sal_Bool bRot = pHdlList->IsRotateShear();
+ if(pObj)
+ eColIndex = (bSelect) ? Cyan : LightCyan;
+ if(bRot)
+ {
+ // Rotation handles in red
+ if(pObj && bSelect)
eColIndex = Red;
else
- eColIndex = LightRed;
- }
+ eColIndex = LightRed;
+ }
switch(eKind)
{
@@ -462,7 +462,7 @@ void SdrHdl::CreateB2dIAObject()
case HDL_LWLFT:
case HDL_LWRGT:
{
- // corner handles
+ // Corner handles
if(bRot)
{
eKindOfMarker = Circ_7x7;
@@ -557,8 +557,8 @@ void SdrHdl::CreateB2dIAObject()
eColIndex = Yellow;
break;
}
- default:
- break;
+ default:
+ break;
}
SdrMarkView* pView = pHdlList->GetView();
@@ -574,20 +574,20 @@ void SdrHdl::CreateB2dIAObject()
if(rPageWindow.GetPaintWindow().OutputToWindow())
{
Point aMoveOutsideOffset(0, 0);
-
+
// add offset if necessary
if(pHdlList->IsMoveOutside() || mbMoveOutside)
{
OutputDevice& rOutDev = rPageWindow.GetPaintWindow().GetOutputDevice();
Size aOffset = rOutDev.PixelToLogic(Size(4, 4));
- if(eKind == HDL_UPLFT || eKind == HDL_UPPER || eKind == HDL_UPRGT)
+ if(eKind == HDL_UPLFT || eKind == HDL_UPPER || eKind == HDL_UPRGT)
aMoveOutsideOffset.Y() -= aOffset.Width();
- if(eKind == HDL_LWLFT || eKind == HDL_LOWER || eKind == HDL_LWRGT)
+ if(eKind == HDL_LWLFT || eKind == HDL_LOWER || eKind == HDL_LWRGT)
aMoveOutsideOffset.Y() += aOffset.Height();
- if(eKind == HDL_UPLFT || eKind == HDL_LEFT || eKind == HDL_LWLFT)
+ if(eKind == HDL_UPLFT || eKind == HDL_LEFT || eKind == HDL_LWLFT)
aMoveOutsideOffset.X() -= aOffset.Width();
- if(eKind == HDL_UPRGT || eKind == HDL_RIGHT || eKind == HDL_LWRGT)
+ if(eKind == HDL_UPRGT || eKind == HDL_RIGHT || eKind == HDL_LWRGT)
aMoveOutsideOffset.X() += aOffset.Height();
}
@@ -627,31 +627,31 @@ BitmapMarkerKind SdrHdl::GetNextBigger(BitmapMarkerKind eKnd) const
case Circ_7x7: eRetval = Circ_9x9; break;
case Circ_9x9: eRetval = Circ_11x11; break;
//case Circ_11x11: eRetval = ; break;
-
- case Customshape_7x7: eRetval = Customshape_9x9; break;
- case Customshape_9x9: eRetval = Customshape_11x11; break;
+
+ case Customshape_7x7: eRetval = Customshape_9x9; break;
+ case Customshape_9x9: eRetval = Customshape_11x11; break;
//case Customshape_11x11: eRetval = ; break;
-
+
case Elli_7x9: eRetval = Elli_9x11; break;
//case Elli_9x11: eRetval = ; break;
-
+
case Elli_9x7: eRetval = Elli_11x9; break;
//case Elli_11x9: eRetval = ; break;
-
+
case RectPlus_7x7: eRetval = RectPlus_9x9; break;
case RectPlus_9x9: eRetval = RectPlus_11x11; break;
//case RectPlus_11x11: eRetval = ; break;
-
+
//case Crosshair: eRetval = ; break;
//case Glue: eRetval = ; break;
- // #98388# let anchor blink with it's pressed state
+ // #98388# let anchor blink with its pressed state
case Anchor: eRetval = AnchorPressed; break;
// #101688# same for AnchorTR
case AnchorTR: eRetval = AnchorPressedTR; break;
- default:
- break;
+ default:
+ break;
}
return eRetval;
@@ -678,7 +678,7 @@ BitmapEx SdrHdl::ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd,
}
::sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject(
- const basegfx::B2DPoint& rPos,
+ const basegfx::B2DPoint& rPos,
BitmapColorIndex eColIndex, BitmapMarkerKind eKindOfMarker, Point aMoveOutsideOffset)
{
::sdr::overlay::OverlayObject* pRetval = 0L;
@@ -691,29 +691,29 @@ BitmapEx SdrHdl::ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd,
if(pHdlList->GetHdlSize() > 3)
{
- switch(eKindOfMarker)
- {
- case Anchor:
- case AnchorPressed:
- case AnchorTR:
- case AnchorPressedTR:
- {
- // #121463# For anchor, do not simply make bigger because of HdlSize,
- // do it dependent of IsSelected() which Writer can set in drag mode
- if(IsSelected())
- {
- bForceBiggerSize = sal_True;
- }
- break;
- }
- default:
- {
- bForceBiggerSize = sal_True;
- break;
- }
- }
- }
-
+ switch(eKindOfMarker)
+ {
+ case Anchor:
+ case AnchorPressed:
+ case AnchorTR:
+ case AnchorPressedTR:
+ {
+ // #121463# For anchor, do not simply make bigger because of HdlSize,
+ // do it dependent of IsSelected() which Writer can set in drag mode
+ if(IsSelected())
+ {
+ bForceBiggerSize = sal_True;
+ }
+ break;
+ }
+ default:
+ {
+ bForceBiggerSize = sal_True;
+ break;
+ }
+ }
+ }
+
// #101928# ...for high contrast, too.
if(!bForceBiggerSize && bIsHighContrast)
{
@@ -755,8 +755,8 @@ BitmapEx SdrHdl::ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd,
case Glue:
eNextBigger = Crosshair;
break;
- default:
- break;
+ default:
+ break;
}
}
@@ -784,9 +784,9 @@ BitmapEx SdrHdl::ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd,
{
// create centered handle as default
pRetval = new ::sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime,
- (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
(sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
- (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
(sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1);
}
}
@@ -804,7 +804,7 @@ BitmapEx SdrHdl::ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd,
else if(eKindOfMarker == AnchorTR || eKindOfMarker == AnchorPressedTR)
{
// #101688# AnchorTR for SW, take top right as (0,0)
- pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
+ pRetval = new ::sdr::overlay::OverlayBitmapEx(rPos, aBmpEx,
(sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1), 0);
}
else
@@ -847,72 +847,72 @@ bool SdrHdl::IsHdlHit(const Point& rPnt) const
Pointer SdrHdl::GetPointer() const
{
- PointerStyle ePtr=POINTER_MOVE;
- const sal_Bool bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT;
- const sal_Bool bRot=pHdlList!=NULL && pHdlList->IsRotateShear();
- const sal_Bool bDis=pHdlList!=NULL && pHdlList->IsDistortShear();
- if (bSize && pHdlList!=NULL && (bRot || bDis)) {
- switch (eKind) {
- case HDL_UPLFT: case HDL_UPRGT:
- case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break;
- case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break;
- case HDL_UPPER: case HDL_LOWER: ePtr=POINTER_HSHEAR; break;
- default:
- break;
- }
- } else {
- // Fuer Resize von gedrehten Rechtecken die Mauszeiger etwas mitdrehen
- if (bSize && nDrehWink!=0) {
- long nHdlWink=0;
- switch (eKind) {
- case HDL_LWRGT: nHdlWink=31500; break;
- case HDL_LOWER: nHdlWink=27000; break;
- case HDL_LWLFT: nHdlWink=22500; break;
- case HDL_LEFT : nHdlWink=18000; break;
- case HDL_UPLFT: nHdlWink=13500; break;
- case HDL_UPPER: nHdlWink=9000; break;
- case HDL_UPRGT: nHdlWink=4500; break;
- case HDL_RIGHT: nHdlWink=0; break;
- default:
- break;
- }
- nHdlWink+=nDrehWink+2249; // und etwas drauf (zum runden)
- while (nHdlWink<0) nHdlWink+=36000;
- while (nHdlWink>=36000) nHdlWink-=36000;
- nHdlWink/=4500;
- switch ((sal_uInt8)nHdlWink) {
- case 0: ePtr=POINTER_ESIZE; break;
- case 1: ePtr=POINTER_NESIZE; break;
- case 2: ePtr=POINTER_NSIZE; break;
- case 3: ePtr=POINTER_NWSIZE; break;
- case 4: ePtr=POINTER_WSIZE; break;
- case 5: ePtr=POINTER_SWSIZE; break;
- case 6: ePtr=POINTER_SSIZE; break;
- case 7: ePtr=POINTER_SESIZE; break;
- } // switch
- } else {
- switch (eKind) {
- case HDL_UPLFT: ePtr=POINTER_NWSIZE; break;
- case HDL_UPPER: ePtr=POINTER_NSIZE; break;
- case HDL_UPRGT: ePtr=POINTER_NESIZE; break;
- case HDL_LEFT : ePtr=POINTER_WSIZE; break;
- case HDL_RIGHT: ePtr=POINTER_ESIZE; break;
- case HDL_LWLFT: ePtr=POINTER_SWSIZE; break;
- case HDL_LOWER: ePtr=POINTER_SSIZE; break;
- case HDL_LWRGT: ePtr=POINTER_SESIZE; break;
- case HDL_POLY : ePtr=POINTER_MOVEPOINT; break;
- case HDL_CIRC : ePtr=POINTER_HAND; break;
- case HDL_REF1 : ePtr=POINTER_REFHAND; break;
- case HDL_REF2 : ePtr=POINTER_REFHAND; break;
- case HDL_BWGT : ePtr=POINTER_MOVEBEZIERWEIGHT; break;
- case HDL_GLUE : ePtr=POINTER_MOVEPOINT; break;
- case HDL_CUSTOMSHAPE1 : ePtr=POINTER_HAND; break;
- default:
- break;
- }
- }
- }
- return Pointer(ePtr);
+ PointerStyle ePtr=POINTER_MOVE;
+ const sal_Bool bSize=eKind>=HDL_UPLFT && eKind<=HDL_LWRGT;
+ const sal_Bool bRot=pHdlList!=NULL && pHdlList->IsRotateShear();
+ const sal_Bool bDis=pHdlList!=NULL && pHdlList->IsDistortShear();
+ if (bSize && pHdlList!=NULL && (bRot || bDis)) {
+ switch (eKind) {
+ case HDL_UPLFT: case HDL_UPRGT:
+ case HDL_LWLFT: case HDL_LWRGT: ePtr=bRot ? POINTER_ROTATE : POINTER_REFHAND; break;
+ case HDL_LEFT : case HDL_RIGHT: ePtr=POINTER_VSHEAR; break;
+ case HDL_UPPER: case HDL_LOWER: ePtr=POINTER_HSHEAR; break;
+ default:
+ break;
+ }
+ } else {
+ // Fuer Resize von gedrehten Rechtecken die Mauszeiger etwas mitdrehen
+ if (bSize && nDrehWink!=0) {
+ long nHdlWink=0;
+ switch (eKind) {
+ case HDL_LWRGT: nHdlWink=31500; break;
+ case HDL_LOWER: nHdlWink=27000; break;
+ case HDL_LWLFT: nHdlWink=22500; break;
+ case HDL_LEFT : nHdlWink=18000; break;
+ case HDL_UPLFT: nHdlWink=13500; break;
+ case HDL_UPPER: nHdlWink=9000; break;
+ case HDL_UPRGT: nHdlWink=4500; break;
+ case HDL_RIGHT: nHdlWink=0; break;
+ default:
+ break;
+ }
+ nHdlWink+=nDrehWink+2249; // und etwas drauf (zum runden)
+ while (nHdlWink<0) nHdlWink+=36000;
+ while (nHdlWink>=36000) nHdlWink-=36000;
+ nHdlWink/=4500;
+ switch ((sal_uInt8)nHdlWink) {
+ case 0: ePtr=POINTER_ESIZE; break;
+ case 1: ePtr=POINTER_NESIZE; break;
+ case 2: ePtr=POINTER_NSIZE; break;
+ case 3: ePtr=POINTER_NWSIZE; break;
+ case 4: ePtr=POINTER_WSIZE; break;
+ case 5: ePtr=POINTER_SWSIZE; break;
+ case 6: ePtr=POINTER_SSIZE; break;
+ case 7: ePtr=POINTER_SESIZE; break;
+ } // switch
+ } else {
+ switch (eKind) {
+ case HDL_UPLFT: ePtr=POINTER_NWSIZE; break;
+ case HDL_UPPER: ePtr=POINTER_NSIZE; break;
+ case HDL_UPRGT: ePtr=POINTER_NESIZE; break;
+ case HDL_LEFT : ePtr=POINTER_WSIZE; break;
+ case HDL_RIGHT: ePtr=POINTER_ESIZE; break;
+ case HDL_LWLFT: ePtr=POINTER_SWSIZE; break;
+ case HDL_LOWER: ePtr=POINTER_SSIZE; break;
+ case HDL_LWRGT: ePtr=POINTER_SESIZE; break;
+ case HDL_POLY : ePtr=POINTER_MOVEPOINT; break;
+ case HDL_CIRC : ePtr=POINTER_HAND; break;
+ case HDL_REF1 : ePtr=POINTER_REFHAND; break;
+ case HDL_REF2 : ePtr=POINTER_REFHAND; break;
+ case HDL_BWGT : ePtr=POINTER_MOVEBEZIERWEIGHT; break;
+ case HDL_GLUE : ePtr=POINTER_MOVEPOINT; break;
+ case HDL_CUSTOMSHAPE1 : ePtr=POINTER_HAND; break;
+ default:
+ break;
+ }
+ }
+ }
+ return Pointer(ePtr);
}
// #97016# II
@@ -920,14 +920,14 @@ sal_Bool SdrHdl::IsFocusHdl() const
{
switch(eKind)
{
- case HDL_UPLFT: // Oben links
- case HDL_UPPER: // Oben
- case HDL_UPRGT: // Oben rechts
- case HDL_LEFT: // Links
- case HDL_RIGHT: // Rechts
- case HDL_LWLFT: // Unten links
- case HDL_LOWER: // Unten
- case HDL_LWRGT: // Unten rechts
+ case HDL_UPLFT: // top left
+ case HDL_UPPER: // top
+ case HDL_UPRGT: // top right
+ case HDL_LEFT: // left
+ case HDL_RIGHT: // right
+ case HDL_LWLFT: // bottom left
+ case HDL_LOWER: // bottom
+ case HDL_LWRGT: // bottom right
{
// if it's a activated TextEdit, it's moved to extended points
if(pHdlList && pHdlList->IsMoveOutside())
@@ -950,8 +950,8 @@ sal_Bool SdrHdl::IsFocusHdl() const
//case HDL_ANCHOR: // anchor symbol (SD, SW)
// #101688# same for AnchorTR
//case HDL_ANCHOR_TR: // anchor symbol (SD, SW)
-
- //case HDL_TRNS: // interactive transparence
+
+ //case HDL_TRNS: // interactive transparency
//case HDL_GRAD: // interactive gradient
//case HDL_COLR: // interactive color
@@ -1006,7 +1006,7 @@ void SdrHdlColor::CreateB2dIAObject()
{
// first throw away old one
GetRidOfIAObject();
-
+
if(pHdlList)
{
SdrMarkView* pView = pHdlList->GetView();
@@ -1028,11 +1028,11 @@ void SdrHdlColor::CreateB2dIAObject()
{
Bitmap aBmpCol(CreateColorDropper(aMarkerColor));
basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
- ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
::sdr::overlay::OverlayBitmapEx(
- aPosition,
- BitmapEx(aBmpCol),
- (sal_uInt16)(aBmpCol.GetSizePixel().Width() - 1) >> 1,
+ aPosition,
+ BitmapEx(aBmpCol),
+ (sal_uInt16)(aBmpCol.GetSizePixel().Width() - 1) >> 1,
(sal_uInt16)(aBmpCol.GetSizePixel().Height() - 1) >> 1
);
DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
@@ -1075,19 +1075,19 @@ Bitmap SdrHdlColor::CreateColorDropper(Color aCol)
pWrite->DrawLine(Point(nWidth - 1, 1), Point(nWidth - 1, nHeight - 2));
// draw lighter UpperLeft
- const Color aLightColor(
- (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetRed() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
- (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetGreen() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
- (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetBlue() + (sal_Int16)0x0040), (sal_Int16)0x00ff)));
+ const Color aLightColor(
+ (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetRed() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
+ (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetGreen() + (sal_Int16)0x0040), (sal_Int16)0x00ff)),
+ (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetBlue() + (sal_Int16)0x0040), (sal_Int16)0x00ff)));
pWrite->SetLineColor(aLightColor);
pWrite->DrawLine(Point(1, 1), Point(1, nHeight - 2));
pWrite->DrawLine(Point(2, 1), Point(nWidth - 2, 1));
// draw darker LowerRight
- const Color aDarkColor(
- (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetRed() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
- (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetGreen() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
- (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetBlue() - (sal_Int16)0x0040), (sal_Int16)0x0000)));
+ const Color aDarkColor(
+ (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetRed() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
+ (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetGreen() - (sal_Int16)0x0040), (sal_Int16)0x0000)),
+ (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetBlue() - (sal_Int16)0x0040), (sal_Int16)0x0000)));
pWrite->SetLineColor(aDarkColor);
pWrite->DrawLine(Point(2, nHeight - 2), Point(nWidth - 2, nHeight - 2));
pWrite->DrawLine(Point(nWidth - 2, 2), Point(nWidth - 2, nHeight - 3));
@@ -1149,8 +1149,8 @@ SdrHdlGradient::SdrHdlGradient(const Point& rRef1, const Point& rRef2, sal_Bool
: SdrHdl(rRef1, bGrad ? HDL_GRAD : HDL_TRNS),
pColHdl1(NULL),
pColHdl2(NULL),
- a2ndPos(rRef2),
- bGradient(bGrad)
+ a2ndPos(rRef2),
+ bGradient(bGrad)
{
}
@@ -1174,7 +1174,7 @@ void SdrHdlGradient::CreateB2dIAObject()
{
// first throw away old one
GetRidOfIAObject();
-
+
if(pHdlList)
{
SdrMarkView* pView = pHdlList->GetView();
@@ -1203,36 +1203,36 @@ void SdrHdlGradient::CreateB2dIAObject()
sal_Int32 nMidX = (sal_Int32)(aPos.X() + aVec.getX() * fLongPercentArrow);
sal_Int32 nMidY = (sal_Int32)(aPos.Y() + aVec.getY() * fLongPercentArrow);
Point aMidPoint(nMidX, nMidY);
-
+
basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
basegfx::B2DPoint aMidPos(aMidPoint.X(), aMidPoint.Y());
- ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
::sdr::overlay::OverlayLineStriped(
aPosition, aMidPos
);
DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
-
+
pNewOverlayObject->setBaseColor(IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE));
rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
maOverlayGroup.append(*pNewOverlayObject);
// arrowhead
- Point aLeft(aMidPoint.X() + (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
+ Point aLeft(aMidPoint.X() + (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
aMidPoint.Y() + (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
- Point aRight(aMidPoint.X() - (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
+ Point aRight(aMidPoint.X() - (sal_Int32)(aPerpend.getX() * fHalfArrowWidth),
aMidPoint.Y() - (sal_Int32)(aPerpend.getY() * fHalfArrowWidth));
basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y());
basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y());
basegfx::B2DPoint aPosition2(a2ndPos.X(), a2ndPos.Y());
- pNewOverlayObject = new
+ pNewOverlayObject = new
::sdr::overlay::OverlayTriangle(
- aPositionLeft,
- aPosition2,
- aPositionRight,
- IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)
+ aPositionLeft,
+ aPosition2,
+ aPositionRight,
+ IsGradient() ? Color(COL_BLACK) : Color(COL_BLUE)
);
DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
@@ -1256,7 +1256,7 @@ IMPL_LINK(SdrHdlGradient, ColorChangeHdl, SdrHdl*, /*pHdl*/)
void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, sal_Bool bSetItemOnObject, sal_Bool bUndo)
{
// from IAO positions and colors to gradient
- const SfxItemSet& rSet = _pObj->GetMergedItemSet();
+ const SfxItemSet& rSet = _pObj->GetMergedItemSet();
GradTransformer aGradTransformer;
GradTransGradient aOldGradTransGradient;
@@ -1271,18 +1271,18 @@ void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, sal_Bool bSetItemOnObject,
aGradTransVector.aCol1 = pColHdl1->GetColor();
if(pColHdl2)
aGradTransVector.aCol2 = pColHdl2->GetColor();
-
+
if(IsGradient())
aOldGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
else
aOldGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue();
// transform vector data to gradient
- aGradTransformer.VecToGrad(aGradTransVector, aGradTransGradient, aOldGradTransGradient, _pObj, bMoveSingleHandle, bMoveFirstHandle);
+ aGradTransformer.VecToGrad(aGradTransVector, aGradTransGradient, aOldGradTransGradient, _pObj, bMoveSingleHandle, bMoveFirstHandle);
if(bSetItemOnObject)
{
- SdrModel* pModel = _pObj->GetModel();
+ SdrModel* pModel = _pObj->GetModel();
SfxItemSet aNewSet(pModel->GetItemPool());
if(IsGradient())
@@ -1297,7 +1297,7 @@ void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, sal_Bool bSetItemOnObject,
XFillFloatTransparenceItem aNewTransItem(aString, aGradTransGradient.aGradient);
aNewSet.Put(aNewTransItem);
}
-
+
if(bUndo && pModel->IsUndoEnabled())
{
pModel->BegUndo(SVX_RESSTR(IsGradient() ? SIP_XA_FILLGRADIENT : SIP_XA_FILLTRANSPARENCE));
@@ -1309,7 +1309,7 @@ void SdrHdlGradient::FromIAOToItem(SdrObject* _pObj, sal_Bool bSetItemOnObject,
}
// back transformation, set values on pIAOHandle
- aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, _pObj);
+ aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, _pObj);
SetPos(Point(FRound(aGradTransVector.maPositionA.getX()), FRound(aGradTransVector.maPositionA.getY())));
Set2ndPos(Point(FRound(aGradTransVector.maPositionB.getX()), FRound(aGradTransVector.maPositionB.getY())));
@@ -1355,9 +1355,9 @@ void SdrHdlLine::CreateB2dIAObject()
basegfx::B2DPoint aPosition1(pHdl1->GetPos().X(), pHdl1->GetPos().Y());
basegfx::B2DPoint aPosition2(pHdl2->GetPos().X(), pHdl2->GetPos().Y());
- ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
::sdr::overlay::OverlayLineStriped(
- aPosition1,
+ aPosition1,
aPosition2
);
DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
@@ -1381,7 +1381,7 @@ void SdrHdlLine::CreateB2dIAObject()
Pointer SdrHdlLine::GetPointer() const
{
- return Pointer(POINTER_REFHAND);
+ return Pointer(POINTER_REFHAND);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1417,9 +1417,9 @@ void SdrHdlBezWgt::CreateB2dIAObject()
if(!aPosition1.equal(aPosition2))
{
- ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
::sdr::overlay::OverlayLineStriped(
- aPosition1,
+ aPosition1,
aPosition2
);
DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
@@ -1473,16 +1473,16 @@ void E3dVolumeMarker::CreateB2dIAObject()
{
if(rPageWindow.GetOverlayManager() && aWireframePoly.count())
{
- ::sdr::overlay::OverlayObject* pNewOverlayObject = new
+ ::sdr::overlay::OverlayObject* pNewOverlayObject = new
::sdr::overlay::OverlayPolyPolygonStripedAndFilled(
- aWireframePoly);
+ aWireframePoly);
DBG_ASSERT(pNewOverlayObject, "Got NO new IAO!");
// OVERLAYMANAGER
if(pNewOverlayObject)
{
pNewOverlayObject->setBaseColor(Color(COL_BLACK));
-
+
rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
maOverlayGroup.append(*pNewOverlayObject);
}
@@ -1502,7 +1502,7 @@ ImpEdgeHdl::~ImpEdgeHdl()
void ImpEdgeHdl::CreateB2dIAObject()
{
- if(nObjHdlNum <= 1 && pObj)
+ if(nObjHdlNum <= 1 && pObj)
{
// first throw away old one
GetRidOfIAObject();
@@ -1518,10 +1518,10 @@ void ImpEdgeHdl::CreateB2dIAObject()
{
const SdrEdgeObj* pEdge = (SdrEdgeObj*)pObj;
- if(pEdge->GetConnectedNode(nObjHdlNum == 0) != NULL)
+ if(pEdge->GetConnectedNode(nObjHdlNum == 0) != NULL)
eColIndex = LightRed;
- if(nPPntNum < 2)
+ if(nPPntNum < 2)
{
// Handle with plus sign inside
eKindOfMarker = Circ_7x7;
@@ -1542,7 +1542,7 @@ void ImpEdgeHdl::CreateB2dIAObject()
basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
- aPosition,
+ aPosition,
eColIndex,
eKindOfMarker);
@@ -1567,11 +1567,11 @@ void ImpEdgeHdl::CreateB2dIAObject()
}
void ImpEdgeHdl::SetLineCode(SdrEdgeLineCode eCode)
-{
+{
if(eLineCode != eCode)
{
// remember new value
- eLineCode = eCode;
+ eLineCode = eCode;
// create new display
Touch();
@@ -1580,41 +1580,41 @@ void ImpEdgeHdl::SetLineCode(SdrEdgeLineCode eCode)
Pointer ImpEdgeHdl::GetPointer() const
{
- SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
- if (pEdge==NULL)
+ SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
+ if (pEdge==NULL)
return SdrHdl::GetPointer();
- if (nObjHdlNum<=1)
+ if (nObjHdlNum<=1)
return Pointer(POINTER_MOVEPOINT); //Pointer(POINTER_DRAW_CONNECT);
- if (IsHorzDrag())
+ if (IsHorzDrag())
return Pointer(POINTER_ESIZE);
- else
+ else
return Pointer(POINTER_SSIZE);
}
sal_Bool ImpEdgeHdl::IsHorzDrag() const
{
- SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
- if (pEdge==NULL)
+ SdrEdgeObj* pEdge=PTR_CAST(SdrEdgeObj,pObj);
+ if (pEdge==NULL)
return sal_False;
- if (nObjHdlNum<=1)
+ if (nObjHdlNum<=1)
return sal_False;
-
+
SdrEdgeKind eEdgeKind = ((SdrEdgeKindItem&)(pEdge->GetObjectItem(SDRATTR_EDGEKIND))).GetValue();
-
+
const SdrEdgeInfoRec& rInfo=pEdge->aEdgeInfo;
- if (eEdgeKind==SDREDGE_ORTHOLINES || eEdgeKind==SDREDGE_BEZIER)
+ if (eEdgeKind==SDREDGE_ORTHOLINES || eEdgeKind==SDREDGE_BEZIER)
{
- return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
- }
- else if (eEdgeKind==SDREDGE_THREELINES)
+ return !rInfo.ImpIsHorzLine(eLineCode,*pEdge->pEdgeTrack);
+ }
+ else if (eEdgeKind==SDREDGE_THREELINES)
{
- long nWink=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
- if (nWink==0 || nWink==18000)
+ long nWink=nObjHdlNum==2 ? rInfo.nAngle1 : rInfo.nAngle2;
+ if (nWink==0 || nWink==18000)
return sal_True;
- else
+ else
return sal_False;
- }
- return sal_False;
+ }
+ return sal_False;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1642,7 +1642,7 @@ void ImpMeasureHdl::CreateB2dIAObject()
eKindOfMarker = Rect_7x7;
}
- if(bSelect)
+ if(bSelect)
{
eColIndex = Cyan;
}
@@ -1662,7 +1662,7 @@ void ImpMeasureHdl::CreateB2dIAObject()
basegfx::B2DPoint aPosition(aPos.X(), aPos.Y());
::sdr::overlay::OverlayObject* pNewOverlayObject = CreateOverlayObject(
- aPosition,
+ aPosition,
eColIndex,
eKindOfMarker);
@@ -1682,20 +1682,20 @@ void ImpMeasureHdl::CreateB2dIAObject()
Pointer ImpMeasureHdl::GetPointer() const
{
- switch (nObjHdlNum)
+ switch (nObjHdlNum)
{
- case 0: case 1: return Pointer(POINTER_HAND);
- case 2: case 3: return Pointer(POINTER_MOVEPOINT);
- case 4: case 5: return SdrHdl::GetPointer(); // wird dann entsprechend gedreht
- } // switch
- return Pointer(POINTER_NOTALLOWED);
+ case 0: case 1: return Pointer(POINTER_HAND);
+ case 2: case 3: return Pointer(POINTER_MOVEPOINT);
+ case 4: case 5: return SdrHdl::GetPointer(); // will be rotated accordingly
+ } // switch
+ return Pointer(POINTER_NOTALLOWED);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
-ImpTextframeHdl::ImpTextframeHdl(const Rectangle& rRect) :
- SdrHdl(rRect.TopLeft(),HDL_MOVE),
- maRect(rRect)
+ImpTextframeHdl::ImpTextframeHdl(const Rectangle& rRect) :
+ SdrHdl(rRect.TopLeft(),HDL_MOVE),
+ maRect(rRect)
{
}
@@ -1722,35 +1722,35 @@ void ImpTextframeHdl::CreateB2dIAObject()
{
if(rPageWindow.GetOverlayManager())
{
- const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
- const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
- const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
-
- ::sdr::overlay::OverlayRectangle* pNewOverlayObject = new ::sdr::overlay::OverlayRectangle(
- aTopLeft,
- aBottomRight,
- aHilightColor,
- fTransparence,
- 3.0,
- 3.0,
- nDrehWink * -F_PI18000,
- 500,
- true); // allow animation; the Handle is not shown at text edit time
-
- pNewOverlayObject->setHittable(false);
-
- // OVERLAYMANAGER
- if(pNewOverlayObject)
- {
- rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
- maOverlayGroup.append(*pNewOverlayObject);
- }
- }
- }
- }
- }
+ const basegfx::B2DPoint aTopLeft(maRect.Left(), maRect.Top());
+ const basegfx::B2DPoint aBottomRight(maRect.Right(), maRect.Bottom());
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
+ const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
+
+ ::sdr::overlay::OverlayRectangle* pNewOverlayObject = new ::sdr::overlay::OverlayRectangle(
+ aTopLeft,
+ aBottomRight,
+ aHilightColor,
+ fTransparence,
+ 3.0,
+ 3.0,
+ nDrehWink * -F_PI18000,
+ 500,
+ true); // allow animation; the Handle is not shown at text edit time
+
+ pNewOverlayObject->setHittable(false);
+
+ // OVERLAYMANAGER
+ if(pNewOverlayObject)
+ {
+ rPageWindow.GetOverlayManager()->add(*pNewOverlayObject);
+ maOverlayGroup.append(*pNewOverlayObject);
+ }
+ }
+ }
+ }
+ }
}
}
}
@@ -1759,71 +1759,71 @@ void ImpTextframeHdl::CreateB2dIAObject()
class ImpSdrHdlListSorter: public ContainerSorter {
public:
- ImpSdrHdlListSorter(Container& rNewCont): ContainerSorter(rNewCont) {}
- virtual int Compare(const void* pElem1, const void* pElem2) const;
+ ImpSdrHdlListSorter(Container& rNewCont): ContainerSorter(rNewCont) {}
+ virtual int Compare(const void* pElem1, const void* pElem2) const;
};
int ImpSdrHdlListSorter::Compare(const void* pElem1, const void* pElem2) const
{
- SdrHdlKind eKind1=((SdrHdl*)pElem1)->GetKind();
- SdrHdlKind eKind2=((SdrHdl*)pElem2)->GetKind();
- // Level 1: Erst normale Handles, dann Glue, dann User, dann Plushandles, dann Retpunkt-Handles
- unsigned n1=1;
- unsigned n2=1;
- if (eKind1!=eKind2)
+ SdrHdlKind eKind1=((SdrHdl*)pElem1)->GetKind();
+ SdrHdlKind eKind2=((SdrHdl*)pElem2)->GetKind();
+ // Level 1: Erst normale Handles, dann Glue, dann User, dann Plushandles, dann Retpunkt-Handles
+ unsigned n1=1;
+ unsigned n2=1;
+ if (eKind1!=eKind2)
{
- if (eKind1==HDL_REF1 || eKind1==HDL_REF2 || eKind1==HDL_MIRX) n1=5;
- else if (eKind1==HDL_GLUE) n1=2;
- else if (eKind1==HDL_USER) n1=3;
+ if (eKind1==HDL_REF1 || eKind1==HDL_REF2 || eKind1==HDL_MIRX) n1=5;
+ else if (eKind1==HDL_GLUE) n1=2;
+ else if (eKind1==HDL_USER) n1=3;
else if (eKind1==HDL_SMARTTAG) n1=0;
- if (eKind2==HDL_REF1 || eKind2==HDL_REF2 || eKind2==HDL_MIRX) n2=5;
- else if (eKind2==HDL_GLUE) n2=2;
- else if (eKind2==HDL_USER) n2=3;
+ if (eKind2==HDL_REF1 || eKind2==HDL_REF2 || eKind2==HDL_MIRX) n2=5;
+ else if (eKind2==HDL_GLUE) n2=2;
+ else if (eKind2==HDL_USER) n2=3;
else if (eKind2==HDL_SMARTTAG) n2=0;
- }
- if (((SdrHdl*)pElem1)->IsPlusHdl()) n1=4;
- if (((SdrHdl*)pElem2)->IsPlusHdl()) n2=4;
- if (n1==n2)
- {
- // Level 2: PageView (Pointer)
- SdrPageView* pPV1=((SdrHdl*)pElem1)->GetPageView();
- SdrPageView* pPV2=((SdrHdl*)pElem2)->GetPageView();
- if (pPV1==pPV2)
- {
- // Level 3: Position (x+y)
- SdrObject* pObj1=((SdrHdl*)pElem1)->GetObj();
- SdrObject* pObj2=((SdrHdl*)pElem2)->GetObj();
- if (pObj1==pObj2)
+ }
+ if (((SdrHdl*)pElem1)->IsPlusHdl()) n1=4;
+ if (((SdrHdl*)pElem2)->IsPlusHdl()) n2=4;
+ if (n1==n2)
+ {
+ // Level 2: PageView (Pointer)
+ SdrPageView* pPV1=((SdrHdl*)pElem1)->GetPageView();
+ SdrPageView* pPV2=((SdrHdl*)pElem2)->GetPageView();
+ if (pPV1==pPV2)
+ {
+ // Level 3: Position (x+y)
+ SdrObject* pObj1=((SdrHdl*)pElem1)->GetObj();
+ SdrObject* pObj2=((SdrHdl*)pElem2)->GetObj();
+ if (pObj1==pObj2)
{
- sal_uInt32 nNum1=((SdrHdl*)pElem1)->GetObjHdlNum();
- sal_uInt32 nNum2=((SdrHdl*)pElem2)->GetObjHdlNum();
- if (nNum1==nNum2)
+ sal_uInt32 nNum1=((SdrHdl*)pElem1)->GetObjHdlNum();
+ sal_uInt32 nNum2=((SdrHdl*)pElem2)->GetObjHdlNum();
+ if (nNum1==nNum2)
{ // #48763#
- if (eKind1==eKind2)
- return (long)pElem1<(long)pElem2 ? -1 : 1; // Notloesung, um immer die gleiche Sortierung zu haben
- return (sal_uInt16)eKind1<(sal_uInt16)eKind2 ? -1 : 1;
- }
- else
+ if (eKind1==eKind2)
+ return (long)pElem1<(long)pElem2 ? -1 : 1; // Notloesung, um immer die gleiche Sortierung zu haben
+ return (sal_uInt16)eKind1<(sal_uInt16)eKind2 ? -1 : 1;
+ }
+ else
return nNum1<nNum2 ? -1 : 1;
- }
- else
+ }
+ else
{
- return (long)pObj1<(long)pObj2 ? -1 : 1;
- }
- }
- else
+ return (long)pObj1<(long)pObj2 ? -1 : 1;
+ }
+ }
+ else
{
- return (long)pPV1<(long)pPV2 ? -1 : 1;
- }
- }
- else
+ return (long)pPV1<(long)pPV2 ? -1 : 1;
+ }
+ }
+ else
{
- return n1<n2 ? -1 : 1;
- }
+ return n1<n2 ? -1 : 1;
+ }
}
-SdrMarkView* SdrHdlList::GetView() const
-{
+SdrMarkView* SdrHdlList::GetView() const
+{
return pView;
}
@@ -1925,7 +1925,7 @@ void SdrHdlList::TravelFocusHdl(sal_Bool bForward)
const sal_uIntPtr nOldHdlNum(mnFocusIndex);
SdrHdl* pOld = GetHdl(nOldHdlNum);
//SDOsal_Bool bRefresh(sal_False);
-
+
if(pOld)
{
// switch off old handle
@@ -2107,31 +2107,31 @@ void SdrHdlList::ResetFocusHdl()
////////////////////////////////////////////////////////////////////////////////////////////////////
SdrHdlList::SdrHdlList(SdrMarkView* pV)
-: mnFocusIndex(CONTAINER_ENTRY_NOTFOUND),
+: mnFocusIndex(CONTAINER_ENTRY_NOTFOUND),
pView(pV),
aList(1024,32,32)
-{
- nHdlSize = 3;
- bRotateShear = sal_False;
- bMoveOutside = sal_False;
- bDistortShear = sal_False;
- bFineHandles = sal_True; // new default: Handles are fine handles
+{
+ nHdlSize = 3;
+ bRotateShear = sal_False;
+ bMoveOutside = sal_False;
+ bDistortShear = sal_False;
+ bFineHandles = sal_True; // new default: Handles are fine handles
}
-SdrHdlList::~SdrHdlList()
-{
- Clear();
+SdrHdlList::~SdrHdlList()
+{
+ Clear();
}
void SdrHdlList::SetHdlSize(sal_uInt16 nSiz)
-{
+{
if(nHdlSize != nSiz)
{
// remember new value
- nHdlSize = nSiz;
+ nHdlSize = nSiz;
// propagate change to IAOs
- for(sal_uInt32 i=0; i<GetHdlCount(); i++)
+ for(sal_uInt32 i=0; i<GetHdlCount(); i++)
{
SdrHdl* pHdl = GetHdl(i);
pHdl->Touch();
@@ -2139,15 +2139,15 @@ void SdrHdlList::SetHdlSize(sal_uInt16 nSiz)
}
}
-void SdrHdlList::SetMoveOutside(sal_Bool bOn)
-{
+void SdrHdlList::SetMoveOutside(sal_Bool bOn)
+{
if(bMoveOutside != bOn)
{
// remember new value
- bMoveOutside = bOn;
+ bMoveOutside = bOn;
// propagate change to IAOs
- for(sal_uInt32 i=0; i<GetHdlCount(); i++)
+ for(sal_uInt32 i=0; i<GetHdlCount(); i++)
{
SdrHdl* pHdl = GetHdl(i);
pHdl->Touch();
@@ -2155,25 +2155,25 @@ void SdrHdlList::SetMoveOutside(sal_Bool bOn)
}
}
-void SdrHdlList::SetRotateShear(sal_Bool bOn)
-{
- bRotateShear = bOn;
+void SdrHdlList::SetRotateShear(sal_Bool bOn)
+{
+ bRotateShear = bOn;
}
-void SdrHdlList::SetDistortShear(sal_Bool bOn)
-{
- bDistortShear = bOn;
+void SdrHdlList::SetDistortShear(sal_Bool bOn)
+{
+ bDistortShear = bOn;
}
-void SdrHdlList::SetFineHdl(sal_Bool bOn)
-{
+void SdrHdlList::SetFineHdl(sal_Bool bOn)
+{
if(bFineHandles != bOn)
{
// remember new state
- bFineHandles = bOn;
+ bFineHandles = bOn;
// propagate change to IAOs
- for(sal_uInt32 i=0; i<GetHdlCount(); i++)
+ for(sal_uInt32 i=0; i<GetHdlCount(); i++)
{
SdrHdl* pHdl = GetHdl(i);
pHdl->Touch();
@@ -2181,8 +2181,8 @@ void SdrHdlList::SetFineHdl(sal_Bool bOn)
}
}
-SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum)
-{
+SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum)
+{
SdrHdl* pRetval = (SdrHdl*)aList.Remove(nNum);
return pRetval;
@@ -2190,7 +2190,7 @@ SdrHdl* SdrHdlList::RemoveHdl(sal_uIntPtr nNum)
void SdrHdlList::Clear()
{
- for (sal_uIntPtr i=0; i<GetHdlCount(); i++)
+ for (sal_uIntPtr i=0; i<GetHdlCount(); i++)
{
SdrHdl* pHdl=GetHdl(i);
delete pHdl;
@@ -2206,8 +2206,8 @@ void SdrHdlList::Sort()
// #97016# II: remember current focused handle
SdrHdl* pPrev = GetFocusHdl();
- ImpSdrHdlListSorter aSort(aList);
- aSort.DoSort();
+ ImpSdrHdlListSorter aSort(aList);
+ aSort.DoSort();
// #97016# II: get now and compare
SdrHdl* pNow = GetFocusHdl();
@@ -2232,64 +2232,64 @@ void SdrHdlList::Sort()
sal_uIntPtr SdrHdlList::GetHdlNum(const SdrHdl* pHdl) const
{
- if (pHdl==NULL)
+ if (pHdl==NULL)
return CONTAINER_ENTRY_NOTFOUND;
- sal_uIntPtr nPos=aList.GetPos(pHdl);
- return nPos;
+ sal_uIntPtr nPos=aList.GetPos(pHdl);
+ return nPos;
}
void SdrHdlList::AddHdl(SdrHdl* pHdl, sal_Bool bAtBegin)
{
- if (pHdl!=NULL)
+ if (pHdl!=NULL)
{
- if (bAtBegin)
+ if (bAtBegin)
{
- aList.Insert(pHdl,sal_uIntPtr(0));
- }
- else
+ aList.Insert(pHdl,sal_uIntPtr(0));
+ }
+ else
{
- aList.Insert(pHdl,CONTAINER_APPEND);
- }
- pHdl->SetHdlList(this);
- }
+ aList.Insert(pHdl,CONTAINER_APPEND);
+ }
+ pHdl->SetHdlList(this);
+ }
}
SdrHdl* SdrHdlList::IsHdlListHit(const Point& rPnt, sal_Bool bBack, sal_Bool bNext, SdrHdl* pHdl0) const
{
- SdrHdl* pRet=NULL;
- sal_uIntPtr nAnz=GetHdlCount();
- sal_uIntPtr nNum=bBack ? 0 : nAnz;
- while ((bBack ? nNum<nAnz : nNum>0) && pRet==NULL)
- {
- if (!bBack)
- nNum--;
- SdrHdl* pHdl=GetHdl(nNum);
- if (bNext)
- {
- if (pHdl==pHdl0)
- bNext=sal_False;
- }
- else
- {
- if (pHdl->IsHdlHit(rPnt))
- pRet=pHdl;
- }
- if (bBack)
- nNum++;
- }
- return pRet;
+ SdrHdl* pRet=NULL;
+ sal_uIntPtr nAnz=GetHdlCount();
+ sal_uIntPtr nNum=bBack ? 0 : nAnz;
+ while ((bBack ? nNum<nAnz : nNum>0) && pRet==NULL)
+ {
+ if (!bBack)
+ nNum--;
+ SdrHdl* pHdl=GetHdl(nNum);
+ if (bNext)
+ {
+ if (pHdl==pHdl0)
+ bNext=sal_False;
+ }
+ else
+ {
+ if (pHdl->IsHdlHit(rPnt))
+ pRet=pHdl;
+ }
+ if (bBack)
+ nNum++;
+ }
+ return pRet;
}
SdrHdl* SdrHdlList::GetHdl(SdrHdlKind eKind1) const
{
- SdrHdl* pRet=NULL;
- for (sal_uIntPtr i=0; i<GetHdlCount() && pRet==NULL; i++)
- {
- SdrHdl* pHdl=GetHdl(i);
- if (pHdl->GetKind()==eKind1)
- pRet=pHdl;
- }
- return pRet;
+ SdrHdl* pRet=NULL;
+ for (sal_uIntPtr i=0; i<GetHdlCount() && pRet==NULL; i++)
+ {
+ SdrHdl* pHdl=GetHdl(i);
+ if (pHdl->GetKind()==eKind1)
+ pRet=pHdl;
+ }
+ return pRet;
}
// --------------------------------------------------------------------
@@ -2297,13 +2297,13 @@ SdrHdl* SdrHdlList::GetHdl(SdrHdlKind eKind1) const
// --------------------------------------------------------------------
SdrCropHdl::SdrCropHdl(
- const Point& rPnt,
- SdrHdlKind eNewKind,
- double fShearX,
- double fRotation)
-: SdrHdl(rPnt, eNewKind),
- mfShearX(fShearX),
- mfRotation(fRotation)
+ const Point& rPnt,
+ SdrHdlKind eNewKind,
+ double fShearX,
+ double fRotation)
+: SdrHdl(rPnt, eNewKind),
+ mfShearX(fShearX),
+ mfRotation(fRotation)
{
}
@@ -2369,11 +2369,11 @@ BitmapEx SdrCropHdl::GetBitmapForHandle( const BitmapEx& rBitmap, int nSize )
default: break;
}
- Rectangle aSourceRect( Point( nX * (nPixelSize-1) + nOffset, nY * (nPixelSize-1)), Size(nPixelSize, nPixelSize) );
+ Rectangle aSourceRect( Point( nX * (nPixelSize-1) + nOffset, nY * (nPixelSize-1)), Size(nPixelSize, nPixelSize) );
BitmapEx aRetval(rBitmap);
aRetval.Crop(aSourceRect);
- return aRetval;
+ return aRetval;
}
// --------------------------------------------------------------------
@@ -2411,40 +2411,40 @@ void SdrCropHdl::CreateB2dIAObject()
::sdr::overlay::OverlayObject* pOverlayObject = 0L;
- // animate focused handles
- if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
- {
- if( nHdlSize >= 2 )
- nHdlSize = 1;
-
- BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
-
- const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
-
- pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(
- aPosition,
- aBmpEx1,
- aBmpEx2,
- nBlinkTime,
- (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
- (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
- (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
- (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1,
- mfShearX,
- mfRotation);
- }
- else
- {
- // create centered handle as default
- pOverlayObject = new ::sdr::overlay::OverlayBitmapEx(
- aPosition,
- aBmpEx1,
- (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
- (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
- 0.0,
- mfShearX,
- mfRotation);
- }
+ // animate focused handles
+ if(IsFocusHdl() && (pHdlList->GetFocusHdl() == this))
+ {
+ if( nHdlSize >= 2 )
+ nHdlSize = 1;
+
+ BitmapEx aBmpEx2( GetBitmapForHandle( aHandlesBitmap, nHdlSize + 1 ) );
+
+ const sal_uInt32 nBlinkTime = sal::static_int_cast<sal_uInt32>(rStyleSettings.GetCursorBlinkTime());
+
+ pOverlayObject = new ::sdr::overlay::OverlayAnimatedBitmapEx(
+ aPosition,
+ aBmpEx1,
+ aBmpEx2,
+ nBlinkTime,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
+ (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1,
+ mfShearX,
+ mfRotation);
+ }
+ else
+ {
+ // create centered handle as default
+ pOverlayObject = new ::sdr::overlay::OverlayBitmapEx(
+ aPosition,
+ aBmpEx1,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1,
+ (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1,
+ 0.0,
+ mfShearX,
+ mfRotation);
+ }
// OVERLAYMANAGER
if(pOverlayObject)
@@ -2463,206 +2463,207 @@ void SdrCropHdl::CreateB2dIAObject()
// accordingly
SdrCropViewHdl::SdrCropViewHdl(
- const basegfx::B2DHomMatrix& rObjectTransform,
- const Graphic& rGraphic,
- double fCropLeft,
- double fCropTop,
- double fCropRight,
- double fCropBottom)
-: SdrHdl(Point(), HDL_USER),
- maObjectTransform(rObjectTransform),
- maGraphic(rGraphic),
- mfCropLeft(fCropLeft),
- mfCropTop(fCropTop),
- mfCropRight(fCropRight),
- mfCropBottom(fCropBottom)
+ const basegfx::B2DHomMatrix& rObjectTransform,
+ const Graphic& rGraphic,
+ double fCropLeft,
+ double fCropTop,
+ double fCropRight,
+ double fCropBottom)
+: SdrHdl(Point(), HDL_USER),
+ maObjectTransform(rObjectTransform),
+ maGraphic(rGraphic),
+ mfCropLeft(fCropLeft),
+ mfCropTop(fCropTop),
+ mfCropRight(fCropRight),
+ mfCropBottom(fCropBottom)
{
}
void SdrCropViewHdl::CreateB2dIAObject()
{
- GetRidOfIAObject();
- SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
- SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
-
- if(pPageView && pView->areMarkHandlesHidden())
- {
- return;
- }
-
- // decompose to have current translate and scale
- basegfx::B2DVector aScale, aTranslate;
- double fRotate, fShearX;
-
- maObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX);
-
- if(aScale.equalZero())
- {
- return;
- }
-
- // detect 180 degree rotation, this is the same as mirrored in X and Y,
- // thus change to mirroring. Prefer mirroring here. Use the equal call
- // with getSmallValue here, the original which uses rtl::math::approxEqual
- // is too correct here. Maybe this changes with enhanced precision in aw080
- // to the better so that this can be reduced to the more precise call again
- if(basegfx::fTools::equal(fabs(fRotate), F_PI, 0.000000001))
- {
- aScale.setX(aScale.getX() * -1.0);
- aScale.setY(aScale.getY() * -1.0);
- fRotate = 0.0;
- }
-
- // remember mirroring, reset at Scale and adapt crop values for usage;
- // mirroring can stay in the object transformation, so do not have to
- // cope with it here (except later for the CroppedImage transformation,
- // see below)
- const bool bMirroredX(aScale.getX() < 0.0);
- const bool bMirroredY(aScale.getY() < 0.0);
- double fCropLeft(mfCropLeft);
- double fCropTop(mfCropTop);
- double fCropRight(mfCropRight);
- double fCropBottom(mfCropBottom);
-
- if(bMirroredX)
- {
- aScale.setX(-aScale.getX());
- }
-
- if(bMirroredY)
- {
- aScale.setY(-aScale.getY());
- }
-
- // create target translate and scale
- const basegfx::B2DVector aTargetScale(
- aScale.getX() + fCropRight + fCropLeft,
- aScale.getY() + fCropBottom + fCropTop);
- const basegfx::B2DVector aTargetTranslate(
- aTranslate.getX() - fCropLeft,
- aTranslate.getY() - fCropTop);
-
- // create ranges to make comparisons
- const basegfx::B2DRange aCurrentForCompare(
- aTranslate.getX(), aTranslate.getY(),
- aTranslate.getX() + aScale.getX(), aTranslate.getY() + aScale.getY());
- basegfx::B2DRange aCropped(
- aTargetTranslate.getX(), aTargetTranslate.getY(),
- aTargetTranslate.getX() + aTargetScale.getX(), aTargetTranslate.getY() + aTargetScale.getY());
-
- if(aCropped.isEmpty())
- {
- // nothing to return since cropped content is completely empty
- return;
- }
-
- if(aCurrentForCompare.equal(aCropped))
- {
- // no crop at all
- return;
- }
-
- // back-transform to have values in unit coordinates
- basegfx::B2DHomMatrix aBackToUnit;
- aBackToUnit.translate(-aTranslate.getX(), -aTranslate.getY());
- aBackToUnit.scale(
- basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : 1.0 / aScale.getX(),
- basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : 1.0 / aScale.getY());
-
- // transform cropped back to unit coordinates
- aCropped.transform(aBackToUnit);
-
- // prepare crop PolyPolygon
- basegfx::B2DPolygon aGraphicOutlinePolygon(
- basegfx::tools::createPolygonFromRect(
- aCropped));
- basegfx::B2DPolyPolygon aCropPolyPolygon(aGraphicOutlinePolygon);
-
- // current range is unit range
- basegfx::B2DRange aOverlap(0.0, 0.0, 1.0, 1.0);
-
- aOverlap.intersect(aCropped);
-
- if(!aOverlap.isEmpty())
- {
- aCropPolyPolygon.append(
- basegfx::tools::createPolygonFromRect(
- aOverlap));
- }
-
- // transform to object coordinates to prepare for clip
- aCropPolyPolygon.transform(maObjectTransform);
- aGraphicOutlinePolygon.transform(maObjectTransform);
-
- // create cropped transformation
- basegfx::B2DHomMatrix aCroppedTransform;
- const bool bCombinedMirrorX(bMirroredX);
-
- aCroppedTransform.scale(
- aCropped.getWidth(),
- aCropped.getHeight());
- aCroppedTransform.translate(
- aCropped.getMinX(),
- aCropped.getMinY());
- aCroppedTransform = maObjectTransform * aCroppedTransform;
-
- // prepare graphic primitive (tranformed)
- const drawinglayer::primitive2d::Primitive2DReference aGraphic(
- new drawinglayer::primitive2d::GraphicPrimitive2D(
- aCroppedTransform,
- maGraphic));
-
- // prepare outline polygon for whole graphic
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
- const drawinglayer::primitive2d::Primitive2DReference aGraphicOutline(
- new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
- aGraphicOutlinePolygon,
- aHilightColor));
-
- // combine these
- drawinglayer::primitive2d::Primitive2DSequence aCombination(2);
- aCombination[0] = aGraphic;
- aCombination[1] = aGraphicOutline;
-
- // embed to MaskPrimitive2D
- const drawinglayer::primitive2d::Primitive2DReference aMaskedGraphic(
- new drawinglayer::primitive2d::MaskPrimitive2D(
- aCropPolyPolygon,
- aCombination));
-
- // embed to UnifiedTransparencePrimitive2D
- const drawinglayer::primitive2d::Primitive2DReference aTransparenceMaskedGraphic(
- new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
- drawinglayer::primitive2d::Primitive2DSequence(&aMaskedGraphic, 1),
- 0.8));
-
- const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aTransparenceMaskedGraphic, 1);
-
- for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
- {
- // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
- const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
-
- if(rPageWindow.GetPaintWindow().OutputToWindow())
- {
- if(rPageWindow.GetOverlayManager())
- {
- ::sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence);
- DBG_ASSERT(pNew, "Got NO new IAO!");
-
- if(pNew)
- {
- // only informative object, no hit
- pNew->setHittable(false);
-
- rPageWindow.GetOverlayManager()->add(*pNew);
- maOverlayGroup.append(*pNew);
- }
- }
- }
- }
+ GetRidOfIAObject();
+ SdrMarkView* pView = pHdlList ? pHdlList->GetView() : 0;
+ SdrPageView* pPageView = pView ? pView->GetSdrPageView() : 0;
+
+ if(pPageView && pView->areMarkHandlesHidden())
+ {
+ return;
+ }
+
+ // decompose to have current translate and scale
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+
+ maObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ if(aScale.equalZero())
+ {
+ return;
+ }
+
+ // detect 180 degree rotation, this is the same as mirrored in X and Y,
+ // thus change to mirroring. Prefer mirroring here. Use the equal call
+ // with getSmallValue here, the original which uses rtl::math::approxEqual
+ // is too correct here. Maybe this changes with enhanced precision in aw080
+ // to the better so that this can be reduced to the more precise call again
+ if(basegfx::fTools::equal(fabs(fRotate), F_PI, 0.000000001))
+ {
+ aScale.setX(aScale.getX() * -1.0);
+ aScale.setY(aScale.getY() * -1.0);
+ fRotate = 0.0;
+ }
+
+ // remember mirroring, reset at Scale and adapt crop values for usage;
+ // mirroring can stay in the object transformation, so do not have to
+ // cope with it here (except later for the CroppedImage transformation,
+ // see below)
+ const bool bMirroredX(aScale.getX() < 0.0);
+ const bool bMirroredY(aScale.getY() < 0.0);
+ double fCropLeft(mfCropLeft);
+ double fCropTop(mfCropTop);
+ double fCropRight(mfCropRight);
+ double fCropBottom(mfCropBottom);
+
+ if(bMirroredX)
+ {
+ aScale.setX(-aScale.getX());
+ }
+
+ if(bMirroredY)
+ {
+ aScale.setY(-aScale.getY());
+ }
+
+ // create target translate and scale
+ const basegfx::B2DVector aTargetScale(
+ aScale.getX() + fCropRight + fCropLeft,
+ aScale.getY() + fCropBottom + fCropTop);
+ const basegfx::B2DVector aTargetTranslate(
+ aTranslate.getX() - fCropLeft,
+ aTranslate.getY() - fCropTop);
+
+ // create ranges to make comparisons
+ const basegfx::B2DRange aCurrentForCompare(
+ aTranslate.getX(), aTranslate.getY(),
+ aTranslate.getX() + aScale.getX(), aTranslate.getY() + aScale.getY());
+ basegfx::B2DRange aCropped(
+ aTargetTranslate.getX(), aTargetTranslate.getY(),
+ aTargetTranslate.getX() + aTargetScale.getX(), aTargetTranslate.getY() + aTargetScale.getY());
+
+ if(aCropped.isEmpty())
+ {
+ // nothing to return since cropped content is completely empty
+ return;
+ }
+
+ if(aCurrentForCompare.equal(aCropped))
+ {
+ // no crop at all
+ return;
+ }
+
+ // back-transform to have values in unit coordinates
+ basegfx::B2DHomMatrix aBackToUnit;
+ aBackToUnit.translate(-aTranslate.getX(), -aTranslate.getY());
+ aBackToUnit.scale(
+ basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : 1.0 / aScale.getX(),
+ basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : 1.0 / aScale.getY());
+
+ // transform cropped back to unit coordinates
+ aCropped.transform(aBackToUnit);
+
+ // prepare crop PolyPolygon
+ basegfx::B2DPolygon aGraphicOutlinePolygon(
+ basegfx::tools::createPolygonFromRect(
+ aCropped));
+ basegfx::B2DPolyPolygon aCropPolyPolygon(aGraphicOutlinePolygon);
+
+ // current range is unit range
+ basegfx::B2DRange aOverlap(0.0, 0.0, 1.0, 1.0);
+
+ aOverlap.intersect(aCropped);
+
+ if(!aOverlap.isEmpty())
+ {
+ aCropPolyPolygon.append(
+ basegfx::tools::createPolygonFromRect(
+ aOverlap));
+ }
+
+ // transform to object coordinates to prepare for clip
+ aCropPolyPolygon.transform(maObjectTransform);
+ aGraphicOutlinePolygon.transform(maObjectTransform);
+
+ // create cropped transformation
+ basegfx::B2DHomMatrix aCroppedTransform;
+ const bool bCombinedMirrorX(bMirroredX);
+
+ aCroppedTransform.scale(
+ aCropped.getWidth(),
+ aCropped.getHeight());
+ aCroppedTransform.translate(
+ aCropped.getMinX(),
+ aCropped.getMinY());
+ aCroppedTransform = maObjectTransform * aCroppedTransform;
+
+ // prepare graphic primitive (transformed)
+ const drawinglayer::primitive2d::Primitive2DReference aGraphic(
+ new drawinglayer::primitive2d::GraphicPrimitive2D(
+ aCroppedTransform,
+ maGraphic));
+
+ // prepare outline polygon for whole graphic
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
+ const drawinglayer::primitive2d::Primitive2DReference aGraphicOutline(
+ new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+ aGraphicOutlinePolygon,
+ aHilightColor));
+
+ // combine these
+ drawinglayer::primitive2d::Primitive2DSequence aCombination(2);
+ aCombination[0] = aGraphic;
+ aCombination[1] = aGraphicOutline;
+
+ // embed to MaskPrimitive2D
+ const drawinglayer::primitive2d::Primitive2DReference aMaskedGraphic(
+ new drawinglayer::primitive2d::MaskPrimitive2D(
+ aCropPolyPolygon,
+ aCombination));
+
+ // embed to UnifiedTransparencePrimitive2D
+ const drawinglayer::primitive2d::Primitive2DReference aTransparenceMaskedGraphic(
+ new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
+ drawinglayer::primitive2d::Primitive2DSequence(&aMaskedGraphic, 1),
+ 0.8));
+
+ const drawinglayer::primitive2d::Primitive2DSequence aSequence(&aTransparenceMaskedGraphic, 1);
+
+ for(sal_uInt32 b(0L); b < pPageView->PageWindowCount(); b++)
+ {
+ // const SdrPageViewWinRec& rPageViewWinRec = rPageViewWinList[b];
+ const SdrPageWindow& rPageWindow = *pPageView->GetPageWindow(b);
+
+ if(rPageWindow.GetPaintWindow().OutputToWindow())
+ {
+ if(rPageWindow.GetOverlayManager())
+ {
+ ::sdr::overlay::OverlayObject* pNew = new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence);
+ DBG_ASSERT(pNew, "Got NO new IAO!");
+
+ if(pNew)
+ {
+ // only informative object, no hit
+ pNew->setHittable(false);
+
+ rPageWindow.GetOverlayManager()->add(*pNew);
+ maOverlayGroup.append(*pNew);
+ }
+ }
+ }
+ }
}
////////////////////////////////////////////////////////////////////////////////////////////////////
// eof
+