bump product version to 4.1.6.2
[LibreOffice.git] / svx / source / unodraw / unoshap2.cxx
blobe96f7e12b56032b7fc978d6afc22930183e9da06
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <com/sun/star/lang/DisposedException.hpp>
21 #include <com/sun/star/awt/FontSlant.hpp>
22 #include <com/sun/star/style/VerticalAlignment.hpp>
23 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
24 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
25 #include <com/sun/star/awt/TextAlign.hpp>
26 #include <com/sun/star/style/ParagraphAdjust.hpp>
27 #include <com/sun/star/drawing/PointSequenceSequence.hpp>
28 #include <com/sun/star/drawing/PointSequence.hpp>
29 #include <com/sun/star/graphic/XGraphic.hpp>
30 #include <tools/urlobj.hxx>
31 #include <unotools/localfilehelper.hxx>
32 #include <vcl/svapp.hxx>
33 #include <osl/mutex.hxx>
34 #include <vcl/fltcall.hxx>
35 #include <vcl/graphicfilter.hxx>
37 #include <boost/scoped_ptr.hpp>
38 #include <svx/svdpool.hxx>
40 #include <editeng/unoprnms.hxx>
41 #include <svx/unoshape.hxx>
42 #include <svx/unopage.hxx>
43 #include <svx/svdobj.hxx>
44 #include <svx/svdpage.hxx>
45 #include <svx/svdmodel.hxx>
46 #include <svx/svdouno.hxx>
47 #include "shapeimpl.hxx"
48 #include "svx/unoshprp.hxx"
49 #include <svx/svdoashp.hxx>
51 // #i29181#
52 #include "svx/svdviter.hxx"
53 #include <svx/svdview.hxx>
54 #include <basegfx/matrix/b2dhommatrix.hxx>
55 #include <basegfx/polygon/b2dpolygon.hxx>
56 #include <basegfx/point/b2dpoint.hxx>
57 #include <basegfx/polygon/b2dpolygontools.hxx>
58 #include <basegfx/tools/unotools.hxx>
60 #include <comphelper/servicehelper.hxx>
61 #include <vcl/wmf.hxx>
63 using namespace ::osl;
64 using namespace ::cppu;
65 using namespace ::com::sun::star;
66 using namespace ::com::sun::star::uno;
67 using namespace ::com::sun::star::lang;
68 using namespace ::com::sun::star::container;
70 #define QUERYINT( xint ) \
71 if( rType == ::getCppuType((const Reference< xint >*)0) ) \
72 aAny <<= Reference< xint >(this)
74 /***********************************************************************
75 * class SvxShapeGroup *
76 ***********************************************************************/
78 SvxShapeGroup::SvxShapeGroup( SdrObject* pObj, SvxDrawPage* pDrawPage ) throw() :
79 SvxShape( pObj, getSvxMapProvider().GetMap(SVXMAP_GROUP), getSvxMapProvider().GetPropertySet(SVXMAP_GROUP, SdrObject::GetGlobalDrawObjectItemPool()) ),
80 mxPage( pDrawPage )
84 //----------------------------------------------------------------------
85 SvxShapeGroup::~SvxShapeGroup() throw()
89 //----------------------------------------------------------------------
90 void SvxShapeGroup::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
92 SvxShape::Create( pNewObj, pNewPage );
93 mxPage = pNewPage;
96 //----------------------------------------------------------------------
97 uno::Any SAL_CALL SvxShapeGroup::queryInterface( const uno::Type & rType )
98 throw(uno::RuntimeException)
100 return SvxShape::queryInterface( rType );
103 uno::Any SAL_CALL SvxShapeGroup::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
105 uno::Any aAny;
107 QUERYINT( drawing::XShapeGroup );
108 else QUERYINT( drawing::XShapes );
109 else QUERYINT( container::XIndexAccess );
110 else QUERYINT( container::XElementAccess );
111 else
112 return SvxShape::queryAggregation( rType );
114 return aAny;
117 void SAL_CALL SvxShapeGroup::acquire() throw ( )
119 SvxShape::acquire();
122 void SAL_CALL SvxShapeGroup::release() throw ( )
124 SvxShape::release();
127 uno::Sequence< uno::Type > SAL_CALL SvxShapeGroup::getTypes()
128 throw (uno::RuntimeException)
130 return SvxShape::getTypes();
133 namespace
135 class theSvxShapeGroupImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxShapeGroupImplementationId > {};
138 uno::Sequence< sal_Int8 > SAL_CALL SvxShapeGroup::getImplementationId()
139 throw (uno::RuntimeException)
141 return theSvxShapeGroupImplementationId::get().getSeq();
144 // ::com::sun::star::drawing::XShape
146 //----------------------------------------------------------------------
147 OUString SAL_CALL SvxShapeGroup::getShapeType()
148 throw( uno::RuntimeException )
150 return SvxShape::getShapeType();
153 //------------------------------------------------------------------1----
154 awt::Point SAL_CALL SvxShapeGroup::getPosition() throw(uno::RuntimeException)
156 return SvxShape::getPosition();
159 //----------------------------------------------------------------------
160 void SAL_CALL SvxShapeGroup::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
162 SvxShape::setPosition(Position);
165 //----------------------------------------------------------------------
167 awt::Size SAL_CALL SvxShapeGroup::getSize() throw(uno::RuntimeException)
169 return SvxShape::getSize();
172 //----------------------------------------------------------------------
173 void SAL_CALL SvxShapeGroup::setSize( const awt::Size& rSize )
174 throw(beans::PropertyVetoException, uno::RuntimeException)
176 SvxShape::setSize( rSize );
179 // drawing::XShapeGroup
181 //----------------------------------------------------------------------
182 void SAL_CALL SvxShapeGroup::enterGroup( ) throw(uno::RuntimeException)
184 // Todo
185 // pDrView->EnterMarkedGroup();
188 //----------------------------------------------------------------------
189 void SAL_CALL SvxShapeGroup::leaveGroup( ) throw(uno::RuntimeException)
191 // Todo
192 // pDrView->LeaveOneGroup();
195 //----------------------------------------------------------------------
197 // XShapes
198 void SAL_CALL SvxShapeGroup::add( const uno::Reference< drawing::XShape >& xShape )
199 throw( uno::RuntimeException )
201 ::SolarMutexGuard aGuard;
203 SvxShape* pShape = SvxShape::getImplementation( xShape );
205 if( mpObj.is()&& mxPage.is() && pShape )
207 SdrObject* pSdrShape = pShape->GetSdrObject();
208 if( pSdrShape == NULL )
209 pSdrShape = mxPage->_CreateSdrObject( xShape );
211 if( pSdrShape->IsInserted() )
212 pSdrShape->GetObjList()->RemoveObject( pSdrShape->GetOrdNum() );
214 mpObj->GetSubList()->InsertObject( pSdrShape );
215 pSdrShape->SetModel(mpObj->GetModel());
217 // #85922# It makes no sense to set the layer asked
218 // from the group object since these is an iteration
219 // over the contained objects. In consequence, this
220 // statement erases all layer information from the draw
221 // objects. Layers need to be set at draw objects directly
222 // and have nothing to do with grouping at all.
223 // pSdrShape->SetLayer(pObject->GetLayer());
225 // Establish connection between new SdrObject and its wrapper before
226 // inserting the new shape into the group. There a new wrapper
227 // would be created when this connection would not already exist.
228 pShape->Create( pSdrShape, mxPage.get() );
230 if( mpModel )
231 mpModel->SetChanged();
233 else
235 OSL_FAIL("could not add XShape to group shape!");
239 //----------------------------------------------------------------------
240 void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xShape )
241 throw( uno::RuntimeException )
243 ::SolarMutexGuard aGuard;
245 SdrObject* pSdrShape = NULL;
246 SvxShape* pShape = SvxShape::getImplementation( xShape );
248 if( pShape )
249 pSdrShape = pShape->GetSdrObject();
251 if( !mpObj.is() || pSdrShape == NULL || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get() )
252 throw uno::RuntimeException();
254 SdrObjList& rList = *pSdrShape->GetObjList();
256 const sal_uInt32 nObjCount = rList.GetObjCount();
257 sal_uInt32 nObjNum = 0;
258 while( nObjNum < nObjCount )
260 if(rList.GetObj( nObjNum ) == pSdrShape )
261 break;
262 nObjNum++;
265 if( nObjNum < nObjCount )
267 // #i29181#
268 // If the SdrObject which is about to be deleted is in any selection,
269 // deselect it first.
270 SdrViewIter aIter( pSdrShape );
272 for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
274 if(CONTAINER_ENTRY_NOTFOUND != pView->TryToFindMarkedObject(pSdrShape))
276 pView->MarkObj(pSdrShape, pView->GetSdrPageView(), sal_True, sal_False);
280 SdrObject* pObject = rList.NbcRemoveObject( nObjNum );
281 SdrObject::Free( pObject );
283 else
285 DBG_ASSERT( 0, "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
288 if( mpModel )
289 mpModel->SetChanged();
292 // XIndexAccess
294 //----------------------------------------------------------------------
295 sal_Int32 SAL_CALL SvxShapeGroup::getCount() throw( uno::RuntimeException )
297 ::SolarMutexGuard aGuard;
299 sal_Int32 nRetval = 0;
301 if(mpObj.is() && mpObj->GetSubList())
302 nRetval = mpObj->GetSubList()->GetObjCount();
303 else
304 throw uno::RuntimeException();
306 return nRetval;
309 //----------------------------------------------------------------------
310 uno::Any SAL_CALL SvxShapeGroup::getByIndex( sal_Int32 Index )
311 throw( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException )
313 ::SolarMutexGuard aGuard;
315 if( !mpObj.is() || mpObj->GetSubList() == NULL )
316 throw uno::RuntimeException();
318 if( mpObj->GetSubList()->GetObjCount() <= (sal_uInt32)Index )
319 throw lang::IndexOutOfBoundsException();
321 SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
323 if(pDestObj == NULL)
324 throw lang::IndexOutOfBoundsException();
326 Reference< drawing::XShape > xShape( pDestObj->getUnoShape(), uno::UNO_QUERY );
327 return uno::makeAny( xShape );
330 // ::com::sun::star::container::XElementAccess
332 //----------------------------------------------------------------------
333 uno::Type SAL_CALL SvxShapeGroup::getElementType() throw( uno::RuntimeException )
335 return ::getCppuType(( const Reference< drawing::XShape >*)0);
338 //----------------------------------------------------------------------
339 sal_Bool SAL_CALL SvxShapeGroup::hasElements() throw( uno::RuntimeException )
341 ::SolarMutexGuard aGuard;
343 return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
346 //----------------------------------------------------------------------
347 // ::com::sun::star::lang::XServiceInfo
349 uno::Sequence< OUString > SAL_CALL SvxShapeGroup::getSupportedServiceNames()
350 throw(uno::RuntimeException)
352 return SvxShape::getSupportedServiceNames();
355 /***********************************************************************
357 ***********************************************************************/
359 SvxShapeConnector::SvxShapeConnector( SdrObject* pObj ) throw() :
360 SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CONNECTOR), getSvxMapProvider().GetPropertySet(SVXMAP_CONNECTOR, SdrObject::GetGlobalDrawObjectItemPool()) )
364 //----------------------------------------------------------------------
365 SvxShapeConnector::~SvxShapeConnector() throw()
369 //----------------------------------------------------------------------
371 uno::Any SAL_CALL SvxShapeConnector::queryInterface( const uno::Type & rType )
372 throw(uno::RuntimeException)
374 return SvxShapeText::queryInterface( rType );
377 uno::Any SAL_CALL SvxShapeConnector::queryAggregation( const uno::Type & rType )
378 throw(uno::RuntimeException)
380 uno::Any aAny;
382 QUERYINT( drawing::XConnectorShape );
383 else
384 return SvxShapeText::queryAggregation( rType );
386 return aAny;
389 void SAL_CALL SvxShapeConnector::acquire() throw ( )
391 SvxShapeText::acquire();
394 void SAL_CALL SvxShapeConnector::release() throw ( )
396 SvxShapeText::release();
398 // XTypeProvider
400 uno::Sequence< uno::Type > SAL_CALL SvxShapeConnector::getTypes()
401 throw (uno::RuntimeException)
403 return SvxShape::getTypes();
406 namespace
408 class theSvxShapeConnectorImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxShapeConnectorImplementationId > {};
411 uno::Sequence< sal_Int8 > SAL_CALL SvxShapeConnector::getImplementationId()
412 throw (uno::RuntimeException)
414 return theSvxShapeConnectorImplementationId::get().getSeq();
417 // ::com::sun::star::drawing::XShape
419 //----------------------------------------------------------------------
420 OUString SAL_CALL SvxShapeConnector::getShapeType()
421 throw( uno::RuntimeException )
423 return SvxShapeText::getShapeType();
426 //------------------------------------------------------------------1----
427 awt::Point SAL_CALL SvxShapeConnector::getPosition() throw(uno::RuntimeException)
429 return SvxShapeText::getPosition();
432 //----------------------------------------------------------------------
433 void SAL_CALL SvxShapeConnector::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
435 SvxShapeText::setPosition(Position);
438 //----------------------------------------------------------------------
440 awt::Size SAL_CALL SvxShapeConnector::getSize() throw(uno::RuntimeException)
442 return SvxShapeText::getSize();
445 //----------------------------------------------------------------------
446 void SAL_CALL SvxShapeConnector::setSize( const awt::Size& rSize )
447 throw(beans::PropertyVetoException, uno::RuntimeException)
449 SvxShapeText::setSize( rSize );
452 //----------------------------------------------------------------------
454 // XConnectorShape
456 void SAL_CALL SvxShapeConnector::connectStart( const uno::Reference< drawing::XConnectableShape >& xShape, drawing::ConnectionType ) throw( uno::RuntimeException )
458 ::SolarMutexGuard aGuard;
460 Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
461 SvxShape* pShape = SvxShape::getImplementation( xRef );
463 if( pShape )
464 mpObj->ConnectToNode( sal_True, pShape->mpObj.get() );
466 if( mpModel )
467 mpModel->SetChanged();
470 //----------------------------------------------------------------------
471 void SAL_CALL SvxShapeConnector::connectEnd( const uno::Reference< drawing::XConnectableShape >& xShape, drawing::ConnectionType )
472 throw( uno::RuntimeException )
474 ::SolarMutexGuard aGuard;
476 Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
477 SvxShape* pShape = SvxShape::getImplementation( xRef );
479 if( mpObj.is() && pShape )
480 mpObj->ConnectToNode( sal_False, pShape->mpObj.get() );
482 if( mpModel )
483 mpModel->SetChanged();
486 //----------------------------------------------------------------------
487 void SAL_CALL SvxShapeConnector::disconnectBegin( const uno::Reference< drawing::XConnectableShape >& )
488 throw( uno::RuntimeException )
490 ::SolarMutexGuard aGuard;
492 if(mpObj.is())
493 mpObj->DisconnectFromNode( sal_True );
495 if( mpModel )
496 mpModel->SetChanged();
499 //----------------------------------------------------------------------
500 void SAL_CALL SvxShapeConnector::disconnectEnd( const uno::Reference< drawing::XConnectableShape >& )
501 throw( uno::RuntimeException )
503 ::SolarMutexGuard aGuard;
505 if(mpObj.is())
506 mpObj->DisconnectFromNode( sal_False );
508 if( mpModel )
509 mpModel->SetChanged();
512 //----------------------------------------------------------------------
513 // ::com::sun::star::lang::XServiceInfo
514 //----------------------------------------------------------------------
515 uno::Sequence< OUString > SAL_CALL SvxShapeConnector::getSupportedServiceNames() throw( uno::RuntimeException )
517 return SvxShapeText::getSupportedServiceNames();
520 /***********************************************************************
521 * class SvxShapeControl *
522 ***********************************************************************/
523 DBG_NAME(SvxShapeControl)
525 SvxShapeControl::SvxShapeControl( SdrObject* pObj ) throw() :
526 SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CONTROL), getSvxMapProvider().GetPropertySet(SVXMAP_CONTROL, SdrObject::GetGlobalDrawObjectItemPool()) )
528 DBG_CTOR(SvxShapeControl,NULL);
529 setShapeKind( OBJ_UNO );
532 //----------------------------------------------------------------------
533 SvxShapeControl::~SvxShapeControl() throw()
535 DBG_DTOR(SvxShapeControl,NULL);
538 //----------------------------------------------------------------------
539 uno::Any SAL_CALL SvxShapeControl::queryInterface( const uno::Type & rType )
540 throw(uno::RuntimeException)
542 return SvxShapeText::queryInterface( rType );
545 uno::Any SAL_CALL SvxShapeControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
547 uno::Any aAny;
549 QUERYINT( drawing::XControlShape );
550 else
551 return SvxShapeText::queryAggregation( rType );
553 return aAny;
556 void SAL_CALL SvxShapeControl::acquire() throw ( )
558 SvxShapeText::acquire();
561 void SAL_CALL SvxShapeControl::release() throw ( )
563 SvxShapeText::release();
565 // XTypeProvider
567 uno::Sequence< uno::Type > SAL_CALL SvxShapeControl::getTypes()
568 throw (uno::RuntimeException)
570 return SvxShape::getTypes();
573 namespace
575 class theSvxShapeControlImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxShapeControlImplementationId > {};
578 uno::Sequence< sal_Int8 > SAL_CALL SvxShapeControl::getImplementationId()
579 throw (uno::RuntimeException)
581 return theSvxShapeControlImplementationId::get().getSeq();
584 // ::com::sun::star::drawing::XShape
586 //----------------------------------------------------------------------
587 OUString SAL_CALL SvxShapeControl::getShapeType()
588 throw( uno::RuntimeException )
590 return SvxShapeText::getShapeType();
593 //------------------------------------------------------------------1----
594 awt::Point SAL_CALL SvxShapeControl::getPosition() throw(uno::RuntimeException)
596 return SvxShapeText::getPosition();
599 //----------------------------------------------------------------------
600 void SAL_CALL SvxShapeControl::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
602 SvxShapeText::setPosition(Position);
605 //----------------------------------------------------------------------
607 awt::Size SAL_CALL SvxShapeControl::getSize() throw(uno::RuntimeException)
609 return SvxShapeText::getSize();
612 //----------------------------------------------------------------------
613 void SAL_CALL SvxShapeControl::setSize( const awt::Size& rSize )
614 throw(beans::PropertyVetoException, uno::RuntimeException)
616 SvxShapeText::setSize( rSize );
619 //----------------------------------------------------------------------
620 // XControlShape
622 Reference< awt::XControlModel > SAL_CALL SvxShapeControl::getControl()
623 throw( uno::RuntimeException )
625 ::SolarMutexGuard aGuard;
627 Reference< awt::XControlModel > xModel;
629 SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
630 if( pUnoObj )
631 xModel = pUnoObj->GetUnoControlModel();
633 return xModel;
636 //----------------------------------------------------------------------
637 void SAL_CALL SvxShapeControl::setControl( const Reference< awt::XControlModel >& xControl )
638 throw( uno::RuntimeException )
640 ::SolarMutexGuard aGuard;
642 SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
643 if( pUnoObj )
644 pUnoObj->SetUnoControlModel( xControl );
646 if( mpModel )
647 mpModel->SetChanged();
650 // XServiceInfo
651 uno::Sequence< OUString > SAL_CALL SvxShapeControl::getSupportedServiceNames() throw( uno::RuntimeException )
653 return SvxShapeText::getSupportedServiceNames();
656 static struct
658 const sal_Char* mpAPIName;
659 sal_uInt16 mnAPINameLen;
661 const sal_Char* mpFormName;
662 sal_uInt16 mnFormNameLen;
664 SvxShapeControlPropertyMapping[] =
666 // Warning: The first entry must be FontSlant because the any needs to be converted
667 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), MAP_CHAR_LEN("FontSlant") }, // const sal_Int16 => ::com::sun::star::awt::FontSlant
668 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), MAP_CHAR_LEN("FontName") },
669 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME), MAP_CHAR_LEN("FontStyleName") },
670 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), MAP_CHAR_LEN("FontFamily") },
671 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), MAP_CHAR_LEN("FontCharset") },
672 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), MAP_CHAR_LEN("FontHeight") },
673 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), MAP_CHAR_LEN("FontPitch" ) },
674 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), MAP_CHAR_LEN("FontWeight" ) },
675 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), MAP_CHAR_LEN("FontUnderline") },
676 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), MAP_CHAR_LEN("FontStrikeout") },
677 { MAP_CHAR_LEN("CharKerning"), MAP_CHAR_LEN("FontKerning") },
678 { MAP_CHAR_LEN("CharWordMode"), MAP_CHAR_LEN("FontWordLineMode" ) },
679 { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR), MAP_CHAR_LEN("TextColor") },
680 { MAP_CHAR_LEN("CharRelief"), MAP_CHAR_LEN("FontRelief") },
681 { MAP_CHAR_LEN("CharUnderlineColor"), MAP_CHAR_LEN("TextLineColor") },
682 { MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), MAP_CHAR_LEN("Align") },
683 { MAP_CHAR_LEN("TextVerticalAdjust"), MAP_CHAR_LEN("VerticalAlign") },
684 { MAP_CHAR_LEN("ControlBackground"), MAP_CHAR_LEN("BackgroundColor") },
685 { MAP_CHAR_LEN("ControlSymbolColor"), MAP_CHAR_LEN("SymbolColor") },
686 { MAP_CHAR_LEN("ControlBorder"), MAP_CHAR_LEN("Border") },
687 { MAP_CHAR_LEN("ControlBorderColor"), MAP_CHAR_LEN("BorderColor") },
688 { MAP_CHAR_LEN("ControlTextEmphasis"), MAP_CHAR_LEN("FontEmphasisMark") },
689 { MAP_CHAR_LEN("ImageScaleMode"), MAP_CHAR_LEN("ScaleMode") },
690 { MAP_CHAR_LEN("ControlWritingMode"), MAP_CHAR_LEN("WritingMode") },
691 { NULL,0, NULL, 0 }
694 namespace
696 static bool lcl_convertPropertyName( const OUString& rApiName, OUString& rInternalName )
698 sal_uInt16 i = 0;
699 while( SvxShapeControlPropertyMapping[i].mpAPIName )
701 if( rApiName.reverseCompareToAsciiL( SvxShapeControlPropertyMapping[i].mpAPIName, SvxShapeControlPropertyMapping[i].mnAPINameLen ) == 0 )
703 rInternalName = OUString( SvxShapeControlPropertyMapping[i].mpFormName, SvxShapeControlPropertyMapping[i].mnFormNameLen, RTL_TEXTENCODING_ASCII_US );
705 ++i;
707 return !rInternalName.isEmpty();
710 struct EnumConversionMap
712 sal_Int16 nAPIValue;
713 sal_Int16 nFormValue;
716 EnumConversionMap aMapAdjustToAlign[] =
718 // note that order matters:
719 // lcl_convertTextAlignmentToParaAdjustment and lcl_convertParaAdjustmentToTextAlignment search this map from the _beginning_
720 // and use the first matching entry
721 {style::ParagraphAdjust_LEFT, (sal_Int16)awt::TextAlign::LEFT},
722 {style::ParagraphAdjust_CENTER, (sal_Int16)awt::TextAlign::CENTER},
723 {style::ParagraphAdjust_RIGHT, (sal_Int16)awt::TextAlign::RIGHT},
724 {style::ParagraphAdjust_BLOCK, (sal_Int16)awt::TextAlign::RIGHT},
725 {style::ParagraphAdjust_STRETCH, (sal_Int16)awt::TextAlign::LEFT},
726 {-1,-1}
729 static void lcl_mapFormToAPIValue( Any& _rValue, const EnumConversionMap* _pMap )
731 sal_Int16 nValue = sal_Int16();
732 OSL_VERIFY( _rValue >>= nValue );
734 const EnumConversionMap* pEntry = _pMap;
735 while ( pEntry && ( pEntry->nFormValue != -1 ) )
737 if ( nValue == pEntry->nFormValue )
739 _rValue <<= pEntry->nAPIValue;
740 return;
742 ++pEntry;
746 static void lcl_mapAPIToFormValue( Any& _rValue, const EnumConversionMap* _pMap )
748 sal_Int32 nValue = 0;
749 OSL_VERIFY( _rValue >>= nValue );
751 const EnumConversionMap* pEntry = _pMap;
752 while ( pEntry && ( pEntry->nAPIValue != -1 ) )
754 if ( nValue == pEntry->nAPIValue )
756 _rValue <<= pEntry->nFormValue;
757 return;
759 ++pEntry;
763 static void lcl_convertTextAlignmentToParaAdjustment( Any& rValue )
765 lcl_mapFormToAPIValue( rValue, aMapAdjustToAlign );
768 static void lcl_convertParaAdjustmentToTextAlignment( Any& rValue )
770 lcl_mapAPIToFormValue( rValue, aMapAdjustToAlign );
773 void convertVerticalAdjustToVerticalAlign( Any& _rValue ) SAL_THROW( ( lang::IllegalArgumentException ) )
775 if ( !_rValue.hasValue() )
776 return;
778 drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
779 style::VerticalAlignment eAlign = style::VerticalAlignment_TOP;
780 if ( !( _rValue >>= eAdjust ) )
781 throw lang::IllegalArgumentException();
782 switch ( eAdjust )
784 case drawing::TextVerticalAdjust_TOP: eAlign = style::VerticalAlignment_TOP; break;
785 case drawing::TextVerticalAdjust_BOTTOM: eAlign = style::VerticalAlignment_BOTTOM; break;
786 default: eAlign = style::VerticalAlignment_MIDDLE; break;
788 _rValue <<= eAlign;
791 void convertVerticalAlignToVerticalAdjust( Any& _rValue )
793 if ( !_rValue.hasValue() )
794 return;
795 style::VerticalAlignment eAlign = style::VerticalAlignment_TOP;
796 drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP;
797 OSL_VERIFY( _rValue >>= eAlign );
798 switch ( eAlign )
800 case style::VerticalAlignment_TOP: eAdjust = drawing::TextVerticalAdjust_TOP; break;
801 case style::VerticalAlignment_BOTTOM: eAdjust = drawing::TextVerticalAdjust_BOTTOM; break;
802 default: eAdjust = drawing::TextVerticalAdjust_CENTER; break;
804 _rValue <<= eAdjust;
808 void SAL_CALL SvxShapeControl::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
809 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
811 OUString aFormsName;
812 if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
814 uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
815 if( xControl.is() )
817 uno::Reference< beans::XPropertySetInfo > xInfo( xControl->getPropertySetInfo() );
818 if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
820 uno::Any aConvertedValue( aValue );
821 if ( aFormsName == "FontSlant" )
823 awt::FontSlant nSlant;
824 if( !(aValue >>= nSlant ) )
825 throw lang::IllegalArgumentException();
826 aConvertedValue <<= (sal_Int16)nSlant;
828 else if ( aFormsName == "Align" )
830 lcl_convertParaAdjustmentToTextAlignment( aConvertedValue );
832 else if ( aFormsName == "VerticalAlign" )
834 convertVerticalAdjustToVerticalAlign( aConvertedValue );
837 xControl->setPropertyValue( aFormsName, aConvertedValue );
841 else
843 SvxShape::setPropertyValue( aPropertyName, aValue );
847 uno::Any SAL_CALL SvxShapeControl::getPropertyValue( const OUString& aPropertyName )
848 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
850 OUString aFormsName;
851 if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
853 uno::Reference< beans::XPropertySet > xControl( getControl(), uno::UNO_QUERY );
855 uno::Any aValue;
856 if( xControl.is() )
858 uno::Reference< beans::XPropertySetInfo > xInfo( xControl->getPropertySetInfo() );
859 if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
861 aValue = xControl->getPropertyValue( aFormsName );
862 if ( aFormsName == "FontSlant" )
864 awt::FontSlant eSlant = awt::FontSlant_NONE;
865 sal_Int16 nSlant = sal_Int16();
866 if ( aValue >>= nSlant )
868 eSlant = (awt::FontSlant)nSlant;
870 else
872 OSL_VERIFY( aValue >>= eSlant );
874 aValue <<= eSlant;
876 else if ( aFormsName == "Align" )
878 lcl_convertTextAlignmentToParaAdjustment( aValue );
880 else if ( aFormsName == "VerticalAlign" )
882 convertVerticalAlignToVerticalAdjust( aValue );
887 return aValue;
889 else
891 return SvxShape::getPropertyValue( aPropertyName );
896 // XPropertyState
897 beans::PropertyState SAL_CALL SvxShapeControl::getPropertyState( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
899 OUString aFormsName;
900 if ( lcl_convertPropertyName( PropertyName, aFormsName ) )
902 uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
903 uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
905 if( xControl.is() && xPropSet.is() )
907 uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
908 if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
910 return xControl->getPropertyState( aFormsName );
914 return beans::PropertyState_DEFAULT_VALUE;
916 else
918 return SvxShape::getPropertyState( PropertyName );
922 void SAL_CALL SvxShapeControl::setPropertyToDefault( const OUString& PropertyName ) throw( beans::UnknownPropertyException, uno::RuntimeException )
924 OUString aFormsName;
925 if ( lcl_convertPropertyName( PropertyName, aFormsName ) )
927 uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
928 uno::Reference< beans::XPropertySet > xPropSet( getControl(), uno::UNO_QUERY );
930 if( xControl.is() && xPropSet.is() )
932 uno::Reference< beans::XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
933 if( xInfo.is() && xInfo->hasPropertyByName( aFormsName ) )
935 xControl->setPropertyToDefault( aFormsName );
939 else
941 SvxShape::setPropertyToDefault( PropertyName );
945 uno::Any SAL_CALL SvxShapeControl::getPropertyDefault( const OUString& aPropertyName )
946 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
948 OUString aFormsName;
949 if ( lcl_convertPropertyName( aPropertyName, aFormsName ) )
951 uno::Reference< beans::XPropertyState > xControl( getControl(), uno::UNO_QUERY );
953 if( xControl.is() )
955 Any aDefault( xControl->getPropertyDefault( aFormsName ) );
956 if ( aFormsName == "FontSlant" )
958 sal_Int16 nSlant( 0 );
959 aDefault >>= nSlant;
960 aDefault <<= (awt::FontSlant)nSlant;
962 else if ( aFormsName == "Align" )
964 lcl_convertTextAlignmentToParaAdjustment( aDefault );
966 else if ( aFormsName == "VerticalAlign" )
968 convertVerticalAlignToVerticalAdjust( aDefault );
970 return aDefault;
973 throw beans::UnknownPropertyException();
975 else
977 return SvxShape::getPropertyDefault( aPropertyName );
982 /***********************************************************************
983 * class SvxShapeDimensioning *
984 ***********************************************************************/
986 //----------------------------------------------------------------------
987 SvxShapeDimensioning::SvxShapeDimensioning( SdrObject* pObj ) throw()
988 : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_DIMENSIONING), getSvxMapProvider().GetPropertySet(SVXMAP_DIMENSIONING, SdrObject::GetGlobalDrawObjectItemPool()) )
992 //----------------------------------------------------------------------
993 SvxShapeDimensioning::~SvxShapeDimensioning() throw()
997 // ::com::sun::star::lang::XServiceInfo
998 uno::Sequence< OUString > SAL_CALL SvxShapeDimensioning::getSupportedServiceNames() throw( uno::RuntimeException )
1000 return SvxShapeText::getSupportedServiceNames();
1003 /***********************************************************************
1005 ***********************************************************************/
1007 //----------------------------------------------------------------------
1008 SvxShapeCircle::SvxShapeCircle( SdrObject* pObj ) throw()
1009 : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CIRCLE), getSvxMapProvider().GetPropertySet(SVXMAP_CIRCLE, SdrObject::GetGlobalDrawObjectItemPool()) )
1013 //----------------------------------------------------------------------
1014 SvxShapeCircle::~SvxShapeCircle() throw()
1018 // ::com::sun::star::lang::XServiceInfo
1019 // XServiceInfo
1020 uno::Sequence< OUString > SAL_CALL SvxShapeCircle::getSupportedServiceNames() throw( uno::RuntimeException )
1022 return SvxShapeText::getSupportedServiceNames();
1025 /***********************************************************************
1027 ***********************************************************************/
1029 #include <svx/svdopath.hxx>
1031 //----------------------------------------------------------------------
1032 SvxShapePolyPolygon::SvxShapePolyPolygon( SdrObject* pObj , drawing::PolygonKind eNew )
1033 throw( com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
1034 : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_POLYPOLYGON), getSvxMapProvider().GetPropertySet(SVXMAP_POLYPOLYGON, SdrObject::GetGlobalDrawObjectItemPool()) )
1035 , mePolygonKind( eNew )
1039 //----------------------------------------------------------------------
1040 SvxShapePolyPolygon::~SvxShapePolyPolygon() throw()
1044 basegfx::B2DPolyPolygon SAL_CALL ImplSvxPointSequenceSequenceToB2DPolyPolygon( const drawing::PointSequenceSequence* pOuterSequence) throw()
1046 basegfx::B2DPolyPolygon aRetval;
1048 // Zeiger auf innere sequences holen
1049 const drawing::PointSequence* pInnerSequence = pOuterSequence->getConstArray();
1050 const drawing::PointSequence* pInnerSeqEnd = pInnerSequence + pOuterSequence->getLength();
1052 for(;pInnerSequence != pInnerSeqEnd; ++pInnerSequence)
1054 // Neues Polygon vorbereiten
1055 basegfx::B2DPolygon aNewPolygon;
1057 // Zeiger auf Arrays holen
1058 const awt::Point* pArray = pInnerSequence->getConstArray();
1059 const awt::Point* pArrayEnd = pArray + pInnerSequence->getLength();
1061 for(;pArray != pArrayEnd;++pArray)
1063 aNewPolygon.append(basegfx::B2DPoint(pArray->X, pArray->Y));
1066 // check for closed state flag
1067 basegfx::tools::checkClosed(aNewPolygon);
1069 // Neues Teilpolygon einfuegen
1070 aRetval.append(aNewPolygon);
1073 return aRetval;
1076 //----------------------------------------------------------------------
1078 bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1080 switch( pProperty->nWID )
1082 case OWN_ATTR_VALUE_POLYPOLYGON:
1084 if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0) ) )
1086 basegfx::B2DPolyPolygon aNewPolyPolygon(ImplSvxPointSequenceSequenceToB2DPolyPolygon( (drawing::PointSequenceSequence*)rValue.getValue()));
1087 SetPolygon(aNewPolyPolygon);
1088 return true;
1090 break;
1092 case OWN_ATTR_BASE_GEOMETRY:
1094 if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0)))
1096 if( mpObj.is() )
1098 basegfx::B2DPolyPolygon aNewPolyPolygon;
1099 basegfx::B2DHomMatrix aNewHomogenMatrix;
1101 mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
1102 aNewPolyPolygon = ImplSvxPointSequenceSequenceToB2DPolyPolygon((drawing::PointSequenceSequence*)rValue.getValue());
1103 mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
1105 return true;
1107 break;
1109 case OWN_ATTR_VALUE_POLYGON:
1111 if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PointSequenceSequence*)0) ))
1113 drawing::PointSequence* pSequence = (drawing::PointSequence*)rValue.getValue();
1115 // Neues Polygon vorbereiten
1116 basegfx::B2DPolygon aNewPolygon;
1118 // Zeiger auf Arrays holen
1119 // Zeiger auf Arrays holen
1120 const awt::Point* pArray = pSequence->getConstArray();
1121 const awt::Point* pArrayEnd = pArray + pSequence->getLength();
1123 for(;pArray != pArrayEnd;++pArray)
1125 aNewPolygon.append(basegfx::B2DPoint(pArray->X, pArray->Y));
1128 // check for closed state flag
1129 basegfx::tools::checkClosed(aNewPolygon);
1131 // Polygon setzen
1132 SetPolygon(basegfx::B2DPolyPolygon(aNewPolygon));
1133 return true;
1135 break;
1137 default:
1138 return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
1141 throw lang::IllegalArgumentException();
1144 void SAL_CALL B2DPolyPolygonToSvxPointSequenceSequence( const basegfx::B2DPolyPolygon& rPolyPoly, drawing::PointSequenceSequence& rRetval )
1146 if( (sal_uInt32)rRetval.getLength() != rPolyPoly.count() )
1147 rRetval.realloc( rPolyPoly.count() );
1149 // Zeiger auf aeussere Arrays holen
1150 drawing::PointSequence* pOuterSequence = rRetval.getArray();
1152 for(sal_uInt32 a(0L); a < rPolyPoly.count(); a++)
1154 // Einzelpolygon holen
1155 const basegfx::B2DPolygon aPoly(rPolyPoly.getB2DPolygon(a));
1157 // #i75974# take closed stae into account, the API polygon still uses the old closed definition
1158 // with last/first point are identical (cannot hold information about open polygons with identical
1159 // first and last point, though)
1160 const sal_uInt32 nPointCount(aPoly.count());
1161 const bool bIsClosed(aPoly.isClosed());
1163 // Platz in Arrays schaffen
1164 pOuterSequence->realloc(bIsClosed ? nPointCount + 1 : nPointCount);
1166 // Pointer auf arrays holen
1167 awt::Point* pInnerSequence = pOuterSequence->getArray();
1169 for(sal_uInt32 b(0L); b < nPointCount; b++)
1171 const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(b));
1172 *pInnerSequence = awt::Point( basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()) );
1173 pInnerSequence++;
1176 // #i75974# copy first point
1177 if(bIsClosed)
1179 *pInnerSequence = *pOuterSequence->getArray();
1182 pOuterSequence++;
1186 //----------------------------------------------------------------------
1188 bool SvxShapePolyPolygon::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1190 switch( pProperty->nWID )
1192 case OWN_ATTR_VALUE_POLYPOLYGON:
1194 // PolyPolygon in eine struct PolyPolygon packen
1195 const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
1196 drawing::PointSequenceSequence aRetval( rPolyPoly.count() );
1198 B2DPolyPolygonToSvxPointSequenceSequence( rPolyPoly, aRetval );
1200 rValue <<= aRetval;
1201 break;
1203 case OWN_ATTR_BASE_GEOMETRY:
1205 // pack a PolyPolygon in struct PolyPolygon
1206 basegfx::B2DPolyPolygon aNewPolyPolygon;
1207 basegfx::B2DHomMatrix aNewHomogenMatrix;
1209 if(mpObj.is())
1210 mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
1212 drawing::PointSequenceSequence aRetval(aNewPolyPolygon.count());
1213 B2DPolyPolygonToSvxPointSequenceSequence(aNewPolyPolygon, aRetval);
1214 rValue <<= aRetval;
1215 break;
1217 case OWN_ATTR_VALUE_POLYGON:
1219 // PolyPolygon in eine struct PolyPolygon packen
1220 const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
1222 sal_Int32 nCount = 0;
1223 if( rPolyPoly.count() > 0 )
1224 nCount = rPolyPoly.getB2DPolygon(0L).count();
1226 drawing::PointSequence aRetval( nCount );
1228 if( nCount > 0 )
1230 // Einzelpolygon holen
1231 const basegfx::B2DPolygon aPoly(rPolyPoly.getB2DPolygon(0L));
1233 // Pointer auf arrays holen
1234 awt::Point* pSequence = aRetval.getArray();
1236 for(sal_Int32 b=0;b<nCount;b++)
1238 const basegfx::B2DPoint aPoint(aPoly.getB2DPoint(b));
1239 *pSequence++ = awt::Point( basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY()) );
1243 rValue <<= aRetval;
1244 break;
1246 case OWN_ATTR_VALUE_POLYGONKIND:
1248 rValue <<= GetPolygonKind();
1249 break;
1251 default:
1252 return SvxShapeText::getPropertyValueImpl( rName, pProperty, rValue );
1255 return true;
1258 //----------------------------------------------------------------------
1259 drawing::PolygonKind SvxShapePolyPolygon::GetPolygonKind() const throw()
1261 return mePolygonKind;
1264 //----------------------------------------------------------------------
1265 void SvxShapePolyPolygon::SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw()
1267 ::SolarMutexGuard aGuard;
1269 if(mpObj.is())
1270 ((SdrPathObj*)mpObj.get())->SetPathPoly(rNew);
1273 //----------------------------------------------------------------------
1274 basegfx::B2DPolyPolygon SvxShapePolyPolygon::GetPolygon() const throw()
1276 ::SolarMutexGuard aGuard;
1278 if(mpObj.is())
1280 return ((SdrPathObj*)mpObj.get())->GetPathPoly();
1282 else
1284 return basegfx::B2DPolyPolygon();
1288 // ::com::sun::star::lang::XServiceInfo
1289 uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygon::getSupportedServiceNames() throw( uno::RuntimeException )
1291 return SvxShapeText::getSupportedServiceNames();
1294 /***********************************************************************
1295 * class SvxShapePolyPolygonBezier *
1296 ***********************************************************************/
1297 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
1298 #include <com/sun/star/drawing/FlagSequence.hpp>
1299 //----------------------------------------------------------------------
1300 SvxShapePolyPolygonBezier::SvxShapePolyPolygonBezier( SdrObject* pObj , drawing::PolygonKind eNew ) throw()
1301 : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_POLYPOLYGONBEZIER), getSvxMapProvider().GetPropertySet(SVXMAP_POLYPOLYGONBEZIER, SdrObject::GetGlobalDrawObjectItemPool()) )
1302 , mePolygonKind( eNew )
1306 //----------------------------------------------------------------------
1307 SvxShapePolyPolygonBezier::~SvxShapePolyPolygonBezier() throw()
1311 //----------------------------------------------------------------------
1313 bool SvxShapePolyPolygonBezier::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1315 switch( pProperty->nWID )
1317 case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
1319 if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PolyPolygonBezierCoords*)0) ) )
1321 basegfx::B2DPolyPolygon aNewPolyPolygon(
1322 basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(
1323 *(drawing::PolyPolygonBezierCoords*)rValue.getValue()));
1324 SetPolygon(aNewPolyPolygon);
1325 return true;
1327 break;
1329 case OWN_ATTR_BASE_GEOMETRY:
1331 if( rValue.getValue() && (rValue.getValueType() == ::getCppuType(( const drawing::PolyPolygonBezierCoords*)0)) )
1333 if( mpObj.is() )
1335 basegfx::B2DPolyPolygon aNewPolyPolygon;
1336 basegfx::B2DHomMatrix aNewHomogenMatrix;
1338 mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
1339 aNewPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(
1340 *(drawing::PolyPolygonBezierCoords*)rValue.getValue());
1341 mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
1343 return true;
1345 break;
1347 default:
1348 return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
1351 throw IllegalArgumentException();
1354 //----------------------------------------------------------------------
1356 bool SvxShapePolyPolygonBezier::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1358 switch( pProperty->nWID )
1360 case OWN_ATTR_VALUE_POLYPOLYGONBEZIER:
1362 // PolyPolygon in eine struct PolyPolygon packen
1363 const basegfx::B2DPolyPolygon& rPolyPoly = GetPolygon();
1364 drawing::PolyPolygonBezierCoords aRetval;
1365 basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(rPolyPoly, aRetval);
1367 rValue <<= aRetval;
1368 break;
1370 case OWN_ATTR_BASE_GEOMETRY:
1372 // PolyPolygon in eine struct PolyPolygon packen
1373 basegfx::B2DPolyPolygon aNewPolyPolygon;
1374 basegfx::B2DHomMatrix aNewHomogenMatrix;
1375 mpObj.get()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
1376 drawing::PolyPolygonBezierCoords aRetval;
1377 basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(aNewPolyPolygon, aRetval);
1379 rValue <<= aRetval;
1380 break;
1382 case OWN_ATTR_VALUE_POLYGONKIND:
1384 rValue <<= GetPolygonKind();
1385 break;
1387 default:
1388 return SvxShapeText::getPropertyValueImpl( rName, pProperty, rValue );
1390 return true;
1393 //----------------------------------------------------------------------
1394 drawing::PolygonKind SvxShapePolyPolygonBezier::GetPolygonKind() const throw()
1396 return mePolygonKind;
1399 //----------------------------------------------------------------------
1400 void SvxShapePolyPolygonBezier::SetPolygon(const basegfx::B2DPolyPolygon& rNew) throw()
1402 ::SolarMutexGuard aGuard;
1404 if(mpObj.is())
1405 static_cast<SdrPathObj*>(mpObj.get())->SetPathPoly(rNew);
1408 //----------------------------------------------------------------------
1409 basegfx::B2DPolyPolygon SvxShapePolyPolygonBezier::GetPolygon() const throw()
1411 ::SolarMutexGuard aGuard;
1413 if(mpObj.is())
1415 return static_cast<SdrPathObj*>(mpObj.get())->GetPathPoly();
1417 else
1419 return basegfx::B2DPolyPolygon();
1424 // ::com::sun::star::lang::XServiceInfo
1425 uno::Sequence< OUString > SAL_CALL SvxShapePolyPolygonBezier::getSupportedServiceNames() throw( uno::RuntimeException )
1427 return SvxShapeText::getSupportedServiceNames();
1430 /***********************************************************************
1431 * class SvxGraphicObject *
1432 ***********************************************************************/
1433 #include <com/sun/star/awt/XBitmap.hpp>
1434 #include <vcl/cvtgrf.hxx>
1435 #include <svx/svdograf.hxx>
1436 #include <sfx2/docfile.hxx>
1437 #include <sfx2/app.hxx>
1438 #include <sfx2/fcontnr.hxx>
1440 #include "toolkit/unohlp.hxx"
1442 //----------------------------------------------------------------------
1443 SvxGraphicObject::SvxGraphicObject( SdrObject* pObj ) throw()
1444 : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_GRAPHICOBJECT), getSvxMapProvider().GetPropertySet(SVXMAP_GRAPHICOBJECT, SdrObject::GetGlobalDrawObjectItemPool()) )
1448 //----------------------------------------------------------------------
1449 SvxGraphicObject::~SvxGraphicObject() throw()
1453 //----------------------------------------------------------------------
1455 bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1457 bool bOk = false;
1458 switch( pProperty->nWID )
1460 case OWN_ATTR_VALUE_FILLBITMAP:
1462 if( rValue.getValue() )
1464 if( rValue.getValueType() == ::getCppuType(( const uno::Sequence< sal_Int8 >*)0) )
1466 uno::Sequence<sal_Int8>* pSeq( (uno::Sequence<sal_Int8>*)rValue.getValue() );
1467 SvMemoryStream aMemStm;
1468 Graphic aGraphic;
1470 aMemStm.SetBuffer( (char*)pSeq->getConstArray(), pSeq->getLength(), sal_False, pSeq->getLength() );
1472 if( GraphicConverter::Import( aMemStm, aGraphic ) == ERRCODE_NONE )
1474 static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(aGraphic);
1475 bOk = true;
1479 else if( (rValue.getValueType() == awt::XBitmap::static_type()) || (rValue.getValueType() == graphic::XGraphic::static_type()))
1481 Reference< graphic::XGraphic> xGraphic( rValue, UNO_QUERY );
1482 if( xGraphic.is() )
1484 ((SdrGrafObj*)mpObj.get())->SetGraphic(Graphic(xGraphic));
1485 bOk = true;
1487 else
1489 // Bitmap in das Objekt packen
1490 Reference< awt::XBitmap > xBmp( rValue, UNO_QUERY );
1491 if( xBmp.is() )
1493 // Bitmap einsetzen
1494 Graphic aGraphic(VCLUnoHelper::GetBitmap( xBmp ));
1495 ((SdrGrafObj*)mpObj.get())->SetGraphic(aGraphic);
1496 bOk = true;
1500 break;
1502 case OWN_ATTR_GRAFURL:
1504 OUString aURL;
1505 if( rValue >>= aURL )
1507 if( aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX ) )
1509 // graphic manager url
1510 aURL = aURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
1511 String aTmpStr(aURL);
1512 OString aUniqueID(OUStringToOString(aTmpStr, RTL_TEXTENCODING_UTF8));
1513 GraphicObject aGrafObj(aUniqueID);
1515 // #101808# since loading a graphic can cause a reschedule of the office
1516 // it is possible that our shape is removed while where in this
1517 // method.
1518 if( mpObj.is() )
1520 static_cast<SdrGrafObj*>(mpObj.get())->ReleaseGraphicLink();
1521 static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicObject( aGrafObj );
1524 else if( !aURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
1526 // normal link
1527 String aFilterName;
1528 const SfxFilter* pSfxFilter = NULL;
1529 SfxMedium aSfxMedium( aURL, STREAM_READ | STREAM_SHARE_DENYNONE );
1531 SFX_APP()->GetFilterMatcher().GuessFilter( aSfxMedium, &pSfxFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
1533 if( !pSfxFilter )
1535 INetURLObject aURLObj( aURL );
1537 if( aURLObj.GetProtocol() == INET_PROT_NOT_VALID )
1539 OUString aValidURL;
1541 if( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aURL, aValidURL ) )
1542 aURLObj = INetURLObject( aValidURL );
1545 if( aURLObj.GetProtocol() != INET_PROT_NOT_VALID )
1547 GraphicFilter &rGrfFilter = GraphicFilter::GetGraphicFilter();
1548 aFilterName = rGrfFilter.GetImportFormatName( rGrfFilter.GetImportFormatNumberForShortName( aURLObj.getExtension() ) );
1551 else
1552 aFilterName = pSfxFilter->GetFilterName();
1554 // #101808# since loading a graphic can cause a reschedule of the office
1555 // it is possible that our shape is removed while where in this
1556 // method.
1557 if( mpObj.is() )
1558 static_cast<SdrGrafObj*>(mpObj.get())->SetGraphicLink( aURL, aFilterName );
1561 bOk = true;
1563 break;
1566 case OWN_ATTR_GRAFSTREAMURL:
1568 OUString aStreamURL;
1570 if( rValue >>= aStreamURL )
1572 if( !aStreamURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
1573 aStreamURL = OUString();
1575 if( mpObj.is() )
1577 static_cast<SdrGrafObj*>(mpObj.get())->SetGrafStreamURL( aStreamURL );
1578 static_cast<SdrGrafObj*>(mpObj.get())->ForceSwapOut();
1580 bOk = true;
1582 break;
1585 case OWN_ATTR_VALUE_GRAPHIC:
1587 Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
1588 if( xGraphic.is() )
1590 static_cast< SdrGrafObj*>( mpObj.get() )->SetGraphic( xGraphic );
1591 bOk = true;
1593 break;
1595 default:
1596 return SvxShapeText::setPropertyValueImpl( rName, pProperty, rValue );
1599 if( !bOk )
1600 throw lang::IllegalArgumentException();
1602 if( mpModel )
1603 mpModel->SetChanged();
1605 return true;
1608 //----------------------------------------------------------------------
1610 bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1612 switch( pProperty->nWID )
1614 case OWN_ATTR_VALUE_FILLBITMAP:
1616 sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
1617 const Graphic& rGraphic = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphic();
1619 if(rGraphic.GetType() != GRAPHIC_GDIMETAFILE)
1621 // Objekt in eine Bitmap packen
1622 Reference< ::com::sun::star::awt::XBitmap > xBitmap( VCLUnoHelper::CreateBitmap(static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphic().GetBitmapEx()) );
1623 rValue <<= xBitmap;
1625 else
1627 SvMemoryStream aDestStrm( 65535, 65535 );
1629 ConvertGDIMetaFileToWMF( rGraphic.GetGDIMetaFile(), aDestStrm, NULL, sal_False );
1630 const uno::Sequence<sal_Int8> aSeq(
1631 static_cast< const sal_Int8* >(aDestStrm.GetData()),
1632 aDestStrm.GetEndOfData());
1633 rValue <<= aSeq;
1635 if ( bSwapped )
1636 static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
1637 break;
1640 case OWN_ATTR_GRAFURL:
1642 if( static_cast< SdrGrafObj*>( mpObj.get() )->IsLinkedGraphic() )
1644 rValue <<= OUString( static_cast< SdrGrafObj*>( mpObj.get() )->GetFileName() );
1646 else
1648 sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
1649 const GraphicObject& rGrafObj = static_cast< SdrGrafObj*>( mpObj.get() )->GetGraphicObject(true);
1650 OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
1651 aURL += OStringToOUString(rGrafObj.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
1652 rValue <<= aURL;
1653 if ( bSwapped )
1654 static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
1656 break;
1659 case OWN_ATTR_REPLACEMENTGRAFURL:
1661 const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject();
1663 if(pGrafObj)
1665 OUString aURL(UNO_NAME_GRAPHOBJ_URLPREFIX);
1666 aURL += OStringToOUString(pGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
1667 rValue <<= aURL;
1670 break;
1673 case OWN_ATTR_GRAFSTREAMURL:
1675 const OUString aStreamURL( ( (SdrGrafObj*) mpObj.get() )->GetGrafStreamURL() );
1676 if( !aStreamURL.isEmpty() )
1677 rValue <<= aStreamURL;
1678 break;
1681 case OWN_ATTR_VALUE_GRAPHIC:
1683 sal_Bool bSwapped = static_cast< SdrGrafObj* >( mpObj.get() )->IsSwappedOut();
1684 Reference< graphic::XGraphic > xGraphic( static_cast< SdrGrafObj* >( mpObj.get() )->GetGraphic().GetXGraphic() );
1685 rValue <<= xGraphic;
1686 if ( bSwapped )
1687 static_cast< SdrGrafObj* >( mpObj.get() )->ForceSwapOut();
1688 break;
1691 case OWN_ATTR_GRAPHIC_STREAM:
1693 rValue <<= static_cast< SdrGrafObj* >( mpObj.get() )->getInputStream();
1694 break;
1696 default:
1697 return SvxShapeText::getPropertyValueImpl(rName, pProperty,rValue);
1700 return true;
1703 ///////////////////////////////////////////////////////////////////////
1705 SvxShapeCaption::SvxShapeCaption( SdrObject* pObj ) throw()
1706 : SvxShapeText( pObj, getSvxMapProvider().GetMap(SVXMAP_CAPTION), getSvxMapProvider().GetPropertySet(SVXMAP_CAPTION, SdrObject::GetGlobalDrawObjectItemPool()) )
1710 SvxShapeCaption::~SvxShapeCaption() throw()
1714 /***********************************************************************
1715 * class SvxCustomShape *
1716 ***********************************************************************/
1718 SvxCustomShape::SvxCustomShape( SdrObject* pObj ) throw() :
1719 SvxShapeText( pObj, getSvxMapProvider().GetMap( SVXMAP_CUSTOMSHAPE ), getSvxMapProvider().GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool()) )
1723 //----------------------------------------------------------------------
1724 SvxCustomShape::~SvxCustomShape() throw()
1728 //----------------------------------------------------------------------
1730 void SvxCustomShape::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage )
1732 SvxShapeText::Create( pNewObj, pNewPage );
1735 //----------------------------------------------------------------------
1737 uno::Any SAL_CALL SvxCustomShape::queryInterface( const uno::Type & rType )
1738 throw(uno::RuntimeException)
1740 return SvxShapeText::queryInterface( rType );
1743 uno::Any SAL_CALL SvxCustomShape::queryAggregation( const uno::Type & rType )
1744 throw(uno::RuntimeException)
1746 ::com::sun::star::uno::Any aReturn = SvxShapeText::queryAggregation( rType );
1747 if ( !aReturn.hasValue() )
1748 aReturn = ::cppu::queryInterface(rType, static_cast<drawing::XEnhancedCustomShapeDefaulter*>(this) );
1749 return aReturn;
1752 void SAL_CALL SvxCustomShape::acquire() throw ( )
1754 SvxShapeText::acquire();
1757 void SAL_CALL SvxCustomShape::release() throw ( )
1759 SvxShapeText::release();
1762 //----------------------------------------------------------------------
1764 uno::Sequence< uno::Type > SAL_CALL SvxCustomShape::getTypes()
1765 throw (uno::RuntimeException)
1767 return SvxShapeText::getTypes();
1770 namespace
1772 class theSvxCustomShapeImplementationId : public rtl::Static< UnoTunnelIdInit, theSvxCustomShapeImplementationId > {};
1775 uno::Sequence< sal_Int8 > SAL_CALL SvxCustomShape::getImplementationId()
1776 throw (uno::RuntimeException)
1778 return theSvxCustomShapeImplementationId::get().getSeq();
1781 // ::com::sun::star::drawing::XShape
1783 //----------------------------------------------------------------------
1784 OUString SAL_CALL SvxCustomShape::getShapeType()
1785 throw( uno::RuntimeException )
1787 return SvxShape::getShapeType();
1790 //------------------------------------------------------------------1----
1791 awt::Point SAL_CALL SvxCustomShape::getPosition() throw(uno::RuntimeException)
1793 ::SolarMutexGuard aGuard;
1794 if ( mpModel && mpObj.is() )
1796 SdrAShapeObjGeoData aCustomShapeGeoData;
1797 ((SdrObjCustomShape*)mpObj.get())->SaveGeoData( aCustomShapeGeoData );
1799 sal_Bool bMirroredX = sal_False;
1800 sal_Bool bMirroredY = sal_False;
1802 if ( mpObj.is() )
1804 bMirroredX = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredX() );
1805 bMirroredY = ( ((SdrObjCustomShape*)mpObj.get())->IsMirroredY() );
1807 // get aRect, this is the unrotated snaprect
1808 Rectangle aRect(((SdrObjCustomShape*)mpObj.get())->GetLogicRect());
1809 Rectangle aRectangle( aRect );
1811 if ( bMirroredX || bMirroredY )
1812 { // we have to retrieve the unmirrored rect
1814 GeoStat aNewGeo( aCustomShapeGeoData.aGeo );
1815 if ( bMirroredX )
1817 Polygon aPol( Rect2Poly( aRect, aNewGeo ) );
1818 Rectangle aBoundRect( aPol.GetBoundRect() );
1820 Point aRef1( ( aBoundRect.Left() + aBoundRect.Right() ) >> 1, aBoundRect.Top() );
1821 Point aRef2( aRef1.X(), aRef1.Y() + 1000 );
1822 sal_uInt16 i;
1823 sal_uInt16 nPntAnz=aPol.GetSize();
1824 for (i=0; i<nPntAnz; i++)
1826 MirrorPoint(aPol[i],aRef1,aRef2);
1828 // Polygon wenden und etwas schieben
1829 Polygon aPol0(aPol);
1830 aPol[0]=aPol0[1];
1831 aPol[1]=aPol0[0];
1832 aPol[2]=aPol0[3];
1833 aPol[3]=aPol0[2];
1834 aPol[4]=aPol0[1];
1835 Poly2Rect(aPol,aRectangle,aNewGeo);
1837 if ( bMirroredY )
1839 Polygon aPol( Rect2Poly( aRectangle, aNewGeo ) );
1840 Rectangle aBoundRect( aPol.GetBoundRect() );
1842 Point aRef1( aBoundRect.Left(), ( aBoundRect.Top() + aBoundRect.Bottom() ) >> 1 );
1843 Point aRef2( aRef1.X() + 1000, aRef1.Y() );
1844 sal_uInt16 i;
1845 sal_uInt16 nPntAnz=aPol.GetSize();
1846 for (i=0; i<nPntAnz; i++)
1848 MirrorPoint(aPol[i],aRef1,aRef2);
1850 // Polygon wenden und etwas schieben
1851 Polygon aPol0(aPol);
1852 aPol[0]=aPol0[1];
1853 aPol[1]=aPol0[0];
1854 aPol[2]=aPol0[3];
1855 aPol[3]=aPol0[2];
1856 aPol[4]=aPol0[1];
1857 Poly2Rect( aPol, aRectangle, aNewGeo );
1860 Point aPt( aRectangle.TopLeft() );
1862 if( mpModel->IsWriter() )
1863 aPt -= mpObj->GetAnchorPos();
1865 ForceMetricTo100th_mm(aPt);
1866 return ::com::sun::star::awt::Point( aPt.X(), aPt.Y() );
1868 else
1869 return SvxShape::getPosition();
1872 //----------------------------------------------------------------------
1873 void SAL_CALL SvxCustomShape::setPosition( const awt::Point& Position ) throw(uno::RuntimeException)
1875 SvxShapeText::setPosition(Position);
1878 //----------------------------------------------------------------------
1880 awt::Size SAL_CALL SvxCustomShape::getSize() throw(uno::RuntimeException)
1882 return SvxShapeText::getSize();
1885 //----------------------------------------------------------------------
1886 void SAL_CALL SvxCustomShape::setSize( const awt::Size& rSize )
1887 throw(beans::PropertyVetoException, uno::RuntimeException)
1889 SvxShapeText::setSize( rSize );
1892 //----------------------------------------------------------------------
1894 //----------------------------------------------------------------------
1895 void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
1896 throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, com::sun::star::beans::PropertyVetoException, com::sun::star::lang::IllegalArgumentException)
1898 ::SolarMutexGuard aGuard;
1899 SdrObject* pObject = mpObj.get();
1901 bool bCustomShapeGeometry = pObject && aPropertyName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CustomShapeGeometry" ) );
1903 sal_Bool bMirroredX = sal_False;
1904 sal_Bool bMirroredY = sal_False;
1906 if ( bCustomShapeGeometry )
1908 bMirroredX = ( ((SdrObjCustomShape*)pObject)->IsMirroredX() );
1909 bMirroredY = ( ((SdrObjCustomShape*)pObject)->IsMirroredY() );
1912 SvxShape::setPropertyValue( aPropertyName, aValue );
1914 if ( bCustomShapeGeometry )
1916 ((SdrObjCustomShape*)pObject)->MergeDefaultAttributes(0);
1917 Rectangle aRect( pObject->GetSnapRect() );
1919 // #i38892#
1920 bool bNeedsMirrorX = ((SdrObjCustomShape*)pObject)->IsMirroredX() != bMirroredX;
1921 bool bNeedsMirrorY = ((SdrObjCustomShape*)pObject)->IsMirroredY() != bMirroredY;
1923 boost::scoped_ptr< SdrGluePointList > pListCopy;
1924 if( bNeedsMirrorX || bNeedsMirrorY )
1926 const SdrGluePointList* pList = pObject->GetGluePointList();
1927 if( pList )
1928 pListCopy.reset( new SdrGluePointList(*pList) );
1931 if ( bNeedsMirrorX )
1933 Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
1934 Point aBottom( aTop.X(), aTop.Y() + 1000 );
1935 pObject->NbcMirror( aTop, aBottom );
1936 // NbcMirroring is flipping the current mirror state,
1937 // so we have to set the correct state again
1938 ((SdrObjCustomShape*)pObject)->SetMirroredX( bMirroredX ? sal_False : sal_True );
1940 if ( bNeedsMirrorY )
1942 Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
1943 Point aRight( aLeft.X() + 1000, aLeft.Y() );
1944 pObject->NbcMirror( aLeft, aRight );
1945 // NbcMirroring is flipping the current mirror state,
1946 // so we have to set the correct state again
1947 ((SdrObjCustomShape*)pObject)->SetMirroredY( bMirroredY ? sal_False : sal_True );
1950 if( pListCopy )
1952 SdrGluePointList* pNewList = const_cast< SdrGluePointList* >( pObject->GetGluePointList() );
1953 if(pNewList)
1954 *pNewList = *pListCopy;
1959 bool SvxCustomShape::getPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
1961 switch( pProperty->nWID )
1963 case SDRATTR_ROTATEANGLE:
1965 double fAngle = static_cast<SdrObjCustomShape*>(mpObj.get())->GetObjectRotation();
1966 fAngle *= 100;
1967 rValue <<= (sal_Int32)fAngle;
1968 return true;
1970 default:
1971 return SvxShape::getPropertyValueImpl( rName, pProperty, rValue );
1974 //----------------------------------------------------------------------
1976 void SvxCustomShape::createCustomShapeDefaults( const OUString& rValueType ) throw (::com::sun::star::uno::RuntimeException)
1978 ((SdrObjCustomShape*)mpObj.get())->MergeDefaultAttributes( &rValueType );
1981 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */