[Libreoffice-commits] .: 3 commits - sw/source
Lubos Lunak
llunak at kemper.freedesktop.org
Tue Jul 19 04:57:11 PDT 2011
sw/source/core/text/txtfly.cxx | 11 +------
sw/source/filter/ww8/attributeoutputbase.hxx | 3 +
sw/source/filter/ww8/docxattributeoutput.cxx | 41 +++++++++++++++++++++++----
sw/source/filter/ww8/docxattributeoutput.hxx | 11 +++++--
sw/source/filter/ww8/docxexport.cxx | 22 ++++++++++++++
sw/source/filter/ww8/docxexport.hxx | 3 +
sw/source/filter/ww8/wrtw8nds.cxx | 2 +
7 files changed, 78 insertions(+), 15 deletions(-)
New commits:
commit 17651a5b8aab1a64fcefde3067422509a3221e34
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue Jul 19 13:56:30 2011 +0200
skeleton for writting .docx comments
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index c002488..1562a75 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -176,6 +176,9 @@ public:
/// for docx footnotePr/endnotePr inside sectPr
virtual void SectFootnoteEndnotePr() {};
+ /// for docx w:commentReference
+ virtual void WritePostitFieldReference() {};
+
/// Output text (inside a run).
virtual void RunText( const String& rText, rtl_TextEncoding eCharSet ) = 0;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8b7f095..e5bac97 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3302,9 +3302,34 @@ void DocxAttributeOutput::HiddenField( const SwField& /*rFld*/ )
OSL_TRACE( "TODO DocxAttributeOutput::HiddenField()\n" );
}
-void DocxAttributeOutput::PostitField( const SwField* /* pFld*/ )
+void DocxAttributeOutput::PostitField( const SwField* pFld )
{
- OSL_TRACE( "TODO DocxAttributeOutput::PostitField()\n" );
+ assert( dynamic_cast< const SwPostItField* >( pFld ));
+ m_postitFields.push_back( static_cast< const SwPostItField* >( pFld ));
+}
+
+void DocxAttributeOutput::WritePostitFieldReference()
+{
+ while( m_postitFieldsMaxId < m_postitFields.size())
+ {
+ OString idstr = OString::valueOf( sal_Int32( m_postitFieldsMaxId ));
+ m_pSerializer->singleElementNS( XML_w, XML_commentReference, FSNS( XML_w, XML_id ), idstr.getStr(), FSEND );
+ ++m_postitFieldsMaxId;
+ }
+}
+
+void DocxAttributeOutput::WritePostitFields()
+{
+ for( unsigned int i = 0;
+ i < m_postitFields.size();
+ ++i )
+ {
+ OString idstr = OString::valueOf( sal_Int32( i ));
+ const SwPostItField* f = m_postitFields[ i ];
+ m_pSerializer->startElementNS( XML_w, XML_comment, FSNS( XML_w, XML_id ), idstr.getStr(),
+ /*TODO*/ FSEND );
+ m_pSerializer->endElementNS( XML_w, XML_comment );
+ }
}
bool DocxAttributeOutput::DropdownField( const SwField* pFld )
@@ -4283,7 +4308,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_nColBreakStatus( COLBRK_NONE ),
m_pParentFrame( NULL ),
m_nCloseHyperlinkStatus( Undetected ),
- m_postponedGraphic( NULL )
+ m_postponedGraphic( NULL ),
+ m_postitFieldsMaxId( 0 )
{
}
@@ -4319,4 +4345,9 @@ bool DocxAttributeOutput::HasEndnotes() const
return !m_pEndnotesList->isEmpty();
}
+bool DocxAttributeOutput::HasPostitFields() const
+{
+ return !m_postitFields.empty();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index a476cc5..cc67549 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -105,6 +105,8 @@ public:
virtual void SectFootnoteEndnotePr();
+ virtual void WritePostitFieldReference();
+
/// Output text (inside a run).
virtual void RunText( const String& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8 );
@@ -599,6 +601,8 @@ private:
Size size;
};
std::list< PostponedGraphic >* m_postponedGraphic;
+ std::vector< const SwPostItField* > m_postitFields;
+ unsigned int m_postitFieldsMaxId;
public:
DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML );
@@ -626,6 +630,9 @@ public:
/// writes the footnotePr/endnotePr (depending on tag) section
void WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr fs, int tag, const SwEndNoteInfo& info, int listtag );
+
+ bool HasPostitFields() const;
+ void WritePostitFields();
};
#endif // _DOCXATTRIBUTEOUTPUT_HXX_
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 12ab4a8..dd77d7b 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -339,6 +339,8 @@ void DocxExport::ExportDocument_Impl()
WriteFootnotesEndnotes();
+ WritePostitFields();
+
WriteNumbering();
WriteFonts();
@@ -516,6 +518,26 @@ void DocxExport::WriteFootnotesEndnotes()
}
}
+void DocxExport::WritePostitFields()
+{
+ if ( m_pAttrOutput->HasPostitFields() )
+ {
+ m_pFilter->addRelation( m_pDocumentFS->getOutputStream(),
+ S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" ),
+ S( "comments.xml" ) );
+
+ ::sax_fastparser::FSHelperPtr pPostitFS =
+ m_pFilter->openFragmentStreamWithSerializer( S( "word/comments.xml" ),
+ S( "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" ) );
+
+ pPostitFS->startElementNS( XML_w, XML_comments, MainXmlNamespaces( pPostitFS ));
+ m_pAttrOutput->SetSerializer( pPostitFS );
+ m_pAttrOutput->WritePostitFields();
+ m_pAttrOutput->SetSerializer( m_pDocumentFS );
+ pPostitFS->endElementNS( XML_w, XML_comments );
+ }
+}
+
void DocxExport::WriteNumbering()
{
if ( !pUsedNumTbl )
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index ee84dcd..faed1e0 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -190,6 +190,9 @@ private:
/// Write footnotes.xml and endnotes.xml.
void WriteFootnotesEndnotes();
+ /// Write comments.xml
+ void WritePostitFields();
+
/// Write the numbering table.
virtual void WriteNumbering();
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 72ae0fd..8dcd8b8 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -2030,6 +2030,8 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
}
}
+ AttrOutput().WritePostitFieldReference();
+
AttrOutput().EndRun();
nAktPos = nNextAttr;
commit 51dae8c127e4d9d3d864947f239ceec6bebd0ae8
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Tue Jul 19 13:53:46 2011 +0200
make text wrapping work in headers/footers too (fdo#39155)
There does not seem to be a reason for avoiding this in headers,
with this change the behavior either stays the same or improves.
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 513c2d5..a900867 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -1380,14 +1380,7 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
const SwSortedObjs *pSorted = pPage->GetSortedObjs();
const sal_uInt32 nCount = pSorted ? pSorted->Count() : 0;
- // --> #108724# Page header/footer content doesn't have to wrap around
- // floating screen objects
- const bool bFooterHeader = 0 != pCurrFrm->FindFooterOrHeader();
- const IDocumentSettingAccess* pIDSA = pCurrFrm->GetTxtNode()->getIDocumentSettingAccess();
- // #i40155# - check, if frame is marked not to wrap
- const sal_Bool bWrapAllowed = ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) ||
- ( !pCurrFrm->IsInFtn() && !bFooterHeader ) ) &&
- !SwLayouter::FrmNotToWrap( *pCurrFrm->GetTxtNode()->getIDocumentLayoutAccess(), *pCurrFrm );
+ const sal_Bool bWrapAllowed = !SwLayouter::FrmNotToWrap( *pCurrFrm->GetTxtNode()->getIDocumentLayoutAccess(), *pCurrFrm );
bOn = sal_False;
@@ -1399,6 +1392,7 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
// #i28701# - consider complete frame area for new
// text wrapping
SwRect aRect;
+ const IDocumentSettingAccess* pIDSA = pCurrFrm->GetTxtNode()->getIDocumentSettingAccess();
if ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) )
{
aRect = pCurrFrm->Prt();
@@ -1414,6 +1408,7 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
const long nRight = (aRect.*fnRect->fnGetRight)() - 1;
const long nLeft = (aRect.*fnRect->fnGetLeft)() + 1;
const sal_Bool bR2L = pCurrFrm->IsRightToLeft();
+ const bool bFooterHeader = ( pCurrFrm->FindFooterOrHeader() != NULL );
const IDocumentDrawModelAccess* pIDDMA = pCurrFrm->GetTxtNode()->getIDocumentDrawModelAccess();
commit 0e00fc23b54bc1f93bb531a18f7e23ada5ee429b
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Fri Jul 8 17:02:41 2011 +0200
const methods
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6086213..8b7f095 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4309,12 +4309,12 @@ DocxExport& DocxAttributeOutput::GetExport()
return m_rExport;
}
-bool DocxAttributeOutput::HasFootnotes()
+bool DocxAttributeOutput::HasFootnotes() const
{
return !m_pFootnotesList->isEmpty();
}
-bool DocxAttributeOutput::HasEndnotes()
+bool DocxAttributeOutput::HasEndnotes() const
{
return !m_pEndnotesList->isEmpty();
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 884563d..a476cc5 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -616,10 +616,10 @@ public:
::sax_fastparser::FSHelperPtr GetSerializer( ) { return m_pSerializer; }
/// Do we have any footnotes?
- bool HasFootnotes();
+ bool HasFootnotes() const;
/// Do we have any endnotes?
- bool HasEndnotes();
+ bool HasEndnotes() const;
/// Output the content of the footnotes.xml resp. endnotes.xml
void FootnotesEndnotes( bool bFootnotes );
More information about the Libreoffice-commits
mailing list