xref: /aoo41x/main/sd/source/ui/func/fuarea.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 
31 
32 #include "fuarea.hxx"
33 
34 #include <svx/svxids.hrc>
35 #include <svx/tabarea.hxx>
36 #include <vcl/msgbox.hxx>
37 #include <svl/intitem.hxx>
38 #include <svl/stritem.hxx>
39 #include <sfx2/request.hxx>
40 #include <sfx2/viewfrm.hxx>
41 #include <sfx2/bindings.hxx>
42 #include "ViewShell.hxx"
43 
44 #include "drawdoc.hxx"
45 #include "View.hxx"
46 #include "Window.hxx"
47 #include "app.hrc"
48 #include <svx/svxdlg.hxx>
49 #include <svx/dialogs.hrc>
50 
51 namespace sd {
52 TYPEINIT1( FuArea, FuPoor );
53 
54 /*************************************************************************
55 |*
56 |* Konstruktor
57 |*
58 \************************************************************************/
59 
60 FuArea::FuArea( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq)
61 : FuPoor(pViewSh, pWin, _pView, pDoc, rReq)
62 {
63 }
64 
65 FunctionReference FuArea::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* _pView, SdDrawDocument* pDoc, SfxRequest& rReq )
66 {
67 	FunctionReference xFunc( new FuArea( pViewSh, pWin, _pView, pDoc, rReq ) );
68 	xFunc->DoExecute(rReq);
69 	return xFunc;
70 }
71 
72 void FuArea::DoExecute( SfxRequest& rReq )
73 {
74 	const SfxItemSet* pArgs = rReq.GetArgs();
75 
76 	if( !pArgs )
77 	{
78 		SfxItemSet aNewAttr( mpDoc->GetPool() );
79 		mpView->GetAttributes( aNewAttr );
80 
81 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
82 		AbstractSvxAreaTabDialog * pDlg = pFact ? pFact->CreateSvxAreaTabDialog( NULL,
83 																		&aNewAttr,
84 																		mpDoc,
85 																		mpView) : 0;
86 		if( pDlg && (pDlg->Execute() == RET_OK) )
87 		{
88 			mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
89 		}
90 
91 		// Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden
92 		static sal_uInt16 SidArray[] = {
93 						SID_ATTR_FILL_STYLE,
94 						SID_ATTR_FILL_COLOR,
95 						SID_ATTR_FILL_GRADIENT,
96 						SID_ATTR_FILL_HATCH,
97 						SID_ATTR_FILL_BITMAP,
98 						0 };
99 
100 		mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
101 
102 		delete pDlg;
103 	}
104 
105 	rReq.Ignore ();
106 
107 }
108 
109 void FuArea::Activate()
110 {
111 }
112 
113 void FuArea::Deactivate()
114 {
115 }
116 
117 } // end of namespace sd
118