[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source

2022-08-22 Thread Justin Luth (via logerrit)
 include/xmloff/xmlnume.hxx|4 --
 sw/qa/extras/odfexport/data/tdf57317_autoListName.odt |binary
 sw/qa/extras/odfexport/odfexport2.cxx |   31 ++
 xmloff/source/style/xmlnume.cxx   |9 +
 xmloff/source/text/XMLTextListAutoStylePool.cxx   |   20 +++
 xmloff/source/text/txtstyle.cxx   |2 -
 6 files changed, 55 insertions(+), 11 deletions(-)

New commits:
commit 46dc9f3bbac67e9240adc44ab017f905482ef786
Author: Justin Luth 
AuthorDate: Mon Aug 22 12:52:22 2022 -0400
Commit: Justin Luth 
CommitDate: Tue Aug 23 04:09:04 2022 +0200

tdf#57317 odf export: avoid autolist conflict with NumberingStyles

Somehow you can have autoStyles writing into the styles.xml.
Well, the code to prevent duplicates for that needs to exist
for autoStyles written into document.xml as well.

Change-Id: I9602b7023a1ef009ad644374dc5081afb8a76916
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138703
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/include/xmloff/xmlnume.hxx b/include/xmloff/xmlnume.hxx
index 68818f1076ff..85f78047ee80 100644
--- a/include/xmloff/xmlnume.hxx
+++ b/include/xmloff/xmlnume.hxx
@@ -63,9 +63,7 @@ public:
 const css::uno::Reference< css::container::XIndexReplace > & 
xNumRule,
 bool bOutline=false );
 
