xref: /AOO41X/main/svx/inc/svx/svdxcgv.hxx (revision 47148b3bc50811ceb41802e4cc50a5db21535900)
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     ::std::vector< SdrObject* > GetMarkedObjects() const;
69     virtual void        DrawMarkedObj(OutputDevice& rOut) const;
70 
71     // Z.B. fuer's Clipboard, Drag&Drop, ...
72     // Alle markierten Objekte in ein Metafile stecken. Z.Zt. noch etwas
73     // buggee (Offset..., Fremdgrafikobjekte (SdrGrafObj), Virtuelle
74     // Objektkopien (SdrVirtObj) mit Ankerpos<>(0,0)).
75     GDIMetaFile GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked = false) const;
76 
77     // Alle markierten Objekte auf eine Bitmap malen. Diese hat die Farbtiefe
78     // und Aufloesung des Bildschirms.
79     BitmapEx GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked = false) const;
80 
81     // Alle markierten Objekte in ein neues Model kopieren. Dieses neue Model
82     // hat dann genau eine Page. Das Flag PageNotValid an diesem Model ist
83     // gesetzt. Daran ist zu erkennen, dass nur die Objekte der Page Gueltikeit
84     // haben, die Page sebst jedoch nicht (Seitengroesse, Raender). Das neue
85     // Model wird auf dem Heap erzeugt und wird an den Aufrufer dieser Methode
86     // uebergeben. Dieser hat es dann spaeter zu entsorgen.
87     // Beim einfuegen der markierten Objekte in die eine Page des neuen Model
88     // findet ein Merging der seitenlokalen Layer statt. Sollte kein Platz mehr
89     // fuer weitere seitenlokale Layer sein, wird den entsprechenden Objekten
90     // der Default-Layer zugewiesen (Layer 0, (dokumentglobaler Standardlayer).
91     virtual SdrModel*   GetMarkedObjModel() const;
92 
93     Graphic         GetAllMarkedGraphic() const;
GetAllMarkedModel() const94     SdrModel*       GetAllMarkedModel() const { return GetMarkedObjModel(); }
95 
96     /** Generate a Graphic for the given draw object in the given model
97 
98         @param pModel
99         Must not be NULL. Denotes the draw model the object is a part
100         of.
101 
102         @param pObj
103         The object (can also be a group object) to retrieve a Graphic
104         for. Must not be NULL.
105 
106         @return a graphical representation of the given object, as it
107         appears on screen (e.g. with rotation, if any, applied).
108      */
109     static Graphic  GetObjGraphic( const SdrModel* pModel, const SdrObject* pObj );
110 
111     // Bestimmung des View-Mittelpunktes, z.B. zum Pasten
112     Point           GetViewCenter(const OutputDevice* pOut=NULL) const;
113 
114     // Bei allen Paste-Methoden werden die neuen Draw-Objekte markiert.
115     // Wird der Parameter bAddMark auf sal_True gesetzt, so werden die neuen
116     // DrawObjekte zu einer bereits bestehenden Selektion "hinzumarkiert".
117     // Dieser Fall ist fuer Drag&Drop mit mehreren Items gedacht.
118     // Die Methoden mit Point-Parameter fuegen neue Objekte zentriert an
119     // dieser Position ein, die anderen zentriert am 1.OutputDevice der View.
120     // Ist der Parameter pPg gesetzt, werden die Objekte and dieser Seite
121     // eingefuegt. Die Positionierung (rPos bzw. Zentrierung) bezieht sich
122     // dann nichtmehr auf die View sondern auf die Page.
123     // Hinweis: SdrObjList ist Basisklasse von SdrPage.
124     // Die Methoden liefern sal_True, wenn die Objekte erfolgreich erzeugt und
125     // eingefuegt wurden. Bei pLst=sal_False und kein TextEdit aktiv kann man
126     // sich dann auch darauf verlassen, dass diese an der View markiert sind.
127     // Andernfalls erfolgt die Markierung nur, wenn pLst z.Zt. auch an der
128     // View angezeigt wird.
129     // Gueltige Werte fuer nOptions sind SDRINSERT_DONTMARK und
130     // SDRINSERT_ADDMARK (siehe svdedtv.hxx).
Paste(const GDIMetaFile & rMtf,SdrObjList * pLst=NULL,OutputDevice * pOut=NULL,sal_uInt32 nOptions=0)131     sal_Bool            Paste(const GDIMetaFile& rMtf, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rMtf,GetPastePos(pLst,pOut),pLst,nOptions); }
132     sal_Bool            Paste(const GDIMetaFile& rMtf, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
Paste(const Bitmap & rBmp,SdrObjList * pLst=NULL,OutputDevice * pOut=NULL,sal_uInt32 nOptions=0)133     sal_Bool            Paste(const Bitmap& rBmp, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rBmp,GetPastePos(pLst,pOut),pLst,nOptions); }
134     sal_Bool            Paste(const Bitmap& rBmp, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
Paste(const SdrModel & rMod,SdrObjList * pLst=NULL,OutputDevice * pOut=NULL,sal_uInt32 nOptions=0)135     sal_Bool            Paste(const SdrModel& rMod, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rMod,GetPastePos(pLst,pOut),pLst,nOptions); }
136     virtual sal_Bool    Paste(const SdrModel& rMod, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
Paste(const String & rStr,SdrObjList * pLst=NULL,OutputDevice * pOut=NULL,sal_uInt32 nOptions=0)137     sal_Bool            Paste(const String& rStr, SdrObjList* pLst=NULL, OutputDevice* pOut=NULL, sal_uInt32 nOptions=0) { return Paste(rStr,GetPastePos(pLst,pOut),pLst,nOptions); }
138     sal_Bool            Paste(const String& rStr, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
139     // der sal_uInt16 eFormat nimmt Werte des enum EETextFormat entgegen
Paste(SvStream & rInput,const String & rBaseURL,sal_uInt16 eFormat,SdrObjList * pLst=NULL,OutputDevice * pOut=NULL,sal_uInt32 nOptions=0)140     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); }
141     sal_Bool            Paste(SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat, const Point& rPos, SdrObjList* pLst=NULL, sal_uInt32 nOptions=0);
142 
143     // Feststellen, ob ein bestimmtes Format ueber Drag&Drop bzw. ueber's
144     // Clipboard angenommen werden kann.
145     sal_Bool            IsExchangeFormatSupported(sal_uIntPtr nFormat) const;
146 
147     sal_Bool            Cut( sal_uIntPtr nFormat = SDR_ANYFORMAT );
148     void            CutMarked( sal_uIntPtr nFormat=SDR_ANYFORMAT );
149 
150     sal_Bool            Yank( sal_uIntPtr nFormat = SDR_ANYFORMAT );
151     void            YankMarked( sal_uIntPtr nFormat=SDR_ANYFORMAT );
152 
153     sal_Bool            Paste( Window* pWin = NULL, sal_uIntPtr nFormat = SDR_ANYFORMAT );
154     sal_Bool            PasteClipboard( OutputDevice* pOut = NULL, sal_uIntPtr nFormat = SDR_ANYFORMAT, sal_uInt32 nOptions = 0 );
155 };
156 
157 #endif //_SVDXCGV_HXX
158