xref: /trunk/main/svx/inc/svx/svdxcgv.hxx (revision b5da552ccefc4034e06a43bfae43fb8a8b64a7ad)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVDXCGV_HXX
25 #define _SVDXCGV_HXX
26 
27 #include <svx/svdedxv.hxx>
28 
29 #ifndef _GDIMTF_HXX //autogen
30 #include <vcl/gdimtf.hxx>
31 #endif
32 #include "svx/svxdllapi.h"
33 
34 ////////////////////////////////////////////////////////////////////////////////////////////////////
35 ////////////////////////////////////////////////////////////////////////////////////////////////////
36 //
37 //  @@@@@ @@   @@  @@@@  @@  @@  @@@@  @@  @@  @@@@  @@@@@  @@ @@ @@ @@@@@ @@   @@
38 //  @@    @@@ @@@ @@  @@ @@  @@ @@  @@ @@@ @@ @@  @@ @@     @@ @@ @@ @@    @@   @@
39 //  @@     @@@@@  @@     @@  @@ @@  @@ @@@@@@ @@     @@     @@ @@ @@ @@    @@ @ @@
40 //  @@@@    @@@   @@     @@@@@@ @@@@@@ @@@@@@ @@ @@@ @@@@   @@@@@ @@ @@@@  @@@@@@@
41 //  @@     @@@@@  @@     @@  @@ @@  @@ @@ @@@ @@  @@ @@      @@@  @@ @@    @@@@@@@
42 //  @@    @@@ @@@ @@  @@ @@  @@ @@  @@ @@  @@ @@  @@ @@      @@@  @@ @@    @@@ @@@
43 //  @@@@@ @@   @@  @@@@  @@  @@ @@  @@ @@  @@  @@@@@ @@@@@    @   @@ @@@@@ @@   @@
44 //
45 ////////////////////////////////////////////////////////////////////////////////////////////////////
46 ////////////////////////////////////////////////////////////////////////////////////////////////////
47 
48 class SVX_DLLPUBLIC SdrExchangeView: public SdrObjEditView
49 {
50     friend class SdrPageView;
51 
52 protected:
53 
54     void                ImpGetPasteObjList(Point& rPos, SdrObjList*& rpLst);
55     void                ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Point& rCenter, const Size& rSiz, const MapMode& rMap, sal_uInt32 nOptions);
56     sal_Bool                ImpGetPasteLayer(const SdrObjList* pObjList, SdrLayerID& rLayer) const;
57     Point               GetPastePos(SdrObjList* pLst, OutputDevice* pOut=NULL);
58 
59     // liefert True, wenn rPt geaendert wurde
60     sal_Bool                ImpLimitToWorkArea(Point& rPt) const;
61 
62 protected:
63     // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
64     SdrExchangeView(SdrModel* pModel1, OutputDevice* pOut = 0L);
65 
66 public:
67     // Alle markierten Objekte auf dem angegebenen OutputDevice ausgeben.
68     virtual void        DrawMarkedObj(OutputDevice& rOut) const;
69 
70     // Z.B. fuer's Clipboard, Drag&Drop, ...
71     // Alle markierten Objekte in ein Metafile stecken. Z.Zt. noch etwas
72     // buggee (Offset..., Fremdgrafikobjekte (SdrGrafObj), Virtuelle
73     // Objektkopien (SdrVirtObj) mit Ankerpos<>(0,0)).
74     virtual GDIMetaFile GetMarkedObjMetaFile(sal_Bool bNoVDevIfOneMtfMarked=sal_False) const;
75 
76     // Alle markierten Objekte auf eine Bitmap malen. Diese hat die Farbtiefe
77     // und Aufloesung des Bildschirms.
78     virtual Bitmap      GetMarkedObjBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const;
79 
80     // Alle markierten Objekte in ein neues Model kopieren. Dieses neue Model
81     // hat dann genau eine Page. Das Flag PageNotValid an diesem Model ist
82     // gesetzt. Daran ist zu erkennen, dass nur die Objekte der Page Gueltikeit
83     // haben, die Page sebst jedoch nicht (Seitengroesse, Raender). Das neue
84     // Model wird auf dem Heap erzeugt und wird an den Aufrufer dieser Methode
85     // uebergeben. Dieser hat es dann spaeter zu entsorgen.
86     // Beim einfuegen der markierten Objekte in die eine Page des neuen Model
87     // findet ein Merging der seitenlokalen Layer statt. Sollte kein Platz mehr
88     // fuer weitere seitenlokale Layer sein, wird den entsprechenden Objekten
89     // der Default-Layer zugewiesen (Layer 0, (dokumentglobaler Standardlayer).
90     virtual SdrModel*   GetMarkedObjModel() const;
91 
92     GDIMetaFile     GetAllMarkedMetaFile(sal_Bool bNoVDevIfOneMtfMarked=sal_False) const { return GetMarkedObjMetaFile(bNoVDevIfOneMtfMarked); }
93     Bitmap          GetAllMarkedBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const { return GetMarkedObjBitmap(bNoVDevIfOneBmpMarked); }
94     Graphic         GetAllMarkedGraphic() const;
95     SdrModel*       GetAllMarkedModel() const { return GetMarkedObjModel(); }
96 
97     /** Generate a Graphic for the given draw object in the given model
98 
99         @param pModel
100         Must not be NULL. Denotes the draw model the object is a part
101         of.
102 
103         @param pObj
104         The object (can also be a group object) to retrieve a Graphic
105         for. Must not be NULL.
106 
107         @return a graphical representation of the given object, as it
108         appears on screen (e.g. with rotation, if any, applied).
109      */
110     static Graphic  GetObjGraphic( const SdrModel* pModel, const SdrObject* pObj );
111 
112     // Bestimmung des View-Mittelpunktes, z.B. zum Pasten
113     Point           GetViewCenter(const OutputDevice* pOut=NULL) const;
114 
115     // Bei allen Paste-Methoden werden die neuen Draw-Objekte markiert.
116     // Wird der Parameter bAddMark auf sal_True gesetzt, so werden die neuen
117     // DrawObjekte zu einer bereits bestehenden Selektion "hinzumarkiert".
118     // Dieser Fall ist fuer Drag&Drop mit mehreren Items gedacht.
119     // Die Methoden mit Point-Parameter fuegen neue Objekte zentriert an
120     // dieser Position ein, die anderen zentriert am 1.OutputDevice der View.
121     // Ist der Parameter pPg gesetzt, werden die Objekte and dieser Seite
122     // eingefuegt. Die Positionierung (rPos bzw. Zentrierung) bezieht sich
123     // dann nichtmehr auf die View sondern auf die Page.
124     // Hinweis: SdrObjList ist Basisklasse von SdrPage.
125     // Die Methoden liefern sal_True, wenn die Objekte erfolgreich erzeugt und
126     // eingefuegt wurden. Bei pLst=sal_False und kein TextEdit aktiv kann man
127     // sich dann auch darauf verlassen, dass diese an der View markiert sind.
128     // Andernfalls erfolgt die Markierung nur, wenn pLst z.Zt. auch an der
129     // View angezeigt wird.
130     // Gueltige Werte fuer nOptions sind SDRINSERT_DONTMARK und
131     // SDRINSERT_ADDMARK (siehe svdedtv.hxx).
132     sal_Bool            Paste(const GDIMetaFile& rMtf, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rMtf,GetPastePos(pLst,pOut),pLst,nOptions); }
133     sal_Bool            Paste(const GDIMetaFile& rMtf, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
134     sal_Bool            Paste(const Bitmap& rBmp, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rBmp,GetPastePos(pLst,pOut),pLst,nOptions); }
135     sal_Bool            Paste(const Bitmap& rBmp, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
136     sal_Bool            Paste(const SdrModel& rMod, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rMod,GetPastePos(pLst,pOut),pLst,nOptions); }
137     virtual sal_Bool    Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
138     sal_Bool            Paste(const String& rStr, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rStr,GetPastePos(pLst,pOut),pLst,nOptions); }
139     sal_Bool            Paste(const String& rStr, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
140     // der sal_uInt16 eFormat nimmt Werte des enum EETextFormat entgegen
141     sal_Bool            Paste(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rInput,rBaseURL,eFormat,GetPastePos(pLst,pOut),pLst,nOptions); }
142     sal_Bool            Paste(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
143 
144     // Feststellen, ob ein bestimmtes Format ueber Drag&Drop bzw. ueber's
145     // Clipboard angenommen werden kann.
146     sal_Bool            IsExchangeFormatSupported(sal_uIntPtr nFormat) const;
147 
148     sal_Bool            Cut( sal_uIntPtr nFormat = SDR_ANYFORMAT );
149     void            CutMarked( sal_uIntPtr nFormat=SDR_ANYFORMAT );
150 
151     sal_Bool            Yank( sal_uIntPtr nFormat = SDR_ANYFORMAT );
152     void            YankMarked( sal_uIntPtr nFormat=SDR_ANYFORMAT );
153 
154     sal_Bool            Paste( Window* pWin = NULL, sal_uIntPtr nFormat = SDR_ANYFORMAT );
155     sal_Bool            PasteClipboard( OutputDevice* pOut = NULL, sal_uIntPtr nFormat = SDR_ANYFORMAT, sal_uInt32 nOptions = 0 );
156 };
157 
158 #endif //_SVDXCGV_HXX
159