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