[Libreoffice-commits] .: 4 commits - sw/source writerfilter/source
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Mon Dec 5 09:10:24 PST 2011
sw/source/filter/ww8/rtfexport.cxx | 4
sw/source/filter/ww8/wrtw8nds.cxx | 8
sw/source/filter/ww8/wrtww8.cxx | 16
writerfilter/source/dmapper/DomainMapper.cxx | 5
writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 6
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 356 ++++++++++-----
writerfilter/source/dmapper/DomainMapper_Impl.hxx | 1
writerfilter/source/dmapper/PropertyMap.cxx | 23
writerfilter/source/dmapper/PropertyMap.hxx | 2
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 243 ++++++----
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 11
writerfilter/source/rtftok/rtffly.hxx | 82 +++
12 files changed, 526 insertions(+), 231 deletions(-)
New commits:
commit 83560ad42b83473913482e5569b25a1276d80da6
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Thu Dec 1 17:25:35 2011 +0100
RTF import: fixed the handling of frame properties n#417818
Change the RTF tokenizer to send the same tokens than the docx tokenizer
for the <w:framePr> element.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index b6c5c19..d2fc018 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1220,7 +1220,8 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
case NS_sprm::LN_PDxaFromText:
case NS_sprm::LN_PDyaFromText:
{
- ParagraphProperties* pParaProperties = dynamic_cast< ParagraphProperties*>(m_pImpl->GetTopContext().get());
+ ParagraphProperties* pParaProperties = dynamic_cast< ParagraphProperties*>(
+ m_pImpl->GetTopContextOfType( CONTEXT_PARAGRAPH ).get() );
if( pParaProperties )
{
switch( nName )
@@ -3206,6 +3207,8 @@ void DomainMapper::lcl_startSectionGroup()
void DomainMapper::lcl_endSectionGroup()
{
+ m_pImpl->CheckUnregisteredFrameConversion();
+ m_pImpl->ExecuteFrameConversion();
PropertyMapPtr pContext = m_pImpl->GetTopContextOfType(CONTEXT_SECTION);
SectionPropertyMap* pSectionContext = dynamic_cast< SectionPropertyMap* >( pContext.get() );
OSL_ENSURE(pSectionContext, "SectionContext unavailable!");
@@ -3233,7 +3236,6 @@ void DomainMapper::lcl_startParagraphGroup()
void DomainMapper::lcl_endParagraphGroup()
{
- m_pImpl->CheckUnregisteredFrameConversion();
m_pImpl->PopProperties(CONTEXT_PARAGRAPH);
m_pImpl->getTableManager().endParagraphGroup();
//frame conversion has to be executed after table conversion
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 835e2e6..4bd3f18 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -695,17 +695,17 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
{
PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
TextAppendContext& rAppendContext = m_aTextAppendStack.top();
- if( rAppendContext.pLastParagraphProperties.get() )
+ if( rAppendContext.pLastParagraphProperties.get() && rAppendContext.pLastParagraphProperties->IsFrameMode() )
{
try
{
StyleSheetEntryPtr pParaStyle =
- m_pStyleSheetTable->FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties->GetParaStyleName());
+ GetStyleSheetTable()->FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties->GetParaStyleName());
+
+ uno::Sequence< beans::PropertyValue > aFrameProperties(pParaStyle ? 15: 9);
- uno::Sequence< beans::PropertyValue > aFrameProperties(pParaStyle ? 15: 0);
if ( pParaStyle.get( ) )
{
- const ParagraphProperties* pStyleProperties = dynamic_cast<const ParagraphProperties*>( pParaStyle->pProperties.get() );
beans::PropertyValue* pFrameProperties = aFrameProperties.getArray();
pFrameProperties[0].Name = rPropNameSupplier.GetName(PROP_WIDTH);
pFrameProperties[1].Name = rPropNameSupplier.GetName(PROP_HEIGHT);
@@ -722,6 +722,8 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
pFrameProperties[12].Name = rPropNameSupplier.GetName(PROP_RIGHT_MARGIN);
pFrameProperties[13].Name = rPropNameSupplier.GetName(PROP_TOP_MARGIN);
pFrameProperties[14].Name = rPropNameSupplier.GetName(PROP_BOTTOM_MARGIN);
+
+ const ParagraphProperties* pStyleProperties = dynamic_cast<const ParagraphProperties*>( pParaStyle->pProperties.get() );
sal_Int32 nWidth =
rAppendContext.pLastParagraphProperties->Getw() > 0 ?
rAppendContext.pLastParagraphProperties->Getw() :
@@ -730,10 +732,12 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
if( bAutoWidth )
nWidth = DEFAULT_FRAME_MIN_WIDTH;
pFrameProperties[0].Value <<= nWidth;
+
pFrameProperties[1].Value <<=
rAppendContext.pLastParagraphProperties->Geth() > 0 ?
rAppendContext.pLastParagraphProperties->Geth() :
pStyleProperties->Geth();
+
pFrameProperties[2].Value <<= sal_Int16(
rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
rAppendContext.pLastParagraphProperties->GethRule() :
@@ -795,6 +799,118 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
rAppendContext.pLastParagraphProperties->GetStartingRange(),
rAppendContext.pLastParagraphProperties->GetEndingRange());
}
+ else
+ {
+ beans::PropertyValue* pFrameProperties = aFrameProperties.getArray();
+ pFrameProperties[0].Name = rPropNameSupplier.GetName(PROP_WIDTH);
+ pFrameProperties[1].Name = rPropNameSupplier.GetName(PROP_SIZE_TYPE);
+ pFrameProperties[2].Name = rPropNameSupplier.GetName(PROP_WIDTH_TYPE);
+ pFrameProperties[3].Name = rPropNameSupplier.GetName(PROP_HORI_ORIENT);
+ pFrameProperties[4].Name = rPropNameSupplier.GetName(PROP_VERT_ORIENT);
+ pFrameProperties[5].Name = rPropNameSupplier.GetName(PROP_LEFT_MARGIN);
+ pFrameProperties[6].Name = rPropNameSupplier.GetName(PROP_RIGHT_MARGIN);
+ pFrameProperties[7].Name = rPropNameSupplier.GetName(PROP_TOP_MARGIN);
+ pFrameProperties[8].Name = rPropNameSupplier.GetName(PROP_BOTTOM_MARGIN);
+
+ sal_Int32 nWidth = rAppendContext.pLastParagraphProperties->Getw();
+ bool bAutoWidth = nWidth < 1;
+ if( bAutoWidth )
+ nWidth = DEFAULT_FRAME_MIN_WIDTH;
+ pFrameProperties[0].Value <<= nWidth;
+
+ pFrameProperties[1].Value <<= sal_Int16(
+ rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GethRule() :
+ text::SizeType::VARIABLE);
+
+ pFrameProperties[2].Value <<= bAutoWidth ? text::SizeType::MIN : text::SizeType::FIX;
+
+ sal_Int16 nHoriOrient = sal_Int16(
+ rAppendContext.pLastParagraphProperties->GetxAlign() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GetxAlign() :
+ text::HoriOrientation::NONE );
+ pFrameProperties[3].Value <<= nHoriOrient;
+
+ sal_Int16 nVertOrient = sal_Int16(
+ rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GetyAlign() :
+ text::VertOrientation::NONE );
+ pFrameProperties[4].Value <<= nVertOrient;
+
+ sal_Int32 nVertDist = rAppendContext.pLastParagraphProperties->GethSpace();
+ if( nVertDist < 0 )
+ nVertDist = 0;
+ pFrameProperties[5].Value <<= nVertOrient == text::VertOrientation::TOP ? 0 : nVertDist;
+ pFrameProperties[6].Value <<= nVertOrient == text::VertOrientation::BOTTOM ? 0 : nVertDist;
+
+ sal_Int32 nHoriDist = rAppendContext.pLastParagraphProperties->GetvSpace();
+ if( nHoriDist < 0 )
+ nHoriDist = 0;
+ pFrameProperties[7].Value <<= nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist;
+ pFrameProperties[8].Value <<= nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist;
+
+ if( rAppendContext.pLastParagraphProperties->Geth() > 0 )
+ {
+ sal_Int32 nOldSize = aFrameProperties.getLength();
+ aFrameProperties.realloc( nOldSize + 1 );
+ pFrameProperties = aFrameProperties.getArray();
+ pFrameProperties[nOldSize].Name = rPropNameSupplier.GetName(PROP_HEIGHT);
+ pFrameProperties[nOldSize].Value <<= rAppendContext.pLastParagraphProperties->Geth();
+ }
+
+ if( rAppendContext.pLastParagraphProperties->IsxValid() )
+ {
+ sal_Int32 nOldSize = aFrameProperties.getLength();
+ aFrameProperties.realloc( nOldSize + 1 );
+ pFrameProperties = aFrameProperties.getArray();
+ pFrameProperties[nOldSize].Name = rPropNameSupplier.GetName(PROP_HORI_ORIENT_POSITION);
+ pFrameProperties[nOldSize].Value <<= rAppendContext.pLastParagraphProperties->Getx();
+ }
+
+ if( rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 )
+ {
+ sal_Int32 nOldSize = aFrameProperties.getLength();
+ aFrameProperties.realloc( nOldSize + 1 );
+ pFrameProperties = aFrameProperties.getArray();
+ pFrameProperties[nOldSize].Name = rPropNameSupplier.GetName(PROP_HORI_ORIENT_RELATION);
+ pFrameProperties[nOldSize].Value <<= sal_Int16(
+ rAppendContext.pLastParagraphProperties->GethAnchor() );
+ }
+
+ if( rAppendContext.pLastParagraphProperties->IsyValid() )
+ {
+ sal_Int32 nOldSize = aFrameProperties.getLength();
+ aFrameProperties.realloc( nOldSize + 1 );
+ pFrameProperties = aFrameProperties.getArray();
+ pFrameProperties[nOldSize].Name = rPropNameSupplier.GetName(PROP_VERT_ORIENT_POSITION);
+ pFrameProperties[nOldSize].Value <<= rAppendContext.pLastParagraphProperties->Gety();
+ }
+
+ if( rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 )
+ {
+ sal_Int32 nOldSize = aFrameProperties.getLength();
+ aFrameProperties.realloc( nOldSize + 1 );
+ pFrameProperties = aFrameProperties.getArray();
+ pFrameProperties[nOldSize].Name = rPropNameSupplier.GetName(PROP_VERT_ORIENT_RELATION);
+ pFrameProperties[nOldSize].Value <<= sal_Int16(
+ rAppendContext.pLastParagraphProperties->GetvAnchor() );
+ }
+
+ if( rAppendContext.pLastParagraphProperties->GetWrap() >= 0 )
+ {
+ sal_Int32 nOldSize = aFrameProperties.getLength();
+ aFrameProperties.realloc( nOldSize + 1 );
+ pFrameProperties = aFrameProperties.getArray();
+ pFrameProperties[nOldSize].Name = rPropNameSupplier.GetName(PROP_SURROUND);
+ pFrameProperties[nOldSize].Value <<= text::WrapTextMode(
+ rAppendContext.pLastParagraphProperties->GetWrap() );
+ }
+
+ lcl_MoveBorderPropertiesToFrame(aFrameProperties,
+ rAppendContext.pLastParagraphProperties->GetStartingRange(),
+ rAppendContext.pLastParagraphProperties->GetEndingRange());
+ }
+
//frame conversion has to be executed after table conversion
RegisterFrameConversion(
rAppendContext.pLastParagraphProperties->GetStartingRange(),
@@ -949,6 +1065,9 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
m_bIsLastParaInSection = false;
m_bParaChanged = false;
+
+ // Reset the frame properties for the next paragraph
+ pParaContext->ResetFrameProperties();
}
if( !bKeepLastParagraphProperties )
rAppendContext.pLastParagraphProperties = pToBeSavedProperties;
@@ -3276,6 +3395,10 @@ bool DomainMapper_Impl::ExecuteFrameConversion()
}
catch( const uno::Exception& rEx)
{
+#if OSL_DEBUG_LEVEL > 1
+ fprintf( stderr, "Exception caught when converting to frame: %s\n",
+ rtl::OUStringToOString( rEx.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
+#endif
(void)rEx;
bRet = false;
}
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 84180c9..e74e784 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1142,6 +1142,29 @@ int ParagraphProperties::operator==(const ParagraphProperties& rCompare)
m_bAnchorLock== rCompare.m_bAnchorLock;
}
+void ParagraphProperties::ResetFrameProperties()
+{
+ m_bFrameMode = false;
+ m_nDropCap = NS_ooxml::LN_Value_wordprocessingml_ST_DropCap_none;
+ m_nLines = 0;
+ m_w = -1;
+ m_h = -1;
+ m_nWrap = -1;
+ m_hAnchor = -1;
+ m_vAnchor = text::RelOrientation::FRAME;
+ m_x = -1;
+ m_bxValid = false;
+ m_y = -1;
+ m_byValid = false;
+ m_hSpace = -1;
+ m_vSpace = -1;
+ m_hRule = -1;
+ m_xAlign = -1;
+ m_yAlign = -1;
+ m_bAnchorLock = false;
+ m_nDropCapLength = 0;
+}
+
ParagraphPropertyMap::ParagraphPropertyMap()
{
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index 3b93061..5c455dd 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -376,7 +376,7 @@ public:
void SetParaStyleName( const ::rtl::OUString& rSet ) { m_sParaStyleName = rSet;}
const ::rtl::OUString& GetParaStyleName() const { return m_sParaStyleName;}
-
+ void ResetFrameProperties();
};
typedef boost::shared_ptr<ParagraphProperties> ParagraphPropertiesPtr;
/*-------------------------------------------------------------------------
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f3d56c9..a378e83 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -404,14 +404,19 @@ void RTFDocumentImpl::checkNeedPap()
{
if (m_bNeedPap)
{
- checkChangedFrame();
-
if (!m_pCurrentBuffer)
{
writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(
new RTFReferenceProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)
);
Mapper().props(pParagraphProperties);
+
+ if (m_aStates.top().aFrame.hasProperties())
+ {
+ writerfilter::Reference<Properties>::Pointer_t const pFrameProperties(
+ new RTFReferenceProperties(RTFSprms(), m_aStates.top().aFrame.getSprms()));
+ Mapper().props(pFrameProperties);
+ }
}
else
{
@@ -460,7 +465,6 @@ void RTFDocumentImpl::sectBreak(bool bFinal = false)
// If there is no paragraph in this section, then insert a dummy one, as required by Writer
if (m_bNeedPar)
dispatchSymbol(RTF_PAR);
- checkChangedFrame();
while (m_nHeaderFooterPositions.size())
{
std::pair<Id, sal_uInt32> aPair = m_nHeaderFooterPositions.front();
@@ -759,58 +763,6 @@ bool RTFDocumentImpl::inFrame()
|| m_aStates.top().aFrame.nY > 0;
}
-void RTFDocumentImpl::checkChangedFrame()
-{
- if (!getModelFactory().is())
- return;
- // Check if this is a frame.
- if (inFrame() && !m_bWasInFrame)
- {
- if (m_bIsInFrame)
- return;
- OSL_TRACE("%s starting frame", OSL_THIS_FUNC);
- uno::Reference<text::XTextFrame> xTextFrame;
- xTextFrame.set(getModelFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame"))), uno::UNO_QUERY);
- uno::Reference<drawing::XShape> xShape(xTextFrame, uno::UNO_QUERY);
- uno::Reference<beans::XPropertySet> xPropertySet(xTextFrame, uno::UNO_QUERY);
-
- // RTF allows frames larger than the text content by default
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("SizeType")), uno::Any(text::SizeType::MIN));
-
- xShape->setSize(awt::Size(m_aStates.top().aFrame.nW, m_aStates.top().aFrame.nH));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("AnchorType")), uno::Any(m_aStates.top().aFrame.nAnchorType));
- if (m_aStates.top().aFrame.bPositionToggle)
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("PositionToggle")), uno::Any(m_aStates.top().aFrame.bPositionToggle));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")), uno::Any(m_aStates.top().aFrame.nHoriOrient));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation")), uno::Any(m_aStates.top().aFrame.nHoriOrientRelation));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")), uno::Any(sal_Int32(m_aStates.top().aFrame.nX)));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrient")), uno::Any(m_aStates.top().aFrame.nVertOrient));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation")), uno::Any(m_aStates.top().aFrame.nVertOrientRelation));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")), uno::Any(sal_Int32(m_aStates.top().aFrame.nY)));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("LeftMargin")), uno::Any(sal_Int32(m_aStates.top().aFrame.nLeftMargin)));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("RightMargin")), uno::Any(sal_Int32(m_aStates.top().aFrame.nRightMargin)));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("TopMargin")), uno::Any(sal_Int32(m_aStates.top().aFrame.nTopMargin)));
- xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BottomMargin")), uno::Any(sal_Int32(m_aStates.top().aFrame.nBottomMargin)));
-
- Mapper().startShape(xShape);
- Mapper().startParagraphGroup();
- m_bIsInFrame = true;
- }
- else if (!inFrame() && m_bWasInFrame)
- {
- if (!m_bIsInFrame)
- return;
- OSL_TRACE("%s ending frame", OSL_THIS_FUNC);
- finishSubstream();
- Mapper().endParagraphGroup();
- Mapper().endShape();
- Mapper().endParagraphGroup();
- Mapper().startParagraphGroup();
- m_bWasInFrame = false; // this is needed by invalid nested flies where the result is separate frames
- m_bIsInFrame = false;
- }
-}
-
void RTFDocumentImpl::text(OUString& rString)
{
bool bRet = true;
@@ -1416,6 +1368,13 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
);
Mapper().props(pParagraphProperties);
+ if (m_aStates.top().aFrame.hasProperties())
+ {
+ writerfilter::Reference<Properties>::Pointer_t const pFrameProperties(
+ new RTFReferenceProperties(RTFSprms(), m_aStates.top().aFrame.getSprms()));
+ Mapper().props(pFrameProperties);
+ }
+
// Table width.
RTFValue::Pointer_t pUnitValue(new RTFValue(3));
lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
@@ -1672,7 +1631,6 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
m_aStates.top().aFrame = RTFFrame();
- checkChangedFrame();
m_pCurrentBuffer = 0;
break;
case RTF_SECTD:
@@ -1891,22 +1849,25 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTF_FORMSHADE:
// Noop, this is the default in Writer.
break;
- case RTF_POSYT: m_aStates.top().aFrame.nVertOrient = text::VertOrientation::TOP; break;
- case RTF_POSYB: m_aStates.top().aFrame.nVertOrient = text::VertOrientation::BOTTOM; break;
- case RTF_POSYC: m_aStates.top().aFrame.nVertOrient = text::VertOrientation::CENTER; break;
-
- case RTF_PHMRG: m_aStates.top().aFrame.nHoriOrientRelation = text::RelOrientation::PAGE_PRINT_AREA; break;
- case RTF_PVMRG: m_aStates.top().aFrame.nVertOrientRelation = text::RelOrientation::PAGE_PRINT_AREA; break;
- case RTF_PHPG: m_aStates.top().aFrame.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME; break;
- case RTF_PVPG: m_aStates.top().aFrame.nVertOrientRelation = text::RelOrientation::PAGE_FRAME; break;
- case RTF_PHCOL: m_aStates.top().aFrame.nHoriOrientRelation = text::RelOrientation::FRAME; break;
- case RTF_PVPARA: m_aStates.top().aFrame.nVertOrientRelation = text::RelOrientation::FRAME; break;
-
- case RTF_POSXC: m_aStates.top().aFrame.nHoriOrient = text::HoriOrientation::CENTER; break;
- case RTF_POSXI: m_aStates.top().aFrame.nHoriOrient = text::HoriOrientation::LEFT; m_aStates.top().aFrame.bPositionToggle = sal_True; break;
- case RTF_POSXO: m_aStates.top().aFrame.nHoriOrient = text::HoriOrientation::RIGHT; m_aStates.top().aFrame.bPositionToggle = sal_True; break;
- case RTF_POSXL: m_aStates.top().aFrame.nHoriOrient = text::HoriOrientation::LEFT; break;
- case RTF_POSXR: m_aStates.top().aFrame.nHoriOrient = text::HoriOrientation::RIGHT; break;
+ case RTF_POSYT: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top; break;
+ case RTF_POSYB: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom; break;
+ case RTF_POSYC: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center; break;
+ case RTF_POSYIN: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inside; break;
+ case RTF_POSYOUT: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_outside; break;
+ case RTF_POSYIL: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inline; break;
+
+ case RTF_PHMRG: m_aStates.top().aFrame.nHoriAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin; break;
+ case RTF_PVMRG: m_aStates.top().aFrame.nVertAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin; break;
+ case RTF_PHPG: m_aStates.top().aFrame.nHoriAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_page; break;
+ case RTF_PVPG: m_aStates.top().aFrame.nVertAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_page; break;
+ case RTF_PHCOL: m_aStates.top().aFrame.nHoriAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text; break;
+ case RTF_PVPARA: m_aStates.top().aFrame.nVertAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_text; break;
+
+ case RTF_POSXC: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_center; break;
+ case RTF_POSXI: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_inside; break;
+ case RTF_POSXO: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_outside; break;
+ case RTF_POSXL: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_left; break;
+ case RTF_POSXR: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right; break;
default:
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE("%s: TODO handle flag '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword));
@@ -2012,8 +1973,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
{
case RTF_ABSW: pSprm = &m_aStates.top().aFrame.nW; break;
case RTF_ABSH: pSprm = &m_aStates.top().aFrame.nH; break;
- case RTF_POSX: pSprm = &m_aStates.top().aFrame.nX; m_aStates.top().aFrame.nHoriOrient = text::HoriOrientation::NONE; break;
- case RTF_POSY: pSprm = &m_aStates.top().aFrame.nY; m_aStates.top().aFrame.nVertOrient = text::VertOrientation::NONE; break;
+ case RTF_POSX: pSprm = &m_aStates.top().aFrame.nX; m_aStates.top().aFrame.nHoriAlign = 0; break;
+ case RTF_POSY: pSprm = &m_aStates.top().aFrame.nY; m_aStates.top().aFrame.nVertAlign = 0; break;
default: break;
}
if (pSprm)
@@ -2021,7 +1982,7 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
m_bNeedPap = true;
// Don't try to support text frames inside tables for now.
if (m_pCurrentBuffer != &m_aTableBuffer)
- *pSprm = TWIP_TO_MM100(nParam);
+ *pSprm = nParam;
return 0;
}
@@ -2524,27 +2485,26 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
lcl_putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_endnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue);
break;
case RTF_DFRMTXTX:
- m_aStates.top().aFrame.nLeftMargin = m_aStates.top().aFrame.nRightMargin = TWIP_TO_MM100(nParam);
+ m_aStates.top().aFrame.nHoriPadding = nParam;
break;
case RTF_DFRMTXTY:
- m_aStates.top().aFrame.nTopMargin = m_aStates.top().aFrame.nBottomMargin = TWIP_TO_MM100(nParam);
+ m_aStates.top().aFrame.nVertPadding = nParam;
break;
case RTF_DXFRTEXT:
- m_aStates.top().aFrame.nLeftMargin = m_aStates.top().aFrame.nRightMargin =
- m_aStates.top().aFrame.nTopMargin = m_aStates.top().aFrame.nBottomMargin = TWIP_TO_MM100(nParam);
+ m_aStates.top().aFrame.nVertPadding = m_aStates.top().aFrame.nHoriPadding = nParam;
break;
case RTF_FLYVERT:
{
RTFVertOrient aVertOrient(nParam);
- m_aStates.top().aFrame.nVertOrient = aVertOrient.GetOrient();
- m_aStates.top().aFrame.nVertOrientRelation = aVertOrient.GetRelation();
+ m_aStates.top().aFrame.nVertAlign = aVertOrient.GetAlign();
+ m_aStates.top().aFrame.nVertAnchor = aVertOrient.GetAnchor();
}
break;
case RTF_FLYHORZ:
{
RTFHoriOrient aHoriOrient(nParam);
- m_aStates.top().aFrame.nHoriOrient = aHoriOrient.GetOrient();
- m_aStates.top().aFrame.nHoriOrientRelation = aHoriOrient.GetRelation();
+ m_aStates.top().aFrame.nHoriAlign = aHoriOrient.GetAlign();
+ m_aStates.top().aFrame.nHoriAnchor = aHoriOrient.GetAnchor();
}
break;
case RTF_FLYANCHOR:
@@ -3278,17 +3238,114 @@ RTFFrame::RTFFrame()
nY(0),
nW(0),
nH(0),
- nLeftMargin(0),
- nRightMargin(0),
- nTopMargin(0),
- nBottomMargin(0),
- nHoriOrient(0),
- nHoriOrientRelation(0),
- nVertOrient(0),
- nVertOrientRelation(0),
- nAnchorType(0),
- bPositionToggle(false)
+ nHoriPadding(0),
+ nVertPadding(0),
+ nHoriAlign(0),
+ nHoriAnchor(0),
+ nVertAlign(0),
+ nVertAnchor(0),
+ nAnchorType(0)
+{
+}
+
+RTFSprms RTFFrame::getSprms()
+{
+ RTFSprms sprms;
+
+ static Id pNames[] =
+ {
+ NS_ooxml::LN_CT_FramePr_x,
+ NS_ooxml::LN_CT_FramePr_y,
+ NS_sprm::LN_PWHeightAbs,
+ NS_sprm::LN_PDxaWidth,
+ NS_sprm::LN_PDxaFromText,
+ NS_sprm::LN_PDyaFromText,
+ NS_ooxml::LN_CT_FramePr_hAnchor,
+ NS_ooxml::LN_CT_FramePr_vAnchor,
+ NS_ooxml::LN_CT_FramePr_xAlign,
+ NS_ooxml::LN_CT_FramePr_yAlign,
+ NS_sprm::LN_PWr,
+ NS_ooxml::LN_CT_FramePr_dropCap,
+ NS_ooxml::LN_CT_FramePr_lines,
+ NS_ooxml::LN_CT_FramePr_hRule
+ };
+
+ for ( int i = 0, len = sizeof( pNames ) / sizeof( Id ); i < len; ++i )
+ {
+ Id aId = pNames[i];
+ RTFValue::Pointer_t pValue;
+
+ switch ( aId )
+ {
+ case NS_ooxml::LN_CT_FramePr_x:
+ if ( nX != 0 )
+ pValue.reset(new RTFValue(nX));
+ break;
+ case NS_ooxml::LN_CT_FramePr_y:
+ if ( nY != 0 )
+ pValue.reset(new RTFValue(nY));
+ break;
+ case NS_sprm::LN_PWHeightAbs:
+ if ( nH != 0 )
+ pValue.reset(new RTFValue(nH));
+ break;
+ case NS_sprm::LN_PDxaWidth:
+ if ( nW != 0 )
+ pValue.reset(new RTFValue(nW));
+ break;
+ case NS_sprm::LN_PDxaFromText:
+ if ( nHoriPadding != 0 )
+ pValue.reset(new RTFValue(nHoriPadding));
+ break;
+ case NS_sprm::LN_PDyaFromText:
+ if ( nVertPadding != 0 )
+ pValue.reset(new RTFValue(nVertPadding));
+ break;
+ case NS_ooxml::LN_CT_FramePr_hAnchor:
+ if ( nHoriAnchor != 0 )
+ pValue.reset(new RTFValue(nHoriAnchor));
+ break;
+ case NS_ooxml::LN_CT_FramePr_vAnchor:
+ if ( nVertAnchor != 0 )
+ pValue.reset(new RTFValue(nVertAnchor));
+ break;
+ case NS_ooxml::LN_CT_FramePr_xAlign:
+ pValue.reset(new RTFValue(nHoriAlign));
+ break;
+ case NS_ooxml::LN_CT_FramePr_yAlign:
+ pValue.reset(new RTFValue(nVertAlign));
+ break;
+ case NS_ooxml::LN_CT_FramePr_hRule:
+ {
+ sal_Int32 nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto;
+ if ( nH < 0 )
+ nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact;
+ else if ( nH > 0 )
+ nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast;
+ pValue.reset(new RTFValue(nHRule));
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (pValue.get())
+ sprms->push_back(make_pair(aId, pValue));
+ }
+
+ RTFSprms frameprSprms;
+ RTFValue::Pointer_t pFrameprValue(new RTFValue(sprms));
+ frameprSprms->push_back(make_pair(NS_ooxml::LN_CT_PPrBase_framePr, pFrameprValue));
+
+ return frameprSprms;
+}
+
+bool RTFFrame::hasProperties()
{
+ return nX != 0 || nY != 0 || nW != 0 || nH != 0 ||
+ nHoriPadding != 0 || nVertPadding != 0 ||
+ nHoriAlign != 0 || nHoriAnchor != 0 || nVertAlign != 0 || nVertAnchor != 0 ||
+ nAnchorType != 0;
}
} // namespace rtftok
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 863a6d5..729e5e5 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -191,10 +191,13 @@ namespace writerfilter {
public:
RTFFrame();
sal_Int32 nX, nY, nW, nH;
- sal_Int32 nLeftMargin, nRightMargin, nTopMargin, nBottomMargin;
- sal_Int16 nHoriOrient, nHoriOrientRelation, nVertOrient, nVertOrientRelation;
+ sal_Int32 nHoriPadding, nVertPadding;
+ sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
sal_Int16 nAnchorType;
- sal_Bool bPositionToggle;
+
+ /// Convert the stored properties to Sprms
+ RTFSprms getSprms();
+ bool hasProperties();
};
/// State of the parser, which gets saved / restored when changing groups.
@@ -340,7 +343,6 @@ namespace writerfilter {
void replayBuffer(RTFBuffer_t& rBuffer);
/// If we got tokens indicating we're in a frame.
bool inFrame();
- void checkChangedFrame();
/// If we have some unicode characters to send.
void checkUnicode();
@@ -429,7 +431,6 @@ namespace writerfilter {
bool m_bIsInFrame;
// Unicode characters are collected here so we don't have to send them one by one.
rtl::OUStringBuffer m_aUnicodeBuffer;
-
};
} // namespace rtftok
} // namespace writerfilter
diff --git a/writerfilter/source/rtftok/rtffly.hxx b/writerfilter/source/rtftok/rtffly.hxx
index a03dc82..8922524 100644
--- a/writerfilter/source/rtftok/rtffly.hxx
+++ b/writerfilter/source/rtftok/rtffly.hxx
@@ -49,6 +49,44 @@ namespace writerfilter {
return Value.Flags.nRelOrient;
}
+ sal_Int32 GetAlign() const
+ {
+ sal_Int32 nAlign = 0;
+ switch( GetOrient( ) )
+ {
+ case text::VertOrientation::CENTER:
+ nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center;
+ break;
+ case text::VertOrientation::TOP:
+ nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top;
+ break;
+ case text::VertOrientation::BOTTOM:
+ nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom;
+ break;
+ }
+
+ return nAlign;
+ }
+
+ sal_Int32 GetAnchor() const
+ {
+ sal_Int32 nAnchor = 0;
+ switch( GetRelation( ) )
+ {
+ case text::RelOrientation::FRAME:
+ nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_text;
+ break;
+ case text::RelOrientation::PAGE_FRAME:
+ nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_page;
+ break;
+ case text::RelOrientation::PAGE_PRINT_AREA:
+ nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin;
+ break;
+ }
+
+ return nAnchor;
+ }
+
sal_uInt16 GetValue() const
{
return Value.nVal;
@@ -85,6 +123,50 @@ namespace writerfilter {
return Value.Flags.nRelOrient;
}
+ sal_Int32 GetAlign() const
+ {
+ sal_Int32 nAlign = 0;
+ switch( GetOrient( ) )
+ {
+ case text::HoriOrientation::CENTER:
+ nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_center;
+ break;
+ case text::HoriOrientation::RIGHT:
+ nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right;
+ break;
+ case text::HoriOrientation::LEFT:
+ nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_left;
+ break;
+ case text::HoriOrientation::INSIDE:
+ nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_inside;
+ break;
+ case text::HoriOrientation::OUTSIDE:
+ nAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_outside;
+ break;
+ }
+
+ return nAlign;
+ }
+
+ sal_Int32 GetAnchor() const
+ {
+ sal_Int32 nAnchor = 0;
+ switch( GetRelation( ) )
+ {
+ case text::RelOrientation::FRAME:
+ nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text;
+ break;
+ case text::RelOrientation::PAGE_FRAME:
+ nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_page;
+ break;
+ case text::RelOrientation::PAGE_PRINT_AREA:
+ nAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin;
+ break;
+ }
+
+ return nAnchor;
+ }
+
sal_uInt16 GetValue() const
{
return Value.nVal;
commit 88bd22cad050162eb6c2759569821a98e95f451d
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Mon Dec 5 11:13:21 2011 +0100
sw, fixed some missing include in dbglevel>1
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index 5139102..195cb8e 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -63,6 +63,10 @@
#include <svtools/rtfkeywd.hxx>
#include <unotools/configmgr.hxx>
+#if OSL_DEBUG_LEVEL > 1
+#include <iostream>
+#endif
+
using ::editeng::SvxBorderLine;
using namespace ::comphelper;
using namespace ::com::sun::star;
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 55ae016..4990112 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -730,9 +730,8 @@ void DomainMapperTableHandler::endTable()
catch ( uno::Exception &e )
{
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
- dmapper_logger->startElement("exception");
- dmapper_logger->chars(rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ));
- dmapper_logger->endElement();
+ fprintf( stderr, "Exception during table creation: %s\n",
+ rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) );
#else
(void) e;
#endif
@@ -812,7 +811,6 @@ void DomainMapperTableHandler::endCell(const Handle_t & end)
dmapper_logger->chars(toString(end));
dmapper_logger->endElement();
dmapper_logger->endElement();
- clog << "</table.cell>" << endl;
#endif
if (!end.get())
commit 91ae8f6c068c636a5600406da3d8829442a2af78
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Mon Nov 28 15:06:28 2011 +0100
docx: actually import the last frame of a section.
When there is no paragraph outside the frame before the section end, the
paragraphs weren't transformed to a frame.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 91a1aca..b6c5c19 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3233,6 +3233,7 @@ void DomainMapper::lcl_startParagraphGroup()
void DomainMapper::lcl_endParagraphGroup()
{
+ m_pImpl->CheckUnregisteredFrameConversion();
m_pImpl->PopProperties(CONTEXT_PARAGRAPH);
m_pImpl->getTableManager().endParagraphGroup();
//frame conversion has to be executed after table conversion
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index be64351..835e2e6 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -691,6 +691,123 @@ void lcl_AddRangeAndStyle(
//define some default frame width - 0cm ATM: this allow the frame to be wrapped around the text
#define DEFAULT_FRAME_MIN_WIDTH 0
+void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
+{
+ PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
+ TextAppendContext& rAppendContext = m_aTextAppendStack.top();
+ if( rAppendContext.pLastParagraphProperties.get() )
+ {
+ try
+ {
+ StyleSheetEntryPtr pParaStyle =
+ m_pStyleSheetTable->FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties->GetParaStyleName());
+
+ uno::Sequence< beans::PropertyValue > aFrameProperties(pParaStyle ? 15: 0);
+ if ( pParaStyle.get( ) )
+ {
+ const ParagraphProperties* pStyleProperties = dynamic_cast<const ParagraphProperties*>( pParaStyle->pProperties.get() );
+ beans::PropertyValue* pFrameProperties = aFrameProperties.getArray();
+ pFrameProperties[0].Name = rPropNameSupplier.GetName(PROP_WIDTH);
+ pFrameProperties[1].Name = rPropNameSupplier.GetName(PROP_HEIGHT);
+ pFrameProperties[2].Name = rPropNameSupplier.GetName(PROP_SIZE_TYPE);
+ pFrameProperties[3].Name = rPropNameSupplier.GetName(PROP_WIDTH_TYPE);
+ pFrameProperties[4].Name = rPropNameSupplier.GetName(PROP_HORI_ORIENT);
+ pFrameProperties[5].Name = rPropNameSupplier.GetName(PROP_HORI_ORIENT_POSITION);
+ pFrameProperties[6].Name = rPropNameSupplier.GetName(PROP_HORI_ORIENT_RELATION);
+ pFrameProperties[7].Name = rPropNameSupplier.GetName(PROP_VERT_ORIENT);
+ pFrameProperties[8].Name = rPropNameSupplier.GetName(PROP_VERT_ORIENT_POSITION);
+ pFrameProperties[9].Name = rPropNameSupplier.GetName(PROP_VERT_ORIENT_RELATION);
+ pFrameProperties[10].Name = rPropNameSupplier.GetName(PROP_SURROUND);
+ pFrameProperties[11].Name = rPropNameSupplier.GetName(PROP_LEFT_MARGIN);
+ pFrameProperties[12].Name = rPropNameSupplier.GetName(PROP_RIGHT_MARGIN);
+ pFrameProperties[13].Name = rPropNameSupplier.GetName(PROP_TOP_MARGIN);
+ pFrameProperties[14].Name = rPropNameSupplier.GetName(PROP_BOTTOM_MARGIN);
+ sal_Int32 nWidth =
+ rAppendContext.pLastParagraphProperties->Getw() > 0 ?
+ rAppendContext.pLastParagraphProperties->Getw() :
+ pStyleProperties->Getw();
+ bool bAutoWidth = nWidth < 1;
+ if( bAutoWidth )
+ nWidth = DEFAULT_FRAME_MIN_WIDTH;
+ pFrameProperties[0].Value <<= nWidth;
+ pFrameProperties[1].Value <<=
+ rAppendContext.pLastParagraphProperties->Geth() > 0 ?
+ rAppendContext.pLastParagraphProperties->Geth() :
+ pStyleProperties->Geth();
+ pFrameProperties[2].Value <<= sal_Int16(
+ rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GethRule() :
+ pStyleProperties->GethRule() >=0 ? pStyleProperties->GethRule() : text::SizeType::VARIABLE);
+
+ pFrameProperties[3].Value <<= bAutoWidth ? text::SizeType::MIN : text::SizeType::FIX;
+
+ sal_Int16 nHoriOrient = sal_Int16(
+ rAppendContext.pLastParagraphProperties->GetxAlign() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GetxAlign() :
+ pStyleProperties->GetxAlign() >= 0 ? pStyleProperties->GetxAlign() : text::HoriOrientation::NONE );
+ pFrameProperties[4].Value <<= nHoriOrient;
+
+ pFrameProperties[5].Value <<=
+ rAppendContext.pLastParagraphProperties->IsxValid() ?
+ rAppendContext.pLastParagraphProperties->Getx() : pStyleProperties->Getx();
+ pFrameProperties[6].Value <<= sal_Int16(
+ rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GethAnchor() :
+ pStyleProperties->GethAnchor() );
+
+ sal_Int16 nVertOrient = sal_Int16(
+ rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GetyAlign() :
+ pStyleProperties->GetyAlign() >= 0 ? pStyleProperties->GetyAlign() : text::VertOrientation::NONE );
+ pFrameProperties[7].Value <<= nVertOrient;
+
+ pFrameProperties[8].Value <<=
+ rAppendContext.pLastParagraphProperties->IsyValid() ?
+ rAppendContext.pLastParagraphProperties->Gety() : pStyleProperties->Gety();
+ pFrameProperties[9].Value <<= sal_Int16(
+ rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GetvAnchor() :
+ pStyleProperties->GetvAnchor() );
+
+ pFrameProperties[10].Value <<= text::WrapTextMode(
+ rAppendContext.pLastParagraphProperties->GetWrap() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GetWrap() :
+ pStyleProperties->GetWrap());
+
+ sal_Int32 nBottomDist;
+ sal_Int32 nTopDist = nBottomDist =
+ rAppendContext.pLastParagraphProperties->GethSpace() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GethSpace() :
+ pStyleProperties->GethSpace();
+
+ pFrameProperties[11].Value <<= nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist;
+ pFrameProperties[12].Value <<= nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist;
+
+ sal_Int32 nRightDist;
+ sal_Int32 nLeftDist = nRightDist =
+ rAppendContext.pLastParagraphProperties->GetvSpace() >= 0 ?
+ rAppendContext.pLastParagraphProperties->GetvSpace() :
+ pStyleProperties->GetvSpace() >= 0 ? pStyleProperties->GetvSpace() : 0;
+ pFrameProperties[13].Value <<= nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist;
+ pFrameProperties[14].Value <<= nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist;
+
+ lcl_MoveBorderPropertiesToFrame(aFrameProperties,
+ rAppendContext.pLastParagraphProperties->GetStartingRange(),
+ rAppendContext.pLastParagraphProperties->GetEndingRange());
+ }
+ //frame conversion has to be executed after table conversion
+ RegisterFrameConversion(
+ rAppendContext.pLastParagraphProperties->GetStartingRange(),
+ rAppendContext.pLastParagraphProperties->GetEndingRange(),
+ aFrameProperties );
+ }
+ catch( const uno::Exception& rEx )
+ {
+ (void)rEx;
+ }
+ }
+}
+
void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
{
#ifdef DEBUG_DOMAINMAPPER
@@ -771,121 +888,7 @@ void DomainMapper_Impl::finishParagraph( PropertyMapPtr pPropertyMap )
else
{
//handles (8)(9) and completes (6)
- try
- {
- //
- StyleSheetEntryPtr pParaStyle =
- m_pStyleSheetTable->FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties->GetParaStyleName());
-
- uno::Sequence< beans::PropertyValue > aFrameProperties(pParaStyle ? 15: 0);
- if ( pParaStyle.get( ) )
- {
- const ParagraphProperties* pStyleProperties = dynamic_cast<const ParagraphProperties*>( pParaStyle->pProperties.get() );
- beans::PropertyValue* pFrameProperties = aFrameProperties.getArray();
- pFrameProperties[0].Name = rPropNameSupplier.GetName(PROP_WIDTH);
- pFrameProperties[1].Name = rPropNameSupplier.GetName(PROP_HEIGHT);
- pFrameProperties[2].Name = rPropNameSupplier.GetName(PROP_SIZE_TYPE);
- pFrameProperties[3].Name = rPropNameSupplier.GetName(PROP_WIDTH_TYPE);
- pFrameProperties[4].Name = rPropNameSupplier.GetName(PROP_HORI_ORIENT);
- pFrameProperties[5].Name = rPropNameSupplier.GetName(PROP_HORI_ORIENT_POSITION);
- pFrameProperties[6].Name = rPropNameSupplier.GetName(PROP_HORI_ORIENT_RELATION);
- pFrameProperties[7].Name = rPropNameSupplier.GetName(PROP_VERT_ORIENT);
- pFrameProperties[8].Name = rPropNameSupplier.GetName(PROP_VERT_ORIENT_POSITION);
- pFrameProperties[9].Name = rPropNameSupplier.GetName(PROP_VERT_ORIENT_RELATION);
- pFrameProperties[10].Name = rPropNameSupplier.GetName(PROP_SURROUND);
- pFrameProperties[11].Name = rPropNameSupplier.GetName(PROP_LEFT_MARGIN);
- pFrameProperties[12].Name = rPropNameSupplier.GetName(PROP_RIGHT_MARGIN);
- pFrameProperties[13].Name = rPropNameSupplier.GetName(PROP_TOP_MARGIN);
- pFrameProperties[14].Name = rPropNameSupplier.GetName(PROP_BOTTOM_MARGIN);
- sal_Int32 nWidth =
- rAppendContext.pLastParagraphProperties->Getw() > 0 ?
- rAppendContext.pLastParagraphProperties->Getw() :
- pStyleProperties->Getw();
- bool bAutoWidth = nWidth < 1;
- if( bAutoWidth )
- nWidth = DEFAULT_FRAME_MIN_WIDTH;
- pFrameProperties[0].Value <<= nWidth;
- pFrameProperties[1].Value <<=
- rAppendContext.pLastParagraphProperties->Geth() > 0 ?
- rAppendContext.pLastParagraphProperties->Geth() :
- pStyleProperties->Geth();
- pFrameProperties[2].Value <<= sal_Int16(
- rAppendContext.pLastParagraphProperties->GethRule() >= 0 ?
- rAppendContext.pLastParagraphProperties->GethRule() :
- pStyleProperties->GethRule() >=0 ? pStyleProperties->GethRule() : text::SizeType::VARIABLE);
-
- pFrameProperties[3].Value <<= bAutoWidth ? text::SizeType::MIN : text::SizeType::FIX;
-
- sal_Int16 nHoriOrient = sal_Int16(
- rAppendContext.pLastParagraphProperties->GetxAlign() >= 0 ?
- rAppendContext.pLastParagraphProperties->GetxAlign() :
- pStyleProperties->GetxAlign() >= 0 ? pStyleProperties->GetxAlign() : text::HoriOrientation::NONE );
- pFrameProperties[4].Value <<= nHoriOrient;
-
- pFrameProperties[5].Value <<=
- rAppendContext.pLastParagraphProperties->IsxValid() ?
- rAppendContext.pLastParagraphProperties->Getx() : pStyleProperties->Getx();
- pFrameProperties[6].Value <<= sal_Int16(
- rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 ?
- rAppendContext.pLastParagraphProperties->GethAnchor() :
- pStyleProperties->GethAnchor() );
-
- sal_Int16 nVertOrient = sal_Int16(
- rAppendContext.pLastParagraphProperties->GetyAlign() >= 0 ?
- rAppendContext.pLastParagraphProperties->GetyAlign() :
- pStyleProperties->GetyAlign() >= 0 ? pStyleProperties->GetyAlign() : text::VertOrientation::NONE );
- pFrameProperties[7].Value <<= nVertOrient;
-
- pFrameProperties[8].Value <<=
- rAppendContext.pLastParagraphProperties->IsyValid() ?
- rAppendContext.pLastParagraphProperties->Gety() : pStyleProperties->Gety();
- pFrameProperties[9].Value <<= sal_Int16(
- rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ?
- rAppendContext.pLastParagraphProperties->GetvAnchor() :
- pStyleProperties->GetvAnchor() );
-
- pFrameProperties[10].Value <<= text::WrapTextMode(
- rAppendContext.pLastParagraphProperties->GetWrap() >= 0 ?
- rAppendContext.pLastParagraphProperties->GetWrap() :
- pStyleProperties->GetWrap());
-
- sal_Int32 nBottomDist;
- sal_Int32 nTopDist = nBottomDist =
- rAppendContext.pLastParagraphProperties->GethSpace() >= 0 ?
- rAppendContext.pLastParagraphProperties->GethSpace() :
- pStyleProperties->GethSpace();
-
- pFrameProperties[11].Value <<= nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist;
- pFrameProperties[12].Value <<= nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist;
-
- sal_Int32 nRightDist;
- sal_Int32 nLeftDist = nRightDist =
- rAppendContext.pLastParagraphProperties->GetvSpace() >= 0 ?
- rAppendContext.pLastParagraphProperties->GetvSpace() :
- pStyleProperties->GetvSpace() >= 0 ? pStyleProperties->GetvSpace() : 0;
- pFrameProperties[13].Value <<= nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist;
- pFrameProperties[14].Value <<= nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist;
-
- lcl_MoveBorderPropertiesToFrame(aFrameProperties,
- rAppendContext.pLastParagraphProperties->GetStartingRange(),
- rAppendContext.pLastParagraphProperties->GetEndingRange());
- }
- //frame conversion has to be executed after table conversion
- RegisterFrameConversion(
- rAppendContext.pLastParagraphProperties->GetStartingRange(),
- rAppendContext.pLastParagraphProperties->GetEndingRange(),
- aFrameProperties );
- // next frame follows directly
- if( pParaContext->IsFrameMode() )
- {
- pToBeSavedProperties.reset( new ParagraphProperties(*pParaContext) );
- lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap);
- }
- }
- catch( const uno::Exception& rEx )
- {
- (void)rEx;
- }
+ CheckUnregisteredFrameConversion( );
}
}
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index 926caea..d7d0546 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -578,6 +578,7 @@ public:
void SetCustomFtnMark(bool bSet) { m_bIsCustomFtnMark = bSet; }
bool IsCustomFtnMark() const { return m_bIsCustomFtnMark; }
+ void CheckUnregisteredFrameConversion( );
void RegisterFrameConversion(
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameStartRange,
::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameEndRange,
commit b8b1b45cb4c9f1fb31a6e107d0131affeb99fce5
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Mon Nov 28 12:23:18 2011 +0100
WW8TableNodeInfo debug outputs now for DBG_UTIL only builds
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index b054574..95895e8 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -1559,7 +1559,7 @@ void WW8AttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rS
if ( pTextNodeInfo.get() != NULL )
{
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << pTextNodeInfo->toString() << ::std::endl;
#endif
@@ -1742,7 +1742,7 @@ void MSWordExportBase::GetSortedBookmarks( const SwTxtNode& rNode, xub_StrLen nA
void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
{
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << "<OutWW8_SwTxtNode>" << ::std::endl;
#endif
@@ -2044,7 +2044,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
if ( pTextNodeInfo.get() != NULL )
{
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << pTextNodeInfo->toString() << ::std::endl;
#endif
@@ -2346,7 +2346,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode )
AttrOutput().EndParagraph( pTextNodeInfoInner );
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << "</OutWW8_SwTxtNode>" << ::std::endl;
#endif
}
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 9a519ea..c5b7afb 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3622,7 +3622,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer
SVBT16 nStyle;
ShortToSVBT16( m_rWW8Export.nStyleBeforeFly, nStyle );
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << "<OutWW8_TableNodeInfoInner>" << pNodeInfoInner->toString();
#endif
@@ -3652,7 +3652,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer
if (pNodeInfoInner->isEndOfCell())
{
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << "<endOfCell/>" << ::std::endl;
#endif
m_rWW8Export.WriteCR(pNodeInfoInner);
@@ -3687,7 +3687,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer
if (pNodeInfoInner->isEndOfLine())
{
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << "<endOfLine/>" << ::std::endl;
#endif
TableRowEnd(pNodeInfoInner->getDepth());
@@ -3699,7 +3699,7 @@ void WW8AttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer
m_rWW8Export.pO->clear();
}
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << "</OutWW8_TableNodeInfoInner>" << ::std::endl;
#endif
}
@@ -3712,7 +3712,7 @@ void MSWordExportBase::OutputStartNode( const SwStartNode & rNode)
if (pNodeInfo.get() != NULL)
{
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << pNodeInfo->toString() << ::std::endl;
#endif
@@ -3727,7 +3727,7 @@ void MSWordExportBase::OutputStartNode( const SwStartNode & rNode)
++aIt;
}
}
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << "</OutWW8_SwStartNode>" << ::std::endl;
#endif
}
@@ -3744,7 +3744,7 @@ void MSWordExportBase::OutputEndNode( const SwEndNode &rNode )
if (pNodeInfo.get() != NULL)
{
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << pNodeInfo->toString() << ::std::endl;
#endif
@@ -3758,7 +3758,7 @@ void MSWordExportBase::OutputEndNode( const SwEndNode &rNode )
++aIt;
}
}
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DBG_UTIL
::std::clog << "</OutWW8_SwEndNode>" << ::std::endl;
#endif
}
More information about the Libreoffice-commits
mailing list