ooo-build r13046 - trunk/patches/vba



Author: pflin
Date: Thu Jul  3 11:40:27 2008
New Revision: 13046
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13046&view=rev

Log:
Forget add the patch


Added:
   trunk/patches/vba/vba-pagebreak-object.diff

Added: trunk/patches/vba/vba-pagebreak-object.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-pagebreak-object.diff	Thu Jul  3 11:40:27 2008
@@ -0,0 +1,840 @@
+--- oovbaapi/org/openoffice/excel/XWorksheet.idl.orig	2008-07-03 10:19:08.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XWorksheet.idl	2008-07-03 18:56:26.000000000 +0800
+@@ -52,6 +52,7 @@ interface XComments;
+ interface XRange;
+ interface XOutline;
+ interface XPageSetup;
++interface XHPageBreaks;
+ interface XWorksheet
+ {
+ 	interface ::org::openoffice::vba::XHelperInterface;
+@@ -85,6 +86,7 @@ interface XWorksheet
+ 	any Comments([in] any Index);
+ 	XOutline Outline();
+ 	XPageSetup PageSetup();
++	XHPageBreaks HPageBreaks();
+ 	any OLEObjects([in] any Index);
+ 	void ShowDataForm();
+ 	any Shapes([in] any Index);
+--- oovbaapi/org/openoffice/excel/makefile.mk.orig	2008-07-03 10:19:08.000000000 +0800
++++ oovbaapi/org/openoffice/excel/makefile.mk	2008-07-03 18:56:26.000000000 +0800
+@@ -95,6 +95,9 @@ IDLFILES= XApplication.idl\
+  	XHyperlink.idl \
+  	Hyperlink.idl \
+  	XPageSetup.idl \
++ 	XPageBreak.idl \
++ 	XHPageBreak.idl \
++ 	XHPageBreaks.idl \
+ 
+ 
+ # ------------------------------------------------------------------
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XHPageBreak.idl	2008-07-03 18:56:26.000000000 +0800
+@@ -0,0 +1,55 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile$
++ * $Revision$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef __org_openoffice_excel_XHPageBreak_idl__
++#define __org_openoffice_excel_XHPageBreak_idl__
++
++#ifndef __org_openoffice_excel_XPageBreak_idl__
++#include <org/openoffice/excel/XPageBreak.idl>
++#endif
++
++
++//=============================================================================
++
++module org {  module openoffice {  module excel { 
++
++//=============================================================================
++
++interface XHPageBreak
++{
++	interface ::org::openoffice::excel::XPageBreak;
++};
++
++//=============================================================================
++
++}; }; };
++
++#endif
++
++
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XHPageBreaks.idl	2008-07-03 18:56:26.000000000 +0800
+@@ -0,0 +1,71 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile$
++ * $Revision$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef __org_openoffice_excel_XHPageBreaks_idl__
++#define __org_openoffice_excel_XHPageBreaks_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++#ifndef __org_openoffice_vba_XHelperInterface_idl__
++#include <org/openoffice/vba/XHelperInterface.idl>
++#endif
++
++#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
++#include <com/sun/star/script/BasicErrorException.idl>
++#endif
++
++//=============================================================================
++
++module org {  module openoffice {  module excel { 
++
++//=============================================================================
++
++interface XHPageBreak;
++
++interface XHPageBreaks
++{
++
++	interface ::org::openoffice::vba::XHelperInterface;
++
++	//Methods	
++    XHPageBreak Add([in] any Before) raises(com::sun::star::script::BasicErrorException);
++	long Count() raises(com::sun::star::script::BasicErrorException);
++    XHPageBreak Item([in] long index)raises(com::sun::star::script::BasicErrorException);
++
++};
++
++//=============================================================================
++
++}; }; };
++
++#endif
++
++
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XPageBreak.idl	2008-07-03 18:56:26.000000000 +0800
+@@ -0,0 +1,73 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile$
++ * $Revision$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef __org_openoffice_excel_XPageBreak_idl__
++#define __org_openoffice_excel_XPageBreak_idl__
++
++#ifndef __com_sun_star_uno_XInterface_idl__
++#include <com/sun/star/uno/XInterface.idl>
++#endif
++
++#ifndef __org_openoffice_vba_XHelperInterface_idl__
++#include <org/openoffice/vba/XHelperInterface.idl>
++#endif
++
++#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
++#include <com/sun/star/script/BasicErrorException.idl>
++#endif
++
++//=============================================================================
++
++module org {  module openoffice {  module excel { 
++
++//=============================================================================
++
++interface XRange;
++
++interface XPageBreak
++{
++
++	interface ::org::openoffice::vba::XHelperInterface;
++
++    // Attributes
++    [attribute] long Type;
++    
++	//Methods	
++	void Delete() raises(com::sun::star::script::BasicErrorException);
++    XRange Location()raises(com::sun::star::script::BasicErrorException);
++
++};
++
++//=============================================================================
++
++}; }; };
++
++#endif
++
++
+--- sc/source/ui/vba/vbaworksheet.hxx.orig	2008-07-03 10:19:08.000000000 +0800
++++ sc/source/ui/vba/vbaworksheet.hxx	2008-07-03 18:56:26.000000000 +0800
+@@ -43,6 +43,7 @@
+ #include <com/sun/star/frame/XModel.hpp>
+ #include <org/openoffice/excel/XOutline.hpp>
+ #include <org/openoffice/excel/XPageSetup.hpp>
++#include <org/openoffice/excel/XHPageBreaks.hpp>
+ #include <org/openoffice/excel/XChartObjects.hpp>
+ 
+ #include "vbahelperinterface.hxx"
+@@ -91,6 +92,7 @@ public:
+ 	virtual css::uno::Any SAL_CALL ChartObjects( const css::uno::Any& Index ) throw (css::uno::RuntimeException);
+ 	virtual css::uno::Reference< oo::excel::XOutline > SAL_CALL Outline( ) throw (css::uno::RuntimeException);
+ 	virtual css::uno::Reference< oo::excel::XPageSetup > SAL_CALL PageSetup( ) throw (css::uno::RuntimeException);
++	virtual css::uno::Reference< oo::excel::XHPageBreaks > SAL_CALL HPageBreaks( ) throw (css::uno::RuntimeException);
+ 	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);
+ 
+--- sc/source/ui/vba/vbaworksheet.cxx.orig	2008-07-03 19:16:19.000000000 +0800
++++ sc/source/ui/vba/vbaworksheet.cxx	2008-07-03 19:16:19.000000000 +0800
+@@ -47,6 +47,7 @@
+ #include <com/sun/star/sheet/XSheetPastable.hpp>
+ #include <com/sun/star/sheet/XCellAddressable.hpp>
+ #include <com/sun/star/sheet/XSheetOutline.hpp>
++#include <com/sun/star/sheet/XSheetPageBreak.hpp>
+ #include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
+ #include <com/sun/star/util/XURLTransformer.hpp>
+ #include <com/sun/star/frame/XDispatchProvider.hpp>
+@@ -86,6 +87,7 @@
+ #include "vbaoleobjects.hxx"
+ #include "vbashapes.hxx"
+ #include "vbapagesetup.hxx"
++#include "vbapagebreaks.hxx"
+ 
+ #define STANDARDWIDTH 2267
+ #define STANDARDHEIGHT 427
+@@ -274,6 +276,13 @@ ScVbaWorksheet::PageSetup( ) throw (uno:
+ 	return new ScVbaPageSetup( this, mxContext, getSheet(), getModel() );
+ }
+ 
++uno::Reference< excel::XHPageBreaks >
++ScVbaWorksheet::HPageBreaks( ) throw (uno::RuntimeException)
++{
++    uno::Reference< sheet::XSheetPageBreak > xSheetPageBreak(getSheet(),uno::UNO_QUERY_THROW);
++	return new ScVbaHPageBreaks( this, mxContext, xSheetPageBreak);
++}
++
+ sal_Int32 
+ ScVbaWorksheet::getStandardWidth() throw (uno::RuntimeException)
+ {
+--- sc/source/ui/vba/makefile.mk.orig	2008-07-03 18:55:34.000000000 +0800
++++ sc/source/ui/vba/makefile.mk	2008-07-03 19:10:53.000000000 +0800
+@@ -127,6 +127,8 @@ SLOFILES= \
+                 $(SLO)$/vbacommandbars.obj \
+         $(SLO)$/vbahyperlink.obj \
+         $(SLO)$/vbapagesetup.obj \
++        $(SLO)$/vbapagebreak.obj \
++        $(SLO)$/vbapagebreaks.obj \
+         $(SLO)$/vbaspinbutton.obj \
+ 		$(SLO)$/service.obj \
+         $(SLO)$/vbaeventshelper.obj \
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ sc/source/ui/vba/vbapagebreak.hxx	2008-07-03 18:56:26.000000000 +0800
+@@ -0,0 +1,87 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile$
++ * $Revision$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_PAGEBREAK_HXX
++#define SC_VBA_PAGEBREAK_HXX
++
++#include <cppuhelper/implbase1.hxx>
++#include <org/openoffice/excel/XPageBreak.hpp>
++#include <org/openoffice/excel/XHPageBreak.hpp>
++#include <org/openoffice/excel/XRange.hpp>
++#include <com/sun/star/uno/XComponentContext.hpp>
++#include <com/sun/star/script/BasicErrorException.hpp>
++#include <com/sun/star/sheet/TablePageBreakData.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include "vbahelperinterface.hxx"
++
++template< typename Ifc1 >
++class ScVbaPageBreak : public InheritedHelperInterfaceImpl1< Ifc1 >
++{
++typedef InheritedHelperInterfaceImpl1< Ifc1 > ScVbaPageBreak_BASE;
++protected:
++    css::sheet::TablePageBreakData maTablePageBreakData;
++	css::uno::Reference< css::beans::XPropertySet > mxRowColPropertySet;
++public:
++	ScVbaPageBreak( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, 
++                    const css::uno::Reference< css::uno::XComponentContext >& xContext,
++            		css::uno::Reference< css::beans::XPropertySet >& xProps,
++                    css::sheet::TablePageBreakData aTablePageBreakData) throw (css::uno::RuntimeException);
++	virtual ~ScVbaPageBreak(){}
++	
++	virtual sal_Int32 SAL_CALL getType( ) throw (css::uno::RuntimeException);
++    virtual void SAL_CALL setType(sal_Int32 type) throw (css::uno::RuntimeException);
++
++    virtual void SAL_CALL Delete() throw ( css::script::BasicErrorException, css::uno::RuntimeException);
++    virtual css::uno::Reference< oo::excel::XRange> SAL_CALL Location() throw ( css::script::BasicErrorException, css::uno::RuntimeException);
++
++	// XHelperInterface
++	virtual rtl::OUString& getServiceImplName();
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++
++
++typedef ScVbaPageBreak < oo::excel::XHPageBreak > ScVbaHPageBreak_BASE;
++
++class ScVbaHPageBreak :  public ScVbaHPageBreak_BASE
++{
++public:
++	ScVbaHPageBreak( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, 
++                    const css::uno::Reference< css::uno::XComponentContext >& xContext,
++            		css::uno::Reference< css::beans::XPropertySet >& xProps,
++                    css::sheet::TablePageBreakData aTablePageBreakData) throw (css::uno::RuntimeException):
++              ScVbaHPageBreak_BASE( xParent,xContext,xProps,aTablePageBreakData ){}
++            
++	virtual ~ScVbaHPageBreak(){}
++	
++	// XHelperInterface
++	virtual rtl::OUString& getServiceImplName();
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++
++#endif
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ sc/source/ui/vba/vbapagebreak.cxx	2008-07-03 18:56:26.000000000 +0800
+@@ -0,0 +1,144 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile$
++ * $Revision$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include "vbapagebreak.hxx"
++#include "vbarange.hxx"
++#include <org/openoffice/excel/XlPageBreak.hpp>
++using namespace ::com::sun::star;
++using namespace ::org::openoffice;
++
++template< typename Ifc1 >
++ScVbaPageBreak<Ifc1>::ScVbaPageBreak( const uno::Reference< vba::XHelperInterface >& xParent, 
++                    const uno::Reference< uno::XComponentContext >& xContext,
++            		uno::Reference< beans::XPropertySet >& xProps,
++                    sheet::TablePageBreakData aTablePageBreakData) throw (uno::RuntimeException):
++            ScVbaPageBreak_BASE( xParent, xContext ),
++            mxRowColPropertySet( xProps ),
++            maTablePageBreakData( aTablePageBreakData )
++{
++}
++
++template< typename Ifc1 >
++sal_Int32 ScVbaPageBreak<Ifc1>::getType() throw (uno::RuntimeException) 
++{
++    uno::Any aValue = mxRowColPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )));
++    sal_Bool hasPageBreak = sal_False;
++    aValue >>= hasPageBreak;
++
++    if( !hasPageBreak )
++        return excel::XlPageBreak::xlPageBreakNone;
++    
++    if( maTablePageBreakData.ManualBreak )
++        return excel::XlPageBreak::xlPageBreakManual;
++    
++    return excel::XlPageBreak::xlPageBreakAutomatic;
++}
++
++template< typename Ifc1 >
++void ScVbaPageBreak<Ifc1>::setType(sal_Int32 type) throw (uno::RuntimeException) 
++{
++    if( (type != excel::XlPageBreak::xlPageBreakNone) && 
++        (type != excel::XlPageBreak::xlPageBreakManual) &&
++        (type != excel::XlPageBreak::xlPageBreakAutomatic) )
++    {
++        DebugHelper::exception(SbERR_BAD_PARAMETER, rtl::OUString() );
++    }
++
++    if( type == excel::XlPageBreak::xlPageBreakNone )
++    {
++        mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_False));
++        return;
++    }
++
++    mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_True));
++    if( type == excel::XlPageBreak::xlPageBreakManual )
++        maTablePageBreakData.ManualBreak = sal_True;
++    else
++        maTablePageBreakData.ManualBreak = sal_False;
++}
++
++template< typename Ifc1 >
++void ScVbaPageBreak<Ifc1>::Delete() throw ( script::BasicErrorException, uno::RuntimeException)
++{
++    mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_False));
++}
++
++template< typename Ifc1 >
++uno::Reference< excel::XRange> ScVbaPageBreak<Ifc1>::Location() throw ( script::BasicErrorException, uno::RuntimeException)
++{
++    // FIXME
++    uno::Reference< table::XCellRange > xRange( mxRowColPropertySet, uno::UNO_QUERY_THROW );
++    
++    //return new ScVbaRange( getParent(), mxContext, xRange);
++    return NULL;
++}
++
++template< typename Ifc1 >
++rtl::OUString& 
++ScVbaPageBreak<Ifc1>::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPageBreak") );
++	return sImplName;
++}
++
++template< typename Ifc1 >
++uno::Sequence< rtl::OUString > 
++ScVbaPageBreak<Ifc1>::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.PageBreak" ) );
++	}
++	return aServiceNames;
++}
++
++template class ScVbaPageBreak< excel::XHPageBreak >;
++
++/* class ScVbaHPageBreak */
++rtl::OUString& 
++ScVbaHPageBreak::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaHPageBreak") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaHPageBreak::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.HPageBreak" ) );
++	}
++	return aServiceNames;
++}
++
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ sc/source/ui/vba/vbapagebreaks.hxx	2008-07-03 18:56:26.000000000 +0800
+@@ -0,0 +1,106 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile$
++ * $Revision$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#ifndef SC_VBA_PAGEBREAKS_HXX
++#define SC_VBA_PAGEBREAKS_HXX
++
++#include <cppuhelper/implbase1.hxx>
++#include <org/openoffice/excel/XHPageBreaks.hpp>
++#include <org/openoffice/excel/XHPageBreak.hpp>
++#include <org/openoffice/excel/XRange.hpp>
++#include <com/sun/star/uno/XComponentContext.hpp>
++#include <com/sun/star/script/BasicErrorException.hpp>
++#include <com/sun/star/sheet/XSheetPageBreak.hpp>
++#include <com/sun/star/sheet/TablePageBreakData.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/container/XIndexAccess.hpp>
++#include <com/sun/star/table/XColumnRowRange.hpp>
++#include "vbahelperinterface.hxx"
++
++class RangePageBreak
++{
++public:
++   css::uno::Reference< css::beans::XPropertySet > mxRowColPropertySet; 
++   css::sheet::TablePageBreakData maTablePageBreakData;
++   RangePageBreak(){};
++   RangePageBreak( css::uno::Reference< css::beans::XPropertySet >& xProps, css::sheet::TablePageBreakData aTablePageBreakData ):
++                mxRowColPropertySet( xProps ), maTablePageBreakData(aTablePageBreakData){};
++};
++
++class ScVbaPageBreaks
++{
++private:
++    const css::uno::Reference< oo::vba::XHelperInterface > mxParent;
++protected:
++	css::uno::Reference< css::sheet::XSheetPageBreak > mxSheetPageBreak;
++	css::uno::Reference< css::table::XColumnRowRange > mxColumnRowRange;
++
++    ScVbaPageBreaks(const css::uno::Reference< oo::vba::XHelperInterface >& xParent, css::uno::Reference< css::sheet::XSheetPageBreak >& xSheetPageBreak) throw (css::uno::RuntimeException);
++    virtual ~ScVbaPageBreaks(){};
++
++    virtual sal_Int32 getAPIStartofRange( const css::uno::Reference< oo::excel::XRange >& xRange ) throw (css::uno::RuntimeException) = 0;
++    virtual sal_Int32 getAPIEndIndexofRange( const css::uno::Reference< oo::excel::XRange >& xRange, sal_Int32 nUsedStart ) throw (css::uno::RuntimeException) = 0;
++    virtual css::uno::Sequence<css::sheet::TablePageBreakData> getAllPageBreaks() = 0;
++    virtual css::uno::Reference<css::container::XIndexAccess> getRowColContainer() = 0;
++
++    RangePageBreak getRangePageBreak( const css::uno::Any& Before ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
++    RangePageBreak getRangePageBreak( sal_Int32 nIndex ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
++    css::sheet::TablePageBreakData getTablePageBreakData( sal_Int32 nIndex ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
++
++public:    
++    virtual sal_Int32 SAL_CALL Count() throw ( css::script::BasicErrorException, css::uno::RuntimeException);
++};
++
++typedef InheritedHelperInterfaceImpl1< oo::excel::XHPageBreaks > ScVbaHPageBreaks_BASE;
++
++class ScVbaHPageBreaks : public ScVbaHPageBreaks_BASE, ScVbaPageBreaks
++{
++public:
++	ScVbaHPageBreaks( const css::uno::Reference< oo::vba::XHelperInterface >& xParent, 
++                    const css::uno::Reference< css::uno::XComponentContext >& xContext,
++            		css::uno::Reference< css::sheet::XSheetPageBreak >& xSheetPageBreak) throw (css::uno::RuntimeException);
++	virtual ~ScVbaHPageBreaks(){}
++	
++    virtual sal_Int32 getAPIStartofRange( const css::uno::Reference< oo::excel::XRange >& xRange ) throw (css::uno::RuntimeException);
++    virtual sal_Int32 getAPIEndIndexofRange( const css::uno::Reference< oo::excel::XRange >& xRange, sal_Int32 nUsedStart ) throw (css::uno::RuntimeException);
++    virtual css::uno::Sequence<css::sheet::TablePageBreakData> getAllPageBreaks();
++    virtual css::uno::Reference<css::container::XIndexAccess> getRowColContainer();
++
++    // XHPageBreaks 
++    virtual css::uno::Reference<oo::excel::XHPageBreak>  SAL_CALL Add( const css::uno::Any& Before) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
++    virtual css::uno::Reference<oo::excel::XHPageBreak> SAL_CALL Item( sal_Int32 index ) throw ( css::script::BasicErrorException, css::uno::RuntimeException);
++    virtual sal_Int32 SAL_CALL Count() throw ( css::script::BasicErrorException, css::uno::RuntimeException);
++
++    
++	// XHelperInterface
++	virtual rtl::OUString& getServiceImplName();
++	virtual css::uno::Sequence<rtl::OUString> getServiceNames();
++};
++
++#endif
+--- /dev/null	2008-06-07 04:36:48.000000000 +0800
++++ sc/source/ui/vba/vbapagebreaks.cxx	2008-07-03 18:56:26.000000000 +0800
+@@ -0,0 +1,192 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ * 
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile$
++ * $Revision$
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org.  If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++#include "vbapagebreaks.hxx"
++#include "vbapagebreak.hxx"
++#include <org/openoffice/excel/XWorksheet.hpp>
++using namespace ::com::sun::star;
++using namespace ::org::openoffice;
++
++ScVbaPageBreaks::ScVbaPageBreaks( const uno::Reference< vba::XHelperInterface >& xParent,
++                                  uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak) throw (uno::RuntimeException):
++                        mxParent(xParent), mxSheetPageBreak(xSheetPageBreak)
++{
++    mxColumnRowRange.set( mxSheetPageBreak, uno::UNO_QUERY_THROW );
++}
++
++sal_Int32 SAL_CALL ScVbaPageBreaks::Count() throw ( script::BasicErrorException, uno::RuntimeException)
++{
++    sal_Int32 nCount = 0;
++    uno::Reference< excel::XWorksheet > xWorksheet( mxParent, uno::UNO_QUERY_THROW );
++    uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange();
++    sal_Int32 nUsedStart = getAPIStartofRange( xRange );
++    sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart );
++    uno::Sequence<sheet::TablePageBreakData> aTablePageBreakData = getAllPageBreaks();
++
++    sal_Int32 nLength = aTablePageBreakData.getLength();
++    for( sal_Int32 i=0; i<nLength; i++ )
++    {
++        sal_Int32 nPos = aTablePageBreakData[i].Position;
++        if( nPos > nUsedEnd )
++            return nCount;
++        if( nPos >= nUsedStart )
++            nCount++;
++    }
++
++    return nCount;
++}
++
++RangePageBreak ScVbaPageBreaks::getRangePageBreak( const css::uno::Any& Before ) throw ( css::script::BasicErrorException, css::uno::RuntimeException)
++{
++    uno::Reference< excel::XRange > xRange;
++    Before >>= xRange;
++    if( xRange.is() )
++    {
++        sal_Int32 nAPIRowColIndex = getAPIStartofRange( xRange );
++        uno::Reference< container::XIndexAccess > xIndexAccess = getRowColContainer();
++        uno::Reference< beans::XPropertySet > xRowColPropertySet( xIndexAccess->getByIndex(nAPIRowColIndex), uno::UNO_QUERY_THROW );
++        sheet::TablePageBreakData aPageBreakData;
++        aPageBreakData.ManualBreak = sal_True;
++        aPageBreakData.Position = nAPIRowColIndex;
++        RangePageBreak aRangepageBreak(xRowColPropertySet, aPageBreakData);
++        return aRangepageBreak;
++    }
++    DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
++    return RangePageBreak();
++}
++
++RangePageBreak ScVbaPageBreaks::getRangePageBreak( sal_Int32 nIndex ) throw ( css::script::BasicErrorException, css::uno::RuntimeException)
++{
++    if( (nIndex < Count()) && ( nIndex > 0 ))
++    {
++        sheet::TablePageBreakData aTablePageBreakData = getTablePageBreakData(nIndex - 1);
++        uno::Reference< container::XIndexAccess > xIndexAccess = getRowColContainer();
++        sal_Int32 nPos = aTablePageBreakData.Position;
++        if( (nPos < xIndexAccess->getCount()) && (nPos > -1) )
++        {
++            uno::Reference< beans::XPropertySet > xRowColPropertySet( xIndexAccess->getByIndex(nPos), uno::UNO_QUERY_THROW );
++            RangePageBreak aRangepageBreak(xRowColPropertySet, aTablePageBreakData);
++            return aRangepageBreak;
++        }
++    }
++    DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
++    return RangePageBreak();
++}
++
++sheet::TablePageBreakData ScVbaPageBreaks::getTablePageBreakData( sal_Int32 nAPIItemIndex ) throw ( script::BasicErrorException, uno::RuntimeException)
++{
++    sal_Int32 index = 0;
++    sheet::TablePageBreakData aTablePageBreakData;
++    uno::Reference< excel::XWorksheet > xWorksheet( mxParent, uno::UNO_QUERY_THROW );
++    uno::Reference< excel::XRange > xRange = xWorksheet->getUsedRange();
++    sal_Int32 nUsedStart = getAPIStartofRange( xRange );
++    sal_Int32 nUsedEnd = getAPIEndIndexofRange( xRange, nUsedStart );
++    uno::Sequence<sheet::TablePageBreakData> aTablePageBreakDataList = getAllPageBreaks();
++
++    sal_Int32 nLength = aTablePageBreakDataList.getLength();
++    for( sal_Int32 i=0; i<nLength; i++ )
++    {
++        aTablePageBreakData = aTablePageBreakDataList[i];
++        sal_Int32 nPos = aTablePageBreakData.Position;
++        if( nPos >= nUsedStart )
++            index++;
++        if( nPos > nUsedEnd )
++            DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
++        if( index == nAPIItemIndex )
++            return aTablePageBreakData;
++    }
++
++    return aTablePageBreakData;
++}
++
++ScVbaHPageBreaks::ScVbaHPageBreaks( const uno::Reference< vba::XHelperInterface >& xParent, 
++                                    const uno::Reference< uno::XComponentContext >& xContext,
++            		                uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak) throw (uno::RuntimeException):
++                          ScVbaHPageBreaks_BASE( xParent,xContext),ScVbaPageBreaks(xParent, xSheetPageBreak)
++{
++}
++
++sal_Int32 ScVbaHPageBreaks::getAPIStartofRange( const uno::Reference< excel::XRange >& xRange ) throw (uno::RuntimeException)
++{
++    return xRange->getRow() - 1;
++}
++sal_Int32 ScVbaHPageBreaks::getAPIEndIndexofRange( const uno::Reference< excel::XRange >& xRange, sal_Int32 nUsedStart ) throw (uno::RuntimeException)
++{
++    return nUsedStart + xRange->Rows( aNULL() )->getCount();
++}
++
++uno::Sequence<sheet::TablePageBreakData> ScVbaHPageBreaks::getAllPageBreaks()
++{
++    return mxSheetPageBreak->getRowPageBreaks();
++}
++
++uno::Reference<container::XIndexAccess> ScVbaHPageBreaks::getRowColContainer()
++{
++    uno::Reference<container::XIndexAccess> xIndexAccess( mxColumnRowRange->getRows(), uno::UNO_QUERY );
++    return xIndexAccess;
++}
++
++uno::Reference<excel::XHPageBreak> ScVbaHPageBreaks::Add( const uno::Any& Before) throw ( script::BasicErrorException, uno::RuntimeException)
++{
++    RangePageBreak aRangePageBreak = getRangePageBreak( Before );
++    aRangePageBreak.mxRowColPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsStartOfNewPage" )), uno::makeAny(sal_True));
++    return new ScVbaHPageBreak(getParent(), mxContext, aRangePageBreak.mxRowColPropertySet, aRangePageBreak.maTablePageBreakData);
++}
++
++
++uno::Reference<excel::XHPageBreak> ScVbaHPageBreaks::Item( sal_Int32 index ) throw ( script::BasicErrorException, uno::RuntimeException)
++{
++    RangePageBreak aRangePageBreak = getRangePageBreak( index );
++    return new ScVbaHPageBreak(getParent(), mxContext, aRangePageBreak.mxRowColPropertySet, aRangePageBreak.maTablePageBreakData);
++}
++
++sal_Int32 SAL_CALL ScVbaHPageBreaks::Count() throw ( script::BasicErrorException, uno::RuntimeException)
++{
++    return ScVbaPageBreaks::Count();
++}
++
++rtl::OUString& 
++ScVbaHPageBreaks::getServiceImplName()
++{
++	static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaHPageBreaks") );
++	return sImplName;
++}
++
++uno::Sequence< rtl::OUString > 
++ScVbaHPageBreaks::getServiceNames()
++{
++	static uno::Sequence< rtl::OUString > aServiceNames;
++	if ( aServiceNames.getLength() == 0 )
++	{
++		aServiceNames.realloc( 1 );
++		aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.excel.HPageBreaks" ) );
++	}
++	return aServiceNames;
++}
++



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