[Libreoffice-commits] .: 6 commits - offapi/com offapi/UnoApi_offapi.mk sw/inc sw/qa sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 30 04:04:11 PST 2013


 offapi/UnoApi_offapi.mk                               |    1 
 offapi/com/sun/star/text/GradientTable.idl            |   33 ++++++++++++
 sw/inc/hintids.hxx                                    |   48 +++++++++---------
 sw/qa/extras/odfexport/data/textframe-gradient.odt    |binary
 sw/qa/extras/odfexport/odfexport.cxx                  |   25 +++++++++
 sw/qa/extras/ooxmlexport/data/textframe-gradient.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx              |   27 +++++++++-
 sw/source/filter/ww8/attributeoutputbase.hxx          |    8 +++
 sw/source/filter/ww8/docxattributeoutput.cxx          |   42 +++++++++++++++
 sw/source/filter/ww8/docxattributeoutput.hxx          |   11 ++++
 sw/source/filter/ww8/rtfattributeoutput.cxx           |    8 +++
 sw/source/filter/ww8/rtfattributeoutput.hxx           |    6 ++
 sw/source/filter/ww8/ww8atr.cxx                       |   18 ++++++
 sw/source/filter/ww8/ww8attributeoutput.hxx           |    6 ++
 14 files changed, 207 insertions(+), 26 deletions(-)

New commits:
commit d3c72662488cd2fad1876e8f4c17d54f26245a7a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jan 30 12:37:23 2013 +0100

    sw: add textframe gradient DOCX roundtrip testcase
    
    Change-Id: I77f63631b5b666e2735978d1bf48ef5733a9f28e

diff --git a/sw/qa/extras/ooxmlexport/data/textframe-gradient.docx b/sw/qa/extras/ooxmlexport/data/textframe-gradient.docx
new file mode 100755
index 0000000..e5ed068
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/textframe-gradient.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4ff3f98..d39489a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -26,6 +26,8 @@
  */
 
 #include <com/sun/star/frame/XStorable.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
 #include <com/sun/star/style/TabStop.hpp>
 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
 #include <com/sun/star/text/XTextFrame.hpp>
@@ -71,6 +73,7 @@ public:
     void test1Table1Page();
     void testTextFrames();
     void testTextFrameBorders();
+    void testTextframeGradient();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -111,7 +114,8 @@ void Test::run()
         {"n789482.docx", &Test::testN789482},
 //      {"1-table-1-page.docx", &Test::test1Table1Page}, // doesn't work on openSUSE12.2 at least
         {"textframes.odt", &Test::testTextFrames},
-        {"textframe-borders.docx", &Test::testTextFrameBorders}
+        {"textframe-borders.docx", &Test::testTextFrameBorders},
+        {"textframe-gradient.docx", &Test::testTextframeGradient},
     };
     // Don't test the first import of these, for some reason those tests fail
     const char* aBlacklist[] = {
@@ -539,6 +543,27 @@ void Test::testTextFrameBorders()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x622423), aShadowFormat.Color);
 }
 
+void Test::testTextframeGradient()
+{
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+
+    uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame, "FillStyle"));
+    awt::Gradient aGradient = getProperty<awt::Gradient>(xFrame, "FillGradient");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), aGradient.StartColor);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), aGradient.EndColor);
+    CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style);
+
+    xFrame.set(xIndexAccess->getByIndex(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame, "FillStyle"));
+    aGradient = getProperty<awt::Gradient>(xFrame, "FillGradient");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aGradient.StartColor);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x666666), aGradient.EndColor);
+    CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit b7de0431375926878646db1b1113573fb27f1cde
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jan 30 12:22:18 2013 +0100

    initial DOCX export of Writer textframe gradients
    
    Change-Id: I0b0a623c58ca398bb556fc9fcd2cdecb4e789d0a

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 42e488e..917ddb5 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -70,6 +70,8 @@
 #include <editeng/editobj.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/svdobj.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflgrit.hxx>
 #include <sfx2/sfxbasemodel.hxx>
 
 #include <anchoredobject.hxx>
@@ -315,6 +317,12 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
         m_pSerializer->startElementNS( XML_w, XML_pict, FSEND );
         m_pSerializer->startElementNS( XML_v, XML_rect, xFlyAttrList );
         lcl_TextFrameShadow(m_pSerializer, rFrmFmt);
