svddrgmt.cxx (ddde725d) | svddrgmt.cxx (f106eca9) |
---|---|
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 --- 18 unchanged lines hidden (view full) --- 27#include "svddrgm1.hxx" 28#include <math.h> 29 30#ifndef _MATH_H 31#define _MATH_H 32#endif 33#include <tools/bigint.hxx> 34#include <vcl/svapp.hxx> | 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 --- 18 unchanged lines hidden (view full) --- 27#include "svddrgm1.hxx" 28#include <math.h> 29 30#ifndef _MATH_H 31#define _MATH_H 32#endif 33#include <tools/bigint.hxx> 34#include <vcl/svapp.hxx> |
35 | |
36#include "svx/xattr.hxx" 37#include <svx/xpoly.hxx> 38#include <svx/svdetc.hxx> 39#include <svx/svdtrans.hxx> 40#include <svx/svdundo.hxx> 41#include <svx/svdmark.hxx> 42#include <svx/svdocapt.hxx> 43#include <svx/svdpagv.hxx> --- 30 unchanged lines hidden (view full) --- 74#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> 75#include <svx/svdoole2.hxx> 76#include <svx/svdovirt.hxx> 77#include <svx/svdouno.hxx> 78#include <svx/sdr/primitive2d/sdrprimitivetools.hxx> 79#include <basegfx/matrix/b2dhommatrixtools.hxx> 80#include <drawinglayer/attribute/sdrlineattribute.hxx> 81#include <drawinglayer/attribute/sdrlinestartendattribute.hxx> | 35#include "svx/xattr.hxx" 36#include <svx/xpoly.hxx> 37#include <svx/svdetc.hxx> 38#include <svx/svdtrans.hxx> 39#include <svx/svdundo.hxx> 40#include <svx/svdmark.hxx> 41#include <svx/svdocapt.hxx> 42#include <svx/svdpagv.hxx> --- 30 unchanged lines hidden (view full) --- 73#include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> 74#include <svx/svdoole2.hxx> 75#include <svx/svdovirt.hxx> 76#include <svx/svdouno.hxx> 77#include <svx/sdr/primitive2d/sdrprimitivetools.hxx> 78#include <basegfx/matrix/b2dhommatrixtools.hxx> 79#include <drawinglayer/attribute/sdrlineattribute.hxx> 80#include <drawinglayer/attribute/sdrlinestartendattribute.hxx> |
81#include <map> 82#include <vector> |
|
82 83//////////////////////////////////////////////////////////////////////////////////////////////////// 84 85SdrDragEntry::SdrDragEntry() 86: mbAddToTransparent(false) 87{ 88} 89 --- 58 unchanged lines hidden (view full) --- 148SdrDragEntrySdrObject::~SdrDragEntrySdrObject() 149{ 150 if(mpClone) 151 { 152 SdrObject::Free(mpClone); 153 } 154} 155 | 83 84//////////////////////////////////////////////////////////////////////////////////////////////////// 85 86SdrDragEntry::SdrDragEntry() 87: mbAddToTransparent(false) 88{ 89} 90 --- 58 unchanged lines hidden (view full) --- 149SdrDragEntrySdrObject::~SdrDragEntrySdrObject() 150{ 151 if(mpClone) 152 { 153 SdrObject::Free(mpClone); 154 } 155} 156 |
156drawinglayer::primitive2d::Primitive2DSequence SdrDragEntrySdrObject::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) | 157void SdrDragEntrySdrObject::prepareCurrentState(SdrDragMethod& rDragMethod) |
157{ 158 // for the moment, i need to re-create the clone in all cases. I need to figure 159 // out when clone and original have the same class, so that i can use operator= 160 // in those cases 161 162 // // copy all other needed stuff 163 // basegfx::B2DHomMatrix aMatrix; 164 // basegfx::B2DPolyPolygon aPolyPolygon; 165 // pOleObject->TRGetBaseGeometry(aMatrix, aPolyPolygon); 166 // pClone->TRSetBaseGeometry(aMatrix, aPolyPolygon); 167 | 158{ 159 // for the moment, i need to re-create the clone in all cases. I need to figure 160 // out when clone and original have the same class, so that i can use operator= 161 // in those cases 162 163 // // copy all other needed stuff 164 // basegfx::B2DHomMatrix aMatrix; 165 // basegfx::B2DPolyPolygon aPolyPolygon; 166 // pOleObject->TRGetBaseGeometry(aMatrix, aPolyPolygon); 167 // pClone->TRSetBaseGeometry(aMatrix, aPolyPolygon); 168 |
168 const SdrObject* pSource = &maOriginal; 169 | |
170 if(mpClone) 171 { 172 SdrObject::Free(mpClone); 173 mpClone = 0; 174 } 175 176 if(mbModify) 177 { 178 if(!mpClone) 179 { 180 mpClone = maOriginal.getFullDragClone(); 181 } 182 183 // apply original transformation, implemented at the DragMethods 184 rDragMethod.applyCurrentTransformationToSdrObject(*mpClone); | 169 if(mpClone) 170 { 171 SdrObject::Free(mpClone); 172 mpClone = 0; 173 } 174 175 if(mbModify) 176 { 177 if(!mpClone) 178 { 179 mpClone = maOriginal.getFullDragClone(); 180 } 181 182 // apply original transformation, implemented at the DragMethods 183 rDragMethod.applyCurrentTransformationToSdrObject(*mpClone); |
184 } 185} |
|
185 | 186 |
187drawinglayer::primitive2d::Primitive2DSequence SdrDragEntrySdrObject::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) 188{ 189 const SdrObject* pSource = &maOriginal; 190 191 if(mbModify && mpClone) 192 { |
|
186 // choose source for geometry data 187 pSource = mpClone; 188 } 189 190 // get VOC and Primitive2DSequence 191 sdr::contact::ViewContact& rVC = pSource->GetViewContact(); 192 sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(mrObjectContact); 193 sdr::contact::DisplayInfo aDisplayInfo; --- 114 unchanged lines hidden (view full) --- 308 clearSdrDragEntries(); 309} 310 311basegfx::B2DRange SdrDragMethod::getCurrentRange() const 312{ 313 return getB2DRangeFromOverlayObjectList(); 314} 315 | 193 // choose source for geometry data 194 pSource = mpClone; 195 } 196 197 // get VOC and Primitive2DSequence 198 sdr::contact::ViewContact& rVC = pSource->GetViewContact(); 199 sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(mrObjectContact); 200 sdr::contact::DisplayInfo aDisplayInfo; --- 114 unchanged lines hidden (view full) --- 315 clearSdrDragEntries(); 316} 317 318basegfx::B2DRange SdrDragMethod::getCurrentRange() const 319{ 320 return getB2DRangeFromOverlayObjectList(); 321} 322 |
323void SdrDragMethod::clearSdrDragEntries() 324{ 325 for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++) 326 { 327 delete maSdrDragEntries[a]; 328 } 329 330 maSdrDragEntries.clear(); 331} 332 333void SdrDragMethod::addSdrDragEntry(SdrDragEntry* pNew) 334{ 335 if(pNew) 336 { 337 maSdrDragEntries.push_back(pNew); 338 } 339} 340 |
|
316void SdrDragMethod::createSdrDragEntries() 317{ 318 if(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView()) 319 { 320 if(getSdrDragView().IsDraggingPoints()) 321 { 322 createSdrDragEntries_PointDrag(); 323 } --- 334 unchanged lines hidden (view full) --- 658 return basegfx::B2DHomMatrix(); 659} 660 661void SdrDragMethod::CancelSdrDrag() 662{ 663 Hide(); 664} 665 | 341void SdrDragMethod::createSdrDragEntries() 342{ 343 if(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView()) 344 { 345 if(getSdrDragView().IsDraggingPoints()) 346 { 347 createSdrDragEntries_PointDrag(); 348 } --- 334 unchanged lines hidden (view full) --- 683 return basegfx::B2DHomMatrix(); 684} 685 686void SdrDragMethod::CancelSdrDrag() 687{ 688 Hide(); 689} 690 |
691struct compareConstSdrObjectRefs 692{ 693 bool operator()(const SdrObject* p1, const SdrObject* p2) const 694 { 695 return (p1 < p2); 696 } 697}; 698 699typedef std::map< const SdrObject*, SdrObject*, compareConstSdrObjectRefs> SdrObjectAndCloneMap; 700 |
|
666void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager) 667{ 668 // create SdrDragEntries on demand 669 if(maSdrDragEntries.empty()) 670 { 671 createSdrDragEntries(); 672 } 673 674 // if there are entries, derive OverlayObjects from the entries, including 675 // modification from current interactive state 676 if(!maSdrDragEntries.empty()) 677 { | 701void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager) 702{ 703 // create SdrDragEntries on demand 704 if(maSdrDragEntries.empty()) 705 { 706 createSdrDragEntries(); 707 } 708 709 // if there are entries, derive OverlayObjects from the entries, including 710 // modification from current interactive state 711 if(!maSdrDragEntries.empty()) 712 { |
713 // #54102# SdrDragEntrySdrObject creates clones of SdrObjects as base for creating the needed 714 // primitives, holding the original and the clone. If connectors (Edges) are involved, 715 // the cloned connectors need to be connected to the cloned SdrObjects (after cloning 716 // they are connected to the original SdrObjects). To do so, trigger the preparation 717 // steps for SdrDragEntrySdrObject, save an association of (orig, clone) in a helper 718 // and evtl. remember if it was an edge 719 SdrObjectAndCloneMap aOriginalAndClones; 720 std::vector< SdrEdgeObj* > aEdges; 721 sal_uInt32 a; 722 723 // #54102# execute prepareCurrentState for all SdrDragEntrySdrObject, register pair of original and 724 // clone, remember edges 725 for(a = 0; a < maSdrDragEntries.size(); a++) 726 { 727 SdrDragEntrySdrObject* pSdrDragEntrySdrObject = dynamic_cast< SdrDragEntrySdrObject*>(maSdrDragEntries[a]); 728 729 if(pSdrDragEntrySdrObject) 730 { 731 pSdrDragEntrySdrObject->prepareCurrentState(*this); 732 733 SdrEdgeObj* pSdrEdgeObj = dynamic_cast< SdrEdgeObj* >(pSdrDragEntrySdrObject->getClone()); 734 735 if(pSdrEdgeObj) 736 { 737 aEdges.push_back(pSdrEdgeObj); 738 } 739 740 if(pSdrDragEntrySdrObject->getClone()) 741 { 742 aOriginalAndClones[&pSdrDragEntrySdrObject->getOriginal()] = pSdrDragEntrySdrObject->getClone(); 743 } 744 } 745 } 746 747 // #54102# if there are edges, reconnect their ends to the corresponding clones (if found) 748 if(aEdges.size()) 749 { 750 for(a = 0; a < aEdges.size(); a++) 751 { 752 SdrEdgeObj* pSdrEdgeObj = aEdges[a]; 753 SdrObject* pConnectedTo = pSdrEdgeObj->GetConnectedNode(true); 754 755 if(pConnectedTo) 756 { 757 SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo); 758 759 if(aEntry != aOriginalAndClones.end()) 760 { 761 pSdrEdgeObj->ConnectToNode(true, aEntry->second); 762 } 763 } 764 765 pConnectedTo = pSdrEdgeObj->GetConnectedNode(false); 766 767 if(pConnectedTo) 768 { 769 SdrObjectAndCloneMap::iterator aEntry = aOriginalAndClones.find(pConnectedTo); 770 771 if(aEntry != aOriginalAndClones.end()) 772 { 773 pSdrEdgeObj->ConnectToNode(false, aEntry->second); 774 } 775 } 776 } 777 } 778 779 // collect primitives for visualisation |
|
678 drawinglayer::primitive2d::Primitive2DSequence aResult; 679 drawinglayer::primitive2d::Primitive2DSequence aResultTransparent; | 780 drawinglayer::primitive2d::Primitive2DSequence aResult; 781 drawinglayer::primitive2d::Primitive2DSequence aResultTransparent; |
680 681 for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++) | 782 783 for(a = 0; a < maSdrDragEntries.size(); a++) |
682 { 683 SdrDragEntry* pCandidate = maSdrDragEntries[a]; 684 685 if(pCandidate) 686 { 687 const drawinglayer::primitive2d::Primitive2DSequence aCandidateResult(pCandidate->createPrimitive2DSequenceInCurrentState(*this)); 688 689 if(aCandidateResult.hasElements()) --- 2982 unchanged lines hidden --- | 784 { 785 SdrDragEntry* pCandidate = maSdrDragEntries[a]; 786 787 if(pCandidate) 788 { 789 const drawinglayer::primitive2d::Primitive2DSequence aCandidateResult(pCandidate->createPrimitive2DSequenceInCurrentState(*this)); 790 791 if(aCandidateResult.hasElements()) --- 2982 unchanged lines hidden --- |