[cbosdo03]Applied the patches to upstream

These patches are fixing docx import problems like:
  * Page breaks added at wrong places
  * Additionnal paragraphs added at the end of some sections
  * Hierarchy of numbering properties wasn't working nicely
This commit is contained in:
Cédric Bosdonnat 2009-12-02 09:12:26 +01:00
parent 81087627f3
commit 9c7ffb6b61
25 changed files with 1555 additions and 2230 deletions

View file

@ -65,6 +65,8 @@ namespace dmapper
class PropertyMap;
class DomainMapper_Impl;
class ListsManager;
class StyleSheetTable;
// different context types require different sprm handling (e.g. names)
enum SprmType
@ -106,6 +108,7 @@ public:
virtual void endSectionGroup();
virtual void startParagraphGroup();
virtual void endParagraphGroup();
virtual void markLastParagraphInSection();
virtual void startCharacterGroup();
virtual void endCharacterGroup();
virtual void startShape( ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape );
@ -134,6 +137,8 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetCurrentTextRange();
::rtl::OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties );
boost::shared_ptr< ListsManager > GetListTable( );
boost::shared_ptr< StyleSheetTable > GetStyleSheetTable( );
private:
void handleUnderlineType(const sal_Int32 nIntValue, const ::boost::shared_ptr<PropertyMap> pContext);

View file

@ -210,6 +210,8 @@ public:
*/
virtual void endParagraphGroup() = 0;
virtual void markLastParagraphInSection( ) { };
/**
Receives start mark for group with the same character properties.
*/

View file

@ -33,6 +33,7 @@
#include <dmapper/DomainMapper.hxx>
#include <DomainMapper_Impl.hxx>
#include <ConversionHelper.hxx>
#include <NumberingManager.hxx>
#include <ThemeTable.hxx>
#include <ModelEventListener.hxx>
#include <MeasureHandler.hxx>
@ -1647,7 +1648,9 @@ void DomainMapper::attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_TabStop_val:
/* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
if (sal::static_int_cast<Id>(nIntValue) == NS_ooxml::LN_Value_ST_TabJc_clear)
{
m_pImpl->m_aCurrentTabStop.bDeleted = true;
}
else
{
m_pImpl->m_aCurrentTabStop.bDeleted = false;
@ -1774,8 +1777,11 @@ void DomainMapper::attribute(Id nName, Value & val)
case NS_ooxml::LN_CT_Ind_hanging:
/* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
if (m_pImpl->GetTopContext())
{
sal_Int32 nValue = ConversionHelper::convertTwipToMM100( nIntValue );
m_pImpl->GetTopContext()->Insert(
PROP_PARA_FIRST_LINE_INDENT, true, uno::makeAny( - ConversionHelper::convertTwipToMM100(nIntValue ) ));
PROP_PARA_FIRST_LINE_INDENT, true, uno::makeAny( - nValue ));
}
break;
case NS_ooxml::LN_CT_Ind_firstLine:
/* WRITERFILTERSTATUS: done: 100, planned: 0.5, spent: 0 */
@ -2264,20 +2270,26 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
/* WRITERFILTERSTATUS: comment: */
{
//convert the ListTable entry to a NumberingRules propery and apply it
sal_Int32 nListId = m_pImpl->GetLFOTable()->GetListID( nIntValue );
if(nListId >= 0)
ListsManager::Pointer pListTable = m_pImpl->GetListTable();
ListDef::Pointer pList = pListTable->GetList( nIntValue );
if( pList.get( ) )
{
ListTablePtr pListTable = m_pImpl->GetListTable();
if( m_pImpl->IsStyleSheetImport() )
{
//style sheets cannot have a numbering rule attached
StyleSheetPropertyMap* pStyleSheetPropertyMap = dynamic_cast< StyleSheetPropertyMap* >( rContext.get() );
pStyleSheetPropertyMap->SetListId( nListId );
pStyleSheetPropertyMap->SetListId( nIntValue );
}
else
rContext->Insert( PROP_NUMBERING_RULES, true,
uno::makeAny(pListTable->GetNumberingRules(nListId)));
//TODO: Merge overwrittern numbering levels from LFO table
{
uno::Any aRules = uno::makeAny( pList->GetNumberingRules( ) );
rContext->Insert( PROP_NUMBERING_RULES, true, aRules );
}
}
else if ( !m_pImpl->IsStyleSheetImport( ) )
{
rtl::OUString sNone;
rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny( sNone ) );
}
}
break;
@ -3911,7 +3923,7 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
if( pStyleSheetProperties && pStyleSheetProperties->GetListId() >= 0 )
rContext->Insert( PROP_NUMBERING_STYLE_NAME, true, uno::makeAny(
m_pImpl->GetListTable( )->GetStyleName( pStyleSheetProperties->GetListId( ) ) ), false);
ListDef::GetStyleName( pStyleSheetProperties->GetListId( ) ) ), false);
if( pStyleSheetProperties && pStyleSheetProperties->GetListLevel() >= 0 )
rContext->Insert( PROP_NUMBERING_LEVEL, true, uno::makeAny(pStyleSheetProperties->GetListLevel()), false);
@ -4132,9 +4144,6 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
break;
case NS_ooxml::LN_EG_SectPrContents_formProt: //section protection, only form editing is enabled - unsupported
break;
case NS_ooxml::LN_CT_Lvl_pStyle:
//TODO: numbering style should apply current numbering level - not yet supported
break;
default:
{
#if OSL_DEBUG_LEVEL > 0
@ -4142,7 +4151,10 @@ void DomainMapper::sprm( Sprm& rSprm, PropertyMapPtr rContext, SprmType eSprmTyp
sMessage += ::rtl::OString::valueOf( sal_Int32( nSprmId ), 10 );
sMessage += ::rtl::OString(" / 0x");
sMessage += ::rtl::OString::valueOf( sal_Int32( nSprmId ), 16 );
OSL_ENSURE( false, sMessage.getStr()); //
sMessage += ::rtl::OString(" / ");
sMessage += ::rtl::OString( rSprm.getName( ).c_str( ) );
clog << sMessage.getStr( ) << endl;
// OSL_ENSURE( false, sMessage.getStr()); //
#endif
}
}
@ -4219,38 +4231,6 @@ void DomainMapper::startParagraphGroup()
-----------------------------------------------------------------------*/
void DomainMapper::endParagraphGroup()
{
//handle unprocessed deferred breaks
PropertyMapPtr pParaProperties = m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH);
if( pParaProperties->hasEmptyPropertyValues() )
{
PropertyMap::const_iterator aIter = pParaProperties->find(PropertyDefinition( PROP_BREAK_TYPE , false ) );
if( aIter != pParaProperties->end() )
{
style::BreakType eType;
aIter->second >>= eType;
bool bPage = false;
bool bColumn = false;
if( eType == style::BreakType_PAGE_BEFORE )
bPage = true;
else if( eType == style::BreakType_COLUMN_BEFORE )
bColumn = true;
if( bPage || bColumn )
{
try
{
uno::Reference< beans::XPropertySet > xRangeProperties( m_pImpl->GetTopTextAppend()->getEnd(), uno::UNO_QUERY_THROW );
xRangeProperties->setPropertyValue(
PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_BREAK_TYPE),
uno::makeAny( bPage ? style::BreakType_PAGE_BEFORE : style::BreakType_COLUMN_BEFORE));
}
catch( const uno::Exception& )
{
}
}
}
}
m_pImpl->PopProperties(CONTEXT_PARAGRAPH);
m_pImpl->getTableManager().endParagraphGroup();
//frame conversion has to be executed after table conversion
@ -4260,6 +4240,14 @@ void DomainMapper::endParagraphGroup()
#endif
}
void DomainMapper::markLastParagraphInSection( )
{
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->element( "markLastParagraphInSection" );
#endif
m_pImpl->SetIsLastParagraphInSection( true );
}
void DomainMapper::startShape( uno::Reference< drawing::XShape > xShape )
{
m_pImpl->PushShapeContext( xShape );
@ -4545,9 +4533,12 @@ void DomainMapper::table(Id name, writerfilter::Reference<Table>::Pointer_t ref)
}
break;
case NS_rtf::LN_LFOTABLE:
/* WRITERFILTERSTATUS: done: 0, planned: 0.5, spent: 0 */
ref->resolve( *m_pImpl->GetLFOTable() );
{
m_pImpl->GetListTable( )->SetLFOImport( true );
ref->resolve( *m_pImpl->GetListTable() );
m_pImpl->GetListTable( )->CreateNumberingRules( );
m_pImpl->GetListTable( )->SetLFOImport( false );
}
break;
case NS_ooxml::LN_THEMETABLE:
ref->resolve ( *m_pImpl->GetThemeTable() );
@ -4573,6 +4564,7 @@ void DomainMapper::substream(Id rName, ::writerfilter::Reference<Stream>::Pointe
dmapper_logger->startElement("substream");
#endif
m_pImpl->appendTableManager( );
m_pImpl->getTableManager().startLevel();
//->debug
@ -4642,6 +4634,7 @@ void DomainMapper::substream(Id rName, ::writerfilter::Reference<Stream>::Pointe
}
m_pImpl->getTableManager().endLevel();
m_pImpl->popTableManager( );
#ifdef DEBUG_DOMAINMAPPER
dmapper_logger->endElement("substream");
@ -4808,6 +4801,7 @@ com::sun::star::style::TabAlign DomainMapper::getTabAlignFromValue(const sal_Int
{
case 0:
case 4: // bar not supported
case 5: // num not supported
return com::sun::star::style::TabAlign_LEFT;
case 1:
return com::sun::star::style::TabAlign_CENTER;
@ -4815,8 +4809,6 @@ com::sun::star::style::TabAlign DomainMapper::getTabAlignFromValue(const sal_Int
return com::sun::star::style::TabAlign_RIGHT;
case 3:
return com::sun::star::style::TabAlign_DECIMAL;
default:
return com::sun::star::style::TabAlign_DEFAULT;
}
return com::sun::star::style::TabAlign_LEFT;
}
@ -4856,10 +4848,6 @@ uno::Reference < lang::XMultiServiceFactory > DomainMapper::GetTextFactory() con
/*-- 12.11.2007 10:41:01---------------------------------------------------
-----------------------------------------------------------------------*/
void DomainMapper::AddListIDToLFOTable( sal_Int32 nAbstractNumId )
{
m_pImpl->GetLFOTable()->AddListID( nAbstractNumId );
}
/*-- 31.01.2008 18:19:44---------------------------------------------------
-----------------------------------------------------------------------*/
@ -4877,5 +4865,15 @@ uno::Reference< text::XTextRange > DomainMapper::GetCurrentTextRange()
return pStyleSheets->getOrCreateCharStyle( rCharProperties );
}
ListsManager::Pointer DomainMapper::GetListTable( )
{
return m_pImpl->GetListTable( );
}
StyleSheetTablePtr DomainMapper::GetStyleSheetTable( )
{
return m_pImpl->GetStyleSheetTable( );
}
} //namespace dmapper
} //namespace writerfilter

View file

@ -82,6 +82,7 @@
#if DEBUG
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/style/TabStop.hpp>
#endif
#include <map>
@ -403,7 +404,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bIsPageBreakDeferred( false ),
m_bIsInShape( false ),
m_bShapeContextAdded( false ),
m_TableManager( eDocumentType == DOCUMENT_OOXML ),
m_pLastSectionContext( ),
m_nCurrentTabStopIndex( 0 ),
m_sCurrentParaStyleId(),
m_bInStyleSheetImport( false ),
@ -411,8 +412,11 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bLineNumberingSet( false ),
m_bIsInFootnoteProperties( true ),
m_bIsCustomFtnMark( false ),
m_bIsParaChange( false )
m_bIsParaChange( false ),
m_bParaChanged( false ),
m_bIsLastParaInSection( false )
{
appendTableManager( );
GetBodyText();
uno::Reference< text::XTextAppend > xBodyTextAppend = uno::Reference< text::XTextAppend >( m_xBodyText, uno::UNO_QUERY );
m_aTextAppendStack.push(xBodyTextAppend);
@ -421,16 +425,18 @@ DomainMapper_Impl::DomainMapper_Impl(
uno::Reference< text::XTextAppendAndConvert > xBodyTextAppendAndConvert( m_xBodyText, uno::UNO_QUERY );
TableDataHandler_t::Pointer_t pTableHandler
(new DomainMapperTableHandler(xBodyTextAppendAndConvert, *this));
m_TableManager.setHandler(pTableHandler);
getTableManager( ).setHandler(pTableHandler);
m_TableManager.startLevel();
getTableManager( ).startLevel();
}
/*-- 01.09.2006 10:22:28---------------------------------------------------
-----------------------------------------------------------------------*/
DomainMapper_Impl::~DomainMapper_Impl()
{
m_TableManager.endLevel();
RemoveLastParagraph( );
getTableManager( ).endLevel();
popTableManager( );
}
/*-------------------------------------------------------------------------
@ -484,6 +490,28 @@ void DomainMapper_Impl::SetDocumentSettingsProperty( const ::rtl::OUString& rPro
}
}
}
void DomainMapper_Impl::RemoveLastParagraph( )
{
uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
try
{
uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor();
xCursor->gotoEnd(false);
xCursor->goLeft( 1, true );
xCursor->setString(::rtl::OUString());
}
catch( const uno::Exception& rEx)
{
(void)rEx;
}
}
void DomainMapper_Impl::SetIsLastParagraphInSection( bool bIsLast )
{
m_bIsLastParaInSection = bIsLast;
}
/*-------------------------------------------------------------------------
-----------------------------------------------------------------------*/
@ -534,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())
@ -668,7 +705,7 @@ void DomainMapper_Impl::IncorporateTabStop( const DeletableTabStop & rTabStop )
-----------------------------------------------------------------------*/
uno::Sequence< style::TabStop > DomainMapper_Impl::GetCurrentTabStopAndClear()
{
uno::Sequence< style::TabStop > aRet( m_aCurrentTabStops.size() );
uno::Sequence< style::TabStop > aRet( sal_Int32( m_aCurrentTabStops.size() ) );
style::TabStop* pArray = aRet.getArray();
::std::vector<DeletableTabStop>::const_iterator aIt = m_aCurrentTabStops.begin();
::std::vector<DeletableTabStop>::const_iterator aEndIt = m_aCurrentTabStops.end();
@ -721,11 +758,11 @@ uno::Any DomainMapper_Impl::GetPropertyFromStyleSheet(PropertyIds eId)
/*-------------------------------------------------------------------------
-----------------------------------------------------------------------*/
ListTablePtr DomainMapper_Impl::GetListTable()
ListsManager::Pointer DomainMapper_Impl::GetListTable()
{
if(!m_pListTable)
m_pListTable.reset(
new ListTable( m_rDMapper, m_xTextFactory ));
new ListsManager( m_rDMapper, m_xTextFactory ));
return m_pListTable;
}
@ -854,7 +891,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
TextAppendContext& rAppendContext = m_aTextAppendStack.top();
uno::Reference< text::XTextAppend > xTextAppend = rAppendContext.xTextAppend;
PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
if(xTextAppend.is() && ! m_TableManager.isIgnore())
if(xTextAppend.is() && ! getTableManager( ).isIgnore())
{
try
{
@ -1056,9 +1093,21 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
aProperties[nLength].Value <<= aDrop;
aProperties[nLength].Name = rPropNameSupplier.GetName(PROP_DROP_CAP_FORMAT);
}
#if DEBUG
sal_Int32 nLen = aProperties.getLength();
for ( sal_Int32 i = 0; i < nLen; i++ )
{
uno::Any aValue = aProperties[i].Value;
uno::Sequence< style::TabStop > aTabs;
if ( aValue >>= aTabs )
{
fprintf( stderr, "Found tab stops\n" );
}
}
#endif
uno::Reference< text::XTextRange > xTextRange =
xTextAppend->finishParagraph( aProperties );
m_TableManager.handle(xTextRange);
getTableManager( ).handle(xTextRange);
// Set the anchor of the objects to the created paragraph
while ( m_aAnchoredStack.size( ) > 0 && !m_bIsInShape )
@ -1084,6 +1133,15 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
xCur->goLeft( 1 , true );
uno::Reference< text::XTextRange > xParaEnd( xCur, uno::UNO_QUERY );
CheckParaRedline( xParaEnd );
// Remove the last empty section paragraph if needed
if ( m_bIsLastParaInSection && !m_bParaChanged )
{
RemoveLastParagraph( );
m_bIsLastParaInSection = false;
}
m_bParaChanged = false;
}
if( !bKeepLastParagraphProperties )
rAppendContext.pLastParagraphProperties = pToBeSavedProperties;
@ -1126,7 +1184,7 @@ util::DateTime lcl_DateStringToDateTime( const ::rtl::OUString& rDateTime )
void DomainMapper_Impl::appendTextPortion( const ::rtl::OUString& rString, PropertyMapPtr pPropertyMap )
{
uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
if(xTextAppend.is() && ! m_TableManager.isIgnore())
if(xTextAppend.is() && ! getTableManager( ).isIgnore())
{
try
{
@ -1134,8 +1192,9 @@ void DomainMapper_Impl::appendTextPortion( const ::rtl::OUString& rString, Prope
xTextAppend->appendTextPortion
(rString, pPropertyMap->GetPropertyValues());
CheckRedline( xTextRange );
m_bParaChanged = true;
//m_TableManager.handle(xTextRange);
//getTableManager( ).handle(xTextRange);
}
catch(const lang::IllegalArgumentException& rEx)
{
@ -1159,7 +1218,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" );
if(xTextAppendAndConvert.is() && ! m_TableManager.isIgnore())
if(xTextAppendAndConvert.is() && ! getTableManager( ).isIgnore())
{
try
{
@ -1326,18 +1385,7 @@ void DomainMapper_Impl::PopPageHeaderFooter()
{
//header and footer always have an empty paragraph at the end
//this has to be removed
uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
try
{
uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor();
xCursor->gotoEnd(false);
xCursor->goLeft( 1, true );
xCursor->setString(::rtl::OUString());
}
catch( const uno::Exception& rEx)
{
(void)rEx;
}
RemoveLastParagraph( );
m_aTextAppendStack.pop();
}
/*-- 24.05.2007 14:22:28---------------------------------------------------

View file

@ -48,8 +48,7 @@
#include <DomainMapperTableManager.hxx>
#include <PropertyMap.hxx>
#include <FontTable.hxx>
#include <ListTable.hxx>
#include <LFOTable.hxx>
#include <NumberingManager.hxx>
#include <StyleSheetTable.hxx>
#include <ThemeTable.hxx>
#include <SettingsTable.hxx>
@ -298,21 +297,22 @@ private:
_PageMar m_aPageMargins;
DomainMapperTableManager m_TableManager;
// TableManagers are stacked: one for each stream to avoid any confusion
std::stack< boost::shared_ptr< DomainMapperTableManager > > m_aTableManagers;
//each context needs a stack of currently used attributes
FIB m_aFIB;
PropertyStack m_aPropertyStacks[NUMBER_OF_CONTEXTS];
ContextStack m_aContextStack;
FontTablePtr m_pFontTable;
ListTablePtr m_pListTable;
LFOTablePtr m_pLFOTable;
ListsManager::Pointer m_pListTable;
StyleSheetTablePtr m_pStyleSheetTable;
ThemeTablePtr m_pThemeTable;
GraphicImportPtr m_pGraphicImport;
SettingsTablePtr m_pSettingsTable;
PropertyMapPtr m_pTopContext;
PropertyMapPtr m_pLastSectionContext;
::std::vector<DeletableTabStop> m_aCurrentTabStops;
sal_uInt32 m_nCurrentTabStopIndex;
@ -334,6 +334,8 @@ private:
RedlineParamsPtr m_pParaRedline;
bool m_bIsParaChange;
bool m_bParaChanged;
bool m_bIsLastParaInSection;
//annotation import
uno::Reference< beans::XPropertySet > m_xAnnotationField;
@ -356,6 +358,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
@ -381,6 +388,9 @@ public:
void StartParaChange( );
void EndParaChange( );
void RemoveLastParagraph( );
void SetIsLastParagraphInSection( bool bIsLast );
void deferBreak( BreakType deferredBreakType );
bool isBreakDeferred( BreakType deferredBreakType );
void clearDeferredBreaks();
@ -422,13 +432,7 @@ public:
m_pStyleSheetTable.reset(new StyleSheetTable( m_rDMapper, m_xTextDocument ));
return m_pStyleSheetTable;
}
ListTablePtr GetListTable();
LFOTablePtr GetLFOTable()
{
if(!m_pLFOTable)
m_pLFOTable.reset( new LFOTable );
return m_pLFOTable;
}
ListsManager::Pointer GetListTable();
ThemeTablePtr GetThemeTable()
{
if(!m_pThemeTable)
@ -495,7 +499,24 @@ public:
void AddBookmark( const ::rtl::OUString& rBookmarkName, const ::rtl::OUString& rId );
DomainMapperTableManager& getTableManager() { return m_TableManager; }
DomainMapperTableManager& getTableManager()
{
boost::shared_ptr< DomainMapperTableManager > pMngr = m_aTableManagers.top();
return *pMngr.get( );
}
void appendTableManager( )
{
boost::shared_ptr< DomainMapperTableManager > pMngr(
new DomainMapperTableManager( m_eDocumentType == DOCUMENT_OOXML ) );
m_aTableManagers.push( pMngr );
}
void popTableManager( )
{
if ( m_aTableManagers.size( ) > 0 )
m_aTableManagers.pop( );
}
void SetLineNumbering( sal_Int32 nLnnMod, sal_Int32 nLnc, sal_Int32 ndxaLnn );
bool IsLineNumberingSet() const {return m_bLineNumberingSet;}

View file

@ -1,609 +0,0 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: LFOTable.cxx,v $
* $Revision: 1.5 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include <LFOTable.hxx>
#include <doctok/resourceids.hxx>
#include <vector>
namespace writerfilter {
namespace dmapper
{
using namespace std;
using namespace writerfilter;
struct LFOLevel
{
sal_Int32 nIStartAt;
sal_Int32 nFStartAt;
sal_Int32 nFFormatting;
::rtl::OUString sILevel;
LFOLevel() :
nIStartAt(-1)
,nFStartAt(-1)
,nFFormatting(-1)
{}
};
typedef ::boost::shared_ptr< LFOLevel > LFOLevelPtr;
struct LFOEntry
{
sal_Int32 nListId;
sal_Int32 nCLFOLevel;
vector< LFOLevelPtr > aLFOLevels; //usually empty
LFOEntry() :
nListId(-1)
,nCLFOLevel(-1)
{}
};
typedef ::boost::shared_ptr<LFOEntry> LFOEntryPtr;
struct LFOTable_Impl
{
::std::vector< LFOEntryPtr > m_aLFOEntries; //properties of each level
LFOEntryPtr m_pCurrentEntry;
};
/*-- 27.06.2006 15:13:03---------------------------------------------------
-----------------------------------------------------------------------*/
LFOTable::LFOTable() :
m_pImpl( new LFOTable_Impl )
{
}
/*-- 27.06.2006 15:13:03---------------------------------------------------
-----------------------------------------------------------------------*/
LFOTable::~LFOTable()
{
}
/*-- 27.06.2006 15:13:04---------------------------------------------------
-----------------------------------------------------------------------*/
void LFOTable::attribute(Id Name, Value & val)
{
OSL_ENSURE(m_pImpl->m_pCurrentEntry, "no current entry to write to");
if(!m_pImpl->m_pCurrentEntry)
return;
int nIntValue = val.getInt();
/* WRITERFILTERSTATUS: table: LFOTable_attributedata */
switch( Name )
{
// case NS_rtf::LN_ISTD: break;//index of applied style
/* WRITERFILTERSTATUS: done: 50, planned: 0, spent: 0 */
case NS_rtf::LN_ISTARTAT:
/* WRITERFILTERSTATUS: done: 50, planned: 0, spent: 0 */
case NS_rtf::LN_ILVL:
/* WRITERFILTERSTATUS: done: 50, planned: 0, spent: 0 */
case NS_rtf::LN_FSTARTAT:
/* WRITERFILTERSTATUS: done: 50, planned: 0, spent: 0 */
case NS_rtf::LN_FFORMATTING:
if(m_pImpl->m_pCurrentEntry->aLFOLevels.size())
{
vector< LFOLevelPtr >::reverse_iterator aEndIter = m_pImpl->m_pCurrentEntry->aLFOLevels.rbegin();
switch( Name )
{
case NS_rtf::LN_ISTARTAT:
(*aEndIter)->nIStartAt = nIntValue;
break;
case NS_rtf::LN_ILVL:
(*aEndIter)->sILevel = val.getString();
break;
case NS_rtf::LN_FSTARTAT:
(*aEndIter)->nFStartAt = nIntValue;
break;
case NS_rtf::LN_FFORMATTING:
(*aEndIter)->nFFormatting = nIntValue;
break;
default:;
}
}
break;
// case NS_rtf::LN_NFC: break;
// case NS_rtf::LN_JC: break;
// case NS_rtf::LN_FLEGAL: break;
// case NS_rtf::LN_FNORESTART: break;
// case NS_rtf::LN_FPREV: break;
// case NS_rtf::LN_FPREVSPACE: break;
// case NS_rtf::LN_FWORD6: break;
// case NS_rtf::LN_UNUSED5_7: break;
// case NS_rtf::LN_RGBXCHNUMS: break;
// case NS_rtf::LN_IXCHFOLLOW: break;
// case NS_rtf::LN_DXASPACE: break;
// case NS_rtf::LN_DXAINDENT: break;
// case NS_rtf::LN_CBGRPPRLCHPX: break;
// case NS_rtf::LN_CBGRPPRLPAPX: break;
/* WRITERFILTERSTATUS: done: 50, planned: 0, spent: 0 */
case NS_rtf::LN_LSID:
m_pImpl->m_pCurrentEntry->nListId = nIntValue;
break;
// case NS_rtf::LN_TPLC: break;
// case NS_rtf::LN_RGISTD: break;
// case NS_rtf::LN_FSIMPLELIST: break;
// case NS_rtf::LN_FRESTARTHDN: break;
// case NS_rtf::LN_UNSIGNED26_2: break;
// case NS_rtf::LN_UNSIGNED4_6: break;
/* WRITERFILTERSTATUS: done: 1, planned: 0, spent: 0 */
case NS_rtf::LN_UNUSED4:
/* WRITERFILTERSTATUS: done: 1, planned: 0, spent: 0 */
case NS_rtf::LN_UNUSED8:
// as the names state they are unused
break;
/* WRITERFILTERSTATUS: done: 50, planned: 0, spent: 0 */
case NS_rtf::LN_CLFOLVL:
m_pImpl->m_pCurrentEntry->nCLFOLevel = nIntValue;
break;
// case NS_rtf::LN_CBFFNM1: break;
// case NS_rtf::LN_PRQ: break;
// case NS_rtf::LN_FTRUETYPE: break;
// case NS_rtf::LN_UNUSED1_3: break;
// case NS_rtf::LN_FF: break;
// case NS_rtf::LN_UNUSED1_7: break;
// case NS_rtf::LN_WWEIGHT: break;
// case NS_rtf::LN_CHS: break;
// case NS_rtf::LN_IXCHSZALT: break;
// case NS_rtf::LN_PANOSE: break;
// case NS_rtf::LN_FS: break;
// case NS_rtf::LN_STI: break;
// case NS_rtf::LN_FSCRATCH: break;
// case NS_rtf::LN_FINVALHEIGHT: break;
// case NS_rtf::LN_FHASUPE: break;
// case NS_rtf::LN_FMASSCOPY: break;
// case NS_rtf::LN_SGC: break;
// case NS_rtf::LN_ISTDBASE: break;
// case NS_rtf::LN_CUPX: break;
// case NS_rtf::LN_ISTDNEXT: break;
// case NS_rtf::LN_BCHUPE: break;
// case NS_rtf::LN_FAUTOREDEF: break;
// case NS_rtf::LN_FHIDDEN: break;
// case NS_rtf::LN_UNUSED8_3: break;
// case NS_rtf::LN_CSTD: break;
// case NS_rtf::LN_CBSTDBASEINFILE: break;
// case NS_rtf::LN_FSTDSTYLENAMESWRITTEN: break;
// case NS_rtf::LN_UNUSED4_2: break;
// case NS_rtf::LN_STIMAXWHENSAVED: break;
// case NS_rtf::LN_ISTDMAXFIXEDWHENSAVED: break;
// case NS_rtf::LN_NVERBUILTINNAMESWHENSAVED: break;
// case NS_rtf::LN_RGFTCSTANDARDCHPSTSH: break;
// case NS_rtf::LN_WIDENT: break;
// case NS_rtf::LN_NFIB: break;
// case NS_rtf::LN_NPRODUCT: break;
// case NS_rtf::LN_LID: break;
// case NS_rtf::LN_PNNEXT: break;
// case NS_rtf::LN_FDOT: break;
// case NS_rtf::LN_FGLSY: break;
// case NS_rtf::LN_FCOMPLEX: break;
// case NS_rtf::LN_FHASPIC: break;
// case NS_rtf::LN_CQUICKSAVES: break;
// case NS_rtf::LN_FENCRYPTED: break;
// case NS_rtf::LN_FWHICHTBLSTM: break;
// case NS_rtf::LN_FREADONLYRECOMMENDED: break;
// case NS_rtf::LN_FWRITERESERVATION: break;
// case NS_rtf::LN_FEXTCHAR: break;
// case NS_rtf::LN_FLOADOVERRIDE: break;
// case NS_rtf::LN_FFAREAST: break;
// case NS_rtf::LN_FCRYPTO: break;
// case NS_rtf::LN_NFIBBACK: break;
// case NS_rtf::LN_LKEY: break;
// case NS_rtf::LN_ENVR: break;
// case NS_rtf::LN_FMAC: break;
// case NS_rtf::LN_FEMPTYSPECIAL: break;
// case NS_rtf::LN_FLOADOVERRIDEPAGE: break;
// case NS_rtf::LN_FFUTURESAVEDUNDO: break;
// case NS_rtf::LN_FWORD97SAVED: break;
// case NS_rtf::LN_FSPARE0: break;
// case NS_rtf::LN_CHSTABLES: break;
// case NS_rtf::LN_FCMIN: break;
// case NS_rtf::LN_FCMAC: break;
// case NS_rtf::LN_CSW: break;
// case NS_rtf::LN_WMAGICCREATED: break;
// case NS_rtf::LN_WMAGICREVISED: break;
// case NS_rtf::LN_WMAGICCREATEDPRIVATE: break;
// case NS_rtf::LN_WMAGICREVISEDPRIVATE: break;
// case NS_rtf::LN_PNFBPCHPFIRST_W6: break;
// case NS_rtf::LN_PNCHPFIRST_W6: break;
// case NS_rtf::LN_CPNBTECHP_W6: break;
// case NS_rtf::LN_PNFBPPAPFIRST_W6: break;
// case NS_rtf::LN_PNPAPFIRST_W6: break;
// case NS_rtf::LN_CPNBTEPAP_W6: break;
// case NS_rtf::LN_PNFBPLVCFIRST_W6: break;
// case NS_rtf::LN_PNLVCFIRST_W6: break;
// case NS_rtf::LN_CPNBTELVC_W6: break;
// case NS_rtf::LN_LIDFE: break;
// case NS_rtf::LN_CLW: break;
// case NS_rtf::LN_CBMAC: break;
// case NS_rtf::LN_LPRODUCTCREATED: break;
// case NS_rtf::LN_LPRODUCTREVISED: break;
// case NS_rtf::LN_CCPTEXT: break;
// case NS_rtf::LN_CCPFTN: break;
// case NS_rtf::LN_CCPHDD: break;
// case NS_rtf::LN_CCPMCR: break;
// case NS_rtf::LN_CCPATN: break;
// case NS_rtf::LN_CCPEDN: break;
// case NS_rtf::LN_CCPTXBX: break;
// case NS_rtf::LN_CCPHDRTXBX: break;
// case NS_rtf::LN_PNFBPCHPFIRST: break;
// case NS_rtf::LN_PNCHPFIRST: break;
// case NS_rtf::LN_CPNBTECHP: break;
// case NS_rtf::LN_PNFBPPAPFIRST: break;
// case NS_rtf::LN_PNPAPFIRST: break;
// case NS_rtf::LN_CPNBTEPAP: break;
// case NS_rtf::LN_PNFBPLVCFIRST: break;
// case NS_rtf::LN_PNLVCFIRST: break;
// case NS_rtf::LN_CPNBTELVC: break;
// case NS_rtf::LN_FCISLANDFIRST: break;
// case NS_rtf::LN_FCISLANDLIM: break;
// case NS_rtf::LN_CFCLCB: break;
// case NS_rtf::LN_FCSTSHFORIG: break;
// case NS_rtf::LN_LCBSTSHFORIG: break;
// case NS_rtf::LN_FCSTSHF: break;
// case NS_rtf::LN_LCBSTSHF: break;
// case NS_rtf::LN_FCPLCFFNDREF: break;
// case NS_rtf::LN_LCBPLCFFNDREF: break;
// case NS_rtf::LN_FCPLCFFNDTXT: break;
// case NS_rtf::LN_LCBPLCFFNDTXT: break;
// case NS_rtf::LN_FCPLCFANDREF: break;
// case NS_rtf::LN_LCBPLCFANDREF: break;
// case NS_rtf::LN_FCPLCFANDTXT: break;
// case NS_rtf::LN_LCBPLCFANDTXT: break;
// case NS_rtf::LN_FCPLCFSED: break;
// case NS_rtf::LN_LCBPLCFSED: break;
// case NS_rtf::LN_FCPLCFPAD: break;
// case NS_rtf::LN_LCBPLCFPAD: break;
// case NS_rtf::LN_FCPLCFPHE: break;
// case NS_rtf::LN_LCBPLCFPHE: break;
// case NS_rtf::LN_FCSTTBFGLSY: break;
// case NS_rtf::LN_LCBSTTBFGLSY: break;
// case NS_rtf::LN_FCPLCFGLSY: break;
// case NS_rtf::LN_LCBPLCFGLSY: break;
// case NS_rtf::LN_FCPLCFHDD: break;
// case NS_rtf::LN_LCBPLCFHDD: break;
// case NS_rtf::LN_FCPLCFBTECHPX: break;
// case NS_rtf::LN_LCBPLCFBTECHPX: break;
// case NS_rtf::LN_FCPLCFBTEPAPX: break;
// case NS_rtf::LN_LCBPLCFBTEPAPX: break;
// case NS_rtf::LN_FCPLCFSEA: break;
// case NS_rtf::LN_LCBPLCFSEA: break;
// case NS_rtf::LN_FCSTTBFFFN: break;
// case NS_rtf::LN_LCBSTTBFFFN: break;
// case NS_rtf::LN_FCPLCFFLDMOM: break;
// case NS_rtf::LN_LCBPLCFFLDMOM: break;
// case NS_rtf::LN_FCPLCFFLDHDR: break;
// case NS_rtf::LN_LCBPLCFFLDHDR: break;
// case NS_rtf::LN_FCPLCFFLDFTN: break;
// case NS_rtf::LN_LCBPLCFFLDFTN: break;
// case NS_rtf::LN_FCPLCFFLDATN: break;
// case NS_rtf::LN_LCBPLCFFLDATN: break;
// case NS_rtf::LN_FCPLCFFLDMCR: break;
// case NS_rtf::LN_LCBPLCFFLDMCR: break;
// case NS_rtf::LN_FCSTTBFBKMK: break;
// case NS_rtf::LN_LCBSTTBFBKMK: break;
// case NS_rtf::LN_FCPLCFBKF: break;
// case NS_rtf::LN_LCBPLCFBKF: break;
// case NS_rtf::LN_FCPLCFBKL: break;
// case NS_rtf::LN_LCBPLCFBKL: break;
// case NS_rtf::LN_FCCMDS: break;
// case NS_rtf::LN_LCBCMDS: break;
// case NS_rtf::LN_FCPLCMCR: break;
// case NS_rtf::LN_LCBPLCMCR: break;
// case NS_rtf::LN_FCSTTBFMCR: break;
// case NS_rtf::LN_LCBSTTBFMCR: break;
// case NS_rtf::LN_FCPRDRVR: break;
// case NS_rtf::LN_LCBPRDRVR: break;
// case NS_rtf::LN_FCPRENVPORT: break;
// case NS_rtf::LN_LCBPRENVPORT: break;
// case NS_rtf::LN_FCPRENVLAND: break;
// case NS_rtf::LN_LCBPRENVLAND: break;
// case NS_rtf::LN_FCWSS: break;
// case NS_rtf::LN_LCBWSS: break;
// case NS_rtf::LN_FCDOP: break;
// case NS_rtf::LN_LCBDOP: break;
// case NS_rtf::LN_FCSTTBFASSOC: break;
// case NS_rtf::LN_LCBSTTBFASSOC: break;
// case NS_rtf::LN_FCCLX: break;
// case NS_rtf::LN_LCBCLX: break;
// case NS_rtf::LN_FCPLCFPGDFTN: break;
// case NS_rtf::LN_LCBPLCFPGDFTN: break;
// case NS_rtf::LN_FCAUTOSAVESOURCE: break;
// case NS_rtf::LN_LCBAUTOSAVESOURCE: break;
// case NS_rtf::LN_FCGRPXSTATNOWNERS: break;
// case NS_rtf::LN_LCBGRPXSTATNOWNERS: break;
// case NS_rtf::LN_FCSTTBFATNBKMK: break;
// case NS_rtf::LN_LCBSTTBFATNBKMK: break;
// case NS_rtf::LN_FCPLCDOAMOM: break;
// case NS_rtf::LN_LCBPLCDOAMOM: break;
// case NS_rtf::LN_FCPLCDOAHDR: break;
// case NS_rtf::LN_LCBPLCDOAHDR: break;
// case NS_rtf::LN_FCPLCSPAMOM: break;
// case NS_rtf::LN_LCBPLCSPAMOM: break;
// case NS_rtf::LN_FCPLCSPAHDR: break;
// case NS_rtf::LN_LCBPLCSPAHDR: break;
// case NS_rtf::LN_FCPLCFATNBKF: break;
// case NS_rtf::LN_LCBPLCFATNBKF: break;
// case NS_rtf::LN_FCPLCFATNBKL: break;
// case NS_rtf::LN_LCBPLCFATNBKL: break;
// case NS_rtf::LN_FCPMS: break;
// case NS_rtf::LN_LCBPMS: break;
// case NS_rtf::LN_FCFORMFLDSTTBF: break;
// case NS_rtf::LN_LCBFORMFLDSTTBF: break;
// case NS_rtf::LN_FCPLCFENDREF: break;
// case NS_rtf::LN_LCBPLCFENDREF: break;
// case NS_rtf::LN_FCPLCFENDTXT: break;
// case NS_rtf::LN_LCBPLCFENDTXT: break;
// case NS_rtf::LN_FCPLCFFLDEDN: break;
// case NS_rtf::LN_LCBPLCFFLDEDN: break;
// case NS_rtf::LN_FCPLCFPGDEDN: break;
// case NS_rtf::LN_LCBPLCFPGDEDN: break;
// case NS_rtf::LN_FCDGGINFO: break;
// case NS_rtf::LN_LCBDGGINFO: break;
// case NS_rtf::LN_FCSTTBFRMARK: break;
// case NS_rtf::LN_LCBSTTBFRMARK: break;
// case NS_rtf::LN_FCSTTBFCAPTION: break;
// case NS_rtf::LN_LCBSTTBFCAPTION: break;
// case NS_rtf::LN_FCSTTBFAUTOCAPTION: break;
// case NS_rtf::LN_LCBSTTBFAUTOCAPTION: break;
// case NS_rtf::LN_FCPLCFWKB: break;
// case NS_rtf::LN_LCBPLCFWKB: break;
// case NS_rtf::LN_FCPLCFSPL: break;
// case NS_rtf::LN_LCBPLCFSPL: break;
// case NS_rtf::LN_FCPLCFTXBXTXT: break;
// case NS_rtf::LN_LCBPLCFTXBXTXT: break;
// case NS_rtf::LN_FCPLCFFLDTXBX: break;
// case NS_rtf::LN_LCBPLCFFLDTXBX: break;
// case NS_rtf::LN_FCPLCFHDRTXBXTXT: break;
// case NS_rtf::LN_LCBPLCFHDRTXBXTXT: break;
// case NS_rtf::LN_FCPLCFFLDHDRTXBX: break;
// case NS_rtf::LN_LCBPLCFFLDHDRTXBX: break;
// case NS_rtf::LN_FCSTWUSER: break;
// case NS_rtf::LN_LCBSTWUSER: break;
// case NS_rtf::LN_FCSTTBTTMBD: break;
// case NS_rtf::LN_LCBSTTBTTMBD: break;
// case NS_rtf::LN_FCUNUSED: break;
// case NS_rtf::LN_LCBUNUSED: break;
// case NS_rtf::LN_FCPGDMOTHER: break;
// case NS_rtf::LN_LCBPGDMOTHER: break;
// case NS_rtf::LN_FCBKDMOTHER: break;
// case NS_rtf::LN_LCBBKDMOTHER: break;
// case NS_rtf::LN_FCPGDFTN: break;
// case NS_rtf::LN_LCBPGDFTN: break;
// case NS_rtf::LN_FCBKDFTN: break;
// case NS_rtf::LN_LCBBKDFTN: break;
// case NS_rtf::LN_FCPGDEDN: break;
// case NS_rtf::LN_LCBPGDEDN: break;
// case NS_rtf::LN_FCBKDEDN: break;
// case NS_rtf::LN_LCBBKDEDN: break;
// case NS_rtf::LN_FCSTTBFINTLFLD: break;
// case NS_rtf::LN_LCBSTTBFINTLFLD: break;
// case NS_rtf::LN_FCROUTESLIP: break;
// case NS_rtf::LN_LCBROUTESLIP: break;
// case NS_rtf::LN_FCSTTBSAVEDBY: break;
// case NS_rtf::LN_LCBSTTBSAVEDBY: break;
// case NS_rtf::LN_FCSTTBFNM: break;
// case NS_rtf::LN_LCBSTTBFNM: break;
// case NS_rtf::LN_FCPLCFLST: break;
// case NS_rtf::LN_LCBPLCFLST: break;
// case NS_rtf::LN_FCPLFLFO: break;
// case NS_rtf::LN_LCBPLFLFO: break;
// case NS_rtf::LN_FCPLCFTXBXBKD: break;
// case NS_rtf::LN_LCBPLCFTXBXBKD: break;
// case NS_rtf::LN_FCPLCFTXBXHDRBKD: break;
// case NS_rtf::LN_LCBPLCFTXBXHDRBKD: break;
// case NS_rtf::LN_FCDOCUNDO: break;
// case NS_rtf::LN_LCBDOCUNDO: break;
// case NS_rtf::LN_FCRGBUSE: break;
// case NS_rtf::LN_LCBRGBUSE: break;
// case NS_rtf::LN_FCUSP: break;
// case NS_rtf::LN_LCBUSP: break;
// case NS_rtf::LN_FCUSKF: break;
// case NS_rtf::LN_LCBUSKF: break;
// case NS_rtf::LN_FCPLCUPCRGBUSE: break;
// case NS_rtf::LN_LCBPLCUPCRGBUSE: break;
// case NS_rtf::LN_FCPLCUPCUSP: break;
// case NS_rtf::LN_LCBPLCUPCUSP: break;
// case NS_rtf::LN_FCSTTBGLSYSTYLE: break;
// case NS_rtf::LN_LCBSTTBGLSYSTYLE: break;
// case NS_rtf::LN_FCPLGOSL: break;
// case NS_rtf::LN_LCBPLGOSL: break;
// case NS_rtf::LN_FCPLCOCX: break;
// case NS_rtf::LN_LCBPLCOCX: break;
// case NS_rtf::LN_FCPLCFBTELVC: break;
// case NS_rtf::LN_LCBPLCFBTELVC: break;
// case NS_rtf::LN_DWLOWDATETIME: break;
// case NS_rtf::LN_DWHIGHDATETIME: break;
// case NS_rtf::LN_FCPLCFLVC: break;
// case NS_rtf::LN_LCBPLCFLVC: break;
// case NS_rtf::LN_FCPLCASUMY: break;
// case NS_rtf::LN_LCBPLCASUMY: break;
// case NS_rtf::LN_FCPLCFGRAM: break;
// case NS_rtf::LN_LCBPLCFGRAM: break;
// case NS_rtf::LN_FCSTTBLISTNAMES: break;
// case NS_rtf::LN_LCBSTTBLISTNAMES: break;
// case NS_rtf::LN_FCSTTBFUSSR: break;
// case NS_rtf::LN_LCBSTTBFUSSR: break;
// case NS_rtf::LN_FN: break;
// case NS_rtf::LN_FCSEPX: break;
// case NS_rtf::LN_FNMPR: break;
// case NS_rtf::LN_FCMPR: break;
// case NS_rtf::LN_ICOFORE: break;
// case NS_rtf::LN_ICOBACK: break;
// case NS_rtf::LN_IPAT: break;
// case NS_rtf::LN_SHDFORECOLOR: break;
// case NS_rtf::LN_SHDBACKCOLOR: break;
// case NS_rtf::LN_SHDPATTERN: break;
// case NS_rtf::LN_DPTLINEWIDTH: break;
// case NS_rtf::LN_BRCTYPE: break;
// case NS_rtf::LN_ICO: break;
// case NS_rtf::LN_DPTSPACE: break;
// case NS_rtf::LN_FSHADOW: break;
// case NS_rtf::LN_FFRAME: break;
// case NS_rtf::LN_UNUSED2_15: break;
// case NS_rtf::LN_FFIRSTMERGED: break;
// case NS_rtf::LN_FMERGED: break;
// case NS_rtf::LN_FVERTICAL: break;
// case NS_rtf::LN_FBACKWARD: break;
// case NS_rtf::LN_FROTATEFONT: break;
// case NS_rtf::LN_FVERTMERGE: break;
// case NS_rtf::LN_FVERTRESTART: break;
// case NS_rtf::LN_VERTALIGN: break;
// case NS_rtf::LN_FUNUSED: break;
// case NS_rtf::LN_WUNUSED: break;
// case NS_rtf::LN_BRCTOP: break;
// case NS_rtf::LN_BRCLEFT: break;
// case NS_rtf::LN_BRCBOTTOM: break;
// case NS_rtf::LN_BRCRIGHT: break;
// case NS_rtf::LN_IBKL: break;
// case NS_rtf::LN_ITCFIRST: break;
// case NS_rtf::LN_FPUB: break;
// case NS_rtf::LN_ITCLIM: break;
// case NS_rtf::LN_FCOL: break;
// case NS_rtf::LN_LINECOLOR: break;
// case NS_rtf::LN_LINEWIDTH: break;
// case NS_rtf::LN_LINETYPE: break;
// case NS_rtf::LN_MM: break;
// case NS_rtf::LN_XEXT: break;
// case NS_rtf::LN_YEXT: break;
// case NS_rtf::LN_HMF: break;
// case NS_rtf::LN_LCB: break;
// case NS_rtf::LN_CBHEADER: break;
// case NS_rtf::LN_MFP: break;
// case NS_rtf::LN_BM_RCWINMF: break;
// case NS_rtf::LN_DXAGOAL: break;
// case NS_rtf::LN_DYAGOAL: break;
// case NS_rtf::LN_MX: break;
// case NS_rtf::LN_MY: break;
// case NS_rtf::LN_DXACROPLEFT: break;
// case NS_rtf::LN_DYACROPTOP: break;
// case NS_rtf::LN_DXACROPRIGHT: break;
// case NS_rtf::LN_DYACROPBOTTOM: break;
// case NS_rtf::LN_BRCL: break;
// case NS_rtf::LN_FFRAMEEMPTY: break;
// case NS_rtf::LN_FBITMAP: break;
// case NS_rtf::LN_FDRAWHATCH: break;
// case NS_rtf::LN_FERROR: break;
// case NS_rtf::LN_BPP: break;
// case NS_rtf::LN_DXAORIGIN: break;
// case NS_rtf::LN_DYAORIGIN: break;
// case NS_rtf::LN_CPROPS: break;
// case NS_rtf::LN_LINEPROPSTOP: break;
// case NS_rtf::LN_LINEPROPSLEFT: break;
// case NS_rtf::LN_LINEPROPSBOTTOM: break;
// case NS_rtf::LN_LINEPROPSRIGHT: break;
// case NS_rtf::LN_LINEPROPSHORIZONTAL: break;
// case NS_rtf::LN_LINEPROPSVERTICAL: break;
// case NS_rtf::LN_headerr: break;
// case NS_rtf::LN_footerr: break;
// case NS_rtf::LN_endnote: break;
// case NS_rtf::LN_BOOKMARKNAME: break;
// case NS_rtf::LN_LISTLEVEL: break;
/* WRITERFILTERSTATUS: done: 50, planned: 0, spent: 0 */
case NS_rtf::LN_LFO:
{
writerfilter::Reference<Properties>::Pointer_t pProperties;
if(m_pImpl->m_pCurrentEntry && (pProperties = val.getProperties()).get())
{
LFOLevelPtr pLevel( new LFOLevel );
m_pImpl->m_pCurrentEntry->aLFOLevels.push_back(pLevel);
}
}
break;
// case NS_rtf::LN_F: break;
// case NS_rtf::LN_ALTFONTNAME: break;
// case NS_rtf::LN_XSZFFN: break;
// case NS_rtf::LN_XSTZNAME: break;
// case NS_rtf::LN_XSTZNAME1: break;
// case NS_rtf::LN_UPXSTART: break;
// case NS_rtf::LN_UPX: break;
// case NS_rtf::LN_sed: break;
// case NS_rtf::LN_picf: break;
// case NS_rtf::LN_rgbrc: break;
// case NS_rtf::LN_shd: break;
// case NS_rtf::LN_cellShd: break;
// case NS_rtf::LN_cellTopColor: break;
// case NS_rtf::LN_cellLeftColor: break;
// case NS_rtf::LN_cellBottomColor: break;
// case NS_rtf::LN_cellRightColor: break;
// case NS_rtf::LN_LISTTABLE: break;
// case NS_rtf::LN_LFOTABLE: break;
// case NS_rtf::LN_FONTTABLE: break;
// case NS_rtf::LN_STYLESHEET: break;
default:
{
OSL_ENSURE( false, "LFOTable::attribute: default statement");
//---->debug
int nVal = val.getInt();
++nVal;
//<----debug
}
}
}
/*-- 27.06.2006 15:13:04---------------------------------------------------
-----------------------------------------------------------------------*/
void LFOTable::sprm(Sprm& )
{
OSL_ENSURE( false, "Which sprm should be handled here?");
}
/*-- 27.06.2006 15:13:04---------------------------------------------------
-----------------------------------------------------------------------*/
void LFOTable::entry(int, writerfilter::Reference<Properties>::Pointer_t ref)
{
//create a new LFO entry
OSL_ENSURE( !m_pImpl->m_pCurrentEntry.get(), "current entry has to be NULL here");
m_pImpl->m_pCurrentEntry.reset( new LFOEntry );
ref->resolve(*this);
//append it to the table
m_pImpl->m_aLFOEntries.push_back( m_pImpl->m_pCurrentEntry );
m_pImpl->m_pCurrentEntry = LFOEntryPtr();
}
/*-- 27.06.2006 15:13:05---------------------------------------------------
1 based access to the LFO table
-----------------------------------------------------------------------*/
sal_Int32 LFOTable::GetListID(sal_uInt32 nLFO)
{
sal_Int32 nRet = -1;
if( nLFO > 0 && nLFO <= m_pImpl->m_aLFOEntries.size())
nRet = m_pImpl->m_aLFOEntries[nLFO - 1]->nListId;
return nRet;
}
/*-- 12.11.2007 10:31:23---------------------------------------------------
-----------------------------------------------------------------------*/
void LFOTable::AddListID( sal_Int32 nAbstractNumId )
{
LFOEntryPtr pNew( new LFOEntry );
pNew->nListId = nAbstractNumId;
m_pImpl->m_aLFOEntries.push_back( pNew );
}
}//namespace dmapper
}//namespace writerfilter

View file

@ -1,68 +0,0 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: LFOTable.hxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef INCLUDED_LFOTABLE_HXX
#define INCLUDED_LFOTABLE_HXX
#include <WriterFilterDllApi.hxx>
#include <resourcemodel/WW8ResourceModel.hxx>
#include <com/sun/star/lang/XComponent.hpp>
//#ifndef INCLUDED_DMAPPER_PROPERTYMAP_HXX
//#include <PropertyMap.hxx>
//#endif
//#include <vector>
namespace writerfilter {
namespace dmapper
{
struct LFOTable_Impl;
class WRITERFILTER_DLLPRIVATE LFOTable : public Properties, public Table
{
LFOTable_Impl *m_pImpl;
public:
LFOTable();
virtual ~LFOTable();
// Properties
virtual void attribute(Id Name, Value & val);
virtual void sprm(Sprm & sprm);
// Table
virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
// sal_uInt32 size();
sal_Int32 GetListID(sal_uInt32 nLFO);
//direct access in ooxml import
void AddListID( sal_Int32 nAbstractNumId );
};
typedef boost::shared_ptr< LFOTable > LFOTablePtr;
}}
#endif //

File diff suppressed because it is too large Load diff

View file

@ -1,92 +0,0 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: ListTable.hxx,v $
* $Revision: 1.5 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef INCLUDED_LISTTABLE_HXX
#define INCLUDED_LISTTABLE_HXX
#include <WriterFilterDllApi.hxx>
#include <PropertyMap.hxx>
#include <resourcemodel/WW8ResourceModel.hxx>
namespace com{ namespace sun { namespace star {
namespace text{
class XTextDocument;
}
namespace container{
class XIndexReplace;
}
namespace lang{
class XMultiServiceFactory;
}
}}}
namespace writerfilter {
namespace dmapper
{
class DomainMapper;
struct ListTable_Impl;
class WRITERFILTER_DLLPRIVATE ListTable :
public Properties,
public Table
{
ListTable_Impl *m_pImpl;
sal_Int32 m_nOverwriteListId;
sal_Int32 m_nOverwriteLevel;
void ApplyLevelValues( sal_Int32 nId, sal_Int32 nIntValue);
public:
ListTable(
DomainMapper& rDMapper,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory);
virtual ~ListTable();
// Properties
virtual void attribute(Id Name, Value & val);
virtual void sprm(Sprm & sprm);
// Table
virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
// BinaryObj
// virtual void data(const sal_Int8* buf, size_t len,
// writerfilter::Reference<Properties>::Pointer_t ref);
sal_uInt32 size() const;
rtl::OUString GetStyleName( sal_Int32 nListId );
void CreateNumberingRules( );
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace >
GetNumberingRules(sal_Int32 nListId);
void setOverwriteLevel(sal_Int32 nAbstractNumId, sal_Int32 nLevel);
void resetOverwrite();
};
typedef boost::shared_ptr< ListTable > ListTablePtr;
}}
#endif //

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,224 @@
#ifndef INCLUDED_NUMBERINGMANAGER_HXX
#define INCLUDED_NUMBERINGMANAGER_HXX
#include "PropertyMap.hxx"
#include <WriterFilterDllApi.hxx>
#include <dmapper/DomainMapper.hxx>
#include <resourcemodel/WW8ResourceModel.hxx>
#include <com/sun/star/container/XIndexReplace.hpp>
namespace writerfilter {
namespace dmapper {
class DomainMapper;
struct StyleSheetEntry;
/** Class representing the numbering level properties.
*/
class ListLevel : public PropertyMap
{
sal_Int32 m_nIStartAt; //LN_ISTARTAT
sal_Int32 m_nNFC; //LN_NFC
sal_Int32 m_nJC; //LN_JC
sal_Int32 m_nFLegal; //LN_FLEGAL
sal_Int32 m_nFNoRestart; //LN_FNORESTART
sal_Int32 m_nFPrev; //LN_FPREV
sal_Int32 m_nFPrevSpace; //LN_FPREVSPACE
sal_Int32 m_nFWord6; //LN_FWORD6
::rtl::OUString m_sRGBXchNums; //LN_RGBXCHNUMS
sal_Int32 m_nXChFollow; //LN_IXCHFOLLOW
::rtl::OUString m_sBulletChar;
sal_Int32 m_nTabstop;
boost::shared_ptr< StyleSheetEntry > m_pParaStyle;
public:
typedef boost::shared_ptr< ListLevel > Pointer;
ListLevel() :
m_nIStartAt(-1)
,m_nNFC(-1)
,m_nJC(-1)
,m_nFLegal(-1)
,m_nFNoRestart(-1)
,m_nFPrev(-1)
,m_nFPrevSpace(-1)
,m_nFWord6(-1)
,m_nXChFollow(-1)
,m_nTabstop( 0 )
{}
~ListLevel( ){ }
// Setters for the import
void SetValue( Id nId, sal_Int32 nValue );
void SetBulletChar( rtl::OUString sValue ) { m_sBulletChar = sValue; };
void SetParaStyle( boost::shared_ptr< StyleSheetEntry > pStyle )
{
m_pParaStyle = pStyle;
};
void AddRGBXchNums( rtl::OUString sValue ) { m_sRGBXchNums += sValue; };
// Getters
rtl::OUString GetBulletChar( ) { return m_sBulletChar; };
boost::shared_ptr< StyleSheetEntry > GetParaStyle( ) { return m_pParaStyle; };
// UNO mapping functions
// rPrefix and rSuffix are out parameters
static sal_Int16 GetParentNumbering( rtl::OUString sText, sal_Int16 nLevel,
rtl::OUString& rPrefix, rtl::OUString& rSuffix );
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
GetProperties( );
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue>
GetCharStyleProperties( );
private:
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
GetLevelProperties( );
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >
GetParaProperties( );
};
class AbstractListDef
{
private:
sal_Int32 m_nTPLC; //LN_TPLC
::rtl::OUString m_sRGISTD; //LN_RGISTD
sal_Int32 m_nSimpleList; //LN_FSIMPLELIST
sal_Int32 m_nRestart; //LN_FRESTARTHDN
sal_Int32 m_nUnsigned; //LN_UNSIGNED26_2
// The ID member reflects either the abstractNumId or the numId
// depending on the use of the class
sal_Int32 m_nId;
// Properties of each level. This can also reflect the overridden
// levels of a numbering.
::std::vector< ListLevel::Pointer > m_aLevels;
// Only used during the numberings import
ListLevel::Pointer m_pCurrentLevel;
public:
typedef boost::shared_ptr< AbstractListDef > Pointer;
AbstractListDef( );
~AbstractListDef( );
// Setters using during the import
void SetId( sal_Int32 nId ) { m_nId = nId; };
void SetValue( sal_uInt32 nSprmId, sal_Int32 nValue );
void AddRGISTD( rtl::OUString sValue ) { m_sRGISTD += sValue; };
// Accessors
sal_Int32 GetId( ) { return m_nId; };
sal_Int16 Size( ) { return sal_Int16( m_aLevels.size( ) ); };
ListLevel::Pointer GetLevel( sal_uInt16 nLvl );
void AddLevel( );
ListLevel::Pointer GetCurrentLevel( ) { return m_pCurrentLevel; };
virtual com::sun::star::uno::Sequence<
com::sun::star::uno::Sequence<
com::sun::star::beans::PropertyValue > > GetPropertyValues( );
};
class ListDef : public AbstractListDef
{
private:
// Pointer to the abstract numbering
AbstractListDef::Pointer m_pAbstractDef;
// Cache for the UNO numbering rules
uno::Reference< container::XIndexReplace > m_xNumRules;
public:
typedef boost::shared_ptr< ListDef > Pointer;
ListDef( );
~ListDef( );
// Accessors
void SetAbstractDefinition( AbstractListDef::Pointer pAbstract ) { m_pAbstractDef = pAbstract; };
AbstractListDef::Pointer GetAbstractDefinition( ) { return m_pAbstractDef; };
// Mapping functions
static rtl::OUString GetStyleName( sal_Int32 nId );
com::sun::star::uno::Sequence<
com::sun::star::uno::Sequence<
com::sun::star::beans::PropertyValue > > GetPropertyValues( );
void CreateNumberingRules(
DomainMapper& rDMapper,
com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory> xFactory );
::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace >
GetNumberingRules( ) { return m_xNumRules; };
};
/** This class provides access to the defined numbering styles.
*/
class WRITERFILTER_DLLPRIVATE ListsManager :
public Properties,
public Table
{
private:
DomainMapper& m_rDMapper;
com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory > m_xFactory;
// The numbering entries
std::vector< AbstractListDef::Pointer > m_aAbstractLists;
std::vector< ListDef::Pointer > m_aLists;
// These members are used for import only
AbstractListDef::Pointer m_pCurrentDefinition;
bool m_bIsLFOImport;
public:
ListsManager(
DomainMapper& rDMapper,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory);
virtual ~ListsManager();
typedef boost::shared_ptr< ListsManager > Pointer;
// Properties
virtual void attribute( Id nName, Value & rVal );
virtual void sprm(Sprm & sprm);
// Table
virtual void entry(int pos, writerfilter::Reference<Properties>::Pointer_t ref);
// Config methods
void SetLFOImport( bool bLFOImport ) { m_bIsLFOImport = bLFOImport; };
// Numberings accessors
AbstractListDef::Pointer GetCurrentDef( ) { return m_pCurrentDefinition; };
sal_uInt32 Size() const
{ return sal_uInt32( m_aLists.size( ) ); };
ListDef::Pointer GetList( sal_Int32 nId );
// Mapping methods
void CreateNumberingRules( );
};
} }
#endif

View file

@ -319,9 +319,10 @@ const rtl::OUString& PropertyNameSupplier::GetName( PropertyIds eId ) const
case PROP_INDENT_AT : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IndentAt")); break;
case PROP_FIRST_LINE_INDENT : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FirstLineIndent")); break;
case PROP_NUMBERING_STYLE_NAME : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberingStyleName")); break;
case PROP_OUTLINE_LEVEL : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OutlineLevel")); break;
case PROP_LISTTAB_STOP_POSITION : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ListtabStopPosition")); break;
case PROP_POSITION_AND_SPACE_MODE : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionAndSpaceMode")); break;
// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
case PROP_HEADING_STYLE_NAME: sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HeadingStyleName")); break;
// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;
// case : sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("")); break;

View file

@ -282,8 +282,10 @@ enum PropertyIds
/*243*/ ,PROP_INDENT_AT
/*244*/ ,PROP_FIRST_LINE_INDENT
/*245*/ ,PROP_NUMBERING_STYLE_NAME
/*246*/ ,PROP_LISTTAB_STOP_POSITION
/*247*/ ,PROP_POSITION_AND_SPACE_MODE
/*246*/ ,PROP_OUTLINE_LEVEL
/*247*/ ,PROP_LISTTAB_STOP_POSITION
/*248*/ ,PROP_POSITION_AND_SPACE_MODE
/*249*/ ,PROP_HEADING_STYLE_NAME
};
struct PropertyNameSupplier_Impl;
class PropertyNameSupplier

View file

@ -36,12 +36,15 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/table/BorderLine.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/style/BreakType.hpp>
#include <com/sun/star/text/RelOrientation.hpp>
#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;
@ -381,14 +384,18 @@ void SectionPropertyMap::ApplyBorderToPageStyles(
switch( nValue & 0x07)
{
case 0: /*all styles*/
xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
xSecond = GetPageStyle( xPageStyles, xTextFactory, true );
if ( m_sFollowPageStyleName.getLength( ) > 0 )
xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
if ( m_sFirstPageStyleName.getLength( ) > 0 )
xSecond = GetPageStyle( xPageStyles, xTextFactory, true );
break;
case 1: /*first page*/
xFirst = GetPageStyle( xPageStyles, xTextFactory, true );
if ( m_sFirstPageStyleName.getLength( ) > 0 )
xFirst = GetPageStyle( xPageStyles, xTextFactory, true );
break;
case 2: /*left and right*/
xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
if ( m_sFollowPageStyleName.getLength( ) > 0 )
xFirst = GetPageStyle( xPageStyles, xTextFactory, false );
break;
case 3: //whole document?
//todo: how to apply a border to the whole document - find all sections or access all page styles?
@ -565,6 +572,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;
@ -703,6 +796,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 );
@ -775,6 +869,7 @@ 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 );
@ -797,28 +892,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 )
xRangeProperties = uno::Reference< beans::XPropertySet >( rDM_Impl.GetBodyText()->getStart(), uno::UNO_QUERY_THROW );
{
uno::Reference< container::XEnumerationAccess > xEnumAccess( rDM_Impl.GetBodyText( ), uno::UNO_QUERY_THROW );
uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration( );
xRangeProperties = uno::Reference< beans::XPropertySet >( xEnum->nextElement( ), uno::UNO_QUERY_THROW );
}
else
xRangeProperties = uno::Reference< beans::XPropertySet >( m_xStartingRange, uno::UNO_QUERY_THROW );
/* break type
0 - No break 1 - New Colunn 2 - New page 3 - Even page 4 - odd page */
if( m_nBreakType == 2 || m_nBreakType == 3)
{
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_BREAK_TYPE),
uno::makeAny( m_nBreakType == 2 ? style::BreakType_COLUMN_AFTER : style::BreakType_PAGE_AFTER ) );
}
else
{
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ));
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_DESC_NAME ),
uno::makeAny( m_bTitlePage ? m_sFirstPageStyleName : m_sFollowPageStyleName ));
// todo: page breaks with odd/even page numbering are not available - find out current page number to check how to change the number
// or add even/odd page break types
if(m_bPageNoRestart || m_nPageNumber >= 0)
{
sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_NUMBER_OFFSET ),
uno::makeAny( nPageNumber ));
}
if(m_bPageNoRestart || m_nPageNumber >= 0)
{
sal_Int16 nPageNumber = m_nPageNumber >= 0 ? static_cast< sal_Int16 >(m_nPageNumber) : 1;
xRangeProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_PAGE_NUMBER_OFFSET ),
uno::makeAny( nPageNumber ));
}
}
}

