xref: /trunk/main/sc/source/ui/drawfunc/drawsh4.cxx (revision 97e8a929)
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 
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 	if ( pObj == NULL || !pObj->ISA(SdrTextObj) ||
64 		!((SdrTextObj*) pObj)->HasText() )
65 	{
66 		if ( pDlg )
67 			pDlg->SetActive(sal_False);
68 
69 		rSet.DisableItem(XATTR_FORMTXTSTYLE);
70 		rSet.DisableItem(XATTR_FORMTXTADJUST);
71 		rSet.DisableItem(XATTR_FORMTXTDISTANCE);
72 		rSet.DisableItem(XATTR_FORMTXTSTART);
73 		rSet.DisableItem(XATTR_FORMTXTMIRROR);
74 		rSet.DisableItem(XATTR_FORMTXTSTDFORM);
75 		rSet.DisableItem(XATTR_FORMTXTHIDEFORM);
76 		rSet.DisableItem(XATTR_FORMTXTOUTLINE);
77 		rSet.DisableItem(XATTR_FORMTXTSHADOW);
78 		rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR);
79 		rSet.DisableItem(XATTR_FORMTXTSHDWXVAL);
80 		rSet.DisableItem(XATTR_FORMTXTSHDWYVAL);
81 	}
82 	else
83 	{
84 		if ( pDlg )
85 		{
86 			SfxObjectShell* pDocSh = SfxObjectShell::Current();
87 
88 			if ( pDocSh )
89 			{
90                 const SfxPoolItem*  pItem = pDocSh->GetItem( SID_COLOR_TABLE );
91 				XColorList*		pColorTable = NULL;
92 
93 				if ( pItem )
94 					pColorTable = ((SvxColorTableItem*)pItem)->GetColorTable();
95 
96 				pDlg->SetActive();
97 
98 				if ( pColorTable )
99 					pDlg->SetColorTable( pColorTable );
100 				else
101 					{ DBG_ERROR( "ColorList not found :-/" ); }
102 			}
103 		}
104 		SfxItemSet aViewAttr(pDrView->GetModel()->GetItemPool());
105 		pDrView->GetAttributes(aViewAttr);
106 		rSet.Set(aViewAttr);
107 	}
108 }
109 
110 
111 
112