summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter/inc/filter/msfilter/msocximex.hxx787
-rw-r--r--filter/inc/filter/msfilter/svdfppt.hxx6
-rw-r--r--filter/source/msfilter/msocximex.cxx2743
-rw-r--r--filter/source/msfilter/svdfppt.cxx14
-rw-r--r--oox/Library_oox.mk3
-rw-r--r--oox/inc/oox/helper/binaryoutputstream.hxx17
-rw-r--r--oox/inc/oox/ole/axbinaryreader.hxx43
-rw-r--r--oox/inc/oox/ole/axcontrol.hxx103
-rw-r--r--oox/inc/oox/ole/olehelper.hxx63
-rw-r--r--oox/source/helper/binaryoutputstream.cxx32
-rw-r--r--oox/source/ole/axbinaryreader.cxx70
-rw-r--r--oox/source/ole/axcontrol.cxx808
-rw-r--r--oox/source/ole/olehelper.cxx426
-rw-r--r--oox/source/token/properties.txt1
-rw-r--r--sc/source/filter/excel/xiescher.cxx7
-rw-r--r--sc/source/filter/inc/xiescher.hxx4
-rw-r--r--sc/source/filter/xcl97/xcl97esc.cxx1
-rw-r--r--sd/inc/pch/precompiled_sd.hxx1
-rw-r--r--sd/source/filter/eppt/eppt.cxx5
-rw-r--r--sd/source/filter/eppt/eppt.hxx1
-rw-r--r--sd/source/filter/eppt/epptso.cxx17
-rw-r--r--sd/source/filter/ppt/pptin.cxx13
-rw-r--r--sd/source/filter/ppt/pptin.hxx4
-rw-r--r--sw/inc/pch/precompiled_sw.hxx1
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx15
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx1
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx1
-rw-r--r--sw/source/filter/ww8/ww8par.hxx13
-rw-r--r--sw/source/filter/ww8/ww8par3.cxx1
-rw-r--r--sw/source/filter/ww8/ww8par4.cxx1
30 files changed, 1443 insertions, 3759 deletions
diff --git a/filter/inc/filter/msfilter/msocximex.hxx b/filter/inc/filter/msfilter/msocximex.hxx
index 98c2f676ac6b..7fa196afda12 100644
--- a/filter/inc/filter/msfilter/msocximex.hxx
+++ b/filter/inc/filter/msfilter/msocximex.hxx
@@ -30,15 +30,8 @@
#include <sot/storage.hxx>
#include <tools/debug.hxx>
-#include <com/sun/star/graphic/XGraphicObject.hpp>
-//!! no such defines in global namespaces - it will break other existing code that uses the same define!!
-//#ifndef C2U
-//#define C2U(cChar) rtl::OUString::createFromAscii(cChar)
-//#endif
#include "filter/msfilter/msfilterdllapi.h"
-#include <vector>
-#include <boost/unordered_map.hpp>
namespace com{namespace sun{namespace star{
namespace drawing{
@@ -69,49 +62,20 @@ namespace com{namespace sun{namespace star{
namespace uno{
class XComponentContext;
}
+ namespace frame{
+ class XModel;
+ }
}}}
-class OCX_Control;
class SfxObjectShell;
-class SwPaM;
class MSFILTER_DLLPUBLIC SvxMSConvertOCXControls
{
public:
- SvxMSConvertOCXControls( SfxObjectShell *pDSh,SwPaM *pP );
+ SvxMSConvertOCXControls( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
virtual ~SvxMSConvertOCXControls();
- //Reads a control from the given storage, constructed shape in pShapeRef
- virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1,
- com::sun::star::uno::Reference<
- com::sun::star::drawing::XShape > *pShapeRef=0,
- sal_Bool bFloatingCtrl=sal_False ) = 0;
-
-
-
- //Writes the given Uno Control into the given storage
-
- static sal_Bool WriteOCXStream(SotStorageRef &rSrc1,
- const com::sun::star::uno::Reference<
- com::sun::star::awt::XControlModel > &rControlModel,
- const com::sun::star::awt::Size& rSize,String &rName);
-
- //Excel has a nasty kludged mechanism for this, read
- //the comments in the source to follow it
- static sal_Bool WriteOCXExcelKludgeStream(SotStorageStreamRef& rContents,
- const com::sun::star::uno::Reference<
- com::sun::star::awt::XControlModel > &rControlModel,
- const com::sun::star::awt::Size &rSize, String &rName);
-
- //Generate an OCX converter based on the OLE2 name
- static OCX_Control *OCX_Factory(const String &rId);
-
- //Generate an OCX converter based on the StarOffice UNO id
- static OCX_Control *OCX_Factory( const com::sun::star::uno::Reference<
- com::sun::star::awt::XControlModel > &rControlModel,
- String &rId,String &rName);
-
virtual sal_Bool InsertControl(
const com::sun::star::uno::Reference<
com::sun::star::form::XFormComponent >& /*rFComp*/,
@@ -123,10 +87,6 @@ public:
/*begin: Backwards compatability with office 95 import, modify later*/
const com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory > & GetServiceFactory();
-
- sal_uInt16 GetEditNum() { return ++nEdit; }
- sal_uInt16 GetCheckboxNum() { return ++nCheckbox; }
- /*end: Backwards compatability*/
protected:
const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > &
GetShapes();
@@ -134,8 +94,7 @@ protected:
const com::sun::star::uno::Reference<
com::sun::star::container::XIndexContainer > & GetFormComps();
- SfxObjectShell *pDocSh;
- SwPaM *pPaM;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
// gecachte Interfaces
com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >
@@ -148,746 +107,10 @@ protected:
com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >
xFormComps;
- sal_uInt16 nEdit;
- sal_uInt16 nCheckbox;
-
virtual const com::sun::star::uno::Reference<
com::sun::star::drawing::XDrawPage > & GetDrawPage();
};
-class OCX_FontData
-{
-public:
- OCX_FontData() : nFontNameLen(0), fBold(0), fItalic(0), fUnderline(0),
- fStrike(0), nFontSize(12), nJustification(1), pFontName(0),
- bHasAlign(sal_False), bHasFont(sal_True) {}
- ~OCX_FontData() {
- if (pFontName)
- delete [] pFontName;
- }
-
- sal_Bool Export(SotStorageStreamRef &rContent,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet);
-
- sal_uInt16 nIdentifier;
- sal_uInt16 nFixedAreaLen;
- sal_uInt8 pBlockFlags[4];
-
- sal_uInt32 nFontNameLen;
-
- sal_uInt8 fBold:1;
- sal_uInt8 fItalic:1;
- sal_uInt8 fUnderline:1;
- sal_uInt8 fStrike:1;
- sal_uInt8 fUnknown1:4;
-
- sal_uInt8 nUnknown2;
- sal_uInt8 nUnknown3;
- sal_uInt8 nUnknown4;
-
- sal_uInt32 nFontSize;
- sal_uInt16 nLanguageID;
- sal_uInt8 nJustification;
- sal_uInt16 nFontWeight;
-
- char *pFontName;
- void SetHasAlign(sal_Bool bIn) {bHasAlign=bIn;}
- void SetHasFont(sal_Bool bIn) {bHasFont=bIn;}
-protected:
- static sal_uInt16 nStandardId;
- sal_uInt8 ExportAlign(sal_Int16 nAlign) const;
-private:
- sal_Bool bHasAlign;
- sal_Bool bHasFont;
-};
-
-class MSFILTER_DLLPUBLIC OCX_Control
-{
-public:
- OCX_Control(UniString sN, OCX_Control* parent = NULL ) : nWidth( 0 ), nHeight( 0 ), mnLeft(0), mnTop(0),
- mnStep(0), mnBackColor(0x8000000FL), mnForeColor(0), mnTabPos(0), mbVisible(true), sName(sN), pDocSh(0),
- bSetInDialog(sal_False), mpParent( parent ) {}
- //Export exports a control as an OLE style storage stream tree
- virtual sal_Bool Export(SotStorageRef& /*rObj*/,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet>& /*rPropSet*/,
- const com::sun::star::awt::Size& /*rSize*/) {return sal_False;}
-
- //WriteContents writes the contents of a contents stream, for
- //the Excel export you cannot use Export, only WriteContents instead
- virtual sal_Bool WriteContents(SotStorageStreamRef& /*rObj*/,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet>& /*rPropSet*/,
- const com::sun::star::awt::Size& /*rSize*/) {return sal_False;}
- void SetInDialog(bool bState) { bSetInDialog = bState; }
- bool GetInDialog() { return bSetInDialog; }
-
- virtual ~OCX_Control() {}
-
- static void FillSystemColors();
-
- sal_uInt32 nWidth;
- sal_uInt32 nHeight;
- sal_Int32 mnLeft;
- sal_Int32 mnTop;
- sal_Int32 mnStep;
- sal_Int32 mnBackColor;
- sal_Int32 mnForeColor;
- sal_uInt16 mnTabPos;
- bool mbVisible;
- UniString sName;
- UniString msToolTip;
- UniString msParentName;
- OCX_FontData aFontData;
- rtl::OUString msCtrlSource;
- rtl::OUString msRowSource;
- SfxObjectShell *pDocSh;
- ::rtl::OUString sImageUrl;
- com::sun::star::uno::Reference< com::sun::star::graphic::XGraphicObject> mxGrfObj;
-protected:
-
- sal_uInt32 ExportColor(sal_uInt32 nColorCode) const;
- sal_uInt32 SwapColor(sal_uInt32 nColorCode) const;
- sal_uInt8 ExportBorder(sal_uInt16 nBorder,sal_uInt8 &rBorderStyle) const;
- bool bSetInDialog;
- sal_uInt8 ExportSpecEffect( sal_Int16 nApiEffect ) const;
- static sal_uInt16 nStandardId;
- static sal_uInt8 const aObjInfo[4];
- rtl::OUString msFormType;
- rtl::OUString msDialogType;
- OCX_Control* mpParent;
-private:
- static sal_uInt32 pColor[25];
-};
-
-class OCX_ModernControl : public OCX_Control
-{
-public:
- OCX_ModernControl(UniString sN) : OCX_Control(sN),
- fEnabled(1), fLocked(0), fBackStyle(1), fColumnHeads(0), fIntegralHeight(1),
- fMatchRequired(0), fAlignment(1), fDragBehaviour(0), fEnterKeyBehaviour(0),
- fEnterFieldBehaviour(0), fTabKeyBehaviour(0), fWordWrap(1),
- fSelectionMargin(1), fAutoWordSelect(1), fAutoSize(0), fHideSelection(1),
- fAutoTab(0), fMultiLine(1), nMaxLength(0), nBorderStyle(0), nScrollBars(0),
- nStyle(0), nMousePointer(0), nPasswordChar(0), nListWidth(0),
- nBoundColumn(1), nTextColumn(-1), nColumnCount(1), nListRows(8),
- nMatchEntry(2), nListStyle(0), nShowDropButtonWhen(0), nDropButtonStyle(1),
- nMultiState(0), nValueLen(0), nCaptionLen(0), nVertPos(1), nHorzPos(7),
- nSpecialEffect(2), nIcon(0), nPicture(0), nAccelerator(0), nGroupNameLen(0),
- pValue(0), pCaption(0), pGroupName(0), nIconLen(0), pIcon(0),
- nPictureLen(0) {}
-
- ~OCX_ModernControl() {
- if (pValue) delete[] pValue;
- if (pCaption) delete[] pCaption;
- if (pGroupName) delete[] pGroupName;
- if (pIcon) delete[] pIcon;
- }
-
- /*sal_uInt8 for sal_uInt8 Word Struct*/
- sal_uInt16 nIdentifier;
- sal_uInt16 nFixedAreaLen;
- sal_uInt8 pBlockFlags[8];
-
- sal_uInt8 fUnknown1:1;
- sal_uInt8 fEnabled:1;
- sal_uInt8 fLocked:1;
- sal_uInt8 fBackStyle:1;
- sal_uInt8 fUnknown2:4;
-
- sal_uInt8 fUnknown3:2;
- sal_uInt8 fColumnHeads:1;
- sal_uInt8 fIntegralHeight:1;
- sal_uInt8 fMatchRequired:1;
- sal_uInt8 fAlignment:1;
- sal_uInt8 fUnknown4:2;
-
- sal_uInt8 fUnknown5:3;
- sal_uInt8 fDragBehaviour:1;
- sal_uInt8 fEnterKeyBehaviour:1;
- sal_uInt8 fEnterFieldBehaviour:1;
- sal_uInt8 fTabKeyBehaviour:1;
- sal_uInt8 fWordWrap:1;
-
- sal_uInt8 fUnknown6:2;
- sal_uInt8 fSelectionMargin:1;
- sal_uInt8 fAutoWordSelect:1;
- sal_uInt8 fAutoSize:1;
- sal_uInt8 fHideSelection:1;
- sal_uInt8 fAutoTab:1;
- sal_uInt8 fMultiLine:1;
-
- sal_uInt32 nMaxLength;
- sal_uInt8 nBorderStyle;
- sal_uInt8 nScrollBars;
- sal_uInt8 nStyle;
- sal_uInt8 nMousePointer;
- sal_uInt8 nUnknown7;
- sal_uInt8 nPasswordChar;
- sal_uInt32 nListWidth;
- sal_uInt16 nBoundColumn;
- sal_Int16 nTextColumn;
- sal_uInt16 nColumnCount;
- sal_uInt16 nListRows;
- sal_uInt16 nUnknown8;
- sal_uInt8 nMatchEntry;
- sal_uInt8 nListStyle;
- sal_uInt8 nShowDropButtonWhen;
- sal_uInt8 nDropButtonStyle;
- sal_uInt8 nMultiState;
- sal_uInt32 nValueLen;
- sal_uInt32 nCaptionLen;
-
- sal_uInt16 nVertPos;
- sal_uInt16 nHorzPos;
-
- sal_uInt32 nBorderColor;
- sal_uInt8 nSpecialEffect;
- sal_uInt16 nIcon;
- sal_uInt16 nPicture;
- sal_uInt8 nAccelerator;
- sal_uInt8 nUnknown9;
- sal_uInt32 nGroupNameLen;
- sal_uInt32 nUnknown10;
-
- char *pValue;
- char *pCaption;
- char *pGroupName;
-
- sal_uInt8 pIconHeader[20];
- sal_uInt32 nIconLen;
- sal_uInt8 *pIcon;
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-
-};
-
-class OCX_Image : public OCX_Control
-{
-public:
- OCX_Image() : OCX_Control(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Image" ))), fEnabled(1), fBackStyle(0), bPictureTiling(false), bAutoSize(false) {
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.DatabaseImageControl" ));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlImageControlModel" ));
- }
-
- ~OCX_Image() { }
- /*sal_uInt8 for sal_uInt8 Word Struct*/
- sal_uInt16 nIdentifier;
- sal_uInt16 nFixedAreaLen;
- sal_uInt8 pBlockFlags[4];
-
- sal_uInt32 nBorderColor;
- sal_uInt8 nBorderStyle;
- sal_uInt8 nMousePointer;
- sal_uInt8 nPictureSizeMode;
-
-
- sal_uInt8 fUnknown1:1;
- sal_uInt8 fEnabled:1;
- sal_uInt8 fUnknown2:2;
- sal_uInt8 fBackStyle:1;
- sal_uInt8 fUnknown3:3;
-
- sal_uInt8 nPictureAlignment;
- bool bPictureTiling;
- sal_uInt8 nSpecialEffect;
-
- bool bAutoSize;
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
-
- static OCX_Control *Create() { return new OCX_Image;}
-};
-class OCX_OptionButton;
-
-class OCX_CheckBox : public OCX_ModernControl
-{
-public:
- OCX_CheckBox() : OCX_ModernControl(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CheckBox" ))){
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.CheckBox" ));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlCheckBoxModel" ));
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- aFontData.SetHasAlign(sal_True);
- }
-
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- static OCX_Control *Create() { return new OCX_CheckBox;}
-};
-
-class OCX_OptionButton : public OCX_ModernControl
-{
-public:
- OCX_OptionButton() : OCX_ModernControl(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionButton" )))
- {
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.RadioButton" ));
- //msDialogType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel"));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.RadioButton" ));
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- aFontData.SetHasAlign(sal_True);
- }
-
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
-
-
- static OCX_Control *Create() { return new OCX_OptionButton;}
-};
-
-class OCX_TextBox : public OCX_ModernControl
-{
-public:
- OCX_TextBox() : OCX_ModernControl(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextBox" ))) {
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TextField" ));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlEditModel" ));
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- nBorderColor = 0x80000006L;
- aFontData.SetHasAlign(sal_True);
- }
-
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- static OCX_Control *Create() { return new OCX_TextBox;}
-};
-
-class OCX_FieldControl: public OCX_ModernControl
-{
-public:
- OCX_FieldControl() : OCX_ModernControl(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextBox" ))) {
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- nBorderColor = 0x80000006L;
- }
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- static OCX_Control *Create() { return new OCX_FieldControl;}
-};
-
-
-class OCX_ToggleButton : public OCX_ModernControl
-{
-public:
- OCX_ToggleButton() : OCX_ModernControl(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToggleButton" ))) {
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.CommandButton" ));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" ));
-
- mnBackColor = 0x8000000F;
- mnForeColor = 0x80000012;
- aFontData.SetHasAlign(sal_True);
- aFontData.nJustification = 3; // centered by default
- }
- static OCX_Control *Create() { return new OCX_ToggleButton;}
-
- sal_Bool Export(SvStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SvStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
-};
-
-class OCX_ComboBox : public OCX_ModernControl
-{
-public:
- OCX_ComboBox() : OCX_ModernControl(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ComboBox" ))){
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ComboBox" ));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ComboBox" ));
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
- aFontData.SetHasAlign(sal_True);
- }
- static OCX_Control *Create() { return new OCX_ComboBox;}
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
-};
-
-class OCX_ListBox : public OCX_ModernControl
-{
-public:
- OCX_ListBox() : OCX_ModernControl(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListBox" ))){
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ListBox" ));
- //msDialogType = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel"));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ListBox" ));
- mnBackColor = 0x80000005;
- mnForeColor = 0x80000008;
- nBorderColor = 0x80000006;
- aFontData.SetHasAlign(sal_True);
- }
- static OCX_Control *Create() { return new OCX_ListBox;}
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
-
-};
-
-class OCX_CommandButton : public OCX_Control
-{
-public:
- OCX_CommandButton() : OCX_Control(String::CreateFromAscii("CommandButton")),
- fEnabled(1), fLocked(0), fBackStyle(1), fWordWrap(0), fAutoSize(0),
- nCaptionLen(0), nVertPos(1), nHorzPos(7), nMousePointer(0), nPicture(0),
- nAccelerator(0), nIcon(0), pCaption(0), nIconLen(0), pIcon(0), nPictureLen(0),
- mbTakeFocus( true )
- {
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.CommandButton" ));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" ));
- mnForeColor = 0x80000012L;
- mnBackColor = 0x8000000FL;
- }
-
- ~OCX_CommandButton() {
- if (pCaption) delete[] pCaption;
- if (pIcon) delete[] pIcon;
- }
-
- /*sal_uInt8 for sal_uInt8 Word Struct*/
- sal_uInt16 nIdentifier;
- sal_uInt16 nFixedAreaLen;
- sal_uInt8 pBlockFlags[4];
-
-
- sal_uInt8 fUnknown1:1;
- sal_uInt8 fEnabled:1;
- sal_uInt8 fLocked:1;
- sal_uInt8 fBackStyle:1;
- sal_uInt8 fUnknown2:4;
-
- sal_uInt8 fUnknown3:8;
-
- sal_uInt8 fUnknown4:7;
- sal_uInt8 fWordWrap:1;
-
- sal_uInt8 fUnknown5:4;
- sal_uInt8 fAutoSize:1;
- sal_uInt8 fUnknown6:3;
-
- sal_uInt32 nCaptionLen;
-
- sal_uInt16 nVertPos;
- sal_uInt16 nHorzPos;
-
- sal_uInt16 nMousePointer;
- sal_uInt16 nPicture;
- sal_uInt16 nAccelerator;
- sal_uInt16 nIcon;
-
- char *pCaption;
-
- sal_uInt8 pIconHeader[20];
- sal_uInt32 nIconLen;
- sal_uInt8 *pIcon;
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-
- bool mbTakeFocus;
-
- static OCX_Control *Create() { return new OCX_CommandButton;}
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
-
-};
-
-class OCX_ImageButton: public OCX_CommandButton
-{
-public:
- OCX_ImageButton() {
- aFontData.SetHasAlign(sal_False);
- aFontData.SetHasFont(sal_False);
- }
- static OCX_Control *Create() { return new OCX_ImageButton;}
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
-
-};
-
-class OCX_GroupBox: public OCX_Control
-{
-public:
- OCX_GroupBox() : OCX_Control(String::CreateFromAscii("GroupBox")) {}
- static OCX_Control *Create() { return new OCX_GroupBox;}
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
-
-};
-
-class OCX_Label : public OCX_Control
-{
-public:
- OCX_Label(OCX_Control* pParent = NULL ) : OCX_Control(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Label" )), pParent ), fEnabled(1),
- fLocked(0),fBackStyle(1),fWordWrap(1),
- fAutoSize(0),nCaptionLen(0),nVertPos(1),nHorzPos(7),nMousePointer(0),
- nBorderColor(0x80000006),nBorderStyle(0),nSpecialEffect(0),
- nPicture(0),nAccelerator(0),nIcon(0),pCaption(0),nIconLen(0),pIcon(0),
- nPictureLen(0)
- {
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.FixedText" ));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedTextModel" ));
- mnForeColor = 0x80000008;
- mnBackColor = 0x80000005;
- aFontData.SetHasAlign(sal_True);
- }
-
- ~OCX_Label() {
- if (pCaption) delete[] pCaption;
- if (pIcon) delete[] pIcon;
- }
-
- /*sal_uInt8 for sal_uInt8 Word Struct*/
- sal_uInt16 nIdentifier;
- sal_uInt16 nFixedAreaLen;
- sal_uInt8 pBlockFlags[4];
-
-
- sal_uInt8 fUnknown1:1;
- sal_uInt8 fEnabled:1;
- sal_uInt8 fLocked:1;
- sal_uInt8 fBackStyle:1;
- sal_uInt8 fUnknown2:4;
-
- sal_uInt8 fUnknown3:8;
-
- sal_uInt8 fUnknown4:7;
- sal_uInt8 fWordWrap:1;
-
- sal_uInt8 fUnknown5:4;
- sal_uInt8 fAutoSize:1;
- sal_uInt8 fUnknown6:3;
-
- sal_uInt32 nCaptionLen;
- sal_uInt16 nVertPos;
- sal_uInt16 nHorzPos;
- sal_uInt8 nMousePointer;
- sal_uInt32 nBorderColor;
- sal_uInt16 nBorderStyle;
- sal_uInt16 nSpecialEffect;
- sal_uInt16 nPicture;
- sal_uInt16 nAccelerator;
- sal_uInt16 nIcon;
-
- char *pCaption;
-
- sal_uInt8 pIconHeader[20];
- sal_uInt32 nIconLen;
- sal_uInt8 *pIcon;
-
- sal_uInt8 pPictureHeader[20];
- sal_uInt32 nPictureLen;
-
- static OCX_Control *Create() { return new OCX_Label;}
-
- sal_Bool Export(SotStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
- sal_Bool WriteContents(SotStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize);
-
-};
-
-
-class OCX_ProgressBar : public OCX_Control
-{
-public:
- explicit OCX_ProgressBar();
-
- static OCX_Control* Create();
-
-private:
- sal_Int32 nMin;
- sal_Int32 nMax;
- bool bFixedSingle;
- bool bEnabled;
- bool b3d;
-};
-
-class OCX_SpinButton : public OCX_Control
-{
-public:
- explicit OCX_SpinButton();
-
- static OCX_Control* Create();
-
- //Export exports a control as an OLE style storage stream tree
- virtual sal_Bool Export( SvStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize );
-
- //WriteContents writes the contents of a contents stream, for
- //the Excel export you cannot use Export, only WriteContents instead
- virtual sal_Bool WriteContents( SvStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize );
-
-protected:
- void UpdateInt32Property(
- sal_Int32& rnCoreValue, sal_Int32 nNewValue,
- sal_Int32 nBlockFlag );
-
- void GetInt32Property(
- sal_Int32& rnCoreValue,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet >& rxPropSet,
- const rtl::OUString& rPropName,
- sal_Int32 nBlockFlag );
-
- void UpdateBoolProperty(
- bool& rbCoreValue, bool bNewValue,
- sal_Int32 nBlockFlag );
-
- void GetBoolProperty(
- bool& rbCoreValue,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet >& rxPropSet,
- const rtl::OUString& rPropName,
- sal_Int32 nBlockFlag );
-
- /** Writes the data from own members to stream. */
- sal_Bool WriteData( SvStream& rStrm ) const;
-
- sal_Int32 mnBlockFlags;
- sal_Int32 mnValue;
- sal_Int32 mnMin;
- sal_Int32 mnMax;
- sal_Int32 mnSmallStep;
- sal_Int32 mnPageStep;
- sal_Int32 mnOrient;
- sal_Int32 mnDelay;
- bool mbEnabled;
- bool mbLocked;
- bool mbPropThumb;
-};
-
-class OCX_ScrollBar : public OCX_SpinButton
-{
-public:
- explicit OCX_ScrollBar();
-
- static OCX_Control* Create();
-
- //Export exports a control as an OLE style storage stream tree
- virtual sal_Bool Export( SvStorageRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize );
-
- //WriteContents writes the contents of a contents stream, for
- //the Excel export you cannot use Export, only WriteContents instead
- virtual sal_Bool WriteContents( SvStorageStreamRef &rObj,
- const com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet> &rPropSet,
- const com::sun::star::awt::Size& rSize );
-};
-
-class HTML_Select : public OCX_ModernControl
-{
-public:
- HTML_Select() : OCX_ModernControl(rtl::OUString::createFromAscii("TextBox")) {
- msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
- msDialogType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox");
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- nBorderColor = 0x80000006L;
- aFontData.SetHasAlign(sal_True);
- fEnabled = true;
- nMultiState =false;
- }
-
- static OCX_Control *Create() { return new HTML_Select;}
-
- com::sun::star::uno::Sequence< rtl::OUString > msListData;
- com::sun::star::uno::Sequence< sal_Int16 > msIndices;
-};
-
-class HTML_TextBox : public OCX_ModernControl
-{
-public:
- HTML_TextBox() : OCX_ModernControl(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextBox" ))) {
- msFormType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.TextField" ));
- msDialogType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlEditModel" ));
- mnBackColor = 0x80000005L;
- mnForeColor = 0x80000008L;
- nBorderColor = 0x80000006L;
- aFontData.SetHasAlign(sal_True);
- }
-
- static OCX_Control *Create() { return new HTML_TextBox;}
-
-};
-
-
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx
index 3374699de3ba..6d2b8e0e8456 100644
--- a/filter/inc/filter/msfilter/svdfppt.hxx
+++ b/filter/inc/filter/msfilter/svdfppt.hxx
@@ -628,7 +628,7 @@ public:
sal_uInt32* pTableArry,
SvxMSDffSolverContainer*
);
- virtual bool ReadFormControl( com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& rxInStrm, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const = 0;
+ virtual bool ReadFormControl( SotStorageRef& rSrc1, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const = 0;
};
struct PPTTextCharacterStyleAtomInterpreter
@@ -1258,8 +1258,8 @@ class PPTConvertOCXControls : public SvxMSConvertOCXControls
com::sun::star::uno::Reference< com::sun::star::io::XInputStream > mxInStrm;
public :
- PPTConvertOCXControls( const SdrPowerPointImport* pPPTImporter, com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& rxInStrm, SfxObjectShell* pDSh, PptPageKind ePKind ) :
- SvxMSConvertOCXControls ( pDSh, NULL ),
+ PPTConvertOCXControls( const SdrPowerPointImport* pPPTImporter, com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& rxInStrm, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel, PptPageKind ePKind ) :
+ SvxMSConvertOCXControls ( rxModel ),
ePageKind ( ePKind ),
mpPPTImporter ( pPPTImporter ),
mxInStrm ( rxInStrm )
diff --git a/filter/source/msfilter/msocximex.cxx b/filter/source/msfilter/msocximex.cxx
index 4e65bb919e99..112157237edf 100644
--- a/filter/source/msfilter/msocximex.cxx
+++ b/filter/source/msfilter/msocximex.cxx
@@ -28,370 +28,42 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_filter.hxx"
-
-#include <com/sun/star/uno/Any.h>
-#include <com/sun/star/text/VertOrientation.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/text/TextContentAnchorType.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/form/XFormsSupplier.hpp>
#include <com/sun/star/form/XForm.hpp>
-#include <com/sun/star/form/binding/XBindableValue.hpp>
-#include <com/sun/star/form/binding/XValueBinding.hpp>
-#include <com/sun/star/form/binding/XListEntrySink.hpp>
-#include <com/sun/star/form/binding/XListEntrySource.hpp>
-#include <com/sun/star/form/FormComponentType.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
-#include <com/sun/star/awt/FontSlant.hpp>
-#include <com/sun/star/awt/FontUnderline.hpp>
-#include <com/sun/star/awt/FontStrikeout.hpp>
-#include <com/sun/star/awt/ScrollBarOrientation.hpp>
-#include <com/sun/star/style/VerticalAlignment.hpp>
-#include <comphelper/extract.hxx>
-#include <com/sun/star/awt/XControlModel.hpp>
-#include <com/sun/star/io/XInputStreamProvider.hpp>
-#include <rtl/ustrbuf.hxx>
-#include <vcl/svapp.hxx>
-#include <sfx2/objsh.hxx>
-#include <xmlscript/xmldlg_imexp.hxx>
#include <filter/msfilter/msocximex.hxx>
-#include <osl/file.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <comphelper/processfactory.hxx> // shouldn't be needed
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <algorithm>
-#include <memory>
-#include <com/sun/star/graphic/GraphicObject.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <comphelper/componentcontext.hxx>
-#include <unotools/streamwrap.hxx>
-#include <sal/macros.h>
-
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/sheet/XSpreadsheetView.hpp>
-#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
-#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
-// #TODO remove this when oox is used for control/userform import
-#include <com/sun/star/util/MeasureUnit.hpp>
-#include <com/sun/star/awt/XDevice.hpp>
-#include <com/sun/star/awt/XUnitConversion.hpp>
-
-#ifndef C2U
-#define C2U(cChar) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(cChar))
-#endif
using namespace ::com::sun::star;
using namespace ::rtl;
-using namespace cppu;
-
-static char sWW8_form[] = "WW-Standard";
-
-sal_uInt8 const OCX_Control::aObjInfo[4] = { 0x00, 0x12, 0x03, 0x00 };
-
-long WriteAlign(SvStorageStream *pS, int nAmount)
-{
- if (long nAlign = pS->Tell() % nAmount)
- {
- long nLen = nAmount - nAlign;
- for (long i=0; i< nLen; ++i)
- *pS << sal_uInt8(0x00);
- return nLen;
- }
- return 0;
-}
-// string import/export =======================================================
-/** #117832# import of form control names
-* control name is located in stream ("\3OCXNAME")
-* a strings in "\3OCXNAME" stream seem to be terminated by 4 trailing bytes of 0's.
-* ====
-* Note: If the string in the stream is overwritten by a shorter string
-* some characters from the original string may remain, the new string however
-* will still be terminated in the same way e.g. by 4 bytes with value 0.
-*/
-
-bool writeOCXNAME( const OUString& sOCXName, SvStorageStream* pStream )
-{
- const sal_Unicode* buffer = sOCXName.getStr();
- for ( sal_Int32 index=0; index < sOCXName.getLength(); index++ )
- {
- sal_uInt16 ch = static_cast< sal_uInt16 >( buffer[ index ] );
- *pStream << ch;
- }
- // write
- *pStream << sal_uInt32(0);
- return ( SVSTREAM_OK == pStream->GetError() );
-
-}
-
-namespace {
-
-const sal_uInt32 SVX_MSOCX_SIZEMASK = 0x7FFFFFFF; /// Mask for character buffer size.
-const sal_uInt32 SVX_MSOCX_COMPRESSED = 0x80000000; /// 1 = compressed Unicode array.
-
-
-/** Returns true, if the passed length field specifies a compressed character array.
- */
-inline bool lclIsCompressed( sal_uInt32 nLenFld )
-{
- return (nLenFld & SVX_MSOCX_COMPRESSED) != 0;
-}
-
-
-/** Extracts and returns the memory size of the character buffer.
- @return Character buffer size (may differ from resulting string length!).
- */
-inline sal_uInt32 lclGetBufferSize( sal_uInt32 nLenFld )
-{
- return nLenFld & SVX_MSOCX_SIZEMASK;
-}
-
-// export ---------------------------------------------------------------------
-
-/** This class implements writing a character array from a Unicode string.
-
- Usage:
- 1) Construct an instance, either directly with an OUString, or with an UNO
- Any containing an OUString.
- 2) Check with HasData(), if there is something to write.
- 3) Write the string length field with WriteLenField() at the right place.
- 4) Write the encoded character array with WriteCharArray().
- */
-class SvxOcxString
-{
-public:
- /** Constructs an empty string. String data may be set later by assignment. */
- inline explicit SvxOcxString() : mnLenFld( 0 ) {}
- /** Constructs the string from the passed OUString. */
- inline explicit SvxOcxString( const OUString& rStr ) { Init( rStr ); }
- /** Constructs the string from the passed UNO Any. */
- inline explicit SvxOcxString( const uno::Any& rAny ) { Init( rAny ); }
-
- /** Assigns the passed string to the object. */
- inline SvxOcxString& operator=( const OUString& rStr ) { Init( rStr ); return *this; }
- /** Assigns the string in the passed UNO Any to the object. */
- inline SvxOcxString& operator=( const uno::Any& rAny ) { Init( rAny ); return *this; }
-
- /** Returns true, if the string contains at least one character to write. */
- inline bool HasData() const { return maString.getLength() > 0; }
-
- /** Writes the encoded 32-bit string length field. Aligns stream position to mult. of 4 before. */
- void WriteLenField( SvStorageStream& rStrm ) const;
- /** Writes the encoded character array. Aligns stream position to mult. of 4 before. */
- void WriteCharArray( SvStorageStream& rStrm ) const;
-
-private:
- inline void Init( const OUString& rStr ) { maString = rStr; Init(); }
- void Init( const uno::Any& rAny );
- void Init();
-
- OUString maString; /// The initial string data.
- sal_uInt32 mnLenFld; /// The encoded string length field.
-};
-
-void SvxOcxString::Init( const uno::Any& rAny )
-{
- if( !(rAny >>= maString) )
- maString = OUString();
- Init();
-}
-
-void SvxOcxString::Init()
-{
- mnLenFld = static_cast< sal_uInt32 >( maString.getLength() );
- bool bCompr = true;
- // try to find a character >= 0x100 -> character array will be stored uncompressed then
- if( const sal_Unicode* pChar = maString.getStr() )
- for( const sal_Unicode* pEnd = pChar + maString.getLength(); bCompr && (pChar < pEnd); ++pChar )
- bCompr = (*pChar < 0x100);
- if( bCompr )
- mnLenFld |= SVX_MSOCX_COMPRESSED;
- else
- mnLenFld *= 2;
-}
-
-void SvxOcxString::WriteLenField( SvStorageStream& rStrm ) const
-{
- if( HasData() )
- {
- WriteAlign( &rStrm, 4);
- rStrm << mnLenFld;
- }
-}
-
-void SvxOcxString::WriteCharArray( SvStorageStream& rStrm ) const
-{
- if( HasData() )
- {
- const sal_Unicode* pChar = maString.getStr();
- const sal_Unicode* pEnd = pChar + maString.getLength();
- bool bCompr = lclIsCompressed( mnLenFld );
-
- WriteAlign( &rStrm, 4);
- for( ; pChar < pEnd; ++pChar )
- {
- // write compressed Unicode (not encoded bytestring), or Little-Endian Unicode
- rStrm << static_cast< sal_uInt8 >( *pChar );
- if( !bCompr )
- rStrm << static_cast< sal_uInt8 >( *pChar >> 8 );
- }
- }
-}
-
-} // namespace
-
-// ============================================================================
-
-class OCX_UserFormLabel : public OCX_Label
-{
-public:
- OCX_UserFormLabel(OCX_Control* pParent ) : OCX_Label( pParent )
- {
- mnForeColor = 0x80000012L;
- mnBackColor = 0x8000000FL;
- }
-};
-
-
-sal_uInt16 OCX_Control::nStandardId(0x0200);
-sal_uInt16 OCX_FontData::nStandardId(0x0200);
-
-sal_uInt32 OCX_Control::pColor[25] = {
-0xC0C0C0, 0x008080, 0x000080, 0x808080, 0xC0C0C0, 0xFFFFFF, 0x000000,
-0x000000, 0x000000, 0xFFFFFF, 0xC0C0C0, 0xC0C0C0, 0x808080, 0x000080,
-0xFFFFFF, 0xC0C0C0, 0x808080, 0x808080, 0x000000, 0xC0C0C0, 0xFFFFFF,
-0x000000, 0xC0C0C0, 0x000000, 0xFFFFC0 };
-
-void OCX_Control::FillSystemColors()
-{
- // overwrite the predefined colors with available system colors
- const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
- pColor[ 0x00 ] = rSett.GetFaceColor().GetColor();
- pColor[ 0x01 ] = rSett.GetWorkspaceColor().GetColor();
- pColor[ 0x02 ] = rSett.GetActiveColor().GetColor();
- pColor[ 0x03 ] = rSett.GetDeactiveColor().GetColor();
- pColor[ 0x04 ] = rSett.GetMenuBarColor().GetColor();
- pColor[ 0x05 ] = rSett.GetWindowColor().GetColor();
- pColor[ 0x07 ] = rSett.GetMenuTextColor().GetColor();
- pColor[ 0x08 ] = rSett.GetWindowTextColor().GetColor();
- pColor[ 0x09 ] = rSett.GetActiveTextColor().GetColor();
- pColor[ 0x0A ] = rSett.GetActiveBorderColor().GetColor();
- pColor[ 0x0B ] = rSett.GetDeactiveBorderColor().GetColor();
- pColor[ 0x0C ] = rSett.GetWorkspaceColor().GetColor();
- pColor[ 0x0D ] = rSett.GetHighlightColor().GetColor();
- pColor[ 0x0E ] = rSett.GetHighlightTextColor().GetColor();
- pColor[ 0x0F ] = rSett.GetFaceColor().GetColor();
- pColor[ 0x10 ] = rSett.GetShadowColor().GetColor();
- pColor[ 0x12 ] = rSett.GetButtonTextColor().GetColor();
- pColor[ 0x13 ] = rSett.GetDeactiveTextColor().GetColor();
- pColor[ 0x14 ] = rSett.GetHighlightColor().GetColor();
- pColor[ 0x15 ] = rSett.GetDarkShadowColor().GetColor();
- pColor[ 0x16 ] = rSett.GetShadowColor().GetColor();
- pColor[ 0x17 ] = rSett.GetHelpTextColor().GetColor();
- pColor[ 0x18 ] = rSett.GetHelpColor().GetColor();
-}
-
-sal_uInt8 OCX_FontData::ExportAlign(sal_Int16 nAlign) const
-{
- sal_Int8 nRet;
- switch (nAlign)
- {
- default:
- case 0:
- nRet = 1;
- break;
- case 2:
- nRet = 2;
- break;
- case 1:
- nRet = 3;
- break;
- }
- return nRet;
-}
-
-sal_uInt32 OCX_Control::SwapColor(sal_uInt32 nColor) const
-{
- sal_uInt8
- r(static_cast<sal_uInt8>(nColor&0xFF)),
- g(static_cast<sal_uInt8>(((nColor)>>8)&0xFF)),
- b(static_cast<sal_uInt8>((nColor>>16)&0xFF));
- nColor = (r<<16) + (g<<8) + b;
- return nColor;
-}
-
-sal_uInt32 OCX_Control::ExportColor(sal_uInt32 nColor) const
-{
- sal_uInt8 nUpper = (sal_uInt8)( nColor >> 24 );
- if (nUpper & 0x80) //Palette color, should be switch on bottom 24 bits
- {
- /*Might as well use my systems ones in the absence of any other ideas*/
- nColor = nColor&0x00FFFFFF;
- DBG_ASSERT (nColor <= 24,"Unknown Palette Index");
- if (nColor > 24)
- nColor = 0xFFFFFF;
- else
- nColor = pColor[nColor];
- }
+#define WW8_ASCII2STR(s) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(s))
- //Stored in bgr! rather than rgb
- nColor = SwapColor(nColor);
- return nColor;
-}
+static char sWW8_form[] = "WW-Standard";
-sal_uInt8 OCX_Control::ExportBorder(sal_uInt16 nBorder,sal_uInt8 &rBorderStyle)
- const
+SvxMSConvertOCXControls::SvxMSConvertOCXControls( const uno::Reference< frame::XModel >& rxModel) : mxModel(rxModel)
{
- sal_uInt8 nRet;
- switch(nBorder)
- {
- case 0:
- nRet = rBorderStyle = 0;
- break;
- default:
- case 1:
- nRet = 2;
- rBorderStyle = 0;
- break;
- case 2:
- nRet = 0;
- rBorderStyle = 1;
- break;
- }
- return nRet;
+ OSL_ENSURE( pDocSh, "No DocShell, Cannot do Controls" );
}
-sal_uInt8 OCX_Control::ExportSpecEffect( sal_Int16 nApiEffect ) const
+SvxMSConvertOCXControls::~SvxMSConvertOCXControls()
{
- return (nApiEffect == 2) ? 0 : 2;
}
const uno::Reference< drawing::XDrawPage >&
SvxMSConvertOCXControls::GetDrawPage()
{
- if( !xDrawPage.is() && pDocSh )
+ if( !xDrawPage.is() && mxModel.is() )
{
- uno::Reference< drawing::XDrawPageSupplier > xTxtDoc(pDocSh->GetModel(),
+ uno::Reference< drawing::XDrawPageSupplier > xTxtDoc(mxModel,
uno::UNO_QUERY);
- DBG_ASSERT(xTxtDoc.is(),"XDrawPageSupplier nicht vom XModel erhalten");
+ OSL_ENSURE(xTxtDoc.is(),"no XDrawPageSupplier from XModel");
xDrawPage = xTxtDoc->getDrawPage();
- DBG_ASSERT( xDrawPage.is(), "XDrawPage nicht erhalten" );
+ OSL_ENSURE( xDrawPage.is(), "no XDrawPage" );
}
return xDrawPage;
@@ -401,12 +73,12 @@ const uno::Reference< drawing::XDrawPage >&
const uno::Reference< lang::XMultiServiceFactory >&
SvxMSConvertOCXControls::GetServiceFactory()
{
- if( !xServiceFactory.is() && pDocSh )
+ if( !xServiceFactory.is() && mxModel.is() )
{
xServiceFactory = uno::Reference< lang::XMultiServiceFactory >
- (pDocSh->GetBaseModel(), uno::UNO_QUERY);
- DBG_ASSERT( xServiceFactory.is(),
- "XMultiServiceFactory nicht vom Model erhalten" );
+ (mxModel, uno::UNO_QUERY);
+ OSL_ENSURE( xServiceFactory.is(),
+ "no XMultiServiceFactory from doc Model" );
}
return xServiceFactory;
@@ -422,7 +94,7 @@ const uno::Reference< drawing::XShapes >& SvxMSConvertOCXControls::GetShapes()
xShapes = uno::Reference< drawing::XShapes >(xDrawPage,
uno::UNO_QUERY);
- DBG_ASSERT( xShapes.is(), "XShapes nicht vom XDrawPage erhalten" );
+ OSL_ENSURE( xShapes.is(), "UNO_QUERY failed for XShapes from XDrawPage" );
}
}
return xShapes;
@@ -438,8 +110,8 @@ const uno::Reference< container::XIndexContainer >&
{
uno::Reference< form::XFormsSupplier > xFormsSupplier( xDrawPage,
uno::UNO_QUERY );
- DBG_ASSERT( xFormsSupplier.is(),
- "XFormsSupplier nicht vom XDrawPage erhalten" );
+ OSL_ENSURE( xFormsSupplier.is(),
+ "UNO_QUERY failed for XFormsSupplier from XDrawPage" );
uno::Reference< container::XNameContainer > xNameCont =
xFormsSupplier->getForms();
@@ -472,11 +144,11 @@ const uno::Reference< container::XIndexContainer >&
xFormPropSet->setPropertyValue( C2U("Name"), aTmp );
uno::Reference< form::XForm > xForm( xCreate, uno::UNO_QUERY );
- DBG_ASSERT(xForm.is(), "keine Form?");
+ OSL_ENSURE(xForm.is(), "no Form?");
uno::Reference< container::XIndexContainer > xForms( xNameCont,
uno::UNO_QUERY );
- DBG_ASSERT( xForms.is(), "XForms nicht erhalten" );
+ OSL_ENSURE( xForms.is(), "XForms not available" );
aTmp.setValue( &xForm,
::getCppuType((uno::Reference < form::XForm >*)0));
@@ -491,2383 +163,4 @@ const uno::Reference< container::XIndexContainer >&
return xFormComps;
}
-sal_Bool OCX_GroupBox::Export(SvStorageRef& /* rObj */,
- const uno::Reference< beans::XPropertySet >& /* rPropSet */,
- const awt::Size& /* rSize */ )
-{
- sal_Bool bRet=sal_True;
- return bRet;
-}
-
-sal_Bool OCX_GroupBox::WriteContents(SvStorageStreamRef& /* rObj */,
- const uno::Reference< beans::XPropertySet >& /* rPropSet */,
- const awt::Size& /* rSize */)
-{
- sal_Bool bRet=sal_True;
- return bRet;
-}
-
-sal_Bool OCX_CommandButton::WriteContents(SvStorageStreamRef& rContents,
- const uno::Reference< beans::XPropertySet >& rPropSet,
- const awt::Size& rSize )
-{
- sal_Bool bRet=sal_True;
-
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(8);
-
- uno::Any aTmp = rPropSet->getPropertyValue(C2U("TextColor"));
- if (aTmp.hasValue())
- aTmp >>= mnForeColor;
- *rContents << ExportColor(mnForeColor);
-
- aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- *rContents << ExportColor(mnBackColor);
-
- aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
- sal_uInt8 nTemp=0;//fEnabled;
- if (fEnabled)
- nTemp |= 0x02;
- if (fBackStyle)
- nTemp |= 0x08;
- *rContents << nTemp;
- *rContents << sal_uInt8(0x00);
-
- nTemp = 0;
- aTmp = rPropSet->getPropertyValue(C2U("MultiLine"));
- fWordWrap = any2bool(aTmp);
- if (fWordWrap)
- nTemp |= 0x80;
- *rContents << nTemp;
- *rContents << sal_uInt8(0x00);
-
- SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) );
- aCaption.WriteLenField( *rContents );
- aCaption.WriteCharArray( *rContents );
-
- WriteAlign(rContents,4);
-
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
- // "take focus on click" is directly in content flags, not in option field...
- mbTakeFocus = any2bool( rPropSet->getPropertyValue( C2U( "FocusOnClick" ) ) );
-
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
-
- bRet = aFontData.Export(rContents,rPropSet);
-
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- sal_uInt8 nTmp = 0x27;
- if (aCaption.HasData())
- nTmp |= 0x08;
- *rContents << nTmp;
- nTmp = 0x00;
- if( !mbTakeFocus ) // flag is set, if option is off
- nTmp |= 0x02;
- *rContents << nTmp;
- *rContents << sal_uInt8(0x00);
- *rContents << sal_uInt8(0x00);
-
- DBG_ASSERT((rContents.Is() && (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-
-
-sal_Bool OCX_CommandButton::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x32, 0x05, 0xD7,
- 0x69, 0xCE, 0xCD, 0x11, 0xA7, 0x77, 0x00, 0xDD,
- 0x01, 0x14, 0x3C, 0x57, 0x22, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6d, 0x73, 0x20,
- 0x32, 0x2e, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x6D,
- 0x61, 0x6E, 0x64, 0x42, 0x75, 0x74, 0x74, 0x6F,
- 0x6E, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
- 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
- 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x16, 0x00,
- 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
- 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x42,
- 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00,
- 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x6D, 0x00,
- 0x61, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x42, 0x00,
- 0x75, 0x00, 0x74, 0x00, 0x74, 0x00, 0x6F, 0x00,
- 0x6E, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
-
- return WriteContents(xContents,rPropSet,rSize);
-}
-
-sal_Bool OCX_ImageButton::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- sal_Bool bRet=sal_True;
-
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(8);
-
- uno::Any aTmp=rPropSet->getPropertyValue(C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- *rContents << ExportColor(mnBackColor);
-
- aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
- sal_uInt8 nTemp=0;//fEnabled;
- if (fEnabled)
- nTemp |= 0x02;
- *rContents << nTemp;
- *rContents << sal_uInt8(0x00);
- *rContents << sal_uInt8(0x00);
- *rContents << sal_uInt8(0x00);
-
- WriteAlign(rContents,4);
-
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
-
- bRet = aFontData.Export(rContents,rPropSet);
-
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- sal_uInt8 nTmp = 0x26;
- *rContents << nTmp;
- *rContents << sal_uInt8(0x00);
- *rContents << sal_uInt8(0x00);
- *rContents << sal_uInt8(0x00);
-
- DBG_ASSERT((rContents.Is() && (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-
-
-sal_Bool OCX_ImageButton::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x32, 0x05, 0xD7,
- 0x69, 0xCE, 0xCD, 0x11, 0xA7, 0x77, 0x00, 0xDD,
- 0x01, 0x14, 0x3C, 0x57, 0x22, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6d, 0x73, 0x20,
- 0x32, 0x2e, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x6D,
- 0x61, 0x6E, 0x64, 0x42, 0x75, 0x74, 0x74, 0x6F,
- 0x6E, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
- 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
- 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x16, 0x00,
- 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
- 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x42,
- 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00,
- 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x6D, 0x00,
- 0x61, 0x00, 0x6E, 0x00, 0x64, 0x00, 0x42, 0x00,
- 0x75, 0x00, 0x74, 0x00, 0x74, 0x00, 0x6F, 0x00,
- 0x6E, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents,rPropSet,rSize);
-}
-
-bool lcl_isNamedRange( const rtl::OUString& sAddress, uno::Reference< frame::XModel >& xModel, table::CellRangeAddress& aAddress )
-{
- bool bRes = false;
- const static rtl::OUString sNamedRanges( RTL_CONSTASCII_USTRINGPARAM("NamedRanges"));
- uno::Reference< sheet::XCellRangeReferrer > xReferrer;
- try
- {
- uno::Reference< beans::XPropertySet > xPropSet( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameAccess > xNamed( xPropSet->getPropertyValue( sNamedRanges ), uno::UNO_QUERY_THROW );
- xReferrer.set ( xNamed->getByName( sAddress ), uno::UNO_QUERY );
- }
- catch( uno::Exception& /*e*/ )
- {
- // do nothing
- }
- if ( xReferrer.is() )
- {
- uno::Reference< sheet::XCellRangeAddressable > xRangeAddressable( xReferrer->getReferredCells(), uno::UNO_QUERY );
- if ( xRangeAddressable.is() )
- {
- aAddress = xRangeAddressable->getRangeAddress();
- bRes = true;
- }
- }
- return bRes;
-}
-
-void lcl_ApplyListSourceAndBindableStuff( uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rPropSet, const rtl::OUString& rsCtrlSource, const rtl::OUString& rsRowSource )
-{
-// XBindable etc.
- uno::Reference< lang::XMultiServiceFactory > xFac;
- if ( xModel.is() )
- xFac.set( xModel, uno::UNO_QUERY );
- uno::Reference< form::binding::XBindableValue > xBindable( rPropSet, uno::UNO_QUERY );
- if ( xFac.is() && rsCtrlSource.getLength() && xBindable.is() )
- {
-
- // OOo address structures
- // RefCell - convert from XL
- // pretend we converted the imported string address into the
- // appropriate address structure
- uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
- table::CellAddress aAddress;
- if ( xConvertor.is() )
- {
- // we need this service to properly convert XL notation also
- // Should be easy to extend
- xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsCtrlSource ) );
- xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
- }
-
- beans::NamedValue aArg1;
- aArg1.Name = C2U("BoundCell");
- aArg1.Value <<= aAddress;
-
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[ 0 ] <<= aArg1;
-
- uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
- xBindable->setValueBinding( xBinding );
- }
- uno::Reference< form::binding::XListEntrySink > xListEntrySink( rPropSet, uno::UNO_QUERY );
- if ( xFac.is() && rsRowSource.getLength() && xListEntrySink.is() )
- {
-
- // OOo address structures
- // RefCell - convert from XL
- // pretend we converted the imported string address into the
- // appropriate address structure
- uno::Reference< beans::XPropertySet > xConvertor( xFac->createInstance( C2U( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
- table::CellRangeAddress aAddress;
- if ( xConvertor.is() )
- {
- if ( !lcl_isNamedRange( rsRowSource, xModel, aAddress ) )
- {
- // we need this service to properly convert XL notation also
- // Should be easy to extend
- xConvertor->setPropertyValue( C2U( "XL_A1_Representation" ), uno::makeAny( rsRowSource ) );
- xConvertor->getPropertyValue( C2U( "Address" ) ) >>= aAddress;
- }
- }
-
- beans::NamedValue aArg1;
- aArg1.Name = C2U("CellRange");
- aArg1.Value <<= aAddress;
-
- uno::Sequence< uno::Any > aArgs(1);
- aArgs[ 0 ] <<= aArg1;
-
- uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( C2U("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
- xListEntrySink->setListEntrySource( xSource );
- }
-}
-
-sal_Bool OCX_OptionButton::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- sal_Bool bRet=sal_True;
-
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(12);
-
- pBlockFlags[0] = 0;
- pBlockFlags[1] = 0x01;
- pBlockFlags[2] = 0;
- pBlockFlags[3] = 0x80;
- pBlockFlags[4] = 0;
- pBlockFlags[5] = 0;
- pBlockFlags[6] = 0;
- pBlockFlags[7] = 0;
-
- uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
-
- aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- else
- fBackStyle = 0;
-
- sal_uInt8 nTemp=0;//=fEnabled;
- if (fEnabled)
- nTemp |= 0x02;
- if (fBackStyle)
- nTemp |= 0x08;
- *rContents << nTemp;
- pBlockFlags[0] |= 0x01;
- *rContents << sal_uInt8(0x00);
- nTemp = 0;
- aTmp = rPropSet->getPropertyValue(C2U("MultiLine"));
- fWordWrap = any2bool(aTmp);
- if (fWordWrap)
- nTemp |= 0x80;
- *rContents << nTemp;
- *rContents << sal_uInt8(0x00);
-
- *rContents << ExportColor(mnBackColor);
- pBlockFlags[0] |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("TextColor"));
- if (aTmp.hasValue())
- aTmp >>= mnForeColor;
- *rContents << ExportColor(mnForeColor);
- pBlockFlags[0] |= 0x04;
-
- nStyle = 5;
- *rContents << nStyle;
- pBlockFlags[0] |= 0x40;
-
- WriteAlign(rContents,4);
- nValueLen = 1|SVX_MSOCX_COMPRESSED;
- aTmp = rPropSet->getPropertyValue(C2U("DefaultState"));
- sal_Int16 nDefault = sal_Int16();
- aTmp >>= nDefault;
- *rContents << nValueLen;
- pBlockFlags[2] |= 0x40;
-
-
- SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) );
- if (aCaption.HasData())
- pBlockFlags[2] |= 0x80;
- aCaption.WriteLenField( *rContents );
-
- aTmp = rPropSet->getPropertyValue(C2U("VisualEffect"));
- if (aTmp.hasValue())
- {
- sal_Int16 nApiSpecEffect = sal_Int16();
- aTmp >>= nApiSpecEffect;
- nSpecialEffect = ExportSpecEffect( nApiSpecEffect );
- }
- *rContents << nSpecialEffect;
- pBlockFlags[3] |= 0x04;
-
- WriteAlign(rContents,4);
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
- nDefault += 0x30;
- *rContents << sal_uInt8(nDefault);
- *rContents << sal_uInt8(0x00);
-
- aCaption.WriteCharArray( *rContents );
-
- WriteAlign(rContents,4);
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
- bRet = aFontData.Export(rContents,rPropSet);
-
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- *rContents << pBlockFlags[0];
- *rContents << pBlockFlags[1];
- *rContents << pBlockFlags[2];
- *rContents << pBlockFlags[3];
- *rContents << pBlockFlags[4];
- *rContents << pBlockFlags[5];
- *rContents << pBlockFlags[6];
- *rContents << pBlockFlags[7];
-
- DBG_ASSERT((rContents.Is() &&
- (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-
-
-sal_Bool OCX_OptionButton::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x50, 0x1D, 0xD2, 0x8B,
- 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
- 0x00, 0x60, 0x02, 0xF3, 0x21, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x4F, 0x70, 0x74, 0x69,
- 0x6F, 0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E,
- 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62,
- 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62,
- 0x6A, 0x65, 0x63, 0x74, 0x00, 0x15, 0x00, 0x00,
- 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x4F,
- 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x42, 0x75, 0x74,
- 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00, 0xF4, 0x39,
- 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x4F, 0x00, 0x70, 0x00, 0x74, 0x00, 0x69, 0x00,
- 0x6F, 0x00, 0x6E, 0x00, 0x42, 0x00, 0x75, 0x00,
- 0x74, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x6E, 0x00,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-sal_Bool OCX_TextBox::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- sal_Bool bRet=sal_True;
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(12);
-
- pBlockFlags[0] = 0;
- pBlockFlags[1] = 0x01;
- pBlockFlags[2] = 0x00;
- pBlockFlags[3] = 0x80;
- pBlockFlags[4] = 0;
- pBlockFlags[5] = 0;
- pBlockFlags[6] = 0;
- pBlockFlags[7] = 0;
-
-
- sal_uInt8 nTemp=0x19;
- uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
- if (fEnabled)
- nTemp |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("ReadOnly"));
- fLocked = any2bool(aTmp);
- if (fLocked)
- nTemp |= 0x04;
-
- *rContents << nTemp;
- pBlockFlags[0] |= 0x01;
- *rContents << sal_uInt8(0x48);
- *rContents << sal_uInt8(0x80);
-
- fMultiLine = any2bool(rPropSet->getPropertyValue(C2U("MultiLine")));
- fHideSelection = any2bool(rPropSet->getPropertyValue(C2U("HideInactiveSelection")));
- nTemp = 0x0C;
- if (fMultiLine)
- nTemp |= 0x80;
- if( fHideSelection )
- nTemp |= 0x20;
- *rContents << nTemp;
-
- aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- *rContents << ExportColor(mnBackColor);
- pBlockFlags[0] |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("TextColor"));
- if (aTmp.hasValue())
- aTmp >>= mnForeColor;
- *rContents << ExportColor(mnForeColor);
- pBlockFlags[0] |= 0x04;
-
- aTmp = rPropSet->getPropertyValue( C2U("MaxTextLen"));
- aTmp >>= nMaxLength;
- *rContents << nMaxLength;
- pBlockFlags[0] |= 0x08;
-
- aTmp = rPropSet->getPropertyValue(C2U("Border"));
- sal_Int16 nBorder = sal_Int16();
- aTmp >>= nBorder;
- nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
- *rContents << nBorderStyle;
- pBlockFlags[0] |= 0x10;
-
- aTmp = rPropSet->getPropertyValue( C2U("HScroll"));
- sal_Bool bTemp1 = any2bool(aTmp);
- aTmp = rPropSet->getPropertyValue( C2U("VScroll"));
- sal_Bool bTemp2 = any2bool(aTmp);
- if (!bTemp1 && !bTemp2)
- nScrollBars =0;
- else if (bTemp1 && bTemp2)
- nScrollBars = 3;
- else if (!bTemp1 && bTemp2)
- nScrollBars = 2;
- else
- nScrollBars = 1;
- *rContents << nScrollBars;
- pBlockFlags[0] |= 0x20;
-
- aTmp = rPropSet->getPropertyValue(C2U("EchoChar"));
- sal_uInt16 nTmp = sal_uInt16();
- aTmp >>= nTmp;
- nPasswordChar = static_cast<sal_uInt8>(nTmp);
- *rContents << nPasswordChar;
- pBlockFlags[1] |= 0x02;
-
- SvxOcxString aValue( rPropSet->getPropertyValue(C2U("DefaultText")) );
- aValue.WriteLenField( *rContents );
- if (aValue.HasData())
- pBlockFlags[2] |= 0x40;
-
- WriteAlign(rContents,4);
- aTmp = rPropSet->getPropertyValue(C2U("BorderColor"));
- if (aTmp.hasValue())
- aTmp >>= nBorderColor;
- *rContents << ExportColor(nBorderColor);
- pBlockFlags[3] |= 0x02;
-
- *rContents << nSpecialEffect;
- pBlockFlags[3] |= 0x04;
-
- WriteAlign(rContents,4);
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
- aValue.WriteCharArray( *rContents );
-
- WriteAlign(rContents,4);
-
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
-
- bRet = aFontData.Export(rContents,rPropSet);
-
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- *rContents << pBlockFlags[0];
- *rContents << pBlockFlags[1];
- *rContents << pBlockFlags[2];
- *rContents << pBlockFlags[3];
- *rContents << pBlockFlags[4];
- *rContents << pBlockFlags[5];
- *rContents << pBlockFlags[6];
- *rContents << pBlockFlags[7];
-
- DBG_ASSERT((rContents.Is() &&
- (SVSTREAM_OK == rContents->GetError())),"damn");
- return bRet;
-}
-
-
-sal_Bool OCX_TextBox::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x1D, 0xD2, 0x8B,
- 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
- 0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x54, 0x65, 0x78, 0x74,
- 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
- 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
- 0x73, 0x2E, 0x54, 0x65, 0x78, 0x74, 0x42, 0x6F,
- 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x54, 0x00, 0x65, 0x00, 0x78, 0x00, 0x74, 0x00,
- 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00, 0x31, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-sal_Bool OCX_FieldControl::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- sal_Bool bRet=sal_True;
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(12);
-
- pBlockFlags[0] = 0;
- pBlockFlags[1] = 0x01;
- pBlockFlags[2] = 0x00;
- pBlockFlags[3] = 0x80;
- pBlockFlags[4] = 0;
- pBlockFlags[5] = 0;
- pBlockFlags[6] = 0;
- pBlockFlags[7] = 0;
-
-
- sal_uInt8 nTemp=0x19;
- uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
- if (fEnabled)
- nTemp |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("ReadOnly"));
- fLocked = any2bool(aTmp);
- if (fLocked)
- nTemp |= 0x04;
-
- *rContents << nTemp;
- pBlockFlags[0] |= 0x01;
- *rContents << sal_uInt8(0x48);
- *rContents << sal_uInt8(0x80);
-
- nTemp = 0x2C;
- *rContents << nTemp;
-
- aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- *rContents << ExportColor(mnBackColor);
- pBlockFlags[0] |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("TextColor"));
- if (aTmp.hasValue())
- aTmp >>= mnForeColor;
- *rContents << ExportColor(mnForeColor);
- pBlockFlags[0] |= 0x04;
-
- aTmp = rPropSet->getPropertyValue(C2U("Border"));
- sal_Int16 nBorder = sal_Int16();
- aTmp >>= nBorder;
- nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
- *rContents << nBorderStyle;
- pBlockFlags[0] |= 0x10;
-
-#if 0 //Each control has a different Value format, and how to convert each to text has to be found out
- SvxOcxString aValue( rPropSet->getPropertyValue(C2U("DefaultText")) );
- aValue.WriteLenField( *rContents );
- if (aValue.HasData())
- pBlockFlags[2] |= 0x40;
-#endif
-
- *rContents << nSpecialEffect;
- pBlockFlags[3] |= 0x04;
-
- WriteAlign(rContents,4);
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
-#if 0
- aValue.WriteCharArray( *rContents );
-#endif
-
- WriteAlign(rContents,4);
-
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
-
- bRet = aFontData.Export(rContents,rPropSet);
-
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- *rContents << pBlockFlags[0];
- *rContents << pBlockFlags[1];
- *rContents << pBlockFlags[2];
- *rContents << pBlockFlags[3];
- *rContents << pBlockFlags[4];
- *rContents << pBlockFlags[5];
- *rContents << pBlockFlags[6];
- *rContents << pBlockFlags[7];
-
- DBG_ASSERT((rContents.Is() &&
- (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-sal_Bool OCX_FieldControl::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x1D, 0xD2, 0x8B,
- 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
- 0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x54, 0x65, 0x78, 0x74,
- 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
- 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
- 0x73, 0x2E, 0x54, 0x65, 0x78, 0x74, 0x42, 0x6F,
- 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x54, 0x00, 0x65, 0x00, 0x78, 0x00, 0x74, 0x00,
- 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00, 0x31, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-sal_Bool OCX_ToggleButton::Export(
- SvStorageRef &rObj, const uno::Reference< beans::XPropertySet> &rPropSet,
- const awt::Size& rSize )
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x60, 0x1D, 0xD2, 0x8B,
- 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
- 0x00, 0x60, 0x02, 0xF3, 0x21, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x54, 0x6F, 0x67, 0x67,
- 0x6C, 0x65, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E,
- 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62,
- 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62,
- 0x6A, 0x65, 0x63, 0x74, 0x00, 0x15, 0x00, 0x00,
- 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x54,
- 0x6F, 0x67, 0x67, 0x6C, 0x65, 0x42, 0x75, 0x74,
- 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00, 0xF4, 0x39,
- 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x54, 0x00, 0x6F, 0x00, 0x67, 0x00, 0x67, 0x00,
- 0x6C, 0x00, 0x65, 0x00, 0x42, 0x00, 0x75, 0x00,
- 0x74, 0x00, 0x74, 0x00, 0x6F, 0x00, 0x6E, 0x00,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
-
- return WriteContents(xContents,rPropSet,rSize);
-}
-
-sal_Bool OCX_ToggleButton::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- sal_Bool bRet=sal_True;
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(12);
-
- pBlockFlags[0] = 0;
- pBlockFlags[1] = 0x01;
- pBlockFlags[2] = 0;
- pBlockFlags[3] = 0x80;
- pBlockFlags[4] = 0;
- pBlockFlags[5] = 0;
- pBlockFlags[6] = 0;
- pBlockFlags[7] = 0;
-
- uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
-
- sal_uInt8 nTemp=fEnabled;
- if (fEnabled)
- nTemp = nTemp << 1;
- if (fBackStyle)
- nTemp |= 0x08;
- *rContents << nTemp;
- pBlockFlags[0] |= 0x01;
- *rContents << sal_uInt8(0x00);
- nTemp = 0;
- aTmp = rPropSet->getPropertyValue(C2U("MultiLine"));
- fWordWrap = any2bool(aTmp);
- if (fWordWrap)
- nTemp |= 0x80;
- *rContents << nTemp;
- *rContents << sal_uInt8(0x00);
-
- aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- *rContents << ExportColor(mnBackColor);
- pBlockFlags[0] |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("TextColor"));
- if (aTmp.hasValue())
- aTmp >>= mnForeColor;
- *rContents << ExportColor(mnForeColor);
- pBlockFlags[0] |= 0x04;
-
- nStyle = 6;
- *rContents << nStyle;
- pBlockFlags[0] |= 0x40;
-
- WriteAlign(rContents,4);
- nValueLen = 1|SVX_MSOCX_COMPRESSED;
- bool bDefault = false;
- rPropSet->getPropertyValue(C2U("DefaultState")) >>= bDefault;
- sal_uInt8 nDefault = static_cast< sal_uInt8 >( bDefault ? '1' : '0' );
- *rContents << nValueLen;
- pBlockFlags[2] |= 0x40;
-
- SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) );
- aCaption.WriteLenField( *rContents );
- if (aCaption.HasData())
- pBlockFlags[2] |= 0x80;
-
- WriteAlign(rContents,4);
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
- *rContents << nDefault;
- *rContents << sal_uInt8(0x00);
-
- aCaption.WriteCharArray( *rContents );
-
- WriteAlign(rContents,4);
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
- bRet = aFontData.Export(rContents,rPropSet);
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- *rContents << pBlockFlags[0];
- *rContents << pBlockFlags[1];
- *rContents << pBlockFlags[2];
- *rContents << pBlockFlags[3];
- *rContents << pBlockFlags[4];
- *rContents << pBlockFlags[5];
- *rContents << pBlockFlags[6];
- *rContents << pBlockFlags[7];
-
- DBG_ASSERT((rContents.Is() &&
- (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-sal_Bool OCX_ComboBox::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- sal_Bool bRet=sal_True;
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(12);
-
- pBlockFlags[0] = 0;
- pBlockFlags[1] = 0x01;
- pBlockFlags[2] = 0x00;
- pBlockFlags[3] = 0x80;
- pBlockFlags[4] = 0;
- pBlockFlags[5] = 0;
- pBlockFlags[6] = 0;
- pBlockFlags[7] = 0;
-
-
- sal_uInt8 nTemp=0x19;//fEnabled;
- uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
- if (fEnabled)
- nTemp |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("ReadOnly"));
- fLocked = any2bool(aTmp);
- if (fLocked)
- nTemp |= 0x04;
-
- *rContents << nTemp;
- pBlockFlags[0] |= 0x01;
- *rContents << sal_uInt8(0x48);
- *rContents << sal_uInt8(0x80);
-
- nTemp = 0x0C;
- fHideSelection = any2bool(rPropSet->getPropertyValue(C2U("HideInactiveSelection")));
- if( fHideSelection )
- nTemp |= 0x20;
- *rContents << nTemp;
-
- aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- *rContents << ExportColor(mnBackColor);
- pBlockFlags[0] |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("TextColor"));
- if (aTmp.hasValue())
- aTmp >>= mnForeColor;
- *rContents << ExportColor(mnForeColor);
- pBlockFlags[0] |= 0x04;
-
- aTmp = rPropSet->getPropertyValue(C2U("Border"));
- sal_Int16 nBorder = sal_Int16();
- aTmp >>= nBorder;
- nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
- *rContents << nBorderStyle;
- pBlockFlags[0] |= 0x10;
-
- nStyle = 3;
- *rContents << nStyle;
- pBlockFlags[0] |= 0x40;
-
- WriteAlign(rContents,2);
-
- aTmp = rPropSet->getPropertyValue(C2U("LineCount"));
- aTmp >>= nListRows;
- *rContents << nListRows;
- pBlockFlags[1] |= 0x40;
-
- *rContents << sal_uInt8(1); //DefaultSelected One
- pBlockFlags[2] |= 0x01;
-
- aTmp = rPropSet->getPropertyValue(C2U("Dropdown"));
- nDropButtonStyle = any2bool(aTmp);
- if (nDropButtonStyle)
- nDropButtonStyle=0x02;
- *rContents << nDropButtonStyle;
- pBlockFlags[2] |= 0x04;
-
- SvxOcxString aValue( rPropSet->getPropertyValue(C2U("Text")) );
- aValue.WriteLenField( *rContents );
- if (aValue.HasData())
- pBlockFlags[2] |= 0x40;
-
- WriteAlign(rContents,4);
- aTmp = rPropSet->getPropertyValue(C2U("BorderColor"));
- if (aTmp.hasValue())
- aTmp >>= nBorderColor;
- *rContents << ExportColor(nBorderColor);
- pBlockFlags[3] |= 0x02;
-
- *rContents << nSpecialEffect;
- pBlockFlags[3] |= 0x04;
-
- WriteAlign(rContents,4);
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
- aValue.WriteCharArray( *rContents );
-
- WriteAlign(rContents,4);
-
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
-
- bRet = aFontData.Export(rContents,rPropSet);
-
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- *rContents << pBlockFlags[0];
- *rContents << pBlockFlags[1];
- *rContents << pBlockFlags[2];
- *rContents << pBlockFlags[3];
- *rContents << pBlockFlags[4];
- *rContents << pBlockFlags[5];
- *rContents << pBlockFlags[6];
- *rContents << pBlockFlags[7];
-
- DBG_ASSERT((rContents.Is() &&
- (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-
-sal_Bool OCX_ComboBox::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x30, 0x1D, 0xD2, 0x8B,
- 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
- 0x00, 0x60, 0x02, 0xF3, 0x1D, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x62,
- 0x6F, 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00,
- 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65,
- 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74,
- 0x00, 0x11, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72,
- 0x6D, 0x73, 0x2E, 0x43, 0x6F, 0x6D, 0x62, 0x6F,
- 0x42, 0x6F, 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39,
- 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x43, 0x00, 0x6F, 0x00, 0x6D, 0x00, 0x62, 0x00,
- 0x6F, 0x00, 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-sal_Bool OCX_ListBox::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- sal_Bool bRet=sal_True;
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(12);
-
- pBlockFlags[0] = 0;
- pBlockFlags[1] = 0x01;
- pBlockFlags[2] = 0x01;
- pBlockFlags[3] = 0x80;
- pBlockFlags[4] = 0;
- pBlockFlags[5] = 0;
- pBlockFlags[6] = 0;
- pBlockFlags[7] = 0;
-
- uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
- sal_uInt8 nTemp=fEnabled;
- if (fEnabled)
- nTemp = nTemp << 1;
-
- aTmp = rPropSet->getPropertyValue(C2U("ReadOnly"));
- fLocked = any2bool(aTmp);
- if (fLocked)
- nTemp |= 0x04;
-
- *rContents << nTemp;
- pBlockFlags[0] |= 0x01;
- *rContents << sal_uInt8(0x00);
- *rContents << sal_uInt8(0x00);
- *rContents << sal_uInt8(0x00);
-
- aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- *rContents << ExportColor(mnBackColor);
- pBlockFlags[0] |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("TextColor"));
- if (aTmp.hasValue())
- aTmp >>= mnForeColor;
- *rContents << ExportColor(mnForeColor);
- pBlockFlags[0] |= 0x04;
-
- aTmp = rPropSet->getPropertyValue(C2U("Border"));
- sal_Int16 nBorder = sal_Int16();
- aTmp >>= nBorder;
- nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
- WriteAlign(rContents,2);
- *rContents << nBorderStyle;
- pBlockFlags[0] |= 0x10;
-
- aTmp = rPropSet->getPropertyValue(C2U("MultiSelection"));
- nMultiState = any2bool(aTmp);
-
- if (nMultiState)
- {
- *rContents << nMultiState;
- pBlockFlags[0] |= 0x20;
- }
-
- nStyle = 2;
- *rContents << nStyle;
- pBlockFlags[0] |= 0x40;
-
-
- WriteAlign(rContents,4);
-
-#if 0
- SvxOcxString aValue( rPropSet->getPropertyValue(C2U("DefaultText")) );
- aValue.WriteLenField( *rContents );
- if (aValue.HasData())
- pBlockFlags[2] |= 0x40;
-
- WriteAlign(rContents,4);
-#endif
-
- WriteAlign(rContents,4);
- aTmp = rPropSet->getPropertyValue(C2U("BorderColor"));
- if (aTmp.hasValue())
- aTmp >>= nBorderColor;
- *rContents << ExportColor(nBorderColor);
- pBlockFlags[3] |= 0x02;
-
- *rContents << nSpecialEffect;
- pBlockFlags[3] |= 0x04;
-
- WriteAlign(rContents,4);
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
-#if 0
- aValue.WriteCharArray( *rContents );
-#endif
-
- WriteAlign(rContents,4);
-
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
-
- bRet = aFontData.Export(rContents,rPropSet);
-
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- *rContents << pBlockFlags[0];
- *rContents << pBlockFlags[1];
- *rContents << pBlockFlags[2];
- *rContents << pBlockFlags[3];
- *rContents << pBlockFlags[4];
- *rContents << pBlockFlags[5];
- *rContents << pBlockFlags[6];
- *rContents << pBlockFlags[7];
-
- DBG_ASSERT((rContents.Is() &&
- (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-sal_Bool OCX_ListBox::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x1D, 0xD2, 0x8B,
- 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
- 0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x4C, 0x69, 0x73, 0x74,
- 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
- 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
- 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
- 0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
- 0x73, 0x2E, 0x4C, 0x69, 0x73, 0x74, 0x42, 0x6F,
- 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x4C, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00,
- 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00, 0x31, 0x00,
- 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-sal_Bool OCX_Label::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- sal_Bool bRet = sal_True;
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(8);
- pBlockFlags[0] = 0x20;
- pBlockFlags[1] = 0;
- pBlockFlags[2] = 0;
- pBlockFlags[3] = 0;
-
- uno::Any aTmp = rPropSet->getPropertyValue(C2U("TextColor"));
- if (aTmp.hasValue())
- aTmp >>= mnForeColor;
- *rContents << ExportColor(mnForeColor);
- pBlockFlags[0] |= 0x01;
-
- aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- *rContents << ExportColor(mnBackColor);
- pBlockFlags[0] |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
- sal_uInt8 nTemp=fEnabled;
- if (fEnabled)
- nTemp = nTemp << 1;
- *rContents << nTemp;
- *rContents << sal_uInt8(0x00);
-
- aTmp = rPropSet->getPropertyValue(C2U("MultiLine"));
- fWordWrap = any2bool(aTmp);
- nTemp=fWordWrap;
- nTemp = nTemp << 7;
- *rContents << nTemp;
- *rContents << sal_uInt8(0x00);
- pBlockFlags[0] |= 0x04;
-
- SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) );
- aCaption.WriteLenField( *rContents );
- if (aCaption.HasData())
- pBlockFlags[0] |= 0x08;
-
- WriteAlign(rContents,4);
- aTmp = rPropSet->getPropertyValue(C2U("BorderColor"));
- if (aTmp.hasValue())
- aTmp >>= nBorderColor;
- *rContents << ExportColor(nBorderColor);
- pBlockFlags[0] |= 0x80;
-
- aTmp = rPropSet->getPropertyValue(C2U("Border"));
- sal_Int16 nBorder = sal_Int16();
- aTmp >>= nBorder;
- sal_uInt8 nNewBorder;
- nSpecialEffect = ExportBorder(nBorder,nNewBorder);
- nBorderStyle = nNewBorder;
- *rContents << nBorderStyle;
- pBlockFlags[1] |= 0x01;
- *rContents << nSpecialEffect;
- pBlockFlags[1] |= 0x02;
-
- aCaption.WriteCharArray( *rContents );
-
- WriteAlign(rContents,4);
- *rContents << rSize.Width;
- *rContents << rSize.Height;
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
-
- bRet = aFontData.Export(rContents,rPropSet);
-
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- *rContents << pBlockFlags[0];
- *rContents << pBlockFlags[1];
- *rContents << pBlockFlags[2];
- *rContents << pBlockFlags[3];
-
- DBG_ASSERT((rContents.Is() &&
- (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-
-
-sal_Bool OCX_Label::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x23, 0x9E, 0x8C, 0x97,
- 0xB0, 0xD4, 0xCE, 0x11, 0xBF, 0x2D, 0x00, 0xAA,
- 0x00, 0x3F, 0x40, 0xD0, 0x1A, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x4C, 0x61, 0x62, 0x65,
- 0x6C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
- 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
- 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x0E, 0x00,
- 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
- 0x4C, 0x61, 0x62, 0x65, 0x6C, 0x2E, 0x31, 0x00,
- 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x4C, 0x00, 0x61, 0x00, 0x62, 0x00, 0x65, 0x00,
- 0x6C, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-typedef OCX_Control *(*FNCreate)();
-
-
-struct OCX_map
-{
- FNCreate pCreate;
- const char *sId;
- sal_Int16 nId;
- const char *sName;
-};
-
-OCX_map aOCXTab[] =
-{
- // Command button MUST be at index 0
- {&OCX_CommandButton::Create,"D7053240-CE69-11CD-a777-00dd01143c57",
- form::FormComponentType::COMMANDBUTTON,"CommandButton"},
- // Toggle button MUST be at index 1
- {&OCX_ToggleButton::Create,"8BD21D60-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::COMMANDBUTTON,"ToggleButton"},
- {&OCX_Label::Create, "978C9E23-D4B0-11CE-bf2d-00aa003f40d0",
- form::FormComponentType::FIXEDTEXT,"Label"},
- {&OCX_TextBox::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::TEXTFIELD,"TextBox"},
- {&OCX_ListBox::Create,"8BD21D20-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::LISTBOX,"ListBox"},
- {&OCX_ComboBox::Create,"8BD21D30-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::COMBOBOX,"ComboBox"},
- {&OCX_CheckBox::Create,"8BD21D40-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::CHECKBOX,"CheckBox"},
- {&OCX_OptionButton::Create,"8BD21D50-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::RADIOBUTTON,"OptionButton"},
- {&OCX_Image::Create,"4C599241-6926-101B-9992-00000b65c6f9",
- form::FormComponentType::IMAGECONTROL,"Image"},
- {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::DATEFIELD,"TextBox"},
- {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::TIMEFIELD,"TextBox"},
- {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::NUMERICFIELD,"TextBox"},
- {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::CURRENCYFIELD,"TextBox"},
- {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::PATTERNFIELD,"TextBox"},
-#if 0
- {&OCX_FieldControl::Create,"8BD21D10-EC42-11CE-9e0d-00aa006002f3",
- form::FormComponentType::FORMULAFIELD,"TextBox"},
-#endif
- {&OCX_ImageButton::Create,"D7053240-CE69-11CD-a777-00dd01143c57",
- form::FormComponentType::IMAGEBUTTON,"CommandButton"},
- {&OCX_SpinButton::Create,"79176FB0-B7F2-11CE-97ef-00aa006d2776",
- form::FormComponentType::SPINBUTTON,"SpinButton"},
- {&OCX_ScrollBar::Create,"DFD181E0-5E2F-11CE-a449-00aa004a803d",
- form::FormComponentType::SCROLLBAR,"ScrollBar"},
- {&OCX_GroupBox::Create,"",
- form::FormComponentType::GROUPBOX,""},
- {&OCX_ProgressBar::Create,"",
- form::FormComponentType::CONTROL,""},
- {&HTML_TextBox::Create,"5512D124-5CC6-11CF-8d67-00aa00bdce1d", form::FormComponentType::TEXTFIELD,"TextBox"},
- {&HTML_Select::Create,"5512D122-5CC6-11CF-8d67-00aa00bdce1d",
- form::FormComponentType::LISTBOX,"ListBox"},
-};
-
-const int NO_OCX = sizeof( aOCXTab ) / sizeof( *aOCXTab );
-
-SvxMSConvertOCXControls::SvxMSConvertOCXControls(SfxObjectShell *pDSh, SwPaM *pP) :
- pDocSh(pDSh), pPaM(pP), nEdit(0), nCheckbox(0)
-{
- DBG_ASSERT( pDocSh, "No DocShell, Cannot do Controls" );
- OCX_Control::FillSystemColors();
-}
-
-SvxMSConvertOCXControls::~SvxMSConvertOCXControls()
-{
-}
-
-OCX_Control * SvxMSConvertOCXControls::OCX_Factory(const String &sName)
-{
- for (int i=0;i<NO_OCX;i++)
- {
- if ( sName.EqualsIgnoreCaseAscii( aOCXTab[i].sId ))
- return(aOCXTab[i].pCreate());
- }
- return(NULL);
-}
-
-OCX_Control * SvxMSConvertOCXControls::OCX_Factory(
- const uno::Reference< awt::XControlModel > &rControlModel,
- String &rId, String &rName)
-{
- rName.Erase();
- rId.Erase();
-
- uno::Reference< beans::XPropertySet > xPropSet(
- rControlModel,uno::UNO_QUERY);
-
- uno::Any aTmp = xPropSet->getPropertyValue(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassId" )));
- sal_Int16 nClassId = *(sal_Int16*) aTmp.getValue();
-
-//Begin nasty hack
- /*
- 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, when this happens uncomment the FORMULAFIELD in the OCX_Tab
- and delete this block, cmc.
-
- And also the nClassId for ImageControls is being reported as "CONTROL"
- rather than IMAGECONTROL
- */
- if (nClassId == form::FormComponentType::TEXTFIELD)
- {
- uno::Reference< lang::XServiceInfo > xInfo(rControlModel,
- uno::UNO_QUERY);
- if (xInfo->
- supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.FormattedField" ))))
- {
- rId.AppendAscii("8BD21D10-EC42-11CE-9e0d-00aa006002f3");
- rName.AppendAscii("TextBox");
- return new OCX_FieldControl;
- }
- }
- else if (nClassId == form::FormComponentType::CONTROL)
- {
- uno::Reference< lang::XServiceInfo > xInfo(rControlModel,
- uno::UNO_QUERY);
- if (xInfo->
- supportsService(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.ImageControl" ))))
- nClassId = form::FormComponentType::IMAGECONTROL;
- }
-//End nasty hack
-
- const OCX_map* pEntry = 0;
-
- // distinguish between push button and toggle button
- if( nClassId == form::FormComponentType::COMMANDBUTTON )
- {
- pEntry = any2bool(xPropSet->getPropertyValue(C2U("Toggle"))) ?
- (aOCXTab + 1) : aOCXTab;
- }
- else
- {
- for( int i = 2; (i < NO_OCX) && !pEntry; ++i )
- if( nClassId == aOCXTab[ i ].nId )
- pEntry = aOCXTab + i;
- }
-
- if( pEntry )
- {
- rId.AppendAscii( pEntry->sId );
- rName.AppendAscii( pEntry->sName );
- return pEntry->pCreate();
- }
-
- return 0;
-}
-
-
-sal_Bool SvxMSConvertOCXControls::WriteOCXStream( SvStorageRef& rSrc1,
- const uno::Reference< awt::XControlModel > &rControlModel,
- const awt::Size &rSize, String &rName)
-{
- sal_Bool bRet=sal_False;
-
- DBG_ASSERT( rControlModel.is(), "UNO-Control missing Model, panic!" );
- if( !rControlModel.is() )
- return sal_False;
-
-#if 0
- uno::Any aTmp = xPropSet->getPropertyValue(
- OUString(RTL_CONSTASCII_USTRINGPARAM("ClassId")));
- sal_Int16 nClassId = *(sal_Int16*) aTmp.getValue();
-#endif
-
- String sId;
- OCX_Control *pObj = OCX_Factory(rControlModel,sId,rName);
- if (pObj != NULL)
- {
- uno::Reference<beans::XPropertySet> xPropSet(rControlModel,
- uno::UNO_QUERY);
-
- /* #117832# - also enable export of control name */
- OUString sCName;
- xPropSet->getPropertyValue(C2U("Name")) >>= sCName;
- pObj->sName = sCName;
-
- SvGlobalName aName;
- aName.MakeId(sId);
- String sFullName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(
- "Microsoft Forms 2.0 ")));
- sFullName.Append(rName);
- rSrc1->SetClass(aName,0x5C,sFullName);
- // ^^^^, this pathetic 0x5c is the magic number
- // which the lack of originally blocked the implementation of
- // the controls export
- // cmc
-
- bRet = pObj->Export(rSrc1,xPropSet,rSize);
- SvStorageStreamRef xStor2( rSrc1->OpenSotStream( C2U("\3OCXNAME")));
- /* #117832# - also enable export of control name */
- writeOCXNAME( sCName, xStor2 );
- delete pObj;
- }
- return bRet;
-}
-
-
-//I think this should work for excel documents, create the "Ctls" stream
-//and give it here as rContents, we'll append out streams ole id and
-//contents here and that appears to be what Excel is doing
-sal_Bool SvxMSConvertOCXControls::WriteOCXExcelKludgeStream(
- SvStorageStreamRef& rContents,
- const uno::Reference< awt::XControlModel > &rControlModel,
- const awt::Size &rSize, String &rName)
-{
- sal_Bool bRet=sal_False;
-
- DBG_ASSERT( rControlModel.is(), "UNO-Control missing Model, panic!" );
- if( !rControlModel.is() )
- return sal_False;
-
- String sId;
- OCX_Control *pObj = OCX_Factory(rControlModel,sId,rName);
- if (pObj != NULL)
- {
- uno::Reference<beans::XPropertySet> xPropSet(rControlModel,
- uno::UNO_QUERY);
-
- SvGlobalName aName;
- aName.MakeId(sId);
- String sFullName(String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(
- "Microsoft Forms 2.0 ")));
- sFullName.Append(rName);
- SvStream *pS=rContents;
- *pS << aName;
- bRet = pObj->WriteContents(rContents,xPropSet,rSize);
- delete pObj;
- // export needs correct stream position
- rContents->Seek( STREAM_SEEK_TO_END );
- }
- return bRet;
-}
-
-sal_Bool OCX_CheckBox::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-
-{
- sal_Bool bRet=sal_True;
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(12);
-
- pBlockFlags[0] = 0;
- pBlockFlags[1] = 0x01;
- pBlockFlags[2] = 0;
- pBlockFlags[3] = 0x80;
- pBlockFlags[4] = 0;
- pBlockFlags[5] = 0;
- pBlockFlags[6] = 0;
- pBlockFlags[7] = 0;
-
- uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
-
- aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor"));
- fBackStyle = aTmp.hasValue() ? 1 : 0;
- if (fBackStyle)
- aTmp >>= mnBackColor;
-
- sal_uInt8 nTemp=fEnabled;
- if (fEnabled)
- nTemp = nTemp << 1;
- if (fBackStyle)
- nTemp |= 0x08;
- *rContents << nTemp;
- pBlockFlags[0] |= 0x01;
- *rContents << sal_uInt8(0x00);
- nTemp = 0;
- aTmp = rPropSet->getPropertyValue(C2U("MultiLine"));
- fWordWrap = any2bool(aTmp);
- if (fWordWrap)
- nTemp |= 0x80;
- *rContents << nTemp;
- *rContents << sal_uInt8(0x00);
-
- *rContents << ExportColor(mnBackColor);
- pBlockFlags[0] |= 0x02;
-
- aTmp = rPropSet->getPropertyValue(C2U("TextColor"));
- if (aTmp.hasValue())
- aTmp >>= mnForeColor;
- *rContents << ExportColor(mnForeColor);
- pBlockFlags[0] |= 0x04;
-
- nStyle = 4;
- *rContents << nStyle;
- pBlockFlags[0] |= 0x40;
-
- aTmp = rPropSet->getPropertyValue(C2U("TriState"));
- nMultiState = any2bool(aTmp);
- *rContents << nMultiState;
- pBlockFlags[2] |= 0x20;
-
- WriteAlign(rContents,4);
- nValueLen = 1|SVX_MSOCX_COMPRESSED;
- aTmp = rPropSet->getPropertyValue(C2U("DefaultState"));
- sal_Int16 nDefault = sal_Int16();
- aTmp >>= nDefault;
- *rContents << nValueLen;
- pBlockFlags[2] |= 0x40;
-
- SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) );
- aCaption.WriteLenField( *rContents );
- if (aCaption.HasData())
- pBlockFlags[2] |= 0x80;
-
- aTmp = rPropSet->getPropertyValue(C2U("VisualEffect"));
- if (aTmp.hasValue())
- {
- sal_Int16 nApiSpecEffect = sal_Int16();
- aTmp >>= nApiSpecEffect;
- nSpecialEffect = ExportSpecEffect( nApiSpecEffect );
- }
- WriteAlign(rContents,4);
- *rContents << nSpecialEffect;
- pBlockFlags[3] |= 0x04;
-
- WriteAlign(rContents,4);
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
- nDefault += 0x30;
- *rContents << sal_uInt8(nDefault);
- *rContents << sal_uInt8(0x00);
-
- aCaption.WriteCharArray( *rContents );
-
- WriteAlign(rContents,4);
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
- bRet = aFontData.Export(rContents,rPropSet);
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- *rContents << pBlockFlags[0];
- *rContents << pBlockFlags[1];
- *rContents << pBlockFlags[2];
- *rContents << pBlockFlags[3];
- *rContents << pBlockFlags[4];
- *rContents << pBlockFlags[5];
- *rContents << pBlockFlags[6];
- *rContents << pBlockFlags[7];
-
- DBG_ASSERT((rContents.Is() &&
- (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-
-sal_Bool OCX_CheckBox::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x1D, 0xD2, 0x8B,
- 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
- 0x00, 0x60, 0x02, 0xF3, 0x1D, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x43, 0x68, 0x65, 0x63,
- 0x6B, 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00,
- 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65,
- 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74,
- 0x00, 0x11, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72,
- 0x6D, 0x73, 0x2E, 0x43, 0x68, 0x65, 0x63, 0x6B,
- 0x42, 0x6F, 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39,
- 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x43, 0x00, 0x68, 0x00, 0x65, 0x00, 0x63, 0x00,
- 0x6B, 0x00, 0x42, 0x00, 0x6F, 0x00, 0x78, 0x00,
- 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
- };
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-
-sal_Bool OCX_FontData::Export(SvStorageStreamRef &rContent,
- const uno::Reference< beans::XPropertySet > &rPropSet)
-{
- sal_uInt8 nFlags=0x00;
- sal_uInt32 nOldPos = rContent->Tell();
- rContent->SeekRel(8);
- SvxOcxString aFontName;
- uno::Any aTmp;
-
- if (bHasFont)
- aFontName = rPropSet->getPropertyValue(C2U("FontName"));
- if (!aFontName.HasData())
- aFontName = OUString( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) );
- aFontName.WriteLenField( *rContent );
- nFlags |= 0x01;
-
- if (bHasFont)
- {
- aTmp = rPropSet->getPropertyValue(C2U("FontWeight"));
- float nBold = 0;
- aTmp >>= nBold;
-
- if (nBold >= 150)
- {
- nFlags |= 0x02;
- sal_uInt8 nTmp=0x01;
- *rContent << nTmp;
- nTmp=0x00;
- *rContent << nTmp;
- *rContent << nTmp;
- *rContent << nTmp;
- }
-
- aTmp = rPropSet->getPropertyValue(C2U("FontHeight"));
- float nFontHeight = 0;
- aTmp >>= nFontHeight;
- if (nFontHeight)
- {
- nFlags |= 0x04;
- // very strange way of storing font sizes:
- // 1pt->30, 2pt->45, 3pt->60, 4pt->75, 5pt->105, 6pt->120, 7pt->135
- // 8pt->165, 9pt->180, 10pt->195, 11pt->225, ...
- nFontSize = (nFontHeight == 1) ? 30 : (static_cast<sal_uInt32>((nFontHeight*4+1)/3)*15);
- *rContent << nFontSize;
- }
-
- if (bHasAlign)
- {
- *rContent << sal_uInt16(0x0200);
- nFlags |= 0x10;
-
- nFlags |= 0x20; // ?
-
- aTmp = rPropSet->getPropertyValue(C2U("Align"));
- nFlags |= 0x40;
- sal_Int16 nAlign(0);
- if (aTmp.hasValue())
- aTmp >>= nAlign;
- nJustification = ExportAlign(nAlign);
- *rContent << nJustification;
- }
- }
-
- aFontName.WriteCharArray( *rContent );
- WriteAlign(rContent,4);
-
- sal_uInt16 nFixedAreaLn = static_cast<sal_uInt16>(rContent->Tell()-nOldPos-4);
- rContent->Seek(nOldPos);
- *rContent << nStandardId;
- *rContent << nFixedAreaLn;
- *rContent << nFlags;
- *rContent << sal_uInt8(0x00);
- *rContent << sal_uInt8(0x00);
- *rContent << sal_uInt8(0x00);
-
- WriteAlign(rContent,4);
- return sal_True;
-}
-
-sal_Bool OCX_Image::WriteContents(SvStorageStreamRef &rContents,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- sal_Bool bRet=sal_True;
- sal_uInt32 nOldPos = rContents->Tell();
- rContents->SeekRel(8);
-
- pBlockFlags[0] = 0;
- pBlockFlags[1] = 0x02;
- pBlockFlags[2] = 0;
- pBlockFlags[3] = 0;
-
- uno::Any aTmp = rPropSet->getPropertyValue(
- C2U("BackgroundColor"));
- if (aTmp.hasValue())
- aTmp >>= mnBackColor;
- *rContents << ExportColor(mnBackColor);
- pBlockFlags[0] |= 0x10;
-
-
- aTmp = rPropSet->getPropertyValue(C2U("Border"));
- sal_Int16 nBorder = sal_Int16();
- aTmp >>= nBorder;
- nSpecialEffect = ExportBorder(nBorder,nBorderStyle);
- *rContents << nBorderStyle;
- pBlockFlags[0] |= 0x20;
-
- *rContents << nSpecialEffect;
- pBlockFlags[1] |= 0x01;
-
- WriteAlign(rContents,4);
-
- aTmp = rPropSet->getPropertyValue(C2U("Enabled"));
- fEnabled = any2bool(aTmp);
- if (fEnabled)
- {
- sal_uInt8 nTemp = 0x19;
- *rContents << nTemp;
- pBlockFlags[1] |= 0x20;
- *rContents << sal_uInt8(0x00);
- *rContents << sal_uInt8(0x00);
- *rContents << sal_uInt8(0x00);
- }
-
- aTmp = rPropSet->getPropertyValue(C2U("ImageURL"));
- /*Magically fetch that image and turn it into something that
- *we can store in ms controls, wmf,png,jpg are almost certainly
- *the options we have for export...*/
-
- WriteAlign(rContents,4);
- *rContents << rSize.Width;
- *rContents << rSize.Height;
-
- WriteAlign(rContents,4);
- nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4);
-
- rContents->Seek(nOldPos);
- *rContents << nStandardId;
- *rContents << nFixedAreaLen;
-
- *rContents << pBlockFlags[0];
- *rContents << pBlockFlags[1];
- *rContents << pBlockFlags[2];
- *rContents << pBlockFlags[3];
- DBG_ASSERT((rContents.Is() &&
- (SVSTREAM_OK==rContents->GetError())),"damn");
- return bRet;
-}
-
-
-sal_Bool OCX_Image::Export(SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet > &rPropSet,
- const awt::Size &rSize)
-{
- static sal_uInt8 const aCompObj[] = {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x41, 0x92, 0x59, 0x4C,
- 0x26, 0x69, 0x1B, 0x10, 0x99, 0x92, 0x00, 0x00,
- 0x0B, 0x65, 0xC6, 0xF9, 0x1A, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x49, 0x6D, 0x61, 0x67,
- 0x65, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
- 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
- 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x0E, 0x00,
- 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
- 0x49, 0x6D, 0x61, 0x67, 0x65, 0x2E, 0x31, 0x00,
- 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] = {
- 0x49, 0x00, 0x6D, 0x00, 0x61, 0x00, 0x67, 0x00,
- 0x65, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-// ============================================================================
-
-OCX_SpinButton::OCX_SpinButton() :
- OCX_Control( OUString( RTL_CONSTASCII_USTRINGPARAM( "SpinButton" ) ) ),
- mnBlockFlags( 0 ),
- mnValue( 0 ),
- mnMin( 0 ),
- mnMax( 100 ),
- mnSmallStep( 1 ),
- mnPageStep( 1 ),
- mnOrient( -1 ),
- mnDelay( 50 ),
- mbEnabled( true ),
- mbLocked( false ),
- mbPropThumb( true )
-{
- msFormType = C2U("com.sun.star.form.component.SpinButton");
- msDialogType = C2U("com.sun.star.form.component.SpinButton");
- mnBackColor = 0x8000000F;
- mnForeColor = 0x80000012;
-}
-
-OCX_Control* OCX_SpinButton::Create()
-{
- return new OCX_SpinButton;
-}
-
-sal_Bool OCX_SpinButton::Export(
- SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet>& rPropSet,
- const awt::Size& rSize )
-{
- static sal_uInt8 const aCompObj[] =
- {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xB0, 0x6F, 0x17, 0x79,
- 0xF2, 0xB7, 0xCE, 0x11, 0x97, 0xEF, 0x00, 0xAA,
- 0x00, 0x6D, 0x27, 0x76, 0x1F, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x53, 0x70, 0x69, 0x6E,
- 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x00, 0x10,
- 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64,
- 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65,
- 0x63, 0x74, 0x00, 0x13, 0x00, 0x00, 0x00, 0x46,
- 0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E,
- 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] =
- {
- 0x53, 0x00, 0x70, 0x00, 0x69, 0x00, 0x6E, 0x00,
- 0x42, 0x00, 0x75, 0x00, 0x74, 0x00, 0x74, 0x00,
- 0x6F, 0x00, 0x6E, 0x00, 0x31, 0x00, 0x00, 0x00,
- 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-sal_Bool OCX_SpinButton::WriteContents(
- SvStorageStreamRef &rObj,
- const uno::Reference< beans::XPropertySet> &rPropSet,
- const awt::Size& rSize )
-{
- if( !rObj.Is() )
- return sal_False;
-
- mnBlockFlags = 0x00000008;
- nWidth = rSize.Width;
- nHeight = rSize.Height;
-
- GetInt32Property( mnForeColor, rPropSet, C2U( "SymbolColor" ), 0x00000001 );
- GetInt32Property( mnBackColor, rPropSet, C2U( "BackgroundColor" ), 0x00000002 );
- GetBoolProperty( mbEnabled, rPropSet, C2U( "Enabled" ), 0x00000304 );
- GetInt32Property( mnMin, rPropSet, C2U( "SpinValueMin" ), 0x00000020 );
- GetInt32Property( mnMax, rPropSet, C2U( "SpinValueMax" ), 0x00000040 );
- GetInt32Property( mnValue, rPropSet, C2U( "SpinValue" ), 0x00000080 );
- GetInt32Property( mnSmallStep, rPropSet, C2U( "SpinIncrement" ), 0x00000800 );
- GetInt32Property( mnDelay, rPropSet, C2U( "RepeatDelay" ), 0x00008000 );
-
- namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation;
- sal_Int16 nApiOrient = sal_Int16();
- if( rPropSet->getPropertyValue( C2U( "Orientation" ) ) >>= nApiOrient )
- UpdateInt32Property( mnOrient, (nApiOrient == AwtScrollOrient::VERTICAL) ? 0 : 1, 0x00002000 );
-
- return WriteData( *rObj );
-}
-
-void OCX_SpinButton::UpdateInt32Property(
- sal_Int32& rnCoreValue, sal_Int32 nNewValue, sal_Int32 nBlockFlag )
-{
- if( nNewValue != rnCoreValue )
- {
- rnCoreValue = nNewValue;
- mnBlockFlags |= nBlockFlag;
- }
-}
-
-void OCX_SpinButton::GetInt32Property(
- sal_Int32& rnCoreValue, const uno::Reference< beans::XPropertySet>& rxPropSet,
- const OUString& rPropName, sal_Int32 nBlockFlag )
-{
- sal_Int32 nNewValue = 0;
- if( rxPropSet->getPropertyValue( rPropName ) >>= nNewValue )
- UpdateInt32Property( rnCoreValue, nNewValue, nBlockFlag );
-}
-
-void OCX_SpinButton::UpdateBoolProperty(
- bool& rbCoreValue, bool bNewValue, sal_Int32 nBlockFlag )
-{
- if( bNewValue != rbCoreValue )
- {
- rbCoreValue = bNewValue;
- mnBlockFlags |= nBlockFlag;
- }
-}
-
-void OCX_SpinButton::GetBoolProperty(
- bool& rbCoreValue, const uno::Reference< beans::XPropertySet>& rxPropSet,
- const OUString& rPropName, sal_Int32 nBlockFlag )
-{
- UpdateBoolProperty( rbCoreValue,
- any2bool( rxPropSet->getPropertyValue( rPropName ) ), nBlockFlag );
-}
-
-sal_Bool OCX_SpinButton::WriteData( SvStream& rStrm ) const
-{
- sal_Bool bRet = sal_True;
- sal_uLong nStartPos = rStrm.Tell();
-
- rStrm << sal_Int32( 0 ) << mnBlockFlags;
-
- if( mnBlockFlags & 0x00000001 ) rStrm << ExportColor( mnForeColor );
- if( mnBlockFlags & 0x00000002 ) rStrm << ExportColor( mnBackColor );
- if( mnBlockFlags & 0x00000004 )
- {
- sal_Int32 nFlags = 0x00000019; // always set
- if( mbEnabled ) nFlags |= 0x00000002;
- if( mbLocked ) nFlags |= 0x00000004;
- rStrm << nFlags;
- }
- if( mnBlockFlags & 0x00000020 ) rStrm << mnMin;
- if( mnBlockFlags & 0x00000040 ) rStrm << mnMax;
- if( mnBlockFlags & 0x00000080 ) rStrm << mnValue;
- if( mnBlockFlags & 0x00000100 ) rStrm << sal_Int32( 0 ); // unknown
- if( mnBlockFlags & 0x00000200 ) rStrm << sal_Int32( 0 ); // unknown
- if( mnBlockFlags & 0x00000400 ) rStrm << sal_Int32( 0 ); // unknown
- if( mnBlockFlags & 0x00000800 ) rStrm << mnSmallStep;
- if( mnBlockFlags & 0x00001000 ) rStrm << mnPageStep;
- if( mnBlockFlags & 0x00002000 ) rStrm << mnOrient;
- if( mnBlockFlags & 0x00004000 ) rStrm << sal_Int32( mbPropThumb ? 1 : 0 );
- if( mnBlockFlags & 0x00008000 ) rStrm << mnDelay;
- if( mnBlockFlags & 0x00000008 ) rStrm << nWidth << nHeight;
-
- sal_uInt16 nSize = static_cast< sal_uInt16 >( rStrm.Tell() - nStartPos - 4 );
- rStrm.Seek( nStartPos );
- rStrm << nStandardId << nSize;
-
- DBG_ASSERT( rStrm.GetError() == SVSTREAM_OK, "OCX_SpinButton::WriteData - error in stream" );
- return bRet;
-}
-
-// ============================================================================
-
-OCX_ScrollBar::OCX_ScrollBar()
-{
- sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ScrollBar" ) );
- mnMax = 32767;
- msFormType = C2U("com.sun.star.form.component.ScrollBar");
- msDialogType = C2U("com.sun.star.form.component.ScrollBar");
-
-}
-
-OCX_Control* OCX_ScrollBar::Create()
-{
- return new OCX_ScrollBar;
-}
-
-sal_Bool OCX_ScrollBar::Export(
- SvStorageRef &rObj,
- const uno::Reference< beans::XPropertySet>& rPropSet,
- const awt::Size& rSize )
-{
- static sal_uInt8 const aCompObj[] =
- {
- 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x81, 0xD1, 0xDF,
- 0x2F, 0x5E, 0xCE, 0x11, 0xA4, 0x49, 0x00, 0xAA,
- 0x00, 0x4A, 0x80, 0x3D, 0x1E, 0x00, 0x00, 0x00,
- 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
- 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
- 0x32, 0x2E, 0x30, 0x20, 0x53, 0x63, 0x72, 0x6F,
- 0x6C, 0x6C, 0x42, 0x61, 0x72, 0x00, 0x10, 0x00,
- 0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64,
- 0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63,
- 0x74, 0x00, 0x12, 0x00, 0x00, 0x00, 0x46, 0x6F,
- 0x72, 0x6D, 0x73, 0x2E, 0x53, 0x63, 0x72, 0x6F,
- 0x6C, 0x6C, 0x42, 0x61, 0x72, 0x2E, 0x31, 0x00,
- 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj")));
- xStor->Write(aCompObj,sizeof(aCompObj));
- DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn");
- }
-
- {
- SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo")));
- xStor3->Write(aObjInfo,sizeof(aObjInfo));
- DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn");
- }
-
- static sal_uInt8 const aOCXNAME[] =
- {
- 0x53, 0x00, 0x63, 0x00, 0x72, 0x00, 0x6F, 0x00,
- 0x6C, 0x00, 0x6C, 0x00, 0x42, 0x00, 0x61, 0x00,
- 0x72, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- {
- SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME")));
- xStor2->Write(aOCXNAME,sizeof(aOCXNAME));
- DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn");
- }
-
- SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents")));
- return WriteContents(xContents, rPropSet, rSize);
-}
-
-sal_Bool OCX_ScrollBar::WriteContents(
- SvStorageStreamRef &rObj,
- const uno::Reference< beans::XPropertySet> &rPropSet,
- const awt::Size& rSize )
-{
- if( !rObj.Is() )
- return sal_False;
-
- mnBlockFlags = 0x00000008;
- nWidth = rSize.Width;
- nHeight = rSize.Height;
-
- GetInt32Property( mnForeColor, rPropSet, C2U( "SymbolColor" ), 0x00000001 );
- GetInt32Property( mnBackColor, rPropSet, C2U( "BackgroundColor" ), 0x00000002 );
- GetBoolProperty( mbEnabled, rPropSet, C2U( "Enabled" ), 0x00000304 );
- GetInt32Property( mnMin, rPropSet, C2U( "ScrollValueMin" ), 0x00000020 );
- GetInt32Property( mnMax, rPropSet, C2U( "ScrollValueMax" ), 0x00000040 );
- GetInt32Property( mnValue, rPropSet, C2U( "ScrollValue" ), 0x00000080 );
- GetInt32Property( mnSmallStep, rPropSet, C2U( "LineIncrement" ), 0x00000800 );
- GetInt32Property( mnPageStep, rPropSet, C2U( "BlockIncrement" ), 0x00001000 );
- GetInt32Property( mnDelay, rPropSet, C2U( "RepeatDelay" ), 0x00008000 );
-
- namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation;
- sal_Int16 nApiOrient = sal_Int16();
- if( rPropSet->getPropertyValue( C2U( "Orientation" ) ) >>= nApiOrient )
- UpdateInt32Property( mnOrient, (nApiOrient == AwtScrollOrient::VERTICAL) ? 0 : 1, 0x00002000 );
-
- UpdateBoolProperty( mbPropThumb, true, 0x00004000 );
-
- return WriteData( *rObj );
-}
-
-OCX_ProgressBar::OCX_ProgressBar() :
- OCX_Control( OUString( RTL_CONSTASCII_USTRINGPARAM( "ProgressBar" ) ) ),
- nMin( 0 ),
- nMax( 0 ),
- bFixedSingle(true),
- bEnabled( true ),
- b3d( true )
-{
- msDialogType = C2U("com.sun.star.awt.UnoControlProgressBarModel");
- bSetInDialog = true;
-}
-
-OCX_Control* OCX_ProgressBar::Create()
-{
- return new OCX_ProgressBar;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 70ee252a9323..50fd5436e96e 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -1640,14 +1640,14 @@ SdrPowerPointImport::~SdrPowerPointImport()
delete[] pPersistPtr;
}
-sal_Bool PPTConvertOCXControls::ReadOCXStream( SotStorageRef& /*rSrc1*/,
+sal_Bool PPTConvertOCXControls::ReadOCXStream( SotStorageRef& rSrc,
com::sun::star::uno::Reference<
com::sun::star::drawing::XShape > *pShapeRef,
sal_Bool bFloatingCtrl )
{
bool bRes = false;
uno::Reference< form::XFormComponent > xFComp;
- if ( mpPPTImporter && mpPPTImporter->ReadFormControl( mxInStrm, xFComp ) )
+ if ( mpPPTImporter && mpPPTImporter->ReadFormControl( rSrc, xFComp ) )
{
if ( xFComp.is() )
{
@@ -1715,9 +1715,8 @@ sal_Bool PPTConvertOCXControls::InsertControl(
};
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& PPTConvertOCXControls::GetDrawPage()
{
- if( !xDrawPage.is() && pDocSh )
+ if( !xDrawPage.is() && mxModel.is() )
{
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel( pDocSh->GetModel() );
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > xDrawPages;
switch( ePageKind )
{
@@ -1725,7 +1724,7 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >&
case PPT_NOTEPAGE :
{
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPagesSupplier >
- xDrawPagesSupplier( xModel, ::com::sun::star::uno::UNO_QUERY);
+ xDrawPagesSupplier( mxModel, ::com::sun::star::uno::UNO_QUERY);
if ( xDrawPagesSupplier.is() )
xDrawPages = xDrawPagesSupplier->getDrawPages();
}
@@ -1734,7 +1733,7 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >&
case PPT_MASTERPAGE :
{
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPagesSupplier >
- xMasterPagesSupplier( xModel, ::com::sun::star::uno::UNO_QUERY);
+ xMasterPagesSupplier( mxModel, ::com::sun::star::uno::UNO_QUERY);
if ( xMasterPagesSupplier.is() )
xDrawPages = xMasterPagesSupplier->getMasterPages();
}
@@ -1872,7 +1871,8 @@ SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId,
if ( !pRet && ( pOe->nType == PPT_PST_ExControl ) )
{
uno::Reference< io::XInputStream > xIStrm = new utl::OSeekableInputStreamWrapper(*pDest );
- PPTConvertOCXControls aPPTConvertOCXControls( this, xIStrm, pOe->pShell, eAktPageKind );
+ uno::Reference< frame::XModel > xModel( pOe->pShell ? pOe->pShell->GetModel() : NULL );
+ PPTConvertOCXControls aPPTConvertOCXControls( this, xIStrm, xModel, eAktPageKind );
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape;
if ( aPPTConvertOCXControls.ReadOCXStream( xObjStor, &xShape, sal_False ) )
pRet = GetSdrObjectFromXShape( xShape );
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index 9a0295cf8fa1..1a3dceefd71c 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -61,6 +61,7 @@ $(eval $(call gb_Library_add_linked_libs,oox,\
svl \
svt \
svxcore \
+ sot \
tl \
utl \
vcl \
@@ -213,6 +214,8 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
oox/source/helper/textinputstream \
oox/source/helper/zipstorage \
oox/source/ole/axbinaryreader \
+ oox/source/ole/axbinarywriter \
+ oox/source/ole/axfontdata \
oox/source/ole/axcontrol \
oox/source/ole/axcontrolfragment \
oox/source/ole/olehelper \
diff --git a/oox/inc/oox/helper/binaryoutputstream.hxx b/oox/inc/oox/helper/binaryoutputstream.hxx
index 3441f9726fa9..b0cc8b259935 100644
--- a/oox/inc/oox/helper/binaryoutputstream.hxx
+++ b/oox/inc/oox/helper/binaryoutputstream.hxx
@@ -70,16 +70,33 @@ public:
template< typename Type >
void writeValue( Type nValue );
+ template< typename Type >
+ void writeArray( Type* opnArray, sal_Int32 nElemCount );
+
/** Stream operator for all data types supported by the writeValue() function. */
template< typename Type >
inline BinaryOutputStream& operator<<( Type nValue ) { writeValue( nValue ); return *this; }
+ void writeCompressedUnicodeArray( const ::rtl::OUString& rString, bool bCompressed, bool bAllowNulChars = false );
+
+ void writeCharArrayUC( const ::rtl::OUString& rString, rtl_TextEncoding eTextEnc, bool bAllowNulChars = false );
+
+ void writeUnicodeArray( const ::rtl::OUString& rString, bool bAllowNulChars = false );
+
protected:
/** This dummy default c'tor will never call the c'tor of the virtual base
class BinaryStreamBase as this class cannot be instanciated directly. */
inline explicit BinaryOutputStream() : BinaryStreamBase( false ) {}
};
+template< typename Type >
+void BinaryOutputStream::writeArray( Type* opnArray, sal_Int32 nElemCount )
+{
+ sal_Int32 nWriteSize = getLimitedValue< sal_Int32, sal_Int32 >( nElemCount, 0, SAL_MAX_INT32 / sizeof( Type ) ) * sizeof( Type );
+ ByteOrderConverter::convertLittleEndianArray( opnArray, static_cast< size_t >( nWriteSize ) );
+ writeMemory( opnArray, nWriteSize, sizeof( Type ) );
+}
+
typedef ::boost::shared_ptr< BinaryOutputStream > BinaryOutputStreamRef;
// ----------------------------------------------------------------------------
diff --git a/oox/inc/oox/ole/axbinaryreader.hxx b/oox/inc/oox/ole/axbinaryreader.hxx
index 5d7e9a6d4f25..f4fab1277624 100644
--- a/oox/inc/oox/ole/axbinaryreader.hxx
+++ b/oox/inc/oox/ole/axbinaryreader.hxx
@@ -32,6 +32,7 @@
#include <utility>
#include "oox/helper/binaryinputstream.hxx"
#include "oox/helper/refvector.hxx"
+#include "oox/ole/axfontdata.hxx"
namespace oox {
namespace ole {
@@ -99,48 +100,6 @@ typedef ::std::vector< ::rtl::OUString > AxStringArray;
// ============================================================================
-const sal_Char* const AX_GUID_CFONT = "{AFC20920-DA4E-11CE-B943-00AA006887B4}";
-
-const sal_uInt32 AX_FONTDATA_BOLD = 0x00000001;
-const sal_uInt32 AX_FONTDATA_ITALIC = 0x00000002;
-const sal_uInt32 AX_FONTDATA_UNDERLINE = 0x00000004;
-const sal_uInt32 AX_FONTDATA_STRIKEOUT = 0x00000008;
-const sal_uInt32 AX_FONTDATA_DISABLED = 0x00002000;
-const sal_uInt32 AX_FONTDATA_AUTOCOLOR = 0x40000000;
-
-const sal_Int32 AX_FONTDATA_LEFT = 1;
-const sal_Int32 AX_FONTDATA_RIGHT = 2;
-const sal_Int32 AX_FONTDATA_CENTER = 3;
-
-/** All entries of a font property. */
-struct AxFontData
-{
- ::rtl::OUString maFontName; /// Name of the used font.
- sal_uInt32 mnFontEffects; /// Font effect flags.
- sal_Int32 mnFontHeight; /// Height of the font (not really twips, see code).
- sal_Int32 mnFontCharSet; /// Windows character set of the font.
- sal_Int32 mnHorAlign; /// Horizontal text alignment.
- bool mbDblUnderline; /// True = double underline style (legacy VML drawing controls only).
-
- explicit AxFontData();
-
- /** Converts the internal representation of the font height to points. */
- sal_Int16 getHeightPoints() const;
- /** Converts the passed font height from points to the internal representation. */
- void setHeightPoints( sal_Int16 nPoints );
-
- /** Reads the font data settings from the passed input stream. */
- bool importBinaryModel( BinaryInputStream& rInStrm );
- /** Reads the font data settings from the passed input stream that contains
- an OLE StdFont structure. */
- bool importStdFont( BinaryInputStream& rInStrm );
- /** Reads the font data settings from the passed input stream depending on
- the GUID preceding the actual font data. */
- bool importGuidAndFont( BinaryInputStream& rInStrm );
-};
-
-// ============================================================================
-
/** Import helper to read simple and complex ActiveX form control properties
from a binary input stream. */
class AxBinaryPropertyReader
diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx
index 2f06aca5ee7d..ee3a9acc5c53 100644
--- a/oox/inc/oox/ole/axcontrol.hxx
+++ b/oox/inc/oox/ole/axcontrol.hxx
@@ -64,23 +64,23 @@ const sal_uInt16 COMCTL_VERSION_60 = 6;
// ----------------------------------------------------------------------------
-#define AX_GUID_COMMANDBUTTON "{D7053240-CE69-11CD-A777-00DD01143C57}"
-#define AX_GUID_LABEL "{978C9E23-D4B0-11CE-BF2D-00AA003F40D0}"
-#define AX_GUID_IMAGE "{4C599241-6926-101B-9992-00000B65C6F9}"
-#define AX_GUID_TOGGLEBUTTON "{8BD21D60-EC42-11CE-9E0D-00AA006002F3}"
-#define AX_GUID_CHECKBOX "{8BD21D40-EC42-11CE-9E0D-00AA006002F3}"
-#define AX_GUID_OPTIONBUTTON "{8BD21D50-EC42-11CE-9E0D-00AA006002F3}"
-#define AX_GUID_TEXTBOX "{8BD21D10-EC42-11CE-9E0D-00AA006002F3}"
-#define AX_GUID_LISTBOX "{8BD21D20-EC42-11CE-9E0D-00AA006002F3}"
-#define AX_GUID_COMBOBOX "{8BD21D30-EC42-11CE-9E0D-00AA006002F3}"
-#define AX_GUID_SPINBUTTON "{79176FB0-B7F2-11CE-97EF-00AA006D2776}"
-#define AX_GUID_SCROLLBAR "{DFD181E0-5E2F-11CE-A449-00AA004A803D}"
-#define AX_GUID_FRAME "{6E182020-F460-11CE-9BCD-00AA00608E01}"
+#define AX_GUID_COMMANDBUTTON "{D7053240-CE69-11CD-a777-00dd01143c57}"
+#define AX_GUID_LABEL "{978C9E23-D4B0-11CE-bf2d-00aa003f40d0}"
+#define AX_GUID_IMAGE "{4C599241-6926-101B-9992-00000b65c6f9}"
+#define AX_GUID_TOGGLEBUTTON "{8BD21D60-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_CHECKBOX "{8BD21D40-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_OPTIONBUTTON "{8BD21D50-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_TEXTBOX "{8BD21D10-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_LISTBOX "{8BD21D20-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_COMBOBOX "{8BD21D30-EC42-11CE-9e0d-00aa006002f3}"
+#define AX_GUID_SPINBUTTON "{79176FB0-B7F2-11CE-97ef-00aa006d2776}"
+#define AX_GUID_SCROLLBAR "{DFD181E0-5E2F-11CE-a449-00aa004a803d}"
+#define AX_GUID_FRAME "{6E182020-F460-11CE-9bcd-00aa00608e01}"
// Html control GUID(s)
-#define HTML_GUID_SELECT "{5512D122-5CC6-11CF-8D67-00AA00BDCE1D}"
-#define HTML_GUID_TEXTBOX "{5512D124-5CC6-11CF-8D67-00AA00BDCE1D}"
+#define HTML_GUID_SELECT "{5512D122-5CC6-11CF-8d67-00aa00bdce1d}"
+#define HTML_GUID_TEXTBOX "{5512D124-5CC6-11CF-8d67-00aa00bdce1d}"
const sal_uInt32 AX_SYSCOLOR_WINDOWBACK = 0x80000005;
const sal_uInt32 AX_SYSCOLOR_WINDOWFRAME = 0x80000006;
@@ -224,6 +224,12 @@ public:
sal_Int32 nPropId,
sal_uInt32 nOleColor ) const;
+ void convertToMSColor(
+ PropertySet& rPropSet,
+ sal_Int32 nPropId,
+ sal_uInt32& nOleColor ) const;
+
+
/** Converts the passed StdPic picture stream to UNO properties. */
void convertPicture(
PropertyMap& rPropMap,
@@ -234,6 +240,11 @@ public:
PropertyMap& rPropMap,
bool bHorizontal ) const;
+ void convertToMSOrientation(
+ PropertySet& rPropMap,
+ bool& bHorizontal ) const;
+
+ /** Converts the vertical alignment to UNO properties. */
/** Converts the vertical alignment to UNO properties. */
void convertVerticalAlign(
PropertyMap& rPropMap,
@@ -269,11 +280,21 @@ public:
sal_Int32 nBorderStyle,
sal_Int32 nSpecialEffect ) const;
+ void convertToAxBorder(
+ PropertySet& rPropSet,
+ sal_uInt32& nBorderColor,
+ sal_Int32& nBorderStyle,
+ sal_Int32& nSpecialEffect ) const;
+
/** Converts the Forms 2.0 special effect to UNO properties. */
void convertAxVisualEffect(
PropertyMap& rPropMap,
sal_Int32 nSpecialEffect ) const;
+ void convertToAxVisualEffect(
+ PropertySet& rPropSet,
+ sal_Int32& nSpecialEffect ) const;
+
/** Converts the passed picture stream and Forms 2.0 position to UNO
properties. */
void convertAxPicture(
@@ -299,12 +320,24 @@ public:
ApiDefaultStateMode eDefStateMode,
bool bAwtModel ) const;
+ void convertToAxState(
+ PropertySet& rPropSet,
+ ::rtl::OUString& rValue,
+ sal_Int32& nMultiSelect,
+ ApiDefaultStateMode eDefStateMode,
+ bool bAwtModel ) const;
+
/** Converts the Forms 2.0 control orientation to UNO properties. */
void convertAxOrientation(
PropertyMap& rPropMap,
const AxPairData& rSize,
sal_Int32 nOrientation ) const;
+ void convertToAxOrientation(
+ PropertySet& rPropSet,
+ const AxPairData& rSize,
+ sal_Int32& nOrientation ) const;
+
private:
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxDocModel;
const GraphicHelper& mrGraphicHelper;
@@ -337,11 +370,16 @@ public:
virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
/** Derived classes import a form control model from the passed input stream. */
virtual bool importBinaryModel( BinaryInputStream& rInStrm ) = 0;
-
+ /** Derived classes export a form control model to the passed output stream. */
+ virtual void exportBinaryModel( BinaryOutputStream& /*rOutStrm*/ ) {}
+ /** Derived classes export CompObjStream contents. */
+ virtual void exportCompObj( BinaryOutputStream& /*rOutStrm*/ ) {}
/** Derived classes return the UNO control type enum value. */
virtual ApiControlType getControlType() const = 0;
/** Derived classes convert all control properties. */
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ /** Derived classes convert from uno control properties to equiv. MS values. */
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
/** Converts the control size to UNO properties. */
void convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
@@ -464,7 +502,9 @@ public:
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
/** Returns the font height in points. */
inline sal_Int16 getFontHeight() const { return maFontData.getHeightPoints(); }
@@ -487,9 +527,12 @@ public:
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
public: // direct access needed for legacy VML drawing controls
StreamDataSequence maPictureData; /// Binary picture stream.
@@ -512,9 +555,12 @@ public:
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
public: // direct access needed for legacy VML drawing controls
::rtl::OUString maCaption; /// Visible caption of the button.
@@ -538,6 +584,8 @@ public:
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
@@ -565,6 +613,7 @@ public:
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual void importPictureData( sal_Int32 nPropId, BinaryInputStream& rInStrm );
virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
public: // direct access needed for legacy VML drawing controls
@@ -600,6 +649,8 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
};
// ============================================================================
@@ -612,6 +663,8 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
};
// ============================================================================
@@ -627,6 +680,8 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
};
// ============================================================================
@@ -639,6 +694,8 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
};
// ============================================================================
@@ -651,6 +708,8 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
};
// ============================================================================
@@ -663,6 +722,8 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
};
// ============================================================================
@@ -675,6 +736,8 @@ public:
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
};
// ============================================================================
@@ -687,9 +750,12 @@ public:
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
public: // direct access needed for legacy VML drawing controls
sal_uInt32 mnArrowColor; /// Button arrow color.
@@ -713,9 +779,12 @@ public:
virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue );
virtual bool importBinaryModel( BinaryInputStream& rInStrm );
+ virtual void exportBinaryModel( BinaryOutputStream& rOutStrm );
+ virtual void exportCompObj( BinaryOutputStream& rOutStrm );
virtual ApiControlType getControlType() const;
virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const;
+ virtual void convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv );
public: // direct access needed for legacy VML drawing controls
sal_uInt32 mnArrowColor; /// Button arrow color.
@@ -911,6 +980,10 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
const ControlConverter& rConv ) const;
+ bool convertFromProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxCtrlModel,
+ const ControlConverter& rConv );
+
private:
ControlModelRef mxModel; /// Control model containing the properties.
::rtl::OUString maName; /// Name of the control.
diff --git a/oox/inc/oox/ole/olehelper.hxx b/oox/inc/oox/ole/olehelper.hxx
index efe0b40c2938..e711804aac3f 100644
--- a/oox/inc/oox/ole/olehelper.hxx
+++ b/oox/inc/oox/ole/olehelper.hxx
@@ -35,14 +35,22 @@
#include "oox/helper/graphichelper.hxx"
#include "com/sun/star/form/XFormComponent.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/frame/XModel.hpp"
#include "com/sun/star/frame/XFrame.hpp"
-#include "com/sun/star/awt/XControl.hpp"
+#include "com/sun/star/drawing/XShapes.hpp"
+#include "com/sun/star/awt/XControlModel.hpp"
#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/io/XOutputStream.hpp"
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include "com/sun/star/container/XIndexContainer.hpp"
+#include <filter/msfilter/msocximex.hxx>
#include "oox/dllapi.h"
+#include "sot/storage.hxx"
namespace oox {
class BinaryInputStream;
+ class BinaryOutputStream;
class BinaryXInputStream;
class GraphicHelper;
}
@@ -153,30 +161,53 @@ private:
~OleHelper(); // not implemented
};
-class OOX_DLLPUBLIC OleFormCtrlImportHelper
+// ideally it would be great to get rid of SvxMSConvertOCXControls
+// however msfilter/source/msfilter/svdfppt.cxx still uses
+// SvxMSConvertOCXControls as a base class, unfortunately oox depends on
+// msfilter. Probably the solution would be to move the svdfppt.cxx
+// implementation into the sd module itself.
+class OOX_DLLPUBLIC MSConvertOCXControls : public SvxMSConvertOCXControls
{
- ::oox::StorageRef mpRoot;
- ::oox::StorageRef mpPoolStrg;
- ::oox::BinaryXInputStreamRef mpCtlsStrm;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxDrawPage;
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > mxFormComps;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxServiceFactory;
+protected:
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxCtx;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
::oox::GraphicHelper maGrfHelper;
+
bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
const ::rtl::OUString& rGuidString );
- bool importControlFromStorage( ::oox::StorageRef rxObjStrg,
- ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp );
+ bool importControlFromStream( ::oox::BinaryInputStream& rInStrm,
+ ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
+ const ::rtl::OUString& rGuidString,
+ sal_Int32 nSize );
public:
- OleFormCtrlImportHelper( const ::com::sun::star::uno::Reference< com::sun::star::io::XInputStream > & xInStrm,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxCtx,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
- ~OleFormCtrlImportHelper();
- bool importFormControlFromObjStorage( ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp);
- bool importFormControlFromCtls( ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
+ MSConvertOCXControls( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel );
+ ~MSConvertOCXControls();
+ sal_Bool ReadOCXStorage( SotStorageRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp );
+ sal_Bool ReadOCXCtlsStream(SotStorageStreamRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
sal_Int32 nPos, sal_Int32 nSize );
- bool importFormControlFromObjPool( ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp,
- const ::rtl::OUString& rPoolName );
+ static sal_Bool WriteOCXStream( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, SotStorageRef &rSrc1, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > &rControlModel, const com::sun::star::awt::Size& rSize,rtl::OUString &rName);
+
+#if SvxMSConvertOCXControlsRemoved
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > & GetShapes();
+ const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > & GetFormComps();
+ virtual const com::sun::star::uno::Reference<
+ com::sun::star::drawing::XDrawPage > & GetDrawPage();
+ const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & GetServiceFactory();
+ virtual sal_Bool InsertControl(
+ const com::sun::star::uno::Reference<
+ com::sun::star::form::XFormComponent >& /*rFComp*/,
+ const com::sun::star::awt::Size& /*rSize*/,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape >* /*pShape*/,
+ sal_Bool /*bFloatingCtrl*/ ) {return sal_False;}
+#endif
};
+
+
// ============================================================================
} // namespace ole
diff --git a/oox/source/helper/binaryoutputstream.cxx b/oox/source/helper/binaryoutputstream.cxx
index 76f08ed67ff8..c96eeb95997f 100644
--- a/oox/source/helper/binaryoutputstream.cxx
+++ b/oox/source/helper/binaryoutputstream.cxx
@@ -40,6 +40,10 @@ namespace oox {
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::uno;
+using ::rtl::OString;
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
+
namespace {
const sal_Int32 OUTPUTSTREAM_BUFFERSIZE = 0x8000;
@@ -110,6 +114,34 @@ void BinaryXOutputStream::writeMemory( const void* pMem, sal_Int32 nBytes, size_
}
}
+void
+BinaryOutputStream::writeCharArrayUC( const OUString& rString, rtl_TextEncoding eTextEnc, bool bAllowNulChars )
+{
+ OString sBuf( OUStringToOString( rString, eTextEnc ) );
+ if( !bAllowNulChars )
+ sBuf.replace( '\0', '?' );
+ writeMemory( static_cast< const void* >( sBuf.getStr() ), sBuf.getLength() );
+}
+
+void
+BinaryOutputStream::writeUnicodeArray( const ::rtl::OUString& rString, bool bAllowNulChars )
+{
+ OUString sBuf( rString );
+ if( !bAllowNulChars )
+ sBuf.replace( '\0', '?' );
+ writeArray( sBuf.getStr(), sBuf.getLength() );
+}
+
+void
+BinaryOutputStream::writeCompressedUnicodeArray( const rtl::OUString& rString, bool bCompressed, bool bAllowNulChars )
+{
+ if ( bCompressed )
+ // ISO-8859-1 maps all byte values 0xHH to the same Unicode code point U+00HH
+ writeCharArrayUC( rString, RTL_TEXTENCODING_ISO_8859_1, bAllowNulChars );
+ else
+ writeUnicodeArray( rString, bAllowNulChars );
+}
+
// ============================================================================
SequenceOutputStream::SequenceOutputStream( StreamDataSequence& rData ) :
diff --git a/oox/source/ole/axbinaryreader.cxx b/oox/source/ole/axbinaryreader.cxx
index af3076477c56..af9ed4fc040f 100644
--- a/oox/source/ole/axbinaryreader.cxx
+++ b/oox/source/ole/axbinaryreader.cxx
@@ -121,76 +121,6 @@ void AxAlignedInputStream::align( size_t nSize )
// ============================================================================
-AxFontData::AxFontData() :
- mnFontEffects( 0 ),
- mnFontHeight( 160 ),
- mnFontCharSet( WINDOWS_CHARSET_DEFAULT ),
- mnHorAlign( AX_FONTDATA_LEFT ),
- mbDblUnderline( false )
-{
-}
-
-sal_Int16 AxFontData::getHeightPoints() const
-{
- /* MSO uses weird font sizes:
- 1pt->30, 2pt->45, 3pt->60, 4pt->75, 5pt->105, 6pt->120, 7pt->135,
- 8pt->165, 9pt->180, 10pt->195, 11pt->225, ... */
- return getLimitedValue< sal_Int16, sal_Int32 >( (mnFontHeight + 10) / 20, 1, SAL_MAX_INT16 );
-}
-
-void AxFontData::setHeightPoints( sal_Int16 nPoints )
-{
- mnFontHeight = getLimitedValue< sal_Int32, sal_Int32 >( ((nPoints * 4 + 1) / 3) * 15, 30, 4294967 );
-}
-
-bool AxFontData::importBinaryModel( BinaryInputStream& rInStrm )
-{
- AxBinaryPropertyReader aReader( rInStrm );
- aReader.readStringProperty( maFontName );
- aReader.readIntProperty< sal_uInt32 >( mnFontEffects );
- aReader.readIntProperty< sal_Int32 >( mnFontHeight );
- aReader.skipIntProperty< sal_Int32 >(); // font offset
- aReader.readIntProperty< sal_uInt8 >( mnFontCharSet );
- aReader.skipIntProperty< sal_uInt8 >(); // font pitch/family
- aReader.readIntProperty< sal_uInt8 >( mnHorAlign );
- aReader.skipIntProperty< sal_uInt16 >(); // font weight
- mbDblUnderline = false;
- return aReader.finalizeImport();
-}
-
-bool AxFontData::importStdFont( BinaryInputStream& rInStrm )
-{
- StdFontInfo aFontInfo;
- if( OleHelper::importStdFont( aFontInfo, rInStrm, false ) )
- {
- maFontName = aFontInfo.maName;
- mnFontEffects = 0;
- setFlag( mnFontEffects, AX_FONTDATA_BOLD, aFontInfo.mnWeight >= OLE_STDFONT_BOLD );
- setFlag( mnFontEffects, AX_FONTDATA_ITALIC, getFlag( aFontInfo.mnFlags, OLE_STDFONT_ITALIC ) );
- setFlag( mnFontEffects, AX_FONTDATA_UNDERLINE, getFlag( aFontInfo.mnFlags, OLE_STDFONT_UNDERLINE ) );
- setFlag( mnFontEffects, AX_FONTDATA_STRIKEOUT, getFlag( aFontInfo.mnFlags,OLE_STDFONT_STRIKE ) );
- mbDblUnderline = false;
- // StdFont stores font height in 1/10,000 of points
- setHeightPoints( getLimitedValue< sal_Int16, sal_Int32 >( aFontInfo.mnHeight / 10000, 0, SAL_MAX_INT16 ) );
- mnFontCharSet = aFontInfo.mnCharSet;
- mnHorAlign = AX_FONTDATA_LEFT;
- return true;
- }
- return false;
-}
-
-bool AxFontData::importGuidAndFont( BinaryInputStream& rInStrm )
-{
- OUString aGuid = OleHelper::importGuid( rInStrm );
- if( aGuid.equalsAscii( AX_GUID_CFONT ) )
- return importBinaryModel( rInStrm );
- if( aGuid.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(OLE_GUID_STDFONT) ) )
- return importStdFont( rInStrm );
- return false;
-}
-
-// ============================================================================
-
namespace {
bool lclReadString( AxAlignedInputStream& rInStrm, OUString& rValue, sal_uInt32 nSize, bool bArrayString )
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index ef8ac40b00fe..a9e6d3724c59 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -61,8 +61,8 @@
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/graphichelper.hxx"
#include "oox/helper/propertymap.hxx"
+#include "oox/ole/axbinarywriter.hxx"
#include "tools/string.hxx"
-
namespace oox {
namespace ole {
@@ -281,6 +281,12 @@ void ControlConverter::convertColor( PropertyMap& rPropMap, sal_Int32 nPropId, s
rPropMap.setProperty( nPropId, OleHelper::decodeOleColor( mrGraphicHelper, nOleColor, mbDefaultColorBgr ) );
}
+void ControlConverter::convertToMSColor( PropertySet& rPropSet, sal_Int32 nPropId, sal_uInt32& nOleColor ) const
+{
+ sal_uInt32 nRGB = 0;
+ rPropSet.getProperty( nRGB, nPropId );
+ nOleColor = OleHelper::encodeOleColor( nRGB );
+}
void ControlConverter::convertPicture( PropertyMap& rPropMap, const StreamDataSequence& rPicData ) const
{
if( rPicData.hasElements() )
@@ -297,6 +303,13 @@ void ControlConverter::convertOrientation( PropertyMap& rPropMap, bool bHorizont
rPropMap.setProperty( PROP_Orientation, nScrollOrient );
}
+void ControlConverter::convertToMSOrientation( PropertySet& rPropSet, bool& bHorizontal ) const
+{
+ sal_Int32 nScrollOrient = ScrollBarOrientation::HORIZONTAL;
+ if ( rPropSet.getProperty( nScrollOrient, PROP_Orientation ) )
+ bHorizontal = ( nScrollOrient == ScrollBarOrientation::HORIZONTAL );
+}
+
void ControlConverter::convertVerticalAlign( PropertyMap& rPropMap, sal_Int32 nVerticalAlign ) const
{
VerticalAlignment eAlign = VerticalAlignment_TOP;
@@ -420,12 +433,42 @@ void ControlConverter::convertAxBorder( PropertyMap& rPropMap,
convertColor( rPropMap, PROP_BorderColor, nBorderColor );
}
+void ControlConverter::convertToAxBorder( PropertySet& rPropSet,
+ sal_uInt32& nBorderColor, sal_Int32& nBorderStyle, sal_Int32& nSpecialEffect ) const
+{
+ sal_Int16 nBorder = API_BORDER_NONE;
+ rPropSet.getProperty( nBorder, PROP_Border );
+ nBorderStyle = AX_BORDERSTYLE_NONE;
+ nSpecialEffect = AX_SPECIALEFFECT_FLAT;
+ switch ( nBorder )
+ {
+ case API_BORDER_FLAT:
+ nBorderStyle = AX_BORDERSTYLE_SINGLE;
+ break;
+ case API_BORDER_SUNKEN:
+ nSpecialEffect = AX_SPECIALEFFECT_SUNKEN;
+ case API_BORDER_NONE:
+ default:
+ break;
+ };
+ convertToMSColor( rPropSet, PROP_BorderColor, nBorderColor );
+}
+
void ControlConverter::convertAxVisualEffect( PropertyMap& rPropMap, sal_Int32 nSpecialEffect ) const
{
sal_Int16 nVisualEffect = (nSpecialEffect == AX_SPECIALEFFECT_FLAT) ? VisualEffect::FLAT : VisualEffect::LOOK3D;
rPropMap.setProperty( PROP_VisualEffect, nVisualEffect );
}
+void ControlConverter::convertToAxVisualEffect( PropertySet& rPropSet, sal_Int32& nSpecialEffect ) const
+{
+ sal_Int16 nVisualEffect = AX_SPECIALEFFECT_FLAT;
+ rPropSet.getProperty( nVisualEffect, PROP_VisualEffect );
+ // is this appropriate AX_SPECIALEFFECT_XXXX value ?
+ if (nVisualEffect == VisualEffect::LOOK3D )
+ nSpecialEffect = AX_SPECIALEFFECT_RAISED;
+}
+
void ControlConverter::convertAxPicture( PropertyMap& rPropMap, const StreamDataSequence& rPicData, sal_uInt32 nPicPos ) const
{
// the picture
@@ -496,6 +539,39 @@ void ControlConverter::convertAxState( PropertyMap& rPropMap,
rPropMap.setProperty( PROP_TriState, nMultiSelect == AX_SELCTION_MULTI );
}
+void ControlConverter::convertToAxState( PropertySet& rPropSet,
+ OUString& rValue, sal_Int32& nMultiSelect, ApiDefaultStateMode eDefStateMode, bool bAwtModel ) const
+{
+ bool bBooleanState = eDefStateMode == API_DEFAULTSTATE_BOOLEAN;
+ bool bSupportsTriState = eDefStateMode == API_DEFAULTSTATE_TRISTATE;
+
+ sal_Int32 nPropId = bAwtModel ? PROP_State : PROP_DefaultState;
+ sal_Int16 nState = API_STATE_DONTKNOW;
+
+ sal_Bool bTmp = sal_False;
+
+ if( bBooleanState )
+ {
+ rPropSet.getProperty( bTmp, nPropId );
+ if ( bTmp )
+ nState = API_STATE_CHECKED;
+ else
+ nState = API_STATE_UNCHECKED;
+ }
+ else
+ rPropSet.getProperty( nState, nPropId );
+
+ rValue = rtl::OUString(); // empty e.g. 'don't know'
+ if ( nState == API_STATE_UNCHECKED )
+ rValue = rtl::OUString( '0' );
+ else if ( nState == API_STATE_CHECKED )
+ rValue = rtl::OUString( '1' );
+
+ // tristate
+ if( bSupportsTriState && rPropSet.getProperty( bTmp, PROP_TriState ) )
+ nMultiSelect = AX_SELCTION_MULTI;
+}
+
void ControlConverter::convertAxOrientation( PropertyMap& rPropMap,
const AxPairData& rSize, sal_Int32 nOrientation ) const
{
@@ -510,6 +586,18 @@ void ControlConverter::convertAxOrientation( PropertyMap& rPropMap,
convertOrientation( rPropMap, bHorizontal );
}
+void ControlConverter::convertToAxOrientation( PropertySet& rPropSet,
+ const AxPairData& /*rSize*/, sal_Int32& nOrientation ) const
+{
+ bool bHorizontal = true;
+ convertToMSOrientation( rPropSet, bHorizontal );
+
+ if ( bHorizontal )
+ nOrientation = AX_ORIENTATION_HORIZONTAL;
+ else
+ nOrientation = AX_ORIENTATION_VERTICAL;
+}
+
// ============================================================================
ControlModelBase::ControlModelBase() :
@@ -576,6 +664,10 @@ void ControlModelBase::convertProperties( PropertyMap& /*rPropMap*/, const Contr
{
}
+void ControlModelBase::convertFromProperties( PropertySet& /*rPropMap*/, const ControlConverter& /*rConv*/ )
+{
+}
+
void ControlModelBase::convertSize( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rConv.convertSize( rPropMap, maSize );
@@ -810,6 +902,10 @@ bool AxFontDataModel::importBinaryModel( BinaryInputStream& rInStrm )
return maFontData.importBinaryModel( rInStrm );
}
+void AxFontDataModel::exportBinaryModel( BinaryOutputStream& rOutStrm )
+{
+ maFontData.exportBinaryModel( rOutStrm );
+}
void AxFontDataModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
// font name
@@ -849,6 +945,41 @@ void AxFontDataModel::convertProperties( PropertyMap& rPropMap, const ControlCon
AxControlModelBase::convertProperties( rPropMap, rConv );
}
+void AxFontDataModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& /*rConv */)
+{
+ rPropSet.getProperty( maFontData.maFontName, PROP_FontName );
+ float fontWeight = (float)0;
+ if ( rPropSet.getProperty(fontWeight, PROP_FontWeight ) )
+ setFlag( maFontData.mnFontEffects, AX_FONTDATA_BOLD, ( fontWeight == FontWeight::BOLD ) );
+ sal_Int16 nSlant = FontSlant_NONE;
+ if ( rPropSet.getProperty( nSlant, PROP_FontSlant ) )
+ setFlag( maFontData.mnFontEffects, AX_FONTDATA_ITALIC, ( nSlant == FontSlant_ITALIC ) );
+
+ sal_Int16 nUnderLine = FontUnderline::NONE;
+ if ( rPropSet.getProperty( nUnderLine, PROP_FontUnderline ) )
+ setFlag( maFontData.mnFontEffects, AX_FONTDATA_UNDERLINE, nUnderLine != FontUnderline::NONE );
+ sal_Int16 nStrikeout = FontStrikeout::NONE ;
+ if ( rPropSet.getProperty( nStrikeout, PROP_FontStrikeout ) )
+ setFlag( maFontData.mnFontEffects, AX_FONTDATA_STRIKEOUT, nStrikeout != FontStrikeout::NONE );
+
+ float fontHeight = 0.0;
+ if ( rPropSet.getProperty( fontHeight, PROP_FontHeight ) )
+ maFontData.setHeightPoints( static_cast< sal_Int16 >( fontHeight ) );
+
+ // TODO - handle textencoding
+ sal_Int16 nAlign = 0;
+ if ( rPropSet.getProperty( nAlign, PROP_Align ) )
+ {
+ switch ( nAlign )
+ {
+ case TextAlign::LEFT: maFontData.mnHorAlign = AX_FONTDATA_LEFT; break;
+ case TextAlign::RIGHT: maFontData.mnHorAlign = AX_FONTDATA_RIGHT; break;
+ case TextAlign::CENTER: maFontData.mnHorAlign = AX_FONTDATA_CENTER; break;
+ default: OSL_FAIL( "AxFontDataModel::convertFromProperties - unknown text alignment" );
+ }
+ }
+}
+
// ============================================================================
AxCommandButtonModel::AxCommandButtonModel() :
@@ -901,6 +1032,50 @@ bool AxCommandButtonModel::importBinaryModel( BinaryInputStream& rInStrm )
return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
}
+
+void AxCommandButtonModel::exportBinaryModel( BinaryOutputStream& rOutStrm )
+{
+ AxBinaryPropertyWriter aWriter( rOutStrm );
+ aWriter.writeIntProperty< sal_uInt32 >( mnTextColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
+ aWriter.writeStringProperty( maCaption );
+ aWriter.skipProperty(); // pict pos
+ aWriter.writePairProperty( maSize );
+ aWriter.skipProperty(); // mouse pointer
+ aWriter.skipProperty(); // picture data
+ aWriter.skipProperty(); // accelerator
+ aWriter.writeBoolProperty( mbFocusOnClick ); // binary flag means "do not take focus"
+ aWriter.skipProperty(); // mouse icon
+ aWriter.finalizeExport();
+ AxFontDataModel::exportBinaryModel( rOutStrm );
+}
+
+void AxCommandButtonModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x32, 0x05, 0xD7,
+ 0x69, 0xCE, 0xCD, 0x11, 0xA7, 0x77, 0x00, 0xDD,
+ 0x01, 0x14, 0x3C, 0x57, 0x22, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6d, 0x73, 0x20,
+ 0x32, 0x2e, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x6D,
+ 0x61, 0x6E, 0x64, 0x42, 0x75, 0x74, 0x74, 0x6F,
+ 0x6E, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
+ 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
+ 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x16, 0x00,
+ 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
+ 0x43, 0x6F, 0x6D, 0x6D, 0x61, 0x6E, 0x64, 0x42,
+ 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00,
+ 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
+
ApiControlType AxCommandButtonModel::getControlType() const
{
return API_CONTROL_BUTTON;
@@ -919,6 +1094,21 @@ void AxCommandButtonModel::convertProperties( PropertyMap& rPropMap, const Contr
AxFontDataModel::convertProperties( rPropMap, rConv );
}
+void AxCommandButtonModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ rPropSet.getProperty( maCaption, PROP_Label );
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_Enabled ) )
+ setFlag( mnFlags, AX_FLAGS_ENABLED, bRes );
+ if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
+ setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
+ rPropSet.getProperty( mbFocusOnClick, PROP_FocusOnClick );
+
+ rConv.convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+
+ AxFontDataModel::convertFromProperties( rPropSet, rConv );
+}
// ============================================================================
AxLabelModel::AxLabelModel() :
@@ -966,6 +1156,69 @@ bool AxLabelModel::importBinaryModel( BinaryInputStream& rInStrm )
return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
}
+void AxLabelModel::exportBinaryModel( BinaryOutputStream& rOutStrm )
+{
+ AxBinaryPropertyWriter aWriter( rOutStrm );
+ aWriter.writeIntProperty< sal_uInt32 >( mnTextColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
+ aWriter.writeStringProperty( maCaption );
+ aWriter.skipProperty(); // picture position
+ aWriter.writePairProperty( maSize );
+ aWriter.skipProperty(); // mouse pointer
+ aWriter.writeIntProperty< sal_uInt32 >( mnBorderColor );
+ aWriter.writeIntProperty< sal_uInt16 >( mnBorderStyle );
+ aWriter.writeIntProperty< sal_uInt16 >( mnSpecialEffect );
+ aWriter.skipProperty(); // picture
+ aWriter.skipProperty(); // accelerator
+ aWriter.skipProperty(); // mouse icon
+ aWriter.finalizeExport();
+ AxFontDataModel::exportBinaryModel( rOutStrm );
+}
+
+void AxLabelModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ rPropSet.getProperty( maCaption, PROP_Label );
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_Enabled ) )
+ setFlag( mnFlags, AX_FLAGS_ENABLED, bRes );
+ if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
+ setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
+
+ rConv.convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
+ // VerticleAlign doesn't seem to be read from binary
+
+ // not sure about background color, how do we decide when to set
+ // AX_FLAGS_OPAQUE ?
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+ rConv.convertToAxBorder( rPropSet, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+
+ AxFontDataModel::convertFromProperties( rPropSet, rConv );
+}
+
+void AxLabelModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x23, 0x9E, 0x8C, 0x97,
+ 0xB0, 0xD4, 0xCE, 0x11, 0xBF, 0x2D, 0x00, 0xAA,
+ 0x00, 0x3F, 0x40, 0xD0, 0x1A, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x4C, 0x61, 0x62, 0x65,
+ 0x6C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
+ 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
+ 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x0E, 0x00,
+ 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
+ 0x4C, 0x61, 0x62, 0x65, 0x6C, 0x2E, 0x31, 0x00,
+ 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
+
ApiControlType AxLabelModel::getControlType() const
{
return API_CONTROL_FIXEDTEXT;
@@ -1043,6 +1296,50 @@ bool AxImageModel::importBinaryModel( BinaryInputStream& rInStrm )
return aReader.finalizeImport();
}
+void AxImageModel::exportBinaryModel( BinaryOutputStream& rOutStrm )
+{
+ AxBinaryPropertyWriter aWriter( rOutStrm );
+ aWriter.skipProperty(); //undefined
+ aWriter.skipProperty(); //undefined
+ aWriter.skipProperty(); //auto-size
+ aWriter.writeIntProperty< sal_uInt32 >( mnBorderColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
+ aWriter.writeIntProperty< sal_uInt8 >( mnBorderStyle );
+ aWriter.skipProperty(); // mouse pointer
+ aWriter.writeIntProperty< sal_uInt8 >( mnPicSizeMode );
+ aWriter.writeIntProperty< sal_uInt8 >( mnSpecialEffect );
+ aWriter.writePairProperty( maSize );
+ aWriter.skipProperty(); //maPictureData );
+ aWriter.writeIntProperty< sal_uInt8 >( mnPicAlign );
+ aWriter.writeBoolProperty( mbPicTiling );
+ aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
+ aWriter.skipProperty(); // mouse icon
+ aWriter.finalizeExport();
+}
+
+void AxImageModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x41, 0x92, 0x59, 0x4C,
+ 0x26, 0x69, 0x1B, 0x10, 0x99, 0x92, 0x00, 0x00,
+ 0x0B, 0x65, 0xC6, 0xF9, 0x1A, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x49, 0x6D, 0x61, 0x67,
+ 0x65, 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D,
+ 0x62, 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F,
+ 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00, 0x0E, 0x00,
+ 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E,
+ 0x49, 0x6D, 0x61, 0x67, 0x65, 0x2E, 0x31, 0x00,
+ 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
+
ApiControlType AxImageModel::getControlType() const
{
return API_CONTROL_IMAGE;
@@ -1153,6 +1450,46 @@ bool AxMorphDataModelBase::importBinaryModel( BinaryInputStream& rInStrm )
return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm );
}
+void AxMorphDataModelBase::exportBinaryModel( BinaryOutputStream& rOutStrm )
+{
+ AxBinaryPropertyWriter aWriter( rOutStrm, true );
+ aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
+ aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnTextColor );
+ aWriter.writeIntProperty< sal_Int32 >( mnMaxLength );
+ aWriter.writeIntProperty< sal_uInt8 >( mnBorderStyle );
+ aWriter.writeIntProperty< sal_uInt8 >( mnScrollBars );
+ aWriter.writeIntProperty< sal_uInt8 >( mnDisplayStyle );
+ aWriter.skipProperty(); // mouse pointer
+ aWriter.writePairProperty( maSize );
+ aWriter.writeIntProperty< sal_uInt16 >( mnPasswordChar );
+ aWriter.skipProperty(); // list width
+ aWriter.skipProperty(); // bound column
+ aWriter.skipProperty(); // text column
+ aWriter.skipProperty(); // column count
+ aWriter.skipProperty(); // mnListRows
+ aWriter.skipProperty(); // column info count
+ aWriter.skipProperty(); // mnMatchEntry
+ aWriter.skipProperty(); // list style
+ aWriter.skipProperty(); // mnShowDropButton );
+ aWriter.skipProperty();
+ aWriter.skipProperty(); // drop down style
+ aWriter.writeIntProperty< sal_uInt8 >( mnMultiSelect );
+ aWriter.skipProperty(); // maValue;
+ aWriter.writeStringProperty( maCaption );
+ aWriter.skipProperty(); // mnPicturePos );
+ aWriter.writeIntProperty< sal_uInt32 >( mnBorderColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnSpecialEffect );
+ aWriter.skipProperty(); // mouse icon
+ aWriter.skipProperty(); // maPictureData
+ aWriter.skipProperty(); // accelerator
+ aWriter.skipProperty(); // undefined
+ aWriter.skipProperty(); // some bool
+ aWriter.writeStringProperty( maGroupName );
+ aWriter.finalizeExport();
+ AxFontDataModel::exportBinaryModel( rOutStrm );
+}
+
void AxMorphDataModelBase::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
@@ -1173,6 +1510,20 @@ ApiControlType AxToggleButtonModel::getControlType() const
return API_CONTROL_BUTTON;
}
+void AxToggleButtonModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ rPropSet.getProperty( maCaption, PROP_Label );
+
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
+ setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
+
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+ // need to process the image if one exists
+ rConv.convertToAxState( rPropSet, maValue, mnMultiSelect, API_DEFAULTSTATE_BOOLEAN, mbAwtModel );
+ AxMorphDataModelBase::convertFromProperties( rPropSet, rConv );
+}
+
void AxToggleButtonModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_Label, maCaption );
@@ -1185,6 +1536,31 @@ void AxToggleButtonModel::convertProperties( PropertyMap& rPropMap, const Contro
AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
+void AxToggleButtonModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x60, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x21, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x54, 0x6F, 0x67, 0x67,
+ 0x6C, 0x65, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E,
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62,
+ 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62,
+ 0x6A, 0x65, 0x63, 0x74, 0x00, 0x15, 0x00, 0x00,
+ 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x54,
+ 0x6F, 0x67, 0x67, 0x6C, 0x65, 0x42, 0x75, 0x74,
+ 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00, 0xF4, 0x39,
+ 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
+
// ============================================================================
AxCheckBoxModel::AxCheckBoxModel()
@@ -1210,6 +1586,44 @@ void AxCheckBoxModel::convertProperties( PropertyMap& rPropMap, const ControlCon
AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
+void AxCheckBoxModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ rPropSet.getProperty( maCaption, PROP_Label );
+
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
+ setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
+
+ rConv.convertToAxVisualEffect( rPropSet, mnSpecialEffect );
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+ // need to process the image if one exists
+ rConv.convertToAxState( rPropSet, maValue, mnMultiSelect, API_DEFAULTSTATE_BOOLEAN, mbAwtModel );
+ AxMorphDataModelBase::convertFromProperties( rPropSet, rConv );
+}
+
+void AxCheckBoxModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x40, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1D, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x43, 0x68, 0x65, 0x63,
+ 0x6B, 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65,
+ 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74,
+ 0x00, 0x11, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72,
+ 0x6D, 0x73, 0x2E, 0x43, 0x68, 0x65, 0x63, 0x6B,
+ 0x42, 0x6F, 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39,
+ 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
// ============================================================================
AxOptionButtonModel::AxOptionButtonModel()
@@ -1235,6 +1649,46 @@ void AxOptionButtonModel::convertProperties( PropertyMap& rPropMap, const Contro
AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
+void AxOptionButtonModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ rPropSet.getProperty( maCaption, PROP_Label );
+
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
+ setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
+
+ rConv.convertToAxVisualEffect( rPropSet, mnSpecialEffect );
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+ // need to process the image if one exists
+ rConv.convertToAxState( rPropSet, maValue, mnMultiSelect, API_DEFAULTSTATE_BOOLEAN, mbAwtModel );
+ AxMorphDataModelBase::convertFromProperties( rPropSet, rConv );
+}
+
+void AxOptionButtonModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x50, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x21, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x4F, 0x70, 0x74, 0x69,
+ 0x6F, 0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E,
+ 0x00, 0x10, 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62,
+ 0x65, 0x64, 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62,
+ 0x6A, 0x65, 0x63, 0x74, 0x00, 0x15, 0x00, 0x00,
+ 0x00, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x2E, 0x4F,
+ 0x70, 0x74, 0x69, 0x6F, 0x6E, 0x42, 0x75, 0x74,
+ 0x74, 0x6F, 0x6E, 0x2E, 0x31, 0x00, 0xF4, 0x39,
+ 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
+
// ============================================================================
AxTextBoxModel::AxTextBoxModel()
@@ -1263,6 +1717,53 @@ void AxTextBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConv
AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
+void AxTextBoxModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
+ setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
+ if ( rPropSet.getProperty( bRes, PROP_HideInactiveSelection ) )
+ setFlag( mnFlags, AX_FLAGS_HIDESELECTION, bRes );
+ rPropSet.getProperty( maValue, ( mbAwtModel ? PROP_Text : PROP_DefaultText ) );
+ sal_Int16 nTmp(0);
+ if ( rPropSet.getProperty( nTmp, PROP_MaxTextLen ) )
+ mnMaxLength = nTmp;
+ if ( rPropSet.getProperty( nTmp, PROP_EchoChar ) )
+ mnPasswordChar = nTmp;
+ if ( rPropSet.getProperty( bRes, PROP_HScroll ) )
+ setFlag( mnScrollBars, AX_SCROLLBAR_HORIZONTAL, bRes );
+ if ( rPropSet.getProperty( bRes, PROP_VScroll ) )
+ setFlag( mnScrollBars, AX_SCROLLBAR_VERTICAL, bRes );
+
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+
+ rConv.convertToAxBorder( rPropSet, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ AxMorphDataModelBase::convertFromProperties( rPropSet, rConv );
+}
+
+void AxTextBoxModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x54, 0x65, 0x78, 0x74,
+ 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
+ 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
+ 0x73, 0x2E, 0x54, 0x65, 0x78, 0x74, 0x42, 0x6F,
+ 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
// ============================================================================
AxNumericFieldModel::AxNumericFieldModel()
@@ -1288,6 +1789,44 @@ void AxNumericFieldModel::convertProperties( PropertyMap& rPropMap, const Contro
AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
+void AxNumericFieldModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_HideInactiveSelection ) )
+ setFlag( mnFlags, AX_FLAGS_HIDESELECTION, bRes );
+ rPropSet.getProperty( maValue, ( mbAwtModel ? PROP_Text : PROP_DefaultText ) );
+ if ( rPropSet.getProperty( bRes, PROP_Spin ) )
+ setFlag( mnScrollBars, AX_SCROLLBAR_VERTICAL, bRes );
+
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+
+ rConv.convertToAxBorder( rPropSet, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ AxMorphDataModelBase::convertFromProperties( rPropSet, rConv );
+}
+
+void AxNumericFieldModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x54, 0x65, 0x78, 0x74,
+ 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
+ 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
+ 0x73, 0x2E, 0x54, 0x65, 0x78, 0x74, 0x42, 0x6F,
+ 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
// ============================================================================
AxListBoxModel::AxListBoxModel()
@@ -1311,6 +1850,40 @@ void AxListBoxModel::convertProperties( PropertyMap& rPropMap, const ControlConv
AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
+void AxListBoxModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_MultiSelection ) )
+
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+
+ rConv.convertToAxBorder( rPropSet, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ AxMorphDataModelBase::convertFromProperties( rPropSet, rConv );
+}
+
+void AxListBoxModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1C, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x4C, 0x69, 0x73, 0x74,
+ 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65, 0x64,
+ 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72, 0x6D,
+ 0x73, 0x2E, 0x4C, 0x69, 0x73, 0x74, 0x42, 0x6F,
+ 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
// ============================================================================
AxComboBoxModel::AxComboBoxModel()
@@ -1342,6 +1915,62 @@ void AxComboBoxModel::convertProperties( PropertyMap& rPropMap, const ControlCon
AxMorphDataModelBase::convertProperties( rPropMap, rConv );
}
+void AxComboBoxModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ // when would we have mnDisplayStyle = AX_DISPLAYSTYLE_DROPDOWN ?
+ // #TODO check against msocximex
+ mnDisplayStyle = AX_DISPLAYSTYLE_COMBOBOX;
+ bool bRes = false;
+
+ if ( rPropSet.getProperty( bRes, PROP_HideInactiveSelection ) )
+ setFlag( mnFlags, AX_FLAGS_HIDESELECTION, bRes );
+ rPropSet.getProperty( maValue, ( mbAwtModel ? PROP_Text : PROP_DefaultText ) );
+
+ sal_Int16 nTmp(0);
+ if ( rPropSet.getProperty( nTmp, PROP_MaxTextLen ) )
+ mnMaxLength = nTmp;
+ if ( rPropSet.getProperty( bRes, PROP_Autocomplete ) )
+ {
+ // when to choose AX_MATCHENTRY_FIRSTLETTER ?
+ // #TODO check against msocximex
+ if ( bRes )
+ mnMatchEntry = AX_MATCHENTRY_COMPLETE;
+ }
+ if ( rPropSet.getProperty( bRes, PROP_Dropdown ) )
+ {
+ rPropSet.getProperty( mnListRows, PROP_LineCount );
+ if ( !mnListRows )
+ mnListRows = 1;
+ }
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+
+ rConv.convertToAxBorder( rPropSet, mnBorderColor, mnBorderStyle, mnSpecialEffect );
+ AxMorphDataModelBase::convertFromProperties( rPropSet, rConv );
+}
+
+void AxComboBoxModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] = {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x30, 0x1D, 0xD2, 0x8B,
+ 0x42, 0xEC, 0xCE, 0x11, 0x9E, 0x0D, 0x00, 0xAA,
+ 0x00, 0x60, 0x02, 0xF3, 0x1D, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x43, 0x6F, 0x6D, 0x62,
+ 0x6F, 0x42, 0x6F, 0x78, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64, 0x65,
+ 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74,
+ 0x00, 0x11, 0x00, 0x00, 0x00, 0x46, 0x6F, 0x72,
+ 0x6D, 0x73, 0x2E, 0x43, 0x6F, 0x6D, 0x62, 0x6F,
+ 0x42, 0x6F, 0x78, 0x2E, 0x31, 0x00, 0xF4, 0x39,
+ 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
// ============================================================================
AxSpinButtonModel::AxSpinButtonModel() :
@@ -1400,6 +2029,28 @@ bool AxSpinButtonModel::importBinaryModel( BinaryInputStream& rInStrm )
return aReader.finalizeImport();
}
+void AxSpinButtonModel::exportBinaryModel( BinaryOutputStream& rOutStrm )
+{
+ AxBinaryPropertyWriter aWriter( rOutStrm );
+ aWriter.writeIntProperty< sal_uInt32 >( mnArrowColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
+ aWriter.writePairProperty( maSize );
+ aWriter.skipProperty(); // unused
+ aWriter.writeIntProperty< sal_Int32 >( mnMin );
+ aWriter.writeIntProperty< sal_Int32 >( mnMax );
+ aWriter.writeIntProperty< sal_Int32 >( mnPosition );
+ aWriter.skipProperty(); // prev enabled
+ aWriter.skipProperty(); // next enabled
+ aWriter.writeIntProperty< sal_Int32 >( mnSmallChange );
+ aWriter.writeIntProperty< sal_Int32 >( mnOrientation );
+ aWriter.writeIntProperty< sal_Int32 >( mnDelay );
+ aWriter.skipProperty(); // mouse icon
+ aWriter.skipProperty(); // mouse pointer
+
+ aWriter.finalizeExport();
+}
+
void AxSpinButtonModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
sal_Int32 nMin = ::std::min( mnMin, mnMax );
@@ -1418,6 +2069,47 @@ void AxSpinButtonModel::convertProperties( PropertyMap& rPropMap, const ControlC
AxControlModelBase::convertProperties( rPropMap, rConv );
}
+void AxSpinButtonModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_Enabled ) )
+ setFlag( mnFlags, AX_FLAGS_ENABLED, bRes );
+ rPropSet.getProperty( mnMin, PROP_SpinValueMin );
+ rPropSet.getProperty( mnMax, PROP_SpinValueMax );
+ rPropSet.getProperty( mnSmallChange, PROP_SpinIncrement );
+ rPropSet.getProperty( mnPosition, ( mbAwtModel ? PROP_SpinValue : PROP_DefaultSpinValue ) );
+ rPropSet.getProperty( mnDelay, PROP_RepeatDelay );
+ rConv.convertToMSColor( rPropSet, PROP_SymbolColor, mnArrowColor);
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+
+ rConv.convertToAxOrientation( rPropSet, maSize, mnOrientation );
+}
+
+void AxSpinButtonModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] =
+ {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xB0, 0x6F, 0x17, 0x79,
+ 0xF2, 0xB7, 0xCE, 0x11, 0x97, 0xEF, 0x00, 0xAA,
+ 0x00, 0x6D, 0x27, 0x76, 0x1F, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x53, 0x70, 0x69, 0x6E,
+ 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x00, 0x10,
+ 0x00, 0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64,
+ 0x64, 0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65,
+ 0x63, 0x74, 0x00, 0x13, 0x00, 0x00, 0x00, 0x46,
+ 0x6E, 0x42, 0x75, 0x74, 0x74, 0x6F, 0x6E, 0x2E,
+ 0x31, 0x00, 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00
+ };
+
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
// ============================================================================
AxScrollBarModel::AxScrollBarModel() :
@@ -1482,6 +2174,54 @@ bool AxScrollBarModel::importBinaryModel( BinaryInputStream& rInStrm )
return aReader.finalizeImport();
}
+void AxScrollBarModel::exportBinaryModel( BinaryOutputStream& rOutStrm )
+{
+ AxBinaryPropertyWriter aWriter( rOutStrm );
+ aWriter.writeIntProperty< sal_uInt32 >( mnArrowColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnBackColor );
+ aWriter.writeIntProperty< sal_uInt32 >( mnFlags );
+ aWriter.writePairProperty( maSize );
+ aWriter.skipProperty(); // mouse pointer
+ aWriter.writeIntProperty< sal_Int32 >( mnMin );
+ aWriter.writeIntProperty< sal_Int32 >( mnMax );
+ aWriter.writeIntProperty< sal_Int32 >( mnPosition );
+ aWriter.skipProperty(); // unused
+ aWriter.skipProperty(); // prev enabled
+ aWriter.skipProperty(); // next enabled
+ aWriter.writeIntProperty< sal_Int32 >( mnSmallChange );
+ aWriter.writeIntProperty< sal_Int32 >( mnLargeChange );
+ aWriter.writeIntProperty< sal_Int32 >( mnOrientation );
+ aWriter.writeIntProperty< sal_Int16 >( mnPropThumb );
+ aWriter.writeIntProperty< sal_Int32 >( mnDelay );
+ aWriter.skipProperty(); // mouse icon
+ aWriter.finalizeExport();
+}
+
+void AxScrollBarModel::exportCompObj( BinaryOutputStream& rOutStream )
+{
+ // should be able to replace this hardcoded foo with
+ // proper export info from MS-OLEDS spec.
+ static sal_uInt8 const aCompObj[] =
+ {
+ 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x81, 0xD1, 0xDF,
+ 0x2F, 0x5E, 0xCE, 0x11, 0xA4, 0x49, 0x00, 0xAA,
+ 0x00, 0x4A, 0x80, 0x3D, 0x1E, 0x00, 0x00, 0x00,
+ 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66,
+ 0x74, 0x20, 0x46, 0x6F, 0x72, 0x6D, 0x73, 0x20,
+ 0x32, 0x2E, 0x30, 0x20, 0x53, 0x63, 0x72, 0x6F,
+ 0x6C, 0x6C, 0x42, 0x61, 0x72, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x45, 0x6D, 0x62, 0x65, 0x64, 0x64,
+ 0x65, 0x64, 0x20, 0x4F, 0x62, 0x6A, 0x65, 0x63,
+ 0x74, 0x00, 0x12, 0x00, 0x00, 0x00, 0x46, 0x6F,
+ 0x72, 0x6D, 0x73, 0x2E, 0x53, 0x63, 0x72, 0x6F,
+ 0x6C, 0x6C, 0x42, 0x61, 0x72, 0x2E, 0x31, 0x00,
+ 0xF4, 0x39, 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+ rOutStream.writeMemory( aCompObj, sizeof( aCompObj ) );
+}
+
void AxScrollBarModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const
{
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_FLAGS_ENABLED ) );
@@ -1501,6 +2241,26 @@ void AxScrollBarModel::convertProperties( PropertyMap& rPropMap, const ControlCo
AxControlModelBase::convertProperties( rPropMap, rConv );
}
+void AxScrollBarModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
+{
+ bool bRes = false;
+ if ( rPropSet.getProperty( bRes, PROP_Enabled ) )
+ setFlag( mnFlags, AX_FLAGS_ENABLED, bRes );
+ rPropSet.getProperty( mnDelay, PROP_RepeatDelay );
+ sal_Int32 nThumbLen = 0;
+ mnPropThumb = AX_PROPTHUMB_ON; // default
+ rConv.convertToMSColor( rPropSet, PROP_SymbolColor, mnArrowColor);
+ rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
+ rConv.convertToAxOrientation( rPropSet, maSize, mnOrientation );
+
+ rPropSet.getProperty( mnMin, PROP_ScrollValueMin );
+ rPropSet.getProperty( mnMax, PROP_ScrollValueMax );
+ rPropSet.getProperty( mnSmallChange, PROP_LineIncrement );
+ rPropSet.getProperty( mnLargeChange, PROP_BlockIncrement );
+ rPropSet.getProperty( mnPosition, ( mbAwtModel ? PROP_ScrollValue : PROP_DefaultScrollValue ) );
+
+}
+
// ============================================================================
AxTabStripModel::AxTabStripModel() :
@@ -1859,23 +2619,23 @@ EmbeddedControl::~EmbeddedControl()
ControlModelBase* EmbeddedControl::createModelFromGuid( const OUString& rClassId )
{
- OUString aClassId = rClassId.toAsciiUpperCase();
-
- if( aClassId.equalsAscii( AX_GUID_COMMANDBUTTON ) ) return &createModel< AxCommandButtonModel >();
- if( aClassId.equalsAscii( AX_GUID_LABEL ) ) return &createModel< AxLabelModel >();
- if( aClassId.equalsAscii( AX_GUID_IMAGE ) ) return &createModel< AxImageModel >();
- if( aClassId.equalsAscii( AX_GUID_TOGGLEBUTTON ) ) return &createModel< AxToggleButtonModel >();
- if( aClassId.equalsAscii( AX_GUID_CHECKBOX ) ) return &createModel< AxCheckBoxModel >();
- if( aClassId.equalsAscii( AX_GUID_OPTIONBUTTON ) ) return &createModel< AxOptionButtonModel >();
- if( aClassId.equalsAscii( AX_GUID_TEXTBOX ) ) return &createModel< AxTextBoxModel >();
- if( aClassId.equalsAscii( AX_GUID_LISTBOX ) ) return &createModel< AxListBoxModel >();
- if( aClassId.equalsAscii( AX_GUID_COMBOBOX ) ) return &createModel< AxComboBoxModel >();
- if( aClassId.equalsAscii( AX_GUID_SPINBUTTON ) ) return &createModel< AxSpinButtonModel >();
- if( aClassId.equalsAscii( AX_GUID_SCROLLBAR ) ) return &createModel< AxScrollBarModel >();
- if( aClassId.equalsAscii( AX_GUID_FRAME ) ) return &createModel< AxFrameModel >();
- if( aClassId.equalsAscii( COMCTL_GUID_SCROLLBAR_60 ) ) return &createModel< ComCtlScrollBarModel >( COMCTL_VERSION_60 );
- if( aClassId.equalsAscii( HTML_GUID_SELECT ) ) return &createModel< HtmlSelectModel >();
- if( aClassId.equalsAscii( HTML_GUID_TEXTBOX ) ) return &createModel< HtmlTextBoxModel >();
+ OUString aClassId = rClassId;//.toAsciiUpperCase();
+
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_COMMANDBUTTON ) ) return &createModel< AxCommandButtonModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_LABEL ) ) return &createModel< AxLabelModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_IMAGE ) ) return &createModel< AxImageModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_TOGGLEBUTTON ) ) return &createModel< AxToggleButtonModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_CHECKBOX ) ) return &createModel< AxCheckBoxModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_OPTIONBUTTON ) ) return &createModel< AxOptionButtonModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_TEXTBOX ) ) return &createModel< AxTextBoxModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_LISTBOX ) ) return &createModel< AxListBoxModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_COMBOBOX ) ) return &createModel< AxComboBoxModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_SPINBUTTON ) ) return &createModel< AxSpinButtonModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_SCROLLBAR ) ) return &createModel< AxScrollBarModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( AX_GUID_FRAME ) ) return &createModel< AxFrameModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( COMCTL_GUID_SCROLLBAR_60 ) ) return &createModel< ComCtlScrollBarModel >( COMCTL_VERSION_60 );
+ if( aClassId.equalsIgnoreAsciiCaseAscii( HTML_GUID_SELECT ) ) return &createModel< HtmlSelectModel >();
+ if( aClassId.equalsIgnoreAsciiCaseAscii( HTML_GUID_TEXTBOX ) ) return &createModel< HtmlTextBoxModel >();
mxModel.reset();
return 0;
@@ -1907,6 +2667,18 @@ bool EmbeddedControl::convertProperties( const Reference< XControlModel >& rxCtr
return false;
}
+bool EmbeddedControl::convertFromProperties( const Reference< XControlModel >& rxCtrlModel, const ControlConverter& rConv )
+{
+ if( mxModel.get() && rxCtrlModel.is() && (maName.getLength() > 0) )
+ {
+ PropertySet aPropSet( rxCtrlModel );
+ aPropSet.getProperty( maName, PROP_Name );
+ mxModel->convertFromProperties( aPropSet, rConv );
+ return true;
+ }
+ return false;
+}
+
// ============================================================================
EmbeddedForm::EmbeddedForm( const Reference< XModel >& rxDocModel,
diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx
index 2bcafc9a2882..6e6fa671b2d7 100644
--- a/oox/source/ole/olehelper.cxx
+++ b/oox/source/ole/olehelper.cxx
@@ -33,11 +33,23 @@
#include "oox/helper/graphichelper.hxx"
#include "oox/token/tokens.hxx"
#include "oox/ole/axcontrol.hxx"
-#include <com/sun/star/beans/XPropertySet.hpp>
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/ole/olestorage.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#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/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include <tools/globname.hxx>
+#include <unotools/streamwrap.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+
namespace oox {
namespace ole {
@@ -47,10 +59,27 @@ using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::com::sun::star::form::XFormComponent;
+using ::com::sun::star::form::XForm;
using ::com::sun::star::awt::XControlModel;
+using ::com::sun::star::awt::Size;
+using ::com::sun::star::frame::XModel;
+using ::com::sun::star::form::XFormsSupplier;
+using ::com::sun::star::drawing::XDrawPage;
+using ::com::sun::star::drawing::XDrawPageSupplier;
+using ::com::sun::star::drawing::XShapes;
+using ::com::sun::star::io::XOutputStream;
+using ::com::sun::star::io::XInputStream;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::XInterface;
using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::Any;
+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 namespace ::com::sun::star::form;
// ============================================================================
@@ -66,6 +95,7 @@ const sal_uInt32 OLE_PALETTECOLOR_MASK = 0x0000FFFF;
const sal_uInt32 OLE_BGRCOLOR_MASK = 0x00FFFFFF;
const sal_uInt32 OLE_SYSTEMCOLOR_MASK = 0x0000FFFF;
+
/** Swaps the red and blue component of the passed color. */
inline sal_uInt32 lclSwapRedBlue( sal_uInt32 nColor )
{
@@ -95,6 +125,101 @@ const sal_uInt32 OLE_STDHLINK_HASTIME = 0x00000040; /// Has creation tim
const sal_uInt32 OLE_STDHLINK_HASFRAME = 0x00000080; /// Has frame.
const sal_uInt32 OLE_STDHLINK_ASSTRING = 0x00000100; /// Hyperlink as simple string.
+struct GUIDCNamePair
+{
+ const char* sGUID;
+ const char* sName;
+ GUIDCNamePair( const char* psId, const char* psName ) : sGUID( psId ), sName( psName ) {}
+ GUIDCNamePair() : sGUID( NULL ), sName( NULL ) {}
+};
+
+struct IdCntrlData
+{
+ sal_Int16 nId;
+ GUIDCNamePair aData;
+};
+
+const sal_Int16 TOGGLEBUTTON = -1;
+
+typedef std::map< sal_Int16, GUIDCNamePair > GUIDCNamePairMap;
+class classIdToGUIDCNamePairMap
+{
+ GUIDCNamePairMap mnIdToGUIDCNamePairMap;
+ classIdToGUIDCNamePairMap();
+public:
+ static GUIDCNamePairMap& get();
+};
+
+classIdToGUIDCNamePairMap::classIdToGUIDCNamePairMap()
+{
+ IdCntrlData initialCntrlData[] =
+ {
+ // Command button MUST be at index 0
+ { FormComponentType::COMMANDBUTTON,
+ { AX_GUID_COMMANDBUTTON, "CommandButton"} ,
+ },
+ // Toggle button MUST be at index 1
+ { TOGGLEBUTTON,
+ { AX_GUID_TOGGLEBUTTON, "ToggleButton"},
+ },
+ { FormComponentType::FIXEDTEXT,
+ { AX_GUID_LABEL, "Label"},
+ },
+ { FormComponentType::TEXTFIELD,
+ { AX_GUID_TEXTBOX, "TextBox"},
+ },
+ { FormComponentType::LISTBOX,
+ { AX_GUID_LISTBOX, "ListBox"},
+ },
+ { FormComponentType::COMBOBOX,
+ { AX_GUID_COMBOBOX, "ComboBox"},
+ },
+ { FormComponentType::CHECKBOX,
+ { AX_GUID_CHECKBOX, "CheckBox"},
+ },
+ { FormComponentType::RADIOBUTTON,
+ { AX_GUID_OPTIONBUTTON, "OptionButton"},
+ },
+ { FormComponentType::IMAGECONTROL,
+ { AX_GUID_IMAGE, "Image"},
+ },
+ { FormComponentType::DATEFIELD,
+ { AX_GUID_TEXTBOX, "TextBox"},
+ },
+ { FormComponentType::TIMEFIELD,
+ { AX_GUID_TEXTBOX, "TextBox"},
+ },
+ { FormComponentType::NUMERICFIELD,
+ { AX_GUID_TEXTBOX, "TextBox"},
+ },
+ { FormComponentType::CURRENCYFIELD,
+ { AX_GUID_TEXTBOX, "TextBox"},
+ },
+ { FormComponentType::PATTERNFIELD,
+ { AX_GUID_TEXTBOX, "TextBox"},
+ },
+ { FormComponentType::IMAGEBUTTON,
+ { AX_GUID_COMMANDBUTTON, "CommandButton"},
+ },
+ { FormComponentType::SPINBUTTON,
+ { AX_GUID_SPINBUTTON, "SpinButton"},
+ },
+ { FormComponentType::SCROLLBAR,
+ { AX_GUID_SCROLLBAR, "ScrollBar"},
+ }
+ };
+ int length = SAL_N_ELEMENTS( initialCntrlData );
+ IdCntrlData* pData = initialCntrlData;
+ for ( int index = 0; index < length; ++index, ++pData )
+ mnIdToGUIDCNamePairMap[ pData->nId ] = pData->aData;
+};
+
+GUIDCNamePairMap& classIdToGUIDCNamePairMap::get()
+{
+ static classIdToGUIDCNamePairMap theInst;
+ return theInst.mnIdToGUIDCNamePairMap;
+}
+
// ----------------------------------------------------------------------------
template< typename Type >
@@ -331,16 +456,114 @@ lcl_getFrame( const Reference< ::com::sun::star::frame::XModel >& rxModel )
return xFrame;
}
-OleFormCtrlImportHelper::OleFormCtrlImportHelper( const Reference< com::sun::star::io::XInputStream > & rxInStrm, const Reference< ::com::sun::star::uno::XComponentContext >& rxCtx, const Reference< ::com::sun::star::frame::XModel >& rxModel ) : mpRoot( new ::oox::ole::OleStorage( rxCtx, rxInStrm, true ) ), mxCtx( rxCtx ), mxModel( rxModel ), maGrfHelper( rxCtx, lcl_getFrame( rxModel ), mpRoot )
+Reference< XComponentContext >
+lcl_getUnoCtx()
{
+ comphelper::ComponentContext aCtx( ::comphelper::getProcessServiceFactory() );
+ return aCtx.getUNOContext();
}
-OleFormCtrlImportHelper::~OleFormCtrlImportHelper()
+
+
+class OleFormCtrlExportHelper
+{
+ ::oox::ole::EmbeddedControl maControl;
+ ::oox::ole::ControlModelBase* mpModel;
+ ::oox::GraphicHelper maGrfHelper;
+ Reference< XModel > mxDocModel;
+ Reference< XControlModel > mxControlModel;
+
+ ::rtl::OUString maName;
+ ::rtl::OUString maTypeName;
+ ::rtl::OUString maFullName;
+ ::rtl::OUString maGUID;
+public:
+ OleFormCtrlExportHelper( const Reference< XComponentContext >& rxCtx, const Reference< XModel >& xDocModel, const Reference< XControlModel >& xModel );
+ virtual ::rtl::OUString getGUID()
+ {
+ rtl::OUString sResult;
+ if ( maGUID.getLength() > 2 )
+ sResult = maGUID.copy(1, maGUID.getLength() - 2 );
+ return sResult;
+ }
+ ::rtl::OUString getFullName() { return maFullName; }
+ ::rtl::OUString getTypeName() { return maTypeName; }
+ bool isValid() { return mpModel != NULL; }
+ void exportName( const Reference< XOutputStream >& rxOut );
+ void exportCompObj( const Reference< XOutputStream >& rxOut );
+ void exportControl( const Reference< XOutputStream >& rxOut, const ::com::sun::star::awt::Size& rSize );
+};
+OleFormCtrlExportHelper::OleFormCtrlExportHelper( const Reference< XComponentContext >& rxCtx, const Reference< XModel >& rxDocModel, const Reference< XControlModel >& xCntrlModel ) : maControl( CREATE_OUSTRING( "Unknown" ) ), mpModel( NULL ), maGrfHelper( rxCtx, lcl_getFrame( rxDocModel ), StorageRef() ), mxDocModel( rxDocModel ), mxControlModel( xCntrlModel )
+{
+ // try to get the guid
+ Reference< com::sun::star::beans::XPropertySet > xProps( xCntrlModel, UNO_QUERY );
+ if ( xProps.is() )
+ {
+ sal_Int16 nClassId = 0;
+ PropertySet aPropSet( mxControlModel );
+ if ( aPropSet.getProperty( nClassId, PROP_ClassId ) )
+ {
+ // psuedo ripped from legacy msocximex
+ if ( nClassId == FormComponentType::COMMANDBUTTON )
+ {
+ bool bToggle = false;
+ aPropSet.getProperty( bToggle, PROP_Toggle );
+ if ( bToggle )
+ nClassId = TOGGLEBUTTON;
+ }
+
+ GUIDCNamePairMap& cntrlMap = classIdToGUIDCNamePairMap::get();
+ GUIDCNamePairMap::iterator it = cntrlMap.find( nClassId );
+ if ( it != cntrlMap.end() )
+ {
+ aPropSet.getProperty(maName, PROP_Name );
+ maTypeName = OUString::createFromAscii( it->second.sName );
+ maFullName = CREATE_OUSTRING( "Microsoft Forms 2.0 " ) + maTypeName;
+ maControl = EmbeddedControl( maName );
+ maGUID = OUString::createFromAscii( it->second.sGUID );
+ mpModel = maControl.createModelFromGuid( maGUID );
+ }
+ }
+ }
+}
+
+void OleFormCtrlExportHelper::exportName( const Reference< XOutputStream >& rxOut )
+{
+ oox::BinaryXOutputStream aOut( rxOut, false );
+ aOut.writeUnicodeArray( maName );
+ aOut << sal_Int32(0);
+}
+
+void OleFormCtrlExportHelper::exportCompObj( const Reference< XOutputStream >& rxOut )
+{
+ oox::BinaryXOutputStream aOut( rxOut, false );
+ if ( mpModel && mpModel->getControlType() == API_CONTROL_BUTTON )
+ mpModel->exportCompObj( aOut );
+}
+
+void OleFormCtrlExportHelper::exportControl( const Reference< XOutputStream >& rxOut, const Size& rSize )
+{
+ oox::BinaryXOutputStream aOut( rxOut, false );
+ if ( mpModel )
+ {
+ ::oox::ole::ControlConverter aConv( mxDocModel, maGrfHelper );
+ maControl.convertFromProperties( mxControlModel, aConv );
+ mpModel->maSize.first = rSize.Width;
+ mpModel->maSize.second = rSize.Height;
+ mpModel->exportBinaryModel( aOut );
+ }
+}
+
+MSConvertOCXControls::MSConvertOCXControls( const Reference< ::com::sun::star::frame::XModel >& rxModel ) : SvxMSConvertOCXControls( rxModel ), mxCtx( lcl_getUnoCtx() ), maGrfHelper( mxCtx, lcl_getFrame( rxModel ), StorageRef() )
+{
+}
+
+MSConvertOCXControls::~MSConvertOCXControls()
{
}
bool
-OleFormCtrlImportHelper::importControlFromStream( ::oox::BinaryInputStream& rInStrm, Reference< XFormComponent >& rxFormComp, const ::rtl::OUString& rGuidString )
+MSConvertOCXControls::importControlFromStream( ::oox::BinaryInputStream& rInStrm, Reference< XFormComponent >& rxFormComp, const ::rtl::OUString& rGuidString )
{
::oox::ole::EmbeddedControl aControl( CREATE_OUSTRING( "Unknown" ) );
if( ::oox::ole::ControlModelBase* pModel = aControl.createModelFromGuid( rGuidString ) )
@@ -354,21 +577,30 @@ OleFormCtrlImportHelper::importControlFromStream( ::oox::BinaryInputStream& rInS
return rxFormComp.is();
}
-bool
-OleFormCtrlImportHelper::importFormControlFromCtls( Reference< XFormComponent > & rxFormComp,
+sal_Bool
+MSConvertOCXControls::ReadOCXCtlsStream( SotStorageStreamRef& rSrc1, Reference< XFormComponent > & rxFormComp,
sal_Int32 nPos,
sal_Int32 nStreamSize)
{
- if ( mpRoot.get() && mpRoot->isStorage() )
+ if ( rSrc1.Is() )
{
- if ( !mpCtlsStrm.get() )
- mpCtlsStrm.reset( new BinaryXInputStream( mpRoot->openInputStream( CREATE_OUSTRING( "Ctls" ) ), true ) );
- mpCtlsStrm->seek( nPos );
- OUString aStrmClassId = ::oox::ole::OleHelper::importGuid( *mpCtlsStrm );
+ BinaryXInputStream aCtlsStrm( Reference< XInputStream >( new utl::OSeekableInputStreamWrapper( *rSrc1 ) ), true );
+ aCtlsStrm.seek( nPos );
+ OUString aStrmClassId = ::oox::ole::OleHelper::importGuid( aCtlsStrm );
+ return importControlFromStream( aCtlsStrm, rxFormComp, aStrmClassId, nStreamSize );
+ }
+ return sal_False;
+}
+bool MSConvertOCXControls::importControlFromStream( ::oox::BinaryInputStream& rInStrm, Reference< XFormComponent >& rxFormComp, const rtl::OUString& rStrmClassId,
+ sal_Int32 nStreamSize)
+{
+ if ( !rInStrm.isEof() )
+ {
+ // Special processing for those html controls
bool bOneOfHtmlControls = false;
- if ( aStrmClassId.toAsciiUpperCase().equalsAscii( HTML_GUID_SELECT )
- || aStrmClassId.toAsciiUpperCase().equalsAscii( HTML_GUID_TEXTBOX ) )
+ if ( rStrmClassId.toAsciiUpperCase().equalsAscii( HTML_GUID_SELECT )
+ || rStrmClassId.toAsciiUpperCase().equalsAscii( HTML_GUID_TEXTBOX ) )
bOneOfHtmlControls = false;
if ( bOneOfHtmlControls )
@@ -377,33 +609,42 @@ OleFormCtrlImportHelper::importFormControlFromCtls( Reference< XFormComponent >
// in the binary stream.
// Given the control stream length create a stream of nStreamSize bytes starting from
// nPos ( offset by the guid already read in )
+ if ( !nStreamSize )
+ return false;
const int nGuidSize = 0x10;
StreamDataSequence aDataSeq;
sal_Int32 nBytesToRead = nStreamSize - nGuidSize;
while ( nBytesToRead )
- nBytesToRead -= mpCtlsStrm->readData( aDataSeq, nBytesToRead );
+ nBytesToRead -= rInStrm.readData( aDataSeq, nBytesToRead );
SequenceInputStream aInSeqStream( aDataSeq );
- importControlFromStream( aInSeqStream, rxFormComp, aStrmClassId );
+ importControlFromStream( aInSeqStream, rxFormComp, rStrmClassId );
}
else
{
- importControlFromStream( *mpCtlsStrm, rxFormComp, aStrmClassId );
+ importControlFromStream( rInStrm, rxFormComp, rStrmClassId );
}
}
return rxFormComp.is();
}
-bool OleFormCtrlImportHelper::importControlFromStorage( ::oox::StorageRef xObjStrg,
+sal_Bool MSConvertOCXControls::ReadOCXStorage( SotStorageRef& xOleStg,
Reference< XFormComponent > & rxFormComp )
{
- if ( xObjStrg.get() && xObjStrg->isStorage() )
+ if ( xOleStg.Is() )
{
- BinaryXInputStream aNameStream( xObjStrg->openInputStream( CREATE_OUSTRING("\3OCXNAME") ), true );
- BinaryXInputStream aInStrm( xObjStrg->openInputStream( CREATE_OUSTRING("contents") ), true );
- BinaryXInputStream aClsStrm( xObjStrg->openInputStream( CREATE_OUSTRING("\1CompObj") ), true );
+ SvStorageStreamRef pNameStream = xOleStg->OpenSotStream( CREATE_OUSTRING("\3OCXNAME"));
+ BinaryXInputStream aNameStream( Reference< XInputStream >( new utl::OSeekableInputStreamWrapper( *pNameStream ) ), true );
+
+ SvStorageStreamRef pContents = xOleStg->OpenSotStream( CREATE_OUSTRING("contents"));
+ BinaryXInputStream aInStrm( Reference< XInputStream >( new utl::OSeekableInputStreamWrapper( *pContents ) ), true );
+
+
+ SvStorageStreamRef pClsStrm = xOleStg->OpenSotStream( CREATE_OUSTRING("\1CompObj") );
+ BinaryXInputStream aClsStrm( Reference< XInputStream >( new utl::OSeekableInputStreamWrapper(*pClsStrm ) ), true );
aClsStrm.skip(12);
+
OUString aStrmClassId = ::oox::ole::OleHelper::importGuid( aClsStrm );
- if ( importControlFromStream( aInStrm, rxFormComp, aStrmClassId ) )
+ if ( importControlFromStream( aInStrm, rxFormComp, aStrmClassId, aInStrm.size() ) )
{
OUString aName = aNameStream.readNulUnicodeArray();
Reference< XControlModel > xCtlModel( rxFormComp, UNO_QUERY );
@@ -414,37 +655,144 @@ bool OleFormCtrlImportHelper::importControlFromStorage( ::oox::StorageRef xObjSt
PropertySet aPropSet( xCtlModel );
aPropSet.setProperties( aPropMap );
}
+ return rxFormComp.is();
}
}
- return rxFormComp.is();
+ return sal_False;
}
-bool
-OleFormCtrlImportHelper::importFormControlFromObjStorage( Reference< XFormComponent > & rxFormComp )
+sal_Bool MSConvertOCXControls::WriteOCXStream( const Reference< XModel >& rxModel, SotStorageRef &xOleStg,
+ const Reference< XControlModel > &rxControlModel,
+ const com::sun::star::awt::Size& rSize, rtl::OUString &rName)
+{
+ SvGlobalName aName;
+
+ OleFormCtrlExportHelper exportHelper( lcl_getUnoCtx(), rxModel, rxControlModel );
+
+ if ( !exportHelper.isValid() )
+ return sal_False;
+
+ rtl::OUString sId = exportHelper.getGUID();
+ aName.MakeId(sId);
+
+ rtl::OUString sFullName = exportHelper.getFullName();
+ rName = exportHelper.getTypeName();
+ xOleStg->SetClass( aName,0x5C,sFullName);
+ {
+ SvStorageStreamRef pNameStream = xOleStg->OpenSotStream( CREATE_OUSTRING("\3OCXNAME"));
+ Reference< XOutputStream > xOut = new utl::OSeekableOutputStreamWrapper( *pNameStream );
+ exportHelper.exportName( xOut );
+ }
+ {
+ SvStorageStreamRef pObjStream = xOleStg->OpenSotStream( CREATE_OUSTRING("\1CompObj"));
+ Reference< XOutputStream > xOut = new utl::OSeekableOutputStreamWrapper( *pObjStream );
+ exportHelper.exportCompObj( xOut );
+ }
+ {
+ SvStorageStreamRef pContents = xOleStg->OpenSotStream( CREATE_OUSTRING("contents"));
+ Reference< XOutputStream > xOut = new utl::OSeekableOutputStreamWrapper( *pContents );
+ exportHelper.exportControl( xOut, rSize );
+ }
+ return sal_True;
+}
+
+#if SvxMSConvertOCXControlsRemoved
+const Reference< com::sun::star::lang::XMultiServiceFactory > & MSConvertOCXControls::GetServiceFactory()
{
- return importControlFromStorage( mpRoot, rxFormComp );
+ if ( !mxServiceFactory.is() && mxModel.is() )
+ mxServiceFactory.set( mxModel, UNO_QUERY );
+ return mxServiceFactory;
}
-bool
-OleFormCtrlImportHelper::importFormControlFromObjPool( Reference< XFormComponent > & rxFormComp,
- const ::rtl::OUString& rPoolName )
+const Reference< XIndexContainer >&
+ MSConvertOCXControls::GetFormComps()
{
- bool bRet = false;
- if ( mpRoot.get() )
+ if( !mxFormComps.is() )
{
- if ( !mpPoolStrg.get() )
- mpPoolStrg = mpRoot->openSubStorage( CREATE_OUSTRING( "ObjectPool" ), false );
- if ( !mpPoolStrg.get() )
- return false;
- if ( mpPoolStrg->isStorage() )
+ GetDrawPage();
+ if( mxDrawPage.is() )
{
- StorageRef xObjStrg = mpPoolStrg->openSubStorage( rPoolName, false );
- bRet = importControlFromStorage( xObjStrg, rxFormComp );
+ Reference< XFormsSupplier > xFormsSupplier( mxDrawPage,
+ UNO_QUERY );
+ OSL_ENSURE( xFormsSupplier.is(),
+ "not able to get XFormsSupplier from XDrawPage" );
+
+ Reference< XNameContainer > xNameCont =
+ xFormsSupplier->getForms();
+
+ rtl::OUString sStdName = CREATE_OUSTRING( "WW-Standard" );
+ rtl::OUString sName( sStdName );
+ sal_uInt16 n = 0;
+
+ while( xNameCont->hasByName( sName ) )
+ {
+ sName = sStdName;
+ sName += String::CreateFromInt32( ++n );
+ }
+
+ const Reference< XMultiServiceFactory > &rServiceFactory
+ = GetServiceFactory();
+ if( !rServiceFactory.is() )
+ return mxFormComps;
+
+ Reference< XInterface > xCreate =
+ rServiceFactory->createInstance( CREATE_OUSTRING(
+ "com.sun.star.form.component.Form"));
+ if( xCreate.is() )
+ {
+ Reference< XPropertySet > xFormPropSet( xCreate,
+ UNO_QUERY );
+
+ Any aTmp(&sName,getCppuType((OUString *)0));
+ xFormPropSet->setPropertyValue( CREATE_OUSTRING("Name"), aTmp );
+
+ Reference< XForm > xForm( xCreate, UNO_QUERY );
+ OSL_ENSURE(xForm.is(), "No Form?");
+
+ Reference< XIndexContainer > xForms( xNameCont,
+ UNO_QUERY );
+ OSL_ENSURE( xForms.is(), "XForms not available" );
+
+ aTmp.setValue( &xForm,
+ ::getCppuType((Reference < XForm >*)0));
+ xForms->insertByIndex( xForms->getCount(), aTmp );
+
+ mxFormComps = Reference< XIndexContainer >
+ (xCreate, UNO_QUERY);
+ }
}
}
- return bRet;
+
+ return mxFormComps;
+}
+const Reference< XDrawPage >& MSConvertOCXControls::GetDrawPage()
+{
+ if( !mxDrawPage.is() && mxModel.is() )
+ {
+ Reference< XDrawPageSupplier > xTxtDoc(mxModel, UNO_QUERY);
+ OSL_ENSURE( xTxtDoc.is(),"no XDrawPageSupplier from XModel");
+ mxDrawPage = xTxtDoc->getDrawPage();
+ OSL_ENSURE( mxDrawPage.is(), "no XDrawPage" );
+ }
+ return mxDrawPage;
}
+const Reference< XShapes >& MSConvertOCXControls::GetShapes()
+{
+ if( !mxShapes.is() )
+ {
+ GetDrawPage();
+ if( mxDrawPage.is() )
+ {
+
+ mxShapes = Reference< XShapes >(mxDrawPage,
+ UNO_QUERY);
+ OSL_ENSURE( mxShapes.is(), "no XShapes from XDrawPage" );
+ }
+ }
+ return mxShapes;
+}
+#endif
// ============================================================================
} // namespace ole
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 64c76b6a684a..28320662f23d 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -85,6 +85,7 @@ CharWeightComplex
CircleEndAngle
CircleKind
CircleStartAngle
+ClassId
CodeName
Color
ColumnGrand
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 123c337f21da..0c04214f60ac 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -3171,8 +3171,8 @@ XclImpDffConverter::XclImpDffConvData::XclImpDffConvData(
XclImpDffConverter::XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm ) :
XclImpSimpleDffConverter( rRoot, rDffStrm ),
+ oox::ole::MSConvertOCXControls( rRoot.GetDocShell()->GetModel() ),
maStdFormName( CREATE_OUSTRING( "Standard" ) ),
- maFormCtrlHelper( GetMedium().GetInputStream(), lcl_getUnoCtx(), GetDocShell()->GetModel() ),
mnOleImpFlags( 0 )
{
const SvtFilterOptions& rFilterOpt = SvtFilterOptions::Get();
@@ -3330,15 +3330,14 @@ SdrObject* XclImpDffConverter::CreateSdrObject( const XclImpPictureObj& rPicObj,
/* set controls form, needed in virtual function InsertControl()
called from ReadOCXExcelKludgeStream() */
InitControlForm();
- // seek to stream position of the extra data for this control
- mxCtlsStrm->Seek( rPicObj.GetCtlsStreamPos() );
+
// read from mxCtlsStrm into xShape, insert the control model into the form
Reference< XShape > xShape;
if( GetConvData().mxCtrlForm.is() )
{
Reference< XFormComponent > xFComp;
com::sun::star::awt::Size aSz; // not used in import
- maFormCtrlHelper.importFormControlFromCtls( xFComp, rPicObj.GetCtlsStreamPos(), rPicObj.GetCtlsStreamSize() );
+ ReadOCXCtlsStream( mxCtlsStrm, xFComp, rPicObj.GetCtlsStreamPos(), rPicObj.GetCtlsStreamSize() );
// recreate the method formally known as
// ReadOCXExcelKludgeStream( )
if ( xFComp.is() )
diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index 975dac9495b1..e7e2db587d5e 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -32,7 +32,6 @@
#include <vector>
#include <map>
#include <filter/msfilter/msdffimp.hxx>
-#include <filter/msfilter/msocximex.hxx>
#include <vcl/graph.hxx>
#include "xlescher.hxx"
#include "xiroot.hxx"
@@ -988,7 +987,7 @@ protected:
contains core implementation of DFF stream import and OCX form control
import.
*/
-class XclImpDffConverter : public XclImpSimpleDffConverter
+class XclImpDffConverter : public XclImpSimpleDffConverter, private oox::ole::MSConvertOCXControls
{
public:
explicit XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm );
@@ -1095,7 +1094,6 @@ private:
typedef ::std::vector< XclImpDffConvDataRef > XclImpDffConvDataStack;
const ::rtl::OUString maStdFormName; /// Standard name of control forms.
- ::oox::ole::OleFormCtrlImportHelper maFormCtrlHelper;
SotStorageStreamRef mxCtlsStrm; /// The 'Ctls' stream for OCX form controls.
ScfProgressBarRef mxProgress; /// The progress bar used in ProcessObj().
XclImpDffConvDataStack maDataStack; /// Stack for registered drawing managers.
diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx
index 89cda3e19eb9..cf60b12f1cc4 100644
--- a/sc/source/filter/xcl97/xcl97esc.cxx
+++ b/sc/source/filter/xcl97/xcl97esc.cxx
@@ -42,7 +42,6 @@
#include <svx/svdoole2.hxx>
#include <svx/unoapi.hxx>
#include <svx/fmglob.hxx>
-#include <filter/msfilter/msocximex.hxx>
#include <vcl/outdev.hxx>
#include <unotools/tempfile.hxx>
#include <unotools/ucbstreamhelper.hxx>
diff --git a/sd/inc/pch/precompiled_sd.hxx b/sd/inc/pch/precompiled_sd.hxx
index d69122633cb1..51524bf49a73 100644
--- a/sd/inc/pch/precompiled_sd.hxx
+++ b/sd/inc/pch/precompiled_sd.hxx
@@ -631,7 +631,6 @@
#include "editeng/lspcitem.hxx"
#include "svx/modctrl.hxx"
#include "svx/msdffdef.hxx"
-#include "filter/msfilter/msocximex.hxx"
#include "filter/msfilter/msoleexp.hxx"
#include "editeng/numitem.hxx"
#include "svx/obj3d.hxx"
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index b996d205cf1d..832e7b0b7c1c 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -64,6 +64,7 @@
#include <editeng/flditem.hxx>
#include <sfx2/docinf.hxx>
#include <oox/export/utils.hxx>
+#include <oox/ole/olehelper.hxx>
using namespace com::sun::star;
using namespace ::com::sun::star::uno;
@@ -1332,10 +1333,10 @@ void PPTWriter::ImplWriteOLE( )
{
if ( pPtr->xControlModel.is() )
{
- String aName;
+ rtl::OUString aName;
::com::sun::star::awt::Size aSize;
SvStorageRef xDest( new SvStorage( new SvMemoryStream(), sal_True ) );
- sal_Bool bOk = SvxMSConvertOCXControls::WriteOCXStream( xDest, pPtr->xControlModel, aSize, aName );
+ sal_Bool bOk = oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xDest, pPtr->xControlModel, aSize, aName );
if ( bOk )
pStrm = xDest->CreateMemoryStream();
}
diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx
index a3284bd9f810..5695aa595e45 100644
--- a/sd/source/filter/eppt/eppt.hxx
+++ b/sd/source/filter/eppt/eppt.hxx
@@ -83,7 +83,6 @@
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/awt/XControlModel.hpp>
#include <com/sun/star/style/TabStop.hpp>
-#include <filter/msfilter/msocximex.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 62967ac171e1..10932acc9fa5 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -89,7 +89,7 @@
#include <com/sun/star/table/XMergeableCell.hpp>
#include <com/sun/star/table/BorderLine.hpp>
#include <set>
-
+#include <oox/ole/olehelper.hxx>
#include "i18npool/mslangid.hxx"
using namespace ::com::sun::star;
@@ -2564,9 +2564,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
<< (sal_uInt32)0x0012de00;
::com::sun::star::awt::Size aSize;
- String aControlName;
+ rtl::OUString aControlName;
SvStorageRef xTemp( new SvStorage( new SvMemoryStream(), sal_True ) );
- if ( SvxMSConvertOCXControls::WriteOCXStream( xTemp, aXControlModel, aSize, aControlName ) )
+ if ( oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xTemp, aXControlModel, aSize, aControlName ) )
{
String aUserName( xTemp->GetUserName() );
String aOleIdentifier;
@@ -2602,7 +2602,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
}
}
}
- if ( aControlName.Len() )
+
+ if ( aControlName.getLength() )
PPTWriter::WriteCString( *mpExEmbed, aControlName, 1 );
if ( aOleIdentifier.Len() )
PPTWriter::WriteCString( *mpExEmbed, aOleIdentifier, 2 );
@@ -2623,15 +2624,15 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
aPropOpt.AddOpt( ESCHER_Prop_pictureId, mnExEmbed );
aPropOpt.AddOpt( ESCHER_Prop_pictureActive, 0x10000 );
- if ( aControlName.Len() )
+ if ( aControlName.getLength() )
{
sal_uInt16 i, nBufSize;
- nBufSize = ( aControlName.Len() + 1 ) << 1;
+ nBufSize = ( aControlName.getLength() + 1 ) << 1;
sal_uInt8* pBuf = new sal_uInt8[ nBufSize ];
sal_uInt8* pTmp = pBuf;
- for ( i = 0; i < aControlName.Len(); i++ )
+ for ( i = 0; i < aControlName.getLength(); i++ )
{
- sal_Unicode nUnicode = aControlName.GetChar( i );
+ sal_Unicode nUnicode = *(aControlName.getStr() + i);
*pTmp++ = (sal_uInt8)nUnicode;
*pTmp++ = (sal_uInt8)( nUnicode >> 8 );
}
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 0f4c8824758f..2620f2026c36 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -103,6 +103,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/componentcontext.hxx>
#include <comphelper/string.hxx>
+#include <oox/ole/olehelper.hxx>
using namespace ::com::sun::star;
@@ -2707,10 +2708,16 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
bool
-ImplSdPPTImport::ReadFormControl( uno::Reference< io::XInputStream >& xIs, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const
+ImplSdPPTImport::ReadFormControl( SotStorageRef& rSrc1, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const
{
- ::oox::ole::OleFormCtrlImportHelper maFormCtrlHelper( xIs, lcl_getUnoCtx(), mpDoc->GetDocSh()->GetModel() );
- return maFormCtrlHelper.importFormControlFromObjStorage( rFormComp );
+ uno::Reference< frame::XModel > xModel;
+ if ( mpDoc->GetDocSh() )
+ {
+ xModel = mpDoc->GetDocSh()->GetModel();
+ oox::ole::MSConvertOCXControls mCtrlImporter( xModel );
+ return mCtrlImporter.ReadOCXStorage( rSrc1, rFormComp );
+ }
+ return false;
}
// ---------------------
diff --git a/sd/source/filter/ppt/pptin.hxx b/sd/source/filter/ppt/pptin.hxx
index babc2a3ae538..39bd87405601 100644
--- a/sd/source/filter/ppt/pptin.hxx
+++ b/sd/source/filter/ppt/pptin.hxx
@@ -36,7 +36,6 @@
#include <filter/msfilter/msfiltertracer.hxx>
#include <com/sun/star/uno/Any.h>
#include <boost/shared_ptr.hpp>
-#include <oox/ole/olehelper.hxx>
class SdDrawDocument;
class SfxMedium;
@@ -71,7 +70,6 @@ class ImplSdPPTImport : public SdrPowerPointImport
SdrLayerID mnBackgroundObjectsLayerID;
tAnimationMap maAnimations;
-// ::oox::ole::OleFormCtrlImportHelper maFormCtrlHelper;
void SetHeaderFooterPageSettings( SdPage* pPage, const PptSlidePersistEntry* pMasterPersist );
void ImportPageEffect( SdPage* pPage, const sal_Bool bNewAnimationsUsed );
@@ -90,7 +88,7 @@ public:
~ImplSdPPTImport();
sal_Bool Import();
- virtual bool ReadFormControl( com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& xIs, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const;
+ virtual bool ReadFormControl( SotStorageRef& rSrc1, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const;
};
class SdPPTImport
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index d577822dc843..bc40045e9695 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -760,7 +760,6 @@
#include "filter/msfilter/mscodec.hxx"
#include "filter/msfilter/msdffimp.hxx"
#include "filter/msfilter/msfiltertracer.hxx"
-#include "filter/msfilter/msocximex.hxx"
#include "filter/msfilter/msoleexp.hxx"
#include "editeng/numitem.hxx"
#include "svx/numvset.hxx"
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 4abb4975a789..7695670cfcd3 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -110,6 +110,8 @@
#include <oox/ole/olehelper.hxx>
#include <comphelper/componentcontext.hxx>
#include <fstream>
+#include <unotools/streamwrap.hxx>
+
using ::editeng::SvxBorderLine;
using namespace com::sun::star;
@@ -2783,7 +2785,8 @@ lcl_getUnoCtx()
}
-SwMSConvertControls::SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP ) : SvxMSConvertOCXControls( pDSh,pP ), maFormCtrlHelper( pDocSh->GetMedium()->GetInputStream(), lcl_getUnoCtx(), pDocSh->GetModel() )
+SwMSConvertControls::SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP ) : oox
+::ole::MSConvertOCXControls( pDSh ? pDSh->GetModel() : NULL ), pPaM( pP )
{
}
@@ -2794,7 +2797,7 @@ sal_Bool SwMSConvertControls::ReadOCXStream( SotStorageRef& rSrc1,
sal_Bool bFloatingCtrl )
{
uno::Reference< form::XFormComponent > xFComp;
- sal_Bool bRes = maFormCtrlHelper.importFormControlFromObjPool( xFComp, rtl::OUString( rSrc1->GetName() ) );
+ sal_Bool bRes = oox::ole::MSConvertOCXControls::ReadOCXStorage( rSrc1, xFComp );
if ( bRes && xFComp.is() )
{
com::sun::star::awt::Size aSz; // not used in import
@@ -2833,13 +2836,17 @@ bool SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrObject *pOb
SvStorageRef xOleStg = xObjPool->OpenSotStorage(sStorageName,
STREAM_READWRITE|STREAM_SHARE_DENYALL);
+
if (!xOleStg.Is())
return false;
- String sName;
- if (!WriteOCXStream(xOleStg,xControlModel,aSize,sName))
+
+ rtl::OUString sUName;
+ if (!WriteOCXStream( mxModel, xOleStg,xControlModel,aSize,sUName))
return false;
+ String sName = sUName;
+
sal_uInt8 aSpecOLE[] =
{
0x03, 0x6a, 0xFF, 0xFF, 0xFF, 0xFF, // sprmCPicLocation
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 9f7eb841f16e..676ac87aa3c7 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -53,7 +53,6 @@
#include <editeng/hyznitem.hxx>
#include <editeng/langitem.hxx>
#include <filter/msfilter/msoleexp.hxx>
-#include <filter/msfilter/msocximex.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/ulspitem.hxx>
#include <editeng/boxitem.hxx>
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 7359f2903b38..e2d7aeac22e7 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -38,7 +38,6 @@
#include <shellio.hxx>
#include <wrt_fn.hxx>
-#include <filter/msfilter/msocximex.hxx>
#include "ww8struc.hxx"
#include "ww8scan.hxx"
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 901d87670320..1961630c5a15 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -31,7 +31,6 @@
#include <tools/string.hxx>
#include <filter/msfilter/msdffimp.hxx>
-#include <filter/msfilter/msocximex.hxx>
#include <editeng/frmdir.hxx>
#include <fltshell.hxx> // fuer den Attribut Stack
@@ -582,16 +581,15 @@ enum SwWw8ControlType
WW8_CT_DROPDOWN
};
-
-class WW8FormulaControl : public OCX_Control
+class WW8FormulaControl
{
protected:
SwWW8ImplReader &rRdr;
public:
WW8FormulaControl(const String& rN, SwWW8ImplReader &rR)
- : OCX_Control(rN), rRdr(rR), fUnknown(0), fDropdownIndex(0),
+ : rRdr(rR), fUnknown(0), fDropdownIndex(0),
fToolTip(0), fNoMark(0), fUseSize(0), fNumbersOnly(0), fDateOnly(0),
- fUnused(0), nSize(0), hpsCheckBox(20), nChecked(0)
+ fUnused(0), nSize(0), hpsCheckBox(20), nChecked(0), sName( rN )
{
}
sal_uInt8 fUnknown:2;
@@ -621,6 +619,7 @@ public:
com::sun::star::uno::Reference <
com::sun::star::form::XFormComponent> &rFComp,
com::sun::star::awt::Size &rSz) = 0;
+ UniString sName;
private:
//No copying
WW8FormulaControl(const WW8FormulaControl&);
@@ -677,7 +676,7 @@ public:
com::sun::star::awt::Size & /* rSz */) { return sal_False; }
};
-class SwMSConvertControls: public SvxMSConvertOCXControls
+class SwMSConvertControls: public oox::ole::MSConvertOCXControls
{
public:
SwMSConvertControls( SfxObjectShell *pDSh,SwPaM *pP );
@@ -693,7 +692,7 @@ public:
com::sun::star::drawing::XShape > *pShapeRef=0,
sal_Bool bFloatingCtrl=false );
private:
- ::oox::ole::OleFormCtrlImportHelper maFormCtrlHelper;
+ SwPaM *pPaM;
};
class SwMSDffManager : public SvxMSDffManager
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 604a81170b69..1b38b33ead64 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -72,7 +72,6 @@
#include <editeng/crsditem.hxx>
#include <editeng/udlnitem.hxx>
#include <editeng/postitem.hxx>
-#include <filter/msfilter/msocximex.hxx>
#include <unotextrange.hxx>
#include <doc.hxx>
#include <docary.hxx>
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index c99d48d9555e..98d0ba9e5dd4 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -41,7 +41,6 @@
#include <svx/svdoole2.hxx>
#include <filter/msfilter/msdffimp.hxx>
#include <svx/unoapi.hxx>
-#include <filter/msfilter/msocximex.hxx>
#include <sot/exchange.hxx>
#include <swtypes.hxx>