sw/inc/tblafmt.hxx                  |    8 +++++
 sw/inc/unoprnms.hxx                 |    4 ++
 sw/inc/unostyle.hxx                 |   10 ++++++
 sw/source/core/doc/tblafmt.cxx      |   23 +++++++++++++++
 sw/source/core/unocore/unomap.cxx   |    4 ++
 sw/source/core/unocore/unostyle.cxx |   54 ++++++++++++++++++++++++++++++++++++
 6 files changed, 103 insertions(+)

New commits:
commit 98e3e2414b4cf80343af3499414f6a5ef86d7ae8
Author: Jakub Trzebiatowski <ubap....@gmail.com>
Date:   Thu Jun 16 11:56:01 2016 +0200

    GSoC Table Styles, Add TableStyle properties
    
    Added properties for the following odf attributes:
        table:first-row-end-column
        table:first-row-start-column
        table:last-row-end-column
        table:last-row-start-column
    
    Change-Id: Iac140e00a3439740623649ea234504f08146aaf3
    Reviewed-on: https://gerrit.libreoffice.org/26359
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx
index 6ed138d..fc698ef 100644
--- a/sw/inc/tblafmt.hxx
+++ b/sw/inc/tblafmt.hxx
@@ -118,6 +118,8 @@ public:
     ~SwBoxAutoFormat();
 
     SwBoxAutoFormat& operator=( const SwBoxAutoFormat& rNew );
+    /// Comparing based of boxes backgrounds.
+    bool operator==(const SwBoxAutoFormat& rRight);
 
     // The get-methods.
     const SvxFontItem       &GetFont() const        { return m_aFont; }
@@ -300,6 +302,12 @@ public:
     void SetValueFormat( const bool bNew )  { bInclValueFormat = bNew; }
     void SetWidthHeight( const bool bNew )  { bInclWidthHeight = bNew; }
 
+    /// These methods returns what style (row or column) is applied first on 
given Cell
+    bool FirstRowEndColumnIsRow();
+    bool FirstRowStartColumnIsRow();
+    bool LastRowEndColumnIsRow();
+    bool LastRowStartColumnIsRow();
+
     bool Load( SvStream& rStream, const SwAfVersions& );
     bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const;
 
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 8a43709..0d1322d 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -843,6 +843,10 @@
 #define UNO_NAME_ROW_INTEROP_GRAB_BAG "RowInteropGrabBag"
 #define UNO_NAME_TABLE_INTEROP_GRAB_BAG "TableInteropGrabBag"
 
+#define UNO_NAME_TABLE_FIRST_ROW_END_COLUMN "FirstRowEndColumn"
+#define UNO_NAME_TABLE_FIRST_ROW_START_COLUMN "FirstRowStartColumn"
+#define UNO_NAME_TABLE_LAST_ROW_END_COLUMN "LastRowEndColumn"
+#define UNO_NAME_TABLE_LAST_ROW_START_COLUMN "LastRowStartColumn"
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx
index bac73cf..cbb04f5 100644
--- a/sw/inc/unostyle.hxx
+++ b/sw/inc/unostyle.hxx
@@ -253,6 +253,7 @@ typedef std::map<OUString, sal_Int32> CellStyleNameMap;
 class SwXTextTableStyle : public cppu::WeakImplHelper
 <
     css::style::XStyle,
+    css::beans::XPropertySet,
     css::container::XNameAccess,
     css::lang::XServiceInfo
 >
@@ -290,6 +291,15 @@ public:
     virtual OUString SAL_CALL getName() throw(css::uno::RuntimeException, 
std::exception) override;
     virtual void SAL_CALL setName(const OUString& rName) 
throw(css::uno::RuntimeException, std::exception) override;
 
+    //XPropertySet
+    virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL 
getPropertySetInfo() throw(css::uno::RuntimeException, std::exception) override;
+    virtual void SAL_CALL setPropertyValue(const OUString& aPropertyName, 
const css::uno::Any& aValue) throw(css::beans::UnknownPropertyException, 
css::beans::PropertyVetoException, css::lang::IllegalArgumentException, 
css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) 
override;
+    virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& 
PropertyName) throw(css::beans::UnknownPropertyException, 
css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) 
override;
+    virtual void SAL_CALL addPropertyChangeListener(const OUString& 
aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& 
xListener) throw(css::beans::UnknownPropertyException, 
css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) 
override;
+    virtual void SAL_CALL removePropertyChangeListener(const OUString& 
aPropertyName, const css::uno::Reference<css::beans::XPropertyChangeListener>& 
aListener) throw(css::beans::UnknownPropertyException, 
css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) 
override;
+    virtual void SAL_CALL addVetoableChangeListener(const OUString& 
PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& 
aListener) throw(css::beans::UnknownPropertyException, 
css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) 
override;
+    virtual void SAL_CALL removeVetoableChangeListener(const OUString& 
PropertyName, const css::uno::Reference<css::beans::XVetoableChangeListener>& 
aListener) throw(css::beans::UnknownPropertyException, 
css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) 
override;
+
     //XNameAccess
     virtual css::uno::Any SAL_CALL getByName(const OUString& rName) 
throw(css::container::NoSuchElementException, 
css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception) 
override;
     virtual css::uno::Sequence<OUString> SAL_CALL getElementNames() 
throw(css::uno::RuntimeException, std::exception) override;
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 6b18c2e..d5b623d 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -393,6 +393,11 @@ SwBoxAutoFormat& SwBoxAutoFormat::operator=( const 
SwBoxAutoFormat& rNew )
     return *this;
 }
 
+bool SwBoxAutoFormat::operator==(const SwBoxAutoFormat& rRight)
+{
+    return GetBackground().GetColor() == rRight.GetBackground().GetColor();
+}
+
 #define READ( aItem, aItemType, nVers )\
     pNew = aItem.Create(rStream, nVers ); \
     aItem = *static_cast<aItemType*>(pNew); \
@@ -923,6 +928,24 @@ void SwTableAutoFormat::StoreTableProperties(const SwTable 
&table)
     m_aShadow = static_cast<const SvxShadowItem&>(rSet.Get(RES_SHADOW));
 }
 
