1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: frmdlg.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
34 #ifdef SW_DLLIMPLEMENTATION
35 #undef SW_DLLIMPLEMENTATION
38 #include <svx/dialogs.hrc>
39 #include <hintids.hxx>
40 #include <tools/list.hxx>
41 #include <sfx2/viewfrm.hxx>
42 #include <svx/htmlmode.hxx>
43 #include <fmtfsize.hxx>
49 #include <viewopt.hxx>
51 #include <frmpage.hxx>
54 #include <macassgn.hxx>
60 #include <globals.hrc>
62 #include <svx/svxids.hrc>
63 #include <svx/flagsdef.hxx>
64 #include <svx/svxdlg.hxx>
66 /*--------------------------------------------------------------------
67 Beschreibung: Der Traeger des Dialoges
68 --------------------------------------------------------------------*/
70 SwFrmDlg::SwFrmDlg( SfxViewFrame
* pViewFrame
,
72 const SfxItemSet
& rCoreSet
,
79 SfxTabDialog(pViewFrame
, pParent
, SW_RES(nResType
), &rCoreSet
, pStr
!= 0),
84 m_pWrtShell(((SwView
*)pViewFrame
->GetViewShell())->GetWrtShellPtr())
87 USHORT nHtmlMode
= ::GetHtmlMode(m_pWrtShell
->GetView().GetDocShell());
88 m_bHTMLMode
= static_cast< BOOL
>(nHtmlMode
& HTMLMODE_ON
);
90 // BspFont fuer beide Bsp-TabPages
94 String
aTmp( GetText() );
95 aTmp
+= SW_RESSTR(STR_COLL_HEADER
);
99 AddTabPage(TP_FRM_STD
, SwFrmPage::Create
, 0);
100 AddTabPage(TP_FRM_ADD
, SwFrmAddPage::Create
, 0);
101 AddTabPage(TP_FRM_WRAP
, SwWrapTabPage::Create
, 0);
102 AddTabPage(TP_FRM_URL
, SwFrmURLPage::Create
, 0);
103 if(m_nDlgType
== DLG_FRM_GRF
)
105 AddTabPage( TP_GRF_EXT
, SwGrfExtPage::Create
, 0 );
106 AddTabPage( RID_SVXPAGE_GRFCROP
);
108 if (m_nDlgType
== DLG_FRM_STD
)
110 AddTabPage(TP_COLUMN
, SwColumnPage::Create
, 0);
112 SfxAbstractDialogFactory
* pFact
= SfxAbstractDialogFactory::Create();
113 DBG_ASSERT(pFact
, "Dialogdiet fail!");
114 AddTabPage(TP_BACKGROUND
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND
), 0 );
115 AddTabPage( TP_MACRO_ASSIGN
, pFact
->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN
), 0);
116 AddTabPage( TP_BORDER
, pFact
->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER
), 0 );
123 if(0 == (nHtmlMode
& HTMLMODE_SOME_ABS_POS
))
124 RemoveTabPage(TP_BORDER
);
125 RemoveTabPage(TP_COLUMN
);
128 RemoveTabPage(TP_FRM_URL
);
129 RemoveTabPage(TP_MACRO_ASSIGN
);
132 RemoveTabPage(RID_SVXPAGE_GRFCROP
);
135 if( 0 == (nHtmlMode
& HTMLMODE_SOME_ABS_POS
) ||
136 m_nDlgType
!= DLG_FRM_STD
)
137 RemoveTabPage(TP_BACKGROUND
);
141 SetCurPageId(TP_FRM_STD
);
144 SetCurPageId(nDefPage
);
147 /*--------------------------------------------------------------------
149 --------------------------------------------------------------------*/
151 SwFrmDlg::~SwFrmDlg()
158 void SwFrmDlg::PageCreated( USHORT nId
, SfxTabPage
&rPage
)
160 SfxAllItemSet
aSet(*(GetInputSetImpl()->GetPool()));
164 ((SwFrmPage
&)rPage
).SetNewFrame(m_bNew
);
165 ((SwFrmPage
&)rPage
).SetFormatUsed(m_bFormat
);
166 ((SwFrmPage
&)rPage
).SetFrmType(m_nDlgType
);
170 ((SwFrmAddPage
&)rPage
).SetFormatUsed(m_bFormat
);
171 ((SwFrmAddPage
&)rPage
).SetFrmType(m_nDlgType
);
172 ((SwFrmAddPage
&)rPage
).SetNewFrame(m_bNew
);
173 ((SwFrmAddPage
&)rPage
).SetShell(m_pWrtShell
);
177 ((SwWrapTabPage
&)rPage
).SetNewFrame(m_bNew
);
178 ((SwWrapTabPage
&)rPage
).SetFormatUsed(m_bFormat
, FALSE
);
179 ((SwWrapTabPage
&)rPage
).SetShell(m_pWrtShell
);
184 ((SwColumnPage
&)rPage
).SetFrmMode(TRUE
);
185 ((SwColumnPage
&)rPage
).SetFormatUsed(m_bFormat
);
187 const SwFmtFrmSize
& rSize
= (const SwFmtFrmSize
&)
188 m_rSet
.Get( RES_FRM_SIZE
);
189 ((SwColumnPage
&)rPage
).SetPageWidth( rSize
.GetWidth() );
193 case TP_MACRO_ASSIGN
:
195 SfxAllItemSet
aNewSet(*aSet
.GetPool());
196 aNewSet
.Put( SwMacroAssignDlg::AddEvents(
197 DLG_FRM_GRF
== m_nDlgType
? MACASSGN_GRAPHIC
: DLG_FRM_OLE
== m_nDlgType
? MACASSGN_OLE
: MACASSGN_FRMURL
) );
199 rPage
.SetFrame( m_pWrtShell
->GetView().GetViewFrame()->GetFrame()->GetFrameInterface() );
200 rPage
.PageCreated(aNewSet
);
205 if( DLG_FRM_STD
== m_nDlgType
)
207 sal_Int32 nFlagType
= SVX_SHOW_SELECTOR
;
209 nFlagType
|= SVX_ENABLE_TRANSPARENCY
;
210 aSet
.Put (SfxUInt32Item(SID_FLAG_TYPE
, nFlagType
));
211 rPage
.PageCreated(aSet
);
217 aSet
.Put (SfxUInt16Item(SID_SWMODE_TYPE
,SW_BORDER_MODE_FRAME
));
218 rPage
.PageCreated(aSet
);