[Libreoffice-commits] core.git: Branch 'distro/suse/suse-3.6' - 2 commits - writerfilter/source
Miklos Vajna
vmiklos at suse.cz
Wed Jun 5 04:11:17 PDT 2013
writerfilter/source/dmapper/DomainMapper.cxx | 10 ++++++----
writerfilter/source/dmapper/ModelEventListener.cxx | 10 ++++++++--
writerfilter/source/dmapper/ModelEventListener.hxx | 4 +++-
writerfilter/source/dmapper/SdtHelper.cxx | 6 ++++++
writerfilter/source/dmapper/SdtHelper.hxx | 4 ++++
5 files changed, 27 insertions(+), 7 deletions(-)
New commits:
commit 82d52b5af7b7cabc546acd90f0b77508ffae1f51
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Jun 5 11:22:33 2013 +0200
bnc#820509 DOCX import: handle M.d.yyyy date format in w:sdt
Change-Id: Iae233c24a9580ffc8ea4680276161a543171f63c
(cherry picked from commit 58197c3692df0d0fccb5bc7abddaf6d9667565f6)
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index d0b60d4..c91c139 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3380,8 +3380,9 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
break;
case NS_ooxml::LN_CT_SdtDate_dateFormat:
{
- if (sStringValue == "M/d/yyyy")
- // See com/sun/star/awt/UnoControlDateFieldModel.idl, DateFormat; sadly there are no constants for this.
+ // See com/sun/star/awt/UnoControlDateFieldModel.idl, DateFormat; sadly there are no constants for this.
+ if (sStringValue == "M/d/yyyy" || sStringValue == "M.d.yyyy")
+ // Approximate with MM.dd.yyy
m_pImpl->m_pSdtHelper->getDateFormat().reset(8);
else
{
commit 5e9eeafc4364f63a353d3a6099db4a73519c4dd8
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Jun 5 10:29:25 2013 +0200
bnc#820509 DOCX import: try harder to disable form design mode
Previously this only worked if we had indexes in the document as well,
but actually these are independent.
Change-Id: I28afa60d2606230c901948d4c1da8f5a7c50a9f7
(cherry picked from commit 3d6a7cf3eb7aa966601cbc019d1ad5fafdddd21f)
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 3defa79..d0b60d4 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -155,11 +155,12 @@ DomainMapper::~DomainMapper()
xEnumeration->nextElement();
}
}
- if( nIndexes )
+ if( nIndexes || m_pImpl->m_pSdtHelper->hasElements())
{
//index update has to wait until first view is created
uno::Reference< document::XEventBroadcaster > xBroadcaster(xIndexesSupplier, uno::UNO_QUERY);
- xBroadcaster->addEventListener(uno::Reference< document::XEventListener >(new ModelEventListener));
+ if (xBroadcaster.is())
+ xBroadcaster->addEventListener(uno::Reference< document::XEventListener >(new ModelEventListener(nIndexes, m_pImpl->m_pSdtHelper->hasElements())));
}
diff --git a/writerfilter/source/dmapper/ModelEventListener.cxx b/writerfilter/source/dmapper/ModelEventListener.cxx
index 88cba67..899ea66 100644
--- a/writerfilter/source/dmapper/ModelEventListener.cxx
+++ b/writerfilter/source/dmapper/ModelEventListener.cxx
@@ -47,7 +47,9 @@ using namespace ::com::sun::star;
-ModelEventListener::ModelEventListener()
+ModelEventListener::ModelEventListener(bool bIndexes, bool bControls)
+ : m_bIndexes(bIndexes),
+ m_bControls(bControls)
{
}
@@ -59,7 +61,7 @@ ModelEventListener::~ModelEventListener()
void ModelEventListener::notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException)
{
- if ( rEvent.EventName == "OnFocus" )
+ if ( rEvent.EventName == "OnFocus" && m_bIndexes)
{
try
{
@@ -110,6 +112,10 @@ void ModelEventListener::notifyEvent( const document::EventObject& rEvent ) thro
{
SAL_WARN("writerfilter", "exception while updating indexes: " << rEx.Message);
}
+ }
+
+ if ( rEvent.EventName == "OnFocus" && m_bControls)
+ {
// Form design mode is enabled by default in Writer, not in Word.
uno::Reference<frame::XModel> xModel(rEvent.Source, uno::UNO_QUERY);
diff --git a/writerfilter/source/dmapper/ModelEventListener.hxx b/writerfilter/source/dmapper/ModelEventListener.hxx
index 957af5f..502fdda 100644
--- a/writerfilter/source/dmapper/ModelEventListener.hxx
+++ b/writerfilter/source/dmapper/ModelEventListener.hxx
@@ -39,8 +39,10 @@ namespace dmapper{
class WRITERFILTER_DLLPRIVATE ModelEventListener :
public cppu::WeakImplHelper1< ::com::sun::star::document::XEventListener >
{
+ bool m_bIndexes;
+ bool m_bControls;
public:
- ModelEventListener();
+ ModelEventListener(bool bIndexes, bool bControls);
~ModelEventListener();
virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index e773ff9..5f5a1e4 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -111,6 +111,7 @@ void SdtHelper::createControlShape(awt::Size aSize, uno::Reference<awt::XControl
uno::Reference<text::XTextContent> xTextContent(xControlShape, uno::UNO_QUERY);
m_rDM_Impl.appendTextContent(xTextContent, uno::Sequence< beans::PropertyValue >());
+ m_bHasElements = true;
}
std::vector<rtl::OUString>& SdtHelper::getDropDownItems()
@@ -128,6 +129,11 @@ boost::optional<sal_Int16>& SdtHelper::getDateFormat()
return m_oDateFormat;
}
+bool SdtHelper::hasElements()
+{
+ return m_bHasElements;
+}
+
} // namespace dmapper
} // namespace writerfilter
diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx
index 72a0096..a830b25 100644
--- a/writerfilter/source/dmapper/SdtHelper.hxx
+++ b/writerfilter/source/dmapper/SdtHelper.hxx
@@ -44,6 +44,8 @@ namespace writerfilter {
/// Date format, see com/sun/star/awt/UnoControlDateFieldModel.idl
boost::optional<sal_Int16> m_oDateFormat;
+ bool m_bHasElements;
+
/// Create and append the drawing::XControlShape, containing the various models.
void createControlShape(com::sun::star::awt::Size aSize, com::sun::star::uno::Reference<com::sun::star::awt::XControlModel>);
public:
@@ -53,6 +55,8 @@ namespace writerfilter {
std::vector<rtl::OUString>& getDropDownItems();
rtl::OUStringBuffer& getSdtTexts();
boost::optional<sal_Int16>& getDateFormat();
+ /// If createControlShape() was ever called.
+ bool hasElements();
/// Create drop-down control from w:sdt's w:dropDownList.
void createDropDownControl();
More information about the Libreoffice-commits
mailing list