diff options
Diffstat (limited to 'patches/vba/vba-word-support-part2.diff')
-rw-r--r-- | patches/vba/vba-word-support-part2.diff | 23674 |
1 files changed, 0 insertions, 23674 deletions
diff --git a/patches/vba/vba-word-support-part2.diff b/patches/vba/vba-word-support-part2.diff deleted file mode 100644 index fdecccf06..000000000 --- a/patches/vba/vba-word-support-part2.diff +++ /dev/null @@ -1,23674 +0,0 @@ ---- forms/source/component/ListBox.cxx -+++ forms/source/component/ListBox.cxx -@@ -1514,6 +1514,8 @@ namespace frm - void SAL_CALL OListBoxControl::itemStateChanged(const ItemEvent& _rEvent) throw(RuntimeException) - { - // forward this to our listeners -+ Reference< XChild > xChild( getModel(), UNO_QUERY ); -+ if ( xChild.is() && xChild->getParent().is() ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( m_aItemListeners.getLength() ) -@@ -1526,6 +1528,8 @@ namespace frm - m_pItemBroadcaster->addEvent( new ItemEventDescription( _rEvent ), this ); - } - } -+ else -+ m_aItemListeners.notifyEach( &XItemListener::itemStateChanged, _rEvent ); - - // and do the handling for the ChangeListeners - ::osl::ClearableMutexGuard aGuard(m_aMutex); -diff --git oovbaapi/ooo/vba/XApplicationBase.idl oovbaapi/ooo/vba/XApplicationBase.idl -index bd2fa27..38efadd 100644 ---- oovbaapi/ooo/vba/XApplicationBase.idl -+++ oovbaapi/ooo/vba/XApplicationBase.idl -@@ -52,8 +52,11 @@ interface XApplicationBase - - [attribute] boolean ScreenUpdating; - [attribute] boolean DisplayStatusBar; -+ [attribute, readonly] string Version; - - any CommandBars( [in] any aIndex ); -+ void Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30); -+ float CentimetersToPoints([in] float Centimeters ); - }; - - }; }; -diff --git oovbaapi/ooo/vba/XDialogBase.idl oovbaapi/ooo/vba/XDialogBase.idl -new file mode 100644 -index 0000000..550c50f ---- /dev/null -+++ oovbaapi/ooo/vba/XDialogBase.idl -@@ -0,0 +1,58 @@ -+/************************************************************************* -+ * -+ * 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: XDialog.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __ooo_vba_XDialog_idl__ -+#define __ooo_vba_XDialog_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { -+ -+//============================================================================= -+ -+interface XDialogBase -+{ -+ interface ::ooo::vba::XHelperInterface; -+ -+ void Show(); -+}; -+ -+}; }; -+ -+#endif -+ -diff --git oovbaapi/ooo/vba/XDialogsBase.idl oovbaapi/ooo/vba/XDialogsBase.idl -new file mode 100644 -index 0000000..14feec4 ---- /dev/null -+++ oovbaapi/ooo/vba/XDialogsBase.idl -@@ -0,0 +1,60 @@ -+/************************************************************************* -+ * -+ * 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: XDialogs.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __ooo_vba_XDialogs_idl__ -+#define __ooo_vba_XDialogs_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+//============================================================================= -+ -+module ooo { module vba { -+ -+//interface XDialogs : ::ooo::vba::XCollection -+interface XDialogsBase -+{ -+ interface ::ooo::vba::XHelperInterface; -+ -+ [attribute, readonly] long Count; -+ any Item( [in] any Index ); -+}; -+ -+}; }; -+ -+#endif -+ -diff --git oovbaapi/ooo/vba/XDocumentsBase.idl oovbaapi/ooo/vba/XDocumentsBase.idl -new file mode 100644 -index 0000000..33de551 ---- /dev/null -+++ oovbaapi/ooo/vba/XDocumentsBase.idl -@@ -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: XDocumentsBase.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __ooo_vba_XDocumentsBase_idl__ -+#define __ooo_vba_XDocumentsBase_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { -+ -+//============================================================================= -+ -+interface XDocumentsBase -+{ -+ interface ::ooo::vba::XCollection; -+}; -+ -+}; }; -+ -+#endif -diff --git oovbaapi/ooo/vba/XFontBase.idl oovbaapi/ooo/vba/XFontBase.idl -new file mode 100644 -index 0000000..c2fe1c5 ---- /dev/null -+++ oovbaapi/ooo/vba/XFontBase.idl -@@ -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: XFont.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __ooo_vba_XFont_idl__ -+#define __ooo_vba_XFont_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__ -+#include <com/sun/star/lang/IndexOutOfBoundsException.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+//============================================================================= -+ -+module ooo { module vba { -+ -+interface XFontBase -+{ -+ interface ::ooo::vba::XHelperInterface; -+ -+ [attribute] any Size; -+ [attribute] any ColorIndex; -+ [attribute] any Color; -+ [attribute] any Bold; -+ [attribute] any Underline; -+ [attribute] any Strikethrough; -+ [attribute] any Shadow; -+ [attribute] any Italic; -+ [attribute] any Subscript; -+ [attribute] any Superscript; -+ [attribute] any Name; -+}; -+ -+//============================================================================= -+ -+}; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/XPageSetupBase.idl oovbaapi/ooo/vba/XPageSetupBase.idl -new file mode 100644 -index 0000000..c79f831 ---- /dev/null -+++ oovbaapi/ooo/vba/XPageSetupBase.idl -@@ -0,0 +1,67 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_XPageSetupBase_idl__ -+#define __ooo_vba_XPageSetupBase_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+//============================================================================= -+ -+module ooo { module vba { -+ -+//============================================================================= -+ -+ -+interface XPageSetupBase -+{ -+ -+ interface ::ooo::vba::XHelperInterface; -+ -+ //Attributes -+ [attribute] double TopMargin; -+ [attribute] double BottomMargin; -+ [attribute] double RightMargin; -+ [attribute] double LeftMargin; -+ [attribute] long Orientation; -+}; -+ -+//============================================================================= -+ -+}; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/excel/TextFrame.idl oovbaapi/ooo/vba/excel/TextFrame.idl -new file mode 100644 -index 0000000..f6fb5cb ---- /dev/null -+++ oovbaapi/ooo/vba/excel/TextFrame.idl -@@ -0,0 +1,53 @@ -+/************************************************************************* -+ * -+ * OpenOffice.org - a multi-platform office productivity suite -+ * -+ * $RCSfile$ -+ * -+ * $Revision$ -+ * -+ * last change: $Author$ $Date$ -+ * -+ * The Contents of this file are made available subject to -+ * the terms of GNU Lesser General Public License Version 2.1. -+ * -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2005 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library 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 for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ ************************************************************************/ -+ -+#ifndef __ooo_vba_excel_TextFrame_idl__ -+#define __ooo_vba_excel_TextFrame_idl__ -+ -+#ifndef __ooo_vba_excel_XTextFrame_idl__ -+#include <ooo/vba/excel/XTextFrame.idl> -+#endif -+ -+#include <com/sun/star/uno/XComponentContext.idl> -+ -+module ooo { module vba { module excel { -+service TextFrame : XTextFrame -+{ -+ //createTextFrame( [in] ::ooo::vba::XHelperInterface Parent, [in] ::com::sun::star::frame::XModel xModel ); -+}; -+ -+}; }; }; -+ -+#endif -diff --git oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XApplication.idl -index 35c4852..2d903de 100644 ---- oovbaapi/ooo/vba/excel/XApplication.idl -+++ oovbaapi/ooo/vba/excel/XApplication.idl -@@ -75,7 +75,6 @@ interface XApplication : com::sun::star::uno::XInterface - [attribute] any CutCopyMode; - [attribute] any StatusBar; - [attribute] long Cursor; -- [attribute, readonly] string Version; - - void setDefaultFilePath([in] string DefaultFilePath) raises(com::sun::star::script::BasicErrorException); - -diff --git oovbaapi/ooo/vba/excel/XDialog.idl oovbaapi/ooo/vba/excel/XDialog.idl -index da45681..c9900f4 100644 ---- oovbaapi/ooo/vba/excel/XDialog.idl -+++ oovbaapi/ooo/vba/excel/XDialog.idl -@@ -45,13 +45,8 @@ module ooo { module vba { module excel { - - //============================================================================= - --interface XApplication; -- --interface XDialog -+interface XDialog : com::sun::star::uno::XInterface - { -- interface ::ooo::vba::XHelperInterface; -- -- void Show(); - }; - - }; }; }; -diff --git oovbaapi/ooo/vba/excel/XDialogs.idl oovbaapi/ooo/vba/excel/XDialogs.idl -index 0610c44..4632e38 100644 ---- oovbaapi/ooo/vba/excel/XDialogs.idl -+++ oovbaapi/ooo/vba/excel/XDialogs.idl -@@ -33,9 +33,6 @@ - #ifndef __com_sun_star_uno_XInterface_idl__ - #include <com/sun/star/uno/XInterface.idl> - #endif --#ifndef __ooo_vba_XCollection_idl__ --#include <ooo/vba/XCollection.idl> --#endif - - #ifndef __ooo_vba_XHelperInterface_idl__ - #include <ooo/vba/XHelperInterface.idl> -@@ -44,15 +41,9 @@ - //============================================================================= - - module ooo { module vba { module excel { --interface XApplication; --//============================================================================= - --//interface XDialogs : ::ooo::vba::XCollection --interface XDialogs -+interface XDialogs : com::sun::star::uno::XInterface - { -- interface ::ooo::vba::XHelperInterface; -- -- [attribute, readonly] long Count; - - any Item( [in] any Index ); - }; -diff --git oovbaapi/ooo/vba/excel/XFont.idl oovbaapi/ooo/vba/excel/XFont.idl -index c03d84a..40396b8 100644 ---- oovbaapi/ooo/vba/excel/XFont.idl -+++ oovbaapi/ooo/vba/excel/XFont.idl -@@ -47,22 +47,9 @@ module ooo { module vba { module excel { - - interface XFont - { -- interface ::ooo::vba::XHelperInterface; -- -- [attribute] any Size; - [attribute] any StandardFontSize; - [attribute] any StandardFont; - [attribute] any FontStyle; -- [attribute] any ColorIndex; -- [attribute] any Color; -- [attribute] any Bold; -- [attribute] any Underline; -- [attribute] any Strikethrough; -- [attribute] any Shadow; -- [attribute] any Italic; -- [attribute] any Subscript; -- [attribute] any Superscript; -- [attribute] any Name; - [attribute] any OutlineFont; - }; - -diff --git oovbaapi/ooo/vba/excel/XPageSetup.idl oovbaapi/ooo/vba/excel/XPageSetup.idl -index cd15e79..ca210c4 100644 ---- oovbaapi/ooo/vba/excel/XPageSetup.idl -+++ oovbaapi/ooo/vba/excel/XPageSetup.idl -@@ -45,20 +45,15 @@ module ooo { module vba { module excel { - //============================================================================= - - --interface XPageSetup -+interface XPageSetup : com::sun::star::uno::XInterface - { - -- interface ::ooo::vba::XHelperInterface; -+// interface ::ooo::vba::XHelperInterface; - - //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; -diff --git oovbaapi/ooo/vba/excel/XTextFrame.idl oovbaapi/ooo/vba/excel/XTextFrame.idl -index 534b256..4962be5 100644 ---- oovbaapi/ooo/vba/excel/XTextFrame.idl -+++ oovbaapi/ooo/vba/excel/XTextFrame.idl -@@ -34,21 +34,9 @@ - #include <ooo/vba/XHelperInterface.idl> - #endif - --#ifndef __ooo_vba_excel_XCharacters_idl__ --#include <ooo/vba/excel/XCharacters.idl> --#endif -- - module ooo { module vba { module excel { --interface XTextFrame : ooo::vba::XHelperInterface -+interface XTextFrame : com::sun::star::uno::XInterface - { -- [attribute] boolean AutoSize; -- [attribute] float MarginBottom; -- [attribute] float MarginTop; -- [attribute] float MarginLeft; -- [attribute] float MarginRight; -- XCharacters Characters(); -- /*I don't find it in msdn -- Range TextRange();*/ - }; - }; }; }; - #endif -diff --git oovbaapi/ooo/vba/excel/XWorkbooks.idl oovbaapi/ooo/vba/excel/XWorkbooks.idl -index 5521257..77a3020 100644 ---- oovbaapi/ooo/vba/excel/XWorkbooks.idl -+++ oovbaapi/ooo/vba/excel/XWorkbooks.idl -@@ -45,9 +45,8 @@ module ooo { module vba { module excel { - - //============================================================================= - --interface XWorkbooks -+interface XWorkbooks : com::sun::star::uno::XInterface - { -- interface ::ooo::vba::XCollection; - any Add(); - any Open([in] string Filename, [in] any UpdateLinks, [in] any ReadOnly, [in] any Format, [in] any Password, [in] any WriteResPassword, [in] any IgnoreReadOnlyRecommended, [in] any Origin, [in] any Delimiter, [in] any Editable, [in] any Notify, [in] any Converter, [in] any AddToMru); - -diff --git oovbaapi/ooo/vba/excel/makefile.mk oovbaapi/ooo/vba/excel/makefile.mk -index 8ef4294..232f83c 100644 ---- oovbaapi/ooo/vba/excel/makefile.mk -+++ oovbaapi/ooo/vba/excel/makefile.mk -@@ -102,6 +102,7 @@ IDLFILES= XGlobals.idl\ - XHPageBreaks.idl \ - XVPageBreak.idl \ - XVPageBreaks.idl \ -+ TextFrame.idl \ - - - # ------------------------------------------------------------------ -diff --git oovbaapi/ooo/vba/makefile.mk oovbaapi/ooo/vba/makefile.mk -index 2dcc035..f246ce5 100644 ---- oovbaapi/ooo/vba/makefile.mk -+++ oovbaapi/ooo/vba/makefile.mk -@@ -58,9 +58,14 @@ IDLFILES=\ - XApplicationBase.idl\ - XWindowBase.idl\ - XDocumentBase.idl\ -+ XDocumentsBase.idl\ - XGlobalsBase.idl\ - XDocumentProperty.idl\ - XDocumentProperties.idl\ -+ XFontBase.idl\ -+ XDialogsBase.idl\ -+ XDialogBase.idl\ -+ XPageSetupBase.idl \ - - # ------------------------------------------------------------------ - -diff --git oovbaapi/ooo/vba/msforms/XControl.idl oovbaapi/ooo/vba/msforms/XControl.idl -index 086b646..6e08891 100644 ---- oovbaapi/ooo/vba/msforms/XControl.idl -+++ oovbaapi/ooo/vba/msforms/XControl.idl -@@ -61,6 +61,7 @@ interface XControl - [attribute] double Left; - [attribute] double Top; - [attribute] string Name; -+ [attribute] string ControlTipText; - }; - - //============================================================================= -diff --git oovbaapi/ooo/vba/msforms/XShape.idl oovbaapi/ooo/vba/msforms/XShape.idl -index a1ac36d..90047e6 100644 ---- oovbaapi/ooo/vba/msforms/XShape.idl -+++ oovbaapi/ooo/vba/msforms/XShape.idl -@@ -34,10 +34,6 @@ - #include <ooo/vba/XHelperInterface.idl> - #endif - --#ifndef __ooo_vba_excel_XTextFrame_idl__ --#include <ooo/vba/excel/XTextFrame.idl> --#endif -- - #ifndef __ooo_vba_msforms_XLineFormat_idl__ - #include <ooo/vba/msforms/XLineFormat.idl> - #endif -@@ -66,14 +62,13 @@ interface XShape : ooo::vba::XHelperInterface - [attribute, readonly] XLineFormat Line; - [attribute, readonly] XFillFormat Fill; - [attribute, readonly] XPictureFormat PictureFormat; -+ [attribute] boolean LockAspectRatio; -+ [attribute] boolean LockAnchor; -+ [attribute] long RelativeHorizontalPosition; -+ [attribute] long RelativeVerticalPosition; - -- /* -- using in word -- [attribute] RelativeHorizontalPosition -- [attribute] RelativeVerticalPosition -- [attribute] XWrapFormat WrapFormat; -- */ -- ooo::vba::excel::XTextFrame TextFrame(); -+ any TextFrame(); -+ any WrapFormat(); - void Delete(); - void ZOrder( [in] long ZOrderCmd ); - void IncrementRotation( [in] double Increment ); -diff --git oovbaapi/ooo/vba/msforms/XShapeRange.idl oovbaapi/ooo/vba/msforms/XShapeRange.idl -index 1b39485..0ae1883 100644 ---- oovbaapi/ooo/vba/msforms/XShapeRange.idl -+++ oovbaapi/ooo/vba/msforms/XShapeRange.idl -@@ -44,9 +44,25 @@ - - module ooo { module vba { module msforms { - -+interface XLineFormat; -+interface XFillFormat; - interface XShapeRange - { - interface ooo::vba::XCollection; -+ -+ [attribute] double Height; -+ [attribute] double Width; -+ [attribute] double Left; -+ [attribute] double Top; -+ [attribute, readonly] XLineFormat Line; -+ [attribute, readonly] XFillFormat Fill; -+ [attribute] boolean LockAspectRatio; -+ [attribute] boolean LockAnchor; -+ [attribute] long RelativeHorizontalPosition; -+ [attribute] long RelativeVerticalPosition; -+ -+ any TextFrame(); -+ any WrapFormat(); - void Select(); - XShape Group(); - void IncrementRotation( [in] double Increment ); -diff --git oovbaapi/ooo/vba/msforms/XShapes.idl oovbaapi/ooo/vba/msforms/XShapes.idl -index 3ba31ab..7d7e26d 100644 ---- oovbaapi/ooo/vba/msforms/XShapes.idl -+++ oovbaapi/ooo/vba/msforms/XShapes.idl -@@ -51,6 +51,7 @@ interface XShapes - */ - any AddLine( [in] long StartX, [in] long StartY, [in] long endX, [in] long endY ); - any AddShape([in] long ShapeType, [in] long StartX, [in] long StartY, [in] long endX, [in] long endY ); -+ any AddTextbox([in] long Orientation, [in] long Left, [in] long Top, [in] long Width, [in] long Height ); - }; - }; }; }; - -diff --git oovbaapi/ooo/vba/msforms/XTextFrame.idl oovbaapi/ooo/vba/msforms/XTextFrame.idl -new file mode 100644 -index 0000000..b702ecf ---- /dev/null -+++ oovbaapi/ooo/vba/msforms/XTextFrame.idl -@@ -0,0 +1,50 @@ -+/************************************************************************* -+ * -+ * 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: XTextFrame.idl,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 __ooo_vba_msforms_XTextFrame_idl__ -+#define __ooo_vba_msforms_XTextFrame_idl__ -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+module ooo { module vba { module msforms { -+interface XTextFrame : ooo::vba::XHelperInterface -+{ -+ [attribute] boolean AutoSize; -+ [attribute] float MarginBottom; -+ [attribute] float MarginTop; -+ [attribute] float MarginLeft; -+ [attribute] float MarginRight; -+ any Characters(); -+ /*I don't find it in msdn -+ Range TextRange();*/ -+}; -+}; }; }; -+#endif -diff --git oovbaapi/ooo/vba/msforms/makefile.mk oovbaapi/ooo/vba/msforms/makefile.mk -index cd2aa3b..6610d33 100644 ---- oovbaapi/ooo/vba/msforms/makefile.mk -+++ oovbaapi/ooo/vba/msforms/makefile.mk -@@ -66,6 +66,7 @@ IDLFILES=\ - XSpinButton.idl \ - XImage.idl \ - XControls.idl \ -+ XTextFrame.idl \ - - # ------------------------------------------------------------------ - -diff --git oovbaapi/ooo/vba/word/XAddin.idl oovbaapi/ooo/vba/word/XAddin.idl -new file mode 100644 -index 0000000..9854e27 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XAddin.idl -@@ -0,0 +1,61 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XAddin_idl__ -+#define __ooo_vba_word_XAddin_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+#ifndef __com_sun_star_container_XNamed_idl__ -+#include <com/sun/star/container/XNamed.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XAddin -+{ -+ interface ooo::vba::XHelperInterface; -+ interface ::com::sun::star::container::XNamed; -+ -+ [attribute, readonly] string Path; -+ [attribute, readonly] boolean Autoload; -+ [attribute] boolean Installed; -+}; -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XAddins.idl oovbaapi/ooo/vba/word/XAddins.idl -new file mode 100644 -index 0000000..d4b4d1a ---- /dev/null -+++ oovbaapi/ooo/vba/word/XAddins.idl -@@ -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 __ooo_vba_word_XAddins_idl__ -+#define __ooo_vba_word_XAddins_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+//============================================================================= -+ -+interface XAddins -+{ -+ interface ::ooo::vba::XCollection; -+}; -+ -+}; }; }; -+ -+#endif -diff --git oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XApplication.idl -index ae1835b..b3623e4 100644 ---- oovbaapi/ooo/vba/word/XApplication.idl -+++ oovbaapi/ooo/vba/word/XApplication.idl -@@ -53,7 +53,14 @@ interface XApplication : com::sun::star::uno::XInterface - [attribute, readonly] ooo::vba::word::XSystem System; - [attribute, readonly] ooo::vba::word::XOptions Options; - [attribute, readonly] ooo::vba::word::XSelection Selection; -+ [attribute] boolean DisplayAutoCompleteTips; -+ [attribute] long EnableCancelKey; -+ - any CommandBars( [in] any aIndex ); -+ any Documents( [in] any aIndex ); -+ any Addins( [in] any aIndex ); -+ any Dialogs( [in] any aIndex ); -+ float CentimetersToPoints([in] float Centimeters ); - }; - - }; }; }; -diff --git oovbaapi/ooo/vba/word/XAutoTextEntries.idl oovbaapi/ooo/vba/word/XAutoTextEntries.idl -new file mode 100644 -index 0000000..b4bc1e5 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XAutoTextEntries.idl -@@ -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 __ooo_vba_word_XAutoTextEntries_idl__ -+#define __ooo_vba_word_XAutoTextEntries_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+//============================================================================= -+ -+interface XAutoTextEntries -+{ -+ interface ::ooo::vba::XCollection; -+}; -+ -+}; }; }; -+ -+#endif -diff --git oovbaapi/ooo/vba/word/XAutoTextEntry.idl oovbaapi/ooo/vba/word/XAutoTextEntry.idl -new file mode 100644 -index 0000000..37ce701 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XAutoTextEntry.idl -@@ -0,0 +1,59 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XAutoTextEntry_idl__ -+#define __ooo_vba_word_XAutoTextEntry_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+#ifndef __com_sun_star_container_XNamed_idl__ -+#include <com/sun/star/container/XNamed.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XRange; -+interface XAutoTextEntry -+{ -+ interface ooo::vba::XHelperInterface; -+ -+ XRange Insert([in] XRange Where, [in] /*Optional*/ any RichText); -+}; -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XBorder.idl oovbaapi/ooo/vba/word/XBorder.idl -new file mode 100644 -index 0000000..8944bdd ---- /dev/null -+++ oovbaapi/ooo/vba/word/XBorder.idl -@@ -0,0 +1,59 @@ -+/************************************************************************* -+ * -+ * 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: XBorder.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __ooo_vba_word_XBorder_idl__ -+#define __ooo_vba_word_XBorder_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+ -+//============================================================================= -+interface XBorder -+{ -+ interface ::ooo::vba::XHelperInterface; -+ -+ [attribute] any LineStyle; -+}; -+ -+//============================================================================= -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XBorders.idl oovbaapi/ooo/vba/word/XBorders.idl -new file mode 100644 -index 0000000..5956fc3 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XBorders.idl -@@ -0,0 +1,59 @@ -+/************************************************************************* -+ * -+ * 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: XBorders.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __ooo_vba_word_XBorders_idl__ -+#define __ooo_vba_word_XBorders_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+//============================================================================= -+interface XBorders -+{ -+ interface ooo::vba::XCollection; -+ -+ [attribute] boolean Shadow; -+}; -+ -+//============================================================================= -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XDialog.idl oovbaapi/ooo/vba/word/XDialog.idl -new file mode 100644 -index 0000000..9c31fa7 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XDialog.idl -@@ -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: XDialog.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __ooo_vba_word_XDialog_idl__ -+#define __ooo_vba_word_XDialog_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+//============================================================================= -+ -+interface XDialog : com::sun::star::uno::XInterface -+{ -+}; -+ -+}; }; }; -+ -+#endif -+ -diff --git oovbaapi/ooo/vba/word/XDialogs.idl oovbaapi/ooo/vba/word/XDialogs.idl -new file mode 100644 -index 0000000..b68848d ---- /dev/null -+++ oovbaapi/ooo/vba/word/XDialogs.idl -@@ -0,0 +1,54 @@ -+/************************************************************************* -+ * -+ * 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: XDialogs.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __ooo_vba_word_XDialogs_idl__ -+#define __ooo_vba_word_XDialogs_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+interface XDialogs : com::sun::star::uno::XInterface -+{ -+ -+ any Item( [in] any Index ); -+}; -+ -+}; }; }; -+ -+#endif -+ -diff --git oovbaapi/ooo/vba/word/XDocument.idl oovbaapi/ooo/vba/word/XDocument.idl -index 2502846..a7ceb18 100644 ---- oovbaapi/ooo/vba/word/XDocument.idl -+++ oovbaapi/ooo/vba/word/XDocument.idl -@@ -42,9 +42,13 @@ - #include <ooo/vba/word/XRange.idl> - #endif - -+#ifndef __com_sun_star_script_XInvocation_idl__ -+#include <com/sun/star/script/XInvocation.idl> -+#endif -+ - module ooo { module vba { module word { - --interface XDocument : com::sun::star::uno::XInterface -+interface XDocument : com::sun::star::script::XInvocation - { - [attribute, readonly] XRange Content; - [attribute] any AttachedTemplate; -@@ -54,6 +58,14 @@ interface XDocument : com::sun::star::uno::XInterface - any CustomDocumentProperties( [in] any index ); - any Bookmarks( [in] any aIndex ); - any Variables( [in] any aIndex ); -+ any Paragraphs( [in] any aIndex ); -+ any Styles( [in] any aIndex ); -+ any Tables( [in] any aIndex ); -+ any Fields( [in] any aIndex ); -+ any Shapes([in] any Index); -+ any Sections([in] any Index); -+ void Activate(); -+ any PageSetup(); - }; - - }; }; }; -diff --git oovbaapi/ooo/vba/word/XDocuments.idl oovbaapi/ooo/vba/word/XDocuments.idl -new file mode 100644 -index 0000000..c45b9ae ---- /dev/null -+++ oovbaapi/ooo/vba/word/XDocuments.idl -@@ -0,0 +1,58 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XDocuments_idl__ -+#define __ooo_vba_word_XDocuments_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+//============================================================================= -+ -+interface XDocuments : com::sun::star::uno::XInterface -+{ -+ any Add([in] any Template, [in] any NewTemplate, [in] any DocumentType, [in] any Visible); -+ any Open([in] string Filename, [in] any ConfirmConversions, [in] any ReadOnly, [in] any AddToRecentFiles, [in] any PasswordDocument, [in] any PasswordTemplate, [in] any Revert, [in] any WritePasswordDocument, [in] any WritePasswordTemplate, [in] any Format, [in] any Encoding, [in] any Visible, [in] any OpenAndRepair, [in] any DocumentDirection, [in] any NoEncodingDialog, [in] any XMLTransform); -+ -+ void Close([in] any SaveChanges,[in] any OriginalFormat,[in] any RouteDocument); -+}; -+ -+}; }; }; -+ -+#endif -diff --git oovbaapi/ooo/vba/word/XField.idl oovbaapi/ooo/vba/word/XField.idl -new file mode 100644 -index 0000000..19d3d3b ---- /dev/null -+++ oovbaapi/ooo/vba/word/XField.idl -@@ -0,0 +1,52 @@ -+/************************************************************************* -+ * -+ * OpenOffice.org - a multi-platform office productivity suite -+ * -+ * $RCSfile: XField.idl,v $ -+ * -+ * $Revision: 1.1 $ -+ * -+ * last change: $Author: jsc $ $Date: 2007/02/09 08:35:01 $ -+ * -+ * The Contents of this file are made available subject to -+ * the terms of GNU Lesser General Public License Version 2.1. -+ * -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2005 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library 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 for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ ************************************************************************/ -+ -+#ifndef __ooo_vba_word_XField_idl__ -+#define __ooo_vba_word_XField_idl__ -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+module ooo { module vba { module word { -+ -+interface XField -+{ -+ interface ::ooo::vba::XHelperInterface; -+}; -+ -+}; }; }; -+ -+#endif -+ -diff --git oovbaapi/ooo/vba/word/XFields.idl oovbaapi/ooo/vba/word/XFields.idl -new file mode 100644 -index 0000000..78266ac ---- /dev/null -+++ oovbaapi/ooo/vba/word/XFields.idl -@@ -0,0 +1,62 @@ -+/************************************************************************* -+ * -+ * OpenOffice.org - a multi-platform office productivity suite -+ * -+ * $RCSfile: XFields.idl,v $ -+ * -+ * $Revision: 1.1 $ -+ * -+ * last change: $Author: jsc $ $Date: 2007/02/09 08:45:13 $ -+ * -+ * The Contents of this file are made available subject to -+ * the terms of GNU Lesser General Public License Version 2.1. -+ * -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2005 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library 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 for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ ************************************************************************/ -+ -+#ifndef __ooo_vba_word__XFields_idl__ -+#define __ooo_vba_word__XFields_idl__ -+ -+#ifndef __ooo_vba_HelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XRange; -+interface XField; -+interface XFields -+{ -+ interface ooo::vba::XCollection; -+ -+ XField Add([in] XRange Range, [in] any Type, [in] any Text,[in] any PreserveFormatting); -+ long Update(); -+}; -+ -+}; }; }; -+ -+#endif -+ -diff --git oovbaapi/ooo/vba/word/XFind.idl oovbaapi/ooo/vba/word/XFind.idl -new file mode 100644 -index 0000000..e42ac6f ---- /dev/null -+++ oovbaapi/ooo/vba/word/XFind.idl -@@ -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 __ooo_vba_word_XFind_idl__ -+#define __ooo_vba_word_XFind_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XFind -+{ -+ interface ooo::vba::XHelperInterface; -+ -+ [attribute] string Text; -+ [attribute] any Replacement; -+ [attribute] boolean Forward; -+ [attribute] long Wrap; -+ [attribute] boolean Format; -+ [attribute] boolean MatchCase; -+ [attribute] boolean MatchWholeWord; -+ [attribute] boolean MatchWildcards; -+ [attribute] boolean MatchSoundsLike; -+ [attribute] boolean MatchAllWordForms; -+ [attribute] any Style; -+ -+ boolean Execute([in] /* string */ any FindText, -+ [in] /* boolean */ any MatchCase, -+ [in] /* boolean */ any MatchWholeWord, -+ [in] /* boolean */ any MatchWildcards, -+ [in] /* boolean */ any MatchSoundsLike, -+ [in] /* boolean */ any MatchAllWordForms, -+ [in] /* boolean */ any Forward, -+ [in] /* long */ any Wrap, -+ [in] /* boolean */ any Format, -+ [in] /* string */ any ReplaceWith, -+ [in] /* boolean */ any Replace, -+ [in] /* boolean */ any MatchKashida, -+ [in] /* boolean */ any MatchDiacritics, -+ [in] /* boolean */ any MatchAlefHamza, -+ [in] /* boolean */ any MatchControl, -+ [in] /* boolean */ any MatchPrefix, -+ [in] /* boolean */ any MatchSuffix, -+ [in] /* boolean */ any MatchPhrase, -+ [in] /* boolean */ any IgnoreSpace, -+ [in] /* boolean */ any IgnorePunct ); -+ void ClearFormatting(); -+ -+}; -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XFont.idl oovbaapi/ooo/vba/word/XFont.idl -new file mode 100644 -index 0000000..53fc1bb ---- /dev/null -+++ oovbaapi/ooo/vba/word/XFont.idl -@@ -0,0 +1,58 @@ -+/************************************************************************* -+ * -+ * 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: XFont.idl,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 __ooo_vba_word_XFont_idl__ -+#define __ooo_vba_word_XFont_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__ -+#include <com/sun/star/lang/IndexOutOfBoundsException.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+interface XFont : com::sun::star::uno::XInterface -+{ -+}; -+ -+//============================================================================= -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XGlobals.idl -index 3305e93..519499c 100644 ---- oovbaapi/ooo/vba/word/XGlobals.idl -+++ oovbaapi/ooo/vba/word/XGlobals.idl -@@ -49,6 +49,10 @@ interface XGlobals : com::sun::star::uno::XInterface - [attribute, readonly] ooo::vba::word::XOptions Options; - [attribute, readonly] ooo::vba::word::XSelection Selection; - any CommandBars( [in] any aIndex ); -+ any Documents( [in] any aIndex ); -+ any Addins( [in] any aIndex ); -+ any Dialogs( [in] any aIndex ); -+ float CentimetersToPoints([in] float Centimeters ); - }; - - }; }; }; -diff --git oovbaapi/ooo/vba/word/XHeaderFooter.idl oovbaapi/ooo/vba/word/XHeaderFooter.idl -new file mode 100644 -index 0000000..7dd1a39 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XHeaderFooter.idl -@@ -0,0 +1,59 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XHeaderFooter_idl__ -+#define __ooo_vba_word_XHeaderFooter_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XRange; -+interface XHeaderFooter -+{ -+ interface ooo::vba::XHelperInterface; -+ -+ [attribute, readonly] boolean IsHeader; -+ [attribute] boolean LinkToPrevious; -+ [attribute, readonly] XRange Range; -+ //[attribute, readonly] XShapers Shapes ; -+ any Shapes([in] any Index); -+}; -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XOptions.idl oovbaapi/ooo/vba/word/XOptions.idl -index 75b1064..13bb65e 100644 ---- oovbaapi/ooo/vba/word/XOptions.idl -+++ oovbaapi/ooo/vba/word/XOptions.idl -@@ -44,6 +44,20 @@ interface XOptions - { - interface ooo::vba::XHelperInterface; - -+ [attribute] long DefaultBorderLineStyle; -+ [attribute] long DefaultBorderLineWidth; -+ [attribute] long DefaultBorderColorIndex; -+ [attribute] boolean ReplaceSelection; -+ [attribute] boolean MapPaperSize; -+ [attribute] boolean AutoFormatAsYouTypeApplyHeadings; -+ [attribute] boolean AutoFormatAsYouTypeApplyBulletedLists; -+ [attribute] boolean AutoFormatAsYouTypeApplyNumberedLists; -+ [attribute] boolean AutoFormatAsYouTypeFormatListItemBeginning; -+ [attribute] boolean AutoFormatAsYouTypeDefineStyles; -+ [attribute] boolean AutoFormatApplyHeadings; -+ [attribute] boolean AutoFormatApplyLists; -+ [attribute] boolean AutoFormatApplyBulletedLists; -+ - any DefaultFilePath( [in] long Path ); - }; - -diff --git oovbaapi/ooo/vba/word/XPageSetup.idl oovbaapi/ooo/vba/word/XPageSetup.idl -new file mode 100644 -index 0000000..ca8e944 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XPageSetup.idl -@@ -0,0 +1,63 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XPageSetup_idl__ -+#define __ooo_vba_word_XPageSetup_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+//============================================================================= -+ -+ -+interface XPageSetup : com::sun::star::uno::XInterface -+{ -+ [attribute] double Gutter; -+ [attribute] double HeaderDistance; -+ [attribute] double FooterDistance; -+ [attribute] boolean DifferentFirstPageHeaderFooter; -+ [attribute] long SectionStart; -+}; -+ -+//============================================================================= -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XParagraph.idl oovbaapi/ooo/vba/word/XParagraph.idl -new file mode 100644 -index 0000000..79ad7ae ---- /dev/null -+++ oovbaapi/ooo/vba/word/XParagraph.idl -@@ -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 __ooo_vba_word_XParagraph_idl__ -+#define __ooo_vba_word_XParagraph_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XRange; -+interface XParagraph -+{ -+ interface ooo::vba::XHelperInterface; -+ -+ [attribute, readonly] XRange Range; -+}; -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XParagraphFormat.idl oovbaapi/ooo/vba/word/XParagraphFormat.idl -new file mode 100644 -index 0000000..df6d584 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XParagraphFormat.idl -@@ -0,0 +1,70 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XParagraphFormat_idl__ -+#define __ooo_vba_word_XParagraphFormat_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+ -+module ooo { module vba { module word { -+ -+interface XParagraphFormat -+{ -+ interface ooo::vba::XHelperInterface; -+ -+ [attribute] long Alignment; -+ [attribute] float FirstLineIndent; -+ [attribute] any KeepTogether; -+ [attribute] any KeepWithNext; -+ [attribute] any Hyphenation; -+ [attribute] float LineSpacing; -+ [attribute] long LineSpacingRule; -+ [attribute] any NoLineNumber; -+ [attribute] long OutlineLevel; -+ [attribute] any PageBreakBefore; -+ [attribute] float SpaceBefore; -+ [attribute] float SpaceAfter; -+ [attribute] float LeftIndent; -+ [attribute] float RightIndent; -+ [attribute] any TabStops; -+ [attribute] any WidowControl; -+}; -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XParagraphs.idl oovbaapi/ooo/vba/word/XParagraphs.idl -new file mode 100644 -index 0000000..d392528 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XParagraphs.idl -@@ -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 __ooo_vba_word_XParagraphs_idl__ -+#define __ooo_vba_word_XParagraphs_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+//============================================================================= -+ -+interface XParagraphs -+{ -+ interface ::ooo::vba::XCollection; -+}; -+ -+}; }; }; -+ -+#endif -diff --git oovbaapi/ooo/vba/word/XRange.idl oovbaapi/ooo/vba/word/XRange.idl -index 4ce9b79..47e688e 100644 ---- oovbaapi/ooo/vba/word/XRange.idl -+++ oovbaapi/ooo/vba/word/XRange.idl -@@ -34,6 +34,10 @@ - #include <com/sun/star/uno/XInterface.idl> - #endif - -+#ifndef __com_sun_star_text_XTextRange_idl__ -+#include <com/sun/star/text/XTextRange.idl> -+#endif -+ - #ifndef __ooo_vba_XHelperInterface_idl__ - #include <ooo/vba/XHelperInterface.idl> - #endif -@@ -41,13 +45,30 @@ - - module ooo { module vba { module word { - -+interface XParagraphFormat; -+interface XStyle; -+interface XFont; - interface XRange - { - interface ooo::vba::XHelperInterface; - - [attribute] string Text; -+ [attribute] XParagraphFormat ParagraphFormat; -+ [attribute] XStyle Style; -+ [attribute,readonly] ::com::sun::star::text::XTextRange XTextRange; -+ // Of course Font is NOT readonly, #FIXME #TODO -+ // readonly though will force an error attempting to write -+ [attribute, readonly] XFont Font; -+ [attribute] long LanguageID; -+ [attribute] long Start; -+ [attribute] long End; - - void InsertBreak( [in] any Type ); -+ void Select(); -+ void InsertParagraph(); -+ void InsertParagraphBefore(); -+ void InsertParagraphAfter(); -+ any PageSetup(); - }; - - }; }; }; -diff --git oovbaapi/ooo/vba/word/XReplacement.idl oovbaapi/ooo/vba/word/XReplacement.idl -new file mode 100644 -index 0000000..daae501 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XReplacement.idl -@@ -0,0 +1,54 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XReplacement_idl__ -+#define __ooo_vba_word_XReplacement_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XReplacement -+{ -+ interface ooo::vba::XHelperInterface; -+ -+ [attribute] string Text; -+}; -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XSection.idl oovbaapi/ooo/vba/word/XSection.idl -new file mode 100644 -index 0000000..c79a24b ---- /dev/null -+++ oovbaapi/ooo/vba/word/XSection.idl -@@ -0,0 +1,58 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XSection_idl__ -+#define __ooo_vba_word_XSection_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XSection -+{ -+ interface ooo::vba::XHelperInterface; -+ -+ [attribute] boolean ProtectedForForms; -+ -+ any Headers(); -+ any Footers(); -+ any PageSetup(); -+}; -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XSections.idl oovbaapi/ooo/vba/word/XSections.idl -new file mode 100644 -index 0000000..a941285 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XSections.idl -@@ -0,0 +1,57 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XSections_idl__ -+#define __ooo_vba_word_XSections_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+//============================================================================= -+ -+interface XSections -+{ -+ interface ::ooo::vba::XCollection; -+ -+ any PageSetup(); -+}; -+ -+}; }; }; -+ -+#endif -diff --git oovbaapi/ooo/vba/word/XSelection.idl oovbaapi/ooo/vba/word/XSelection.idl -index 2142fb4..44026da 100644 ---- oovbaapi/ooo/vba/word/XSelection.idl -+++ oovbaapi/ooo/vba/word/XSelection.idl -@@ -41,11 +41,45 @@ - - module ooo { module vba { module word { - -+interface XRange; -+interface XParagraphFormat; -+interface XFind; -+interface XFont; -+interface XStyle; -+interface XHeaderFooter; - interface XSelection - { - interface ooo::vba::XHelperInterface; - - [attribute] string Text; -+ [attribute, readonly] XRange Range; -+ [attribute] XParagraphFormat ParagraphFormat; -+ [attribute, readonly] XFind Find; -+ [attribute] XStyle Style; -+ [attribute, readonly] XFont Font; -+ [attribute, readonly] XHeaderFooter HeaderFooter; -+ [attribute] long LanguageID; -+ [attribute] long Start; -+ [attribute] long End; -+ -+ any Tables( [in] any aIndex ); -+ any Fields( [in] any aIndex ); -+ void TypeText( [in] string Text ); -+ void HomeKey( [in] any Unit, [in] any Extend ); -+ void EndKey( [in] any Unit, [in] any Extend ); -+ void Delete( [in] any Unit, [in] any Count ); -+ void MoveRight( [in] any Unit, [in] any Count, [in] any Extend ); -+ void MoveLeft( [in] any Unit, [in] any Count, [in] any Extend ); -+ void MoveDown( [in] any Unit, [in] any Count, [in] any Extend ); -+ void TypeParagraph(); -+ void InsertParagraph(); -+ void InsertParagraphBefore(); -+ void InsertParagraphAfter(); -+ void TypeBackspace(); -+ XRange GoTo( [in] any What, [in] any Which, [in] any Count, [in] any Name ); -+ any Information( [in] long Type ); -+ void InsertBreak( [in] any Type ); -+ any ShapeRange(); - }; - - }; }; }; -diff --git oovbaapi/ooo/vba/word/XStyle.idl oovbaapi/ooo/vba/word/XStyle.idl -new file mode 100644 -index 0000000..af19517 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XStyle.idl -@@ -0,0 +1,58 @@ -+/************************************************************************* -+ * -+ * 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 __ooo_vba_word_XStyle_idl__ -+#define __ooo_vba_word_XStyle_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XFont; -+interface XStyle -+{ -+ interface ooo::vba::XHelperInterface; -+ -+ [attribute] string Name; -+ [attribute] long LanguageID; -+ [attribute, readonly] long Type; -+ [attribute, readonly] XFont Font; -+}; -+ -+}; }; }; -+ -+#endif -+ -+ -diff --git oovbaapi/ooo/vba/word/XStyles.idl oovbaapi/ooo/vba/word/XStyles.idl -new file mode 100644 -index 0000000..dd6f2b4 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XStyles.idl -@@ -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 __ooo_vba_word_XStyles_idl__ -+#define __ooo_vba_word_XStyles_idl__ -+ -+#ifndef __com_sun_star_uno_XInterface_idl__ -+#include <com/sun/star/uno/XInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+ -+//============================================================================= -+ -+module ooo { module vba { module word { -+ -+//============================================================================= -+ -+interface XStyles -+{ -+ interface ::ooo::vba::XCollection; -+}; -+ -+}; }; }; -+ -+#endif -diff --git oovbaapi/ooo/vba/word/XTable.idl oovbaapi/ooo/vba/word/XTable.idl -new file mode 100644 -index 0000000..f677da6 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XTable.idl -@@ -0,0 +1,86 @@ -+/************************************************************************* -+ * -+ * OpenOffice.org - a multi-platform office productivity suite -+ * -+ * $RCSfile: XTable.idl,v $ -+ * -+ * $Revision: 1.1 $ -+ * -+ * last change: $Author: jsc $ $Date: 2007/02/09 08:35:01 $ -+ * -+ * The Contents of this file are made available subject to -+ * the terms of GNU Lesser General Public License Version 2.1. -+ * -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2005 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library 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 for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ ************************************************************************/ -+ -+#ifndef __ooo_vba_word_XTable_idl__ -+#define __ooo_vba_word_XTable_idl__ -+ -+#ifndef __com_sun_star_script_BasicErrorException_idl__ -+#include <com/sun/star/script/BasicErrorException.idl> -+#endif -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+module ooo { module vba { module word { -+ -+interface XRange; -+ -+interface XTable -+{ -+ interface ::ooo::vba::XHelperInterface; -+ [attribute, readonly ] string Name; // for debug only -+ -+ XRange Range() raises (com::sun::star::script::BasicErrorException); -+ -+ /** -+ select the table -+ */ -+ void Select() -+ raises (com::sun::star::script::BasicErrorException); -+ -+ /** -+ delete the table -+ */ -+ void Delete() -+ raises (com::sun::star::script::BasicErrorException); -+ -+ /** -+ convert the table to text -+ @param Separator the separator used for the text where cell separation was -+ @return XRange a range containing the text -+ @throw BasicErrorException when the conversion cannot be done -+ */ -+/* -+ XRange ConvertToText([in] any Separator, [in] any NestedTables) -+ raises(com::sun::star::script::BasicErrorException); -+*/ -+ any Borders( [in] any aIndex ); -+ -+}; -+ -+}; }; }; -+ -+#endif -+ -diff --git oovbaapi/ooo/vba/word/XTables.idl oovbaapi/ooo/vba/word/XTables.idl -new file mode 100644 -index 0000000..f09f27f ---- /dev/null -+++ oovbaapi/ooo/vba/word/XTables.idl -@@ -0,0 +1,79 @@ -+/************************************************************************* -+ * -+ * OpenOffice.org - a multi-platform office productivity suite -+ * -+ * $RCSfile: XTables.idl,v $ -+ * -+ * $Revision: 1.1 $ -+ * -+ * last change: $Author: jsc $ $Date: 2007/02/09 08:45:13 $ -+ * -+ * The Contents of this file are made available subject to -+ * the terms of GNU Lesser General Public License Version 2.1. -+ * -+ * -+ * GNU Lesser General Public License Version 2.1 -+ * ============================================= -+ * Copyright 2005 by Sun Microsystems, Inc. -+ * 901 San Antonio Road, Palo Alto, CA 94303, USA -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License version 2.1, as published by the Free Software Foundation. -+ * -+ * This library 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 for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ * -+ ************************************************************************/ -+ -+#ifndef __ooo_vba_word__XTables_idl__ -+#define __ooo_vba_word__XTables_idl__ -+ -+#ifndef __ooo_vba_HelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+#ifndef __ooo_vba_XCollection_idl__ -+#include <ooo/vba/XCollection.idl> -+#endif -+ -+#ifndef __ooo_vba_word_XTable_idl__ -+#include <ooo/vba/word/XTable.idl> -+#endif -+ -+#ifndef __com_sun_star_script_BasicErrorException_idl__ -+#include <com/sun/star/script/BasicErrorException.idl> -+#endif -+ -+module ooo { module vba { module word { -+ -+interface XRange; -+ -+interface XTables -+{ -+ interface ooo::vba::XCollection; -+ /** Creates a new Table, optionally with a name. -+ <p>Creates a new table at the current cursor position. </p> -+ @param range -+ @returns -+ reference to the new table. -+ */ -+ XTable Add([in] XRange Range, [in] any NumRows, [in] any NumColumns, -+ /*optional*/ [in] any DefaultTableBehavior, -+ /*optional*/ [in] any AutoFitBehavior) -+ raises(com::sun::star::script::BasicErrorException); -+ -+ -+}; -+ -+}; }; }; -+ -+#endif -+ -diff --git oovbaapi/ooo/vba/word/XTemplate.idl oovbaapi/ooo/vba/word/XTemplate.idl -index 1913118..a2bd1d7 100644 ---- oovbaapi/ooo/vba/word/XTemplate.idl -+++ oovbaapi/ooo/vba/word/XTemplate.idl -@@ -45,6 +45,8 @@ interface XTemplate - interface ooo::vba::XHelperInterface; - - [attribute, readonly] string Name; -+ -+ any AutoTextEntries( [in] any aIndex ); - }; - - }; }; }; -diff --git oovbaapi/ooo/vba/word/XWrapFormat.idl oovbaapi/ooo/vba/word/XWrapFormat.idl -new file mode 100644 -index 0000000..386feb3 ---- /dev/null -+++ oovbaapi/ooo/vba/word/XWrapFormat.idl -@@ -0,0 +1,48 @@ -+/************************************************************************* -+ * -+ * 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: XWrapFormat.idl,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 __ooo_vba_word_XWrapFormat_idl__ -+#define __ooo_vba_word_XWrapFormat_idl__ -+ -+#ifndef __ooo_vba_XHelperInterface_idl__ -+#include <ooo/vba/XHelperInterface.idl> -+#endif -+ -+module ooo { module vba { module word { -+interface XWrapFormat : ooo::vba::XHelperInterface -+{ -+ [attribute] long Type; -+ [attribute] long Side; -+ [attribute] float DistanceTop; -+ [attribute] float DistanceBottom; -+ [attribute] float DistanceLeft; -+ [attribute] float DistanceRight; -+}; -+}; }; }; -+#endif -diff --git oovbaapi/ooo/vba/word/makefile.mk oovbaapi/ooo/vba/word/makefile.mk -index c638476..8126587 100644 ---- oovbaapi/ooo/vba/word/makefile.mk -+++ oovbaapi/ooo/vba/word/makefile.mk -@@ -56,7 +56,33 @@ IDLFILES= XGlobals.idl\ - XPanes.idl \ - XOptions.idl \ - XSelection.idl \ -- XTemplate.idl \ -+ XTemplate.idl \ -+ XParagraphFormat.idl \ -+ XAutoTextEntries.idl \ -+ XAutoTextEntry.idl \ -+ XParagraphs.idl \ -+ XParagraph.idl \ -+ XFind.idl \ -+ XReplacement.idl \ -+ XStyle.idl \ -+ XStyles.idl \ -+ XFont.idl \ -+ XTable.idl \ -+ XTables.idl \ -+ XField.idl \ -+ XFields.idl \ -+ XBorder.idl \ -+ XBorders.idl \ -+ XDocuments.idl \ -+ XHeaderFooter.idl \ -+ XAddins.idl \ -+ XAddin.idl \ -+ XDialogs.idl \ -+ XDialog.idl \ -+ XWrapFormat.idl \ -+ XPageSetup.idl \ -+ XSection.idl \ -+ XSections.idl \ - - # ------------------------------------------------------------------ - -diff --git sc/source/ui/vba/excelvbahelper.cxx sc/source/ui/vba/excelvbahelper.cxx -index ba1bdc8..795ec5a 100644 ---- sc/source/ui/vba/excelvbahelper.cxx -+++ sc/source/ui/vba/excelvbahelper.cxx -@@ -170,7 +170,7 @@ void implnPasteSpecial(USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_B - } - - ScDocShell* --getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) -+getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) - { - uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW ); - ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() ); -@@ -182,7 +182,7 @@ getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) - } - - ScTabViewShell* --getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) -+getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) - { - ScDocShell* pDocShell = getDocShell( xModel ); - if ( pDocShell ) -diff --git sc/source/ui/vba/excelvbahelper.hxx sc/source/ui/vba/excelvbahelper.hxx -index 7c156df..3a3b7f8 100644 ---- sc/source/ui/vba/excelvbahelper.hxx -+++ sc/source/ui/vba/excelvbahelper.hxx -@@ -45,8 +45,8 @@ namespace ooo - void implnPaste(); - void implnCut(); - void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose); -- ScTabViewShell* getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel ) ; -- ScDocShell* getDocShell( css::uno::Reference< css::frame::XModel>& xModel ) ; -+ ScTabViewShell* getBestViewShell( const css::uno::Reference< css::frame::XModel>& xModel ) ; -+ ScDocShell* getDocShell( const css::uno::Reference< css::frame::XModel>& xModel ) ; - ScTabViewShell* getCurrentBestViewShell(); - SfxViewFrame* getCurrentViewFrame(); - class ScVbaCellRangeAccess -diff --git sc/source/ui/vba/makefile.mk sc/source/ui/vba/makefile.mk -index 1f861e6..9350a3b 100644 ---- sc/source/ui/vba/makefile.mk -+++ sc/source/ui/vba/makefile.mk -@@ -86,13 +86,6 @@ SLOFILES= \ - $(SLO)$/vbaoleobjects.obj \ - $(SLO)$/vbatextboxshape.obj \ - $(SLO)$/vbapane.obj \ -- $(SLO)$/vbashape.obj \ -- $(SLO)$/vbacolorformat.obj \ -- $(SLO)$/vbashapes.obj \ -- $(SLO)$/vbalineformat.obj \ -- $(SLO)$/vbafillformat.obj \ -- $(SLO)$/vbapictureformat.obj \ -- $(SLO)$/vbashaperange.obj \ - $(SLO)$/vbatextframe.obj \ - $(SLO)$/vbacharttitle.obj \ - $(SLO)$/vbacharts.obj \ -diff --git sc/source/ui/vba/service.cxx sc/source/ui/vba/service.cxx -index 06629e7..37b6fb3 100644 ---- sc/source/ui/vba/service.cxx -+++ sc/source/ui/vba/service.cxx -@@ -73,6 +73,10 @@ namespace vbaeventshelper - { - extern sdecl::ServiceDecl const serviceDecl; - } -+namespace textframe -+{ -+extern sdecl::ServiceDecl const serviceDecl; -+} - - extern "C" - { -@@ -113,7 +117,7 @@ extern "C" - #else - // Component registration - return component_writeInfoHelper( pServiceManager, pRegistryKey, -- range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ); -+ range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ) && component_writeInfoHelper( pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl, textframe::serviceDecl ); - #endif - - } -@@ -126,7 +130,7 @@ extern "C" - void* pRet = component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, range::serviceDecl, workbook::serviceDecl, worksheet::serviceDecl, globals::serviceDecl, window::serviceDecl, hyperlink::serviceDecl, application::serviceDecl ); - if( !pRet ) -- pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl ); -+ pRet = component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey, vbaeventshelper::serviceDecl, textframe::serviceDecl ); - OSL_TRACE("Ret is 0x%x", pRet); - return pRet; - } -diff --git sc/source/ui/vba/vbaapplication.cxx sc/source/ui/vba/vbaapplication.cxx -index c26a61d..9088dc9 100644 ---- sc/source/ui/vba/vbaapplication.cxx -+++ sc/source/ui/vba/vbaapplication.cxx -@@ -57,7 +57,7 @@ - #include "tabvwsh.hxx" - #include "gridwin.hxx" - #include "vbanames.hxx" --#include "vbashape.hxx" -+#include <vbahelper/vbashape.hxx> - #include "vbatextboxshape.hxx" - #include "vbaassistant.hxx" - #include "sc.hrc" -@@ -88,6 +88,8 @@ - #include "unonames.hxx" - #include "docsh.hxx" - #include <vbahelper/helperdecl.hxx> -+#include "excelvbahelper.hxx" -+ - #include <basic/sbmeth.hxx> - #include <basic/sbmod.hxx> - #include <basic/sbstar.hxx> -@@ -114,8 +116,6 @@ using ::rtl::OUString; - #define FILE_PATH_SEPERATOR "\\" - #endif - --#define EXCELVERSION "11.0" -- - uno::Any sbxToUnoValue( SbxVariable* pVar ); - - class ActiveWorkbook : public ScVbaWorkbook -@@ -137,7 +137,10 @@ ScVbaApplication::~ScVbaApplication() - { - } - -- -+SfxObjectShell* ScVbaApplication::GetDocShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) -+{ -+ return static_cast< SfxObjectShell* >( excel::getDocShell( xModel ) ); -+} - - uno::Reference< excel::XWorkbook > - ScVbaApplication::getActiveWorkbook() throw (uno::RuntimeException) -@@ -307,12 +310,6 @@ ScVbaApplication::getCutCopyMode() throw (uno::RuntimeException) - return result; - } - --::rtl::OUString --ScVbaApplication::getVersion() throw (uno::RuntimeException) --{ -- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(EXCELVERSION)); --} -- - void SAL_CALL - ScVbaApplication::setCutCopyMode( const uno::Any& /*_cutcopymode*/ ) throw (uno::RuntimeException) - { -diff --git sc/source/ui/vba/vbaapplication.hxx sc/source/ui/vba/vbaapplication.hxx -index 9435282..67b6ba9 100644 ---- sc/source/ui/vba/vbaapplication.hxx -+++ sc/source/ui/vba/vbaapplication.hxx -@@ -51,6 +51,8 @@ public: - ScVbaApplication( const css::uno::Reference< css::uno::XComponentContext >& m_xContext ); - virtual ~ScVbaApplication(); - -+ virtual SfxObjectShell* GetDocShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException); -+ - // XApplication - virtual ::rtl::OUString SAL_CALL PathSeparator( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); - virtual void SAL_CALL setDefaultFilePath( const ::rtl::OUString& DefaultFilePath ) throw (css::script::BasicErrorException, css::uno::RuntimeException); -@@ -80,7 +82,6 @@ public: - virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& DialogIndex ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getCutCopyMode() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCutCopyMode( const css::uno::Any& _cutcopymode ) throw (css::uno::RuntimeException); -- virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getStatusBar() throw (css::uno::RuntimeException); - virtual void SAL_CALL setStatusBar( const css::uno::Any& _statusbar ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getCursor() throw (css::uno::RuntimeException); -diff --git sc/source/ui/vba/vbacolorformat.cxx sc/source/ui/vba/vbacolorformat.cxx -deleted file mode 100644 -index d2ce12b..0000000 ---- sc/source/ui/vba/vbacolorformat.cxx -+++ /dev/null -@@ -1,190 +0,0 @@ --/************************************************************************* -- * -- * 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: vbacolorformat.cxx,v $ -- * $Revision: 1.3.146.1 $ -- * -- * 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 <com/sun/star/beans/XPropertySet.hpp> --#include <ooo/vba/msforms/XLineFormat.hpp> --#include "vbacolorformat.hxx" -- --using namespace ooo::vba; --using namespace com::sun::star; -- --sal_Int32 --MsoColorIndizes::getColorIndex( sal_Int32 nIndex ) --{ -- const static sal_Int32 COLORINDIZES[56] = -- { HAPICOLOR_BLACK, HAPICOLOR_WITHE, HAPICOLOR_RED, HAPICOLOR_BRIGHTGREEN, HAPICOLOR_BLUE, HAPICOLOR_YELLOW, HAPICOLOR_PINK, -- HAPICOLOR_TURQUOISE, HAPICOLOR_DARKRED, HAPICOLOR_GREEN, HAPICOLOR_DARKBLUE, HAPICOLOR_DARKYELLOW, HAPICOLOR_VIOLET, -- HAPICOLOR_TEAL, HAPICOLOR_GRAY_25_PERCENT, HAPICOLOR_GRAY_50_PERCENT, HAPICOLOR_PERIWINCKLE, HAPICOLOR_PLUM, -- HAPICOLOR_IVORY, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_DARKPRUPLE, HAPICOLOR_CORAL, HAPICOLOR_OCEANBLUE, HAPICOLOR_ICEBLUE, -- HAPICOLOR_GREEN, HAPICOLOR_PINK, HAPICOLOR_YELLOW, HAPICOLOR_TURQUOISE, HAPICOLOR_VIOLET, HAPICOLOR_DARKRED, HAPICOLOR_TEAL, -- HAPICOLOR_BLUE, HAPICOLOR_SKYBLUE, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_LIGHTGREEN, HAPICOLOR_LIGHTYELLOW, HAPICOLOR_PALEBLUE, -- HAPICOLOR_ROSE, HAPICOLOR_LAVENDER, HAPICOLOR_TAN, HAPICOLOR_LIGHTBLUE, HAPICOLOR_AQUA, HAPICOLOR_LIME, HAPICOLOR_GOLD, -- HAPICOLOR_LIGHTORANGE, HAPICOLOR_ORANGE, HAPICOLOR_BLUEGRAY, HAPICOLOR_GRAY_40_PERCENT, HAPICOLOR_DARKTEAL, -- HAPICOLOR_SEAGREEN, HAPICOLOR_NONAME, HAPICOLOR_OLIVEGREEN, HAPICOLOR_BROWN, HAPICOLOR_PLUM, HAPICOLOR_INDIGO, -- HAPICOLOR_GRAY_80_PERCENT -- }; -- return COLORINDIZES[nIndex]; --} --ScVbaColorFormat::ScVbaColorFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XHelperInterface > xInternalParent, const uno::Reference< drawing::XShape > xShape, const sal_Int16 nColorFormatType ) : ScVbaColorFormat_BASE( xParent, xContext ), m_xInternalParent( xInternalParent ), m_xShape( xShape ), m_nColorFormatType( nColorFormatType ) --{ -- m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); -- m_nFillFormatBackColor = 0; -- try -- { -- uno::Reference< ov::msforms::XFillFormat > xFillFormat( xInternalParent, uno::UNO_QUERY_THROW ); -- m_pFillFormat = ( ScVbaFillFormat* )( xFillFormat.get() ); -- }catch ( uno::RuntimeException e ) -- { -- m_pFillFormat = NULL; -- } --} -- --void --ScVbaColorFormat::setColorFormat( sal_Int16 _ntype ) --{ -- m_nColorFormatType = _ntype; --} -- --// Attribute --sal_Int32 SAL_CALL --ScVbaColorFormat::getRGB() throw (uno::RuntimeException) --{ -- sal_Int32 nRGB = 0; -- switch( m_nColorFormatType ) -- { -- case ColorFormatType::LINEFORMAT_FORECOLOR: -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LineColor") ) >>= nRGB; -- break; -- case ColorFormatType::LINEFORMAT_BACKCOLOR: -- //TODO BackColor not supported -- // m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("Color"), uno::makeAny( nRGB ) ); -- break; -- case ColorFormatType::FILLFORMAT_FORECOLOR: -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillColor") ) >>= nRGB; -- break; -- case ColorFormatType::FILLFORMAT_BACKCOLOR: -- nRGB = m_nFillFormatBackColor; -- break; -- default: -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); -- } -- nRGB = OORGBToXLRGB( nRGB ); -- return nRGB; --} -- --void SAL_CALL --ScVbaColorFormat::setRGB( sal_Int32 _rgb ) throw (uno::RuntimeException) --{ -- sal_Int32 nRGB = XLRGBToOORGB( _rgb ); -- switch( m_nColorFormatType ) -- { -- case ColorFormatType::LINEFORMAT_FORECOLOR: -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineColor" ), uno::makeAny( nRGB ) ); -- break; -- case ColorFormatType::LINEFORMAT_BACKCOLOR: -- // TODO BackColor not supported -- break; -- case ColorFormatType::FILLFORMAT_FORECOLOR: -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor" ), uno::makeAny( nRGB ) ); -- if( m_pFillFormat ) -- { -- m_pFillFormat->setForeColorAndInternalStyle(nRGB); -- } -- break; -- case ColorFormatType::FILLFORMAT_BACKCOLOR: -- m_nFillFormatBackColor = nRGB; -- if( m_pFillFormat ) -- { -- m_pFillFormat->setForeColorAndInternalStyle(nRGB); -- } -- break; -- default: -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); -- } --} -- --sal_Int32 SAL_CALL --ScVbaColorFormat::getSchemeColor() throw (uno::RuntimeException) --{ -- sal_Int32 nColor = getRGB(); -- // #TODO I guess the number of elements is determined by the correct scheme -- // the implementation here seems to be a rehash of color index ( which seems to be a -- // different thing ) - I would guess we need to know/import etc. the correct color scheme -- // or at least find out a little more -- sal_Int32 i = 0; -- for( ; i < 56; i++ ) -- { -- if( nColor == MsoColorIndizes::getColorIndex(i) ) -- break; -- } -- -- if( i == 56 ) // this is most likely an error condition -- --i; -- return i; -- // #TODO figure out what craziness is this, -- // the 56 colors seems incorrect, as in default XL ( 2003 ) there are 80 colors --/* -- if( i == 56 ) -- { -- i = -2; -- } -- -- return ( i + 2 ); --*/ --} -- --void SAL_CALL --ScVbaColorFormat::setSchemeColor( sal_Int32 _schemecolor ) throw (uno::RuntimeException) --{ -- // the table is 0 based -- sal_Int32 nColor = MsoColorIndizes::getColorIndex( _schemecolor ); -- // nColor is already xl RGB -- setRGB( nColor ); --} -- -- --rtl::OUString& --ScVbaColorFormat::getServiceImplName() --{ -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaColorFormat") ); -- return sImplName; --} -- --uno::Sequence< rtl::OUString > --ScVbaColorFormat::getServiceNames() --{ -- static uno::Sequence< rtl::OUString > aServiceNames; -- if ( aServiceNames.getLength() == 0 ) -- { -- aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ColorFormat" ) ); -- } -- return aServiceNames; --} -- -diff --git sc/source/ui/vba/vbacolorformat.hxx sc/source/ui/vba/vbacolorformat.hxx -deleted file mode 100644 -index a45d5d8..0000000 ---- sc/source/ui/vba/vbacolorformat.hxx -+++ /dev/null -@@ -1,128 +0,0 @@ --/************************************************************************* -- * -- * 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: vbacolorformat.hxx,v $ -- * $Revision: 1.3.146.1 $ -- * -- * 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_XCOLORFORMAT_HXX --#define SC_VBA_XCOLORFORMAT_HXX -- --#include <com/sun/star/drawing/XShape.hpp> --#include <ooo/vba/msforms/XColorFormat.hpp> --#include <ooo/vba/msforms/XFillFormat.hpp> --#include <vbahelper/vbahelperinterface.hxx> --#include "vbafillformat.hxx" -- --typedef InheritedHelperInterfaceImpl1< ov::msforms::XColorFormat > ScVbaColorFormat_BASE; -- --class ColorFormatType --{ --public: -- const static sal_Int16 LINEFORMAT_FORECOLOR = 1; -- const static sal_Int16 LINEFORMAT_BACKCOLOR = 2; -- const static sal_Int16 FILLFORMAT_FORECOLOR = 3; -- const static sal_Int16 FILLFORMAT_BACKCOLOR = 4; -- const static sal_Int16 THREEDFORMAT_EXTRUSIONCOLOR = 5; --}; -- --struct MsoColorIndizes --{ -- const static sal_Int32 HAPICOLOR_BLACK = 0; -- const static sal_Int32 HAPICOLOR_WITHE = 16777215; -- const static sal_Int32 HAPICOLOR_RED = 16711680; -- const static sal_Int32 HAPICOLOR_BRIGHTGREEN = 65280; -- const static sal_Int32 HAPICOLOR_BLUE = 255; -- const static sal_Int32 HAPICOLOR_YELLOW = 16776960; -- const static sal_Int32 HAPICOLOR_PINK = 16711935; -- const static sal_Int32 HAPICOLOR_TURQUOISE = 65535; -- const static sal_Int32 HAPICOLOR_DARKRED = 8388608; -- const static sal_Int32 HAPICOLOR_GREEN = 32768; -- const static sal_Int32 HAPICOLOR_DARKBLUE = 128; -- const static sal_Int32 HAPICOLOR_DARKYELLOW = 8421376; -- const static sal_Int32 HAPICOLOR_VIOLET = 8388736; -- const static sal_Int32 HAPICOLOR_TEAL = 32896; -- const static sal_Int32 HAPICOLOR_GRAY_25_PERCENT = 12632256; -- const static sal_Int32 HAPICOLOR_GRAY_50_PERCENT = 8421504; -- const static sal_Int32 HAPICOLOR_PERIWINCKLE = 10066431; -- const static sal_Int32 HAPICOLOR_PLUM = 10040166; -- const static sal_Int32 HAPICOLOR_IVORY = 16777164; -- const static sal_Int32 HAPICOLOR_LIGHTTURQUOISE = 13434879; -- const static sal_Int32 HAPICOLOR_DARKPRUPLE = 6684774; -- const static sal_Int32 HAPICOLOR_CORAL = 16744576; -- const static sal_Int32 HAPICOLOR_OCEANBLUE = 26316; -- const static sal_Int32 HAPICOLOR_ICEBLUE = 13421823; -- const static sal_Int32 HAPICOLOR_SKYBLUE = 52479; -- const static sal_Int32 HAPICOLOR_LIGHTGREEN = 13434828; -- const static sal_Int32 HAPICOLOR_LIGHTYELLOW = 16777113; -- const static sal_Int32 HAPICOLOR_PALEBLUE = 10079487; -- const static sal_Int32 HAPICOLOR_ROSE = 16751052; -- const static sal_Int32 HAPICOLOR_LAVENDER = 13408767; -- const static sal_Int32 HAPICOLOR_TAN = 16764057; -- const static sal_Int32 HAPICOLOR_LIGHTBLUE = 3368703; -- const static sal_Int32 HAPICOLOR_AQUA = 3394764; -- const static sal_Int32 HAPICOLOR_LIME = 10079232; -- const static sal_Int32 HAPICOLOR_GOLD = 16763904; -- const static sal_Int32 HAPICOLOR_LIGHTORANGE = 16750848; -- const static sal_Int32 HAPICOLOR_ORANGE = 16737792; -- const static sal_Int32 HAPICOLOR_BLUEGRAY = 6710937; -- const static sal_Int32 HAPICOLOR_GRAY_40_PERCENT = 9868950; -- const static sal_Int32 HAPICOLOR_DARKTEAL = 13158; -- const static sal_Int32 HAPICOLOR_SEAGREEN = 3381606; -- const static sal_Int32 HAPICOLOR_NONAME = 13056; -- const static sal_Int32 HAPICOLOR_OLIVEGREEN = 3355392; -- const static sal_Int32 HAPICOLOR_BROWN = 10040064; -- const static sal_Int32 HAPICOLOR_INDIGO = 3355545; -- const static sal_Int32 HAPICOLOR_GRAY_80_PERCENT = 3355443; -- -- static sal_Int32 getColorIndex( sal_Int32 nIndex ); -- --}; -- --class ScVbaColorFormat : public ScVbaColorFormat_BASE --{ --private: -- css::uno::Reference< ov::XHelperInterface > m_xInternalParent; -- css::uno::Reference< css::drawing::XShape > m_xShape; -- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -- ScVbaFillFormat *m_pFillFormat; -- sal_Int16 m_nColorFormatType; -- sal_Int32 m_nFillFormatBackColor; --protected: -- virtual rtl::OUString& getServiceImplName(); -- virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -- void setColorFormat( sal_Int16 nType ); --public: -- ScVbaColorFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XHelperInterface > xInternalParent, const css::uno::Reference< css::drawing::XShape > xShape, const sal_Int16 nColorFormatType ); -- -- // Attributes -- virtual sal_Int32 SAL_CALL getRGB() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setRGB( sal_Int32 _rgb ) throw (css::uno::RuntimeException); -- virtual sal_Int32 SAL_CALL getSchemeColor() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setSchemeColor( sal_Int32 _schemecolor ) throw (css::uno::RuntimeException); -- --}; -- --#endif//SC_VBA_XCOLORFORMAT_HXX -diff --git sc/source/ui/vba/vbadialog.cxx sc/source/ui/vba/vbadialog.cxx -index abfa6d3..4adfc4c 100644 ---- sc/source/ui/vba/vbadialog.cxx -+++ sc/source/ui/vba/vbadialog.cxx -@@ -27,40 +27,11 @@ - * for a copy of the LGPLv3 License. - * - ************************************************************************/ --#include <comphelper/processfactory.hxx> -- --#include <com/sun/star/lang/XMultiComponentFactory.hpp> --#include <com/sun/star/frame/XModel.hpp> --#include <ooo/vba/excel/XApplication.hpp> -- --#include <tools/string.hxx> -- --#include "excelvbahelper.hxx" - #include "vbadialog.hxx" --#include "vbaglobals.hxx" - - using namespace ::ooo::vba; - using namespace ::com::sun::star; - --// fails silently --void --ScVbaDialog::Show() throw(uno::RuntimeException) --{ -- rtl::OUString aURL; -- // #FIXME - should this really use the current document? -- uno::Reference< frame::XModel > xModel = getCurrentDocument(); -- if ( xModel.is() ) -- { -- aURL = mapIndexToName( mnIndex ); -- if( aURL.getLength() ) -- throw uno::RuntimeException( -- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ), -- uno::Reference< XInterface > () ); -- dispatchRequests( xModel, aURL ); -- } --} -- -- - static const rtl::OUString aStringList[]= - { - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ), -@@ -103,7 +74,7 @@ ScVbaDialog::mapIndexToName( sal_Int32 nIndex ) - rtl::OUString& - ScVbaDialog::getServiceImplName() - { -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPivotTable") ); -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaDialog") ); - return sImplName; - } - -@@ -114,7 +85,7 @@ ScVbaDialog::getServiceNames() - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PivotTable" ) ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Dialog" ) ); - } - return aServiceNames; - } -diff --git sc/source/ui/vba/vbadialog.hxx sc/source/ui/vba/vbadialog.hxx -index 583969e..8625166 100644 ---- sc/source/ui/vba/vbadialog.hxx -+++ sc/source/ui/vba/vbadialog.hxx -@@ -31,26 +31,20 @@ - #define SC_VBA_DIALOG_HXX - - #include <cppuhelper/implbase1.hxx> -- --#include <com/sun/star/uno/XComponentContext.hpp> --#include <ooo/vba/excel/XApplication.hpp> - #include <ooo/vba/excel/XDialog.hpp> -- - #include <vbahelper/vbahelperinterface.hxx> --#include "vbadialog.hxx" -+#include <vbahelper/vbadialogbase.hxx> - --typedef InheritedHelperInterfaceImpl1< ov::excel::XDialog > ScVbaDialog_BASE; -+typedef cppu::ImplInheritanceHelper1< VbaDialogBase, ov::excel::XDialog > ScVbaDialog_BASE; - - class ScVbaDialog : public ScVbaDialog_BASE - { -- sal_Int32 mnIndex; - public: -- ScVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, sal_Int32 nIndex, const css::uno::Reference< css::uno::XComponentContext > xContext ):ScVbaDialog_BASE( xParent, xContext ), mnIndex( nIndex ) {} -+ ScVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nIndex ):ScVbaDialog_BASE( xParent, xContext, nIndex ) {} - virtual ~ScVbaDialog() {} - - // Methods -- virtual void SAL_CALL Show() throw (css::uno::RuntimeException); -- rtl::OUString mapIndexToName( sal_Int32 nIndex ); -+ virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ); - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -diff --git sc/source/ui/vba/vbadialogs.cxx sc/source/ui/vba/vbadialogs.cxx -index c76a0b5..c0c8bf7 100644 ---- sc/source/ui/vba/vbadialogs.cxx -+++ sc/source/ui/vba/vbadialogs.cxx -@@ -27,18 +27,8 @@ - * for a copy of the LGPLv3 License. - * - ************************************************************************/ --#include <comphelper/processfactory.hxx> -- --#include <com/sun/star/lang/XMultiComponentFactory.hpp> --#include <com/sun/star/frame/XModel.hpp> --#include <ooo/vba/excel/XApplication.hpp> - #include <ooo/vba/excel/XDialog.hpp> -- --#include <tools/string.hxx> -- --#include "excelvbahelper.hxx" - #include "vbadialogs.hxx" --#include "vbaglobals.hxx" - #include "vbadialog.hxx" - - using namespace ::ooo::vba; -@@ -49,26 +39,19 @@ ScVbaDialogs::Dummy() throw (uno::RuntimeException) - { - } - --::sal_Int32 --ScVbaDialogs::getCount() throw (uno::RuntimeException) --{ -- //#TODO #FIXEME -- //SC_VBA_STUB(); -- return 0; --} -- - uno::Any - ScVbaDialogs::Item( const uno::Any &aItem ) throw (uno::RuntimeException) - { - sal_Int32 nIndex = 0; - aItem >>= nIndex; -- uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), nIndex, mxContext ) ); -+ uno::Reference< excel::XDialog > aDialog( new ScVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, nIndex ) ); - return uno::Any( aDialog ); - } -+ - rtl::OUString& - ScVbaDialogs::getServiceImplName() - { -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaWorksheet") ); -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaDialogs") ); - return sImplName; - } - -@@ -79,7 +62,7 @@ ScVbaDialogs::getServiceNames() - if ( aServiceNames.getLength() == 0 ) - { - aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Worksheet" ) ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Dialogs" ) ); - } - return aServiceNames; - } -diff --git sc/source/ui/vba/vbadialogs.hxx sc/source/ui/vba/vbadialogs.hxx -index a0b2b24..ab53253 100644 ---- sc/source/ui/vba/vbadialogs.hxx -+++ sc/source/ui/vba/vbadialogs.hxx -@@ -30,16 +30,14 @@ - #ifndef SC_VBA_DIALOGS_HXX - #define SC_VBA_DIALOGS_HXX - --#include <cppuhelper/implbase1.hxx> -- - #include <com/sun/star/uno/XComponentContext.hpp> - #include <ooo/vba/excel/XDialogs.hpp> - #include <ooo/vba/XCollection.hpp> - #include <vbahelper/vbahelperinterface.hxx> -+#include <vbahelper/vbadialogsbase.hxx> -+#include <cppuhelper/implbase1.hxx> - --class ScModelObj; -- --typedef InheritedHelperInterfaceImpl1< ov::excel::XDialogs > ScVbaDialogs_BASE; -+typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::excel::XDialogs > ScVbaDialogs_BASE; - - class ScVbaDialogs : public ScVbaDialogs_BASE - { -@@ -48,7 +46,6 @@ public: - virtual ~ScVbaDialogs() {} - - // XCollection -- virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); - - // XDialogs -diff --git sc/source/ui/vba/vbaeventshelper.cxx sc/source/ui/vba/vbaeventshelper.cxx -index 794cb84..3948ac6 100644 ---- sc/source/ui/vba/vbaeventshelper.cxx -+++ sc/source/ui/vba/vbaeventshelper.cxx -@@ -63,16 +63,13 @@ - #include <cellsuno.hxx> - #include <convuno.hxx> - #include <map> -+#include <svx/msvbahelper.hxx> - - using namespace std; - using namespace com::sun::star; - using namespace ooo::vba; - using namespace com::sun::star::document::VbaEventId; - --const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:"); --const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard."); --const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document"); -- - typedef ::cppu::WeakImplHelper1< util::XChangesListener > WorksheetChangeListener_BASE; - - class WorksheetChangeListener : public WorksheetChangeListener_BASE -@@ -488,37 +485,6 @@ ScVbaEventsHelper::getEventName( const sal_Int32 nId ) - return sEventName; - } - --// Treat the args as possible inouts ( convertion at bottom of method ) --sal_Bool ScVbaEventsHelper::executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet ) --{ -- // until ObjectModules ( and persisting of codenames ) is supported, if this is a -- // document saved from XL then we won't be able to determine the codename for the Workbook -- // Module, so... we have no choice but to search all modules for the moment, thus the macro -- // passed in should be the fully specified name. -- rtl::OUString sUrl = sUrlPart0.concat( sMacroName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 ) ; -- uno::Sequence< sal_Int16 > aOutArgsIndex; -- uno::Sequence< uno::Any > aOutArgs; -- ErrCode nErr = pShell->CallXScript( sUrl, aArgs, aRet, -- aOutArgsIndex, aOutArgs, sal_False ); -- -- // Script Executed? -- if ( nErr != ERRCODE_NONE ) -- return sal_False; -- -- sal_Int32 nLen = aOutArgs.getLength(); -- // convert any out params to seem like they were inouts -- if ( nLen ) -- { -- for ( sal_Int32 index=0; index < nLen; ++index ) -- { -- sal_Int32 nOutIndex = aOutArgsIndex[ index ]; -- aArgs[ nOutIndex ] = aOutArgs[ index ]; -- } -- -- } -- return sal_True; --} -- - uno::Any ScVbaEventsHelper::createWorkSheet( SfxObjectShell* pShell, SCTAB nTab ) - { - uno::Any aRet; -@@ -664,7 +630,7 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab ) - case VBAEVENT_WORKSHEET_SELECTIONCHANGE : - { - rtl::OUString aSheetModuleName = getSheetModuleName( nTab ); -- sMacroPath = docMacroExists( pShell, aSheetModuleName, sMacroName ); -+ sMacroPath = findVBAMacro( pShell, aSheetModuleName, sMacroName ); - break; - } - // Workbook -@@ -698,7 +664,7 @@ ScVbaEventsHelper::getMacroPath( const sal_Int32 nEventId, const SCTAB nTab ) - sWorkbookModuleName = aExtDocSettings.maGlobCodeName; - } - -- sMacroPath = docMacroExists( pShell, sWorkbookModuleName, sMacroName ); -+ sMacroPath = findVBAMacro( pShell, sWorkbookModuleName, sMacroName ); - break; - } - default: -diff --git sc/source/ui/vba/vbaeventshelper.hxx sc/source/ui/vba/vbaeventshelper.hxx -index e812aa0..d165695 100644 ---- sc/source/ui/vba/vbaeventshelper.hxx -+++ sc/source/ui/vba/vbaeventshelper.hxx -@@ -63,7 +63,6 @@ private: - css::uno::Any createRange( const css::uno::Any& aRange ); - css::uno::Any createHyperlink( const css::uno::Any& rCell ); - css::uno::Any createWindow( SfxObjectShell* pShell ); -- sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, css::uno::Sequence< css::uno::Any >& aArgs, css::uno::Any& aRet ); - SCTAB getTabFromArgs( const css::uno::Sequence< css::uno::Any > aArgs, const sal_Int32 nPos = 0 ); - rtl::OUString getEventName( const sal_Int32 nEventId ); - rtl::OUString getMacroPath( const sal_Int32 nEventId, const SCTAB nTab = INVALID_TAB ); -diff --git sc/source/ui/vba/vbafillformat.cxx sc/source/ui/vba/vbafillformat.cxx -deleted file mode 100644 -index ed7fcd2..0000000 ---- sc/source/ui/vba/vbafillformat.cxx -+++ /dev/null -@@ -1,202 +0,0 @@ --/************************************************************************* -- * -- * 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: vbafillformat.cxx,v $ -- * $Revision: 1.3 $ -- * -- * 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 <com/sun/star/beans/XPropertySet.hpp> --#include <com/sun/star/awt/Gradient.hpp> --#include <com/sun/star/awt/GradientStyle.hpp> --#include <ooo/vba/office/MsoGradientStyle.hpp> --#include "vbafillformat.hxx" --#include "vbacolorformat.hxx" -- --using namespace ooo::vba; --using namespace com::sun::star; -- --ScVbaFillFormat::ScVbaFillFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaFillFormat_BASE( xParent, xContext ), m_xShape( xShape ) --{ -- m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); -- m_nFillStyle = drawing::FillStyle_SOLID; -- m_nForeColor = 0; -- m_nBackColor = 0; -- m_nGradientAngle = 0; --} -- --void --ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::RuntimeException) --{ -- m_nFillStyle = nFillStyle; -- if( m_nFillStyle == drawing::FillStyle_GRADIENT ) -- { -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_GRADIENT ) ); -- awt::Gradient aGradient; -- // AXIAL -- // RADIAL -- // ELLIPTICAL -- // SQUARE -- // RECT -- aGradient.Style = awt::GradientStyle_LINEAR; -- aGradient.StartColor = ForeColor()->getRGB(); -- aGradient.EndColor = BackColor()->getRGB(); -- aGradient.Angle = m_nGradientAngle; -- aGradient.Border = 0; -- aGradient.XOffset = 0; -- aGradient.YOffset = 0; -- aGradient.StartIntensity = 100; -- aGradient.EndIntensity = 100; -- aGradient.StepCount = 1; -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), uno::makeAny( aGradient ) ); -- } -- else if( m_nFillStyle == drawing::FillStyle_SOLID ) -- { -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny(drawing::FillStyle_SOLID) ); -- } --} -- --void --ScVbaFillFormat::setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException) --{ -- m_nForeColor = nForeColor; -- setFillStyle( m_nFillStyle ); --} -- --// Attributes --sal_Bool SAL_CALL --ScVbaFillFormat::getVisible() throw (uno::RuntimeException) --{ -- drawing::FillStyle nFillStyle; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= nFillStyle; -- if( nFillStyle == drawing::FillStyle_NONE ) -- return sal_False; -- return sal_True; --} -- --void SAL_CALL --ScVbaFillFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) --{ -- drawing::FillStyle aFillStyle; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= aFillStyle; -- if( !_visible ) -- { -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_NONE ) ); -- } -- else -- { -- if( aFillStyle == drawing::FillStyle_NONE ) -- { -- setFillStyle( m_nFillStyle ); -- } -- } --} -- --double SAL_CALL --ScVbaFillFormat::getTransparency() throw (uno::RuntimeException) --{ -- sal_Int16 nTransparence = 0; -- double dTransparence = 0; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ) ) >>= nTransparence; -- dTransparence = static_cast<double>( nTransparence ); -- dTransparence /= 100; -- return dTransparence; --} -- --void SAL_CALL --ScVbaFillFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) --{ -- sal_Int16 nTransparence = static_cast< sal_Int16 >( _transparency * 100 ); -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ), uno::makeAny( nTransparence ) ); --} -- -- --// Methods --void SAL_CALL --ScVbaFillFormat::Solid() throw (uno::RuntimeException) --{ -- setFillStyle( drawing::FillStyle_SOLID ); --} -- --void SAL_CALL --ScVbaFillFormat::TwoColorGradient( sal_Int32 style, sal_Int32 /*variant*/ ) throw (uno::RuntimeException) --{ -- if( style == office::MsoGradientStyle::msoGradientHorizontal ) -- { -- m_nGradientAngle = 0; -- setFillStyle( drawing::FillStyle_GRADIENT ); -- } -- else if( style == office::MsoGradientStyle::msoGradientVertical ) -- { -- m_nGradientAngle = 900; -- setFillStyle( drawing::FillStyle_GRADIENT ); -- } -- else if( style == office::MsoGradientStyle::msoGradientDiagonalDown ) -- { -- m_nGradientAngle = 450; -- setFillStyle( drawing::FillStyle_GRADIENT ); -- } -- else if( style == office::MsoGradientStyle::msoGradientDiagonalUp ) -- { -- m_nGradientAngle = 900 + 450; -- setFillStyle( drawing::FillStyle_GRADIENT ); -- } --} -- --uno::Reference< msforms::XColorFormat > SAL_CALL --ScVbaFillFormat::BackColor() throw (uno::RuntimeException) --{ -- if( !m_xColorFormat.is() ) -- m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_BACKCOLOR ) ); -- return m_xColorFormat; --} -- --uno::Reference< msforms::XColorFormat > SAL_CALL --ScVbaFillFormat::ForeColor() throw (uno::RuntimeException) --{ -- if( !m_xColorFormat.is() ) -- m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_FORECOLOR ) ); -- return m_xColorFormat; --} -- -- --rtl::OUString& --ScVbaFillFormat::getServiceImplName() --{ -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFillFormat") ); -- return sImplName; --} -- --uno::Sequence< rtl::OUString > --ScVbaFillFormat::getServiceNames() --{ -- static uno::Sequence< rtl::OUString > aServiceNames; -- if ( aServiceNames.getLength() == 0 ) -- { -- aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.FillFormat" ) ); -- } -- return aServiceNames; --} -- -diff --git sc/source/ui/vba/vbafillformat.hxx sc/source/ui/vba/vbafillformat.hxx -deleted file mode 100644 -index 047af92..0000000 ---- sc/source/ui/vba/vbafillformat.hxx -+++ /dev/null -@@ -1,74 +0,0 @@ --/************************************************************************* -- * -- * 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: vbafillformat.hxx,v $ -- * $Revision: 1.3 $ -- * -- * 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_XFILLFORMAT_HXX --#define SC_VBA_XFILLFORMAT_HXX -- --#include <com/sun/star/drawing/XShape.hpp> --#include <com/sun/star/drawing/FillStyle.hpp> --#include <ooo/vba/msforms/XFillFormat.hpp> --#include <vbahelper/vbahelperinterface.hxx> -- --typedef InheritedHelperInterfaceImpl1< ov::msforms::XFillFormat > ScVbaFillFormat_BASE; -- --class ScVbaFillFormat : public ScVbaFillFormat_BASE --{ --private: -- css::uno::Reference< css::drawing::XShape > m_xShape; -- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -- css::uno::Reference< ov::msforms::XColorFormat > m_xColorFormat; -- css::drawing::FillStyle m_nFillStyle; -- sal_Int32 m_nForeColor; -- sal_Int32 m_nBackColor; -- sal_Int16 m_nGradientAngle; --private: -- void setFillStyle( css::drawing::FillStyle nFillStyle ) throw (css::uno::RuntimeException); --protected: -- virtual rtl::OUString& getServiceImplName(); -- virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -- --public: -- ScVbaFillFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); -- -- void setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException); -- // Attributes -- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); -- virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException); -- -- // Methods -- virtual void SAL_CALL Solid() throw (css::uno::RuntimeException); -- virtual void SAL_CALL TwoColorGradient( sal_Int32 style, sal_Int32 variant ) throw (css::uno::RuntimeException); -- virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); -- virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); -- --}; -- --#endif//SC_VBA_XFILLFORMAT_HXX -diff --git sc/source/ui/vba/vbafont.cxx sc/source/ui/vba/vbafont.cxx -index 41d09e9..49ebf63 100644 ---- sc/source/ui/vba/vbafont.cxx -+++ sc/source/ui/vba/vbafont.cxx -@@ -46,30 +46,7 @@ - using namespace ::ooo::vba; - using namespace ::com::sun::star; - --// use local constants there is no need to expose these constants --// externally. Looking at the Format->Character dialog it seem that --// these may infact be even be calculated. Leave hardcoded for now --// #FIXEME #TBD investigate the code for dialog mentioned above -- --// The font baseline is not specified. --const short NORMAL = 0; -- --// specifies a superscripted. --const short SUPERSCRIPT = 33; -- --// specifies a subscripted. --const short SUBSCRIPT = -33; -- --// specifies a hight of superscripted font -- const sal_Int8 SUPERSCRIPTHEIGHT = 58; -- --// specifies a hight of subscripted font --const sal_Int8 SUBSCRIPTHEIGHT = 58; -- --// specifies a hight of normal font --const short NORMALHEIGHT = 100; -- --ScVbaFont::ScVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, uno::Reference< beans::XPropertySet > xPropertySet, ScCellRangeObj* pRangeObj ) throw ( uno::RuntimeException ) : ScVbaFont_BASE( xParent, xContext ), mxFont( xPropertySet, css::uno::UNO_QUERY_THROW ), mPalette( dPalette ), mpRangeObj( pRangeObj ) -+ScVbaFont::ScVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const ScVbaPalette& dPalette, uno::Reference< beans::XPropertySet > xPropertySet, ScCellRangeObj* pRangeObj ) throw ( uno::RuntimeException ) : ScVbaFont_BASE( xParent, xContext, dPalette.getPalette(), xPropertySet ), mPalette( dPalette ), mpRangeObj( pRangeObj ) - { - } - -@@ -243,19 +220,13 @@ ScVbaFont::getSubscript() throw ( uno::RuntimeException ) - return uno::makeAny( ( nValue == SUBSCRIPT ) ); - } - --void SAL_CALL --ScVbaFont::setSize( const uno::Any& aValue ) throw( uno::RuntimeException ) --{ -- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), aValue ); --} -- - uno::Any SAL_CALL - ScVbaFont::getSize() throw ( uno::RuntimeException ) - { - if ( GetDataSet() ) - if ( GetDataSet()->GetItemState( ATTR_FONT_HEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE ) - return aNULL(); -- return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ) ); -+ return ScVbaFont_BASE::getSize(); - } - - void SAL_CALL -@@ -267,13 +238,12 @@ ScVbaFont::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeExcep - // handled properly here - - if ( !nIndex || ( nIndex == excel::XlColorIndex::xlColorIndexAutomatic ) ) -+ { - nIndex = 1; // check defualt ( assume black ) -- --nIndex; // OOo indices are zero bases -- uno::Reference< container::XIndexAccess > xIndex = mPalette.getPalette(); -- // setColor expects colors in XL RGB values -- // #FIXME this is daft we convert OO RGB val to XL RGB val and -- // then back again to OO RGB value -- setColor( OORGBToXLRGB(xIndex->getByIndex( nIndex )) ); -+ ScVbaFont_BASE::setColorIndex( uno::makeAny( nIndex ) ); -+ } -+ else -+ ScVbaFont_BASE::setColorIndex( _colorindex ); - } - - -@@ -284,26 +254,7 @@ ScVbaFont::getColorIndex() throw ( uno::RuntimeException ) - if ( GetDataSet() ) - if ( GetDataSet()->GetItemState( ATTR_FONT_COLOR, TRUE, NULL) == SFX_ITEM_DONTCARE ) - return aNULL(); -- -- // getColor returns Xl ColorValue, need to convert it to OO val -- // as the palette deals with OO RGB values -- // #FIXME this is daft in getColor we convert OO RGB val to XL RGB val -- // and then back again to OO RGB value -- XLRGBToOORGB( getColor() ) >>= nColor; -- uno::Reference< container::XIndexAccess > xIndex = mPalette.getPalette(); -- sal_Int32 nElems = xIndex->getCount(); -- sal_Int32 nIndex = -1; -- for ( sal_Int32 count=0; count<nElems; ++count ) -- { -- sal_Int32 nPaletteColor = 0; -- xIndex->getByIndex( count ) >>= nPaletteColor; -- if ( nPaletteColor == nColor ) -- { -- nIndex = count + 1; // 1 based -- break; -- } -- } -- return uno::makeAny( nIndex ); -+ return ScVbaFont_BASE::getColorIndex(); - } - - ////////////////////////////////////////////////////////////////////////////////////////// -@@ -396,28 +347,13 @@ ScVbaFont::getFontStyle() throw ( uno::RuntimeException ) - return uno::makeAny( aStyles.makeStringAndClear() ); - } - --void SAL_CALL --ScVbaFont::setBold( const uno::Any& aValue ) throw( uno::RuntimeException ) --{ -- sal_Bool bValue = sal_False; -- aValue >>= bValue; -- double fBoldValue = awt::FontWeight::NORMAL; -- if( bValue ) -- fBoldValue = awt::FontWeight::BOLD; -- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), ( uno::Any )fBoldValue ); -- --} -- - uno::Any SAL_CALL - ScVbaFont::getBold() throw ( uno::RuntimeException ) - { - if ( GetDataSet() ) - if ( GetDataSet()->GetItemState( ATTR_FONT_WEIGHT, TRUE, NULL) == SFX_ITEM_DONTCARE ) - return aNULL(); -- -- double fValue = 0.0; -- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ) ) >>= fValue; -- return uno::makeAny( fValue == awt::FontWeight::BOLD ); -+ return ScVbaFont_BASE::getBold(); - } - - void SAL_CALL -@@ -481,32 +417,13 @@ ScVbaFont::getUnderline() throw ( uno::RuntimeException ) - return uno::makeAny( nValue ); - } - --void SAL_CALL --ScVbaFont::setStrikethrough( const uno::Any& aValue ) throw ( uno::RuntimeException ) --{ -- sal_Bool bValue = sal_False; -- aValue >>= bValue; -- short nValue = awt::FontStrikeout::NONE; -- if( bValue ) -- nValue = awt::FontStrikeout::SINGLE; -- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ), ( uno::Any )nValue ); --} -- - uno::Any SAL_CALL - ScVbaFont::getStrikethrough() throw ( uno::RuntimeException ) - { - if ( GetDataSet() ) - if ( GetDataSet()->GetItemState( ATTR_FONT_CROSSEDOUT, TRUE, NULL) == SFX_ITEM_DONTCARE ) - return aNULL(); -- short nValue = 0; -- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ) ) >>= nValue; -- return uno::Any( nValue == awt::FontStrikeout::SINGLE ); --} -- --void SAL_CALL --ScVbaFont::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException ) --{ -- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue ); -+ return ScVbaFont_BASE::getStrikethrough(); - } - - uno::Any SAL_CALL -@@ -515,18 +432,7 @@ ScVbaFont::getShadow() throw (uno::RuntimeException) - if ( GetDataSet() ) - if ( GetDataSet()->GetItemState( ATTR_FONT_SHADOWED, TRUE, NULL) == SFX_ITEM_DONTCARE ) - return aNULL(); -- return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) ); --} -- --void SAL_CALL --ScVbaFont::setItalic( const uno::Any& aValue ) throw ( uno::RuntimeException ) --{ -- sal_Bool bValue = sal_False; -- aValue >>= bValue; -- short nValue = awt::FontSlant_NONE; -- if( bValue ) -- nValue = awt::FontSlant_ITALIC; -- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), ( uno::Any )nValue ); -+ return ScVbaFont_BASE::getShadow(); - } - - uno::Any SAL_CALL -@@ -536,17 +442,7 @@ ScVbaFont::getItalic() throw ( uno::RuntimeException ) - if ( GetDataSet()->GetItemState( ATTR_FONT_POSTURE, TRUE, NULL) == SFX_ITEM_DONTCARE ) - return aNULL(); - -- awt::FontSlant aFS; -- mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ) ) >>= aFS; -- return uno::makeAny( aFS == awt::FontSlant_ITALIC ); --} -- --void SAL_CALL --ScVbaFont::setName( const uno::Any& aValue ) throw ( uno::RuntimeException ) --{ -- rtl::OUString sString; -- aValue >>= sString; -- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), aValue); -+ return ScVbaFont_BASE::getItalic(); - } - - uno::Any SAL_CALL -@@ -555,22 +451,17 @@ ScVbaFont::getName() throw ( uno::RuntimeException ) - if ( GetDataSet() ) - if ( GetDataSet()->GetItemState( ATTR_FONT, TRUE, NULL) == SFX_ITEM_DONTCARE ) - return aNULL(); -- return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ) ); -+ return ScVbaFont_BASE::getName(); - } - uno::Any - ScVbaFont::getColor() throw (uno::RuntimeException) - { -+ // #TODO #FIXME - behave like getXXX above ( wrt. GetDataSet ) - uno::Any aAny; - aAny = OORGBToXLRGB( mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) ) ); - return aAny; - } - --void --ScVbaFont::setColor( const uno::Any& _color ) throw (uno::RuntimeException) --{ -- mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) , XLRGBToOORGB(_color)); --} -- - void SAL_CALL - ScVbaFont::setOutlineFont( const uno::Any& aValue ) throw ( uno::RuntimeException ) - { -diff --git sc/source/ui/vba/vbafont.hxx sc/source/ui/vba/vbafont.hxx -index efca63c..16f70ea 100644 ---- sc/source/ui/vba/vbafont.hxx -+++ sc/source/ui/vba/vbafont.hxx -@@ -32,19 +32,19 @@ - - #include <cppuhelper/implbase1.hxx> - --#include <ooo/vba/excel/XFont.hpp> - #include <com/sun/star/beans/XPropertySet.hpp> -+#include <ooo/vba/excel/XFont.hpp> - #include <vbahelper/vbahelperinterface.hxx> -+#include <vbahelper/vbafontbase.hxx> - #include "vbapalette.hxx" - - class ScTableSheetsObj; - class ScCellRangeObj; - --typedef InheritedHelperInterfaceImpl1< ov::excel::XFont > ScVbaFont_BASE; -+typedef cppu::ImplInheritanceHelper1< VbaFontBase, ov::excel::XFont > ScVbaFont_BASE; - - class ScVbaFont : public ScVbaFont_BASE - { -- css::uno::Reference< css::beans::XPropertySet > mxFont; - ScVbaPalette mPalette; - ScCellRangeObj* mpRangeObj; - SfxItemSet* GetDataSet(); -@@ -54,7 +54,6 @@ public: - - // Attributes - virtual css::uno::Any SAL_CALL getSize() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setSize( const css::uno::Any& _size ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getStandardFontSize() throw (css::uno::RuntimeException); - virtual void SAL_CALL setStandardFontSize( const css::uno::Any& _standardfontsize ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getStandardFont() throw (css::uno::RuntimeException); -@@ -64,23 +63,17 @@ public: - virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException); - virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setBold( const css::uno::Any& _bold ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getUnderline() throw (css::uno::RuntimeException); - virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setStrikethrough( const css::uno::Any& _strikethrough ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setShadow( const css::uno::Any& _shadow ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setItalic( const css::uno::Any& _italic ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getSubscript() throw (css::uno::RuntimeException); - virtual void SAL_CALL setSubscript( const css::uno::Any& _subscript ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getSuperscript() throw (css::uno::RuntimeException); - virtual void SAL_CALL setSuperscript( const css::uno::Any& _superscript ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setName( const css::uno::Any& _name ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getColor() throw (css::uno::RuntimeException) ; -- virtual void SAL_CALL setColor( const css::uno::Any& _color ) throw (css::uno::RuntimeException) ; - virtual css::uno::Any SAL_CALL getOutlineFont() throw (css::uno::RuntimeException) ; - virtual void SAL_CALL setOutlineFont( const css::uno::Any& _outlinefont ) throw (css::uno::RuntimeException) ; - // XHelperInterface ---- sc/source/ui/vba/vbalineformat.cxx -+++ /dev/null -@@ -1,458 +0,0 @@ --/************************************************************************* -- * -- * 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: vbalineformat.cxx,v $ -- * $Revision: 1.4 $ -- * -- * 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 <ooo/vba/office/MsoArrowheadStyle.hpp> --#include <ooo/vba/office/MsoArrowheadLength.hpp> --#include <ooo/vba/office/MsoArrowheadWidth.hpp> --#include <ooo/vba/office/MsoLineDashStyle.hpp> --#include <com/sun/star/drawing/LineStyle.hpp> --#include <com/sun/star/drawing/LineDash.hpp> --#include "vbalineformat.hxx" --#include "vbacolorformat.hxx" -- --using namespace ooo::vba; --using namespace com::sun::star; -- --ScVbaLineFormat::ScVbaLineFormat( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaLineFormat_BASE( xParent, xContext ), m_xShape( xShape ) --{ -- m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); -- m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid; -- m_nLineWeight = 1; --} -- --sal_Int32 --ScVbaLineFormat::calculateArrowheadSize() --{ -- return 0; --} -- --sal_Int32 --ScVbaLineFormat::convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ) --{ -- sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; -- if (sLineName.equals(rtl::OUString::createFromAscii("Small Arrow")) || -- sLineName.equals(rtl::OUString::createFromAscii("Arrow")) || -- sLineName.equals(rtl::OUString::createFromAscii("msArrowEnd")) || -- sLineName.equals(rtl::OUString::createFromAscii("Double Arrow"))) -- { -- // msoArrowheadTriangle -- nLineType = office::MsoArrowheadStyle::msoArrowheadTriangle; -- } -- else if (sLineName.equals(rtl::OUString::createFromAscii("Square 45")) || -- sLineName.equals(rtl::OUString::createFromAscii("Square")) || -- sLineName.equals(rtl::OUString::createFromAscii("msArrowDiamondEnd"))) -- { -- // msoArrowheadDiamond -- nLineType = office::MsoArrowheadStyle::msoArrowheadDiamond; -- } -- else if (sLineName.equals(rtl::OUString::createFromAscii("Circle")) || -- sLineName.equals(rtl::OUString::createFromAscii("msArrowOvalEnd")) || -- sLineName.equals(rtl::OUString::createFromAscii("Dimension Lines")) ) -- { -- // msoArrowheadOval -- nLineType = office::MsoArrowheadStyle::msoArrowheadOval; -- } -- else if (sLineName.equals(rtl::OUString::createFromAscii("Arrow concave")) || -- sLineName.equals(rtl::OUString::createFromAscii("msArrowStealthEnd"))) -- { -- // msoArrowheadStealth -- nLineType = office::MsoArrowheadStyle::msoArrowheadStealth; -- } -- else if (sLineName.equals(rtl::OUString::createFromAscii("Rounded short Arrow")) || -- sLineName.equals(rtl::OUString::createFromAscii("Rounded large Arrow")) || -- sLineName.equals(rtl::OUString::createFromAscii("Symmetric Arrow")) || -- sLineName.equals(rtl::OUString::createFromAscii("msArrowOpenEnd")) || -- sLineName.equals(rtl::OUString::createFromAscii("Line Arrow"))) -- { -- // msoArrowheadOpen -- nLineType = office::MsoArrowheadStyle::msoArrowheadOpen; -- } -- else -- { -- // msoArrowheadNone -- nLineType = office::MsoArrowheadStyle::msoArrowheadNone; -- } -- return nLineType; --} -- --rtl::OUString --ScVbaLineFormat::convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (uno::RuntimeException) --{ -- switch( nArrowheadStyle ) -- { -- case office::MsoArrowheadStyle::msoArrowheadNone: -- return rtl::OUString(rtl::OUString::createFromAscii( "" ) ); -- case office::MsoArrowheadStyle::msoArrowheadStealth: -- return rtl::OUString::createFromAscii( "Arrow concave" ); -- case office::MsoArrowheadStyle::msoArrowheadOpen: -- return rtl::OUString::createFromAscii("Line Arrow" ); -- case office::MsoArrowheadStyle::msoArrowheadOval: -- return rtl::OUString::createFromAscii("Circle" ); -- case office::MsoArrowheadStyle::msoArrowheadDiamond: -- return rtl::OUString::createFromAscii( "Square 45" ); -- case office::MsoArrowheadStyle::msoArrowheadTriangle: -- return rtl::OUString::createFromAscii( "Arrow" ); -- default: -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Invalid Arrow Style!"), uno::Reference< uno::XInterface >() ); -- } --} -- --// Attributes --sal_Int32 SAL_CALL --ScVbaLineFormat::getBeginArrowheadStyle() throw (uno::RuntimeException) --{ -- sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; -- rtl::OUString sLineName; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ) ) >>= sLineName; -- if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString::createFromAscii( "msArray" ) ) ) != -1 ) -- { -- sal_Int32 nIndex = sLineName.indexOf( rtl::OUString::createFromAscii(" ") ); -- rtl::OUString sName = sLineName.copy( 0, nIndex ); -- //sal_Int32 nSize = sLineName.copy( nIndex + 1 ).toInt32(); -- nLineType = convertLineStartEndNameToArrowheadStyle( sName ); -- } -- else -- { -- nLineType = convertLineStartEndNameToArrowheadStyle( sLineName ); -- } -- return nLineType; --} -- --void SAL_CALL --ScVbaLineFormat::setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (uno::RuntimeException) --{ -- rtl::OUString sArrayName = convertArrowheadStyleToLineStartEndName( _beginarrowheadstyle ); -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ), uno::makeAny( sArrayName ) ); --} -- --sal_Int32 SAL_CALL --ScVbaLineFormat::getBeginArrowheadLength() throw (uno::RuntimeException) --{ -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); --} -- --void SAL_CALL --ScVbaLineFormat::setBeginArrowheadLength( sal_Int32 /*_beginarrowheadlength*/ ) throw (uno::RuntimeException) --{ -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); --} -- --sal_Int32 SAL_CALL --ScVbaLineFormat::getBeginArrowheadWidth() throw (uno::RuntimeException) --{ -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); --} -- --void SAL_CALL --ScVbaLineFormat::setBeginArrowheadWidth( sal_Int32 /*_beginarrowheadwidth*/ ) throw (uno::RuntimeException) --{ -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); --} -- --sal_Int32 SAL_CALL --ScVbaLineFormat::getEndArrowheadStylel() throw (uno::RuntimeException) --{ -- return 0; --} -- --void SAL_CALL --ScVbaLineFormat::setEndArrowheadStylel( sal_Int32 /*_endarrowheadstylel*/ ) throw (uno::RuntimeException) --{ --} -- --sal_Int32 SAL_CALL --ScVbaLineFormat::getEndArrowheadLength() throw (uno::RuntimeException) --{ -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); --} -- --void SAL_CALL --ScVbaLineFormat::setEndArrowheadLength( sal_Int32 /*_endarrowheadlength*/ ) throw (uno::RuntimeException) --{ -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); --} -- --sal_Int32 SAL_CALL --ScVbaLineFormat::getEndArrowheadWidth() throw (uno::RuntimeException) --{ -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); --} -- --void SAL_CALL --ScVbaLineFormat::setEndArrowheadWidth( sal_Int32 /*_endarrowheadwidth*/ ) throw (uno::RuntimeException) --{ -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); --} -- --double SAL_CALL --ScVbaLineFormat::getWeight() throw (uno::RuntimeException) --{ -- sal_Int32 nLineWidth=0; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineWidth") ) >>= nLineWidth; -- double dLineWidth = Millimeter::getInPoints( nLineWidth ); -- return dLineWidth; --} -- --void SAL_CALL --ScVbaLineFormat::setWeight( double _weight ) throw (uno::RuntimeException) --{ -- if( _weight < 0 ) -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter: Must be positv."), uno::Reference< uno::XInterface >() ); -- if( _weight == 0 ) -- _weight = 0.5; -- m_nLineWeight = _weight; -- Millimeter aMillimeter; -- aMillimeter.setInPoints( _weight ); -- -- sal_Int32 nLineWidth = static_cast<sal_Int32>( aMillimeter.getInHundredthsOfOneMillimeter() ); -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineWidth" ), uno::makeAny( nLineWidth ) ); -- setDashStyle( m_nLineDashStyle ); --} -- --sal_Bool SAL_CALL --ScVbaLineFormat::getVisible() throw (uno::RuntimeException) --{ -- drawing::LineStyle aLineStyle; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; -- if( aLineStyle == drawing::LineStyle_NONE ) -- { -- return sal_False; -- } -- return sal_True; --} -- --void SAL_CALL --ScVbaLineFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) --{ -- drawing::LineStyle aLineStyle; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; -- if( !_visible ) -- { -- aLineStyle = drawing::LineStyle_NONE; -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) ); -- } -- else -- { -- if( aLineStyle == drawing::LineStyle_NONE ) -- { -- setDashStyle( m_nLineDashStyle ); -- } -- } --} -- --double SAL_CALL --ScVbaLineFormat::getTransparency() throw (uno::RuntimeException) --{ -- sal_Int16 nTransparency = 0; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ) ) >>= nTransparency; -- double fTransparency = static_cast<double>( nTransparency ); -- return fTransparency / 100; --} -- --void SAL_CALL --ScVbaLineFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) --{ -- sal_Int16 nTransparency = static_cast<sal_Int16>( _transparency * 100 ); -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ), uno::makeAny( nTransparency ) ); --} -- --sal_Int16 SAL_CALL --ScVbaLineFormat::getStyle() throw (uno::RuntimeException) --{ -- //OpenOffice.org only supports one LineStyle (other than the DashStyles) -- //Therefore we can only return the SingleLine -- return 1; --} -- --void SAL_CALL --ScVbaLineFormat::setStyle( sal_Int16 /*_style */) throw (uno::RuntimeException) --{ -- //OpenOffice.org only supports one LineStyle (other than the DashStyles) -- //Therefore we do not set the LineStyle, because it maybe is already set -- //to Dashed or Single Line. Setting the 'Visible' or 'DashStyle' properties -- //will be done with the according methods. --} -- --sal_Int32 SAL_CALL --ScVbaLineFormat::getDashStyle() throw (uno::RuntimeException) --{ -- drawing::LineStyle eLineStyle; -- //LineStyle integer in Xray -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= eLineStyle; -- if( eLineStyle == drawing::LineStyle_SOLID ) -- m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid; -- else -- { -- drawing::LineDash aLineDash; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineDash" ) ) >>= aLineDash; -- if( aLineDash.Dots == 0 ) -- { -- //LineDash -- //LineLongDash -- m_nLineDashStyle = office::MsoLineDashStyle::msoLineDash; -- if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) ) -- { -- m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDash; -- } -- } -- else if( aLineDash.Dots == 1 ) -- { -- // LineDashDot -- // LineLongDashDot -- // LineSquareDot -- // LineRoundDot ! not supported -- m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDot; -- if( aLineDash.Dashes == 0 ) -- { -- m_nLineDashStyle = office::MsoLineDashStyle::msoLineSquareDot; -- } -- else -- { -- if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) ) -- { -- m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDashDot; -- } -- } -- } -- else if( aLineDash.Dots == 2 ) -- { -- // LineDashDotDot -- m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDotDot; -- } -- } -- -- return m_nLineDashStyle; --} -- --void SAL_CALL --ScVbaLineFormat::setDashStyle( sal_Int32 _dashstyle ) throw (uno::RuntimeException) --{ -- m_nLineDashStyle = _dashstyle; -- if( _dashstyle == office::MsoLineDashStyle::msoLineSolid ) -- { -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID )); -- } -- else -- { -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_DASH ) ); -- drawing::LineDash pLineDash; -- Millimeter aMillimeter( m_nLineWeight ); -- sal_Int32 nPixel = static_cast< sal_Int32 >( aMillimeter.getInHundredthsOfOneMillimeter() ); -- switch( _dashstyle ) -- { -- case office::MsoLineDashStyle::msoLineDashDot: -- pLineDash.Dots = 1; -- pLineDash.DotLen = nPixel; -- pLineDash.Dashes = 1; -- pLineDash.DashLen = 5 * nPixel; -- pLineDash.Distance = 4 * nPixel; -- break; -- case office::MsoLineDashStyle::msoLineLongDashDot: -- pLineDash.Dots = 1; -- pLineDash.DotLen = nPixel; -- pLineDash.Dashes = 1; -- pLineDash.DashLen = 10 * nPixel; -- pLineDash.Distance = 4 * nPixel; -- break; -- case office::MsoLineDashStyle::msoLineDash: -- pLineDash.Dots = 0; -- pLineDash.DotLen = 0; -- pLineDash.Dashes = 1; -- pLineDash.DashLen = 6 * nPixel; -- pLineDash.Distance = 4 * nPixel; -- break; -- case office::MsoLineDashStyle::msoLineDashDotDot: -- pLineDash.Dots = 2; -- pLineDash.DotLen = nPixel; -- pLineDash.Dashes = 1; -- pLineDash.DashLen = 10 * nPixel; -- pLineDash.Distance = 3 * nPixel; -- break; -- case office::MsoLineDashStyle::msoLineLongDash: -- pLineDash.Dots = 0; -- pLineDash.DotLen = 0; -- pLineDash.Dashes = 1; -- pLineDash.DashLen = 10 * nPixel; -- pLineDash.Distance = 4 * nPixel; -- break; -- case office::MsoLineDashStyle::msoLineSquareDot: -- pLineDash.Dots = 1; -- pLineDash.DotLen = nPixel; -- pLineDash.Dashes = 0; -- pLineDash.DashLen = 0; -- pLineDash.Distance = nPixel; -- break; -- case office::MsoLineDashStyle::msoLineRoundDot: -- pLineDash.Dots = 1; -- pLineDash.DotLen = nPixel; -- pLineDash.Dashes = 0; -- pLineDash.DashLen = 0; -- pLineDash.Distance = nPixel; -- break; -- default: -- throw uno::RuntimeException( rtl::OUString::createFromAscii("this MsoLineDashStyle is not supported."), uno::Reference< uno::XInterface >() ); -- } -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineDash" ), uno::makeAny( pLineDash ) ); -- } --} -- --// Methods --uno::Reference< msforms::XColorFormat > SAL_CALL --ScVbaLineFormat::BackColor() throw (uno::RuntimeException) --{ -- return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_BACKCOLOR ) ); --} -- --uno::Reference< msforms::XColorFormat > SAL_CALL --ScVbaLineFormat::ForeColor() throw (uno::RuntimeException) --{ -- return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_FORECOLOR ) ); --} -- -- --rtl::OUString& --ScVbaLineFormat::getServiceImplName() --{ -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLineFormat") ); -- return sImplName; --} -- --uno::Sequence< rtl::OUString > --ScVbaLineFormat::getServiceNames() --{ -- static uno::Sequence< rtl::OUString > aServiceNames; -- if ( aServiceNames.getLength() == 0 ) -- { -- aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.LineFormat" ) ); -- } -- return aServiceNames; --} -- -- -diff --git sc/source/ui/vba/vbalineformat.hxx sc/source/ui/vba/vbalineformat.hxx -deleted file mode 100644 -index a6287e4..0000000 ---- sc/source/ui/vba/vbalineformat.hxx -+++ /dev/null -@@ -1,85 +0,0 @@ --/************************************************************************* -- * -- * 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: vbalineformat.hxx,v $ -- * $Revision: 1.3 $ -- * -- * 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_XLINEFORMAT_HXX --#define SC_VBA_XLINEFORMAT_HXX -- --#include <com/sun/star/drawing/XShape.hpp> --#include <com/sun/star/beans/XPropertySet.hpp> --#include <ooo/vba/msforms/XLineFormat.hpp> --#include <vbahelper/vbahelperinterface.hxx> -- --typedef InheritedHelperInterfaceImpl1< ov::msforms::XLineFormat > ScVbaLineFormat_BASE; -- --class ScVbaLineFormat : public ScVbaLineFormat_BASE --{ --private: -- css::uno::Reference< css::drawing::XShape > m_xShape; -- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -- sal_Int32 m_nLineDashStyle; -- double m_nLineWeight; --protected: -- virtual rtl::OUString& getServiceImplName(); -- virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -- sal_Int32 convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ); -- rtl::OUString convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (css::uno::RuntimeException); -- sal_Int32 calculateArrowheadSize(); --public: -- ScVbaLineFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); -- -- // Attributes -- virtual sal_Int32 SAL_CALL getBeginArrowheadStyle() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (css::uno::RuntimeException); -- virtual sal_Int32 SAL_CALL getBeginArrowheadLength() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setBeginArrowheadLength( sal_Int32 _beginarrowheadlength ) throw (css::uno::RuntimeException); -- virtual sal_Int32 SAL_CALL getBeginArrowheadWidth() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setBeginArrowheadWidth( sal_Int32 _beginarrowheadwidth ) throw (css::uno::RuntimeException); -- virtual sal_Int32 SAL_CALL getEndArrowheadStylel() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setEndArrowheadStylel( sal_Int32 _endarrowheadstylel ) throw (css::uno::RuntimeException); -- virtual sal_Int32 SAL_CALL getEndArrowheadLength() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setEndArrowheadLength( sal_Int32 _endarrowheadlength ) throw (css::uno::RuntimeException); -- virtual sal_Int32 SAL_CALL getEndArrowheadWidth() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setEndArrowheadWidth( sal_Int32 _endarrowheadwidth ) throw (css::uno::RuntimeException); -- virtual double SAL_CALL getWeight() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setWeight( double _weight ) throw (css::uno::RuntimeException); -- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); -- virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException); -- virtual sal_Int16 SAL_CALL getStyle() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setStyle( sal_Int16 _style ) throw (css::uno::RuntimeException); -- virtual sal_Int32 SAL_CALL getDashStyle() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setDashStyle( sal_Int32 _dashstyle ) throw (css::uno::RuntimeException); -- -- // Methods -- virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); -- virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); --}; -- --#endif//SC_VBA_XLINEFORMAT_HXX -diff --git sc/source/ui/vba/vbaoleobject.cxx sc/source/ui/vba/vbaoleobject.cxx -index cbd1669..3819656 100644 ---- sc/source/ui/vba/vbaoleobject.cxx -+++ sc/source/ui/vba/vbaoleobject.cxx -@@ -33,6 +33,7 @@ - #include <com/sun/star/view/XControlAccess.hpp> - #include <com/sun/star/container/XChild.hpp> - #include <com/sun/star/drawing/XShape.hpp> -+#include <ooo/vba/XControlProvider.hpp> - - #include "vbaoleobject.hxx" - -@@ -61,8 +62,9 @@ ScVbaOLEObject::ScVbaOLEObject( const uno::Reference< XHelperInterface >& xParen - xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW ); - xChild.set( xChild->getParent(), uno::UNO_QUERY_THROW ); - css::uno::Reference< css::frame::XModel > xModel( xChild->getParent(), uno::UNO_QUERY_THROW ); -- css::uno::Reference< css::view::XControlAccess > xControlAccess( xModel->getCurrentController(), css::uno::UNO_QUERY_THROW ); -- m_xWindowPeer = xControlAccess->getControl( xControlModel )->getPeer(); -+ uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -+ uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW ); -+ m_xControl.set( xControlProvider->createControl( xControlShape, xModel ) ); - } - - uno::Reference< uno::XInterface > SAL_CALL -@@ -74,98 +76,76 @@ ScVbaOLEObject::getObject() throw (uno::RuntimeException) - sal_Bool SAL_CALL - ScVbaOLEObject::getEnabled() throw (uno::RuntimeException) - { -- uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW ); -- return xWindow2->isEnabled(); -+ return m_xControl->getEnabled(); - } - - void SAL_CALL - ScVbaOLEObject::setEnabled( sal_Bool _enabled ) throw (uno::RuntimeException) - { -- uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW ); -- xWindow2->setEnable( _enabled ); -+ m_xControl->setEnabled( _enabled ); - } - - sal_Bool SAL_CALL - ScVbaOLEObject::getVisible() throw (uno::RuntimeException) - { -- uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW ); -- return xWindow2->isVisible(); -+ OSL_TRACE("OleObject %s returning visible %s", rtl::OUStringToOString( m_xControl->getName(), RTL_TEXTENCODING_UTF8 ).getStr(), m_xControl->getVisible() ? "true" : "false" ); -+ return m_xControl->getVisible(); - } - - void SAL_CALL - ScVbaOLEObject::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) - { -- uno::Reference< css::awt::XWindow2 > xWindow2( m_xWindowPeer, css::uno::UNO_QUERY_THROW ); -- xWindow2->setVisible( _visible ); -+ OSL_TRACE("OleObject %s set visible %s", rtl::OUStringToOString( m_xControl->getName(), RTL_TEXTENCODING_UTF8 ).getStr(), _visible ? "true" : "false" ); -+ m_xControl->setVisible( _visible ); - } - - double SAL_CALL - ScVbaOLEObject::getLeft() throw (uno::RuntimeException) - { -- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); -- return mm2pt( xShape->getPosition().X / 100 ); -+ return m_xControl->getLeft(); - } - - void SAL_CALL - ScVbaOLEObject::setLeft( double _left ) throw (uno::RuntimeException) - { -- awt::Point oldPosition; -- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); -- oldPosition = xShape->getPosition(); -- oldPosition.X = pt2mm( _left ) * 100; -- xShape->setPosition( oldPosition ); -+ m_xControl->setLeft( _left ); - - } - - double SAL_CALL - ScVbaOLEObject::getTop() throw (uno::RuntimeException) - { -- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); -- return mm2pt( xShape->getPosition().Y / 100 ); -+ return m_xControl->getTop(); - } - - void SAL_CALL - ScVbaOLEObject::setTop( double _top ) throw (uno::RuntimeException) - { -- awt::Point oldPosition; -- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); -- oldPosition = xShape->getPosition(); -- oldPosition.Y = pt2mm( _top ) * 100;; -- xShape->setPosition( oldPosition ); -+ m_xControl->setTop( _top ); - } - - double SAL_CALL - ScVbaOLEObject::getHeight() throw (uno::RuntimeException) - { -- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); -- return mm2pt( xShape->getSize().Height / 100 );//1pt = 1/72in -+ return m_xControl->getHeight(); - } - - void SAL_CALL - ScVbaOLEObject::setHeight( double _height ) throw (uno::RuntimeException) - { -- awt::Size oldSize; -- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); -- oldSize = xShape->getSize(); -- oldSize.Height = pt2mm( _height ) * 100; -- xShape->setSize( oldSize ); -+ m_xControl->setHeight( _height ); - } - - double SAL_CALL - ScVbaOLEObject::getWidth() throw (uno::RuntimeException) - { -- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); -- return mm2pt ( xShape->getSize().Width / 100 ); -+ return m_xControl->getWidth(); - } - - void SAL_CALL - ScVbaOLEObject::setWidth( double _width ) throw (uno::RuntimeException) - { -- awt::Size oldSize; -- uno::Reference< drawing::XShape > xShape( m_xControlShape, uno::UNO_QUERY_THROW ); -- oldSize = xShape->getSize(); -- oldSize.Width = pt2mm( _width ) * 100; -- xShape->setSize( oldSize ); -+ m_xControl->setWidth( _width ); - } - rtl::OUString& - ScVbaOLEObject::getServiceImplName() -diff --git sc/source/ui/vba/vbaoleobject.hxx sc/source/ui/vba/vbaoleobject.hxx -index 297fcbf..10133aa 100644 ---- sc/source/ui/vba/vbaoleobject.hxx -+++ sc/source/ui/vba/vbaoleobject.hxx -@@ -32,8 +32,8 @@ - - #include <cppuhelper/implbase1.hxx> - #include <com/sun/star/drawing/XControlShape.hpp> --#include <com/sun/star/awt/XWindowPeer.hpp> - #include <ooo/vba/excel/XOLEObject.hpp> -+#include <ooo/vba/msforms/XControl.hpp> - - #include <vbahelper/vbahelperinterface.hxx> - -@@ -41,11 +41,11 @@ typedef InheritedHelperInterfaceImpl1< ov::excel::XOLEObject > OLEObjectImpl_BAS - - class ScVbaOLEObject : public OLEObjectImpl_BASE - { -- css::uno::Reference< css::awt::XWindowPeer > m_xWindowPeer; - protected: - css::uno::Reference< css::drawing::XControlShape > m_xControlShape; - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+ css::uno::Reference< ov::msforms::XControl> m_xControl; - public: - ScVbaOLEObject( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, - css::uno::Reference< css::drawing::XControlShape > xControlShape ); -diff --git sc/source/ui/vba/vbapagesetup.cxx sc/source/ui/vba/vbapagesetup.cxx -index a859e74..6ce04c5 100644 ---- sc/source/ui/vba/vbapagesetup.cxx -+++ sc/source/ui/vba/vbapagesetup.cxx -@@ -53,10 +53,10 @@ ScVbaPageSetup::ScVbaPageSetup(const uno::Reference< 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 ) -+ ScVbaPageSetup_BASE( xParent, xContext ), mxSheet( xSheet ) - { - // query for current page style -+ mxModel.set( xModel, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xSheetProps( mxSheet, uno::UNO_QUERY_THROW ); - uno::Any aValue = xSheetProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageStyle" ))); - rtl::OUString aStyleName; -@@ -66,6 +66,8 @@ ScVbaPageSetup::ScVbaPageSetup(const uno::Reference< XHelperInterface >& xParent - 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 ); -+ mnOrientLandscape = excel::XlPageOrientation::xlLandscape; -+ mnOrientPortrait = excel::XlPageOrientation::xlPortrait; - } - - rtl::OUString SAL_CALL ScVbaPageSetup::getPrintArea() throw (css::uno::RuntimeException) -@@ -122,290 +124,24 @@ void SAL_CALL ScVbaPageSetup::setPrintArea( const rtl::OUString& rAreas ) throw - } - } - --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 Millimeter::getInPoints( topMargin ); --} -- --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 );; -+ return VbaPageSetupBase::getHeaderMargin(); - } - - void SAL_CALL ScVbaPageSetup::setHeaderMargin( double margin ) throw (css::uno::RuntimeException) - { -- sal_Int32 headerMargin = Millimeter::getInHundredthsOfOneMillimeter( margin ); -- try -- { -- uno::Any aValue; -- aValue <<= headerMargin; -- mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), aValue ); -- } -- catch( uno::Exception& ) -- { -- } -+ VbaPageSetupBase::setHeaderMargin( margin ); - } - - 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 );; -+ return VbaPageSetupBase::getFooterMargin(); - } - - 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& ) -- { -- } -+ VbaPageSetupBase::setFooterMargin( margin ); - } - - uno::Any SAL_CALL ScVbaPageSetup::getFitToPagesTall() throw (css::uno::RuntimeException) -diff --git sc/source/ui/vba/vbapagesetup.hxx sc/source/ui/vba/vbapagesetup.hxx -index 0026197..59608cf 100644 ---- sc/source/ui/vba/vbapagesetup.hxx -+++ sc/source/ui/vba/vbapagesetup.hxx -@@ -36,38 +36,27 @@ - #include <com/sun/star/sheet/XSpreadsheet.hpp> - #include <com/sun/star/beans/XPropertySet.hpp> - #include <vbahelper/vbahelperinterface.hxx> -+#include <vbahelper/vbapagesetupbase.hxx> - --typedef InheritedHelperInterfaceImpl1< ov::excel::XPageSetup > ScVbaPageSetup_BASE; -+typedef cppu::ImplInheritanceHelper1< VbaPageSetupBase, ov::excel::XPageSetup > ScVbaPageSetup_BASE; - - class ScVbaPageSetup : public ScVbaPageSetup_BASE - { - 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< ov::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); -+ const css::uno::Reference< css::frame::XModel >& xModel) 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 double SAL_CALL getHeaderMargin() throw (css::uno::RuntimeException); -+ void SAL_CALL setHeaderMargin( double margin ) throw (css::uno::RuntimeException); -+ double SAL_CALL getFooterMargin() throw (css::uno::RuntimeException); -+ void SAL_CALL setFooterMargin( double margin ) 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); -diff --git sc/source/ui/vba/vbapalette.cxx sc/source/ui/vba/vbapalette.cxx -index 8f32414..d5764e5 100644 ---- sc/source/ui/vba/vbapalette.cxx -+++ sc/source/ui/vba/vbapalette.cxx -@@ -92,7 +92,7 @@ ScVbaPalette::getDefaultPalette() - } - - uno::Reference< container::XIndexAccess > --ScVbaPalette::getPalette() -+ScVbaPalette::getPalette() const - { - uno::Reference< container::XIndexAccess > xIndex; - uno::Reference< beans::XPropertySet > xProps; -diff --git sc/source/ui/vba/vbapalette.hxx sc/source/ui/vba/vbapalette.hxx -index af41d2f..dc740ce 100644 ---- sc/source/ui/vba/vbapalette.hxx -+++ sc/source/ui/vba/vbapalette.hxx -@@ -42,7 +42,7 @@ public: - ScVbaPalette( SfxObjectShell* pShell = NULL ) : m_pShell( pShell ){} - // if no palette available e.g. because the document doesn't have a - // palette defined then a default palette will be returned. -- css::uno::Reference< css::container::XIndexAccess > getPalette(); -+ css::uno::Reference< css::container::XIndexAccess > getPalette() const; - static css::uno::Reference< css::container::XIndexAccess > getDefaultPalette(); - }; - -diff --git sc/source/ui/vba/vbapictureformat.cxx sc/source/ui/vba/vbapictureformat.cxx -deleted file mode 100644 -index 2663682..0000000 ---- sc/source/ui/vba/vbapictureformat.cxx -+++ /dev/null -@@ -1,147 +0,0 @@ --/************************************************************************* -- * -- * 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: vbapictureformat.cxx,v $ -- * $Revision: 1.3 $ -- * -- * 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 "vbapictureformat.hxx" -- --using namespace ooo::vba; --using namespace com::sun::star; -- --ScVbaPictureFormat::ScVbaPictureFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, -- const css::uno::Reference< css::uno::XComponentContext >& xContext, -- uno::Reference< drawing::XShape > xShape ) -- throw( lang::IllegalArgumentException ) : ScVbaPictureFormat_BASE( xParent, xContext ), m_xShape( xShape ) --{ -- m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); --} -- --void --ScVbaPictureFormat::checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException) --{ -- if( nRange < nMin ) -- { -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too small.") , uno::Reference< uno::XInterface >() ); -- } -- if( nRange > nMax ) -- { -- throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too high.") , uno::Reference< uno::XInterface >() ); -- } --} -- --// Attributes --double SAL_CALL --ScVbaPictureFormat::getBrightness() throw (uno::RuntimeException) --{ -- sal_Int16 nLuminance = 0; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance") ) >>= nLuminance; -- double fBrightness = static_cast< double >( nLuminance ); -- fBrightness = ( fBrightness +100 ) / 200; -- return fBrightness; --} -- --void SAL_CALL --ScVbaPictureFormat::setBrightness( double _brightness ) throw (uno::RuntimeException) --{ -- checkParameterRangeInDouble( _brightness, 0.0, 1.0 ); -- double fLuminance = _brightness * 200 - 100; -- sal_Int16 nLuminance = static_cast< sal_Int16 >( fLuminance ); -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance"), uno::makeAny( nLuminance ) ); --} -- --double SAL_CALL --ScVbaPictureFormat::getContrast() throw (uno::RuntimeException) --{ -- sal_Int16 nContrast = 0; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustContrast") ) >>= nContrast; -- double fContrast = static_cast< double >( nContrast ); -- fContrast = ( fContrast + 100 ) / 200; -- return fContrast; --} -- --void SAL_CALL --ScVbaPictureFormat::setContrast( double _contrast ) throw (uno::RuntimeException) --{ -- checkParameterRangeInDouble( _contrast, 0.0, 1.0 ); -- double fContrast = _contrast * 200 - 100; -- sal_Int16 nContrast = static_cast< sal_Int16 >( fContrast ); -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustContrast"), uno::makeAny( nContrast ) ); --} -- -- --// Methods --void SAL_CALL --ScVbaPictureFormat::IncrementBrightness( double increment ) throw (uno::RuntimeException) --{ -- double fBrightness = getBrightness(); -- fBrightness += increment; -- if( fBrightness < 0 ) -- { -- fBrightness = 0.0; -- } -- if( fBrightness > 1 ) -- { -- fBrightness = 1; -- } -- setBrightness( fBrightness ); --} -- --void SAL_CALL --ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeException) --{ -- double nContrast = getContrast(); -- nContrast += increment; -- if( increment < 0 ) -- { -- increment = 0.0; -- } -- if( increment > 1 ) -- { -- increment = 1.0; -- } -- setContrast( nContrast ); --} -- -- --rtl::OUString& --ScVbaPictureFormat::getServiceImplName() --{ -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPictureFormat") ); -- return sImplName; --} -- --uno::Sequence< rtl::OUString > --ScVbaPictureFormat::getServiceNames() --{ -- static uno::Sequence< rtl::OUString > aServiceNames; -- if ( aServiceNames.getLength() == 0 ) -- { -- aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.PictureFormat" ) ); -- } -- return aServiceNames; --} -diff --git sc/source/ui/vba/vbapictureformat.hxx sc/source/ui/vba/vbapictureformat.hxx -deleted file mode 100644 -index a549b88..0000000 ---- sc/source/ui/vba/vbapictureformat.hxx -+++ /dev/null -@@ -1,64 +0,0 @@ --/************************************************************************* -- * -- * 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: vbapictureformat.hxx,v $ -- * $Revision: 1.3 $ -- * -- * 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_PICTUREFORMAT_HXX --#define SC_VBA_PICTUREFORMAT_HXX -- --#include <com/sun/star/drawing/XShape.hpp> --#include <com/sun/star/beans/XPropertySet.hpp> --#include <ooo/vba/msforms/XPictureFormat.hpp> --#include <vbahelper/vbahelperinterface.hxx> -- --typedef InheritedHelperInterfaceImpl1< ov::msforms::XPictureFormat > ScVbaPictureFormat_BASE; -- --class ScVbaPictureFormat : public ScVbaPictureFormat_BASE --{ --private: -- css::uno::Reference< css::drawing::XShape > m_xShape; -- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; --protected: -- virtual rtl::OUString& getServiceImplName(); -- virtual css::uno::Sequence<rtl::OUString> getServiceNames(); --private: -- void checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException); --public: -- ScVbaPictureFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::drawing::XShape > xShape ) throw( css::lang::IllegalArgumentException ); -- -- // Attributes -- virtual double SAL_CALL getBrightness() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setBrightness( double _brightness ) throw (css::uno::RuntimeException); -- virtual double SAL_CALL getContrast() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setContrast( double _contrast ) throw (css::uno::RuntimeException); -- -- // Methods -- virtual void SAL_CALL IncrementBrightness( double increment ) throw (css::uno::RuntimeException); -- virtual void SAL_CALL IncrementContrast( double increment ) throw (css::uno::RuntimeException); --}; -- --#endif//SC_VBA_PICTUREFORMAT_HXX -diff --git sc/source/ui/vba/vbashape.cxx sc/source/ui/vba/vbashape.cxx -deleted file mode 100644 -index ec13479..0000000 ---- sc/source/ui/vba/vbashape.cxx -+++ /dev/null -@@ -1,472 +0,0 @@ --/************************************************************************* -- * -- * 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: vbashape.cxx,v $ -- * $Revision: 1.4 $ -- * -- * 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<ooo/vba/office/MsoZOrderCmd.hpp> --#include<ooo/vba/office/MsoScaleFrom.hpp> --#include<com/sun/star/container/XNamed.hpp> --#include<com/sun/star/drawing/ConnectorType.hpp> --#include <com/sun/star/lang/XEventListener.hpp> --#include<com/sun/star/drawing/XDrawPagesSupplier.hpp> --#include<com/sun/star/drawing/XDrawPages.hpp> -- --#include <vos/mutex.hxx> --#include <vcl/svapp.hxx> --#include <svx/unopage.hxx> --#include <svx/unoshape.hxx> -- --#include "vbashape.hxx" --#include "vbatextframe.hxx" --#include "vbalineformat.hxx" --#include "vbafillformat.hxx" --#include "vbapictureformat.hxx" -- --using namespace ::ooo::vba; --using namespace ::com::sun::star; --using namespace ::vos; -- --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 ) --{ -- m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); -- m_pShapeHelper.reset( new ShapeHelper( m_xShape ) ); -- addListeners(); --} -- --ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xShape( xShape ) --{ -- // add listener -- addListeners(); --} -- --ScVbaShape::~ScVbaShape() --{ -- // dtor must never ever throw -- try -- { -- removeShapeListener(); -- removeShapesListener(); -- } -- catch( uno::Exception& ) -- { -- } --} -- --void SAL_CALL --ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException ) --{ -- uno::Reference< drawing::XShapes > xShapes( rEventObject.Source, uno::UNO_QUERY ); -- uno::Reference< drawing::XShape > xShape( rEventObject.Source, uno::UNO_QUERY ); -- if ( xShapes.is() ) -- removeShapesListener(); -- if ( xShape.is() ) -- removeShapeListener(); --} -- -- --void ScVbaShape::addListeners() --{ -- uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY ); -- if ( xComponent.is() ) -- xComponent->addEventListener( this ); -- -- xComponent.set( m_xShapes, uno::UNO_QUERY ); -- if ( xComponent.is() ) -- xComponent->addEventListener( this ); --} -- --void --ScVbaShape::removeShapeListener() throw( uno::RuntimeException ) --{ -- if( m_xShape.is() ) -- { -- uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY_THROW ); -- xComponent->removeEventListener( this ); -- } -- m_xShape = NULL; -- m_xPropertySet = NULL; --} -- --void --ScVbaShape::removeShapesListener() throw( uno::RuntimeException ) --{ -- if( m_xShapes.is() ) -- { -- uno::Reference< lang::XComponent > xComponent( m_xShapes, uno::UNO_QUERY_THROW ); -- xComponent->removeEventListener( this ); -- } -- m_xShapes = NULL; --} -- --sal_Int32 --ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException) --{ -- rtl::OUString sShapeType; -- uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor( xShape, uno::UNO_QUERY_THROW ); -- sShapeType = xShapeDescriptor->getShapeType(); -- // office::MsoShapeType::msoDiagram to "com.sun.star.drawing.GroupShape" -- if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) ) -- return office::MsoShapeType::msoGroup; -- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) ) -- return office::MsoShapeType::msoPicture; -- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) ) -- return office::MsoShapeType::msoOLEControlObject; -- // OOo don't support office::MsoShapeType::msoComment as a Shape. -- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" ) ) ) -- return office::MsoShapeType::msoChart; -- // Art characters office::MsoShapeType::msoTextEffect, in OOo corresponding to "com.sun.star.drawing.CustomShape" -- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ConnectorShape" ) ) ) -- { -- enum drawing::ConnectorType connectorType; -- uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); -- xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("EdgeKind")) >>= connectorType; -- if( connectorType == drawing::ConnectorType_CURVE ) -- return office::MsoShapeType::msoFreeform; -- else if( connectorType == drawing::ConnectorType_LINE ) -- return office::MsoShapeType::msoLine; -- else -- return office::MsoShapeType::msoAutoShape; -- } -- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) ) -- return office::MsoShapeType::msoLine; -- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) ) || -- sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape") ) ) -- return office::MsoShapeType::msoAutoShape; -- else -- throw uno::RuntimeException( rtl::OUString::createFromAscii( "the shape type do not be surppored: " ) + sShapeType, uno::Reference< uno::XInterface >() ); --} -- --// Attributes --rtl::OUString SAL_CALL --ScVbaShape::getName() throw (uno::RuntimeException) --{ -- rtl::OUString sName; -- uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW ); -- sName = xNamed->getName(); -- return sName; --} -- --void SAL_CALL --ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) --{ -- uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW ); -- xNamed->setName( _name ); --} -- --double SAL_CALL --ScVbaShape::getHeight() throw (uno::RuntimeException) --{ -- return m_pShapeHelper->getHeight(); --} -- --void SAL_CALL --ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException) --{ -- m_pShapeHelper->setHeight( _height ); --} -- --double SAL_CALL --ScVbaShape::getWidth() throw (uno::RuntimeException) --{ -- return m_pShapeHelper->getWidth(); --} -- --void SAL_CALL --ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException) --{ -- m_pShapeHelper->setWidth( _width ); --} -- --double SAL_CALL --ScVbaShape::getLeft() throw (uno::RuntimeException) --{ -- return m_pShapeHelper->getLeft(); --} -- --void SAL_CALL --ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException) --{ -- m_pShapeHelper->setLeft( _left ); --} -- --double SAL_CALL --ScVbaShape::getTop() throw (uno::RuntimeException) --{ -- return m_pShapeHelper->getTop(); --} -- --void SAL_CALL --ScVbaShape::setTop( double _top ) throw (uno::RuntimeException) --{ -- return m_pShapeHelper->setTop( _top ); --} -- --sal_Bool SAL_CALL --ScVbaShape::getVisible() throw (uno::RuntimeException) --{ -- //UNO Shapes are always visible -- return sal_True; --} -- --void SAL_CALL --ScVbaShape::setVisible( sal_Bool /*_visible*/ ) throw (uno::RuntimeException) --{ -- //UNO Shapes are always visible --} -- --sal_Int32 SAL_CALL --ScVbaShape::getZOrderPosition() throw (uno::RuntimeException) --{ -- sal_Int32 nZOrderPosition = 0; -- uno::Any aZOrderPosition = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); -- aZOrderPosition >>= nZOrderPosition; -- return nZOrderPosition + 1; --} -- --sal_Int32 SAL_CALL --ScVbaShape::getType() throw (uno::RuntimeException) --{ -- return m_nType; --} -- --double SAL_CALL --ScVbaShape::getRotation() throw (uno::RuntimeException) --{ -- double dRotation = 0; -- sal_Int32 nRotation = 0; -- m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ) ) >>= nRotation; -- dRotation = static_cast< double >( nRotation /100 ); -- return dRotation; --} -- --void SAL_CALL --ScVbaShape::setRotation( double _rotation ) throw (uno::RuntimeException) --{ -- sal_Int32 nRotation = static_cast < sal_Int32 > ( _rotation * 100 ); -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ), uno::makeAny( nRotation ) ); --} -- --uno::Reference< msforms::XLineFormat > SAL_CALL --ScVbaShape::getLine() throw (uno::RuntimeException) --{ -- // TODO should ongly return line -- return uno::Reference< msforms::XLineFormat >( new ScVbaLineFormat( this, mxContext, m_xShape ) ); --} -- --uno::Reference< msforms::XFillFormat > SAL_CALL --ScVbaShape::getFill() throw (uno::RuntimeException) --{ -- return uno::Reference< msforms::XFillFormat >( new ScVbaFillFormat( this, mxContext, m_xShape ) ); --} -- --uno::Reference< msforms::XPictureFormat > SAL_CALL --ScVbaShape::getPictureFormat() throw (uno::RuntimeException) --{ -- return uno::Reference< msforms::XPictureFormat >( new ScVbaPictureFormat( this, mxContext, m_xShape ) ); --} -- --// Methods --uno::Reference< excel::XTextFrame > SAL_CALL --ScVbaShape::TextFrame() throw (uno::RuntimeException) --{ -- return uno::Reference< excel::XTextFrame >(new ScVbaTextFrame( getParent(), mxContext, m_xShape ) ); --} -- --void SAL_CALL --ScVbaShape::Delete() throw (uno::RuntimeException) --{ -- OGuard aGuard( Application::GetSolarMutex() ); -- m_xShapes->remove( m_xShape ); --} -- --void SAL_CALL --ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException) --{ -- sal_Int32 nOrderPositon; -- uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); -- aOrderPostion >>= nOrderPositon; -- switch( ZOrderCmd ) -- { -- case office::MsoZOrderCmd::msoBringToFront: -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( SAL_MAX_INT32 ) ); -- break; -- case office::MsoZOrderCmd::msoSendToBack: -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( (sal_Int32)0 ) ); -- break; -- case office::MsoZOrderCmd::msoBringForward: -- nOrderPositon += 1; -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); -- break; -- case office::MsoZOrderCmd::msoSendBackward: -- if( nOrderPositon > 0 ) -- { -- nOrderPositon -= 1; -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); -- } -- break; -- // below two commands use with Writer for text and image object. -- case office::MsoZOrderCmd::msoBringInFrontOfText: -- case office::MsoZOrderCmd::msoSendBehindText: -- throw uno::RuntimeException( rtl::OUString::createFromAscii( "This ZOrderCmd is not implemented, it is use with writer." ), uno::Reference< uno::XInterface >() ); -- default: -- throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Parameter." ), uno::Reference< uno::XInterface >() ); -- } --} -- --void SAL_CALL --ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException) --{ -- double nCurrentRotation = getRotation(); -- nCurrentRotation += Increment; -- setRotation(nCurrentRotation); --} -- --void SAL_CALL --ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException) --{ -- double nCurrentLeft = getLeft(); -- nCurrentLeft += Increment; -- setLeft(nCurrentLeft); --} -- --void SAL_CALL --ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException) --{ -- double nCurrentTop = getTop(); -- nCurrentTop += Increment; -- setTop(nCurrentTop); --} -- --void SAL_CALL --ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException) --{ -- double nHeight = getHeight(); -- double nNewHeight = nHeight * Factor; -- if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft ) -- { -- setHeight(nNewHeight); -- } -- else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight ) -- { -- double nDeltaHeight = nNewHeight - nHeight; -- double nNewTop = getTop() - nDeltaHeight; -- setTop(nNewTop); -- setHeight(nNewHeight); -- } -- else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle ) -- { -- double nDeltaHeight = (nNewHeight - nHeight) / 2; -- double nNewTop = getTop() - nDeltaHeight; -- setTop(nNewTop); -- setHeight(nNewHeight); -- } -- else -- { -- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); -- } --} -- --void SAL_CALL --ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException) --{ -- double nWidth = getWidth(); -- double nNewWidth = nWidth * Factor; -- if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft ) -- { -- setWidth(nNewWidth); -- } -- else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight ) -- { -- double nDeltaWidth = nNewWidth - nWidth; -- double nNewLeft = getLeft() - nDeltaWidth; -- setLeft(nNewLeft); -- setWidth(nNewWidth); -- } -- else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle ) -- { -- double nDeltaWidth = (nNewWidth - nWidth) / 2; -- double nNewLeft = getLeft() - nDeltaWidth; -- setLeft(nNewLeft); -- setWidth(nNewWidth); -- } -- else -- { -- throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); -- } --} -- --void SAL_CALL --ScVbaShape::Select( const uno::Any& /*Replace*/ ) throw ( uno::RuntimeException ) --{ -- // #FIXME don't use getCurrentDocument -- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); -- uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); -- xSelectSupp->select( uno::makeAny( m_xShape ) ); --} -- --// This method should not be part of Shape, what we reall need to do is... --// dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc. --// ( e.g. the ones that really do have ShapeRange as an attribute ) --#include "vbashaperange.hxx" -- --uno::Any SAL_CALL --ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException ) --{ -- // perhaps we should store a reference to the Shapes Collection -- // in this class -- // but anyway this method should not even be in this class -- // #TODO not sure what the parent of the Shapes collection should be -- -- XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec aVec; -- aVec.push_back( m_xShape ); -- uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( aVec ) ); -- uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW ); -- // #FIXME for want of a better parent, setting this -- uno::Reference< msforms::XShapeRange > xShapeRange( new ScVbaShapeRange( mxParent, mxContext, xIndexAccess, uno::Reference< drawing::XDrawPage >( xChild->getParent(), uno::UNO_QUERY_THROW ) ) ); -- if ( index.hasValue() ) -- return xShapeRange->Item( index, uno::Any() ); -- return uno::makeAny( xShapeRange ); --} -- --rtl::OUString& --ScVbaShape::getServiceImplName() --{ -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShape") ); -- return sImplName; --} -- --uno::Sequence< rtl::OUString > --ScVbaShape::getServiceNames() --{ -- static uno::Sequence< rtl::OUString > aServiceNames; -- if ( aServiceNames.getLength() == 0 ) -- { -- aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shape" ) ); -- } -- return aServiceNames; --} -diff --git sc/source/ui/vba/vbashape.hxx sc/source/ui/vba/vbashape.hxx -deleted file mode 100644 -index eb48b93..0000000 ---- sc/source/ui/vba/vbashape.hxx -+++ /dev/null -@@ -1,108 +0,0 @@ --/************************************************************************* -- * -- * 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: vbashape.hxx,v $ -- * $Revision: 1.3 $ -- * -- * 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_SHAPE_HXX --#define SC_VBA_SHAPE_HXX -- --#include <ooo/vba/office/MsoShapeType.hpp> --#include <com/sun/star/drawing/XShape.hpp> --#include <com/sun/star/drawing/XShapes.hpp> --#include <com/sun/star/lang/XEventListener.hpp> --#include <com/sun/star/beans/XPropertySet.hpp> --#include <ooo/vba/msforms/XShape.hpp> --#include <ooo/vba/msforms/XLineFormat.hpp> --#include <cppuhelper/implbase2.hxx> -- --#include <vbahelper/vbahelperinterface.hxx> -- --typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape; -- --typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE; -- --class ScVbaShape : public ScVbaShape_BASE --{ --private: --protected: -- std::auto_ptr< ov::ShapeHelper > m_pShapeHelper; -- css::uno::Reference< css::drawing::XShape > m_xShape; -- css::uno::Reference< css::drawing::XShapes > m_xShapes; -- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -- sal_Int32 m_nType; -- css::uno::Any m_aRange; -- virtual void addListeners(); -- virtual void removeShapeListener() throw( css::uno::RuntimeException ); -- virtual void removeShapesListener() throw( css::uno::RuntimeException ); -- virtual rtl::OUString& getServiceImplName(); -- virtual css::uno::Sequence<rtl::OUString> getServiceNames(); --public: -- ScVbaShape( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XShapes >& xShapes, sal_Int32 nType ) throw ( css::lang::IllegalArgumentException ); -- ScVbaShape( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ) throw ( css::lang::IllegalArgumentException ); -- virtual ~ScVbaShape(); -- css::uno::Any getRange() { return m_aRange; }; -- void setRange( css::uno::Any aRange ) { m_aRange = aRange; }; -- -- static sal_Int32 getType( const css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException); -- -- // Attributes -- virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); -- virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException); -- virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException); -- virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException); -- virtual double SAL_CALL getTop() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException); -- virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); -- virtual sal_Int32 SAL_CALL getZOrderPosition() throw (css::uno::RuntimeException); -- virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException); -- virtual double SAL_CALL getRotation() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setRotation( double _rotation ) throw (css::uno::RuntimeException); -- virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException); -- virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException); -- virtual css::uno::Reference< ov::msforms::XPictureFormat > SAL_CALL getPictureFormat() throw (css::uno::RuntimeException); -- -- // Methods -- virtual css::uno::Reference< ov::excel::XTextFrame > SAL_CALL TextFrame( ) throw (css::uno::RuntimeException); -- virtual void SAL_CALL Delete() throw (css::uno::RuntimeException); -- virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException); -- virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException); -- virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException); -- virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException); -- virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException); -- virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException); -- // Replace?? -- virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException); -- virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException ); -- // XEventListener -- virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException ); --}; --#endif//SC_VBA_SHAPE_HXX -diff --git sc/source/ui/vba/vbashaperange.cxx sc/source/ui/vba/vbashaperange.cxx -deleted file mode 100644 -index 5890e43..0000000 ---- sc/source/ui/vba/vbashaperange.cxx -+++ /dev/null -@@ -1,172 +0,0 @@ --/************************************************************************* -- * -- * 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: vbashaperange.cxx,v $ -- * $Revision: 1.3 $ -- * -- * 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 <com/sun/star/drawing/XShapeGrouper.hpp> --#include <com/sun/star/drawing/XDrawPage.hpp> -- --#include "excelvbahelper.hxx" --#include "vbashaperange.hxx" --#include "vbashape.hxx" -- --using namespace ::ooo::vba; --using namespace ::com::sun::star; -- --class VbShapeRangeEnumHelper : public EnumerationHelper_BASE --{ -- uno::Reference< XCollection > m_xParent; -- uno::Reference<container::XIndexAccess > m_xIndexAccess; -- sal_Int32 nIndex; --public: -- VbShapeRangeEnumHelper( const uno::Reference< XCollection >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} -- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -- { -- return ( nIndex < m_xIndexAccess->getCount() ); -- } -- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -- { -- ScVbaShapeRange* pCollectionImpl = dynamic_cast< ScVbaShapeRange* >(m_xParent.get()); -- if ( pCollectionImpl && hasMoreElements() ) -- return pCollectionImpl->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); -- throw container::NoSuchElementException(); -- } -- --}; -- --ScVbaShapeRange::ScVbaShapeRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xShapes, const uno::Reference< drawing::XDrawPage >& xDrawPage ) : ScVbaShapeRange_BASE( xParent, xContext, xShapes ), m_xDrawPage( xDrawPage ), m_nShapeGroupCount(0) --{ --} -- --// Methods --void SAL_CALL --ScVbaShapeRange::Select( ) throw (uno::RuntimeException) --{ -- // #FIXME don't use getCurrentDocument -- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); -- uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); -- xSelectSupp->select( uno::makeAny( getShapes() ) ); --} -- --uno::Reference< msforms::XShape > SAL_CALL --ScVbaShapeRange::Group() throw (uno::RuntimeException) --{ -- uno::Reference< drawing::XShapeGrouper > xShapeGrouper( m_xDrawPage, uno::UNO_QUERY_THROW ); -- uno::Reference< drawing::XShapeGroup > xShapeGroup( xShapeGrouper->group( getShapes() ), uno::UNO_QUERY_THROW ); -- uno::Reference< drawing::XShape > xShape( xShapeGroup, uno::UNO_QUERY_THROW ); -- return uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, getShapes(), office::MsoShapeType::msoGroup ) ); --} -- --uno::Reference< drawing::XShapes > --ScVbaShapeRange::getShapes() throw (uno::RuntimeException) --{ -- if ( !m_xShapes.is() ) -- { -- uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -- m_xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW ); -- sal_Int32 nLen = m_xIndexAccess->getCount(); -- for ( sal_Int32 index = 0; index < nLen; ++index ) -- m_xShapes->add( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW ) ); -- -- } -- return m_xShapes; --} -- -- --void SAL_CALL --ScVbaShapeRange::IncrementRotation( double Increment ) throw (uno::RuntimeException) --{ -- sal_Int32 nLen = getCount(); -- for ( sal_Int32 index = 1; index <= nLen; ++index ) -- { -- uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -- xShape->IncrementRotation( Increment ); -- } --} -- --void SAL_CALL --ScVbaShapeRange::IncrementLeft( double Increment ) throw (uno::RuntimeException) --{ -- sal_Int32 nLen = getCount(); -- for ( sal_Int32 index = 1; index <= nLen; ++index ) -- { -- uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -- xShape->IncrementLeft( Increment ); -- } --} -- --void SAL_CALL --ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException) --{ -- sal_Int32 nLen = getCount(); -- for ( sal_Int32 index = 1; index <= nLen; ++index ) -- { -- uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -- xShape->IncrementTop( Increment ); -- } --} -- --uno::Type SAL_CALL --ScVbaShapeRange::getElementType() throw (uno::RuntimeException) --{ -- return msforms::XShape::static_type(0); --} -- --uno::Reference< container::XEnumeration > SAL_CALL --ScVbaShapeRange::createEnumeration() throw (uno::RuntimeException) --{ -- return new VbShapeRangeEnumHelper( this, m_xIndexAccess ); --} -- --uno::Any --ScVbaShapeRange:: createCollectionObject( const css::uno::Any& aSource ) --{ -- uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW ); -- // #TODO #FIXME Shape parent should always be the sheet the shapes belong -- // to -- uno::Reference< msforms::XShape > xVbShape( new ScVbaShape( uno::Reference< XHelperInterface >(), mxContext, xShape, getShapes(), ScVbaShape::getType( xShape ) ) ); -- return uno::makeAny( xVbShape ); --} -- --rtl::OUString& --ScVbaShapeRange::getServiceImplName() --{ -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapeRange") ); -- return sImplName; --} -- --uno::Sequence< rtl::OUString > --ScVbaShapeRange::getServiceNames() --{ -- static uno::Sequence< rtl::OUString > aServiceNames; -- if ( aServiceNames.getLength() == 0 ) -- { -- aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.ShapeRange" ) ); -- } -- return aServiceNames; --} -diff --git sc/source/ui/vba/vbashaperange.hxx sc/source/ui/vba/vbashaperange.hxx -deleted file mode 100644 -index 540f33d..0000000 ---- sc/source/ui/vba/vbashaperange.hxx -+++ /dev/null -@@ -1,66 +0,0 @@ --/************************************************************************* -- * -- * 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: vbashaperange.hxx,v $ -- * $Revision: 1.3 $ -- * -- * 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_SHAPERANGE_HXX --#define SC_VBA_SHAPERANGE_HXX -- --#include <com/sun/star/drawing/XShapes.hpp> --#include <ooo/vba/msforms/XShapeRange.hpp> -- --#include <vbahelper/vbacollectionimpl.hxx> -- --typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE; -- --class ScVbaShapeRange : public ScVbaShapeRange_BASE --{ --private: -- css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; -- css::uno::Reference< css::drawing::XShapes > m_xShapes; -- sal_Int32 m_nShapeGroupCount; --protected: -- virtual rtl::OUString& getServiceImplName(); -- virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -- css::uno::Reference< css::drawing::XShapes > getShapes() throw (css::uno::RuntimeException) ; --public: -- ScVbaShapeRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xShapes, const css::uno::Reference< css::drawing::XDrawPage>& xDrawShape ); -- -- // Methods -- virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException); -- virtual css::uno::Reference< ::ooo::vba::msforms::XShape > SAL_CALL Group() throw (css::uno::RuntimeException); -- virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException); -- virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ; -- virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException); -- //XEnumerationAccess -- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -- // ScVbaCollectionBaseImpl -- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); --}; -- --#endif//SC_VBA_SHAPERANGE_HXX -diff --git sc/source/ui/vba/vbashapes.cxx sc/source/ui/vba/vbashapes.cxx -deleted file mode 100644 -index c1013ba..0000000 ---- sc/source/ui/vba/vbashapes.cxx -+++ /dev/null -@@ -1,396 +0,0 @@ --/************************************************************************* -- * -- * 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: vbashapes.cxx,v $ -- * $Revision: 1.3.32.1 $ -- * -- * 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 <com/sun/star/container/XNamed.hpp> --#include <com/sun/star/view/XSelectionSupplier.hpp> --#include <com/sun/star/text/WrapTextMode.hpp> --#include <ooo/vba/msforms/XShapeRange.hpp> --#include <ooo/vba/office/MsoAutoShapeType.hpp> -- --#include "excelvbahelper.hxx" --#include "vbashapes.hxx" --#include "vbashape.hxx" --#include "vbashaperange.hxx" -- --using namespace ::ooo::vba; --using namespace ::com::sun::star; -- --class VbShapeEnumHelper : public EnumerationHelper_BASE --{ -- uno::Reference<msforms::XShapes > m_xParent; -- uno::Reference<container::XIndexAccess > m_xIndexAccess; -- sal_Int32 nIndex; --public: -- VbShapeEnumHelper( const uno::Reference< msforms::XShapes >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} -- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -- { -- return ( nIndex < m_xIndexAccess->getCount() ); -- } -- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -- { -- ScVbaShapes* pShapes = dynamic_cast< ScVbaShapes* >(m_xParent.get()); -- if ( pShapes && hasMoreElements() ) -- return pShapes->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); -- throw container::NoSuchElementException(); -- } -- --}; -- --void ScVbaShapes::initBaseCollection() --{ -- if ( m_xNameAccess.is() ) // already has NameAccess -- return; -- // no NameAccess then use ShapeCollectionHelper -- XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes; -- sal_Int32 nLen = m_xIndexAccess->getCount(); -- mShapes.reserve( nLen ); -- for ( sal_Int32 index=0; index<nLen; ++index ) -- mShapes.push_back( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ) , uno::UNO_QUERY ) ); -- uno::Reference< container::XIndexAccess > xShapes( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) ); -- m_xIndexAccess.set( xShapes, uno::UNO_QUERY ); -- m_xNameAccess.set( xShapes, uno::UNO_QUERY ); --} -- --ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0) --{ -- m_xShapes.set( xShapes, uno::UNO_QUERY_THROW ); -- m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW ); -- initBaseCollection(); --} -- --uno::Reference< container::XEnumeration > --ScVbaShapes::createEnumeration() throw (uno::RuntimeException) --{ -- return new VbShapeEnumHelper( this, m_xIndexAccess ); --} -- --uno::Any --ScVbaShapes::createCollectionObject( const css::uno::Any& aSource ) --{ -- if( aSource.hasValue() ) -- { -- uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW ); -- return uno::makeAny( uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ) ) ); -- } -- return uno::Any(); --} -- --uno::Type --ScVbaShapes::getElementType() throw (uno::RuntimeException) --{ -- return ooo::vba::msforms::XShape::static_type(0); --} --rtl::OUString& --ScVbaShapes::getServiceImplName() --{ -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapes") ); -- return sImplName; --} -- --uno::Sequence< rtl::OUString > --ScVbaShapes::getServiceNames() --{ -- static uno::Sequence< rtl::OUString > aServiceNames; -- if ( aServiceNames.getLength() == 0 ) -- { -- aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shapes" ) ); -- } -- return aServiceNames; --} -- --css::uno::Reference< css::container::XIndexAccess > --ScVbaShapes::getShapesByArrayIndices( const uno::Any& Index ) throw (uno::RuntimeException) --{ -- if ( Index.getValueTypeClass() != uno::TypeClass_SEQUENCE ) -- throw uno::RuntimeException(); -- -- uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext); -- uno::Any aConverted; -- aConverted = xConverter->convertTo( Index, getCppuType((uno::Sequence< uno::Any >*)0) ); -- -- uno::Sequence< uno::Any > sIndices; -- aConverted >>= sIndices; -- XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes; -- sal_Int32 nElems = sIndices.getLength(); -- for( sal_Int32 index = 0; index < nElems; ++index ) -- { -- uno::Reference< drawing::XShape > xShape; -- if ( sIndices[ index ].getValueTypeClass() == uno::TypeClass_STRING ) -- { -- rtl::OUString sName; -- sIndices[ index ] >>= sName; -- xShape.set( m_xNameAccess->getByName( sName ), uno::UNO_QUERY ); -- } -- else -- { -- sal_Int32 nIndex = 0; -- sIndices[ index ] >>= nIndex; -- // adjust for 1 based mso indexing -- xShape.set( m_xIndexAccess->getByIndex( nIndex - 1 ), uno::UNO_QUERY ); -- -- } -- // populate map with drawing::XShapes -- if ( xShape.is() ) -- mShapes.push_back( xShape ); -- } -- uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) ); -- return xIndexAccess; --} -- --uno::Any SAL_CALL --ScVbaShapes::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException) --{ -- // I don't think we need to support Array of indices for shapes --/* -- if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE ) -- { -- uno::Reference< container::XIndexAccess > xIndexAccess( getShapesByArrayIndices( Index ) ); -- // return new collection instance -- uno::Reference< XCollection > xShapesCollection( new ScVbaShapes( this->getParent(), mxContext, xIndexAccess ) ); -- return uno::makeAny( xShapesCollection ); -- } --*/ -- return ScVbaShapes_BASE::Item( Index, Index2 ); --} -- --uno::Reference< msforms::XShapeRange > SAL_CALL --ScVbaShapes::Range( const uno::Any& shapes ) throw (css::uno::RuntimeException) --{ -- // shapes, can be an index or an array of indices -- uno::Reference< container::XIndexAccess > xShapes; -- if ( shapes.getValueTypeClass() == uno::TypeClass_SEQUENCE ) -- xShapes = getShapesByArrayIndices( shapes ); -- else -- { -- // wrap single index into a sequence -- uno::Sequence< uno::Any > sIndices(1); -- sIndices[ 0 ] = shapes; -- uno::Any aIndex; -- aIndex <<= sIndices; -- xShapes = getShapesByArrayIndices( aIndex ); -- } -- return new ScVbaShapeRange( getParent(), mxContext, xShapes, m_xDrawPage ); --} -- --void SAL_CALL --ScVbaShapes::SelectAll() throw (uno::RuntimeException) --{ -- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); -- uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); -- try -- { -- xSelectSupp->select( uno::makeAny( m_xShapes ) ); -- } -- // viewuno.cxx ScTabViewObj::select will throw IllegalArgumentException -- // if one of the shapes is no 'markable' e.g. a button -- // the method still works -- catch( lang::IllegalArgumentException& ) -- { -- } --} -- --uno::Reference< drawing::XShape > --ScVbaShapes::createShape( rtl::OUString service ) throw (css::uno::RuntimeException) --{ -- // #FIXME don't use getCurrentDocument -- uno::Reference< lang::XMultiServiceFactory > xMSF( getCurrentDocument(), uno::UNO_QUERY_THROW ); -- uno::Reference< drawing::XShape > xShape( xMSF->createInstance( service ), uno::UNO_QUERY_THROW ); -- return xShape; --} -- --uno::Any --ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) --{ -- rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape" ) ); -- sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); -- sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); -- sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); -- sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); -- -- uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); -- m_xShapes->add( xShape ); -- -- rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Rectangle" ) ); -- setDefaultShapeProperties( xShape ); -- setShape_NameProperty( xShape, sName ); -- -- awt::Point aMovePositionIfRange(0, 0); -- awt::Point position; -- position.X = nXPos - aMovePositionIfRange.X; -- position.Y = nYPos - aMovePositionIfRange.Y; -- xShape->setPosition( position ); -- -- awt::Size size; -- size.Height = nHeight; -- size.Width = nWidth; -- xShape->setSize( size ); -- -- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); -- pScVbaShape->setRange( aRange ); -- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); --} -- --uno::Any --ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) --{ -- rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.EllipseShape" ) ); -- sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); -- sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); -- sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); -- sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); -- -- uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); -- m_xShapes->add( xShape ); -- -- awt::Point aMovePositionIfRange( 0, 0 ); -- //TODO helperapi using a writer document -- /* -- XDocument xDocument = (XDocument)getParent(); -- if (AnyConverter.isVoid(_aRange)) -- { -- _aRange = xDocument.Range(new Integer(0), new Integer(1)); -- // Top&Left in Word is Top&Left of the paper and not the writeable area. -- aMovePositionIfRange = calculateTopLeftMargin((HelperInterfaceAdaptor)xDocument); -- } -- -- setShape_AnchorTypeAndRangeProperty(xShape, _aRange); -- */ -- rtl::OUString name = createName( rtl::OUString::createFromAscii( "Oval" )); -- setDefaultShapeProperties(xShape); -- setShape_NameProperty(xShape, name); -- -- awt::Point position; -- position.X = nXPos - aMovePositionIfRange.X; -- position.Y = nYPos - aMovePositionIfRange.Y; -- xShape->setPosition(position); -- -- awt::Size size; -- size.Height = nHeight; -- size.Width = nWidth; -- xShape->setSize(size); -- -- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); -- pScVbaShape->setRange( aRange ); -- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); --} -- --//helpeapi calc --uno::Any SAL_CALL --ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (uno::RuntimeException) --{ -- sal_Int32 nLineWidth = endX - StartX; -- sal_Int32 nLineHeight = endY - StartY; -- -- sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); -- sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); -- sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( StartX ); -- sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( StartY ); -- -- uno::Reference< drawing::XShape > xShape( createShape( rtl::OUString::createFromAscii("com.sun.star.drawing.LineShape") ), uno::UNO_QUERY_THROW ); -- m_xShapes->add( xShape ); -- -- awt::Point aMovePositionIfRange( 0, 0 ); -- -- rtl::OUString name = createName( rtl::OUString::createFromAscii( "Line" ) ); -- setDefaultShapeProperties(xShape); -- setShape_NameProperty(xShape, name); -- -- awt::Point position; -- position.X = nXPos - aMovePositionIfRange.X; -- position.Y = nYPos - aMovePositionIfRange.Y; -- xShape->setPosition(position); -- -- awt::Size size; -- size.Height = nHeight; -- size.Width = nWidth; -- xShape->setSize(size); -- -- ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); -- return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); --} -- --uno::Any SAL_CALL --ScVbaShapes::AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) --{ -- uno::Any _aAnchor; -- if (_nType == office::MsoAutoShapeType::msoShapeRectangle) -- { -- return AddRectangle(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor); -- } -- else if (_nType == office::MsoAutoShapeType::msoShapeOval) -- { -- return AddEllipse(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor); -- } -- return uno::Any(); --} -- --void --ScVbaShapes::setDefaultShapeProperties( uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException) --{ -- uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); -- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillStyle" ), uno::makeAny( rtl::OUString::createFromAscii( "SOLID" ) ) ); -- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor"), uno::makeAny( sal_Int32(0xFFFFFF) ) ); -- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap"), uno::makeAny( text::WrapTextMode_THROUGHT ) ); -- //not find in OOo2.3 -- //xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Opaque"), uno::makeAny( sal_True ) ); --} -- --void --ScVbaShapes::setShape_NameProperty( uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName ) --{ -- uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); -- try -- { -- xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Name" ), uno::makeAny( sName ) ); -- } -- catch( script::BasicErrorException e ) -- { -- } --} -- --rtl::OUString --ScVbaShapes::createName( rtl::OUString sName ) --{ -- sal_Int32 nActNumber = 1 + m_nNewShapeCount; -- m_nNewShapeCount++; -- sName += rtl::OUString::valueOf( nActNumber ); -- return sName; --} -- --#if 0 --//TODO helperapi using a writer document --awt::Point --calculateTopLeftMargin( uno::Reference< XHelperInterface > xDocument ) --{ -- awt::Point aPoint( 0, 0 ); -- uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW ); -- return awt::Point(); --} --#endif -diff --git sc/source/ui/vba/vbashapes.hxx sc/source/ui/vba/vbashapes.hxx -deleted file mode 100644 -index c29f56b..0000000 ---- sc/source/ui/vba/vbashapes.hxx -+++ /dev/null -@@ -1,80 +0,0 @@ --/************************************************************************* -- * -- * 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: vbashapes.hxx,v $ -- * $Revision: 1.3.32.1 $ -- * -- * 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_SHAPES_HXX --#define SC_VBA_SHAPES_HXX -- --#include <com/sun/star/drawing/XShapes.hpp> --#include <com/sun/star/drawing/XDrawPage.hpp> --#include <com/sun/star/container/XIndexAccess.hpp> --#include <ooo/vba/msforms/XShapes.hpp> -- --#include <vbahelper/vbahelperinterface.hxx> -- --#include <vbahelper/vbacollectionimpl.hxx> -- --typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE; -- --class ScVbaShapes : public ScVbaShapes_BASE --{ --private: -- css::uno::Reference< css::drawing::XShapes > m_xShapes; -- css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; -- sal_Int32 m_nNewShapeCount; -- void initBaseCollection(); --protected: -- virtual rtl::OUString& getServiceImplName(); -- virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -- virtual css::uno::Reference< css::container::XIndexAccess > getShapesByArrayIndices( const css::uno::Any& Index ) throw (css::uno::RuntimeException); -- css::uno::Reference< css::drawing::XShape > createShape( rtl::OUString service ) throw (css::uno::RuntimeException); -- css::uno::Any AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException); -- css::uno::Any AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException); -- rtl::OUString createName( rtl::OUString sName ); -- //TODO helperapi using a writer document -- //css::awt::Point calculateTopLeftMargin( css::uno::Reference< ov::XHelperInterface > xDocument ); -- --public: -- ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes ); -- static void setDefaultShapeProperties( css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException); -- static void setShape_NameProperty( css::uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName ); -- //XEnumerationAccess -- virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -- virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -- -- virtual void SAL_CALL SelectAll() throw (css::uno::RuntimeException); -- //helper::calc -- virtual css::uno::Any SAL_CALL AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (css::uno::RuntimeException); -- virtual css::uno::Any SAL_CALL AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); -- virtual css::uno::Reference< ov::msforms::XShapeRange > SAL_CALL Range( const css::uno::Any& shapes ) throw (css::uno::RuntimeException); -- // ScVbaCollectionBaseImpl -- virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -- virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException); --}; -- --#endif//SC_VBA_SHAPES_HXX -diff --git sc/source/ui/vba/vbatextboxshape.hxx sc/source/ui/vba/vbatextboxshape.hxx -index c923329..993d045 100644 ---- sc/source/ui/vba/vbatextboxshape.hxx -+++ sc/source/ui/vba/vbatextboxshape.hxx -@@ -37,7 +37,7 @@ - #include <cppuhelper/implbase1.hxx> - #include <com/sun/star/text/XTextRange.hpp> - #include <ooo/vba/msforms/XTextBoxShape.hpp> --#include "vbashape.hxx" -+#include <vbahelper/vbashape.hxx> - #include "excelvbahelper.hxx" - #include "vbacharacters.hxx" - -diff --git sc/source/ui/vba/vbatextframe.cxx sc/source/ui/vba/vbatextframe.cxx -index fa3980d..1a0f588 100644 ---- sc/source/ui/vba/vbatextframe.cxx -+++ sc/source/ui/vba/vbatextframe.cxx -@@ -27,6 +27,7 @@ - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -+#include <vbahelper/helperdecl.hxx> - #include <com/sun/star/drawing/TextFitToSizeType.hpp> - #include <com/sun/star/text/XText.hpp> - #include "vbatextframe.hxx" -@@ -35,121 +36,19 @@ - using namespace ::ooo::vba; - using namespace ::com::sun::star; - --ScVbaTextFrame::ScVbaTextFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< drawing::XShape > xShape ) : ScVbaTextFrame_BASE( xParent, xContext ), m_xShape( xShape ) -+ScVbaTextFrame::ScVbaTextFrame( uno::Sequence< uno::Any> const & args, uno::Reference< uno::XComponentContext> const & xContext ) throw ( lang::IllegalArgumentException ) : ScVbaTextFrame_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext, getXSomethingFromArgs< drawing::XShape >( args, 1, false ) ) - { -- m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); - } - --void --ScVbaTextFrame::setAsMSObehavior() --{ -- //set property TextWordWrap default as False. -- // TextFitToSize control the text content. it seems we should set the default as False. -- // com.sun.star.drawing.TextFitToSizeType.NONE -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap" ), uno::makeAny( sal_False ) ); -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextFitToSize" ), uno::makeAny( drawing::TextFitToSizeType_NONE ) ); --} -- --sal_Int32 ScVbaTextFrame::getMargin( rtl::OUString sMarginType ) --{ -- sal_Int32 nMargin = 0; -- uno::Any aMargin = m_xPropertySet->getPropertyValue( sMarginType ); -- aMargin >>= nMargin; -- return nMargin; --} -- --void ScVbaTextFrame::setMargin( rtl::OUString sMarginType, float fMargin ) --{ -- sal_Int32 nMargin = Millimeter::getInHundredthsOfOneMillimeter( fMargin ); -- m_xPropertySet->setPropertyValue( sMarginType, uno::makeAny( nMargin ) ); --} -- --// Attributes --sal_Bool SAL_CALL --ScVbaTextFrame::getAutoSize() throw (uno::RuntimeException) --{ -- // I don't know why, but in OOo, TextAutoGrowHeight is the property control autosize. not TextFitToSize. -- // TextFitToSize control the text content. -- // and in mso, there isnot option TextWordWrap which means auto wrap. the default is False. -- sal_Bool bAutosize = sal_False; -- uno::Any aTextAutoGrowHeight = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ) ); -- aTextAutoGrowHeight >>= bAutosize; -- return bAutosize; --} -- --void SAL_CALL --ScVbaTextFrame::setAutoSize( sal_Bool _autosize ) throw (uno::RuntimeException) --{ -- setAsMSObehavior(); -- m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ), uno::makeAny( _autosize ) ); --} -- --float SAL_CALL --ScVbaTextFrame::getMarginBottom() throw (uno::RuntimeException) --{ -- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ) ); -- float fMargin = (float)Millimeter::getInPoints( nMargin ); -- return fMargin; --} -- --void SAL_CALL --ScVbaTextFrame::setMarginBottom( float _marginbottom ) throw (uno::RuntimeException) --{ -- setMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ), _marginbottom ); --} -- --float SAL_CALL --ScVbaTextFrame::getMarginTop() throw (uno::RuntimeException) --{ -- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ) ); -- float fMargin = (float)Millimeter::getInPoints( nMargin ); -- return fMargin; --} -- --void SAL_CALL --ScVbaTextFrame::setMarginTop( float _margintop ) throw (uno::RuntimeException) --{ -- setMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ), _margintop ); --} -- --float SAL_CALL --ScVbaTextFrame::getMarginLeft() throw (uno::RuntimeException) --{ -- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ) ); -- float fMargin = (float)Millimeter::getInPoints( nMargin ); -- return fMargin; --} -- --void SAL_CALL --ScVbaTextFrame::setMarginLeft( float _marginleft ) throw (uno::RuntimeException) --{ -- setMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ), _marginleft ); --} -- --float SAL_CALL --ScVbaTextFrame::getMarginRight() throw (uno::RuntimeException) --{ -- sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextRightDistance" ) ); -- float fMargin = (float)Millimeter::getInPoints( nMargin ); -- return fMargin; --} -- --void SAL_CALL --ScVbaTextFrame::setMarginRight( float _marginright ) throw (uno::RuntimeException) --{ -- setMargin( rtl::OUString::createFromAscii( "TextRightDistance" ), _marginright ); --} -- -- - // Methods --uno::Reference< ov::excel::XCharacters > SAL_CALL -+uno::Any SAL_CALL - ScVbaTextFrame::Characters() throw (uno::RuntimeException) - { - uno::Reference< text::XSimpleText > xSimpleText( m_xShape, uno::UNO_QUERY_THROW ); - ScVbaPalette aPalette( SfxObjectShell::Current() ); - uno::Any aStart( sal_Int32( 1 ) ); - uno::Any aLength(sal_Int32( -1 ) ); -- return uno::Reference< ov::excel::XCharacters >( new ScVbaCharacters( this, mxContext, aPalette, xSimpleText, aStart, aLength, sal_True ) ); -+ return uno::makeAny( uno::Reference< ov::excel::XCharacters >( new ScVbaCharacters( this, mxContext, aPalette, xSimpleText, aStart, aLength, sal_True ) ) ); - } - - rtl::OUString& -@@ -171,3 +70,12 @@ ScVbaTextFrame::getServiceNames() - return aServiceNames; - } - -+namespace textframe -+{ -+namespace sdecl = comphelper::service_decl; -+sdecl::vba_service_class_<ScVbaTextFrame, sdecl::with_args<true> > serviceImpl; -+extern sdecl::ServiceDecl const serviceDecl( -+ serviceImpl, -+ "ScVbaTextFrame", -+ "ooo.vba.excel.TextFrame" ); -+} -diff --git sc/source/ui/vba/vbatextframe.hxx sc/source/ui/vba/vbatextframe.hxx -index 4787ddc..71e36bf 100644 ---- sc/source/ui/vba/vbatextframe.hxx -+++ sc/source/ui/vba/vbatextframe.hxx -@@ -29,45 +29,23 @@ - ************************************************************************/ - #ifndef SC_VBA_TEXTFRAME_HXX - #define SC_VBA_TEXTFRAME_HXX --#include <com/sun/star/drawing/XShape.hpp> --#include <com/sun/star/beans/XPropertySet.hpp> --#include <ooo/vba/excel/XCharacters.hpp> - #include <ooo/vba/excel/XTextFrame.hpp> -- - #include <vbahelper/vbahelperinterface.hxx> --#include "vbapalette.hxx" -+#include <vbahelper/vbatextframe.hxx> - --typedef InheritedHelperInterfaceImpl1< ov::excel::XTextFrame > ScVbaTextFrame_BASE; -+//typedef InheritedHelperInterfaceImpl1< ov::excel::XTextFrame > ScVbaTextFrame_BASE; -+typedef cppu::ImplInheritanceHelper1< VbaTextFrame, ov::excel::XTextFrame > ScVbaTextFrame_BASE; - - class ScVbaTextFrame : public ScVbaTextFrame_BASE - { --private: -- css::uno::Reference< ov::excel::XCharacters > m_xCharacters; -- css::uno::Reference< css::drawing::XShape > m_xShape; -- css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; --protected: -- virtual rtl::OUString& getServiceImplName(); -- virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -- virtual void setAsMSObehavior(); -- sal_Int32 getMargin( rtl::OUString sMarginType ); -- void setMargin( rtl::OUString sMarginType, float fMargin ); - public: -- ScVbaTextFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext , css::uno::Reference< css::drawing::XShape > xShape); -+ ScVbaTextFrame( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext > const& xContext ) throw ( css::lang::IllegalArgumentException ); - virtual ~ScVbaTextFrame() {} -- // Attributes -- virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setAutoSize( sal_Bool _autosize ) throw (css::uno::RuntimeException); -- virtual float SAL_CALL getMarginBottom() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setMarginBottom( float _marginbottom ) throw (css::uno::RuntimeException); -- virtual float SAL_CALL getMarginTop() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setMarginTop( float _margintop ) throw (css::uno::RuntimeException); -- virtual float SAL_CALL getMarginLeft() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setMarginLeft( float _marginleft ) throw (css::uno::RuntimeException); -- virtual float SAL_CALL getMarginRight() throw (css::uno::RuntimeException); -- virtual void SAL_CALL setMarginRight( float _marginright ) throw (css::uno::RuntimeException); -- - // Methods -- virtual css::uno::Reference< ov::excel::XCharacters > SAL_CALL Characters( ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Characters( ) throw (css::uno::RuntimeException); -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); - - }; - -diff --git sc/source/ui/vba/vbaworkbooks.cxx sc/source/ui/vba/vbaworkbooks.cxx -index acb9cfc..2f8325f 100644 ---- sc/source/ui/vba/vbaworkbooks.cxx -+++ sc/source/ui/vba/vbaworkbooks.cxx -@@ -65,14 +65,6 @@ using namespace ::com::sun::star; - - const sal_Int16 CUSTOM_CHAR = 5; - --typedef std::hash_map< rtl::OUString, --sal_Int32, ::rtl::OUStringHash, --::std::equal_to< ::rtl::OUString > > NameIndexHash; -- --typedef std::vector < uno::Reference< sheet::XSpreadsheetDocument > > WorkBooks; -- --typedef ::cppu::WeakImplHelper1< container::XEnumeration > SpreadSheetDocEnumImpl_BASE; -- - static uno::Any - getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheetDocument > &xDoc, const uno::Any& aApplication ) - { -@@ -85,53 +77,6 @@ getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Refe - return uno::Any( uno::Reference< excel::XWorkbook > (pWb) ); - } - -- --// #FIXME clearly this is a candidate for some sort of helper base class as --// this is a copy of SelectedSheetsEnum ( vbawindow.cxx ) -- --class SpreadSheetDocEnumImpl : public SpreadSheetDocEnumImpl_BASE --{ -- uno::Reference< uno::XComponentContext > m_xContext; -- WorkBooks m_books; -- WorkBooks::const_iterator m_it; -- --public: -- SpreadSheetDocEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const WorkBooks& books ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_books( books ) -- { -- m_it = m_books.begin(); -- } -- SpreadSheetDocEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext ) -- { -- uno::Reference< lang::XMultiComponentFactory > xSMgr( -- m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); -- -- uno::Reference< frame::XDesktop > xDesktop -- (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), m_xContext), uno::UNO_QUERY_THROW ); -- uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration(); -- while( mxComponents->hasMoreElements() ) -- { -- uno::Reference< sheet::XSpreadsheetDocument > xNext( mxComponents->nextElement(), uno::UNO_QUERY ); -- if ( xNext.is() ) -- m_books.push_back( xNext ); -- } -- m_it = m_books.begin(); -- } -- // XEnumeration -- virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -- { -- return m_it != m_books.end(); -- } -- -- virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -- { -- if ( !hasMoreElements() ) -- { -- throw container::NoSuchElementException(); -- } -- return makeAny( *(m_it++) ); -- } --}; -- - class WorkBookEnumImpl : public EnumerationHelperImpl - { - uno::Any m_aApplication; -@@ -146,100 +91,7 @@ public: - - }; - --// #FIXME clearly this is also a candidate for some sort of helper base class as --// a very similar one is used in vbawindow ( SelectedSheetsEnumAccess ) --// Maybe a template base class that does all of the operations on the hashmap --// and vector only, and the sub-class does everything else --// => ctor, createEnumeration & factory method need be defined ( to be called --// by getByIndex, getByName ) --typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess -- , com::sun::star::container::XIndexAccess -- , com::sun::star::container::XNameAccess -- > WorkBooksAccessImpl_BASE; -- --class WorkBooksAccessImpl : public WorkBooksAccessImpl_BASE --{ -- uno::Reference< uno::XComponentContext > m_xContext; -- WorkBooks m_books; -- NameIndexHash namesToIndices; --public: -- WorkBooksAccessImpl( const uno::Reference< uno::XComponentContext >& xContext ):m_xContext( xContext ) -- { -- uno::Reference< container::XEnumeration > xEnum = new SpreadSheetDocEnumImpl( m_xContext ); -- sal_Int32 nIndex=0; -- while( xEnum->hasMoreElements() ) -- { -- uno::Reference< sheet::XSpreadsheetDocument > xNext( xEnum->nextElement(), uno::UNO_QUERY ); -- if ( xNext.is() ) -- { -- m_books.push_back( xNext ); -- uno::Reference< frame::XModel > xModel( xNext, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given -- INetURLObject aURL( xModel->getURL() ); -- namesToIndices[ aURL.GetLastName() ] = nIndex++; -- } -- } -- -- } -- -- //XEnumerationAccess -- virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) -- { -- return new SpreadSheetDocEnumImpl( m_xContext, m_books ); -- } -- // XIndexAccess -- virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) -- { -- return m_books.size(); -- } -- virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -- { -- if ( Index < 0 -- || static_cast< WorkBooks::size_type >(Index) >= m_books.size() ) -- throw lang::IndexOutOfBoundsException(); -- return makeAny( m_books[ Index ] ); // returns xspreadsheetdoc -- } -- -- //XElementAccess -- virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) -- { -- return sheet::XSpreadsheetDocument::static_type(0); -- } -- -- virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) -- { -- return (m_books.size() > 0); -- } -- -- //XNameAccess -- virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -- { -- NameIndexHash::const_iterator it = namesToIndices.find( aName ); -- if ( it == namesToIndices.end() ) -- throw container::NoSuchElementException(); -- return makeAny( m_books[ it->second ] ); -- -- } -- -- virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) -- { -- uno::Sequence< ::rtl::OUString > names( namesToIndices.size() ); -- ::rtl::OUString* pString = names.getArray(); -- NameIndexHash::const_iterator it = namesToIndices.begin(); -- NameIndexHash::const_iterator it_end = namesToIndices.end(); -- for ( ; it != it_end; ++it, ++pString ) -- *pString = it->first; -- return names; -- } -- -- virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) -- { -- NameIndexHash::const_iterator it = namesToIndices.find( aName ); -- return (it != namesToIndices.end()); -- } -- --}; -- --ScVbaWorkbooks::ScVbaWorkbooks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWorkbooks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new WorkBooksAccessImpl( xContext ) ) ) -+ScVbaWorkbooks::ScVbaWorkbooks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWorkbooks_BASE( xParent, xContext, VbaDocumentsBase::EXCEL_DOCUMENT ) - { - } - // XEnumerationAccess -@@ -255,13 +107,14 @@ ScVbaWorkbooks::createEnumeration() throw (uno::RuntimeException) - // the state of this object ( although it should ) would be - // safer to create an enumeration based on this objects state - // rather than one effectively based of the desktop component -- return new WorkBookEnumImpl( mxContext, uno::Reference< container::XEnumeration >( new SpreadSheetDocEnumImpl(mxContext) ), Application() ); -+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); -+ return new WorkBookEnumImpl( mxContext, xEnumerationAccess->createEnumeration(), Application() ); - } - - uno::Any - ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource ) - { -- uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY ); -+ uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY_THROW ); - return getWorkbook( mxContext, xDoc, Application() ); - } - -@@ -269,18 +122,7 @@ ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource ) - uno::Any SAL_CALL - ScVbaWorkbooks::Add() throw (uno::RuntimeException) - { -- uno::Reference< lang::XMultiComponentFactory > xSMgr( -- mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -- -- uno::Reference< frame::XComponentLoader > xLoader( -- xSMgr->createInstanceWithContext( -- ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), -- mxContext), uno::UNO_QUERY_THROW ); -- uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( -- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") ), -- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, -- uno::Sequence< beans::PropertyValue >(0) ); -- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW ); -+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( VbaDocumentsBase::Add() , uno::UNO_QUERY_THROW ); - - if( xSpreadDoc.is() ) - return getWorkbook( mxContext, xSpreadDoc, Application() ); -@@ -290,11 +132,7 @@ ScVbaWorkbooks::Add() throw (uno::RuntimeException) - void - ScVbaWorkbooks::Close() throw (uno::RuntimeException) - { -- uno::Reference< lang::XMultiComponentFactory > xSMgr( -- mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); -- rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc")); -- dispatchRequests(xModel,url); -+ VbaDocumentsBase::Close(); - } - - bool -@@ -338,24 +176,15 @@ uno::Any - ScVbaWorkbooks::Open( const rtl::OUString& rFileName, const uno::Any& /*UpdateLinks*/, const uno::Any& ReadOnly, const uno::Any& Format, const uno::Any& /*Password*/, const uno::Any& /*WriteResPassword*/, const uno::Any& /*IgnoreReadOnlyRecommended*/, const uno::Any& /*Origin*/, const uno::Any& Delimiter, const uno::Any& /*Editable*/, const uno::Any& /*Notify*/, const uno::Any& /*Converter*/, const uno::Any& /*AddToMru*/ ) throw (uno::RuntimeException) - { - // we need to detect if this is a URL, if not then assume its a file path -- rtl::OUString aURL; -- INetURLObject aObj; -+ rtl::OUString aURL; -+ INetURLObject aObj; - aObj.SetURL( rFileName ); - bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; - if ( bIsURL ) - aURL = rFileName; - else - osl::FileBase::getFileURLFromSystemPath( rFileName, aURL ); -- uno::Reference< lang::XMultiComponentFactory > xSMgr( -- mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -- uno::Reference< frame::XDesktop > xDesktop -- (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") , mxContext), -- uno::UNO_QUERY_THROW ); -- uno::Reference< frame::XComponentLoader > xLoader( -- xSMgr->createInstanceWithContext( -- ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), -- mxContext), -- uno::UNO_QUERY_THROW ); -+ - uno::Sequence< beans::PropertyValue > sProps(0); - sal_Int32 nIndex = 0; - -@@ -422,23 +251,7 @@ ScVbaWorkbooks::Open( const rtl::OUString& rFileName, const uno::Any& /*UpdateLi - else if ( !isSpreadSheetFile( sType ) ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Bad Format")), uno::Reference< uno::XInterface >() ); - -- if ( ReadOnly.hasValue() ) -- { -- sal_Bool bIsReadOnly = sal_False; ReadOnly >>= bIsReadOnly; -- if ( bIsReadOnly ) -- { -- static const rtl::OUString sReadOnly( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ); -- sProps.realloc( sProps.getLength() + 1 ); -- sProps[ nIndex ].Name = sReadOnly; -- sProps[ nIndex++ ].Value = uno::makeAny( (sal_Bool)sal_True ); -- } -- } -- -- uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( aURL, -- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_default") ), -- frame::FrameSearchFlag::CREATE, -- sProps); -- uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW ); -+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( VbaDocumentsBase::Open( rFileName, ReadOnly, sProps ), uno::UNO_QUERY_THROW ); - uno::Any aRet = getWorkbook( mxContext, xSpreadDoc, Application() ); - uno::Reference< excel::XWorkbook > xWBook( aRet, uno::UNO_QUERY ); - if ( xWBook.is() ) -diff --git sc/source/ui/vba/vbaworkbooks.hxx sc/source/ui/vba/vbaworkbooks.hxx -index b66d294..182a5da 100644 ---- sc/source/ui/vba/vbaworkbooks.hxx -+++ sc/source/ui/vba/vbaworkbooks.hxx -@@ -34,12 +34,13 @@ - #include <vbahelper/vbacollectionimpl.hxx> - #include <ooo/vba/excel/XWorkbooks.hpp> - #include <com/sun/star/container/XEnumerationAccess.hpp> -+#include <vbahelper/vbadocumentsbase.hxx> - #include "excelvbahelper.hxx" - - - class ScModelObj; - --typedef CollTestImplHelper< ov::excel::XWorkbooks > ScVbaWorkbooks_BASE; -+typedef cppu::ImplInheritanceHelper1< VbaDocumentsBase, ov::excel::XWorkbooks > ScVbaWorkbooks_BASE; - - class ScVbaWorkbooks : public ScVbaWorkbooks_BASE - { -diff --git sc/source/ui/vba/vbaworksheet.cxx sc/source/ui/vba/vbaworksheet.cxx -index 310f81e..ddd5111 100644 ---- sc/source/ui/vba/vbaworksheet.cxx -+++ sc/source/ui/vba/vbaworksheet.cxx -@@ -86,7 +86,7 @@ - #include "vbapivottables.hxx" - #include "vbaoleobject.hxx" - #include "vbaoleobjects.hxx" --#include "vbashapes.hxx" -+#include <vbahelper/vbashapes.hxx> - #include "vbapagesetup.hxx" - #include "vbapagebreaks.hxx" - -diff --git sc/util/makefile.mk sc/util/makefile.mk -index b3e30f1..442814d 100644 ---- sc/util/makefile.mk -+++ sc/util/makefile.mk -@@ -373,6 +373,7 @@ SHL9STDLIBS= \ - $(ISCLIB) \ - $(VCLLIB) \ - $(TKLIB) \ -+ $(SVXMSFILTERLIB) \ - $(FORLIB) - - SHL9DEPN=$(SHL1TARGETN) $(SHL8TARGETN) -diff --git scripting/source/dlgprov/dlgevtatt.cxx scripting/source/dlgprov/dlgevtatt.cxx -index 93409b3..958e854 100644 ---- scripting/source/dlgprov/dlgevtatt.cxx -+++ scripting/source/dlgprov/dlgevtatt.cxx -@@ -112,13 +112,14 @@ namespace dlgprov - { - protected: - rtl::OUString msDialogCodeName; -+ rtl::OUString msDialogLibName; - Reference< script::XScriptListener > mxListener; - virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet ); - public: -- DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ); -+ DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ); - }; - -- DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ) : DialogScriptListenerImpl( rxContext ) -+ DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName( sDialogLibName ) - { - Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); - Sequence< Any > args(1); -@@ -146,7 +147,7 @@ namespace dlgprov - if ( aScriptEvent.ScriptType.equals( rtl::OUString::createFromAscii("VBAInterop") ) && mxListener.is() ) - { - ScriptEvent aScriptEventCopy( aScriptEvent ); -- aScriptEventCopy.ScriptCode = msDialogCodeName; -+ aScriptEventCopy.ScriptCode = msDialogLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( msDialogCodeName ); - try - { - mxListener->firing( aScriptEventCopy ); -@@ -162,7 +163,7 @@ namespace dlgprov - // DialogEventsAttacherImpl - // ============================================================================= - -- DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener ) -+ DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener, const rtl::OUString& sDialogLibName ) - :m_xContext( rxContext ) - { - // key listeners by protocol when ScriptType = 'Script' -@@ -175,7 +176,7 @@ namespace dlgprov - listernersForTypes[ rtl::OUString::createFromAscii("vnd.sun.star.UNO") ] = new DialogUnoScriptListenerImpl( rxContext, rxModel, rxControl, rxHandler, rxIntrospect, bProviderMode ); - listernersForTypes[ rtl::OUString::createFromAscii("vnd.sun.star.script") ] = new DialogSFScriptListenerImpl( rxContext, rxModel ); - #ifdef FAKE_VBA_EVENT_SUPPORT -- listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel ); -+ listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName ); - #endif - } - -diff --git scripting/source/dlgprov/dlgevtatt.hxx scripting/source/dlgprov/dlgevtatt.hxx -index ca1c7a3..d06489d 100644 ---- scripting/source/dlgprov/dlgevtatt.hxx -+++ scripting/source/dlgprov/dlgevtatt.hxx -@@ -84,7 +84,7 @@ namespace dlgprov - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& xIntrospect, - bool bProviderMode, -- const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ); -+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ,const rtl::OUString& sDialogLibName ); - virtual ~DialogEventsAttacherImpl(); - - // XScriptEventsAttacher -diff --git scripting/source/dlgprov/dlgprov.cxx scripting/source/dlgprov/dlgprov.cxx -index a1ae5b7..2754bc1 100644 ---- scripting/source/dlgprov/dlgprov.cxx -+++ scripting/source/dlgprov/dlgprov.cxx -@@ -418,6 +418,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs - - if ( xISP.is() ) - xInput = xISP->createInputStream(); -+ msDialogLibName = sLibName; - } - - // import dialog model -@@ -535,7 +536,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs - const Reference< XControl >& rxControl, - const Reference< XInterface >& rxHandler, - const Reference< XIntrospectionAccess >& rxIntrospectionAccess, -- bool bDialogProviderMode ) -+ bool bDialogProviderMode, const rtl::OUString& sDialogLibName ) - { - if ( rxControl.is() ) - { -@@ -559,7 +560,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs - - Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl - ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess, -- bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) ); -+ bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ), msDialogLibName ); - - Any aHelper; - xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper ); -@@ -742,7 +743,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs - { - //xDialog = Reference< XDialog >( xCtrl, UNO_QUERY ); - Reference< XIntrospectionAccess > xIntrospectionAccess = inspectHandler( xHandler ); -- attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode ); -+ attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode, msDialogLibName ); - } - } - -diff --git scripting/source/dlgprov/dlgprov.hxx scripting/source/dlgprov/dlgprov.hxx -index 559c686..b4c8181 100644 ---- scripting/source/dlgprov/dlgprov.hxx -+++ scripting/source/dlgprov/dlgprov.hxx -@@ -84,9 +84,9 @@ namespace dlgprov - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel; - -- -+ rtl::OUString msDialogLibName; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL ); -- -+ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl( - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent ); -@@ -94,7 +94,7 @@ namespace dlgprov - void attachControlEvents( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxControlContainer, - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess, -- bool bDialogProviderMode ); -+ bool bDialogProviderMode, const rtl::OUString& ); - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler( - const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler ); - // helper methods -diff --git scripting/source/vbaevents/eventhelper.cxx scripting/source/vbaevents/eventhelper.cxx -index 5433c7e..84dc900 100644 ---- scripting/source/vbaevents/eventhelper.cxx -+++ scripting/source/vbaevents/eventhelper.cxx -@@ -52,6 +52,14 @@ - #include <set> - #include <list> - #include <hash_map> -+#define ASYNC 0 -+ -+// primitive support for asynchronous handling of -+// events from controls ( all event will be processed asynchronously -+// in the application thread ) -+#if ASYNC -+#include <vcl/svapp.hxx> -+#endif - - using namespace ::com::sun::star; - using namespace ::com::sun::star::script; -@@ -251,6 +259,12 @@ EventInfoHash& getEventTransInfo() - info.toVBA = NULL; - actionInfos.push_back( info ); - eventTransInfo[ rtl::OUString::createFromAscii("actionPerformed") ] = actionInfos; -+ // itemStateChanged ooo event -+ std::list< TranslateInfo > stateChangedInfos; -+ info.sVBAName = rtl::OUString::createFromAscii("_Change"); -+ info.toVBA = NULL; -+ stateChangedInfos.push_back( info ); -+ eventTransInfo[ rtl::OUString::createFromAscii("itemStateChanged") ] = stateChangedInfos; - // changed ooo event - std::list< TranslateInfo > changeInfos; - info.sVBAName = rtl::OUString::createFromAscii("_Change"); -@@ -621,6 +635,9 @@ protected: - virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; - - private: -+#if ASYNC -+ DECL_LINK( OnAsyncScriptEvent, ScriptEvent* ); -+#endif - void setShellFromModel(); - void firing_Impl( const ScriptEvent& evt, Any *pSyncRet=NULL ) throw( RuntimeException ); - -@@ -666,9 +683,39 @@ EventListener::disposing(const lang::EventObject&) throw( RuntimeException ) - void SAL_CALL - EventListener::firing(const ScriptEvent& evt) throw(RuntimeException) - { -+#if ASYNC -+ // needs some logic to check if the event handler is oneway or not -+ // if not oneway then firing_Impl otherwise... as below -+ acquire(); -+ Application::PostUserEvent( LINK( this, EventListener, OnAsyncScriptEvent ), new ScriptEvent( evt ) ); -+#else - firing_Impl( evt ); -+#endif - } - -+#if ASYNC -+IMPL_LINK( EventListener, OnAsyncScriptEvent, ScriptEvent*, _pEvent ) -+{ -+ if ( !_pEvent ) -+ return 1L; -+ -+ { -+ // #FIXME if we enable ASYNC we probably need something like -+ // below -+ //::osl::ClearableMutexGuard aGuard( m_aMutex ); -+ -+ //if ( !impl_isDisposed_nothrow() ) -+ // impl_doFireScriptEvent_nothrow( aGuard, *_pEvent, NULL ); -+ firing_Impl( *_pEvent, NULL ); -+ } -+ -+ delete _pEvent; -+ // we acquired ourself immediately before posting the event -+ release(); -+ return 0L; -+ } -+#endif -+ - Any SAL_CALL - EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException) - { -@@ -735,6 +782,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime - return; - lang::EventObject aEvent; - evt.Arguments[ 0 ] >>= aEvent; -+ OSL_TRACE("evt.MethodName is %s", rtl::OUStringToOString( evt.MethodName, RTL_TEXTENCODING_UTF8 ).getStr() ); - OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() ); - OSL_TRACE("Getting Control"); - uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW ); -@@ -771,23 +819,34 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime - - StarBASIC* pBasic = mpShell->GetBasic(); - BasicManager* pBasicManager = mpShell->GetBasicManager(); -- //'Project' is a better default but I want to force failures -- //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project"); -- rtl::OUString sProject = rtl::OUString::createFromAscii("Standard"); -- -- if ( pBasicManager->GetName().Len() > 0 ) -- sProject = pBasicManager->GetName(); -- -+ rtl::OUString sProject; -+ rtl::OUString sScriptCode( evt.ScriptCode ); -+ // dialogs pass their own library, presence of Dot determines that -+ if ( sScriptCode.indexOf( '.' ) == -1 ) -+ { -+ //'Project' is a better default but I want to force failures -+ //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project"); -+ sProject = rtl::OUString::createFromAscii("Standard"); -+ -+ if ( pBasicManager->GetName().Len() > 0 ) -+ sProject = pBasicManager->GetName(); -+ } -+ else -+ { -+ sal_Int32 nIndex = sScriptCode.indexOf( '.' ); -+ sProject = sScriptCode.copy( 0, nIndex ); -+ sScriptCode = sScriptCode.copy( nIndex + 1 ); -+ } - rtl::OUString sMacroLoc = sProject; - sMacroLoc = sMacroLoc.concat( rtl::OUString::createFromAscii(".") ); -- sMacroLoc = sMacroLoc.concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") ); -+ sMacroLoc = sMacroLoc.concat( sScriptCode ).concat( rtl::OUString::createFromAscii(".") ); - - OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() ); - - // find library - pBasic = pBasicManager->GetLib( sProject ); - -- SbModule* pModule = pBasic->FindModule( evt.ScriptCode ); -+ SbModule* pModule = pBasic ? pBasic->FindModule( sScriptCode ) : NULL; - - for ( ; pModule && txInfo != txInfo_end; ++txInfo ) - { -diff --git svx/inc/svx/msvbahelper.hxx svx/inc/svx/msvbahelper.hxx -new file mode 100644 -index 0000000..8be6901 ---- /dev/null -+++ svx/inc/svx/msvbahelper.hxx -@@ -0,0 +1,43 @@ -+/************************************************************************* -+ * -+ * 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 _MSVBAHELPER_HXX -+#define _MSVBAHELPER_HXX -+ -+#include <sfx2/objsh.hxx> -+#include "svx/svxdllapi.h" -+ -+namespace ooo { namespace vba -+{ -+ SVX_DLLPUBLIC String makeMacroURL( const String& sMacroName ); -+ SVX_DLLPUBLIC String findVBAMacro( SfxObjectShell* pShell, const String& sMod, const String& sMacro ); -+ SVX_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet ); -+} } -+ -+#endif -diff --git svx/prj/d.lst svx/prj/d.lst -index 119a6ea..37c75fb 100644 ---- svx/prj/d.lst -+++ svx/prj/d.lst -@@ -657,5 +657,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table - ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx - ..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx - ..\inc\svx\mstoolbar.hxx %_DEST%\inc%_EXT%\svx\mstoolbar.hxx -+..\inc\svx\msvbahelper.hxx %_DEST%\inc%_EXT%\svx\msvbahelper.hxx - - ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.* ---- svx/source/msfilter/makefile.mk -+++ svx/source/msfilter/makefile.mk -@@ -58,6 +58,7 @@ LIB1OBJFILES= \ - $(SLO)$/mscodec.obj \ - $(SLO)$/msfiltertracer.obj\ - $(SLO)$/mstoolbar.obj\ -+ $(SLO)$/msvbahelper.obj\ - - EXCEPTIONSFILES= \ - $(SLO)$/eschesdo.obj \ -@@ -76,6 +77,7 @@ EXCEPTIONSFILES= \ - $(SLO)$/svxmsbas.obj \ - $(SLO)$/msfiltertracer.obj\ - $(SLO)$/mstoolbar.obj\ -+ $(SLO)$/msvbahelper.obj\ - - .INCLUDE : target.mk - -diff --git svx/source/msfilter/msocximex.cxx svx/source/msfilter/msocximex.cxx -index 53e8f82..44a200e 100644 ---- svx/source/msfilter/msocximex.cxx -+++ svx/source/msfilter/msocximex.cxx -@@ -1749,18 +1749,18 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference< - rtl::OUString sParentName = msParentName; - sGroupName = sParentName.concat( C2U( ":" ) ).concat( sGroupName ); - } -- if ( sGroupName.getLength() > 0 ) -- { -+ if ( sGroupName.getLength() == 0 ) -+ sGroupName = rtl::OUString::createFromAscii("DefaultGroup"); - OSL_TRACE("RadioButton %s has groupname %s", - rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString( sGroupName, RTL_TEXTENCODING_UTF8 ).getStr() ); - try - { -+ aTmp <<= sGroupName; - rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp); - } - catch( uno::Exception& ) - { - } -- } - - if (pCaption) - { -@@ -1772,11 +1772,6 @@ sal_Bool OCX_OptionButton::Import(com::sun::star::uno::Reference< - aTmp <<= ::com::sun::star::style::VerticalAlignment_MIDDLE; - rPropSet->setPropertyValue( WW8_ASCII2STR("VerticalAlign"), aTmp ); - -- if ( pGroupName ) -- { -- aTmp <<= lclCreateOUString( pGroupName, nGroupNameLen ); -- rPropSet->setPropertyValue( WW8_ASCII2STR("GroupName"), aTmp); -- } - uno::Reference< frame::XModel > xModel ( pDocSh ? pDocSh->GetModel() : NULL ); - lcl_ApplyListSourceAndBindableStuff( xModel, rPropSet, msCtrlSource, msRowSource ); - if ( sImageUrl.getLength() ) -@@ -3791,7 +3786,8 @@ OCX_MultiPage::OCX_MultiPage( SotStorageRef& parent, - nScrollWidth(0), nScrollHeight(0), nIconLen(0), pIcon(0), nPictureLen(0), - pPicture(0) - { -- msDialogType = C2U("NotSupported"); -+ //msDialogType = C2U("NotSupported"); -+ msDialogType = C2U("com.sun.star.awt.UnoMultiPageModel"); - mnForeColor = 0x80000012L, - mnBackColor = 0x8000000FL; - bSetInDialog = true;// UserForm control only -@@ -3855,7 +3851,6 @@ sal_Bool OCX_MultiPage::Read(SvStorageStream *pS) - sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference< - com::sun::star::beans::XPropertySet> &rPropSet) - { -- // Calls import on contained controls - OCX_ContainerControl::Import( rPropSet ); - return sal_True; - } -@@ -3876,6 +3871,43 @@ sal_Bool OCX_MultiPage::Import(com::sun::star::uno::Reference< - - if ( xPropSet.is() ) - { -+ uno::Reference<lang::XMultiServiceFactory> -+ xFactory(rDialog, uno::UNO_QUERY); -+ OSL_TRACE("** MultiPage creating control %s", rtl::OUStringToOString( msDialogType, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ uno::Reference<uno::XInterface> xCreate = xFactory->createInstance(msDialogType); -+ if (!xCreate.is()) -+ return sal_False; -+ -+ uno::Reference<awt::XControlModel> xModel(xCreate, uno::UNO_QUERY); -+ if (!xModel.is()) -+ return sal_False; -+ -+ try -+ { -+ // we should just call MultiPage::Import( XPropertySet ) -+ OSL_TRACE("********* MULTIPAGE cName %s", rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ uno::Any aTmp(&sName,getCppuType((OUString *)0)); -+ uno::Reference<beans::XPropertySet> xPrps(xModel, uno::UNO_QUERY); -+ xPrps->setPropertyValue( WW8_ASCII2STR("Name"), aTmp ); -+ aTmp = uno::makeAny( mnCurrentPageStep ); -+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValueMax"), aTmp ); -+ // default current page to 0 ( #FIXME, we need to read this value ) -+ aTmp = uno::makeAny( sal_Int32(0) ); -+ xPrps->setPropertyValue( WW8_ASCII2STR("ProgressValue"), aTmp ); -+ OSL_TRACE("********* MULTIPAGE vomitted out properties"); -+ -+ // Calls import on contained controls -+ rDialog->insertByName(sName, uno::makeAny(xModel)); -+ OSL_TRACE("*** inserted ***"); -+ } -+ catch( uno::Exception& ) -+ { -+ DBG_ERRORFILE( -+ ByteString( "OCX_Control::Import - cannot insert control \"" ). -+ Append( ByteString( sName, RTL_TEXTENCODING_UTF8 ) ). -+ Append( '"' ).GetBuffer() ); -+ } -+ - // Calls import on contained pages - return OCX_ContainerControl::Import( xPropSet ); - } -diff --git svx/source/msfilter/msvbahelper.cxx svx/source/msfilter/msvbahelper.cxx -new file mode 100644 -index 0000000..5875cf7 ---- /dev/null -+++ svx/source/msfilter/msvbahelper.cxx -@@ -0,0 +1,134 @@ -+/************************************************************************* -+ * -+ * 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 <svx/msvbahelper.hxx> -+#include <basic/sbx.hxx> -+#include <basic/sbstar.hxx> -+#include <basic/basmgr.hxx> -+#include <basic/sbmod.hxx> -+#include <basic/sbmeth.hxx> -+ -+using namespace ::com::sun::star; -+ -+const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:"); -+const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document"); -+ -+namespace ooo { namespace vba { -+ -+String makeMacroURL( const String& sMacroName ) -+{ -+ return sUrlPart0.concat( sMacroName ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart1 ) ; -+} -+ -+String findVBAMacro( SfxObjectShell* pShell, const String& sMod, const String& sMacro ) -+{ -+ String sFullName; -+ // would use the script provider to see if the macro exists but -+ // called at this stage tdoc content handler stuff is not set up -+ // so it fails -+ -+ String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard")); -+ BasicManager* pBasicMgr = pShell-> GetBasicManager(); -+ if ( pBasicMgr ) -+ { -+ if ( pBasicMgr->GetName().Len() ) -+ sLibrary = pBasicMgr->GetName(); -+ StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary ); -+ if ( !pBasic ) -+ { -+ USHORT nId = pBasicMgr->GetLibId( sLibrary ); -+ pBasicMgr->LoadLib( nId ); -+ pBasic = pBasicMgr->GetLib( sLibrary ); -+ } -+ if ( pBasic ) -+ { -+ if ( sMod.Len() ) // we wish to find the macro is a specific module -+ { -+ SbModule* pModule = pBasic->FindModule( sMod ); -+ if ( pModule ) -+ { -+ SbxArray* pMethods = pModule->GetMethods(); -+ if ( pMethods ) -+ { -+ SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) ); -+ if ( pMethod ) -+ { -+ sFullName = sMacro; -+ sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 ); -+ } -+ } -+ } -+ } -+ else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) ) -+ { -+ if( SbModule* pModule = pMethod->GetModule() ) -+ { -+ sFullName = sMacro; -+ sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 ); -+ } -+ } -+ -+ } -+ } -+ return sFullName; -+} -+ -+// Treat the args as possible inouts ( convertion at bottom of method ) -+sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, uno::Sequence< uno::Any >& aArgs, uno::Any& aRet ) -+{ -+ // until ObjectModules ( and persisting of codenames ) is supported, if this is a -+ // document saved from XL then we won't be able to determine the codename for the Workbook -+ // Module, so... we have no choice but to search all modules for the moment, thus the macro -+ // passed in should be the fully specified name. -+ rtl::OUString sUrl = makeMacroURL( sMacroName ); -+ uno::Sequence< sal_Int16 > aOutArgsIndex; -+ uno::Sequence< uno::Any > aOutArgs; -+ ErrCode nErr = pShell->CallXScript( sUrl, aArgs, aRet, -+ aOutArgsIndex, aOutArgs, sal_False ); -+ -+ // Script Executed? -+ if ( nErr != ERRCODE_NONE ) -+ return sal_False; -+ -+ sal_Int32 nLen = aOutArgs.getLength(); -+ // convert any out params to seem like they were inouts -+ if ( nLen ) -+ { -+ for ( sal_Int32 index=0; index < nLen; ++index ) -+ { -+ sal_Int32 nOutIndex = aOutArgsIndex[ index ]; -+ aArgs[ nOutIndex ] = aOutArgs[ index ]; -+ } -+ -+ } -+ return sal_True; -+} -+ -+} } // vba // ooo -diff --git svx/source/msfilter/msvbasic.cxx svx/source/msfilter/msvbasic.cxx -index 60667ed..cfe547a 100644 ---- svx/source/msfilter/msvbasic.cxx -+++ svx/source/msfilter/msvbasic.cxx -@@ -954,7 +954,7 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage) - STREAM_STD_READ | STREAM_NOCREATE ); - // disable read and import of Dir stream bits, e.g. project references and - // project name for 3.1 ( a bit unstable yet ) --#if 0 -+#if 1 - // decompress the stream - std::auto_ptr< SvMemoryStream > xCmpDir; - xCmpDir.reset( MSLZSS::decompressAsStream( xDir, 0 ) ); ---- sw/inc/unocoll.hxx -+++ sw/inc/unocoll.hxx -@@ -40,6 +40,7 @@ - #include <cppuhelper/implbase4.hxx> // helper for implementations - #include <IMark.hxx> - #include <unobaseclass.hxx> -+#include "swdllapi.h" - /*************************************************** - *************************************************** - * -@@ -283,7 +284,7 @@ cppu::WeakImplHelper3 - ::com::sun::star::lang::XServiceInfo - > - SwCollectionBaseClass; --class SwXTextTables : public SwCollectionBaseClass, -+class SW_DLLPUBLIC SwXTextTables : public SwCollectionBaseClass, - public SwUnoCollection - { - protected: ---- sw/inc/unotbl.hxx -+++ sw/inc/unotbl.hxx -@@ -214,14 +214,13 @@ typedef cppu::WeakImplHelper3< - ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::beans::XPropertySet - > SwXTextTableCursor_Base; --class SwXTextTableCursor : public SwXTextTableCursor_Base -+class SW_DLLPUBLIC SwXTextTableCursor : public SwXTextTableCursor_Base - ,public SwClient - ,public OTextCursorHelper - { - SwDepend aCrsrDepend; - const SfxItemPropertySet* m_pPropSet; - -- SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } - // SwUnoCrsr* GetCrsr() const { return (SwUnoCrsr*)aCrsrDepend.GetRegisteredIn(); } - - protected: -@@ -271,6 +270,7 @@ public: - - const SwUnoCrsr* GetCrsr() const; - SwUnoCrsr* GetCrsr(); -+ SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } - }; - - /*-----------------11.12.97 09:38------------------- -diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx -index 65da983..90efd7b 100644 ---- sw/source/filter/ww8/ww8par.cxx -+++ sw/source/filter/ww8/ww8par.cxx -@@ -154,15 +154,14 @@ using namespace sw::util; - using namespace sw::types; - using namespace nsHdFtFlags; - --#include <vbahelper/vbahelper.hxx> - #include <com/sun/star/document/XEventsSupplier.hpp> - #include <com/sun/star/container/XNameReplace.hpp> - #include <com/sun/star/frame/XModel.hpp> --const static String sModule( RTL_CONSTASCII_USTRINGPARAM("ThisDocument")); -+#include <svx/msvbahelper.hxx> -+#include <svtools/pathoptions.hxx> -+#include <com/sun/star/ucb/XSimpleFileAccess.hpp> - --const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:"); --const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard."); --const static rtl::OUString sUrlPart2 = rtl::OUString::createFromAscii( "?language=Basic&location=document"); -+const static String sModule( RTL_CONSTASCII_USTRINGPARAM("ThisDocument")); - - struct DocEventNameTable - { -@@ -194,7 +193,7 @@ bool registerDocEvent( SfxObjectShell* pShell ) - rtl::OUString sEvt = rtl::OUString::createFromAscii( pTable->sEventName ); - rtl::OUString sMacroName = rtl::OUString::createFromAscii( pTable->sMacroName ); - // fail to search the macro if the module is not specified. -- String sFullPath = ooo::vba::docMacroExists( pShell, sModule, sMacroName ); -+ String sFullPath = ooo::vba::findVBAMacro( pShell, sModule, sMacroName ); - if( sFullPath.Len() == 0 ) - continue; - -@@ -204,7 +203,7 @@ bool registerDocEvent( SfxObjectShell* pShell ) - aOpenEvt[ 0 ].Name = sEvtType; - aOpenEvt[ 0 ].Value = uno::makeAny(sScript); - aOpenEvt[ 1 ].Name = sScript; -- rtl::OUString sUrl = sUrlPart0.concat( sFullPath ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".") ) ).concat( sUrlPart2 ); -+ rtl::OUString sUrl = ooo::vba::makeMacroURL( sFullPath ); - aOpenEvt[ 1 ].Value = uno::makeAny(sUrl); - sal_Int32 nPos = aEvents.getLength(); - -@@ -3866,16 +3865,16 @@ bool WW8Customizations::Import( SwDocShell* pShell ) - - bool SwWW8ImplReader::ReadGlobalTemplateSettings() - { -+ SvtPathOptions aPathOpt; -+ String aAddinPath = aPathOpt.GetAddinPath(); - uno::Sequence< rtl::OUString > sGlobalTemplates; -- rtl::OUString sNode = rtl::OUString::createFromAscii( "org.openoffice.Office.Writer/GlobalTemplateList" ); -- try -- { -- css::uno::Reference< css::container::XNameAccess > xCfg( ::comphelper::ConfigurationHelper::openConfig( ::comphelper::getProcessServiceFactory(), sNode, ::comphelper::ConfigurationHelper::E_STANDARD), uno::UNO_QUERY_THROW); -- xCfg->getByName( rtl::OUString::createFromAscii("Paths") ) >>= sGlobalTemplates; -- } -- catch( uno::Exception& ) -- { -- } -+ -+ // first get the autoload addins in the directory STARTUP -+ uno::Reference< ucb::XSimpleFileAccess > xSFA( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), uno::UNO_QUERY_THROW ); -+ -+ if( xSFA->isFolder( aAddinPath ) ) -+ sGlobalTemplates = xSFA->getFolderContents( aAddinPath, sal_False ); -+ - sal_Int32 nEntries = sGlobalTemplates.getLength(); - bool bRes = true; - const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get(); -@@ -3894,8 +3893,9 @@ bool SwWW8ImplReader::ReadGlobalTemplateSettings() - aURL = sGlobalTemplates[ i ]; - else - osl::FileBase::getFileURLFromSystemPath( sGlobalTemplates[ i ], aURL ); -- if ( sCreatedFrom.getLength() && sCreatedFrom.equals( aURL ) ) -+ if ( !aURL.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) || ( sCreatedFrom.getLength() && sCreatedFrom.equals( aURL ) ) ) - continue; // don't try and read the same document as ourselves -+ - SotStorageRef rRoot = new SotStorage( aURL, STREAM_STD_READWRITE, STORAGE_TRANSACTED ); - // Read Macro Projects - SvxImportMSVBasic aVBasic(*mpDocShell, *rRoot, -@@ -4182,7 +4182,7 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) - maTracer.EnterEnvironment(sw::log::eMacros); - // dissable below for 3.1 at the moment, 'cause it's kinda immature - // similarly the project reference in svx/source/msvba --#if 0 -+#if 1 - // Read Global templates - ReadGlobalTemplateSettings(); - #endif -@@ -4199,7 +4199,7 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) - int nRet = aVBasic.Import( s1, s2, ! pVBAFlags->IsLoadWordBasicCode() ); - // dissable below for 3.1 at the moment, 'cause it's kinda immature - // similarly the project reference in svx/source/msvba --#if 0 -+#if 1 - WW8Customizations aCustomisations( pTableStream, *pWwFib ); - aCustomisations.Import( mpDocShell ); - #endif -diff --git sw/source/ui/vba/makefile.mk sw/source/ui/vba/makefile.mk -index 42a9bbc..f51ef26 100644 ---- sw/source/ui/vba/makefile.mk -+++ sw/source/ui/vba/makefile.mk -@@ -69,7 +69,32 @@ SLOFILES= \ - $(SLO)$/vbapanes.obj \ - $(SLO)$/vbaoptions.obj \ - $(SLO)$/vbaselection.obj \ -- $(SLO)$/vbatemplate.obj \ -+ $(SLO)$/vbatemplate.obj \ -+ $(SLO)$/vbaparagraphformat.obj \ -+ $(SLO)$/vbaautotextentry.obj \ -+ $(SLO)$/vbaparagraph.obj \ -+ $(SLO)$/vbafind.obj \ -+ $(SLO)$/vbareplacement.obj \ -+ $(SLO)$/vbastyle.obj \ -+ $(SLO)$/vbastyles.obj \ -+ $(SLO)$/vbafont.obj \ -+ $(SLO)$/vbapalette.obj \ -+ $(SLO)$/vbainformationhelper.obj \ -+ $(SLO)$/vbatable.obj \ -+ $(SLO)$/vbatables.obj \ -+ $(SLO)$/vbafield.obj \ -+ $(SLO)$/vbaborders.obj \ -+ $(SLO)$/vbadocuments.obj \ -+ $(SLO)$/vbaheaderfooter.obj \ -+ $(SLO)$/vbaheaderfooterhelper.obj \ -+ $(SLO)$/vbaaddin.obj \ -+ $(SLO)$/vbaaddins.obj \ -+ $(SLO)$/vbadialogs.obj \ -+ $(SLO)$/vbadialog.obj \ -+ $(SLO)$/vbawrapformat.obj \ -+ $(SLO)$/vbapagesetup.obj \ -+ $(SLO)$/vbasection.obj \ -+ $(SLO)$/vbasections.obj \ - - # --- Targets ------------------------------------------------------ - -diff --git sw/source/ui/vba/service.cxx sw/source/ui/vba/service.cxx -index 009f440..0ed9492 100644 ---- sw/source/ui/vba/service.cxx -+++ sw/source/ui/vba/service.cxx -@@ -50,6 +50,11 @@ namespace document - extern sdecl::ServiceDecl const serviceDecl; - } - -+namespace wrapformat -+{ -+extern sdecl::ServiceDecl const serviceDecl; -+} -+ - extern "C" - { - void SAL_CALL component_getImplementationEnvironment( -@@ -66,7 +71,7 @@ extern "C" - - // Component registration - return component_writeInfoHelper( pServiceManager, pRegistryKey, -- globals::serviceDecl, document::serviceDecl ); -+ globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl ); - } - - void * SAL_CALL component_getFactory( -@@ -75,7 +80,7 @@ extern "C" - { - OSL_TRACE("In component_getFactory for %s", pImplName ); - void* pRet = component_getFactoryHelper( -- pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl ); -+ pImplName, pServiceManager, pRegistryKey, globals::serviceDecl, document::serviceDecl, wrapformat::serviceDecl ); - OSL_TRACE("Ret is 0x%x", pRet); - return pRet; - } -diff --git sw/source/ui/vba/vbaaddin.cxx sw/source/ui/vba/vbaaddin.cxx -new file mode 100644 -index 0000000..559643f ---- /dev/null -+++ sw/source/ui/vba/vbaaddin.cxx -@@ -0,0 +1,107 @@ -+/************************************************************************* -+ * -+ * 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 "vbaaddin.hxx" -+#include <vbahelper/vbahelper.hxx> -+#include <tools/diagnose_ex.h> -+#include <tools/urlobj.hxx> -+#include <osl/file.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+SwVbaAddin::SwVbaAddin( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const rtl::OUString& rFileURL, sal_Bool bAutoload ) throw ( uno::RuntimeException ) : -+ SwVbaAddin_BASE( rParent, rContext ), msFileURL( rFileURL ), mbAutoload( bAutoload ), mbInstalled( bAutoload ) -+{ -+} -+ -+SwVbaAddin::~SwVbaAddin() -+{ -+} -+ -+::rtl::OUString SAL_CALL SwVbaAddin::getName() throw (uno::RuntimeException) -+{ -+ rtl::OUString sName; -+ INetURLObject aURL( msFileURL ); -+ ::osl::File::getSystemPathFromFileURL( aURL.GetLastName(), sName ); -+ return sName; -+} -+ -+void SAL_CALL -+SwVbaAddin::setName( const rtl::OUString& ) throw ( css::uno::RuntimeException ) -+{ -+ throw uno::RuntimeException( rtl::OUString( -+ RTL_CONSTASCII_USTRINGPARAM(" Fail to set name")), uno::Reference< uno::XInterface >() ); -+} -+ -+::rtl::OUString SAL_CALL SwVbaAddin::getPath() throw (uno::RuntimeException) -+{ -+ INetURLObject aURL( msFileURL ); -+ aURL.CutLastName(); -+ return aURL.GetURLPath(); -+} -+ -+::sal_Bool SAL_CALL SwVbaAddin::getAutoload() throw (uno::RuntimeException) -+{ -+ return mbAutoload; -+} -+ -+::sal_Bool SAL_CALL SwVbaAddin::getInstalled() throw (uno::RuntimeException) -+{ -+ return mbInstalled; -+} -+ -+void SAL_CALL SwVbaAddin::setInstalled( ::sal_Bool _installed ) throw (uno::RuntimeException) -+{ -+ if( _installed != mbInstalled ) -+ { -+ mbInstalled = _installed; -+ // TODO: should call AutoExec and AutoExit etc. -+ } -+} -+ -+rtl::OUString& -+SwVbaAddin::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAddin") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaAddin::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Addin" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbaaddin.hxx sw/source/ui/vba/vbaaddin.hxx -new file mode 100644 -index 0000000..8ddb120 ---- /dev/null -+++ sw/source/ui/vba/vbaaddin.hxx -@@ -0,0 +1,62 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_ADDIN_HXX -+#define SW_VBA_ADDIN_HXX -+ -+#include <ooo/vba/word/XAddin.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <cppuhelper/implbase1.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XAddin > SwVbaAddin_BASE; -+ -+class SwVbaAddin : public SwVbaAddin_BASE -+{ -+private: -+ rtl::OUString msFileURL; -+ sal_Bool mbAutoload; -+ sal_Bool mbInstalled; -+ -+public: -+ SwVbaAddin( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const rtl::OUString& rFileURL, sal_Bool bAutoload ) throw ( css::uno::RuntimeException ); -+ virtual ~SwVbaAddin(); -+ -+ // Attributes -+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getAutoload() throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getInstalled() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setInstalled( ::sal_Bool _installed ) throw (css::uno::RuntimeException); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+#endif /* SW_VBA_ADDIN_HXX */ -diff --git sw/source/ui/vba/vbaaddins.cxx sw/source/ui/vba/vbaaddins.cxx -new file mode 100644 -index 0000000..17dbed8 ---- /dev/null -+++ sw/source/ui/vba/vbaaddins.cxx -@@ -0,0 +1,110 @@ -+/************************************************************************* -+ * -+ * 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 "vbaaddins.hxx" -+#include "vbaaddin.hxx" -+#include <cppuhelper/implbase3.hxx> -+#include <svtools/pathoptions.hxx> -+#include <com/sun/star/lang/XMultiComponentFactory.hpp> -+#include <com/sun/star/ucb/XSimpleFileAccess.hpp> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+uno::Reference< container::XIndexAccess > lcl_getAddinCollection( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) -+{ -+ XNamedObjectCollectionHelper< word::XAddin >::XNamedVec maAddins; -+ -+ // first get the autoload addins in the directory STARTUP -+ uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager(), uno::UNO_QUERY_THROW ); -+ uno::Reference< ucb::XSimpleFileAccess > xSFA( xMCF->createInstanceWithContext( rtl::OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ), xContext), uno::UNO_QUERY_THROW ); -+ SvtPathOptions aPathOpt; -+ // FIXME: temporary the STARTUP path is located in $OO/basic3.1/program/addin -+ String aAddinPath = aPathOpt.GetAddinPath(); -+ OSL_TRACE("lcl_getAddinCollection: %s", rtl::OUStringToOString( aAddinPath, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ if( xSFA->isFolder( aAddinPath ) ) -+ { -+ uno::Sequence< rtl::OUString > sEntries = xSFA->getFolderContents( aAddinPath, sal_False ); -+ sal_Int32 nEntry = sEntries.getLength(); -+ for( sal_Int32 index = 0; index < nEntry; ++index ) -+ { -+ rtl::OUString sUrl = sEntries[ index ]; -+ if( !xSFA->isFolder( sUrl ) && sUrl.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) ) -+ { -+ maAddins.push_back( uno::Reference< word::XAddin >( new SwVbaAddin( xParent, xContext, sUrl, sal_True ) ) ); -+ } -+ } -+ } -+ -+ // TODO: second get the customize addins in the org.openoffice.Office.Writer/GlobalTemplateList -+ -+ uno::Reference< container::XIndexAccess > xAddinsAccess( new XNamedObjectCollectionHelper< word::XAddin >( maAddins ) ); -+ return xAddinsAccess; -+} -+ -+SwVbaAddins::SwVbaAddins( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext ) throw (uno::RuntimeException): SwVbaAddins_BASE( xParent, xContext, lcl_getAddinCollection( xParent,xContext ) ) -+{ -+} -+// XEnumerationAccess -+uno::Type -+SwVbaAddins::getElementType() throw (uno::RuntimeException) -+{ -+ return word::XAddin::static_type(0); -+} -+uno::Reference< container::XEnumeration > -+SwVbaAddins::createEnumeration() throw (uno::RuntimeException) -+{ -+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); -+ return xEnumerationAccess->createEnumeration(); -+} -+ -+uno::Any -+SwVbaAddins::createCollectionObject( const css::uno::Any& aSource ) -+{ -+ return aSource; -+} -+ -+rtl::OUString& -+SwVbaAddins::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAddins") ); -+ return sImplName; -+} -+ -+css::uno::Sequence<rtl::OUString> -+SwVbaAddins::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > sNames; -+ if ( sNames.getLength() == 0 ) -+ { -+ sNames.realloc( 1 ); -+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Addins") ); -+ } -+ return sNames; -+} -diff --git sw/source/ui/vba/vbaaddins.hxx sw/source/ui/vba/vbaaddins.hxx -new file mode 100644 -index 0000000..6efa97e ---- /dev/null -+++ sw/source/ui/vba/vbaaddins.hxx -@@ -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 SW_VBA_ADDINS_HXX -+#define SW_VBA_ADDINS_HXX -+ -+#include <vbahelper/vbacollectionimpl.hxx> -+#include <ooo/vba/word/XAddins.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef CollTestImplHelper< ooo::vba::word::XAddins > SwVbaAddins_BASE; -+ -+class SwVbaAddins : public SwVbaAddins_BASE -+{ -+public: -+ SwVbaAddins( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext ) throw (css::uno::RuntimeException); -+ virtual ~SwVbaAddins() {} -+ -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ -+ // SwVbaAddins_BASE -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif /* SW_VBA_ADDINS_HXX */ -diff --git sw/source/ui/vba/vbaapplication.cxx sw/source/ui/vba/vbaapplication.cxx -index 0d580e3..4117688 100644 ---- sw/source/ui/vba/vbaapplication.cxx -+++ sw/source/ui/vba/vbaapplication.cxx -@@ -36,6 +36,13 @@ - #include "vbasystem.hxx" - #include "vbaoptions.hxx" - #include "vbaselection.hxx" -+#include "vbadocuments.hxx" -+#include "vbaaddins.hxx" -+#include "vbadialogs.hxx" -+#include <ooo/vba/word/WdEnableCancelKey.hpp> -+#include <svx/acorrcfg.hxx> -+#include "wordvbahelper.hxx" -+#include <docsh.hxx> - - using namespace ::ooo; - using namespace ::ooo::vba; -@@ -71,6 +78,11 @@ SwVbaApplication::~SwVbaApplication() - { - } - -+SfxObjectShell* SwVbaApplication::GetDocShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) -+{ -+ return static_cast< SfxObjectShell* >( word::getDocShell( xModel ) ); -+} -+ - rtl::OUString SAL_CALL - SwVbaApplication::getName() throw (uno::RuntimeException) - { -@@ -115,6 +127,59 @@ SwVbaApplication::getSelection() throw (uno::RuntimeException) - return new SwVbaSelection( this, mxContext, getCurrentDocument() ); - } - -+uno::Any SAL_CALL -+SwVbaApplication::Documents( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< XCollection > xCol( new SwVbaDocuments( this, mxContext ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+uno::Any SAL_CALL -+SwVbaApplication::Addins( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ static uno::Reference< XCollection > xCol( new SwVbaAddins( this, mxContext ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+uno::Any SAL_CALL -+SwVbaApplication::Dialogs( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< word::XDialogs > xCol( new SwVbaDialogs( this, mxContext ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index ); -+ return uno::makeAny( xCol ); -+} -+ -+sal_Bool SAL_CALL SwVbaApplication::getDisplayAutoCompleteTips() throw (css::uno::RuntimeException) -+{ -+ return SvxAutoCorrCfg::Get()->IsAutoTextTip(); -+} -+ -+void SAL_CALL SwVbaApplication::setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException) -+{ -+ SvxAutoCorrCfg::Get()->SetAutoTextTip( _displayAutoCompleteTips ); -+} -+ -+sal_Int32 SAL_CALL SwVbaApplication::getEnableCancelKey() throw (css::uno::RuntimeException) -+{ -+ // the default value is wdCancelInterrupt in Word -+ return word::WdEnableCancelKey::wdCancelInterrupt; -+} -+ -+void SAL_CALL SwVbaApplication::setEnableCancelKey( sal_Int32/* _enableCancelKey */) throw (css::uno::RuntimeException) -+{ -+ // seems not supported in Writer -+} -+ -+float SAL_CALL SwVbaApplication::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException) -+{ -+ return VbaApplicationBase::CentimetersToPoints( _Centimeters ); -+} -+ - rtl::OUString& - SwVbaApplication::getServiceImplName() - { -diff --git sw/source/ui/vba/vbaapplication.hxx sw/source/ui/vba/vbaapplication.hxx -index fbb7221..e896e02 100644 ---- sw/source/ui/vba/vbaapplication.hxx -+++ sw/source/ui/vba/vbaapplication.hxx -@@ -36,6 +36,7 @@ - #include <ooo/vba/word/XSystem.hpp> - #include <ooo/vba/word/XOptions.hpp> - #include <ooo/vba/word/XSelection.hpp> -+#include <ooo/vba/word/XAddins.hpp> - #include <vbahelper/vbahelperinterface.hxx> - #include <vbahelper/vbaapplicationbase.hxx> - #include <cppuhelper/implbase1.hxx> -@@ -49,6 +50,8 @@ public: - SwVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext ); - virtual ~SwVbaApplication(); - -+ virtual SfxObjectShell* GetDocShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException); -+ - // XApplication - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual css::uno::Reference< ooo::vba::word::XSystem > SAL_CALL getSystem() throw (css::uno::RuntimeException); -@@ -57,6 +60,14 @@ public: - virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException); - virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL getDisplayAutoCompleteTips() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDisplayAutoCompleteTips( sal_Bool _displayAutoCompleteTips ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getEnableCancelKey() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setEnableCancelKey( sal_Int32 _enableCancelKey ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException); - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -diff --git sw/source/ui/vba/vbaautotextentry.cxx sw/source/ui/vba/vbaautotextentry.cxx -new file mode 100644 -index 0000000..2cab994 ---- /dev/null -+++ sw/source/ui/vba/vbaautotextentry.cxx -@@ -0,0 +1,129 @@ -+/************************************************************************* -+ * -+ * 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 "vbaautotextentry.hxx" -+#include <vbahelper/vbahelper.hxx> -+#include <tools/diagnose_ex.h> -+#include "vbarange.hxx" -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+SwVbaAutoTextEntry::SwVbaAutoTextEntry( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XAutoTextEntry >& xEntry ) throw ( uno::RuntimeException ) : -+ SwVbaAutoTextEntry_BASE( rParent, rContext ), mxEntry( xEntry ) -+{ -+} -+ -+SwVbaAutoTextEntry::~SwVbaAutoTextEntry() -+{ -+} -+ -+uno::Reference< word::XRange > SAL_CALL SwVbaAutoTextEntry::Insert( const uno::Reference< word::XRange >& _where, const uno::Any& _richtext ) throw ( uno::RuntimeException ) -+{ -+ SwVbaRange* pWhere = dynamic_cast<SwVbaRange*>( _where.get() ); -+ if( pWhere ) -+ { -+ uno::Reference< text::XTextRange > xTextRange = pWhere->getXTextRange(); -+ xTextRange->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); // set marker -+ uno::Reference< text::XTextRange > xEndMarker = xTextRange->getEnd(); -+ xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("x") ) ); // set marker -+ uno::Reference< text::XText > xText = pWhere->getXText(); -+ mxEntry->applyTo( xEndMarker->getStart() ); -+ uno::Reference< text::XTextCursor > xTC = xText->createTextCursorByRange( xTextRange->getStart() ); -+ xTC->goRight( 1, sal_True ); -+ xTC->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker -+ xEndMarker->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); // remove marker -+ xTC->gotoRange( xEndMarker, sal_True ); -+ pWhere->setXTextCursor( xTC ); -+ } -+ return uno::Reference< word::XRange >( pWhere ); -+} -+ -+rtl::OUString& -+SwVbaAutoTextEntry::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAutoTextEntry") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaAutoTextEntry::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.AutoTextEntry" ) ); -+ } -+ return aServiceNames; -+} -+ -+ -+SwVbaAutoTextEntries::SwVbaAutoTextEntries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : SwVbaAutoTextEntries_BASE( xParent, xContext, xIndexAccess ), mxAutoTextEntryAccess( xIndexAccess ) -+{ -+} -+ -+// XEnumerationAccess -+uno::Type -+SwVbaAutoTextEntries::getElementType() throw (uno::RuntimeException) -+{ -+ return word::XAutoTextEntry::static_type(0); -+} -+uno::Reference< container::XEnumeration > -+SwVbaAutoTextEntries::createEnumeration() throw (uno::RuntimeException) -+{ -+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); -+ return xEnumerationAccess->createEnumeration(); -+} -+ -+uno::Any -+SwVbaAutoTextEntries::createCollectionObject( const css::uno::Any& aSource ) -+{ -+ uno::Reference< text::XAutoTextEntry > xEntry( aSource, uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XAutoTextEntry >( new SwVbaAutoTextEntry( this, mxContext, xEntry ) ) ); -+} -+ -+rtl::OUString& -+SwVbaAutoTextEntries::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaAutoTextEntries") ); -+ return sImplName; -+} -+ -+css::uno::Sequence<rtl::OUString> -+SwVbaAutoTextEntries::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > sNames; -+ if ( sNames.getLength() == 0 ) -+ { -+ sNames.realloc( 1 ); -+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.AutoTextEntries") ); -+ } -+ return sNames; -+} -diff --git sw/source/ui/vba/vbaautotextentry.hxx sw/source/ui/vba/vbaautotextentry.hxx -new file mode 100644 -index 0000000..01d12b9 ---- /dev/null -+++ sw/source/ui/vba/vbaautotextentry.hxx -@@ -0,0 +1,83 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_AUTOTEXTENTRY_HXX -+#define SW_VBA_AUTOTEXTENTRY_HXX -+ -+#include <vbahelper/vbacollectionimpl.hxx> -+#include <ooo/vba/word/XAutoTextEntries.hpp> -+#include <ooo/vba/word/XAutoTextEntry.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <cppuhelper/implbase1.hxx> -+#include <ooo/vba/word/XRange.hpp> -+#include <com/sun/star/text/XAutoTextEntry.hpp> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XAutoTextEntry > SwVbaAutoTextEntry_BASE; -+ -+class SwVbaAutoTextEntry : public SwVbaAutoTextEntry_BASE -+{ -+private: -+ css::uno::Reference< css::text::XAutoTextEntry > mxEntry; -+ -+public: -+ SwVbaAutoTextEntry( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XAutoTextEntry >& xEntry ) throw ( css::uno::RuntimeException ); -+ virtual ~SwVbaAutoTextEntry(); -+ -+ // XAutoTextEntry -+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL Insert( const css::uno::Reference< ooo::vba::word::XRange >& _where, const css::uno::Any& _richtext ) throw ( css::uno::RuntimeException ); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+ -+/* class SwVbaAutoTextEntries */ -+typedef CollTestImplHelper< ooo::vba::word::XAutoTextEntries > SwVbaAutoTextEntries_BASE; -+ -+class SwVbaAutoTextEntries : public SwVbaAutoTextEntries_BASE -+{ -+private: -+ css::uno::Reference< css::container::XIndexAccess > mxAutoTextEntryAccess; -+ -+public: -+ SwVbaAutoTextEntries( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw (css::uno::RuntimeException); -+ virtual ~SwVbaAutoTextEntries() {} -+ -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ -+ // SwVbaAutoTextEntries_BASE -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif /* SW_VBA_AUTOTEXTENTRY_HXX */ -diff --git sw/source/ui/vba/vbabookmark.cxx sw/source/ui/vba/vbabookmark.cxx -index e05476e..0c7bacf 100644 ---- sw/source/ui/vba/vbabookmark.cxx -+++ sw/source/ui/vba/vbabookmark.cxx -@@ -87,7 +87,8 @@ uno::Any SAL_CALL SwVbaBookmark::Range() throw ( uno::RuntimeException ) - { - uno::Reference< text::XTextContent > xTextContent( mxBookmark, uno::UNO_QUERY_THROW ); - uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW ); -- return uno::makeAny( uno::Reference< word::XRange>( new SwVbaRange( this, mxContext, xTextDocument, xTextContent->getAnchor()->getStart(), xTextContent->getAnchor()->getEnd() ) ) ); -+ uno::Reference< text::XTextRange > xTextRange( xTextContent->getAnchor(), uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XRange>( new SwVbaRange( this, mxContext, xTextDocument, xTextRange->getStart(), xTextRange->getEnd(), xTextRange->getText() ) ) ); - } - - rtl::OUString& -diff --git sw/source/ui/vba/vbabookmarks.cxx sw/source/ui/vba/vbabookmarks.cxx -index 3ff2bf3..e7d73cf 100644 ---- sw/source/ui/vba/vbabookmarks.cxx -+++ sw/source/ui/vba/vbabookmarks.cxx -@@ -35,6 +35,8 @@ - #include <com/sun/star/text/XTextViewCursorSupplier.hpp> - #include <ooo/vba/word/WdBookmarkSortBy.hpp> - #include "vbarange.hxx" -+#include "wordvbahelper.hxx" -+#include <cppuhelper/implbase2.hxx> - - using namespace ::ooo::vba; - using namespace ::com::sun::star; -@@ -55,15 +57,73 @@ public: - - }; - --SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, xBookmarks ), mxModel( xModel ) -+// Bookmarks use case-insensitive name lookup in MS Word. -+typedef ::cppu::WeakImplHelper2< container::XNameAccess, container::XIndexAccess > BookmarkCollectionHelper_BASE; -+class BookmarkCollectionHelper : public BookmarkCollectionHelper_BASE -+{ -+private: -+ uno::Reference< container::XNameAccess > mxNameAccess; -+ uno::Reference< container::XIndexAccess > mxIndexAccess; -+ uno::Any cachePos; -+public: -+ BookmarkCollectionHelper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : mxIndexAccess( xIndexAccess ) -+ { -+ mxNameAccess.set( mxIndexAccess, uno::UNO_QUERY_THROW ); -+ } -+ // XElementAccess -+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return mxIndexAccess->getElementType(); } -+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return mxIndexAccess->hasElements(); } -+ // XNameAcess -+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( !hasByName(aName) ) -+ throw container::NoSuchElementException(); -+ return cachePos; -+ } -+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) -+ { -+ return mxNameAccess->getElementNames(); -+ } -+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) -+ { -+ if( mxNameAccess->hasByName( aName ) ) -+ { -+ cachePos = mxNameAccess->getByName( aName ); -+ return sal_True; -+ } -+ else -+ { -+ for( sal_Int32 nIndex = 0; nIndex < mxIndexAccess->getCount(); nIndex++ ) -+ { -+ uno::Reference< container::XNamed > xNamed( mxIndexAccess->getByIndex( nIndex ), uno::UNO_QUERY_THROW ); -+ rtl::OUString aBookmarkName = xNamed->getName(); -+ if( aName.equalsIgnoreAsciiCase( aBookmarkName ) ) -+ { -+ cachePos <<= xNamed; -+ return sal_True; -+ } -+ } -+ } -+ return sal_False; -+ } -+ // XIndexAccess -+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) -+ { -+ return mxIndexAccess->getCount(); -+ } -+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) -+ { -+ return mxIndexAccess->getByIndex( Index ); -+ } -+}; -+ -+SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BookmarkCollectionHelper( xBookmarks ) ) ), mxModel( xModel ) - { - mxBookmarksSupplier.set( mxModel, uno::UNO_QUERY_THROW ); - uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW ); -- mxText = xDocument->getText(); -- -- // FIXME: fail to rename the bookmark -- // word doesn't distinguish cases, so set all bookmarknames to Lowercase -- //renameAllBookmarksToLowercase(); -+ // use view cursor to insert bookmark, or it will fail if insert bookmark in table -+ // mxText = xDocument->getText(); -+ mxText = word::getXTextViewCursor( mxModel )->getText(); - } - // XEnumerationAccess - uno::Type -@@ -88,7 +148,7 @@ SwVbaBookmarks::createCollectionObject( const css::uno::Any& aSource ) - - void SwVbaBookmarks::removeBookmarkByName( const rtl::OUString& rName ) throw (uno::RuntimeException) - { -- uno::Reference< text::XTextContent > xBookmark( mxBookmarksSupplier->getBookmarks()->getByName( rName ), uno::UNO_QUERY_THROW ); -+ uno::Reference< text::XTextContent > xBookmark( m_xNameAccess->getByName( rName ), uno::UNO_QUERY_THROW ); - mxText->removeTextContent( xBookmark ); - } - -@@ -101,19 +161,6 @@ void SwVbaBookmarks::addBookmarkByName( const rtl::OUString& rName, const uno::R - mxText->insertTextContent( rTextRange, xBookmark, sal_False ); - } - --void SwVbaBookmarks::renameAllBookmarksToLowercase() throw (uno::RuntimeException) --{ -- uno::Reference< container::XIndexAccess > xBookmarks( mxBookmarksSupplier->getBookmarks(),uno::UNO_QUERY_THROW ); -- for( sal_Int32 nIndex = 0; nIndex < xBookmarks->getCount(); nIndex++ ) -- { -- uno::Reference< container::XNamed > xNamed( xBookmarks->getByIndex( nIndex ), uno::UNO_QUERY_THROW ); -- rtl::OUString aName = xNamed->getName(); -- rtl::OUString aNameLowerCase = aName.toAsciiLowerCase(); -- if( !aName.equals( aNameLowerCase ) ); -- xNamed->setName( aNameLowerCase ); -- } --} -- - uno::Any SAL_CALL - SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw (uno::RuntimeException) - { -@@ -128,13 +175,13 @@ SwVbaBookmarks::Add( const rtl::OUString& rName, const uno::Any& rRange ) throw - else - { - // FIXME: insert the bookmark into current view cursor -- uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( mxModel->getCurrentController(), uno::UNO_QUERY_THROW ); -- xTextRange.set( xViewCursorSupplier->getViewCursor(), uno::UNO_QUERY_THROW ); -+ xTextRange.set( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW ); - } - - // remove the exist bookmark -- rtl::OUString aName = rName.toAsciiLowerCase(); -- if( mxBookmarksSupplier->getBookmarks()->hasByName( aName ) ) -+ // rtl::OUString aName = rName.toAsciiLowerCase(); -+ rtl::OUString aName = rName; -+ if( m_xNameAccess->hasByName( aName ) ) - removeBookmarkByName( aName ); - - addBookmarkByName( aName, xTextRange ); -@@ -169,7 +216,7 @@ SwVbaBookmarks::setShowHidden( sal_Bool /*_hidden*/ ) throw (css::uno::RuntimeEx - sal_Bool SAL_CALL - SwVbaBookmarks::Exists( const rtl::OUString& rName ) throw (css::uno::RuntimeException) - { -- sal_Bool bExist = mxBookmarksSupplier->getBookmarks()->hasByName( rName.toAsciiLowerCase() ); -+ sal_Bool bExist = m_xNameAccess->hasByName( rName ); - return bExist; - } - -diff --git sw/source/ui/vba/vbabookmarks.hxx sw/source/ui/vba/vbabookmarks.hxx -index 7fe5ffe..6047788 100644 ---- sw/source/ui/vba/vbabookmarks.hxx -+++ sw/source/ui/vba/vbabookmarks.hxx -@@ -51,7 +51,6 @@ private: - private: - void removeBookmarkByName( const rtl::OUString& rName ) throw (css::uno::RuntimeException); - void addBookmarkByName( const rtl::OUString& rName, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw (css::uno::RuntimeException); -- void renameAllBookmarksToLowercase() throw (css::uno::RuntimeException); - - public: - SwVbaBookmarks( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xBookmarks, const css::uno::Reference< css::frame::XModel >& xModel ); -diff --git sw/source/ui/vba/vbaborders.cxx sw/source/ui/vba/vbaborders.cxx -new file mode 100644 -index 0000000..44ed6eb ---- /dev/null -+++ sw/source/ui/vba/vbaborders.cxx -@@ -0,0 +1,381 @@ -+/************************************************************************* -+ * -+ * 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: vbaborders.cxx,v $ -+ * $Revision: 1.6 $ -+ * -+ * 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 "vbaborders.hxx" -+#include <ooo/vba/word/XBorder.hpp> -+#include <ooo/vba/word/WdBorderType.hpp> -+#include <ooo/vba/word/WdLineStyle.hpp> -+#include <cppuhelper/implbase3.hxx> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <com/sun/star/table/TableBorder.hpp> -+#include <com/sun/star/table/ShadowFormat.hpp> -+#include <com/sun/star/table/ShadowLocation.hpp> -+#include "vbapalette.hxx" -+ -+using namespace ::com::sun::star; -+using namespace ::ooo::vba; -+ -+ -+typedef ::cppu::WeakImplHelper1<container::XIndexAccess > RangeBorders_Base; -+typedef InheritedHelperInterfaceImpl1<word::XBorder > SwVbaBorder_Base; -+ -+// #TODO sort these indexes to match the order in which Word iterates over the -+// borders, the enumeration will match the order in this list -+static const sal_Int16 supportedIndexTable[] = { word::WdBorderType::wdBorderBottom, word::WdBorderType::wdBorderDiagonalDown, word::WdBorderType::wdBorderDiagonalUp, word::WdBorderType::wdBorderHorizontal, word::WdBorderType::wdBorderLeft, word::WdBorderType::wdBorderRight, word::WdBorderType::wdBorderTop, word::WdBorderType::wdBorderVertical }; -+ -+const static rtl::OUString sTableBorder( RTL_CONSTASCII_USTRINGPARAM("TableBorder") ); -+ -+// Equiv widths in in 1/100 mm -+const static sal_Int32 OOLineThin = 35; -+const static sal_Int32 OOLineMedium = 88; -+const static sal_Int32 OOLineThick = 141; -+const static sal_Int32 OOLineHairline = 2; -+ -+class SwVbaBorder : public SwVbaBorder_Base -+{ -+private: -+ uno::Reference< beans::XPropertySet > m_xProps; -+ sal_Int32 m_LineType; -+ VbaPalette m_Palette; -+ bool setBorderLine( table::BorderLine& rBorderLine ) -+ { -+ table::TableBorder aTableBorder; -+ m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder; -+ -+ switch ( m_LineType ) -+ { -+ case word::WdBorderType::wdBorderLeft: -+ aTableBorder.IsLeftLineValid = sal_True; -+ aTableBorder.LeftLine= rBorderLine; -+ break; -+ case word::WdBorderType::wdBorderTop: -+ aTableBorder.IsTopLineValid = sal_True; -+ aTableBorder.TopLine = rBorderLine; -+ break; -+ -+ case word::WdBorderType::wdBorderBottom: -+ aTableBorder.IsBottomLineValid = sal_True; -+ aTableBorder.BottomLine = rBorderLine; -+ break; -+ case word::WdBorderType::wdBorderRight: -+ aTableBorder.IsRightLineValid = sal_True; -+ aTableBorder.RightLine = rBorderLine; -+ break; -+ case word::WdBorderType::wdBorderVertical: -+ aTableBorder.IsVerticalLineValid = sal_True; -+ aTableBorder.VerticalLine = rBorderLine; -+ break; -+ case word::WdBorderType::wdBorderHorizontal: -+ aTableBorder.IsHorizontalLineValid = sal_True; -+ aTableBorder.HorizontalLine = rBorderLine; -+ break; -+ case word::WdBorderType::wdBorderDiagonalDown: -+ case word::WdBorderType::wdBorderDiagonalUp: -+ // #TODO have to ignore at the momement, would be -+ // nice to investigate what we can do here -+ break; -+ default: -+ return false; -+ } -+ m_xProps->setPropertyValue( sTableBorder, uno::makeAny(aTableBorder) ); -+ return true; -+ } -+ -+ bool getBorderLine( table::BorderLine& rBorderLine ) -+ { -+ table::TableBorder aTableBorder; -+ m_xProps->getPropertyValue( sTableBorder ) >>= aTableBorder; -+ switch ( m_LineType ) -+ { -+ case word::WdBorderType::wdBorderLeft: -+ if ( aTableBorder.IsLeftLineValid ) -+ rBorderLine = aTableBorder.LeftLine; -+ break; -+ case word::WdBorderType::wdBorderTop: -+ if ( aTableBorder.IsTopLineValid ) -+ rBorderLine = aTableBorder.TopLine; -+ break; -+ case word::WdBorderType::wdBorderBottom: -+ if ( aTableBorder.IsBottomLineValid ) -+ rBorderLine = aTableBorder.BottomLine; -+ break; -+ case word::WdBorderType::wdBorderRight: -+ if ( aTableBorder.IsRightLineValid ) -+ rBorderLine = aTableBorder.RightLine; -+ break; -+ case word::WdBorderType::wdBorderVertical: -+ if ( aTableBorder.IsVerticalLineValid ) -+ rBorderLine = aTableBorder.VerticalLine; -+ break; -+ case word::WdBorderType::wdBorderHorizontal: -+ if ( aTableBorder.IsHorizontalLineValid ) -+ rBorderLine = aTableBorder.HorizontalLine; -+ break; -+ -+ case word::WdBorderType::wdBorderDiagonalDown: -+ case word::WdBorderType::wdBorderDiagonalUp: -+ // #TODO have to ignore at the momement, would be -+ // nice to investigate what we can do here -+ break; -+ default: -+ return false; -+ } -+ return true; -+ } -+ SwVbaBorder(); // no impl -+protected: -+ virtual rtl::OUString& getServiceImplName() -+ { -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorder") ); -+ return sImplName; -+ } -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames() -+ { -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Border" ) ); -+ } -+ return aServiceNames; -+ } -+public: -+ SwVbaBorder( const uno::Reference< beans::XPropertySet > & xProps, const uno::Reference< uno::XComponentContext >& xContext, sal_Int32 lineType, VbaPalette& rPalette) : SwVbaBorder_Base( uno::Reference< XHelperInterface >( xProps, uno::UNO_QUERY ), xContext ), m_xProps( xProps ), m_LineType( lineType ), m_Palette( rPalette ) {} -+ -+ uno::Any SAL_CALL getLineStyle() throw (uno::RuntimeException) -+ { -+ sal_Int32 nLineStyle = word::WdLineStyle::wdLineStyleNone; -+ table::BorderLine aBorderLine; -+ if ( getBorderLine( aBorderLine ) ) -+ { -+ if( aBorderLine.InnerLineWidth !=0 && aBorderLine.OuterLineWidth !=0 ) -+ { -+ nLineStyle = word::WdLineStyle::wdLineStyleDouble; -+ } -+ else if( aBorderLine.InnerLineWidth !=0 || aBorderLine.OuterLineWidth !=0 ) -+ { -+ nLineStyle = word::WdLineStyle::wdLineStyleSingle; -+ } -+ else -+ { -+ nLineStyle = word::WdLineStyle::wdLineStyleNone; -+ } -+ } -+ return uno::makeAny( nLineStyle ); -+ } -+ void SAL_CALL setLineStyle( const uno::Any& _linestyle ) throw (uno::RuntimeException) -+ { -+ // Urk no choice but to silently ignore we don't support this attribute -+ // #TODO would be nice to support the word line styles -+ sal_Int32 nLineStyle = 0; -+ _linestyle >>= nLineStyle; -+ table::BorderLine aBorderLine; -+ if ( getBorderLine( aBorderLine ) ) -+ { -+ switch ( nLineStyle ) -+ { -+ case word::WdLineStyle::wdLineStyleNone: -+ { -+ aBorderLine.InnerLineWidth = 0; -+ aBorderLine.OuterLineWidth = 0; -+ break; -+ } -+ case word::WdLineStyle::wdLineStyleDashDot: -+ case word::WdLineStyle::wdLineStyleDashDotDot: -+ case word::WdLineStyle::wdLineStyleDashDotStroked: -+ case word::WdLineStyle::wdLineStyleDashLargeGap: -+ case word::WdLineStyle::wdLineStyleDashSmallGap: -+ case word::WdLineStyle::wdLineStyleDot: -+ case word::WdLineStyle::wdLineStyleDouble: -+ case word::WdLineStyle::wdLineStyleDoubleWavy: -+ case word::WdLineStyle::wdLineStyleEmboss3D: -+ case word::WdLineStyle::wdLineStyleEngrave3D: -+ case word::WdLineStyle::wdLineStyleInset: -+ case word::WdLineStyle::wdLineStyleOutset: -+ case word::WdLineStyle::wdLineStyleSingle: -+ case word::WdLineStyle::wdLineStyleSingleWavy: -+ case word::WdLineStyle::wdLineStyleThickThinLargeGap: -+ case word::WdLineStyle::wdLineStyleThickThinMedGap: -+ case word::WdLineStyle::wdLineStyleThickThinSmallGap: -+ case word::WdLineStyle::wdLineStyleThinThickLargeGap: -+ case word::WdLineStyle::wdLineStyleThinThickMedGap: -+ case word::WdLineStyle::wdLineStyleThinThickSmallGap: -+ case word::WdLineStyle::wdLineStyleThinThickThinLargeGap: -+ case word::WdLineStyle::wdLineStyleThinThickThinMedGap: -+ case word::WdLineStyle::wdLineStyleThinThickThinSmallGap: -+ case word::WdLineStyle::wdLineStyleTriple: -+ { -+ aBorderLine.InnerLineWidth = 0; -+ aBorderLine.OuterLineWidth = OOLineHairline; -+ break; -+ } -+ default: -+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bad param" ) ), uno::Reference< uno::XInterface >() ); -+ } -+ setBorderLine( aBorderLine ); -+ } -+ else -+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Method failed" ) ), uno::Reference< uno::XInterface >() ); -+ } -+}; -+ -+class RangeBorders : public RangeBorders_Base -+{ -+private: -+ uno::Reference< table::XCellRange > m_xRange; -+ uno::Reference< uno::XComponentContext > m_xContext; -+ VbaPalette m_Palette; -+ sal_Int32 getTableIndex( sal_Int32 nConst ) -+ { -+ // hokay return position of the index in the table -+ sal_Int32 nIndexes = getCount(); -+ sal_Int32 realIndex = 0; -+ const sal_Int16* pTableEntry = supportedIndexTable; -+ for ( ; realIndex < nIndexes; ++realIndex, ++pTableEntry ) -+ { -+ if ( *pTableEntry == nConst ) -+ return realIndex; -+ } -+ return getCount(); // error condition -+ } -+public: -+ RangeBorders( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette ) : m_xRange( xRange ), m_xContext( xContext ), m_Palette( rPalette ) -+ { -+ } -+ // XIndexAccess -+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) -+ { -+ return sizeof( supportedIndexTable ) / sizeof( supportedIndexTable[0] ); -+ } -+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ -+ sal_Int32 nIndex = getTableIndex( Index ); -+ if ( nIndex >= 0 && nIndex < getCount() ) -+ { -+ uno::Reference< beans::XPropertySet > xProps( m_xRange, uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XBorder >( new SwVbaBorder( xProps, m_xContext, supportedIndexTable[ nIndex ], m_Palette )) ); -+ } -+ throw lang::IndexOutOfBoundsException(); -+ } -+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) -+ { -+ return word::XBorder::static_type(0); -+ } -+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) -+ { -+ return sal_True; -+ } -+}; -+ -+uno::Reference< container::XIndexAccess > -+rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette& rPalette ) -+{ -+ return new RangeBorders( xRange, xContext, rPalette ); -+} -+ -+class RangeBorderEnumWrapper : public EnumerationHelper_BASE -+{ -+ uno::Reference<container::XIndexAccess > m_xIndexAccess; -+ sal_Int32 nIndex; -+public: -+ RangeBorderEnumWrapper( const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} -+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -+ { -+ return ( nIndex < m_xIndexAccess->getCount() ); -+ } -+ -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( nIndex < m_xIndexAccess->getCount() ) -+ return m_xIndexAccess->getByIndex( nIndex++ ); -+ throw container::NoSuchElementException(); -+ } -+}; -+ -+// for Table borders -+SwVbaBorders::SwVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, VbaPalette& rPalette ): SwVbaBorders_BASE( xParent, xContext, rangeToBorderIndexAccess( xRange ,xContext, rPalette ) ) -+{ -+ m_xProps.set( xRange, uno::UNO_QUERY_THROW ); -+} -+ -+uno::Reference< container::XEnumeration > -+SwVbaBorders::createEnumeration() throw (uno::RuntimeException) -+{ -+ return new RangeBorderEnumWrapper( m_xIndexAccess ); -+} -+ -+uno::Any -+SwVbaBorders::createCollectionObject( const css::uno::Any& aSource ) -+{ -+ return aSource; // its already a Border object -+} -+ -+uno::Type -+SwVbaBorders::getElementType() throw (uno::RuntimeException) -+{ -+ return word::XBorders::static_type(0); -+} -+ -+uno::Any -+SwVbaBorders::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException) -+{ -+ return createCollectionObject( m_xIndexAccess->getByIndex( nIndex ) ); -+} -+ -+sal_Bool SAL_CALL SwVbaBorders::getShadow() throw (uno::RuntimeException) -+{ -+ table::ShadowFormat aShadowFormat; -+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowFormat") ) ) >>= aShadowFormat; -+ return ( aShadowFormat.Location != table::ShadowLocation_NONE ); -+} -+ -+void SAL_CALL SwVbaBorders::setShadow( sal_Bool _shadow ) throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+rtl::OUString& -+SwVbaBorders::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBorders") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaBorders::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Borders" ) ); -+ } -+ return aServiceNames; -+} -diff --git sw/source/ui/vba/vbaborders.hxx sw/source/ui/vba/vbaborders.hxx -new file mode 100644 -index 0000000..b0cf517 ---- /dev/null -+++ sw/source/ui/vba/vbaborders.hxx -@@ -0,0 +1,66 @@ -+/************************************************************************* -+ * -+ * 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: vbaborders.hxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 SW_VBA_BORDERS_HXX -+#define SW_VBA_BORDERS_HXX -+ -+#include <cppuhelper/implbase1.hxx> -+#include <ooo/vba/word/XBorders.hpp> -+#include <com/sun/star/uno/XComponentContext.hpp> -+#include <com/sun/star/table/XCellRange.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <vbahelper/vbacollectionimpl.hxx> -+ -+typedef CollTestImplHelper< ov::word::XBorders > SwVbaBorders_BASE; -+class VbaPalette; -+class SwVbaBorders : public SwVbaBorders_BASE -+{ -+ // XEnumerationAccess -+ virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException); -+ css::uno::Reference< css::beans::XPropertySet > m_xProps; -+public: -+ SwVbaBorders( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::table::XCellRange >& xRange, VbaPalette& rPalette ); -+ virtual ~SwVbaBorders() {} -+ -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ -+ // SwVbaCollectionBaseImpl -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -+ -+ virtual sal_Bool SAL_CALL getShadow() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setShadow( sal_Bool _shadow ) throw (css::uno::RuntimeException); -+ -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif //SW_VBA_BORDERS_HXX -+ -diff --git sw/source/ui/vba/vbadialog.cxx sw/source/ui/vba/vbadialog.cxx -new file mode 100644 -index 0000000..df35a1a ---- /dev/null -+++ sw/source/ui/vba/vbadialog.cxx -@@ -0,0 +1,81 @@ -+/************************************************************************* -+ * -+ * 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: vbadialog.cxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 "vbadialog.hxx" -+#include <ooo/vba/word/WdWordDialog.hpp> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+struct WordDialogTable -+{ -+ sal_Int32 wdDialog; -+ const sal_Char* ooDialog; -+}; -+ -+static const WordDialogTable aWordDialogTable[] = -+{ -+ { word::WdWordDialog::wdDialogFileNew, ".uno:NewDoc" }, -+ { word::WdWordDialog::wdDialogFileOpen, ".uno:Open" }, -+ { word::WdWordDialog::wdDialogFilePrint, ".uno:Print" }, -+ { word::WdWordDialog::wdDialogFileSaveAs, ".uno:SaveAs" }, -+ { 0, 0 } -+}; -+ -+rtl::OUString -+SwVbaDialog::mapIndexToName( sal_Int32 nIndex ) -+{ -+ for( const WordDialogTable* pTable = aWordDialogTable; pTable->wdDialog != NULL; pTable++ ) -+ { -+ if( nIndex == pTable->wdDialog ) -+ { -+ return rtl::OUString::createFromAscii( pTable->ooDialog ); -+ } -+ } -+ return rtl::OUString(); -+} -+ -+rtl::OUString& -+SwVbaDialog::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDialog") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaDialog::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Dialog" ) ); -+ } -+ return aServiceNames; -+} -diff --git sw/source/ui/vba/vbadialog.hxx sw/source/ui/vba/vbadialog.hxx -new file mode 100644 -index 0000000..9090f15 ---- /dev/null -+++ sw/source/ui/vba/vbadialog.hxx -@@ -0,0 +1,53 @@ -+/************************************************************************* -+ * -+ * 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: vbadialog.hxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 SW_VBA_DIALOG_HXX -+#define SW_VBA_DIALOG_HXX -+ -+#include <cppuhelper/implbase1.hxx> -+#include <ooo/vba/word/XDialog.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <vbahelper/vbadialogbase.hxx> -+ -+typedef cppu::ImplInheritanceHelper1< VbaDialogBase, ov::word::XDialog > SwVbaDialog_BASE; -+ -+class SwVbaDialog : public SwVbaDialog_BASE -+{ -+public: -+ SwVbaDialog( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nIndex ):SwVbaDialog_BASE( xParent, xContext, nIndex ) {} -+ virtual ~SwVbaDialog() {} -+ -+ // Methods -+ virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ); -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif /* SW_VBA_DIALOG_HXX */ -diff --git sw/source/ui/vba/vbadialogs.cxx sw/source/ui/vba/vbadialogs.cxx -new file mode 100644 -index 0000000..26dd7f1 ---- /dev/null -+++ sw/source/ui/vba/vbadialogs.cxx -@@ -0,0 +1,64 @@ -+/************************************************************************* -+ * -+ * 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: vbadialogs.cxx,v $ -+ * $Revision: 1.5 $ -+ * -+ * 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 <ooo/vba/word/XDialog.hpp> -+#include "vbadialogs.hxx" -+#include "vbadialog.hxx" -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+uno::Any -+SwVbaDialogs::Item( const uno::Any &aItem ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nIndex = 0; -+ aItem >>= nIndex; -+ uno::Reference< word::XDialog > aDialog( new SwVbaDialog( uno::Reference< XHelperInterface >( Application(),uno::UNO_QUERY_THROW ), mxContext, nIndex ) ); -+ return uno::Any( aDialog ); -+} -+ -+rtl::OUString& -+SwVbaDialogs::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDialogs") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaDialogs::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Dialogs" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbadialogs.hxx sw/source/ui/vba/vbadialogs.hxx -new file mode 100644 -index 0000000..ef36067 ---- /dev/null -+++ sw/source/ui/vba/vbadialogs.hxx -@@ -0,0 +1,56 @@ -+/************************************************************************* -+ * -+ * 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: vbadialogs.hxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 SW_VBA_DIALOGS_HXX -+#define SW_VBA_DIALOGS_HXX -+ -+#include <com/sun/star/uno/XComponentContext.hpp> -+#include <ooo/vba/word/XDialogs.hpp> -+#include <ooo/vba/XCollection.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <vbahelper/vbadialogsbase.hxx> -+#include <cppuhelper/implbase1.hxx> -+ -+typedef cppu::ImplInheritanceHelper1< VbaDialogsBase, ov::word::XDialogs > SwVbaDialogs_BASE; -+ -+class SwVbaDialogs : public SwVbaDialogs_BASE -+{ -+public: -+ SwVbaDialogs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext ): SwVbaDialogs_BASE( xParent, xContext ) {} -+ virtual ~SwVbaDialogs() {} -+ -+ // XCollection -+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif /* SW_VBA_DIALOGS_HXX */ -diff --git sw/source/ui/vba/vbadocument.cxx sw/source/ui/vba/vbadocument.cxx -index bb03373..906a617 100644 ---- sw/source/ui/vba/vbadocument.cxx -+++ sw/source/ui/vba/vbadocument.cxx -@@ -37,10 +37,23 @@ - #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> - #include <com/sun/star/document/XDocumentInfoSupplier.hpp> - #include <com/sun/star/document/XDocumentProperties.hpp> -+#include <com/sun/star/drawing/XDrawPageSupplier.hpp> -+#include <com/sun/star/drawing/XControlShape.hpp> -+#include <com/sun/star/drawing/XControlShape.hpp> -+#include <com/sun/star/form/XFormsSupplier.hpp> -+#include <ooo/vba/XControlProvider.hpp> -+ - #include <vbahelper/helperdecl.hxx> - #include <wordvbahelper.hxx> - #include <docsh.hxx> - #include "vbatemplate.hxx" -+#include "vbaparagraph.hxx" -+#include "vbastyles.hxx" -+#include "vbatables.hxx" -+#include "vbafield.hxx" -+#include "vbapagesetup.hxx" -+#include "vbasections.hxx" -+#include <vbahelper/vbashapes.hxx> - - using namespace ::ooo::vba; - using namespace ::com::sun::star; -@@ -159,6 +172,61 @@ SwVbaDocument::Variables( const uno::Any& rIndex ) throw ( uno::RuntimeException - return uno::Any( xVariables->Item( rIndex, uno::Any() ) ); - } - -+uno::Any SAL_CALL -+SwVbaDocument::Paragraphs( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< XCollection > xCol( new SwVbaParagraphs( mxParent, mxContext, mxTextDocument ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+uno::Any SAL_CALL -+SwVbaDocument::Styles( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< XCollection > xCol( new SwVbaStyles( mxParent, mxContext, getModel() ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+uno::Any SAL_CALL -+SwVbaDocument::Fields( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, getModel() ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+uno::Any SAL_CALL -+SwVbaDocument::Shapes( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getModel(), uno::UNO_QUERY_THROW ); -+ //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); -+ uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+uno::Any SAL_CALL -+SwVbaDocument::Sections( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< XCollection > xCol( new SwVbaSections( mxParent, mxContext, getModel() ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+uno::Any SAL_CALL -+SwVbaDocument::PageSetup( ) throw (uno::RuntimeException) -+{ -+ uno::Reference< beans::XPropertySet > xPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, xPageProps ) ) ); -+} -+ - rtl::OUString& - SwVbaDocument::getServiceImplName() - { -@@ -185,6 +253,112 @@ SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) thr - throw uno::RuntimeException(); - } - -+uno::Any SAL_CALL -+SwVbaDocument::Tables( const css::uno::Any& aIndex ) throw (uno::RuntimeException) -+{ -+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW ); -+ uno::Reference< XCollection > xColl( new SwVbaTables( mxParent, mxContext, xModel ) ); -+ -+ if ( aIndex.hasValue() ) -+ return xColl->Item( aIndex, uno::Any() ); -+ return uno::makeAny( xColl ); -+} -+ -+void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException) -+{ -+ VbaDocumentBase::Activate(); -+} -+ -+uno::Any -+SwVbaDocument::getControlShape( const ::rtl::OUString& sName ) -+{ -+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); -+ -+ sal_Int32 nCount = xIndexAccess->getCount(); -+ for( int index = 0; index < nCount; index++ ) -+ { -+ uno::Any aUnoObj = xIndexAccess->getByIndex( index ); -+ // It seems there are some drawing objects that can not query into Control shapes? -+ uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY ); -+ if( xControlShape.is() ) -+ { -+ uno::Reference< container::XNamed > xNamed( xControlShape->getControl(), uno::UNO_QUERY_THROW ); -+ if( sName.equals( xNamed->getName() )) -+ { -+ return aUnoObj; -+ } -+ } -+ } -+ return uno::Any(); -+} -+ -+uno::Reference< beans::XIntrospectionAccess > SAL_CALL -+SwVbaDocument::getIntrospection( ) throw (uno::RuntimeException) -+{ -+ return uno::Reference< beans::XIntrospectionAccess >(); -+} -+ -+uno::Any SAL_CALL -+SwVbaDocument::invoke( const ::rtl::OUString& aFunctionName, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) -+{ -+ OSL_TRACE("** SwVbaDocument::invoke( %s ), will barf", -+ rtl::OUStringToOString( aFunctionName, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ -+ throw uno::RuntimeException(); // unsupported operation -+} -+ -+void SAL_CALL -+SwVbaDocument::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::Any& /*aValue*/ ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) -+{ -+ throw uno::RuntimeException(); // unsupported operation -+} -+uno::Any SAL_CALL -+SwVbaDocument::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException) -+{ -+ uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW ); -+ -+ uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -+ uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW ); -+ uno::Reference< msforms::XControl > xControl( xControlProvider->createControl( xControlShape, getModel() ) ); -+ return uno::makeAny( xControl ); -+} -+ -+::sal_Bool SAL_CALL -+SwVbaDocument::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+::sal_Bool SAL_CALL -+SwVbaDocument::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException) -+{ -+ uno::Reference< container::XNameAccess > xFormControls( getFormControls() ); -+ if ( xFormControls.is() ) -+ return xFormControls->hasByName( aName ); -+ return sal_False; -+} -+ -+uno::Reference< container::XNameAccess > -+SwVbaDocument::getFormControls() -+{ -+ uno::Reference< container::XNameAccess > xFormControls; -+ try -+ { -+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW ); -+ uno::Reference< form::XFormsSupplier > xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW ); -+ // get the www-standard container ( maybe we should access the -+ // 'www-standard' by name rather than index, this seems an -+ // implementation detail -+ xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW ); -+ } -+ catch( uno::Exception& ) -+ { -+ } -+ return xFormControls; -+} -+ - uno::Sequence< rtl::OUString > - SwVbaDocument::getServiceNames() - { -diff --git sw/source/ui/vba/vbadocument.hxx sw/source/ui/vba/vbadocument.hxx -index a82503b..651b06c 100644 ---- sw/source/ui/vba/vbadocument.hxx -+++ sw/source/ui/vba/vbadocument.hxx -@@ -43,6 +43,9 @@ private: - css::uno::Reference< css::text::XTextDocument > mxTextDocument; - - void Initialize(); -+ css::uno::Any getControlShape( const rtl::OUString& sName ); -+ css::uno::Reference< css::container::XNameAccess > getFormControls(); -+ - public: - SwVbaDocument( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& m_xContext, css::uno::Reference< css::frame::XModel > xModel ); - SwVbaDocument( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ); -@@ -57,7 +60,21 @@ public: - virtual css::uno::Any SAL_CALL Variables( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException ); - virtual css::uno::Any SAL_CALL getAttachedTemplate() throw (css::uno::RuntimeException); - virtual void SAL_CALL setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (css::uno::RuntimeException); -- -+ virtual css::uno::Any SAL_CALL Paragraphs( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException ); -+ virtual css::uno::Any SAL_CALL Styles( const css::uno::Any& rIndex ) throw ( css::uno::RuntimeException ); -+ virtual css::uno::Any SAL_CALL Tables( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Sections( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL Activate() throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException); -+ // XInvocation -+ virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const css::uno::Sequence< css::uno::Any >& aParams, css::uno::Sequence< ::sal_Int16 >& aOutParamIndex, css::uno::Sequence< css::uno::Any >& aOutParam ) throw (css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); -+ virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const css::uno::Any& aValue ) throw (css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (css::beans::UnknownPropertyException, css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException); - - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); -diff --git sw/source/ui/vba/vbadocumentproperties.cxx sw/source/ui/vba/vbadocumentproperties.cxx -index 74470f9..f07b978 100644 ---- sw/source/ui/vba/vbadocumentproperties.cxx -+++ sw/source/ui/vba/vbadocumentproperties.cxx -@@ -250,38 +250,7 @@ public: - { - boost::shared_ptr< PropertGetSetHelper > aStandardHelper( new BuiltinPropertyGetSetHelper( xModel ) ); - boost::shared_ptr< PropertGetSetHelper > aUsingStatsHelper( new StatisticPropertyGetSetHelper( xModel ) ); --/* -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyKeywords ] = DocPropInfo::createDocPropInfo( "Keywords", "Keywords", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyComments ] = DocPropInfo::createDocPropInfo( "Comments", "Description", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTemplate ] = DocPropInfo::createDocPropInfo( "Template", "Template", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLastAuthor ] = DocPropInfo::createDocPropInfo( "Last author", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ? -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyRevision ] = DocPropInfo::createDocPropInfo( "Revision number", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ? -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAppName ] = DocPropInfo::createDocPropInfo( "Application name", "Generator", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist - throw or return nothing ? -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastPrinted ] = DocPropInfo::createDocPropInfo( "Last print date", "PrintDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ? -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeCreated ] = DocPropInfo::createDocPropInfo( "Creation date", "CreationDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ? -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTimeLastSaved ] = DocPropInfo::createDocPropInfo( "Last save time", "ModifyDate", office::MsoDocProperties::msoPropertyTypeDate, aStandardHelper ); // doesn't seem to exist - throw or return nothing ? -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyVBATotalEdit ] = DocPropInfo::createDocPropInfo( "Total editing time", "EditingDuration", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // Not sure if this is correct -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyPages ] = DocPropInfo::createDocPropInfo( "Number of pages", "PageCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyWords ] = DocPropInfo::createDocPropInfo( "Number of words", "WordCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharacters ] = DocPropInfo::createDocPropInfo( "Number of characters", "CharacterCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling required -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySecurity ] = DocPropInfo::createDocPropInfo( "Security", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCategory ] = DocPropInfo::createDocPropInfo( "Category", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyFormat ] = DocPropInfo::createDocPropInfo( "Format", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyManager ] = DocPropInfo::createDocPropInfo( "Manager", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCompany ] = DocPropInfo::createDocPropInfo( "Company", "", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); // doesn't seem to exist -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyBytes ] = DocPropInfo::createDocPropInfo( "Number of bytes", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist - size on disk exists ( for an already saved document ) perhaps it will do ( or we need something else ) -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyLines ] = DocPropInfo::createDocPropInfo( "Number of lines", "LineCount", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyParas ] = DocPropInfo::createDocPropInfo( "Number of paragraphs", "", office::MsoDocProperties::msoPropertyTypeNumber, aUsingStatsHelper ); // special handling -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySlides ] = DocPropInfo::createDocPropInfo( "Number of slides", "" , office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyNotes ] = DocPropInfo::createDocPropInfo( "Number of notes", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHiddenSlides ] = DocPropInfo::createDocPropInfo("Number of hidden Slides", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyMMClips ] = DocPropInfo::createDocPropInfo( "Number of multimedia clips", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to exist -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyHyperlinkBase ] = DocPropInfo::createDocPropInfo( "Hyperlink base", "AutoloadURL", office::MsoDocProperties::msoPropertyTypeString, aStandardHelper ); -- m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyCharsWSpaces ] = DocPropInfo::createDocPropInfo( "Number of characters (with spaces)", "", office::MsoDocProperties::msoPropertyTypeNumber, aStandardHelper ); // doesn't seem to be supported --*/ -+ - m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyTitle ] = DocPropInfo::createDocPropInfo( "Title", "Title", aStandardHelper ); - m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertySubject ] = DocPropInfo::createDocPropInfo( "Subject", "Subject", aStandardHelper ); - m_docPropInfoMap[ word::WdBuiltInProperty::wdPropertyAuthor ] = DocPropInfo::createDocPropInfo( "Author", "Author", aStandardHelper ); -@@ -393,7 +362,7 @@ SwVbaCustomDocumentProperty::setLinkSource( const rtl::OUString& /*rsLinkContent - } - - void SAL_CALL --SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& Name ) throw (script::BasicErrorException, uno::RuntimeException) -+SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& /*Name*/ ) throw (script::BasicErrorException, uno::RuntimeException) - { - // setName on existing property ? - // #FIXME -@@ -401,7 +370,7 @@ SwVbaCustomDocumentProperty::setName( const ::rtl::OUString& Name ) throw (scrip - } - - void SAL_CALL --SwVbaCustomDocumentProperty::setType( ::sal_Int8 Type ) throw (script::BasicErrorException, uno::RuntimeException) -+SwVbaCustomDocumentProperty::setType( ::sal_Int8 /*Type*/ ) throw (script::BasicErrorException, uno::RuntimeException) - { - // setType, do we need to do a conversion? - // #FIXME the underlying value needs to be changed to the new type -@@ -620,7 +589,7 @@ SwVbaBuiltinDocumentProperties::SwVbaBuiltinDocumentProperties( const uno::Refer - } - - uno::Reference< XDocumentProperty > SAL_CALL --SwVbaBuiltinDocumentProperties::Add( const ::rtl::OUString& /*Name*/, ::sal_Bool /*LinkToContent*/, ::sal_Int8 /*Type*/, const uno::Any& value, const uno::Any& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException) -+SwVbaBuiltinDocumentProperties::Add( const ::rtl::OUString& /*Name*/, ::sal_Bool /*LinkToContent*/, ::sal_Int8 /*Type*/, const uno::Any& /*value*/, const uno::Any& /*LinkSource*/ ) throw (script::BasicErrorException, uno::RuntimeException) - { - throw uno::RuntimeException( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("not supported for Builtin properties") ), uno::Reference< uno::XInterface >() ); -@@ -752,7 +721,7 @@ public: - return new DocPropEnumeration( simpleDocPropSnapShot ); - } - -- void addProp( const ::rtl::OUString& Name, ::sal_Int8 Type, const uno::Any& Value ) -+ void addProp( const ::rtl::OUString& Name, ::sal_Int8 /*Type*/, const uno::Any& Value ) - { - sal_Int16 attributes = 128; - uno::Reference< beans::XPropertyContainer > xContainer( mxUserDefinedProp, uno::UNO_QUERY_THROW ); -diff --git sw/source/ui/vba/vbadocuments.cxx sw/source/ui/vba/vbadocuments.cxx -new file mode 100644 -index 0000000..c8934b4 ---- /dev/null -+++ sw/source/ui/vba/vbadocuments.cxx -@@ -0,0 +1,181 @@ -+/************************************************************************* -+ * -+ * 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: vbadocuments.cxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 <comphelper/processfactory.hxx> -+ -+#include <cppuhelper/implbase1.hxx> -+#include <cppuhelper/implbase3.hxx> -+ -+#include <com/sun/star/frame/XDesktop.hpp> -+#include <com/sun/star/text/XTextDocument.hpp> -+#include <com/sun/star/container/XEnumerationAccess.hpp> -+#include <com/sun/star/frame/XComponentLoader.hpp> -+#include <com/sun/star/lang/XComponent.hpp> -+#include <com/sun/star/frame/XModel.hpp> -+#include <com/sun/star/frame/XFrame.hpp> -+#include <com/sun/star/frame/FrameSearchFlag.hpp> -+#include <com/sun/star/util/XModifiable.hpp> -+#include <com/sun/star/frame/XStorable.hpp> -+#include <com/sun/star/lang/DisposedException.hpp> -+#include <com/sun/star/beans/PropertyVetoException.hpp> -+#include <com/sun/star/util/XCloseable.hpp> -+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -+#include <com/sun/star/document/XTypeDetection.hpp> -+#include <com/sun/star/uri/XUriReference.hpp> -+#include <com/sun/star/uri/XUriReferenceFactory.hpp> -+ -+#include <sfx2/objsh.hxx> -+#include <tools/urlobj.hxx> -+ -+#include "vbaglobals.hxx" -+#include "vbadocument.hxx" -+#include "vbadocuments.hxx" -+#include <vbahelper/vbahelper.hxx> -+ -+#include <hash_map> -+#include <osl/file.hxx> -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+static uno::Any -+getDocument( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< text::XTextDocument > &xDoc, const uno::Any& aApplication ) -+{ -+ // FIXME: fine as long as SwVbaDocument is stateless ... -+ uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY ); -+ if( !xModel.is() ) -+ return uno::Any(); -+ -+ SwVbaDocument *pWb = new SwVbaDocument( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xModel ); -+ return uno::Any( uno::Reference< word::XDocument > (pWb) ); -+} -+ -+class DocumentEnumImpl : public EnumerationHelperImpl -+{ -+ uno::Any m_aApplication; -+public: -+ DocumentEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Any& aApplication ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_aApplication( aApplication ) {} -+ -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ uno::Reference< text::XTextDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); -+ return getDocument( m_xContext, xDoc, m_aApplication ); -+ } -+}; -+ -+SwVbaDocuments::SwVbaDocuments( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : SwVbaDocuments_BASE( xParent, xContext, VbaDocumentsBase::WORD_DOCUMENT ) -+{ -+} -+// XEnumerationAccess -+uno::Type -+SwVbaDocuments::getElementType() throw (uno::RuntimeException) -+{ -+ return word::XDocument::static_type(0); -+} -+uno::Reference< container::XEnumeration > -+SwVbaDocuments::createEnumeration() throw (uno::RuntimeException) -+{ -+ // #FIXME its possible the DocumentEnumImpl here doens't reflect -+ // the state of this object ( although it should ) would be -+ // safer to create an enumeration based on this objects state -+ // rather than one effectively based of the desktop component -+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); -+ return new DocumentEnumImpl( mxContext, xEnumerationAccess->createEnumeration(), Application() ); -+} -+ -+uno::Any -+SwVbaDocuments::createCollectionObject( const uno::Any& aSource ) -+{ -+ uno::Reference< text::XTextDocument > xDoc( aSource, uno::UNO_QUERY_THROW ); -+ return getDocument( mxContext, xDoc, Application() ); -+} -+ -+uno::Any SAL_CALL -+SwVbaDocuments::Add( const uno::Any& Template, const uno::Any& NewTemplate, const uno::Any& DocumentType, const uno::Any& Visible ) throw (uno::RuntimeException) -+{ -+ rtl::OUString sFileName; -+ if( Template.hasValue() && ( Template >>= sFileName ) ) -+ { -+ return Open( sFileName, uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any()); -+ } -+ uno::Reference <text::XTextDocument> xTextDoc( VbaDocumentsBase::Add() , uno::UNO_QUERY_THROW ); -+ -+ if( xTextDoc.is() ) -+ return getDocument( mxContext, xTextDoc, Application() ); -+ return uno::Any(); -+} -+ -+// #TODO# #FIXME# can any of the unused params below be used? -+void SAL_CALL -+SwVbaDocuments::Close( const uno::Any& SaveChanges, const uno::Any& OriginalFormat, const uno::Any& RouteDocument ) throw (uno::RuntimeException) -+{ -+ VbaDocumentsBase::Close(); -+} -+ -+// #TODO# #FIXME# can any of the unused params below be used? -+uno::Any SAL_CALL -+SwVbaDocuments::Open( const ::rtl::OUString& Filename, const uno::Any& ConfirmConversions, const uno::Any& ReadOnly, const uno::Any& AddToRecentFiles, const uno::Any& PasswordDocument, const uno::Any& PasswordTemplate, const uno::Any& Revert, const uno::Any& WritePasswordDocument, const uno::Any& WritePasswordTemplate, const uno::Any& Format, const uno::Any& Encoding, const uno::Any& Visible, const uno::Any& OpenAndRepair, const uno::Any& DocumentDirection, const uno::Any& NoEncodingDialog, const uno::Any& XMLTransform ) throw (uno::RuntimeException) -+{ -+ // we need to detect if this is a URL, if not then assume its a file path -+ rtl::OUString aURL; -+ INetURLObject aObj; -+ aObj.SetURL( Filename ); -+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; -+ if ( bIsURL ) -+ aURL = Filename; -+ else -+ osl::FileBase::getFileURLFromSystemPath( Filename, aURL ); -+ -+ uno::Sequence< beans::PropertyValue > sProps(0); -+ -+ uno::Reference <text::XTextDocument> xSpreadDoc( VbaDocumentsBase::Open( Filename, ReadOnly, sProps ), uno::UNO_QUERY_THROW ); -+ uno::Any aRet = getDocument( mxContext, xSpreadDoc, Application() ); -+ uno::Reference< word::XDocument > xDocument( aRet, uno::UNO_QUERY ); -+ if ( xDocument.is() ) -+ xDocument->Activate(); -+ return aRet; -+} -+ -+rtl::OUString& -+SwVbaDocuments::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocuments") ); -+ return sImplName; -+} -+ -+uno::Sequence<rtl::OUString> -+SwVbaDocuments::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > sNames; -+ if ( sNames.getLength() == 0 ) -+ { -+ sNames.realloc( 1 ); -+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Documents") ); -+ } -+ return sNames; -+} -diff --git sw/source/ui/vba/vbadocuments.hxx sw/source/ui/vba/vbadocuments.hxx -new file mode 100644 -index 0000000..e27a3c6 ---- /dev/null -+++ sw/source/ui/vba/vbadocuments.hxx -@@ -0,0 +1,65 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_DOCUMENTS_HXX -+#define SW_VBA_DOCUMENTS_HXX -+ -+ -+#include <vbahelper/vbacollectionimpl.hxx> -+#include <ooo/vba/word/XDocuments.hpp> -+#include <com/sun/star/container/XEnumerationAccess.hpp> -+#include <vbahelper/vbadocumentsbase.hxx> -+#include "wordvbahelper.hxx" -+ -+ -+typedef cppu::ImplInheritanceHelper1< VbaDocumentsBase, ov::word::XDocuments > SwVbaDocuments_BASE; -+ -+class SwVbaDocuments : public SwVbaDocuments_BASE -+{ -+public: -+ SwVbaDocuments( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ); -+ virtual ~SwVbaDocuments() {} -+ -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ -+ // SwVbaDocuments_BASE -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+ -+ // Methods -+ virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Template, const css::uno::Any& NewTemplate, const css::uno::Any& DocumentType, const css::uno::Any& Visible ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ConfirmConversions, const css::uno::Any& ReadOnly, const css::uno::Any& AddToRecentFiles, const css::uno::Any& PasswordDocument, const css::uno::Any& PasswordTemplate, const css::uno::Any& Revert, const css::uno::Any& WritePasswordDocument, const css::uno::Any& WritePasswordTemplate, const css::uno::Any& Format, const css::uno::Any& Encoding, const css::uno::Any& Visible, const css::uno::Any& OpenAndRepair, const css::uno::Any& DocumentDirection, const css::uno::Any& NoEncodingDialog, const css::uno::Any& XMLTransform ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& OriginalFormat, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException); -+ -+}; -+ -+#endif /* SW_VBA_DOCUMENTS_HXX */ -diff --git sw/source/ui/vba/vbafield.cxx sw/source/ui/vba/vbafield.cxx -new file mode 100644 -index 0000000..6effe4d ---- /dev/null -+++ sw/source/ui/vba/vbafield.cxx -@@ -0,0 +1,481 @@ -+/************************************************************************* -+ * -+ * 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 "vbafield.hxx" -+#include "vbarange.hxx" -+#include <com/sun/star/frame/XModel.hpp> -+#include <com/sun/star/text/XTextViewCursorSupplier.hpp> -+#include <com/sun/star/view/XSelectionSupplier.hpp> -+#include <com/sun/star/text/XTextFieldsSupplier.hpp> -+#include <ooo/vba/word/WdFieldType.hpp> -+#include <com/sun/star/text/FilenameDisplayFormat.hpp> -+#include <com/sun/star/util/XRefreshable.hpp> -+#include <swtypes.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+// *** SwVbaField *********************************************** -+ -+SwVbaField::SwVbaField( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextField >& xTextField) throw ( uno::RuntimeException ) : SwVbaField_BASE( rParent, rContext ), mxTextDocument( rDocument ) -+{ -+ mxTextField.set( xTextField, uno::UNO_QUERY_THROW ); -+} -+ -+// XHelperInterface -+rtl::OUString& -+SwVbaField::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaField") ); -+ return sImplName; -+} -+ -+uno::Sequence<rtl::OUString> -+SwVbaField::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Field" ) ); -+ } -+ return aServiceNames; -+} -+ -+// *** _ReadFieldParams *********************************************** -+// the codes are copied from ww8par5.cxx -+class _ReadFieldParams -+{ -+private: -+ String aData; -+ xub_StrLen nLen, nFnd, nNext, nSavPtr; -+ String aFieldName; -+public: -+ _ReadFieldParams( const String& rData ); -+ ~_ReadFieldParams(); -+ -+ xub_StrLen GoToTokenParam(); -+ long SkipToNextToken(); -+ xub_StrLen GetTokenSttPtr() const { return nFnd; } -+ -+ xub_StrLen FindNextStringPiece( xub_StrLen _nStart = STRING_NOTFOUND ); -+ bool GetTokenSttFromTo(xub_StrLen* _pFrom, xub_StrLen* _pTo, -+ xub_StrLen _nMax); -+ -+ String GetResult() const; -+ String GetFieldName()const { return aFieldName; } -+}; -+ -+ -+_ReadFieldParams::_ReadFieldParams( const String& _rData ) -+ : aData( _rData ), nLen( _rData.Len() ), nNext( 0 ) -+{ -+ /* -+ erstmal nach einer oeffnenden Klammer oder einer Leerstelle oder einem -+ Anfuehrungszeichen oder einem Backslash suchen, damit der Feldbefehl -+ (also INCLUDEPICTURE bzw EINFUeGENGRAFIK bzw ...) ueberlesen wird -+ */ -+ while( (nLen > nNext) && (aData.GetChar( nNext ) == ' ') ) -+ ++nNext; -+ -+ sal_Unicode c; -+ while( nLen > nNext -+ && (c = aData.GetChar( nNext )) != ' ' -+ && c != '"' -+ && c != '\\' -+ && c != 132 -+ && c != 0x201c ) -+ ++nNext; -+ -+ nFnd = nNext; -+ nSavPtr = nNext; -+ aFieldName = aData.Copy( 0, nFnd ); -+// cLastChar = aData.GetChar( nSavPtr ); -+} -+ -+ -+_ReadFieldParams::~_ReadFieldParams() -+{ -+// aData.SetChar( nSavPtr, cLastChar ); -+} -+ -+ -+String _ReadFieldParams::GetResult() const -+{ -+ return (STRING_NOTFOUND == nFnd) -+ ? aEmptyStr -+ : aData.Copy( nFnd, (nSavPtr - nFnd) ); -+} -+ -+ -+xub_StrLen _ReadFieldParams::GoToTokenParam() -+{ -+ xub_StrLen nOld = nNext; -+ if( -2 == SkipToNextToken() ) -+ return GetTokenSttPtr(); -+ nNext = nOld; -+ return STRING_NOTFOUND; -+} -+ -+// ret: -2: NOT a '\' parameter but normal Text -+long _ReadFieldParams::SkipToNextToken() -+{ -+ long nRet = -1; // Ende -+ if ( -+ (STRING_NOTFOUND != nNext) && (nLen > nNext) && -+ STRING_NOTFOUND != (nFnd = FindNextStringPiece(nNext)) -+ ) -+ { -+ nSavPtr = nNext; -+ -+ if ('\\' == aData.GetChar(nFnd) && '\\' != aData.GetChar(nFnd + 1)) -+ { -+ nRet = aData.GetChar(++nFnd); -+ nNext = ++nFnd; // und dahinter setzen -+ } -+ else -+ { -+ nRet = -2; -+ if ( -+ (STRING_NOTFOUND != nSavPtr ) && -+ ( -+ ('"' == aData.GetChar(nSavPtr - 1)) || -+ (0x201d == aData.GetChar(nSavPtr - 1)) -+ ) -+ ) -+ { -+ --nSavPtr; -+ } -+ } -+ } -+ return nRet; -+} -+ -+// FindNextPara sucht naechsten Backslash-Parameter oder naechste Zeichenkette -+// bis zum Blank oder naechsten "\" oder zum schliessenden Anfuehrungszeichen -+// oder zum String-Ende von pStr. -+// -+// Ausgabe ppNext (falls ppNext != 0) Suchbeginn fuer naechsten Parameter bzw. 0 -+// -+// Returnwert: 0 falls String-Ende erreicht, -+// ansonsten Anfang des Paramters bzw. der Zeichenkette -+// -+xub_StrLen _ReadFieldParams::FindNextStringPiece(const xub_StrLen nStart) -+{ -+ xub_StrLen n = ( STRING_NOTFOUND == nStart ) ? nFnd : nStart; // Anfang -+ xub_StrLen n2; // Ende -+ -+ nNext = STRING_NOTFOUND; // Default fuer nicht gefunden -+ -+ while( (nLen > n) && (aData.GetChar( n ) == ' ') ) -+ ++n; -+ -+ if( nLen == n ) -+ return STRING_NOTFOUND; // String End reached! -+ -+ if( (aData.GetChar( n ) == '"') // Anfuehrungszeichen vor Para? -+ || (aData.GetChar( n ) == 0x201c) -+ || (aData.GetChar( n ) == 132) ) -+ { -+ n++; // Anfuehrungszeichen ueberlesen -+ n2 = n; // ab hier nach Ende suchen -+ while( (nLen > n2) -+ && (aData.GetChar( n2 ) != '"') -+ && (aData.GetChar( n2 ) != 0x201d) -+ && (aData.GetChar( n2 ) != 147) ) -+ n2++; // Ende d. Paras suchen -+ } -+ else // keine Anfuehrungszeichen -+ { -+ n2 = n; // ab hier nach Ende suchen -+ while( (nLen > n2) && (aData.GetChar( n2 ) != ' ') ) // Ende d. Paras suchen -+ { -+ if( aData.GetChar( n2 ) == '\\' ) -+ { -+ if( aData.GetChar( n2+1 ) == '\\' ) -+ n2 += 2; // Doppel-Backslash -> OK -+ else -+ { -+ if( n2 > n ) -+ n2--; -+ break; // einfach-Backslash -> Ende -+ } -+ } -+ else -+ n2++; // kein Backslash -> OK -+ } -+ } -+ if( nLen > n2 ) -+ { -+ if(aData.GetChar( n2 ) != ' ') n2++; -+ nNext = n2; -+ } -+ return n; -+} -+ -+ -+ -+// read parameters "1-3" or 1-3 with both values between 1 and nMax -+bool _ReadFieldParams::GetTokenSttFromTo(USHORT* pFrom, USHORT* pTo, USHORT nMax) -+{ -+ USHORT nStart = 0; -+ USHORT nEnd = 0; -+ xub_StrLen n = GoToTokenParam(); -+ if( STRING_NOTFOUND != n ) -+ { -+ -+ String sParams( GetResult() ); -+ -+ xub_StrLen nIndex = 0; -+ String sStart( sParams.GetToken(0, '-', nIndex) ); -+ if( STRING_NOTFOUND != nIndex ) -+ { -+ nStart = static_cast<USHORT>(sStart.ToInt32()); -+ nEnd = static_cast<USHORT>(sParams.Copy(nIndex).ToInt32()); -+ } -+ } -+ if( pFrom ) *pFrom = nStart; -+ if( pTo ) *pTo = nEnd; -+ -+ return nStart && nEnd && (nMax >= nStart) && (nMax >= nEnd); -+} -+ -+// *** SwVbaFields *********************************************** -+ -+uno::Any lcl_createField( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel, const uno::Any& aSource ) -+{ -+ uno::Reference< text::XTextField > xTextField( aSource, uno::UNO_QUERY_THROW ); -+ uno::Reference< text::XTextDocument > xTextDocument( xModel, uno::UNO_QUERY_THROW ); -+ uno::Reference< word::XField > xField( new SwVbaField( xParent, xContext, xTextDocument, xTextField ) ); -+ return uno::makeAny( xField ); -+} -+ -+typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > FieldEnumeration_BASE; -+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > FieldCollectionHelper_BASE; -+ -+class FieldEnumeration : public FieldEnumeration_BASE -+{ -+ uno::Reference< XHelperInterface > mxParent; -+ uno::Reference< uno::XComponentContext > mxContext; -+ uno::Reference< frame::XModel > mxModel; -+ uno::Reference< container::XEnumeration > mxEnumeration; -+public: -+ FieldEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< container::XEnumeration >& xEnumeration ) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ), mxEnumeration( xEnumeration ) -+ { -+ } -+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -+ { -+ return mxEnumeration->hasMoreElements(); -+ } -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( !hasMoreElements() ) -+ throw container::NoSuchElementException(); -+ return lcl_createField( mxParent, mxContext, mxModel, mxEnumeration->nextElement() ); -+ } -+}; -+ -+class FieldCollectionHelper : public FieldCollectionHelper_BASE -+{ -+ uno::Reference< XHelperInterface > mxParent; -+ uno::Reference< uno::XComponentContext > mxContext; -+ uno::Reference< frame::XModel > mxModel; -+ uno::Reference< container::XEnumerationAccess > mxEnumerationAccess; -+public: -+ FieldCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) throw (css::uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ) -+ { -+ uno::Reference< text::XTextFieldsSupplier > xSupp( xModel, uno::UNO_QUERY_THROW ); -+ mxEnumerationAccess.set( xSupp->getTextFields(), uno::UNO_QUERY_THROW ); -+ } -+ // XElementAccess -+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return mxEnumerationAccess->getElementType(); } -+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return mxEnumerationAccess->hasElements(); } -+ // XIndexAccess -+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) -+ { -+ uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration(); -+ sal_Int32 nCount = 0; -+ while( xEnumeration->hasMoreElements() ) -+ { -+ ++nCount; -+ xEnumeration->nextElement(); -+ } -+ return nCount; -+ } -+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) -+ { -+ if( Index < 0 || Index >= getCount() ) -+ throw lang::IndexOutOfBoundsException(); -+ -+ uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration(); -+ sal_Int32 nCount = 0; -+ while( xEnumeration->hasMoreElements() ) -+ { -+ if( nCount == Index ) -+ { -+ return xEnumeration->nextElement(); -+ } -+ ++nCount; -+ } -+ throw lang::IndexOutOfBoundsException(); -+ } -+ // XEnumerationAccess -+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) -+ { -+ uno::Reference< container::XEnumeration > xEnumeration = mxEnumerationAccess->createEnumeration(); -+ return uno::Reference< container::XEnumeration >( new FieldEnumeration( mxParent, mxContext, mxModel, xEnumeration ) ); -+ } -+}; -+ -+SwVbaFields::SwVbaFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaFields_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new FieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel ) -+{ -+ mxMSF.set( mxModel, uno::UNO_QUERY_THROW ); -+} -+ -+uno::Reference< word::XField > SAL_CALL -+SwVbaFields::Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& Type, const css::uno::Any& Text, const css::uno::Any& /*PreserveFormatting*/ ) throw (css::uno::RuntimeException) -+{ -+ sal_Int32 nType = word::WdFieldType::wdFieldEmpty; -+ Type >>= nType; -+ rtl::OUString sText; -+ Text >>= sText; -+ -+ String sFieldName; -+ if( ( nType == word::WdFieldType::wdFieldEmpty ) && ( sText.getLength() > 0 ) ) -+ { -+ _ReadFieldParams aReadParam(sText); -+ sFieldName = aReadParam.GetFieldName(); -+ } -+ -+ uno::Reference< text::XTextContent > xTextField; -+ if( nType == word::WdFieldType::wdFieldFileName || sFieldName.EqualsIgnoreCaseAscii("FILENAME") ) -+ { -+ xTextField.set( Create_Field_FileName( sText ), uno::UNO_QUERY_THROW ); -+ } -+ else -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ } -+ -+ SwVbaRange* pVbaRange = dynamic_cast< SwVbaRange* >( Range.get() ); -+ uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange(); -+ uno::Reference< text::XText > xText = xTextRange->getText(); -+ xText->insertTextContent( xTextRange, xTextField, true ); -+ return uno::Reference< word::XField >( new SwVbaField( mxParent, mxContext, uno::Reference< text::XTextDocument >( mxModel, uno::UNO_QUERY_THROW ), uno::Reference< text::XTextField >( xTextField, uno::UNO_QUERY_THROW ) ) ); -+} -+ -+uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const rtl::OUString _text ) throw (uno::RuntimeException) -+{ -+ uno::Reference< text::XTextField > xTextField( mxMSF->createInstance( rtl::OUString::createFromAscii("com.sun.star.text.TextField.FileName") ), uno::UNO_QUERY_THROW ); -+ sal_Int16 nFileFormat = text::FilenameDisplayFormat::NAME_AND_EXT; -+ if( _text.getLength() > 0 ) -+ { -+ long nRet; -+ _ReadFieldParams aReadParam( _text ); -+ while (-1 != (nRet = aReadParam.SkipToNextToken())) -+ { -+ switch (nRet) -+ { -+ case 'p': -+ nFileFormat = text::FilenameDisplayFormat::FULL; -+ break; -+ case '*': -+ //Skip over MERGEFORMAT -+ aReadParam.SkipToNextToken(); -+ break; -+ default: -+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); -+ break; -+ } -+ } -+ } -+ -+ uno::Reference< beans::XPropertySet > xProps( xTextField, uno::UNO_QUERY_THROW ); -+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FileFormat") ), uno::makeAny( nFileFormat ) ); -+ -+ return xTextField; -+} -+ -+uno::Reference< container::XEnumeration > SAL_CALL -+SwVbaFields::createEnumeration() throw (uno::RuntimeException) -+{ -+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); -+ return xEnumerationAccess->createEnumeration(); -+} -+ -+// ScVbaCollectionBaseImpl -+uno::Any -+SwVbaFields::createCollectionObject( const uno::Any& aSource ) -+{ -+ return lcl_createField( mxParent, mxContext, mxModel, aSource ); -+} -+ -+sal_Int32 SAL_CALL SwVbaFields::Update() throw (uno::RuntimeException) -+{ -+ sal_Int32 nUpdate = 1; -+ try -+ { -+ uno::Reference< text::XTextFieldsSupplier > xSupp( mxModel, uno::UNO_QUERY_THROW ); -+ uno::Reference< util::XRefreshable > xRef( xSupp->getTextFields(), uno::UNO_QUERY_THROW ); -+ xRef->refresh(); -+ nUpdate = 0; -+ }catch( uno::Exception ) -+ { -+ nUpdate = 1; -+ } -+ return nUpdate; -+} -+ -+// XHelperInterface -+rtl::OUString& -+SwVbaFields::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFields") ); -+ return sImplName; -+} -+ -+// XEnumerationAccess -+uno::Type SAL_CALL -+SwVbaFields::getElementType() throw (uno::RuntimeException) -+{ -+ return word::XField::static_type(0); -+} -+ -+uno::Sequence<rtl::OUString> -+SwVbaFields::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Fields" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbafield.hxx sw/source/ui/vba/vbafield.hxx -new file mode 100644 -index 0000000..20d0499 ---- /dev/null -+++ sw/source/ui/vba/vbafield.hxx -@@ -0,0 +1,80 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_FIELD_HXX -+#define SW_VBA_FIELD_HXX -+#include <vbahelper/vbahelperinterface.hxx> -+#include <com/sun/star/text/XTextDocument.hpp> -+#include <com/sun/star/text/XTextField.hpp> -+#include <ooo/vba/word/XField.hpp> -+#include <ooo/vba/word/XFields.hpp> -+#include <vbahelper/vbacollectionimpl.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XField > SwVbaField_BASE; -+ -+class SwVbaField : public SwVbaField_BASE -+{ -+ css::uno::Reference< css::text::XTextDocument > mxTextDocument; -+ css::uno::Reference< css::text::XTextField > mxTextField; -+public: -+ SwVbaField( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextField >& xTextField) throw ( css::uno::RuntimeException);; -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+// *** SwVbaFields *********************************************** -+ -+typedef CollTestImplHelper< ov::word::XFields > SwVbaFields_BASE; -+ -+class SwVbaFields : public SwVbaFields_BASE -+{ -+ css::uno::Reference< css::frame::XModel > mxModel; -+ css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF; -+private: -+ css::uno::Reference< css::text::XTextField > Create_Field_FileName( const rtl::OUString _text ) throw (css::uno::RuntimeException); -+ -+public: -+ SwVbaFields( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ); -+ // XFields -+ virtual css::uno::Reference< ::ooo::vba::word::XField > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& Type, const css::uno::Any& Text, const css::uno::Any& PreserveFormatting ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL Update() throw (css::uno::RuntimeException); -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ // ScVbaCollectionBaseImpl -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif -diff --git sw/source/ui/vba/vbafind.cxx sw/source/ui/vba/vbafind.cxx -new file mode 100644 -index 0000000..22d9a1f ---- /dev/null -+++ sw/source/ui/vba/vbafind.cxx -@@ -0,0 +1,431 @@ -+/************************************************************************* -+ * -+ * 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 "vbafind.hxx" -+#include <vbahelper/vbahelper.hxx> -+#include <tools/diagnose_ex.h> -+#include "vbareplacement.hxx" -+#include <ooo/vba/word/WdFindWrap.hpp> -+#include <ooo/vba/word/WdReplace.hpp> -+#include <com/sun/star/text/XTextRangeCompare.hpp> -+#include "wordvbahelper.hxx" -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+SwVbaFind::SwVbaFind( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) : -+ SwVbaFind_BASE( rParent, rContext ), mxModel( xModel ), mxTextRange( xTextRange ), mbReplace( sal_False ), mnReplaceType( word::WdReplace::wdReplaceOne ), mnWrap( word::WdFindWrap::wdFindStop ) -+{ -+ mxReplaceable.set( mxModel, uno::UNO_QUERY_THROW ); -+ mxPropertyReplace.set( mxReplaceable->createReplaceDescriptor(), uno::UNO_QUERY_THROW ); -+ mxTVC = word::getXTextViewCursor( mxModel ); -+ mxSelSupp.set( mxModel->getCurrentController(), uno::UNO_QUERY_THROW ); -+} -+ -+SwVbaFind::~SwVbaFind() -+{ -+} -+ -+sal_Bool SwVbaFind::InRange( const uno::Reference< text::XTextRange >& xCurrentRange ) throw ( uno::RuntimeException ) -+{ -+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextRange->getText(), uno::UNO_QUERY_THROW ); -+ if( xTRC->compareRegionStarts( mxTextRange, xCurrentRange ) >= 0 && xTRC->compareRegionEnds( mxTextRange, xCurrentRange ) <= 0 ) -+ return sal_True; -+ return sal_False; -+} -+ -+sal_Bool SwVbaFind::InEqualRange( const uno::Reference< text::XTextRange >& xCurrentRange ) throw ( uno::RuntimeException ) -+{ -+ uno::Reference< text::XTextRangeCompare > xTRC( mxTextRange->getText(), uno::UNO_QUERY_THROW ); -+ if( xTRC->compareRegionStarts( mxTextRange, xCurrentRange ) == 0 && xTRC->compareRegionEnds( mxTextRange, xCurrentRange ) == 0 ) -+ return sal_True; -+ return sal_False; -+} -+ -+void SwVbaFind::SetReplaceWith( const rtl::OUString& rText ) throw (uno::RuntimeException) -+{ -+ mxPropertyReplace->setReplaceString( rText ); -+ mbReplace = sal_True; -+} -+ -+rtl::OUString SwVbaFind::GetReplaceWith() throw (uno::RuntimeException) -+{ -+ return mxPropertyReplace->getReplaceString(); -+} -+void SwVbaFind::SetReplace( sal_Int32 type ) -+{ -+ mnReplaceType = type; -+ mbReplace = sal_True; -+} -+ -+rtl::OUString SwVbaFind::ReplaceWildcards( const rtl::OUString& rText ) throw ( uno::RuntimeException ) -+{ -+ // TODO: -+ return rtl::OUString(); -+} -+ -+uno::Reference< text::XTextRange > SwVbaFind::FindOneElement() throw ( uno::RuntimeException ) -+{ -+ uno::Reference< text::XTextRange > xFoundOne; -+ if( mxTVC->getString().getLength() > 0 ) -+ { -+ if( getForward() ) -+ { -+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getStart(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); -+ } -+ else -+ { -+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getEnd(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); -+ } -+ -+ if( xFoundOne.is() && InEqualRange( xFoundOne ) ) -+ { -+ xFoundOne.set( mxReplaceable->findNext( xFoundOne, uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); -+ } -+ else if( xFoundOne.is() && !InRange( xFoundOne ) ) -+ { -+ xFoundOne = uno::Reference< text::XTextRange >(); -+ } -+ } -+ else -+ { -+ xFoundOne.set( mxReplaceable->findNext( mxTextRange, uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); -+ } -+ -+ if( !xFoundOne.is() && ( getWrap() == word::WdFindWrap::wdFindContinue || getWrap() == word::WdFindWrap::wdFindAsk ) ) -+ { -+ if( getForward() ) -+ { -+ mxTVC->gotoStart(sal_False); -+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getStart(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); -+ } -+ else -+ { -+ mxTVC->gotoEnd( sal_False ); -+ xFoundOne.set( mxReplaceable->findNext( mxTextRange->getEnd(), uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ), uno::UNO_QUERY ); -+ -+ } -+ } -+ return xFoundOne; -+} -+ -+sal_Bool SwVbaFind::SearchReplace() throw (uno::RuntimeException) -+{ -+ sal_Bool result = sal_False; -+ -+ // TODO: map wildcards in area to OOo wildcards -+ -+ if( mbReplace ) -+ { -+ switch( mnReplaceType ) -+ { -+ case word::WdReplace::wdReplaceNone: -+ { -+ result = sal_True; -+ break; -+ } -+ case word::WdReplace::wdReplaceOne: -+ { -+ uno::Reference< text::XTextRange > xFindOne = FindOneElement(); -+ if( xFindOne.is() ) -+ { -+ xFindOne->setString( GetReplaceWith() ); -+ result = mxSelSupp->select( uno::makeAny( xFindOne ) ); -+ } -+ break; -+ } -+ case word::WdReplace::wdReplaceAll: -+ { -+ uno::Reference< container::XIndexAccess > xIndexAccess = mxReplaceable->findAll( uno::Reference< util::XSearchDescriptor >( mxPropertyReplace, uno::UNO_QUERY_THROW ) ); -+ if( xIndexAccess->getCount() > 0 ) -+ { -+ for( sal_Int32 i = 0; i < xIndexAccess->getCount(); i++ ) -+ { -+ uno::Reference< text::XTextRange > xTextRange( xIndexAccess->getByIndex( i ), uno::UNO_QUERY_THROW ); -+ if( mnWrap == word::WdFindWrap::wdFindContinue || mnWrap == word::WdFindWrap::wdFindAsk || InRange( xTextRange ) ) -+ { -+ xTextRange->setString( GetReplaceWith() ); -+ result = sal_True; -+ } -+ } -+ } -+ break; -+ } -+ defalut: -+ { -+ result = sal_False; -+ } -+ } -+ } -+ else -+ { -+ uno::Reference< text::XTextRange > xFindOne = FindOneElement(); -+ if( xFindOne.is() ) -+ result = mxSelSupp->select( uno::makeAny( xFindOne ) ); -+ } -+ -+ return result; -+} -+ -+::rtl::OUString SAL_CALL SwVbaFind::getText() throw (uno::RuntimeException) -+{ -+ return mxPropertyReplace->getSearchString(); -+} -+ -+void SAL_CALL SwVbaFind::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException) -+{ -+ mxPropertyReplace->setSearchString( _text ); -+} -+ -+uno::Any SAL_CALL SwVbaFind::getReplacement() throw (uno::RuntimeException) -+{ -+ return uno::makeAny( uno::Reference< word::XReplacement >( new SwVbaReplacement( this, mxContext, mxPropertyReplace ) ) ); -+} -+ -+void SAL_CALL SwVbaFind::setReplacement( const uno::Any& /*_replacement */ ) throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+::sal_Bool SAL_CALL SwVbaFind::getForward() throw (uno::RuntimeException) -+{ -+ sal_Bool bBackward = sal_False; -+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchBackwards") ) ) >>= bBackward; -+ return !bBackward; -+} -+ -+void SAL_CALL SwVbaFind::setForward( ::sal_Bool _forward ) throw (uno::RuntimeException) -+{ -+ sal_Bool bBackward = !_forward; -+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchBackwards") ), uno::makeAny( bBackward ) ); -+} -+ -+::sal_Int32 SAL_CALL SwVbaFind::getWrap() throw (uno::RuntimeException) -+{ -+ // seems not supported in Writer -+ return mnWrap; -+} -+ -+void SAL_CALL SwVbaFind::setWrap( ::sal_Int32 _wrap ) throw (uno::RuntimeException) -+{ -+ // seems not supported in Writer -+ mnWrap = _wrap; -+} -+ -+::sal_Bool SAL_CALL SwVbaFind::getFormat() throw (uno::RuntimeException) -+{ -+ return mxPropertyReplace->getValueSearch(); -+} -+ -+void SAL_CALL SwVbaFind::setFormat( ::sal_Bool _format ) throw (uno::RuntimeException) -+{ -+ mxPropertyReplace->setValueSearch( _format ); -+} -+ -+::sal_Bool SAL_CALL SwVbaFind::getMatchCase() throw (uno::RuntimeException) -+{ -+ sal_Bool value = sal_False; -+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchCaseSensitive") ) ) >>= value; -+ return value; -+} -+ -+void SAL_CALL SwVbaFind::setMatchCase( ::sal_Bool _matchcase ) throw (uno::RuntimeException) -+{ -+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchCaseSensitive") ), uno::makeAny( _matchcase ) ); -+} -+ -+::sal_Bool SAL_CALL SwVbaFind::getMatchWholeWord() throw (uno::RuntimeException) -+{ -+ sal_Bool value = sal_False; -+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchWords") ) ) >>= value; -+ return value; -+} -+ -+void SAL_CALL SwVbaFind::setMatchWholeWord( ::sal_Bool _matchwholeword ) throw (uno::RuntimeException) -+{ -+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchWords") ), uno::makeAny( _matchwholeword ) ); -+} -+ -+::sal_Bool SAL_CALL SwVbaFind::getMatchWildcards() throw (uno::RuntimeException) -+{ -+ sal_Bool value = sal_False; -+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchRegularExpression") ) ) >>= value; -+ return value; -+} -+ -+void SAL_CALL SwVbaFind::setMatchWildcards( ::sal_Bool _matchwildcards ) throw (uno::RuntimeException) -+{ -+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchRegularExpression") ), uno::makeAny( _matchwildcards ) ); -+} -+ -+::sal_Bool SAL_CALL SwVbaFind::getMatchSoundsLike() throw (uno::RuntimeException) -+{ -+ sal_Bool value = sal_False; -+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ) ) >>= value; -+ return value; -+} -+ -+void SAL_CALL SwVbaFind::setMatchSoundsLike( ::sal_Bool _matchsoundslike ) throw (uno::RuntimeException) -+{ -+ // seems not accurate -+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ), uno::makeAny( _matchsoundslike ) ); -+} -+ -+::sal_Bool SAL_CALL SwVbaFind::getMatchAllWordForms() throw (uno::RuntimeException) -+{ -+ sal_Bool value = sal_False; -+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ) ) >>= value; -+ if( value ) -+ mxPropertyReplace->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarityRelax") ) ) >>= value; -+ return value; -+} -+ -+void SAL_CALL SwVbaFind::setMatchAllWordForms( ::sal_Bool _matchallwordforms ) throw (uno::RuntimeException) -+{ -+ // seems not accurate -+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarity") ), uno::makeAny( _matchallwordforms ) ); -+ mxPropertyReplace->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SearchSimilarityRelax") ), uno::makeAny( _matchallwordforms ) ); -+} -+ -+uno::Any SAL_CALL SwVbaFind::getStyle() throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+void SAL_CALL SwVbaFind::setStyle( const uno::Any& /*_style */ ) throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+sal_Bool SAL_CALL -+SwVbaFind::Execute( const uno::Any& FindText, const uno::Any& MatchCase, const uno::Any& MatchWholeWord, const uno::Any& MatchWildcards, const uno::Any& MatchSoundsLike, const uno::Any& MatchAllWordForms, const uno::Any& Forward, const uno::Any& Wrap, const uno::Any& Format, const uno::Any& ReplaceWith, const uno::Any& Replace, const uno::Any& /*MatchKashida*/, const uno::Any& /*MatchDiacritics*/, const uno::Any& /*MatchAlefHamza*/, const uno::Any& /*MatchControl*/, const uno::Any& /*MatchPrefix*/, const uno::Any& /*MatchSuffix*/, const uno::Any& /*MatchPhrase*/, const uno::Any& /*IgnoreSpace*/, const uno::Any& /*IgnorePunct*/ ) throw (uno::RuntimeException) -+{ -+ sal_Bool result = sal_False; -+ if( FindText.hasValue() ) -+ { -+ rtl::OUString sText; -+ FindText >>= sText; -+ setText( sText ); -+ } -+ -+ sal_Bool bValue = sal_False; -+ if( MatchCase.hasValue() ) -+ { -+ MatchCase >>= bValue; -+ setMatchCase( bValue ); -+ } -+ -+ if( MatchWholeWord.hasValue() ) -+ { -+ MatchWholeWord >>= bValue; -+ setMatchWholeWord( bValue ); -+ } -+ -+ if( MatchWildcards.hasValue() ) -+ { -+ MatchWildcards >>= bValue; -+ setMatchWildcards( bValue ); -+ } -+ -+ if( MatchSoundsLike.hasValue() ) -+ { -+ MatchSoundsLike >>= bValue; -+ setMatchSoundsLike( bValue ); -+ } -+ -+ if( MatchAllWordForms.hasValue() ) -+ { -+ MatchAllWordForms >>= bValue; -+ setMatchAllWordForms( bValue ); -+ } -+ -+ if( Forward.hasValue() ) -+ { -+ Forward >>= bValue; -+ setForward( bValue ); -+ } -+ -+ if( Wrap.hasValue() ) -+ { -+ sal_Int32 nWrapType = 0; -+ Wrap >>= nWrapType; -+ setWrap( nWrapType ); -+ } -+ -+ if( Format.hasValue() ) -+ { -+ Format >>= bValue; -+ setFormat( bValue ); -+ } -+ -+ if( ReplaceWith.hasValue() ) -+ { -+ rtl::OUString sValue; -+ ReplaceWith >>= sValue; -+ SetReplaceWith( sValue ); -+ } -+ -+ if( Replace.hasValue() ) -+ { -+ sal_Int32 nValue; -+ Replace >>= nValue; -+ SetReplace( nValue ); -+ } -+ -+ result = SearchReplace(); -+ -+ return result; -+} -+ -+void SAL_CALL -+SwVbaFind::ClearFormatting( ) throw (uno::RuntimeException) -+{ -+ uno::Sequence< beans::PropertyValue > aSearchAttribs; -+ mxPropertyReplace->setSearchAttributes( aSearchAttribs ); -+} -+ -+rtl::OUString& -+SwVbaFind::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFind") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaFind::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Find" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbafind.hxx sw/source/ui/vba/vbafind.hxx -new file mode 100644 -index 0000000..76988ca ---- /dev/null -+++ sw/source/ui/vba/vbafind.hxx -@@ -0,0 +1,104 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_FIND_HXX -+#define SW_VBA_FIND_HXX -+ -+#include <ooo/vba/word/XFind.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <cppuhelper/implbase1.hxx> -+#include <com/sun/star/text/XTextRange.hpp> -+#include <com/sun/star/util/XReplaceable.hpp> -+#include <com/sun/star/util/XPropertyReplace.hpp> -+#include <com/sun/star/text/XTextViewCursor.hpp> -+#include <com/sun/star/text/XTextCursor.hpp> -+#include <com/sun/star/view/XSelectionSupplier.hpp> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XFind > SwVbaFind_BASE; -+ -+class SwVbaFind : public SwVbaFind_BASE -+{ -+private: -+ css::uno::Reference< css::frame::XModel > mxModel; -+ css::uno::Reference< css::text::XTextRange > mxTextRange; -+ css::uno::Reference< css::util::XReplaceable > mxReplaceable; -+ css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace; -+ css::uno::Reference< css::text::XTextViewCursor> mxTVC; -+ css::uno::Reference< css::view::XSelectionSupplier> mxSelSupp; -+ sal_Bool mbReplace; -+ sal_Int32 mnReplaceType; -+ sal_Int32 mnWrap; -+ -+private: -+ sal_Bool InRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange ) throw ( css::uno::RuntimeException ); -+ sal_Bool InEqualRange( const css::uno::Reference< css::text::XTextRange >& xCurrentRange ) throw ( css::uno::RuntimeException ); -+ void SetReplace( sal_Int32 type ); -+ void SetReplaceWith( const rtl::OUString& rText ) throw ( css::uno::RuntimeException ); -+ rtl::OUString GetReplaceWith() throw ( css::uno::RuntimeException ); -+ rtl::OUString ReplaceWildcards( const rtl::OUString& rText ) throw ( css::uno::RuntimeException ); -+ css::uno::Reference< css::text::XTextRange > FindOneElement() throw ( css::uno::RuntimeException ); -+ sal_Bool SearchReplace() throw ( css::uno::RuntimeException ); -+ -+public: -+ SwVbaFind( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException ); -+ virtual ~SwVbaFind(); -+ -+ // Attributes -+ virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getReplacement() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setReplacement( const css::uno::Any& _replacement ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getForward() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setForward( ::sal_Bool _forward ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getWrap() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setWrap( ::sal_Int32 _wrap ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getFormat() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setFormat( ::sal_Bool _format ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getMatchCase() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMatchCase( ::sal_Bool _matchcase ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getMatchWholeWord() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMatchWholeWord( ::sal_Bool _matchwholeword ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getMatchWildcards() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMatchWildcards( ::sal_Bool _matchwildcards ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getMatchSoundsLike() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMatchSoundsLike( ::sal_Bool _matchsoundslike ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getMatchAllWordForms() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMatchAllWordForms( ::sal_Bool _matchallwordforms ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getStyle() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setStyle( const css::uno::Any& _style ) throw (css::uno::RuntimeException); -+ -+ // Methods -+ virtual ::sal_Bool SAL_CALL Execute( const css::uno::Any& FindText, const css::uno::Any& MatchCase, const css::uno::Any& MatchWholeWord, const css::uno::Any& MatchWildcards, const css::uno::Any& MatchSoundsLike, const css::uno::Any& MatchAllWordForms, const css::uno::Any& Forward, const css::uno::Any& Wrap, const css::uno::Any& Format, const css::uno::Any& ReplaceWith, const css::uno::Any& Replace, const css::uno::Any& MatchKashida, const css::uno::Any& MatchDiacritics, const css::uno::Any& MatchAlefHamza, const css::uno::Any& MatchControl, const css::uno::Any& MatchPrefix, const css::uno::Any& MatchSuffix, const css::uno::Any& MatchPhrase, const css::uno::Any& IgnoreSpace, const css::uno::Any& IgnorePunct ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL ClearFormatting( ) throw (css::uno::RuntimeException); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+#endif /* SW_VBA_FIND_HXX */ -diff --git sw/source/ui/vba/vbafont.cxx sw/source/ui/vba/vbafont.cxx -new file mode 100644 -index 0000000..58fe73e ---- /dev/null -+++ sw/source/ui/vba/vbafont.cxx -@@ -0,0 +1,216 @@ -+#include "vbafont.hxx" -+#include <com/sun/star/awt/FontUnderline.hpp> -+#include <ooo/vba/word/WdUnderline.hpp> -+#include <hash_map> -+#include <ooo/vba/word/WdColorIndex.hpp> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+const uno::Any aLongAnyTrue( sal_Int16(-1) ); -+const uno::Any aLongAnyFalse( sal_Int16( 0 ) ); -+ -+struct MapPair -+{ -+ sal_Int32 nMSOConst; -+ sal_Int32 nOOOConst; -+}; -+ -+static MapPair UnderLineTable[] = { -+ { word::WdUnderline::wdUnderlineNone, com::sun::star::awt::FontUnderline::NONE }, -+ { word::WdUnderline::wdUnderlineSingle, com::sun::star::awt::FontUnderline::SINGLE }, -+ { word::WdUnderline::wdUnderlineWords, com::sun::star::awt::FontUnderline::SINGLE }, -+ { word::WdUnderline::wdUnderlineDouble, com::sun::star::awt::FontUnderline::DOUBLE }, -+ { word::WdUnderline::wdUnderlineDotted, com::sun::star::awt::FontUnderline::DOTTED }, -+ { word::WdUnderline::wdUnderlineThick, com::sun::star::awt::FontUnderline::BOLDDASH }, -+ { word::WdUnderline::wdUnderlineDash, com::sun::star::awt::FontUnderline::DASH }, -+ { word::WdUnderline::wdUnderlineDotDash, com::sun::star::awt::FontUnderline::DASHDOT }, -+ { word::WdUnderline::wdUnderlineDotDotDash, com::sun::star::awt::FontUnderline::DASHDOTDOT }, -+ { word::WdUnderline::wdUnderlineWavy, com::sun::star::awt::FontUnderline::WAVE }, -+ { word::WdUnderline::wdUnderlineDottedHeavy, com::sun::star::awt::FontUnderline::BOLDDOTTED }, -+ { word::WdUnderline::wdUnderlineDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASH }, -+ { word::WdUnderline::wdUnderlineDotDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASHDOT }, -+ { word::WdUnderline::wdUnderlineDotDotDashHeavy, com::sun::star::awt::FontUnderline::BOLDDASHDOTDOT }, -+ { word::WdUnderline::wdUnderlineWavyHeavy, com::sun::star::awt::FontUnderline::BOLDWAVE }, -+ { word::WdUnderline::wdUnderlineDashLong, com::sun::star::awt::FontUnderline::LONGDASH }, -+ { word::WdUnderline::wdUnderlineWavyDouble, com::sun::star::awt::FontUnderline::DOUBLEWAVE }, -+ { word::WdUnderline::wdUnderlineDashLongHeavy, com::sun::star::awt::FontUnderline::BOLDLONGDASH }, -+}; -+ -+typedef std::hash_map< sal_Int32, sal_Int32 > ConstToConst; -+class UnderLineMapper -+{ -+ ConstToConst MSO2OOO; -+ ConstToConst OOO2MSO; -+private: -+ UnderLineMapper() -+ { -+ sal_Int32 nLen = sizeof( UnderLineTable )/ sizeof( UnderLineTable[0] ); -+ -+ for ( sal_Int32 index=0; index<nLen; ++index ) -+ { -+ MSO2OOO[ UnderLineTable[ index ].nMSOConst ] = UnderLineTable[ index ].nOOOConst; -+ OOO2MSO[ UnderLineTable[ index ].nOOOConst ] = UnderLineTable[ index ].nMSOConst; -+ } -+ } -+public: -+ static rtl::OUString propName() -+ { -+ static rtl::OUString sPropName( RTL_CONSTASCII_USTRINGPARAM("CharUnderline") ); -+ return sPropName; -+ } -+ -+ static UnderLineMapper& instance() -+ { -+ static UnderLineMapper theMapper; -+ return theMapper; -+ } -+ -+ sal_Int32 getOOOFromMSO( sal_Int32 nMSOConst ) throw( lang::IllegalArgumentException ) -+ { -+ ConstToConst::iterator it = MSO2OOO.find( nMSOConst ); -+ if ( it == MSO2OOO.end() ) -+ throw lang::IllegalArgumentException(); -+ return it->second; -+ } -+ sal_Int32 getMSOFromOOO( sal_Int32 nOOOConst ) throw( lang::IllegalArgumentException ) -+ { -+ ConstToConst::iterator it = OOO2MSO.find( nOOOConst ); -+ if ( it == OOO2MSO.end() ) -+ throw lang::IllegalArgumentException(); -+ return it->second; -+ } -+}; -+ -+SwVbaFont::SwVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPalette, uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException ) : SwVbaFont_BASE( xParent, xContext, xPalette, xPropertySet ) -+{ -+} -+ -+uno::Any SAL_CALL -+SwVbaFont::getUnderline() throw (uno::RuntimeException) -+{ -+ sal_Int32 nOOVal = 0; -+ mxFont->getPropertyValue( UnderLineMapper::propName() ) >>= nOOVal; -+ return uno::makeAny( UnderLineMapper::instance().getMSOFromOOO( nOOVal ) ); -+} -+ -+void SAL_CALL -+SwVbaFont::setUnderline( const uno::Any& _underline ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nMSOVal = 0; -+ -+ if ( _underline >>= nMSOVal ) -+ { -+ sal_Int32 nOOVal = UnderLineMapper::instance().getOOOFromMSO( nMSOVal ); -+ mxFont->setPropertyValue( UnderLineMapper::propName(), uno::makeAny( nOOVal ) ); -+ } -+} -+ -+rtl::OUString& -+SwVbaFont::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaFont") ); -+ return sImplName; -+} -+ -+void SAL_CALL -+SwVbaFont::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeException ) -+{ -+ sal_Int32 nIndex = 0; -+ _colorindex >>= nIndex; -+ return setColor( OORGBToXLRGB(mxPalette->getByIndex( nIndex )) ); -+} -+ -+uno::Any SAL_CALL -+SwVbaFont::getColorIndex() throw ( uno::RuntimeException ) -+{ -+ sal_Int32 nColor = 0; -+ -+ XLRGBToOORGB( getColor() ) >>= nColor; -+ sal_Int32 nElems = mxPalette->getCount(); -+ sal_Int32 nIndex = 0; -+ for ( sal_Int32 count=0; count<nElems; ++count ) -+ { -+ sal_Int32 nPaletteColor = 0; -+ mxPalette->getByIndex( count ) >>= nPaletteColor; -+ if ( nPaletteColor == nColor ) -+ { -+ nIndex = count; -+ break; -+ } -+ } -+ return uno::makeAny( nIndex ); -+} -+uno::Any SAL_CALL -+SwVbaFont::getSubscript() throw ( uno::RuntimeException ) -+{ -+ sal_Bool bRes = sal_False; -+ SwVbaFont_BASE::getSubscript() >>= bRes; -+ if ( bRes ) -+ return aLongAnyTrue; -+ return aLongAnyFalse; -+} -+ -+uno::Any SAL_CALL -+SwVbaFont::getSuperscript() throw ( uno::RuntimeException ) -+{ -+ sal_Bool bRes = sal_False; -+ SwVbaFont_BASE::getSuperscript() >>= bRes; -+ if ( bRes ) -+ return aLongAnyTrue; -+ return aLongAnyFalse; -+} -+ -+uno::Any SAL_CALL -+SwVbaFont::getBold() throw (uno::RuntimeException) -+{ -+ sal_Bool bRes = sal_False; -+ SwVbaFont_BASE::getBold() >>= bRes; -+ if ( bRes ) -+ return aLongAnyTrue; -+ return aLongAnyFalse; -+} -+ -+uno::Any SAL_CALL -+SwVbaFont::getItalic() throw (uno::RuntimeException) -+{ -+ sal_Bool bRes = sal_False; -+ SwVbaFont_BASE::getItalic() >>= bRes; -+ if ( bRes ) -+ return aLongAnyTrue; -+ return aLongAnyFalse; -+} -+ -+uno::Any SAL_CALL -+SwVbaFont::getStrikethrough() throw (css::uno::RuntimeException) -+{ -+ sal_Bool bRes = sal_False; -+ SwVbaFont_BASE::getStrikethrough() >>= bRes; -+ if ( bRes ) -+ return aLongAnyTrue; -+ return aLongAnyFalse; -+} -+ -+uno::Any SAL_CALL -+SwVbaFont::getShadow() throw (uno::RuntimeException) -+{ -+ sal_Bool bRes = sal_False; -+ SwVbaFont_BASE::getShadow() >>= bRes; -+ if ( bRes ) -+ return aLongAnyTrue; -+ return aLongAnyFalse; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaFont::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Font" ) ); -+ } -+ return aServiceNames; -+} -+ -+ -diff --git sw/source/ui/vba/vbafont.hxx sw/source/ui/vba/vbafont.hxx -new file mode 100644 -index 0000000..85262ac ---- /dev/null -+++ sw/source/ui/vba/vbafont.hxx -@@ -0,0 +1,31 @@ -+#ifndef VBA_FONT_HXX -+#define VBA_FONT_HXX -+ -+#include <vbahelper/vbafontbase.hxx> -+#include <ooo/vba/word/XFont.hpp> -+ -+typedef cppu::ImplInheritanceHelper1< VbaFontBase, ov::word::XFont > SwVbaFont_BASE; -+ -+class SwVbaFont : public SwVbaFont_BASE -+{ -+public: -+ SwVbaFont( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException ); -+ virtual ~SwVbaFont(){} -+ -+ // Attributes -+ virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getUnderline() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getSubscript() throw ( css::uno::RuntimeException ); -+ virtual css::uno::Any SAL_CALL getSuperscript() throw ( css::uno::RuntimeException ); -+ -+ virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException); -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+#endif -diff --git sw/source/ui/vba/vbaglobals.cxx sw/source/ui/vba/vbaglobals.cxx -index 38818fa..acf6b06 100644 ---- sw/source/ui/vba/vbaglobals.cxx -+++ sw/source/ui/vba/vbaglobals.cxx -@@ -105,12 +105,35 @@ SwVbaGlobals::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException - return getApplication()->CommandBars( aIndex ); - } - -+uno::Any SAL_CALL -+SwVbaGlobals::Documents( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ return getApplication()->Documents( index ); -+} -+ -+uno::Any SAL_CALL -+SwVbaGlobals::Addins( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ return getApplication()->Addins( index ); -+} -+ -+uno::Any SAL_CALL -+SwVbaGlobals::Dialogs( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ return getApplication()->Dialogs( index ); -+} -+ - uno::Reference<word::XSelection > SAL_CALL - SwVbaGlobals::getSelection() throw (uno::RuntimeException) - { - return getApplication()->getSelection(); - } - -+float SAL_CALL SwVbaGlobals::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException) -+{ -+ return getApplication()->CentimetersToPoints( _Centimeters ); -+} -+ - rtl::OUString& - SwVbaGlobals::getServiceImplName() - { -diff --git sw/source/ui/vba/vbaglobals.hxx sw/source/ui/vba/vbaglobals.hxx -index 5c216b1..267b1ed 100644 ---- sw/source/ui/vba/vbaglobals.hxx -+++ sw/source/ui/vba/vbaglobals.hxx -@@ -38,7 +38,6 @@ - #include <ooo/vba/word/XSystem.hpp> - #include <ooo/vba/word/XOptions.hpp> - #include <ooo/vba/word/XSelection.hpp> -- - #include <cppuhelper/implbase1.hxx> - #include <vbahelper/vbahelper.hxx> - #include <vbahelper/vbaglobalbase.hxx> -@@ -70,6 +69,10 @@ public: - virtual css::uno::Reference< ooo::vba::word::XOptions > SAL_CALL getOptions() throw (css::uno::RuntimeException); - virtual css::uno::Reference< ooo::vba::word::XSelection > SAL_CALL getSelection() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Documents( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Addins( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException); - // XMultiServiceFactory - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw (css::uno::RuntimeException); - -diff --git sw/source/ui/vba/vbaheaderfooter.cxx sw/source/ui/vba/vbaheaderfooter.cxx -new file mode 100644 -index 0000000..c1eb4ec ---- /dev/null -+++ sw/source/ui/vba/vbaheaderfooter.cxx -@@ -0,0 +1,114 @@ -+/************************************************************************* -+ * -+ * 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 "vbaheaderfooter.hxx" -+#include <vbahelper/vbahelper.hxx> -+#include <tools/diagnose_ex.h> -+#include <ooo/vba/word/WdHeaderFooterIndex.hpp> -+#include <com/sun/star/text/XText.hpp> -+#include <com/sun/star/text/XTextDocument.hpp> -+#include <com/sun/star/drawing/XDrawPageSupplier.hpp> -+#include "vbarange.hxx" -+#include <vbahelper/vbashapes.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+SwVbaHeaderFooter::SwVbaHeaderFooter( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rProps, sal_Bool isHeader, sal_Int32 index ) throw ( uno::RuntimeException ) : SwVbaHeaderFooter_BASE( rParent, rContext ), mxModel( xModel ), mxPageStyleProps( rProps ), mbHeader( isHeader ), mnIndex( index ) -+{ -+} -+ -+sal_Bool SAL_CALL SwVbaHeaderFooter::getIsHeader() throw (uno::RuntimeException) -+{ -+ return mbHeader; -+} -+ -+sal_Bool SAL_CALL SwVbaHeaderFooter::getLinkToPrevious() throw (uno::RuntimeException) -+{ -+ // seems always false -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaHeaderFooter::setLinkToPrevious( ::sal_Bool _linktoprevious ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno::RuntimeException) -+{ -+ rtl::OUString sPropsNameText; -+ if( mbHeader ) -+ { -+ sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") ); -+ } -+ else -+ { -+ sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") ); -+ } -+ if( mnIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages ) -+ { -+ sPropsNameText.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Left") ) ); -+ } -+ -+ uno::Reference< text::XText > xText( mxPageStyleProps->getPropertyValue( sPropsNameText ), uno::UNO_QUERY_THROW ); -+ uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW ); -+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xText->getStart(), xText->getEnd(), xText ) ); -+} -+ -+uno::Any SAL_CALL -+SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW ); -+ //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); -+ uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+rtl::OUString& -+SwVbaHeaderFooter::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaHeaderFooter") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaHeaderFooter::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Pane" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbaheaderfooter.hxx sw/source/ui/vba/vbaheaderfooter.hxx -new file mode 100644 -index 0000000..4715994 ---- /dev/null -+++ sw/source/ui/vba/vbaheaderfooter.hxx -@@ -0,0 +1,63 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_HEADERFOOTER_HXX -+#define SW_VBA_HEADERFOOTER_HXX -+ -+#include <ooo/vba/word/XHeaderFooter.hpp> -+#include <ooo/vba/word/XRange.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <cppuhelper/implbase1.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XHeaderFooter > SwVbaHeaderFooter_BASE; -+ -+class SwVbaHeaderFooter : public SwVbaHeaderFooter_BASE -+{ -+private: -+ css::uno::Reference< css::frame::XModel > mxModel; -+ css::uno::Reference< css::beans::XPropertySet > mxPageStyleProps; -+ sal_Bool mbHeader; -+ sal_Int32 mnIndex; -+ -+public: -+ SwVbaHeaderFooter( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps, sal_Bool isHeader, sal_Int32 index ) throw ( css::uno::RuntimeException ); -+ virtual ~SwVbaHeaderFooter(){} -+ -+ // Attributes -+ virtual ::sal_Bool SAL_CALL getIsHeader() throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getLinkToPrevious() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLinkToPrevious( ::sal_Bool _linktoprevious ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL getRange() throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Shapes( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+#endif /* SW_VBA_HEADERFOOTER_HXX */ -diff --git sw/source/ui/vba/vbaheaderfooterhelper.cxx sw/source/ui/vba/vbaheaderfooterhelper.cxx -new file mode 100644 -index 0000000..4069b85 ---- /dev/null -+++ sw/source/ui/vba/vbaheaderfooterhelper.cxx -@@ -0,0 +1,178 @@ -+/************************************************************************* -+ * -+ * 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 "vbaheaderfooterhelper.hxx" -+#include "wordvbahelper.hxx" -+#include <comphelper/processfactory.hxx> -+#include <com/sun/star/frame/XController.hpp> -+#include <com/sun/star/text/XTextViewCursorSupplier.hpp> -+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> -+#include <com/sun/star/container/XNameAccess.hpp> -+ -+using namespace ::com::sun::star; -+using namespace ::ooo::vba; -+ -+#define FIRST_PAGE 1; -+ -+// Class HeaderFooterHelper -+ -+sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) -+{ -+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); -+ -+ sal_Bool isOn = sal_False; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn; -+ if( !isOn ) -+ return sal_False; -+ -+ sal_Bool isShared = sal_False; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared; -+ -+ rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") ); -+ if( !isShared ) -+ { -+ if( 0 == xPageCursor->getPage() % 2 ) -+ { -+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") ); -+ } -+ else -+ { -+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") ); -+ } -+ } -+ -+ uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW ); -+ //FIXME: can not compare in this way? -+ return ( xText == xCurrentText ); -+} -+ -+sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) -+{ -+ if( isHeader( xModel, xCurrentText ) ) -+ { -+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -+ // FIXME: getPage allways returns 1 -+ sal_Int32 nPage = xPageCursor->getPage(); -+ return nPage == FIRST_PAGE; -+ } -+ return sal_False; -+} -+ -+sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) -+{ -+ if( isHeader( xModel, xCurrentText ) ) -+ { -+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); -+ sal_Bool isShared = sal_False; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared; -+ if( !isShared ) -+ { -+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -+ return ( 0 == xPageCursor->getPage() % 2 ); -+ } -+ } -+ return sal_False; -+} -+ -+sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) -+{ -+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); -+ -+ sal_Bool isOn = sal_False; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn; -+ if( !isOn ) -+ return sal_False; -+ -+ sal_Bool isShared = sal_False; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared; -+ -+ rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") ); -+ if( !isShared ) -+ { -+ if( 0 == xPageCursor->getPage() % 2 ) -+ { -+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") ); -+ } -+ else -+ { -+ aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") ); -+ } -+ } -+ -+ uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW ); -+ -+ return ( xText == xCurrentText ); -+} -+ -+sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) -+{ -+ if( isFooter( xModel, xCurrentText ) ) -+ { -+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -+ sal_Int32 nPage = xPageCursor->getPage(); -+ return nPage == FIRST_PAGE; -+ } -+ return sal_False; -+} -+ -+sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) -+{ -+ if( isFooter( xModel, xCurrentText ) ) -+ { -+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); -+ sal_Bool isShared = sal_False; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared; -+ if( !isShared ) -+ { -+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -+ return ( 0 == xPageCursor->getPage() % 2 ); -+ } -+ } -+ return sal_False; -+} -+ -+sal_Bool HeaderFooterHelper::isPrimaryHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) -+{ -+ if( isHeader( xModel, xCurrentText ) ) -+ { -+ return( !( isFirstPageHeader( xModel, xCurrentText ) && isEvenPagesHeader( xModel, xCurrentText ) ) ); -+ } -+ return sal_False; -+} -+ -+sal_Bool HeaderFooterHelper::isPrimaryFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) -+{ -+ if( isHeader( xModel, xCurrentText ) ) -+ { -+ return( !( isFirstPageFooter( xModel, xCurrentText ) && isEvenPagesFooter( xModel, xCurrentText ) ) ); -+ } -+ return sal_False; -+} -diff --git sw/source/ui/vba/vbaheaderfooterhelper.hxx sw/source/ui/vba/vbaheaderfooterhelper.hxx -new file mode 100644 -index 0000000..2dffc59 ---- /dev/null -+++ sw/source/ui/vba/vbaheaderfooterhelper.hxx -@@ -0,0 +1,52 @@ -+/************************************************************************* -+ * -+ * 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: vbahelper.hxx,v $ -+ * $Revision: 1.5.32.1 $ -+ * -+ * 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 SW_WORD_VBA_HEADERFOOTERHELPER_HXX -+#define SW_WORD_VBA_HEADERFOOTERHELPER_HXX -+ -+#include <vbahelper/vbahelper.hxx> -+#include <com/sun/star/text/XText.hpp> -+#include <com/sun/star/text/XTextViewCursor.hpp> -+#include <com/sun/star/text/XPageCursor.hpp> -+#include <com/sun/star/style/XStyle.hpp> -+ -+class HeaderFooterHelper -+{ -+public: -+ static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -+ static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -+ static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -+ static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -+ static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -+ static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -+ static sal_Bool isPrimaryHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -+ static sal_Bool isPrimaryFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -+}; -+ -+#endif -diff --git sw/source/ui/vba/vbainformationhelper.cxx sw/source/ui/vba/vbainformationhelper.cxx -new file mode 100644 -index 0000000..e062ed0 ---- /dev/null -+++ sw/source/ui/vba/vbainformationhelper.cxx -@@ -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. -+ * -+ ************************************************************************/ -+#include "vbainformationhelper.hxx" -+#include <com/sun/star/text/XPageCursor.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include "wordvbahelper.hxx" -+#include <docsh.hxx> -+#include <doc.hxx> -+#include <vbahelper/vbahelper.hxx> -+#include <swtypes.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+static const sal_Int32 DEFAULT_PAGE_DISTANCE = 500; -+ -+sal_Int32 SwVbaInformationHelper::handleWdActiveEndPageNumber( const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException ) -+{ -+ uno::Reference< text::XPageCursor > xPageCursor( xTVCursor, uno::UNO_QUERY_THROW ); -+ return xPageCursor->getPage(); -+} -+ -+sal_Int32 SwVbaInformationHelper::handleWdNumberOfPagesInDocument( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException ) -+{ -+ return word::getPageCount( xModel ); -+} -+ -+double SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException ) -+{ -+ xTVCursor->collapseToStart(); -+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); -+ sal_Int32 nTopMargin = 0; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ) ) >>= nTopMargin; -+ sal_Int32 nCurrentPos = xTVCursor->getPosition().Y; -+ -+ sal_Int32 nCurrentPage = handleWdActiveEndPageNumber( xTVCursor ); -+ sal_Int32 nPageHeight = word::getDocShell( xModel )->GetDoc()->GetPageSize( nCurrentPage, sal_False ).Height(); -+ // FIXME: handle multipul page style -+ // it is very strange that the curros position is incorrect when open Word file. -+ // e.g. if current cursor in the top left of the text body of the first page without header, -+ // the top value of current position should be 0, but is 201 when open a Word file. -+ nCurrentPos = nCurrentPos + nTopMargin - ( DEFAULT_PAGE_DISTANCE + TWIP_TO_MM100( nPageHeight ) ) * ( nCurrentPage - 1 ); -+ return Millimeter::getInPoints( nCurrentPos ); -+} -diff --git sw/source/ui/vba/vbainformationhelper.hxx sw/source/ui/vba/vbainformationhelper.hxx -new file mode 100644 -index 0000000..96241bb ---- /dev/null -+++ sw/source/ui/vba/vbainformationhelper.hxx -@@ -0,0 +1,46 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_INFORMATIONHELPER_HXX -+#define SW_VBA_INFORMATIONHELPER_HXX -+ -+#include <vbahelper/vbahelperinterface.hxx> -+#include <com/sun/star/text/XTextViewCursor.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+ -+class SwVbaInformationHelper -+{ -+public: -+ static sal_Int32 handleWdActiveEndPageNumber( const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException ); -+ static sal_Int32 handleWdNumberOfPagesInDocument( const css::uno::Reference< css::frame::XModel >& xModel ) throw( css::uno::RuntimeException ); -+ static double handleWdVerticalPositionRelativeToPage( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor ) throw( css::uno::RuntimeException ); -+ //static double verticalPositionRelativeToPageBoundary( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XTextViewCursor >& xTVCursor, const css::uno::Reference< css::beans::XPropertySet >& xStyleProps ) throw( css::uno::RuntimeException ); -+ -+}; -+#endif /* SW_VBA_INFORMATIONHELPER_HXX */ -diff --git sw/source/ui/vba/vbaoptions.cxx sw/source/ui/vba/vbaoptions.cxx -index 9066a76..eac6da7 100644 ---- sw/source/ui/vba/vbaoptions.cxx -+++ sw/source/ui/vba/vbaoptions.cxx -@@ -30,6 +30,9 @@ - #include "vbaoptions.hxx" - #include <vbahelper/vbahelper.hxx> - #include <ooo/vba/word/WdDefaultFilePath.hpp> -+#include <ooo/vba/word/WdLineStyle.hpp> -+#include <ooo/vba/word/WdLineWidth.hpp> -+#include <ooo/vba/word/WdColorIndex.hpp> - #include <com/sun/star/util/XStringSubstitution.hpp> - #include <com/sun/star/beans/XPropertySet.hpp> - #include <osl/file.hxx> -@@ -67,6 +70,11 @@ SwVbaOptions::DefaultFilePath( sal_Int32 _path ) throw ( uno::RuntimeException ) - msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Template") ); - break; - } -+ case word::WdDefaultFilePath::wdStartupPath: -+ { -+ msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Addin") ); -+ break; -+ } - case word::WdDefaultFilePath::wdUserOptionsPath: - { - msDefaultFilePath = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserConfig") ); -@@ -128,6 +136,137 @@ uno::Any SwVbaOptions::getValueEvent() - return uno::makeAny( sPath ); - } - -+sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderLineStyle() throw (uno::RuntimeException) -+{ -+ return word::WdLineStyle::wdLineStyleSingle; -+} -+ -+void SAL_CALL SwVbaOptions::setDefaultBorderLineStyle( ::sal_Int32 _defaultborderlinestyle ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderLineWidth() throw (uno::RuntimeException) -+{ -+ return word::WdLineWidth::wdLineWidth050pt; -+} -+ -+void SAL_CALL SwVbaOptions::setDefaultBorderLineWidth( ::sal_Int32 _defaultborderlinewidth ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+sal_Int32 SAL_CALL SwVbaOptions::getDefaultBorderColorIndex() throw (uno::RuntimeException) -+{ -+ return word::WdColorIndex::wdAuto; -+} -+ -+void SAL_CALL SwVbaOptions::setDefaultBorderColorIndex( ::sal_Int32 _defaultbordercolorindex ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getReplaceSelection() throw (uno::RuntimeException) -+{ -+ return sal_True; -+} -+ -+void SAL_CALL SwVbaOptions::setReplaceSelection( ::sal_Bool _replaceselection ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getMapPaperSize() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaOptions::setMapPaperSize( ::sal_Bool _mappapersize ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyHeadings() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyHeadings( ::sal_Bool _autoformatasyoutypeapplyheadings ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyBulletedLists() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyBulletedLists( ::sal_Bool _autoformatasyoutypeapplybulletedlists ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeApplyNumberedLists() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeApplyNumberedLists( ::sal_Bool _autoformatasyoutypeapplynumberedlists ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeFormatListItemBeginning() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeFormatListItemBeginning( ::sal_Bool _autoformatasyoutypeformatlistitembeginning ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatAsYouTypeDefineStyles() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaOptions::setAutoFormatAsYouTypeDefineStyles( ::sal_Bool _autoformatasyoutypedefinestyles ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyHeadings() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaOptions::setAutoFormatApplyHeadings( ::sal_Bool _autoformatapplyheadings ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyLists() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaOptions::setAutoFormatApplyLists( ::sal_Bool _autoformatapplylists ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+::sal_Bool SAL_CALL SwVbaOptions::getAutoFormatApplyBulletedLists() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaOptions::setAutoFormatApplyBulletedLists( ::sal_Bool _autoformatapplybulletedlists ) throw (uno::RuntimeException) -+{ -+ // not support in Writer -+} -+ -+ - rtl::OUString& - SwVbaOptions::getServiceImplName() - { -diff --git sw/source/ui/vba/vbaoptions.hxx sw/source/ui/vba/vbaoptions.hxx -index a03b581..6ef6e44 100644 ---- sw/source/ui/vba/vbaoptions.hxx -+++ sw/source/ui/vba/vbaoptions.hxx -@@ -48,7 +48,35 @@ public: - SwVbaOptions( css::uno::Reference< css::uno::XComponentContext >& m_xContext ) throw ( css::uno::RuntimeException ); - virtual ~SwVbaOptions(); - -- // XOptions -+ // Attributes -+ virtual ::sal_Int32 SAL_CALL getDefaultBorderLineStyle() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDefaultBorderLineStyle( ::sal_Int32 _defaultborderlinestyle ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getDefaultBorderLineWidth() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDefaultBorderLineWidth( ::sal_Int32 _defaultborderlinewidth ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getDefaultBorderColorIndex() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDefaultBorderColorIndex( ::sal_Int32 _defaultbordercolorindex ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getReplaceSelection() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setReplaceSelection( ::sal_Bool _replaceselection ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getMapPaperSize() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMapPaperSize( ::sal_Bool _mappapersize ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyHeadings() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAutoFormatAsYouTypeApplyHeadings( ::sal_Bool _autoformatasyoutypeapplyheadings ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyBulletedLists() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAutoFormatAsYouTypeApplyBulletedLists( ::sal_Bool _autoformatasyoutypeapplybulletedlists ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeApplyNumberedLists() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAutoFormatAsYouTypeApplyNumberedLists( ::sal_Bool _autoformatasyoutypeapplynumberedlists ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeFormatListItemBeginning() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAutoFormatAsYouTypeFormatListItemBeginning( ::sal_Bool _autoformatasyoutypeformatlistitembeginning ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getAutoFormatAsYouTypeDefineStyles() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAutoFormatAsYouTypeDefineStyles( ::sal_Bool _autoformatasyoutypedefinestyles ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getAutoFormatApplyHeadings() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAutoFormatApplyHeadings( ::sal_Bool _autoformatapplyheadings ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getAutoFormatApplyLists() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAutoFormatApplyLists( ::sal_Bool _autoformatapplylists ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getAutoFormatApplyBulletedLists() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAutoFormatApplyBulletedLists( ::sal_Bool _autoformatapplybulletedlists ) throw (css::uno::RuntimeException); -+ -+ // Methods - virtual css::uno::Any SAL_CALL DefaultFilePath( sal_Int32 _path ) throw ( css::uno::RuntimeException ); - - //PropListener -diff --git sw/source/ui/vba/vbapagesetup.cxx sw/source/ui/vba/vbapagesetup.cxx -new file mode 100644 -index 0000000..96760e8 ---- /dev/null -+++ sw/source/ui/vba/vbapagesetup.cxx -@@ -0,0 +1,275 @@ -+/************************************************************************* -+ * -+ * 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 "vbapagesetup.hxx" -+#include <com/sun/star/text/XText.hpp> -+#include <com/sun/star/text/XPageCursor.hpp> -+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> -+#include <com/sun/star/container/XNameAccess.hpp> -+#include <ooo/vba/word/WdSectionStart.hpp> -+#include <ooo/vba/word/WdOrientation.hpp> -+#include "wordvbahelper.hxx" -+ -+using namespace ::com::sun::star; -+using namespace ::ooo::vba; -+ -+SwVbaPageSetup::SwVbaPageSetup(const uno::Reference< XHelperInterface >& xParent, -+ const uno::Reference< uno::XComponentContext >& xContext, -+ const uno::Reference< frame::XModel >& xModel, -+ const uno::Reference< beans::XPropertySet >& xProps ) throw (uno::RuntimeException): -+ SwVbaPageSetup_BASE( xParent, xContext ) -+{ -+ mxModel.set( xModel, uno::UNO_QUERY_THROW ); -+ mxPageProps.set( xProps, uno::UNO_QUERY_THROW ); -+ mnOrientPortrait = word::WdOrientation::wdOrientPortrait; -+ mnOrientLandscape = word::WdOrientation::wdOrientLandscape; -+} -+ -+double SAL_CALL SwVbaPageSetup::getGutter() throw (uno::RuntimeException) -+{ -+ // not support in Writer -+ return 0; -+} -+ -+void SAL_CALL SwVbaPageSetup::setGutter( double _gutter ) throw (uno::RuntimeException) -+{ -+ // default add gutter into left margin -+ if( _gutter != 0 ) -+ { -+ double margin = VbaPageSetupBase::getLeftMargin() + _gutter; -+ VbaPageSetupBase::setLeftMargin( margin ); -+ } -+} -+ -+double SAL_CALL SwVbaPageSetup::getHeaderDistance() throw (uno::RuntimeException) -+{ -+ sal_Bool isHeaderOn = sal_False; -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn; -+ if( !isHeaderOn ) -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) ); -+ return VbaPageSetupBase::getHeaderMargin(); -+} -+ -+ /** -+ * changes the value of TopMargin to the value of new MS-Word-HeaderDistance. Subtracts the difference -+ * between old TopMargin and the new headerDistance from the value of HeaderSpacing (which defines the -+ * space between the header and the body of the text). calculates the new HeaderHeight (= height of the -+ * header + headerBodyDistance). -+ * -+ * @param: headerDistance is the value that is set in MS Word for the distance from the top of the page -+ * to the header -+ */ -+void SAL_CALL SwVbaPageSetup::setHeaderDistance( double _headerdistance ) throw (uno::RuntimeException) -+{ -+ sal_Int32 newHeaderDistance = Millimeter::getInHundredthsOfOneMillimeter( _headerdistance ); -+ sal_Bool isHeaderOn = sal_False; -+ sal_Int32 aktTopMargin = 0; -+ sal_Int32 aktSpacing = 0; -+ sal_Int32 aktHeaderHeight = 0; -+ -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn; -+ if( !isHeaderOn ) -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_True ) ); -+ -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= aktTopMargin; -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance"))) >>= aktSpacing; -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= aktHeaderHeight; -+ -+ sal_Int32 newSpacing = aktSpacing - ( newHeaderDistance - aktTopMargin ); -+ sal_Int32 height = aktHeaderHeight - aktSpacing; -+ sal_Int32 newHeaderHeight = newSpacing + height; -+ -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin")), uno::makeAny( newHeaderDistance ) ); -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderBodyDistance")), uno::makeAny( newSpacing ) ); -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight")), uno::makeAny( newHeaderHeight ) ); -+} -+ -+double SAL_CALL SwVbaPageSetup::getFooterDistance() throw (uno::RuntimeException) -+{ -+ sal_Bool isFooterOn = sal_False; -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn; -+ if( !isFooterOn ) -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) ); -+ return VbaPageSetupBase::getFooterMargin(); -+} -+ -+void SAL_CALL SwVbaPageSetup::setFooterDistance( double _footerdistance ) throw (uno::RuntimeException) -+{ -+ sal_Int32 newFooterDistance = Millimeter::getInHundredthsOfOneMillimeter( _footerdistance ); -+ sal_Bool isFooterOn = sal_False; -+ sal_Int32 aktBottomMargin = 0; -+ sal_Int32 aktSpacing = 0; -+ sal_Int32 aktFooterHeight = 0; -+ -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isFooterOn; -+ if( !isFooterOn ) -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_True ) ); -+ -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= aktBottomMargin; -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance"))) >>= aktSpacing; -+ mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= aktFooterHeight; -+ -+ sal_Int32 newSpacing = aktSpacing - ( newFooterDistance - aktBottomMargin ); -+ sal_Int32 height = aktFooterHeight - aktSpacing; -+ sal_Int32 newFooterHeight = newSpacing + height; -+ -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), uno::makeAny( newFooterDistance ) ); -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterBodyDistance")), uno::makeAny( newSpacing ) ); -+ mxPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight")), uno::makeAny( newFooterHeight ) ); -+} -+ -+sal_Bool SAL_CALL SwVbaPageSetup::getDifferentFirstPageHeaderFooter() throw (uno::RuntimeException) -+{ -+ rtl::OUString pageStyle = getStyleOfFirstPage(); -+ if( pageStyle.equalsAscii( "First Page" ) ) -+ return sal_True; -+ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaPageSetup::setDifferentFirstPageHeaderFooter( sal_Bool status ) throw (uno::RuntimeException) -+{ -+ if( status == getDifferentFirstPageHeaderFooter() ) -+ return; -+ -+ rtl::OUString newStyle; -+ if( status ) -+ newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("First Page") ); -+ else -+ newStyle = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Standard") ); -+ -+ uno::Reference< beans::XPropertySet > xStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW ); -+ sal_Int32 nTopMargin = 0; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin"))) >>= nTopMargin; -+ sal_Int32 nBottomMargin = 0; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin"))) >>= nBottomMargin; -+ sal_Int32 nLeftMargin = 0; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin"))) >>= nLeftMargin; -+ sal_Int32 nRightMargin = 0; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin"))) >>= nRightMargin; -+ sal_Int32 nHeaderHeight = 0; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderHeight"))) >>= nHeaderHeight; -+ sal_Int32 nFooterHeight = 0; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterHeight"))) >>= nFooterHeight; -+ -+ sal_Bool isHeaderOn = sal_False; -+ xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isHeaderOn; -+ if( isHeaderOn ) -+ { -+ nTopMargin += nHeaderHeight; -+ nBottomMargin += nFooterHeight; -+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn")), uno::makeAny( sal_False ) ); -+ xStyleProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn")), uno::makeAny( sal_False ) ); -+ } -+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW ); -+ if( xPageCursor->getPage() != 1 ) -+ { -+ xPageCursor->jumpToFirstPage(); -+ } -+ -+ uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW ); -+ uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY ); -+ if( xTableProps.is() ) -+ { -+ xTableProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) ); -+ } -+ else -+ { -+ xCursorProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ), uno::makeAny( newStyle ) ); -+ } -+ -+ uno::Reference< beans::XPropertySet > xFirstPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW ); -+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ), uno::makeAny( nTopMargin ) ); -+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ), uno::makeAny( nBottomMargin ) ); -+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), uno::makeAny( nLeftMargin ) ); -+ xFirstPageProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ), uno::makeAny( nRightMargin ) ); -+} -+ -+rtl::OUString SwVbaPageSetup::getStyleOfFirstPage() throw (uno::RuntimeException) -+{ -+ rtl::OUString styleFirstPage; -+ uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( mxModel ), uno::UNO_QUERY_THROW ); -+ if( xPageCursor->getPage() != 1 ) -+ { -+ xPageCursor->jumpToFirstPage(); -+ } -+ -+ uno::Reference< beans::XPropertySet > xCursorProps( xPageCursor, uno::UNO_QUERY_THROW ); -+ uno::Reference< beans::XPropertySet > xTableProps( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ), uno::UNO_QUERY ); -+ if( xTableProps.is() ) -+ { -+ xTableProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage; -+ } -+ else -+ { -+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageDescName") ) ) >>= styleFirstPage; -+ } -+ return styleFirstPage; -+} -+ -+::sal_Int32 SAL_CALL SwVbaPageSetup::getSectionStart() throw (uno::RuntimeException) -+{ -+ // FIXME: -+ sal_Int32 wdSectionStart = word::WdSectionStart::wdSectionNewPage; -+ uno::Reference< container::XNamed > xNamed( mxPageProps, uno::UNO_QUERY_THROW ); -+ rtl::OUString sStyleName = xNamed->getName(); -+ //mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sStyleName; -+ if( sStyleName.equalsAscii("Left Page") ) -+ wdSectionStart = word::WdSectionStart::wdSectionEvenPage; -+ else if( sStyleName.equalsAscii("Right Page") ) -+ wdSectionStart = word::WdSectionStart::wdSectionOddPage; -+ else -+ wdSectionStart = word::WdSectionStart::wdSectionNewPage; -+ return wdSectionStart; -+} -+ -+void SAL_CALL SwVbaPageSetup::setSectionStart( ::sal_Int32 _sectionstart ) throw (uno::RuntimeException) -+{ -+ // fail to find corresponding feature in Writer -+ // #FIXME: -+} -+ -+rtl::OUString& -+SwVbaPageSetup::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaPageSetup") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaPageSetup::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.PageSetup" ) ); -+ } -+ return aServiceNames; -+} -diff --git sw/source/ui/vba/vbapagesetup.hxx sw/source/ui/vba/vbapagesetup.hxx -new file mode 100644 -index 0000000..db621ba ---- /dev/null -+++ sw/source/ui/vba/vbapagesetup.hxx -@@ -0,0 +1,70 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_PAGESETUP_HXX -+#define SW_VBA_PAGESETUP_HXX -+ -+#include <cppuhelper/implbase1.hxx> -+#include <ooo/vba/word/XPageSetup.hpp> -+#include <com/sun/star/uno/XComponentContext.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <vbahelper/vbapagesetupbase.hxx> -+ -+typedef cppu::ImplInheritanceHelper1< VbaPageSetupBase, ooo::vba::word::XPageSetup > SwVbaPageSetup_BASE; -+ -+class SwVbaPageSetup : public SwVbaPageSetup_BASE -+{ -+private: -+ rtl::OUString getStyleOfFirstPage() throw (css::uno::RuntimeException); -+ -+public: -+ SwVbaPageSetup( const css::uno::Reference< ooo::vba::XHelperInterface >& xParent, -+ const css::uno::Reference< css::uno::XComponentContext >& xContext, -+ const css::uno::Reference< css::frame::XModel >& xModel, -+ const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw (css::uno::RuntimeException); -+ virtual ~SwVbaPageSetup(){} -+ -+ // Attributes -+ virtual double SAL_CALL getGutter() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setGutter( double _gutter ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getHeaderDistance() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setHeaderDistance( double _headerdistance ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getFooterDistance() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setFooterDistance( double _footerdistance ) throw (css::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL getDifferentFirstPageHeaderFooter() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDifferentFirstPageHeaderFooter( sal_Bool status ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getSectionStart() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setSectionStart( ::sal_Int32 _sectionstart ) throw (css::uno::RuntimeException); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+#endif -diff --git sw/source/ui/vba/vbapalette.cxx sw/source/ui/vba/vbapalette.cxx -new file mode 100644 -index 0000000..9c7427d ---- /dev/null -+++ sw/source/ui/vba/vbapalette.cxx -@@ -0,0 +1,75 @@ -+#include "vbapalette.hxx" -+#include <cppuhelper/implbase1.hxx> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <ooo/vba/word/WdColor.hpp> -+#include <ooo/vba/word/WdColorIndex.hpp> -+ -+using namespace ::ooo::vba; -+using namespace ::ooo::vba::word; -+using namespace ::com::sun::star; -+ -+static const sal_Int32 ColorTable[] = -+{ -+WdColor::wdColorAutomatic, // 0 -+WdColor::wdColorBlack, // 1 -+WdColor::wdColorBlue, // 2 -+WdColor::wdColorTurquoise, // 3 -+WdColor::wdColorBrightGreen, // 4 -+WdColor::wdColorPink, // 5 -+WdColor::wdColorRed, // 6 -+WdColor::wdColorYellow, // 7 -+WdColor::wdColorWhite, // 8 -+WdColor::wdColorDarkBlue, // 9 -+WdColor::wdColorTeal, // 10 -+WdColor::wdColorGreen, // 11 -+WdColor::wdColorViolet, // 12 -+WdColor::wdColorDarkRed, // 13 -+WdColor::wdColorDarkYellow, // 14 -+WdColor::wdColorGray50, // 15 -+WdColor::wdColorGray25, // 16 -+}; -+ -+typedef ::cppu::WeakImplHelper1< container::XIndexAccess > XIndexAccess_BASE; -+ -+class DefaultPalette : public XIndexAccess_BASE -+{ -+public: -+ DefaultPalette(){} -+ -+ // Methods XIndexAccess -+ virtual ::sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException) -+ { -+ return sizeof(ColorTable) / sizeof(ColorTable[0]); -+ } -+ -+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( Index < 0 || Index >= getCount() ) -+ throw lang::IndexOutOfBoundsException(); -+ return uno::makeAny( sal_Int32( ColorTable[ Index ] ) ); -+ } -+ -+ // Methods XElementAcess -+ virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException) -+ { -+ return ::getCppuType( (sal_Int32*)0 ); -+ } -+ virtual ::sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException) -+ { -+ return sal_True; -+ } -+ -+}; -+ -+VbaPalette::VbaPalette() -+{ -+ mxPalette = new DefaultPalette(); -+} -+ -+uno::Reference< container::XIndexAccess > -+VbaPalette::getPalette() const -+{ -+ -+ return mxPalette; -+} -+ -diff --git sw/source/ui/vba/vbapalette.hxx sw/source/ui/vba/vbapalette.hxx -new file mode 100644 -index 0000000..130e405 ---- /dev/null -+++ sw/source/ui/vba/vbapalette.hxx -@@ -0,0 +1,15 @@ -+#ifndef VBAPALETTE_HXX -+#define VBAPALETTE_HXX -+#include <vbahelper/vbahelper.hxx> -+ -+class VbaPalette -+{ -+ css::uno::Reference< css::container::XIndexAccess > mxPalette; -+public: -+ VbaPalette(); -+ // if no palette available e.g. because the document doesn't have a -+ // palette defined then a default palette will be returned. -+ css::uno::Reference< css::container::XIndexAccess > getPalette() const; -+}; -+ -+#endif -diff --git sw/source/ui/vba/vbaparagraph.cxx sw/source/ui/vba/vbaparagraph.cxx -new file mode 100644 -index 0000000..107ff33 ---- /dev/null -+++ sw/source/ui/vba/vbaparagraph.cxx -@@ -0,0 +1,177 @@ -+/************************************************************************* -+ * -+ * 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 "vbaparagraph.hxx" -+#include <vbahelper/vbahelper.hxx> -+#include <tools/diagnose_ex.h> -+#include "vbarange.hxx" -+#include <com/sun/star/lang/XServiceInfo.hpp> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+SwVbaParagraph::SwVbaParagraph( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& xDocument, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) : -+ SwVbaParagraph_BASE( rParent, rContext ), mxTextDocument( xDocument ), mxTextRange( xTextRange ) -+{ -+} -+ -+SwVbaParagraph::~SwVbaParagraph() -+{ -+} -+ -+uno::Reference< word::XRange > SAL_CALL -+SwVbaParagraph::getRange( ) throw ( uno::RuntimeException ) -+{ -+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, mxTextRange->getStart(), mxTextRange->getEnd(), mxTextRange->getText(), sal_True ) ); -+} -+ -+rtl::OUString& -+SwVbaParagraph::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraph") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaParagraph::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraph" ) ); -+ } -+ return aServiceNames; -+} -+ -+ -+//typedef ::cppu::WeakImplHelper1< container::XEnumeration > ParagraphEnumeration_BASE; -+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > ParagraphCollectionHelper_BASE; -+ -+class ParagraphCollectionHelper : public ParagraphCollectionHelper_BASE -+{ -+private: -+ uno::Reference< text::XTextDocument > mxTextDocument; -+ -+ uno::Reference< container::XEnumeration > getEnumeration() throw (uno::RuntimeException) -+ { -+ uno::Reference< container::XEnumerationAccess > xParEnumAccess( mxTextDocument->getText(), uno::UNO_QUERY_THROW ); -+ return xParEnumAccess->createEnumeration(); -+ } -+ -+public: -+ ParagraphCollectionHelper( const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException): mxTextDocument( xDocument ) -+ { -+ } -+ // XElementAccess -+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return text::XTextRange::static_type(0); } -+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return sal_True; } -+ // XIndexAccess -+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) -+ { -+ sal_Int32 nCount = 0; -+ uno::Reference< container::XEnumeration > xParEnum = getEnumeration(); -+ while( xParEnum->hasMoreElements() ) -+ { -+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW ); -+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) ) -+ { -+ nCount++; -+ } -+ } -+ return nCount; -+ } -+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) -+ { -+ if( Index < getCount() ) -+ { -+ sal_Int32 nCount = 0; -+ uno::Reference< container::XEnumeration > xParEnum = getEnumeration(); -+ while( xParEnum->hasMoreElements() ) -+ { -+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParEnum->nextElement(), uno::UNO_QUERY_THROW ); -+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph") ) ) ) -+ { -+ if( Index == nCount ) -+ return uno::makeAny( xServiceInfo ); -+ nCount++; -+ } -+ } -+ } -+ throw lang::IndexOutOfBoundsException(); -+ } -+ // XEnumerationAccess -+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) -+ { -+ return getEnumeration(); -+ } -+}; -+ -+SwVbaParagraphs::SwVbaParagraphs( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDocument ) throw (uno::RuntimeException) : SwVbaParagraphs_BASE( xParent, xContext, new ParagraphCollectionHelper( xDocument ) ), mxTextDocument( xDocument ) -+{ -+} -+ -+// XEnumerationAccess -+uno::Type -+SwVbaParagraphs::getElementType() throw (uno::RuntimeException) -+{ -+ return word::XParagraph::static_type(0); -+} -+uno::Reference< container::XEnumeration > -+SwVbaParagraphs::createEnumeration() throw (uno::RuntimeException) -+{ -+ uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); -+ return xEnumerationAccess->createEnumeration(); -+} -+ -+uno::Any -+SwVbaParagraphs::createCollectionObject( const css::uno::Any& aSource ) -+{ -+ uno::Reference< text::XTextRange > xTextRange( aSource, uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XParagraph >( new SwVbaParagraph( this, mxContext, mxTextDocument, xTextRange ) ) ); -+} -+ -+rtl::OUString& -+SwVbaParagraphs::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphs") ); -+ return sImplName; -+} -+ -+css::uno::Sequence<rtl::OUString> -+SwVbaParagraphs::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > sNames; -+ if ( sNames.getLength() == 0 ) -+ { -+ sNames.realloc( 1 ); -+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Paragraphs") ); -+ } -+ return sNames; -+} -diff --git sw/source/ui/vba/vbaparagraph.hxx sw/source/ui/vba/vbaparagraph.hxx -new file mode 100644 -index 0000000..979116d ---- /dev/null -+++ sw/source/ui/vba/vbaparagraph.hxx -@@ -0,0 +1,84 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_PARAGRAPH_HXX -+#define SW_VBA_PARAGRAPH_HXX -+ -+#include <vbahelper/vbacollectionimpl.hxx> -+#include <ooo/vba/word/XParagraphs.hpp> -+#include <ooo/vba/word/XParagraph.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <cppuhelper/implbase1.hxx> -+#include <com/sun/star/text/XTextRange.hpp> -+#include <com/sun/star/text/XTextDocument.hpp> -+ -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XParagraph > SwVbaParagraph_BASE; -+ -+class SwVbaParagraph : public SwVbaParagraph_BASE -+{ -+private: -+ css::uno::Reference< css::text::XTextDocument > mxTextDocument; -+ css::uno::Reference< css::text::XTextRange > mxTextRange; -+ -+public: -+ SwVbaParagraph( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& xDocument, const css::uno::Reference< css::text::XTextRange >& xTextRange ) throw ( css::uno::RuntimeException ); -+ virtual ~SwVbaParagraph(); -+ -+ // XParagraph -+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw ( css::uno::RuntimeException ); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+ -+/* class SwVbaParagraphs */ -+typedef CollTestImplHelper< ooo::vba::word::XParagraphs > SwVbaParagraphs_BASE; -+ -+class SwVbaParagraphs : public SwVbaParagraphs_BASE -+{ -+private: -+ css::uno::Reference< css::text::XTextDocument > mxTextDocument; -+public: -+ SwVbaParagraphs( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::text::XTextDocument >& xDocument ) throw (css::uno::RuntimeException); -+ virtual ~SwVbaParagraphs() {} -+ -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ -+ // SwVbaParagraphs_BASE -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif /* SW_VBA_PARAGRAPH_HXX */ -diff --git sw/source/ui/vba/vbaparagraphformat.cxx sw/source/ui/vba/vbaparagraphformat.cxx -new file mode 100644 -index 0000000..7726d48 ---- /dev/null -+++ sw/source/ui/vba/vbaparagraphformat.cxx -@@ -0,0 +1,576 @@ -+/************************************************************************* -+ * -+ * 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 "vbaparagraphformat.hxx" -+#include <vbahelper/vbahelper.hxx> -+#include <tools/diagnose_ex.h> -+#include "wordvbahelper.hxx" -+#include <com/sun/star/style/LineSpacingMode.hpp> -+#include <ooo/vba/word/WdLineSpacing.hpp> -+#include <ooo/vba/word/WdParagraphAlignment.hpp> -+#include <ooo/vba/word/WdOutlineLevel.hpp> -+#include <com/sun/star/style/ParagraphAdjust.hpp> -+#include <com/sun/star/style/BreakType.hpp> -+ -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+static const sal_Int16 CHARACTER_INDENT_FACTOR = 12; -+static const sal_Int16 PERCENT100 = 100; -+static const sal_Int16 PERCENT150 = 150; -+static const sal_Int16 PERCENT200 = 200; -+ -+SwVbaParagraphFormat::SwVbaParagraphFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< beans::XPropertySet >& rParaProps ) : SwVbaParagraphFormat_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mxParaProps( rParaProps ) -+{ -+} -+ -+SwVbaParagraphFormat::~SwVbaParagraphFormat() -+{ -+} -+ -+sal_Int32 SAL_CALL SwVbaParagraphFormat::getAlignment() throw (uno::RuntimeException) -+{ -+ style::ParagraphAdjust aParaAdjust = style::ParagraphAdjust_LEFT; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ) ) >>= aParaAdjust; -+ return getMSWordAlignment( aParaAdjust ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setAlignment( sal_Int32 _alignment ) throw (uno::RuntimeException) -+{ -+ style::ParagraphAdjust aParaAdjust = ( style::ParagraphAdjust ) getOOoAlignment( _alignment ); -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaAdjust") ), uno::makeAny( aParaAdjust ) ); -+} -+ -+float SAL_CALL SwVbaParagraphFormat::getFirstLineIndent() throw (uno::RuntimeException) -+{ -+ sal_Int32 indent = 0; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ) ) >>= indent; -+ return (float)( Millimeter::getInPoints( indent ) ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setFirstLineIndent( float _firstlineindent ) throw (uno::RuntimeException) -+{ -+ sal_Int32 indent = Millimeter::getInHundredthsOfOneMillimeter( _firstlineindent ); -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaFirstLineIndent") ), uno::makeAny( indent ) ); -+} -+ -+uno::Any SAL_CALL SwVbaParagraphFormat::getKeepTogether() throw (uno::RuntimeException) -+{ -+ sal_Bool bKeep = sal_False; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ) ) >>= bKeep; -+ return uno::makeAny ( bKeep ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setKeepTogether( const uno::Any& _keeptogether ) throw (uno::RuntimeException) -+{ -+ sal_Bool bKeep = sal_False; -+ if( _keeptogether >>= bKeep ) -+ { -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaKeepTogether") ), uno::makeAny( bKeep ) ); -+ } -+ else -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ } -+} -+ -+uno::Any SAL_CALL SwVbaParagraphFormat::getKeepWithNext() throw (uno::RuntimeException) -+{ -+ sal_Bool bKeep = sal_False; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ) ) >>= bKeep; -+ return uno::makeAny ( bKeep ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setKeepWithNext( const uno::Any& _keepwithnext ) throw (uno::RuntimeException) -+{ -+ sal_Bool bKeep = sal_False; -+ if( _keepwithnext >>= bKeep ) -+ { -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaSplit") ), uno::makeAny( bKeep ) ); -+ } -+ else -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ } -+} -+ -+uno::Any SAL_CALL SwVbaParagraphFormat::getHyphenation() throw (uno::RuntimeException) -+{ -+ sal_Bool bHypn = sal_False; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ) ) >>= bHypn; -+ return uno::makeAny ( bHypn ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setHyphenation( const uno::Any& _hyphenation ) throw (uno::RuntimeException) -+{ -+ sal_Bool bHypn = sal_False; -+ if( _hyphenation >>= bHypn ) -+ { -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation") ), uno::makeAny( bHypn ) ); -+ } -+ else -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ } -+} -+ -+float SAL_CALL SwVbaParagraphFormat::getLineSpacing() throw (uno::RuntimeException) -+{ -+ style::LineSpacing aLineSpacing; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing; -+ return getMSWordLineSpacing( aLineSpacing ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setLineSpacing( float _linespacing ) throw (uno::RuntimeException) -+{ -+ style::LineSpacing aLineSpacing; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing; -+ aLineSpacing = getOOoLineSpacing( _linespacing, aLineSpacing.Mode ); -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) ); -+} -+ -+sal_Int32 SAL_CALL SwVbaParagraphFormat::getLineSpacingRule() throw (uno::RuntimeException) -+{ -+ style::LineSpacing aLineSpacing; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ) ) >>= aLineSpacing; -+ return getMSWordLineSpacingRule( aLineSpacing ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setLineSpacingRule( sal_Int32 _linespacingrule ) throw (uno::RuntimeException) -+{ -+ style::LineSpacing aLineSpacing = getOOoLineSpacingFromRule( _linespacingrule ); -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineSpacing") ), uno::makeAny( aLineSpacing ) ); -+} -+ -+uno::Any SAL_CALL SwVbaParagraphFormat::getNoLineNumber() throw (uno::RuntimeException) -+{ -+ sal_Bool noLineNum = sal_False; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ) ) >>= noLineNum; -+ return uno::makeAny ( noLineNum ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setNoLineNumber( const uno::Any& _nolinenumber ) throw (uno::RuntimeException) -+{ -+ sal_Bool noLineNum = sal_False; -+ if( _nolinenumber >>= noLineNum ) -+ { -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLineNumberCount") ), uno::makeAny( noLineNum ) ); -+ } -+ else -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ } -+} -+ -+sal_Int32 SAL_CALL SwVbaParagraphFormat::getOutlineLevel() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLevel = word::WdOutlineLevel::wdOutlineLevelBodyText; -+ rtl::OUString aHeading; -+ const rtl::OUString HEADING = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Heading") ); -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ) ) >>= aHeading; -+ if( aHeading.indexOf( HEADING ) == 0 ) -+ { -+ // get the sub string after "Heading" -+ nLevel = aHeading.copy( HEADING.getLength() ).toInt32(); -+ } -+ return nLevel; -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setOutlineLevel( sal_Int32 _outlinelevel ) throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+uno::Any SAL_CALL SwVbaParagraphFormat::getPageBreakBefore() throw (uno::RuntimeException) -+{ -+ style::BreakType aBreakType; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType; -+ sal_Bool bBreakBefore = ( aBreakType == style::BreakType_PAGE_BEFORE || aBreakType == style::BreakType_PAGE_BOTH ); -+ return uno::makeAny( bBreakBefore ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setPageBreakBefore( const uno::Any& _breakbefore ) throw (uno::RuntimeException) -+{ -+ sal_Bool bBreakBefore = sal_False; -+ if( _breakbefore >>= bBreakBefore ) -+ { -+ style::BreakType aBreakType; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ) ) >>= aBreakType; -+ if( bBreakBefore ) -+ { -+ if( aBreakType == style::BreakType_NONE ) -+ aBreakType = style::BreakType_PAGE_BEFORE; -+ else if ( aBreakType == style::BreakType_PAGE_AFTER ) -+ aBreakType = style::BreakType_PAGE_BOTH; -+ } -+ else -+ { -+ if( aBreakType == style::BreakType_PAGE_BOTH ) -+ aBreakType = style::BreakType_PAGE_AFTER; -+ else if ( aBreakType == style::BreakType_PAGE_BEFORE ) -+ aBreakType = style::BreakType_PAGE_AFTER; -+ } -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BreakType") ), uno::makeAny( aBreakType ) ); -+ } -+ else -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ } -+} -+ -+float SAL_CALL SwVbaParagraphFormat::getSpaceBefore() throw (uno::RuntimeException) -+{ -+ sal_Int32 nSpace; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ) ) >>= nSpace; -+ return (float)( Millimeter::getInPoints( nSpace ) ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setSpaceBefore( float _space ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space ); -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaTopMargin") ), uno::makeAny( nSpace ) ); -+} -+ -+float SAL_CALL SwVbaParagraphFormat::getSpaceAfter() throw (uno::RuntimeException) -+{ -+ sal_Int32 nSpace = 0; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ) ) >>= nSpace; -+ return (float)( Millimeter::getInPoints( nSpace ) ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setSpaceAfter( float _space ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nSpace = Millimeter::getInHundredthsOfOneMillimeter( _space ); -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaBottomMargin") ), uno::makeAny( nSpace ) ); -+} -+ -+float SAL_CALL SwVbaParagraphFormat::getLeftIndent() throw (uno::RuntimeException) -+{ -+ sal_Int32 nIndent = 0; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ) ) >>= nIndent; -+ return (float)( Millimeter::getInPoints( nIndent ) ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setLeftIndent( float _leftindent ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _leftindent ); -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin") ), uno::makeAny( nIndent ) ); -+} -+ -+float SAL_CALL SwVbaParagraphFormat::getRightIndent() throw (uno::RuntimeException) -+{ -+ sal_Int32 nIndent = 0; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ) ) >>= nIndent; -+ return (float)( Millimeter::getInPoints( nIndent ) ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setRightIndent( float _rightindent ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nIndent = Millimeter::getInHundredthsOfOneMillimeter( _rightindent ); -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaRightMargin") ), uno::makeAny( nIndent ) ); -+} -+ -+uno::Any SAL_CALL SwVbaParagraphFormat::getTabStops() throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setTabStops( const uno::Any& _tabstops ) throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+uno::Any SAL_CALL SwVbaParagraphFormat::getWidowControl() throw (uno::RuntimeException) -+{ -+ sal_Bool bWidow = sal_False; -+ sal_Int8 nWidow = 0; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ) ) >>= nWidow; -+ sal_Int8 nOrphan = 0; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ) ) >>= nOrphan; -+ // if the amount of single lines on one page > 1 and the same of start and end of the paragraph, -+ // true is retured. -+ bWidow = ( nWidow > 1 && nOrphan == nWidow ); -+ return uno::makeAny( bWidow ); -+} -+ -+void SAL_CALL SwVbaParagraphFormat::setWidowControl( const uno::Any& _widowcontrol ) throw (uno::RuntimeException) -+{ -+ // if we get true, the part of the paragraph on one page has to be -+ // at least two lines -+ sal_Bool bWidow = sal_False; -+ if( _widowcontrol >>= bWidow ) -+ { -+ sal_Int8 nControl = bWidow? 2:1; -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaWidows") ), uno::makeAny( nControl ) ); -+ mxParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaOrphans") ), uno::makeAny( nControl ) ); -+ } -+ else -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ } -+} -+ -+style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacing( float _lineSpace, sal_Int16 mode ) -+{ -+ style::LineSpacing aLineSpacing; -+ if( mode != style::LineSpacingMode::MINIMUM && mode != style::LineSpacingMode::FIX ) -+ { -+ // special behaviour of word: if the space is set to these values, the rule and -+ // the height are changed accordingly -+ if( _lineSpace == CHARACTER_INDENT_FACTOR ) -+ { -+ aLineSpacing.Mode = style::LineSpacingMode::PROP; -+ aLineSpacing.Height = PERCENT100; -+ } -+ else if( _lineSpace == ( sal_Int16 )( CHARACTER_INDENT_FACTOR * 1.5 ) ) -+ { -+ aLineSpacing.Mode = style::LineSpacingMode::PROP; -+ aLineSpacing.Height = PERCENT150; -+ } -+ else if( _lineSpace == ( sal_Int16 )( ( CHARACTER_INDENT_FACTOR ) * 2 ) ) -+ { -+ aLineSpacing.Mode = style::LineSpacingMode::PROP; -+ aLineSpacing.Height = PERCENT200; -+ } -+ else -+ { -+ aLineSpacing.Mode = style::LineSpacingMode::FIX; -+ aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) ); -+ } -+ } -+ else -+ { -+ aLineSpacing.Mode = mode; -+ aLineSpacing.Height = ( sal_Int16 )( Millimeter::getInHundredthsOfOneMillimeter( _lineSpace ) ); -+ } -+ return aLineSpacing; -+} -+ -+style::LineSpacing SwVbaParagraphFormat::getOOoLineSpacingFromRule( sal_Int32 _linespacingrule ) -+{ -+ style::LineSpacing aLineSpacing; -+ switch( _linespacingrule ) -+ { -+ case word::WdLineSpacing::wdLineSpace1pt5: -+ { -+ aLineSpacing.Mode = style::LineSpacingMode::PROP; -+ aLineSpacing.Height = PERCENT150; -+ break; -+ } -+ case word::WdLineSpacing::wdLineSpaceAtLeast: -+ { -+ aLineSpacing.Mode = style::LineSpacingMode::MINIMUM; -+ aLineSpacing.Height = getCharHeight(); -+ break; -+ } -+ case word::WdLineSpacing::wdLineSpaceDouble: -+ { -+ aLineSpacing.Mode = style::LineSpacingMode::PROP; -+ aLineSpacing.Height = getCharHeight(); -+ break; -+ } -+ case word::WdLineSpacing::wdLineSpaceExactly: -+ case word::WdLineSpacing::wdLineSpaceMultiple: -+ { -+ aLineSpacing.Mode = style::LineSpacingMode::FIX; -+ aLineSpacing.Height = getCharHeight(); -+ break; -+ } -+ case word::WdLineSpacing::wdLineSpaceSingle: -+ { -+ aLineSpacing.Mode = style::LineSpacingMode::PROP; -+ aLineSpacing.Height = PERCENT100; -+ break; -+ } -+ default: -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ break; -+ } -+ } -+ return aLineSpacing; -+} -+ -+float SwVbaParagraphFormat::getMSWordLineSpacing( style::LineSpacing& rLineSpacing ) -+{ -+ float wdLineSpacing = 0; -+ if( rLineSpacing.Mode != style::LineSpacingMode::PROP ) -+ { -+ wdLineSpacing = (float)( Millimeter::getInPoints( rLineSpacing.Height ) ); -+ } -+ else -+ { -+ wdLineSpacing = (float)( CHARACTER_INDENT_FACTOR * rLineSpacing.Height ) / PERCENT100; -+ } -+ return wdLineSpacing; -+} -+ -+sal_Int32 SwVbaParagraphFormat::getMSWordLineSpacingRule( style::LineSpacing& rLineSpacing ) -+{ -+ sal_Int32 wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle; -+ switch( rLineSpacing.Mode ) -+ { -+ case style::LineSpacingMode::PROP: -+ { -+ switch( rLineSpacing.Height ) -+ { -+ case PERCENT100: -+ { -+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceSingle; -+ break; -+ } -+ case PERCENT150: -+ { -+ wdLineSpacing = word::WdLineSpacing::wdLineSpace1pt5; -+ break; -+ } -+ case PERCENT200: -+ { -+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceDouble; -+ break; -+ } -+ default: -+ { -+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceMultiple; -+ } -+ } -+ break; -+ } -+ case style::LineSpacingMode::MINIMUM: -+ { -+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceAtLeast; -+ break; -+ } -+ case style::LineSpacingMode::FIX: -+ case style::LineSpacingMode::LEADING: -+ { -+ wdLineSpacing = word::WdLineSpacing::wdLineSpaceExactly; -+ break; -+ } -+ default: -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ } -+ } -+ return wdLineSpacing; -+} -+ -+sal_Int16 SwVbaParagraphFormat::getCharHeight() throw (uno::RuntimeException) -+{ -+ float fCharHeight; -+ mxParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharHeight") ) ) >>= fCharHeight; -+ return (sal_Int16)( Millimeter::getInHundredthsOfOneMillimeter( fCharHeight ) ); -+} -+ -+sal_Int32 SwVbaParagraphFormat::getOOoAlignment( sal_Int32 _alignment ) -+{ -+ sal_Int32 nParaAjust = style::ParagraphAdjust_LEFT; -+ switch( _alignment ) -+ { -+ case word::WdParagraphAlignment::wdAlignParagraphCenter: -+ { -+ nParaAjust = style::ParagraphAdjust_CENTER; -+ break; -+ } -+ case word::WdParagraphAlignment::wdAlignParagraphJustify: -+ { -+ nParaAjust = style::ParagraphAdjust_BLOCK; -+ break; -+ } -+ case word::WdParagraphAlignment::wdAlignParagraphLeft: -+ { -+ nParaAjust = style::ParagraphAdjust_LEFT; -+ break; -+ } -+ case word::WdParagraphAlignment::wdAlignParagraphRight: -+ { -+ nParaAjust = style::ParagraphAdjust_RIGHT; -+ break; -+ } -+ default: -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ } -+ } -+ return nParaAjust; -+} -+ -+sal_Int32 SwVbaParagraphFormat::getMSWordAlignment( sal_Int32 _alignment ) -+{ -+ sal_Int32 wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft; -+ switch( _alignment ) -+ { -+ case style::ParagraphAdjust_CENTER: -+ { -+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphCenter; -+ break; -+ } -+ case style::ParagraphAdjust_LEFT: -+ { -+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphLeft; -+ break; -+ } -+ case style::ParagraphAdjust_BLOCK: -+ { -+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphJustify; -+ break; -+ } -+ case style::ParagraphAdjust_RIGHT: -+ { -+ wdAlignment = word::WdParagraphAlignment::wdAlignParagraphRight; -+ break; -+ } -+ default: -+ { -+ DebugHelper::exception( SbERR_BAD_PARAMETER, rtl::OUString() ); -+ } -+ } -+ return wdAlignment; -+} -+ -+rtl::OUString& -+SwVbaParagraphFormat::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaParagraphFormat") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaParagraphFormat::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ParagraphFormat" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbaparagraphformat.hxx sw/source/ui/vba/vbaparagraphformat.hxx -new file mode 100644 -index 0000000..d4d9795 ---- /dev/null -+++ sw/source/ui/vba/vbaparagraphformat.hxx -@@ -0,0 +1,98 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_PARAGRAPHFORMAT_HXX -+#define SW_VBA_PARAGRAPHFORMAT_HXX -+ -+#include <ooo/vba/word/XParagraphFormat.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <cppuhelper/implbase1.hxx> -+#include <com/sun/star/text/XTextDocument.hpp> -+#include <com/sun/star/style/LineSpacing.hpp> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XParagraphFormat > SwVbaParagraphFormat_BASE; -+ -+class SwVbaParagraphFormat : public SwVbaParagraphFormat_BASE -+{ -+private: -+ css::uno::Reference< css::text::XTextDocument > mxTextDocument; -+ css::uno::Reference< css::beans::XPropertySet > mxParaProps; -+ -+private: -+ css::style::LineSpacing getOOoLineSpacing( float _lineSpace, sal_Int16 mode ); -+ css::style::LineSpacing getOOoLineSpacingFromRule( sal_Int32 _linespacingrule ); -+ float getMSWordLineSpacing( css::style::LineSpacing& rLineSpacing ); -+ sal_Int32 getMSWordLineSpacingRule( css::style::LineSpacing& rLineSpacing ); -+ sal_Int16 getCharHeight() throw (css::uno::RuntimeException); -+ sal_Int32 getOOoAlignment( sal_Int32 _alignment ); -+ sal_Int32 getMSWordAlignment( sal_Int32 _alignment ); -+ -+public: -+ SwVbaParagraphFormat( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::beans::XPropertySet >& rParaProps ); -+ virtual ~SwVbaParagraphFormat(); -+ -+ // Attributes -+ virtual ::sal_Int32 SAL_CALL getAlignment() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAlignment( ::sal_Int32 _alignment ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getFirstLineIndent() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setFirstLineIndent( float _firstlineindent ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getKeepTogether() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setKeepTogether( const css::uno::Any& _keeptogether ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getKeepWithNext() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setKeepWithNext( const css::uno::Any& _keepwithnext ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getHyphenation() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setHyphenation( const css::uno::Any& _hyphenation ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getLineSpacing() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLineSpacing( float _linespacing ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getLineSpacingRule() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLineSpacingRule( ::sal_Int32 _linespacingrule ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getNoLineNumber() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setNoLineNumber( const css::uno::Any& _nolinenumber ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getOutlineLevel() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setOutlineLevel( ::sal_Int32 _outlinelevel ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getPageBreakBefore() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setPageBreakBefore( const css::uno::Any& _pagebreakbefore ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getSpaceBefore() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setSpaceBefore( float _spacebefore ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getSpaceAfter() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setSpaceAfter( float _spaceafter ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getLeftIndent() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLeftIndent( float _leftindent ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getRightIndent() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setRightIndent( float _rightindent ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getTabStops() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setTabStops( const css::uno::Any& _tabstops ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getWidowControl() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setWidowControl( const css::uno::Any& _widowcontrol ) throw (css::uno::RuntimeException); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+#endif /* SW_VBA_PARAGRAPHFORMAT_HXX */ -diff --git sw/source/ui/vba/vbarange.cxx sw/source/ui/vba/vbarange.cxx -index 39c93b9..283162a 100644 ---- sw/source/ui/vba/vbarange.cxx -+++ sw/source/ui/vba/vbarange.cxx -@@ -31,65 +31,76 @@ - #include <vbahelper/vbahelper.hxx> - #include <tools/diagnose_ex.h> - #include "vbarangehelper.hxx" --#include <com/sun/star/text/XTextDocument.hpp> - #include <ooo/vba/word/WdBreakType.hpp> - #include <com/sun/star/style/BreakType.hpp> -+#include <com/sun/star/text/ControlCharacter.hpp> -+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> -+#include "wordvbahelper.hxx" -+#include "vbaparagraphformat.hxx" -+#include "vbastyle.hxx" -+#include "vbafont.hxx" -+#include "vbapalette.hxx" -+#include "vbapagesetup.hxx" - - using namespace ::ooo::vba; - using namespace ::com::sun::star; - --typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaBaseRange_BASE; -- --class SwVbaBaseRange : public SwVbaBaseRange_BASE -+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument ) - { --protected: -- uno::Reference< text::XTextDocument > mxTextDocument; -- uno::Reference< text::XTextCursor > mxTextCursor; -- uno::Reference< text::XText > mxText; -- sal_Bool mbMaySpanEndOfDocument; -- -- SwVbaBaseRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext ); -- virtual ~SwVbaBaseRange(); -- --public: -- uno::Reference< text::XTextRange > getXTextRange() throw (uno::RuntimeException); -- -- // XRange -- virtual rtl::OUString SAL_CALL getText() throw (uno::RuntimeException); -- virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (uno::RuntimeException); -- -- // Methods -- virtual void SAL_CALL InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException); -+ uno::Reference< text::XTextRange > xEnd; -+ initialize( rStart, xEnd ); -+} - -- // XHelperInterface -- virtual rtl::OUString& getServiceImplName(); -- virtual uno::Sequence<rtl::OUString> getServiceNames(); --}; -+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ), mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument ) -+{ -+ initialize( rStart, rEnd ); -+} - -+SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument ) throw (uno::RuntimeException) : SwVbaRange_BASE( rParent, rContext ),mxTextDocument( rTextDocument ), mbMaySpanEndOfDocument( _bMaySpanEndOfDocument ), mxText( rText ) -+{ -+ initialize( rStart, rEnd ); -+} - --SwVbaBaseRange::SwVbaBaseRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext ) -- : SwVbaBaseRange_BASE( rParent, rContext ) -+SwVbaRange::~SwVbaRange() - { - } - --SwVbaBaseRange::~SwVbaBaseRange() -+void SwVbaRange::initialize( const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd ) throw (uno::RuntimeException) - { -+ if( !mxText.is() ) -+ { -+ mxText = mxTextDocument->getText(); -+ } -+ -+ mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText ); -+ mxTextCursor->collapseToStart(); -+ -+ if( rEnd.is() ) -+ mxTextCursor->gotoRange( rEnd, sal_True ); -+ else -+ mxTextCursor->gotoEnd( sal_True ); - } - --uno::Reference< text::XTextRange > --SwVbaBaseRange::getXTextRange() throw (uno::RuntimeException) -+uno::Reference< text::XTextRange > SAL_CALL -+SwVbaRange::getXTextRange() throw (uno::RuntimeException) - { - uno::Reference< text::XTextRange > xTextRange( mxTextCursor, uno::UNO_QUERY_THROW ); - return xTextRange; - } - -+void SwVbaRange::setXTextRange( const uno::Reference< text::XTextRange >& xRange ) throw (uno::RuntimeException) -+{ -+ mxTextCursor->gotoRange( xRange->getStart(), sal_False ); -+ mxTextCursor->gotoRange( xRange->getEnd(), sal_True ); -+} -+ - /** - * The complexity in this method is because we need to workaround - * an issue that the last paragraph in a document does not have a trailing CRLF. - * @return - */ - rtl::OUString SAL_CALL --SwVbaBaseRange::getText() throw ( uno::RuntimeException ) -+SwVbaRange::getText() throw ( uno::RuntimeException ) - { - rtl::OUString aText = mxTextCursor->getString(); - sal_Int32 nLen = aText.getLength(); -@@ -118,7 +129,7 @@ SwVbaBaseRange::getText() throw ( uno::RuntimeException ) - } - - void SAL_CALL --SwVbaBaseRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException ) -+SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException ) - { - if( rText.indexOf( '\n' ) != -1 ) - { -@@ -134,7 +145,7 @@ SwVbaBaseRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeExcept - } - - // FIXME: test is not pass --void SAL_CALL SwVbaBaseRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException) -+void SAL_CALL SwVbaRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException) - { - // default type is wdPageBreak; - sal_Int32 nBreakType = word::WdBreakType::wdPageBreak; -@@ -145,7 +156,7 @@ void SAL_CALL SwVbaBaseRange::InsertBreak( const uno::Any& _breakType ) throw (u - switch( nBreakType ) - { - case word::WdBreakType::wdPageBreak: -- eBreakType = style::BreakType_PAGE_AFTER; -+ eBreakType = style::BreakType_PAGE_BEFORE; - break; - case word::WdBreakType::wdColumnBreak: - eBreakType = style::BreakType_COLUMN_AFTER; -@@ -177,110 +188,145 @@ void SAL_CALL SwVbaBaseRange::InsertBreak( const uno::Any& _breakType ) throw (u - } - } - --rtl::OUString& --SwVbaBaseRange::getServiceImplName() -+void SAL_CALL -+SwVbaRange::Select() throw ( uno::RuntimeException ) - { -- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaBaseRange") ); -- return sImplName; -+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW ); -+ uno::Reference< text::XTextViewCursor > xTextViewCursor = word::getXTextViewCursor( xModel ); -+ xTextViewCursor->gotoRange( mxTextCursor->getStart(), sal_False ); -+ xTextViewCursor->gotoRange( mxTextCursor->getEnd(), sal_True ); - } - --uno::Sequence< rtl::OUString > --SwVbaBaseRange::getServiceNames() -+void SAL_CALL -+SwVbaRange::InsertParagraph() throw ( uno::RuntimeException ) - { -- static uno::Sequence< rtl::OUString > aServiceNames; -- if ( aServiceNames.getLength() == 0 ) -- { -- aServiceNames.realloc( 1 ); -- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.BaseRange" ) ); -- } -- return aServiceNames; -+ mxTextCursor->setString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("") ) ); -+ InsertParagraphBefore(); - } - -+void SAL_CALL -+SwVbaRange::InsertParagraphBefore() throw ( uno::RuntimeException ) -+{ -+ uno::Reference< text::XTextRange > xTextRange = mxTextCursor->getStart(); -+ mxText->insertControlCharacter( xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, sal_True ); -+ mxTextCursor->gotoRange( xTextRange, sal_True ); -+} - --/* --* class SwVbaDocRange --*/ --class SwVbaDocRange : public SwVbaBaseRange -+void SAL_CALL -+SwVbaRange::InsertParagraphAfter() throw ( uno::RuntimeException ) - { --public: -- SwVbaDocRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, -- const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextRange >& rStart, -- const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument = sal_False ) -- throw ( uno::RuntimeException ); -- virtual ~SwVbaDocRange(); --}; -- --SwVbaDocRange::SwVbaDocRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, -- const uno::Reference< text::XTextDocument >& rDocument, const uno::Reference< text::XTextRange >& rStart, -- const uno::Reference< text::XTextRange >& rEnd, const uno::Reference< text::XText >& rText, sal_Bool _bMaySpanEndOfDocument ) throw ( uno::RuntimeException ) : SwVbaBaseRange( rParent, rContext ) -+ uno::Reference< text::XTextRange > xTextRange = mxTextCursor->getEnd(); -+ mxText->insertControlCharacter( xTextRange, text::ControlCharacter::PARAGRAPH_BREAK, sal_True ); -+} -+ -+uno::Reference< word::XParagraphFormat > SAL_CALL -+SwVbaRange::getParagraphFormat() throw ( uno::RuntimeException ) - { -- mxTextDocument = rDocument; -- mbMaySpanEndOfDocument = _bMaySpanEndOfDocument; -+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); -+ return uno::Reference< word::XParagraphFormat >( new SwVbaParagraphFormat( this, mxContext, mxTextDocument, xParaProps ) ); -+} - -- if( rText.is() ) -- mxText = rText; -- else -- mxText = mxTextDocument->getText(); -- -- mxTextCursor = SwVbaRangeHelper::initCursor( rStart, mxText ); -- mxTextCursor->collapseToStart(); -+void SAL_CALL -+SwVbaRange::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& /*rParagraphFormat*/ ) throw ( uno::RuntimeException ) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} - -- if( rEnd.is() ) -- mxTextCursor->gotoRange( rEnd, sal_True ); -- else -- mxTextCursor->gotoEnd( sal_True ); -+uno::Reference< word::XStyle > SAL_CALL -+SwVbaRange::getStyle() throw ( uno::RuntimeException ) -+{ -+ rtl::OUString aStyleName; -+ rtl::OUString aStyleType; -+ uno::Reference< beans::XPropertySet > xProp( mxTextCursor, uno::UNO_QUERY_THROW ); -+ if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() ) -+ { -+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") ); -+ } -+ else if( ( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ) ) >>= aStyleName ) && aStyleName.getLength() ) -+ { -+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ); -+ } -+ if( aStyleType.getLength() == 0 ) -+ { -+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() ); -+ } -+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW); -+ uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW ); -+ uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW ); -+ return uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ); - } - --SwVbaDocRange::~SwVbaDocRange() -+void SAL_CALL -+SwVbaRange::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException ) - { -+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); -+ SwVbaStyle::setStyle( xParaProps, rStyle ); - } - --/* --* class SwVbaRange --*/ --SwVbaRange::SwVbaRange( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, -- const uno::Reference< text::XTextDocument >& rTextDocument, const uno::Reference< text::XTextRange >& rStart, const uno::Reference< text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument ) : SwVbaRange_BASE( rParent, rContext ) -+uno::Reference< word::XFont > SAL_CALL -+SwVbaRange::getFont() throw ( uno::RuntimeException ) - { -- uno::Reference< text::XText > xText; -- mxActualRange = uno::Reference< word::XRange > ( new SwVbaDocRange( rParent, rContext, rTextDocument, rStart, rEnd, xText, _bMaySpanEndOfDocument ) ); -+ VbaPalette aColors; -+ return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), uno::Reference< beans::XPropertySet >( getXTextRange(), uno::UNO_QUERY_THROW ) ); - } - --SwVbaRange::~SwVbaRange() -+::sal_Int32 SAL_CALL SwVbaRange::getLanguageID() throw (uno::RuntimeException) - { -+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); -+ return SwVbaStyle::getLanguageID( xParaProps ); - } - --uno::Reference< text::XTextRange > --SwVbaRange::getXTextRange() throw (uno::RuntimeException) -+void SAL_CALL SwVbaRange::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException) - { -- uno::Reference< text::XTextRange > xTextRange; -- SwVbaBaseRange* pBaseRange = dynamic_cast< SwVbaBaseRange* >( mxActualRange.get() ); -- if( pBaseRange ) -- xTextRange = pBaseRange->getXTextRange(); -- return xTextRange; -+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); -+ SwVbaStyle::setLanguageID( xParaProps, _languageid ); - } - --rtl::OUString SAL_CALL --SwVbaRange::getText() throw ( uno::RuntimeException ) -+uno::Any SAL_CALL -+SwVbaRange::PageSetup( ) throw (uno::RuntimeException) - { -- rtl::OUString aText; -- if( mxActualRange.is() ) -- return mxActualRange->getText(); -- return aText; -+ uno::Reference< beans::XPropertySet > xParaProps( mxTextCursor, uno::UNO_QUERY_THROW ); -+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW ); -+ rtl::OUString aPageStyleName; -+ xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyleName"))) >>= aPageStyleName; -+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( xModel, uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XNameAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW ); -+ uno::Reference< beans::XPropertySet > xPageProps( xPageStyles->getByName( aPageStyleName ), uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, xModel, xPageProps ) ) ); - } - --void SAL_CALL --SwVbaRange::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException ) -+::sal_Int32 SAL_CALL SwVbaRange::getStart() throw (uno::RuntimeException) - { -- if( mxActualRange.is() ) -- mxActualRange->setText( rText ); -+ uno::Reference< text::XText > xText = mxTextDocument->getText(); -+ return SwVbaRangeHelper::getPosition( xText, mxTextCursor->getStart() ); - } - --void SAL_CALL SwVbaRange::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException) -+void SAL_CALL SwVbaRange::setStart( ::sal_Int32 _start ) throw (uno::RuntimeException) - { -- if( mxActualRange.is() ) -- mxActualRange->InsertBreak( _breakType ); -+ uno::Reference< text::XText > xText = mxTextDocument->getText(); -+ uno::Reference< text::XTextRange > xStart = SwVbaRangeHelper::getRangeByPosition( xText, _start ); -+ uno::Reference< text::XTextRange > xEnd = mxTextCursor->getEnd(); -+ -+ mxTextCursor->gotoRange( xStart, sal_False ); -+ mxTextCursor->gotoRange( xEnd, sal_True ); - } -- -+ -+::sal_Int32 SAL_CALL SwVbaRange::getEnd() throw (uno::RuntimeException) -+{ -+ uno::Reference< text::XText > xText = mxTextDocument->getText(); -+ return SwVbaRangeHelper::getPosition( xText, mxTextCursor->getEnd() ); -+} -+ -+void SAL_CALL SwVbaRange::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeException) -+{ -+ uno::Reference< text::XText > xText = mxTextDocument->getText(); -+ uno::Reference< text::XTextRange > xEnd = SwVbaRangeHelper::getRangeByPosition( xText, _end ); -+ -+ mxTextCursor->collapseToStart(); -+ mxTextCursor->gotoRange( xEnd, sal_True ); -+} -+ - rtl::OUString& - SwVbaRange::getServiceImplName() - { -diff --git sw/source/ui/vba/vbarange.hxx sw/source/ui/vba/vbarange.hxx -index f126527..abce5b7 100644 ---- sw/source/ui/vba/vbarange.hxx -+++ sw/source/ui/vba/vbarange.hxx -@@ -31,32 +31,60 @@ - #define SW_VBA_RANGE_HXX - - #include <ooo/vba/word/XRange.hpp> -+#include <ooo/vba/word/XParagraphFormat.hpp> -+#include <ooo/vba/word/XFont.hpp> - #include <vbahelper/vbahelperinterface.hxx> - #include <cppuhelper/implbase1.hxx> - #include <com/sun/star/text/XTextRange.hpp> - #include <com/sun/star/text/XTextDocument.hpp> -+#include <ooo/vba/word/XStyle.hpp> - - typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XRange > SwVbaRange_BASE; - - class SwVbaRange : public SwVbaRange_BASE - { - private: -- css::uno::Reference< ooo::vba::word::XRange > mxActualRange; -+ css::uno::Reference< css::text::XTextDocument > mxTextDocument; -+ css::uno::Reference< css::text::XTextCursor > mxTextCursor; -+ css::uno::Reference< css::text::XText > mxText; -+ sal_Bool mbMaySpanEndOfDocument; - -+private: -+ void initialize( const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd ) throw (css::uno::RuntimeException); - public: -- SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, -- const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False ); -+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException); -+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException); -+ SwVbaRange( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rTextDocument, const css::uno::Reference< css::text::XTextRange >& rStart, const css::uno::Reference< css::text::XTextRange >& rEnd, const css::uno::Reference< css::text::XText >& rText, sal_Bool _bMaySpanEndOfDocument = sal_False ) throw (css::uno::RuntimeException); - virtual ~SwVbaRange(); -+ css::uno::Reference< css::text::XTextDocument > getDocument() { return mxTextDocument; } - -- css::uno::Reference< css::text::XTextRange > getXTextRange() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getXTextRange() throw (css::uno::RuntimeException); -+ void setXTextRange( const css::uno::Reference< css::text::XTextRange >& xRange ) throw (css::uno::RuntimeException); -+ css::uno::Reference< css::text::XText > getXText() { return mxText; } -+ void setXTextCursor( const css::uno::Reference< css::text::XTextCursor >& xTextCursor ) { mxTextCursor = xTextCursor; } - - // Attribute - virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); - virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException); - -- // Methods -- virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException); -- -+ virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException); -+ // Methods -+ virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL Select() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL InsertParagraphAfter() throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getLanguageID() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL PageSetup() throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getStart() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException); - - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); -diff --git sw/source/ui/vba/vbarangehelper.cxx sw/source/ui/vba/vbarangehelper.cxx -index 61ced2c..5df01b8 100644 ---- sw/source/ui/vba/vbarangehelper.cxx -+++ sw/source/ui/vba/vbarangehelper.cxx -@@ -29,6 +29,7 @@ - ************************************************************************/ - #include "vbarangehelper.hxx" - #include <com/sun/star/text/ControlCharacter.hpp> -+#include <com/sun/star/text/XTextRangeCompare.hpp> - - using namespace ::ooo::vba; - using namespace ::com::sun::star; -@@ -141,3 +142,33 @@ uno::Reference< text::XTextCursor > SwVbaRangeHelper::initCursor( const uno::Ref - } - return xTextCursor; - } -+ -+sal_Int32 SwVbaRangeHelper::getPosition( const uno::Reference< text::XText >& rText, const uno::Reference< text::XTextRange >& rTextRange ) throw ( uno::RuntimeException ) -+{ -+ sal_Int32 nPosition = -1; -+ if( rText.is() && rTextRange.is() ) -+ { -+ nPosition = 0; -+ uno::Reference< text::XTextCursor > xCursor = rText->createTextCursor(); -+ xCursor->collapseToStart(); -+ uno::Reference< text::XTextRangeCompare > xCompare( rText, uno::UNO_QUERY_THROW ); -+ // compareValue is 0 if the ranges are equal -+ sal_Int32 nCompareValue = xCompare->compareRegionStarts( xCursor->getStart(), rTextRange ); -+ sal_Bool canGo = sal_True; -+ -+ while( nCompareValue !=0 && canGo ) -+ { -+ canGo = xCursor->goRight( 1, sal_False ); -+ nCompareValue = xCompare->compareRegionStarts( xCursor->getStart(), rTextRange ); -+ nPosition++; -+ } -+ -+ // check fails: no correct position found -+ if( !canGo && nCompareValue != 0 ) -+ { -+ nPosition = -1; -+ } -+ } -+ -+ return nPosition; -+} -diff --git sw/source/ui/vba/vbarangehelper.hxx sw/source/ui/vba/vbarangehelper.hxx -index 3e5a281..5e47899 100644 ---- sw/source/ui/vba/vbarangehelper.hxx -+++ sw/source/ui/vba/vbarangehelper.hxx -@@ -40,6 +40,7 @@ public: - static css::uno::Reference< css::text::XTextRange > getRangeByPosition( const css::uno::Reference< css::text::XText >& rText, sal_Int32 _position )throw ( css::uno::RuntimeException ); - static void insertString( css::uno::Reference< css::text::XTextRange >& rTextRange, css::uno::Reference< css::text::XText >& rText, const rtl::OUString& rStr, sal_Bool _bAbsorb ) throw ( css::uno::RuntimeException ); - static css::uno::Reference< css::text::XTextCursor > initCursor( const css::uno::Reference< css::text::XTextRange >& rTextRange, const css::uno::Reference< css::text::XText >& rText ) throw ( css::uno::RuntimeException ); -+ static sal_Int32 getPosition( const css::uno::Reference< css::text::XText >& rText, const css::uno::Reference< css::text::XTextRange >& rTextRange ) throw ( css::uno::RuntimeException ); - - }; - #endif /* SW_VBA_RANGEHELPER_HXX */ -diff --git sw/source/ui/vba/vbareplacement.cxx sw/source/ui/vba/vbareplacement.cxx -new file mode 100644 -index 0000000..abf85f3 ---- /dev/null -+++ sw/source/ui/vba/vbareplacement.cxx -@@ -0,0 +1,74 @@ -+/************************************************************************* -+ * -+ * 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 "vbareplacement.hxx" -+#include <vbahelper/vbahelper.hxx> -+#include <tools/diagnose_ex.h> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+SwVbaReplacement::SwVbaReplacement( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< util::XPropertyReplace >& xPropertyReplace ) throw ( uno::RuntimeException ) : -+ SwVbaReplacement_BASE( rParent, rContext ), mxPropertyReplace( xPropertyReplace ) -+{ -+} -+ -+SwVbaReplacement::~SwVbaReplacement() -+{ -+} -+ -+::rtl::OUString SAL_CALL SwVbaReplacement::getText() throw (uno::RuntimeException) -+{ -+ return mxPropertyReplace->getReplaceString(); -+} -+ -+void SAL_CALL SwVbaReplacement::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException) -+{ -+ mxPropertyReplace->setReplaceString( _text ); -+} -+ -+rtl::OUString& -+SwVbaReplacement::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaReplacement") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaReplacement::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Replacement" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbareplacement.hxx sw/source/ui/vba/vbareplacement.hxx -new file mode 100644 -index 0000000..d590a1d ---- /dev/null -+++ sw/source/ui/vba/vbareplacement.hxx -@@ -0,0 +1,57 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_REPLACEMENT_HXX -+#define SW_VBA_REPLACEMENT_HXX -+ -+#include <ooo/vba/word/XReplacement.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <cppuhelper/implbase1.hxx> -+#include <com/sun/star/util/XPropertyReplace.hpp> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XReplacement > SwVbaReplacement_BASE; -+ -+class SwVbaReplacement : public SwVbaReplacement_BASE -+{ -+private: -+ css::uno::Reference< css::util::XPropertyReplace> mxPropertyReplace; -+ -+public: -+ SwVbaReplacement( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::util::XPropertyReplace >& xPropertyReplace ) throw ( css::uno::RuntimeException ); -+ virtual ~SwVbaReplacement(); -+ -+ // Attributes -+ virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+#endif /* SW_VBA_REPLACEMENT_HXX */ -diff --git sw/source/ui/vba/vbasection.cxx sw/source/ui/vba/vbasection.cxx -new file mode 100644 -index 0000000..306ed26 ---- /dev/null -+++ sw/source/ui/vba/vbasection.cxx -@@ -0,0 +1,90 @@ -+/************************************************************************* -+ * -+ * 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 "vbasection.hxx" -+#include <vbahelper/vbahelper.hxx> -+#include <tools/diagnose_ex.h> -+#include "vbapagesetup.hxx" -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+SwVbaSection::SwVbaSection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xProps ) throw ( uno::RuntimeException ) : -+ SwVbaSection_BASE( rParent, rContext ), mxModel( xModel ), mxPageProps( xProps ) -+{ -+} -+ -+SwVbaSection::~SwVbaSection() -+{ -+} -+ -+::sal_Bool SAL_CALL SwVbaSection::getProtectedForForms() throw (uno::RuntimeException) -+{ -+ return sal_False; -+} -+ -+void SAL_CALL SwVbaSection::setProtectedForForms( ::sal_Bool _protectedforforms ) throw (uno::RuntimeException) -+{ -+} -+ -+uno::Any SAL_CALL SwVbaSection::Headers( ) throw (uno::RuntimeException) -+{ -+ return uno::Any(); -+} -+ -+uno::Any SAL_CALL SwVbaSection::Footers( ) throw (uno::RuntimeException) -+{ -+ return uno::Any(); -+} -+ -+uno::Any SAL_CALL -+SwVbaSection::PageSetup( ) throw (uno::RuntimeException) -+{ -+ return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, mxPageProps ) ) ); -+} -+ -+rtl::OUString& -+SwVbaSection::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSection") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaSection::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Section" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbasection.hxx sw/source/ui/vba/vbasection.hxx -new file mode 100644 -index 0000000..92a65f3 ---- /dev/null -+++ sw/source/ui/vba/vbasection.hxx -@@ -0,0 +1,62 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_SECTION_HXX -+#define SW_VBA_SECTION_HXX -+ -+#include <ooo/vba/word/XSection.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <cppuhelper/implbase1.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSection > SwVbaSection_BASE; -+ -+class SwVbaSection : public SwVbaSection_BASE -+{ -+private: -+ css::uno::Reference< css::frame::XModel > mxModel; -+ css::uno::Reference< css::beans::XPropertySet > mxPageProps; -+ -+public: -+ SwVbaSection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::beans::XPropertySet >& xProps ) throw ( css::uno::RuntimeException ); -+ virtual ~SwVbaSection(); -+ -+ // Attributes -+ virtual ::sal_Bool SAL_CALL getProtectedForForms() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setProtectedForForms( ::sal_Bool _protectedforforms ) throw (css::uno::RuntimeException); -+ -+ // Methods -+ virtual css::uno::Any SAL_CALL Headers( ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Footers( ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+#endif /* SW_VBA_SECTION_HXX */ -diff --git sw/source/ui/vba/vbasections.cxx sw/source/ui/vba/vbasections.cxx -new file mode 100644 -index 0000000..8fca880 ---- /dev/null -+++ sw/source/ui/vba/vbasections.cxx -@@ -0,0 +1,190 @@ -+/************************************************************************* -+ * -+ * 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 "vbasections.hxx" -+#include "vbasection.hxx" -+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> -+#include <com/sun/star/style/XStyle.hpp> -+#include <docsh.hxx> -+#include <doc.hxx> -+#include "wordvbahelper.hxx" -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+typedef ::cppu::WeakImplHelper1< container::XEnumeration > SectionEnumeration_BASE; -+typedef ::cppu::WeakImplHelper2< container::XIndexAccess, container::XEnumerationAccess > SectionCollectionHelper_Base; -+typedef std::vector< uno::Reference< beans::XPropertySet > > XSectionVec; -+ -+class SectionEnumeration : public SectionEnumeration_BASE -+{ -+ XSectionVec mxSections; -+ XSectionVec::iterator mIt; -+ -+public: -+ SectionEnumeration( const XSectionVec& rVec ) : mxSections( rVec ), mIt( mxSections.begin() ) {} -+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -+ { -+ return ( mIt != mxSections.end() ); -+ } -+ -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( hasMoreElements() ) -+ return uno::makeAny( *mIt++ ); -+ throw container::NoSuchElementException(); -+ } -+}; -+ -+// here I regard pagestyle as section -+class SectionCollectionHelper : public SectionCollectionHelper_Base -+{ -+private: -+ uno::Reference< XHelperInterface > mxParent; -+ uno::Reference< uno::XComponentContext > mxContext; -+ uno::Reference< frame::XModel > mxModel; -+ XSectionVec mxSections; -+ -+public: -+ SectionCollectionHelper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : mxParent( xParent ), mxContext( xContext ), mxModel( xModel ) -+ { -+ uno::Reference< style::XStyleFamiliesSupplier > xSytleFamSupp( mxModel, uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XNameAccess > xSytleFamNames( xSytleFamSupp->getStyleFamilies(), uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XIndexAccess > xPageStyles( xSytleFamNames->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageStyles") ) ), uno::UNO_QUERY_THROW ); -+ sal_Int32 nCount = xPageStyles->getCount(); -+ for( sal_Int32 index = 0; index < nCount; ++index ) -+ { -+ uno::Reference< style::XStyle > xStyle( xPageStyles->getByIndex( index ), uno::UNO_QUERY_THROW ); -+ // only the pagestyles in using are considered -+ if( xStyle->isInUse( ) ) -+ { -+ uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW ); -+ mxSections.push_back( xPageProps ); -+ } -+ } -+ } -+ -+ ~SectionCollectionHelper(){} -+ -+ // XIndexAccess -+ virtual sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) -+ { -+ return mxSections.size(); -+ } -+ virtual uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( Index < 0 || Index >= getCount() ) -+ throw css::lang::IndexOutOfBoundsException(); -+ -+ uno::Reference< beans::XPropertySet > xPageProps( mxSections[ Index ], uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XSection >( new SwVbaSection( mxParent, mxContext, mxModel, xPageProps ) ) ); -+ } -+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) -+ { -+ return word::XSection::static_type(0); -+ } -+ virtual sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) -+ { -+ return sal_True; -+ } -+ // XEnumerationAccess -+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) -+ { -+ return new SectionEnumeration( mxSections ); -+ } -+}; -+ -+class SectionsEnumWrapper : public EnumerationHelperImpl -+{ -+ uno::Reference< frame::XModel > mxModel; -+ uno::WeakReference< XHelperInterface > mxParent; -+public: -+ SectionsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), mxModel( xModel ), mxParent( xParent ) {} -+ -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ uno::Reference< beans::XPropertySet > xPageProps( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XSection > ( new SwVbaSection( mxParent, m_xContext, mxModel, xPageProps ) ) ); -+ } -+}; -+ -+SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel ) -+{ -+} -+ -+uno::Any SAL_CALL -+SwVbaSections::PageSetup( ) throw (uno::RuntimeException) -+{ -+ if( m_xIndexAccess->getCount() ) -+ { -+ // check if the first section is our want -+ uno::Reference< word::XSection > xSection( m_xIndexAccess->getByIndex( 0 ), uno::UNO_QUERY_THROW ); -+ return xSection->PageSetup(); -+ } -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("There is no section") ), uno::Reference< uno::XInterface >() ); -+} -+ -+// XEnumerationAccess -+uno::Type SAL_CALL -+SwVbaSections::getElementType() throw (uno::RuntimeException) -+{ -+ return word::XSection::static_type(0); -+} -+ -+uno::Reference< container::XEnumeration > SAL_CALL -+SwVbaSections::createEnumeration() throw (uno::RuntimeException) -+{ -+ uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); -+ return new SectionsEnumWrapper( this, mxContext, xEnumAccess->createEnumeration(), mxModel ); -+} -+ -+uno::Any -+SwVbaSections::createCollectionObject( const css::uno::Any& aSource ) -+{ -+ return aSource; -+} -+ -+rtl::OUString& -+SwVbaSections::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaSections") ); -+ return sImplName; -+} -+ -+css::uno::Sequence<rtl::OUString> -+SwVbaSections::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > sNames; -+ if ( sNames.getLength() == 0 ) -+ { -+ sNames.realloc( 1 ); -+ sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Sections") ); -+ } -+ return sNames; -+} -diff --git sw/source/ui/vba/vbasections.hxx sw/source/ui/vba/vbasections.hxx -new file mode 100644 -index 0000000..1ff9e9e ---- /dev/null -+++ sw/source/ui/vba/vbasections.hxx -@@ -0,0 +1,62 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_SECTIONS_HXX -+#define SW_VBA_SECTIONS_HXX -+ -+#include <vbahelper/vbacollectionimpl.hxx> -+#include <ooo/vba/word/XSections.hpp> -+#include <com/sun/star/container/XEnumerationAccess.hpp> -+#include <com/sun/star/container/XIndexAccess.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef CollTestImplHelper< ooo::vba::word::XSections > SwVbaSections_BASE; -+ -+class SwVbaSections : public SwVbaSections_BASE -+{ -+private: -+ css::uno::Reference< css::frame::XModel > mxModel; -+ -+public: -+ SwVbaSections( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ); -+ virtual ~SwVbaSections() {} -+ -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ -+ virtual css::uno::Any SAL_CALL PageSetup( ) throw (css::uno::RuntimeException); -+ -+ // SwVbaSections_BASE -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif /* SW_VBA_SECTIONS_HXX */ -diff --git sw/source/ui/vba/vbaselection.cxx sw/source/ui/vba/vbaselection.cxx -index ceb7bb1..b85c2d7 100644 ---- sw/source/ui/vba/vbaselection.cxx -+++ sw/source/ui/vba/vbaselection.cxx -@@ -30,28 +30,635 @@ - #include "vbaselection.hxx" - #include <vbahelper/vbahelper.hxx> - #include <tools/diagnose_ex.h> -+#include "vbarange.hxx" -+#include "vbafind.hxx" -+#include "wordvbahelper.hxx" -+#include <com/sun/star/text/XTextRange.hpp> -+#include <com/sun/star/text/XTextTable.hpp> -+#include <com/sun/star/text/XTextTableCursor.hpp> -+#include <com/sun/star/text/ControlCharacter.hpp> -+#include <com/sun/star/table/XCell.hpp> -+#include <ooo/vba/word/WdUnits.hpp> -+#include <ooo/vba/word/WdMovementType.hpp> -+#include <ooo/vba/word/WdGoToItem.hpp> -+#include <ooo/vba/word/WdGoToDirection.hpp> -+#include <ooo/vba/word/XBookmark.hpp> -+#include <ooo/vba/word/XApplication.hpp> -+#include <com/sun/star/text/XPageCursor.hpp> -+#include "unotbl.hxx" -+#include "unocoll.hxx" -+#include "vbatable.hxx" -+#include <com/sun/star/view/XSelectionSupplier.hpp> -+#include <com/sun/star/view/XViewCursor.hpp> -+#include <ooo/vba/word/WdInformation.hpp> -+#include <ooo/vba/word/WdHeaderFooterIndex.hpp> -+#include "vbainformationhelper.hxx" -+#include "vbafield.hxx" -+#include "vbaheaderfooter.hxx" -+#include "vbaheaderfooterhelper.hxx" -+#include <vbahelper/vbashaperange.hxx> -+#include <com/sun/star/drawing/XDrawPageSupplier.hpp> -+#include <com/sun/star/drawing/XDrawPage.hpp> - - using namespace ::ooo::vba; - using namespace ::com::sun::star; - --SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel ) -+SwVbaSelection::SwVbaSelection( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) : SwVbaSelection_BASE( rParent, rContext ), mxModel( rModel ) - { -+ mxTextViewCursor = word::getXTextViewCursor( mxModel ); - } - - SwVbaSelection::~SwVbaSelection() - { - } - -+uno::Reference< text::XTextRange > SwVbaSelection::GetSelectedRange() throw ( uno::RuntimeException ) -+{ -+ uno::Reference< text::XTextRange > xTextRange; -+ uno::Reference< lang::XServiceInfo > xServiceInfo( mxModel->getCurrentSelection(), uno::UNO_QUERY_THROW ); -+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextRanges") ) ) ) -+ { -+ uno::Reference< container::XIndexAccess > xTextRanges( xServiceInfo, uno::UNO_QUERY_THROW ); -+ if( xTextRanges->getCount() > 0 ) -+ { -+ // if there are multipul selection, just return the last selected Range. -+ xTextRange.set( xTextRanges->getByIndex( xTextRanges->getCount()-1 ), uno::UNO_QUERY_THROW ); -+ } -+ } -+ else -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ } -+ return xTextRange; -+} -+ -+uno::Reference< word::XRange > SAL_CALL -+SwVbaSelection::getRange() throw ( uno::RuntimeException ) -+{ -+ uno::Reference< text::XTextRange > xTextRange = GetSelectedRange(); -+ uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW ); -+ return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xTextRange->getStart(), xTextRange->getEnd(), mxTextViewCursor->getText() ) ); -+} -+ - rtl::OUString SAL_CALL - SwVbaSelection::getText() throw ( uno::RuntimeException ) - { -- rtl::OUString aText; -- return aText; -+ return getRange()->getText(); - } - - void SAL_CALL - SwVbaSelection::setText( const rtl::OUString& rText ) throw ( uno::RuntimeException ) - { -+ getRange()->setText( rText ); -+} -+ -+void SAL_CALL -+SwVbaSelection::TypeText( const rtl::OUString& rText ) throw ( uno::RuntimeException ) -+{ -+ // FIXME: handle the property Options.ReplaceSelection, the default value is TRUE -+ setText( rText ); -+} -+ -+void SAL_CALL -+SwVbaSelection::HomeKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException ) -+{ -+ sal_Int32 nUnit = word::WdUnits::wdLine; -+ sal_Int32 nExtend = word::WdMovementType::wdMove; -+ _unit >>= nUnit; -+ _extend >>= nExtend; -+ -+ switch( nUnit ) -+ { -+ case word::WdUnits::wdStory: -+ { -+ // go to the begin of the document -+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfDoc")); -+ dispatchRequests( mxModel,url ); -+ // If something is selected, it needs to go twice -+ dispatchRequests( mxModel,url ); -+ break; -+ } -+ case word::WdUnits::wdLine: -+ { -+ // go to the begin of the Line -+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToStartOfLine")); -+ dispatchRequests( mxModel,url ); -+ break; -+ } -+ default: -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ break; -+ } -+ } -+} -+ -+void SAL_CALL -+SwVbaSelection::EndKey( const uno::Any& _unit, const uno::Any& _extend ) throw ( uno::RuntimeException ) -+{ -+ sal_Int32 nUnit = word::WdUnits::wdLine; -+ sal_Int32 nExtend = word::WdMovementType::wdMove; -+ _unit >>= nUnit; -+ _extend >>= nExtend; -+ -+ switch( nUnit ) -+ { -+ case word::WdUnits::wdStory: -+ { -+ // go to the end of the document -+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfDoc")); -+ dispatchRequests( mxModel,url ); -+ // If something is selected, it needs to go twice -+ dispatchRequests( mxModel,url ); -+ break; -+ } -+ case word::WdUnits::wdLine: -+ { -+ // go to the end of the Line -+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoToEndOfLine")); -+ dispatchRequests( mxModel,url ); -+ break; -+ } -+ default: -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ break; -+ } -+ } -+} -+ -+void SAL_CALL -+SwVbaSelection::Delete( const uno::Any& _unit, const uno::Any& _count ) throw ( uno::RuntimeException ) -+{ -+ // FIXME: handle the arguments: _unit and _count -+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Delete")); -+ dispatchRequests( mxModel,url ); -+} -+ -+void SwVbaSelection::NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( uno::RuntimeException ) -+{ -+ uno::Reference< beans::XPropertySet > xCursorProps( mxTextViewCursor, uno::UNO_QUERY_THROW ); -+ uno::Reference< text::XTextTable > xTextTable; -+ uno::Reference< table::XCell > xCell; -+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextTable; -+ xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cell") ) ) >>= xCell; -+ if( !xTextTable.is() || !xCell.is() ) -+ { -+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); -+ return; -+ } -+ uno::Reference< beans::XPropertySet > xCellProps( xCell, uno::UNO_QUERY_THROW ); -+ rtl::OUString aCellName; -+ xCellProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellName") ) ) >>= aCellName; -+ uno::Reference< text::XTextTableCursor > xTextTableCursor = xTextTable->createCursorByCellName( aCellName ); -+ // move the table cursor -+ switch( eDirection ) -+ { -+ case MOVE_LEFT: -+ { -+ xTextTableCursor->goLeft( nCount, sal_False ); -+ break; -+ } -+ case MOVE_RIGHT: -+ { -+ xTextTableCursor->goRight( nCount, sal_False ); -+ break; -+ } -+ case MOVE_UP: -+ { -+ xTextTableCursor->goUp( nCount, sal_False ); -+ break; -+ } -+ case MOVE_DOWN: -+ { -+ xTextTableCursor->goDown( nCount, sal_False ); -+ break; -+ } -+ default: -+ { -+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); -+ return; -+ } -+ } -+ // move the view cursor -+ xCell = xTextTable->getCellByName( xTextTableCursor->getRangeName() ); -+ mxTextViewCursor->gotoRange( uno::Reference< text::XTextRange >( xCell, uno::UNO_QUERY_THROW ), sal_False ); -+} -+ -+void SAL_CALL -+SwVbaSelection::MoveRight( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException ) -+{ -+ sal_Int32 nUnit = word::WdUnits::wdCharacter; -+ sal_Int32 nCount = 1; -+ sal_Int32 nExtend = word::WdMovementType::wdMove; -+ -+ if( _unit.hasValue() ) -+ _unit >>= nUnit; -+ if( _count.hasValue() ) -+ _count >>= nCount; -+ if( _extend.hasValue() ) -+ _extend >>= nExtend; -+ -+ if( nCount == 0 ) -+ return; -+ -+ if( nCount < 0 ) -+ { -+ // TODO: call MoveLeft; -+ MoveLeft( _unit, uno::makeAny( -nCount ), _extend ); -+ return; -+ } -+ -+ switch( nUnit ) -+ { -+ case word::WdUnits::wdCell: -+ { -+ if( nExtend == word::WdMovementType::wdExtend ) -+ { -+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); -+ return; -+ } -+ NextCell( nCount, MOVE_RIGHT ); -+ break; -+ } -+ default: -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ break; -+ } -+ } -+ -+} -+ -+void SAL_CALL -+SwVbaSelection::MoveLeft( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException ) -+{ -+ sal_Int32 nUnit = word::WdUnits::wdCharacter; -+ sal_Int32 nCount = 1; -+ sal_Int32 nExtend = word::WdMovementType::wdMove; -+ -+ if( _unit.hasValue() ) -+ _unit >>= nUnit; -+ if( _count.hasValue() ) -+ _count >>= nCount; -+ if( _extend.hasValue() ) -+ _extend >>= nExtend; -+ -+ if( nCount == 0 ) -+ return; -+ -+ if( nCount < 0 ) -+ { -+ MoveRight( _unit, uno::makeAny( -nCount ), _extend ); -+ return; -+ } -+ -+ switch( nUnit ) -+ { -+ case word::WdUnits::wdCell: -+ { -+ if( nExtend == word::WdMovementType::wdExtend ) -+ { -+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); -+ return; -+ } -+ NextCell( nCount, MOVE_LEFT ); -+ break; -+ } -+ default: -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ break; -+ } -+ } -+ -+} -+ -+void SAL_CALL -+SwVbaSelection::MoveDown( const uno::Any& _unit, const uno::Any& _count, const uno::Any& _extend ) throw ( uno::RuntimeException ) -+{ -+ sal_Int32 nUnit = word::WdUnits::wdCharacter; -+ sal_Int32 nCount = 1; -+ sal_Int32 nExtend = word::WdMovementType::wdMove; -+ -+ if( _unit.hasValue() ) -+ _unit >>= nUnit; -+ if( _count.hasValue() ) -+ _count >>= nCount; -+ if( _extend.hasValue() ) -+ _extend >>= nExtend; -+ -+ if( nCount == 0 ) -+ return; -+ -+ if( nCount < 0 ) -+ { -+ // TODO: call MoveLeft; -+ //MoveUp( _unit, uno::makeAny( -nCount ), _extend ); -+ return; -+ } -+ -+ switch( nUnit ) -+ { -+ case word::WdUnits::wdLine: -+ { -+ uno::Reference< view::XViewCursor > xViewCursor( mxTextViewCursor, uno::UNO_QUERY_THROW ); -+ sal_Bool bExpand = ( nExtend == word::WdMovementType::wdMove ) ? sal_False : sal_True; -+ xViewCursor->goDown( nCount, bExpand ); -+ break; -+ } -+ default: -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ break; -+ } -+ } -+ -+} -+ -+void SAL_CALL -+SwVbaSelection::TypeParagraph() throw ( uno::RuntimeException ) -+{ -+ // #FIXME: if the selection is an entire paragraph, it's replaced -+ // by the new paragraph -+ sal_Bool isCollapsed = mxTextViewCursor->isCollapsed(); -+ InsertParagraph(); -+ if( isCollapsed ) -+ mxTextViewCursor->collapseToStart(); -+} -+ -+void SAL_CALL -+SwVbaSelection::InsertParagraph() throw ( uno::RuntimeException ) -+{ -+ // #FIME: the selection should include the new paragraph. -+ getRange()->InsertParagraph(); -+} -+ -+void SAL_CALL -+SwVbaSelection::InsertParagraphBefore() throw ( uno::RuntimeException ) -+{ -+ getRange()->InsertParagraphBefore(); -+} -+ -+void SAL_CALL -+SwVbaSelection::InsertParagraphAfter() throw ( uno::RuntimeException ) -+{ -+ getRange()->InsertParagraphAfter(); -+} -+ -+uno::Reference< word::XParagraphFormat > SAL_CALL -+SwVbaSelection::getParagraphFormat() throw ( uno::RuntimeException ) -+{ -+ return getRange()->getParagraphFormat(); -+} -+ -+void SAL_CALL -+SwVbaSelection::setParagraphFormat( const uno::Reference< word::XParagraphFormat >& rParagraphFormat ) throw ( uno::RuntimeException ) -+{ -+ return getRange()->setParagraphFormat( rParagraphFormat ); -+} -+ -+uno::Reference< word::XFind > SAL_CALL -+SwVbaSelection::getFind() throw ( uno::RuntimeException ) -+{ -+ uno::Reference< text::XTextRange > xTextRange = GetSelectedRange(); -+ return uno::Reference< word::XFind >( new SwVbaFind( this, mxContext, mxModel, xTextRange ) ); -+} -+ -+uno::Reference< word::XStyle > SAL_CALL -+SwVbaSelection::getStyle() throw ( uno::RuntimeException ) -+{ -+ return getRange()->getStyle(); -+} -+ -+void SAL_CALL -+SwVbaSelection::setStyle( const uno::Reference< word::XStyle >& rStyle ) throw ( uno::RuntimeException ) -+{ -+ return getRange()->setStyle( rStyle ); -+} -+ -+uno::Reference< word::XFont > SAL_CALL -+SwVbaSelection::getFont() throw ( uno::RuntimeException ) -+{ -+ return getRange()->getFont(); -+} -+ -+void SAL_CALL -+SwVbaSelection::TypeBackspace() throw ( uno::RuntimeException ) -+{ -+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SwBackspace")); -+ dispatchRequests( mxModel,url ); -+} -+ -+uno::Reference< word::XRange > SAL_CALL SwVbaSelection::GoTo( const uno::Any& _what, const uno::Any& _which, const uno::Any& _count, const uno::Any& _name ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nWhat; -+ if( ( _what >>= nWhat ) != sal_True ) -+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); -+ switch( nWhat ) -+ { -+ case word::WdGoToItem::wdGoToBookmark: -+ { -+ rtl::OUString sName; -+ uno::Reference< word::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); -+ uno::Reference< word::XBookmark > xBookmark( xApplication->getActiveDocument()->Bookmarks(_name), uno::UNO_QUERY_THROW ); -+ xBookmark->Select(); -+ //return uno::Reference< word::XRange >( xBookmark->Range(), uno::UNO_QUERY_THROW ); -+ break; -+ } -+ case word::WdGoToItem::wdGoToPage: -+ { -+ uno::Reference< text::XPageCursor > xPageCursor( mxTextViewCursor, uno::UNO_QUERY_THROW ); -+ sal_Int32 nCurrPage = xPageCursor->getPage(); -+ sal_Int32 nLastPage = word::getPageCount( mxModel ); -+ sal_Int32 nCount = 0; -+ if( _count.hasValue() ) -+ _count >>= nCount; -+ sal_Int32 nWhich = 0; -+ if( _which.hasValue() ) -+ _which >>= nWhich; -+ sal_Int32 nPage = 0; -+ switch( nWhich ) -+ { -+ case word::WdGoToDirection::wdGoToLast: -+ { -+ nPage = nLastPage; -+ break; -+ } -+ case word::WdGoToDirection::wdGoToNext: -+ { -+ nPage = nCurrPage + 1; -+ break; -+ } -+ case word::WdGoToDirection::wdGoToPrevious: -+ { -+ nPage = nCurrPage - 1; -+ break; -+ } -+ default: -+ { -+ nPage = nCount; -+ } -+ } -+ if( nPage <= 0 ) -+ nPage = 1; -+ if( nPage > nLastPage ) -+ nPage = nLastPage; -+ xPageCursor->jumpToPage( ( sal_Int16 )( nPage ) ); -+ break; -+ } -+ case word::WdGoToItem::wdGoToSection: -+ { -+ // TODO: implement Section object -+ } -+ default: -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ } -+ return getRange(); -+} -+ -+::sal_Int32 SAL_CALL SwVbaSelection::getLanguageID() throw (uno::RuntimeException) -+{ -+ return getRange()->getLanguageID(); -+} -+ -+void SAL_CALL SwVbaSelection::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException) -+{ -+ getRange()->setLanguageID( _languageid ); -+} -+ -+uno::Any SAL_CALL SwVbaSelection::Information( sal_Int32 _type ) throw (uno::RuntimeException) -+{ -+ uno::Any result; -+ //uno::Reference< view::XSelectionSupplier > xSel( mxModel->getCurrentController(), uno::UNO_QUERY_THROW ); -+ //uno::Any aSelectedObject = xSel->getSelection(); -+ switch( _type ) -+ { -+ case word::WdInformation::wdActiveEndPageNumber: -+ { -+ result = uno::makeAny( SwVbaInformationHelper::handleWdActiveEndPageNumber( mxTextViewCursor ) ); -+ break; -+ } -+ case word::WdInformation::wdNumberOfPagesInDocument: -+ { -+ result = uno::makeAny( SwVbaInformationHelper::handleWdNumberOfPagesInDocument( mxModel ) ); -+ break; -+ } -+ case word::WdInformation::wdVerticalPositionRelativeToPage: -+ { -+ result = uno::makeAny( SwVbaInformationHelper::handleWdVerticalPositionRelativeToPage( mxModel, mxTextViewCursor ) ); -+ break; -+ } -+ default: -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ } -+ // This method fails to restore the previouse selection -+ //xSel->select( aSelectedObject ); -+ return result; -+} -+ -+void SAL_CALL SwVbaSelection::InsertBreak( const uno::Any& _breakType ) throw (uno::RuntimeException) -+{ -+ getRange()->InsertBreak( _breakType ); -+} -+ -+uno::Any SAL_CALL -+SwVbaSelection::Tables( const uno::Any& aIndex ) throw (uno::RuntimeException) -+{ -+ // Hacky implementation due to missing api ( and lack of knowledge ) -+ // we can only support a selection that is a single table -+ if ( !aIndex.hasValue() ) // currently we can't support multiple tables in a selection -+ throw uno::RuntimeException(); -+ // if the current selection is a XTextTableCursor and the index is 1 then we can service this request, otherwise we just have to throw -+ uno::Reference< text::XTextTableCursor > xTextTableCursor( mxModel->getCurrentSelection(), uno::UNO_QUERY ); -+ -+ if ( !xTextTableCursor.is() ) -+ throw uno::RuntimeException(); -+ -+ sal_Int32 nIndex = 0; -+ aIndex >>= nIndex; -+ -+ uno::Any aRet; -+ -+ if ( nIndex != 1 ) -+ throw uno::RuntimeException(); -+ SwXTextTableCursor* pTTCursor = dynamic_cast< SwXTextTableCursor* >( xTextTableCursor.get() ); -+ if ( pTTCursor ) -+ { -+ SwFrmFmt* pFmt = pTTCursor->GetFrmFmt(); -+ rtl::OUString sTableName; -+ if ( pFmt ) -+ { -+ uno::Reference< text::XTextTable > xTbl = SwXTextTables::GetObject(*pFmt); -+ uno::Reference< css::text::XTextDocument > xTextDoc( mxModel, uno::UNO_QUERY_THROW ); -+ uno::Reference< word::XTable > xVBATbl = new SwVbaTable( mxParent, mxContext, xTextDoc, xTbl ); -+ aRet <<= xVBATbl; -+ } -+ } -+ return aRet; -+ -+} -+ -+uno::Any SAL_CALL -+SwVbaSelection::Fields( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, mxModel ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+uno::Reference< word::XHeaderFooter > SAL_CALL -+SwVbaSelection::getHeaderFooter() throw ( uno::RuntimeException ) -+{ -+ uno::Reference< text::XText > xCurrentText = word::getXTextViewCursor( mxModel )->getText(); -+ if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFooter( mxModel, xCurrentText ) ) -+ { -+ uno::Reference< beans::XPropertySet > xPageStyleProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW ); -+ sal_Int32 nIndex = word::WdHeaderFooterIndex::wdHeaderFooterPrimary; -+ sal_Bool isHeader = HeaderFooterHelper::isHeader( mxModel, xCurrentText ); -+ if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) ) -+ nIndex = word::WdHeaderFooterIndex::wdHeaderFooterEvenPages; -+ else if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) || HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) ) -+ nIndex = word::WdHeaderFooterIndex::wdHeaderFooterFirstPage; -+ -+ return uno::Reference< word::XHeaderFooter >( new SwVbaHeaderFooter( this, mxContext, mxModel, xPageStyleProps, isHeader, nIndex ) ); -+ -+ } -+ return uno::Reference< word::XHeaderFooter >(); -+} -+ -+uno::Any SAL_CALL -+SwVbaSelection::ShapeRange( ) throw (uno::RuntimeException) -+{ -+ uno::Reference< drawing::XShapes > xShapes( mxModel->getCurrentSelection(), uno::UNO_QUERY ); -+ -+ if ( !xShapes.is() ) -+ throw uno::RuntimeException(); -+ -+ uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW ); -+ uno::Reference< drawing::XDrawPage > xDrawPage = xDrawPageSupplier->getDrawPage(); -+ uno::Reference< container::XIndexAccess > xShapesAccess( xShapes, uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< msforms::XShapeRange >( new ScVbaShapeRange( this, mxContext, xShapesAccess, xDrawPage ) ) ); -+} -+ -+::sal_Int32 SAL_CALL SwVbaSelection::getStart() throw (uno::RuntimeException) -+{ -+ return getRange()->getStart(); -+} -+ -+void SAL_CALL SwVbaSelection::setStart( ::sal_Int32 _start ) throw (uno::RuntimeException) -+{ -+ getRange()->setStart( _start ); -+} -+::sal_Int32 SAL_CALL SwVbaSelection::getEnd() throw (uno::RuntimeException) -+{ -+ return getRange()->getEnd(); -+} -+ -+void SAL_CALL SwVbaSelection::setEnd( ::sal_Int32 _end ) throw (uno::RuntimeException) -+{ -+ getRange()->setEnd( _end ); - } - - rtl::OUString& -diff --git sw/source/ui/vba/vbaselection.hxx sw/source/ui/vba/vbaselection.hxx -index 4d48068..83994f6 100644 ---- sw/source/ui/vba/vbaselection.hxx -+++ sw/source/ui/vba/vbaselection.hxx -@@ -31,7 +31,14 @@ - #define SW_VBA_SELECTION_HXX - - #include <ooo/vba/word/XSelection.hpp> -+#include <ooo/vba/word/XRange.hpp> - #include <vbahelper/vbahelperinterface.hxx> -+#include <com/sun/star/text/XTextViewCursor.hpp> -+#include <ooo/vba/word/XParagraphFormat.hpp> -+#include <ooo/vba/word/XFind.hpp> -+#include <ooo/vba/word/XStyle.hpp> -+#include <ooo/vba/word/XFont.hpp> -+#include <ooo/vba/word/XHeaderFooter.hpp> - - typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XSelection > SwVbaSelection_BASE; - -@@ -39,6 +46,20 @@ class SwVbaSelection : public SwVbaSelection_BASE - { - private: - css::uno::Reference< css::frame::XModel > mxModel; -+ css::uno::Reference< css::text::XTextViewCursor > mxTextViewCursor; -+ css::uno::Reference< ooo::vba::word::XRange > mxRange; -+ -+ enum E_DIRECTION -+ { -+ MOVE_LEFT = 1, -+ MOVE_RIGHT, -+ MOVE_UP, -+ MOVE_DOWN -+ }; -+ -+private: -+ void NextCell( sal_Int32 nCount, E_DIRECTION eDirection ) throw ( css::uno::RuntimeException ); -+ css::uno::Reference< css::text::XTextRange > GetSelectedRange() throw ( css::uno::RuntimeException ); - - public: - SwVbaSelection( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::frame::XModel >& rModel ) throw ( css::uno::RuntimeException ); -@@ -47,7 +68,38 @@ public: - // Attribute - virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); - virtual void SAL_CALL setText( const rtl::OUString& rText ) throw (css::uno::RuntimeException); -- -+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL getRange() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL HomeKey( const css::uno::Any& _unit, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL EndKey( const css::uno::Any& _unit, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL TypeText( const rtl::OUString& rText ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL Delete( const css::uno::Any& _unit, const css::uno::Any& _count ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL MoveRight( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL MoveLeft( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL MoveDown( const css::uno::Any& _unit, const css::uno::Any& _count, const css::uno::Any& _extend ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL TypeParagraph() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL InsertParagraph() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL InsertParagraphBefore() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL InsertParagraphAfter() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ooo::vba::word::XParagraphFormat > SAL_CALL getParagraphFormat() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setParagraphFormat( const css::uno::Reference< ooo::vba::word::XParagraphFormat >& rParagraphFormat ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ooo::vba::word::XFind > SAL_CALL getFind() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ooo::vba::word::XStyle > SAL_CALL getStyle() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setStyle( const css::uno::Reference< ooo::vba::word::XStyle >& _xStyle ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL TypeBackspace() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ooo::vba::word::XRange > SAL_CALL GoTo( const css::uno::Any& _what, const css::uno::Any& _which, const css::uno::Any& _count, const css::uno::Any& _name ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getLanguageID( ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Information( sal_Int32 _type ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL InsertBreak( const css::uno::Any& _breakType ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Tables( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Fields( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ooo::vba::word::XHeaderFooter > SAL_CALL getHeaderFooter() throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL ShapeRange( ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getStart() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setStart( ::sal_Int32 _start ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getEnd() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setEnd( ::sal_Int32 _end ) throw (css::uno::RuntimeException); - - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); -diff --git sw/source/ui/vba/vbastyle.cxx sw/source/ui/vba/vbastyle.cxx -new file mode 100644 -index 0000000..f75c16b ---- /dev/null -+++ sw/source/ui/vba/vbastyle.cxx -@@ -0,0 +1,152 @@ -+/************************************************************************* -+ * -+ * 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 "vbastyle.hxx" -+#include <ooo/vba/word/WdStyleType.hpp> -+#include <com/sun/star/lang/Locale.hpp> -+#include <i18npool/mslangid.hxx> -+#include "vbafont.hxx" -+#include "vbapalette.hxx" -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+ -+SwVbaStyle::SwVbaStyle( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet ) throw ( script::BasicErrorException, uno::RuntimeException ) : SwVbaStyle_BASE( xParent, xContext ) , mxStyleProps( _xPropertySet ) -+{ -+ mxStyle.set( _xPropertySet, uno::UNO_QUERY_THROW ); -+} -+ -+void SAL_CALL -+SwVbaStyle::setName( const ::rtl::OUString& Name ) throw (uno::RuntimeException) -+{ -+ mxStyle->setName(Name); -+} -+ -+::rtl::OUString SAL_CALL -+SwVbaStyle::getName() throw (uno::RuntimeException) -+{ -+ return mxStyle->getName(); -+} -+ -+sal_Int32 SwVbaStyle::getLanguageID( const uno::Reference< beans::XPropertySet >& xTCProps ) throw (uno::RuntimeException) -+{ -+ lang::Locale aLocale; -+ xTCProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharLocale") ) ) >>= aLocale; -+ return MsLangId::convertLocaleToLanguage( aLocale ); -+} -+ -+void SwVbaStyle::setLanguageID( const uno::Reference< beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (uno::RuntimeException) -+{ -+ lang::Locale aLocale = MsLangId::convertLanguageToLocale( _languageid ); -+ xTCProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharLocale") ), uno::makeAny( aLocale ) ) ; -+} -+ -+::sal_Int32 SAL_CALL SwVbaStyle::getLanguageID() throw (uno::RuntimeException) -+{ -+ return getLanguageID( mxStyleProps ); -+} -+ -+void SAL_CALL SwVbaStyle::setLanguageID( ::sal_Int32 _languageid ) throw (uno::RuntimeException) -+{ -+ setLanguageID( mxStyleProps, _languageid ); -+} -+ -+::sal_Int32 SAL_CALL SwVbaStyle::getType() throw (uno::RuntimeException) -+{ -+ sal_Int32 nType = word::WdStyleType::wdStyleTypeParagraph; -+ uno::Reference< lang::XServiceInfo > xServiceInfo( mxStyle, uno::UNO_QUERY_THROW ); -+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.ParagraphStyle") ) ) ) -+ nType = word::WdStyleType::wdStyleTypeParagraph; -+ else if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.style.CharacterStyle") ) ) ) -+ nType = word::WdStyleType::wdStyleTypeCharacter; -+ else // if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingStyle") ) ) ) -+ nType = word::WdStyleType::wdStyleTypeList; -+ return nType; -+} -+ -+uno::Reference< word::XFont > SAL_CALL -+SwVbaStyle::getFont() throw ( uno::RuntimeException ) -+{ -+ VbaPalette aColors; -+ return new SwVbaFont( mxParent, mxContext, aColors.getPalette(), mxStyleProps ); -+} -+ -+void SwVbaStyle::setStyle( const uno::Reference< beans::XPropertySet >& xTCProps, const uno::Reference< ooo::vba::word::XStyle >& xStyle )throw (uno::RuntimeException) -+{ -+ rtl::OUString aStyleType = getOOoStyleTypeFromMSWord( xStyle->getType() ); -+ xTCProps->setPropertyValue( aStyleType, uno::makeAny( xStyle->getName() ) ); -+} -+ -+rtl::OUString SwVbaStyle::getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType ) -+{ -+ rtl::OUString aStyleType; -+ switch( _wdStyleType ) -+ { -+ case word::WdStyleType::wdStyleTypeParagraph: -+ case word::WdStyleType::wdStyleTypeTable: -+ { -+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaStyleName") ); -+ break; -+ } -+ case word::WdStyleType::wdStyleTypeCharacter: -+ { -+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharStyleName") ); -+ break; -+ } -+ case word::WdStyleType::wdStyleTypeList: -+ { -+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName") ); -+ break; -+ } -+ default: -+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() ); -+ } -+ return aStyleType; -+} -+ -+rtl::OUString& -+SwVbaStyle::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaStyle") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaStyle::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.XStyle" ) ); -+ } -+ return aServiceNames; -+} -diff --git sw/source/ui/vba/vbastyle.hxx sw/source/ui/vba/vbastyle.hxx -new file mode 100644 -index 0000000..9a7f349 ---- /dev/null -+++ sw/source/ui/vba/vbastyle.hxx -@@ -0,0 +1,70 @@ -+/************************************************************************* -+ * -+ * 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 SW_VBA_STYLE_HXX -+#define SW_VBA_STYLE_HXX -+#include <ooo/vba/word/XStyle.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <com/sun/star/frame/XModel.hpp> -+#include <com/sun/star/container/XNameContainer.hpp> -+#include <com/sun/star/style/XStyle.hpp> -+#include <ooo/vba/word/XFont.hpp> -+ -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XStyle > SwVbaStyle_BASE; -+ -+class SwVbaStyle : public SwVbaStyle_BASE -+{ -+private: -+ css::uno::Reference< css::beans::XPropertySet > mxStyleProps; -+ css::uno::Reference< css::style::XStyle > mxStyle; -+public: -+ SwVbaStyle( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ) throw ( css::script::BasicErrorException, css::uno::RuntimeException ); -+ virtual ~SwVbaStyle(){} -+ -+ static void setStyle( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, const css::uno::Reference< ooo::vba::word::XStyle >& xStyle ) throw (css::uno::RuntimeException); -+ static rtl::OUString getOOoStyleTypeFromMSWord( sal_Int32 _wdStyleType ); -+ static sal_Int32 getLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps ) throw (css::uno::RuntimeException); -+ static void setLanguageID( const css::uno::Reference< css::beans::XPropertySet >& xTCProps, sal_Int32 _languageid ) throw (css::uno::RuntimeException); -+ -+ // Attributes -+ virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setName( const rtl::OUString& Name ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getLanguageID( ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLanguageID( ::sal_Int32 _languageid ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ooo::vba::word::XFont > SAL_CALL getFont() throw (css::uno::RuntimeException); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif //SW_VBA_AXIS_HXX -diff --git sw/source/ui/vba/vbastyles.cxx sw/source/ui/vba/vbastyles.cxx -new file mode 100644 -index 0000000..c178fe1 ---- /dev/null -+++ sw/source/ui/vba/vbastyles.cxx -@@ -0,0 +1,380 @@ -+/************************************************************************* -+ * -+ * 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: vbastyles.cxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 "vbastyles.hxx" -+#include "vbastyle.hxx" -+#include <cppuhelper/implbase3.hxx> -+#include <com/sun/star/container/XEnumerationAccess.hpp> -+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> -+#include <com/sun/star/style/XStyle.hpp> -+#include <ooo/vba/word/WdBuiltinStyle.hpp> -+#include <ooo/vba/word/WdStyleType.hpp> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+struct BuiltinStyleTable -+{ -+ sal_Int32 wdBuiltinStyle; -+ const sal_Char* pOOoStyleName; -+ sal_Int32 wdStyleType; -+}; -+ -+const BuiltinStyleTable aBuiltinStyleTable[] = -+{ -+ { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleBodyText, "Text body", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleBodyText2, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleBodyText3, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent, "First line indent", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleBodyTextFirstIndent2, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleBodyTextIndent, "Text body indent", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleBodyTextIndent2, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleBodyTextIndent3, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleCaption, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleClosing, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleCommentReference, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleCommentText, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleDate, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleDefaultParagraphFont, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleEmphasis, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleEndnoteReference, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleEndnoteText, "Endnote", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleEnvelopeAddress, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleEnvelopeReturn, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleFooter, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleFootnoteReference, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleFootnoteText, "Footnote", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeader, "Header", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeading1, "Heading 1", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeading2, "Heading 2", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeading3, "Heading 3", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeading4, "Heading 4", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeading5, "Heading 5", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeading6, "Heading 6", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeading7, "Heading 7", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeading8, "Heading 8", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHeading9, "Heading 9", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlAcronym, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlAddress, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlCite, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlCode, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlDfn, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlKbd, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlNormal, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlPre, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlSamp, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlTt, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHtmlVar, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHyperlink, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleHyperlinkFollowed, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndex1, "Index 1", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndex2, "Index 2", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndex3, "Index 3", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndex4, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndex5, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndex6, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndex7, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndex8, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndex9, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleIndexHeading, "Index Heading", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleLineNumber, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleList, "List", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleList2, "List 2", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleList3, "List 3", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleList4, "List 4", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleList5, "List 5", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleListBullet, "List 1", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleListBullet2, "List 2", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleListBullet3, "List 3", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleListBullet4, "List 4", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleListBullet5, "List 5", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleListContinue, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleListContinue2, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleListContinue3, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleListContinue4, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleListContinue5, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleListNumber, "Numbering 1", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleListNumber2, "Numbering 2", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleListNumber3, "Numbering 3", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleListNumber4, "Numbering 4", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleListNumber5, "Numbering 5", word::WdStyleType::wdStyleTypeList }, -+ { word::WdBuiltinStyle::wdStyleMacroText, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleMessageHeader, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleNavPane, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleNormal, "Default", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleNormalIndent, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleNormalTable, "Table", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleNoteHeading, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStylePageNumber, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStylePlainText, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleSalutation, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleSignature, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleStrong, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleSubtitle, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTableOfAuthorities, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTableOfFigures, "", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTitle, "Title", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOAHeading, "Contents Heading", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOC1, "Contents 1", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOC2, "Contents 2", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOC3, "Contents 3", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOC4, "Contents 4", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOC5, "Contents 5", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOC6, "Contents 6", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOC7, "Contents 7", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOC8, "Contents 8", word::WdStyleType::wdStyleTypeParagraph }, -+ { word::WdBuiltinStyle::wdStyleTOC9, "Contents 9", word::WdStyleType::wdStyleTypeParagraph }, -+ { 0, 0, 0 } -+}; -+ -+ -+static uno::Sequence< rtl::OUString > getStyleTypes() -+{ -+ uno::Sequence< rtl::OUString > aRet(3); -+ rtl::OUString* pArray = aRet.getArray(); -+ pArray[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ); -+ pArray[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") ); -+ pArray[2] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") ); -+ return aRet; -+} -+ -+typedef ::cppu::WeakImplHelper1< container::XEnumeration > StyleEnumeration_BASE; -+typedef ::cppu::WeakImplHelper3< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > StyleCollectionHelper_BASE; -+/* -+class StylesEnumeration : public StyleEnumeration_BASE -+{ -+public: -+ StylesEnumeration( const SheetMap& sMap ) : mSheetMap( sMap ), mIt( mSheetMap.begin() ) {} -+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -+ { -+ return ( mIt != mSheetMap.end() ); -+ } -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( !hasMoreElements() ) -+ throw container::NoSuchElementException(); -+ uno::Reference< sheet::XSpreadsheet > xSheet( *mIt++ ); -+ return uno::makeAny( xSheet ) ; -+ } -+}; -+*/ -+class StyleCollectionHelper : public StyleCollectionHelper_BASE -+{ -+private: -+ uno::Reference< frame::XModel > mxModel; -+ uno::Reference< container::XNameAccess > mxStyleFamilies; -+ uno::Reference< container::XNameContainer > mxCurrentStyleFamily; -+ uno::Any cachePos; -+public: -+ StyleCollectionHelper( const uno::Reference< frame::XModel >& _xModel ) : mxModel( _xModel ) -+ { -+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( _xModel, uno::UNO_QUERY_THROW); -+ mxStyleFamilies = xStyleSupplier->getStyleFamilies(); -+ } -+ uno::Reference< container::XNameContainer > getCurrentStyleFamily(){ return mxCurrentStyleFamily; } -+ // XElementAccess -+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) { return style::XStyle::static_type(0); } -+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) { return getCount() > 0; } -+ // XNameAcess -+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( !hasByName(aName) ) -+ throw container::NoSuchElementException(); -+ return cachePos; -+ } -+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) -+ { -+ uno::Sequence< rtl::OUString > sNames( getCount() ); -+ rtl::OUString* pString = sNames.getArray(); -+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes(); -+ sal_Int32 nCount = 0; -+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ ) -+ { -+ uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW ); -+ uno::Sequence< rtl::OUString > sElementNames = xNameAccess->getElementNames(); -+ for( sal_Int32 j = 0; j < sElementNames.getLength(); j++ ) -+ { -+ pString[nCount++] = sElementNames[j]; -+ } -+ } -+ return sNames; -+ } -+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) -+ { -+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes(); -+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ ) -+ { -+ uno::Reference< container::XNameAccess > xNameAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW ); -+ if( xNameAccess->hasByName( aName ) ) -+ { -+ cachePos = xNameAccess->getByName( aName ); -+ mxCurrentStyleFamily.set( xNameAccess, uno::UNO_QUERY_THROW ); -+ return sal_True; -+ } -+ } -+ return sal_False; -+ } -+ -+ // XIndexAccess -+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) -+ { -+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes(); -+ sal_Int32 nCount = 0; -+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ ) -+ { -+ uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW ); -+ nCount += xIndexAccess->getCount(); -+ } -+ return nCount; -+ } -+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException ) -+ { -+ if ( Index < 0 || Index >= getCount() ) -+ throw lang::IndexOutOfBoundsException(); -+ -+ // FIXME: need to make a alphabetically sorted list of style names -+ uno::Sequence< rtl::OUString > aStyleTypes = getStyleTypes(); -+ for( sal_Int32 i = 0; i < aStyleTypes.getLength(); i++ ) -+ { -+ uno::Reference< container::XIndexAccess > xIndexAccess( mxStyleFamilies->getByName( aStyleTypes[i] ), uno::UNO_QUERY_THROW ); -+ sal_Int32 nCount = xIndexAccess->getCount(); -+ if( Index >= nCount ) -+ Index -= nCount; -+ else -+ { -+ mxCurrentStyleFamily.set( xIndexAccess, uno::UNO_QUERY_THROW ); -+ return xIndexAccess->getByIndex( Index ); -+ } -+ } -+ throw lang::IndexOutOfBoundsException(); -+ } -+ // XEnumerationAccess -+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) -+ { -+ // FIXME: -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ } -+}; -+ -+SwVbaStyles::SwVbaStyles( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) throw ( script::BasicErrorException ) : SwVbaStyles_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new StyleCollectionHelper( xModel ) ) ), mxModel( xModel ) -+{ -+ mxMSF.set( mxModel, uno::UNO_QUERY_THROW ); -+} -+ -+uno::Any -+SwVbaStyles::createCollectionObject(const uno::Any& aObject) -+{ -+ uno::Reference< beans::XPropertySet > xStyleProp( aObject, uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProp ) ) ); -+} -+ -+uno::Type SAL_CALL -+SwVbaStyles::getElementType() throw (uno::RuntimeException) -+{ -+ return word::XStyle::static_type(0); -+} -+ -+uno::Reference< container::XEnumeration > SAL_CALL -+SwVbaStyles::createEnumeration() throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+uno::Any SAL_CALL -+SwVbaStyles::Item( const uno::Any& Index1, const uno::Any& Index2 ) throw (uno::RuntimeException) -+{ -+ //handle WdBuiltinStyle -+ sal_Int32 nIndex = 0; -+ if( ( Index1 >>= nIndex ) && ( nIndex < 0 ) ) -+ { -+ for( const BuiltinStyleTable* pTable = aBuiltinStyleTable; pTable->wdBuiltinStyle != NULL; pTable++ ) -+ { -+ if( nIndex == pTable->wdBuiltinStyle ) -+ { -+ rtl::OUString aStyleName = rtl::OUString::createFromAscii( pTable->pOOoStyleName ); -+ if( aStyleName.getLength() > 0 ) -+ { -+ rtl::OUString aStyleType = SwVbaStyle::getOOoStyleTypeFromMSWord( pTable->wdStyleType ); -+ switch( pTable->wdStyleType ) -+ { -+ case word::WdStyleType::wdStyleTypeParagraph: -+ case word::WdStyleType::wdStyleTypeTable: -+ { -+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParagraphStyles") ); -+ break; -+ } -+ case word::WdStyleType::wdStyleTypeCharacter: -+ { -+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CharacterStyles") ); -+ break; -+ } -+ case word::WdStyleType::wdStyleTypeList: -+ { -+ aStyleType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStyles") ); -+ break; -+ } -+ default: -+ DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() ); -+ } -+ uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxModel, uno::UNO_QUERY_THROW); -+ uno::Reference< container::XNameAccess > xStylesAccess( xStyleSupplier->getStyleFamilies()->getByName( aStyleType ), uno::UNO_QUERY_THROW ); -+ uno::Reference< beans::XPropertySet > xStyleProps( xStylesAccess->getByName( aStyleName ), uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< word::XStyle >( new SwVbaStyle( this, mxContext, xStyleProps ) ) ); -+ } -+ else -+ { -+ OSL_TRACE("SwVbaStyles::Item: the builtin style type is not implemented"); -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ } -+ } -+ } -+ } -+ return SwVbaStyles_BASE::Item( Index1, Index2 ); -+} -+ -+rtl::OUString& -+SwVbaStyles::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaStyles") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaStyles::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.XStyles" ) ); -+ } -+ return aServiceNames; -+} -diff --git sw/source/ui/vba/vbastyles.hxx sw/source/ui/vba/vbastyles.hxx -new file mode 100644 -index 0000000..50f20d2 ---- /dev/null -+++ sw/source/ui/vba/vbastyles.hxx -@@ -0,0 +1,54 @@ -+/************************************************************************* -+ * -+ * 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: vbastyles.hxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 SW_VBA_STYLES_HXX -+#define SW_VBA_STYLES_HXX -+ -+#include <ooo/vba/word/XStyles.hpp> -+#include <vbahelper/vbacollectionimpl.hxx> -+ -+typedef CollTestImplHelper< ooo::vba::word::XStyles > SwVbaStyles_BASE; -+class SwVbaStyles: public SwVbaStyles_BASE -+{ -+ css::uno::Reference< css::frame::XModel > mxModel; -+ css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF; -+public: -+ SwVbaStyles( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::script::BasicErrorException ); -+ -+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException); -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ virtual css::uno::Any createCollectionObject(const css::uno::Any&); -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif -diff --git sw/source/ui/vba/vbasystem.cxx sw/source/ui/vba/vbasystem.cxx -index 29ea2e5..0b233a4 100644 ---- sw/source/ui/vba/vbasystem.cxx -+++ sw/source/ui/vba/vbasystem.cxx -@@ -61,7 +61,7 @@ uno::Any PrivateProfileStringListener::getValueEvent() - // get the private profile string - Config aCfg( maFileName ); - aCfg.SetGroup( maGroupName ); -- rtl::OUString sValue = rtl::OUString( String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_UTF8 ) ); -+ rtl::OUString sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW ); - - return uno::makeAny( sValue ); - } -@@ -74,7 +74,7 @@ void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value ) - - rtl::OUString aValue; - value >>= aValue; -- aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_UTF8 ) ); -+ aCfg.WriteKey( maKey, ByteString( aValue.getStr(), RTL_TEXTENCODING_DONTKNOW ) ); - } - - SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext >& xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext ) -@@ -168,8 +168,8 @@ SwVbaSystem::PrivateProfileString( const rtl::OUString& rFilename, const rtl::OU - else - osl::FileBase::getFileURLFromSystemPath( rFilename, sFileUrl); - -- ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_UTF8); -- ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_UTF8); -+ ByteString aGroupName = ByteString( rSection.getStr(), RTL_TEXTENCODING_DONTKNOW); -+ ByteString aKey = ByteString( rKey.getStr(), RTL_TEXTENCODING_DONTKNOW); - maPrivateProfileStringListener.Initialize( sFileUrl, aGroupName, aKey ); - - return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( &maPrivateProfileStringListener ) ) ); -diff --git sw/source/ui/vba/vbatable.cxx sw/source/ui/vba/vbatable.cxx -new file mode 100644 -index 0000000..3a4ead5 ---- /dev/null -+++ sw/source/ui/vba/vbatable.cxx -@@ -0,0 +1,97 @@ -+#include "vbatable.hxx" -+#include "vbarange.hxx" -+#include <com/sun/star/frame/XModel.hpp> -+#include <com/sun/star/text/XTextViewCursorSupplier.hpp> -+#include <com/sun/star/view/XSelectionSupplier.hpp> -+#include <com/sun/star/text/XTextTable.hpp> -+#include <com/sun/star/text/XTextTablesSupplier.hpp> -+#include <com/sun/star/table/XTableRows.hpp> -+#include <com/sun/star/container/XNamed.hpp> -+#include "vbaborders.hxx" -+#include "vbapalette.hxx" -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+SwVbaTable::SwVbaTable( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const uno::Reference< css::text::XTextTable >& xTextTable) throw ( uno::RuntimeException ) : SwVbaTable_BASE( rParent, rContext ), mxTextDocument( rDocument ) -+{ -+ mxTextTable.set( xTextTable, uno::UNO_QUERY_THROW ); -+} -+ -+uno::Reference< word::XRange > SAL_CALL -+SwVbaTable::Range( ) throw (script::BasicErrorException, uno::RuntimeException) -+{ -+ return new SwVbaRange( mxParent, mxContext, mxTextDocument, mxTextTable->getAnchor() ); -+} -+ -+void SAL_CALL -+SwVbaTable::Select( ) throw (script::BasicErrorException, uno::RuntimeException) -+{ -+ uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW ); -+ uno::Reference< frame::XController > xController = xModel->getCurrentController(); -+ -+ uno::Reference< text::XTextViewCursorSupplier > xViewCursorSupplier( xController, uno::UNO_QUERY_THROW ); -+ uno::Reference< view::XSelectionSupplier > xSelectionSupplier( xController, uno::UNO_QUERY_THROW ); -+ -+ // set the view cursor to the start of the table. -+ xSelectionSupplier->select( uno::makeAny( mxTextTable ) ); -+ -+ // go to the end of the table and span the view -+ uno::Reference< text::XTextViewCursor > xCursor = xViewCursorSupplier->getViewCursor(); -+ xCursor->gotoEnd(sal_True); -+ -+} -+ -+void SAL_CALL -+SwVbaTable::Delete( ) throw (script::BasicErrorException, uno::RuntimeException) -+{ -+ uno::Reference< table::XTableRows > xRows( mxTextTable->getRows() ); -+ xRows->removeByIndex( 0, xRows->getCount() ); -+} -+ -+uno::Reference< word::XRange > SAL_CALL -+SwVbaTable::ConvertToText( const uno::Any& Separator, const uno::Any& NestedTables ) throw (script::BasicErrorException, uno::RuntimeException) -+{ -+ // #FIXME the helper api uses the dreaded dispatch mechanism, holding off -+ // implementation while I look for alternative solution -+ throw uno::RuntimeException(); -+} -+ -+rtl::OUString SAL_CALL -+SwVbaTable::getName() throw (uno::RuntimeException) -+{ -+ uno::Reference< container::XNamed > xNamed( mxTextTable, uno::UNO_QUERY_THROW ); -+ return xNamed->getName(); -+} -+ -+uno::Any SAL_CALL -+SwVbaTable::Borders( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< table::XCellRange > aCellRange( mxTextTable, uno::UNO_QUERY_THROW ); -+ VbaPalette aPalette; -+ uno::Reference< XCollection > xCol( new SwVbaBorders( this, mxContext, aCellRange, aPalette ) ); -+ if ( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ -+// XHelperInterface -+rtl::OUString& -+SwVbaTable::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTable") ); -+ return sImplName; -+} -+ -+uno::Sequence<rtl::OUString> -+SwVbaTable::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Table" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbatable.hxx sw/source/ui/vba/vbatable.hxx -new file mode 100644 -index 0000000..3376007 ---- /dev/null -+++ sw/source/ui/vba/vbatable.hxx -@@ -0,0 +1,28 @@ -+#ifndef SW_VBA_TABLE_HXX -+#define SW_VBA_TABLE_HXX -+#include <vbahelper/vbahelperinterface.hxx> -+#include <com/sun/star/text/XTextDocument.hpp> -+#include <com/sun/star/text/XTextTable.hpp> -+#include <ooo/vba/word/XRange.hpp> -+#include <ooo/vba/word/XTable.hpp> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XTable > SwVbaTable_BASE; -+ -+class SwVbaTable : public SwVbaTable_BASE -+{ -+ css::uno::Reference< css::text::XTextDocument > mxTextDocument; -+ css::uno::Reference< css::text::XTextTable > mxTextTable; -+public: -+ SwVbaTable( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, const css::uno::Reference< css::text::XTextDocument >& rDocument, const css::uno::Reference< css::text::XTextTable >& xTextTable) throw ( css::uno::RuntimeException);; -+ css::uno::Reference< css::text::XTextDocument > getDocument() { return mxTextDocument; }; -+ virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL Range( ) throw (css::script::BasicErrorException, css::uno::RuntimeException);; -+ virtual void SAL_CALL Select( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); -+ virtual void SAL_CALL Delete( ) throw (css::script::BasicErrorException, css::uno::RuntimeException); -+ virtual css::uno::Reference< ::ooo::vba::word::XRange > SAL_CALL ConvertToText( const css::uno::Any& Separator, const css::uno::Any& NestedTables ) throw (css::script::BasicErrorException, css::uno::RuntimeException); -+ virtual rtl::OUString SAL_CALL getName( ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Borders( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+#endif -diff --git sw/source/ui/vba/vbatables.cxx sw/source/ui/vba/vbatables.cxx -new file mode 100644 -index 0000000..d6ea709 ---- /dev/null -+++ sw/source/ui/vba/vbatables.cxx -@@ -0,0 +1,131 @@ -+#include "vbatables.hxx" -+#include "vbatable.hxx" -+#include "vbarange.hxx" -+#include <com/sun/star/text/XTextTable.hpp> -+#include <com/sun/star/text/XTextTablesSupplier.hpp> -+#include <com/sun/star/text/XTextDocument.hpp> -+#include <comphelper/componentcontext.hxx> -+ -+using namespace ::ooo::vba; -+using namespace css; -+ -+uno::Reference< container::XIndexAccess > lcl_getTables( const uno::Reference< frame::XModel >& xDoc ) -+{ -+ uno::Reference< container::XIndexAccess > xTables; -+ uno::Reference< text::XTextTablesSupplier > xSupp( xDoc, uno::UNO_QUERY ); -+ if ( xSupp.is() ) -+ xTables.set( xSupp->getTextTables(), uno::UNO_QUERY_THROW ); -+ return xTables; -+} -+ -+uno::Any lcl_createTable( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xDocument, const uno::Any& aSource ) -+{ -+ uno::Reference< text::XTextTable > xTextTable( aSource, uno::UNO_QUERY_THROW ); -+ uno::Reference< text::XTextDocument > xTextDocument( xDocument, uno::UNO_QUERY_THROW ); -+ uno::Reference< word::XTable > xTable( new SwVbaTable( xParent, xContext, xTextDocument, xTextTable ) ); -+ return uno::makeAny( xTable ); -+} -+ -+typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumBase; -+ -+class TableEnumerationImpl : public EnumBase -+{ -+ uno::Reference< XHelperInterface > mxParent; -+ uno::Reference< uno::XComponentContext > mxContext; -+ uno::Reference< frame::XModel > mxDocument; -+ uno::Reference< container::XIndexAccess > mxIndexAccess; -+ sal_Int32 mnCurIndex; -+public: -+ TableEnumerationImpl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : mxParent( xParent ), mxContext( xContext ), mxDocument( xDocument ), mxIndexAccess( xIndexAccess ), mnCurIndex(0) -+ { -+ } -+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -+ { -+ return ( mnCurIndex < mxIndexAccess->getCount() ); -+ } -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( !hasMoreElements() ) -+ throw container::NoSuchElementException(); -+ return lcl_createTable( mxParent, mxContext, mxDocument, mxIndexAccess->getByIndex( mnCurIndex++ ) ); -+ } -+ -+}; -+ -+SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , lcl_getTables( xDocument ) ), mxDocument( xDocument ) -+{ -+} -+ -+ -+uno::Reference< word::XTable > SAL_CALL -+SwVbaTables::Add( const uno::Reference< word::XRange >& Range, const uno::Any& NumRows, const uno::Any& NumColumns, const uno::Any& DefaultTableBehavior, const uno::Any& AutoFitBehavior ) throw (script::BasicErrorException, uno::RuntimeException) -+{ -+ sal_Int32 nCols = 0; -+ sal_Int32 nRows = 0; -+ SwVbaRange* pVbaRange = dynamic_cast< SwVbaRange* >( Range.get() ); -+ // Preconditions -+ if ( !( pVbaRange && ( NumRows >>= nRows ) && ( NumColumns >>= nCols ) ) ) -+ throw uno::RuntimeException(); // #FIXME better exception?? -+ if ( nCols <= 0 || nRows <= 0 ) -+ throw uno::RuntimeException(); // #FIXME better exception?? -+ -+ uno::Reference< frame::XModel > xModel( pVbaRange->getDocument(), uno::UNO_QUERY_THROW ); -+ uno::Reference< lang::XMultiServiceFactory > xMsf( xModel, uno::UNO_QUERY_THROW ); -+ uno::Reference< text::XTextRange > xTextRange = pVbaRange->getXTextRange(); -+ -+ uno::Reference< text::XTextTable > xTable; -+ xTable.set( xMsf->createInstance( rtl::OUString::createFromAscii("com.sun.star.text.TextTable") ), uno::UNO_QUERY_THROW ); -+/* -+ comphelper::ComponentContext aCtx( xMsf ); -+ if ( !aCtx.createComponent( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ), xTable ) ); -+ throw uno::RuntimeException(); // #FIXME better exception?? -+*/ -+ xTable->initialize( nRows, nCols ); -+ uno::Reference< text::XText > xText = xTextRange->getText(); -+ uno::Reference< text::XTextContent > xContext( xTable, uno::UNO_QUERY_THROW ); -+ -+ xText->insertTextContent( xTextRange, xContext, true ); -+ uno::Reference< word::XTable > xVBATable( new SwVbaTable( mxParent, mxContext, pVbaRange->getDocument(), xTable ) ); -+ return xVBATable; -+} -+ -+uno::Reference< container::XEnumeration > SAL_CALL -+SwVbaTables::createEnumeration() throw (uno::RuntimeException) -+{ -+ return new TableEnumerationImpl( mxParent, mxContext, mxDocument, m_xIndexAccess ); -+} -+ -+// ScVbaCollectionBaseImpl -+uno::Any -+SwVbaTables::createCollectionObject( const uno::Any& aSource ) -+{ -+ return lcl_createTable( mxParent, mxContext, mxDocument, aSource ); -+} -+ -+// XHelperInterface -+rtl::OUString& -+SwVbaTables::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaTables") ); -+ return sImplName; -+} -+ -+// XEnumerationAccess -+uno::Type SAL_CALL -+SwVbaTables::getElementType() throw (uno::RuntimeException) -+{ -+ return word::XTable::static_type(0); -+} -+ -+uno::Sequence<rtl::OUString> -+SwVbaTables::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Tables" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git sw/source/ui/vba/vbatables.hxx sw/source/ui/vba/vbatables.hxx -new file mode 100644 -index 0000000..79df2f9 ---- /dev/null -+++ sw/source/ui/vba/vbatables.hxx -@@ -0,0 +1,28 @@ -+#ifndef SW_VBA_TABLES_HXX -+#define SW_VBA_TABLES_HXX -+ -+#include <ooo/vba/word/XTables.hpp> -+#include <vbahelper/vbacollectionimpl.hxx> -+ -+ -+typedef CollTestImplHelper< ov::word::XTables > SwVbaTables_BASE; -+ -+class SwVbaTables : public SwVbaTables_BASE -+{ -+ css::uno::Reference< css::frame::XModel > mxDocument; -+public: -+ SwVbaTables( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::frame::XModel >& xDocument ); -+ // XTables -+ virtual css::uno::Reference< ov::word::XTable > SAL_CALL Add( const css::uno::Reference< ::ooo::vba::word::XRange >& Range, const css::uno::Any& NumRows, const css::uno::Any& NumColumns, const css::uno::Any& DefaultTableBehavior, const css::uno::Any& AutoFitBehavior ) throw (css::script::BasicErrorException, css::uno::RuntimeException); -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ // ScVbaCollectionBaseImpl -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -+ -+ // XHelperInterface -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif -diff --git sw/source/ui/vba/vbatemplate.cxx sw/source/ui/vba/vbatemplate.cxx -index 11c1a59..9413428 100644 ---- sw/source/ui/vba/vbatemplate.cxx -+++ sw/source/ui/vba/vbatemplate.cxx -@@ -30,6 +30,9 @@ - #include "vbatemplate.hxx" - #include <vbahelper/vbahelper.hxx> - #include "wordvbahelper.hxx" -+#include "vbaautotextentry.hxx" -+#include <comphelper/processfactory.hxx> -+#include <com/sun/star/text/XAutoTextContainer.hpp> - - using namespace ::ooo::vba; - using namespace ::com::sun::star; -@@ -49,6 +52,38 @@ SwVbaTemplate::getName() throw ( css::uno::RuntimeException ) - { - return msName; - } -+ -+uno::Any SAL_CALL -+SwVbaTemplate::AutoTextEntries( const uno::Any& index ) throw (uno::RuntimeException) -+{ -+ uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); -+ uno::Reference< text::XAutoTextContainer > xAutoTextContainer( xMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.AutoTextContainer") ) ), uno::UNO_QUERY_THROW ); -+ -+ // the default template is "Normal.dot" in Word. -+ rtl::OUString sGroup( RTL_CONSTASCII_USTRINGPARAM("Normal") ); -+ if( sal_Int32 nIndex = msName.lastIndexOf( sal_Unicode('.') ) > 0 ) -+ { -+ sGroup = msName.copy( 0, msName.lastIndexOf( sal_Unicode('.') ) ); -+ // OSL_TRACE("SwVbaTemplate::AutoTextEntries: %s", rtl::OUStringToOString( sGroup, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ } -+ -+ uno::Reference< container::XIndexAccess > xGroup; -+ if( xAutoTextContainer->hasByName( sGroup ) ) -+ { -+ xGroup.set( xAutoTextContainer->getByName( sGroup ), uno::UNO_QUERY_THROW ); -+ } -+ else -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Auto Text Entry doesn't exist") ), uno::Reference< uno::XInterface >() ); -+ //xGroup.set( xAutoTextContainer->insertNewByName( sGroup ), uno::UNO_QUERY_THROW ); -+ } -+ -+ uno::Reference< XCollection > xCol( new SwVbaAutoTextEntries( this, mxContext, xGroup ) ); -+ if( index.hasValue() ) -+ return xCol->Item( index, uno::Any() ); -+ return uno::makeAny( xCol ); -+} -+ - rtl::OUString& - SwVbaTemplate::getServiceImplName() - { -diff --git sw/source/ui/vba/vbatemplate.hxx sw/source/ui/vba/vbatemplate.hxx -index 63a2f26..df8848b 100644 ---- sw/source/ui/vba/vbatemplate.hxx -+++ sw/source/ui/vba/vbatemplate.hxx -@@ -47,6 +47,7 @@ public: - - // XTemplate - virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL AutoTextEntries( const css::uno::Any& index ) throw (css::uno::RuntimeException); - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -diff --git sw/source/ui/vba/vbaview.cxx sw/source/ui/vba/vbaview.cxx -index b9b52f4..bc7b9b4 100644 ---- sw/source/ui/vba/vbaview.cxx -+++ sw/source/ui/vba/vbaview.cxx -@@ -34,10 +34,14 @@ - #include <com/sun/star/view/XViewSettingsSupplier.hpp> - #include <com/sun/star/text/XTextViewCursorSupplier.hpp> - #include <com/sun/star/text/XText.hpp> -+#include <com/sun/star/text/XTextTable.hpp> -+#include <com/sun/star/table/XCellRange.hpp> - #include <com/sun/star/text/XTextDocument.hpp> - #include <com/sun/star/text/XFootnotesSupplier.hpp> - #include <com/sun/star/text/XEndnotesSupplier.hpp> - #include <com/sun/star/container/XIndexAccess.hpp> -+#include <com/sun/star/container/XEnumerationAccess.hpp> -+#include <com/sun/star/container/XEnumeration.hpp> - #include <com/sun/star/frame/XController.hpp> - #include <com/sun/star/lang/XServiceInfo.hpp> - #include <ooo/vba/word/WdSpecialPane.hpp> -@@ -45,12 +49,13 @@ - #include <ooo/vba/word/WdSeekView.hpp> - - #include "wordvbahelper.hxx" -+#include "vbaheaderfooterhelper.hxx" - #include <view.hxx> - - using namespace ::ooo::vba; - using namespace ::com::sun::star; - --const sal_Int32 DEFAULT_BODY_DISTANCE = 500; -+static const sal_Int32 DEFAULT_BODY_DISTANCE = 500; - - SwVbaView::SwVbaView( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, - const uno::Reference< frame::XModel >& rModel ) throw ( uno::RuntimeException ) : -@@ -72,7 +77,16 @@ SwVbaView::~SwVbaView() - ::sal_Int32 SAL_CALL - SwVbaView::getSeekView() throw (css::uno::RuntimeException) - { -+ // FIXME: if the view cursor is in table, field, section and frame -+ // handle if the cursor is in table - uno::Reference< text::XText > xCurrentText = mxViewCursor->getText(); -+ uno::Reference< beans::XPropertySet > xCursorProps( mxViewCursor, uno::UNO_QUERY_THROW ); -+ uno::Reference< text::XTextContent > xTextContent; -+ while( xCursorProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextTable") ) ) >>= xTextContent ) -+ { -+ xCurrentText = xTextContent->getAnchor()->getText(); -+ xCursorProps.set( xCurrentText->createTextCursor(), uno::UNO_QUERY_THROW ); -+ } - uno::Reference< lang::XServiceInfo > xServiceInfo( xCurrentText, uno::UNO_QUERY_THROW ); - rtl::OUString aImplName = xServiceInfo->getImplementationName(); - if( aImplName.equalsAscii("SwXBodyText") ) -@@ -81,20 +95,20 @@ SwVbaView::getSeekView() throw (css::uno::RuntimeException) - } - else if( aImplName.equalsAscii("SwXHeadFootText") ) - { -- if( word::HeaderFooterHelper::isHeader( mxModel, xCurrentText ) ) -+ if( HeaderFooterHelper::isHeader( mxModel, xCurrentText ) ) - { -- if( word::HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) ) -+ if( HeaderFooterHelper::isFirstPageHeader( mxModel, xCurrentText ) ) - return word::WdSeekView::wdSeekFirstPageHeader; -- else if( word::HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) ) -+ else if( HeaderFooterHelper::isEvenPagesHeader( mxModel, xCurrentText ) ) - return word::WdSeekView::wdSeekEvenPagesHeader; - else - return word::WdSeekView::wdSeekPrimaryHeader; - } - else - { -- if( word::HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) ) -+ if( HeaderFooterHelper::isFirstPageFooter( mxModel, xCurrentText ) ) - return word::WdSeekView::wdSeekFirstPageFooter; -- else if( word::HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) ) -+ else if( HeaderFooterHelper::isEvenPagesFooter( mxModel, xCurrentText ) ) - return word::WdSeekView::wdSeekEvenPagesFooter; - else - return word::WdSeekView::wdSeekPrimaryFooter; -@@ -114,8 +128,12 @@ SwVbaView::getSeekView() throw (css::uno::RuntimeException) - void SAL_CALL - SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeException) - { -- if( _seekview == getSeekView() ) -- return; -+ // FIXME: save the current cursor position, if the cursor is in the main -+ // document, so we can jump back to this position, if the macro sets -+ // the ViewMode back to wdSeekMainDocument -+ -+ // if( _seekview == getSeekView() ) -+ // return; - - switch( _seekview ) - { -@@ -166,7 +184,7 @@ SwVbaView::setSeekView( ::sal_Int32 _seekview ) throw (css::uno::RuntimeExceptio - { - uno::Reference< text::XTextDocument > xTextDocument( mxModel, uno::UNO_QUERY_THROW ); - uno::Reference< text::XText > xText = xTextDocument->getText(); -- mxViewCursor->gotoRange( xText->getStart(), sal_False ); -+ mxViewCursor->gotoRange( getFirstObjectPosition( xText ), sal_False ); - break; - } - } -@@ -214,6 +232,7 @@ SwVbaView::setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException) - switch( _type ) - { - case word::WdViewType::wdPrintView: -+ case word::WdViewType::wdNormalView: - { - mxViewSettings->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")), uno::makeAny( sal_False ) ); - break; -@@ -360,7 +379,29 @@ uno::Reference< text::XTextRange > SwVbaView::getHFTextRange( sal_Int32 nType ) - { - DebugHelper::exception( SbERR_INTERNAL_ERROR, rtl::OUString() ); - } -- return xText->getStart(); -+ uno::Reference< text::XTextRange > xTextRange = getFirstObjectPosition( xText ); -+ return xTextRange; -+} -+ -+uno::Reference< text::XTextRange > SwVbaView::getFirstObjectPosition( const uno::Reference< text::XText >& xText ) throw (uno::RuntimeException) -+{ -+ // if the first object is table, get the position of first cell -+ uno::Reference< text::XTextRange > xTextRange; -+ uno::Reference< container::XEnumerationAccess > xParaAccess( xText, uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XEnumeration> xParaEnum = xParaAccess->createEnumeration(); -+ if( xParaEnum->hasMoreElements() ) -+ { -+ uno::Reference< lang::XServiceInfo > xServiceInfo( xParaEnum->nextElement(), uno::UNO_QUERY_THROW ); -+ if( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable") ) ) ) -+ { -+ uno::Reference< table::XCellRange > xCellRange( xServiceInfo, uno::UNO_QUERY_THROW ); -+ uno::Reference< text::XText> xFirstCellText( xCellRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW ); -+ xTextRange = xFirstCellText->getStart(); -+ } -+ } -+ if( !xTextRange.is() ) -+ xTextRange = xText->getStart(); -+ return xTextRange; - } - - rtl::OUString& -diff --git sw/source/ui/vba/vbaview.hxx sw/source/ui/vba/vbaview.hxx -index 4aa07a3..47675a5 100644 ---- sw/source/ui/vba/vbaview.hxx -+++ sw/source/ui/vba/vbaview.hxx -@@ -34,6 +34,7 @@ - #include <vbahelper/vbahelperinterface.hxx> - #include <com/sun/star/text/XTextViewCursor.hpp> - #include <com/sun/star/text/XTextRange.hpp> -+#include <com/sun/star/text/XText.hpp> - #include <com/sun/star/beans/XPropertySet.hpp> - - typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XView > SwVbaView_BASE; -@@ -46,6 +47,7 @@ private: - css::uno::Reference< css::beans::XPropertySet > mxViewSettings; - - css::uno::Reference< css::text::XTextRange > getHFTextRange( sal_Int32 nType ) throw (css::uno::RuntimeException); -+ css::uno::Reference< css::text::XTextRange > getFirstObjectPosition( const css::uno::Reference< css::text::XText >& xText ) throw (css::uno::RuntimeException); - - public: - SwVbaView( const css::uno::Reference< ooo::vba::XHelperInterface >& rParent, const css::uno::Reference< css::uno::XComponentContext >& rContext, -diff --git sw/source/ui/vba/vbawrapformat.cxx sw/source/ui/vba/vbawrapformat.cxx -new file mode 100644 -index 0000000..a169e95 ---- /dev/null -+++ sw/source/ui/vba/vbawrapformat.cxx -@@ -0,0 +1,260 @@ -+/************************************************************************* -+ * -+ * 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: vbawrapformat.cxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 "vbawrapformat.hxx" -+#include <ooo/vba/word/WdWrapSideType.hpp> -+#include <ooo/vba/word/WdWrapType.hpp> -+#include <com/sun/star/text/WrapTextMode.hpp> -+#include <vbahelper/vbahelper.hxx> -+#include <vbahelper/helperdecl.hxx> -+ -+using namespace ooo::vba; -+using namespace com::sun::star; -+ -+SwVbaWrapFormat::SwVbaWrapFormat( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : SwVbaWrapFormat_BASE( xParent, xContext ), m_xShape( xShape ), mnWrapFormatType( 0 ), mnSide( word::WdWrapSideType::wdWrapBoth ) -+{ -+ m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); -+} -+ -+SwVbaWrapFormat::SwVbaWrapFormat( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaWrapFormat_BASE( getXSomethingFromArgs< XHelperInterface >( aArgs, 0 ), xContext ), m_xShape( getXSomethingFromArgs< drawing::XShape >( aArgs, 1, false ) ), mnWrapFormatType( 0 ), mnSide( word::WdWrapSideType::wdWrapBoth ) -+{ -+ m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); -+} -+ -+void SwVbaWrapFormat::makeWrap() throw (uno::RuntimeException) -+{ -+ text::WrapTextMode eTextMode = text::WrapTextMode_NONE; -+ if( mnSide == word::WdWrapSideType::wdWrapLeft ) -+ { -+ eTextMode = text::WrapTextMode_LEFT; -+ } -+ else if( mnSide == word::WdWrapSideType::wdWrapRight ) -+ { -+ eTextMode = text::WrapTextMode_RIGHT; -+ } -+ else if( mnSide == word::WdWrapSideType::wdWrapBoth || -+ mnSide == word::WdWrapSideType::wdWrapLargest ) -+ { -+ switch( mnWrapFormatType ) -+ { -+ case word::WdWrapType::wdWrapNone: -+ case word::WdWrapType::wdWrapThrough: -+ { -+ eTextMode = text::WrapTextMode_THROUGHT; -+ break; -+ } -+ case word::WdWrapType::wdWrapInline: -+ case word::WdWrapType::wdWrapTopBottom: -+ { -+ eTextMode = text::WrapTextMode_NONE; -+ break; -+ } -+ case word::WdWrapType::wdWrapSquare: -+ { -+ eTextMode = text::WrapTextMode_PARALLEL; -+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") ), uno::makeAny( sal_False ) ); -+ break; -+ } -+ case word::WdWrapType::wdWrapTight: -+ { -+ eTextMode = text::WrapTextMode_PARALLEL; -+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") ), uno::makeAny( sal_True ) ); -+ break; -+ } -+ default: -+ { -+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); -+ } -+ } -+ } -+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") ), uno::makeAny( eTextMode ) ); -+} -+ -+::sal_Int32 SAL_CALL SwVbaWrapFormat::getType() throw (uno::RuntimeException) -+{ -+ sal_Int32 nType = word::WdWrapType::wdWrapSquare; -+ text::WrapTextMode eTextMode; -+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") )) >>= eTextMode; -+ switch( eTextMode ) -+ { -+ case text::WrapTextMode_NONE: -+ { -+ nType = word::WdWrapType::wdWrapTopBottom; -+ break; -+ } -+ case text::WrapTextMode_THROUGHT: -+ { -+ nType = word::WdWrapType::wdWrapNone; -+ break; -+ } -+ case text::WrapTextMode_PARALLEL: -+ { -+ sal_Bool bContour = sal_False; -+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SurroundContour") )) >>= bContour; -+ if( bContour ) -+ nType = word::WdWrapType::wdWrapTight; -+ else -+ nType = word::WdWrapType::wdWrapSquare; -+ break; -+ } -+ case text::WrapTextMode_DYNAMIC: -+ case text::WrapTextMode_LEFT: -+ case text::WrapTextMode_RIGHT: -+ { -+ nType = word::WdWrapType::wdWrapThrough; -+ break; -+ } -+ default: -+ { -+ nType = word::WdWrapType::wdWrapSquare; -+ } -+ } -+ return nType; -+} -+ -+void SAL_CALL SwVbaWrapFormat::setType( ::sal_Int32 _type ) throw (uno::RuntimeException) -+{ -+ mnWrapFormatType = _type; -+ makeWrap(); -+} -+ -+::sal_Int32 SAL_CALL SwVbaWrapFormat::getSide() throw (uno::RuntimeException) -+{ -+ sal_Int32 nSide = word::WdWrapSideType::wdWrapBoth; -+ text::WrapTextMode eTextMode; -+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TextWrap") )) >>= eTextMode; -+ switch( eTextMode ) -+ { -+ case text::WrapTextMode_LEFT: -+ { -+ nSide = word::WdWrapSideType::wdWrapLeft; -+ break; -+ } -+ case text::WrapTextMode_RIGHT: -+ { -+ nSide = word::WdWrapSideType::wdWrapRight; -+ break; -+ } -+ default: -+ { -+ nSide = word::WdWrapSideType::wdWrapBoth; -+ } -+ } -+ return nSide; -+} -+ -+void SAL_CALL SwVbaWrapFormat::setSide( ::sal_Int32 _side ) throw (uno::RuntimeException) -+{ -+ mnSide = _side; -+ makeWrap(); -+} -+ -+float SwVbaWrapFormat::getDistance( const rtl::OUString& sName ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nDistance = 0; -+ m_xPropertySet->getPropertyValue( sName ) >>= nDistance; -+ return static_cast< float >( Millimeter::getInPoints( nDistance ) ); -+} -+ -+void SwVbaWrapFormat::setDistance( const rtl::OUString& sName, float _distance ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nDistance = Millimeter::getInHundredthsOfOneMillimeter( _distance ); -+ m_xPropertySet->setPropertyValue( sName, uno::makeAny( nDistance ) ); -+} -+ -+float SAL_CALL SwVbaWrapFormat::getDistanceTop() throw (uno::RuntimeException) -+{ -+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ) ); -+} -+ -+void SAL_CALL SwVbaWrapFormat::setDistanceTop( float _distancetop ) throw (uno::RuntimeException) -+{ -+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopMargin") ), _distancetop ); -+} -+ -+float SAL_CALL SwVbaWrapFormat::getDistanceBottom() throw (uno::RuntimeException) -+{ -+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ) ); -+} -+ -+void SAL_CALL SwVbaWrapFormat::setDistanceBottom( float _distancebottom ) throw (uno::RuntimeException) -+{ -+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomMargin") ), _distancebottom ); -+} -+ -+float SAL_CALL SwVbaWrapFormat::getDistanceLeft() throw (uno::RuntimeException) -+{ -+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ) ); -+} -+ -+void SAL_CALL SwVbaWrapFormat::setDistanceLeft( float _distanceleft ) throw (uno::RuntimeException) -+{ -+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftMargin") ), _distanceleft ); -+} -+ -+float SAL_CALL SwVbaWrapFormat::getDistanceRight() throw (uno::RuntimeException) -+{ -+ return getDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ) ); -+} -+ -+void SAL_CALL SwVbaWrapFormat::setDistanceRight( float _distanceright ) throw (uno::RuntimeException) -+{ -+ setDistance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightMargin") ), _distanceright ); -+} -+ -+rtl::OUString& -+SwVbaWrapFormat::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaWrapFormat") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+SwVbaWrapFormat::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.WrapFormat" ) ); -+ } -+ return aServiceNames; -+} -+ -+namespace wrapformat -+{ -+namespace sdecl = comphelper::service_decl; -+sdecl::vba_service_class_<SwVbaWrapFormat, sdecl::with_args<true> > serviceImpl; -+extern sdecl::ServiceDecl const serviceDecl( -+ serviceImpl, -+ "SwVbaWrapFormat", -+ "ooo.vba.word.WrapFormat" ); -+} -+ -+ -diff --git sw/source/ui/vba/vbawrapformat.hxx sw/source/ui/vba/vbawrapformat.hxx -new file mode 100644 -index 0000000..6ef75ba ---- /dev/null -+++ sw/source/ui/vba/vbawrapformat.hxx -@@ -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: vbafillformat.hxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 SW_VBA_XWRAPFORMAT_HXX -+#define SW_VBA_XWRAPFORMAT_HXX -+ -+#include <com/sun/star/drawing/XShape.hpp> -+#include <ooo/vba/word/XWrapFormat.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::word::XWrapFormat > SwVbaWrapFormat_BASE; -+ -+class SwVbaWrapFormat : public SwVbaWrapFormat_BASE -+{ -+private: -+ css::uno::Reference< css::drawing::XShape > m_xShape; -+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -+ sal_Int32 mnWrapFormatType; -+ sal_Int32 mnSide; -+ -+private: -+ void makeWrap() throw (css::uno::RuntimeException); -+ float getDistance( const rtl::OUString& sName ) throw (css::uno::RuntimeException); -+ void setDistance( const rtl::OUString& sName, float _distance ) throw (css::uno::RuntimeException); -+ -+public: -+ SwVbaWrapFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); -+ SwVbaWrapFormat( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ); -+ -+ virtual ::sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setType( ::sal_Int32 _type ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getSide() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setSide( ::sal_Int32 _side ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getDistanceTop() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDistanceTop( float _distancetop ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getDistanceBottom() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDistanceBottom( float _distancebottom ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getDistanceLeft() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDistanceLeft( float _distanceleft ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getDistanceRight() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDistanceRight( float _distanceright ) throw (css::uno::RuntimeException); -+ -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+}; -+ -+#endif//SW_VBA_XWRAPFORMAT_HXX -diff --git sw/source/ui/vba/wordvbahelper.cxx sw/source/ui/vba/wordvbahelper.cxx -index 00f40fd..409b8bd 100644 ---- sw/source/ui/vba/wordvbahelper.cxx -+++ sw/source/ui/vba/wordvbahelper.cxx -@@ -36,6 +36,7 @@ - #include <com/sun/star/container/XNameAccess.hpp> - #include <com/sun/star/lang/XUnoTunnel.hpp> - #include <unotxdoc.hxx> -+#include <doc.hxx> - - using namespace ::com::sun::star; - using namespace ::ooo::vba; -@@ -83,123 +84,10 @@ uno::Reference< style::XStyle > getCurrentPageStyle( const uno::Reference< frame - return xStyle; - } - --// Class HeaderFooterHelper -- --sal_Bool HeaderFooterHelper::isHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) --{ -- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -- uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); -- -- sal_Bool isOn = sal_False; -- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsOn"))) >>= isOn; -- if( !isOn ) -- return sal_False; -- -- sal_Bool isShared = sal_False; -- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared; -- -- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") ); -- if( !isShared ) -- { -- if( 0 == xPageCursor->getPage() % 2 ) -- { -- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextLeft") ); -- } -- else -- { -- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderTextRight") ); -- } -- } -- -- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW ); -- //FIXME: can not compare in this way? -- return ( xText == xCurrentText ); --} -- --sal_Bool HeaderFooterHelper::isFirstPageHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) --{ -- if( isHeader( xModel, xCurrentText ) ) -- { -- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -- // FIXME: getPage allways returns 1 -- sal_Int32 nPage = xPageCursor->getPage(); -- return nPage == FIRST_PAGE; -- } -- return sal_False; --} -- --sal_Bool HeaderFooterHelper::isEvenPagesHeader( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) --{ -- if( isHeader( xModel, xCurrentText ) ) -- { -- uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); -- sal_Bool isShared = sal_False; -- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderIsShared"))) >>= isShared; -- if( !isShared ) -- { -- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -- return ( 0 == xPageCursor->getPage() % 2 ); -- } -- } -- return sal_False; --} -- --sal_Bool HeaderFooterHelper::isFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) -+sal_Int32 getPageCount( const uno::Reference< frame::XModel>& xModel ) throw (uno::RuntimeException) - { -- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -- uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); -- -- sal_Bool isOn = sal_False; -- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsOn"))) >>= isOn; -- if( !isOn ) -- return sal_False; -- -- sal_Bool isShared = sal_False; -- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared; -- -- rtl::OUString aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") ); -- if( !isShared ) -- { -- if( 0 == xPageCursor->getPage() % 2 ) -- { -- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextLeft") ); -- } -- else -- { -- aPropText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterTextRight") ); -- } -- } -- -- uno::Reference< text::XText > xText( xStyleProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW ); -- -- return ( xText == xCurrentText ); --} -- --sal_Bool HeaderFooterHelper::isFirstPageFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) --{ -- if( isFooter( xModel, xCurrentText ) ) -- { -- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -- sal_Int32 nPage = xPageCursor->getPage(); -- return nPage == FIRST_PAGE; -- } -- return sal_False; --} -- --sal_Bool HeaderFooterHelper::isEvenPagesFooter( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XText >& xCurrentText ) throw (uno::RuntimeException) --{ -- if( isFooter( xModel, xCurrentText ) ) -- { -- uno::Reference< beans::XPropertySet > xStyleProps( getCurrentPageStyle( xModel ), uno::UNO_QUERY_THROW ); -- sal_Bool isShared = sal_False; -- xStyleProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterIsShared"))) >>= isShared; -- if( !isShared ) -- { -- uno::Reference< text::XPageCursor > xPageCursor( getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); -- return ( 0 == xPageCursor->getPage() % 2 ); -- } -- } -- return sal_False; -+ SwDocShell* pDocShell = getDocShell( xModel ); -+ return pDocShell ? pDocShell->GetDoc()->GetPageCount() : 0; - } - - } // word -diff --git sw/source/ui/vba/wordvbahelper.hxx sw/source/ui/vba/wordvbahelper.hxx -index aecae44..98afd00 100644 ---- sw/source/ui/vba/wordvbahelper.hxx -+++ sw/source/ui/vba/wordvbahelper.hxx -@@ -49,17 +49,7 @@ namespace ooo - SwView* getView( const css::uno::Reference< css::frame::XModel>& xModel ); - css::uno::Reference< css::text::XTextViewCursor > getXTextViewCursor( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException); - css::uno::Reference< css::style::XStyle > getCurrentPageStyle( const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException); -- --class HeaderFooterHelper --{ --public: -- static sal_Bool isHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -- static sal_Bool isFirstPageHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -- static sal_Bool isEvenPagesHeader( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -- static sal_Bool isFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -- static sal_Bool isFirstPageFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); -- static sal_Bool isEvenPagesFooter( const css::uno::Reference< css::frame::XModel >& xModel, const css::uno::Reference< css::text::XText >& xCurrentText ) throw (css::uno::RuntimeException); --}; -+ sal_Int32 getPageCount( const css::uno::Reference< css::frame::XModel>& xModel ) throw (css::uno::RuntimeException); - - }; // word - }; // vba -diff --git sw/util/makefile.mk sw/util/makefile.mk -index d12cd60..1181815 100644 ---- sw/util/makefile.mk -+++ sw/util/makefile.mk -@@ -349,7 +349,6 @@ SHL4STDLIBS= \ - $(CPPUHELPERLIB) \ - $(SALLIB) \ - $(ICUUCLIB) \ -- $(VBAHELPERLIB) \ - $(BASICLIB) \ - $(I18NUTILLIB) - -@@ -368,6 +367,7 @@ SHL5STDLIBS= \ - $(CPPULIB) \ - $(COMPHELPERLIB) \ - $(SVLIB) \ -+ $(UNOTOOLSLIB) \ - $(TOOLSLIB) \ - $(SALLIB)\ - $(VBAHELPERLIB) \ -@@ -376,8 +376,11 @@ SHL5STDLIBS= \ - $(SVXLIB) \ - $(SVTOOLLIB) \ - $(SVLLIB) \ -- $(VCLLIB) \ -- $(TKLIB) \ -+ $(VCLLIB) \ -+ $(TKLIB) \ -+ $(I18NISOLANGLIB) \ -+ $(SVXCORELIB) \ -+ $(SVXMSFILTERLIB) \ - - SHL5DEPN=$(SHL1TARGETN) - SHL5LIBS=$(SLB)$/$(TARGET_VBA).lib -diff --git toolkit/inc/toolkit/controls/unocontrols.hxx toolkit/inc/toolkit/controls/unocontrols.hxx -index b22e5b4..a5eb2e6 100644 ---- toolkit/inc/toolkit/controls/unocontrols.hxx -+++ toolkit/inc/toolkit/controls/unocontrols.hxx -@@ -669,6 +669,44 @@ public: - - }; - -+class UnoMultiPageModel : public UnoControlModel -+{ -+protected: -+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; -+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); -+ -+public: -+ UnoMultiPageModel(); -+ UnoMultiPageModel( const UnoMultiPageModel& rModel ) : UnoControlModel( rModel ) {;} -+ -+ UnoControlModel* Clone() const { return new UnoMultiPageModel( *this ); } -+ -+ // ::com::sun::star::io::XPersistObject -+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); -+ -+ // ::com::sun::star::beans::XMultiPropertySet -+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); -+ -+ // ::com::sun::star::lang::XServiceInfo -+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, UnoControlModel, szServiceName_UnoMultiPageModel ) -+ -+}; -+// ---------------------------------------------------- -+// class UnoGroupBoxControl -+// ---------------------------------------------------- -+class UnoMultiPageControl : public UnoControlBase -+{ -+public: -+ UnoMultiPageControl(); -+ ::rtl::OUString GetComponentServiceName(); -+ -+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException); -+ -+ // ::com::sun::star::lang::XServiceInfo -+ DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, UnoControlBase, szServiceName_UnoMultiPageControl ) -+ -+}; -+ - // ---------------------------------------------------- - // class UnoFixedTextControl - // ---------------------------------------------------- -diff --git toolkit/inc/toolkit/helper/servicenames.hxx toolkit/inc/toolkit/helper/servicenames.hxx -index 78a507a..a0dec29 100644 ---- toolkit/inc/toolkit/helper/servicenames.hxx -+++ toolkit/inc/toolkit/helper/servicenames.hxx -@@ -40,6 +40,8 @@ extern const sal_Char __FAR_DATA szServiceName_PopupMenu[], szServiceName2_Popup - extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[]; - extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[]; - extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[]; -+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[], szServiceName2_UnoMultiPageControl[]; -+extern const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[], szServiceName2_UnoMultiPageModel[]; - extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[]; - extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[]; - extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[]; -diff --git toolkit/source/awt/vclxwindows.cxx toolkit/source/awt/vclxwindows.cxx -index 1b23f37..bc673cf 100644 ---- toolkit/source/awt/vclxwindows.cxx -+++ toolkit/source/awt/vclxwindows.cxx -@@ -1179,6 +1179,16 @@ void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const :: - pButton->Check( b ); - else - pButton->SetState( b ); -+ // If VBA - need to be able to test -+ // simulate click event -+ if ( maActionListeners.getLength() ) -+ { -+ ::com::sun::star::awt::ActionEvent aEvent; -+ aEvent.Source = (::cppu::OWeakObject*)this; -+ aEvent.ActionCommand = maActionCommand; -+ maActionListeners.actionPerformed( aEvent ); -+ } -+ - } - } - break; -@@ -1937,8 +1947,11 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com: - ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems; - if ( Value >>= aItems ) - { -+ sal_Int16 nElem = pListBox->GetEntryCount(); - pListBox->Clear(); - addItems( aItems, 0 ); -+ if ( aItems.getLength() == 0 && nElem && maItemListeners.getLength() ) -+ ImplCallItemListeners(); - } - } - break; -@@ -1951,7 +1964,11 @@ void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com: - pListBox->SelectEntryPos( --n, sal_False ); - - if ( aItems.getLength() ) -+ { - selectItemsPos( aItems, sal_True ); -+ if ( maItemListeners.getLength() ) -+ ImplCallItemListeners(); -+ } - else - pListBox->SetNoSelection(); - -diff --git toolkit/source/controls/unocontrols.cxx toolkit/source/controls/unocontrols.cxx -index 2cfa89f..b8ca5f1 100644 ---- toolkit/source/controls/unocontrols.cxx -+++ toolkit/source/controls/unocontrols.cxx -@@ -1852,6 +1852,77 @@ sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException) - return sal_True; - } - -+// MultiPage -+ -+UnoMultiPageModel::UnoMultiPageModel() -+{ -+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); -+ ImplRegisterProperty( BASEPROPERTY_ENABLED ); -+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); -+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); -+ ImplRegisterProperty( BASEPROPERTY_HELPURL ); -+ ImplRegisterProperty( BASEPROPERTY_LABEL ); -+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); -+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE ); -+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX ); -+} -+ -+::rtl::OUString UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException) -+{ -+ return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel ); -+} -+ -+uno::Any UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const -+{ -+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL ) -+ { -+ uno::Any aAny; -+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox ); -+ //aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl ); -+ return aAny; -+ } -+ return UnoControlModel::ImplGetDefaultValue( nPropId ); -+} -+ -+::cppu::IPropertyArrayHelper& UnoMultiPageModel::getInfoHelper() -+{ -+ static UnoPropertyArrayHelper* pHelper = NULL; -+ if ( !pHelper ) -+ { -+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); -+ pHelper = new UnoPropertyArrayHelper( aIDs ); -+ } -+ return *pHelper; -+} -+ -+// beans::XMultiPropertySet -+uno::Reference< beans::XPropertySetInfo > UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException) -+{ -+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); -+ return xInfo; -+} -+ -+// ---------------------------------------------------- -+// class MultiPageControl -+// ---------------------------------------------------- -+UnoMultiPageControl::UnoMultiPageControl() -+{ -+ maComponentInfos.nWidth = 100; -+ maComponentInfos.nHeight = 100; -+} -+ -+::rtl::OUString UnoMultiPageControl::GetComponentServiceName() -+{ -+ return ::rtl::OUString::createFromAscii( "multipage" ); -+} -+ -+sal_Bool UnoMultiPageControl::isTransparent() throw(uno::RuntimeException) -+{ -+ return sal_True; -+} -+ -+ -+ - // ---------------------------------------------------- - // class UnoControlListBoxModel - // ---------------------------------------------------- -diff --git toolkit/source/helper/registerservices.cxx toolkit/source/helper/registerservices.cxx -index 6bbc5eb..cb48a95 100644 ---- toolkit/source/helper/registerservices.cxx -+++ toolkit/source/helper/registerservices.cxx -@@ -168,6 +168,7 @@ IMPL_CREATEINSTANCE( UnoControlTimeFieldModel ) - IMPL_CREATEINSTANCE( UnoControlProgressBarModel ) - IMPL_CREATEINSTANCE( UnoControlScrollBarModel ) - IMPL_CREATEINSTANCE( UnoSpinButtonModel ) -+IMPL_CREATEINSTANCE( UnoMultiPageModel ) - IMPL_CREATEINSTANCE( UnoControlFixedLineModel ) - IMPL_CREATEINSTANCE( UnoCurrencyFieldControl ) - IMPL_CREATEINSTANCE( UnoDateFieldControl ) -@@ -187,6 +188,7 @@ IMPL_CREATEINSTANCE( UnoTimeFieldControl ) - IMPL_CREATEINSTANCE( UnoProgressBarControl ) - IMPL_CREATEINSTANCE( UnoScrollBarControl ) - IMPL_CREATEINSTANCE( UnoSpinButtonControl ) -+IMPL_CREATEINSTANCE( UnoMultiPageControl ) - IMPL_CREATEINSTANCE( UnoFixedLineControl ) - IMPL_CREATEINSTANCE( VCLXMenuBar ) - IMPL_CREATEINSTANCE( VCLXPointer ) -@@ -273,6 +275,8 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, - registerServices( xRegistryKey, "UnoControlScrollBarModel", szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel ); - registerServices( xRegistryKey, "UnoSpinButtonModel", szServiceName_UnoSpinButtonModel ); - registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl ); -+ registerServices( xRegistryKey, "UnoMultiPageModel", szServiceName_UnoMultiPageModel ); -+ registerServices( xRegistryKey, "UnoMultiPageControl", szServiceName_UnoMultiPageControl ); - registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine ); - registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel ); - registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer ); -@@ -358,6 +362,8 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen - CHECKANDCREATEFACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer ) - CHECKANDCREATEFACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap ) - CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel ) -+ CHECKANDCREATEFACTORY( UnoMultiPageModel, szServiceName_UnoMultiPageModel, NULL ) -+ CHECKANDCREATEFACTORY( UnoMultiPageControl, szServiceName_UnoMultiPageControl, NULL ) - CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL ) - CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL ) - CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL ) -diff --git toolkit/source/helper/servicenames.cxx toolkit/source/helper/servicenames.cxx -index 3b27e91..e03808d 100644 ---- toolkit/source/helper/servicenames.cxx -+++ toolkit/source/helper/servicenames.cxx -@@ -40,6 +40,8 @@ const sal_Char __FAR_DATA szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", s - const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar"; - const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer"; - const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer"; -+ -+ - const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel"; - const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController"; - const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel"; -@@ -92,6 +94,8 @@ const sal_Char __FAR_DATA szServiceName_UnoControlRoadmap[] = "stardiv.vcl.contr - const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel"; - const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton"; - const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel"; -+const sal_Char __FAR_DATA szServiceName_UnoMultiPageControl[] = "com.sun.star.awt.UnoControlMultiPage"; -+const sal_Char __FAR_DATA szServiceName_UnoMultiPageModel[] = "com.sun.star.awt.UnoMultiPageModel"; - const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl"; - const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel"; - const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel"; -diff --git vbahelper/inc/vbahelper/vbaapplicationbase.hxx vbahelper/inc/vbahelper/vbaapplicationbase.hxx -index aff57d0..a4d550b 100644 ---- vbahelper/inc/vbahelper/vbaapplicationbase.hxx -+++ vbahelper/inc/vbahelper/vbaapplicationbase.hxx -@@ -33,14 +33,16 @@ - #include <ooo/vba/XHelperInterface.hpp> - #include <ooo/vba/XApplicationBase.hpp> - #include <vbahelper/vbahelperinterface.hxx> -+#include <sfx2/objsh.hxx> - - typedef InheritedHelperInterfaceImpl1< ov::XApplicationBase > ApplicationBase_BASE; - --class VbaApplicationBase : public ApplicationBase_BASE -+class VBAHELPER_DLLPUBLIC VbaApplicationBase : public ApplicationBase_BASE - { - protected: - VbaApplicationBase( const css::uno::Reference< css::uno::XComponentContext >& xContext ); - virtual ~VbaApplicationBase(); -+ virtual SfxObjectShell* GetDocShell( const css::uno::Reference< css::frame::XModel >& /*xModel*/ ) throw (css::uno::RuntimeException) { return NULL; } - - public: - // XHelperInterface ( parent is itself ) -@@ -51,6 +53,9 @@ public: - virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException); - virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); -+ virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException); - - // XHelperInterface - virtual rtl::OUString& getServiceImplName(); -diff --git vbahelper/inc/vbahelper/vbacollectionimpl.hxx vbahelper/inc/vbahelper/vbacollectionimpl.hxx -index fec7b92..bc60cf1 100644 ---- vbahelper/inc/vbahelper/vbacollectionimpl.hxx -+++ vbahelper/inc/vbahelper/vbacollectionimpl.hxx -@@ -49,7 +49,7 @@ - - typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE; - --class EnumerationHelperImpl : public EnumerationHelper_BASE -+class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE - { - protected: - css::uno::Reference< css::uno::XComponentContext > m_xContext; -@@ -68,7 +68,7 @@ public: - typedef ::cppu::WeakImplHelper3< css::container::XNameAccess, css::container::XIndexAccess, css::container::XEnumerationAccess > XNamedCollectionHelper_BASE; - - template< typename Ifc1 > --class XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE -+class VBAHELPER_DLLPUBLIC XNamedObjectCollectionHelper : public XNamedCollectionHelper_BASE - { - public: - typedef std::vector< css::uno::Reference< Ifc1 > > XNamedVec; -@@ -237,7 +237,7 @@ typedef ::cppu::WeakImplHelper1<ov::XCollection> XCollection_InterfacesBASE; - - typedef ScVbaCollectionBase< XCollection_InterfacesBASE > CollImplBase1; - // compatible with the old collections ( pre XHelperInterface base class ) ( some internal objects still use this ) --class ScVbaCollectionBaseImpl : public CollImplBase1 -+class VBAHELPER_DLLPUBLIC ScVbaCollectionBaseImpl : public CollImplBase1 - { - public: - ScVbaCollectionBaseImpl( const css::uno::Reference< ov::XHelperInterface > xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : CollImplBase1( xParent, xContext, xIndexAccess){} -@@ -245,7 +245,7 @@ public: - }; - - template <typename Ifc> // where Ifc must implement XCollectionTest --class CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > -+class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > - { - typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1; - -diff --git vbahelper/inc/vbahelper/vbadialogbase.hxx vbahelper/inc/vbahelper/vbadialogbase.hxx -new file mode 100644 -index 0000000..4b3e2a2 ---- /dev/null -+++ vbahelper/inc/vbahelper/vbadialogbase.hxx -@@ -0,0 +1,52 @@ -+/************************************************************************* -+ * -+ * 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: vbadialog.hxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 VBA_DIALOG_BASE_HXX -+#define VBA_DIALOG_BASE_HXX -+ -+#include <cppuhelper/implbase1.hxx> -+#include <ooo/vba/XDialogBase.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ov::XDialogBase > VbaDialogBase_BASE; -+ -+class VBAHELPER_DLLPUBLIC VbaDialogBase : public VbaDialogBase_BASE -+{ -+protected: -+ sal_Int32 mnIndex; -+public: -+ VbaDialogBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > xContext, sal_Int32 nIndex ):VbaDialogBase_BASE( xParent, xContext ), mnIndex( nIndex ) {} -+ virtual ~VbaDialogBase() {} -+ -+ // Methods -+ virtual void SAL_CALL Show() throw (css::uno::RuntimeException); -+ virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ) = 0; -+}; -+ -+#endif /* VBA_DIALOG_BASE_HXX */ -diff --git vbahelper/inc/vbahelper/vbadialogsbase.hxx vbahelper/inc/vbahelper/vbadialogsbase.hxx -new file mode 100644 -index 0000000..e8b1b2e ---- /dev/null -+++ vbahelper/inc/vbahelper/vbadialogsbase.hxx -@@ -0,0 +1,51 @@ -+/************************************************************************* -+ * -+ * 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: vbadialogs.hxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 VBA_DIALOGS_BASE_HXX -+#define VBA_DIALOGS_BASE_HXX -+ -+#include <cppuhelper/implbase1.hxx> -+#include <ooo/vba/XHelperInterface.hpp> -+#include <ooo/vba/XDialogsBase.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ov::XDialogsBase > VbaDialogsBase_BASE; -+ -+class VBAHELPER_DLLPUBLIC VbaDialogsBase : public VbaDialogsBase_BASE -+{ -+public: -+ VbaDialogsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext > &xContext ): VbaDialogsBase_BASE( xParent, xContext ) {} -+ virtual ~VbaDialogsBase() {} -+ -+ // XCollection -+ virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); -+}; -+ -+#endif /* VBA_DIALOGS_BASE_HXX */ -diff --git vbahelper/inc/vbahelper/vbadocumentbase.hxx vbahelper/inc/vbahelper/vbadocumentbase.hxx -index 985cd25..9576510 100644 ---- vbahelper/inc/vbahelper/vbadocumentbase.hxx -+++ vbahelper/inc/vbahelper/vbadocumentbase.hxx -@@ -36,7 +36,7 @@ - - typedef InheritedHelperInterfaceImpl1< ooo::vba::XDocumentBase > VbaDocumentBase_BASE; - --class VbaDocumentBase : public VbaDocumentBase_BASE -+class VBAHELPER_DLLPUBLIC VbaDocumentBase : public VbaDocumentBase_BASE - { - protected: - css::uno::Reference< css::frame::XModel > mxModel; -diff --git vbahelper/inc/vbahelper/vbadocumentsbase.hxx vbahelper/inc/vbahelper/vbadocumentsbase.hxx -new file mode 100644 -index 0000000..cc8c1b3 ---- /dev/null -+++ vbahelper/inc/vbahelper/vbadocumentsbase.hxx -@@ -0,0 +1,69 @@ -+/************************************************************************* -+ * -+ * 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 VBA_WORKBOOKS_HXX -+#define VBA_WORKBOOKS_HXX -+ -+ -+#include <vbahelper/vbacollectionimpl.hxx> -+#include <ooo/vba/XDocumentsBase.hpp> -+#include <com/sun/star/container/XEnumerationAccess.hpp> -+ -+typedef CollTestImplHelper< ooo::vba::XDocumentsBase > VbaDocumentsBase_BASE; -+ -+class VBAHELPER_DLLPUBLIC VbaDocumentsBase : public VbaDocumentsBase_BASE -+{ -+public: -+ enum DOCUMENT_TYPE -+ { -+ WORD_DOCUMENT = 1, -+ EXCEL_DOCUMENT -+ }; -+ -+private: -+ DOCUMENT_TYPE meDocType; -+ -+public: -+ VbaDocumentsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, DOCUMENT_TYPE eDocType ) throw (css::uno::RuntimeException); -+ virtual ~VbaDocumentsBase() {} -+ -+ // XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0; -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0; -+ -+ // VbaDocumentsBase_BASE -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0; -+ -+ // XDocumentsBase -+ virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); -+}; -+ -+#endif /* SC_VBA_WORKBOOKS_HXX */ -diff --git vbahelper/inc/vbahelper/vbafontbase.hxx vbahelper/inc/vbahelper/vbafontbase.hxx -new file mode 100644 -index 0000000..be30554 ---- /dev/null -+++ vbahelper/inc/vbahelper/vbafontbase.hxx -@@ -0,0 +1,99 @@ -+/************************************************************************* -+ * -+ * 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: vbafont.hxx,v $ -+ * $Revision: 1.5 $ -+ * -+ * 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 VBAHELPER_FONTBASE_HXX -+#define VBAHELPER_FONTBASE_HXX -+ -+#include <cppuhelper/implbase1.hxx> -+ -+#include <ooo/vba/XFontBase.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+// use local constants there is no need to expose these constants -+// externally. Looking at the Format->Character dialog it seem that -+// these may infact be even be calculated. Leave hardcoded for now -+// #FIXEME #TBD investigate the code for dialog mentioned above -+ -+// The font baseline is not specified. -+const short NORMAL = 0; -+ -+// specifies a superscripted. -+const short SUPERSCRIPT = 33; -+ -+// specifies a subscripted. -+const short SUBSCRIPT = -33; -+ -+// specifies a hight of superscripted font -+ const sal_Int8 SUPERSCRIPTHEIGHT = 58; -+ -+// specifies a hight of subscripted font -+const sal_Int8 SUBSCRIPTHEIGHT = 58; -+ -+// specifies a hight of normal font -+const short NORMALHEIGHT = 100; -+ -+typedef InheritedHelperInterfaceImpl1< ov::XFontBase > VbaFontBase_BASE; -+ -+class VBAHELPER_DLLPUBLIC VbaFontBase : public VbaFontBase_BASE -+{ -+protected: -+ css::uno::Reference< css::beans::XPropertySet > mxFont; -+ css::uno::Reference< css::container::XIndexAccess > mxPalette; -+public: -+ VbaFontBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xPalette, css::uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException ); -+ virtual ~VbaFontBase();// {} -+ -+ // Attributes -+ virtual css::uno::Any SAL_CALL getSize() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setSize( const css::uno::Any& _size ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getColorIndex() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setColorIndex( const css::uno::Any& _colorindex ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getBold() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setBold( const css::uno::Any& _bold ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getUnderline() throw (css::uno::RuntimeException) = 0; -+ virtual void SAL_CALL setUnderline( const css::uno::Any& _underline ) throw (css::uno::RuntimeException) = 0; -+ virtual css::uno::Any SAL_CALL getStrikethrough() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setStrikethrough( const css::uno::Any& _strikethrough ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getShadow() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setShadow( const css::uno::Any& _shadow ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getItalic() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setItalic( const css::uno::Any& _italic ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getSubscript() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setSubscript( const css::uno::Any& _subscript ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getSuperscript() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setSuperscript( const css::uno::Any& _superscript ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getName() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setName( const css::uno::Any& _name ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL getColor() throw (css::uno::RuntimeException) ; -+ virtual void SAL_CALL setColor( const css::uno::Any& _color ) throw (css::uno::RuntimeException) ; -+}; -+ -+#endif -+ -diff --git vbahelper/inc/vbahelper/vbaglobalbase.hxx vbahelper/inc/vbahelper/vbaglobalbase.hxx -index 43c8286..f9c0d25 100644 ---- vbahelper/inc/vbahelper/vbaglobalbase.hxx -+++ vbahelper/inc/vbahelper/vbaglobalbase.hxx -@@ -34,7 +34,7 @@ - #include <ooo/vba/XGlobalsBase.hpp> - - typedef InheritedHelperInterfaceImpl1< ov::XGlobalsBase > Globals_BASE; --class VbaGlobalsBase : public Globals_BASE -+class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE - - { - protected: -diff --git vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/inc/vbahelper/vbahelper.hxx -index a333cf0..1849437 100644 ---- vbahelper/inc/vbahelper/vbahelper.hxx -+++ vbahelper/inc/vbahelper/vbahelper.hxx -@@ -92,7 +92,6 @@ namespace ooo - VBAHELPER_DLLPUBLIC double PixelsToPoints( css::uno::Reference< css::awt::XDevice >& xDevice, double fPoints, sal_Bool bVertical); - VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle(); - VBAHELPER_DLLPUBLIC void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite ); -- VBAHELPER_DLLPUBLIC String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro ); - - class VBAHELPER_DLLPUBLIC Millimeter - { -diff --git vbahelper/inc/vbahelper/vbahelperinterface.hxx vbahelper/inc/vbahelper/vbahelperinterface.hxx -index 389a825..3d82aaa 100644 ---- vbahelper/inc/vbahelper/vbahelperinterface.hxx -+++ vbahelper/inc/vbahelper/vbahelperinterface.hxx -@@ -64,7 +64,7 @@ - const ::rtl::OUString sHelperServiceName( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.HelperServiceBase" ) ); - - template< typename Ifc1 > --class InheritedHelperInterfaceImpl : public Ifc1 -+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl : public Ifc1 - { - protected: - css::uno::WeakReference< ov::XHelperInterface > mxParent; -@@ -110,7 +110,7 @@ public: - }; - - template< typename Ifc1 > --class InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > -+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > - - { - typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base; -diff --git vbahelper/inc/vbahelper/vbapagesetupbase.hxx vbahelper/inc/vbahelper/vbapagesetupbase.hxx -new file mode 100644 -index 0000000..4c8a4bc ---- /dev/null -+++ vbahelper/inc/vbahelper/vbapagesetupbase.hxx -@@ -0,0 +1,70 @@ -+/************************************************************************* -+ * -+ * 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 VBA_PAGESETUPBASE_HXX -+#define VBA_PAGESETUPBASE_HXX -+ -+#include <cppuhelper/implbase1.hxx> -+#include <ooo/vba/XPageSetupBase.hpp> -+#include <com/sun/star/uno/XComponentContext.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ooo::vba::XPageSetupBase > VbaPageSetupBase_BASE; -+ -+class VBAHELPER_DLLPUBLIC VbaPageSetupBase : public VbaPageSetupBase_BASE -+{ -+protected: -+ css::uno::Reference< css::frame::XModel > mxModel; -+ css::uno::Reference< css::beans::XPropertySet > mxPageProps; -+ sal_Int32 mnOrientLandscape; -+ sal_Int32 mnOrientPortrait; -+ -+ VbaPageSetupBase( const css::uno::Reference< ov::XHelperInterface >& xParent, -+ const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException); -+public: -+ virtual ~VbaPageSetupBase(){} -+ -+ // Attribute -+ 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); -+}; -+#endif -diff --git vbahelper/inc/vbahelper/vbapropvalue.hxx vbahelper/inc/vbahelper/vbapropvalue.hxx -index c782f5b..d56d799 100644 ---- vbahelper/inc/vbahelper/vbapropvalue.hxx -+++ vbahelper/inc/vbahelper/vbapropvalue.hxx -@@ -36,7 +36,7 @@ - - typedef ::cppu::WeakImplHelper1< ov::XPropValue > PropValueImpl_BASE; - --class PropListener -+class VBAHELPER_DLLPUBLIC PropListener - { - public: - virtual void setValueEvent( const css::uno::Any& value ) = 0; -@@ -44,7 +44,7 @@ public: - }; - - --class ScVbaPropValue : public PropValueImpl_BASE -+class VBAHELPER_DLLPUBLIC ScVbaPropValue : public PropValueImpl_BASE - { - PropListener* m_pListener; - public: -diff --git vbahelper/inc/vbahelper/vbashape.hxx vbahelper/inc/vbahelper/vbashape.hxx -new file mode 100644 -index 0000000..7893905 ---- /dev/null -+++ vbahelper/inc/vbahelper/vbashape.hxx -@@ -0,0 +1,117 @@ -+/************************************************************************* -+ * -+ * 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: vbashape.hxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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_SHAPE_HXX -+#define SC_VBA_SHAPE_HXX -+ -+#include <ooo/vba/office/MsoShapeType.hpp> -+#include <com/sun/star/drawing/XShape.hpp> -+#include <com/sun/star/drawing/XShapes.hpp> -+#include <com/sun/star/lang/XEventListener.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <ooo/vba/msforms/XShape.hpp> -+#include <ooo/vba/msforms/XLineFormat.hpp> -+#include <cppuhelper/implbase2.hxx> -+ -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef ::cppu::WeakImplHelper2< ov::msforms::XShape, css::lang::XEventListener > ListeningShape; -+ -+typedef InheritedHelperInterfaceImpl< ListeningShape > ScVbaShape_BASE; -+ -+class VBAHELPER_DLLPUBLIC ScVbaShape : public ScVbaShape_BASE -+{ -+private: -+protected: -+ std::auto_ptr< ov::ShapeHelper > m_pShapeHelper; -+ css::uno::Reference< css::drawing::XShape > m_xShape; -+ css::uno::Reference< css::drawing::XShapes > m_xShapes; -+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -+ sal_Int32 m_nType; -+ css::uno::Any m_aRange; -+ virtual void addListeners(); -+ virtual void removeShapeListener() throw( css::uno::RuntimeException ); -+ virtual void removeShapesListener() throw( css::uno::RuntimeException ); -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+public: -+ ScVbaShape( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape, const css::uno::Reference< css::drawing::XShapes >& xShapes, sal_Int32 nType ) throw ( css::lang::IllegalArgumentException ); -+ ScVbaShape( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape >& xShape ) throw ( css::lang::IllegalArgumentException ); -+ virtual ~ScVbaShape(); -+ css::uno::Any getRange() { return m_aRange; }; -+ void setRange( css::uno::Any aRange ) { m_aRange = aRange; }; -+ -+ static sal_Int32 getType( const css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException); -+ -+ // Attributes -+ virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getTop() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getZOrderPosition() throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getType() throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getRotation() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setRotation( double _rotation ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ov::msforms::XPictureFormat > SAL_CALL getPictureFormat() throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getLockAspectRatio() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getLockAnchor() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException); -+ -+ // Methods -+ virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL Delete() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL ScaleHeight( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL ScaleWidth( double Factor, sal_Bool RelativeToOriginalSize, sal_Int32 Scale ) throw (css::uno::RuntimeException); -+ // Replace?? -+ virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException ); -+ // XEventListener -+ virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException ); -+}; -+#endif//SC_VBA_SHAPE_HXX -diff --git vbahelper/inc/vbahelper/vbashaperange.hxx vbahelper/inc/vbahelper/vbashaperange.hxx -new file mode 100644 -index 0000000..af39456 ---- /dev/null -+++ vbahelper/inc/vbahelper/vbashaperange.hxx -@@ -0,0 +1,88 @@ -+/************************************************************************* -+ * -+ * 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: vbashaperange.hxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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_SHAPERANGE_HXX -+#define SC_VBA_SHAPERANGE_HXX -+ -+#include <com/sun/star/drawing/XShapes.hpp> -+#include <ooo/vba/msforms/XShapeRange.hpp> -+#include <com/sun/star/drawing/XDrawPage.hpp> -+#include <vbahelper/vbacollectionimpl.hxx> -+#include <ooo/vba/msforms/XLineFormat.hpp> -+#include <ooo/vba/msforms/XFillFormat.hpp> -+ -+typedef CollTestImplHelper< ov::msforms::XShapeRange > ScVbaShapeRange_BASE; -+ -+class VBAHELPER_DLLPUBLIC ScVbaShapeRange : public ScVbaShapeRange_BASE -+{ -+private: -+ css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; -+ css::uno::Reference< css::drawing::XShapes > m_xShapes; -+ sal_Int32 m_nShapeGroupCount; -+protected: -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+ css::uno::Reference< css::drawing::XShapes > getShapes() throw (css::uno::RuntimeException) ; -+public: -+ ScVbaShapeRange( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xShapes, const css::uno::Reference< css::drawing::XDrawPage>& xDrawShape ); -+ -+ // Methods -+ virtual void SAL_CALL Select( ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ::ooo::vba::msforms::XShape > SAL_CALL Group() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ; -+ virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setWidth( double _width ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getLeft() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLeft( double _left ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getTop() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ov::msforms::XLineFormat > SAL_CALL getLine() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ov::msforms::XFillFormat > SAL_CALL getFill() throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getLockAspectRatio() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (css::uno::RuntimeException); -+ virtual ::sal_Bool SAL_CALL getLockAnchor() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setLockAnchor( ::sal_Bool _lockanchor ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getRelativeHorizontalPosition() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (css::uno::RuntimeException); -+ virtual ::sal_Int32 SAL_CALL getRelativeVerticalPosition() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException); -+ //XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ // ScVbaCollectionBaseImpl -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -+}; -+ -+#endif//SC_VBA_SHAPERANGE_HXX -diff --git vbahelper/inc/vbahelper/vbashapes.hxx vbahelper/inc/vbahelper/vbashapes.hxx -new file mode 100644 -index 0000000..597f97b ---- /dev/null -+++ vbahelper/inc/vbahelper/vbashapes.hxx -@@ -0,0 +1,83 @@ -+/************************************************************************* -+ * -+ * 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: vbashapes.hxx,v $ -+ * $Revision: 1.3.32.1 $ -+ * -+ * 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_SHAPES_HXX -+#define SC_VBA_SHAPES_HXX -+ -+#include <com/sun/star/drawing/XShapes.hpp> -+#include <com/sun/star/drawing/XDrawPage.hpp> -+#include <com/sun/star/container/XIndexAccess.hpp> -+#include <ooo/vba/msforms/XShapes.hpp> -+ -+#include <vbahelper/vbahelperinterface.hxx> -+ -+#include <vbahelper/vbacollectionimpl.hxx> -+ -+typedef CollTestImplHelper< ov::msforms::XShapes > ScVbaShapes_BASE; -+ -+class VBAHELPER_DLLPUBLIC ScVbaShapes : public ScVbaShapes_BASE -+{ -+private: -+ css::uno::Reference< css::drawing::XShapes > m_xShapes; -+ css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage; -+ sal_Int32 m_nNewShapeCount; -+ void initBaseCollection(); -+protected: -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+ virtual css::uno::Reference< css::container::XIndexAccess > getShapesByArrayIndices( const css::uno::Any& Index ) throw (css::uno::RuntimeException); -+ css::uno::Reference< css::drawing::XShape > createShape( rtl::OUString service ) throw (css::uno::RuntimeException); -+ css::uno::Any AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException); -+ css::uno::Any AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, css::uno::Any aRange ) throw (css::uno::RuntimeException); -+ css::uno::Any AddTextboxInWriter( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); -+ rtl::OUString createName( rtl::OUString sName ); -+ css::uno::Any AddShape( const rtl::OUString& sService, const rtl::OUString& sName, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); -+ //TODO helperapi using a writer document -+ //css::awt::Point calculateTopLeftMargin( css::uno::Reference< ov::XHelperInterface > xDocument ); -+ -+public: -+ ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes ); -+ static void setDefaultShapeProperties( css::uno::Reference< css::drawing::XShape > xShape ) throw (css::uno::RuntimeException); -+ static void setShape_NameProperty( css::uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName ); -+ //XEnumerationAccess -+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); -+ -+ virtual void SAL_CALL SelectAll() throw (css::uno::RuntimeException); -+ //helper::calc -+ virtual css::uno::Any SAL_CALL AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ov::msforms::XShapeRange > SAL_CALL Range( const css::uno::Any& shapes ) throw (css::uno::RuntimeException); -+ // ScVbaCollectionBaseImpl -+ virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) throw (css::uno::RuntimeException); -+ virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index1, const css::uno::Any& Index2 ) throw (css::uno::RuntimeException); -+}; -+ -+#endif//SC_VBA_SHAPES_HXX -diff --git vbahelper/inc/vbahelper/vbatextframe.hxx vbahelper/inc/vbahelper/vbatextframe.hxx -new file mode 100644 -index 0000000..0b7d9ec ---- /dev/null -+++ vbahelper/inc/vbahelper/vbatextframe.hxx -@@ -0,0 +1,70 @@ -+/************************************************************************* -+ * -+ * 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: vbatextframe.hxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 VBA_TEXTFRAME_HXX -+#define VBA_TEXTFRAME_HXX -+#include <ooo/vba/msforms/XTextFrame.hpp> -+#include <com/sun/star/drawing/XShape.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ov::msforms::XTextFrame > VbaTextFrame_BASE; -+ -+class VBAHELPER_DLLPUBLIC VbaTextFrame : public VbaTextFrame_BASE -+{ -+protected: -+ css::uno::Reference< css::drawing::XShape > m_xShape; -+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -+protected: -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+ virtual void setAsMSObehavior(); -+ sal_Int32 getMargin( rtl::OUString sMarginType ); -+ void setMargin( rtl::OUString sMarginType, float fMargin ); -+public: -+ VbaTextFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext , css::uno::Reference< css::drawing::XShape > xShape); -+ virtual ~VbaTextFrame() {} -+ // Attributes -+ virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setAutoSize( sal_Bool _autosize ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getMarginBottom() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMarginBottom( float _marginbottom ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getMarginTop() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMarginTop( float _margintop ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getMarginLeft() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMarginLeft( float _marginleft ) throw (css::uno::RuntimeException); -+ virtual float SAL_CALL getMarginRight() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setMarginRight( float _marginright ) throw (css::uno::RuntimeException); -+ -+ // Methods -+ virtual css::uno::Any SAL_CALL Characters( ) throw (css::uno::RuntimeException); -+ -+}; -+ -+#endif//SC_VBA_TEXTFRAME_HXX -diff --git vbahelper/inc/vbahelper/vbawindowbase.hxx vbahelper/inc/vbahelper/vbawindowbase.hxx -index ad35a98..508f9d2 100644 ---- vbahelper/inc/vbahelper/vbawindowbase.hxx -+++ vbahelper/inc/vbahelper/vbawindowbase.hxx -@@ -38,7 +38,7 @@ - - typedef InheritedHelperInterfaceImpl1<ov::XWindowBase > WindowBaseImpl_BASE; - --class VbaWindowBase : public WindowBaseImpl_BASE -+class VBAHELPER_DLLPUBLIC VbaWindowBase : public WindowBaseImpl_BASE - { - protected: - css::uno::Reference< css::frame::XModel > m_xModel; -diff --git vbahelper/prj/d.lst vbahelper/prj/d.lst -index e06c9d1..d7b61d1 100644 ---- vbahelper/prj/d.lst -+++ vbahelper/prj/d.lst -@@ -1,6 +1,6 @@ - ..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT% - ..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT% --..\%__SRC%\slb\vbahelper.lib %_DEST%\lib%_EXT%\vbahelper.lib -+..\%__SRC%\lib\ivbahelper.lib %_DEST%\lib%_EXT%\vbahelper.lib - ..\%__SRC%\lib\vbahelp*.* %_DEST%\lib%_EXT%\vba*.* - ..\%__SRC%\bin\vbahelper*.* %_DEST%\bin%_EXT%\vbahelper*.* - ..\%__SRC%\bin\msforms*.* %_DEST%\bin%_EXT%\msforms*.* -@@ -11,8 +11,17 @@ mkdir: %_DEST%\inc%_EXT%\basic - ..\inc\vbahelper\helperdecl.hxx %_DEST%\inc%_EXT%\vbahelper\helperdecl.hxx - ..\inc\vbahelper\vbahelperinterface.hxx %_DEST%\inc%_EXT%\vbahelper\vbahelperinterface.hxx - ..\inc\vbahelper\vbaapplicationbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaapplicationbase.hxx -+..\inc\vbahelper\vbafontbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbafontbase.hxx - ..\inc\vbahelper\vbadllapi.h %_DEST%\inc%_EXT%\vbahelper\vbadllapi.h - ..\inc\vbahelper\vbawindowbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbawindowbase.hxx - ..\inc\vbahelper\vbadocumentbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentbase.hxx -+..\inc\vbahelper\vbadocumentsbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadocumentsbase.hxx - ..\inc\vbahelper\vbapropvalue.hxx %_DEST%\inc%_EXT%\vbahelper\vbapropvalue.hxx - ..\inc\vbahelper\vbaglobalbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaglobalbase.hxx -+..\inc\vbahelper\vbadialogbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadialogbase.hxx -+..\inc\vbahelper\vbadialogsbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbadialogsbase.hxx -+..\inc\vbahelper\vbashape.hxx %_DEST%\inc%_EXT%\vbahelper\vbashape.hxx -+..\inc\vbahelper\vbashapes.hxx %_DEST%\inc%_EXT%\vbahelper\vbashapes.hxx -+..\inc\vbahelper\vbatextframe.hxx %_DEST%\inc%_EXT%\vbahelper\vbatextframe.hxx -+..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx -+..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx -diff --git vbahelper/source/msforms/vbacontrol.cxx vbahelper/source/msforms/vbacontrol.cxx -index 100c2b3..3503631 100644 ---- vbahelper/source/msforms/vbacontrol.cxx -+++ vbahelper/source/msforms/vbacontrol.cxx -@@ -361,6 +361,22 @@ ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException - m_xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) ); - } -+ -+rtl::OUString SAL_CALL -+ScVbaControl::getControlTipText() throw (css::uno::RuntimeException) -+{ -+ rtl::OUString sName; -+ m_xProps->getPropertyValue -+ (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ) ) >>= sName; -+ return sName; -+} -+ -+void SAL_CALL -+ScVbaControl::setControlTipText( const rtl::OUString& rsToolTip ) throw (css::uno::RuntimeException) -+{ -+ m_xProps->setPropertyValue -+ (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) ), uno::makeAny( rsToolTip ) ); -+} - //ScVbaControlFactory - - ScVbaControlFactory::ScVbaControlFactory( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel ): m_xContext( xContext ), m_xControl( xControl ), m_xModel( xModel ) -diff --git vbahelper/source/msforms/vbacontrol.hxx vbahelper/source/msforms/vbacontrol.hxx -index e7593e8..3c9a128 100644 ---- vbahelper/source/msforms/vbacontrol.hxx -+++ vbahelper/source/msforms/vbacontrol.hxx -@@ -86,6 +86,8 @@ public: - virtual void SAL_CALL setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException); - virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException); -+ virtual rtl::OUString SAL_CALL getControlTipText() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setControlTipText( const rtl::OUString& ) throw (css::uno::RuntimeException); - //remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape - virtual void removeResouce() throw( css::uno::RuntimeException ); - //XHelperInterface -diff --git vbahelper/source/msforms/vbalistbox.cxx vbahelper/source/msforms/vbalistbox.cxx -index 39eb251..47f9847 100644 ---- vbahelper/source/msforms/vbalistbox.cxx -+++ vbahelper/source/msforms/vbalistbox.cxx -@@ -53,7 +53,8 @@ ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExceptio - { - sal_Int32 nIndex = 0; - _value >>= nIndex; -- Selected( nIndex ); -+ uno::Reference< XPropValue > xPropVal( Selected( nIndex ), uno::UNO_QUERY_THROW ); -+ xPropVal->setValue( uno::makeAny( sal_True ) ); - } - - uno::Any SAL_CALL -@@ -224,7 +225,8 @@ ScVbaListBox::setValueEvent( const uno::Any& value ) - nList.realloc( 1 ); - nList[0] = nIndex; - } -- m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); -+ //m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) ); -+ m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) ); - } - } - -diff --git vbahelper/source/msforms/vbatextbox.hxx vbahelper/source/msforms/vbatextbox.hxx -index 3abe491..4e26f6f 100644 ---- vbahelper/source/msforms/vbatextbox.hxx -+++ vbahelper/source/msforms/vbatextbox.hxx -@@ -29,12 +29,12 @@ - ************************************************************************/ - #ifndef SC_VBA_TEXTBOX_HXX - #define SC_VBA_TEXTBOX_HXX --#include <cppuhelper/implbase1.hxx> -+#include <cppuhelper/implbase2.hxx> - #include <ooo/vba/msforms/XTextBox.hpp> - #include "vbacontrol.hxx" - #include <vbahelper/vbahelper.hxx> - --typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XTextBox > TextBoxImpl_BASE; -+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XTextBox, css::script::XDefaultProperty > TextBoxImpl_BASE; - - class ScVbaTextBox : public TextBoxImpl_BASE - { -@@ -50,6 +50,8 @@ public: - virtual void SAL_CALL setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getMultiline() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeException); -+ // XDefaultProperty -+ rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); } - //XHelperInterface - virtual rtl::OUString& getServiceImplName(); - virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -diff --git vbahelper/source/msforms/vbauserform.cxx vbahelper/source/msforms/vbauserform.cxx -index 775b539..fef36db 100644 ---- vbahelper/source/msforms/vbauserform.cxx -+++ vbahelper/source/msforms/vbauserform.cxx -@@ -72,6 +72,7 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException) - { - OSL_TRACE("ScVbaUserForm::Show( )"); - short aRet = 0; -+ mbDispose = true; - if ( m_xDialog.is() ) - aRet = m_xDialog->execute(); - OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); -diff --git vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/makefile.mk -index 8f5862a..61155e6 100644 ---- vbahelper/source/vbahelper/makefile.mk -+++ vbahelper/source/vbahelper/makefile.mk -@@ -31,7 +31,7 @@ - - PRJ=..$/../ - PRJNAME=vbahelper --TARGET=vbahelper -+TARGET=vbahelperbits - - ENABLE_EXCEPTIONS := TRUE - -@@ -49,7 +49,20 @@ SLOFILES=\ - $(SLO)$/vbaapplicationbase.obj \ - $(SLO)$/vbawindowbase.obj \ - $(SLO)$/vbadocumentbase.obj \ -+ $(SLO)$/vbadocumentsbase.obj \ - $(SLO)$/vbaglobalbase.obj \ -+ $(SLO)$/vbafontbase.obj \ -+ $(SLO)$/vbadialogbase.obj \ -+ $(SLO)$/vbadialogsbase.obj \ -+ $(SLO)$/vbashape.obj \ -+ $(SLO)$/vbacolorformat.obj \ -+ $(SLO)$/vbashapes.obj \ -+ $(SLO)$/vbalineformat.obj \ -+ $(SLO)$/vbafillformat.obj \ -+ $(SLO)$/vbapictureformat.obj \ -+ $(SLO)$/vbashaperange.obj \ -+ $(SLO)$/vbatextframe.obj \ -+ $(SLO)$/vbapagesetupbase.obj \ - - # --- Targets ------------------------------------------------------- - -diff --git vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbaapplicationbase.cxx -index b6a8dee..a424b35 100644 ---- vbahelper/source/vbahelper/vbaapplicationbase.cxx -+++ vbahelper/source/vbahelper/vbaapplicationbase.cxx -@@ -35,13 +35,21 @@ - #include "vbahelper/vbaapplicationbase.hxx" - #include <com/sun/star/container/XIndexAccess.hpp> - #include <com/sun/star/frame/XLayoutManager.hpp> -+#include <com/sun/star/frame/XDesktop.hpp> -+#include <com/sun/star/container/XEnumerationAccess.hpp> -+#include <com/sun/star/document/XDocumentInfoSupplier.hpp> -+#include <com/sun/star/document/XDocumentProperties.hpp> -+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> - - #include "vbacommandbars.hxx" -+#include <svx/msvbahelper.hxx> - - using namespace com::sun::star; - using namespace ooo::vba; - --VbaApplicationBase::VbaApplicationBase( const uno::Reference< css::uno::XComponentContext >& xContext ) -+#define OFFICEVERSION "11.0" -+ -+VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentContext >& xContext ) - : ApplicationBase_BASE( uno::Reference< XHelperInterface >(), xContext ) - { - } -@@ -118,6 +126,251 @@ VbaApplicationBase::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeExc - return uno::makeAny( xCommandBars ); - } - -+::rtl::OUString SAL_CALL -+VbaApplicationBase::getVersion() throw (uno::RuntimeException) -+{ -+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OFFICEVERSION)); -+} -+ -+void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException) -+{ -+ // parse the macro name -+ sal_Int32 nDocSepIndex = MacroName.indexOfAsciiL( "!", 1 ); -+ String sMacroUrl = MacroName; -+ uno::Reference< frame::XModel > xModel; -+ if( nDocSepIndex > 0 ) -+ { -+ rtl::OUString sTemplate = MacroName.copy( 0, nDocSepIndex ); -+ OSL_TRACE("VbaApplicationBase::Run, template name: %s", rtl::OUStringToOString( sTemplate, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ sMacroUrl = MacroName.copy( nDocSepIndex + 1 ); -+ OSL_TRACE("VbaApplicationBase::Run, macro name: %s", rtl::OUStringToOString( sMacroUrl, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ -+ // get the template model -+ uno::Reference< lang::XMultiComponentFactory > xSMgr( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -+ -+ uno::Reference< frame::XDesktop > xDesktop -+ (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), mxContext), uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration(); -+ sal_Int32 nCount = 0; -+ while( mxComponents->hasMoreElements() ) -+ { -+ uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( mxComponents->nextElement(), uno::UNO_QUERY ); -+ if( xDocInfoSupp.is() ) -+ { -+ uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW ); -+ uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW ); -+ rtl::OUString sCurrName = xDocProps->getTemplateName(); -+ OSL_TRACE("VbaApplicationBase::Run, current template %d name: %s", ++nCount, rtl::OUStringToOString( sCurrName, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ // FIXME: should be check the full path of the template -+ if( sTemplate.lastIndexOf( sCurrName ) >= 0 ) -+ { -+ xModel.set( xDocInfoSupp, uno::UNO_QUERY_THROW ); -+ break; -+ } -+ } -+ } -+ } -+ else -+ { -+ xModel = getCurrentDocument(); -+ } -+ -+ if( !xModel.is() ) -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Fail to find the template in Application.Run") ), uno::Reference< uno::XInterface >() ); -+ } -+ -+ String sMacro; -+ String sModule; -+ sal_Int32 nTokens = sMacroUrl.GetTokenCount( '.' ); -+ xub_StrLen nToken = 0; -+ xub_StrLen nIndex = 0; -+ // only support ThisModule.ThisMacro -+ if( nTokens == 2 ) -+ { -+ sModule = sMacroUrl.GetToken( nToken, '.', nIndex ); -+ sMacro = sMacroUrl.GetToken( nToken, '.', nIndex ); -+ } -+ else -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The macro doesn't exist") ), uno::Reference< uno::XInterface >() ); -+ } -+ -+ SfxObjectShell* pShell = GetDocShell( xModel ); -+ if( pShell ) -+ { -+ sMacroUrl = findVBAMacro( pShell, sModule, sMacro ); -+ if( sMacroUrl.Len() ) -+ { -+ // handle the arguments -+ uno::Sequence< uno::Any > aArgs; -+ if( varg1.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg1; -+ } -+ if( varg2.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg2; -+ } -+ if( varg3.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg3; -+ } -+ if( varg4.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg4; -+ } -+ if( varg5.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg5; -+ } -+ if( varg6.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg6; -+ } -+ if( varg7.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg7; -+ } -+ if( varg8.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg8; -+ } -+ if( varg9.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg9; -+ } -+ if( varg10.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg10; -+ } -+ if( varg11.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg11; -+ } -+ if( varg12.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg12; -+ } -+ if( varg13.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg13; -+ } -+ if( varg14.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg14; -+ } -+ if( varg15.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg15; -+ } -+ if( varg16.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg16; -+ } -+ if( varg17.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg17; -+ } -+ if( varg18.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg18; -+ } -+ if( varg19.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg19; -+ } -+ if( varg20.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg20; -+ } -+ if( varg21.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg21; -+ } -+ if( varg22.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg22; -+ } -+ if( varg23.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg23; -+ } -+ if( varg24.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg24; -+ } -+ if( varg25.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg25; -+ } -+ if( varg26.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg26; -+ } -+ if( varg27.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg27; -+ } -+ if( varg28.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg28; -+ } -+ if( varg29.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg29; -+ } -+ if( varg30.hasValue() ) -+ { -+ aArgs.realloc( aArgs.getLength() + 1 ); -+ aArgs[ aArgs.getLength() ] = varg30; -+ } -+ uno::Any aRet; -+ executeMacro( pShell, sMacroUrl, aArgs, aRet ); -+ } -+ else -+ { -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("The macro doesn't exist") ), uno::Reference< uno::XInterface >() ); -+ } -+ } -+} -+ -+float SAL_CALL VbaApplicationBase::CentimetersToPoints( float _Centimeters ) throw (uno::RuntimeException) -+{ -+ // i cm = 28.35 points -+ static const float rate = 28.35; -+ return ( _Centimeters * rate ); -+} -+ - rtl::OUString& - VbaApplicationBase::getServiceImplName() - { -diff --git vbahelper/source/vbahelper/vbacolorformat.cxx vbahelper/source/vbahelper/vbacolorformat.cxx -new file mode 100644 -index 0000000..d2ce12b ---- /dev/null -+++ vbahelper/source/vbahelper/vbacolorformat.cxx -@@ -0,0 +1,190 @@ -+/************************************************************************* -+ * -+ * 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: vbacolorformat.cxx,v $ -+ * $Revision: 1.3.146.1 $ -+ * -+ * 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 <com/sun/star/beans/XPropertySet.hpp> -+#include <ooo/vba/msforms/XLineFormat.hpp> -+#include "vbacolorformat.hxx" -+ -+using namespace ooo::vba; -+using namespace com::sun::star; -+ -+sal_Int32 -+MsoColorIndizes::getColorIndex( sal_Int32 nIndex ) -+{ -+ const static sal_Int32 COLORINDIZES[56] = -+ { HAPICOLOR_BLACK, HAPICOLOR_WITHE, HAPICOLOR_RED, HAPICOLOR_BRIGHTGREEN, HAPICOLOR_BLUE, HAPICOLOR_YELLOW, HAPICOLOR_PINK, -+ HAPICOLOR_TURQUOISE, HAPICOLOR_DARKRED, HAPICOLOR_GREEN, HAPICOLOR_DARKBLUE, HAPICOLOR_DARKYELLOW, HAPICOLOR_VIOLET, -+ HAPICOLOR_TEAL, HAPICOLOR_GRAY_25_PERCENT, HAPICOLOR_GRAY_50_PERCENT, HAPICOLOR_PERIWINCKLE, HAPICOLOR_PLUM, -+ HAPICOLOR_IVORY, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_DARKPRUPLE, HAPICOLOR_CORAL, HAPICOLOR_OCEANBLUE, HAPICOLOR_ICEBLUE, -+ HAPICOLOR_GREEN, HAPICOLOR_PINK, HAPICOLOR_YELLOW, HAPICOLOR_TURQUOISE, HAPICOLOR_VIOLET, HAPICOLOR_DARKRED, HAPICOLOR_TEAL, -+ HAPICOLOR_BLUE, HAPICOLOR_SKYBLUE, HAPICOLOR_LIGHTTURQUOISE, HAPICOLOR_LIGHTGREEN, HAPICOLOR_LIGHTYELLOW, HAPICOLOR_PALEBLUE, -+ HAPICOLOR_ROSE, HAPICOLOR_LAVENDER, HAPICOLOR_TAN, HAPICOLOR_LIGHTBLUE, HAPICOLOR_AQUA, HAPICOLOR_LIME, HAPICOLOR_GOLD, -+ HAPICOLOR_LIGHTORANGE, HAPICOLOR_ORANGE, HAPICOLOR_BLUEGRAY, HAPICOLOR_GRAY_40_PERCENT, HAPICOLOR_DARKTEAL, -+ HAPICOLOR_SEAGREEN, HAPICOLOR_NONAME, HAPICOLOR_OLIVEGREEN, HAPICOLOR_BROWN, HAPICOLOR_PLUM, HAPICOLOR_INDIGO, -+ HAPICOLOR_GRAY_80_PERCENT -+ }; -+ return COLORINDIZES[nIndex]; -+} -+ScVbaColorFormat::ScVbaColorFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XHelperInterface > xInternalParent, const uno::Reference< drawing::XShape > xShape, const sal_Int16 nColorFormatType ) : ScVbaColorFormat_BASE( xParent, xContext ), m_xInternalParent( xInternalParent ), m_xShape( xShape ), m_nColorFormatType( nColorFormatType ) -+{ -+ m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); -+ m_nFillFormatBackColor = 0; -+ try -+ { -+ uno::Reference< ov::msforms::XFillFormat > xFillFormat( xInternalParent, uno::UNO_QUERY_THROW ); -+ m_pFillFormat = ( ScVbaFillFormat* )( xFillFormat.get() ); -+ }catch ( uno::RuntimeException e ) -+ { -+ m_pFillFormat = NULL; -+ } -+} -+ -+void -+ScVbaColorFormat::setColorFormat( sal_Int16 _ntype ) -+{ -+ m_nColorFormatType = _ntype; -+} -+ -+// Attribute -+sal_Int32 SAL_CALL -+ScVbaColorFormat::getRGB() throw (uno::RuntimeException) -+{ -+ sal_Int32 nRGB = 0; -+ switch( m_nColorFormatType ) -+ { -+ case ColorFormatType::LINEFORMAT_FORECOLOR: -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("LineColor") ) >>= nRGB; -+ break; -+ case ColorFormatType::LINEFORMAT_BACKCOLOR: -+ //TODO BackColor not supported -+ // m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("Color"), uno::makeAny( nRGB ) ); -+ break; -+ case ColorFormatType::FILLFORMAT_FORECOLOR: -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillColor") ) >>= nRGB; -+ break; -+ case ColorFormatType::FILLFORMAT_BACKCOLOR: -+ nRGB = m_nFillFormatBackColor; -+ break; -+ default: -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); -+ } -+ nRGB = OORGBToXLRGB( nRGB ); -+ return nRGB; -+} -+ -+void SAL_CALL -+ScVbaColorFormat::setRGB( sal_Int32 _rgb ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nRGB = XLRGBToOORGB( _rgb ); -+ switch( m_nColorFormatType ) -+ { -+ case ColorFormatType::LINEFORMAT_FORECOLOR: -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineColor" ), uno::makeAny( nRGB ) ); -+ break; -+ case ColorFormatType::LINEFORMAT_BACKCOLOR: -+ // TODO BackColor not supported -+ break; -+ case ColorFormatType::FILLFORMAT_FORECOLOR: -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor" ), uno::makeAny( nRGB ) ); -+ if( m_pFillFormat ) -+ { -+ m_pFillFormat->setForeColorAndInternalStyle(nRGB); -+ } -+ break; -+ case ColorFormatType::FILLFORMAT_BACKCOLOR: -+ m_nFillFormatBackColor = nRGB; -+ if( m_pFillFormat ) -+ { -+ m_pFillFormat->setForeColorAndInternalStyle(nRGB); -+ } -+ break; -+ default: -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Second parameter of ColorFormat is wrong."), uno::Reference< uno::XInterface >() ); -+ } -+} -+ -+sal_Int32 SAL_CALL -+ScVbaColorFormat::getSchemeColor() throw (uno::RuntimeException) -+{ -+ sal_Int32 nColor = getRGB(); -+ // #TODO I guess the number of elements is determined by the correct scheme -+ // the implementation here seems to be a rehash of color index ( which seems to be a -+ // different thing ) - I would guess we need to know/import etc. the correct color scheme -+ // or at least find out a little more -+ sal_Int32 i = 0; -+ for( ; i < 56; i++ ) -+ { -+ if( nColor == MsoColorIndizes::getColorIndex(i) ) -+ break; -+ } -+ -+ if( i == 56 ) // this is most likely an error condition -+ --i; -+ return i; -+ // #TODO figure out what craziness is this, -+ // the 56 colors seems incorrect, as in default XL ( 2003 ) there are 80 colors -+/* -+ if( i == 56 ) -+ { -+ i = -2; -+ } -+ -+ return ( i + 2 ); -+*/ -+} -+ -+void SAL_CALL -+ScVbaColorFormat::setSchemeColor( sal_Int32 _schemecolor ) throw (uno::RuntimeException) -+{ -+ // the table is 0 based -+ sal_Int32 nColor = MsoColorIndizes::getColorIndex( _schemecolor ); -+ // nColor is already xl RGB -+ setRGB( nColor ); -+} -+ -+ -+rtl::OUString& -+ScVbaColorFormat::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaColorFormat") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+ScVbaColorFormat::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.ColorFormat" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git vbahelper/source/vbahelper/vbacolorformat.hxx vbahelper/source/vbahelper/vbacolorformat.hxx -new file mode 100644 -index 0000000..a45d5d8 ---- /dev/null -+++ vbahelper/source/vbahelper/vbacolorformat.hxx -@@ -0,0 +1,128 @@ -+/************************************************************************* -+ * -+ * 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: vbacolorformat.hxx,v $ -+ * $Revision: 1.3.146.1 $ -+ * -+ * 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_XCOLORFORMAT_HXX -+#define SC_VBA_XCOLORFORMAT_HXX -+ -+#include <com/sun/star/drawing/XShape.hpp> -+#include <ooo/vba/msforms/XColorFormat.hpp> -+#include <ooo/vba/msforms/XFillFormat.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+#include "vbafillformat.hxx" -+ -+typedef InheritedHelperInterfaceImpl1< ov::msforms::XColorFormat > ScVbaColorFormat_BASE; -+ -+class ColorFormatType -+{ -+public: -+ const static sal_Int16 LINEFORMAT_FORECOLOR = 1; -+ const static sal_Int16 LINEFORMAT_BACKCOLOR = 2; -+ const static sal_Int16 FILLFORMAT_FORECOLOR = 3; -+ const static sal_Int16 FILLFORMAT_BACKCOLOR = 4; -+ const static sal_Int16 THREEDFORMAT_EXTRUSIONCOLOR = 5; -+}; -+ -+struct MsoColorIndizes -+{ -+ const static sal_Int32 HAPICOLOR_BLACK = 0; -+ const static sal_Int32 HAPICOLOR_WITHE = 16777215; -+ const static sal_Int32 HAPICOLOR_RED = 16711680; -+ const static sal_Int32 HAPICOLOR_BRIGHTGREEN = 65280; -+ const static sal_Int32 HAPICOLOR_BLUE = 255; -+ const static sal_Int32 HAPICOLOR_YELLOW = 16776960; -+ const static sal_Int32 HAPICOLOR_PINK = 16711935; -+ const static sal_Int32 HAPICOLOR_TURQUOISE = 65535; -+ const static sal_Int32 HAPICOLOR_DARKRED = 8388608; -+ const static sal_Int32 HAPICOLOR_GREEN = 32768; -+ const static sal_Int32 HAPICOLOR_DARKBLUE = 128; -+ const static sal_Int32 HAPICOLOR_DARKYELLOW = 8421376; -+ const static sal_Int32 HAPICOLOR_VIOLET = 8388736; -+ const static sal_Int32 HAPICOLOR_TEAL = 32896; -+ const static sal_Int32 HAPICOLOR_GRAY_25_PERCENT = 12632256; -+ const static sal_Int32 HAPICOLOR_GRAY_50_PERCENT = 8421504; -+ const static sal_Int32 HAPICOLOR_PERIWINCKLE = 10066431; -+ const static sal_Int32 HAPICOLOR_PLUM = 10040166; -+ const static sal_Int32 HAPICOLOR_IVORY = 16777164; -+ const static sal_Int32 HAPICOLOR_LIGHTTURQUOISE = 13434879; -+ const static sal_Int32 HAPICOLOR_DARKPRUPLE = 6684774; -+ const static sal_Int32 HAPICOLOR_CORAL = 16744576; -+ const static sal_Int32 HAPICOLOR_OCEANBLUE = 26316; -+ const static sal_Int32 HAPICOLOR_ICEBLUE = 13421823; -+ const static sal_Int32 HAPICOLOR_SKYBLUE = 52479; -+ const static sal_Int32 HAPICOLOR_LIGHTGREEN = 13434828; -+ const static sal_Int32 HAPICOLOR_LIGHTYELLOW = 16777113; -+ const static sal_Int32 HAPICOLOR_PALEBLUE = 10079487; -+ const static sal_Int32 HAPICOLOR_ROSE = 16751052; -+ const static sal_Int32 HAPICOLOR_LAVENDER = 13408767; -+ const static sal_Int32 HAPICOLOR_TAN = 16764057; -+ const static sal_Int32 HAPICOLOR_LIGHTBLUE = 3368703; -+ const static sal_Int32 HAPICOLOR_AQUA = 3394764; -+ const static sal_Int32 HAPICOLOR_LIME = 10079232; -+ const static sal_Int32 HAPICOLOR_GOLD = 16763904; -+ const static sal_Int32 HAPICOLOR_LIGHTORANGE = 16750848; -+ const static sal_Int32 HAPICOLOR_ORANGE = 16737792; -+ const static sal_Int32 HAPICOLOR_BLUEGRAY = 6710937; -+ const static sal_Int32 HAPICOLOR_GRAY_40_PERCENT = 9868950; -+ const static sal_Int32 HAPICOLOR_DARKTEAL = 13158; -+ const static sal_Int32 HAPICOLOR_SEAGREEN = 3381606; -+ const static sal_Int32 HAPICOLOR_NONAME = 13056; -+ const static sal_Int32 HAPICOLOR_OLIVEGREEN = 3355392; -+ const static sal_Int32 HAPICOLOR_BROWN = 10040064; -+ const static sal_Int32 HAPICOLOR_INDIGO = 3355545; -+ const static sal_Int32 HAPICOLOR_GRAY_80_PERCENT = 3355443; -+ -+ static sal_Int32 getColorIndex( sal_Int32 nIndex ); -+ -+}; -+ -+class ScVbaColorFormat : public ScVbaColorFormat_BASE -+{ -+private: -+ css::uno::Reference< ov::XHelperInterface > m_xInternalParent; -+ css::uno::Reference< css::drawing::XShape > m_xShape; -+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -+ ScVbaFillFormat *m_pFillFormat; -+ sal_Int16 m_nColorFormatType; -+ sal_Int32 m_nFillFormatBackColor; -+protected: -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+ void setColorFormat( sal_Int16 nType ); -+public: -+ ScVbaColorFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< ov::XHelperInterface > xInternalParent, const css::uno::Reference< css::drawing::XShape > xShape, const sal_Int16 nColorFormatType ); -+ -+ // Attributes -+ virtual sal_Int32 SAL_CALL getRGB() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setRGB( sal_Int32 _rgb ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getSchemeColor() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setSchemeColor( sal_Int32 _schemecolor ) throw (css::uno::RuntimeException); -+ -+}; -+ -+#endif//SC_VBA_XCOLORFORMAT_HXX -diff --git vbahelper/source/vbahelper/vbadialogbase.cxx vbahelper/source/vbahelper/vbadialogbase.cxx -new file mode 100644 -index 0000000..205442e ---- /dev/null -+++ vbahelper/source/vbahelper/vbadialogbase.cxx -@@ -0,0 +1,52 @@ -+/************************************************************************* -+ * -+ * 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: vbadialog.cxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 <vbahelper/vbadialogbase.hxx> -+#include <vbahelper/vbahelper.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+// fails silently -+void -+VbaDialogBase::Show() throw(uno::RuntimeException) -+{ -+ rtl::OUString aURL; -+ uno::Reference< frame::XModel > xModel = getCurrentDocument(); -+ if ( xModel.is() ) -+ { -+ aURL = mapIndexToName( mnIndex ); -+ if( aURL.getLength() == 0 ) -+ throw uno::RuntimeException( -+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ), -+ uno::Reference< XInterface > () ); -+ dispatchRequests( xModel, aURL ); -+ } -+} -+ -diff --git vbahelper/source/vbahelper/vbadialogsbase.cxx vbahelper/source/vbahelper/vbadialogsbase.cxx -new file mode 100644 -index 0000000..f3679d6 ---- /dev/null -+++ vbahelper/source/vbahelper/vbadialogsbase.cxx -@@ -0,0 +1,47 @@ -+/************************************************************************* -+ * -+ * 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: vbadialogs.cxx,v $ -+ * $Revision: 1.5 $ -+ * -+ * 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 <vbahelper/vbadialogsbase.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+::sal_Int32 -+VbaDialogsBase::getCount() throw (uno::RuntimeException) -+{ -+ //#TODO #FIXEME -+ return 0; -+} -+ -+uno::Any -+VbaDialogsBase::Item( const uno::Any& /* &aItem */) throw (uno::RuntimeException) -+{ -+ return uno::Any(); -+} -+ -diff --git vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx -new file mode 100644 -index 0000000..813e084 ---- /dev/null -+++ vbahelper/source/vbahelper/vbadocumentsbase.cxx -@@ -0,0 +1,295 @@ -+/************************************************************************* -+ * -+ * 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 <vbahelper/vbadocumentsbase.hxx> -+#include <comphelper/processfactory.hxx> -+#include <cppuhelper/implbase1.hxx> -+#include <cppuhelper/implbase3.hxx> -+#include <com/sun/star/frame/XDesktop.hpp> -+#include <com/sun/star/container/XEnumerationAccess.hpp> -+#include <com/sun/star/frame/XComponentLoader.hpp> -+#include <com/sun/star/lang/XComponent.hpp> -+#include <com/sun/star/frame/XModel.hpp> -+#include <com/sun/star/frame/XFrame.hpp> -+#include <com/sun/star/frame/FrameSearchFlag.hpp> -+#include <com/sun/star/util/XModifiable.hpp> -+#include <com/sun/star/frame/XStorable.hpp> -+#include <com/sun/star/lang/DisposedException.hpp> -+#include <com/sun/star/beans/PropertyVetoException.hpp> -+#include <com/sun/star/util/XCloseable.hpp> -+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -+#include <com/sun/star/document/XTypeDetection.hpp> -+#include <com/sun/star/uri/XUriReference.hpp> -+#include <com/sun/star/uri/XUriReferenceFactory.hpp> -+#include <com/sun/star/lang/XServiceInfo.hpp> -+#include <sfx2/objsh.hxx> -+#include <tools/urlobj.hxx> -+#include <vbahelper/vbahelper.hxx> -+#include <hash_map> -+#include <osl/file.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+static const rtl::OUString sSpreadsheetDocument( rtl::OUString::createFromAscii( "com.sun.star.sheet.SpreadsheetDocument" ) ); -+static const rtl::OUString sTextDocument( rtl::OUString::createFromAscii( "com.sun.star.text.TextDocument" ) ); -+ -+typedef std::hash_map< rtl::OUString, -+sal_Int32, ::rtl::OUStringHash, -+::std::equal_to< ::rtl::OUString > > NameIndexHash; -+ -+typedef std::vector < uno::Reference< frame::XModel > > Documents; -+ -+typedef ::cppu::WeakImplHelper1< container::XEnumeration > DocumentsEnumImpl_BASE; -+ -+// #FIXME clearly this is a candidate for some sort of helper base class as -+// this is a copy of SelectedSheetsEnum ( vbawindow.cxx ) -+ -+class DocumentsEnumImpl : public DocumentsEnumImpl_BASE -+{ -+ uno::Reference< uno::XComponentContext > m_xContext; -+ Documents m_documents; -+ Documents::const_iterator m_it; -+ -+public: -+ DocumentsEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const Documents& docs ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_documents( docs ) -+ { -+ m_it = m_documents.begin(); -+ } -+ DocumentsEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext ) -+ { -+ uno::Reference< lang::XMultiComponentFactory > xSMgr( -+ m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); -+ -+ uno::Reference< frame::XDesktop > xDesktop -+ (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), m_xContext), uno::UNO_QUERY_THROW ); -+ uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration(); -+ while( mxComponents->hasMoreElements() ) -+ { -+ uno::Reference< frame::XModel > xNext( mxComponents->nextElement(), uno::UNO_QUERY ); -+ if ( xNext.is() ) -+ m_documents.push_back( xNext ); -+ } -+ m_it = m_documents.begin(); -+ } -+ // XEnumeration -+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -+ { -+ return m_it != m_documents.end(); -+ } -+ -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( !hasMoreElements() ) -+ { -+ throw container::NoSuchElementException(); -+ } -+ return makeAny( *(m_it++) ); -+ } -+}; -+ -+// #FIXME clearly this is also a candidate for some sort of helper base class as -+// a very similar one is used in vbawindow ( SelectedSheetsEnumAccess ) -+// Maybe a template base class that does all of the operations on the hashmap -+// and vector only, and the sub-class does everything else -+// => ctor, createEnumeration & factory method need be defined ( to be called -+// by getByIndex, getByName ) -+typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess -+ , com::sun::star::container::XIndexAccess -+ , com::sun::star::container::XNameAccess -+ > DocumentsAccessImpl_BASE; -+ -+class DocumentsAccessImpl : public DocumentsAccessImpl_BASE -+{ -+ uno::Reference< uno::XComponentContext > m_xContext; -+ Documents m_documents; -+ NameIndexHash namesToIndices; -+ VbaDocumentsBase::DOCUMENT_TYPE meDocType; -+public: -+ DocumentsAccessImpl( const uno::Reference< uno::XComponentContext >& xContext, VbaDocumentsBase::DOCUMENT_TYPE eDocType ) throw (uno::RuntimeException) :m_xContext( xContext ), meDocType( eDocType ) -+ { -+ uno::Reference< container::XEnumeration > xEnum = new DocumentsEnumImpl( m_xContext ); -+ sal_Int32 nIndex=0; -+ while( xEnum->hasMoreElements() ) -+ { -+ uno::Reference< lang::XServiceInfo > xServiceInfo( xEnum->nextElement(), uno::UNO_QUERY ); -+ if ( xServiceInfo.is() -+ && ( ( xServiceInfo->supportsService( sSpreadsheetDocument ) && meDocType == VbaDocumentsBase::EXCEL_DOCUMENT ) -+ || ( xServiceInfo->supportsService( sTextDocument ) && meDocType == VbaDocumentsBase::WORD_DOCUMENT ) ) ) -+ { -+ uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given -+ m_documents.push_back( xModel ); -+ INetURLObject aURL( xModel->getURL() ); -+ namesToIndices[ aURL.GetLastName() ] = nIndex++; -+ } -+ } -+ -+ } -+ -+ //XEnumerationAccess -+ virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) -+ { -+ return new DocumentsEnumImpl( m_xContext, m_documents ); -+ } -+ // XIndexAccess -+ virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) -+ { -+ return m_documents.size(); -+ } -+ virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ if ( Index < 0 -+ || static_cast< Documents::size_type >(Index) >= m_documents.size() ) -+ throw lang::IndexOutOfBoundsException(); -+ return makeAny( m_documents[ Index ] ); // returns xspreadsheetdoc -+ } -+ -+ //XElementAccess -+ virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) -+ { -+ return frame::XModel::static_type(0); -+ } -+ -+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) -+ { -+ return (m_documents.size() > 0); -+ } -+ -+ //XNameAccess -+ virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ NameIndexHash::const_iterator it = namesToIndices.find( aName ); -+ if ( it == namesToIndices.end() ) -+ throw container::NoSuchElementException(); -+ return makeAny( m_documents[ it->second ] ); -+ -+ } -+ -+ virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) -+ { -+ uno::Sequence< ::rtl::OUString > names( namesToIndices.size() ); -+ ::rtl::OUString* pString = names.getArray(); -+ NameIndexHash::const_iterator it = namesToIndices.begin(); -+ NameIndexHash::const_iterator it_end = namesToIndices.end(); -+ for ( ; it != it_end; ++it, ++pString ) -+ *pString = it->first; -+ return names; -+ } -+ -+ virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) -+ { -+ NameIndexHash::const_iterator it = namesToIndices.find( aName ); -+ return (it != namesToIndices.end()); -+ } -+ -+}; -+ -+VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext, DOCUMENT_TYPE eDocType ) throw (uno::RuntimeException) : VbaDocumentsBase_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new DocumentsAccessImpl( xContext, eDocType ) ) ), meDocType( eDocType ) -+{ -+} -+ -+uno::Any SAL_CALL -+VbaDocumentsBase::Add() throw (uno::RuntimeException) -+{ -+ uno::Reference< lang::XMultiComponentFactory > xSMgr( -+ mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -+ -+ uno::Reference< frame::XComponentLoader > xLoader( -+ xSMgr->createInstanceWithContext( -+ ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), -+ mxContext), uno::UNO_QUERY_THROW ); -+ rtl::OUString sURL; -+ if( meDocType == WORD_DOCUMENT ) -+ sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/swriter") ); -+ else if( meDocType == EXCEL_DOCUMENT ) -+ sURL = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") ); -+ else -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+ uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( -+ sURL , -+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, -+ uno::Sequence< beans::PropertyValue >(0) ); -+ return uno::makeAny( xComponent ); -+} -+ -+void -+VbaDocumentsBase::Close() throw (uno::RuntimeException) -+{ -+ uno::Reference< lang::XMultiComponentFactory > xSMgr( -+ mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); -+ rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc")); -+ dispatchRequests(xModel,url); -+} -+ -+// #TODO# #FIXME# can any of the unused params below be used? -+uno::Any -+VbaDocumentsBase::Open( const rtl::OUString& rFileName, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) -+{ -+ // we need to detect if this is a URL, if not then assume its a file path -+ rtl::OUString aURL; -+ INetURLObject aObj; -+ aObj.SetURL( rFileName ); -+ bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID; -+ if ( bIsURL ) -+ aURL = rFileName; -+ else -+ osl::FileBase::getFileURLFromSystemPath( rFileName, aURL ); -+ uno::Reference< lang::XMultiComponentFactory > xSMgr( -+ mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -+ uno::Reference< frame::XDesktop > xDesktop -+ (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") , mxContext), -+ uno::UNO_QUERY_THROW ); -+ uno::Reference< frame::XComponentLoader > xLoader( -+ xSMgr->createInstanceWithContext( -+ ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), -+ mxContext), -+ uno::UNO_QUERY_THROW ); -+ uno::Sequence< beans::PropertyValue > sProps( rProps ); -+ sal_Int32 nIndex = 0; -+ -+ if ( ReadOnly.hasValue() ) -+ { -+ sal_Bool bIsReadOnly = sal_False; ReadOnly >>= bIsReadOnly; -+ if ( bIsReadOnly ) -+ { -+ static const rtl::OUString sReadOnly( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ); -+ sProps.realloc( sProps.getLength() + 1 ); -+ sProps[ nIndex ].Name = sReadOnly; -+ sProps[ nIndex++ ].Value = uno::makeAny( (sal_Bool)sal_True ); -+ } -+ } -+ -+ uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( aURL, -+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_default") ), -+ frame::FrameSearchFlag::CREATE, -+ sProps); -+ return uno::makeAny( xComponent ); -+} -+ -diff --git vbahelper/source/vbahelper/vbafillformat.cxx vbahelper/source/vbahelper/vbafillformat.cxx -new file mode 100644 -index 0000000..ed7fcd2 ---- /dev/null -+++ vbahelper/source/vbahelper/vbafillformat.cxx -@@ -0,0 +1,202 @@ -+/************************************************************************* -+ * -+ * 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: vbafillformat.cxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 <com/sun/star/beans/XPropertySet.hpp> -+#include <com/sun/star/awt/Gradient.hpp> -+#include <com/sun/star/awt/GradientStyle.hpp> -+#include <ooo/vba/office/MsoGradientStyle.hpp> -+#include "vbafillformat.hxx" -+#include "vbacolorformat.hxx" -+ -+using namespace ooo::vba; -+using namespace com::sun::star; -+ -+ScVbaFillFormat::ScVbaFillFormat( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaFillFormat_BASE( xParent, xContext ), m_xShape( xShape ) -+{ -+ m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); -+ m_nFillStyle = drawing::FillStyle_SOLID; -+ m_nForeColor = 0; -+ m_nBackColor = 0; -+ m_nGradientAngle = 0; -+} -+ -+void -+ScVbaFillFormat::setFillStyle( drawing::FillStyle nFillStyle ) throw (uno::RuntimeException) -+{ -+ m_nFillStyle = nFillStyle; -+ if( m_nFillStyle == drawing::FillStyle_GRADIENT ) -+ { -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_GRADIENT ) ); -+ awt::Gradient aGradient; -+ // AXIAL -+ // RADIAL -+ // ELLIPTICAL -+ // SQUARE -+ // RECT -+ aGradient.Style = awt::GradientStyle_LINEAR; -+ aGradient.StartColor = ForeColor()->getRGB(); -+ aGradient.EndColor = BackColor()->getRGB(); -+ aGradient.Angle = m_nGradientAngle; -+ aGradient.Border = 0; -+ aGradient.XOffset = 0; -+ aGradient.YOffset = 0; -+ aGradient.StartIntensity = 100; -+ aGradient.EndIntensity = 100; -+ aGradient.StepCount = 1; -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillGradient"), uno::makeAny( aGradient ) ); -+ } -+ else if( m_nFillStyle == drawing::FillStyle_SOLID ) -+ { -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny(drawing::FillStyle_SOLID) ); -+ } -+} -+ -+void -+ScVbaFillFormat::setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException) -+{ -+ m_nForeColor = nForeColor; -+ setFillStyle( m_nFillStyle ); -+} -+ -+// Attributes -+sal_Bool SAL_CALL -+ScVbaFillFormat::getVisible() throw (uno::RuntimeException) -+{ -+ drawing::FillStyle nFillStyle; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= nFillStyle; -+ if( nFillStyle == drawing::FillStyle_NONE ) -+ return sal_False; -+ return sal_True; -+} -+ -+void SAL_CALL -+ScVbaFillFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) -+{ -+ drawing::FillStyle aFillStyle; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("FillStyle") ) >>= aFillStyle; -+ if( !_visible ) -+ { -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("FillStyle"), uno::makeAny( drawing::FillStyle_NONE ) ); -+ } -+ else -+ { -+ if( aFillStyle == drawing::FillStyle_NONE ) -+ { -+ setFillStyle( m_nFillStyle ); -+ } -+ } -+} -+ -+double SAL_CALL -+ScVbaFillFormat::getTransparency() throw (uno::RuntimeException) -+{ -+ sal_Int16 nTransparence = 0; -+ double dTransparence = 0; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ) ) >>= nTransparence; -+ dTransparence = static_cast<double>( nTransparence ); -+ dTransparence /= 100; -+ return dTransparence; -+} -+ -+void SAL_CALL -+ScVbaFillFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) -+{ -+ sal_Int16 nTransparence = static_cast< sal_Int16 >( _transparency * 100 ); -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillTransparence" ), uno::makeAny( nTransparence ) ); -+} -+ -+ -+// Methods -+void SAL_CALL -+ScVbaFillFormat::Solid() throw (uno::RuntimeException) -+{ -+ setFillStyle( drawing::FillStyle_SOLID ); -+} -+ -+void SAL_CALL -+ScVbaFillFormat::TwoColorGradient( sal_Int32 style, sal_Int32 /*variant*/ ) throw (uno::RuntimeException) -+{ -+ if( style == office::MsoGradientStyle::msoGradientHorizontal ) -+ { -+ m_nGradientAngle = 0; -+ setFillStyle( drawing::FillStyle_GRADIENT ); -+ } -+ else if( style == office::MsoGradientStyle::msoGradientVertical ) -+ { -+ m_nGradientAngle = 900; -+ setFillStyle( drawing::FillStyle_GRADIENT ); -+ } -+ else if( style == office::MsoGradientStyle::msoGradientDiagonalDown ) -+ { -+ m_nGradientAngle = 450; -+ setFillStyle( drawing::FillStyle_GRADIENT ); -+ } -+ else if( style == office::MsoGradientStyle::msoGradientDiagonalUp ) -+ { -+ m_nGradientAngle = 900 + 450; -+ setFillStyle( drawing::FillStyle_GRADIENT ); -+ } -+} -+ -+uno::Reference< msforms::XColorFormat > SAL_CALL -+ScVbaFillFormat::BackColor() throw (uno::RuntimeException) -+{ -+ if( !m_xColorFormat.is() ) -+ m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_BACKCOLOR ) ); -+ return m_xColorFormat; -+} -+ -+uno::Reference< msforms::XColorFormat > SAL_CALL -+ScVbaFillFormat::ForeColor() throw (uno::RuntimeException) -+{ -+ if( !m_xColorFormat.is() ) -+ m_xColorFormat.set( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ColorFormatType::FILLFORMAT_FORECOLOR ) ); -+ return m_xColorFormat; -+} -+ -+ -+rtl::OUString& -+ScVbaFillFormat::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFillFormat") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+ScVbaFillFormat::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.FillFormat" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git vbahelper/source/vbahelper/vbafillformat.hxx vbahelper/source/vbahelper/vbafillformat.hxx -new file mode 100644 -index 0000000..047af92 ---- /dev/null -+++ vbahelper/source/vbahelper/vbafillformat.hxx -@@ -0,0 +1,74 @@ -+/************************************************************************* -+ * -+ * 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: vbafillformat.hxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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_XFILLFORMAT_HXX -+#define SC_VBA_XFILLFORMAT_HXX -+ -+#include <com/sun/star/drawing/XShape.hpp> -+#include <com/sun/star/drawing/FillStyle.hpp> -+#include <ooo/vba/msforms/XFillFormat.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ov::msforms::XFillFormat > ScVbaFillFormat_BASE; -+ -+class ScVbaFillFormat : public ScVbaFillFormat_BASE -+{ -+private: -+ css::uno::Reference< css::drawing::XShape > m_xShape; -+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -+ css::uno::Reference< ov::msforms::XColorFormat > m_xColorFormat; -+ css::drawing::FillStyle m_nFillStyle; -+ sal_Int32 m_nForeColor; -+ sal_Int32 m_nBackColor; -+ sal_Int16 m_nGradientAngle; -+private: -+ void setFillStyle( css::drawing::FillStyle nFillStyle ) throw (css::uno::RuntimeException); -+protected: -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+ -+public: -+ ScVbaFillFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); -+ -+ void setForeColorAndInternalStyle( sal_Int32 nForeColor ) throw (css::uno::RuntimeException); -+ // Attributes -+ virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException); -+ -+ // Methods -+ virtual void SAL_CALL Solid() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL TwoColorGradient( sal_Int32 style, sal_Int32 variant ) throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); -+ -+}; -+ -+#endif//SC_VBA_XFILLFORMAT_HXX -diff --git vbahelper/source/vbahelper/vbafontbase.cxx vbahelper/source/vbahelper/vbafontbase.cxx -new file mode 100644 -index 0000000..26da500 ---- /dev/null -+++ vbahelper/source/vbahelper/vbafontbase.cxx -@@ -0,0 +1,309 @@ -+/************************************************************************* -+ * -+ * 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: vbafont.cxx,v $ -+ * $Revision: 1.7 $ -+ * -+ * 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 <com/sun/star/beans/XProperty.hpp> -+#include <com/sun/star/awt/FontWeight.hpp> -+#include <com/sun/star/awt/FontUnderline.hpp> -+#include <com/sun/star/awt/FontStrikeout.hpp> -+#include <com/sun/star/awt/FontSlant.hpp> -+#include <com/sun/star/text/XSimpleText.hpp> -+#include <vbahelper/vbafontbase.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+VbaFontBase::VbaFontBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< css::container::XIndexAccess >& xPalette, uno::Reference< beans::XPropertySet > xPropertySet ) throw ( uno::RuntimeException ) : VbaFontBase_BASE( xParent, xContext ), mxFont( xPropertySet, css::uno::UNO_QUERY_THROW ), mxPalette( xPalette ) -+{ -+} -+ -+VbaFontBase::~VbaFontBase() -+{ -+} -+ -+ -+void SAL_CALL -+VbaFontBase::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeException ) -+{ -+ sal_Bool bValue = sal_False; -+ aValue >>= bValue; -+ sal_Int16 nValue = NORMAL; -+ sal_Int8 nValue2 = NORMALHEIGHT; -+ -+ if( bValue ) -+ { -+ nValue = SUPERSCRIPT; -+ nValue2 = SUPERSCRIPTHEIGHT; -+ } -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); -+} -+ -+uno::Any SAL_CALL -+VbaFontBase::getSuperscript() throw ( uno::RuntimeException ) -+{ -+ short nValue = 0; -+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; -+ return uno::makeAny( ( nValue == SUPERSCRIPT ) ); -+} -+ -+void SAL_CALL -+VbaFontBase::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException ) -+{ -+ sal_Bool bValue = sal_False; -+ aValue >>= bValue; -+ sal_Int16 nValue = NORMAL; -+ sal_Int8 nValue2 = NORMALHEIGHT; -+ -+ if( bValue ) -+ { -+ nValue= SUBSCRIPT; -+ nValue2 = SUBSCRIPTHEIGHT; -+ } -+ -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapementHeight" ) ), ( uno::Any )nValue2 ); -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), ( uno::Any )nValue ); -+ -+} -+ -+uno::Any SAL_CALL -+VbaFontBase::getSubscript() throw ( uno::RuntimeException ) -+{ -+ short nValue = NORMAL; -+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ) ) >>= nValue; -+ return uno::makeAny( ( nValue == SUBSCRIPT ) ); -+} -+ -+void SAL_CALL -+VbaFontBase::setSize( const uno::Any& aValue ) throw( uno::RuntimeException ) -+{ -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), aValue ); -+} -+ -+uno::Any SAL_CALL -+VbaFontBase::getSize() throw ( uno::RuntimeException ) -+{ -+ return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ) ); -+} -+ -+void SAL_CALL -+VbaFontBase::setColorIndex( const uno::Any& _colorindex ) throw( uno::RuntimeException ) -+{ -+ sal_Int32 nIndex = 0; -+ _colorindex >>= nIndex; -+ -+ --nIndex; // OOo indices are zero bases -+ -+ // setColor expects colors in XL RGB values -+ // #FIXME this is daft we convert OO RGB val to XL RGB val and -+ // then back again to OO RGB value -+ setColor( OORGBToXLRGB(mxPalette->getByIndex( nIndex )) ); -+} -+ -+ -+uno::Any SAL_CALL -+VbaFontBase::getColorIndex() throw ( uno::RuntimeException ) -+{ -+ sal_Int32 nColor = 0; -+ -+ XLRGBToOORGB( getColor() ) >>= nColor; -+ sal_Int32 nElems = mxPalette->getCount(); -+ sal_Int32 nIndex = -1; -+ for ( sal_Int32 count=0; count<nElems; ++count ) -+ { -+ sal_Int32 nPaletteColor = 0; -+ mxPalette->getByIndex( count ) >>= nPaletteColor; -+ if ( nPaletteColor == nColor ) -+ { -+ nIndex = count + 1; // 1 based -+ break; -+ } -+ } -+ return uno::makeAny( nIndex ); -+} -+ -+void SAL_CALL -+VbaFontBase::setBold( const uno::Any& aValue ) throw( uno::RuntimeException ) -+{ -+ sal_Bool bValue = sal_False; -+ aValue >>= bValue; -+ double fBoldValue = awt::FontWeight::NORMAL; -+ if( bValue ) -+ fBoldValue = awt::FontWeight::BOLD; -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), ( uno::Any )fBoldValue ); -+ -+} -+ -+uno::Any SAL_CALL -+VbaFontBase::getBold() throw ( uno::RuntimeException ) -+{ -+ double fValue = 0.0; -+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ) ) >>= fValue; -+ return uno::makeAny( fValue == awt::FontWeight::BOLD ); -+} -+ -+void SAL_CALL -+VbaFontBase::setStrikethrough( const uno::Any& aValue ) throw ( uno::RuntimeException ) -+{ -+ sal_Bool bValue = sal_False; -+ aValue >>= bValue; -+ short nValue = awt::FontStrikeout::NONE; -+ if( bValue ) -+ nValue = awt::FontStrikeout::SINGLE; -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ), ( uno::Any )nValue ); -+} -+ -+uno::Any SAL_CALL -+VbaFontBase::getStrikethrough() throw ( uno::RuntimeException ) -+{ -+ short nValue = 0; -+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ) ) >>= nValue; -+ return uno::Any( nValue == awt::FontStrikeout::SINGLE ); -+} -+ -+void SAL_CALL -+VbaFontBase::setShadow( const uno::Any& aValue ) throw ( uno::RuntimeException ) -+{ -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), aValue ); -+} -+ -+uno::Any SAL_CALL -+VbaFontBase::getShadow() throw (uno::RuntimeException) -+{ -+ return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) ); -+} -+ -+void SAL_CALL -+VbaFontBase::setItalic( const uno::Any& aValue ) throw ( uno::RuntimeException ) -+{ -+ sal_Bool bValue = sal_False; -+ aValue >>= bValue; -+ short nValue = awt::FontSlant_NONE; -+ if( bValue ) -+ nValue = awt::FontSlant_ITALIC; -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), ( uno::Any )nValue ); -+} -+ -+uno::Any SAL_CALL -+VbaFontBase::getItalic() throw ( uno::RuntimeException ) -+{ -+ -+ awt::FontSlant aFS; -+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ) ) >>= aFS; -+ return uno::makeAny( aFS == awt::FontSlant_ITALIC ); -+} -+ -+void SAL_CALL -+VbaFontBase::setName( const uno::Any& aValue ) throw ( uno::RuntimeException ) -+{ -+ rtl::OUString sString; -+ aValue >>= sString; -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), aValue); -+} -+ -+uno::Any SAL_CALL -+VbaFontBase::getName() throw ( uno::RuntimeException ) -+{ -+ return mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ) ); -+} -+uno::Any -+VbaFontBase::getColor() throw (uno::RuntimeException) -+{ -+ uno::Any aAny; -+ aAny = OORGBToXLRGB( mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) ) ); -+ return aAny; -+} -+ -+void -+VbaFontBase::setColor( const uno::Any& _color ) throw (uno::RuntimeException) -+{ -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ) , XLRGBToOORGB(_color)); -+} -+ -+void SAL_CALL -+VbaFontBase::setUnderline( const uno::Any& aValue ) throw ( uno::RuntimeException ) -+{ -+/* -+ // default -+ sal_Int32 nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone; -+ aValue >>= nValue; -+ switch ( nValue ) -+ { -+// NOTE:: #TODO #FIMXE -+// xlUnderlineStyleDoubleAccounting & xlUnderlineStyleSingleAccounting -+// don't seem to be supported in Openoffice. -+// The import filter converts them to single or double underlines as appropriate -+// So, here at the moment we are similarly silently converting -+// xlUnderlineStyleSingleAccounting to xlUnderlineStyleSingle. -+ -+ case excel::XlUnderlineStyle::xlUnderlineStyleNone: -+ nValue = awt::FontUnderline::NONE; -+ break; -+ case excel::XlUnderlineStyle::xlUnderlineStyleSingle: -+ case excel::XlUnderlineStyle::xlUnderlineStyleSingleAccounting: -+ nValue = awt::FontUnderline::SINGLE; -+ break; -+ case excel::XlUnderlineStyle::xlUnderlineStyleDouble: -+ case excel::XlUnderlineStyle::xlUnderlineStyleDoubleAccounting: -+ nValue = awt::FontUnderline::DOUBLE; -+ break; -+ default: -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value for Underline")), uno::Reference< uno::XInterface >() ); -+ } -+ -+ mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), ( uno::Any )nValue ); -+*/ -+ -+} -+ -+uno::Any SAL_CALL -+VbaFontBase::getUnderline() throw ( uno::RuntimeException ) -+{ -+ sal_Int32 nValue = awt::FontUnderline::NONE; -+ mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ) ) >>= nValue; -+/* -+ switch ( nValue ) -+ { -+ case awt::FontUnderline::DOUBLE: -+ nValue = excel::XlUnderlineStyle::xlUnderlineStyleDouble; -+ break; -+ case awt::FontUnderline::SINGLE: -+ nValue = excel::XlUnderlineStyle::xlUnderlineStyleSingle; -+ break; -+ case awt::FontUnderline::NONE: -+ nValue = excel::XlUnderlineStyle::xlUnderlineStyleNone; -+ break; -+ default: -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Unknown value retrieved for Underline") ), uno::Reference< uno::XInterface >() ); -+ -+ } -+*/ -+ return uno::makeAny( nValue ); -+} -+ -+ -diff --git vbahelper/source/vbahelper/vbahelper.cxx vbahelper/source/vbahelper/vbahelper.cxx -index b95ccf1..57bca7c 100644 ---- vbahelper/source/vbahelper/vbahelper.cxx -+++ vbahelper/source/vbahelper/vbahelper.cxx -@@ -89,6 +89,7 @@ using namespace ::ooo::vba; - - #define POINTTO100THMILLIMETERFACTOR 35.27778 - -+ - void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue ); - - uno::Any sbxToUnoValue( SbxVariable* pVar ); -@@ -468,6 +469,8 @@ getCurrentDocument() throw (uno::RuntimeException) - sal_Int32 - OORGBToXLRGB( sal_Int32 nCol ) - { -+ sal_Int32 nAutoBits = nCol; -+ nAutoBits &= 0xFF000000; - sal_Int32 nRed = nCol; - nRed &= 0x00FF0000; - nRed >>= 16; -@@ -476,12 +479,15 @@ OORGBToXLRGB( sal_Int32 nCol ) - nGreen >>= 8; - sal_Int32 nBlue = nCol; - nBlue &= 0x000000FF; -- sal_Int32 nRGB = ( (nBlue << 16) | (nGreen << 8) | nRed ); -+ sal_Int32 nRGB = ( nAutoBits | (nBlue << 16) | (nGreen << 8) | nRed ); - return nRGB; - } - sal_Int32 - XLRGBToOORGB( sal_Int32 nCol ) - { -+ sal_Int32 nAutoBits = nCol; -+ nAutoBits &= 0xFF000000; -+ - sal_Int32 nBlue = nCol; - nBlue &= 0x00FF0000; - nBlue >>= 16; -@@ -490,7 +496,7 @@ XLRGBToOORGB( sal_Int32 nCol ) - nGreen >>= 8; - sal_Int32 nRed = nCol; - nRed &= 0x000000FF; -- sal_Int32 nRGB = ( (nRed << 16) | (nGreen << 8) | nBlue ); -+ sal_Int32 nRGB = ( nAutoBits | (nRed << 16) | (nGreen << 8) | nBlue ); - return nRGB; - } - uno::Any -@@ -899,59 +905,6 @@ void setCursorHelper( const Pointer& rPointer, sal_Bool bOverWrite ) - } - } - --String docMacroExists( SfxObjectShell* pShell, const String& sMod, const String& sMacro ) --{ -- String sFullName; -- // would use the script provider to see if the macro exists but -- // called at this stage tdoc content handler stuff is not set up -- // so it fails -- -- String sLibrary( RTL_CONSTASCII_USTRINGPARAM("Standard")); -- BasicManager* pBasicMgr = pShell-> GetBasicManager(); -- if ( pBasicMgr ) -- { -- if ( pBasicMgr->GetName().Len() ) -- sLibrary = pBasicMgr->GetName(); -- StarBASIC* pBasic = pBasicMgr->GetLib( sLibrary ); -- if ( !pBasic ) -- { -- USHORT nId = pBasicMgr->GetLibId( sLibrary ); -- pBasicMgr->LoadLib( nId ); -- pBasic = pBasicMgr->GetLib( sLibrary ); -- } -- if ( pBasic ) -- { -- if ( sMod.Len() ) // we wish to find the macro is a specific module -- { -- SbModule* pModule = pBasic->FindModule( sMod ); -- if ( pModule ) -- { -- SbxArray* pMethods = pModule->GetMethods(); -- if ( pMethods ) -- { -- SbMethod* pMethod = static_cast< SbMethod* >( pMethods->Find( sMacro, SbxCLASS_METHOD ) ); -- if ( pMethod ) -- { -- sFullName = sMacro; -- sFullName.Insert( '.', 0 ).Insert( sMod, 0 ).Insert( '.', 0 ).Insert( sLibrary, 0 ); -- } -- } -- } -- } -- else if( SbMethod* pMethod = dynamic_cast< SbMethod* >( pBasic->Find( sMacro, SbxCLASS_METHOD ) ) ) -- { -- if( SbModule* pModule = pMethod->GetModule() ) -- { -- sFullName = sMacro; -- sFullName.Insert( '.', 0 ).Insert( pModule->GetName(), 0).Insert( '.', 0 ).Insert( sLibrary, 0 ); -- } -- } -- -- } -- } -- return sFullName; --} -- - #define VBA_LEFT "PositionX" - #define VBA_TOP "PositionY" - UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl ) -diff --git vbahelper/source/vbahelper/vbalineformat.cxx vbahelper/source/vbahelper/vbalineformat.cxx -new file mode 100644 -index 0000000..7c9610f ---- /dev/null -+++ vbahelper/source/vbahelper/vbalineformat.cxx -@@ -0,0 +1,458 @@ -+/************************************************************************* -+ * -+ * 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: vbalineformat.cxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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 <ooo/vba/office/MsoArrowheadStyle.hpp> -+#include <ooo/vba/office/MsoArrowheadLength.hpp> -+#include <ooo/vba/office/MsoArrowheadWidth.hpp> -+#include <ooo/vba/office/MsoLineDashStyle.hpp> -+#include <com/sun/star/drawing/LineStyle.hpp> -+#include <com/sun/star/drawing/LineDash.hpp> -+#include "vbalineformat.hxx" -+#include "vbacolorformat.hxx" -+ -+using namespace ooo::vba; -+using namespace com::sun::star; -+ -+ScVbaLineFormat::ScVbaLineFormat( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape > xShape ) : ScVbaLineFormat_BASE( xParent, xContext ), m_xShape( xShape ) -+{ -+ m_xPropertySet.set( xShape, uno::UNO_QUERY_THROW ); -+ m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid; -+ m_nLineWeight = 1; -+} -+ -+sal_Int32 -+ScVbaLineFormat::calculateArrowheadSize() -+{ -+ return 0; -+} -+ -+sal_Int32 -+ScVbaLineFormat::convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ) -+{ -+ sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; -+ if (sLineName.equals(rtl::OUString::createFromAscii("Small Arrow")) || -+ sLineName.equals(rtl::OUString::createFromAscii("Arrow")) || -+ sLineName.equals(rtl::OUString::createFromAscii("msArrowEnd")) || -+ sLineName.equals(rtl::OUString::createFromAscii("Double Arrow"))) -+ { -+ // msoArrowheadTriangle -+ nLineType = office::MsoArrowheadStyle::msoArrowheadTriangle; -+ } -+ else if (sLineName.equals(rtl::OUString::createFromAscii("Square 45")) || -+ sLineName.equals(rtl::OUString::createFromAscii("Square")) || -+ sLineName.equals(rtl::OUString::createFromAscii("msArrowDiamondEnd"))) -+ { -+ // msoArrowheadDiamond -+ nLineType = office::MsoArrowheadStyle::msoArrowheadDiamond; -+ } -+ else if (sLineName.equals(rtl::OUString::createFromAscii("Circle")) || -+ sLineName.equals(rtl::OUString::createFromAscii("msArrowOvalEnd")) || -+ sLineName.equals(rtl::OUString::createFromAscii("Dimension Lines")) ) -+ { -+ // msoArrowheadOval -+ nLineType = office::MsoArrowheadStyle::msoArrowheadOval; -+ } -+ else if (sLineName.equals(rtl::OUString::createFromAscii("Arrow concave")) || -+ sLineName.equals(rtl::OUString::createFromAscii("msArrowStealthEnd"))) -+ { -+ // msoArrowheadStealth -+ nLineType = office::MsoArrowheadStyle::msoArrowheadStealth; -+ } -+ else if (sLineName.equals(rtl::OUString::createFromAscii("Rounded short Arrow")) || -+ sLineName.equals(rtl::OUString::createFromAscii("Rounded large Arrow")) || -+ sLineName.equals(rtl::OUString::createFromAscii("Symmetric Arrow")) || -+ sLineName.equals(rtl::OUString::createFromAscii("msArrowOpenEnd")) || -+ sLineName.equals(rtl::OUString::createFromAscii("Line Arrow"))) -+ { -+ // msoArrowheadOpen -+ nLineType = office::MsoArrowheadStyle::msoArrowheadOpen; -+ } -+ else -+ { -+ // msoArrowheadNone -+ nLineType = office::MsoArrowheadStyle::msoArrowheadNone; -+ } -+ return nLineType; -+} -+ -+rtl::OUString -+ScVbaLineFormat::convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (uno::RuntimeException) -+{ -+ switch( nArrowheadStyle ) -+ { -+ case office::MsoArrowheadStyle::msoArrowheadNone: -+ return rtl::OUString(rtl::OUString::createFromAscii( "" ) ); -+ case office::MsoArrowheadStyle::msoArrowheadStealth: -+ return rtl::OUString::createFromAscii( "Arrow concave" ); -+ case office::MsoArrowheadStyle::msoArrowheadOpen: -+ return rtl::OUString::createFromAscii("Line Arrow" ); -+ case office::MsoArrowheadStyle::msoArrowheadOval: -+ return rtl::OUString::createFromAscii("Circle" ); -+ case office::MsoArrowheadStyle::msoArrowheadDiamond: -+ return rtl::OUString::createFromAscii( "Square 45" ); -+ case office::MsoArrowheadStyle::msoArrowheadTriangle: -+ return rtl::OUString::createFromAscii( "Arrow" ); -+ default: -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Invalid Arrow Style!"), uno::Reference< uno::XInterface >() ); -+ } -+} -+ -+// Attributes -+sal_Int32 SAL_CALL -+ScVbaLineFormat::getBeginArrowheadStyle() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLineType = office::MsoArrowheadStyle::msoArrowheadNone; -+ rtl::OUString sLineName; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ) ) >>= sLineName; -+ if( ( sLineName.getLength() > 7 ) && ( sLineName.indexOf( rtl::OUString::createFromAscii( "msArray" ) ) ) != -1 ) -+ { -+ sal_Int32 nIndex = sLineName.indexOf( rtl::OUString::createFromAscii(" ") ); -+ rtl::OUString sName = sLineName.copy( 0, nIndex ); -+ //sal_Int32 nSize = sLineName.copy( nIndex + 1 ).toInt32(); -+ nLineType = convertLineStartEndNameToArrowheadStyle( sName ); -+ } -+ else -+ { -+ nLineType = convertLineStartEndNameToArrowheadStyle( sLineName ); -+ } -+ return nLineType; -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (uno::RuntimeException) -+{ -+ rtl::OUString sArrayName = convertArrowheadStyleToLineStartEndName( _beginarrowheadstyle ); -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStartName" ), uno::makeAny( sArrayName ) ); -+} -+ -+sal_Int32 SAL_CALL -+ScVbaLineFormat::getBeginArrowheadLength() throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setBeginArrowheadLength( sal_Int32 /*_beginarrowheadlength*/ ) throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -+} -+ -+sal_Int32 SAL_CALL -+ScVbaLineFormat::getBeginArrowheadWidth() throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setBeginArrowheadWidth( sal_Int32 /*_beginarrowheadwidth*/ ) throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -+} -+ -+sal_Int32 SAL_CALL -+ScVbaLineFormat::getEndArrowheadStylel() throw (uno::RuntimeException) -+{ -+ return 0; -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setEndArrowheadStylel( sal_Int32 /*_endarrowheadstylel*/ ) throw (uno::RuntimeException) -+{ -+} -+ -+sal_Int32 SAL_CALL -+ScVbaLineFormat::getEndArrowheadLength() throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setEndArrowheadLength( sal_Int32 /*_endarrowheadlength*/ ) throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -+} -+ -+sal_Int32 SAL_CALL -+ScVbaLineFormat::getEndArrowheadWidth() throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setEndArrowheadWidth( sal_Int32 /*_endarrowheadwidth*/ ) throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Property 'EndArrowheadWidth' is not supported."), uno::Reference< uno::XInterface >() ); -+} -+ -+double SAL_CALL -+ScVbaLineFormat::getWeight() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLineWidth=0; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineWidth") ) >>= nLineWidth; -+ double dLineWidth = Millimeter::getInPoints( nLineWidth ); -+ return dLineWidth; -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setWeight( double _weight ) throw (uno::RuntimeException) -+{ -+ if( _weight < 0 ) -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter: Must be positv."), uno::Reference< uno::XInterface >() ); -+ if( _weight == 0 ) -+ _weight = 0.5; -+ m_nLineWeight = _weight; -+ Millimeter aMillimeter; -+ aMillimeter.setInPoints( _weight ); -+ -+ sal_Int32 nLineWidth = static_cast<sal_Int32>( aMillimeter.getInHundredthsOfOneMillimeter() ); -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineWidth" ), uno::makeAny( nLineWidth ) ); -+ setDashStyle( m_nLineDashStyle ); -+} -+ -+sal_Bool SAL_CALL -+ScVbaLineFormat::getVisible() throw (uno::RuntimeException) -+{ -+ drawing::LineStyle aLineStyle; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; -+ if( aLineStyle == drawing::LineStyle_NONE ) -+ { -+ return sal_False; -+ } -+ return sal_True; -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setVisible( sal_Bool _visible ) throw (uno::RuntimeException) -+{ -+ drawing::LineStyle aLineStyle; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= aLineStyle; -+ if( !_visible ) -+ { -+ aLineStyle = drawing::LineStyle_NONE; -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) ); -+ } -+ else -+ { -+ if( aLineStyle == drawing::LineStyle_NONE ) -+ { -+ setDashStyle( m_nLineDashStyle ); -+ } -+ } -+} -+ -+double SAL_CALL -+ScVbaLineFormat::getTransparency() throw (uno::RuntimeException) -+{ -+ sal_Int16 nTransparency = 0; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ) ) >>= nTransparency; -+ double fTransparency = static_cast<double>( nTransparency ); -+ return fTransparency / 100; -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setTransparency( double _transparency ) throw (uno::RuntimeException) -+{ -+ sal_Int16 nTransparency = static_cast<sal_Int16>( _transparency * 100 ); -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineTransparence" ), uno::makeAny( nTransparency ) ); -+} -+ -+sal_Int16 SAL_CALL -+ScVbaLineFormat::getStyle() throw (uno::RuntimeException) -+{ -+ //OpenOffice.org only supports one LineStyle (other than the DashStyles) -+ //Therefore we can only return the SingleLine -+ return 1; -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setStyle( sal_Int16 /*_style */) throw (uno::RuntimeException) -+{ -+ //OpenOffice.org only supports one LineStyle (other than the DashStyles) -+ //Therefore we do not set the LineStyle, because it maybe is already set -+ //to Dashed or Single Line. Setting the 'Visible' or 'DashStyle' properties -+ //will be done with the according methods. -+} -+ -+sal_Int32 SAL_CALL -+ScVbaLineFormat::getDashStyle() throw (uno::RuntimeException) -+{ -+ drawing::LineStyle eLineStyle; -+ //LineStyle integer in Xray -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ) ) >>= eLineStyle; -+ if( eLineStyle == drawing::LineStyle_SOLID ) -+ m_nLineDashStyle = office::MsoLineDashStyle::msoLineSolid; -+ else -+ { -+ drawing::LineDash aLineDash; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "LineDash" ) ) >>= aLineDash; -+ if( aLineDash.Dots == 0 ) -+ { -+ //LineDash -+ //LineLongDash -+ m_nLineDashStyle = office::MsoLineDashStyle::msoLineDash; -+ if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) ) -+ { -+ m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDash; -+ } -+ } -+ else if( aLineDash.Dots == 1 ) -+ { -+ // LineDashDot -+ // LineLongDashDot -+ // LineSquareDot -+ // LineRoundDot ! not supported -+ m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDot; -+ if( aLineDash.Dashes == 0 ) -+ { -+ m_nLineDashStyle = office::MsoLineDashStyle::msoLineSquareDot; -+ } -+ else -+ { -+ if( aLineDash.Distance > 0 && ( aLineDash.DashLen / aLineDash.Distance > 1 ) ) -+ { -+ m_nLineDashStyle = office::MsoLineDashStyle::msoLineLongDashDot; -+ } -+ } -+ } -+ else if( aLineDash.Dots == 2 ) -+ { -+ // LineDashDotDot -+ m_nLineDashStyle = office::MsoLineDashStyle::msoLineDashDotDot; -+ } -+ } -+ -+ return m_nLineDashStyle; -+} -+ -+void SAL_CALL -+ScVbaLineFormat::setDashStyle( sal_Int32 _dashstyle ) throw (uno::RuntimeException) -+{ -+ m_nLineDashStyle = _dashstyle; -+ if( _dashstyle == office::MsoLineDashStyle::msoLineSolid ) -+ { -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_SOLID )); -+ } -+ else -+ { -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( drawing::LineStyle_DASH ) ); -+ drawing::LineDash pLineDash; -+ Millimeter aMillimeter( m_nLineWeight ); -+ sal_Int32 nPixel = static_cast< sal_Int32 >( aMillimeter.getInHundredthsOfOneMillimeter() ); -+ switch( _dashstyle ) -+ { -+ case office::MsoLineDashStyle::msoLineDashDot: -+ pLineDash.Dots = 1; -+ pLineDash.DotLen = nPixel; -+ pLineDash.Dashes = 1; -+ pLineDash.DashLen = 5 * nPixel; -+ pLineDash.Distance = 4 * nPixel; -+ break; -+ case office::MsoLineDashStyle::msoLineLongDashDot: -+ pLineDash.Dots = 1; -+ pLineDash.DotLen = nPixel; -+ pLineDash.Dashes = 1; -+ pLineDash.DashLen = 10 * nPixel; -+ pLineDash.Distance = 4 * nPixel; -+ break; -+ case office::MsoLineDashStyle::msoLineDash: -+ pLineDash.Dots = 0; -+ pLineDash.DotLen = 0; -+ pLineDash.Dashes = 1; -+ pLineDash.DashLen = 6 * nPixel; -+ pLineDash.Distance = 4 * nPixel; -+ break; -+ case office::MsoLineDashStyle::msoLineDashDotDot: -+ pLineDash.Dots = 2; -+ pLineDash.DotLen = nPixel; -+ pLineDash.Dashes = 1; -+ pLineDash.DashLen = 10 * nPixel; -+ pLineDash.Distance = 3 * nPixel; -+ break; -+ case office::MsoLineDashStyle::msoLineLongDash: -+ pLineDash.Dots = 0; -+ pLineDash.DotLen = 0; -+ pLineDash.Dashes = 1; -+ pLineDash.DashLen = 10 * nPixel; -+ pLineDash.Distance = 4 * nPixel; -+ break; -+ case office::MsoLineDashStyle::msoLineSquareDot: -+ pLineDash.Dots = 1; -+ pLineDash.DotLen = nPixel; -+ pLineDash.Dashes = 0; -+ pLineDash.DashLen = 0; -+ pLineDash.Distance = nPixel; -+ break; -+ case office::MsoLineDashStyle::msoLineRoundDot: -+ pLineDash.Dots = 1; -+ pLineDash.DotLen = nPixel; -+ pLineDash.Dashes = 0; -+ pLineDash.DashLen = 0; -+ pLineDash.Distance = nPixel; -+ break; -+ default: -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("this MsoLineDashStyle is not supported."), uno::Reference< uno::XInterface >() ); -+ } -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "LineDash" ), uno::makeAny( pLineDash ) ); -+ } -+} -+ -+// Methods -+uno::Reference< msforms::XColorFormat > SAL_CALL -+ScVbaLineFormat::BackColor() throw (uno::RuntimeException) -+{ -+ return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_BACKCOLOR ) ); -+} -+ -+uno::Reference< msforms::XColorFormat > SAL_CALL -+ScVbaLineFormat::ForeColor() throw (uno::RuntimeException) -+{ -+ return uno::Reference< msforms::XColorFormat >( new ScVbaColorFormat( getParent(), mxContext, this, m_xShape, ::ColorFormatType::LINEFORMAT_FORECOLOR ) ); -+} -+ -+ -+rtl::OUString& -+ScVbaLineFormat::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLineFormat") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+ScVbaLineFormat::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.LineFormat" ) ); -+ } -+ return aServiceNames; -+} -+ -+ -diff --git vbahelper/source/vbahelper/vbalineformat.hxx vbahelper/source/vbahelper/vbalineformat.hxx -new file mode 100644 -index 0000000..a6287e4 ---- /dev/null -+++ vbahelper/source/vbahelper/vbalineformat.hxx -@@ -0,0 +1,85 @@ -+/************************************************************************* -+ * -+ * 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: vbalineformat.hxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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_XLINEFORMAT_HXX -+#define SC_VBA_XLINEFORMAT_HXX -+ -+#include <com/sun/star/drawing/XShape.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <ooo/vba/msforms/XLineFormat.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ov::msforms::XLineFormat > ScVbaLineFormat_BASE; -+ -+class ScVbaLineFormat : public ScVbaLineFormat_BASE -+{ -+private: -+ css::uno::Reference< css::drawing::XShape > m_xShape; -+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -+ sal_Int32 m_nLineDashStyle; -+ double m_nLineWeight; -+protected: -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+ sal_Int32 convertLineStartEndNameToArrowheadStyle( rtl::OUString sLineName ); -+ rtl::OUString convertArrowheadStyleToLineStartEndName( sal_Int32 nArrowheadStyle ) throw (css::uno::RuntimeException); -+ sal_Int32 calculateArrowheadSize(); -+public: -+ ScVbaLineFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::drawing::XShape > xShape ); -+ -+ // Attributes -+ virtual sal_Int32 SAL_CALL getBeginArrowheadStyle() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setBeginArrowheadStyle( sal_Int32 _beginarrowheadstyle ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getBeginArrowheadLength() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setBeginArrowheadLength( sal_Int32 _beginarrowheadlength ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getBeginArrowheadWidth() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setBeginArrowheadWidth( sal_Int32 _beginarrowheadwidth ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getEndArrowheadStylel() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setEndArrowheadStylel( sal_Int32 _endarrowheadstylel ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getEndArrowheadLength() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setEndArrowheadLength( sal_Int32 _endarrowheadlength ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getEndArrowheadWidth() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setEndArrowheadWidth( sal_Int32 _endarrowheadwidth ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getWeight() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setWeight( double _weight ) throw (css::uno::RuntimeException); -+ virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getTransparency() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setTransparency( double _transparency ) throw (css::uno::RuntimeException); -+ virtual sal_Int16 SAL_CALL getStyle() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setStyle( sal_Int16 _style ) throw (css::uno::RuntimeException); -+ virtual sal_Int32 SAL_CALL getDashStyle() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setDashStyle( sal_Int32 _dashstyle ) throw (css::uno::RuntimeException); -+ -+ // Methods -+ virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL BackColor() throw (css::uno::RuntimeException); -+ virtual css::uno::Reference< ov::msforms::XColorFormat > SAL_CALL ForeColor() throw (css::uno::RuntimeException); -+}; -+ -+#endif//SC_VBA_XLINEFORMAT_HXX -diff --git vbahelper/source/vbahelper/vbapagesetupbase.cxx vbahelper/source/vbahelper/vbapagesetupbase.cxx -new file mode 100644 -index 0000000..569b204 ---- /dev/null -+++ vbahelper/source/vbahelper/vbapagesetupbase.cxx -@@ -0,0 +1,325 @@ -+/************************************************************************* -+ * -+ * 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 <vbahelper/vbapagesetupbase.hxx> -+ -+using namespace ::com::sun::star; -+using namespace ::ooo::vba; -+ -+VbaPageSetupBase::VbaPageSetupBase(const uno::Reference< XHelperInterface >& xParent, -+ const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException): VbaPageSetupBase_BASE( xParent, xContext ) -+{ -+} -+ -+double SAL_CALL VbaPageSetupBase::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 = topMargin + headerHeight; -+ } -+ } -+ catch( uno::Exception& ) -+ { -+ } -+ -+ return Millimeter::getInPoints( topMargin ); -+} -+ -+void SAL_CALL VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::setHeaderMargin( double margin ) throw (css::uno::RuntimeException) -+{ -+ 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 VbaPageSetupBase::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 VbaPageSetupBase::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 VbaPageSetupBase::getOrientation() throw (css::uno::RuntimeException) -+{ -+ sal_Int32 orientation = mnOrientPortrait; -+ try -+ { -+ sal_Bool isLandscape = sal_False; -+ uno::Any aValue = mxPageProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsLandscape"))); -+ aValue >>= isLandscape; -+ -+ if( isLandscape ) -+ { -+ orientation = mnOrientLandscape; -+ } -+ } -+ catch( uno::Exception& ) -+ { -+ } -+ return orientation; -+} -+ -+void SAL_CALL VbaPageSetupBase::setOrientation( sal_Int32 orientation ) throw (css::uno::RuntimeException) -+{ -+ if( ( orientation != mnOrientPortrait ) && -+ ( orientation != mnOrientLandscape ) ) -+ { -+ 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 != mnOrientLandscape ) || -+ ( !isLandscape && orientation != mnOrientPortrait )) -+ { -+ 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 = mnOrientLandscape; -+ } -+ } -+ catch( uno::Exception& ) -+ { -+ } -+} -+ -diff --git vbahelper/source/vbahelper/vbapictureformat.cxx vbahelper/source/vbahelper/vbapictureformat.cxx -new file mode 100644 -index 0000000..2663682 ---- /dev/null -+++ vbahelper/source/vbahelper/vbapictureformat.cxx -@@ -0,0 +1,147 @@ -+/************************************************************************* -+ * -+ * 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: vbapictureformat.cxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 "vbapictureformat.hxx" -+ -+using namespace ooo::vba; -+using namespace com::sun::star; -+ -+ScVbaPictureFormat::ScVbaPictureFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, -+ const css::uno::Reference< css::uno::XComponentContext >& xContext, -+ uno::Reference< drawing::XShape > xShape ) -+ throw( lang::IllegalArgumentException ) : ScVbaPictureFormat_BASE( xParent, xContext ), m_xShape( xShape ) -+{ -+ m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); -+} -+ -+void -+ScVbaPictureFormat::checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException) -+{ -+ if( nRange < nMin ) -+ { -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too small.") , uno::Reference< uno::XInterface >() ); -+ } -+ if( nRange > nMax ) -+ { -+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Parameter out of range, value is too high.") , uno::Reference< uno::XInterface >() ); -+ } -+} -+ -+// Attributes -+double SAL_CALL -+ScVbaPictureFormat::getBrightness() throw (uno::RuntimeException) -+{ -+ sal_Int16 nLuminance = 0; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance") ) >>= nLuminance; -+ double fBrightness = static_cast< double >( nLuminance ); -+ fBrightness = ( fBrightness +100 ) / 200; -+ return fBrightness; -+} -+ -+void SAL_CALL -+ScVbaPictureFormat::setBrightness( double _brightness ) throw (uno::RuntimeException) -+{ -+ checkParameterRangeInDouble( _brightness, 0.0, 1.0 ); -+ double fLuminance = _brightness * 200 - 100; -+ sal_Int16 nLuminance = static_cast< sal_Int16 >( fLuminance ); -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustLuminance"), uno::makeAny( nLuminance ) ); -+} -+ -+double SAL_CALL -+ScVbaPictureFormat::getContrast() throw (uno::RuntimeException) -+{ -+ sal_Int16 nContrast = 0; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("AdjustContrast") ) >>= nContrast; -+ double fContrast = static_cast< double >( nContrast ); -+ fContrast = ( fContrast + 100 ) / 200; -+ return fContrast; -+} -+ -+void SAL_CALL -+ScVbaPictureFormat::setContrast( double _contrast ) throw (uno::RuntimeException) -+{ -+ checkParameterRangeInDouble( _contrast, 0.0, 1.0 ); -+ double fContrast = _contrast * 200 - 100; -+ sal_Int16 nContrast = static_cast< sal_Int16 >( fContrast ); -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii("AdjustContrast"), uno::makeAny( nContrast ) ); -+} -+ -+ -+// Methods -+void SAL_CALL -+ScVbaPictureFormat::IncrementBrightness( double increment ) throw (uno::RuntimeException) -+{ -+ double fBrightness = getBrightness(); -+ fBrightness += increment; -+ if( fBrightness < 0 ) -+ { -+ fBrightness = 0.0; -+ } -+ if( fBrightness > 1 ) -+ { -+ fBrightness = 1; -+ } -+ setBrightness( fBrightness ); -+} -+ -+void SAL_CALL -+ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeException) -+{ -+ double nContrast = getContrast(); -+ nContrast += increment; -+ if( increment < 0 ) -+ { -+ increment = 0.0; -+ } -+ if( increment > 1 ) -+ { -+ increment = 1.0; -+ } -+ setContrast( nContrast ); -+} -+ -+ -+rtl::OUString& -+ScVbaPictureFormat::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaPictureFormat") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+ScVbaPictureFormat::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.PictureFormat" ) ); -+ } -+ return aServiceNames; -+} -diff --git vbahelper/source/vbahelper/vbapictureformat.hxx vbahelper/source/vbahelper/vbapictureformat.hxx -new file mode 100644 -index 0000000..a549b88 ---- /dev/null -+++ vbahelper/source/vbahelper/vbapictureformat.hxx -@@ -0,0 +1,64 @@ -+/************************************************************************* -+ * -+ * 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: vbapictureformat.hxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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_PICTUREFORMAT_HXX -+#define SC_VBA_PICTUREFORMAT_HXX -+ -+#include <com/sun/star/drawing/XShape.hpp> -+#include <com/sun/star/beans/XPropertySet.hpp> -+#include <ooo/vba/msforms/XPictureFormat.hpp> -+#include <vbahelper/vbahelperinterface.hxx> -+ -+typedef InheritedHelperInterfaceImpl1< ov::msforms::XPictureFormat > ScVbaPictureFormat_BASE; -+ -+class ScVbaPictureFormat : public ScVbaPictureFormat_BASE -+{ -+private: -+ css::uno::Reference< css::drawing::XShape > m_xShape; -+ css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; -+protected: -+ virtual rtl::OUString& getServiceImplName(); -+ virtual css::uno::Sequence<rtl::OUString> getServiceNames(); -+private: -+ void checkParameterRangeInDouble( double nRange, double nMin, double nMax ) throw (css::uno::RuntimeException); -+public: -+ ScVbaPictureFormat( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, css::uno::Reference< css::drawing::XShape > xShape ) throw( css::lang::IllegalArgumentException ); -+ -+ // Attributes -+ virtual double SAL_CALL getBrightness() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setBrightness( double _brightness ) throw (css::uno::RuntimeException); -+ virtual double SAL_CALL getContrast() throw (css::uno::RuntimeException); -+ virtual void SAL_CALL setContrast( double _contrast ) throw (css::uno::RuntimeException); -+ -+ // Methods -+ virtual void SAL_CALL IncrementBrightness( double increment ) throw (css::uno::RuntimeException); -+ virtual void SAL_CALL IncrementContrast( double increment ) throw (css::uno::RuntimeException); -+}; -+ -+#endif//SC_VBA_PICTUREFORMAT_HXX -diff --git vbahelper/source/vbahelper/vbashape.cxx vbahelper/source/vbahelper/vbashape.cxx -new file mode 100644 -index 0000000..5a8dbd6 ---- /dev/null -+++ vbahelper/source/vbahelper/vbashape.cxx -@@ -0,0 +1,679 @@ -+/************************************************************************* -+ * -+ * 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: vbashape.cxx,v $ -+ * $Revision: 1.4 $ -+ * -+ * 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<ooo/vba/office/MsoZOrderCmd.hpp> -+#include<ooo/vba/office/MsoScaleFrom.hpp> -+#include<com/sun/star/container/XNamed.hpp> -+#include<com/sun/star/drawing/ConnectorType.hpp> -+#include <com/sun/star/lang/XEventListener.hpp> -+#include<com/sun/star/drawing/XDrawPagesSupplier.hpp> -+#include<com/sun/star/drawing/XDrawPages.hpp> -+#include<com/sun/star/view/XSelectionSupplier.hpp> -+#include <com/sun/star/lang/XServiceInfo.hpp> -+#include <com/sun/star/lang/XMultiServiceFactory.hpp> -+#include <com/sun/star/text/TextContentAnchorType.hpp> -+#include <ooo/vba/word/WdRelativeHorizontalPosition.hpp> -+#include <ooo/vba/word/WdRelativeVerticalPosition.hpp> -+ -+#include <comphelper/processfactory.hxx> -+#include <vos/mutex.hxx> -+#include <vcl/svapp.hxx> -+#include <svx/unopage.hxx> -+#include <svx/unoshape.hxx> -+ -+#include <vbahelper/vbashape.hxx> -+#include <vbahelper/vbatextframe.hxx> -+#include "vbalineformat.hxx" -+#include "vbafillformat.hxx" -+#include "vbapictureformat.hxx" -+#include <vbahelper/vbashaperange.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+using namespace ::vos; -+ -+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 ) -+{ -+ m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); -+ m_pShapeHelper.reset( new ShapeHelper( m_xShape ) ); -+ addListeners(); -+} -+ -+ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< drawing::XShape >& xShape ) throw( lang::IllegalArgumentException ) : ScVbaShape_BASE( uno::Reference< XHelperInterface >(), xContext ), m_xShape( xShape ) -+{ -+ // add listener -+ addListeners(); -+} -+ -+ScVbaShape::~ScVbaShape() -+{ -+ // dtor must never ever throw -+ /*try -+ { -+ removeShapeListener(); -+ removeShapesListener(); -+ } -+ catch( uno::Exception& ) -+ { -+ }*/ -+} -+ -+void SAL_CALL -+ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException ) -+{ -+ try -+ { -+ uno::Reference< drawing::XShapes > xShapes( rEventObject.Source, uno::UNO_QUERY ); -+ uno::Reference< drawing::XShape > xShape( rEventObject.Source, uno::UNO_QUERY ); -+ if ( xShapes.is() ) -+ removeShapesListener(); -+ if ( xShape.is() ) -+ removeShapeListener(); -+ } -+ catch( uno::Exception& ) -+ { -+ } -+} -+ -+ -+void ScVbaShape::addListeners() -+{ -+ uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY ); -+ if ( xComponent.is() ) -+ xComponent->addEventListener( this ); -+ -+ xComponent.set( m_xShapes, uno::UNO_QUERY ); -+ if ( xComponent.is() ) -+ xComponent->addEventListener( this ); -+} -+ -+void -+ScVbaShape::removeShapeListener() throw( uno::RuntimeException ) -+{ -+ if( m_xShape.is() ) -+ { -+ uno::Reference< lang::XComponent > xComponent( m_xShape, uno::UNO_QUERY_THROW ); -+ xComponent->removeEventListener( this ); -+ } -+ m_xShape = NULL; -+ m_xPropertySet = NULL; -+} -+ -+void -+ScVbaShape::removeShapesListener() throw( uno::RuntimeException ) -+{ -+ if( m_xShapes.is() ) -+ { -+ uno::Reference< lang::XComponent > xComponent( m_xShapes, uno::UNO_QUERY_THROW ); -+ xComponent->removeEventListener( this ); -+ } -+ m_xShapes = NULL; -+} -+ -+sal_Int32 -+ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException) -+{ -+ rtl::OUString sShapeType; -+ uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor( xShape, uno::UNO_QUERY_THROW ); -+ sShapeType = xShapeDescriptor->getShapeType(); -+ OSL_TRACE("ScVbaShape::getType: %s", rtl::OUStringToOString( sShapeType, RTL_TEXTENCODING_UTF8 ).getStr() ); -+ // office::MsoShapeType::msoDiagram to "com.sun.star.drawing.GroupShape" -+ if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GroupShape" ) ) ) -+ return office::MsoShapeType::msoGroup; -+ else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) ) -+ return office::MsoShapeType::msoPicture; -+ else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) || -+ sShapeType.equals( rtl::OUString::createFromAscii( "FrameShape" ) ) ) -+ return office::MsoShapeType::msoOLEControlObject; -+ // OOo don't support office::MsoShapeType::msoComment as a Shape. -+ else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.OLE2Shape" ) ) ) -+ return office::MsoShapeType::msoChart; -+ // Art characters office::MsoShapeType::msoTextEffect, in OOo corresponding to "com.sun.star.drawing.CustomShape" -+ else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ConnectorShape" ) ) ) -+ { -+ enum drawing::ConnectorType connectorType; -+ uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); -+ xPropertySet->getPropertyValue( rtl::OUString::createFromAscii("EdgeKind")) >>= connectorType; -+ if( connectorType == drawing::ConnectorType_CURVE ) -+ return office::MsoShapeType::msoFreeform; -+ else if( connectorType == drawing::ConnectorType_LINE ) -+ return office::MsoShapeType::msoLine; -+ else -+ return office::MsoShapeType::msoAutoShape; -+ } -+ else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) ) -+ return office::MsoShapeType::msoLine; -+ else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.CustomShape" ) ) || -+ sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape") ) ) -+ return office::MsoShapeType::msoAutoShape; -+ else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ) ) -+ return office::MsoShapeType::msoTextBox; -+ else -+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "the shape type do not be supported: " ) + sShapeType, uno::Reference< uno::XInterface >() ); -+} -+ -+// Attributes -+rtl::OUString SAL_CALL -+ScVbaShape::getName() throw (uno::RuntimeException) -+{ -+ rtl::OUString sName; -+ uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW ); -+ sName = xNamed->getName(); -+ return sName; -+} -+ -+void SAL_CALL -+ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException) -+{ -+ uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW ); -+ xNamed->setName( _name ); -+} -+ -+double SAL_CALL -+ScVbaShape::getHeight() throw (uno::RuntimeException) -+{ -+ return m_pShapeHelper->getHeight(); -+} -+ -+void SAL_CALL -+ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException) -+{ -+ m_pShapeHelper->setHeight( _height ); -+} -+ -+double SAL_CALL -+ScVbaShape::getWidth() throw (uno::RuntimeException) -+{ -+ return m_pShapeHelper->getWidth(); -+} -+ -+void SAL_CALL -+ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException) -+{ -+ m_pShapeHelper->setWidth( _width ); -+} -+ -+double SAL_CALL -+ScVbaShape::getLeft() throw (uno::RuntimeException) -+{ -+ return m_pShapeHelper->getLeft(); -+} -+ -+void SAL_CALL -+ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException) -+{ -+ m_pShapeHelper->setLeft( _left ); -+} -+ -+double SAL_CALL -+ScVbaShape::getTop() throw (uno::RuntimeException) -+{ -+ return m_pShapeHelper->getTop(); -+} -+ -+void SAL_CALL -+ScVbaShape::setTop( double _top ) throw (uno::RuntimeException) -+{ -+ return m_pShapeHelper->setTop( _top ); -+} -+ -+sal_Bool SAL_CALL -+ScVbaShape::getVisible() throw (uno::RuntimeException) -+{ -+ //UNO Shapes are always visible -+ return sal_True; -+} -+ -+void SAL_CALL -+ScVbaShape::setVisible( sal_Bool /*_visible*/ ) throw (uno::RuntimeException) -+{ -+ //UNO Shapes are always visible -+} -+ -+sal_Int32 SAL_CALL -+ScVbaShape::getZOrderPosition() throw (uno::RuntimeException) -+{ -+ sal_Int32 nZOrderPosition = 0; -+ uno::Any aZOrderPosition = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); -+ aZOrderPosition >>= nZOrderPosition; -+ return nZOrderPosition + 1; -+} -+ -+sal_Int32 SAL_CALL -+ScVbaShape::getType() throw (uno::RuntimeException) -+{ -+ return m_nType; -+} -+ -+double SAL_CALL -+ScVbaShape::getRotation() throw (uno::RuntimeException) -+{ -+ double dRotation = 0; -+ sal_Int32 nRotation = 0; -+ m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ) ) >>= nRotation; -+ dRotation = static_cast< double >( nRotation /100 ); -+ return dRotation; -+} -+ -+void SAL_CALL -+ScVbaShape::setRotation( double _rotation ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nRotation = static_cast < sal_Int32 > ( _rotation * 100 ); -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ), uno::makeAny( nRotation ) ); -+} -+ -+uno::Reference< msforms::XLineFormat > SAL_CALL -+ScVbaShape::getLine() throw (uno::RuntimeException) -+{ -+ // TODO should ongly return line -+ return uno::Reference< msforms::XLineFormat >( new ScVbaLineFormat( this, mxContext, m_xShape ) ); -+} -+ -+uno::Reference< msforms::XFillFormat > SAL_CALL -+ScVbaShape::getFill() throw (uno::RuntimeException) -+{ -+ return uno::Reference< msforms::XFillFormat >( new ScVbaFillFormat( this, mxContext, m_xShape ) ); -+} -+ -+uno::Reference< msforms::XPictureFormat > SAL_CALL -+ScVbaShape::getPictureFormat() throw (uno::RuntimeException) -+{ -+ return uno::Reference< msforms::XPictureFormat >( new ScVbaPictureFormat( this, mxContext, m_xShape ) ); -+} -+ -+// Methods -+uno::Any SAL_CALL -+ScVbaShape::TextFrame() throw (uno::RuntimeException) -+{ -+ uno::Reference< frame::XModel > xModel = getCurrentDocument(); -+ uno::Reference< lang::XServiceInfo > xServiceInfo( xModel, uno::UNO_QUERY_THROW ); -+ if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ) ) ) ) -+ { -+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); -+ uno::Sequence< uno::Any > aArgs(2); -+ aArgs[0] = uno::makeAny( getParent() ); -+ aArgs[1] <<= m_xShape; -+ uno::Reference< uno::XInterface > xTextFrame( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.TextFrame") ) , aArgs ) , uno::UNO_QUERY_THROW ); -+ return uno::makeAny( xTextFrame ); -+ } -+ -+ return uno::makeAny( uno::Reference< msforms::XTextFrame >( new VbaTextFrame( this, mxContext, m_xShape ) ) ); -+} -+ -+void SAL_CALL -+ScVbaShape::Delete() throw (uno::RuntimeException) -+{ -+ OGuard aGuard( Application::GetSolarMutex() ); -+ m_xShapes->remove( m_xShape ); -+} -+ -+void SAL_CALL -+ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nOrderPositon; -+ uno::Any aOrderPostion = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ) ); -+ aOrderPostion >>= nOrderPositon; -+ switch( ZOrderCmd ) -+ { -+ case office::MsoZOrderCmd::msoBringToFront: -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( SAL_MAX_INT32 ) ); -+ break; -+ case office::MsoZOrderCmd::msoSendToBack: -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( (sal_Int32)0 ) ); -+ break; -+ case office::MsoZOrderCmd::msoBringForward: -+ nOrderPositon += 1; -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); -+ break; -+ case office::MsoZOrderCmd::msoSendBackward: -+ if( nOrderPositon > 0 ) -+ { -+ nOrderPositon -= 1; -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "ZOrder" ), uno::makeAny( nOrderPositon ) ); -+ } -+ break; -+ // below two commands use with Writer for text and image object. -+ case office::MsoZOrderCmd::msoBringInFrontOfText: -+ case office::MsoZOrderCmd::msoSendBehindText: -+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "This ZOrderCmd is not implemented, it is use with writer." ), uno::Reference< uno::XInterface >() ); -+ default: -+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "Invalid Parameter." ), uno::Reference< uno::XInterface >() ); -+ } -+} -+ -+void SAL_CALL -+ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException) -+{ -+ double nCurrentRotation = getRotation(); -+ nCurrentRotation += Increment; -+ setRotation(nCurrentRotation); -+} -+ -+void SAL_CALL -+ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException) -+{ -+ double nCurrentLeft = getLeft(); -+ nCurrentLeft += Increment; -+ setLeft(nCurrentLeft); -+} -+ -+void SAL_CALL -+ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException) -+{ -+ double nCurrentTop = getTop(); -+ nCurrentTop += Increment; -+ setTop(nCurrentTop); -+} -+ -+void SAL_CALL -+ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException) -+{ -+ double nHeight = getHeight(); -+ double nNewHeight = nHeight * Factor; -+ if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft ) -+ { -+ setHeight(nNewHeight); -+ } -+ else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight ) -+ { -+ double nDeltaHeight = nNewHeight - nHeight; -+ double nNewTop = getTop() - nDeltaHeight; -+ setTop(nNewTop); -+ setHeight(nNewHeight); -+ } -+ else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle ) -+ { -+ double nDeltaHeight = (nNewHeight - nHeight) / 2; -+ double nNewTop = getTop() - nDeltaHeight; -+ setTop(nNewTop); -+ setHeight(nNewHeight); -+ } -+ else -+ { -+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); -+ } -+} -+ -+void SAL_CALL -+ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException) -+{ -+ double nWidth = getWidth(); -+ double nNewWidth = nWidth * Factor; -+ if( Scale == office::MsoScaleFrom::msoScaleFromTopLeft ) -+ { -+ setWidth(nNewWidth); -+ } -+ else if( Scale == office::MsoScaleFrom::msoScaleFromBottomRight ) -+ { -+ double nDeltaWidth = nNewWidth - nWidth; -+ double nNewLeft = getLeft() - nDeltaWidth; -+ setLeft(nNewLeft); -+ setWidth(nNewWidth); -+ } -+ else if( Scale == office::MsoScaleFrom::msoScaleFromMiddle ) -+ { -+ double nDeltaWidth = (nNewWidth - nWidth) / 2; -+ double nNewLeft = getLeft() - nDeltaWidth; -+ setLeft(nNewLeft); -+ setWidth(nNewWidth); -+ } -+ else -+ { -+ throw uno::RuntimeException( rtl::OUString::createFromAscii( "ScaleHeight.Scale wrong value is given." ) , uno::Reference< uno::XInterface >() ); -+ } -+} -+ -+void SAL_CALL -+ScVbaShape::Select( const uno::Any& /*Replace*/ ) throw ( uno::RuntimeException ) -+{ -+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); -+ uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); -+ xSelectSupp->select( uno::makeAny( m_xShape ) ); -+} -+ -+// This method should not be part of Shape, what we reall need to do is... -+// dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc. -+// ( e.g. the ones that really do have ShapeRange as an attribute ) -+uno::Any SAL_CALL -+ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException ) -+{ -+ // perhaps we should store a reference to the Shapes Collection -+ // in this class -+ // but anyway this method should not even be in this class -+ // #TODO not sure what the parent of the Shapes collection should be -+ -+ XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec aVec; -+ aVec.push_back( m_xShape ); -+ uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( aVec ) ); -+ uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW ); -+ // #FIXME for want of a better parent, setting this -+ uno::Reference< msforms::XShapeRange > xShapeRange( new ScVbaShapeRange( mxParent, mxContext, xIndexAccess, uno::Reference< drawing::XDrawPage >( xChild->getParent(), uno::UNO_QUERY_THROW ) ) ); -+ if ( index.hasValue() ) -+ return xShapeRange->Item( index, uno::Any() ); -+ return uno::makeAny( xShapeRange ); -+} -+ -+sal_Bool SAL_CALL -+ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException) -+{ -+ // FIXME: -+ return sal_False; -+} -+ -+void SAL_CALL -+ScVbaShape::setLockAspectRatio( sal_Bool /*_lockaspectratio*/ ) throw (uno::RuntimeException) -+{ -+ // FIXME: -+} -+ -+sal_Bool SAL_CALL -+ScVbaShape::getLockAnchor() throw (uno::RuntimeException) -+{ -+ // FIXME: -+ return sal_True; -+} -+ -+void SAL_CALL -+ScVbaShape::setLockAnchor( sal_Bool /*_lockanchor*/ ) throw (uno::RuntimeException) -+{ -+ // FIXME: -+} -+ -+sal_Int32 SAL_CALL -+ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException) -+{ -+ sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin; -+ text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; -+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType; -+ -+ switch( eType ) -+ { -+ case text::TextContentAnchorType_AT_PARAGRAPH: -+ { -+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn; -+ break; -+ } -+ case text::TextContentAnchorType_AT_PAGE: -+ { -+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage; -+ break; -+ } -+ case text::TextContentAnchorType_AT_CHARACTER: -+ { -+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter; -+ break; -+ } -+ case text::TextContentAnchorType_AT_FRAME: -+ case text::TextContentAnchorType_AS_CHARACTER: -+ { -+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin; -+ break; -+ } -+ default: -+ { -+ nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin; -+ } -+ } -+ return nRelativeHorizontalPosition; -+} -+ -+void SAL_CALL -+ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException) -+{ -+ text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; -+ switch( _relativehorizontalposition ) -+ { -+ case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter: -+ { -+ eType = text::TextContentAnchorType_AT_CHARACTER; -+ break; -+ } -+ case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn: -+ case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin: -+ { -+ eType = text::TextContentAnchorType_AT_PARAGRAPH; -+ break; -+ } -+ case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage: -+ { -+ eType = text::TextContentAnchorType_AT_PAGE; -+ break; -+ } -+ default: -+ { -+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); -+ } -+ } -+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) ); -+} -+ -+sal_Int32 SAL_CALL -+ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException) -+{ -+ sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin; -+ text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; -+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType; -+ -+ switch( eType ) -+ { -+ case text::TextContentAnchorType_AT_PARAGRAPH: -+ { -+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph; -+ break; -+ } -+ case text::TextContentAnchorType_AT_PAGE: -+ { -+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage; -+ break; -+ } -+ case text::TextContentAnchorType_AT_CHARACTER: -+ { -+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine; -+ break; -+ } -+ case text::TextContentAnchorType_AT_FRAME: -+ case text::TextContentAnchorType_AS_CHARACTER: -+ { -+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin; -+ break; -+ } -+ default: -+ { -+ nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin; -+ } -+ } -+ return nRelativeVerticalPosition; -+} -+ -+void SAL_CALL -+ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException) -+{ -+ text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH; -+ switch( _relativeverticalposition ) -+ { -+ case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine: -+ { -+ eType = text::TextContentAnchorType_AT_CHARACTER; -+ break; -+ } -+ case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph: -+ case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin: -+ { -+ eType = text::TextContentAnchorType_AT_PARAGRAPH; -+ break; -+ } -+ case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage: -+ { -+ eType = text::TextContentAnchorType_AT_PAGE; -+ break; -+ } -+ default: -+ { -+ DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString()); -+ } -+ } -+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) ); -+} -+ -+uno::Any SAL_CALL -+ScVbaShape::WrapFormat() throw (uno::RuntimeException) -+{ -+ uno::Reference< frame::XModel > xModel = getCurrentDocument(); -+ uno::Reference< lang::XServiceInfo > xServiceInfo( xModel, uno::UNO_QUERY_THROW ); -+ if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) ) -+ { -+ uno::Reference< lang::XMultiServiceFactory > xSF( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); -+ uno::Sequence< uno::Any > aArgs(2); -+ aArgs[0] = uno::makeAny( getParent() ); -+ aArgs[1] <<= m_xShape; -+ uno::Reference< uno::XInterface > xWrapFormat( xSF->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.WrapFormat") ) , aArgs ) , uno::UNO_QUERY_THROW ); -+ return uno::makeAny( xWrapFormat ); -+ } -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+ -+rtl::OUString& -+ScVbaShape::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShape") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+ScVbaShape::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shape" ) ); -+ } -+ return aServiceNames; -+} -diff --git vbahelper/source/vbahelper/vbashaperange.cxx vbahelper/source/vbahelper/vbashaperange.cxx -new file mode 100644 -index 0000000..ae1a1fb ---- /dev/null -+++ vbahelper/source/vbahelper/vbashaperange.cxx -@@ -0,0 +1,383 @@ -+/************************************************************************* -+ * -+ * 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: vbashaperange.cxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 <com/sun/star/drawing/XShapeGrouper.hpp> -+#include <com/sun/star/drawing/XDrawPage.hpp> -+#include<com/sun/star/view/XSelectionSupplier.hpp> -+ -+#include <vbahelper/vbahelper.hxx> -+#include <vbahelper/vbashaperange.hxx> -+#include <vbahelper/vbashape.hxx> -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+class VbShapeRangeEnumHelper : public EnumerationHelper_BASE -+{ -+ uno::Reference< XCollection > m_xParent; -+ uno::Reference<container::XIndexAccess > m_xIndexAccess; -+ sal_Int32 nIndex; -+public: -+ VbShapeRangeEnumHelper( const uno::Reference< XCollection >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} -+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -+ { -+ return ( nIndex < m_xIndexAccess->getCount() ); -+ } -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ ScVbaShapeRange* pCollectionImpl = dynamic_cast< ScVbaShapeRange* >(m_xParent.get()); -+ if ( pCollectionImpl && hasMoreElements() ) -+ return pCollectionImpl->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); -+ throw container::NoSuchElementException(); -+ } -+ -+}; -+ -+ScVbaShapeRange::ScVbaShapeRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xShapes, const uno::Reference< drawing::XDrawPage >& xDrawPage ) : ScVbaShapeRange_BASE( xParent, xContext, xShapes ), m_xDrawPage( xDrawPage ), m_nShapeGroupCount(0) -+{ -+} -+ -+// Methods -+void SAL_CALL -+ScVbaShapeRange::Select( ) throw (uno::RuntimeException) -+{ -+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); -+ uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); -+ xSelectSupp->select( uno::makeAny( getShapes() ) ); -+} -+ -+uno::Reference< msforms::XShape > SAL_CALL -+ScVbaShapeRange::Group() throw (uno::RuntimeException) -+{ -+ uno::Reference< drawing::XShapeGrouper > xShapeGrouper( m_xDrawPage, uno::UNO_QUERY_THROW ); -+ uno::Reference< drawing::XShapeGroup > xShapeGroup( xShapeGrouper->group( getShapes() ), uno::UNO_QUERY_THROW ); -+ uno::Reference< drawing::XShape > xShape( xShapeGroup, uno::UNO_QUERY_THROW ); -+ return uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, getShapes(), office::MsoShapeType::msoGroup ) ); -+} -+ -+uno::Reference< drawing::XShapes > -+ScVbaShapeRange::getShapes() throw (uno::RuntimeException) -+{ -+ if ( !m_xShapes.is() ) -+ { -+ uno::Reference< lang::XMultiServiceFactory > xMSF( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); -+ m_xShapes.set( xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.drawing.ShapeCollection" ) ), uno::UNO_QUERY_THROW ); -+ sal_Int32 nLen = m_xIndexAccess->getCount(); -+ for ( sal_Int32 index = 0; index < nLen; ++index ) -+ m_xShapes->add( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ), uno::UNO_QUERY_THROW ) ); -+ -+ } -+ return m_xShapes; -+} -+ -+ -+void SAL_CALL -+ScVbaShapeRange::IncrementRotation( double Increment ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->IncrementRotation( Increment ); -+ } -+} -+ -+void SAL_CALL -+ScVbaShapeRange::IncrementLeft( double Increment ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->IncrementLeft( Increment ); -+ } -+} -+ -+void SAL_CALL -+ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->IncrementTop( Increment ); -+ } -+} -+ -+double SAL_CALL ScVbaShapeRange::getHeight() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getHeight( ); -+ } -+ throw uno::RuntimeException(); -+} -+ -+void SAL_CALL ScVbaShapeRange::setHeight( double _height ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->setHeight( _height ); -+ } -+} -+ -+double SAL_CALL ScVbaShapeRange::getWidth() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getWidth( ); -+ } -+ throw uno::RuntimeException(); -+} -+ -+void SAL_CALL ScVbaShapeRange::setWidth( double _width ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->setWidth( _width ); -+ } -+} -+ -+double SAL_CALL ScVbaShapeRange::getLeft() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getLeft(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+void SAL_CALL ScVbaShapeRange::setLeft( double _left ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->setLeft( _left ); -+ } -+} -+ -+double SAL_CALL ScVbaShapeRange::getTop() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getTop(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+void SAL_CALL ScVbaShapeRange::setTop( double _top ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->setTop( _top ); -+ } -+} -+ -+uno::Reference< ov::msforms::XLineFormat > SAL_CALL ScVbaShapeRange::getLine() throw (css::uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getLine(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+uno::Reference< ov::msforms::XFillFormat > SAL_CALL ScVbaShapeRange::getFill() throw (css::uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getFill(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+::sal_Bool SAL_CALL ScVbaShapeRange::getLockAspectRatio() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getLockAspectRatio(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+void SAL_CALL ScVbaShapeRange::setLockAspectRatio( ::sal_Bool _lockaspectratio ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->setLockAspectRatio( _lockaspectratio ); -+ } -+} -+ -+::sal_Bool SAL_CALL ScVbaShapeRange::getLockAnchor() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getLockAnchor(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+void SAL_CALL ScVbaShapeRange::setLockAnchor( ::sal_Bool _lockanchor ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->setLockAnchor( _lockanchor ); -+ } -+} -+ -+::sal_Int32 SAL_CALL ScVbaShapeRange::getRelativeHorizontalPosition() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getRelativeHorizontalPosition(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+void SAL_CALL ScVbaShapeRange::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->setRelativeHorizontalPosition( _relativehorizontalposition ); -+ } -+} -+ -+::sal_Int32 SAL_CALL ScVbaShapeRange::getRelativeVerticalPosition() throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->getRelativeVerticalPosition(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+void SAL_CALL ScVbaShapeRange::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ xShape->setRelativeVerticalPosition( _relativeverticalposition ); -+ } -+} -+ -+uno::Any SAL_CALL ScVbaShapeRange::TextFrame( ) throw (css::uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->TextFrame(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::uno::RuntimeException) -+{ -+ sal_Int32 nLen = getCount(); -+ for ( sal_Int32 index = 1; index <= nLen; ++index ) -+ { -+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW ); -+ return xShape->WrapFormat(); -+ } -+ throw uno::RuntimeException(); -+} -+ -+uno::Type SAL_CALL -+ScVbaShapeRange::getElementType() throw (uno::RuntimeException) -+{ -+ return msforms::XShape::static_type(0); -+} -+ -+uno::Reference< container::XEnumeration > SAL_CALL -+ScVbaShapeRange::createEnumeration() throw (uno::RuntimeException) -+{ -+ return new VbShapeRangeEnumHelper( this, m_xIndexAccess ); -+} -+ -+uno::Any -+ScVbaShapeRange:: createCollectionObject( const css::uno::Any& aSource ) -+{ -+ uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW ); -+ // #TODO #FIXME Shape parent should always be the sheet the shapes belong -+ // to -+ uno::Reference< msforms::XShape > xVbShape( new ScVbaShape( uno::Reference< XHelperInterface >(), mxContext, xShape, getShapes(), ScVbaShape::getType( xShape ) ) ); -+ return uno::makeAny( xVbShape ); -+} -+ -+rtl::OUString& -+ScVbaShapeRange::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapeRange") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+ScVbaShapeRange::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.ShapeRange" ) ); -+ } -+ return aServiceNames; -+} -diff --git vbahelper/source/vbahelper/vbashapes.cxx vbahelper/source/vbahelper/vbashapes.cxx -new file mode 100644 -index 0000000..6515c6e ---- /dev/null -+++ vbahelper/source/vbahelper/vbashapes.cxx -@@ -0,0 +1,493 @@ -+/************************************************************************* -+ * -+ * 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: vbashapes.cxx,v $ -+ * $Revision: 1.3.32.1 $ -+ * -+ * 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 <com/sun/star/container/XNamed.hpp> -+#include <com/sun/star/view/XSelectionSupplier.hpp> -+#include <com/sun/star/text/WrapTextMode.hpp> -+#include <ooo/vba/msforms/XShapeRange.hpp> -+#include <ooo/vba/office/MsoAutoShapeType.hpp> -+#include <ooo/vba/office/MsoTextOrientation.hpp> -+#include <com/sun/star/lang/XServiceInfo.hpp> -+#include <com/sun/star/text/XText.hpp> -+#include <com/sun/star/text/XTextDocument.hpp> -+#include <com/sun/star/text/XTextContent.hpp> -+#include <com/sun/star/text/TextContentAnchorType.hpp> -+#include <com/sun/star/text/HoriOrientation.hpp> -+#include <com/sun/star/text/VertOrientation.hpp> -+#include <com/sun/star/text/RelOrientation.hpp> -+#include <com/sun/star/text/SizeType.hpp> -+#include <com/sun/star/text/WritingMode.hpp> -+#include <com/sun/star/drawing/LineStyle.hpp> -+ -+#include <vbahelper/vbahelper.hxx> -+#include <vbahelper/vbashape.hxx> -+#include <vbahelper/vbashapes.hxx> -+#include <vbahelper/vbashaperange.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+class VbShapeEnumHelper : public EnumerationHelper_BASE -+{ -+ uno::Reference<msforms::XShapes > m_xParent; -+ uno::Reference<container::XIndexAccess > m_xIndexAccess; -+ sal_Int32 nIndex; -+public: -+ VbShapeEnumHelper( const uno::Reference< msforms::XShapes >& xParent, const uno::Reference< container::XIndexAccess >& xIndexAccess ) : m_xParent( xParent ), m_xIndexAccess( xIndexAccess ), nIndex( 0 ) {} -+ virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) -+ { -+ return ( nIndex < m_xIndexAccess->getCount() ); -+ } -+ virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) -+ { -+ ScVbaShapes* pShapes = dynamic_cast< ScVbaShapes* >(m_xParent.get()); -+ if ( pShapes && hasMoreElements() ) -+ return pShapes->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); -+ throw container::NoSuchElementException(); -+ } -+ -+}; -+ -+void ScVbaShapes::initBaseCollection() -+{ -+ if ( m_xNameAccess.is() ) // already has NameAccess -+ return; -+ // no NameAccess then use ShapeCollectionHelper -+ XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes; -+ sal_Int32 nLen = m_xIndexAccess->getCount(); -+ mShapes.reserve( nLen ); -+ for ( sal_Int32 index=0; index<nLen; ++index ) -+ mShapes.push_back( uno::Reference< drawing::XShape >( m_xIndexAccess->getByIndex( index ) , uno::UNO_QUERY ) ); -+ uno::Reference< container::XIndexAccess > xShapes( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) ); -+ m_xIndexAccess.set( xShapes, uno::UNO_QUERY ); -+ m_xNameAccess.set( xShapes, uno::UNO_QUERY ); -+} -+ -+ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0) -+{ -+ m_xShapes.set( xShapes, uno::UNO_QUERY_THROW ); -+ m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW ); -+ initBaseCollection(); -+} -+ -+uno::Reference< container::XEnumeration > -+ScVbaShapes::createEnumeration() throw (uno::RuntimeException) -+{ -+ return new VbShapeEnumHelper( this, m_xIndexAccess ); -+} -+ -+uno::Any -+ScVbaShapes::createCollectionObject( const css::uno::Any& aSource ) throw (uno::RuntimeException) -+{ -+ if( aSource.hasValue() ) -+ { -+ uno::Reference< drawing::XShape > xShape( aSource, uno::UNO_QUERY_THROW ); -+ return uno::makeAny( uno::Reference< msforms::XShape >( new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ) ) ); -+ } -+ return uno::Any(); -+} -+ -+uno::Type -+ScVbaShapes::getElementType() throw (uno::RuntimeException) -+{ -+ return ooo::vba::msforms::XShape::static_type(0); -+} -+rtl::OUString& -+ScVbaShapes::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShapes") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+ScVbaShapes::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msform.Shapes" ) ); -+ } -+ return aServiceNames; -+} -+ -+css::uno::Reference< css::container::XIndexAccess > -+ScVbaShapes::getShapesByArrayIndices( const uno::Any& Index ) throw (uno::RuntimeException) -+{ -+ if ( Index.getValueTypeClass() != uno::TypeClass_SEQUENCE ) -+ throw uno::RuntimeException(); -+ -+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(mxContext); -+ uno::Any aConverted; -+ aConverted = xConverter->convertTo( Index, getCppuType((uno::Sequence< uno::Any >*)0) ); -+ -+ uno::Sequence< uno::Any > sIndices; -+ aConverted >>= sIndices; -+ XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec mShapes; -+ sal_Int32 nElems = sIndices.getLength(); -+ for( sal_Int32 index = 0; index < nElems; ++index ) -+ { -+ uno::Reference< drawing::XShape > xShape; -+ if ( sIndices[ index ].getValueTypeClass() == uno::TypeClass_STRING ) -+ { -+ rtl::OUString sName; -+ sIndices[ index ] >>= sName; -+ xShape.set( m_xNameAccess->getByName( sName ), uno::UNO_QUERY ); -+ } -+ else -+ { -+ sal_Int32 nIndex = 0; -+ sIndices[ index ] >>= nIndex; -+ // adjust for 1 based mso indexing -+ xShape.set( m_xIndexAccess->getByIndex( nIndex - 1 ), uno::UNO_QUERY ); -+ -+ } -+ // populate map with drawing::XShapes -+ if ( xShape.is() ) -+ mShapes.push_back( xShape ); -+ } -+ uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( mShapes ) ); -+ return xIndexAccess; -+} -+ -+uno::Any SAL_CALL -+ScVbaShapes::Item( const uno::Any& Index, const uno::Any& Index2 ) throw (uno::RuntimeException) -+{ -+ // I don't think we need to support Array of indices for shapes -+/* -+ if ( Index.getValueTypeClass() == uno::TypeClass_SEQUENCE ) -+ { -+ uno::Reference< container::XIndexAccess > xIndexAccess( getShapesByArrayIndices( Index ) ); -+ // return new collection instance -+ uno::Reference< XCollection > xShapesCollection( new ScVbaShapes( this->getParent(), mxContext, xIndexAccess ) ); -+ return uno::makeAny( xShapesCollection ); -+ } -+*/ -+ return ScVbaShapes_BASE::Item( Index, Index2 ); -+} -+ -+uno::Reference< msforms::XShapeRange > SAL_CALL -+ScVbaShapes::Range( const uno::Any& shapes ) throw (css::uno::RuntimeException) -+{ -+ // shapes, can be an index or an array of indices -+ uno::Reference< container::XIndexAccess > xShapes; -+ if ( shapes.getValueTypeClass() == uno::TypeClass_SEQUENCE ) -+ xShapes = getShapesByArrayIndices( shapes ); -+ else -+ { -+ // wrap single index into a sequence -+ uno::Sequence< uno::Any > sIndices(1); -+ sIndices[ 0 ] = shapes; -+ uno::Any aIndex; -+ aIndex <<= sIndices; -+ xShapes = getShapesByArrayIndices( aIndex ); -+ } -+ return new ScVbaShapeRange( getParent(), mxContext, xShapes, m_xDrawPage ); -+} -+ -+void SAL_CALL -+ScVbaShapes::SelectAll() throw (uno::RuntimeException) -+{ -+ uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); -+ uno::Reference< view::XSelectionSupplier > xSelectSupp( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); -+ try -+ { -+ xSelectSupp->select( uno::makeAny( m_xShapes ) ); -+ } -+ // viewuno.cxx ScTabViewObj::select will throw IllegalArgumentException -+ // if one of the shapes is no 'markable' e.g. a button -+ // the method still works -+ catch( lang::IllegalArgumentException& ) -+ { -+ } -+} -+ -+uno::Reference< drawing::XShape > -+ScVbaShapes::createShape( rtl::OUString service ) throw (css::uno::RuntimeException) -+{ -+ // #FIXME don't use getCurrentDocument -+ uno::Reference< lang::XMultiServiceFactory > xMSF( getCurrentDocument(), uno::UNO_QUERY_THROW ); -+ uno::Reference< drawing::XShape > xShape( xMSF->createInstance( service ), uno::UNO_QUERY_THROW ); -+ return xShape; -+} -+ -+uno::Any -+ScVbaShapes::AddRectangle( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) -+{ -+ rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.RectangleShape" ) ); -+ sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); -+ sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); -+ sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); -+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); -+ -+ uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); -+ m_xShapes->add( xShape ); -+ -+ rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Rectangle" ) ); -+ setDefaultShapeProperties( xShape ); -+ setShape_NameProperty( xShape, sName ); -+ -+ awt::Point aMovePositionIfRange(0, 0); -+ awt::Point position; -+ position.X = nXPos - aMovePositionIfRange.X; -+ position.Y = nYPos - aMovePositionIfRange.Y; -+ xShape->setPosition( position ); -+ -+ awt::Size size; -+ size.Height = nHeight; -+ size.Width = nWidth; -+ xShape->setSize( size ); -+ -+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); -+ pScVbaShape->setRange( aRange ); -+ return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); -+} -+ -+uno::Any -+ScVbaShapes::AddEllipse( sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, uno::Any aRange ) throw (css::uno::RuntimeException) -+{ -+ rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.EllipseShape" ) ); -+ sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX ); -+ sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY ); -+ sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); -+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); -+ -+ uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); -+ m_xShapes->add( xShape ); -+ -+ awt::Point aMovePositionIfRange( 0, 0 ); -+ //TODO helperapi using a writer document -+ /* -+ XDocument xDocument = (XDocument)getParent(); -+ if (AnyConverter.isVoid(_aRange)) -+ { -+ _aRange = xDocument.Range(new Integer(0), new Integer(1)); -+ // Top&Left in Word is Top&Left of the paper and not the writeable area. -+ aMovePositionIfRange = calculateTopLeftMargin((HelperInterfaceAdaptor)xDocument); -+ } -+ -+ setShape_AnchorTypeAndRangeProperty(xShape, _aRange); -+ */ -+ rtl::OUString name = createName( rtl::OUString::createFromAscii( "Oval" )); -+ setDefaultShapeProperties(xShape); -+ setShape_NameProperty(xShape, name); -+ -+ awt::Point position; -+ position.X = nXPos - aMovePositionIfRange.X; -+ position.Y = nYPos - aMovePositionIfRange.Y; -+ xShape->setPosition(position); -+ -+ awt::Size size; -+ size.Height = nHeight; -+ size.Width = nWidth; -+ xShape->setSize(size); -+ -+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); -+ pScVbaShape->setRange( aRange ); -+ return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); -+} -+ -+//helpeapi calc -+uno::Any SAL_CALL -+ScVbaShapes::AddLine( sal_Int32 StartX, sal_Int32 StartY, sal_Int32 endX, sal_Int32 endY ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nLineWidth = endX - StartX; -+ sal_Int32 nLineHeight = endY - StartY; -+ -+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight ); -+ sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth ); -+ sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( StartX ); -+ sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( StartY ); -+ -+ uno::Reference< drawing::XShape > xShape( createShape( rtl::OUString::createFromAscii("com.sun.star.drawing.LineShape") ), uno::UNO_QUERY_THROW ); -+ m_xShapes->add( xShape ); -+ -+ awt::Point aMovePositionIfRange( 0, 0 ); -+ -+ rtl::OUString name = createName( rtl::OUString::createFromAscii( "Line" ) ); -+ setDefaultShapeProperties(xShape); -+ setShape_NameProperty(xShape, name); -+ -+ awt::Point position; -+ position.X = nXPos - aMovePositionIfRange.X; -+ position.Y = nYPos - aMovePositionIfRange.Y; -+ xShape->setPosition(position); -+ -+ awt::Size size; -+ size.Height = nHeight; -+ size.Width = nWidth; -+ xShape->setSize(size); -+ -+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); -+ return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); -+} -+ -+uno::Any SAL_CALL -+ScVbaShapes::AddShape( sal_Int32 _nType, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) -+{ -+ uno::Any _aAnchor; -+ if (_nType == office::MsoAutoShapeType::msoShapeRectangle) -+ { -+ return AddRectangle(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor); -+ } -+ else if (_nType == office::MsoAutoShapeType::msoShapeOval) -+ { -+ return AddEllipse(_nLeft, _nTop, _nWidth, _nHeight, _aAnchor); -+ } -+ return uno::Any(); -+} -+ -+uno::Any SAL_CALL -+ScVbaShapes::AddTextbox( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) -+{ -+ uno::Reference< lang::XServiceInfo > xServiceInfo( getCurrentDocument(), uno::UNO_QUERY_THROW ); -+ if( xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) ) -+ { -+ return AddTextboxInWriter( _nOrientation, _nLeft, _nTop, _nWidth, _nHeight ); -+ } -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+uno::Any -+ScVbaShapes::AddTextboxInWriter( sal_Int32 _nOrientation, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) -+{ -+ rtl::OUString sCreateShapeName( rtl::OUString::createFromAscii( "com.sun.star.drawing.TextShape" ) ); -+ sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft ); -+ sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop ); -+ sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth ); -+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( _nHeight ); -+ -+ uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW ); -+ m_xShapes->add( xShape ); -+ -+ setDefaultShapeProperties(xShape); -+ -+ rtl::OUString sName = createName( rtl::OUString::createFromAscii( "Text Box") ); -+ setShape_NameProperty( xShape, sName ); -+ -+ awt::Size size; -+ size.Height = nHeight; -+ size.Width = nWidth; -+ xShape->setSize(size); -+ -+ uno::Reference< beans::XPropertySet > xShapeProps( xShape, uno::UNO_QUERY_THROW ); -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "AnchorType" ), uno::makeAny( text::TextContentAnchorType_AT_PAGE ) ); -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_LEFT ) ); -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrient" ), uno::makeAny( text::HoriOrientation::NONE ) ); -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nXPos ) ); -+ -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientRelation" ), uno::makeAny( text::RelOrientation::PAGE_FRAME ) ); -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrient" ), uno::makeAny( text::VertOrientation::NONE ) ); -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nYPos ) ); -+ -+ // set to visible -+ drawing::LineStyle aLineStyle = drawing::LineStyle_SOLID; -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LineStyle" ), uno::makeAny( aLineStyle ) ); -+ // set to font -+ sal_Int16 nLayerId = 1; -+ rtl::OUString sLayerName = rtl::OUString::createFromAscii("Heaven"); -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerID" ), uno::makeAny( nLayerId ) ); -+ xShapeProps->setPropertyValue( rtl::OUString::createFromAscii( "LayerName" ), uno::makeAny( sLayerName ) ); -+ -+ -+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); -+ return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); -+} -+ -+uno::Any -+ScVbaShapes::AddShape( const rtl::OUString& sService, const rtl::OUString& sName, sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight ) throw (uno::RuntimeException) -+{ -+ sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft ); -+ sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop ); -+ sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth ); -+ sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( _nHeight ); -+ -+ uno::Reference< drawing::XShape > xShape( createShape( sService ), uno::UNO_QUERY_THROW ); -+ m_xShapes->add( xShape ); -+ -+ setDefaultShapeProperties(xShape); -+ setShape_NameProperty( xShape, sName ); -+ -+ awt::Point aMovePositionIfRange( 0, 0 ); -+ awt::Point position; -+ position.X = nXPos - aMovePositionIfRange.X; -+ position.Y = nYPos - aMovePositionIfRange.Y; -+ xShape->setPosition(position); -+ -+ awt::Size size; -+ size.Height = nHeight; -+ size.Width = nWidth; -+ xShape->setSize(size); -+ -+ ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, ScVbaShape::getType( xShape ) ); -+ return uno::makeAny( uno::Reference< msforms::XShape > ( pScVbaShape ) ); -+} -+void -+ScVbaShapes::setDefaultShapeProperties( uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException) -+{ -+ uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); -+ xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillStyle" ), uno::makeAny( rtl::OUString::createFromAscii( "SOLID" ) ) ); -+ xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "FillColor"), uno::makeAny( sal_Int32(0xFFFFFF) ) ); -+ xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap"), uno::makeAny( text::WrapTextMode_THROUGHT ) ); -+ //not find in OOo2.3 -+ //xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Opaque"), uno::makeAny( sal_True ) ); -+} -+ -+void -+ScVbaShapes::setShape_NameProperty( uno::Reference< css::drawing::XShape > xShape, rtl::OUString sName ) -+{ -+ uno::Reference< beans::XPropertySet > xPropertySet( xShape, uno::UNO_QUERY_THROW ); -+ try -+ { -+ xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "Name" ), uno::makeAny( sName ) ); -+ } -+ catch( script::BasicErrorException e ) -+ { -+ } -+} -+ -+rtl::OUString -+ScVbaShapes::createName( rtl::OUString sName ) -+{ -+ sal_Int32 nActNumber = 1 + m_nNewShapeCount; -+ m_nNewShapeCount++; -+ sName += rtl::OUString::valueOf( nActNumber ); -+ return sName; -+} -+ -+#if 0 -+//TODO helperapi using a writer document -+awt::Point -+calculateTopLeftMargin( uno::Reference< XHelperInterface > xDocument ) -+{ -+ awt::Point aPoint( 0, 0 ); -+ uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW ); -+ return awt::Point(); -+} -+#endif -diff --git vbahelper/source/vbahelper/vbatextframe.cxx vbahelper/source/vbahelper/vbatextframe.cxx -new file mode 100644 -index 0000000..a461c54 ---- /dev/null -+++ vbahelper/source/vbahelper/vbatextframe.cxx -@@ -0,0 +1,169 @@ -+/************************************************************************* -+ * -+ * 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: vbatextframe.cxx,v $ -+ * $Revision: 1.3 $ -+ * -+ * 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 <vbahelper/helperdecl.hxx> -+#include <com/sun/star/drawing/TextFitToSizeType.hpp> -+#include <com/sun/star/text/XText.hpp> -+#include <vbahelper/vbatextframe.hxx> -+ -+using namespace ::ooo::vba; -+using namespace ::com::sun::star; -+ -+VbaTextFrame::VbaTextFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< drawing::XShape > xShape ) : VbaTextFrame_BASE( xParent, xContext ), m_xShape( xShape ) -+{ -+ m_xPropertySet.set( m_xShape, uno::UNO_QUERY_THROW ); -+} -+ -+void -+VbaTextFrame::setAsMSObehavior() -+{ -+ //set property TextWordWrap default as False. -+ // TextFitToSize control the text content. it seems we should set the default as False. -+ // com.sun.star.drawing.TextFitToSizeType.NONE -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextWordWrap" ), uno::makeAny( sal_False ) ); -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextFitToSize" ), uno::makeAny( drawing::TextFitToSizeType_NONE ) ); -+} -+ -+sal_Int32 VbaTextFrame::getMargin( rtl::OUString sMarginType ) -+{ -+ sal_Int32 nMargin = 0; -+ uno::Any aMargin = m_xPropertySet->getPropertyValue( sMarginType ); -+ aMargin >>= nMargin; -+ return nMargin; -+} -+ -+void VbaTextFrame::setMargin( rtl::OUString sMarginType, float fMargin ) -+{ -+ sal_Int32 nMargin = Millimeter::getInHundredthsOfOneMillimeter( fMargin ); -+ m_xPropertySet->setPropertyValue( sMarginType, uno::makeAny( nMargin ) ); -+} -+ -+// Attributes -+sal_Bool SAL_CALL -+VbaTextFrame::getAutoSize() throw (uno::RuntimeException) -+{ -+ // I don't know why, but in OOo, TextAutoGrowHeight is the property control autosize. not TextFitToSize. -+ // TextFitToSize control the text content. -+ // and in mso, there isnot option TextWordWrap which means auto wrap. the default is False. -+ sal_Bool bAutosize = sal_False; -+ uno::Any aTextAutoGrowHeight = m_xPropertySet->getPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ) ); -+ aTextAutoGrowHeight >>= bAutosize; -+ return bAutosize; -+} -+ -+void SAL_CALL -+VbaTextFrame::setAutoSize( sal_Bool _autosize ) throw (uno::RuntimeException) -+{ -+ setAsMSObehavior(); -+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "TextAutoGrowHeight" ), uno::makeAny( _autosize ) ); -+} -+ -+float SAL_CALL -+VbaTextFrame::getMarginBottom() throw (uno::RuntimeException) -+{ -+ sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ) ); -+ float fMargin = (float)Millimeter::getInPoints( nMargin ); -+ return fMargin; -+} -+ -+void SAL_CALL -+VbaTextFrame::setMarginBottom( float _marginbottom ) throw (uno::RuntimeException) -+{ -+ setMargin( rtl::OUString::createFromAscii( "TextLowerDistance" ), _marginbottom ); -+} -+ -+float SAL_CALL -+VbaTextFrame::getMarginTop() throw (uno::RuntimeException) -+{ -+ sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ) ); -+ float fMargin = (float)Millimeter::getInPoints( nMargin ); -+ return fMargin; -+} -+ -+void SAL_CALL -+VbaTextFrame::setMarginTop( float _margintop ) throw (uno::RuntimeException) -+{ -+ setMargin( rtl::OUString::createFromAscii( "TextUpperDistance" ), _margintop ); -+} -+ -+float SAL_CALL -+VbaTextFrame::getMarginLeft() throw (uno::RuntimeException) -+{ -+ sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ) ); -+ float fMargin = (float)Millimeter::getInPoints( nMargin ); -+ return fMargin; -+} -+ -+void SAL_CALL -+VbaTextFrame::setMarginLeft( float _marginleft ) throw (uno::RuntimeException) -+{ -+ setMargin( rtl::OUString::createFromAscii( "TextLeftDistance" ), _marginleft ); -+} -+ -+float SAL_CALL -+VbaTextFrame::getMarginRight() throw (uno::RuntimeException) -+{ -+ sal_Int32 nMargin = getMargin( rtl::OUString::createFromAscii( "TextRightDistance" ) ); -+ float fMargin = (float)Millimeter::getInPoints( nMargin ); -+ return fMargin; -+} -+ -+void SAL_CALL -+VbaTextFrame::setMarginRight( float _marginright ) throw (uno::RuntimeException) -+{ -+ setMargin( rtl::OUString::createFromAscii( "TextRightDistance" ), _marginright ); -+} -+ -+ -+// Methods -+uno::Any SAL_CALL -+VbaTextFrame::Characters() throw (uno::RuntimeException) -+{ -+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() ); -+} -+ -+rtl::OUString& -+VbaTextFrame::getServiceImplName() -+{ -+ static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaTextFrame") ); -+ return sImplName; -+} -+ -+uno::Sequence< rtl::OUString > -+VbaTextFrame::getServiceNames() -+{ -+ static uno::Sequence< rtl::OUString > aServiceNames; -+ if ( aServiceNames.getLength() == 0 ) -+ { -+ aServiceNames.realloc( 1 ); -+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.TextFrame" ) ); -+ } -+ return aServiceNames; -+} -+ -diff --git vbahelper/util/makefile.mk vbahelper/util/makefile.mk -index 7835a0c..796af0a 100644 ---- vbahelper/util/makefile.mk -+++ vbahelper/util/makefile.mk -@@ -40,13 +40,12 @@ TARGET=vbahelper - - - TARGET_HELPER=vbahelper --SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX) --SHL1IMPLIB= i$(TARGET_HELPER) - --SHL1DEF=$(MISC)$/$(SHL1TARGET).def --DEF1NAME=$(SHL1TARGET) -+LIB1TARGET= $(SLB)$/$(TARGET).lib -+LIB1FILES=$(SLB)$/$(TARGET)bits.lib -+ -+SHL1TARGET= $(TARGET_HELPER)$(DLLPOSTFIX) - --LIB1FILES=$(SLB)$/$(TARGET_HELPER).lib - - # dynamic libraries - SHL1STDLIBS= \ -@@ -62,9 +61,17 @@ SHL1STDLIBS= \ - $(VCLLIB) \ - $(SVTOOLLIB) \ - $(TKLIB) \ -+ $(SVXMSFILTERLIB) \ - --#SHL4DEPN=$(SHL1TARGETN) --SHL1LIBS=$(LIB1FILES) -+SHL1DEPN= -+SHL1IMPLIB= i$(TARGET_HELPER) -+SHL1USE_EXPORTS=name -+SHL1LIBS=$(LIB1TARGET) -+ -+SHL1DEF=$(MISC)$/$(SHL1TARGET).def -+ -+DEF1NAME=$(SHL1TARGET) -+DEFLIB1NAME=$(TARGET) - - TARGET_MSFORMS=msforms - SHL2TARGET=$(TARGET_MSFORMS)$(DLLPOSTFIX).uno -diff --git xmlscript/source/xmldlg_imexp/exp_share.hxx xmlscript/source/xmldlg_imexp/exp_share.hxx -index 2007522..2685f32 100644 ---- xmlscript/source/xmldlg_imexp/exp_share.hxx -+++ xmlscript/source/xmldlg_imexp/exp_share.hxx -@@ -174,6 +174,8 @@ public: - // - void readDialogModel( StyleBag * all_styles ) - SAL_THROW( (css::uno::Exception) ); -+ void readMultiPageModel( StyleBag * all_styles ) -+ SAL_THROW( (css::uno::Exception) ); - void readButtonModel( StyleBag * all_styles ) - SAL_THROW( (css::uno::Exception) ); - void readEditModel( StyleBag * all_styles ) -diff --git xmlscript/source/xmldlg_imexp/imp_share.hxx xmlscript/source/xmldlg_imexp/imp_share.hxx -index bf3ea5f..bf83523 100644 ---- xmlscript/source/xmldlg_imexp/imp_share.hxx -+++ xmlscript/source/xmldlg_imexp/imp_share.hxx -@@ -1028,6 +1028,27 @@ public: - }; - - //============================================================================== -+class MultiPage -+ : public ControlElement -+{ -+public: -+ virtual css::uno::Reference< css::xml::input::XElement > -+ SAL_CALL startChildElement( -+ sal_Int32 nUid, ::rtl::OUString const & rLocalName, -+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes ) -+ throw (css::xml::sax::SAXException, css::uno::RuntimeException); -+ virtual void SAL_CALL endElement() -+ throw (css::xml::sax::SAXException, css::uno::RuntimeException); -+ -+ inline MultiPage( -+ ::rtl::OUString const & rLocalName, -+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes, -+ ElementBase * pParent, DialogImport * pImport ) -+ SAL_THROW( () ) -+ : ControlElement( rLocalName, xAttributes, pParent, pImport ) -+ {} -+}; -+ - class ProgressBarElement - : public ControlElement - { -diff --git xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx -index 4f87c16..8559984 100644 ---- xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx -+++ xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx -@@ -137,6 +137,42 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style ) - } - - //__________________________________________________________________________________________________ -+void ElementDescriptor::readMultiPageModel( StyleBag * all_styles ) -+{ -+ // collect styles -+ Style aStyle( 0x2 | 0x8 | 0x20 ); -+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor) -+ aStyle._set |= 0x2; -+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor) -+ aStyle._set |= 0x20; -+ if (readFontProps( this, aStyle )) -+ aStyle._set |= 0x8; -+ if (aStyle._set) -+ { -+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ), -+ all_styles->getStyleId( aStyle ) ); -+ } -+ -+ // collect elements -+ readDefaults(); -+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), -+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) ); -+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ), -+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) ); -+ -+ OUString aTitle; -+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle) -+ { -+ ElementDescriptor * title = new ElementDescriptor( -+ _xProps, _xPropState, -+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) ); -+ title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ), -+ aTitle ); -+ addSubElement( title ); -+ } -+ -+ readEvents(); -+} - void ElementDescriptor::readButtonModel( StyleBag * all_styles ) - SAL_THROW( (Exception) ) - { -diff --git xmlscript/source/xmldlg_imexp/xmldlg_export.cxx xmlscript/source/xmldlg_imexp/xmldlg_export.cxx -index b5c223d..223e803 100644 ---- xmlscript/source/xmldlg_imexp/xmldlg_export.cxx -+++ xmlscript/source/xmldlg_imexp/xmldlg_export.cxx -@@ -1420,6 +1420,14 @@ void SAL_CALL exportDialogModel( - xElem = static_cast< xml::sax::XAttributeList * >( pElem ); - pElem->readGroupBoxModel( &all_styles ); - } -+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) ) -+ { -+ pElem = new ElementDescriptor( -+ xProps, xPropState, -+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ) ); -+ xElem = static_cast< xml::sax::XAttributeList * >( pElem ); -+ pElem->readMultiPageModel( &all_styles ); -+ } - else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) ) - { - pElem = new ElementDescriptor( -diff --git xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx -index 92c1a09..d5a82ab 100644 ---- xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx -+++ xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx -@@ -51,6 +51,69 @@ using ::rtl::OUString; - - namespace xmlscript - { -+Reference< xml::input::XElement > MultiPage::startChildElement( -+ sal_Int32 nUid, OUString const & rLocalName, -+ Reference< xml::input::XAttributes > const & xAttributes ) -+ throw (xml::sax::SAXException, RuntimeException) -+{ -+ // event -+rtl::OUString _label = rtl::OUString::createFromAscii("foo"); -+ if (_pImport->isEventElement( nUid, rLocalName )) -+ { -+ return new EventElement( -+ nUid, rLocalName, xAttributes, this, _pImport ); -+ } -+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") )) -+ { -+ getStringAttr( &_label, -+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), -+ xAttributes, -+ _pImport->XMLNS_DIALOGS_UID ); -+ -+ return new ElementBase( -+ _pImport->XMLNS_DIALOGS_UID, -+ rLocalName, xAttributes, this, _pImport ); -+ } -+ else -+ { -+ -+ throw xml::sax::SAXException( -+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ), -+ Reference< XInterface >(), Any() ); -+ } -+} -+//__________________________________________________________________________________________________ -+ -+void MultiPage::endElement() -+ throw (xml::sax::SAXException, RuntimeException) -+{ -+ ControlImportContext ctx( -+ _pImport, getControlId( _xAttributes ), -+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ); -+// OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ); -+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() ); -+ -+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) ); -+ if (xStyle.is()) -+ { -+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () ); -+ pStyle->importTextColorStyle( xControlModel ); -+ pStyle->importTextLineColorStyle( xControlModel ); -+ pStyle->importFontStyle( xControlModel ); -+ } -+ -+ ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement -+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ), -+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ), -+ _xAttributes ); -+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ), -+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ), -+ _xAttributes ); -+ ctx.importEvents( _events ); -+ // avoid ring-reference: -+ // vector< event elements > holding event elements holding this (via _pParent) -+ _events.clear(); -+} - - // #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251 - // of course we need to find a common home for this helper -@@ -2422,6 +2485,10 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement( - { - return new ProgressBarElement( rLocalName, xAttributes, this, _pImport ); - } -+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multipage") )) -+ { -+ return new MultiPage( rLocalName, xAttributes, this, _pImport ); -+ } - // bulletinboard - else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") )) - { |