include/svl/grabbagitem.hxx | 44 ++++++ offapi/com/sun/star/style/ParagraphProperties.idl | 10 + svl/Library_svl.mk | 1 svl/source/items/grabbagitem.cxx | 100 +++++++++++++++ sw/inc/hintids.hxx | 143 +++++++++++----------- sw/inc/unoprnms.hxx | 2 sw/qa/extras/ooxmlexport/data/grabbag.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 13 +- sw/source/core/bastyp/init.cxx | 3 sw/source/core/unocore/unomap.cxx | 3 sw/source/core/unocore/unoprnms.cxx | 1 sw/source/filter/ww8/attributeoutputbase.hxx | 4 sw/source/filter/ww8/docxattributeoutput.cxx | 13 ++ sw/source/filter/ww8/docxattributeoutput.hxx | 3 sw/source/filter/ww8/rtfattributeoutput.cxx | 4 sw/source/filter/ww8/rtfattributeoutput.hxx | 3 sw/source/filter/ww8/ww8atr.cxx | 8 + sw/source/filter/ww8/ww8attributeoutput.hxx | 3 writerfilter/source/dmapper/DomainMapper.cxx | 3 writerfilter/source/dmapper/PropertyIds.cxx | 1 writerfilter/source/dmapper/PropertyIds.hxx | 1 writerfilter/source/dmapper/PropertyMap.cxx | 39 ++++-- writerfilter/source/dmapper/PropertyMap.hxx | 7 - 23 files changed, 325 insertions(+), 84 deletions(-)
New commits: commit 00af1f2114d1c8c380ac3d5bc30cddc5f44b8132 Author: Miklos Vajna <[email protected]> Date: Wed Jul 24 11:51:57 2013 +0200 sw: update hintids.hxx comments to match reality Change-Id: Ida2afe0cb37cf5c80bfe76a0f24ce0fb0d690da6 diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 403bd74..1cc5857 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -160,7 +160,7 @@ RES_PARATR_BEGIN = RES_TXTATR_END, RES_PARATR_CONNECT_BORDER, // 73 RES_PARATR_OUTLINELEVEL, // 74 RES_PARATR_RSID, // 75 - RES_PARATR_GRABBAG, + RES_PARATR_GRABBAG, // 76 RES_PARATR_END }; @@ -169,101 +169,101 @@ RES_PARATR_END enum RES_PARATR_LIST { RES_PARATR_LIST_BEGIN = RES_PARATR_END, - RES_PARATR_LIST_ID = RES_PARATR_LIST_BEGIN, // 76 - RES_PARATR_LIST_LEVEL, // 77 - RES_PARATR_LIST_ISRESTART, // 78 - RES_PARATR_LIST_RESTARTVALUE, // 79 - RES_PARATR_LIST_ISCOUNTED, // 80 + RES_PARATR_LIST_ID = RES_PARATR_LIST_BEGIN, // 77 + RES_PARATR_LIST_LEVEL, // 78 + RES_PARATR_LIST_ISRESTART, // 79 + RES_PARATR_LIST_RESTARTVALUE, // 80 + RES_PARATR_LIST_ISCOUNTED, // 81 RES_PARATR_LIST_END }; enum RES_FRMATR { RES_FRMATR_BEGIN = RES_PARATR_LIST_END, - RES_FILL_ORDER = RES_FRMATR_BEGIN, // 81 - RES_FRM_SIZE, // 82 - RES_PAPER_BIN, // 83 - RES_LR_SPACE, // 84 - RES_UL_SPACE, // 85 - RES_PAGEDESC, // 86 - RES_BREAK, // 87 - RES_CNTNT, // 88 - RES_HEADER, // 89 - RES_FOOTER, // 90 - RES_PRINT, // 91 - RES_OPAQUE, // 92 - RES_PROTECT, // 93 - RES_SURROUND, // 94 - RES_VERT_ORIENT, // 95 - RES_HORI_ORIENT, // 96 - RES_ANCHOR, // 97 - RES_BACKGROUND, // 98 - RES_BOX, // 99 - RES_SHADOW, // 100 - RES_FRMMACRO, // 101 - RES_COL, // 102 - RES_KEEP, // 103 - RES_URL, // 104 - RES_EDIT_IN_READONLY, // 105 - RES_LAYOUT_SPLIT, // 106 - RES_CHAIN, // 107 - RES_TEXTGRID, // 108 - RES_LINENUMBER , // 109 - RES_FTN_AT_TXTEND, // 110 - RES_END_AT_TXTEND, // 111 - RES_COLUMNBALANCE, // 112 - RES_FRAMEDIR, // 113 - RES_HEADER_FOOTER_EAT_SPACING, // 114 - RES_ROW_SPLIT, // 115 - RES_FOLLOW_TEXT_FLOW, // 116 - RES_COLLAPSING_BORDERS, // 117 - RES_WRAP_INFLUENCE_ON_OBJPOS, // 118 - RES_AUTO_STYLE, // 119 - RES_FRMATR_STYLE_NAME, // 120 - RES_FRMATR_CONDITIONAL_STYLE_NAME, // 121 - RES_FILL_STYLE, // 122 - RES_FILL_GRADIENT, // 123 + RES_FILL_ORDER = RES_FRMATR_BEGIN, // 82 + RES_FRM_SIZE, // 83 + RES_PAPER_BIN, // 84 + RES_LR_SPACE, // 85 + RES_UL_SPACE, // 86 + RES_PAGEDESC, // 87 + RES_BREAK, // 88 + RES_CNTNT, // 89 + RES_HEADER, // 90 + RES_FOOTER, // 91 + RES_PRINT, // 92 + RES_OPAQUE, // 93 + RES_PROTECT, // 94 + RES_SURROUND, // 95 + RES_VERT_ORIENT, // 96 + RES_HORI_ORIENT, // 97 + RES_ANCHOR, // 98 + RES_BACKGROUND, // 99 + RES_BOX, // 100 + RES_SHADOW, // 101 + RES_FRMMACRO, // 102 + RES_COL, // 103 + RES_KEEP, // 104 + RES_URL, // 105 + RES_EDIT_IN_READONLY, // 106 + RES_LAYOUT_SPLIT, // 107 + RES_CHAIN, // 108 + RES_TEXTGRID, // 109 + RES_LINENUMBER , // 110 + RES_FTN_AT_TXTEND, // 111 + RES_END_AT_TXTEND, // 112 + RES_COLUMNBALANCE, // 113 + RES_FRAMEDIR, // 114 + RES_HEADER_FOOTER_EAT_SPACING, // 115 + RES_ROW_SPLIT, // 116 + RES_FOLLOW_TEXT_FLOW, // 117 + RES_COLLAPSING_BORDERS, // 118 + RES_WRAP_INFLUENCE_ON_OBJPOS, // 119 + RES_AUTO_STYLE, // 120 + RES_FRMATR_STYLE_NAME, // 121 + RES_FRMATR_CONDITIONAL_STYLE_NAME, // 122 + RES_FILL_STYLE, // 123 + RES_FILL_GRADIENT, // 124 RES_FRMATR_END }; enum RES_GRFATR { RES_GRFATR_BEGIN = RES_FRMATR_END, - RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN, // 124 - RES_GRFATR_CROPGRF, // 125 - - RES_GRFATR_ROTATION, // 126 - RES_GRFATR_LUMINANCE, // 127 - RES_GRFATR_CONTRAST, // 128 - RES_GRFATR_CHANNELR, // 129 - RES_GRFATR_CHANNELG, // 130 - RES_GRFATR_CHANNELB, // 131 - RES_GRFATR_GAMMA, // 132 - RES_GRFATR_INVERT, // 133 - RES_GRFATR_TRANSPARENCY, // 134 - RES_GRFATR_DRAWMODE, // 135 - - RES_GRFATR_DUMMY1, // 136 - RES_GRFATR_DUMMY2, // 137 - RES_GRFATR_DUMMY3, // 138 - RES_GRFATR_DUMMY4, // 139 - RES_GRFATR_DUMMY5, // 140 + RES_GRFATR_MIRRORGRF = RES_GRFATR_BEGIN, // 125 + RES_GRFATR_CROPGRF, // 126 + + RES_GRFATR_ROTATION, // 127 + RES_GRFATR_LUMINANCE, // 128 + RES_GRFATR_CONTRAST, // 129 + RES_GRFATR_CHANNELR, // 130 + RES_GRFATR_CHANNELG, // 131 + RES_GRFATR_CHANNELB, // 132 + RES_GRFATR_GAMMA, // 133 + RES_GRFATR_INVERT, // 134 + RES_GRFATR_TRANSPARENCY, // 135 + RES_GRFATR_DRAWMODE, // 136 + + RES_GRFATR_DUMMY1, // 137 + RES_GRFATR_DUMMY2, // 138 + RES_GRFATR_DUMMY3, // 139 + RES_GRFATR_DUMMY4, // 140 + RES_GRFATR_DUMMY5, // 141 RES_GRFATR_END }; enum RES_BOXATR { RES_BOXATR_BEGIN = RES_GRFATR_END, - RES_BOXATR_FORMAT = RES_BOXATR_BEGIN, // 141 - RES_BOXATR_FORMULA, // 142 - RES_BOXATR_VALUE, // 143 + RES_BOXATR_FORMAT = RES_BOXATR_BEGIN, // 142 + RES_BOXATR_FORMULA, // 143 + RES_BOXATR_VALUE, // 144 RES_BOXATR_END }; enum RES_UNKNOWNATR { RES_UNKNOWNATR_BEGIN = RES_BOXATR_END, - RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 142 + RES_UNKNOWNATR_CONTAINER = RES_UNKNOWNATR_BEGIN,// 145 RES_UNKNOWNATR_END }; commit afe463fb62225fdc526343fb2020ced790c61251 Author: Miklos Vajna <[email protected]> Date: Wed Jul 24 11:35:01 2013 +0200 SfxGrabBagItem testcase Change-Id: I1386ab7a0680460bd98648d2803b1b7e0326e093 diff --git a/sw/qa/extras/ooxmlexport/data/grabbag.docx b/sw/qa/extras/ooxmlexport/data/grabbag.docx new file mode 100755 index 0000000..0aca64d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/grabbag.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index afaa061..24ad76e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -98,6 +98,7 @@ public: void testFdo66929(); void testFdo66145(); void testPageBorderSpacingExportCase2(); + void testGrabBag(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -114,7 +115,7 @@ private: * xml stream, so that you can do the asserting. */ xmlDocPtr parseExport(); - void assertXPath(xmlDocPtr pXmlDoc, OString aXPath, OString aAttribute, OUString aExpectedValue); + void assertXPath(xmlDocPtr pXmlDoc, OString aXPath, OString aAttribute = OString(), OUString aExpectedValue = OUString()); }; void Test::run() @@ -174,6 +175,7 @@ void Test::run() {"bnc581614.doc", &Test::testBnc581614}, {"fdo66929.docx", &Test::testFdo66929}, {"page-borders-export-case-2.docx", &Test::testPageBorderSpacingExportCase2}, + {"grabbag.docx", &Test::testGrabBag}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -227,6 +229,8 @@ void Test::assertXPath(xmlDocPtr pXmlDoc, OString aXPath, OString aAttribute, OU xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(aXPath.getStr()), pXmlXpathCtx); xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval; CPPUNIT_ASSERT_EQUAL(1, xmlXPathNodeSetGetLength(pXmlNodes)); + if (aAttribute.isEmpty()) + return; xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; OUString aValue = OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST(aAttribute.getStr()))); CPPUNIT_ASSERT_EQUAL(aExpectedValue, aValue); @@ -1012,6 +1016,13 @@ void Test::testFdo66145() CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(xPropertySet, "FirstIsShared"))); } +void Test::testGrabBag() +{ + // w:mirrorIndents was lost on roundtrip, now should be handled as a grab bag property + xmlDocPtr pXmlDoc = parseExport(); + assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:mirrorIndents"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit d978bc31bf821d9698b2fdb5c277b239704d9776 Author: Miklos Vajna <[email protected]> Date: Wed Jul 24 11:25:16 2013 +0200 MSWordExportBase: handle SfxGrabBagItem Change-Id: Iace2abaa0e933d7f4abf2feb146698bbf299be38 diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx index 25ee2a0..cadce5a 100644 --- a/sw/source/filter/ww8/attributeoutputbase.hxx +++ b/sw/source/filter/ww8/attributeoutputbase.hxx @@ -102,6 +102,7 @@ class SvxFmtKeepItem; class SwTextGridItem; class SwFmtLineNumber; class SvxFrameDirectionItem; +class SfxGrabBagItem; class SwFmtRuby; class SwTxtNode; class SwTOXMark; @@ -560,6 +561,9 @@ protected: /// Sfx item RES_FRAMEDIR virtual void FormatFrameDirection( const SvxFrameDirectionItem& ) = 0; + /// Sfx item RES_PARATR_GRABBAG + virtual void ParaGrabBag( const SfxGrabBagItem& ) = 0; + /// Write the expanded field virtual void WriteExpand( const SwField* pFld ) = 0; diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f4a5608..cf95aa2 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -73,6 +73,7 @@ #include <svx/svdobj.hxx> #include <svx/xfillit0.hxx> #include <svx/xflgrit.hxx> +#include <svl/grabbagitem.hxx> #include <sfx2/sfxbasemodel.hxx> #include <anchoredobject.hxx> @@ -5221,6 +5222,18 @@ void DocxAttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDi } } +void DocxAttributeOutput::ParaGrabBag(const SfxGrabBagItem& rItem) +{ + const std::map<OUString, com::sun::star::uno::Any>& rMap = rItem.GetGrabBag(); + for (std::map<OUString, com::sun::star::uno::Any>::const_iterator i = rMap.begin(); i != rMap.end(); ++i) + { + if (i->first == "MirrorIndents") + m_pSerializer->singleElementNS(XML_w, XML_mirrorIndents, FSEND); + else + SAL_INFO("sw.ww8", "DocxAttributeOutput::ParaGrabBag: unhandled grab bag property " << i->first); + } +} + DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML ) : m_rExport( rExport ), m_pSerializer( pSerializer ), diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 316ea6a..2a163a89 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -564,6 +564,9 @@ protected: /// Sfx item RES_FRAMEDIR virtual void FormatFrameDirection( const SvxFrameDirectionItem& ); + /// Sfx item RES_PARATR_GRABBAG + virtual void ParaGrabBag( const SfxGrabBagItem& ); + /// Write the expanded field virtual void WriteExpand( const SwField* pFld ); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 4e16660..70f19c8 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3116,6 +3116,10 @@ void RtfAttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDir } } +void RtfAttributeOutput::ParaGrabBag(const SfxGrabBagItem& /*rItem*/) +{ +} + void RtfAttributeOutput::WriteExpand( const SwField* pFld ) { SAL_INFO("sw.rtf", OSL_THIS_FUNC); diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx index ec5002f..ea115bf 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.hxx +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -402,6 +402,9 @@ protected: /// Sfx item RES_FRAMEDIR virtual void FormatFrameDirection( const SvxFrameDirectionItem& ); + /// Sfx item RES_PARATR_GRABBAG + virtual void ParaGrabBag( const SfxGrabBagItem& ); + /// Write the expanded field virtual void WriteExpand( const SwField* pFld ); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 62335b3..f8c6eee 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -30,6 +30,7 @@ #include <svl/zformat.hxx> #include <svl/itemiter.hxx> #include <svl/whiter.hxx> +#include <svl/grabbagitem.hxx> #include <editeng/fontitem.hxx> #include <editeng/tstpitem.hxx> #include <editeng/adjustitem.hxx> @@ -4708,6 +4709,10 @@ void WW8AttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDir } } +void WW8AttributeOutput::ParaGrabBag(const SfxGrabBagItem& /*rItem*/) +{ +} + // "Separate paragraphs" void WW8AttributeOutput::ParaSplit( const SvxFmtSplitItem& rSplit ) { @@ -5243,6 +5248,9 @@ void AttributeOutputBase::OutputItem( const SfxPoolItem& rHt ) case RES_FRAMEDIR: FormatFrameDirection( static_cast< const SvxFrameDirectionItem& >( rHt ) ); break; + case RES_PARATR_GRABBAG: + ParaGrabBag(static_cast<const SfxGrabBagItem&>(rHt)); + break; default: SAL_INFO("sw.ww8", "Unhandled SfxPoolItem with id " << rHt.Which() ); diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx index d471101..97419ba 100644 --- a/sw/source/filter/ww8/ww8attributeoutput.hxx +++ b/sw/source/filter/ww8/ww8attributeoutput.hxx @@ -383,6 +383,9 @@ protected: /// Sfx item RES_FRAMEDIR virtual void FormatFrameDirection( const SvxFrameDirectionItem& ); + /// Sfx item RES_PARATR_GRABBAG + virtual void ParaGrabBag( const SfxGrabBagItem& ); + /// Write the expanded field virtual void WriteExpand( const SwField* pFld ); commit 41bf9d4cc32436ab3e43e8905236dd61ba511815 Author: Miklos Vajna <[email protected]> Date: Wed Jul 24 10:53:29 2013 +0200 writerfilter: import w:mirrorIndents as a grab bag property Change-Id: I500c6af08326ea226b3774fb1e02709d278fa509 diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 4fda96b..cab21d8 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -3326,6 +3326,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType case NS_sprm::LN_PContextualSpacing: rContext->Insert(PROP_PARA_CONTEXT_MARGIN, uno::makeAny( sal_Bool( nIntValue ) )); break; + case 0x2470: // mirrorIndents + rContext->Insert(PROP_MIRROR_INDENTS, uno::makeAny(sal_Bool(nIntValue)), true, true); + break; case NS_ooxml::LN_EG_SectPrContents_formProt: //section protection, only form editing is enabled - unsupported case NS_ooxml::LN_EG_SectPrContents_vAlign: case NS_ooxml::LN_EG_RPrBase_fitText: diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx index f71ed96..1d62f00 100644 --- a/writerfilter/source/dmapper/PropertyIds.cxx +++ b/writerfilter/source/dmapper/PropertyIds.cxx @@ -328,6 +328,7 @@ const OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const case PROP_CHAR_SHADING_VALUE: sName = "CharShadingValue"; break; case PROP_LABEL_CATEGORY: sName = "LabelCategory"; break; case PROP_FIRST_IS_SHARED : sName = "FirstIsShared"; break; + case PROP_MIRROR_INDENTS : sName = "MirrorIndents"; break; } ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt = m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName )); diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx index 64e81fe..19ee4ff 100644 --- a/writerfilter/source/dmapper/PropertyIds.hxx +++ b/writerfilter/source/dmapper/PropertyIds.hxx @@ -299,6 +299,7 @@ enum PropertyIds ,PROP_GRAPHIC_BITMAP ,PROP_CHAR_SHADING_VALUE ,PROP_FIRST_IS_SHARED + ,PROP_MIRROR_INDENTS }; struct PropertyNameSupplier_Impl; class PropertyNameSupplier diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 3a6668e..12380f7 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -64,11 +64,19 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues() { if(!m_aValues.getLength() && size()) { - m_aValues.realloc( size() ); + size_t nGrabBag = 0; + for (PropertyMap::iterator i = begin(); i != end(); ++i) + if (i->first.m_bGrabBag) + nGrabBag++; + // If there are any grab bag properties, we need one slot for them. + m_aValues.realloc( size() - nGrabBag + (nGrabBag ? 1 : 0)); ::com::sun::star::beans::PropertyValue* pValues = m_aValues.getArray(); + uno::Sequence<beans::PropertyValue> aGrabBagValues(nGrabBag); + beans::PropertyValue* pGrabBagValues = aGrabBagValues.getArray(); //style names have to be the first elements within the property sequence //otherwise they will overwrite 'hard' attributes sal_Int32 nValue = 0; + sal_Int32 nGrabBagValue = 0; PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); PropertyMap::iterator aParaStyleIter = find(PropertyDefinition( PROP_PARA_STYLE_NAME ) ); if( aParaStyleIter != end()) @@ -93,15 +101,30 @@ uno::Sequence< beans::PropertyValue > PropertyMap::GetPropertyValues() ++nValue; } PropertyMap::iterator aMapIter = begin(); - for( ; nValue < m_aValues.getLength(); ++aMapIter ) + for( ; aMapIter != end(); ++aMapIter ) { if( aMapIter != aParaStyleIter && aMapIter != aCharStyleIter && aMapIter != aNumRuleIter ) { - pValues[nValue].Name = rPropNameSupplier.GetName( aMapIter->first.eId ); - pValues[nValue].Value = aMapIter->second; - ++nValue; + if (!aMapIter->first.m_bGrabBag) + { + pValues[nValue].Name = rPropNameSupplier.GetName( aMapIter->first.eId ); + pValues[nValue].Value = aMapIter->second; + ++nValue; + } + else + { + pGrabBagValues[nGrabBagValue].Name = rPropNameSupplier.GetName( aMapIter->first.eId ); + pGrabBagValues[nGrabBagValue].Value = aMapIter->second; + ++nGrabBagValue; + } } } + if (nGrabBag) + { + pValues[nValue].Name = "ParaInteropGrabBag"; + pValues[nValue].Value = uno::makeAny(aGrabBagValues); + ++nValue; + } } return m_aValues; } @@ -131,7 +154,7 @@ static void lcl_AnyToTag(const uno::Any & rAny) } #endif -void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite ) +void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite, bool bGrabBag ) { #ifdef DEBUG_DMAPPER_PROPERTY_MAP const OUString& rInsert = PropertyNameSupplier:: @@ -143,7 +166,7 @@ void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite dmapper_logger->endElement(); #endif - PropertyMap::iterator aElement = find(PropertyDefinition( eId ) ); + PropertyMap::iterator aElement = find(PropertyDefinition( eId, bGrabBag ) ); if( aElement != end()) { if(!bOverwrite) @@ -151,7 +174,7 @@ void PropertyMap::Insert( PropertyIds eId, const uno::Any& rAny, bool bOverwrite erase( aElement ); } _PropertyMap::insert( PropertyMap::value_type - (PropertyDefinition( eId ), + (PropertyDefinition( eId, bGrabBag ), rAny )); Invalidate(); } diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx index ba15e89..d5d70d7 100644 --- a/writerfilter/source/dmapper/PropertyMap.hxx +++ b/writerfilter/source/dmapper/PropertyMap.hxx @@ -67,9 +67,10 @@ enum BorderPosition struct PropertyDefinition { PropertyIds eId; + bool m_bGrabBag; - PropertyDefinition( PropertyIds _eId ) : - eId( _eId ){} + PropertyDefinition( PropertyIds _eId, bool bGrabBag = false ) : + eId( _eId ), m_bGrabBag(bGrabBag){} bool operator== (const PropertyDefinition& rDef) const { return rDef.eId == eId; } @@ -102,7 +103,7 @@ public: bool hasEmptyPropertyValues() const {return !m_aValues.getLength();} /** Add property, usually overwrites already available attributes. It shouldn't overwrite in case of default attributes */ - void Insert( PropertyIds eId, const ::com::sun::star::uno::Any& rAny, bool bOverwrite = true ); + void Insert( PropertyIds eId, const ::com::sun::star::uno::Any& rAny, bool bOverwrite = true, bool bGrabBag = false ); void InsertProps(const boost::shared_ptr<PropertyMap> pMap); const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote>& GetFootnote() const; commit 288bcd68bdccd7a57b2c6da2c0bb91b71e8fcd3b Author: Miklos Vajna <[email protected]> Date: Wed Jul 24 10:52:40 2013 +0200 sw: add ParaInteropGrabBag uno property to paragraphs Change-Id: Ic1208f97db31d86bffd71032d6eba1768e929707 diff --git a/offapi/com/sun/star/style/ParagraphProperties.idl b/offapi/com/sun/star/style/ParagraphProperties.idl index 43e7752..ef73da5 100644 --- a/offapi/com/sun/star/style/ParagraphProperties.idl +++ b/offapi/com/sun/star/style/ParagraphProperties.idl @@ -30,6 +30,7 @@ #include <com/sun/star/table/BorderLine.idl> #include <com/sun/star/style/BreakType.idl> #include <com/sun/star/container/XNameContainer.idl> +#include <com/sun/star/beans/PropertyValue.idl> module com { module sun { module star { module style { @@ -137,6 +138,15 @@ published service ParagraphProperties */ [optional, property] boolean ParaContextMargin; + /** Grab bag of paragraph 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> ParaInteropGrabBag; /** determines if the paragraph is included in the line numbering. diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 83afbcd..403bd74 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -160,6 +160,7 @@ RES_PARATR_BEGIN = RES_TXTATR_END, RES_PARATR_CONNECT_BORDER, // 73 RES_PARATR_OUTLINELEVEL, // 74 RES_PARATR_RSID, // 75 + RES_PARATR_GRABBAG, RES_PARATR_END }; diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 68a1f4b..d418a12 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -824,6 +824,8 @@ enum SwPropNameIds /* 0761 */ UNO_NAME_CHAR_SHADING_VALUE, +/* 0762 */ UNO_NAME_PARA_INTEROP_GRAB_BAG, + /* 0762 */ SW_PROPNAME_END // new items in this array must match SwPropNameTab aPropNameTab diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 4e57193..7d585b7 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -59,6 +59,7 @@ #include <editeng/protitem.hxx> #include <editeng/prszitem.hxx> #include <editeng/rsiditem.hxx> +#include <svl/grabbagitem.hxx> #include <editeng/scriptspaceitem.hxx> #include <editeng/shaditem.hxx> #include <editeng/spltitem.hxx> @@ -328,6 +329,7 @@ SfxItemInfo aSlotTab[] = { SID_ATTR_PARA_OUTLINE_LEVEL, SFX_ITEM_POOLABLE }, // RES_PARATR_OUTLINELEVEL //#outline level { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_RSID + { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_GRABBAG { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ID { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_LEVEL { 0, SFX_ITEM_POOLABLE }, // RES_PARATR_LIST_ISRESTART @@ -544,6 +546,7 @@ void _InitCore() aAttrTab[ RES_PARATR_OUTLINELEVEL - POOLATTR_BEGIN ] = new SfxUInt16Item( RES_PARATR_OUTLINELEVEL, 0 ); aAttrTab[ RES_PARATR_RSID - POOLATTR_BEGIN ] = new SvxRsidItem( 0, RES_PARATR_RSID ); + aAttrTab[ RES_PARATR_GRABBAG - POOLATTR_BEGIN ] = new SfxGrabBagItem( RES_PARATR_GRABBAG ); aAttrTab[ RES_PARATR_LIST_ID - POOLATTR_BEGIN ] = new SfxStringItem( RES_PARATR_LIST_ID, aEmptyStr ); aAttrTab[ RES_PARATR_LIST_LEVEL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_PARATR_LIST_LEVEL, 0 ); diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index da8857c..6b9cadd 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -235,7 +235,8 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider() { SW_PROP_NMID(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, CPPU_E2T(CPPUTYPE_BOOLEAN), PropertyAttribute::MAYBEVOID, 0 }, \ { 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_WRITING_MODE), RES_FRAMEDIR, CPPU_E2T(CPPUTYPE_INT16), PROPERTY_NONE, 0 }, \ - { SW_PROP_NMID(UNO_NAME_CHAR_SHADING_VALUE), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_SHADING_VALUE }, + { SW_PROP_NMID(UNO_NAME_CHAR_SHADING_VALUE), RES_CHRATR_BACKGROUND, CPPU_E2T(CPPUTYPE_INT32), PROPERTY_NONE, MID_SHADING_VALUE }, \ + { SW_PROP_NMID(UNO_NAME_PARA_INTEROP_GRAB_BAG), RES_PARATR_GRABBAG, CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PROPERTY_NONE, 0 }, \ #define COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN \ COMMON_CRSR_PARA_PROPERTIES_WITHOUT_FN_01 \ diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx index 8e1c7ce..b721a3a 100644 --- a/sw/source/core/unocore/unoprnms.cxx +++ b/sw/source/core/unocore/unoprnms.cxx @@ -791,6 +791,7 @@ const SwPropNameTab aPropNameTab = { /* 0759 UNO_NAME_FILL_GRADIENT_NAME */ {MAP_CHAR_LEN("FillGradientName")}, /* 0760 UNO_NAME_DEFAULT_PAGE_MODE */ {MAP_CHAR_LEN("DefaultPageMode")}, /* 0761 UNO_NAME_CHAR_SHADING_VALUE */ {MAP_CHAR_LEN("CharShadingValue")}, +/* 0762 UNO_NAME_PARA_INTEROP_GRAB_BAG */ {MAP_CHAR_LEN("ParaInteropGrabBag")}, // new items in this array must match enum SwPropNameIds }; commit f841985d9c80556001fbd6bd856eb84f49e805ab Author: Miklos Vajna <[email protected]> Date: Wed Jul 24 10:51:33 2013 +0200 svl: add an SfxGrabBagItem The intention is that this can be used as a grab bag of properties which are not handled properly, yet we want the roundtrip of them to alien formats. See http://lists.freedesktop.org/archives/libreoffice/2013-July/054428.html for more details. Change-Id: I3781b3b3bf1380d30683039f037d9a4292ba2f4a diff --git a/include/svl/grabbagitem.hxx b/include/svl/grabbagitem.hxx new file mode 100644 index 0000000..f32e8e5 --- /dev/null +++ b/include/svl/grabbagitem.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef _SFXGRABBAGITEM_HXX +#define _SFXGRABBAGITEM_HXX + +#include <map> + +#include "svl/svldllapi.h" +#include <tools/rtti.hxx> +#include <svl/poolitem.hxx> +#include <com/sun/star/uno/Any.hxx> + +/// Grab bag item provides a string-any map for interim interop purposes. +class SVL_DLLPUBLIC SfxGrabBagItem : public SfxPoolItem +{ +private: + std::map<OUString, com::sun::star::uno::Any> m_aMap; + +public: + TYPEINFO(); + + SfxGrabBagItem(); + SfxGrabBagItem(sal_uInt16 nWhich, const std::map<OUString, com::sun::star::uno::Any> *pMap = 0); + SfxGrabBagItem(const SfxGrabBagItem& rItem); + ~SfxGrabBagItem(); + + void SetGrabBag(const std::map<OUString, com::sun::star::uno::Any>& rMap); + const std::map<OUString, com::sun::star::uno::Any>& GetGrabBag() const; + + virtual int operator==(const SfxPoolItem&) const; + virtual SfxPoolItem* Clone(SfxItemPool *pPool = 0) const; + + virtual bool PutValue(const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0); + virtual bool QueryValue(com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0) const; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk index 499b105..fd28a7a 100644 --- a/svl/Library_svl.mk +++ b/svl/Library_svl.mk @@ -73,6 +73,7 @@ $(eval $(call gb_Library_add_exception_objects,svl,\ svl/source/items/eitem \ svl/source/items/flagitem \ svl/source/items/globalnameitem \ + svl/source/items/grabbagitem \ svl/source/items/ilstitem \ svl/source/items/imageitm \ svl/source/items/intitem \ diff --git a/svl/source/items/grabbagitem.cxx b/svl/source/items/grabbagitem.cxx new file mode 100644 index 0000000..23ab2bd --- /dev/null +++ b/svl/source/items/grabbagitem.cxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <svl/grabbagitem.hxx> +#include <svl/poolitem.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <comphelper/sequence.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> + +DBG_NAME(SfxGrabBagItem) + +TYPEINIT1_AUTOFACTORY(SfxGrabBagItem, SfxPoolItem); + +using namespace com::sun::star; + +SfxGrabBagItem::SfxGrabBagItem() +{ +} + +SfxGrabBagItem::SfxGrabBagItem(sal_uInt16 nWhich, const std::map<OUString, uno::Any> *pMap) : + SfxPoolItem( nWhich ) +{ + if (pMap) + m_aMap = *pMap; +} + +SfxGrabBagItem::SfxGrabBagItem(const SfxGrabBagItem& rItem) : + SfxPoolItem(rItem), + m_aMap(rItem.m_aMap) +{ +} + +SfxGrabBagItem::~SfxGrabBagItem() +{ +} + +void SfxGrabBagItem::SetGrabBag(const std::map<OUString, uno::Any>& rMap) +{ + m_aMap = rMap; +} + +const std::map<OUString, uno::Any>& SfxGrabBagItem::GetGrabBag() const +{ + return m_aMap; +} + +int SfxGrabBagItem::operator==(const SfxPoolItem& rItem) const +{ + SfxGrabBagItem* pItem = (SfxGrabBagItem*)&rItem; + + return m_aMap == pItem->m_aMap; +} + +SfxPoolItem* SfxGrabBagItem::Clone(SfxItemPool * /*pPool*/) const +{ + return new SfxGrabBagItem(*this); +} + +bool SfxGrabBagItem::PutValue(const uno::Any& rVal, sal_uInt8 /*nMemberId*/) +{ + uno::Sequence<beans::PropertyValue> aValue; + if ( rVal >>= aValue ) + { + m_aMap.clear(); + comphelper::OSequenceIterator<beans::PropertyValue> i(aValue); + while (i.hasMoreElements()) + { + beans::PropertyValue aPropertyValue = i.nextElement().get<beans::PropertyValue>(); + m_aMap[aPropertyValue.Name] = aPropertyValue.Value; + } + return true; + } + + SAL_WARN("svl", "SfxGrabBagItem::PutValue: wrong type"); + return false; +} + +bool SfxGrabBagItem::QueryValue(uno::Any& rVal, sal_uInt8 /*nMemberId*/) const +{ + uno::Sequence<beans::PropertyValue> aValue(m_aMap.size()); + beans::PropertyValue* pValue = aValue.getArray(); + for (std::map<OUString, com::sun::star::uno::Any>::const_iterator i = m_aMap.begin(); i != m_aMap.end(); ++i) + { + pValue[0].Name = i->first; + pValue[0].Value = i->second; + ++pValue; + } + rVal = uno::makeAny(aValue); + return true; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
