1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
26 static bool implIsMultiPresObj( PresObjKind eKind
)
34 case PRESOBJ_ORGCHART
:
44 SdPage
* View::GetPage()
47 SdrPageView
* pPV
= GetSdrPageView();
50 pPage
= static_cast< SdPage
* >( pPV
->GetPage() );
56 // returns selected object in case there's just one object in the selection
57 SdrObject
* View::GetSelectedSingleObject(SdPage
* pPage
)
59 SdrObject
* pRet
= NULL
;
62 // first try selected shape
63 if ( AreObjectsMarked() )
65 const SdrMarkList
& rMarkList
= GetMarkedObjectList();
67 if (rMarkList
.GetMarkCount() == 1)
69 SdrMark
* pMark
= rMarkList
.GetMark(0);
70 pRet
= pMark
->GetMarkedSdrObj();
78 SdrObject
* View::GetEmptyPresentationObject( PresObjKind eKind
)
80 SdPage
* pPage
= GetPage();
81 SdrObject
* pEmptyObj
= NULL
;
83 if ( pPage
&& !pPage
->IsMasterPage() ) {
84 SdrObject
* pObj
= GetSelectedSingleObject( pPage
);
86 if( pObj
&& pObj
->IsEmptyPresObj() && implIsMultiPresObj( pPage
->GetPresObjKind(pObj
) ) )
89 // try to find empty pres obj of same type
95 pEmptyObj
= pPage
->GetPresObj(eKind
, nIndex
++ );
97 while( (pEmptyObj
!= 0) && (!pEmptyObj
->IsEmptyPresObj()) );
100 // last try to find empty pres obj of multiple type
103 const std::list
< SdrObject
* >& rShapes
= pPage
->GetPresentationShapeList().getList();
105 for( std::list
< SdrObject
* >::const_iterator
iter( rShapes
.begin() ); iter
!= rShapes
.end(); ++iter
)
107 if( (*iter
)->IsEmptyPresObj() && implIsMultiPresObj(pPage
->GetPresObjKind(*iter
)) )
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */