diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/doc/docfld.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/doc/poolfmt.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/html/htmlplug.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.cxx | 39 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxexport.hxx | 16 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 36 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par3.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/fldui/flddb.cxx | 2 |
8 files changed, 93 insertions, 16 deletions
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 62cc8b4763b5..16e5a7680da7 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -2288,9 +2288,9 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) } String sTrue( String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "sal_True" ))), + RTL_CONSTASCII_STRINGPARAM( "TRUE" ))), sFalse( String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "sal_False" ))); + RTL_CONSTASCII_STRINGPARAM( "FALSE" ))); sal_Bool bIsDBMgr = 0 != rDoc.GetNewDBMgr(); sal_uInt16 nWhich, n; diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index 1fbe5340b7bc..ca115007c9eb 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -1520,7 +1520,12 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) aSet.Put( aUL ); bSetLeft = sal_False; if( pNewPgDsc ) + { pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT ); + // this relies on GetPageDescFromPool() not going into infinite recursion + // (by this point RES_POOLPAGE_LEFT will not reach this place again) + pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_RIGHT )); + } } break; case RES_POOLPAGE_RIGHT: // Rechte Seite @@ -1530,7 +1535,10 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) aSet.Put( aUL ); bSetLeft = sal_False; if( pNewPgDsc ) + { pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT ); + pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_LEFT )); + } } break; diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 6c82e8141d88..e559b937a93d 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -78,7 +78,7 @@ using namespace com::sun::star; namespace { -static char const sHTML_O_Hidden_False[] = "sal_False"; +static char const sHTML_O_Hidden_False[] = "FALSE"; } diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 0bd0908ed9e5..9f0489716fc0 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -215,6 +215,9 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 nHeadFootFlags, if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_FIRST ) WriteHeaderFooter( rFirstPageFmt, false, "first" ); + if ( nHeadFootFlags & ( nsHdFtFlags::WW8_FOOTER_EVEN | nsHdFtFlags::WW8_HEADER_EVEN )) + settings.evenAndOddHeaders = true; + #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "DocxExport::WriteHeadersFooters() - nBreakCode introduced, but ignored\n" ); #endif @@ -339,6 +342,8 @@ void DocxExport::ExportDocument_Impl() WriteFonts(); + WriteSettings(); + delete pStyles, pStyles = NULL; delete m_pSections, m_pSections = NULL; } @@ -642,6 +647,28 @@ void DocxExport::WriteProperties( ) m_pFilter->exportDocumentProperties( xDocProps ); } +void DocxExport::WriteSettings() +{ + if( !settings.hasData()) + return; + m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), + S( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" ), + S( "settings.xml" ) ); + + ::sax_fastparser::FSHelperPtr pFS = m_pFilter->openFragmentStreamWithSerializer( + S( "word/settings.xml" ), + S( "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" ) ); + + pFS->startElementNS( XML_w, XML_settings, + FSNS( XML_xmlns, XML_w ), "http://schemas.openxmlformats.org/wordprocessingml/2006/main", + FSEND ); + + if( settings.evenAndOddHeaders ) + pFS->singleElementNS( XML_w, XML_evenAndOddHeaders, FSEND ); + + pFS->endElementNS( XML_w, XML_settings ); +} + VMLExport& DocxExport::VMLExporter() { return *m_pVMLExport; @@ -726,4 +753,16 @@ DocxExport::~DocxExport() delete m_pDrawingML, m_pDrawingML = NULL; } +DocxSettingsData::DocxSettingsData() +: evenAndOddHeaders( false ) +{ +} + +bool DocxSettingsData::hasData() const +{ + if( evenAndOddHeaders ) + return true; + return false; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 4838d55868c4..ee84dcd33b42 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -58,6 +58,14 @@ namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } } +/// Data to be written in the document settings part of the document +struct DocxSettingsData +{ + DocxSettingsData(); + bool hasData() const; /// returns true if there are any non-default settings (i.e. something to write) + bool evenAndOddHeaders; +}; + /// The class that does all the actual DOCX export-related work. class DocxExport : public MSWordExportBase { @@ -85,6 +93,8 @@ class DocxExport : public MSWordExportBase /// Exporter of the VML shapes. oox::vml::VMLExport *m_pVMLExport; + DocxSettingsData settings; + public: DocxExportFilter& GetFilter() { return *m_pFilter; }; @@ -192,6 +202,9 @@ private: /// Write docProps/core.xml void WriteProperties(); + /// Write word/settings.xml + void WriteSettings(); + /// All xml namespaces to be used at the top of any text .xml file (main doc, headers, footers,...) sax_fastparser::XFastAttributeListRef MainXmlNamespaces( sax_fastparser::FSHelperPtr serializer ); @@ -210,6 +223,9 @@ public: /// Reference to the VMLExport instance for the main document. oox::vml::VMLExport& VMLExporter(); + /// Data to be exported in the settings part of the document + DocxSettingsData& settingsData(); + private: /// No copying. DocxExport( const DocxExport& ); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 83cece4881dc..17716b65cc05 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1594,6 +1594,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt } } + bool titlePage = false; if ( bOutPgDscSet ) { // es ist ein Follow gesetzt und dieser zeigt nicht auf sich @@ -1620,10 +1621,19 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt pPdFmt = &rFollowFmt; // has different headers/footers for the title page - AttrOutput().SectionTitlePage(); + titlePage = true; } } + // The code above tries to detect if this is first page headers/footers, + // but it doesn't work even for quite trivial testcases. As I don't actually + // understand that code, I'll keep it. The simple and (at least for me) reliable way + // to detect for first page seems to be just RES_POOLPAGE_FIRST. + if( pPd->GetPoolFmtId() == RES_POOLPAGE_FIRST ) + titlePage = true; + if( titlePage ) + AttrOutput().SectionTitlePage(); + const SfxItemSet* pOldI = pISet; AttrOutput().SectionPageBorders( pPdFmt, pPdFirstPgFmt ); @@ -1698,22 +1708,26 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt if ( nBreakCode != 0 ) { - MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD ); - MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD ); - - if ( !pPd->IsHeaderShared() || bLeftRightPgChain ) - MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN ); - - if ( !pPd->IsFooterShared() || bLeftRightPgChain ) - MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN ); - - if ( pPdFmt != pPdFirstPgFmt ) + if ( titlePage ) { // es gibt eine ErsteSeite: MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_HEADER_FIRST ); MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFirstPgFmt, WW8_FOOTER_FIRST ); } + // write other headers/footers only if it's not the first page - I'm not quite sure + // this is technically correct, but it avoids first-page headers/footers + // extending to all pages (bnc#654230) + if( pPdFmt != pPdFirstPgFmt ) + { + MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdFmt, WW8_HEADER_ODD ); + MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdFmt, WW8_FOOTER_ODD ); + if ( !pPd->IsHeaderShared() || bLeftRightPgChain ) + MSWordSections::SetHeaderFlag( nHeadFootFlags, *pPdLeftFmt, WW8_HEADER_EVEN ); + + if ( !pPd->IsFooterShared() || bLeftRightPgChain ) + MSWordSections::SetFooterFlag( nHeadFootFlags, *pPdLeftFmt, WW8_FOOTER_EVEN ); + } AttrOutput().SectionWW6HeaderFooterFlags( nHeadFootFlags ); } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 42ca75e60e95..6d014a08a61a 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2158,7 +2158,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich, nType=1; } fUnknown = nHeaderByte & 0x3; - fDropdownIndex = (nHeaderByte & 0xFC) >> 2; + fDropdownIndex = (nHeaderByte & 0x7C) >> 2; *pDataStream >> nField; fToolTip = nField & 0x01; fNoMark = (nField & 0x02)>>1; diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index 9d1ac103ae29..d6f57df395ef 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -385,7 +385,7 @@ IMPL_LINK( SwFldDBPage, TypeHdl, ListBox *, pBox ) aValueED.SetText(aEmptyStr); if (bCond) aConditionED.SetText( String::CreateFromAscii( - RTL_CONSTASCII_STRINGPARAM( "sal_True" ))); + RTL_CONSTASCII_STRINGPARAM( "TRUE" ))); else aConditionED.SetText(aEmptyStr); } |