Files
libreoffice/svx/source/customshapes/EnhancedCustomShapeEngine.cxx

473 lines
18 KiB
C++
Raw Normal View History

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: EnhancedCustomShapeEngine.cxx,v $
* $Revision: 1.21 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svx.hxx"
#include "EnhancedCustomShapeEngine.hxx"
#include "EnhancedCustomShape2d.hxx"
#include "EnhancedCustomShape3d.hxx"
#include "EnhancedCustomShapeFontWork.hxx"
#include "EnhancedCustomShapeHandle.hxx"
#include "EnhancedCustomShapeGeometry.hxx"
#include <svx/unoshape.hxx>
#ifndef _SVX_UNOPAGE_HXX
#include "svx/unopage.hxx"
#endif
#include "unoapi.hxx"
#include <svx/svdobj.hxx>
#include <svx/svdoashp.hxx>
#include <svx/svdogrp.hxx>
#include <svx/svdorect.hxx>
#include <svx/outlobj.hxx>
#include <svx/outliner.hxx>
#include <svx/svdoutl.hxx>
#include <svtools/itemset.hxx>
#include <svx/svdopath.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdmodel.hxx>
#include "svditer.hxx"
#include "unopolyhelper.hxx"
#include <uno/mapping.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
// ---------------------------
// - EnhancedCustomShapeEngine -
// ---------------------------
rtl::OUString EnhancedCustomShapeEngine_getImplementationName()
throw( NMSP_UNO::RuntimeException )
{
return B2UCONST( "com.sun.star.drawing.EnhancedCustomShapeEngine" );
}
sal_Bool SAL_CALL EnhancedCustomShapeEngine_supportsService( const rtl::OUString& ServiceName )
throw( NMSP_UNO::RuntimeException )
{
return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.CustomShapeEngine" ) );
}
SEQ( rtl::OUString ) SAL_CALL EnhancedCustomShapeEngine_getSupportedServiceNames()
throw( NMSP_UNO::RuntimeException )
{
SEQ( rtl::OUString ) aRet(1);
rtl::OUString* pArray = aRet.getArray();
pArray[0] = B2UCONST( "com.sun.star.drawing.CustomShapeEngine" );
return aRet;
}
// -----------------------------------------------------------------------------
EnhancedCustomShapeEngine::EnhancedCustomShapeEngine( const REF( NMSP_LANG::XMultiServiceFactory )& rxMgr ) :
mxFact ( rxMgr ),
mbForceGroupWithText ( sal_False )
{
}
EnhancedCustomShapeEngine::~EnhancedCustomShapeEngine()
{
}
// XInterface -----------------------------------------------------------------
void SAL_CALL EnhancedCustomShapeEngine::acquire() throw()
{
OWeakObject::acquire();
}
void SAL_CALL EnhancedCustomShapeEngine::release() throw()
{
OWeakObject::release();
}
// XInitialization ------------------------------------------------------------
void SAL_CALL EnhancedCustomShapeEngine::initialize( const SEQ( NMSP_UNO::Any )& aArguments )
throw ( NMSP_UNO::Exception, NMSP_UNO::RuntimeException )
{
sal_Int32 i;
SEQ( NMSP_BEANS::PropertyValue ) aParameter;
for ( i = 0; i < aArguments.getLength(); i++ )
{
if ( aArguments[ i ] >>= aParameter )
break;
}
for ( i = 0; i < aParameter.getLength(); i++ )
{
const NMSP_BEANS::PropertyValue& rProp = aParameter[ i ];
if ( rProp.Name.equalsAscii( "CustomShape" ) )
rProp.Value >>= mxShape;
else if ( rProp.Name.equalsAscii( "ForceGroupWithText" ) )
rProp.Value >>= mbForceGroupWithText;
}
}
// XServiceInfo ---------------------------------------------------------------
rtl::OUString SAL_CALL EnhancedCustomShapeEngine::getImplementationName()
throw( NMSP_UNO::RuntimeException )
{
return EnhancedCustomShapeEngine_getImplementationName();
}
sal_Bool SAL_CALL EnhancedCustomShapeEngine::supportsService( const rtl::OUString& rServiceName )
throw( NMSP_UNO::RuntimeException )
{
return EnhancedCustomShapeEngine_supportsService( rServiceName );
}
SEQ( rtl::OUString ) SAL_CALL EnhancedCustomShapeEngine::getSupportedServiceNames()
throw ( NMSP_UNO::RuntimeException )
{
return EnhancedCustomShapeEngine_getSupportedServiceNames();
}
// XCustomShapeEngine -----------------------------------------------------------
SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText( const SdrObjCustomShape* pCustoObj, SdrObject* pRenderedShape )
{
bool bHasText = pCustoObj->HasText();
if ( pRenderedShape || bHasText )
{
// applying shadow
const SdrObject* pShadowGeometry = pCustoObj->GetSdrObjectShadowFromCustomShape();
if ( pShadowGeometry )
{
if ( pRenderedShape )
{
if ( !pRenderedShape->ISA( SdrObjGroup ) )
{
SdrObject* pTmp = pRenderedShape;
pRenderedShape = new SdrObjGroup();
((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
}
((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pShadowGeometry->Clone(), 0 );
}
else
pRenderedShape = pShadowGeometry->Clone();
}
// apply text
if ( bHasText )
{
// #i37011# also create a text object and add at rPos + 1
SdrTextObj* pTextObj = (SdrTextObj*)SdrObjFactory::MakeNewObject(
pCustoObj->GetObjInventor(), OBJ_TEXT, 0L, pCustoObj->GetModel());
// Copy text content
OutlinerParaObject* pParaObj = pCustoObj->GetOutlinerParaObject();
if( pParaObj )
CWS-TOOLING: integrate CWS aw063 2009-02-12 13:10:24 +0100 aw r267649 : #i99123# when a primitive is invisible, it is not sufficient to produce no output when decomposing, but to add invisible data using HitTestPrimitive2D. This is needed for the slideshow which relies on geometry data in MetaFiles when painting invisible objects 2009-02-12 13:08:39 +0100 aw r267648 : #i99123# do not ignore HitTestPrimitive2D, but draw empty rectangles instead. This is needed since Slideshow is based on getting MetaFile content when painting invisible objects 2009-02-11 16:04:28 +0100 aw r267620 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:04:10 +0100 aw r267619 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:56 +0100 aw r267618 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:39 +0100 aw r267617 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:03:21 +0100 aw r267615 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:48 +0100 aw r267614 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:24 +0100 aw r267613 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:02:01 +0100 aw r267612 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:01:32 +0100 aw r267611 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:01:05 +0100 aw r267610 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 16:00:15 +0100 aw r267608 : #i98788# made SfxItemPool destructor protected, added static ::Free method 2009-02-11 11:27:33 +0100 aw r267585 : #i98788# added missing include for STL 2009-02-10 17:46:50 +0100 aw r267570 : #i98788# added reaction on pool destruction 2009-02-10 17:11:58 +0100 aw r267562 : #i98788# added messaging mechanism to register for pool destruction 2009-02-10 13:35:35 +0100 aw r267549 : #i98788# removing changes, too complicated and risky for 3.1 2009-02-10 12:13:48 +0100 aw r267546 : #i98788# 4th round 2009-02-10 12:13:37 +0100 aw r267545 : #i98788# 4th round 2009-02-10 12:13:26 +0100 aw r267544 : #i98788# 4th round 2009-02-10 12:13:14 +0100 aw r267543 : #i98788# 4th round 2009-02-10 12:13:03 +0100 aw r267542 : #i98788# 4th round 2009-02-10 12:12:50 +0100 aw r267541 : #i98788# 4th round 2009-02-10 12:12:37 +0100 aw r267540 : #i98788# 4th round 2009-02-08 14:38:22 +0100 aw r267495 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:38:06 +0100 aw r267494 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:37:48 +0100 aw r267493 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:37:17 +0100 aw r267492 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:56 +0100 aw r267491 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:44 +0100 aw r267490 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:29 +0100 aw r267489 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:16 +0100 aw r267488 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:36:02 +0100 aw r267487 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-08 14:35:46 +0100 aw r267486 : #i98788# 3rd round of changes to SfxItemPool handling 2009-02-05 12:20:39 +0100 aw r267415 : #i98788# 2nd batch of adaptions for SfxItemPoolHolder addition 2009-02-04 15:12:54 +0100 aw r267385 : #i98788# added newline at EOF 2009-02-04 13:26:04 +0100 aw r267379 : #i98788# make SfxItemPool holdable 2009-02-04 13:25:40 +0100 aw r267378 : #i98788# make SfxItemPool holdable 2009-02-04 13:25:08 +0100 aw r267377 : #i98788# make SfxItemPool holdable 2009-02-04 13:24:42 +0100 aw r267376 : #i98788# make SfxItemPool holdable 2009-02-04 13:23:14 +0100 aw r267375 : #i98788# make SfxItemPool holdable 2009-02-04 13:23:02 +0100 aw r267374 : #i98788# make SfxItemPool holdable 2009-01-29 17:08:31 +0100 aw r267159 : #i97628# completed the fix 2009-01-29 17:08:15 +0100 aw r267158 : #i97628# completed the fix 2009-01-29 14:09:07 +0100 aw r267132 : #i97628# Corrected usage of ParagraphData in headers 2009-01-29 14:06:58 +0100 iha r267131 : #i98344# incorrect font size in charts 2009-01-29 12:13:46 +0100 aw r267115 : #i97628# back to old state; triggers too many errors in other modules 2009-01-29 12:03:51 +0100 aw r267114 : #i97628# enabled exceptions due to STL vector include 2009-01-29 11:21:37 +0100 aw r267107 : #i97628# added needed include 2009-01-28 17:58:29 +0100 aw r267077 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:58:12 +0100 aw r267076 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:57:51 +0100 aw r267074 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-28 17:57:21 +0100 aw r267073 : #i97628# first version of newly implemented OutlinerParaObject and adaptions 2009-01-27 17:07:33 +0100 aw r267011 : #i98402# added support for ViewRange when exporting MetaFiles in ObjectContactOfPageView::DoProcessDisplay to avoid to paint too much 2009-01-27 11:45:48 +0100 aw r266973 : #i98404# Added a warning to a place where a conversion to rectangle should not be copied from 2009-01-26 21:44:36 +0100 iha r266949 : #i98497# 3D charts are rendered with wrong size 2009-01-26 20:47:07 +0100 aw r266947 : #i98404# handle BackgroundColorPrimitive2D directly in PixelRenderers and avoid AA under all circumstances 2009-01-26 14:50:36 +0100 aw r266926 : #i98386# secured cloning of SdrObject in IMapUserData by boost::shared_prt usage 2009-01-26 12:51:30 +0100 aw r266916 : #i96581# added separated FontStretching and fallback for small X!=Y scale differences 2009-01-23 16:14:55 +0100 aw r266834 : #i96475# added missing implementation of TextDecoratedPortionPrimitive2D::getB2DRange 2009-01-23 15:24:34 +0100 aw r266826 : #i98405# fixed fallback to DrawAlphaRect to use the correctly sized rectangle 2009-01-23 13:34:43 +0100 aw r266813 : #i96474# fixed impSplitSingleWords for an unexpected case 2009-01-23 10:47:31 +0100 aw r266786 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:47:20 +0100 aw r266785 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:47:09 +0100 aw r266783 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:46:58 +0100 aw r266782 : #i98289#,#i96474# tooling and new flags for tasks 2009-01-23 10:46:48 +0100 aw r266781 : #i98289#,#i96474# tooling and new flags for tasks
2009-03-04 14:16:02 +00:00
pTextObj->NbcSetOutlinerParaObject( new OutlinerParaObject(*pParaObj) );
// copy all attributes
SfxItemSet aTargetItemSet( pCustoObj->GetMergedItemSet() );
// clear fill and line style
aTargetItemSet.Put(XLineStyleItem(XLINE_NONE));
aTargetItemSet.Put(XFillStyleItem(XFILL_NONE));
// get the text bounds and set at text object
Rectangle aTextBounds = pCustoObj->GetSnapRect();
CWS-TOOLING: integrate CWS impress168 2009-04-24 11:26:33 +0200 wg r271204 : i101157 2009-04-24 10:17:59 +0200 wg r271200 : i101157 2009-04-23 15:50:12 +0200 wg r271178 : i101157 2009-04-23 15:16:58 +0200 wg r271176 : i101157 2009-04-23 13:04:41 +0200 wg r271158 : i101157 2009-04-22 15:39:32 +0200 wg r271123 : i101157 2009-04-22 14:27:24 +0200 wg r271111 : i101157 2009-04-22 14:14:02 +0200 wg r271109 : i101157 2009-04-17 14:34:19 +0200 wg r270946 : i101157 2009-04-17 13:49:15 +0200 wg r270939 : i101157 2009-03-31 14:54:52 +0200 sj r270281 : CWS-TOOLING: rebase CWS impress168 to trunk@270033 (milestone: DEV300:m45) 2009-03-26 16:56:44 +0100 sj r270089 : removed invalid file names 2009-03-24 14:02:54 +0100 sj r269944 : CWS-TOOLING: rebase CWS impress168 to trunk@269781 (milestone: DEV300:m44) 2009-03-06 16:32:14 +0100 sj r269020 : #i99970# importing customshapes without group object, taking care of the correct text alignment 2009-02-27 13:53:24 +0100 sj r268591 : #158501,158483# fixed positioning problem of 3d customshapes 2009-02-19 16:02:00 +0100 sj r268292 : #76543# fixed interactive hyperlink program action with relativ url 2009-02-18 15:36:52 +0100 sj r268233 : #158503# added import of circular gradients for ellipse shapes 2009-02-16 19:51:54 +0100 sj r267836 : #i99146# calculating correct text bounds 2009-02-12 13:59:46 +0100 sj r267654 : #i96179# fixed bullet problem 2009-02-10 17:26:41 +0100 sj r267566 : #158476# fixed import of the ribbon shape 2009-02-10 17:10:27 +0100 cl r267561 : #i95364# fixed type detection of linked images 2009-02-09 18:31:59 +0100 cl r267531 : #i98352# removed assertion 2009-02-09 18:31:17 +0100 cl r267530 : #i98355# fixed alien attribute import for sd in binfilter 2009-02-09 18:30:53 +0100 cl r267529 : #i98355# fixed alien attribute import for sd in binfilter 2009-02-09 09:52:15 +0100 cl r267501 : #i98573# fixed build error 2009-02-06 17:02:21 +0100 sj r267476 : #i96179# fixed bullet problem 2009-02-06 14:58:39 +0100 cl r267466 : #i14832# fixed page count field for handout printing 2009-02-06 10:23:01 +0100 cl r267447 : #i98573# fixed GetEditOutlinerParaObject() memory leak 2009-02-05 18:03:34 +0100 cl r267435 : #i98573# fixed GetEditOutlinerParaObject() memory leak 2009-02-05 18:03:08 +0100 cl r267434 : #i85481# added XMultiPropertyStates to text implementations 2009-02-05 18:02:54 +0100 cl r267433 : #i85481# added XMultiPropertyStates to text implementations 2009-02-05 18:02:42 +0100 cl r267432 : #i85481# added XMultiPropertyStates to text implementations 2009-02-04 18:54:46 +0100 sj r267400 : #i33630# fixed arrow size of word import 2009-02-04 15:40:16 +0100 cl r267389 : #i58702# fixed tiled bitmap fill for vcl canvas 2009-02-04 15:39:07 +0100 cl r267388 : #i58702# fixed tiled bitmap fill for vcl canvas 2009-02-04 14:23:27 +0100 cl r267382 : #i98573# fixed memory leaks caused by wron usage of GetEditOutlinerParaObject() 2009-02-04 14:22:34 +0100 cl r267381 : #i98573# fixed memory leaks caused by wron usage of GetEditOutlinerParaObject() 2009-02-04 12:51:50 +0100 cl r267371 : #i14832# added Page Count field to impress 2009-02-04 12:41:31 +0100 cl r267368 : #i14832# added Page Count field to impress
2009-05-06 21:51:02 +00:00
SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
if ( pSdrObjCustomShape )
{
EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
aTextBounds = aCustomShape2d.GetTextRect();
}
pTextObj->SetSnapRect( aTextBounds );
// if rotated, copy GeoStat, too.
const GeoStat& rSourceGeo = pCustoObj->GetGeoStat();
if ( rSourceGeo.nDrehWink )
{
pTextObj->NbcRotate(
pCustoObj->GetSnapRect().Center(), rSourceGeo.nDrehWink,
rSourceGeo.nSin, rSourceGeo.nCos);
}
// set modified ItemSet at text object
pTextObj->SetMergedItemSet(aTargetItemSet);
if ( pRenderedShape )
{
if ( !pRenderedShape->ISA( SdrObjGroup ) )
{
SdrObject* pTmp = pRenderedShape;
pRenderedShape = new SdrObjGroup();
((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
}
((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTextObj, LIST_APPEND );
}
else
pRenderedShape = pTextObj;
}
// force group
if ( pRenderedShape )
{
if ( !pRenderedShape->ISA( SdrObjGroup ) )
{
SdrObject* pTmp = pRenderedShape;
pRenderedShape = new SdrObjGroup();
((SdrObjGroup*)pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
}
pRenderedShape->SetPage( pCustoObj->GetPage() );
pRenderedShape->SetModel( pCustoObj->GetModel() );
}
}
return pRenderedShape;
}
void SetTemporary( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape )
{
if ( xShape.is() )
{
SvxShape* pShape = SvxShape::getImplementation( xShape );
if ( pShape )
pShape->TakeSdrObjectOwnership();
/*
::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes > xShapes( xShape, ::com::sun::star::uno::UNO_QUERY );
if ( xShapes.is() )
{
sal_Int32 i;
for ( i = 0; i < xShapes->getCount(); i++ )
{
::com::sun::star::uno::Any aAny( xShapes->getByIndex( i ) );
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape;
if ( aAny >>= xShape )
SetTemporary( xShape );
}
}
*/
}
}
REF( com::sun::star::drawing::XShape ) SAL_CALL EnhancedCustomShapeEngine::render()
throw ( NMSP_UNO::RuntimeException )
{
REF( com::sun::star::drawing::XShape ) xShape;
SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
if ( pSdrObjCustomShape )
{
// retrieving the TextPath property to check if feature is enabled
SdrCustomShapeGeometryItem& rGeometryItem = (SdrCustomShapeGeometryItem&)
pSdrObjCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
sal_Bool bTextPathOn = sal_False;
const rtl::OUString sTextPath( RTL_CONSTASCII_USTRINGPARAM ( "TextPath" ) );
com::sun::star::uno::Any* pAny = rGeometryItem.GetPropertyValueByName( sTextPath, sTextPath );
if ( pAny )
*pAny >>= bTextPathOn;
EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
sal_Bool bFlipV = aCustomShape2d.IsFlipVert();
sal_Bool bFlipH = aCustomShape2d.IsFlipHorz();
sal_Bool bLineGeometryNeededOnly = bTextPathOn;
SdrObject* pRenderedShape = aCustomShape2d.CreateObject( bLineGeometryNeededOnly );
if ( pRenderedShape )
{
if ( bTextPathOn )
{
SdrObject* pRenderedFontWork = EnhancedCustomShapeFontWork::CreateFontWork( pRenderedShape, pSdrObjCustomShape );
if ( pRenderedFontWork )
{
SdrObject::Free( pRenderedShape );
pRenderedShape = pRenderedFontWork;
}
}
SdrObject* pRenderedShape3d = EnhancedCustomShape3d::Create3DObject( pRenderedShape, pSdrObjCustomShape );
if ( pRenderedShape3d )
{
bFlipV = bFlipH = sal_False;
nRotateAngle = 0;
SdrObject::Free( pRenderedShape );
pRenderedShape = pRenderedShape3d;
}
Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
const GeoStat& rGeoStat = ((SdrObjCustomShape*)pSdrObjCustomShape)->GetGeoStat();
if ( rGeoStat.nShearWink )
{
long nShearWink = rGeoStat.nShearWink;
double nTan = rGeoStat.nTan;
if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
{
nShearWink = -nShearWink;
nTan = -nTan;
}
pRenderedShape->Shear( pSdrObjCustomShape->GetSnapRect().Center(), nShearWink, nTan, FALSE);
}
if( nRotateAngle )
{
double a = nRotateAngle * F_PI18000;
pRenderedShape->NbcRotate( pSdrObjCustomShape->GetSnapRect().Center(), nRotateAngle, sin( a ), cos( a ) );
}
if ( bFlipV )
{
Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
Point aRight( aLeft.X() + 1000, aLeft.Y() );
pRenderedShape->NbcMirror( aLeft, aRight );
}
if ( bFlipH )
{
Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
Point aBottom( aTop.X(), aTop.Y() + 1000 );
pRenderedShape->NbcMirror( aTop, aBottom );
}
pRenderedShape->NbcSetStyleSheet( pSdrObjCustomShape->GetStyleSheet(), sal_True );
pRenderedShape->RecalcSnapRect();
}
if ( mbForceGroupWithText )
pRenderedShape = ImplForceGroupWithText( (SdrObjCustomShape*)pSdrObjCustomShape, pRenderedShape );
if ( pRenderedShape )
{
aCustomShape2d.ApplyGluePoints( pRenderedShape );
xShape = SvxDrawPage::CreateShapeByTypeAndInventor( pRenderedShape->GetObjIdentifier(),
pRenderedShape->GetObjInventor(), pRenderedShape, NULL );
}
SetTemporary( xShape );
}
return xShape;
}
com::sun::star::awt::Rectangle SAL_CALL EnhancedCustomShapeEngine::getTextBounds()
throw ( NMSP_UNO::RuntimeException )
{
com::sun::star::awt::Rectangle aTextRect;
SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
if ( pSdrObjCustomShape && pSdrObjCustomShape->GetModel() && !pSdrObjCustomShape->GetModel()->isLocked() )
{
if ( pSdrObjCustomShape )
{
EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
Rectangle aRect( aCustomShape2d.GetTextRect() );
aTextRect.X = aRect.Left();
aTextRect.Y = aRect.Top();
aTextRect.Width = aRect.GetWidth();
aTextRect.Height = aRect.GetHeight();
}
}
return aTextRect;
}
com::sun::star::drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeometry()
throw ( NMSP_UNO::RuntimeException )
{
com::sun::star::drawing::PolyPolygonBezierCoords aPolyPolygonBezierCoords;
SdrObject* pSdrObjCustomShape( GetSdrObjectFromXShape( mxShape ) );
if ( pSdrObjCustomShape )
{
EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
SdrObject* pObj = aCustomShape2d.CreateLineGeometry();
if ( pObj )
{
Rectangle aRect( pSdrObjCustomShape->GetSnapRect() );
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
sal_Bool bFlipV = aCustomShape2d.IsFlipVert();
sal_Bool bFlipH = aCustomShape2d.IsFlipHorz();
const GeoStat& rGeoStat = ((SdrObjCustomShape*)pSdrObjCustomShape)->GetGeoStat();
if ( rGeoStat.nShearWink )
{
long nShearWink = rGeoStat.nShearWink;
double nTan = rGeoStat.nTan;
if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV))
{
nShearWink = -nShearWink;
nTan = -nTan;
}
pObj->Shear( aRect.Center(), nShearWink, nTan, FALSE);
}
sal_Int32 nRotateAngle = aCustomShape2d.GetRotateAngle();
if( nRotateAngle )
{
double a = nRotateAngle * F_PI18000;
pObj->NbcRotate( aRect.Center(), nRotateAngle, sin( a ), cos( a ) );
}
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
if ( bFlipH )
{
Point aTop( ( aRect.Left() + aRect.Right() ) >> 1, aRect.Top() );
Point aBottom( aTop.X(), aTop.Y() + 1000 );
pObj->NbcMirror( aTop, aBottom );
}
CWS-TOOLING: integrate CWS impress171 2009-06-02 16:32:02 +0200 cl r272511 : fixed build error 2009-05-29 16:40:09 +0200 cl r272471 : CWS-TOOLING: rebase CWS impress171 to trunk@272291 (milestone: DEV300:m49) 2009-05-19 15:14:08 +0200 sj r272082 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:31 +0200 sj r272081 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-19 15:09:14 +0200 sj r272080 : #i101459# applied patch (writing out StyleTextProperties even if no chars given) 2009-05-18 13:34:05 +0200 sj r272015 : #i47689# fixed rectangles toolbar 2009-05-13 14:59:08 +0200 sj r271862 : #i101563# fixed crash when loading pptx document 2009-05-12 19:31:58 +0200 sj r271835 : #101684# fixed rotation of customshapes 2009-05-08 16:37:01 +0200 sj r271724 : #i101683,i101584,i48160# added shearing of customshapes, fixed rotation problem 2009-04-28 17:32:14 +0200 sj r271335 : #i48160# fixed gluepoint rotation of customshapes 2009-04-27 16:31:54 +0200 cl r271291 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:30:52 +0200 cl r271290 : #i100138# applied patch for japanese reconversion feature 2009-04-27 16:28:55 +0200 cl r271289 : #i100138# applied patch for japanese reconversion feature 2009-04-23 14:22:59 +0200 cl r271170 : #i95342# #i96820# #i97298# multiple table handling fixes 2009-04-23 14:18:54 +0200 sj r271169 : #i60368# ignoring gamma values for toolbar/menu icons 2009-04-23 11:54:28 +0200 cl r271146 : #i97298# set style to text even during text edit 2009-04-23 11:46:38 +0200 cl r271145 : fixed compiler error with debug 2009-04-22 19:09:37 +0200 sj r271135 : #i101051# applied patch (proper import of notes page object) 2009-04-22 11:07:54 +0200 cl r271082 : #i96820# modify doc after merging cells 2009-04-22 10:57:35 +0200 cl r271081 : #i100307# applied patch from jlcheng to correctly set modfiy state 2009-04-22 10:31:11 +0200 cl r271079 : #i96736# copy merge information on clone 2009-04-21 08:27:22 +0200 cl r271016 : #i89541# use SfxErrorContext to make the ErrorHandler dialog modal 2009-04-20 17:52:56 +0200 cl r271003 : #i98480# removed 'EndPosition' and 'StartPosition' from styles 2009-04-20 16:41:55 +0200 cl r270994 : #i98403# fixed state handling for selected motion path 2009-04-17 11:35:25 +0200 cl r270931 : #i61274# export to pdf should behave like printing considering layer visibility 2009-04-17 10:00:17 +0200 cl r270924 : #i98967# set default style on any new shape except a page obj 2009-04-16 16:28:20 +0200 cl r270893 : #i98859# use percentage type for relative font height
2009-06-17 10:58:14 +00:00
if ( bFlipV )
{
Point aLeft( aRect.Left(), ( aRect.Top() + aRect.Bottom() ) >> 1 );
Point aRight( aLeft.X() + 1000, aLeft.Y() );
pObj->NbcMirror( aLeft, aRight );
}
basegfx::B2DPolyPolygon aPolyPolygon;
SdrObjListIter aIter( *pObj, IM_DEEPWITHGROUPS );
while ( aIter.IsMore() )
{
SdrObject* pNewObj = NULL;
basegfx::B2DPolyPolygon aPP;
const SdrObject* pNext = aIter.Next();
if ( pNext->ISA( SdrPathObj ) )
{
aPP = ((SdrPathObj*)pNext)->GetPathPoly();
}
else
{
pNewObj = pNext->ConvertToPolyObj( FALSE, FALSE );
SdrPathObj* pPath = PTR_CAST( SdrPathObj, pNewObj );
if ( pPath )
aPP = pPath->GetPathPoly();
}
if ( aPP.count() )
aPolyPolygon.append(aPP);
SdrObject::Free( pNewObj );
}
SdrObject::Free( pObj );
SvxConvertB2DPolyPolygonToPolyPolygonBezier( aPolyPolygon, aPolyPolygonBezierCoords );
}
}
return aPolyPolygonBezierCoords;
}
SEQ( REF( com::sun::star::drawing::XCustomShapeHandle ) ) SAL_CALL EnhancedCustomShapeEngine::getInteraction()
throw ( NMSP_UNO::RuntimeException )
{
sal_uInt32 i, nHdlCount = 0;
SdrObject* pSdrObjCustomShape = GetSdrObjectFromXShape( mxShape );
if ( pSdrObjCustomShape )
{
EnhancedCustomShape2d aCustomShape2d( pSdrObjCustomShape );
nHdlCount = aCustomShape2d.GetHdlCount();
}
SEQ( REF( com::sun::star::drawing::XCustomShapeHandle ) ) aSeq( nHdlCount );
for ( i = 0; i < nHdlCount; i++ )
aSeq[ i ] = new EnhancedCustomShapeHandle( mxShape, i );
return aSeq;
}