summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2009-09-17 14:37:24 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2009-09-17 14:37:24 +0000
commitd995b5e1caa0722859132c9905bea918496c4f02 (patch)
tree789b030375831cbf34925ca8f30dd4b65493bf07
parent77765a8e122b1ad2aaac1cf5a229d6b5f3247493 (diff)
CWS-TOOLING: integrate CWS os136
2009-09-08 08:51:21 +0200 os r275915 : #i104757# dropdown events also for key events 2009-09-04 13:13:14 +0200 os r275798 : #i104757# send event before opening a drop down list 2009-09-04 13:11:48 +0200 os r275797 : #i104757# dynamically load sub-regions in format/sections dialog
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx189
-rw-r--r--sw/source/ui/inc/regionsw.hxx18
2 files changed, 105 insertions, 102 deletions
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 6bed5be61b..88e3df03a2 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -34,29 +34,22 @@
#undef SW_DLLIMPLEMENTATION
#endif
-#include "hintids.hxx"
-#include "regionsw.hxx"
+#include <hintids.hxx>
+#include <regionsw.hxx>
#include <svtools/urihelper.hxx>
#include <svtools/PasswordHelper.hxx>
#include <vcl/svapp.hxx>
-#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
-#endif
#include <svtools/stritem.hxx>
#include <svtools/eitem.hxx>
-#ifndef _PASSWD_HXX //autogen
#include <sfx2/passwd.hxx>
-#endif
#include <sfx2/docfilt.hxx>
#include <sfx2/request.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/linkmgr.hxx>
#include <sfx2/docinsert.hxx>
#include <sfx2/filedlghelper.hxx>
-#ifndef _SVX_SIZEITEM_HXX //autogen
-
#include <svx/sizeitem.hxx>
-#endif
#include <svx/htmlcfg.hxx>
#include <comphelper/storagehelper.hxx>
@@ -65,15 +58,9 @@
#include <section.hxx>
#include <docary.hxx>
#include <doc.hxx> // fuers SwSectionFmt-Array
-#ifndef _BASESH_HXX
#include <basesh.hxx>
-#endif
-#ifndef _WDOCSH_HXX
#include <wdocsh.hxx>
-#endif
-#ifndef _VIEW_HXX
#include <view.hxx>
-#endif
#include <swmodule.hxx>
#include <wrtsh.hxx>
#include <swundo.hxx> // fuer Undo-Ids
@@ -82,27 +69,15 @@
#include <swunodef.hxx>
#include <shellio.hxx>
-#ifndef _HELPID_H
#include <helpid.h>
-#endif
-#ifndef _CMDID_H
#include <cmdid.h>
-#endif
-#ifndef _REGIONSW_HRC
#include <regionsw.hrc>
-#endif
-#ifndef _COMCORE_HRC
#include <comcore.hrc>
-#endif
-#ifndef _GLOBALS_HRC
#include <globals.hrc>
-#endif
#include <sfx2/bindings.hxx>
#include <svx/htmlmode.hxx>
#include <svx/dlgutil.hxx>
-#ifndef _SVX_DIALOGS_HRC
#include <svx/dialogs.hrc>
-#endif
#include <svx/svxdlg.hxx>
#include <svx/flagsdef.hxx>
@@ -115,7 +90,65 @@ SV_IMPL_PTRARR( SwSectionFmts, SwSectionFmtPtr )
SV_IMPL_OP_PTRARR_SORT( SectReprArr, SectReprPtr )
-static void lcl_ReadSections( SwWrtShell& rSh, SfxMedium& rMedium, ComboBox& rBox );
+static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox );
+
+void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames, const SwSectionFmt* pNewFmt )
+{
+ const SwSectionFmt* pFmt;
+ if( !pNewFmt )
+ {
+ USHORT nCount = rSh.GetSectionFmtCount();
+ for(USHORT i=0;i<nCount;i++)
+ {
+ SectionType eTmpType;
+ if( !(pFmt = &rSh.GetSectionFmt(i))->GetParent() &&
+ pFmt->IsInNodesArr() &&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ String* pString = new String(pFmt->GetSection()->GetName());
+ if(pAvailNames)
+ pAvailNames->InsertEntry(*pString);
+ rSubRegions.InsertEntry(*pString);
+ lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt );
+ }
+ }
+ }
+ else
+ {
+ SwSections aTmpArr;
+ USHORT nCnt = pNewFmt->GetChildSections(aTmpArr,SORTSECT_POS);
+ if( nCnt )
+ {
+ SectionType eTmpType;
+ for( USHORT n = 0; n < nCnt; ++n )
+ if( (pFmt = aTmpArr[n]->GetFmt())->IsInNodesArr()&&
+ (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
+ && TOX_HEADER_SECTION != eTmpType )
+ {
+ String* pString = new String(pFmt->GetSection()->GetName());
+ if(pAvailNames)
+ pAvailNames->InsertEntry(*pString);
+ rSubRegions.InsertEntry(*pString);
+ lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt );
+ }
+ }
+ }
+}
+
+void lcl_FillSubRegionList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAvailNames )
+{
+ lcl_FillList( rSh, rSubRegions, pAvailNames, 0 );
+ IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
+ for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
+ ppMark != pMarkAccess->getMarksEnd();
+ ppMark++)
+ {
+ const ::sw::mark::IMark* pBkmk = ppMark->get();
+ if( pBkmk->IsExpanded() )
+ rSubRegions.InsertEntry( pBkmk->GetName() );
+ }
+}
/* -----------------25.06.99 15:38-------------------
@@ -275,6 +308,7 @@ SwEditRegionDlg::SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh )
aFilePB ( this, SW_RES( PB_FILE ) ),
aSubRegionFT ( this, SW_RES( FT_SUBREG ) ) ,
aSubRegionED ( this, SW_RES( LB_SUBREG ) ) ,
+ bSubRegionsFilled( false ),
aProtectFL ( this, SW_RES( FL_PROTECT ) ),
aProtectCB ( this, SW_RES( CB_PROTECT ) ),
@@ -330,6 +364,8 @@ SwEditRegionDlg::SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh )
aFilePB.SetClickHdl ( LINK( this, SwEditRegionDlg, FileSearchHdl ));
aFileNameED.SetModifyHdl( LINK( this, SwEditRegionDlg, FileNameHdl ));
aSubRegionED.SetModifyHdl( LINK( this, SwEditRegionDlg, FileNameHdl ));
+ aSubRegionED.AddEventListener( LINK( this, SwEditRegionDlg, SubRegionEventHdl ));
+ aSubRegionED.EnableAutocomplete( sal_True, sal_True );
aTree.SetHelpId(HID_REGION_TREE);
aTree.SetSelectionMode( MULTIPLE_SELECTION );
@@ -667,6 +703,8 @@ IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox )
aDismiss.Enable();
String aFile = pRepr->GetFile();
String sSub = pRepr->GetSubRegion();
+ bSubRegionsFilled = false;
+ aSubRegionED.Clear();
if(aFile.Len()||sSub.Len())
{
aFileCB.Check(TRUE);
@@ -1174,6 +1212,8 @@ IMPL_LINK( SwEditRegionDlg, FileNameHdl, Edit *, pEdit )
SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData();
if(pEdit == &aFileNameED)
{
+ bSubRegionsFilled = false;
+ aSubRegionED.Clear();
if( aDDECB.IsChecked() )
{
String sLink( pEdit->GetText() );
@@ -1371,7 +1411,7 @@ IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg )
const SfxPoolItem* pItem;
if ( SFX_ITEM_SET == pMedium->GetItemSet()->GetItemState( SID_PASSWORD, FALSE, &pItem ) )
sPassword = ( (SfxStringItem*)pItem )->GetValue();
- ::lcl_ReadSections( rSh, *pMedium, aSubRegionED );
+ ::lcl_ReadSections( *pMedium, aSubRegionED );
delete pMedium;
}
}
@@ -1390,6 +1430,36 @@ IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg )
Application::SetDefDialogParent( m_pOldDefDlgParent );
return 0;
}
+/*-- 03.09.2009 16:24:18---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+IMPL_LINK( SwEditRegionDlg, SubRegionEventHdl, VclWindowEvent *, pEvent )
+{
+ if( !bSubRegionsFilled && pEvent && pEvent->GetId() == VCLEVENT_DROPDOWN_PRE_OPEN )
+ {
+ //if necessary fill the names bookmarks/sections/tables now
+
+ rtl::OUString sFileName = aFileNameED.GetText();
+ if(sFileName.getLength())
+ {
+ SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
+ INetURLObject aAbs;
+ if( pMedium )
+ aAbs = pMedium->GetURLObject();
+ sFileName = URIHelper::SmartRel2Abs(
+ aAbs, sFileName, URIHelper::GetMaybeFileHdl() );
+
+ //load file and set the shell
+ SfxMedium aMedium( sFileName, STREAM_STD_READ );
+ sFileName = aMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE );
+ ::lcl_ReadSections( aMedium, aSubRegionED );
+ }
+ else
+ lcl_FillSubRegionList( rSh, aSubRegionED, 0 );
+ bSubRegionsFilled = true;
+ }
+ return 0;
+}
/* -----------------------------08.05.2002 15:00------------------------------
@@ -1404,7 +1474,7 @@ Image SwEditRegionDlg::BuildBitmap(BOOL bProtect,BOOL bHidden, BOOL bHighContras
Beschreibung: Hilfsfunktion - Bereichsnamen aus dem Medium lesen
--------------------------------------------------------------------*/
-static void lcl_ReadSections( SwWrtShell& /*rSh*/, SfxMedium& rMedium, ComboBox& rBox )
+static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox )
{
rBox.Clear();
uno::Reference < embed::XStorage > xStg;
@@ -1604,16 +1674,7 @@ void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh)
aDDECommandFT .Hide();
}
- FillList();
- IDocumentMarkAccess* const pMarkAccess = m_pWrtSh->getIDocumentMarkAccess();
- for( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
- ppMark != pMarkAccess->getMarksEnd();
- ppMark++)
- {
- const ::sw::mark::IMark* pBkmk = ppMark->get();
- if( pBkmk->IsExpanded() )
- aSubRegionED.InsertEntry( pBkmk->GetName() );
- }
+ lcl_FillSubRegionList( *m_pWrtSh, aSubRegionED, &aCurName );
SwSection* pSect = ((SwInsertSectionTabDialog*)GetTabDialog())->GetSection();
if( pSect ) // etwas vorgegeben ?
@@ -1876,7 +1937,7 @@ IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFil
m_sFilePasswd = ( (SfxStringItem*)pItem )->GetValue();
aFileNameED.SetText( INetURLObject::decode(
m_sFileName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_UTF8 ) );
- ::lcl_ReadSections( *m_pWrtSh, *pMedium, aSubRegionED );
+ ::lcl_ReadSections( *pMedium, aSubRegionED );
delete pMedium;
}
}
@@ -1887,52 +1948,6 @@ IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFil
return 0;
}
-/*--------------------------------------------------------------------
- Beschreibung: Liste der verwendeten Namen fuellen
- --------------------------------------------------------------------*/
-
-void SwInsertSectionTabPage::FillList( const SwSectionFmt* pNewFmt )
-{
- const SwSectionFmt* pFmt;
- if( !pNewFmt )
- {
- USHORT nCount = m_pWrtSh->GetSectionFmtCount();
- for(USHORT i=0;i<nCount;i++)
- {
- SectionType eTmpType;
- if( !(pFmt = &m_pWrtSh->GetSectionFmt(i))->GetParent() &&
- pFmt->IsInNodesArr() &&
- (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
- && TOX_HEADER_SECTION != eTmpType )
- {
- String* pString = new String(pFmt->GetSection()->GetName());
- aCurName.InsertEntry(*pString);
- aSubRegionED.InsertEntry(*pString);
- FillList( pFmt );
- }
- }
- }
- else
- {
- SwSections aTmpArr;
- USHORT nCnt = pNewFmt->GetChildSections(aTmpArr,SORTSECT_POS);
- if( nCnt )
- {
- SectionType eTmpType;
- for( USHORT n = 0; n < nCnt; ++n )
- if( (pFmt = aTmpArr[n]->GetFmt())->IsInNodesArr()&&
- (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION
- && TOX_HEADER_SECTION != eTmpType )
- {
- String* pString = new String(pFmt->GetSection()->GetName());
- aCurName.InsertEntry(*pString);
- aSubRegionED.InsertEntry(*pString);
- FillList( pFmt );
- }
- }
- }
-}
-
// --------------------------------------------------------------
// Numerierungsformat Umsetzung:
diff --git a/sw/source/ui/inc/regionsw.hxx b/sw/source/ui/inc/regionsw.hxx
index 0d9e77616b..a7347c0aa7 100644
--- a/sw/source/ui/inc/regionsw.hxx
+++ b/sw/source/ui/inc/regionsw.hxx
@@ -33,35 +33,23 @@
#include <hintids.hxx>
#include <vcl/field.hxx>
#include <vcl/lstbox.hxx>
-#ifndef _EDIT_HXX //autogen
#include <vcl/edit.hxx>
-#endif
-#ifndef _BUTTON_HXX //autogen
#include <vcl/button.hxx>
-#endif
-#ifndef _FIXED_HXX //autogen
#include <vcl/fixed.hxx>
-#endif
-#ifndef _COMBOBOX_HXX //autogen
#include <vcl/combobox.hxx>
-#endif
-#ifndef _GROUP_HXX //autogen
#include <vcl/group.hxx>
-#endif
#include <svtools/svtreebx.hxx>
#include <sfx2/basedlgs.hxx>
#include <sfx2/tabdlg.hxx>
#include <svx/brshitem.hxx>
-#ifndef _CONDEDIT_HXX
#include <condedit.hxx>
-#endif
#include <section.hxx>
#include <fmtclds.hxx>
#include <fmtftntx.hxx>
#include <fmtclbl.hxx>
#include <numberingtypelistbox.hxx>
-#include "svx/frmdiritem.hxx"
+#include <svx/frmdiritem.hxx>
#include <vcl/image.hxx>
#include <svx/paraprev.hxx>
#include <svx/lrspitem.hxx>
@@ -179,6 +167,7 @@ class SwEditRegionDlg : public SfxModalDialog
PushButton aFilePB;
FixedText aSubRegionFT;
ComboBox aSubRegionED;
+ bool bSubRegionsFilled;
FixedLine aProtectFL;
TriStateBox aProtectCB;
@@ -239,6 +228,7 @@ class SwEditRegionDlg : public SfxModalDialog
DECL_LINK( FileNameHdl, Edit* );
DECL_LINK( DDEHdl, CheckBox* );
DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper* );
+ DECL_LINK( SubRegionEventHdl, VclWindowEvent * );
BOOL CheckPasswd(CheckBox* pBox = 0);
@@ -308,8 +298,6 @@ class SwInsertSectionTabPage : public SfxTabPage
DECL_LINK( DDEHdl, CheckBox* );
DECL_LINK( DlgClosedHdl, sfx2::FileDialogHelper* );
- void FillList( const SwSectionFmt* pFmt = 0 );
-
public:
SwInsertSectionTabPage(Window *pParent, const SfxItemSet &rAttrSet);
virtual ~SwInsertSectionTabPage();