[Libreoffice-commits] core.git: editeng/source sd/qa xmloff/inc xmloff/source

2017-03-18 Thread Rosemary Sebastian
 editeng/source/items/flditem.cxx |   15 +--
 sd/qa/unit/data/odp/author_fixed.odp |binary
 sd/qa/unit/export-tests.cxx  |   19 +++
 xmloff/inc/txtfldi.hxx   |4 
 xmloff/source/text/txtflde.cxx   |7 +--
 xmloff/source/text/txtfldi.cxx   |   10 ++
 6 files changed, 47 insertions(+), 8 deletions(-)

New commits:
commit 109210e5b71a4e0b6fcaae72be7ef8d7667f3708
Author: Rosemary Sebastian 
Date:   Sat Mar 18 08:46:27 2017 +

Revert "Revert "Implement export and import of author field in fixed 
format""

This reverts commit cae16645e17df6a1f87443c00b6abfd26dabd27f.

Change-Id: If5b85beb53a0925909d537023879a7d86fa011cf
Reviewed-on: https://gerrit.libreoffice.org/35391
Tested-by: Jenkins 
Reviewed-by: Rosemary Sebastian 
Tested-by: Rosemary Sebastian 

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 1d5ba3fa784e..690425594227 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -181,13 +181,16 @@ SvxFieldData* SvxFieldData::Create(const 
uno::Reference& xTe
 SvxAuthorField* pData = new SvxAuthorField(
 aFirstName, aLastName, OUString(), bIsFixed ? 
SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR);
 
-if (!bFullName)
+if (!bIsFixed)
 {
-pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
-}
-else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
-{
-pData->SetFormat(static_cast(nFmt));
+if (!bFullName)
+{
+pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
+}
+else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
+{
+
pData->SetFormat(static_cast(nFmt));
+}
 }
 
 return pData;
diff --git a/sd/qa/unit/data/odp/author_fixed.odp 
b/sd/qa/unit/data/odp/author_fixed.odp
new file mode 100644
index ..2e666ad17fee
Binary files /dev/null and b/sd/qa/unit/data/odp/author_fixed.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 797bf36d6192..dd57ec01bf3d 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -92,6 +92,7 @@ public:
 void testTdf62176();
 void testTransparentBackground();
 void testEmbeddedPdf();
+void testAuthorField();
 
 CPPUNIT_TEST_SUITE(SdExportTest);
 
@@ -106,6 +107,7 @@ public:
 CPPUNIT_TEST(testTdf62176);
 CPPUNIT_TEST(testTransparentBackground);
 CPPUNIT_TEST(testEmbeddedPdf);
+CPPUNIT_TEST(testAuthorField);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -552,6 +554,23 @@ void SdExportTest::testEmbeddedPdf()
 #endif
 }
 
+void SdExportTest::testAuthorField()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), 
ODP);
+
+xDocShRef = saveAndReload( xDocShRef.get(), ODP );
+
+uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 
0, xDocShRef);
+CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+uno::Reference< beans::XPropertySet > xPropSet( xField, 
uno::UNO_QUERY_THROW );
+bool bFixed = false;
+xPropSet->getPropertyValue("IsFixed") >>= bFixed;
+CPPUNIT_ASSERT_MESSAGE("Author field is not fixed", bFixed);
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 106545c34503..ed154c72ffe0 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -234,6 +234,10 @@ protected:
 virtual void StartElement(
 const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) 
override;
 
+/// process attribute values
+virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+   const OUString& sAttrValue ) override;
+
 /// prepare XTextField for insertion into document
 virtual void PrepareField(
 const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) 
override;
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 4692856b96e2..91dba974616d 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1055,8 +1055,11 @@ void XMLTextFieldExport::ExportFieldHelper(
 switch (nToken) {
 case FIELD_ID_AUTHOR:
 // author field: fixed, field (sub-)type
-ProcessBoolean(XML_FIXED,
-   GetBoolProperty(sPropertyIsFixed, 

[Libreoffice-commits] core.git: editeng/source sd/qa xmloff/inc xmloff/source

2017-03-16 Thread Rosemary Sebastian
 dev/null |binary
 editeng/source/items/flditem.cxx |   15 ++-
 sd/qa/unit/export-tests.cxx  |   19 ---
 xmloff/inc/txtfldi.hxx   |4 
 xmloff/source/text/txtflde.cxx   |7 ++-
 xmloff/source/text/txtfldi.cxx   |   10 --
 6 files changed, 8 insertions(+), 47 deletions(-)

New commits:
commit cae16645e17df6a1f87443c00b6abfd26dabd27f
Author: Rosemary Sebastian 
Date:   Thu Mar 16 15:25:26 2017 +

Revert "Implement export and import of author field in fixed format"

This reverts commit 5de40734af30a8b897c6c5b7f681759e36a25557.

Change-Id: Ib09fb1dc54066cadcd9503c92140d78e7482ae6c
Reviewed-on: https://gerrit.libreoffice.org/35281
Reviewed-by: Rosemary Sebastian 
Tested-by: Rosemary Sebastian 

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 690425594227..1d5ba3fa784e 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -181,16 +181,13 @@ SvxFieldData* SvxFieldData::Create(const 
uno::Reference& xTe
 SvxAuthorField* pData = new SvxAuthorField(
 aFirstName, aLastName, OUString(), bIsFixed ? 
SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR);
 
-if (!bIsFixed)
+if (!bFullName)
 {
-if (!bFullName)
-{
-pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
-}
-else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
-{
-
pData->SetFormat(static_cast(nFmt));
-}
+pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
+}
+else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
+{
+pData->SetFormat(static_cast(nFmt));
 }
 
 return pData;
diff --git a/sd/qa/unit/data/odp/author_fixed.odp 
b/sd/qa/unit/data/odp/author_fixed.odp
deleted file mode 100644
index 2e666ad17fee..
Binary files a/sd/qa/unit/data/odp/author_fixed.odp and /dev/null differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index dd57ec01bf3d..797bf36d6192 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -92,7 +92,6 @@ public:
 void testTdf62176();
 void testTransparentBackground();
 void testEmbeddedPdf();
-void testAuthorField();
 
 CPPUNIT_TEST_SUITE(SdExportTest);
 
@@ -107,7 +106,6 @@ public:
 CPPUNIT_TEST(testTdf62176);
 CPPUNIT_TEST(testTransparentBackground);
 CPPUNIT_TEST(testEmbeddedPdf);
-CPPUNIT_TEST(testAuthorField);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -554,23 +552,6 @@ void SdExportTest::testEmbeddedPdf()
 #endif
 }
 
-void SdExportTest::testAuthorField()
-{
-::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), 
ODP);
-
-xDocShRef = saveAndReload( xDocShRef.get(), ODP );
-
-uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 
0, xDocShRef);
-CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
-
-uno::Reference< beans::XPropertySet > xPropSet( xField, 
uno::UNO_QUERY_THROW );
-bool bFixed = false;
-xPropSet->getPropertyValue("IsFixed") >>= bFixed;
-CPPUNIT_ASSERT_MESSAGE("Author field is not fixed", bFixed);
-
-xDocShRef->DoClose();
-}
-
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index ed154c72ffe0..106545c34503 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -234,10 +234,6 @@ protected:
 virtual void StartElement(
 const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) 
override;
 
-/// process attribute values
-virtual void ProcessAttribute( sal_uInt16 nAttrToken,
-   const OUString& sAttrValue ) override;
-
 /// prepare XTextField for insertion into document
 virtual void PrepareField(
 const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) 
override;
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 91dba974616d..4692856b96e2 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1055,11 +1055,8 @@ void XMLTextFieldExport::ExportFieldHelper(
 switch (nToken) {
 case FIELD_ID_AUTHOR:
 // author field: fixed, field (sub-)type
-if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
-{
-GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_FIXED,
- 

[Libreoffice-commits] core.git: editeng/source sd/qa xmloff/inc xmloff/source

2017-03-09 Thread Rosemary Sebastian
 editeng/source/items/flditem.cxx |   15 +--
 sd/qa/unit/data/odp/author_fixed.odp |binary
 sd/qa/unit/export-tests.cxx  |   19 +++
 xmloff/inc/txtfldi.hxx   |4 
 xmloff/source/text/txtflde.cxx   |7 +--
 xmloff/source/text/txtfldi.cxx   |   10 ++
 6 files changed, 47 insertions(+), 8 deletions(-)

New commits:
commit 5de40734af30a8b897c6c5b7f681759e36a25557
Author: Rosemary Sebastian 
Date:   Wed Jan 25 12:56:47 2017 +0530

Implement export and import of author field in fixed format

Change-Id: I1975bfcdc8436f2b05e2fab2a4c9c09838330b30
Reviewed-on: https://gerrit.libreoffice.org/33520
Tested-by: Jenkins 
Reviewed-by: Rosemary Sebastian 

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 1d5ba3f..6904255 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -181,13 +181,16 @@ SvxFieldData* SvxFieldData::Create(const 
uno::Reference& xTe
 SvxAuthorField* pData = new SvxAuthorField(
 aFirstName, aLastName, OUString(), bIsFixed ? 
SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR);
 
-if (!bFullName)
+if (!bIsFixed)
 {
-pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
-}
-else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
-{
-pData->SetFormat(static_cast(nFmt));
+if (!bFullName)
+{
+pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
+}
+else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
+{
+
pData->SetFormat(static_cast(nFmt));
+}
 }
 
 return pData;
diff --git a/sd/qa/unit/data/odp/author_fixed.odp 
b/sd/qa/unit/data/odp/author_fixed.odp
new file mode 100644
index 000..2e666ad
Binary files /dev/null and b/sd/qa/unit/data/odp/author_fixed.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 797bf36..dd57ec0 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -92,6 +92,7 @@ public:
 void testTdf62176();
 void testTransparentBackground();
 void testEmbeddedPdf();
+void testAuthorField();
 
 CPPUNIT_TEST_SUITE(SdExportTest);
 
@@ -106,6 +107,7 @@ public:
 CPPUNIT_TEST(testTdf62176);
 CPPUNIT_TEST(testTransparentBackground);
 CPPUNIT_TEST(testEmbeddedPdf);
+CPPUNIT_TEST(testAuthorField);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -552,6 +554,23 @@ void SdExportTest::testEmbeddedPdf()
 #endif
 }
 
+void SdExportTest::testAuthorField()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), 
ODP);
+
+xDocShRef = saveAndReload( xDocShRef.get(), ODP );
+
+uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 
0, xDocShRef);
+CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+uno::Reference< beans::XPropertySet > xPropSet( xField, 
uno::UNO_QUERY_THROW );
+bool bFixed = false;
+xPropSet->getPropertyValue("IsFixed") >>= bFixed;
+CPPUNIT_ASSERT_MESSAGE("Author field is not fixed", bFixed);
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 106545c..ed154c7 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -234,6 +234,10 @@ protected:
 virtual void StartElement(
 const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) 
override;
 
+/// process attribute values
+virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+   const OUString& sAttrValue ) override;
+
 /// prepare XTextField for insertion into document
 virtual void PrepareField(
 const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) 
override;
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 4037bab..72dc79a 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1067,8 +1067,11 @@ void XMLTextFieldExport::ExportFieldHelper(
 switch (nToken) {
 case FIELD_ID_AUTHOR:
 // author field: fixed, field (sub-)type
-ProcessBoolean(XML_FIXED,
-   GetBoolProperty(sPropertyIsFixed, rPropSet), true);
+if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
+{
+GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_FIXED,
+