LibreOffice Module sd (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 <rtl/ustring.hxx>
22#include <sfx2/dispatch.hxx>
23#include <sfx2/viewfrm.hxx>
24#include <sfx2/request.hxx>
25#include <svl/intitem.hxx>
26#include <svx/svxids.hrc>
27#include <vcl/ptrstyle.hxx>
28
29#include <ViewShell.hxx>
30#include <View.hxx>
31#include <Window.hxx>
32#include <ViewShellBase.hxx>
33#include <ToolBarManager.hxx>
34#include <unokywds.hxx>
35
36
37namespace sd {
38
39
41 ViewShell* pViewSh,
42 ::sd::Window* pWin,
43 ::sd::View* pView,
44 SdDrawDocument* pDoc,
45 SfxRequest& rReq)
46 : FuConstruct(pViewSh, pWin, pView, pDoc, rReq)
47 , nInventor(SdrInventor::Unknown)
48 , nIdentifier(SdrObjKind::NONE)
49{
50}
51
53{
55 rtl::Reference<FuPoor> xFunc( pFunc = new FuConstructUnoControl( pViewSh, pWin, pView, pDoc, rReq ) );
56 xFunc->DoExecute(rReq);
58 return xFunc;
59}
60
62{
64
65 const SfxUInt32Item* pInventorItem = rReq.GetArg<SfxUInt32Item>(SID_FM_CONTROL_INVENTOR);
66 const SfxUInt16Item* pIdentifierItem = rReq.GetArg<SfxUInt16Item>(SID_FM_CONTROL_IDENTIFIER);
67 if( pInventorItem )
68 nInventor = static_cast<SdrInventor>(pInventorItem->GetValue());
69 if( pIdentifierItem )
70 nIdentifier = static_cast<SdrObjKind>(pIdentifierItem->GetValue());
71
75}
76
78{
79 bool bReturn = FuConstruct::MouseButtonDown(rMEvt);
80
81 if ( rMEvt.IsLeft() && !mpView->IsAction() )
82 {
83 Point aPnt( mpWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
84 mpWindow->CaptureMouse();
85 sal_uInt16 nDrgLog = sal_uInt16 ( mpWindow->PixelToLogic(Size(mpView->GetDragThresholdPixels(),0)).Width() );
86 mpView->BegCreateObj(aPnt, nullptr, nDrgLog);
87 bReturn = true;
88 }
89 return bReturn;
90}
91
93{
95 return false;
96
97 bool bReturn = false;
98
99 if ( mpView->IsCreateObj() && rMEvt.IsLeft() )
100 {
101 mpView->EndCreateObj(SdrCreateCmd::ForceEnd);
102 bReturn = true;
103 }
104
105 bReturn = (FuConstruct::MouseButtonUp(rMEvt) || bReturn);
106
107 if (!bPermanent)
108 mpViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SfxCallMode::ASYNCHRON);
109
110 return bReturn;
111}
112
114{
116
117 aNewPointer = PointerStyle::DrawRect;
118 aOldPointer = mpWindow->GetPointer();
119 mpWindow->SetPointer( aNewPointer );
120
123
125}
126
128{
131 mpWindow->SetPointer( aOldPointer );
132}
133
134rtl::Reference<SdrObject> FuConstructUnoControl::CreateDefaultObject(const sal_uInt16, const ::tools::Rectangle& rRectangle)
135{
136 // case SID_FM_CREATE_CONTROL:
137
142
143 if(pObj)
144 {
145 pObj->SetLogicRect(rRectangle);
146 }
147
148 return pObj;
149}
150
151} // end of namespace sd
152
153/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt32 GetValue() const
const Point & GetPosPixel() const
bool IsLeft() const
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)
sal_Int32 GetDragThresholdPixels() const
static rtl::Reference< SdrObject > MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
void SetActiveLayer(const OUString &rName)
SdrModel & getSdrModelFromSdrView() const
const OUString & GetActiveLayer() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const T * GetArg(sal_uInt16 nSlotId) const
SfxDispatcher * GetDispatcher()
FuConstructUnoControl(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fuconuno.cxx:40
static rtl::Reference< FuPoor > Create(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq, bool bPermanent)
Definition: fuconuno.cxx:52
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: fuconuno.cxx:77
virtual void Activate() override
activates the function
Definition: fuconuno.cxx:113
virtual void DoExecute(SfxRequest &rReq) override
Definition: fuconuno.cxx:61
virtual rtl::Reference< SdrObject > CreateDefaultObject(const sal_uInt16 nID, const ::tools::Rectangle &rRectangle) override
Definition: fuconuno.cxx:134
virtual void Deactivate() override
deactivates the function
Definition: fuconuno.cxx:127
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: fuconuno.cxx:92
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: fuconstr.cxx:128
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: fuconstr.cxx:64
virtual void Deactivate() override
deactivates the function
Definition: fuconstr.cxx:227
virtual void Activate() override
activates the function
Definition: fuconstr.cxx:221
bool IsIgnoreUnexpectedMouseButtonUp()
Definition: fuconstr.cxx:233
PointerStyle aNewPointer
Definition: fudraw.hxx:71
bool bPermanent
Definition: fudraw.hxx:76
void SetPermanent(bool bSet)
Definition: fudraw.hxx:52
PointerStyle aOldPointer
Definition: fudraw.hxx:72
VclPtr< ::sd::Window > mpWindow
Definition: fupoor.hxx:146
ViewShell * mpViewShell
Definition: fupoor.hxx:145
::sd::View * mpView
Definition: fupoor.hxx:144
virtual void DoExecute(SfxRequest &rReq)
Definition: fupoor.cxx:1129
static constexpr OUStringLiteral msDrawingObjectToolBar
std::shared_ptr< ToolBarManager > const & GetToolBarManager() const
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
Definition: viewshel.cxx:1397
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
NONE
Unknown
SdrInventor
SdrObjKind
constexpr OUStringLiteral sUNO_LayerName_controls
Definition: unokywds.hxx:32