[ooo-build-commit] .: patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Aug 3 11:29:16 PDT 2010


 patches/dev300/apply                                      |   11 
 patches/dev300/calc-dp-sort-fix.diff                      |  244 ++++++++++++++
 patches/dev300/calc-xls-import-biff2-file-sheet-name.diff |   27 +
 patches/dev300/dde-reconnect-on-load-sc.diff              |   61 +++
 patches/dev300/dde-reconnect-on-load-sfx2.diff            |  200 +++++++++++
 patches/dev300/dde-reconnect-on-load-sw.diff              |   38 ++
 6 files changed, 581 insertions(+)

New commits:
commit 44fb9e4515b488e4bd5375146de090c8110c689d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Aug 3 14:24:31 2010 -0400

    Ported patches from ooo-build-3-2-1 CalcExperimental section.
    
    * patches/dev300/apply: added new patches.
    
    * patches/dev300/calc-dp-sort-fix.diff: display correct data field
      names in the data field options dialog.  The correct name to display
      should consist of the function name (e.g. SUM) followed by the
      display name. (n#629920)
    
    * patches/dev300/calc-xls-import-biff2-file-sheet-name.diff: use the
      file name as the sheet name when importing the Excel 2.1 worksheet
      document. (n#612902)
    
    * patches/dev300/dde-reconnect-on-load-sc.diff:
    * patches/dev300/dde-reconnect-on-load-sfx2.diff:
    * patches/dev300/dde-reconnect-on-load-sw.diff: re-connect DDE connection
      as appropriate when opening a new Writer/Calc document.
      (n#618846, n#618864)

diff --git a/patches/dev300/apply b/patches/dev300/apply
index e3ac220..c29decc 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -3471,6 +3471,17 @@ calc-perf-ods-export-hidden-rows.diff, deb#582785, kohei
 # Opening an xml file with xls extension
 sc-xml-with-xls-ext.diff, n#527738, muthusuba
 
+# Set file name as the sheet name when importing Excel 2.1 worksheet file.
+calc-xls-import-biff2-file-sheet-name.diff, n#612902, kohei
+
+# Re-connect DDE linkage upon loading of source files.
+dde-reconnect-on-load-sc.diff,   n#618846, n#618864, kohei
+dde-reconnect-on-load-sw.diff,   n#618846, n#618864, kohei
+dde-reconnect-on-load-sfx2.diff, n#618846, n#618864, kohei
+
+# Properly display data field names in the data field options dialog.
+calc-dp-sort-fix.diff, n#629920, kohei
+
 [ GentooExperimental ]
 SectionOwner => hmth
 # jemalloc allocator
diff --git a/patches/dev300/calc-dp-sort-fix.diff b/patches/dev300/calc-dp-sort-fix.diff
new file mode 100644
index 0000000..49c1a70
--- /dev/null
+++ b/patches/dev300/calc-dp-sort-fix.diff
@@ -0,0 +1,244 @@
+diff --git sc/inc/pivot.hxx sc/inc/pivot.hxx
+index 09a88b4..72f8e4e 100644
+--- sc/inc/pivot.hxx
++++ sc/inc/pivot.hxx
+@@ -133,6 +133,16 @@ typedef PivotField          PivotPageFieldArr[PIVOT_MAXPAGEFIELD];
+ 
+ //------------------------------------------------------------------------
+ 
++struct ScDPName
++{
++    ::rtl::OUString     maName;         /// Original name of the dimension.
++    ::rtl::OUString     maLayoutName;   /// Layout name (display name)
++
++    explicit ScDPName(const ::rtl::OUString& rName, const ::rtl::OUString& rLayoutName);
++};
++
++// ============================================================================
++
+ struct ScDPLabelData
+ {
+     ::rtl::OUString     maName;         /// Original name of the dimension.
+@@ -190,7 +200,7 @@ struct ScDPFuncData
+ // ============================================================================
+ 
+ typedef std::vector< ScDPLabelData > ScDPLabelDataVec;
+-typedef std::vector< String > ScDPNameVec;
++typedef std::vector<ScDPName> ScDPNameVec;
+ 
+ // ============================================================================
+ 
+diff --git sc/source/core/data/pivot2.cxx sc/source/core/data/pivot2.cxx
+index eea170b..e2bfbe8 100644
+--- sc/source/core/data/pivot2.cxx
++++ sc/source/core/data/pivot2.cxx
+@@ -63,6 +63,11 @@ using ::rtl::OUString;
+ // STATIC DATA -----------------------------------------------------------
+ // ============================================================================
+ 
++ScDPName::ScDPName(const OUString& rName, const OUString& rLayoutName) :
++    maName(rName), maLayoutName(rLayoutName) {}
++
++// ============================================================================
++
+ ScDPLabelData::Member::Member() :
+     mbVisible(true),
+     mbShowDetails(true)
+diff --git sc/source/ui/dbgui/pvfundlg.cxx sc/source/ui/dbgui/pvfundlg.cxx
+index bcaa5de..f697842 100644
+--- sc/source/ui/dbgui/pvfundlg.cxx
++++ sc/source/ui/dbgui/pvfundlg.cxx
+@@ -545,7 +545,7 @@ void ScDPSubtotalOptDlg::FillLabelData( ScDPLabelData& rLabelData ) const
+     else
+         rLabelData.maSortInfo.Mode = DataPilotFieldSortMode::DATA;
+ 
+-    rLabelData.maSortInfo.Field = maLbSortBy.GetSelectEntry();
++    rLabelData.maSortInfo.Field = GetFieldName(maLbSortBy.GetSelectEntry());
+     rLabelData.maSortInfo.IsAscending = maRbSortAsc.IsChecked();
+ 
+     // *** LAYOUT MODE ***
+@@ -558,7 +558,7 @@ void ScDPSubtotalOptDlg::FillLabelData( ScDPLabelData& rLabelData ) const
+     rLabelData.maShowInfo.IsEnabled = maCbShow.IsChecked();
+     rLabelData.maShowInfo.ShowItemsMode = maLbShowFromWrp.GetControlValue();
+     rLabelData.maShowInfo.ItemCount = sal::static_int_cast<sal_Int32>( maNfShow.GetValue() );
+-    rLabelData.maShowInfo.DataField = maLbShowUsing.GetSelectEntry();
++    rLabelData.maShowInfo.DataField = GetFieldName(maLbShowUsing.GetSelectEntry());
+ 
+     // *** HIDDEN ITEMS ***
+ 
+@@ -583,9 +583,13 @@ void ScDPSubtotalOptDlg::Init( const ScDPNameVec& rDataFields, bool bEnableLayou
+ 
+     for( ScDPNameVec::const_iterator aIt = rDataFields.begin(), aEnd = rDataFields.end(); aIt != aEnd; ++aIt )
+     {
+-        maLbSortBy.InsertEntry( *aIt );
+-        maLbShowUsing.InsertEntry( *aIt );  // for AutoShow
++        // Cache names for later lookup.
++        maDataFieldNameMap.insert(NameMapType::value_type(aIt->maLayoutName, aIt->maName));
++
++        maLbSortBy.InsertEntry( aIt->maLayoutName );
++        maLbShowUsing.InsertEntry( aIt->maLayoutName );  // for AutoShow
+     }
++
+     if( maLbSortBy.GetEntryCount() > SC_SORTDATA_POS )
+         maLbSortBy.SetSeparatorPos( SC_SORTDATA_POS - 1 );
+ 
+@@ -681,6 +685,12 @@ void ScDPSubtotalOptDlg::InitHideListBox()
+     maLbHide.Enable( bEnable );
+ }
+ 
++const OUString& ScDPSubtotalOptDlg::GetFieldName(const OUString& rLayoutName) const
++{
++    NameMapType::const_iterator itr = maDataFieldNameMap.find(rLayoutName);
++    return itr == maDataFieldNameMap.end() ? rLayoutName : itr->second;
++}
++
+ IMPL_LINK( ScDPSubtotalOptDlg, RadioClickHdl, RadioButton*, pBtn )
+ {
+     maLbSortBy.Enable( pBtn != &maRbSortMan );
+diff --git sc/source/ui/dbgui/pvlaydlg.cxx sc/source/ui/dbgui/pvlaydlg.cxx
+index 1b2c41e..81eac1b 100644
+--- sc/source/ui/dbgui/pvlaydlg.cxx
++++ sc/source/ui/dbgui/pvlaydlg.cxx
+@@ -469,10 +469,14 @@ void ScDPLayoutDlg::InitWnd( PivotField* pArr, long nCount, ScDPFieldType eType
+                         DBG_ASSERT( pData, "ScDPLabelData not found" );
+                         if (pData)
+                         {
+-                            String aStr( GetFuncString( (*pInitArr)[j]->mnFuncMask,
+-                                                         pData->mbIsValue ) );
++                            OUString aStr = pData->maLayoutName;
++                            if (!aStr.getLength())
++                            {
++                                USHORT nInitMask = (*pInitArr)[j]->mnFuncMask;
++                                aStr = GetFuncString(nInitMask, pData->mbIsValue);
++                                aStr += pData->maName;
++                            }
+ 
+-                            aStr += GetLabelString( nCol );
+                             pInitWnd->AddField( aStr, j );
+ 
+                             pData->mnFuncMask = nMask;
+@@ -615,10 +619,14 @@ void ScDPLayoutDlg::AddField( size_t nFromIndex, ScDPFieldType eToType, const Po
+         }
+         else
+         {
++            ScDPLabelData* p = GetLabelData(fData.mnCol);
++            OUString aStr = p->maLayoutName;
+             USHORT nMask = fData.mnFuncMask;
+-            OUString aStr = GetFuncString( nMask, rData.mbIsValue );
+-            
+-            aStr += rData.getDisplayName();
++            if (!aStr.getLength())
++            {
++                aStr = GetFuncString(nMask);
++                aStr += p->maName;
++            }
+ 
+             if ( toWnd->AddField( aStr,
+                                   DlgPos2WndPos( rAtPos, *toWnd ),
+@@ -765,10 +773,14 @@ void ScDPLayoutDlg::MoveField( ScDPFieldType eFromType, size_t nFromIndex, ScDPF
+                     }
+                     else
+                     {
+-                        String aStr;
++                        ScDPLabelData* p = GetLabelData(fData.mnCol);
++                        OUString aStr = p->maLayoutName;
+                         USHORT nMask = fData.mnFuncMask;
+-                        aStr  = GetFuncString( nMask );
+-                        aStr += GetLabelString( fData.mnCol );
++                        if (!aStr.getLength())
++                        {
++                            aStr = GetFuncString(nMask);
++                            aStr += p->maName;
++                        }
+ 
+                         if ( toWnd->AddField( aStr,
+                                               DlgPos2WndPos( rAtPos, *toWnd ),
+@@ -846,10 +858,14 @@ void ScDPLayoutDlg::MoveField( ScDPFieldType eFromType, size_t nFromIndex, ScDPF
+                 }
+                 else
+                 {
+-                    String aStr;
++                    ScDPLabelData* p = GetLabelData(fData.mnCol);
++                    OUString aStr = p->maLayoutName;
+                     USHORT nMask = fData.mnFuncMask;
+-                    aStr  = GetFuncString( nMask );
+-                    aStr += GetLabelString( fData.mnCol );
++                    if (!aStr.getLength())
++                    {
++                        aStr = GetFuncString(nMask);
++                        aStr += p->maName;
++                    }
+ 
+                     if ( theWnd->AddField( aStr,
+                                            DlgPos2WndPos( rAtPos, *theWnd ),
+@@ -1017,13 +1033,26 @@ void ScDPLayoutDlg::NotifyDoubleClick( ScDPFieldType eType, size_t nFieldIndex )
+                 case TYPE_ROW:
+                 {
+                     // list of names of all data fields
+-                    std::vector< String > aDataFieldNames;
++                    vector<ScDPName> aDataFieldNames;
+                     for( ScDPFuncDataVec::const_iterator aIt = aDataArr.begin(), aEnd = aDataArr.end();
+                             (aIt != aEnd) && aIt->get(); ++aIt )
+                     {
+-                        String aName( GetLabelString( (*aIt)->mnCol ) );
+-                        if( aName.Len() )
+-                            aDataFieldNames.push_back( aName );
++                        ScDPLabelData* pDFData = GetLabelData((*aIt)->mnCol);
++                        if (!pDFData)
++                            continue;
++
++                        if (!pDFData->maName.getLength())
++                            continue;
++
++                        OUString aLayoutName = pDFData->maLayoutName;
++                        if (!aLayoutName.getLength())
++                        {
++                            // No layout name exists.  Use the stock name.
++                            USHORT nMask = (*aIt)->mnFuncMask;
++                            OUString aFuncStr = GetFuncString(nMask);
++                            aLayoutName = aFuncStr + pDFData->maName;
++                        }
++                        aDataFieldNames.push_back(ScDPName(pDFData->maName, aLayoutName));
+                     }
+ 
+                     bool bLayout = (eType == TYPE_ROW) &&
+@@ -1053,8 +1082,14 @@ void ScDPLayoutDlg::NotifyDoubleClick( ScDPFieldType eType, size_t nFieldIndex )
+                         (*pArr)[nFieldIndex]->mnFuncMask = pData->mnFuncMask = pDlg->GetFuncMask();
+                         (*pArr)[nFieldIndex]->maFieldRef = pDlg->GetFieldRef();
+ 
+-                        String aStr( GetFuncString ( aDataArr[nFieldIndex]->mnFuncMask ) );
+-                        aStr += GetLabelString( aDataArr[nFieldIndex]->mnCol );
++                        ScDPLabelData* p = GetLabelData(aDataArr[nFieldIndex]->mnCol);
++                        OUString aStr = p->maLayoutName;
++                        if (!aStr.getLength())
++                        {
++                            // Layout name is not available.  Use default name.
++                            aStr = GetFuncString (aDataArr[nFieldIndex]->mnFuncMask);
++                            aStr += p->maName;
++                        }
+                         aWndData.SetFieldText( aStr, nFieldIndex );
+                     }
+                     delete pDlg;
+diff --git sc/source/ui/inc/pvfundlg.hxx sc/source/ui/inc/pvfundlg.hxx
+index 4f219d8..9b9ef3e 100644
+--- sc/source/ui/inc/pvfundlg.hxx
++++ sc/source/ui/inc/pvfundlg.hxx
+@@ -170,6 +170,8 @@ private:
+     void                Init( const ScDPNameVec& rDataFields, bool bEnableLayout );
+     void                InitHideListBox();
+ 
++    const ::rtl::OUString& GetFieldName(const ::rtl::OUString& rLayoutName) const;
++
+     DECL_LINK( RadioClickHdl, RadioButton* );
+     DECL_LINK( CheckHdl, CheckBox* );
+     DECL_LINK( SelectHdl, ListBox* );
+@@ -205,6 +207,9 @@ private:
+ 
+     ScDPObject&         mrDPObj;            /// The DataPilot object (for member names).
+     ScDPLabelData       maLabelData;        /// Cache for members data.
++
++    typedef ::std::hash_map< ::rtl::OUString, ::rtl::OUString, ::rtl::OUStringHash > NameMapType;
++    NameMapType maDataFieldNameMap; /// Cache for displayed name to field name mapping.
+ };
+ 
+ // ============================================================================
diff --git a/patches/dev300/calc-xls-import-biff2-file-sheet-name.diff b/patches/dev300/calc-xls-import-biff2-file-sheet-name.diff
new file mode 100644
index 0000000..55b175f
--- /dev/null
+++ b/patches/dev300/calc-xls-import-biff2-file-sheet-name.diff
@@ -0,0 +1,27 @@
+diff --git sc/source/filter/excel/impop.cxx sc/source/filter/excel/impop.cxx
+index cea2a9d..16060ba 100644
+--- sc/source/filter/excel/impop.cxx
++++ sc/source/filter/excel/impop.cxx
+@@ -47,6 +47,7 @@
+ #include <svl/zforlist.hxx>
+ 
+ #include <sfx2/objsh.hxx>
++#include "tools/urlobj.hxx"
+ #include "docuno.hxx"
+ 
+ #include "cell.hxx"
+@@ -1158,6 +1159,14 @@ void ImportExcel::NeueTabelle( void )
+     if( nTab > 0 && !pD->HasTable( nTab ) )
+         pD->MakeTable( nTab );
+ 
++    if (nTab == 0 && GetBiff() == EXC_BIFF2)
++    {
++        // For Excel 2.1 Worksheet file, we need to set the file name as the 
++        // sheet name.
++        INetURLObject aURL(GetDocUrl());
++        pD->RenameTab(0, aURL.getBase(), false);
++    }
++
+     pExcRoot->pShrfmlaBuff->Clear();
+ 
+     InitializeTable( nTab );
diff --git a/patches/dev300/dde-reconnect-on-load-sc.diff b/patches/dev300/dde-reconnect-on-load-sc.diff
new file mode 100644
index 0000000..0a08974
--- /dev/null
+++ b/patches/dev300/dde-reconnect-on-load-sc.diff
@@ -0,0 +1,61 @@
+diff --git sc/source/ui/docshell/docsh6.cxx sc/source/ui/docshell/docsh6.cxx
+index bb7b82f..8d9a9f0 100644
+--- sc/source/ui/docshell/docsh6.cxx
++++ sc/source/ui/docshell/docsh6.cxx
+@@ -393,6 +393,15 @@ BOOL __EXPORT ScDocShell::Insert( SfxObjectShell &rSource,
+     return bRet;
+ }
+ 
++void ScDocShell::ReconnectDdeLink(SfxObjectShell& rServer)
++{
++    SvxLinkManager* pLinkManager = aDocument.GetLinkManager();
++    if (!pLinkManager)
++        return;
++
++    pLinkManager->ReconnectDdeLink(rServer);
++}
++
+ void ScDocShell::UpdateLinks()
+ {
+     sfx2::LinkManager* pLinkManager = aDocument.GetLinkManager();
+diff --git sc/source/ui/docshell/servobj.cxx sc/source/ui/docshell/servobj.cxx
+index 1d69e26..4790d68 100644
+--- sc/source/ui/docshell/servobj.cxx
++++ sc/source/ui/docshell/servobj.cxx
+@@ -41,6 +41,8 @@
+ #include "rangenam.hxx"
+ #include "sc.hrc"				// SC_HINT_AREAS_CHANGED
+ 
++using namespace formula;
++
+ // -----------------------------------------------------------------------
+ 
+ BOOL lcl_FillRangeFromName( ScRange& rRange, ScDocShell* pDocSh, const String& rName )
+@@ -97,11 +99,13 @@ ScServerObject::ScServerObject( ScDocShell* pShell, const String& rItem ) :
+         SCTAB nTab = pDocSh->GetCurTab();
+         aRange.aStart.SetTab( nTab );
+ 
+-        if ( aRange.Parse( rItem, pDoc ) & SCA_VALID )
++        // For DDE link, we always must parse references using OOO A1 convention.
++
++        if ( aRange.Parse( rItem, pDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
+         {
+             // area reference
+         }
+-        else if ( aRange.aStart.Parse( rItem, pDoc, pDoc->GetAddressConvention() ) & SCA_VALID )
++        else if ( aRange.aStart.Parse( rItem, pDoc, FormulaGrammar::CONV_OOO ) & SCA_VALID )
+         {
+             // cell reference
+             aRange.aEnd = aRange.aStart;
+diff --git sc/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
+index 6bfaf40..07d8c3f 100755
+--- sc/source/ui/inc/docsh.hxx
++++ sc/source/ui/inc/docsh.hxx
+@@ -319,6 +319,7 @@ public:
+     ScDBData*       GetOldAutoDBRange();    // has to be deleted by caller!
+     void            CancelAutoDBRange();    // called when dialog is cancelled
+ 
++    virtual void    ReconnectDdeLink(SfxObjectShell& rServer);
+     void			UpdateLinks();			// Link-Eintraege aktuallisieren
+     BOOL			ReloadTabLinks();		// Links ausfuehren (Inhalt aktualisieren)
+ 
diff --git a/patches/dev300/dde-reconnect-on-load-sfx2.diff b/patches/dev300/dde-reconnect-on-load-sfx2.diff
new file mode 100644
index 0000000..bdfe0d9
--- /dev/null
+++ b/patches/dev300/dde-reconnect-on-load-sfx2.diff
@@ -0,0 +1,200 @@
+diff --git sfx2/inc/sfx2/linkmgr.hxx sfx2/inc/sfx2/linkmgr.hxx
+index 6ff4e26..941321a 100644
+--- sfx2/inc/sfx2/linkmgr.hxx
++++ sfx2/inc/sfx2/linkmgr.hxx
+@@ -90,6 +90,8 @@ public:
+                 // falls am Link schon alles eingestellt ist !
+     BOOL 		InsertDDELink( SvBaseLink* );
+ 
++    void        ReconnectDdeLink(SfxObjectShell& rServer);
++
+     // den Link mit einem PseudoObject verbinden und in die Liste eintragen
+     BOOL InsertFileLink( sfx2::SvBaseLink&,
+                         USHORT nFileType,
+diff --git sfx2/inc/sfx2/objsh.hxx sfx2/inc/sfx2/objsh.hxx
+index 9c6259b..a0ad22a 100755
+--- sfx2/inc/sfx2/objsh.hxx
++++ sfx2/inc/sfx2/objsh.hxx
+@@ -520,6 +520,9 @@ public:
+                                             const String& rMimeType,
+                                 const ::com::sun::star::uno::Any & rValue );
+     virtual ::sfx2::SvLinkSource* 		DdeCreateLinkSource( const String& rItem );
++    virtual void                ReconnectDdeLink(SfxObjectShell& rServer);
++
++    static void                 ReconnectDdeLinks(SfxObjectShell& rServer);
+ 
+     // Contents
+     virtual SfxStyleSheetBasePool*	GetStyleSheetPool();
+diff --git sfx2/source/appl/appdde.cxx sfx2/source/appl/appdde.cxx
+index 789de8b..6134d9d 100644
+--- sfx2/source/appl/appdde.cxx
++++ sfx2/source/appl/appdde.cxx
+@@ -365,6 +365,23 @@ long SfxObjectShell::DdeSetData
+     return 0;
+ }
+ 
++void SfxObjectShell::ReconnectDdeLink(SfxObjectShell& /*rServer*/)
++{
++}
++
++void SfxObjectShell::ReconnectDdeLinks(SfxObjectShell& rServer)
++{
++    TypeId aType = TYPE(SfxObjectShell);
++    SfxObjectShell* p = GetFirst(&aType, false);
++    while (p)
++    {
++        if (&rServer != p)
++            p->ReconnectDdeLink(rServer);
++
++        p = GetNext(*p, &aType, false);
++    }
++}
++
+ //========================================================================
+ 
+ long SfxViewFrame::DdeExecute
+diff --git sfx2/source/appl/linkmgr2.cxx sfx2/source/appl/linkmgr2.cxx
+index 7653637..758f5e0 100644
+--- sfx2/source/appl/linkmgr2.cxx
++++ sfx2/source/appl/linkmgr2.cxx
+@@ -55,6 +55,9 @@
+ #define _SVSTDARR_STRINGSDTOR
+ #include <svl/svstdarr.hxx>
+ 
++using ::rtl::OUString;
++using ::rtl::OUStringBuffer;
++
+ namespace sfx2
+ {
+ 
+@@ -209,6 +212,50 @@ BOOL LinkManager::InsertDDELink( SvBaseLink * pLink )
+     return Insert( pLink );
+ }
+ 
++void LinkManager::ReconnectDdeLink(SfxObjectShell& rServer)
++{
++    SfxMedium* pMed = rServer.GetMedium();
++    if (!pMed)
++        return;
++
++    const ::sfx2::SvBaseLinks& rLinks = GetLinks();
++    sal_uInt16 n = rLinks.Count();
++
++    for (sal_uInt16 i = 0; i < n; ++i)
++    {
++        ::sfx2::SvBaseLink* p = *rLinks[i];
++        String aType, aFile, aLink, aFilter;
++        if (!GetDisplayNames(p, &aType, &aFile, &aLink, &aFilter))
++            continue;
++
++        if (!aType.EqualsAscii("soffice"))
++            // DDE connections between OOo apps are always named 'soffice'.
++            continue;
++
++        String aTmp;
++        utl::LocalFileHelper::ConvertPhysicalNameToURL(aFile, aTmp);
++        OUString aURL = aTmp;
++
++        if (!aURL.equalsIgnoreAsciiCase(pMed->GetName()))
++            // This DDE link is not associated with this server shell...  Skip it.
++            continue;
++
++        if (!aLink.Len())
++            continue;
++
++        // Reconnect the server document shell to this DDE link object.
++        ::sfx2::SvLinkSource* pSrvSrc = rServer.DdeCreateLinkSource(aLink);
++        if (pSrvSrc)
++        {
++            ::com::sun::star::datatransfer::DataFlavor aFl;
++            SotExchange::GetFormatDataFlavor(p->GetContentType(), aFl);
++            p->SetObj(pSrvSrc);
++            pSrvSrc->AddDataAdvise(
++                p, aFl.MimeType,
++                sfx2::LINKUPDATE_ONCALL == p->GetUpdateMode() ? ADVISEMODE_ONLYONCE : 0);
++        }
++    }
++}
+ 
+ // erfrage die Strings fuer den Dialog
+ BOOL LinkManager::GetDisplayNames( const SvBaseLink * pLink,
+@@ -578,7 +625,23 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
+     if( !sTopic.Len() )
+         return FALSE;
+ 
+-    if( !pFndShell )
++    if (pFndShell)
++    {
++        sfx2::SvLinkSource* pNewSrc = pFndShell->DdeCreateLinkSource( sItem );
++        if( pNewSrc )
++        {
++            ::com::sun::star::datatransfer::DataFlavor aFl;
++            SotExchange::GetFormatDataFlavor( pLink->GetContentType(), aFl );
++
++            pLink->SetObj( pNewSrc );
++            pNewSrc->AddDataAdvise( pLink, aFl.MimeType,
++                                sfx2::LINKUPDATE_ONCALL == pLink->GetUpdateMode()
++                                    ? ADVISEMODE_ONLYONCE
++                                    : 0 );
++            return true;
++        }
++    }
++    else
+     {
+         // dann versuche die Datei zu laden:
+         INetURLObject aURL( sTopic );
+@@ -593,7 +656,7 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
+             SfxStringItem aTarget( SID_TARGETNAME, String::CreateFromAscii("_blank") );
+             SfxStringItem aReferer( SID_REFERER, sReferer );
+             SfxUInt16Item aUpdate( SID_UPDATEDOCMODE, nUpdateMode );
+-            SfxBoolItem aReadOnly(SID_DOC_READONLY, TRUE);
++            SfxBoolItem aReadOnly(SID_DOC_READONLY, false);
+ 
+             // #i14200# (DDE-link crashes wordprocessor)
+             SfxAllItemSet aArgs( SFX_APP()->GetPool() );
+@@ -605,28 +668,13 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
+             aArgs.Put(aUpdate);
+             aArgs.Put(aReadOnly);
+             pFndShell = SfxObjectShell::CreateAndLoadObject( aArgs );
+-        }
+-    }
+ 
+-    BOOL bRet = FALSE;
+-    if( pFndShell )
+-    {
+-        sfx2::SvLinkSource* pNewSrc = pFndShell->DdeCreateLinkSource( sItem );
+-        if( pNewSrc )
+-        {
+-            bRet = TRUE;
+-
+-            ::com::sun::star::datatransfer::DataFlavor aFl;
+-            SotExchange::GetFormatDataFlavor( pLink->GetContentType(), aFl );
+-
+-            pLink->SetObj( pNewSrc );
+-            pNewSrc->AddDataAdvise( pLink, aFl.MimeType,
+-                                sfx2::LINKUPDATE_ONCALL == pLink->GetUpdateMode()
+-                                    ? ADVISEMODE_ONLYONCE
+-                                    : 0 );
++            // When loading a new document, DDE links get connected during the loading.
++            return true;
+         }
+     }
+-    return bRet;
++
++    return false;
+ }
+ 
+ 
+diff --git sfx2/source/doc/objstor.cxx sfx2/source/doc/objstor.cxx
+index 474b4a0..1053023 100644
+--- sfx2/source/doc/objstor.cxx
++++ sfx2/source/doc/objstor.cxx
+@@ -974,6 +974,8 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
+             }
+         }
+ 
++        ReconnectDdeLinks(*this);
++
+ #if 0
+         if ( pMedium->HasStorage_Impl() )
+         {
diff --git a/patches/dev300/dde-reconnect-on-load-sw.diff b/patches/dev300/dde-reconnect-on-load-sw.diff
new file mode 100644
index 0000000..d50f460
--- /dev/null
+++ b/patches/dev300/dde-reconnect-on-load-sw.diff
@@ -0,0 +1,38 @@
+diff --git sw/inc/docsh.hxx sw/inc/docsh.hxx
+index 3840d59..9abc65e 100644
+--- sw/inc/docsh.hxx
++++ sw/inc/docsh.hxx
+@@ -237,6 +237,8 @@ public:
+     virtual long DdeSetData( const String& rItem, const String& rMimeType,
+                                 const ::com::sun::star::uno::Any & rValue );
+     virtual ::sfx2::SvLinkSource* DdeCreateLinkSource( const String& rItem );
++    virtual void ReconnectDdeLink(SfxObjectShell& rServer);
++
+     virtual void FillClass( SvGlobalName * pClassName,
+                                    sal_uInt32 * pClipFormat,
+                                    String * pAppName,
+diff --git sw/source/ui/app/docsh2.cxx sw/source/ui/app/docsh2.cxx
+index cea9d74..5a4a07d 100644
+--- sw/source/ui/app/docsh2.cxx
++++ sw/source/ui/app/docsh2.cxx
+@@ -64,6 +64,7 @@
+ #include <editeng/svxacorr.hxx>
+ #include <editeng/langitem.hxx>
+ #include <svx/fmshell.hxx>
++#include <svx/linkmgr.hxx>
+ 
+ #include <svtools/htmlcfg.hxx>
+ #include <svx/ofaitem.hxx>
+@@ -1523,6 +1524,12 @@ long SwDocShell::DdeSetData( const String& rItem, const String& rMimeType,
+     return pDoc->CreateLinkSource( rItem );
+ }
+ 
++void SwDocShell::ReconnectDdeLink(SfxObjectShell& rServer)
++{
++    SvxLinkManager& rLinkManager = pDoc->GetLinkManager();
++    rLinkManager.ReconnectDdeLink(rServer);
++}
++
+ /*--------------------------------------------------------------------
+     Beschreibung:
+  --------------------------------------------------------------------*/


More information about the ooo-build-commit mailing list