dictionaries | 2 helpcontent2 | 2 include/svx/svdotext.hxx | 7 ++ sc/source/core/data/postit.cxx | 15 ++-- sc/source/filter/xml/xmlexprt.cxx | 86 +++++++++++++--------------- sc/source/filter/xml/xmlexprt.hxx | 2 svx/source/svdraw/svdobj.cxx | 4 - svx/source/svdraw/svdotextdecomposition.cxx | 4 - svx/source/svdraw/svdotxat.cxx | 13 +++- xmloff/source/draw/shapeexport.cxx | 5 - 10 files changed, 77 insertions(+), 63 deletions(-)
New commits: commit 8cabe511b5a96f7f66c4047f1535e07c2341f77f Author: Laurent Godard <[email protected]> Date: Tue Nov 19 12:13:11 2013 +0100 notes export current state - broken : lot of notes are lost on exporting Change-Id: I083cbdf51f7ea7bd90e6cddf15ba59abb4add1a1 diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 46eb924..491946f 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -271,6 +271,9 @@ private: SVX_DLLPRIVATE ImpSdrObjTextLinkUserData* GetLinkUserData() const; // void ImpCheckItemSetChanges(const SfxItemSet& rAttr); + // Annotation : do not process SetText until process fully achieved (hack) + bool bFreezeSetText=false; + protected: bool ImpCanConvTextToCurve() const; SdrObject* ImpConvertMakeObj(const basegfx::B2DPolyPolygon& rPolyPolygon, sal_Bool bClosed, sal_Bool bBezier, sal_Bool bNoSetAttr = sal_False) const; @@ -414,9 +417,6 @@ public: SdrTextAniKind GetTextAniKind() const; SdrTextAniDirection GetTextAniDirection() const; - // Annotation : do not process SetText until process fully achieved (hack) - bool bShuntSetText=false; - virtual void SetPage(SdrPage* pNewPage); virtual void SetModel(SdrModel* pNewModel); virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; @@ -557,6 +557,10 @@ public: // ItemChange(), PostItemChange() and ItemSetChanged() calls. void SetObjectItemNoBroadcast(const SfxPoolItem& rItem); + // Annotation : do not process SetText until process fully achieved (hack) + bool IsFreezeSetText() const; + void SetFreezeSetText(bool bFreeze); + public: ////////////////////////////////////////////////////////////////////////////// // text primitive decomposition helpers diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index fbd0032..9d138cc 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -675,7 +675,7 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const { ScCaptionInitData& rInitData = *maNoteData.mxInitData; - maNoteData.mpCaption->bShuntSetText=true; + maNoteData.mpCaption->SetFreezeSetText(true); // copy all items or set default items; reset shadow items ScCaptionUtil::SetDefaultItems( *maNoteData.mpCaption, mrDoc ); @@ -702,7 +702,7 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const aCreator.FitCaptionToRect(); } - maNoteData.mpCaption->bShuntSetText=false; + maNoteData.mpCaption->SetFreezeSetText(false); if( rInitData.mxOutlinerObj.get() ) maNoteData.mpCaption->SetOutlinerParaObject( rInitData.mxOutlinerObj.release() ); else diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 995f75a..7831a38 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -1375,6 +1375,7 @@ void ScXMLExport::ExportAnnotationsTextAutoStyles() std::vector<sc::NoteEntry> aEntries; pDoc->GetAllNoteEntries(aEntries); std::vector<sc::NoteEntry>::const_iterator it = aEntries.begin(), itEnd = aEntries.end(); + for (; it != itEnd; ++it) { const ScPostIt& pNote = *it->mpNote; @@ -2439,7 +2440,92 @@ void ScXMLExport::_ExportAutoStyles() } // stored styles for notes + + UniReference<SvXMLExportPropertyMapper> xShapeMapper = XMLShapeExport::CreateShapePropMapper( *this ); + GetShapeExport(); // make sure the graphics styles family is added + + const std::vector<ScNoteStyleEntry>& rNoteEntries = pSheetData->GetNoteStyles(); + std::vector<ScNoteStyleEntry>::const_iterator aNoteIter = rNoteEntries.begin(); + std::vector<ScNoteStyleEntry>::const_iterator aNoteEnd = rNoteEntries.end(); + while (aNoteIter != aNoteEnd) + { + ScAddress aPos = aNoteIter->maCellPos; + SCTAB nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( nTable ); + if (bCopySheet) + { + //! separate method AddStyleFromNote needed? + + ScPostIt* pNote = pDoc->GetNote(aPos); + OSL_ENSURE( pNote, "note not found" ); + if (pNote) + { + SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); + // all uno shapes are created anyway in CollectSharedData + Reference<beans::XPropertySet> xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY ); + if (xShapeProperties.is()) + { + if ( !aNoteIter->maStyleName.isEmpty() ) + { + std::vector<XMLPropertyState> xPropStates(xShapeMapper->Filter(xShapeProperties)); + OUString sParent; + OUString sName( aNoteIter->maStyleName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_SD_GRAPHICS_ID, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_SD_GRAPHICS_ID, sName); + } + if ( !aNoteIter->maTextStyle.isEmpty() ) + { + std::vector<XMLPropertyState> xPropStates( + GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(xShapeProperties)); + OUString sParent; + OUString sName( aNoteIter->maTextStyle ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); + } + } + } + } + ++aNoteIter; + } + + // note paragraph styles + + UniReference<SvXMLExportPropertyMapper> xParaPropMapper = GetTextParagraphExport()->GetParagraphPropertyMapper(); + + const std::vector<ScTextStyleEntry>& rNoteParaEntries = pSheetData->GetNoteParaStyles(); + std::vector<ScTextStyleEntry>::const_iterator aNoteParaIter = rNoteParaEntries.begin(); + std::vector<ScTextStyleEntry>::const_iterator aNoteParaEnd = rNoteParaEntries.end(); + while (aNoteParaIter != aNoteParaEnd) + { + ScAddress aPos = aNoteParaIter->maCellPos; + SCTAB nTable = aPos.Tab(); + bool bCopySheet = pDoc->IsStreamValid( nTable ); + if (bCopySheet) + { + ScPostIt* pNote = pDoc->GetNote( aPos ); + OSL_ENSURE( pNote, "note not found" ); + if (pNote) + { + SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); + Reference<container::XEnumerationAccess> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); + Reference<beans::XPropertySet> xParaProp( + lcl_GetEnumerated( xCellText, aNoteParaIter->maSelection.nStartPara ), uno::UNO_QUERY ); + if ( xParaProp.is() ) + { + std::vector<XMLPropertyState> xPropStates(xParaPropMapper->Filter(xParaProp)); + OUString sParent; + OUString sName( aNoteParaIter->maName ); + GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); + GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); + } + } + } + ++aNoteParaIter; + } + + // text notes styles UniReference<SvXMLExportPropertyMapper> xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this ); + ExportAnnotationsTextAutoStyles(); // stored text styles @@ -2609,7 +2695,7 @@ void ScXMLExport::_ExportAutoStyles() ExportCellTextAutoStyles(nTable); } - ExportAnnotationsTextAutoStyles(); +// ExportAnnotationsTextAutoStyles(); pChangeTrackingExportHelper->CollectAutoStyles(); diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 558cb77..8b9ea59 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -911,7 +911,7 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( } rOutliner.SetPaperSize(aAnchorTextSize); - rOutliner.SetUpdateMode(!bShuntSetText); + rOutliner.SetUpdateMode(!IsFreezeSetText()); rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); } else @@ -955,7 +955,7 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( } rOutliner.SetPaperSize(aNullSize); - rOutliner.SetUpdateMode(true); + rOutliner.SetUpdateMode(!IsFreezeSetText()); rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); } diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx index dbf2306..78ed1e9 100644 --- a/svx/source/svdraw/svdotxat.cxx +++ b/svx/source/svdraw/svdotxat.cxx @@ -120,7 +120,7 @@ bool SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt, bool bW rOutliner.SetUpdateMode(sal_True); // TODO: add the optimization with bPortionInfoChecked etc. here OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject(); - if ( pOutlinerParaObject != NULL && !bShuntSetText ) + if ( pOutlinerParaObject != NULL && !IsFreezeSetText() ) { rOutliner.SetText(*pOutlinerParaObject); rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); @@ -183,6 +183,15 @@ bool SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt, bool bW return sal_False; } +bool SdrTextObj::IsFreezeSetText() const +{ + return bFreezeSetText; +} +void SdrTextObj::SetFreezeSetText(bool bFreeze) +{ + bFreezeSetText = bFreeze; +} + bool SdrTextObj::NbcAdjustTextFrameWidthAndHeight(bool bHgt, bool bWdt) { bool bRet=AdjustTextFrameWidthAndHeight(aRect,bHgt,bWdt); commit 04dd4418dca27a3b404185912a7cb3c5ed9a5809 Author: Laurent Godard <[email protected]> Date: Sat Nov 16 15:59:43 2013 +0100 export - avoid multiple SetText calls from CreateCaptionFromInitData known issues - progressbar not correct - still too slow Change-Id: I16734f323ce145769e78538d241534c63cb2f536 diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx index 0e77b0e..46eb924 100644 --- a/include/svx/svdotext.hxx +++ b/include/svx/svdotext.hxx @@ -414,6 +414,9 @@ public: SdrTextAniKind GetTextAniKind() const; SdrTextAniDirection GetTextAniDirection() const; + // Annotation : do not process SetText until process fully achieved (hack) + bool bShuntSetText=false; + virtual void SetPage(SdrPage* pNewPage); virtual void SetModel(SdrModel* pNewModel); virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const; diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index dfd143d..fbd0032 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -49,7 +49,6 @@ #include <utility> - // ============================================================================ namespace { @@ -676,13 +675,7 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const { ScCaptionInitData& rInitData = *maNoteData.mxInitData; - // transfer ownership of outliner object to caption, or set simple text - OSL_ENSURE( rInitData.mxOutlinerObj.get() || !rInitData.maSimpleText.isEmpty(), - "ScPostIt::CreateCaptionFromInitData - need either outliner para object or simple text" ); - if( rInitData.mxOutlinerObj.get() ) - maNoteData.mpCaption->SetOutlinerParaObject( rInitData.mxOutlinerObj.release() ); - else - maNoteData.mpCaption->SetText( rInitData.maSimpleText ); + maNoteData.mpCaption->bShuntSetText=true; // copy all items or set default items; reset shadow items ScCaptionUtil::SetDefaultItems( *maNoteData.mpCaption, mrDoc ); @@ -708,6 +701,12 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const maNoteData.mpCaption->SetLogicRect( aCaptRect ); aCreator.FitCaptionToRect(); } + + maNoteData.mpCaption->bShuntSetText=false; + if( rInitData.mxOutlinerObj.get() ) + maNoteData.mpCaption->SetOutlinerParaObject( rInitData.mxOutlinerObj.release() ); + else + maNoteData.mpCaption->SetText( rInitData.maSimpleText ); } } // forget the initial caption data struct diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index b495c5b..a23496a 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1821,9 +1821,7 @@ void SdrObject::SetOutlinerParaObject(OutlinerParaObject* pTextObject) NbcSetOutlinerParaObject(pTextObject); SetChanged(); BroadcastObjectChange(); - if (GetCurrentBoundRect()!=aBoundRect0) { - SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); - } + SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0); } void SdrObject::NbcSetOutlinerParaObject(OutlinerParaObject* /*pTextObject*/) diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 9384184..558cb77 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -911,7 +911,7 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( } rOutliner.SetPaperSize(aAnchorTextSize); - rOutliner.SetUpdateMode(true); + rOutliner.SetUpdateMode(!bShuntSetText); rOutliner.SetText(rSdrBlockTextPrimitive.getOutlinerParaObject()); } else diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx index e4dc269..dbf2306 100644 --- a/svx/source/svdraw/svdotxat.cxx +++ b/svx/source/svdraw/svdotxat.cxx @@ -120,7 +120,7 @@ bool SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt, bool bW rOutliner.SetUpdateMode(sal_True); // TODO: add the optimization with bPortionInfoChecked etc. here OutlinerParaObject* pOutlinerParaObject = GetOutlinerParaObject(); - if ( pOutlinerParaObject != NULL ) + if ( pOutlinerParaObject != NULL && !bShuntSetText ) { rOutliner.SetText(*pOutlinerParaObject); rOutliner.SetFixedCellHeight(((const SdrTextFixedCellHeightItem&)GetMergedItem(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue()); @@ -133,7 +133,7 @@ bool SdrTextObj::AdjustTextFrameWidthAndHeight(Rectangle& rR, bool bHgt, bool bW } else { nHgt=rOutliner.GetTextHeight()+1; // a little tolerance } - rOutliner.Clear(); + //rOutliner.Clear(); } if (nWdt<nMinWdt) nWdt=nMinWdt; if (nWdt>nMaxWdt) nWdt=nMaxWdt; commit 311fce86d50049722e6fc6eac472960ebb6cdabf Author: Laurent Godard <[email protected]> Date: Fri Nov 15 18:04:29 2013 +0100 export notes bottlenecks - annotation autostyles - write EditText xml in the annotation reusing existing class Change-Id: Iddfabde8d76316fdc8ca2f4284dbd5d70aa1f722 diff --git a/dictionaries b/dictionaries index c6f4f79..a32a341 160000 --- a/dictionaries +++ b/dictionaries @@ -1 +1 @@ -Subproject commit c6f4f79b596756f5d45c5264a49232e491b9cd78 +Subproject commit a32a341efdbb9e53a7b832262a41f6fb6454bedf diff --git a/helpcontent2 b/helpcontent2 index 086ca60..4ae80c4 160000 --- a/helpcontent2 +++ b/helpcontent2 @@ -1 +1 @@ -Subproject commit 086ca602232837bc9c80800487c57e35e242fe7a +Subproject commit 4ae80c49646df353bada547f4755593bf1a6b209 diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 5454438..995f75a 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -1366,6 +1366,41 @@ void ScXMLExport::ExportCellTextAutoStyles(sal_Int32 nTable) GetProgressBarHelper()->ChangeReference(GetProgressBarHelper()->GetReference() + nCellCount); } +void ScXMLExport::ExportAnnotationsTextAutoStyles() +{ + UniReference<XMLPropertySetMapper> xMapper = GetTextParagraphExport()->GetTextPropMapper()->getPropertySetMapper(); + UniReference<SvXMLAutoStylePoolP> xStylePool = GetAutoStylePool(); + const ScXMLEditAttributeMap& rAttrMap = GetEditAttributeMap(); + + std::vector<sc::NoteEntry> aEntries; + pDoc->GetAllNoteEntries(aEntries); + std::vector<sc::NoteEntry>::const_iterator it = aEntries.begin(), itEnd = aEntries.end(); + for (; it != itEnd; ++it) + { + const ScPostIt& pNote = *it->mpNote; + const EditTextObject* pEdit = pNote.GetEditTextObject(); + + std::vector<editeng::Section> aAttrs; + pEdit->GetAllSections(aAttrs); + if (aAttrs.empty()) + continue; + + std::vector<editeng::Section>::const_iterator itSec = aAttrs.begin(), itSecEnd = aAttrs.end(); + for (; itSec != itSecEnd; ++itSec) + { + const std::vector<const SfxPoolItem*>& rSecAttrs = itSec->maAttributes; + if (rSecAttrs.empty()) + // No formats applied to this section. Skip it. + continue; + + std::vector<XMLPropertyState> aPropStates; + toXMLPropertyStates(aPropStates, rSecAttrs, xMapper, rAttrMap); + if (!aPropStates.empty()) + xStylePool->Add(XML_STYLE_FAMILY_TEXT_TEXT, OUString(), aPropStates, false); + } + } +} + void ScXMLExport::WriteRowContent() { ScMyRowFormatRange aRange; @@ -2404,126 +2439,8 @@ void ScXMLExport::_ExportAutoStyles() } // stored styles for notes - - UniReference<SvXMLExportPropertyMapper> xShapeMapper = XMLShapeExport::CreateShapePropMapper( *this ); - GetShapeExport(); // make sure the graphics styles family is added - - const std::vector<ScNoteStyleEntry>& rNoteEntries = pSheetData->GetNoteStyles(); - std::vector<ScNoteStyleEntry>::const_iterator aNoteIter = rNoteEntries.begin(); - std::vector<ScNoteStyleEntry>::const_iterator aNoteEnd = rNoteEntries.end(); - while (aNoteIter != aNoteEnd) - { - ScAddress aPos = aNoteIter->maCellPos; - SCTAB nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( nTable ); - if (bCopySheet) - { - //! separate method AddStyleFromNote needed? - - ScPostIt* pNote = pDoc->GetNote(aPos); - OSL_ENSURE( pNote, "note not found" ); - if (pNote) - { - SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); - // all uno shapes are created anyway in CollectSharedData - Reference<beans::XPropertySet> xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY ); - if (xShapeProperties.is()) - { - if ( !aNoteIter->maStyleName.isEmpty() ) - { - std::vector<XMLPropertyState> xPropStates(xShapeMapper->Filter(xShapeProperties)); - OUString sParent; - OUString sName( aNoteIter->maStyleName ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_SD_GRAPHICS_ID, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_SD_GRAPHICS_ID, sName); - } - if ( !aNoteIter->maTextStyle.isEmpty() ) - { - std::vector<XMLPropertyState> xPropStates( - GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(xShapeProperties)); - OUString sParent; - OUString sName( aNoteIter->maTextStyle ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); - } - } - } - } - ++aNoteIter; - } - - // note paragraph styles - - UniReference<SvXMLExportPropertyMapper> xParaPropMapper = GetTextParagraphExport()->GetParagraphPropertyMapper(); - - const std::vector<ScTextStyleEntry>& rNoteParaEntries = pSheetData->GetNoteParaStyles(); - std::vector<ScTextStyleEntry>::const_iterator aNoteParaIter = rNoteParaEntries.begin(); - std::vector<ScTextStyleEntry>::const_iterator aNoteParaEnd = rNoteParaEntries.end(); - while (aNoteParaIter != aNoteParaEnd) - { - ScAddress aPos = aNoteParaIter->maCellPos; - SCTAB nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( nTable ); - if (bCopySheet) - { - ScPostIt* pNote = pDoc->GetNote( aPos ); - OSL_ENSURE( pNote, "note not found" ); - if (pNote) - { - SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); - Reference<container::XEnumerationAccess> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); - Reference<beans::XPropertySet> xParaProp( - lcl_GetEnumerated( xCellText, aNoteParaIter->maSelection.nStartPara ), uno::UNO_QUERY ); - if ( xParaProp.is() ) - { - std::vector<XMLPropertyState> xPropStates(xParaPropMapper->Filter(xParaProp)); - OUString sParent; - OUString sName( aNoteParaIter->maName ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName); - } - } - } - ++aNoteParaIter; - } - - // note text styles - UniReference<SvXMLExportPropertyMapper> xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this ); - const std::vector<ScTextStyleEntry>& rNoteTextEntries = pSheetData->GetNoteTextStyles(); - std::vector<ScTextStyleEntry>::const_iterator aNoteTextIter = rNoteTextEntries.begin(); - std::vector<ScTextStyleEntry>::const_iterator aNoteTextEnd = rNoteTextEntries.end(); - while (aNoteTextIter != aNoteTextEnd) - { - ScAddress aPos = aNoteTextIter->maCellPos; - SCTAB nTable = aPos.Tab(); - bool bCopySheet = pDoc->IsStreamValid( nTable ); - if (bCopySheet) - { - ScPostIt* pNote = pDoc->GetNote( aPos ); - OSL_ENSURE( pNote, "note not found" ); - if (pNote) - { - SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos ); - Reference<text::XSimpleText> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY); - Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY); - ScDrawTextCursor* pCursor = ScDrawTextCursor::getImplementation( xCursorProp ); - if (pCursor) - { - pCursor->SetSelection( aNoteTextIter->maSelection ); - - std::vector<XMLPropertyState> xPropStates(xTextPropMapper->Filter(xCursorProp)); - OUString sParent; - OUString sName( aNoteTextIter->maName ); - GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates); - GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_TEXT, sName); - } - } - } - ++aNoteTextIter; - } - // stored text styles const std::vector<ScTextStyleEntry>& rTextEntries = pSheetData->GetTextStyles(); @@ -2692,6 +2609,8 @@ void ScXMLExport::_ExportAutoStyles() ExportCellTextAutoStyles(nTable); } + ExportAnnotationsTextAutoStyles(); + pChangeTrackingExportHelper->CollectAutoStyles(); GetAutoStylePool()->exportXML(XML_STYLE_FAMILY_TABLE_COLUMN, @@ -3635,14 +3554,6 @@ void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape > if (pNote) { - // TODO : notes - //is it still usefull, as this call back is only called from ScXMLExport::WriteAnnotation - // and should be in sync with pCurrentCell - SdrCaptionObj* pNoteCaption = pNote->GetOrCreateCaption(aCellPos); - Reference<drawing::XShape> xCurrentShape( pNoteCaption->getUnoShape(), uno::UNO_QUERY ); - if (xCurrentShape.get()!=xShape.get()) - return; - OUString sAuthor(pNote->GetAuthor()); if (!sAuthor.isEmpty()) { @@ -3682,6 +3593,8 @@ void ScXMLExport::exportAnnotationMeta( const uno::Reference < drawing::XShape > false ); Characters(OUString(aDate)); } + // Write the TextEditObject part of the caption + WriteEditCell(pNote->GetEditTextObject()); } } @@ -3705,7 +3618,6 @@ void ScXMLExport::WriteAnnotation(ScMyCell& rMyCell) GetShapeExport()->exportShape(xShape, SEF_DEFAULT|SEF_EXPORT_ANNOTATION, NULL); pCurrentCell = NULL; - } } diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx index cc649bd..87c68d1f 100644 --- a/sc/source/filter/xml/xmlexprt.hxx +++ b/sc/source/filter/xml/xmlexprt.hxx @@ -155,6 +155,7 @@ class ScXMLExport : public SvXMLExport void ExportColumns(const sal_Int32 nTable, const com::sun::star::table::CellRangeAddress& aColumnHeaderRange, const bool bHasColumnHeader); void ExportExternalRefCacheStyles(); void ExportCellTextAutoStyles(sal_Int32 nTable); + void ExportAnnotationsTextAutoStyles(); void ExportFormatRanges(const sal_Int32 nStartCol, const sal_Int32 nStartRow, const sal_Int32 nEndCol, const sal_Int32 nEndRow, const sal_Int32 nSheet); void WriteRowContent(); @@ -279,6 +280,7 @@ public: virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); virtual void DisposingModel(); + }; #endif diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index e341f71..b5b29b1 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2956,8 +2956,9 @@ void XMLShapeExport::ImpExportCaptionShape( ImpExportEvents( xShape ); ImpExportGluePoints( xShape ); if( bAnnotation ) - mrExport.exportAnnotationMeta( xShape ); - ImpExportText( xShape ); + mrExport.exportAnnotationMeta( xShape ); // The text is processed at annotation level + else + ImpExportText( xShape ); } } _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
