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 #ifndef INCLUDED_SC_SOURCE_UI_INC_DRAWVIEW_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_DRAWVIEW_HXX
22 
23 #include <svx/fmview.hxx>
24 
25 #include <global.hxx>
26 
27 namespace com::sun::star::datatransfer { class XTransferable; }
28 
29 class ScDocument;
30 class ScViewData;
31 class ScDrawObjData;
32 class SdrUndoManager;
33 
34 class ScDrawView final : public FmFormView
35 {
40  Fraction aScaleX; // Factor for Drawing-MapMode
42  std::unique_ptr<SdrDropMarkerOverlay> pDropMarker;
45 
46  void Construct();
47 
48  virtual void ModelHasChanged() override;
49 
50  // add custom handles (used by other apps, e.g. AnchorPos)
51  virtual void AddCustomHdl() override;
52 
54 
55  // support enhanced text edit for draw objects
56  virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const override;
57 
58 public:
59  ScDrawView(
60  OutputDevice* pOut,
61  ScViewData* pData);
62 
63  virtual ~ScDrawView() override;
64 
65  virtual void MarkListHasChanged() override;
66  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
67 
68  virtual void DoConnect(SdrOle2Obj* pOleObj) override;
69 
70  virtual void MakeVisible( const tools::Rectangle& rRect, vcl::Window& rWin ) override;
71 
72  virtual void DeleteMarked() override;
73 
74  virtual bool SdrBeginTextEdit(
75  SdrObject* pObj,
76  SdrPageView* pPV = nullptr,
77  vcl::Window* pWin = nullptr,
78  bool bIsNewObj = false,
79  SdrOutliner* pGivenOutliner = nullptr,
80  OutlinerView* pGivenOutlinerView = nullptr,
81  bool bDontDeleteOutliner = false,
82  bool bOnlyOneView = false,
83  bool bGrabFocus = true) override;
84 
85  virtual SdrEndTextEditKind SdrEndTextEdit( bool bDontDeleteReally = false ) override;
86 
87  void MarkDropObj( SdrObject* pObj );
88 
89  void SetMarkedToLayer( SdrLayerID nLayerNo );
90 
91  void InvalidateAttribs();
93 
94  void BeginDrag( vcl::Window* pWindow, const Point& rStartPos );
95  void DoCut();
96  void DoCopy();
97 
98  void GetScale( Fraction& rFractX, Fraction& rFractY ) const;
99  void RecalcScale();
100  void UpdateWorkArea();
101  SCTAB GetTab() const { return nTab; }
102 
103  void CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const;
104 
105  void SetPageAnchored();
106  void SetCellAnchored(bool bResizeWithCell);
107  ScAnchorType GetAnchorType() const;
108 
109  void UpdateIMap( SdrObject* pObj );
110 
111  void UpdateUserViewOptions();
112 
113  void SetMarkedOriginalSize();
114  void FitToCellSize();
115 
116  bool SelectObject( const OUString& rName );
117  bool HasMarkedControl() const;
118  bool HasMarkedInternal() const;
119 
120  bool InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV);
121 
125 
128  void LockCalcLayer( SdrLayerID nLayer, bool bLock );
129 
132  void LockBackgroundLayer( bool bLock ) { LockCalcLayer( SC_LAYER_BACK, bLock ); }
133 
136  void LockInternalLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_INTERN, bLock ); }
139 
140  SdrEndTextEditKind ScEndTextEdit(); // calls SetDrawTextUndo(0)
141  css::uno::Reference< css::datatransfer::XTransferable > CopyToTransferable();
142 
143  SdrObject* GetObjectByName(const OUString& rName);
144  bool GetObjectIsMarked( const SdrObject * pObject );
145  void SelectCurrentViewObject( const OUString& rName );
146 
147  // #i123922# helper which checks if a Graphic may be applied to an existing
148  // SdrObject; if it's a SdrGrafObj the fill will be replaced. If it's a
149  // fillable, non-OLE SdrObject, the FillStyle will be adapted
151  SdrObject& rHitObject,
152  const Graphic& rGraphic,
153  const OUString& rBeginUndoText,
154  const OUString& rFile,
155  const OUString& rFilter);
156 
157  static void CheckOle( const SdrMarkList& rMarkList, bool& rAnyOle, bool& rOneOle );
158 
159  void SyncForGrid( SdrObject* pObj );
160 
162  SdrObject& rSdrObject,
163  basegfx::B2DVector& rTarget) const;
165  const basegfx::B2DRange& rB2DRange,
166  basegfx::B2DVector& rTarget) const;
168 
170  SfxViewShell* GetSfxViewShell() const override;
171 
172  // Do not create ObjectContact locally, but offer a call to allow override
173  // and to create own derivations of ObjectContact
175  SdrPageWindow& rPageWindow,
176  const char* pDebugName) const override;
177 };
178 
179 extern Point aDragStartDiff;
180 
181 #endif
182 
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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:541
void UpdateUserViewOptions()
Definition: drawview.cxx:624
virtual ~ScDrawView() override
Definition: drawview.cxx:131
void ImplClearCalcDropMarker()
Definition: drawview.cxx:126
Fraction aScaleX
Definition: drawview.hxx:40
void UpdateIMap(SdrObject *pObj)
Definition: drawvie3.cxx:202
SdrObject * GetObjectByName(const OUString &rName)
Definition: drawview.cxx:648
void CalcNormScale(Fraction &rFractX, Fraction &rFractY) const
Definition: drawvie4.cxx:411
SdrEndTextEditKind
void InvalidateAttribs()
Definition: drawview.cxx:151
void LockInternalLayer(bool bLock=true)
Locks/unlocks the internal layer that contains caption objects of cell notes.
Definition: drawview.hxx:136
bool HasMarkedInternal() const
Definition: drawview.cxx:251
constexpr SdrLayerID SC_LAYER_BACK(1)
virtual void AddCustomHdl() override
Definition: drawview.cxx:136
ScViewData * pViewData
Definition: drawview.hxx:36
bool HasMarkedControl() const
Definition: drawview.cxx:242
void resetGridOffsetsForAllSdrPageViews()
Definition: drawview.cxx:972
void SelectCurrentViewObject(const OUString &rName)
Definition: drawview.cxx:679
void LockBackgroundLayer(bool bLock)
Locks/unlocks the background layer that contains background objects.
Definition: drawview.hxx:132
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: drawvie3.cxx:175
virtual void DeleteMarked() override
Definition: drawview.cxx:854
Point aDragStartDiff
Definition: drawvie4.cxx:55
void LockCalcLayer(SdrLayerID nLayer, bool bLock)
Locks/unlocks the specified layer in the draw page.
Definition: drawview.cxx:833
Fraction aScaleY
Definition: drawview.hxx:41
void BeginDrag(vcl::Window *pWindow, const Point &rStartPos)
Definition: drawvie4.cxx:57
void GetScale(Fraction &rFractX, Fraction &rFractY) const
Definition: drawview.cxx:290
void MarkDropObj(SdrObject *pObj)
Definition: drawview.cxx:903
void UpdateWorkArea()
Definition: drawview.cxx:261
void SyncForGrid(SdrObject *pObj)
Definition: drawview.cxx:923
ScAnchorType
Definition: global.hxx:382
virtual void MarkListHasChanged() override
Definition: drawview.cxx:356
void Construct()
Definition: drawview.cxx:69
bool calculateGridOffsetForB2DRange(const basegfx::B2DRange &rB2DRange, basegfx::B2DVector &rTarget) const
Definition: drawview.cxx:1058
virtual SdrUndoManager * getSdrUndoManagerForEnhancedTextEdit() const override
Definition: drawview.cxx:1107
static void CheckOle(const SdrMarkList &rMarkList, bool &rAnyOle, bool &rOneOle)
Definition: drawvie4.cxx:327
void SetCellAnchored(bool bResizeWithCell)
Definition: drawvie3.cxx:83
void SetMarkedToLayer(SdrLayerID nLayerNo)
Definition: drawview.cxx:210
void InvalidateDrawTextAttrs()
Definition: drawview.cxx:160
SfxViewShell * GetSfxViewShell() const override
See SdrMarkView::GetSfxViewShell().
Definition: drawview.cxx:849
void RecalcScale()
Definition: drawview.cxx:296
ScDrawView(OutputDevice *pOut, ScViewData *pData)
Definition: drawvie3.cxx:36
SCTAB GetTab() const
Definition: drawview.hxx:101
void SetPageAnchored()
Definition: drawvie3.cxx:58
virtual void DoConnect(SdrOle2Obj *pOleObj) override
Definition: drawview.cxx:350
void DoCut()
Definition: drawview.cxx:282
bool SelectObject(const OUString &rName)
Definition: drawview.cxx:730
bool InsertObjectSafe(SdrObject *pObj, SdrPageView &rPV)
Definition: drawview.cxx:802
SdrObject * pDropMarkObj
Definition: drawview.hxx:43
void UnlockInternalLayer()
Unlocks the internal layer that contains caption objects of cell notes.
Definition: drawview.hxx:138
virtual void ModelHasChanged() override
Definition: drawview.cxx:610
void SetMarkedOriginalSize()
Definition: drawvie4.cxx:432
virtual SdrEndTextEditKind SdrEndTextEdit(bool bDontDeleteReally=false) override
Definition: drawview.cxx:586
ScAnchorType GetAnchorType() const
Definition: drawvie3.cxx:109
VclPtr< OutputDevice > pDev
Definition: drawview.hxx:37
std::unique_ptr< SdrDropMarkerOverlay > pDropMarker
Definition: drawview.hxx:42
SdrObject * GetMarkedNoteCaption(ScDrawObjData **ppCaptData)
Returns the selected object, if it is the caption object of a cell note.
Definition: drawview.cxx:818
constexpr SdrLayerID SC_LAYER_INTERN(2)
SdrObject * ApplyGraphicToObject(SdrObject &rHitObject, const Graphic &rGraphic, const OUString &rBeginUndoText, const OUString &rFile, const OUString &rFilter)
Definition: drawview.cxx:1113
ScDocument & rDoc
needed ?
Definition: drawview.hxx:38
SdrEndTextEditKind ScEndTextEdit()
Definition: drawview.cxx:892
css::uno::Reference< css::datatransfer::XTransferable > CopyToTransferable()
Definition: drawvie4.cxx:374
virtual sdr::contact::ObjectContact * createViewSpecificObjectContact(SdrPageWindow &rPageWindow, const char *pDebugName) const override
Definition: drawview.cxx:1242
void DoCopy()
Definition: drawvie4.cxx:332
bool bInConstruct
Definition: drawview.hxx:44
virtual void MakeVisible(const tools::Rectangle &rRect, vcl::Window &rWin) override
Definition: drawview.cxx:840
void FitToCellSize()
Definition: drawvie4.cxx:524
bool calculateGridOffsetForSdrObject(SdrObject &rSdrObject, basegfx::B2DVector &rTarget) const
Definition: drawview.cxx:996
bool GetObjectIsMarked(const SdrObject *pObject)
Definition: drawview.cxx:792
sal_Int16 SCTAB
Definition: types.hxx:23
SCTAB nTab
Definition: drawview.hxx:39