Line data Source code
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 <svx/svdmark.hxx>
21 : #include <svx/svdview.hxx>
22 : #include <svx/svdopath.hxx>
23 :
24 : #include "view.hxx"
25 : #include "edtwin.hxx"
26 : #include "wrtsh.hxx"
27 : #include "drawbase.hxx"
28 : #include "conpoly.hxx"
29 : #include <basegfx/polygon/b2dpolygon.hxx>
30 :
31 0 : ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
32 0 : SwDrawBase(pWrtShell, pEditWin, pSwView)
33 : {
34 0 : }
35 :
36 0 : sal_Bool ConstPolygon::MouseButtonDown(const MouseEvent& rMEvt)
37 : {
38 : sal_Bool bReturn;
39 :
40 0 : if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == sal_True)
41 0 : aLastPos = rMEvt.GetPosPixel();
42 :
43 0 : return (bReturn);
44 : }
45 :
46 0 : sal_Bool ConstPolygon::MouseMove(const MouseEvent& rMEvt)
47 : {
48 0 : sal_Bool bReturn = SwDrawBase::MouseMove(rMEvt);
49 :
50 0 : return bReturn;
51 : }
52 :
53 0 : sal_Bool ConstPolygon::MouseButtonUp(const MouseEvent& rMEvt)
54 : {
55 0 : sal_Bool bReturn = sal_False;
56 :
57 0 : if (m_pSh->IsDrawCreate())
58 : {
59 0 : if (rMEvt.IsLeft() && rMEvt.GetClicks() == 1 &&
60 0 : m_pWin->GetSdrDrawMode() != OBJ_FREELINE)
61 : {
62 0 : if (!m_pSh->EndCreate(SDRCREATE_NEXTPOINT))
63 : {
64 0 : m_pSh->BreakCreate();
65 0 : EnterSelectMode(rMEvt);
66 0 : return sal_True;
67 : }
68 : }
69 : else
70 : {
71 0 : bReturn = SwDrawBase::MouseButtonUp(rMEvt);
72 :
73 : // #i85045# removed double mechanism to check for AutoClose polygon
74 : // after construction; the method here did not check for already closed and
75 : // also worked only for a single polygon. Removing.
76 : }
77 : }
78 : else
79 0 : bReturn = SwDrawBase::MouseButtonUp(rMEvt);
80 :
81 0 : return (bReturn);
82 : }
83 :
84 0 : void ConstPolygon::Activate(const sal_uInt16 nSlotId)
85 : {
86 0 : switch (nSlotId)
87 : {
88 : case SID_DRAW_POLYGON_NOFILL:
89 0 : m_pWin->SetSdrDrawMode(OBJ_PLIN);
90 0 : break;
91 :
92 : case SID_DRAW_BEZIER_NOFILL:
93 0 : m_pWin->SetSdrDrawMode(OBJ_PATHLINE);
94 0 : break;
95 :
96 : case SID_DRAW_FREELINE_NOFILL:
97 0 : m_pWin->SetSdrDrawMode(OBJ_FREELINE);
98 0 : break;
99 :
100 : default:
101 0 : break;
102 : }
103 :
104 0 : SwDrawBase::Activate(nSlotId);
105 0 : }
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|