Author: jsc
Date: Fri Jun  8 11:31:12 2012
New Revision: 1348027

URL: http://svn.apache.org/viewvc?rev=1348027&view=rev
Log:
119629: Bullet color is lost when open pptx sample file

fix: apply text's color to bullet color.

Patch By: companycy
Found By: zongdj
Review By: jsc


Modified:
    incubator/ooo/trunk/main/oox/inc/oox/drawingml/textparagraphproperties.hxx
    incubator/ooo/trunk/main/oox/source/drawingml/textparagraph.cxx

Modified: 
incubator/ooo/trunk/main/oox/inc/oox/drawingml/textparagraphproperties.hxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/oox/inc/oox/drawingml/textparagraphproperties.hxx?rev=1348027&r1=1348026&r2=1348027&view=diff
==============================================================================
--- incubator/ooo/trunk/main/oox/inc/oox/drawingml/textparagraphproperties.hxx 
(original)
+++ incubator/ooo/trunk/main/oox/inc/oox/drawingml/textparagraphproperties.hxx 
Fri Jun  8 11:31:12 2012
@@ -90,6 +90,7 @@ public:
     sal_Int16                           getLevel( ) const { return mnLevel; }
     PropertyMap&                        getTextParagraphPropertyMap() { return 
maTextParagraphPropertyMap; }
     BulletList&                         getBulletList() { return maBulletList; 
}
+    const BulletList&                   getBulletList() const { return 
maBulletList; }
     TextCharacterProperties&            getTextCharacterProperties() { return 
maTextCharacterProperties; }
     const TextCharacterProperties&      getTextCharacterProperties() const { 
return maTextCharacterProperties; }
 

Modified: incubator/ooo/trunk/main/oox/source/drawingml/textparagraph.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/oox/source/drawingml/textparagraph.cxx?rev=1348027&r1=1348026&r2=1348027&view=diff
==============================================================================
--- incubator/ooo/trunk/main/oox/source/drawingml/textparagraph.cxx (original)
+++ incubator/ooo/trunk/main/oox/source/drawingml/textparagraph.cxx Fri Jun  8 
11:31:12 2012
@@ -46,6 +46,16 @@ TextParagraph::~TextParagraph()
 {
 }
 
+void lcl_getBulletclr(Color& bulletClr,
+                      const TextRunVector& rRuns)
+{
+    // color of closest text in runs
+    if (rRuns.begin() != rRuns.end() && 
((*rRuns.begin())->getTextCharacterProperties()).maCharColor.isUsed())
+    {
+        bulletClr = 
((*rRuns.begin())->getTextCharacterProperties()).maCharColor;
+    }
+}
+
 void TextParagraph::insertAt(
         const ::oox::core::XmlFilterBase& rFilterBase,
         const Reference < XText > &xText,
@@ -101,6 +111,15 @@ void TextParagraph::insertAt(
             pTextParagraphStyle->pushToPropSet( rFilterBase, xProps, 
aioBulletList, NULL, sal_False, fCharacterSize );
             fCharacterSize = pTextParagraphStyle->getCharHeightPoints( 18 );
                }
+
+        // bullet color inherits from closest text
+        if (maProperties.getBulletList().maBulletColorPtr && 
!(maProperties.getBulletList().maBulletColorPtr)->isUsed())
+        {
+            Color bulletClr;
+            lcl_getBulletclr(bulletClr, maRuns);
+            
(maProperties.getBulletList().maBulletColorPtr)->assignIfUsed(bulletClr);
+        }
+
                maProperties.pushToPropSet( rFilterBase, xProps, aioBulletList, 
&pTextParagraphStyle->getBulletList(), sal_True, fCharacterSize );
 
         // empty paragraphs do not have bullets in ppt


Reply via email to