summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx5
-rw-r--r--writerfilter/source/dmapper/ModelEventListener.cxx10
-rw-r--r--writerfilter/source/dmapper/ModelEventListener.hxx4
-rw-r--r--writerfilter/source/dmapper/SdtHelper.cxx6
-rw-r--r--writerfilter/source/dmapper/SdtHelper.hxx4
5 files changed, 24 insertions, 5 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 3defa796127e..d0b60d474fdc 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 88cba6755024..899ea66a60f5 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 957af5fa4804..502fdda77650 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 e773ff986508..5f5a1e4f8b90 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 72a0096bd1c7..a830b2582d30 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();