+        if (m_pFlyFillAttrList)
+        {
+            XFastAttributeListRef xFlyFillAttrList(m_pFlyFillAttrList);
+            m_pFlyFillAttrList = NULL;
+            m_pSerializer->singleElementNS(XML_v, XML_fill, xFlyFillAttrList);
+        }
         m_pSerializer->startElementNS( XML_v, XML_textbox, FSEND );
         m_pSerializer->startElementNS( XML_w, XML_txbxContent, FSEND );
         m_rExport.WriteText( );
@@ -4547,12 +4555,37 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
     }
 }
 
-void DocxAttributeOutput::FormatFillStyle( const XFillStyleItem& /*rFillStyle*/ )
+void DocxAttributeOutput::FormatFillStyle( const XFillStyleItem& rFillStyle )
 {
+    m_oFillStyle.reset(rFillStyle.GetValue());
 }
 
-void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& /*rFillGradient*/ )
+void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& rFillGradient )
 {
+    if (*m_oFillStyle == XFILL_GRADIENT)
+    {
+        m_pFlyFillAttrList = m_pSerializer->createAttrList();
+        m_pFlyFillAttrList->add(XML_type, "gradient");
+
+        const XGradient& rGradient = rFillGradient.GetGradientValue();
+        OString sStartColor = impl_ConvertColor(rGradient.GetStartColor());
+        m_pFlyFillAttrList->add(XML_color2, "#" + sStartColor);
+        OString sEndColor = impl_ConvertColor(rGradient.GetEndColor());
+        m_pFlyAttrList->add(XML_fillcolor, "#" + sEndColor);
+
+        switch (rGradient.GetGradientStyle())
+        {
+            case XGRAD_LINEAR: break;
+            case XGRAD_AXIAL:
+                m_pFlyFillAttrList->add(XML_focus, "50%");
+                break;
+            case XGRAD_RADIAL: break;
+            case XGRAD_ELLIPTICAL: break;
+            case XGRAD_SQUARE: break;
+            case XGRAD_RECT: break;
+        }
+    }
+    m_oFillStyle.reset();
 }
 
 void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
@@ -4743,6 +4776,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
       m_pParagraphSpacingAttrList( NULL ),
       m_pHyperlinkAttrList( NULL ),
       m_pFlyAttrList( NULL ),
+      m_pFlyFillAttrList( NULL ),
       m_pFootnotesList( new ::docx::FootnotesList() ),
       m_pEndnotesList( new ::docx::FootnotesList() ),
       m_footnoteEndnoteRefTag( 0 ),
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 6508d0b..ff35351 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -28,11 +28,13 @@
 #include <sax/fshelper.hxx>
 #include <sax/fastattribs.hxx>
 #include <vcl/vclenum.hxx>
+#include <svx/xenum.hxx>
 
 #include <fldbas.hxx>
 
 #include <vector>
 #include <boost/scoped_ptr.hpp>
+#include <boost/optional.hpp>
 #include <oox/export/vmlexport.hxx>
 
 class SwGrfNode;
@@ -558,6 +560,7 @@ private:
     ::sax_fastparser::FastAttributeList *m_pParagraphSpacingAttrList;
     ::sax_fastparser::FastAttributeList *m_pHyperlinkAttrList;
     ::sax_fastparser::FastAttributeList *m_pFlyAttrList;
+    ::sax_fastparser::FastAttributeList *m_pFlyFillAttrList;
 
     ::docx::FootnotesList *m_pFootnotesList;
     ::docx::FootnotesList *m_pEndnotesList;
@@ -630,6 +633,8 @@ private:
     // Remember first cell (used for for default borders/margins) of each table
     std::vector<ww8::WW8TableNodeInfoInner::Pointer_t> tableFirstCells;
 
+    boost::optional<XFillStyle> m_oFillStyle;
+
 public:
     DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML );
 
commit 23515e814e2af04ffd82c18cd20607f7c15e1472
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jan 30 11:03:43 2013 +0100

    sw: handle RES_FILL_STYLE/GRADIENT in AttributeOutputBase::OutputItem
    
    So that later in doc/docx/rtf export gradient background of textframes
    can be handled.
    
    Change-Id: I8f79cd0b63231c0551fc85c5cd1c06f5511326f1

diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index 898acbb..d340dda 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -50,6 +50,8 @@ class SvxWeightItem;
 class SvxAutoKernItem;
 class SvxBlinkItem;
 class SvxBrushItem;
+class XFillStyleItem;
+class XFillGradientItem;
 class SvxFontItem;
 class SvxFontHeightItem;
 class SvxLanguageItem;
@@ -528,6 +530,12 @@ protected:
     /// Sfx item RES_BACKGROUND
     virtual void FormatBackground( const SvxBrushItem& ) = 0;
 
+    /// Sfx item RES_FILL_STYLE
+    virtual void FormatFillStyle( const XFillStyleItem& ) = 0;
+
+    /// Sfx item RES_FILL_GRADIENT
+    virtual void FormatFillGradient( const XFillGradientItem& ) = 0;
+
     /// Sfx item RES_BOX
     virtual void FormatBox( const SvxBoxItem& ) = 0;
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6300ddd..42e488e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4547,6 +4547,14 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
     }
 }
 
+void DocxAttributeOutput::FormatFillStyle( const XFillStyleItem& /*rFillStyle*/ )
+{
+}
+
+void DocxAttributeOutput::FormatFillGradient( const XFillGradientItem& /*rFillGradient*/ )
+{
+}
+
 void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
 {
     if (m_bTextFrameSyntax)
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 91539b5..6508d0b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -496,6 +496,12 @@ protected:
     /// Sfx item RES_BACKGROUND
     virtual void FormatBackground( const SvxBrushItem& );
 
+    /// Sfx item RES_FILL_STYLE
+    virtual void FormatFillStyle( const XFillStyleItem& );
+
+    /// Sfx item RES_FILL_GRADIENT
+    virtual void FormatFillGradient( const XFillGradientItem& );
+
     /// Sfx item RES_BOX
     virtual void FormatBox( const SvxBoxItem& );
 
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 867d6c2..902c00c 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2873,6 +2873,14 @@ void RtfAttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
     }
 }
 
+void RtfAttributeOutput::FormatFillStyle( const XFillStyleItem& /*rFillStyle*/ )
+{
+}
+
+void RtfAttributeOutput::FormatFillGradient( const XFillGradientItem& /*rFillGradient*/ )
+{
+}
+
 void RtfAttributeOutput::FormatBox( const SvxBoxItem& rBox )
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 65e493c..aefa724 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -374,6 +374,12 @@ protected:
     /// Sfx item RES_BACKGROUND
     virtual void FormatBackground( const SvxBrushItem& );
 
+    /// Sfx item RES_FILL_STYLE
+    virtual void FormatFillStyle( const XFillStyleItem& );
+
+    /// Sfx item RES_FILL_GRADIENT
+    virtual void FormatFillGradient( const XFillGradientItem& );
+
     /// Sfx item RES_BOX
     virtual void FormatBox( const SvxBoxItem& );
 
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 3d3bcf4..003bde1 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -70,6 +70,8 @@
 #include <editeng/blnkitem.hxx>
 #include <editeng/charhiddenitem.hxx>
 #include <editeng/paperinf.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflgrit.hxx>
 #include <fmtfld.hxx>
 #include <fchrfmt.hxx>
 #include <fmtfsize.hxx>
@@ -4020,6 +4022,14 @@ void WW8AttributeOutput::FormatBackground( const SvxBrushItem& rBrush )
     }
 }
 
+void WW8AttributeOutput::FormatFillStyle( const XFillStyleItem& /*rFillStyle*/ )
+{
+}
+
+void WW8AttributeOutput::FormatFillGradient( const XFillGradientItem& /*rFillGradient*/ )
+{
+}
+
 WW8_BRC WW8Export::TranslateBorderLine(const SvxBorderLine& rLine,
     sal_uInt16 nDist, bool bShadow)
 {
@@ -5167,6 +5177,12 @@ void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt )
         case RES_BACKGROUND:
             FormatBackground( static_cast< const SvxBrushItem& >( rHt ) );
             break;
