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 :
33 : class ScDrawView: public FmFormView
34 : {
35 : ScViewData* pViewData;
36 : OutputDevice* pDev; //! needed ?
37 : ScDocument* pDoc;
38 : SCTAB nTab;
39 : Fraction aScaleX; // Factor for Drawing-MapMode
40 : Fraction aScaleY;
41 : SdrDropMarkerOverlay* pDropMarker;
42 : SdrObject* pDropMarkObj;
43 : sal_Bool bInConstruct;
44 :
45 : void Construct();
46 : void UpdateBrowser();
47 :
48 : protected:
49 : virtual void ModelHasChanged();
50 :
51 : // add custom handles (used by other apps, e.g. AnchorPos)
52 : virtual void AddCustomHdl();
53 :
54 : void ImplClearCalcDropMarker();
55 :
56 : public:
57 : ScDrawView( OutputDevice* pOut, ScViewData* pData );
58 : virtual ~ScDrawView();
59 :
60 : virtual void MarkListHasChanged();
61 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
62 :
63 : virtual void DoConnect(SdrOle2Obj* pOleObj);
64 :
65 : virtual void MakeVisible( const Rectangle& rRect, Window& rWin );
66 :
67 : virtual void DeleteMarked();
68 :
69 : void MarkDropObj( SdrObject* pObj );
70 :
71 : void SetMarkedToLayer( sal_uInt8 nLayerNo );
72 :
73 : void InvalidateAttribs();
74 : void InvalidateDrawTextAttrs();
75 :
76 : sal_Bool BeginDrag( Window* pWindow, const Point& rStartPos );
77 : void DoCut();
78 : void DoCopy();
79 :
80 : void GetScale( Fraction& rFractX, Fraction& rFractY ) const;
81 : void RecalcScale();
82 : void UpdateWorkArea();
83 0 : SCTAB GetTab() const { return nTab; }
84 :
85 : void CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const;
86 :
87 : void SetPageAnchored();
88 : void SetCellAnchored();
89 : ScAnchorType GetAnchorType() const;
90 :
91 : void VCAddWin( Window* pWin );
92 : void VCRemoveWin( Window* pWin );
93 :
94 : void UpdateIMap( SdrObject* pObj );
95 :
96 : sal_uInt16 GetPopupMenuId();
97 : void UpdateUserViewOptions();
98 :
99 : void SetMarkedOriginalSize();
100 :
101 : sal_Bool SelectObject( const String& rName );
102 : bool HasMarkedControl() const;
103 : bool HasMarkedInternal() const;
104 :
105 : bool InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, sal_uLong nOptions=0);
106 :
107 : /** Returns the selected object, if it is the caption object of a cell note.
108 : @param ppCaptData (out-param) If not null, returns the pointer to the caption object data. */
109 : SdrObject* GetMarkedNoteCaption( ScDrawObjData** ppCaptData = 0 );
110 :
111 : /** Locks/unlocks the specified layer in the draw page.
112 : Unlocked layer is required to be able to edit the contained objects. */
113 : void LockCalcLayer( SdrLayerID nLayer, bool bLock = true );
114 : /** Unlocks the specified layer in the draw page. */
115 : inline void UnlockCalcLayer( SdrLayerID nLayer ) { LockCalcLayer( nLayer, false ); }
116 :
117 : /** Locks/unlocks the background layer that contains background objects.
118 : Unlocked layer is required to be able to edit the objects. */
119 0 : inline void LockBackgroundLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_BACK, bLock ); }
120 : /** Unlocks the background layer that contains background objects. */
121 0 : inline void UnlockBackgroundLayer() { LockBackgroundLayer( false ); }
122 :
123 : /** Locks/unlocks the internal layer that contains caption objects of cell notes.
124 : Unlocked layer is required to be able to edit the contained objects. */
125 0 : inline void LockInternalLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_INTERN, bLock ); }
126 : /** Unlocks the internal layer that contains caption objects of cell notes. */
127 0 : inline void UnlockInternalLayer() { LockInternalLayer( false ); }
128 :
129 : SdrEndTextEditKind ScEndTextEdit(); // calls SetDrawTextUndo(0)
130 : ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
131 :
132 : static void CheckOle( const SdrMarkList& rMarkList, sal_Bool& rAnyOle, sal_Bool& rOneOle );
133 : virtual void SyncForGrid( SdrObject* pObj );
134 : };
135 :
136 :
137 :
138 :
139 : #endif
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|