View file

@ -199,6 +199,7 @@ 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;
@ -275,6 +276,7 @@ public:
void CloseSectionGroup( DomainMapper_Impl& rDM_Impl );
};
typedef boost::shared_ptr<SectionPropertyMap> SectionPropertyMapPtr;
/*-- 28.12.2007 08:17:34---------------------------------------------------

View file

@ -29,6 +29,7 @@
************************************************************************/
#include <StyleSheetTable.hxx>
#include <dmapper/DomainMapper.hxx>
#include <NumberingManager.hxx>
#include <ConversionHelper.hxx>
#include <TblStylePrHandler.hxx>
#include <BorderHandler.hxx>
@ -1157,7 +1158,8 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
{
//TODO: Handle cases where a paragraph <> character style relation is needed
StyleSheetEntryPtr pParent = FindStyleSheetByISTD( pEntry->sBaseStyleIdentifier );
xStyle->setParentStyle(ConvertStyleName( pParent->sStyleName ));
if ( pParent.get( ) )
xStyle->setParentStyle(ConvertStyleName( pParent->sStyleName ));
}
catch( const uno::RuntimeException& )
{
@ -1215,30 +1217,23 @@ void StyleSheetTable::ApplyStyleSheets( FontTablePtr rFontTable )
{
// Set the outline levels
const StyleSheetPropertyMap* pStyleSheetProperties = dynamic_cast<const StyleSheetPropertyMap*>(pEntry ? pEntry->pProperties.get() : 0);
if ( pStyleSheetProperties && pStyleSheetProperties->GetOutlineLevel( ) >= 0 )
if ( pStyleSheetProperties )
{
sal_Int16 nLvl = pStyleSheetProperties->GetOutlineLevel( );
uno::Reference< text::XChapterNumberingSupplier > xOutlines ( m_pImpl->m_xTextDocument,
uno::UNO_QUERY_THROW );
uno::Reference< container::XIndexReplace > xRules = xOutlines->getChapterNumberingRules( );
uno::Any aLevel = xRules->getByIndex( nLvl );
uno::Sequence< beans::PropertyValue > aLevelProps;
aLevel >>= aLevelProps;
aPropValues.realloc( aPropValues.getLength( ) + 1 );
sal_Int32 nLen = aLevelProps.getLength( );
sal_Int32 i = 0;
bool bPropFound = false;
rtl::OUString sPropName( rtl::OUString::createFromAscii( "HeadingStyleName" ) );
while ( i < nLen && !bPropFound )
beans::PropertyValue aLvlVal( rPropNameSupplier.GetName( PROP_OUTLINE_LEVEL ), 0,
uno::makeAny( sal_Int16( pStyleSheetProperties->GetOutlineLevel( ) + 1 ) ),
beans::PropertyState_DIRECT_VALUE );
aPropValues[ aPropValues.getLength( ) - 1 ] = aLvlVal;
if ( pStyleSheetProperties->GetOutlineLevel( ) == 0 )
{
if ( aLevelProps[i].Name.equals( sPropName ) )
{
aLevelProps[i].Value = uno::makeAny( ConvertStyleName( pEntry->sStyleName ) );
bPropFound = true;
}
i++;
aPropValues.realloc( aPropValues.getLength( ) + 1 );
beans::PropertyValue aStyleVal( rPropNameSupplier.GetName( PROP_NUMBERING_STYLE_NAME ), 0,
uno::makeAny( rtl::OUString::createFromAscii( "" ) ),
beans::PropertyState_DIRECT_VALUE );
aPropValues[ aPropValues.getLength( ) - 1 ] = aStyleVal;
}
xRules->replaceByIndex( nLvl, uno::makeAny( aLevelProps ) );
}
uno::Reference< beans::XPropertyState >xState( xStyle, uno::UNO_QUERY_THROW );

View file

@ -56,8 +56,7 @@ SLOFILES= $(SLO)$/BorderHandler.obj \
$(SLO)$/DomainMapperTableManager.obj \
$(SLO)$/FontTable.obj \
$(SLO)$/GraphicImport.obj \
$(SLO)$/LFOTable.obj \
$(SLO)$/ListTable.obj \
$(SLO)$/NumberingManager.obj \
$(SLO)$/MeasureHandler.obj \
$(SLO)$/PropertyMap.obj \
$(SLO)$/PropertyIds.obj \

View file

@ -1688,17 +1688,6 @@ void WW8DocumentImpl::resolve(Stream & rStream)
}
#endif
writerfilter::Reference<Table>::Pointer_t pListTable = getListTable();
if (pListTable.get() != NULL)
rStream.table(NS_rtf::LN_LISTTABLE, pListTable);
writerfilter::Reference<Table>::Pointer_t pLFOTable = getLFOTable();
if (pLFOTable.get() != NULL)
rStream.table(NS_rtf::LN_LFOTABLE, pLFOTable);
writerfilter::Reference<Table>::Pointer_t pFontTable = getFontTable();
if (pFontTable.get() != NULL)
@ -1715,6 +1704,16 @@ void WW8DocumentImpl::resolve(Stream & rStream)
{
clog << e.getText() << endl;
}
writerfilter::Reference<Table>::Pointer_t pListTable = getListTable();
if (pListTable.get() != NULL)
rStream.table(NS_rtf::LN_LISTTABLE, pListTable);
writerfilter::Reference<Table>::Pointer_t pLFOTable = getLFOTable();
if (pLFOTable.get() != NULL)
rStream.table(NS_rtf::LN_LFOTABLE, pLFOTable);
}
WW8DocumentIterator::Pointer_t pIt = begin();