+        case RES_FILL_STYLE:
+            FormatFillStyle( static_cast< const XFillStyleItem& >( rHt ) );
+            break;
+        case RES_FILL_GRADIENT:
+            FormatFillGradient( static_cast< const XFillGradientItem& >( rHt ) );
+            break;
         case RES_BOX:
             FormatBox( static_cast< const SvxBoxItem& >( rHt ) );
             break;
@@ -5187,7 +5203,7 @@ void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt )
             break;
 
         default:
-            OSL_TRACE("Unhandled SfxPoolItem with id %d.", rHt.Which() );
+            SAL_INFO("sw.ww8", "Unhandled SfxPoolItem with id " << rHt.Which() );
             break;
     }
 }
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index d1e17bb..8d1661f 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -358,6 +358,12 @@ protected:
     /// Sfx item RES_BACKGROUND
     virtual void FormatBackground( const SvxBrushItem& );
 
+    /// Sfx item RES_FILL_STYLE
+    virtual void FormatFillStyle( const XFillStyleItem& );
+
+    /// Sfx item RES_FILL_GRADIENT
+    virtual void FormatFillGradient( const XFillGradientItem& );
+
     /// Sfx item RES_BOX
     virtual void FormatBox( const SvxBoxItem& );
 
commit 3430220290322ff8b6c68fe68357487bc1431b1f
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jan 29 16:02:48 2013 +0100

    sw: update hintids comments to match reality
    
    Change-Id: I30ef3e080d97f9bbdd1a9bca1c2d4c99fdfdfd28

diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx
index e6c5c79..83afbcd 100644
--- a/sw/inc/hintids.hxx
+++ b/sw/inc/hintids.hxx
@@ -220,42 +220,42 @@ RES_FRMATR_BEGIN = RES_PARATR_LIST_END,
     RES_AUTO_STYLE,                                 // 119
     RES_FRMATR_STYLE_NAME,                          // 120
     RES_FRMATR_CONDITIONAL_STYLE_NAME,              // 121
-    RES_FILL_STYLE,
-    RES_FILL_GRADIENT,
+    RES_FILL_STYLE,                                 // 122
+    RES_FILL_GRADIENT,                              // 123
 RES_FRMATR_END
 };
 
 enum RES_GRFATR
 {
 RES_GRFATR_BEGIN = RES_FRMATR_END,
-    RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN,        // 122
-    RES_GRFATR_CROPGRF,                             // 123
-
-    RES_GRFATR_ROTATION,                            // 124
-    RES_GRFATR_LUMINANCE,                           // 125
-    RES_GRFATR_CONTRAST,                            // 126
-    RES_GRFATR_CHANNELR,                            // 127
-    RES_GRFATR_CHANNELG,                            // 128
-    RES_GRFATR_CHANNELB,                            // 129
-    RES_GRFATR_GAMMA,                               // 130
-    RES_GRFATR_INVERT,                              // 131
-    RES_GRFATR_TRANSPARENCY,                        // 132
-    RES_GRFATR_DRAWMODE,                            // 133
-
-    RES_GRFATR_DUMMY1,                              // 134
-    RES_GRFATR_DUMMY2,                              // 135
-    RES_GRFATR_DUMMY3,                              // 136
-    RES_GRFATR_DUMMY4,                              // 137
-    RES_GRFATR_DUMMY5,                              // 138
+    RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN,        // 124
+    RES_GRFATR_CROPGRF,                             // 125
+
+    RES_GRFATR_ROTATION,                            // 126
+    RES_GRFATR_LUMINANCE,                           // 127
+    RES_GRFATR_CONTRAST,                            // 128
+    RES_GRFATR_CHANNELR,                            // 129
+    RES_GRFATR_CHANNELG,                            // 130
+    RES_GRFATR_CHANNELB,                            // 131
+    RES_GRFATR_GAMMA,                               // 132
+    RES_GRFATR_INVERT,                              // 133
+    RES_GRFATR_TRANSPARENCY,                        // 134
+    RES_GRFATR_DRAWMODE,                            // 135
+
+    RES_GRFATR_DUMMY1,                              // 136
+    RES_GRFATR_DUMMY2,                              // 137
+    RES_GRFATR_DUMMY3,                              // 138
+    RES_GRFATR_DUMMY4,                              // 139
+    RES_GRFATR_DUMMY5,                              // 140
 RES_GRFATR_END
 };
 
 enum RES_BOXATR
 {
 RES_BOXATR_BEGIN = RES_GRFATR_END,
-    RES_BOXATR_FORMAT = RES_BOXATR_BEGIN,           // 139
-    RES_BOXATR_FORMULA,                             // 140
-    RES_BOXATR_VALUE,                               // 141
+    RES_BOXATR_FORMAT = RES_BOXATR_BEGIN,           // 141
+    RES_BOXATR_FORMULA,                             // 142
+    RES_BOXATR_VALUE,                               // 143
 RES_BOXATR_END
 };
 
