summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Lippka <christian.lippka@sun.com>2010-02-02 16:46:05 +0100
committerChristian Lippka <christian.lippka@sun.com>2010-02-02 16:46:05 +0100
commite3642c3f42dcbbcb64c47cfa4ae3ce9182f911a3 (patch)
treee9e3c1be96bbfce9d050251c4617ec366a87240d
parent1729ed6a9a1617a5821913501513beec86921a7e (diff)
work on setautolayout
-rw-r--r--sd/inc/sdpage.hxx2
-rw-r--r--sd/source/core/sdpage.cxx34
-rw-r--r--sd/source/ui/view/sdview4.cxx6
3 files changed, 32 insertions, 10 deletions
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index 698684dcc765..34010fc6198b 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -199,7 +199,7 @@ public:
SdrObject* CreatePresObj(PresObjKind eObjKind, BOOL bVertical, const Rectangle& rRect, BOOL bInsert=FALSE);
SdrObject* CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert);
- SdrObject* GetPresObj(PresObjKind eObjKind, int nIndex = 1 );
+ SdrObject* GetPresObj(PresObjKind eObjKind, int nIndex = 1, bool bFuzzySearch = false );
PresObjKind GetPresObjKind(SdrObject* pObj) const;
String GetPresObjText(PresObjKind eObjKind) const;
SfxStyleSheet* GetStyleSheetForPresObj(PresObjKind eObjKind) const;
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 762e8ad2f649..b0afb816dcc3 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -162,18 +162,40 @@ SdPage::~SdPage()
}
/** returns the nIndex'th object from the given PresObjKind, index starts with 1 */
-SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, int nIndex )
+SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, int nIndex, bool bFuzzySearch /* = false */ )
{
int nObjFound = 0; // index of the searched object
SdrObject* pObj = 0;
while( (pObj = maPresentationShapeList.getNextShape(pObj)) != 0 )
{
SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
- if( pInfo && (pInfo->mePresObjKind == eObjKind) )
+ if( pInfo )
{
- nObjFound++; // found one
- if( nObjFound == nIndex )
- return pObj;
+ bool bFound = false;
+ if( pInfo->mePresObjKind == eObjKind )
+ {
+ bFound = true;
+ }
+ else if( bFuzzySearch && (eObjKind == PRESOBJ_OUTLINE) )
+ {
+ switch( pInfo->mePresObjKind )
+ {
+ case PRESOBJ_GRAPHIC:
+ case PRESOBJ_OBJECT:
+ case PRESOBJ_CHART:
+ case PRESOBJ_ORGCHART:
+ case PRESOBJ_TABLE:
+ case PRESOBJ_IMAGE:
+ bFound = TRUE;
+ break;
+ }
+ }
+ if( bFound )
+ {
+ nObjFound++; // found one
+ if( nObjFound == nIndex )
+ return pObj;
+ }
}
}
@@ -1357,7 +1379,7 @@ void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescripto
for( i = 0; (i < PRESOBJ_MAX) && (rDescriptor.meKind[i] != PRESOBJ_NONE); i++ )
{
PresObjKind eKind = rDescriptor.meKind[i];
- SdrObject* pObj = rPage.GetPresObj( eKind, PresObjIndex[eKind] );
+ SdrObject* pObj = rPage.GetPresObj( eKind, PresObjIndex[eKind], true );
if( pObj )
{
PresObjIndex[eKind]++; // on next search for eKind, find next shape with same eKind
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index e75f1e981ea9..06db26cc317e 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -123,6 +123,8 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
const bool bIsGraphic = pPickObj->ISA( SdrGrafObj );
if( bIsGraphic || pObj->IsEmptyPresObj() )
{
+ SdPage* pPage = (SdPage*) pPickObj->GetPage();
+
if( bIsGraphic )
{
// Das Objekt wird mit der Bitmap gefuellt
@@ -147,9 +149,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
if( bUndo )
BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
- SdPage* pPage = (SdPage*) pPickObj->GetPage();
-
- if (pPage && pPage->GetPresObjKind(pPickObj) == PRESOBJ_GRAPHIC)
+ if (pPage && pPage->IsPresObj(pPickObj))
{
// Neues PresObj in die Liste eintragen
pNewGrafObj->SetUserCall(pPickObj->GetUserCall());