1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sc.hxx" 26 27 28 29 //------------------------------------------------------------------ 30 31 #include "scitems.hxx" 32 #include <svx/drawitem.hxx> 33 #include <svx/fontwork.hxx> 34 #include <svx/svdotext.hxx> 35 #include <svx/xdef.hxx> 36 #include <sfx2/objsh.hxx> 37 #include <sfx2/viewfrm.hxx> 38 #include <svx/svdoashp.hxx> 39 #include "drawsh.hxx" 40 #include "drawview.hxx" 41 #include "viewdata.hxx" 42 #include "tabvwsh.hxx" 43 #include "sc.hrc" 44 45 46 //------------------------------------------------------------------ 47 48 void ScDrawShell::GetFormTextState(SfxItemSet& rSet) 49 { 50 const SdrObject* pObj = NULL; 51 SvxFontWorkDialog* pDlg = NULL; 52 ScDrawView* pDrView = pViewData->GetScDrawView(); 53 const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); 54 sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId(); 55 56 SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame(); 57 if ( pViewFrm->HasChildWindow(nId) ) 58 pDlg = (SvxFontWorkDialog*)(pViewFrm->GetChildWindow(nId)->GetWindow()); 59 60 if ( rMarkList.GetMarkCount() == 1 ) 61 pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); 62 63 const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj); 64 const bool bDeactivate( 65 !pObj || 66 !pTextObj || 67 !pTextObj->HasText() || 68 dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes 69 70 if(bDeactivate) 71 { 72 if ( pDlg ) 73 pDlg->SetActive(sal_False); 74 75 rSet.DisableItem(XATTR_FORMTXTSTYLE); 76 rSet.DisableItem(XATTR_FORMTXTADJUST); 77 rSet.DisableItem(XATTR_FORMTXTDISTANCE); 78 rSet.DisableItem(XATTR_FORMTXTSTART); 79 rSet.DisableItem(XATTR_FORMTXTMIRROR); 80 rSet.DisableItem(XATTR_FORMTXTSTDFORM); 81 rSet.DisableItem(XATTR_FORMTXTHIDEFORM); 82 rSet.DisableItem(XATTR_FORMTXTOUTLINE); 83 rSet.DisableItem(XATTR_FORMTXTSHADOW); 84 rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR); 85 rSet.DisableItem(XATTR_FORMTXTSHDWXVAL); 86 rSet.DisableItem(XATTR_FORMTXTSHDWYVAL); 87 } 88 else 89 { 90 if ( pDlg ) 91 { 92 SfxObjectShell* pDocSh = SfxObjectShell::Current(); 93 94 if ( pDocSh ) 95 { 96 const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE ); 97 XColorTable* pColorTable = NULL; 98 99 if ( pItem ) 100 pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable(); 101 102 pDlg->SetActive(); 103 104 if ( pColorTable ) 105 pDlg->SetColorTable( pColorTable ); 106 else 107 { DBG_ERROR( "ColorList not found :-/" ); } 108 } 109 } 110 SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool()); 111 pDrView->GetAttributes(aViewAttr); 112 rSet.Set(aViewAttr); 113 } 114 } 115 116 117 118