[Libreoffice-commits] core.git: 5 commits - sw/inc sw/qa sw/source sw/UIConfig_swriter.mk

Luboš Luňák l.lunak at collabora.com
Fri Oct 3 09:28:36 PDT 2014


 sw/UIConfig_swriter.mk                                     |    1 
 sw/inc/hintids.hxx                                         |    2 
 sw/qa/extras/mailmerge/data/missing-default-line-color.ott |binary
 sw/qa/extras/mailmerge/data/one-empty-address.ods          |binary
 sw/qa/extras/mailmerge/mailmerge.cxx                       |   23 ++++++
 sw/source/core/doc/docnew.cxx                              |    3 
 sw/source/uibase/dbui/dbmgr.cxx                            |   49 -------------
 7 files changed, 29 insertions(+), 49 deletions(-)

New commits:
commit f4825097a98c681cc187d88cfc1f8fd82362e1e0
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Fri Oct 3 18:21:08 2014 +0200

    copy default drawinglayer attributes when doing mailmerge
    
    Change-Id: I4c6fc31ae72d179975c65aec0b560741474d433e

diff --git a/sw/qa/extras/mailmerge/data/missing-default-line-color.ott b/sw/qa/extras/mailmerge/data/missing-default-line-color.ott
new file mode 100644
index 0000000..dad5a7b
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/missing-default-line-color.ott differ
diff --git a/sw/qa/extras/mailmerge/data/one-empty-address.ods b/sw/qa/extras/mailmerge/data/one-empty-address.ods
new file mode 100644
index 0000000..abffed9
Binary files /dev/null and b/sw/qa/extras/mailmerge/data/one-empty-address.ods differ
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx
index 1b8dc2e..33f8f43 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -71,6 +71,29 @@ DECLARE_DFLT_MAILMERGE_TEST(testMultiPageAnchoredDraws, "multiple-page-anchored-
     }
 }
 
+DECLARE_DFLT_MAILMERGE_TEST(testMissingDefaultLineColor, "missing-default-line-color.ott", "one-empty-address.ods", "one-empty-address")
+{
+    executeMailMerge();
+    // The document was created by LO version which didn't write out the default value for line color
+    // (see XMLGraphicsDefaultStyle::SetDefaults()).
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxMMComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
+    // Lines do not have a line color.
+    CPPUNIT_ASSERT( !xPropertySet->getPropertySetInfo()->hasPropertyByName( "LineColor" ));
+    SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument *>(mxMMComponent.get());
+    CPPUNIT_ASSERT(pTxtDoc);
+    uno::Reference< lang::XMultiServiceFactory > xFact( mxMMComponent, uno::UNO_QUERY );
+    uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance( "com.sun.star.drawing.Defaults" ), uno::UNO_QUERY );
+    CPPUNIT_ASSERT( xDefaults.is());
+    uno::Reference< beans::XPropertySetInfo > xInfo( xDefaults->getPropertySetInfo());
+    CPPUNIT_ASSERT( xInfo->hasPropertyByName( "LineColor" ));
+    sal_uInt32 lineColor;
+    xDefaults->getPropertyValue( "LineColor" ) >>= lineColor;
+    // And the default value is black (wasn't copied properly by mailmerge).
+    CPPUNIT_ASSERT_EQUAL( COL_BLACK, lineColor );
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 7701873..710db73 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -853,6 +853,7 @@ void SwDoc::ReplaceDefaults(const SwDoc& rSource)
         RES_PARATR_BEGIN, RES_PARATR_END-1,
         RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
         RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+        XATTR_START, XATTR_END-1,
         0
     };
 
commit 47db7c5d61f96ce90aebf560c29fcb999567e75f
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Fri Oct 3 18:22:53 2014 +0200

    list mmcreatingdialog.ui in makefile
    
    Change-Id: I05c5030530591f440323f72088bc7b456b774b7d

diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk
index e2d35c2..dbfb7d4 100644
--- a/sw/UIConfig_swriter.mk
+++ b/sw/UIConfig_swriter.mk
@@ -171,6 +171,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\
 	sw/uiconfig/swriter/ui/queryshowchangesdialog \
 	sw/uiconfig/swriter/ui/mailmerge \
 	sw/uiconfig/swriter/ui/mmaddressblockpage \
+	sw/uiconfig/swriter/ui/mmcreatingdialog \
 	sw/uiconfig/swriter/ui/mmlayoutpage \
 	sw/uiconfig/swriter/ui/mmmailbody \
 	sw/uiconfig/swriter/ui/mmmergepage \
commit 72da443f876a59a8107e26a277a8992838ea9231
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Fri Oct 3 16:54:35 2014 +0200

    isDrawingLayerAttribute() maybe could return true for all drawinglayer attrs
    
    Change-Id: I83013ecd45b32100bf14e004899561a57a087aef

diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index 6877276..76d5202 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -403,7 +403,7 @@ inline bool isFRMATR(const sal_uInt16 nWhich)
 }
 inline bool isDrawingLayerAttribute(const sal_uInt16 nWhich) //UUUU
 {
-    return (XATTR_FILL_FIRST <= nWhich) && (XATTR_FILL_LAST >= nWhich);
+    return (XATTR_START <= nWhich) && (XATTR_END > nWhich);
 }
 inline bool isGRFATR(const sal_uInt16 nWhich)
 {
commit 105ddd124ad4cff3109d2e25c8035402446ac0db
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Fri Oct 3 16:40:18 2014 +0200

    long live code duplication
    
    Change-Id: I7386c26e5ff05cec23a6cccb86ed3aa6ab715096

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 623b933..28a5d9d 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -193,22 +193,6 @@ bool lcl_getCountFromResultSet( sal_Int32& rCount, const uno::Reference<XResultS
     }
     return false;
 }
-// copy compatibility options
-void lcl_CopyCompatibilityOptions( SwWrtShell& rSourceShell, SwWrtShell& rTargetShell)
-{
-    IDocumentSettingAccess* pIDsa = rSourceShell.getIDocumentSettingAccess();
-
-    rTargetShell.SetParaSpaceMax( pIDsa->get(IDocumentSettingAccess::PARA_SPACE_MAX));
-    rTargetShell.SetParaSpaceMaxAtPages(pIDsa->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES));
-    rTargetShell.SetTabCompat( pIDsa->get(IDocumentSettingAccess::TAB_COMPAT));
-    rTargetShell.SetAddExtLeading( pIDsa->get(IDocumentSettingAccess::ADD_EXT_LEADING));
-    rTargetShell.SetUseVirDev( pIDsa->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE));
-    rTargetShell.SetAddParaSpacingToTableCells( pIDsa->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS));
-    rTargetShell.SetUseFormerLineSpacing( pIDsa->get(IDocumentSettingAccess::OLD_LINE_SPACING));
-    rTargetShell.SetUseFormerObjectPositioning( pIDsa->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS));
-    rTargetShell.SetConsiderWrapOnObjPos( pIDsa->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION));
-    rTargetShell.SetUseFormerTextWrapping( pIDsa->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING));
-}
 }
 
 class SwConnectionDisposedListener_Impl : public cppu::WeakImplHelper1
@@ -753,35 +737,6 @@ static OUString lcl_FindUniqueName(SwWrtShell* pTargetShell, const OUString& rSt
     }while(true);
 }
 
-static void lcl_CopyDynamicDefaults( const SwDoc& rSource, SwDoc& rTarget )
-{
-    sal_uInt16 aRangeOfDefaults[] = {
-        RES_FRMATR_BEGIN, RES_FRMATR_END-1,
-        RES_CHRATR_BEGIN, RES_CHRATR_END-1,
-        RES_PARATR_BEGIN, RES_PARATR_END-1,
-        RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
-        RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
-        0
-    };
-
-    SfxItemSet aNewDefaults( rTarget.GetAttrPool(), aRangeOfDefaults );
-
-    sal_uInt16 nWhich;
-    sal_uInt16 nRange = 0;
-    while( aRangeOfDefaults[nRange] != 0)
-    {
-        for( nWhich = aRangeOfDefaults[nRange]; nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich )
-        {
-            const SfxPoolItem& rSourceAttr = rSource.GetDefault( nWhich );
-            if( rSourceAttr != rTarget.GetDefault( nWhich ) )
-                aNewDefaults.Put( rSourceAttr );
-        }
-        nRange += 2;
-    }
-    if( aNewDefaults.Count() )
-        rTarget.SetDefault( aNewDefaults );
-}
-
 static void lcl_CopyFollowPageDesc(
                             SwWrtShell& rTargetShell,
                             const SwPageDesc& rSourcePageDesc,
@@ -1030,9 +985,9 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell,
                                                 rMaster.GetFooter().IsActive();
 
                 // copy compatibility options
-                lcl_CopyCompatibilityOptions( *pSourceShell, *pTargetShell);
+                pTargetShell->GetDoc()->ReplaceCompatabilityOptions( *pTargetShell->GetDoc());
                 // #72821# copy dynamic defaults
-                lcl_CopyDynamicDefaults( *pSourceShell->GetDoc(), *pTargetShell->GetDoc() );
+                pTargetShell->GetDoc()->ReplaceDefaults( *pSourceShell->GetDoc());
 
                 lcl_CopyDocumentPorperties( xSourceDocProps, xTargetDocShell, pTargetDoc );
             }
commit 540243834390256f0a1dd968ff02860fda07edcf
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Tue Sep 30 12:49:00 2014 +0200

    SfxItemSet ranges are inclusive
    
    This used to skip the last item in the range.
    
    Change-Id: Icf27a041f1388c8bd01568356d1009a08e5b7a7a

diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 2521962..7701873 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -862,7 +862,7 @@ void SwDoc::ReplaceDefaults(const SwDoc& rSource)
     while (aRangeOfDefaults[nRange] != 0)
     {
         for (sal_uInt16 nWhich = aRangeOfDefaults[nRange];
-             nWhich < aRangeOfDefaults[nRange + 1]; ++nWhich)
+             nWhich <= aRangeOfDefaults[nRange + 1]; ++nWhich)
         {
             const SfxPoolItem& rSourceAttr =
                 rSource.mpAttrPool->GetDefaultItem(nWhich);


More information about the Libreoffice-commits mailing list