summaryrefslogtreecommitdiff
path: root/sw/source/ui/frmdlg/frmdlg.cxx
blob: 2c45253ae0ab96fa2767aad478adafb254251358 (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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
/*************************************************************************
 *
 *  $RCSfile: frmdlg.cxx,v $
 *
 *  $Revision: 1.2 $
 *
 *  last change: $Author: gt $ $Date: 2002-08-14 07:41:54 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#ifdef PRECOMPILED
#include "ui_pch.hxx"
#endif

#pragma hdrstop

#ifndef _HINTIDS_HXX
#include <hintids.hxx>
#endif
#ifndef _UIPARAM_HXX
#include <uiparam.hxx>
#endif

#ifndef _LIST_HXX //autogen
#include <tools/list.hxx>
#endif
#ifndef _SFXVIEWFRM_HXX //autogen
#include <sfx2/viewfrm.hxx>
#endif
#ifndef _SVX_HTMLMODE_HXX
#include <svx/htmlmode.hxx>
#endif
#ifndef _SVX_BORDER_HXX
#include <svx/border.hxx>
#endif
#ifndef _SVX_BACKGRND_HXX //autogen
#include <svx/backgrnd.hxx>
#endif
#ifndef _SVX_GRFPAGE_HXX //autogen
#include <svx/grfpage.hxx>
#endif
#ifndef _OFA_HTMLCFG_HXX //autogen
#include <offmgr/htmlcfg.hxx>
#endif
#ifndef _OFF_APP_HXX //autogen
#include <offmgr/app.hxx>
#endif


#ifndef _FMTFSIZE_HXX //autogen
#include <fmtfsize.hxx>
#endif
#ifndef _WRTSH_HXX
#include <wrtsh.hxx>
#endif
#ifndef _VIEW_HXX
#include <view.hxx>
#endif
#ifndef _VIEWOPT_HXX
#include <viewopt.hxx>
#endif
#ifndef _FRMDLG_HXX
#include <frmdlg.hxx>
#endif
#ifndef _FRMPAGE_HXX
#include <frmpage.hxx>
#endif
#ifndef _WRAP_HXX
#include <wrap.hxx>
#endif
#ifndef _COLUMN_HXX
#include <column.hxx>
#endif
#ifndef _MACASSGN_HXX
#include <macassgn.hxx>
#endif

#ifndef _FRMUI_HRC
#include <frmui.hrc>
#endif
#ifndef _GLOBALS_HRC
#include <globals.hrc>
#endif

/*--------------------------------------------------------------------
    Beschreibung:   Der Traeger des Dialoges
 --------------------------------------------------------------------*/

SwFrmDlg::SwFrmDlg( SfxViewFrame*       pFrame,
                    Window*             pParent,
                    const SfxItemSet&   rCoreSet,
                    BOOL                bNewFrm,
                    USHORT              nResType,
                    BOOL                bFmt,
                    UINT16              nDefPage,
                    const String*       pStr) :

    SfxTabDialog(pFrame, pParent, SW_RES(nResType), &rCoreSet, pStr != 0),
    bNew(bNewFrm),
    bFormat(bFmt),
    rSet(rCoreSet),
    nDlgType(nResType),
    pWrtShell(((SwView*)pFrame->GetViewShell())->GetWrtShellPtr())
{
    FreeResource();
    USHORT nHtmlMode = ::GetHtmlMode(pWrtShell->GetView().GetDocShell());
    BOOL bHtmlMode = nHtmlMode & HTMLMODE_ON;

    // BspFont fuer beide Bsp-TabPages
    //
    if(pStr)
    {
        String aTmp( GetText() );
        aTmp += SW_RESSTR(STR_COLL_HEADER);
        aTmp += *pStr;
        aTmp += ')';
    }
    AddTabPage(TP_FRM_STD,  SwFrmPage::Create, 0);
    AddTabPage(TP_FRM_ADD,  SwFrmAddPage::Create, 0);
    AddTabPage(TP_FRM_WRAP, SwWrapTabPage::Create, 0);
    AddTabPage(TP_FRM_URL,  SwFrmURLPage::Create, 0);
    if(nDlgType == DLG_FRM_GRF)
    {
        AddTabPage( TP_GRF_EXT, SwGrfExtPage::Create, 0 );
        AddTabPage( RID_SVXPAGE_GRFCROP, SvxGrfCropPage::Create, 0 );
    }
    if (nDlgType == DLG_FRM_STD)
    {
        AddTabPage(TP_COLUMN,   SwColumnPage::Create,    0);
    }
    AddTabPage(TP_BACKGROUND,SvxBackgroundTabPage::Create,  0);
    AddTabPage( TP_MACRO_ASSIGN, SfxMacroTabPage::Create, 0);
    AddTabPage( TP_BORDER,   SvxBorderTabPage::Create,      0);

    if(bHtmlMode)
    {
        switch( nDlgType )
        {
        case DLG_FRM_STD:
                if(0  == (nHtmlMode & HTMLMODE_SOME_ABS_POS))
                    RemoveTabPage(TP_BORDER);
                RemoveTabPage(TP_COLUMN);
            // kein break
        case DLG_FRM_OLE:
                RemoveTabPage(TP_FRM_URL);
                RemoveTabPage(TP_MACRO_ASSIGN);
            break;
        case DLG_FRM_GRF:
                RemoveTabPage(RID_SVXPAGE_GRFCROP);
            break;
        }
        if( 0  == (nHtmlMode & HTMLMODE_SOME_ABS_POS) ||
            nDlgType != DLG_FRM_STD )
            RemoveTabPage(TP_BACKGROUND);
    }

    if (bNew)
        SetCurPageId(TP_FRM_STD);

    if (nDefPage)
        SetCurPageId(nDefPage);
}

/*--------------------------------------------------------------------
    Beschreibung:
 --------------------------------------------------------------------*/

SwFrmDlg::~SwFrmDlg()
{
}




void SwFrmDlg::PageCreated( USHORT nId, SfxTabPage &rPage )
{
    switch ( nId )
    {
    case TP_FRM_STD:
        ((SwFrmPage&)rPage).SetNewFrame(bNew);
        ((SwFrmPage&)rPage).SetFormatUsed(bFormat);
        ((SwFrmPage&)rPage).SetFrmType(nDlgType);
        break;

    case TP_FRM_ADD:
        ((SwFrmAddPage&)rPage).SetFormatUsed(bFormat);
        ((SwFrmAddPage&)rPage).SetFrmType(nDlgType);
        ((SwFrmAddPage&)rPage).SetNewFrame(bNew);
        ((SwFrmAddPage&)rPage).SetShell(pWrtShell);
        break;

    case TP_FRM_WRAP:
        ((SwWrapTabPage&)rPage).SetNewFrame(bNew);
        ((SwWrapTabPage&)rPage).SetFormatUsed(bFormat, FALSE);
        ((SwWrapTabPage&)rPage).SetShell(pWrtShell);
        break;

    case TP_COLUMN:
        {
            ((SwColumnPage&)rPage).SetFrmMode(TRUE);
            ((SwColumnPage&)rPage).SetFormatUsed(bFormat);

            const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)
                                                rSet.Get( RES_FRM_SIZE );
            ((SwColumnPage&)rPage).SetPageWidth( rSize.GetWidth() );
        }
        break;

    case TP_MACRO_ASSIGN:
        SwMacroAssignDlg::AddEvents( (SfxMacroTabPage&)rPage,
            DLG_FRM_GRF == nDlgType ? MACASSGN_GRAPHIC
                            : DLG_FRM_OLE == nDlgType ? MACASSGN_OLE
                                                      : MACASSGN_FRMURL );
        break;

    case TP_BACKGROUND:
        if( DLG_FRM_STD == nDlgType )
            ((SvxBackgroundTabPage&)rPage).ShowSelector();
        break;

    case TP_BORDER:
        ((SvxBorderTabPage&) rPage).SetSWMode(SW_BORDER_MODE_FRAME);
        break;
    }
}


