Line data Source code
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 { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
28 :
29 : class ScDocument;
30 : class ScViewData;
31 : class ScDrawObjData;
32 : class SdrUndoManager;
33 :
34 : class ScDrawView: public FmFormView
35 : {
36 : ScViewData* pViewData;
37 : VclPtr<OutputDevice> pDev; //! needed ?
38 : ScDocument* pDoc;
39 : SCTAB nTab;
40 : Fraction aScaleX; // Factor for Drawing-MapMode
41 : Fraction aScaleY;
42 : SdrDropMarkerOverlay* pDropMarker;
43 : SdrObject* pDropMarkObj;
44 : bool bInConstruct;
45 :
46 : void Construct();
47 :
48 : protected:
49 : virtual void ModelHasChanged() SAL_OVERRIDE;
50 :
51 : // add custom handles (used by other apps, e.g. AnchorPos)
52 : virtual void AddCustomHdl() SAL_OVERRIDE;
53 :
54 : void ImplClearCalcDropMarker();
55 :
56 : // support enhanced text edit for draw objects
57 : virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const SAL_OVERRIDE;
58 :
59 : public:
60 : ScDrawView( OutputDevice* pOut, ScViewData* pData );
61 : virtual ~ScDrawView();
62 :
63 : virtual void MarkListHasChanged() SAL_OVERRIDE;
64 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
65 :
66 : virtual void DoConnect(SdrOle2Obj* pOleObj) SAL_OVERRIDE;
67 :
68 : virtual void MakeVisible( const Rectangle& rRect, vcl::Window& rWin ) SAL_OVERRIDE;
69 :
70 : virtual void DeleteMarked() SAL_OVERRIDE;
71 :
72 : virtual bool SdrBeginTextEdit(
73 : SdrObject* pObj,
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;
82 :
83 : virtual SdrEndTextEditKind SdrEndTextEdit( bool bDontDeleteReally = false ) SAL_OVERRIDE;
84 :
85 : void MarkDropObj( SdrObject* pObj );
86 :
87 : void SetMarkedToLayer( sal_uInt8 nLayerNo );
88 :
89 : void InvalidateAttribs();
90 : void InvalidateDrawTextAttrs();
91 :
92 : bool BeginDrag( vcl::Window* pWindow, const Point& rStartPos );
93 : void DoCut();
94 : void DoCopy();
95 :
96 : void GetScale( Fraction& rFractX, Fraction& rFractY ) const;
97 : void RecalcScale();
98 : void UpdateWorkArea();
99 844 : SCTAB GetTab() const { return nTab; }
100 :
101 : void CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const;
102 :
103 : void SetPageAnchored();
104 : void SetCellAnchored();
105 : ScAnchorType GetAnchorType() const;
106 :
107 : void UpdateIMap( SdrObject* pObj );
108 :
109 : sal_uInt16 GetPopupMenuId();
110 : void UpdateUserViewOptions();
111 :
112 : void SetMarkedOriginalSize();
113 :
114 : bool SelectObject( const OUString& rName );
115 : bool HasMarkedControl() const;
116 : bool HasMarkedInternal() const;
117 :
118 : bool InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE);
119 :
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 );
123 :
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 ); }
129 :
130 : /** Locks/unlocks the background layer that contains background objects.
131 : Unlocked layer is required to be able to edit the objects. */
132 3 : inline void LockBackgroundLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_BACK, bLock ); }
133 : /** Unlocks the background layer that contains background objects. */
134 0 : inline void UnlockBackgroundLayer() { LockBackgroundLayer( false ); }
135 :
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 3 : inline void LockInternalLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_INTERN, bLock ); }
139 : /** Unlocks the internal layer that contains caption objects of cell notes. */
140 0 : inline void UnlockInternalLayer() { LockInternalLayer( false ); }
141 :
142 : SdrEndTextEditKind ScEndTextEdit(); // calls SetDrawTextUndo(0)
143 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
144 :
145 : SdrObject* GetObjectByName(const OUString& rName);
146 : bool GetObjectIsMarked( SdrObject * pObject );
147 : bool SelectCurrentViewObject( const OUString& rName );
148 :
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);
158 :
159 : static void CheckOle( const SdrMarkList& rMarkList, bool& rAnyOle, bool& rOneOle );
160 : void SyncForGrid( SdrObject* pObj );
161 156 : };
162 :
163 : #endif
164 :
165 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|