User: rt      
Date: 2008-01-29 13:44:36+0000
Modified:
   dba/reportdesign/source/core/inc/Tools.hxx

Log:
 INTEGRATION: CWS reportdesign02 (1.2.44); FILE MERGED
 2007/10/30 06:56:28 oj 1.2.44.1: #i78939# change pos and size when control is 
outside page

File Changes:

Directory: /dba/reportdesign/source/core/inc/
=============================================

File [changed]: Tools.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/source/core/inc/Tools.hxx?r1=1.2&r2=1.3
Delta lines:  +26 -5
--------------------
--- Tools.hxx   2007-07-09 11:56:15+0000        1.2
+++ Tools.hxx   2008-01-29 13:44:34+0000        1.3
@@ -106,9 +106,16 @@
     public:
         template<typename T> static void setSize(const 
::com::sun::star::awt::Size& aSize,T* _pShape)
         {
+            OSL_ENSURE(aSize.Width > 0 && aSize.Height > 0,"Illegal with or 
height!");
+
             ::osl::MutexGuard aGuard(_pShape->m_aMutex);
             if ( _pShape->m_aProps.aComponent.m_xShape.is() )
+            {
+                ::com::sun::star::awt::Size aOldSize = 
_pShape->m_aProps.aComponent.m_xShape->getSize();
+                _pShape->m_aProps.aComponent.m_nWidth = aOldSize.Width;
+                _pShape->m_aProps.aComponent.m_nHeight = aOldSize.Height;
                 _pShape->m_aProps.aComponent.m_xShape->setSize(aSize);
+            }
             
_pShape->set(PROPERTY_WIDTH,aSize.Width,_pShape->m_aProps.aComponent.m_nWidth);
             
_pShape->set(PROPERTY_HEIGHT,aSize.Height,_pShape->m_aProps.aComponent.m_nHeight);
         }
@@ -116,15 +123,25 @@
         {
                ::osl::MutexGuard aGuard(_pShape->m_aMutex);
             if ( _pShape->m_aProps.aComponent.m_xShape.is() )
-                return _pShape->m_aProps.aComponent.m_xShape->getSize();
+            {
+                ::com::sun::star::awt::Size aSize = 
_pShape->m_aProps.aComponent.m_xShape->getSize();
+                OSL_ENSURE(aSize.Width > 0 && aSize.Height > 0,"Illegal with 
or height!");
+                return aSize;
+            }
                return 
::com::sun::star::awt::Size(_pShape->m_aProps.aComponent.m_nWidth,_pShape->m_aProps.aComponent.m_nHeight);
         }
 
         template<typename T> static void setPosition( const 
::com::sun::star::awt::Point& aPosition ,T* _pShape)
         {
+            OSL_ENSURE(aPosition.X >= 0 && aPosition.Y >= 0,"Illegal 
position!");
             ::osl::MutexGuard aGuard(_pShape->m_aMutex);
             if ( _pShape->m_aProps.aComponent.m_xShape.is() )
+            {
+                ::com::sun::star::awt::Point aOldPos = 
_pShape->m_aProps.aComponent.m_xShape->getPosition();
+                _pShape->m_aProps.aComponent.m_nPosX = aOldPos.X;
+                _pShape->m_aProps.aComponent.m_nPosY = aOldPos.Y;
                 _pShape->m_aProps.aComponent.m_xShape->setPosition(aPosition);
+            }
             
_pShape->set(PROPERTY_POSITIONX,aPosition.X,_pShape->m_aProps.aComponent.m_nPosX);
             
_pShape->set(PROPERTY_POSITIONY,aPosition.Y,_pShape->m_aProps.aComponent.m_nPosY);
         }
@@ -132,7 +149,11 @@
         {
             ::osl::MutexGuard aGuard(_pShape->m_aMutex);
             if ( _pShape->m_aProps.aComponent.m_xShape.is() )
-                return _pShape->m_aProps.aComponent.m_xShape->getPosition();
+            {
+                ::com::sun::star::awt::Point aPosition = 
_pShape->m_aProps.aComponent.m_xShape->getPosition();
+                OSL_ENSURE(aPosition.X >= 0 && aPosition.Y >= 0,"Illegal 
position!");
+                return aPosition;
+            }
                return 
::com::sun::star::awt::Point(_pShape->m_aProps.aComponent.m_nPosX,_pShape->m_aProps.aComponent.m_nPosY);
         }
         template<typename T> static void setParent( const 
com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& Parent, T* 
_pShape)




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to