Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / drawfunc / drawsh4.cxx
blobbbd925492a398fb2013b3f32eebceaea587ac6c4
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 "scitems.hxx"
21 #include <svx/drawitem.hxx>
22 #include <svx/fontwork.hxx>
23 #include <svx/svdotext.hxx>
24 #include <svx/xdef.hxx>
25 #include <sfx2/objsh.hxx>
26 #include <sfx2/viewfrm.hxx>
27 #include <svx/svdoashp.hxx>
28 #include "drawsh.hxx"
29 #include "drawview.hxx"
30 #include "viewdata.hxx"
31 #include "tabvwsh.hxx"
32 #include "sc.hrc"
35 //------------------------------------------------------------------
37 void ScDrawShell::GetFormTextState(SfxItemSet& rSet)
39 const SdrObject* pObj = NULL;
40 SvxFontWorkDialog* pDlg = NULL;
41 ScDrawView* pDrView = pViewData->GetScDrawView();
42 const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
43 sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
45 SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
46 if ( pViewFrm->HasChildWindow(nId) )
47 pDlg = (SvxFontWorkDialog*)(pViewFrm->GetChildWindow(nId)->GetWindow());
49 if ( rMarkList.GetMarkCount() == 1 )
50 pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
52 const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
53 const bool bDeactivate(
54 !pObj ||
55 !pTextObj ||
56 !pTextObj->HasText() ||
57 dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes
59 if(bDeactivate)
61 if ( pDlg )
62 pDlg->SetActive(false);
64 rSet.DisableItem(XATTR_FORMTXTSTYLE);
65 rSet.DisableItem(XATTR_FORMTXTADJUST);
66 rSet.DisableItem(XATTR_FORMTXTDISTANCE);
67 rSet.DisableItem(XATTR_FORMTXTSTART);
68 rSet.DisableItem(XATTR_FORMTXTMIRROR);
69 rSet.DisableItem(XATTR_FORMTXTHIDEFORM);
70 rSet.DisableItem(XATTR_FORMTXTOUTLINE);
71 rSet.DisableItem(XATTR_FORMTXTSHADOW);
72 rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR);
73 rSet.DisableItem(XATTR_FORMTXTSHDWXVAL);
74 rSet.DisableItem(XATTR_FORMTXTSHDWYVAL);
76 else
78 if ( pDlg )
80 SfxObjectShell* pDocSh = SfxObjectShell::Current();
82 if ( pDocSh )
84 const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
85 XColorListRef pColorList;
87 if ( pItem )
88 pColorList = ((SvxColorListItem*)pItem)->GetColorList();
90 pDlg->SetActive();
92 if ( pColorList.is() )
93 pDlg->SetColorList( pColorList );
96 SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool());
97 pDrView->GetAttributes(aViewAttr);
98 rSet.Set(aViewAttr);
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */