Bugzilla – Attachment 135599 Details for
Bug 109308
FILESAVE: DOCX - Drop caps is lost when saving
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
sledgehammer patch for exporting drop-caps
0001-tdf-109308-docx-export-support-export-of-Drop-Caps.patch (text/plain), 5.93 KB, created by
Justin L
on 2017-08-17 01:20:40 UTC
(
hide
)
Description:
sledgehammer patch for exporting drop-caps
Filename:
MIME Type:
Creator:
Justin L
Created:
2017-08-17 01:20:40 UTC
Size:
5.93 KB
patch
obsolete
>From a96abfcabba97e69d3ad91511bd0e9e38350d6f3 Mon Sep 17 00:00:00 2001 >From: Justin Luth <justin_luth@sil.org> >Date: Wed, 16 Aug 2017 21:05:12 -0400 >Subject: [PATCH] tdf#109308 docx export: support export of Drop Caps > >LO handles Drop Caps much better than MSO. MSO needs a lot of >extra size settings specified instead of calculating the >appropriate value. > >I don't understand marks/mergeTopMarks at all, so this is a mess. >I also get really frustrated trying to do something simple like >figure out the current font size - which is only needed to sync >the MSO-required properties with the proper size. > >Change-Id: Ibd260aed2eef00ed196df63cb79df737dca7632a >--- > sw/source/filter/ww8/docxattributeoutput.cxx | 40 +++++++++++++++++++++++++++- > sw/source/filter/ww8/docxattributeoutput.hxx | 2 ++ > 2 files changed, 41 insertions(+), 1 deletion(-) > >diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx >index e09bdaa..87cdfa3 100644 >--- a/sw/source/filter/ww8/docxattributeoutput.cxx >+++ b/sw/source/filter/ww8/docxattributeoutput.cxx >@@ -904,6 +904,14 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties() > m_pSerializer->singleElementNS( XML_w, XML_spacing, xAttrList ); > } > >+ if ( m_pDropCapSpacingAttrList.is() ) >+ { >+ XFastAttributeListRef xAttrList( m_pDropCapSpacingAttrList.get() ); >+ m_pDropCapSpacingAttrList.clear(); >+ >+ m_pSerializer->singleElementNS( XML_w, XML_spacing, xAttrList ); >+ } >+ > if ( m_pBackgroundAttrList.is() ) > { > XFastAttributeListRef xAttrList( m_pBackgroundAttrList.get() ); >@@ -1981,6 +1989,13 @@ void DocxAttributeOutput::WriteCollectedRunProperties() > m_pSerializer->singleElementNS( XML_w, XML_rFonts, xAttrList ); > } > >+ if ( m_pDropCapSizeAttrList.is() ) >+ { >+ XFastAttributeListRef xAttrList( m_pDropCapSizeAttrList.get() ); >+ m_pDropCapSizeAttrList.clear(); >+ m_pSerializer->singleElementNS( XML_w, XML_sz, xAttrList ); >+ } >+ > if ( m_pColorAttrList.is() ) > { > XFastAttributeListRef xAttrList( m_pColorAttrList.get() ); >@@ -2589,9 +2604,32 @@ void DocxAttributeOutput::EndRedline( const SwRedlineData * pRedlineData ) > } > } > >-void DocxAttributeOutput::FormatDrop( const SwTextNode& /*rNode*/, const SwFormatDrop& /*rSwFormatDrop*/, sal_uInt16 /*nStyle*/, ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/, ww8::WW8TableNodeInfoInner::Pointer_t ) >+void DocxAttributeOutput::FormatDrop( const SwTextNode& rNode, const SwFormatDrop& rSwFormatDrop, sal_uInt16 /*nStyle*/, ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/, ww8::WW8TableNodeInfoInner::Pointer_t ) > { > SAL_INFO("sw.ww8", "TODO DocxAttributeOutput::FormatDrop( const SwTextNode& rNode, const SwFormatDrop& rSwFormatDrop, sal_uInt16 nStyle )" ); >+ >+SAL_WARN("DEBUG","::FormatDrop Drop.Lines["<<(int)rSwFormatDrop.GetLines()<<"] Count["<<(int)rSwFormatDrop.GetChars()<<"] Distance["<<rSwFormatDrop.GetDistance()<<"] text["<<rNode.GetText()<<"]"); >+ AddToAttrList( m_rExport.SdrExporter().getFlyAttrList(), FSNS( XML_w, XML_dropCap ), "drop" ); >+ AddToAttrList( m_rExport.SdrExporter().getFlyAttrList(), FSNS( XML_w, XML_lines ), OString::number( rSwFormatDrop.GetLines() ).getStr() ); >+ AddToAttrList( m_rExport.SdrExporter().getFlyAttrList(), FSNS( XML_w, XML_hSpace ), OString::number( rSwFormatDrop.GetDistance() ).getStr() ); >+ AddToAttrList( m_rExport.SdrExporter().getFlyAttrList(), FSNS( XML_w, XML_wrap ), "around" ); >+ //AddToAttrList( m_rExport.SdrExporter().getFlyAttrList(), FSNS( XML_w, XML_vAnchor ), "text" ); >+ //AddToAttrList( m_rExport.SdrExporter().getFlyAttrList(), FSNS( XML_w, XML_hAnchor ), "text" ); >+ >+ const SvxFontHeightItem& rItem = static_cast<const SvxFontHeightItem&>(m_rExport.GetItem(RES_CHRATR_FONTSIZE)); >+ // 240 is roughly the height of a normal font. MSO needs this to set the frame height approxmiately correct on import. How do you get the current height? >+ AddToAttrList( m_pDropCapSpacingAttrList, FSNS( XML_w, XML_line ), OString::number( rSwFormatDrop.GetLines() * rItem.GetHeight() ).getStr() ); >+ AddToAttrList( m_pDropCapSpacingAttrList, FSNS( XML_w, XML_lineRule ), "exact" ); >+ >+ // 28 is roughly the pt size of a normal font. MSO needs this to set the text size approxmately correct on import. How do you get the current size? >+ AddToAttrList( m_pDropCapSizeAttrList, FSNS( XML_w, XML_val ), OString::number( rSwFormatDrop.GetLines() * 28 ).getStr() ); >+ >+SAL_WARN("DEBUG","::FormatDop finished, ParaOpened?["<<m_bParagraphOpened<<"]"); >+//I don't know how to properly end one paragraph and start another - but this worked as a sledgehammer approach, although it messes up m_pDropCapSizeAttrList >+ m_pSerializer->endElementNS( XML_w, XML_r ); >+ m_pSerializer->endElementNS( XML_w, XML_p ); >+ m_pSerializer->startElementNS( XML_w, XML_p, FSEND ); >+ m_pSerializer->startElementNS( XML_w, XML_r, FSEND ); > } > > void DocxAttributeOutput::ParagraphStyle( sal_uInt16 nStyle ) >diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx >index 49efe1d..47044eb 100644 >--- a/sw/source/filter/ww8/docxattributeoutput.hxx >+++ b/sw/source/filter/ww8/docxattributeoutput.hxx >@@ -724,8 +724,10 @@ private: > rtl::Reference<sax_fastparser::FastAttributeList> m_pFontsAttrList; > rtl::Reference<sax_fastparser::FastAttributeList> m_pEastAsianLayoutAttrList; > rtl::Reference<sax_fastparser::FastAttributeList> m_pCharLangAttrList; >+ rtl::Reference<sax_fastparser::FastAttributeList> m_pDropCapSizeAttrList; > rtl::Reference<sax_fastparser::FastAttributeList> m_pSectionSpacingAttrList; > rtl::Reference<sax_fastparser::FastAttributeList> m_pParagraphSpacingAttrList; >+ rtl::Reference<sax_fastparser::FastAttributeList> m_pDropCapSpacingAttrList; > rtl::Reference<sax_fastparser::FastAttributeList> m_pHyperlinkAttrList; > /// If the current SDT around runs should be ended before the current run. > bool m_bEndCharSdt; >-- >2.7.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 109308
:
134817
|
134818
|
134819
|
134820
| 135599