Kaydet (Commit) 06a39e43 authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX import: handle character format of dateTime SDT

Change-Id: Ia8966745b1ed63ae7de2ad0d673faff8b8804d63
üst 07601de4
...@@ -2673,6 +2673,10 @@ void DomainMapper::lcl_startCharacterGroup() ...@@ -2673,6 +2673,10 @@ void DomainMapper::lcl_startCharacterGroup()
m_pImpl->GetTopContext()->Insert(PROP_SDT_END_BEFORE, uno::makeAny(true), true, CHAR_GRAB_BAG); m_pImpl->GetTopContext()->Insert(PROP_SDT_END_BEFORE, uno::makeAny(true), true, CHAR_GRAB_BAG);
m_pImpl->setSdtEndDeferred(false); m_pImpl->setSdtEndDeferred(false);
} }
// Remember formatting of the date control as it only supports plain strings natively.
if (!m_pImpl->m_pSdtHelper->getDateFormat().isEmpty())
enableInteropGrabBag("CharFormat");
} }
void DomainMapper::lcl_endCharacterGroup() void DomainMapper::lcl_endCharacterGroup()
...@@ -2785,7 +2789,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len) ...@@ -2785,7 +2789,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
* create the control early, as in Writer, it's part of the cell, but * create the control early, as in Writer, it's part of the cell, but
* in OOXML, the sdt contains the cell. * in OOXML, the sdt contains the cell.
*/ */
m_pImpl->m_pSdtHelper->createDateControl(sText); m_pImpl->m_pSdtHelper->createDateControl(sText, getInteropGrabBag());
return; return;
} }
else if (!m_pImpl->m_pSdtHelper->isInteropGrabBagEmpty()) else if (!m_pImpl->m_pSdtHelper->isInteropGrabBagEmpty())
......
...@@ -92,7 +92,7 @@ void SdtHelper::createDropDownControl() ...@@ -92,7 +92,7 @@ void SdtHelper::createDropDownControl()
m_aDropDownItems.clear(); m_aDropDownItems.clear();
} }
void SdtHelper::createDateControl(OUString& rContentText) void SdtHelper::createDateControl(OUString& rContentText, beans::PropertyValue aCharFormat)
{ {
uno::Reference<awt::XControlModel> xControlModel(m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.form.component.DateField"), uno::UNO_QUERY); uno::Reference<awt::XControlModel> xControlModel(m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.form.component.DateField"), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xPropertySet(xControlModel, uno::UNO_QUERY);
...@@ -122,7 +122,7 @@ void SdtHelper::createDateControl(OUString& rContentText) ...@@ -122,7 +122,7 @@ void SdtHelper::createDateControl(OUString& rContentText)
xPropertySet->setPropertyValue("HelpText", uno::makeAny(rContentText)); xPropertySet->setPropertyValue("HelpText", uno::makeAny(rContentText));
// append date format to grab bag // append date format to grab bag
uno::Sequence<beans::PropertyValue> aGrabBag(4); uno::Sequence<beans::PropertyValue> aGrabBag(5);
aGrabBag[0].Name = "OriginalDate"; aGrabBag[0].Name = "OriginalDate";
aGrabBag[0].Value = uno::makeAny(aDate); aGrabBag[0].Value = uno::makeAny(aDate);
aGrabBag[1].Name = "OriginalContent"; aGrabBag[1].Name = "OriginalContent";
...@@ -131,6 +131,7 @@ void SdtHelper::createDateControl(OUString& rContentText) ...@@ -131,6 +131,7 @@ void SdtHelper::createDateControl(OUString& rContentText)
aGrabBag[2].Value = uno::makeAny(sDateFormat); aGrabBag[2].Value = uno::makeAny(sDateFormat);
aGrabBag[3].Name = "Locale"; aGrabBag[3].Name = "Locale";
aGrabBag[3].Value = uno::makeAny(m_sLocale.makeStringAndClear()); aGrabBag[3].Value = uno::makeAny(m_sLocale.makeStringAndClear());
aGrabBag[4] = aCharFormat;
std::vector<OUString> aItems; std::vector<OUString> aItems;
createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), rContentText, aItems), xControlModel, aGrabBag); createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), rContentText, aItems), xControlModel, aGrabBag);
......
...@@ -98,7 +98,7 @@ public: ...@@ -98,7 +98,7 @@ public:
/// Create drop-down control from w:sdt's w:dropDownList. /// Create drop-down control from w:sdt's w:dropDownList.
void createDropDownControl(); void createDropDownControl();
/// Create date control from w:sdt's w:date. /// Create date control from w:sdt's w:date.
void createDateControl(OUString& rContentText); void createDateControl(OUString& rContentText, css::beans::PropertyValue aCharFormat);
void appendToInteropGrabBag(com::sun::star::beans::PropertyValue rValue); void appendToInteropGrabBag(com::sun::star::beans::PropertyValue rValue);
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getInteropGrabBagAndClear(); com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getInteropGrabBagAndClear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment