diff options
-rw-r--r-- | filter/inc/filter/msfilter/msvbahelper.hxx | 3 | ||||
-rw-r--r-- | filter/source/msfilter/msvbahelper.cxx | 31 | ||||
-rw-r--r-- | filter/source/msfilter/msvbasic.cxx | 71 | ||||
-rw-r--r-- | filter/source/msfilter/svxmsbas.cxx | 5 | ||||
-rwxr-xr-x | oox/inc/oox/ole/axbinaryreader.hxx | 20 | ||||
-rw-r--r-- | oox/inc/oox/ole/axcontrol.hxx | 72 | ||||
-rwxr-xr-x | oox/inc/oox/ole/vbacontrol.hxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/textbodyproperties.cxx | 5 | ||||
-rw-r--r-- | oox/source/dump/biffdumper.ini | 1 | ||||
-rw-r--r-- | oox/source/dump/dumperbase.ini | 2 | ||||
-rw-r--r-- | oox/source/dump/oledumper.ini | 16 | ||||
-rwxr-xr-x | oox/source/ole/axbinaryreader.cxx | 62 | ||||
-rw-r--r-- | oox/source/ole/axcontrol.cxx | 143 | ||||
-rwxr-xr-x | oox/source/ole/vbacontrol.cxx | 12 | ||||
-rw-r--r-- | oox/source/token/properties.txt | 2 | ||||
-rw-r--r-- | oox/source/xls/chartsheetfragment.cxx | 1 | ||||
-rw-r--r-- | oox/source/xls/formulabase.cxx | 5 |
17 files changed, 351 insertions, 108 deletions
diff --git a/filter/inc/filter/msfilter/msvbahelper.hxx b/filter/inc/filter/msfilter/msvbahelper.hxx index 540097c054dc..81607c9b296c 100644 --- a/filter/inc/filter/msfilter/msvbahelper.hxx +++ b/filter/inc/filter/msfilter/msvbahelper.hxx @@ -48,7 +48,8 @@ namespace ooo { namespace vba }; MSFILTER_DLLPUBLIC String makeMacroURL( const String& sMacroName ); - MSFILTER_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false ); + MSFILTER_DLLPUBLIC ::rtl::OUString extractMacroName( const ::rtl::OUString& rMacroUrl ); + MSFILTER_DLLPUBLIC VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUString& sMod, bool bSearchGlobalTemplates = false ); MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const String& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller ); } } diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index 97529c22eae6..18ecc5ae6530 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -41,16 +41,27 @@ using namespace ::com::sun::star; +namespace ooo { namespace vba { + const static rtl::OUString sUrlPart0 = rtl::OUString::createFromAscii( "vnd.sun.star.script:"); const static rtl::OUString sUrlPart1 = rtl::OUString::createFromAscii( "?language=Basic&location=document"); -namespace ooo { namespace vba { - String makeMacroURL( const String& sMacroName ) { return sUrlPart0.concat( sMacroName ).concat( sUrlPart1 ) ; } +::rtl::OUString extractMacroName( const ::rtl::OUString& rMacroUrl ) +{ + if( (rMacroUrl.getLength() > sUrlPart0.getLength() + sUrlPart1.getLength()) && + rMacroUrl.match( sUrlPart0 ) && + rMacroUrl.match( sUrlPart1, rMacroUrl.getLength() - sUrlPart1.getLength() ) ) + { + return rMacroUrl.copy( sUrlPart0.getLength(), rMacroUrl.getLength() - sUrlPart0.getLength() - sUrlPart1.getLength() ); + } + return ::rtl::OUString(); +} + SfxObjectShell* findShellForUrl( const rtl::OUString& sMacroURLOrPath ) { SfxObjectShell* pFoundShell=NULL; @@ -186,9 +197,15 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin if ( !pShell ) return aRes; aRes.SetMacroDocContext( pShell ); + + // the name may be enclosed in apostrophs + ::rtl::OUString sMacroUrl = MacroName; + sal_Int32 nMacroLen = MacroName.getLength(); + if( (nMacroLen >= 2) && (MacroName[0] == '\'') && (MacroName[nMacroLen-1] == '\'') ) + sMacroUrl = MacroName.copy( 1, nMacroLen - 2 ); + // parse the macro name - sal_Int32 nDocSepIndex = MacroName.indexOfAsciiL( "!", 1 ); - String sMacroUrl = MacroName; + sal_Int32 nDocSepIndex = sMacroUrl.indexOf( '!' ); String sContainer; String sModule; @@ -201,8 +218,8 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin // recursively // assume for now that the document name is *this* document - String sDocUrlOrPath = MacroName.copy( 0, nDocSepIndex ); - sMacroUrl = MacroName.copy( nDocSepIndex + 1 ); + String sDocUrlOrPath = sMacroUrl.copy( 0, nDocSepIndex ); + sMacroUrl = sMacroUrl.copy( nDocSepIndex + 1 ); OSL_TRACE("doc search, current shell is 0x%x", pShell ); SfxObjectShell* pFoundShell = findShellForUrl( sDocUrlOrPath ); OSL_TRACE("doc search, after find, found shell is 0x%x", pFoundShell ); @@ -215,7 +232,7 @@ VBAMacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const rtl::OUStrin // document is created from ) // macro format = Container.Module.Procedure - parseMacro( MacroName, sContainer, sModule, sProcedure ); + parseMacro( sMacroUrl, sContainer, sModule, sProcedure ); uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY); uno::Reference< container::XNameContainer > xPrjNameCache; if ( xSF.is() ) diff --git a/filter/source/msfilter/msvbasic.cxx b/filter/source/msfilter/msvbasic.cxx index be8ee6bd30e5..65d39953ec20 100644 --- a/filter/source/msfilter/msvbasic.cxx +++ b/filter/source/msfilter/msvbasic.cxx @@ -170,75 +170,36 @@ int VBA_Impl::ReadVBAProject(const SvStorageRef &rxVBAStorage) return 0; } - static const sal_uInt8 aOffice2003LE_2[] = - { - 0x79, 0x00, 0x00, 0x01, 0x00, 0xFF - }; - - static const sal_uInt8 aOffice2003LE[] = - { - 0x76, 0x00, 0x00, 0x01, 0x00, 0xFF - }; - - static const sal_uInt8 aOfficeXPLE[] = - { - 0x73, 0x00, 0x00, 0x01, 0x00, 0xFF - }; - - static const sal_uInt8 aOfficeXPBE[] = - { - 0x63, 0x00, 0x00, 0x0E, 0x00, 0xFF - }; + static const sal_uInt8 aOffice2007LE[] = { 0x88, 0x00, 0x00, 0x01, 0x00, 0xFF }; + static const sal_uInt8 aOffice2003LE_2[] = { 0x79, 0x00, 0x00, 0x01, 0x00, 0xFF }; + static const sal_uInt8 aOffice2003LE[] = { 0x76, 0x00, 0x00, 0x01, 0x00, 0xFF }; + static const sal_uInt8 aOfficeXPLE[] = { 0x73, 0x00, 0x00, 0x01, 0x00, 0xFF }; + static const sal_uInt8 aOfficeXPBE[] = { 0x63, 0x00, 0x00, 0x0E, 0x00, 0xFF }; + static const sal_uInt8 aOffice2000LE[] = { 0x6D, 0x00, 0x00, 0x01, 0x00, 0xFF }; + static const sal_uInt8 aOffice98BE[] = { 0x60, 0x00, 0x00, 0x0E, 0x00, 0xFF }; + static const sal_uInt8 aOffice97LE[] = { 0x5E, 0x00, 0x00, 0x01, 0x00, 0xFF }; - static const sal_uInt8 aOffice2000LE[] = - { - 0x6D, 0x00, 0x00, 0x01, 0x00, 0xFF - }; - static const sal_uInt8 aOffice98BE[] = - { - 0x60, 0x00, 0x00, 0x0E, 0x00, 0xFF - }; - static const sal_uInt8 aOffice97LE[] = - { - 0x5E, 0x00, 0x00, 0x01, 0x00, 0xFF - }; sal_uInt8 aProduct[6]; xVBAProject->Read( aProduct, sizeof(aProduct) ); bool bIsUnicode; - if (!(memcmp(aProduct, aOffice2003LE, sizeof(aProduct))) || - !(memcmp(aProduct, aOffice2003LE_2, sizeof(aProduct))) ) - { - xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - bIsUnicode = true; - } - else if (!(memcmp(aProduct, aOfficeXPLE, sizeof(aProduct)))) + if (!(memcmp(aProduct, aOffice2007LE, sizeof(aProduct))) || + !(memcmp(aProduct, aOffice2003LE, sizeof(aProduct))) || + !(memcmp(aProduct, aOffice2003LE_2, sizeof(aProduct))) || + !(memcmp(aProduct, aOfficeXPLE, sizeof(aProduct))) || + !(memcmp(aProduct, aOffice2000LE, sizeof(aProduct))) || + !(memcmp(aProduct, aOffice97LE, sizeof(aProduct))) ) { xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); bIsUnicode = true; } - else if (!(memcmp(aProduct, aOfficeXPBE, sizeof(aProduct)))) + else if (!(memcmp(aProduct, aOfficeXPBE, sizeof(aProduct))) || + !(memcmp(aProduct, aOffice98BE, sizeof(aProduct))) ) { xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); mbMac = true; bIsUnicode = false; } - else if (!(memcmp(aProduct, aOffice2000LE, sizeof(aProduct)))) - { - xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - bIsUnicode = true; - } - else if (!(memcmp(aProduct, aOffice98BE, sizeof(aProduct)))) - { - xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN ); - mbMac = true; - bIsUnicode = false; - } - else if (!(memcmp(aProduct, aOffice97LE, sizeof(aProduct)))) - { - xVBAProject->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - bIsUnicode = true; - } else { switch (aProduct[3]) diff --git a/filter/source/msfilter/svxmsbas.cxx b/filter/source/msfilter/svxmsbas.cxx index 55465850d8c8..49fd4a7544f3 100644 --- a/filter/source/msfilter/svxmsbas.cxx +++ b/filter/source/msfilter/svxmsbas.cxx @@ -360,10 +360,9 @@ BOOL SvxImportMSVBasic::ImportCode_Impl( const String& rStorageName, static ::rtl::OUString sClassOption( RTL_CONSTASCII_USTRINGPARAM( "Option ClassModule\n" ) ); if ( !bAsComment ) { - modeTypeComment = modeTypeComment + sVBAOption; + modeTypeComment += sVBAOption; if ( mType == ModuleType::CLASS ) - modeTypeComment = modeTypeComment + sClassOption; - + modeTypeComment += sClassOption; } String sModule(sBasicModule); //#i52606# no need to split Macros in 64KB blocks any more! diff --git a/oox/inc/oox/ole/axbinaryreader.hxx b/oox/inc/oox/ole/axbinaryreader.hxx index d036e958a446..e3f102716e17 100755 --- a/oox/inc/oox/ole/axbinaryreader.hxx +++ b/oox/inc/oox/ole/axbinaryreader.hxx @@ -87,6 +87,9 @@ private: /** A pair of integer values as a property. */ typedef ::std::pair< sal_Int32, sal_Int32 > AxPairData; +/** An array of string values as a property. */ +typedef ::std::vector< ::rtl::OUString > AxStringArray; + // ============================================================================ const sal_uInt32 AX_FONTDATA_BOLD = 0x00000001; @@ -149,6 +152,9 @@ public: /** Reads the next string property from the stream, if the respective flag in the property mask is set. */ void readStringProperty( ::rtl::OUString& orValue ); + /** Reads a string array property from the stream, if the respective flag + in the property mask is set. */ + void readStringArrayProperty( AxStringArray& orArray ); /** Reads the next GUID property from the stream, if the respective flag in the property mask is set. The GUID will be enclosed in braces. */ void readGuidProperty( ::rtl::OUString& orGuid ); @@ -172,6 +178,9 @@ public: /** Skips the next string property in the stream, if the respective flag in the property mask is set. */ inline void skipStringProperty() { readStringProperty( maDummyString ); } + /** Skips the next string array property in the stream, if the respective + flag in the property mask is set. */ + inline void skipStringArrayProperty() { readStringArrayProperty( maDummyStringArray ); } /** Skips the next GUID property in the stream, if the respective flag in the property mask is set. */ inline void skipGuidProperty() { readGuidProperty( maDummyString ); } @@ -221,6 +230,16 @@ private: virtual bool readProperty( AxAlignedInputStream& rInStrm ); }; + /** Complex property for an array of strings. */ + struct StringArrayProperty : public ComplexProperty + { + AxStringArray& mrArray; + sal_uInt32 mnSize; + inline explicit StringArrayProperty( AxStringArray& rArray, sal_uInt32 nSize ) : + mrArray( rArray ), mnSize( nSize ) {} + virtual bool readProperty( AxAlignedInputStream& rInStrm ); + }; + /** Complex property for a GUID value. */ struct GuidProperty : public ComplexProperty { @@ -261,6 +280,7 @@ private: AxFontData maDummyFontData; /// Dummy font for unsupported properties. StreamDataSequence maDummyPicData; /// Dummy picture for unsupported properties. ::rtl::OUString maDummyString; /// Dummy string for unsupported properties. + AxStringArray maDummyStringArray; /// Dummy string array for unsupported properties. sal_Int64 mnPropFlags; /// Flags specifying existing properties. sal_Int64 mnNextProp; /// Next property to read. sal_Int64 mnPropsEnd; /// End position of simple/large properties. diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx index 7c533334cc49..8df45ece6065 100644 --- a/oox/inc/oox/ole/axcontrol.hxx +++ b/oox/inc/oox/ole/axcontrol.hxx @@ -111,8 +111,12 @@ enum ApiControlType API_CONTROL_COMBOBOX, API_CONTROL_SPINBUTTON, API_CONTROL_SCROLLBAR, + API_CONTROL_TABSTRIP, API_CONTROL_PROGRESSBAR, API_CONTROL_GROUPBOX, + API_CONTROL_FRAME, + API_CONTROL_PAGE, + API_CONTROL_MULTIPAGE, API_CONTROL_DIALOG }; @@ -639,19 +643,50 @@ private: // ============================================================================ +/** Model for a Forms 2.0 tabstrip control. */ +class AxTabStripModel : public AxFontDataModel +{ +public: + explicit AxTabStripModel(); + + virtual bool importBinaryModel( BinaryInputStream& rInStrm ); + + virtual ApiControlType getControlType() const; + virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; + + /** Returns the caption with the specified zero-based index. */ + ::rtl::OUString getCaption( sal_Int32 nIndex ) const; + +private: + AxStringArray maCaptions; /// Captions of all tabs. + sal_uInt32 mnBackColor; /// Fill color. + sal_uInt32 mnTextColor; /// Text color. + sal_uInt32 mnFlags; /// Various flags. + sal_Int32 mnSelectedTab; /// The index of the selected tab. + sal_uInt32 mnTabStyle; /// Visual style of the tabs. + sal_Int32 mnTabFlagCount; /// Number of entries in tab flag array. +}; + +typedef ::boost::shared_ptr< AxTabStripModel > AxTabStripModelRef; + +// ============================================================================ + typedef ::std::vector< ::rtl::OUString > AxClassTable; /** Base class for ActiveX container controls. */ class AxContainerModelBase : public AxFontDataModel { public: - explicit AxContainerModelBase(); + explicit AxContainerModelBase( bool bFontSupport = false ); /** Allows to set single properties specified by XML token identifier. */ virtual void importProperty( sal_Int32 nPropId, const ::rtl::OUString& rValue ); /** Reads the leading structure in the 'f' stream containing the model for this control. */ virtual bool importBinaryModel( BinaryInputStream& rInStrm ); + /** Converts font settings if supported. */ + virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; + /** Reads the class table structure for embedded controls following the own model from the 'f' stream. */ bool importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable ); @@ -672,13 +707,14 @@ protected: sal_Int32 mnPicAlign; /// Anchor position of the picture. sal_Int32 mnPicSizeMode; /// Clip, stretch, zoom. bool mbPicTiling; /// True = picture is repeated. + bool mbFontSupport; /// True = control supports the font property. }; typedef ::boost::shared_ptr< AxContainerModelBase > AxContainerModelRef; // ============================================================================ -/** Model for a Forms 2.0 frame (group box). */ +/** Model for a Forms 2.0 frame control. */ class AxFrameModel : public AxContainerModelBase { public: @@ -690,6 +726,38 @@ public: // ============================================================================ +/** Model for a Forms 2.0 formpage control (a single page in a multipage control). */ +class AxFormPageModel : public AxContainerModelBase +{ +public: + explicit AxFormPageModel(); + + virtual ApiControlType getControlType() const; + virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; +}; + +// ============================================================================ + +/** Model for a Forms 2.0 multipage control. Contains the tabstrip control + (class AxTabStripModel) and the single pages (class AxFormPageModel). */ +class AxMultiPageModel : public AxContainerModelBase +{ +public: + explicit AxMultiPageModel(); + + virtual ApiControlType getControlType() const; + virtual void convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const; + + /** Sets the tabstrip control model related to this multipage control. + Contains all formatting attributes of the page tabs. */ + void setTabStripModel( const AxTabStripModelRef& rxTabStrip ); + +private: + AxTabStripModelRef mxTabStrip; +}; + +// ============================================================================ + /** Model for a Forms 2.0 user form. */ class AxUserFormModel : public AxContainerModelBase { diff --git a/oox/inc/oox/ole/vbacontrol.hxx b/oox/inc/oox/ole/vbacontrol.hxx index ec1c25be6952..c2490b3506bf 100755 --- a/oox/inc/oox/ole/vbacontrol.hxx +++ b/oox/inc/oox/ole/vbacontrol.hxx @@ -39,8 +39,6 @@ namespace oox { class StorageBase; } namespace oox { namespace ole { -class VbaFormControl; - // ============================================================================ /** Common properties for all controls that are part of a VBA user form or of @@ -62,6 +60,10 @@ public: inline const ::rtl::OUString& getName() const { return maName; } /** Returns the position of the control in its parent. */ inline const AxPairData& getPosition() const { return maPos; } + /** Returns the unique identifier of this control. */ + inline sal_Int32 getId() const { return mnId; } + /** Returns true, if the control is visible. */ + bool isVisible() const; /** Returns true, if this control is a container control. */ bool isContainer() const; /** Returns the length of the stream data for stream based controls. */ @@ -122,6 +124,8 @@ public: /** Returns the programmatical name of the control. */ ::rtl::OUString getControlName() const; + /** Returns the unique identifier of this control. */ + sal_Int32 getControlId() const; /** Creates the UNO control model, inserts it into the passed container, and converts all control properties. */ diff --git a/oox/source/drawingml/textbodyproperties.cxx b/oox/source/drawingml/textbodyproperties.cxx index afd4766b0106..6cec7643e58e 100644 --- a/oox/source/drawingml/textbodyproperties.cxx +++ b/oox/source/drawingml/textbodyproperties.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: textbodyproperties.cxx,v $ - * $Revision: 1.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini index 16c3fb883149..fab205733430 100644 --- a/oox/source/dump/biffdumper.ini +++ b/oox/source/dump/biffdumper.ini @@ -1962,6 +1962,7 @@ flagslist=XF-PROTECTION-FLAGS 0x01=locked 0x02=formula-hidden 0x04=style-xf + 0x08=apostroph-quote end flagslist=XF-USEDATTRIBS-FLAGS diff --git a/oox/source/dump/dumperbase.ini b/oox/source/dump/dumperbase.ini index 84d742c2b35f..34ef302c784c 100644 --- a/oox/source/dump/dumperbase.ini +++ b/oox/source/dump/dumperbase.ini @@ -254,7 +254,7 @@ end combilist=RK-FLAGS 0x00000001=div-100 0x00000002=integer - 0xFFFFFFFC=int32,dec,value,,filter=0x2~0x2 + 0xFFFFFFFC=int32,hex,value end constlist=CHARSET diff --git a/oox/source/dump/oledumper.ini b/oox/source/dump/oledumper.ini index 7efe424b0ddc..13478464e6b3 100644 --- a/oox/source/dump/oledumper.ini +++ b/oox/source/dump/oledumper.ini @@ -206,7 +206,7 @@ shortlist=COMCTL-SCROLLBAR-ARROWS,0,both,left-up,right-down constlist=COMCTL-SLIDER-SELECTRANGE 0x00000000=off 0x0000FFFF=on - end +end shortlist=COMCTL-SLIDER-TICKSTYLE,0,bottom-right,top-left,both,no-ticks @@ -218,13 +218,13 @@ shortlist=COMCTL-SLIDER-TICKSTYLE,0,bottom-right,top-left,both,no-ticks flagslist=COMCTL-UPDOWN-FLAGS1 0x00000001=!align-left!align-right 0x00000004=!vertical!horizontal - end +end flagslist=COMCTL-UPDOWN-FLAGS2 0x00000004=wrap 0x00000020=ole-drop-manual 0x00000080=enabled - end +end # image list ----------------------------------------------------------------- @@ -725,11 +725,6 @@ combilist=VBA-FORMSITE-CLASSIDCACHE 0x8000=!predefined-class-id!class-table-index end -constlist=VBA-FORMSITE-CLASSIDCACHEINDEX - include=VBA-FORMSITE-CLASSNAMES - 0x7FFF=invalid -end - constlist=VBA-FORMSITE-CLASSNAMES 7=Forms.Form.1 12=Forms.Image.1 @@ -749,6 +744,11 @@ constlist=VBA-FORMSITE-CLASSNAMES 57=Forms.MultiPage.1 end +constlist=VBA-FORMSITE-CLASSIDCACHEINDEX + include=VBA-FORMSITE-CLASSNAMES + 0x7FFF=invalid +end + # form design extender ------------------------------------------------------ flagslist=VBA-FORMDESIGNEXT-PROPERTIES diff --git a/oox/source/ole/axbinaryreader.cxx b/oox/source/ole/axbinaryreader.cxx index cb7e292b8cf4..68a18932bf42 100755 --- a/oox/source/ole/axbinaryreader.cxx +++ b/oox/source/ole/axbinaryreader.cxx @@ -156,6 +156,30 @@ bool AxFontData::importGuidAndFont( BinaryInputStream& rInStrm ) // ============================================================================ +namespace { + +bool lclReadString( AxAlignedInputStream& rInStrm, OUString& rValue, sal_uInt32 nSize, bool bArrayString ) +{ + bool bCompressed = getFlag( nSize, AX_STRING_COMPRESSED ); + sal_uInt32 nBufSize = nSize & AX_STRING_SIZEMASK; + // Unicode: simple strings store byte count, array strings store char count + sal_Int32 nChars = static_cast< sal_Int32 >( nBufSize / ((bCompressed || bArrayString) ? 1 : 2) ); + bool bValidChars = nChars <= 65536; + OSL_ENSURE( bValidChars, "lclReadString - string too long" ); + sal_Int64 nEndPos = rInStrm.tell() + nChars * (bCompressed ? 1 : 2); + nChars = ::std::min< sal_Int32 >( nChars, 65536 ); + rValue = bCompressed ? + // ISO-8859-1 maps all byte values xx to the same Unicode code point U+00xx + rInStrm.readCharArrayUC( nChars, RTL_TEXTENCODING_ISO_8859_1 ) : + rInStrm.readUnicodeArray( nChars ); + rInStrm.seek( nEndPos ); + return bValidChars; +} + +} // namespace + +// ---------------------------------------------------------------------------- + AxBinaryPropertyReader::ComplexProperty::~ComplexProperty() { } @@ -168,19 +192,22 @@ bool AxBinaryPropertyReader::PairProperty::readProperty( AxAlignedInputStream& r bool AxBinaryPropertyReader::StringProperty::readProperty( AxAlignedInputStream& rInStrm ) { - bool bCompressed = getFlag( mnSize, AX_STRING_COMPRESSED ); - sal_uInt32 nBufSize = mnSize & AX_STRING_SIZEMASK; - sal_Int64 nEndPos = rInStrm.tell() + nBufSize; - sal_Int32 nChars = static_cast< sal_Int32 >( nBufSize / (bCompressed ? 1 : 2) ); - bool bValidChars = nChars <= 65536; - OSL_ENSURE( bValidChars, "StringProperty::readProperty - string too long" ); - nChars = ::std::min< sal_Int32 >( nChars, 65536 ); - mrValue = bCompressed ? - // ISO-8859-1 maps all byte values xx to the same Unicode code point U+00xx - rInStrm.readCharArrayUC( nChars, RTL_TEXTENCODING_ISO_8859_1 ) : - rInStrm.readUnicodeArray( nChars ); - rInStrm.seek( nEndPos ); - return bValidChars; + return lclReadString( rInStrm, mrValue, mnSize, false ); +} + +bool AxBinaryPropertyReader::StringArrayProperty::readProperty( AxAlignedInputStream& rInStrm ) +{ + sal_Int64 nEndPos = rInStrm.tell() + mnSize; + while( rInStrm.tell() < nEndPos ) + { + OUString aString; + if( !lclReadString( rInStrm, aString, rInStrm.readuInt32(), true ) ) + return false; + mrArray.push_back( aString ); + // every array string is aligned on 4 byte boundries + rInStrm.align( 4 ); + } + return true; } bool AxBinaryPropertyReader::GuidProperty::readProperty( AxAlignedInputStream& rInStrm ) @@ -238,6 +265,15 @@ void AxBinaryPropertyReader::readStringProperty( OUString& orValue ) } } +void AxBinaryPropertyReader::readStringArrayProperty( AxStringArray& orArray ) +{ + if( startNextProperty() ) + { + sal_uInt32 nSize = maInStrm.readAligned< sal_uInt32 >(); + maLargeProps.push_back( ComplexPropVector::value_type( new StringArrayProperty( orArray, nSize ) ) ); + } +} + void AxBinaryPropertyReader::readGuidProperty( ::rtl::OUString& orGuid ) { if( startNextProperty() ) diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 95d5c7dc67b7..12664e02899f 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -128,6 +128,7 @@ const sal_uInt32 AX_IMAGE_DEFFLAGS = 0x0000001B; const sal_uInt32 AX_MORPHDATA_DEFFLAGS = 0x2C80081B; const sal_uInt32 AX_SPINBUTTON_DEFFLAGS = 0x0000001B; const sal_uInt32 AX_SCROLLBAR_DEFFLAGS = 0x0000001B; +const sal_uInt32 AX_TABSTRIP_DEFFLAGS = 0x0000001B; const sal_uInt16 AX_POS_TOPLEFT = 0; const sal_uInt16 AX_POS_TOP = 1; @@ -186,6 +187,10 @@ const sal_Int32 AX_ORIENTATION_HORIZONTAL = 1; const sal_Int32 AX_PROPTHUMB_ON = -1; const sal_Int32 AX_PROPTHUMB_OFF = 0; +const sal_uInt32 AX_TABSTRIP_TABS = 0; +const sal_uInt32 AX_TABSTRIP_BUTTONS = 1; +const sal_uInt32 AX_TABSTRIP_NONE = 2; + const sal_uInt32 AX_CONTAINER_ENABLED = 0x00000004; const sal_uInt32 AX_CONTAINER_HASDESIGNEXT = 0x00004000; const sal_uInt32 AX_CONTAINER_NOCLASSTABLE = 0x00008000; @@ -231,14 +236,6 @@ ControlConverter::~ControlConverter() // Generic conversion --------------------------------------------------------- -void ControlConverter::convertSize( PropertyMap& rPropMap, const AxPairData& rSize ) const -{ - // size is given in 1/100 mm, UNO needs AppFont units - Size aAppFontSize = mrGraphicHelper.convertHmmToAppFont( Size( rSize.first, rSize.second ) ); - rPropMap.setProperty( PROP_Width, aAppFontSize.Width ); - rPropMap.setProperty( PROP_Height, aAppFontSize.Height ); -} - void ControlConverter::convertPosition( PropertyMap& rPropMap, const AxPairData& rPos ) const { // position is given in 1/100 mm, UNO needs AppFont units @@ -247,6 +244,14 @@ void ControlConverter::convertPosition( PropertyMap& rPropMap, const AxPairData& rPropMap.setProperty( PROP_PositionY, aAppFontPos.Y ); } +void ControlConverter::convertSize( PropertyMap& rPropMap, const AxPairData& rSize ) const +{ + // size is given in 1/100 mm, UNO needs AppFont units + Size aAppFontSize = mrGraphicHelper.convertHmmToAppFont( Size( rSize.first, rSize.second ) ); + rPropMap.setProperty( PROP_Width, aAppFontSize.Width ); + rPropMap.setProperty( PROP_Height, aAppFontSize.Height ); +} + void ControlConverter::convertColor( PropertyMap& rPropMap, sal_Int32 nPropId, sal_uInt32 nOleColor ) const { rPropMap.setProperty( nPropId, OleHelper::decodeOleColor( mrGraphicHelper, nOleColor, mbDefaultColorBgr ) ); @@ -1362,7 +1367,69 @@ void AxScrollBarModel::convertProperties( PropertyMap& rPropMap, const ControlCo // ============================================================================ -AxContainerModelBase::AxContainerModelBase() : +AxTabStripModel::AxTabStripModel() : + AxFontDataModel( false ), // no support for Align property + mnBackColor( AX_SYSCOLOR_BUTTONFACE ), + mnTextColor( AX_SYSCOLOR_BUTTONTEXT ), + mnFlags( AX_TABSTRIP_DEFFLAGS ), + mnSelectedTab( -1 ), + mnTabStyle( AX_TABSTRIP_TABS ), + mnTabFlagCount( 0 ) +{ +} + +bool AxTabStripModel::importBinaryModel( BinaryInputStream& rInStrm ) +{ + AxBinaryPropertyReader aReader( rInStrm ); + aReader.readIntProperty< sal_Int32 >( mnSelectedTab ); + aReader.readIntProperty< sal_uInt32 >( mnBackColor ); + aReader.readIntProperty< sal_uInt32 >( mnTextColor ); + aReader.skipUndefinedProperty(); + aReader.readPairProperty( maSize ); + aReader.readStringArrayProperty( maCaptions ); + aReader.skipIntProperty< sal_uInt8 >(); // mouse pointer + aReader.skipUndefinedProperty(); + aReader.skipIntProperty< sal_uInt32 >(); // tab orientation + aReader.readIntProperty< sal_uInt32 >( mnTabStyle ); + aReader.skipBoolProperty(); // multiple rows + aReader.skipIntProperty< sal_uInt32 >(); // fixed width + aReader.skipIntProperty< sal_uInt32 >(); // fixed height + aReader.skipBoolProperty(); // tooltips + aReader.skipUndefinedProperty(); + aReader.skipStringArrayProperty(); // tooltip strings + aReader.skipUndefinedProperty(); + aReader.skipStringArrayProperty(); // tab names + aReader.readIntProperty< sal_uInt32 >( mnFlags ); + aReader.skipBoolProperty(); // new version + aReader.skipIntProperty< sal_uInt32 >(); // tabs allocated + aReader.skipStringArrayProperty(); // tags + aReader.readIntProperty< sal_uInt32 >( mnTabFlagCount ); + aReader.skipStringArrayProperty(); // accelerators + aReader.skipPictureProperty(); // mouse icon + return aReader.finalizeImport() && AxFontDataModel::importBinaryModel( rInStrm ); +} + +ApiControlType AxTabStripModel::getControlType() const +{ + return API_CONTROL_TABSTRIP; +} + +void AxTabStripModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const +{ + rPropMap.setProperty( PROP_Decoration, mnTabStyle != AX_TABSTRIP_NONE ); + rPropMap.setProperty( PROP_MultiPageValue, mnSelectedTab ); + rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor ); + AxFontDataModel::convertProperties( rPropMap, rConv ); +} + +OUString AxTabStripModel::getCaption( sal_Int32 nIndex ) const +{ + return ContainerHelper::getVectorElement( maCaptions, nIndex, OUString() ); +} + +// ============================================================================ + +AxContainerModelBase::AxContainerModelBase( bool bFontSupport ) : AxFontDataModel( false ), // no support for Align property maLogicalSize( AX_CONTAINER_DEFWIDTH, AX_CONTAINER_DEFHEIGHT ), maScrollPos( 0, 0 ), @@ -1376,7 +1443,8 @@ AxContainerModelBase::AxContainerModelBase() : mnSpecialEffect( AX_SPECIALEFFECT_FLAT ), mnPicAlign( AX_PICALIGN_CENTER ), mnPicSizeMode( AX_PICSIZE_CLIP ), - mbPicTiling( false ) + mbPicTiling( false ), + mbFontSupport( bFontSupport ) { setAwtModelMode(); // different default size for frame @@ -1423,6 +1491,15 @@ bool AxContainerModelBase::importBinaryModel( BinaryInputStream& rInStrm ) return aReader.finalizeImport(); } +void AxContainerModelBase::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const +{ + if( mbFontSupport ) + { + rConv.convertColor( rPropMap, PROP_TextColor, mnTextColor ); + AxFontDataModel::convertProperties( rPropMap, rConv ); + } +} + bool AxContainerModelBase::importClassTable( BinaryInputStream& rInStrm, AxClassTable& orClassTable ) { bool bValid = true; @@ -1457,7 +1534,8 @@ bool AxContainerModelBase::importClassTable( BinaryInputStream& rInStrm, AxClass // ============================================================================ -AxFrameModel::AxFrameModel() +AxFrameModel::AxFrameModel() : + AxContainerModelBase( true ) { } @@ -1475,6 +1553,49 @@ void AxFrameModel::convertProperties( PropertyMap& rPropMap, const ControlConver // ============================================================================ +AxFormPageModel::AxFormPageModel() +{ +} + +ApiControlType AxFormPageModel::getControlType() const +{ + return API_CONTROL_PAGE; +} + +void AxFormPageModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const +{ + rPropMap.setProperty( PROP_Title, maCaption ); + rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_CONTAINER_ENABLED ) ); + rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor ); + AxContainerModelBase::convertProperties( rPropMap, rConv ); +} + +// ============================================================================ + +AxMultiPageModel::AxMultiPageModel() +{ +} + +ApiControlType AxMultiPageModel::getControlType() const +{ + return API_CONTROL_MULTIPAGE; +} + +void AxMultiPageModel::convertProperties( PropertyMap& rPropMap, const ControlConverter& rConv ) const +{ + rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_CONTAINER_ENABLED ) ); + if( mxTabStrip.get() ) + mxTabStrip->convertProperties( rPropMap, rConv ); + AxContainerModelBase::convertProperties( rPropMap, rConv ); +} + +void AxMultiPageModel::setTabStripModel( const AxTabStripModelRef& rxTabStrip ) +{ + mxTabStrip = rxTabStrip; +} + +// ============================================================================ + AxUserFormModel::AxUserFormModel() { } diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx index b43e8289a592..4952b956bae4 100755 --- a/oox/source/ole/vbacontrol.cxx +++ b/oox/source/ole/vbacontrol.cxx @@ -231,6 +231,11 @@ void VbaSiteModel::moveRelative( const AxPairData& rDistance ) maPos.second += rDistance.second; } +bool VbaSiteModel::isVisible() const +{ + return getFlag( mnFlags, VBA_SITE_VISIBLE ); +} + bool VbaSiteModel::isContainer() const { return !getFlag( mnFlags, VBA_SITE_OSTREAM ); @@ -326,7 +331,7 @@ void VbaSiteModel::convertProperties( PropertyMap& rPropMap, if( (0 <= nCtrlIndex) && (nCtrlIndex <= SAL_MAX_INT16) ) rPropMap.setProperty( PROP_TabIndex, static_cast< sal_Int16 >( nCtrlIndex ) ); // progress bar and group box support TabIndex, but not Tabstop... - if( (eCtrlType != API_CONTROL_PROGRESSBAR) && (eCtrlType != API_CONTROL_GROUPBOX) ) + if( (eCtrlType != API_CONTROL_PROGRESSBAR) && (eCtrlType != API_CONTROL_GROUPBOX) && (eCtrlType != API_CONTROL_FRAME) && (eCtrlType != API_CONTROL_PAGE) ) rPropMap.setProperty( PROP_Tabstop, getFlag( mnFlags, VBA_SITE_TABSTOP ) ); rConv.convertPosition( rPropMap, maPos ); } @@ -367,6 +372,11 @@ OUString VbaFormControl::getControlName() const return mxSiteModel.get() ? mxSiteModel->getName() : OUString(); } +sal_Int32 VbaFormControl::getControlId() const +{ + return mxSiteModel.get() ? mxSiteModel->getId() : -1; +} + void VbaFormControl::createAndConvert( sal_Int32 nCtrlIndex, const Reference< XNameContainer >& rxParentNC, const ControlConverter& rConv ) const { diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt index 609eeda60cde..59018311d49f 100644 --- a/oox/source/token/properties.txt +++ b/oox/source/token/properties.txt @@ -99,6 +99,7 @@ D3DScenePerspective D3DSceneShadeMode DDELinks DatabaseRanges +Decoration DefaultContext DefaultScrollValue DefaultSpinValue @@ -247,6 +248,7 @@ MinorTickmarks MissingValueTreatment Model MultiLine +MultiPageValue MultiSelection Name NamedRanges diff --git a/oox/source/xls/chartsheetfragment.cxx b/oox/source/xls/chartsheetfragment.cxx index 4980312900fd..287518584cc3 100644 --- a/oox/source/xls/chartsheetfragment.cxx +++ b/oox/source/xls/chartsheetfragment.cxx @@ -263,6 +263,7 @@ bool BiffChartsheetFragment::importFragment() case BIFF8: switch( nRecId ) { + case BIFF_ID_CODENAME: rWorksheetSett.importCodeName( mrStrm ); break; case BIFF_ID_HCENTER: rPageSett.importHorCenter( mrStrm ); break; case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break; case BIFF_ID_PICTURE: rPageSett.importPicture( mrStrm ); break; diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx index b2e5ba0ee931..ea353bb48558 100644 --- a/oox/source/xls/formulabase.cxx +++ b/oox/source/xls/formulabase.cxx @@ -1262,6 +1262,11 @@ bool OpCodeProviderImpl::initFuncOpCode( FunctionInfo& orFuncInfo, const ApiToke maParserMap.push_back( aEntry ); } } + else + { + // ignore entries for functions unknown by Calc *and* by Excel + bIsValid = orFuncInfo.maOoxFuncName.getLength() == 0; + } } else if( orFuncInfo.mnBiffFuncId == BIFF_FUNC_EXTERNCALL ) { |