View file

@ -48,7 +48,7 @@ using namespace ::std;
OOXMLDocumentImpl::OOXMLDocumentImpl
(OOXMLStream::Pointer_t pStream)
: mpStream(pStream), mXNoteType(0)
: mpStream(pStream), mXNoteType(0), mbIsSubstream( false )
{
}
@ -138,6 +138,7 @@ OOXMLDocumentImpl::getSubStream(const rtl::OUString & rId)
writerfilter::Reference<Stream>::Pointer_t pRet( pTemp = new OOXMLDocumentImpl(pStream) );
pTemp->setModel(mxModel);
pTemp->setDrawPage(mxDrawPage);
pTemp->setIsSubstream( true );
return pRet;
}
@ -317,6 +318,7 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
pDocHandler->setStream(&rStream);
pDocHandler->setDocument(this);
pDocHandler->setXNoteId(msXNoteId);
pDocHandler->setIsSubstream( mbIsSubstream );
uno::Reference < xml::sax::XFastDocumentHandler > xDocumentHandler
(pDocHandler);
uno::Reference < xml::sax::XFastTokenHandler > xTokenHandler
@ -324,9 +326,9 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
resolveFastSubStream(rStream, OOXMLStream::SETTINGS);
resolveFastSubStream(rStream, OOXMLStream::THEME);
resolveFastSubStream(rStream, OOXMLStream::NUMBERING);
resolveFastSubStream(rStream, OOXMLStream::FONTTABLE);
resolveFastSubStream(rStream, OOXMLStream::STYLES);
resolveFastSubStream(rStream, OOXMLStream::NUMBERING);
xParser->setFastDocumentHandler( xDocumentHandler );
xParser->setTokenHandler( xTokenHandler );

