1 --- sc/source/filter/excel/excimp8.cxx.old 2009-04-06 16:41:49.000000000 +0000
2 +++ sc/source/filter/excel/excimp8.cxx 2009-04-06 16:41:59.000000000 +0000
3 @@ -275,11 +275,11 @@ void ImportExcel8::ReadBasic( void )
4 SvxImportMSVBasic aBasicImport( *pShell, *xRootStrg, bLoadCode, bLoadStrg );
5 bool bAsComment = !bLoadExecutable || !lcl_hasVBAEnabled();
6 aBasicImport.Import( EXC_STORAGE_VBA_PROJECT, EXC_STORAGE_VBA, bAsComment );
7 + GetObjectManager().SetOleNameOverrideInfo( aBasicImport.ControlNameForObjectId() );
13 void ImportExcel8::EndSheet( void )
15 GetCondFormatManager().Apply();
16 --- sc/source/filter/excel/xiescher.cxx.old 2009-04-06 16:41:49.000000000 +0000
17 +++ sc/source/filter/excel/xiescher.cxx 2009-04-06 16:41:59.000000000 +0000
20 #include "xichart.hxx"
21 #include "xicontent.hxx"
22 +#include "scextopt.hxx"
24 #include "namebuff.hxx"
26 using ::rtl::OUString;
27 @@ -399,11 +401,16 @@ void XclImpDrawObjBase::SetAnchor( const
29 String XclImpDrawObjBase::GetObjName() const
31 + String sName( GetObjectManager().GetOleNameOverride( GetObjId() ) );
34 /* #118053# #i51348# Always return a non-empty name. Create English
35 default names depending on the object type. This is not implemented as
36 virtual functions in derived classes, as class type and object type may
38 - return (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this );
39 + if ( sName.Len() == 0 )
40 + sName = ( (maObjName.Len() > 0) ? maObjName : GetObjectManager().GetDefaultObjName( *this ) );
44 bool XclImpDrawObjBase::IsValidSize( const Rectangle& rAnchorRect ) const
45 @@ -3086,6 +3093,23 @@ XclImpDffManager::~XclImpDffManager()
49 +String XclImpObjectManager::GetOleNameOverride( const XclObjId& nObjId )
52 + String sCodeName = GetExtDocOptions().GetCodeName( nObjId.mnScTab );
54 + CodeNameToCntrlObjIdInfo::iterator it = maOleCtrlNameOverride.find( sCodeName );
55 + if ( it != maOleCtrlNameOverride.end() )
57 + CntrlObjIdToName::iterator it_id = it->second.find( nObjId.mnObjId );
58 + if ( it_id != it->second.end() )
60 + sOleName = it_id->second;
66 void XclImpDffManager::StartProgressBar( sal_Size nProgressSize )
68 mxProgress.reset( new ScfProgressBar( GetDocShell(), STR_PROGRESS_CALCULATING ) );
69 --- sc/source/filter/inc/xiescher.hxx.old 2009-04-06 16:41:46.000000000 +0000
70 +++ sc/source/filter/inc/xiescher.hxx 2009-04-06 16:41:59.000000000 +0000
76 #include <svx/msdffimp.hxx>
77 #include <svx/msocximex.hxx>
78 #include <vcl/graph.hxx>
79 @@ -1085,6 +1086,8 @@ private:
80 /** Stores all drawing and OLE objects and additional data related to these objects. */
81 class XclImpObjectManager : protected XclImpRoot
83 +typedef std::hash_map< sal_Int32, String > CntrlObjIdToName;
84 +typedef std::map< String, CntrlObjIdToName > CodeNameToCntrlObjIdInfo;
86 explicit XclImpObjectManager( const XclImpRoot& rRoot );
87 virtual ~XclImpObjectManager();
88 @@ -1130,9 +1133,13 @@ public:
89 String GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
90 /** Returns the used area in the sheet with the passed index. */
91 ScRange GetUsedArea( SCTAB nScTab ) const;
93 + void SetOleNameOverrideInfo( const CodeNameToCntrlObjIdInfo& rOverrideInfo ) { maOleCtrlNameOverride = rOverrideInfo; }
94 + String GetOleNameOverride( const XclObjId& nObjId );
95 // ------------------------------------------------------------------------
98 + CodeNameToCntrlObjIdInfo maOleCtrlNameOverride;
100 /** Reads and returns a bitmap from WMF/PICT format. */
101 static void ReadWmf( Graphic& rGraphic, XclImpStream& rStrm );
102 /** Reads and returns a bitmap from BMP format. */
103 --- svx/inc/svxmsbas.hxx.old 2009-04-02 11:03:40.000000000 +0000
104 +++ svx/inc/svxmsbas.hxx 2009-04-06 16:41:59.000000000 +0000
106 #include "svx/svxdllapi.h"
108 #include <sot/storage.hxx>
112 class SfxObjectShell;
114 @@ -53,8 +55,15 @@ class SfxObjectShell;
115 * probably what the user expects to see when viewing the code
118 +typedef std::hash_map< sal_Int32, String > ObjIdToName;
120 +typedef std::map< String, ObjIdToName > ControlAttributeInfo;
122 class SVX_DLLPUBLIC SvxImportMSVBasic
125 + ControlAttributeInfo m_ModuleNameToObjIdHash;
126 + void extractAttribute( const String& rAttribute, const String& rModName );
129 SvxImportMSVBasic( SfxObjectShell &rDocS, SotStorage &rRoot,
130 BOOL bImportCode = TRUE, BOOL bCopyStorage = TRUE )
131 @@ -73,9 +82,10 @@ public:
132 // - returns a warning code if a modified basic exist, in all other
133 // cases return ERRCODE_NONE.
134 ULONG SaveOrDelMSVBAStorage( BOOL bSaveInto, const String& rStorageName );
136 // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
137 // If it exist, then return the WarningId for loosing the information.
139 + const ControlAttributeInfo& ControlNameForObjectId(){ return m_ModuleNameToObjIdHash; }
140 static ULONG GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
142 static String GetMSBasicStorageName();
143 @@ -87,7 +97,7 @@ private:
145 SVX_DLLPRIVATE BOOL ImportCode_Impl( const String& rStorageName,
146 const String &rSubStorageName,
147 - BOOL bAsComment, BOOL bStripped);
148 + BOOL bAsComment, BOOL bStripped );
149 SVX_DLLPRIVATE bool ImportForms_Impl(const String& rStorageName,
150 const String &rSubStorageName);
151 SVX_DLLPRIVATE BOOL CopyStorage_Impl( const String& rStorageName,
152 --- svx/source/msfilter/svxmsbas.cxx.old 2009-04-02 11:03:03.000000000 +0000
153 +++ svx/source/msfilter/svxmsbas.cxx 2009-04-06 16:41:59.000000000 +0000
154 @@ -61,6 +61,23 @@ using namespace com::sun::star;
158 +void SvxImportMSVBasic::extractAttribute( const String& rAttribute, const String& rModName )
160 + // format of the attribute we are interested in is
161 + // Attribute VB_Control = "ControlName", intString, MSForms, ControlTypeAsString
163 + // Attribute VB_Control = "CommandButton1, 201, 19, MSForms, CommandButton"
164 + String sControlAttribute( RTL_CONSTASCII_USTRINGPARAM("Attribute VB_Control = \"") );
165 + if ( rAttribute.Search( sControlAttribute ) != STRING_NOTFOUND )
167 + String sRest = rAttribute.Copy( sControlAttribute.Len() );
168 + xub_StrLen nPos = 0;
169 + String sCntrlName = sRest.GetToken( 0, ',', nPos );
171 + sal_Int32 nCntrlId = sRest.GetToken( 0, ',', nPos).ToInt32();
172 + m_ModuleNameToObjIdHash[ rModName ][ nCntrlId ] = sCntrlName;
175 int SvxImportMSVBasic::Import( const String& rStorageName,
176 const String &rSubStorageName,
177 BOOL bAsComment, BOOL bStripped )
178 @@ -369,7 +386,12 @@ BOOL SvxImportMSVBasic::ImportCode_Impl(
179 if( nEnd == STRING_NOTFOUND )
183 + //OSL_TRACE("Erase %s", rtl::OUStringToOString(*pStr, RTL_TEXTENCODING_UTF8 ).getStr() );
184 + String sAttr= pStr->Copy( nBegin, (nEnd-nBegin)+1);
185 + extractAttribute( sAttr, sModule );
186 pStr->Erase(nBegin, (nEnd-nBegin)+1);
190 if( aDecompressed.Get(j)->Len() )