[ooo-build-commit] .: Branch 'ooo-build-3-2-1' - 2 commits - patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Aug 9 08:16:19 PDT 2010


 patches/dev300/apply                           |    3 
 patches/dev300/calc-dp-sort-fix.diff           |  244 +++++++++++++++++++++++
 patches/dev300/dde-reconnect-on-load-sc.diff   |   32 +++
 patches/dev300/dde-reconnect-on-load-sfx2.diff |  255 ++++++++++++++++++++++++-
 patches/dev300/dde-reconnect-on-load-svx.diff  |  141 ++++++++++---
 patches/dev300/dde-reconnect-on-load-sw.diff   |   12 +
 6 files changed, 650 insertions(+), 37 deletions(-)

New commits:
commit 7d5eb2c4908006cc24c4577b5a39b498641c8dca
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Aug 9 11:14:15 2010 -0400

    Further work on fixing DDE update issue.
    
    When opening remote documents to get up-to-date values during DDE
    update, close those documents afterwards to avoid all sorts of
    problems caused by these hidden document instances. (n#618864)
    
    * patches/dev300/dde-reconnect-on-load-sc.diff:
    * patches/dev300/dde-reconnect-on-load-sfx2.diff:
    * patches/dev300/dde-reconnect-on-load-svx.diff:
    * patches/dev300/dde-reconnect-on-load-sw.diff:

diff --git a/patches/dev300/dde-reconnect-on-load-sc.diff b/patches/dev300/dde-reconnect-on-load-sc.diff
index 5f0844f..55275dd 100644
--- a/patches/dev300/dde-reconnect-on-load-sc.diff
+++ b/patches/dev300/dde-reconnect-on-load-sc.diff
@@ -1,3 +1,35 @@
+diff --git sc/source/core/data/documen8.cxx sc/source/core/data/documen8.cxx
+index 64d1db4..8cc9d40 100644
+--- sc/source/core/data/documen8.cxx
++++ sc/source/core/data/documen8.cxx
+@@ -1103,6 +1103,7 @@ void ScDocument::UpdateDdeLinks()
+             if (pBase->ISA(ScDdeLink))
+                 ((ScDdeLink*)pBase)->TryUpdate();       // bei DDE-Links TryUpdate statt Update
+         }
++        pLinkManager->CloseCachedComps();
+     }
+ }
+ 
+@@ -1132,6 +1133,7 @@ BOOL ScDocument::UpdateDdeLink( const String& rAppl, const String& rTopic, const
+                 }
+             }
+         }
++        pLinkManager->CloseCachedComps();
+     }
+     return bFound;
+ }
+diff --git sc/source/core/tool/interpr2.cxx sc/source/core/tool/interpr2.cxx
+index a725b42..ae62908 100644
+--- sc/source/core/tool/interpr2.cxx
++++ sc/source/core/tool/interpr2.cxx
+@@ -2218,6 +2218,7 @@ void ScInterpreter::ScDde()
+             PushNA();
+ 
+         pDok->DisableIdle( bOldDis );
++        pLinkMgr->CloseCachedComps();
+     }
+ }
+ 
 diff --git sc/source/ui/docshell/docsh6.cxx sc/source/ui/docshell/docsh6.cxx
 index 84796f6..1fbb8c3 100644
 --- sc/source/ui/docshell/docsh6.cxx
