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 "tabvwsh.hxx"
32 : : #include "sc.hrc"
33 : : #include "drawview.hxx"
34 : :
35 : : /*************************************************************************
36 : : |*
37 : : |* Konstruktor
38 : : |*
39 : : \************************************************************************/
40 : :
41 : 0 : FuConstUnoControl::FuConstUnoControl(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
42 : : SdrModel* pDoc, SfxRequest& rReq)
43 : 0 : : FuConstruct(pViewSh, pWin, pViewP, pDoc, rReq)
44 : : {
45 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pInventorItem, SfxUInt32Item, SID_FM_CONTROL_INVENTOR, false );
46 [ # # ][ # # ]: 0 : SFX_REQUEST_ARG( rReq, pIdentifierItem, SfxUInt16Item, SID_FM_CONTROL_IDENTIFIER, false );
47 [ # # ]: 0 : if( pInventorItem )
48 : 0 : nInventor = pInventorItem->GetValue();
49 [ # # ]: 0 : if( pIdentifierItem )
50 : 0 : nIdentifier = pIdentifierItem->GetValue();
51 : 0 : }
52 : :
53 : : /*************************************************************************
54 : : |*
55 : : |* Destruktor
56 : : |*
57 : : \************************************************************************/
58 : :
59 : 0 : FuConstUnoControl::~FuConstUnoControl()
60 : : {
61 [ # # ]: 0 : }
62 : :
63 : : /*************************************************************************
64 : : |*
65 : : |* MouseButtonDown-event
66 : : |*
67 : : \************************************************************************/
68 : :
69 : 0 : sal_Bool FuConstUnoControl::MouseButtonDown(const MouseEvent& rMEvt)
70 : : {
71 : : // remember button state for creation of own MouseEvents
72 : 0 : SetMouseButtonCode(rMEvt.GetButtons());
73 : :
74 : 0 : sal_Bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
75 : :
76 [ # # ][ # # ]: 0 : if ( rMEvt.IsLeft() && !pView->IsAction() )
[ # # ]
77 : : {
78 [ # # ]: 0 : Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
79 [ # # ]: 0 : pWindow->CaptureMouse();
80 [ # # ]: 0 : pView->BegCreateObj(aPnt);
81 : 0 : bReturn = sal_True;
82 : : }
83 : 0 : return bReturn;
84 : : }
85 : :
86 : : /*************************************************************************
87 : : |*
88 : : |* MouseMove-event
89 : : |*
90 : : \************************************************************************/
91 : :
92 : 0 : sal_Bool FuConstUnoControl::MouseMove(const MouseEvent& rMEvt)
93 : : {
94 : 0 : return FuConstruct::MouseMove(rMEvt);
95 : : }
96 : :
97 : : /*************************************************************************
98 : : |*
99 : : |* MouseButtonUp-event
100 : : |*
101 : : \************************************************************************/
102 : :
103 : 0 : sal_Bool FuConstUnoControl::MouseButtonUp(const MouseEvent& rMEvt)
104 : : {
105 : : // remember button state for creation of own MouseEvents
106 : 0 : SetMouseButtonCode(rMEvt.GetButtons());
107 : :
108 : 0 : sal_Bool bReturn = false;
109 : :
110 [ # # ][ # # ]: 0 : if ( pView->IsCreateObj() && rMEvt.IsLeft() )
[ # # ]
111 : : {
112 : 0 : pView->EndCreateObj(SDRCREATE_FORCEEND);
113 : 0 : bReturn = sal_True;
114 : : }
115 [ # # ][ # # ]: 0 : return (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
116 : : }
117 : :
118 : : /*************************************************************************
119 : : |*
120 : : |* Tastaturereignisse bearbeiten
121 : : |*
122 : : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
123 : : |* FALSE.
124 : : |*
125 : : \************************************************************************/
126 : :
127 : 0 : sal_Bool FuConstUnoControl::KeyInput(const KeyEvent& rKEvt)
128 : : {
129 : 0 : sal_Bool bReturn = FuConstruct::KeyInput(rKEvt);
130 : 0 : return(bReturn);
131 : : }
132 : :
133 : : /*************************************************************************
134 : : |*
135 : : |* Function aktivieren
136 : : |*
137 : : \************************************************************************/
138 : :
139 : 0 : void FuConstUnoControl::Activate()
140 : : {
141 : 0 : pView->SetCurrentObj( nIdentifier, nInventor );
142 : :
143 : 0 : aNewPointer = Pointer( POINTER_DRAW_RECT );
144 : 0 : aOldPointer = pWindow->GetPointer();
145 : 0 : pViewShell->SetActivePointer( aNewPointer );
146 : :
147 : 0 : SdrLayer* pLayer = pView->GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_CONTROLS);
148 [ # # ]: 0 : if (pLayer)
149 : 0 : pView->SetActiveLayer( pLayer->GetName() );
150 : :
151 : 0 : FuConstruct::Activate();
152 : 0 : }
153 : :
154 : : /*************************************************************************
155 : : |*
156 : : |* Function deaktivieren
157 : : |*
158 : : \************************************************************************/
159 : :
160 : 0 : void FuConstUnoControl::Deactivate()
161 : : {
162 : 0 : FuConstruct::Deactivate();
163 : :
164 : 0 : SdrLayer* pLayer = pView->GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_FRONT);
165 [ # # ]: 0 : if (pLayer)
166 : 0 : pView->SetActiveLayer( pLayer->GetName() );
167 : :
168 : 0 : pViewShell->SetActivePointer( aOldPointer );
169 : 0 : }
170 : :
171 : : // Create default drawing objects via keyboard
172 : 0 : SdrObject* FuConstUnoControl::CreateDefaultObject(const sal_uInt16 /* nID */, const Rectangle& rRectangle)
173 : : {
174 : : // case SID_FM_CREATE_CONTROL:
175 : :
176 : : SdrObject* pObj = SdrObjFactory::MakeNewObject(
177 : 0 : pView->GetCurrentObjInventor(), pView->GetCurrentObjIdentifier(),
178 : 0 : 0L, pDrDoc);
179 : :
180 [ # # ]: 0 : if(pObj)
181 : : {
182 : 0 : pObj->SetLogicRect(rRectangle);
183 : : }
184 : :
185 : 0 : return pObj;
186 : : }
187 : :
188 : :
189 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|