diff options
author | Varun Dhall <varun.dhall@studentpartner.com> | 2017-08-15 21:27:43 +0530 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-08-16 00:11:55 +0200 |
commit | 5be19d80f47cca8260cb46ac6e54ac19e5ea2705 (patch) | |
tree | 88e104cd9ee6d3d34f1542b7096b21df2bf54337 /sd | |
parent | 8aae35170281c8b8799f64db749d89155315cf7d (diff) |
Replace stringify by Equals in SdrObject and SdPage
Change-Id: Ia4cf7a5382a05061ff98f423cf5640a51015236d
Reviewed-on: https://gerrit.libreoffice.org/41182
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/sdpage.hxx | 2 | ||||
-rw-r--r-- | sd/source/core/drawdoc3.cxx | 2 | ||||
-rw-r--r-- | sd/source/core/sdpage2.cxx | 38 |
3 files changed, 22 insertions, 20 deletions
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx index b4b72390b6bf..4edb82d0c874 100644 --- a/sd/inc/sdpage.hxx +++ b/sd/inc/sdpage.hxx @@ -375,7 +375,7 @@ public: void addAnnotation( const css::uno::Reference< css::office::XAnnotation >& xAnnotation, int nIndex ); void removeAnnotation( const css::uno::Reference< css::office::XAnnotation >& xAnnotation ); const sd::AnnotationVector& getAnnotations() const { return maAnnotations; } - OString stringify() const; + bool Equals(const SdPage&) const; virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const override; sal_uInt16 getPageId() { return mnPageId; } diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 23c687e6dc1e..69b6a83d6ef3 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -111,7 +111,7 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc { // Ignore Layouts with "Default" these seem to be special - in the sense that there are lot of assumption all over Impress // about this - if( bRenameDuplicates && aTest != SdResId( STR_LAYOUT_DEFAULT_NAME ) && pTestPage->stringify() != pBMMPage->stringify() ) + if( bRenameDuplicates && aTest != SdResId( STR_LAYOUT_DEFAULT_NAME ) && !(pTestPage->Equals(*pBMMPage)) ) { pBookmarkDoc->RenameLayoutTemplate( pBMMPage->GetLayoutName(), pBMMPage->GetName() + "_"); diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index c4168094d373..65a7eaaabde8 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -557,25 +557,27 @@ void SdPage::setTransitionDuration ( double fTranstionDuration ) ActionChanged(); } -OString SdPage::stringify() const +bool SdPage::Equals(const SdPage& rOtherPage) const { - OStringBuffer aString(100); - aString.append((sal_Int32)mePageKind).append((sal_Int32)meAutoLayout).append((sal_Int32)mePresChange).append(mfTime).append(mbSoundOn).append(mbExcluded). - append(OUStringToOString( maLayoutName, RTL_TEXTENCODING_UTF8 )). - append(OUStringToOString(maSoundFile, RTL_TEXTENCODING_UTF8 )). - append(mbLoopSound).append(mbStopSound). - /*append(OUStringToOString(maCreatedPageName, RTL_TEXTENCODING_UTF8)). - append(OUStringToOString(maFileName, RTL_TEXTENCODING_UTF8)).*/ - append(OUStringToOString(maBookmarkName, RTL_TEXTENCODING_UTF8)). - append(mbScaleObjects).append(mbBackgroundFullSize).append((sal_Int32)meCharSet).append((sal_Int32)mnPaperBin). - append((sal_Int32)meOrientation).append((sal_Int32)mnTransitionType).append((sal_Int32)mnTransitionSubtype).append(mbTransitionDirection). - append(mnTransitionFadeColor).append(mfTransitionDuration);//.append(mbIsPrecious); - - const size_t n = GetObjCount(); - for(size_t i = 0; i < n; ++i) - aString.append(GetObj(i)->stringify()); - return aString.makeStringAndClear(); -} + bool isEqual = GetObjCount() == rOtherPage.GetObjCount(); + if( isEqual ) + { + for(size_t i = 0; i < GetObjCount(); ++i) + isEqual = isEqual && GetObj(i)->Equals(*(rOtherPage.GetObj(i))); + } + + return (isEqual && mePageKind == rOtherPage.mePageKind && meAutoLayout == rOtherPage.meAutoLayout && + mePresChange == rOtherPage.mePresChange && rtl::math::approxEqual(mfTime, rOtherPage.mfTime) && + mbSoundOn == rOtherPage.mbSoundOn && mbExcluded == rOtherPage.mbExcluded && + maLayoutName == rOtherPage.maLayoutName && maSoundFile == rOtherPage.maSoundFile && + mbLoopSound == rOtherPage.mbLoopSound && mbStopSound == rOtherPage.mbStopSound && + maBookmarkName == rOtherPage.maBookmarkName && mbScaleObjects == rOtherPage.mbScaleObjects && + mbBackgroundFullSize == rOtherPage.mbBackgroundFullSize && meCharSet == rOtherPage.meCharSet && + mnPaperBin == rOtherPage.mnPaperBin && meOrientation == rOtherPage.meOrientation && + mnTransitionType == rOtherPage.mnTransitionType && mnTransitionSubtype == rOtherPage.mnTransitionSubtype && + mbTransitionDirection == rOtherPage.mbTransitionDirection && mnTransitionFadeColor == rOtherPage.mnTransitionFadeColor && + rtl::math::approxEqual(mfTransitionDuration, rOtherPage.mfTransitionDuration)); + } void SdPage::createAnnotation( css::uno::Reference< css::office::XAnnotation >& xAnnotation ) { |