diff options
author | Oliver Specht <os@openoffice.org> | 2000-12-21 11:12:43 +0000 |
---|---|---|
committer | Oliver Specht <os@openoffice.org> | 2000-12-21 11:12:43 +0000 |
commit | 775c92c7650afbeae6cfdaf0869e71fd31bcacfd (patch) | |
tree | e6dbdf8cfb049a5eced7465fe6f0276164b9c38e | |
parent | c061858e723f718a172e60c9f3aac0e3e7a6c330 (diff) |
#81437# reload example instead of trying a Undo()
-rw-r--r-- | sw/source/ui/envelp/label1.cxx | 37 | ||||
-rw-r--r-- | sw/source/ui/envelp/labimp.hxx | 11 | ||||
-rw-r--r-- | sw/source/ui/inc/glossary.hxx | 17 | ||||
-rw-r--r-- | sw/source/ui/inc/unotools.hxx | 7 | ||||
-rw-r--r-- | sw/source/ui/misc/glossary.cxx | 59 | ||||
-rw-r--r-- | sw/source/ui/utlui/unotools.cxx | 197 |
6 files changed, 157 insertions, 171 deletions
diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 0fccee058d96..6f8a1e82bf77 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -2,9 +2,9 @@ * * $RCSfile: label1.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: rt $ $Date: 2000-11-15 09:21:52 $ + * last change: $Author: os $ $Date: 2000-12-21 12:12:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1002,11 +1002,14 @@ SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) aAutoTextGroupLB(this, ResId( LB_AUTO_TEXT_GROUP )), aContentGB(this, ResId( GB_CONTENT )), aExampleWIN(this, ResId( WIN_EXAMPLE )), + aHideExampleWIN(this, ResId( WIN_EXAMPLE )), aExampleGB(this, ResId( GB_EXAMPLE )), sVisCardGroup(ResId(ST_VISCARD_GROUP)), - pExampleFrame(0) + pExampleFrame(0), + bResume(FALSE) { FreeResource(); + aHideExampleWIN.SetBackground( Wallpaper(Color( COL_WHITE )) ); aAutoTextLB.SetWindowBits( WB_HSCROLL ); aAutoTextLB.SetSpaceBetweenEntries(0); aAutoTextLB.SetSelectionMode( SINGLE_SELECTION ); @@ -1211,7 +1214,7 @@ void SwVisitingCardPage::InitFrameControl() --------------------------------------------------*/ IMPL_LINK( SwVisitingCardPage, FrameControlInitializedHdl, void*, EMPTYARG ) { - AutoTextSelectHdl(&aAutoTextGroupLB); + ResumeShowAutoText(); return 0; }; /* -----------------22.07.99 11:06------------------- @@ -1242,7 +1245,8 @@ IMPL_LINK( SwVisitingCardPage, AutoTextSelectHdl, void*, pBox ) String sGroup( *(String*)aAutoTextGroupLB.GetEntryData(aAutoTextGroupLB.GetSelectEntryPos())); uno::Any aGroup = _xAutoText->getByName(sGroup); - uno::Reference< text::XAutoTextGroup > xGroup = *(uno::Reference< text::XAutoTextGroup > *)aGroup.getValue(); + uno::Reference< text::XAutoTextGroup > xGroup; + aGroup >>= xGroup; if(bGroup) { @@ -1266,13 +1270,32 @@ IMPL_LINK( SwVisitingCardPage, AutoTextSelectHdl, void*, pBox ) pEntry->SetUserData(new String(sBlock)); } } + SetResume(); + aHideExampleWIN.Show(); + pExampleFrame->ExecUndo(); + } + return 0; +} +/* -----------------------------21.12.00 12:16-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwVisitingCardPage::ResumeShowAutoText() +{ + if(IsResume()) + { SvLBoxEntry* pSel = aAutoTextLB.FirstSelected(); String sEntry; if(pSel) sEntry = *(String*)pSel->GetUserData(); - pExampleFrame->ExecUndo(); uno::Reference< text::XTextCursor > & xCrsr = pExampleFrame->GetTextCursor(); OUString uEntry(sEntry); + + String sGroup( + *(String*)aAutoTextGroupLB.GetEntryData(aAutoTextGroupLB.GetSelectEntryPos())); + uno::Any aGroup = _xAutoText->getByName(sGroup); + uno::Reference< text::XAutoTextGroup > xGroup; + aGroup >>= xGroup; + if(sEntry.Len() && xGroup->hasByName(uEntry)) { uno::Any aEntry(xGroup->getByName(uEntry)); @@ -1284,8 +1307,8 @@ IMPL_LINK( SwVisitingCardPage, AutoTextSelectHdl, void*, pBox ) } UpdateFields(); } + aHideExampleWIN.Hide(); } - return 0; } /* -----------------01.10.99 11:59------------------- diff --git a/sw/source/ui/envelp/labimp.hxx b/sw/source/ui/envelp/labimp.hxx index a7551b0c7183..e8d5cfdea8eb 100644 --- a/sw/source/ui/envelp/labimp.hxx +++ b/sw/source/ui/envelp/labimp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: labimp.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: os $ $Date: 2000-09-26 11:55:45 $ + * last change: $Author: os $ $Date: 2000-12-21 12:12:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -331,6 +331,7 @@ class SwVisitingCardPage : public SfxTabPage GroupBox aContentGB; Window aExampleWIN; + Window aHideExampleWIN; GroupBox aExampleGB; String sVisCardGroup; @@ -338,9 +339,15 @@ class SwVisitingCardPage : public SfxTabPage SwLabItem aLabItem; + BOOL bResume; + SwOneExampleFrame* pExampleFrame; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > _xAutoText; + void SetResume() {bResume = TRUE;} + BOOL IsResume() {return bResume;} + void ResumeShowAutoText(); + DECL_LINK( AutoTextSelectHdl, void* ); DECL_LINK( FrameControlInitializedHdl, void* ); diff --git a/sw/source/ui/inc/glossary.hxx b/sw/source/ui/inc/glossary.hxx index bcc118ef599f..f6242533a836 100644 --- a/sw/source/ui/inc/glossary.hxx +++ b/sw/source/ui/inc/glossary.hxx @@ -2,9 +2,9 @@ * * $RCSfile: glossary.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:40 $ + * last change: $Author: os $ $Date: 2000-12-21 12:11:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -167,6 +167,7 @@ class SwGlossaryDlg : public SvxStandardDialog GroupBox aExampleGB; Window aExampleWIN; + Window aHideExampleWIN; CheckBox aShowExampleCB; CheckBox aInsertTipCB; @@ -197,6 +198,12 @@ class SwGlossaryDlg : public SvxStandardDialog PopupMenu* pMenu; SwGlossaryHdl* pGlossaryHdl; + + String sResumeGroup; + String sResumeShortName; + BOOL bResume; + + const sal_Bool bSelection : 1; sal_Bool bReadOnly : 1; sal_Bool bIsOld : 1; @@ -223,7 +230,13 @@ class SwGlossaryDlg : public SvxStandardDialog void Init(); SvLBoxEntry* DoesBlockExist(const String& sBlock, const String& rShort); void ShowAutoText(const String& rGroup, const String& rShortName); + void ResumeShowAutoText(); + BOOL GetResumeData(String& rGroup, String& rShortName) + {rGroup = sResumeGroup; rShortName = sResumeShortName; return bResume;} + void SetResumeData(const String& rGroup, const String& rShortName) + {sResumeGroup = rGroup; sResumeShortName = rShortName; bResume = TRUE;} + void ResetResumeData() {bResume = FALSE;} public: SwGlossaryDlg(SfxViewFrame* pViewFrame, SwGlossaryHdl* pGlosHdl, SwWrtShell *pWrtShell); ~SwGlossaryDlg(); diff --git a/sw/source/ui/inc/unotools.hxx b/sw/source/ui/inc/unotools.hxx index fad07a577ec7..fec1ee59fd59 100644 --- a/sw/source/ui/inc/unotools.hxx +++ b/sw/source/ui/inc/unotools.hxx @@ -2,9 +2,9 @@ * * $RCSfile: unotools.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 17:14:43 $ + * last change: $Author: os $ $Date: 2000-12-21 12:12:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -180,6 +180,7 @@ class SwOneExampleFrame Link aInitializedLink; MenuResource aMenuRes; + String sArgumentURL; SwView* pModuleView; @@ -193,6 +194,8 @@ class SwOneExampleFrame DECL_LINK( TimeoutHdl, Timer* ); DECL_LINK( PopupHdl, Menu* ); + void CreateControl(); + void DisposeControl(); public: SwOneExampleFrame(Window& rWin, sal_uInt32 nStyleFlags = EX_SHOW_ONLINE_LAYOUT, diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 91a40b626079..eba1e87a3a52 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -2,9 +2,9 @@ * * $RCSfile: glossary.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: jp $ $Date: 2000-11-06 09:04:00 $ + * last change: $Author: os $ $Date: 2000-12-21 12:11:28 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -330,6 +330,7 @@ SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame, SvxStandardDialog(&pViewFrame->GetWindow(), SW_RES(DLG_GLOSSARY)), aExampleGB (this, SW_RES(GB_EXAMPLE )), aExampleWIN (this, SW_RES(WIN_EXAMPLE )), + aHideExampleWIN(this, SW_RES(WIN_EXAMPLE )), aShowExampleCB(this, SW_RES(CB_SHOW_EXAMPLE )), aInsertTipCB (this, SW_RES(CB_INSERT_TIP)), aNameLbl (this, SW_RES(FT_NAME)), @@ -355,8 +356,11 @@ SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame, bSelection( pWrtShell->IsSelection() ), bReadOnly( sal_False ), bIsOld( sal_False ), - bIsDocReadOnly(sal_False) + bIsDocReadOnly(sal_False), + bResume(sal_False) { + aHideExampleWIN.SetBackground( Wallpaper(Color( COL_WHITE )) ); + aHideExampleWIN.Show(FALSE); // Static-Pointer initialisieren if( !pCurrGlosGroup ) pCurrGlosGroup = new String;//(SwGlossaries::GetDefName()); @@ -1298,9 +1302,8 @@ IMPL_LINK( SwGlossaryDlg, ShowPreviewHdl, CheckBox *, pBox ) --------------------------------------------------*/ IMPL_LINK( SwGlossaryDlg, PreviewLoadedHdl, void *, EMPTYARG ) { - if(pCurrGlosGroup) - ShowAutoText(*pCurrGlosGroup, aShortNameEdit.GetText()); aExampleWIN.Show(aShowExampleCB.IsChecked()); + ResumeShowAutoText(); return 0; }; @@ -1311,6 +1314,11 @@ void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName) { if(aExampleWIN.IsVisible()) { + aHideExampleWIN.Show(); + SetResumeData(rGroup, rShortName); + //try to make an Undo() + pExampleFrame->ExecUndo(); + if(!_xAutoText.is()) { uno::Reference< lang::XMultiServiceFactory > @@ -1321,8 +1329,6 @@ void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName) _xAutoText = uno::Reference< container::XNameAccess >(xAText, uno::UNO_QUERY); } - //try to make an Undo() - pExampleFrame->ExecUndo(); uno::Reference< XTextCursor > & xCrsr = pExampleFrame->GetTextCursor(); if(xCrsr.is()) { @@ -1342,5 +1348,44 @@ void SwGlossaryDlg::ShowAutoText(const String& rGroup, const String& rShortName) } } } +/* -----------------------------21.12.00 11:33-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwGlossaryDlg::ResumeShowAutoText() +{ + String sGroup, sShortName; + if(GetResumeData(sGroup, sShortName) && aExampleWIN.IsVisible()) + { + if(!_xAutoText.is()) + { + uno::Reference< lang::XMultiServiceFactory > + xMgr = getProcessServiceFactory(); + //now the AutoText ListBoxes have to be filled + + uno::Reference< uno::XInterface > xAText = xMgr->createInstance( C2U("com.sun.star.text.AutoTextContainer") ); + _xAutoText = uno::Reference< container::XNameAccess >(xAText, uno::UNO_QUERY); + } + + uno::Reference< XTextCursor > & xCrsr = pExampleFrame->GetTextCursor(); + if(xCrsr.is()) + { + if(sShortName.Len()) + { + uno::Any aGroup = _xAutoText->getByName(sGroup); + uno::Reference< XAutoTextGroup > xGroup = *(uno::Reference< XAutoTextGroup > *)aGroup.getValue(); + OUString uShortName(sShortName); + if(xGroup->hasByName(uShortName)) + { + uno::Any aEntry(xGroup->getByName(uShortName)); + uno::Reference< XAutoTextEntry > xEntry = *(uno::Reference< XAutoTextEntry > *)aEntry.getValue(); + uno::Reference< XTextRange > xRange(xCrsr, uno::UNO_QUERY); + xEntry->applyTo(xRange); + } + } + } + aHideExampleWIN.Hide(); + } + ResetResumeData(); +} diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx index 6c65aafb1d8a..53001bb70d56 100644 --- a/sw/source/ui/utlui/unotools.cxx +++ b/sw/source/ui/utlui/unotools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unotools.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: os $ $Date: 2000-10-20 14:18:07 $ + * last change: $Author: os $ $Date: 2000-12-21 12:12:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -158,9 +158,12 @@ #define C2U(cChar) rtl::OUString::createFromAscii(cChar) +#define C2S(cChar) String::CreateFromAscii(cChar) using namespace ::com::sun::star; using namespace ::rtl; +const sal_Char cFrameControl[] = "com.sun.star.frame.FrameControl"; +const sal_Char cFactory[] = "private:factory/swriter"; /* -----------------09.06.99 14:39------------------- * * --------------------------------------------------*/ @@ -252,6 +255,9 @@ SwOneExampleFrame::SwOneExampleFrame(Window& rWin, bIsInitialized(sal_False), bServiceAvailable(sal_False) { + if(pURL && pURL->Len()) + sArgumentURL = *pURL; + aTopWindow.SetPaintTransparent(sal_True); aTopWindow.SetPosSizePixel(rWin.GetPosPixel(), rWin.GetSizePixel()); aTopWindow.SetZOrder( &rWin, WINDOW_ZORDER_FIRST ); @@ -260,6 +266,35 @@ SwOneExampleFrame::SwOneExampleFrame(Window& rWin, aInitializedLink = *pInitializedLink; rWin.Enable(sal_False); + CreateControl(); +} +/* -----------------------------08.12.99 13:44-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwOneExampleFrame::CreateErrorMessage(Window* pParent) +{ + if(SwOneExampleFrame::bShowServiceNotAvailableMessage) + { + String sInfo(SW_RES(STR_SERVICE_UNAVAILABLE)); + sInfo += C2S(cFrameControl); + InfoBox(pParent, sInfo).Execute(); + SwOneExampleFrame::bShowServiceNotAvailableMessage = sal_False; + } +} +/* -----------------27.07.99 15:26------------------- + + --------------------------------------------------*/ +SwOneExampleFrame::~SwOneExampleFrame() +{ + DisposeControl(); +} +/* -----------------------------21.12.00 10:16-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwOneExampleFrame::CreateControl() +{ + if(_xControl.is()) + return ; uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); uno::Reference< uno::XInterface > xInst = xMgr->createInstance( C2U("com.sun.star.frame.FrameControl") ); @@ -276,9 +311,9 @@ SwOneExampleFrame::SwOneExampleFrame(Window& rWin, uno::Any aURL; // // create new doc - String sTempURL = String::CreateFromAscii("private:factory/swriter"); - if(pURL && pURL->Len()) - sTempURL = *pURL; + String sTempURL = C2S(cFactory); + if(sArgumentURL.Len()) + sTempURL = sArgumentURL; aURL <<= OUString(sTempURL); uno::Sequence<beans::PropertyValue> aSeq(3); @@ -312,23 +347,10 @@ SwOneExampleFrame::SwOneExampleFrame(Window& rWin, } } } -/* -----------------------------08.12.99 13:44-------------------------------- +/* -----------------------------21.12.00 10:16-------------------------------- ---------------------------------------------------------------------------*/ -void SwOneExampleFrame::CreateErrorMessage(Window* pParent) -{ - if(SwOneExampleFrame::bShowServiceNotAvailableMessage) - { - String sInfo(SW_RES(STR_SERVICE_UNAVAILABLE)); - sInfo += String::CreateFromAscii("com.sun.star.frame.FrameControl"); - InfoBox(pParent, sInfo).Execute(); - SwOneExampleFrame::bShowServiceNotAvailableMessage = sal_False; - } -} -/* -----------------27.07.99 15:26------------------- - - --------------------------------------------------*/ -SwOneExampleFrame::~SwOneExampleFrame() +void SwOneExampleFrame::DisposeControl() { _xCursor = 0; if(_xControl.is()) @@ -447,25 +469,11 @@ IMPL_LINK( SwOneExampleFrame, TimeoutHdl, Timer*, pTimer ) ---------------------------------------------------------------------------*/ void SwOneExampleFrame::ExecUndo() { - if(_xCursor.is()) + DisposeControl(); + CreateControl(); + while(pTimer->IsActive()) { - uno::Reference< lang::XUnoTunnel > xTunnel(_xCursor, uno::UNO_QUERY); - SwXTextCursor* pCrsr = xTunnel.is() ? - (SwXTextCursor*)xTunnel->getSomething(SwXTextCursor::getUnoTunnelId()) : 0; - - if(pCrsr) - { - SwDoc* pDoc = pCrsr->GetCrsr()->GetDoc(); - SwEditShell* pSh = pDoc->GetEditShell(); - pSh->Undo(); - pDoc->ResetAttr(*pCrsr->GetCrsr()); - } - else - { - _xCursor->gotoStart(sal_False); - _xCursor->gotoEnd(sal_True); - _xCursor->setString(OUString()); - } + wait(); } } /* -----------------------------15.12.99 11:09-------------------------------- @@ -587,117 +595,4 @@ MenuResource::MenuResource(const ResId& rResId) : { FreeResource(); } -/*------------------------------------------------------------------------ - - $Log: not supported by cvs2svn $ - Revision 1.1.1.1 2000/09/18 17:14:50 hr - initial import - - Revision 1.34 2000/09/18 16:06:19 willem.vandorp - OpenOffice header added. - - Revision 1.33 2000/09/14 14:47:48 os - #78770# CreateFromInt32 - - Revision 1.32 2000/08/28 08:12:24 os - #78015# Referer - - Revision 1.31 2000/07/20 15:05:48 kz - properties renamed - - Revision 1.30 2000/07/03 08:55:07 jp - must changes for VCL - - Revision 1.29 2000/06/07 13:19:19 os - using UCB - - Revision 1.28 2000/05/19 13:03:45 os - check interface in dtor - - Revision 1.27 2000/05/16 09:15:14 os - project usr removed - - Revision 1.26 2000/04/18 15:14:09 os - UNICODE - - Revision 1.25 2000/03/23 13:25:02 os - #74334# create sub-popup within the same block as the main popup - - Revision 1.24 2000/03/23 07:51:11 os - UNO III - - Revision 1.23 2000/03/06 15:47:51 os - #73802# preview improved - - Revision 1.22 2000/03/03 15:17:05 os - StarView remainders removed - - Revision 1.21 2000/02/11 15:01:13 hr - #70473# changes for unicode ( patched by automated patchtool ) - - Revision 1.20 2000/02/04 14:59:53 os - #72599# mark current zoom level - - Revision 1.19 1999/12/29 07:52:04 os - #71262# set zoom type first - - Revision 1.18 1999/12/27 10:46:07 os - #71262# Undo in SwOneExampleFrame - - Revision 1.17 1999/12/17 14:50:57 os - #70986# SwView of Example resets Module's view pointer - - Revision 1.16 1999/12/15 15:32:45 os - #70234# ExampleFrame: OnlineLayout, ContextMenu, disabled - - Revision 1.15 1999/12/09 12:29:12 os - #70284# show Bitmaps in hyperlink insert dialog# content.cxx glbltree.cxx navipi.hrc navipi.src - - Revision 1.14 1999/12/07 15:41:50 os - #70574# old service names removed - - Revision 1.13 1999/11/29 15:53:21 os - #70181# call dispose in dtor - - Revision 1.12 1999/11/25 15:47:10 os - headers corrected - - Revision 1.11 1999/11/25 08:58:07 os - hori scrollbar enabled - - Revision 1.10 1999/11/23 10:18:09 os - header corrected - - Revision 1.9 1999/11/19 16:40:25 os - modules renamed - - Revision 1.8 1999/11/10 14:58:55 os - vertical scrollbar on - - Revision 1.7 1999/10/22 15:06:25 os - user factory URL - - Revision 1.6 1999/10/01 12:02:27 os - set bIsInitialized before calling the link - - Revision 1.5 1999/09/20 09:58:54 os - local resources separated - - Revision 1.4 1999/07/28 11:07:38 OS - new: SwOneExampleFrame - - - Rev 1.3 28 Jul 1999 13:07:38 OS - new: SwOneExampleFrame - - Rev 1.2 02 Jul 1999 11:10:08 OS - #63003# NameWarning also in StarOne rename dialog - - Rev 1.1 25 Jun 1999 10:22:40 OS - #67190# Names must be unique forall frames - - Rev 1.0 10 Jun 1999 09:51:46 OS - SwRenameXNamedDialog - -------------------------------------------------------------------------*/ |