summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/inc/dmapper/DomainMapper.hxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx20
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx22
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.hxx14
4 files changed, 61 insertions, 0 deletions
diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx
index c22eebe69857..4dbbe87e5b5e 100644
--- a/writerfilter/inc/dmapper/DomainMapper.hxx
+++ b/writerfilter/inc/dmapper/DomainMapper.hxx
@@ -109,6 +109,11 @@ public:
GraphicZOrderHelper* graphicZOrderHelper();
bool IsInHeaderFooter() const;
+ /**
+ @see DomainMapper_Impl::processDeferredCharacterProperties()
+ */
+ void processDeferredCharacterProperties(
+ const std::map< sal_Int32, com::sun::star::uno::Any >& deferredCharacterProperties );
private:
// Stream
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 4aa843c70b8b..686c10feaf22 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3237,6 +3237,26 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
}
+void DomainMapper::processDeferredCharacterProperties( const std::map< sal_Int32, uno::Any >& deferredCharacterProperties )
+{
+ for( std::map< sal_Int32, uno::Any >::const_iterator it = deferredCharacterProperties.begin();
+ it != deferredCharacterProperties.end();
+ ++it )
+ {
+ sal_Int32 Id = it->first;
+ sal_Int32 nIntValue = 0;
+ OUString sStringValue;
+ it->second >>= nIntValue;
+ it->second >>= sStringValue;
+ switch( Id )
+ {
+ default:
+ SAL_WARN( "writerfilter", "Unhandled property in processDeferredCharacterProperty()" );
+ break;
+ }
+ }
+}
+
void DomainMapper::lcl_entry(int /*pos*/,
writerfilter::Reference<Properties>::Pointer_t ref)
{
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 164a2d40282c..8bc792646952 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -384,7 +384,12 @@ void DomainMapper_Impl::PopProperties(ContextType eId)
m_pLastSectionContext = m_aPropertyStacks[eId].top( );
}
else if (eId == CONTEXT_CHARACTER)
+ {
m_pLastCharacterContext = m_aPropertyStacks[eId].top();
+ // Sadly an assert about deferredCharacterProperties being empty is not possible
+ // here, becase appendTextPortion() may not be called for every character section.
+ deferredCharacterProperties.clear();
+ }
m_aPropertyStacks[eId].pop();
m_aContextStack.pop();
@@ -1107,6 +1112,8 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, PropertyMapP
{
if (m_aTextAppendStack.empty())
return;
+ if( pPropertyMap == m_pTopContext && !deferredCharacterProperties.empty())
+ processDeferredCharacterProperties();
uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
if(xTextAppend.is() && ! getTableManager( ).isIgnore())
{
@@ -3725,6 +3732,21 @@ SectionPropertyMap * DomainMapper_Impl::GetSectionContext()
return pSectionContext;
}
+void DomainMapper_Impl::deferCharacterProperty( sal_Int32 id, com::sun::star::uno::Any value )
+{
+ deferredCharacterProperties[ id ] = value;
+}
+
+void DomainMapper_Impl::processDeferredCharacterProperties()
+{
+ // ACtually process in DomainMapper, so that it's the same source file like normal processing.
+ if( !deferredCharacterProperties.empty())
+ {
+ m_rDMapper.processDeferredCharacterProperties( deferredCharacterProperties );
+ deferredCharacterProperties.clear();
+ }
+}
+
}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 2622cb70c3ee..abe5ef4b17c1 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -369,6 +369,8 @@ private:
throw(::com::sun::star::uno::Exception);
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetDocumentSettings();
+ std::map< sal_Int32, com::sun::star::uno::Any > deferredCharacterProperties;
+
public:
DomainMapper_Impl(
DomainMapper& rDMapper,
@@ -629,6 +631,18 @@ public:
SectionPropertyMap * GetSectionContext();
/// If the current paragraph has a numbering style associated, this method returns its character style
com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> GetCurrentNumberingCharStyle();
+
+ /**
+ Used for attributes/sprms which cannot be evaluated immediatelly (e.g. they depend
+ on another one that comes in the same CONTEXT_CHARACTER). The property will be processed
+ again in DomainMapper::processDeferredCharacterProperties().
+ */
+ void deferCharacterProperty( sal_Int32 id, com::sun::star::uno::Any value );
+ /**
+ Processes properties deferred using deferCharacterProperty(). To be called whenever the top
+ CONTEXT_CHARACTER is going to be used (e.g. by appendText()).
+ */
+ void processDeferredCharacterProperties();
};
} //namespace dmapper
} //namespace writerfilter