21#include <com/sun/star/beans/XPropertySet.hpp>
27 const uno::Reference< uno::XComponentContext >& xContext )
29 , mnOrientLandscape(0)
36 sal_Int32 topMargin = 0;
40 bool headerOn =
false;
45 aValue =
mxPageProps->getPropertyValue(
"TopMargin" );
50 sal_Int32 headerHeight = 0;
51 aValue =
mxPageProps->getPropertyValue(
"HeaderHeight" );
52 aValue >>= headerHeight;
53 topMargin = topMargin + headerHeight;
56 catch( uno::Exception& )
60 return Millimeter::getInPoints( topMargin );
65 sal_Int32 topMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
69 bool headerOn =
false;
76 sal_Int32 headerHeight = 0;
77 aValue =
mxPageProps->getPropertyValue(
"HeaderHeight" );
78 aValue >>= headerHeight;
79 topMargin -= headerHeight;
84 catch( uno::Exception& )
91 sal_Int32 bottomMargin = 0;
95 bool footerOn =
false;
100 aValue =
mxPageProps->getPropertyValue(
"BottomMargin" );
101 aValue >>= bottomMargin;
105 sal_Int32 footerHeight = 0;
106 aValue =
mxPageProps->getPropertyValue(
"FooterHeight" );
107 aValue >>= footerHeight;
108 bottomMargin += footerHeight;
111 catch( uno::Exception& )
115 return Millimeter::getInPoints( bottomMargin );
120 sal_Int32 bottomMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
124 bool footerOn =
false;
131 sal_Int32 footerHeight = 0;
132 aValue =
mxPageProps->getPropertyValue(
"FooterHeight" );
133 aValue >>= footerHeight;
134 bottomMargin -= footerHeight;
139 catch( uno::Exception& )
146 sal_Int32 rightMargin = 0;
150 aValue >>= rightMargin;
152 catch( uno::Exception& )
156 return Millimeter::getInPoints( rightMargin );
161 sal_Int32 rightMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
166 catch( uno::Exception& )
174 sal_Int32 leftMargin = 0;
178 aValue >>= leftMargin;
180 catch( uno::Exception& )
184 return Millimeter::getInPoints( leftMargin );
189 sal_Int32 leftMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
194 catch( uno::Exception& )
201 sal_Int32 headerMargin = 0;
205 aValue >>= headerMargin;
207 catch( uno::Exception& )
211 return Millimeter::getInPoints( headerMargin );
216 sal_Int32 headerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
221 catch( uno::Exception& )
228 sal_Int32 footerMargin = 0;
232 aValue >>= footerMargin;
234 catch( uno::Exception& )
238 return Millimeter::getInPoints( footerMargin );
243 sal_Int32 footerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
248 catch( uno::Exception& )
258 bool isLandscape =
false;
260 aValue >>= isLandscape;
267 catch( uno::Exception& )
283 bool isLandscape =
false;
285 aValue >>= isLandscape;
287 bool switchOrientation =
false;
291 switchOrientation =
true;
294 if( switchOrientation )
299 mxPageProps->setPropertyValue(
"Width" , aHeight );
300 mxPageProps->setPropertyValue(
"Height" , aWidth );
303 catch( uno::Exception& )
VbaPageSetupBase(const css::uno::Reference< ov::XHelperInterface > &xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext)
virtual void SAL_CALL setFooterMargin(double margin)
virtual double SAL_CALL getTopMargin() override
virtual double SAL_CALL getFooterMargin()
virtual void SAL_CALL setBottomMargin(double margin) override
virtual void SAL_CALL setHeaderMargin(double margin)
virtual double SAL_CALL getRightMargin() override
virtual double SAL_CALL getBottomMargin() override
virtual sal_Int32 SAL_CALL getOrientation() override
virtual double SAL_CALL getHeaderMargin()
virtual void SAL_CALL setOrientation(sal_Int32 orientation) override
virtual double SAL_CALL getLeftMargin() override
virtual void SAL_CALL setRightMargin(double margin) override
sal_Int32 mnOrientPortrait
css::uno::Reference< css::beans::XPropertySet > mxPageProps
sal_Int32 mnOrientLandscape
virtual void SAL_CALL setLeftMargin(double margin) override
virtual void SAL_CALL setTopMargin(double margin) override
#define ERRCODE_BASIC_BAD_PARAMETER