/*-----------------25.02.94 21:22-------------------
   $Log: not supported by cvs2svn $
   Revision 1.1.1.1  2000/09/18 17:14:37  hr
   initial import

   Revision 1.196  2000/09/18 16:05:33  willem.vandorp
   OpenOffice header added.

   Revision 1.195  2000/08/25 14:10:11  jp
   Graphic Crop-Attribut and TabPage exported to SVX

   Revision 1.194  2000/06/20 14:47:24  os
   #70060# less occurences of columns in HTML

   Revision 1.193  1998/07/17 08:18:06  OS
   SfxxSmallMacroTabPage einsetzen #52809#


      Rev 1.192   17 Jul 1998 10:18:06   OS
   SfxxSmallMacroTabPage einsetzen #52809#

      Rev 1.191   15 Jun 1998 21:15:48   MH
   add: list.hxx

      Rev 1.190   16 Apr 1998 13:11:10   OS
   Rahmenanpassung die zweite

      Rev 1.189   06 Apr 1998 09:48:24   OS
   HTML-Anpassungen

      Rev 1.188   28 Nov 1997 19:41:18   MA
   includes

      Rev 1.187   24 Nov 1997 17:40:14   MA
   include

      Rev 1.186   03 Nov 1997 13:19:48   MA
   precomp entfernt

      Rev 1.185   01 Sep 1997 13:29:54   OS
   DLL-Umstellung

      Rev 1.184   15 Aug 1997 12:13:22   OS
   chartar/frmatr/txtatr aufgeteilt

      Rev 1.183   11 Aug 1997 12:45:16   MH
   chg: header

      Rev 1.182   03 Jul 1997 12:54:34   OS
   SwSwMode jetzt mit BYTE #41255#

      Rev 1.181   29 Apr 1997 15:04:48   OS
   Hintergrund auch fuer OLE

--------------------------------------------------*/