1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
|
/*************************************************************************
*
* $RCSfile: unopage.cxx,v $
*
* $Revision: 1.23 $
*
* last change: $Author: hr $ $Date: 2003-03-27 15:05:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (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.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#define _SVX_USE_UNOGLOBALS_
#ifndef _VOS_MUTEX_HXX_
#include <vos/mutex.hxx>
#endif
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef SVX_LIGHT
#ifndef _SFXDISPATCH_HXX //autogen
#include <sfx2/dispatch.hxx>
#endif
#ifndef _PERSIST_HXX
#include <so3/persist.hxx>
#endif
#ifndef _SOT_CLSIDS_HXX
#include <sot/clsids.hxx>
#endif
#endif
/*
#ifndef _SFX_BINDINGS_HXX
#include <sfx2/bindings.hxx>
#endif
*/
#include <rtl/uuid.h>
#include <rtl/memory.h>
#include "svdobj.hxx"
#include "svdoole2.hxx"
#include "svdpage.hxx"
#include "svdmodel.hxx"
#include "svdview.hxx"
#include "svdpagv.hxx"
#include "unopage.hxx"
#include "shapeimpl.hxx"
#include "globl3d.hxx"
#include "polysc3d.hxx"
#include "unoprov.hxx"
#include "svdopath.hxx"
#include "unoapi.hxx"
#include "svdomeas.hxx"
#ifndef _E3D_EXTRUD3D_HXX
#include <extrud3d.hxx>
#endif
#ifndef _E3D_LATHE3D_HXX
#include <lathe3d.hxx>
#endif
using namespace ::vos;
using namespace ::rtl;
using namespace ::cppu;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::drawing;
#define INTERFACE_TYPE( xint ) \
::getCppuType((const Reference< xint >*)0)
#define QUERYINT( xint ) \
if( rType == ::getCppuType((const Reference< xint >*)0) ) \
aAny <<= Reference< xint >(this)
DECLARE_LIST( SvxDrawPageList, SvxDrawPage * );
extern SfxItemPropertyMap* ImplGetSvxOle2PropertyMap();
extern SfxItemPropertyMap* ImplGetSvxPageShapePropertyMap();
/**********************************************************************
* class SvxDrawPage *
**********************************************************************/
UNO3_GETIMPLEMENTATION_IMPL( SvxDrawPage );
SvxDrawPage::SvxDrawPage( SdrPage* pInPage ) throw() :
pPage ( pInPage ),
pModel ( NULL )
{
// Am Broadcaster anmelden
pModel = pPage->GetModel();
StartListening( *pModel );
// Erzeugen der (hidden) ::com::sun::star::sdbcx::View
pView = new SdrView( pModel );
if( pView )
pView->SetDesignMode(sal_True);
}
//----------------------------------------------------------------------
// Ctor fuer SvxDrawPage_NewInstance()
//----------------------------------------------------------------------
SvxDrawPage::SvxDrawPage() throw() :
pPage ( NULL ),
pModel ( NULL ),
pView ( NULL )
{
}
//----------------------------------------------------------------------
SvxDrawPage::~SvxDrawPage() throw()
{
// Am Broadcaster abmelden
if( pModel )
EndListening( *pModel );
delete pView;
}
SvxDrawPage* SvxDrawPage::GetPageForSdrPage( SdrPage* pPage ) throw()
{
return getImplementation( pPage->getUnoPage() );
}
// SfxListener
//----------------------------------------------------------------------
void SvxDrawPage::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
if( pModel )
{
const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
sal_Bool bInvalid = sal_False;
if( pSdrHint )
{
switch( pSdrHint->GetKind() )
{
case HINT_MODELCLEARED:
bInvalid = sal_True;
break;
case HINT_PAGEORDERCHG:
{
const SdrPage* pPg=pSdrHint->GetPage();
if( pPg == pPage ) // own page?
{
if(!pPg->IsInserted()) // page removed?
bInvalid = sal_True;
}
}
break;
}
}
if( bInvalid )
{
pModel = NULL;
delete pView;
pView = NULL;
}
}
}
// ::com::sun::star::drawing::XShapes
//----------------------------------------------------------------------
void SAL_CALL SvxDrawPage::add( const Reference< drawing::XShape >& xShape )
throw( uno::RuntimeException )
{
OGuard aGuard( Application::GetSolarMutex() );
SvxShape* pShape = SvxShape::getImplementation( xShape );
if( NULL == pShape )
return;
SdrObject *pObj = pShape->GetSdrObject();
if(!pObj)
{
pObj = CreateSdrObject( xShape );
}
else if ( !pObj->IsInserted() )
{
pObj->SetModel(pModel);
pPage->InsertObject( pObj );
}
if(pObj == NULL)
return;
if(pShape)
pShape->Create( pObj, this );
if( pModel )
pModel->SetChanged();
}
//----------------------------------------------------------------------
void SAL_CALL SvxDrawPage::remove( const Reference< drawing::XShape >& xShape )
throw( uno::RuntimeException )
{
OGuard aGuard( Application::GetSolarMutex() );
SvxShape* pShape = SvxShape::getImplementation( xShape );
if(pShape)
{
SdrObject* pObj = pShape->GetSdrObject();
if(pObj)
{
// SdrObject aus der Page loeschen
sal_uInt32 nCount = pPage->GetObjCount();
for( sal_uInt32 nNum = 0; nNum < nCount; nNum++ )
{
if(pPage->GetObj(nNum) == pObj)
{
delete pPage->RemoveObject(nNum);
pShape->InvalidateSdrObject();
break;
}
}
}
}
if( pModel )
pModel->SetChanged();
}
// ::com::sun::star::container::XIndexAccess
//----------------------------------------------------------------------
sal_Int32 SAL_CALL SvxDrawPage::getCount()
throw( uno::RuntimeException )
{
return( (sal_Int32) pPage->GetObjCount() );
}
//----------------------------------------------------------------------
uno::Any SAL_CALL SvxDrawPage::getByIndex( sal_Int32 Index )
throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
{
OGuard aGuard( Application::GetSolarMutex() );
if(pPage == NULL)
throw uno::RuntimeException();
if ( Index < 0 || Index >= (sal_Int32)pPage->GetObjCount() )
throw lang::IndexOutOfBoundsException();
SdrObject* pObj = pPage->GetObj( Index );
if( pObj == NULL )
throw uno::RuntimeException();
return makeAny(Reference< drawing::XShape >( pObj->getUnoShape(), uno::UNO_QUERY ));
}
// ::com::sun::star::container::XElementAccess
//----------------------------------------------------------------------
uno::Type SAL_CALL SvxDrawPage::getElementType()
throw( uno::RuntimeException )
{
return INTERFACE_TYPE( drawing::XShape );
}
//----------------------------------------------------------------------
sal_Bool SAL_CALL SvxDrawPage::hasElements()
throw( uno::RuntimeException )
{
return pPage?(pPage->GetObjCount()>0):sal_False;
}
//----------------------------------------------------------------------
// ACHTUNG: _SelectObjectsInView selektiert die ::com::sun::star::drawing::Shapes nur in der angegebennen
// SdrPageView. Dies mu nicht die sichtbare SdrPageView sein.
//----------------------------------------------------------------------
void SvxDrawPage::_SelectObjectsInView( const Reference< drawing::XShapes > & aShapes, SdrPageView* pPageView ) throw ()
{
DBG_ASSERT(pPageView,"SdrPageView ist NULL! [CL]");
DBG_ASSERT(pView, "SdrView ist NULL! [CL]");
if(pPageView!=NULL && pView!=NULL)
{
pView->UnmarkAllObj( pPageView );
long nCount = aShapes->getCount();
for( long i = 0; i < nCount; i++ )
{
uno::Any aAny( aShapes->getByIndex(i) );
Reference< drawing::XShape > xShape;
if( aAny >>= xShape )
{
SvxShape* pShape = SvxShape::getImplementation( xShape );
if( pShape )
pView->MarkObj( pShape->pObj, pPageView );
}
}
}
}
//----------------------------------------------------------------------
// ACHTUNG: _SelectObjectInView selektiert das Shape *nur* in der angegebennen
// SdrPageView. Dies mu nicht die sichtbare SdrPageView sein.
//----------------------------------------------------------------------
void SvxDrawPage::_SelectObjectInView( const Reference< drawing::XShape > & xShape, SdrPageView* pPageView ) throw()
{
DBG_ASSERT(pPageView,"SdrPageView ist NULL! [CL]");
DBG_ASSERT(pView, "SdrView ist NULL! [CL]");
if(pPageView!=NULL && pView != NULL)
{
pView->UnmarkAllObj( pPageView );
SvxShape* pShape = SvxShape::getImplementation( xShape );
if( pShape )
pView->MarkObj( pShape->pObj, pPageView );
}
}
//----------------------------------------------------------------------
Reference< drawing::XShapeGroup > SAL_CALL SvxDrawPage::group( const Reference< drawing::XShapes >& xShapes )
throw( uno::RuntimeException )
{
OGuard aGuard( Application::GetSolarMutex() );
DBG_ASSERT(pPage,"SdrPage ist NULL! [CL]");
DBG_ASSERT(pView, "SdrView ist NULL! [CL]");
Reference< ::com::sun::star::drawing::XShapeGroup > xShapeGroup;
if(pPage==NULL||pView==NULL||!xShapes.is())
return xShapeGroup;
SdrPageView* pPageView = pView->ShowPage( pPage, Point() );
_SelectObjectsInView( xShapes, pPageView );
pView->GroupMarked();
pView->AdjustMarkHdl();
const SdrMarkList& rMarkList = pView->GetMarkList();
if( rMarkList.GetMarkCount() == 1 )
{
SdrObject* pObj = rMarkList.GetMark(0)->GetObj();
if( pObj )
xShapeGroup = Reference< drawing::XShapeGroup >::query( pObj->getUnoShape() );
}
pView->HidePage(pPageView);
if( pModel )
pModel->SetChanged();
return xShapeGroup;
}
//----------------------------------------------------------------------
void SAL_CALL SvxDrawPage::ungroup( const Reference< drawing::XShapeGroup >& aGroup )
throw( uno::RuntimeException )
{
OGuard aGuard( Application::GetSolarMutex() );
DBG_ASSERT(pPage,"SdrPage ist NULL! [CL]");
DBG_ASSERT(pView, "SdrView ist NULL! [CL]");
if(pPage==NULL||pView==NULL||!aGroup.is())
return;
SdrPageView* pPageView = pView->ShowPage( pPage, Point() );
Reference< drawing::XShape > xShape( aGroup, UNO_QUERY );
_SelectObjectInView( xShape, pPageView );
pView->UnGroupMarked();
pView->HidePage(pPageView);
if( pModel )
pModel->SetChanged();
}
//----------------------------------------------------------------------
SdrObject *SvxDrawPage::_CreateSdrObject( const Reference< drawing::XShape > & xShape ) throw()
{
sal_uInt16 nType;
sal_uInt32 nInventor;
GetTypeAndInventor( nType, nInventor, xShape->getShapeType() );
SdrObject* pNewObj = 0;
if( nType != 0 )
{
awt::Size aSize = xShape->getSize();
aSize.Width += 1;
aSize.Height += 1;
awt::Point aPos = xShape->getPosition();
Rectangle aRect( Point( aPos.X, aPos.Y ), Size( aSize.Width, aSize.Height ) );
// special cases
if( nInventor == SdrInventor )
{
switch( nType )
{
case OBJ_MEASURE:
pNewObj = new SdrMeasureObj( aRect.TopLeft(), aRect.BottomRight() );
break;
case OBJ_LINE:
pNewObj = new SdrPathObj( aRect.TopLeft(), aRect.BottomRight() );
break;
}
}
if( pNewObj == NULL )
pNewObj = SdrObjFactory::MakeNewObject( nInventor, nType, pPage );
if(pNewObj)
{
pNewObj->SetSnapRect(aRect);
if( pNewObj->ISA(E3dPolyScene))
{
// Szene initialisieren
E3dScene* pScene = (E3dScene*)pNewObj;
double fW = (double)aSize.Width;
double fH = (double)aSize.Height;
Camera3D aCam(pScene->GetCamera());
aCam.SetAutoAdjustProjection(sal_False);
aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH);
Vector3D aLookAt;
Vector3D aCamPos(0.0, 0.0, 10000.0);
aCam.SetPosAndLookAt(aCamPos, aLookAt);
aCam.SetFocalLength(100.0);
aCam.SetDefaults(aCamPos, aLookAt, 10000.0);
pScene->SetCamera(aCam);
pScene->SetRectsDirty();
pScene->InitTransformationSet();
}
else if(pNewObj->ISA(E3dExtrudeObj))
{
E3dExtrudeObj* pObj = (E3dExtrudeObj*)pNewObj;
Polygon3D aNewP(3);
aNewP[0] = Vector3D(0,0,0);
aNewP[1] = Vector3D(0,1,0);
aNewP[2] = Vector3D(1,0,0);
// #87922#
// To avoid that CreateGeometry(...) sets the DoubleSided
// item at once, use a closed poylgon.
aNewP.SetClosed(TRUE);
PolyPolygon3D aNewPP(aNewP);
pObj->SetExtrudePolygon(aNewPP);
// #107245# pObj->SetExtrudeCharacterMode(TRUE);
pObj->SetItem(Svx3DCharacterModeItem(sal_True));
}
else if(pNewObj->ISA(E3dLatheObj))
{
E3dLatheObj* pObj = (E3dLatheObj*)pNewObj;
Polygon3D aNewP(3);
aNewP[0] = Vector3D(0,0,0);
aNewP[1] = Vector3D(0,1,0);
aNewP[2] = Vector3D(1,0,0);
// #87922#
// To avoid that CreateGeometry(...) sets the DoubleSided
// item at once, use a closed poylgon.
aNewP.SetClosed(TRUE);
PolyPolygon3D aNewPP(aNewP);
pObj->SetPolyPoly3D(aNewPP);
// #107245# pObj->SetLatheCharacterMode(TRUE);
pObj->SetItem(Svx3DCharacterModeItem(sal_True));
}
}
}
return pNewObj;
}
//----------------------------------------------------------------------
void SvxDrawPage::GetTypeAndInventor( sal_uInt16& rType, sal_uInt32& rInventor, const OUString& aName ) const throw()
{
sal_uInt32 nTempType = aSdrShapeIdentifierMap.getId( aName );
if(nTempType & E3D_INVENTOR_FLAG)
{
rInventor = E3dInventor;
rType = (sal_uInt16)(nTempType & ~E3D_INVENTOR_FLAG);
}
else
{
rInventor = SdrInventor;
rType = (sal_uInt16)nTempType;
switch( rType )
{
case OBJ_FRAME:
case OBJ_OLE2_PLUGIN:
case OBJ_OLE2_APPLET:
rType = OBJ_OLE2;
break;
}
}
}
//----------------------------------------------------------------------
SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor, SdrObject *pObj, SvxDrawPage *pPage ) throw()
{
SvxShape* pRet = NULL;
switch( nInventor )
{
case E3dInventor:
{
switch( nType )
{
case E3D_SCENE_ID :
case E3D_POLYSCENE_ID :
pRet = new Svx3DSceneObject( pObj, pPage );
break;
case E3D_CUBEOBJ_ID :
pRet = new Svx3DCubeObject( pObj );
break;
case E3D_SPHEREOBJ_ID :
pRet = new Svx3DSphereObject( pObj );
break;
case E3D_LATHEOBJ_ID :
pRet = new Svx3DLatheObject( pObj );
break;
case E3D_EXTRUDEOBJ_ID :
pRet = new Svx3DExtrudeObject( pObj );
break;
case E3D_POLYGONOBJ_ID :
pRet = new Svx3DPolygonObject( pObj );
break;
default: // unbekanntes 3D-Objekt auf der Page
pRet = new SvxShape( pObj );
break;
}
break;
}
case SdrInventor:
{
switch( nType )
{
// case OBJ_NONE:
// break;
case OBJ_GRUP:
pRet = new SvxShapeGroup( pObj, pPage );
break;
case OBJ_LINE:
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_LINE );
break;
case OBJ_RECT:
pRet = new SvxShapeRect( pObj );
break;
case OBJ_CIRC:
case OBJ_SECT:
case OBJ_CARC:
case OBJ_CCUT:
pRet = new SvxShapeCircle( pObj );
break;
case OBJ_POLY:
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_POLY );
break;
case OBJ_PLIN:
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PLIN );
break;
case OBJ_SPLNLINE:
case OBJ_PATHLINE:
pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHLINE );
break;
case OBJ_SPLNFILL:
case OBJ_PATHFILL:
pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_PATHFILL );
break;
case OBJ_FREELINE:
pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREELINE );
break;
case OBJ_FREEFILL:
pRet = new SvxShapePolyPolygonBezier( pObj , PolygonKind_FREEFILL );
break;
case OBJ_CAPTION:
pRet = new SvxShapeCaption( pObj );
break;
case OBJ_TITLETEXT:
case OBJ_OUTLINETEXT:
case OBJ_TEXT:
pRet = new SvxShapeText( pObj );
break;
case OBJ_GRAF:
pRet = new SvxGraphicObject( pObj );
break;
case OBJ_FRAME:
#ifndef SVX_LIGHT
pRet = new SvxFrameShape( pObj );
break;
#endif
case OBJ_OLE2_APPLET:
#ifndef SVX_LIGHT
pRet = new SvxAppletShape( pObj );
break;
#endif
case OBJ_OLE2_PLUGIN:
#ifndef SVX_LIGHT
pRet = new SvxPluginShape( pObj );
break;
#endif
case OBJ_OLE2:
{
#ifndef SVX_LIGHT
if( pObj && !pObj->IsEmptyPresObj() )
{
SvPersist *pPersist = pPage->GetSdrPage()->GetModel()->GetPersist();
if( pPersist )
{
const SvInfoObject *pInfo = pPersist->Find( static_cast< SdrOle2Obj* >( pObj )->GetPersistName() );
DBG_ASSERT( pInfo, "no info object for OLE object found" );
// CL->KA: Why is this not working anymore?
if( pInfo )
{
const SvGlobalName aClassId( pInfo->GetClassName() );
const SvGlobalName aAppletClassId( SO3_APPLET_CLASSID );
const SvGlobalName aPluginClassId( SO3_PLUGIN_CLASSID );
const SvGlobalName aIFrameClassId( SO3_IFRAME_CLASSID );
if( aPluginClassId == aClassId )
{
pRet = new SvxPluginShape( pObj );
nType = OBJ_OLE2_PLUGIN;
}
else if( aAppletClassId == aClassId )
{
pRet = new SvxAppletShape( pObj );
nType = OBJ_OLE2_APPLET;
}
else if( aIFrameClassId == aClassId )
{
pRet = new SvxFrameShape( pObj );
nType = OBJ_FRAME;
}
}
}
}
#endif
if( pRet == NULL )
{
pRet = new SvxOle2Shape( pObj, ImplGetSvxOle2PropertyMap() );
}
break;
}
case OBJ_EDGE:
pRet = new SvxShapeConnector( pObj );
break;
case OBJ_PATHPOLY:
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPOLY );
break;
case OBJ_PATHPLIN:
pRet = new SvxShapePolyPolygon( pObj , PolygonKind_PATHPLIN );
break;
case OBJ_PAGE:
pRet = new SvxShape( pObj, ImplGetSvxPageShapePropertyMap() );
break;
case OBJ_MEASURE:
pRet = new SvxShapeDimensioning( pObj );
break;
// case OBJ_DUMMY:
// break;
case OBJ_UNO:
pRet = new SvxShapeControl( pObj );
break;
default: // unbekanntes 2D-Objekt auf der Page
DBG_ERROR("Nicht implementierter Starone-Shape erzeugt! [CL]");
pRet = new SvxShapeText( pObj );
break;
}
break;
}
default: // Unbekannter Inventor
{
DBG_ERROR("AW: Unknown Inventor in SvxDrawPage::_CreateShape()");
break;
}
}
if(pRet)
{
sal_uInt32 nObjId = nType;
if( nInventor == E3dInventor )
nObjId |= E3D_INVENTOR_FLAG;
switch(nObjId)
{
case OBJ_CCUT: // Kreisabschnitt
case OBJ_CARC: // Kreisbogen
case OBJ_SECT: // Kreissektor
nObjId = OBJ_CIRC;
break;
case E3D_SCENE_ID | E3D_INVENTOR_FLAG:
nObjId = E3D_POLYSCENE_ID | E3D_INVENTOR_FLAG;
break;
case OBJ_TITLETEXT:
case OBJ_OUTLINETEXT:
nObjId = OBJ_TEXT;
break;
}
pRet->setShapeKind(nObjId);
}
return pRet;
}
//----------------------------------------------------------------------
Reference< drawing::XShape > SvxDrawPage::_CreateShape( SdrObject *pObj ) const throw()
{
Reference< drawing::XShape > xShape( CreateShapeByTypeAndInventor(pObj->GetObjIdentifier(),
pObj->GetObjInventor(),
pObj,
(SvxDrawPage*)this));
return xShape;
}
//----------------------------------------------------------------------
SdrObject *SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xShape ) throw()
{
SdrObject* pObj = _CreateSdrObject( xShape );
if( pObj && !pObj->IsInserted() )
pPage->InsertObject( pObj );
return pObj;
}
//----------------------------------------------------------------------
// ::com::sun::star::lang::XServiceInfo
//----------------------------------------------------------------------
OUString SAL_CALL SvxDrawPage::getImplementationName() throw( uno::RuntimeException )
{
return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxDrawPage"));
}
sal_Bool SAL_CALL SvxDrawPage::supportsService( const OUString& ServiceName )
throw(::com::sun::star::uno::RuntimeException)
{
return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
}
uno::Sequence< OUString > SAL_CALL SvxDrawPage::getSupportedServiceNames() throw( uno::RuntimeException )
{
uno::Sequence< OUString > aSeq( 1 );
aSeq.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ShapeCollection" ));
return aSeq;
}
SvxShape* CreateSvxShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt32 nInventor ) throw()
{
return SvxDrawPage::CreateShapeByTypeAndInventor( nType, nInventor );
}
|