[ooo-build-commit] patches/dev300

Thorsten Behrens thorsten at kemper.freedesktop.org
Fri Jun 19 16:14:08 PDT 2009


 patches/dev300/apply                         |    2 
 patches/dev300/sd-odf-relaxed-listlevel.diff |  249 +++++++++++++++++++++++++++
 2 files changed, 251 insertions(+)

New commits:
commit 5c9ec47ae647dd87a5a85ccffb105bcfd723b6f8
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Sat Jun 20 01:08:46 2009 +0200

    Related to the ruler fix, aligns odf list writing with ui & ppt
    
    Previously, Impress generated an entirely new odf list hierarchy, as
    soon as *any* aspect of the NumBullet changed; sd-ruler-fix.diff
    changed that for the ui, as it e.g. does not make sense at all to
    have coloring one numbering prefix red, and having that paragraph
    restart numbering. This patch aligns odf writing with the ui
    behaviour; i.e. new lists are only opened for stuff that really
    breaks numbering (e.g. bulleted, or normal paragraphs)
    
    * patches/dev300/apply: added the patch
    * patches/dev300/sd-odf-relaxed-listlevel.diff: made xmloff
      conditionally relax when writing odf lists (the condition
      when new list hierarchies are created is relaxed to 'when
      numbering is switched on or off')

diff --git a/patches/dev300/apply b/patches/dev300/apply
index f51ed17..8756ccc 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2945,6 +2945,8 @@ vcl-permit-global-shortcuts.diff, thorsten
 sd-customanimation-defbutton.diff, thorsten
 # make Impress ruler behave as before 3.0
 sd-ruler-fix.diff, i#101269, thorsten
+# related to the ruler fix, aligns odf list writing with ui & ppt
+sd-odf-relaxed-listlevel.diff, i#101269, thorsten
 # another extract from CWS slideshow1 - crash & mouse lock in
 # Impress animation UI
 sd-animation-ui-fix.diff, thorsten
diff --git a/patches/dev300/sd-odf-relaxed-listlevel.diff b/patches/dev300/sd-odf-relaxed-listlevel.diff
new file mode 100644
index 0000000..5064162
--- /dev/null
+++ b/patches/dev300/sd-odf-relaxed-listlevel.diff
@@ -0,0 +1,249 @@
+Changes the way Impress docs write lists to odf
+
+From: Thorsten Behrens <thb at openoffice.org>
+
+
+---
+
+ sd/source/filter/xml/sdxmlwrp.cxx         |    4 ++++
+ xmloff/inc/xmloff/xmlexp.hxx              |    1 +
+ xmloff/source/core/xmlexp.cxx             |   12 ++++++++++++
+ xmloff/source/text/XMLTextNumRuleInfo.cxx |   28 +++++++++++++++++++---------
+ xmloff/source/text/XMLTextNumRuleInfo.hxx |   12 +++++++++++-
+ xmloff/source/text/txtparae.cxx           |   12 +++++++++---
+ 6 files changed, 56 insertions(+), 13 deletions(-)
+
+
+diff --git sd/source/filter/xml/sdxmlwrp.cxx sd/source/filter/xml/sdxmlwrp.cxx
+index d9e5e0b..f5519f3 100644
+--- sd/source/filter/xml/sdxmlwrp.cxx
++++ sd/source/filter/xml/sdxmlwrp.cxx
+@@ -869,6 +869,7 @@ sal_Bool SdXMLFilter::Export()
+ 			{ MAP_LEN( "ProgressMax" ),		0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ 			{ MAP_LEN( "ProgressCurrent" ),	0, &::getCppuType((const sal_Int32*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ 			{ MAP_LEN( "UsePrettyPrinting"),0, &::getBooleanCppuType(),				::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
++			{ MAP_LEN( "GenerousListLevels"),0, &::getBooleanCppuType(),			::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0},
+ 
+ 			{ MAP_LEN( "PageLayoutNames" ), 0, SEQTYPE(::getCppuType((const OUString*)0)), 	::com::sun::star::beans::PropertyAttribute::MAYBEVOID,     0},
+ 			{ MAP_LEN( "BaseURI" ), 0,
+@@ -900,6 +901,9 @@ sal_Bool SdXMLFilter::Export()
+ 		sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
+ 		xInfoSet->setPropertyValue( sUsePrettyPrinting, makeAny( bUsePrettyPrinting ) );
+ 
++		OUString sGenerousListLevels(RTL_CONSTASCII_USTRINGPARAM("GenerousListLevels"));
++		xInfoSet->setPropertyValue( sGenerousListLevels, makeAny( true ) );
++
+         const uno::Reference < embed::XStorage >& xStorage = mrMedium.GetOutputStorage();
+ 
+ 		// Set base URI
+diff --git xmloff/inc/xmloff/xmlexp.hxx xmloff/inc/xmloff/xmlexp.hxx
+index a5cd93b..5363551 100644
+--- xmloff/inc/xmloff/xmlexp.hxx
++++ xmloff/inc/xmloff/xmlexp.hxx
+@@ -109,6 +109,7 @@ namespace comphelper { class UnoInterfaceToUniqueIdentifierMapper; }
+ #define EXPORT_NODOCTYPE                0x0200
+ #define EXPORT_PRETTY                   0x0400
+ #define EXPORT_SAVEBACKWARDCOMPATIBLE   0x0800
++#define EXPORT_GENEROUS_LIST_LEVELS     0x4000
+ #define EXPORT_OASIS                    0x8000
+ #define EXPORT_ALL                      0x7fff
+ 
+diff --git xmloff/source/core/xmlexp.cxx xmloff/source/core/xmlexp.cxx
+index 1dc010d..78487f1 100644
+--- xmloff/source/core/xmlexp.cxx
++++ xmloff/source/core/xmlexp.cxx
+@@ -136,6 +136,7 @@ const sal_Char *sOpenOfficeOrgProject ="OpenOffice.org_project";
+ #define XML_MODEL_SERVICE_CHART		"com.sun.star.chart.ChartDocument"
+ 
+ #define XML_USEPRETTYPRINTING       "UsePrettyPrinting"
++#define XML_GENEROUSLISTLEVELS      "GenerousListLevels"
+ 
+ #define C2U(cChar) OUString( RTL_CONSTASCII_USTRINGPARAM(cChar) )
+ 
+@@ -605,6 +606,17 @@ void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XCompo
+ 					mnExportFlags &= ~EXPORT_PRETTY;
+ 			}
+ 
++			OUString sGenerousListLevels(RTL_CONSTASCII_USTRINGPARAM(XML_GENEROUSLISTLEVELS));
++			if (!xPropertySetInfo->hasPropertyByName(sGenerousListLevels)
++                || !mxExportInfo->getPropertyValue(sGenerousListLevels).get<bool>())
++			{
++                mnExportFlags &= ~EXPORT_GENEROUS_LIST_LEVELS;
++			}
++            else
++            {
++                mnExportFlags |= EXPORT_GENEROUS_LIST_LEVELS;
++			}
++
+             if (mpNumExport && (mnExportFlags & (EXPORT_AUTOSTYLES | EXPORT_STYLES)))
+ 			{
+ 				OUString sWrittenNumberFormats(RTL_CONSTASCII_USTRINGPARAM(XML_WRITTENNUMBERSTYLES));
+diff --git xmloff/source/text/XMLTextNumRuleInfo.cxx xmloff/source/text/XMLTextNumRuleInfo.cxx
+index 8ee79a9..88e493e 100644
+--- xmloff/source/text/XMLTextNumRuleInfo.cxx
++++ xmloff/source/text/XMLTextNumRuleInfo.cxx
+@@ -55,6 +55,7 @@ XMLTextNumRuleInfo::XMLTextNumRuleInfo()
+     : msNumberingRules(RTL_CONSTASCII_USTRINGPARAM("NumberingRules"))
+     , msNumberingLevel(RTL_CONSTASCII_USTRINGPARAM("NumberingLevel"))
+     , msNumberingStartValue(RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue"))
++    , msNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType"))
+     , msParaIsNumberingRestart(RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart"))
+     , msNumberingIsNumber(RTL_CONSTASCII_USTRINGPARAM("NumberingIsNumber"))
+     , msNumberingIsOutline(RTL_CONSTASCII_USTRINGPARAM("NumberingIsOutline"))
+@@ -68,6 +69,7 @@ XMLTextNumRuleInfo::XMLTextNumRuleInfo()
+     , msNumRulesName()
+     , msListId()
+     , mnListStartValue( -1 )
++    , mnNumberingType( NumberingType::CHAR_SPECIAL )
+     , mnListLevel( 0 )
+     , mbIsNumbered( sal_False )
+     , mbIsRestart( sal_False )
+@@ -212,10 +214,9 @@ void XMLTextNumRuleInfo::Set(
+           const PropertyValue& rProp = pPropArray[i];
+ 
+             if ( rProp.Name == msPropNameStartWith )
+-            {
+                 rProp.Value >>= mnListLevelStartValue;
+-                break;
+-            }
++            else if ( rProp.Name == msNumberingType )
++                rProp.Value >>= mnNumberingType;
+         }
+ 
+         // --> OD 2008-11-26 #158694#
+@@ -236,20 +237,29 @@ void XMLTextNumRuleInfo::Set(
+     }
+ }
+ 
+-sal_Bool XMLTextNumRuleInfo::BelongsToSameList( const XMLTextNumRuleInfo& rCmp ) const
++static inline bool IsNumbering(sal_Int16 nType)
++{
++    return nType != NumberingType::CHAR_SPECIAL && nType != NumberingType::BITMAP;
++}
++
++sal_Bool XMLTextNumRuleInfo::BelongsToSameList( const XMLTextNumRuleInfo& rCmp, bool bIgnoreFormatting ) const
+ {
+-    sal_Bool bRet( sal_True );
+     // Currently only the text documents support <ListId>.
+     if ( rCmp.msListId.getLength() > 0 ||
+          msListId.getLength() > 0 )
+     {
+-        bRet = rCmp.msListId == msListId;
++        return rCmp.msListId == msListId;
+     }
+     else
+     {
+-        bRet = HasSameNumRules( rCmp );
++        if ( !bIgnoreFormatting )
++        {
++            return HasSameNumRules( rCmp );
++        }
++        else
++        {
++            return IsNumbering(mnNumberingType) == IsNumbering(rCmp.mnNumberingType);
++        }
+     }
+-
+-    return bRet;
+ }
+ // <--
+diff --git xmloff/source/text/XMLTextNumRuleInfo.hxx xmloff/source/text/XMLTextNumRuleInfo.hxx
+index d3066a0..b012cbe 100644
+--- xmloff/source/text/XMLTextNumRuleInfo.hxx
++++ xmloff/source/text/XMLTextNumRuleInfo.hxx
+@@ -33,6 +33,7 @@
+ 
+ #include <com/sun/star/uno/Reference.hxx>
+ #include <com/sun/star/container/XIndexReplace.hpp>
++#include <com/sun/star/style/NumberingType.hpp>
+ 
+ namespace com { namespace sun { namespace star {
+ 	namespace text { class XTextContent; }
+@@ -52,6 +53,7 @@ class XMLTextNumRuleInfo
+     const ::rtl::OUString msNumberingRules;
+     const ::rtl::OUString msNumberingLevel;
+     const ::rtl::OUString msNumberingStartValue;
++    const ::rtl::OUString msNumberingType;
+     const ::rtl::OUString msParaIsNumberingRestart;
+     const ::rtl::OUString msNumberingIsNumber;
+     const ::rtl::OUString msNumberingIsOutline;
+@@ -70,6 +72,7 @@ class XMLTextNumRuleInfo
+     // paragraph's list attributes
+     ::rtl::OUString     msListId;
+     sal_Int16           mnListStartValue;
++    sal_Int16           mnNumberingType;
+     sal_Int16           mnListLevel;
+     sal_Bool            mbIsNumbered;
+     sal_Bool            mbIsRestart;
+@@ -144,7 +147,12 @@ public:
+         return mbIsRestart;
+     }
+ 
+-    sal_Bool BelongsToSameList( const XMLTextNumRuleInfo& rCmp ) const;
++    /** Compare num rules
++
++        @param rCmp other numrule to compare with
++        @param bIgnoreFormatting when true, different list styles still compare equal
++     */
++    sal_Bool BelongsToSameList( const XMLTextNumRuleInfo& rCmp, bool bIgnoreFormatting ) const;
+ 
+     inline sal_Bool HasSameNumRules( const XMLTextNumRuleInfo& rCmp ) const
+     {
+@@ -170,6 +178,7 @@ inline XMLTextNumRuleInfo& XMLTextNumRuleInfo::operator=(
+     mxNumRules = rInfo.mxNumRules;
+     msListId = rInfo.msListId;
+     mnListStartValue = rInfo.mnListStartValue;
++    mnNumberingType = rInfo.mnNumberingType;
+     mnListLevel = rInfo.mnListLevel;
+     mbIsNumbered = rInfo.mbIsNumbered;
+     mbIsRestart = rInfo.mbIsRestart;
+@@ -190,6 +199,7 @@ inline void XMLTextNumRuleInfo::Reset()
+     msNumRulesName = ::rtl::OUString();
+     msListId = ::rtl::OUString();
+     mnListStartValue = -1;
++    mnNumberingType = ::com::sun::star::style::NumberingType::CHAR_SPECIAL;
+     mnListLevel = 0;
+     // --> OD 2006-09-27 #i69627#
+     mbIsNumbered = mbIsRestart =
+diff --git xmloff/source/text/txtparae.cxx xmloff/source/text/txtparae.cxx
+index d5454fc..361200c 100644
+--- xmloff/source/text/txtparae.cxx
++++ xmloff/source/text/txtparae.cxx
+@@ -596,12 +596,16 @@ void XMLTextParagraphExport::exportListChange(
+ 		const XMLTextNumRuleInfo& rPrevInfo,
+ 	    const XMLTextNumRuleInfo& rNextInfo )
+ {
++    const bool bGenerousListLevels(
++        GetExport().getExportFlags() & EXPORT_GENEROUS_LIST_LEVELS);
++
+ 	// end a list
+     if ( rPrevInfo.GetLevel() > 0 )
+     {
+         bool bRootListToBeClosed = false;
+         sal_Int16 nListLevelsToBeClosed = 0;
+-        if ( !rNextInfo.BelongsToSameList( rPrevInfo ) ||
++        if ( !rNextInfo.BelongsToSameList( rPrevInfo, 
++                                           bGenerousListLevels ) ||
+              rNextInfo.GetLevel() <= 0 )
+         {
+             // close complete previous list
+@@ -644,7 +648,8 @@ void XMLTextParagraphExport::exportListChange(
+     {
+         bool bRootListToBeStarted = false;
+         sal_Int16 nListLevelsToBeOpened = 0;
+-        if ( !rPrevInfo.BelongsToSameList( rNextInfo ) ||
++        if ( !rPrevInfo.BelongsToSameList( rNextInfo,
++                                           bGenerousListLevels ) ||
+              rPrevInfo.GetLevel() <= 0 )
+         {
+             // new root list
+@@ -851,7 +856,8 @@ void XMLTextParagraphExport::exportListChange(
+ 
+     if ( rNextInfo.GetLevel() > 0 &&
+          rNextInfo.IsNumbered() &&
+-         rPrevInfo.BelongsToSameList( rNextInfo ) &&
++         rPrevInfo.BelongsToSameList( rNextInfo,
++                                      bGenerousListLevels ) &&
+          rPrevInfo.GetLevel() >= rNextInfo.GetLevel() )
+ 	{
+         // close previous list-item


More information about the ooo-build-commit mailing list