sw/inc/unoprnms.hxx                         |    1 +
 sw/qa/extras/unowriter/unowriter.cxx        |   16 ++++++++++++++++
 sw/source/core/unocore/unomap1.cxx          |    2 ++
 sw/source/core/unocore/unomapproperties.hxx |    3 +++
 4 files changed, 22 insertions(+)

New commits:
commit c48790b5cec73a49aed20c26b123c3656bb9eff9
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Jan 2 18:06:05 2020 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Jan 3 09:05:29 2020 +0100

    sw: add UNO API for semi-transparent text
    
    This makes the ODF filter work out of the box, since the same property
    was provided by Draw/Impress in the past already.
    
    Change-Id: Ie6a053864c9fa41fad6ca4571d7d04a3756b7591
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86147
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index fdcc88442bc4..4e1e565868b7 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -118,6 +118,7 @@
 #define UNO_NAME_CHAR_PROP_HEIGHT_COMPLEX "CharPropHeightComplex"
 #define UNO_NAME_CHAR_DIFF_HEIGHT_COMPLEX "CharDiffHeightComplex"
 #define UNO_NAME_CHAR_ESCAPEMENT_HEIGHT "CharEscapementHeight"
+#define UNO_NAME_CHAR_TRANSPARENCE "CharTransparence"
 #define UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS "HideTabLeaderAndPageNumber"
 #define UNO_NAME_TAB_IN_TOC "TabInTOC"
 #define UNO_NAME_TOC_BOOKMARK "TOCBookmark"