diff --git a/patches/dev300/dde-reconnect-on-load-sfx2.diff b/patches/dev300/dde-reconnect-on-load-sfx2.diff
index 4a6d731..a3bf2e5 100644
--- a/patches/dev300/dde-reconnect-on-load-sfx2.diff
+++ b/patches/dev300/dde-reconnect-on-load-sfx2.diff
@@ -1,8 +1,68 @@
+diff --git sfx2/inc/sfx2/linkmgr.hxx sfx2/inc/sfx2/linkmgr.hxx
+index b2f0c98..95e2805 100644
+--- sfx2/inc/sfx2/linkmgr.hxx
++++ sfx2/inc/sfx2/linkmgr.hxx
+@@ -33,8 +33,16 @@
+ #include <tools/string.hxx>
+ #include <svtools/svarray.hxx>
+ 
++#include <vector>
++
+ class SfxObjectShell;
+ 
++namespace com { namespace sun { namespace star {
++    namespace lang {
++        class XComponent;
++    }
++}}}
++
+ namespace sfx2
+ {
+ 
+@@ -49,6 +57,10 @@ SV_DECL_PTRARR( SvLinkSources, SvLinkSourcePtr, 1, 1 )
+ 
+ class SFX2_DLLPUBLIC SvLinkManager
+ {
++    typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > >
++        CompVector;
++    CompVector maCachedComps;
++
+     SvBaseLinks		aLinkTbl;
+     SvLinkSources aServerTbl;
+ 
+@@ -59,6 +71,17 @@ protected:
+ public:
+                 SvLinkManager();
+     virtual		~SvLinkManager();
++
++    /**
++     * Insert a component loaded during link update, which needs to be closed 
++     * when the update is complete. 
++     * 
++     * @param xComp component loaded during link update.
++     */
++    void        InsertCachedComp(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp);
++
++    void        CloseCachedComps();
++
+     SfxObjectShell*    GetPersist() const              { return pPersist; }
+     void        SetPersist( SfxObjectShell * p )   { pPersist = p; }
+ 
 diff --git sfx2/inc/sfx2/objsh.hxx sfx2/inc/sfx2/objsh.hxx
-index a1396a3..4faccea 100644
+index a1396a3..d3f3649 100644
 --- sfx2/inc/sfx2/objsh.hxx
 +++ sfx2/inc/sfx2/objsh.hxx
-@@ -528,6 +528,9 @@ public:
+@@ -129,6 +129,9 @@ namespace com { namespace sun { namespace star {
+     namespace document {
+         class XDocumentProperties;
+     }
++    namespace lang {
++        class XComponent;
++    }
+ } } }
+ 
+ typedef sal_uInt32 SfxObjectShellFlags;
+@@ -528,6 +531,9 @@ public:
                                              const String& rMimeType,
                                  const ::com::sun::star::uno::Any & rValue );
      virtual ::sfx2::SvLinkSource* 		DdeCreateLinkSource( const String& rItem );
@@ -12,6 +72,28 @@ index a1396a3..4faccea 100644
  
      // Contents
      virtual SfxStyleSheetBasePool*	GetStyleSheetPool();
+@@ -639,6 +645,9 @@ public:
+     static SfxObjectShell*		CreateObject( const String& rServiceName, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD );
+     static SfxObjectShell*		CreateObjectByFactoryName( const String& rURL, SfxObjectCreateMode = SFX_CREATE_MODE_STANDARD );
+     static SfxObjectShell*      CreateAndLoadObject( const SfxItemSet& rSet, SfxFrame* pFrame=0 );
++    static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
++                                CreateAndLoadComponent( const SfxItemSet& rSet, SfxFrame* pFrame = NULL );
++    static SfxObjectShell*      GetShellFromComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp );
+     static String				GetServiceNameFromFactory( const String& rFact );
+     BOOL						IsInPlaceActive();
+     BOOL						IsUIActive();
+diff --git sfx2/inc/sfx2/sfxsids.hrc sfx2/inc/sfx2/sfxsids.hrc
+index 470e80b..99f67eb 100644
+--- sfx2/inc/sfx2/sfxsids.hrc
++++ sfx2/inc/sfx2/sfxsids.hrc
+@@ -629,6 +629,7 @@
+ #define SID_OPENCOPY                        (SID_SFX_START + 674)
+ #define SID_SOURCEVIEW                      (SID_SFX_START + 675)
+ #define SID_DOC_STARTPRESENTATION           (SID_SFX_START + 695)
++#define SID_DDE_RECONNECT_ONLOAD            (SID_SFX_START + 696)
+ 
+ #define SID_PLUGFRAMEARG                    (SID_SFX_START + 666)
+ #define SID_NEWWINDOWFOREDIT                (SID_SFX_START + 667)
 diff --git sfx2/source/appl/appdde.cxx sfx2/source/appl/appdde.cxx
 index 3cc38c9..ce4fe23 100644
 --- sfx2/source/appl/appdde.cxx
@@ -40,16 +122,179 @@ index 3cc38c9..ce4fe23 100644
  //========================================================================
  
  long SfxViewFrame::DdeExecute
+diff --git sfx2/source/appl/appuno.cxx sfx2/source/appl/appuno.cxx
+index 8f8af45..bf9b7f1 100644
+--- sfx2/source/appl/appuno.cxx
++++ sfx2/source/appl/appuno.cxx
+@@ -151,6 +151,7 @@ static const String sOpenNewView    = String::CreateFromAscii( "OpenNewView"
+ static const String sViewId         = String::CreateFromAscii( "ViewId"         );
+ static const String sPluginMode     = String::CreateFromAscii( "PluginMode"     );
+ static const String sReadOnly       = String::CreateFromAscii( "ReadOnly"       );
++static const String sDdeReconnect   = String::CreateFromAscii( "DDEReconnect"   );
+ static const String sStartPresentation = String::CreateFromAscii( "StartPresentation"       );
+ static const String sFrameName      = String::CreateFromAscii( "FrameName"      );
+ static const String sMediaType      = String::CreateFromAscii( "MediaType"    );
+@@ -606,6 +607,14 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque
+                     if (bOK)
+                         rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
+                 }
++                else if ( aName == sDdeReconnect )
++                {
++                    sal_Bool bVal = sal_True;
++                    sal_Bool bOK = (rProp.Value >>= bVal);
++                    DBG_ASSERT( bOK, "invalid type for DDEReconnect" );
++                    if (bOK)
++                        rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) );
++                }
+                 else if ( aName == sStartPresentation )
+                 {
+                     sal_Bool bVal = sal_False;
+@@ -1009,6 +1018,8 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
+                 nAdditional++;
+             if ( rSet.GetItemState( SID_DOC_READONLY ) == SFX_ITEM_SET )
+                 nAdditional++;
++            if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SFX_ITEM_SET )
++                nAdditional++;
+             if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SFX_ITEM_SET )
+                 nAdditional++;
+             if ( rSet.GetItemState( SID_SELECTION ) == SFX_ITEM_SET )
+@@ -1419,6 +1430,11 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta
+                 pValue[nActProp].Name = sReadOnly;
+                 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
+             }
++            if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD, sal_False, &pItem ) == SFX_ITEM_SET )
++            {
++                pValue[nActProp].Name = sDdeReconnect;
++                pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
++            }
+             if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET )
+             {
+                 pValue[nActProp].Name = sStartPresentation;
+diff --git sfx2/source/appl/linkmgr2.cxx sfx2/source/appl/linkmgr2.cxx
+index 81f2eed..7e11548 100644
+--- sfx2/source/appl/linkmgr2.cxx
++++ sfx2/source/appl/linkmgr2.cxx
+@@ -46,6 +46,13 @@
+ 
+ #include <svtools/svstdarr.hxx>
+ 
++#include <com/sun/star/lang/XComponent.hpp>
++#include <com/sun/star/util/XCloseable.hpp>
++
++using ::com::sun::star::uno::UNO_QUERY;
++using ::com::sun::star::uno::Reference;
++using ::com::sun::star::lang::XComponent;
++using ::com::sun::star::util::XCloseable;
+ 
+ namespace sfx2
+ {
+@@ -72,6 +79,24 @@ SvLinkManager::~SvLinkManager()
+     }
+ }
+ 
++void SvLinkManager::InsertCachedComp(const Reference<XComponent>& xComp)
++{
++    maCachedComps.push_back(xComp);
++}
++
++void SvLinkManager::CloseCachedComps()
++{
++    CompVector::iterator itr = maCachedComps.begin(), itrEnd = maCachedComps.end();
++    for (; itr != itrEnd; ++itr)
++    {
++        Reference<XCloseable> xCloseable(*itr, UNO_QUERY);
++        if (!xCloseable.is())
++            continue;
++
++        xCloseable->close(true);
++    }
++    maCachedComps.clear();
++}
+ 
+ /************************************************************************
+ |*    SvLinkManager::Remove()
+@@ -276,6 +301,7 @@ void SvLinkManager::UpdateAllLinks(
+ 
+         pLink->Update();
+     }
++    CloseCachedComps();
+ }
+ 
+ /************************************************************************
 diff --git sfx2/source/doc/objstor.cxx sfx2/source/doc/objstor.cxx
-index 89e1618..4f4c540 100644
+index 89e1618..cde0bd6 100644
 --- sfx2/source/doc/objstor.cxx
 +++ sfx2/source/doc/objstor.cxx
-@@ -1011,6 +1011,8 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
+@@ -1011,6 +1011,16 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
              }
          }
  
-+        ReconnectDdeLinks(*this);
++        const SfxBoolItem* pDdeReconnectItem = static_cast<const SfxBoolItem*>(
++            SfxRequest::GetItem(pMedium->GetItemSet(), SID_DDE_RECONNECT_ONLOAD, false, TYPE(SfxBoolItem)));
++
++        bool bReconnectDde = true; // by default, we try to auto-connect DDE connections.
++        if (pDdeReconnectItem)
++            bReconnectDde = pDdeReconnectItem->GetValue();
++
++        if (bReconnectDde)
++            ReconnectDdeLinks(*this);
 +
  #if 0
          if ( pMedium->HasStorage_Impl() )
          {
+diff --git sfx2/source/doc/objxtor.cxx sfx2/source/doc/objxtor.cxx
+index 6f3741a..2ff1513 100644
+--- sfx2/source/doc/objxtor.cxx
++++ sfx2/source/doc/objxtor.cxx
+@@ -1135,6 +1135,12 @@ SfxObjectShell* SfxObjectShell::CreateObject( const String& rServiceName, SfxObj
+ 
+ SfxObjectShell* SfxObjectShell::CreateAndLoadObject( const SfxItemSet& rSet, SfxFrame* pFrame )
+ {
++    Reference<lang::XComponent> xComp = CreateAndLoadComponent(rSet, pFrame);
++    return GetShellFromComponent(xComp);
++}
++
++Reference<lang::XComponent> SfxObjectShell::CreateAndLoadComponent( const SfxItemSet& rSet, SfxFrame* pFrame )
++{
+     uno::Sequence < beans::PropertyValue > aProps;
+     TransformItems( SID_OPENDOC, rSet, aProps );
+     SFX_ITEMSET_ARG(&rSet, pFileNameItem, SfxStringItem, SID_FILE_NAME, FALSE);
+@@ -1155,20 +1161,31 @@ SfxObjectShell* SfxObjectShell::CreateAndLoadObject( const SfxItemSet& rSet, Sfx
+         xLoader = uno::Reference < frame::XComponentLoader >( comphelper::getProcessServiceFactory()->createInstance(
+             ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") ), uno::UNO_QUERY );
+ 
+-    uno::Reference < lang::XUnoTunnel > xObj;
++    Reference <lang::XComponent> xComp;
+     try
+     {
+-        xObj = uno::Reference< lang::XUnoTunnel >( xLoader->loadComponentFromURL( aURL, aTarget, 0, aProps ), uno::UNO_QUERY );
++        xComp = xLoader->loadComponentFromURL(aURL, aTarget, 0, aProps);
+     }
+     catch( uno::Exception& )
+     {}
+ 
+-    if ( xObj.is() )
++    return xComp;
++}
++
++SfxObjectShell* SfxObjectShell::GetShellFromComponent( const Reference<lang::XComponent>& xComp )
++{
++    try
++    {
++        Reference<lang::XUnoTunnel> xTunnel(xComp, UNO_QUERY_THROW);
++        Sequence <sal_Int8> aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() );
++        sal_Int64 nHandle = xTunnel->getSomething( aSeq );
++        if (!nHandle)
++            return NULL;
++
++        return reinterpret_cast< SfxObjectShell* >(sal::static_int_cast< sal_IntPtr >(  nHandle ));
++    }
++    catch (const Exception&)
+     {
+-        ::com::sun::star::uno::Sequence < sal_Int8 > aSeq( SvGlobalName( SFX_GLOBAL_CLASSID ).GetByteSequence() );
+-        sal_Int64 nHandle = xObj->getSomething( aSeq );
+-        if ( nHandle )
+-            return reinterpret_cast< SfxObjectShell* >(sal::static_int_cast< sal_IntPtr >(  nHandle ));
+     }
+ 
+     return NULL;
diff --git a/patches/dev300/dde-reconnect-on-load-svx.diff b/patches/dev300/dde-reconnect-on-load-svx.diff
index 5f7e618..6e1c42d 100644
--- a/patches/dev300/dde-reconnect-on-load-svx.diff
+++ b/patches/dev300/dde-reconnect-on-load-svx.diff
@@ -1,5 +1,5 @@
 diff --git svx/inc/linkmgr.hxx svx/inc/linkmgr.hxx
-index b614aba..1b3142a 100644
+index b614aba..e3056ca 100644
 --- svx/inc/linkmgr.hxx
 +++ svx/inc/linkmgr.hxx
 @@ -33,6 +33,7 @@
@@ -10,30 +10,70 @@ index b614aba..1b3142a 100644
  
  // Damit der Link ueber den Status der zu ladenen Grafik informierten werden
  // verschickt das FileObject ein SvData, mit der FormatId
-@@ -63,6 +64,8 @@ public:
+@@ -63,6 +64,17 @@ public:
              // falls am Link schon alles eingestellt ist !
      BOOL InsertFileLink( sfx2::SvBaseLink& );
  
 +    void ReconnectDdeLink(SfxObjectShell& rServer);
 +
++    /**
++     * Reconnect the server document shell to a DDE link object.
++     * 
++     * @param rPath path to the server document
++     * @param rServer server document shell instance
++     * @param rLink link object of the client document
++     */
++    void LinkServerShell(const ::rtl::OUString& rPath, SfxObjectShell& rServer, ::sfx2::SvBaseLink& rLink) const;
++
          // erfrage die Strings fuer den Dialog
      virtual BOOL GetDisplayNames( const sfx2::SvBaseLink*,
                                      String* pType,
+@@ -90,7 +102,6 @@ public:
+     static BOOL GetGraphicFromAny( const String& rMimeType,
+                                 const ::com::sun::star::uno::Any & rValue,
+                                 Graphic& rGrf );
+-
+ };
+ 
+ 
+diff --git svx/source/cui/linkdlg.cxx svx/source/cui/linkdlg.cxx
+index d8df934..620b340 100644
+--- svx/source/cui/linkdlg.cxx
++++ svx/source/cui/linkdlg.cxx
+@@ -336,6 +336,8 @@ IMPL_LINK( SvBaseLinksDlg, UpdateNowClickHdl, PushButton *, EMPTYARG )
+             rListBox.Select( pE );
+             rListBox.MakeVisible( pE );
+         }
++
++        pNewMgr->CloseCachedComps();
+     }
+     return 0;
+ }
 diff --git svx/source/svxlink/linkmgr.cxx svx/source/svxlink/linkmgr.cxx
-index 0e2415f..86d9e97 100644
+index 0e2415f..6727f4c 100644
 --- svx/source/svxlink/linkmgr.cxx
 +++ svx/source/svxlink/linkmgr.cxx
-@@ -57,6 +57,9 @@
+@@ -50,6 +50,7 @@
+ #include <svtools/itemset.hxx>
+ #include <svtools/urihelper.hxx>
+ #include <com/sun/star/datatransfer/DataFlavor.hpp>
++#include <com/sun/star/lang/XComponent.hpp>
+ 
+ #include "linkmgr.hxx"
+ #include "fileobj.hxx"
+@@ -57,6 +58,11 @@
  #include <svx/dialogs.hrc>
  #include "unolingu.hxx"
  
 +using ::rtl::OUString;
 +using ::rtl::OUStringBuffer;
++using ::com::sun::star::uno::Reference;
++using ::com::sun::star::lang::XComponent;
 +
  class SvxInternalLink : public sfx2::SvLinkSource
  {
  public:
-@@ -107,6 +110,51 @@ BOOL SvxLinkManager::InsertFileLink( sfx2::SvBaseLink& rLink,
+@@ -107,6 +113,56 @@ BOOL SvxLinkManager::InsertFileLink( sfx2::SvBaseLink& rLink,
                                      sfx2::LINKUPDATE_ONCALL, &sCmd );
  }
  
@@ -58,8 +98,9 @@ index 0e2415f..86d9e97 100644
 +            continue;
 +
 +        String aTmp;
-+        utl::LocalFileHelper::ConvertPhysicalNameToURL(aFile, aTmp);
-+        OUString aURL = aTmp;
++        OUString aURL = aFile;
++        if (utl::LocalFileHelper::ConvertPhysicalNameToURL(aFile, aTmp))
++            aURL = aTmp;
 +
 +        if (!aURL.equalsIgnoreAsciiCase(pMed->GetName()))
 +            // This DDE link is not associated with this server shell...  Skip it.
@@ -68,24 +109,49 @@ index 0e2415f..86d9e97 100644
 +        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);
-+        }
++        LinkServerShell(aLink, rServer, *p);
++    }
++}
++
++void SvxLinkManager::LinkServerShell(const OUString& rPath, SfxObjectShell& rServer, ::sfx2::SvBaseLink& rLink) const
++{
++    ::sfx2::SvLinkSource* pSrvSrc = rServer.DdeCreateLinkSource(rPath);
++    if (pSrvSrc)
++    {
++        ::com::sun::star::datatransfer::DataFlavor aFl;
++        SotExchange::GetFormatDataFlavor(rLink.GetContentType(), aFl);
++        rLink.SetObj(pSrvSrc);
++        pSrvSrc->AddDataAdvise(
++            &rLink, aFl.MimeType,
++            sfx2::LINKUPDATE_ONCALL == rLink.GetUpdateMode() ? ADVISEMODE_ONLYONCE : 0);
 +    }
 +}
 +
  BOOL SvxLinkManager::InsertFileLink( sfx2::SvBaseLink& rLink )
  {
      if( OBJECT_CLIENT_FILE == ( OBJECT_CLIENT_FILE & rLink.GetObjType() ))
-@@ -338,7 +386,23 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
+@@ -274,9 +330,8 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
+     SfxObjectShell* pFndShell = 0;
+     USHORT nUpdateMode = com::sun::star::document::UpdateDocMode::NO_UPDATE;
+     String sTopic, sItem, sReferer;
+-    if( pLink->GetLinkManager() &&
+-        pLink->GetLinkManager()->GetDisplayNames( pLink, 0, &sTopic, &sItem )
+-        && sTopic.Len() )
++    SvxLinkManager* pLinkMgr = dynamic_cast<SvxLinkManager*>(pLink->GetLinkManager());
++    if (pLinkMgr && pLinkMgr->GetDisplayNames(pLink, 0, &sTopic, &sItem) && sTopic.Len())
+     {
+         // erstmal nur ueber die DocumentShells laufen und die mit dem
+         // Namen heraussuchen:
+@@ -288,7 +343,7 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
+         TypeId aType( TYPE(SfxObjectShell) );
+ 
+         BOOL bFirst = TRUE;
+-        SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist();
++        SfxObjectShell* pShell = pLinkMgr->GetPersist();
+         if( pShell && pShell->GetMedium() )
+         {
+             sReferer = pShell->GetMedium()->GetBaseURL();
+@@ -338,7 +393,23 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
      if( !sTopic.Len() )
          return FALSE;
  
@@ -110,22 +176,36 @@ index 0e2415f..86d9e97 100644
      {
          // dann versuche die Datei zu laden:
          INetURLObject aURL( sTopic );
-@@ -353,7 +417,7 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
+@@ -353,7 +424,11 @@ 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);
++
++            // Disable automatic re-connection to avoid this link instance 
++            // being destroyed at re-connection.
++            SfxBoolItem aDdeConnect(SID_DDE_RECONNECT_ONLOAD, false);
  
              // #i14200# (DDE-link crashes wordprocessor)
              SfxAllItemSet aArgs( SFX_APP()->GetPool() );
-@@ -365,28 +429,13 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
+@@ -364,29 +439,18 @@ BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink )
+             aArgs.Put(aName);
              aArgs.Put(aUpdate);
              aArgs.Put(aReadOnly);
-             pFndShell = SfxObjectShell::CreateAndLoadObject( aArgs );
--        }
--    }
--
+-            pFndShell = SfxObjectShell::CreateAndLoadObject( aArgs );
++            aArgs.Put(aDdeConnect);
++            Reference<XComponent> xComp = SfxObjectShell::CreateAndLoadComponent(aArgs);
++            pFndShell = SfxObjectShell::GetShellFromComponent(xComp);
++            if (xComp.is() && pFndShell)
++            {
++                pLinkMgr->InsertCachedComp(xComp);
++                pLinkMgr->LinkServerShell(sItem, *pFndShell, *pLink);
++                return true;
++            }
+         }
+     }
+ 
 -    BOOL bRet = FALSE;
 -    if( pFndShell )
 -    {
@@ -136,19 +216,16 @@ index 0e2415f..86d9e97 100644
 -
 -            ::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 a/patches/dev300/dde-reconnect-on-load-sw.diff b/patches/dev300/dde-reconnect-on-load-sw.diff
index a053d8b..fb436c2 100644
--- a/patches/dev300/dde-reconnect-on-load-sw.diff
+++ b/patches/dev300/dde-reconnect-on-load-sw.diff
@@ -36,3 +36,15 @@ index 8ff7f79..7fd0d25 100644
  /*--------------------------------------------------------------------
      Beschreibung:
   --------------------------------------------------------------------*/
+diff --git sw/source/ui/uno/unotxdoc.cxx sw/source/ui/uno/unotxdoc.cxx
+index 61c78bf..e4b71bf 100644
+--- sw/source/ui/uno/unotxdoc.cxx
++++ sw/source/ui/uno/unotxdoc.cxx
+@@ -2407,6 +2407,7 @@ void SwXTextDocument::updateLinks(  ) throw(RuntimeException)
+     {
+         UnoActionContext aAction(pDoc);
+         rLnkMan.UpdateAllLinks( FALSE, FALSE, TRUE );
++        rLnkMan.CloseCachedComps();
+     }
+ }
+ //XPropertyState
commit 222319491c3689c634bcbc930884bf387036119e
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Jul 16 23:02:24 2010 -0400

    Properly display data field names in the data field options dialog.
    
    In the data field options dialog, the data field names are supposed
    to be '<subtotal func> - <field name>' (e.g. 'Sum - Score'), but the
    dialog only displayed <field name> (e.g. 'Score').  This patch fixes
    it.
    
    Note that this patch is disabled in the default build.
    
    * patches/dev300/apply:
    * patches/dev300/calc-dp-sort-fix.diff: fixes n#629920.

diff --git a/patches/dev300/apply b/patches/dev300/apply
index e41f2a6..826a3fc 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -4091,3 +4091,6 @@ 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-svx.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
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.
+ };
+ 
+ // ============================================================================


More information about the ooo-build-commit mailing list