1*efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*efeef26fSAndrew Rist * distributed with this work for additional information 6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10*efeef26fSAndrew Rist * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*efeef26fSAndrew Rist * 13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*efeef26fSAndrew Rist * software distributed under the License is distributed on an 15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17*efeef26fSAndrew Rist * specific language governing permissions and limitations 18*efeef26fSAndrew Rist * under the License. 19*efeef26fSAndrew Rist * 20*efeef26fSAndrew Rist *************************************************************/ 21*efeef26fSAndrew Rist 22*efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION 28cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <svx/dialogs.hrc> 32cdf0e10cSrcweir #include <hintids.hxx> 33cdf0e10cSrcweir #include <tools/list.hxx> 34cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 35cdf0e10cSrcweir #include <svx/htmlmode.hxx> 36cdf0e10cSrcweir #include <fmtfsize.hxx> 37cdf0e10cSrcweir #include <wrtsh.hxx> 38cdf0e10cSrcweir #ifndef _VIEW_HXX 39cdf0e10cSrcweir #include <view.hxx> 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir #include <docsh.hxx> 42cdf0e10cSrcweir #include <viewopt.hxx> 43cdf0e10cSrcweir #include <frmdlg.hxx> 44cdf0e10cSrcweir #include <frmpage.hxx> 45cdf0e10cSrcweir #include <wrap.hxx> 46cdf0e10cSrcweir #include <column.hxx> 47cdf0e10cSrcweir #include <macassgn.hxx> 48cdf0e10cSrcweir 49cdf0e10cSrcweir #ifndef _FRMUI_HRC 50cdf0e10cSrcweir #include <frmui.hrc> 51cdf0e10cSrcweir #endif 52cdf0e10cSrcweir #ifndef _GLOBALS_HRC 53cdf0e10cSrcweir #include <globals.hrc> 54cdf0e10cSrcweir #endif 55cdf0e10cSrcweir #include <svx/svxids.hrc> 56cdf0e10cSrcweir #include <svx/flagsdef.hxx> 57cdf0e10cSrcweir #include <svx/svxdlg.hxx> 58cdf0e10cSrcweir 59cdf0e10cSrcweir /*-------------------------------------------------------------------- 60cdf0e10cSrcweir Beschreibung: Der Traeger des Dialoges 61cdf0e10cSrcweir --------------------------------------------------------------------*/ 62cdf0e10cSrcweir 63cdf0e10cSrcweir SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame, 64cdf0e10cSrcweir Window* pParent, 65cdf0e10cSrcweir const SfxItemSet& rCoreSet, 66cdf0e10cSrcweir sal_Bool bNewFrm, 67cdf0e10cSrcweir sal_uInt16 nResType, 68cdf0e10cSrcweir sal_Bool bFormat, 69cdf0e10cSrcweir sal_uInt16 nDefPage, 70cdf0e10cSrcweir const String* pStr) : 71cdf0e10cSrcweir 72cdf0e10cSrcweir SfxTabDialog(pViewFrame, pParent, SW_RES(nResType), &rCoreSet, pStr != 0), 73cdf0e10cSrcweir m_bFormat(bFormat), 74cdf0e10cSrcweir m_bNew(bNewFrm), 75cdf0e10cSrcweir m_rSet(rCoreSet), 76cdf0e10cSrcweir m_nDlgType(nResType), 77cdf0e10cSrcweir m_pWrtShell(((SwView*)pViewFrame->GetViewShell())->GetWrtShellPtr()) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir FreeResource(); 80cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode(m_pWrtShell->GetView().GetDocShell()); 81cdf0e10cSrcweir m_bHTMLMode = static_cast< sal_Bool >(nHtmlMode & HTMLMODE_ON); 82cdf0e10cSrcweir 83cdf0e10cSrcweir // BspFont fuer beide Bsp-TabPages 84cdf0e10cSrcweir // 85cdf0e10cSrcweir if(pStr) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir String aTmp( GetText() ); 88cdf0e10cSrcweir aTmp += SW_RESSTR(STR_COLL_HEADER); 89cdf0e10cSrcweir aTmp += *pStr; 90cdf0e10cSrcweir aTmp += ')'; 91cdf0e10cSrcweir } 92cdf0e10cSrcweir 93cdf0e10cSrcweir AddTabPage(TP_FRM_STD, SwFrmPage::Create, 0); 94cdf0e10cSrcweir AddTabPage(TP_FRM_ADD, SwFrmAddPage::Create, 0); 95cdf0e10cSrcweir AddTabPage(TP_FRM_WRAP, SwWrapTabPage::Create, 0); 96cdf0e10cSrcweir AddTabPage(TP_FRM_URL, SwFrmURLPage::Create, 0); 97cdf0e10cSrcweir if(m_nDlgType == DLG_FRM_GRF) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir AddTabPage( TP_GRF_EXT, SwGrfExtPage::Create, 0 ); 100cdf0e10cSrcweir AddTabPage( RID_SVXPAGE_GRFCROP ); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir if (m_nDlgType == DLG_FRM_STD) 103cdf0e10cSrcweir { 104cdf0e10cSrcweir AddTabPage(TP_COLUMN, SwColumnPage::Create, 0); 105cdf0e10cSrcweir } 106cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 107cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 108cdf0e10cSrcweir AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); 109cdf0e10cSrcweir AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0); 110cdf0e10cSrcweir AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir if(m_bHTMLMode) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir switch( m_nDlgType ) 115cdf0e10cSrcweir { 116cdf0e10cSrcweir case DLG_FRM_STD: 117cdf0e10cSrcweir if(0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS)) 118cdf0e10cSrcweir RemoveTabPage(TP_BORDER); 119cdf0e10cSrcweir RemoveTabPage(TP_COLUMN); 120cdf0e10cSrcweir // kein break 121cdf0e10cSrcweir case DLG_FRM_OLE: 122cdf0e10cSrcweir RemoveTabPage(TP_FRM_URL); 123cdf0e10cSrcweir RemoveTabPage(TP_MACRO_ASSIGN); 124cdf0e10cSrcweir break; 125cdf0e10cSrcweir case DLG_FRM_GRF: 126cdf0e10cSrcweir RemoveTabPage(RID_SVXPAGE_GRFCROP); 127cdf0e10cSrcweir break; 128cdf0e10cSrcweir } 129cdf0e10cSrcweir if( 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS) || 130cdf0e10cSrcweir m_nDlgType != DLG_FRM_STD ) 131cdf0e10cSrcweir RemoveTabPage(TP_BACKGROUND); 132cdf0e10cSrcweir } 133cdf0e10cSrcweir 134cdf0e10cSrcweir if (m_bNew) 135cdf0e10cSrcweir SetCurPageId(TP_FRM_STD); 136cdf0e10cSrcweir 137cdf0e10cSrcweir if (nDefPage) 138cdf0e10cSrcweir SetCurPageId(nDefPage); 139cdf0e10cSrcweir } 140cdf0e10cSrcweir 141cdf0e10cSrcweir /*-------------------------------------------------------------------- 142cdf0e10cSrcweir Beschreibung: 143cdf0e10cSrcweir --------------------------------------------------------------------*/ 144cdf0e10cSrcweir 145cdf0e10cSrcweir SwFrmDlg::~SwFrmDlg() 146cdf0e10cSrcweir { 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir 150cdf0e10cSrcweir 151cdf0e10cSrcweir 152cdf0e10cSrcweir void SwFrmDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) 153cdf0e10cSrcweir { 154cdf0e10cSrcweir SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); 155cdf0e10cSrcweir switch ( nId ) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir case TP_FRM_STD: 158cdf0e10cSrcweir ((SwFrmPage&)rPage).SetNewFrame(m_bNew); 159cdf0e10cSrcweir ((SwFrmPage&)rPage).SetFormatUsed(m_bFormat); 160cdf0e10cSrcweir ((SwFrmPage&)rPage).SetFrmType(m_nDlgType); 161cdf0e10cSrcweir break; 162cdf0e10cSrcweir 163cdf0e10cSrcweir case TP_FRM_ADD: 164cdf0e10cSrcweir ((SwFrmAddPage&)rPage).SetFormatUsed(m_bFormat); 165cdf0e10cSrcweir ((SwFrmAddPage&)rPage).SetFrmType(m_nDlgType); 166cdf0e10cSrcweir ((SwFrmAddPage&)rPage).SetNewFrame(m_bNew); 167cdf0e10cSrcweir ((SwFrmAddPage&)rPage).SetShell(m_pWrtShell); 168cdf0e10cSrcweir break; 169cdf0e10cSrcweir 170cdf0e10cSrcweir case TP_FRM_WRAP: 171cdf0e10cSrcweir ((SwWrapTabPage&)rPage).SetNewFrame(m_bNew); 172cdf0e10cSrcweir ((SwWrapTabPage&)rPage).SetFormatUsed(m_bFormat, sal_False); 173cdf0e10cSrcweir ((SwWrapTabPage&)rPage).SetShell(m_pWrtShell); 174cdf0e10cSrcweir break; 175cdf0e10cSrcweir 176cdf0e10cSrcweir case TP_COLUMN: 177cdf0e10cSrcweir { 178cdf0e10cSrcweir ((SwColumnPage&)rPage).SetFrmMode(sal_True); 179cdf0e10cSrcweir ((SwColumnPage&)rPage).SetFormatUsed(m_bFormat); 180cdf0e10cSrcweir 181cdf0e10cSrcweir const SwFmtFrmSize& rSize = (const SwFmtFrmSize&) 182cdf0e10cSrcweir m_rSet.Get( RES_FRM_SIZE ); 183cdf0e10cSrcweir ((SwColumnPage&)rPage).SetPageWidth( rSize.GetWidth() ); 184cdf0e10cSrcweir } 185cdf0e10cSrcweir break; 186cdf0e10cSrcweir 187cdf0e10cSrcweir case TP_MACRO_ASSIGN: 188cdf0e10cSrcweir { 189cdf0e10cSrcweir SfxAllItemSet aNewSet(*aSet.GetPool()); 190cdf0e10cSrcweir aNewSet.Put( SwMacroAssignDlg::AddEvents( 191cdf0e10cSrcweir DLG_FRM_GRF == m_nDlgType ? MACASSGN_GRAPHIC : DLG_FRM_OLE == m_nDlgType ? MACASSGN_OLE : MACASSGN_FRMURL ) ); 192cdf0e10cSrcweir if ( m_pWrtShell ) 193cdf0e10cSrcweir rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() ); 194cdf0e10cSrcweir rPage.PageCreated(aNewSet); 195cdf0e10cSrcweir break; 196cdf0e10cSrcweir } 197cdf0e10cSrcweir 198cdf0e10cSrcweir case TP_BACKGROUND: 199cdf0e10cSrcweir if( DLG_FRM_STD == m_nDlgType ) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir sal_Int32 nFlagType = SVX_SHOW_SELECTOR; 202cdf0e10cSrcweir if(!m_bHTMLMode) 203cdf0e10cSrcweir nFlagType |= SVX_ENABLE_TRANSPARENCY; 204cdf0e10cSrcweir aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType)); 205cdf0e10cSrcweir rPage.PageCreated(aSet); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir break; 208cdf0e10cSrcweir 209cdf0e10cSrcweir case TP_BORDER: 210cdf0e10cSrcweir { 211cdf0e10cSrcweir aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME)); 212cdf0e10cSrcweir rPage.PageCreated(aSet); 213cdf0e10cSrcweir } 214cdf0e10cSrcweir break; 215cdf0e10cSrcweir } 216cdf0e10cSrcweir } 217cdf0e10cSrcweir 218