[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jul 26 17:34:14 UTC 2019
sw/qa/extras/ooxmlexport/data/btlr-frame.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 15 ++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 4 -
sw/source/filter/ww8/docxsdrexport.cxx | 65 ---------------------------
sw/source/filter/ww8/docxsdrexport.hxx | 2
5 files changed, 19 insertions(+), 67 deletions(-)
New commits:
commit e7da02efd9e8b0d1d4d70e9aa9562b3424a61aea
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jul 25 21:28:04 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jul 26 19:33:43 2019 +0200
sw btlr writing mode: DOCX export of Writer textframes
Do it the same way as tbrl is already handled.
(cherry picked from commit 6a4b7d1e658b4515ec9a2fe3604dd4ead4c0fec8)
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
sw/source/filter/ww8/docxsdrexport.cxx
Change-Id: I7daad962c6349874357c38801c15adadfe8c3a50
Reviewed-on: https://gerrit.libreoffice.org/76385
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/data/btlr-frame.odt b/sw/qa/extras/ooxmlexport/data/btlr-frame.odt
new file mode 100644
index 000000000000..31cb03849c53
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/btlr-frame.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index d0250213ccd1..8ccc2bc68100 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -174,6 +174,21 @@ DECLARE_OOXMLEXPORT_TEST(testTbrlFrameVml, "tbrl-frame-vml.docx")
}
}
+DECLARE_OOXMLEXPORT_TEST(testBtlrFrame, "btlr-frame.odt")
+{
+ if (!mbExported)
+ {
+ return;
+ }
+
+ uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
+ comphelper::SequenceAsHashMap aGeometry(xPropertySet->getPropertyValue("CustomShapeGeometry"));
+ // Without the accompanying fix in place, this test would have failed with 'Expected:
+ // -270; Actual: 0', i.e. the writing direction of the frame was lost.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-270),
+ aGeometry["TextPreRotateAngle"].get<sal_Int32>());
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf116371, "tdf116371.odt")
{
// Make sure the rotation is exported correctly, and size not distorted
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index e8e57496a387..69c0e5f3e578 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1346,6 +1346,8 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
const SvxFrameDirectionItem& rDirection = rFrameFormat.GetFrameDir();
if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB)
m_pImpl->m_pBodyPrAttrList->add(XML_vert, "vert");
+ else if (rDirection.GetValue() == SvxFrameDirection::Vertical_LR_BT)
+ m_pImpl->m_pBodyPrAttrList->add(XML_vert, "vert270");
m_pImpl->m_bFlyFrameGraphic = true;
m_pImpl->m_rExport.WriteText();
commit c89f2db14a2b3dc2153d75996f87bbb2167afbd9
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Jul 18 21:27:51 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jul 26 19:33:29 2019 +0200
sw btlr writing mode: remove not needed checkFrameBtlr() in the DOCX export
Now that the DOCX import doesn't create this and instead uses the proper
writing mode (neither VML nor drawingmL).
(cherry picked from commit ab0df471915c5d54e8a3e8556de12afdfa541b3c)
Conflicts:
sw/source/filter/ww8/docxsdrexport.cxx
Change-Id: I560c710866de8fb2f90d681e8cfc2d82afb1a327
Reviewed-on: https://gerrit.libreoffice.org/76384
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index ea3bb3800e69..cfc98d6e9391 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7300,8 +7300,8 @@ void DocxAttributeOutput::CharIdctHint( const SfxPoolItem& )
void DocxAttributeOutput::CharRotate( const SvxCharRotateItem& rRotate)
{
- // Not rotated or we the rotation already handled?
- if ( !rRotate.GetValue() || m_rExport.SdrExporter().getFrameBtLr())
+ // Not rotated?
+ if ( !rRotate.GetValue())
return;
AddToAttrList( m_pEastAsianLayoutAttrList, FSNS( XML_w, XML_vert ), "true" );
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index d40e2a786c70..e8e57496a387 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -150,7 +150,6 @@ struct DocxSdrExport::Impl
rtl::Reference<sax_fastparser::FastAttributeList> m_pFlyAttrList;
rtl::Reference<sax_fastparser::FastAttributeList> m_pTextboxAttrList;
OStringBuffer m_aTextFrameStyle;
- bool m_bFrameBtLr;
bool m_bDrawingOpen;
bool m_bParagraphSdtOpen;
bool m_bParagraphHasDrawing; ///Flag for checking drawing in a paragraph.
@@ -173,7 +172,6 @@ struct DocxSdrExport::Impl
, m_pFlyFrameSize(nullptr)
, m_bTextFrameSyntax(false)
, m_bDMLTextFrameSyntax(false)
- , m_bFrameBtLr(false)
, m_bDrawingOpen(false)
, m_bParagraphSdtOpen(false)
, m_bParagraphHasDrawing(false)
@@ -189,8 +187,6 @@ struct DocxSdrExport::Impl
void textFrameShadow(const SwFrameFormat& rFrameFormat);
static bool isSupportedDMLShape(const uno::Reference<drawing::XShape>& xShape);
- /// Undo the text direction mangling done by the frame btLr handler in writerfilter::dmapper::DomainMapper::lcl_startCharacterGroup()
- bool checkFrameBtlr(SwNode* pStartNode, bool bDML);
oox::drawingml::DrawingML* getDrawingML() const { return m_pDrawingML; }
};
@@ -225,8 +221,6 @@ rtl::Reference<sax_fastparser::FastAttributeList>& DocxSdrExport::getTextboxAttr
OStringBuffer& DocxSdrExport::getTextFrameStyle() { return m_pImpl->m_aTextFrameStyle; }
-bool DocxSdrExport::getFrameBtLr() { return m_pImpl->m_bFrameBtLr; }
-
bool DocxSdrExport::IsDrawingOpen() { return m_pImpl->m_bDrawingOpen; }
void DocxSdrExport::setParagraphSdtOpen(bool bParagraphSdtOpen)
@@ -1088,7 +1082,6 @@ void DocxSdrExport::writeOnlyTextOfFrame(ww8::Frame const* pParentFrame)
m_pImpl->m_bFlyFrameGraphic = true;
m_pImpl->m_rExport.WriteText();
m_pImpl->m_bFlyFrameGraphic = false;
- m_pImpl->m_bFrameBtLr = false;
}
void DocxSdrExport::writeBoxItemLine(const SvxBoxItem& rBox)
@@ -1354,8 +1347,6 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
if (rDirection.GetValue() == SvxFrameDirection::Vertical_RL_TB)
m_pImpl->m_pBodyPrAttrList->add(XML_vert, "vert");
- m_pImpl->m_bFrameBtLr
- = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/true);
m_pImpl->m_bFlyFrameGraphic = true;
m_pImpl->m_rExport.WriteText();
if (m_pImpl->m_bParagraphSdtOpen)
@@ -1364,7 +1355,6 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* pParentFrame, int nAncho
m_pImpl->m_bParagraphSdtOpen = false;
}
m_pImpl->m_bFlyFrameGraphic = false;
- m_pImpl->m_bFrameBtLr = false;
pFS->endElementNS(XML_w, XML_txbxContent);
pFS->endElementNS(XML_wps, XML_txbx);
@@ -1473,8 +1463,6 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText
}
sax_fastparser::XFastAttributeListRef xFlyAttrList(m_pImpl->m_pFlyAttrList.get());
m_pImpl->m_pFlyAttrList.clear();
- m_pImpl->m_bFrameBtLr
- = m_pImpl->checkFrameBtlr(m_pImpl->m_rExport.m_pDoc->GetNodes()[nStt], /*bDML=*/false);
sax_fastparser::XFastAttributeListRef xTextboxAttrList(m_pImpl->m_pTextboxAttrList.get());
m_pImpl->m_pTextboxAttrList.clear();
m_pImpl->m_bTextFrameSyntax = false;
@@ -1526,61 +1514,10 @@ void DocxSdrExport::writeVMLTextFrame(ww8::Frame const* pParentFrame, bool bText
pFS->endElementNS(XML_v, XML_rect);
pFS->endElementNS(XML_w, XML_pict);
}
- m_pImpl->m_bFrameBtLr = false;
m_pImpl->m_bDMLAndVMLDrawingOpen = bDMLAndVMLDrawingOpen;
}
-bool DocxSdrExport::Impl::checkFrameBtlr(SwNode* pStartNode, bool bDML)
-{
- // The intended usage is to pass either a valid VML or DML attribute list.
- if (bDML)
- assert(m_pBodyPrAttrList);
- else
- assert(m_pTextboxAttrList.is());
-
- if (!pStartNode->IsTextNode())
- return false;
-
- SwTextNode* pTextNode = pStartNode->GetTextNode();
-
- const SfxPoolItem* pItem = nullptr; // explicitly init to avoid warnings
- bool bItemSet = false;
- if (pTextNode->HasSwAttrSet())
- {
- const SwAttrSet& rAttrSet = pTextNode->GetSwAttrSet();
- bItemSet = rAttrSet.GetItemState(RES_CHRATR_ROTATE, true, &pItem) == SfxItemState::SET;
- }
-
- if (!bItemSet)
- {
- if (!pTextNode->HasHints())
- return false;
-
- SwTextAttr* pTextAttr = pTextNode->GetTextAttrAt(0, RES_TXTATR_AUTOFMT);
-
- if (!pTextAttr || pTextAttr->Which() != RES_TXTATR_AUTOFMT)
- return false;
-
- std::shared_ptr<SfxItemSet> pItemSet = pTextAttr->GetAutoFormat().GetStyleHandle();
- bItemSet = pItemSet->GetItemState(RES_CHRATR_ROTATE, true, &pItem) == SfxItemState::SET;
- }
-
- if (bItemSet)
- {
- auto& rCharRotate = static_cast<const SvxCharRotateItem&>(*pItem);
- if (rCharRotate.GetValue() == 900)
- {
- if (bDML)
- m_pBodyPrAttrList->add(XML_vert, "vert270");
- else
- m_pTextboxAttrList->add(XML_style, "mso-layout-flow-alt:bottom-to-top");
- return true;
- }
- }
- return false;
-}
-
bool DocxSdrExport::isTextBox(const SwFrameFormat& rFrameFormat)
{
return SwTextBoxHelper::isTextBox(&rFrameFormat, RES_FLYFRMFMT);
diff --git a/sw/source/filter/ww8/docxsdrexport.hxx b/sw/source/filter/ww8/docxsdrexport.hxx
index 613978761706..2f7d57c2017d 100644
--- a/sw/source/filter/ww8/docxsdrexport.hxx
+++ b/sw/source/filter/ww8/docxsdrexport.hxx
@@ -67,8 +67,6 @@ public:
/// Attributes of the next v:textbox element.
rtl::Reference<sax_fastparser::FastAttributeList>& getTextboxAttrList();
OStringBuffer& getTextFrameStyle();
- /// Same, as DocxAttributeOutput::m_bBtLr, but for textframe rotation.
- bool getFrameBtLr();
/// Set if paragraph sdt open in the current drawing.
void setParagraphSdtOpen(bool bParagraphSdtOpen);
More information about the Libreoffice-commits
mailing list