android: Update app-specific/MIME type icons
[LibreOffice.git] / sd / source / ui / view / drviewsc.cxx
blob6be86e63cb8d5436fc825bb39aae0d89028b594f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <DrawViewShell.hxx>
22 #include <svx/imapdlg.hxx>
23 #include <svx/svdoole2.hxx>
24 #include <svx/svdograf.hxx>
25 #include <svx/svxdlg.hxx>
26 #include <svx/ImageMapInfo.hxx>
28 #include <sfx2/viewfrm.hxx>
30 #include <drawdoc.hxx>
31 #include <drawview.hxx>
32 #include <memory>
34 namespace sd {
36 void DrawViewShell::UpdateIMapDlg( SdrObject* pObj )
38 if( ( dynamic_cast< SdrGrafObj *>( pObj ) == nullptr && dynamic_cast< SdrOle2Obj *>( pObj ) == nullptr )
39 || mpDrawView->IsTextEdit()
40 || !GetViewFrame()->HasChildWindow( SvxIMapDlgChildWindow::GetChildWindowId() ) )
41 return;
43 Graphic aGraphic;
44 ImageMap* pIMap = nullptr;
45 std::unique_ptr<TargetList> pTargetList;
46 SvxIMapInfo* pIMapInfo = SvxIMapInfo::GetIMapInfo( pObj );
48 // get graphic from shape
49 SdrGrafObj* pGrafObj = dynamic_cast< SdrGrafObj* >( pObj );
50 if( pGrafObj )
51 aGraphic = pGrafObj->GetGraphic();
53 if ( pIMapInfo )
55 pIMap = const_cast<ImageMap*>(&pIMapInfo->GetImageMap());
56 pTargetList.reset(new TargetList);
57 SfxViewFrame::GetTargetList( *pTargetList );
60 SvxIMapDlgChildWindow::UpdateIMapDlg( aGraphic, pIMap, pTargetList.get(), pObj );
63 IMPL_LINK( DrawViewShell, NameObjectHdl, AbstractSvxObjectNameDialog&, rDialog, bool )
65 OUString aName;
66 rDialog.GetName( aName );
67 return aName.isEmpty() || ( GetDoc() && !GetDoc()->GetObj( aName ) );
70 } // end of namespace sd
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */