summaryrefslogtreecommitdiff
path: root/vbahelper/source/msforms
diff options
context:
space:
mode:
Diffstat (limited to 'vbahelper/source/msforms')
-rw-r--r--vbahelper/source/msforms/vbabutton.cxx53
-rw-r--r--vbahelper/source/msforms/vbabutton.hxx15
-rw-r--r--vbahelper/source/msforms/vbacheckbox.cxx9
-rw-r--r--vbahelper/source/msforms/vbacheckbox.hxx5
-rw-r--r--vbahelper/source/msforms/vbacombobox.cxx100
-rw-r--r--vbahelper/source/msforms/vbacombobox.hxx14
-rw-r--r--vbahelper/source/msforms/vbacontrol.cxx117
-rw-r--r--vbahelper/source/msforms/vbacontrol.hxx24
-rw-r--r--vbahelper/source/msforms/vbacontrols.cxx188
-rw-r--r--vbahelper/source/msforms/vbacontrols.hxx27
-rw-r--r--vbahelper/source/msforms/vbaframe.cxx77
-rw-r--r--vbahelper/source/msforms/vbaframe.hxx27
-rw-r--r--vbahelper/source/msforms/vbalabel.cxx7
-rw-r--r--vbahelper/source/msforms/vbalabel.hxx1
-rw-r--r--vbahelper/source/msforms/vbalistbox.cxx9
-rw-r--r--vbahelper/source/msforms/vbalistbox.hxx3
-rw-r--r--vbahelper/source/msforms/vbamultipage.cxx11
-rw-r--r--vbahelper/source/msforms/vbamultipage.hxx9
-rwxr-xr-xvbahelper/source/msforms/vbanewfont.cxx160
-rwxr-xr-xvbahelper/source/msforms/vbanewfont.hxx73
-rw-r--r--vbahelper/source/msforms/vbaradiobutton.cxx8
-rw-r--r--vbahelper/source/msforms/vbaradiobutton.hxx1
-rw-r--r--vbahelper/source/msforms/vbatextbox.cxx39
-rw-r--r--vbahelper/source/msforms/vbatextbox.hxx6
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.cxx53
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.hxx12
-rw-r--r--vbahelper/source/msforms/vbauserform.cxx36
-rw-r--r--vbahelper/source/msforms/vbauserform.hxx14
28 files changed, 892 insertions, 206 deletions
diff --git a/vbahelper/source/msforms/vbabutton.cxx b/vbahelper/source/msforms/vbabutton.cxx
index 21693128c899..775a05cbb5b5 100644
--- a/vbahelper/source/msforms/vbabutton.cxx
+++ b/vbahelper/source/msforms/vbabutton.cxx
@@ -24,8 +24,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbabutton.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
using namespace com::sun::star;
using namespace ooo::vba;
@@ -51,6 +52,56 @@ ScVbaButton::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
}
+sal_Bool SAL_CALL ScVbaButton::getAutoSize() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaButton::setAutoSize( sal_Bool /*bAutoSize*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Bool SAL_CALL ScVbaButton::getCancel() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaButton::setCancel( sal_Bool /*bCancel*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Bool SAL_CALL ScVbaButton::getDefault() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaButton::setDefault( sal_Bool /*bDefault*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaButton::getBackColor() throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL ScVbaButton::setBackColor( sal_Int32 /*nBackColor*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaButton::getForeColor() throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL ScVbaButton::setForeColor( sal_Int32 /*nForeColor*/ ) throw (uno::RuntimeException)
+{
+}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaButton::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaButton::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbabutton.hxx b/vbahelper/source/msforms/vbabutton.hxx
index 1c65c293f76c..93a55e1bf73a 100644
--- a/vbahelper/source/msforms/vbabutton.hxx
+++ b/vbahelper/source/msforms/vbabutton.hxx
@@ -27,12 +27,12 @@
#ifndef SC_VBA_BUTTON_HXX
#define SC_VBA_BUTTON_HXX
#include <cppuhelper/implbase1.hxx>
-#include <ooo/vba/msforms/XButton.hpp>
+#include <ooo/vba/msforms/XCommandButton.hpp>
#include "vbacontrol.hxx"
#include <vbahelper/vbahelper.hxx>
-typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XButton > ButtonImpl_BASE;
+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XCommandButton > ButtonImpl_BASE;
class ScVbaButton : public ButtonImpl_BASE
{
@@ -41,6 +41,17 @@ public:
// Attributes
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoSize( sal_Bool bAutoSize ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getCancel() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setCancel( sal_Bool bCancel ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getDefault() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDefault( sal_Bool bDefault ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackColor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBackColor( sal_Int32 nBackColor ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeColor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setForeColor( sal_Int32 nForeColor ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx
index e9ea64f772b6..329586cf6b27 100644
--- a/vbahelper/source/msforms/vbacheckbox.cxx
+++ b/vbahelper/source/msforms/vbacheckbox.cxx
@@ -24,9 +24,10 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbacheckbox.hxx"
+#include "vbanewfont.hxx"
#include <vbahelper/helperdecl.hxx>
-#include <vector>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -83,6 +84,12 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
}
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaCheckbox::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaCheckbox::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbacheckbox.hxx b/vbahelper/source/msforms/vbacheckbox.hxx
index 34d0828e0c66..59e4d7e75e49 100644
--- a/vbahelper/source/msforms/vbacheckbox.hxx
+++ b/vbahelper/source/msforms/vbacheckbox.hxx
@@ -27,12 +27,12 @@
#ifndef SC_VBA_CHECKBOX_HXX
#define SC_VBA_CHECKBOX_HXX
#include <cppuhelper/implbase2.hxx>
-#include <ooo/vba/msforms/XRadioButton.hpp>
+#include <ooo/vba/msforms/XCheckBox.hpp>
#include "vbacontrol.hxx"
#include <vbahelper/vbahelper.hxx>
-typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XCheckBox, css::script::XDefaultProperty > CheckBoxImpl_BASE;
class ScVbaCheckbox : public CheckBoxImpl_BASE
{
@@ -43,6 +43,7 @@ public:
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
// XDefaultProperty
rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
//XHelperInterface
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index 0b5f1af30bb7..9a75fa5cbaa1 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -24,8 +24,15 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbacombobox.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
+#include <ooo/vba/msforms/fmStyle.hpp>
+#include <ooo/vba/msforms/fmDropButtonStyle.hpp>
+#include <ooo/vba/msforms/fmDragBehavior.hpp>
+#include <ooo/vba/msforms/fmEnterFieldBehavior.hpp>
+#include <ooo/vba/msforms/fmListStyle.hpp>
+#include <ooo/vba/msforms/fmTextAlign.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -41,9 +48,17 @@ const static rtl::OUString CONTROLSOURCEPROP( RTL_CONSTASCII_USTRINGPARAM("DataF
ScVbaComboBox::ScVbaComboBox( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialogType ) : ComboBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialogType( bDialogType )
{
- mpListHelper.reset( new ListControlHelper( m_xProps ) );
- // grab the default value property name
- m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
+ mpListHelper.reset( new ListControlHelper( m_xProps ) );
+ try
+ {
+ // grab the default value property name
+ m_xProps->getPropertyValue( CONTROLSOURCEPROP ) >>= sSourceName;
+ }
+ catch( uno::Exception& )
+ {
+ }
+ if( sSourceName.getLength() == 0 )
+ sSourceName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) );
}
// Attributes
@@ -103,7 +118,8 @@ ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
void SAL_CALL
ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
- m_xProps->setPropertyValue( sSourceName, _value );
+ // booleans are converted to uppercase strings
+ m_xProps->setPropertyValue( sSourceName, uno::Any( extractStringFromAny( _value, ::rtl::OUString(), true ) ) );
}
// see Value
@@ -131,22 +147,22 @@ ScVbaComboBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex )
void SAL_CALL
ScVbaComboBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
- {
+{
mpListHelper->removeItem( index );
}
void SAL_CALL
ScVbaComboBox::Clear( ) throw (uno::RuntimeException)
- {
+{
mpListHelper->Clear();
- }
+}
void SAL_CALL
ScVbaComboBox::setRowSource( const rtl::OUString& _rowsource ) throw (css::uno::RuntimeException)
{
ScVbaControl::setRowSource( _rowsource );
mpListHelper->setRowSource( _rowsource );
- }
+}
sal_Int32 SAL_CALL
ScVbaComboBox::getListCount() throw (uno::RuntimeException)
@@ -158,7 +174,71 @@ uno::Any SAL_CALL
ScVbaComboBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
{
return mpListHelper->List( pvargIndex, pvarColumn );
- }
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getStyle() throw (uno::RuntimeException)
+{
+ return msforms::fmStyle::fmStyleDropDownCombo;
+}
+
+void SAL_CALL ScVbaComboBox::setStyle( sal_Int32 /*nStyle*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getDropButtonStyle() throw (uno::RuntimeException)
+{
+ return msforms::fmDropButtonStyle::fmDropButtonStyleArrow;
+}
+
+void SAL_CALL ScVbaComboBox::setDropButtonStyle( sal_Int32 /*nDropButtonStyle*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getDragBehavior() throw (uno::RuntimeException)
+{
+ return msforms::fmDragBehavior::fmDragBehaviorDisabled;
+}
+
+void SAL_CALL ScVbaComboBox::setDragBehavior( sal_Int32 /*nDragBehavior*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getEnterFieldBehavior() throw (uno::RuntimeException)
+{
+ return msforms::fmEnterFieldBehavior::fmEnterFieldBehaviorSelectAll;
+}
+
+void SAL_CALL ScVbaComboBox::setEnterFieldBehavior( sal_Int32 /*nEnterFieldBehavior*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getListStyle() throw (uno::RuntimeException)
+{
+ return msforms::fmListStyle::fmListStylePlain;
+}
+
+void SAL_CALL ScVbaComboBox::setListStyle( sal_Int32 /*nListStyle*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getTextAlign() throw (uno::RuntimeException)
+{
+ return msforms::fmTextAlign::fmTextAlignLeft;
+}
+
+void SAL_CALL ScVbaComboBox::setTextAlign( sal_Int32 /*nTextAlign*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaComboBox::getTextLength() throw (uno::RuntimeException)
+{
+ return getText().getLength();
+}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaComboBox::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
rtl::OUString&
ScVbaComboBox::getServiceImplName()
diff --git a/vbahelper/source/msforms/vbacombobox.hxx b/vbahelper/source/msforms/vbacombobox.hxx
index 28215d16dcd7..c73b617a743b 100644
--- a/vbahelper/source/msforms/vbacombobox.hxx
+++ b/vbahelper/source/msforms/vbacombobox.hxx
@@ -58,6 +58,20 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStyle( sal_Int32 nStyle ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getDropButtonStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDropButtonStyle( sal_Int32 nDropButtonStyle ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getDragBehavior() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDragBehavior( sal_Int32 nDragBehavior ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getEnterFieldBehavior() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setEnterFieldBehavior( sal_Int32 nEnterFieldBehavior ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getListStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setListStyle( sal_Int32 nListStyle ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTextAlign() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setTextAlign( sal_Int32 nTextAlign ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTextLength() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
// Methods
virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index ed9f83a7c647..780191885049 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -43,8 +43,8 @@
#ifdef VBA_OOBUILD_HACK
#include <svtools/bindablecontrolhelper.hxx>
#endif
-#include"vbacontrol.hxx"
-#include"vbacombobox.hxx"
+#include "vbacontrol.hxx"
+#include "vbacombobox.hxx"
#include "vbabutton.hxx"
#include "vbalabel.hxx"
#include "vbatextbox.hxx"
@@ -397,99 +397,104 @@ void SAL_CALL ScVbaControl::setTag( const ::rtl::OUString& aTag )
m_aControlTag = aTag;
}
-
-//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 )
+sal_Int32 SAL_CALL ScVbaControl::getTabIndex() throw (uno::RuntimeException)
{
+ return 1;
}
-ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException)
+void SAL_CALL ScVbaControl::setTabIndex( sal_Int32 /*nTabIndex*/ ) throw (uno::RuntimeException)
{
- uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
- if ( xControlShape.is() ) // form controls
- return createControl( xControlShape, xParent );
- uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY );
- if ( !xControl.is() )
- throw uno::RuntimeException(); // really we should be more informative
- return createControl( xControl, xParent );
}
-ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< uno::XInterface >& /*xParent*/ ) throw (uno::RuntimeException)
+//ScVbaControlFactory
+
+/*static*/ uno::Reference< msforms::XControl > ScVbaControlFactory::createShapeControl(
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< drawing::XControlShape >& xControlShape,
+ const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
{
uno::Reference< beans::XPropertySet > xProps( xControlShape->getControl(), uno::UNO_QUERY_THROW );
sal_Int32 nClassId = -1;
const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
xProps->getPropertyValue( sClassId ) >>= nClassId;
uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
+ uno::Reference< drawing::XShape > xShape( xControlShape, uno::UNO_QUERY_THROW );
+ ::std::auto_ptr< ConcreteXShapeGeometryAttributes > xGeoHelper( new ConcreteXShapeGeometryAttributes( xContext, xShape ) );
+
switch( nClassId )
{
case form::FormComponentType::COMBOBOX:
- return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaComboBox( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::COMMANDBUTTON:
- return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaButton( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::FIXEDTEXT:
- return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaLabel( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::TEXTFIELD:
- return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaTextBox( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::RADIOBUTTON:
- return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaRadioButton( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::LISTBOX:
- return new ScVbaListBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaListBox( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::SPINBUTTON:
- return new ScVbaSpinButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ return new ScVbaSpinButton( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
case form::FormComponentType::IMAGECONTROL:
- return new ScVbaImage( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
- default:
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Donot support this Control Type." ), uno::Reference< uno::XInterface >() );
+ return new ScVbaImage( xVbaParent, xContext, xControlShape, xModel, xGeoHelper.release() );
}
+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control." ), uno::Reference< uno::XInterface >() );
}
-ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< uno::XInterface >& xParent ) throw (uno::RuntimeException)
+/*static*/ uno::Reference< msforms::XControl > ScVbaControlFactory::createUserformControl(
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< awt::XControl >& xControl,
+ const uno::Reference< awt::XControl >& xDialog,
+ const uno::Reference< frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY ) throw (uno::RuntimeException)
{
uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
uno::Reference< lang::XServiceInfo > xServiceInfo( xProps, uno::UNO_QUERY_THROW );
- ScVbaControl* pControl = NULL;
+ uno::Reference< msforms::XControl > xVBAControl;
uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
+ ::std::auto_ptr< UserFormGeometryHelper > xGeoHelper( new UserFormGeometryHelper( xContext, xControl, fOffsetX, fOffsetY ) );
+
if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
- pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaCheckbox( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
- pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaRadioButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
- pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
+ xVBAControl.set( new ScVbaTextBox( xVbaParent, xContext, xControl, xModel, xGeoHelper.release(), true ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
{
sal_Bool bToggle = sal_False;
xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
if ( bToggle )
- pControl = new ScVbaToggleButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaToggleButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else
- pControl = new ScVbaButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
}
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) ) )
- pControl = new ScVbaComboBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
+ xVBAControl.set( new ScVbaComboBox( xVbaParent, xContext, xControl, xModel, xGeoHelper.release(), true ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
- pControl = new ScVbaListBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaListBox( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
- pControl = new ScVbaLabel( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaLabel( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) ) )
- pControl = new ScVbaImage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaImage( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
- pControl = new ScVbaProgressBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaProgressBar( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
- pControl = new ScVbaFrame( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaFrame( xVbaParent, xContext, xControl, xModel, xGeoHelper.release(), xDialog ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) ) )
- pControl = new ScVbaScrollBar( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaScrollBar( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
- pControl = new ScVbaMultiPage( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), xParent );
+ xVBAControl.set( new ScVbaMultiPage( xVbaParent, xContext, xControl, xModel, xGeoHelper.release(), xDialog ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
- pControl = new ScVbaSpinButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ xVBAControl.set( new ScVbaSpinButton( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.custom.awt.UnoControlSystemAXContainerModel") ) ) )
- pControl = new VbaSystemAXControl( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
- else
- throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control " ), uno::Reference< uno::XInterface >() );
- return pControl;
+ xVBAControl.set( new VbaSystemAXControl( xVbaParent, xContext, xControl, xModel, xGeoHelper.release() ) );
+
+ if( xVBAControl.is() )
+ return xVBAControl;
+ throw uno::RuntimeException( rtl::OUString::createFromAscii("Unsupported control." ), uno::Reference< uno::XInterface >() );
}
rtl::OUString&
@@ -520,7 +525,6 @@ class ControlProviderImpl : public ControlProvider_BASE
public:
ControlProviderImpl( const uno::Reference< uno::XComponentContext >& xCtx ) : m_xCtx( xCtx ) {}
virtual uno::Reference< msforms::XControl > SAL_CALL createControl( const uno::Reference< drawing::XControlShape >& xControl, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
- virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
};
uno::Reference< msforms::XControl > SAL_CALL
@@ -528,27 +532,10 @@ ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape
{
uno::Reference< msforms::XControl > xControlToReturn;
if ( xControlShape.is() )
- {
- ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner );
- xControlToReturn.set( controlFactory.createControl( xDocOwner ) );
- }
+ xControlToReturn = ScVbaControlFactory::createShapeControl( m_xCtx, xControlShape, xDocOwner );
return xControlToReturn;
}
-uno::Reference< msforms::XControl > SAL_CALL
-ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
-{
- uno::Reference< msforms::XControl > xControlToReturn;
- if ( xControl.is() && xDialog.is() )
- {
-
- ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner );
- xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) );
- ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xControlToReturn.get() );
- pControl->setGeometryHelper( new UserFormGeometryHelper( m_xCtx, xControl ) );
- }
- return xControlToReturn;
-}
namespace controlprovider
{
diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx
index 247eabfe95e8..e421f919b6a4 100644
--- a/vbahelper/source/msforms/vbacontrol.hxx
+++ b/vbahelper/source/msforms/vbacontrol.hxx
@@ -93,6 +93,8 @@ public:
virtual void SAL_CALL setControlTipText( const rtl::OUString& ) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getTag() throw (css::uno::RuntimeException);
virtual void SAL_CALL setTag( const ::rtl::OUString& aTag ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTabIndex() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setTabIndex( sal_Int32 nTabIndex ) 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
@@ -104,15 +106,21 @@ public:
class ScVbaControlFactory
{
public:
- ScVbaControlFactory( const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel );
- ScVbaControl* createControl( const css::uno::Reference< css::uno::XInterface >& xParent ) throw ( css::uno::RuntimeException );
+ static css::uno::Reference< ov::msforms::XControl > createShapeControl(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::drawing::XControlShape >& xControlShape,
+ const css::uno::Reference< css::frame::XModel >& xModel ) throw (css::uno::RuntimeException);
+
+ static css::uno::Reference< ov::msforms::XControl > createUserformControl(
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::awt::XControl >& xControl,
+ const css::uno::Reference< css::awt::XControl >& xDialog,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY ) throw (css::uno::RuntimeException);
+
private:
- ScVbaControl* createControl( const css::uno::Reference< css::awt::XControl >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
- ScVbaControl* createControl( const css::uno::Reference< css::drawing::XControlShape >&, const css::uno::Reference< css::uno::XInterface >& ) throw ( css::uno::RuntimeException );
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::uno::XInterface > m_xControl;
- css::uno::Reference< css::frame::XModel > m_xModel;
+ ScVbaControlFactory();
+ ~ScVbaControlFactory();
};
#endif//SC_VBA_CONTROL_HXX
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index 8d01687ef905..7411f7ad9463 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -27,13 +27,18 @@
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/lang/WrappedTargetException.hpp>
#include "vbacontrols.hxx"
+#include "vbacontrol.hxx"
#include <cppuhelper/implbase2.hxx>
-#include <ooo/vba//XControlProvider.hpp>
+#include <ooo/vba/XControlProvider.hpp>
#include <hash_map>
using namespace com::sun::star;
@@ -153,11 +158,28 @@ class ControlsEnumWrapper : public EnumerationHelper_BASE
uno::Reference<uno::XComponentContext > m_xContext;
uno::Reference<container::XIndexAccess > m_xIndexAccess;
uno::Reference<awt::XControl > m_xDlg;
+ uno::Reference< frame::XModel > m_xModel;
+ double mfOffsetX;
+ double mfOffsetY;
sal_Int32 nIndex;
public:
- ControlsEnumWrapper( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< awt::XControl >& xDlg ) : m_xParent( xParent ), m_xContext( xContext), m_xIndexAccess( xIndexAccess ), m_xDlg( xDlg ), nIndex( 0 ) {}
+ ControlsEnumWrapper(
+ const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< container::XIndexAccess >& xIndexAccess,
+ const uno::Reference< awt::XControl >& xDlg,
+ const uno::Reference< frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY ) :
+ m_xParent( xParent ),
+ m_xContext( xContext),
+ m_xIndexAccess( xIndexAccess ),
+ m_xDlg( xDlg ),
+ m_xModel( xModel ),
+ mfOffsetX( fOffsetX ),
+ mfOffsetY( fOffsetY ),
+ nIndex( 0 ) {}
virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException)
{
@@ -168,14 +190,12 @@ public:
{
if ( nIndex < m_xIndexAccess->getCount() )
{
- uno::Reference< frame::XModel > xModel;
uno::Reference< awt::XControl > xControl;
m_xIndexAccess->getByIndex( nIndex++ ) >>= xControl;
- uno::Reference<lang::XMultiComponentFactory > xServiceManager( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
- uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), m_xContext ), uno::UNO_QUERY_THROW );
-
- uno::Reference< msforms::XControl > xVBAControl( xControlProvider->createUserformControl( xControl, m_xDlg, xModel ) );
+ uno::Reference< msforms::XControl > xVBAControl;
+ if ( xControl.is() && m_xDlg.is() )
+ xVBAControl = ScVbaControlFactory::createUserformControl( m_xContext, xControl, m_xDlg, m_xModel, mfOffsetX, mfOffsetY );
return uno::makeAny( xVBAControl );
}
throw container::NoSuchElementException();
@@ -190,17 +210,24 @@ lcl_controlsWrapper( const uno::Reference< awt::XControl >& xDlg )
return new ControlArrayWrapper( xDlg );
}
-ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext,
- const css::uno::Reference< awt::XControl >& xDialog )
- : ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) )
+ScVbaControls::ScVbaControls(
+ const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const css::uno::Reference< awt::XControl >& xDialog,
+ const uno::Reference< frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY ) :
+ ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) ),
+ mxDialog( xDialog ),
+ mxModel( xModel ),
+ mfOffsetX( fOffsetX ),
+ mfOffsetY( fOffsetY )
{
- mxDialog.set( xDialog, uno::UNO_QUERY );
}
uno::Reference< container::XEnumeration >
ScVbaControls::createEnumeration() throw (uno::RuntimeException)
{
- uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog ) );
+ uno::Reference< container::XEnumeration > xEnum( new ControlsEnumWrapper( mxParent, mxContext, m_xIndexAccess, mxDialog, mxModel, mfOffsetX, mfOffsetY ) );
if ( !xEnum.is() )
throw uno::RuntimeException();
return xEnum;
@@ -210,15 +237,9 @@ uno::Any
ScVbaControls::createCollectionObject( const css::uno::Any& aSource )
{
// Create control from awt::XControl
- uno::Reference< awt::XControl > xControl;
- aSource >>= xControl;
- uno::Reference< frame::XModel > xModel;
- 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 > xVBAControl( xControlProvider->createUserformControl( xControl, mxDialog, xModel ) );
-
- return uno::makeAny( xVBAControl );
+ uno::Reference< awt::XControl > xControl( aSource, uno::UNO_QUERY_THROW );
+ uno::Reference< msforms::XControl > xVBAControl = ScVbaControlFactory::createUserformControl( mxContext, xControl, mxDialog, mxModel, mfOffsetX, mfOffsetY );
+ return uno::Any( xVBAControl );
}
void SAL_CALL
@@ -261,23 +282,117 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
aNewName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Control" ) );
sal_Int32 nInd = 0;
- while( xDialogContainer->hasByName( aNewName ) && nInd < SAL_MAX_INT32 )
+ while( xDialogContainer->hasByName( aNewName ) && (nInd < SAL_MAX_INT32) )
{
aNewName = aComServiceName;
- aNewName += ::rtl::OUString::valueOf( nInd );
+ aNewName += ::rtl::OUString::valueOf( nInd++ );
}
}
+ double fDefWidth = 72.0, fDefHeight = 18.0;
if ( aComServiceName.getLength() )
{
- uno::Reference< awt::XControlModel > xNewModel( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.custom.awt.UnoControlSystemAXContainerModel" ) ) ), uno::UNO_QUERY_THROW );
+ // create a UNO control model based on the passed control type
+ uno::Reference< awt::XControlModel > xNewModel;
+ bool bFontSupport = false;
+ bool bNativeAX = false;
+ if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.CommandButton.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 24.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.Label.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedTextModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.Image.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlImageControlModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 72.0;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.CheckBox.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCheckBoxModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 108.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.OptionButton.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlRadioButtonModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 108.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.TextBox.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlEditModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.ListBox.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlListBoxModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.ComboBox.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlComboBoxModel" ) ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xProps( xNewModel, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dropdown" ) ), uno::Any( true ) );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.ToggleButton.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" ) ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xProps( xNewModel, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Toggle" ) ), uno::Any( true ) );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.Frame.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlGroupBoxModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 216.0; fDefHeight = 144.0;
+ bFontSupport = true;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.SpinButton.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlSpinButtonModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 12.75; fDefHeight = 25.5;
+ }
+ else if( aComServiceName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "Forms.ScrollBar.1" ) ) )
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlScrollBarModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 12.75; fDefHeight = 63.8;
+ }
+ else
+ {
+ xNewModel.set( xModelFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.custom.awt.UnoControlSystemAXContainerModel" ) ) ), uno::UNO_QUERY_THROW );
+ fDefWidth = 72.0; fDefHeight = 18.0;
+ bNativeAX = true;
+ }
+ // need to set a few font properties to get rid of the default DONT_KNOW values
+ if( bFontSupport )
+ {
+ uno::Reference< beans::XPropertySet > xModelProps( xNewModel, uno::UNO_QUERY_THROW );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontName" ) ), uno::Any( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Tahoma" ) ) ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontHeight" ) ), uno::Any( float( 8.0 ) ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) ), uno::Any( awt::FontWeight::NORMAL ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontSlant" ) ), uno::Any( awt::FontSlant_NONE ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontUnderline" ) ), uno::Any( awt::FontUnderline::NONE ) );
+ xModelProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontStrikeout" ) ), uno::Any( awt::FontStrikeout::NONE ) );
+ }
xDialogContainer->insertByName( aNewName, uno::makeAny( xNewModel ) );
uno::Reference< awt::XControlContainer > xControlContainer( mxDialog, uno::UNO_QUERY_THROW );
xNewControl = xControlContainer->getControl( aNewName );
- try
+ if( bNativeAX ) try
{
uno::Reference< script::XInvocation > xControlInvoke( xNewControl, uno::UNO_QUERY_THROW );
@@ -299,6 +414,11 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
UpdateCollectionIndex( lcl_controlsWrapper( mxDialog ) );
aResult <<= xNewControl;
aResult = createCollectionObject( aResult );
+ uno::Reference< msforms::XControl > xVBAControl( aResult, uno::UNO_QUERY_THROW );
+ if( fDefWidth > 0.0 )
+ xVBAControl->setWidth( fDefWidth );
+ if( fDefHeight > 0.0 )
+ xVBAControl->setHeight( fDefHeight );
}
else
throw uno::RuntimeException();
@@ -376,21 +496,5 @@ ScVbaControls::getElementType() throw (uno::RuntimeException)
{
return ooo::vba::msforms::XControl::static_type(0);
}
-rtl::OUString&
-ScVbaControls::getServiceImplName()
-{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControls") );
- return sImplName;
-}
-uno::Sequence< rtl::OUString >
-ScVbaControls::getServiceNames()
-{
- static uno::Sequence< rtl::OUString > aServiceNames;
- if ( aServiceNames.getLength() == 0 )
- {
- aServiceNames.realloc( 1 );
- aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Controls" ) );
- }
- return aServiceNames;
-}
+VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaControls, "ooo.vba.msforms.Controls" )
diff --git a/vbahelper/source/msforms/vbacontrols.hxx b/vbahelper/source/msforms/vbacontrols.hxx
index a72506609531..4b4838a45a8e 100644
--- a/vbahelper/source/msforms/vbacontrols.hxx
+++ b/vbahelper/source/msforms/vbacontrols.hxx
@@ -38,19 +38,17 @@ typedef CollTestImplHelper< ov::msforms::XControls > ControlsImpl_BASE;
class ScVbaControls : public ControlsImpl_BASE
{
- css::uno::Reference< css::awt::XControl > mxDialog;
-
-protected:
- virtual rtl::OUString& getServiceImplName();
- virtual css::uno::Sequence<rtl::OUString> getServiceNames();
-
public:
- ScVbaControls( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::awt::XControl >& xDialog );
+ ScVbaControls(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::awt::XControl >& xDialog,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ double fOffsetX, double fOffsetY );
// XControls
virtual void SAL_CALL Move( double cx, double cy ) throw (css::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL Add( const ::com::sun::star::uno::Any& Object, const ::com::sun::star::uno::Any& StringKey, const ::com::sun::star::uno::Any& Before, const ::com::sun::star::uno::Any& After ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL Remove( const ::com::sun::star::uno::Any& StringKeyOrIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Object, const css::uno::Any& StringKey, const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Remove( const css::uno::Any& StringKeyOrIndex ) throw (css::uno::RuntimeException);
// XEnumerationAccess
virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
@@ -59,6 +57,15 @@ public:
// ScVbaCollectionBaseImpl
virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource );
+ // XHelperInterface
+ VBAHELPER_DECL_XHELPERINTERFACE
+
+private:
+ css::uno::Reference< css::awt::XControl > mxDialog;
+ css::uno::Reference< css::frame::XModel > mxModel;
+ double mfOffsetX;
+ double mfOffsetY;
};
+
#endif //SC_VBA_OLEOBJECTS_HXX
diff --git a/vbahelper/source/msforms/vbaframe.cxx b/vbahelper/source/msforms/vbaframe.cxx
index c470ee0097e4..4a1fe6a58b49 100644
--- a/vbahelper/source/msforms/vbaframe.cxx
+++ b/vbahelper/source/msforms/vbaframe.cxx
@@ -24,62 +24,83 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbaframe.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
+#include "vbacontrols.hxx"
+#include <ooo/vba/msforms/fmBorderStyle.hpp>
+#include <ooo/vba/msforms/fmSpecialEffect.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
const static rtl::OUString LABEL( RTL_CONSTASCII_USTRINGPARAM("Label") );
-ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper ) : FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
+
+ScVbaFrame::ScVbaFrame(
+ const uno::Reference< XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< uno::XInterface >& xControl,
+ const uno::Reference< frame::XModel >& xModel,
+ ov::AbstractGeometryAttributes* pGeomHelper,
+ const css::uno::Reference< css::awt::XControl >& xDialog ) :
+ FrameImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ),
+ mxDialog( xDialog )
{
}
-// Attributes
-rtl::OUString SAL_CALL
-ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
+// XFrame attributes
+
+rtl::OUString SAL_CALL ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
{
rtl::OUString Label;
m_xProps->getPropertyValue( LABEL ) >>= Label;
return Label;
}
-void SAL_CALL
-ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
{
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
}
-uno::Any SAL_CALL
-ScVbaFrame::getValue() throw (css::uno::RuntimeException)
+sal_Int32 SAL_CALL ScVbaFrame::getSpecialEffect() throw (uno::RuntimeException)
{
- return uno::makeAny( getCaption() );
+ return msforms::fmSpecialEffect::fmSpecialEffectEtched;
}
-void SAL_CALL
-ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
+void SAL_CALL ScVbaFrame::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException)
{
- rtl::OUString sCaption;
- _value >>= sCaption;
- setCaption( sCaption );
}
-rtl::OUString&
-ScVbaFrame::getServiceImplName()
+sal_Int32 SAL_CALL ScVbaFrame::getBorderStyle() throw (uno::RuntimeException)
{
- static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") );
- return sImplName;
+ return msforms::fmBorderStyle::fmBorderStyleNone;
}
-uno::Sequence< rtl::OUString >
-ScVbaFrame::getServiceNames()
+void SAL_CALL ScVbaFrame::setBorderStyle( sal_Int32 /*nBorderStyle*/ ) 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.msforms.Frame" ) );
- }
- return aServiceNames;
}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaFrame::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
+// XFrame methods
+
+uno::Any SAL_CALL ScVbaFrame::Controls( const uno::Any& rIndex ) throw (uno::RuntimeException)
+{
+ // horizontal anchor of frame children is inside border line (add one unit to compensate border line width)
+ double fOffsetX = mpGeometryHelper->getOffsetX() + getLeft() + 1.0;
+ // vertical anchor of frame children is inside border line (add half of text height and one unit to compensate border line width)
+ double fOffsetY = mpGeometryHelper->getOffsetY() + getTop() + (getFont()->getSize() / 2.0) + 1.0;
+
+ uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, mxDialog, m_xModel, fOffsetX, fOffsetY ) );
+ if( rIndex.hasValue() )
+ return uno::Any( xControls->Item( rIndex, uno::Any() ) );
+ return uno::Any( xControls );
+}
+
+// XHelperInterface
+
+VBAHELPER_IMPL_XHELPERINTERFACE( ScVbaFrame, "ooo.vba.msforms.Frame" )
diff --git a/vbahelper/source/msforms/vbaframe.hxx b/vbahelper/source/msforms/vbaframe.hxx
index 567e58b57272..d76f31230bba 100644
--- a/vbahelper/source/msforms/vbaframe.hxx
+++ b/vbahelper/source/msforms/vbaframe.hxx
@@ -27,24 +27,39 @@
#ifndef SC_VBA_FRAME_HXX
#define SC_VBA_FRAME_HXX
#include <cppuhelper/implbase1.hxx>
-#include <ooo/vba/msforms/XLabel.hpp>
+#include <ooo/vba/msforms/XFrame.hpp>
#include "vbacontrol.hxx"
#include <vbahelper/vbahelper.hxx>
-typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XLabel > FrameImpl_BASE;
+typedef cppu::ImplInheritanceHelper1< ScVbaControl, ov::msforms::XFrame > FrameImpl_BASE;
class ScVbaFrame : public FrameImpl_BASE
{
public:
- ScVbaFrame( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper );
- // Attributes
- virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
+ ScVbaFrame(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::uno::XInterface >& xControl,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ ov::AbstractGeometryAttributes* pGeomHelper,
+ const css::uno::Reference< css::awt::XControl >& xDialog );
+
+ // XFrame attributes
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSpecialEffect() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSpecialEffect( sal_Int32 nSpecialEffect ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBorderStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBorderStyle( sal_Int32 nBorderStyle ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
+ // XFrame methods
+ css::uno::Any SAL_CALL Controls( const css::uno::Any& rIndex ) throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
+
+private:
+ css::uno::Reference< css::awt::XControl > mxDialog;
};
#endif //SC_VBA_LABEL_HXX
diff --git a/vbahelper/source/msforms/vbalabel.cxx b/vbahelper/source/msforms/vbalabel.cxx
index 9bf7a7e001bf..d5aa1176e3d3 100644
--- a/vbahelper/source/msforms/vbalabel.cxx
+++ b/vbahelper/source/msforms/vbalabel.cxx
@@ -24,8 +24,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbalabel.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
using namespace com::sun::star;
using namespace ooo::vba;
@@ -64,6 +65,10 @@ ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
setCaption( sCaption );
}
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaLabel::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
rtl::OUString&
ScVbaLabel::getServiceImplName()
diff --git a/vbahelper/source/msforms/vbalabel.hxx b/vbahelper/source/msforms/vbalabel.hxx
index af3bc074c54d..2dcee186d58b 100644
--- a/vbahelper/source/msforms/vbalabel.hxx
+++ b/vbahelper/source/msforms/vbalabel.hxx
@@ -44,6 +44,7 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx
index 17f8c8341588..8829c8ae7256 100644
--- a/vbahelper/source/msforms/vbalistbox.cxx
+++ b/vbahelper/source/msforms/vbalistbox.cxx
@@ -24,12 +24,12 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
#include "vbalistbox.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
#include <comphelper/anytostring.hxx>
#include <com/sun/star/script/ArrayWrapper.hpp>
+#include <com/sun/star/form/validation/XValidatableFormComponent.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -267,6 +267,11 @@ ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) t
return mpListHelper->List( pvargIndex, pvarColumn );
}
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaListBox::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaListBox::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx
index 3d0797e2b7b2..7dbda1837cb0 100644
--- a/vbahelper/source/msforms/vbalistbox.hxx
+++ b/vbahelper/source/msforms/vbalistbox.hxx
@@ -60,9 +60,10 @@ public:
virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
// Methods
+ virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
virtual void SAL_CALL AddItem( const css::uno::Any& pvargItem, const css::uno::Any& pvargIndex ) throw (css::uno::RuntimeException);
virtual void SAL_CALL removeItem( const css::uno::Any& index ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Clear( ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx
index b6587c9b2367..78590f0fd85b 100644
--- a/vbahelper/source/msforms/vbamultipage.cxx
+++ b/vbahelper/source/msforms/vbamultipage.cxx
@@ -68,9 +68,16 @@ ScVbaMultiPage::getPages( sal_Int32 nPages )
return new PagesImpl( nPages );
}
-ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, const uno::Reference< uno::XInterface >& xDialog ) : MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
+ScVbaMultiPage::ScVbaMultiPage(
+ const uno::Reference< ov::XHelperInterface >& xParent,
+ const uno::Reference< uno::XComponentContext >& xContext,
+ const uno::Reference< uno::XInterface >& xControl,
+ const uno::Reference< frame::XModel >& xModel,
+ AbstractGeometryAttributes* pGeomHelper,
+ const uno::Reference< awt::XControl >& xDialog ) :
+ MultiPageImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper )
{
- mxDialogProps.set( xDialog, uno::UNO_QUERY_THROW );
+ mxDialogProps.set( xDialog->getModel(), uno::UNO_QUERY_THROW );
// set dialog step to value of multipage pseudo model
setValue(getValue());
}
diff --git a/vbahelper/source/msforms/vbamultipage.hxx b/vbahelper/source/msforms/vbamultipage.hxx
index 4a54525cf95f..328a71b61592 100644
--- a/vbahelper/source/msforms/vbamultipage.hxx
+++ b/vbahelper/source/msforms/vbamultipage.hxx
@@ -42,7 +42,14 @@ class ScVbaMultiPage : public MultiPageImpl_BASE
css::uno::Reference< css::container::XIndexAccess > getPages( sal_Int32 nPages );
css::uno::Reference< css::beans::XPropertySet > mxDialogProps;
public:
- ScVbaMultiPage( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pGeomHelper, const css::uno::Reference< css::uno::XInterface >& xDialog );
+ ScVbaMultiPage(
+ const css::uno::Reference< ov::XHelperInterface >& xParent,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ const css::uno::Reference< css::uno::XInterface >& xControl,
+ const css::uno::Reference< css::frame::XModel >& xModel,
+ ov::AbstractGeometryAttributes* pGeomHelper,
+ const css::uno::Reference< css::awt::XControl >& xDialog );
+
// Attributes
virtual sal_Int32 SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue( sal_Int32 _value ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/msforms/vbanewfont.cxx b/vbahelper/source/msforms/vbanewfont.cxx
new file mode 100755
index 000000000000..f487b4e6919c
--- /dev/null
+++ b/vbahelper/source/msforms/vbanewfont.cxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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 <vbanewfont.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+// ============================================================================
+
+VbaNewFont::VbaNewFont(
+ const uno::Reference< XHelperInterface >& rxParent,
+ const uno::Reference< uno::XComponentContext >& rxContext,
+ const uno::Reference< beans::XPropertySet >& rxModelProps ) throw (uno::RuntimeException) :
+ VbaNewFont_BASE( rxParent, rxContext ),
+ mxProps( rxModelProps, uno::UNO_SET_THROW )
+{
+}
+
+// XNewFont attributes
+
+::rtl::OUString SAL_CALL VbaNewFont::getName() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontName" ) ) );
+ return aAny.get< ::rtl::OUString >();
+}
+
+void SAL_CALL VbaNewFont::setName( const ::rtl::OUString& rName ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontName" ) ),
+ uno::Any( rName ) );
+}
+
+double SAL_CALL VbaNewFont::getSize() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontHeight" ) ) );
+ return aAny.get< float >();
+}
+
+void SAL_CALL VbaNewFont::setSize( double fSize ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontHeight" ) ),
+ uno::Any( static_cast< float >( fSize ) ) );
+}
+
+sal_Int16 SAL_CALL VbaNewFont::getCharset() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontCharset" ) ) );
+ return rtl_getBestWindowsCharsetFromTextEncoding( static_cast< rtl_TextEncoding >( aAny.get< sal_Int16 >() ) );
+}
+
+void SAL_CALL VbaNewFont::setCharset( sal_Int16 nCharset ) throw (uno::RuntimeException)
+{
+ rtl_TextEncoding eFontEnc = RTL_TEXTENCODING_DONTKNOW;
+ if( (0 <= nCharset) && (nCharset <= SAL_MAX_UINT8) )
+ eFontEnc = rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( nCharset ) );
+ if( eFontEnc == RTL_TEXTENCODING_DONTKNOW )
+ throw uno::RuntimeException();
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontCharset" ) ),
+ uno::Any( static_cast< sal_Int16 >( eFontEnc ) ) );
+}
+
+sal_Int16 SAL_CALL VbaNewFont::getWeight() throw (uno::RuntimeException)
+{
+ return getBold() ? 700 : 400;
+}
+
+void SAL_CALL VbaNewFont::setWeight( sal_Int16 nWeight ) throw (uno::RuntimeException)
+{
+ setBold( nWeight >= 700 );
+}
+
+sal_Bool SAL_CALL VbaNewFont::getBold() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) ) );
+ return aAny.get< float >() > awt::FontWeight::NORMAL;
+}
+
+void SAL_CALL VbaNewFont::setBold( sal_Bool bBold ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontWeight" ) ),
+ uno::Any( bBold ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL ) );
+}
+
+sal_Bool SAL_CALL VbaNewFont::getItalic() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontSlant" ) ) );
+ return aAny.get< awt::FontSlant >() != awt::FontSlant_NONE;
+}
+
+void SAL_CALL VbaNewFont::setItalic( sal_Bool bItalic ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontSlant" ) ),
+ uno::Any( bItalic ? awt::FontSlant_ITALIC : awt::FontSlant_NONE ) );
+}
+
+sal_Bool SAL_CALL VbaNewFont::getUnderline() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontUnderline" ) ) );
+ return aAny.get< sal_Int16 >() != awt::FontUnderline::NONE;
+}
+
+void SAL_CALL VbaNewFont::setUnderline( sal_Bool bUnderline ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontUnderline" ) ),
+ uno::Any( bUnderline ? awt::FontUnderline::SINGLE : awt::FontUnderline::NONE ) );
+}
+
+sal_Bool SAL_CALL VbaNewFont::getStrikethrough() throw (uno::RuntimeException)
+{
+ uno::Any aAny = mxProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontStrikeout" ) ) );
+ return aAny.get< sal_Int16 >() != awt::FontStrikeout::NONE;
+}
+
+void SAL_CALL VbaNewFont::setStrikethrough( sal_Bool bStrikethrough ) throw (uno::RuntimeException)
+{
+ mxProps->setPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FontStrikeout" ) ),
+ uno::Any( bStrikethrough ? awt::FontStrikeout::SINGLE : awt::FontStrikeout::NONE ) );
+}
+
+// XHelperInterface
+
+VBAHELPER_IMPL_XHELPERINTERFACE( VbaNewFont, "ooo.vba.msforms.NewFont" )
+
+// ============================================================================
diff --git a/vbahelper/source/msforms/vbanewfont.hxx b/vbahelper/source/msforms/vbanewfont.hxx
new file mode 100755
index 000000000000..d59d5caa139c
--- /dev/null
+++ b/vbahelper/source/msforms/vbanewfont.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_MSFORMS_VBANEWFONT_HXX
+#define VBAHELPER_MSFORMS_VBANEWFONT_HXX
+
+#include <ooo/vba/msforms/XNewFont.hpp>
+#include <vbahelper/vbahelperinterface.hxx>
+
+// ============================================================================
+
+typedef InheritedHelperInterfaceImpl1< ov::msforms::XNewFont > VbaNewFont_BASE;
+
+class VbaNewFont : public VbaNewFont_BASE
+{
+public:
+ VbaNewFont(
+ const css::uno::Reference< ov::XHelperInterface >& rxParent,
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Reference< css::beans::XPropertySet >& rxModelProps ) throw (css::uno::RuntimeException);
+
+ // XNewFont attributes
+ virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const ::rtl::OUString& rName ) throw (css::uno::RuntimeException);
+ virtual double SAL_CALL getSize() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSize( double fSize ) throw (css::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getCharset() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setCharset( sal_Int16 nCharset ) throw (css::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getWeight() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setWeight( sal_Int16 nWeight ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getBold() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBold( sal_Bool bBold ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getItalic() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setItalic( sal_Bool bItalic ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getUnderline() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setUnderline( sal_Bool bUnderline ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getStrikethrough() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setStrikethrough( sal_Bool bStrikethrough ) throw (css::uno::RuntimeException);
+
+ // XHelperInterface
+ VBAHELPER_DECL_XHELPERINTERFACE
+
+private:
+ css::uno::Reference< css::beans::XPropertySet > mxProps;
+};
+
+// ============================================================================
+
+#endif
diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx
index 94d12c5823ba..12ee1ad8ae41 100644
--- a/vbahelper/source/msforms/vbaradiobutton.cxx
+++ b/vbahelper/source/msforms/vbaradiobutton.cxx
@@ -24,8 +24,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbaradiobutton.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
using namespace com::sun::star;
using namespace ooo::vba;
@@ -84,6 +85,11 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
}
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaRadioButton::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaRadioButton::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbaradiobutton.hxx b/vbahelper/source/msforms/vbaradiobutton.hxx
index a0de21ae5d0e..3da00eb0765e 100644
--- a/vbahelper/source/msforms/vbaradiobutton.hxx
+++ b/vbahelper/source/msforms/vbaradiobutton.hxx
@@ -42,6 +42,7 @@ public:
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue(const com::sun::star::uno::Any&) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx
index 2d83d41d77c3..b6aedcdceaf6 100644
--- a/vbahelper/source/msforms/vbatextbox.cxx
+++ b/vbahelper/source/msforms/vbatextbox.cxx
@@ -24,16 +24,16 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <com/sun/star/text/XTextRange.hpp>
#include "vbatextbox.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
+#include <com/sun/star/text/XTextRange.hpp>
+#include <ooo/vba/msforms/fmBorderStyle.hpp>
+#include <ooo/vba/msforms/fmSpecialEffect.hpp>
using namespace com::sun::star;
using namespace ooo::vba;
-
-
ScVbaTextBox::ScVbaTextBox( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< uno::XInterface >& xControl, const uno::Reference< frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper, bool bDialog ) : TextBoxImpl_BASE( xParent, xContext, xControl, xModel, pGeomHelper ), mbDialog( bDialog )
{
}
@@ -48,7 +48,8 @@ ScVbaTextBox::getValue() throw (css::uno::RuntimeException)
void SAL_CALL
ScVbaTextBox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
{
- rtl::OUString sVal = getAnyAsString( _value );
+ // booleans are converted to uppercase strings
+ rtl::OUString sVal = extractStringFromAny( _value, true );
setText( sVal );
}
@@ -114,6 +115,34 @@ ScVbaTextBox::setMultiline( sal_Bool _multiline ) throw (css::uno::RuntimeExcept
(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiLine" ) ), aValue);
}
+sal_Int32 SAL_CALL ScVbaTextBox::getSpecialEffect() throw (uno::RuntimeException)
+{
+ return msforms::fmSpecialEffect::fmSpecialEffectSunken;
+}
+
+void SAL_CALL ScVbaTextBox::setSpecialEffect( sal_Int32 /*nSpecialEffect*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaTextBox::getBorderStyle() throw (uno::RuntimeException)
+{
+ return msforms::fmBorderStyle::fmBorderStyleNone;
+}
+
+void SAL_CALL ScVbaTextBox::setBorderStyle( sal_Int32 /*nBorderStyle*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaTextBox::getTextLength() throw (uno::RuntimeException)
+{
+ return getText().getLength();
+}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaTextBox::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaTextBox::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbatextbox.hxx b/vbahelper/source/msforms/vbatextbox.hxx
index 0553e047488e..586bceb607a0 100644
--- a/vbahelper/source/msforms/vbatextbox.hxx
+++ b/vbahelper/source/msforms/vbatextbox.hxx
@@ -47,6 +47,12 @@ 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);
+ virtual sal_Int32 SAL_CALL getSpecialEffect() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setSpecialEffect( sal_Int32 nSpecialEffect ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBorderStyle() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBorderStyle( sal_Int32 nBorderStyle ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTextLength() throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
// XDefaultProperty
rtl::OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
//XHelperInterface
diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx
index 071651ff8a36..d1a3b40d6eb7 100644
--- a/vbahelper/source/msforms/vbatogglebutton.cxx
+++ b/vbahelper/source/msforms/vbatogglebutton.cxx
@@ -24,8 +24,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbatogglebutton.hxx"
-#include <vector>
+#include "vbanewfont.hxx"
using namespace com::sun::star;
using namespace ooo::vba;
@@ -79,6 +80,56 @@ ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExcepti
m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
}
+sal_Bool SAL_CALL ScVbaToggleButton::getAutoSize() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaToggleButton::setAutoSize( sal_Bool /*bAutoSize*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Bool SAL_CALL ScVbaToggleButton::getCancel() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaToggleButton::setCancel( sal_Bool /*bCancel*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Bool SAL_CALL ScVbaToggleButton::getDefault() throw (uno::RuntimeException)
+{
+ return sal_False;
+}
+
+void SAL_CALL ScVbaToggleButton::setDefault( sal_Bool /*bDefault*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaToggleButton::getBackColor() throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL ScVbaToggleButton::setBackColor( sal_Int32 /*nBackColor*/ ) throw (uno::RuntimeException)
+{
+}
+
+sal_Int32 SAL_CALL ScVbaToggleButton::getForeColor() throw (uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL ScVbaToggleButton::setForeColor( sal_Int32 /*nForeColor*/ ) throw (uno::RuntimeException)
+{
+}
+
+uno::Reference< msforms::XNewFont > SAL_CALL ScVbaToggleButton::getFont() throw (uno::RuntimeException)
+{
+ return new VbaNewFont( this, mxContext, m_xProps );
+}
+
rtl::OUString&
ScVbaToggleButton::getServiceImplName()
{
diff --git a/vbahelper/source/msforms/vbatogglebutton.hxx b/vbahelper/source/msforms/vbatogglebutton.hxx
index bfdd68d09642..d2bf4c6b7f17 100644
--- a/vbahelper/source/msforms/vbatogglebutton.hxx
+++ b/vbahelper/source/msforms/vbatogglebutton.hxx
@@ -43,9 +43,19 @@ public:
// Attributes
virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException);
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
-
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getAutoSize() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAutoSize( sal_Bool bAutoSize ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getCancel() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setCancel( sal_Bool bCancel ) throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL getDefault() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setDefault( sal_Bool bDefault ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackColor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setBackColor( sal_Int32 nBackColor ) throw (css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeColor() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setForeColor( sal_Int32 nForeColor ) throw (css::uno::RuntimeException);
+ virtual css::uno::Reference< ov::msforms::XNewFont > SAL_CALL getFont() throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 16bc97babd7d..3eb799205389 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -54,7 +54,7 @@ ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Refer
m_xDialog.set( m_xControl, uno::UNO_QUERY_THROW );
uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
- setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
+ setGeometryHelper( new UserFormGeometryHelper( xContext, xControl, 0.0, 0.0 ) );
}
ScVbaUserForm::~ScVbaUserForm()
@@ -105,18 +105,38 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException)
}
rtl::OUString SAL_CALL
-ScVbaUserForm::getCaption() throw (::com::sun::star::uno::RuntimeException)
+ScVbaUserForm::getCaption() throw (uno::RuntimeException)
{
rtl::OUString sCaption;
m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ) ) >>= sCaption;
return sCaption;
}
void
-ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
+ScVbaUserForm::setCaption( const ::rtl::OUString& _caption ) throw (uno::RuntimeException)
{
m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Title") ), uno::makeAny( _caption ) );
}
+double SAL_CALL ScVbaUserForm::getInnerWidth() throw (uno::RuntimeException)
+{
+ return mpGeometryHelper->getInnerWidth();
+}
+
+void SAL_CALL ScVbaUserForm::setInnerWidth( double fInnerWidth ) throw (uno::RuntimeException)
+{
+ mpGeometryHelper->setInnerWidth( fInnerWidth );
+}
+
+double SAL_CALL ScVbaUserForm::getInnerHeight() throw (uno::RuntimeException)
+{
+ return mpGeometryHelper->getInnerHeight();
+}
+
+void SAL_CALL ScVbaUserForm::setInnerHeight( double fInnerHeight ) throw (uno::RuntimeException)
+{
+ mpGeometryHelper->setInnerHeight( fInnerHeight );
+}
+
void SAL_CALL
ScVbaUserForm::Hide( ) throw (uno::RuntimeException)
{
@@ -202,13 +222,7 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW );
uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName );
if ( xControl.is() )
- {
- ScVbaControlFactory aFac( mxContext, xControl, m_xModel );
- uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
- ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
- pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
- aResult = uno::makeAny( xVBAControl );
- }
+ aResult <<= ScVbaControlFactory::createUserformControl( mxContext, xControl, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() );
}
return aResult;
@@ -225,7 +239,7 @@ ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
// if the dialog already closed we should do nothing, but the VBA will call methods of the Controls objects
// thus we have to provide a dummy object in this case
uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY );
- uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl ) );
+ uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() ) );
if ( index.hasValue() )
return uno::makeAny( xControls->Item( index, uno::Any() ) );
return uno::makeAny( xControls );
diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx
index 71e8b4f62aa9..1777a979b9f2 100644
--- a/vbahelper/source/msforms/vbauserform.hxx
+++ b/vbahelper/source/msforms/vbauserform.hxx
@@ -50,18 +50,22 @@ public:
// XUserForm
virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException);
- // XIntrospection
- 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);
virtual ::rtl::OUString SAL_CALL getCaption() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setCaption( const ::rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getInnerWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInnerWidth( double fInnerWidth ) throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getInnerHeight() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInnerHeight( double fInnerHeight ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL Hide( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL UnloadObject( ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL Controls( const css::uno::Any& index ) throw (css::uno::RuntimeException);
+ // XIntrospection
+ 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 ::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();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();