View file

@ -53,6 +53,8 @@ class OOXMLDocumentImpl : public OOXMLDocument
uno::Reference<frame::XModel> mxModel;
uno::Reference<drawing::XDrawPage> mxDrawPage;
bool mbIsSubstream;
protected:
virtual void resolveFastSubStream(Stream & rStream,
OOXMLStream::StreamType_t nType);
@ -69,6 +71,8 @@ protected:
const Id & rType,
const rtl::OUString & rNoteId);
void setIsSubstream( bool bSubstream ) { mbIsSubstream = bSubstream; };
public:
OOXMLDocumentImpl(OOXMLStream::Pointer_t pStream);
virtual ~OOXMLDocumentImpl();

View file

@ -755,6 +755,7 @@ void OOXMLFastContextHandler::setLastParagraphInSection()
#endif
mpParserState->setLastParagraphInSection(true);
mpStream->markLastParagraphInSection( );
}
void OOXMLFastContextHandler::newProperty

View file

@ -225,4 +225,9 @@ void OOXMLFastDocumentHandler::setXNoteId(const ::rtl::OUString & rXNoteId)
msXNoteId = rXNoteId;
}
void OOXMLFastDocumentHandler::setIsSubstream( bool bSubstream )
{
getContextHandler( )->getParserState( )->setInSectionGroup( bSubstream );
}
}}

