summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2011-10-06 09:53:49 +0100
committerNoel Power <noel.power@novell.com>2011-10-06 09:54:59 +0100
commit80b81a561ee92a2abed34f98ee25a0e3c4117326 (patch)
tree7960dce46fdb43cd3e017303cb852cd28baba44a /oox/source
parent1339a41fb01323d607b5313256f5f9702804b9eb (diff)
add hackery re. EditControls, FormattedField & ImageControls from msocximex
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/ole/olehelper.cxx33
1 files changed, 31 insertions, 2 deletions
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index fd4672ab5943..1ac4a5de5753 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/form/FormComponentType.hpp>
#include <com/sun/star/form/XFormsSupplier.hpp>
#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/awt/Size.hpp>
@@ -78,6 +79,7 @@ using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::container::XIndexContainer;
using ::com::sun::star::container::XNameContainer;
using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::lang::XServiceInfo;
using namespace ::com::sun::star::form;
@@ -138,6 +140,7 @@ struct IdCntrlData
};
const sal_Int16 TOGGLEBUTTON = -1;
+const sal_Int16 FORMULAFIELD = -2;
typedef std::map< sal_Int16, GUIDCNamePair > GUIDCNamePairMap;
class classIdToGUIDCNamePairMap
@@ -196,6 +199,9 @@ classIdToGUIDCNamePairMap::classIdToGUIDCNamePairMap()
{ FormComponentType::PATTERNFIELD,
{ AX_GUID_TEXTBOX, "TextBox"},
},
+ { FORMULAFIELD,
+ { AX_GUID_TEXTBOX, "TextBox"},
+ },
{ FormComponentType::IMAGEBUTTON,
{ AX_GUID_COMMANDBUTTON, "CommandButton"},
},
@@ -501,14 +507,37 @@ OleFormCtrlExportHelper::OleFormCtrlExportHelper( const Reference< XComponentCo
PropertySet aPropSet( mxControlModel );
if ( aPropSet.getProperty( nClassId, PROP_ClassId ) )
{
- // psuedo ripped from legacy msocximex
- if ( nClassId == FormComponentType::COMMANDBUTTON )
+ /* psuedo ripped from legacy msocximex:
+ "There is a truly horrible thing with EditControls and FormattedField
+ Controls, they both pretend to have an EDITBOX ClassId for compability
+ reasons, at some stage in the future hopefully there will be a proper
+ FormulaField ClassId rather than this piggybacking two controls onto the
+ same ClassId, cmc." - when fixed the fake FORMULAFIELD id entry
+ and definition above can be removed/replaced
+ */
+ if ( nClassId == FormComponentType::TEXTFIELD)
+ {
+ Reference< XServiceInfo > xInfo( xCntrlModel,
+ UNO_QUERY);
+ if (xInfo->
+ supportsService( CREATE_OUSTRING( "com.sun.star.form.component.FormattedField" ) ) )
+ nClassId = FORMULAFIELD;
+ }
+ else if ( nClassId == FormComponentType::COMMANDBUTTON )
{
bool bToggle = false;
aPropSet.getProperty( bToggle, PROP_Toggle );
if ( bToggle )
nClassId = TOGGLEBUTTON;
}
+ else if ( nClassId == FormComponentType::CONTROL )
+ {
+ Reference< XServiceInfo > xInfo( xCntrlModel,
+ UNO_QUERY);
+ if (xInfo->
+ supportsService(OUString( CREATE_OUSTRING( "com.sun.star.form.component.ImageControl" ) ) ) )
+ nClassId = FormComponentType::IMAGECONTROL;
+ }
GUIDCNamePairMap& cntrlMap = classIdToGUIDCNamePairMap::get();
GUIDCNamePairMap::iterator it = cntrlMap.find( nClassId );