[Libreoffice-commits] .: Branch 'libreoffice-3-6' - 3 commits - sw/source writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri Jun 15 01:08:41 PDT 2012


 sw/source/filter/ww8/wrtw8esh.cxx             |   42 ++++++++++++++++++++++++--
 writerfilter/source/dmapper/FFDataHandler.cxx |   17 ++++++++--
 writerfilter/source/dmapper/FFDataHandler.hxx |    5 +--
 3 files changed, 56 insertions(+), 8 deletions(-)

New commits:
commit 6dca552c3888eb51151bf6aa289b691785da3fa9
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jun 15 08:49:46 2012 +0100

    n#325936 fix ww8 export of fly frames with transparent background in headers
    
    Regression from commit ed8b5f2d -- to be safe, reverted only for fly
    frames in headers.
    
    Change-Id: Ia538b69bb913567c7d087d40afc7f0a141b7a0ed

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index e47d881..d4d7801 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -77,6 +77,7 @@
 #include <frmfmt.hxx>
 #include <flyfrm.hxx>
 #include <pagefrm.hxx>
+#include <frmatr.hxx>
 #include <fmtcntnt.hxx>
 #include <ndindex.hxx>
 #include <doc.hxx>
@@ -1763,16 +1764,24 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt,
         rPropOpt.AddOpt( ESCHER_Prop_dxTextRight, 0 );
     }
 
-    SvxBrushItem aBrush(rWrt.TrueFrameBgBrush(rFmt));
-    WriteBrushAttr(aBrush, rPropOpt);
-
-    const SdrObject* pObj = rFmt.FindRealSdrObject();
-
     // SwWW8ImplReader::Read_GrafLayer() imports these as opaque
     // unconditionally, so if both are true, don't export the property.
     bool bIsInHeader = lcl_isInHeader(rFmt);
     bool bIsThrought = rFmt.GetSurround().GetValue() == SURROUND_THROUGHT;
 
+    if (bIsInHeader)
+    {
+        const SvxBrushItem& rBrush(rFmt.GetBackground());
+        WriteBrushAttr(rBrush, rPropOpt);
+    }
+    else
+    {
+        SvxBrushItem aBrush(rWrt.TrueFrameBgBrush(rFmt));
+        WriteBrushAttr(aBrush, rPropOpt);
+    }
+
+    const SdrObject* pObj = rFmt.FindRealSdrObject();
+
     if( pObj && (pObj->GetLayer() == GetHellLayerId() ||
         pObj->GetLayer() == GetInvisibleHellId() ) && !(bIsInHeader && bIsThrought))
     {
commit f258f89a96ff6521ae75ae67a0cef9b29f01434d
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jun 14 13:30:57 2012 +0200

    n#325936 fix ww8 export of not-in-background anchored images in header
    
    Regression from commit 2ad707b3, which only updated the import, but
    forgot to remove the fake "in background" property on export.
    
    Change-Id: I2b42c5fa7873d946b10d311800049586bc214071

diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 477eaa4..e47d881 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -75,6 +75,8 @@
 #include <fmtfollowtextflow.hxx> // #i30669#
 #include <dcontact.hxx>
 #include <frmfmt.hxx>
+#include <flyfrm.hxx>
+#include <pagefrm.hxx>
 #include <fmtcntnt.hxx>
 #include <ndindex.hxx>
 #include <doc.hxx>
@@ -1656,6 +1658,25 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem &rBrush,
     }
 }
 
+bool lcl_isInHeader(const SwFrmFmt& rFmt)
+{
+    const SwFlyFrmFmt* pFlyFrmFmt = dynamic_cast<const SwFlyFrmFmt*>(&rFmt);
+    SwFlyFrm* pFlyFrm = const_cast<SwFlyFrm*>(pFlyFrmFmt->GetFrm());
+    SwPageFrm* pPageFrm = pFlyFrm->FindPageFrmOfAnchor();
+    SwFrm* pHeader = pPageFrm->Lower();
+    if (pHeader->GetType() == FRM_HEADER)
+    {
+        const SwFrm* pFrm = pFlyFrm->GetAnchorFrm();
+        while (pFrm)
+        {
+            if (pFrm == pHeader)
+                return true;
+            pFrm = pFrm->GetUpper();
+        }
+    }
+    return false;
+}
+
 sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt,
     MSO_SPT eShapeType, EscherPropertyContainer& rPropOpt)
 {
@@ -1746,8 +1767,14 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt,
     WriteBrushAttr(aBrush, rPropOpt);
 
     const SdrObject* pObj = rFmt.FindRealSdrObject();
+
+    // SwWW8ImplReader::Read_GrafLayer() imports these as opaque
+    // unconditionally, so if both are true, don't export the property.
+    bool bIsInHeader = lcl_isInHeader(rFmt);
+    bool bIsThrought = rFmt.GetSurround().GetValue() == SURROUND_THROUGHT;
+
     if( pObj && (pObj->GetLayer() == GetHellLayerId() ||
-        pObj->GetLayer() == GetInvisibleHellId() ))
+        pObj->GetLayer() == GetInvisibleHellId() ) && !(bIsInHeader && bIsThrought))
     {
         rPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x200020 );
     }
commit f0bd2e796de731fd5172171acc0e68e4fd559be3
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jun 12 16:50:56 2012 +0200

    n#766477 dmapper: import NS_ooxml::LN_CT_FFCheckBox_default
    
    Change-Id: If7edb301fa90a49d79fc5322a7c19ee2591f5494

diff --git a/writerfilter/source/dmapper/FFDataHandler.cxx b/writerfilter/source/dmapper/FFDataHandler.cxx
index 4dac6f4..2a9d97b 100644
--- a/writerfilter/source/dmapper/FFDataHandler.cxx
+++ b/writerfilter/source/dmapper/FFDataHandler.cxx
@@ -41,7 +41,8 @@ FFDataHandler::FFDataHandler() :
 LoggedProperties(dmapper_logger, "FFDataHandler"),
 m_nCheckboxHeight(0),
 m_bCheckboxAutoHeight(false),
-m_bCheckboxChecked(false)
+m_nCheckboxChecked(-1),
+m_nCheckboxDefault(-1)
 {
 }
 
@@ -77,7 +78,12 @@ bool FFDataHandler::getCheckboxAutoHeight() const
 
 bool FFDataHandler::getCheckboxChecked() const
 {
-    return m_bCheckboxChecked;
+    if (m_nCheckboxChecked != -1)
+        return m_nCheckboxChecked;
+    else if (m_nCheckboxDefault != -1)
+        return m_nCheckboxDefault;
+    else
+        return false;
 }
 
 const rtl::OUString & FFDataHandler::getDropDownResult() const
@@ -126,7 +132,12 @@ void FFDataHandler::lcl_sprm(Sprm & r_Sprm)
         break;
     case NS_ooxml::LN_CT_FFCheckBox_checked:
         {
-            m_bCheckboxChecked = r_Sprm.getValue()->getInt();
+            m_nCheckboxChecked = r_Sprm.getValue()->getInt();
+        }
+        break;
+    case NS_ooxml::LN_CT_FFCheckBox_default:
+        {
+            m_nCheckboxDefault = r_Sprm.getValue()->getInt();
         }
         break;
     case NS_ooxml::LN_CT_FFData_checkBox:
diff --git a/writerfilter/source/dmapper/FFDataHandler.hxx b/writerfilter/source/dmapper/FFDataHandler.hxx
index 5a192ab..b9d538c 100644
--- a/writerfilter/source/dmapper/FFDataHandler.hxx
+++ b/writerfilter/source/dmapper/FFDataHandler.hxx
@@ -58,7 +58,7 @@ public:
     // member: checkboxAutoHeight
     bool getCheckboxAutoHeight() const;
 
-    // member: checkboxChecked
+    // member: checkboxChecked or checkboxDefault (if the previous is not set)
     bool getCheckboxChecked() const;
 
     // member: dropDownResult
@@ -79,7 +79,8 @@ private:
     rtl::OUString m_sStatusText;
     sal_uInt32 m_nCheckboxHeight;
     bool m_bCheckboxAutoHeight;
-    bool m_bCheckboxChecked;
+    int m_nCheckboxChecked;
+    int m_nCheckboxDefault;
     rtl::OUString m_sDropDownResult;
     DropDownEntries_t m_DropDownEntries;
     rtl::OUString m_sTextDefault;


More information about the Libreoffice-commits mailing list