ooo-build r14786 - in trunk: . patches/dev300
- From: thorstenb svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14786 - in trunk: . patches/dev300
- Date: Tue, 9 Dec 2008 07:22:19 +0000 (UTC)
Author: thorstenb
Date: Tue Dec 9 07:22:19 2008
New Revision: 14786
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14786&view=rev
Log:
* patches/dev300/apply:
* patches/dev300/fit-list-to-size*.diff: converted to
DrawingPrimitives, enabled patches again
* patches/dev300/canvas-directx-lostdevice-fix.diff: improved
DeviceLost handling in device::flip(); converted backbuffer from
DX mem surface to GDI+ bitmap (which does not become invalid
during device lost state)
Modified:
trunk/ChangeLog
trunk/patches/dev300/apply
trunk/patches/dev300/canvas-directx-lostdevice-fix.diff
trunk/patches/dev300/fit-list-to-size.diff
Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply (original)
+++ trunk/patches/dev300/apply Tue Dec 9 07:22:19 2008
@@ -2532,10 +2532,9 @@
# have Impress outline text boxes shrink font automatically when text
# starts to overflow
-# FIXME 2008-11-26: doesn't apply to dev300-m35
-#fit-list-to-size.diff, i#94086, thorsten
-#fit-list-to-size-ui.diff, i#94086, thorsten
-#fit-list-to-size-style-defaults.diff, i#94086, thorsten
+fit-list-to-size.diff, i#94086, thorsten
+fit-list-to-size-ui.diff, i#94086, thorsten
+fit-list-to-size-style-defaults.diff, i#94086, thorsten
# apply this patch if you need to disable vcl grabbing your mouse -
# after applying the patch, set SAL_NO_MOUSEGRABS in your env
@@ -2711,8 +2710,7 @@
piece-desktop-avoid-user-conf-symlinks.diff, pmladek
[ BFFixes ]
-# FIXME 2008-11-26: compilation error in dev300-m35
-#fit-list-to-size-binfilter.diff, i#94086, thorsten
+fit-list-to-size-binfilter.diff, i#94086, thorsten
[ ArkOnly ]
SectionOwner => brosenk
Modified: trunk/patches/dev300/canvas-directx-lostdevice-fix.diff
==============================================================================
--- trunk/patches/dev300/canvas-directx-lostdevice-fix.diff (original)
+++ trunk/patches/dev300/canvas-directx-lostdevice-fix.diff Tue Dec 9 07:22:19 2008
@@ -1,36 +1,681 @@
diff -u -p -r1.5 dx_9rm.cxx
--- canvas/source/directx/dx_9rm.cxx 24 Jun 2008 10:30:05 -0000 1.5
-+++ canvas/source/directx/dx_9rm.cxx 4 Dec 2008 00:20:35 -0000
-@@ -956,11 +956,32 @@ namespace dxcanvas
++++ canvas/source/directx/dx_9rm.cxx 8 Dec 2008 23:04:21 -0000
+@@ -53,6 +53,7 @@
+ #include <canvas/debug.hxx>
+ #include <canvas/verbosetrace.hxx>
+ #include <tools/diagnose_ex.h>
++#include <osl/thread.h>
+
+ #include <canvas/elapsedtime.hxx>
+ #include <canvas/canvastools.hxx>
+@@ -956,11 +957,43 @@ namespace dxcanvas
{
if(hr != D3DERR_DEVICELOST)
return false;
+- hr = mpDevice->Reset(&mad3dpp);
+- if(SUCCEEDED(hr))
+- return true;
+- if(hr == D3DERR_DEVICELOST)
+- return true;
+
-+ mpVertexBuffer.reset();
- hr = mpDevice->Reset(&mad3dpp);
- if(SUCCEEDED(hr))
++ // interestingly enough, sometimes the Reset() below
++ // *still* causes DeviceLost errors. So, cycle until
++ // DX was kind enough to really reset the device...
++ do
+ {
-+ IDirect3DVertexBuffer9 *pVB(NULL);
-+ DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
-+ if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices,
-+ D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
-+ aFVF,
-+ D3DPOOL_DEFAULT,
-+ &pVB,
-+ NULL)) )
++ mpVertexBuffer.reset();
++ hr = mpDevice->Reset(&mad3dpp);
++ if(SUCCEEDED(hr))
+ {
-+ throw lang::NoSupportException(
-+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
-+ "Could not create DirectX device - out of memory!")),NULL);
++ IDirect3DVertexBuffer9 *pVB(NULL);
++ DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
++ if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices,
++ D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
++ aFVF,
++ D3DPOOL_DEFAULT,
++ &pVB,
++ NULL)) )
++ {
++ throw lang::NoSupportException(
++ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
++ "Could not create DirectX device - out of memory!")),NULL);
++ }
++ mpVertexBuffer=COMReference<IDirect3DVertexBuffer9>(pVB);
++
++ // retry after the restore
++ if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0)))
++ return true;
+ }
-+ mpVertexBuffer=COMReference<IDirect3DVertexBuffer9>(pVB);
+
- return true;
++ TimeValue aTimeout;
++ aTimeout.Seconds=1;
++ aTimeout.Nanosec=0;
++ osl_waitThread(&aTimeout);
+ }
-+
- if(hr == D3DERR_DEVICELOST)
- return true;
++ while(hr == D3DERR_DEVICELOST);
+
return false;
}
+diff -u -p -r1.2 dx_surfacebitmap.cxx
+--- canvas/source/directx/dx_surfacebitmap.cxx 24 Jun 2008 10:39:05 -0000 1.2
++++ canvas/source/directx/dx_surfacebitmap.cxx 8 Dec 2008 23:04:23 -0000
+@@ -57,91 +57,6 @@ namespace dxcanvas
+ namespace
+ {
+ //////////////////////////////////////////////////////////////////////////////////
+- // DXColorBuffer
+- //////////////////////////////////////////////////////////////////////////////////
+-
+- struct DXColorBuffer : public canvas::IColorBuffer
+- {
+- public:
+- DXColorBuffer( const COMReference<surface_type>& rSurface,
+- const ::basegfx::B2IVector& rSize ) :
+- mpSurface(rSurface),
+- maSize(rSize),
+- mbAlpha(false)
+- {
+- }
+-
+- // implementation of the 'IColorBuffer' interface
+- public:
+-
+- virtual sal_uInt8* lock() const;
+- virtual void unlock() const;
+- virtual sal_uInt32 getWidth() const;
+- virtual sal_uInt32 getHeight() const;
+- virtual sal_uInt32 getStride() const;
+- virtual Format getFormat() const;
+-
+- private:
+-
+- ::basegfx::B2IVector maSize;
+-#if DIRECTX_VERSION < 0x0900
+- mutable DDSURFACEDESC aSurfaceDesc;
+-#else
+- mutable D3DLOCKED_RECT maLockedRect;
+-#endif
+- mutable COMReference<surface_type> mpSurface;
+- bool mbAlpha;
+- };
+-
+- sal_uInt8* DXColorBuffer::lock() const
+- {
+-#if DIRECTX_VERSION < 0x0900
+- rtl_fillMemory((void *)&aSurfaceDesc,sizeof(DDSURFACEDESC),0);
+- aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC);
+- const DWORD dwFlags = DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_READONLY;
+- if(SUCCEEDED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL)))
+- return static_cast<sal_uInt8 *>(aSurfaceDesc.lpSurface);
+-#else
+- if(SUCCEEDED(mpSurface->LockRect(&maLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
+- return static_cast<sal_uInt8 *>(maLockedRect.pBits);
+-#endif
+- return NULL;
+- }
+-
+- void DXColorBuffer::unlock() const
+- {
+-#if DIRECTX_VERSION < 0x0900
+- mpSurface->Unlock(NULL);
+-#else
+- mpSurface->UnlockRect();
+-#endif
+- }
+-
+- sal_uInt32 DXColorBuffer::getWidth() const
+- {
+- return maSize.getX();
+- }
+-
+- sal_uInt32 DXColorBuffer::getHeight() const
+- {
+- return maSize.getY();
+- }
+-
+- sal_uInt32 DXColorBuffer::getStride() const
+- {
+-#if DIRECTX_VERSION < 0x0900
+- return aSurfaceDesc.lPitch;
+-#else
+- return maLockedRect.Pitch;
+-#endif
+- }
+-
+- canvas::IColorBuffer::Format DXColorBuffer::getFormat() const
+- {
+- return canvas::IColorBuffer::FMT_X8R8G8B8;
+- }
+-
+- //////////////////////////////////////////////////////////////////////////////////
+ // GDIColorBuffer
+ //////////////////////////////////////////////////////////////////////////////////
+
+@@ -233,7 +148,6 @@ namespace dxcanvas
+ mpRenderModule(rRenderModule),
+ mpSurfaceManager(rMgr),
+ mpSurfaceProxy(),
+- mpSurface(),
+ mpGDIPlusBitmap(),
+ mpGraphics(),
+ mpColorBuffer(),
+@@ -267,24 +181,24 @@ namespace dxcanvas
+ maSize.getY(),
+ PixelFormat32bppARGB
+ ));
+- mpGraphics.reset( tools::createGraphicsFromBitmap(mpGDIPlusBitmap) );
+-
+- // create the colorbuffer object, which is basically a simple
+- // wrapper around the directx surface. the colorbuffer is the
+- // interface which is used by the surfaceproxy to support any
+- // kind of underlying structure for the pixel data container.
+- mpColorBuffer.reset(new GDIColorBuffer(mpGDIPlusBitmap,maSize));
+ }
+ else
+ {
+- mpSurface = mpRenderModule->createSystemMemorySurface(maSize);
+-
+- // create the colorbuffer object, which is basically a simple
+- // wrapper around the directx surface. the colorbuffer is the
+- // interface which is used by the surfaceproxy to support any
+- // kind of underlying structure for the pixel data container.
+- mpColorBuffer.reset(new DXColorBuffer(mpSurface,maSize));
++ mpGDIPlusBitmap.reset(
++ new Gdiplus::Bitmap(
++ maSize.getX(),
++ maSize.getY(),
++ PixelFormat24bppRGB
++ ));
+ }
++
++ mpGraphics.reset( tools::createGraphicsFromBitmap(mpGDIPlusBitmap) );
++
++ // create the colorbuffer object, which is basically a simple
++ // wrapper around the directx surface. the colorbuffer is the
++ // interface which is used by the surfaceproxy to support any
++ // kind of underlying structure for the pixel data container.
++ mpColorBuffer.reset(new GDIColorBuffer(mpGDIPlusBitmap,maSize));
+
+ // create a (possibly hardware accelerated) mirror surface.
+ mpSurfaceProxy = mpSurfaceManager->createSurfaceProxy(mpColorBuffer);
+@@ -337,11 +251,7 @@ namespace dxcanvas
+ // to ensure that the corrosponding dxsurface will
+ // be updated.
+ mbIsSurfaceDirty = true;
+-
+- if(hasAlpha())
+- return mpGraphics;
+- else
+- return createSurfaceGraphics(mpSurface);
++ return mpGraphics;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////
+@@ -350,52 +260,7 @@ namespace dxcanvas
+
+ BitmapSharedPtr DXSurfaceBitmap::getBitmap() const
+ {
+- if(hasAlpha())
+- return mpGDIPlusBitmap;
+-
+- BitmapSharedPtr pResult;
+-
+-#if DIRECTX_VERSION < 0x0900
+- DDSURFACEDESC aSurfaceDesc;
+- rtl_fillMemory(&aSurfaceDesc,sizeof(DDSURFACEDESC),0);
+- aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC);
+- const DWORD dwFlags = DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_READONLY;
+-
+- // lock the directx surface to receive the pointer to the surface memory.
+- if(SUCCEEDED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL)))
+- {
+- // decide about the format we pass the gdi+, the directx surface is always
+- // 32bit, either with or without alpha component.
+- Gdiplus::PixelFormat nFormat = hasAlpha() ? PixelFormat32bppARGB : PixelFormat32bppRGB;
+-
+- // construct a gdi+ bitmap from the raw pixel data.
+- pResult.reset(new Gdiplus::Bitmap( maSize.getX(),maSize.getY(),
+- aSurfaceDesc.lPitch,
+- nFormat,
+- (BYTE *)aSurfaceDesc.lpSurface ));
+-
+- // unlock the directx surface
+- mpSurface->Unlock(NULL);
+- }
+-#else
+- D3DLOCKED_RECT aLockedRect;
+- if(SUCCEEDED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
+- {
+- // decide about the format we pass the gdi+, the directx surface is always
+- // 32bit, either with or without alpha component.
+- Gdiplus::PixelFormat nFormat = hasAlpha() ? PixelFormat32bppARGB : PixelFormat32bppRGB;
+-
+- // construct a gdi+ bitmap from the raw pixel data.
+- pResult.reset(new Gdiplus::Bitmap( maSize.getX(),maSize.getY(),
+- aLockedRect.Pitch,
+- nFormat,
+- (BYTE *)aLockedRect.pBits ));
+-
+- mpSurface->UnlockRect();
+- }
+-#endif
+-
+- return pResult;
++ return mpGDIPlusBitmap;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////
+@@ -473,125 +338,41 @@ namespace dxcanvas
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////
+- // DXSurfaceBitmap::imageDebugger
+- //////////////////////////////////////////////////////////////////////////////////
+-#if defined(DX_DEBUG_IMAGES)
+-# if OSL_DEBUG_LEVEL > 0
+- void DXSurfaceBitmap::imageDebugger()
+- {
+-#if DIRECTX_VERSION < 0x0900
+- DDSURFACEDESC aSurfaceDesc;
+- rtl_fillMemory( &aSurfaceDesc,sizeof(DDSURFACEDESC),0 );
+- aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC);
+-
+- if( FAILED(mpSurface->Lock( NULL,
+- &aSurfaceDesc,
+- DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_READONLY,
+- NULL)) )
+- return;
+-
+- imdebug("bgra w=%d h=%d %p", aSurfaceDesc.dwWidth, aSurfaceDesc.dwHeight, aSurfaceDesc.lpSurface);
+-
+- mpSurface->Unlock(NULL);
+-#else
+- D3DLOCKED_RECT aLockedRect;
+- if( FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)) )
+- return;
+-
+- imdebug("bgra w=%d h=%d %p", maSize.getX(),
+- maSize.getY(), aLockedRect.pBits);
+- mpSurface->UnlockRect();
+-#endif
+- }
+-# endif
+-#endif
+-
+- //////////////////////////////////////////////////////////////////////////////////
+ // DXSurfaceBitmap::getData
+ //////////////////////////////////////////////////////////////////////////////////
+
+ uno::Sequence< sal_Int8 > DXSurfaceBitmap::getData( rendering::IntegerBitmapLayout& /*bitmapLayout*/,
+ const geometry::IntegerRectangle2D& rect )
+ {
+- if(hasAlpha())
+- {
+- uno::Sequence< sal_Int8 > aRes( (rect.X2-rect.X1)*(rect.Y2-rect.Y1)*4 ); // TODO(F1): Be format-agnostic here
+-
+- const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) );
+-
+- Gdiplus::BitmapData aBmpData;
+- aBmpData.Width = rect.X2-rect.X1;
+- aBmpData.Height = rect.Y2-rect.Y1;
+- aBmpData.Stride = 4*aBmpData.Width;
+- aBmpData.PixelFormat = PixelFormat32bppARGB;
+- aBmpData.Scan0 = aRes.getArray();
+-
+- // TODO(F1): Support more pixel formats natively
+-
+- // read data from bitmap
+- if( Gdiplus::Ok != mpGDIPlusBitmap->LockBits( &aRect,
+- Gdiplus::ImageLockModeRead | Gdiplus::ImageLockModeUserInputBuf,
+- PixelFormat32bppARGB, // TODO(F1): Adapt to
+- // Graphics native
+- // format/change
+- // getMemoryLayout
+- &aBmpData ) )
+- {
+- // failed to lock, bail out
+- return uno::Sequence< sal_Int8 >();
+- }
++ uno::Sequence< sal_Int8 > aRes( (rect.X2-rect.X1)*(rect.Y2-rect.Y1)*4 ); // TODO(F1): Be format-agnostic here
+
+- mpGDIPlusBitmap->UnlockBits( &aBmpData );
++ const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) );
+
+- return aRes;
+- }
+- else
+- {
+- sal_uInt32 nWidth = rect.X2-rect.X1;
+- sal_uInt32 nHeight = rect.Y2-rect.Y1;
++ Gdiplus::BitmapData aBmpData;
++ aBmpData.Width = rect.X2-rect.X1;
++ aBmpData.Height = rect.Y2-rect.Y1;
++ aBmpData.Stride = 4*aBmpData.Width;
++ aBmpData.PixelFormat = PixelFormat32bppARGB;
++ aBmpData.Scan0 = aRes.getArray();
++
++ // TODO(F1): Support more pixel formats natively
++
++ // read data from bitmap
++ if( Gdiplus::Ok != mpGDIPlusBitmap->LockBits( &aRect,
++ Gdiplus::ImageLockModeRead | Gdiplus::ImageLockModeUserInputBuf,
++ PixelFormat32bppARGB, // TODO(F1): Adapt to
++ // Graphics native
++ // format/change
++ // getMemoryLayout
++ &aBmpData ) )
++ {
++ // failed to lock, bail out
++ return uno::Sequence< sal_Int8 >();
++ }
+
+- uno::Sequence< sal_Int8 > aRes(nWidth*nHeight*4);
++ mpGDIPlusBitmap->UnlockBits( &aBmpData );
+
+-#if DIRECTX_VERSION < 0x0900
+- DDSURFACEDESC aSurfaceDesc;
+- rtl_fillMemory(&aSurfaceDesc,sizeof(DDSURFACEDESC),0);
+- aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC);
+- const DWORD dwFlags = DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_READONLY;
+-
+- // lock the directx surface to receive the pointer to the surface memory.
+- if(FAILED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL)))
+- return uno::Sequence< sal_Int8 >();
+-
+- sal_uInt8 *pSrc = (sal_uInt8 *)((((BYTE *)aSurfaceDesc.lpSurface)+(rect.Y1*aSurfaceDesc.lPitch))+rect.X1);
+- sal_uInt8 *pDst = (sal_uInt8 *)aRes.getArray();
+- sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
+- for(sal_uInt32 y=0; y<nHeight; ++y)
+- {
+- rtl_copyMemory(pDst,pSrc,nSegmentSizeInBytes);
+- pDst += nSegmentSizeInBytes;
+- pSrc += aSurfaceDesc.lPitch;
+- }
+-
+- mpSurface->Unlock(NULL);
+-#else
+- D3DLOCKED_RECT aLockedRect;
+- if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
+- return uno::Sequence< sal_Int8 >();
+-
+- sal_uInt8 *pSrc = (sal_uInt8 *)((((BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1);
+- sal_uInt8 *pDst = (sal_uInt8 *)aRes.getArray();
+- sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
+- for(sal_uInt32 y=0; y<nHeight; ++y)
+- {
+- rtl_copyMemory(pDst,pSrc,nSegmentSizeInBytes);
+- pDst += nSegmentSizeInBytes;
+- pSrc += aLockedRect.Pitch;
+- }
+-
+- mpSurface->UnlockRect();
+-#endif
+- return aRes;
+- }
++ return aRes;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////
+@@ -602,78 +383,30 @@ namespace dxcanvas
+ const rendering::IntegerBitmapLayout& /*bitmapLayout*/,
+ const geometry::IntegerRectangle2D& rect )
+ {
+- if(hasAlpha())
+- {
+- const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) );
++ const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) );
+
+- Gdiplus::BitmapData aBmpData;
+- aBmpData.Width = rect.X2-rect.X1;
+- aBmpData.Height = rect.Y2-rect.Y1;
+- aBmpData.Stride = 4*aBmpData.Width;
+- aBmpData.PixelFormat = PixelFormat32bppARGB;
+- aBmpData.Scan0 = (void*)data.getConstArray();
+-
+- // TODO(F1): Support more pixel formats natively
+-
+- if( Gdiplus::Ok != mpGDIPlusBitmap->LockBits( &aRect,
+- Gdiplus::ImageLockModeWrite | Gdiplus::ImageLockModeUserInputBuf,
+- PixelFormat32bppARGB, // TODO: Adapt to
+- // Graphics native
+- // format/change
+- // getMemoryLayout
+- &aBmpData ) )
+- {
+- throw uno::RuntimeException();
+- }
+-
+- // commit data to bitmap
+- mpGDIPlusBitmap->UnlockBits( &aBmpData );
+- }
+- else
+- {
+- sal_uInt32 nWidth = rect.X2-rect.X1;
+- sal_uInt32 nHeight = rect.Y2-rect.Y1;
+-
+-#if DIRECTX_VERSION < 0x0900
+- DDSURFACEDESC aSurfaceDesc;
+- rtl_fillMemory(&aSurfaceDesc,sizeof(DDSURFACEDESC),0);
+- aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC);
+- const DWORD dwFlags = DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_WRITEONLY;
+-
+- // lock the directx surface to receive the pointer to the surface memory.
+- if(FAILED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL)))
+- throw uno::RuntimeException();
+-
+- sal_uInt8 *pSrc = (sal_uInt8 *)data.getConstArray();
+- sal_uInt8 *pDst = (sal_uInt8 *)((((BYTE *)aSurfaceDesc.lpSurface)+(rect.Y1*aSurfaceDesc.lPitch))+rect.X1);
+- sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
+- for(sal_uInt32 y=0; y<nHeight; ++y)
+- {
+- rtl_copyMemory(pDst,pSrc,nSegmentSizeInBytes);
+- pSrc += nSegmentSizeInBytes;
+- pDst += aSurfaceDesc.lPitch;
+- }
+-
+- mpSurface->Unlock(NULL);
+-#else
+- // lock the directx surface to receive the pointer to the surface memory.
+- D3DLOCKED_RECT aLockedRect;
+- if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
+- throw uno::RuntimeException();
+-
+- sal_uInt8 *pSrc = (sal_uInt8 *)data.getConstArray();
+- sal_uInt8 *pDst = (sal_uInt8 *)((((BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1);
+- sal_uInt32 nSegmentSizeInBytes = nWidth<<4;
+- for(sal_uInt32 y=0; y<nHeight; ++y)
+- {
+- rtl_copyMemory(pDst,pSrc,nSegmentSizeInBytes);
+- pSrc += nSegmentSizeInBytes;
+- pDst += aLockedRect.Pitch;
+- }
++ Gdiplus::BitmapData aBmpData;
++ aBmpData.Width = rect.X2-rect.X1;
++ aBmpData.Height = rect.Y2-rect.Y1;
++ aBmpData.Stride = 4*aBmpData.Width;
++ aBmpData.PixelFormat = PixelFormat32bppARGB;
++ aBmpData.Scan0 = (void*)data.getConstArray();
++
++ // TODO(F1): Support more pixel formats natively
++
++ if( Gdiplus::Ok != mpGDIPlusBitmap->LockBits( &aRect,
++ Gdiplus::ImageLockModeWrite | Gdiplus::ImageLockModeUserInputBuf,
++ PixelFormat32bppARGB, // TODO: Adapt to
++ // Graphics native
++ // format/change
++ // getMemoryLayout
++ &aBmpData ) )
++ {
++ throw uno::RuntimeException();
++ }
+
+- mpSurface->UnlockRect();
+-#endif
+- }
++ // commit data to bitmap
++ mpGDIPlusBitmap->UnlockBits( &aBmpData );
+
+ mbIsSurfaceDirty = true;
+ }
+@@ -686,58 +419,20 @@ namespace dxcanvas
+ const rendering::IntegerBitmapLayout& /*bitmapLayout*/,
+ const geometry::IntegerPoint2D& pos )
+ {
+- if(hasAlpha())
+- {
+- const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() );
++ const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() );
+
+- ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width,
+- "CanvasHelper::setPixel: X coordinate out of bounds" );
+- ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height,
+- "CanvasHelper::setPixel: Y coordinate out of bounds" );
+- ENSURE_ARG_OR_THROW( color.getLength() > 3,
+- "CanvasHelper::setPixel: not enough color components" );
+-
+- if( Gdiplus::Ok != mpGDIPlusBitmap->SetPixel( pos.X, pos.Y,
+- Gdiplus::Color( tools::sequenceToArgb( color ))))
+- {
+- throw uno::RuntimeException();
+- }
+- }
+- else
+- {
+- ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(),
+- "CanvasHelper::setPixel: X coordinate out of bounds" );
+- ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(),
+- "CanvasHelper::setPixel: Y coordinate out of bounds" );
+- ENSURE_ARG_OR_THROW( color.getLength() > 3,
+- "CanvasHelper::setPixel: not enough color components" );
+-
+- Gdiplus::Color aColor(tools::sequenceToArgb(color));
+-
+-#if DIRECTX_VERSION < 0x0900
+- DDSURFACEDESC aSurfaceDesc;
+- rtl_fillMemory(&aSurfaceDesc,sizeof(DDSURFACEDESC),0);
+- aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC);
+- const DWORD dwFlags = DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_WRITEONLY;
+-
+- // lock the directx surface to receive the pointer to the surface memory.
+- if(FAILED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL)))
+- throw uno::RuntimeException();
+-
+- sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aSurfaceDesc.lpSurface)+(pos.Y*aSurfaceDesc.lPitch))+pos.X);
+- *pDst = aColor.GetValue();
+- mpSurface->Unlock(NULL);
+-#else
+- // lock the directx surface to receive the pointer to the surface memory.
+- D3DLOCKED_RECT aLockedRect;
+- if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
+- throw uno::RuntimeException();
+-
+- sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X);
+- *pDst = aColor.GetValue();
+- mpSurface->UnlockRect();
+-#endif
+- }
++ ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width,
++ "CanvasHelper::setPixel: X coordinate out of bounds" );
++ ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height,
++ "CanvasHelper::setPixel: Y coordinate out of bounds" );
++ ENSURE_ARG_OR_THROW( color.getLength() > 3,
++ "CanvasHelper::setPixel: not enough color components" );
++
++ if( Gdiplus::Ok != mpGDIPlusBitmap->SetPixel( pos.X, pos.Y,
++ Gdiplus::Color( tools::sequenceToArgb( color ))))
++ {
++ throw uno::RuntimeException();
++ }
+
+ mbIsSurfaceDirty = true;
+ }
+@@ -749,55 +444,19 @@ namespace dxcanvas
+ uno::Sequence< sal_Int8 > DXSurfaceBitmap::getPixel( rendering::IntegerBitmapLayout& /*bitmapLayout*/,
+ const geometry::IntegerPoint2D& pos )
+ {
+- if(hasAlpha())
+- {
+- const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() );
++ const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() );
+
+- ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width,
+- "CanvasHelper::getPixel: X coordinate out of bounds" );
+- ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height,
+- "CanvasHelper::getPixel: Y coordinate out of bounds" );
++ ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width,
++ "CanvasHelper::getPixel: X coordinate out of bounds" );
++ ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height,
++ "CanvasHelper::getPixel: Y coordinate out of bounds" );
+
+- Gdiplus::Color aColor;
++ Gdiplus::Color aColor;
+
+- if( Gdiplus::Ok != mpGDIPlusBitmap->GetPixel( pos.X, pos.Y, &aColor ) )
+- return uno::Sequence< sal_Int8 >();
++ if( Gdiplus::Ok != mpGDIPlusBitmap->GetPixel( pos.X, pos.Y, &aColor ) )
++ return uno::Sequence< sal_Int8 >();
+
+- return tools::argbToIntSequence(aColor.GetValue());
+- }
+- else
+- {
+- ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(),
+- "CanvasHelper::getPixel: X coordinate out of bounds" );
+- ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(),
+- "CanvasHelper::getPixel: Y coordinate out of bounds" );
+-
+-#if DIRECTX_VERSION < 0x0900
+- DDSURFACEDESC aSurfaceDesc;
+- rtl_fillMemory(&aSurfaceDesc,sizeof(DDSURFACEDESC),0);
+- aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC);
+- const DWORD dwFlags = DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_READONLY;
+-
+- // lock the directx surface to receive the pointer to the surface memory.
+- if(FAILED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL)))
+- throw uno::RuntimeException();
+-
+- sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aSurfaceDesc.lpSurface)+(pos.Y*aSurfaceDesc.lPitch))+pos.X);
+- Gdiplus::Color aColor(*pDst);
+- mpSurface->Unlock(NULL);
+-#else
+- // lock the directx surface to receive the pointer to the surface memory.
+- D3DLOCKED_RECT aLockedRect;
+- if(FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)))
+- throw uno::RuntimeException();
+-
+- sal_uInt32 *pDst = (sal_uInt32 *)((((BYTE *)aLockedRect.pBits)+(pos.Y*aLockedRect.Pitch))+pos.X);
+- Gdiplus::Color aColor(*pDst);
+- mpSurface->UnlockRect();
+-#endif
+-
+- return tools::argbToIntSequence(aColor.GetValue());
+- }
++ return tools::argbToIntSequence(aColor.GetValue());
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////
+diff -u -p -r1.2 dx_surfacebitmap.hxx
+--- canvas/source/directx/dx_surfacebitmap.hxx 24 Jun 2008 10:39:16 -0000 1.2
++++ canvas/source/directx/dx_surfacebitmap.hxx 8 Dec 2008 23:04:23 -0000
+@@ -57,8 +57,6 @@ namespace dxcanvas
+ virtual ::basegfx::B2IVector getSize() const;
+ virtual bool hasAlpha() const;
+
+- COMReference<surface_type> getSurface() const { return mpSurface; }
+-
+ bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DHomMatrix& rTransform );
+@@ -120,10 +118,6 @@ namespace dxcanvas
+ // the hardware-dependent rendering stuff.
+ canvas::ISurfaceProxySharedPtr mpSurfaceProxy;
+
+- // container for pixel data, we need to use a directx
+- // surface since GDI+ sucks...
+- COMReference<surface_type> mpSurface;
+-
+ // since GDI+ does not work correctly in case we
+ // run on a 16bit display [don't ask me why] we need
+ // to occasionally render to a native GDI+ bitmap.
Modified: trunk/patches/dev300/fit-list-to-size.diff
==============================================================================
--- trunk/patches/dev300/fit-list-to-size.diff (original)
+++ trunk/patches/dev300/fit-list-to-size.diff Tue Dec 9 07:22:19 2008
@@ -1,23 +1,32 @@
- offapi/com/sun/star/drawing/TextFitToSizeType.idl | 7 +
- qadevOOo/runner/util/ValueChanger.java | 2
- sd/sdi/_drvwsh.sdi | 12 --
- svx/inc/svx/sdtfsitm.hxx | 26 +++--
- svx/inc/svx/svdotext.hxx | 10 ++
- svx/source/dialog/textattr.cxx | 1
- svx/source/editeng/editobj2.hxx | 10 ++
- svx/source/editeng/impedit3.cxx | 7 +
- svx/source/editeng/impedit4.cxx | 6 +
- svx/source/outliner/outliner.cxx | 11 ++
- svx/source/svdraw/svdedxv.cxx | 4 -
- svx/source/svdraw/svdfppt.cxx | 12 ++
- svx/source/svdraw/svdotext.cxx | 104 +++++++++++++++++----
- svx/source/svdraw/svdotxat.cxx | 3 -
- svx/source/svdraw/svdotxed.cxx | 17 ++-
- svx/source/svdraw/svdotxtr.cxx | 9 --
- svx/source/svdraw/svdtxhdl.cxx | 3 -
- svx/source/svdraw/svdview.cxx | 3 -
- xmloff/source/draw/sdpropls.cxx | 4 -
- 19 files changed, 167 insertions(+), 84 deletions(-)
+ offapi/com/sun/star/drawing/TextFitToSizeType.idl | 7 +
+ qadevOOo/runner/util/ValueChanger.java | 2
+ sd/sdi/_drvwsh.sdi | 12 --
+ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx | 6 +
+ svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx | 40 ++++++
+ .../svx/sdr/primitive2d/svx_primitivetypes2d.hxx | 1
+ svx/inc/svx/sdtfsitm.hxx | 26 ++--
+ svx/inc/svx/svdotext.hxx | 16 ++
+ svx/source/dialog/dbregisterednamesconfig.cxx | 4 -
+ svx/source/dialog/textattr.cxx | 1
+ svx/source/editeng/editobj2.hxx | 10 +
+ svx/source/editeng/impedit3.cxx | 7 +
+ svx/source/editeng/impedit4.cxx | 6 +
+ svx/source/outliner/outliner.cxx | 11 +-
+ svx/source/sdr/attribute/sdrtextattribute.cxx | 3
+ svx/source/sdr/primitive2d/sdrattributecreator.cxx | 6 -
+ .../sdr/primitive2d/sdrdecompositiontools.cxx | 5 +
+ svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx | 54 ++++++++
+ svx/source/svdraw/svdedxv.cxx | 10 +
+ svx/source/svdraw/svdfppt.cxx | 12 ++
+ svx/source/svdraw/svdotext.cxx | 107 ++++++++++++---
+ svx/source/svdraw/svdotextdecomposition.cxx | 140 +++++++++++++++++++-
+ svx/source/svdraw/svdotxat.cxx | 3
+ svx/source/svdraw/svdotxed.cxx | 17 ++
+ svx/source/svdraw/svdotxtr.cxx | 9 -
+ svx/source/svdraw/svdtxhdl.cxx | 3
+ svx/source/svdraw/svdview.cxx | 3
+ xmloff/source/draw/sdpropls.cxx | 4 -
+ 28 files changed, 427 insertions(+), 98 deletions(-)
diff --git offapi/com/sun/star/drawing/TextFitToSizeType.idl offapi/com/sun/star/drawing/TextFitToSizeType.idl
@@ -52,7 +61,7 @@
if (oldValue.equals(TF2)) newValue = TF3;
if (oldValue.equals(TF3)) newValue = TF4;
diff --git sd/sdi/_drvwsh.sdi sd/sdi/_drvwsh.sdi
-index 69208fe..76ed4a3 100644
+index a3dfd27..c895d2e 100644
--- sd/sdi/_drvwsh.sdi
+++ sd/sdi/_drvwsh.sdi
@@ -28,18 +28,6 @@
@@ -74,6 +83,100 @@
interface DrawView
{
SID_JUMPTOMARK // ole : no, status : ?
+diff --git svx/inc/svx/sdr/attribute/sdrtextattribute.hxx svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
+index 713ec55..d324e8e 100644
+--- svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
++++ svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
+@@ -64,6 +64,7 @@ namespace drawinglayer
+ // bitfield
+ unsigned mbContour : 1;
+ unsigned mbFitToSize : 1;
++ unsigned mbAutoFit : 1;
+ unsigned mbHideContour : 1;
+ unsigned mbBlink : 1;
+ unsigned mbScroll : 1;
+@@ -77,8 +78,8 @@ namespace drawinglayer
+ sal_Int32 aTextRightDistance,
+ sal_Int32 aTextLowerDistance,
+ bool bContour, bool bFitToSize,
+- bool bHideContour, bool bBlink,
+- bool bScroll);
++ bool bAutoFit, bool bHideContour,
++ bool bBlink, bool bScroll);
+ bool operator==(const SdrTextAttribute& rCandidate) const;
+
+ // data access
+@@ -86,6 +87,7 @@ namespace drawinglayer
+ bool isContour() const { return mbContour; }
+ bool isFontwork() const { return (XFT_NONE != meFormTextStyle); }
+ bool isFitToSize() const { return mbFitToSize; }
++ bool isAutoFit() const { return mbAutoFit; }
+ bool isHideContour() const { return mbHideContour; }
+ bool isBlink() const { return mbBlink; }
+ bool isScroll() const { return mbScroll; }
+diff --git svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
+index 78b9210..8432d40 100644
+--- svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
++++ svx/inc/svx/sdr/primitive2d/sdrtextprimitive2d.hxx
+@@ -251,6 +251,46 @@ namespace drawinglayer
+
+ //////////////////////////////////////////////////////////////////////////////
+
++namespace drawinglayer
++{
++ namespace primitive2d
++ {
++ class SdrAutoFitTextPrimitive2D : public SdrTextPrimitive2D
++ {
++ private:
++ ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range
++
++ // bitfield
++ unsigned mbWordWrap : 1; // for CustomShapes text layout
++
++ protected:
++ // local decomposition.
++ virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const;
++
++ public:
++ SdrAutoFitTextPrimitive2D(
++ const SdrText& rSdrText,
++ const ::basegfx::B2DHomMatrix& rTextRangeTransform,
++ bool bWordWrap);
++
++ // get data
++ const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; }
++ bool getWordWrap() const { return mbWordWrap; }
++
++ // compare operator
++ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
++
++ // transformed clone operator
++ virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const;
++
++ // provide unique ID
++ DeclPrimitrive2DIDBlock()
++ };
++ } // end of namespace primitive2d
++} // end of namespace drawinglayer
++
++//////////////////////////////////////////////////////////////////////////////
++
+ #endif //INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX
+
+ // eof
+diff --git svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
+index b0f0e62..5ce667c 100644
+--- svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
++++ svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
+@@ -52,6 +52,7 @@
+ #define PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 13)
+ #define PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 14)
+ #define PRIMITIVE2D_ID_SDRBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 15)
++#define PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 16)
+
+ //////////////////////////////////////////////////////////////////////////////
+
diff --git svx/inc/svx/sdtfsitm.hxx svx/inc/svx/sdtfsitm.hxx
index 97fb158..474cf75 100644
--- svx/inc/svx/sdtfsitm.hxx
@@ -113,10 +216,18 @@
//--------------------------------
// class SdrTextFitToSizeTypeItem
diff --git svx/inc/svx/svdotext.hxx svx/inc/svx/svdotext.hxx
-index ab9a41b..332ee89 100644
+index a1ce415..91a7fd9 100644
--- svx/inc/svx/svdotext.hxx
+++ svx/inc/svx/svdotext.hxx
-@@ -244,6 +244,9 @@ protected:
+@@ -62,6 +62,7 @@ namespace drawinglayer { namespace primitive2d {
+ class SdrContourTextPrimitive2D;
+ class SdrPathTextPrimitive2D;
+ class SdrBlockTextPrimitive2D;
++ class SdrAutoFitTextPrimitive2D;
+ class SdrStretchTextPrimitive2D;
+ }}
+
+@@ -259,6 +260,9 @@ protected:
// Flag for allowing text animation. Default is sal_true.
BOOL mbTextAnimationAllowed : 1;
@@ -126,24 +237,25 @@
SVX_DLLPRIVATE SdrOutliner& ImpGetDrawOutliner() const;
private:
-@@ -257,6 +260,7 @@ private:
+@@ -272,6 +276,8 @@ private:
Rectangle& rAnchorRect,
Rectangle& rPaintRect,
Fraction& aFitXKorreg ) const;
+ void ImpAutoFitText( SdrOutliner& rOutliner ) const;
++ static void ImpAutoFitText( SdrOutliner& rOutliner, const Size& rShapeSize, bool bIsVerticalWriting );
SVX_DLLPRIVATE SdrObject* ImpConvertObj(FASTBOOL bToPoly) const;
SVX_DLLPRIVATE void ImpLinkAnmeldung();
SVX_DLLPRIVATE void ImpLinkAbmeldung();
-@@ -268,7 +272,7 @@ protected:
+@@ -283,7 +289,7 @@ protected:
SdrObject* ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, sal_Bool bClosed, sal_Bool bBezier, sal_Bool bNoSetAttr = sal_False) const;
SdrObject* ImpConvertAddText(SdrObject* pObj, FASTBOOL bBezier) const;
void ImpSetTextStyleSheetListeners();
- void ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& rTextRect, const Rectangle& rAnchorRect, Fraction& rFitXKorreg) const;
+ void ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextSize, const Size& rShapeSize, Fraction& rFitXKorreg) const;
- void ImpAddTextToBoundRect();
void ImpJustifyRect(Rectangle& rRect) const;
void ImpCheckShear();
-@@ -331,6 +335,10 @@ public:
+ Rectangle ImpDragCalcRect(const SdrDragStat& rDrag) const;
+@@ -345,6 +351,10 @@ public:
void NbcResizeTextAttributes(const Fraction& xFact, const Fraction& yFact);
FASTBOOL IsTextFrame() const { return bTextFrame; }
FASTBOOL IsOutlText() const { return bTextFrame && (eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT); }
@@ -154,6 +266,39 @@
SdrObjKind GetTextKind() const { return eTextKind; }
virtual bool HasText() const;
+@@ -587,6 +597,10 @@ public:
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive,
+ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
++ bool impDecomposeAutoFitTextPrimitive(
++ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
++ const drawinglayer::primitive2d::SdrAutoFitTextPrimitive2D& rSdrAutofitTextPrimitive,
++ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
+ bool impDecomposeStretchTextPrimitive(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const drawinglayer::primitive2d::SdrStretchTextPrimitive2D& rSdrStretchTextPrimitive,
+diff --git svx/source/dialog/dbregisterednamesconfig.cxx svx/source/dialog/dbregisterednamesconfig.cxx
+index 0723af6..567baef 100644
+--- svx/source/dialog/dbregisterednamesconfig.cxx
++++ svx/source/dialog/dbregisterednamesconfig.cxx
+@@ -163,7 +163,7 @@ namespace svx
+ }
+ catch( const Exception& )
+ {
+- DBG_UNHANDLED_EXCEPTION();
++ //DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+@@ -184,7 +184,7 @@ namespace svx
+ }
+ catch( const Exception& )
+ {
+- DBG_UNHANDLED_EXCEPTION();
++ //DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
diff --git svx/source/dialog/textattr.cxx svx/source/dialog/textattr.cxx
index 563a367..aa64e10 100644
--- svx/source/dialog/textattr.cxx
@@ -199,10 +344,10 @@
/* cl removed because not needed anymore since binfilter
diff --git svx/source/editeng/impedit3.cxx svx/source/editeng/impedit3.cxx
-index 6b1ccc4..0ae30f5 100644
+index fb8eac9..9391ed5 100644
--- svx/source/editeng/impedit3.cxx
+++ svx/source/editeng/impedit3.cxx
-@@ -3978,20 +3978,25 @@ void ImpEditEngine::SetFlatMode( sal_Bool bFlat )
+@@ -4030,20 +4030,25 @@ void ImpEditEngine::SetFlatMode( sal_Bool bFlat )
void ImpEditEngine::SetCharStretching( sal_uInt16 nX, sal_uInt16 nY )
{
@@ -254,7 +399,7 @@
if ( ( pPortionInfo->GetRefDevPtr() == (sal_uIntPtr)GetRefDevice() ) ||
( ( pPortionInfo->GetRefDevType() == OUTDEV_VIRDEV ) &&
diff --git svx/source/outliner/outliner.cxx svx/source/outliner/outliner.cxx
-index c27272d..2cdd508 100644
+index 2e70966..ba9b16a 100644
--- svx/source/outliner/outliner.cxx
+++ svx/source/outliner/outliner.cxx
@@ -900,7 +900,10 @@ Font Outliner::ImpCalcBulletFont( USHORT nPara ) const
@@ -282,11 +427,151 @@
Paragraph* pPara = pParaList->GetParagraph( nPara );
const SvxNumberFormat* pFmt = GetNumberFormat( nPara );
+diff --git svx/source/sdr/attribute/sdrtextattribute.cxx svx/source/sdr/attribute/sdrtextattribute.cxx
+index 527059b..e605a53 100644
+--- svx/source/sdr/attribute/sdrtextattribute.cxx
++++ svx/source/sdr/attribute/sdrtextattribute.cxx
+@@ -50,6 +50,7 @@ namespace drawinglayer
+ sal_Int32 aTextLowerDistance,
+ bool bContour,
+ bool bFitToSize,
++ bool bAutoFit,
+ bool bHideContour,
+ bool bBlink,
+ bool bScroll)
+@@ -62,6 +63,7 @@ namespace drawinglayer
+ maTextLowerDistance(aTextLowerDistance),
+ mbContour(bContour),
+ mbFitToSize(bFitToSize),
++ mbAutoFit(bAutoFit),
+ mbHideContour(bHideContour),
+ mbBlink(bBlink),
+ mbScroll(bScroll)
+@@ -80,6 +82,7 @@ namespace drawinglayer
+ && getTextLowerDistance() == rCandidate.getTextLowerDistance()
+ && isContour() == rCandidate.isContour()
+ && isFitToSize() == rCandidate.isFitToSize()
++ && isAutoFit() == rCandidate.isAutoFit()
+ && isHideContour() == rCandidate.isHideContour()
+ && isBlink() == rCandidate.isBlink()
+ && isScroll() == rCandidate.isScroll());
+diff --git svx/source/sdr/primitive2d/sdrattributecreator.cxx svx/source/sdr/primitive2d/sdrattributecreator.cxx
+index b76d204..42f6900 100644
+--- svx/source/sdr/primitive2d/sdrattributecreator.cxx
++++ svx/source/sdr/primitive2d/sdrattributecreator.cxx
+@@ -493,7 +493,6 @@ namespace drawinglayer
+
+ if(!bInEditMode)
+ {
+- const SdrFitToSizeType eFit = rTextObj.GetFitToSize();
+ const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind());
+
+ pRetval = new attribute::SdrTextAttribute(
+@@ -504,7 +503,8 @@ namespace drawinglayer
+ rTextObj.GetTextRightDistance(),
+ rTextObj.GetTextLowerDistance(),
+ ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(),
+- (SDRTEXTFIT_PROPORTIONAL == eFit || SDRTEXTFIT_ALLLINES == eFit),
++ rTextObj.IsFitToSize(),
++ rTextObj.IsAutoFit(),
+ ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(),
+ SDRTEXTANI_BLINK == eAniKind,
+ SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind);
+@@ -525,7 +525,7 @@ namespace drawinglayer
+ const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
+ const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
+ const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
+- const bool bCompletelyTransparent(0xff == nStartLuminance == nEndLuminance);
++ const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
+
+ if(!bCompletelyTransparent)
+ {
+diff --git svx/source/sdr/primitive2d/sdrdecompositiontools.cxx svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+index 62461df..6b05729 100644
+--- svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
++++ svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+@@ -267,6 +267,11 @@ namespace drawinglayer
+ // streched text in range
+ pNew = new SdrStretchTextPrimitive2D(rText.getSdrText(), aAnchorTransform);
+ }
++ else if(rText.isAutoFit())
++ {
++ // isotrophically scaled text in range
++ pNew = new SdrAutoFitTextPrimitive2D(rText.getSdrText(), aAnchorTransform, bWordWrap);
++ }
+ else // text in range
+ {
+ // build new primitive
+diff --git svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+index 6d406fd..470bfe9 100644
+--- svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
++++ svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx
+@@ -304,6 +304,60 @@ namespace drawinglayer
+ {
+ namespace primitive2d
+ {
++ Primitive2DSequence SdrAutoFitTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const
++ {
++ Primitive2DSequence aRetval;
++ const bool bCurrentSpellCheck(getSdrText().GetObject().impDecomposeAutoFitTextPrimitive(aRetval, *this, aViewInformation));
++
++ if(getLastSpellCheck() != bCurrentSpellCheck)
++ {
++ // remember last spell check state; this is part of the decomposition source data definition
++ const_cast< SdrAutoFitTextPrimitive2D* >(this)->setLastSpellCheck(bCurrentSpellCheck);
++ }
++
++ return encapsulateWithTextHierarchyBlockPrimitive2D(aRetval);
++ }
++
++ SdrAutoFitTextPrimitive2D::SdrAutoFitTextPrimitive2D(
++ const SdrText& rSdrText,
++ const ::basegfx::B2DHomMatrix& rTextRangeTransform,
++ bool bWordWrap)
++ : SdrTextPrimitive2D(rSdrText),
++ maTextRangeTransform(rTextRangeTransform),
++ mbWordWrap(bWordWrap)
++ {
++ }
++
++ bool SdrAutoFitTextPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
++ {
++ if(SdrTextPrimitive2D::operator==(rPrimitive))
++ {
++ const SdrBlockTextPrimitive2D& rCompare = (SdrBlockTextPrimitive2D&)rPrimitive;
++
++ return (getTextRangeTransform() == rCompare.getTextRangeTransform()
++ && getWordWrap() == rCompare.getWordWrap());
++ }
++
++ return false;
++ }
++
++ SdrTextPrimitive2D* SdrAutoFitTextPrimitive2D::createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const
++ {
++ return new SdrAutoFitTextPrimitive2D(getSdrText(), rTransform * getTextRangeTransform(), getWordWrap());
++ }
++
++ // provide unique ID
++ ImplPrimitrive2DIDBlock(SdrAutoFitTextPrimitive2D, PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D)
++
++ } // end of namespace primitive2d
++} // end of namespace drawinglayer
++
++//////////////////////////////////////////////////////////////////////////////
++
++namespace drawinglayer
++{
++ namespace primitive2d
++ {
+ Primitive2DSequence SdrStretchTextPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& aViewInformation) const
+ {
+ Primitive2DSequence aRetval;
diff --git svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdedxv.cxx
-index f6a67ac..1a20173 100644
+index 08e9524..b0219cb 100644
--- svx/source/svdraw/svdedxv.cxx
+++ svx/source/svdraw/svdedxv.cxx
-@@ -318,7 +318,7 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectang
+@@ -315,7 +315,7 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectang
{
const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
bool bTextFrame(pText && pText->IsTextFrame());
@@ -295,7 +580,7 @@
bool bModifyMerk(pTextEditOutliner->IsModified()); // #43095#
Rectangle aBlankRect(rOutlView.GetOutputArea());
aBlankRect.Union(aMinTextEditArea);
-@@ -387,7 +387,7 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView& rOutlView) const
+@@ -384,7 +384,7 @@ void SdrObjEditView::ImpInvalidateOutlinerView(OutlinerView& rOutlView) const
{
const SdrTextObj* pText = PTR_CAST(SdrTextObj,GetTextEditObject());
bool bTextFrame(pText && pText->IsTextFrame());
@@ -304,11 +589,31 @@
if(bTextFrame && !bFitToSize)
{
+@@ -692,8 +692,7 @@ sal_Bool SdrObjEditView::SdrBeginTextEdit(
+ if ( !pTextObj->IsContourTextFrame() )
+ {
+ // FitToSize erstmal nicht mit ContourFrame
+- SdrFitToSizeType eFit = pTextObj->GetFitToSize();
+- if (eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES)
++ if (pTextObj->IsFitToSize())
+ aTextRect = aAnchorRect;
+ }
+
+@@ -761,8 +760,7 @@ sal_Bool SdrObjEditView::SdrBeginTextEdit(
+ // #71519#
+ if(!bExtraInvalidate)
+ {
+- SdrFitToSizeType eFit = pTextObj->GetFitToSize();
+- if(eFit == SDRTEXTFIT_PROPORTIONAL || eFit == SDRTEXTFIT_ALLLINES)
++ if(pTextObj->IsFitToSize())
+ bExtraInvalidate = sal_True;
+ }
+
diff --git svx/source/svdraw/svdfppt.cxx svx/source/svdraw/svdfppt.cxx
-index 42d0b1b..f216075 100644
+index ac53ab7..4aaba2e 100644
--- svx/source/svdraw/svdfppt.cxx
+++ svx/source/svdraw/svdfppt.cxx
-@@ -1119,6 +1119,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
+@@ -1113,6 +1113,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
}
aTextObj.SetDestinationInstance( (sal_uInt16)nDestinationInstance );
@@ -316,7 +621,7 @@
switch ( aTextObj.GetInstance() )
{
case TSS_TYPE_PAGETITLE :
-@@ -1126,7 +1127,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
+@@ -1120,7 +1121,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
case TSS_TYPE_SUBTITLE : eTextKind = OBJ_TEXT; break;
case TSS_TYPE_BODY :
case TSS_TYPE_HALFBODY :
@@ -325,7 +630,7 @@
}
if ( aTextObj.GetDestinationInstance() != TSS_TYPE_TEXT_IN_SHAPE )
{
-@@ -1181,6 +1182,15 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
+@@ -1175,6 +1176,15 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
}
pTObj->SetMergedItem( SvxFrameDirectionItem( bVerticalText ? FRMDIR_VERT_TOP_RIGHT : FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
@@ -342,10 +647,10 @@
{
pTObj->SetMergedItem( SdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
diff --git svx/source/svdraw/svdotext.cxx svx/source/svdraw/svdotext.cxx
-index e457f0c..396e1cb 100644
+index f52ab08..90ae9c4 100644
--- svx/source/svdraw/svdotext.cxx
+++ svx/source/svdraw/svdotext.cxx
-@@ -140,6 +140,7 @@ SdrTextObj::SdrTextObj()
+@@ -145,6 +145,7 @@ SdrTextObj::SdrTextObj()
// #i25616#
mbSupportTextIndentingOnLineWidthChange = sal_True;
@@ -353,7 +658,7 @@
}
SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
-@@ -165,6 +166,7 @@ SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
+@@ -170,6 +171,7 @@ SdrTextObj::SdrTextObj(const Rectangle& rNewRect)
// #111096#
mbTextAnimationAllowed = sal_True;
@@ -361,7 +666,7 @@
// #108784#
maTextEditOffset = Point(0, 0);
-@@ -195,6 +197,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind)
+@@ -200,6 +202,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind)
// #111096#
mbTextAnimationAllowed = sal_True;
@@ -369,7 +674,7 @@
// #108784#
maTextEditOffset = Point(0, 0);
-@@ -227,6 +230,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect)
+@@ -232,6 +235,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect)
// #111096#
mbTextAnimationAllowed = sal_True;
@@ -377,7 +682,7 @@
// #108784#
maTextEditOffset = Point(0, 0);
-@@ -261,6 +265,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStr
+@@ -266,6 +270,7 @@ SdrTextObj::SdrTextObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStr
// #111096#
mbTextAnimationAllowed = sal_True;
@@ -385,7 +690,7 @@
// #108784#
maTextEditOffset = Point(0, 0);
-@@ -829,8 +834,7 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FAS
+@@ -842,8 +847,7 @@ void SdrTextObj::TakeTextRect( SdrOutliner& rOutliner, Rectangle& rTextRect, FAS
SdrTextAniKind eAniKind=GetTextAniKind();
SdrTextAniDirection eAniDirection=GetTextAniDirection();
@@ -395,7 +700,7 @@
FASTBOOL bContourFrame=IsContourTextFrame();
FASTBOOL bFrame=IsTextFrame();
-@@ -988,7 +992,7 @@ OutlinerParaObject* SdrTextObj::GetEditOutlinerParaObject() const
+@@ -1001,7 +1005,7 @@ OutlinerParaObject* SdrTextObj::GetEditOutlinerParaObject() const
return pPara;
}
@@ -404,7 +709,7 @@
{
OutputDevice* pOut = rOutliner.GetRefDevice();
BOOL bNoStretching(FALSE);
-@@ -1033,12 +1037,12 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& r
+@@ -1046,12 +1050,12 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Rectangle& r
unsigned nLoopCount=0;
FASTBOOL bNoMoreLoop=FALSE;
long nXDiff0=0x7FFFFFFF;
@@ -421,17 +726,7 @@
if (nIsHgt==0) nIsHgt=1;
long nXTolPl=nWantWdt/100; // Toleranz +1%
-@@ -1401,8 +1405,7 @@ void SdrTextObj::ImpAddTextToBoundRect()
- Rectangle aTextRect;
- Rectangle aAnchorRect;
- TakeTextRect(rOutliner,aTextRect,TRUE,&aAnchorRect); // EditText ignorieren!
-- SdrFitToSizeType eFit=GetFitToSize();
-- FASTBOOL bFitToSize=(eFit==SDRTEXTFIT_PROPORTIONAL || eFit==SDRTEXTFIT_ALLLINES);
-+ FASTBOOL bFitToSize(IsFitToSize());
- if (bFitToSize) aTextRect=aAnchorRect;
- rOutliner.Clear();
- if (aGeo.nDrehWink!=0) {
-@@ -1431,8 +1434,7 @@ SdrObject* SdrTextObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte*
+@@ -1140,8 +1144,7 @@ SdrObject* SdrTextObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte*
INT32 nMyTol=nTol;
FASTBOOL bFontwork=IsFontwork();
@@ -441,7 +736,7 @@
Rectangle aR(aRect);
Rectangle aAnchor2(aR);
Rectangle aTextRect(aR);
-@@ -1665,8 +1667,7 @@ basegfx::B2DPolyPolygon SdrTextObj::TakeContour() const
+@@ -1374,8 +1377,7 @@ basegfx::B2DPolyPolygon SdrTextObj::TakeContour() const
Rectangle aR;
TakeTextRect(rOutliner,aR,FALSE,&aAnchor2);
rOutliner.Clear();
@@ -451,7 +746,7 @@
if (bFitToSize) aR=aAnchor2;
Polygon aPol(aR);
if (aGeo.nDrehWink!=0) RotatePoly(aPol,aR.TopLeft(),aGeo.nSin,aGeo.nCos);
-@@ -1783,8 +1784,7 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( FASTBOOL bContourFrame,
+@@ -1492,8 +1494,7 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( FASTBOOL bContourFrame,
if (!bContourFrame)
{
// FitToSize erstmal nicht mit ContourFrame
@@ -461,7 +756,7 @@
{
ULONG nStat=rOutliner.GetControlWord();
nStat|=EE_CNTRL_STRETCHING|EE_CNTRL_AUTOPAGESIZE;
-@@ -1798,13 +1798,54 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( FASTBOOL bContourFrame,
+@@ -1507,13 +1508,60 @@ void SdrTextObj::ImpSetupDrawOutlinerForPaint( FASTBOOL bContourFrame,
if (!bContourFrame)
{
// FitToSize erstmal nicht mit ContourFrame
@@ -482,20 +777,26 @@
+
+void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner ) const
+{
++ const Size aShapeSize=GetSnapRect().GetSize();
++ ImpAutoFitText( rOutliner,
++ Size(aShapeSize.Width()-GetTextLeftDistance()-GetTextRightDistance(),
++ aShapeSize.Height()-GetTextUpperDistance()-GetTextLowerDistance()),
++ IsVerticalWriting() );
++}
++
++void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner, const Size& rTextSize, bool bIsVerticalWriting )
++{
+ // EditEngine formatting is unstable enough for
+ // line-breaking text that we need some more samples
+ USHORT nMinStretchX=65535, nMinStretchY=65535;
-+ const Size aShapeSize = GetLastBoundRect().GetSize();
+ for(int i=0; i<3; ++i)
+ {
+ const Size aCurrTextSize = rOutliner.CalcTextSize();
+ double fFactor(1.0);
-+ if( IsVerticalWriting() )
-+ fFactor = double(aShapeSize.Width())/
-+ (aCurrTextSize.Width()+GetTextLeftDistance()+GetTextRightDistance());
++ if( bIsVerticalWriting )
++ fFactor = double(rTextSize.Width())/aCurrTextSize.Width();
+ else
-+ fFactor = double(aShapeSize.Height())/
-+ (aCurrTextSize.Height()+GetTextUpperDistance()+GetTextLowerDistance());
++ fFactor = double(rTextSize.Height())/aCurrTextSize.Height();
+
+ USHORT nCurrStretchX, nCurrStretchY;
+ rOutliner.GetGlobalCharStretching(nCurrStretchX, nCurrStretchY);
@@ -519,7 +820,7 @@
}
void SdrTextObj::SetupOutlinerFormatting( SdrOutliner& rOutl, Rectangle& rPaintRect ) const
-@@ -2394,6 +2435,17 @@ sal_Bool SdrTextObj::IsTextAnimationAllowed() const
+@@ -2107,6 +2155,17 @@ bool SdrTextObj::IsTextAnimationAllowed() const
return mbTextAnimationAllowed;
}
@@ -537,7 +838,7 @@
void SdrTextObj::SetTextAnimationAllowed(sal_Bool bNew)
{
if(mbTextAnimationAllowed != bNew)
-@@ -2411,13 +2463,21 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
+@@ -2124,13 +2183,21 @@ void SdrTextObj::onEditOutlinerStatusEvent( EditStatus* pEditStatus )
const bool bGrowY=(nStat & EE_STAT_TEXTHEIGHTCHANGED) !=0;
if(bTextFrame && (bGrowX || bGrowY))
{
@@ -563,6 +864,164 @@
}
}
+diff --git svx/source/svdraw/svdotextdecomposition.cxx svx/source/svdraw/svdotextdecomposition.cxx
+index 554070d..fac3231 100644
+--- svx/source/svdraw/svdotextdecomposition.cxx
++++ svx/source/svdraw/svdotextdecomposition.cxx
+@@ -871,11 +871,11 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive(
+ basegfx::B2DHomMatrix aNewTransformA;
+ basegfx::B2DHomMatrix aNewTransformB;
+
+- // calculate global char stretching scale parameters. Use non-mirrored sizes
+- // to layout without mirroring
+- const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX());
+- const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY());
+- rOutliner.SetGlobalCharStretching((sal_Int16)FRound(fScaleX * 100.0), (sal_Int16)FRound(fScaleY * 100.0));
++ // calculate global char stretching scale parameters. Use non-mirrored sizes
++ // to layout without mirroring. Scale anisotrophically
++ const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX());
++ const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY());
++ rOutliner.SetGlobalCharStretching((sal_Int16)FRound(fScaleX * 100.0), (sal_Int16)FRound(fScaleY * 100.0));
+
+ // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
+ // move the null point which was top left to bottom right.
+@@ -902,6 +902,136 @@ bool SdrTextObj::impDecomposeStretchTextPrimitive(
+ return (rOutliner.GetControlWord() & EE_CNTRL_NOREDLINES);
+ }
+
++bool SdrTextObj::impDecomposeAutoFitTextPrimitive(
++ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
++ const drawinglayer::primitive2d::SdrAutoFitTextPrimitive2D& rSdrAutofitTextPrimitive,
++ const drawinglayer::geometry::ViewInformation2D& aViewInformation) const
++{
++ // decompose matrix to have position and size of text
++ basegfx::B2DVector aScale, aTranslate;
++ double fRotate, fShearX;
++ rSdrAutofitTextPrimitive.getTextRangeTransform().decompose(aScale, aTranslate, fRotate, fShearX);
++
++ // use B2DRange aAnchorTextRange for calculations
++ basegfx::B2DRange aAnchorTextRange(aTranslate);
++ aAnchorTextRange.expand(aTranslate + aScale);
++
++ // prepare outliner
++ const SfxItemSet& rTextItemSet = rSdrAutofitTextPrimitive.getSdrText().GetItemSet();
++ SdrOutliner& rOutliner = ImpGetDrawOutliner();
++ SdrTextVertAdjust eVAdj = GetTextVerticalAdjust(rTextItemSet);
++ SdrTextHorzAdjust eHAdj = GetTextHorizontalAdjust(rTextItemSet);
++ const sal_uInt32 nOriginalControlWord(rOutliner.GetControlWord());
++ const Size aNullSize;
++
++ // set visualizing page at Outliner; needed e.g. for PageNumberField decomposition
++ rOutliner.setVisualizedPage(GetSdrPageFromXDrawPage(aViewInformation.getVisualizedPage()));
++
++ rOutliner.SetControlWord(nOriginalControlWord|EE_CNTRL_AUTOPAGESIZE|EE_CNTRL_STRETCHING);
++ rOutliner.SetMinAutoPaperSize(aNullSize);
++ rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000));
++
++ // add one to rage sizes to get back to the old Rectangle and outliner measurements
++ const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1L));
++ const sal_uInt32 nAnchorTextHeight(FRound(aAnchorTextRange.getHeight() + 1L));
++ const OutlinerParaObject* pOutlinerParaObject = rSdrAutofitTextPrimitive.getSdrText().GetOutlinerParaObject();
++ OSL_ENSURE(pOutlinerParaObject, "impDecomposeBlockTextPrimitive used with no OutlinerParaObject (!)");
++ const bool bVerticalWritintg(pOutlinerParaObject->IsVertical());
++ const Size aAnchorTextSize(Size(nAnchorTextWidth, nAnchorTextHeight));
++
++ if((rSdrAutofitTextPrimitive.getWordWrap() || IsTextFrame()))
++ {
++ rOutliner.SetMaxAutoPaperSize(aAnchorTextSize);
++ }
++
++ if(SDRTEXTHORZADJUST_BLOCK == eHAdj && !bVerticalWritintg)
++ {
++ rOutliner.SetMinAutoPaperSize(Size(nAnchorTextWidth, 0));
++ }
++
++ if(SDRTEXTVERTADJUST_BLOCK == eVAdj && bVerticalWritintg)
++ {
++ rOutliner.SetMinAutoPaperSize(Size(0, nAnchorTextHeight));
++ }
++
++ rOutliner.SetPaperSize(aNullSize);
++ rOutliner.SetUpdateMode(true);
++ rOutliner.SetText(*pOutlinerParaObject);
++ ImpAutoFitText(rOutliner,aAnchorTextSize,bVerticalWritintg);
++
++ // now get back the layouted text size from outliner
++ const Size aOutlinerTextSiz(rOutliner.GetPaperSize());
++ const basegfx::B2DVector aOutlinerScale(aOutlinerTextSiz.Width(), aOutlinerTextSiz.Height());
++ basegfx::B2DVector aAdjustTranslate(0.0, 0.0);
++
++ // correct horizontal translation using the now known text size
++ if(SDRTEXTHORZADJUST_CENTER == eHAdj || SDRTEXTHORZADJUST_RIGHT == eHAdj)
++ {
++ const double fFree(aAnchorTextRange.getWidth() - aOutlinerScale.getX());
++
++ if(SDRTEXTHORZADJUST_CENTER == eHAdj)
++ {
++ aAdjustTranslate.setX(fFree / 2.0);
++ }
++
++ if(SDRTEXTHORZADJUST_RIGHT == eHAdj)
++ {
++ aAdjustTranslate.setX(fFree);
++ }
++ }
++
++ // correct vertical translation using the now known text size
++ if(SDRTEXTVERTADJUST_CENTER == eVAdj || SDRTEXTVERTADJUST_BOTTOM == eVAdj)
++ {
++ const double fFree(aAnchorTextRange.getHeight() - aOutlinerScale.getY());
++
++ if(SDRTEXTVERTADJUST_CENTER == eVAdj)
++ {
++ aAdjustTranslate.setY(fFree / 2.0);
++ }
++
++ if(SDRTEXTVERTADJUST_BOTTOM == eVAdj)
++ {
++ aAdjustTranslate.setY(fFree);
++ }
++ }
++
++ // prepare matrices to apply to newly created primitives. aNewTransformA
++ // will get coordinates in aOutlinerScale size and positive in X, Y.
++ basegfx::B2DHomMatrix aNewTransformA;
++ basegfx::B2DHomMatrix aNewTransformB;
++
++ // translate relative to given primitive to get same rotation and shear
++ // as the master shape we are working on. For vertical, use the top-right
++ // corner
++ const double fStartInX(bVerticalWritintg ? aAdjustTranslate.getX() + aOutlinerScale.getX() : aAdjustTranslate.getX());
++ aNewTransformA.translate(fStartInX, aAdjustTranslate.getY());
++
++ // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y,
++ // move the null point which was top left to bottom right.
++ const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
++ const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
++ aNewTransformB.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0);
++
++ // in-between the translations of the single primitives will take place. Afterwards,
++ // the object's transformations need to be applied
++ aNewTransformB.shearX(fShearX);
++ aNewTransformB.rotate(fRotate);
++ aNewTransformB.translate(aTranslate.getX(), aTranslate.getY());
++
++ // now break up text primitives.
++ impTextBreakupHandler aConverter(rOutliner);
++ aConverter.decomposeBlockTextPrimitive(aNewTransformA, aNewTransformB);
++
++ // cleanup outliner
++ rOutliner.Clear();
++ rOutliner.setVisualizedPage(0);
++ rOutliner.SetControlWord(nOriginalControlWord);
++
++ rTarget = aConverter.getPrimitive2DSequence();
++ return (rOutliner.GetControlWord() & EE_CNTRL_NOREDLINES);
++}
++
+ //////////////////////////////////////////////////////////////////////////////
+ // timing generators
+ #define ENDLESS_LOOP (0xffffffff)
diff --git svx/source/svdraw/svdotxat.cxx svx/source/svdraw/svdotxat.cxx
index 67b6cc2..f3e4564 100644
--- svx/source/svdraw/svdotxat.cxx
@@ -578,7 +1037,7 @@
FASTBOOL bHgtGrow=bHgt && IsAutoGrowHeight();
SdrTextAniKind eAniKind=GetTextAniKind();
diff --git svx/source/svdraw/svdotxed.cxx svx/source/svdraw/svdotxed.cxx
-index 7400015..0307a92 100644
+index 94c8a20..741b793 100644
--- svx/source/svdraw/svdotxed.cxx
+++ svx/source/svdraw/svdotxed.cxx
@@ -75,15 +75,17 @@ sal_Bool SdrTextObj::BegTextEdit(SdrOutliner& rOutl)
@@ -627,10 +1086,10 @@
Rectangle aViewInit;
TakeTextAnchorRect(aViewInit);
diff --git svx/source/svdraw/svdotxtr.cxx svx/source/svdraw/svdotxtr.cxx
-index 6ecb8e0..621111b 100644
+index a1a82f6..08f73bf 100644
--- svx/source/svdraw/svdotxtr.cxx
+++ svx/source/svdraw/svdotxtr.cxx
-@@ -85,9 +85,6 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
+@@ -81,9 +81,6 @@ void SdrTextObj::NbcSetSnapRect(const Rectangle& rRect)
if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
@@ -640,7 +1099,7 @@
NbcAdjustTextFrameWidthAndHeight();
}
ImpCheckShear();
-@@ -113,9 +110,6 @@ void SdrTextObj::NbcSetLogicRect(const Rectangle& rRect)
+@@ -109,9 +106,6 @@ void SdrTextObj::NbcSetLogicRect(const Rectangle& rRect)
if (bTextFrame) {
if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
@@ -650,7 +1109,7 @@
NbcAdjustTextFrameWidthAndHeight();
}
SetRectsDirty();
-@@ -229,9 +223,6 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
+@@ -225,9 +219,6 @@ void SdrTextObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract
if (bTextFrame && (pModel==NULL || !pModel->IsPasteResize())) { // #51139#
if (nTWdt0!=nTWdt1 && IsAutoGrowWidth() ) NbcSetMinTextFrameWidth(nTWdt1);
if (nTHgt0!=nTHgt1 && IsAutoGrowHeight()) NbcSetMinTextFrameHeight(nTHgt1);
@@ -661,10 +1120,10 @@
}
ImpCheckShear();
diff --git svx/source/svdraw/svdtxhdl.cxx svx/source/svdraw/svdtxhdl.cxx
-index b06de31..ff0e8f8 100644
+index d1a4401..7450c5a 100644
--- svx/source/svdraw/svdtxhdl.cxx
+++ svx/source/svdraw/svdtxhdl.cxx
-@@ -90,8 +90,7 @@ void ImpTextPortionHandler::ConvertToPathObj(SdrObjGroup& rGroup, FASTBOOL bPoly
+@@ -84,8 +84,7 @@ void ImpTextPortionHandler::ConvertToPathObj(SdrObjGroup& rGroup, FASTBOOL bPoly
Rectangle aAnchorRect;
Rectangle aTextRect;
@@ -675,7 +1134,7 @@
// den Outliner gesteckt
rTextObj.TakeTextRect(rOutliner,aTextRect,FALSE,&aAnchorRect);
diff --git svx/source/svdraw/svdview.cxx svx/source/svdraw/svdview.cxx
-index 2e14bc7..453ddc4 100644
+index 9c42be1..1c281c8 100644
--- svx/source/svdraw/svdview.cxx
+++ svx/source/svdraw/svdview.cxx
@@ -504,8 +504,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]