[ooo-build-commit] patches/dev300
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Mon Jul 27 02:56:05 PDT 2009
patches/dev300/docx-import-fixes.diff | 409 ++++++++++++++++++++++++++++------
1 file changed, 346 insertions(+), 63 deletions(-)
New commits:
commit 0e27b30fd32922f4b9a05659596e6b469de9aadf
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Mon Jul 27 11:52:08 2009 +0200
Docx: reused hdr/ftr now imported
n519201: in Docx, when no header/footer reference is contained in a
sectPr, the ones of the previous section is used. This is now
implemented.
In order to copy the previous header/footer text into the new one, the
SwXText object had to support the XTextCopy interface, but it doesn't
tells it to the world: this is not a published API.
* patches/dev300/docx-import-fixes.diff:
diff --git a/patches/dev300/docx-import-fixes.diff b/patches/dev300/docx-import-fixes.diff
index ba212e7..e6ddf2e 100644
--- a/patches/dev300/docx-import-fixes.diff
+++ b/patches/dev300/docx-import-fixes.diff
@@ -932,6 +932,40 @@ index e06c984..ab892ed 100644
+}
+
} }
+diff --git sw/inc/unoobj.hxx sw/inc/unoobj.hxx
+index 5c8829d..0a7202e 100644
+--- sw/inc/unoobj.hxx
++++ sw/inc/unoobj.hxx
+@@ -51,6 +51,7 @@
+ #include <com/sun/star/text/XTextField.hpp>
+ #include <com/sun/star/text/XTextRange.hpp>
+ #include <com/sun/star/text/XText.hpp>
++#include <com/sun/star/text/XTextCopy.hpp>
+ #include <com/sun/star/text/XTextContent.hpp>
+ #include <com/sun/star/util/XSortable.hpp>
+ #include <com/sun/star/container/XEnumerationAccess.hpp>
+@@ -212,7 +213,8 @@ class SwXText : public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::text::XRelativeTextContentRemove,
+ public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::lang::XUnoTunnel,
+- public ::com::sun::star::text::XTextAppendAndConvert
++ public ::com::sun::star::text::XTextAppendAndConvert,
++ public ::com::sun::star::text::XTextCopy
+ {
+ SwDoc* pDoc;
+ BOOL bObjectValid;
+@@ -299,7 +301,10 @@ public:
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& TableProperties
+ ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+-
++
++ //XTextCopy
++ virtual void SAL_CALL copyText( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCopy >& xSource ) throw (::com::sun::star::uno::RuntimeException);
++
+ //
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createCursor()throw(::com::sun::star::uno::RuntimeException);
+ INT16 ComparePositions(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange>& xPos1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange>& xPos2) throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
diff --git sw/source/core/doc/docredln.cxx sw/source/core/doc/docredln.cxx
index fd13119..86b6267 100644
--- sw/source/core/doc/docredln.cxx
@@ -1066,19 +1100,40 @@ index 715fed4..12d4d27 100644
/*-- 10.12.98 12:54:44---------------------------------------------------
diff --git sw/source/core/unocore/unotext.cxx sw/source/core/unocore/unotext.cxx
-index fe6139d..fab01f9 100644
+index fe6139d..50b57d0 100644
--- sw/source/core/unocore/unotext.cxx
+++ sw/source/core/unocore/unotext.cxx
-@@ -68,6 +68,8 @@
+@@ -68,6 +68,9 @@
#include <memory>
#include <stdlib.h>
+#include <iostream>
+
++using namespace std;
using namespace ::com::sun::star;
using ::rtl::OUString;
-@@ -256,8 +258,8 @@ void SwXText::insertString(const uno::Reference< text::XTextRange > & xTextRange
+@@ -133,6 +136,7 @@ uno::Any SAL_CALL SwXText::queryInterface( const uno::Type& rType ) throw(uno::R
+ const uno::Type& rXTextConvert = ::getCppuType((uno::Reference< text::XTextConvert >*)0);
+ const uno::Type& rXTextAppend = ::getCppuType((uno::Reference< text::XTextAppend >*)0);
+ const uno::Type& rXTextAppendAndConvert = ::getCppuType((uno::Reference< text::XTextAppendAndConvert >*)0);
++ const uno::Type& rXTextCopy = ::getCppuType((uno::Reference< text::XTextCopy >*)0);
+
+ uno::Any aRet;
+ if(rType == rXTextType)
+@@ -210,6 +214,11 @@ uno::Any SAL_CALL SwXText::queryInterface( const uno::Type& rType ) throw(uno::R
+ uno::Reference< XTextContentAppend > xRet = this;
+ aRet.setValue(&xRet, rXTextContentAppend );
+ }
++ else if(rType == rXTextCopy )
++ {
++ uno::Reference< XTextCopy> xRet = this;
++ aRet.setValue(&xRet, rXTextCopy );
++ }
+ return aRet;
+ }
+ /* -----------------------------15.03.00 17:42--------------------------------
+@@ -256,8 +265,8 @@ void SwXText::insertString(const uno::Reference< text::XTextRange > & xTextRange
sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
}
@@ -1089,7 +1144,44 @@ index fe6139d..fab01f9 100644
{
const SwStartNode* pOwnStartNode = GetStartNode();
if(pCursor)
-@@ -1871,18 +1873,11 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
+@@ -1828,6 +1837,36 @@ bool lcl_SimilarPosition( sal_Int32 nPos1, sal_Int32 nPos2 )
+ return abs( nPos1 - nPos2 ) < COL_POS_FUZZY;
+ }
+
++void SwXText::copyText(
++ const uno::Reference< text::XTextCopy >& xSource )
++ throw ( uno::RuntimeException )
++{
++#if DEBUG
++ clog << "TODO - SwXText::copyText()" << endl;
++#endif
++ uno::Reference< lang::XUnoTunnel > xTTunnel( xSource, uno::UNO_QUERY_THROW );
++ SwXText* pText = 0;
++ pText = reinterpret_cast< SwXText* >(
++ sal::static_int_cast< sal_IntPtr >( xTTunnel->getSomething( SwXText::getUnoTunnelId()) ));
++
++
++ uno::Reference< text::XText > xText( xSource, uno::UNO_QUERY_THROW );
++ uno::Reference< text::XTextCursor > xCursor = xText->createTextCursor( );
++ xCursor->gotoEnd( sal_True );
++
++ uno::Reference< lang::XUnoTunnel > xTunnel( xCursor, uno::UNO_QUERY_THROW );
++
++ OTextCursorHelper* pCursor = 0;
++ pCursor = reinterpret_cast< OTextCursorHelper* >(
++ sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
++ if ( pCursor )
++ {
++ SwNodeIndex rNdIndex( *GetStartNode( ), 1 );
++ SwPosition rPos( rNdIndex );
++ pDoc->Copy( *pCursor->GetPaM( ), rPos );
++ }
++}
++
+ uno::Reference< text::XTextTable > SwXText::convertToTable(
+ const uno::Sequence< uno::Sequence< uno::Sequence< uno::Reference< text::XTextRange > > > >& rTableRanges,
+ const uno::Sequence< uno::Sequence< uno::Sequence< beans::PropertyValue > > >& rCellProperties,
+@@ -1871,18 +1910,11 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
if(aStartCellPam.Start()->nNode < aEndCellPam.End()->nNode)
{
const SwNode& rStartNode = aStartCellPam.Start()->nNode.GetNode();
@@ -1109,7 +1201,7 @@ index fe6139d..fab01f9 100644
{
if( aCellIndex.GetNode().IsStartNode() )
++nOpenNodeBlock;
-@@ -1893,6 +1888,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
+@@ -1893,6 +1925,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
bExcept = true;
break;
}
@@ -1117,7 +1209,7 @@ index fe6139d..fab01f9 100644
}
if( nOpenNodeBlock != 0)
{
-@@ -1938,7 +1934,9 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
+@@ -1938,7 +1971,9 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
//node border anyway
}
else
@@ -1127,7 +1219,7 @@ index fe6139d..fab01f9 100644
}
//now check if there's a need to insert another paragraph break
if( aEndCellPam.End()->nContent.GetIndex() < aEndCellPam.End()->nNode.GetNode().GetTxtNode()->Len())
-@@ -1995,7 +1993,22 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
+@@ -1995,7 +2030,22 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
const beans::PropertyValue* pTableProperties = rTableProperties.getConstArray();
sal_Int32 nProperty = 0;
for( ; nProperty < rTableProperties.getLength(); ++nProperty)
@@ -1151,7 +1243,7 @@ index fe6139d..fab01f9 100644
//apply row properties
uno::Reference< table::XTableRows > xRows = xRet->getRows();
-@@ -2052,6 +2065,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
+@@ -2052,6 +2102,7 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
//--<
#endif
@@ -1159,7 +1251,7 @@ index fe6139d..fab01f9 100644
//apply cell properties
for( nRow = 0; nRow < rCellProperties.getLength(); ++nRow)
{
-@@ -2064,7 +2078,8 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
+@@ -2064,7 +2115,8 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
uno::Reference< beans::XPropertySet > xCell( pTextTable->getCellByPosition(nCell, nRow), uno::UNO_QUERY );
for( nProperty = 0; nProperty < nCellProperties; ++nProperty)
{
@@ -1169,7 +1261,7 @@ index fe6139d..fab01f9 100644
RTL_CONSTASCII_STRINGPARAM ( "VerticalMerge")))
{
//determine left border position
-@@ -2127,8 +2142,24 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
+@@ -2127,8 +2179,24 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
}
}
}
@@ -1196,7 +1288,7 @@ index fe6139d..fab01f9 100644
}
}
}
-@@ -2166,30 +2197,6 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
+@@ -2166,30 +2234,6 @@ uno::Reference< text::XTextTable > SwXText::convertToTable(
{
(void)rBounds;
}
@@ -3162,7 +3254,7 @@ index c183252..d301acf 100644
}}
diff --git writerfilter/source/dmapper/DomainMapper_Impl.cxx writerfilter/source/dmapper/DomainMapper_Impl.cxx
-index 051a2b8..0c8c037 100644
+index 051a2b8..cb19158 100644
--- writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -36,6 +36,8 @@
@@ -3200,17 +3292,18 @@ index 051a2b8..0c8c037 100644
#include <map>
-@@ -393,7 +401,8 @@ DomainMapper_Impl::DomainMapper_Impl(
+@@ -393,7 +401,9 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bIsFirstSection( true ),
m_bIsColumnBreakDeferred( false ),
m_bIsPageBreakDeferred( false ),
- m_TableManager( eDocumentType == DOCUMENT_OOXML ),
+ m_bIsInShape( false ),
+ m_bShapeContextAdded( false ),
++ m_pLastSectionContext( ),
m_nCurrentTabStopIndex( 0 ),
m_sCurrentParaStyleId(),
m_bInStyleSheetImport( false ),
-@@ -401,8 +410,11 @@ DomainMapper_Impl::DomainMapper_Impl(
+@@ -401,8 +411,11 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bLineNumberingSet( false ),
m_bIsInFootnoteProperties( true ),
m_bIsCustomFtnMark( false ),
@@ -3223,7 +3316,7 @@ index 051a2b8..0c8c037 100644
GetBodyText();
uno::Reference< text::XTextAppend > xBodyTextAppend = uno::Reference< text::XTextAppend >( m_xBodyText, uno::UNO_QUERY );
m_aTextAppendStack.push(xBodyTextAppend);
-@@ -411,17 +423,20 @@ DomainMapper_Impl::DomainMapper_Impl(
+@@ -411,17 +424,20 @@ DomainMapper_Impl::DomainMapper_Impl(
uno::Reference< text::XTextAppendAndConvert > xBodyTextAppendAndConvert( m_xBodyText, uno::UNO_QUERY );
TableDataHandler_t::Pointer_t pTableHandler
(new DomainMapperTableHandler(xBodyTextAppendAndConvert, *this));
@@ -3247,7 +3340,7 @@ index 051a2b8..0c8c037 100644
/*-------------------------------------------------------------------------
-----------------------------------------------------------------------*/
-@@ -474,6 +489,28 @@ void DomainMapper_Impl::SetDocumentSettingsProperty( const ::rtl::OUString& rPro
+@@ -474,6 +490,28 @@ void DomainMapper_Impl::SetDocumentSettingsProperty( const ::rtl::OUString& rPro
}
}
}
@@ -3276,15 +3369,23 @@ index 051a2b8..0c8c037 100644
/*-------------------------------------------------------------------------
-----------------------------------------------------------------------*/
-@@ -524,6 +561,7 @@ void DomainMapper_Impl::PushListProperties(PropertyMapPtr pListProperties)
+@@ -524,6 +562,15 @@ void DomainMapper_Impl::PushListProperties(PropertyMapPtr pListProperties)
void DomainMapper_Impl::PopProperties(ContextType eId)
{
OSL_ENSURE(!m_aPropertyStacks[eId].empty(), "section stack already empty");
++
++ if ( eId == CONTEXT_SECTION )
++ {
++#if DEBUG
++ clog << "Saving the last section context" << endl;
++#endif
++ m_pLastSectionContext = m_aPropertyStacks[eId].top( );
++ }
+
m_aPropertyStacks[eId].pop();
m_aContextStack.pop();
if(!m_aContextStack.empty() && !m_aPropertyStacks[m_aContextStack.top()].empty())
-@@ -685,13 +723,13 @@ uno::Sequence< style::TabStop > DomainMapper_Impl::GetCurrentTabStopAndClear()
+@@ -685,13 +732,13 @@ uno::Sequence< style::TabStop > DomainMapper_Impl::GetCurrentTabStopAndClear()
-----------------------------------------------------------------------*/
uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId)
{
@@ -3300,7 +3401,7 @@ index 051a2b8..0c8c037 100644
{
//is there a tab stop set?
if(pEntry->pProperties)
-@@ -725,10 +763,10 @@ void DomainMapper_Impl::deferBreak( BreakType deferredBreakType)
+@@ -725,10 +772,10 @@ void DomainMapper_Impl::deferBreak( BreakType deferredBreakType)
switch (deferredBreakType)
{
case COLUMN_BREAK:
@@ -3313,7 +3414,7 @@ index 051a2b8..0c8c037 100644
break;
default:
return;
-@@ -831,16 +869,20 @@ void lcl_AddRangeAndStyle(
+@@ -831,16 +878,20 @@ void lcl_AddRangeAndStyle(
/*-------------------------------------------------------------------------
-----------------------------------------------------------------------*/
@@ -3337,7 +3438,7 @@ index 051a2b8..0c8c037 100644
{
try
{
-@@ -903,11 +945,11 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
+@@ -903,11 +954,11 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
try
{
//
@@ -3351,7 +3452,7 @@ index 051a2b8..0c8c037 100644
{
const ParagraphProperties* pStyleProperties = dynamic_cast<const ParagraphProperties*>( pParaStyle->pProperties.get() );
beans::PropertyValue* pFrameProperties = aFrameProperties.getArray();
-@@ -1044,15 +1086,41 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
+@@ -1044,15 +1095,41 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
}
uno::Reference< text::XTextRange > xTextRange =
xTextAppend->finishParagraph( aProperties );
@@ -3398,7 +3499,7 @@ index 051a2b8..0c8c037 100644
}
catch(const lang::IllegalArgumentException& rIllegal)
{
-@@ -1062,7 +1130,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
+@@ -1062,7 +1139,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
catch(const uno::Exception& rEx)
{
(void)rEx;
@@ -3407,7 +3508,7 @@ index 051a2b8..0c8c037 100644
}
}
}
-@@ -1091,45 +1159,23 @@ util::DateTime lcl_DateStringToDateTime( const ::rtl::OUString& rDateTime )
+@@ -1091,45 +1168,23 @@ util::DateTime lcl_DateStringToDateTime( const ::rtl::OUString& rDateTime )
}
void DomainMapper_Impl::appendTextPortion( const ::rtl::OUString& rString, PropertyMapPtr pPropertyMap )
{
@@ -3461,7 +3562,7 @@ index 051a2b8..0c8c037 100644
}
catch(const lang::IllegalArgumentException& rEx)
{
-@@ -1153,7 +1199,7 @@ void DomainMapper_Impl::appendTextContent(
+@@ -1153,7 +1208,7 @@ void DomainMapper_Impl::appendTextContent(
{
uno::Reference< text::XTextAppendAndConvert > xTextAppendAndConvert( m_aTextAppendStack.top().xTextAppend, uno::UNO_QUERY );
OSL_ENSURE( xTextAppendAndConvert.is(), "trying to append a text content without XTextAppendAndConvert" );
@@ -3470,7 +3571,7 @@ index 051a2b8..0c8c037 100644
{
try
{
-@@ -1167,6 +1213,7 @@ void DomainMapper_Impl::appendTextContent(
+@@ -1167,6 +1222,7 @@ void DomainMapper_Impl::appendTextContent(
}
}
}
@@ -3478,7 +3579,7 @@ index 051a2b8..0c8c037 100644
/*-- 24.04.2008 08:38:07---------------------------------------------------
-----------------------------------------------------------------------*/
-@@ -1319,18 +1366,7 @@ void DomainMapper_Impl::PopPageHeaderFooter()
+@@ -1319,18 +1375,7 @@ void DomainMapper_Impl::PopPageHeaderFooter()
{
//header and footer always have an empty paragraph at the end
//this has to be removed
@@ -3498,7 +3599,7 @@ index 051a2b8..0c8c037 100644
m_aTextAppendStack.pop();
}
/*-- 24.05.2007 14:22:28---------------------------------------------------
-@@ -1351,31 +1387,99 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote )
+@@ -1351,31 +1396,99 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote )
{
xFootnote->setLabel( ::rtl::OUString( pTopContext->GetFootnoteSymbol() ) );
}
@@ -3615,7 +3716,7 @@ index 051a2b8..0c8c037 100644
}
/*-- 22.12.2008 13:45:15---------------------------------------------------
-@@ -1416,57 +1520,58 @@ void DomainMapper_Impl::PopAnnotation()
+@@ -1416,57 +1529,58 @@ void DomainMapper_Impl::PopAnnotation()
m_xAnnotationField.clear();
}
@@ -3712,7 +3813,7 @@ index 051a2b8..0c8c037 100644
}
/*-- 12.09.2006 08:07:55---------------------------------------------------
-@@ -2952,6 +3057,7 @@ void DomainMapper_Impl::CloseFieldCommand()
+@@ -2952,6 +3066,7 @@ void DomainMapper_Impl::CloseFieldCommand()
bool bHyperlinks = false;
bool bFromOutline = false;
bool bFromEntries = false;
@@ -3720,7 +3821,7 @@ index 051a2b8..0c8c037 100644
::rtl::OUString sTemplate;
::rtl::OUString sChapterNoSeparator;
// \a Builds a table of figures but does not include the captions's label and number
-@@ -3001,6 +3107,10 @@ void DomainMapper_Impl::CloseFieldCommand()
+@@ -3001,6 +3116,10 @@ void DomainMapper_Impl::CloseFieldCommand()
if( lcl_FindInCommand( pContext->GetCommand(), 'o', sValue ))
{
bFromOutline = true;
@@ -3731,7 +3832,7 @@ index 051a2b8..0c8c037 100644
}
// \p Defines the separator between the table entry and its page number
if( lcl_FindInCommand( pContext->GetCommand(), 'p', sValue ))
-@@ -3048,6 +3158,7 @@ void DomainMapper_Impl::CloseFieldCommand()
+@@ -3048,6 +3167,7 @@ void DomainMapper_Impl::CloseFieldCommand()
xTOC->setPropertyValue(rPropNameSupplier.GetName( PROP_TITLE ), uno::makeAny(::rtl::OUString()));
if( !bTableOfFigures )
{
@@ -3739,7 +3840,7 @@ index 051a2b8..0c8c037 100644
xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_CREATE_FROM_OUTLINE ), uno::makeAny( bFromOutline ));
xTOC->setPropertyValue( rPropNameSupplier.GetName( PROP_CREATE_FROM_MARKS ), uno::makeAny( bFromEntries ));
if( sTemplate.getLength() )
-@@ -3531,14 +3642,98 @@ bool DomainMapper_Impl::ExecuteFrameConversion()
+@@ -3531,14 +3651,98 @@ bool DomainMapper_Impl::ExecuteFrameConversion()
}
return bRet;
}
@@ -3842,7 +3943,7 @@ index 051a2b8..0c8c037 100644
}}
diff --git writerfilter/source/dmapper/DomainMapper_Impl.hxx writerfilter/source/dmapper/DomainMapper_Impl.hxx
-index f4dfaf0..ab0a561 100644
+index f4dfaf0..6b44e6e 100644
--- writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -34,6 +34,7 @@
@@ -3913,15 +4014,18 @@ index f4dfaf0..ab0a561 100644
//each context needs a stack of currently used attributes
FIB m_aFIB;
-@@ -293,6 +311,7 @@ private:
+@@ -293,8 +311,10 @@ private:
StyleSheetTablePtr m_pStyleSheetTable;
ThemeTablePtr m_pThemeTable;
GraphicImportPtr m_pGraphicImport;
+ SettingsTablePtr m_pSettingsTable;
PropertyMapPtr m_pTopContext;
++ PropertyMapPtr m_pLastSectionContext;
-@@ -311,14 +330,14 @@ private:
+ ::std::vector<DeletableTabStop> m_aCurrentTabStops;
+ sal_uInt32 m_nCurrentTabStopIndex;
+@@ -311,14 +331,14 @@ private:
::com::sun::star::uno::Reference< text::XTextRange > m_xFrameStartRange;
::com::sun::star::uno::Reference< text::XTextRange > m_xFrameEndRange;
@@ -3943,7 +4047,19 @@ index f4dfaf0..ab0a561 100644
//annotation import
uno::Reference< beans::XPropertySet > m_xAnnotationField;
-@@ -357,6 +376,18 @@ public:
+@@ -341,6 +361,11 @@ public:
+ DomainMapper_Impl();
+ virtual ~DomainMapper_Impl();
+
++ SectionPropertyMap* GetLastSectionContext( )
++ {
++ return dynamic_cast< SectionPropertyMap* >( m_pLastSectionContext.get( ) );
++ };
++
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > GetPageStyles();
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > GetBodyText();
+ ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > GetTextFactory() const
+@@ -357,6 +382,18 @@ public:
}
void SetDocumentSettingsProperty( const ::rtl::OUString& rPropName, const uno::Any& rValue );
@@ -3962,7 +4078,7 @@ index f4dfaf0..ab0a561 100644
void deferBreak( BreakType deferredBreakType );
bool isBreakDeferred( BreakType deferredBreakType );
void clearDeferredBreaks();
-@@ -412,6 +443,13 @@ public:
+@@ -412,6 +449,13 @@ public:
return m_pThemeTable;
}
@@ -3976,7 +4092,7 @@ index f4dfaf0..ab0a561 100644
GraphicImportPtr GetGraphicImport( GraphicImportType eGraphicImportType );
void ResetGraphicImport();
// this method deletes the current m_pGraphicImport after import
-@@ -432,10 +470,8 @@ public:
+@@ -432,10 +476,8 @@ public:
void SetAnyTableImport( bool bSet ) { m_bInAnyTableImport = bSet;}
bool IsAnyTableImport()const { return m_bInAnyTableImport;}
@@ -3988,7 +4104,7 @@ index f4dfaf0..ab0a561 100644
void PushPageHeader(SectionPropertyMap::PageType eType);
void PushPageFooter(SectionPropertyMap::PageType eType);
-@@ -466,7 +502,25 @@ public:
+@@ -466,7 +508,25 @@ public:
void AddBookmark( const ::rtl::OUString& rBookmarkName, const ::rtl::OUString& rId );
@@ -4015,7 +4131,7 @@ index f4dfaf0..ab0a561 100644
void SetLineNumbering( sal_Int32 nLnnMod, sal_Int32 nLnc, sal_Int32 ndxaLnn );
bool IsLineNumberingSet() const {return m_bLineNumberingSet;}
-@@ -495,19 +549,17 @@ public:
+@@ -495,19 +555,17 @@ public:
);
bool ExecuteFrameConversion();
@@ -5430,10 +5546,10 @@ index c9acac7..b46e502 100644
struct PropertyNameSupplier_Impl;
class PropertyNameSupplier
diff --git writerfilter/source/dmapper/PropertyMap.cxx writerfilter/source/dmapper/PropertyMap.cxx
-index 0ca1023..01f2cf4 100644
+index 0ca1023..7b9be7d 100644
--- writerfilter/source/dmapper/PropertyMap.cxx
+++ writerfilter/source/dmapper/PropertyMap.cxx
-@@ -35,6 +35,8 @@
+@@ -35,12 +35,15 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/table/BorderLine.hpp>
@@ -5442,15 +5558,46 @@ index 0ca1023..01f2cf4 100644
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/style/BreakType.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
-@@ -175,6 +177,7 @@ void PropertyMap::insertTableProperties( const PropertyMap* )
+ #include <com/sun/star/text/WritingMode.hpp>
+ #include <com/sun/star/text/XTextColumns.hpp>
+ #include <com/sun/star/text/XText.hpp>
++#include <com/sun/star/text/XTextCopy.hpp>
+
+ using namespace ::com::sun::star;
+
+@@ -173,8 +176,9 @@ void PropertyMap::insertTableProperties( const PropertyMap* )
+ /*-- 24.07.2006 08:29:01---------------------------------------------------
+
-----------------------------------------------------------------------*/
- SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
- m_bIsFirstSection( bIsFirstSection )
+-SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
+- m_bIsFirstSection( bIsFirstSection )
++SectionPropertyMap::SectionPropertyMap( bool bFirstSection ) :
++ m_bIsFirstSection( bFirstSection )
+ ,m_nBorderParams( 0 )
,m_bTitlePage( false )
,m_nColumnCount( 0 )
,m_nColumnDistance( 1249 )
-@@ -375,32 +378,21 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
+@@ -202,6 +206,9 @@ SectionPropertyMap::SectionPropertyMap(bool bIsFirstSection) :
+ ,m_ndxaLnn( 0 )
+ ,m_nLnnMin( 0 )
+ {
++#if DEBUG
++ clog << "Creating section" << endl;
++#endif
+ static sal_Int32 nNumber = 0;
+ nSectionNumber = nNumber++;
+ memset(&m_pBorderLines, 0x00, sizeof(m_pBorderLines));
+@@ -241,6 +248,9 @@ SectionPropertyMap::~SectionPropertyMap()
+ {
+ for( sal_Int16 ePos = BORDER_LEFT; ePos <= BORDER_BOTTOM; ++ePos)
+ delete m_pBorderLines[ePos];
++#if DEBUG
++ clog << "Destroying section" << endl;
++#endif
+ }
+ /*-- 24.07.2006 08:31:07---------------------------------------------------
+
+@@ -375,32 +385,21 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
sal_Int32 nOffsetFrom = (nValue & 0x00E0) >> 5;
//sal_Int32 bPageDepth = (nValue & 0x0018) >> 3; //unused infromation: 0 - in front 1 - in back
//todo: negative spacing (from ww8par6.cxx)
@@ -5491,25 +5638,25 @@ index 0ca1023..01f2cf4 100644
break;
case 3: //whole document?
//todo: how to apply a border to the whole document - find all sections or access all page styles?
-@@ -420,8 +412,16 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
+@@ -420,8 +419,16 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
PROP_LEFT_BORDER_DISTANCE,
PROP_RIGHT_BORDER_DISTANCE,
PROP_TOP_BORDER_DISTANCE,
- PROP_BOTTOM_BORDER_DISTANCE,
+ PROP_BOTTOM_BORDER_DISTANCE
- };
++ };
+ static const PropertyIds aMarginIds[4] =
+ {
+ PROP_LEFT_MARGIN,
+ PROP_RIGHT_MARGIN,
+ PROP_TOP_MARGIN,
+ PROP_BOTTOM_MARGIN
-+ };
+ };
+
PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
for( sal_Int32 nBorder = 0; nBorder < 4; ++nBorder)
{
-@@ -434,19 +434,38 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
+@@ -434,19 +441,38 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
}
if( m_nBorderDistances[nBorder] >= 0 )
{
@@ -5555,7 +5702,116 @@ index 0ca1023..01f2cf4 100644
/*-- 14.12.2006 12:50:06---------------------------------------------------
-----------------------------------------------------------------------*/
-@@ -724,8 +743,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
+@@ -550,6 +576,92 @@ bool SectionPropertyMap::HasFooter(bool bFirstPage) const
+ -----------------------------------------------------------------------*/
+ #define MIN_HEAD_FOOT_HEIGHT 100 //minimum header/footer height
+
++void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl )
++{
++#if DEBUG
++ clog << "START>>> SectionPropertyMap::CopyLastHeaderFooter()" << endl;
++#endif
++ SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext( );
++ if ( pLastContext )
++ {
++ uno::Reference< beans::XPropertySet > xPrevStyle = pLastContext->GetPageStyle(
++ rDM_Impl.GetPageStyles(),
++ rDM_Impl.GetTextFactory(),
++ bFirstPage );
++ uno::Reference< beans::XPropertySet > xStyle = GetPageStyle(
++ rDM_Impl.GetPageStyles(),
++ rDM_Impl.GetTextFactory(),
++ bFirstPage );
++
++ PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
++
++ try {
++ // Loop over the Header and Footer properties to copy them
++ static PropertyIds aProperties[] =
++ {
++ PROP_HEADER_TEXT,
++ PROP_FOOTER_TEXT,
++ };
++
++ bool bHasPrevHeader = false;
++ bool bHasHeader = false;
++
++ rtl::OUString sHeaderIsOn = rPropNameSupplier.GetName( PROP_HEADER_IS_ON );
++ xPrevStyle->getPropertyValue( sHeaderIsOn ) >>= bHasPrevHeader;
++ xStyle->getPropertyValue( sHeaderIsOn ) >>= bHasHeader;
++ bool bCopyHeader = bHasPrevHeader && !bHasHeader;
++
++ if ( bCopyHeader )
++ xStyle->setPropertyValue( sHeaderIsOn, uno::makeAny( sal_True ) );
++
++ bool bHasPrevFooter = false;
++ bool bHasFooter = false;
++
++ rtl::OUString sFooterIsOn = rPropNameSupplier.GetName( PROP_FOOTER_IS_ON );
++ xPrevStyle->getPropertyValue( sFooterIsOn ) >>= bHasPrevFooter;
++ xStyle->getPropertyValue( sFooterIsOn ) >>= bHasFooter;
++ bool bCopyFooter = bHasPrevFooter && !bHasFooter;
++
++ if ( bCopyFooter )
++ xStyle->setPropertyValue( sFooterIsOn, uno::makeAny( sal_True ) );
++
++ // Copying the text properties
++ for ( int i = 0, nNbProps = 2; i < nNbProps; i++ )
++ {
++ bool bIsHeader = ( i < nNbProps / 2 );
++ PropertyIds aPropId = aProperties[i];
++ rtl::OUString sName = rPropNameSupplier.GetName( aPropId );
++
++ if ( ( bIsHeader && bCopyHeader ) || ( !bIsHeader && bCopyFooter ) )
++ {
++#if DEBUG
++ clog << "Copying ";
++ clog << rtl::OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
++#endif
++ // TODO has to be copied
++ uno::Reference< text::XTextCopy > xTxt(
++ xStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
++
++ uno::Reference< text::XTextCopy > xPrevTxt(
++ xPrevStyle->getPropertyValue( sName ), uno::UNO_QUERY_THROW );
++
++ xTxt->copyText( xPrevTxt );
++ }
++ }
++ }
++ catch ( const uno::Exception& e )
++ {
++#if DEBUG
++ clog << "An exception occured in SectionPropertyMap::CopyLastHeaderFooter( ) - ";
++ clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl;
++#endif
++ }
++ }
++#if DEBUG
++ clog << "END>>> SectionPropertyMap::CopyLastHeaderFooter()" << endl;
++#endif
++}
++
+ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
+ {
+ sal_Int32 nTopMargin = m_nTopMargin;
+@@ -566,7 +678,6 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
+ m_nHeaderTop = MIN_HEAD_FOOT_HEIGHT;
+ }
+
+-
+ if( nTopMargin >= 0 ) //fixed height header -> see WW8Par6.hxx
+ {
+ operator[]( PropertyDefinition( PROP_HEADER_IS_DYNAMIC_HEIGHT, false )) = uno::makeAny( true );
+@@ -688,6 +799,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
+ /*** if headers/footers are available then the top/bottom margins of the
+ header/footer are copied to the top/bottom margin of the page
+ */
++ CopyLastHeaderFooter( false, rDM_Impl );
+ PrepareHeaderFooterProperties( false );
+
+ const ::rtl::OUString sTrayIndex = rPropNameSupplier.GetName( PROP_PRINTER_PAPER_TRAY_INDEX );
+@@ -724,8 +836,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
sal_Int32 nCharWidth = 423; //240 twip/ 12 pt
//todo: is '0' the right index here?
@@ -5566,7 +5822,12 @@ index 0ca1023..01f2cf4 100644
{
PropertyMap::iterator aElement_ = pEntry->pProperties->find(PropertyDefinition( PROP_CHAR_HEIGHT_ASIAN, false ));
if( aElement_ != pEntry->pProperties->end())
-@@ -764,6 +783,7 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
+@@ -760,10 +872,12 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
+ //todo: creating a "First Page" style depends on HasTitlePage und _fFacingPage_
+ if( m_bTitlePage )
+ {
++ CopyLastHeaderFooter( true, rDM_Impl );
+ PrepareHeaderFooterProperties( true );
uno::Reference< beans::XPropertySet > xFirstPageStyle = GetPageStyle(
rDM_Impl.GetPageStyles(), rDM_Impl.GetTextFactory(), true );
_ApplyProperties( xFirstPageStyle );
@@ -5574,7 +5835,7 @@ index 0ca1023..01f2cf4 100644
sal_Int32 nPaperBin = m_nFirstPaperBin >= 0 ? m_nFirstPaperBin : m_nPaperBin >= 0 ? m_nPaperBin : 0;
if( nPaperBin )
xFollowPageStyle->setPropertyValue( sTrayIndex, uno::makeAny( nPaperBin ) );
-@@ -771,6 +791,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
+@@ -771,6 +885,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
xFollowPageStyle->setPropertyValue(
rPropNameSupplier.GetName( PROP_TEXT_COLUMNS ), uno::makeAny( xColumns ));
}
@@ -5583,7 +5844,7 @@ index 0ca1023..01f2cf4 100644
try
{
// if( m_xStartingRange.is() )
-@@ -778,28 +800,24 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
+@@ -778,28 +894,24 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
//now apply this break at the first paragraph of this section
uno::Reference< beans::XPropertySet > xRangeProperties;
if( m_bIsFirstSection )
@@ -5624,7 +5885,7 @@ index 0ca1023..01f2cf4 100644
}
}
}
-@@ -875,7 +893,8 @@ StyleSheetPropertyMap::StyleSheetPropertyMap() :
+@@ -875,7 +987,8 @@ StyleSheetPropertyMap::StyleSheetPropertyMap() :
mbCT_TblWidth_wSet( false ),
mbCT_TblWidth_typeSet( false ),
mnListId( -1 ),
@@ -5634,8 +5895,13 @@ index 0ca1023..01f2cf4 100644
{
}
/*-- 14.06.2007 13:57:43---------------------------------------------------
+@@ -1045,3 +1158,4 @@ void TablePropertyMap::insertTableProperties( const PropertyMap* pMap )
+
+ }//namespace dmapper
+ }//namespace writerfilter
++
diff --git writerfilter/source/dmapper/PropertyMap.hxx writerfilter/source/dmapper/PropertyMap.hxx
-index c6736fe..526f902 100644
+index c6736fe..2dff30f 100644
--- writerfilter/source/dmapper/PropertyMap.hxx
+++ writerfilter/source/dmapper/PropertyMap.hxx
@@ -158,6 +158,7 @@ class SectionPropertyMap : public PropertyMap
@@ -5646,7 +5912,12 @@ index c6736fe..526f902 100644
bool m_bTitlePage;
sal_Int16 m_nColumnCount;
-@@ -202,6 +203,9 @@ class SectionPropertyMap : public PropertyMap
+@@ -198,12 +199,16 @@ class SectionPropertyMap : public PropertyMap
+ void _ApplyProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle );
+ ::com::sun::star::uno::Reference< com::sun::star::text::XTextColumns > ApplyColumnProperties(
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xFollowPageStyle );
++ void CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl );
+ void PrepareHeaderFooterProperties( bool bFirstPage );
bool HasHeader( bool bFirstPage ) const;
bool HasFooter( bool bFirstPage ) const;
@@ -5654,9 +5925,12 @@ index c6736fe..526f902 100644
+ PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom );
+
public:
- explicit SectionPropertyMap(bool bIsFirstSection);
+- explicit SectionPropertyMap(bool bIsFirstSection);
++ explicit SectionPropertyMap( bool bFirstSection );
~SectionPropertyMap();
-@@ -227,6 +231,7 @@ public:
+
+ enum PageType
+@@ -227,6 +232,7 @@ public:
bool bFirst );
void SetBorder( BorderPosition ePos, sal_Int32 nLineDistance, const ::com::sun::star::table::BorderLine& rBorderLine );
@@ -5664,7 +5938,16 @@ index c6736fe..526f902 100644
void SetColumnCount( sal_Int16 nCount ) { m_nColumnCount = nCount; }
void SetColumnDistance( sal_Int32 nDist ) { m_nColumnDistance = nDist; }
-@@ -376,6 +381,9 @@ typedef boost::shared_ptr<ParagraphProperties> ParagraphPropertiesPtr;
+@@ -270,7 +276,7 @@ public:
+
+ void CloseSectionGroup( DomainMapper_Impl& rDM_Impl );
+ };
+-
++typedef boost::shared_ptr<SectionPropertyMap> SectionPropertyMapPtr;
+ /*-- 28.12.2007 08:17:34---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+@@ -376,6 +382,9 @@ typedef boost::shared_ptr<ParagraphProperties> ParagraphPropertiesPtr;
/*-- 14.06.2007 12:12:34---------------------------------------------------
property map of a stylesheet
-----------------------------------------------------------------------*/
@@ -5674,7 +5957,7 @@ index c6736fe..526f902 100644
class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
{
-@@ -405,6 +413,8 @@ class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
+@@ -405,6 +414,8 @@ class StyleSheetPropertyMap : public PropertyMap, public ParagraphProperties
sal_Int32 mnListId;
sal_Int16 mnListLevel;
@@ -5683,7 +5966,7 @@ index c6736fe..526f902 100644
public:
explicit StyleSheetPropertyMap();
~StyleSheetPropertyMap();
-@@ -479,6 +489,12 @@ public:
+@@ -479,6 +490,12 @@ public:
sal_Int16 GetListLevel() const { return mnListLevel; }
void SetListLevel(sal_Int16 nLevel) { mnListLevel = nLevel; }
More information about the ooo-build-commit
mailing list