View file

@ -100,6 +100,8 @@ public:
OOXMLParserState::Pointer_t getParserState() const;
void setIsSubstream( bool bSubstream );
private:
OOXMLFastDocumentHandler(OOXMLFastDocumentHandler &); // not defined
void operator =(OOXMLFastDocumentHandler &); // not defined

View file

@ -22048,18 +22048,13 @@
<resource xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" name="CT_HdrFtrRef" resource="Properties">
<attribute name="type" tokenid="ooxml:CT_HdrFtrRef_type"/>
<attribute name="r:id" tokenid="ooxml:CT_HdrFtrRef_id"/>
<action name="end" action="endCharacterGroup"/>
<action name="end" action="endParagraphGroup"/>
<action name="end" action="handleHdrFtr"/>
</resource>
<resource name="EG_HdrFtrReferences" resource="Properties">
<element name="headerReference" tokenid="ooxml:EG_HdrFtrReferences_headerReference"/>
<element name="footerReference" tokenid="ooxml:EG_HdrFtrReferences_footerReference"/>
</resource>
<resource name="CT_HdrFtr" resource="Stream">
<action name="start" action="startSectionGroup"/>
<action name="end" action="endSectionGroup"/>
</resource>
<resource name="CT_HdrFtr" resource="Stream"/>
<resource name="EG_SectPrContents" resource="Properties">
<element name="bidi" tokenid="ooxml:EG_SectPrContents_bidi"/>
<element name="cols" tokenid="ooxml:EG_SectPrContents_cols"/>

View file

@ -273,7 +273,7 @@ namespace writerfilter
fileName += "/writerfilter.";
fileName += name;
fileName += ".tmp";
fileName += ".xml";
ofstream dumpStream(fileName.c_str());
aIt->second->output(dumpStream);