[Libreoffice-commits] core.git: 4 commits - sw/inc sw/qa sw/source writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Fri Nov 8 05:23:33 PST 2013
sw/inc/numrule.hxx | 4 +
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 3 +
sw/source/core/doc/number.cxx | 20 ++++++++
sw/source/core/unocore/unomap.cxx | 1
sw/source/filter/ww8/docxattributeoutput.cxx | 57 +++++++++++++-----------
sw/source/filter/ww8/wrtw8sty.cxx | 7 ++
sw/source/filter/ww8/wrtww8.hxx | 2
sw/source/ui/app/docstyle.cxx | 17 +++++++
writerfilter/source/dmapper/StyleSheetTable.cxx | 12 +----
9 files changed, 88 insertions(+), 35 deletions(-)
New commits:
commit 961e319da7e8aa16b64ceee421e896802cbb82c1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Nov 8 13:46:33 2013 +0100
DOCX filter: handle numbering style's qFormat, rsid and friends
Change-Id: Ia261995b98e2108ab673c7b240a1aa822d3db96e
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index c6af87d..ecbabb4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1314,6 +1314,9 @@ DECLARE_OOXML_TEST(testStyleInheritance, "style-inheritance.docx")
// Additional char style properties should be also roundtripped.
assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='DefaultParagraphFont']", "default", "1");
+
+ // Finally check the same for numbering styles.
+ assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='NoList']", "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 eaae878..2ff5e61 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3596,36 +3596,41 @@ 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();
+ uno::Any aAny;
if (eType == STYLE_TYPE_PARA || eType == STYLE_TYPE_CHAR)
{
const SwFmt* pFmt = m_rExport.pStyles->GetSwFmt(nId);
- uno::Any aAny;
pFmt->GetGrabBagItem(aAny);
- const uno::Sequence<beans::PropertyValue>& rGrabBag = aAny.get< uno::Sequence<beans::PropertyValue> >();
-
- for (sal_Int32 i = 0; i < rGrabBag.getLength(); ++i)
- {
- if (rGrabBag[i].Name == "uiPriority")
- aUiPriority = rGrabBag[i].Value.get<OUString>();
- else if (rGrabBag[i].Name == "qFormat")
- bQFormat = true;
- else if (rGrabBag[i].Name == "link")
- aLink = rGrabBag[i].Value.get<OUString>();
- else if (rGrabBag[i].Name == "rsid")
- aRsid = rGrabBag[i].Value.get<OUString>();
- else if (rGrabBag[i].Name == "unhideWhenUsed")
- bUnhideWhenUsed = true;
- else if (rGrabBag[i].Name == "semiHidden")
- bSemiHidden = true;
- else if (rGrabBag[i].Name == "locked")
- bLocked = true;
- else if (rGrabBag[i].Name == "default")
- bDefault = rGrabBag[i].Value.get<sal_Bool>();
- else if (rGrabBag[i].Name == "customStyle")
- bCustomStyle = rGrabBag[i].Value.get<sal_Bool>();
- else
- SAL_WARN("sw.ww8", "Unhandled style property: " << rGrabBag[i].Name);
- }
+ }
+ else
+ {
+ const SwNumRule* pRule = m_rExport.pStyles->GetSwNumRule(nId);
+ pRule->GetGrabBagItem(aAny);
+ }
+ const uno::Sequence<beans::PropertyValue>& rGrabBag = aAny.get< uno::Sequence<beans::PropertyValue> >();
+
+ for (sal_Int32 i = 0; i < rGrabBag.getLength(); ++i)
+ {
+ if (rGrabBag[i].Name == "uiPriority")
+ aUiPriority = rGrabBag[i].Value.get<OUString>();
+ else if (rGrabBag[i].Name == "qFormat")
+ bQFormat = true;
+ else if (rGrabBag[i].Name == "link")
+ aLink = rGrabBag[i].Value.get<OUString>();
+ else if (rGrabBag[i].Name == "rsid")
+ aRsid = rGrabBag[i].Value.get<OUString>();
+ else if (rGrabBag[i].Name == "unhideWhenUsed")
+ bUnhideWhenUsed = true;
+ else if (rGrabBag[i].Name == "semiHidden")
+ bSemiHidden = true;
+ else if (rGrabBag[i].Name == "locked")
+ bLocked = true;
+ else if (rGrabBag[i].Name == "default")
+ bDefault = rGrabBag[i].Value.get<sal_Bool>();
+ else if (rGrabBag[i].Name == "customStyle")
+ bCustomStyle = rGrabBag[i].Value.get<sal_Bool>();
+ else
+ SAL_WARN("sw.ww8", "Unhandled style property: " << rGrabBag[i].Name);
}
const char* pType = 0;
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 57c2c98..941ab3e 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -400,12 +400,6 @@ 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");
@@ -491,7 +485,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(lcl_wantGrabBag(m_pImpl->m_pCurrentEntry->nStyleTypeCode))
+ if (m_pImpl->m_pCurrentEntry->nStyleTypeCode != STYLE_TYPE_UNKNOWN)
{
beans::PropertyValue aValue;
aValue.Name = "default";
@@ -500,7 +494,7 @@ void StyleSheetTable::lcl_attribute(Id Name, Value & val)
}
break;
case NS_ooxml::LN_CT_Style_customStyle:
- if(lcl_wantGrabBag(m_pImpl->m_pCurrentEntry->nStyleTypeCode))
+ if (m_pImpl->m_pCurrentEntry->nStyleTypeCode != STYLE_TYPE_UNKNOWN)
{
beans::PropertyValue aValue;
aValue.Name = "customStyle";
@@ -623,7 +617,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(lcl_wantGrabBag(m_pImpl->m_pCurrentEntry->nStyleTypeCode))
+ if (m_pImpl->m_pCurrentEntry->nStyleTypeCode != STYLE_TYPE_UNKNOWN)
{
StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry;
beans::PropertyValue aValue;
commit d632598049b473a6e06dde853b54cf5206604a9e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Nov 8 14:06:38 2013 +0100
Introduce MSWordStyles::GetSwNumRule()
This is similar to GetSwFmt(), but for list styles.
Change-Id: I5c198c786e0c73c83430bd60b91d0ef85c7a49fc
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 8f1c980..0b55430 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -718,6 +718,13 @@ void MSWordStyles::OutputStylesTable()
m_rExport.bStyDef = false;
}
+const SwNumRule* MSWordStyles::GetSwNumRule(sal_uInt16 nId) const
+{
+ std::map<sal_uInt16, const SwNumRule*>::const_iterator it = m_aNumRules.find(nId);
+ assert(it != m_aNumRules.end());
+ return it->second;
+}
+
//---------------------------------------------------------------------------
// Fonts
//---------------------------------------------------------------------------
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 09db650..91728d8 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1559,6 +1559,8 @@ public:
OString GetStyleId(sal_uInt16 nId) const;
const SwFmt* GetSwFmt(sal_uInt16 nId) const { return pFmtA[nId]; }
+ /// Get numbering rule of the nId-th style
+ const SwNumRule* GetSwNumRule(sal_uInt16 nId) const;
};
sal_Int16 GetWordFirstLineOffset(const SwNumFmt &rFmt);
commit 53163026efa4b402000ac6d22d90a71bff961ece
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Nov 8 11:58:25 2013 +0100
sw: add InteropGrabBag for list styles
Change-Id: I2881a507d71aad10e39272141b5d63c6e39e2cc9
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index 6ddd1d9..e90c345 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -931,6 +931,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_IS_PHYSICAL), FN_UNO_IS_PHYSICAL, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::READONLY, 0},
{ SW_PROP_NMID(UNO_NAME_DISPLAY_NAME), FN_UNO_DISPLAY_NAME, CPPU_E2T(CPPUTYPE_OUSTRING), 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},
{0,0,0,0,0,0}
};
aMapEntriesArr[nPropertyId] = aNumStyleMap;
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 9fc712f..65834bc 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -452,6 +452,16 @@ void SwDocStyleSheet::SetGrabBagItem(const uno::Any& rVal)
bChg = true;
}
break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ SwNumRule* pRule = rDoc.FindNumRulePtr(aName);
+ if (pRule)
+ {
+ pRule->SetGrabBagItem(rVal);
+ bChg = true;
+ }
+ }
+ break;
default:
break;
}
@@ -479,6 +489,13 @@ void SwDocStyleSheet::GetGrabBagItem(uno::Any& rVal) const
pFmt = rDoc.FindTxtFmtCollByName(aName);
pFmt->GetGrabBagItem(rVal);
break;
+ case SFX_STYLE_FAMILY_PSEUDO:
+ {
+ SwNumRule* pRule = rDoc.FindNumRulePtr(aName);
+ if (pRule)
+ pRule->GetGrabBagItem(rVal);
+ }
+ break;
default:
break;
}
commit 605f7c34b8598c6b3a5748d5a5382c07d743706c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Nov 8 11:20:05 2013 +0100
SwNumRule: add getter / setter for InteropGrabBag
Change-Id: I6f76dbfd806139f141c054dccb0884be32511e06
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index 95dfb33..5b71ddd3 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -37,6 +37,7 @@ class IDocumentListsAccess;
class SwNodeNum;
class Font;
class SvxBrushItem;
+class SfxGrabBagItem;
class SvxNumRule;
class SwCharFmt;
class SwDoc;
@@ -141,6 +142,7 @@ private:
const SvxNumberFormat::SvxNumPositionAndSpaceMode meDefaultNumberFormatPositionAndSpaceMode;
OUString msDefaultListId;
+ boost::shared_ptr<SfxGrabBagItem> mpGrabBagItem; ///< Style InteropGrabBag.
public:
/// add parameter <eDefaultNumberFormatPositionAndSpaceMode>
@@ -271,6 +273,8 @@ public:
void Validate();
void dumpAsXml(xmlTextWriterPtr w);
+ void GetGrabBagItem(com::sun::star::uno::Any& rVal) const;
+ void SetGrabBagItem(const com::sun::star::uno::Any& rVal);
};
/// namespace for static functions and methods for numbering and bullets
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index e4f65e3..c3fe902 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -24,6 +24,7 @@
#include <editeng/brushitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/numitem.hxx>
+#include <svl/grabbagitem.hxx>
#include <fmtornt.hxx>
#include <doc.hxx>
#include <pam.hxx>
@@ -1041,6 +1042,25 @@ void SwNumRule::RemoveParagraphStyle( SwTxtFmtColl& rTxtFmtColl )
}
}
+void SwNumRule::GetGrabBagItem(uno::Any& rVal) const
+{
+ if (mpGrabBagItem.get())
+ mpGrabBagItem->QueryValue(rVal);
+ else
+ {
+ uno::Sequence<beans::PropertyValue> aValue(0);
+ rVal = uno::makeAny(aValue);
+ }
+}
+
+void SwNumRule::SetGrabBagItem(const uno::Any& rVal)
+{
+ if (!mpGrabBagItem.get())
+ mpGrabBagItem.reset(new SfxGrabBagItem);
+
+ mpGrabBagItem->PutValue(rVal);
+}
+
namespace numfunc
{
/** class containing default bullet list configuration data */
More information about the Libreoffice-commits
mailing list