LibreOffice Module sc (master) 1
fuconuno.cxx
Go to the documentation of this file.
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 <fuconuno.hxx>
21#include <tabvwsh.hxx>
22#include <drawview.hxx>
23
24#include <svx/svxids.hrc>
25
27 SdrModel* pDoc, const SfxRequest& rReq)
28 : FuConstruct(rViewSh, pWin, pViewP, pDoc, rReq)
29 , nInventor(SdrInventor::Unknown)
30 , nIdentifier(SdrObjKind::NONE)
31{
32 const SfxUInt32Item* pInventorItem = rReq.GetArg<SfxUInt32Item>(SID_FM_CONTROL_INVENTOR);
33 const SfxUInt16Item* pIdentifierItem = rReq.GetArg<SfxUInt16Item>(SID_FM_CONTROL_IDENTIFIER);
34 if( pInventorItem )
35 nInventor = static_cast<SdrInventor>(pInventorItem->GetValue());
36 if( pIdentifierItem )
37 nIdentifier = static_cast<SdrObjKind>(pIdentifierItem->GetValue());
38}
39
41{
42}
43
45{
46 // remember button state for creation of own MouseEvents
48
49 bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
50
51 if ( rMEvt.IsLeft() && !pView->IsAction() )
52 {
53 Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
54 pWindow->CaptureMouse();
55 pView->BegCreateObj(aPnt);
56 bReturn = true;
57 }
58 return bReturn;
59}
60
62{
63 // remember button state for creation of own MouseEvents
65
66 bool bReturn = false;
67
68 if ( pView->IsCreateObj() && rMEvt.IsLeft() )
69 {
70 pView->EndCreateObj(SdrCreateCmd::ForceEnd);
71 bReturn = true;
72 }
73 return (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
74}
75
77{
79
80 aNewPointer = PointerStyle::DrawRect;
81 aOldPointer = pWindow->GetPointer();
83
85 if (pLayer)
86 pView->SetActiveLayer( pLayer->GetName() );
87
89}
90
92{
94
96 if (pLayer)
97 pView->SetActiveLayer( pLayer->GetName() );
98
100}
101
102// Create default drawing objects via keyboard
104{
105 // case SID_FM_CREATE_CONTROL:
106
108 *pDrDoc,
111
112 if(pObj)
113 {
114 pObj->SetLogicRect(rRectangle);
115 // tdf#140252 Controls are always on layer "controls"
116 pObj->NbcSetLayer(SC_LAYER_CONTROLS);
117 }
118
119 return pObj;
120}
121
122/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt32 GetValue() const
virtual SC_DLLPUBLIC void Deactivate() override
Definition: fuconuno.cxx:91
virtual SC_DLLPUBLIC bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: fuconuno.cxx:44
virtual rtl::Reference< SdrObject > CreateDefaultObject(const sal_uInt16 nID, const tools::Rectangle &rRectangle) override
Definition: fuconuno.cxx:103
virtual SC_DLLPUBLIC void Activate() override
Definition: fuconuno.cxx:76
SdrInventor nInventor
Definition: fuconuno.hxx:31
virtual SC_DLLPUBLIC bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: fuconuno.cxx:61
FuConstUnoControl(ScTabViewShell &rViewSh, vcl::Window *pWin, ScDrawView *pView, SdrModel *pDoc, const SfxRequest &rReq)
Definition: fuconuno.cxx:26
virtual ~FuConstUnoControl() override
Definition: fuconuno.cxx:40
SdrObjKind nIdentifier
Definition: fuconuno.hxx:32
Draw rectangle.
Definition: fuconstr.hxx:28
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: fuconstr.cxx:128
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: fuconstr.cxx:46
PointerStyle aNewPointer
Definition: fudraw.hxx:30
PointerStyle aOldPointer
Definition: fudraw.hxx:31
ScDrawView * pView
Definition: fupoor.hxx:42
virtual void Activate()
Definition: fupoor.cxx:61
void SetMouseButtonCode(sal_uInt16 nNew)
Definition: fupoor.hxx:70
SdrModel * pDrDoc
Definition: fupoor.hxx:45
virtual void Deactivate()
Definition: fupoor.cxx:65
ScTabViewShell & rViewShell
Definition: fupoor.hxx:43
VclPtr< vcl::Window > pWindow
Definition: fupoor.hxx:44
sal_uInt16 GetButtons() const
const Point & GetPosPixel() const
bool IsLeft() const
void SetActivePointer(PointerStyle nPointer)
Definition: tabview.cxx:884
bool BegCreateObj(const Point &rPnt, OutputDevice *pOut=nullptr, short nMinMov=-3)
bool IsCreateObj() const
bool EndCreateObj(SdrCreateCmd eCmd)
SdrInventor GetCurrentObjInventor() const
SdrObjKind GetCurrentObjIdentifier() const
virtual bool IsAction() const override
void SetCurrentObj(SdrObjKind nIdent, SdrInventor nInvent=SdrInventor::Default)
SdrLayer * GetLayerPerID(SdrLayerID nID)
const OUString & GetName() const
const SdrLayerAdmin & GetLayerAdmin() const
static rtl::Reference< SdrObject > MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
void SetActiveLayer(const OUString &rName)
SdrModel * GetModel() const
const T * GetArg(sal_uInt16 nSlotId) const
constexpr SdrLayerID SC_LAYER_FRONT(0)
constexpr SdrLayerID SC_LAYER_CONTROLS(3)
Unknown
SdrInventor
SdrObjKind