-void exportStyles( bool bUsed,
-   XMLTextListAutoStylePool *pPool,
-   bool bExportChapterNumbering );
+void exportStyles(bool bUsed, bool bExportChapterNumbering);
 void exportNumberingRule(
 const OUString& rName, bool bIsHidden,
 const css::uno::Reference< css::container::XIndexReplace > & 
xNumRule );
diff --git a/sw/qa/extras/odfexport/data/tdf57317_autoListName.odt 
b/sw/qa/extras/odfexport/data/tdf57317_autoListName.odt
new file mode 100644
index ..3aafbc519387
Binary files /dev/null and 
b/sw/qa/extras/odfexport/data/tdf57317_autoListName.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index 2a2f015f6b84..5d2f91b92d5d 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -94,6 +94,37 @@ DECLARE_ODFEXPORT_TEST(testTdf143605, "tdf143605.odt")
 CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(getParagraph(1), 
"ListLabelString"));
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf57317_autoListName)
+{
+load(mpTestDocumentPath, "tdf57317_autoListName.odt");
+// The list style (from styles.xml) overrides a duplicate named auto-style
+//uno::Any aNumStyle = getStyles("NumberingStyles")->getByName("L1");
+//CPPUNIT_ASSERT(aNumStyle.hasValue());
+uno::Reference xPara(getParagraph(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(">1<"), getProperty(xPara, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("L1"), getProperty(xPara, 
"NumberingStyleName"));
+
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:DefaultBullet", {});
+
+// This was failing with a duplicate auto numbering style name of L1 
instead of a unique name,
+// thus it was showing the same info as before the bullet modification.
+reload(mpFilter, "");
+xPara.set(getParagraph(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara, 
"ListLabelString"));
+
+uno::Reference 
xLevels(xPara->getPropertyValue("NumberingRules"),
+uno::UNO_QUERY);
+uno::Sequence aProps;
+xLevels->getByIndex(0) >>= aProps;
+for (beans::PropertyValue const& rProp : std::as_const(aProps))
+{
+if (rProp.Name == "BulletChar")
+return;
+}
+CPPUNIT_FAIL("no BulletChar property");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testListFormatDocx)
 {
 loadAndReload("listformat.docx");
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index 682fc648af41..9ec9350374db 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -782,9 +782,7 @@ void SvxXMLNumRuleExport::exportOutline()
 }
 }
 
-void SvxXMLNumRuleExport::exportStyles( bool bUsed,
-XMLTextListAutoStylePool *pPool,
-bool bExportChapterNumbering )
+void SvxXMLNumRuleExport::exportStyles( bool bUsed, bool 
bExportChapterNumbering )
 {
 if( bExportChapterNumbering )
 exportOutline();
@@ -821,11 +819,8 @@ void SvxXMLNumRuleExport::exportStyles( bool bUsed,
 xStyles->getByIndex( i ) >>= xStyle;
 
 if( !bUsed || xStyle->isInUse() )
-{
 exportStyle( xStyle );
-if( pPool )
-pPool->RegisterName( xStyle->getName() );
-}
+
 }
 }
 
diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx 

[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source

2022-07-13 Thread Mike Kaganski (via logerrit)
 include/xmloff/txtparae.hxx |9 
 sw/qa/uitest/data/hyperlink_multiple_spans.fodt |   44 +++
 sw/qa/uitest/navigator/tdf148198.py |   61 +
 xmloff/source/text/txtflde.cxx  |   35 --
 xmloff/source/text/txtftne.cxx  |   30 --
 xmloff/source/text/txtparae.cxx |  288 +---
 6 files changed, 276 insertions(+), 191 deletions(-)

New commits:
commit 9f4af852c4050d45bb5ab314480fc83639bea90a
Author: Mike Kaganski 
AuthorDate: Wed Jul 13 11:37:30 2022 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jul 14 07:43:14 2022 +0200

tdf#148198: merge identical hyperlinks of adjacent text ranges on ODF export

The true hyperlink boundaries are available as SwpHints starts/ends, which 
are used
in DOC(X) export (see SwWW8AttrIter::OutAttrWithRange).

However, I don't see a reasonable way to expose this information to xmloff, 
so I
decided instead to just merge the identical hyperlink properties of 
adjacent ranges
into a single hyperlink. This will allow to fix already split hyperlinks 
saved in
previous versions. The downside is that this disallows to have separate 
adjacent
identical hyperlinks - I hope that this would not be a real issue.

Change-Id: I901e6035a5e89bc515b5742c6a5f564c77faf05b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137013
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
index 546bf2adca3c..e474a9c5b763 100644
--- a/include/xmloff/txtparae.hxx
+++ b/include/xmloff/txtparae.hxx
@@ -50,7 +50,7 @@ namespace com::sun::star
 {
 namespace beans { class XPropertySet; class XPropertyState;
   class XPropertySetInfo; }
-namespace container { class XEnumeration; class XIndexAccess; }
+namespace container { class XEnumeration; class XIndexAccess; class 
XNameReplace; }
 namespace text { class XTextContent; class XTextRange; class XText;
  class XFootnote; class XTextFrame; class XTextSection;
  class XTextField; }
@@ -182,16 +182,11 @@ public:
 return xRubyPropMapper;
 }
 
-OUString FindTextStyleAndHyperlink(
+OUString FindTextStyle(
 const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
-bool& rbHyperlink,
 bool& rbHasCharStyle,
 bool& rbHasAutoStyle,
 const XMLPropertyState** pAddState = nullptr) const;
-bool addHyperlinkAttributes(
-const css::uno::Reference< css::beans::XPropertySet > & rPropSet,
-const css::uno::Reference< css::beans::XPropertyState > & rPropState,
-const css::uno::Reference< css::beans::XPropertySetInfo > & 
rPropSetInfo );
 
 void exportTextRangeEnumeration(
 const css::uno::Reference< css::container::XEnumeration > & rRangeEnum,
diff --git a/sw/qa/uitest/data/hyperlink_multiple_spans.fodt 
b/sw/qa/uitest/data/hyperlink_multiple_spans.fodt
new file mode 100644
index ..bdf405ffd39d
--- /dev/null
+++ b/sw/qa/uitest/data/hyperlink_multiple_spans.fodt
@@ -0,0 +1,44 @@
+
+
+http://www.w3.org/1999/xlink; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:officeooo="http://openoffice.org/2009/office; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+   
+  
+  
+  
+   
+  
+  
+ 
+ 
+  
+   
+  
+  
+   
+   
+  
+ 
+ 
+  
+   This is a 
bookmark
+   
+   No hyperlink; a hyperlink with an 
anchor
+  
+   text
+  
+ , different character 
styles, a footnote1
+A footnote, 
a field This is a bookmark, and a rsid; no hyperlink; another 
hyperlink; no hyperlink
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/uitest/navigator/tdf148198.py 
b/sw/qa/uitest/navigator/tdf148198.py
new file mode 100644
index ..d273bb6b5e2b
--- /dev/null
+++ b/sw/qa/uitest/navigator/tdf148198.py
@@ -0,0 +1,61 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+class tdf148198(UITestCase):
+
+def test_tdf148198(self):
+

[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source

2020-06-11 Thread Maxim Monastirsky (via logerrit)
 include/xmloff/xmlnumfi.hxx   |2 ++
 sw/qa/extras/odfimport/data/tdf133459.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx  |   30 ++
 xmloff/source/core/xmlimp.cxx |5 +++--
 xmloff/source/style/xmlnumfi.cxx  |   16 ++--
 5 files changed, 49 insertions(+), 4 deletions(-)

New commits:
commit cd0dc1bc592d7952c36659da33d99ab964fe2e93
Author: Maxim Monastirsky 
AuthorDate: Wed Jun 10 22:01:24 2020 +0300
Commit: Maxim Monastirsky 
CommitDate: Thu Jun 11 23:07:46 2020 +0200

tdf#133459 Fix import of fields with user defined number formats

commit 59ace23c367f83491a37e844d16f7d716eff6346 ("tdf#101710 Fix
invalid style:data-style-name attribute") had a side effect of
exporting user defined number formats under  instead
of under  (which is valid, and what Calc
does since forever). As it turned out, this didn't work well for
fields:

- For fields inside headers or footers, their number format wasn't
imported at all. The reason here is that fields use the
XMLTextImportHelper::GetDataStyleKey method to resolve data styles,
and that method checks only automatic styles. Actually it resolves
also styles from , because SvXMLImport::SetAutoStyles
has a special code that merges styles from  into
automatic styles during content.xml reading. The problem is that
headers and footers have their contents stored inside styles.xml,
and no merging happens at this stage (unless it's a flat odf file).
One way to solve this could be to explicitly check for styles from
 in XMLTextImportHelper::GetDataStyleKey (e.g. see
previous gerrit patchsets, or XMLTableStyleContext::GetNumberFormat)
I chose to simply modify the condition in SvXMLImport::SetAutoStyles,
so that merging happens anyway.

- Fields whose format resolution depends on the merging of
SvXMLImport::SetAutoStyles, did import the number format itself,
but not its language setting. This can be in one of three ways:
(a) Fields in the document and the header, when both use the same
format. In this case the format is stored once in styles.xml, so
at least the consumer from content.xml depends on merging.
(b) Field in the document with a user defined format - a regression
of the above commit. Now stored in styles.xml under 
instead of in content.xml under .
(c) Field in a header with a user defined format - depends
on merging as a result of the above fix.

The reason here is that the merging isn't done with the original
SvXMLNumFormatContext objects, but with a newly created fake ones,
which only have the format id correct (with the assumption that
those formats already imported, and calling code could just find
them by the id). The problem is that the fields code uses
XMLTextImportHelper::GetDataStyleKey to get the language setting
from style objects, and set the IsFixedLanguage property according
to it, while we know that those fake objects don't have the
language correctly set. Try to fix that problem by setting the
correct language on those fake objects.

Change-Id: Ibb362df019921e040708d3bda83bf155535ec7af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95612
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/include/xmloff/xmlnumfi.hxx b/include/xmloff/xmlnumfi.hxx
index 21eac93a3cd9..b337fad36832 100644
--- a/include/xmloff/xmlnumfi.hxx
+++ b/include/xmloff/xmlnumfi.hxx
@@ -91,6 +91,7 @@ public:
 SvXMLNumImpData* getData() { return pData.get(); }
 
 const SvXMLTokenMap&GetStylesElemTokenMap();
+LanguageTypeGetLanguageForKey(sal_Int32 nKey);
 
 //  sal_uInt32  GetKeyForName( const OUString& rName );
 };
@@ -164,6 +165,7 @@ public:
 const OUString& rLName,
 const css::uno::Reference< 
css::xml::sax::XAttributeList>& xAttrList,
 const sal_Int32 nKey,
+LanguageType nLang,
 SvXMLStylesContext& rStyles );
 virtual ~SvXMLNumFormatContext() override;
 
diff --git a/sw/qa/extras/odfimport/data/tdf133459.odt 
b/sw/qa/extras/odfimport/data/tdf133459.odt
new file mode 100644
index ..9468d7918a6c
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf133459.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 30737c3454dd..70d5a158b22c 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -30,6 +30,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -1048,5 +1051,32 @@ DECLARE_ODFIMPORT_TEST(testTdf123968, "tdf123968.odt")
  rStart.GetText());
 }
 

[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source

2018-08-29 Thread Libreoffice Gerrit user
 include/xmloff/txtimp.hxx|6 ++--
 sw/qa/extras/odfexport/data/tdf101856_overlapped.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx |   24 +++
 xmloff/source/text/XMLTextMarkImportContext.cxx  |   10 +++
 xmloff/source/text/txtimp.cxx|   19 +++
 5 files changed, 41 insertions(+), 18 deletions(-)

New commits:
commit 3559daee24ea1224d3d40e6a86b10cf37e18443f
Author: Serge Krot 
AuthorDate: Tue Aug 28 14:32:14 2018 +0200
Commit: Thorsten Behrens 
CommitDate: Thu Aug 30 00:21:23 2018 +0200

tdf#101856 Handle properties of nested bookmarks

Change-Id: I1a92d2001e58751c5bbe41f6480f4c46dcc8c9e7
Reviewed-on: https://gerrit.libreoffice.org/59766
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index c8e060f15d9c..2caeff3ea689 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -712,9 +712,9 @@ public:
 void AddCrossRefHeadingMapping(OUString const& rFrom, OUString const& rTo);
 void MapCrossRefHeadingFieldsHorribly();
 
-void setBookmarkAttributes(bool hidden, OUString const& condition);
-bool getBookmarkHidden();
-const OUString& getBookmarkCondition();
+void setBookmarkAttributes(OUString const& bookmark, bool hidden, OUString 
const& condition);
+bool getBookmarkHidden(OUString const& bookmark) const;
+const OUString& getBookmarkCondition(OUString const& bookmark) const;
 
 };
 
diff --git a/sw/qa/extras/odfexport/data/tdf101856_overlapped.odt 
b/sw/qa/extras/odfexport/data/tdf101856_overlapped.odt
new file mode 100644
index ..c05df538da52
Binary files /dev/null and 
b/sw/qa/extras/odfexport/data/tdf101856_overlapped.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index ef48e648661b..ab993fb28439 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1997,6 +1997,30 @@ DECLARE_ODFEXPORT_TEST(testSpellOutNumberingTypes, 
"spellout-numberingtypes.odt"
 }
 
 // MAILMERGE Add conditional to expand / collapse bookmarks
+DECLARE_ODFEXPORT_TEST(tdf101856_overlapped, "tdf101856_overlapped.odt")
+{
+// get bookmark interface
+uno::Reference xBookmarksSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+uno::Reference 
xBookmarksByName(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+
+// check: we have 2 bookmarks
+CPPUNIT_ASSERT_EQUAL(static_cast(2), 
xBookmarksByIdx->getCount());
+CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkNonHidden"));
+CPPUNIT_ASSERT(xBookmarksByName->hasByName("BookmarkHidden"));
+
+// 
+uno::Reference 
xBookmark1(xBookmarksByName->getByName("BookmarkNonHidden"), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xBookmark1, 
UNO_NAME_BOOKMARK_CONDITION));
+CPPUNIT_ASSERT_EQUAL(false, getProperty(xBookmark1, 
UNO_NAME_BOOKMARK_HIDDEN));
+
+// 
+uno::Reference 
xBookmark2(xBookmarksByName->getByName("BookmarkHidden"), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xBookmark2, 
UNO_NAME_BOOKMARK_CONDITION));
+CPPUNIT_ASSERT_EQUAL(true, getProperty(xBookmark2, 
UNO_NAME_BOOKMARK_HIDDEN));
+}
+
+// MAILMERGE Add conditional to expand / collapse bookmarks
 DECLARE_ODFEXPORT_TEST(tdf101856, "tdf101856.odt")
 {
 // get bookmark interface
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx 
b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 6641bec775a8..ea00d0aae2cd 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -174,9 +174,9 @@ void XMLTextMarkImportContext::StartElement(
 
 if (IsXMLToken(GetLocalName(), XML_BOOKMARK_START))
 {
-OUString sHidden = xAttrList->getValueByName("loext:hidden");
-OUString sCondition = xAttrList->getValueByName("loext:condition");
-m_rHelper.setBookmarkAttributes(sHidden == "true", sCondition);
+const OUString sHidden= xAttrList->getValueByName("loext:hidden");
+const OUString sCondition = 
xAttrList->getValueByName("loext:condition");
+m_rHelper.setBookmarkAttributes(m_sBookmarkName, sHidden == "true", 
sCondition);
 }
 }
 
@@ -357,8 +357,8 @@ void XMLTextMarkImportContext::EndElement()
 const Reference 
xPropertySet(xContent, UNO_QUERY);
 if (xPropertySet.is())
 {
-
xPropertySet->setPropertyValue("BookmarkHidden",
uno::Any(m_rHelper.getBookmarkHidden()));
-
xPropertySet->setPropertyValue("BookmarkCondition", 
uno::Any(m_rHelper.getBookmarkCondition()));
+

[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source

2018-03-02 Thread Mark Hung
 include/xmloff/xmltoken.hxx   |1 +
 include/xmloff/xmltypes.hxx   |2 ++
 sw/qa/extras/odfexport/data/ruby-position.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx  |6 ++
 xmloff/source/core/xmltoken.cxx   |1 +
 xmloff/source/text/txtprhdl.cxx   |   22 --
 xmloff/source/text/txtprmap.cxx   |3 ++-
 xmloff/source/token/tokens.txt|1 +
 8 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit 1e034575584930c5bfb57838383ac2cf151c1b92
Author: Mark Hung 
Date:   Sun Jan 21 21:29:00 2018 +0800

tdf#35301 xmloff: load / store loext:ruby-position.

Add a new property loext:ruby-position to ODF filter
for the new attribute value "inter-character".

Change-Id: I193eb93fba0e2e7861b6c8635244cac36eb29a06
Reviewed-on: https://gerrit.libreoffice.org/48328
Tested-by: Jenkins 
Reviewed-by: Mark Hung 

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 242a93f28d48..ddd50ab9e6a0 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1055,6 +1055,7 @@ namespace xmloff { namespace token {
 XML_INSTITUTION,
 XML_INT,
 XML_INTENSITY,
+XML_INTER_CHARACTER,
 XML_INTERSECT,
 XML_INTERVAL,
 XML_INTERVAL_MAJOR,
diff --git a/include/xmloff/xmltypes.hxx b/include/xmloff/xmltypes.hxx
index 010dad07fc38..8b7fc23981c7 100644
--- a/include/xmloff/xmltypes.hxx
+++ b/include/xmloff/xmltypes.hxx
@@ -289,6 +289,8 @@
 #define XML_SW_TYPE_BITMAPREPOFFSETX(XML_TEXT_TYPES_START + 124)
 #define XML_SW_TYPE_BITMAPREPOFFSETY(XML_TEXT_TYPES_START + 125)
 
+#define XML_TYPE_TEXT_RUBY_IS_ABOVE (XML_TEXT_TYPES_START + 126)
+
 #endif // INCLUDED_XMLOFF_XMLTYPES_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/odfexport/data/ruby-position.odt 
b/sw/qa/extras/odfexport/data/ruby-position.odt
new file mode 100644
index ..7086144bf10f
Binary files /dev/null and b/sw/qa/extras/odfexport/data/ruby-position.odt 
differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index de1399620fea..b36b8045be7f 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1918,6 +1918,12 @@ DECLARE_ODFEXPORT_TEST(testReferenceLanguage, 
"referencelanguage.odt")
 }
 }
 
+DECLARE_ODFEXPORT_TEST(testRubyPosition, "ruby-position.odt")
+{
+if (xmlDocPtr pXmlDoc = parseExport("content.xml"))
+assertXPath(pXmlDoc, 
"//style:style[@style:family='ruby']/style:ruby-properties[@loext:ruby-position='inter-character']",
 1);
+}
+
 DECLARE_ODFEXPORT_TEST(testBulletAsImage, "BulletAsImage.odt")
 {
 uno::Reference xPara(getParagraph(1));
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index e4718637eace..e28178afdda5 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1056,6 +1056,7 @@ namespace xmloff { namespace token {
 TOKEN( "institution", XML_INSTITUTION ),
 TOKEN( "int", XML_INT ),
 TOKEN( "intensity",   XML_INTENSITY ),
+TOKEN( "inter-character", XML_INTER_CHARACTER ),
 TOKEN( "intersect",   XML_INTERSECT ),
 TOKEN( "interval",XML_INTERVAL ),
 TOKEN( "interval-major",  XML_INTERVAL_MAJOR ),
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index 382c283e1a57..993b100976bd 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -198,6 +199,21 @@ static SvXMLEnumMapEntry const 
pXML_RubyAdjust_Enum[] =
 { XML_TOKEN_INVALID,RubyAdjust(0) }
 };
 
+static SvXMLEnumMapEntry const pXML_RubyPosition_Enum[] =
+{
+{ XML_ABOVE,RubyPosition::ABOVE},
+{ XML_BELOW,RubyPosition::BELOW},
+{ XML_INTER_CHARACTER,  RubyPosition::INTER_CHARACTER},
+{ XML_TOKEN_INVALID,0 }
+};
+
+static SvXMLEnumMapEntry const pXML_RubyIsAbove_Enum[] =
+{
+{ XML_ABOVE,RubyPosition::ABOVE},
+{ XML_BELOW,RubyPosition::BELOW},
+{ XML_TOKEN_INVALID,0 }
+};
+
 static SvXMLEnumMapEntry const pXML_FontRelief_Enum[] =
 {
 { XML_NONE, FontRelief::NONE},
@@ -1256,8 +1272,10 @@ static const XMLPropertyHandler *GetPropertyHandler
 pHdl = new XMLConstantsPropertyHandler( pXML_ParaVerticalAlign_Enum, 
XML_TOKEN_INVALID );
 break;
 case XML_TYPE_TEXT_RUBY_POSITION:
-pHdl = new XMLNamedBoolPropertyHdl( ::xmloff::token::XML_ABOVE,
-

[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source

2017-05-17 Thread Tamás Zolnai
 include/xmloff/txtimp.hxx   |5 +
 sw/qa/extras/odfimport/data/tdf100033_1.odt |binary
 sw/qa/extras/odfimport/data/tdf100033_2.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx|   16 ++
 xmloff/source/text/XMLTextFrameContext.cxx  |   29 +++
 xmloff/source/text/txtimp.cxx   |   71 
 6 files changed, 112 insertions(+), 9 deletions(-)

New commits:
commit 6952d696439981962ad378aa28b0d16ea6e48f0e
Author: Tamás Zolnai 
Date:   Wed May 17 11:16:17 2017 +0200

tdf#100033: Frames with the same name are removed

Allow to have frames with the same name. For removing
real duplicated frames (generated by LO earlier)
check other things also next to the frame name:
position, size or whether the two frames are anchored
to the same position.

Change-Id: I191ae5128d0228eb85f78f065b44b1f0b3ba6dcf
Reviewed-on: https://gerrit.libreoffice.org/37702
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 

diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index 3e8ff127cd03..109469cf74ba 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -523,6 +523,11 @@ public:
 GetChapterNumbering() const;
 
 bool HasFrameByName( const OUString& rName ) const;
+
+bool IsDuplicateFrame(const OUString& sName, sal_Int32 nX, sal_Int32 nY, 
sal_Int32 nWidth, sal_Int32 nHeight) const;
+void StoreLastImportedFrameName(const OUString& rName);
+void ClearLastImportedTextFrameName();
+
 void ConnectFrameChains( const OUString& rFrmName,
 const OUString& rNextFrmName,
 const css::uno::Reference< css::beans::XPropertySet >& rFrmPropSet );
diff --git a/sw/qa/extras/odfimport/data/tdf100033_1.odt 
b/sw/qa/extras/odfimport/data/tdf100033_1.odt
new file mode 100755
index ..b7f3ae7aaeb4
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf100033_1.odt differ
diff --git a/sw/qa/extras/odfimport/data/tdf100033_2.odt 
b/sw/qa/extras/odfimport/data/tdf100033_2.odt
new file mode 100755
index ..98ae7bd6b31d
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf100033_2.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index ce4a69b7b369..06f2bf7f8a9c 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -784,5 +784,21 @@ DECLARE_ODFIMPORT_TEST(testTdf107392, "tdf107392.odt")
 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), 
getProperty(getShapeByName("SVG"), "ZOrder"));
 }
 
+DECLARE_ODFIMPORT_TEST(testTdf100033_1, "tdf100033_1.odt")
+{
+// Test document have three duplicated frames with the same name and 
position/size -> import one frame
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+}
+
+DECLARE_ODFIMPORT_TEST(testTdf100033_2, "tdf100033_2.odt")
+{
+// Test document have three different frames anchored to different 
paragraphs -> import all frames
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xIndexAccess->getCount());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx 
b/xmloff/source/text/XMLTextFrameContext.cxx
index 539d41e4fd8e..ece946e001b6 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -368,6 +368,7 @@ class XMLTextFrameContext_Impl : public SvXMLImportContext
 boolbSyncHeight : 1;
 boolbCreateFailed : 1;
 boolbOwnBase64Stream : 1;
+boolmbMultipleContent : 1; // This context is created based on a 
multiple content (image)
 
 void Create();
 
@@ -383,7 +384,8 @@ public:
 const css::uno::Reference & 
rAttrList,
 css::text::TextContentAnchorType eAnchorType,
 sal_uInt16 nType,
-const css::uno::Reference & 
rFrameAttrList );
+const css::uno::Reference & 
rFrameAttrList,
+bool bMultipleContent = false );
 
 virtual void EndElement() override;
 
@@ -405,6 +407,8 @@ public:
 
 void SetName();
 
+const OUString& GetOrigName() const { return m_sOrigName; }
+
 css::text::TextContentAnchorType GetAnchorType() const { return 
eAnchorType; }
 
 const css::uno::Reference < css::beans::XPropertySet >& GetPropSet() const 
{ return xPropSet; }
@@ -520,6 +524,14 @@ void XMLTextFrameContext_Impl::Create()
 
 Reference< XPropertySetInfo > xPropSetInfo = 
xPropSet->getPropertySetInfo();
 
+// Skip duplicated frames
+if(!mbMultipleContent && // It's 

[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source

2017-04-26 Thread Miklos Vajna
 include/xmloff/shapeimport.hxx |3 ++
 include/xmloff/xmlmultiimagehelper.hxx |2 -
 sw/qa/extras/odfimport/data/tdf107392.odt  |binary
 sw/qa/extras/odfimport/odfimport.cxx   |   12 
 xmloff/source/draw/shapeimport.cxx |   40 ++---
 xmloff/source/draw/ximpshap.cxx|2 -
 xmloff/source/draw/ximpshap.hxx|2 -
 xmloff/source/text/XMLTextFrameContext.cxx |7 -
 xmloff/source/text/XMLTextFrameContext.hxx |2 -
 9 files changed, 62 insertions(+), 8 deletions(-)

New commits:
commit 1b471124df251011b0053900cb82ceb0f3d8be86
Author: Miklos Vajna 
Date:   Wed Apr 26 17:52:27 2017 +0200

tdf#107392 ODF import: fix z-order sorting of SVG images

The problem was that in case the document has shapes where the order
does not match the z-index order, so sorting is needed, then sorting
failed to take the multi-image feature into account. E.g. SVG images
have a PNG fallback, but at the end of the shape import the PNG
fallback is removed, which means the "actual" (not the "wished") z-index
of the shapes after the SVG image has to be adjusted.

Without this happening SvxDrawPage::getByIndex() (or in case of Writer,
SwTextBoxHelper::getByIndex()) will throw when the importer calls
getByIndex(3) but we only have 3 shapes. This results in not honoring
the z-index request of the remaining shapes.

Regression from commit 44cfc7cb6533d827fd2d6e586d92c61d7d7f7a70 (re-base
on ALv2 code. Includes (at least) relevant parts of:, 2012-10-09), from
the

Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision=1220836

part.

Change-Id: Ibe880e5c6c74b728b4a760498720ee31f052b726
Reviewed-on: https://gerrit.libreoffice.org/36998
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins 

diff --git a/include/xmloff/shapeimport.hxx b/include/xmloff/shapeimport.hxx
index 4936b36a7068..efc00a289355 100644
--- a/include/xmloff/shapeimport.hxx
+++ b/include/xmloff/shapeimport.hxx
@@ -319,6 +319,9 @@ public:
 
 void shapeWithZIndexAdded( css::uno::Reference< css::drawing::XShape >& 
rShape,
sal_Int32 nZIndex );
+/// Updates the z-order of other shapes to be consistent again, needed due
+/// to the removal of rShape.
+void shapeRemoved(const css::uno::Reference& rShape);
 
 void addShapeConnection( css::uno::Reference< css::drawing::XShape >& 
rConnectorShape,
  bool bStart,
diff --git a/include/xmloff/xmlmultiimagehelper.hxx 
b/include/xmloff/xmlmultiimagehelper.hxx
index 391f8a67a6a4..4a14d1ac4a77 100644
--- a/include/xmloff/xmlmultiimagehelper.hxx
+++ b/include/xmloff/xmlmultiimagehelper.hxx
@@ -33,7 +33,7 @@ private:
 protected:
 /// helper to get the created xShape instance, override this
 virtual OUString getGraphicURLFromImportContext(const SvXMLImportContext& 
rContext) const = 0;
-virtual void removeGraphicFromImportContext(const SvXMLImportContext& 
rContext) const = 0;
+virtual void removeGraphicFromImportContext(const SvXMLImportContext& 
rContext) = 0;
 
 public:
 MultiImageImportHelper();
diff --git a/sw/qa/extras/odfimport/data/tdf107392.odt 
b/sw/qa/extras/odfimport/data/tdf107392.odt
new file mode 100644
index ..c8a05a9eef94
Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf107392.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index 9572e7f4dba4..ce4a69b7b369 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -772,5 +772,17 @@ DECLARE_ODFIMPORT_TEST(testTdf101729, "tdf101729.odt")
 CPPUNIT_ASSERT( x < l + 3 * w / 4);
 }
 
+DECLARE_ODFIMPORT_TEST(testTdf107392, "tdf107392.odt")
+{
+// Shapes from bottom to top were Frame, SVG, Bitmap, i.e. in the order as
+// they appeared in the document, not according to their requested z-index,
+// as sorting failed.
+// So instead of 0, 1, 2 these were 2, 0, 1.
+
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), 
getProperty(getShapeByName("Bitmap"), "ZOrder"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), 
getProperty(getShapeByName("Frame"), "ZOrder"));
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), 
getProperty(getShapeByName("SVG"), "ZOrder"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/draw/shapeimport.cxx 
b/xmloff/source/draw/shapeimport.cxx
index 44c648fa641f..4f55f1ec2726 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -698,6 +698,8 @@ struct ZOrderHint
 {
 sal_Int32 nIs;
 sal_Int32 nShould;
+/// The hint is for this shape.
+uno::Reference xShape;
 
 bool operator<(const ZOrderHint& rComp) const { 

[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source

2016-02-02 Thread Michael Stahl
 include/xmloff/txtprmap.hxx|7 +-
 sw/qa/extras/globalfilter/globalfilter.cxx |   80 +
 xmloff/source/text/txtexppr.cxx|   10 +++
 xmloff/source/text/txtprmap.cxx|4 -
 4 files changed, 96 insertions(+), 5 deletions(-)

New commits:
commit 8dadefc35f8b33648fb6adbdaca75ea52b2705db
Author: Michael Stahl 
Date:   Tue Feb 2 14:10:02 2016 +0100

xmloff: tdf#96147: ODF export: fix duplicate fo:background-color

... attributes that happen if both CharHighlight and CharBackColor
properties are used, because the CharBackTransparent property wasn't
taken into account, and combining the CharBackColor and
CharBackTransparent properties happens *after*
XMLTextExportPropertySetMapper::ContextFilter() runs.

Also, it looks like a transparent highlight wouldn't export properly but
apparently DomainMapper::getColorFromId() won't create such.

(regression from f880962f5bf26bfaef06bd3f9e67e2d901a2e74c)

Change-Id: Ib628ef8bb377482f74fadb97c81afb95fbbf7184

diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx
index 5fa8e3c..79baf8b 100644
--- a/include/xmloff/txtprmap.hxx
+++ b/include/xmloff/txtprmap.hxx
@@ -197,9 +197,10 @@
 #define CTF_RELWIDTHREL (XML_TEXT_CTF_START + 168)
 #define CTF_RELHEIGHTREL(XML_TEXT_CTF_START + 169)
 #define CTF_CHAR_BACKGROUND (XML_TEXT_CTF_START + 170)
-#define CTF_CHAR_HIGHLIGHT  (XML_TEXT_CTF_START + 171)
-#define CTF_FILLSTYLE   (XML_TEXT_CTF_START + 172)
-#define CTF_FILLCOLOR   (XML_TEXT_CTF_START + 173)
+#define CTF_CHAR_BACKGROUND_TRANSPARENCY(XML_TEXT_CTF_START + 171)
+#define CTF_CHAR_HIGHLIGHT  (XML_TEXT_CTF_START + 172)
+#define CTF_FILLSTYLE   (XML_TEXT_CTF_START + 173)
+#define CTF_FILLCOLOR   (XML_TEXT_CTF_START + 174)
 
 
 enum class TextPropMap {
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx 
b/sw/qa/extras/globalfilter/globalfilter.cxx
index 1871c61..751f2a5 100644
--- a/sw/qa/extras/globalfilter/globalfilter.cxx
+++ b/sw/qa/extras/globalfilter/globalfilter.cxx
@@ -30,6 +30,7 @@ public:
 void testImageWithSpecialID();
 void testGraphicShape();
 void testCharHighlight();
+void testCharHighlightODF();
 void testCharHighlightBody();
 void testMSCharBackgroundEditing();
 void testCharBackgroundToHighlighting();
@@ -43,6 +44,7 @@ public:
 CPPUNIT_TEST(testImageWithSpecialID);
 CPPUNIT_TEST(testGraphicShape);
 CPPUNIT_TEST(testCharHighlight);
+CPPUNIT_TEST(testCharHighlightODF);
 CPPUNIT_TEST(testMSCharBackgroundEditing);
 CPPUNIT_TEST(testCharBackgroundToHighlighting);
 #if !defined(WNT)
@@ -473,6 +475,84 @@ void Test::testCharHighlight()
 testCharHighlightBody();
 }
 
+void Test::testCharHighlightODF()
+{
+mxComponent = 
loadFromDesktop(getURLFromSrc("/sw/qa/extras/globalfilter/data/char_background_editing.docx"),
+  "com.sun.star.text.TextDocument");
+
+// don't check import, testMSCharBackgroundEditing already does that
+
+uno::Reference xPara = getParagraph(1);
+for (int i = 1; i <= 4; ++i)
+{
+uno::Reference xRun(getRun(xPara,i), 
uno::UNO_QUERY);
+switch (i)
+{
+case 1: // non-transparent highlight
+xRun->setPropertyValue("CharBackColor", 
uno::makeAny(static_cast(128)));
+xRun->setPropertyValue("CharBackTransparent", uno::makeAny(true));
+xRun->setPropertyValue("CharHighlight", 
uno::makeAny(static_cast(64)));
+break;
+
+case 2: // transparent backcolor
+xRun->setPropertyValue("CharBackColor", 
uno::makeAny(static_cast(128)));
+xRun->setPropertyValue("CharBackTransparent", uno::makeAny(true));
+xRun->setPropertyValue("CharHighlight", 
uno::makeAny(static_cast(COL_TRANSPARENT)));
+break;
+
+case 3: // non-transparent backcolor
+xRun->setPropertyValue("CharBackColor", 
uno::makeAny(static_cast(128)));
+xRun->setPropertyValue("CharBackTransparent", uno::makeAny(false));
+xRun->setPropertyValue("CharHighlight", 
uno::makeAny(static_cast(COL_TRANSPARENT)));
+break;
+
+case 4: // non-transparent highlight again
+xRun->setPropertyValue("CharBackColor", 
uno::makeAny(static_cast(128)));
+xRun->setPropertyValue("CharBackTransparent", uno::makeAny(false));
+xRun->setPropertyValue("CharHighlight", 
uno::makeAny(static_cast(64)));
+break;
+}
+}
+
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+utl::MediaDescriptor aMediaDescriptor;
+aMediaDescriptor["FilterName"] <<= OUString::createFromAscii("writer8");
+
+utl::TempFile aTempFile;
+

[Libreoffice-commits] core.git: include/xmloff sw/qa xmloff/source

2014-01-30 Thread Miklos Vajna
 include/xmloff/txtprmap.hxx   |2 ++
 include/xmloff/xmltoken.hxx   |2 ++
 sw/qa/extras/odfexport/data/relh-page.odt |binary
 sw/qa/extras/odfexport/data/relw-page.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx  |   19 +++
 xmloff/source/core/xmltoken.cxx   |2 ++
 xmloff/source/text/txtexppr.cxx   |   18 ++
 xmloff/source/text/txtprmap.cxx   |2 ++
 8 files changed, 45 insertions(+)

New commits:
commit 0b20f01a8817867d7657ed2ee29321de9af15843
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Jan 30 10:25:16 2014 +0100

swpagerelsize: implement ODF import/export

Export rel-height-rel / rel-width-rel only in case rel-height /
rel-width is non-zero, though.

Change-Id: I36120cbd8679ac4fc072d1e7cf4dfc024836b5ac

diff --git a/include/xmloff/txtprmap.hxx b/include/xmloff/txtprmap.hxx
index 0eebd9b..dc8de70 100644
--- a/include/xmloff/txtprmap.hxx
+++ b/include/xmloff/txtprmap.hxx
@@ -194,6 +194,8 @@
 #define CTF_CHARRIGHTBORDER (XML_TEXT_CTF_START + 165)
 #define CTF_CHARTOPBORDER   (XML_TEXT_CTF_START + 166)
 #define CTF_CHARBOTTOMBORDER(XML_TEXT_CTF_START + 167)
+#define CTF_RELWIDTHREL (XML_TEXT_CTF_START + 168)
+#define CTF_RELHEIGHTREL(XML_TEXT_CTF_START + 169)
 
 
 #define TEXT_PROP_MAP_TEXT 0
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index f804744..16ddf69 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1495,7 +1495,9 @@ namespace xmloff { namespace token {
 XML_REJECTION,
 XML_REL_COLUMN_WIDTH,
 XML_REL_HEIGHT,
+XML_REL_HEIGHT_REL,
 XML_REL_WIDTH,
+XML_REL_WIDTH_REL,
 XML_RELATIVE,
 XML_RELATIVE_TAB_STOP_POSITION,
 XML_RELN,
diff --git a/sw/qa/extras/odfexport/data/relh-page.odt 
b/sw/qa/extras/odfexport/data/relh-page.odt
new file mode 100644
index 000..2dcf641
Binary files /dev/null and b/sw/qa/extras/odfexport/data/relh-page.odt differ
diff --git a/sw/qa/extras/odfexport/data/relw-page.odt 
b/sw/qa/extras/odfexport/data/relw-page.odt
new file mode 100644
index 000..047d91e
Binary files /dev/null and b/sw/qa/extras/odfexport/data/relw-page.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 5ef7ca4..333f00d 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -13,6 +13,7 @@
 #include com/sun/star/awt/Gradient.hpp
 #include com/sun/star/drawing/FillStyle.hpp
 #include com/sun/star/table/ShadowFormat.hpp
+#include com/sun/star/text/RelOrientation.hpp
 
 class Test : public SwModelTestBase
 {
@@ -310,6 +311,24 @@ DECLARE_ODFEXPORT_TEST(testTextframeTransparentShadow, 
textframe-transparent-sh
 CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getPropertysal_Int32(xPicture, 
ShadowTransparence));
 }
 
+DECLARE_ODFEXPORT_TEST(testRelhPage, relh-page.odt)
+{
+uno::Referencedrawing::XShape xTextFrame = getShape(1);
+// This was text::RelOrientation::FRAME (the default), 
RelativeHeightRelation was not handled in xmloff.
+CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, 
getPropertysal_Int16(xTextFrame, RelativeHeightRelation));
+// Make sure rel-height-rel doesn't affect width.
+CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, 
getPropertysal_Int16(xTextFrame, RelativeWidthRelation));
+}
+
+DECLARE_ODFEXPORT_TEST(testRelwPage, relw-page.odt)
+{
+uno::Referencedrawing::XShape xTextFrame = getShape(1);
+// This was text::RelOrientation::FRAME (the default), 
RelativeWidthRelation was not handled in xmloff.
+CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, 
getPropertysal_Int16(xTextFrame, RelativeWidthRelation));
+// Make sure rel-width-rel doesn't affect height.
+CPPUNIT_ASSERT_EQUAL(text::RelOrientation::FRAME, 
getPropertysal_Int16(xTextFrame, RelativeHeightRelation));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 27fb252..8ff43ec 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1500,7 +1500,9 @@ namespace xmloff { namespace token {
 TOKEN( rejection,   XML_REJECTION ),
 TOKEN( rel-column-width,XML_REL_COLUMN_WIDTH ),
 TOKEN( rel-height,  XML_REL_HEIGHT ),
+TOKEN( rel-height-rel,  XML_REL_HEIGHT_REL ),
 TOKEN( rel-width,   XML_REL_WIDTH ),
+TOKEN( rel-width-rel,   XML_REL_WIDTH_REL ),
 TOKEN( relative,XML_RELATIVE ),
 TOKEN( relative-tab-stop-position,  
XML_RELATIVE_TAB_STOP_POSITION ),
 TOKEN( reln,XML_RELN ),
diff --git a/xmloff/source/text/txtexppr.cxx