Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
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"
33 :
34 0 : void ScDrawShell::GetFormTextState(SfxItemSet& rSet)
35 : {
36 0 : const SdrObject* pObj = NULL;
37 0 : SvxFontWorkDialog* pDlg = NULL;
38 0 : ScDrawView* pDrView = pViewData->GetScDrawView();
39 0 : const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
40 0 : sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
41 :
42 0 : SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
43 0 : if ( pViewFrm->HasChildWindow(nId) )
44 0 : pDlg = static_cast<SvxFontWorkDialog*>(pViewFrm->GetChildWindow(nId)->GetWindow());
45 :
46 0 : if ( rMarkList.GetMarkCount() == 1 )
47 0 : pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
48 :
49 0 : const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
50 : const bool bDeactivate(
51 0 : !pObj ||
52 0 : !pTextObj ||
53 0 : !pTextObj->HasText() ||
54 0 : dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes
55 :
56 0 : if(bDeactivate)
57 : {
58 0 : if ( pDlg )
59 0 : pDlg->SetActive(false);
60 :
61 0 : rSet.DisableItem(XATTR_FORMTXTSTYLE);
62 0 : rSet.DisableItem(XATTR_FORMTXTADJUST);
63 0 : rSet.DisableItem(XATTR_FORMTXTDISTANCE);
64 0 : rSet.DisableItem(XATTR_FORMTXTSTART);
65 0 : rSet.DisableItem(XATTR_FORMTXTMIRROR);
66 0 : rSet.DisableItem(XATTR_FORMTXTHIDEFORM);
67 0 : rSet.DisableItem(XATTR_FORMTXTOUTLINE);
68 0 : rSet.DisableItem(XATTR_FORMTXTSHADOW);
69 0 : rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR);
70 0 : rSet.DisableItem(XATTR_FORMTXTSHDWXVAL);
71 0 : rSet.DisableItem(XATTR_FORMTXTSHDWYVAL);
72 : }
73 : else
74 : {
75 0 : if ( pDlg )
76 : {
77 0 : SfxObjectShell* pDocSh = SfxObjectShell::Current();
78 :
79 0 : if ( pDocSh )
80 : {
81 0 : const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
82 0 : XColorListRef pColorList;
83 :
84 0 : if ( pItem )
85 0 : pColorList = static_cast<const SvxColorListItem*>(pItem)->GetColorList();
86 :
87 0 : pDlg->SetActive();
88 :
89 0 : if ( pColorList.is() )
90 0 : pDlg->SetColorList( pColorList );
91 : }
92 : }
93 0 : SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool());
94 0 : pDrView->GetAttributes(aViewAttr);
95 0 : rSet.Set(aViewAttr);
96 : }
97 228 : }
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|