1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <editeng/editdata.hxx>
22 #include <editeng/editeng.hxx>
23 #include <rtl/strbuf.hxx>
24 #include <svx/xexch.hxx>
25 #include <svx/xflclit.hxx>
26 #include <svx/svdxcgv.hxx>
27 #include <svx/svdoutl.hxx>
28 #include <svx/svdetc.hxx>
29 #include <svx/svdundo.hxx>
30 #include <svx/svdograf.hxx>
31 #include <svx/svdoole2.hxx>
32 #include <svx/svdorect.hxx>
33 #include <svx/svdoedge.hxx>
34 #include <svx/svdopage.hxx>
35 #include <svx/svdpage.hxx>
36 #include <svx/svdpagv.hxx>
37 #include <svx/svdtrans.hxx>
38 #include "svx/svdstr.hrc"
39 #include "svdglob.hxx"
40 #include "svx/xoutbmp.hxx"
41 #include <vcl/metaact.hxx>
42 #include <svl/poolitem.hxx>
43 #include <svl/itempool.hxx>
44 #include <tools/bigint.hxx>
45 #include <sot/formats.hxx>
46 #include <clonelist.hxx>
47 #include <vcl/virdev.hxx>
48 #include <svl/style.hxx>
50 #include <vcl/svgdata.hxx>
51 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
52 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
53 #include <drawinglayer/geometry/viewinformation2d.hxx>
54 #include <svx/sdr/contact/viewcontact.hxx>
55 #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
56 #include <svx/sdr/contact/displayinfo.hxx>
60 SdrExchangeView::SdrExchangeView(SdrModel
* pModel1
, OutputDevice
* pOut
):
61 SdrObjEditView(pModel1
,pOut
)
65 bool SdrExchangeView::ImpLimitToWorkArea(Point
& rPt
) const
69 if(!aMaxWorkArea
.IsEmpty())
71 if(rPt
.X()<aMaxWorkArea
.Left())
73 rPt
.X() = aMaxWorkArea
.Left();
77 if(rPt
.X()>aMaxWorkArea
.Right())
79 rPt
.X() = aMaxWorkArea
.Right();
83 if(rPt
.Y()<aMaxWorkArea
.Top())
85 rPt
.Y() = aMaxWorkArea
.Top();
89 if(rPt
.Y()>aMaxWorkArea
.Bottom())
91 rPt
.Y() = aMaxWorkArea
.Bottom();
98 void SdrExchangeView::ImpGetPasteObjList(Point
& /*rPos*/, SdrObjList
*& rpLst
)
102 SdrPageView
* pPV
= GetSdrPageView();
105 rpLst
=pPV
->GetObjList();
110 bool SdrExchangeView::ImpGetPasteLayer(const SdrObjList
* pObjList
, SdrLayerID
& rLayer
) const
114 if (pObjList
!=NULL
) {
115 const SdrPage
* pPg
=pObjList
->GetPage();
117 rLayer
=pPg
->GetLayerAdmin().GetLayerID(aAktLayer
,true);
118 if (rLayer
==SDRLAYER_NOTFOUND
) rLayer
=0;
119 SdrPageView
* pPV
= GetSdrPageView();
121 bRet
=!pPV
->GetLockedLayers().IsSet(rLayer
) && pPV
->GetVisibleLayers().IsSet(rLayer
);
128 bool SdrExchangeView::Paste(const OUString
& rStr
, const Point
& rPos
, SdrObjList
* pLst
, sal_uInt32 nOptions
)
134 ImpGetPasteObjList(aPos
,pLst
);
135 ImpLimitToWorkArea( aPos
);
136 if (pLst
==NULL
) return false;
138 if (!ImpGetPasteLayer(pLst
,nLayer
)) return false;
139 bool bUnmark
=(nOptions
&(SDRINSERT_DONTMARK
|SDRINSERT_ADDMARK
))==0 && !IsTextEdit();
140 if (bUnmark
) UnmarkAllObj();
141 Rectangle
aTextRect(0,0,500,500);
142 SdrPage
* pPage
=pLst
->GetPage();
144 aTextRect
.SetSize(pPage
->GetSize());
146 SdrRectObj
* pObj
=new SdrRectObj(OBJ_TEXT
,aTextRect
);
147 pObj
->SetModel(pMod
);
148 pObj
->SetLayer(nLayer
);
149 pObj
->NbcSetText(rStr
); // SetText before SetAttr, else SetAttr doesn't work!
150 if (pDefaultStyleSheet
!=NULL
) pObj
->NbcSetStyleSheet(pDefaultStyleSheet
, false);
152 pObj
->SetMergedItemSet(aDefaultAttr
);
154 SfxItemSet
aTempAttr(pMod
->GetItemPool()); // no fill, no line
155 aTempAttr
.Put(XLineStyleItem(XLINE_NONE
));
156 aTempAttr
.Put(XFillStyleItem(XFILL_NONE
));
158 pObj
->SetMergedItemSet(aTempAttr
);
160 pObj
->FitFrameToTextSize();
161 Size
aSiz(pObj
->GetLogicRect().GetSize());
162 MapUnit eMap
=pMod
->GetScaleUnit();
163 Fraction aMap
=pMod
->GetScaleFraction();
164 ImpPasteObject(pObj
,*pLst
,aPos
,aSiz
,MapMode(eMap
,Point(0,0),aMap
,aMap
),nOptions
);
168 bool SdrExchangeView::Paste(SvStream
& rInput
, const OUString
& rBaseURL
, sal_uInt16 eFormat
, const Point
& rPos
, SdrObjList
* pLst
, sal_uInt32 nOptions
)
171 ImpGetPasteObjList(aPos
,pLst
);
172 ImpLimitToWorkArea( aPos
);
173 if (pLst
==NULL
) return false;
175 if (!ImpGetPasteLayer(pLst
,nLayer
)) return false;
176 bool bUnmark
=(nOptions
&(SDRINSERT_DONTMARK
|SDRINSERT_ADDMARK
))==0 && !IsTextEdit();
177 if (bUnmark
) UnmarkAllObj();
178 Rectangle
aTextRect(0,0,500,500);
179 SdrPage
* pPage
=pLst
->GetPage();
181 aTextRect
.SetSize(pPage
->GetSize());
183 SdrRectObj
* pObj
=new SdrRectObj(OBJ_TEXT
,aTextRect
);
184 pObj
->SetModel(pMod
);
185 pObj
->SetLayer(nLayer
);
186 if (pDefaultStyleSheet
!=NULL
) pObj
->NbcSetStyleSheet(pDefaultStyleSheet
, false);
188 pObj
->SetMergedItemSet(aDefaultAttr
);
190 SfxItemSet
aTempAttr(pMod
->GetItemPool()); // no fill, no line
191 aTempAttr
.Put(XLineStyleItem(XLINE_NONE
));
192 aTempAttr
.Put(XFillStyleItem(XFILL_NONE
));
194 pObj
->SetMergedItemSet(aTempAttr
);
196 pObj
->NbcSetText(rInput
,rBaseURL
,eFormat
);
197 pObj
->FitFrameToTextSize();
198 Size
aSiz(pObj
->GetLogicRect().GetSize());
199 MapUnit eMap
=pMod
->GetScaleUnit();
200 Fraction aMap
=pMod
->GetScaleFraction();
201 ImpPasteObject(pObj
,*pLst
,aPos
,aSiz
,MapMode(eMap
,Point(0,0),aMap
,aMap
),nOptions
);
204 if(pObj
->GetModel() && pObj
->GetOutlinerParaObject())
206 SdrOutliner
& rOutliner
= pObj
->GetModel()->GetHitTestOutliner();
207 rOutliner
.SetText(*pObj
->GetOutlinerParaObject());
209 if(1L == rOutliner
.GetParagraphCount())
211 SfxStyleSheet
* pCandidate
= rOutliner
.GetStyleSheet(0L);
215 if(pObj
->GetModel()->GetStyleSheetPool() == &pCandidate
->GetPool())
217 pObj
->NbcSetStyleSheet(pCandidate
, true);
226 bool SdrExchangeView::Paste(const SdrModel
& rMod
, const Point
& rPos
, SdrObjList
* pLst
, sal_uInt32 nOptions
)
228 const SdrModel
* pSrcMod
=&rMod
;
230 return false; // this can't work, right?
232 const bool bUndo
= IsUndoEnabled();
235 BegUndo(ImpGetResStr(STR_ExchangePaste
));
237 if( mxSelectionController
.is() && mxSelectionController
->PasteObjModel( rMod
) )
245 ImpGetPasteObjList(aPos
,pLst
);
246 SdrPageView
* pMarkPV
=NULL
;
247 SdrPageView
* pPV
= GetSdrPageView();
251 if ( pPV
->GetObjList() == pLst
)
255 ImpLimitToWorkArea( aPos
);
259 bool bUnmark
=(nOptions
&(SDRINSERT_DONTMARK
|SDRINSERT_ADDMARK
))==0 && !IsTextEdit();
263 // Rescale, if the Model uses a different MapUnit.
264 // Calculate the necessary factors first.
265 MapUnit eSrcUnit
=pSrcMod
->GetScaleUnit();
266 MapUnit eDstUnit
=pMod
->GetScaleUnit();
267 bool bResize
=eSrcUnit
!=eDstUnit
;
268 Fraction xResize
,yResize
;
272 FrPair
aResize(GetMapFactor(eSrcUnit
,eDstUnit
));
276 SdrObjList
* pDstLst
=pLst
;
277 sal_uInt16 nPg
,nPgAnz
=pSrcMod
->GetPageCount();
278 for (nPg
=0; nPg
<nPgAnz
; nPg
++)
280 const SdrPage
* pSrcPg
=pSrcMod
->GetPage(nPg
);
282 // Use SnapRect, not BoundRect here
283 Rectangle aR
=pSrcPg
->GetAllObjSnapRect();
286 ResizeRect(aR
,aPt0
,xResize
,yResize
);
287 Point
aDist(aPos
-aR
.Center());
288 Size
aSiz(aDist
.X(),aDist
.Y());
289 sal_uIntPtr nCloneErrCnt
=0;
290 sal_uIntPtr nOb
,nObAnz
=pSrcPg
->GetObjCount();
291 bool bMark
=pMarkPV
!=NULL
&& !IsTextEdit() && (nOptions
&SDRINSERT_DONTMARK
)==0;
294 // New mechanism to re-create the connections of cloned connectors
295 CloneList aCloneList
;
297 for (nOb
=0; nOb
<nObAnz
; nOb
++)
299 const SdrObject
* pSrcOb
=pSrcPg
->GetObj(nOb
);
301 SdrObject
* pNeuObj
= pSrcOb
->Clone();
307 pNeuObj
->GetModel()->SetPasteResize(true);
308 pNeuObj
->NbcResize(aPt0
,xResize
,yResize
);
309 pNeuObj
->GetModel()->SetPasteResize(false);
313 pNeuObj
->SetModel(pDstLst
->GetModel());
314 pNeuObj
->SetPage(pDstLst
->GetPage());
316 pNeuObj
->NbcMove(aSiz
);
318 const SdrPage
* pPg
= pDstLst
->GetPage();
323 const SdrLayerAdmin
& rAd
= pPg
->GetLayerAdmin();
324 SdrLayerID
nLayer(0);
326 if(pNeuObj
->ISA(FmFormObj
))
328 // for FormControls, force to form layer
329 nLayer
= rAd
.GetLayerID(rAd
.GetControlLayerName(), true);
333 nLayer
= rAd
.GetLayerID(aAktLayer
, true);
336 if(SDRLAYER_NOTFOUND
== nLayer
)
341 pNeuObj
->SetLayer(nLayer
);
344 SdrInsertReason
aReason(SDRREASON_VIEWCALL
);
345 pDstLst
->InsertObject(pNeuObj
,CONTAINER_APPEND
,&aReason
);
348 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNeuObj
));
351 // Don't already set Markhandles!
352 // That is instead being done by ModelHasChanged in MarkView.
353 MarkObj(pNeuObj
,pMarkPV
,false,true);
357 aCloneList
.AddPair(pSrcOb
, pNeuObj
);
366 // New mechanism to re-create the connections of cloned connectors
367 aCloneList
.CopyConnections();
369 if(0L != nCloneErrCnt
)
372 OStringBuffer
aStr("SdrExchangeView::Paste(): Error when cloning ");
374 if(nCloneErrCnt
== 1)
376 aStr
.append("a drawing object.");
380 aStr
.append(static_cast<sal_Int32
>(nCloneErrCnt
));
381 aStr
.append(" drawing objects.");
384 aStr
.append(" Not copying object connectors.");
386 OSL_FAIL(aStr
.getStr());
397 void SdrExchangeView::ImpPasteObject(SdrObject
* pObj
, SdrObjList
& rLst
, const Point
& rCenter
, const Size
& rSiz
, const MapMode
& rMap
, sal_uInt32 nOptions
)
399 BigInt
nSizX(rSiz
.Width());
400 BigInt
nSizY(rSiz
.Height());
401 MapUnit eSrcMU
=rMap
.GetMapUnit();
402 MapUnit eDstMU
=pMod
->GetScaleUnit();
403 FrPair
aMapFact(GetMapFactor(eSrcMU
,eDstMU
));
404 Fraction
aDstFr(pMod
->GetScaleFraction());
405 nSizX
*=aMapFact
.X().GetNumerator();
406 nSizX
*=rMap
.GetScaleX().GetNumerator();
407 nSizX
*=aDstFr
.GetDenominator();
408 nSizX
/=aMapFact
.X().GetDenominator();
409 nSizX
/=rMap
.GetScaleX().GetDenominator();
410 nSizX
/=aDstFr
.GetNumerator();
411 nSizY
*=aMapFact
.Y().GetNumerator();
412 nSizY
*=rMap
.GetScaleY().GetNumerator();
413 nSizX
*=aDstFr
.GetDenominator();
414 nSizY
/=aMapFact
.Y().GetDenominator();
415 nSizY
/=rMap
.GetScaleY().GetDenominator();
416 nSizY
/=aDstFr
.GetNumerator();
419 Point
aPos(rCenter
.X()-xs
/2,rCenter
.Y()-ys
/2);
420 Rectangle
aR(aPos
.X(),aPos
.Y(),aPos
.X()+xs
,aPos
.Y()+ys
);
421 pObj
->SetLogicRect(aR
);
422 SdrInsertReason
aReason(SDRREASON_VIEWCALL
);
423 rLst
.InsertObject(pObj
,CONTAINER_APPEND
,&aReason
);
425 if( IsUndoEnabled() )
426 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj
));
428 SdrPageView
* pMarkPV
=NULL
;
429 SdrPageView
* pPV
= GetSdrPageView();
433 if (pPV
->GetObjList()==&rLst
)
437 bool bMark
=pMarkPV
!=NULL
&& !IsTextEdit() && (nOptions
&SDRINSERT_DONTMARK
)==0;
439 { // select object the first PageView we found
440 MarkObj(pObj
,pMarkPV
);
444 BitmapEx
SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked
) const
448 if( AreObjectsMarked() )
450 if(1 == GetMarkedObjectCount())
452 if(bNoVDevIfOneBmpMarked
)
454 SdrObject
* pGrafObjTmp
= GetMarkedObjectByIndex( 0 );
455 SdrGrafObj
* pGrafObj
= ( GetMarkedObjectCount() == 1 ) ? PTR_CAST( SdrGrafObj
, pGrafObjTmp
) : NULL
;
457 if( pGrafObj
&& ( pGrafObj
->GetGraphicType() == GRAPHIC_BITMAP
) )
459 aBmp
= pGrafObj
->GetTransformedGraphic().GetBitmapEx();
464 const SdrGrafObj
* pSdrGrafObj
= dynamic_cast< const SdrGrafObj
* >(GetMarkedObjectByIndex(0));
466 if(pSdrGrafObj
&& pSdrGrafObj
->isEmbeddedSvg())
468 aBmp
= pSdrGrafObj
->GetGraphic().getSvgData()->getReplacement();
475 // choose conversion directly using primitives to bitmap to avoid
476 // rendering errors with tiled bitmap fills (these will be tiled in a
477 // in-between metafile, but tend to show 'gaps' since the target is *no*
479 ::std::vector
< SdrObject
* > aSdrObjects(GetMarkedObjects());
480 const sal_uInt32
nCount(aSdrObjects
.size());
484 // collect sub-primitives as group objects, thus no expensive append
485 // to existing sequence is needed
486 drawinglayer::primitive2d::Primitive2DSequence
xPrimitives(nCount
);
488 for(sal_uInt32
a(0); a
< nCount
; a
++)
490 SdrObject
* pCandidate
= aSdrObjects
[a
];
491 SdrGrafObj
* pSdrGrafObj
= dynamic_cast< SdrGrafObj
* >(pCandidate
);
495 // #122753# To ensure existence of graphic content, force swap in
496 pSdrGrafObj
->ForceSwapIn();
499 xPrimitives
[a
] = new drawinglayer::primitive2d::GroupPrimitive2D(
500 pCandidate
->GetViewContact().getViewIndependentPrimitive2DSequence());
504 const drawinglayer::geometry::ViewInformation2D aViewInformation2D
;
505 const basegfx::B2DRange
aRange(
506 drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(
508 aViewInformation2D
));
510 if(!aRange
.isEmpty())
512 // if we have geometry and it has a range, convert to BitmapEx using
514 aBmp
= convertPrimitive2DSequenceToBitmapEx(
528 GDIMetaFile
SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked
) const
532 if( AreObjectsMarked() )
534 Rectangle
aBound( GetMarkedObjBoundRect() );
535 Size
aBoundSize( aBound
.GetWidth(), aBound
.GetHeight() );
536 MapMode
aMap( pMod
->GetScaleUnit(), Point(), pMod
->GetScaleFraction(), pMod
->GetScaleFraction() );
538 if( bNoVDevIfOneMtfMarked
)
540 SdrObject
* pGrafObjTmp
= GetMarkedObjectByIndex( 0 );
541 SdrGrafObj
* pGrafObj
= ( GetMarkedObjectCount() ==1 ) ? PTR_CAST( SdrGrafObj
, pGrafObjTmp
) : NULL
;
545 Graphic
aGraphic( pGrafObj
->GetTransformedGraphic() );
547 // #119735# just use GetGDIMetaFile, it will create a bufferd version of contained bitmap now automatically
548 aMtf
= aGraphic
.GetGDIMetaFile();
552 if( !aMtf
.GetActionSize() )
555 const Size
aDummySize(2, 2);
557 aOut
.SetOutputSizePixel(aDummySize
);
558 aOut
.EnableOutput(false);
559 aOut
.SetMapMode(aMap
);
568 // moving the result is more reliable then setting a relative MapMode at the VDev (used
569 // before), also see #i99268# in GetObjGraphic() below. Some draw actions at
570 // the OutDev are simply not handled correctly when a MapMode is set at the
571 // target devive, e.g. MetaFloatTransparentAction. Even the Move for this action
572 // was missing the manipulation of the embedded Metafile
573 aMtf
.Move(-aBound
.Left(), -aBound
.Top());
575 aMtf
.SetPrefMapMode( aMap
);
577 // removed PrefSize extension. It is principally wrong to set a reduced size at
578 // the created MetaFile. The mentioned errors occur at output time since the integer
579 // MapModes from VCL lead to errors. It is now corrected in the VCLRenderer for
580 // primitives (and may later be done in breaking up a MetaFile to primitives)
581 aMtf
.SetPrefSize(aBoundSize
);
590 Graphic
SdrExchangeView::GetAllMarkedGraphic() const
594 if( AreObjectsMarked() )
596 if( ( 1 == GetMarkedObjectCount() ) && GetSdrMarkByIndex( 0 ) )
597 aRet
= SdrExchangeView::GetObjGraphic( pMod
, GetMarkedObjectByIndex( 0 ) );
599 aRet
= GetMarkedObjMetaFile(false);
607 Graphic
SdrExchangeView::GetObjGraphic( const SdrModel
* pModel
, const SdrObject
* pObj
)
613 // try to get a graphic from the object first
614 const SdrGrafObj
* pSdrGrafObj
= dynamic_cast< const SdrGrafObj
* >(pObj
);
615 const SdrOle2Obj
* pSdrOle2Obj
= dynamic_cast< const SdrOle2Obj
* >(pObj
);
619 if(pSdrGrafObj
->isEmbeddedSvg())
621 // get Metafile for Svg content
622 aRet
= pSdrGrafObj
->getMetafileFromEmbeddedSvg();
626 // Make behaviour coherent with metafile
627 // recording below (which of course also takes
628 // view-transformed objects)
629 aRet
= pSdrGrafObj
->GetTransformedGraphic();
634 if ( pSdrOle2Obj
->GetGraphic() )
635 aRet
= *pSdrOle2Obj
->GetGraphic();
638 // if graphic could not be retrieved => go the hard way and create a MetaFile
639 if( ( GRAPHIC_NONE
== aRet
.GetType() ) || ( GRAPHIC_DEFAULT
== aRet
.GetType() ) )
643 const Rectangle
aBoundRect( pObj
->GetCurrentBoundRect() );
644 const MapMode
aMap( pModel
->GetScaleUnit(),
646 pModel
->GetScaleFraction(),
647 pModel
->GetScaleFraction() );
649 aOut
.EnableOutput( false );
650 aOut
.SetMapMode( aMap
);
651 aMtf
.Record( &aOut
);
652 pObj
->SingleObjectPainter( aOut
);
656 // #i99268# replace the original offset from using XOutDev's SetOffset
657 // NOT (as tried with #i92760#) with another MapMode which gets recorded
658 // by the Metafile itself (what always leads to problems), but by
659 // moving the result directly
660 aMtf
.Move(-aBoundRect
.Left(), -aBoundRect
.Top());
662 aMtf
.SetPrefMapMode( aMap
);
663 aMtf
.SetPrefSize( aBoundRect
.GetSize() );
665 if( aMtf
.GetActionSize() )
675 ::std::vector
< SdrObject
* > SdrExchangeView::GetMarkedObjects() const
678 ::std::vector
< SdrObject
* > aRetval
;
680 ::std::vector
< ::std::vector
< SdrMark
* > > aObjVectors( 2 );
681 ::std::vector
< SdrMark
* >& rObjVector1
= aObjVectors
[ 0 ];
682 ::std::vector
< SdrMark
* >& rObjVector2
= aObjVectors
[ 1 ];
683 const SdrLayerAdmin
& rLayerAdmin
= pMod
->GetLayerAdmin();
684 const sal_uInt32 nControlLayerId
= rLayerAdmin
.GetLayerID( rLayerAdmin
.GetControlLayerName(), false );
685 sal_uInt32 n
, nCount
;
687 for( n
= 0, nCount
= GetMarkedObjectCount(); n
< nCount
; n
++ )
689 SdrMark
* pMark
= GetSdrMarkByIndex( n
);
691 // paint objects on control layer on top of all other objects
692 if( nControlLayerId
== pMark
->GetMarkedSdrObj()->GetLayer() )
693 rObjVector2
.push_back( pMark
);
695 rObjVector1
.push_back( pMark
);
698 for( n
= 0, nCount
= aObjVectors
.size(); n
< nCount
; n
++ )
700 ::std::vector
< SdrMark
* >& rObjVector
= aObjVectors
[ n
];
702 for( sal_uInt32 i
= 0; i
< rObjVector
.size(); i
++ )
704 SdrMark
* pMark
= rObjVector
[ i
];
705 aRetval
.push_back(pMark
->GetMarkedSdrObj());
714 void SdrExchangeView::DrawMarkedObj(OutputDevice
& rOut
) const
716 ::std::vector
< SdrObject
* > aSdrObjects(GetMarkedObjects());
718 if(aSdrObjects
.size())
720 sdr::contact::ObjectContactOfObjListPainter
aPainter(rOut
, aSdrObjects
, aSdrObjects
[0]->GetPage());
721 sdr::contact::DisplayInfo aDisplayInfo
;
724 aPainter
.ProcessDisplay(aDisplayInfo
);
730 SdrModel
* SdrExchangeView::GetMarkedObjModel() const
732 // Sorting the MarkList here might be problematic in the future, so
735 SdrModel
* pNeuMod
=pMod
->AllocModel();
736 SdrPage
* pNeuPag
=pNeuMod
->AllocPage(false);
737 pNeuMod
->InsertPage(pNeuPag
);
739 if( !mxSelectionController
.is() || !mxSelectionController
->GetMarkedObjModel( pNeuPag
) )
741 ::std::vector
< SdrObject
* > aSdrObjects(GetMarkedObjects());
744 // New mechanism to re-create the connections of cloned connectors
745 CloneList aCloneList
;
747 for( sal_uInt32
i(0); i
< aSdrObjects
.size(); i
++ )
749 const SdrObject
* pObj
= aSdrObjects
[i
];
752 if( pObj
->ISA( SdrPageObj
) )
754 // convert SdrPageObj's to a graphic representation, because
755 // virtual connection to referenced page gets lost in new model
756 pNeuObj
= new SdrGrafObj( GetObjGraphic( pMod
, pObj
), pObj
->GetLogicRect() );
757 pNeuObj
->SetPage( pNeuPag
);
758 pNeuObj
->SetModel( pNeuMod
);
762 pNeuObj
= pObj
->Clone();
763 pNeuObj
->SetPage( pNeuPag
);
764 pNeuObj
->SetModel( pNeuMod
);
767 SdrInsertReason
aReason(SDRREASON_VIEWCALL
);
768 pNeuPag
->InsertObject(pNeuObj
,CONTAINER_APPEND
,&aReason
);
771 aCloneList
.AddPair(pObj
, pNeuObj
);
775 // New mechanism to re-create the connections of cloned connectors
776 aCloneList
.CopyConnections();
783 bool SdrExchangeView::Cut( sal_uIntPtr
/*nFormat */)
785 OSL_FAIL( "SdrExchangeView::Cut: Not supported any more." );
791 bool SdrExchangeView::Yank(sal_uIntPtr
/*nFormat*/)
793 OSL_FAIL( "SdrExchangeView::Yank: Not supported any more." );
799 bool SdrExchangeView::Paste(Window
* /*pWin*/, sal_uIntPtr
/*nFormat*/)
801 OSL_FAIL( "SdrExchangeView::Paste: Not supported any more." );
805 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */