summaryrefslogtreecommitdiff
path: root/sw/source/ui/ribbar/conform.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/ribbar/conform.cxx')
-rw-r--r--sw/source/ui/ribbar/conform.cxx144
1 files changed, 144 insertions, 0 deletions
diff --git a/sw/source/ui/ribbar/conform.cxx b/sw/source/ui/ribbar/conform.cxx
new file mode 100644
index 000000000000..9ab0e2efeda2
--- /dev/null
+++ b/sw/source/ui/ribbar/conform.cxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+
+#include <svx/fmglob.hxx>
+#include <svx/svdview.hxx>
+#include <svx/fmshell.hxx>
+
+#include "view.hxx"
+#include "edtwin.hxx"
+#include "wrtsh.hxx"
+#include "drawbase.hxx"
+#include "conform.hxx"
+
+extern sal_Bool bNoInterrupt; // in mainwn.cxx
+
+/*************************************************************************
+|*
+|* Konstruktor
+|*
+\************************************************************************/
+
+
+ConstFormControl::ConstFormControl(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView) :
+ SwDrawBase(pWrtShell, pEditWin, pSwView)
+{
+ m_bInsForm = sal_True;
+}
+
+/*************************************************************************
+|*
+|* MouseButtonDown-event
+|*
+\************************************************************************/
+
+
+sal_Bool ConstFormControl::MouseButtonDown(const MouseEvent& rMEvt)
+{
+ sal_Bool bReturn = sal_False;
+
+ SdrView *pSdrView = m_pSh->GetDrawView();
+
+ pSdrView->SetOrtho(rMEvt.IsShift());
+ pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());
+
+ if (rMEvt.IsMod2())
+ {
+ pSdrView->SetCreate1stPointAsCenter(sal_True);
+ pSdrView->SetResizeAtCenter(sal_True);
+ }
+ else
+ {
+ pSdrView->SetCreate1stPointAsCenter(sal_False);
+ pSdrView->SetResizeAtCenter(sal_False);
+ }
+
+ SdrViewEvent aVEvt;
+ SdrHitKind eHit = pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
+
+ // Nur neues Objekt, wenn nicht im Basismode (bzw reinem Selektionsmode)
+ if (rMEvt.IsLeft() && !m_pWin->IsDrawAction() &&
+ (eHit == SDRHIT_UNMARKEDOBJECT || eHit == SDRHIT_NONE || m_pSh->IsDrawCreate()))
+ {
+ bNoInterrupt = sal_True;
+ m_pWin->CaptureMouse();
+
+ m_pWin->SetPointer(Pointer(POINTER_DRAW_RECT));
+
+ m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
+ bReturn = m_pSh->BeginCreate( static_cast< sal_uInt16 >(m_pWin->GetSdrDrawMode()), FmFormInventor, m_aStartPos);
+
+ if (bReturn)
+ m_pWin->SetDrawAction(sal_True);
+ }
+ else
+ bReturn = SwDrawBase::MouseButtonDown(rMEvt);
+
+ return (bReturn);
+}
+
+/*************************************************************************
+|*
+|* Function aktivieren
+|*
+\************************************************************************/
+
+
+void ConstFormControl::Activate(const sal_uInt16 nSlotId)
+{
+ m_pWin->SetSdrDrawMode( static_cast<SdrObjKind>(nSlotId) );
+ SwDrawBase::Activate(nSlotId);
+ m_pSh->GetDrawView()->SetCurrentObj(nSlotId);
+
+ m_pWin->SetPointer(Pointer(POINTER_DRAW_RECT));
+}
+
+void ConstFormControl::CreateDefaultObject()
+{
+ Point aStartPos(GetDefaultCenterPos());
+ Point aEndPos(aStartPos);
+ aStartPos.X() -= 2 * MM50;
+ aStartPos.Y() -= MM50;
+ aEndPos.X() += 2 * MM50;
+ aEndPos.Y() += MM50;
+
+ if(!m_pSh->HasDrawView())
+ m_pSh->MakeDrawView();
+
+ SdrView *pSdrView = m_pSh->GetDrawView();
+ pSdrView->SetDesignMode(sal_True);
+ m_pSh->BeginCreate( static_cast< sal_uInt16 >(m_pWin->GetSdrDrawMode()), FmFormInventor, aStartPos);
+ m_pSh->MoveCreate(aEndPos);
+ m_pSh->EndCreate(SDRCREATE_FORCEEND);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */