Caolán McNamara píše v Pá 18. 03. 2011 v 14:26 +0000:
> There's a cluster of messy mail merge related bugs.
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=32553
> https://bugs.freedesktop.org/show_bug.cgi?id=31792
> https://bugs.freedesktop.org/show_bug.cgi?id=34187
> 
> and I'd like backport three concrete and fairly trivial fixes which
> address the reproducible parts to 3-3-2

You rock!

> Firstly, the hang.
> http://cgit.freedesktop.org/libreoffice/writer/commit/?id=7482695994c5f6bf9995748944e38d2792aaed92
> nNodeCnt is a ULONG, and is therefore unsigned, the loop counts down to
> 0, if nNodeCnt is less than the value which gets subtracted from it, it
> natually wraps around and leaps off into hyperspace, hanging or
> crashing. Safest fix IMO is to simply set it to 1 in this case so that
> at the end of the loop the -- makes it hit 0 and loop ends.

Looks fine. I have cherry-picked it for libreoffice-3-3 branch as 
http://cgit.freedesktop.org/libreoffice/writer/commit/?h=libreoffice-3-3&id=d1234b1bcd542b4ce523b6be76e7491afdce4de8

> Secondly, sending an email with an attached .odt. We're looking up the
> mimetype of the odt by finding what filter handles .odt, sadly we now
> have *two* filters that handle suffixes of .odt, i.e. the flat xml
> filter as well, and that has no mime-type set in the filter config ->
> epic fail. Simplest fix is to pull the known export filter directly
> rather than hope for the best off ".odt"
> http://cgit.freedesktop.org/libreoffice/writer/commit/?id=5c4a455137ae1fc74cdf88fe6d4d315b1948b4c0
> 
> Thirdly, send an email with an attached .pdf won't work unless mailmerge
> was used with html or txt beforehand, which is apparently a similar
> problem to two in that looking up the export filter for .pdf by what can
> export a ".pdf" isn't getting the expected filter (possibly getting a
> calc or draw .pdf exporter or something, didn't bother looking deeper)
> http://cgit.freedesktop.org/libreoffice/writer/commit/?id=97bce7aad1c3a6f3fd23a3380c79ca9c1515624c

These did not apply cleanly, so I did difference between 
sw/source/ui/dbui/mmoutputpage.cxx in master and libreoffice-3-3 branch
and selected the relevant hunks. I have combined both fixes into one
commit.

Caolan, could you please review the attached patch? You might see that
there was an attempt to solve this but it did nothing. It compiles and
works here.

We still need 2 more reviews for the libreoffice-3-3 branch.


Best Regards,
Petr
>From b59804d94e107c5227532aa3511d4fad1dd15436 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caol...@redhat.com>
Date: Fri, 18 Mar 2011 17:47:27 +0100
Subject: [PATCH] Related: fdo#32553/fdo#31792 nsure correct odt mimetype and pdf export filter

Signed-off-by: Petr Mladek <pmla...@suse.cz>
---
 sw/source/ui/dbui/mmoutputpage.cxx |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

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();
-- 
1.7.3.4

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to