summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-10-21 21:33:36 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-10-22 08:44:02 +0200
commit9a29a4df545d7f88cd14bb99ce54f149032eb7f0 (patch)
tree03cdbef6aec0a3b5c9eb0702dbe888e7c4ddd0c8
parent5b9b855c19fd8b8fb61f49e9d3d8bbf47521caee (diff)
tdf#127412 sw: fix reported ZOrder of shape+textbox pairs
Writer documents may have shape+textbox pairs, in which case internally they have individual ZOrders, but the textbox ZOrder is always just 1 larger than their shape, and externally this is not visible (UNO API, UI). This is implemented by e.g. SwXDrawPage::getCount(), which ignores those textboxes. This worked in general for SwVirtFlyDrawObj, but in case the textbox is a SwFlyDrawObj, then these were not filtered out. Fix this, so the scenario when the shapes are added to the draw page following ZOrder (0, 1, etc) works (internally producing 0, 1, 2, 3, etc ZOrders). Change-Id: I2a04fb76029d83390d418c764fdfbe7a1ee0f208 Reviewed-on: https://gerrit.libreoffice.org/81277 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx4
-rw-r--r--sw/source/core/draw/dflyobj.cxx7
-rw-r--r--sw/source/core/inc/dflyobj.hxx1
3 files changed, 11 insertions, 1 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index afbe37ce21aa..ff50b080f79a 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -1347,10 +1347,12 @@ void SwUiWriterTest::testShapeTextboxAutosize()
{
SwDoc* pDoc = createDoc("shape-textbox-autosize.odt");
SdrPage* pPage = pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ // 0-1 is the first UI-visible shape+textbox.
SdrObject* pFirst = pPage->GetObj(0);
CPPUNIT_ASSERT_EQUAL(OUString("1st"), pFirst->GetName());
- SdrObject* pSecond = pPage->GetObj(1);
+ // 2-3 is the second UI-visible shape+textbox.
+ SdrObject* pSecond = pPage->GetObj(2);
CPPUNIT_ASSERT_EQUAL(OUString("2nd"), pSecond->GetName());
// Shape -> textbox synchronization was missing, the second shape had the
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index f7ff362b5f15..423b41ed64e9 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -67,6 +67,7 @@
#include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <notxtfrm.hxx>
+#include <dcontact.hxx>
using namespace ::com::sun::star;
@@ -144,6 +145,12 @@ sal_uInt16 SwFlyDrawObj::GetObjIdentifier() const
return SwFlyDrawObjIdentifier;
}
+bool SwFlyDrawObj::IsTextBox() const
+{
+ const SwFrameFormat* pFrameFormat = FindFrameFormat(this);
+ return SwTextBoxHelper::isTextBox(pFrameFormat, RES_FLYFRMFMT);
+}
+
// TODO: Need own primitive to get the FlyFrame paint working
namespace drawinglayer
{
diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx
index 0d0a8fdfab4c..d96029be3eeb 100644
--- a/sw/source/core/inc/dflyobj.hxx
+++ b/sw/source/core/inc/dflyobj.hxx
@@ -50,6 +50,7 @@ public:
// for instantiation of this class while loading (via factory)
virtual SdrInventor GetObjInventor() const override;
virtual sal_uInt16 GetObjIdentifier() const override;
+ bool IsTextBox() const override;
};
// virtual objects for Flys