update dev300-m57
[ooovba.git] / applied_patches / 0373-vba-fix-control-shape-geom-fix.diff
blob038dbdd12063af3b621500ae236459aaf583072a
1 diff --git sc/source/ui/vba/vbashape.cxx sc/source/ui/vba/vbashape.cxx
2 index a8d9e82..eb31a64 100644
3 --- sc/source/ui/vba/vbashape.cxx
4 +++ sc/source/ui/vba/vbashape.cxx
5 @@ -53,6 +53,7 @@ using namespace ::vos;
6 ScVbaShape::ScVbaShape( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape, const uno::Reference< drawing::XShapes >& xShapes, sal_Int32 nType ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( xParent, xContext ), m_xShape( xShape ), m_xShapes( xShapes ), m_nType( nType )
8 m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW );
9 + m_pShapeHelper.reset( new ShapeHelper( m_xShape ) );
10 addListeners();
13 @@ -179,59 +180,49 @@ ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
14 double SAL_CALL
15 ScVbaShape::getHeight() throw (uno::RuntimeException)
17 - return Millimeter::getInPoints( m_xShape->getSize().Height );
18 + return m_pShapeHelper->getHeight();
21 void SAL_CALL
22 ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException)
24 - awt::Size aSize( m_xShape->getSize() );
25 - aSize.Height = Millimeter::getInHundredthsOfOneMillimeter( _height );
26 - m_xShape->setSize( aSize );
27 + m_pShapeHelper->setHeight( _height );
30 double SAL_CALL
31 ScVbaShape::getWidth() throw (uno::RuntimeException)
33 - return Millimeter::getInPoints( m_xShape->getSize().Width );
34 + return m_pShapeHelper->getWidth();
37 void SAL_CALL
38 ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
40 - awt::Size aSize( m_xShape->getSize() );
41 - aSize.Width = Millimeter::getInHundredthsOfOneMillimeter( _width );
42 - m_xShape->setSize( aSize );
43 + m_pShapeHelper->setWidth( _width );
46 double SAL_CALL
47 ScVbaShape::getLeft() throw (uno::RuntimeException)
49 - return Millimeter::getInPoints( m_xShape->getPosition().X );
50 + return m_pShapeHelper->getLeft();
53 void SAL_CALL
54 ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
56 - awt::Point oldPosition;
57 - oldPosition = m_xShape->getPosition();
58 - oldPosition.X = Millimeter::getInHundredthsOfOneMillimeter( _left );
59 - m_xShape->setPosition( oldPosition );
60 + m_pShapeHelper->setLeft( _left );
63 double SAL_CALL
64 ScVbaShape::getTop() throw (uno::RuntimeException)
66 - return Millimeter::getInPoints( m_xShape->getPosition().Y );
67 + return m_pShapeHelper->getTop();
70 void SAL_CALL
71 ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
73 - awt::Point oldPosition;
74 - oldPosition = m_xShape->getPosition();
75 - oldPosition.Y = Millimeter::getInHundredthsOfOneMillimeter( _top );
76 - m_xShape->setPosition( oldPosition );
77 + return m_pShapeHelper->setTop( _top );
80 sal_Bool SAL_CALL
81 diff --git sc/source/ui/vba/vbashape.hxx sc/source/ui/vba/vbashape.hxx
82 index d896a3d..eb48b93 100644
83 --- sc/source/ui/vba/vbashape.hxx
84 +++ sc/source/ui/vba/vbashape.hxx
85 @@ -47,9 +47,9 @@ typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE;
87 class ScVbaShape : public ScVbaShape_BASE
89 -friend class ConcreteXShapeHelper; // perhaps an accessor would be better
90 private:
91 protected:
92 + std::auto_ptr< ov::ShapeHelper > m_pShapeHelper;
93 css::uno::Reference< css::drawing::XShape > m_xShape;
94 css::uno::Reference< css::drawing::XShapes > m_xShapes;
95 css::uno::Reference< css::beans::XPropertySet > m_xPropertySet;
96 diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx
97 index cfc8ee0..5749839 100644
98 --- vbahelper/inc/vbahelper/vbahelper.hxx
99 +++ vbahelper/inc/vbahelper/vbahelper.hxx
100 @@ -46,6 +46,7 @@
101 #include <vcl/pointr.hxx>
102 #define VBAHELPER_DLLIMPLEMENTATION
103 #include <vbahelper/vbadllapi.h>
104 +#include <memory>
105 namespace css = ::com::sun::star;
107 namespace ooo
108 @@ -132,10 +133,34 @@ namespace msforms {
109 class XShape;
112 +class VBAHELPER_DLLPUBLIC ShapeHelper
114 +protected:
115 + css::uno::Reference< css::drawing::XShape > xShape;
116 +public:
117 + ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException );
119 + double getHeight();
121 + void setHeight(double _fheight) throw ( css::script::BasicErrorException );
123 + double getWidth();
125 + void setWidth(double _fWidth) throw ( css::script::BasicErrorException );
127 + double getLeft();
129 + void setLeft(double _fLeft);
131 + double getTop();
133 + void setTop(double _fTop);
136 class VBAHELPER_DLLPUBLIC ConcreteXShapeGeometryAttributes : public AbstractGeometryAttributes
138 + std::auto_ptr< ShapeHelper > m_pShapeHelper;
139 public:
140 - css::uno::Reference< ooo::vba::msforms::XShape > m_xShape;
141 ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape );
142 virtual double getLeft();
143 virtual void setLeft( double nLeft );
144 @@ -164,30 +189,6 @@ public:
145 virtual void setWidth( double nWidth);
148 -class VBAHELPER_DLLPUBLIC ShapeHelper
150 -protected:
151 - css::uno::Reference< css::drawing::XShape > xShape;
152 -public:
153 - ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException );
155 - double getHeight();
157 - void setHeight(double _fheight) throw ( css::script::BasicErrorException );
159 - double getWidth();
161 - void setWidth(double _fWidth) throw ( css::script::BasicErrorException );
163 - double getLeft();
165 - void setLeft(double _fLeft);
167 - double getTop();
169 - void setTop(double _fTop);
172 class VBAHELPER_DLLPUBLIC ContainerUtilities
175 diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx
176 index bc66be6..b95ccf1 100644
177 --- vbahelper/source/vbahelper/vbahelper.cxx
178 +++ vbahelper/source/vbahelper/vbahelper.cxx
179 @@ -818,8 +818,7 @@ double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double
181 ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape )
183 -// #FIXME needs to be an instantiable service
184 -// m_xShape = new ScVbaShape( xContext, xShape );
185 + m_pShapeHelper.reset( new ShapeHelper( xShape ) );
188 static uno::Reference< frame::XController > lcl_getCurrentController()
189 @@ -1002,36 +1001,36 @@ UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComp
191 double ConcreteXShapeGeometryAttributes::getLeft()
193 - return m_xShape->getLeft();
194 + return m_pShapeHelper->getLeft();
196 void ConcreteXShapeGeometryAttributes::setLeft( double nLeft )
198 - m_xShape->setLeft( nLeft );
199 + m_pShapeHelper->setLeft( nLeft );
201 double ConcreteXShapeGeometryAttributes::getTop()
203 - return m_xShape->getTop();
204 + return m_pShapeHelper->getTop();
206 void ConcreteXShapeGeometryAttributes::setTop( double nTop )
208 - m_xShape->setTop( nTop );
209 + m_pShapeHelper->setTop( nTop );
212 double ConcreteXShapeGeometryAttributes::getHeight()
214 - return m_xShape->getHeight();
215 + return m_pShapeHelper->getHeight();
217 void ConcreteXShapeGeometryAttributes::setHeight( double nHeight )
219 - m_xShape->setHeight( nHeight );
220 + m_pShapeHelper->setHeight( nHeight );
222 double ConcreteXShapeGeometryAttributes::getWidth()
224 - return m_xShape->getWidth();
225 + return m_pShapeHelper->getWidth();
227 void ConcreteXShapeGeometryAttributes::setWidth( double nWidth)
229 - m_xShape->setHeight( nWidth );
230 + m_pShapeHelper->setWidth( nWidth );