Update ooo320-m1
[ooovba.git] / sc / source / ui / drawfunc / drawsh4.cxx
blobbf25e99200a247baa7eae7e7b29eb354681a184c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: drawsh4.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 //------------------------------------------------------------------
38 #include "scitems.hxx"
39 #include <svx/drawitem.hxx>
40 #include <svx/fontwork.hxx>
41 #include <svx/svdotext.hxx>
42 #include <svx/xdef.hxx>
43 #include <sfx2/objsh.hxx>
44 #include <sfx2/viewfrm.hxx>
46 #include "drawsh.hxx"
47 #include "drawview.hxx"
48 #include "viewdata.hxx"
49 #include "tabvwsh.hxx"
50 #include "sc.hrc"
53 //------------------------------------------------------------------
55 void ScDrawShell::GetFormTextState(SfxItemSet& rSet)
57 const SdrObject* pObj = NULL;
58 SvxFontWorkDialog* pDlg = NULL;
59 ScDrawView* pDrView = pViewData->GetScDrawView();
60 const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
61 USHORT nId = SvxFontWorkChildWindow::GetChildWindowId();
63 SfxViewFrame* pViewFrm = pViewData->GetViewShell()->GetViewFrame();
64 if ( pViewFrm->HasChildWindow(nId) )
65 pDlg = (SvxFontWorkDialog*)(pViewFrm->GetChildWindow(nId)->GetWindow());
67 if ( rMarkList.GetMarkCount() == 1 )
68 pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
70 if ( pObj == NULL || !pObj->ISA(SdrTextObj) ||
71 !((SdrTextObj*) pObj)->HasText() )
73 if ( pDlg )
74 pDlg->SetActive(FALSE);
76 rSet.DisableItem(XATTR_FORMTXTSTYLE);
77 rSet.DisableItem(XATTR_FORMTXTADJUST);
78 rSet.DisableItem(XATTR_FORMTXTDISTANCE);
79 rSet.DisableItem(XATTR_FORMTXTSTART);
80 rSet.DisableItem(XATTR_FORMTXTMIRROR);
81 rSet.DisableItem(XATTR_FORMTXTSTDFORM);
82 rSet.DisableItem(XATTR_FORMTXTHIDEFORM);
83 rSet.DisableItem(XATTR_FORMTXTOUTLINE);
84 rSet.DisableItem(XATTR_FORMTXTSHADOW);
85 rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR);
86 rSet.DisableItem(XATTR_FORMTXTSHDWXVAL);
87 rSet.DisableItem(XATTR_FORMTXTSHDWYVAL);
89 else
91 if ( pDlg )
93 SfxObjectShell* pDocSh = SfxObjectShell::Current();
95 if ( pDocSh )
97 const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
98 XColorTable* pColorTable = NULL;
100 if ( pItem )
101 pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
103 pDlg->SetActive();
105 if ( pColorTable )
106 pDlg->SetColorTable( pColorTable );
107 else
108 { DBG_ERROR( "ColorList not found :-/" ); }
111 SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool());
112 pDrView->GetAttributes(aViewAttr);
113 rSet.Set(aViewAttr);