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