sw/source/core/docnode/nodedump.cxx | 23 +++ writerfilter/source/dmapper/DomainMapper.cxx | 43 +++++ writerfilter/source/ooxml/model.xml | 194 ++++++--------------------- 3 files changed, 102 insertions(+), 158 deletions(-)
New commits: commit 3820a1611b399a318c86a41c3355d6887a4dd1b4 Author: Miklos Vajna <[email protected]> Date: Fri Aug 8 15:18:01 2014 +0200 DOCX import: handle date SDT in headers/footers Turns out form controls are not allowed in headers/footers (see the comment in the patch), so if that happens, then just fall back to what we already do for other SDT types. Change-Id: Icc79c2a825e9eb2a85980489812a4178fde37576 diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 40c3afa..0da5178 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -944,7 +944,10 @@ void DomainMapper::lcl_attribute(Id nName, Value & val) m_pImpl->m_pSdtHelper->getDropDownItems().push_back(sStringValue); break; case NS_ooxml::LN_CT_SdtDate_fullDate: - m_pImpl->m_pSdtHelper->getDate().append(sStringValue); + if (!IsInHeaderFooter()) + m_pImpl->m_pSdtHelper->getDate().append(sStringValue); + else + m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_fullDate", sStringValue); break; case NS_ooxml::LN_CT_Background_color: m_pImpl->m_oBackgroundColor.reset(nIntValue); @@ -2351,19 +2354,44 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) break; case NS_ooxml::LN_CT_SdtPr_date: { - writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps(); - if (pProperties.get() != NULL) - pProperties->resolve(*this); + if (!IsInHeaderFooter()) + resourcemodel::resolveSprmProps(*this, rSprm); + else + { + OUString sName = "ooxml::CT_SdtPr_date"; + enableInteropGrabBag(sName); + resourcemodel::resolveSprmProps(*this, rSprm); + m_pImpl->m_pSdtHelper->appendToInteropGrabBag(getInteropGrabBag()); + m_pImpl->disableInteropGrabBag(); + } } break; case NS_ooxml::LN_CT_SdtDate_dateFormat: { - m_pImpl->m_pSdtHelper->getDateFormat().append(sStringValue); + if (!IsInHeaderFooter()) + m_pImpl->m_pSdtHelper->getDateFormat().append(sStringValue); + else + m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_dateFormat", sStringValue); + } + break; + case NS_ooxml::LN_CT_SdtDate_storeMappedDataAs: + { + if (IsInHeaderFooter()) + m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_storeMappedDataAs", sStringValue); + } + break; + case NS_ooxml::LN_CT_SdtDate_calendar: + { + if (IsInHeaderFooter()) + m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_calendar", sStringValue); } break; case NS_ooxml::LN_CT_SdtDate_lid: { - m_pImpl->m_pSdtHelper->getLocale().append(sStringValue); + if (!IsInHeaderFooter()) + m_pImpl->m_pSdtHelper->getLocale().append(sStringValue); + else + m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_lid", sStringValue); } break; case NS_ooxml::LN_CT_SdtPr_dataBinding: @@ -2914,7 +2942,8 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) m_pImpl->m_pSdtHelper->getSdtTexts().append(sText); return; } - else if (!m_pImpl->m_pSdtHelper->getDateFormat().isEmpty()) + // Form controls are not allowed in headers / footers; see sw::DocumentContentOperationsManager::InsertDrawObj() + else if (!m_pImpl->m_pSdtHelper->getDateFormat().isEmpty() && !IsInHeaderFooter()) { /* * Here we assume w:sdt only contains a single text token. We need to commit d1ebad2077d2b2b9edbaec090f38468393874a07 Author: Miklos Vajna <[email protected]> Date: Fri Aug 8 14:55:35 2014 +0200 DOCX import: tokenize CT_SdtDate / storeMappedDataAs and calendar Change-Id: I7d47e7db08637488975b834f7cc72fe1251a14d3 diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index 0c84d0f..9083de0 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -22866,6 +22866,8 @@ <attribute name="fullDate" tokenid="ooxml:CT_SdtDate_fullDate"/> <element name="dateFormat" tokenid="ooxml:CT_SdtDate_dateFormat"/> <element name="lid" tokenid="ooxml:CT_SdtDate_lid"/> + <element name="storeMappedDataAs" tokenid="ooxml:CT_SdtDate_storeMappedDataAs"/> + <element name="calendar" tokenid="ooxml:CT_SdtDate_calendar"/> </resource> <resource name="CT_SdtDocPart" resource="Properties"> <element name="docPartGallery" tokenid="ooxml:CT_SdtDocPart_docPartGallery"/> commit b32539d065be7bc73154a52c6492b10050cadb9b Author: Miklos Vajna <[email protected]> Date: Fri Aug 8 14:09:10 2014 +0200 sw: improve doc model xml dump of SwFmtAnchor Change-Id: Icdfc370c4b525fd43d9d5935ff461534cf535233 diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 159cdcd..e082caf 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -438,9 +438,30 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet) { pWhich = "frame anchor"; const SwFmtAnchor* pAnchor = static_cast<const SwFmtAnchor*>(pItem); + switch (pAnchor->GetAnchorId()) + { + case FLY_AT_PARA: + oValue = "anchor type: at-para"; + break; + case FLY_AS_CHAR: + oValue = "anchor type: as-char"; + break; + case FLY_AT_PAGE: + oValue = "anchor type: at-page"; + break; + case FLY_AT_FLY: + oValue = "anchor type: at-fly"; + break; + case FLY_AT_CHAR: + oValue = "anchor type: at-char"; + break; + default: + oValue = "anchor type: " + OString::number(pAnchor->GetAnchorId()); + break; + } const SwPosition* pPosition = pAnchor->GetCntntAnchor(); if (pPosition) - oValue = "node index: " + OString::number(pPosition->nNode.GetNode().GetIndex()) + ", index: " + OString::number(pPosition->nContent.GetIndex()); + oValue = *oValue + ", node index: " + OString::number(pPosition->nNode.GetNode().GetIndex()) + ", index: " + OString::number(pPosition->nContent.GetIndex()); break; } case RES_SURROUND: commit 2ba698a293cd20e25da2f8417b46d3d9ec32a9b7 Author: Miklos Vajna <[email protected]> Date: Fri Aug 8 10:38:42 2014 +0200 Unused param elements Change-Id: Iaefcd143eea3a09040cc0b6aa5d07b2d131e525c diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml index e2479ab..0c84d0f 100644 --- a/writerfilter/source/ooxml/model.xml +++ b/writerfilter/source/ooxml/model.xml @@ -1163,27 +1163,16 @@ <include href="dml-shapeEffects.rng"/> <include href="dml-shapeLineProperties.rng"/> <define name="ST_TextPoint"> - <data type="int"> - <param name="minInclusive">-400000</param> - <param name="maxInclusive">400000</param> - </data> + <data type="int"/> </define> <define name="ST_TextNonNegativePoint"> - <data type="int"> - <param name="minInclusive">0</param> - <param name="maxInclusive">400000</param> - </data> + <data type="int"/> </define> <define name="ST_TextFontSize"> - <data type="int"> - <param name="minInclusive">100</param> - <param name="maxInclusive">400000</param> - </data> + <data type="int"/> </define> <define name="ST_Panose"> - <data type="hexBinary"> - <param name="length">10</param> - </data> + <data type="hexBinary"/> </define> <define name="ST_TextTypeface"> <data type="string"/> @@ -3125,19 +3114,13 @@ </attribute> </define> <define name="ST_Coordinate"> - <data type="long"> - <param name="minInclusive">-27273042329600</param> - <param name="maxInclusive">27273042316900</param> - </data> + <data type="long"/> </define> <define name="ST_Coordinate32"> <data type="int"/> </define> <define name="ST_PositiveCoordinate"> - <data type="long"> - <param name="minInclusive">0</param> - <param name="maxInclusive">27273042316900</param> - </data> + <data type="long"/> </define> <define name="ST_PositiveCoordinate32"> <empty/> @@ -3335,9 +3318,7 @@ </attribute> </define> <define name="ST_HexBinary3"> - <data type="hexBinary"> - <param name="length">3</param> - </data> + <data type="hexBinary"/> </define> <define name="CT_SRgbColor"> <zeroOrMore> @@ -3940,9 +3921,7 @@ </choice> </define> <define name="ST_Guid"> - <data type="token"> - <param name="pattern">\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}</param> - </data> + <data type="token"/> </define> <define name="EG_ColorChoice"> <choice> @@ -5118,51 +5097,28 @@ </define> <define name="ST_PositiveCoordinate"> - <data type="long"> - <param name="minInclusive">0</param> - <param name="maxInclusive">27273042316900</param> - </data> + <data type="long"/> </define> <define name="ST_HexColorRGB"> - <data type="hexBinary"> - <param name="length">3</param> - </data> + <data type="hexBinary"/> </define> <define name="ST_PositiveFixedPercentage"> - <data type="long"> - <param name="minInclusive">0</param> - <param name="maxInclusive">27273042316900</param> - </data> + <data type="long"/> </define> <define name="ST_PositivePercentage"> - <data type="long"> - <param name="minInclusive">0</param> - <param name="maxInclusive">27273042316900</param> - </data> + <data type="long"/> </define> <define name="ST_Percentage"> - <data type="long"> - <param name="minInclusive">0</param> - <param name="maxInclusive">27273042316900</param> - </data> + <data type="long"/> </define> <define name="ST_PositiveFixedAngle"> - <data type="int"> - <param name="minInclusive">0</param> - <param name="maxInclusive">21600000</param> - </data> + <data type="int"/> </define> <define name="ST_FixedAngle"> - <data type="int"> - <param name="minInclusive">-5400000</param> - <param name="maxInclusive">5400000</param> - </data> + <data type="int"/> </define> <define name="ST_LineWidth"> - <data type="int"> - <param name="minInclusive">0</param> - <param name="maxInclusive">20116800</param> - </data> + <data type="int"/> </define> <define name="ST_UnsignedDecimalNumber"> <data type="unsignedLong"/> @@ -6254,46 +6210,25 @@ <grammar xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2006/xpath-functions" xmlns="http://relaxng.org/ns/structure/1.0" ns="http://schemas.microsoft.com/office/drawingml/2010/main" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> <!-- Simple types --> <define name="ST_ArtisticEffectParam10"> - <data type="integer"> - <param name="minInclusive">0</param> - <param name="maxInclusive">10</param> - </data> + <data type="integer"/> </define> <define name="ST_ArtisticEffectParam100"> - <data type="integer"> - <param name="minInclusive">0</param> - <param name="maxInclusive">100</param> - </data> + <data type="integer"/> </define> <define name="ST_ArtisticEffectParam4"> - <data type="integer"> - <param name="minInclusive">0</param> - <param name="maxInclusive">4</param> - </data> + <data type="integer"/> </define> <define name="ST_ArtisticEffectParam6"> - <data type="integer"> - <param name="minInclusive">0</param> - <param name="maxInclusive">6</param> - </data> + <data type="integer"/> </define> <define name="ST_ColorTemperature"> - <data type="integer"> - <param name="minInclusive">1500</param> - <param name="maxInclusive">11500</param> - </data> + <data type="integer"/> </define> <define name="ST_LegacySpreadsheetColorIndex"> - <data type="integer"> - <param name="minInclusive">0</param> - <param name="maxInclusive">80</param> - </data> + <data type="integer"/> </define> <define name="ST_SaturationAmount"> - <data type="integer"> - <param name="minInclusive">0</param> - <param name="maxInclusive">400000</param> - </data> + <data type="integer"/> </define> <!-- Complex types for effects --> @@ -7753,9 +7688,7 @@ <data type="unsignedInt"/> </define> <define name="ST_EditId"> - <data type="hexBinary"> - <param name="length">4</param> - </data> + <data type="hexBinary"/> </define> <define name="CT_Inline"> <group> @@ -8322,10 +8255,7 @@ <include href="wml.rng"/> <!-- start = mathPr | oMathPara | oMath --> <define name="ST_Integer255"> - <data type="integer"> - <param name="minInclusive">1</param> - <param name="maxInclusive">255</param> - </data> + <data type="integer"/> </define> <define name="CT_Integer255"> <attribute name="val"> @@ -8333,10 +8263,7 @@ </attribute> </define> <define name="ST_Integer2"> - <data type="integer"> - <param name="minInclusive">-2</param> - <param name="maxInclusive">2</param> - </data> + <data type="integer"/> </define> <define name="CT_Integer2"> <attribute name="val"> @@ -8344,10 +8271,7 @@ </attribute> </define> <define name="ST_SpacingRule"> - <data type="integer"> - <param name="minInclusive">0</param> - <param name="maxInclusive">4</param> - </data> + <data type="integer"/> </define> <define name="CT_SpacingRule"> <attribute name="val"> @@ -8363,9 +8287,7 @@ </attribute> </define> <define name="ST_Char"> - <data type="string"> - <param name="maxLength">1</param> - </data> + <data type="string"/> </define> <define name="CT_Char"> <attribute name="val"> @@ -12635,9 +12557,7 @@ </choice> </define> <define name="ST_Guid"> - <data type="token"> - <param name="pattern">\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}</param> - </data> + <data type="token"/> </define> <define name="ST_RelationshipId"> <data type="string"/> @@ -13213,9 +13133,7 @@ </attribute> </define> <define name="ST_LongHexNumber"> - <data type="hexBinary"> - <param name="length">4</param> - </data> + <data type="hexBinary"/> </define> <define name="CT_LongHexNumber"> <attribute name="val"> @@ -13223,9 +13141,7 @@ </attribute> </define> <define name="ST_ShortHexNumber"> - <data type="hexBinary"> - <param name="length">2</param> - </data> + <data type="hexBinary"/> </define> <define name="CT_ShortHexNumber"> <attribute name="val"> @@ -13233,9 +13149,7 @@ </attribute> </define> <define name="ST_UcharHexNumber"> - <data type="hexBinary"> - <param name="length">1</param> - </data> + <data type="hexBinary"/> </define> <define name="CT_UcharHexNumber"> <attribute name="val"> @@ -13297,9 +13211,7 @@ <data type="dateTime"/> </define> <define name="ST_MacroName"> - <data type="string"> - <param name="maxLength">33</param> - </data> + <data type="string"/> </define> <define name="CT_MacroName"> <attribute name="val"> @@ -13321,10 +13233,7 @@ </attribute> </define> <define name="ST_TextScale"> - <data type="integer"> - <param name="minInclusive">0</param> - <param name="maxInclusive">600</param> - </data> + <data type="integer"/> </define> <define name="CT_TextScale"> <attribute name="val"> @@ -13381,9 +13290,7 @@ </list> </define> <define name="ST_HexColorRGB"> - <data type="hexBinary"> - <param name="length">3</param> - </data> + <data type="hexBinary"/> </define> <define name="ST_HexColor"> <choice> @@ -13413,9 +13320,7 @@ </optional> </define> <define name="ST_LangCode"> - <data type="hexBinary"> - <param name="length">2</param> - </data> + <data type="hexBinary"/> </define> <define name="ST_Lang"> <choice> @@ -13430,9 +13335,7 @@ </attribute> </define> <define name="ST_Guid"> - <data type="token"> - <param name="pattern">\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}</param> - </data> + <data type="token"/> </define> <define name="CT_Guid"> <attribute name="val"> @@ -15557,19 +15460,13 @@ </choice> </define> <define name="ST_FFHelpTextVal"> - <data type="string"> - <param name="maxLength">256</param> - </data> + <data type="string"/> </define> <define name="ST_FFStatusTextVal"> - <data type="string"> - <param name="maxLength">140</param> - </data> + <data type="string"/> </define> <define name="ST_FFName"> - <data type="string"> - <param name="maxLength">65</param> - </data> + <data type="string"/> </define> <define name="ST_FFTextType"> <choice> @@ -18026,10 +17923,7 @@ </oneOrMore> </define> <define name="ST_Cnf"> - <data type="string"> - <param name="length">12</param> - <param name="pattern">[01]*</param> - </data> + <data type="string"/> </define> <define name="CT_Cnf"> <attribute name="val"> @@ -20596,9 +20490,7 @@ </zeroOrMore> </define> <define name="ST_Panose"> - <data type="hexBinary"> - <param name="length">10</param> - </data> + <data type="hexBinary"/> </define> <define name="CT_Panose"> <attribute name="val"> _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