diff --git a/sw/qa/extras/unowriter/unowriter.cxx 
b/sw/qa/extras/unowriter/unowriter.cxx
index 1cceb108181d..2f01c47605ba 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -824,6 +824,22 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testMultiSelect)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTransparentText)
+{
+    // Test the CharTransparence text portion property.
+
+    // Create a new document.
+    loadURL("private:factory/swriter", nullptr);
+
+    // Set a custom transparency.
+    uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), 
uno::UNO_QUERY);
+    sal_Int16 nExpected = 42;
+    xParagraph->setPropertyValue("CharTransparence", uno::makeAny(nExpected));
+
+    // Get the transparency & verify.
+    CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int16>(xParagraph, 
"CharTransparence"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unomap1.cxx 
b/sw/source/core/unocore/unomap1.cxx
index aeea274dedd6..c1fe17bd1842 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -194,6 +194,7 @@ const SfxItemPropertyMapEntry*  
SwUnoPropertyMapProvider::GetCharStylePropertyMa
         { OUString(UNO_NAME_CHAR_HIGHLIGHT), RES_CHRATR_HIGHLIGHT, 
cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_BACK_COLOR },
         { OUString(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP,     
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, 0},
         { OUString(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE, 0},
+        { OUString(UNO_NAME_CHAR_TRANSPARENCE), RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_ALPHA},
         { OUString(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<sal_Int16>::get(),                  PropertyAttribute::MAYBEVOID, 
MID_CROSS_OUT},
         { OUString(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<bool>::get()  ,        PROPERTY_NONE, 0},
         { OUString(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT,  
cppu::UnoType<sal_Int16>::get(),             PROPERTY_NONE, MID_ESC          },
@@ -255,6 +256,7 @@ const SfxItemPropertyMapEntry*  
SwUnoPropertyMapProvider::GetAutoCharStyleProper
         { OUString(UNO_NAME_CHAR_HIGHLIGHT), RES_CHRATR_HIGHLIGHT, 
cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_BACK_COLOR },
         { OUString(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP,     
cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, 0},
         { OUString(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE, 0},
+        { OUString(UNO_NAME_CHAR_TRANSPARENCE), RES_CHRATR_COLOR, 
cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_COLOR_ALPHA},
         { OUString(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<sal_Int16>::get(),                  PropertyAttribute::MAYBEVOID, 
MID_CROSS_OUT},
         { OUString(UNO_NAME_CHAR_CROSSED_OUT), RES_CHRATR_CROSSEDOUT,  
cppu::UnoType<bool>::get()  ,        PROPERTY_NONE, 0},
         { OUString(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT,  
cppu::UnoType<sal_Int16>::get(),             PROPERTY_NONE, MID_ESC          },
diff --git a/sw/source/core/unocore/unomapproperties.hxx 
b/sw/source/core/unocore/unomapproperties.hxx
index bf75f3d133d6..0b211f392b67 100644
--- a/sw/source/core/unocore/unomapproperties.hxx
+++ b/sw/source/core/unocore/unomapproperties.hxx
@@ -121,6 +121,7 @@
         { OUString(UNO_NAME_PARA_BACK_COLOR),                     
RES_BACKGROUND,                cppu::UnoType<sal_Int32>::get(),         
PropertyAttribute::MAYBEVOID, MID_BACK_COLOR                         }, \
         { OUString(UNO_NAME_CHAR_CASE_MAP),                       
RES_CHRATR_CASEMAP,            cppu::UnoType<sal_Int16>::get(),         
PropertyAttribute::MAYBEVOID, 0                                      }, \
         { OUString(UNO_NAME_CHAR_COLOR),                          
RES_CHRATR_COLOR,              cppu::UnoType<sal_Int32>::get(),         
PropertyAttribute::MAYBEVOID, 0                                      }, \
+        { OUString(UNO_NAME_CHAR_TRANSPARENCE),                   
RES_CHRATR_COLOR,              cppu::UnoType<sal_Int16>::get(),         
PropertyAttribute::MAYBEVOID, MID_COLOR_ALPHA }, \
         { OUString(UNO_NAME_CHAR_STRIKEOUT),                      
RES_CHRATR_CROSSEDOUT,         cppu::UnoType<sal_Int16>::get(),         
PropertyAttribute::MAYBEVOID, MID_CROSS_OUT                          }, \
         { OUString(UNO_NAME_CHAR_CROSSED_OUT),                    
RES_CHRATR_CROSSEDOUT,         cppu::UnoType<bool>::get(),       
PropertyAttribute::MAYBEVOID, MID_CROSSED_OUT                        }, \
         { OUString(UNO_NAME_CHAR_ESCAPEMENT),                     
RES_CHRATR_ESCAPEMENT,         cppu::UnoType<sal_Int16>::get(),         
PropertyAttribute::MAYBEVOID, MID_ESC                                }, \
@@ -362,6 +363,7 @@
                     { OUString(UNO_NAME_PARA_GRAPHIC_LOCATION), 
RES_BACKGROUND,         cppu::UnoType<css::style::GraphicLocation>::get(), 
PROPERTY_NONE ,MID_GRAPHIC_POSITION}, \
                     { OUString(UNO_NAME_CHAR_CASE_MAP), RES_CHRATR_CASEMAP,    
 cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, 0},\
                     { OUString(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE, 0},\
+                    { OUString(UNO_NAME_CHAR_TRANSPARENCE), RES_CHRATR_COLOR,  
    cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, MID_COLOR_ALPHA},\
                     { OUString(UNO_NAME_CHAR_STRIKEOUT), 
RES_CHRATR_CROSSEDOUT,  cppu::UnoType<sal_Int16>::get(),                  
PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},\
                     { OUString(UNO_NAME_CHAR_CROSSED_OUT), 
RES_CHRATR_CROSSEDOUT,  cppu::UnoType<bool>::get()  ,        PROPERTY_NONE, 0},\
                     { OUString(UNO_NAME_CHAR_ESCAPEMENT), 
RES_CHRATR_ESCAPEMENT,  cppu::UnoType<sal_Int16>::get(),             
PROPERTY_NONE, MID_ESC          },\
@@ -466,6 +468,7 @@
 #define COMMON_ACCESSIBILITY_TEXT_ATTRIBUTE \
                     { OUString(UNO_NAME_CHAR_BACK_COLOR), 
RES_CHRATR_BACKGROUND,    cppu::UnoType<sal_Int32>::get(),           
PROPERTY_NONE ,MID_BACK_COLOR        }, \
                     { OUString(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR,      
cppu::UnoType<sal_Int32>::get(),           PROPERTY_NONE, 0},  \
+                    { OUString(UNO_NAME_CHAR_TRANSPARENCE), RES_CHRATR_COLOR,  
    cppu::UnoType<sal_Int16>::get(),           PROPERTY_NONE, MID_COLOR_ALPHA 
},  \
                     { OUString(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR,   
 cppu::UnoType<bool>::get()  ,       PROPERTY_NONE, 0},  \
                     { OUString(UNO_NAME_CHAR_EMPHASIS), 
RES_CHRATR_EMPHASIS_MARK,           cppu::UnoType<sal_Int16>::get(),   
PROPERTY_NONE, MID_EMPHASIS},   \
                     { OUString(UNO_NAME_CHAR_ESCAPEMENT), 
RES_CHRATR_ESCAPEMENT,  cppu::UnoType<sal_Int16>::get(),             
PROPERTY_NONE, MID_ESC          },  \
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to