commit d7efffebd9651dd866349915360ade64b97d7301
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jan 29 15:59:29 2013 +0100

    Document com.sun.star.text.GradientTable
    
    Introduced in commit 81a46fc86a530f028a5bd2f5e52fe0372d50ee38.
    
    Change-Id: I2e54c214916ce1793e07a4a7d42a6cf7e39f3424

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index eda4101..72a590e 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1277,6 +1277,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/text,\
 	GenericTextDocument \
 	GlobalDocument \
 	GlobalSettings \
+	GradientTable \
 	IllustrationsIndex \
 	InContentMetadata \
 	LineNumberingProperties \
diff --git a/offapi/com/sun/star/text/GradientTable.idl b/offapi/com/sun/star/text/GradientTable.idl
new file mode 100644
index 0000000..b7f433f
--- /dev/null
+++ b/offapi/com/sun/star/text/GradientTable.idl
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef __com_sun_star_text_GradientTable_idl__
+#define __com_sun_star_text_GradientTable_idl__
+
+#include <com/sun/star/container/XNameContainer.idl>
+
+
+ module com {  module sun {  module star {  module text {
+
+
+/** this is a container for <type scope="com::sun::star::awt">Gradient</type>s, used for Writer TextFrames
+*/
+service GradientTable
+{
+    /** this container lets you access the <type scope="com::sun::star::awt">Gradient</type>s that
+        are indexed with a name inside Writer.
+    */
+    interface com::sun::star::container::XNameContainer;
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 64020cebd676e6ff2b16da5af667b41afa04004d
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jan 29 15:49:44 2013 +0100

    sw: add textframe gradient ODF roundtrip testcase
    
    Change-Id: I346de7efd4e91f93e3f07ece1c6fe71d1ca53b8e

diff --git a/sw/qa/extras/odfexport/data/textframe-gradient.odt b/sw/qa/extras/odfexport/data/textframe-gradient.odt
new file mode 100644
index 0000000..cdcae4f
Binary files /dev/null and b/sw/qa/extras/odfexport/data/textframe-gradient.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 92c934c..4ed23f1 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -26,12 +26,15 @@
  */
 
 #include <swmodeltestbase.hxx>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 
 class Test : public SwModelTestBase
 {
 public:
     void testFdo38244();
     void testFirstHeaderFooter();
+    void testTextframeGradient();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -48,6 +51,7 @@ void Test::run()
     MethodEntry<Test> aMethods[] = {
         {"fdo38244.odt", &Test::testFdo38244},
         {"first-header-footer.odt", &Test::testFirstHeaderFooter},
+        {"textframe-gradient.odt", &Test::testTextframeGradient},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -108,6 +112,27 @@ void Test::testFirstHeaderFooter()
     CPPUNIT_ASSERT_EQUAL(OUString("Left footer2"),  parseDump("/root/page[6]/footer/txt/text()"));
 }
 
+void Test::testTextframeGradient()
+{
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+
+    uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame, "FillStyle"));
+    awt::Gradient aGradient = getProperty<awt::Gradient>(xFrame, "FillGradient");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0xC0504D), aGradient.StartColor);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD99594), aGradient.EndColor);
+    CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style);
+
+    xFrame.set(xIndexAccess->getByIndex(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, getProperty<drawing::FillStyle>(xFrame, "FillStyle"));
+    aGradient = getProperty<awt::Gradient>(xFrame, "FillGradient");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), aGradient.StartColor);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0x666666), aGradient.EndColor);
+    CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list