summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/errinf.hxx1
-rw-r--r--sw/CppunitTest_sw_core_doc.mk1
-rw-r--r--sw/qa/core/doc/data/textbox-textrotateangle.odtbin0 -> 9496 bytes
-rw-r--r--sw/qa/core/doc/doc.cxx22
-rw-r--r--sw/source/core/doc/textboxhelper.cxx14
-rw-r--r--vcl/source/window/errinf.cxx6
6 files changed, 42 insertions, 2 deletions
diff --git a/include/vcl/errinf.hxx b/include/vcl/errinf.hxx
index 6d57954aff2b..4a0edc75b259 100644
--- a/include/vcl/errinf.hxx
+++ b/include/vcl/errinf.hxx
@@ -59,6 +59,7 @@ public:
static void RegisterDisplay(BasicDisplayErrorFunc*);
static void RegisterDisplay(WindowDisplayErrorFunc*);
+ static void Reset();
private:
DisplayFnPtr pDsp;
diff --git a/sw/CppunitTest_sw_core_doc.mk b/sw/CppunitTest_sw_core_doc.mk
index 487e02322ef4..856f007cb9b1 100644
--- a/sw/CppunitTest_sw_core_doc.mk
+++ b/sw/CppunitTest_sw_core_doc.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_core_doc, \
comphelper \
cppu \
cppuhelper \
+ editeng \
sal \
sfx \
sw \
diff --git a/sw/qa/core/doc/data/textbox-textrotateangle.odt b/sw/qa/core/doc/data/textbox-textrotateangle.odt
new file mode 100644
index 000000000000..2ce4c3e0b7ec
--- /dev/null
+++ b/sw/qa/core/doc/data/textbox-textrotateangle.odt
Binary files differ
diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 882f31873bf3..a8489e01a274 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -12,6 +12,8 @@
#include <comphelper/classids.hxx>
#include <tools/globname.hxx>
#include <svtools/embedhlp.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <vcl/errinf.hxx>
#include <wrtsh.hxx>
#include <fmtanchr.hxx>
@@ -58,6 +60,26 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testMathInsertAnchorType)
// - Actual : 4
// i.e. the anchor type was at-char, not as-char.
CPPUNIT_ASSERT_EQUAL(RndStdIds::FLY_AS_CHAR, rAnchor.GetAnchorId());
+ ErrorRegistry::Reset();
+}
+
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testTextboxTextRotateAngle)
+{
+ // Check the writing direction of the only TextFrame in the document.
+ SwDoc* pDoc = createDoc("textbox-textrotateangle.odt");
+ SwFrameFormats& rFrameFormats = *pDoc->GetSpzFrameFormats();
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), rFrameFormats.size());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(RES_DRAWFRMFMT), rFrameFormats[0]->Which());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(RES_FLYFRMFMT), rFrameFormats[1]->Which());
+ SvxFrameDirection eActual = rFrameFormats[1]->GetAttrSet().GetItem(RES_FRAMEDIR)->GetValue();
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 5 (btlr)
+ // - Actual : 0 (lrtb)
+ // i.e. the writing direction was in the ODT file, but it was lost on import in the textbox
+ // case.
+ CPPUNIT_ASSERT_EQUAL(SvxFrameDirection::Vertical_LR_BT, eActual);
+ ErrorRegistry::Reset();
}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 4f2550f06b52..1dcc7e242016 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -361,11 +361,21 @@ void SwTextBoxHelper::syncProperty(SwFrameFormat* pShape, const OUString& rPrope
comphelper::SequenceAsHashMap aCustomShapeGeometry(rValue);
auto it = aCustomShapeGeometry.find("TextPreRotateAngle");
+ if (it == aCustomShapeGeometry.end())
+ {
+ it = aCustomShapeGeometry.find("TextRotateAngle");
+ }
+
if (it != aCustomShapeGeometry.end())
{
- auto nTextPreRotateAngle = it->second.get<sal_Int32>();
+ auto nAngle = it->second.has<sal_Int32>() ? it->second.get<sal_Int32>() : 0;
+ if (nAngle == 0)
+ {
+ nAngle = it->second.has<double>() ? it->second.get<double>() : 0;
+ }
+
sal_Int16 nDirection = 0;
- switch (nTextPreRotateAngle)
+ switch (nAngle)
{
case -90:
nDirection = text::WritingMode2::TB_RL;
diff --git a/vcl/source/window/errinf.cxx b/vcl/source/window/errinf.cxx
index 5307d60df716..8e08dc361acd 100644
--- a/vcl/source/window/errinf.cxx
+++ b/vcl/source/window/errinf.cxx
@@ -74,6 +74,12 @@ void ErrorRegistry::RegisterDisplay(WindowDisplayErrorFunc *aDsp)
rData.pDsp = reinterpret_cast< DisplayFnPtr >(aDsp);
}
+void ErrorRegistry::Reset()
+{
+ ErrorRegistry &rData = TheErrorRegistry::get();
+ rData = ErrorRegistry();
+}
+
static void aDspFunc(const OUString &rErr, const OUString &rAction)
{
SAL_WARN("vcl", "Action: " << rAction << " Error: " << rErr);