SdrObject: add meRelativeWidth/HeightRelation

Similar to Writer TextBoxes, this member is supposed to store the
"relation" (text::RelOrientation constants) of the relative
width/height, so far the layout always assumed "relative to page".

Change-Id: I5100745314e45ad322bff2b761e3722459aba014
This commit is contained in:
Miklos Vajna 2014-02-20 11:14:14 +01:00
parent b74870f275
commit b0bf124360
2 changed files with 11 additions and 0 deletions

View File

@ -413,13 +413,19 @@ protected:
private: private:
static SdrItemPool* mpGlobalItemPool; static SdrItemPool* mpGlobalItemPool;
boost::optional<double> mnRelativeWidth; boost::optional<double> mnRelativeWidth;
sal_Int16 meRelativeWidthRelation;
boost::optional<double> mnRelativeHeight; boost::optional<double> mnRelativeHeight;
sal_Int16 meRelativeHeightRelation;
public: public:
static SdrItemPool& GetGlobalDrawObjectItemPool(); static SdrItemPool& GetGlobalDrawObjectItemPool();
void SetRelativeWidth( double nValue ) { mnRelativeWidth.reset( nValue ); } void SetRelativeWidth( double nValue ) { mnRelativeWidth.reset( nValue ); }
void SetRelativeWidthRelation( sal_Int16 eValue ) { meRelativeWidthRelation = eValue; }
void SetRelativeHeight( double nValue ) { mnRelativeHeight.reset( nValue ); } void SetRelativeHeight( double nValue ) { mnRelativeHeight.reset( nValue ); }
void SetRelativeHeightRelation( sal_Int16 eValue ) { meRelativeHeightRelation = eValue; }
boost::optional<double> GetRelativeWidth( ) const { return mnRelativeWidth; } boost::optional<double> GetRelativeWidth( ) const { return mnRelativeWidth; }
sal_Int16 GetRelativeWidthRelation() const { return meRelativeWidthRelation; }
boost::optional<double> GetRelativeHeight( ) const { return mnRelativeHeight; } boost::optional<double> GetRelativeHeight( ) const { return mnRelativeHeight; }
sal_Int16 GetRelativeHeightRelation() const { return meRelativeHeightRelation; }
// evil calc grid/shape drawlayer syncing // evil calc grid/shape drawlayer syncing
Point GetGridOffset() const { return aGridOffset; } Point GetGridOffset() const { return aGridOffset; }
void SetGridOffset( const Point& rGridOffset ){ aGridOffset = rGridOffset; } void SetGridOffset( const Point& rGridOffset ){ aGridOffset = rGridOffset; }

View File

@ -20,6 +20,7 @@
#include "sal/config.h" #include "sal/config.h"
#include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#include "svdconv.hxx" #include "svdconv.hxx"
@ -437,6 +438,8 @@ SdrObject::SdrObject()
,pGrabBagItem(NULL) ,pGrabBagItem(NULL)
,mnNavigationPosition(SAL_MAX_UINT32) ,mnNavigationPosition(SAL_MAX_UINT32)
,mnLayerID(0) ,mnLayerID(0)
,meRelativeWidthRelation(text::RelOrientation::PAGE_FRAME)
,meRelativeHeightRelation(text::RelOrientation::PAGE_FRAME)
,mpSvxShape( NULL ) ,mpSvxShape( NULL )
,maWeakUnoShape() ,maWeakUnoShape()
,mbDoNotInsertIntoPageAutomatically(false) ,mbDoNotInsertIntoPageAutomatically(false)
@ -1615,6 +1618,8 @@ void SdrObject::Resize(const Point& rRef, const Fraction& xFact, const Fraction&
if (bUnsetRelative) if (bUnsetRelative)
{ {
mnRelativeWidth.reset( ); mnRelativeWidth.reset( );
meRelativeWidthRelation = text::RelOrientation::PAGE_FRAME;
meRelativeHeightRelation = text::RelOrientation::PAGE_FRAME;
mnRelativeHeight.reset( ); mnRelativeHeight.reset( );
} }
Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect(); Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();