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 .
20 #ifndef INCLUDED_SC_SOURCE_UI_INC_DRAWVIEW_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_DRAWVIEW_HXX
23 #include <svx/fmview.hxx>
27 namespace com
{ namespace sun
{ namespace star
{ namespace datatransfer
{ class XTransferable
; } } } }
34 class ScDrawView
: public FmFormView
36 ScViewData
* pViewData
;
37 VclPtr
<OutputDevice
> pDev
; //! needed ?
40 Fraction aScaleX
; // Factor for Drawing-MapMode
42 SdrDropMarkerOverlay
* pDropMarker
;
43 SdrObject
* pDropMarkObj
;
49 virtual void ModelHasChanged() SAL_OVERRIDE
;
51 // add custom handles (used by other apps, e.g. AnchorPos)
52 virtual void AddCustomHdl() SAL_OVERRIDE
;
54 void ImplClearCalcDropMarker();
56 // support enhanced text edit for draw objects
57 virtual SdrUndoManager
* getSdrUndoManagerForEnhancedTextEdit() const SAL_OVERRIDE
;
60 ScDrawView( OutputDevice
* pOut
, ScViewData
* pData
);
61 virtual ~ScDrawView();
63 virtual void MarkListHasChanged() SAL_OVERRIDE
;
64 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
66 virtual void DoConnect(SdrOle2Obj
* pOleObj
) SAL_OVERRIDE
;
68 virtual void MakeVisible( const Rectangle
& rRect
, vcl::Window
& rWin
) SAL_OVERRIDE
;
70 virtual void DeleteMarked() SAL_OVERRIDE
;
72 virtual bool SdrBeginTextEdit(
74 SdrPageView
* pPV
= 0L,
75 vcl::Window
* pWin
= 0L,
76 bool bIsNewObj
= false,
77 SdrOutliner
* pGivenOutliner
= 0L,
78 OutlinerView
* pGivenOutlinerView
= 0L,
79 bool bDontDeleteOutliner
= false,
80 bool bOnlyOneView
= false,
81 bool bGrabFocus
= true) SAL_OVERRIDE
;
83 virtual SdrEndTextEditKind
SdrEndTextEdit( bool bDontDeleteReally
= false ) SAL_OVERRIDE
;
85 void MarkDropObj( SdrObject
* pObj
);
87 void SetMarkedToLayer( sal_uInt8 nLayerNo
);
89 void InvalidateAttribs();
90 void InvalidateDrawTextAttrs();
92 bool BeginDrag( vcl::Window
* pWindow
, const Point
& rStartPos
);
96 void GetScale( Fraction
& rFractX
, Fraction
& rFractY
) const;
98 void UpdateWorkArea();
99 SCTAB
GetTab() const { return nTab
; }
101 void CalcNormScale( Fraction
& rFractX
, Fraction
& rFractY
) const;
103 void SetPageAnchored();
104 void SetCellAnchored();
105 ScAnchorType
GetAnchorType() const;
107 void UpdateIMap( SdrObject
* pObj
);
109 sal_uInt16
GetPopupMenuId();
110 void UpdateUserViewOptions();
112 void SetMarkedOriginalSize();
114 bool SelectObject( const OUString
& rName
);
115 bool HasMarkedControl() const;
116 bool HasMarkedInternal() const;
118 bool InsertObjectSafe(SdrObject
* pObj
, SdrPageView
& rPV
, SdrInsertFlags nOptions
=SdrInsertFlags::NONE
);
120 /** Returns the selected object, if it is the caption object of a cell note.
121 @param ppCaptData (out-param) If not null, returns the pointer to the caption object data. */
122 SdrObject
* GetMarkedNoteCaption( ScDrawObjData
** ppCaptData
= 0 );
124 /** Locks/unlocks the specified layer in the draw page.
125 Unlocked layer is required to be able to edit the contained objects. */
126 void LockCalcLayer( SdrLayerID nLayer
, bool bLock
= true );
127 /** Unlocks the specified layer in the draw page. */
128 inline void UnlockCalcLayer( SdrLayerID nLayer
) { LockCalcLayer( nLayer
, false ); }
130 /** Locks/unlocks the background layer that contains background objects.
131 Unlocked layer is required to be able to edit the objects. */
132 inline void LockBackgroundLayer( bool bLock
= true ) { LockCalcLayer( SC_LAYER_BACK
, bLock
); }
133 /** Unlocks the background layer that contains background objects. */
134 inline void UnlockBackgroundLayer() { LockBackgroundLayer( false ); }
136 /** Locks/unlocks the internal layer that contains caption objects of cell notes.
137 Unlocked layer is required to be able to edit the contained objects. */
138 inline void LockInternalLayer( bool bLock
= true ) { LockCalcLayer( SC_LAYER_INTERN
, bLock
); }
139 /** Unlocks the internal layer that contains caption objects of cell notes. */
140 inline void UnlockInternalLayer() { LockInternalLayer( false ); }
142 SdrEndTextEditKind
ScEndTextEdit(); // calls SetDrawTextUndo(0)
143 ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
> CopyToTransferable();
145 SdrObject
* GetObjectByName(const OUString
& rName
);
146 bool GetObjectIsMarked( SdrObject
* pObject
);
147 bool SelectCurrentViewObject( const OUString
& rName
);
149 // #i123922# helper which checks if a Graphic may be appied to an existing
150 // SdrObject; if it's a SdrGrafObj the fill will be replaced. If it's a
151 // fillable, non-OLE SdrObject, the FillStyle will be adapted
152 SdrObject
* ApplyGraphicToObject(
153 SdrObject
& rHitObject
,
154 const Graphic
& rGraphic
,
155 const OUString
& rBeginUndoText
,
156 const OUString
& rFile
,
157 const OUString
& rFilter
);
159 static void CheckOle( const SdrMarkList
& rMarkList
, bool& rAnyOle
, bool& rOneOle
);
160 void SyncForGrid( SdrObject
* pObj
);
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */