1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <svx/fmview.hxx>
26 namespace com::sun::star::datatransfer
{ class XTransferable
; }
33 class ScDrawView final
: public FmFormView
35 ScViewData
* pViewData
;
36 VclPtr
<OutputDevice
> pDev
; //! needed ?
39 Fraction aScaleX
; // Factor for Drawing-MapMode
41 std::unique_ptr
<SdrDropMarkerOverlay
> pDropMarker
;
42 SdrObject
* pDropMarkObj
;
47 virtual void ModelHasChanged() override
;
49 // add custom handles (used by other apps, e.g. AnchorPos)
50 virtual void AddCustomHdl() override
;
52 void ImplClearCalcDropMarker();
54 // Create a local UndoManager
55 std::unique_ptr
<SdrUndoManager
> createLocalTextUndoManager() override
;
62 virtual ~ScDrawView() override
;
64 virtual void MarkListHasChanged() override
;
65 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
67 virtual void DoConnect(SdrOle2Obj
* pOleObj
) override
;
69 virtual void MakeVisible( const tools::Rectangle
& rRect
, vcl::Window
& rWin
) override
;
71 virtual void DeleteMarked() override
;
73 virtual bool SdrBeginTextEdit(
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
;
84 virtual SdrEndTextEditKind
SdrEndTextEdit( bool bDontDeleteReally
= false ) override
;
86 void MarkDropObj( SdrObject
* pObj
);
88 void SetMarkedToLayer( SdrLayerID nLayerNo
);
90 void InvalidateAttribs();
91 void InvalidateDrawTextAttrs();
93 void BeginDrag( vcl::Window
* pWindow
, const Point
& rStartPos
);
97 void GetScale( Fraction
& rFractX
, Fraction
& rFractY
) const;
99 void UpdateWorkArea();
100 SCTAB
GetTab() const { return nTab
; }
102 void CalcNormScale( Fraction
& rFractX
, Fraction
& rFractY
) const;
104 void SetPageAnchored();
105 void SetCellAnchored(bool bResizeWithCell
);
106 ScAnchorType
GetAnchorType() const;
108 void UpdateIMap( SdrObject
* pObj
);
110 void UpdateUserViewOptions();
112 void SetMarkedOriginalSize();
113 void FitToCellSize();
115 bool SelectObject( std::u16string_view rName
);
116 bool HasMarkedControl() const;
117 bool HasMarkedInternal() const;
119 bool InsertObjectSafe(SdrObject
* pObj
, SdrPageView
& rPV
);
121 /** Returns the selected object, if it is the caption object of a cell note.
122 @param ppCaptData (out-param) If not null, returns the pointer to the caption object data. */
123 SdrObject
* GetMarkedNoteCaption( ScDrawObjData
** ppCaptData
);
125 /** Locks/unlocks the specified layer in the draw page.
126 Unlocked layer is required to be able to edit the contained objects. */
127 void LockCalcLayer( SdrLayerID nLayer
, bool bLock
);
129 /** Locks/unlocks the background layer that contains background objects.
130 Unlocked layer is required to be able to edit the objects. */
131 void LockBackgroundLayer( bool bLock
) { LockCalcLayer( SC_LAYER_BACK
, bLock
); }
133 /** Locks/unlocks the internal layer that contains caption objects of cell notes.
134 Unlocked layer is required to be able to edit the contained objects. */
135 void LockInternalLayer( bool bLock
= true ) { LockCalcLayer( SC_LAYER_INTERN
, bLock
); }
136 /** Unlocks the internal layer that contains caption objects of cell notes. */
137 void UnlockInternalLayer() { LockInternalLayer( false ); }
139 SdrEndTextEditKind
ScEndTextEdit(); // calls SetDrawTextUndo(0)
140 css::uno::Reference
< css::datatransfer::XTransferable
> CopyToTransferable();
142 SdrObject
* GetObjectByName(std::u16string_view rName
);
143 bool GetObjectIsMarked( const SdrObject
* pObject
);
144 void SelectCurrentViewObject( std::u16string_view rName
);
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
149 SdrObject
* ApplyGraphicToObject(
150 SdrObject
& rHitObject
,
151 const Graphic
& rGraphic
,
152 const OUString
& rBeginUndoText
,
153 const OUString
& rFile
);
155 static void CheckOle( const SdrMarkList
& rMarkList
, bool& rAnyOle
, bool& rOneOle
);
157 void SyncForGrid( SdrObject
* pObj
);
159 bool calculateGridOffsetForSdrObject(
160 SdrObject
& rSdrObject
,
161 basegfx::B2DVector
& rTarget
) const;
162 bool calculateGridOffsetForB2DRange(
163 const basegfx::B2DRange
& rB2DRange
,
164 basegfx::B2DVector
& rTarget
) const;
165 void resetGridOffsetsForAllSdrPageViews();
167 /// See SdrMarkView::GetSfxViewShell().
168 SfxViewShell
* GetSfxViewShell() const override
;
170 // Do not create ObjectContact locally, but offer a call to allow override
171 // and to create own derivations of ObjectContact
172 virtual sdr::contact::ObjectContact
* createViewSpecificObjectContact(
173 SdrPageWindow
& rPageWindow
,
174 const char* pDebugName
) const override
;
177 extern Point aDragStartDiff
;
179 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */