[Libreoffice-commits] .: Branch 'libreoffice-3-3-2' - 2 commits - sw/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Mar 21 02:20:46 PDT 2011


 sw/source/core/docnode/nodes.cxx   |   18 +++++++++++++++---
 sw/source/ui/dbui/mmoutputpage.cxx |   27 ++++++++++++++++-----------
 2 files changed, 31 insertions(+), 14 deletions(-)

New commits:
commit 3b52a83f6598b8f0387f94ea8619acaed4ebeb11
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 18 17:47:27 2011 +0100

    Related: fdo#32553/fdo#31792 nsure correct odt mimetype and pdf export filter
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>
    (cherry picked from commit b59804d94e107c5227532aa3511d4fad1dd15436)

diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx
index f6d0409..2b6c5fe 100644
--- a/sw/source/ui/dbui/mmoutputpage.cxx
+++ b/sw/source/ui/dbui/mmoutputpage.cxx
@@ -1043,7 +1043,6 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton)
             nEnd = rConfigItem.GetMergedDocumentCount();
     }
     bool bAsBody = false;
-    bool bIsPDF = false;
     rtl_TextEncoding eEncoding = ::gsl_getSystemTextEncoding();
     SfxFilterContainer* pFilterContainer = SwDocShell::Factory().GetFilterContainer();
     const SfxFilter *pSfxFlt = 0;
@@ -1051,8 +1050,22 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton)
     String sExtension = lcl_GetExtensionForDocType(nDocType);
     switch( nDocType )
     {
-        case MM_DOCTYPE_OOO : break;
-        case MM_DOCTYPE_PDF : bIsPDF = true; break;
+        case MM_DOCTYPE_OOO:
+        {
+            //Make sure we don't pick e.g. the flat xml filter
+            //for this format
+            pSfxFlt = SwIoSystem::GetFilterOfFormat(
+                String::CreateFromAscii( FILTER_XML ),
+                SwDocShell::Factory().GetFilterContainer() );
+        }
+        break;
+        case MM_DOCTYPE_PDF:
+        {
+            pSfxFlt = pFilterContainer->GetFilter4FilterName(
+                ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("writer_pdf_Export")),
+                SFX_FILTER_EXPORT);
+        }
+        break;
         case MM_DOCTYPE_WORD:
         {
             //the method SwIOSystemGetFilterOfFormat( ) returns the template filter
@@ -1195,14 +1208,6 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton)
                     INetURLObject(), utl::TempFile::CreateTempName(0),
                     URIHelper::GetMaybeFileHdl()) );
 
-/*        if(bIsPDF)
-        {
-            SfxDispatcher* pSfxDispatcher = pTempView->GetViewFrame()->GetDispatcher();
-            pSfxDispatcher->Execute(
-                            SID_DIRECTEXPORTDOCASPDF,
-                                  SFX_CALLMODE_SYNCHRON, &aName, &aFilterName, 0L );
-        }
-        else*/
         {
             uno::Sequence< beans::PropertyValue > aFilterValues(MM_DOCTYPE_TEXT == nDocType ? 2 : 1);
             beans::PropertyValue* pFilterValues = aFilterValues.getArray();
commit dfce3b53b75c95bafb1e6f9d76a298515eb8a124
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 18 12:29:41 2011 +0000

    Resolves: fdo#32553 freeze/hang on mailmerge to attached pdf
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>
    (cherry picked from commit d1234b1bcd542b4ce523b6be76e7491afdce4de8)

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index e47a094..b44c285 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2108,9 +2108,13 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                     pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex()
                     < aInsPos.GetIndex() )
             {
-                nNodeCnt -=
+                ULONG nDistance =
                     ( pAktNode->EndOfSectionIndex() -
                         aRg.aStart.GetIndex() );
+                if (nDistance < nNodeCnt)
+                    nNodeCnt -= nDistance;
+                else
+                    nNodeCnt = 1;
 
                 // dann alle Nodes der Tabelle in die akt. Zelle kopieren
                 // fuer den TabellenNode einen DummyNode einfuegen?
@@ -2145,7 +2149,11 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                 SwNodeIndex nStt( aInsPos, -1 );
                 SwTableNode* pTblNd = ((SwTableNode*)pAktNode)->
                                         MakeCopy( pDoc, aInsPos );
-                nNodeCnt -= aInsPos.GetIndex() - nStt.GetIndex() -2;
+                ULONG nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
+                if (nDistance < nNodeCnt)
+                    nNodeCnt -= nDistance;
+                else
+                    nNodeCnt = 1;
 
                 aRg.aStart = pAktNode->EndOfSectionIndex();
 
@@ -2169,7 +2177,11 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
                 SwSectionNode* pSectNd = ((SwSectionNode*)pAktNode)->
                                     MakeCopy( pDoc, aInsPos );
 
-                nNodeCnt -= aInsPos.GetIndex() - nStt.GetIndex() -2;
+                ULONG nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
+                if (nDistance < nNodeCnt)
+                    nNodeCnt -= nDistance;
+                else
+                    nNodeCnt = 1;
                 aRg.aStart = pAktNode->EndOfSectionIndex();
 
                 if( bNewFrms && pSectNd &&


More information about the Libreoffice-commits mailing list