summaryrefslogtreecommitdiff
path: root/binfilter/inc/bf_so3/embobj.hxx
blob: d1043e2682660b6106a1047215a83a5e1010ca5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef _EMBOBJ_HXX
#define _EMBOBJ_HXX

#include <bf_svtools/bf_solar.h>

#include <bf_so3/persist.hxx>
#include <bf_so3/pseudo.hxx>
#include <bf_so3/protocol.hxx>
#include <bf_so3/svstor.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <vcl/mapmod.hxx>
#include <bf_svtools/ownlist.hxx>

#include "bf_so3/so3dllapi.h"

class Printer;

/*************************************************************************/
// Datenart !!! Uebereinstimmung mit MS-Windows
#define ASPECT_CONTENT      1
#define ASPECT_THUMBNAIL    2 /* 120 * 120, 6 Farben DIB in MetaFile */
#define ASPECT_ICON         4
#define ASPECT_DOCPRINT     8
#define ASPECT_ALL      (ASPECT_CONTENT | ASPECT_THUMBNAIL | ASPECT_ICON | ASPECT_DOCPRINT)

struct TransferableObjectDescriptor;
class ImpOleObject;
class ImpViewObject;
class OutputDevice;
class Region;
class Menu;
class GDIMetaFile;
class JobSetup;
class SotStorage;
namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }

namespace binfilter {
class SvEmbeddedClient;
class SvStorage;

class SO3_DLLPUBLIC SvEmbeddedObject : virtual public SvPersist,
                         public SvPseudoObject
{
friend class ImpOleObject;
friend class SvEmbeddedClient;
friend class SvEditObjectProtocol;
friend class ImplSvEditObjectProtocol;
friend class SvPersist; // nur wegen Sun-C40 Compiler
friend class SwWW6WrGrf; // SH benoetigt MakeMetafile
    BOOL                    bAutoSave:1,   // TRUE, bei DoOpen( FALSE ), Save
                            bAutoHatch:1;  // TRUE, bei Embed automatisch Hatch zeichnen
    Rectangle               aVisArea;      // leer == nicht gesetzt
    MapUnit                 nMapUnit;
    String                  aDocName;      // Documentname

    void            DrawHatch( OutputDevice * pDev, const Point & rPos,
                               const Size & rSize );
protected:
    SvEditObjectProtocol    aProt;           // Referenz auf das Protokoll
                    ~SvEmbeddedObject();
    virtual BOOL    Load( SvStorage * );
    virtual BOOL    Save() {return false;}
    virtual void    LoadContent( SvStream & rStm, BOOL bOwner_ );
    virtual void    SaveContent( SvStream & rStm, BOOL bOwner_ );
    virtual void    Connect( BOOL bConnect );
    virtual void    Open( BOOL bOpen );
    virtual void    Embed( BOOL bEmbedded );
    virtual void    PlugIn( BOOL bPlugIn );
    virtual ErrCode Verb( long nVerbPos, ::binfilter::SvEmbeddedClient * pCallerClient,
                        Window * pWin, const Rectangle * pWorkAreaPixel );

    virtual BOOL    Close();
    void            SetMapUnit( MapUnit nUnit )
                    { nMapUnit = nUnit; }
    virtual void    Draw( OutputDevice *, const JobSetup & rSetup,
                          USHORT nAspect = ASPECT_CONTENT );
    virtual void    DocumentNameChanged( const String & rDocName );

public:
                    SvEmbeddedObject();
                    SO2_DECL_STANDARD_CLASS_DLL(SvEmbeddedObject,SOAPP)
    virtual void    FillClass( SvGlobalName * pClassName,
                               ULONG * pFormat,
                               String * pAppName,
                               String * pFullTypeName,
                               String * pShortTypeName,
                               long nFileFormat = SOFFICE_FILEFORMAT_CURRENT ) const;
    SvGlobalName    GetClassName() const
                    { return SvPseudoObject::GetClassName(); }

    void            SetAutoSave( BOOL bAutoSaveP )
                    { bAutoSave = bAutoSaveP; }
    BOOL            IsAutoSave() const { return bAutoSave; }
    virtual void    SetModified( BOOL = TRUE );

    void            SetAutoHatch( BOOL bAutoHatchP )
                    { bAutoHatch = bAutoHatchP; }
    BOOL            IsAutoHatch() const { return bAutoHatch; }

    SvEmbeddedClient * GetClient() const { return aProt.GetClient(); }

    // Konvertieren von StarObjects
    static BOOL InsertStarObject
    ( const String &rObjName, const String& rStgName,
      SvStream& rSrc, SvPersist* pPersist );
    // Einlesen eines StarObjects als Picture
    static BOOL LoadStarObjectPicture( SvStream& rSrc, GDIMetaFile& rMTF );

    static BOOL     MakeContentStream( SvStorage * pStor, const GDIMetaFile & );
    static BOOL     MakeContentStream( SotStorage * pStor, const GDIMetaFile & );

    // Attribute zum Feintuning
    virtual ULONG   GetMiscStatus() const;

    // Robuste Protokollsteuerung
    ErrCode         DoEmbed( BOOL bEmbedded );
    ErrCode         DoPlugIn( BOOL bPLugIn );
    ErrCode         DoOpen( BOOL bOpen );

    const String &  GetDocumentName() const { return aDocName; }

    SvEditObjectProtocol & GetProtocol() { return aProt; }
    const SvEditObjectProtocol & GetProtocol() const { return aProt; }

    void            SendViewChanged();
    void            ViewChanged( USHORT nAspect);

    GDIMetaFile& GetGDIMetaFile( GDIMetaFile& );
    virtual BOOL SetData( const String& rData );

    MapUnit         GetMapUnit() const { return nMapUnit; }
    //virtual Rectangle GetVisArea( USHORT nAspect = ASPECT_CONTENT ) const;
    virtual Rectangle GetVisArea( USHORT nAspect ) const;
    const Rectangle & GetVisArea() const;
    virtual void    SetVisArea( const Rectangle & rVisArea );
                    // Optimierung gegenueber SetVisArea, wenn dana GetVisArea
    const Rectangle & SetGetVisArea( const Rectangle & rVisArea );
    void            SetVisAreaSize( const Size & rVisSize );

    void            DoDraw( OutputDevice *, const Point & rObjPos,
                            const Fraction & rXScale,
                            const Fraction & rScaleY,
                            const JobSetup & rSetup, const Size& rSize,
                            USHORT nAspect = ASPECT_CONTENT );
    void            DoDraw( OutputDevice *, const Point & rObjPos,
                            const Size & rSize,
                            const JobSetup & rSetup,
                            USHORT nAspect = ASPECT_CONTENT );

    // WYSIWYG
    /* Return the printer of the document. A return of null means that the
     * document has no printer.
     * The default implementation call the parent if one exist or return null.
     */
    virtual Printer *       GetDocumentPrinter();
    virtual OutputDevice*    GetDocumentRefDev();

    /* This Method is called if the printer in the document changed.
     * The default implementation does not call the childs.
     * @param pNewPrinter   the new printer. Only hold references
     *                      to this object during the call.
     * @see documentation in so3\source\inplace\embobj.cxx::OnDocumentPrinterChanged
     */
    virtual void            OnDocumentPrinterChanged( Printer * pNewPrinter );

    virtual UINT32          GetViewAspect() const;
};
#ifndef SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
#define SO2_DECL_SVEMBEDDEDOBJECT_DEFINED
SO2_DECL_REF(SvEmbeddedObject)
#endif
SO2_IMPL_REF(SvEmbeddedObject)

/*************************************************************************
*************************************************************************/
class SO3_DLLPUBLIC SvEmbeddedInfoObject : public SvInfoObject
{
    Rectangle       aVisArea;
    UINT32          nViewAspect;
protected:
                    ~SvEmbeddedInfoObject();
    virtual void    Assign( const SvInfoObject * pObj );
public:
                    SV_DECL_PERSIST1(SvEmbeddedObject,SvInfoObject,2)
                    SvEmbeddedInfoObject();
                    SvEmbeddedInfoObject( SvEmbeddedObject *, const String & rObjName );
                    SvEmbeddedInfoObject( const String& rObjName,
                                     const SvGlobalName& rClassName );

    virtual void    SetObj( SvPersist * );

    SvEmbeddedObject * GetEmbed() const { return &SvEmbeddedObjectRef( GetObj() ); }
    BOOL            IsLink() const;
    const Rectangle & GetVisArea() const;
    const Rectangle & GetInfoVisArea() const { return aVisArea; }
    void SetInfoVisArea( const Rectangle& r) { aVisArea = r; }

    UINT32 GetInfoViewAspect() const { return nViewAspect; }
    void SetInfoViewAspect( UINT32 nAspect ) { nViewAspect = nAspect; }
    UINT32          GetViewAspect() const;
};

}

#endif // _EMBOBJ_HXX

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */