Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / sc / source / ui / drawfunc / drawsh4.cxx
blob16976c0b2489a17930428ea198598bb4c661351b
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 void ScDrawShell::GetFormTextState(SfxItemSet& rSet)
37 const SdrObject* pObj = NULL;
38 SvxFontWorkDialog* pDlg = NULL;
39 ScDrawView* pDrView = pViewData->GetScDrawView();
40 const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
41 sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
43 SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
44 if ( pViewFrm->HasChildWindow(nId) )
45 pDlg = (SvxFontWorkDialog*)(pViewFrm->GetChildWindow(nId)->GetWindow());
47 if ( rMarkList.GetMarkCount() == 1 )
48 pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
50 const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
51 const bool bDeactivate(
52 !pObj ||
53 !pTextObj ||
54 !pTextObj->HasText() ||
55 dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes
57 if(bDeactivate)
59 if ( pDlg )
60 pDlg->SetActive(false);
62 rSet.DisableItem(XATTR_FORMTXTSTYLE);
63 rSet.DisableItem(XATTR_FORMTXTADJUST);
64 rSet.DisableItem(XATTR_FORMTXTDISTANCE);
65 rSet.DisableItem(XATTR_FORMTXTSTART);
66 rSet.DisableItem(XATTR_FORMTXTMIRROR);
67 rSet.DisableItem(XATTR_FORMTXTHIDEFORM);
68 rSet.DisableItem(XATTR_FORMTXTOUTLINE);
69 rSet.DisableItem(XATTR_FORMTXTSHADOW);
70 rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR);
71 rSet.DisableItem(XATTR_FORMTXTSHDWXVAL);
72 rSet.DisableItem(XATTR_FORMTXTSHDWYVAL);
74 else
76 if ( pDlg )
78 SfxObjectShell* pDocSh = SfxObjectShell::Current();
80 if ( pDocSh )
82 const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
83 XColorListRef pColorList;
85 if ( pItem )
86 pColorList = ((SvxColorListItem*)pItem)->GetColorList();
88 pDlg->SetActive();
90 if ( pColorList.is() )
91 pDlg->SetColorList( pColorList );
94 SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool());
95 pDrView->GetAttributes(aViewAttr);
96 rSet.Set(aViewAttr);
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */