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 SC_DRAWVIEW_HXX
21 : #define SC_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 : 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 : void UpdateBrowser();
48 :
49 : protected:
50 : virtual void ModelHasChanged() SAL_OVERRIDE;
51 :
52 : // add custom handles (used by other apps, e.g. AnchorPos)
53 : virtual void AddCustomHdl() SAL_OVERRIDE;
54 :
55 : void ImplClearCalcDropMarker();
56 :
57 : // support enhanced text edit for draw objects
58 : virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const SAL_OVERRIDE;
59 :
60 : public:
61 : ScDrawView( OutputDevice* pOut, ScViewData* pData );
62 : virtual ~ScDrawView();
63 :
64 : virtual void MarkListHasChanged() SAL_OVERRIDE;
65 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
66 :
67 : virtual void DoConnect(SdrOle2Obj* pOleObj) SAL_OVERRIDE;
68 :
69 : virtual void MakeVisible( const Rectangle& rRect, Window& rWin ) SAL_OVERRIDE;
70 :
71 : virtual void DeleteMarked() SAL_OVERRIDE;
72 :
73 : virtual bool SdrBeginTextEdit(
74 : SdrObject* pObj,
75 : SdrPageView* pPV = 0L,
76 : ::Window* pWin = 0L,
77 : bool bIsNewObj = false,
78 : SdrOutliner* pGivenOutliner = 0L,
79 : OutlinerView* pGivenOutlinerView = 0L,
80 : bool bDontDeleteOutliner = false,
81 : bool bOnlyOneView = false,
82 : bool bGrabFocus = true) SAL_OVERRIDE;
83 :
84 : virtual SdrEndTextEditKind SdrEndTextEdit( bool bDontDeleteReally = false ) SAL_OVERRIDE;
85 :
86 : void MarkDropObj( SdrObject* pObj );
87 :
88 : void SetMarkedToLayer( sal_uInt8 nLayerNo );
89 :
90 : void InvalidateAttribs();
91 : void InvalidateDrawTextAttrs();
92 :
93 : bool BeginDrag( 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 0 : SCTAB GetTab() const { return nTab; }
101 :
102 : void CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const;
103 :
104 : void SetPageAnchored();
105 : void SetCellAnchored();
106 : ScAnchorType GetAnchorType() const;
107 :
108 : void VCAddWin( Window* pWin );
109 : void VCRemoveWin( Window* pWin );
110 :
111 : void UpdateIMap( SdrObject* pObj );
112 :
113 : sal_uInt16 GetPopupMenuId();
114 : void UpdateUserViewOptions();
115 :
116 : void SetMarkedOriginalSize();
117 :
118 : bool SelectObject( const OUString& rName );
119 : bool HasMarkedControl() const;
120 : bool HasMarkedInternal() const;
121 :
122 : bool InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, sal_uLong nOptions=0);
123 :
124 : /** Returns the selected object, if it is the caption object of a cell note.
125 : @param ppCaptData (out-param) If not null, returns the pointer to the caption object data. */
126 : SdrObject* GetMarkedNoteCaption( ScDrawObjData** ppCaptData = 0 );
127 :
128 : /** Locks/unlocks the specified layer in the draw page.
129 : Unlocked layer is required to be able to edit the contained objects. */
130 : void LockCalcLayer( SdrLayerID nLayer, bool bLock = true );
131 : /** Unlocks the specified layer in the draw page. */
132 : inline void UnlockCalcLayer( SdrLayerID nLayer ) { LockCalcLayer( nLayer, false ); }
133 :
134 : /** Locks/unlocks the background layer that contains background objects.
135 : Unlocked layer is required to be able to edit the objects. */
136 0 : inline void LockBackgroundLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_BACK, bLock ); }
137 : /** Unlocks the background layer that contains background objects. */
138 0 : inline void UnlockBackgroundLayer() { LockBackgroundLayer( false ); }
139 :
140 : /** Locks/unlocks the internal layer that contains caption objects of cell notes.
141 : Unlocked layer is required to be able to edit the contained objects. */
142 0 : inline void LockInternalLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_INTERN, bLock ); }
143 : /** Unlocks the internal layer that contains caption objects of cell notes. */
144 0 : inline void UnlockInternalLayer() { LockInternalLayer( false ); }
145 :
146 : SdrEndTextEditKind ScEndTextEdit(); // calls SetDrawTextUndo(0)
147 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
148 :
149 : SdrObject* GetObjectByName(const OUString& rName);
150 : bool GetObjectIsMarked( SdrObject * pObject );
151 : bool SelectCurrentViewObject( const OUString& rName );
152 :
153 : // #i123922# helper which checks if a Graphic may be appied to an existing
154 : // SdrObject; if it's a SdrGrafObj the fill will be replaced. If it's a
155 : // fillable, non-OLE SdrObject, the FillStyle will be adapted
156 : SdrObject* ApplyGraphicToObject(
157 : SdrObject& rHitObject,
158 : const Graphic& rGraphic,
159 : const OUString& rBeginUndoText,
160 : const OUString& rFile,
161 : const OUString& rFilter);
162 :
163 : static void CheckOle( const SdrMarkList& rMarkList, bool& rAnyOle, bool& rOneOle );
164 : virtual void SyncForGrid( SdrObject* pObj );
165 : };
166 :
167 :
168 : #endif
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|