1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svx.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifndef _SVX_FMRESIDS_HRC 32*cdf0e10cSrcweir #include "svx/fmresids.hrc" 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir #ifndef _SVX_FMEXPL_HRC 35*cdf0e10cSrcweir #include "fmexpl.hrc" 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #include "fmexpl.hxx" 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #ifndef _SVX_FMHELP_HRC 40*cdf0e10cSrcweir #include "fmhelp.hrc" 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir #include <svx/fmglob.hxx> 43*cdf0e10cSrcweir #include "fmservs.hxx" 44*cdf0e10cSrcweir #include <svx/fmmodel.hxx> 45*cdf0e10cSrcweir #include "fmexch.hxx" 46*cdf0e10cSrcweir #include "fmundo.hxx" 47*cdf0e10cSrcweir #include "fmpgeimp.hxx" 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC 50*cdf0e10cSrcweir #include <svx/svxids.hrc> 51*cdf0e10cSrcweir #endif 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir #ifndef _SVX_FMPROP_HRC 54*cdf0e10cSrcweir #include "fmprop.hrc" 55*cdf0e10cSrcweir #endif 56*cdf0e10cSrcweir #include <svx/dialmgr.hxx> 57*cdf0e10cSrcweir #include "svx/svditer.hxx" 58*cdf0e10cSrcweir #include <svx/svdouno.hxx> 59*cdf0e10cSrcweir #include <fmundo.hxx> 60*cdf0e10cSrcweir #include <svx/svdobj.hxx> 61*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 62*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 63*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 64*cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 65*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 66*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 67*cdf0e10cSrcweir #include <com/sun/star/form/FormComponentType.hpp> 68*cdf0e10cSrcweir #include <com/sun/star/awt/XTabControllerModel.hpp> 69*cdf0e10cSrcweir #include <vcl/menu.hxx> 70*cdf0e10cSrcweir #include <sfx2/objitem.hxx> 71*cdf0e10cSrcweir #include <sfx2/request.hxx> 72*cdf0e10cSrcweir #include <tools/shl.hxx> 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir #ifndef _WRKWIN_HXX //autogen 75*cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 76*cdf0e10cSrcweir #endif 77*cdf0e10cSrcweir #include <vcl/sound.hxx> 78*cdf0e10cSrcweir #include <svx/fmshell.hxx> 79*cdf0e10cSrcweir #include "fmshimp.hxx" 80*cdf0e10cSrcweir #include <svx/fmpage.hxx> 81*cdf0e10cSrcweir #include <com/sun/star/io/XPersistObject.hpp> 82*cdf0e10cSrcweir #include <com/sun/star/script/XEventAttacherManager.hpp> 83*cdf0e10cSrcweir #include <com/sun/star/sdb/CommandType.hpp> 84*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 85*cdf0e10cSrcweir #include <comphelper/property.hxx> 86*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 87*cdf0e10cSrcweir #include <osl/diagnose.h> 88*cdf0e10cSrcweir #include <rtl/logfile.hxx> 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir using namespace ::svxform; 91*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 92*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc; 93*cdf0e10cSrcweir using namespace ::com::sun::star::sdb; 94*cdf0e10cSrcweir using namespace ::com::sun::star::form; 95*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 96*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 97*cdf0e10cSrcweir using namespace ::com::sun::star::container; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir //======================================================================== 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir SV_IMPL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr ) 102*cdf0e10cSrcweir SV_IMPL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr ) 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir //======================================================================== 105*cdf0e10cSrcweir // class FmNavInsertedHint 106*cdf0e10cSrcweir //======================================================================== 107*cdf0e10cSrcweir TYPEINIT1( FmNavInsertedHint, SfxHint ); 108*cdf0e10cSrcweir DBG_NAME(FmNavInsertedHint); 109*cdf0e10cSrcweir //------------------------------------------------------------------------ 110*cdf0e10cSrcweir FmNavInsertedHint::FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos ) 111*cdf0e10cSrcweir :pEntryData( pInsertedEntryData ) 112*cdf0e10cSrcweir ,nPos( nRelPos ) 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir DBG_CTOR(FmNavInsertedHint,NULL); 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir //------------------------------------------------------------------------ 119*cdf0e10cSrcweir FmNavInsertedHint::~FmNavInsertedHint() 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir DBG_DTOR(FmNavInsertedHint,NULL); 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir //======================================================================== 126*cdf0e10cSrcweir // class FmNavInsertedHint 127*cdf0e10cSrcweir //======================================================================== 128*cdf0e10cSrcweir TYPEINIT1( FmNavModelReplacedHint, SfxHint ); 129*cdf0e10cSrcweir DBG_NAME(FmNavModelReplacedHint); 130*cdf0e10cSrcweir //------------------------------------------------------------------------ 131*cdf0e10cSrcweir FmNavModelReplacedHint::FmNavModelReplacedHint( FmEntryData* pAffectedEntryData ) 132*cdf0e10cSrcweir :pEntryData( pAffectedEntryData ) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir DBG_CTOR(FmNavModelReplacedHint,NULL); 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir //------------------------------------------------------------------------ 138*cdf0e10cSrcweir FmNavModelReplacedHint::~FmNavModelReplacedHint() 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir DBG_DTOR(FmNavModelReplacedHint,NULL); 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir //======================================================================== 144*cdf0e10cSrcweir // class FmNavRemovedHint 145*cdf0e10cSrcweir //======================================================================== 146*cdf0e10cSrcweir TYPEINIT1( FmNavRemovedHint, SfxHint ); 147*cdf0e10cSrcweir DBG_NAME(FmNavRemovedHint); 148*cdf0e10cSrcweir //------------------------------------------------------------------------ 149*cdf0e10cSrcweir FmNavRemovedHint::FmNavRemovedHint( FmEntryData* pRemovedEntryData ) 150*cdf0e10cSrcweir :pEntryData( pRemovedEntryData ) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir DBG_CTOR(FmNavRemovedHint,NULL); 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir //------------------------------------------------------------------------ 156*cdf0e10cSrcweir FmNavRemovedHint::~FmNavRemovedHint() 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir DBG_DTOR(FmNavRemovedHint,NULL); 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir //======================================================================== 163*cdf0e10cSrcweir // class FmNavNameChangedHint 164*cdf0e10cSrcweir //======================================================================== 165*cdf0e10cSrcweir TYPEINIT1( FmNavNameChangedHint, SfxHint ); 166*cdf0e10cSrcweir DBG_NAME(FmNavNameChangedHint); 167*cdf0e10cSrcweir //------------------------------------------------------------------------ 168*cdf0e10cSrcweir FmNavNameChangedHint::FmNavNameChangedHint( FmEntryData* pData, const ::rtl::OUString& rNewName ) 169*cdf0e10cSrcweir :pEntryData( pData ) 170*cdf0e10cSrcweir ,aNewName( rNewName ) 171*cdf0e10cSrcweir { 172*cdf0e10cSrcweir DBG_CTOR(FmNavNameChangedHint,NULL); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir //------------------------------------------------------------------------ 176*cdf0e10cSrcweir FmNavNameChangedHint::~FmNavNameChangedHint() 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir DBG_DTOR(FmNavNameChangedHint,NULL); 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir //======================================================================== 182*cdf0e10cSrcweir // class FmNavClearedHint 183*cdf0e10cSrcweir //======================================================================== 184*cdf0e10cSrcweir TYPEINIT1( FmNavClearedHint, SfxHint ); 185*cdf0e10cSrcweir DBG_NAME(FmNavClearedHint); 186*cdf0e10cSrcweir //------------------------------------------------------------------------ 187*cdf0e10cSrcweir FmNavClearedHint::FmNavClearedHint() 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir DBG_CTOR(FmNavClearedHint,NULL); 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir //------------------------------------------------------------------------ 193*cdf0e10cSrcweir FmNavClearedHint::~FmNavClearedHint() 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir DBG_DTOR(FmNavClearedHint,NULL); 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir //======================================================================== 199*cdf0e10cSrcweir // class FmNavRequestSelectHint 200*cdf0e10cSrcweir //======================================================================== 201*cdf0e10cSrcweir TYPEINIT1(FmNavRequestSelectHint, SfxHint); 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir //======================================================================== 204*cdf0e10cSrcweir // class FmNavViewMarksChanged 205*cdf0e10cSrcweir //======================================================================== 206*cdf0e10cSrcweir TYPEINIT1(FmNavViewMarksChanged, SfxHint); 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir //======================================================================== 209*cdf0e10cSrcweir // class FmEntryDataList 210*cdf0e10cSrcweir //======================================================================== 211*cdf0e10cSrcweir DBG_NAME(FmEntryDataList); 212*cdf0e10cSrcweir //------------------------------------------------------------------------ 213*cdf0e10cSrcweir FmEntryDataList::FmEntryDataList() 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir DBG_CTOR(FmEntryDataList,NULL); 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir //------------------------------------------------------------------------ 219*cdf0e10cSrcweir FmEntryDataList::~FmEntryDataList() 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir DBG_DTOR(FmEntryDataList,NULL); 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir //======================================================================== 226*cdf0e10cSrcweir // class FmEntryData 227*cdf0e10cSrcweir //======================================================================== 228*cdf0e10cSrcweir TYPEINIT0( FmEntryData ); 229*cdf0e10cSrcweir DBG_NAME(FmEntryData); 230*cdf0e10cSrcweir //------------------------------------------------------------------------ 231*cdf0e10cSrcweir FmEntryData::FmEntryData( FmEntryData* pParentData, const Reference< XInterface >& _rxIFace ) 232*cdf0e10cSrcweir :pParent( pParentData ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::FmEntryData" ); 235*cdf0e10cSrcweir DBG_CTOR(FmEntryData,NULL); 236*cdf0e10cSrcweir pChildList = new FmEntryDataList(); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir newObject( _rxIFace ); 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir //------------------------------------------------------------------------ 242*cdf0e10cSrcweir FmEntryData::~FmEntryData() 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir Clear(); 245*cdf0e10cSrcweir delete pChildList; 246*cdf0e10cSrcweir DBG_DTOR(FmEntryData,NULL); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir //------------------------------------------------------------------------ 250*cdf0e10cSrcweir void FmEntryData::newObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace ) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::newObject" ); 253*cdf0e10cSrcweir // do not just copy, normalize it 254*cdf0e10cSrcweir m_xNormalizedIFace = Reference< XInterface >( _rxIFace, UNO_QUERY ); 255*cdf0e10cSrcweir m_xProperties = m_xProperties.query( m_xNormalizedIFace ); 256*cdf0e10cSrcweir m_xChild = m_xChild.query( m_xNormalizedIFace ); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir //------------------------------------------------------------------------ 260*cdf0e10cSrcweir FmEntryData::FmEntryData( const FmEntryData& rEntryData ) 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::FmEntryData" ); 263*cdf0e10cSrcweir pChildList = new FmEntryDataList(); 264*cdf0e10cSrcweir aText = rEntryData.GetText(); 265*cdf0e10cSrcweir m_aNormalImage = rEntryData.GetNormalImage(); 266*cdf0e10cSrcweir m_aHCImage = rEntryData.GetHCImage(); 267*cdf0e10cSrcweir pParent = rEntryData.GetParent(); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir FmEntryData* pChildData; 270*cdf0e10cSrcweir sal_uInt32 nEntryCount = rEntryData.GetChildList()->Count(); 271*cdf0e10cSrcweir for( sal_uInt32 i=0; i<nEntryCount; i++ ) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir pChildData = rEntryData.GetChildList()->GetObject(i); 274*cdf0e10cSrcweir FmEntryData* pNewChildData = pChildData->Clone(); 275*cdf0e10cSrcweir pChildList->Insert( pNewChildData, LIST_APPEND ); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir m_xNormalizedIFace = rEntryData.m_xNormalizedIFace; 279*cdf0e10cSrcweir m_xProperties = rEntryData.m_xProperties; 280*cdf0e10cSrcweir m_xChild = rEntryData.m_xChild; 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir //------------------------------------------------------------------------ 284*cdf0e10cSrcweir void FmEntryData::Clear() 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::Clear" ); 287*cdf0e10cSrcweir for (;;) 288*cdf0e10cSrcweir { 289*cdf0e10cSrcweir FmEntryData* pEntryData = GetChildList()->Remove(sal_uLong(0)); 290*cdf0e10cSrcweir if (pEntryData == NULL) 291*cdf0e10cSrcweir break; 292*cdf0e10cSrcweir delete pEntryData; 293*cdf0e10cSrcweir } 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir //------------------------------------------------------------------------ 297*cdf0e10cSrcweir sal_Bool FmEntryData::IsEqualWithoutChilds( FmEntryData* pEntryData ) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::IsEqualWithoutChilds" ); 300*cdf0e10cSrcweir if(this == pEntryData) 301*cdf0e10cSrcweir return sal_True; 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir if( !pEntryData ) 304*cdf0e10cSrcweir return sal_False; 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir if( !aText.equals(pEntryData->GetText())) 307*cdf0e10cSrcweir return sal_False; 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir if( !pEntryData->GetParent() && pParent ) 310*cdf0e10cSrcweir return sal_False; 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir if( pEntryData->GetParent() && !pParent ) 313*cdf0e10cSrcweir return sal_False; 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir if( !pEntryData->GetParent() && !pParent ) 316*cdf0e10cSrcweir return sal_True; 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir if( !pParent->IsEqualWithoutChilds(pEntryData->GetParent()) ) 319*cdf0e10cSrcweir return sal_False; 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir return sal_True; 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir //======================================================================== 326*cdf0e10cSrcweir // class FmFormData 327*cdf0e10cSrcweir //======================================================================== 328*cdf0e10cSrcweir TYPEINIT1( FmFormData, FmEntryData ); 329*cdf0e10cSrcweir DBG_NAME(FmFormData); 330*cdf0e10cSrcweir //------------------------------------------------------------------------ 331*cdf0e10cSrcweir FmFormData::FmFormData( const Reference< XForm >& _rxForm, const ImageList& _rNormalImages, const ImageList& _rHCImages, FmFormData* _pParent ) 332*cdf0e10cSrcweir :FmEntryData( _pParent, _rxForm ) 333*cdf0e10cSrcweir ,m_xForm( _rxForm ) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir DBG_CTOR(FmEntryData,NULL); 336*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 337*cdf0e10cSrcweir // Images setzen 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir m_aNormalImage = _rNormalImages.GetImage( RID_SVXIMG_FORM ); 340*cdf0e10cSrcweir m_aHCImage = _rHCImages.GetImage( RID_SVXIMG_FORM ); 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 343*cdf0e10cSrcweir // Titel setzen 344*cdf0e10cSrcweir if (m_xForm.is()) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir Reference< XPropertySet > xSet(m_xForm, UNO_QUERY); 347*cdf0e10cSrcweir if (xSet.is()) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir ::rtl::OUString aEntryName(::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME ))); 350*cdf0e10cSrcweir SetText(aEntryName); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir else 354*cdf0e10cSrcweir SetText( ::rtl::OUString() ); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir //------------------------------------------------------------------------ 358*cdf0e10cSrcweir FmFormData::~FmFormData() 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir DBG_DTOR(FmEntryData,NULL); 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir //------------------------------------------------------------------------ 364*cdf0e10cSrcweir FmFormData::FmFormData( const FmFormData& rFormData ) 365*cdf0e10cSrcweir :FmEntryData( rFormData ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir DBG_CTOR(FmEntryData,NULL); 368*cdf0e10cSrcweir m_xForm = rFormData.GetFormIface(); 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir //------------------------------------------------------------------------ 372*cdf0e10cSrcweir FmEntryData* FmFormData::Clone() 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir return new FmFormData( *this ); 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir //------------------------------------------------------------------------ 378*cdf0e10cSrcweir sal_Bool FmFormData::IsEqualWithoutChilds( FmEntryData* pEntryData ) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir if(this == pEntryData) 381*cdf0e10cSrcweir return sal_True; 382*cdf0e10cSrcweir if( !pEntryData->ISA(FmFormData) ) 383*cdf0e10cSrcweir return sal_False; 384*cdf0e10cSrcweir FmFormData* pFormData = (FmFormData*)pEntryData; 385*cdf0e10cSrcweir if( (XForm*)m_xForm.get() != (XForm*)pFormData->GetFormIface().get() ) 386*cdf0e10cSrcweir return sal_False; 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir return FmEntryData::IsEqualWithoutChilds( pFormData ); 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir //======================================================================== 393*cdf0e10cSrcweir // class FmControlData 394*cdf0e10cSrcweir //======================================================================== 395*cdf0e10cSrcweir TYPEINIT1( FmControlData, FmEntryData ); 396*cdf0e10cSrcweir DBG_NAME(FmControlData); 397*cdf0e10cSrcweir //------------------------------------------------------------------------ 398*cdf0e10cSrcweir FmControlData::FmControlData( const Reference< XFormComponent >& _rxComponent, const ImageList& _rNormalImages, const ImageList& _rHCImages, FmFormData* _pParent ) 399*cdf0e10cSrcweir :FmEntryData( _pParent, _rxComponent ) 400*cdf0e10cSrcweir ,m_xFormComponent( _rxComponent ) 401*cdf0e10cSrcweir { 402*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::FmControlData" ); 403*cdf0e10cSrcweir DBG_CTOR(FmControlData,NULL); 404*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 405*cdf0e10cSrcweir // Images setzen 406*cdf0e10cSrcweir m_aNormalImage = GetImage( _rNormalImages ); 407*cdf0e10cSrcweir m_aHCImage = GetImage( _rHCImages ); 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 410*cdf0e10cSrcweir // Titel setzen 411*cdf0e10cSrcweir Reference< XPropertySet > xSet(m_xFormComponent, UNO_QUERY); 412*cdf0e10cSrcweir if( xSet.is() ) 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir #ifdef DBG_UTIL 415*cdf0e10cSrcweir ::rtl::OUString aEntryName = ::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME )); 416*cdf0e10cSrcweir #endif 417*cdf0e10cSrcweir SetText( ::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME ))); 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir } 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir //------------------------------------------------------------------------ 422*cdf0e10cSrcweir FmControlData::~FmControlData() 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir DBG_DTOR(FmControlData,NULL); 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir //------------------------------------------------------------------------ 428*cdf0e10cSrcweir FmControlData::FmControlData( const FmControlData& rControlData ) 429*cdf0e10cSrcweir :FmEntryData( rControlData ) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir DBG_CTOR(FmControlData,NULL); 432*cdf0e10cSrcweir m_xFormComponent = rControlData.GetFormComponent(); 433*cdf0e10cSrcweir } 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir //------------------------------------------------------------------------ 436*cdf0e10cSrcweir FmEntryData* FmControlData::Clone() 437*cdf0e10cSrcweir { 438*cdf0e10cSrcweir return new FmControlData( *this ); 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir //------------------------------------------------------------------------ 442*cdf0e10cSrcweir Image FmControlData::GetImage(const ImageList& ilNavigatorImages) const 443*cdf0e10cSrcweir { 444*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::FmControlData" ); 445*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 446*cdf0e10cSrcweir // Default-Image 447*cdf0e10cSrcweir Image aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CONTROL ); 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir Reference< XServiceInfo > xInfo( m_xFormComponent, UNO_QUERY ); 450*cdf0e10cSrcweir if (!m_xFormComponent.is()) 451*cdf0e10cSrcweir return aImage; 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////// 454*cdf0e10cSrcweir // Spezielle Control-Images 455*cdf0e10cSrcweir sal_Int16 nObjectType = getControlTypeByObject(xInfo); 456*cdf0e10cSrcweir switch (nObjectType) 457*cdf0e10cSrcweir { 458*cdf0e10cSrcweir case OBJ_FM_BUTTON: 459*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_BUTTON ); 460*cdf0e10cSrcweir break; 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir case OBJ_FM_FIXEDTEXT: 463*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FIXEDTEXT ); 464*cdf0e10cSrcweir break; 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir case OBJ_FM_EDIT: 467*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_EDIT ); 468*cdf0e10cSrcweir break; 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir case OBJ_FM_RADIOBUTTON: 471*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_RADIOBUTTON ); 472*cdf0e10cSrcweir break; 473*cdf0e10cSrcweir 474*cdf0e10cSrcweir case OBJ_FM_CHECKBOX: 475*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CHECKBOX ); 476*cdf0e10cSrcweir break; 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir case OBJ_FM_LISTBOX: 479*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_LISTBOX ); 480*cdf0e10cSrcweir break; 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir case OBJ_FM_COMBOBOX: 483*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_COMBOBOX ); 484*cdf0e10cSrcweir break; 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir case OBJ_FM_NAVIGATIONBAR: 487*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_NAVIGATIONBAR ); 488*cdf0e10cSrcweir break; 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir case OBJ_FM_GROUPBOX: 491*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_GROUPBOX ); 492*cdf0e10cSrcweir break; 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir case OBJ_FM_IMAGEBUTTON: 495*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_IMAGEBUTTON ); 496*cdf0e10cSrcweir break; 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir case OBJ_FM_FILECONTROL: 499*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FILECONTROL ); 500*cdf0e10cSrcweir break; 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir case OBJ_FM_HIDDEN: 503*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_HIDDEN ); 504*cdf0e10cSrcweir break; 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir case OBJ_FM_DATEFIELD: 507*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_DATEFIELD ); 508*cdf0e10cSrcweir break; 509*cdf0e10cSrcweir 510*cdf0e10cSrcweir case OBJ_FM_TIMEFIELD: 511*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_TIMEFIELD ); 512*cdf0e10cSrcweir break; 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir case OBJ_FM_NUMERICFIELD: 515*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_NUMERICFIELD ); 516*cdf0e10cSrcweir break; 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir case OBJ_FM_CURRENCYFIELD: 519*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CURRENCYFIELD ); 520*cdf0e10cSrcweir break; 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir case OBJ_FM_PATTERNFIELD: 523*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_PATTERNFIELD ); 524*cdf0e10cSrcweir break; 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir case OBJ_FM_IMAGECONTROL: 527*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_IMAGECONTROL ); 528*cdf0e10cSrcweir break; 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir case OBJ_FM_FORMATTEDFIELD: 531*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FORMATTEDFIELD ); 532*cdf0e10cSrcweir break; 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir case OBJ_FM_GRID: 535*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_GRID ); 536*cdf0e10cSrcweir break; 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir case OBJ_FM_SCROLLBAR: 539*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_SCROLLBAR ); 540*cdf0e10cSrcweir break; 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir case OBJ_FM_SPINBUTTON: 543*cdf0e10cSrcweir aImage = ilNavigatorImages.GetImage( RID_SVXIMG_SPINBUTTON); 544*cdf0e10cSrcweir break; 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir return aImage; 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir //------------------------------------------------------------------------ 551*cdf0e10cSrcweir sal_Bool FmControlData::IsEqualWithoutChilds( FmEntryData* pEntryData ) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::IsEqualWithoutChilds" ); 554*cdf0e10cSrcweir if(this == pEntryData) 555*cdf0e10cSrcweir return sal_True; 556*cdf0e10cSrcweir 557*cdf0e10cSrcweir if( !pEntryData->ISA(FmControlData) ) 558*cdf0e10cSrcweir return sal_False; 559*cdf0e10cSrcweir FmControlData* pControlData = (FmControlData*)pEntryData; 560*cdf0e10cSrcweir 561*cdf0e10cSrcweir if( (XFormComponent*)m_xFormComponent.get() != (XFormComponent*)pControlData->GetFormComponent().get() ) 562*cdf0e10cSrcweir return sal_False; 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir return FmEntryData::IsEqualWithoutChilds( pControlData ); 565*cdf0e10cSrcweir } 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir //------------------------------------------------------------------------ 568*cdf0e10cSrcweir void FmControlData::ModelReplaced( const Reference< XFormComponent >& _rxNew, const ImageList& _rNormalImages, const ImageList& _rHCImages ) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::ModelReplaced" ); 571*cdf0e10cSrcweir m_xFormComponent = _rxNew; 572*cdf0e10cSrcweir newObject( m_xFormComponent ); 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir // Images neu setzen 575*cdf0e10cSrcweir m_aNormalImage = GetImage( _rNormalImages ); 576*cdf0e10cSrcweir m_aHCImage = GetImage( _rHCImages ); 577*cdf0e10cSrcweir } 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir //............................................................................ 580*cdf0e10cSrcweir namespace svxform 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir //............................................................................ 583*cdf0e10cSrcweir 584*cdf0e10cSrcweir //======================================================================== 585*cdf0e10cSrcweir // class NavigatorFrame 586*cdf0e10cSrcweir //======================================================================== 587*cdf0e10cSrcweir DBG_NAME(NavigatorFrame) 588*cdf0e10cSrcweir //------------------------------------------------------------------------ 589*cdf0e10cSrcweir NavigatorFrame::NavigatorFrame( SfxBindings* _pBindings, SfxChildWindow* _pMgr, 590*cdf0e10cSrcweir Window* _pParent ) 591*cdf0e10cSrcweir :SfxDockingWindow( _pBindings, _pMgr, _pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_ROLLABLE|WB_3DLOOK|WB_DOCKABLE) ) 592*cdf0e10cSrcweir ,SfxControllerItem( SID_FM_FMEXPLORER_CONTROL, *_pBindings ) 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir DBG_CTOR(NavigatorFrame,NULL); 595*cdf0e10cSrcweir SetHelpId( HID_FORM_NAVIGATOR_WIN ); 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir m_pNavigatorTree = new NavigatorTree(comphelper::getProcessServiceFactory(), this ); 598*cdf0e10cSrcweir m_pNavigatorTree->Show(); 599*cdf0e10cSrcweir SetText( SVX_RES(RID_STR_FMEXPLORER) ); 600*cdf0e10cSrcweir SfxDockingWindow::SetFloatingSize( Size(200,200) ); 601*cdf0e10cSrcweir } 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir //------------------------------------------------------------------------ 604*cdf0e10cSrcweir NavigatorFrame::~NavigatorFrame() 605*cdf0e10cSrcweir { 606*cdf0e10cSrcweir delete m_pNavigatorTree; 607*cdf0e10cSrcweir DBG_DTOR(NavigatorFrame,NULL); 608*cdf0e10cSrcweir } 609*cdf0e10cSrcweir 610*cdf0e10cSrcweir //----------------------------------------------------------------------- 611*cdf0e10cSrcweir void NavigatorFrame::UpdateContent( FmFormShell* pFormShell ) 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir m_pNavigatorTree->UpdateContent( pFormShell ); 614*cdf0e10cSrcweir } 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir //----------------------------------------------------------------------- 617*cdf0e10cSrcweir void NavigatorFrame::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir if( !pState || SID_FM_FMEXPLORER_CONTROL != nSID ) 620*cdf0e10cSrcweir return; 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir if( eState >= SFX_ITEM_AVAILABLE ) 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir FmFormShell* pShell = PTR_CAST( FmFormShell,((SfxObjectItem*)pState)->GetShell() ); 625*cdf0e10cSrcweir UpdateContent( pShell ); 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir else 628*cdf0e10cSrcweir UpdateContent( NULL ); 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir 631*cdf0e10cSrcweir //----------------------------------------------------------------------- 632*cdf0e10cSrcweir void NavigatorFrame::GetFocus() 633*cdf0e10cSrcweir { 634*cdf0e10cSrcweir if ( m_pNavigatorTree ) 635*cdf0e10cSrcweir m_pNavigatorTree->GrabFocus(); 636*cdf0e10cSrcweir else 637*cdf0e10cSrcweir SfxDockingWindow::GetFocus(); 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir //----------------------------------------------------------------------- 641*cdf0e10cSrcweir sal_Bool NavigatorFrame::Close() 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir UpdateContent( NULL ); 644*cdf0e10cSrcweir return SfxDockingWindow::Close(); 645*cdf0e10cSrcweir } 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir //----------------------------------------------------------------------- 648*cdf0e10cSrcweir void NavigatorFrame::FillInfo( SfxChildWinInfo& rInfo ) const 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir SfxDockingWindow::FillInfo( rInfo ); 651*cdf0e10cSrcweir rInfo.bVisible = sal_False; 652*cdf0e10cSrcweir } 653*cdf0e10cSrcweir 654*cdf0e10cSrcweir //----------------------------------------------------------------------- 655*cdf0e10cSrcweir Size NavigatorFrame::CalcDockingSize( SfxChildAlignment eAlign ) 656*cdf0e10cSrcweir { 657*cdf0e10cSrcweir if ( ( eAlign == SFX_ALIGN_TOP ) || ( eAlign == SFX_ALIGN_BOTTOM ) ) 658*cdf0e10cSrcweir return Size(); 659*cdf0e10cSrcweir 660*cdf0e10cSrcweir return SfxDockingWindow::CalcDockingSize( eAlign ); 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir //----------------------------------------------------------------------- 664*cdf0e10cSrcweir SfxChildAlignment NavigatorFrame::CheckAlignment( SfxChildAlignment _eActAlign, SfxChildAlignment _eAlign ) 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir if ( ( _eAlign == SFX_ALIGN_LEFT ) || ( _eAlign == SFX_ALIGN_RIGHT ) || ( _eAlign == SFX_ALIGN_NOALIGNMENT ) ) 667*cdf0e10cSrcweir return _eAlign; 668*cdf0e10cSrcweir return _eActAlign; 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir //------------------------------------------------------------------------ 672*cdf0e10cSrcweir void NavigatorFrame::Resize() 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir SfxDockingWindow::Resize(); 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir Size aLogOutputSize = PixelToLogic( GetOutputSizePixel(), MAP_APPFONT ); 677*cdf0e10cSrcweir Size aLogExplSize = aLogOutputSize; 678*cdf0e10cSrcweir aLogExplSize.Width() -= 6; 679*cdf0e10cSrcweir aLogExplSize.Height() -= 6; 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir Point aExplPos = LogicToPixel( Point(3,3), MAP_APPFONT ); 682*cdf0e10cSrcweir Size aExplSize = LogicToPixel( aLogExplSize, MAP_APPFONT ); 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir m_pNavigatorTree->SetPosSizePixel( aExplPos, aExplSize ); 685*cdf0e10cSrcweir } 686*cdf0e10cSrcweir 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir //======================================================================== 689*cdf0e10cSrcweir // class NavigatorFrameManager 690*cdf0e10cSrcweir //======================================================================== 691*cdf0e10cSrcweir 692*cdf0e10cSrcweir //----------------------------------------------------------------------- 693*cdf0e10cSrcweir SFX_IMPL_DOCKINGWINDOW( NavigatorFrameManager, SID_FM_SHOW_FMEXPLORER ) 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir //----------------------------------------------------------------------- 696*cdf0e10cSrcweir NavigatorFrameManager::NavigatorFrameManager( Window* _pParent, sal_uInt16 _nId, 697*cdf0e10cSrcweir SfxBindings* _pBindings, SfxChildWinInfo* _pInfo ) 698*cdf0e10cSrcweir :SfxChildWindow( _pParent, _nId ) 699*cdf0e10cSrcweir { 700*cdf0e10cSrcweir pWindow = new NavigatorFrame( _pBindings, this, _pParent ); 701*cdf0e10cSrcweir eChildAlignment = SFX_ALIGN_NOALIGNMENT; 702*cdf0e10cSrcweir ((SfxDockingWindow*)pWindow)->Initialize( _pInfo ); 703*cdf0e10cSrcweir } 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir //............................................................................ 706*cdf0e10cSrcweir } // namespace svxform 707*cdf0e10cSrcweir //............................................................................ 708