summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore/unodraw.cxx
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-02-13 10:05:35 +0000
committerOliver Bolte <obo@openoffice.org>2009-02-13 10:05:35 +0000
commit1524aa18b9ddf7a4181e3f278155c48655084452 (patch)
tree44a60ea6c3327cc5b13c62cace39ddde425d837a /sw/source/core/unocore/unodraw.cxx
parent841d2d5a1cf491cd59a89cbe26ace1cfeb18d556 (diff)
CWS-TOOLING: integrate CWS sw31bf04
2009-01-21 14:24:10 +0100 od r266670 : #i59051# correction of metric change for PolyPolygonBezier needed 2009-01-21 09:35:44 +0100 od r266632 : #i96062# adjustment of fix after rebasing 2009-01-21 09:34:56 +0100 od r266631 : #i94152# adjustment of fix after rebasing 2009-01-20 16:43:12 +0100 od r266596 : CWS-TOOLING: rebase CWS sw31bf04 to trunk@266428 (milestone: DEV300:m39) 2009-01-20 11:52:22 +0100 od r266561 : #i94152 method <SwDoc::SetOutlineNumRule(..)> - assure that at outline list style registered text node have the correct list level set 2009-01-20 10:43:53 +0100 od r266556 : #i93399# methods <SwNumRule::SetIndent(..)> and <SwNumRule::ChangeIndent(..)> - adjust also the list tab position, if a list tab stop is applied 2009-01-16 16:26:56 +0100 od r266432 : #i59051# adjust Writer's UNO-API for drawing objects - correct conversion of "StartPosition" and "EndPosition" - conversion of "PolyPolygonBezier" 2009-01-16 16:20:49 +0100 od r266430 : #i59051# - adjust UNO-API of connector shape -- convert "PolyPolygonBezier" to correct metric -- convert "StartPosition" and "EndPosition" in set-method before applying anchor position - adjust UNO-API of measure shape -- convert "StartPosition" and "EndPosition" to correct metric 2009-01-16 15:01:21 +0100 od r266419 : #i95698# method <SwFrm::GetPrevSctLeaf(..)> - only columns as previous section leaves for tables inside sections, which are inside another table. 2009-01-14 14:34:58 +0100 od r266304 : #i96092# method <HandleResetAttrAtTxtNode::~HandleResetAttrAtTxtNode()> - set list level to outline level, if needed. 2009-01-13 17:09:43 +0100 od r266238 : #i98037# method <SwWW8ImplReader::IsObjectLayoutInTableCell(..)> - adjust evaluation of WW8 attributes 2009-01-13 11:49:48 +0100 od r266203 : #i94187# method <SwTxtFormatter::NewTabPortion(..)> - correct consideration of compatibility option TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST 2009-01-13 11:48:45 +0100 od r266202 : #i94187# method <OutWW8_SwTxtNode(..)> - set list style directly at paragraph only in position and space mode LABEL_WIDTH_AND_POSITION 2009-01-12 12:22:58 +0100 od r266143 : #i70582# method <SwFlyAtCntFrm::SetAbsPos(..)> and local method <lcl_CalcDownDist(..)> - correct determination of anchor's frame top for object positioning.
Diffstat (limited to 'sw/source/core/unocore/unodraw.cxx')
-rw-r--r--sw/source/core/unocore/unodraw.cxx173
1 files changed, 96 insertions, 77 deletions
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 1b8d883f36a9..19a1a84af546 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -68,9 +68,7 @@
#include <comphelper/extract.hxx>
#include <comphelper/stl_types.hxx>
#include <svx/scene3d.hxx>
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
@@ -78,14 +76,15 @@
// OD 2004-05-05 #i28701#
#include <fmtwrapinfluenceonobjpos.hxx>
// --> OD 2004-11-10 #i35007#
-#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP
#include <com/sun/star/text/TextContentAnchorType.hpp>
-#endif
// <--
// --> OD 2005-03-10 #i44334#, #i44681#
// --> OD 2007-01-03 #i73079# - use correct matrix type
#include <basegfx/matrix/b2dhommatrix.hxx>
// <--
+// --> OD 2009-01-16 #i59051
+#include <com/sun/star/drawing/PointSequence.hpp>
+// <--
#include <vcl/svapp.hxx>
@@ -1634,13 +1633,25 @@ uno::Any SwXShape::getPropertyValue(const rtl::OUString& rPropertyName)
{
awt::Point aStartPos;
aRet >>= aStartPos;
- aRet <<= _ConvertStartPosToLayoutDir( aStartPos );
+ // --> OD 2009-01-12 #i59051#
+ aRet <<= _ConvertStartOrEndPosToLayoutDir( aStartPos );
+ // <--
}
else if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) )
{
awt::Point aEndPos;
aRet >>= aEndPos;
- aRet <<= _ConvertEndPosToLayoutDir( aEndPos );
+ // --> OD 2009-01-12 #i59051#
+ aRet <<= _ConvertStartOrEndPosToLayoutDir( aEndPos );
+ // <--
+ }
+ // --> OD 2009-01-16 #i59051#
+ else if ( rPropertyName.equals(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier"))) )
+ {
+ drawing::PolyPolygonBezierCoords aPath;
+ aRet >>= aPath;
+ aRet <<= _ConvertPolyPolygonBezierToLayoutDir( aPath );
+ // <--
}
// <--
}
@@ -2628,96 +2639,104 @@ void SwXShape::_AdjustPositionProperties( const awt::Point _aPosition )
}
}
-/** method to convert start and end position of the drawing object to the
+/** method to convert start or end position of the drawing object to the
Writer specific position, which is the attribute position in layout direction
- OD 2004-10-28 #i36248#
+ OD 2009-01-12 #i59051#
@author OD
*/
-void SwXShape::__ConvertStartEndPosToLayoutDir( awt::Point& _rioStartPos,
- awt::Point& _rioEndPos )
+::com::sun::star::awt::Point SwXShape::_ConvertStartOrEndPosToLayoutDir(
+ const ::com::sun::star::awt::Point& aStartOrEndPos )
{
- awt::Point aPos( getPosition() );
- awt::Size aSize( getSize() );
+ awt::Point aConvertedPos( aStartOrEndPos );
- if ( _rioStartPos.X == _rioEndPos.X )
- {
- _rioStartPos.X = aPos.X;
- _rioEndPos.X = aPos.X;
- }
- else if ( _rioStartPos.X < _rioEndPos.X )
- {
- _rioStartPos.X = aPos.X;
- _rioEndPos.X = aPos.X + aSize.Width;
- }
- else
- {
- _rioEndPos.X = aPos.X;
- _rioStartPos.X = aPos.X + aSize.Width;
- }
-
- if ( _rioStartPos.Y == _rioEndPos.Y )
- {
- _rioStartPos.Y = aPos.Y;
- _rioEndPos.Y = aPos.Y;
- }
- else if ( _rioStartPos.Y < _rioEndPos.Y )
- {
- _rioStartPos.Y = aPos.Y;
- _rioEndPos.Y = aPos.Y + aSize.Height;
- }
- else
- {
- _rioEndPos.Y = aPos.Y;
- _rioStartPos.Y = aPos.Y + aSize.Height;
- }
-}
-
-/** method to convert start position of the drawing object to the
- Writer specific position, which is the attribute position in layout direction
-
- OD 2004-10-28 #i36248#
-
- @author OD
-*/
-awt::Point SwXShape::_ConvertStartPosToLayoutDir( const awt::Point& _aStartPos )
-{
- awt::Point aStartPos( _aStartPos );
- awt::Point aEndPos( 0, 0 );
- SvxShape* pSvxShape( GetSvxShape() );
+ SvxShape* pSvxShape = GetSvxShape();
+ ASSERT( pSvxShape,
+ "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!")
if ( pSvxShape )
{
- pSvxShape->_getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")) )
- >>= aEndPos;
-
- __ConvertStartEndPosToLayoutDir( aStartPos, aEndPos );
+ const SdrObject* pObj = pSvxShape->GetSdrObject();
+ ASSERT( pObj,
+ "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!")
+ if ( pObj )
+ {
+ // get position of object in Writer coordinate system.
+ awt::Point aPos( getPosition() );
+ // get position of object in Drawing layer coordinate system
+ const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
+ const awt::Point aObjPos(
+ TWIP_TO_MM100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
+ TWIP_TO_MM100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
+ // determine difference between these positions according to the
+ // Writer coordinate system
+ const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
+ aPos.Y - aObjPos.Y );
+ // apply translation difference to transformation matrix.
+ if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
+ {
+ aConvertedPos.X = aConvertedPos.X + aTranslateDiff.X;
+ aConvertedPos.Y = aConvertedPos.Y + aTranslateDiff.Y;
+ }
+ }
}
- return aStartPos;
+ return aConvertedPos;
}
-/** method to convert end position of the drawing object to the
- Writer specific position, which is the attribute position in layout direction
-
- OD 2004-10-28 #i36248#
-
- @author OD
-*/
-awt::Point SwXShape::_ConvertEndPosToLayoutDir( const awt::Point& _aEndPos )
+::com::sun::star::drawing::PolyPolygonBezierCoords SwXShape::_ConvertPolyPolygonBezierToLayoutDir(
+ const ::com::sun::star::drawing::PolyPolygonBezierCoords& aPath )
{
- awt::Point aEndPos( _aEndPos );
- awt::Point aStartPos( 0, 0 );
- SvxShape* pSvxShape( GetSvxShape() );
+ drawing::PolyPolygonBezierCoords aConvertedPath( aPath );
+
+ SvxShape* pSvxShape = GetSvxShape();
+ ASSERT( pSvxShape,
+ "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SvxShape found!")
if ( pSvxShape )
{
- pSvxShape->_getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")) )
- >>= aStartPos;
+ const SdrObject* pObj = pSvxShape->GetSdrObject();
+ ASSERT( pObj,
+ "<SwXShape::_ConvertStartOrEndPosToLayoutDir(..)> - no SdrObject found!")
+ if ( pObj )
+ {
+ // get position of object in Writer coordinate system.
+ awt::Point aPos( getPosition() );
+ // get position of object in Drawing layer coordinate system
+ const Point aTmpObjPos( pObj->GetSnapRect().TopLeft() );
+ const awt::Point aObjPos(
+ TWIP_TO_MM100( aTmpObjPos.X() - pObj->GetAnchorPos().X() ),
+ TWIP_TO_MM100( aTmpObjPos.Y() - pObj->GetAnchorPos().Y() ) );
+ // determine difference between these positions according to the
+ // Writer coordinate system
+ const awt::Point aTranslateDiff( aPos.X - aObjPos.X,
+ aPos.Y - aObjPos.Y );
+ // apply translation difference to PolyPolygonBezier.
+ if ( aTranslateDiff.X != 0 || aTranslateDiff.Y != 0 )
+ {
+ basegfx::B2DHomMatrix aMatrix;
+ aMatrix.translate( aTranslateDiff.X, aTranslateDiff.Y );
+
+ const sal_Int32 nOuterSequenceCount(aConvertedPath.Coordinates.getLength());
+ drawing::PointSequence* pInnerSequence = aConvertedPath.Coordinates.getArray();
+ for(sal_Int32 a(0); a < nOuterSequenceCount; a++)
+ {
+ const sal_Int32 nInnerSequenceCount(pInnerSequence->getLength());
+ awt::Point* pArray = pInnerSequence->getArray();
- __ConvertStartEndPosToLayoutDir( aStartPos, aEndPos );
+ for(sal_Int32 b(0); b < nInnerSequenceCount; b++)
+ {
+ basegfx::B2DPoint aNewCoordinatePair(pArray->X, pArray->Y);
+ aNewCoordinatePair *= aMatrix;
+ pArray->X = basegfx::fround(aNewCoordinatePair.getX());
+ pArray->Y = basegfx::fround(aNewCoordinatePair.getY());
+ pArray++;
+ }
+ }
+ }
+ }
}
- return aEndPos;
+ return aConvertedPath;
}
/*-- 31.05.01 09:59:19---------------------------------------------------