+bool SwTableAutoFormat::FirstRowEndColumnIsRow()
+{
+    return *aBoxAutoFormat[3] == *aBoxAutoFormat[2];
+}
+
+bool SwTableAutoFormat::FirstRowStartColumnIsRow()
+{
+    return *aBoxAutoFormat[0] == *aBoxAutoFormat[1];
+}
+bool SwTableAutoFormat::LastRowEndColumnIsRow()
+{
+    return *aBoxAutoFormat[15] == *aBoxAutoFormat[14];
+}
+bool SwTableAutoFormat::LastRowStartColumnIsRow()
+{
+    return *aBoxAutoFormat[12] == *aBoxAutoFormat[13];
+}
+
 bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions 
)
 {
     sal_uInt16  nVal = 0;
diff --git a/sw/source/core/unocore/unomap.cxx 
b/sw/source/core/unocore/unomap.cxx
index e120b7f..70594f4 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1492,6 +1492,10 @@ const SfxItemPropertyMapEntry* 
SwUnoPropertyMapProvider::GetPropertyMapEntries(s
             {
                 static SfxItemPropertyMapEntry const aTableStyleMap[] =
                 {
+                    { OUString(UNO_NAME_TABLE_FIRST_ROW_END_COLUMN),   0, 
cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0 },
+                    { OUString(UNO_NAME_TABLE_FIRST_ROW_START_COLUMN), 0, 
cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0 },
+                    { OUString(UNO_NAME_TABLE_LAST_ROW_END_COLUMN),    0, 
cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0 },
+                    { OUString(UNO_NAME_TABLE_LAST_ROW_START_COLUMN),  0, 
cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0 },
                     { OUString(), 0, css::uno::Type(), 0, 0 }
                 };
                 m_aMapEntriesArr[nPropertyId] = aTableStyleMap;
diff --git a/sw/source/core/unocore/unostyle.cxx 
b/sw/source/core/unocore/unostyle.cxx
index ab000ae..44133af 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -4480,6 +4480,60 @@ void SAL_CALL SwXTextTableStyle::setName(const OUString& 
rName) throw(uno::Runti
     m_sTableAutoFormatName = rName;
 }
 
+//XPropertySet
+css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL 
SwXTextTableStyle::getPropertySetInfo() throw(css::uno::RuntimeException, 
std::exception)
+{
+    static uno::Reference<beans::XPropertySetInfo> 
xRef(aSwMapProvider.GetPropertySet(PROPERTY_MAP_TABLE_STYLE)->getPropertySetInfo());
+    return xRef;
+}
+
+void SAL_CALL SwXTextTableStyle::setPropertyValue(const OUString& 
/*rPropertyName*/, const css::uno::Any& /*aValue*/) 
throw(css::beans::UnknownPropertyException, css::beans::PropertyVetoException, 
css::lang::IllegalArgumentException, css::lang::WrappedTargetException, 
css::uno::RuntimeException, std::exception)
+{
+    SAL_WARN("sw.uno", "not implemented");
+}
+
+css::uno::Any SAL_CALL SwXTextTableStyle::getPropertyValue(const OUString& 
rPropertyName) throw(css::beans::UnknownPropertyException, 
css::lang::WrappedTargetException, css::uno::RuntimeException, std::exception)
+{
+    SolarMutexGuard aGuard;
+    bool bIsRow = false;
+    SwTableAutoFormat* pFormat = GetTableAutoFormat();
+    if (pFormat)
+    {
+        if (rPropertyName == UNO_NAME_TABLE_FIRST_ROW_END_COLUMN)
+            bIsRow = pFormat->FirstRowEndColumnIsRow();
+        else if (rPropertyName == UNO_NAME_TABLE_FIRST_ROW_START_COLUMN)
+            bIsRow = pFormat->FirstRowStartColumnIsRow();
+        else if (rPropertyName == UNO_NAME_TABLE_LAST_ROW_END_COLUMN)
+            bIsRow = pFormat->LastRowEndColumnIsRow();
+        else if (rPropertyName == UNO_NAME_TABLE_LAST_ROW_START_COLUMN)
+            bIsRow = pFormat->LastRowStartColumnIsRow();
+        else
+            throw css::beans::UnknownPropertyException();
+    }
+
+    return uno::makeAny(bIsRow ? OUString("row") : OUString("column"));
+}
+
+void SAL_CALL SwXTextTableStyle::addPropertyChangeListener( const OUString& 
/*aPropertyName*/, const css::uno::Reference< 
css::beans::XPropertyChangeListener >& /*xListener*/ ) 
throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, 
css::uno::RuntimeException, std::exception)
+{
+    SAL_WARN("sw.uno", "not implemented");
+}
+
+void SAL_CALL SwXTextTableStyle::removePropertyChangeListener( const OUString& 
/*aPropertyName*/, const css::uno::Reference< 
css::beans::XPropertyChangeListener >& /*aListener*/ ) 
throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, 
css::uno::RuntimeException, std::exception)
+{
+    SAL_WARN("sw.uno", "not implemented");
+}
+
+void SAL_CALL SwXTextTableStyle::addVetoableChangeListener( const OUString& 
/*PropertyName*/, const css::uno::Reference< 
css::beans::XVetoableChangeListener >& /*aListener*/ ) 
throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, 
css::uno::RuntimeException, std::exception)
+{
+    SAL_WARN("sw.uno", "not implemented");
+}
+
+void SAL_CALL SwXTextTableStyle::removeVetoableChangeListener( const OUString& 
/*PropertyName*/, const css::uno::Reference< 
css::beans::XVetoableChangeListener >& /*aListener*/ ) 
throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, 
css::uno::RuntimeException, std::exception)
+{
+    SAL_WARN("sw.uno", "not implemented");
+}
+
 //XNameAccess
 uno::Any SAL_CALL SwXTextTableStyle::getByName(const OUString& rName) 
throw(container::NoSuchElementException, lang::WrappedTargetException, 
css::uno::RuntimeException, std::exception)
 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to