offapi/com/sun/star/style/Style.idl | 10 +++++ sw/inc/cmdid.h | 1 sw/inc/docstyle.hxx | 2 + sw/inc/format.hxx | 6 +++ sw/inc/unoprnms.hxx | 1 sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 5 ++ sw/source/core/attr/format.cxx | 23 ++++++++++++ sw/source/core/unocore/unomap.cxx | 3 + sw/source/core/unocore/unoprnms.cxx | 1 sw/source/core/unocore/unostyle.cxx | 15 +++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 37 +++++++++++++++++++ sw/source/filter/ww8/docxtablestyleexport.cxx | 23 +++--------- sw/source/filter/ww8/wrtww8.hxx | 2 - sw/source/filter/ww8/ww8atr.cxx | 2 - sw/source/ui/app/docstyle.cxx | 46 ++++++++++++++++++++++++ writerfilter/source/dmapper/StyleSheetTable.cxx | 40 +++++++++++++++----- writerfilter/source/dmapper/StyleSheetTable.hxx | 11 +++-- 17 files changed, 194 insertions(+), 34 deletions(-)
New commits: commit eb3942a24918e9537c85cc79a405fff8c167d456 Author: Miklos Vajna <[email protected]> Date: Wed Nov 6 15:11:05 2013 +0100 DOCX export of para style's qFormat, rsid and friends Change-Id: I4ed35f2b497fec96d012303001d4861768daef6a diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 6aeae7b..1355f51 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -1299,6 +1299,11 @@ DECLARE_OOXML_TEST(testStyleInheritance, "style-inheritance.docx") assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:tblPr/w:tblCellMar/w:left", "w", "108"); assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:semiHidden", 1); assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='TableNormal']/w:unhideWhenUsed", 1); + + // Additional para style properties should be also roundtripped. + assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='ListParagraph']/w:uiPriority", "val", "34"); + assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:qFormat", 1); + assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:rsid", "val", "00780346"); } DECLARE_OOXML_TEST(testCalendar1, "calendar1.docx") diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 755f606..8f5859f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3609,6 +3609,43 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType, FSNS( XML_w, XML_val ), OUStringToOString( OUString( rName ), RTL_TEXTENCODING_UTF8 ).getStr(), FSEND ); + if (eType == STYLE_TYPE_PARA) + { + 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> >(); + + bool bQFormat = false, bUnhideWhenUsed = false; + OUString aRsid, aUiPriority; + 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 == "rsid") + aRsid = rGrabBag[i].Value.get<OUString>(); + else if (rGrabBag[i].Name == "unhideWhenUsed") + bUnhideWhenUsed = true; + else + SAL_WARN("sw.ww8", "Unhandled style property: " << rGrabBag[i].Name); + } + + if (!aUiPriority.isEmpty()) + m_pSerializer->singleElementNS(XML_w, XML_uiPriority, + FSNS(XML_w, XML_val), OUStringToOString(aUiPriority, RTL_TEXTENCODING_UTF8).getStr(), + FSEND); + if (bQFormat) + m_pSerializer->singleElementNS(XML_w, XML_qFormat, FSEND); + if (bUnhideWhenUsed) + m_pSerializer->singleElementNS(XML_w, XML_unhideWhenUsed, FSEND); + if (!aRsid.isEmpty()) + m_pSerializer->singleElementNS(XML_w, XML_rsid, + FSNS(XML_w, XML_val), OUStringToOString(aRsid, RTL_TEXTENCODING_UTF8).getStr(), + FSEND); + } + if ( nBase != 0x0FFF && eType != STYLE_TYPE_LIST) { m_pSerializer->singleElementNS( XML_w, XML_basedOn, diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx index 61eea42..3fc7246 100644 --- a/sw/source/filter/ww8/docxtablestyleexport.cxx +++ b/sw/source/filter/ww8/docxtablestyleexport.cxx @@ -14,7 +14,6 @@ #include <oox/token/tokens.hxx> #include <comphelper/sequenceashashmap.hxx> -#include <comphelper/string.hxx> #include <rtl/strbuf.hxx> #include <com/sun/star/beans/PropertyValue.hpp> @@ -538,8 +537,7 @@ void DocxTableStyleExport::Impl::tableStyleTblStylePr(uno::Sequence<beans::Prope void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>& rStyle) { bool bDefault = false, bCustomStyle = false, bQFormat = false, bSemiHidden = false, bUnhideWhenUsed = false; - OUString aStyleId, aName, aBasedOn; - sal_Int32 nUiPriority = 0, nRsid = 0; + OUString aStyleId, aName, aBasedOn, aRsid, aUiPriority; uno::Sequence<beans::PropertyValue> aPPr, aRPr, aTblPr, aTcPr; std::vector< uno::Sequence<beans::PropertyValue> > aTblStylePrs; for (sal_Int32 i = 0; i < rStyle.getLength(); ++i) @@ -555,7 +553,7 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>& else if (rStyle[i].Name == "basedOn") aBasedOn = rStyle[i].Value.get<OUString>(); else if (rStyle[i].Name == "uiPriority") - nUiPriority = rStyle[i].Value.get<sal_Int32>(); + aUiPriority = rStyle[i].Value.get<OUString>(); else if (rStyle[i].Name == "qFormat") bQFormat = true; else if (rStyle[i].Name == "semiHidden") @@ -563,7 +561,7 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>& else if (rStyle[i].Name == "unhideWhenUsed") bUnhideWhenUsed = true; else if (rStyle[i].Name == "rsid") - nRsid = rStyle[i].Value.get<sal_Int32>(); + aRsid = rStyle[i].Value.get<OUString>(); else if (rStyle[i].Name == "pPr") aPPr = rStyle[i].Value.get< uno::Sequence<beans::PropertyValue> >(); else if (rStyle[i].Name == "rPr") @@ -594,9 +592,9 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>& m_pSerializer->singleElementNS(XML_w, XML_basedOn, FSNS(XML_w, XML_val), OUStringToOString(aBasedOn, RTL_TEXTENCODING_UTF8).getStr(), FSEND); - if (nUiPriority) + if (!aUiPriority.isEmpty()) m_pSerializer->singleElementNS(XML_w, XML_uiPriority, - FSNS(XML_w, XML_val), OString::number(nUiPriority), + FSNS(XML_w, XML_val), OUStringToOString(aUiPriority, RTL_TEXTENCODING_UTF8).getStr(), FSEND); if (bQFormat) m_pSerializer->singleElementNS(XML_w, XML_qFormat, FSEND); @@ -604,17 +602,10 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>& m_pSerializer->singleElementNS(XML_w, XML_semiHidden, FSEND); if (bUnhideWhenUsed) m_pSerializer->singleElementNS(XML_w, XML_unhideWhenUsed, FSEND); - if (nRsid) - { - // We want the rsid as a hex string, but always with the length of 8. - OStringBuffer aBuf = OString::number(nRsid, 16); - OStringBuffer aStr; - comphelper::string::padToLength(aStr, 8 - aBuf.getLength(), '0'); - aStr.append(aBuf.getStr()); + if (!aRsid.isEmpty()) m_pSerializer->singleElementNS(XML_w, XML_rsid, - FSNS(XML_w, XML_val), aStr.getStr(), + FSNS(XML_w, XML_val), OUStringToOString(aRsid, RTL_TEXTENCODING_UTF8).getStr(), FSEND); - } tableStylePPr(aPPr); tableStyleRPr(aRPr); diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index b60e667..85626e1 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -41,6 +41,7 @@ #include <map> #include <stdio.h> #include <rtl/ustrbuf.hxx> +#include <comphelper/string.hxx> #include <dmapperLoggers.hxx> @@ -621,8 +622,14 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) beans::PropertyValue aValue; if (nSprmId == NS_ooxml::LN_CT_Style_rsid) { + // We want the rsid as a hex string, but always with the length of 8. + OUStringBuffer aBuf = OUString::number(nIntValue, 16); + OUStringBuffer aStr; + comphelper::string::padToLength(aStr, 8 - aBuf.getLength(), '0'); + aStr.append(aBuf.getStr()); + aValue.Name = "rsid"; - aValue.Value = uno::makeAny(nIntValue); + aValue.Value = uno::makeAny(aStr.makeStringAndClear()); } else if (nSprmId == NS_ooxml::LN_CT_Style_qFormat) aValue.Name = "qFormat"; @@ -633,7 +640,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) else { aValue.Name = "uiPriority"; - aValue.Value = uno::makeAny(nIntValue); + aValue.Value = uno::makeAny(OUString::number(nIntValue)); } pEntry->AppendInteropGrabBag(aValue); } commit e2790597d9cd534321bf95cb72dcad13e405cc47 Author: Miklos Vajna <[email protected]> Date: Wed Nov 6 15:56:46 2013 +0100 MSWordStyles::GetSwFmt: be explicit about what format to return Change-Id: Ib8afdc757c30ca1571d8d7ec7145b749952edbca diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 5944cfe..09db650 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1558,7 +1558,7 @@ public: /// Get styleId of the nId-th style (nId is its position in pFmtA). OString GetStyleId(sal_uInt16 nId) const; - const SwFmt* GetSwFmt() const { return (*pFmtA); } + const SwFmt* GetSwFmt(sal_uInt16 nId) const { return pFmtA[nId]; } }; sal_Int16 GetWordFirstLineOffset(const SwNumFmt &rFmt); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 56d32c2..b0630a8 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3665,7 +3665,7 @@ void WW8AttributeOutput::SectionBreak( sal_uInt8 nC, const WW8_SepInfo* /*pSecti sal_uInt32 AttributeOutputBase::GridCharacterPitch( const SwTextGridItem& rGrid ) const { MSWordStyles * pStyles = GetExport().pStyles; - const SwFmt * pSwFmt = pStyles->GetSwFmt(); + const SwFmt * pSwFmt = pStyles->GetSwFmt(0); sal_uInt32 nPageCharSize = 0; commit 3ebfef72037f9b4e33e9ca77fae0d03706ef5d83 Author: Miklos Vajna <[email protected]> Date: Wed Nov 6 14:55:31 2013 +0100 DOCX import of para style's qFormat, rsid and friends Load these into the new style-level InteropGrabBag. Change-Id: I89b138c334dd3de36b97ef103d5483ca141a6585 diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 28e1510..b60e667 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -173,16 +173,22 @@ PropertyMapPtr TableStyleSheetEntry::GetProperties( sal_Int32 nMask, StyleSheetE return pProps; } -beans::PropertyValue StyleSheetEntry::GetInteropGrabBag() +beans::PropertyValues StyleSheetEntry::GetInteropGrabBagSeq() { - beans::PropertyValue aRet; - aRet.Name = sStyleIdentifierI; - uno::Sequence<beans::PropertyValue> aSeq(m_aInteropGrabBag.size()); beans::PropertyValue* pSeq = aSeq.getArray(); for (std::vector<beans::PropertyValue>::iterator i = m_aInteropGrabBag.begin(); i != m_aInteropGrabBag.end(); ++i) *pSeq++ = *i; + return aSeq; +} + +beans::PropertyValue StyleSheetEntry::GetInteropGrabBag() +{ + beans::PropertyValue aRet; + aRet.Name = sStyleIdentifierI; + + beans::PropertyValues aSeq = GetInteropGrabBagSeq();; aRet.Value = uno::makeAny(aSeq); return aRet; } @@ -609,9 +615,9 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) case NS_ooxml::LN_CT_Style_semiHidden: case NS_ooxml::LN_CT_Style_unhideWhenUsed: case NS_ooxml::LN_CT_Style_uiPriority: - if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE) + if(m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_TABLE || m_pImpl->m_pCurrentEntry->nStyleTypeCode == STYLE_TYPE_PARA) { - TableStyleSheetEntry* pTableEntry = static_cast<TableStyleSheetEntry *>(m_pImpl->m_pCurrentEntry.get()); + StyleSheetEntryPtr pEntry = m_pImpl->m_pCurrentEntry; beans::PropertyValue aValue; if (nSprmId == NS_ooxml::LN_CT_Style_rsid) { @@ -629,7 +635,7 @@ void StyleSheetTable::lcl_sprm(Sprm & rSprm) aValue.Name = "uiPriority"; aValue.Value = uno::makeAny(nIntValue); } - pTableEntry->AppendInteropGrabBag(aValue); + pEntry->AppendInteropGrabBag(aValue); } break; case NS_ooxml::LN_CT_Style_tblPr: //contains table properties @@ -1166,6 +1172,13 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable ) { xStyles->insertByName( sConvertedStyleName, uno::makeAny( xStyle) ); } + + beans::PropertyValues aGrabBag = pEntry->GetInteropGrabBagSeq(); + if (aGrabBag.hasElements()) + { + uno::Reference<beans::XPropertySet> xPropertySet(xStyle, uno::UNO_QUERY); + xPropertySet->setPropertyValue("StyleInteropGrabBag", uno::makeAny(aGrabBag)); + } } else if(pEntry->nStyleTypeCode == STYLE_TYPE_TABLE) { diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx index db9be28..25c3065 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.hxx +++ b/writerfilter/source/dmapper/StyleSheetTable.hxx @@ -24,6 +24,7 @@ #include <WriterFilterDllApi.hxx> #include <dmapper/DomainMapper.hxx> #include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/beans/PropertyValues.hpp> #include <PropertyMap.hxx> #include <FontTable.hxx> #include <resourcemodel/LoggedResources.hxx> @@ -68,7 +69,8 @@ public: std::vector<beans::PropertyValue> aLsdExceptions; ///< List of lsdException attribute lists void AppendInteropGrabBag(beans::PropertyValue aValue); - beans::PropertyValue GetInteropGrabBag(); + beans::PropertyValue GetInteropGrabBag(); ///< Used for table styles, has a name. + beans::PropertyValues GetInteropGrabBagSeq(); ///< Used for existing styles, just a list of properties. StyleSheetEntry(); virtual ~StyleSheetEntry(); commit d66029491060db5f45532d0a7e3e3c52b4b11d1e Author: Miklos Vajna <[email protected]> Date: Wed Nov 6 14:41:04 2013 +0100 writerfilter: make GrabBag methods accessible for para styles Change-Id: Ifbb5eaa85340e07d34fa2b9cb2ea4f83f74ffab8 diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index b4c5d3e..28e1510 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -173,7 +173,7 @@ PropertyMapPtr TableStyleSheetEntry::GetProperties( sal_Int32 nMask, StyleSheetE return pProps; } -beans::PropertyValue TableStyleSheetEntry::GetInteropGrabBag() +beans::PropertyValue StyleSheetEntry::GetInteropGrabBag() { beans::PropertyValue aRet; aRet.Name = sStyleIdentifierI; @@ -187,7 +187,7 @@ beans::PropertyValue TableStyleSheetEntry::GetInteropGrabBag() return aRet; } -void TableStyleSheetEntry::AppendInteropGrabBag(beans::PropertyValue aValue) +void StyleSheetEntry::AppendInteropGrabBag(beans::PropertyValue aValue) { m_aInteropGrabBag.push_back(aValue); } diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx index cb6b9af..db9be28 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.hxx +++ b/writerfilter/source/dmapper/StyleSheetTable.hxx @@ -50,6 +50,7 @@ enum StyleType struct StyleSheetTable_Impl; class StyleSheetEntry { + std::vector<beans::PropertyValue> m_aInteropGrabBag; public: OUString sStyleIdentifierI; OUString sStyleIdentifierD; @@ -66,6 +67,9 @@ public: std::vector<beans::PropertyValue> aLatentStyles; ///< Attributes of latentStyles std::vector<beans::PropertyValue> aLsdExceptions; ///< List of lsdException attribute lists + void AppendInteropGrabBag(beans::PropertyValue aValue); + beans::PropertyValue GetInteropGrabBag(); + StyleSheetEntry(); virtual ~StyleSheetEntry(); }; @@ -124,8 +128,6 @@ private: StyleSheetTable* m_pStyleSheet; TblStylePrs m_aStyles; - std::vector<beans::PropertyValue> m_aInteropGrabBag; - public: short m_nColBandSize; @@ -143,9 +145,6 @@ public: // @param pStack already processed StyleSheetEntries PropertyMapPtr GetProperties( sal_Int32 nMask, StyleSheetEntryDequePtr pStack = StyleSheetEntryDequePtr()); - void AppendInteropGrabBag(beans::PropertyValue aValue); - beans::PropertyValue GetInteropGrabBag(); - TableStyleSheetEntry( StyleSheetEntry& aEntry, StyleSheetTable* pStyles ); virtual ~TableStyleSheetEntry( ); commit a1f6a4667c985b6037e9041a938cb714bc03f5cd Author: Miklos Vajna <[email protected]> Date: Wed Nov 6 12:15:06 2013 +0100 offapi: document style::Style's new StyleInteropGrabBag property Change-Id: Ie8a022858a1bbdf3c66044d9935e62675ea8cff0 diff --git a/offapi/com/sun/star/style/Style.idl b/offapi/com/sun/star/style/Style.idl index bd81188..28fccae 100644 --- a/offapi/com/sun/star/style/Style.idl +++ b/offapi/com/sun/star/style/Style.idl @@ -139,6 +139,16 @@ published service Style @since LibreOffice 4.0 */ [optional, property] boolean Hidden; + + /** Grab bag of style properties, used as a string-any map for interim interop purposes. + + @since LibreOffice 4.2 + + <p>This property is intentionally not handled by the ODF filter. Any + member that should be handled there should be first moved out from this grab + bag to a separate property.</p> + */ + [optional, property] sequence<com::sun::star::beans::PropertyValue> StyleInteropGrabBag; }; commit 02b91a83b67f230bb58854340c79e94cc147bb12 Author: Miklos Vajna <[email protected]> Date: Wed Nov 6 11:59:24 2013 +0100 sw: add InteropGrabBag for paragraph styles Change-Id: I44087a5119a538a3892d7f44a33a00bc601a6d44 diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index a7977f8..2c7afac 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -654,6 +654,7 @@ included in c-context files, so c++ style stuff will cause problems. #define FN_UNO_REPLACEMENT_GRAPHIC_U_R_L (FN_EXTRA2 + 121) #define FN_UNO_HIDDEN (FN_EXTRA2 + 122) +#define FN_UNO_STYLE_INTEROP_GRAB_BAG (FN_EXTRA2 + 123) /*------------------------------------------------ -------------------- Area: Help diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 66a56d6..34d3608 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -841,6 +841,7 @@ enum SwPropNameIds /* 0774 */ UNO_NAME_DOC_INTEROP_GRAB_BAG, /* 0775 */ UNO_NAME_FRAME_INTEROP_GRAB_BAG, /* 0776 */ UNO_NAME_CHAR_HIGHLIGHT, +/* 0777 */ UNO_NAME_STYLE_INTEROP_GRAB_BAG, SW_PROPNAME_END diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index f63b85a..f2fb41c 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -490,7 +490,8 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() { SW_PROP_NMID(UNO_NAME_PARA_IS_CONNECT_BORDER), RES_PARATR_CONNECT_BORDER, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0},\ { SW_PROP_NMID(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \ { SW_PROP_NMID(UNO_NAME_OUTLINE_LEVEL), RES_PARATR_OUTLINELEVEL,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0}, \ - { SW_PROP_NMID(UNO_NAME_HIDDEN), FN_UNO_HIDDEN, CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_NONE, 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}, #define COMMON_FLDTYP_PROPERTIES \ diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index 740c8fd..1ad38e9 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -806,6 +806,7 @@ const SwPropNameTab aPropNameTab = { /* 0774 UNO_NAME_DOC_INTEROP_GRAB_BAG */ {MAP_CHAR_LEN("InteropGrabBag")}, /* 0775 UNO_NAME_FRAME_INTEROP_GRAB_BAG */ {MAP_CHAR_LEN("FrameInteropGrabBag")}, /* 0776 UNO_NAME_CHAR_HIGHLIGHT */ {MAP_CHAR_LEN("CharHighlight")}, +/* 0777 UNO_NAME_STYLE_INTEROP_GRAB_BAG */ {MAP_CHAR_LEN("StyleInteropGrabBag")}, // new items in this array must match enum SwPropNameIds }; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 5227be1..e402803 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1678,6 +1678,13 @@ static void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } break; + case FN_UNO_STYLE_INTEROP_GRAB_BAG: + { + rBase.mxNewBase->GetItemSet(); + rBase.mxNewBase->SetGrabBagItem(rValue); + } + break; + case RES_PAPER_BIN: { SfxPrinter *pPrinter = pDoc->getPrinter( true ); @@ -2177,6 +2184,14 @@ static uno::Any lcl_GetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, } aRet.setValue(&bHidden, ::getBooleanCppuType()); } + else if (FN_UNO_STYLE_INTEROP_GRAB_BAG == rEntry.nWID) + { + if (pBase) + { + rtl::Reference<SwDocStyleSheet> xBase(new SwDocStyleSheet(*(SwDocStyleSheet*)pBase)); + xBase->GetGrabBagItem(aRet); + } + } else if(pBase) { if(!rBase.mxNewBase.is()) commit 8dfd8245381b8b9e89d2399b35c089964385b3cf Author: Miklos Vajna <[email protected]> Date: Wed Nov 6 11:44:41 2013 +0100 SwDocStyleSheet: add getter / setter for InteropGrabBag Change-Id: I4163633f11c75cf9f12485212f563c8f53af38f7 diff --git a/sw/inc/docstyle.hxx b/sw/inc/docstyle.hxx index 8620cd8..a08ff60 100644 --- a/sw/inc/docstyle.hxx +++ b/sw/inc/docstyle.hxx @@ -101,6 +101,8 @@ public: virtual void SetHidden( sal_Bool bHidden ); virtual sal_Bool IsHidden( ) const; + void SetGrabBagItem(const com::sun::star::uno::Any& rVal); + void GetGrabBagItem(com::sun::star::uno::Any& rVal) const; /** add optional parameter <bResetIndentAttrsAtParagraphStyle>, default value sal_False, which indicates that the indent attributes at a paragraph style should diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index 4759a0e..8e3736d 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -54,6 +54,8 @@ #include <svx/svxids.hrc> #include <SwRewriter.hxx> +using namespace com::sun::star; + // The Format names in the list of all names have the // following family as their first character: @@ -425,6 +427,50 @@ void SwDocStyleSheet::Reset() SetPhysical(sal_False); } +void SwDocStyleSheet::SetGrabBagItem(const uno::Any& rVal) +{ + bool bChg = false; + if (!bPhysical) + FillStyleSheet(FillPhysical); + + SwFmt* pFmt = 0; + switch (nFamily) + { + case SFX_STYLE_FAMILY_PARA: + pFmt = rDoc.FindTxtFmtCollByName(aName); + if (pFmt) + { + pFmt->SetGrabBagItem(rVal); + bChg = true; + } + break; + default: + break; + } + + if (bChg) + { + dynamic_cast<SwDocStyleSheetPool*>(pPool)->InvalidateIterator(); + pPool->Broadcast(SfxStyleSheetHint(SFX_STYLESHEET_MODIFIED, *this)); + SwEditShell* pSh = rDoc.GetEditShell(); + if (pSh) + pSh->CallChgLnk(); + } +} + +void SwDocStyleSheet::GetGrabBagItem(uno::Any& rVal) const +{ + SwFmt* pFmt = 0; + switch (nFamily) + { + case SFX_STYLE_FAMILY_PARA: + pFmt = rDoc.FindTxtFmtCollByName(aName); + pFmt->GetGrabBagItem(rVal); + break; + default: + break; + } +} // virtual methods void SwDocStyleSheet::SetHidden( sal_Bool bValue ) { commit e9b848270850f57965d274f7fd47fc2a84611465 Author: Miklos Vajna <[email protected]> Date: Wed Nov 6 11:32:33 2013 +0100 SwFmt: add getter / setter for InteropGrabBag Change-Id: I3f97c23077f8c2af69873e9cef244265378f44f7 diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index c9efac3..abea51a 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -24,6 +24,7 @@ #include <swatrset.hxx> #include <calbck.hxx> #include <hintids.hxx> +#include <boost/shared_ptr.hpp> class IDocumentSettingAccess; class IDocumentDrawModelAccess; @@ -32,6 +33,7 @@ class IDocumentTimerAccess; class IDocumentFieldsAccess; class IDocumentChartDataProviderAccess; class SwDoc; +class SfxGrabBagItem; /// Base class for various Writer styles. class SW_DLLPUBLIC SwFmt : public SwModify @@ -52,6 +54,7 @@ class SW_DLLPUBLIC SwFmt : public SwModify sal_Bool bAutoUpdateFmt : 1;/**< TRUE: Set attributes of a whole paragraph at format (UI-side!). */ bool bHidden : 1; + boost::shared_ptr<SfxGrabBagItem> m_pGrabBagItem; ///< Style InteropGrabBag. protected: SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm, @@ -158,6 +161,9 @@ public: bool IsHidden() const { return bHidden; } void SetHidden( bool bValue = false ) { bHidden = bValue; } + void GetGrabBagItem(com::sun::star::uno::Any& rVal) const; + void SetGrabBagItem(const com::sun::star::uno::Any& rVal); + /// Query / set bAutoUpdateFmt-flag. sal_Bool IsAutoUpdateFmt() const { return bAutoUpdateFmt; } void SetAutoUpdateFmt( sal_Bool bNew = sal_True ) { bAutoUpdateFmt = bNew; } diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index de54367..d94f2d7 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -25,6 +25,10 @@ #include <hints.hxx> #include <paratr.hxx> #include <swcache.hxx> +#include <svl/grabbagitem.hxx> +#include <com/sun/star/beans/PropertyValues.hpp> + +using namespace com::sun::star; TYPEINIT1( SwFmt, SwClient ); @@ -603,4 +607,23 @@ IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); } IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return GetDoc(); } IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return GetDoc(); } +void SwFmt::GetGrabBagItem(uno::Any& rVal) const +{ + if (m_pGrabBagItem.get()) + m_pGrabBagItem->QueryValue(rVal); + else + { + uno::Sequence<beans::PropertyValue> aValue(0); + rVal = uno::makeAny(aValue); + } +} + +void SwFmt::SetGrabBagItem(const uno::Any& rVal) +{ + if (!m_pGrabBagItem.get()) + m_pGrabBagItem.reset(new SfxGrabBagItem); + + m_pGrabBagItem->PutValue(rVal); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
