Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/DomainMapperTableManager.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/DomainMapperTableManager.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/DomainMapperTableManager.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/DomainMapperTableManager.cxx Thu Oct 4 23:16:35 2012 @@ -56,7 +56,7 @@ DomainMapperTableManager::DomainMapperTa { m_pTablePropsHandler->SetTableManager( this ); -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER #ifdef DEBUG_TABLE setTagLogger(dmapper_logger); #endif @@ -67,15 +67,15 @@ DomainMapperTableManager::DomainMapperTa -----------------------------------------------------------------------*/ DomainMapperTableManager::~DomainMapperTableManager() { - if ( m_pTablePropsHandler ) - delete m_pTablePropsHandler, m_pTablePropsHandler = NULL; + delete m_pTablePropsHandler; + m_pTablePropsHandler = NULL; } /*-- 23.04.2007 15:25:37--------------------------------------------------- -----------------------------------------------------------------------*/ bool DomainMapperTableManager::sprm(Sprm & rSprm) { -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("tablemanager.sprm"); string sSprm = rSprm.toString(); dmapper_logger->chars(sSprm); @@ -121,7 +121,7 @@ bool DomainMapperTableManager::sprm(Sprm if( m_nTableWidth ) pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth ); } -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->addTag(pPropMap->toTag()); #endif insertTableProps(pPropMap); @@ -253,7 +253,7 @@ bool DomainMapperTableManager::sprm(Sprm case NS_ooxml::LN_CT_TcPrBase_gridSpan: //number of grid positions spanned by this cell /* WRITERFILTERSTATUS: done: 100, planned: 2, spent: 0 */ { -#if DEBUG_DOMAINMAPPER +#if DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("tablemanager.GridSpan"); dmapper_logger->attribute("gridSpan", nIntValue); dmapper_logger->endElement("tablemanager.GridSpan"); @@ -291,7 +291,7 @@ bool DomainMapperTableManager::sprm(Sprm bRet = false; #ifdef DEBUG_DOMAINMAPPER - dmapper_logger->element("unhandled"); + dmapper_logger->element("TableManager.unhandled"); #endif } } @@ -326,7 +326,7 @@ void DomainMapperTableManager::endLevel( m_nTableWidth = 0; DomainMapperTableManager_Base_t::endLevel( ); -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("dmappertablemanager.endLevel"); PropertyMapPtr pProps = getTableProps(); if (pProps.get() != NULL) @@ -341,7 +341,7 @@ void DomainMapperTableManager::endLevel( -----------------------------------------------------------------------*/ void DomainMapperTableManager::endOfCellAction() { -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->element("endOFCellAction"); #endif @@ -354,7 +354,7 @@ void DomainMapperTableManager::endOfCell -----------------------------------------------------------------------*/ void DomainMapperTableManager::endOfRowAction() { -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("endOfRowAction"); #endif @@ -363,13 +363,13 @@ void DomainMapperTableManager::endOfRowA { ::std::vector<sal_Int32>::const_iterator aCellIter = pTableGrid->begin(); -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("tableWidth"); #endif while( aCellIter != pTableGrid->end() ) { -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("col"); dmapper_logger->attribute("width", *aCellIter); dmapper_logger->endElement("col"); @@ -386,7 +386,7 @@ void DomainMapperTableManager::endOfRowA insertTableProps(pPropMap); } -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->endElement("tableWidth"); #endif } @@ -398,7 +398,7 @@ void DomainMapperTableManager::endOfRowA pCurrentSpans->insert( pCurrentSpans->end( ), m_nCell - pCurrentSpans->size(), 1 ); } -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("gridSpans"); { ::std::vector<sal_Int32>::const_iterator aGridSpanIter = pCurrentSpans->begin(); @@ -454,7 +454,7 @@ void DomainMapperTableManager::endOfRowA TablePropertyMapPtr pPropMap( new TablePropertyMap ); pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, false, uno::makeAny( aSeparators ) ); -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->startElement("rowProperties"); dmapper_logger->addTag(pPropMap->toTag()); dmapper_logger->endElement("rowProperties"); @@ -467,7 +467,7 @@ void DomainMapperTableManager::endOfRowA m_nCellBorderIndex = 0; pCurrentSpans->clear(); -#ifdef DEBUG_DOMAINMAPPER +#ifdef DEBUG_DMAPPER_TABLE_HANDLER dmapper_logger->endElement("endOfRowAction"); #endif }
Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/DomainMapper_Impl.cxx Thu Oct 4 23:16:35 2012 @@ -86,6 +86,16 @@ using namespace ::com::sun::star; using namespace ::rtl; namespace writerfilter { namespace dmapper{ + +class Exception +{ + ::std::string m_message; + +public: + Exception(const ::std::string & message = "") : m_message(message) {} + virtual ~Exception() {} +}; + struct FieldConversion { ::rtl::OUString sWordCommand; @@ -218,8 +228,9 @@ void DomainMapper_Impl::SetDocumentSetti { xSettings->setPropertyValue( rPropName, rValue ); } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } } } @@ -251,9 +262,22 @@ void DomainMapper_Impl::SetIsLastParagra void DomainMapper_Impl::PushProperties(ContextType eId) { SectionPropertyMap* pSectionContext = 0; - PropertyMapPtr pInsert(eId == CONTEXT_SECTION ? - (pSectionContext = new SectionPropertyMap( m_bIsFirstSection )) : - eId == CONTEXT_PARAGRAPH ? new ParagraphPropertyMap : new PropertyMap); + PropertyMapPtr pInsert; + + switch (eId) + { + case CONTEXT_SECTION: + pSectionContext = new SectionPropertyMap( m_bIsFirstSection ); + pInsert.reset(pSectionContext); + break; + case CONTEXT_PARAGRAPH: + pInsert.reset(new ParagraphPropertyMap); + break; + default: + pInsert.reset(new PropertyMap); + break; + } + if(eId == CONTEXT_SECTION) { if( m_bIsFirstSection ) @@ -533,7 +557,7 @@ void DomainMapper_Impl::clearDeferredBre /*------------------------------------------------------------------------- -----------------------------------------------------------------------*/ -void lcl_MoveBorderPropertiesToFrame(uno::Sequence<beans::PropertyValue>& rFrameProperties, +void lcl_MoveBorderPropertiesToFrame(PropertySequence & aPropSequence, uno::Reference<text::XTextRange> xStartTextRange, uno::Reference<text::XTextRange> xEndTextRange ) { @@ -558,28 +582,95 @@ void lcl_MoveBorderPropertiesToFrame(uno PROP_BOTTOM_BORDER_DISTANCE }; - sal_uInt32 nStart = rFrameProperties.getLength(); sal_uInt32 nBorderPropertyCount = sizeof( aBorderProperties ) / sizeof(PropertyIds); - rFrameProperties.realloc(nStart + nBorderPropertyCount); - beans::PropertyValue* pFrameProperties = rFrameProperties.getArray(); PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier(); for( sal_uInt32 nProperty = 0; nProperty < nBorderPropertyCount; ++nProperty) { ::rtl::OUString sPropertyName = rPropNameSupplier.GetName(aBorderProperties[nProperty]); - pFrameProperties[nStart].Name = sPropertyName; - pFrameProperties[nStart].Value = xTextRangeProperties->getPropertyValue(sPropertyName); + aPropSequence.set(aBorderProperties[nProperty], xTextRangeProperties->getPropertyValue(sPropertyName)); if( nProperty < 4 ) xTextRangeProperties->setPropertyValue( sPropertyName, uno::makeAny(table::BorderLine())); - ++nStart; } - rFrameProperties.realloc(nStart); } catch( const uno::Exception& rEx ) { (void)rEx; } } + +void lcl_CorrectIndents(PropertySequence & aPropSeq) +{ + try + { + uno::Any aAny; + + sal_Int32 nLeftMargin = 0; + +#ifdef DEBUG + ::std::string aStr(aPropSeq.toString()); +#endif + + aAny = aPropSeq.get(PROP_PARA_LEFT_MARGIN); + if (aAny.hasValue()) + aAny >>= nLeftMargin; + + aAny = aPropSeq.get(PROP_LEFT_BORDER_DISTANCE); + + if (aAny.hasValue()) + { + sal_Int32 nLeftBorderDistance = 0; + aAny >>= nLeftBorderDistance; + nLeftMargin -= nLeftBorderDistance; + aPropSeq.set(PROP_PARA_LEFT_MARGIN, nLeftMargin); + } + + aAny = aPropSeq.get(PROP_LEFT_BORDER); + + if (aAny.hasValue()) + { + table::BorderLine aBorderLine; + aAny >>= aBorderLine; + nLeftMargin -= aBorderLine.OuterLineWidth; + aPropSeq.set(PROP_PARA_LEFT_MARGIN, nLeftMargin); + } + + sal_Int32 nRightMargin = 0; + aAny = aPropSeq.get(PROP_PARA_RIGHT_MARGIN); + if (aAny.hasValue()) + aAny >>= nRightMargin; + + aAny = aPropSeq.get(PROP_RIGHT_BORDER_DISTANCE); + + if (aAny.hasValue()) + { + sal_Int32 nRightBorderDistance = 0; + aAny >>= nRightBorderDistance; + nRightMargin -= nRightBorderDistance; + aPropSeq.set(PROP_PARA_RIGHT_MARGIN, nRightMargin); + } + + aAny = aPropSeq.get(PROP_RIGHT_BORDER); + + if (aAny.hasValue()) + { + table::BorderLine aBorderLine; + aAny >>= aBorderLine; + nRightMargin -= aBorderLine.OuterLineWidth; + aPropSeq.set(PROP_PARA_RIGHT_MARGIN, nRightMargin); + } + } + catch (const uno::Exception& rEx) + { + (void) rEx; + } + catch (const dmapper::Exception & rEx) + { + (void) rEx; + } + +} + /*-- 04.01.2008 10:59:19--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -690,120 +781,207 @@ void DomainMapper_Impl::finishParagraph( { //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; - } + { + // + StyleSheetEntryPtr pParaStyle = + m_pStyleSheetTable->FindStyleSheetByConvertedStyleName(rAppendContext.pLastParagraphProperties->GetParaStyleName()); + + PropertySequence aPropSequence; + if ( pParaStyle.get( ) ) + { + const ParagraphProperties* pStyleProperties = dynamic_cast<const ParagraphProperties*>( pParaStyle->pProperties.get() ); + sal_Int32 nWidth = + rAppendContext.pLastParagraphProperties->Getw() > 0 ? + rAppendContext.pLastParagraphProperties->Getw() : + pStyleProperties->Getw(); + bool bAutoWidth = nWidth < 1; + if( bAutoWidth ) + nWidth = DEFAULT_FRAME_MIN_WIDTH; + aPropSequence.set(PROP_WIDTH, nWidth); + + if (rAppendContext.pLastParagraphProperties->Geth()) + { + aPropSequence.set(PROP_HEIGHT, rAppendContext.pLastParagraphProperties->Geth()); + } + else + { + aPropSequence.set(PROP_HEIGHT, pStyleProperties->Geth()); + } + + if (rAppendContext.pLastParagraphProperties->GethRule() >= 0) + { + aPropSequence.set(PROP_SIZE_TYPE, rAppendContext.pLastParagraphProperties->GethRule()); + } + else if (pStyleProperties->GethRule() >=0) + { + aPropSequence.set(PROP_SIZE_TYPE, pStyleProperties->GethRule()); + } + else + { + aPropSequence.set(PROP_SIZE_TYPE, text::SizeType::VARIABLE); + } + + if (bAutoWidth) + { + aPropSequence.set(PROP_WIDTH_TYPE, text::SizeType::MIN); + } + else + { + aPropSequence.set(PROP_WIDTH_TYPE, text::SizeType::FIX); + } + + sal_Int16 nHoriOrient = text::HoriOrientation::NONE; + if ( rAppendContext.pLastParagraphProperties->GetxAlign() >= 0) + { + nHoriOrient = static_cast<sal_Int16>(rAppendContext.pLastParagraphProperties->GetxAlign()); + } + else if (pStyleProperties->GetxAlign() >= 0) + { + nHoriOrient = static_cast<sal_Int16>(pStyleProperties->GetxAlign()); + } + + aPropSequence.set(PROP_HORI_ORIENT, nHoriOrient); + + if (rAppendContext.pLastParagraphProperties->IsxValid()) + { + aPropSequence.set(PROP_HORI_ORIENT_POSITION, + rAppendContext.pLastParagraphProperties->Getx()); + } + else + { + aPropSequence.set(PROP_HORI_ORIENT_POSITION, + pStyleProperties->Getx()); + } + + if (rAppendContext.pLastParagraphProperties->GethAnchor() >= 0) + { + aPropSequence.set(PROP_HORI_ORIENT_RELATION, + rAppendContext.pLastParagraphProperties->GethAnchor()); + } + else + { + aPropSequence.set(PROP_HORI_ORIENT_RELATION, pStyleProperties->GethAnchor()); + } + + sal_Int16 nVertOrient = text::VertOrientation::NONE; + if ( rAppendContext.pLastParagraphProperties->GetyAlign() >= 0) + { + nVertOrient = static_cast<sal_Int16>(rAppendContext.pLastParagraphProperties->GetyAlign()); + } + else if ( pStyleProperties->GetyAlign() >= 0) + { + nVertOrient = static_cast<sal_Int16>(pStyleProperties->GetyAlign()); + } + + aPropSequence.set(PROP_VERT_ORIENT, nVertOrient); + + if ( rAppendContext.pLastParagraphProperties->IsyValid()) + { + aPropSequence.set(PROP_VERT_ORIENT_POSITION, rAppendContext.pLastParagraphProperties->Gety()); } + else + { + aPropSequence.set(PROP_VERT_ORIENT_POSITION, pStyleProperties->Gety()); + } + + if (rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0) + { + aPropSequence.set(PROP_VERT_ORIENT_RELATION, + rAppendContext.pLastParagraphProperties->GetvAnchor()); + } + else + { + aPropSequence.set(PROP_VERT_ORIENT_RELATION, + pStyleProperties->GetvAnchor()); + } + + if (rAppendContext.pLastParagraphProperties->GetWrap() >= 0) + { + aPropSequence.set(PROP_SURROUND, + rAppendContext.pLastParagraphProperties->GetWrap()); + } + else + { + aPropSequence.set(PROP_SURROUND, + pStyleProperties->GetWrap()); + } + + sal_Int32 nTopDist; + + if (nVertOrient == text::VertOrientation::TOP) + { + nTopDist = 0; + } + else + { + if (rAppendContext.pLastParagraphProperties->GethSpace() >= 0) + { + nTopDist = rAppendContext.pLastParagraphProperties->GethSpace(); + } + else + { + nTopDist = pStyleProperties->GethSpace(); + } + } + + aPropSequence.set(PROP_TOP_MARGIN, nTopDist); + + sal_Int32 nBottomDist = nTopDist; + if (nVertOrient == text::VertOrientation::BOTTOM) + { + nBottomDist = 0; + } + + aPropSequence.set(PROP_BOTTOM_MARGIN, nBottomDist); + + sal_Int32 nLeftDist = 0; + if (nHoriOrient == text::HoriOrientation::LEFT) + { + nLeftDist = 0; + } + else if (rAppendContext.pLastParagraphProperties->GetvSpace() >= 0) + { + nLeftDist = rAppendContext.pLastParagraphProperties->GetvSpace(); + } + else if (pStyleProperties->GetvSpace() >= 0) + { + nLeftDist = pStyleProperties->GetvSpace(); + } + else + { + nLeftDist = 0; + } + + aPropSequence.set(PROP_LEFT_MARGIN, nLeftDist); + + sal_Int32 nRightDist = nLeftDist; + + if ( nHoriOrient == text::HoriOrientation::RIGHT) + { + nRightDist = 0; + } + + aPropSequence.set(PROP_RIGHT_MARGIN, nRightDist); + + lcl_MoveBorderPropertiesToFrame(aPropSequence, + rAppendContext.pLastParagraphProperties->GetStartingRange(), + rAppendContext.pLastParagraphProperties->GetEndingRange()); + lcl_CorrectIndents(aPropSequence); + } + //frame conversion has to be executed after table conversion + RegisterFrameConversion(rAppendContext.pLastParagraphProperties->GetStartingRange(), + rAppendContext.pLastParagraphProperties->GetEndingRange(), + aPropSequence.getSequence() ); + // next frame follows directly + if( pParaContext->IsFrameMode() ) + { + pToBeSavedProperties.reset( new ParagraphProperties(*pParaContext) ); + lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap); + } + } + catch( const uno::Exception& rEx ) + { + (void)rEx; + } } } @@ -817,22 +995,27 @@ void DomainMapper_Impl::finishParagraph( lcl_AddRangeAndStyle(pToBeSavedProperties, xTextAppend, pPropertyMap); } } - uno::Sequence< beans::PropertyValue > aProperties; + + PropertySequence::Pointer_t pPropSeq(new PropertySequence()); + if( pPropertyMap.get() ) { - aProperties = pPropertyMap->GetPropertyValues(); + pPropSeq.reset(new PropertySequence(pPropertyMap->GetPropertyValues())); } + if( !bIsDropCap ) { if( aDrop.Lines > 1 ) { - sal_uInt32 nLength = aProperties.getLength(); - aProperties.realloc( nLength + 1 ); - aProperties[nLength].Value <<= aDrop; - aProperties[nLength].Name = rPropNameSupplier.GetName(PROP_DROP_CAP_FORMAT); + uno::Any aAny(aDrop); + + pPropSeq->set(PROP_DROP_CAP_FORMAT, aAny); } + + lcl_CorrectIndents(*pPropSeq); + uno::Reference< text::XTextRange > xTextRange = - xTextAppend->finishParagraph( aProperties ); + xTextAppend->finishParagraph( pPropSeq->getSequence() ); getTableManager( ).handle(xTextRange); // Set the anchor of the objects to the created paragraph @@ -846,9 +1029,10 @@ void DomainMapper_Impl::finishParagraph( #endif xObj->attach( xTextRange ); } - catch ( uno::RuntimeException& ) + catch ( uno::RuntimeException& e) { // this is normal: the shape is already attached + (void) e; } m_aAnchoredStack.pop( ); } @@ -954,11 +1138,13 @@ void DomainMapper_Impl::appendTextConten { xTextAppendAndConvert->appendTextContent( xContent, xPropertyValues ); } - catch(const lang::IllegalArgumentException& ) + catch(const lang::IllegalArgumentException& e) { + (void) e; } - catch(const uno::Exception& ) + catch(const uno::Exception& e) { + (void) e; } } } @@ -1025,8 +1211,9 @@ uno::Reference< beans::XPropertySet > Do xSection->attach( uno::Reference< text::XTextRange >( xCursor, uno::UNO_QUERY_THROW) ); xRet = uno::Reference< beans::XPropertySet > (xSection, uno::UNO_QUERY ); } - catch(const uno::Exception& ) + catch(const uno::Exception& e) { + (void) e; } } @@ -1066,8 +1253,9 @@ void DomainMapper_Impl::PushPageHeader(S xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_HEADER_TEXT_LEFT : PROP_HEADER_TEXT) ) >>= xHeaderText; m_aTextAppendStack.push( uno::Reference< text::XTextAppend >( xHeaderText, uno::UNO_QUERY_THROW)); } - catch( uno::Exception& ) + catch( uno::Exception& e) { + (void) e; } } } @@ -1103,8 +1291,9 @@ void DomainMapper_Impl::PushPageFooter(S xPageStyle->getPropertyValue(rPropNameSupplier.GetName( bLeft ? PROP_FOOTER_TEXT_LEFT : PROP_FOOTER_TEXT) ) >>= xFooterText; m_aTextAppendStack.push(uno::Reference< text::XTextAppend >( xFooterText, uno::UNO_QUERY_THROW )); } - catch( uno::Exception& ) + catch( uno::Exception& e) { + (void) e; } } } @@ -1307,10 +1496,9 @@ void DomainMapper_Impl::PushShapeContext } catch ( const uno::Exception& e ) { -#if DEBUG - clog << "Exception when adding shape: "; - clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ); - clog << endl; + (void) e; +#if DEBUG_DOMAINMAPPER + dmapper_logger->element("exception"); #endif } } @@ -2229,8 +2417,9 @@ void DomainMapper_Impl::SetNumberFormat( PropertyNameSupplier::GetPropertyNameSupplier().GetName(PROP_NUMBER_FORMAT), uno::makeAny( nKey )); } - catch(const uno::Exception&) + catch(const uno::Exception& e) { + (void) e; } } @@ -3375,15 +3564,16 @@ void DomainMapper_Impl::SetFieldResult( uno::makeAny( rResult )); } } - catch( const beans::UnknownPropertyException& ) + catch( const beans::UnknownPropertyException& e) { + (void) e; //some fields don't have a CurrentPresentation (DateTime) } } } - catch( uno::Exception& ) + catch( uno::Exception& e) { - + (void) e; } } } @@ -3523,8 +3713,9 @@ void DomainMapper_Impl::AddBookmark( con m_aBookmarkMap.insert(BookmarkMap_t::value_type( rId, BookmarkInsertPosition( bIsStart, rBookmarkName, xCurrent ) )); } } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; //TODO: What happens to bookmarks where start and end are at different XText objects? } } @@ -3592,10 +3783,10 @@ void DomainMapper_Impl::SetLineNumbering xProperties->setPropertyValue( rPropNameSupplier.GetName( PROP_NUMBERING_TYPE ), uno::makeAny( style::NumberingType::ARABIC)); xProperties->setPropertyValue( rPropNameSupplier.GetName( PROP_RESTART_AT_EACH_PAGE ), uno::makeAny( nLnc == 0 )); } - catch( const uno::Exception& ) - {} - - + catch( const uno::Exception& e) + { + (void) e; + } /* { SW_PROP_NAME(UNO_NAME_CHAR_STYLE_NAME @@ -3781,8 +3972,9 @@ void DomainMapper_Impl::ApplySettingsTab sal_Int32 nDefTab = m_pSettingsTable->GetDefaultTabStop(); xTextDefaults->setPropertyValue( PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_TAB_STOP_DISTANCE ), uno::makeAny(nDefTab) ); } - catch(const uno::Exception& ) + catch(const uno::Exception& e) { + (void) e; } } } Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FFDataHandler.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FFDataHandler.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FFDataHandler.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FFDataHandler.cxx Thu Oct 4 23:16:35 2012 @@ -410,7 +410,7 @@ void FFDataHandler::lcl_sprm(Sprm & r_Sp break; default: #ifdef DEBUG_DOMAINMAPPER - dmapper_logger->element("unhandled"); + dmapper_logger->element("FFDataHandler.unhandled"); #endif break; } @@ -453,7 +453,7 @@ void FFDataHandler::lcl_attribute(Id nam break; default: #ifdef DEBUG_DOMAINMAPPER - dmapper_logger->element("unhandled"); + dmapper_logger->element("FFDataHandler.unhandled"); #endif break; } Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FontTable.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FontTable.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FontTable.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FontTable.cxx Thu Oct 4 23:16:35 2012 @@ -68,7 +68,6 @@ void FontTable::lcl_attribute(Id Name, V return ; int nIntValue = val.getInt(); ::rtl::OUString sValue = val.getString(); - //printf ( "FontTable::attribute(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)Name, (unsigned int)nIntValue, ::rtl::OUStringToOString(sValue, RTL_TEXTENCODING_DONTKNOW).getStr()); /* WRITERFILTERSTATUS: table: FontTable_attributedata */ switch(Name) { @@ -547,8 +546,6 @@ void FontTable::lcl_sprm(Sprm& rSprm) (void)nIntValue; rtl::OUString sStringValue = pValue->getString(); - //printf ( "FontTable::sprm(0x%.4x, 0x%.4x) [%s]\n", (unsigned int)nSprmId, (unsigned int)nIntValue, ::rtl::OUStringToOString(sStringValue, RTL_TEXTENCODING_DONTKNOW).getStr()); - /* switch(nSprmId) { default: Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FormControlHelper.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FormControlHelper.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FormControlHelper.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/FormControlHelper.cxx Thu Oct 4 23:16:35 2012 @@ -185,6 +185,7 @@ bool FormControlHelper::createCheckbox(u } catch (beans::UnknownPropertyException & rException) { + (void) rException; } } Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/GraphicHelpers.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/GraphicHelpers.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/GraphicHelpers.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/GraphicHelpers.cxx Thu Oct 4 23:16:35 2012 @@ -110,7 +110,7 @@ void PositionHandler::lcl_attribute( Id break; default: #ifdef DEBUG_DOMAINMAPPER - dmapper_logger->element("unhandled"); + dmapper_logger->element("PositionHandler.unhandled"); #endif break; } @@ -182,7 +182,7 @@ void PositionHandler::lcl_sprm( Sprm& rS m_nPosition = ConversionHelper::convertEMUToMM100( nIntValue ); default: #ifdef DEBUG_DOMAINMAPPER - dmapper_logger->element("unhandled"); + dmapper_logger->element("PositionHandler.unhandled"); #endif break; } Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/GraphicImport.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/GraphicImport.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/GraphicImport.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/GraphicImport.cxx Thu Oct 4 23:16:35 2012 @@ -1092,6 +1092,7 @@ void GraphicImport::lcl_attribute(Id nNa } catch( const beans::UnknownPropertyException e ) { + (void) e; // It isn't a graphic image } @@ -1144,8 +1145,8 @@ void GraphicImport::lcl_attribute(Id nNa //TODO: does it need to be handled? break; default: -#ifdef DEBUG_DMAPPER_GRAPHIC_IMPORT - dmapper_logger->element("unhandled"); +#ifdef DEBUG_DOMAINMAPPER + dmapper_logger->element("GraphicImport.unhandled"); #endif ; } @@ -1733,16 +1734,24 @@ uno::Reference< text::XTextContent > Gra xNamed->setName( m_pImpl->sName ); } } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } } } } catch( const uno::Exception& e ) { - clog << __FILE__ << ":" << __LINE__ << " failed. Message :" ; - clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl; + (void) e; + +#ifdef DEBUG_DMAPPER_GRAPHIC_IMPORT + dmapper_logger->startElement("exception"); + dmapper_logger->attribute("file", __FILE__); + dmapper_logger->attribute("line", __LINE__); + dmapper_logger->chars(e.Message); + dmapper_logger->endElement("exceptiion"); +#endif } return xGraphicObject; } Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/ModelEventListener.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/ModelEventListener.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/ModelEventListener.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/ModelEventListener.cxx Thu Oct 4 23:16:35 2012 @@ -83,8 +83,9 @@ void ModelEventListener::disposing( cons uno::Reference<document::XEventBroadcaster>(rEvent.Source, uno::UNO_QUERY )->removeEventListener( uno::Reference<document::XEventListener>(this)); } - catch( const uno::Exception& ) + catch( const uno::Exception& e) { + (void) e; } } Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/NumberingManager.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/NumberingManager.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/NumberingManager.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/NumberingManager.cxx Thu Oct 4 23:16:35 2012 @@ -59,26 +59,6 @@ namespace dmapper { //--------------------------------------------------- Utility functions -void lcl_printProperties( uno::Sequence< beans::PropertyValue > aProps ) -{ - sal_Int32 nLen = aProps.getLength( ); - for ( sal_Int32 i = 0; i < nLen; i++ ) - { - uno::Any aValue = aProps[i].Value; - sal_Int32 nValue = 0; - OUString sValue; - - if ( !( aValue >>= sValue ) && ( aValue >>= nValue ) ) - sValue = OUString::valueOf( nValue ); - -#if DEBUG - fprintf( stderr, "Property %s: %s\n", - OUSTR_TO_C( aProps[i].Name ), - OUSTR_TO_C( sValue ) ); -#endif - } -} - sal_Int32 lcl_findProperty( uno::Sequence< beans::PropertyValue > aProps, OUString sName ) { sal_Int32 i = 0; @@ -503,8 +483,9 @@ uno::Reference< container::XNameContaine oFamily >>= xStyles; } - catch ( const uno::Exception ) + catch ( const uno::Exception e) { + (void) e; } return xStyles; @@ -552,8 +533,6 @@ void ListDef::CreateNumberingRules( Doma // Get the merged level properties uno::Sequence< beans::PropertyValue > aLvlProps = aProps[sal_Int32( nLevel )]; - lcl_printProperties( aLvlProps ); - // Get the char style uno::Sequence< beans::PropertyValue > aAbsCharStyleProps = pAbsLevel->GetCharStyleProperties( ); uno::Sequence< beans::PropertyValue >& rAbsCharStyleProps = aAbsCharStyleProps; Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/NumberingManager.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/NumberingManager.hxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/NumberingManager.hxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/NumberingManager.hxx Thu Oct 4 23:16:35 2012 @@ -143,13 +143,13 @@ public: void AddRGISTD( rtl::OUString sValue ) { m_sRGISTD += sValue; }; // Accessors - sal_Int32 GetId( ) { return m_nId; }; + sal_Int32 GetId( ) const { 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; }; + ListLevel::Pointer GetCurrentLevel( ) const { return m_pCurrentLevel; }; virtual com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< Modified: incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/OLEHandler.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/OLEHandler.cxx?rev=1394326&r1=1394325&r2=1394326&view=diff ============================================================================== --- incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/OLEHandler.cxx (original) +++ incubator/ooo/branches/buildsys/main/writerfilter/source/dmapper/OLEHandler.cxx Thu Oct 4 23:16:35 2012 @@ -125,9 +125,11 @@ void OLEHandler::lcl_attribute(Id rName, } catch( const uno::Exception& e ) { + (void) e; #if DEBUG - clog << "Exception in OLE Handler: "; - clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl; + dmapper_logger->startElement("exception"); + dmapper_logger->chars(e.Message); + dmapper_logger->endElement("exception"); #endif } } @@ -175,9 +177,11 @@ void OLEHandler::lcl_sprm(Sprm & rSprm) } catch( const uno::Exception& e ) { + (void) e; #if DEBUG - clog << "Exception in OLE Handler: "; - clog << rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr( ) << endl; + dmapper_logger->startElement("exception"); + dmapper_logger->chars(e.Message); + dmapper_logger->endElement("exception"); #endif } }