[Libreoffice-commits] core.git: 2 commits - sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Nov 8 00:53:38 PST 2013


 sw/qa/extras/ooxmlexport/ooxmlexport.cxx        |    3 +++
 sw/source/core/unocore/unomap.cxx               |    1 +
 sw/source/filter/ww8/docxattributeoutput.cxx    |    2 +-
 sw/source/ui/app/docstyle.cxx                   |   12 ++++++++++++
 writerfilter/source/dmapper/StyleSheetTable.cxx |   12 +++++++++---
 5 files changed, 26 insertions(+), 4 deletions(-)

New commits:
commit 5ecd8a55ee494c1150ec552a9002c6991371437c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 8 09:47:50 2013 +0100

    DOCX filter: handle char style's qFormat, rsid and friends
    
    Change-Id: Ie0bc9aff722d87fcd246d0cf1971ad6f34f0996a

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d431a60..c6af87d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1311,6 +1311,9 @@ DECLARE_OOXML_TEST(testStyleInheritance, "style-inheritance.docx")
 
     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading11']", "customStyle", "1");
     assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Heading11']/w:autoRedefine", 1);
+
+    // Additional char style properties should be also roundtripped.
+    assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='DefaultParagraphFont']", "default", "1");
 }
 
 DECLARE_OOXML_TEST(testCalendar1, "calendar1.docx")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4ca41e4..eaae878 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3596,7 +3596,7 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType,
     bool bQFormat = false, bUnhideWhenUsed = false, bSemiHidden = false, bLocked = false, bDefault = false, bCustomStyle = false;
     OUString aLink, aRsid, aUiPriority;
     FastAttributeList* pStyleAttributeList = m_pSerializer->createAttrList();
-    if (eType == STYLE_TYPE_PARA)
+    if (eType == STYLE_TYPE_PARA || eType == STYLE_TYPE_CHAR)
     {
         const SwFmt* pFmt = m_rExport.pStyles->GetSwFmt(nId);
         uno::Any aAny;
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index b34273a..57c2c98 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -400,6 +400,12 @@ PropertyMapPtr StyleSheetTable::GetDefaultCharProps()
     return m_pImpl->m_pDefaultCharProps;
 }
 
+// Does the given style type support InteropGrabBag?
+bool lcl_wantGrabBag(StyleType eType)
+{
+    return eType == STYLE_TYPE_TABLE || eType == STYLE_TYPE_PARA || eType == STYLE_TYPE_CHAR;
+}
+
 void StyleSheetTable::lcl_attribute(Id Name, Value & val)
 {
     OSL_ENSURE( m_pImpl->m_pCurrentEntry, "current entry has to be set here");
@@ -485,7 +491,7 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
         break;
         case NS_ooxml::LN_CT_Style_default:
             m_pImpl->m_pCurrentEntry->bIsDefaultStyle = (nIntValue != 0);
-            if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE || m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_PARA)
+            if(lcl_wantGrabBag(m_pImpl->m_pCurrentEntry->nStyleTypeCode))
             {
                 beans::PropertyValue aValue;
                 aValue.Name = "default";
@@ -494,7 +500,7 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
             }
         break;
         case NS_ooxml::LN_CT_Style_customStyle:
-            if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE || m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_PARA)
+            if(lcl_wantGrabBag(m_pImpl->m_pCurrentEntry->nStyleTypeCode))
             {
                 beans::PropertyValue aValue;
                 aValue.Name = "customStyle";
@@ -617,7 +623,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm)
         case NS_ooxml::LN_CT_Style_uiPriority:
         case NS_ooxml::LN_CT_Style_link:
         case NS_ooxml::LN_CT_Style_locked:
-            if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE || m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_PARA)
+            if(lcl_wantGrabBag(m_pImpl->m_pCurrentEntry->nStyleTypeCode))
             {
                 StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
                 beans::PropertyValue aValue;
commit cad4afbd1444fe410aef014b01008b03ed4ecbf5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 8 09:44:07 2013 +0100

    sw: add InteropGrabBag for character styles
    
    offapi already documented this, but marked as optional, and previously
    only paragraph styles implemented it. Do the same for character styles.
    
    Change-Id: I3e331eb43f325ac8963984b2460db53f1be497a6

diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index f2fb41c..6ddd1d9 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -590,6 +590,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
                     { SW_PROP_NMID(UNO_NAME_USER_DEFINED_ATTRIBUTES), RES_UNKNOWNATR_CONTAINER, CPPU_E2T(CPPUTYPE_REFNAMECNT), PropertyAttribute::MAYBEVOID, 0 },
                     { SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL,     CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
                     { SW_PROP_NMID(UNO_NAME_HIDDEN), FN_UNO_HIDDEN,     CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 0},
+                    { SW_PROP_NMID(UNO_NAME_STYLE_INTEROP_GRAB_BAG), FN_UNO_STYLE_INTEROP_GRAB_BAG, CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PROPERTY_NONE, 0},
                     { SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::READONLY, 0},
                     { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_IS_ON), RES_CHRATR_TWO_LINES,          CPPU_E2T(CPPUTYPE_BOOLEAN),     PROPERTY_NONE, MID_TWOLINES},
                     { SW_PROP_NMID(UNO_NAME_CHAR_COMBINE_PREFIX), RES_CHRATR_TWO_LINES,             CPPU_E2T(CPPUTYPE_OUSTRING),    PROPERTY_NONE, MID_START_BRACKET},
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 8e3736d..9fc712f 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -436,6 +436,14 @@ void SwDocStyleSheet::SetGrabBagItem(const uno::Any& rVal)
     SwFmt* pFmt = 0;
     switch (nFamily)
     {
+        case SFX_STYLE_FAMILY_CHAR:
+            pFmt = rDoc.FindCharFmtByName(aName);
+            if (pFmt)
+            {
+                pFmt->SetGrabBagItem(rVal);
+                bChg = true;
+            }
+            break;
         case SFX_STYLE_FAMILY_PARA:
             pFmt = rDoc.FindTxtFmtCollByName(aName);
             if (pFmt)
@@ -463,6 +471,10 @@ void SwDocStyleSheet::GetGrabBagItem(uno::Any& rVal) const
     SwFmt* pFmt = 0;
     switch (nFamily)
     {
+        case SFX_STYLE_FAMILY_CHAR:
+            pFmt = rDoc.FindCharFmtByName(aName);
+            pFmt->GetGrabBagItem(rVal);
+            break;
         case SFX_STYLE_FAMILY_PARA:
             pFmt = rDoc.FindTxtFmtCollByName(aName);
             pFmt->GetGrabBagItem(rVal);


More information about the Libreoffice-commits mailing list