svdmrkv.cxx (f77d51df) svdmrkv.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

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

649 if (!bFrmHdl) {
650 // FrameHandles, wenn wenigstens 1 Obj kein SpecialDrag kann
651 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bFrmHdl; nMarkNum++) {
652 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
653 const SdrObject* pObj=pM->GetMarkedSdrObj();
654 bFrmHdl=!pObj->hasSpecialDrag();
655 }
656 }
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

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

649 if (!bFrmHdl) {
650 // FrameHandles, wenn wenigstens 1 Obj kein SpecialDrag kann
651 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bFrmHdl; nMarkNum++) {
652 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
653 const SdrObject* pObj=pM->GetMarkedSdrObj();
654 bFrmHdl=!pObj->hasSpecialDrag();
655 }
656 }
657
658 // no FrameHdl for crop
659 if(bFrmHdl && SDRDRAG_CROP == eDragMode)
660 {
661 bFrmHdl = sal_False;
662 }
663
657 return bFrmHdl;
658}
659
660void SdrMarkView::SetMarkHandles()
661{
662 // #105722# remember old focus handle values to search for it again
663 const SdrHdl* pSaveOldFocusHdl = aHdl.GetFocusHdl();
664 sal_Bool bSaveOldFocus(sal_False);

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

762 for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
763 {
764 SdrHdl* pHdl=aHdl.GetHdl(i);
765 pHdl->SetObj(pMarkedObj);
766 pHdl->SetPageView(pMarkedPV);
767 pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
768 }
769 }
664 return bFrmHdl;
665}
666
667void SdrMarkView::SetMarkHandles()
668{
669 // #105722# remember old focus handle values to search for it again
670 const SdrHdl* pSaveOldFocusHdl = aHdl.GetFocusHdl();
671 sal_Bool bSaveOldFocus(sal_False);

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

769 for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
770 {
771 SdrHdl* pHdl=aHdl.GetHdl(i);
772 pHdl->SetObj(pMarkedObj);
773 pHdl->SetPageView(pMarkedPV);
774 pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
775 }
776 }
770 else if( eDragMode==SDRDRAG_CROP )
771 {
772 const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pMarkedObj);
773
774 if(pSdrGrafObj)
777 else
778 {
779 sal_Bool bWdt0=aRect.Left()==aRect.Right();
780 sal_Bool bHgt0=aRect.Top()==aRect.Bottom();
781 if (bWdt0 && bHgt0)
775 {
782 {
776 const SdrGrafCropItem& rCrop = static_cast< const SdrGrafCropItem& >(pSdrGrafObj->GetMergedItem(SDRATTR_GRAFCROP));
783 aHdl.AddHdl(new SdrHdl(aRect.TopLeft(),HDL_UPLFT));
784 }
785 else if (!bStdDrag && (bWdt0 || bHgt0))
786 {
787 aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT));
788 aHdl.AddHdl(new SdrHdl(aRect.BottomRight(),HDL_LWRGT));
789 }
790 else
791 {
792 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT));
793 if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopCenter() ,HDL_UPPER));
794 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopRight() ,HDL_UPRGT));
795 if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.LeftCenter() ,HDL_LEFT ));
796 if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.RightCenter() ,HDL_RIGHT));
797 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomLeft() ,HDL_LWLFT));
798 if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomCenter(),HDL_LOWER));
799 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomRight() ,HDL_LWRGT));
800 }
801 }
802 }
803 }
804 else
805 {
806 bool bDone(false);
777
807
778 if(rCrop.GetLeft() || rCrop.GetTop() || rCrop.GetRight() ||rCrop.GetBottom())
779 {
780 basegfx::B2DHomMatrix aMatrix;
781 basegfx::B2DPolyPolygon aPolyPolygon;
808 // moved crop handling to non-frame part and the handle creation to SdrGrafObj
809 if(1 == nMarkAnz && pMarkedObj && SDRDRAG_CROP == eDragMode)
810 {
811 const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pMarkedObj);
782
812
783 pSdrGrafObj->TRGetBaseGeometry(aMatrix, aPolyPolygon);
813 if(pSdrGrafObj)
814 {
815 pSdrGrafObj->addCropHandles(aHdl);
816 bDone = true;
817 }
818 }
784
819
785 // decompose to have current translate and scale
786 basegfx::B2DVector aScale, aTranslate;
787 double fRotate, fShearX;
788
789 aMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
790
791 if(!aScale.equalZero())
820 if(!bDone)
821 {
822 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
823 {
824 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
825 SdrObject* pObj=pM->GetMarkedSdrObj();
826 SdrPageView* pPV=pM->GetPageView();
827 const sal_uIntPtr nSiz0=aHdl.GetHdlCount();
828 pObj->AddToHdlList(aHdl);
829 const sal_uIntPtr nSiz1=aHdl.GetHdlCount();
830 bool bPoly=pObj->IsPolyObj();
831 const SdrUShortCont* pMrkPnts=pM->GetMarkedPoints();
832 for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
833 {
834 SdrHdl* pHdl=aHdl.GetHdl(i);
835 pHdl->SetObj(pObj);
836 pHdl->SetPageView(pPV);
837 pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
838 if (bPoly)
839 {
840 sal_Bool bSelected=pMrkPnts!=NULL && pMrkPnts->Exist(sal_uInt16(i-nSiz0));
841 pHdl->SetSelected(bSelected);
842 //sal_Bool bPlus=bPlusHdlAlways;
843 if (bPlusHdlAlways || bSelected)
792 {
844 {
793 // get crop scale
794 const basegfx::B2DVector aCropScaleFactor(
795 pSdrGrafObj->GetGraphicObject().calculateCropScaling(
796 aScale.getX(),
797 aScale.getY(),
798 rCrop.GetLeft(),
799 rCrop.GetTop(),
800 rCrop.GetRight(),
801 rCrop.GetBottom()));
802
803 // apply crop scale
804 const double fCropLeft(rCrop.GetLeft() * aCropScaleFactor.getX());
805 const double fCropTop(rCrop.GetTop() * aCropScaleFactor.getY());
806 const double fCropRight(rCrop.GetRight() * aCropScaleFactor.getX());
807 const double fCropBottom(rCrop.GetBottom() * aCropScaleFactor.getY());
808
809 aHdl.AddHdl(
810 new SdrCropViewHdl(
811 aMatrix,
812 pSdrGrafObj->GetGraphicObject().GetGraphic(),
813 fCropLeft,
814 fCropTop,
815 fCropRight,
816 fCropBottom,
817 pSdrGrafObj->IsMirrored()));
845 sal_uInt32 nPlusAnz=pObj->GetPlusHdlCount(*pHdl);
846 for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusAnz; nPlusNum++)
847 {
848 SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,nPlusNum);
849 if (pPlusHdl!=NULL)
850 {
851 pPlusHdl->SetObj(pObj);
852 pPlusHdl->SetPageView(pPV);
853 pPlusHdl->SetPlusHdl(sal_True);
854 aHdl.AddHdl(pPlusHdl);
855 }
856 }
818 }
819 }
820 }
857 }
858 }
859 }
821
822 aHdl.AddHdl(new SdrCropHdl(aRect.TopLeft() ,HDL_UPLFT));
823 aHdl.AddHdl(new SdrCropHdl(aRect.TopCenter() ,HDL_UPPER));
824 aHdl.AddHdl(new SdrCropHdl(aRect.TopRight() ,HDL_UPRGT));
825 aHdl.AddHdl(new SdrCropHdl(aRect.LeftCenter() ,HDL_LEFT ));
826 aHdl.AddHdl(new SdrCropHdl(aRect.RightCenter() ,HDL_RIGHT));
827 aHdl.AddHdl(new SdrCropHdl(aRect.BottomLeft() ,HDL_LWLFT));
828 aHdl.AddHdl(new SdrCropHdl(aRect.BottomCenter(),HDL_LOWER));
829 aHdl.AddHdl(new SdrCropHdl(aRect.BottomRight() ,HDL_LWRGT));
830 }
831 else
832 {
833 sal_Bool bWdt0=aRect.Left()==aRect.Right();
834 sal_Bool bHgt0=aRect.Top()==aRect.Bottom();
835 if (bWdt0 && bHgt0)
836 {
837 aHdl.AddHdl(new SdrHdl(aRect.TopLeft(),HDL_UPLFT));
838 }
839 else if (!bStdDrag && (bWdt0 || bHgt0))
840 {
841 aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT));
842 aHdl.AddHdl(new SdrHdl(aRect.BottomRight(),HDL_LWRGT));
843 }
844 else
845 {
846 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopLeft() ,HDL_UPLFT));
847 if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopCenter() ,HDL_UPPER));
848 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopRight() ,HDL_UPRGT));
849 if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.LeftCenter() ,HDL_LEFT ));
850 if (!bWdt0 ) aHdl.AddHdl(new SdrHdl(aRect.RightCenter() ,HDL_RIGHT));
851 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomLeft() ,HDL_LWLFT));
852 if ( !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomCenter(),HDL_LOWER));
853 if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomRight() ,HDL_LWRGT));
854 }
855 }
856 }
857 }
858 else
859 {
860 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
861 {
862 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
863 SdrObject* pObj=pM->GetMarkedSdrObj();
864 SdrPageView* pPV=pM->GetPageView();
865 const sal_uIntPtr nSiz0=aHdl.GetHdlCount();
866 pObj->AddToHdlList(aHdl);
867 const sal_uIntPtr nSiz1=aHdl.GetHdlCount();
868 bool bPoly=pObj->IsPolyObj();
869 const SdrUShortCont* pMrkPnts=pM->GetMarkedPoints();
870 for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
871 {
872 SdrHdl* pHdl=aHdl.GetHdl(i);
873 pHdl->SetObj(pObj);
874 pHdl->SetPageView(pPV);
875 pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
876 if (bPoly)
877 {
878 sal_Bool bSelected=pMrkPnts!=NULL && pMrkPnts->Exist(sal_uInt16(i-nSiz0));
879 pHdl->SetSelected(bSelected);
880 //sal_Bool bPlus=bPlusHdlAlways;
881 if (bPlusHdlAlways || bSelected)
882 {
883 sal_uInt32 nPlusAnz=pObj->GetPlusHdlCount(*pHdl);
884 for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusAnz; nPlusNum++)
885 {
886 SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,nPlusNum);
887 if (pPlusHdl!=NULL)
888 {
889 pPlusHdl->SetObj(pObj);
890 pPlusHdl->SetPageView(pPV);
891 pPlusHdl->SetPlusHdl(sal_True);
892 aHdl.AddHdl(pPlusHdl);
893 }
894 }
895 }
896 }
897 }
898 } // for nMarkNum
899 } // if bFrmHdl else
860 }
861 }
862 }
900
901 // GluePoint-Handles
902 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
903 {
904 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
905 SdrObject* pObj=pM->GetMarkedSdrObj();
906 SdrPageView* pPV=pM->GetPageView();
907 const SdrUShortCont* pMrkGlue=pM->GetMarkedGluePoints();

--- 1341 unchanged lines hidden ---
863
864 // GluePoint-Handles
865 for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
866 {
867 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
868 SdrObject* pObj=pM->GetMarkedSdrObj();
869 SdrPageView* pPV=pM->GetPageView();
870 const SdrUShortCont* pMrkGlue=pM->GetMarkedGluePoints();

--- 1341 unchanged lines hidden ---