LibreOffice Module editeng (master) 1
unoviwou.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 <vcl/outdev.hxx>
21#include <vcl/window.hxx>
22
23#include <editeng/unoviwou.hxx>
24#include <editeng/outliner.hxx>
25
27 mrOutlinerView ( rOutl )
28{
29}
30
32 mrOutlinerView ( rOutl ), maTextShapeTopLeft( rShapePosTopLeft )
33{
34}
35
37{
38}
39
41{
42 // calc text offset from shape anchor
44
45 return aOutputRect.TopLeft() - maTextShapeTopLeft;
46}
47
49{
50 return true;
51}
52
53Point SvxDrawOutlinerViewForwarder::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
54{
56
57 if( pOutDev )
58 {
59 Point aPoint1( rPoint );
60 Point aTextOffset( GetTextOffset() );
61
62 aPoint1.AdjustX(aTextOffset.X() );
63 aPoint1.AdjustY(aTextOffset.Y() );
64
65 MapMode aMapMode(pOutDev->GetMapMode());
66 Point aPoint2( OutputDevice::LogicToLogic( aPoint1, rMapMode,
67 MapMode(aMapMode.GetMapUnit())));
68 aMapMode.SetOrigin(Point());
69 return pOutDev->LogicToPixel( aPoint2, aMapMode );
70 }
71
72 return Point();
73}
74
75Point SvxDrawOutlinerViewForwarder::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
76{
78
79 if( pOutDev )
80 {
81 MapMode aMapMode(pOutDev->GetMapMode());
82 aMapMode.SetOrigin(Point());
83 Point aPoint1( pOutDev->PixelToLogic( rPoint, aMapMode ) );
84 Point aPoint2( OutputDevice::LogicToLogic( aPoint1,
85 MapMode(aMapMode.GetMapUnit()),
86 rMapMode ) );
87 Point aTextOffset( GetTextOffset() );
88
89 aPoint2.AdjustX( -(aTextOffset.X()) );
90 aPoint2.AdjustY( -(aTextOffset.Y()) );
91
92 return aPoint2;
93 }
94
95 return Point();
96}
97
99{
100 rSelection = mrOutlinerView.GetSelection();
101 return true;
102}
103
105{
106 mrOutlinerView.SetSelection( rSelection );
107 return true;
108}
109
111{
113 return true;
114}
115
117{
119 return true;
120}
121
123{
125 return true;
126}
127
128/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetOrigin(const Point &rOrigin)
MapUnit GetMapUnit() const
void SetSelection(const ESelection &)
Definition: outlvw.cxx:1198
void PasteSpecial()
Definition: outlvw.cxx:670
vcl::Window * GetWindow() const
Definition: outlvw.cxx:1238
tools::Rectangle const & GetOutputArea() const
Definition: outlvw.cxx:1248
ESelection GetSelection() const
Definition: outlvw.cxx:1297
void Cut()
Definition: outlvw.cxx:661
void Copy()
Definition: outlvw.cxx:1328
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
const MapMode & GetMapMode() const
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
virtual Point LogicToPixel(const Point &rPoint, const MapMode &rMapMode) const override
Convert from logical, EditEngine-relative coordinates to screen coordinates.
Definition: unoviwou.cxx:53
EDITENG_DLLPRIVATE Point GetTextOffset() const
Definition: unoviwou.cxx:40
virtual ~SvxDrawOutlinerViewForwarder() override
Definition: unoviwou.cxx:36
virtual bool SetSelection(const ESelection &rSelection) override
Set selection in view.
Definition: unoviwou.cxx:104
OutlinerView & mrOutlinerView
Definition: unoviwou.hxx:32
virtual bool IsValid() const override
Query state of forwarder.
Definition: unoviwou.cxx:48
virtual Point PixelToLogic(const Point &rPoint, const MapMode &rMapMode) const override
Convert from screen to logical, EditEngine-relative coordinates.
Definition: unoviwou.cxx:75
SvxDrawOutlinerViewForwarder(OutlinerView &rOutl)
Definition: unoviwou.cxx:26
virtual bool Copy() override
Copy current selection to clipboard.
Definition: unoviwou.cxx:110
virtual bool Cut() override
Cut current selection to clipboard.
Definition: unoviwou.cxx:116
virtual bool Paste() override
Paste clipboard into current selection.
Definition: unoviwou.cxx:122
virtual bool GetSelection(ESelection &rSelection) const override
Query current selection.
Definition: unoviwou.cxx:98
constexpr Point TopLeft() const
::OutputDevice const * GetOutDev() const