diff options
Diffstat (limited to 'sw/source/ui/dialog')
27 files changed, 9229 insertions, 0 deletions
diff --git a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx new file mode 100644 index 000000000000..c9e99979e66b --- /dev/null +++ b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx @@ -0,0 +1,934 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#include <SwSpellDialogChildWindow.hxx> +#include <vcl/msgbox.hxx> +#include <editeng/svxacorr.hxx> +#include <editeng/acorrcfg.hxx> +#include <svx/svxids.hrc> +#include <sfx2/app.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <editeng/unolingu.hxx> +#include <editeng/editeng.hxx> +#include <editeng/editview.hxx> +#include <wrtsh.hxx> +#include <sfx2/printer.hxx> +#include <svx/svdoutl.hxx> +#include <svx/svdview.hxx> +#include <svx/svditer.hxx> +#include <svx/svdogrp.hxx> +#include <unotools/linguprops.hxx> +#include <unotools/lingucfg.hxx> +#include <doc.hxx> +#include <docsh.hxx> +#include <docary.hxx> +#include <frmfmt.hxx> +#include <dcontact.hxx> +#include <edtwin.hxx> +#include <pam.hxx> +#include <drawbase.hxx> +#include <unotextrange.hxx> +#include <dialog.hrc> +#include <cmdid.h> + + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::text; +using namespace ::com::sun::star::linguistic2; +using namespace ::com::sun::star::beans; + +SFX_IMPL_CHILDWINDOW(SwSpellDialogChildWindow, FN_SPELL_GRAMMAR_DIALOG) + + +#define SPELL_START_BODY 0 // body text area +#define SPELL_START_OTHER 1 // frame, footnote, header, footer +#define SPELL_START_DRAWTEXT 2 // started in a draw text object + +struct SpellState +{ + bool m_bInitialCall; + bool m_bLockFocus; //lock the focus notification while a modal dialog is active + bool m_bLostFocus; + + //restart and progress information + USHORT m_SpellStartPosition; + bool m_bBodySpelled; //body already spelled + bool m_bOtherSpelled; //frames, footnotes, headers and footers spelled + bool m_bStartedInOther; //started the spelling insided of the _other_ area + bool m_bStartedInSelection; // there was an initial text selection + SwPaM* pOtherCursor; // position where the spelling inside the _other_ area started + bool m_bDrawingsSpelled; //all drawings spelled + Reference<XTextRange> m_xStartRange; //text range that marks the start of spelling + const SdrObject* m_pStartDrawing; //draw text object spelling started in + ESelection m_aStartDrawingSelection; //draw text start selection + bool m_bRestartDrawing; // the first selected drawing object is found again + + //lose/get focus information to decide if spelling can be continued + ShellModes m_eSelMode; + const SwNode* m_pPointNode; + const SwNode* m_pMarkNode; + xub_StrLen m_nPointPos; + xub_StrLen m_nMarkPos; + const SdrOutliner* m_pOutliner; + ESelection m_aESelection; + + //iterating over draw text objects + std::vector<SdrTextObj*> m_aTextObjects; + bool m_bTextObjectsCollected; + + SpellState() : + m_bInitialCall(true), + m_bLockFocus(false), + m_bLostFocus(false), + m_SpellStartPosition(SPELL_START_BODY), + m_bBodySpelled(false), + m_bOtherSpelled(false), + m_bStartedInOther(false), + m_bStartedInSelection(false), + pOtherCursor(0), + m_bDrawingsSpelled(false), + m_pStartDrawing(0), + m_bRestartDrawing(false), + + m_eSelMode(SHELL_MODE_OBJECT), //initially invalid + m_pPointNode(0), + m_pMarkNode(0), + m_nPointPos(0), + m_nMarkPos(0), + m_pOutliner(0), + m_bTextObjectsCollected(false) + {} + + ~SpellState() {delete pOtherCursor;} + + // reset state in ::InvalidateSpellDialog + void Reset() + { m_bInitialCall = true; + m_bBodySpelled = m_bOtherSpelled = m_bDrawingsSpelled = false; + m_xStartRange = 0; + m_pStartDrawing = 0; + m_bRestartDrawing = false; + m_bTextObjectsCollected = false; + m_aTextObjects.clear(); + m_bStartedInOther = false; + delete pOtherCursor; + pOtherCursor = 0; + } +}; +/*-- 30.10.2003 14:33:26--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void lcl_LeaveDrawText(SwWrtShell& rSh) +{ + if(rSh.GetDrawView()) + { + rSh.GetDrawView()->SdrEndTextEdit( TRUE ); + Point aPt(LONG_MIN, LONG_MIN); + //go out of the frame + rSh.SelectObj(aPt, SW_LEAVE_FRAME); + rSh.EnterStdMode(); + rSh.GetView().AttrChangedNotify(&rSh); + } +} +/*-- 09.09.2003 10:39:22--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwSpellDialogChildWindow::SwSpellDialogChildWindow ( + Window* _pParent, + USHORT nId, + SfxBindings* pBindings, + SfxChildWinInfo* pInfo) : + svx::SpellDialogChildWindow ( + _pParent, nId, pBindings, pInfo), + m_pSpellState(new SpellState) +{ + + String aPropName( String::CreateFromAscii(UPN_IS_GRAMMAR_INTERACTIVE ) ); + SvtLinguConfig().GetProperty( aPropName ) >>= m_bIsGrammarCheckingOn; +} +/*-- 09.09.2003 10:39:22--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwSpellDialogChildWindow::~SwSpellDialogChildWindow () +{ + SwWrtShell* pWrtShell = GetWrtShell_Impl(); + if(!m_pSpellState->m_bInitialCall && pWrtShell) + pWrtShell->SpellEnd(); + delete m_pSpellState; +} + +/*-- 09.09.2003 12:40:07--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxChildWinInfo SwSpellDialogChildWindow::GetInfo (void) const +{ + SfxChildWinInfo aInfo = svx::SpellDialogChildWindow::GetInfo(); + aInfo.bVisible = FALSE; + return aInfo; +} + +/*-- 09.09.2003 10:39:40--------------------------------------------------- + + + -----------------------------------------------------------------------*/ +svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck) +{ + svx::SpellPortions aRet; + SwWrtShell* pWrtShell = GetWrtShell_Impl(); + if(pWrtShell) + { + if (!bRecheck) + { + // first set continuation point for spell/grammar check to the + // end of the current sentence + pWrtShell->MoveContinuationPosToEndOfCheckedSentence(); + } + + ShellModes eSelMode = pWrtShell->GetView().GetShellMode(); + bool bDrawText = SHELL_MODE_DRAWTEXT == eSelMode; + bool bNormalText = + SHELL_MODE_TABLE_TEXT == eSelMode || + SHELL_MODE_LIST_TEXT == eSelMode || + SHELL_MODE_TABLE_LIST_TEXT == eSelMode || + SHELL_MODE_TEXT == eSelMode; + //Writer text outside of the body + bool bOtherText = false; + + if( m_pSpellState->m_bInitialCall ) + { + //if no text selection exists the cursor has to be set into the text + if(!bDrawText && !bNormalText) + { + if(!MakeTextSelection_Impl(*pWrtShell, eSelMode)) + return aRet; + else + { + // the selection type has to be checked again - both text types are possible + if(0 != (pWrtShell->GetSelectionType()& nsSelectionType::SEL_DRW_TXT)) + bDrawText = true; + bNormalText = !bDrawText; + } + } + if(bNormalText) + { + //set cursor to the start of the sentence + if(!pWrtShell->HasSelection()) + pWrtShell->GoStartSentence(); + else + { + pWrtShell->ExpandToSentenceBorders(); + m_pSpellState->m_bStartedInSelection = true; + } + //determine if the selection is outside of the body text + bOtherText = !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY); + m_pSpellState->m_SpellStartPosition = bOtherText ? SPELL_START_OTHER : SPELL_START_BODY; + if(bOtherText) + { + m_pSpellState->pOtherCursor = new SwPaM(*pWrtShell->GetCrsr()->GetPoint()); + m_pSpellState->m_bStartedInOther = true; + pWrtShell->SpellStart( DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_CURR, FALSE ); + } + else + { + SwPaM* pCrsr = pWrtShell->GetCrsr(); + //mark the start position only if not at start of doc + if(!pWrtShell->IsStartOfDoc()) + { + m_pSpellState->m_xStartRange = + SwXTextRange::CreateXTextRange( + *pWrtShell->GetDoc(), + *pCrsr->Start(), pCrsr->End()); + } + pWrtShell->SpellStart( DOCPOS_START, DOCPOS_END, DOCPOS_CURR, FALSE ); + } + } + else + { + SdrView* pSdrView = pWrtShell->GetDrawView(); + m_pSpellState->m_SpellStartPosition = SPELL_START_DRAWTEXT; + m_pSpellState->m_pStartDrawing = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + // start checking at the top of the drawing object + pOLV->SetSelection( ESelection() ); + m_pSpellState->m_aStartDrawingSelection = ESelection(); +/* +Note: spelling in a selection only, or starting in a mid of a drawing object requires +further changes elsewhere. (Especially if it should work in sc and sd as well.) +The code below would only be part of the solution. +(Keeping it a as a comment for the time being) + ESelection aCurSel( pOLV->GetSelection() ); + ESelection aSentenceSel( pOLV->GetEditView().GetEditEngine()->SelectSentence( aCurSel ) ); + if (!aCurSel.HasRange()) + { + aSentenceSel.nEndPara = aSentenceSel.nStartPara; + aSentenceSel.nEndPos = aSentenceSel.nStartPos; + } + pOLV->SetSelection( aSentenceSel ); + m_pSpellState->m_aStartDrawingSelection = aSentenceSel; +*/ + } + + m_pSpellState->m_bInitialCall = false; + } + if( bDrawText ) + { + // spell inside of the current draw text + if(!SpellDrawText_Impl(*pWrtShell, aRet)) + { + if(!FindNextDrawTextError_Impl(*pWrtShell) || !SpellDrawText_Impl(*pWrtShell, aRet)) + { + lcl_LeaveDrawText(*pWrtShell); + //now the drawings have been spelled + m_pSpellState->m_bDrawingsSpelled = true; + //the spelling continues at the other content + //if there's any that has not been spelled yet + if(!m_pSpellState->m_bOtherSpelled && pWrtShell->HasOtherCnt()) + { + pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_OTHERSTART, FALSE ); + if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) + { + pWrtShell->SpellEnd(); + m_pSpellState->m_bOtherSpelled = true; + } + } + else + m_pSpellState->m_bOtherSpelled = true; + //if no result has been found try at the body text - completely + if(!m_pSpellState->m_bBodySpelled && !aRet.size()) + { + pWrtShell->SpellStart(DOCPOS_START, DOCPOS_END, DOCPOS_START, FALSE ); + if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) + { + m_pSpellState->m_bBodySpelled = true; + pWrtShell->SpellEnd(); + } + } + + } + } + } + else + { + //spell inside of the Writer text + if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) + { + // if there is a selection (within body or header/footer text) + // then spell/grammar checking should not move outside of it. + if (!m_pSpellState->m_bStartedInSelection) + { + //find out which text has been spelled body or other + bOtherText = !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY); + if(bOtherText && m_pSpellState->m_bStartedInOther && m_pSpellState->pOtherCursor) + { + m_pSpellState->m_bStartedInOther = false; + pWrtShell->SetSelection(*m_pSpellState->pOtherCursor); + pWrtShell->SpellEnd(); + delete m_pSpellState->pOtherCursor; + m_pSpellState->pOtherCursor = 0; + pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_CURR, DOCPOS_OTHERSTART, FALSE ); + pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn); + } + if(!aRet.size()) + { + //end spelling + pWrtShell->SpellEnd(); + if(bOtherText) + { + m_pSpellState->m_bOtherSpelled = true; + //has the body been spelled? + if(!m_pSpellState->m_bBodySpelled) + { + pWrtShell->SpellStart(DOCPOS_START, DOCPOS_END, DOCPOS_START, FALSE ); + if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) + { + m_pSpellState->m_bBodySpelled = true; + pWrtShell->SpellEnd(); + } + } + } + else + { + m_pSpellState->m_bBodySpelled = true; + if(!m_pSpellState->m_bOtherSpelled && pWrtShell->HasOtherCnt()) + { + pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_OTHEREND, DOCPOS_OTHERSTART, FALSE ); + if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) + { + pWrtShell->SpellEnd(); + m_pSpellState->m_bOtherSpelled = true; + } + } + else + m_pSpellState->m_bOtherSpelled = true; + } + } + + //search for a draw text object that contains error and spell it + if(!aRet.size() && + (m_pSpellState->m_bDrawingsSpelled || + !FindNextDrawTextError_Impl(*pWrtShell) || !SpellDrawText_Impl(*pWrtShell, aRet))) + { + lcl_LeaveDrawText(*pWrtShell); + m_pSpellState->m_bDrawingsSpelled = true; + } + } + } + } + // now only the rest of the body text can be spelled - + // if the spelling started inside of the body + // + bool bCloseMessage = true; + if(!aRet.size() && !m_pSpellState->m_bStartedInSelection) + { + DBG_ASSERT(m_pSpellState->m_bDrawingsSpelled && + m_pSpellState->m_bOtherSpelled && m_pSpellState->m_bBodySpelled, + "not all parts of the document are already spelled"); + if(m_pSpellState->m_xStartRange.is()) + { + LockFocusNotification( true ); + USHORT nRet = QueryBox( GetWindow(), SW_RES(RID_QB_SPELL_CONTINUE)).Execute(); + if(RET_YES == nRet) + { + SwUnoInternalPaM aPam(*pWrtShell->GetDoc()); + if (::sw::XTextRangeToSwPaM(aPam, + m_pSpellState->m_xStartRange)) + { + pWrtShell->SetSelection(aPam); + pWrtShell->SpellStart(DOCPOS_START, DOCPOS_CURR, DOCPOS_START); + if(!pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn)) + pWrtShell->SpellEnd(); + } + m_pSpellState->m_xStartRange = 0; + LockFocusNotification( false ); + //take care that the now valid selection is stored + LoseFocus(); + } + else + bCloseMessage = false; //no closing message if a wrap around has been denied + } + } + if(!aRet.size()) + { + if(bCloseMessage) + { + LockFocusNotification( true ); + String sInfo(SW_RES(STR_SPELLING_COMPLETED)); + //#i84610# + Window* pTemp = GetWindow(); // temporary needed for g++ 3.3.5 + InfoBox(pTemp, sInfo ).Execute(); + LockFocusNotification( false ); + //take care that the now valid selection is stored + LoseFocus(); + } + + //close the spelling dialog + GetBindings().GetDispatcher()->Execute(FN_SPELL_GRAMMAR_DIALOG, SFX_CALLMODE_ASYNCHRON); + } + } + return aRet; + +} +/*-- 09.09.2003 10:39:40--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSpellDialogChildWindow::ApplyChangedSentence(const svx::SpellPortions& rChanged, bool bRecheck) +{ + SwWrtShell* pWrtShell = GetWrtShell_Impl(); + DBG_ASSERT(!m_pSpellState->m_bInitialCall, "ApplyChangedSentence in initial call or after resume"); + if(pWrtShell && !m_pSpellState->m_bInitialCall) + { + ShellModes eSelMode = pWrtShell->GetView().GetShellMode(); + bool bDrawText = SHELL_MODE_DRAWTEXT == eSelMode; + bool bNormalText = + SHELL_MODE_TABLE_TEXT == eSelMode || + SHELL_MODE_LIST_TEXT == eSelMode || + SHELL_MODE_TABLE_LIST_TEXT == eSelMode || + SHELL_MODE_TEXT == eSelMode; + + // evaluate if the same sentence should be rechecked or not. + // Sentences that got grammar checked should always be rechecked in order + // to detect possible errors that get introduced with the changes + bRecheck |= pWrtShell->HasLastSentenceGotGrammarChecked(); + + if(bNormalText) + pWrtShell->ApplyChangedSentence(rChanged, bRecheck); + else if(bDrawText ) + { + SdrView* pDrView = pWrtShell->GetDrawView(); + SdrOutliner *pOutliner = pDrView->GetTextEditOutliner(); + pOutliner->ApplyChangedSentence(pDrView->GetTextEditOutlinerView()->GetEditView(), rChanged, bRecheck); + } + } +} +/*-- 21.10.2003 09:33:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSpellDialogChildWindow::AddAutoCorrection( + const String& rOld, const String& rNew, LanguageType eLanguage) +{ + SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect(); + pACorr->PutText( rOld, rNew, eLanguage ); +} +/*-- 21.10.2003 09:33:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +bool SwSpellDialogChildWindow::HasAutoCorrection() +{ + return true; +} +/*-- 16.06.2008 11:59:17--------------------------------------------------- + + -----------------------------------------------------------------------*/ +bool SwSpellDialogChildWindow::HasGrammarChecking() +{ + return SvtLinguConfig().HasGrammarChecker(); +} +/*-- 18.06.2008 12:27:11--------------------------------------------------- + + -----------------------------------------------------------------------*/ +bool SwSpellDialogChildWindow::IsGrammarChecking() +{ + return m_bIsGrammarCheckingOn; +} +/*-- 18.06.2008 12:27:11--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSpellDialogChildWindow::SetGrammarChecking(bool bOn) +{ + uno::Any aVal; + aVal <<= bOn; + m_bIsGrammarCheckingOn = bOn; + String aPropName( C2S(UPN_IS_GRAMMAR_INTERACTIVE ) ); + SvtLinguConfig().SetProperty( aPropName, aVal ); + // set current spell position to the start of the current sentence to + // continue with this sentence after grammar checking state has been changed + SwWrtShell* pWrtShell = GetWrtShell_Impl(); + if(pWrtShell) + { + ShellModes eSelMode = pWrtShell->GetView().GetShellMode(); + bool bDrawText = SHELL_MODE_DRAWTEXT == eSelMode; + bool bNormalText = + SHELL_MODE_TABLE_TEXT == eSelMode || + SHELL_MODE_LIST_TEXT == eSelMode || + SHELL_MODE_TABLE_LIST_TEXT == eSelMode || + SHELL_MODE_TEXT == eSelMode; + if( bNormalText ) + pWrtShell->PutSpellingToSentenceStart(); + else if( bDrawText ) + { + SdrView* pSdrView = pWrtShell->GetDrawView(); + SdrOutliner* pOutliner = pSdrView ? pSdrView->GetTextEditOutliner() : 0; + DBG_ASSERT(pOutliner, "No Outliner in SwSpellDialogChildWindow::SetGrammarChecking"); + if(pOutliner) + { + pOutliner->PutSpellingToSentenceStart( pSdrView->GetTextEditOutlinerView()->GetEditView() ); + } + } + } +} +/*-- 28.10.2003 08:41:09--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSpellDialogChildWindow::GetFocus() +{ + if(m_pSpellState->m_bLockFocus) + return; + bool bInvalidate = false; + SwWrtShell* pWrtShell = GetWrtShell_Impl(); + if(pWrtShell && !m_pSpellState->m_bInitialCall) + { + ShellModes eSelMode = pWrtShell->GetView().GetShellMode(); + if(eSelMode != m_pSpellState->m_eSelMode) + { + //prevent initial invalidation + if(m_pSpellState->m_bLostFocus) + bInvalidate = true; + } + else + { + switch(m_pSpellState->m_eSelMode) + { + case SHELL_MODE_TEXT: + case SHELL_MODE_LIST_TEXT: + case SHELL_MODE_TABLE_TEXT: + case SHELL_MODE_TABLE_LIST_TEXT: + { + SwPaM* pCursor = pWrtShell->GetCrsr(); + if(m_pSpellState->m_pPointNode != pCursor->GetNode(TRUE) || + m_pSpellState->m_pMarkNode != pCursor->GetNode(FALSE)|| + m_pSpellState->m_nPointPos != pCursor->GetPoint()->nContent.GetIndex()|| + m_pSpellState->m_nMarkPos != pCursor->GetMark()->nContent.GetIndex()) + bInvalidate = true; + } + break; + case SHELL_MODE_DRAWTEXT: + { + SdrView* pSdrView = pWrtShell->GetDrawView(); + SdrOutliner* pOutliner = pSdrView ? pSdrView->GetTextEditOutliner() : 0; + if(!pOutliner || m_pSpellState->m_pOutliner != pOutliner) + bInvalidate = true; + else + { + OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + DBG_ASSERT(pOLV, "no OutlinerView in SwSpellDialogChildWindow::GetFocus()"); + if(!pOLV || !m_pSpellState->m_aESelection.IsEqual(pOLV->GetSelection())) + bInvalidate = true; + } + } + break; + default: bInvalidate = true; + } + } + } + else + { + bInvalidate = true; + } + if(bInvalidate) + InvalidateSpellDialog(); +} +/*-- 28.10.2003 08:41:09--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSpellDialogChildWindow::LoseFocus() +{ + //prevent initial invalidation + m_pSpellState->m_bLostFocus = true; + if(m_pSpellState->m_bLockFocus) + return; + SwWrtShell* pWrtShell = GetWrtShell_Impl(); + if(pWrtShell) + { + m_pSpellState->m_eSelMode = pWrtShell->GetView().GetShellMode(); + m_pSpellState->m_pPointNode = m_pSpellState->m_pMarkNode = 0; + m_pSpellState->m_nPointPos = m_pSpellState->m_nMarkPos = 0; + m_pSpellState->m_pOutliner = 0; + + switch(m_pSpellState->m_eSelMode) + { + case SHELL_MODE_TEXT: + case SHELL_MODE_LIST_TEXT: + case SHELL_MODE_TABLE_TEXT: + case SHELL_MODE_TABLE_LIST_TEXT: + { + //store a node pointer and a pam-position to be able to check on next GetFocus(); + SwPaM* pCursor = pWrtShell->GetCrsr(); + m_pSpellState->m_pPointNode = pCursor->GetNode(TRUE); + m_pSpellState->m_pMarkNode = pCursor->GetNode(FALSE); + m_pSpellState->m_nPointPos = pCursor->GetPoint()->nContent.GetIndex(); + m_pSpellState->m_nMarkPos = pCursor->GetMark()->nContent.GetIndex(); + + } + break; + case SHELL_MODE_DRAWTEXT: + { + SdrView* pSdrView = pWrtShell->GetDrawView(); + SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner(); + m_pSpellState->m_pOutliner = pOutliner; + OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + DBG_ASSERT(pOutliner && pOLV, "no Outliner/OutlinerView in SwSpellDialogChildWindow::LoseFocus()"); + if(pOLV) + { + m_pSpellState->m_aESelection = pOLV->GetSelection(); + } + } + break; + default:;//prevent warning + } + } + else + m_pSpellState->m_eSelMode = SHELL_MODE_OBJECT; +} +/*-- 18.09.2003 12:50:18--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSpellDialogChildWindow::InvalidateSpellDialog() +{ + SwWrtShell* pWrtShell = GetWrtShell_Impl(); + if(!m_pSpellState->m_bInitialCall && pWrtShell) + pWrtShell->SpellEnd(0, false); + m_pSpellState->Reset(); + svx::SpellDialogChildWindow::InvalidateSpellDialog(); +} + +/*-- 18.09.2003 12:54:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwWrtShell* SwSpellDialogChildWindow::GetWrtShell_Impl() +{ + SfxDispatcher* pDispatch = GetBindings().GetDispatcher(); + SwView* pView = 0; + if(pDispatch) + { + USHORT nShellIdx = 0; + SfxShell* pShell; + while(0 != (pShell = pDispatch->GetShell(nShellIdx++))) + if(pShell->ISA(SwView)) + { + pView = static_cast<SwView* >(pShell); + break; + } + } + return pView ? pView->GetWrtShellPtr(): 0; +} + +/*-- 13.10.2003 15:19:04--------------------------------------------------- + set the cursor into the body text - necessary if any object is selected + on start of the spelling dialog + -----------------------------------------------------------------------*/ +bool SwSpellDialogChildWindow::MakeTextSelection_Impl(SwWrtShell& rShell, ShellModes eSelMode) +{ + SwView& rView = rShell.GetView(); + switch(eSelMode) + { + case SHELL_MODE_TEXT: + case SHELL_MODE_LIST_TEXT: + case SHELL_MODE_TABLE_TEXT: + case SHELL_MODE_TABLE_LIST_TEXT: + case SHELL_MODE_DRAWTEXT: + DBG_ERROR("text already active in SwSpellDialogChildWindow::MakeTextSelection_Impl()"); + break; + + case SHELL_MODE_FRAME: + { + rShell.UnSelectFrm(); + rShell.LeaveSelFrmMode(); + rView.AttrChangedNotify(&rShell); + } + break; + + case SHELL_MODE_DRAW: + case SHELL_MODE_DRAW_CTRL: + case SHELL_MODE_DRAW_FORM: + case SHELL_MODE_BEZIER: + if(FindNextDrawTextError_Impl(rShell)) + { + rView.AttrChangedNotify(&rShell); + break; + } + //otherwise no break to deselect the object + case SHELL_MODE_GRAPHIC: + case SHELL_MODE_OBJECT: + { + if ( rShell.IsDrawCreate() ) + { + rView.GetDrawFuncPtr()->BreakCreate(); + rView.AttrChangedNotify(&rShell); + } + else if ( rShell.HasSelection() || rView.IsDrawMode() ) + { + SdrView *pSdrView = rShell.GetDrawView(); + if(pSdrView && pSdrView->AreObjectsMarked() && + pSdrView->GetHdlList().GetFocusHdl()) + { + ((SdrHdlList&)pSdrView->GetHdlList()).ResetFocusHdl(); + } + else + { + rView.LeaveDrawCreate(); + Point aPt(LONG_MIN, LONG_MIN); + //go out of the frame + rShell.SelectObj(aPt, SW_LEAVE_FRAME); + SfxBindings& rBind = rView.GetViewFrame()->GetBindings(); + rBind.Invalidate( SID_ATTR_SIZE ); + rShell.EnterStdMode(); + rView.AttrChangedNotify(&rShell); + } + } + } + break; + default:; //prevent warning + } + return true; +} +/*-- 13.10.2003 15:20:09--------------------------------------------------- + select the next draw text object that has a spelling error + -----------------------------------------------------------------------*/ +bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh) +{ + bool bNextDoc = false; + SdrView* pDrView = rSh.GetDrawView(); + if(!pDrView) + return bNextDoc; + SwView& rView = rSh.GetView(); + SwDoc* pDoc = rView.GetDocShell()->GetDoc(); + const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList(); + //start at the current draw object - if there is any selected + SdrTextObj* pCurrentTextObj = 0; + if ( rMarkList.GetMarkCount() == 1 ) + { + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); + if( pObj && pObj->ISA(SdrTextObj) ) + pCurrentTextObj = static_cast<SdrTextObj*>(pObj); + } + //at first fill the vector of drawing objects + if(!m_pSpellState->m_bTextObjectsCollected ) + { + m_pSpellState->m_bTextObjectsCollected = true; + sal_uInt16 n = 0; + //iterate in the 'normal' array of objects + while( n < pDoc->GetSpzFrmFmts()->Count() ) + { + SwFrmFmt* pFly = (*pDoc->GetSpzFrmFmts())[ n ]; + if( pFly->IsA( TYPE(SwDrawFrmFmt) ) ) + { + SwClientIter aIter( (SwFmt&) *pFly ); + if( aIter.First( TYPE(SwDrawContact) ) ) + { + SdrObject* pSdrO = ((SwDrawContact*)aIter())->GetMaster(); + if ( pSdrO ) + { + if ( pSdrO->IsA( TYPE(SdrObjGroup) ) ) + { + SdrObjListIter aListIter( *pSdrO, IM_DEEPNOGROUPS ); + //iterate inside of a grouped object + while( aListIter.IsMore() ) + { + SdrObject* pSdrOElement = aListIter.Next(); + if( pSdrOElement && pSdrOElement->IsA( TYPE(SdrTextObj) ) && + static_cast<SdrTextObj*>( pSdrOElement)->HasText() && + pCurrentTextObj != pSdrOElement) + { + m_pSpellState->m_aTextObjects.push_back((SdrTextObj*) pSdrOElement); + } + } + } + else if( pSdrO->IsA( TYPE(SdrTextObj) ) && + static_cast<SdrTextObj*>( pSdrO )->HasText() && + pCurrentTextObj != pSdrO) + { + m_pSpellState->m_aTextObjects.push_back((SdrTextObj*) pSdrO); + } + } + } + } + ++n; + } + if(pCurrentTextObj) + m_pSpellState->m_aTextObjects.push_back(pCurrentTextObj); + } + if(m_pSpellState->m_aTextObjects.size()) + { + Reference< XSpellChecker1 > xSpell( GetSpellChecker() ); + while(!bNextDoc && m_pSpellState->m_aTextObjects.size()) + { + std::vector<SdrTextObj*>::iterator aStart = m_pSpellState->m_aTextObjects.begin(); + SdrTextObj* pTextObj = *aStart; + if(m_pSpellState->m_pStartDrawing == pTextObj) + m_pSpellState->m_bRestartDrawing = true; + m_pSpellState->m_aTextObjects.erase(aStart); + OutlinerParaObject* pParaObj = pTextObj->GetOutlinerParaObject(); + if ( pParaObj ) + { + bool bHasSpellError = false; + { + SdrOutliner aTmpOutliner(pDoc->GetDrawModel()-> + GetDrawOutliner().GetEmptyItemSet().GetPool(), + OUTLINERMODE_TEXTOBJECT ); + aTmpOutliner.SetRefDevice( pDoc->getPrinter( false ) ); + MapMode aMapMode (MAP_TWIP); + aTmpOutliner.SetRefMapMode(aMapMode); + aTmpOutliner.SetPaperSize( pTextObj->GetLogicRect().GetSize() ); + aTmpOutliner.SetSpeller( xSpell ); + + OutlinerView* pOutlView = new OutlinerView( &aTmpOutliner, &(rView.GetEditWin()) ); + pOutlView->GetOutliner()->SetRefDevice( rSh.getIDocumentDeviceAccess()->getPrinter( false ) ); + aTmpOutliner.InsertView( pOutlView ); + Point aPt; + Size aSize(1,1); + Rectangle aRect( aPt, aSize ); + pOutlView->SetOutputArea( aRect ); + aTmpOutliner.SetText( *pParaObj ); + aTmpOutliner.ClearModifyFlag(); + bHasSpellError = EE_SPELL_OK != aTmpOutliner.HasSpellErrors(); + aTmpOutliner.RemoveView( pOutlView ); + delete pOutlView; + } + if(bHasSpellError) + { + //now the current one has to be deselected + if(pCurrentTextObj) + pDrView->SdrEndTextEdit( TRUE ); + //and the found one should be activated + rSh.MakeVisible(pTextObj->GetLogicRect()); + Point aTmp( 0,0 ); + rSh.SelectObj( aTmp, 0, pTextObj ); + SdrPageView* pPV = pDrView->GetSdrPageView(); + rView.BeginTextEdit( pTextObj, pPV, &rView.GetEditWin(), FALSE, TRUE ); + rView.AttrChangedNotify(&rSh); + bNextDoc = true; + } + } + } + } + return bNextDoc; +} + +/*-- 13.10.2003 15:24:27--------------------------------------------------- + + -----------------------------------------------------------------------*/ +bool SwSpellDialogChildWindow::SpellDrawText_Impl(SwWrtShell& rSh, ::svx::SpellPortions& rPortions) +{ + bool bRet = false; + SdrView* pSdrView = rSh.GetDrawView(); + SdrOutliner* pOutliner = pSdrView ? pSdrView->GetTextEditOutliner() : 0; + DBG_ASSERT(pOutliner, "No Outliner in SwSpellDialogChildWindow::SpellDrawText_Impl"); + if(pOutliner) + { + bRet = pOutliner->SpellSentence(pSdrView->GetTextEditOutlinerView()->GetEditView(), rPortions, m_bIsGrammarCheckingOn); + //find out if the current selection is in the first spelled drawing object + //and behind the initial selection + if(bRet && m_pSpellState->m_bRestartDrawing) + { + OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); + ESelection aCurrentSelection = pOLV->GetSelection(); + if(m_pSpellState->m_aStartDrawingSelection.nEndPara < aCurrentSelection.nEndPara || + (m_pSpellState->m_aStartDrawingSelection.nEndPara == aCurrentSelection.nEndPara && + m_pSpellState->m_aStartDrawingSelection.nEndPos < aCurrentSelection.nEndPos)) + { + bRet = false; + rPortions.clear(); + } + } + } + return bRet; +} +/*-- 30.10.2003 14:54:59--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSpellDialogChildWindow::LockFocusNotification(bool bLock) +{ + DBG_ASSERT(m_pSpellState->m_bLockFocus != bLock, "invalid locking - no change of state"); + m_pSpellState->m_bLockFocus = bLock; +} + + diff --git a/sw/source/ui/dialog/abstract.cxx b/sw/source/ui/dialog/abstract.cxx new file mode 100644 index 000000000000..54955c286a02 --- /dev/null +++ b/sw/source/ui/dialog/abstract.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include "swtypes.hxx" +#include "hintids.hxx" + +#include "dialog.hrc" +#include "abstract.hxx" +#include "abstract.hrc" + + +/*-----------------22.02.97 15.32------------------- + +--------------------------------------------------*/ + +SwInsertAbstractDlg::SwInsertAbstractDlg( Window* pParent ) : + SfxModalDialog(pParent, SW_RES(DLG_INSERT_ABSTRACT)), + aFL (this, SW_RES(FL_1 )), + aLevelFT(this, SW_RES(FT_LEVEL )), + aLevelNF(this, SW_RES(NF_LEVEL )), + aParaFT (this, SW_RES(FT_PARA )), + aParaNF (this, SW_RES(NF_PARA )), + aDescFT (this, SW_RES(FT_DESC )), + aOkPB (this, SW_RES(PB_OK )), + aCancelPB (this, SW_RES(PB_CANCEL )), + aHelpPB (this, SW_RES(PB_HELP )) +{ + FreeResource(); +} + +/*-----------------22.02.97 15.32------------------- + +--------------------------------------------------*/ + +SwInsertAbstractDlg::~SwInsertAbstractDlg() +{ +} + +/*-----------------22.02.97 15.34------------------- + +--------------------------------------------------*/ + +BYTE SwInsertAbstractDlg::GetLevel() const +{ + return static_cast< BYTE >(aLevelNF.GetValue() - 1); +} +/*-----------------22.02.97 15.34------------------- + +--------------------------------------------------*/ + +BYTE SwInsertAbstractDlg::GetPara() const +{ + return (BYTE) aParaNF.GetValue(); +} + + + + + + diff --git a/sw/source/ui/dialog/abstract.hrc b/sw/source/ui/dialog/abstract.hrc new file mode 100644 index 000000000000..c36d02ee1b1f --- /dev/null +++ b/sw/source/ui/dialog/abstract.hrc @@ -0,0 +1,36 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define FL_1 1 +#define FT_PARA 2 +#define NF_PARA 3 +#define FT_LEVEL 4 +#define NF_LEVEL 5 +#define FT_DESC 6 +#define PB_OK 7 +#define PB_CANCEL 8 +#define PB_HELP 9 diff --git a/sw/source/ui/dialog/abstract.src b/sw/source/ui/dialog/abstract.src new file mode 100644 index 000000000000..87f7bfb9174c --- /dev/null +++ b/sw/source/ui/dialog/abstract.src @@ -0,0 +1,153 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "dialog.hrc" +#include "helpid.h" +#include "abstract.hrc" + +ModalDialog DLG_INSERT_ABSTRACT +{ + HelpID = HID_INSERT_ABSTRACT ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 239 , 68 ) ; + /* ### ACHTUNG: Neuer Text in Resource? AutoAbstract erzeugen : AutoAbstrakt erzeugen */ + /* ### ACHTUNG: Neuer Text in Resource? AutoAbstract erzeugen : AutoAbstrakt erzeugen */ + /* ### ACHTUNG: Neuer Text in Resource? AutoAbstract erzeugen : AutoAbstrakt erzeugen */ + Moveable = TRUE ; + FixedLine FL_1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 174 , 8 ) ; + Text [ en-US ] = "Properties" ; + }; + FixedText FT_LEVEL + { + Pos = MAP_APPFONT ( 12 , 12 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Text [ en-US ] = "Included outline levels" ; + }; + NumericField NF_LEVEL + { + Border = TRUE ; + Pos = MAP_APPFONT ( 153 , 12 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 5 ; + Value = 3 ; + First = 1 ; + Last = 5 ; + }; + FixedText FT_PARA + { + Pos = MAP_APPFONT ( 12 , 27 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + /* ### ACHTUNG: Neuer Text in Resource? Absätze je Kapitel : Absõtze je Kapitel */ + Text [ en-US ] = "Subpoints per level" ; + }; + NumericField NF_PARA + { + Border = TRUE ; + Pos = MAP_APPFONT ( 153 , 27 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 5 ; + Value = 1 ; + First = 1 ; + Last = 5 ; + }; + FixedText FT_DESC + { + Pos = MAP_APPFONT ( 12 , 43 ) ; + Size = MAP_APPFONT ( 165 , 16 ) ; + /* ### ACHTUNG: Neuer Text in Resource? Im Abstrakt erscheint die ausgewählte Anzahl von Absätzen aus den einbezogenen Kapitelebenen. : Im Abstrakt erscheint die ausgewõhlte Anzahl von Absõtzen aus den einbezogenen Kapitelebenen. */ + WordBreak = TRUE ; + Text [ en-US ] = "The abstract contains the selected number of paragraphs from the included outline levels." ; + }; + OKButton PB_OK + { + Pos = MAP_APPFONT ( 186 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 186 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 186 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + Text [ en-US ] = "Create AutoAbstract" ; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/dialog/addrdlg.cxx b/sw/source/ui/dialog/addrdlg.cxx new file mode 100644 index 000000000000..f168d0684a81 --- /dev/null +++ b/sw/source/ui/dialog/addrdlg.cxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include "addrdlg.hxx" +#include <svx/svxdlg.hxx> +#include <sfx2/sfx.hrc> + +/**************************************************************************** +Ctor +****************************************************************************/ + + +SwAddrDlg::SwAddrDlg(Window* pParent, const SfxItemSet& rSet ) : + + SfxSingleTabDialog(pParent, rSet, 0) + +{ + // TabPage erzeugen + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SFXPAGE_GENERAL ); + if ( fnCreatePage ) + { + SfxTabPage* pPage2 = (*fnCreatePage)( this, rSet ); + SetTabPage(pPage2); + } +} + +/**************************************************************************** +Dtor +****************************************************************************/ + + +__EXPORT SwAddrDlg::~SwAddrDlg() +{ +} + + diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx new file mode 100644 index 000000000000..355e68bd5c58 --- /dev/null +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -0,0 +1,450 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif +#include <hintids.hxx> +#include <rtl/textenc.h> +#include <i18npool/mslangid.hxx> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <unotools/lingucfg.hxx> +#include <fontcfg.hxx> +#include <swmodule.hxx> +#include <editeng/unolingu.hxx> +#include <sfx2/printer.hxx> +#include <editeng/flstitem.hxx> +#include <svx/dlgutil.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/langitem.hxx> +#include <editeng/scripttypeitem.hxx> +#include <swtypes.hxx> +#include <ascfldlg.hxx> +#include <shellio.hxx> +#include <docsh.hxx> +#include <doc.hxx> +#include <errhdl.hxx> + +#ifndef _DIALOG_HRC +#include <dialog.hrc> +#endif +#ifndef _ASCFLDLG_HRC +#include <ascfldlg.hrc> +#endif + + +using namespace ::com::sun::star; + +const sal_Unicode cDialogExtraDataClose = '}'; +const char __FAR_DATA sDialogImpExtraData[] = "EncImpDlg:{"; +const char __FAR_DATA sDialogExpExtraData[] = "EncExpDlg:{"; +const USHORT nDialogExtraDataLen = 11; // 12345678901 + +SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, + SvStream* pStream ) + : SfxModalDialog( pParent, SW_RES( DLG_ASCII_FILTER )), + aFL( this, SW_RES( FL_1 )), + aCharSetFT( this, SW_RES( FT_CHARSET )), + aCharSetLB( this, SW_RES( LB_CHARSET )), + aFontFT( this, SW_RES( FT_FONT )), + aFontLB( this, SW_RES( LB_FONT )), + aLanguageFT( this, SW_RES( FT_LANGUAGE )), + aLanguageLB( this, SW_RES( LB_LANGUAGE )), + aCRLF_FT( this, SW_RES( FT_CRLF )), + aCRLF_RB( this, SW_RES( RB_CRLF )), + aCR_RB( this, SW_RES( RB_CR )), + aLF_RB( this, SW_RES( RB_LF )), + aOkPB( this, SW_RES( PB_OK )), + aCancelPB( this, SW_RES( PB_CANCEL )), + aHelpPB( this, SW_RES( PB_HELP )), + sSystemCharSet( SW_RES( STR_SYS_CHARSET )), + bSaveLineStatus( TRUE ) +{ + FreeResource(); + + SwAsciiOptions aOpt; + { + const String& rFindNm = String::CreateFromAscii( + pStream ? sDialogImpExtraData + : sDialogExpExtraData); + USHORT nEnd, nStt = GetExtraData().Search( rFindNm ); + if( STRING_NOTFOUND != nStt ) + { + nStt += nDialogExtraDataLen; + nEnd = GetExtraData().Search( cDialogExtraDataClose, nStt ); + if( STRING_NOTFOUND != nEnd ) + { + aOpt.ReadUserData( GetExtraData().Copy( nStt, nEnd - nStt )); + nStt -= nDialogExtraDataLen; + GetExtraData().Erase( nStt, nEnd - nStt + 1 ); + } + } + } + + // read the first chars and check the charset, (language - with L&H) + if( pStream ) + { + char aBuffer[ 4098 ]; + ULONG nOldPos = pStream->Tell(); + ULONG nBytesRead = pStream->Read( aBuffer, 4096 ); + pStream->Seek( nOldPos ); + + if( nBytesRead <= 4096 ) + { + aBuffer[ nBytesRead ] = '0'; + aBuffer[ nBytesRead+1 ] = '0'; + if( 0 != ( nBytesRead & 0x00000001 ) ) + aBuffer[ nBytesRead + 2 ] = '0'; + } + + BOOL bCR = FALSE, bLF = FALSE, bNoNormalChar = FALSE, + bNullChar = FALSE; + for( USHORT nCnt = 0; nCnt < nBytesRead; ++nCnt ) + switch( aBuffer[ nCnt ] ) + { + case 0x0: bNullChar = TRUE; break; + case 0xA: bLF = TRUE; break; + case 0xD: bCR = TRUE; break; + case 0xC: + case 0x1A: + case 0x9: break; + default: + if( 0x20 > aBuffer[ nCnt ] ) + bNoNormalChar = TRUE; + } + + if( !bNullChar ) + { + if( bCR ) + { + if( bLF ) + { + aOpt.SetParaFlags( LINEEND_CRLF ); +// have to check if of CharSet is type of ANSI +// aOpt.SetCharSet( CHARSET_ANSI ); + } + else + { + aOpt.SetParaFlags( LINEEND_CR ); +// have to check if CharSet is type of MAC +// aOpt.SetCharSet( CHARSET_MAC ); + } + } + else if( bLF ) + { + aOpt.SetParaFlags( LINEEND_LF ); +// have to check if of CharSet is type of ANSI +// aOpt.SetCharSet( CHARSET_ANSI ); + } + } + + SwDoc* pDoc = rDocSh.GetDoc(); + + USHORT nAppScriptType = GetI18NScriptTypeOfLanguage( (USHORT)GetAppLanguage() ); + { + BOOL bDelPrinter = FALSE; + SfxPrinter* pPrt = pDoc ? pDoc->getPrinter(false) : 0; + if( !pPrt ) + { + SfxItemSet* pSet = new SfxItemSet( rDocSh.GetPool(), + SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, + SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, + 0 ); + pPrt = new SfxPrinter( pSet ); + bDelPrinter = TRUE; + } + + const USHORT nCount = pPrt->GetFontCount(); + for (USHORT i = 0; i < nCount; ++i) + { + const String &rStr = pPrt->GetFont(i)->GetName(); + aFontLB.InsertEntry( rStr ); + } + + if( !aOpt.GetFontName().Len() ) + { + if(pDoc) + { + USHORT nFontRes = RES_CHRATR_FONT; + if(SCRIPTTYPE_ASIAN == nAppScriptType) + nFontRes = RES_CHRATR_CJK_FONT; + else if(SCRIPTTYPE_COMPLEX == nAppScriptType) + nFontRes = RES_CHRATR_CTL_FONT; + + aOpt.SetFontName( ((SvxFontItem&)pDoc->GetDefault( + nFontRes )).GetFamilyName() ); + } + else + { + USHORT nFontType = FONT_STANDARD; + if(SCRIPTTYPE_ASIAN == nAppScriptType) + nFontType = FONT_STANDARD_CJK; + else if(SCRIPTTYPE_COMPLEX == nAppScriptType) + nFontType = FONT_STANDARD_CTL; + aOpt.SetFontName(SW_MOD()->GetStdFontConfig()->GetFontFor(nFontType)); + } + } + aFontLB.SelectEntry( aOpt.GetFontName() ); + + if( bDelPrinter ) + delete pPrt; + } + + // initialisiere Sprache + { + if( !aOpt.GetLanguage() ) + { + if(pDoc) + { + USHORT nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType); + aOpt.SetLanguage( ((SvxLanguageItem&)pDoc-> + GetDefault( nWhich )).GetLanguage()); + } + else + { + SvtLinguOptions aLinguOpt; + SvtLinguConfig().GetOptions( aLinguOpt ); + switch(nAppScriptType) + { + case SCRIPTTYPE_ASIAN: + aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, SCRIPTTYPE_ASIAN)); + break; + case SCRIPTTYPE_COMPLEX: + aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, SCRIPTTYPE_COMPLEX)); + break; + //SCRIPTTYPE_LATIN: + default: + aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, SCRIPTTYPE_LATIN)); + } + } + } + + aLanguageLB.SetLanguageList( LANG_LIST_ALL, TRUE, FALSE ); + aLanguageLB.SelectLanguage( aOpt.GetLanguage() ); + } + } + else + { + // hide the used Control for the Export and move the + // other behind the charset controls + aFontFT.Hide(); + aFontLB.Hide(); + aLanguageFT.Hide(); + aLanguageLB.Hide(); + + long nY = aFontFT.GetPosPixel().Y() + 1; + Point aPos( aCRLF_FT.GetPosPixel() ); aPos.Y() = nY; + aCRLF_FT.SetPosPixel( aPos ); + + aPos = aCRLF_RB.GetPosPixel(); aPos.Y() = nY; + aCRLF_RB.SetPosPixel( aPos ); + + aPos = aCR_RB.GetPosPixel(); aPos.Y() = nY; + aCR_RB.SetPosPixel( aPos ); + + aPos = aLF_RB.GetPosPixel(); aPos.Y() = nY; + aLF_RB.SetPosPixel( aPos ); + + Size aSize = GetSizePixel(); + Size aTmpSz( 6, 6 ); + aTmpSz = LogicToPixel(aTmpSz, MAP_APPFONT); + aSize.Height() = aHelpPB.GetPosPixel().Y() + + aHelpPB.GetSizePixel().Height() + aTmpSz.Height(); + SetSizePixel( aSize ); + } + + // initialisiere Zeichensatz + aCharSetLB.FillFromTextEncodingTable( pStream != NULL ); + aCharSetLB.SelectTextEncoding( aOpt.GetCharSet() ); + + aCharSetLB.SetSelectHdl( LINK( this, SwAsciiFilterDlg, CharSetSelHdl )); + aCRLF_RB.SetToggleHdl( LINK( this, SwAsciiFilterDlg, LineEndHdl )); + aLF_RB.SetToggleHdl( LINK( this, SwAsciiFilterDlg, LineEndHdl )); + aCR_RB.SetToggleHdl( LINK( this, SwAsciiFilterDlg, LineEndHdl )); + + SetCRLF( aOpt.GetParaFlags() ); + + aCRLF_RB.SaveValue(); + aLF_RB.SaveValue(); + aCR_RB.SaveValue(); +} + + +SwAsciiFilterDlg::~SwAsciiFilterDlg() +{ +} + + +void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions ) +{ + ULONG nCCode = aCharSetLB.GetSelectTextEncoding(); + String sFont; + ULONG nLng = 0; + if( aFontLB.IsVisible() ) + { + sFont = aFontLB.GetSelectEntry(); + nLng = (ULONG)aLanguageLB.GetSelectLanguage(); + } + + rOptions.SetFontName( sFont ); + rOptions.SetCharSet( rtl_TextEncoding( nCCode ) ); + rOptions.SetLanguage( USHORT( nLng ) ); + rOptions.SetParaFlags( GetCRLF() ); + + // JP: Task #71802# save the user settings + String sData; + rOptions.WriteUserData( sData ); + if( sData.Len() ) + { + const String& rFindNm = String::CreateFromAscii( + aFontLB.IsVisible() ? sDialogImpExtraData + : sDialogExpExtraData); + USHORT nEnd, nStt = GetExtraData().Search( rFindNm ); + if( STRING_NOTFOUND != nStt ) + { + // called twice, so remove "old" settings + nEnd = GetExtraData().Search( cDialogExtraDataClose, + nStt + nDialogExtraDataLen ); + if( STRING_NOTFOUND != nEnd ) + GetExtraData().Erase( nStt, nEnd - nStt + 1 ); + } + String sTmp(GetExtraData()); + sTmp += rFindNm; + sTmp += sData; + sTmp += cDialogExtraDataClose; + GetExtraData() = sTmp; + } +} + +void SwAsciiFilterDlg::SetCRLF( LineEnd eEnd ) +{ + switch( eEnd ) + { + case LINEEND_CR: aCR_RB.Check(); break; + case LINEEND_CRLF: aCRLF_RB.Check(); break; + case LINEEND_LF: aLF_RB.Check(); break; + } +} + +LineEnd SwAsciiFilterDlg::GetCRLF() const +{ + LineEnd eEnd; + if( aCR_RB.IsChecked() ) + eEnd = LINEEND_CR; + else if( aLF_RB.IsChecked() ) + eEnd = LINEEND_LF; + else + eEnd = LINEEND_CRLF; + return eEnd; +} + +IMPL_LINK( SwAsciiFilterDlg, CharSetSelHdl, SvxTextEncodingBox*, pBox ) +{ + LineEnd eOldEnd = GetCRLF(), eEnd = (LineEnd)-1; + LanguageType nLng = aFontLB.IsVisible() + ? aLanguageLB.GetSelectLanguage() + : LANGUAGE_SYSTEM, + nOldLng = nLng; + + rtl_TextEncoding nChrSet = pBox->GetSelectTextEncoding(); + if( nChrSet == gsl_getSystemTextEncoding() ) + eEnd = GetSystemLineEnd(); + else + { + switch( nChrSet ) + { + case RTL_TEXTENCODING_MS_1252: +#ifdef UNX + eEnd = LINEEND_LF; +#else + eEnd = LINEEND_CRLF; // ANSI +#endif + break; + + case RTL_TEXTENCODING_APPLE_ROMAN: // MAC + eEnd = LINEEND_CR; + break; + + case RTL_TEXTENCODING_IBM_850: // DOS + eEnd = LINEEND_CRLF; + break; + + case RTL_TEXTENCODING_APPLE_ARABIC: + case RTL_TEXTENCODING_APPLE_CENTEURO: + case RTL_TEXTENCODING_APPLE_CROATIAN: + case RTL_TEXTENCODING_APPLE_CYRILLIC: + case RTL_TEXTENCODING_APPLE_DEVANAGARI: + case RTL_TEXTENCODING_APPLE_FARSI: + case RTL_TEXTENCODING_APPLE_GREEK: + case RTL_TEXTENCODING_APPLE_GUJARATI: + case RTL_TEXTENCODING_APPLE_GURMUKHI: + case RTL_TEXTENCODING_APPLE_HEBREW: + case RTL_TEXTENCODING_APPLE_ICELAND: + case RTL_TEXTENCODING_APPLE_ROMANIAN: + case RTL_TEXTENCODING_APPLE_THAI: + case RTL_TEXTENCODING_APPLE_TURKISH: + case RTL_TEXTENCODING_APPLE_UKRAINIAN: + case RTL_TEXTENCODING_APPLE_CHINSIMP: + case RTL_TEXTENCODING_APPLE_CHINTRAD: + case RTL_TEXTENCODING_APPLE_JAPANESE: + case RTL_TEXTENCODING_APPLE_KOREAN: + eEnd = LINEEND_CR; + break; + } + } + + bSaveLineStatus = FALSE; + if( eEnd != (LineEnd)-1 ) // changed? + { + if( eOldEnd != eEnd ) + SetCRLF( eEnd ); + } + else + { + // restore old user choise (not the automatic!) + aCRLF_RB.Check( aCRLF_RB.GetSavedValue() ); + aCR_RB.Check( aCR_RB.GetSavedValue() ); + aLF_RB.Check( aLF_RB.GetSavedValue() ); + } + bSaveLineStatus = TRUE; + + if( nOldLng != nLng && aFontLB.IsVisible() ) + aLanguageLB.SelectLanguage( nLng ); + + return 0; +} + +IMPL_LINK( SwAsciiFilterDlg, LineEndHdl, RadioButton*, pBtn ) +{ + if( bSaveLineStatus ) + pBtn->SaveValue(); + return 0; +} + + diff --git a/sw/source/ui/dialog/ascfldlg.hrc b/sw/source/ui/dialog/ascfldlg.hrc new file mode 100644 index 000000000000..b96cdc39b57a --- /dev/null +++ b/sw/source/ui/dialog/ascfldlg.hrc @@ -0,0 +1,44 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define FL_1 1 +#define FT_CHARSET 2 +#define LB_CHARSET 3 +#define FT_FONT 4 +#define LB_FONT 5 +#define FT_LANGUAGE 6 +#define LB_LANGUAGE 7 +#define FT_CRLF 8 +#define RB_CRLF 9 +#define RB_CR 10 +#define RB_LF 11 +#define PB_OK 12 +#define PB_CANCEL 13 +#define PB_HELP 14 +#define STR_SYS_CHARSET 15 + + diff --git a/sw/source/ui/dialog/ascfldlg.src b/sw/source/ui/dialog/ascfldlg.src new file mode 100644 index 000000000000..6ef0ea42b656 --- /dev/null +++ b/sw/source/ui/dialog/ascfldlg.src @@ -0,0 +1,177 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "dialog.hrc" +#include "helpid.h" +#include "ascfldlg.hrc" + +ModalDialog DLG_ASCII_FILTER +{ + HelpID = HID_ASCII_FILTER ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 239 , 80 ) ; + Moveable = TRUE ; + FixedLine FL_1 + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 170 , 8 ) ; + Text [ en-US ] = "Properties"; + }; + FixedText FT_CHARSET + { + Pos = MAP_APPFONT ( 12 , 15 ) ; + Size = MAP_APPFONT ( 66 , 10 ) ; + Text [ en-US ] = "~Character set"; + }; + ListBox LB_CHARSET + { + Pos = MAP_APPFONT ( 80 , 14 ) ; + Size = MAP_APPFONT ( 90 , 61 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + FixedText FT_FONT + { + Pos = MAP_APPFONT ( 12 , 31 ) ; + Size = MAP_APPFONT ( 66 , 10 ) ; + Text [ en-US ] = "Default fonts"; + }; + ListBox LB_FONT + { + Pos = MAP_APPFONT ( 80 , 30 ) ; + Size = MAP_APPFONT ( 90 , 61 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + FixedText FT_LANGUAGE + { + Pos = MAP_APPFONT ( 12 , 47 ) ; + Size = MAP_APPFONT ( 66 , 10 ) ; + Text [ en-US ] = "Lan~guage"; + }; + ListBox LB_LANGUAGE + { + Pos = MAP_APPFONT ( 80 , 46 ) ; + Size = MAP_APPFONT ( 90 , 61 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + Sort = TRUE ; + }; + FixedText FT_CRLF + { + Pos = MAP_APPFONT ( 12 , 64 ) ; + Size = MAP_APPFONT ( 66 , 8 ) ; + Text [ en-US ] = "~Paragraph break"; + }; + RadioButton RB_CRLF + { + Pos = MAP_APPFONT ( 80 , 64 ) ; + Size = MAP_APPFONT ( 40 , 10 ) ; + TabStop = TRUE ; + Check = TRUE; + Text [ en-US ] = "~CR & LF"; + }; + RadioButton RB_CR + { + Pos = MAP_APPFONT ( 121 , 64 ) ; + Size = MAP_APPFONT ( 20 , 10 ) ; +// TabStop = TRUE ; + Text [ en-US ] = "C~R"; + }; + RadioButton RB_LF + { + Pos = MAP_APPFONT ( 155 , 64 ) ; + Size = MAP_APPFONT ( 20 , 10 ) ; +// TabStop = TRUE ; + Text [ en-US ] = "~LF"; + }; + + OKButton PB_OK + { + Pos = MAP_APPFONT ( 183 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 183 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 183 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + String STR_SYS_CHARSET + { + Text [ en-US ] = "System"; + }; + Text [ en-US ] = "ASCII Filter Options"; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/dialog/dialog.src b/sw/source/ui/dialog/dialog.src new file mode 100644 index 000000000000..26b615bff7b2 --- /dev/null +++ b/sw/source/ui/dialog/dialog.src @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "dialog.hrc" + +CheckBox CB_USE_PASSWD +{ + /* ### ACHTUNG: Neuer Text in Resource? ~Paßwort : ~Pa˜wort */ + Text [ en-US ] = "~Password" ; +}; +CheckBox CB_READ_ONLY +{ + Text [ en-US ] = "~Read-only" ; +}; +String STR_LINKEDIT_TEXT +{ + /* ### ACHTUNG: Neuer Text in Resource? Verknüpfungen bearbeiten : Verkn³pfungen bearbeiten */ + Text [ en-US ] = "Edit links" ; +}; +String STR_PATH_NOT_FOUND +{ + Text [ en-US ] = "The directory '%1' does not exist." ; +}; +String STR_FLT_SGV +{ + Text = "SGV - StarDraw 2.0,SGV" ; +}; + +QueryBox RID_QB_SPELL_CONTINUE +{ + BUTTONS = WB_YES_NO ; + DEFBUTTON = WB_DEF_YES ; + MESSAGE [ en-US ] = "Continue checking at beginning of document?" ; +}; +String STR_SPELLING_COMPLETED +{ + Text [ en-US ] = "The spellcheck is complete." ; +}; + diff --git a/sw/source/ui/dialog/docstdlg.cxx b/sw/source/ui/dialog/docstdlg.cxx new file mode 100644 index 000000000000..40f0fddf98f8 --- /dev/null +++ b/sw/source/ui/dialog/docstdlg.cxx @@ -0,0 +1,197 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include <stdio.h> +#include <ctype.h> +#include <swwait.hxx> +#include <wrtsh.hxx> +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#include <swmodule.hxx> +#ifndef _GLOBALS_HRC +#include <globals.hrc> +#endif +#ifndef _DOCSH_HXX +#include <docsh.hxx> +#endif +#ifndef _PVIEW_HXX +#include <pview.hxx> +#endif +#include <doc.hxx> +#include <docstdlg.hxx> +#ifndef _MODCFG_HXX +#include <modcfg.hxx> +#endif + +// fuer Statistikfelder +#include <fldmgr.hxx> +#include <fldbas.hxx> + +#ifndef _DOCSTDLG_HRC +#include <docstdlg.hrc> +#endif + + +/*-------------------------------------------------------------------- + Beschreibung: Create + --------------------------------------------------------------------*/ + + +SfxTabPage * SwDocStatPage::Create(Window *pParent, const SfxItemSet &rSet) +{ + return new SwDocStatPage(pParent, rSet); +} + +/*-------------------------------------------------------------------- + Beschreibung: Ctor + --------------------------------------------------------------------*/ + + +SwDocStatPage::SwDocStatPage(Window *pParent, const SfxItemSet &rSet) : + + SfxTabPage (pParent, SW_RES(TP_DOC_STAT), rSet), + + aTableLbl (this, SW_RES( FT_TABLE )), + aGrfLbl (this, SW_RES( FT_GRF )), + aOLELbl (this, SW_RES( FT_OLE )), + aPageLbl (this, SW_RES( FT_PAGE )), + aParaLbl (this, SW_RES( FT_PARA )), + aWordLbl (this, SW_RES( FT_WORD )), + aCharLbl (this, SW_RES( FT_CHAR )), + aLineLbl (this, SW_RES( FT_LINE )), + + aTableNo (this, SW_RES( FT_TABLE_COUNT)), + aGrfNo (this, SW_RES( FT_GRF_COUNT )), + aOLENo (this, SW_RES( FT_OLE_COUNT )), + aPageNo (this, SW_RES( FT_PAGE_COUNT )), + aParaNo (this, SW_RES( FT_PARA_COUNT )), + aWordNo (this, SW_RES( FT_WORD_COUNT )), + aCharNo (this, SW_RES( FT_CHAR_COUNT )), + aLineNo (this, SW_RES( FT_LINE_COUNT )), + aUpdatePB (this, SW_RES( PB_PDATE )) +{ + Update(); + FreeResource(); + aUpdatePB.SetClickHdl(LINK(this, SwDocStatPage, UpdateHdl)); + //#111684# is the current view a page preview no SwFEShell can be found -> hide the update button + SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current(); + SwFEShell* pFEShell = pDocShell->GetFEShell(); + if(!pFEShell) + { + aUpdatePB.Show(FALSE); + aLineLbl.Show(FALSE); + aLineNo .Show(FALSE); + } + +} + + + SwDocStatPage::~SwDocStatPage() +{ +} + +/*-------------------------------------------------------------------- + Beschreibung: ItemSet fuellen bei Aenderung + --------------------------------------------------------------------*/ + + +BOOL SwDocStatPage::FillItemSet(SfxItemSet & /*rSet*/) +{ + return FALSE; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + +void SwDocStatPage::Reset(const SfxItemSet &/*rSet*/) +{ +} +/*------------------------------------------------------------------------ + Beschreibung: Aktualisieren / Setzen der Daten +------------------------------------------------------------------------*/ + + +void SwDocStatPage::SetData(const SwDocStat &rStat) +{ + aTableNo.SetText(String::CreateFromInt32( rStat.nTbl )); + aGrfNo.SetText(String::CreateFromInt32( rStat.nGrf )); + aOLENo.SetText(String::CreateFromInt32( rStat.nOLE )); + aPageNo.SetText(String::CreateFromInt32( rStat.nPage )); + aParaNo.SetText(String::CreateFromInt32( rStat.nPara )); + aWordNo.SetText(String::CreateFromInt32( rStat.nWord )); + aCharNo.SetText(String::CreateFromInt32( rStat.nChar )); +} + +/*------------------------------------------------------------------------ + Beschreibung: Aktualisieren der Statistik +------------------------------------------------------------------------*/ + + +void SwDocStatPage::Update() +{ + SfxViewShell *pVSh = SfxViewShell::Current(); + ViewShell *pSh = 0; + if ( pVSh->ISA(SwView) ) + pSh = ((SwView*)pVSh)->GetWrtShellPtr(); + else if ( pVSh->ISA(SwPagePreView) ) + pSh = ((SwPagePreView*)pVSh)->GetViewShell(); + + ASSERT( pSh, "Shell not found" ); + + SwWait aWait( *pSh->GetDoc()->GetDocShell(), TRUE ); + pSh->StartAction(); + aDocStat = pSh->GetDoc()->GetDocStat(); + pSh->GetDoc()->UpdateDocStat( aDocStat ); + pSh->EndAction(); + + SetData(aDocStat); +} + +/*-----------------19.06.97 16.37------------------- + Zeilennummer aktualisieren +--------------------------------------------------*/ +IMPL_LINK( SwDocStatPage, UpdateHdl, PushButton*, EMPTYARG) +{ + Update(); + SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current(); + SwFEShell* pFEShell = pDocShell->GetFEShell(); + if(pFEShell) + aLineNo.SetText( String::CreateFromInt32( pFEShell->GetLineCount(FALSE))); + //pButton->Disable(); + return 0; +} + diff --git a/sw/source/ui/dialog/docstdlg.hrc b/sw/source/ui/dialog/docstdlg.hrc new file mode 100644 index 000000000000..5084ea58dbdb --- /dev/null +++ b/sw/source/ui/dialog/docstdlg.hrc @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define FT_TABLE 1 +#define FT_GRF 2 +#define FT_OLE 3 +#define FT_PAGE 4 +#define FT_PARA 5 +#define FT_WORD 6 +#define FT_CHAR 9 +#define FT_TABLE_COUNT 10 +#define FT_GRF_COUNT 11 +#define FT_OLE_COUNT 12 +#define FT_PAGE_COUNT 13 +#define FT_PARA_COUNT 14 +#define FT_WORD_COUNT 15 +#define FT_CHAR_COUNT 16 +#define FT_LINE 17 +#define FT_LINE_COUNT 18 +#define PB_PDATE 19 + +#define BT_OK 100 + diff --git a/sw/source/ui/dialog/docstdlg.src b/sw/source/ui/dialog/docstdlg.src new file mode 100644 index 000000000000..4384acbe3fe9 --- /dev/null +++ b/sw/source/ui/dialog/docstdlg.src @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "globals.hrc" +#include "docstdlg.hrc" +#include "helpid.h" + // #define TP_DOC_STAT 256 +TabPage TP_DOC_STAT +{ + HelpID = HID_DOC_STAT ; + Hide = TRUE; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedText FT_PAGE + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Number of Pages:" ; + Left = TRUE ; + }; + FixedText FT_TABLE + { + Pos = MAP_APPFONT ( 6 , 18 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Number of Tables:" ; + Left = TRUE ; + }; + FixedText FT_GRF + { + Pos = MAP_APPFONT ( 6 , 30 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Number of Graphics:" ; + Left = TRUE ; + }; + FixedText FT_OLE + { + Pos = MAP_APPFONT ( 6 , 42 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Number of OLE Objects:" ; + Left = TRUE ; + }; + FixedText FT_PARA + { + Pos = MAP_APPFONT ( 6 , 54 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Number of Paragraphs:" ; + Left = TRUE ; + }; + FixedText FT_WORD + { + Pos = MAP_APPFONT ( 6 , 68 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Number of Words:" ; + Left = TRUE ; + }; + FixedText FT_CHAR + { + Pos = MAP_APPFONT ( 6 , 82 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Number of Characters:" ; + Left = TRUE ; + }; + FixedText FT_LINE + { + Pos = MAP_APPFONT ( 6 , 96 ) ; + Size = MAP_APPFONT ( 90 , 8 ) ; + Text [ en-US ] = "Number of Lines:" ; + }; + FixedText FT_PAGE_COUNT + { + Pos = MAP_APPFONT ( 114 , 6 ) ; + Size = MAP_APPFONT ( 27 , 8 ) ; + Left = TRUE ; + }; + FixedText FT_TABLE_COUNT + { + Pos = MAP_APPFONT ( 114 , 18 ) ; + Size = MAP_APPFONT ( 27 , 8 ) ; + Left = TRUE ; + }; + FixedText FT_GRF_COUNT + { + Pos = MAP_APPFONT ( 114 , 30 ) ; + Size = MAP_APPFONT ( 27 , 8 ) ; + Left = TRUE ; + }; + FixedText FT_OLE_COUNT + { + Pos = MAP_APPFONT ( 114 , 42 ) ; + Size = MAP_APPFONT ( 27 , 8 ) ; + Left = TRUE ; + }; + FixedText FT_PARA_COUNT + { + Pos = MAP_APPFONT ( 114 , 54 ) ; + Size = MAP_APPFONT ( 27 , 8 ) ; + Left = TRUE ; + }; + FixedText FT_WORD_COUNT + { + Pos = MAP_APPFONT ( 114 , 68 ) ; + Size = MAP_APPFONT ( 27 , 8 ) ; + Left = TRUE ; + }; + FixedText FT_CHAR_COUNT + { + Pos = MAP_APPFONT ( 114 , 82 ) ; + Size = MAP_APPFONT ( 27 , 8 ) ; + Left = TRUE ; + }; + FixedText FT_LINE_COUNT + { + Pos = MAP_APPFONT ( 114 , 96 ) ; + Size = MAP_APPFONT ( 27 , 8 ) ; + Left = TRUE ; + Text = "..." ; + }; + PushButton PB_PDATE + { + Pos = MAP_APPFONT ( 204 , 94 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "~Update" ; + }; +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/source/ui/dialog/macassgn.cxx b/sw/source/ui/dialog/macassgn.cxx new file mode 100644 index 000000000000..2d2b7c357720 --- /dev/null +++ b/sw/source/ui/dialog/macassgn.cxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include "hintids.hxx" + +#define _SVSTDARR_STRINGSDTOR +#include <svl/svstdarr.hxx> +#include <svx/htmlmode.hxx> +#ifndef _SVX_SVXIDS_HRC //autogen +#include <svx/svxids.hrc> +#endif +#include <sfx2/app.hxx> +#include <vcl/msgbox.hxx> + +#include "swtypes.hxx" +#include "wrtsh.hxx" +#include "viewopt.hxx" +#include "macassgn.hxx" +#include "swevent.hxx" +#include "docsh.hxx" +#include "globals.hrc" +#include "view.hxx" +#include <sfx2/viewfrm.hxx> + +#include <svx/svxdlg.hxx> + +#include <doc.hxx> + +using ::com::sun::star::uno::Reference; +using ::com::sun::star::frame::XFrame; + +// SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage*, const String& ); + +SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) +{ + // const SfxItemSet& rSet = rPg.GetItemSet(); + SfxEventNamesItem aItem(SID_EVENTCONFIG); + + BOOL bHtmlMode = FALSE; + USHORT nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); + bHtmlMode = nHtmlMode & HTMLMODE_ON ? TRUE : FALSE; + + switch( eType ) + { + case MACASSGN_TEXTBAUST: // Textbausteine + // rPg.SetGetRangeLink( &_GetRangeHdl ); + aItem.AddEvent( String( SW_RES(STR_EVENT_START_INS_GLOSSARY) ), String(), + SW_EVENT_START_INS_GLOSSARY ); + aItem.AddEvent( String( SW_RES(STR_EVENT_END_INS_GLOSSARY) ), String(), + SW_EVENT_END_INS_GLOSSARY); + // damit der neue Handler aktiv wird! + // rPg.Reset( rSet ); + break; + case MACASSGN_ALLFRM: + case MACASSGN_GRAPHIC: // Grafiken + { + aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ERROR) ), String(), + SVX_EVENT_IMAGE_ERROR); + aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ABORT) ), String(), + SVX_EVENT_IMAGE_ABORT); + aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_LOAD) ), String(), + SVX_EVENT_IMAGE_LOAD); + } + // kein break; + case MACASSGN_FRMURL: // Frm - URL-Attribute + { + if( !bHtmlMode && + (MACASSGN_FRMURL == eType || MACASSGN_ALLFRM == eType)) + { + aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_A ) ), String(), + SW_EVENT_FRM_KEYINPUT_ALPHA ); + aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_NOA ) ), String(), + SW_EVENT_FRM_KEYINPUT_NOALPHA ); + aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_RESIZE ) ), String(), + SW_EVENT_FRM_RESIZE ); + aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_MOVE ) ), String(), + SW_EVENT_FRM_MOVE ); + } + } + // kein break; + case MACASSGN_OLE: // OLE + { + if( !bHtmlMode ) + aItem.AddEvent( String( SW_RES(STR_EVENT_OBJECT_SELECT) ), String(), + SW_EVENT_OBJECT_SELECT ); + } + // kein break; + case MACASSGN_INETFMT: // INetFmt-Attribute + { + aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOVER_OBJECT) ), String(), + SFX_EVENT_MOUSEOVER_OBJECT ); + aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSECLICK_OBJECT) ), String(), + SFX_EVENT_MOUSECLICK_OBJECT); + aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOUT_OBJECT) ), String(), + SFX_EVENT_MOUSEOUT_OBJECT); + } + break; + } + + return aItem; +} + + +BOOL SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh, + SvxMacroItem*& rpINetItem ) +{ + BOOL bRet = FALSE; + SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 ); + SvxMacroItem aItem( RES_FRMMACRO ); + if( !rpINetItem ) + rpINetItem = new SvxMacroItem( RES_FRMMACRO ); + else + aItem.SetMacroTable( rpINetItem->GetMacroTable() ); + + aSet.Put( aItem ); + aSet.Put( AddEvents( MACASSGN_INETFMT ) ); + + SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); + SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pParent, aSet, + rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), + SID_EVENTCONFIG ); + if ( pMacroDlg && pMacroDlg->Execute() == RET_OK ) + { + const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet(); + const SfxPoolItem* pItem; + if( SFX_ITEM_SET == pOutSet->GetItemState( RES_FRMMACRO, FALSE, &pItem )) + { + rpINetItem->SetMacroTable( ((SvxMacroItem*)pItem)->GetMacroTable() ); + bRet = TRUE; + } + } + return bRet; +} + +/* +SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage* , const String& rLanguage ) +{ + SvStringsDtor* pNew = new SvStringsDtor; + + SfxApplication* pSfxApp = SFX_APP(); + if ( !rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT) ) + { + pSfxApp->EnterBasicCall(); + + String* pNewEntry = new String( pSfxApp->GetName() ); + pNew->Insert( pNewEntry, pNew->Count() ); + + TypeId aType( TYPE( SwDocShell )); + SfxObjectShell* pDoc = SfxObjectShell::GetFirst( &aType ); + while( pDoc ) + { + pNewEntry = new String( pDoc->GetTitle() ); + pNew->Insert( pNewEntry, pNew->Count() ); + pDoc = SfxObjectShell::GetNext( *pDoc, &aType ); + } + pSfxApp->LeaveBasicCall(); + } + + return pNew; +} +*/ + + + diff --git a/sw/source/ui/dialog/makefile.mk b/sw/source/ui/dialog/makefile.mk new file mode 100644 index 000000000000..758ea00fcb10 --- /dev/null +++ b/sw/source/ui/dialog/makefile.mk @@ -0,0 +1,99 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* +PRJ=..$/..$/.. + +PRJNAME=sw +TARGET=dialog +LIBTARGET=no + +# future: DEMO\dialog.srs + +# --- Settings ----------------------------------------------------- + +.INCLUDE : $(PRJ)$/inc$/swpre.mk +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/inc$/sw.mk + +# --- Files -------------------------------------------------------- + +SRS1NAME=$(TARGET) +SRC1FILES = \ + abstract.src \ + ascfldlg.src \ + dialog.src \ + docstdlg.src \ + regionsw.src \ + wordcountdialog.src + +EXCEPTIONSFILES = \ + $(SLO)$/SwSpellDialogChildWindow.obj + +SLOFILES = \ + $(SLO)$/abstract.obj \ + $(SLO)$/addrdlg.obj \ + $(SLO)$/ascfldlg.obj \ + $(SLO)$/docstdlg.obj \ + $(SLO)$/macassgn.obj \ + $(SLO)$/SwSpellDialogChildWindow.obj \ + $(SLO)$/regionsw.obj \ + $(SLO)$/uiregionsw.obj \ + $(SLO)$/swabstdlg.obj \ + $(SLO)$/swuiexp.obj \ + $(SLO)$/swwrtshitem.obj \ + $(SLO)$/swdialmgr.obj \ + $(SLO)$/wordcountdialog.obj \ + $(SLO)$/swdlgfact.obj + +LIB1TARGET = $(SLB)$/$(TARGET).lib + +LIB1OBJFILES = \ + $(SLO)$/regionsw.obj \ + $(SLO)$/swabstdlg.obj \ + $(SLO)$/SwSpellDialogChildWindow.obj \ + $(SLO)$/swwrtshitem.obj + +# $(SLO)$/macassgn.obj \ + +# --- Tagets ------------------------------------------------------- + +.INCLUDE : target.mk +$(INCCOM)$/swuilib.hxx: makefile.mk +.IF "$(GUI)"=="UNX" + $(RM) $@ + echo \#define DLL_NAME \"libswui$(DLLPOSTFIX)$(DLLPOST)\" >$@ +.ELSE + echo \#define DLL_NAME \"swui$(DLLPOSTFIX)$(DLLPOST)\" >$@ +.ENDIF + +$(SLO)$/swabstdlg.obj : $(INCCOM)$/swuilib.hxx + + + + + + + diff --git a/sw/source/ui/dialog/regionsw.cxx b/sw/source/ui/dialog/regionsw.cxx new file mode 100644 index 000000000000..8a4304bcd5a9 --- /dev/null +++ b/sw/source/ui/dialog/regionsw.cxx @@ -0,0 +1,264 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + +#include <hintids.hxx> +#include <uitool.hxx> +#include <svl/urihelper.hxx> +#include <svl/PasswordHelper.hxx> +#include <vcl/msgbox.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> +#include <sot/formats.hxx> +#include <sfx2/passwd.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/request.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/linkmgr.hxx> +#include <editeng/sizeitem.hxx> +#include <svtools/htmlcfg.hxx> +#include <section.hxx> +#include <docary.hxx> +#include <regionsw.hxx> +#include <basesh.hxx> +#include <wdocsh.hxx> +#include <view.hxx> +#include <swmodule.hxx> +#include <wrtsh.hxx> +#include <swundo.hxx> // fuer Undo-Ids +#include <column.hxx> +#include <fmtfsize.hxx> +#include <swunodef.hxx> +#include <shellio.hxx> +#include <helpid.h> +#include <cmdid.h> +#include <regionsw.hrc> +#include <comcore.hrc> +#include <globals.hrc> +#include <sfx2/bindings.hxx> +#include <svx/htmlmode.hxx> +#include <svx/dlgutil.hxx> +#include "swabstdlg.hxx" + +/*-------------------------------------------------------------------- + Beschreibung: Bereiche einfuegen + --------------------------------------------------------------------*/ + + +void SwBaseShell::InsertRegionDialog(SfxRequest& rReq) +{ + SwWrtShell& rSh = GetShell(); + const SfxItemSet *pSet = rReq.GetArgs(); + + SfxItemSet aSet(GetPool(), + RES_COL, RES_COL, + RES_LR_SPACE, RES_LR_SPACE, + RES_COLUMNBALANCE, RES_FRAMEDIR, + RES_BACKGROUND, RES_BACKGROUND, + RES_FRM_SIZE, RES_FRM_SIZE, + RES_FTN_AT_TXTEND, RES_END_AT_TXTEND, + SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, + 0); + + if (!pSet || pSet->Count()==0) + { + SwRect aRect; + rSh.CalcBoundRect(aRect, FLY_AS_CHAR); + + long nWidth = aRect.Width(); + aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth)); + + // Hoehe=Breite fuer konsistentere Vorschau (analog zu Bereich bearbeiten) + aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth))); + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + AbstractInsertSectionTabDialog* aTabDlg = pFact->CreateInsertSectionTabDialog( DLG_INSERT_SECTION, + &GetView().GetViewFrame()->GetWindow(), aSet , rSh); + DBG_ASSERT(aTabDlg, "Dialogdiet fail!"); + aTabDlg->Execute(); + rReq.Ignore(); + delete aTabDlg; + } + else + { + const SfxPoolItem *pItem = 0; + String aTmpStr; + if ( SFX_ITEM_SET == + pSet->GetItemState(FN_PARAM_REGION_NAME, TRUE, &pItem) ) + aTmpStr = rSh.GetUniqueSectionName( + &((const SfxStringItem *)pItem)->GetValue() ); + else + aTmpStr = rSh.GetUniqueSectionName(); + + SwSectionData aSection(CONTENT_SECTION, aTmpStr); + rReq.SetReturnValue(SfxStringItem(FN_INSERT_REGION, aTmpStr)); + + aSet.Put( *pSet ); + if(SFX_ITEM_SET == pSet->GetItemState(SID_ATTR_COLUMNS, FALSE, &pItem)|| + SFX_ITEM_SET == pSet->GetItemState(FN_INSERT_REGION, FALSE, &pItem)) + { + SwFmtCol aCol; + SwRect aRect; + rSh.CalcBoundRect(aRect, FLY_AS_CHAR); + long nWidth = aRect.Width(); + + USHORT nCol = ((SfxUInt16Item *)pItem)->GetValue(); + if(nCol) + { + aCol.Init( nCol, 0, static_cast< USHORT >(nWidth) ); + aSet.Put(aCol); + } + } + else if(SFX_ITEM_SET == pSet->GetItemState(RES_COL, FALSE, &pItem)) + { + aSet.Put(*pItem); + } + + const BOOL bHidden = SFX_ITEM_SET == + pSet->GetItemState(FN_PARAM_REGION_HIDDEN, TRUE, &pItem)? + (BOOL)((const SfxBoolItem *)pItem)->GetValue():FALSE; + const BOOL bProtect = SFX_ITEM_SET == + pSet->GetItemState(FN_PARAM_REGION_PROTECT, TRUE, &pItem)? + (BOOL)((const SfxBoolItem *)pItem)->GetValue():FALSE; + // --> FME 2004-06-22 #114856# edit in readonly sections + const BOOL bEditInReadonly = SFX_ITEM_SET == + pSet->GetItemState(FN_PARAM_REGION_EDIT_IN_READONLY, TRUE, &pItem)? + (BOOL)((const SfxBoolItem *)pItem)->GetValue():FALSE; + // <-- + + aSection.SetProtectFlag(bProtect); + aSection.SetHidden(bHidden); + // --> FME 2004-06-22 #114856# edit in readonly sections + aSection.SetEditInReadonlyFlag(bEditInReadonly); + // <-- + + if(SFX_ITEM_SET == + pSet->GetItemState(FN_PARAM_REGION_CONDITION, TRUE, &pItem)) + aSection.SetCondition(((const SfxStringItem *)pItem)->GetValue()); + + String aFile, aSub; + if(SFX_ITEM_SET == + pSet->GetItemState(FN_PARAM_1, TRUE, &pItem)) + aFile = ((const SfxStringItem *)pItem)->GetValue(); + + if(SFX_ITEM_SET == + pSet->GetItemState(FN_PARAM_3, TRUE, &pItem)) + aSub = ((const SfxStringItem *)pItem)->GetValue(); + + + if(aFile.Len() || aSub.Len()) + { + String sLinkFileName(sfx2::cTokenSeperator); + sLinkFileName += sfx2::cTokenSeperator; + sLinkFileName.SetToken(0, sfx2::cTokenSeperator,aFile); + + if(SFX_ITEM_SET == + pSet->GetItemState(FN_PARAM_2, TRUE, &pItem)) + sLinkFileName.SetToken(1, sfx2::cTokenSeperator, + ((const SfxStringItem *)pItem)->GetValue()); + + sLinkFileName += aSub; + aSection.SetType( FILE_LINK_SECTION ); + aSection.SetLinkFileName(sLinkFileName); + } + rSh.InsertSection(aSection, aSet.Count() ? &aSet : 0); + rReq.Done(); + } +} + +IMPL_STATIC_LINK( SwWrtShell, InsertRegionDialog, SwSectionData*, pSect ) +{ + ::std::auto_ptr<SwSectionData> pSectionData(pSect); + if (pSectionData.get()) + { + SfxItemSet aSet(pThis->GetView().GetPool(), + RES_COL, RES_COL, + RES_BACKGROUND, RES_BACKGROUND, + RES_FRM_SIZE, RES_FRM_SIZE, + SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, + 0); + SwRect aRect; + pThis->CalcBoundRect(aRect, FLY_AS_CHAR); + long nWidth = aRect.Width(); + aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth)); + // Hoehe=Breite fuer konsistentere Vorschau (analog zu Bereich bearbeiten) + aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth))); + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + AbstractInsertSectionTabDialog* aTabDlg = pFact->CreateInsertSectionTabDialog( DLG_INSERT_SECTION, + &pThis->GetView().GetViewFrame()->GetWindow(),aSet , *pThis); + DBG_ASSERT(aTabDlg, "Dialogdiet fail!"); + aTabDlg->SetSectionData(*pSectionData); + aTabDlg->Execute(); + + delete aTabDlg; + } + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: Bereich bearbeiten + --------------------------------------------------------------------*/ + +void SwBaseShell::EditRegionDialog(SfxRequest& rReq) +{ + const SfxItemSet* pArgs = rReq.GetArgs(); + USHORT nSlot = rReq.GetSlot(); + const SfxPoolItem* pItem = 0; + if(pArgs) + pArgs->GetItemState(nSlot, FALSE, &pItem); + SwWrtShell& rWrtShell = GetShell(); + + switch ( nSlot ) + { + case FN_EDIT_REGION: + { + Window* pParentWin = &GetView().GetViewFrame()->GetWindow(); + BOOL bStart = TRUE; + if(bStart) + { + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + AbstractEditRegionDlg* pEditRegionDlg = pFact->CreateEditRegionDlg( MD_EDIT_REGION, + pParentWin, rWrtShell); + DBG_ASSERT(pEditRegionDlg, "Dialogdiet fail!"); + if(pItem && pItem->ISA(SfxStringItem)) + { + pEditRegionDlg->SelectSection(((const SfxStringItem*)pItem)->GetValue()); + } + pEditRegionDlg->Execute(); + delete pEditRegionDlg; + } + else + InfoBox(pParentWin, SW_RES(REG_WRONG_PASSWORD)).Execute(); + } + break; + } +} diff --git a/sw/source/ui/dialog/regionsw.hrc b/sw/source/ui/dialog/regionsw.hrc new file mode 100644 index 000000000000..0535ed46a630 --- /dev/null +++ b/sw/source/ui/dialog/regionsw.hrc @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _REGIONSW_HRC +#define _REGIONSW_HRC + +#include "dialog.hrc" + + +#define CB_DDE 1 +#define CB_DISMISS 2 +#define CB_END_AT_TXTEND 3 +#define CB_END_NUM 4 +#define CB_FILE 5 +#define CB_FTN_AT_TXTEND 6 +#define CB_FTN_NUM 7 +#define CB_HIDE 8 +#define CB_PASSWD 9 +#define CB_PROTECT 10 +#define CB_FTN_NUM_FMT 11 +#define CB_END_NUM_FMT 12 +#define ED_CONDITION 13 +#define ED_END_PREFIX 14 +#define ED_END_SUFFIX 15 +#define ED_FILE 16 +#define ED_FTN_PREFIX 17 +#define ED_FTN_SUFFIX 18 +#define ED_RANAME 19 +#define ED_RNAME 20 +#define FT_CONDITION 21 +#define FL_EDIT_OPTIONS 22 +#define FLD_END_OFFSET 23 +#define FLD_FTN_OFFSET 24 +#define FT_DDE 25 +#define FT_END_OFFSET 26 +#define FT_END_PREFIX 27 +#define FT_END_SUFFIX 28 +#define FT_FILE 29 +#define FT_FTN_OFFSET 30 +#define FT_FTN_PREFIX 31 +#define FT_FTN_SUFFIX 32 +#define FT_RNAME 33 +#define FT_SUBREG 34 +#define LB_END_NUMVIEW 36 +#define LB_FTN_NUMVIEW 37 +#define LB_SUBREG 38 +#define PB_CANCEL 39 +#define PB_FILE 40 +#define PB_HELP 41 +#define PB_OK 42 +#define PB_OPTIONS 43 +#define PB_SAVED 44 +#define ST_INSERT 45 +#define TLB_SECTION 46 +#define FL_NAME 47 +#define FL_LINK 48 +#define FL_PROTECT 49 +#define FL_HIDE 50 +#define PB_PASSWD 51 +#define FL_END 52 +#define FL_FTN 53 +#define IL_BITMAPS 54 +#define ILH_BITMAPS 55 +// --> FME 2004-06-22 #114856# edit in readonly sections +#define FL_PROPERTIES 56 +#define CB_EDIT_IN_READONLY 57 +// <-- + +/* Globale Resourcen */ +#define STR_REG_DUPLICATE (RC_REGIONSW_BEGIN+6) +#define STR_INFO_DUPLICATE (RC_REGIONSW_BEGIN+7) + +#define MD_INS_REGION (RC_REGIONSW_BEGIN+8) +#define MD_EDIT_REGION (RC_REGIONSW_BEGIN+9) +#define QB_CONNECT (RC_REGIONSW_BEGIN+10) +#define REG_WRONG_PASSWORD (RC_REGIONSW_BEGIN+11) +#define REG_WRONG_PASSWD_REPEAT (RC_REGIONSW_BEGIN+12) + +//ImageList elements +#define BMP_HIDE 1 +#define BMP_NO_HIDE 2 +#define BMP_PROT_HIDE 3 +#define BMP_PROT_NO_HIDE 4 + +//SwSectionIndentTabPage +#define FL_INDENT 1 +#define FT_BEFORE 2 +#define MF_BEFORE 3 +#define FT_AFTER 4 +#define MF_AFTER 5 +#define WIN_PREVIEW 6 + +#endif diff --git a/sw/source/ui/dialog/regionsw.src b/sw/source/ui/dialog/regionsw.src new file mode 100644 index 000000000000..f2af8dca3b0d --- /dev/null +++ b/sw/source/ui/dialog/regionsw.src @@ -0,0 +1,857 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "regionsw.hrc" +#include "cmdid.h" +#include "globals.hrc" +#include "helpid.h" +/************************************************************************* + + Dialog "Bereich einfuegen" + +*************************************************************************/ +#define FT_SUBREG_TEXT \ + Text [ en-US ] = "~Section" ; \ + +#define CB_HIDE_TEXT \ + Text [ en-US ] = "H~ide" ;\ + +#define FL_HIDE_TEXT \ + Text [ en-US ] = "Hide" ;\ + +#define CB_CONDITION_TEXT \ + Text [ en-US ] = "~With Condition" ;\ + +#define FL_PROPERTIES_TEXT \ + Text [ en-US ] = "Properties" ;\ + +#define CB_EDIT_IN_READONLY_TEXT \ + Text [ en-US ] = "E~ditable in read-only document" ;\ + +#define FL_FILE_TEXT \ + Text [ en-US ] = "Link" ;\ + +#define CB_FILE_TEXT\ + Text [ en-US ] = "~Link";\ + +#define CB_DDE_TEXT \ + Text [ en-US ] = "DD~E" ;\ + +#define FT_DDE_TEXT \ + Text [ en-US ] = "DDE ~command" ;\ + +#define FT_FILE_TEXT \ + Text [ en-US ] = "~File name" ;\ + + +#define GB_HIDE_TEXT \ + Text [ en-US ] = "Hide";\ + +#define GB_OPTIONS_TEXT \ + Text [ en-US ] = "Options" ;\ + +#define FL_PROTECT_TEXT \ + Text [ en-US ] = "Write protection";\ + +#define CB_PASSWD_TEXT\ + Text [ en-US ] = "Wit~h password";\ + +/************************************************************************* + + Dialog "Bereiche bearbeiten" + +*************************************************************************/ +ModalDialog MD_EDIT_REGION +{ + HelpID = FN_EDIT_REGION ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 316 , 185 ) ; + Text [ en-US ] = "Edit Sections" ; + Moveable = TRUE ; + FixedLine FL_NAME + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Section" ; + }; + Edit ED_RANAME + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 71 , 12 ) ; + TabStop = TRUE ; + Disable = TRUE ; + }; + Control TLB_SECTION + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 29 ) ; + Size = MAP_APPFONT ( 71 , 150 ) ; + TabStop = TRUE ; + }; + FixedLine FL_LINK + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 92 , 3 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + FL_FILE_TEXT + }; + TriStateBox CB_FILE + { + Pos = MAP_APPFONT ( 98 , 14 ) ; + Size = MAP_APPFONT ( 59 , 10 ) ; + TabStop = TRUE ; + CB_FILE_TEXT + }; + CheckBox CB_DDE + { + Pos = MAP_APPFONT ( 98 , 28 ) ; + Size = MAP_APPFONT ( 30 , 10 ) ; + Disable = TRUE ; + CB_DDE_TEXT + }; + FixedText FT_DDE + { + Pos = MAP_APPFONT ( 104 , 44) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Hide = TRUE ; + FT_DDE_TEXT + }; + FixedText FT_FILE + { + Pos = MAP_APPFONT ( 104 , 44 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Disable = TRUE ; + FT_FILE_TEXT + }; + Edit ED_FILE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 165 , 42 ) ; + Size = MAP_APPFONT ( 68 , 12 ) ; + Disable = TRUE ; + TabStop = TRUE ; + }; + PushButton PB_FILE + { + Pos = MAP_APPFONT ( 239 , 42 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + TabStop = TRUE ; + Disable = TRUE ; + Text = "..."; + }; + FixedText FT_SUBREG + { + Pos = MAP_APPFONT ( 104 , 59 ) ; + Size = MAP_APPFONT ( 38 , 8 ) ; + Disable = TRUE ; + FT_SUBREG_TEXT + }; + ComboBox LB_SUBREG + { + Pos = MAP_APPFONT ( 165 , 57 ) ; + Size = MAP_APPFONT ( 68 , 50 ) ; + Disable = TRUE ; + TabStop = TRUE ; + Sort = TRUE ; + DropDown = TRUE ; + }; + FixedLine FL_PROTECT + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 92 , 75 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + FL_PROTECT_TEXT + }; + TriStateBox CB_PROTECT + { + Pos = MAP_APPFONT ( 98 , 86 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + TabStop = TRUE ; + Disable = TRUE ; + TriStateDisable = FALSE ; + Text [ en-US ] = "~Protected" ; + }; + CheckBox CB_PASSWD + { + Pos = MAP_APPFONT ( 107 , 100 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + CB_PASSWD_TEXT + }; + PushButton PB_PASSWD + { + Pos = MAP_APPFONT ( 239 , 98 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + TabStop = TRUE ; + Text = "..." ; + }; + FixedLine FL_HIDE + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 92 , 116 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + FL_HIDE_TEXT + }; + TriStateBox CB_HIDE + { + Pos = MAP_APPFONT ( 98 , 127 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + TabStop = TRUE ; + TriStateDisable = FALSE ; + CB_HIDE_TEXT + }; + FixedText FT_CONDITION + { + Pos = MAP_APPFONT ( 104 , 143) ; + Size = MAP_APPFONT ( 55 , 8 ) ; + Disable = TRUE ; + CB_CONDITION_TEXT + }; + Edit ED_CONDITION + { + Border = TRUE ; + Pos = MAP_APPFONT ( 165 , 141) ; + Size = MAP_APPFONT ( 86 , 12 ) ; + TabStop = TRUE ; + Disable = TRUE ; + }; + + FixedLine FL_PROPERTIES + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 92 , 159 ) ; + Size = MAP_APPFONT ( 162 , 8 ) ; + FL_PROPERTIES_TEXT + }; + TriStateBox CB_EDIT_IN_READONLY + { + Pos = MAP_APPFONT ( 98 , 170 ) ; + Size = MAP_APPFONT ( 156 , 10 ) ; + TabStop = TRUE ; + TriStateDisable = FALSE ; + CB_EDIT_IN_READONLY_TEXT + }; + + OKButton PB_OK + { + Pos = MAP_APPFONT ( 263 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Disable = TRUE ; + DefButton = TRUE ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 263 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + PushButton PB_OPTIONS + { + Pos = MAP_APPFONT ( 263 , 40 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Hide = TRUE ; + Text [ en-US ] = "~Options..."; + }; + PushButton CB_DISMISS + { + Pos = MAP_APPFONT ( 263 , 57 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + Disable = TRUE ; + TabStop = TRUE ; + Text [ en-US ] = "Remove" ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 263 , 77 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + +#define DLG_IMAGE_IDLIST \ + IdList = \ + { \ + BMP_HIDE /*1*/ ;\ + BMP_NO_HIDE /*2*/ ;\ + BMP_PROT_HIDE /*3*/ ;\ + BMP_PROT_NO_HIDE /*4*/ ;\ + }; \ + IdCount = { 4 ; }; + + ImageList IL_BITMAPS + { + Prefix = "re"; + MaskColor = IMAGE_MASK_COLOR ; + DLG_IMAGE_IDLIST + }; + ImageList ILH_BITMAPS + { + Prefix = "reh"; + MaskColor = IMAGE_MASK_COLOR ; + DLG_IMAGE_IDLIST + }; +}; +String STR_REG_DUPLICATE +{ + Text [ en-US ] = "Section name changed:" ; +}; +String STR_INFO_DUPLICATE +{ + Text [ en-US ] = "Duplicate section name" ; +}; +QueryBox QB_CONNECT +{ + Buttons = WB_YES_NO ; + DefButton = WB_DEF_NO ; + Message [ en-US ] = "A file connection will delete the contents of the current section. Connect anyway?" ; +}; +InfoBox REG_WRONG_PASSWORD +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message [ en-US ] = "The password entered is invalid." ; +}; +InfoBox REG_WRONG_PASSWD_REPEAT +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + Message [ en-US ] = "The password has not been set." ; +}; + +TabDialog DLG_INSERT_SECTION +{ + HelpId = HID_INSERT_SECTION_DLG; + Text [ en-US ] = "Insert Section" ; + OutputSize = TRUE ; + SVLook = TRUE ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_INSERT_SECTION; + PageResID = TP_INSERT_SECTION; + Text [ en-US ] = "Section"; + }; + PageItem + { + Identifier = TP_COLUMN ; + PageResID = TP_COLUMN ; + Text [ en-US ] = "Columns" ; + }; + PageItem + { + Identifier = TP_SECTION_INDENTS; + PageResID = TP_SECTION_INDENTS; + Text [ en-US ] = "Indents" ; + }; + PageItem + { + Identifier = TP_BACKGROUND ; + PageResID = TP_BACKGROUND ; + Text [ en-US ] = "Background" ; + }; + PageItem + { + Identifier = TP_SECTION_FTNENDNOTES ; + PageResID = TP_SECTION_FTNENDNOTES ; + Text [ en-US ] = "Footnotes/Endnotes"; + }; + }; + }; + String ST_INSERT + { + Text [ en-US ] = "Insert" ; + }; +}; + +TabPage TP_INSERT_SECTION +{ + HelpID = HID_INSERT_SECTION_PAGE; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_NAME + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 78 , 8 ) ; + Text [ en-US ] = "New section" ; + }; + ComboBox ED_RNAME + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 69 , 140 ) ; + TabStop = TRUE ; + AutoHScroll = TRUE ; + SORT = TRUE ; + }; + FixedLine FL_LINK + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 90 , 3 ) ; + Size = MAP_APPFONT ( 164 , 8 ) ; + FL_FILE_TEXT + }; + CheckBox CB_FILE + { + Pos = MAP_APPFONT ( 96 , 14 ) ; + Size = MAP_APPFONT ( 60 , 10 ) ; + TabStop = TRUE ; + CB_FILE_TEXT + }; + CheckBox CB_DDE + { + Pos = MAP_APPFONT ( 96 , 28) ; + Size = MAP_APPFONT ( 60 , 10 ) ; + Disable = TRUE ; + CB_DDE_TEXT + }; + FixedText FT_DDE + { + Pos = MAP_APPFONT ( 96 , 44 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Hide = TRUE ; + FT_DDE_TEXT + }; + FixedText FT_FILE + { + Pos = MAP_APPFONT ( 96 , 44 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Disable = TRUE ; + FT_FILE_TEXT + }; + Edit ED_FILE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 160 , 42 ) ; + Size = MAP_APPFONT ( 76 , 12 ) ; + Disable = TRUE ; + TabStop = TRUE ; + }; + PushButton PB_FILE + { + Pos = MAP_APPFONT ( 239 , 42 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + Disable = TRUE ; + TabStop = TRUE ; + Text = "..."; + }; + FixedText FT_SUBREG + { + Pos = MAP_APPFONT ( 96 , 60 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Disable = TRUE ; + FT_SUBREG_TEXT + }; + ComboBox LB_SUBREG + { + Pos = MAP_APPFONT ( 160 , 58 ) ; + Size = MAP_APPFONT ( 76 , 50 ) ; + DropDown = TRUE ; + Disable = TRUE ; + TabStop = TRUE ; + Sort = TRUE ; + }; + FixedLine FL_PROTECT + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 90 , 76 ) ; + Size = MAP_APPFONT ( 164 , 8 ) ; + FL_PROTECT_TEXT + }; + CheckBox CB_PROTECT + { + Pos = MAP_APPFONT ( 96 , 87 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Protect"; + }; + CheckBox CB_PASSWD + { + Pos = MAP_APPFONT ( 105 , 101 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + CB_PASSWD_TEXT + }; + PushButton PB_PASSWD + { + Pos = MAP_APPFONT ( 239 , 99 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + TabStop = TRUE ; + Text = "..." ; + }; + FixedLine FL_HIDE + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 90 , 117 ) ; + Size = MAP_APPFONT ( 164 , 8 ) ; + FL_HIDE_TEXT + }; + CheckBox CB_HIDE + { + Pos = MAP_APPFONT ( 96 , 128 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + CB_HIDE_TEXT + }; + FixedText FT_CONDITION + { + Pos = MAP_APPFONT ( 96 , 144 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Disable = TRUE ; + CB_CONDITION_TEXT + }; + Edit ED_CONDITION + { + Border = TRUE ; + Pos = MAP_APPFONT ( 160 , 142 ) ; + Size = MAP_APPFONT ( 91 , 12 ) ; + Disable = TRUE ; + TabStop = TRUE ; + }; + + FixedLine FL_PROPERTIES + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 90 , 159 ) ; + Size = MAP_APPFONT ( 164 , 8 ) ; + FL_PROPERTIES_TEXT + }; + CheckBox CB_EDIT_IN_READONLY + { + Pos = MAP_APPFONT ( 96 , 170 ) ; + Size = MAP_APPFONT ( 158 , 10 ) ; + CB_EDIT_IN_READONLY_TEXT + }; + +}; + +TabDialog DLG_SECTION_PROPERTIES +{ + HelpId = HID_SECTION_PROPERTIES_DLG; + OutputSize = TRUE ; + SVLook = TRUE ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_COLUMN ; + PageResID = TP_COLUMN ; + Text [ en-US ] = "Columns" ; + }; + PageItem + { + Identifier = TP_SECTION_INDENTS; + PageResID = TP_SECTION_INDENTS; + Text [ en-US ] = "Indents" ; + }; + PageItem + { + Identifier = TP_BACKGROUND ; + PageResID = TP_BACKGROUND ; + Text [ en-US ] = "Background" ; + }; + PageItem + { + Identifier = TP_SECTION_FTNENDNOTES ; + PageResID = TP_SECTION_FTNENDNOTES ; + Text [ en-US ] = "Footnotes/Endnotes"; + }; + }; + }; + Text [ en-US ] = "Options"; +}; + + +TabPage TP_SECTION_FTNENDNOTES +{ + HelpID = HID_SECTION_FTNENDNOTES_PAGE; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_FTN + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Footnotes"; + }; + CheckBox CB_FTN_AT_TXTEND + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 90 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Collec~t at end of text"; + + }; + CheckBox CB_FTN_NUM + { + Pos = MAP_APPFONT ( 18 , 29 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Restart numbering"; + }; + FixedText FT_FTN_OFFSET + { + Pos = MAP_APPFONT ( 24 , 46 ) ; + Size = MAP_APPFONT ( 64 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Start at" ; + }; + NumericField FLD_FTN_OFFSET + { + Pos = MAP_APPFONT ( 90 , 44 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + Spin = TRUE ; + Minimum = 1 ; + First = 1 ; + Last = 9999 ; + Maximum = 9999 ; + TabStop = TRUE ; + Border = TRUE ; + }; + CheckBox CB_FTN_NUM_FMT + { + Pos = MAP_APPFONT ( 24 , 61 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Custom ~format"; + }; + FixedText FT_FTN_PREFIX + { + Pos = MAP_APPFONT ( 30 , 76 ) ; + Size = MAP_APPFONT ( 58 , 8 ) ; + Text [ en-US ] = "Be~fore" ; + Left = TRUE ; + }; + Edit ED_FTN_PREFIX + { + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 74 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + MaxTextLength = 50 ; + }; + ListBox LB_FTN_NUMVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 123 , 74 ) ; + Size = MAP_APPFONT ( 62 , 50 ) ; + TabStop = TRUE ; + Group = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_FTN_SUFFIX + { + Pos = MAP_APPFONT ( 191 , 76 ) ; + Size = MAP_APPFONT ( 25 , 8 ) ; + Text [ en-US ] = "Aft~er" ; + Right = TRUE ; + }; + Edit ED_FTN_SUFFIX + { + Border = TRUE ; + Pos = MAP_APPFONT ( 219 , 74 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + MaxTextLength = 50 ; + }; + + + FixedLine FL_END + { + OutputSize = TRUE ; + Pos = MAP_APPFONT ( 6 , 92 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Endnotes"; + }; + CheckBox CB_END_AT_TXTEND + { + Pos = MAP_APPFONT ( 12 , 103 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "C~ollect at end of section"; + }; + CheckBox CB_END_NUM + { + Pos = MAP_APPFONT ( 16 , 118 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Restart numbering"; + }; + FixedText FT_END_OFFSET + { + Pos = MAP_APPFONT ( 24 , 135 ) ; + Size = MAP_APPFONT ( 64 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Start at" ; + }; + NumericField FLD_END_OFFSET + { + Pos = MAP_APPFONT ( 90 , 133 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + Spin = TRUE ; + Minimum = 1 ; + First = 1 ; + Last = 9999 ; + Maximum = 9999 ; + TabStop = TRUE ; + Border = TRUE ; + }; + CheckBox CB_END_NUM_FMT + { + Pos = MAP_APPFONT ( 24 , 150 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Custom format"; + }; + + FixedText FT_END_PREFIX + { + Pos = MAP_APPFONT ( 30 , 165 ) ; + Size = MAP_APPFONT ( 58 , 8 ) ; + Text [ en-US ] = "Be~fore" ; + Left = TRUE ; + }; + Edit ED_END_PREFIX + { + Border = TRUE ; + Pos = MAP_APPFONT ( 90 , 163 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + MaxTextLength = 50 ; + }; + ListBox LB_END_NUMVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 123 , 163 ) ; + Size = MAP_APPFONT ( 62 , 50 ) ; + TabStop = TRUE ; + Group = TRUE ; + DropDown = TRUE ; + CurPos = 0 ; + }; + FixedText FT_END_SUFFIX + { + Pos = MAP_APPFONT ( 191 , 165 ) ; + Size = MAP_APPFONT ( 25 , 8 ) ; + Text [ en-US ] = "Aft~er" ; + Right = TRUE ; + }; + Edit ED_END_SUFFIX + { + Border = TRUE ; + Pos = MAP_APPFONT ( 219 , 163 ) ; + Size = MAP_APPFONT ( 30 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + MaxTextLength = 50 ; + }; +}; + +TabPage TP_SECTION_INDENTS +{ + HelpID = HID_SECTION_INDENTS_PAGE; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedLine FL_INDENT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 173 , 8 ) ; + Text [ en-US ] = "Indent" ; + }; + FixedText FT_BEFORE + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Before section" ; + }; + MetricField MF_BEFORE + { + Border = TRUE ; + Pos = MAP_APPFONT ( 135 , 14 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + Minimum = -9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_AFTER + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 120 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~After section" ; + }; + MetricField MF_AFTER + { + Border = TRUE ; + Pos = MAP_APPFONT ( 135 , 30 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + Group = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + Minimum = -9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + Window WIN_PREVIEW + { + Border = TRUE ; + Pos = MAP_APPFONT ( 185 , 7 ) ; + Size = MAP_APPFONT ( 68 , 112 ) ; + }; +}; diff --git a/sw/source/ui/dialog/swabstdlg.cxx b/sw/source/ui/dialog/swabstdlg.cxx new file mode 100644 index 000000000000..a39c1866b717 --- /dev/null +++ b/sw/source/ui/dialog/swabstdlg.cxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#include "swabstdlg.hxx" +#include "swuilib.hxx" + +#include <osl/module.hxx> +#include <tools/string.hxx> + +typedef SwAbstractDialogFactory* (__LOADONCALLAPI *SwFuncPtrCreateDialogFactory)(); + +extern "C" { static void SAL_CALL thisModule() {} } + +SwAbstractDialogFactory* SwAbstractDialogFactory::Create() +{ + SwFuncPtrCreateDialogFactory fp = 0; + static ::osl::Module aDialogLibrary; + if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( RTL_CONSTASCII_USTRINGPARAM( DLL_NAME ) ) ) ) + fp = ( SwAbstractDialogFactory* (__LOADONCALLAPI*)() ) + aDialogLibrary.getFunctionSymbol( ::rtl::OUString::createFromAscii("CreateDialogFactory") ); + if ( fp ) + return fp(); + return 0; +} diff --git a/sw/source/ui/dialog/swdialmgr.cxx b/sw/source/ui/dialog/swdialmgr.cxx new file mode 100644 index 000000000000..308411358efa --- /dev/null +++ b/sw/source/ui/dialog/swdialmgr.cxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +// include --------------------------------------------------------------- + +#include "dialmgr.hxx" +#include "tools/string.hxx" +#include <sfx2/app.hxx> + +//copy from core\bastyp\swtypes.cxx +String aEmptyStr; // Konstante Strings + +ResMgr* pSwResMgr=0; + +ResMgr* SwDialogsResMgr::GetResMgr() +{ + if ( !pSwResMgr ) + { + pSwResMgr = SfxApplication::CreateResManager( "sw" ); + } + + return pSwResMgr; +} diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx new file mode 100644 index 000000000000..8447489e5b03 --- /dev/null +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -0,0 +1,1742 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include "swdlgfact.hxx" +#include <svl/style.hxx> +#ifndef _SVX_SVXIDS_HRC +#include <svx/svxids.hrc> +#endif +#include "dialog.hrc" +#include "misc.hrc" +#include "chrdlg.hrc" +#include "fldui.hrc" +#include "table.hrc" +#include "frmui.hrc" +#include "dbui.hrc" +#include "globals.hrc" +#include "fldui.hrc" +#include "envelp.hrc" +#include "dochdl.hrc" +#include <index.hrc> +#include <regionsw.hrc> +#include <fmtui.hrc> + +#include <wordcountdialog.hxx> +#include "abstract.hxx" // add for SwInsertAbstractDlg +#include "addrdlg.hxx" // add for SwAddrDlg +#include "ascfldlg.hxx" // add for SwAsciiFilterDlg +#include "bookmark.hxx" //add for SwInsertBookmarkDlg +#include "break.hxx" //add for SwBreakDlg +#include "changedb.hxx" //add for SwChangeDBDlg +#include "chrdlg.hxx" // add for SwCharDlg +#include "convert.hxx" //add for SwConvertTableDlg +#include "cption.hxx" //add for SwCaptionDialog +#include "dbinsdlg.hxx" //add for SwInsertDBColAutoPilot +#include "docfnote.hxx" //add for SwFootNoteOptionDlg +#include "docstdlg.hxx" //add for SwDocStatPage +#include "DropDownFieldDialog.hxx" //add for DropDownFieldDialog +#include "envlop.hxx" //add for SwEnvDlg +#include "label.hxx" //add for SwLabDlg +#include "drpcps.hxx" //add for SwDropCapsDlg +#include "swuipardlg.hxx" //add for SwParaDlg +#include "pattern.hxx" //add for SwBackgroundDlg +#include "rowht.hxx" //add for SwTableHeightDlg +#include "selglos.hxx" //add for SwSelGlossaryDlg +#include "splittbl.hxx" //add for SwSplitTblDlg +#include "srtdlg.hxx" //add for SwSortDlg +#include "tautofmt.hxx" //add for SwAutoFormatDlg +#include "tblnumfm.hxx" //add for SwNumFmtDlg +#include "uiborder.hxx" //add for SwBorderDlg +#include "wrap.hxx" //add for SwWrapDlg +#include "colwd.hxx" //add for SwTableWidthDlg +#include "tabledlg.hxx" //add for SwTableTabDlg +#include "fldtdlg.hxx" //add for SwFldDlg +#include "fldedt.hxx" //add for SwFldEditDlg +#include "swrenamexnameddlg.hxx" //add for SwRenameXNamedDlg +#include "swmodalredlineacceptdlg.hxx" //add for SwModalRedlineAcceptDlg +#include <frmdlg.hxx> //add for SwFrmDlg +#include <tmpdlg.hxx> //add for SwTemplateDlg +#include <glossary.hxx> //add for SwGlossaryDlg +#include <inpdlg.hxx> //add for SwFldInputDlg +#include <insfnote.hxx> //add for SwInsFootNoteDlg +#include <insrule.hxx> //add for SwInsertGrfRulerDlg +#include <instable.hxx> //add for SwInsTableDlg +#include <javaedit.hxx> //add for SwJavaEditDialog +#include <linenum.hxx> //add for SwLineNumberingDlg +#include <mailmrge.hxx> //add for SwMailMergeDlg, SwMailMergeCreateFromDlg, SwMailMergeFieldConnectionsDlg +#include <mergetbl.hxx> //add for SwMergeTblDlg +#include <multmrk.hxx> //add for SwMultiTOXMarkDlg +#include <num.hxx> //add for SwSvxNumBulletTabDialog +#include <outline.hxx> //add for SwOutlineTabDialog +#include <column.hxx> //add for SwColumnDlg +#include <cnttab.hxx> //add for SwMultiTOXTabDialog +#include <swuicnttab.hxx> //add for SwMultiTOXTabDialog +#include <regionsw.hxx> //add for SwEditRegionDlg, SwInsertSectionTabDialog +#include <optcomp.hxx> //add for SwCompatibilityOptPage +#include <optload.hxx> //add for SwLoadOptPage +#include <optpage.hxx> //add for OptPage +#include <swuiidxmrk.hxx> //add for SwIndexMarkDlg, SwAuthMarkDlg, SwIndexMarkModalDlg, SwAuthMarkModalDlg +#include <svx/dialogs.hrc> +#include <mailmergewizard.hxx> +#include <mailconfigpage.hxx> + +using namespace ::com::sun::star; + +IMPL_ABSTDLG_BASE(AbstractSwWordCountDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractSfxDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractSwAsciiFilterDlg_Impl); +IMPL_ABSTDLG_BASE(VclAbstractDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractSwBreakDlg_Impl); //add for SwBreakDlg +IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for SwCharDlg, SwFootNoteOptionDlg, SwEnvDlg SwParaDlg SwTableTabDlg +IMPL_ABSTDLG_BASE(AbstractSwConvertTableDlg_Impl); //add for SwConvertTableDlg +IMPL_ABSTDLG_BASE(AbstractSwInsertDBColAutoPilot_Impl); //add for SwInsertDBColAutoPilot +IMPL_ABSTDLG_BASE(AbstractDropDownFieldDialog_Impl); //add for DropDownFieldDialog +IMPL_ABSTDLG_BASE(AbstarctSwLabDlg_Impl);//add for SwLabDlg +IMPL_ABSTDLG_BASE(AbstarctSwSelGlossaryDlg_Impl);//add for SwSelGlossaryDlg +IMPL_ABSTDLG_BASE(AbstractSwAutoFormatDlg_Impl); //add for SwAutoFormatDlg +IMPL_ABSTDLG_BASE(AbstractSwFldDlg_Impl); //add for SwFldDlg +IMPL_ABSTDLG_BASE(AbstractSwRenameXNamedDlg_Impl); //add for SwRenameXNamedDlg +IMPL_ABSTDLG_BASE(AbstractSwModalRedlineAcceptDlg_Impl); //add for SwModalRedlineAcceptDlg +IMPL_ABSTDLG_BASE(AbstractGlossaryDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractFldInputDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractInsFootNoteDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractInsertGrfRulerDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractInsTableDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractJavaEditDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractMailMergeDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractMailMergeCreateFromDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractMailMergeFieldConnectionsDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractMultiTOXTabDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractEditRegionDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractInsertSectionTabDialog_Impl); +IMPL_ABSTDLG_BASE(AbstractIndexMarkFloatDlg_Impl); +IMPL_ABSTDLG_BASE(AbstractAuthMarkFloatDlg_Impl); + +// AbstractTabDialog_Impl begin +void AbstractTabDialog_Impl::SetCurPageId( USHORT nId ) +{ + pDlg->SetCurPageId( nId ); +} + +const SfxItemSet* AbstractTabDialog_Impl::GetOutputItemSet() const +{ + return pDlg->GetOutputItemSet(); +} + +const USHORT* AbstractTabDialog_Impl::GetInputRanges(const SfxItemPool& pItem ) +{ + return pDlg->GetInputRanges( pItem ); +} + +void AbstractTabDialog_Impl::SetInputSet( const SfxItemSet* pInSet ) +{ + pDlg->SetInputSet( pInSet ); +} +//From class Window. +void AbstractTabDialog_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} +String AbstractTabDialog_Impl::GetText() const +{ + return pDlg->GetText(); +} + +//add for AbstractTabDialog_Impl end + +void AbstractSwWordCountDialog_Impl::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc) +{ + pDlg->SetValues(rCurrent, rDoc); +} + +//add for SwInsertAbstractDlg begin +BYTE AbstractSwInsertAbstractDlg_Impl::GetLevel() const +{ + return pDlg->GetLevel(); +} +BYTE AbstractSwInsertAbstractDlg_Impl::GetPara() const +{ + return pDlg->GetPara(); +} +//add for SwInsertAbstractDlg end + +//add for SwAddrDlg, SwDropCapsDlg ,SwBackgroundDlg, SwNumFmtDlg SwBorderDlg SwWrapDlg SwFldEditDlg begin +const SfxItemSet* AbstractSfxDialog_Impl::GetOutputItemSet() const +{ + return pDlg->GetOutputItemSet(); +} + +void AbstractSfxDialog_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} +String AbstractSfxDialog_Impl::GetText() const +{ + return pDlg->GetText(); +} + +//add for SwAddrDlg, SwDropCapsDlg ,SwBackgroundDlg, SwNumFmtDlg SwBorderDlg SwWrapDlg SwFldEditDlg end + +//add for SwAsciiFilterDlg begin +void AbstractSwAsciiFilterDlg_Impl::FillOptions( SwAsciiOptions& rOptions ) +{ + pDlg->FillOptions(rOptions); +} +//add for SwAsciiFilterDlg end + +//add for SwSplitTblDlg +sal_uInt16 AbstractSplitTableDialog_Impl::GetSplitMode() +{ + return pDlg->GetSplitMode(); +} +//add for SwBreakDlg begin +String AbstractSwBreakDlg_Impl::GetTemplateName() +{ + return pDlg->GetTemplateName(); +} + +USHORT AbstractSwBreakDlg_Impl:: GetKind() +{ + return pDlg->GetKind(); +} + +USHORT AbstractSwBreakDlg_Impl:: GetPageNumber() +{ + return pDlg->GetPageNumber(); +} +//add for SwBreakDlg end + +//add for SwConvertTableDlg begin +void AbstractSwConvertTableDlg_Impl::GetValues( sal_Unicode& rDelim,SwInsertTableOptions& rInsTblFlags, + SwTableAutoFmt *& prTAFmt ) +{ + pDlg->GetValues(rDelim,rInsTblFlags, prTAFmt); +} +//add for SwConvertTableDlg end + +//add for SwInsertDBColAutoPilot begin +void AbstractSwInsertDBColAutoPilot_Impl::DataToDoc( const uno::Sequence< uno::Any >& rSelection, + uno::Reference< sdbc::XDataSource> rxSource, + uno::Reference< sdbc::XConnection> xConnection, + uno::Reference< sdbc::XResultSet > xResultSet) +{ + pDlg->DataToDoc(rSelection, rxSource, xConnection, xResultSet); +} +//add for SwInsertDBColAutoPilot end + +// add for DropDownFieldDialog begin +ByteString AbstractDropDownFieldDialog_Impl::GetWindowState( ULONG nMask ) const +{ + return pDlg->GetWindowState(nMask); +} +void AbstractDropDownFieldDialog_Impl::SetWindowState( const ByteString& rStr ) +{ + pDlg->SetWindowState(rStr); +} +//add for DropDownFieldDialog end + +//add for SwLabDlg begin + +void AbstarctSwLabDlg_Impl::SetCurPageId( USHORT nId ) +{ + pDlg->SetCurPageId( nId ); +} + +const SfxItemSet* AbstarctSwLabDlg_Impl::GetOutputItemSet() const +{ + return pDlg->GetOutputItemSet(); +} + +const USHORT* AbstarctSwLabDlg_Impl::GetInputRanges(const SfxItemPool& pItem ) +{ + return pDlg->GetInputRanges( pItem ); +} + +void AbstarctSwLabDlg_Impl::SetInputSet( const SfxItemSet* pInSet ) +{ + pDlg->SetInputSet( pInSet ); +} + +void AbstarctSwLabDlg_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} +String AbstarctSwLabDlg_Impl::GetText() const +{ + return pDlg->GetText(); +} +const String& AbstarctSwLabDlg_Impl::GetBusinessCardStr() const +{ + return pDlg->GetBusinessCardStr(); +} +Printer * AbstarctSwLabDlg_Impl::GetPrt() +{ + return pDlg->GetPrt(); +} +//add for SwLabDlg end + + +//add for SwSelGlossaryDlg begin + +void AbstarctSwSelGlossaryDlg_Impl::InsertGlos(const String &rRegion, const String &rGlosName) +{ + pDlg->InsertGlos( rRegion, rGlosName ); +} +USHORT AbstarctSwSelGlossaryDlg_Impl::GetSelectedIdx() const +{ + return pDlg->GetSelectedIdx(); +} +void AbstarctSwSelGlossaryDlg_Impl::SelectEntryPos(USHORT nIdx) +{ + pDlg->SelectEntryPos( nIdx ); +} + +//add for SwSelGlossaryDlg end + +//add for SwAutoFormatDlg begin + +void AbstractSwAutoFormatDlg_Impl::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const +{ + pDlg->FillAutoFmtOfIndex(rToFill); +} +//add for SwAutoFormatDlg end + +//add for SwFldDlg begin +void AbstractSwFldDlg_Impl::SetCurPageId( USHORT nId ) +{ + pDlg->SetCurPageId( nId ); +} + +const SfxItemSet* AbstractSwFldDlg_Impl::GetOutputItemSet() const +{ + return pDlg->GetOutputItemSet(); +} + +const USHORT* AbstractSwFldDlg_Impl::GetInputRanges(const SfxItemPool& pItem ) +{ + return pDlg->GetInputRanges( pItem ); +} + +void AbstractSwFldDlg_Impl::SetInputSet( const SfxItemSet* pInSet ) +{ + pDlg->SetInputSet( pInSet ); +} + +void AbstractSwFldDlg_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} +String AbstractSwFldDlg_Impl::GetText() const +{ + return pDlg->GetText(); +} +void AbstractSwFldDlg_Impl::Start( BOOL bShowl ) +{ + pDlg->Start( bShowl ); +} + +void AbstractSwFldDlg_Impl::Initialize(SfxChildWinInfo *pInfo) +{ + pDlg->Initialize( pInfo ); +} + +void AbstractSwFldDlg_Impl::ReInitDlg() +{ + pDlg->ReInitDlg(); +} +void AbstractSwFldDlg_Impl::ActivateDatabasePage() +{ + pDlg->ActivateDatabasePage(); +} +Window* AbstractSwFldDlg_Impl::GetWindow() +{ + return (Window*)pDlg; +} +void AbstractSwFldDlg_Impl::ShowPage( USHORT nId ) +{ + pDlg->ShowPage(nId); +} +//add for SwFldD end + +//add for SwRenameXNamedDlg begin + +void AbstractSwRenameXNamedDlg_Impl::SetForbiddenChars( const String& rSet ) +{ + pDlg->SetForbiddenChars( rSet ); +} + +void AbstractSwRenameXNamedDlg_Impl::SetAlternativeAccess( + STAR_REFERENCE( container::XNameAccess ) & xSecond, + STAR_REFERENCE( container::XNameAccess ) & xThird ) +{ + pDlg->SetAlternativeAccess( xSecond, xThird); +} +//add for SwRenameXNamedDlg end + +//add for SwModalRedlineAcceptDlg begin + +void AbstractSwModalRedlineAcceptDlg_Impl::AcceptAll( BOOL bAccept ) +{ + pDlg->AcceptAll( bAccept); +} +//add for SwModalRedlineAcceptDlg end + +// AbstractGlossaryDlg_Impl begin +String AbstractGlossaryDlg_Impl::GetCurrGrpName() const +{ + return pDlg->GetCurrGrpName(); +} + +String AbstractGlossaryDlg_Impl::GetCurrShortName() const +{ + return pDlg->GetCurrShortName(); +} +// AbstractGlossaryDlg_Impl end + +// AbstractFldInputDlg_Impl begin +void AbstractFldInputDlg_Impl::SetWindowState( const ByteString& rStr ) +{ + pDlg->SetWindowState( rStr ); +} + +ByteString AbstractFldInputDlg_Impl::GetWindowState( ULONG nMask ) const +{ + return pDlg->GetWindowState( nMask ); +} +// AbstractFldInputDlg_Impl end + +// AbstractInsFootNoteDlg_Impl begin +String AbstractInsFootNoteDlg_Impl::GetFontName() +{ + return pDlg->GetFontName(); +} +BOOL AbstractInsFootNoteDlg_Impl::IsEndNote() +{ + return pDlg->IsEndNote(); +} +String AbstractInsFootNoteDlg_Impl::GetStr() +{ + return pDlg->GetStr(); +} +void AbstractInsFootNoteDlg_Impl::SetHelpId( ULONG nHelpId ) +{ + pDlg->SetHelpId( nHelpId ); +} +void AbstractInsFootNoteDlg_Impl::SetText( const XubString& rStr ) +{ + pDlg->SetText( rStr ); +} +// AbstractInsFootNoteDlg_Impl end + +// AbstractInsertGrfRulerDlg_Impl begin +String AbstractInsertGrfRulerDlg_Impl::GetGraphicName() +{ + return pDlg->GetGraphicName(); +} +BOOL AbstractInsertGrfRulerDlg_Impl::IsSimpleLine() +{ + return pDlg->IsSimpleLine(); +} +BOOL AbstractInsertGrfRulerDlg_Impl::HasImages() const +{ + return pDlg->HasImages(); +} +// AbstractInsertGrfRulerDlg_Impl end + +// AbstractInsTableDlg_Impl begin +void AbstractInsTableDlg_Impl::GetValues( String& rName, USHORT& rRow, USHORT& rCol, + SwInsertTableOptions& rInsTblFlags, String& rTableAutoFmtName, + SwTableAutoFmt *& prTAFmt ) +{ + pDlg->GetValues( rName, rRow, rCol, rInsTblFlags, rTableAutoFmtName, prTAFmt); +} +// AbstractInsTableDlg_Impl end + +// AbstractJavaEditDialog_Impl begin +String AbstractJavaEditDialog_Impl::GetText() +{ + return pDlg->GetText(); +} +String AbstractJavaEditDialog_Impl::GetType() +{ + return pDlg->GetType(); +} +BOOL AbstractJavaEditDialog_Impl::IsUrl() +{ + return pDlg->IsUrl(); +} +BOOL AbstractJavaEditDialog_Impl::IsNew() +{ + return pDlg->IsNew(); +} +BOOL AbstractJavaEditDialog_Impl::IsUpdate() +{ + return pDlg->IsUpdate(); +} +// AbstractJavaEditDialog_Impl end + +// AbstractMailMergeDlg_Impl begin +USHORT AbstractMailMergeDlg_Impl::GetMergeType() +{ + return pDlg->GetMergeType(); +} +const ::rtl::OUString& AbstractMailMergeDlg_Impl::GetSaveFilter() const +{ + return pDlg->GetSaveFilter(); +} + +const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > AbstractMailMergeDlg_Impl::GetSelection() const +{ + return pDlg->GetSelection(); +} +uno::Reference< sdbc::XResultSet> AbstractMailMergeDlg_Impl::GetResultSet() const +{ + return pDlg->GetResultSet(); +} +// AbstractMailMergeDlg_Impl end +// AbstractMailMergeCreateFromDlg_Impl begin +BOOL AbstractMailMergeCreateFromDlg_Impl::IsThisDocument() const +{ + return pDlg->IsThisDocument(); +} +// AbstractMailMergeCreateFromDlg_Impl end +//AbstractMailMergeFieldConnectionsDlg_Impl begin +BOOL AbstractMailMergeFieldConnectionsDlg_Impl::IsUseExistingConnections() const +{ + return pDlg->IsUseExistingConnections(); +} +// AbstractMailMergeFieldConnectionsDlg_Impl end + +// AbstractMultiTOXTabDialog_Impl begin +SwForm* AbstractMultiTOXTabDialog_Impl::GetForm(CurTOXType eType) +{ + return pDlg->GetForm(eType); +} +CurTOXType AbstractMultiTOXTabDialog_Impl::GetCurrentTOXType() const +{ + return pDlg->GetCurrentTOXType(); +} +SwTOXDescription& AbstractMultiTOXTabDialog_Impl::GetTOXDescription(CurTOXType eTOXTypes) +{ + return pDlg->GetTOXDescription(eTOXTypes); +} +const SfxItemSet* AbstractMultiTOXTabDialog_Impl::GetOutputItemSet() const +{ + return pDlg->GetOutputItemSet(); +} +// AbstractMultiTOXTabDialog_Impl end + +// AbstractEditRegionDlg_Impl begin +void AbstractEditRegionDlg_Impl::SelectSection(const String& rSectionName) +{ + pDlg->SelectSection(rSectionName); +} +// AbstractEditRegionDlg_Impl end +//AbstractInsertSectionTabDialog_Impl begin +void +AbstractInsertSectionTabDialog_Impl::SetSectionData(SwSectionData const& rSect) +{ + pDlg->SetSectionData(rSect); +} +// AbstractInsertSectionTabDialog_Impl end + +//AbstractIndexMarkFloatDlg_Impl begin +void AbstractIndexMarkFloatDlg_Impl::ReInitDlg(SwWrtShell& rWrtShell) +{ + pDlg->ReInitDlg( rWrtShell); +} +Window* AbstractIndexMarkFloatDlg_Impl::GetWindow() +{ + return (Window*)pDlg; +} +// AbstractIndexMarkFloatDlg_Impl end + +//AbstractAuthMarkFloatDlg_Impl begin +void AbstractAuthMarkFloatDlg_Impl::ReInitDlg(SwWrtShell& rWrtShell) +{ + pDlg->ReInitDlg( rWrtShell); +} +Window* AbstractAuthMarkFloatDlg_Impl::GetWindow() +{ + return (Window*)pDlg; +} +// AbstractAuthMarkFloatDlg_Impl end + +AbstractMailMergeWizard_Impl::~AbstractMailMergeWizard_Impl() +{ + delete pDlg; +} + +void AbstractMailMergeWizard_Impl::StartExecuteModal( const Link& rEndDialogHdl ) +{ + aEndDlgHdl = rEndDialogHdl; + pDlg->StartExecuteModal( + LINK( this, AbstractMailMergeWizard_Impl, EndDialogHdl ) ); +} + +long AbstractMailMergeWizard_Impl::GetResult() +{ + return pDlg->GetResult(); +} + +#ifdef DBG_UTIL +IMPL_LINK( AbstractMailMergeWizard_Impl, EndDialogHdl, SwMailMergeWizard*, pDialog ) +#else +IMPL_LINK( AbstractMailMergeWizard_Impl, EndDialogHdl, SwMailMergeWizard*, EMPTYARG ) +#endif +{ + DBG_ASSERT( pDialog == pDlg, "wrong dialog passed to EndDialogHdl!" ); + + aEndDlgHdl.Call( this ); + aEndDlgHdl = Link(); + + return 0L; +} + +void AbstractMailMergeWizard_Impl::SetReloadDocument(const String& rURL) +{ + pDlg->SetReloadDocument(rURL); +} +const String& AbstractMailMergeWizard_Impl::GetReloadDocument() const +{ + return pDlg->GetReloadDocument(); +} +BOOL AbstractMailMergeWizard_Impl::ShowPage( USHORT nLevel ) +{ + return pDlg->skipUntil(nLevel); +} +sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const +{ + return pDlg->GetRestartPage(); +} + +//-------------- SwAbstractDialogFactory implementation-------------- + +AbstractSwWordCountDialog* SwAbstractDialogFactory_Impl::CreateSwWordCountDialog(Window* pParent) +{ + SwWordCountDialog* pDlg = new SwWordCountDialog( pParent ); + return new AbstractSwWordCountDialog_Impl( pDlg ); +} + +//add for SwInsertAbstractDlg begin +AbstractSwInsertAbstractDlg * SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg( Window* pParent, + int nResId ) +{ + SwInsertAbstractDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_INSERT_ABSTRACT : + pDlg = new SwInsertAbstractDlg( pParent); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractSwInsertAbstractDlg_Impl( pDlg ); + return 0; +} +//add for SwInsertAbstractDlg end + +SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSfxDialog( Window* pParent, + const SfxItemSet& rSet, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&, + sal_uInt32 nResId + ) +{ + SfxModalDialog* pDlg=NULL; + switch ( nResId ) + { + case RC_DLG_ADDR : + pDlg = new SwAddrDlg( pParent, rSet ); + break; + case DLG_SWDROPCAPS : + pDlg = new SwDropCapsDlg( pParent, rSet ); + break; + case RC_SWDLG_BACKGROUND : + pDlg = new SwBackgroundDlg( pParent, rSet ); + break; + case RC_DLG_SWNUMFMTDLG : + pDlg = new SwNumFmtDlg( pParent, rSet ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractSfxDialog_Impl( pDlg ); + return 0; +} + +// add for SwAsciiFilterDlg begin +AbstractSwAsciiFilterDlg* SwAbstractDialogFactory_Impl::CreateSwAsciiFilterDlg( Window* pParent, + SwDocShell& rDocSh, + SvStream* pStream, + int nResId ) +{ + SwAsciiFilterDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_ASCII_FILTER : + pDlg = new SwAsciiFilterDlg( pParent, rDocSh, pStream ); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractSwAsciiFilterDlg_Impl( pDlg ); + return 0; +} + +//add for SwAsciiFilterDlg end + +// add for SwInsertBookmarkDlg begin +VclAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwInsertBookmarkDlg( Window *pParent, + SwWrtShell &rSh, + SfxRequest& rReq, + int nResId ) +{ + Dialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_INSERT_BOOKMARK : + pDlg = new SwInsertBookmarkDlg( pParent, rSh, rReq ); + break; + + default: + break; + } + + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} + +//add for SwInsertBookmarkDlg end + +//add for SwBreakDlg begin + +AbstractSwBreakDlg * SwAbstractDialogFactory_Impl::CreateSwBreakDlg ( Window *pParent, + SwWrtShell &rSh, + int nResId ) +{ + SwBreakDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_BREAK : + pDlg = new SwBreakDlg( pParent, rSh ); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractSwBreakDlg_Impl( pDlg ); + return 0; +} +//add for SwBreakDlg end + +// add for SwChangeDBDlg begin +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwChangeDBDlg( SwView& rVw, int nResId ) +{ + Dialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_CHANGE_DB : + pDlg = new SwChangeDBDlg( rVw ); + break; + + default: + break; + } + + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} + +// add for SwChangeDBDlg end + +// add for SwCharDlg begin +SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwCharDlg(Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, int nResId, // add for SwCharDlg + const String* pFmtStr , BOOL bIsDrwTxtDlg ) +{ + + SfxTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_CHAR : + pDlg = new SwCharDlg( pParent, pVw, rCoreSet, pFmtStr, bIsDrwTxtDlg ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractTabDialog_Impl( pDlg ); + return 0; + +} +// add for SwCharDlg end + +//add for SwConvertTableDlg begin +AbstractSwConvertTableDlg* SwAbstractDialogFactory_Impl::CreateSwConvertTableDlg ( + SwView& rView,int nResId, bool bToTable ) +{ + SwConvertTableDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_CONV_TEXT_TABLE : + pDlg = new SwConvertTableDlg( rView, bToTable ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractSwConvertTableDlg_Impl( pDlg ); + return 0; +} + +//add for SwConvertTableDlg end + +//add for SwCaptionDialog begin +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwCaptionDialog ( Window *pParent, SwView &rV,int nResId) +{ + Dialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_CAPTION : + pDlg = new SwCaptionDialog( pParent, rV ); + break; + + default: + break; + } + + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} +//add for SwCaptionDialog end + +//add for SwInsertDBColAutoPilot begin + +AbstractSwInsertDBColAutoPilot* SwAbstractDialogFactory_Impl::CreateSwInsertDBColAutoPilot( SwView& rView, // add for SwInsertDBColAutoPilot + uno::Reference< sdbc::XDataSource> rxSource, + uno::Reference<sdbcx::XColumnsSupplier> xColSupp, + const SwDBData& rData, int nResId) +{ + SwInsertDBColAutoPilot* pDlg=NULL; + switch ( nResId ) + { + case DLG_AP_INSERT_DB_SEL : + pDlg = new SwInsertDBColAutoPilot( rView, rxSource, xColSupp, rData ); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractSwInsertDBColAutoPilot_Impl( pDlg ); + return 0; +} +//add for SwInsertDBColAutoPilot end +//add for SwFootNoteOptionDlg begin +SfxAbstractTabDialog * SwAbstractDialogFactory_Impl::CreateSwFootNoteOptionDlg( Window *pParent, SwWrtShell &rSh,int nResId) +{ + SfxTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_DOC_FOOTNOTE : + pDlg = new SwFootNoteOptionDlg( pParent, rSh ); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractTabDialog_Impl( pDlg ); + return 0; +} +//add for SwFootNoteOptionDlg begin + + +//add for DropDownFieldDialog begin + +AbstractDropDownFieldDialog * SwAbstractDialogFactory_Impl::CreateDropDownFieldDialog ( Window *pParent, SwWrtShell &rSh, //add for DropDownFieldDialog + SwField* pField,int nResId, BOOL bNextButton ) +{ + sw::DropDownFieldDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_FLD_DROPDOWN : + pDlg = new sw::DropDownFieldDialog( pParent, rSh, pField, bNextButton ); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractDropDownFieldDialog_Impl( pDlg ); + return 0; +} +//add for DropDownFieldDialog end + +//add for SwEnvDlg begin +SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwEnvDlg ( Window* pParent, const SfxItemSet& rSet, + SwWrtShell* pWrtSh, Printer* pPrt, + BOOL bInsert,int nResId ) //add for SwEnvDlg +{ + SfxTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_ENV : + pDlg = new SwEnvDlg( pParent, rSet, pWrtSh,pPrt, bInsert ); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractTabDialog_Impl( pDlg ); + return 0; +} +//add for SwEnvDlg end + +//add for SwLabDlg begin + +AbstarctSwLabDlg* SwAbstractDialogFactory_Impl::CreateSwLabDlg ( Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg + SwNewDBMgr* pNewDBMgr, BOOL bLabel,int nResId ) +{ + SwLabDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_LAB : + pDlg = new SwLabDlg( pParent, rSet, pNewDBMgr,bLabel ); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstarctSwLabDlg_Impl( pDlg ); + return 0; +} + +SwLabDlgMethod SwAbstractDialogFactory_Impl::GetSwLabDlgStaticMethod () +{ + return SwLabDlg::UpdateFieldInformation; +} + +//add for SwLabDlg end + +//add for SwParaDlg begin +SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwParaDlg ( Window *pParent, SwView& rVw, + const SfxItemSet& rCoreSet , + BYTE nDialogMode, + int nResId, + const String *pCollName, + BOOL bDraw , UINT16 nDefPage) +{ + SfxTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_DRAWPARA : + case DLG_PARA : + pDlg = new SwParaDlg( pParent, rVw, rCoreSet,nDialogMode, pCollName, bDraw, nDefPage ); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractTabDialog_Impl( pDlg ); + return 0; +} +//add for SwParaDlg end + +//add for SwTableHeightDlg SwSortDlg begin +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclAbstractDialog ( Window *pParent, SwWrtShell &rSh, int nResId ) +{ + Dialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_ROW_HEIGHT : + pDlg = new SwTableHeightDlg( pParent, rSh); + break; + + case DLG_SORTING : + pDlg = new SwSortDlg( pParent, rSh); + break; + case DLG_COLUMN : + pDlg = new SwColumnDlg( pParent, rSh ); + break; + case DLG_EDIT_AUTHMARK : + pDlg = new SwAuthMarkModalDlg( pParent, rSh ); + break; + default: + break; + } + + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} +//add for SwTableHeightDlg SwSortDlg ,end +//add for SwSplitTblDlg begin +AbstractSplitTableDialog * SwAbstractDialogFactory_Impl::CreateSplitTblDialog ( Window *pParent, SwWrtShell &rSh ) +{ + return new AbstractSplitTableDialog_Impl( new SwSplitTblDlg( pParent, rSh) ); +} +//add SwSplitTblDlg end + +//add for SwSelGlossaryDlg begin +AbstarctSwSelGlossaryDlg * SwAbstractDialogFactory_Impl::CreateSwSelGlossaryDlg ( Window * pParent, const String &rShortName, int nResId ) +{ + SwSelGlossaryDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_SEL_GLOS : + pDlg = new SwSelGlossaryDlg( pParent, rShortName); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstarctSwSelGlossaryDlg_Impl( pDlg ); + return 0; +} + +//add for SwSelGlossaryDlg end + +//add for SwAutoFormatDlg begin +AbstractSwAutoFormatDlg * SwAbstractDialogFactory_Impl::CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell, + int nResId, + BOOL bSetAutoFmt, + const SwTableAutoFmt* pSelFmt ) +{ + SwAutoFormatDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_AUTOFMT_TABLE : + pDlg = new SwAutoFormatDlg( pParent, pShell,bSetAutoFmt,pSelFmt); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractSwAutoFormatDlg_Impl( pDlg ); + return 0; +} +//add for SwAutoFormatDlg end + +//add for SwBorderDlg begin +SfxAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, USHORT nType,int nResId ) +{ + SfxModalDialog* pDlg=NULL; + switch ( nResId ) + { + case RC_DLG_SWBORDERDLG : + pDlg = new SwBorderDlg( pParent, rSet, nType ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractSfxDialog_Impl( pDlg ); + return 0; +} +//add for SwBorderDlg end + +//add for SwWrapDlg begin +SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId ) +{ + SfxModalDialog* pDlg=NULL; + switch ( nResId ) + { + case RC_DLG_SWWRAPDLG : + pDlg = new SwWrapDlg( pParent, rSet, pSh, bDrawMode ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractSfxDialog_Impl( pDlg ); + return 0; +} +//add for SwWrapDlg end + +//add for SwTableWidthDlg begin +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwTableWidthDlg ( Window *pParent, SwTableFUNC &rFnc , int nResId ) +{ + Dialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_COL_WIDTH : + pDlg = new SwTableWidthDlg( pParent, rFnc); + break; + + default: + break; + } + + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} +//add for SwTableWidthDlg end + + //add for SwTableTabDlg begin +SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTableTabDlg( Window* pParent, SfxItemPool& Pool, + const SfxItemSet* pItemSet, SwWrtShell* pSh,int nResId ) +{ + SfxTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_FORMAT_TABLE : + pDlg = new SwTableTabDlg( pParent, Pool, pItemSet,pSh ); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractTabDialog_Impl( pDlg ); + return 0; +} + //add for SwTableTabDlg end + +//add for SwFldDlg begin +AbstractSwFldDlg * SwAbstractDialogFactory_Impl::CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId ) +{ + SwFldDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_FLD_INSERT : + pDlg = new SwFldDlg( pB, pCW,pParent); + break; + + default: + break; + } + + if ( pDlg ) + return new AbstractSwFldDlg_Impl( pDlg ); + return 0; +} +//add for SwFldDlg end + +//add for SwFldEditDlg begin +SfxAbstractDialog* SwAbstractDialogFactory_Impl::CreateSwFldEditDlg ( SwView& rVw, int nResId ) +{ + SfxModalDialog* pDlg=NULL; + switch ( nResId ) + { + case RC_DLG_SWFLDEDITDLG : + pDlg = new SwFldEditDlg( rVw ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractSfxDialog_Impl( pDlg ); + return 0; +} +//add for SwFldEditDlg + +//add for SwRenameXNamedDlg begin +AbstractSwRenameXNamedDlg * SwAbstractDialogFactory_Impl::CreateSwRenameXNamedDlg( Window* pParent, + STAR_REFERENCE( container::XNamed ) & xNamed, + STAR_REFERENCE( container::XNameAccess ) & xNameAccess,int nResId ) +{ + SwRenameXNamedDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_RENAME_XNAMED : + pDlg = new SwRenameXNamedDlg( pParent,xNamed, xNameAccess); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractSwRenameXNamedDlg_Impl( pDlg ); + return 0; +} + +//add for SwRenameXNamedDlg end + +//add for SwModalRedlineAcceptDlg begin +AbstractSwModalRedlineAcceptDlg * SwAbstractDialogFactory_Impl::CreateSwModalRedlineAcceptDlg ( Window *pParent, int nResId ) +{ + SwModalRedlineAcceptDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_MOD_REDLINE_ACCEPT : + pDlg = new SwModalRedlineAcceptDlg( pParent ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractSwModalRedlineAcceptDlg_Impl( pDlg ); + return 0; +} +//add for SwModalRedlineAcceptDlg end + +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateSwVclDialog( int nResId, + Window* pParent, BOOL& rWithPrev ) //add for SwMergeTblDlg +{ + Dialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_MERGE_TABLE : + pDlg = new SwMergeTblDlg( pParent, rWithPrev ); + break; + default: + break; + } + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} +SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateFrmTabDialog( int nResId, + SfxViewFrame *pFrame, Window *pParent, + const SfxItemSet& rCoreSet, + BOOL bNewFrm, + USHORT nResType, + BOOL bFmt, + UINT16 nDefPage, + const String* pFmtStr ) //add for SwFrmDlg +{ + SfxTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_FRM_GRF : + case DLG_FRM_OLE : + case DLG_FRM_STD : + pDlg = new SwFrmDlg( pFrame, pParent, rCoreSet, bNewFrm, nResType, bFmt, nDefPage, pFmtStr ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractTabDialog_Impl( pDlg ); + return 0; +} + +SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateTemplateDialog( int nResId, + Window* pParent, + SfxStyleSheetBase& rBase, + USHORT nRegion, + BOOL bColumn, + SwWrtShell* pActShell, + BOOL bNew ) //add for SwTemplateDlg +{ + SfxTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_TEMPLATE_BASE : + pDlg = new SwTemplateDlg( pParent, rBase, nRegion, bColumn, pActShell, bNew ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractTabDialog_Impl( pDlg ); + return 0; +} + +AbstractGlossaryDlg* SwAbstractDialogFactory_Impl::CreateGlossaryDlg( int nResId, + SfxViewFrame* pViewFrame, + SwGlossaryHdl* pGlosHdl, + SwWrtShell *pWrtShell) //add for SwGlossaryDlg +{ + SwGlossaryDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_RENAME_GLOS : + pDlg = new SwGlossaryDlg( pViewFrame, pGlosHdl, pWrtShell ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractGlossaryDlg_Impl( pDlg ); + return 0; +} + +AbstractFldInputDlg* SwAbstractDialogFactory_Impl::CreateFldInputDlg( int nResId, + Window *pParent, SwWrtShell &rSh, + SwField* pField, BOOL bNextButton ) //add for SwFldInputDlg +{ + SwFldInputDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_FLD_INPUT : + pDlg = new SwFldInputDlg( pParent, rSh, pField, bNextButton ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractFldInputDlg_Impl( pDlg ); + return 0; +} + +AbstractInsFootNoteDlg* SwAbstractDialogFactory_Impl::CreateInsFootNoteDlg( int nResId, + Window * pParent, SwWrtShell &rSh, BOOL bEd ) //add for SwInsFootNoteDlg +{ + SwInsFootNoteDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_INS_FOOTNOTE : + pDlg = new SwInsFootNoteDlg( pParent, rSh, bEd ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractInsFootNoteDlg_Impl( pDlg ); + return 0; +} + +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateVclSwViewDialog( int nResId, + SwView& rView, BOOL /*bCol*/ ) //add for SwInsRowColDlg, SwLineNumberingDlg +{ + Dialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_LINE_NUMBERING : + pDlg = new SwLineNumberingDlg( &rView ); + break; + default: + break; + } + + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} + +AbstractInsertGrfRulerDlg * SwAbstractDialogFactory_Impl::CreateInsertGrfRulerDlg( int nResId, + Window * pParent ) //add for SwInsertGrfRulerDlg +{ + SwInsertGrfRulerDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_INSERT_RULER : + pDlg = new SwInsertGrfRulerDlg( pParent ); + break; + default: + break; + } + + if ( pDlg ) + return new AbstractInsertGrfRulerDlg_Impl( pDlg ); + return 0; +} + +AbstractInsTableDlg * SwAbstractDialogFactory_Impl::CreateInsTableDlg( int nResId, + SwView& rView ) //add for SwInsTableDlg +{ + SwInsTableDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_INSERT_TABLE : + pDlg = new SwInsTableDlg( rView ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractInsTableDlg_Impl( pDlg ); + return 0; +} + +AbstractJavaEditDialog * SwAbstractDialogFactory_Impl::CreateJavaEditDialog( int nResId, + Window* pParent, SwWrtShell* pWrtSh ) //add for SwJavaEditDialog +{ + SwJavaEditDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_JAVAEDIT : + pDlg = new SwJavaEditDialog( pParent, pWrtSh ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractJavaEditDialog_Impl( pDlg ); + return 0; +} + +AbstractMailMergeDlg * SwAbstractDialogFactory_Impl::CreateMailMergeDlg( int nResId, + Window* pParent, SwWrtShell& rSh, + const String& rSourceName, + const String& rTblName, + sal_Int32 nCommandType, + const uno::Reference< sdbc::XConnection>& xConnection, + uno::Sequence< uno::Any >* pSelection ) //add for SwMailMergeDlg +{ + SwMailMergeDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_MAILMERGE : + pDlg = new SwMailMergeDlg( pParent, rSh, rSourceName, rTblName, nCommandType, xConnection, pSelection ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractMailMergeDlg_Impl( pDlg ); + return 0; +} +AbstractMailMergeCreateFromDlg * SwAbstractDialogFactory_Impl::CreateMailMergeCreateFromDlg( int nResId, + Window* pParent ) //add for SwMailMergeCreateFromDlg +{ + SwMailMergeCreateFromDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_MERGE_CREATE : + pDlg = new SwMailMergeCreateFromDlg( pParent ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractMailMergeCreateFromDlg_Impl( pDlg ); + return 0; +} +AbstractMailMergeFieldConnectionsDlg * SwAbstractDialogFactory_Impl::CreateMailMergeFieldConnectionsDlg( int nResId, + Window* pParent ) //add for SwMailMergeFieldConnectionsDlg +{ + SwMailMergeFieldConnectionsDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_MERGE_FIELD_CONNECTIONS : + pDlg = new SwMailMergeFieldConnectionsDlg( pParent ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractMailMergeFieldConnectionsDlg_Impl( pDlg ); + return 0; +} + +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXMarkDlg( int nResId, + Window* pParent, SwTOXMgr &rTOXMgr ) //add for SwMultiTOXMarkDlg +{ + Dialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_MULTMRK : + pDlg = new SwMultiTOXMarkDlg( pParent, rTOXMgr ); + break; + default: + break; + } + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} +SfxAbstractTabDialog* SwAbstractDialogFactory_Impl::CreateSwTabDialog( int nResId, + Window* pParent, + const SfxItemSet* pSwItemSet, + SwWrtShell & rWrtSh ) //add for SwSvxNumBulletTabDialog, SwOutlineTabDialog +{ + SfxTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_SVXTEST_NUM_BULLET : + pDlg = new SwSvxNumBulletTabDialog( pParent, pSwItemSet, rWrtSh ); + break; + case DLG_TAB_OUTLINE : + pDlg = new SwOutlineTabDialog( pParent, pSwItemSet, rWrtSh ); + break; + + default: + break; + } + if ( pDlg ) + return new AbstractTabDialog_Impl( pDlg ); + return 0; +} +AbstractMultiTOXTabDialog * SwAbstractDialogFactory_Impl::CreateMultiTOXTabDialog( int nResId, + Window* pParent, const SfxItemSet& rSet, + SwWrtShell &rShell, + SwTOXBase* pCurTOX, USHORT nToxType, + BOOL bGlobal ) //add for SwMultiTOXTabDialog +{ + SwMultiTOXTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_MULTI_TOX : + pDlg = new SwMultiTOXTabDialog( pParent, rSet, rShell, pCurTOX, nToxType, bGlobal ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractMultiTOXTabDialog_Impl( pDlg ); + return 0; +} +AbstractEditRegionDlg * SwAbstractDialogFactory_Impl::CreateEditRegionDlg( int nResId, + Window* pParent, SwWrtShell& rWrtSh ) //add for SwEditRegionDlg +{ + SwEditRegionDlg* pDlg=NULL; + switch ( nResId ) + { + case MD_EDIT_REGION : + pDlg = new SwEditRegionDlg( pParent, rWrtSh ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractEditRegionDlg_Impl( pDlg ); + return 0; +} +AbstractInsertSectionTabDialog * SwAbstractDialogFactory_Impl::CreateInsertSectionTabDialog( int nResId, + Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) //add for SwInsertSectionTabDialog +{ + SwInsertSectionTabDialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_INSERT_SECTION : + pDlg = new SwInsertSectionTabDialog( pParent, rSet, rSh ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractInsertSectionTabDialog_Impl( pDlg ); + return 0; +} + +AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateIndexMarkFloatDlg( int nResId, + SfxBindings* pBindings, + SfxChildWindow* pChild, + Window *pParent, + SfxChildWinInfo* pInfo, + sal_Bool bNew ) //add for SwIndexMarkFloatDlg +{ + SwIndexMarkFloatDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_INSIDXMARK_CJK : + case DLG_INSIDXMARK : + pDlg = new SwIndexMarkFloatDlg( pBindings, pChild, pParent, pInfo, bNew ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractIndexMarkFloatDlg_Impl( pDlg ); + return 0; +} + +AbstractMarkFloatDlg * SwAbstractDialogFactory_Impl::CreateAuthMarkFloatDlg( int nResId, + SfxBindings* pBindings, + SfxChildWindow* pChild, + Window *pParent, + SfxChildWinInfo* pInfo, + sal_Bool bNew ) //add for SwAuthMarkFloatDlg +{ + SwAuthMarkFloatDlg* pDlg=NULL; + switch ( nResId ) + { + case DLG_INSAUTHMARK : + pDlg = new SwAuthMarkFloatDlg( pBindings, pChild, pParent, pInfo, bNew ); + break; + default: + break; + } + if ( pDlg ) + return new AbstractAuthMarkFloatDlg_Impl( pDlg ); + return 0; +} + +//add for SwIndexMarkModalDlg begin +VclAbstractDialog * SwAbstractDialogFactory_Impl::CreateIndexMarkModalDlg( int nResId, + Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark ) //add for SwIndexMarkModalDlg +{ + Dialog* pDlg=NULL; + switch ( nResId ) + { + case DLG_EDIT_IDXMARK_CJK : + case DLG_EDIT_IDXMARK : + pDlg = new SwIndexMarkModalDlg( pParent, rSh, pCurTOXMark ); + break; + + default: + break; + } + + if ( pDlg ) + return new VclAbstractDialog_Impl( pDlg ); + return 0; +} +//add for SwIndexMarkModalDlg end +AbstractMailMergeWizard* SwAbstractDialogFactory_Impl::CreateMailMergeWizard( + SwView& rView, SwMailMergeConfigItem& rConfigItem) +{ + return new AbstractMailMergeWizard_Impl( new SwMailMergeWizard(rView, rConfigItem)); +} + +//add for static func in SwGlossaryDlg +GlossaryGetCurrGroup SwAbstractDialogFactory_Impl::GetGlossaryCurrGroupFunc( USHORT nId ) +{ + switch ( nId ) + { + case DLG_RENAME_GLOS : + return SwGlossaryDlg::GetCurrGroup; + default: + break; + } + return 0; +} +GlossarySetActGroup SwAbstractDialogFactory_Impl::SetGlossaryActGroupFunc( USHORT nId ) +{ + switch ( nId ) + { + case DLG_RENAME_GLOS : + return SwGlossaryDlg::SetActGroup; + default: + break; + } + return 0; +} + +//------------------ Factories for TabPages +CreateTabPage SwAbstractDialogFactory_Impl::GetTabPageCreatorFunc( USHORT nId ) +{ + CreateTabPage pRet = 0; + switch ( nId ) + { + case TP_OPTCOMPATIBILITY_PAGE : + case RID_SW_TP_OPTCOMPATIBILITY_PAGE : + pRet = SwCompatibilityOptPage::Create; + break; + case TP_OPTLOAD_PAGE : + case RID_SW_TP_OPTLOAD_PAGE : + pRet = SwLoadOptPage::Create; + break; + case TP_OPTCAPTION_PAGE: + case RID_SW_TP_OPTCAPTION_PAGE: + return SwCaptionOptPage::Create; + case TP_CONTENT_OPT : + case RID_SW_TP_CONTENT_OPT: + case RID_SW_TP_HTML_CONTENT_OPT: + pRet = SwContentOptPage::Create; + break; + case TP_OPTSHDWCRSR : + case RID_SW_TP_OPTSHDWCRSR: + case RID_SW_TP_HTML_OPTSHDWCRSR: + pRet = SwShdwCrsrOptionsTabPage::Create; + break; + case RID_SW_TP_REDLINE_OPT : + case TP_REDLINE_OPT : + pRet = SwRedlineOptionsTabPage::Create; + break; + case RID_SW_TP_OPTTEST_PAGE : + case TP_OPTTEST_PAGE : +#ifdef DBG_UTIL + pRet = SwTestTabPage::Create; +#endif + break; + case TP_OPTPRINT_PAGE : + case RID_SW_TP_HTML_OPTPRINT_PAGE: + case RID_SW_TP_OPTPRINT_PAGE: + pRet = SwAddPrinterTabPage::Create; + break; + case TP_STD_FONT : + case RID_SW_TP_STD_FONT: + case RID_SW_TP_STD_FONT_CJK: + case RID_SW_TP_STD_FONT_CTL: + pRet = SwStdFontTabPage::Create; + break; + case TP_OPTTABLE_PAGE : + case RID_SW_TP_HTML_OPTTABLE_PAGE: + case RID_SW_TP_OPTTABLE_PAGE: + pRet = SwTableOptionsTabPage::Create; + break; + case TP_DOC_STAT : + pRet = SwDocStatPage::Create; + break; + case RID_SW_TP_MAILCONFIG: + pRet = SwMailConfigPage::Create; + break; + } + + return pRet; +} + +GetTabPageRanges SwAbstractDialogFactory_Impl::GetTabPageRangesFunc( USHORT nId ) +{ + switch ( nId ) + { + case 1 : //RID_SVXPAGE_TEXTANIMATION : + //return SvxTextAnimationPage::GetRanges; + break; + default: + break; + } + + return 0; +} diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx new file mode 100644 index 000000000000..5d8611d51f54 --- /dev/null +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -0,0 +1,586 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SW_DLGFACT_HXX +#define _SW_DLGFACT_HXX + +// include --------------------------------------------------------------- +#include "swabstdlg.hxx" + +class SwSaveLabelDlg; +class SwInsertAbstractDlg; +class SfxSingleTabDialog; +class SwAsciiFilterDlg; +class Dialog; +class SwBreakDlg; +class SfxTabDialog; +class SwConvertTableDlg; +class SwInsertDBColAutoPilot; +class SwLabDlg; +class SwSelGlossaryDlg; +class SwAutoFormatDlg; +class SwFldDlg; +class SwRenameXNamedDlg; +class SwModalRedlineAcceptDlg; +class SwTOXMark; +class SwWordCountDialog; +class SwSplitTblDlg; + +#include "itabenum.hxx" + +namespace sw +{ +class DropDownFieldDialog; +} + +#define DECL_ABSTDLG_BASE(Class,DialogClass) \ + DialogClass* pDlg; \ +public: \ + Class( DialogClass* p) \ + : pDlg(p) \ + {} \ + virtual ~Class(); \ + virtual short Execute() ; +// virtual void Show( BOOL bVisible = TRUE, USHORT nFlags = 0 ) + +#define IMPL_ABSTDLG_BASE(Class) \ +Class::~Class() \ +{ \ + delete pDlg; \ +} \ +short Class::Execute() \ +{ \ + return pDlg->Execute(); \ +} + + +class AbstractSwWordCountDialog_Impl : public AbstractSwWordCountDialog +{ + DECL_ABSTDLG_BASE(AbstractSwWordCountDialog_Impl,SwWordCountDialog) + void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc); +}; + +//add for SwInsertAbstractDlg begin +class AbstractSwInsertAbstractDlg_Impl : public AbstractSwInsertAbstractDlg +{ + DECL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl,SwInsertAbstractDlg) + virtual BYTE GetLevel() const ; + virtual BYTE GetPara() const ; +}; + +//add for SwInsertAbstractDlg end + +// add for SwAddrDlg, SwDropCapsDlg, SwBackgroundDlg SwNumFmtDlg SwWrapDlg SwBorderDlg, SwFldEditDlg begin +class SfxSingleTabDialog; +class AbstractSfxDialog_Impl :public SfxAbstractDialog +{ + DECL_ABSTDLG_BASE(AbstractSfxDialog_Impl,SfxModalDialog) + virtual const SfxItemSet* GetOutputItemSet() const; + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; +}; +// add for SwAddrDlg,SwDropCapsDlg , SwBackgroundDlg SwNumFmtDlg SwWrapDlg SwBorderDlg, SwFldEditDlg end + +// add for SwAsciiFilterDlg begin +class AbstractSwAsciiFilterDlg_Impl : public AbstractSwAsciiFilterDlg +{ + DECL_ABSTDLG_BASE( AbstractSwAsciiFilterDlg_Impl,SwAsciiFilterDlg ) + virtual void FillOptions( SwAsciiOptions& rOptions ); + +}; +// add for SwAsciiFilterDlg end + +// add for SwInsertBookmarkDlg SwChangeDBDlg, SwTableHeightDlg, SwSplitTblDlg SwSortDlg SwTableWidthDlgbegin +class VclAbstractDialog_Impl : public VclAbstractDialog +{ + DECL_ABSTDLG_BASE(VclAbstractDialog_Impl,Dialog) +}; +// add for SwInsertBookmarkDlg SwChangeDBDlg, SwTableHeightDlg SwSplitTblDlg SwSortDlg SwTableWidthDlg end + +// add for SwBreakDlg begin +class AbstractSwBreakDlg_Impl : public AbstractSwBreakDlg // add for SwBreakDlg +{ + DECL_ABSTDLG_BASE(AbstractSwBreakDlg_Impl,SwBreakDlg) + virtual String GetTemplateName(); + virtual USHORT GetKind(); + virtual USHORT GetPageNumber(); + +}; +class AbstractSplitTableDialog_Impl : public AbstractSplitTableDialog // add for +{ + DECL_ABSTDLG_BASE(AbstractSplitTableDialog_Impl, SwSplitTblDlg) + virtual sal_uInt16 GetSplitMode(); +}; + +// add for SwBreakDlg end + +//add for SwCharDlg , SwEnvDlg , SwFootNoteOptionDlg SwParaDlg SwTableTabDlg begin +class AbstractTabDialog_Impl : public SfxAbstractTabDialog +{ + DECL_ABSTDLG_BASE( AbstractTabDialog_Impl,SfxTabDialog ) + virtual void SetCurPageId( USHORT nId ); + virtual const SfxItemSet* GetOutputItemSet() const; + virtual const USHORT* GetInputRanges( const SfxItemPool& pItem ); + virtual void SetInputSet( const SfxItemSet* pInSet ); + //From class Window. + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; +}; +//add for SwCharDlg, SwEnvDlg ,SwFootNoteOptionDlg SwParaDlg SwTableTabDlg end + +//add for SwConvertTableDlg begin +class AbstractSwConvertTableDlg_Impl : public AbstractSwConvertTableDlg // add for SwConvertTableDlg +{ + DECL_ABSTDLG_BASE( AbstractSwConvertTableDlg_Impl,SwConvertTableDlg) + virtual void GetValues( sal_Unicode& rDelim,SwInsertTableOptions& rInsTblFlags, + SwTableAutoFmt *& prTAFmt ); +}; +//add for SwConvertTableDlg end + +//add for SwInsertDBColAutoPilot begin +class AbstractSwInsertDBColAutoPilot_Impl : public AbstractSwInsertDBColAutoPilot // add for SwInsertDBColAutoPilot +{ + DECL_ABSTDLG_BASE( AbstractSwInsertDBColAutoPilot_Impl,SwInsertDBColAutoPilot) + virtual void DataToDoc( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rSelection, + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource, + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> xConnection, + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > xResultSet); +}; +//add for SwInsertDBColAutoPilot end + +//add for DropDownFieldDialog begin +class AbstractDropDownFieldDialog_Impl : public AbstractDropDownFieldDialog //add for DropDownFieldDialog +{ + DECL_ABSTDLG_BASE(AbstractDropDownFieldDialog_Impl, sw::DropDownFieldDialog) + virtual ByteString GetWindowState( ULONG nMask = WINDOWSTATE_MASK_ALL ) const; //this method inherit from SystemWindow + virtual void SetWindowState( const ByteString& rStr );//this method inherit from SystemWindow +}; +//add for DropDownFieldDialog end + + +class AbstarctSwLabDlg_Impl : public AbstarctSwLabDlg +{ + DECL_ABSTDLG_BASE(AbstarctSwLabDlg_Impl,SwLabDlg) + virtual void SetCurPageId( USHORT nId ); + virtual const SfxItemSet* GetOutputItemSet() const; + virtual const USHORT* GetInputRanges( const SfxItemPool& pItem ); + virtual void SetInputSet( const SfxItemSet* pInSet ); + //From class Window. + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; + virtual const String& GetBusinessCardStr() const; + virtual Printer *GetPrt(); +}; +//add for SwLabDlg end + +//add for SwSelGlossaryDlg begin +class AbstarctSwSelGlossaryDlg_Impl : public AbstarctSwSelGlossaryDlg +{ + DECL_ABSTDLG_BASE(AbstarctSwSelGlossaryDlg_Impl,SwSelGlossaryDlg) + virtual void InsertGlos(const String &rRegion, const String &rGlosName); // inline + virtual USHORT GetSelectedIdx() const; // inline + virtual void SelectEntryPos(USHORT nIdx); // inline +}; +//add for SwSelGlossaryDlg end + +//add for SwAutoFormatDlg begin +class AbstractSwAutoFormatDlg_Impl : public AbstractSwAutoFormatDlg +{ + DECL_ABSTDLG_BASE(AbstractSwAutoFormatDlg_Impl,SwAutoFormatDlg ) + virtual void FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const; +}; +//add for SwAutoFormatDlg end + +//add for SwFldDlg begin + +class AbstractSwFldDlg_Impl : public AbstractSwFldDlg //add for SwFldDlg +{ + DECL_ABSTDLG_BASE(AbstractSwFldDlg_Impl,SwFldDlg ) + virtual void SetCurPageId( USHORT nId ); + virtual const SfxItemSet* GetOutputItemSet() const; + virtual const USHORT* GetInputRanges( const SfxItemPool& pItem ); + virtual void SetInputSet( const SfxItemSet* pInSet ); + //From class Window. + virtual void SetText( const XubString& rStr ); + virtual String GetText() const; + virtual void Start( BOOL bShow = TRUE ); //this method from SfxTabDialog + virtual void ShowPage( USHORT nId );// this method from SfxTabDialog + virtual void Initialize(SfxChildWinInfo *pInfo); + virtual void ReInitDlg(); + virtual void ActivateDatabasePage(); + virtual Window * GetWindow(); //this method is added for return a Window type pointer +}; +//add for SwFldD end + +//add for SwRenameXNamedDlg begin +class AbstractSwRenameXNamedDlg_Impl : public AbstractSwRenameXNamedDlg +{ + DECL_ABSTDLG_BASE(AbstractSwRenameXNamedDlg_Impl,SwRenameXNamedDlg ) + virtual void SetForbiddenChars( const String& rSet ); + virtual void SetAlternativeAccess( + STAR_REFERENCE( container::XNameAccess ) & xSecond, + STAR_REFERENCE( container::XNameAccess ) & xThird ); +}; +//add for SwRenameXNamedDlg end +//add for SwModalRedlineAcceptDlg begin +class AbstractSwModalRedlineAcceptDlg_Impl : public AbstractSwModalRedlineAcceptDlg +{ + DECL_ABSTDLG_BASE(AbstractSwModalRedlineAcceptDlg_Impl,SwModalRedlineAcceptDlg ) + virtual void AcceptAll( BOOL bAccept ); +}; +//add for SwModalRedlineAcceptDlg end + +//for SwGlossaryDlg begin +class SwGlossaryDlg; +class AbstractGlossaryDlg_Impl : public AbstractGlossaryDlg +{ + DECL_ABSTDLG_BASE(AbstractGlossaryDlg_Impl,SwGlossaryDlg) + virtual String GetCurrGrpName() const; + virtual String GetCurrShortName() const; +}; +//for SwGlossaryDlg end + +//for SwFldInputDlg begin +class SwFldInputDlg; +class AbstractFldInputDlg_Impl : public AbstractFldInputDlg +{ + DECL_ABSTDLG_BASE(AbstractFldInputDlg_Impl,SwFldInputDlg) + //from class SalFrame + virtual void SetWindowState( const ByteString& rStr ) ; + virtual ByteString GetWindowState( ULONG nMask = WINDOWSTATE_MASK_ALL ) const ; +}; +//for SwFldInputDlg end + +//for SwInsFootNoteDlg begin +class SwInsFootNoteDlg; +class AbstractInsFootNoteDlg_Impl : public AbstractInsFootNoteDlg +{ + DECL_ABSTDLG_BASE(AbstractInsFootNoteDlg_Impl,SwInsFootNoteDlg) + virtual String GetFontName(); + virtual BOOL IsEndNote(); + virtual String GetStr(); + //from class Window + virtual void SetHelpId( ULONG nHelpId ); + virtual void SetText( const XubString& rStr ); +}; +//for SwInsFootNoteDlg end + +//for SwInsertGrfRulerDlg begin +class SwInsertGrfRulerDlg; +class AbstractInsertGrfRulerDlg_Impl : public AbstractInsertGrfRulerDlg +{ + DECL_ABSTDLG_BASE(AbstractInsertGrfRulerDlg_Impl,SwInsertGrfRulerDlg) + virtual String GetGraphicName(); + virtual BOOL IsSimpleLine(); + virtual BOOL HasImages() const ; +}; +//for SwInsertGrfRulerDlg end + +//for SwInsTableDlg begin +class SwInsTableDlg; +class AbstractInsTableDlg_Impl : public AbstractInsTableDlg +{ + DECL_ABSTDLG_BASE(AbstractInsTableDlg_Impl,SwInsTableDlg) + virtual void GetValues( String& rName, USHORT& rRow, USHORT& rCol, + SwInsertTableOptions& rInsTblFlags, String& rTableAutoFmtName, + SwTableAutoFmt *& prTAFmt ); +}; +//for SwInsTableDlg end + +//for SwJavaEditDialog begin +class SwJavaEditDialog; +class AbstractJavaEditDialog_Impl : public AbstractJavaEditDialog +{ + DECL_ABSTDLG_BASE(AbstractJavaEditDialog_Impl,SwJavaEditDialog) + virtual String GetText(); + virtual String GetType(); + virtual BOOL IsUrl(); + virtual BOOL IsNew(); + virtual BOOL IsUpdate(); +}; +//for SwJavaEditDialog end + +//for SwMailMergeDlg begin +class SwMailMergeDlg; +class AbstractMailMergeDlg_Impl : public AbstractMailMergeDlg +{ + DECL_ABSTDLG_BASE(AbstractMailMergeDlg_Impl,SwMailMergeDlg) + virtual USHORT GetMergeType() ; + virtual const ::rtl::OUString& GetSaveFilter() const; + virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > GetSelection() const ; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> GetResultSet() const; +}; +//for SwMailMergeDlg end +//for SwMailMergeCreateFromDlg begin +class SwMailMergeCreateFromDlg; +class AbstractMailMergeCreateFromDlg_Impl : public AbstractMailMergeCreateFromDlg +{ + DECL_ABSTDLG_BASE(AbstractMailMergeCreateFromDlg_Impl,SwMailMergeCreateFromDlg) + virtual BOOL IsThisDocument() const ; +}; +//for SwMailMergeCreateFromDlg end +//for SwMailMergeFieldConnectionsDlg begin +class SwMailMergeFieldConnectionsDlg; +class AbstractMailMergeFieldConnectionsDlg_Impl : public AbstractMailMergeFieldConnectionsDlg +{ + DECL_ABSTDLG_BASE(AbstractMailMergeFieldConnectionsDlg_Impl,SwMailMergeFieldConnectionsDlg) + virtual BOOL IsUseExistingConnections() const ; +}; +//for SwMailMergeFieldConnectionsDlg end + +//for SwMultiTOXTabDialog begin +class SwMultiTOXTabDialog; +class AbstractMultiTOXTabDialog_Impl : public AbstractMultiTOXTabDialog +{ + DECL_ABSTDLG_BASE(AbstractMultiTOXTabDialog_Impl,SwMultiTOXTabDialog) + virtual SwForm* GetForm(CurTOXType eType); + virtual CurTOXType GetCurrentTOXType() const ; + virtual SwTOXDescription& GetTOXDescription(CurTOXType eTOXTypes); + //from SfxTabDialog + virtual const SfxItemSet* GetOutputItemSet() const; +}; +//for SwMultiTOXTabDialog end + +//for SwEditRegionDlg begin +class SwEditRegionDlg; +class AbstractEditRegionDlg_Impl : public AbstractEditRegionDlg +{ + DECL_ABSTDLG_BASE(AbstractEditRegionDlg_Impl,SwEditRegionDlg) + virtual void SelectSection(const String& rSectionName); +}; +//for SwEditRegionDlg end +//for SwInsertSectionTabDialog begin +class SwInsertSectionTabDialog; +class AbstractInsertSectionTabDialog_Impl : public AbstractInsertSectionTabDialog +{ + DECL_ABSTDLG_BASE(AbstractInsertSectionTabDialog_Impl,SwInsertSectionTabDialog) + virtual void SetSectionData(SwSectionData const& rSect); +}; +//for SwInsertSectionTabDialog end + +//for SwIndexMarkFloatDlg begin +class SwIndexMarkFloatDlg; +class AbstractIndexMarkFloatDlg_Impl : public AbstractMarkFloatDlg +{ + DECL_ABSTDLG_BASE(AbstractIndexMarkFloatDlg_Impl,SwIndexMarkFloatDlg) + virtual void ReInitDlg(SwWrtShell& rWrtShell); + virtual Window * GetWindow(); //this method is added for return a Window type pointer +}; +//for SwIndexMarkFloatDlg end + +//for SwAuthMarkFloatDlg begin +class SwAuthMarkFloatDlg; +class AbstractAuthMarkFloatDlg_Impl : public AbstractMarkFloatDlg +{ + DECL_ABSTDLG_BASE(AbstractAuthMarkFloatDlg_Impl,SwAuthMarkFloatDlg) + virtual void ReInitDlg(SwWrtShell& rWrtShell); + virtual Window * GetWindow(); //this method is added for return a Window type pointer +}; +//for SwAuthMarkFloatDlg end + +class SwMailMergeWizard; +class AbstractMailMergeWizard_Impl : public AbstractMailMergeWizard +{ + SwMailMergeWizard* pDlg; + Link aEndDlgHdl; + + DECL_LINK( EndDialogHdl, SwMailMergeWizard* ); +public: + AbstractMailMergeWizard_Impl( SwMailMergeWizard* p ) + : pDlg(p) + {} + virtual ~AbstractMailMergeWizard_Impl(); + virtual void StartExecuteModal( const Link& rEndDialogHdl ); + virtual long GetResult(); + + virtual void SetReloadDocument(const String& rURL); + virtual const String& GetReloadDocument() const; + virtual BOOL ShowPage( USHORT nLevel ); + virtual sal_uInt16 GetRestartPage() const; +}; + +//------------------------------------------------------------------------ +//AbstractDialogFactory_Impl implementations +class SwAbstractDialogFactory_Impl : public SwAbstractDialogFactory +{ + +public: + virtual SfxAbstractDialog* CreateSfxDialog( Window* pParent, //add for SvxMeasureDialog & SvxConnectionDialog + const SfxItemSet& rAttr, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame, + sal_uInt32 nResId + ); + virtual AbstractSwWordCountDialog* CreateSwWordCountDialog(Window* pParent); + virtual AbstractSwInsertAbstractDlg * CreateSwInsertAbstractDlg( Window* pParent,int nResId ); + virtual AbstractSwAsciiFilterDlg* CreateSwAsciiFilterDlg ( Window* pParent, SwDocShell& rDocSh, + SvStream* pStream, int nResId ); //add for SwAsciiFilterDlg + virtual VclAbstractDialog * CreateSwInsertBookmarkDlg( Window *pParent, SwWrtShell &rSh, SfxRequest& rReq, int nResId );//add for SwInsertBookmarkDlg + virtual AbstractSwBreakDlg * CreateSwBreakDlg ( Window *pParent, SwWrtShell &rSh,int nResId ); // add for SwBreakDlg + virtual VclAbstractDialog * CreateSwChangeDBDlg( SwView& rVw, int nResId ); //add for SwChangeDBDlg + virtual SfxAbstractTabDialog * CreateSwCharDlg( Window* pParent, SwView& pVw, const SfxItemSet& rCoreSet, int nResId, // add for SwCharDlg + const String* pFmtStr = 0, BOOL bIsDrwTxtDlg = FALSE); + virtual AbstractSwConvertTableDlg* CreateSwConvertTableDlg ( SwView& rView, int nResId, bool bToTable ); //add for SwConvertTableDlg + virtual VclAbstractDialog * CreateSwCaptionDialog ( Window *pParent, SwView &rV,int nResId); //add for SwCaptionDialog + + virtual AbstractSwInsertDBColAutoPilot* CreateSwInsertDBColAutoPilot( SwView& rView, // add for SwInsertDBColAutoPilot + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> rxSource, + com::sun::star::uno::Reference<com::sun::star::sdbcx::XColumnsSupplier> xColSupp, + const SwDBData& rData, int nResId); + virtual SfxAbstractTabDialog * CreateSwFootNoteOptionDlg( Window *pParent, SwWrtShell &rSh,int nResId);//add for SwFootNoteOptionDlg + + virtual AbstractDropDownFieldDialog * CreateDropDownFieldDialog ( Window *pParent, SwWrtShell &rSh, //add for DropDownFieldDialog + SwField* pField,int nResId, BOOL bNextButton = FALSE ); + virtual SfxAbstractTabDialog* CreateSwEnvDlg ( Window* pParent, const SfxItemSet& rSet, SwWrtShell* pWrtSh, Printer* pPrt, BOOL bInsert,int nResId ); //add for SwEnvDlg + virtual AbstarctSwLabDlg* CreateSwLabDlg ( Window* pParent, const SfxItemSet& rSet, //add for SwLabDlg + SwNewDBMgr* pNewDBMgr, BOOL bLabel,int nResId ); + + virtual SwLabDlgMethod GetSwLabDlgStaticMethod (); //add for SwLabDlg + virtual SfxAbstractTabDialog* CreateSwParaDlg ( Window *pParent, //add for SwParaDlg + SwView& rVw, + const SfxItemSet& rCoreSet, + BYTE nDialogMode, + int nResId, + const String *pCollName = 0, + BOOL bDraw = FALSE, + UINT16 nDefPage = 0); + + virtual AbstarctSwSelGlossaryDlg * CreateSwSelGlossaryDlg ( Window * pParent, const String &rShortName, int nResId ); //add for SwSelGlossaryDlg + virtual VclAbstractDialog * CreateVclAbstractDialog ( Window * pParent, SwWrtShell &rSh, int nResId ); //add for SwTableHeightDlg SwSortDlg + virtual AbstractSplitTableDialog * CreateSplitTblDialog ( Window * pParent, SwWrtShell &rSh ); //add for SwSplitTblDlg + + virtual AbstractSwAutoFormatDlg * CreateSwAutoFormatDlg( Window* pParent, SwWrtShell* pShell, //add for SwAutoFormatDlg + int nResId, + BOOL bSetAutoFmt = TRUE, + const SwTableAutoFmt* pSelFmt = 0 ); + virtual SfxAbstractDialog * CreateSwBorderDlg (Window* pParent, SfxItemSet& rSet, USHORT nType,int nResId );//add for SwBorderDlg + + virtual SfxAbstractDialog * CreateSwWrapDlg ( Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, BOOL bDrawMode, int nResId ); //add for SwWrapDlg + virtual VclAbstractDialog * CreateSwTableWidthDlg ( Window *pParent, SwTableFUNC &rFnc , int nResId ); //add for SwTableWidthDlg + virtual SfxAbstractTabDialog* CreateSwTableTabDlg( Window* pParent, SfxItemPool& Pool, + const SfxItemSet* pItemSet, SwWrtShell* pSh,int nResId ); //add for SwTableTabDlg + virtual AbstractSwFldDlg * CreateSwFldDlg ( SfxBindings* pB, SwChildWinWrapper* pCW, Window *pParent, int nResId ); //add for SwFldDlg + virtual SfxAbstractDialog* CreateSwFldEditDlg ( SwView& rVw, int nResId ); //add for SwFldEditDlg + virtual AbstractSwRenameXNamedDlg * CreateSwRenameXNamedDlg( Window* pParent, //add for SwRenameXNamedDlg + STAR_REFERENCE( container::XNamed ) & xNamed, + STAR_REFERENCE( container::XNameAccess ) & xNameAccess, int nResId ); + virtual AbstractSwModalRedlineAcceptDlg * CreateSwModalRedlineAcceptDlg ( Window *pParent, int nResId ); //add for SwModalRedlineAcceptDlg + + virtual VclAbstractDialog* CreateSwVclDialog( int nResId, + Window* pParent, BOOL& rWithPrev ); //add for SwMergeTblDlg + virtual SfxAbstractTabDialog* CreateFrmTabDialog( int nResId, + SfxViewFrame *pFrame, Window *pParent, + const SfxItemSet& rCoreSet, + BOOL bNewFrm = TRUE, + USHORT nResType = DLG_FRM_STD, + BOOL bFmt = FALSE, + UINT16 nDefPage = 0, + const String* pFmtStr = 0); //add for SwFrmDlg + virtual SfxAbstractTabDialog* CreateTemplateDialog( int nResId, + Window* pParent, + SfxStyleSheetBase& rBase, + USHORT nRegion, + BOOL bColumn = FALSE, + SwWrtShell* pActShell = 0, + BOOL bNew = FALSE ); //add for SwTemplateDlg + virtual AbstractGlossaryDlg* CreateGlossaryDlg( int nResId, + SfxViewFrame* pViewFrame, + SwGlossaryHdl* pGlosHdl, + SwWrtShell *pWrtShell); //add for SwGlossaryDlg + virtual AbstractFldInputDlg* CreateFldInputDlg( int nResId, + Window *pParent, SwWrtShell &rSh, + SwField* pField, BOOL bNextButton = FALSE ); //add for SwFldInputDlg + virtual AbstractInsFootNoteDlg* CreateInsFootNoteDlg( int nResId, + Window * pParent, SwWrtShell &rSh, BOOL bEd = FALSE); //add for SwInsFootNoteDlg + virtual VclAbstractDialog * CreateVclSwViewDialog( int nResId, + SwView& rView, BOOL bCol = FALSE ); //add for SwInsRowColDlg, SwLineNumberingDlg + virtual AbstractInsertGrfRulerDlg* CreateInsertGrfRulerDlg( int nResId, + Window * pParent ); //add for SwInsertGrfRulerDlg + virtual AbstractInsTableDlg* CreateInsTableDlg( int nResId, + SwView& rView ); //add for SwInsTableDlg + virtual AbstractJavaEditDialog* CreateJavaEditDialog( int nResId, + Window* pParent, SwWrtShell* pWrtSh ); //add for SwJavaEditDialog + virtual AbstractMailMergeDlg* CreateMailMergeDlg( int nResId, + Window* pParent, SwWrtShell& rSh, + const String& rSourceName, + const String& rTblName, + sal_Int32 nCommandType, + const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& xConnection, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >* pSelection = 0 ); //add for SwMailMergeDlg + virtual AbstractMailMergeCreateFromDlg* CreateMailMergeCreateFromDlg( int nResId, + Window* pParent ); //add for SwMailMergeCreateFromDlg + virtual AbstractMailMergeFieldConnectionsDlg* CreateMailMergeFieldConnectionsDlg( int nResId, + Window* pParent ); //add for SwMailMergeFieldConnectionsDlg + virtual VclAbstractDialog* CreateMultiTOXMarkDlg( int nResId, + Window* pParent, SwTOXMgr &rTOXMgr ); //add for SwMultiTOXMarkDlg + virtual SfxAbstractTabDialog* CreateSwTabDialog( int nResId, + Window* pParent, + const SfxItemSet* pSwItemSet, + SwWrtShell &); //add for SwSvxNumBulletTabDialog, SwOutlineTabDialog + virtual AbstractMultiTOXTabDialog* CreateMultiTOXTabDialog( int nResId, + Window* pParent, const SfxItemSet& rSet, + SwWrtShell &rShell, + SwTOXBase* pCurTOX, USHORT nToxType = USHRT_MAX, + BOOL bGlobal = FALSE); //add for SwMultiTOXTabDialog + virtual AbstractEditRegionDlg* CreateEditRegionDlg( int nResId, + Window* pParent, SwWrtShell& rWrtSh ); //add for SwEditRegionDlg + virtual AbstractInsertSectionTabDialog* CreateInsertSectionTabDialog( int nResId, + Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh); //add for SwInsertSectionTabDialog + virtual AbstractMarkFloatDlg* CreateIndexMarkFloatDlg( int nResId, + SfxBindings* pBindings, + SfxChildWindow* pChild, + Window *pParent, + SfxChildWinInfo* pInfo, + sal_Bool bNew=sal_True); //add for SwIndexMarkFloatDlg + virtual AbstractMarkFloatDlg* CreateAuthMarkFloatDlg( int nResId, + SfxBindings* pBindings, + SfxChildWindow* pChild, + Window *pParent, + SfxChildWinInfo* pInfo, + sal_Bool bNew=sal_True); //add for SwAuthMarkFloatDlg + virtual VclAbstractDialog * CreateIndexMarkModalDlg( int nResId, + Window *pParent, SwWrtShell& rSh, SwTOXMark* pCurTOXMark ); //add for SwIndexMarkModalDlg + + virtual AbstractMailMergeWizard* CreateMailMergeWizard(SwView& rView, SwMailMergeConfigItem& rConfigItem); + + //add for static func in SwGlossaryDlg + virtual GlossaryGetCurrGroup GetGlossaryCurrGroupFunc( USHORT nId ); + virtual GlossarySetActGroup SetGlossaryActGroupFunc( USHORT nId ); + + // For TabPage + virtual CreateTabPage GetTabPageCreatorFunc( USHORT nId ); + + virtual GetTabPageRanges GetTabPageRangesFunc( USHORT nId ); + +}; + +struct SwDialogsResMgr +{ + static ResMgr* GetResMgr(); +}; + +#endif + + diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx new file mode 100644 index 000000000000..3957a233f5e2 --- /dev/null +++ b/sw/source/ui/dialog/swuiexp.cxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include "swdlgfact.hxx" + +namespace swui +{ + static SwAbstractDialogFactory_Impl* pFactory=NULL; + SwAbstractDialogFactory * GetFactory() + { + if ( !pFactory ) + pFactory = new SwAbstractDialogFactory_Impl; + if ( !pSwResMgr) + SwDialogsResMgr::GetResMgr(); + return pFactory; + } +} + +extern "C" +{ + SAL_DLLPUBLIC_EXPORT SwAbstractDialogFactory* CreateDialogFactory() + { + return ::swui::GetFactory(); + } +} diff --git a/sw/source/ui/dialog/swwrtshitem.cxx b/sw/source/ui/dialog/swwrtshitem.cxx new file mode 100644 index 000000000000..f9015e3a0387 --- /dev/null +++ b/sw/source/ui/dialog/swwrtshitem.cxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#include "swwrtshitem.hxx" +TYPEINIT1(SwWrtShellItem,SfxPoolItem); +SwWrtShellItem::SwWrtShellItem( USHORT _nWhich, SwWrtShell* pSh ) + : SfxPoolItem( _nWhich ), pWrtSh( pSh ) +{ + +} +SwWrtShellItem::SwWrtShellItem( const SwWrtShellItem& rItem) : + SfxPoolItem( rItem.Which() ), + pWrtSh( rItem.pWrtSh ) +{ +} + +int SwWrtShellItem::operator==( const SfxPoolItem& rItem) const +{ + return ((SwWrtShellItem&)rItem).pWrtSh == pWrtSh; +} + +SfxPoolItem* SwWrtShellItem::Clone( SfxItemPool * /*pPool*/ ) const +{ + return new SwWrtShellItem( *this ); +} diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx new file mode 100644 index 000000000000..b4151f6d1462 --- /dev/null +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -0,0 +1,2457 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include <hintids.hxx> +#include <regionsw.hxx> +#include <svl/urihelper.hxx> +#include <svl/PasswordHelper.hxx> +#include <vcl/svapp.hxx> +#include <vcl/msgbox.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> +#include <sfx2/passwd.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/request.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/linkmgr.hxx> +#include <sfx2/docinsert.hxx> +#include <sfx2/filedlghelper.hxx> +#include <editeng/sizeitem.hxx> +#include <svtools/htmlcfg.hxx> + +#include <comphelper/storagehelper.hxx> +#include <uitool.hxx> +#include <IMark.hxx> +#include <section.hxx> +#include <docary.hxx> +#include <doc.hxx> // fuers SwSectionFmt-Array +#include <basesh.hxx> +#include <wdocsh.hxx> +#include <view.hxx> +#include <swmodule.hxx> +#include <wrtsh.hxx> +#include <swundo.hxx> // fuer Undo-Ids +#include <column.hxx> +#include <fmtfsize.hxx> +#include <swunodef.hxx> +#include <shellio.hxx> + +#include <helpid.h> +#include <cmdid.h> +#include <regionsw.hrc> +#include <comcore.hrc> +#include <globals.hrc> +#include <sfx2/bindings.hxx> +#include <svx/htmlmode.hxx> +#include <svx/dlgutil.hxx> +#include <svx/dialogs.hrc> +#include <svx/svxdlg.hxx> +#include <svx/flagsdef.hxx> + +using namespace ::com::sun::star; + + +// sw/inc/docary.hxx +SV_IMPL_PTRARR( SwSectionFmts, SwSectionFmtPtr ) + +#define FILE_NAME_LENGTH 17 + +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()->GetSectionName()); + 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()->GetSectionName()); + 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------------------- + + --------------------------------------------------*/ +class SwTestPasswdDlg : public SfxPasswordDialog +{ +public: + SwTestPasswdDlg(Window* pParent) : + SfxPasswordDialog(pParent) + { + SetHelpId(HID_DLG_PASSWD_SECTION); + } +}; + +/*---------------------------------------------------------------------------- + Beschreibung: User Data Klasse fuer Bereichsinformationen +----------------------------------------------------------------------------*/ + +class SectRepr +{ +private: + SwSectionData m_SectionData; + SwFmtCol m_Col; + SvxBrushItem m_Brush; + SwFmtFtnAtTxtEnd m_FtnNtAtEnd; + SwFmtEndAtTxtEnd m_EndNtAtEnd; + SwFmtNoBalancedColumns m_Balance; + SvxFrameDirectionItem m_FrmDirItem; + SvxLRSpaceItem m_LRSpaceItem; + USHORT m_nArrPos; + // zeigt an, ob evtl. Textinhalt im Bereich ist + bool m_bContent : 1; + // fuer Multiselektion erst markieren, dann mit der TreeListBox arbeiten! + bool m_bSelected : 1; + uno::Sequence<sal_Int8> m_TempPasswd; + +public: + SectRepr(USHORT nPos, SwSection& rSect); + bool operator==(SectRepr& rSectRef) const + { return m_nArrPos == rSectRef.GetArrPos(); } + + bool operator< (SectRepr& rSectRef) const + { return m_nArrPos < rSectRef.GetArrPos(); } + + SwSectionData & GetSectionData() { return m_SectionData; } + SwSectionData const&GetSectionData() const { return m_SectionData; } + SwFmtCol& GetCol() { return m_Col; } + SvxBrushItem& GetBackground() { return m_Brush; } + SwFmtFtnAtTxtEnd& GetFtnNtAtEnd() { return m_FtnNtAtEnd; } + SwFmtEndAtTxtEnd& GetEndNtAtEnd() { return m_EndNtAtEnd; } + SwFmtNoBalancedColumns& GetBalance() { return m_Balance; } + SvxFrameDirectionItem& GetFrmDir() { return m_FrmDirItem; } + SvxLRSpaceItem& GetLRSpace() { return m_LRSpaceItem; } + + USHORT GetArrPos() const { return m_nArrPos; } + String GetFile() const; + String GetSubRegion() const; + void SetFile(String const& rFile); + void SetFilter(String const& rFilter); + void SetSubRegion(String const& rSubRegion); + + bool IsContent() { return m_bContent; } + void SetContent(bool const bValue) { m_bContent = bValue; } + + void SetSelected() { m_bSelected = true; } + bool IsSelected() const { return m_bSelected; } + + uno::Sequence<sal_Int8> & GetTempPasswd() { return m_TempPasswd; } + void SetTempPasswd(const uno::Sequence<sal_Int8> & rPasswd) + { m_TempPasswd = rPasswd; } +}; + + +SV_IMPL_OP_PTRARR_SORT( SectReprArr, SectReprPtr ) + +SectRepr::SectRepr( USHORT nPos, SwSection& rSect ) + : m_SectionData( rSect ) + , m_Brush( RES_BACKGROUND ) + , m_FrmDirItem( FRMDIR_ENVIRONMENT, RES_FRAMEDIR ) + , m_LRSpaceItem( RES_LR_SPACE ) + , m_nArrPos(nPos) + , m_bContent(m_SectionData.GetLinkFileName().Len() == 0) + , m_bSelected(false) +{ + SwSectionFmt *pFmt = rSect.GetFmt(); + if( pFmt ) + { + m_Col = pFmt->GetCol(); + m_Brush = pFmt->GetBackground(); + m_FtnNtAtEnd = pFmt->GetFtnAtTxtEnd(); + m_EndNtAtEnd = pFmt->GetEndAtTxtEnd(); + m_Balance.SetValue(pFmt->GetBalancedColumns().GetValue()); + m_FrmDirItem = pFmt->GetFrmDir(); + m_LRSpaceItem = pFmt->GetLRSpace(); + } +} + +void SectRepr::SetFile( const String& rFile ) +{ + String sNewFile( INetURLObject::decode( rFile, INET_HEX_ESCAPE, + INetURLObject::DECODE_UNAMBIGUOUS, + RTL_TEXTENCODING_UTF8 )); + String sOldFileName( m_SectionData.GetLinkFileName() ); + String sSub( sOldFileName.GetToken( 2, sfx2::cTokenSeperator ) ); + + if( rFile.Len() || sSub.Len() ) + { + sNewFile += sfx2::cTokenSeperator; + if( rFile.Len() ) // Filter nur mit FileName + sNewFile += sOldFileName.GetToken( 1, sfx2::cTokenSeperator ); + + sNewFile += sfx2::cTokenSeperator; + sNewFile += sSub; + } + + m_SectionData.SetLinkFileName( sNewFile ); + + if( rFile.Len() || sSub.Len() ) + { + m_SectionData.SetType( FILE_LINK_SECTION ); + } + else + { + m_SectionData.SetType( CONTENT_SECTION ); + } +} + + +void SectRepr::SetFilter( const String& rFilter ) +{ + String sNewFile; + String sOldFileName( m_SectionData.GetLinkFileName() ); + String sFile( sOldFileName.GetToken( 0, sfx2::cTokenSeperator ) ); + String sSub( sOldFileName.GetToken( 2, sfx2::cTokenSeperator ) ); + + if( sFile.Len() ) + (((( sNewFile = sFile ) += sfx2::cTokenSeperator ) += rFilter ) + += sfx2::cTokenSeperator ) += sSub; + else if( sSub.Len() ) + (( sNewFile = sfx2::cTokenSeperator ) += sfx2::cTokenSeperator ) += sSub; + + m_SectionData.SetLinkFileName( sNewFile ); + + if( sNewFile.Len() ) + { + m_SectionData.SetType( FILE_LINK_SECTION ); + } +} + +void SectRepr::SetSubRegion(const String& rSubRegion) +{ + String sNewFile; + String sOldFileName( m_SectionData.GetLinkFileName() ); + String sFilter( sOldFileName.GetToken( 1, sfx2::cTokenSeperator ) ); + sOldFileName = sOldFileName.GetToken( 0, sfx2::cTokenSeperator ); + + if( rSubRegion.Len() || sOldFileName.Len() ) + (((( sNewFile = sOldFileName ) += sfx2::cTokenSeperator ) += sFilter ) + += sfx2::cTokenSeperator ) += rSubRegion; + + m_SectionData.SetLinkFileName( sNewFile ); + + if( rSubRegion.Len() || sOldFileName.Len() ) + { + m_SectionData.SetType( FILE_LINK_SECTION ); + } + else + { + m_SectionData.SetType( CONTENT_SECTION ); + } +} + + +String SectRepr::GetFile() const +{ + String sLinkFile( m_SectionData.GetLinkFileName() ); + if( sLinkFile.Len() ) + { + if (DDE_LINK_SECTION == m_SectionData.GetType()) + { + USHORT n = sLinkFile.SearchAndReplace( sfx2::cTokenSeperator, ' ' ); + sLinkFile.SearchAndReplace( sfx2::cTokenSeperator, ' ', n ); + } + else + sLinkFile = INetURLObject::decode( sLinkFile.GetToken( 0, + sfx2::cTokenSeperator ), + INET_HEX_ESCAPE, + INetURLObject::DECODE_UNAMBIGUOUS, + RTL_TEXTENCODING_UTF8 ); + } + return sLinkFile; +} + + +String SectRepr::GetSubRegion() const +{ + String sLinkFile( m_SectionData.GetLinkFileName() ); + if( sLinkFile.Len() ) + sLinkFile = sLinkFile.GetToken( 2, sfx2::cTokenSeperator ); + return sLinkFile; +} + + + +/*---------------------------------------------------------------------------- + Beschreibung: Dialog Bearbeiten Bereiche +----------------------------------------------------------------------------*/ + +//--------------------------------------------------------------------- + +SwEditRegionDlg::SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh ) + : SfxModalDialog( pParent, SW_RES(MD_EDIT_REGION) ), + aNameFL ( this, SW_RES( FL_NAME ) ), + aCurName ( this, SW_RES( ED_RANAME ) ), + aTree ( this, SW_RES( TLB_SECTION )), + aLinkFL ( this, SW_RES( FL_LINK ) ), + aFileCB ( this, SW_RES( CB_FILE ) ), + aDDECB ( this, SW_RES( CB_DDE ) ) , + aFileNameFT ( this, SW_RES( FT_FILE ) ) , + aDDECommandFT ( this, SW_RES( FT_DDE ) ) , + aFileNameED ( this, SW_RES( ED_FILE ) ), + 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 ) ), + aPasswdCB ( this, SW_RES( CB_PASSWD ) ), + aPasswdPB ( this, SW_RES( PB_PASSWD ) ), + + aHideFL ( this, SW_RES( FL_HIDE ) ), + aHideCB ( this, SW_RES( CB_HIDE ) ), + aConditionFT ( this, SW_RES( FT_CONDITION ) ), + aConditionED ( this, SW_RES( ED_CONDITION ) ), + + // --> FME 2004-06-22 #114856# edit in readonly sections + aPropertiesFL ( this, SW_RES( FL_PROPERTIES ) ), + aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY ) ), + // <-- + + aOK ( this, SW_RES( PB_OK ) ), + aCancel ( this, SW_RES( PB_CANCEL ) ), + aOptionsPB ( this, SW_RES( PB_OPTIONS ) ), + aDismiss ( this, SW_RES( CB_DISMISS ) ), + aHelp ( this, SW_RES( PB_HELP ) ), + + aImageIL ( SW_RES(IL_BITMAPS)), + aImageILH ( SW_RES(ILH_BITMAPS)), + + rSh( rWrtSh ), + pAktEntry( 0 ), + m_pDocInserter ( NULL ), + m_pOldDefDlgParent ( NULL ), + bDontCheckPasswd ( sal_True) +{ + FreeResource(); + + bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ); + + aTree.SetSelectHdl ( LINK( this, SwEditRegionDlg, GetFirstEntryHdl)); + aTree.SetDeselectHdl ( LINK( this, SwEditRegionDlg, DeselectHdl)); + aCurName.SetModifyHdl ( LINK( this, SwEditRegionDlg, NameEditHdl)); + aConditionED.SetModifyHdl( LINK( this, SwEditRegionDlg, ConditionEditHdl)); + aOK.SetClickHdl ( LINK( this, SwEditRegionDlg, OkHdl)); + aPasswdCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangePasswdHdl)); + aPasswdPB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangePasswdHdl)); + aHideCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeHideHdl)); + // --> FME 2004-06-22 #114856# edit in readonly sections + aEditInReadonlyCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeEditInReadonlyHdl)); + // <-- + + aOptionsPB.Show(); + aOptionsPB.SetClickHdl ( LINK( this, SwEditRegionDlg, OptionsHdl)); + aProtectCB.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeProtectHdl)); + aDismiss.SetClickHdl ( LINK( this, SwEditRegionDlg, ChangeDismissHdl)); + aFileCB.SetClickHdl ( LINK( this, SwEditRegionDlg, UseFileHdl )); + 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 ); + aTree.SetWindowBits(WB_HASBUTTONSATROOT|WB_CLIPCHILDREN|WB_HSCROLL); + aTree.SetSpaceBetweenEntries(0); + + if(bWeb) + { + aConditionFT .Hide(); + aConditionED .Hide(); + aPasswdCB .Hide(); + aHideCB .Hide(); + + aDDECB .Hide(); + aDDECommandFT .Hide(); + } + + aDDECB.SetClickHdl ( LINK( this, SwEditRegionDlg, DDEHdl )); + + //Ermitteln der vorhandenen Bereiche + pCurrSect = rSh.GetCurrSection(); + RecurseList( 0, 0 ); + //falls der Cursor nicht in einem Bereich steht, + //wird immer der erste selektiert + if( !aTree.FirstSelected() && aTree.First() ) + aTree.Select( aTree.First() ); + aTree.Show(); + bDontCheckPasswd = sal_False; +} +/* -----------------------------26.04.01 14:56-------------------------------- + + ---------------------------------------------------------------------------*/ +BOOL SwEditRegionDlg::CheckPasswd(CheckBox* pBox) +{ + if(bDontCheckPasswd) + return TRUE; + sal_Bool bRet = TRUE; + SvLBoxEntry* pEntry = aTree.FirstSelected(); + while( pEntry ) + { + SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData(); + if (!pRepr->GetTempPasswd().getLength() + && pRepr->GetSectionData().GetPassword().getLength()) + { + SwTestPasswdDlg aPasswdDlg(this); + bRet = FALSE; + if (aPasswdDlg.Execute()) + { + String sNewPasswd( aPasswdDlg.GetPassword() ); + UNO_NMSPC::Sequence <sal_Int8 > aNewPasswd; + SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); + if (SvPasswordHelper::CompareHashPassword( + pRepr->GetSectionData().GetPassword(), sNewPasswd)) + { + pRepr->SetTempPasswd(aNewPasswd); + bRet = TRUE; + } + else + { + InfoBox(this, SW_RES(REG_WRONG_PASSWORD)).Execute(); + } + } + } + pEntry = aTree.NextSelected(pEntry); + } + if(!bRet && pBox) + { + //reset old button state + if(pBox->IsTriStateEnabled()) + pBox->SetState(pBox->IsChecked() ? STATE_NOCHECK : STATE_DONTKNOW); + else + pBox->Check(!pBox->IsChecked()); + } + + return bRet; +} +/*--------------------------------------------------------------------- + Beschreibung: Durchsuchen nach Child-Sections, rekursiv +---------------------------------------------------------------------*/ + +void SwEditRegionDlg::RecurseList( const SwSectionFmt* pFmt, SvLBoxEntry* pEntry ) +{ + SwSection* pSect = 0; + SvLBoxEntry* pSelEntry = 0; + + if (!pFmt) + { + USHORT nCount=rSh.GetSectionFmtCount(); + for ( USHORT n=0; n < nCount; n++ ) + { + SectionType eTmpType; + if( !( pFmt = &rSh.GetSectionFmt(n))->GetParent() && + pFmt->IsInNodesArr() && + (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION + && TOX_HEADER_SECTION != eTmpType ) + { + SectRepr* pSectRepr = new SectRepr( n, + *(pSect=pFmt->GetSection()) ); + Image aImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), FALSE); + pEntry = aTree.InsertEntry(pSect->GetSectionName(), aImg, aImg); + Image aHCImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), TRUE); + aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); + aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); + pEntry->SetUserData(pSectRepr); + RecurseList( pFmt, pEntry ); + if (pEntry->HasChilds()) + aTree.Expand(pEntry); + if (pCurrSect==pSect) + aTree.Select(pEntry); + } + } + } + else + { + SwSections aTmpArr; + SvLBoxEntry* pNEntry; + USHORT nCnt = pFmt->GetChildSections(aTmpArr,SORTSECT_POS); + if( nCnt ) + { + for( USHORT n = 0; n < nCnt; ++n ) + { + SectionType eTmpType; + pFmt = aTmpArr[n]->GetFmt(); + if( pFmt->IsInNodesArr() && + (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION + && TOX_HEADER_SECTION != eTmpType ) + { + pSect=aTmpArr[n]; + SectRepr* pSectRepr=new SectRepr( + FindArrPos( pSect->GetFmt() ), *pSect ); + Image aImage = BuildBitmap( pSect->IsProtect(), + pSect->IsHidden(), FALSE); + pNEntry = aTree.InsertEntry( + pSect->GetSectionName(), aImage, aImage, pEntry); + Image aHCImg = BuildBitmap( pSect->IsProtect(),pSect->IsHidden(), TRUE); + aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); + aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); + pNEntry->SetUserData(pSectRepr); + RecurseList( aTmpArr[n]->GetFmt(), pNEntry ); + if( pNEntry->HasChilds()) + aTree.Expand(pNEntry); + if (pCurrSect==pSect) + pSelEntry = pNEntry; + } + } + } + } + if(0 != pSelEntry) + { + aTree.MakeVisible(pSelEntry); + aTree.Select(pSelEntry); + } +} +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +USHORT SwEditRegionDlg::FindArrPos(const SwSectionFmt* pFmt ) +{ + USHORT nCount=rSh.GetSectionFmtCount(); + for (USHORT i=0;i<nCount;i++) + if (pFmt==&rSh.GetSectionFmt(i)) + return i; + + DBG_ERROR( "SectionFormat nicht in der Liste" ); + return USHRT_MAX; +} +/*--------------------------------------------------------------------- + Beschreibung: +---------------------------------------------------------------------*/ + +SwEditRegionDlg::~SwEditRegionDlg( ) +{ + SvLBoxEntry* pEntry = aTree.First(); + while( pEntry ) + { + delete (SectRepr*)pEntry->GetUserData(); + pEntry = aTree.Next( pEntry ); + } + + aSectReprArr.DeleteAndDestroy( 0, aSectReprArr.Count() ); + delete m_pDocInserter; +} +/* -----------------------------09.10.2001 15:41------------------------------ + + ---------------------------------------------------------------------------*/ +void SwEditRegionDlg::SelectSection(const String& rSectionName) +{ + SvLBoxEntry* pEntry = aTree.First(); + while(pEntry) + { + SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData(); + if (pRepr->GetSectionData().GetSectionName() == rSectionName) + break; + pEntry = aTree.Next(pEntry); + } + if(pEntry) + { + aTree.SelectAll( FALSE); + aTree.Select(pEntry); + aTree.MakeVisible(pEntry); + } +} +/*--------------------------------------------------------------------- + Beschreibung: Selektierte Eintrag in der TreeListBox wird im + Edit-Fenster angezeigt + Bei Multiselektion werden einige Controls disabled +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox ) +{ + bDontCheckPasswd = sal_True; + SvLBoxEntry* pEntry=pBox->FirstSelected(); + aHideCB .Enable(TRUE); + // --> FME 2004-06-22 #114856# edit in readonly sections + aEditInReadonlyCB.Enable(TRUE); + // <-- + aProtectCB .Enable(TRUE); + aFileCB .Enable(TRUE); + UNO_NMSPC::Sequence <sal_Int8> aCurPasswd; + if( 1 < pBox->GetSelectionCount() ) + { + aHideCB.EnableTriState( TRUE ); + aProtectCB.EnableTriState( TRUE ); + // --> FME 2004-06-22 #114856# edit in readonly sections + aEditInReadonlyCB.EnableTriState ( TRUE ); + // <-- + aFileCB.EnableTriState( TRUE ); + + bool bHiddenValid = true; + bool bProtectValid = true; + bool bConditionValid = true; + // --> FME 2004-06-22 #114856# edit in readonly sections + bool bEditInReadonlyValid = true; + bool bEditInReadonly = true; + // <-- + bool bHidden = true; + bool bProtect = true; + String sCondition; + BOOL bFirst = TRUE; + BOOL bFileValid = TRUE; + BOOL bFile = TRUE; + BOOL bPasswdValid = TRUE; + + while( pEntry ) + { + SectRepr* pRepr=(SectRepr*) pEntry->GetUserData(); + SwSectionData const& rData( pRepr->GetSectionData() ); + if(bFirst) + { + sCondition = rData.GetCondition(); + bHidden = rData.IsHidden(); + bProtect = rData.IsProtectFlag(); + // --> FME 2004-06-22 #114856# edit in readonly sections + bEditInReadonly = rData.IsEditInReadonlyFlag(); + // <-- + bFile = (rData.GetType() != CONTENT_SECTION); + aCurPasswd = rData.GetPassword(); + } + else + { + String sTemp(rData.GetCondition()); + if(sCondition != sTemp) + bConditionValid = FALSE; + bHiddenValid = (bHidden == rData.IsHidden()); + bProtectValid = (bProtect == rData.IsProtectFlag()); + // --> FME 2004-06-22 #114856# edit in readonly sections + bEditInReadonlyValid = + (bEditInReadonly == rData.IsEditInReadonlyFlag()); + // <-- + bFileValid = (bFile == + (rData.GetType() != CONTENT_SECTION)); + bPasswdValid = (aCurPasswd == rData.GetPassword()); + } + pEntry = pBox->NextSelected(pEntry); + bFirst = FALSE; + } + + aHideCB.SetState( !bHiddenValid ? STATE_DONTKNOW : + bHidden ? STATE_CHECK : STATE_NOCHECK); + aProtectCB.SetState( !bProtectValid ? STATE_DONTKNOW : + bProtect ? STATE_CHECK : STATE_NOCHECK); + // --> FME 2004-06-22 #114856# edit in readonly sections + aEditInReadonlyCB.SetState( !bEditInReadonlyValid ? STATE_DONTKNOW : + bEditInReadonly ? STATE_CHECK : STATE_NOCHECK); + // <-- + aFileCB.SetState(!bFileValid ? STATE_DONTKNOW : + bFile ? STATE_CHECK : STATE_NOCHECK); + + if(bConditionValid) + aConditionED.SetText(sCondition); + else + { +// aConditionED.SetText(aEmptyStr); + aConditionFT.Enable(FALSE); + aConditionED.Enable(FALSE); + } + + aFilePB.Enable(FALSE); + aFileNameFT .Enable(FALSE); + aFileNameED .Enable(FALSE); + aSubRegionFT.Enable(FALSE); + aSubRegionED.Enable(FALSE); +// aNameFT .Enable(FALSE); + aCurName .Enable(FALSE); + aOptionsPB .Enable(FALSE); + aDDECB .Enable(FALSE); + aDDECommandFT .Enable(FALSE); + BOOL bPasswdEnabled = aProtectCB.GetState() == STATE_CHECK; + aPasswdCB.Enable(bPasswdEnabled); + aPasswdPB.Enable(bPasswdEnabled); + if(!bPasswdValid) + { + pEntry = pBox->FirstSelected(); + pBox->SelectAll( FALSE ); + pBox->Select( pEntry ); + GetFirstEntryHdl(pBox); + return 0; + } + else + aPasswdCB.Check(aCurPasswd.getLength() > 0); + } + else if (pEntry ) + { +// aNameFT .Enable(TRUE); + aCurName .Enable(TRUE); + aOptionsPB .Enable(TRUE); + SectRepr* pRepr=(SectRepr*) pEntry->GetUserData(); + SwSectionData const& rData( pRepr->GetSectionData() ); + aConditionED.SetText(rData.GetCondition()); + aHideCB.Enable(); + aHideCB.SetState((rData.IsHidden()) ? STATE_CHECK : STATE_NOCHECK); + BOOL bHide = STATE_CHECK == aHideCB.GetState(); + aConditionED.Enable(bHide); + aConditionFT.Enable(bHide); + aPasswdCB.Check(rData.GetPassword().getLength() > 0); + + aOK.Enable(); + aPasswdCB.Enable(); + aCurName.SetText(pBox->GetEntryText(pEntry)); + aCurName.Enable(); + aDismiss.Enable(); + String aFile = pRepr->GetFile(); + String sSub = pRepr->GetSubRegion(); + bSubRegionsFilled = false; + aSubRegionED.Clear(); + if(aFile.Len()||sSub.Len()) + { + aFileCB.Check(TRUE); + aFileNameED.SetText(aFile); + aSubRegionED.SetText(sSub); + aDDECB.Check(rData.GetType() == DDE_LINK_SECTION); + } + else + { + aFileCB.Check(FALSE); + aFileNameED.SetText(aFile); + aDDECB.Enable(FALSE); + aDDECB.Check(FALSE); + } + UseFileHdl(&aFileCB); + DDEHdl( &aDDECB ); + aProtectCB.SetState((rData.IsProtectFlag()) + ? STATE_CHECK : STATE_NOCHECK); + aProtectCB.Enable(); + + // --> FME 2004-06-22 #114856# edit in readonly sections + aEditInReadonlyCB.SetState((rData.IsEditInReadonlyFlag()) + ? STATE_CHECK : STATE_NOCHECK); + aEditInReadonlyCB.Enable(); + // <-- + + BOOL bPasswdEnabled = aProtectCB.IsChecked(); + aPasswdCB.Enable(bPasswdEnabled); + aPasswdPB.Enable(bPasswdEnabled); + } + bDontCheckPasswd = sal_False; + return 0; +} +/*-----------------28.06.97 09:19------------------- + +--------------------------------------------------*/ +IMPL_LINK( SwEditRegionDlg, DeselectHdl, SvTreeListBox *, pBox ) +{ + if( !pBox->GetSelectionCount() ) + { + aHideCB .Enable(FALSE); + aProtectCB .Enable(FALSE); + // --> FME 2004-06-22 #114856# edit in readonly sections + aEditInReadonlyCB.Enable(FALSE); + // <-- + aPasswdCB .Enable(FALSE); + aPasswdCB .Enable(FALSE); + aConditionFT .Enable(FALSE); + aConditionED.Enable(FALSE); + aFileCB .Enable(FALSE); + aFilePB .Enable(FALSE); + aFileNameFT .Enable(FALSE); + aFileNameED .Enable(FALSE); + aSubRegionFT .Enable(FALSE); + aSubRegionED .Enable(FALSE); +// aNameFT .Enable(FALSE); + aCurName .Enable(FALSE); + aDDECB .Enable(FALSE); + aDDECommandFT .Enable(FALSE); + + UseFileHdl(&aFileCB); + DDEHdl( &aDDECB ); + } + return 0; +} + +/*--------------------------------------------------------------------- + Beschreibung: Im OkHdl werden die veraenderten Einstellungen + uebernommen und aufgehobene Bereiche geloescht +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, OkHdl, CheckBox *, EMPTYARG ) +{ + // JP 13.03.96: + // temp. Array weil sich waehrend des aendern eines Bereiches die + // Position innerhalb des "Core-Arrays" verschieben kann: + // - bei gelinkten Bereichen, wenn sie weitere SubBereiche haben oder + // neu erhalten. + // JP 30.05.97: StartUndo darf natuerlich auch erst nach dem Kopieren + // der Formate erfolgen (ClearRedo!) + + const SwSectionFmts& rDocFmts = rSh.GetDoc()->GetSections(); + SwSectionFmts aOrigArray( 0, 5 ); + aOrigArray.Insert( &rDocFmts, 0 ); + + rSh.StartAllAction(); + rSh.StartUndo(); + rSh.ResetSelect( 0,FALSE ); + SvLBoxEntry* pEntry = aTree.First(); + + while( pEntry ) + { + SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); + SwSectionFmt* pFmt = aOrigArray[ pRepr->GetArrPos() ]; + if (!pRepr->GetSectionData().IsProtectFlag()) + { + pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >()); + } + USHORT nNewPos = rDocFmts.GetPos( pFmt ); + if( USHRT_MAX != nNewPos ) + { + SfxItemSet* pSet = pFmt->GetAttrSet().Clone( FALSE ); + if( pFmt->GetCol() != pRepr->GetCol() ) + pSet->Put( pRepr->GetCol() ); + + if( pFmt->GetBackground(FALSE) != pRepr->GetBackground() ) + pSet->Put( pRepr->GetBackground() ); + + if( pFmt->GetFtnAtTxtEnd(FALSE) != pRepr->GetFtnNtAtEnd() ) + pSet->Put( pRepr->GetFtnNtAtEnd() ); + + if( pFmt->GetEndAtTxtEnd(FALSE) != pRepr->GetEndNtAtEnd() ) + pSet->Put( pRepr->GetEndNtAtEnd() ); + + if( pFmt->GetBalancedColumns() != pRepr->GetBalance() ) + pSet->Put( pRepr->GetBalance() ); + + if( pFmt->GetFrmDir() != pRepr->GetFrmDir() ) + pSet->Put( pRepr->GetFrmDir() ); + + if( pFmt->GetLRSpace() != pRepr->GetLRSpace()) + pSet->Put( pRepr->GetLRSpace()); + + rSh.UpdateSection( nNewPos, pRepr->GetSectionData(), + pSet->Count() ? pSet : 0 ); + delete pSet; + } + pEntry = aTree.Next( pEntry ); + } + + for(USHORT i = aSectReprArr.Count(); i; ) + { + SwSectionFmt* pFmt = aOrigArray[ aSectReprArr[ --i ]->GetArrPos() ]; + USHORT nNewPos = rDocFmts.GetPos( pFmt ); + if( USHRT_MAX != nNewPos ) + rSh.DelSectionFmt( nNewPos ); + } +// rSh.ChgSectionPasswd(aNewPasswd); + + aOrigArray.Remove( 0, aOrigArray.Count() ); + + //JP 21.05.97: EndDialog muss vor Ende der EndAction gerufen werden, + // sonst kann es ScrollFehler geben. + EndDialog(RET_OK); + + rSh.EndUndo(); + rSh.EndAllAction(); + + return 0; +} +/*--------------------------------------------------------------------- + Beschreibung: Toggle protect +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, ChangeProtectHdl, TriStateBox *, pBox ) +{ + if(!CheckPasswd(pBox)) + return 0; + pBox->EnableTriState( FALSE ); + SvLBoxEntry* pEntry=aTree.FirstSelected(); + DBG_ASSERT(pEntry,"kein Entry gefunden"); + BOOL bCheck = STATE_CHECK == pBox->GetState(); + while( pEntry ) + { + SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); + pRepr->GetSectionData().SetProtectFlag(bCheck); + Image aImage = BuildBitmap( bCheck, + STATE_CHECK == aHideCB.GetState(), FALSE); + aTree.SetExpandedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL); + aTree.SetCollapsedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL); + Image aHCImg = BuildBitmap( bCheck, STATE_CHECK == aHideCB.GetState(), TRUE); + aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); + aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); + pEntry = aTree.NextSelected(pEntry); + } + aPasswdCB.Enable(bCheck); + aPasswdPB.Enable(bCheck); + return 0; +} +/*--------------------------------------------------------------------- + Beschreibung: Toggle hide +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, ChangeHideHdl, TriStateBox *, pBox ) +{ + if(!CheckPasswd(pBox)) + return 0; + pBox->EnableTriState( FALSE ); + SvLBoxEntry* pEntry=aTree.FirstSelected(); + DBG_ASSERT(pEntry,"kein Entry gefunden"); + while( pEntry ) + { + SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); + pRepr->GetSectionData().SetHidden(STATE_CHECK == pBox->GetState()); + Image aImage = BuildBitmap(STATE_CHECK == aProtectCB.GetState(), + STATE_CHECK == pBox->GetState(), FALSE); + aTree.SetExpandedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL); + aTree.SetCollapsedEntryBmp(pEntry, aImage, BMP_COLOR_NORMAL); + Image aHCImg = BuildBitmap( STATE_CHECK == aProtectCB.GetState(), + STATE_CHECK == pBox->GetState(), TRUE); + aTree.SetExpandedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); + aTree.SetCollapsedEntryBmp(pEntry, aHCImg, BMP_COLOR_HIGHCONTRAST); + + pEntry = aTree.NextSelected(pEntry); + } + + BOOL bHide = STATE_CHECK == pBox->GetState(); + aConditionED.Enable(bHide); + aConditionFT.Enable(bHide); + return 0; +} + +/*--------------------------------------------------------------------- + Beschreibung: Toggle edit in readonly +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, ChangeEditInReadonlyHdl, TriStateBox *, pBox ) +{ + if(!CheckPasswd(pBox)) + return 0; + pBox->EnableTriState( FALSE ); + SvLBoxEntry* pEntry=aTree.FirstSelected(); + DBG_ASSERT(pEntry,"kein Entry gefunden"); + while( pEntry ) + { + SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); + pRepr->GetSectionData().SetEditInReadonlyFlag( + STATE_CHECK == pBox->GetState()); + pEntry = aTree.NextSelected(pEntry); + } + + return 0; +} + +/*--------------------------------------------------------------------- + Beschreibung: selektierten Bereich aufheben +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, ChangeDismissHdl, CheckBox *, EMPTYARG ) +{ + if(!CheckPasswd()) + return 0; + SvLBoxEntry* pEntry = aTree.FirstSelected(); + SvLBoxEntry* pChild; + SvLBoxEntry* pParent; + //zuerst alle selektierten markieren + while(pEntry) + { + const SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); + pSectRepr->SetSelected(); + pEntry = aTree.NextSelected(pEntry); + } + pEntry = aTree.FirstSelected(); + // dann loeschen + while(pEntry) + { + const SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); + SvLBoxEntry* pRemove = 0; + BOOL bRestart = FALSE; + if(pSectRepr->IsSelected()) + { + aSectReprArr.Insert( pSectRepr ); + while( (pChild = aTree.FirstChild(pEntry) )!= 0 ) + { + //durch das Umhaengen muss wieder am Anfang aufgesetzt werden + bRestart = TRUE; + pParent=aTree.GetParent(pEntry); + aTree.GetModel()->Move(pChild, pParent, aTree.GetModel()->GetRelPos(pEntry)); + } + pRemove = pEntry; + } + if(bRestart) + pEntry = aTree.First(); + else + pEntry = aTree.Next(pEntry); + if(pRemove) + aTree.GetModel()->Remove( pRemove ); + } + + if ( (pEntry=aTree.FirstSelected()) == 0 ) + { + aConditionFT. Enable(FALSE); + aConditionED. Enable(FALSE); + aDismiss. Enable(FALSE); + aCurName. Enable(FALSE); + aProtectCB. Enable(FALSE); + aPasswdCB. Enable(FALSE); + aHideCB. Enable(FALSE); + // --> FME 2004-06-22 #114856# edit in readonly sections + aEditInReadonlyCB.Enable(FALSE); + aEditInReadonlyCB.SetState(STATE_NOCHECK); + // <-- + aProtectCB. SetState(STATE_NOCHECK); + aPasswdCB. Check(FALSE); + aHideCB. SetState(STATE_NOCHECK); + aFileCB. Check(FALSE); + //sonst liegt der Focus auf dem HelpButton + aOK.GrabFocus(); + UseFileHdl(&aFileCB); + } + return 0; +} +/*--------------------------------------------------------------------- + Beschreibung: CheckBox mit Datei verknuepfen? +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, UseFileHdl, CheckBox *, pBox ) +{ + if(!CheckPasswd(pBox)) + return 0; + SvLBoxEntry* pEntry = aTree.FirstSelected(); + pBox->EnableTriState(FALSE); + BOOL bMulti = 1 < aTree.GetSelectionCount(); + BOOL bFile = pBox->IsChecked(); + if(pEntry) + { + while(pEntry) + { + const SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); + BOOL bContent = pSectRepr->IsContent(); + if( pBox->IsChecked() && bContent && rSh.HasSelection() ) + { + if( RET_NO == QueryBox( this, SW_RES(QB_CONNECT) ).Execute() ) + pBox->Check( FALSE ); + } + if( bFile ) + pSectRepr->SetContent(FALSE); + else + { + pSectRepr->SetFile(aEmptyStr); + pSectRepr->SetSubRegion(aEmptyStr); + pSectRepr->GetSectionData().SetLinkFilePassword(aEmptyStr); + } + + pEntry = aTree.NextSelected(pEntry); + } + aFileNameFT.Enable(bFile && ! bMulti); + aFileNameED.Enable(bFile && ! bMulti); + aFilePB.Enable(bFile && ! bMulti); + aSubRegionED.Enable(bFile && ! bMulti); + aSubRegionFT.Enable(bFile && ! bMulti); + aDDECommandFT.Enable(bFile && ! bMulti); + aDDECB.Enable(bFile && ! bMulti); + if( bFile ) + { + aProtectCB.SetState(STATE_CHECK); + aFileNameED.GrabFocus(); + + } + else + { + aDDECB.Check(FALSE); + DDEHdl(&aDDECB); +// aFileNameED.SetText(aEmptyStr); + aSubRegionED.SetText(aEmptyStr); + } + } + else + { + pBox->Check(FALSE); + pBox->Enable(FALSE); + aFilePB.Enable(FALSE); + aFileNameED.Enable(FALSE); + aFileNameFT.Enable(FALSE); + aSubRegionED.Enable(FALSE); + aSubRegionFT.Enable(FALSE); + aDDECB.Check(FALSE); + aDDECB.Enable(FALSE); + aDDECommandFT.Enable(FALSE); + } + return 0; +} + +/*--------------------------------------------------------------------- + Beschreibung: Dialog Datei einfuegen rufen +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, FileSearchHdl, PushButton *, EMPTYARG ) +{ + if(!CheckPasswd(0)) + return 0; + + m_pOldDefDlgParent = Application::GetDefDialogParent(); + Application::SetDefDialogParent( this ); + if ( m_pDocInserter ) + delete m_pDocInserter; + m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") ); + m_pDocInserter->StartExecuteModal( LINK( this, SwEditRegionDlg, DlgClosedHdl ) ); + return 0; +} + +/*--------------------------------------------------------------------- + Beschreibung: +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, OptionsHdl, PushButton *, EMPTYARG ) +{ + if(!CheckPasswd()) + return 0; + SvLBoxEntry* pEntry = aTree.FirstSelected(); + + if(pEntry) + { + SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); + SfxItemSet aSet(rSh.GetView().GetPool(), + RES_COL, RES_COL, + RES_COLUMNBALANCE, RES_FRAMEDIR, + RES_BACKGROUND, RES_BACKGROUND, + RES_FRM_SIZE, RES_FRM_SIZE, + SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE, + RES_LR_SPACE, RES_LR_SPACE, + RES_FTN_AT_TXTEND, RES_END_AT_TXTEND, + 0); + + aSet.Put( pSectRepr->GetCol() ); + aSet.Put( pSectRepr->GetBackground() ); + aSet.Put( pSectRepr->GetFtnNtAtEnd() ); + aSet.Put( pSectRepr->GetEndNtAtEnd() ); + aSet.Put( pSectRepr->GetBalance() ); + aSet.Put( pSectRepr->GetFrmDir() ); + aSet.Put( pSectRepr->GetLRSpace() ); + + const SwSectionFmts& rDocFmts = rSh.GetDoc()->GetSections(); + SwSectionFmts aOrigArray( 0, 5 ); + aOrigArray.Insert( &rDocFmts, 0 ); + + SwSectionFmt* pFmt = aOrigArray[pSectRepr->GetArrPos()]; + long nWidth = rSh.GetSectionWidth(*pFmt); + aOrigArray.Remove( 0, aOrigArray.Count() ); + if (!nWidth) + nWidth = USHRT_MAX; + + aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth)); + aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth))); + + SwSectionPropertyTabDialog aTabDlg(this, aSet, rSh); + if(RET_OK == aTabDlg.Execute()) + { + const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet(); + if( pOutSet && pOutSet->Count() ) + { + const SfxPoolItem *pColItem, *pBrushItem, + *pFtnItem, *pEndItem, *pBalanceItem, + *pFrmDirItem, *pLRSpaceItem; + SfxItemState eColState = pOutSet->GetItemState( + RES_COL, FALSE, &pColItem ); + SfxItemState eBrushState = pOutSet->GetItemState( + RES_BACKGROUND, FALSE, &pBrushItem ); + SfxItemState eFtnState = pOutSet->GetItemState( + RES_FTN_AT_TXTEND, FALSE, &pFtnItem ); + SfxItemState eEndState = pOutSet->GetItemState( + RES_END_AT_TXTEND, FALSE, &pEndItem ); + SfxItemState eBalanceState = pOutSet->GetItemState( + RES_COLUMNBALANCE, FALSE, &pBalanceItem ); + SfxItemState eFrmDirState = pOutSet->GetItemState( + RES_FRAMEDIR, FALSE, &pFrmDirItem ); + SfxItemState eLRState = pOutSet->GetItemState( + RES_LR_SPACE, FALSE, &pLRSpaceItem); + + if( SFX_ITEM_SET == eColState || + SFX_ITEM_SET == eBrushState || + SFX_ITEM_SET == eFtnState || + SFX_ITEM_SET == eEndState || + SFX_ITEM_SET == eBalanceState|| + SFX_ITEM_SET == eFrmDirState|| + SFX_ITEM_SET == eLRState) + { + SvLBoxEntry* pSelEntry = aTree.FirstSelected(); + while( pSelEntry ) + { + SectReprPtr pRepr = (SectReprPtr)pSelEntry->GetUserData(); + if( SFX_ITEM_SET == eColState ) + pRepr->GetCol() = *(SwFmtCol*)pColItem; + if( SFX_ITEM_SET == eBrushState ) + pRepr->GetBackground() = *(SvxBrushItem*)pBrushItem; + if( SFX_ITEM_SET == eFtnState ) + pRepr->GetFtnNtAtEnd() = *(SwFmtFtnAtTxtEnd*)pFtnItem; + if( SFX_ITEM_SET == eEndState ) + pRepr->GetEndNtAtEnd() = *(SwFmtEndAtTxtEnd*)pEndItem; + if( SFX_ITEM_SET == eBalanceState ) + pRepr->GetBalance().SetValue(((SwFmtNoBalancedColumns*)pBalanceItem)->GetValue()); + if( SFX_ITEM_SET == eFrmDirState ) + pRepr->GetFrmDir().SetValue(((SvxFrameDirectionItem*)pFrmDirItem)->GetValue()); + if( SFX_ITEM_SET == eLRState ) + pRepr->GetLRSpace() = *(SvxLRSpaceItem*)pLRSpaceItem; + + pSelEntry = aTree.NextSelected(pSelEntry); + } + } + } + } + } + + return 0; +} + +/*--------------------------------------------------------------------- + Beschreibung: Uebernahme des Dateinamen oder + des verknuepften Bereichs +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, FileNameHdl, Edit *, pEdit ) +{ + Selection aSelect = pEdit->GetSelection(); + if(!CheckPasswd()) + return 0; + pEdit->SetSelection(aSelect); + SvLBoxEntry* pEntry=aTree.FirstSelected(); + DBG_ASSERT(pEntry,"kein Entry gefunden"); + SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); + if(pEdit == &aFileNameED) + { + bSubRegionsFilled = false; + aSubRegionED.Clear(); + if( aDDECB.IsChecked() ) + { + String sLink( pEdit->GetText() ); + USHORT nPos = 0; + while( STRING_NOTFOUND != (nPos = sLink.SearchAscii( " ", nPos )) ) + sLink.Erase( nPos--, 1 ); + + nPos = sLink.SearchAndReplace( ' ', sfx2::cTokenSeperator ); + sLink.SearchAndReplace( ' ', sfx2::cTokenSeperator, nPos ); + + pSectRepr->GetSectionData().SetLinkFileName( sLink ); + pSectRepr->GetSectionData().SetType( DDE_LINK_SECTION ); + } + else + { + String sTmp(pEdit->GetText()); + if(sTmp.Len()) + { + SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium(); + INetURLObject aAbs; + if( pMedium ) + aAbs = pMedium->GetURLObject(); + sTmp = URIHelper::SmartRel2Abs( + aAbs, sTmp, URIHelper::GetMaybeFileHdl() ); + } + pSectRepr->SetFile( sTmp ); + pSectRepr->GetSectionData().SetLinkFilePassword( aEmptyStr ); + } + } + else + { + pSectRepr->SetSubRegion( pEdit->GetText() ); + } + return 0; +} +/*--------------------------------------------------------------------- + Beschreibung: +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, DDEHdl, CheckBox*, pBox ) +{ + if(!CheckPasswd(pBox)) + return 0; + SvLBoxEntry* pEntry=aTree.FirstSelected(); + if(pEntry) + { + BOOL bFile = aFileCB.IsChecked(); + SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); + SwSectionData & rData( pSectRepr->GetSectionData() ); + BOOL bDDE = pBox->IsChecked(); + if(bDDE) + { + aFileNameFT.Hide(); + aDDECommandFT.Enable(); + aDDECommandFT.Show(); + aSubRegionFT.Hide(); + aSubRegionED.Hide(); + if (FILE_LINK_SECTION == rData.GetType()) + { + pSectRepr->SetFile(aEmptyStr); + aFileNameED.SetText(aEmptyStr); + rData.SetLinkFilePassword( aEmptyStr ); + } + rData.SetType(DDE_LINK_SECTION); + } + else + { + aDDECommandFT.Hide(); + aFileNameFT.Enable(bFile); + aFileNameFT.Show(); + aSubRegionED.Show(); + aSubRegionFT.Show(); + aSubRegionED.Enable(bFile); + aSubRegionFT.Enable(bFile); + aSubRegionED.Enable(bFile); + if (DDE_LINK_SECTION == rData.GetType()) + { + rData.SetType(FILE_LINK_SECTION); + pSectRepr->SetFile(aEmptyStr); + rData.SetLinkFilePassword( aEmptyStr ); + aFileNameED.SetText(aEmptyStr); + } + } + aFilePB.Enable(bFile && !bDDE); + } + return 0; +} +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox ) +{ + sal_Bool bChange = pBox == &aPasswdPB; + if(!CheckPasswd(0)) + { + if(!bChange) + aPasswdCB.Check(!aPasswdCB.IsChecked()); + return 0; + } + SvLBoxEntry* pEntry=aTree.FirstSelected(); + sal_Bool bSet = bChange ? bChange : aPasswdCB.IsChecked(); + DBG_ASSERT(pEntry,"kein Entry gefunden"); + while( pEntry ) + { + SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData(); + if(bSet) + { + if(!pRepr->GetTempPasswd().getLength() || bChange) + { + SwTestPasswdDlg aPasswdDlg(this); + aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); + if(RET_OK == aPasswdDlg.Execute()) + { + String sNewPasswd( aPasswdDlg.GetPassword() ); + if( aPasswdDlg.GetConfirm() == sNewPasswd ) + { + SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd ); + } + else + { + InfoBox(pBox, SW_RES(REG_WRONG_PASSWD_REPEAT)).Execute(); + ChangePasswdHdl(pBox); + break; + } + } + else + { + if(!bChange) + aPasswdCB.Check(FALSE); + break; + } + } + pRepr->GetSectionData().SetPassword(pRepr->GetTempPasswd()); + } + else + { + pRepr->GetSectionData().SetPassword(uno::Sequence<sal_Int8 >()); + } + pEntry = aTree.NextSelected(pEntry); + } + return 0; +} +/*--------------------------------------------------------------------- + Beschreibung: Aktueller Bereichsname wird sofort beim editieren + in die TreeListBox eingetragen, mit leerem String + kein Ok() +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, NameEditHdl, Edit *, EMPTYARG ) +{ + if(!CheckPasswd(0)) + return 0; + SvLBoxEntry* pEntry=aTree.FirstSelected(); + DBG_ASSERT(pEntry,"kein Entry gefunden"); + if (pEntry) + { + String aName = aCurName.GetText(); + aTree.SetEntryText(pEntry,aName); + SectReprPtr pRepr = (SectReprPtr) pEntry->GetUserData(); + pRepr->GetSectionData().SetSectionName(aName); + + aOK.Enable(aName.Len() != 0); + } + return 0; +} +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +IMPL_LINK( SwEditRegionDlg, ConditionEditHdl, Edit *, pEdit ) +{ + Selection aSelect = pEdit->GetSelection(); + if(!CheckPasswd(0)) + return 0; + pEdit->SetSelection(aSelect); + SvLBoxEntry* pEntry = aTree.FirstSelected(); + DBG_ASSERT(pEntry,"kein Entry gefunden"); + while( pEntry ) + { + SectReprPtr pRepr = (SectReprPtr)pEntry->GetUserData(); + pRepr->GetSectionData().SetCondition(pEdit->GetText()); + pEntry = aTree.NextSelected(pEntry); + } + return 0; +} + +IMPL_LINK( SwEditRegionDlg, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg ) +{ + String sFileName, sFilterName, sPassword; + if ( _pFileDlg->GetError() == ERRCODE_NONE ) + { + SfxMedium* pMedium = m_pDocInserter->CreateMedium(); + if ( pMedium ) + { + sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); + sFilterName = pMedium->GetFilter()->GetFilterName(); + const SfxPoolItem* pItem; + if ( SFX_ITEM_SET == pMedium->GetItemSet()->GetItemState( SID_PASSWORD, FALSE, &pItem ) ) + sPassword = ( (SfxStringItem*)pItem )->GetValue(); + ::lcl_ReadSections( *pMedium, aSubRegionED ); + delete pMedium; + } + } + + SvLBoxEntry* pEntry = aTree.FirstSelected(); + DBG_ASSERT( pEntry, "no entry found" ); + if ( pEntry ) + { + SectReprPtr pSectRepr = (SectRepr*)pEntry->GetUserData(); + pSectRepr->SetFile( sFileName ); + pSectRepr->SetFilter( sFilterName ); + pSectRepr->GetSectionData().SetLinkFilePassword(sPassword); + aFileNameED.SetText( pSectRepr->GetFile() ); + } + + 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------------------------------ + + ---------------------------------------------------------------------------*/ +Image SwEditRegionDlg::BuildBitmap(BOOL bProtect,BOOL bHidden, BOOL bHighContrast) +{ + ImageList& rImgLst = bHighContrast ? aImageILH : aImageIL; + return rImgLst.GetImage((!bHidden+(bProtect<<1)) + 1); +} + +/*-------------------------------------------------------------------- + Beschreibung: Hilfsfunktion - Bereichsnamen aus dem Medium lesen + --------------------------------------------------------------------*/ + +static void lcl_ReadSections( SfxMedium& rMedium, ComboBox& rBox ) +{ + rBox.Clear(); + uno::Reference < embed::XStorage > xStg; + if( rMedium.IsStorage() && (xStg = rMedium.GetStorage()).is() ) + { + SvStrings aArr( 10, 10 ); + sal_uInt32 nFormat = SotStorage::GetFormatID( xStg ); + if ( nFormat == SOT_FORMATSTR_ID_STARWRITER_60 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_60 || + nFormat == SOT_FORMATSTR_ID_STARWRITER_8 || nFormat == SOT_FORMATSTR_ID_STARWRITERGLOB_8) + SwGetReaderXML()->GetSectionList( rMedium, aArr ); + + for( USHORT n = 0; n < aArr.Count(); ++n ) + rBox.InsertEntry( *aArr[ n ] ); + + aArr.DeleteAndDestroy(0, aArr.Count()); + } +} +/* -----------------21.05.99 10:16------------------- + * + * --------------------------------------------------*/ +SwInsertSectionTabDialog::SwInsertSectionTabDialog( + Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) : + SfxTabDialog( pParent, SW_RES(DLG_INSERT_SECTION), &rSet ), + rWrtSh(rSh) + , m_pSectionData(0) +{ + String sInsert(SW_RES(ST_INSERT)); + GetOKButton().SetText(sInsert); + FreeResource(); + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + AddTabPage(TP_INSERT_SECTION, SwInsertSectionTabPage::Create, 0); + AddTabPage(TP_COLUMN, SwColumnPage::Create, 0); + AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0); + AddTabPage(TP_SECTION_FTNENDNOTES, SwSectionFtnEndTabPage::Create, 0); + AddTabPage(TP_SECTION_INDENTS, SwSectionIndentTabPage::Create, 0); + + SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); + long nHtmlMode = pHtmlOpt->GetExportMode(); + + BOOL bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ); + if(bWeb) + { + RemoveTabPage(TP_SECTION_FTNENDNOTES); + RemoveTabPage(TP_SECTION_INDENTS); + if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode) + RemoveTabPage(TP_COLUMN); + } + SetCurPageId(TP_INSERT_SECTION); +} +/* -----------------21.05.99 10:17------------------- + * + * --------------------------------------------------*/ +SwInsertSectionTabDialog::~SwInsertSectionTabDialog() +{ +} +/* -----------------21.05.99 10:23------------------- + * + * --------------------------------------------------*/ +void SwInsertSectionTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage ) +{ + if(TP_INSERT_SECTION == nId) + ((SwInsertSectionTabPage&)rPage).SetWrtShell(rWrtSh); + else if( TP_BACKGROUND == nId ) + { + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); + rPage.PageCreated(aSet); + } + else if( TP_COLUMN == nId ) + { + const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)GetInputSetImpl()->Get(RES_FRM_SIZE); + ((SwColumnPage&)rPage).SetPageWidth(rSize.GetWidth()); + ((SwColumnPage&)rPage).ShowBalance(TRUE); + ((SwColumnPage&)rPage).SetInSection(TRUE); + } + else if(TP_SECTION_INDENTS == nId) + ((SwSectionIndentTabPage&)rPage).SetWrtShell(rWrtSh); +} +/* -----------------21.05.99 13:08------------------- + * + * --------------------------------------------------*/ + +void SwInsertSectionTabDialog::SetSectionData(SwSectionData const& rSect) +{ + m_pSectionData.reset( new SwSectionData(rSect) ); +} +/* -----------------21.05.99 13:10------------------- + * + * --------------------------------------------------*/ +short SwInsertSectionTabDialog::Ok() +{ + short nRet = SfxTabDialog::Ok(); + DBG_ASSERT(m_pSectionData.get(), + "SwInsertSectionTabDialog: no SectionData?"); + const SfxItemSet* pOutputItemSet = GetOutputItemSet(); + rWrtSh.InsertSection(*m_pSectionData, pOutputItemSet); + SfxViewFrame* pViewFrm = rWrtSh.GetView().GetViewFrame(); + uno::Reference< frame::XDispatchRecorder > xRecorder = + pViewFrm->GetBindings().GetRecorder(); + if ( xRecorder.is() ) + { + SfxRequest aRequest( pViewFrm, FN_INSERT_REGION); + const SfxPoolItem* pCol; + if(SFX_ITEM_SET == pOutputItemSet->GetItemState(RES_COL, FALSE, &pCol)) + { + aRequest.AppendItem(SfxUInt16Item(SID_ATTR_COLUMNS, + ((const SwFmtCol*)pCol)->GetColumns().Count())); + } + aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_NAME, + m_pSectionData->GetSectionName())); + aRequest.AppendItem(SfxStringItem( FN_PARAM_REGION_CONDITION, + m_pSectionData->GetCondition())); + aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_HIDDEN, + m_pSectionData->IsHidden())); + aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_PROTECT, + m_pSectionData->IsProtectFlag())); + // --> FME 2004-06-22 #114856# edit in readonly sections + aRequest.AppendItem(SfxBoolItem( FN_PARAM_REGION_EDIT_IN_READONLY, + m_pSectionData->IsEditInReadonlyFlag())); + // <-- + + String sLinkFileName( m_pSectionData->GetLinkFileName() ); + aRequest.AppendItem(SfxStringItem( FN_PARAM_1, sLinkFileName.GetToken( 0, sfx2::cTokenSeperator ))); + aRequest.AppendItem(SfxStringItem( FN_PARAM_2, sLinkFileName.GetToken( 1, sfx2::cTokenSeperator ))); + aRequest.AppendItem(SfxStringItem( FN_PARAM_3, sLinkFileName.GetToken( 2, sfx2::cTokenSeperator ))); + aRequest.Done(); + } + return nRet; +} + +/* -----------------21.05.99 10:31------------------- + * + * --------------------------------------------------*/ +SwInsertSectionTabPage::SwInsertSectionTabPage( + Window *pParent, const SfxItemSet &rAttrSet) : + SfxTabPage( pParent, SW_RES(TP_INSERT_SECTION), rAttrSet ), + aNameFL ( this, SW_RES( FL_NAME ) ), + aCurName ( this, SW_RES( ED_RNAME ) ), + aLinkFL ( this, SW_RES( FL_LINK ) ), + aFileCB ( this, SW_RES( CB_FILE ) ), + aDDECB ( this, SW_RES( CB_DDE ) ) , + aDDECommandFT ( this, SW_RES( FT_DDE ) ) , + aFileNameFT ( this, SW_RES( FT_FILE ) ) , + aFileNameED ( this, SW_RES( ED_FILE ) ), + aFilePB ( this, SW_RES( PB_FILE ) ), + aSubRegionFT ( this, SW_RES( FT_SUBREG ) ) , + aSubRegionED ( this, SW_RES( LB_SUBREG ) ) , + + aProtectFL ( this, SW_RES( FL_PROTECT ) ), + aProtectCB ( this, SW_RES( CB_PROTECT ) ), + aPasswdCB ( this, SW_RES( CB_PASSWD ) ), + aPasswdPB ( this, SW_RES( PB_PASSWD ) ), + + aHideFL ( this, SW_RES( FL_HIDE ) ), + aHideCB ( this, SW_RES( CB_HIDE ) ), + aConditionFT ( this, SW_RES( FT_CONDITION ) ), + aConditionED ( this, SW_RES( ED_CONDITION ) ), + // --> FME 2004-06-22 #114856# edit in readonly sections + aPropertiesFL ( this, SW_RES( FL_PROPERTIES ) ), + aEditInReadonlyCB ( this, SW_RES( CB_EDIT_IN_READONLY ) ), + // <-- + + m_pWrtSh(0), + m_pDocInserter(NULL), + m_pOldDefDlgParent(NULL) +{ + FreeResource(); + + aProtectCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangeProtectHdl)); + aPasswdCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangePasswdHdl)); + aPasswdPB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangePasswdHdl)); + aHideCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangeHideHdl)); + // --> FME 2004-06-22 #114856# edit in readonly sections + aEditInReadonlyCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, ChangeEditInReadonlyHdl)); + // <-- + aFileCB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, UseFileHdl )); + aFilePB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, FileSearchHdl )); + aCurName.SetModifyHdl ( LINK( this, SwInsertSectionTabPage, NameEditHdl)); + aDDECB.SetClickHdl ( LINK( this, SwInsertSectionTabPage, DDEHdl )); + ChangeProtectHdl(&aProtectCB); + aSubRegionED.EnableAutocomplete( sal_True, sal_True ); +} +/* -----------------21.05.99 10:31------------------- + * + * --------------------------------------------------*/ +SwInsertSectionTabPage::~SwInsertSectionTabPage() +{ + delete m_pDocInserter; +} + +void SwInsertSectionTabPage::SetWrtShell(SwWrtShell& rSh) +{ + m_pWrtSh = &rSh; + + BOOL bWeb = 0 != PTR_CAST(SwWebDocShell, m_pWrtSh->GetView().GetDocShell()); + if(bWeb) + { + aHideCB .Hide(); + aConditionED .Hide(); + aConditionFT .Hide(); + aDDECB .Hide(); + aDDECommandFT .Hide(); + } + + lcl_FillSubRegionList( *m_pWrtSh, aSubRegionED, &aCurName ); + + SwSectionData *const pSectionData = + static_cast<SwInsertSectionTabDialog*>(GetTabDialog()) + ->GetSectionData(); + if (pSectionData) // something set? + { + aCurName.SetText( + rSh.GetUniqueSectionName(& pSectionData->GetSectionName())); + aProtectCB.Check( 0 != pSectionData->IsProtectFlag() ); + m_sFileName = pSectionData->GetLinkFileName(); + m_sFilePasswd = pSectionData->GetLinkFilePassword(); + aFileCB.Check( 0 != m_sFileName.Len() ); + aFileNameED.SetText( m_sFileName ); + UseFileHdl( &aFileCB ); + } + else + { + aCurName.SetText( rSh.GetUniqueSectionName() ); + } +} +/* -----------------21.05.99 10:32------------------- + * + * --------------------------------------------------*/ +BOOL SwInsertSectionTabPage::FillItemSet( SfxItemSet& ) +{ + SwSectionData aSection(CONTENT_SECTION, aCurName.GetText()); + aSection.SetCondition(aConditionED.GetText()); + BOOL bProtected = aProtectCB.IsChecked(); + aSection.SetProtectFlag(bProtected); + aSection.SetHidden(aHideCB.IsChecked()); + // --> FME 2004-06-22 #114856# edit in readonly sections + aSection.SetEditInReadonlyFlag(aEditInReadonlyCB.IsChecked()); + // <-- + if(bProtected) + { + aSection.SetPassword(m_aNewPasswd); + } + String sFileName = aFileNameED.GetText(); + String sSubRegion = aSubRegionED.GetText(); + BOOL bDDe = aDDECB.IsChecked(); + if(aFileCB.IsChecked() && (sFileName.Len() || sSubRegion.Len() || bDDe)) + { + String aLinkFile; + if( bDDe ) + { + aLinkFile = sFileName; + + USHORT nPos = 0; + while( STRING_NOTFOUND != (nPos = aLinkFile.SearchAscii( " ", nPos )) ) + aLinkFile.Erase( nPos--, 1 ); + + nPos = aLinkFile.SearchAndReplace( ' ', sfx2::cTokenSeperator ); + aLinkFile.SearchAndReplace( ' ', sfx2::cTokenSeperator, nPos ); + } + else + { + if(sFileName.Len()) + { + SfxMedium* pMedium = m_pWrtSh->GetView().GetDocShell()->GetMedium(); + INetURLObject aAbs; + if( pMedium ) + aAbs = pMedium->GetURLObject(); + aLinkFile = URIHelper::SmartRel2Abs( + aAbs, sFileName, URIHelper::GetMaybeFileHdl() ); + aSection.SetLinkFilePassword( m_sFilePasswd ); + } + + aLinkFile += sfx2::cTokenSeperator; + aLinkFile += m_sFilterName; + aLinkFile += sfx2::cTokenSeperator; + aLinkFile += sSubRegion; + } + + aSection.SetLinkFileName(aLinkFile); + if(aLinkFile.Len()) + { + aSection.SetType( aDDECB.IsChecked() ? + DDE_LINK_SECTION : + FILE_LINK_SECTION); + } + } + ((SwInsertSectionTabDialog*)GetTabDialog())->SetSectionData(aSection); + return TRUE; +} +/* -----------------21.05.99 10:32------------------- + * + * --------------------------------------------------*/ +void SwInsertSectionTabPage::Reset( const SfxItemSet& ) +{ +} +/* -----------------21.05.99 11:22------------------- + * + * --------------------------------------------------*/ +SfxTabPage* SwInsertSectionTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new SwInsertSectionTabPage(pParent, rAttrSet); +} +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +IMPL_LINK( SwInsertSectionTabPage, ChangeHideHdl, CheckBox *, pBox ) +{ + BOOL bHide = pBox->IsChecked(); + aConditionED.Enable(bHide); + aConditionFT.Enable(bHide); + return 0; +} +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +IMPL_LINK( SwInsertSectionTabPage, ChangeEditInReadonlyHdl, CheckBox *, EMPTYARG ) +{ + return 0; +} +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +IMPL_LINK( SwInsertSectionTabPage, ChangeProtectHdl, CheckBox *, pBox ) +{ + sal_Bool bCheck = pBox->IsChecked(); + aPasswdCB.Enable(bCheck); + aPasswdPB.Enable(bCheck); + return 0; +} +/* -----------------------------26.04.01 14:50-------------------------------- + + ---------------------------------------------------------------------------*/ +IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton ) +{ + sal_Bool bChange = pButton == &aPasswdPB; + sal_Bool bSet = bChange ? bChange : aPasswdCB.IsChecked(); + if(bSet) + { + if(!m_aNewPasswd.getLength() || bChange) + { + SwTestPasswdDlg aPasswdDlg(this); + aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); + if(RET_OK == aPasswdDlg.Execute()) + { + String sNewPasswd( aPasswdDlg.GetPassword() ); + if( aPasswdDlg.GetConfirm() == sNewPasswd ) + { + SvPasswordHelper::GetHashPassword( m_aNewPasswd, sNewPasswd ); + } + else + { + InfoBox(pButton, SW_RES(REG_WRONG_PASSWD_REPEAT)).Execute(); + } + } + else if(!bChange) + aPasswdCB.Check(FALSE); + } + } + else + m_aNewPasswd.realloc(0); + return 0; +} +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +IMPL_LINK_INLINE_START( SwInsertSectionTabPage, NameEditHdl, Edit *, EMPTYARG ) +{ + String aName=aCurName.GetText(); + GetTabDialog()->GetOKButton().Enable(aName.Len() && aCurName.GetEntryPos( aName ) == USHRT_MAX); + return 0; +} +IMPL_LINK_INLINE_END( SwInsertSectionTabPage, NameEditHdl, Edit *, EMPTYARG ) + +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +IMPL_LINK( SwInsertSectionTabPage, UseFileHdl, CheckBox *, pBox ) +{ + if( pBox->IsChecked() ) + { + if( m_pWrtSh->HasSelection() && + RET_NO == QueryBox( this, SW_RES(QB_CONNECT) ).Execute() ) + pBox->Check( FALSE ); + } + + BOOL bFile = pBox->IsChecked(); + aFileNameFT.Enable(bFile); + aFileNameED.Enable(bFile); + aFilePB.Enable(bFile); + aSubRegionFT.Enable(bFile); + aSubRegionED.Enable(bFile); + aDDECommandFT.Enable(bFile); + aDDECB.Enable(bFile); + if( bFile ) + { +// aFileNameED.SetText( aFileName ); + aFileNameED.GrabFocus(); + aProtectCB.Check( TRUE ); + } + else + { + aDDECB.Check(FALSE); + DDEHdl(&aDDECB); +// aFileNameED.SetText(aEmptyStr); + } + return 0; +} + +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +IMPL_LINK( SwInsertSectionTabPage, FileSearchHdl, PushButton *, EMPTYARG ) +{ + m_pOldDefDlgParent = Application::GetDefDialogParent(); + Application::SetDefDialogParent( this ); + if ( m_pDocInserter ) + delete m_pDocInserter; + m_pDocInserter = new ::sfx2::DocumentInserter( 0, String::CreateFromAscii("swriter") ); + m_pDocInserter->StartExecuteModal( LINK( this, SwInsertSectionTabPage, DlgClosedHdl ) ); + return 0; +} + +/*--------------------------------------------------------------------- + +---------------------------------------------------------------------*/ + +IMPL_LINK( SwInsertSectionTabPage, DDEHdl, CheckBox*, pBox ) +{ + BOOL bDDE = pBox->IsChecked(); + BOOL bFile = aFileCB.IsChecked(); + aFilePB.Enable(!bDDE && bFile); + if(bDDE) + { + aFileNameFT.Hide(); + aDDECommandFT.Enable(bDDE); + aDDECommandFT.Show(); + aSubRegionFT.Hide(); + aSubRegionED.Hide(); + } + else + { + aDDECommandFT.Hide(); + aFileNameFT.Enable(bFile); + aFileNameFT.Show(); + aSubRegionFT.Show(); + aSubRegionED.Show(); + aSubRegionED.Enable(bFile); + } + return 0; +} + +IMPL_LINK( SwInsertSectionTabPage, DlgClosedHdl, sfx2::FileDialogHelper *, _pFileDlg ) +{ + if ( _pFileDlg->GetError() == ERRCODE_NONE ) + { + SfxMedium* pMedium = m_pDocInserter->CreateMedium(); + if ( pMedium ) + { + m_sFileName = pMedium->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); + m_sFilterName = pMedium->GetFilter()->GetFilterName(); + const SfxPoolItem* pItem; + if ( SFX_ITEM_SET == pMedium->GetItemSet()->GetItemState( SID_PASSWORD, FALSE, &pItem ) ) + m_sFilePasswd = ( (SfxStringItem*)pItem )->GetValue(); + aFileNameED.SetText( INetURLObject::decode( + m_sFileName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS, RTL_TEXTENCODING_UTF8 ) ); + ::lcl_ReadSections( *pMedium, aSubRegionED ); + delete pMedium; + } + } + else + m_sFilterName = m_sFilePasswd = aEmptyStr; + + Application::SetDefDialogParent( m_pOldDefDlgParent ); + return 0; +} + +// -------------------------------------------------------------- + +// Numerierungsformat Umsetzung: +// ListBox - Format - Enum-Wert +// 0 - A, B, C, ... - 0 +// 1 - a, b, c, ... - 1 +// 2 - I, II, III, ... - 2 +// 3 - i, ii, iii, ... - 3 +// 4 - 1, 2, 3, ... - 4 +// 5 - A, .., AA, .., - 9 +// 6 - a, .., aa, .., - 10 + +inline USHORT GetNumPos( USHORT n ) +{ + return SVX_NUM_ARABIC < n ? n - 4 : n; +} + +inline SvxExtNumType GetNumType( USHORT n ) +{ + return (SvxExtNumType)(4 < n ? n + 4 : n ); +} + +SwSectionFtnEndTabPage::SwSectionFtnEndTabPage( Window *pParent, + const SfxItemSet &rAttrSet) + : SfxTabPage( pParent, SW_RES( TP_SECTION_FTNENDNOTES ), rAttrSet ), + aFtnFL ( this, SW_RES( FL_FTN ) ), + aFtnNtAtTextEndCB ( this, SW_RES( CB_FTN_AT_TXTEND ) ), + + aFtnNtNumCB ( this, SW_RES( CB_FTN_NUM ) ), + aFtnOffsetLbl ( this, SW_RES( FT_FTN_OFFSET )), + aFtnOffsetFld ( this, SW_RES( FLD_FTN_OFFSET )), + + aFtnNtNumFmtCB ( this, SW_RES( CB_FTN_NUM_FMT ) ), + aFtnPrefixFT ( this, SW_RES( FT_FTN_PREFIX )), + aFtnPrefixED ( this, SW_RES( ED_FTN_PREFIX )), + aFtnNumViewBox ( this, SW_RES( LB_FTN_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES), + aFtnSuffixFT ( this, SW_RES( FT_FTN_SUFFIX )), + aFtnSuffixED ( this, SW_RES( ED_FTN_SUFFIX )), + + aEndFL ( this, SW_RES( FL_END ) ), + aEndNtAtTextEndCB ( this, SW_RES( CB_END_AT_TXTEND )), + + aEndNtNumCB ( this, SW_RES( CB_END_NUM )), + aEndOffsetLbl ( this, SW_RES( FT_END_OFFSET )), + aEndOffsetFld ( this, SW_RES( FLD_END_OFFSET )), + + aEndNtNumFmtCB ( this, SW_RES( CB_END_NUM_FMT ) ), + aEndPrefixFT ( this, SW_RES( FT_END_PREFIX )), + aEndPrefixED ( this, SW_RES( ED_END_PREFIX )), + aEndNumViewBox ( this, SW_RES( LB_END_NUMVIEW ), INSERT_NUM_EXTENDED_TYPES), + aEndSuffixFT ( this, SW_RES( FT_END_SUFFIX )), + aEndSuffixED ( this, SW_RES( ED_END_SUFFIX )) +{ + FreeResource(); + + Link aLk( LINK( this, SwSectionFtnEndTabPage, FootEndHdl)); + aFtnNtAtTextEndCB.SetClickHdl( aLk ); + aFtnNtNumCB.SetClickHdl( aLk ); + aEndNtAtTextEndCB.SetClickHdl( aLk ); + aEndNtNumCB.SetClickHdl( aLk ); + aFtnNtNumFmtCB.SetClickHdl( aLk ); + aEndNtNumFmtCB.SetClickHdl( aLk ); +} + +SwSectionFtnEndTabPage::~SwSectionFtnEndTabPage() +{ +} + +BOOL SwSectionFtnEndTabPage::FillItemSet( SfxItemSet& rSet ) +{ + SwFmtFtnAtTxtEnd aFtn( aFtnNtAtTextEndCB.IsChecked() + ? ( aFtnNtNumCB.IsChecked() + ? ( aFtnNtNumFmtCB.IsChecked() + ? FTNEND_ATTXTEND_OWNNUMANDFMT + : FTNEND_ATTXTEND_OWNNUMSEQ ) + : FTNEND_ATTXTEND ) + : FTNEND_ATPGORDOCEND ); + + switch( aFtn.GetValue() ) + { + case FTNEND_ATTXTEND_OWNNUMANDFMT: + aFtn.SetNumType( aFtnNumViewBox.GetSelectedNumberingType() ); + aFtn.SetPrefix( aFtnPrefixED.GetText() ); + aFtn.SetSuffix( aFtnSuffixED.GetText() ); + // no break; + + case FTNEND_ATTXTEND_OWNNUMSEQ: + aFtn.SetOffset( static_cast< USHORT >( aFtnOffsetFld.GetValue()-1 ) ); + // no break; + } + + SwFmtEndAtTxtEnd aEnd( aEndNtAtTextEndCB.IsChecked() + ? ( aEndNtNumCB.IsChecked() + ? ( aEndNtNumFmtCB.IsChecked() + ? FTNEND_ATTXTEND_OWNNUMANDFMT + : FTNEND_ATTXTEND_OWNNUMSEQ ) + : FTNEND_ATTXTEND ) + : FTNEND_ATPGORDOCEND ); + + switch( aEnd.GetValue() ) + { + case FTNEND_ATTXTEND_OWNNUMANDFMT: + aEnd.SetNumType( aEndNumViewBox.GetSelectedNumberingType() ); + aEnd.SetPrefix( aEndPrefixED.GetText() ); + aEnd.SetSuffix( aEndSuffixED.GetText() ); + // no break; + + case FTNEND_ATTXTEND_OWNNUMSEQ: + aEnd.SetOffset( static_cast< USHORT >( aEndOffsetFld.GetValue()-1 ) ); + // no break; + } + + rSet.Put( aFtn ); + rSet.Put( aEnd ); + + return TRUE; +} + +void SwSectionFtnEndTabPage::ResetState( BOOL bFtn, + const SwFmtFtnEndAtTxtEnd& rAttr ) +{ + CheckBox *pNtAtTextEndCB, *pNtNumCB, *pNtNumFmtCB; + FixedText*pPrefixFT, *pSuffixFT; + Edit *pPrefixED, *pSuffixED; + SwNumberingTypeListBox *pNumViewBox; + FixedText* pOffsetTxt; + NumericField *pOffsetFld; + + if( bFtn ) + { + pNtAtTextEndCB = &aFtnNtAtTextEndCB; + pNtNumCB = &aFtnNtNumCB; + pNtNumFmtCB = &aFtnNtNumFmtCB; + pPrefixFT = &aFtnPrefixFT; + pPrefixED = &aFtnPrefixED; + pSuffixFT = &aFtnSuffixFT; + pSuffixED = &aFtnSuffixED; + pNumViewBox = &aFtnNumViewBox; + pOffsetTxt = &aFtnOffsetLbl; + pOffsetFld = &aFtnOffsetFld; + } + else + { + pNtAtTextEndCB = &aEndNtAtTextEndCB; + pNtNumCB = &aEndNtNumCB; + pNtNumFmtCB = &aEndNtNumFmtCB; + pPrefixFT = &aEndPrefixFT; + pPrefixED = &aEndPrefixED; + pSuffixFT = &aEndSuffixFT; + pSuffixED = &aEndSuffixED; + pNumViewBox = &aEndNumViewBox; + pOffsetTxt = &aEndOffsetLbl; + pOffsetFld = &aEndOffsetFld; + } + + USHORT eState = rAttr.GetValue(); + switch( eState ) + { + // case FTNEND_ATPGORDOCEND: + case FTNEND_ATTXTEND_OWNNUMANDFMT: + pNtNumFmtCB->SetState( STATE_CHECK ); + // no break; + + case FTNEND_ATTXTEND_OWNNUMSEQ: + pNtNumCB->SetState( STATE_CHECK ); + // no break; + + case FTNEND_ATTXTEND: + pNtAtTextEndCB->SetState( STATE_CHECK ); + // no break; + } + + pNumViewBox->SelectNumberingType( rAttr.GetNumType() ); + pOffsetFld->SetValue( rAttr.GetOffset() + 1 ); + pPrefixED->SetText( rAttr.GetPrefix() ); + pSuffixED->SetText( rAttr.GetSuffix() ); + + switch( eState ) + { + case FTNEND_ATPGORDOCEND: + pNtNumCB->Enable( FALSE ); + // no break; + + case FTNEND_ATTXTEND: + pNtNumFmtCB->Enable( FALSE ); + pOffsetFld->Enable( FALSE ); + pOffsetTxt->Enable( FALSE ); + // no break; + + case FTNEND_ATTXTEND_OWNNUMSEQ: + pNumViewBox->Enable( FALSE ); + pPrefixFT->Enable( FALSE ); + pPrefixED->Enable( FALSE ); + pSuffixFT->Enable( FALSE ); + pSuffixED->Enable( FALSE ); + // no break; + } +} + +void SwSectionFtnEndTabPage::Reset( const SfxItemSet& rSet ) +{ + ResetState( TRUE, (const SwFmtFtnAtTxtEnd&)rSet.Get( + RES_FTN_AT_TXTEND, FALSE )); + ResetState( FALSE, (const SwFmtEndAtTxtEnd&)rSet.Get( + RES_END_AT_TXTEND, FALSE )); +} + +SfxTabPage* SwSectionFtnEndTabPage::Create( Window* pParent, + const SfxItemSet& rAttrSet) +{ + return new SwSectionFtnEndTabPage(pParent, rAttrSet); +} + +IMPL_LINK( SwSectionFtnEndTabPage, FootEndHdl, CheckBox *, pBox ) +{ +// pBox->EnableTriState( FALSE ); + BOOL bFoot = &aFtnNtAtTextEndCB == pBox || &aFtnNtNumCB == pBox || + &aFtnNtNumFmtCB == pBox ; + + CheckBox *pNumBox, *pNumFmtBox, *pEndBox; + SwNumberingTypeListBox* pNumViewBox; + FixedText* pOffsetTxt; + NumericField *pOffsetFld; + FixedText*pPrefixFT, *pSuffixFT; + Edit *pPrefixED, *pSuffixED; + + if( bFoot ) + { + pEndBox = &aFtnNtAtTextEndCB; + pNumBox = &aFtnNtNumCB; + pNumFmtBox = &aFtnNtNumFmtCB; + pNumViewBox = &aFtnNumViewBox; + pOffsetTxt = &aFtnOffsetLbl; + pOffsetFld = &aFtnOffsetFld; + pPrefixFT = &aFtnPrefixFT; + pSuffixFT = &aFtnSuffixFT; + pPrefixED = &aFtnPrefixED; + pSuffixED = &aFtnSuffixED; + } + else + { + pEndBox = &aEndNtAtTextEndCB; + pNumBox = &aEndNtNumCB; + pNumFmtBox = &aEndNtNumFmtCB; + pNumViewBox = &aEndNumViewBox; + pOffsetTxt = &aEndOffsetLbl; + pOffsetFld = &aEndOffsetFld; + pPrefixFT = &aEndPrefixFT; + pSuffixFT = &aEndSuffixFT; + pPrefixED = &aEndPrefixED; + pSuffixED = &aEndSuffixED; + } + + BOOL bEnableAtEnd = STATE_CHECK == pEndBox->GetState(); + BOOL bEnableNum = bEnableAtEnd && STATE_CHECK == pNumBox->GetState(); + BOOL bEnableNumFmt = bEnableNum && STATE_CHECK == pNumFmtBox->GetState(); + + pNumBox->Enable( bEnableAtEnd ); + pOffsetTxt->Enable( bEnableNum ); + pOffsetFld->Enable( bEnableNum ); + pNumFmtBox->Enable( bEnableNum ); + pNumViewBox->Enable( bEnableNumFmt ); + pPrefixED->Enable( bEnableNumFmt ); + pSuffixED->Enable( bEnableNumFmt ); + pPrefixFT->Enable( bEnableNumFmt ); + pSuffixFT->Enable( bEnableNumFmt ); + + return 0; +} + +/* -----------------21.05.99 13:59------------------- + * + * --------------------------------------------------*/ +SwSectionPropertyTabDialog::SwSectionPropertyTabDialog( + Window* pParent, const SfxItemSet& rSet, SwWrtShell& rSh) : + SfxTabDialog(pParent, SW_RES(DLG_SECTION_PROPERTIES), &rSet), + rWrtSh(rSh) +{ + FreeResource(); + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + AddTabPage(TP_COLUMN, SwColumnPage::Create, 0); + AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); + AddTabPage(TP_SECTION_FTNENDNOTES, SwSectionFtnEndTabPage::Create, 0); + AddTabPage(TP_SECTION_INDENTS, SwSectionIndentTabPage::Create, 0); + + SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); + long nHtmlMode = pHtmlOpt->GetExportMode(); + BOOL bWeb = 0 != PTR_CAST( SwWebDocShell, rSh.GetView().GetDocShell() ); + if(bWeb) + { + RemoveTabPage(TP_SECTION_FTNENDNOTES); + RemoveTabPage(TP_SECTION_INDENTS); + if( HTML_CFG_NS40 != nHtmlMode && HTML_CFG_WRITER != nHtmlMode) + RemoveTabPage(TP_COLUMN); + } +} +/* -----------------21.05.99 13:59------------------- + * + * --------------------------------------------------*/ +SwSectionPropertyTabDialog::~SwSectionPropertyTabDialog() +{ +} +/* -----------------21.05.99 13:59------------------- + * + * --------------------------------------------------*/ +void SwSectionPropertyTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage ) +{ + if( TP_BACKGROUND == nId ) + { + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, SVX_SHOW_SELECTOR)); + rPage.PageCreated(aSet); + } + else if( TP_COLUMN == nId ) + { + ((SwColumnPage&)rPage).ShowBalance(TRUE); + ((SwColumnPage&)rPage).SetInSection(TRUE); + } + else if(TP_SECTION_INDENTS == nId) + ((SwSectionIndentTabPage&)rPage).SetWrtShell(rWrtSh); +} +/*-- 13.06.2003 09:59:08--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwSectionIndentTabPage::SwSectionIndentTabPage( Window *pParent, const SfxItemSet &rAttrSet ) : + SfxTabPage(pParent, SW_RES(TP_SECTION_INDENTS), rAttrSet), + aIndentFL(this, SW_RES(FL_INDENT )), + aBeforeFT(this, SW_RES(FT_BEFORE )), + aBeforeMF(this, SW_RES(MF_BEFORE )), + aAfterFT(this, SW_RES(FT_AFTER )), + aAfterMF(this, SW_RES(MF_AFTER )), + aPreviewWin(this, SW_RES(WIN_PREVIEW )) +{ + FreeResource(); + Link aLk = LINK(this, SwSectionIndentTabPage, IndentModifyHdl); + aBeforeMF.SetModifyHdl(aLk); + aAfterMF.SetModifyHdl(aLk); +} +/*-- 13.06.2003 09:59:23--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwSectionIndentTabPage::~SwSectionIndentTabPage() +{ +} +/*-- 13.06.2003 09:59:23--------------------------------------------------- + + -----------------------------------------------------------------------*/ +BOOL SwSectionIndentTabPage::FillItemSet( SfxItemSet& rSet) +{ + if(aBeforeMF.IsValueModified() || + aAfterMF.IsValueModified()) + { + SvxLRSpaceItem aLRSpace( + static_cast< long >(aBeforeMF.Denormalize(aBeforeMF.GetValue(FUNIT_TWIP))) , + static_cast< long >(aAfterMF.Denormalize(aAfterMF.GetValue(FUNIT_TWIP))), 0, 0, RES_LR_SPACE); + rSet.Put(aLRSpace); + } + return TRUE; +} +/*-- 13.06.2003 09:59:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSectionIndentTabPage::Reset( const SfxItemSet& rSet) +{ + //this page doesn't show up in HTML mode + FieldUnit aMetric = ::GetDfltMetric(FALSE); + SetMetric(aBeforeMF, aMetric); + SetMetric(aAfterMF , aMetric); + + SfxItemState eItemState = rSet.GetItemState( RES_LR_SPACE ); + if ( eItemState >= SFX_ITEM_AVAILABLE ) + { + const SvxLRSpaceItem& rSpace = + (const SvxLRSpaceItem&)rSet.Get( RES_LR_SPACE ); + + aBeforeMF.SetValue( aBeforeMF.Normalize(rSpace.GetLeft()), FUNIT_TWIP ); + aAfterMF.SetValue( aAfterMF.Normalize(rSpace.GetRight()), FUNIT_TWIP ); + } + else + { + aBeforeMF.SetEmptyFieldValue(); + aAfterMF.SetEmptyFieldValue(); + } + aBeforeMF.SaveValue(); + aAfterMF.SaveValue(); + IndentModifyHdl(0); +} +/*-- 13.06.2003 09:59:24--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SfxTabPage* SwSectionIndentTabPage::Create( Window* pParent, const SfxItemSet& rAttrSet) +{ + return new SwSectionIndentTabPage(pParent, rAttrSet); +} +/* -----------------13.06.2003 13:57----------------- + + --------------------------------------------------*/ +void SwSectionIndentTabPage::SetWrtShell(SwWrtShell& rSh) +{ + //set sensible values at the preview + aPreviewWin.SetAdjust(SVX_ADJUST_BLOCK); + aPreviewWin.SetLastLine(SVX_ADJUST_BLOCK); + const SwRect& rPageRect = rSh.GetAnyCurRect( RECT_PAGE, 0 ); + Size aPageSize(rPageRect.Width(), rPageRect.Height()); + aPreviewWin.SetSize(aPageSize); +} +/* -----------------13.06.2003 14:02----------------- + + --------------------------------------------------*/ +IMPL_LINK(SwSectionIndentTabPage, IndentModifyHdl, MetricField*, EMPTYARG) +{ + aPreviewWin.SetLeftMargin( static_cast< long >(aBeforeMF.Denormalize(aBeforeMF.GetValue(FUNIT_TWIP))) ); + aPreviewWin.SetRightMargin( static_cast< long >(aAfterMF.Denormalize(aAfterMF.GetValue(FUNIT_TWIP))) ); + aPreviewWin.Draw(TRUE); + return 0; +} + diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx new file mode 100644 index 000000000000..4af058eeae1f --- /dev/null +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif +#include <swtypes.hxx> +#include <wordcountdialog.hxx> +#include <docstat.hxx> + +#include <dialog.hrc> +#include <layout/layout-pre.hxx> +#include <wordcountdialog.hrc> + +#if ENABLE_LAYOUT +#undef SW_RES +#define SW_RES(x) #x +#undef SfxModalDialog +#define SfxModalDialog( parent, id ) Dialog( parent, "wordcount.xml", id ) +#define SW_WORDCOUNTDIALOG_HRC +#include <helpid.h> +#endif /* ENABLE_LAYOUT */ + +/*-- 06.04.2004 16:05:55--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwWordCountDialog::SwWordCountDialog(Window* pParent) : + SfxModalDialog(pParent, SW_RES(DLG_WORDCOUNT)), +#if defined _MSC_VER +#pragma warning (disable : 4355) +#endif + aCurrentFL( this, SW_RES( FL_CURRENT )), + aCurrentWordFT( this, SW_RES( FT_CURRENTWORD )), + aCurrentWordFI( this, SW_RES( FI_CURRENTWORD )), + aCurrentCharacterFT( this, SW_RES( FT_CURRENTCHARACTER )), + aCurrentCharacterFI( this, SW_RES( FI_CURRENTCHARACTER )), + + aDocFL( this, SW_RES( FL_DOC )), + aDocWordFT( this, SW_RES( FT_DOCWORD )), + aDocWordFI( this, SW_RES( FI_DOCWORD )), + aDocCharacterFT( this, SW_RES( FT_DOCCHARACTER )), + aDocCharacterFI( this, SW_RES( FI_DOCCHARACTER )), + aBottomFL(this, SW_RES( FL_BOTTOM )), + aOK( this, SW_RES( PB_OK )), + aHelp( this, SW_RES( PB_HELP )) +#if defined _MSC_VER +#pragma warning (default : 4355) +#endif +{ +#if ENABLE_LAYOUT + SetHelpId (HID_DLG_WORDCOUNT); +#endif /* ENABLE_LAYOUT */ + FreeResource(); +} +/*-- 06.04.2004 16:05:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +SwWordCountDialog::~SwWordCountDialog() +{ +} +/*-- 06.04.2004 16:05:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwWordCountDialog::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc) +{ + aCurrentWordFI.SetText( String::CreateFromInt32(rCurrent.nWord )); + aCurrentCharacterFI.SetText(String::CreateFromInt32(rCurrent.nChar )); + aDocWordFI.SetText( String::CreateFromInt32(rDoc.nWord )); + aDocCharacterFI.SetText( String::CreateFromInt32(rDoc.nChar )); +} + + + diff --git a/sw/source/ui/dialog/wordcountdialog.hrc b/sw/source/ui/dialog/wordcountdialog.hrc new file mode 100644 index 000000000000..00749412ac97 --- /dev/null +++ b/sw/source/ui/dialog/wordcountdialog.hrc @@ -0,0 +1,43 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_WORDCOUNTDIALOG_HRC +#define SW_WORDCOUNTDIALOG_HRC +#define FL_CURRENT 1 +#define FT_CURRENTWORD 2 +#define FI_CURRENTWORD 3 +#define FT_CURRENTCHARACTER 4 +#define FI_CURRENTCHARACTER 5 +#define FL_DOC 6 +#define FT_DOCWORD 7 +#define FI_DOCWORD 8 +#define FT_DOCCHARACTER 9 +#define FI_DOCCHARACTER 10 +#define FL_BOTTOM 11 +#define PB_OK 12 +#define PB_HELP 13 + +#endif diff --git a/sw/source/ui/dialog/wordcountdialog.src b/sw/source/ui/dialog/wordcountdialog.src new file mode 100644 index 000000000000..454a6c050b34 --- /dev/null +++ b/sw/source/ui/dialog/wordcountdialog.src @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include <helpid.h> +#include <dialog.hrc> +#include <wordcountdialog.hrc> +ModalDialog DLG_WORDCOUNT +{ + HelpID = HID_DLG_WORDCOUNT ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 170 , 108 ) ; + Text [ en-US ] = "Word Count" ; + Moveable = TRUE ; + + FixedLine FL_CURRENT + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 158 , 8 ) ; + Text [ en-US ] = "Current selection"; + }; + FixedText FT_CURRENTWORD + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Words:"; + }; + FixedText FI_CURRENTWORD + { + Pos = MAP_APPFONT ( 111 , 14 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Right = TRUE; + }; + FixedText FT_CURRENTCHARACTER + { + Pos = MAP_APPFONT ( 12 , 26 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Characters:"; + }; + FixedText FI_CURRENTCHARACTER + { + Pos = MAP_APPFONT ( 111 , 26 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Right = TRUE; + }; + FixedLine FL_DOC + { + Pos = MAP_APPFONT ( 6, 40 ) ; + Size = MAP_APPFONT ( 158 , 8 ) ; + Text [ en-US ] = "Whole document"; + }; + FixedText FT_DOCWORD + { + Pos = MAP_APPFONT ( 12, 51 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Words:"; + }; + FixedText FI_DOCWORD + { + Pos = MAP_APPFONT ( 111 , 51 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Right = TRUE; + }; + FixedText FT_DOCCHARACTER + { + Pos = MAP_APPFONT ( 12 , 63 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Characters:"; + }; + FixedText FI_DOCCHARACTER + { + Pos = MAP_APPFONT ( 111, 63 ) ; + Size = MAP_APPFONT ( 50, 8 ) ; + Right = TRUE; + }; + FixedLine FL_BOTTOM + { + Pos = MAP_APPFONT ( 6 , 77 ) ; + Size = MAP_APPFONT ( 158 , 8 ) ; + }; + OKButton PB_OK + { + Pos = MAP_APPFONT ( 61 , 88 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 114 , 88 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; +}; |