ooo-build r13033 - in trunk: . patches/vba



Author: pflin
Date: Thu Jul  3 02:33:46 2008
New Revision: 13033
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13033&view=rev

Log:
Support Pagesetup.Orientation. fixe for n#405310, Other attriubtes in Pagesetup object have not tested yet.



Modified:
   trunk/ChangeLog
   trunk/patches/vba/vba-pagesetup-object.diff

Modified: trunk/patches/vba/vba-pagesetup-object.diff
==============================================================================
--- trunk/patches/vba/vba-pagesetup-object.diff	(original)
+++ trunk/patches/vba/vba-pagesetup-object.diff	Thu Jul  3 02:33:46 2008
@@ -1,5 +1,5 @@
---- ../dev300-m10.src/oovbaapi/org/openoffice/excel/XWorksheet.idl	2008-05-09 13:54:11.000000000 +0800
-+++ oovbaapi/org/openoffice/excel/XWorksheet.idl	2008-05-09 11:55:19.000000000 +0800
+--- oovbaapi/org/openoffice/excel/XWorksheet.idl.orig	2008-07-03 10:02:25.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XWorksheet.idl	2008-07-03 10:08:27.000000000 +0800
 @@ -51,6 +51,7 @@ module org {  module openoffice {  modul
  interface XComments;
  interface XRange;
@@ -16,8 +16,8 @@
  	any OLEObjects([in] any Index);
  	void ShowDataForm();
  	any Shapes([in] any Index);
---- ../dev300-m10.src/oovbaapi/org/openoffice/excel/makefile.mk	2008-05-09 13:54:31.000000000 +0800
-+++ oovbaapi/org/openoffice/excel/makefile.mk	2008-05-08 11:50:56.000000000 +0800
+--- oovbaapi/org/openoffice/excel/makefile.mk.orig	2008-07-03 10:02:25.000000000 +0800
++++ oovbaapi/org/openoffice/excel/makefile.mk	2008-07-03 10:08:27.000000000 +0800
 @@ -94,6 +94,7 @@ IDLFILES= XApplication.idl\
  	Window.idl \
   	XHyperlink.idl \
@@ -26,9 +26,9 @@
  
  
  # ------------------------------------------------------------------
---- /dev/null	2008-04-03 19:37:22.000000000 +0800
-+++ oovbaapi/org/openoffice/excel/XPageSetup.idl	2008-05-08 11:50:20.000000000 +0800
-@@ -0,0 +1,64 @@
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XPageSetup.idl	2008-07-03 10:08:27.000000000 +0800
+@@ -0,0 +1,90 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -83,6 +83,32 @@
 +
 +	//Attributes
 +    [attribute] string PrintArea;
++    [attribute] double TopMargin;
++    [attribute] double BottomMargin;
++    [attribute] double RightMargin;
++    [attribute] double LeftMargin;
++    [attribute] double HeaderMargin;
++    [attribute] double FooterMargin;
++    [attribute] long Orientation;
++    [attribute] any FitToPagesTall;
++    [attribute] any FitToPagesWide;
++    [attribute] any Zoom;
++    [attribute] string LeftHeader;
++    [attribute] string CenterHeader;
++    [attribute] string RightHeader;
++    [attribute] string LeftFooter;
++    [attribute] string CenterFooter;
++    [attribute] string RightFooter;
++    [attribute] long PaperSize;
++    [attribute] long Order;
++    [attribute] long FirstPageNumber;
++    [attribute] boolean CenterVertically;
++    [attribute] boolean CenterHorizontally;
++    [attribute] boolean PrintHeadings;
++    [attribute] any PrintTitleRows;
++    [attribute] any PrintTitleColumns;
++    [attribute] boolean PrintGridlines;
++    [attribute] boolean PrintDraft;
 +
 +};
 +
@@ -93,8 +119,8 @@
 +#endif
 +
 +
---- ../dev300-m10.src/sc/source/ui/vba/vbaworksheet.hxx	2008-05-09 13:54:11.000000000 +0800
-+++ sc/source/ui/vba/vbaworksheet.hxx	2008-05-09 11:58:52.000000000 +0800
+--- sc/source/ui/vba/vbaworksheet.hxx.orig	2008-07-03 10:02:26.000000000 +0800
++++ sc/source/ui/vba/vbaworksheet.hxx	2008-07-03 10:08:27.000000000 +0800
 @@ -42,6 +42,7 @@
  #include <com/sun/star/uno/XComponentContext.hpp>
  #include <com/sun/star/frame/XModel.hpp>
@@ -111,43 +137,34 @@
  	virtual css::uno::Reference< oo::excel::XWorksheet > SAL_CALL getNext() throw (css::uno::RuntimeException);
  	virtual css::uno::Reference< oo::excel::XWorksheet > SAL_CALL getPrevious() throw (css::uno::RuntimeException);
  
---- ../dev300-m10.src/sc/source/ui/vba/vbaworksheet.cxx	2008-05-09 13:54:27.000000000 +0800
-+++ sc/source/ui/vba/vbaworksheet.cxx	2008-05-09 12:05:36.000000000 +0800
-@@ -85,6 +85,7 @@
- #include "vbaoleobject.hxx"
- #include "vbaoleobjects.hxx"
- #include "vbashapes.hxx"
-+#include "vbapagesetup.hxx"
- 
- #define STANDARDWIDTH 2267
- #define STANDARDHEIGHT 427
-@@ -267,6 +268,13 @@ ScVbaWorksheet::Outline( ) throw (uno::R
+--- sc/source/ui/vba/vbaworksheet.cxx.orig	2008-07-03 10:02:26.000000000 +0800
++++ sc/source/ui/vba/vbaworksheet.cxx	2008-07-03 10:08:27.000000000 +0800
+@@ -267,6 +267,12 @@ ScVbaWorksheet::Outline( ) throw (uno::R
  	return new ScVbaOutline( this, mxContext, xOutline);
  }
  
 +uno::Reference< excel::XPageSetup >
 +ScVbaWorksheet::PageSetup( ) throw (uno::RuntimeException)
 +{
-+	uno::Reference<sheet::XPrintAreas> xPrintAreas(getSheet(),uno::UNO_QUERY_THROW);
-+	return new ScVbaPageSetup( this, mxContext, xPrintAreas);
++	return new ScVbaPageSetup( this, mxContext, getSheet(), getModel() );
 +}
 +
  sal_Int32 
  ScVbaWorksheet::getStandardWidth() throw (uno::RuntimeException)
  {
---- ../dev300-m10.src/sc/source/ui/vba/makefile.mk	2008-05-09 13:54:31.000000000 +0800
-+++ sc/source/ui/vba/makefile.mk	2008-05-08 15:08:22.000000000 +0800
+--- sc/source/ui/vba/makefile.mk.orig	2008-07-03 10:02:26.000000000 +0800
++++ sc/source/ui/vba/makefile.mk	2008-07-03 10:08:27.000000000 +0800
 @@ -126,6 +126,7 @@ SLOFILES= \
                  $(SLO)$/vbacommandbar.obj \
                  $(SLO)$/vbacommandbars.obj \
          $(SLO)$/vbahyperlink.obj \
 +        $(SLO)$/vbapagesetup.obj \
  		$(SLO)$/service.obj \
+         $(SLO)$/vbaeventshelper.obj \
   
- 
---- /dev/null	2008-04-03 19:37:22.000000000 +0800
-+++ sc/source/ui/vba/vbapagesetup.hxx	2008-05-09 10:55:46.000000000 +0800
-@@ -0,0 +1,58 @@
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ sc/source/ui/vba/vbapagesetup.hxx	2008-07-03 10:08:27.000000000 +0800
+@@ -0,0 +1,114 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -180,35 +197,91 @@
 +#ifndef SC_VBA_PAGESETUP_HXX
 +#define SC_VBA_PAGESETUP_HXX
 +
-+#include <com/sun/star/sheet/XPrintAreas.hpp>
 +#include <cppuhelper/implbase1.hxx>
 +#include <org/openoffice/excel/XPageSetup.hpp>
 +#include <com/sun/star/uno/XComponentContext.hpp>
++#include <com/sun/star/sheet/XSpreadsheet.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
 +#include "vbahelperinterface.hxx"
 +
 +typedef InheritedHelperInterfaceImpl1< oo::excel::XPageSetup > ScVbaPageSetup_BASE;
 +
 +class ScVbaPageSetup :  public ScVbaPageSetup_BASE 
 +{
-+	css::uno::Reference< css::sheet::XPrintAreas > mxPrintAreas;
++    css::uno::Reference< css::sheet::XSpreadsheet > mxSheet;
++    css::uno::Reference< css::beans::XPropertySet > mxPageProps;
++    css::uno::Reference< css::frame::XModel > mxModel;
 +public:
-+	ScVbaPageSetup( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
-+		 css::uno::Reference<css::sheet::XPrintAreas> printareas): ScVbaPageSetup_BASE( xParent, xContext) , mxPrintAreas(printareas)
-+	{}
++	ScVbaPageSetup( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, 
++                    const css::uno::Reference< css::uno::XComponentContext >& xContext,
++		            const css::uno::Reference< css::sheet::XSpreadsheet>& xSheet,
++                    const css::uno::Reference< css::frame::XModel >& xModlel) throw (css::uno::RuntimeException); 
 +	virtual ~ScVbaPageSetup(){}
 +    
 +    // Attribute
 +	virtual rtl::OUString SAL_CALL getPrintArea() throw (css::uno::RuntimeException);
 +	virtual void SAL_CALL setPrintArea( const rtl::OUString& rAreas ) throw (css::uno::RuntimeException);
++	virtual double SAL_CALL getTopMargin() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setTopMargin( double margin ) throw (css::uno::RuntimeException);
++	virtual double SAL_CALL getBottomMargin() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setBottomMargin( double margin ) throw (css::uno::RuntimeException);
++	virtual double SAL_CALL getRightMargin() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setRightMargin( double margin ) throw (css::uno::RuntimeException);
++	virtual double SAL_CALL getLeftMargin() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setLeftMargin( double margin ) throw (css::uno::RuntimeException);
++	virtual double SAL_CALL getHeaderMargin() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setHeaderMargin( double margin ) throw (css::uno::RuntimeException);
++	virtual double SAL_CALL getFooterMargin() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setFooterMargin( double margin ) throw (css::uno::RuntimeException);
++	virtual sal_Int32 SAL_CALL getOrientation() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL getFitToPagesTall() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setFitToPagesTall( const css::uno::Any& fitToPagesTall ) throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL getFitToPagesWide() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setFitToPagesWide( const css::uno::Any& fitToPagesWide ) throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL getZoom() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setZoom( const css::uno::Any& zoom ) throw (css::uno::RuntimeException);
++	virtual rtl::OUString SAL_CALL getLeftHeader() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setLeftHeader( const rtl::OUString& leftHeader ) throw (css::uno::RuntimeException);
++	virtual rtl::OUString SAL_CALL getCenterHeader() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setCenterHeader( const rtl::OUString& centerHeader ) throw (css::uno::RuntimeException);
++	virtual rtl::OUString SAL_CALL getRightHeader() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setRightHeader( const rtl::OUString& rightHeader ) throw (css::uno::RuntimeException);
++	virtual rtl::OUString SAL_CALL getLeftFooter() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setLeftFooter( const rtl::OUString& leftFooter ) throw (css::uno::RuntimeException);
++	virtual rtl::OUString SAL_CALL getCenterFooter() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setCenterFooter( const rtl::OUString& centerFooter ) throw (css::uno::RuntimeException);
++	virtual rtl::OUString SAL_CALL getRightFooter() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setRightFooter( const rtl::OUString& rightFooter ) throw (css::uno::RuntimeException);
++	virtual sal_Int32 SAL_CALL getPaperSize() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setPaperSize( sal_Int32 pagerSize ) throw (css::uno::RuntimeException);
++	virtual sal_Int32 SAL_CALL getOrder() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setOrder( sal_Int32 order ) throw (css::uno::RuntimeException);
++	virtual sal_Int32 SAL_CALL getFirstPageNumber() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setFirstPageNumber( sal_Int32 firstPageNumber ) throw (css::uno::RuntimeException);
++	virtual sal_Bool SAL_CALL getCenterVertically() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setCenterVertically( sal_Bool centerVertically ) throw (css::uno::RuntimeException);
++	virtual sal_Bool SAL_CALL getCenterHorizontally() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setCenterHorizontally( sal_Bool centerHorizontally ) throw (css::uno::RuntimeException);
++	virtual sal_Bool SAL_CALL getPrintHeadings() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setPrintHeadings( sal_Bool printHeadings ) throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL getPrintTitleRows() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setPrintTitleRows( const css::uno::Any& printTitleRows ) throw (css::uno::RuntimeException);
++	virtual css::uno::Any SAL_CALL getPrintTitleColumns() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setPrintTitleColumns( const css::uno::Any& printTitleColumns ) throw (css::uno::RuntimeException);
++	virtual sal_Bool SAL_CALL getPrintGridlines() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setPrintGridlines( sal_Bool printGridlines ) throw (css::uno::RuntimeException);
++	virtual sal_Bool SAL_CALL getPrintDraft() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setPrintDraft( sal_Bool printDraft ) throw (css::uno::RuntimeException);
 +
 +	// XHelperInterface
 +	virtual rtl::OUString& getServiceImplName();
 +	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
 +};
 +#endif
---- /dev/null	2008-04-03 19:37:22.000000000 +0800
-+++ sc/source/ui/vba/vbapagesetup.cxx	2008-05-09 12:53:00.000000000 +0800
-@@ -0,0 +1,134 @@
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ sc/source/ui/vba/vbapagesetup.cxx	2008-07-03 10:08:27.000000000 +0800
+@@ -0,0 +1,960 @@
 +/*************************************************************************
 + *
 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -241,88 +314,914 @@
 +#include "vbapagesetup.hxx"
 +#include "cellsuno.hxx"
 +#include "convuno.hxx"
++#include "rangelst.hxx"
++#include <com/sun/star/sheet/XPrintAreas.hpp>
++#include <com/sun/star/sheet/XHeaderFooterContent.hpp>
++#include <com/sun/star/text/XText.hpp>
++#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
++#include <com/sun/star/container/XNameAccess.hpp>
++#include <org/openoffice/excel/XlPageOrientation.hpp>
++#include <org/openoffice/excel/XlOrder.hpp>
++#include <org/openoffice/excel/Constants.hpp>
++
 +using namespace ::com::sun::star;
 +using namespace ::org::openoffice;
 +
-+// assume that xIf is infact a ScCellRangesBase
-+ScDocument* getDocumentFromIf( const uno::Reference< uno::XInterface >& xIf ) throw ( uno::RuntimeException )
++#define ZOOM_IN 10
++#define ZOOM_MAX 400
++
++bool getScRangeListForAddress( const rtl::OUString& sName, ScDocShell* pDocSh, ScRange& refRange, ScRangeList& aCellRanges, ScAddress::Convention aConv = ScAddress::CONV_XL_A1 ) throw ( uno::RuntimeException );
++
++ScVbaPageSetup::ScVbaPageSetup(const uno::Reference< vba::XHelperInterface >& xParent, 
++				const uno::Reference< uno::XComponentContext >& xContext,
++				const uno::Reference< sheet::XSpreadsheet >& xSheet,
++				const uno::Reference< frame::XModel >& xModel) throw (uno::RuntimeException):
++	   	ScVbaPageSetup_BASE( xParent, xContext ),
++		mxSheet( xSheet ), mxModel( xModel )
++{
++    // query for current page style
++    uno::Reference< beans::XPropertySet > xSheetProps( mxSheet, uno::UNO_QUERY_THROW );
++    uno::Any aValue = xSheetProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageStyle" )));
++    rtl::OUString aStyleName;
++    aValue >>= aStyleName;
++
++    uno::Reference< style::XStyleFamiliesSupplier > xStyleFamiliesSup( mxModel, uno::UNO_QUERY_THROW );
++    uno::Reference< container::XNameAccess > xStyleFamilies = xStyleFamiliesSup->getStyleFamilies();
++    uno::Reference< container::XNameAccess > xPageStyle( xStyleFamilies->getByName(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles"))), uno::UNO_QUERY_THROW );
++    mxPageProps.set( xPageStyle->getByName(aStyleName), uno::UNO_QUERY_THROW );
++}		
++
++rtl::OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeException)
 +{
-+    ScCellRangesBase* pUno= dynamic_cast< ScCellRangesBase* >( xIf.get() );
-+    if ( !pUno )
-+        throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to access underlying uno range object" ) ), uno::Reference<
-+uno::XInterface >()  );
++    String aPrintArea;
++    uno::Reference< sheet::XPrintAreas > xPrintAreas( mxSheet, uno::UNO_QUERY_THROW );
++    uno::Sequence< table::CellRangeAddress > aSeq = xPrintAreas->getPrintAreas();
++    sal_Int32 nCount = aSeq.getLength();
++    if( nCount )
++    {
++        ScAddress::Details aDetails( ScAddress::CONV_XL_A1, 0, 0 );
++        USHORT nFlags = SCA_VALID;
++        nFlags |= ( SCA_TAB_ABSOLUTE | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB2_ABSOLUTE | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE );
++		ScRangeList aRangeList;
++		for( sal_Int32 i=0; i<nCount; i++ )
++		{
++			ScRange aRange;
++			ScUnoConversion::FillScRange( aRange, aSeq[i] );
++			aRangeList.Append( aRange );
++		}
++		ScDocument* pDoc = getDocShell( mxModel )->GetDocument();
++		aRangeList.Format( aPrintArea, nFlags, pDoc, ScAddress::CONV_XL_A1, ','  );
++    }
 +    
-+    return pUno->GetDocument();
++    return aPrintArea;
 +}
 +
-+rtl::OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeException)
++void SAL_CALL ScVbaPageSetup::setPrintArea( const rtl::OUString& rAreas ) throw (css::uno::RuntimeException)
 +{
-+    rtl::OUStringBuffer aPrintArea;
-+    uno::Reference< uno::XInterface > xIf( mxPrintAreas, uno::UNO_QUERY_THROW );
-+    ScDocument* pDoc = getDocumentFromIf( xIf );
-+    if( pDoc )
-+    {
-+        uno::Sequence< table::CellRangeAddress > aSeq = mxPrintAreas->getPrintAreas();
-+        USHORT nCount = (USHORT) aSeq.getLength();
-+        if( nCount )
-+        {
-+            ScAddress::Details aDetails( ScAddress::CONV_XL_A1, 0, 0 );
-+            USHORT nFlags = SCA_VALID;
-+            nFlags |= ( SCA_TAB_ABSOLUTE | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB2_ABSOLUTE | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE );
-+            String sRange;
-+            ScRange aPrintRange;
-+            const table::CellRangeAddress* pAry = aSeq.getArray();
-+            for( USHORT i=0; i<nCount; i++ )
-+            {
-+                if( i > 0 )
-+                    aPrintArea.append( rtl::OUString( ',' ) );
-+                ScUnoConversion::FillScRange( aPrintRange, pAry[i] );
-+                aPrintRange.Format( sRange,  nFlags, pDoc, aDetails );
-+                aPrintArea.append( sRange );
-+            }
++    uno::Reference< sheet::XPrintAreas > xPrintAreas( mxSheet, uno::UNO_QUERY_THROW );
++    if( rAreas.getLength() == 0 ||
++        rAreas.equalsIgnoreAsciiCase ( rtl::OUString::createFromAscii("FALSE") ) )
++    {
++        // print the whole sheet
++        uno::Sequence< table::CellRangeAddress > aSeq;
++        xPrintAreas->setPrintAreas( aSeq );
++    }
++    else
++    {
++		ScRangeList aCellRanges;
++		ScRange aRange;
++		if( getScRangeListForAddress( rAreas, getDocShell( mxModel ) , aRange, aCellRanges ) ) 
++		{
++			uno::Sequence< table::CellRangeAddress > aSeq( aCellRanges.Count() );
++			USHORT i=0;
++			for( ScRange* pRange = aCellRanges.First(); pRange; pRange = aCellRanges.Next() )
++			{
++				table::CellRangeAddress aRangeAddress;
++				ScUnoConversion::FillApiRange( aRangeAddress, *pRange );
++				aSeq[ i++ ] = aRangeAddress;
++			}
++			xPrintAreas->setPrintAreas( aSeq );
++		}
++    }
++}
++
++double SAL_CALL ScVbaPageSetup::getTopMargin() throw (css::uno::RuntimeException)
++{
++    sal_Bool headerOn = sal_False;
++    sal_Int32 topMargin = 0;
++    sal_Int32 headerHeight = 0;
++
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")));
++        aValue >>= headerOn;
++
++        aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")));
++        aValue >>= topMargin;
++
++        if( headerOn )
++        {
++            aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight")));
++            aValue >>= headerHeight;
++            topMargin += headerHeight;
 +        }
 +    }
++    catch( uno::Exception& )
++    {
++    }
 +    
-+    return aPrintArea.makeStringAndClear();
++    return Millimeter::getInPoints( topMargin );
 +}
 +
-+void SAL_CALL ScVbaPageSetup::setPrintArea( const rtl::OUString& rAreas ) throw (css::uno::RuntimeException)
++void SAL_CALL ScVbaPageSetup::setTopMargin( double margin ) throw (css::uno::RuntimeException)
++{
++    sal_Int32 topMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
++    sal_Bool headerOn = sal_False;
++    sal_Int32 headerHeight = 0;
++
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")));
++        aValue >>= headerOn;
++        
++        if( headerOn )
++        {
++            aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight")));
++            aValue >>= headerHeight;
++            topMargin -= headerHeight;
++        }
++
++        aValue <<= topMargin;
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue );
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++double SAL_CALL ScVbaPageSetup::getBottomMargin() throw (css::uno::RuntimeException)
++{
++    sal_Bool footerOn = sal_False;
++    sal_Int32 bottomMargin = 0;
++    sal_Int32 footerHeight = 0;
++
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")));
++        aValue >>= footerOn;
++
++        aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")));
++        aValue >>= bottomMargin;
++
++        if( footerOn )
++        {
++            aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight")));
++            aValue >>= footerHeight;
++            bottomMargin += footerHeight;
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++    
++    return Millimeter::getInPoints( bottomMargin );
++}
++
++void SAL_CALL ScVbaPageSetup::setBottomMargin( double margin ) throw (css::uno::RuntimeException)
++{
++    sal_Int32 bottomMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
++    sal_Bool footerOn = sal_False;
++    sal_Int32 footerHeight = 0;
++
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")));
++        aValue >>= footerOn;
++        
++        if( footerOn )
++        {
++            aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight")));
++            aValue >>= footerHeight;
++            bottomMargin -= footerHeight;
++        }
++
++        aValue <<= bottomMargin;
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue );
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++double SAL_CALL ScVbaPageSetup::getRightMargin() throw (css::uno::RuntimeException)
++{
++    sal_Int32 rightMargin = 0;
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin")));
++        aValue >>= rightMargin;
++    }
++    catch( uno::Exception& )
++    {
++    }
++    
++    return Millimeter::getInPoints( rightMargin );;
++}
++
++void SAL_CALL ScVbaPageSetup::setRightMargin( double margin ) throw (css::uno::RuntimeException)
++{
++    sal_Int32 rightMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
++    try
++    {
++        uno::Any aValue;
++        aValue <<= rightMargin;
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin")), aValue );
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++}
++
++double SAL_CALL ScVbaPageSetup::getLeftMargin() throw (css::uno::RuntimeException)
++{
++    sal_Int32 leftMargin = 0;
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin")));
++        aValue >>= leftMargin;
++    }
++    catch( uno::Exception& )
++    {
++    }
++    
++    return Millimeter::getInPoints( leftMargin );;
++}
++
++void SAL_CALL ScVbaPageSetup::setLeftMargin( double margin ) throw (css::uno::RuntimeException)
++{
++    sal_Int32 leftMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
++    try
++    {
++        uno::Any aValue;
++        aValue <<= leftMargin;
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin")), aValue );
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++double SAL_CALL ScVbaPageSetup::getHeaderMargin() throw (css::uno::RuntimeException)
++{
++    sal_Int32 headerMargin = 0;
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")));
++        aValue >>= headerMargin;
++    }
++    catch( uno::Exception& )
++    {
++    }
++    
++    return Millimeter::getInPoints( headerMargin );;
++}
++
++void SAL_CALL ScVbaPageSetup::setHeaderMargin( double margin ) throw (css::uno::RuntimeException)
 +{
-+    uno::Reference< uno::XInterface > xIf( mxPrintAreas, uno::UNO_QUERY_THROW );
-+    ScDocument* pDoc = getDocumentFromIf( xIf );
-+    if( pDoc )
-+    {
-+        if( rAreas.getLength() == 0 ||
-+            rAreas.equalsIgnoreAsciiCase ( rtl::OUString::createFromAscii("FALSE") ) )
-+        {
-+            // print the whole sheet
-+            uno::Sequence< table::CellRangeAddress > aSeq;
-+            mxPrintAreas->setPrintAreas( aSeq );
++    sal_Int32 headerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
++    try
++    {
++        uno::Any aValue;
++        aValue <<= headerMargin;
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue );
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++double SAL_CALL ScVbaPageSetup::getFooterMargin() throw (css::uno::RuntimeException)
++{
++    sal_Int32 footerMargin = 0;
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")));
++        aValue >>= footerMargin;
++    }
++    catch( uno::Exception& )
++    {
++    }
++    
++    return Millimeter::getInPoints( footerMargin );;
++}
++
++void SAL_CALL ScVbaPageSetup::setFooterMargin( double margin ) throw (css::uno::RuntimeException)
++{
++    sal_Int32 footerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin );
++    try
++    {
++        uno::Any aValue;
++        aValue <<= footerMargin;
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), aValue );
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++sal_Int32 SAL_CALL ScVbaPageSetup::getOrientation() throw (css::uno::RuntimeException)
++{
++    sal_Int32 orientation = excel::XlPageOrientation::xlPortrait;
++    try
++    {
++        sal_Bool isLandscape = sal_False;
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape")));
++        aValue >>= isLandscape;
++
++        if( isLandscape )
++        {
++            orientation = excel::XlPageOrientation::xlLandscape;
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++    return orientation;
++}
++
++void SAL_CALL ScVbaPageSetup::setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException)
++{
++    if( ( orientation != excel::XlPageOrientation::xlPortrait ) &&
++        ( orientation != excel::XlPageOrientation::xlLandscape ) )
++    {
++        DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
++    }
++
++    try
++    {
++        sal_Bool isLandscape = sal_False;
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape")));
++        aValue >>= isLandscape;
++
++        sal_Bool switchOrientation = sal_False;
++        if(( isLandscape && orientation != excel::XlPageOrientation::xlLandscape ) || 
++            ( !isLandscape && orientation != excel::XlPageOrientation::xlPortrait ))
++        {
++            switchOrientation = sal_True;
++        }
++
++        if( switchOrientation )
++        {
++            aValue <<= !isLandscape;
++            uno::Any aHeight = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height")));
++            uno::Any aWidth = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width")));
++            mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape")), aValue );
++            mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Width")),  aHeight );
++            mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Height")), aWidth );
++        }
++
++        if( isLandscape )
++        {
++            orientation = excel::XlPageOrientation::xlLandscape;
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesTall() throw (css::uno::RuntimeException)
++{
++    return mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesY")));
++}
++
++void SAL_CALL ScVbaPageSetup::setFitToPagesTall( const uno::Any& fitToPagesTall) throw (css::uno::RuntimeException)
++{
++    USHORT scaleToPageY = 0;
++    try
++    {
++        sal_Bool aValue;
++        if( fitToPagesTall.getValueTypeClass() != uno::TypeClass_BOOLEAN || (fitToPagesTall >>= aValue))
++        {
++            fitToPagesTall >>= scaleToPageY;
 +        }
++
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesY")), uno::makeAny( scaleToPageY ));
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesWide() throw (css::uno::RuntimeException)
++{
++    return mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesX")));
++}
++
++void SAL_CALL ScVbaPageSetup::setFitToPagesWide( const uno::Any& fitToPagesWide) throw (css::uno::RuntimeException)
++{
++    USHORT scaleToPageX = 0;
++    try
++    {
++        sal_Bool aValue = sal_False;
++        if( fitToPagesWide.getValueTypeClass() != uno::TypeClass_BOOLEAN || (fitToPagesWide >>= aValue))
++        {
++            fitToPagesWide >>= scaleToPageX;
++        }
++
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesX")), uno::makeAny( scaleToPageX ));
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++uno::Any SAL_CALL ScVbaPageSetup::getZoom() throw (css::uno::RuntimeException)
++{
++    return mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageScale")));
++}
++
++void SAL_CALL ScVbaPageSetup::setZoom( const uno::Any& zoom) throw (css::uno::RuntimeException)
++{
++    USHORT pageScale = 0;
++    try
++    {
++		if( zoom.getValueTypeClass() == uno::TypeClass_BOOLEAN )
++		{
++		    sal_Bool aValue = sal_False;
++		    zoom >>= aValue;
++		    if( aValue )
++		    {
++                DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
++		    }
++		}
 +        else
 +        {
-+            ScAddress::Details aDetails( ScAddress::CONV_XL_A1, 0, 0 );
-+            USHORT nFlags = SCA_VALID;
-+            ScRange aRange;
-+            
-+            String aPrintArea( rAreas );
-+            const sal_Unicode sep(',');
-+            USHORT nCount = aPrintArea.GetTokenCount(sep);
-+            uno::Sequence< table::CellRangeAddress > aSeq( nCount );
-+            for( USHORT i=0; i<nCount; i++ )
++            zoom >>= pageScale;
++            if(( pageScale < ZOOM_IN )||( pageScale > ZOOM_MAX ))
 +            {
-+                String aToken = aPrintArea.GetToken( i, sep );
-+                if ( aRange.ParseAny( aToken, pDoc, aDetails ) & nFlags )
-+                {
-+                    table::CellRangeAddress aRangeAddress;
-+                    ScUnoConversion::FillApiRange( aRangeAddress, aRange );
-+                    aSeq[ i ] = aRangeAddress;
-+                }
++                DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
 +            }
++        }
 +
-+            mxPrintAreas->setPrintAreas( aSeq );
++        // these only exist in S08
++        USHORT nScale = 0;
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPages")), uno::makeAny( nScale ));
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesX")), uno::makeAny( nScale ));
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleToPagesY")), uno::makeAny( nScale ));
++    }
++    catch( beans::UnknownPropertyException& )
++    {
++        if( pageScale == 0 )
++        {
++            DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++    mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageScale")), uno::makeAny( pageScale ));
++}
++
++rtl::OUString SAL_CALL ScVbaPageSetup::getLeftHeader() throw (css::uno::RuntimeException)
++{
++    rtl::OUString leftHeader;
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW);
++        if( xHeaderContent.is() )
++        {
++            uno::Reference< text::XText > xText = xHeaderContent->getLeftText();
++            leftHeader = xText->getString();
 +        }
 +    }
++    catch( uno::Exception& )
++    {
++    }
++
++    return leftHeader;
++}
++
++void SAL_CALL ScVbaPageSetup::setLeftHeader( const rtl::OUString& leftHeader) throw (css::uno::RuntimeException)
++{
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW);
++        if( xHeaderContent.is() )
++        {
++            uno::Reference< text::XText > xText = xHeaderContent->getLeftText();
++            xText->setString( leftHeader );
++            mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent")), uno::makeAny(xHeaderContent) ); 
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++rtl::OUString SAL_CALL ScVbaPageSetup::getCenterHeader() throw (css::uno::RuntimeException)
++{
++    rtl::OUString centerHeader;
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW);
++        if( xHeaderContent.is() )
++        {
++            uno::Reference< text::XText > xText = xHeaderContent->getCenterText();
++            centerHeader = xText->getString();
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++    return centerHeader;
++}
++
++void SAL_CALL ScVbaPageSetup::setCenterHeader( const rtl::OUString& centerHeader) throw (css::uno::RuntimeException)
++{
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW);
++        if( xHeaderContent.is() )
++        {
++            uno::Reference< text::XText > xText = xHeaderContent->getCenterText();
++            xText->setString( centerHeader );
++            mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent")), uno::makeAny(xHeaderContent) ); 
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++rtl::OUString SAL_CALL ScVbaPageSetup::getRightHeader() throw (css::uno::RuntimeException)
++{
++    rtl::OUString rightHeader;
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW);
++        if( xHeaderContent.is() )
++        {
++            uno::Reference< text::XText > xText = xHeaderContent->getRightText();
++            rightHeader = xText->getString();
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++    return rightHeader;
++}
++
++void SAL_CALL ScVbaPageSetup::setRightHeader( const rtl::OUString& rightHeader) throw (css::uno::RuntimeException)
++{
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xHeaderContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent"))), uno::UNO_QUERY_THROW);
++        if( xHeaderContent.is() )
++        {
++            uno::Reference< text::XText > xText = xHeaderContent->getRightText();
++            xText->setString( rightHeader );
++            mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageHeaderContent")), uno::makeAny(xHeaderContent) ); 
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++rtl::OUString SAL_CALL ScVbaPageSetup::getLeftFooter() throw (css::uno::RuntimeException)
++{
++    rtl::OUString leftFooter;
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW);
++        if( xFooterContent.is() )
++        {
++            uno::Reference< text::XText > xText = xFooterContent->getLeftText();
++            leftFooter = xText->getString();
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++    return leftFooter;
++}
++
++void SAL_CALL ScVbaPageSetup::setLeftFooter( const rtl::OUString& leftFooter) throw (css::uno::RuntimeException)
++{
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW);
++        if( xFooterContent.is() )
++        {
++            uno::Reference< text::XText > xText = xFooterContent->getLeftText();
++            xText->setString( leftFooter );
++            mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent")), uno::makeAny(xFooterContent) ); 
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++rtl::OUString SAL_CALL ScVbaPageSetup::getCenterFooter() throw (css::uno::RuntimeException)
++{
++    rtl::OUString centerFooter;
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW);
++        if( xFooterContent.is() )
++        {
++            uno::Reference< text::XText > xText = xFooterContent->getCenterText();
++            centerFooter = xText->getString();
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++    return centerFooter;
++}
++
++void SAL_CALL ScVbaPageSetup::setCenterFooter( const rtl::OUString& centerFooter) throw (css::uno::RuntimeException)
++{
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW);
++        if( xFooterContent.is() )
++        {
++            uno::Reference< text::XText > xText = xFooterContent->getCenterText();
++            xText->setString( centerFooter );
++            mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent")), uno::makeAny(xFooterContent) ); 
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++}
++
++rtl::OUString SAL_CALL ScVbaPageSetup::getRightFooter() throw (css::uno::RuntimeException)
++{
++    rtl::OUString rightFooter;
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW);
++        if( xFooterContent.is() )
++        {
++            uno::Reference< text::XText > xText = xFooterContent->getRightText();
++            rightFooter = xText->getString();
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++    return rightFooter;
++}
++
++void SAL_CALL ScVbaPageSetup::setRightFooter( const rtl::OUString& rightFooter) throw (css::uno::RuntimeException)
++{
++    try
++    {
++        uno::Reference<sheet::XHeaderFooterContent> xFooterContent( mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent"))), uno::UNO_QUERY_THROW);
++        if( xFooterContent.is() )
++        {
++            uno::Reference< text::XText > xText = xFooterContent->getRightText();
++            xText->setString( rightFooter );
++            mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightPageFooterContent")), uno::makeAny(xFooterContent) ); 
++        }
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++sal_Int32 SAL_CALL ScVbaPageSetup::getPaperSize() throw (css::uno::RuntimeException)
++{
++    return 0;
++}
++
++void SAL_CALL ScVbaPageSetup::setPaperSize( sal_Int32 paperSize) throw (css::uno::RuntimeException)
++{
++}
++
++sal_Int32 SAL_CALL ScVbaPageSetup::getOrder() throw (css::uno::RuntimeException)
++{
++    sal_Int32 order = excel::XlOrder::xlDownThenOver;
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrintDownFirst")));
++        sal_Bool bPrintDownFirst = sal_False;
++        aValue >>= bPrintDownFirst;
++        if( !bPrintDownFirst )
++            order = excel::XlOrder::xlOverThenDown;
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++    return order;
++}
++
++void SAL_CALL ScVbaPageSetup::setOrder( sal_Int32 order) throw (css::uno::RuntimeException)
++{
++    sal_Bool bOrder = sal_False;
++    switch( order )
++    {
++        case excel::XlOrder::xlDownThenOver:
++            break;
++        case excel::XlOrder::xlOverThenDown:
++            bOrder = sal_True;
++            break;
++        default:
++            DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
++    }
++
++    try
++    {
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrintDownFirst")), uno::makeAny(bOrder));
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++sal_Int32 SAL_CALL ScVbaPageSetup::getFirstPageNumber() throw (css::uno::RuntimeException)
++{
++    sal_Int32 number = 0;
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstPageNumber")));
++        aValue >>= number;
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++    if( number ==0 )
++    {
++        number = excel::Constants::xlAutomatic;
++    }
++
++    return number;
++}
++
++void SAL_CALL ScVbaPageSetup::setFirstPageNumber( sal_Int32 firstPageNumber) throw (css::uno::RuntimeException)
++{
++    if( firstPageNumber < 0 )
++        DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
++    if( firstPageNumber == excel::Constants::xlAutomatic )
++        firstPageNumber = 0;
++
++    try
++    {
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstPageNumber")), uno::makeAny( firstPageNumber ));
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++sal_Bool SAL_CALL ScVbaPageSetup::getCenterVertically() throw (css::uno::RuntimeException)
++{
++    sal_Bool centerVertically = sal_False;
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CenterVertically")));
++        aValue >>= centerVertically;
++    }
++    catch( uno::Exception& )
++    {
++    }
++    return centerVertically;
++}
++
++void SAL_CALL ScVbaPageSetup::setCenterVertically( sal_Bool centerVertically) throw (css::uno::RuntimeException)
++{
++    try
++    {
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CenterVertically")), uno::makeAny( centerVertically ));
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++sal_Bool SAL_CALL ScVbaPageSetup::getCenterHorizontally() throw (css::uno::RuntimeException)
++{
++    sal_Bool centerHorizontally = sal_False;
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CenterHorizontally")));
++        aValue >>= centerHorizontally;
++    }
++    catch( uno::Exception& )
++    {
++    }
++    return centerHorizontally;
++}
++
++void SAL_CALL ScVbaPageSetup::setCenterHorizontally( sal_Bool centerHorizontally) throw (css::uno::RuntimeException)
++{
++    try
++    {
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CenterHorizontally")), uno::makeAny( centerHorizontally ));
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++sal_Bool SAL_CALL ScVbaPageSetup::getPrintHeadings() throw (css::uno::RuntimeException)
++{
++    sal_Bool printHeadings = sal_False;
++    try
++    {
++        uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrintHeadings")));
++        aValue >>= printHeadings;
++    }
++    catch( uno::Exception& )
++    {
++    }
++    return printHeadings;
++}
++
++void SAL_CALL ScVbaPageSetup::setPrintHeadings( sal_Bool printHeadings) throw (css::uno::RuntimeException)
++{
++    try
++    {
++        mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrintHeadings")), uno::makeAny( printHeadings ));
++    }
++    catch( uno::Exception& )
++    {
++    }
++}
++
++uno::Any SAL_CALL ScVbaPageSetup::getPrintTitleRows() throw (css::uno::RuntimeException)
++{
++    rtl::OUStringBuffer printTitleRows;
++    uno::Reference< sheet::XPrintAreas > xPrintAreas( mxSheet, uno::UNO_QUERY_THROW );
++    if( !xPrintAreas->getPrintTitleRows() )
++        return uno::makeAny(printTitleRows.makeStringAndClear());
++
++    table::CellRangeAddress titleRows = xPrintAreas->getTitleRows();
++    printTitleRows.appendAscii("$").append(rtl::OUString::valueOf(titleRows.StartRow+1)).appendAscii(":$").append(rtl::OUString::valueOf(titleRows.EndRow+1));
++
++    return uno::makeAny(printTitleRows.makeStringAndClear());
++}
++
++void SAL_CALL ScVbaPageSetup::setPrintTitleRows( const uno::Any& printTitleRows) throw (css::uno::RuntimeException)
++{
++    // TODO
++    rtl::OUString sPrintTitleRows;
++    uno::Reference< sheet::XPrintAreas > xPrintAreas( mxSheet, uno::UNO_QUERY_THROW );
++    try
++    {
++        //sal_Bool b
++    }
++    catch( uno::Exception& )
++    {
++    }
++
++}
++
++uno::Any SAL_CALL ScVbaPageSetup::getPrintTitleColumns() throw (css::uno::RuntimeException)
++{
++    // TODO
++    return aNULL();
++}
++
++void SAL_CALL ScVbaPageSetup::setPrintTitleColumns( const uno::Any& printTitleColumns) throw (css::uno::RuntimeException)
++{
++    // TODO
++}
++
++sal_Bool SAL_CALL ScVbaPageSetup::getPrintGridlines() throw (css::uno::RuntimeException)
++{
++    // TODO
++    return 0;
++}
++
++void SAL_CALL ScVbaPageSetup::setPrintGridlines( sal_Bool printGridlines) throw (css::uno::RuntimeException)
++{
++    // TODO
++}
++
++sal_Bool SAL_CALL ScVbaPageSetup::getPrintDraft() throw (css::uno::RuntimeException)
++{
++    // TODO
++    return 0;
++}
++
++void SAL_CALL ScVbaPageSetup::setPrintDraft( sal_Bool printDraft) throw (css::uno::RuntimeException)
++{
++    // TODO
 +}
 +
 +rtl::OUString& 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]