[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - 4 commits - sal/inc sd/inc sd/source svl/inc svl/source svx/inc svx/source
Muthu Subramanian
sumuthu at collabora.com
Wed Dec 11 23:18:23 PST 2013
sal/inc/rtl/strbuf.hxx | 17 +++++++++++++++++
sd/inc/sdpage.hxx | 3 +++
sd/source/core/drawdoc3.cxx | 22 ++++++++++++++++------
sd/source/core/sdpage2.cxx | 37 +++++++++++++++++++++++++++++++++++++
svl/inc/svl/itemset.hxx | 1 +
svl/source/items/itemset.cxx | 16 ++++++++++++++++
svx/inc/svx/svdobj.hxx | 2 ++
svx/source/svdraw/svdobj.cxx | 40 ++++++++++++++++++++++++++++++++++++++++
8 files changed, 132 insertions(+), 6 deletions(-)
New commits:
commit c67cbc42ec5f0d37f70aeda4e11e3dd90edad892
Author: Muthu Subramanian <sumuthu at collabora.com>
Date: Thu Dec 12 12:57:02 2013 +0530
Force int16 as int32
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 2aceba9..f61cab0 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -599,8 +599,8 @@ OString SdPage::stringify() const
/*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(mnPaperBin).
- append((sal_Int32)meOrientation).append(mnTransitionType).append(mnTransitionSubtype).append(mbTransitionDirection).
+ 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);
sal_Int32 n = GetObjCount();
commit 3c16c85a8766aa6f4b4e292a9d1700e1a35366c1
Author: Muthu Subramanian <sumuthu at collabora.com>
Date: Thu Dec 12 12:55:39 2013 +0530
Force enums as ints - to avoid warning/errors.
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 9f621fd..2aceba9 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -592,15 +592,15 @@ void SdPage::setTransitionDuration ( double fTranstionDuration )
OString SdPage::stringify() const
{
OStringBuffer aString(100);
- aString.append(mePageKind).append(meAutoLayout).append(mbSelected).append(mePresChange).append(mbSoundOn).append(mbExcluded).
+ aString.append((sal_Int32)mePageKind).append((sal_Int32)meAutoLayout).append(mbSelected).append((sal_Int32)mePresChange).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(meCharSet).append(mnPaperBin).
- append(meOrientation).append(mnTransitionType).append(mnTransitionSubtype).append(mbTransitionDirection).
+ append(mbScaleObjects).append(mbBackgroundFullSize).append((sal_Int32)meCharSet).append(mnPaperBin).
+ append((sal_Int32)meOrientation).append(mnTransitionType).append(mnTransitionSubtype).append(mbTransitionDirection).
append(mnTransitionFadeColor).append(mfTransitionDuration);//.append(mbIsPrecious);
sal_Int32 n = GetObjCount();
commit a3e222581b3ded07285a5e1ad18f5a5abb5d95b9
Author: Muthu Subramanian <sumuthu at collabora.com>
Date: Thu Dec 12 12:53:55 2013 +0530
Add append(bool) to OStringBuffer.
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index ed627ce..d8112ea 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -510,6 +510,23 @@ public:
}
/**
+ Appends the string representation of the <code>bool</code>
+ argument to the string buffer.
+
+ The argument is converted to a string as if by the method
+ <code>String.valueOf</code>, and the characters of that
+ string are then appended to this string buffer.
+
+ @param b a <code>bool</code>.
+ @return this string buffer.
+ */
+ OStringBuffer & append(bool b)
+ {
+ sal_Char sz[RTL_STR_MAX_VALUEOFBOOLEAN];
+ return append( sz, rtl_str_valueOfBoolean( sz, b ) );
+ }
+
+ /**
Appends the string representation of the <code>char</code>
argument to this string buffer.
commit 4e09cb4645e1b8b0393acf956c325150fe1c52fc
Author: Muthu Subramanian <sumuthu at collabora.com>
Date: Thu Dec 12 12:50:13 2013 +0530
n#753460: Copying slides having same master page name.
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index f62b2ae..0c99930 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -382,6 +382,9 @@ public:
void removeAnnotation( const ::com::sun::star::uno::Reference< ::com::sun::star::office::XAnnotation >& xAnnotation );
const sd::AnnotationVector& getAnnotations() const { return maAnnotations; }
bool hasAnnotations() const { return !maAnnotations.empty(); }
+ sal_uInt64 getHash() const;
+ virtual OString stringify() const;
+
private:
bool mbIsPrecious;
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index e2d7039..7f493d8 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -72,12 +72,12 @@ class InsertBookmarkAsPage_FindDuplicateLayouts
public:
InsertBookmarkAsPage_FindDuplicateLayouts( std::vector<rtl::OUString> &rLayoutsToTransfer )
: mrLayoutsToTransfer(rLayoutsToTransfer) {}
- void operator()( SdDrawDocument&, SdPage* );
+ void operator()( SdDrawDocument&, SdPage*, bool, SdDrawDocument* );
private:
std::vector<rtl::OUString> &mrLayoutsToTransfer;
};
-void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc, SdPage* pBMMPage )
+void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc, SdPage* pBMMPage, bool bRenameDuplicates, SdDrawDocument* pBookmarkDoc )
{
// now check for duplicate masterpage and layout names
// ===================================================
@@ -105,7 +105,17 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc
rtl::OUString aTest(aFullTest);
if (aTest == aLayout)
- bFound = true;
+ {
+ if( bRenameDuplicates && pTestPage->getHash() != pBMMPage->getHash() )
+ {
+ pBookmarkDoc->RenameLayoutTemplate( pBMMPage->GetLayoutName(), OUString(pBMMPage->GetName())+=OUString("_") );
+ aLayout = pBMMPage->GetName();
+
+ break;
+ }
+ else
+ bFound = true;
+ }
}
if (!bFound)
@@ -120,7 +130,7 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc
static void lcl_IterateBookmarkPages( SdDrawDocument &rDoc, SdDrawDocument* pBookmarkDoc,
const std::vector<rtl::OUString> &rBookmarkList, sal_uInt16 nBMSdPageCount,
- InsertBookmarkAsPage_FindDuplicateLayouts& rPageIterator )
+ InsertBookmarkAsPage_FindDuplicateLayouts& rPageIterator, bool bRenameDuplicates = false )
{
//
// Refactored copy'n'pasted layout name collection from InsertBookmarkAsPage
@@ -180,7 +190,7 @@ static void lcl_IterateBookmarkPages( SdDrawDocument &rDoc, SdDrawDocument* pBoo
if( pBMMPage )
{
// yes, call functor
- rPageIterator( rDoc, pBMMPage );
+ rPageIterator( rDoc, pBMMPage, bRenameDuplicates, pBookmarkDoc );
}
}
}
@@ -498,7 +508,7 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
//
std::vector<rtl::OUString> aLayoutsToTransfer;
InsertBookmarkAsPage_FindDuplicateLayouts aSearchFunctor( aLayoutsToTransfer );
- lcl_IterateBookmarkPages( *this, pBookmarkDoc, rBookmarkList, nBMSdPageCount, aSearchFunctor );
+ lcl_IterateBookmarkPages( *this, pBookmarkDoc, rBookmarkList, nBMSdPageCount, aSearchFunctor, ( rBookmarkList.empty() && pBookmarkDoc != this ) );
/**************************************************************************
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index 13fda31..9f621fd 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -45,6 +45,7 @@
#include <tools/tenccvt.hxx>
#include <svl/itemset.hxx>
+#include <rtl/strbuf.hxx>
using namespace ::sd;
using namespace ::com::sun::star;
@@ -53,6 +54,16 @@ using namespace ::com::sun::star::office;
extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const Reference< XInterface >& xSource );
+static sal_uInt64 lcl_getHash( OString aString )
+{
+ sal_Int32 len = aString.getLength();
+ sal_uInt64 nHash = 0;
+
+ for( sal_Int32 i = 0; i < len; i++ )
+ nHash = (nHash << 5) - nHash + aString[i];
+ return nHash;
+}
+
/*************************************************************************
|*
|* SetPresentationLayout, setzt: Layoutnamen, Masterpage-Verkn�pfung und
@@ -578,6 +589,32 @@ void SdPage::setTransitionDuration ( double fTranstionDuration )
ActionChanged();
}
+OString SdPage::stringify() const
+{
+ OStringBuffer aString(100);
+ aString.append(mePageKind).append(meAutoLayout).append(mbSelected).append(mePresChange).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(meCharSet).append(mnPaperBin).
+ append(meOrientation).append(mnTransitionType).append(mnTransitionSubtype).append(mbTransitionDirection).
+ append(mnTransitionFadeColor).append(mfTransitionDuration);//.append(mbIsPrecious);
+
+ sal_Int32 n = GetObjCount();
+ for(sal_Int32 i = 0; i < n; i++)
+ aString.append(GetObj(i)->stringify());
+ return aString.makeStringAndClear();
+}
+
+sal_uInt64 SdPage::getHash() const
+{
+ return lcl_getHash( stringify() );
+}
+
+
namespace sd {
extern void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage );
extern SdrUndoAction* CreateUndoInsertOrRemoveAnnotation( const Reference< XAnnotation >& xAnnotation, bool bInsert );
diff --git a/svl/inc/svl/itemset.hxx b/svl/inc/svl/itemset.hxx
index a38398a..47ed7ef 100644
--- a/svl/inc/svl/itemset.hxx
+++ b/svl/inc/svl/itemset.hxx
@@ -119,6 +119,7 @@ public:
virtual sal_uInt16 ClearItem( sal_uInt16 nWhich = 0);
virtual void ClearInvalidItems( sal_Bool bHardDefault = sal_False );
void InvalidateAllItems(); // HACK(via nWhich = 0) ???
+ void InvalidateDefaultItems();
inline void SetParent( const SfxItemSet* pNew );
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index 27f2a8d..c531048 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -1790,7 +1790,23 @@ SfxAllItemSet::SfxAllItemSet(const SfxItemSet &rCopy)
// -----------------------------------------------------------------------
+void SfxItemSet::InvalidateDefaultItems()
+{
+ DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
+ sal_uInt16* pPtr = _pWhichRanges;
+ SfxItemArray ppFnd = _aItems;
+ while( *pPtr )
+ {
+ for ( sal_uInt16 nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
+ if ( *ppFnd && *ppFnd != (SfxPoolItem *)-1 && **ppFnd == _pPool->GetDefaultItem( nWhich ) )
+ {
+ _pPool->Remove( **ppFnd );
+ *ppFnd = (SfxPoolItem*)-1;
+ }
+ pPtr += 2;
+ }
+}
SfxAllItemSet::SfxAllItemSet(const SfxAllItemSet &rCopy)
: SfxItemSet(rCopy),
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index cf6d266..35a023f 100644
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -1056,6 +1056,8 @@ public:
/// @see mbDoNotInsertIntoPageAutomatically
bool IsDoNotInsertIntoPageAutomatically() const;
+ virtual OString stringify() const;
+
protected:
/** Sets a new UNO shape
*
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 09cc658..0f81315 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -109,6 +109,7 @@
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svx/sdrobjectfilter.hxx>
#include "svdconv.hxx"
+#include <rtl/strbuf.hxx>
using namespace ::com::sun::star;
@@ -1766,6 +1767,45 @@ bool SdrObject::HasTextEdit() const
return false;
}
+OString SdrObject::stringify() const
+{
+ OStringBuffer aString(100);
+ aString.append(aAnchor.X()).
+ append(aAnchor.Y()).
+ append(aGridOffset.X()).
+ append(aGridOffset.Y()).
+ append((sal_Int32)nOrdNum).
+ append((sal_Int32)mnNavigationPosition).
+ append(mbSupportTextIndentingOnLineWidthChange).
+ append(mbLineIsOutsideGeometry).
+ append(bMarkProt).
+ append(bIs3DObj).
+ append(bIsEdge).
+ append(bClosedObj).
+ append(bNotVisibleAsMaster).
+ append(bEmptyPresObj).
+ append(mbVisible).
+ append(bNoPrint).
+ append(bSizProt).
+ append(bMovProt).
+ append(bGrouped).
+ append(bInserted).
+ append(bNetLock).
+ append(bVirtObj).
+ //append(maBLIPSizeRectangle).
+ append(mnLayerID);
+
+ SvMemoryStream aStream;
+ OString aLine;
+ SfxItemSet aSet(GetMergedItemSet());
+ aSet.InvalidateDefaultItems();
+ aSet.Store(aStream, true);
+ aStream.Flush();
+ aString.append((const char *)aStream.GetData(), aStream.GetEndOfData());
+
+ return aString.makeStringAndClear();
+}
+
sal_Bool SdrObject::BegTextEdit(SdrOutliner& /*rOutl*/)
{
return false;
More information about the Libreoffice-commits
mailing list