[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 4 commits - .gitreview sw/qa writerfilter/source
Miklos Vajna
vmiklos at suse.cz
Wed Jun 5 03:27:01 PDT 2013
.gitreview | 2 +-
sw/qa/extras/ooxmlimport/data/n820509.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 19 +++++++++++++++++++
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 ++++
8 files changed, 47 insertions(+), 8 deletions(-)
New commits:
commit c9445b1924d0dffd410dcb35ad4f108960d41c40
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Jun 5 11:44:10 2013 +0200
bnc#820509 testcase
(cherry picked from commit a9e0ec2b87a99c93b77a210a916b4df44ece454a)
Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
Change-Id: Iee9909e9c42014ab10ceaa2f8f8e554c25e89157
diff --git a/sw/qa/extras/ooxmlimport/data/n820509.docx b/sw/qa/extras/ooxmlimport/data/n820509.docx
new file mode 100755
index 0000000..a6da1e1
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n820509.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index b38f7cb..aaf9cc9 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/table/ShadowFormat.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/view/XFormLayerAccess.hpp>
#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/table/TableBorder2.hpp>
#include <com/sun/star/text/SizeType.hpp>
@@ -116,6 +117,7 @@ public:
void testPageBackground();
void testWatermark();
void testPageBorderShadow();
+ void testN820509();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -200,6 +202,7 @@ void Test::run()
{"page-background.docx", &Test::testPageBackground},
{"watermark.docx", &Test::testWatermark},
{"page-border-shadow.docx", &Test::testPageBorderShadow},
+ {"n820509.docx", &Test::testN820509},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1426,6 +1429,22 @@ void Test::testPageBorderShadow()
CPPUNIT_ASSERT_EQUAL(sal_Int16(TWIP_TO_MM100(48/8*20)), aShadow.ShadowWidth);
}
+void Test::testN820509()
+{
+ // Design mode was enabled.
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<view::XFormLayerAccess> xFormLayerAccess(xModel->getCurrentController(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(false, bool(xFormLayerAccess->isFormDesignMode()));
+
+ // M.d.yyyy date format was unhandled.
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ uno::Reference<drawing::XControlShape> xControlShape(xDraws->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
+ uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty<sal_Int16>(xPropertySet, "DateFormat"));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
commit 664e6bf7433a97eea8c0a5127d5ce9014d0ab6e0
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 da1ac0e..c39b97a 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3336,8 +3336,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 25e9ead8729e663e22c90f80a26a55a2073c816e
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 e119189..da1ac0e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -143,11 +143,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 8513c27..8da3224 100644
--- a/writerfilter/source/dmapper/ModelEventListener.cxx
+++ b/writerfilter/source/dmapper/ModelEventListener.cxx
@@ -38,7 +38,9 @@ using namespace ::com::sun::star;
-ModelEventListener::ModelEventListener()
+ModelEventListener::ModelEventListener(bool bIndexes, bool bControls)
+ : m_bIndexes(bIndexes),
+ m_bControls(bControls)
{
}
@@ -50,7 +52,7 @@ ModelEventListener::~ModelEventListener()
void ModelEventListener::notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException)
{
- if ( rEvent.EventName == "OnFocus" )
+ if ( rEvent.EventName == "OnFocus" && m_bIndexes)
{
try
{
@@ -101,6 +103,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 0b5cb46..e10be88 100644
--- a/writerfilter/source/dmapper/ModelEventListener.hxx
+++ b/writerfilter/source/dmapper/ModelEventListener.hxx
@@ -30,8 +30,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 35f4d93..031b70f 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<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 d2ce372..814dac0 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<OUString>& getDropDownItems();
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();
commit 3d4b78046e45d9994fa14b0a8d588d2e02a51d78
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Jun 5 12:21:36 2013 +0200
make git review work in this branch
Change-Id: Ib557bee0e1b971a4c2e103d9240991e9104fce69
diff --git a/.gitreview b/.gitreview
index 094c974..1fa62ad 100644
--- a/.gitreview
+++ b/.gitreview
@@ -3,5 +3,5 @@ host=logerrit
port=29418
project=core
defaultremote=logerrit
-defaultbranch=master
+defaultbranch=libreoffice-4-1
More information about the Libreoffice-commits
mailing list