Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1472292F8 for ; Mon, 18 Jun 2012 16:00:54 +0000 (UTC) Received: (qmail 393 invoked by uid 500); 18 Jun 2012 16:00:54 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 356 invoked by uid 500); 18 Jun 2012 16:00:53 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 348 invoked by uid 99); 18 Jun 2012 16:00:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2012 16:00:53 +0000 X-ASF-Spam-Status: No, hits=-1998.1 required=5.0 tests=ALL_TRUSTED,FUZZY_AMBIEN X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Jun 2012 16:00:42 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B58FD2388CBE; Mon, 18 Jun 2012 16:00:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1351396 [1/2] - in /incubator/ooo/branches/alg/aw080/main: sd/source/ui/func/ sd/source/ui/inc/ svx/inc/svx/ svx/inc/svx/sdr/properties/ svx/source/customshapes/ svx/source/engine3d/ svx/source/sdr/contact/ svx/source/sdr/properties/ svx/s... Date: Mon, 18 Jun 2012 16:00:14 -0000 To: ooo-commits@incubator.apache.org From: alg@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120618160018.B58FD2388CBE@eris.apache.org> Author: alg Date: Mon Jun 18 16:00:11 2012 New Revision: 1351396 URL: http://svn.apache.org/viewvc?rev=1351396&view=rev Log: aw080: SdrModel changes secured, some objects stabilized Modified: incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/fuformatpaintbrush.cxx incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/futext.cxx incubator/ooo/branches/alg/aw080/main/sd/source/ui/inc/fuformatpaintbrush.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/fontworkgallery.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/globl3d.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/attributeproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/captionproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/connectorproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/defaultproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/emptyproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/graphicproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/groupproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/measureproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/properties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/rectangleproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/textproperties.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdedxv.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdoashp.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotable.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotext.hxx incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdtext.hxx incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape2d.cxx incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.cxx incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.hxx incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShapeEngine.cxx incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx incubator/ooo/branches/alg/aw080/main/svx/source/engine3d/view3d.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/contact/viewcontactofsdrcaptionobj.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/attributeproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/captionproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/connectorproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/customshapeproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/defaultproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/e3dproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/e3dsceneproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/emptyproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/graphicproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/groupproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/measureproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/rectangleproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/sdr/properties/textproperties.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/sdrtexthelpers.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdcrtv.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdedtv2.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdedxv.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdlegacy.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdoashp.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdograf.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdomeas.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdotext.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdotxat.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdotxtr.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdpage.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdtext.cxx incubator/ooo/branches/alg/aw080/main/svx/source/svdraw/svdxcgv.cxx incubator/ooo/branches/alg/aw080/main/svx/source/table/cell.cxx incubator/ooo/branches/alg/aw080/main/svx/source/table/svdotable.cxx incubator/ooo/branches/alg/aw080/main/svx/source/tbxctrls/fontworkgallery.cxx incubator/ooo/branches/alg/aw080/main/svx/source/toolbars/fontworkbar.cxx incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unopage.cxx incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unoshap2.cxx incubator/ooo/branches/alg/aw080/main/svx/source/unodraw/unoshape.cxx incubator/ooo/branches/alg/aw080/main/sw/source/ui/uiview/viewdraw.cxx incubator/ooo/branches/alg/aw080/main/xmloff/inc/xexptran.hxx incubator/ooo/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapContext.cxx incubator/ooo/branches/alg/aw080/main/xmloff/source/draw/XMLImageMapExport.cxx incubator/ooo/branches/alg/aw080/main/xmloff/source/draw/shapeexport2.cxx incubator/ooo/branches/alg/aw080/main/xmloff/source/draw/xexptran.cxx incubator/ooo/branches/alg/aw080/main/xmloff/source/draw/ximpshap.cxx incubator/ooo/branches/alg/aw080/main/xmloff/source/text/XMLTextFrameContext.cxx incubator/ooo/branches/alg/aw080/main/xmloff/source/text/txtparae.cxx Modified: incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/fuformatpaintbrush.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/fuformatpaintbrush.cxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/fuformatpaintbrush.cxx (original) +++ incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/fuformatpaintbrush.cxx Mon Jun 18 16:00:11 2012 @@ -175,7 +175,7 @@ bool FuFormatPaintBrush::MouseMove(const const basegfx::B2DPoint aPnt(mpWindow->GetInverseViewTransformation() * basegfx::B2DPoint(rMEvt.GetPosPixel().X(), rMEvt.GetPosPixel().Y())); bool bOverMarkableObject = mpView->PickObj( aPnt, fHitLog, pObj, SDRSEARCH_PICKMARKABLE); - if(bOverMarkableObject && HasContentForThisType(pObj->GetObjInventor(),pObj->GetObjIdentifier()) ) + if(bOverMarkableObject && pObj && HasContentForThisType(*pObj) ) mpWindow->SetPointer(Pointer(POINTER_FILL)); else mpWindow->SetPointer(Pointer(POINTER_ARROW)); @@ -242,11 +242,11 @@ void FuFormatPaintBrush::Deactivate() } } -bool FuFormatPaintBrush::HasContentForThisType( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const +bool FuFormatPaintBrush::HasContentForThisType( const SdrObject& rSdrObject ) const { if( mpItemSet.get() == 0 ) return false; - if( !mpView || (!mpView->SupportsFormatPaintbrush( nObjectInventor, nObjectIdentifier) ) ) + if( !mpView || (!mpView->SupportsFormatPaintbrush( rSdrObject ) ) ) return false; return true; } @@ -282,7 +282,7 @@ void FuFormatPaintBrush::Paste( bool bNo if( pSelected ) { - if( rDrawViewShell.GetDrawView()->SupportsFormatPaintbrush(pSelected->GetObjInventor(), pSelected->GetObjIdentifier()) ) + if( rDrawViewShell.GetDrawView()->SupportsFormatPaintbrush(*pSelected) ) return; } Modified: incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/futext.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/futext.cxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/futext.cxx (original) +++ incubator/ooo/branches/alg/aw080/main/sd/source/ui/func/futext.cxx Mon Jun 18 16:00:11 2012 @@ -817,11 +817,6 @@ bool FuText::MouseButtonUp(const MouseEv mxTextObj.reset( dynamic_cast< SdrTextObj* >( mpView->GetCreateObj() ) ); - if(mxTextObj.is()) - { - GetTextObj()->SetDisableAutoWidthOnDragging(true); - } - if(!mpView->EndCreateObj(SDRCREATE_FORCEEND)) { mxTextObj.reset(0); Modified: incubator/ooo/branches/alg/aw080/main/sd/source/ui/inc/fuformatpaintbrush.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/sd/source/ui/inc/fuformatpaintbrush.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/sd/source/ui/inc/fuformatpaintbrush.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/sd/source/ui/inc/fuformatpaintbrush.hxx Mon Jun 18 16:00:11 2012 @@ -55,7 +55,7 @@ private: void DoExecute( SfxRequest& rReq ); - bool HasContentForThisType( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const; + bool HasContentForThisType(const SdrObject& rSdrObject) const; void Paste( bool, bool ); void implcancel(); Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/fontworkgallery.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/fontworkgallery.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/fontworkgallery.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/fontworkgallery.hxx Mon Jun 18 16:00:11 2012 @@ -99,13 +99,12 @@ class SVX_DLLPUBLIC FontWorkGalleryDialo FmFormModel& mrModel; String maStrClickToAddText; + SdrObject** mppSdrObject; DECL_LINK( DoubleClickFavoriteHdl, void * ); DECL_LINK( ClickOKHdl, void * ); DECL_LINK( ClickTextDirectionHdl, ImageButton * ); - SdrObject** mppSdrObject; - SdrModel* mpDestModel; void initfavorites(sal_uInt16 nThemeId, std::vector< Bitmap * >& rFavorites); void insertSelectedFontwork(); @@ -115,11 +114,11 @@ class SVX_DLLPUBLIC FontWorkGalleryDialo std::vector< Bitmap * > maFavoritesHorizontal; public: - FontWorkGalleryDialog( SdrView& rView, Window* pParent, sal_uInt16 nSID ); + // if ppSdrObject is given the object is not inserted to the current page of the given view, but + // set at that pointer for further usage (ownership change). The SDrObject is always created + // for the SdrModel of the given SDrView. + FontWorkGalleryDialog( SdrView& rView, Window* pParent, SdrObject** ppSdrObject = 0 ); ~FontWorkGalleryDialog(); - - // SJ: if the SdrObject** is set, the SdrObject is not inserted into the page when executing the dialog - void SetSdrObjectRef( SdrObject**, SdrModel* pModel ); }; } Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/globl3d.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/globl3d.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/globl3d.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/globl3d.hxx Mon Jun 18 16:00:11 2012 @@ -37,12 +37,10 @@ const sal_uInt32 E3dInventor = sal_uInt3 sal_uInt32('1')*0x01000000; const sal_uInt16 E3D_SCENE_ID = 1; -const sal_uInt16 E3D_OBJECT_ID = 2; // TTTT should not be used, it's only a helper class for E3DScene and E3DCompoundObject -const sal_uInt16 E3D_CUBEOBJ_ID = 3; -const sal_uInt16 E3D_SPHEREOBJ_ID = 4; -const sal_uInt16 E3D_EXTRUDEOBJ_ID = 5; -const sal_uInt16 E3D_LATHEOBJ_ID = 6; -const sal_uInt16 E3D_COMPOUNDOBJ_ID = 7; // TTTT should not be used, is a base class only -const sal_uInt16 E3D_POLYGONOBJ_ID = 8; +const sal_uInt16 E3D_CUBEOBJ_ID = 2; +const sal_uInt16 E3D_SPHEREOBJ_ID = 3; +const sal_uInt16 E3D_EXTRUDEOBJ_ID = 4; +const sal_uInt16 E3D_LATHEOBJ_ID = 5; +const sal_uInt16 E3D_POLYGONOBJ_ID = 6; #endif // _E3D_GLOBL3D_HXX Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/attributeproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/attributeproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/attributeproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/attributeproperties.hxx Mon Jun 18 16:00:11 2012 @@ -36,16 +36,20 @@ namespace sdr { class SVX_DLLPUBLIC AttributeProperties : public DefaultProperties, public SfxListener { + private: // add style sheet, do all the necessary handling - void ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + void ImpAddStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // remove StyleSheet, do all the necessary handling void ImpRemoveStyleSheet(); - protected: + // do needed changes when cloning to a new model + void ImpModelChange(SdrModel& rSourceModel, SdrModel& rTargetModel); + // the SytleSheet of this object SfxStyleSheet* mpStyleSheet; + protected: // create a new itemset virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& pPool); @@ -69,7 +73,7 @@ namespace sdr virtual ~AttributeProperties(); // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // get the installed StyleSheet virtual SfxStyleSheet* GetStyleSheet() const; Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/captionproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/captionproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/captionproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/captionproperties.hxx Mon Jun 18 16:00:11 2012 @@ -55,7 +55,7 @@ namespace sdr virtual BaseProperties& Clone(SdrObject& rObj) const; // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // force default attributes for a specific object type, called from // DefaultProperties::GetObjectItemSet() if a new ItemSet is created Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/connectorproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/connectorproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/connectorproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/connectorproperties.hxx Mon Jun 18 16:00:11 2012 @@ -55,7 +55,7 @@ namespace sdr virtual BaseProperties& Clone(SdrObject& rObj) const; // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); }; } // end of namespace properties } // end of namespace sdr Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/customshapeproperties.hxx Mon Jun 18 16:00:11 2012 @@ -59,7 +59,7 @@ namespace sdr public: // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // force default attributes for a specific object type, called from // DefaultProperties::GetObjectItemSet() if a new ItemSet is created Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/defaultproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/defaultproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/defaultproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/defaultproperties.hxx Mon Jun 18 16:00:11 2012 @@ -35,6 +35,7 @@ namespace sdr { class SVX_DLLPUBLIC DefaultProperties : public BaseProperties { + private: protected: // the to be used ItemSet SfxItemSet* mpItemSet; @@ -87,7 +88,7 @@ namespace sdr virtual void SetObjectItemSet(const SfxItemSet& rSet); // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // get the installed StyleSheet virtual SfxStyleSheet* GetStyleSheet() const; Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dproperties.hxx Mon Jun 18 16:00:11 2012 @@ -56,7 +56,7 @@ namespace sdr virtual BaseProperties& Clone(SdrObject& rObj) const; // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); }; } // end of namespace properties } // end of namespace sdr Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/e3dsceneproperties.hxx Mon Jun 18 16:00:11 2012 @@ -71,7 +71,7 @@ namespace sdr virtual void ClearMergedItem(const sal_uInt16 nWhich = 0); // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // get the installed StyleSheet virtual SfxStyleSheet* GetStyleSheet() const; Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/emptyproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/emptyproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/emptyproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/emptyproperties.hxx Mon Jun 18 16:00:11 2012 @@ -87,7 +87,7 @@ namespace sdr virtual void SetObjectItemSet(const SfxItemSet& rSet); // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // get the installed StyleSheet virtual SfxStyleSheet* GetStyleSheet() const; Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/graphicproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/graphicproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/graphicproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/graphicproperties.hxx Mon Jun 18 16:00:11 2012 @@ -55,7 +55,7 @@ namespace sdr virtual BaseProperties& Clone(SdrObject& rObj) const; // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // force default attributes for a specific object type, called from // DefaultProperties::GetObjectItemSet() if a new ItemSet is created Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/groupproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/groupproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/groupproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/groupproperties.hxx Mon Jun 18 16:00:11 2012 @@ -99,7 +99,7 @@ namespace sdr virtual void SetObjectItemSet(const SfxItemSet& rSet); // set a new StyleSheet - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // get the local StyleSheet virtual SfxStyleSheet* GetStyleSheet() const; Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/measureproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/measureproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/measureproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/measureproperties.hxx Mon Jun 18 16:00:11 2012 @@ -55,7 +55,7 @@ namespace sdr virtual BaseProperties& Clone(SdrObject& rObj) const; // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // force default attributes for a specific object type, called from // DefaultProperties::GetObjectItemSet() if a new ItemSet is created Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/properties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/properties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/properties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/properties.hxx Mon Jun 18 16:00:11 2012 @@ -143,7 +143,7 @@ namespace sdr // Set a new StyleSheet. Registers as listener at the StyleSheet to get knowledge // of StyleSheet changes. - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr) = 0; + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) = 0; // Get the installed StyleSheet. virtual SfxStyleSheet* GetStyleSheet() const = 0; Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/rectangleproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/rectangleproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/rectangleproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/rectangleproperties.hxx Mon Jun 18 16:00:11 2012 @@ -53,7 +53,7 @@ namespace sdr virtual BaseProperties& Clone(SdrObject& rObj) const; // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); }; } // end of namespace properties } // end of namespace sdr Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/textproperties.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/textproperties.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/textproperties.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/sdr/properties/textproperties.hxx Mon Jun 18 16:00:11 2012 @@ -63,7 +63,7 @@ namespace sdr virtual BaseProperties& Clone(SdrObject& rObj) const; // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, sal_Bool bDontRemoveHardAttr); + virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr); // force default attributes for a specific object type, called from // DefaultProperties::GetObjectItemSet() if a new ItemSet is created Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdedxv.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdedxv.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdedxv.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdedxv.hxx Mon Jun 18 16:00:11 2012 @@ -76,6 +76,10 @@ protected: basegfx::B2DPoint maMacroDownPos; sal_uInt16 mnMacroTol; + /// prepared undos for text edit + SdrUndoAction* mpUndoGeoObject; + SdrUndoAction* mpUndoAttrObject; + /// bitfield bool mbTextEditDontDelete : 1; // Outliner und View bei SdrEndTextEdit nicht deleten (f. Rechtschreibpruefung) bool mbTextEditOnlyOneView : 1; // Nur eine OutlinerView (f. Rechtschreibpruefung) @@ -247,8 +251,8 @@ public: rtl::Reference< sdr::SelectionController > getSelectionController() const { return mxSelectionController; } - /** returns true if the shape identified by its inventor and identifier supports format paint brush operation */ - virtual bool SupportsFormatPaintbrush( sal_uInt32 nObjectInventor, sal_uInt16 nObjectIdentifier ) const; + /** returns true if the shape supports format paint brush operation */ + virtual bool SupportsFormatPaintbrush(const SdrObject& rSdrObject) const; /** returns a format paint brush set from the current selection */ virtual bool TakeFormatPaintBrush( boost::shared_ptr< SfxItemSet >& rFormatSet ); Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdoashp.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdoashp.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdoashp.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdoashp.hxx Mon Jun 18 16:00:11 2012 @@ -182,7 +182,7 @@ public: virtual bool MovCreate(SdrDragStat& rStat); // #i37448# virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd); - virtual bool AdjustTextFrameWidthAndHeight(basegfx::B2DRange& o_rRange, bool bHgt = true, bool bWdt = true) const; + virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt = true, bool bWdt = true) const; virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true); virtual bool IsAutoGrowHeight() const; virtual bool IsAutoGrowWidth() const; Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotable.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotable.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotable.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotable.hxx Mon Jun 18 16:00:11 2012 @@ -225,7 +225,7 @@ public: virtual sal_uInt16 GetObjIdentifier() const; virtual void SetChanged(); - virtual bool AdjustTextFrameWidthAndHeight(basegfx::B2DRange& o_rRange, bool bHgt = true, bool bWdt = true) const; + virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt = true, bool bWdt = true) const; virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true); virtual void TakeObjNameSingul(String& rName) const; virtual void TakeObjNamePlural(String& rName) const; Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotext.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotext.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotext.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdotext.hxx Mon Jun 18 16:00:11 2012 @@ -294,7 +294,7 @@ protected: virtual void copyDataFromSdrObject(const SdrObject& rSource); // helper for AdjustTextFrameWidthAndHeight which contains the common parts to avoid useless code copying - bool ImpAdjustTextFrameWidthAndHeight(basegfx::B2DRange& o_rRange, bool bHgt, bool bWdt, bool bCheckAnimation) const; + basegfx::B2DRange ImpAdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt, bool bWdt, bool bCheckAnimation) const; public: /// create a copy, evtl. with a different target model (if given) @@ -322,7 +322,7 @@ public: bool ReloadLinkedText(bool bForceLoad=false); bool LoadText(const String& rFileName, const String& rFilterName, rtl_TextEncoding eCharSet); - virtual bool AdjustTextFrameWidthAndHeight(basegfx::B2DRange& o_rRange, bool bHgt = true, bool bWdt = true) const; + virtual basegfx::B2DRange AdjustTextFrameWidthAndHeight(const basegfx::B2DRange& rRange, bool bHgt = true, bool bWdt = true) const; virtual bool AdjustTextFrameWidthAndHeight(bool bHgt = true, bool bWdt = true); void ResizeTextAttributes(const Fraction& xFact, const Fraction& yFact); bool IsTextFrame() const { return bTextFrame; } Modified: incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdtext.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdtext.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdtext.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/inc/svx/svdtext.hxx Mon Jun 18 16:00:11 2012 @@ -64,6 +64,9 @@ public: /** returns the current OutlinerParaObject and removes it from this instance */ OutlinerParaObject* RemoveOutlinerParaObject(); + // support model change, e.g. when text object is cloned to a new SdrModel + void ImpModelChange(SdrModel& rSourceModel, SdrModel& rTargetModel); + protected: virtual const SfxItemSet& GetObjectItemSet(); virtual void SetObjectItem(const SfxPoolItem& rItem); Modified: incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape2d.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape2d.cxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape2d.cxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape2d.cxx Mon Jun 18 16:00:11 2012 @@ -1144,7 +1144,7 @@ basegfx::B2DRange EnhancedCustomShape2d: // To keep tight to the original, ignore rotate and shear. If this // is not wanted, just use getSdrObjectTransformation() instead - aTransform.scale(pCustomShapeObj->getSdrObjectScale()); + aTransform.scale(basegfx::absolute(pCustomShapeObj->getSdrObjectScale())); aTransform.translate(pCustomShapeObj->getSdrObjectTranslate()); aRetval *= aTransform; @@ -2072,7 +2072,7 @@ SdrObject* EnhancedCustomShape2d::Create else { vTempList.push_back(pObj); - } + } } vObjectList = vTempList; Modified: incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.cxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.cxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.cxx Mon Jun 18 16:00:11 2012 @@ -19,8 +19,6 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include "EnhancedCustomShape3d.hxx" @@ -58,6 +56,7 @@ #include #include #include +#include #define ITEMVALUE(ItemSet,Id,Cast) ((const Cast&)(ItemSet).Get(Id)).GetValue() using namespace com::sun::star; @@ -104,7 +103,7 @@ void GetSkew( SdrCustomShapeGeometryItem rSkewAngle *= F_PI180; } -void GetExtrusionDepth( SdrCustomShapeGeometryItem& rItem, const double* pMap, double& rBackwardDepth, double& rForwardDepth ) +void GetExtrusionDepth( SdrCustomShapeGeometryItem& rItem, const double fMap, double& rBackwardDepth, double& rForwardDepth ) { ::com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepthParaPair; double fDepth = 0, fFraction = 0; @@ -120,22 +119,20 @@ void GetExtrusionDepth( SdrCustomShapeGe rBackwardDepth = 1270; rForwardDepth = 0; } - if ( pMap ) - { - double fMap = *pMap; - rBackwardDepth *= fMap; - rForwardDepth *= fMap; - } + + rBackwardDepth *= fMap; + rForwardDepth *= fMap; } -double GetDouble( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, double fDefault, const double* pMap ) +double GetDouble( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, double fDefault, const double fMap ) { double fRetValue = fDefault; Any* pAny = rItem.GetPropertyValueByName( sExtrusion, rPropertyName ); if ( pAny ) *pAny >>= fRetValue; - if ( pMap ) - fRetValue *= *pMap; + + fRetValue *= fMap; + return fRetValue; } @@ -177,19 +174,18 @@ awt::Point GetPoint( SdrCustomShapeGeome } drawing::Position3D GetPosition3D( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, - const drawing::Position3D& rDefault, const double* pMap ) + const drawing::Position3D& rDefault, const double fMap ) { drawing::Position3D aRetValue( rDefault ); const Any* pAny = rItem.GetPropertyValueByName( sExtrusion, rPropertyName ); if ( pAny ) *pAny >>= aRetValue; - if ( pMap ) - { - aRetValue.PositionX *= *pMap; - aRetValue.PositionY *= *pMap; - aRetValue.PositionZ *= *pMap; - } - return aRetValue; + + aRetValue.PositionX *= fMap; + aRetValue.PositionY *= fMap; + aRetValue.PositionZ *= fMap; + + return aRetValue; } drawing::Direction3D GetDirection3D( SdrCustomShapeGeometryItem& rItem, const rtl::OUString& rPropertyName, const drawing::Direction3D& rDefault ) @@ -201,198 +197,211 @@ drawing::Direction3D GetDirection3D( Sdr return aRetValue; } -EnhancedCustomShape3d::Transformation2D::Transformation2D( const SdrObject* pCustomShape, const Rectangle& /*rBoundRect*/, const double *pM ) -: aCenter( sdr::legacy::GetSnapRect(*pCustomShape).Center() ) -, eProjectionMode( drawing::ProjectionMode_PARALLEL ) -, pMap( pM ) -{ - SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); - const rtl::OUString sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) ); - Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode ); - if ( pAny ) - *pAny >>= eProjectionMode; - - if ( eProjectionMode == drawing::ProjectionMode_PARALLEL ) - GetSkew( rGeometryItem, fSkew, fSkewAngle ); +EnhancedCustomShape3d::Transformation2D::Transformation2D(const SdrObjCustomShape& rCustomShape, const double fM) +: maCenter() +, meProjectionMode(drawing::ProjectionMode_PARALLEL) +, mfMap(fM) +{ + SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)rCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY); + const rtl::OUString sProjectionMode(RTL_CONSTASCII_USTRINGPARAM("ProjectionMode")); + Any* pAny = rGeometryItem.GetPropertyValueByName(sExtrusion, sProjectionMode); + maCenter = rCustomShape.getSdrObjectTransformation() * basegfx::B2DPoint(0.5, 0.5); + + if(pAny) + { + *pAny >>= meProjectionMode; + } + + if(drawing::ProjectionMode_PARALLEL == meProjectionMode) + { + GetSkew(rGeometryItem, mfSkew, mfSkewAngle); + } else { - fZScreen = 0.0; - GetOrigin( rGeometryItem, fOriginX, fOriginY ); - const Rectangle aLogicRect(sdr::legacy::GetLogicRect(*pCustomShape)); - fOriginX = fOriginX * aLogicRect.GetWidth(); - fOriginY = fOriginY * aLogicRect.GetHeight(); - - const rtl::OUString sViewPoint( RTL_CONSTASCII_USTRINGPARAM ( "ViewPoint" ) ); - drawing::Position3D aViewPointDefault( 3472, -3472, 25000 ); - drawing::Position3D aViewPoint( GetPosition3D( rGeometryItem, sViewPoint, aViewPointDefault, pMap ) ); - fViewPoint.setX(aViewPoint.PositionX); - fViewPoint.setY(aViewPoint.PositionY); - fViewPoint.setZ(-aViewPoint.PositionZ); + const basegfx::B2DVector& rScale = rCustomShape.getSdrObjectScale(); + const rtl::OUString sViewPoint(RTL_CONSTASCII_USTRINGPARAM("ViewPoint")); + + mfZScreen = 0.0; + GetOrigin(rGeometryItem, mfOriginX, mfOriginY); + mfOriginX *= fabs(rScale.getX()); + mfOriginY *= fabs(rScale.getY()); + drawing::Position3D aViewPointDefault(3472, -3472, 25000); + drawing::Position3D aViewPoint(GetPosition3D(rGeometryItem, sViewPoint, aViewPointDefault, mfMap)); + mfViewPoint.setX(aViewPoint.PositionX); + mfViewPoint.setY(aViewPoint.PositionY); + mfViewPoint.setZ(-aViewPoint.PositionZ); } } -basegfx::B3DPolygon EnhancedCustomShape3d::Transformation2D::ApplySkewSettings( const basegfx::B3DPolygon& rPoly3D ) const +basegfx::B3DPolygon EnhancedCustomShape3d::Transformation2D::ApplySkewSettings(const basegfx::B3DPolygon& rPoly3D) const { basegfx::B3DPolygon aRetval; - sal_uInt32 j; - for ( j = 0L; j < rPoly3D.count(); j++ ) + + for(j = 0; j < rPoly3D.count(); j++) { const basegfx::B3DPoint aPoint(rPoly3D.getB3DPoint(j)); - double fDepth(-( aPoint.getZ() * fSkew ) / 100.0); - aRetval.append(basegfx::B3DPoint( - aPoint.getX() + (fDepth * cos( fSkewAngle )), - aPoint.getY() - (fDepth * sin( fSkewAngle )), - aPoint.getZ())); + double fDepth(-(aPoint.getZ() * mfSkew) / 100.0); + + aRetval.append( + basegfx::B3DPoint( + aPoint.getX() + (fDepth * cos(mfSkewAngle)), + aPoint.getY() - (fDepth * sin(mfSkewAngle)), + aPoint.getZ())); } return aRetval; } -Point EnhancedCustomShape3d::Transformation2D::Transform2D( const basegfx::B3DPoint& rPoint3D ) const +basegfx::B2DPoint EnhancedCustomShape3d::Transformation2D::Transform2D(const basegfx::B3DPoint& rPoint3D) const { - Point aPoint2D; - if ( eProjectionMode == drawing::ProjectionMode_PARALLEL ) + basegfx::B2DPoint aPoint2D; + + if(drawing::ProjectionMode_PARALLEL == meProjectionMode) { - aPoint2D.X() = (sal_Int32)rPoint3D.getX(); - aPoint2D.Y() = (sal_Int32)rPoint3D.getY(); + aPoint2D.setX(rPoint3D.getX()); + aPoint2D.setY(rPoint3D.getY()); } else { - double fX = rPoint3D.getX() - fOriginX; - double fY = rPoint3D.getY() - fOriginY; - double f = ( fZScreen - fViewPoint.getZ() ) / ( rPoint3D.getZ() - fViewPoint.getZ() ); - aPoint2D.X() = (sal_Int32)(( fX - fViewPoint.getX() ) * f + fViewPoint.getX() + fOriginX ); - aPoint2D.Y() = (sal_Int32)(( fY - fViewPoint.getY() ) * f + fViewPoint.getY() + fOriginY ); + const double fX(rPoint3D.getX() - mfOriginX); + const double fY(rPoint3D.getY() - mfOriginY); + const double f((mfZScreen - mfViewPoint.getZ()) / (rPoint3D.getZ() - mfViewPoint.getZ())); + + aPoint2D.setX((fX - mfViewPoint.getX()) * f + mfViewPoint.getX() + mfOriginX); + aPoint2D.setY((fY - mfViewPoint.getY()) * f + mfViewPoint.getY() + mfOriginY); } - aPoint2D.Move( aCenter.X(), aCenter.Y() ); - return aPoint2D; + + aPoint2D += maCenter; + + return aPoint2D; } -sal_Bool EnhancedCustomShape3d::Transformation2D::IsParallel() const +bool EnhancedCustomShape3d::Transformation2D::IsParallel() const { - return eProjectionMode == com::sun::star::drawing::ProjectionMode_PARALLEL; + return meProjectionMode == com::sun::star::drawing::ProjectionMode_PARALLEL; } -SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, const SdrObject* pCustomShape ) +SdrObject* EnhancedCustomShape3d::Create3DObject(const SdrObject& rShape2d, const SdrObjCustomShape& rCustomShape) { - SdrObject* pRet = NULL; - SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); - - double fMap = 1.0, *pMap = NULL; - Fraction aFraction( pCustomShape->getSdrModelFromSdrObject().GetExchangeObjectScale() ); - if ( ( aFraction.GetNumerator() ) != 1 || ( aFraction.GetDenominator() != 1 ) ) - { - fMap *= aFraction.GetNumerator(); - fMap /= aFraction.GetDenominator(); - pMap = &fMap; - } - if ( pCustomShape->getSdrModelFromSdrObject().GetExchangeObjectUnit() != MAP_100TH_MM ) - { - DBG_ASSERT( pCustomShape->getSdrModelFromSdrObject().GetExchangeObjectUnit() == MAP_TWIP, "EnhancedCustomShape3d::Current MapMode is Unsupported" ); - fMap *= 1440.0 / 2540.0; - pMap = &fMap; - } - if ( GetBool( rGeometryItem, sExtrusion, sal_False ) ) + SdrObject* pRet = 0; + SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)rCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY); + double fMap(1.0); + const double fFraction(rCustomShape.getSdrModelFromSdrObject().GetExchangeObjectScale()); + + if(!basegfx::fTools::equal(fFraction, 1.0)) { - sal_Bool bIsMirroredX = ((SdrObjCustomShape*)pCustomShape)->IsMirroredX(); - sal_Bool bIsMirroredY = ((SdrObjCustomShape*)pCustomShape)->IsMirroredY(); - Rectangle aSnapRect( sdr::legacy::GetLogicRect(*pCustomShape) ); - long nObjectRotation(sdr::legacy::GetRotateAngle(*pCustomShape)); - if ( nObjectRotation ) - { - double a = ( 36000 - nObjectRotation ) * nPi180; - long dx = aSnapRect.Right() - aSnapRect.Left(); - long dy = aSnapRect.Bottom()- aSnapRect.Top(); - Point aP( aSnapRect.TopLeft() ); - RotatePoint( aP, sdr::legacy::GetSnapRect(*pCustomShape).Center(), sin( a ), cos( a ) ); - aSnapRect.Left() = aP.X(); - aSnapRect.Top() = aP.Y(); - aSnapRect.Right() = aSnapRect.Left() + dx; - aSnapRect.Bottom() = aSnapRect.Top() + dy; - } - Point aCenter( aSnapRect.Center() ); + fMap *= fFraction; + } + + if(MAP_100TH_MM != rCustomShape.getSdrModelFromSdrObject().GetExchangeObjectUnit()) + { + DBG_ASSERT(MAP_TWIP == rCustomShape.getSdrModelFromSdrObject().GetExchangeObjectUnit(), + "EnhancedCustomShape3d::Current MapMode is Unsupported"); + fMap *= 1440.0 / 2540.0; + } - SfxItemSet aSet( pCustomShape->GetMergedItemSet() ); + if(GetBool(rGeometryItem, sExtrusion, false)) + { + const bool bIsMirroredX(rCustomShape.IsMirroredX()); + const bool bIsMirroredY(rCustomShape.IsMirroredY()); + basegfx::B2DRange aSnapRange(basegfx::B2DRange::getUnitB2DRange()); + SfxItemSet aSet(rCustomShape.GetMergedItemSet()); + std::vector< E3dCompoundObject* > aPlaceholderObjectList; + double fExtrusionBackward(0.0), fExtrusionForward(0.0); + + // take transformation into account, including rotation and shear + aSnapRange.transform(rCustomShape.getSdrObjectTransformation()); //SJ: vertical writing is not required, by removing this item no outliner is created - aSet.ClearItem( SDRATTR_TEXTDIRECTION ); + aSet.ClearItem(SDRATTR_TEXTDIRECTION); // #i105323# For 3D AutoShapes, the shadow attribute has to be applied to each // created visualisation helper model shape individually. The shadow itself // will then be rendered from the 3D renderer correctly for the whole 3D scene // (and thus behind all objects of which the visualisation may be built). So, - // dio NOT remove it from the ItemSet here. + // do NOT remove it from the ItemSet here. // aSet.ClearItem(SDRATTR_SHADOW); - std::vector< E3dCompoundObject* > aPlaceholderObjectList; + GetExtrusionDepth(rGeometryItem, fMap, fExtrusionBackward, fExtrusionForward); + double fDepth(fExtrusionBackward - fExtrusionForward); - double fExtrusionBackward, fExtrusionForward; - GetExtrusionDepth( rGeometryItem, pMap, fExtrusionBackward, fExtrusionForward ); - double fDepth = fExtrusionBackward - fExtrusionForward; - if ( fDepth < 1.0 ) + if(fDepth < 1.0) + { fDepth = 1.0; + } - drawing::ProjectionMode eProjectionMode( drawing::ProjectionMode_PARALLEL ); - const rtl::OUString sProjectionMode( RTL_CONSTASCII_USTRINGPARAM ( "ProjectionMode" ) ); - Any* pAny = rGeometryItem.GetPropertyValueByName( sExtrusion, sProjectionMode ); - if ( pAny ) + drawing::ProjectionMode eProjectionMode(drawing::ProjectionMode_PARALLEL); + const rtl::OUString sProjectionMode(RTL_CONSTASCII_USTRINGPARAM("ProjectionMode")); + Any* pAny = rGeometryItem.GetPropertyValueByName(sExtrusion, sProjectionMode); + + if(pAny) + { *pAny >>= eProjectionMode; - ProjectionType eProjectionType( eProjectionMode == drawing::ProjectionMode_PARALLEL ? PR_PARALLEL : PR_PERSPECTIVE ); - - // pShape2d Umwandeln in Szene mit 3D Objekt - E3dDefaultAttributes a3DDefaultAttr; - a3DDefaultAttr.SetDefaultLatheCharacterMode( sal_True ); - a3DDefaultAttr.SetDefaultExtrudeCharacterMode( sal_True ); + } - E3dScene* pScene = new E3dScene( pCustomShape->getSdrModelFromSdrObject(), a3DDefaultAttr ); + ProjectionType eProjectionType(drawing::ProjectionMode_PARALLEL == eProjectionMode ? PR_PARALLEL : PR_PERSPECTIVE); - sal_Bool bSceneHasObjects ( sal_False ); - sal_Bool bUseTwoFillStyles( sal_False ); + // rShape2d Umwandeln in Szene mit 3D Objekt + E3dDefaultAttributes a3DDefaultAttr; + + a3DDefaultAttr.SetDefaultLatheCharacterMode(true); + a3DDefaultAttr.SetDefaultExtrudeCharacterMode(true); - drawing::ShadeMode eShadeMode( GetShadeMode( rGeometryItem, drawing::ShadeMode_FLAT ) ); - const rtl::OUString sExtrusionColor( RTL_CONSTASCII_USTRINGPARAM ( "Color" ) ); - sal_Bool bUseExtrusionColor = GetBool( rGeometryItem, sExtrusionColor, sal_False ); + E3dScene* pScene = new E3dScene(rCustomShape.getSdrModelFromSdrObject(), a3DDefaultAttr); - XFillStyle eFillStyle( ITEMVALUE( aSet, XATTR_FILLSTYLE, XFillStyleItem ) ); - pScene->GetProperties().SetObjectItem( Svx3DShadeModeItem( 0 ) ); - aSet.Put( SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, 0 ) ); - aSet.Put( Svx3DTextureModeItem( 1 ) ); - aSet.Put( Svx3DNormalsKindItem( 1 ) ); + bool bSceneHasObjects(false); + bool bUseTwoFillStyles(false); + const drawing::ShadeMode eShadeMode(GetShadeMode(rGeometryItem, drawing::ShadeMode_FLAT)); + const rtl::OUString sExtrusionColor(RTL_CONSTASCII_USTRINGPARAM("Color")); + const bool bUseExtrusionColor(GetBool(rGeometryItem, sExtrusionColor, false)); + const XFillStyle eFillStyle(ITEMVALUE(aSet, XATTR_FILLSTYLE, XFillStyleItem)); + + pScene->GetProperties().SetObjectItem(Svx3DShadeModeItem(0)); + aSet.Put(SfxUInt16Item(SDRATTR_3DOBJ_PERCENT_DIAGONAL, 0)); + aSet.Put(Svx3DTextureModeItem(1)); + aSet.Put(Svx3DNormalsKindItem(1)); - if ( eShadeMode == drawing::ShadeMode_DRAFT ) + if(drawing::ShadeMode_DRAFT == eShadeMode) { - aSet.Put( XLineStyleItem( XLINE_SOLID ) ); - aSet.Put( XFillStyleItem ( XFILL_NONE ) ); - aSet.Put( SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, sal_True ) ); + aSet.Put(XLineStyleItem(XLINE_SOLID)); + aSet.Put(XFillStyleItem(XFILL_NONE)); + aSet.Put(SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, true)); } else { - aSet.Put( XLineStyleItem( XLINE_NONE ) ); - if ( eFillStyle == XFILL_NONE ) - aSet.Put( XFillStyleItem( XFILL_SOLID ) ); - else if ( ( eFillStyle == XFILL_BITMAP ) || ( eFillStyle == XFILL_GRADIENT ) || bUseExtrusionColor ) - bUseTwoFillStyles = sal_True; + aSet.Put(XLineStyleItem(XLINE_NONE)); + + if(XFILL_NONE == eFillStyle) + { + aSet.Put(XFillStyleItem(XFILL_SOLID)); + } + else if(XFILL_BITMAP == eFillStyle || XFILL_GRADIENT == eFillStyle || bUseExtrusionColor) + { + bUseTwoFillStyles = true; + } // #116336# // If shapes are mirrored once (mirroring two times correct geometry again) // double-sided at the object and two-sided-lighting at the scene need to be set. if((bIsMirroredX && !bIsMirroredY) || (!bIsMirroredX && bIsMirroredY)) { - aSet.Put( SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, sal_True ) ); - pScene->GetProperties().SetObjectItem( SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, sal_True ) ); + aSet.Put(SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, true)); + + pScene->GetProperties().SetObjectItem(SfxBoolItem(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING, true)); } } - Rectangle aBoundRect2d; - SdrObjListIter aIter( *pShape2d, IM_DEEPWITHGROUPS ); - while( aIter.IsMore() ) + basegfx::B2DRange aAllPolyPolygonRange; + SdrObjListIter aIter(rShape2d, IM_DEEPWITHGROUPS); + + while(aIter.IsMore()) { const SdrObject* pNext = aIter.Next(); basegfx::B2DPolyPolygon aPolyPoly; const SdrPathObj* pSdrPathObj = dynamic_cast< const SdrPathObj* >(pNext); - if ( pSdrPathObj ) + if(pSdrPathObj) { aPolyPoly = pSdrPathObj->getB2DPolyPolygonInObjectCoordinates(); @@ -403,101 +412,145 @@ SdrObject* EnhancedCustomShape3d::Create } else { - SdrObject* pNewObj = pNext->ConvertToPolyObj( false, false); + SdrObject* pNewObj = pNext->ConvertToPolyObj(false, false); SdrPathObj* pPath = dynamic_cast< SdrPathObj* >(pNewObj); - if ( pPath ) + + if(pPath) + { aPolyPoly = pPath->getB2DPolyPolygonInObjectCoordinates(); - deleteSdrObjectSafeAndClearPointer( pNewObj ); + } + + deleteSdrObjectSafeAndClearPointer(pNewObj); } if( aPolyPoly.count() ) { - const basegfx::B2DRange aTempRange(basegfx::tools::getRange(aPolyPoly)); - const Rectangle aBoundRect(basegfx::fround(aTempRange.getMinX()), basegfx::fround(aTempRange.getMinY()), basegfx::fround(aTempRange.getMaxX()), basegfx::fround(aTempRange.getMaxY())); - aBoundRect2d.Union( aBoundRect ); - - E3dCompoundObject* p3DObj = new E3dExtrudeObj( pCustomShape->getSdrModelFromSdrObject(), a3DDefaultAttr, aPolyPoly, bUseTwoFillStyles ? 10 : fDepth ); - p3DObj->SetLayer( pShape2d->GetLayer() ); - p3DObj->SetMergedItemSet( aSet ); - const bool bIsPlaceholderObject((((XFillStyleItem&)pNext->GetMergedItem( XATTR_FILLSTYLE )).GetValue() == XFILL_NONE ) - && (((XLineStyleItem&)pNext->GetMergedItem( XATTR_LINESTYLE )).GetValue() == XLINE_NONE )); - if ( bIsPlaceholderObject ) - aPlaceholderObjectList.push_back( p3DObj ); - else if ( bUseTwoFillStyles ) + const basegfx::B2DRange aPolyPolygonRange(aPolyPoly.getB2DRange()); + + aAllPolyPolygonRange.expand(aPolyPolygonRange); + + E3dCompoundObject* p3DObj = new E3dExtrudeObj( + rCustomShape.getSdrModelFromSdrObject(), + a3DDefaultAttr, + aPolyPoly, + bUseTwoFillStyles ? 10 : fDepth); + + p3DObj->SetLayer(rShape2d.GetLayer()); + p3DObj->SetMergedItemSet(aSet); + + const bool bIsPlaceholderObject(XFILL_NONE == ((XFillStyleItem&)pNext->GetMergedItem( XATTR_FILLSTYLE )).GetValue() + && XLINE_NONE == ((XLineStyleItem&)pNext->GetMergedItem( XATTR_LINESTYLE )).GetValue()); + + if(bIsPlaceholderObject) + { + aPlaceholderObjectList.push_back(p3DObj); + } + else if(bUseTwoFillStyles) { BitmapEx aFillBmp; - sal_Bool bFillBmpTile = ((XFillBmpTileItem&)p3DObj->GetMergedItem( XATTR_FILLBMP_TILE )).GetValue(); - if ( bFillBmpTile ) + const bool bFillBmpTile(((XFillBmpTileItem&)p3DObj->GetMergedItem( XATTR_FILLBMP_TILE )).GetValue()); + + if(bFillBmpTile) { const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP); - aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); - Size aLogicalSize = aFillBmp.GetPrefSize(); - if ( aFillBmp.GetPrefMapMode() == MAP_PIXEL ) - aLogicalSize = Application::GetDefaultDevice()->PixelToLogic( aLogicalSize, MAP_100TH_MM ); + + aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); + + Size aLogicalSize(aFillBmp.GetPrefSize()); + + if(MapMode(MAP_PIXEL) == aFillBmp.GetPrefMapMode()) + { + aLogicalSize = Application::GetDefaultDevice()->PixelToLogic(aLogicalSize, MAP_100TH_MM); + } else - aLogicalSize = OutputDevice::LogicToLogic( aLogicalSize, aFillBmp.GetPrefMapMode(), MAP_100TH_MM ); - aLogicalSize.Width() *= 5; ;// :-( nice scaling, look at engine3d/obj3d.cxx + { + aLogicalSize = OutputDevice::LogicToLogic(aLogicalSize, aFillBmp.GetPrefMapMode(), MAP_100TH_MM); + } + + aLogicalSize.Width() *= 5; // :-( nice scaling, look at engine3d/obj3d.cxx aLogicalSize.Height() *= 5; - aFillBmp.SetPrefSize( aLogicalSize ); - aFillBmp.SetPrefMapMode( MAP_100TH_MM ); + aFillBmp.SetPrefSize(aLogicalSize); + aFillBmp.SetPrefMapMode(MAP_100TH_MM); p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); } else { - if ( aSnapRect != aBoundRect ) + if(!aSnapRange.equal(aPolyPolygonRange)) { const XFillBitmapItem& rBmpItm = (XFillBitmapItem&)p3DObj->GetMergedItem(XATTR_FILLBITMAP); - aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); - Size aBmpSize( aFillBmp.GetSizePixel() ); - double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth(); - double fYScale = (double)aBoundRect.GetHeight() / (double)aSnapRect.GetHeight(); - - Point aPt( (sal_Int32)( (double)( aBoundRect.Left() - aSnapRect.Left() )* (double)aBmpSize.Width() / (double)aSnapRect.GetWidth() ), - (sal_Int32)( (double)( aBoundRect.Top() - aSnapRect.Top() ) * (double)aBmpSize.Height() / (double)aSnapRect.GetHeight() ) ); - Size aSize( (sal_Int32)( aBmpSize.Width() * fXScale ), - (sal_Int32)( aBmpSize.Height() * fYScale ) ); - Rectangle aCropRect( aPt, aSize ); - aFillBmp.Crop( aCropRect ); + + aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); + + const Size aBmpSize(aFillBmp.GetSizePixel()); + const double fXScale(aPolyPolygonRange.getWidth() / aSnapRange.getWidth()); + const double fYScale(aPolyPolygonRange.getHeight() / aSnapRange.getHeight()); + + const Point aPt( + basegfx::fround((aPolyPolygonRange.getMinX() - aSnapRange.getMinX()) * (double)aBmpSize.Width() / aSnapRange.getWidth()), + basegfx::fround((aPolyPolygonRange.getMinY() - aSnapRange.getMinY()) * (double)aBmpSize.Height() / aSnapRange.getHeight())); + const Size aSize( + basegfx::fround((double)aBmpSize.Width() * fXScale), + basegfx::fround((double)aBmpSize.Height() * fYScale)); + const Rectangle aCropRect(aPt, aSize); + + aFillBmp.Crop(aCropRect); p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); } } + + pScene->Insert3DObj(*p3DObj); + p3DObj = new E3dExtrudeObj( + rCustomShape.getSdrModelFromSdrObject(), + a3DDefaultAttr, + aPolyPoly, + fDepth); + p3DObj->SetLayer(rShape2d.GetLayer()); + p3DObj->SetMergedItemSet(aSet); + + if(bUseExtrusionColor) + { + p3DObj->SetMergedItem(XFillColorItem(String(), ((XSecondaryFillColorItem&)rCustomShape.GetMergedItem(XATTR_SECONDARYFILLCOLOR)).GetColorValue())); + } + + p3DObj->SetMergedItem(XFillStyleItem(XFILL_SOLID)); + p3DObj->SetMergedItem(Svx3DCloseFrontItem(false)); + p3DObj->SetMergedItem(Svx3DCloseBackItem(false)); pScene->Insert3DObj(*p3DObj); - p3DObj = new E3dExtrudeObj( pCustomShape->getSdrModelFromSdrObject(), a3DDefaultAttr, aPolyPoly, fDepth ); - p3DObj->SetLayer( pShape2d->GetLayer() ); - p3DObj->SetMergedItemSet( aSet ); - if ( bUseExtrusionColor ) - p3DObj->SetMergedItem( XFillColorItem( String(), ((XSecondaryFillColorItem&)pCustomShape->GetMergedItem( XATTR_SECONDARYFILLCOLOR )).GetColorValue() ) ); - p3DObj->SetMergedItem( XFillStyleItem( XFILL_SOLID ) ); - p3DObj->SetMergedItem( Svx3DCloseFrontItem( sal_False ) ); - p3DObj->SetMergedItem( Svx3DCloseBackItem( sal_False ) ); - pScene->Insert3DObj(*p3DObj); - p3DObj = new E3dExtrudeObj( pCustomShape->getSdrModelFromSdrObject(), a3DDefaultAttr, aPolyPoly, 10 ); - p3DObj->SetLayer( pShape2d->GetLayer() ); - p3DObj->SetMergedItemSet( aSet ); - basegfx::B3DHomMatrix aFrontTransform( p3DObj->GetB3DTransform() ); - aFrontTransform.translate( 0.0, 0.0, fDepth ); - p3DObj->SetB3DTransform( aFrontTransform ); + p3DObj = new E3dExtrudeObj( + rCustomShape.getSdrModelFromSdrObject(), + a3DDefaultAttr, + aPolyPoly, + 10); + p3DObj->SetLayer(rShape2d.GetLayer()); + p3DObj->SetMergedItemSet(aSet); + + basegfx::B3DHomMatrix aFrontTransform(p3DObj->GetB3DTransform()); + + aFrontTransform.translate(0.0, 0.0, fDepth); + p3DObj->SetB3DTransform(aFrontTransform); - if ( ( eFillStyle == XFILL_BITMAP ) && !aFillBmp.IsEmpty() ) + if(XFILL_BITMAP == eFillStyle && !aFillBmp.IsEmpty()) { p3DObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aFillBmp))); } } - else if ( eFillStyle == XFILL_NONE ) + else if(XFILL_NONE == eFillStyle) { - XLineColorItem& rLineColor = (XLineColorItem&)p3DObj->GetMergedItem( XATTR_LINECOLOR ); - p3DObj->SetMergedItem( XFillColorItem( String(), rLineColor.GetColorValue() ) ); - p3DObj->SetMergedItem( SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, sal_True ) ); - p3DObj->SetMergedItem( Svx3DCloseFrontItem( sal_False ) ); - p3DObj->SetMergedItem( Svx3DCloseBackItem( sal_False ) ); + const XLineColorItem& rLineColor = (XLineColorItem&)p3DObj->GetMergedItem(XATTR_LINECOLOR); + + p3DObj->SetMergedItem(XFillColorItem(String(), rLineColor.GetColorValue())); + p3DObj->SetMergedItem(SfxBoolItem(SDRATTR_3DOBJ_DOUBLE_SIDED, true)); + p3DObj->SetMergedItem(Svx3DCloseFrontItem(false)); + p3DObj->SetMergedItem(Svx3DCloseBackItem(false)); } - pScene->Insert3DObj(*p3DObj); - bSceneHasObjects = sal_True; + + pScene->Insert3DObj(*p3DObj); + bSceneHasObjects = true; } } - if ( bSceneHasObjects ) // is the SdrObject properly converted + if(bSceneHasObjects) // is the SdrObject properly converted { // then we can change the return value pRet = pScene; @@ -505,173 +558,208 @@ SdrObject* EnhancedCustomShape3d::Create // Kameraeinstellungen, Perspektive ... Camera3D& rCamera = (Camera3D&)pScene->GetCamera(); const basegfx::B3DRange& rVolume = pScene->GetBoundVolume(); - sdr::legacy::SetSnapRect(*pScene, aSnapRect ); + sdr::legacy::SetSnapRange(*pScene, aSnapRange); // InitScene replacement - double fW = rVolume.getWidth(); - double fH = rVolume.getHeight(); + const double fW(rVolume.getWidth()); + const double fH(rVolume.getHeight()); - rCamera.SetAutoAdjustProjection( sal_False ); - rCamera.SetViewWindow( -fW / 2, - fH / 2, fW, fH); - basegfx::B3DPoint aLookAt( 0.0, 0.0, 0.0 ); - basegfx::B3DPoint aCamPos( 0.0, 0.0, 100.0 ); - rCamera.SetDefaults( basegfx::B3DPoint( 0.0, 0.0, 100.0 ), aLookAt, 100.0 ); - rCamera.SetPosAndLookAt( aCamPos, aLookAt ); - rCamera.SetFocalLength( 1.0 ); - rCamera.SetProjection( eProjectionType ); - pScene->SetCamera( rCamera ); + rCamera.SetAutoAdjustProjection(false); + rCamera.SetViewWindow(-fW / 2, - fH / 2, fW, fH); + basegfx::B3DPoint aLookAt(0.0, 0.0, 0.0); + basegfx::B3DPoint aCamPos(0.0, 0.0, 100.0); + rCamera.SetDefaults(basegfx::B3DPoint(0.0, 0.0, 100.0), aLookAt, 100.0); + rCamera.SetPosAndLookAt(aCamPos, aLookAt); + rCamera.SetFocalLength(1.0); + rCamera.SetProjection(eProjectionType); + pScene->SetCamera(rCamera); pScene->ActionChanged(); double fOriginX, fOriginY; - GetOrigin( rGeometryItem, fOriginX, fOriginY ); - fOriginX = fOriginX * aSnapRect.GetWidth(); - fOriginY = fOriginY * aSnapRect.GetHeight(); - basegfx::B3DHomMatrix aNewTransform( pScene->GetB3DTransform() ); - aNewTransform.translate( -aCenter.X(), aCenter.Y(), -pScene->GetBoundVolume().getDepth() ); + GetOrigin(rGeometryItem, fOriginX, fOriginY); + fOriginX = fOriginX * aSnapRange.getWidth(); + fOriginY = fOriginY * aSnapRange.getHeight(); + + basegfx::B3DHomMatrix aNewTransform(pScene->GetB3DTransform()); + + aNewTransform.translate(-aSnapRange.getCenterX(), aSnapRange.getCenterY(), -pScene->GetBoundVolume().getDepth()); double fXRotate, fYRotate; - GetRotateAngle( rGeometryItem, fXRotate, fYRotate ); - double fZRotate = ((SdrObjCustomShape*)pCustomShape)->GetObjectRotation() * F_PI180; - if ( fZRotate != 0.0 ) - aNewTransform.rotate( 0.0, 0.0, fZRotate ); - if ( bIsMirroredX ) - aNewTransform.scale( -1.0, 1, 1 ); - if ( bIsMirroredY ) - aNewTransform.scale( 1, -1.0, 1 ); - if( fYRotate != 0.0 ) - aNewTransform.rotate( 0.0, -fYRotate, 0.0 ); - if( fXRotate != 0.0 ) - aNewTransform.rotate( -fXRotate, 0.0, 0.0 ); - if ( eProjectionType == PR_PARALLEL ) + + GetRotateAngle(rGeometryItem, fXRotate, fYRotate); + + const double fZRotate(rCustomShape.GetObjectRotation() * F_PI180); + + if(0.0 != fZRotate) + { + aNewTransform.rotate(0.0, 0.0, fZRotate); + } + + if(bIsMirroredX) + { + aNewTransform.scale(-1.0, 1.0, 1.0); + } + + if(bIsMirroredY) + { + aNewTransform.scale(1.0, -1.0, 1.0); + } + + if(0.0 != fYRotate) + { + aNewTransform.rotate(0.0, -fYRotate, 0.0); + } + + if(0.0 != fXRotate) + { + aNewTransform.rotate(-fXRotate, 0.0, 0.0 ); + } + + if(PR_PARALLEL == eProjectionType) { double fSkew, fAlpha; - GetSkew( rGeometryItem, fSkew, fAlpha ); - if ( fSkew != 0.0 ) + + GetSkew(rGeometryItem, fSkew, fAlpha); + + if(0.0 != fSkew) { - double fInvTanBeta( fSkew / 100.0 ); - if(fInvTanBeta) + const double fInvTanBeta(fSkew / 100.0); + + if(fInvTanBeta) { aNewTransform.shearXY( fInvTanBeta * cos(fAlpha), fInvTanBeta * sin(fAlpha)); } } - basegfx::B3DPoint _aLookAt( 0.0, 0.0, 0.0 ); - basegfx::B3DPoint _aNewCamPos( 0.0, 0.0, 25000.0 ); - rCamera.SetPosAndLookAt( _aNewCamPos, _aLookAt ); - pScene->SetCamera( rCamera ); + + const basegfx::B3DPoint _aLookAt(0.0, 0.0, 0.0); + const basegfx::B3DPoint _aNewCamPos(0.0, 0.0, 25000.0); + + rCamera.SetPosAndLookAt(_aNewCamPos, _aLookAt); + pScene->SetCamera(rCamera); } else { - aNewTransform.translate( -fOriginX, fOriginY, 0.0 ); - // now set correct camera position - const rtl::OUString sViewPoint( RTL_CONSTASCII_USTRINGPARAM ( "ViewPoint" ) ); - drawing::Position3D aViewPointDefault( 3472, -3472, 25000 ); - drawing::Position3D aViewPoint( GetPosition3D( rGeometryItem, sViewPoint, aViewPointDefault, pMap ) ); - double fViewPointX = aViewPoint.PositionX; - double fViewPointY = aViewPoint.PositionY; - double fViewPointZ = aViewPoint.PositionZ; - basegfx::B3DPoint _aLookAt( fViewPointX, -fViewPointY, 0.0 ); - basegfx::B3DPoint aNewCamPos( fViewPointX, -fViewPointY, fViewPointZ ); - rCamera.SetPosAndLookAt( aNewCamPos, _aLookAt ); - pScene->SetCamera( rCamera ); + aNewTransform.translate(-fOriginX, fOriginY, 0.0); + + // now set correct camera position + const rtl::OUString sViewPoint(RTL_CONSTASCII_USTRINGPARAM("ViewPoint")); + const drawing::Position3D aViewPointDefault(3472, -3472, 25000); + const drawing::Position3D aViewPoint(GetPosition3D(rGeometryItem, sViewPoint, aViewPointDefault, fMap)); + const double fViewPointX(aViewPoint.PositionX); + const double fViewPointY(aViewPoint.PositionY); + const double fViewPointZ(aViewPoint.PositionZ); + const basegfx::B3DPoint _aLookAt(fViewPointX, -fViewPointY, 0.0); + const basegfx::B3DPoint aNewCamPos(fViewPointX, -fViewPointY, fViewPointZ); + + rCamera.SetPosAndLookAt(aNewCamPos, _aLookAt); + pScene->SetCamera(rCamera); } - pScene->SetB3DTransform( aNewTransform ); + pScene->SetB3DTransform(aNewTransform); /////////// // light // /////////// - const rtl::OUString sBrightness( RTL_CONSTASCII_USTRINGPARAM ( "Brightness" ) ); - double fAmbientIntensity = GetDouble( rGeometryItem, sBrightness, 22178.0 / 655.36, NULL ) / 100.0; + const rtl::OUString sBrightness(RTL_CONSTASCII_USTRINGPARAM("Brightness")); + const double fAmbientIntensity(GetDouble(rGeometryItem, sBrightness, 22178.0 / 655.36, NULL) / 100.0); + const rtl::OUString sFirstLightDirection(RTL_CONSTASCII_USTRINGPARAM("FirstLightDirection")); + const drawing::Direction3D aFirstLightDirectionDefault(50000, 0, 10000); + drawing::Direction3D aFirstLightDirection(GetDirection3D(rGeometryItem, sFirstLightDirection, aFirstLightDirectionDefault)); - - const rtl::OUString sFirstLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightDirection" ) ); - drawing::Direction3D aFirstLightDirectionDefault( 50000, 0, 10000 ); - drawing::Direction3D aFirstLightDirection( GetDirection3D( rGeometryItem, sFirstLightDirection, aFirstLightDirectionDefault ) ); - if ( aFirstLightDirection.DirectionZ == 0.0 ) + if(0.0 == aFirstLightDirection.DirectionZ) + { aFirstLightDirection.DirectionZ = 1.0; + } - const rtl::OUString sFirstLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightLevel" ) ); - double fLightIntensity = GetDouble( rGeometryItem, sFirstLightLevel, 43712.0 / 655.36, NULL ) / 100.0; - - const rtl::OUString sFirstLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "FirstLightHarsh" ) ); - /* sal_Bool bFirstLightHarsh = */ GetBool( rGeometryItem, sFirstLightHarsh, sal_False ); - - const rtl::OUString sSecondLightDirection( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightDirection" ) ); - drawing::Direction3D aSecondLightDirectionDefault( -50000, 0, 10000 ); - drawing::Direction3D aSecondLightDirection( GetDirection3D( rGeometryItem, sSecondLightDirection, aSecondLightDirectionDefault ) ); - if ( aSecondLightDirection.DirectionZ == 0.0 ) + const rtl::OUString sFirstLightLevel(RTL_CONSTASCII_USTRINGPARAM("FirstLightLevel")); + const double fLightIntensity(GetDouble(rGeometryItem, sFirstLightLevel, 43712.0 / 655.36, NULL) / 100.0); + const rtl::OUString sFirstLightHarsh(RTL_CONSTASCII_USTRINGPARAM("FirstLightHarsh")); + /// const bool bFirstLightHarsh(GetBool(rGeometryItem, sFirstLightHarsh, false)); + const rtl::OUString sSecondLightDirection(RTL_CONSTASCII_USTRINGPARAM("SecondLightDirection")); + const drawing::Direction3D aSecondLightDirectionDefault(-50000, 0, 10000); + drawing::Direction3D aSecondLightDirection(GetDirection3D(rGeometryItem, sSecondLightDirection, aSecondLightDirectionDefault)); + + if(0.0 == aSecondLightDirection.DirectionZ) + { aSecondLightDirection.DirectionZ = -1; + } - const rtl::OUString sSecondLightLevel( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightLevel" ) ); - double fLight2Intensity = GetDouble( rGeometryItem, sSecondLightLevel, 43712.0 / 655.36, NULL ) / 100.0; + const rtl::OUString sSecondLightLevel(RTL_CONSTASCII_USTRINGPARAM("SecondLightLevel")); + const double fLight2Intensity(GetDouble(rGeometryItem, sSecondLightLevel, 43712.0 / 655.36, NULL) / 100.0); + const rtl::OUString sSecondLightHarsh(RTL_CONSTASCII_USTRINGPARAM("SecondLightHarsh")); + const rtl::OUString sLightFace(RTL_CONSTASCII_USTRINGPARAM("LightFace")); + // const bool bLight2Harsh(GetBool(rGeometryItem, sSecondLightHarsh, false)); + // const bool bLightFace(GetBool(rGeometryItem, sLightFace, false)); + const sal_uInt16 nAmbientColor(basegfx::fround(std::min(fAmbientIntensity * 255.0, 255.0))); + const Color aGlobalAmbientColor((sal_uInt8)nAmbientColor, (sal_uInt8)nAmbientColor, (sal_uInt8)nAmbientColor); + + pScene->GetProperties().SetObjectItem(SvxColorItem(aGlobalAmbientColor, SDRATTR_3DSCENE_AMBIENTCOLOR)); + + const sal_uInt8 nSpotLight1((sal_uInt8)(fLightIntensity * 255.0)); + basegfx::B3DVector aSpotLight1(aFirstLightDirection.DirectionX, -aFirstLightDirection.DirectionY, -aFirstLightDirection.DirectionZ); + + aSpotLight1.normalize(); + + pScene->GetProperties().SetObjectItem(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, true)); + + const Color aAmbientSpot1Color(nSpotLight1, nSpotLight1, nSpotLight1); - const rtl::OUString sSecondLightHarsh( RTL_CONSTASCII_USTRINGPARAM ( "SecondLightHarsh" ) ); - const rtl::OUString sLightFace( RTL_CONSTASCII_USTRINGPARAM ( "LightFace" ) ); - /* sal_Bool bLight2Harsh = */ GetBool( rGeometryItem, sSecondLightHarsh, sal_False ); - /* sal_Bool bLightFace = */ GetBool( rGeometryItem, sLightFace, sal_False ); - - sal_uInt16 nAmbientColor = (sal_uInt16)( fAmbientIntensity * 255.0 ); - if ( nAmbientColor > 255 ) - nAmbientColor = 255; - Color aGlobalAmbientColor( (sal_uInt8)nAmbientColor, (sal_uInt8)nAmbientColor, (sal_uInt8)nAmbientColor ); - pScene->GetProperties().SetObjectItem( SvxColorItem(aGlobalAmbientColor, SDRATTR_3DSCENE_AMBIENTCOLOR) ); - - sal_uInt8 nSpotLight1 = (sal_uInt8)( fLightIntensity * 255.0 ); - basegfx::B3DVector aSpotLight1( aFirstLightDirection.DirectionX, - ( aFirstLightDirection.DirectionY ), -( aFirstLightDirection.DirectionZ ) ); - aSpotLight1.normalize(); - pScene->GetProperties().SetObjectItem( SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_1, sal_True ) ); - Color aAmbientSpot1Color( nSpotLight1, nSpotLight1, nSpotLight1 ); - pScene->GetProperties().SetObjectItem( SvxColorItem(aAmbientSpot1Color, SDRATTR_3DSCENE_LIGHTCOLOR_1) ); - pScene->GetProperties().SetObjectItem( SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, aSpotLight1 ) ); + pScene->GetProperties().SetObjectItem(SvxColorItem(aAmbientSpot1Color, SDRATTR_3DSCENE_LIGHTCOLOR_1)); + pScene->GetProperties().SetObjectItem(SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_1, aSpotLight1)); - sal_uInt8 nSpotLight2 = (sal_uInt8)( fLight2Intensity * 255.0 ); - basegfx::B3DVector aSpotLight2( aSecondLightDirection.DirectionX, -aSecondLightDirection.DirectionY, -aSecondLightDirection.DirectionZ ); + const sal_uInt8 nSpotLight2((sal_uInt8)(fLight2Intensity * 255.0)); + basegfx::B3DVector aSpotLight2(aSecondLightDirection.DirectionX, -aSecondLightDirection.DirectionY, -aSecondLightDirection.DirectionZ); aSpotLight2.normalize(); - pScene->GetProperties().SetObjectItem( SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, sal_True ) ); - Color aAmbientSpot2Color( nSpotLight2, nSpotLight2, nSpotLight2 ); - pScene->GetProperties().SetObjectItem( SvxColorItem(aAmbientSpot2Color, SDRATTR_3DSCENE_LIGHTCOLOR_2) ); - pScene->GetProperties().SetObjectItem( SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, aSpotLight2 ) ); - - sal_uInt8 nSpotLight3 = 70; - basegfx::B3DVector aSpotLight3( 0.0, 0.0, 1.0 ); - pScene->GetProperties().SetObjectItem( SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, sal_True ) ); - Color aAmbientSpot3Color( nSpotLight3, nSpotLight3, nSpotLight3 ); - pScene->GetProperties().SetObjectItem( SvxColorItem(aAmbientSpot3Color, SDRATTR_3DSCENE_LIGHTCOLOR_3) ); - pScene->GetProperties().SetObjectItem( SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, aSpotLight3 ) ); - - const rtl::OUString sSpecularity( RTL_CONSTASCII_USTRINGPARAM ( "Specularity" ) ); - const rtl::OUString sDiffusion( RTL_CONSTASCII_USTRINGPARAM ( "Diffusion" ) ); - const rtl::OUString sShininess( RTL_CONSTASCII_USTRINGPARAM ( "Shininess" ) ); - const rtl::OUString sMetal( RTL_CONSTASCII_USTRINGPARAM ( "Metal" ) ); - double fSpecular = GetDouble( rGeometryItem, sSpecularity, 0, NULL ) / 100; - sal_Bool bMetal = GetBool( rGeometryItem, sMetal, sal_False ); - Color aSpecularCol( 225,225,225 ); - if ( bMetal ) + pScene->GetProperties().SetObjectItem(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_2, true)); + + const Color aAmbientSpot2Color(nSpotLight2, nSpotLight2, nSpotLight2); + + pScene->GetProperties().SetObjectItem(SvxColorItem(aAmbientSpot2Color, SDRATTR_3DSCENE_LIGHTCOLOR_2)); + pScene->GetProperties().SetObjectItem(SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_2, aSpotLight2)); + + const sal_uInt8 nSpotLight3(70); + const basegfx::B3DVector aSpotLight3(0.0, 0.0, 1.0); + + pScene->GetProperties().SetObjectItem(SfxBoolItem(SDRATTR_3DSCENE_LIGHTON_3, true)); + + const Color aAmbientSpot3Color(nSpotLight3, nSpotLight3, nSpotLight3); + + pScene->GetProperties().SetObjectItem(SvxColorItem(aAmbientSpot3Color, SDRATTR_3DSCENE_LIGHTCOLOR_3)); + pScene->GetProperties().SetObjectItem(SvxB3DVectorItem(SDRATTR_3DSCENE_LIGHTDIRECTION_3, aSpotLight3)); + + const rtl::OUString sSpecularity(RTL_CONSTASCII_USTRINGPARAM("Specularity")); + const rtl::OUString sDiffusion(RTL_CONSTASCII_USTRINGPARAM("Diffusion")); + const rtl::OUString sShininess(RTL_CONSTASCII_USTRINGPARAM("Shininess")); + const rtl::OUString sMetal(RTL_CONSTASCII_USTRINGPARAM("Metal")); + double fSpecular(GetDouble(rGeometryItem, sSpecularity, 0, NULL) / 100); + const bool bMetal(GetBool(rGeometryItem, sMetal, false)); + Color aSpecularCol(225, 225, 225); + + if(bMetal) { - aSpecularCol = Color( 200, 200, 200 ); + aSpecularCol = Color(200, 200, 200); fSpecular += 0.15; } - sal_Int32 nIntensity = (sal_Int32)fSpecular * 100; - if ( nIntensity > 100 ) - nIntensity = 100; - else if ( nIntensity < 0 ) - nIntensity = 0; - nIntensity = 100 - nIntensity; - pScene->GetProperties().SetObjectItem( SvxColorItem(aSpecularCol, SDRATTR_3DOBJ_MAT_SPECULAR) ); - pScene->GetProperties().SetObjectItem( SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, (sal_uInt16)nIntensity ) ); - sdr::legacy::SetLogicRect(*pScene, CalculateNewSnapRect( pCustomShape, aSnapRect, aBoundRect2d, pMap ) ); + const sal_Int32 nIntensity(basegfx::fround(100.0 - std::min(std::max(0.0, fSpecular * 100.0), 100.0))); + + pScene->GetProperties().SetObjectItem(SvxColorItem(aSpecularCol, SDRATTR_3DOBJ_MAT_SPECULAR)); + pScene->GetProperties().SetObjectItem(SfxUInt16Item(SDRATTR_3DOBJ_MAT_SPECULAR_INTENSITY, (sal_uInt16)nIntensity)); + + // set 2D transformation for scene + sdr::legacy::SetLogicRange(*pScene, CalculateNewSnapRect(rCustomShape, aSnapRange, aAllPolyPolygonRange, fMap)); // removing placeholder objects - std::vector< E3dCompoundObject* >::iterator aObjectListIter( aPlaceholderObjectList.begin() ); - while ( aObjectListIter != aPlaceholderObjectList.end() ) + std::vector< E3dCompoundObject* >::iterator aObjectListIter(aPlaceholderObjectList.begin()); + + while( aObjectListIter != aPlaceholderObjectList.end()) { - pScene->Remove3DObj( **aObjectListIter ); + pScene->Remove3DObj(**aObjectListIter); deleteSdrObjectSafeAndClearPointer(*aObjectListIter++); } } @@ -680,70 +768,87 @@ SdrObject* EnhancedCustomShape3d::Create deleteSdrObjectSafeAndClearPointer(pScene); } } - return pRet; + + return pRet; } -Rectangle EnhancedCustomShape3d::CalculateNewSnapRect( const SdrObject* pCustomShape, const Rectangle& rSnapRect, const Rectangle& rBoundRect, const double* pMap ) +basegfx::B2DRange EnhancedCustomShape3d::CalculateNewSnapRect( + const SdrObjCustomShape& rCustomShape, + const basegfx::B2DRange& rSnapRect, + const basegfx::B2DRange& rBoundRect, + const double fMap) { - SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ); - const Point aCenter( rSnapRect.Center() ); - double fExtrusionBackward, fExtrusionForward; - GetExtrusionDepth( rGeometryItem, pMap, fExtrusionBackward, fExtrusionForward ); + SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)rCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY); + double fExtrusionBackward(0.0), fExtrusionForward(0.0); sal_uInt32 i; + + GetExtrusionDepth(rGeometryItem, fMap, fExtrusionBackward, fExtrusionForward); - // creating initial bound volume ( without rotation. skewing.and camera ) - basegfx::B3DPolygon aBoundVolume; - const Polygon aPolygon( rBoundRect ); - - for ( i = 0L; i < 4L; i++ ) - { - aBoundVolume.append(basegfx::B3DPoint(aPolygon[ (sal_uInt16)i ].X() - aCenter.X(), aPolygon[ (sal_uInt16)i ].Y() - aCenter.Y(), fExtrusionForward)); - } - - for ( i = 0L; i < 4L; i++ ) - { - aBoundVolume.append(basegfx::B3DPoint(aPolygon[ (sal_uInt16)i ].X() - aCenter.X(), aPolygon[ (sal_uInt16)i ].Y() - aCenter.Y(), fExtrusionBackward)); - } - - const rtl::OUString sRotationCenter( RTL_CONSTASCII_USTRINGPARAM ( "RotationCenter" ) ); - drawing::Direction3D aRotationCenterDefault( 0, 0, 0 ); // default seems to be wrong, a fractional size of shape has to be used!! - drawing::Direction3D aRotationCenter( GetDirection3D( rGeometryItem, sRotationCenter, aRotationCenterDefault ) ); - - // double XCenterInGUnits = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationCenterX, 0 ); - // double YCenterInGUnits = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationCenterY, 0 ); - - // sal_Int32 nRotationXAxisInProz = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationAxisX, 100 ); - // sal_Int32 nRotationYAxisInProz = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationAxisY, 0 ); - // sal_Int32 nRotationZAxisInProz = rPropSet.GetPropertyValue( DFF_Prop_c3DRotationAxisZ, 0 ); - + // creating initial bound volume (without rotation, skewing and camera) + basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rBoundRect)); + basegfx::B3DPolygon aBoundVolume; + + aPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(-rSnapRect.getCenterX(), -rSnapRect.getCenterY())); + aBoundVolume.append(basegfx::tools::createB3DPolygonFromB2DPolygon(aPolygon, fExtrusionForward)); + aBoundVolume.append(basegfx::tools::createB3DPolygonFromB2DPolygon(aPolygon, fExtrusionBackward)); + + const rtl::OUString sRotationCenter(RTL_CONSTASCII_USTRINGPARAM("RotationCenter")); + const drawing::Direction3D aRotationCenterDefault(0.0, 0.0, 0.0); // default seems to be wrong, a fractional size of shape has to be used!! + const drawing::Direction3D aRotationCenter(GetDirection3D(rGeometryItem, sRotationCenter, aRotationCenterDefault)); + double fXRotate(0.0), fYRotate(0.0); + + GetRotateAngle(rGeometryItem, fXRotate, fYRotate); - double fXRotate, fYRotate; - GetRotateAngle( rGeometryItem, fXRotate, fYRotate ); - double fZRotate = - ((SdrObjCustomShape*)pCustomShape)->GetObjectRotation() * F_PI180; + double fZRotate(-rCustomShape.GetObjectRotation() * F_PI180); // rotating bound volume basegfx::B3DHomMatrix aMatrix; - aMatrix.translate(-aRotationCenter.DirectionX, -aRotationCenter.DirectionY, -aRotationCenter.DirectionZ); - if ( fZRotate != 0.0 ) - aMatrix.rotate( 0.0, 0.0, fZRotate ); - if ( ((SdrObjCustomShape*)pCustomShape)->IsMirroredX() ) - aMatrix.scale( -1.0, 1, 1 ); - if ( ((SdrObjCustomShape*)pCustomShape)->IsMirroredY() ) - aMatrix.scale( 1, -1.0, 1 ); - if( fYRotate != 0.0 ) - aMatrix.rotate( 0.0, fYRotate, 0.0 ); - if( fXRotate != 0.0 ) - aMatrix.rotate( -fXRotate, 0.0, 0.0 ); + + aMatrix.translate(-aRotationCenter.DirectionX, -aRotationCenter.DirectionY, -aRotationCenter.DirectionZ); + + if(0.0 != fZRotate) + { + aMatrix.rotate(0.0, 0.0, fZRotate); + } + + if(rCustomShape.IsMirroredX()) + { + aMatrix.scale(-1.0, 1.0, 1.0); + } + + if(rCustomShape.IsMirroredY()) + { + aMatrix.scale(1.0, -1.0, 1.0); + } + + if(0.0 != fYRotate) + { + aMatrix.rotate(0.0, fYRotate, 0.0); + } + + if(0.0 != fXRotate) + { + aMatrix.rotate(-fXRotate, 0.0, 0.0); + } + aMatrix.translate(aRotationCenter.DirectionX, aRotationCenter.DirectionY, aRotationCenter.DirectionZ); aBoundVolume.transform(aMatrix); - Transformation2D aTransformation2D( pCustomShape, rSnapRect, pMap ); - if ( aTransformation2D.IsParallel() ) - aBoundVolume = aTransformation2D.ApplySkewSettings( aBoundVolume ); - - Polygon aTransformed( 8 ); - for ( i = 0L; i < 8L; i++ ) - aTransformed[ (sal_uInt16)i ] = aTransformation2D.Transform2D( aBoundVolume.getB3DPoint( i ) ); + Transformation2D aTransformation2D(rCustomShape, fMap); + + if(aTransformation2D.IsParallel()) + { + aBoundVolume = aTransformation2D.ApplySkewSettings(aBoundVolume); + } + + basegfx::B2DRange aRetval; + + for(i = 0; i < aBoundVolume.count(); i++) + { + aRetval.expand(aTransformation2D.Transform2D(aBoundVolume.getB3DPoint(i))); + } - return aTransformed.GetBoundRect(); + return aRetval; } + +// eof Modified: incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.hxx?rev=1351396&r1=1351395&r2=1351396&view=diff ============================================================================== --- incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.hxx (original) +++ incubator/ooo/branches/alg/aw080/main/svx/source/customshapes/EnhancedCustomShape3d.hxx Mon Jun 18 16:00:11 2012 @@ -19,8 +19,6 @@ * *************************************************************/ - - #ifndef _ENHANCEDCUSTOMSHAPE3D_HXX #define _ENHANCEDCUSTOMSHAPE3D_HXX @@ -28,46 +26,54 @@ #include #include #include - -#include +#include +#include class SdrObject; +class SdrObjCustomShape; class EnhancedCustomShape3d { +private: class Transformation2D { - Point aCenter; - com::sun::star::drawing::ProjectionMode eProjectionMode; + private: + basegfx::B2DPoint maCenter; + com::sun::star::drawing::ProjectionMode meProjectionMode; // parallel projection - double fSkewAngle; - double fSkew; // in percent + double mfSkewAngle; + double mfSkew; // in percent // perspective projection - double fZScreen; - basegfx::B3DPoint fViewPoint; - double fOriginX; - double fOriginY; - - const double* pMap; + double mfZScreen; + basegfx::B3DPoint mfViewPoint; + double mfOriginX; + double mfOriginY; - public : + const double mfMap; - Transformation2D( const SdrObject* pCustomShape, const Rectangle& rBoundRect, const double* pMap ); + public : + Transformation2D(const SdrObjCustomShape& rCustomShape, const double fMap); - basegfx::B3DPolygon ApplySkewSettings( const basegfx::B3DPolygon& rPolygon3D ) const; - Point Transform2D( const basegfx::B3DPoint& rPoint ) const; - sal_Bool IsParallel() const; + basegfx::B3DPolygon ApplySkewSettings(const basegfx::B3DPolygon& rPolygon3D) const; + basegfx::B2DPoint Transform2D(const basegfx::B3DPoint& rPoint) const; + bool IsParallel() const; }; friend class Transformation2D; - protected : - static Rectangle CalculateNewSnapRect( const SdrObject* pCustomShape, const Rectangle& rSnapRect, const Rectangle& rBoundRect, const double* pMap ); - - public : - static SdrObject* Create3DObject( const SdrObject* pShape2d, const SdrObject* pCustomShape ); +protected : + static basegfx::B2DRange CalculateNewSnapRect( + const SdrObjCustomShape& rCustomShape, + const basegfx::B2DRange& rSnapRect, + const basegfx::B2DRange& rBoundRect, + const double fMap); + +public : + static SdrObject* Create3DObject( + const SdrObject& rShape2d, + const SdrObjCustomShape& rCustomShape); }; #endif