[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sd/qa
Muthu Subramanian
sumuthu at collabora.com
Fri Mar 28 05:09:28 PDT 2014
include/oox/drawingml/textcharacterproperties.hxx | 2 +
oox/source/drawingml/textcharacterproperties.cxx | 3 +
oox/source/drawingml/textcharacterpropertiescontext.cxx | 4 ++
sd/qa/unit/data/pptx/n862510_4.pptx |binary
sd/qa/unit/import-tests.cxx | 27 ++++++++++++++++
5 files changed, 36 insertions(+)
New commits:
commit 186b96dcfbd0ed87ef414246555e9f953927d692
Author: Muthu Subramanian <sumuthu at collabora.com>
Date: Fri Mar 28 17:29:37 2014 +0530
Add unit test for text gradfill import.
Change-Id: I803238fd21d1c73aae8146966a5e62e62ad48c5c
diff --git a/sd/qa/unit/data/pptx/n862510_4.pptx b/sd/qa/unit/data/pptx/n862510_4.pptx
new file mode 100644
index 0000000..0a461ee
Binary files /dev/null and b/sd/qa/unit/data/pptx/n862510_4.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 81f6b8a..462e2ed 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -66,6 +66,7 @@ public:
void testN862510_1();
void testN862510_2();
void testN862510_3();
+ void testN862510_4();
void testFdo71961();
CPPUNIT_TEST_SUITE(SdFiltersTest);
@@ -87,6 +88,7 @@ public:
CPPUNIT_TEST(testN862510_1);
CPPUNIT_TEST(testN862510_2);
CPPUNIT_TEST(testN862510_3);
+ CPPUNIT_TEST(testN862510_4);
CPPUNIT_TEST(testFdo71961);
CPPUNIT_TEST_SUITE_END();
@@ -308,6 +310,31 @@ void SdFiltersTest::testN862510_3()
}
}
+void SdFiltersTest::testN862510_4()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/n862510_4.pptx") );
+ CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.Is() );
+ CPPUNIT_ASSERT_MESSAGE( "in destruction", !xDocShRef->IsInDestruction() );
+
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+ const SdrPage *pPage = pDoc->GetPage( 1 );
+ CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+ {
+ std::vector<EECharAttrib> rLst;
+ SdrObject *pObj = pPage->GetObj( 0 );
+ SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+ CPPUNIT_ASSERT( pTxtObj );
+ const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
+ aEdit.GetCharAttribs( 0, rLst );
+ for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it != rLst.rend(); ++it )
+ {
+ const SvxColorItem *pC = dynamic_cast<const SvxColorItem *>( (*it).pAttr );
+ CPPUNIT_ASSERT_MESSAGE( "gradfill for text color not handled!", !( pC && pC->GetValue().GetColor() == 0 ) );
+ }
+ }
+}
+
void SdFiltersTest::testN828390()
{
bool bPassed = false;
commit cfc76de83e3c0a56abd30a8f3bd7c69d3500d223
Author: Muthu Subramanian <sumuthu at collabora.com>
Date: Fri Mar 28 17:24:45 2014 +0530
n#870234: Import gradfill for text colors.
Uses the first color from the gradfill list.
(Which is better than plain black!)
Change-Id: I4c1c0c4b031f3681c95b75b3c0683eb4de95bffb
diff --git a/include/oox/drawingml/textcharacterproperties.hxx b/include/oox/drawingml/textcharacterproperties.hxx
index e51937f..4162c23 100644
--- a/include/oox/drawingml/textcharacterproperties.hxx
+++ b/include/oox/drawingml/textcharacterproperties.hxx
@@ -24,6 +24,7 @@
#include <oox/helper/propertymap.hxx>
#include <oox/drawingml/color.hxx>
#include <oox/drawingml/textfont.hxx>
+#include <oox/drawingml/fillproperties.hxx>
namespace oox { class PropertySet; }
@@ -56,6 +57,7 @@ struct TextCharacterProperties
OptValue< bool > moItalic;
OptValue< bool > moUnderlineLineFollowText;
OptValue< bool > moUnderlineFillFollowText;
+ GradientFillProperties maGradientProps; /// Properties for gradient text colors
std::vector<css::beans::PropertyValue> maTextEffectsProperties;
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 6f64f2a..5f7cf4f 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -65,6 +65,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource
moUnderlineFillFollowText.assignIfUsed( rSourceProps.moUnderlineFillFollowText );
maTextEffectsProperties = rSourceProps.maTextEffectsProperties;
+ maGradientProps.assignUsed( rSourceProps.maGradientProps );
}
void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFilterBase& rFilter, bool bUseOptional ) const
@@ -108,6 +109,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
if( maCharColor.isUsed() )
rPropMap.setProperty( PROP_CharColor, maCharColor.getColor( rFilter.getGraphicHelper() ));
+ if( maGradientProps.maGradientStops.size() > 0 )
+ rPropMap[ PROP_CharColor ] <<= maGradientProps.maGradientStops.begin()->second.getColor( rFilter.getGraphicHelper() );
if( moLang.has() && !moLang.get().isEmpty() )
{
diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index 5bb800c..7bedd8e 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -132,6 +132,10 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
case A_TOKEN( hlinkClick ): // CT_Hyperlink
case A_TOKEN( hlinkMouseOver ): // CT_Hyperlink
return new HyperLinkContext( *this, rAttribs, mrTextCharacterProperties.maHyperlinkPropertyMap );
+
+ case A_TOKEN( gradFill ):
+ return new GradientFillContext( *this, rAttribs, mrTextCharacterProperties.maGradientProps );
+
case OOX_TOKEN( doc, rFonts ):
if( rAttribs.hasAttribute(OOX_TOKEN(doc, ascii)) )
{
More information about the Libreoffice-commits
mailing list