diff options
author | Christian Lippka <cl@openoffice.org> | 2009-12-03 18:53:41 +0100 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2009-12-03 18:53:41 +0100 |
commit | 1be43c60fb32783312c18e4f65d63f4d7a55ca70 (patch) | |
tree | ed45748dd36b84b3b2f84b1a8bf093a8ba58f114 /sd/source/ui/view/sdview5.cxx | |
parent | #i107213# added ViewOverlayManager (diff) | |
download | core-1be43c60fb32783312c18e4f65d63f4d7a55ca70.tar.gz core-1be43c60fb32783312c18e4f65d63f4d7a55ca70.zip |
renaissance01: #i107213# further layout work, initial support for new layout toolbox control
Diffstat (limited to 'sd/source/ui/view/sdview5.cxx')
-rw-r--r-- | sd/source/ui/view/sdview5.cxx | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/sd/source/ui/view/sdview5.cxx b/sd/source/ui/view/sdview5.cxx index 6fc8349dfb21..a459011b5f10 100644 --- a/sd/source/ui/view/sdview5.cxx +++ b/sd/source/ui/view/sdview5.cxx @@ -30,3 +30,87 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sd.hxx" + +#include "sdpage.hxx" +#include "View.hxx" +#include "pres.hxx" + +namespace sd { + +static bool implIsMultiPresObj( PresObjKind eKind ) +{ + switch( eKind ) + { + case PRESOBJ_OUTLINE: + case PRESOBJ_GRAPHIC: + case PRESOBJ_OBJECT: + case PRESOBJ_CHART: + case PRESOBJ_ORGCHART: + case PRESOBJ_TABLE: + case PRESOBJ_IMAGE: + return true; + default: + return false; + } +} + +SdrObject* View::GetEmptyPresentationObject( PresObjKind eKind ) +{ + SdrObject* pEmptyObj = 0; + + SdrPageView* pPV = GetSdrPageView(); + if( pPV ) + { + SdPage* pPage = static_cast< SdPage* >( pPV->GetPage() ); + if( pPage ) + { + // first try selected shape + if ( AreObjectsMarked() ) + { + /********************************************************** + * Is an empty graphic object available? + **********************************************************/ + const SdrMarkList& rMarkList = GetMarkedObjectList(); + + if (rMarkList.GetMarkCount() == 1) + { + SdrMark* pMark = rMarkList.GetMark(0); + SdrObject* pObj = pMark->GetMarkedSdrObj(); + + if( pObj->IsEmptyPresObj() && implIsMultiPresObj( pPage->GetPresObjKind(pObj) ) ) + pEmptyObj = pObj; + } + } + + // try to find empty pres obj of same type + if( !pEmptyObj ) + { + int nIndex = 1; + do + { + pEmptyObj = pPage->GetPresObj(eKind, nIndex++ ); + } + while( (pEmptyObj != 0) && (!pEmptyObj->IsEmptyPresObj()) ); + } + + // last try to find empty pres obj of multiple type + if( !pEmptyObj ) + { + const std::list< SdrObject* >& rShapes = pPage->GetPresentationShapeList().getList(); + + for( std::list< SdrObject* >::const_iterator iter( rShapes.begin() ); iter != rShapes.end(); iter++ ) + { + if( (*iter)->IsEmptyPresObj() && implIsMultiPresObj(pPage->GetPresObjKind(*iter)) ) + { + pEmptyObj = (*iter); + break; + } + } + } + } + } + + return pEmptyObj; +} + +}
\ No newline at end of file |