Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "fuconuno.hxx"
31 : : #include <svl/aeitem.hxx>
32 : : #include <sfx2/dispatch.hxx>
33 : : #include <sfx2/viewfrm.hxx>
34 : : #include <sfx2/request.hxx>
35 : : #include <svl/intitem.hxx>
36 : :
37 : :
38 : : #include <svx/fmglob.hxx>
39 : :
40 : : #include <svx/dialogs.hrc>
41 : :
42 : : #include "app.hrc"
43 : : #include "glob.hrc"
44 : : #include "ViewShell.hxx"
45 : : #include "View.hxx"
46 : : #include "Window.hxx"
47 : : #include "ViewShellBase.hxx"
48 : : #include "ToolBarManager.hxx"
49 : : #include "drawdoc.hxx"
50 : : #include "sdresid.hxx"
51 : : #include "res_bmp.hrc"
52 : :
53 : : namespace sd {
54 : :
55 [ # # ][ # # ]: 0 : TYPEINIT1( FuConstructUnoControl, FuConstruct );
56 : :
57 : : /*************************************************************************
58 : : |*
59 : : |* Konstruktor
60 : : |*
61 : : \************************************************************************/
62 : :
63 : 0 : FuConstructUnoControl::FuConstructUnoControl (
64 : : ViewShell* pViewSh,
65 : : ::sd::Window* pWin,
66 : : ::sd::View* pView,
67 : : SdDrawDocument* pDoc,
68 : : SfxRequest& rReq)
69 [ # # ]: 0 : : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
70 : : {
71 : 0 : }
72 : :
73 : 0 : FunctionReference FuConstructUnoControl::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq, bool bPermanent )
74 : : {
75 : : FuConstructUnoControl* pFunc;
76 [ # # ][ # # ]: 0 : FunctionReference xFunc( pFunc = new FuConstructUnoControl( pViewSh, pWin, pView, pDoc, rReq ) );
77 [ # # ]: 0 : xFunc->DoExecute(rReq);
78 : 0 : pFunc->SetPermanent(bPermanent);
79 : 0 : return xFunc;
80 : : }
81 : :
82 : 0 : void FuConstructUnoControl::DoExecute( SfxRequest& rReq )
83 : : {
84 : 0 : FuConstruct::DoExecute( rReq );
85 : :
86 : 0 : SFX_REQUEST_ARG( rReq, pInventorItem, SfxUInt32Item, SID_FM_CONTROL_INVENTOR, sal_False );
87 : 0 : SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, sal_False );
88 [ # # ]: 0 : if( pInventorItem )
89 : 0 : nInventor = pInventorItem->GetValue();
90 [ # # ]: 0 : if( pIdentifierItem )
91 : 0 : nIdentifier = pIdentifierItem->GetValue();
92 : :
93 : 0 : mpViewShell->GetViewShellBase().GetToolBarManager()->SetToolBar(
94 : : ToolBarManager::TBG_FUNCTION,
95 [ # # ]: 0 : ToolBarManager::msDrawingObjectToolBar);
96 : 0 : }
97 : :
98 : : /*************************************************************************
99 : : |*
100 : : |* MouseButtonDown-event
101 : : |*
102 : : \************************************************************************/
103 : 0 : sal_Bool FuConstructUnoControl::MouseButtonDown(const MouseEvent& rMEvt)
104 : : {
105 : 0 : sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
106 : :
107 [ # # ][ # # ]: 0 : if ( rMEvt.IsLeft() && !mpView->IsAction() )
[ # # ]
108 : : {
109 [ # # ]: 0 : Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
110 [ # # ]: 0 : mpWindow->CaptureMouse();
111 [ # # ]: 0 : sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(DRGPIX,0)).Width() );
112 [ # # ]: 0 : mpView->BegCreateObj(aPnt, (OutputDevice*) NULL, nDrgLog);
113 : 0 : bReturn = sal_True;
114 : : }
115 : 0 : return bReturn;
116 : : }
117 : :
118 : : /*************************************************************************
119 : : |*
120 : : |* MouseMove-event
121 : : |*
122 : : \************************************************************************/
123 : 0 : sal_Bool FuConstructUnoControl::MouseMove(const MouseEvent& rMEvt)
124 : : {
125 : 0 : return FuConstruct::MouseMove(rMEvt);
126 : : }
127 : :
128 : : /*************************************************************************
129 : : |*
130 : : |* MouseButtonUp-event
131 : : |*
132 : : \************************************************************************/
133 : 0 : sal_Bool FuConstructUnoControl::MouseButtonUp(const MouseEvent& rMEvt)
134 : : {
135 : 0 : sal_Bool bReturn = sal_False;
136 : :
137 [ # # ][ # # ]: 0 : if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
[ # # ]
138 : : {
139 : 0 : mpView->EndCreateObj(SDRCREATE_FORCEEND);
140 : 0 : bReturn = sal_True;
141 : : }
142 : :
143 [ # # ][ # # ]: 0 : bReturn = (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
144 : :
145 [ # # ]: 0 : if (!bPermanent)
146 : 0 : mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
147 : :
148 : 0 : return (bReturn);
149 : : }
150 : :
151 : : /*************************************************************************
152 : : |*
153 : : |* Tastaturereignisse bearbeiten
154 : : |*
155 : : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
156 : : |* sal_False.
157 : : |*
158 : : \************************************************************************/
159 : 0 : sal_Bool FuConstructUnoControl::KeyInput(const KeyEvent& rKEvt)
160 : : {
161 : 0 : sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
162 : 0 : return(bReturn);
163 : : }
164 : :
165 : : /*************************************************************************
166 : : |*
167 : : |* Function aktivieren
168 : : |*
169 : : \************************************************************************/
170 : 0 : void FuConstructUnoControl::Activate()
171 : : {
172 [ # # ]: 0 : mpView->SetCurrentObj( nIdentifier, nInventor );
173 : :
174 : 0 : aNewPointer = Pointer(POINTER_DRAW_RECT);
175 [ # # ]: 0 : aOldPointer = mpWindow->GetPointer();
176 [ # # ]: 0 : mpWindow->SetPointer( aNewPointer );
177 : :
178 [ # # ]: 0 : aOldLayer = mpView->GetActiveLayer();
179 [ # # ][ # # ]: 0 : String aStr(SdResId(STR_LAYER_CONTROLS));
180 [ # # ]: 0 : mpView->SetActiveLayer( aStr );
181 : :
182 [ # # ][ # # ]: 0 : FuConstruct::Activate();
183 : 0 : }
184 : :
185 : : /*************************************************************************
186 : : |*
187 : : |* Function deaktivieren
188 : : |*
189 : : \************************************************************************/
190 : 0 : void FuConstructUnoControl::Deactivate()
191 : : {
192 : 0 : FuConstruct::Deactivate();
193 : 0 : mpView->SetActiveLayer( aOldLayer );
194 : 0 : mpWindow->SetPointer( aOldPointer );
195 : 0 : }
196 : :
197 : 0 : SdrObject* FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const Rectangle& rRectangle)
198 : : {
199 : : // case SID_FM_CREATE_CONTROL:
200 : :
201 : : SdrObject* pObj = SdrObjFactory::MakeNewObject(
202 : 0 : mpView->GetCurrentObjInventor(), mpView->GetCurrentObjIdentifier(),
203 : 0 : 0L, mpDoc);
204 : :
205 [ # # ]: 0 : if(pObj)
206 : : {
207 : 0 : pObj->SetLogicRect(rRectangle);
208 : : }
209 : :
210 : 0 : return pObj;
211 : : }
212 : :
213 : : } // end of namespace sd
214 : :
215 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|