LibreOffice Module sc (master) 1
drawview.hxx
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#pragma once
21
22#include <svx/fmview.hxx>
23
24#include <global.hxx>
25
26namespace com::sun::star::datatransfer { class XTransferable; }
27
28class ScDocument;
29class ScViewData;
30class ScDrawObjData;
31class SdrUndoManager;
32
33class ScDrawView final : public FmFormView
34{
39 Fraction aScaleX; // Factor for Drawing-MapMode
41 std::unique_ptr<SdrDropMarkerOverlay> pDropMarker;
44
45 void Construct();
46
47 virtual void ModelHasChanged() override;
48
49 // add custom handles (used by other apps, e.g. AnchorPos)
50 virtual void AddCustomHdl() override;
51
53
54 // Create a local UndoManager
55 std::unique_ptr<SdrUndoManager> createLocalTextUndoManager() override;
56
57public:
59 OutputDevice* pOut,
60 ScViewData* pData);
61
62 virtual ~ScDrawView() override;
63
64 virtual void MarkListHasChanged() override;
65 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
66
67 virtual void DoConnect(SdrOle2Obj* pOleObj) override;
68
69 virtual void MakeVisible( const tools::Rectangle& rRect, vcl::Window& rWin ) override;
70
71 virtual void DeleteMarked() override;
72
73 virtual bool SdrBeginTextEdit(
74 SdrObject* pObj,
75 SdrPageView* pPV = nullptr,
76 vcl::Window* pWin = nullptr,
77 bool bIsNewObj = false,
78 SdrOutliner* pGivenOutliner = nullptr,
79 OutlinerView* pGivenOutlinerView = nullptr,
80 bool bDontDeleteOutliner = false,
81 bool bOnlyOneView = false,
82 bool bGrabFocus = true) override;
83
84 virtual SdrEndTextEditKind SdrEndTextEdit( bool bDontDeleteReally = false ) override;
85
86 void MarkDropObj( SdrObject* pObj );
87
88 void SetMarkedToLayer( SdrLayerID nLayerNo );
89
90 void InvalidateAttribs();
92
93 void BeginDrag( vcl::Window* pWindow, const Point& rStartPos );
94 void DoCut();
95 void DoCopy();
96
97 void GetScale( Fraction& rFractX, Fraction& rFractY ) const;
98 void RecalcScale();
99 void UpdateWorkArea();
100 SCTAB GetTab() const { return nTab; }
101
102 void CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const;
103
104 void SetPageAnchored();
105 void SetCellAnchored(bool bResizeWithCell);
107
108 void UpdateIMap( SdrObject* pObj );
109
111
113 void FitToCellSize();
114
115 bool SelectObject( std::u16string_view rName );
116 bool HasMarkedControl() const;
117 bool HasMarkedInternal() const;
118
119 bool InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV);
120
124
127 void LockCalcLayer( SdrLayerID nLayer, bool bLock );
128
131 void LockBackgroundLayer( bool bLock ) { LockCalcLayer( SC_LAYER_BACK, bLock ); }
132
135 void LockInternalLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_INTERN, bLock ); }
138
139 SdrEndTextEditKind ScEndTextEdit(); // calls SetDrawTextUndo(0)
140 css::uno::Reference< css::datatransfer::XTransferable > CopyToTransferable();
141
142 SdrObject* GetObjectByName(std::u16string_view rName);
143 bool GetObjectIsMarked( const SdrObject * pObject );
144 void SelectCurrentViewObject( std::u16string_view rName );
145
146 // #i123922# helper which checks if a Graphic may be applied to an existing
147 // SdrObject; if it's a SdrGrafObj the fill will be replaced. If it's a
148 // fillable, non-OLE SdrObject, the FillStyle will be adapted
150 SdrObject& rHitObject,
151 const Graphic& rGraphic,
152 const OUString& rBeginUndoText,
153 const OUString& rFile);
154
155 static void CheckOle( const SdrMarkList& rMarkList, bool& rAnyOle, bool& rOneOle );
156
157 void SyncForGrid( SdrObject* pObj );
158
160 SdrObject& rSdrObject,
161 basegfx::B2DVector& rTarget) const;
163 const basegfx::B2DRange& rB2DRange,
164 basegfx::B2DVector& rTarget) const;
166
168 SfxViewShell* GetSfxViewShell() const override;
169
170 // Do not create ObjectContact locally, but offer a call to allow override
171 // and to create own derivations of ObjectContact
173 SdrPageWindow& rPageWindow,
174 const char* pDebugName) const override;
175};
176
177extern Point aDragStartDiff;
178
179/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrObject * ApplyGraphicToObject(SdrObject &rHitObject, const Graphic &rGraphic, const OUString &rBeginUndoText, const OUString &rFile)
Definition: drawview.cxx:1117
void SyncForGrid(SdrObject *pObj)
Definition: drawview.cxx:918
virtual bool SdrBeginTextEdit(SdrObject *pObj, SdrPageView *pPV=nullptr, vcl::Window *pWin=nullptr, bool bIsNewObj=false, SdrOutliner *pGivenOutliner=nullptr, OutlinerView *pGivenOutlinerView=nullptr, bool bDontDeleteOutliner=false, bool bOnlyOneView=false, bool bGrabFocus=true) override
Definition: drawview.cxx:540
ScViewData * pViewData
Definition: drawview.hxx:35
void SetCellAnchored(bool bResizeWithCell)
Definition: drawvie3.cxx:90
std::unique_ptr< SdrDropMarkerOverlay > pDropMarker
Definition: drawview.hxx:41
bool calculateGridOffsetForB2DRange(const basegfx::B2DRange &rB2DRange, basegfx::B2DVector &rTarget) const
Definition: drawview.cxx:1056
void RecalcScale()
Definition: drawview.cxx:298
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:887
void CalcNormScale(Fraction &rFractX, Fraction &rFractY) const
Definition: drawvie4.cxx:411
SfxViewShell * GetSfxViewShell() const override
See SdrMarkView::GetSfxViewShell().
Definition: drawview.cxx:844
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: drawvie3.cxx:202
void LockInternalLayer(bool bLock=true)
Locks/unlocks the internal layer that contains caption objects of cell notes.
Definition: drawview.hxx:135
void ImplClearCalcDropMarker()
Definition: drawview.cxx:128
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
Definition: drawview.cxx:584
virtual void DeleteMarked() override
Definition: drawview.cxx:849
virtual void ModelHasChanged() override
Definition: drawview.cxx:605
void BeginDrag(vcl::Window *pWindow, const Point &rStartPos)
Definition: drawvie4.cxx:59
bool calculateGridOffsetForSdrObject(SdrObject &rSdrObject, basegfx::B2DVector &rTarget) const
Definition: drawview.cxx:991
void UpdateIMap(SdrObject *pObj)
Definition: drawvie3.cxx:229
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
Definition: drawview.cxx:835
void UnlockInternalLayer()
Unlocks the internal layer that contains caption objects of cell notes.
Definition: drawview.hxx:137
void InvalidateDrawTextAttrs()
Definition: drawview.cxx:162
Fraction aScaleX
Definition: drawview.hxx:39
ScDrawView(OutputDevice *pOut, ScViewData *pData)
Definition: drawvie3.cxx:42
bool SelectObject(std::u16string_view rName)
Definition: drawview.cxx:725
std::unique_ptr< SdrUndoManager > createLocalTextUndoManager() override
Definition: drawview.cxx:1108
void LockCalcLayer(SdrLayerID nLayer, bool bLock)
Locks/unlocks the specified layer in the draw page.
Definition: drawview.cxx:828
void Construct()
Definition: drawview.cxx:71
bool InsertObjectSafe(SdrObject *pObj, SdrPageView &rPV)
Definition: drawview.cxx:797
css::uno::Reference< css::datatransfer::XTransferable > CopyToTransferable()
Definition: drawvie4.cxx:375
void SetMarkedToLayer(SdrLayerID nLayerNo)
Definition: drawview.cxx:212
void SelectCurrentViewObject(std::u16string_view rName)
Definition: drawview.cxx:674
void DoCopy()
Definition: drawvie4.cxx:333
void MarkDropObj(SdrObject *pObj)
Definition: drawview.cxx:898
SCTAB nTab
Definition: drawview.hxx:38
static void CheckOle(const SdrMarkList &rMarkList, bool &rAnyOle, bool &rOneOle)
Definition: drawvie4.cxx:328
ScDocument & rDoc
needed ?
Definition: drawview.hxx:37
void GetScale(Fraction &rFractX, Fraction &rFractY) const
Definition: drawview.cxx:292
VclPtr< OutputDevice > pDev
Definition: drawview.hxx:36
bool HasMarkedInternal() const
Definition: drawview.cxx:253
bool bInConstruct
Definition: drawview.hxx:43
void SetPageAnchored()
Definition: drawvie3.cxx:65
void resetGridOffsetsForAllSdrPageViews()
Definition: drawview.cxx:967
virtual sdr::contact::ObjectContact * createViewSpecificObjectContact(SdrPageWindow &rPageWindow, const char *pDebugName) const override
Definition: drawview.cxx:1245
bool HasMarkedControl() const
Definition: drawview.cxx:244
void LockBackgroundLayer(bool bLock)
Locks/unlocks the background layer that contains background objects.
Definition: drawview.hxx:131
void UpdateWorkArea()
Definition: drawview.cxx:263
void UpdateUserViewOptions()
Definition: drawview.cxx:619
void InvalidateAttribs()
Definition: drawview.cxx:153
virtual void DoConnect(SdrOle2Obj *pOleObj) override
Definition: drawview.cxx:352
virtual void MarkListHasChanged() override
Definition: drawview.cxx:358
SdrObject * pDropMarkObj
Definition: drawview.hxx:42
virtual void AddCustomHdl() override
Definition: drawview.cxx:138
void SetMarkedOriginalSize()
Definition: drawvie4.cxx:432
SCTAB GetTab() const
Definition: drawview.hxx:100
SdrObject * GetObjectByName(std::u16string_view rName)
Definition: drawview.cxx:643
virtual ~ScDrawView() override
Definition: drawview.cxx:133
ScAnchorType GetAnchorType() const
Definition: drawvie3.cxx:116
Fraction aScaleY
Definition: drawview.hxx:40
void DoCut()
Definition: drawview.cxx:284
SdrObject * GetMarkedNoteCaption(ScDrawObjData **ppCaptData)
Returns the selected object, if it is the caption object of a cell note.
Definition: drawview.cxx:813
bool GetObjectIsMarked(const SdrObject *pObject)
Definition: drawview.cxx:787
void FitToCellSize()
Definition: drawvie4.cxx:515
Point aDragStartDiff
Definition: drawvie4.cxx:57
ScAnchorType
Definition: global.hxx:374
constexpr SdrLayerID SC_LAYER_INTERN(2)
constexpr SdrLayerID SC_LAYER_BACK(1)
SdrEndTextEditKind
sal_Int16 SCTAB
Definition: types.hxx:22