summaryrefslogtreecommitdiff
path: root/sw/source/ui/shells
diff options
context:
space:
mode:
authorroopak12345 <mailstorpk@gmail.com>2014-03-09 21:40:44 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-09 21:53:34 +0100
commita652ea0fc4cc789f715b461819127ee80afa9e6f (patch)
tree0858def8201a45024721f4a98b537cd3274ac4c5 /sw/source/ui/shells
parentf4dfd811344604e119670eb7cdda0ab2e85bcea5 (diff)
fdo#70422 Moved the linked files from sw/source/ui to a new core/uibase dir
Moved the files linked in sw/Library_sw.mk from sw/source/ui to sw/source/core/uibase and modified the make files as per the new directory location. Reviewed on: https://gerrit.libreoffice.org/8447 Change-Id: I05f6ccdeee5e76fb0ae477d16721d9ddc6eaff32
Diffstat (limited to 'sw/source/ui/shells')
-rw-r--r--sw/source/ui/shells/annotsh.cxx1760
-rw-r--r--sw/source/ui/shells/basesh.cxx2832
-rw-r--r--sw/source/ui/shells/beziersh.cxx330
-rw-r--r--sw/source/ui/shells/drawdlg.cxx234
-rw-r--r--sw/source/ui/shells/drawsh.cxx597
-rw-r--r--sw/source/ui/shells/drformsh.cxx258
-rw-r--r--sw/source/ui/shells/drwbassh.cxx961
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx1084
-rw-r--r--sw/source/ui/shells/drwtxtsh.cxx878
-rw-r--r--sw/source/ui/shells/frmsh.cxx1185
-rw-r--r--sw/source/ui/shells/grfsh.cxx892
-rw-r--r--sw/source/ui/shells/grfshex.cxx154
-rw-r--r--sw/source/ui/shells/langhelper.cxx612
-rw-r--r--sw/source/ui/shells/listsh.cxx280
-rw-r--r--sw/source/ui/shells/mediash.cxx199
-rw-r--r--sw/source/ui/shells/navsh.cxx106
-rw-r--r--sw/source/ui/shells/olesh.cxx55
-rw-r--r--sw/source/ui/shells/slotadd.cxx139
-rw-r--r--sw/source/ui/shells/tabsh.cxx1476
-rw-r--r--sw/source/ui/shells/textdrw.cxx122
-rw-r--r--sw/source/ui/shells/textfld.cxx923
-rw-r--r--sw/source/ui/shells/textglos.cxx129
-rw-r--r--sw/source/ui/shells/textidx.cxx251
-rw-r--r--sw/source/ui/shells/textsh.cxx1131
-rw-r--r--sw/source/ui/shells/textsh1.cxx1811
-rw-r--r--sw/source/ui/shells/textsh2.cxx285
-rw-r--r--sw/source/ui/shells/txtattr.cxx743
-rw-r--r--sw/source/ui/shells/txtcrsr.cxx376
-rw-r--r--sw/source/ui/shells/txtnum.cxx410
29 files changed, 0 insertions, 20213 deletions
diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx
deleted file mode 100644
index d1e69591744f..000000000000
--- a/sw/source/ui/shells/annotsh.cxx
+++ /dev/null
@@ -1,1760 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
-#include <com/sun/star/i18n/TextConversionOption.hpp>
-#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-
-#include <tools/shl.hxx>
-#include <i18nlangtag/mslangid.hxx>
-#include <sfx2/objface.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/request.hxx>
-#include <editeng/spltitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/orphitem.hxx>
-#include <editeng/formatbreakitem.hxx>
-#include <editeng/widwitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/escapementitem.hxx>
-#include <editeng/lspcitem.hxx>
-#include <editeng/adjustitem.hxx>
-#include <editeng/crossedoutitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/hyphenzoneitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <svx/clipfmtitem.hxx>
-#include <svl/stritem.hxx>
-#include <svl/slstitm.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/contouritem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/frmdiritem.hxx>
-#include <svx/svdoutl.hxx>
-#include <svl/whiter.hxx>
-#include <svl/cjkoptions.hxx>
-#include <svl/ctloptions.hxx>
-#include <unotools/useroptions.hxx>
-#include <vcl/msgbox.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/editstat.hxx>
-#include <svx/hlnkitem.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/unolingu.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <editeng/writingmodeitem.hxx>
-#include <swundo.hxx>
-#include <doc.hxx>
-#include <viewopt.hxx>
-#include <wrtsh.hxx>
-#include <uitool.hxx>
-#include <popup.hrc>
-#include <chrdlgmodes.hxx>
-#include <pardlg.hxx>
-#include <swdtflvr.hxx>
-#include <drwtxtsh.hxx>
-#include <swmodule.hxx>
-#include <initui.hxx>
-#include <edtwin.hxx>
-#include <swwait.hxx>
-#include <docstat.hxx>
-
-#include <cmdid.h>
-#include <globals.hrc>
-#include <shells.hrc>
-#include <breakit.hxx>
-#include "annotsh.hxx"
-#include "view.hxx"
-#include <PostItMgr.hxx>
-#include <SidebarWin.hxx>
-
-#include "swtypes.hxx"
-
-#include <svx/svxdlg.hxx>
-#include <svx/dialogs.hrc>
-
-#include <svx/svxids.hrc>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <svl/itempool.hxx>
-#include <editeng/outliner.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-
-#include <svl/languageoptions.hxx>
-#include <svtools/langtab.hxx>
-
-#include <docsh.hxx>
-#include <svl/undo.hxx>
-#include "swabstdlg.hxx"
-#include "chrdlg.hrc"
-#include "misc.hrc"
-#include <app.hrc>
-
-#include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
-#include <cppuhelper/bootstrap.hxx>
-
-#include <langhelper.hxx>
-
-#include <wordcountdialog.hxx>
-#include <tools/diagnose_ex.h>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::i18n;
-
-#define SwAnnotationShell
-
-#include <sfx2/msg.hxx>
-#include <swslots.hxx>
-
-SFX_IMPL_INTERFACE(SwAnnotationShell, SfxShell, SW_RES(STR_SHELLNAME_DRAW_TEXT))
-{
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX));
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_ANNOTATION_POPUPMENU));
-}
-
-TYPEINIT1(SwAnnotationShell,SfxShell)
-
-SwAnnotationShell::SwAnnotationShell( SwView& r )
-: rView(r)
-{
- SwWrtShell &rSh = rView.GetWrtShell();
- SetPool(rSh.GetAttrPool().GetSecondaryPool());
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Annotation));
-}
-
-SwAnnotationShell::~SwAnnotationShell()
-{
-}
-
-::svl::IUndoManager* SwAnnotationShell::GetUndoManager()
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr ||
- !pPostItMgr->HasActiveSidebarWin() )
- {
- OSL_ENSURE(pPostItMgr,"PostItMgr::Layout(): We are looping forever");
- return 0;
- }
- return &pPostItMgr->GetActiveSidebarWin()->GetOutlinerView()->GetOutliner()->GetUndoManager();
-}
-
-void SwAnnotationShell::Exec( SfxRequest &rReq )
-{
- //TODO: clean this up!!!!
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
- return;
-
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
- SfxItemSet aEditAttr(pOLV->GetAttribs());
- SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
-
- sal_uInt16 nSlot = rReq.GetSlot();
- sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
- const SfxItemSet *pNewAttrs = rReq.GetArgs();
- sal_uInt16 nEEWhich = 0;
- switch (nSlot)
- {
- case SID_ATTR_PARA_LRSPACE:
- {
- SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
- GetArgs()->Get(nSlot));
- aParaMargin.SetWhich( EE_PARA_LRSPACE );
-
- aNewAttr.Put(aParaMargin);
- rReq.Done();
- break;
- }
- case SID_ATTR_PARA_LINESPACE:
- {
- SvxLineSpacingItem aParaMargin = (const SvxLineSpacingItem&)pNewAttrs->Get(
- GetPool().GetWhich(nSlot));
- aParaMargin.SetWhich( EE_PARA_SBL );
-
- aNewAttr.Put(aParaMargin);
- rReq.Done();
- break;
- }
- case SID_ATTR_PARA_ULSPACE:
- {
- SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get(
- GetPool().GetWhich(nSlot));
- aULSpace.SetWhich( EE_PARA_ULSPACE );
- aNewAttr.Put( aULSpace );
- rReq.Done();
- }
- break;
- case SID_ATTR_CHAR_FONT:
- case SID_ATTR_CHAR_FONTHEIGHT:
- case SID_ATTR_CHAR_WEIGHT:
- case SID_ATTR_CHAR_POSTURE:
- {
- SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
- if( !pSecondPool )
- pSecondPool = aEditAttr.GetPool();
- SvxScriptSetItem aSetItem( nSlot, *pSecondPool );
- aSetItem.PutItemForScriptType( pOLV->GetSelectedScriptType(), pNewAttrs->Get( nWhich ));
- aNewAttr.Put( aSetItem.GetItemSet() );
- rReq.Done();
- break;
- }
- case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
- case SID_ATTR_CHAR_UNDERLINE:
- {
- if( rReq.GetArgs() )
- {
- SFX_REQUEST_ARG( rReq, pItem, SvxUnderlineItem, SID_ATTR_CHAR_UNDERLINE , false );
- if (pItem)
- {
- aNewAttr.Put(*pItem);
- }
- else
- {
- FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle();
- aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) );
- }
- }
- break;
- }
- case SID_ATTR_CHAR_OVERLINE:
- {
- FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle();
- aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE));
- break;
- }
- case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
- case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break;
- case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
- case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
- case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
- case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
- case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
- case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break;
- case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
- case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
- case SID_ATTR_PARA_ADJUST_LEFT:
- aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_LEFT, EE_PARA_JUST));
- break;
- case SID_ATTR_PARA_ADJUST_CENTER:
- aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
- break;
- case SID_ATTR_PARA_ADJUST_RIGHT:
- aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_RIGHT, EE_PARA_JUST));
- break;
- case SID_ATTR_PARA_ADJUST_BLOCK:
- aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST));
- break;
-
- case SID_ATTR_PARA_LINESPACE_10:
- {
- SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL);
- aItem.SetPropLineSpace(100);
- aNewAttr.Put(aItem);
- }
- break;
- case SID_ATTR_PARA_LINESPACE_15:
- {
- SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL);
- aItem.SetPropLineSpace(150);
- aNewAttr.Put(aItem);
- }
- break;
- case SID_ATTR_PARA_LINESPACE_20:
- {
- SvxLineSpacingItem aItem(SVX_LINESPACE_TWO_LINES, EE_PARA_SBL);
- aItem.SetPropLineSpace(200);
- aNewAttr.Put(aItem);
- }
- break;
- case SID_SELECTALL:
- {
- Outliner * pOutliner = pOLV->GetOutliner();
- if(pOutliner)
- {
- sal_Int32 nParaCount = pOutliner->GetParagraphCount();
- if (nParaCount > 0)
- pOLV->SelectRange(0L, nParaCount );
- }
- break;
- }
- case FN_FORMAT_RESET:
- {
- pPostItMgr->GetActiveSidebarWin()->ResetAttributes();
- rReq.Done();
- break;
- }
- case FN_SET_SUPER_SCRIPT:
- {
- SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
- SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
- aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
-
- if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
- aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
- else
- aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
- aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
- }
- break;
- case FN_SET_SUB_SCRIPT:
- {
- SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
- SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
- aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
-
- if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
- aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
- else
- aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
- aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
- }
- break;
- case SID_HYPERLINK_SETLINK:
- {
- const SfxPoolItem* pItem = 0;
- if(pNewAttrs)
- pNewAttrs->GetItemState(nSlot, false, &pItem);
-
- if(pItem)
- {
- const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
- SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT);
- aFld.SetTargetFrame(rHLinkItem.GetTargetFrame());
-
- const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
-
- if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField))
- {
- // Select the field so that it will be deleted during insert
- ESelection aSel = pOLV->GetSelection();
- aSel.nEndPos++;
- pOLV->SetSelection(aSel);
- }
- if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
- pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD));
- }
- break;
- }
- case FN_INSERT_SOFT_HYPHEN:
- case FN_INSERT_HARDHYPHEN:
- case FN_INSERT_HARD_SPACE:
- case SID_INSERT_RLM :
- case SID_INSERT_LRM :
- case SID_INSERT_ZWNBSP :
- case SID_INSERT_ZWSP:
- {
- sal_Unicode cIns = 0;
- switch(rReq.GetSlot())
- {
- case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
- case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break;
- case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break;
- case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
- case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
- case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
- case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
- }
- pOLV->InsertText( OUString(cIns));
- rReq.Done();
- break;
- }
- case SID_CHARMAP:
- {
- if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
- InsertSymbol(rReq);
- break;
- }
- case FN_INSERT_STRING:
- {
- const SfxPoolItem* pItem = 0;
- if(pNewAttrs)
- pNewAttrs->GetItemState(nSlot, false, &pItem );
- if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
- pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue());
- break;
- }
-
- case FN_FORMAT_FOOTNOTE_DLG:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg(rView.GetWindow(), rView.GetWrtShell());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- break;
- }
- case FN_NUMBERING_OUTLINE_DLG:
- {
- SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
- rView.GetWindow(), &aTmp, rView.GetWrtShell());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- rReq.Done();
- }
- break;
- case SID_OPEN_XML_FILTERSETTINGS:
- {
- try
- {
- uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
- xDialog->execute();
- }
- catch (const uno::Exception&)
- {
- }
- rReq.Ignore ();
- }
- break;
- case FN_WORDCOUNT_DIALOG:
- {
- SfxViewFrame* pVFrame = rView.GetViewFrame();
- if (pVFrame != NULL)
- {
- pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
- Invalidate(rReq.GetSlot());
-
- SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
- if (pWrdCnt)
- pWrdCnt->UpdateCounts();
- }
- }
- break;
- case SID_CHAR_DLG_EFFECT:
- case SID_CHAR_DLG:
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
-
- if( !pArgs )
- {
- /* mod
- SwView* pView = &GetView();
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
- */
- SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
-
- // util::Language does not exist in the EditEngine! Therefore not included in the set.
-
- aDlgAttr.Put( aEditAttr );
- aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg( rView.GetWindow(), rView, aDlgAttr, DLG_CHAR_ANN);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if (nSlot == SID_CHAR_DLG_EFFECT)
- {
- pDlg->SetCurPageId("fonteffect");
- }
- sal_uInt16 nRet = pDlg->Execute();
- if(RET_OK == nRet )
- {
- rReq.Done( *( pDlg->GetOutputItemSet() ) );
- aNewAttr.Put(*pDlg->GetOutputItemSet());
- }
- delete( pDlg );
- if(RET_OK != nRet)
- return ;
- }
- else
- aNewAttr.Put(*pArgs);
- break;
- }
- case SID_PARA_DLG:
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
-
- if (!pArgs)
- {
- /* mod todo ???
- SwView* pView = &GetView();
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, eMetric));
- */
- SfxItemSet aDlgAttr(GetPool(),
- EE_ITEMS_START, EE_ITEMS_END,
- SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
- SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
- SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
- SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
- 0);
-
- aDlgAttr.Put(aEditAttr);
-
- aDlgAttr.Put( SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE) );
- aDlgAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
- aDlgAttr.Put( SvxFmtSplitItem( true, RES_PARATR_SPLIT ) );
- aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
- aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- SfxAbstractTabDialog* pDlg = pFact->CreateSwParaDlg( rView.GetWindow(), rView, aDlgAttr,DLG_STD, 0, sal_True );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- sal_uInt16 nRet = pDlg->Execute();
- if(RET_OK == nRet)
- {
- rReq.Done( *( pDlg->GetOutputItemSet() ) );
- aNewAttr.Put(*pDlg->GetOutputItemSet());
- }
- delete( pDlg );
- if(RET_OK != nRet)
- return;
- }
- else
- aNewAttr.Put(*pArgs);
- break;
- }
-
- case SID_AUTOSPELL_CHECK:
- {
- rView.ExecuteSlot(rReq);
- break;
- }
- case SID_ATTR_PARA_LEFT_TO_RIGHT:
- case SID_ATTR_PARA_RIGHT_TO_LEFT:
- {
- bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
-
- const SfxPoolItem* pPoolItem;
- if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, true, &pPoolItem ) )
- {
- if( !( (SfxBoolItem*)pPoolItem)->GetValue() )
- bLeftToRight = !bLeftToRight;
- }
- SfxItemSet aAttr( *aNewAttr.GetPool(),
- EE_PARA_JUST, EE_PARA_JUST,
- EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
- 0 );
-
- sal_uInt16 nAdjust = SVX_ADJUST_LEFT;
- if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) )
- nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
-
- if( bLeftToRight )
- {
- aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
- if( nAdjust == SVX_ADJUST_RIGHT )
- aAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
- }
- else
- {
- aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
- if( nAdjust == SVX_ADJUST_LEFT )
- aAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
- }
- pOLV->SetAttribs(aAttr);
- break;
- }
- }
-
- if(nEEWhich && pNewAttrs)
- aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich);
-
- Rectangle aNullRect;
- Rectangle aOutRect = pOLV->GetOutputArea();
- if (aNullRect != aOutRect)
- pOLV->SetAttribs(aNewAttr);
-
- rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
- if ( pOLV->GetOutliner()->IsModified() )
- rView.GetWrtShell().SetModified();
-
-}
-
-void SwAnnotationShell::GetState(SfxItemSet& rSet)
-{
- //TODO: clean this up!!!
- // FN_SET_SUPER_SCRIPT
- //SID_ATTR_PARA_ADJUST
- //SID_ATTR_PARA_ADJUST_BLOCK
-
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
- return;
-
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
- SfxItemSet aEditAttr(pOLV->GetAttribs());
-
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
- while(nWhich)
- {
- sal_uInt16 nEEWhich = 0;
- sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
- switch( nSlotId )
- {
- case SID_ATTR_PARA_LRSPACE:
- {
- SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE );
- if( eState >= SFX_ITEM_DEFAULT )
- {
- SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ) );
- aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
- rSet.Put(aLR);
- }
- else
- rSet.InvalidateItem(nSlotId);
- }
- break;
- case SID_ATTR_PARA_LINESPACE:
- {
- SfxItemState eState = aEditAttr.GetItemState( EE_PARA_SBL );
- if( eState >= SFX_ITEM_DEFAULT )
- {
- SvxLineSpacingItem aLR = ( (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL ) );
- rSet.Put(aLR);
- }
- else
- rSet.InvalidateItem(nSlotId);
- }
- break;
- case SID_ATTR_PARA_ULSPACE:
- {
- SfxItemState eState = aEditAttr.GetItemState( EE_PARA_ULSPACE );
- if( eState >= SFX_ITEM_DEFAULT )
- {
- SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
- aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
- rSet.Put(aULSpace);
- }
- else
- rSet.InvalidateItem(nSlotId);
- }
- break;
- case SID_ATTR_CHAR_FONT:
- case SID_ATTR_CHAR_FONTHEIGHT:
- case SID_ATTR_CHAR_WEIGHT:
- case SID_ATTR_CHAR_POSTURE:
- {
- if ( pOLV )
- {
- sal_uInt16 nScriptType = pOLV->GetSelectedScriptType();
- SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool();
- if( !pSecondPool )
- pSecondPool = aEditAttr.GetPool();
- SvxScriptSetItem aSetItem( nSlotId, *pSecondPool );
- aSetItem.GetItemSet().Put( aEditAttr, false );
- const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
- if( pI )
- rSet.Put( *pI, nWhich );
- else
- rSet.InvalidateItem( nWhich );
- }
- else
- rSet.InvalidateItem( nWhich );
- }
- break;
- case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
- case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
- case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
- case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
- case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break;
- case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
- case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
- case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT;break;
- case SID_ATTR_CHAR_KERNING: nEEWhich = EE_CHAR_KERNING;break;
- case FN_SET_SUPER_SCRIPT:
- case FN_SET_SUB_SCRIPT:
- {
- sal_uInt16 nEsc = 0;
- const SfxPoolItem *pEscItem = 0;
- if (nWhich==FN_SET_SUPER_SCRIPT)
- nEsc = SVX_ESCAPEMENT_SUPERSCRIPT;
- else
- nEsc = SVX_ESCAPEMENT_SUBSCRIPT;
-
- if( !pEscItem )
- pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT );
-
- if( nEsc == ((const SvxEscapementItem*)pEscItem)->GetEnumValue() )
- rSet.Put( SfxBoolItem( nWhich, true ));
- else
- rSet.InvalidateItem( nWhich );
- break;
- }
- case SID_ATTR_PARA_ADJUST_LEFT:
- case SID_ATTR_PARA_ADJUST_RIGHT:
- case SID_ATTR_PARA_ADJUST_CENTER:
- case SID_ATTR_PARA_ADJUST_BLOCK:
- {
- const SfxPoolItem *pAdjust = 0;
- int eAdjust = 0;
-
- if (nWhich==SID_ATTR_PARA_ADJUST_LEFT)
- eAdjust = SVX_ADJUST_LEFT;
- else if (nWhich==SID_ATTR_PARA_ADJUST_RIGHT)
- eAdjust = SVX_ADJUST_RIGHT;
- else if (nWhich==SID_ATTR_PARA_ADJUST_CENTER)
- eAdjust = SVX_ADJUST_CENTER;
- else if (nWhich==SID_ATTR_PARA_ADJUST_BLOCK)
- eAdjust = SVX_ADJUST_BLOCK;
-
- if( !pAdjust )
- aEditAttr.GetItemState( EE_PARA_JUST, false, &pAdjust);
-
- if( !pAdjust || IsInvalidItem( pAdjust ))
- rSet.InvalidateItem( nSlotId ), nSlotId = 0;
- else
- {
- if ( eAdjust == ((const SvxAdjustItem*)pAdjust)->GetAdjust())
- rSet.Put( SfxBoolItem( nWhich, true ));
- else
- rSet.InvalidateItem( nWhich );
- }
- break;
- }
- case SID_ATTR_PARA_LINESPACE_10:
- case SID_ATTR_PARA_LINESPACE_15:
- case SID_ATTR_PARA_LINESPACE_20:
- {
- const SfxPoolItem *pLSpace = 0;
- int nLSpace = 0;
-
- if (nWhich==SID_ATTR_PARA_LINESPACE_10)
- nLSpace = 100;
- else if (nWhich==SID_ATTR_PARA_LINESPACE_15)
- nLSpace = 150;
- else if (nWhich==SID_ATTR_PARA_LINESPACE_20)
- nLSpace = 200;
-
- if( !pLSpace )
- aEditAttr.GetItemState( EE_PARA_SBL, false, &pLSpace );
-
- if( !pLSpace || IsInvalidItem( pLSpace ))
- rSet.InvalidateItem( nSlotId ), nSlotId = 0;
- else
- {
- if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)->GetPropLineSpace() )
- rSet.Put( SfxBoolItem( nWhich, true ));
- else
- rSet.InvalidateItem( nWhich );
- }
- break;
- }
- case SID_AUTOSPELL_CHECK:
- {
- const SfxPoolItem* pState = rView.GetSlotState(nWhich);
- if (pState)
- rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue()));
- else
- rSet.DisableItem( nWhich );
- break;
- }
- case SID_ATTR_PARA_LEFT_TO_RIGHT:
- case SID_ATTR_PARA_RIGHT_TO_LEFT:
- {
- if ( !SvtLanguageOptions().IsCTLFontEnabled() )
- rSet.DisableItem( nWhich );
- else
- {
- if(pOLV->GetOutliner() && pOLV->GetOutliner()->IsVertical())
- rSet.DisableItem( nWhich );
- else
- {
- sal_Bool bFlag = sal_False;
- switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
- {
- case FRMDIR_HORI_LEFT_TOP:
- {
- bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
- rSet.Put( SfxBoolItem( nWhich, bFlag ));
- break;
- }
- case FRMDIR_HORI_RIGHT_TOP:
- {
- bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
- rSet.Put( SfxBoolItem( nWhich, bFlag ));
- break;
- }
- }
- }
- }
- }
- break;
- case SID_INSERT_RLM :
- case SID_INSERT_LRM :
- case SID_INSERT_ZWNBSP :
- case SID_INSERT_ZWSP:
- {
- SvtCTLOptions aCTLOptions;
- sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
- rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
- if(!bEnabled)
- rSet.DisableItem(nWhich);
- }
- break;
- default:
- rSet.InvalidateItem( nWhich );
- break;
- }
-
- if(nEEWhich)
- {
- rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
- if(nEEWhich == EE_CHAR_KERNING)
- {
- SfxItemState eState = aEditAttr.GetItemState( EE_CHAR_KERNING, true );
- if ( eState == SFX_ITEM_DONTCARE )
- {
- rSet.InvalidateItem(EE_CHAR_KERNING);
- }
- }
- }
-
- if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
- rSet.DisableItem( nWhich );
-
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwAnnotationShell::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage)
-{
- rView.ExecSearch(rReq,bNoMessage);
-}
-
-void SwAnnotationShell::StateSearch(SfxItemSet &rSet)
-{
- rView.StateSearch(rSet);
-}
-
-void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
- return;
-
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
- SfxItemSet aEditAttr(pOLV->GetAttribs());
- SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
-
- long aOldHeight = pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight();
- sal_uInt16 nSlot = rReq.GetSlot();
- switch (nSlot)
- {
- case SID_CUT:
- if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) && pOLV->HasSelection() )
- pOLV->Cut();
- break;
- case SID_COPY:
- if( pOLV->HasSelection() )
- pOLV->Copy();
- break;
- case SID_PASTE:
- if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
- pOLV->Paste();
- break;
- case SID_PASTE_SPECIAL:
- {
- if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED)
- {
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( &rView.GetEditWin() );
-
- pDlg->Insert( SOT_FORMAT_STRING, OUString() );
- pDlg->Insert( SOT_FORMAT_RTF, OUString() );
-
- TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) );
-
- sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
-
- if (nFormat > 0)
- {
- if (nFormat == SOT_FORMAT_STRING)
- pOLV->Paste();
- else
- pOLV->PasteSpecial();
- }
- delete pDlg;
- }
- break;
- }
- case SID_CLIPBOARD_FORMAT_ITEMS:
- {
- sal_uLong nFormat = 0;
- const SfxPoolItem* pItem;
- if ( rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, true, &pItem) == SFX_ITEM_SET &&
- pItem->ISA(SfxUInt32Item) )
- {
- nFormat = ((const SfxUInt32Item*)pItem)->GetValue();
- }
-
- if ( nFormat )
- {
- if (SOT_FORMAT_STRING == nFormat)
- pOLV->Paste();
- else
- pOLV->PasteSpecial();
- }
- break;
- }
- }
- pPostItMgr->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight,pPostItMgr->GetActiveSidebarWin()->GetPostItTextHeight());
-}
-
-void SwAnnotationShell::StateClpbrd(SfxItemSet &rSet)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
- return;
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
-
- TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( &rView.GetEditWin() ) );
- bool bPastePossible = ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) || aDataHelper.HasFormat( SOT_FORMAT_RTF ) );
- bPastePossible = bPastePossible && (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED);
-
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while(nWhich)
- {
- switch(nWhich)
- {
- case SID_CUT:
- {
- if ( (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED) || !pOLV->HasSelection() )
- rSet.DisableItem( nWhich );
- }
- case SID_COPY:
- {
- if( !pOLV->HasSelection() )
- rSet.DisableItem( nWhich );
- break;
- }
- case SID_PASTE:
- case SID_PASTE_SPECIAL:
- {
- if( !bPastePossible )
- rSet.DisableItem( nWhich );
- break;
- }
- case SID_CLIPBOARD_FORMAT_ITEMS:
- {
- if ( bPastePossible )
- {
- SvxClipboardFmtItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
- if ( aDataHelper.HasFormat( SOT_FORMAT_RTF ) )
- aFormats.AddClipbrdFormat( SOT_FORMAT_RTF );
- aFormats.AddClipbrdFormat( SOT_FORMAT_STRING );
- rSet.Put( aFormats );
- }
- else
- rSet.DisableItem( nWhich );
- break;
- }
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwAnnotationShell::StateStatusLine(SfxItemSet &rSet)
-{
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while( nWhich )
- {
- switch( nWhich )
- {
- case FN_STAT_SELMODE:
- {
- rSet.Put(SfxUInt16Item(FN_STAT_SELMODE, 0));
- rSet.DisableItem( nWhich );
- break;
- }
- case FN_STAT_TEMPLATE:
- {
- rSet.DisableItem( nWhich );
- break;
- }
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwAnnotationShell::StateInsert(SfxItemSet &rSet)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
- return;
-
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while(nWhich)
- {
- switch(nWhich)
- {
- case SID_HYPERLINK_GETLINK:
- {
- SvxHyperlinkItem aHLinkItem;
- aHLinkItem.SetInsertMode(HLINK_FIELD);
-
- const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
-
- if (pFieldItem)
- {
- const SvxFieldData* pField = pFieldItem->GetField();
-
- if (pField->ISA(SvxURLField))
- {
- aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
- aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
- aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
- }
- }
- else
- {
- OUString sSel(pOLV->GetSelected());
- sSel = sSel.copy(0, std::min<sal_Int32>(255, sSel.getLength()));
- aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' '));
- }
-
- sal_uInt16 nHtmlMode = ::GetHtmlMode(rView.GetDocShell());
- aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
- ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
-
- rSet.Put(aHLinkItem);
- }
- break;
- }
-
- if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
- rSet.DisableItem( nWhich );
-
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwAnnotationShell::NoteExec(SfxRequest &rReq)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr )
- return;
-
- sal_uInt16 nSlot = rReq.GetSlot();
- switch (nSlot)
- {
- case FN_REPLY:
- case FN_POSTIT:
- case FN_DELETE_COMMENT:
- if ( pPostItMgr->HasActiveSidebarWin() )
- pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot);
- break;
-
- case FN_DELETE_ALL_NOTES:
- pPostItMgr->Delete();
- break;
- case FN_DELETE_NOTE_AUTHOR:
- {
- SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, false);
- if ( pItem )
- pPostItMgr->Delete( pItem->GetValue() );
- break;
- }
- case FN_HIDE_NOTE:
- break;
- case FN_HIDE_ALL_NOTES:
- pPostItMgr->Hide();
- break;
- case FN_HIDE_NOTE_AUTHOR:
- {
- SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, nSlot, false);
- if ( pItem )
- pPostItMgr->Hide( pItem->GetValue() );
- }
- }
-}
-
-void SwAnnotationShell::GetNoteState(SfxItemSet &rSet)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
- while(nWhich)
- {
- sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
- switch( nSlotId )
- {
- case FN_POSTIT:
- case FN_DELETE_NOTE_AUTHOR:
- case FN_DELETE_ALL_NOTES:
- case FN_HIDE_NOTE:
- case FN_HIDE_NOTE_AUTHOR:
- case FN_HIDE_ALL_NOTES:
- case FN_DELETE_COMMENT:
- {
- if( !pPostItMgr
- || !pPostItMgr->HasActiveAnnotationWin() )
- {
- rSet.DisableItem(nWhich);
- }
- break;
- }
-
- case FN_REPLY:
- {
- if ( !pPostItMgr ||
- !pPostItMgr->HasActiveAnnotationWin() )
- {
- rSet.DisableItem(nWhich);
- }
- else
- {
- SvtUserOptions aUserOpt;
- OUString sAuthor;
- if( (sAuthor = aUserOpt.GetFullName()).isEmpty() &&
- (sAuthor = aUserOpt.GetID()).isEmpty() )
- sAuthor = SW_RES( STR_REDLINE_UNKNOWN_AUTHOR );
- if (sAuthor == pPostItMgr->GetActiveSidebarWin()->GetAuthor())
- rSet.DisableItem(nWhich);
- }
- break;
- }
- default:
- rSet.InvalidateItem( nWhich );
- break;
- }
-
- if (pPostItMgr->HasActiveSidebarWin())
- {
- if ( (pPostItMgr->GetActiveSidebarWin()->IsProtected()) &&
- ( (nSlotId==FN_DELETE_COMMENT) || (nSlotId==FN_REPLY) ) )
- rSet.DisableItem( nWhich );
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwAnnotationShell::ExecLingu(SfxRequest &rReq)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
- return;
-
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
- SfxItemSet aEditAttr(pOLV->GetAttribs());
- sal_uInt16 nSlot = rReq.GetSlot();
- SwWrtShell &rSh = rView.GetWrtShell();
- bool bRestoreSelection = false;
- ESelection aOldSelection;
-
- switch (nSlot)
- {
- case SID_LANGUAGE_STATUS:
- {
- aOldSelection = pOLV->GetSelection();
- if (!pOLV->GetEditView().HasSelection())
- {
- bRestoreSelection = true;
- pOLV->GetEditView().SelectCurrentWord();
- }
-
- bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,rView,rSh);
- break;
- }
- case SID_THES:
- {
- OUString aReplaceText;
- SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, false );
- if (pItem2)
- aReplaceText = pItem2->GetValue();
- if (!aReplaceText.isEmpty())
- ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
- break;
- }
- case SID_THESAURUS:
- {
- pOLV->StartThesaurus();
- break;
- }
- case SID_HANGUL_HANJA_CONVERSION:
- pOLV->StartTextConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL,
- i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false );
- break;
-
- case SID_CHINESE_CONVERSION:
- {
- //open ChineseTranslationDialog
- Reference< XComponentContext > xContext(
- ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
- if(xContext.is())
- {
- Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
- if(xMCF.is())
- {
- Reference< ui::dialogs::XExecutableDialog > xDialog(
- xMCF->createInstanceWithContext(
- OUString("com.sun.star.linguistic2.ChineseTranslationDialog")
- , xContext), UNO_QUERY);
- Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
- if( xInit.is() )
- {
- // initialize dialog
- Reference< awt::XWindow > xDialogParentWindow(0);
- Sequence<Any> aSeq(1);
- Any* pArray = aSeq.getArray();
- PropertyValue aParam;
- aParam.Name = "ParentWindow";
- aParam.Value <<= makeAny(xDialogParentWindow);
- pArray[0] <<= makeAny(aParam);
- xInit->initialize( aSeq );
-
- //execute dialog
- sal_Int16 nDialogRet = xDialog->execute();
- if( RET_OK == nDialogRet )
- {
- //get some parameters from the dialog
- sal_Bool bToSimplified = sal_True;
- sal_Bool bUseVariants = sal_True;
- sal_Bool bCommonTerms = sal_True;
- Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
- if( xProp.is() )
- {
- try
- {
- xProp->getPropertyValue( "IsDirectionToSimplified" ) >>= bToSimplified;
- xProp->getPropertyValue( "IsUseCharacterVariants" ) >>= bUseVariants;
- xProp->getPropertyValue( "IsTranslateCommonTerms" ) >>= bCommonTerms;
- }
- catch (const Exception&)
- {
- }
- }
-
- //execute translation
- sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
- sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
- sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
- if( !bCommonTerms )
- nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
-
- Font aTargetFont = pOLV->GetWindow()->GetDefaultFont( DEFAULTFONT_CJK_TEXT,
- nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
-
- pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false );
- }
- }
- Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
- if( xComponent.is() )
- xComponent->dispose();
- }
- }
- }
- break;
- }
-
- if (bRestoreSelection)
- {
- // restore selection
- pOLV->GetEditView().SetSelection( aOldSelection );
- }
-}
-
-void SwAnnotationShell::GetLinguState(SfxItemSet &rSet)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
- return;
-
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
- SfxItemSet aEditAttr(pOLV->GetAttribs());
-
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
- while(nWhich)
- {
- switch (nWhich)
- {
- case SID_LANGUAGE_STATUS:
- {
- SwLangHelper::GetLanguageStatus(pOLV,rSet);
- break;
- }
-
- case SID_THES:
- {
- OUString aStatusVal;
- LanguageType nLang = LANGUAGE_NONE;
- bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
- rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
-
- // disable "Thesaurus" context menu entry if there is nothing to look up
- uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
- if (!bIsLookUpWord ||
- !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
- rSet.DisableItem( SID_THES );
- break;
- }
-
- // disable "Thesaurus" if the language is not supported
- case SID_THESAURUS:
- {
- const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault(
- GetWhichOfScript( RES_CHRATR_LANGUAGE,
- GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) );
- LanguageType nLang = ((const SvxLanguageItem &)
- rItem).GetLanguage();
- uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
- if (!xThes.is() || nLang == LANGUAGE_NONE ||
- !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
- rSet.DisableItem( SID_THESAURUS );
- }
- break;
- case SID_HANGUL_HANJA_CONVERSION:
- case SID_CHINESE_CONVERSION:
- {
- if (!SvtCJKOptions().IsAnyEnabled())
- {
- rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
- rSet.DisableItem(nWhich);
- }
- else
- rView.GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
- }
- break;
- }
-
- if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
- rSet.DisableItem( nWhich );
-
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwAnnotationShell::ExecTransliteration(SfxRequest &rReq)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
- return;
-
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
-
- if (!pOLV)
- return;
-
- using namespace ::com::sun::star::i18n;
-
- sal_uInt32 nMode = 0;
-
- switch( rReq.GetSlot() )
- {
- case SID_TRANSLITERATE_SENTENCE_CASE:
- nMode = TransliterationModulesExtra::SENTENCE_CASE;
- break;
- case SID_TRANSLITERATE_TITLE_CASE:
- nMode = TransliterationModulesExtra::TITLE_CASE;
- break;
- case SID_TRANSLITERATE_TOGGLE_CASE:
- nMode = TransliterationModulesExtra::TOGGLE_CASE;
- break;
- case SID_TRANSLITERATE_UPPER:
- nMode = TransliterationModules_LOWERCASE_UPPERCASE;
- break;
- case SID_TRANSLITERATE_LOWER:
- nMode = TransliterationModules_UPPERCASE_LOWERCASE;
- break;
- case SID_TRANSLITERATE_HALFWIDTH:
- nMode = TransliterationModules_FULLWIDTH_HALFWIDTH;
- break;
- case SID_TRANSLITERATE_FULLWIDTH:
- nMode = TransliterationModules_HALFWIDTH_FULLWIDTH;
- break;
- case SID_TRANSLITERATE_HIRAGANA:
- nMode = TransliterationModules_KATAKANA_HIRAGANA;
- break;
- case SID_TRANSLITERATE_KATAGANA:
- nMode = TransliterationModules_HIRAGANA_KATAKANA;
- break;
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- }
-
- if( nMode )
- pOLV->TransliterateText( nMode );
-}
-
-void SwAnnotationShell::ExecRotateTransliteration( SfxRequest & rReq )
-{
- if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
- {
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if (!pPostItMgr || !pPostItMgr->HasActiveSidebarWin())
- return;
-
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
-
- if (!pOLV)
- return;
-
- pOLV->TransliterateText(m_aRotateCase.getNextMode());
- }
-}
-
-void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
-{
- const SfxItemSet* pArgs = rReq.GetArgs();
- ::svl::IUndoManager* pUndoManager = GetUndoManager();
- SwWrtShell &rSh = rView.GetWrtShell();
-
- long aOldHeight = rView.GetPostItMgr()->HasActiveSidebarWin()
- ? rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight()
- : 0;
-
- sal_uInt16 nId = rReq.GetSlot();
- sal_uInt16 nCnt = 1;
- const SfxPoolItem* pItem=0;
- if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, false, &pItem ) )
- nCnt = ((SfxUInt16Item*)pItem)->GetValue();
- switch( nId )
- {
- case SID_UNDO:
- {
- if ( pUndoManager )
- {
- sal_uInt16 nCount = pUndoManager->GetUndoActionCount();
- sal_uInt16 nSteps = nCnt;
- if ( nCount < nCnt )
- {
- nCnt = nCnt - nCount;
- nSteps = nCount;
- }
- else
- nCnt = 0;
-
- while( nSteps-- )
- pUndoManager->Undo();
- }
-
- if ( nCnt )
- rSh.Do( SwWrtShell::UNDO, nCnt );
-
- break;
- }
-
- case SID_REDO:
- {
- if ( pUndoManager )
- {
- sal_uInt16 nCount = pUndoManager->GetRedoActionCount();
- sal_uInt16 nSteps = nCnt;
- if ( nCount < nCnt )
- {
- nCnt = nCnt - nCount;
- nSteps = nCount;
- }
- else
- nCnt = 0;
-
- while( nSteps-- )
- pUndoManager->Redo();
- }
-
- if ( nCnt )
- rSh.Do( SwWrtShell::REDO, nCnt );
-
- break;
- }
- }
-
- rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
-
- if (rView.GetPostItMgr()->HasActiveSidebarWin())
- rView.GetPostItMgr()->GetActiveSidebarWin()->ResizeIfNecessary(aOldHeight,rView.GetPostItMgr()->GetActiveSidebarWin()->GetPostItTextHeight());
-}
-
-void SwAnnotationShell::StateUndo(SfxItemSet &rSet)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
- return;
-
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
- ::svl::IUndoManager* pUndoManager = GetUndoManager();
- SfxViewFrame *pSfxViewFrame = rView.GetViewFrame();
- SwWrtShell &rSh = rView.GetWrtShell();
-
- while( nWhich )
- {
- switch ( nWhich )
- {
- case SID_UNDO:
- {
- sal_uInt16 nCount = pUndoManager->GetUndoActionCount();
- if ( nCount )
- pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
- else if (rSh.GetLastUndoInfo(0, 0))
- {
- rSet.Put( SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::UNDO)) );
- }
- else
- rSet.DisableItem(nWhich);
- break;
- }
- case SID_REDO:
- {
- sal_uInt16 nCount = pUndoManager->GetRedoActionCount();
- if ( nCount )
- pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
- else if (rSh.GetFirstRedoInfo(0))
- {
- rSet.Put(SfxStringItem( nWhich, rSh.GetDoString(SwWrtShell::REDO)) );
- }
- else
- rSet.DisableItem(nWhich);
- break;
- }
- case SID_GETUNDOSTRINGS:
- case SID_GETREDOSTRINGS:
- {
- if( pUndoManager )
- {
- OUString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const;
-
- sal_uInt16 nCount;
- if( SID_GETUNDOSTRINGS == nWhich )
- {
- nCount = pUndoManager->GetUndoActionCount();
- fnGetComment = &::svl::IUndoManager::GetUndoActionComment;
- }
- else
- {
- nCount = pUndoManager->GetRedoActionCount();
- fnGetComment = &::svl::IUndoManager::GetRedoActionComment;
- }
-
- OUString sList;
- if( nCount )
- {
- for( sal_uInt16 n = 0; n < nCount; ++n )
- sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) + "\n";
- }
-
- SfxStringListItem aItem( nWhich );
- if ((nWhich == SID_GETUNDOSTRINGS) &&
- rSh.GetLastUndoInfo(0, 0))
- {
- rSh.GetDoStrings( SwWrtShell::UNDO, aItem );
- }
- else if ((nWhich == SID_GETREDOSTRINGS) &&
- (rSh.GetFirstRedoInfo(0)))
- {
- rSh.GetDoStrings( SwWrtShell::UNDO, aItem );
- }
-
- sList += aItem.GetString();
- aItem.SetString( sList );
- rSet.Put( aItem );
- }
- else
- rSet.DisableItem( nWhich );
- }
- break;
-
- default:
- {
- pSfxViewFrame->GetSlotState( nWhich, pSfxViewFrame->GetInterface(), &rSet );
- break;
- }
-
- }
-
- if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()==SwPostItHelper::DELETED)
- rSet.DisableItem( nWhich );
-
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwAnnotationShell::StateDisableItems( SfxItemSet &rSet )
-{
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
- while (nWhich)
- {
- rSet.DisableItem( nWhich );
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
-{
- SwPostItMgr* pPostItMgr = rView.GetPostItMgr();
- if ( !pPostItMgr || !pPostItMgr->HasActiveSidebarWin() )
- return;
-
- OutlinerView* pOLV = pPostItMgr->GetActiveSidebarWin()->GetOutlinerView();
-
- const SfxItemSet *pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem = 0;
- if( pArgs )
- pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), false, &pItem);
-
- OUString sSym;
- OUString sFontName;
- if ( pItem )
- {
- sSym = ((const SfxStringItem*)pItem)->GetValue();
- const SfxPoolItem* pFtItem = NULL;
- pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem);
- const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
- if ( pFontItem )
- sFontName = pFontItem->GetValue();
- }
-
- SfxItemSet aSet(pOLV->GetAttribs());
- sal_uInt16 nScript = pOLV->GetSelectedScriptType();
- SvxFontItem aSetDlgFont( RES_CHRATR_FONT );
- {
- SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
- aSetItem.GetItemSet().Put( aSet, false );
- const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
- if( pI )
- aSetDlgFont = *(SvxFontItem*)pI;
- else
- aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
- SID_ATTR_CHAR_FONT,
- GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ));
- if (sFontName.isEmpty())
- sFontName = aSetDlgFont.GetFamilyName();
- }
-
- Font aFont(sFontName, Size(1,1));
- if( sSym.isEmpty() )
- {
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
-
- SfxAllItemSet aAllSet( GetPool() );
- aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
-
- SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions());
- OUString sSymbolFont = aOpt.GetSymbolFont();
- if( !sSymbolFont.isEmpty() )
- aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
- else
- aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) );
-
- // If character is selected then it can be shown.
- SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet,
- rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
-
- sal_uInt16 nResult = pDlg->Execute();
- if( nResult == RET_OK )
- {
- SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, false );
- SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, false );
- if ( pFontItem )
- {
- aFont.SetName( pFontItem->GetFamilyName() );
- aFont.SetStyleName( pFontItem->GetStyleName() );
- aFont.SetCharSet( pFontItem->GetCharSet() );
- aFont.SetPitch( pFontItem->GetPitch() );
- }
-
- if ( pCItem )
- {
- sSym = pCItem->GetValue();
- aOpt.SetSymbolFont(aFont.GetName());
- SW_MOD()->ApplyUsrPref(aOpt, &rView);
- }
- }
-
- delete( pDlg );
- }
-
- if( !sSym.isEmpty() )
- {
- // do not flicker
- pOLV->HideCursor();
- Outliner * pOutliner = pOLV->GetOutliner();
- pOutliner->SetUpdateMode(false);
-
- SfxItemSet aOldSet( pOLV->GetAttribs() );
- SfxItemSet aFontSet( *aOldSet.GetPool(),
- EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
- EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CJK,
- EE_CHAR_FONTINFO_CTL, EE_CHAR_FONTINFO_CTL,
- 0 );
- aFontSet.Set( aOldSet );
-
- // Insert string
- pOLV->InsertText( sSym);
-
- // Attributing (set font)
- SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() );
- SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(),
- aFont.GetStyleName(), aFont.GetPitch(),
- aFont.GetCharSet(),
- EE_CHAR_FONTINFO );
- sal_uInt16 nScriptBreak = g_pBreakIt->GetAllScriptsOfText( sSym );
- if( SCRIPTTYPE_LATIN & nScriptBreak )
- aSetFont.Put( aFontItem, EE_CHAR_FONTINFO );
- if( SCRIPTTYPE_ASIAN & nScriptBreak )
- aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CJK );
- if( SCRIPTTYPE_COMPLEX & nScriptBreak )
- aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CTL );
- pOLV->SetAttribs(aSetFont);
-
- // Erase selection
- ESelection aSel(pOLV->GetSelection());
- aSel.nStartPara = aSel.nEndPara;
- aSel.nStartPos = aSel.nEndPos;
- pOLV->SetSelection(aSel);
-
- // Restore old font
- pOLV->SetAttribs( aFontSet );
-
- // From now on show it again
- pOutliner->SetUpdateMode(true);
- pOLV->ShowCursor();
-
- rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
- if(!aFont.GetName().isEmpty())
- rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) );
- rReq.Done();
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx
deleted file mode 100644
index 797f9dee8749..000000000000
--- a/sw/source/ui/shells/basesh.cxx
+++ /dev/null
@@ -1,2832 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sot/factory.hxx>
-#include <hintids.hxx>
-#include <svl/urihelper.hxx>
-#include <svl/languageoptions.hxx>
-
-#include <svx/svxids.hrc>
-#include <sfx2/linkmgr.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <svx/imapdlg.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/docfile.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/request.hxx>
-#include <svl/whiter.hxx>
-#include <svl/visitem.hxx>
-#include <sfx2/objitem.hxx>
-#include <vcl/graphicfilter.hxx>
-#include <svx/gallery.hxx>
-#include <editeng/langitem.hxx>
-#include <svx/clipfmtitem.hxx>
-#include <svx/contdlg.hxx>
-#include <vcl/graph.hxx>
-#include <svl/slstitm.hxx>
-#include <vcl/msgbox.hxx>
-#include <svl/ptitem.hxx>
-#include <svl/itemiter.hxx>
-#include <svl/stritem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/shaditem.hxx>
-#include <editeng/boxitem.hxx>
-#include <svl/srchitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/brushitem.hxx>
-#include <editeng/opaqitem.hxx>
-#include <editeng/sizeitem.hxx>
-#include <svx/flagsdef.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <sfx2/objface.hxx>
-#include <fmturl.hxx>
-#include <fmthdft.hxx>
-#include <fmtclds.hxx>
-#include <docsh.hxx>
-#include <wrtsh.hxx>
-#include <view.hxx>
-#include <swmodule.hxx>
-#include <swundo.hxx>
-#include <fldbas.hxx>
-#include <uitool.hxx>
-#include <basesh.hxx>
-#include <viewopt.hxx>
-#include <fontcfg.hxx>
-#include <docstat.hxx>
-#include <usrfld.hxx>
-#include <expfld.hxx>
-#include <fldmgr.hxx>
-#include <frmmgr.hxx>
-#include <tablemgr.hxx>
-#include <mdiexp.hxx>
-#include <swdtflvr.hxx>
-#include <pagedesc.hxx>
-#include <convert.hxx>
-#include <fmtcol.hxx>
-#include <edtwin.hxx>
-#include <tblafmt.hxx>
-#include <caption.hxx>
-#include <swwait.hxx>
-#include <cmdid.h>
-#include <globals.hrc>
-#include <shells.hrc>
-#include <statstr.hrc>
-#include <globals.h>
-#include <unotxdoc.hxx>
-#include <crsskip.hxx>
-#include <fmtinfmt.hxx>
-#include <doc.hxx>
-
-#include "swabstdlg.hxx"
-#include "dialog.hrc"
-#include "fldui.hrc"
-#include "table.hrc"
-#include <modcfg.hxx>
-#include <instable.hxx>
-#include <svx/fmshell.hxx>
-#include <SwRewriter.hxx>
-#include <comcore.hrc>
-
-#include <unomid.h>
-#include <svx/galleryitem.hxx>
-#include <com/sun/star/gallery/GalleryItemType.hpp>
-
-FlyMode SwBaseShell::eFrameMode = FLY_DRAG_END;
-
-// These variables keep the state of Gallery (slot SID_GALLERY_BG_BRUSH)
-// detected by GetGalleryState() for the subsequent ExecuteGallery() call.
-
-static sal_uInt8 nParagraphPos;
-static sal_uInt8 nGraphicPos;
-static sal_uInt8 nOlePos;
-static sal_uInt8 nFramePos;
-static sal_uInt8 nTablePos;
-static sal_uInt8 nTableRowPos;
-static sal_uInt8 nTableCellPos;
-static sal_uInt8 nPagePos;
-static sal_uInt8 nHeaderPos;
-static sal_uInt8 nFooterPos;
-
-#define SwBaseShell
-#include <sfx2/msg.hxx>
-#include "swslots.hxx"
-
-#define SWCONTOURDLG(rView) ( (SvxContourDlg*) ( rView.GetViewFrame()->GetChildWindow( \
- SvxContourDlgChildWindow::GetChildWindowId() )-> \
- GetWindow() ) )
-
-#define SWIMAPDLG(rView) ( (SvxIMapDlg*) ( rView.GetViewFrame()->GetChildWindow( \
- SvxIMapDlgChildWindow::GetChildWindowId() )-> \
- GetWindow() ) )
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::frame;
-using namespace ::com::sun::star::lang;
-
-SFX_IMPL_INTERFACE(SwBaseShell, SfxShell, SW_RES(0))
-{
- SFX_CHILDWINDOW_REGISTRATION(SvxIMapDlgChildWindow::GetChildWindowId());
- SFX_CHILDWINDOW_REGISTRATION(SvxContourDlgChildWindow::GetChildWindowId());
-}
-
-TYPEINIT1(SwBaseShell,SfxShell)
-
-static void lcl_UpdateIMapDlg( SwWrtShell& rSh )
-{
- Graphic aGrf( rSh.GetIMapGraphic() );
- GraphicType nGrfType = aGrf.GetType();
- void* pEditObj = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType
- ? rSh.GetIMapInventor() : 0;
- TargetList* pList = new TargetList;
- rSh.GetView().GetViewFrame()->GetTopFrame().GetTargetList(*pList);
-
- SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
- rSh.GetFlyFrmAttr( aSet );
- const SwFmtURL &rURL = (SwFmtURL&)aSet.Get( RES_URL );
- SvxIMapDlgChildWindow::UpdateIMapDlg(
- aGrf, rURL.GetMap(), pList, pEditObj );
-
- delete pList;
-}
-
-static bool lcl_UpdateContourDlg( SwWrtShell &rSh, int nSel )
-{
- Graphic aGraf( rSh.GetIMapGraphic() );
- GraphicType nGrfType = aGraf.GetType();
- bool bRet = GRAPHIC_NONE != nGrfType && GRAPHIC_DEFAULT != nGrfType;
- if( bRet )
- {
- OUString aGrfName;
- if ( nSel & nsSelectionType::SEL_GRF )
- rSh.GetGrfNms( &aGrfName, 0 );
-
- SvxContourDlg *pDlg = SWCONTOURDLG(rSh.GetView());
- pDlg->Update( aGraf, !aGrfName.isEmpty(),
- rSh.GetGraphicPolygon(), rSh.GetIMapInventor() );
- }
- return bRet;
-}
-
-void SwBaseShell::ExecDelete(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- SwEditWin& rTmpEditWin = GetView().GetEditWin();
- switch(rReq.GetSlot())
- {
- case SID_DELETE:
- rSh.DelRight();
- break;
-
- case FN_BACKSPACE:
-
- if( rSh.IsNoNum() )
- {
- rSh.SttCrsrMove();
- sal_Bool bLeft = rSh.Left( CRSR_SKIP_CHARS, sal_True, 1, sal_False );
- if( bLeft )
- {
- rSh.DelLeft();
- }
- else
- // JP 15.07.96: If it no longer goes forward, cancel
- // the numbering. For example at the beginning
- // of a doc, frame, table or an area.
- rSh.DelNumRules();
-
- rSh.EndCrsrMove();
- break;
- }
-
- // otherwise call DelLeft
- case FN_SHIFT_BACKSPACE:
- rSh.DelLeft();
- break;
- default:
- OSL_FAIL("wrong Dispatcher");
- return;
- }
- rReq.Done();
-
- //#i42732# - notify the edit window that from now on we do not use the input language
- rTmpEditWin.SetUseInputLanguage( sal_False );
-}
-
-void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
-{
- // Attention: At risk of suicide!
- // After paste, paste special the shell can be destroy.
-
- SwWrtShell &rSh = GetShell();
- sal_uInt16 nId = rReq.GetSlot();
- bool bIgnore = false;
- switch( nId )
- {
- case SID_CUT:
- case SID_COPY:
- rView.GetEditWin().FlushInBuffer();
- if ( rSh.HasSelection() )
- {
- SwTransferable* pTransfer = new SwTransferable( rSh );
-/*??*/ uno::Reference< datatransfer::XTransferable > xRef( pTransfer );
-
- if ( nId == SID_CUT && !rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) )
- pTransfer->Cut();
- else
- {
- const sal_Bool bLockedView = rSh.IsViewLocked();
- rSh.LockView( sal_True ); //lock visible section
- pTransfer->Copy();
- rSh.LockView( bLockedView );
- }
- break;
- }
- return;
-
- case SID_PASTE:
- {
- TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin() ) );
- if( aDataHelper.GetXTransferable().is()
- && SwTransferable::IsPaste( rSh, aDataHelper )
- && !rSh.CrsrInsideInputFld() )
- {
- // Temporary variables, because the shell could already be
- // destroyed after the paste.
- SwView* pView = &rView;
- SwTransferable::Paste( rSh, aDataHelper );
- if( rSh.IsFrmSelected() || rSh.IsObjSelected() )
- rSh.EnterSelFrmMode();
- pView->AttrChangedNotify( &rSh );
- }
- else
- return;
- }
- break;
-
- case SID_CLIPBOARD_FORMAT_ITEMS:
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
- const SfxPoolItem* pFmt;
- if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, false, &pFmt ) )
- {
- TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &rSh.GetView().GetEditWin()) );
- if( aDataHelper.GetXTransferable().is()
- /*&& SwTransferable::IsPaste( rSh, aDataHelper )*/ )
- {
- // Temporary variables, because the shell could already be
- // destroyed after the paste.
- SwView* pView = &rView;
-
- SwTransferable::PasteFormat( rSh, aDataHelper,
- ((SfxUInt32Item*)pFmt)->GetValue() );
-
- //Done() has to be called before the shell has been removed
- rReq.Done();
- bIgnore = true;
- if( rSh.IsFrmSelected() || rSh.IsObjSelected())
- rSh.EnterSelFrmMode();
- pView->AttrChangedNotify( &rSh );
- }
- }
- }
- break;
-
- case SID_PASTE_UNFORMATTED:
- {
- TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) );
- if( aDataHelper.GetXTransferable().is()
- && SwTransferable::IsPaste( rSh, aDataHelper ) )
- {
- // Temporary variables, because the shell could already be
- // destroyed after the paste.
- SwView* pView = &rView;
- rReq.Ignore();
- bIgnore = true;
- if(SwTransferable::PasteUnformatted( rSh, aDataHelper ))
- {
- SfxViewFrame* pViewFrame = pView->GetViewFrame();
- uno::Reference< frame::XDispatchRecorder > xRecorder =
- pViewFrame->GetBindings().GetRecorder();
- if(xRecorder.is()) {
- SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
- aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, SOT_FORMAT_STRING ) );
- aReq.Done();
- }
- }
-
- if (rSh.IsFrmSelected() || rSh.IsObjSelected())
- rSh.EnterSelFrmMode();
- pView->AttrChangedNotify( &rSh );
- }
- else
- return;
- }
- break;
-
- case SID_PASTE_SPECIAL:
- {
- TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard( &rSh.GetView().GetEditWin()) );
- if( aDataHelper.GetXTransferable().is()
- && SwTransferable::IsPaste( rSh, aDataHelper )
- && !rSh.CrsrInsideInputFld() )
- {
- // Temporary variables, because the shell could already be
- // destroyed after the paste.
- SwView* pView = &rView;
- sal_uLong nFormatId = 0;
- rReq.Ignore();
- bIgnore = true;
- if(SwTransferable::PasteSpecial( rSh, aDataHelper, nFormatId ))
- {
- SfxViewFrame* pViewFrame = pView->GetViewFrame();
- uno::Reference< frame::XDispatchRecorder > xRecorder =
- pViewFrame->GetBindings().GetRecorder();
- if(xRecorder.is()) {
- SfxRequest aReq( pViewFrame, SID_CLIPBOARD_FORMAT_ITEMS );
- aReq.AppendItem( SfxUInt32Item( SID_CLIPBOARD_FORMAT_ITEMS, nFormatId ) );
- aReq.Done();
- }
- }
-
- if (rSh.IsFrmSelected() || rSh.IsObjSelected())
- rSh.EnterSelFrmMode();
- pView->AttrChangedNotify( &rSh );
- }
- else
- return;
- }
- break;
-
- default:
- OSL_FAIL("wrong Dispatcher");
- return;
- }
- if(!bIgnore)
- rReq.Done();
-}
-
-// ClipBoard state
-
-void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
-{
- SwWrtShell &rSh = GetShell();
- SfxWhichIter aIter(rSet);
-
- const sal_Bool bCopy = rSh.HasSelection();
-
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while(nWhich)
- {
- switch(nWhich)
- {
- case SID_CUT:
- if( 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) )
- {
- rSet.DisableItem( nWhich );
- break;
- }
- case SID_COPY:
- if( !bCopy )
- rSet.DisableItem( nWhich );
- break;
-
- case SID_PASTE:
- if( !GetView().IsPasteAllowed()
- || rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case SID_PASTE_SPECIAL:
- if( !GetView().IsPasteSpecialAllowed()
- || rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case SID_PASTE_UNFORMATTED:
- if( !GetView().IsPasteSpecialAllowed() )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case SID_CLIPBOARD_FORMAT_ITEMS:
- {
- TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard(
- &rSh.GetView().GetEditWin()) );
-
- SvxClipboardFmtItem aFmtItem( nWhich );
- SwTransferable::FillClipFmtItem( rSh, aDataHelper, aFmtItem );
- rSet.Put( aFmtItem );
- }
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-// Perform undo
-
-void SwBaseShell::ExecUndo(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
-
- sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
- const SfxItemSet* pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem;
- if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, false, &pItem ))
- nCnt = ((SfxUInt16Item*)pItem)->GetValue();
-
- // #i106349#: save pointer: undo/redo may delete the shell, i.e., this!
- SfxViewFrame *const pViewFrame( GetView().GetViewFrame() );
-
- switch( nId )
- {
- case SID_UNDO:
- rSh.LockPaint();
- rSh.Do( SwWrtShell::UNDO, nCnt );
- rSh.UnlockPaint();
- break;
-
- case SID_REDO:
- rSh.LockPaint();
- rSh.Do( SwWrtShell::REDO, nCnt );
- rSh.UnlockPaint();
- break;
-
- case SID_REPEAT:
- rSh.Do( SwWrtShell::REPEAT );
- break;
- default:
- OSL_FAIL("wrong Dispatcher");
- }
-
- if (pViewFrame) { pViewFrame->GetBindings().InvalidateAll(sal_False); }
-}
-
-// State of undo
-
-void SwBaseShell::StateUndo(SfxItemSet &rSet)
-{
- SwWrtShell &rSh = GetShell();
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
- while(nWhich)
- {
- switch(nWhich)
- {
- case SID_UNDO:
- {
- if (rSh.GetLastUndoInfo(0, 0))
- {
- rSet.Put( SfxStringItem(nWhich,
- rSh.GetDoString(SwWrtShell::UNDO)));
- }
- else
- rSet.DisableItem(nWhich);
- break;
- }
- case SID_REDO:
- {
- if (rSh.GetFirstRedoInfo(0))
- {
- rSet.Put(SfxStringItem(nWhich,
- rSh.GetDoString(SwWrtShell::REDO)));
- }
- else
- rSet.DisableItem(nWhich);
- break;
- }
- case SID_REPEAT:
- { // Repeat is only possible if no REDO is possible - UI-Restriction
- if ((!rSh.GetFirstRedoInfo(0)) &&
- !rSh.IsSelFrmMode() &&
- (UNDO_EMPTY != rSh.GetRepeatInfo(0)))
- {
- rSet.Put(SfxStringItem(nWhich, rSh.GetRepeatString()));
- }
- else
- rSet.DisableItem(nWhich);
- break;
- }
-
- case SID_GETUNDOSTRINGS:
- if (rSh.GetLastUndoInfo(0, 0))
- {
- SfxStringListItem aStrLst( nWhich );
- rSh.GetDoStrings( SwWrtShell::UNDO, aStrLst );
- rSet.Put( aStrLst );
- }
- else
- rSet.DisableItem( nWhich );
- break;
-
- case SID_GETREDOSTRINGS:
- if (rSh.GetFirstRedoInfo(0))
- {
- SfxStringListItem aStrLst( nWhich );
- rSh.GetDoStrings( SwWrtShell::REDO, aStrLst );
- rSet.Put( aStrLst );
- }
- else
- rSet.DisableItem( nWhich );
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-// Evaluate respectively dispatching the slot Id
-
-void SwBaseShell::Execute(SfxRequest &rReq)
-{
- const SfxPoolItem *pItem;
- SwWrtShell &rSh = GetShell();
- const SfxItemSet* pArgs = rReq.GetArgs();
- bool bMore = false;
-
- sal_uInt16 nSlot = rReq.GetSlot();
- switch(nSlot)
- {
- case FN_REPAGINATE:
- {
- Reference < XModel > xModel = GetView().GetDocShell()->GetModel();
- Reference < XUnoTunnel > xDocTunnel ( xModel, UNO_QUERY );
- SwXTextDocument *pDoc = reinterpret_cast < SwXTextDocument * > ( xDocTunnel->getSomething ( SwXTextDocument::getUnoTunnelId() ) );
- pDoc->NotifyRefreshListeners();
- rSh.CalcLayout();
- }
- break;
- case FN_UPDATE_FIELDS:
- {
- rSh.UpdateDocStat();
- rSh.EndAllTblBoxEdit();
- rSh.SwViewShell::UpdateFlds(sal_True);
-
- if( rSh.IsCrsrInTbl() )
- {
- if( !rSh.IsTblComplexForChart() )
- SwTableFUNC( &rSh, sal_False).UpdateChart();
- rSh.ClearTblBoxCntnt();
- rSh.SaveTblBoxCntnt();
- }
- }
- break;
- case FN_UPDATE_CHARTS:
- {
- SwWait aWait( *rView.GetDocShell(), true );
- rSh.UpdateAllCharts();
- }
- break;
-
- case FN_UPDATE_ALL:
- {
- SwView& rTempView = GetView();
- rSh.EnterStdMode();
- if( !rSh.GetLinkManager().GetLinks().empty() )
- {
- rSh.StartAllAction();
- rSh.GetLinkManager().UpdateAllLinks( false, true, true );
- rSh.EndAllAction();
- }
- SfxDispatcher &rDis = *rTempView.GetViewFrame()->GetDispatcher();
- rDis.Execute( FN_UPDATE_FIELDS );
- rDis.Execute( FN_UPDATE_TOX );
- rDis.Execute( FN_UPDATE_CHARTS );
- rSh.CalcLayout();
- }
- break;
-
- case FN_UPDATE_INPUTFIELDS:
- rSh.UpdateInputFlds();
- break;
-
- case FN_PREV_BOOKMARK:
- rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoPrevBookmark()));
- break;
- case FN_NEXT_BOOKMARK:
- rReq.SetReturnValue(SfxBoolItem( nSlot, rSh.GoNextBookmark()));
- break;
-
- case FN_GOTO_NEXT_MARK:
- case FN_GOTO_PREV_MARK:
- {
- SwFldMgr aFldMgr;
- SwFieldType* pFldType = aFldMgr.GetFldType(RES_JUMPEDITFLD);
-
- if (pFldType)
- {
- if (rSh.IsSelFrmMode())
- {
- rSh.UnSelectFrm();
- rSh.LeaveSelFrmMode();
- }
-
- if (rSh.HasMark())
- {
- SwMvContext aMvContext(&rSh);
- if (rSh.IsCrsrPtAtEnd())
- rSh.SwapPam();
- rSh.ClearMark();
- rSh.EndSelect();
- }
- sal_Bool bRet = rSh.MoveFldType( pFldType, nSlot == FN_GOTO_NEXT_MARK );
- SwField* pCurField = bRet ? rSh.GetCurFld() : 0;
- if (pCurField)
- rSh.ClickToField(*pCurField);
- rReq.SetReturnValue(SfxBoolItem( nSlot, bRet));
- }
- }
- break;
-
- case FN_START_DOC_DIRECT:
- case FN_END_DOC_DIRECT:
- {
- if (rSh.IsSelFrmMode())
- {
- rSh.UnSelectFrm();
- rSh.LeaveSelFrmMode();
- }
- rSh.EnterStdMode();
- nSlot == FN_START_DOC_DIRECT ?
- rSh.SttEndDoc(sal_True) :
- rSh.SttEndDoc(sal_False);
- }
- break;
- case FN_GOTO_PREV_OBJ:
- case FN_GOTO_NEXT_OBJ:
- {
- sal_Bool bSuccess = rSh.GotoObj(
- nSlot == FN_GOTO_NEXT_OBJ ? sal_True : sal_False);
- rReq.SetReturnValue(SfxBoolItem(nSlot, bSuccess));
- if (bSuccess && !rSh.IsSelFrmMode())
- {
- rSh.HideCrsr();
- rSh.EnterSelFrmMode();
- GetView().AttrChangedNotify( &rSh );
- }
- }
- break;
- case SID_GALLERY_FORMATS:
- {
- SFX_ITEMSET_ARG( pArgs, pGalleryItem, SvxGalleryItem, SID_GALLERY_FORMATS, false );
- if ( !pGalleryItem )
- break;
-
- const int nSelType = rSh.GetSelectionType();
- sal_Int8 nGalleryItemType( pGalleryItem->GetType() );
-
- if ( (!rSh.IsSelFrmMode() || nSelType & nsSelectionType::SEL_GRF) &&
- nGalleryItemType == com::sun::star::gallery::GalleryItemType::GRAPHIC )
- {
- SwWait aWait( *rView.GetDocShell(), true );
-
- OUString aGrfName, aFltName;
- const Graphic aGrf( pGalleryItem->GetGraphic() );
-
- if ( nSelType & nsSelectionType::SEL_GRF )
- rSh.ReRead( aGrfName, aFltName, &aGrf );
- else
- rSh.Insert( aGrfName, aFltName, aGrf );
-
- GetView().GetEditWin().GrabFocus();
- }
- else if(!rSh.IsSelFrmMode() &&
- nGalleryItemType == com::sun::star::gallery::GalleryItemType::MEDIA )
- {
- const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGalleryItem->GetURL() );
- GetView().GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
- }
- }
- break;
- case FN_PAGE_STYLE_SET_COLS:
- {
- if (pArgs)
- {
- // Determine the current PageDescriptor and fill the set with that.
- const sal_uInt16 nCurIdx = rSh.GetCurPageDesc();
- SwPageDesc aPageDesc(rSh.GetPageDesc(nCurIdx));
-
- SwFrmFmt &rFmt = aPageDesc.GetMaster();
-
- SwFmtCol aFmtCol = rFmt.GetCol();
-
- sal_uInt16 nCount;
- if(SFX_ITEM_SET == pArgs->GetItemState(nSlot))
- nCount = ((SfxUInt16Item &)pArgs->Get(nSlot)).GetValue();
- else
- nCount = ((SfxUInt16Item &)pArgs->Get(SID_ATTR_COLUMNS)).GetValue();
- sal_uInt16 nGutterWidth = DEF_GUTTER_WIDTH;
-
- aFmtCol.Init(nCount ? nCount : 1, nGutterWidth, USHRT_MAX);
- aFmtCol.SetWishWidth(USHRT_MAX);
- aFmtCol.SetGutterWidth(nGutterWidth, USHRT_MAX);
-
- rFmt.SetFmtAttr(aFmtCol);
-
- rSh.ChgPageDesc(nCurIdx, aPageDesc);
- }
- else
- GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_PAGE_COLUMN_DLG, sal_False);
- }
- break;
- case FN_CONVERT_TABLE_TO_TEXT:
- case FN_CONVERT_TEXT_TO_TABLE:
- case FN_CONVERT_TEXT_TABLE:
- {
- sal_Unicode cDelim = 0;
- bool bToTable = false;
- if( nSlot == FN_CONVERT_TEXT_TO_TABLE ||
- ( nSlot == FN_CONVERT_TEXT_TABLE && 0 == rSh.GetTableFmt() ))
- bToTable = true;
- SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
- SwTableAutoFmt const* pTAFmt = 0;
- SwTableAutoFmtTbl* pAutoFmtTbl = 0;
- bool bDeleteFormat = true;
- if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_1, true, &pItem))
- {
- aInsTblOpts.mnInsMode = 0;
- // Delimiter
- OUString sDelim = static_cast< const SfxStringItem* >(pItem)->GetValue();
- if(!sDelim.isEmpty())
- cDelim = sDelim[0];
- // AutoFormat
- if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_2, true, &pItem))
- {
- OUString sAutoFmt = static_cast< const SfxStringItem* >(pItem)->GetValue();
-
- pAutoFmtTbl = new SwTableAutoFmtTbl;
- pAutoFmtTbl->Load();
-
- for( sal_uInt16 i = 0, nCount = pAutoFmtTbl->size(); i < nCount; i++ )
- {
- SwTableAutoFmt const*const pFmt = &(*pAutoFmtTbl)[ i ];
- if( pFmt->GetName() == sAutoFmt )
- {
- pTAFmt = pFmt;
- bDeleteFormat = false;
- break;
- }
- }
- }
- //WithHeader
- if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_3, true, &pItem) &&
- static_cast< const SfxBoolItem* >(pItem)->GetValue())
- aInsTblOpts.mnInsMode |= tabopts::HEADLINE;
- // RepeatHeaderLines
- if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_4, true, &pItem))
- aInsTblOpts.mnRowsToRepeat =
- (sal_uInt16)static_cast< const SfxInt16Item* >(pItem)->GetValue();
- //WithBorder
- if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_5, true, &pItem) &&
- static_cast< const SfxBoolItem* >(pItem)->GetValue())
- aInsTblOpts.mnInsMode |= tabopts::DEFAULT_BORDER;
- //DontSplitTable
- if(SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_6, true, &pItem) &&
- !static_cast< const SfxBoolItem* >(pItem)->GetValue() )
- aInsTblOpts.mnInsMode |= tabopts::SPLIT_LAYOUT;
- }
- else
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- AbstractSwConvertTableDlg* pDlg = pFact->CreateSwConvertTableDlg(GetView(), bToTable);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if( RET_OK == pDlg->Execute() )
- {
- pDlg->GetValues( cDelim, aInsTblOpts, pTAFmt );
-
- }
- delete pDlg;
- }
-
- if( cDelim )
- {
- //Shell change!
- SwView& rSaveView = rView;
- sal_Bool bInserted = sal_False;
- //recording:
- SfxViewFrame* pViewFrame = GetView().GetViewFrame();
- if( SfxRequest::HasMacroRecorder(pViewFrame) )
- {
- SfxRequest aReq( pViewFrame, nSlot);
- aReq.AppendItem( SfxStringItem( FN_PARAM_1, OUString(cDelim) ));
- if(bToTable)
- {
- if(pTAFmt)
- aReq.AppendItem( SfxStringItem( FN_PARAM_2, pTAFmt->GetName()));
- aReq.AppendItem( SfxBoolItem ( FN_PARAM_3, 0 != (aInsTblOpts.mnInsMode & tabopts::HEADLINE)));
- aReq.AppendItem( SfxInt16Item( FN_PARAM_4, (short)aInsTblOpts.mnRowsToRepeat ));
- aReq.AppendItem( SfxBoolItem ( FN_PARAM_5, 0 != (aInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER) ));
- aReq.AppendItem( SfxBoolItem ( FN_PARAM_6, !(aInsTblOpts.mnInsMode & tabopts::SPLIT_LAYOUT)));
- }
- aReq.Done();
- }
-
- if( !bToTable )
- rSh.TableToText( cDelim );
- else
- {
- bInserted = rSh.TextToTable( aInsTblOpts, cDelim, text::HoriOrientation::FULL, pTAFmt );
- }
- rSh.EnterStdMode();
-
- if( bInserted )
- rSaveView.AutoCaption( TABLE_CAP );
- }
- if(bDeleteFormat)
- delete pTAFmt;
- delete pAutoFmtTbl;
- }
- break;
- case SID_STYLE_WATERCAN:
- case SID_STYLE_UPDATE_BY_EXAMPLE:
- case SID_STYLE_NEW_BY_EXAMPLE:
- case SID_STYLE_APPLY:
- {
- ShellModes eMode = GetView().GetShellMode();
- if ( SHELL_MODE_DRAW != eMode &&
- SHELL_MODE_DRAW_CTRL != eMode &&
- SHELL_MODE_DRAW_FORM != eMode &&
- SHELL_MODE_DRAWTEXT != eMode &&
- SHELL_MODE_BEZIER != eMode )
- {
- // oj #107754#
- if ( SID_STYLE_WATERCAN == nSlot )
- {
- const sal_Bool bLockedView = rSh.IsViewLocked();
- rSh.LockView( sal_True ); //lock visible section
-
- GetView().GetDocShell()->ExecStyleSheet(rReq);
-
- rSh.LockView( bLockedView );
- }
- else
- // Will be recorded from the DocShell
- GetView().GetDocShell()->ExecStyleSheet(rReq);
- }
- }
- break;
- case FN_ESCAPE:
- GetView().ExecuteSlot(rReq);
- break;
- case SID_IMAP:
- {
- sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
-
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- pVFrame->ToggleChildWindow( nId );
- pVFrame->GetBindings().Invalidate( SID_IMAP );
-
- if ( pVFrame->HasChildWindow( nId ) && rSh.IsFrmSelected() )
- lcl_UpdateIMapDlg( rSh );
- }
- break;
- case SID_IMAP_EXEC:
- {
- SvxIMapDlg* pDlg = SWIMAPDLG(GetView());
-
- // Check, if the allocation is useful or allowed at all.
- if ( rSh.IsFrmSelected() &&
- pDlg->GetEditingObject() == rSh.GetIMapInventor() )
- {
- SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
- rSh.GetFlyFrmAttr( aSet );
- SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
- aURL.SetMap( &pDlg->GetImageMap() );
- aSet.Put( aURL );
- rSh.SetFlyFrmAttr( aSet );
- }
- }
- break;
- case SID_CONTOUR_DLG:
- {
- sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
-
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- pVFrame->ToggleChildWindow( nId );
- pVFrame->GetBindings().Invalidate( SID_CONTOUR_DLG );
-
- int nSel = rSh.GetSelectionType();
- if ( pVFrame->HasChildWindow( nId ) &&
- (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) )
- {
- lcl_UpdateContourDlg( rSh, nSel );
- }
- }
- break;
- case SID_CONTOUR_EXEC:
- {
- SvxContourDlg *pDlg = SWCONTOURDLG(GetView());
- // Check, if the allocation is useful or allowed at all.
- int nSel = rSh.GetSelectionType();
- if ( nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE) )
- {
- if ( pDlg->GetEditingObject() == rSh.GetIMapInventor() )
- {
- rSh.StartAction();
- SfxItemSet aSet( rSh.GetAttrPool(), RES_SURROUND, RES_SURROUND);
- rSh.GetFlyFrmAttr( aSet );
- SwFmtSurround aSur( (SwFmtSurround&)aSet.Get( RES_SURROUND ) );
- if ( !aSur.IsContour() )
- {
- aSur.SetContour( sal_True );
- if ( aSur.GetSurround() == SURROUND_NONE )
- aSur.SetSurround( SURROUND_PARALLEL );
- aSet.Put( aSur );
- rSh.SetFlyFrmAttr( aSet );
- }
- const PolyPolygon aPoly( pDlg->GetPolyPolygon() );
- rSh.SetGraphicPolygon( &aPoly );
- if ( pDlg->IsGraphicChanged() )
- rSh.ReRead( OUString(), OUString(), &pDlg->GetGraphic());
- rSh.EndAction();
- }
- }
- }
- break;
- case FN_FRAME_TO_ANCHOR:
- {
- rSh.GotoFlyAnchor();
- rSh.EnterStdMode();
- rSh.CallChgLnk();
- }
- break;
- case FN_TOOL_ANCHOR:
- break;
- case FN_TOOL_ANCHOR_PAGE:
- case FN_TOOL_ANCHOR_PARAGRAPH:
- case FN_TOOL_ANCHOR_CHAR:
- case FN_TOOL_ANCHOR_AT_CHAR:
- case FN_TOOL_ANCHOR_FRAME:
- {
- RndStdIds eSet = nSlot == FN_TOOL_ANCHOR_PAGE
- ? FLY_AT_PAGE
- : nSlot == FN_TOOL_ANCHOR_PARAGRAPH
- ? FLY_AT_PARA
- : nSlot == FN_TOOL_ANCHOR_FRAME
- ? FLY_AT_FLY
- : nSlot == FN_TOOL_ANCHOR_CHAR
- ? FLY_AS_CHAR
- : FLY_AT_CHAR;
- rSh.StartUndo();
- if( rSh.IsObjSelected() )
- rSh.ChgAnchor( eSet );
- else if( rSh.IsFrmSelected() )
- {
- // The set also includes VERT/HORI_ORIENT, because the align
- // shall be changed in FEShell::SetFlyFrmAttr/SetFlyFrmAnchor,
- // possibly as a result of the anchor change.
- SfxItemSet aSet( GetPool(), RES_VERT_ORIENT, RES_ANCHOR );
- SwFmtAnchor aAnc( eSet, rSh.GetPhyPageNum() );
- aSet.Put( aAnc );
- rSh.SetFlyFrmAttr(aSet);
- }
- // if new anchor is 'as char' and it is a Math object and the usual
- // pre-conditions are met then align the formula to the baseline of the text
- const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
- const bool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() )
- && FLY_AS_CHAR == eSet && rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT );
- if (bDoMathBaselineAlignment)
- rSh.AlignFormulaToBaseline( xObj );
-
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- if( nHtmlMode )
- {
- SfxItemSet aSet(GetPool(), RES_SURROUND, RES_HORI_ORIENT);
- rSh.GetFlyFrmAttr(aSet);
-
- const SwFmtSurround& rSurround = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
- const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT);
- const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)aSet.Get(RES_HORI_ORIENT);
- sal_Int16 eVOrient = rVert.GetVertOrient();
- sal_Int16 eHOrient = rHori.GetHoriOrient();
- SwSurround eSurround = rSurround.GetSurround();
-
- switch( eSet )
- {
- case FLY_AT_FLY:
- case FLY_AT_PAGE:
- //Wrap through, left or from left, top, from top
- if(eSurround != SURROUND_THROUGHT)
- aSet.Put(SwFmtSurround(SURROUND_THROUGHT));
-
- if( eVOrient != text::VertOrientation::TOP && eVOrient != text::VertOrientation::NONE)
- aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
-
- if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT)
- aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
- break;
-
- case FLY_AT_PARA:
- // left, from left, right, top, no wrap, wrap left and right
- if(eSurround != SURROUND_LEFT || eSurround != SURROUND_RIGHT)
- aSet.Put(SwFmtSurround(SURROUND_LEFT));
-
- if( eVOrient != text::VertOrientation::TOP)
- aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
-
- if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)
- aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
- break;
-
- case FLY_AT_CHAR:
- // left, from left, right, top, wrap through
- if(eSurround != SURROUND_THROUGHT)
- aSet.Put(SwFmtSurround(SURROUND_THROUGHT));
-
- if( eVOrient != text::VertOrientation::TOP)
- aSet.Put(SwFmtVertOrient(0, text::VertOrientation::TOP));
-
- if(eHOrient != text::HoriOrientation::NONE || eHOrient != text::HoriOrientation::LEFT || eHOrient != text::HoriOrientation::RIGHT)
- aSet.Put(SwFmtHoriOrient(0, text::HoriOrientation::LEFT));
- break;
-
- default:
- ;
- }
-
- if( aSet.Count() )
- rSh.SetFlyFrmAttr( aSet );
- }
- rSh.EndUndo();
-
- GetView().GetViewFrame()->GetBindings().Invalidate( FN_TOOL_ANCHOR );
- }
- break;
-
- case FN_FRAME_NOWRAP:
- case FN_FRAME_WRAP:
- case FN_FRAME_WRAP_IDEAL:
- case FN_FRAME_WRAPTHRU:
- case FN_FRAME_WRAPTHRU_TRANSP:
- case FN_FRAME_WRAP_CONTOUR:
- case FN_WRAP_ANCHOR_ONLY:
- case FN_FRAME_WRAP_LEFT:
- case FN_FRAME_WRAP_RIGHT:
- SetWrapMode( nSlot );
- break;
-
- case FN_UPDATE_ALL_LINKS:
- {
- if( !rSh.GetLinkManager().GetLinks().empty() )
- {
- rSh.EnterStdMode();
- rSh.StartAllAction();
- rSh.GetLinkManager().UpdateAllLinks( false, false, false );
- rSh.EndAllAction();
- }
- }
- break;
-
- case FN_XFORMS_DESIGN_MODE:
- if( pArgs != NULL
- && pArgs->GetItemState( nSlot, true, &pItem ) == SFX_ITEM_SET
- && pItem != NULL
- && pItem->ISA( SfxBoolItem ) )
- {
- sal_Bool bDesignMode =
- static_cast<const SfxBoolItem*>( pItem )->GetValue();
-
- // set form design mode
- OSL_ENSURE( GetView().GetFormShell() != NULL, "form shell?" );
- SfxRequest aReq( GetView().GetViewFrame(), SID_FM_DESIGN_MODE );
- aReq.AppendItem( SfxBoolItem( SID_FM_DESIGN_MODE, bDesignMode ) );
- GetView().GetFormShell()->Execute( aReq );
- aReq.Done();
-
- // also set suitable view options
- SwViewOption aViewOption = *rSh.GetViewOptions();
- aViewOption.SetFormView( ! bDesignMode );
- rSh.ApplyViewOptions( aViewOption );
- }
- break;
-
- default:
- bMore = true;
- }
- if(bMore && pArgs)
- {
- pItem = 0;
- pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
- if(pItem)
- switch(nSlot)
- {
- case SID_ATTR_BRUSH:
- case SID_ATTR_BORDER_SHADOW:
- case RES_SHADOW:
- {
- rSh.StartAllAction();
- SfxItemSet aSet( rSh.GetAttrPool(),
- RES_SHADOW, RES_SHADOW,
- RES_BACKGROUND, RES_BACKGROUND, 0 );
-
- aSet.Put(*pItem);
- // Tabele cell(s) selected?
- if ( rSh.IsTableMode() )
- {
- SwFrmFmt *pFmt = rSh.GetTableFmt();
- pFmt->SetFmtAttr( *pItem );
- }
- else if ( rSh.IsFrmSelected() )
- {
- // Set border attributes via Frame-Manager.
- SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
- aMgr.SetAttrSet( *pArgs );
- aMgr.UpdateFlyFrm();
- }
- else
- {
- rSh.SetAttrSet( *pArgs );
- }
- rSh.EndAllAction();
- }
- break;
- case FN_PAGE_STYLE_SET_LR_MARGIN:
- case FN_PAGE_STYLE_SET_UL_MARGIN:
- case FN_PAGE_STYLE_SET_NUMBER_FORMAT:
- case FN_PAGE_STYLE_SET_PAPER_SIZE:
- case FN_PAGE_STYLE_SET_PAPER_BIN:
- {
- OSL_FAIL("not implemented");
- }
- break;
-
- case SID_ATTR_BORDER_OUTER:
- {
- // Tabele cell(s) selected?
- if ( rSh.IsTableMode() )
- {
- // Set border attributes Get/SetTabBorders()
- rSh.SetTabBorders(*pArgs);
- }
- else if ( rSh.IsFrmSelected() )
- {
- // Set border attributes via Frame-Manager.
- SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
- aMgr.SetAttrSet(*pArgs);
- aMgr.UpdateFlyFrm();
- }
- else
- {
- // Set border attributes via shell quite normally.
- rSh.SetAttrItem( *pItem );
- }
- }
- break;
- default:
- OSL_FAIL("wrong Dispatcher");
- }
-
- }
-}
-
-// Here the state fpr SID_IMAP / SID_CONTOUR will be handled
-// until the swapping of the graphic is finished.
-
-IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl)
-{
- sal_uInt16 nGrfType;
- SwWrtShell &rSh = GetShell();
- if( CNT_GRF == rSh.SwEditShell::GetCntType() &&
- GRAPHIC_NONE != ( nGrfType = rSh.GetGraphicType() ) &&
- !aGrfUpdateSlots.empty() )
- {
- bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- sal_uInt16 nSlot;
- std::set<sal_uInt16>::iterator it;
- for( it = aGrfUpdateSlots.begin(); it != aGrfUpdateSlots.end(); ++it )
- {
- sal_Bool bSetState = sal_False;
- sal_Bool bState = sal_False;
- switch( nSlot = *it )
- {
- case SID_IMAP:
- case SID_IMAP_EXEC:
- {
- sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
- SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ?
- (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId )
- ->GetWindow()) : 0;
-
- if( pDlg && ( SID_IMAP_EXEC == nSlot ||
- ( SID_IMAP == nSlot && !bProtect)) &&
- pDlg->GetEditingObject() != rSh.GetIMapInventor())
- lcl_UpdateIMapDlg( rSh );
-
- if( !bProtect && SID_IMAP == nSlot )
- bSetState = sal_True, bState = 0 != pDlg;
- }
- break;
-
- case SID_CONTOUR_DLG:
- if( !bProtect )
- {
- sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
- SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ?
- (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId )
- ->GetWindow()) : 0;
- if( pDlg && pDlg->GetEditingObject() !=
- rSh.GetIMapInventor() )
- lcl_UpdateContourDlg( rSh, nsSelectionType::SEL_GRF );
-
- bSetState = sal_True;
- bState = 0 != pDlg;
- }
- break;
-
- case FN_FRAME_WRAP_CONTOUR:
- if( !bProtect )
- {
- SfxItemSet aSet(GetPool(), RES_SURROUND, RES_SURROUND);
- rSh.GetFlyFrmAttr(aSet);
- const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
- bSetState = sal_True;
- bState = rWrap.IsContour();
- }
- break;
-
- case SID_GRFFILTER:
- case SID_GRFFILTER_INVERT:
- case SID_GRFFILTER_SMOOTH:
- case SID_GRFFILTER_SHARPEN:
- case SID_GRFFILTER_REMOVENOISE:
- case SID_GRFFILTER_SOBEL:
- case SID_GRFFILTER_MOSAIC:
- case SID_GRFFILTER_EMBOSS:
- case SID_GRFFILTER_POSTER:
- case SID_GRFFILTER_POPART:
- case SID_GRFFILTER_SEPIA:
- case SID_GRFFILTER_SOLARIZE:
- bSetState = bState = GRAPHIC_BITMAP == nGrfType;
- break;
- }
-
- if( bSetState )
- {
- SfxBoolItem aBool( nSlot, bState );
- if( pGetStateSet )
- pGetStateSet->Put( aBool );
- else
- pVFrame->GetBindings().SetState( aBool );
- }
- }
- aGrfUpdateSlots.clear();
- }
- return 0;
-}
-
-void SwBaseShell::GetState( SfxItemSet &rSet )
-{
- SwWrtShell &rSh = GetShell();
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- pGetStateSet = &rSet;
- while ( nWhich )
- {
- switch ( nWhich )
- {
- case SID_GALLERY_FORMATS:
- if ( rSh.IsObjSelected() ||
- (rSh.IsSelFrmMode() &&
- !(rSh.GetSelectionType() & nsSelectionType::SEL_GRF)) )
- rSet.DisableItem( nWhich );
- break;
- case SID_GALLERY_ENABLE_ADDCOPY:
- // #108230# allow copy from gallery in Writer AND Writer/Web!
- rSet.Put( SfxBoolItem( SID_GALLERY_ENABLE_ADDCOPY, true ) );
- break;
- case FN_EDIT_REGION:
- if( !rSh.IsAnySectionInDoc() )
- rSet.DisableItem(nWhich);
- break;
-
- case FN_INSERT_REGION:
- if( rSh.CrsrInsideInputFld()
- || rSh.IsSelFrmMode()
- || !rSh.IsInsRegionAvailable() )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case FN_CONVERT_TABLE_TO_TEXT:
- {
- sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
- if( (eFrmType & FRMTYPE_FOOTNOTE) ||
- !rSh.GetTableFmt() )
- rSet.DisableItem( nWhich );
- }
- break;
- case FN_CONVERT_TEXT_TO_TABLE:
- {
- sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
- if( (eFrmType & FRMTYPE_FOOTNOTE) ||
- !rSh.IsTextToTableAvailable() )
- rSet.DisableItem( nWhich );
- }
- break;
- case FN_CONVERT_TEXT_TABLE:
- {
- sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
- if( (eFrmType & FRMTYPE_FOOTNOTE) ||
- (!rSh.GetTableFmt() && !rSh.IsTextToTableAvailable() ) )
- rSet.DisableItem( nWhich );
- }
- break;
- case RES_SHADOW:
- {
- SfxItemSet aSet( rSh.GetAttrPool(),
- RES_SHADOW, RES_SHADOW );
-
- // Table cell(s) selected?
- if ( rSh.IsTableMode() )
- {
- SwFrmFmt *pFmt = rSh.GetTableFmt();
- aSet.Put(pFmt->GetFmtAttr( nWhich, sal_True ));
- }
- else if( rSh.IsFrmSelected() )
- {
- SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
- aSet.Put( aMgr.GetAttrSet() );
- }
- else
- rSh.GetCurAttr( aSet );
-
- const SvxShadowItem& rShItem = (const SvxShadowItem&)aSet.Get(nWhich);
- rSet.Put(rShItem);
- }
- break;
- case SID_IMAP:
- {
- // #i59688#
- // Improve efficiency:
- // If selected object is protected, item has to disabled.
- const bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
- if ( bProtect )
- {
- rSet.DisableItem( nWhich );
- }
- else
- {
- const sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
- const sal_Bool bHas = pVFrame->HasChildWindow( nId );
- const sal_Bool bFrmSel = rSh.IsFrmSelected();
- const bool bIsGraphicSelection =
- rSh.GetSelectionType() == nsSelectionType::SEL_GRF;
-
- // #i59688#
- // Avoid unnecessary loading of selected graphic.
- // The graphic is only needed, if the dialog is open.
- // If the swapping of the graphic is finished, the status
- // must be determined asynchronously, until this the slot
- // will be disabled.
- if ( bHas && bIsGraphicSelection && rSh.IsGrfSwapOut( sal_True ) )
- {
- if( AddGrfUpdateSlot( nWhich ))
- rSh.GetGraphic(sal_False); // start the loading
- }
- else
- {
- if ( !bHas &&
- ( !bFrmSel ||
- ( bIsGraphicSelection &&
- rSh.GetGraphicType() == GRAPHIC_NONE ) ) )
- {
- rSet.DisableItem( nWhich );
- }
- else
- {
- SfxBoolItem aBool(nWhich, bHas);
- if ( bHas && bFrmSel )
- lcl_UpdateIMapDlg( rSh );
- rSet.Put(aBool);
- }
- }
- }
- }
- break;
- case SID_IMAP_EXEC:
- {
- sal_Bool bDisable = sal_False;
- if( !rSh.IsFrmSelected())
- bDisable = sal_True;
- sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId();
- if(!bDisable && pVFrame->HasChildWindow( nId ))
- {
- if(rSh.GetSelectionType() == nsSelectionType::SEL_GRF
- && rSh.IsGrfSwapOut(sal_True))
- {
- if( AddGrfUpdateSlot( nWhich ))
- rSh.GetGraphic(sal_False); // start the loading
- }
- else
- {
- SvxIMapDlg *pDlg = SWIMAPDLG(GetView());
- if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
- lcl_UpdateIMapDlg( rSh );
- }
- }
- rSet.Put(SfxBoolItem(nWhich, bDisable));
- }
- break;
-
- case FN_BACKSPACE:
- case SID_DELETE:
- if ( ( rSh.HasReadonlySel() && !rSh.CrsrInsideInputFld() )
- || rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0 )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case SID_CONTOUR_DLG:
- {
- sal_Bool bParentCntProt = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
-
- if( bParentCntProt || 0 != (HTMLMODE_ON & ::GetHtmlMode(
- GetView().GetDocShell() )) )
- rSet.DisableItem( nWhich );
- else
- {
- sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
- sal_Bool bHas = GetView().GetViewFrame()->HasChildWindow( nId );
- int nSel = rSh.GetSelectionType();
- sal_Bool bOk = 0 != (nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE));
-
- bool bDisable = false;
- if( !bHas && !bOk )
- bDisable = true;
- // #i59688#
- // Avoid unnecessary loading of selected graphic.
- // The graphic is only needed, if the dialog is open.
- // If the swapping of the graphic is finished, the status
- // must be determined asynchronously, until this the slot
- // will be disabled.
- else if ( bHas && (nSel & nsSelectionType::SEL_GRF) &&
- rSh.IsGrfSwapOut(sal_True) )
- {
- if( AddGrfUpdateSlot( nWhich ))
- rSh.GetGraphic(sal_False); // start the loading
- // #i75481#
- bDisable = true;
- }
- else if( bHas && bOk )
- bDisable = !lcl_UpdateContourDlg( rSh, nSel );
- else if( bOk )
- {
- // #i75481#
- // apply fix #i59688# only for selected graphics
- if ( nSel & nsSelectionType::SEL_GRF )
- bDisable = GRAPHIC_NONE == rSh.GetGraphicType();
- else
- bDisable = GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
- }
-
- if( bDisable )
- rSet.DisableItem( nWhich );
- else
- rSet.Put( SfxBoolItem(nWhich, bHas) );
- }
- }
- break;
- case SID_CONTOUR_EXEC:
- {
- sal_Bool bDisable = sal_False;
- int nSel = rSh.GetSelectionType();
- if( !(nSel & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_OLE)) )
- bDisable = sal_True;
- sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId();
- if( !bDisable && GetView().GetViewFrame()->HasChildWindow( nId ))
- {
- SvxContourDlg *pDlg = SWCONTOURDLG(GetView());
- if( pDlg->GetEditingObject() != rSh.GetIMapInventor() )
- bDisable = sal_True;
- }
- rSet.Put(SfxBoolItem(nWhich, bDisable));
- }
- break;
-
- case FN_TOOL_ANCHOR:
- case FN_TOOL_ANCHOR_PAGE:
- case FN_TOOL_ANCHOR_PARAGRAPH:
- case FN_TOOL_ANCHOR_CHAR:
- case FN_TOOL_ANCHOR_AT_CHAR:
- case FN_TOOL_ANCHOR_FRAME:
- {
- sal_Bool bObj = 0 != rSh.IsObjSelected();
- sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
-
- if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
- {
- SfxItemSet aSet(GetPool(), RES_ANCHOR, RES_ANCHOR);
- if(bObj)
- rSh.GetObjAttr(aSet);
- else
- rSh.GetFlyFrmAttr(aSet);
- RndStdIds eSet = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
- const sal_Bool bSet =
- ((nWhich == FN_TOOL_ANCHOR_PAGE) &&
- (eSet == FLY_AT_PAGE))
- || ((nWhich == FN_TOOL_ANCHOR_PARAGRAPH) &&
- (eSet == FLY_AT_PARA))
- || ((nWhich == FN_TOOL_ANCHOR_FRAME) &&
- (eSet == FLY_AT_FLY))
- || ((nWhich == FN_TOOL_ANCHOR_AT_CHAR) &&
- (eSet == FLY_AT_CHAR))
- || ((nWhich == FN_TOOL_ANCHOR_CHAR) &&
- (eSet == FLY_AS_CHAR));
- if(nWhich != FN_TOOL_ANCHOR)
- {
- if( nWhich == FN_TOOL_ANCHOR_FRAME && !rSh.IsFlyInFly() )
- rSet.DisableItem(nWhich);
- else
- rSet.Put(SfxBoolItem(nWhich, bSet));
- }
- else
- {
- sal_uInt16 nSlotId = 0;
-
- switch (eSet)
- {
- case FLY_AT_PAGE:
- nSlotId = FN_TOOL_ANCHOR_PAGE;
- break;
- case FLY_AT_PARA:
- nSlotId = FN_TOOL_ANCHOR_PARAGRAPH;
- break;
- case FLY_AS_CHAR:
- nSlotId = FN_TOOL_ANCHOR_CHAR;
- break;
- case FLY_AT_CHAR:
- nSlotId = FN_TOOL_ANCHOR_AT_CHAR;
- break;
- case FLY_AT_FLY:
- nSlotId = FN_TOOL_ANCHOR_FRAME;
- break;
- default:
- ;
- }
- rSet.Put(SfxUInt16Item(nWhich, nSlotId));
- }
- }
- else
- rSet.DisableItem( nWhich );
- }
- break;
- case FN_FRAME_NOWRAP:
- case FN_FRAME_WRAP:
- case FN_FRAME_WRAP_IDEAL:
- case FN_FRAME_WRAPTHRU:
- case FN_FRAME_WRAPTHRU_TRANSP:
- case FN_FRAME_WRAP_CONTOUR:
- case FN_WRAP_ANCHOR_ONLY:
- case FN_FRAME_WRAP_LEFT:
- case FN_FRAME_WRAP_RIGHT:
- {
- sal_Bool bObj = 0 != rSh.IsObjSelected();
- sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
-
- if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
- {
- SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_ANCHOR);
- int nAnchorType;
- if(bObj)
- {
- rSh.GetObjAttr(aSet);
- nAnchorType = rSh.GetAnchorId();
- }
- else
- {
- rSh.GetFlyFrmAttr(aSet);
- nAnchorType = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
- }
- const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
-
- const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)aSet.Get(RES_OPAQUE);
- sal_Bool bOpaque = rOpaque.GetValue();
- SwSurround nSurround = rWrap.GetSurround();
- sal_Bool bSet = sal_False;
-
- bool bDisable =
- (nAnchorType == - 1) || (nAnchorType == FLY_AS_CHAR);
- const bool bHtmlMode =
- 0 != ::GetHtmlMode(GetView().GetDocShell());
-
- switch( nWhich )
- {
- case FN_FRAME_NOWRAP:
- bDisable |=
- ( (nAnchorType != FLY_AT_PARA)
- && (nAnchorType != FLY_AT_CHAR)
- && (nAnchorType != FLY_AT_PAGE));
- bSet = nSurround == SURROUND_NONE;
- break;
- case FN_FRAME_WRAP:
- bDisable |= bHtmlMode;
- bSet = nSurround == SURROUND_PARALLEL;
- break;
- case FN_FRAME_WRAP_IDEAL:
- bDisable |= bHtmlMode;
- bSet = nSurround == SURROUND_IDEAL;
- break;
- case FN_FRAME_WRAPTHRU:
- bDisable |= (bHtmlMode ||
- ( (nAnchorType != FLY_AT_PARA)
- && (nAnchorType != FLY_AT_CHAR)
- && (nAnchorType != FLY_AT_PAGE)));
- if(bObj)
- bSet = nSurround == SURROUND_THROUGHT && rSh.GetLayerId();
- else
- bSet = nSurround == SURROUND_THROUGHT && bOpaque;
- break;
- case FN_FRAME_WRAPTHRU_TRANSP:
- bDisable |= bHtmlMode;
- if(bObj)
- bSet = nSurround == SURROUND_THROUGHT && !rSh.GetLayerId();
- else
- bSet = nSurround == SURROUND_THROUGHT && !bOpaque;
- break;
- case FN_FRAME_WRAP_CONTOUR:
- bDisable |= bHtmlMode;
- //no contour available whenn no wrap or wrap through is set
- bDisable |= (nSurround == SURROUND_NONE || nSurround == SURROUND_THROUGHT);
- bSet = rWrap.IsContour();
- if( !bDisable )
- {
- int nSel = rSh.GetSelectionType();
- if( (nSel & nsSelectionType::SEL_GRF) &&
- rSh.IsGrfSwapOut(sal_True))
- {
- if( AddGrfUpdateSlot( nWhich ))
- rSh.GetGraphic(sal_False); // start the loading
- }
- else if( rSh.IsFrmSelected() )
- {
- // #i102253# applied patch from OD (see task)
- bDisable =
- nSel & nsSelectionType::SEL_FRM ||
- GRAPHIC_NONE == rSh.GetIMapGraphic().GetType();
- }
- }
- bSet = bDisable ? sal_False : rWrap.IsContour();
-
- break;
- case FN_WRAP_ANCHOR_ONLY:
- bDisable |= (bHtmlMode ||
- (nAnchorType != FLY_AT_PARA));
- bSet = rWrap.IsAnchorOnly();
- break;
- case FN_FRAME_WRAP_LEFT:
- bSet = nSurround == SURROUND_LEFT;
- break;
- case FN_FRAME_WRAP_RIGHT:
- bSet = nSurround == SURROUND_RIGHT;
- break;
- }
-
- if(bDisable)
- rSet.DisableItem(nWhich);
- else
- rSet.Put(SfxBoolItem(nWhich, bSet));
- }
- else
- rSet.DisableItem(nWhich);
- }
- break;
- case FN_UPDATE_CHARTS:
- if( !rSh.HasCharts() )
- rSet.DisableItem( nWhich );
- break;
- case FN_UPDATE_ALL_LINKS:
- if ( rSh.GetLinkManager().GetLinks().empty() )
- rSet.DisableItem(nWhich);
- break;
- case FN_XFORMS_DESIGN_MODE:
- // enable if in XForms document
- if( rSh.GetDoc()->isXForms() )
- {
- // determine current state from view options
- sal_Bool bValue = ! rSh.GetViewOptions()->IsFormView();
- rSet.Put( SfxBoolItem( nWhich, bValue ) );
- }
- else
- rSet.Put( SfxVisibilityItem( nWhich, false ) );
- break;
- }
- nWhich = aIter.NextWhich();
- }
- pGetStateSet = 0;
-}
-
-// Disable the slots with this status methode
-
-void SwBaseShell::StateDisableItems( SfxItemSet &rSet )
-{
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while (nWhich)
- {
- rSet.DisableItem( nWhich );
- nWhich = aIter.NextWhich();
- }
-}
-
-// Disable the slots with this status methode
-
-void SwBaseShell::StateStyle( SfxItemSet &rSet )
-{
- bool bParentCntProt = GetShell().IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
- ShellModes eMode = GetView().GetShellMode();
-
- if ( bParentCntProt ||
- SHELL_MODE_DRAW == eMode ||
- SHELL_MODE_DRAW_CTRL == eMode ||
- SHELL_MODE_DRAW_FORM == eMode ||
- SHELL_MODE_DRAWTEXT == eMode ||
- SHELL_MODE_BEZIER == eMode )
- {
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- while ( nWhich )
- {
- rSet.DisableItem( nWhich );
- nWhich = aIter.NextWhich();
- }
- }
- else
- GetView().GetDocShell()->StateStyleSheet(rSet, &GetShell());
-}
-
-void SwBaseShell::SetWrapMode( sal_uInt16 nSlot )
-{
- SwWrtShell &rSh = GetShell();
- bool bObj = 0 != rSh.IsObjSelected();
- if( bObj || rSh.IsFrmSelected())
- {
- SfxItemSet aSet(GetPool(), RES_OPAQUE, RES_SURROUND);
- if(bObj)
- rSh.GetObjAttr(aSet);
- else
- rSh.GetFlyFrmAttr(aSet);
- SwFmtSurround aWrap( (SwFmtSurround&)aSet.Get(RES_SURROUND) );
- SwSurround nOldSurround(aWrap.GetSurround());
- SwSurround nSurround = SURROUND_PARALLEL;
-
- switch (nSlot)
- {
- case FN_FRAME_NOWRAP:
- nSurround = SURROUND_NONE;
- if (aWrap.IsContour())
- aWrap.SetContour(sal_False);
- break;
- case FN_FRAME_WRAP_IDEAL:
- nSurround = SURROUND_IDEAL;
- break;
- case FN_WRAP_ANCHOR_ONLY:
- aWrap.SetAnchorOnly(!aWrap.IsAnchorOnly());
-
- // keep previous wrapping
-
- // switch to wrap SURROUND_PARALLEL, if previous wrap is SURROUND_NONE
- if ( nOldSurround != SURROUND_NONE )
- {
- nSurround = nOldSurround;
- }
- break;
- case FN_FRAME_WRAP_CONTOUR:
- aWrap.SetContour(!aWrap.IsContour());
- if (nSurround == SURROUND_THROUGHT)
- nSurround = SURROUND_PARALLEL;
- break;
- case FN_FRAME_WRAPTHRU_TRANSP:
- if (aWrap.IsContour())
- aWrap.SetContour(sal_False);
- // No break!!!
- case FN_FRAME_WRAPTHRU:
- nSurround = SURROUND_THROUGHT;
- break;
-
- case FN_FRAME_WRAP_LEFT:
- nSurround = SURROUND_LEFT;
- break;
-
- case FN_FRAME_WRAP_RIGHT:
- nSurround = SURROUND_RIGHT;
- break;
-
- default:
- break;
- }
- aWrap.SetSurround(nSurround);
-
- if (nSlot != FN_FRAME_WRAP_CONTOUR)
- {
- // Defaulting the contour wrap on draw objects.
- if (bObj && nOldSurround != nSurround &&
- (nOldSurround == SURROUND_NONE || nOldSurround == SURROUND_THROUGHT))
- {
- aWrap.SetContour(sal_True);
- }
- }
-
- aSet.Put( aWrap );
- aSet.Put(SvxOpaqueItem(RES_OPAQUE, nSlot != FN_FRAME_WRAPTHRU_TRANSP));
- if(bObj)
- {
- rSh.SetObjAttr(aSet);
- if (nSlot != FN_FRAME_WRAPTHRU_TRANSP)
- rSh.SelectionToHeaven();
- else
- rSh.SelectionToHell();
- }
- else
- rSh.SetFlyFrmAttr(aSet);
- }
-}
-
-//Force update of the status line
-
-void SwBaseShell::SetFrmMode(FlyMode eMode, SwWrtShell *pSh )
-{
- eFrameMode = eMode;
- SfxBindings &rBnd = pSh->GetView().GetViewFrame()->GetBindings();
-
- if( eMode == FLY_DRAG || pSh->IsFrmSelected() || pSh->IsObjSelected() )
- {
- const SfxPointItem aTmp1( SID_ATTR_POSITION, pSh->GetAnchorObjDiff());
- const SvxSizeItem aTmp2( SID_ATTR_SIZE, pSh->GetObjSize());
- rBnd.SetState( aTmp1 );
- rBnd.SetState( aTmp2 );
- }
- else if( eMode == FLY_DRAG_END )
- {
- static sal_uInt16 aInval[] =
- {
- SID_ATTR_POSITION, SID_ATTR_SIZE, 0
- };
- rBnd.Invalidate(aInval);
- }
-}
-
-SwBaseShell::SwBaseShell(SwView& rVw) :
- SfxShell( &rVw ),
- rView(rVw),
- pGetStateSet(0)
-{
- SwWrtShell& rWrtSh = rView.GetWrtShell();
-
- SetPool(&rWrtSh.GetAttrPool());
- SetName(OUString("Base"));
- rWrtSh.SetGrfArrivedLnk( LINK( this, SwBaseShell, GraphicArrivedHdl));
-}
-
-SwBaseShell::~SwBaseShell()
-{
- if( rView.GetCurShell() == this )
- rView.ResetSubShell();
-
- Link aTmp( LINK( this, SwBaseShell, GraphicArrivedHdl));
- if( aTmp == rView.GetWrtShell().GetGrfArrivedLnk() )
- rView.GetWrtShell().SetGrfArrivedLnk( Link() );
-}
-
-void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq )
-{
- const SfxItemSet *pArgs = rReq.GetArgs();
-
- if( pArgs)
- {
- SwWrtShell &rSh = GetShell();
- SvxScriptSetItem* pSSetItem = 0;
- sal_uInt16 nSlot = rReq.GetSlot();
- SfxItemPool& rPool = rSh.GetAttrPool();
- sal_uInt16 nWhich = rPool.GetWhich( nSlot );
- sal_uInt16 nScripts = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
- SfxItemSet aHeightSet( GetPool(), RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE,
- RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_FONTSIZE,
- RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_FONTSIZE,
- 0L);
-
- switch( nSlot )
- {
- case SID_ATTR_CHAR_FONT:
- {
- nScripts = rSh.GetScriptType();
- // #i42732# input language should be preferred over
- // current cursor position to detect script type
- if(!rSh.HasSelection())
- {
- LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
- if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
- nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
- }
- }
- case SID_ATTR_CHAR_POSTURE:
- case SID_ATTR_CHAR_WEIGHT:
- {
- pSSetItem = new SvxScriptSetItem( nSlot, rPool );
- pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
- pArgs = &pSSetItem->GetItemSet();
- }
- break;
- case SID_ATTR_CHAR_FONTHEIGHT:
- {
- if(rSh.HasSelection())
- {
- pSSetItem = new SvxScriptSetItem( nSlot, rPool );
- pSSetItem->PutItemForScriptType( nScripts, pArgs->Get( nWhich ));
- pArgs = &pSSetItem->GetItemSet();
- }
- else
- {
- nScripts = rSh.GetScriptType();
- LanguageType nInputLang = GetView().GetEditWin().GetInputLanguage();
- if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
- nScripts = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
- sal_uInt32 nHeight = static_cast< const SvxFontHeightItem& >(pArgs->Get( nWhich )).GetHeight();
- SwStdFontConfig* pStdFont = SW_MOD()->GetStdFontConfig();
-
- SfxItemSet aLangSet( GetPool(), RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
- RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
- RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
- 0L);
- rSh.GetCurAttr( aLangSet );
-
- sal_Int32 nWesternSize =
- pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_DEFAULT,
- static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_LANGUAGE)).GetLanguage());
- sal_Int32 nCJKSize =
- pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CJK,
- static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CJK_LANGUAGE)).GetLanguage());
- sal_Int32 nCTLSize =
- pStdFont->GetFontHeight(FONT_STANDARD, FONT_GROUP_CTL,
- static_cast<const SvxLanguageItem&>(aLangSet.Get( RES_CHRATR_CTL_LANGUAGE)).GetLanguage());
-
- switch(nScripts)
- {
- case SCRIPTTYPE_LATIN:
- nCJKSize = nHeight * nCJKSize / nWesternSize;
- nCTLSize = nHeight * nCTLSize / nWesternSize;
- nWesternSize = (sal_Int32) nHeight;
- break;
- case SCRIPTTYPE_ASIAN:
- nCTLSize = nHeight* nCTLSize / nCJKSize;
- nWesternSize = nHeight * nWesternSize / nCJKSize;
- nCJKSize = (sal_Int32) nHeight;
- break;
- case SCRIPTTYPE_COMPLEX:
- nCJKSize = nHeight * nCJKSize / nCTLSize;
- nWesternSize = nHeight * nWesternSize / nCTLSize;
- nCTLSize = (sal_Int32) nHeight;
- break;
- }
- aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nWesternSize, 100, RES_CHRATR_FONTSIZE ));
- aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nCJKSize, 100, RES_CHRATR_CJK_FONTSIZE ));
- aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nCTLSize, 100, RES_CHRATR_CTL_FONTSIZE ));
- pArgs = &aHeightSet;
- }
- }
- break;
- }
-
- if( pArgs )
- {
- bool bAuto = false;
- if ( !isCHRATR(nWhich) ||
- ( rSh.HasSelection() && rSh.IsSelFullPara() ) )
- {
- SwTxtFmtColl * pColl = rSh.GetCurTxtFmtColl();
- if ( pColl && pColl->IsAutoUpdateFmt() )
- {
- rSh.AutoUpdatePara( pColl, *pArgs );
- bAuto = true;
- }
- }
-
- if (!bAuto)
- {
- rSh.SetAttrSet( *pArgs );
- }
- }
- delete pSSetItem;
- }
- else
- GetView().GetViewFrame()->GetDispatcher()->Execute( SID_CHAR_DLG, sal_False);
- rReq.Done();
-}
-
-void SwBaseShell::GetTxtCtrlState( SfxItemSet& rSet )
-{
- SwWrtShell &rSh = GetShell();
- rSh.GetCurAttr( rSet );
-}
-
-void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet )
-{
- SwWrtShell &rSh = GetShell();
- bool bFirst = true;
- SfxItemSet* pFntCoreSet = 0;
- sal_uInt16 nScriptType = SCRIPTTYPE_LATIN;
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- while( nWhich )
- {
- switch( nWhich )
- {
- case RES_CHRATR_FONT:
- case RES_CHRATR_FONTSIZE:
- case RES_CHRATR_WEIGHT:
- case RES_CHRATR_POSTURE:
- {
- if( !pFntCoreSet )
- {
- pFntCoreSet = new SfxItemSet( *rSet.GetPool(),
- RES_CHRATR_BEGIN, RES_CHRATR_END-1 );
- rSh.GetCurAttr( *pFntCoreSet );
- nScriptType = rSh.GetScriptType();
- // #i42732# input language should be preferred over
- // current cursor position to detect script type
- SwEditWin& rEditWin = GetView().GetEditWin();
- if( rEditWin.IsUseInputLanguage() )
- {
- if(!rSh.HasSelection() && (
- nWhich == RES_CHRATR_FONT ||
- nWhich == RES_CHRATR_FONTSIZE ))
- {
- LanguageType nInputLang = rEditWin.GetInputLanguage();
- if(nInputLang != LANGUAGE_DONTKNOW && nInputLang != LANGUAGE_SYSTEM)
- nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nInputLang );
- }
- }
- }
- SfxItemPool& rPool = *rSet.GetPool();
- SvxScriptSetItem aSetItem( rPool.GetSlotId( nWhich ), rPool );
- aSetItem.GetItemSet().Put( *pFntCoreSet, false );
- const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
- if( pI )
- rSet.Put( *pI, nWhich );
- else
- rSet.InvalidateItem( nWhich );
- // Set input context of the SwEditWin according to the selected font and script type
- if(RES_CHRATR_FONT == nWhich)
- {
- Font aFont;
- if(pI && pI->ISA(SvxFontItem))
- {
- aFont.SetName( ((const SvxFontItem*)pI)->GetFamilyName());
- aFont.SetStyleName(((const SvxFontItem*)pI)->GetStyleName());
- aFont.SetFamily(((const SvxFontItem*)pI)->GetFamily());
- aFont.SetPitch(((const SvxFontItem*)pI)->GetPitch());
- aFont.SetCharSet(((const SvxFontItem*)pI)->GetCharSet());
- }
-
- bool bVertical = rSh.IsInVerticalText();
- aFont.SetOrientation(bVertical ? 2700 : 0);
- aFont.SetVertical(bVertical ? sal_True : sal_False);
- GetView().GetEditWin().SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT |
- INPUTCONTEXT_EXTTEXTINPUT ) );
- }
- }
- break;
-
- default:
- if( bFirst )
- {
- rSh.GetCurAttr( rSet );
- bFirst = false;
- }
- }
- nWhich = aIter.NextWhich();
- }
- delete pFntCoreSet;
-}
-
-void SwBaseShell::GetBckColState(SfxItemSet &rSet)
-{
- SwWrtShell &rSh = GetShell();
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- int nSelType = rSh.GetSelectionType();
-
- if( nSelType & nsSelectionType::SEL_OLE )
- {
- rSet.DisableItem( SID_BACKGROUND_COLOR );
- return;
- }
-
- if ( nSelType & nsSelectionType::SEL_FRM )
- {
- bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
- if (bParentCntProt)
- {
- rSet.DisableItem( SID_BACKGROUND_COLOR );
- return;
- }
- }
-
- SvxBrushItem aBrushItem( RES_BACKGROUND );
-
- if( nsSelectionType::SEL_TBL_CELLS & nSelType )
- rSh.GetBoxBackground( aBrushItem );
- else
- {
- SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
- if( nSelType & nsSelectionType::SEL_GRF || nsSelectionType::SEL_FRM & nSelType )
- rSh.GetFlyFrmAttr( aCoreSet );
- else
- rSh.GetCurAttr( aCoreSet );
- aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
- }
-
- while ( nWhich )
- {
- switch(nWhich)
- {
- case SID_BACKGROUND_COLOR :
- {
- SvxColorItem aColorItem(aBrushItem.GetColor(), SID_BACKGROUND_COLOR);
- rSet.Put( aColorItem, SID_BACKGROUND_COLOR );
- }
- break;
- case SID_ATTR_BRUSH:
- case RES_BACKGROUND:
- rSet.Put( aBrushItem, GetPool().GetWhich(nWhich) );
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwBaseShell::ExecBckCol(SfxRequest& rReq)
-{
- SwWrtShell &rSh = GetShell();
- int nSelType = rSh.GetSelectionType();
- if ( nSelType & nsSelectionType::SEL_OLE )
- {
- return;
- }
-
- const SfxItemSet* pArgs = rReq.GetArgs();
- sal_uInt16 nSlot = rReq.GetSlot();
- if( !pArgs && nSlot != SID_BACKGROUND_COLOR)
- return ;
-
- SvxBrushItem aBrushItem( RES_BACKGROUND );
-
- if( nsSelectionType::SEL_TBL_CELLS & nSelType )
- {
- rSh.GetBoxBackground( aBrushItem );
- }
- else
- {
- SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
- if( (nsSelectionType::SEL_FRM & nSelType) || (nsSelectionType::SEL_GRF & nSelType) )
- rSh.GetFlyFrmAttr( aCoreSet );
- else
- rSh.GetCurAttr( aCoreSet );
- aBrushItem = (const SvxBrushItem&)aCoreSet.Get(RES_BACKGROUND);
- }
-
- switch (nSlot)
- {
- // RES_BACKGROUND (=SID_ATTR_BRUSH) must be set with two IDs:
- case SID_BACKGROUND_COLOR:
- {
- aBrushItem.SetGraphicPos(GPOS_NONE);
-
- if(pArgs)
- {
- const SvxColorItem& rNewColorItem = (const SvxColorItem&)
- pArgs->Get(SID_BACKGROUND_COLOR);
- const Color& rNewColor = rNewColorItem.GetValue();
- aBrushItem.SetColor( rNewColor );
- GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem);
- }
- else
- {
- aBrushItem.SetColor( COL_TRANSPARENT );
- rReq.AppendItem( SvxColorItem( Color( COL_TRANSPARENT ), nSlot ) );
- }
- }
- break;
-
- case SID_ATTR_BRUSH:
- case RES_BACKGROUND:
- {
- const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&)
- pArgs->Get( GetPool().GetWhich(nSlot) );
- aBrushItem = rNewBrushItem;
- }
- break;
- default:
- rReq.Ignore();
- OSL_FAIL("unknown message in ExecuteAttr!" );
- return;
- }
-
- if( nsSelectionType::SEL_TBL_CELLS & nSelType )
- {
- rSh.SetBoxBackground( aBrushItem );
- }
- else if( (nsSelectionType::SEL_FRM & nSelType) ||
- (nsSelectionType::SEL_GRF & nSelType) )
- {
- SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
- aCoreSet.Put( aBrushItem );
- // Template autoupdate
- SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
- if(pFmt && pFmt->IsAutoUpdateFmt())
- rSh.AutoUpdateFrame( pFmt, aCoreSet);
- else
- rSh.SetFlyFrmAttr( aCoreSet );
- }
- else
- {
- SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
- if( pColl && pColl->IsAutoUpdateFmt())
- {
- SfxItemSet aSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND );
- aSet.Put(aBrushItem);
- rSh.AutoUpdatePara( pColl, aSet);
- }
- else
- rSh.SetAttrItem( aBrushItem );
- }
-
- rReq.Done();
-}
-
-void SwBaseShell::GetBorderState(SfxItemSet &rSet)
-{
- SwWrtShell &rSh = GetShell();
- // Tabele cell(s) selected?
- bool bPrepare = true;
- sal_Bool bTableMode = rSh.IsTableMode();
- if ( bTableMode )
- {
- SfxItemSet aCoreSet( GetPool(),
- RES_BOX, RES_BOX,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
- SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
- aCoreSet.Put( aBoxInfo );
- rSh.GetTabBorders( aCoreSet );
- rSet.Put( aCoreSet );
- }
- else if ( rSh.IsFrmSelected() )
- {
- SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
- rSet.Put( aMgr.GetAttrSet() );
- bPrepare = false;
- }
- else
- // Get border attributes via shell quite normal
- rSh.GetCurAttr( rSet );
- if ( bPrepare )
- ::PrepareBoxInfo( rSet, rSh );
- // Switch the border toolbox controller mode
- rSet.Put( SfxBoolItem( SID_BORDER_REDUCED_MODE, !bTableMode ));
-}
-
-void SwBaseShell::ExecDlg(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- Window *pMDI = &GetView().GetViewFrame()->GetWindow();
- // So that from the basic no dialogues for the background views are called:
- bool bBackground = (&GetView() != GetActiveView());
- const SfxPoolItem* pItem = 0;
- const SfxItemSet* pArgs = rReq.GetArgs();
-
- sal_uInt16 nSlot = rReq.GetSlot();
- const SfxItemSet* pOutSet = 0;
- bool bDone = false;
- if(pArgs)
- pArgs->GetItemState( GetPool().GetWhich(nSlot), false, &pItem );
-
- switch ( nSlot )
- {
- case FN_FORMAT_TITLEPAGE_DLG:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- VclAbstractDialog* pDlg = pFact->CreateTitlePageDlg( pMDI );
- pDlg->Execute();
- delete pDlg;
- }
- break;
- case FN_FORMAT_PAGE_DLG:
- case FN_FORMAT_PAGE_COLUMN_DLG:
- case FN_FORMAT_PAGE_SETTING_DLG:
- {
- if( !bBackground )
- {
- const sal_uInt16 nCurIdx = rSh.GetCurPageDesc();
- const SwPageDesc& rPageDesc = rSh.GetPageDesc( nCurIdx );
- // Temporary view, because the shell does not need to be valid after the dialogue
- // for example disable header
- SwView& rTempView = GetView();
-
- OString sPageId;
- switch (nSlot)
- {
- case FN_FORMAT_PAGE_COLUMN_DLG:
- sPageId = "columns";
- break;
- case FN_FORMAT_PAGE_SETTING_DLG:
- sPageId = "page";
- break;
- }
-
- rTempView.GetDocShell()->FormatPage(
- rPageDesc.GetName(), sPageId, rSh);
- rTempView.InvalidateRulerPos();
- }
- }
- break;
- case FN_FORMAT_BORDER_DLG:
- {
- SfxItemSet aSet( rSh.GetAttrPool(),
- RES_BOX , RES_SHADOW,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- 0 );
- SfxAbstractDialog * pDlg = 0;
- // Table cell(s) selected?
- if ( rSh.IsTableMode() )
- {
- // Set border attributes Get/SetTabBorders()
- ::PrepareBoxInfo( aSet, rSh );
- rSh.GetTabBorders( aSet );
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_TABLE, RC_DLG_SWBORDERDLG );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if ( pDlg->Execute() == RET_OK )
- {
- rSh.SetTabBorders( *pDlg->GetOutputItemSet() );
- pOutSet = pDlg->GetOutputItemSet();
- }
- }
- else if ( rSh.IsFrmSelected() )
- {
- // Set border attributes via Frame-Manager
- SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
- aSet.Put( aMgr.GetAttrSet() );
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_FRAME, RC_DLG_SWBORDERDLG );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if ( pDlg->Execute() == RET_OK )
- {
- aMgr.SetAttrSet( *pDlg->GetOutputItemSet() );
- aMgr.UpdateFlyFrm();
- pOutSet = pDlg->GetOutputItemSet();
- }
- }
- else
- {
- // Set border attributes via Shell quite normal
- rSh.GetCurAttr( aSet );
- ::PrepareBoxInfo( aSet, rSh );
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- pDlg = pFact->CreateSwBorderDlg( pMDI, aSet, SW_BORDER_MODE_PARA, RC_DLG_SWBORDERDLG );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if ( pDlg->Execute() == RET_OK )
- {
- rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
- pOutSet = pDlg->GetOutputItemSet();
- }
- }
- if(pOutSet)
- {
- rReq.Done(*pOutSet);
- bDone = true;
- }
- delete pDlg;
- }
- break;
- case FN_FORMAT_BACKGROUND_DLG:
- {
- SfxItemSet aSet( rSh.GetAttrPool(),
- RES_BACKGROUND, RES_BACKGROUND );
-
- SfxAbstractDialog * pDlg = 0;
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- // Table cell(s) selected?
- if ( rSh.IsTableMode() )
- {
- // Get background attributes of the table and put it in the set
- SvxBrushItem aBrush(RES_BACKGROUND);
- rSh.GetBoxBackground( aBrush );
- pDlg = pFact->CreateSfxDialog( pMDI, aSet,
- rView.GetViewFrame()->GetFrame().GetFrameInterface(),
- RC_SWDLG_BACKGROUND );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- aSet.Put( aBrush );
- if ( pDlg->Execute() == RET_OK )
- {
-
- rSh.SetBoxBackground( (SvxBrushItem&)
- pDlg->GetOutputItemSet()->Get( RES_BACKGROUND ));
- pOutSet = pDlg->GetOutputItemSet();
- }
- }
- else if ( rSh.IsFrmSelected() )
- {
-
- rSh.GetFlyFrmAttr( aSet );
-
- pDlg = pFact->CreateSfxDialog( pMDI, aSet,
- rView.GetViewFrame()->GetFrame().GetFrameInterface(),
- RC_SWDLG_BACKGROUND );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if ( pDlg->Execute() == RET_OK )
- {
- rSh.SetFlyFrmAttr((SfxItemSet &) *pDlg->GetOutputItemSet() );
- pOutSet = pDlg->GetOutputItemSet();
- }
- }
- else
- {
- // Set border attributes Umrandungsattribute with the shell quite normal.
- rSh.GetCurAttr( aSet );
-
- pDlg = pFact->CreateSfxDialog( pMDI, aSet,
- rView.GetViewFrame()->GetFrame().GetFrameInterface(),
- RC_SWDLG_BACKGROUND );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if ( pDlg->Execute() == RET_OK )
- {
- rSh.SetAttrSet( *pDlg->GetOutputItemSet() );
- pOutSet = pDlg->GetOutputItemSet();
- }
- }
- if(pOutSet)
- {
- rReq.Done(*pOutSet);
- bDone = true;
- }
- delete pDlg;
-
- }
- break;
- default:OSL_FAIL("wrong Dispatcher (basesh.cxx)");
- }
- if(!bDone)
- rReq.Done();
-}
-
-SwWrtShell& SwBaseShell::GetShell()
-{
- return rView.GetWrtShell();
-}
-
-SwWrtShell* SwBaseShell::GetShellPtr()
-{
- return rView.GetWrtShellPtr();
-}
-
-void SwBaseShell::InsertTable( SfxRequest& _rRequest )
-{
- const SfxItemSet* pArgs = _rRequest.GetArgs();
- SwWrtShell& rSh = GetShell();
-
- if ( !( rSh.GetFrmType( 0, sal_True ) & FRMTYPE_FOOTNOTE ) )
- {
- SwView &rTempView = GetView(); // Because GetView() does not work after the shell exchange
- sal_Bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON);
- bool bCallEndUndo = false;
-
- if( !pArgs && rSh.IsSelection() && !rSh.IsInClickToEdit() &&
- !rSh.IsTableMode() )
- {
- const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
- SwInsertTableOptions aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode);
-
- rSh.StartUndo(UNDO_INSTABLE);
- bCallEndUndo = true;
-
- sal_Bool bInserted = rSh.TextToTable( aInsTblOpts, '\t', text::HoriOrientation::FULL );
- rSh.EnterStdMode();
- if (bInserted)
- rTempView.AutoCaption(TABLE_CAP);
- _rRequest.Done();
- }
- else
- {
- sal_uInt16 nCols = 0;
- sal_uInt16 nRows = 0;
- SwInsertTableOptions aInsTblOpts( tabopts::ALL_TBL_INS_ATTR, 1 );
- OUString aTableName;
- OUString aAutoName;
- SwTableAutoFmt* pTAFmt = 0;
-
- if( pArgs && pArgs->Count() >= 2 )
- {
- SFX_REQUEST_ARG( _rRequest, pName, SfxStringItem, FN_INSERT_TABLE, false );
- SFX_REQUEST_ARG( _rRequest, pCols, SfxUInt16Item, SID_ATTR_TABLE_COLUMN, false );
- SFX_REQUEST_ARG( _rRequest, pRows, SfxUInt16Item, SID_ATTR_TABLE_ROW, false );
- SFX_REQUEST_ARG( _rRequest, pFlags, SfxInt32Item, FN_PARAM_1, false );
- SFX_REQUEST_ARG( _rRequest, pAuto, SfxStringItem, FN_PARAM_2, false );
-
- if ( pName )
- aTableName = pName->GetValue();
- if ( pCols )
- nCols = pCols->GetValue();
- if ( pRows )
- nRows = pRows->GetValue();
- if ( pAuto )
- {
- aAutoName = pAuto->GetValue();
- if ( !aAutoName.isEmpty() )
- {
- SwTableAutoFmtTbl aTableTbl;
- aTableTbl.Load();
- for ( sal_uInt16 n=0; n<aTableTbl.size(); n++ )
- {
- if ( aTableTbl[n].GetName() == aAutoName )
- {
- pTAFmt = new SwTableAutoFmt( aTableTbl[n] );
- break;
- }
- }
- }
- }
-
- if ( pFlags )
- aInsTblOpts.mnInsMode = (sal_uInt16) pFlags->GetValue();
- else
- {
- const SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
- aInsTblOpts = pModOpt->GetInsTblFlags(bHTMLMode);
- }
- }
-
- if( !nCols || !nRows )
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- AbstractInsTableDlg* pDlg = pFact->CreateInsTableDlg(rTempView);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if( RET_OK == pDlg->Execute() )
- {
- pDlg->GetValues( aTableName, nRows, nCols, aInsTblOpts, aAutoName, pTAFmt );
- }
- else
- _rRequest.Ignore();
- delete pDlg;
- }
-
- if( nCols && nRows )
- {
- // record before shell change
- _rRequest.AppendItem( SfxStringItem( FN_INSERT_TABLE, aTableName ) );
- if ( !aAutoName.isEmpty() )
- _rRequest.AppendItem( SfxStringItem( FN_PARAM_2, aAutoName ) );
- _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_COLUMN, nCols ) );
- _rRequest.AppendItem( SfxUInt16Item( SID_ATTR_TABLE_ROW, nRows ) );
- _rRequest.AppendItem( SfxInt32Item( FN_PARAM_1, (sal_Int32) aInsTblOpts.mnInsMode ) );
- _rRequest.Done();
-
- rSh.StartUndo(UNDO_INSTABLE);
- bCallEndUndo = true;
-
- rSh.StartAllAction();
- if( rSh.HasSelection() )
- rSh.DelRight();
-
- rSh.InsertTable( aInsTblOpts, nRows, nCols, text::HoriOrientation::FULL, pTAFmt );
- rSh.MoveTable( fnTablePrev, fnTableStart );
-
- if( !aTableName.isEmpty() && !rSh.GetTblStyle( aTableName ) )
- rSh.GetTableFmt()->SetName( aTableName );
-
- rSh.EndAllAction();
- rTempView.AutoCaption(TABLE_CAP);
- }
- delete pTAFmt;
- }
-
- if( bCallEndUndo )
- {
- SwRewriter aRewriter;
-
- if (rSh.GetTableFmt())
- {
- aRewriter.AddRule(UndoArg1, SW_RESSTR(STR_START_QUOTE));
- aRewriter.AddRule(UndoArg2, rSh.GetTableFmt()->GetName());
- aRewriter.AddRule(UndoArg3, SW_RESSTR(STR_END_QUOTE));
-
- }
- rSh.EndUndo(UNDO_INSTABLE, &aRewriter); // If possible change the Shell
- }
- }
-}
-
-void SwBaseShell::GetGalleryState( SfxItemSet &rSet )
-{
- SwWrtShell &rSh = GetShell();
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- switch ( nWhich )
- {
- case SID_GALLERY_BG_BRUSH:
- {
- int nSel = rSh.GetSelectionType();
- SfxStringListItem aLst( nWhich );
- std::vector<OUString> &rLst = aLst.GetList();
- nParagraphPos = nGraphicPos = nOlePos = nFramePos = nTablePos =
- nTableRowPos = nTableCellPos = nPagePos =
- nHeaderPos = nFooterPos = 0;
- sal_uInt8 nPos = 1;
- rLst.push_back( SW_RESSTR( STR_SWBG_PAGE ) );
- nPagePos = nPos++;
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- bool bHtmlMode = 0 != (nHtmlMode & HTMLMODE_ON);
-
- if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_FULL_STYLES)) &&
- (nSel & nsSelectionType::SEL_TXT) )
- {
- rLst.push_back( SW_RESSTR( STR_SWBG_PARAGRAPH ) );
- nParagraphPos = nPos++;
- }
- if ( (!bHtmlMode || (nHtmlMode & HTMLMODE_SOME_STYLES)) &&
- nSel & (nsSelectionType::SEL_TBL|nsSelectionType::SEL_TBL_CELLS) )
- {
- rLst.push_back( SW_RESSTR( STR_SWBG_TABLE ) );
- nTablePos = nPos++;
-
- if(!bHtmlMode)
- {
- rLst.push_back( SW_RESSTR( STR_SWBG_TABLE_ROW ) );
- nTableRowPos = nPos++;
- }
-
- rLst.push_back( SW_RESSTR( STR_SWBG_TABLE_CELL) );
- nTableCellPos = nPos++;
- }
- if(!bHtmlMode)
- {
- if ( nSel & nsSelectionType::SEL_FRM )
- {
- rLst.push_back( SW_RESSTR( STR_SWBG_FRAME ) );
- nFramePos = nPos++;
- }
- if ( nSel & nsSelectionType::SEL_GRF )
- {
- rLst.push_back( SW_RESSTR( STR_SWBG_GRAPHIC ) );
- nGraphicPos = nPos++;
- }
- if ( nSel & nsSelectionType::SEL_OLE )
- {
- rLst.push_back( SW_RESSTR( STR_SWBG_OLE ) );
- nOlePos = nPos++;
- }
- const sal_uInt16 nType = rSh.GetFrmType(0,sal_True);
- if ( nType & FRMTYPE_HEADER )
- {
- rLst.push_back( SW_RESSTR( STR_SWBG_HEADER ) );
- nHeaderPos = nPos++;
- }
- if ( nType & FRMTYPE_FOOTER )
- {
- rLst.push_back( SW_RESSTR( STR_SWBG_FOOTER ) );
- nFooterPos = nPos;
- }
- }
- if ( rLst.empty() )
- rSet.DisableItem( nWhich );
- else
- rSet.Put( aLst );
- break;
- }
- }
-}
-
-void SwBaseShell::ExecuteGallery(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- rSh.StartAction();
- const SfxItemSet* pArgs = rReq.GetArgs();
- sal_uInt16 nSlot = rReq.GetSlot();
- switch(nSlot)
- {
- case SID_GALLERY_BG_BRUSH:
- {
- if ( !pArgs )
- break;
-
- int nSel = rSh.GetSelectionType();
- if ( nSel & nsSelectionType::SEL_DRW_TXT )
- break;
-
- SFX_REQUEST_ARG( rReq, pPos, SfxUInt16Item, SID_GALLERY_BG_POS, false );
- SFX_REQUEST_ARG( rReq, pBrush, SvxBrushItem, SID_GALLERY_BG_BRUSH, false );
- if ( !pPos || !pBrush )
- break;
-
- sal_uInt8 nPos = pPos->GetValue();
- ++nPos;
-
- SvxBrushItem aBrush( *pBrush );
- aBrush.SetWhich( RES_BACKGROUND );
- if ( nPos == nParagraphPos )
- rSh.SetAttrItem( aBrush );
- else if ( nPos == nTablePos )
- rSh.SetTabBackground( aBrush );
- else if ( nPos == nTableRowPos )
- rSh.SetRowBackground( aBrush );
- else if ( nPos == nTableCellPos )
- rSh.SetBoxBackground( aBrush );
- else if ( nPos == nFramePos || nPos == nGraphicPos || nPos == nOlePos )
- {
- SfxItemSet aCoreSet(GetPool(), RES_BACKGROUND, RES_BACKGROUND);
- aCoreSet.Put( aBrush );
- rSh.SetFlyFrmAttr( aCoreSet );
- }
- else if ( nPos == nPagePos || nPos == nHeaderPos || nPos == nFooterPos )
- {
- sal_uInt16 nDesc = rSh.GetCurPageDesc();
- SwPageDesc aDesc( rSh.GetPageDesc( nDesc ) );
- if ( nPos == nPagePos )
- aDesc.GetMaster().SetFmtAttr( aBrush );
- else if ( nPos == nHeaderPos )
- {
- SwFmtHeader aHead( aDesc.GetMaster().GetHeader() );
- aHead.GetHeaderFmt()->SetFmtAttr( aBrush );
- aDesc.GetMaster().SetFmtAttr( aHead );
- }
- else if ( nPos == nFooterPos )
- {
- SwFmtFooter aFoot( aDesc.GetMaster().GetFooter() );
- aFoot.GetFooterFmt()->SetFmtAttr( aBrush );
- aDesc.GetMaster().SetFmtAttr( aFoot );
- }
- rSh.ChgPageDesc( nDesc, aDesc );
- }
- break;
- }
- }
- rSh.EndAction();
- rReq.Done();
-}
-
-void SwBaseShell::ExecField( SfxRequest& rReq )
-{
- sal_uInt16 nSlot = rReq.GetSlot();
- switch( nSlot )
- {
- case FN_CHANGE_DBFIELD:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- VclAbstractDialog* pDlg = pFact->CreateSwChangeDBDlg(GetView());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- }
- break;
- default:
- OSL_FAIL("wrong dispatcher");
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/beziersh.cxx b/sw/source/ui/shells/beziersh.cxx
deleted file mode 100644
index 8ba2d2a184df..000000000000
--- a/sw/source/ui/shells/beziersh.cxx
+++ /dev/null
@@ -1,330 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "cmdid.h"
-#include <svx/svdview.hxx>
-#include <svl/srchitem.hxx>
-#include <svl/eitem.hxx>
-#include <svl/whiter.hxx>
-#include <svx/svdopath.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/objface.hxx>
-
-#include "wrtsh.hxx"
-#include "view.hxx"
-#include "edtwin.hxx"
-#include "helpid.h"
-#include "globals.hrc"
-#include "drawbase.hxx"
-#include "beziersh.hxx"
-#include "popup.hrc"
-#include "shells.hrc"
-#define SwBezierShell
-#include <sfx2/msg.hxx>
-#include "swslots.hxx"
-
-#include <unomid.h>
-
-SFX_IMPL_INTERFACE(SwBezierShell, SwBaseShell, SW_RES(STR_SHELLNAME_BEZIER))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAW_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_BEZIER_TOOLBOX));
-}
-
-TYPEINIT1(SwBezierShell,SwBaseShell)
-
-SwBezierShell::SwBezierShell(SwView &_rView):
- SwBaseShell( _rView )
-{
- SetName(OUString("Bezier"));
- SetHelpId(SW_BEZIERSHELL);
-
- SwWrtShell *pSh = &GetShell();
- SdrView* pSdrView = pSh->GetDrawView();
- pSdrView->SetEliminatePolyPointLimitAngle(1500L);
-
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw));
-}
-
-void SwBezierShell::Execute(SfxRequest &rReq)
-{
- SwWrtShell *pSh = &GetShell();
- SdrView* pSdrView = pSh->GetDrawView();
- const SfxItemSet *pArgs = rReq.GetArgs();
- sal_uInt16 nSlotId = rReq.GetSlot();
- sal_Bool bChanged = pSdrView->GetModel()->IsChanged();
- pSdrView->GetModel()->SetChanged(false);
- const SfxPoolItem* pItem;
- if(pArgs)
- pArgs->GetItemState(nSlotId, false, &pItem);
-
- switch (nSlotId)
- {
- case SID_DELETE:
- case FN_BACKSPACE:
- if (pSh->IsObjSelected())
- {
- if (pSdrView->HasMarkedPoints())
- pSh->GetView().GetViewFrame()->GetDispatcher()->Execute(SID_BEZIER_DELETE, sal_False);
- else
- {
- pSh->DelSelectedObj();
- if (pSh->IsSelFrmMode())
- {
- pSh->LeaveSelFrmMode();
- pSh->NoEdit();
- }
- GetView().AttrChangedNotify(pSh); // Shell change if applicable...
- }
- }
- break;
-
- case FN_ESCAPE:
- if (pSdrView->HasMarkedPoints())
- pSdrView->UnmarkAllPoints();
- else
- {
- if ( pSh->IsDrawCreate() )
- {
- GetView().GetDrawFuncPtr()->BreakCreate();
- GetView().AttrChangedNotify(pSh); // Shell change if applicable...
- }
- else if ( pSh->HasSelection() || GetView().IsDrawMode() )
- {
- GetView().LeaveDrawCreate();
- pSh->EnterStdMode();
- GetView().AttrChangedNotify(pSh); // Shell change if applicable...
- }
- }
- break;
-
- case SID_BEZIER_MOVE:
- case SID_BEZIER_INSERT:
- {
- GetView().GetEditWin().SetBezierMode(nSlotId);
- static sal_uInt16 aInva[] =
- {
- SID_BEZIER_INSERT,
- SID_BEZIER_MOVE,
- 0
- };
- GetView().GetViewFrame()->GetBindings().Invalidate(aInva);
- }
- break;
-
- case SID_BEZIER_DELETE:
- case SID_BEZIER_CUTLINE:
- case SID_BEZIER_CONVERT:
- case SID_BEZIER_EDGE:
- case SID_BEZIER_SMOOTH:
- case SID_BEZIER_SYMMTR:
- case SID_BEZIER_CLOSE:
- case SID_BEZIER_ELIMINATE_POINTS:
- {
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
-
- if (rMarkList.GetMark(0) && !pSdrView->IsAction())
- {
- switch (nSlotId)
- {
- case SID_BEZIER_DELETE:
- pSdrView->DeleteMarkedPoints();
- break;
-
- case SID_BEZIER_CUTLINE:
- {
- pSdrView->RipUpAtMarkedPoints();
- pSh->CheckUnboundObjects();
- }
- break;
-
- case SID_BEZIER_CONVERT:
- {
- pSdrView->SetMarkedSegmentsKind(SDRPATHSEGMENT_TOGGLE);
- break;
- }
-
- case SID_BEZIER_EDGE:
- case SID_BEZIER_SMOOTH:
- case SID_BEZIER_SYMMTR:
- {
- SdrPathSmoothKind eKind = SDRPATHSMOOTH_ASYMMETRIC;
-
- switch (nSlotId)
- {
- case SID_BEZIER_EDGE: eKind = SDRPATHSMOOTH_ANGULAR; break;
- case SID_BEZIER_SMOOTH: eKind = SDRPATHSMOOTH_ASYMMETRIC; break;
- case SID_BEZIER_SYMMTR: eKind = SDRPATHSMOOTH_SYMMETRIC; break;
- }
-
- SdrPathSmoothKind eSmooth = pSdrView->GetMarkedPointsSmooth();
- if (eKind != eSmooth)
- {
- pSdrView->SetMarkedPointsSmooth(eKind);
-
- static sal_uInt16 aInva[] =
- {
- SID_BEZIER_SMOOTH,
- SID_BEZIER_EDGE,
- SID_BEZIER_SYMMTR,
- 0
- };
- GetView().GetViewFrame()->GetBindings().Invalidate(aInva);
- }
- break;
- }
-
- case SID_BEZIER_CLOSE:
- {
- SdrPathObj* pPathObj = (SdrPathObj*) rMarkList.GetMark(0)->GetMarkedSdrObj();
- pSdrView->UnmarkAllPoints();
- // Size aDist(GetView().GetEditWin().PixelToLogic(Size(8,8)));
- pPathObj->ToggleClosed(); // aDist.Width());
- break;
- }
-
- case SID_BEZIER_ELIMINATE_POINTS:
- pSdrView->SetEliminatePolyPoints(!pSdrView->IsEliminatePolyPoints());
- break;
- }
- }
- }
- break;
-
- default:
- break;
- }
-
- if (pSdrView->GetModel()->IsChanged())
- GetShell().SetModified();
- else if (bChanged)
- pSdrView->GetModel()->SetChanged(true);
-}
-
-void SwBezierShell::GetState(SfxItemSet &rSet)
-{
- SdrView* pSdrView = GetShell().GetDrawView();
-
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while( nWhich )
- {
- switch( nWhich )
- {
- case SID_BEZIER_MOVE:
- case SID_BEZIER_INSERT:
- {
- sal_uInt16 nEditMode = GetView().GetEditWin().GetBezierMode();
-
- rSet.Put(SfxBoolItem(nWhich, nEditMode == nWhich));
- }
- break;
-
- case SID_BEZIER_CUTLINE:
- if (!pSdrView->IsRipUpAtMarkedPointsPossible())
- {
- rSet.DisableItem(SID_BEZIER_CUTLINE);
- }
- break;
-
- case SID_BEZIER_DELETE:
- if (!pSdrView->IsDeleteMarkedPointsPossible())
- {
- rSet.DisableItem(SID_BEZIER_DELETE);
- }
- break;
-
- case SID_BEZIER_CONVERT:
- if (!pSdrView->IsSetMarkedSegmentsKindPossible())
- {
- rSet.DisableItem(SID_BEZIER_CONVERT);
- }
- else
- {
- SdrPathSegmentKind eSegm = pSdrView->GetMarkedSegmentsKind();
- switch (eSegm)
- {
- case SDRPATHSEGMENT_DONTCARE: rSet.InvalidateItem(SID_BEZIER_CONVERT); break;
- case SDRPATHSEGMENT_LINE : rSet.Put(SfxBoolItem(SID_BEZIER_CONVERT,false)); break; // Button pressed = curve
- case SDRPATHSEGMENT_CURVE : rSet.Put(SfxBoolItem(SID_BEZIER_CONVERT,true)); break;
- default:; //prevent warning
- }
- }
- break;
-
- case SID_BEZIER_EDGE:
- case SID_BEZIER_SMOOTH:
- case SID_BEZIER_SYMMTR:
- if (!pSdrView->IsSetMarkedPointsSmoothPossible())
- rSet.DisableItem(nWhich);
- else
- {
- SdrPathSmoothKind eSmooth = pSdrView->GetMarkedPointsSmooth();
- sal_Bool bEnable = sal_False;
- switch (eSmooth)
- {
- case SDRPATHSMOOTH_DONTCARE :
- break;
- case SDRPATHSMOOTH_ANGULAR :
- bEnable = nWhich == SID_BEZIER_EDGE;
- break;
- case SDRPATHSMOOTH_ASYMMETRIC:
- bEnable = nWhich == SID_BEZIER_SMOOTH;
- break;
- case SDRPATHSMOOTH_SYMMETRIC :
- bEnable = nWhich == SID_BEZIER_SYMMTR;
- break;
- }
- rSet.Put(SfxBoolItem(nWhich, bEnable));
- }
- break;
-
- case SID_BEZIER_CLOSE:
- if (!pSdrView->IsOpenCloseMarkedObjectsPossible())
- {
- rSet.DisableItem(SID_BEZIER_CLOSE);
- }
- else
- {
- SdrObjClosedKind eClose = pSdrView->GetMarkedObjectsClosedState();
- switch (eClose)
- {
- case SDROBJCLOSED_DONTCARE: rSet.InvalidateItem(SID_BEZIER_CLOSE); break;
- case SDROBJCLOSED_OPEN : rSet.Put(SfxBoolItem(SID_BEZIER_CLOSE,false)); break;
- case SDROBJCLOSED_CLOSED : rSet.Put(SfxBoolItem(SID_BEZIER_CLOSE,true)); break;
- default:; //prevent warning
- }
- }
- break;
-
- case SID_BEZIER_ELIMINATE_POINTS:
- rSet.Put(SfxBoolItem(SID_BEZIER_ELIMINATE_POINTS, pSdrView->IsEliminatePolyPoints()));
- break;
-
- default:
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/drawdlg.cxx b/sw/source/ui/shells/drawdlg.cxx
deleted file mode 100644
index 9ba12d925938..000000000000
--- a/sw/source/ui/shells/drawdlg.cxx
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <svx/svxids.hrc>
-#include <vcl/msgbox.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/dispatch.hxx>
-#include <svx/svdview.hxx>
-#include <svx/drawitem.hxx>
-
-#include <svx/xtable.hxx>
-#include "view.hxx"
-#include "wrtsh.hxx"
-#include "docsh.hxx"
-#include "cmdid.h"
-
-#include "drawsh.hxx"
-#include <svx/svxdlg.hxx>
-#include <svx/dialogs.hrc>
-
-void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
-{
- SwWrtShell* pSh = &GetShell();
- SdrView* pView = pSh->GetDrawView();
- SdrModel* pDoc = pView->GetModel();
- sal_Bool bChanged = pDoc->IsChanged();
- pDoc->SetChanged(false);
-
- SfxItemSet aNewAttr( pDoc->GetItemPool() );
- pView->GetAttributes( aNewAttr );
-
- GetView().NoRotate();
-
- switch (rReq.GetSlot())
- {
- case FN_DRAWTEXT_ATTR_DLG:
- {
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if ( pFact )
- {
- SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, pView );
- sal_uInt16 nResult = pDlg->Execute();
-
- if (nResult == RET_OK)
- {
- if (pView->AreObjectsMarked())
- {
- pSh->StartAction();
- pView->SetAttributes(*pDlg->GetOutputItemSet());
- rReq.Done(*(pDlg->GetOutputItemSet()));
- pSh->EndAction();
- }
- }
-
- delete( pDlg );
- }
- }
- break;
-
- case SID_ATTRIBUTES_AREA:
- {
- sal_Bool bHasMarked = pView->AreObjectsMarked();
-
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( NULL,
- &aNewAttr,
- pDoc,
- pView);
- if (pDlg->Execute() == RET_OK)
- {
- pSh->StartAction();
- if (bHasMarked)
- pView->SetAttributes(*pDlg->GetOutputItemSet());
- else
- pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), sal_False);
- pSh->EndAction();
-
- static sal_uInt16 aInval[] =
- {
- SID_ATTR_FILL_STYLE,
- SID_ATTR_FILL_COLOR,
- SID_ATTR_FILL_TRANSPARENCE,
- SID_ATTR_FILL_FLOATTRANSPARENCE,
- 0
- };
- SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
- rBnd.Invalidate(aInval);
- rBnd.Update(SID_ATTR_FILL_STYLE);
- rBnd.Update(SID_ATTR_FILL_COLOR);
- rBnd.Update(SID_ATTR_FILL_TRANSPARENCE);
- rBnd.Update(SID_ATTR_FILL_FLOATTRANSPARENCE);
- }
- delete pDlg;
- }
- break;
-
- case SID_ATTRIBUTES_LINE:
- {
- sal_Bool bHasMarked = pView->AreObjectsMarked();
-
- const SdrObject* pObj = NULL;
- const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
- if( rMarkList.GetMarkCount() == 1 )
- pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet Factory fail!");
- SfxAbstractTabDialog * pDlg = pFact->CreateSvxLineTabDialog( NULL,
- &aNewAttr,
- pDoc,
- pObj,
- bHasMarked);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if (pDlg->Execute() == RET_OK)
- {
- pSh->StartAction();
- if(bHasMarked)
- pView->SetAttrToMarked(*pDlg->GetOutputItemSet(), sal_False);
- else
- pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), sal_False);
- pSh->EndAction();
-
- static sal_uInt16 aInval[] =
- {
- SID_ATTR_LINE_STYLE, // ( SID_SVX_START + 169 )
- SID_ATTR_LINE_DASH, // ( SID_SVX_START + 170 )
- SID_ATTR_LINE_WIDTH, // ( SID_SVX_START + 171 )
- SID_ATTR_LINE_COLOR, // ( SID_SVX_START + 172 )
- SID_ATTR_LINE_START, // ( SID_SVX_START + 173 )
- SID_ATTR_LINE_END, // ( SID_SVX_START + 174 )
- SID_ATTR_LINE_TRANSPARENCE, // (SID_SVX_START+1107)
- SID_ATTR_LINE_JOINT, // (SID_SVX_START+1110)
- SID_ATTR_LINE_CAP, // (SID_SVX_START+1111)
- 0
- };
-
- GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
- }
- delete pDlg;
- }
- break;
-
- default:
- break;
- }
-
- if (pDoc->IsChanged())
- GetShell().SetModified();
- else
- if (bChanged)
- pDoc->SetChanged(true);
-}
-
-void SwDrawShell::ExecDrawAttrArgs(SfxRequest& rReq)
-{
- SwWrtShell* pSh = &GetShell();
- SdrView* pView = pSh->GetDrawView();
- const SfxItemSet* pArgs = rReq.GetArgs();
- sal_Bool bChanged = pView->GetModel()->IsChanged();
- pView->GetModel()->SetChanged(false);
-
- GetView().NoRotate();
-
- if (pArgs)
- {
- if(pView->AreObjectsMarked())
- pView->SetAttrToMarked(*rReq.GetArgs(), sal_False);
- else
- pView->SetDefaultAttr(*rReq.GetArgs(), sal_False);
- }
- else
- {
- SfxDispatcher* pDis = pSh->GetView().GetViewFrame()->GetDispatcher();
- switch (rReq.GetSlot())
- {
- case SID_ATTR_FILL_STYLE:
- case SID_ATTR_FILL_COLOR:
- case SID_ATTR_FILL_GRADIENT:
- case SID_ATTR_FILL_HATCH:
- case SID_ATTR_FILL_BITMAP:
- case SID_ATTR_FILL_TRANSPARENCE:
- case SID_ATTR_FILL_FLOATTRANSPARENCE:
- pDis->Execute(SID_ATTRIBUTES_AREA, sal_False);
- break;
- case SID_ATTR_LINE_STYLE:
- case SID_ATTR_LINE_DASH:
- case SID_ATTR_LINE_WIDTH:
- case SID_ATTR_LINE_COLOR:
- case SID_ATTR_LINE_TRANSPARENCE:
- case SID_ATTR_LINE_JOINT:
- case SID_ATTR_LINE_CAP:
- pDis->Execute(SID_ATTRIBUTES_LINE, sal_False);
- break;
- }
- }
- if (pView->GetModel()->IsChanged())
- GetShell().SetModified();
- else
- if (bChanged)
- pView->GetModel()->SetChanged(true);
-}
-
-void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
-{
- SdrView* pSdrView = GetShell().GetDrawView();
-
- if (pSdrView->AreObjectsMarked())
- {
- sal_Bool bDisable = Disable( rSet );
-
- if( !bDisable )
- pSdrView->GetAttributes( rSet );
- }
- else
- rSet.Put(pSdrView->GetDefaultAttr());
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/drawsh.cxx b/sw/source/ui/shells/drawsh.cxx
deleted file mode 100644
index 5932d12c999b..000000000000
--- a/sw/source/ui/shells/drawsh.cxx
+++ /dev/null
@@ -1,597 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <tools/shl.hxx>
-#include <svx/svdview.hxx>
-#include <svx/svdotext.hxx>
-#include <svl/whiter.hxx>
-#include <svx/fontwork.hxx>
-#include <sfx2/docfile.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/objface.hxx>
-#include <svl/itemiter.hxx>
-#include <svl/srchitem.hxx>
-#include <svx/extrusionbar.hxx>
-#include <svx/fontworkbar.hxx>
-#include <svx/tbxcustomshapes.hxx>
-#include <uitool.hxx>
-#include <wview.hxx>
-#include <swmodule.hxx>
-#include <swwait.hxx>
-#include <doc.hxx>
-#include <docsh.hxx>
-#include <docstat.hxx>
-#include <IDocumentStatistics.hxx>
-#include <tools/diagnose_ex.h>
-
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
-
-#include <svx/svdoashp.hxx>
-#include <svx/xtable.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <svx/svdoashp.hxx>
-#include <svx/svdoole2.hxx>
-#include <sfx2/opengrf.hxx>
-#include <svx/svdograf.hxx>
-#include <svx/svdundo.hxx>
-#include <svx/xbtmpit.hxx>
-
-#include "swundo.hxx"
-#include "wrtsh.hxx"
-#include "cmdid.h"
-#include "globals.hrc"
-#include "helpid.h"
-#include "popup.hrc"
-#include "shells.hrc"
-#include "drwbassh.hxx"
-#include "drawsh.hxx"
-
-#define SwDrawShell
-#include <sfx2/msg.hxx>
-#include "swslots.hxx"
-#include "swabstdlg.hxx"
-#include <wordcountdialog.hxx>
-#include "misc.hrc"
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-SFX_IMPL_INTERFACE(SwDrawShell, SwDrawBaseShell, SW_RES(STR_SHELLNAME_DRAW))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAW_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_DRAW_TOOLBOX));
- SFX_CHILDWINDOW_REGISTRATION(SvxFontWorkChildWindow::GetChildWindowId());
-}
-
-TYPEINIT1(SwDrawShell,SwDrawBaseShell)
-
-// #i123922# check as the name implies
-SdrObject* SwDrawShell::IsSingleFillableNonOLESelected()
-{
- SwWrtShell &rSh = GetShell();
- SdrView* pSdrView = rSh.GetDrawView();
-
- if(!pSdrView)
- {
- return 0;
- }
-
- if(1 != pSdrView->GetMarkedObjectCount())
- {
- return 0;
- }
-
- SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
-
- if(!pPickObj)
- {
- return 0;
- }
-
- if(!pPickObj->IsClosedObj())
- {
- return 0;
- }
-
- if(dynamic_cast< SdrOle2Obj* >(pPickObj))
- {
- return 0;
- }
-
- return pPickObj;
-}
-
-// #i123922# insert given graphic data dependent of the object type in focus
-void SwDrawShell::InsertPictureFromFile(SdrObject& rObject)
-{
- SwWrtShell &rSh = GetShell();
- SdrView* pSdrView = rSh.GetDrawView();
-
- if(pSdrView)
- {
- SvxOpenGraphicDialog aDlg(SW_RESSTR(STR_INSERT_GRAPHIC));
-
- if(GRFILTER_OK == aDlg.Execute())
- {
- Graphic aGraphic;
- int nError(aDlg.GetGraphic(aGraphic));
-
- if(GRFILTER_OK == nError)
- {
- const bool bAsLink(aDlg.IsAsLink());
- SdrObject* pResult = &rObject;
-
- rSh.StartUndo(UNDO_PASTE_CLIPBOARD);
-
- if(dynamic_cast< SdrGrafObj* >(&rObject))
- {
- SdrGrafObj* pNewGrafObj = (SdrGrafObj*)rObject.Clone();
-
- pNewGrafObj->SetGraphic(aGraphic);
-
- // #i123922# for handling MasterObject and virtual ones correctly, SW
- // wants us to call ReplaceObject at the page, but that also
- // triggers the same assertion (I tried it), so stay at the view method
- pSdrView->ReplaceObjectAtView(&rObject, *pSdrView->GetSdrPageView(), pNewGrafObj);
-
- OUString aReferer;
- SwDocShell *pDocShell = rSh.GetDoc()->GetDocShell();
- if (pDocShell->HasName()) {
- aReferer = pDocShell->GetMedium()->GetName();
- }
-
- // set in all cases - the Clone() will have copied an existing link (!)
- pNewGrafObj->SetGraphicLink(
- bAsLink ? aDlg.GetPath() : OUString(),
- aReferer,
- bAsLink ? aDlg.GetCurrentFilter() : OUString());
-
- pResult = pNewGrafObj;
- }
- else // if(rObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rObject))
- {
- pSdrView->AddUndo(new SdrUndoAttrObj(rObject));
-
- SfxItemSet aSet(pSdrView->GetModel()->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
-
- aSet.Put(XFillStyleItem(XFILL_BITMAP));
- aSet.Put(XFillBitmapItem(OUString(), aGraphic));
- rObject.SetMergedItemSetAndBroadcast(aSet);
- }
-
- rSh.EndUndo( UNDO_END );
-
- if(pResult)
- {
- // we are done; mark the modified/new object
- pSdrView->MarkObj(pResult, pSdrView->GetSdrPageView());
- }
- }
- }
- }
-}
-
-void SwDrawShell::Execute(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- SdrView *pSdrView = rSh.GetDrawView();
- const SfxItemSet *pArgs = rReq.GetArgs();
- SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
- sal_uInt16 nSlotId = rReq.GetSlot();
- sal_Bool bChanged = pSdrView->GetModel()->IsChanged();
-
- pSdrView->GetModel()->SetChanged(false);
-
- const SfxPoolItem* pItem;
- if(pArgs)
- pArgs->GetItemState(nSlotId, false, &pItem);
-
- bool bMirror = true;
-
- switch (nSlotId)
- {
- case SID_OBJECT_ROTATE:
- if (rSh.IsObjSelected() && pSdrView->IsRotateAllowed())
- {
- if (GetView().IsDrawRotate())
- rSh.SetDragMode(SDRDRAG_MOVE);
- else
- rSh.SetDragMode(SDRDRAG_ROTATE);
-
- GetView().FlipDrawRotate();
- }
- break;
-
- case SID_BEZIER_EDIT:
- if (GetView().IsDrawRotate())
- {
- rSh.SetDragMode(SDRDRAG_MOVE);
- GetView().FlipDrawRotate();
- }
- GetView().FlipDrawSelMode();
- pSdrView->SetFrameDragSingles(GetView().IsDrawSelMode());
- GetView().AttrChangedNotify(&rSh); // Shell switch
- break;
-
- case SID_OBJECT_HELL:
- if (rSh.IsObjSelected())
- {
- rSh.StartUndo( UNDO_START );
- SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP);
- rSh.SelectionToHell();
- rSh.EndUndo( UNDO_END );
- rBnd.Invalidate(SID_OBJECT_HEAVEN);
- }
- break;
-
- case SID_OBJECT_HEAVEN:
- if (rSh.IsObjSelected())
- {
- rSh.StartUndo( UNDO_START );
- SetWrapMode(FN_FRAME_WRAPTHRU);
- rSh.SelectionToHeaven();
- rSh.EndUndo( UNDO_END );
- rBnd.Invalidate(SID_OBJECT_HELL);
- }
- break;
-
- case FN_TOOL_HIERARCHIE:
- if (rSh.IsObjSelected())
- {
- rSh.StartUndo( UNDO_START );
- if (rSh.GetLayerId() == 0)
- {
- SetWrapMode(FN_FRAME_WRAPTHRU);
- rSh.SelectionToHeaven();
- }
- else
- {
- SetWrapMode(FN_FRAME_WRAPTHRU_TRANSP);
- rSh.SelectionToHell();
- }
- rSh.EndUndo( UNDO_END );
- rBnd.Invalidate( SID_OBJECT_HELL );
- rBnd.Invalidate( SID_OBJECT_HEAVEN );
- }
- break;
-
- case SID_FLIP_VERTICAL:
- bMirror = false;
- /* no break */
- case SID_FLIP_HORIZONTAL:
- rSh.MirrorSelection( bMirror );
- break;
-
- case SID_FONTWORK:
- {
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if (pArgs)
- {
- pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
- ((const SfxBoolItem&)(pArgs->Get(SID_FONTWORK))).GetValue());
- }
- else
- pVFrame->ToggleChildWindow( SvxFontWorkChildWindow::GetChildWindowId() );
- pVFrame->GetBindings().Invalidate(SID_FONTWORK);
- }
- break;
- case FN_FORMAT_FOOTNOTE_DLG:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), GetView().GetWrtShell());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- break;
- }
- case FN_NUMBERING_OUTLINE_DLG:
- {
- SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
- GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- rReq.Done();
- }
- break;
- case SID_OPEN_XML_FILTERSETTINGS:
- {
- try
- {
- uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
- xDialog->execute();
- }
- catch (const uno::Exception&)
- {
- }
- rReq.Ignore ();
- }
- break;
- case FN_WORDCOUNT_DIALOG:
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if (pVFrame != NULL)
- {
- pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
- Invalidate(rReq.GetSlot());
-
- SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
- if (pWrdCnt)
- pWrdCnt->UpdateCounts();
- }
- }
- break;
- case SID_EXTRUSION_TOOGLE:
- case SID_EXTRUSION_TILT_DOWN:
- case SID_EXTRUSION_TILT_UP:
- case SID_EXTRUSION_TILT_LEFT:
- case SID_EXTRUSION_TILT_RIGHT:
- case SID_EXTRUSION_3D_COLOR:
- case SID_EXTRUSION_DEPTH:
- case SID_EXTRUSION_DIRECTION:
- case SID_EXTRUSION_PROJECTION:
- case SID_EXTRUSION_LIGHTING_DIRECTION:
- case SID_EXTRUSION_LIGHTING_INTENSITY:
- case SID_EXTRUSION_SURFACE:
- case SID_EXTRUSION_DEPTH_FLOATER:
- case SID_EXTRUSION_DIRECTION_FLOATER:
- case SID_EXTRUSION_LIGHTING_FLOATER:
- case SID_EXTRUSION_SURFACE_FLOATER:
- case SID_EXTRUSION_DEPTH_DIALOG:
- svx::ExtrusionBar::execute( pSdrView, rReq, rBnd );
- rReq.Ignore ();
- break;
-
- case SID_FONTWORK_SHAPE:
- case SID_FONTWORK_SHAPE_TYPE:
- case SID_FONTWORK_ALIGNMENT:
- case SID_FONTWORK_SAME_LETTER_HEIGHTS:
- case SID_FONTWORK_CHARACTER_SPACING:
- case SID_FONTWORK_KERN_CHARACTER_PAIRS:
- case SID_FONTWORK_CHARACTER_SPACING_FLOATER:
- case SID_FONTWORK_ALIGNMENT_FLOATER:
- case SID_FONTWORK_CHARACTER_SPACING_DIALOG:
- svx::FontworkBar::execute( pSdrView, rReq, rBnd );
- rReq.Ignore ();
- break;
-
- case SID_INSERT_GRAPHIC:
- {
- // #i123922# check if we can do something
- SdrObject* pObj = IsSingleFillableNonOLESelected();
-
- if(pObj)
- {
- // ...and if yes, do something
- InsertPictureFromFile(*pObj);
- }
-
- break;
- }
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
- if (pSdrView->GetModel()->IsChanged())
- rSh.SetModified();
- else if (bChanged)
- pSdrView->GetModel()->SetChanged(true);
-}
-
-void SwDrawShell::GetState(SfxItemSet& rSet)
-{
- SwWrtShell &rSh = GetShell();
- SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
-
- if (!bProtected) // Check the parent
- bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
-
- while( nWhich )
- {
- switch( nWhich )
- {
- case SID_OBJECT_HELL:
- if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 0 || bProtected )
- rSet.DisableItem( nWhich );
- break;
-
- case SID_OBJECT_HEAVEN:
- if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 1 || bProtected )
- rSet.DisableItem( nWhich );
- break;
-
- case FN_TOOL_HIERARCHIE:
- if ( !rSh.IsObjSelected() || bProtected )
- rSet.DisableItem( nWhich );
- break;
-
- case SID_OBJECT_ROTATE:
- {
- const sal_Bool bIsRotate = GetView().IsDrawRotate();
- if ( (!bIsRotate && !pSdrView->IsRotateAllowed()) || bProtected )
- rSet.DisableItem( nWhich );
- else
- rSet.Put( SfxBoolItem( nWhich, bIsRotate ) );
- }
- break;
-
- case SID_BEZIER_EDIT:
- if (!Disable(rSet, nWhich))
- rSet.Put( SfxBoolItem( nWhich, !GetView().IsDrawSelMode()));
- break;
-
- case SID_FLIP_VERTICAL:
- if ( !pSdrView->IsMirrorAllowed() || bProtected )
- {
- rSet.DisableItem( nWhich );
- }
- else
- {
- // TTTT - needs to be adapted in aw080:
- // state is not kept for drawing objects --> provide not flipped state
- rSet.Put( SfxBoolItem( nWhich, false ) );
- }
- break;
-
- case SID_FLIP_HORIZONTAL:
- if ( !pSdrView->IsMirrorAllowed() || bProtected )
- {
- rSet.DisableItem( nWhich );
- }
- else
- {
- // TTTT - needs to be adapted in aw080:
- // state is not kept for drawing objects --> provide not flipped state
- rSet.Put( SfxBoolItem( nWhich, false ) );
- }
- break;
-
- case SID_FONTWORK:
- {
- if (bProtected)
- rSet.DisableItem( nWhich );
- else
- {
- const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
- rSet.Put(SfxBoolItem( nWhich , GetView().GetViewFrame()->HasChildWindow(nId)));
- }
- }
- break;
-
- case SID_INSERT_GRAPHIC:
- {
- // #i123922# check if we can do something
- SdrObject* pObj = IsSingleFillableNonOLESelected();
-
- if(!pObj)
- {
- rSet.DisableItem(nWhich);
- }
-
- break;
- }
- }
- nWhich = aIter.NextWhich();
- }
- svx::ExtrusionBar::getState( pSdrView, rSet );
- svx::FontworkBar::getState( pSdrView, rSet );
-}
-
-SwDrawShell::SwDrawShell(SwView &_rView) :
- SwDrawBaseShell(_rView)
-{
- SetHelpId(SW_DRAWSHELL);
- SetName(OUString("Draw"));
-
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Draw));
-}
-
-// Edit SfxRequests for FontWork
-
-void SwDrawShell::ExecFormText(SfxRequest& rReq)
-{
- SwWrtShell &rSh = GetShell();
- SdrView* pDrView = rSh.GetDrawView();
- sal_Bool bChanged = pDrView->GetModel()->IsChanged();
- pDrView->GetModel()->SetChanged(false);
-
- const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
-
- if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
- {
- const SfxItemSet& rSet = *rReq.GetArgs();
-
- if ( pDrView->IsTextEdit() )
- {
- pDrView->SdrEndTextEdit( sal_True );
- GetView().AttrChangedNotify(&rSh);
- }
-
- pDrView->SetAttributes(rSet);
- }
- if (pDrView->GetModel()->IsChanged())
- rSh.SetModified();
- else
- if (bChanged)
- pDrView->GetModel()->SetChanged(true);
-}
-
-//Return status values for FontWork
-
-void SwDrawShell::GetFormTextState(SfxItemSet& rSet)
-{
- SwWrtShell &rSh = GetShell();
- SdrView* pDrView = rSh.GetDrawView();
- const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
- const SdrObject* pObj = NULL;
- SvxFontWorkDialog* pDlg = NULL;
-
- const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
-
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if ( pVFrame->HasChildWindow(nId) )
- pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow());
-
- if ( rMarkList.GetMarkCount() == 1 )
- pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-
- const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
- const bool bDeactivate(
- !pObj ||
- !pTextObj ||
- !pTextObj->HasText() ||
- dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes
-
- if(bDeactivate)
- {
- rSet.DisableItem(XATTR_FORMTXTSTYLE);
- rSet.DisableItem(XATTR_FORMTXTADJUST);
- rSet.DisableItem(XATTR_FORMTXTDISTANCE);
- rSet.DisableItem(XATTR_FORMTXTSTART);
- rSet.DisableItem(XATTR_FORMTXTMIRROR);
- rSet.DisableItem(XATTR_FORMTXTHIDEFORM);
- rSet.DisableItem(XATTR_FORMTXTOUTLINE);
- rSet.DisableItem(XATTR_FORMTXTSHADOW);
- rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR);
- rSet.DisableItem(XATTR_FORMTXTSHDWXVAL);
- rSet.DisableItem(XATTR_FORMTXTSHDWYVAL);
- }
- else
- {
- if ( pDlg )
- pDlg->SetColorList(XColorList::GetStdColorList());
-
- pDrView->GetAttributes( rSet );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/drformsh.cxx b/sw/source/ui/shells/drformsh.cxx
deleted file mode 100644
index 117db5a8c69e..000000000000
--- a/sw/source/ui/shells/drformsh.cxx
+++ /dev/null
@@ -1,258 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-#include <svx/hlnkitem.hxx>
-#include <svx/svdview.hxx>
-#include <svl/whiter.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/objface.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <svl/srchitem.hxx>
-#include <svx/fmglob.hxx>
-#include <svx/svdouno.hxx>
-#include <com/sun/star/form/FormButtonType.hpp>
-#include <sfx2/htmlmode.hxx>
-#include <tools/urlobj.hxx>
-
-#include "viewopt.hxx"
-#include "swmodule.hxx"
-#include "wrtsh.hxx"
-#include "cmdid.h"
-#include "globals.hrc"
-#include "helpid.h"
-#include "popup.hrc"
-#include "shells.hrc"
-#include "drwbassh.hxx"
-#include "drformsh.hxx"
-#include <svl/urihelper.hxx>
-#include <view.hxx>
-#include <sfx2/docfile.hxx>
-#include <docsh.hxx>
-
-#define SwDrawFormShell
-#include <sfx2/msg.hxx>
-#include "swslots.hxx"
-
-#include <unomid.h>
-
-using namespace ::com::sun::star;
-
-SFX_IMPL_INTERFACE(SwDrawFormShell, SwDrawBaseShell, SW_RES(STR_SHELLNAME_DRAWFORM))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRAWFORM_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX));
-}
-
-TYPEINIT1(SwDrawFormShell, SwDrawBaseShell)
-
-void SwDrawFormShell::Execute(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- const SfxPoolItem* pItem = 0;
- const SfxItemSet *pArgs = rReq.GetArgs();
-
- switch ( rReq.GetSlot() )
- {
- case SID_HYPERLINK_SETLINK:
- {
- if(pArgs)
- pArgs->GetItemState(SID_HYPERLINK_SETLINK, false, &pItem);
- if(pItem)
- {
- SdrView *pSdrView = rSh.GetDrawView();
- const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
- bool bConvertToText = rHLinkItem.GetInsertMode() == HLINK_DEFAULT ||
- rHLinkItem.GetInsertMode() == HLINK_FIELD;
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- if (rMarkList.GetMark(0))
- {
- SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
- if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
- {
- if(bConvertToText)
- {
- //remove object -> results in destruction of this!
- SwView& rTempView = GetView();
- rTempView.GetViewFrame()->GetDispatcher()->Execute(SID_DELETE, SFX_CALLMODE_SYNCHRON );
- rTempView.StopShellTimer();
- //issue a new command to insert the link
- rTempView.GetViewFrame()->GetDispatcher()->Execute(
- SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON, &rHLinkItem, 0);
- }
- else
- {
- uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel();
-
- OSL_ENSURE( xControlModel.is(), "UNO-Control without Model" );
- if( !xControlModel.is() )
- return;
-
- uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY);
-
- // Can we set an URL to the object?
- OUString sTargetURL( "TargetURL" );
- uno::Reference< beans::XPropertySetInfo > xPropInfoSet = xPropSet->getPropertySetInfo();
- if( xPropInfoSet->hasPropertyByName( sTargetURL ))
- {
- beans::Property aProp = xPropInfoSet->getPropertyByName( sTargetURL );
- if( !aProp.Name.isEmpty() )
- {
- uno::Any aTmp;
- // Yes!
- OUString sLabel("Label");
- if( xPropInfoSet->hasPropertyByName(sLabel) )
- {
- aTmp <<= OUString(rHLinkItem.GetName());
- xPropSet->setPropertyValue(sLabel, aTmp );
- }
-
- SfxMedium* pMedium = GetView().GetDocShell()->GetMedium();
- INetURLObject aAbs;
- if( pMedium )
- aAbs = pMedium->GetURLObject();
- aTmp <<= OUString(URIHelper::SmartRel2Abs(aAbs, rHLinkItem.GetURL()));
- xPropSet->setPropertyValue( sTargetURL, aTmp );
-
- if( !rHLinkItem.GetTargetFrame().isEmpty() )
- {
- aTmp <<= rHLinkItem.GetTargetFrame();
- xPropSet->setPropertyValue( "TargetFrame", aTmp );
- }
-
- form::FormButtonType eButtonType = form::FormButtonType_URL;
- aTmp.setValue( &eButtonType, ::getCppuType((const form::FormButtonType*)0));
- xPropSet->setPropertyValue( "ButtonType", aTmp );
- }
- }
- }
- }
- }
- }
- }
- break;
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
-}
-
-void SwDrawFormShell::GetState(SfxItemSet& rSet)
-{
- SwWrtShell &rSh = GetShell();
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while( nWhich )
- {
- switch( nWhich )
- {
- case SID_HYPERLINK_GETLINK:
- {
- SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- SvxHyperlinkItem aHLinkItem;
- if (rMarkList.GetMark(0))
- {
- SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
- if (pUnoCtrl && FmFormInventor == pUnoCtrl->GetObjInventor())
- {
- uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel();
-
- OSL_ENSURE( xControlModel.is(), "UNO-Control without Model" );
- if( !xControlModel.is() )
- return;
-
- uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY);
-
- uno::Any aTmp;
- uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo();
- if(xInfo->hasPropertyByName( "ButtonType" ))
- {
- form::FormButtonType eButtonType = form::FormButtonType_URL;
- aTmp = xPropSet->getPropertyValue( "ButtonType" );
- if( aTmp >>= eButtonType )
- {
- // Label
- if(xInfo->hasPropertyByName( "Label" ))
- {
- aTmp = xPropSet->getPropertyValue( "Label" );
- OUString sTmp;
- if( (aTmp >>= sTmp) && !sTmp.isEmpty())
- {
- aHLinkItem.SetName(sTmp);
- }
- }
-
- // URL
- if(xInfo->hasPropertyByName( "TargetURL" ))
- {
- aTmp = xPropSet->getPropertyValue( "TargetURL" );
- OUString sTmp;
- if( (aTmp >>= sTmp) && !sTmp.isEmpty())
- {
- aHLinkItem.SetURL(sTmp);
- }
- }
-
- // Target
- if(xInfo->hasPropertyByName( "TargetFrame" ))
- {
- aTmp = xPropSet->getPropertyValue( "TargetFrame" );
- OUString sTmp;
- if( (aTmp >>= sTmp) && !sTmp.isEmpty())
- {
- aHLinkItem.SetTargetFrame(sTmp);
- }
- }
- aHLinkItem.SetInsertMode(HLINK_BUTTON);
- }
- }
- }
- }
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
- ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
-
- rSet.Put(aHLinkItem);
- }
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-SwDrawFormShell::SwDrawFormShell(SwView &_rView) :
- SwDrawBaseShell(_rView)
-{
- SetHelpId(SW_DRAWFORMSHELL);
- GetShell().NoEdit(true);
- SetName(OUString("DrawForm"));
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Form));
-}
-
-SwDrawFormShell::~SwDrawFormShell()
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx
deleted file mode 100644
index c19d90caa019..000000000000
--- a/sw/source/ui/shells/drwbassh.cxx
+++ /dev/null
@@ -1,961 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <tools/shl.hxx>
-#include <hintids.hxx>
-#include <helpid.h>
-#include <swtypes.hxx>
-#include <sfx2/objface.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/bindings.hxx>
-#include <svl/aeitem.hxx>
-#include <svx/svdview.hxx>
-#include <vcl/msgbox.hxx>
-#include <svl/srchitem.hxx>
-#include <svl/whiter.hxx>
-#include <svx/swframevalidation.hxx>
-#include <svx/anchorid.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <uitool.hxx>
-#include <fmtornt.hxx>
-#include <cmdid.h>
-#include <swmodule.hxx>
-#include <wrtsh.hxx>
-#include <wview.hxx>
-#include <edtwin.hxx>
-#include <viewopt.hxx>
-#include <dcontact.hxx>
-#include <frmfmt.hxx>
-#include <wrap.hxx>
-#include <drawbase.hxx>
-#include <drwbassh.hxx>
-#include <swdtflvr.hxx>
-#include <svx/svdogrp.hxx>
-#include <svx/svdpage.hxx>
-#include <svx/svditer.hxx>
-
-#include <shells.hrc>
-#define SwDrawBaseShell
-#include <sfx2/msg.hxx>
-#include <swslots.hxx>
-#include <svx/svxdlg.hxx>
-#include <svx/dialogs.hrc>
-#include "swabstdlg.hxx"
-#include "dialog.hrc"
-#include <swundo.hxx>
-#include <com/sun/star/text/HoriOrientation.hpp>
-#include <com/sun/star/text/VertOrientation.hpp>
-#include <com/sun/star/text/RelOrientation.hpp>
-
-#include <IDocumentDrawModelAccess.hxx>
-
-using namespace ::com::sun::star;
-
-SFX_IMPL_INTERFACE(SwDrawBaseShell, SwBaseShell, SW_RES(0))
-{
-}
-
-TYPEINIT1(SwDrawBaseShell,SwBaseShell)
-
-SwDrawBaseShell::SwDrawBaseShell(SwView &_rView):
- SwBaseShell( _rView )
-{
- GetShell().NoEdit(true);
-
- SwEditWin& rWin = GetView().GetEditWin();
-
- rWin.SetBezierMode(SID_BEZIER_MOVE);
-
- if ( !_rView.GetDrawFuncPtr() )
- _rView.GetEditWin().StdDrawMode( OBJ_NONE, sal_True );
-
- SwTransferable::CreateSelection( GetShell() );
-}
-
-SwDrawBaseShell::~SwDrawBaseShell()
-{
- GetView().ExitDraw();
- GetShell().Edit();
- SwTransferable::ClearSelection( GetShell() );
-}
-
-void SwDrawBaseShell::Execute(SfxRequest &rReq)
-{
- SwWrtShell *pSh = &GetShell();
- SdrView* pSdrView = pSh->GetDrawView();
- const SfxItemSet *pArgs = rReq.GetArgs();
- sal_uInt16 nSlotId = rReq.GetSlot();
- sal_Bool bChanged = pSdrView->GetModel()->IsChanged();
- pSdrView->GetModel()->SetChanged(false);
- const SfxPoolItem* pItem = 0;
- if(pArgs)
- pArgs->GetItemState(nSlotId, false, &pItem);
-
- //Special case align by menu
- if(pItem && nSlotId == SID_OBJECT_ALIGN)
- {
- OSL_ENSURE(PTR_CAST(SfxEnumItem, pItem),"SfxEnumItem expected");
- nSlotId = nSlotId + ((const SfxEnumItem*)pItem)->GetValue();
- nSlotId++;
- }
-
- sal_Bool bAlignPossible = pSh->IsAlignPossible();
-
- sal_Bool bTopParam = sal_True, bBottomParam = sal_True;
- bool bNotify = false;
- bool bDone = false;
- SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
-
- switch (nSlotId)
- {
- case FN_DRAW_WRAP_DLG:
- {
- if(pSdrView->AreObjectsMarked())
- {
- if(!pArgs)
- {
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- if( rMarkList.GetMark(0) != 0 )
- {
- SfxItemSet aSet(GetPool(), RES_SURROUND, RES_SURROUND,
- RES_ANCHOR, RES_ANCHOR,
- RES_LR_SPACE, RES_UL_SPACE,
- SID_HTML_MODE, SID_HTML_MODE,
- FN_DRAW_WRAP_DLG, FN_DRAW_WRAP_DLG,
- 0);
-
- aSet.Put(SfxBoolItem(SID_HTML_MODE,
- 0 != ::GetHtmlMode(pSh->GetView().GetDocShell())));
-
- aSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, pSh->GetLayerId()));
-
- pSh->GetObjAttr(aSet);
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- SfxAbstractDialog* pDlg = pFact->CreateSwWrapDlg( GetView().GetWindow(), aSet, pSh, sal_True, RC_DLG_SWWRAPDLG );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
-
- if (pDlg->Execute() == RET_OK)
- {
- const SfxPoolItem* pWrapItem;
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- if(SFX_ITEM_SET == pOutSet->GetItemState(FN_DRAW_WRAP_DLG, false, &pWrapItem))
- {
- short nLayer = ((const SfxInt16Item*)pWrapItem)->GetValue();
- if (nLayer == 1)
- pSh->SelectionToHeaven();
- else
- pSh->SelectionToHell();
- }
-
- pSh->SetObjAttr(*pOutSet);
- }
- delete pDlg;
- }
- }
- }
- }
- break;
-
- case SID_ATTR_TRANSFORM:
- {
- if(pSdrView->AreObjectsMarked())
- {
- if(!pArgs)
- {
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- if( rMarkList.GetMark(0) != 0 )
- {
- SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- SfxAbstractTabDialog *pDlg=NULL;
- bool bCaption = false;
-
- // Allowed anchorages:
- short nAnchor = pSh->GetAnchorId();
- sal_uInt16 nAllowedAnchors = SVX_OBJ_AT_CNTNT | SVX_OBJ_IN_CNTNT | SVX_OBJ_PAGE;
- sal_uInt16 nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell());
-
- if ( pSh->IsFlyInFly() )
- nAllowedAnchors |= SVX_OBJ_AT_FLY;
-
- if (pObj->GetObjIdentifier() == OBJ_CAPTION )
- bCaption = true;
-
- if (bCaption)
- {
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if ( pFact )
- {
- AbstractSvxCaptionDialog* pCaptionDlg =
- pFact->CreateCaptionDialog( NULL, pSdrView, nAllowedAnchors );
- pCaptionDlg->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
- pDlg = pCaptionDlg;
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- }
- }
- else
- {
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if ( pFact )
- {
-
- AbstractSvxTransformTabDialog* pTransform =
- pFact->CreateSvxTransformTabDialog( NULL, NULL, pSdrView, nAllowedAnchors );
- pTransform->SetValidateFramePosLink( LINK(this, SwDrawBaseShell, ValidatePosition) );
- pDlg = pTransform;
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- }
- }
- SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
-
- const sal_uInt16* pRange = pDlg->GetInputRanges( *aNewAttr.GetPool() );
- SfxItemSet aSet( *aNewAttr.GetPool(), pRange );
- FieldUnit eMetric = ::GetDfltMetric(0 != dynamic_cast<SwWebView*>(&GetView()));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
-
- aSet.Put( aNewAttr, false );
-
- if (bCaption)
- pSdrView->GetAttributes( aSet );
-
- aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, nAnchor));
- sal_Bool bRTL;
- sal_Bool bVertL2R;
- aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT, pSh->IsFrmVertical(sal_True, bRTL, bVertL2R)));
- aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_RTL_TEXT, bRTL));
-
- SwFrmFmt* pFrmFmt = FindFrmFmt( pObj );
-
- aSet.Put( pFrmFmt->GetFmtAttr(RES_FOLLOW_TEXT_FLOW) );
-
- SwFmtVertOrient aVOrient((const SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT));
- aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, aVOrient.GetVertOrient()));
- aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, aVOrient.GetRelationOrient() ));
- aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, aVOrient.GetPos()));
-
- SwFmtHoriOrient aHOrient((const SwFmtHoriOrient&)pFrmFmt->GetFmtAttr(RES_HORI_ORIENT));
- aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, aHOrient.GetHoriOrient()));
- aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, aHOrient.GetRelationOrient() ));
- aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, aHOrient.IsPosToggle()));
- aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_HORI_POSITION, aHOrient.GetPos()));
-
- aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
-
- pDlg->SetInputSet( &aSet );
-
- if (pDlg->Execute() == RET_OK)
- {
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- pSh->StartAllAction();
-
- // #i30451#
- pSh->StartUndo(UNDO_INSFMTATTR);
-
- pSdrView->SetGeoAttrToMarked(*pOutSet);
-
- if (bCaption)
- pSdrView->SetAttributes(*pOutSet);
-
- bool bPosCorr =
- SFX_ITEM_SET != pOutSet->GetItemState(
- SID_ATTR_TRANSFORM_POS_X, false ) &&
- SFX_ITEM_SET != pOutSet->GetItemState(
- SID_ATTR_TRANSFORM_POS_Y, false );
-
- SfxItemSet aFrmAttrSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END - 1);
-
- bool bSingleSelection = rMarkList.GetMarkCount() == 1;
-
- const SfxPoolItem* pAnchorItem;
- if(SFX_ITEM_SET == pOutSet->GetItemState(
- SID_ATTR_TRANSFORM_ANCHOR, false, &pAnchorItem))
- {
- if(!bSingleSelection)
- pSh->ChgAnchor(((const SfxInt16Item*)pAnchorItem)
- ->GetValue(), false, bPosCorr );
- else
- {
- SwFmtAnchor aAnchor(pFrmFmt->GetAnchor());
- aAnchor.SetType((RndStdIds)((const SfxInt16Item*)pAnchorItem)->GetValue());
- aFrmAttrSet.Put( aAnchor );
- }
- }
- const SfxPoolItem* pHoriOrient = 0;
- const SfxPoolItem* pHoriRelation = 0;
- const SfxPoolItem* pHoriPosition = 0;
- const SfxPoolItem* pHoriMirror = 0;
- pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_ORIENT, false, &pHoriOrient);
- pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_RELATION, false, &pHoriRelation);
- pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_POSITION, false, &pHoriPosition);
- pOutSet->GetItemState(SID_ATTR_TRANSFORM_HORI_MIRROR, false, &pHoriMirror);
- if(pHoriOrient || pHoriRelation || pHoriPosition || pHoriMirror)
- {
- if(pHoriOrient)
- aHOrient.SetHoriOrient(
- static_cast<const SfxInt16Item*>(pHoriOrient)->GetValue());
- if(pHoriRelation)
- aHOrient.SetRelationOrient(
- static_cast<const SfxInt16Item*>(pHoriRelation)->GetValue());
- if(pHoriPosition)
- aHOrient.SetPos( static_cast<const SfxInt32Item*>(pHoriPosition)->GetValue());
- if(pHoriMirror)
- aHOrient.SetPosToggle( static_cast<const SfxBoolItem*>(pHoriMirror)->GetValue());
- aFrmAttrSet.Put(aHOrient);
- }
-
- const SfxPoolItem* pVertOrient = 0;
- const SfxPoolItem* pVertRelation = 0;
- const SfxPoolItem* pVertPosition = 0;
- pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_ORIENT, false, &pVertOrient);
- pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_RELATION, false, &pVertRelation);
- pOutSet->GetItemState(SID_ATTR_TRANSFORM_VERT_POSITION, false, &pVertPosition);
- if(pVertOrient || pVertRelation || pVertPosition )
- {
- if(pVertOrient)
- aVOrient.SetVertOrient(
- static_cast<const SfxInt16Item*>(pVertOrient)->GetValue());
- if(pVertRelation)
- aVOrient.SetRelationOrient(
- static_cast<const SfxInt16Item*>(pVertRelation)->GetValue());
- if(pVertPosition)
- aVOrient.SetPos( static_cast<const SfxInt32Item*>(pVertPosition)->GetValue());
- aFrmAttrSet.Put( aVOrient );
- }
- const SfxPoolItem* pFollowItem = 0;
- pOutSet->GetItemState(RES_FOLLOW_TEXT_FLOW, false, &pFollowItem);
- if(pFollowItem)
- aFrmAttrSet.Put(*pFollowItem);
-
- if(aFrmAttrSet.Count())
- pSh->SetDrawingAttr(aFrmAttrSet);
-
- rBind.InvalidateAll(sal_False);
-
- // #i30451#
- pSh->EndUndo( UNDO_INSFMTATTR );
-
- pSh->EndAllAction();
- }
- delete pDlg;
-
- }
- }
- else
- {
- pSdrView->SetGeoAttrToMarked( *pArgs );
- }
- }
- }
- break;
-
- case SID_DELETE:
- case FN_BACKSPACE:
- if (pSh->IsObjSelected() && !pSdrView->IsTextEdit())
- {
- bDone = true;
-
- if( GetView().IsDrawRotate() )
- {
- pSh->SetDragMode( SDRDRAG_MOVE );
- GetView().FlipDrawRotate();
- }
-
- pSh->SetModified();
- pSh->DelSelectedObj();
-
- if (rReq.IsAPI() ||
- GetView().GetEditWin().IsObjectSelect() )
- {
- // If basic call, then back to the text shell, because the
- // Basic otherwise has no possibility to return.
- if (GetView().GetDrawFuncPtr())
- {
- GetView().GetDrawFuncPtr()->Deactivate();
- GetView().SetDrawFuncPtr(NULL);
- }
- GetView().LeaveDrawCreate(); // Switch to selection mode
- }
-
- if (pSh->IsSelFrmMode())
- {
- pSh->LeaveSelFrmMode();
- // #105852# FME
- }
- bNotify = true;
- }
- break;
-
- case SID_GROUP:
- if (pSh->IsObjSelected() > 1 && pSh->IsGroupAllowed())
- {
- pSh->GroupSelection();
- rBind.Invalidate(SID_UNGROUP);
- }
- break;
-
- case SID_UNGROUP:
- if (pSh->IsGroupSelected())
- {
- pSh->UnGroupSelection();
- rBind.Invalidate(SID_GROUP);
- }
- break;
-
- case SID_ENTER_GROUP:
- if (pSh->IsGroupSelected())
- {
- pSdrView->EnterMarkedGroup();
- rBind.InvalidateAll(sal_False);
- }
- break;
-
- case SID_LEAVE_GROUP:
- if (pSdrView->IsGroupEntered())
- {
- pSdrView->LeaveOneGroup();
- rBind.Invalidate(SID_ENTER_GROUP);
- rBind.Invalidate(SID_UNGROUP);
- }
- break;
-
- case SID_OBJECT_ALIGN_LEFT:
- case SID_OBJECT_ALIGN_CENTER:
- case SID_OBJECT_ALIGN_RIGHT:
- case SID_OBJECT_ALIGN_UP:
- case SID_OBJECT_ALIGN_MIDDLE:
- case SID_OBJECT_ALIGN_DOWN:
- {
- if ( bAlignPossible )
- {
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- if( rMarkList.GetMarkCount() == 1 && bAlignPossible )
- { // Do not align objects to each other
- sal_uInt16 nAnchor = pSh->GetAnchorId();
- if (nAnchor == FLY_AS_CHAR)
- {
- sal_Int16 nVertOrient = -1;
-
- switch (nSlotId)
- {
- case SID_OBJECT_ALIGN_UP:
- nVertOrient = text::VertOrientation::TOP;
- break;
- case SID_OBJECT_ALIGN_MIDDLE:
- nVertOrient = text::VertOrientation::CENTER;
- break;
- case SID_OBJECT_ALIGN_DOWN:
- nVertOrient = text::VertOrientation::BOTTOM;
- break;
- default:
- break;
- }
- if (nVertOrient != -1)
- {
- pSh->StartAction();
- SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- SwFrmFmt* pFrmFmt = FindFrmFmt( pObj );
- SwFmtVertOrient aVOrient((SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT));
- aVOrient.SetVertOrient( nVertOrient );
- pFrmFmt->SetFmtAttr(aVOrient);
- pSh->EndAction();
- }
- break;
- }
- if (nAnchor == FLY_AT_PARA)
- break; // Do not align frames of an anchored paragraph
- }
-
- pSh->StartAction();
- switch (nSlotId)
- {
- case SID_OBJECT_ALIGN_LEFT:
- pSdrView->AlignMarkedObjects(SDRHALIGN_LEFT, SDRVALIGN_NONE);
- break;
- case SID_OBJECT_ALIGN_CENTER:
- pSdrView->AlignMarkedObjects(SDRHALIGN_CENTER, SDRVALIGN_NONE);
- break;
- case SID_OBJECT_ALIGN_RIGHT:
- pSdrView->AlignMarkedObjects(SDRHALIGN_RIGHT, SDRVALIGN_NONE);
- break;
- case SID_OBJECT_ALIGN_UP:
- pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_TOP);
- break;
- case SID_OBJECT_ALIGN_MIDDLE:
- pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_CENTER);
- break;
- case SID_OBJECT_ALIGN_DOWN:
- pSdrView->AlignMarkedObjects(SDRHALIGN_NONE, SDRVALIGN_BOTTOM);
- break;
- }
- pSh->EndAction();
- }
- }
- break;
-
- case FN_FRAME_UP:
- bTopParam = sal_False;
- /* no break */
- case SID_FRAME_TO_TOP:
- pSh->SelectionToTop( bTopParam );
- break;
-
- case FN_FRAME_DOWN:
- bBottomParam = sal_False;
- /* no break */
- case SID_FRAME_TO_BOTTOM:
- pSh->SelectionToBottom( bBottomParam );
- break;
-
- case FN_NAME_SHAPE:
- {
- bDone = true;
-
- if(1L == pSdrView->GetMarkedObjectCount())
- {
- // #i68101#
- SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0L);
- OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
- OUString aName(pSelected->GetName());
-
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- AbstractSvxObjectNameDialog* pDlg = pFact->CreateSvxObjectNameDialog(NULL, aName);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
-
- pDlg->SetCheckNameHdl(LINK(this, SwDrawBaseShell, CheckGroupShapeNameHdl));
-
- if(RET_OK == pDlg->Execute())
- {
- pDlg->GetName(aName);
- pSelected->SetName(aName);
- pSh->SetModified();
- }
-
- delete pDlg;
- }
-
- break;
- }
-
- // #i68101#
- case FN_TITLE_DESCRIPTION_SHAPE:
- {
- bDone = true;
-
- if(1L == pSdrView->GetMarkedObjectCount())
- {
- SdrObject* pSelected = pSdrView->GetMarkedObjectByIndex(0L);
- OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, but no object (!)");
- OUString aTitle(pSelected->GetTitle());
- OUString aDescription(pSelected->GetDescription());
-
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- AbstractSvxObjectTitleDescDialog* pDlg = pFact->CreateSvxObjectTitleDescDialog(NULL, aTitle, aDescription);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
-
- if(RET_OK == pDlg->Execute())
- {
- pDlg->GetTitle(aTitle);
- pDlg->GetDescription(aDescription);
-
- pSelected->SetTitle(aTitle);
- pSelected->SetDescription(aDescription);
-
- pSh->SetModified();
- }
-
- delete pDlg;
- }
-
- break;
- }
-
- default:
- OSL_ENSURE(!this, "wrong Dispatcher");
- return;
- }
- if(!bDone)
- {
- if(nSlotId >= SID_OBJECT_ALIGN_LEFT && nSlotId <= SID_OBJECT_ALIGN_DOWN)
- rBind.Invalidate(SID_ATTR_LONG_LRSPACE);
- if (pSdrView->GetModel()->IsChanged())
- pSh->SetModified();
- else if (bChanged)
- pSdrView->GetModel()->SetChanged(true);
- // 40220: After Delete from DrawObjecs over the API GPF through self-destruction
- if(bNotify)
- GetView().AttrChangedNotify(pSh); // Shell switch if applicable...
- }
-}
-
-// Checks whether a given name is allowed for a group shape
-
-IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxNameDialog*, pNameDialog )
-{
- SwWrtShell &rSh = GetShell();
- SdrView *pSdrView = rSh.GetDrawView();
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- OSL_ENSURE(rMarkList.GetMarkCount() == 1, "wrong draw selection");
- SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- const OUString sCurrentName = pObj->GetName();
- OUString sNewName;
- pNameDialog->GetName(sNewName);
- long nRet = 0;
- if (sNewName.isEmpty() || sCurrentName == sNewName)
- nRet = 1;
- else
- {
- nRet = 1;
- SdrModel* pModel = rSh.getIDocumentDrawModelAccess()->GetDrawModel();
- SdrObjListIter aIter( *(pModel->GetPage(0)), IM_DEEPWITHGROUPS );
- while( aIter.IsMore() )
- {
- SdrObject* pTempObj = aIter.Next();
- if ( pObj != pTempObj && pTempObj->GetName().equals(sNewName) )
- {
- nRet = 0;
- break;
- }
- }
- }
- return nRet;
-}
-
-void SwDrawBaseShell::GetState(SfxItemSet& rSet)
-{
- SwWrtShell &rSh = GetShell();
- SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
-
- if (!bProtected) // Look in the parent
- bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
-
- while( nWhich )
- {
- switch( nWhich )
- {
- case FN_DRAW_WRAP_DLG:
- case SID_ATTR_TRANSFORM:
- case SID_FRAME_TO_TOP:
- case SID_FRAME_TO_BOTTOM:
- case FN_FRAME_UP:
- case FN_FRAME_DOWN:
- case SID_DELETE:
- case FN_BACKSPACE:
- if( bProtected || !rSh.IsObjSelected() )
- rSet.DisableItem( nWhich );
- break;
- case SID_GROUP:
- if ( rSh.IsObjSelected() < 2 || bProtected || !rSh.IsGroupAllowed() )
- rSet.DisableItem( nWhich );
- break;
- case SID_UNGROUP:
- if ( !rSh.IsGroupSelected() || bProtected )
- rSet.DisableItem( nWhich );
- break;
- case SID_ENTER_GROUP:
- if ( !rSh.IsGroupSelected() )
- rSet.DisableItem( nWhich );
- break;
- case SID_LEAVE_GROUP:
- if ( !pSdrView->IsGroupEntered() )
- rSet.DisableItem( nWhich );
- break;
- case SID_OBJECT_ALIGN_LEFT:
- case SID_OBJECT_ALIGN_CENTER:
- case SID_OBJECT_ALIGN_RIGHT:
- case SID_OBJECT_ALIGN_UP:
- case SID_OBJECT_ALIGN_MIDDLE:
- case SID_OBJECT_ALIGN_DOWN:
- case SID_OBJECT_ALIGN:
- if ( !rSh.IsAlignPossible() || bProtected )
- rSet.DisableItem( nWhich );
- else
- {
- SfxAllEnumItem aEnumItem(nWhich, USHRT_MAX);
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- //if only one object is selected it can only be vertically
- // aligned because it is character bound
- if( rMarkList.GetMarkCount() == 1 )
- {
- aEnumItem.DisableValue(SID_OBJECT_ALIGN_LEFT);
- aEnumItem.DisableValue(SID_OBJECT_ALIGN_CENTER);
- aEnumItem.DisableValue(SID_OBJECT_ALIGN_RIGHT);
- }
- rSet.Put(aEnumItem);
- }
- break;
-
- case FN_NAME_SHAPE :
- {
- if(1L != pSdrView->GetMarkedObjectCount())
- {
- rSet.DisableItem( nWhich );
- }
- }
- break;
-
- // #i68101#
- case FN_TITLE_DESCRIPTION_SHAPE:
- {
- const bool bIsWebView(NULL != dynamic_cast<SwWebView*>(&GetView()));
-
- if(!bIsWebView && 1L != pSdrView->GetMarkedObjectCount())
- {
- rSet.DisableItem( nWhich );
- }
- }
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwDrawBaseShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet )
-{
- SwWrtShell *pSh = &GetShell();
- SdrView* pSdrView = pSh->GetDrawView();
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- if( rMarkList.GetMark(0) != 0 )
- {
- SfxItemSet aNewAttr(pSdrView->GetGeoAttrFromMarked());
- rSet.Put(aNewAttr,false);
- }
-}
-
-sal_Bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich)
-{
- sal_Bool bDisable = GetShell().IsSelObjProtected(FLYPROTECT_CONTENT);
-
- if (bDisable)
- {
- if (nWhich)
- rSet.DisableItem( nWhich );
- else
- {
- SfxWhichIter aIter( rSet );
- nWhich = aIter.FirstWhich();
- while (nWhich)
- {
- rSet.DisableItem( nWhich );
- nWhich = aIter.NextWhich();
- }
- }
- }
-
- return bDisable;
-}
-
-// Validate of drawing positions
-
-IMPL_LINK(SwDrawBaseShell, ValidatePosition, SvxSwFrameValidation*, pValidation )
-{
- SwWrtShell *pSh = &GetShell();
- pValidation->nMinHeight = MINFLY;
- pValidation->nMinWidth = MINFLY;
-
- SwRect aBoundRect;
-
- // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
- // aligned to page for fly frame anchored to paragraph or to character.
- const RndStdIds eAnchorType = static_cast<RndStdIds >(pValidation->nAnchorType);
- const SwPosition* pCntntPos = 0;
- SdrView* pSdrView = pSh->GetDrawView();
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- if( rMarkList.GetMarkCount() == 1 )
- {
- SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
- SwFrmFmt* pFrmFmt = FindFrmFmt( pObj );
- pCntntPos = pFrmFmt->GetAnchor().GetCntntAnchor();
- }
-
- pSh->CalcBoundRect( aBoundRect, eAnchorType,
- pValidation->nHRelOrient,
- pValidation->nVRelOrient,
- pCntntPos,
- pValidation->bFollowTextFlow,
- pValidation->bMirror, NULL, &pValidation->aPercentSize);
-
- sal_Bool bIsInVertical( sal_False );
- {
- sal_Bool bRTL;
- sal_Bool bVertL2R;
- bIsInVertical = pSh->IsFrmVertical(sal_True, bRTL, bVertL2R);
- }
- if(bIsInVertical)
- {
- Point aPos(aBoundRect.Pos());
- long nTmp = aPos.X();
- aPos.X() = aPos.Y();
- aPos.Y() = nTmp;
- Size aSize(aBoundRect.SSize());
- nTmp = aSize.Width();
- aSize.Width() = aSize.Height();
- aSize.Height() = nTmp;
- aBoundRect.Chg( aPos, aSize );
- //exchange width/height to enable correct values
- nTmp = pValidation->nWidth;
- pValidation->nWidth = pValidation->nHeight;
- pValidation->nHeight = nTmp;
- }
- if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY))
- {
- // MinimalPosition
- pValidation->nMinHPos = aBoundRect.Left();
- pValidation->nMinVPos = aBoundRect.Top();
- SwTwips nH = pValidation->nHPos;
- SwTwips nV = pValidation->nVPos;
-
- if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
- {
- if (pValidation->nHoriOrient == text::HoriOrientation::NONE)
- {
- pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right());
- nH = pValidation->nHPos;
- }
- else
- pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
- }
-
- if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
- pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
-
- if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom())
- {
- if (pValidation->nVertOrient == text::VertOrientation::NONE)
- {
- pValidation->nVPos -= ((pValidation->nVPos + pValidation->nHeight) - aBoundRect.Bottom());
- nV = pValidation->nVPos;
- }
- else
- pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos;
- }
-
- if (pValidation->nVPos + pValidation->nHeight > aBoundRect.Bottom())
- pValidation->nHeight = aBoundRect.Bottom() - pValidation->nVPos;
-
- if ( pValidation->nVertOrient != text::VertOrientation::NONE )
- nV = aBoundRect.Top();
-
- if ( pValidation->nHoriOrient != text::HoriOrientation::NONE )
- nH = aBoundRect.Left();
-
- pValidation->nMaxHPos = aBoundRect.Right() - pValidation->nWidth;
- pValidation->nMaxHeight = aBoundRect.Bottom() - nV;
-
- pValidation->nMaxVPos = aBoundRect.Bottom() - pValidation->nHeight;
- pValidation->nMaxWidth = aBoundRect.Right() - nH;
- }
- else if ((eAnchorType == FLY_AT_PARA) || (eAnchorType == FLY_AT_CHAR))
- {
- if (pValidation->nHPos + pValidation->nWidth > aBoundRect.Right())
- {
- if (pValidation->nHoriOrient == text::HoriOrientation::NONE)
- {
- pValidation->nHPos -= ((pValidation->nHPos + pValidation->nWidth) - aBoundRect.Right());
- }
- else
- pValidation->nWidth = aBoundRect.Right() - pValidation->nHPos;
- }
-
- // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow
- // and alignment at page areas.
- const bool bMaxVPosAtBottom = !pValidation->bFollowTextFlow ||
- pValidation->nVRelOrient == text::RelOrientation::PAGE_FRAME ||
- pValidation->nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA;
- {
- SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom
- ? aBoundRect.Bottom()
- : aBoundRect.Height() ) -
- pValidation->nHeight;
- if ( pValidation->nVPos > nTmpMaxVPos )
- {
- if (pValidation->nVertOrient == text::VertOrientation::NONE)
- {
- pValidation->nVPos = nTmpMaxVPos;
- }
- else
- {
- pValidation->nHeight = ( bMaxVPosAtBottom
- ? aBoundRect.Bottom()
- : aBoundRect.Height() ) - pValidation->nVPos;
- }
- }
- }
-
- pValidation->nMinHPos = aBoundRect.Left();
- pValidation->nMaxHPos = aBoundRect.Right() - pValidation->nWidth;
-
- pValidation->nMinVPos = aBoundRect.Top();
- // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position
- if ( bMaxVPosAtBottom )
- {
- pValidation->nMaxVPos = aBoundRect.Bottom() - pValidation->nHeight;
- }
- else
- {
- pValidation->nMaxVPos = aBoundRect.Height() - pValidation->nHeight;
- }
-
- // Maximum width height
- const SwTwips nH = ( pValidation->nHoriOrient != text::HoriOrientation::NONE )
- ? aBoundRect.Left()
- : pValidation->nHPos;
- const SwTwips nV = ( pValidation->nVertOrient != text::VertOrientation::NONE )
- ? aBoundRect.Top()
- : pValidation->nVPos;
- pValidation->nMaxHeight = pValidation->nMaxVPos + pValidation->nHeight - nV;
- pValidation->nMaxWidth = pValidation->nMaxHPos + pValidation->nWidth - nH;
- }
- else if (eAnchorType == FLY_AS_CHAR)
- {
- pValidation->nMinHPos = 0;
- pValidation->nMaxHPos = 0;
-
- pValidation->nMaxHeight = aBoundRect.Height();
- pValidation->nMaxWidth = aBoundRect.Width();
-
- pValidation->nMaxVPos = aBoundRect.Height();
- pValidation->nMinVPos = -aBoundRect.Height() + pValidation->nHeight;
- if (pValidation->nMaxVPos < pValidation->nMinVPos)
- {
- pValidation->nMinVPos = pValidation->nMaxVPos;
- pValidation->nMaxVPos = -aBoundRect.Height();
- }
- }
- if(bIsInVertical)
- {
- //restore width/height exchange
- long nTmp = pValidation->nWidth;
- pValidation->nWidth = pValidation->nHeight;
- pValidation->nHeight = nTmp;
- }
-
- if (pValidation->nMaxWidth < pValidation->nWidth)
- pValidation->nWidth = pValidation->nMaxWidth;
- if (pValidation->nMaxHeight < pValidation->nHeight)
- pValidation->nHeight = pValidation->nMaxHeight;
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
deleted file mode 100644
index 24abc785cf6e..000000000000
--- a/sw/source/ui/shells/drwtxtex.cxx
+++ /dev/null
@@ -1,1084 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
-
-#include <comphelper/processfactory.hxx>
-#include <comphelper/string.hxx>
-#include <i18nlangtag/mslangid.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/request.hxx>
-#include <tools/shl.hxx>
-#include <svx/svdview.hxx>
-#include <editeng/spltitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/orphitem.hxx>
-#include <editeng/formatbreakitem.hxx>
-#include <editeng/widwitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/escapementitem.hxx>
-#include <editeng/lspcitem.hxx>
-#include <editeng/adjustitem.hxx>
-#include <editeng/crossedoutitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/contouritem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/frmdiritem.hxx>
-#include <svx/svdoutl.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <svl/whiter.hxx>
-#include <svl/cjkoptions.hxx>
-#include <svl/ctloptions.hxx>
-#include <svtools/langtab.hxx>
-#include <svl/languageoptions.hxx>
-#include <vcl/msgbox.hxx>
-#include <editeng/flditem.hxx>
-#include <editeng/editstat.hxx>
-#include <svx/hlnkitem.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <svl/slstitm.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/unolingu.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <editeng/writingmodeitem.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/outliner.hxx>
-#include <vcl/window.hxx>
-#include <editeng/editview.hxx>
-#include <vcl/outdev.hxx>
-#include <editeng/hyphenzoneitem.hxx>
-#include <tools/diagnose_ex.h>
-
-#include <cmdid.h>
-#include <doc.hxx>
-#include <docstat.hxx>
-#include <drwtxtsh.hxx>
-#include <edtwin.hxx>
-#include <globals.hrc>
-#include <hintids.hxx>
-#include <initui.hxx>
-#include <langhelper.hxx>
-#include <chrdlgmodes.hxx>
-#include <pardlg.hxx>
-#include <shells.hrc>
-#include <string.h>
-#include <swdtflvr.hxx>
-#include <swmodule.hxx>
-#include <swwait.hxx>
-#include <uitool.hxx>
-#include <viewopt.hxx>
-#include <wrtsh.hxx>
-#include <wview.hxx>
-#include <wordcountdialog.hxx>
-
-#include "swabstdlg.hxx"
-#include "chrdlg.hrc"
-#include "misc.hrc"
-
-const sal_uInt32 nFontInc = 40; // 2pt
-const sal_uInt32 nFontMaxSz = 19998; // 999.9pt
-
-using namespace ::com::sun::star;
-
-void SwDrawTextShell::Execute( SfxRequest &rReq )
-{
- SwWrtShell &rSh = GetShell();
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
- SfxItemSet aEditAttr(pOLV->GetAttribs());
- SfxItemSet aNewAttr(*aEditAttr.GetPool(), aEditAttr.GetRanges());
-
- const sal_uInt16 nSlot = rReq.GetSlot();
-
- const sal_uInt16 nWhich = GetPool().GetWhich(nSlot);
- const SfxItemSet *pNewAttrs = rReq.GetArgs();
-
- bool bRestoreSelection = false;
- ESelection aOldSelection;
-
- sal_uInt16 nEEWhich = 0;
- switch (nSlot)
- {
- case SID_LANGUAGE_STATUS:
- {
- aOldSelection = pOLV->GetSelection();
- if (!pOLV->GetEditView().HasSelection())
- {
- bRestoreSelection = true;
- pOLV->GetEditView().SelectCurrentWord();
- }
-
- bRestoreSelection = SwLangHelper::SetLanguageStatus(pOLV,rReq,GetView(),rSh);
- break;
- }
-
- case SID_THES:
- {
- OUString aReplaceText;
- SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES, false );
- if (pItem2)
- aReplaceText = pItem2->GetValue();
- if (!aReplaceText.isEmpty())
- ReplaceTextWithSynonym( pOLV->GetEditView(), aReplaceText );
- break;
- }
-
- case SID_ATTR_CHAR_FONT:
- case SID_ATTR_CHAR_FONTHEIGHT:
- case SID_ATTR_CHAR_WEIGHT:
- case SID_ATTR_CHAR_POSTURE:
- {
- SfxItemPool* pPool2 = aEditAttr.GetPool()->GetSecondaryPool();
- if( !pPool2 )
- pPool2 = aEditAttr.GetPool();
- SvxScriptSetItem aSetItem( nSlot, *pPool2 );
-
- // #i78017 establish the same behaviour as in Writer
- sal_uInt16 nScriptTypes = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
- if (nSlot == SID_ATTR_CHAR_FONT)
- nScriptTypes = pOLV->GetSelectedScriptType();
-
- if (pNewAttrs)
- {
- aSetItem.PutItemForScriptType( nScriptTypes, pNewAttrs->Get( nWhich ) );
- aNewAttr.Put( aSetItem.GetItemSet() );
- }
- }
- break;
-
- case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
-
- case SID_ATTR_CHAR_UNDERLINE:
- {
- if ( pNewAttrs )
- {
- const SvxTextLineItem& rTextLineItem = static_cast< const SvxTextLineItem& >( pNewAttrs->Get( pNewAttrs->GetPool()->GetWhich(nSlot) ) );
- aNewAttr.Put( SvxUnderlineItem( rTextLineItem.GetLineStyle(), EE_CHAR_UNDERLINE ) );
- }
- else
- {
- FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle();
- aNewAttr.Put( SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE) );
- }
- }
- break;
-
- case SID_ATTR_CHAR_OVERLINE:
- {
- FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle();
- aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE));
- }
- break;
-
- case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
- case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW; break;
- case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT; break;
- case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
- case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
- case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
- case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
- case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH; break;
- case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
- case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
- case SID_ATTR_PARA_ADJUST_LEFT:
- aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_LEFT, EE_PARA_JUST));
- break;
- case SID_ATTR_PARA_ADJUST_CENTER:
- aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_CENTER, EE_PARA_JUST));
- break;
- case SID_ATTR_PARA_ADJUST_RIGHT:
- aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_RIGHT, EE_PARA_JUST));
- break;
- case SID_ATTR_PARA_ADJUST_BLOCK:
- aNewAttr.Put(SvxAdjustItem(SVX_ADJUST_BLOCK, EE_PARA_JUST));
- break;
- case SID_ATTR_PARA_LRSPACE:
- {
- SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq.
- GetArgs()->Get(nSlot));
- aParaMargin.SetWhich( EE_PARA_LRSPACE );
- aNewAttr.Put(aParaMargin);
- rReq.Done();
- }
- break;
- case SID_ATTR_PARA_LINESPACE:
- {
- SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pNewAttrs->Get(
- GetPool().GetWhich(nSlot));
- aLineSpace.SetWhich( EE_PARA_SBL );
- aNewAttr.Put( aLineSpace );
- rReq.Done();
- }
- break;
- case SID_ATTR_PARA_ULSPACE:
- {
- SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get(
- GetPool().GetWhich(nSlot));
- aULSpace.SetWhich( EE_PARA_ULSPACE );
- aNewAttr.Put( aULSpace );
- rReq.Done();
- }
- break;
-
- case SID_ATTR_PARA_LINESPACE_10:
- {
- SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL);
- aItem.SetPropLineSpace(100);
- aNewAttr.Put(aItem);
- }
- break;
- case SID_ATTR_PARA_LINESPACE_15:
- {
- SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_POINT_FIVE_LINES, EE_PARA_SBL);
- aItem.SetPropLineSpace(150);
- aNewAttr.Put(aItem);
- }
- break;
- case SID_ATTR_PARA_LINESPACE_20:
- {
- SvxLineSpacingItem aItem(SVX_LINESPACE_TWO_LINES, EE_PARA_SBL);
- aItem.SetPropLineSpace(200);
- aNewAttr.Put(aItem);
- }
- break;
-
- case FN_SET_SUPER_SCRIPT:
- {
- SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
- SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
- aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
-
- if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT )
- aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
- else
- aItem.SetEscapement( SVX_ESCAPEMENT_SUPERSCRIPT );
- aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
- }
- break;
- case FN_SET_SUB_SCRIPT:
- {
- SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT);
- SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&)
- aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue();
-
- if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT )
- aItem.SetEscapement( SVX_ESCAPEMENT_OFF );
- else
- aItem.SetEscapement( SVX_ESCAPEMENT_SUBSCRIPT );
- aNewAttr.Put( aItem, EE_CHAR_ESCAPEMENT );
- }
- break;
-
- case SID_CHAR_DLG_EFFECT:
- case SID_CHAR_DLG:
- case SID_CHAR_DLG_FOR_PARAGRAPH:
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
-
- if( !pArgs )
- {
- aOldSelection = pOLV->GetSelection();
- if (nSlot == SID_CHAR_DLG_FOR_PARAGRAPH)
- {
- // select current paragraph (and restore selection later on...)
- EditView & rEditView = pOLV->GetEditView();
- SwLangHelper::SelectPara( rEditView, rEditView.GetSelection() );
- bRestoreSelection = true;
- }
-
- SwView* pView = &GetView();
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
- SfxItemSet aDlgAttr(GetPool(), EE_ITEMS_START, EE_ITEMS_END);
-
- // util::Language does not exists in the EditEngine! That is why not in set.
-
- aDlgAttr.Put( aEditAttr );
- aDlgAttr.Put( SvxKerningItem(0, RES_CHRATR_KERNING) );
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- SfxAbstractTabDialog* pDlg = pFact->CreateSwCharDlg(pView->GetWindow(), *pView, aDlgAttr, DLG_CHAR_DRAW);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if (nSlot == SID_CHAR_DLG_EFFECT)
- {
- pDlg->SetCurPageId("fonteffect");
- }
- sal_uInt16 nRet = pDlg->Execute();
- if(RET_OK == nRet )
- {
- rReq.Done( *( pDlg->GetOutputItemSet() ) );
- aNewAttr.Put(*pDlg->GetOutputItemSet());
- }
- delete( pDlg );
- if(RET_OK != nRet)
- return ;
- }
- else
- aNewAttr.Put(*pArgs);
- }
- break;
- case FN_FORMAT_FOOTNOTE_DLG:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), rView.GetWrtShell());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- break;
- }
- case FN_NUMBERING_OUTLINE_DLG:
- {
- SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
- GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- rReq.Done();
- }
- break;
- case SID_OPEN_XML_FILTERSETTINGS:
- {
- try
- {
- uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
- xDialog->execute();
- }
- catch (const uno::Exception&)
- {
- }
- rReq.Ignore ();
- }
- break;
- case FN_WORDCOUNT_DIALOG:
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if (pVFrame != NULL)
- {
- pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
- Invalidate(rReq.GetSlot());
-
- SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
- if (pWrdCnt)
- pWrdCnt->UpdateCounts();
- }
- }
- break;
- case SID_PARA_DLG:
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
-
- if (!pArgs)
- {
- SwView* pView = &GetView();
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
- SfxItemSet aDlgAttr(GetPool(),
- EE_ITEMS_START, EE_ITEMS_END,
- SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
- SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
- SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
- SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
- 0);
-
- aDlgAttr.Put(aEditAttr);
-
- aDlgAttr.Put( SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE) );
- aDlgAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, RES_BREAK ) );
- aDlgAttr.Put( SvxFmtSplitItem( true, RES_PARATR_SPLIT ) );
- aDlgAttr.Put( SvxWidowsItem( 0, RES_PARATR_WIDOWS ) );
- aDlgAttr.Put( SvxOrphansItem( 0, RES_PARATR_ORPHANS ) );
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- SfxAbstractTabDialog* pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(), GetView(), aDlgAttr,DLG_STD, 0, sal_True );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- sal_uInt16 nRet = pDlg->Execute();
- if(RET_OK == nRet)
- {
- rReq.Done( *( pDlg->GetOutputItemSet() ) );
- aNewAttr.Put(*pDlg->GetOutputItemSet());
- }
- delete( pDlg );
- if(RET_OK != nRet)
- return;
- }
- else
- aNewAttr.Put(*pArgs);
- }
- break;
- case SID_AUTOSPELL_CHECK:
- {
-//!! JP 16.03.2001: why?? pSdrView = rSh.GetDrawView();
-//!! JP 16.03.2001: why?? pOutliner = pSdrView->GetTextEditOutliner();
- SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
- sal_uInt32 nCtrl = pOutliner->GetControlWord();
-
- sal_Bool bSet = ((const SfxBoolItem&)rReq.GetArgs()->Get(
- nSlot)).GetValue();
- if(bSet)
- nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS;
- else
- nCtrl &= ~EE_CNTRL_ONLINESPELLING;
- pOutliner->SetControlWord(nCtrl);
-
- rView.ExecuteSlot(rReq);
- }
- break;
- case SID_HYPERLINK_SETLINK:
- {
- const SfxPoolItem* pItem = 0;
- if(pNewAttrs)
- pNewAttrs->GetItemState(nSlot, false, &pItem);
-
- if(pItem)
- {
- const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
- SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT);
- aFld.SetTargetFrame(rHLinkItem.GetTargetFrame());
-
- const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
-
- if (pFieldItem && pFieldItem->GetField()->ISA(SvxURLField))
- {
- // Select field so that it will be deleted during insert
- ESelection aSel = pOLV->GetSelection();
- aSel.nEndPos++;
- pOLV->SetSelection(aSel);
- }
- pOLV->InsertField(SvxFieldItem(aFld, EE_FEATURE_FIELD));
- }
- }
- break;
-
- case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
- case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
- // Shell switch!
- {
- SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
- SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
- SdrView* pTmpView = pSdrView;
-
- pSdrView->SdrEndTextEdit(sal_True);
-
- SfxItemSet aAttr( *aNewAttr.GetPool(),
- SDRATTR_TEXTDIRECTION,
- SDRATTR_TEXTDIRECTION );
-
- aAttr.Put( SvxWritingModeItem(
- nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
- text::WritingMode_LR_TB
- : text::WritingMode_TB_RL, SDRATTR_TEXTDIRECTION ) );
- pTmpView->SetAttributes( aAttr );
-
- rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), false);
- rSh.GetView().AttrChangedNotify( &rSh );
- }
- return;
-
- case SID_ATTR_PARA_LEFT_TO_RIGHT:
- case SID_ATTR_PARA_RIGHT_TO_LEFT:
- {
- SdrObject* pTmpObj = pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
- SdrPageView* pTmpPV = pSdrView->GetSdrPageView();
- SdrView* pTmpView = pSdrView;
-
- pSdrView->SdrEndTextEdit(sal_True);
- bool bLeftToRight = nSlot == SID_ATTR_PARA_LEFT_TO_RIGHT;
-
- const SfxPoolItem* pPoolItem;
- if( pNewAttrs && SFX_ITEM_SET == pNewAttrs->GetItemState( nSlot, true, &pPoolItem ) )
- {
- if( !( (SfxBoolItem*)pPoolItem)->GetValue() )
- bLeftToRight = !bLeftToRight;
- }
- SfxItemSet aAttr( *aNewAttr.GetPool(),
- EE_PARA_JUST, EE_PARA_JUST,
- EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR,
- 0 );
-
- sal_uInt16 nAdjust = SVX_ADJUST_LEFT;
- if( SFX_ITEM_ON == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) )
- nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue();
-
- if( bLeftToRight )
- {
- aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
- if( nAdjust == SVX_ADJUST_RIGHT )
- aAttr.Put( SvxAdjustItem( SVX_ADJUST_LEFT, EE_PARA_JUST ) );
- }
- else
- {
- aAttr.Put( SvxFrameDirectionItem( FRMDIR_HORI_RIGHT_TOP, EE_PARA_WRITINGDIR ) );
- if( nAdjust == SVX_ADJUST_LEFT )
- aAttr.Put( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
- }
- pTmpView->SetAttributes( aAttr );
- rSh.GetView().BeginTextEdit( pTmpObj, pTmpPV, &rSh.GetView().GetEditWin(), false );
- rSh.GetView().AttrChangedNotify( &rSh );
- }
- return;
-
- case FN_GROW_FONT_SIZE:
- case FN_SHRINK_FONT_SIZE:
- {
- SfxItemPool* pPool2 = aEditAttr.GetPool()->GetSecondaryPool();
- if( !pPool2 )
- pPool2 = aEditAttr.GetPool();
-
- SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, *pPool2 );
- aSetItem.GetItemSet().Put( aEditAttr, false );
-
- sal_uInt16 nScriptTypes = pOLV->GetSelectedScriptType();
- const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) );
-
- if (pSize)
- {
- SvxFontHeightItem aSize(*pSize);
-
- sal_uInt32 nSize = aSize.GetHeight();
-
- if( nSlot == FN_GROW_FONT_SIZE && ( nSize += nFontInc ) > nFontMaxSz )
- nSize = nFontMaxSz;
- else if( nSlot == FN_SHRINK_FONT_SIZE && ( nSize -= nFontInc ) < nFontInc )
- nSize = nFontInc;
-
- aSize.SetHeight( nSize );
- aSetItem.PutItemForScriptType( nScriptTypes, aSize );
- aNewAttr.Put( aSetItem.GetItemSet() );
- }
- }
- break;
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
- if(nEEWhich && pNewAttrs)
- aNewAttr.Put(pNewAttrs->Get(nWhich), nEEWhich);
-
- SetAttrToMarked(aNewAttr);
-
- GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
-
- if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
- rSh.SetModified();
-
- if (bRestoreSelection)
- {
- // restore selection
- pOLV->GetEditView().SetSelection( aOldSelection );
- }
-}
-
-void SwDrawTextShell::GetState(SfxItemSet& rSet)
-{
- if (!IsTextEdit()) // Otherwise sometimes crash!
- return;
-
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- SfxItemSet aEditAttr( pOLV->GetAttribs() );
- const SfxPoolItem *pAdjust = 0, *pLSpace = 0, *pEscItem = 0;
- int eAdjust, nLSpace, nEsc;
-
- while(nWhich)
- {
- sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
- sal_Bool bFlag = sal_False;
- switch( nSlotId )
- {
- case SID_LANGUAGE_STATUS://20412:
- {
- nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);
- break;
- }
-
- case SID_THES:
- {
- OUString aStatusVal;
- LanguageType nLang = LANGUAGE_NONE;
- bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, pOLV->GetEditView() );
- rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
-
- // disable "Thesaurus" context menu entry if there is nothing to look up
- uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
- if (!bIsLookUpWord ||
- !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
- rSet.DisableItem( SID_THES );
-
- //! avoid putting the same item as SfxBoolItem at the end of this function
- nSlotId = 0;
- break;
- }
-
- case SID_ATTR_PARA_ADJUST_LEFT: eAdjust = SVX_ADJUST_LEFT; goto ASK_ADJUST;
- case SID_ATTR_PARA_ADJUST_RIGHT: eAdjust = SVX_ADJUST_RIGHT; goto ASK_ADJUST;
- case SID_ATTR_PARA_ADJUST_CENTER: eAdjust = SVX_ADJUST_CENTER; goto ASK_ADJUST;
- case SID_ATTR_PARA_ADJUST_BLOCK: eAdjust = SVX_ADJUST_BLOCK; goto ASK_ADJUST;
-ASK_ADJUST:
- {
- if( !pAdjust )
- aEditAttr.GetItemState( EE_PARA_JUST, false, &pAdjust);
-
- if( !pAdjust || IsInvalidItem( pAdjust ))
- rSet.InvalidateItem( nSlotId ), nSlotId = 0;
- else
- bFlag = eAdjust == ((SvxAdjustItem*)pAdjust)->GetAdjust();
- }
- break;
-
- case SID_ATTR_PARA_LRSPACE:
- {
- SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE);
- if( eState >= SFX_ITEM_DEFAULT )
- {
- SvxLRSpaceItem aLR = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE );
- aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
- rSet.Put(aLR);
- }
- else
- rSet.InvalidateItem(nSlotId);
- nSlotId = 0;
- }
- break;
- case SID_ATTR_PARA_LINESPACE:
- {
- SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL);
- if( eState >= SFX_ITEM_DEFAULT )
- {
- SvxLineSpacingItem aLR = (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL );
- rSet.Put(aLR);
- }
- else
- rSet.InvalidateItem(nSlotId);
- nSlotId = 0;
- }
- break;
- case SID_ATTR_PARA_ULSPACE:
- {
- SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE);
- if( eState >= SFX_ITEM_DEFAULT )
- {
- SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE );
- aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
- rSet.Put(aULSpace);
- }
- else
- rSet.InvalidateItem(nSlotId);
- nSlotId = 0;
- }
- break;
-
- case SID_ATTR_PARA_LINESPACE_10: nLSpace = 100; goto ASK_LINESPACE;
- case SID_ATTR_PARA_LINESPACE_15: nLSpace = 150; goto ASK_LINESPACE;
- case SID_ATTR_PARA_LINESPACE_20: nLSpace = 200; goto ASK_LINESPACE;
-ASK_LINESPACE:
- {
- if( !pLSpace )
- aEditAttr.GetItemState( EE_PARA_SBL, false, &pLSpace );
-
- if( !pLSpace || IsInvalidItem( pLSpace ))
- rSet.InvalidateItem( nSlotId ), nSlotId = 0;
- else if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)->
- GetPropLineSpace() )
- bFlag = sal_True;
- else
- nSlotId = 0;
- }
- break;
-
- case FN_SET_SUPER_SCRIPT: nEsc = SVX_ESCAPEMENT_SUPERSCRIPT;
- goto ASK_ESCAPE;
- case FN_SET_SUB_SCRIPT: nEsc = SVX_ESCAPEMENT_SUBSCRIPT;
- goto ASK_ESCAPE;
-ASK_ESCAPE:
- {
- if( !pEscItem )
- pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT );
-
- if( nEsc == ((const SvxEscapementItem*)
- pEscItem)->GetEnumValue() )
- bFlag = sal_True;
- else
- nSlotId = 0;
- }
- break;
-
- case SID_THESAURUS:
- {
- // disable "Thesaurus" if the language is not supported
- const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault(
- GetWhichOfScript( RES_CHRATR_LANGUAGE,
- GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) );
- LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage();
-
- uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
- if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) ))
- rSet.DisableItem( SID_THESAURUS );
- nSlotId = 0;
- }
- break;
- case SID_HANGUL_HANJA_CONVERSION:
- case SID_CHINESE_CONVERSION:
- {
- if (!SvtCJKOptions().IsAnyEnabled())
- {
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
- rSet.DisableItem(nWhich);
- }
- else
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
- }
- break;
-
- case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
- case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
- if ( !SvtLanguageOptions().IsVerticalTextEnabled() )
- {
- rSet.DisableItem( nSlotId );
- nSlotId = 0;
- }
- else
- {
- SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
- if( pOutliner )
- bFlag = pOutliner->IsVertical() ==
- (SID_TEXTDIRECTION_TOP_TO_BOTTOM == nSlotId);
- else
- {
- text::WritingMode eMode = (text::WritingMode)
- ( (const SvxWritingModeItem&) aEditAttr.Get( SDRATTR_TEXTDIRECTION ) ).GetValue();
-
- if( nSlotId == SID_TEXTDIRECTION_LEFT_TO_RIGHT )
- {
- bFlag = eMode == text::WritingMode_LR_TB;
- }
- else
- {
- bFlag = eMode != text::WritingMode_TB_RL;
- }
- }
- }
- break;
- case SID_ATTR_PARA_LEFT_TO_RIGHT:
- case SID_ATTR_PARA_RIGHT_TO_LEFT:
- {
- if ( !SvtLanguageOptions().IsCTLFontEnabled() )
- {
- rSet.DisableItem( nWhich );
- nSlotId = 0;
- }
- else
- {
- SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
- if(pOutliner && pOutliner->IsVertical())
- {
- rSet.DisableItem( nWhich );
- nSlotId = 0;
- }
- else
- {
- switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() )
- {
- case FRMDIR_HORI_LEFT_TOP:
- bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT;
- break;
-
- case FRMDIR_HORI_RIGHT_TOP:
- bFlag = nWhich != SID_ATTR_PARA_LEFT_TO_RIGHT;
- break;
- }
- }
- }
- }
- break;
- case SID_TRANSLITERATE_HALFWIDTH:
- case SID_TRANSLITERATE_FULLWIDTH:
- case SID_TRANSLITERATE_HIRAGANA:
- case SID_TRANSLITERATE_KATAGANA:
- {
- SvtCJKOptions aCJKOptions;
- if(!aCJKOptions.IsChangeCaseMapEnabled())
- {
- rSet.DisableItem(nWhich);
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
- }
- else
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
- }
- break;
- case SID_INSERT_RLM :
- case SID_INSERT_LRM :
- case SID_INSERT_ZWNBSP :
- case SID_INSERT_ZWSP:
- {
- SvtCTLOptions aCTLOptions;
- sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
- if(!bEnabled)
- rSet.DisableItem(nWhich);
- }
- break;
- default:
- nSlotId = 0; // don't know this slot
- break;
- }
-
- if( nSlotId )
- rSet.Put( SfxBoolItem( nWhich, bFlag ));
-
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet)
-{
- if (!IsTextEdit()) // Otherwise crash!
- return;
-
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
- SfxItemSet aEditAttr(pOLV->GetAttribs());
-
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
- sal_uInt16 nScriptType = pOLV->GetSelectedScriptType();
- while(nWhich)
- {
- sal_uInt16 nEEWhich = 0;
- sal_uInt16 nSlotId = GetPool().GetSlotId( nWhich );
- switch( nSlotId )
- {
- case SID_ATTR_CHAR_FONT:
- case SID_ATTR_CHAR_FONTHEIGHT:
- case SID_ATTR_CHAR_WEIGHT:
- case SID_ATTR_CHAR_POSTURE:
- {
- SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
- if( !pEditPool )
- pEditPool = aEditAttr.GetPool();
- SvxScriptSetItem aSetItem( nSlotId, *pEditPool );
- aSetItem.GetItemSet().Put( aEditAttr, false );
- const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScriptType );
- if( pI )
- rSet.Put( *pI, nWhich );
- else
- rSet.InvalidateItem( nWhich );
- }
- break;
- case SID_ATTR_CHAR_COLOR: nEEWhich = EE_CHAR_COLOR; break;
- case SID_ATTR_CHAR_UNDERLINE: nEEWhich = EE_CHAR_UNDERLINE;break;
- case SID_ATTR_CHAR_OVERLINE: nEEWhich = EE_CHAR_OVERLINE;break;
- case SID_ATTR_CHAR_CONTOUR: nEEWhich = EE_CHAR_OUTLINE; break;
- case SID_ATTR_CHAR_SHADOWED: nEEWhich = EE_CHAR_SHADOW;break;
- case SID_ATTR_CHAR_STRIKEOUT: nEEWhich = EE_CHAR_STRIKEOUT;break;
- case SID_AUTOSPELL_CHECK:
- {
- const SfxPoolItem* pState = rView.GetSlotState(nWhich);
- if (pState)
- rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue()));
- else
- rSet.DisableItem( nWhich );
- break;
- }
- case SID_ATTR_CHAR_WORDLINEMODE: nEEWhich = EE_CHAR_WLM; break;
- case SID_ATTR_CHAR_RELIEF : nEEWhich = EE_CHAR_RELIEF; break;
- case SID_ATTR_CHAR_LANGUAGE : nEEWhich = EE_CHAR_LANGUAGE;break;
- case SID_ATTR_CHAR_KERNING : nEEWhich = EE_CHAR_KERNING; break;
- case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH;break;
- case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
- case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
- case FN_GROW_FONT_SIZE:
- case FN_SHRINK_FONT_SIZE:
- {
- SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
- if( !pEditPool )
- pEditPool = aEditAttr.GetPool();
-
- SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, *pEditPool );
- aSetItem.GetItemSet().Put( aEditAttr, false );
- const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptType ) ) );
-
- if( !pSize )
- rSet.DisableItem( nSlotId );
- else
- {
- sal_uInt32 nSize = pSize->GetHeight();
- if( nSize == nFontMaxSz )
- rSet.DisableItem( FN_GROW_FONT_SIZE );
- else if( nSize == nFontInc )
- rSet.DisableItem( FN_SHRINK_FONT_SIZE );
- }
- }
- }
- if(nEEWhich)
- rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);
-
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwDrawTextShell::ExecClpbrd(SfxRequest &rReq)
-{
- if (!IsTextEdit()) // Otherwise crash!
- return;
-
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
-
- ESelection aSel(pOLV->GetSelection());
- const bool bCopy = (aSel.nStartPara != aSel.nEndPara) || (aSel.nStartPos != aSel.nEndPos);
- sal_uInt16 nId = rReq.GetSlot();
- switch( nId )
- {
- case SID_CUT:
- if (bCopy)
- pOLV->Cut();
- return;
-
- case SID_COPY:
- if (bCopy)
- pOLV->Copy();
- return;
-
- case SID_PASTE:
- pOLV->PasteSpecial();
- break;
-
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
-}
-
-void SwDrawTextShell::StateClpbrd(SfxItemSet &rSet)
-{
- if (!IsTextEdit()) // Otherwise crash!
- return;
-
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
- ESelection aSel(pOLV->GetSelection());
- const bool bCopy = (aSel.nStartPara != aSel.nEndPara) ||
- (aSel.nStartPos != aSel.nEndPos);
-
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while(nWhich)
- {
- switch(nWhich)
- {
- case SID_CUT:
- case SID_COPY:
- if( !bCopy )
- rSet.DisableItem( nWhich );
- break;
-
- case SID_PASTE:
- {
- TransferableDataHelper aDataHelper(
- TransferableDataHelper::CreateFromSystemClipboard( &GetView().GetEditWin() ) );
-
- if( !aDataHelper.GetXTransferable().is()
- || !SwTransferable::IsPaste( GetShell(), aDataHelper ) )
- {
- rSet.DisableItem( nWhich );
- }
- }
- break;
-
- case SID_PASTE_SPECIAL:
- case SID_CLIPBOARD_FORMAT_ITEMS:
- rSet.DisableItem( nWhich );
- break;
- }
-
- nWhich = aIter.NextWhich();
- }
-}
-
-// Hyperlink status
-
-void SwDrawTextShell::StateInsert(SfxItemSet &rSet)
-{
- if (!IsTextEdit()) // Otherwise crash!
- return;
-
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while(nWhich)
- {
- switch(nWhich)
- {
- case SID_HYPERLINK_GETLINK:
- {
- SvxHyperlinkItem aHLinkItem;
- aHLinkItem.SetInsertMode(HLINK_FIELD);
-
- const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
-
- if (pFieldItem)
- {
- const SvxFieldData* pField = pFieldItem->GetField();
-
- if (pField->ISA(SvxURLField))
- {
- aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation());
- aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL());
- aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame());
- }
- }
- else
- {
- OUString sSel(pOLV->GetSelected());
- sSel = sSel.copy(0, std::min<sal_Int32>(255, sSel.getLength()));
- aHLinkItem.SetName(comphelper::string::stripEnd(sSel, ' '));
- }
-
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
- ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
-
- rSet.Put(aHLinkItem);
- }
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/drwtxtsh.cxx b/sw/source/ui/shells/drwtxtsh.cxx
deleted file mode 100644
index 350c4f62c06a..000000000000
--- a/sw/source/ui/shells/drwtxtsh.cxx
+++ /dev/null
@@ -1,878 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-#include <i18nlangtag/lang.h>
-#include <svl/slstitm.hxx>
-#include <svl/cjkoptions.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/langitem.hxx>
-#include <svx/svdview.hxx>
-#include <vcl/msgbox.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/objface.hxx>
-#include <svx/svdotext.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <sfx2/bindings.hxx>
-#include <svx/fontwork.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <svl/whiter.hxx>
-#include <editeng/outliner.hxx>
-#include <editeng/editstat.hxx>
-#include <svx/svdoutl.hxx>
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
-#include <com/sun/star/i18n/TextConversionOption.hpp>
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <swtypes.hxx>
-#include <view.hxx>
-#include <wrtsh.hxx>
-#include <viewopt.hxx>
-#include <initui.hxx>
-#include <drwtxtsh.hxx>
-#include <swundo.hxx>
-#include <breakit.hxx>
-
-#include <cmdid.h>
-#include <helpid.h>
-#include <globals.hrc>
-#include <shells.hrc>
-
-#define SwDrawTextShell
-#include <sfx2/msg.hxx>
-#include <swslots.hxx>
-#include <popup.hrc>
-#include <uitool.hxx>
-#include <wview.hxx>
-#include <swmodule.hxx>
-#include <svx/dialogs.hrc>
-#include <svx/svdoashp.hxx>
-#include <svx/svxdlg.hxx>
-#include <svx/xtable.hxx>
-#include <cppuhelper/bootstrap.hxx>
-#include "swabstdlg.hxx"
-#include "misc.hrc"
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::i18n;
-
-SFX_IMPL_INTERFACE(SwDrawTextShell, SfxShell, SW_RES(STR_SHELLNAME_DRAW_TEXT))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_DRWTXT_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_DRAW_TEXT_TOOLBOX));
- SFX_CHILDWINDOW_REGISTRATION(SvxFontWorkChildWindow::GetChildWindowId());
-}
-
-TYPEINIT1(SwDrawTextShell,SfxShell)
-
-void SwDrawTextShell::Init()
-{
- SwWrtShell &rSh = GetShell();
- pSdrView = rSh.GetDrawView();
- SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
- //#97471# mouse click _and_ key input at the same time
- if( !pOutliner )
- return ;
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
- sal_uLong nCtrl = pOutliner->GetControlWord();
- nCtrl |= EE_CNTRL_AUTOCORRECT;
-
- SetUndoManager(&pOutliner->GetUndoManager());
-
- // Now let's try an AutoSpell.
-
- const SwViewOption* pVOpt = rSh.GetViewOptions();
- if(pVOpt->IsOnlineSpell())
- {
- nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS;
- }
- else
- nCtrl &= ~(EE_CNTRL_ONLINESPELLING);
-
- pOutliner->SetControlWord(nCtrl);
- pOLV->ShowCursor();
-}
-
-SwDrawTextShell::SwDrawTextShell(SwView &rV) :
- SfxShell(&rV),
- rView(rV)
-{
- SwWrtShell &rSh = GetShell();
- SetPool(rSh.GetAttrPool().GetSecondaryPool());
-
- Init();
-
- rSh.NoEdit(true);
- SetName(OUString("ObjectText"));
- SetHelpId(SW_DRWTXTSHELL);
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_DrawText));
-}
-
-SwDrawTextShell::~SwDrawTextShell()
-{
- if ( GetView().GetCurShell() == this )
- rView.ResetSubShell();
-}
-
-SwWrtShell& SwDrawTextShell::GetShell()
-{
- return rView.GetWrtShell();
-}
-
-// Disable slots with this status method
-
-void SwDrawTextShell::StateDisableItems( SfxItemSet &rSet )
-{
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while (nWhich)
- {
- rSet.DisableItem( nWhich );
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwDrawTextShell::SetAttrToMarked(const SfxItemSet& rAttr)
-{
- Rectangle aNullRect;
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
- Rectangle aOutRect = pOLV->GetOutputArea();
-
- if (aNullRect != aOutRect)
- {
- GetShell().GetDrawView()->SetAttributes(rAttr);
-// Init();
- }
-}
-
-sal_Bool SwDrawTextShell::IsTextEdit()
-{
- return pSdrView->IsTextEdit();
-}
-
-void SwDrawTextShell::ExecFontWork(SfxRequest& rReq)
-{
- SwWrtShell &rSh = GetShell();
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if ( rReq.GetArgs() )
- {
- pVFrame->SetChildWindow(SvxFontWorkChildWindow::GetChildWindowId(),
- ((const SfxBoolItem&) (rReq.GetArgs()->
- Get(SID_FONTWORK))).GetValue());
- }
- else
- pVFrame->ToggleChildWindow(SvxFontWorkChildWindow::GetChildWindowId());
-
- pVFrame->GetBindings().Invalidate(SID_FONTWORK);
-}
-
-void SwDrawTextShell::StateFontWork(SfxItemSet& rSet)
-{
- const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
- rSet.Put(SfxBoolItem(SID_FONTWORK, GetView().GetViewFrame()->HasChildWindow(nId)));
-}
-
-// Edit SfxRequests for FontWork
-
-void SwDrawTextShell::ExecFormText(SfxRequest& rReq)
-{
- SwWrtShell &rSh = GetShell();
- SdrView* pDrView = rSh.GetDrawView();
-
- const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
-
- if ( rMarkList.GetMarkCount() == 1 && rReq.GetArgs() )
- {
- const SfxItemSet& rSet = *rReq.GetArgs();
-
- if ( pDrView->IsTextEdit() )
- {
- //#111733# Sometimes SdrEndTextEdit() initiates the change in selection and
- // 'this' is not valid anymore
- SwView& rTempView = GetView();
- pDrView->SdrEndTextEdit(sal_True);
- //this removes the current shell from the dispatcher stack!!
- rTempView.AttrChangedNotify(&rSh);
- }
-
- pDrView->SetAttributes(rSet);
- }
-
-}
-
-// Return Status values back to FontWork
-
-void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet)
-{
- SwWrtShell &rSh = GetShell();
- SdrView* pDrView = rSh.GetDrawView();
- const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
- const SdrObject* pObj = NULL;
- SvxFontWorkDialog* pDlg = NULL;
-
- const sal_uInt16 nId = SvxFontWorkChildWindow::GetChildWindowId();
-
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if ( pVFrame->HasChildWindow(nId) )
- pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow());
-
- if ( rMarkList.GetMarkCount() == 1 )
- pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
-
- const SdrTextObj* pTextObj = dynamic_cast< const SdrTextObj* >(pObj);
- const bool bDeactivate(
- !pObj ||
- !pTextObj ||
- !pTextObj->HasText() ||
- dynamic_cast< const SdrObjCustomShape* >(pObj)); // #121538# no FontWork for CustomShapes
-
- if (bDeactivate)
- {
- rSet.DisableItem(XATTR_FORMTXTSTYLE);
- rSet.DisableItem(XATTR_FORMTXTADJUST);
- rSet.DisableItem(XATTR_FORMTXTDISTANCE);
- rSet.DisableItem(XATTR_FORMTXTSTART);
- rSet.DisableItem(XATTR_FORMTXTMIRROR);
- rSet.DisableItem(XATTR_FORMTXTHIDEFORM);
- rSet.DisableItem(XATTR_FORMTXTOUTLINE);
- rSet.DisableItem(XATTR_FORMTXTSHADOW);
- rSet.DisableItem(XATTR_FORMTXTSHDWCOLOR);
- rSet.DisableItem(XATTR_FORMTXTSHDWXVAL);
- rSet.DisableItem(XATTR_FORMTXTSHDWYVAL);
- }
- else
- {
- if ( pDlg )
- pDlg->SetColorList(XColorList::GetStdColorList());
-
- pDrView->GetAttributes( rSet );
- }
-}
-
-void SwDrawTextShell::ExecDrawLingu(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
- if( rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() )
- {
- switch(rReq.GetSlot())
- {
- case SID_THESAURUS:
- pOLV->StartThesaurus();
- break;
-
- case SID_HANGUL_HANJA_CONVERSION:
- pOLV->StartTextConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL,
- i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false );
- break;
-
- case SID_CHINESE_CONVERSION:
- {
- //open ChineseTranslationDialog
- Reference< XComponentContext > xContext(
- ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
- if(xContext.is())
- {
- Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
- if(xMCF.is())
- {
- Reference< ui::dialogs::XExecutableDialog > xDialog(
- xMCF->createInstanceWithContext(
- OUString("com.sun.star.linguistic2.ChineseTranslationDialog")
- , xContext), UNO_QUERY);
- Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
- if( xInit.is() )
- {
- // initialize dialog
- Reference< awt::XWindow > xDialogParentWindow(0);
- Sequence<Any> aSeq(1);
- Any* pArray = aSeq.getArray();
- PropertyValue aParam;
- aParam.Name = "ParentWindow";
- aParam.Value <<= makeAny(xDialogParentWindow);
- pArray[0] <<= makeAny(aParam);
- xInit->initialize( aSeq );
-
- //execute dialog
- sal_Int16 nDialogRet = xDialog->execute();
- if( RET_OK == nDialogRet )
- {
- //get some parameters from the dialog
- sal_Bool bToSimplified = sal_True;
- sal_Bool bUseVariants = sal_True;
- sal_Bool bCommonTerms = sal_True;
- Reference< beans::XPropertySet > xProp( xDialog, UNO_QUERY );
- if( xProp.is() )
- {
- try
- {
- xProp->getPropertyValue( "IsDirectionToSimplified" ) >>= bToSimplified;
- xProp->getPropertyValue( "IsUseCharacterVariants" ) >>= bUseVariants;
- xProp->getPropertyValue( "IsTranslateCommonTerms" ) >>= bCommonTerms;
- }
- catch (const Exception&)
- {
- }
- }
-
- //execute translation
- sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
- sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
- sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
- if( !bCommonTerms )
- nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
-
- Font aTargetFont = pOLV->GetWindow()->GetDefaultFont( DEFAULTFONT_CJK_TEXT,
- nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
-
- pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false );
- }
- }
- Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
- if( xComponent.is() )
- xComponent->dispose();
- }
- }
- }
- break;
-
- default:
- OSL_ENSURE(!this, "unexpected slot-id");
- }
- }
-}
-
-void SwDrawTextShell::ExecDraw(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- pSdrView = rSh.GetDrawView();
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
-
- switch (rReq.GetSlot())
- {
- case FN_INSERT_SOFT_HYPHEN:
- case FN_INSERT_HARDHYPHEN:
- case FN_INSERT_HARD_SPACE:
- case SID_INSERT_RLM :
- case SID_INSERT_LRM :
- case SID_INSERT_ZWNBSP :
- case SID_INSERT_ZWSP:
- {
- sal_Unicode cIns = 0;
- switch(rReq.GetSlot())
- {
- case FN_INSERT_SOFT_HYPHEN: cIns = CHAR_SOFTHYPHEN; break;
- case FN_INSERT_HARDHYPHEN: cIns = CHAR_HARDHYPHEN; break;
- case FN_INSERT_HARD_SPACE: cIns = CHAR_HARDBLANK; break;
- case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
- case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
- case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
- case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
- }
- pOLV->InsertText( OUString(cIns));
- rReq.Done();
- }
- break;
- case SID_CHARMAP:
- { // Insert special character
- InsertSymbol(rReq);
- break;
- }
- case FN_INSERT_STRING:
- {
- const SfxItemSet *pNewAttrs = rReq.GetArgs();
- sal_uInt16 nSlot = rReq.GetSlot();
- const SfxPoolItem* pItem = 0;
- if(pNewAttrs)
- {
- pNewAttrs->GetItemState(nSlot, false, &pItem );
- pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue());
- }
- break;
- }
-
- case SID_SELECTALL:
- {
- SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
- if(pOutliner)
- {
- sal_Int32 nParaCount = pOutliner->GetParagraphCount();
- if (nParaCount > 0)
- pOLV->SelectRange(0L, nParaCount );
- }
- }
- break;
-
- case FN_FORMAT_RESET: // delete hard text attributes
- {
- pOLV->RemoveAttribsKeepLanguages( true );
- pOLV->GetEditView().GetEditEngine()->RemoveFields(true);
- rReq.Done();
- }
- break;
-
- case FN_ESCAPE:
- if (pSdrView->IsTextEdit())
- {
- // Shell switch!
- rSh.EndTextEdit();
- SwView& rTempView = rSh.GetView();
- rTempView.ExitDraw();
- rSh.Edit();
- return;
- }
- break;
- case FN_DRAWTEXT_ATTR_DLG:
- {
- SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() );
- pSdrView->GetAttributes( aNewAttr );
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if ( pFact )
- {
- SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog(
- &(GetView().GetViewFrame()->GetWindow()),
- &aNewAttr, pSdrView );
- sal_uInt16 nResult = pDlg->Execute();
-
- if (nResult == RET_OK)
- {
- if (pSdrView->AreObjectsMarked())
- {
- pSdrView->SetAttributes(*pDlg->GetOutputItemSet());
- rReq.Done(*(pDlg->GetOutputItemSet()));
- }
- }
-
- delete( pDlg );
- }
- }
- break;
- case SID_TABLE_VERT_NONE:
- case SID_TABLE_VERT_CENTER:
- case SID_TABLE_VERT_BOTTOM:
- {
- sal_uInt16 nSId = rReq.GetSlot();
- if (pSdrView->AreObjectsMarked())
- {
- SdrTextVertAdjust eTVA = SDRTEXTVERTADJUST_TOP;
- if (nSId == SID_TABLE_VERT_CENTER)
- eTVA = SDRTEXTVERTADJUST_CENTER;
- else if (nSId == SID_TABLE_VERT_BOTTOM)
- eTVA = SDRTEXTVERTADJUST_BOTTOM;
-
- SfxItemSet aNewAttr( pSdrView->GetModel()->GetItemPool() );
- pSdrView->GetAttributes( aNewAttr );
- aNewAttr.Put(SdrTextVertAdjustItem(eTVA));
- pSdrView->SetAttributes(aNewAttr);
- rReq.Done();
- }
-
- }
- break;
-
- default:
- OSL_ENSURE(!this, "unexpected slot-id");
- return;
- }
-
- GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
-
- if (IsTextEdit() && pOLV->GetOutliner()->IsModified())
- rSh.SetModified();
-}
-
-// Execute undo
-
-void SwDrawTextShell::ExecUndo(SfxRequest &rReq)
-{
- if( IsTextEdit() )
- {
- bool bCallBase = true;
- const SfxItemSet* pArgs = rReq.GetArgs();
- if( pArgs )
- {
- sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
- const SfxPoolItem* pItem;
- switch( nId )
- {
- case SID_UNDO:
- case SID_REDO:
- if( SFX_ITEM_SET == pArgs->GetItemState( nId, false, &pItem ) &&
- 1 < (nCnt = ((SfxUInt16Item*)pItem)->GetValue()) )
- {
- // then we make by ourself.
- ::svl::IUndoManager* pUndoManager = GetUndoManager();
- if( pUndoManager )
- {
- if( SID_UNDO == nId )
- while( nCnt-- )
- pUndoManager->Undo();
- else
- while( nCnt-- )
- pUndoManager->Redo();
- }
- bCallBase = false;
- GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False);
- }
- break;
- }
- }
- if( bCallBase )
- {
- SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
- pSfxViewFrame->ExecuteSlot(rReq, pSfxViewFrame->GetInterface());
- }
- }
-}
-
-// State of undo
-
-void SwDrawTextShell::StateUndo(SfxItemSet &rSet)
-{
- if ( !IsTextEdit() )
- return;
-
- SfxViewFrame *pSfxViewFrame = GetView().GetViewFrame();
- SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
- while( nWhich )
- {
- switch ( nWhich )
- {
- case SID_GETUNDOSTRINGS:
- case SID_GETREDOSTRINGS:
- {
- ::svl::IUndoManager* pUndoManager = GetUndoManager();
- if( pUndoManager )
- {
- OUString (::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const;
-
- sal_uInt16 nCount;
- if( SID_GETUNDOSTRINGS == nWhich )
- {
- nCount = pUndoManager->GetUndoActionCount();
- fnGetComment = &::svl::IUndoManager::GetUndoActionComment;
- }
- else
- {
- nCount = pUndoManager->GetRedoActionCount();
- fnGetComment = &::svl::IUndoManager::GetRedoActionComment;
- }
- if( nCount )
- {
- OUString sList;
- for( sal_uInt16 n = 0; n < nCount; ++n )
- sList += (pUndoManager->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) + "\n";
-
- SfxStringListItem aItem( nWhich );
- aItem.SetString( sList );
- rSet.Put( aItem );
- }
- }
- else
- rSet.DisableItem( nWhich );
- }
- break;
-
- default:
- pSfxViewFrame->GetSlotState( nWhich,
- pSfxViewFrame->GetInterface(), &rSet );
- }
-
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwDrawTextShell::ExecTransliteration( SfxRequest & rReq )
-{
- if (!pSdrView)
- return;
-
- using namespace i18n;
-
- sal_uInt32 nMode = 0;
-
- switch( rReq.GetSlot() )
- {
- case SID_TRANSLITERATE_SENTENCE_CASE:
- nMode = TransliterationModulesExtra::SENTENCE_CASE;
- break;
- case SID_TRANSLITERATE_TITLE_CASE:
- nMode = TransliterationModulesExtra::TITLE_CASE;
- break;
- case SID_TRANSLITERATE_TOGGLE_CASE:
- nMode = TransliterationModulesExtra::TOGGLE_CASE;
- break;
- case SID_TRANSLITERATE_UPPER:
- nMode = TransliterationModules_LOWERCASE_UPPERCASE;
- break;
- case SID_TRANSLITERATE_LOWER:
- nMode = TransliterationModules_UPPERCASE_LOWERCASE;
- break;
-
- case SID_TRANSLITERATE_HALFWIDTH:
- nMode = TransliterationModules_FULLWIDTH_HALFWIDTH;
- break;
- case SID_TRANSLITERATE_FULLWIDTH:
- nMode = TransliterationModules_HALFWIDTH_FULLWIDTH;
- break;
-
- case SID_TRANSLITERATE_HIRAGANA:
- nMode = TransliterationModules_KATAKANA_HIRAGANA;
- break;
- case SID_TRANSLITERATE_KATAGANA:
- nMode = TransliterationModules_HIRAGANA_KATAKANA;
- break;
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- }
-
- if( nMode )
- {
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
-
- if (!pOLV)
- return;
-
- pOLV->TransliterateText( nMode );
- }
-}
-
-void SwDrawTextShell::ExecRotateTransliteration( SfxRequest & rReq )
-{
- if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
- {
- if (!pSdrView)
- return;
-
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
-
- if (!pOLV)
- return;
-
- pOLV->TransliterateText( m_aRotateCase.getNextMode() );
- }
-}
-
-// Insert special character (see SDraw: FUBULLET.CXX)
-
-void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
-{
- OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
- if(!pOLV)
- return;
- const SfxItemSet *pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem = 0;
- if( pArgs )
- pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), false, &pItem);
-
- OUString sSym;
- OUString sFontName;
- if ( pItem )
- {
- sSym = ((const SfxStringItem*)pItem)->GetValue();
- const SfxPoolItem* pFtItem = NULL;
- pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem);
- const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
- if ( pFontItem )
- sFontName = pFontItem->GetValue();
- }
-
- SfxItemSet aSet(pOLV->GetAttribs());
- sal_uInt16 nScript = pOLV->GetSelectedScriptType();
- SvxFontItem aSetDlgFont( RES_CHRATR_FONT );
- {
- SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
- aSetItem.GetItemSet().Put( aSet, false );
- const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
- if( pI )
- aSetDlgFont = *(SvxFontItem*)pI;
- else
- aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
- SID_ATTR_CHAR_FONT,
- GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ));
- if (sFontName.isEmpty())
- sFontName = aSetDlgFont.GetFamilyName();
- }
-
- Font aFont(sFontName, Size(1,1));
- if(sSym.isEmpty())
- {
- SfxAllItemSet aAllSet( GetPool() );
- aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
-
- SwViewOption aOpt(*rView.GetWrtShell().GetViewOptions());
- OUString sSymbolFont = aOpt.GetSymbolFont();
- if( !sSymbolFont.isEmpty() )
- aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
- else
- aAllSet.Put( SfxStringItem( SID_FONT_NAME, aSetDlgFont.GetFamilyName() ) );
-
- // If character is selected, it can be shown
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( rView.GetWindow(), aAllSet,
- rView.GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
- sal_uInt16 nResult = pDlg->Execute();
- if( nResult == RET_OK )
- {
- SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, false );
- SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, false );
- if ( pFontItem )
- {
- aFont.SetName( pFontItem->GetFamilyName() );
- aFont.SetStyleName( pFontItem->GetStyleName() );
- aFont.SetCharSet( pFontItem->GetCharSet() );
- aFont.SetPitch( pFontItem->GetPitch() );
- }
-
- if ( pCItem )
- {
- sSym = pCItem->GetValue();
- aOpt.SetSymbolFont(aFont.GetName());
- SW_MOD()->ApplyUsrPref(aOpt, &rView);
- }
- }
-
- delete( pDlg );
- }
-
- if( !sSym.isEmpty() )
- {
- // do not flicker
- pOLV->HideCursor();
- SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
- pOutliner->SetUpdateMode(false);
-
- SfxItemSet aOldSet( pOLV->GetAttribs() );
- SfxItemSet aFontSet( *aOldSet.GetPool(),
- EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
- EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CJK,
- EE_CHAR_FONTINFO_CTL, EE_CHAR_FONTINFO_CTL,
- 0 );
- aFontSet.Set( aOldSet );
-
- // Insert string
- pOLV->InsertText( sSym );
-
- // assign attributes (Set font)
- SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() );
- SvxFontItem aFontItem (aFont.GetFamily(), aFont.GetName(),
- aFont.GetStyleName(), aFont.GetPitch(),
- aFont.GetCharSet(),
- EE_CHAR_FONTINFO );
- nScript = g_pBreakIt->GetAllScriptsOfText( sSym );
- if( SCRIPTTYPE_LATIN & nScript )
- aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO );
- if( SCRIPTTYPE_ASIAN & nScript )
- aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CJK );
- if( SCRIPTTYPE_COMPLEX & nScript )
- aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CTL );
- pOLV->SetAttribs(aFontAttribSet);
-
- // Remove selection
- ESelection aSel(pOLV->GetSelection());
- aSel.nStartPara = aSel.nEndPara;
- aSel.nStartPos = aSel.nEndPos;
- pOLV->SetSelection(aSel);
-
- // Restore old font
- pOLV->SetAttribs( aFontSet );
-
- // From now on show again
- pOutliner->SetUpdateMode(true);
- pOLV->ShowCursor();
-
- rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
- if(!aFont.GetName().isEmpty())
- rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetName() ) );
- rReq.Done();
- }
-}
-
-::svl::IUndoManager* SwDrawTextShell::GetUndoManager()
-{
- SwWrtShell &rSh = GetShell();
- pSdrView = rSh.GetDrawView();
- SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
- return &pOutliner->GetUndoManager();
-}
-
-void SwDrawTextShell::GetStatePropPanelAttr(SfxItemSet &rSet)
-{
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- SwWrtShell &rSh = GetShell();
- pSdrView = rSh.GetDrawView();
-
- SfxItemSet aAttrs( pSdrView->GetModel()->GetItemPool() );
- pSdrView->GetAttributes( aAttrs );
-
- while ( nWhich )
- {
- sal_uInt16 nSlotId = SfxItemPool::IsWhich(nWhich)
- ? GetPool().GetSlotId(nWhich)
- : nWhich;
- switch ( nSlotId )
- {
- case SID_TABLE_VERT_NONE:
- case SID_TABLE_VERT_CENTER:
- case SID_TABLE_VERT_BOTTOM:
- sal_Bool bContour = sal_False;
- SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME );
- if( eConState != SFX_ITEM_DONTCARE )
- {
- bContour = ( ( const SdrTextContourFrameItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue();
- }
- if (bContour) break;
-
- SfxItemState eVState = aAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
- //SfxItemState eHState = aAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
-
- //if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState)
- if(SFX_ITEM_DONTCARE != eVState)
- {
- SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)aAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
- sal_Bool bSet = (nSlotId == SID_TABLE_VERT_NONE && eTVA == SDRTEXTVERTADJUST_TOP) ||
- (nSlotId == SID_TABLE_VERT_CENTER && eTVA == SDRTEXTVERTADJUST_CENTER) ||
- (nSlotId == SID_TABLE_VERT_BOTTOM && eTVA == SDRTEXTVERTADJUST_BOTTOM);
- rSet.Put(SfxBoolItem(nSlotId, bSet));
- }
- else
- {
- rSet.Put(SfxBoolItem(nSlotId, false));
- }
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx
deleted file mode 100644
index f9ed0949a836..000000000000
--- a/sw/source/ui/shells/frmsh.cxx
+++ /dev/null
@@ -1,1185 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-#include <svl/whiter.hxx>
-#include <svtools/imapobj.hxx>
-#include <svtools/miscopt.hxx>
-#include <svl/srchitem.hxx>
-#include <svtools/imap.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <basic/sbstar.hxx>
-#include <svl/rectitem.hxx>
-#include <svl/ptitem.hxx>
-#include <svl/stritem.hxx>
-#include <svl/intitem.hxx>
-#include <svl/eitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/lineitem.hxx>
-#include <editeng/boxitem.hxx>
-#include <editeng/protitem.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/objface.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <svx/hlnkitem.hxx>
-// #i73249#
-#include <svx/svdview.hxx>
-#include <vcl/msgbox.hxx>
-#include <tools/diagnose_ex.h>
-
-#include <doc.hxx>
-#include <fmturl.hxx>
-#include <fmtclds.hxx>
-#include <fmtcnct.hxx>
-#include <swmodule.hxx>
-#include <wrtsh.hxx>
-#include <wview.hxx>
-#include <frmatr.hxx>
-#include <uitool.hxx>
-#include <frmfmt.hxx>
-#include <frmsh.hxx>
-#include <frmmgr.hxx>
-#include <frmdlg.hxx>
-#include <swevent.hxx>
-#include <usrpref.hxx>
-#include <edtwin.hxx>
-#include <swdtflvr.hxx>
-#include <swwait.hxx>
-#include <docstat.hxx>
-#include <IDocumentStatistics.hxx>
-
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
-
-#include <helpid.h>
-#include <cmdid.h>
-#include <cfgitems.hxx>
-#include <globals.hrc>
-#include <popup.hrc>
-#include <shells.hrc>
-#include "swabstdlg.hxx"
-#include "misc.hrc"
-// #i73249#
-#include <svx/dialogs.hrc>
-#include <wordcountdialog.hxx>
-
-using ::editeng::SvxBorderLine;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-// Prototypes
-static void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine);
-static const SwFrmFmt* lcl_GetFrmFmtByName(SwWrtShell& rSh, const OUString& rName)
-{
- sal_uInt16 nCount = rSh.GetFlyCount(FLYCNTTYPE_FRM);
- for( sal_uInt16 i = 0; i < nCount; i++)
- {
- const SwFrmFmt* pFmt = rSh.GetFlyNum(i, FLYCNTTYPE_FRM);
- if(pFmt->GetName() == rName)
- return pFmt;
- }
- return 0;
-}
-
-#define SwFrameShell
-#include <sfx2/msg.hxx>
-#include "swslots.hxx"
-
-SFX_IMPL_INTERFACE(SwFrameShell, SwBaseShell, SW_RES(STR_SHELLNAME_FRAME))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_FRM_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_FRAME_TOOLBOX));
-}
-
-void SwFrameShell::Execute(SfxRequest &rReq)
-{
- //First those who do not need FrmMgr.
- SwWrtShell &rSh = GetShell();
- bool bMore = false;
- const SfxItemSet* pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem;
- sal_uInt16 nSlot = rReq.GetSlot();
-
- switch ( nSlot )
- {
- case FN_FRAME_TO_ANCHOR:
- if ( rSh.IsFrmSelected() )
- {
- rSh.GotoFlyAnchor();
- rSh.EnterStdMode();
- rSh.CallChgLnk();
- }
- break;
- case SID_FRAME_TO_TOP:
- rSh.SelectionToTop();
- break;
-
- case SID_FRAME_TO_BOTTOM:
- rSh.SelectionToBottom();
- break;
-
- case FN_FRAME_UP:
- rSh.SelectionToTop( sal_False );
- break;
-
- case FN_FRAME_DOWN:
- rSh.SelectionToBottom( sal_False );
- break;
- case FN_INSERT_FRAME:
- if (!pArgs)
- {
- // Frame already exists, open frame dialog for editing.
- SfxStringItem aDefPage(FN_FORMAT_FRAME_DLG, "columns");
- rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_FORMAT_FRAME_DLG,
- SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD,
- &aDefPage, 0L );
-
- }
- else
- {
- // Frame already exists, only the number of columns will be changed.
- sal_uInt16 nCols = 1;
- if(pArgs->GetItemState(SID_ATTR_COLUMNS, false, &pItem) == SFX_ITEM_SET)
- nCols = ((SfxUInt16Item *)pItem)->GetValue();
-
- SfxItemSet aSet(GetPool(),RES_COL,RES_COL);
- rSh.GetFlyFrmAttr( aSet );
- SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL));
- // GutterWidth will not always passed, hence get firstly
- // (see view2: Execute on this slot)
- sal_uInt16 nGutterWidth = aCol.GetGutterWidth();
- if(!nCols )
- nCols++;
- aCol.Init(nCols, nGutterWidth, aCol.GetWishWidth());
- aSet.Put(aCol);
- // Template AutoUpdate
- SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
- if(pFmt && pFmt->IsAutoUpdateFmt())
- {
- rSh.AutoUpdateFrame(pFmt, aSet);
- }
- else
- {
- rSh.StartAllAction();
- rSh.SetFlyFrmAttr( aSet );
- rSh.SetModified();
- rSh.EndAllAction();
- }
-
- }
- return;
-
- case SID_HYPERLINK_SETLINK:
- {
- if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(SID_HYPERLINK_SETLINK, false, &pItem))
- {
- const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem;
- const OUString& rURL = rHLinkItem.GetURL();
- const OUString& rTarget = rHLinkItem.GetTargetFrame();
-
- SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
- rSh.GetFlyFrmAttr( aSet );
- SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
-
- OUString sOldName(rHLinkItem.GetName().toAsciiUpperCase());
- OUString sFlyName(rSh.GetFlyName().toAsciiUpperCase());
- if (sOldName != sFlyName)
- {
- OUString sName(sOldName);
- sal_uInt16 i = 1;
- while (rSh.FindFlyByName(sName))
- {
- sName = sOldName;
- sName += "_";
- sName += OUString::number(i++);
- }
- rSh.SetFlyName(sName);
- }
- aURL.SetURL( rURL, false );
- aURL.SetTargetFrameName(rTarget);
-
- aSet.Put( aURL );
- rSh.SetFlyFrmAttr( aSet );
- }
- }
- break;
-
- case FN_FRAME_CHAIN:
- rSh.GetView().GetEditWin().SetChainMode( !rSh.GetView().GetEditWin().IsChainMode() );
- break;
-
- case FN_FRAME_UNCHAIN:
- rSh.Unchain( (SwFrmFmt&)*rSh.GetFlyFrmFmt() );
- GetView().GetViewFrame()->GetBindings().Invalidate(FN_FRAME_CHAIN);
- break;
- case FN_FORMAT_FOOTNOTE_DLG:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), GetView().GetWrtShell());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- break;
- }
- case FN_NUMBERING_OUTLINE_DLG:
- {
- SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
- GetView().GetWindow(), &aTmp, GetView().GetWrtShell());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- rReq.Done();
- break;
- }
- case SID_OPEN_XML_FILTERSETTINGS:
- {
- try
- {
- uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create(::comphelper::getProcessComponentContext());
- xDialog->execute();
- }
- catch (const uno::Exception&)
- {
- }
- rReq.Ignore ();
- }
- break;
- case FN_WORDCOUNT_DIALOG:
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if (pVFrame != NULL)
- {
- pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
- Invalidate(rReq.GetSlot());
-
- SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
- if (pWrdCnt)
- pWrdCnt->UpdateCounts();
- }
- }
- break;
- default: bMore = true;
- }
-
- if ( !bMore )
- {
- return;
- }
-
- SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
- bool bUpdateMgr = true;
- bool bCopyToFmt = false;
- switch ( nSlot )
- {
- case SID_OBJECT_ALIGN_MIDDLE:
- case FN_FRAME_ALIGN_VERT_CENTER:
- aMgr.SetVertOrientation( text::VertOrientation::CENTER );
- break;
- case SID_OBJECT_ALIGN_DOWN :
- case FN_FRAME_ALIGN_VERT_BOTTOM:
- aMgr.SetVertOrientation( text::VertOrientation::BOTTOM );
- break;
- case SID_OBJECT_ALIGN_UP :
- case FN_FRAME_ALIGN_VERT_TOP:
- aMgr.SetVertOrientation( text::VertOrientation::TOP );
- break;
-
- case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
- aMgr.SetVertOrientation( text::VertOrientation::CHAR_CENTER );
- break;
-
- case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
- aMgr.SetVertOrientation( text::VertOrientation::CHAR_BOTTOM );
- break;
-
- case FN_FRAME_ALIGN_VERT_CHAR_TOP:
- aMgr.SetVertOrientation( text::VertOrientation::CHAR_TOP );
- break;
-
- case FN_FRAME_ALIGN_VERT_ROW_CENTER:
- aMgr.SetVertOrientation( text::VertOrientation::LINE_CENTER );
- break;
-
- case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
- aMgr.SetVertOrientation( text::VertOrientation::LINE_BOTTOM );
- break;
-
- case FN_FRAME_ALIGN_VERT_ROW_TOP:
- aMgr.SetVertOrientation( text::VertOrientation::LINE_TOP );
- break;
- case SID_OBJECT_ALIGN_CENTER :
- case FN_FRAME_ALIGN_HORZ_CENTER:
- aMgr.SetHorzOrientation( text::HoriOrientation::CENTER );
- break;
- case SID_OBJECT_ALIGN_RIGHT:
- case FN_FRAME_ALIGN_HORZ_RIGHT:
- aMgr.SetHorzOrientation( text::HoriOrientation::RIGHT );
- break;
- case SID_OBJECT_ALIGN_LEFT:
- case FN_FRAME_ALIGN_HORZ_LEFT:
- aMgr.SetHorzOrientation( text::HoriOrientation::LEFT );
- break;
-
- case FN_SET_FRM_POSITION:
- {
- aMgr.SetAbsPos(((SfxPointItem &)pArgs->Get
- (FN_SET_FRM_POSITION)).GetValue());
- }
- break;
- case SID_ATTR_BRUSH:
- {
- if(pArgs)
- {
- aMgr.SetAttrSet( *pArgs );
- bCopyToFmt = true;
- }
- }
- break;
- case SID_ATTR_ULSPACE:
- case SID_ATTR_LRSPACE:
- {
- if(pArgs && SFX_ITEM_SET == pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem))
- {
- aMgr.SetAttrSet( *pArgs );
- bCopyToFmt = true;
- }
- }
- break;
-
- case SID_ATTR_TRANSFORM:
- {
- bool bApplyNewSize = false;
-
- Size aNewSize = aMgr.GetSize();
- if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_WIDTH, false, &pItem ) )
- {
- aNewSize.setWidth( static_cast< const SfxUInt32Item* >(pItem)->GetValue() );
- bApplyNewSize = true;
- }
-
- if ( SFX_ITEM_SET == pArgs->GetItemState( SID_ATTR_TRANSFORM_HEIGHT, false, &pItem ) )
- {
- aNewSize.setHeight( static_cast< const SfxUInt32Item* >(pItem)->GetValue() );
- bApplyNewSize = true;
- }
-
- if ( bApplyNewSize )
- {
- aMgr.SetSize( aNewSize );
- }
- else
- {
- bUpdateMgr = false;
- }
-
- }
- break;
-
- case FN_FORMAT_FRAME_DLG:
- case FN_DRAW_WRAP_DLG:
- {
- const int nSel = rSh.GetSelectionType();
- if (nSel & nsSelectionType::SEL_GRF)
- {
- rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_FORMAT_GRAFIC_DLG);
- bUpdateMgr = false;
- }
- else
- {
- SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
- SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
- SID_ATTR_BRUSH, SID_ATTR_BRUSH,
- SID_ATTR_LRSPACE, SID_ATTR_ULSPACE,
- FN_SURROUND, FN_HORI_ORIENT,
- FN_SET_FRM_NAME, FN_SET_FRM_NAME,
- FN_KEEP_ASPECT_RATIO, FN_KEEP_ASPECT_RATIO,
- SID_DOCFRAME, SID_DOCFRAME,
- SID_HTML_MODE, SID_HTML_MODE,
- FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
- FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT,
- FN_OLE_IS_MATH, FN_OLE_IS_MATH,
- FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT,
- 0);
-
- const SwViewOption* pVOpt = rSh.GetViewOptions();
- if(nSel & nsSelectionType::SEL_OLE)
- aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) );
- aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
- aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
- if( nSel & nsSelectionType::SEL_OLE )
- {
- // #i73249#
- aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
- }
-
- const SwRect &rPg = rSh.GetAnyCurRect(RECT_PAGE);
- SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
- aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
- aSet.Put(aFrmSize);
-
- const SwRect &rPr = rSh.GetAnyCurRect(RECT_PAGE_PRT);
- SwFmtFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
- aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
- aSet.Put(aPrtSize);
-
- aSet.Put(aMgr.GetAttrSet());
- aSet.SetParent( aMgr.GetAttrSet().GetParent() );
-
- // On % values initialize size
- SwFmtFrmSize& rSize = (SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE);
- if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff)
- rSize.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
- if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff)
- rSize.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
-
- // disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated
- aSet.Put( SfxBoolItem( FN_MATH_BASELINE_ALIGNMENT,
- rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) );
- const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() );
- aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) );
-
- OString sDefPage;
- if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, false, &pItem) == SFX_ITEM_SET)
- sDefPage = OUStringToOString(((SfxStringItem *)pItem)->GetValue(), RTL_TEXTENCODING_UTF8);
-
- aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric) ));
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog(
- nSel & nsSelectionType::SEL_GRF ? "PictureDialog" :
- nSel & nsSelectionType::SEL_OLE ? "ObjectDialog":
- "FrameDialog",
- GetView().GetViewFrame(),
- GetView().GetWindow(),
- aSet, false,
- false,
- sDefPage);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
-
- if ( nSlot == FN_DRAW_WRAP_DLG )
- {
- pDlg->SetCurPageId("wrap");
- }
-
- if ( pDlg->Execute() )
- {
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- if(pOutSet)
- {
- rReq.Done(*pOutSet);
- if(nSel & nsSelectionType::SEL_OLE &&
- SFX_ITEM_SET == pOutSet->GetItemState(FN_KEEP_ASPECT_RATIO, true, &pItem))
- {
- SwViewOption aUsrPref( *pVOpt );
- aUsrPref.SetKeepRatio(((const SfxBoolItem*)pItem)->GetValue());
- SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
- }
- if (SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_ALT_NAME, true, &pItem))
- {
- // #i73249#
- rSh.SetObjTitle(((const SfxStringItem*)pItem)->GetValue());
- }
- // Template AutoUpdate
- SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
- if(pFmt && pFmt->IsAutoUpdateFmt())
- {
- rSh.AutoUpdateFrame(pFmt, *pOutSet);
- // Anything which is not supported by the format must be set hard.
- if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, false, &pItem))
- rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue());
- SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
- RES_SURROUND, RES_SURROUND,
- RES_ANCHOR, RES_ANCHOR,
- RES_VERT_ORIENT,RES_HORI_ORIENT,
- 0);
- aShellSet.Put(*pOutSet);
- aMgr.SetAttrSet(aShellSet);
- if(SFX_ITEM_SET == pOutSet->GetItemState(FN_SET_FRM_NAME, false, &pItem))
- rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue());
- }
- else
- aMgr.SetAttrSet( *pOutSet );
-
- const SwFrmFmt* pCurrFlyFmt = rSh.GetFlyFrmFmt();
- if(SFX_ITEM_SET ==
- pOutSet->GetItemState(FN_PARAM_CHAIN_PREVIOUS,
- false, &pItem))
- {
- rSh.HideChainMarker();
-
- OUString sPrevName =
- ((const SfxStringItem*)pItem)->GetValue();
- const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
- //needs cast - no non-const method available
- SwFlyFrmFmt* pFlyFmt =
- (SwFlyFrmFmt*)rChain.GetPrev();
- if(pFlyFmt)
- {
- if (pFlyFmt->GetName() != sPrevName)
- {
- rSh.Unchain(*pFlyFmt);
- }
- else
- sPrevName = OUString();
- }
-
- if (!sPrevName.isEmpty())
- {
- //needs cast - no non-const method available
- SwFrmFmt* pPrevFmt = (SwFrmFmt*)
- lcl_GetFrmFmtByName(rSh, sPrevName);
- OSL_ENSURE(pPrevFmt, "No frame found!");
- if(pPrevFmt)
- {
- rSh.Chain(*pPrevFmt, *pCurrFlyFmt);
- }
- }
- rSh.SetChainMarker();
- }
- if(SFX_ITEM_SET ==
- pOutSet->GetItemState(FN_PARAM_CHAIN_NEXT, false,
- &pItem))
- {
- rSh.HideChainMarker();
- OUString sNextName =
- ((const SfxStringItem*)pItem)->GetValue();
- const SwFmtChain &rChain = pCurrFlyFmt->GetChain();
- //needs cast - no non-const method available
- SwFlyFrmFmt* pFlyFmt =
- (SwFlyFrmFmt*)rChain.GetNext();
- if(pFlyFmt)
- {
- if (pFlyFmt->GetName() != sNextName)
- {
- rSh.Unchain(*((SwFlyFrmFmt*) pCurrFlyFmt));
- }
- else
- sNextName = OUString();
- }
-
- if (!sNextName.isEmpty())
- {
- //needs cast - no non-const method available
- SwFrmFmt* pNextFmt = (SwFrmFmt*)
- lcl_GetFrmFmtByName(rSh, sNextName);
- OSL_ENSURE(pNextFmt, "No frame found!");
- if(pNextFmt)
- {
- rSh.Chain(*(SwFrmFmt*)
- pCurrFlyFmt, *pNextFmt);
- }
- }
- rSh.SetChainMarker();
- }
- }
- }
- else
- bUpdateMgr = false;
- delete pDlg;
- }
- }
- break;
- case FN_FRAME_MIRROR_ON_EVEN_PAGES:
- {
- SwFmtHoriOrient aHori(aMgr.GetHoriOrient());
- sal_Bool bMirror = !aHori.IsPosToggle();
- aHori.SetPosToggle(bMirror);
- SfxItemSet aSet(GetPool(), RES_HORI_ORIENT, RES_HORI_ORIENT);
- aSet.Put(aHori);
- aMgr.SetAttrSet(aSet);
- bCopyToFmt = true;
- rReq.SetReturnValue(SfxBoolItem(nSlot, bMirror));
- }
- break;
- // #i73249#
- case FN_TITLE_DESCRIPTION_SHAPE:
- {
- bUpdateMgr = false;
- SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
- if ( pSdrView &&
- pSdrView->GetMarkedObjectCount() == 1 )
- {
- OUString aDescription(rSh.GetObjDescription());
- OUString aTitle(rSh.GetObjTitle());
-
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- AbstractSvxObjectTitleDescDialog* pDlg =
- pFact->CreateSvxObjectTitleDescDialog( NULL,
- aTitle,
- aDescription );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
-
- if ( pDlg->Execute() == RET_OK )
- {
- pDlg->GetDescription(aDescription);
- pDlg->GetTitle(aTitle);
-
- rSh.SetObjDescription(aDescription);
- rSh.SetObjTitle(aTitle);
- }
-
- delete pDlg;
- }
- }
- break;
- default:
- OSL_ENSURE( !this, "wrong dispatcher" );
- return;
- }
- if ( bUpdateMgr )
- {
- SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
- if ( bCopyToFmt && pFmt && pFmt->IsAutoUpdateFmt() )
- {
- rSh.AutoUpdateFrame(pFmt, aMgr.GetAttrSet());
- }
- else
- {
- aMgr.UpdateFlyFrm();
- }
- }
-
-}
-
-void SwFrameShell::GetState(SfxItemSet& rSet)
-{
- SwWrtShell &rSh = GetShell();
- bool bHtmlMode = 0 != ::GetHtmlMode(rSh.GetView().GetDocShell());
- if (rSh.IsFrmSelected())
- {
- SfxItemSet aSet( rSh.GetAttrPool(),
- RES_LR_SPACE, RES_UL_SPACE,
- RES_PROTECT, RES_HORI_ORIENT,
- RES_OPAQUE, RES_OPAQUE,
- RES_PRINT, RES_OPAQUE,
- 0 );
- rSh.GetFlyFrmAttr( aSet );
-
- sal_Bool bProtect = rSh.IsSelObjProtected(FLYPROTECT_POS);
- sal_Bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
-
- bProtect |= bParentCntProt;
-
- const sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_True);
- SwFlyFrmAttrMgr aMgr( sal_False, &rSh, FRMMGR_TYPE_NONE );
-
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- while ( nWhich )
- {
- switch ( nWhich )
- {
- case RES_FRM_SIZE:
- {
- SwFmtFrmSize aSz(aMgr.GetFrmSize());
- rSet.Put(aSz);
- }
- break;
- case RES_VERT_ORIENT:
- case RES_HORI_ORIENT:
- case SID_ATTR_ULSPACE:
- case SID_ATTR_LRSPACE:
- case RES_LR_SPACE:
- case RES_UL_SPACE:
- case RES_PROTECT:
- case RES_OPAQUE:
- case RES_PRINT:
- case RES_SURROUND:
- {
- rSet.Put(aSet.Get(GetPool().GetWhich(nWhich), sal_True ));
- }
- break;
- case SID_OBJECT_ALIGN_LEFT :
- case SID_OBJECT_ALIGN_CENTER :
- case SID_OBJECT_ALIGN_RIGHT :
- case FN_FRAME_ALIGN_HORZ_CENTER:
- case FN_FRAME_ALIGN_HORZ_RIGHT:
- case FN_FRAME_ALIGN_HORZ_LEFT:
- if ( (eFrmType & FRMTYPE_FLY_INCNT) ||
- bProtect ||
- ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER) &&
- bHtmlMode ))
- rSet.DisableItem( nWhich );
- break;
- case FN_FRAME_ALIGN_VERT_ROW_TOP:
- case FN_FRAME_ALIGN_VERT_ROW_CENTER:
- case FN_FRAME_ALIGN_VERT_ROW_BOTTOM:
- case FN_FRAME_ALIGN_VERT_CHAR_TOP:
- case FN_FRAME_ALIGN_VERT_CHAR_CENTER:
- case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM:
- if ( !(eFrmType & FRMTYPE_FLY_INCNT) || bProtect
- || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) )
- rSet.DisableItem( nWhich );
- break;
-
- case SID_OBJECT_ALIGN_UP :
- case SID_OBJECT_ALIGN_MIDDLE :
- case SID_OBJECT_ALIGN_DOWN :
-
- case FN_FRAME_ALIGN_VERT_TOP:
- case FN_FRAME_ALIGN_VERT_CENTER:
- case FN_FRAME_ALIGN_VERT_BOTTOM:
- if ( bProtect || (bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT))
- rSet.DisableItem( nWhich );
- else
- {
- sal_uInt16 nId = 0;
- if (eFrmType & FRMTYPE_FLY_INCNT)
- {
- switch (nWhich)
- {
- case SID_OBJECT_ALIGN_UP :
- case FN_FRAME_ALIGN_VERT_TOP:
- nId = STR_TOP_BASE; break;
- case SID_OBJECT_ALIGN_MIDDLE :
- case FN_FRAME_ALIGN_VERT_CENTER:
- nId = STR_CENTER_BASE; break;
- case SID_OBJECT_ALIGN_DOWN :
- case FN_FRAME_ALIGN_VERT_BOTTOM:
- if(!bHtmlMode)
- nId = STR_BOTTOM_BASE;
- else
- rSet.DisableItem( nWhich );
- break;
- }
- }
- else
- {
- if (nWhich != FN_FRAME_ALIGN_VERT_TOP &&
- nWhich != SID_OBJECT_ALIGN_UP )
- {
- if (aMgr.GetAnchor() == FLY_AT_FLY)
- {
- const SwFrmFmt* pFmt = rSh.IsFlyInFly();
- if (pFmt)
- {
- const SwFmtFrmSize& rFrmSz = pFmt->GetFrmSize();
- if (rFrmSz.GetHeightSizeType() != ATT_FIX_SIZE)
- {
- rSet.DisableItem( nWhich );
- break;
- }
- }
- }
- }
- switch (nWhich)
- {
- case SID_OBJECT_ALIGN_UP :
- case FN_FRAME_ALIGN_VERT_TOP:
- nId = STR_TOP; break;
- case SID_OBJECT_ALIGN_MIDDLE:
- case FN_FRAME_ALIGN_VERT_CENTER:
- nId = STR_CENTER_VERT; break;
- case SID_OBJECT_ALIGN_DOWN:
- case FN_FRAME_ALIGN_VERT_BOTTOM:
- nId = STR_BOTTOM; break;
- }
- }
- if ( nId )
- rSet.Put( SfxStringItem( nWhich, SW_RES(nId) ));
- }
- break;
- case SID_HYPERLINK_GETLINK:
- {
- SvxHyperlinkItem aHLinkItem;
- const SfxPoolItem* pItem;
-
- SfxItemSet aURLSet(GetPool(), RES_URL, RES_URL);
- rSh.GetFlyFrmAttr( aURLSet );
-
- if(SFX_ITEM_SET == aURLSet.GetItemState(RES_URL, true, &pItem))
- {
- const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem;
- aHLinkItem.SetURL(pFmtURL->GetURL());
- aHLinkItem.SetTargetFrame(pFmtURL->GetTargetFrameName());
- aHLinkItem.SetName(rSh.GetFlyName());
- }
-
- aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
- (bHtmlMode ? HLINK_HTMLMODE : 0)));
-
- rSet.Put(aHLinkItem);
- }
- break;
-
- case FN_FRAME_CHAIN:
- {
- const int nSel = rSh.GetSelectionType();
- if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE)
- rSet.DisableItem( FN_FRAME_CHAIN );
- else
- {
- const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt();
- if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
- !pFmt || pFmt->GetChain().GetNext() )
- {
- rSet.DisableItem( FN_FRAME_CHAIN );
- }
- else
- {
- sal_Bool bChainMode = rSh.GetView().GetEditWin().IsChainMode();
- rSet.Put( SfxBoolItem( FN_FRAME_CHAIN, bChainMode ) );
- }
- }
- }
- break;
- case FN_FRAME_UNCHAIN:
- {
- const int nSel = rSh.GetSelectionType();
- if (nSel & nsSelectionType::SEL_GRF || nSel & nsSelectionType::SEL_OLE)
- rSet.DisableItem( FN_FRAME_UNCHAIN );
- else
- {
- const SwFrmFmt *pFmt = rSh.GetFlyFrmFmt();
- if ( bParentCntProt || rSh.GetView().GetEditWin().GetApplyTemplate() ||
- !pFmt || !pFmt->GetChain().GetNext() )
- {
- rSet.DisableItem( FN_FRAME_UNCHAIN );
- }
- }
- }
- break;
- case SID_FRAME_TO_TOP:
- case SID_FRAME_TO_BOTTOM:
- case FN_FRAME_UP:
- case FN_FRAME_DOWN:
- if ( bParentCntProt )
- rSet.DisableItem( nWhich );
- break;
-
- case SID_ATTR_TRANSFORM:
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case SID_ATTR_TRANSFORM_PROTECT_SIZE:
- {
- const sal_uInt8 eProtection = rSh.IsSelObjProtected( FLYPROTECT_SIZE );
- if ( ( eProtection & FLYPROTECT_CONTENT ) ||
- ( eProtection & FLYPROTECT_SIZE ) )
- {
- rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, true ) );
- }
- else
- {
- rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, false ) );
- }
- }
- break;
-
- case SID_ATTR_TRANSFORM_WIDTH:
- {
- rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_WIDTH, aMgr.GetSize().getWidth() ) );
- }
- break;
-
- case SID_ATTR_TRANSFORM_HEIGHT:
- {
- rSet.Put( SfxUInt32Item( SID_ATTR_TRANSFORM_HEIGHT, aMgr.GetSize().getHeight() ) );
- }
- break;
-
- case FN_FORMAT_FRAME_DLG:
- {
- const int nSel = rSh.GetSelectionType();
- if ( bParentCntProt || nSel & nsSelectionType::SEL_GRF)
- rSet.DisableItem( nWhich );
- }
- break;
- // #i73249#
- case FN_TITLE_DESCRIPTION_SHAPE:
- {
- SwWrtShell &rWrtSh = GetShell();
- SdrView* pSdrView = rWrtSh.GetDrawViewWithValidMarkList();
- if ( !pSdrView ||
- pSdrView->GetMarkedObjectCount() != 1 )
- {
- rSet.DisableItem( nWhich );
- }
-
- }
- break;
-
- default:
- /* do nothing */;
- break;
- }
- nWhich = aIter.NextWhich();
- }
- }
-}
-
-SwFrameShell::SwFrameShell(SwView &_rView) :
- SwBaseShell( _rView )
-{
- SetName(OUString("Frame"));
- SetHelpId(SW_FRAMESHELL);
-
- // #96392# Use this to announce it is the frame shell who creates the selection.
- SwTransferable::CreateSelection( _rView.GetWrtShell(), (SwViewShell *) this );
-
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Frame));
-}
-
-SwFrameShell::~SwFrameShell()
-{
- // #96392# Only clear the selection if it was this frame shell who created it.
- SwTransferable::ClearSelection( GetShell(), (SwViewShell *) this );
-}
-
-void SwFrameShell::ExecFrameStyle(SfxRequest& rReq)
-{
- SwWrtShell &rSh = GetShell();
- bool bDefault = false;
- if (!rSh.IsFrmSelected())
- return;
- // At first pick the default BoxItem out of the pool.
- // If unequal to regular box item, then it has already
- // been changed (New one is no default).
- const SvxBoxItem* pPoolBoxItem = (const SvxBoxItem*)::GetDfltAttr(RES_BOX);
-
- const SfxItemSet *pArgs = rReq.GetArgs();
- SfxItemSet aFrameSet(rSh.GetAttrPool(), RES_BOX, RES_BOX);
-
- rSh.GetFlyFrmAttr( aFrameSet );
- const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aFrameSet.Get(RES_BOX);
-
- if (pPoolBoxItem == &rBoxItem)
- bDefault = true;
-
- SvxBoxItem aBoxItem(rBoxItem);
-
- SvxBorderLine aBorderLine;
- const SfxPoolItem *pItem = 0;
-
- if(pArgs) // Any controller can sometimes deliver nothing #48169#
- {
- switch (rReq.GetSlot())
- {
- case SID_ATTR_BORDER:
- {
- if (pArgs->GetItemState(RES_BOX, true, &pItem) == SFX_ITEM_SET)
- {
- SvxBoxItem aNewBox(*((SvxBoxItem *)pItem));
- const SvxBorderLine* pBorderLine;
-
- if ((pBorderLine = aBoxItem.GetTop()) != NULL)
- lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = aBoxItem.GetBottom()) != NULL)
- lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = aBoxItem.GetLeft()) != NULL)
- lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = aBoxItem.GetRight()) != NULL)
- lcl_FrmGetMaxLineWidth(pBorderLine, aBorderLine);
-
- if(aBorderLine.GetOutWidth() == 0)
- {
- aBorderLine.SetBorderLineStyle(
- table::BorderLineStyle::SOLID);
- aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
- }
- //Set distance only if the request is received from the controller.
-
-#ifndef DISABLE_SCRIPTING
- if(!StarBASIC::IsRunning())
-#endif
- {
- aNewBox.SetDistance( rBoxItem.GetDistance() );
- }
-
- aBoxItem = aNewBox;
- SvxBorderLine aDestBorderLine;
-
- if( aBoxItem.GetTop() != NULL )
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
- if( aBoxItem.GetBottom() != NULL )
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
- if( aBoxItem.GetLeft() != NULL )
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
- if( aBoxItem.GetRight() != NULL )
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
- }
- }
- break;
-
- case SID_FRAME_LINESTYLE:
- {
- if (pArgs->GetItemState(SID_FRAME_LINESTYLE, false, &pItem) == SFX_ITEM_SET)
- {
- const SvxLineItem* pLineItem =
- (const SvxLineItem*)pItem;
-
- if ( pLineItem->GetLine() )
- {
- aBorderLine = *(pLineItem->GetLine());
-
- if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
- !aBoxItem.GetLeft() && !aBoxItem.GetRight())
- {
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
- }
- else
- {
- if( aBoxItem.GetTop() )
- {
- aBorderLine.SetColor( aBoxItem.GetTop()->GetColor() );
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
- }
- if( aBoxItem.GetBottom() )
- {
- aBorderLine.SetColor( aBoxItem.GetBottom()->GetColor());
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
- }
- if( aBoxItem.GetLeft() )
- {
- aBorderLine.SetColor( aBoxItem.GetLeft()->GetColor());
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
- }
- if( aBoxItem.GetRight() )
- {
- aBorderLine.SetColor(aBoxItem.GetRight()->GetColor());
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
- }
- }
- }
- else
- {
- aBoxItem.SetLine(0, BOX_LINE_TOP);
- aBoxItem.SetLine(0, BOX_LINE_BOTTOM);
- aBoxItem.SetLine(0, BOX_LINE_LEFT);
- aBoxItem.SetLine(0, BOX_LINE_RIGHT);
- }
- }
- }
- break;
-
- case SID_FRAME_LINECOLOR:
- {
- if (pArgs->GetItemState(SID_FRAME_LINECOLOR, false, &pItem) == SFX_ITEM_SET)
- {
- const Color& rNewColor = ((const SvxColorItem*)pItem)->GetValue();
-
- if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() &&
- !aBoxItem.GetLeft() && !aBoxItem.GetRight())
- {
- aBorderLine.SetColor( rNewColor );
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_TOP);
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_BOTTOM);
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_LEFT);
- aBoxItem.SetLine(&aBorderLine, BOX_LINE_RIGHT);
- }
- else
- {
- if ( aBoxItem.GetTop() )
- ((SvxBorderLine*)aBoxItem.GetTop())->SetColor( rNewColor );
- if ( aBoxItem.GetBottom() )
- ((SvxBorderLine*)aBoxItem.GetBottom())->SetColor( rNewColor );
- if ( aBoxItem.GetLeft() )
- ((SvxBorderLine*)aBoxItem.GetLeft())->SetColor( rNewColor );
- if ( aBoxItem.GetRight() )
- ((SvxBorderLine*)aBoxItem.GetRight())->SetColor( rNewColor );
- }
- }
- }
- break;
- }
- }
- if (bDefault && (aBoxItem.GetTop() || aBoxItem.GetBottom() ||
- aBoxItem.GetLeft() || aBoxItem.GetRight()))
- {
- aBoxItem.SetDistance(MIN_BORDER_DIST);
- }
- aFrameSet.Put( aBoxItem );
- // Template AutoUpdate
- SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
- if(pFmt && pFmt->IsAutoUpdateFmt())
- {
- rSh.AutoUpdateFrame(pFmt, aFrameSet);
- }
- else
- rSh.SetFlyFrmAttr( aFrameSet );
-
-}
-
-static void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
-{
- if(pBorderLine->GetWidth() > rBorderLine.GetWidth())
- rBorderLine.SetWidth(pBorderLine->GetWidth());
-
- rBorderLine.SetBorderLineStyle(pBorderLine->GetBorderLineStyle());
- rBorderLine.SetColor(pBorderLine->GetColor());
-}
-
-void SwFrameShell::GetLineStyleState(SfxItemSet &rSet)
-{
- SwWrtShell &rSh = GetShell();
- bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
-
- if (bParentCntProt)
- {
- if (rSh.IsFrmSelected())
- rSet.DisableItem( SID_FRAME_LINECOLOR );
-
- rSet.DisableItem( SID_ATTR_BORDER );
- rSet.DisableItem( SID_FRAME_LINESTYLE );
- }
- else
- {
- if (rSh.IsFrmSelected())
- {
- SfxItemSet aFrameSet( rSh.GetAttrPool(), RES_BOX, RES_BOX );
-
- rSh.GetFlyFrmAttr(aFrameSet);
-
- const SvxBorderLine* pLine = ((const SvxBoxItem&)aFrameSet.Get(RES_BOX)).GetTop();
- rSet.Put(SvxColorItem(pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR));
- }
- }
-}
-
-void SwFrameShell::StateInsert(SfxItemSet &rSet)
-{
- const int nSel = GetShell().GetSelectionType();
- if ( (nSel & nsSelectionType::SEL_GRF)
- || (nSel & nsSelectionType::SEL_OLE) )
- {
- rSet.DisableItem(FN_INSERT_FRAME);
- }
- else if ( GetShell().CrsrInsideInputFld() )
- {
- rSet.DisableItem(FN_INSERT_FRAME);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
deleted file mode 100644
index b8c9b422396a..000000000000
--- a/sw/source/ui/shells/grfsh.cxx
+++ /dev/null
@@ -1,892 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cmdid.h>
-#include <hintids.hxx>
-#include <tools/urlobj.hxx>
-#include <vcl/msgbox.hxx>
-#include <svl/stritem.hxx>
-#include <svl/whiter.hxx>
-#include <svl/urihelper.hxx>
-#include <sfx2/docfile.hxx>
-#include <sfx2/dispatch.hxx>
-
-#include <sfx2/objface.hxx>
-#include <editeng/sizeitem.hxx>
-#include <editeng/protitem.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <svl/srchitem.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <svx/sdgluitm.hxx>
-#include <svx/sdgcoitm.hxx>
-#include <svx/sdggaitm.hxx>
-#include <svx/sdgtritm.hxx>
-#include <svx/sdginitm.hxx>
-#include <svx/sdgmoitm.hxx>
-#include <editeng/brushitem.hxx>
-#include <svx/grfflt.hxx>
-#include <svx/compressgraphicdialog.hxx>
-#include <vcl/GraphicNativeTransform.hxx>
-#include <svx/tbxcolor.hxx>
-#include <fmturl.hxx>
-#include <view.hxx>
-#include <wrtsh.hxx>
-#include <viewopt.hxx>
-#include <swmodule.hxx>
-#include <frmatr.hxx>
-#include <swundo.hxx>
-#include <uitool.hxx>
-#include <docsh.hxx>
-#include <grfsh.hxx>
-#include <frmmgr.hxx>
-#include <frmdlg.hxx>
-#include <frmfmt.hxx>
-#include <grfatr.hxx>
-#include <usrpref.hxx>
-#include <edtwin.hxx>
-#include <swwait.hxx>
-#include <shells.hrc>
-#include <popup.hrc>
-#include <svx/extedit.hxx>
-#include <svx/graphichelper.hxx>
-#include <doc.hxx>
-
-#define SwGrfShell
-
-#include <sfx2/msg.hxx>
-#include "swslots.hxx"
-
-#include "swabstdlg.hxx"
-
-#define TOOLBOX_NAME "colorbar"
-
-namespace
-{
- class SwExternalToolEdit : public ExternalToolEdit
- {
- SwWrtShell* m_pShell;
-
- public:
- SwExternalToolEdit ( SwWrtShell* pShell ) :
- m_pShell (pShell)
- {}
-
- virtual void Update( Graphic& aGraphic )
- {
- m_pShell->ReRead(OUString(), OUString(), (const Graphic*) &aGraphic);
- }
- };
-}
-
-SFX_IMPL_INTERFACE(SwGrfShell, SwBaseShell, SW_RES(STR_SHELLNAME_GRAPHIC))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_GRF_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_GRAFIK_TOOLBOX));
-}
-
-void SwGrfShell::Execute(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
-
- sal_uInt16 nSlot = rReq.GetSlot();
- switch(nSlot)
- {
- case SID_TWAIN_TRANSFER:
- {
- GetView().ExecuteScan( rReq );
- break;
- }
-
- case SID_SAVE_GRAPHIC:
- {
- const Graphic *pGraphic;
- if(0 != (pGraphic = rSh.GetGraphic()))
- {
- OUString sGrfNm;
- OUString sFilterNm;
- rSh.GetGrfNms( &sGrfNm, &sFilterNm );
- GraphicHelper::ExportGraphic( *pGraphic, sGrfNm );
- }
- }
- break;
-
- case SID_COMPRESS_GRAPHIC:
- {
- const Graphic* pGraphic = rSh.GetGraphic();
- if( pGraphic )
- {
- Size aSize (
- TWIP_TO_MM100(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width()),
- TWIP_TO_MM100(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height()));
-
- SfxItemSet aSet( rSh.GetAttrPool(), RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF );
- rSh.GetCurAttr( aSet );
- SwCropGrf aCrop( (const SwCropGrf&) aSet.Get(RES_GRFATR_CROPGRF) );
-
- Rectangle aCropRectangle(
- TWIP_TO_MM100(aCrop.GetLeft()),
- TWIP_TO_MM100(aCrop.GetTop()),
- TWIP_TO_MM100(aCrop.GetRight()),
- TWIP_TO_MM100(aCrop.GetBottom()) );
-
- Graphic aGraphic = Graphic( *pGraphic );
-
- CompressGraphicsDialog aDialog( GetView().GetWindow(), aGraphic, aSize, aCropRectangle, GetView().GetViewFrame()->GetBindings() );
- if( aDialog.Execute() == RET_OK )
- {
- rSh.StartAllAction();
- rSh.StartUndo(UNDO_START);
- Rectangle aScaledCropedRectangle = aDialog.GetScaledCropRectangle();
-
- aCrop.SetLeft( MM100_TO_TWIP( aScaledCropedRectangle.Left() ));
- aCrop.SetTop( MM100_TO_TWIP( aScaledCropedRectangle.Top() ));
- aCrop.SetRight( MM100_TO_TWIP( aScaledCropedRectangle.Right() ));
- aCrop.SetBottom( MM100_TO_TWIP( aScaledCropedRectangle.Bottom() ));
-
- Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() );
- rSh.ReRead(OUString(), OUString(), (const Graphic*) &aCompressedGraphic);
-
- rSh.SetAttrItem(aCrop);
-
- rSh.EndUndo(UNDO_END);
- rSh.EndAllAction();
- }
- }
- }
- break;
-
- case SID_EXTERNAL_EDIT:
- {
- // When the graphic is selected to be opened via some external tool
- // for advanced editing
- GraphicObject *pGraphicObject = (GraphicObject *) rSh.GetGraphicObj();
- if(0 != pGraphicObject)
- {
- SwExternalToolEdit* externalToolEdit = new SwExternalToolEdit( &rSh );
- externalToolEdit->Edit ( pGraphicObject );
- }
- }
- break;
-
- case SID_INSERT_GRAPHIC:
- {
- // #i123922# implement slot independent from the two below to
- // bring up the insert graphic dialog and associated actions
- SwView& rLclView = GetView();
- rReq.SetReturnValue(SfxBoolItem(nSlot, rLclView.InsertGraphicDlg( rReq )));
- break;
- }
- case FN_FORMAT_GRAFIC_DLG:
- case FN_DRAW_WRAP_DLG:
- {
- SwFlyFrmAttrMgr aMgr( sal_False, &rSh, rSh.IsFrmSelected() ?
- FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
- const SwViewOption* pVOpt = rSh.GetViewOptions();
- SwViewOption aUsrPref( *pVOpt );
-
- SfxItemSet aSet(GetPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1,
- RES_GRFATR_MIRRORGRF, RES_GRFATR_CROPGRF,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- SID_ATTR_GRAF_KEEP_ZOOM, SID_ATTR_GRAF_KEEP_ZOOM,
- SID_ATTR_GRAF_FRMSIZE, SID_ATTR_GRAF_FRMSIZE,
- SID_ATTR_GRAF_FRMSIZE_PERCENT, SID_ATTR_GRAF_FRMSIZE_PERCENT,
- SID_ATTR_GRAF_GRAPHIC, SID_ATTR_GRAF_GRAPHIC,
- FN_PARAM_GRF_CONNECT, FN_PARAM_GRF_CONNECT,
- SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
- FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
- FN_SET_FRM_NAME, FN_KEEP_ASPECT_RATIO,
- FN_PARAM_GRF_DIALOG, FN_PARAM_GRF_DIALOG,
- SID_DOCFRAME, SID_DOCFRAME,
- SID_HTML_MODE, SID_HTML_MODE,
- FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
- SID_REFERER, SID_REFERER,
- 0);
-
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- aSet.Put(SfxUInt16Item(SID_HTML_MODE, nHtmlMode));
- FieldUnit eMetric = ::GetDfltMetric((0 != (nHtmlMode&HTMLMODE_ON)));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)) );
-
- const SwRect* pRect = &rSh.GetAnyCurRect(RECT_PAGE);
- SwFmtFrmSize aFrmSize( ATT_VAR_SIZE, pRect->Width(), pRect->Height());
- aFrmSize.SetWhich( GetPool().GetWhich( SID_ATTR_PAGE_SIZE ) );
- aSet.Put( aFrmSize );
-
- aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName()));
- if ( nSlot == FN_FORMAT_GRAFIC_DLG )
- {
- // #i73249#
- aSet.Put( SfxStringItem( FN_SET_FRM_ALT_NAME, rSh.GetObjTitle() ) );
- }
-
- pRect = &rSh.GetAnyCurRect(RECT_PAGE_PRT);
- aFrmSize.SetWidth( pRect->Width() );
- aFrmSize.SetHeight( pRect->Height() );
- aFrmSize.SetWhich( GetPool().GetWhich(FN_GET_PRINT_AREA) );
- aSet.Put( aFrmSize );
-
- aSet.Put( aMgr.GetAttrSet() );
- aSet.SetParent( aMgr.GetAttrSet().GetParent() );
-
- // At percentage values initialize size
- SwFmtFrmSize aSizeCopy = (const SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE);
- if (aSizeCopy.GetWidthPercent() && aSizeCopy.GetWidthPercent() != 0xff)
- aSizeCopy.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width());
- if (aSizeCopy.GetHeightPercent() && aSizeCopy.GetHeightPercent() != 0xff)
- aSizeCopy.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height());
- // and now set the size for "external" tabpages
- {
- SvxSizeItem aSzItm( SID_ATTR_GRAF_FRMSIZE, aSizeCopy.GetSize() );
- aSet.Put( aSzItm );
-
- Size aSz( aSizeCopy.GetWidthPercent(), aSizeCopy.GetHeightPercent() );
- if( 0xff == aSz.Width() ) aSz.Width() = 0;
- if( 0xff == aSz.Height() ) aSz.Height() = 0;
-
- aSzItm.SetSize( aSz );
- aSzItm.SetWhich( SID_ATTR_GRAF_FRMSIZE_PERCENT );
- aSet.Put( aSzItm );
- }
-
- OUString sGrfNm;
- OUString sFilterNm;
- rSh.GetGrfNms( &sGrfNm, &sFilterNm );
- if( !sGrfNm.isEmpty() )
- {
- aSet.Put( SvxBrushItem( INetURLObject::decode( sGrfNm,
- INET_HEX_ESCAPE,
- INetURLObject::DECODE_UNAMBIGUOUS,
- RTL_TEXTENCODING_UTF8 ),
- sFilterNm, GPOS_LT,
- SID_ATTR_GRAF_GRAPHIC ));
- }
- else
- {
- // #119353# - robust
- const GraphicObject* pGrfObj = rSh.GetGraphicObj();
- if ( pGrfObj )
- {
- aSet.Put( SvxBrushItem( *pGrfObj, GPOS_LT,
- SID_ATTR_GRAF_GRAPHIC ) );
- }
- }
- aSet.Put( SfxBoolItem( FN_PARAM_GRF_CONNECT, !sGrfNm.isEmpty() ) );
-
- // get Mirror and Crop
- {
- SfxItemSet aTmpSet( rSh.GetAttrPool(),
- RES_GRFATR_MIRRORGRF, RES_GRFATR_CROPGRF );
-
- rSh.GetCurAttr( aTmpSet );
- aSet.Put( aTmpSet );
- }
-
- aSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aUsrPref.IsKeepRatio()));
- aSet.Put(SfxBoolItem( SID_ATTR_GRAF_KEEP_ZOOM, aUsrPref.IsGrfKeepZoom()));
-
- aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame()));
-
- SfxObjectShell * sh = rSh.GetDoc()->GetPersist();
- if (sh != 0 && sh->HasName())
- {
- aSet.Put(
- SfxStringItem(SID_REFERER, sh->GetMedium()->GetName()));
- }
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "no dialog factory!");
- SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog("PictureDialog",
- GetView().GetViewFrame(),
- GetView().GetWindow(),
- aSet, false);
- OSL_ENSURE(pDlg, "no tab dialog!");
-
- if (nSlot == FN_DRAW_WRAP_DLG)
- pDlg->SetCurPageId("wrap");
-
- if( pDlg->Execute() )
- {
- rSh.StartAllAction();
- rSh.StartUndo(UNDO_START);
- const SfxPoolItem* pItem;
- SfxItemSet* pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
- rReq.Done(*pSet);
- // change the 2 frmsize SizeItems to the correct SwFrmSizeItem
- if( SFX_ITEM_SET == pSet->GetItemState(
- SID_ATTR_GRAF_FRMSIZE, false, &pItem ))
- {
- SwFmtFrmSize aSize;
- const Size& rSz = ((SvxSizeItem*)pItem)->GetSize();
- aSize.SetWidth( rSz.Width() );
- aSize.SetHeight( rSz.Height() );
-
- if( SFX_ITEM_SET == pSet->GetItemState(
- SID_ATTR_GRAF_FRMSIZE_PERCENT, false, &pItem ))
- {
- const Size& rRelativeSize = ((SvxSizeItem*)pItem)->GetSize();
- aSize.SetWidthPercent( static_cast< sal_uInt8 >( rRelativeSize.Width() ) );
- aSize.SetHeightPercent( static_cast< sal_uInt8 >( rRelativeSize.Height() ) );
- }
- pSet->Put( aSize );
- }
-
- // Templates AutoUpdate
- SwFrmFmt* pFmt = rSh.GetCurFrmFmt();
- if(pFmt && pFmt->IsAutoUpdateFmt())
- {
- pFmt->SetFmtAttr(*pSet);
- SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE, RES_FRM_SIZE,
- RES_SURROUND, RES_SURROUND,
- RES_ANCHOR, RES_ANCHOR,
- RES_VERT_ORIENT,RES_HORI_ORIENT,
- 0);
- aShellSet.Put(*pSet);
- aMgr.SetAttrSet(aShellSet);
- }
- else
- {
- aMgr.SetAttrSet(*pSet);
- }
- aMgr.UpdateFlyFrm();
-
- bool bApplyUsrPref = false;
- if (SFX_ITEM_SET == pSet->GetItemState(
- FN_KEEP_ASPECT_RATIO, true, &pItem ))
- {
- aUsrPref.SetKeepRatio(
- ((const SfxBoolItem*)pItem)->GetValue() );
- bApplyUsrPref = true;
- }
- if( SFX_ITEM_SET == pSet->GetItemState(
- SID_ATTR_GRAF_KEEP_ZOOM, true, &pItem ))
- {
- aUsrPref.SetGrfKeepZoom(
- ((const SfxBoolItem*)pItem)->GetValue() );
- bApplyUsrPref = true;
- }
-
- if( bApplyUsrPref )
- SW_MOD()->ApplyUsrPref(aUsrPref, &GetView());
-
- // and now set all the graphic attributes and other stuff
- if( SFX_ITEM_SET == pSet->GetItemState(
- SID_ATTR_GRAF_GRAPHIC, true, &pItem ))
- {
- if( !((SvxBrushItem*)pItem)->GetGraphicLink().isEmpty() )
- sGrfNm = ((SvxBrushItem*)pItem)->GetGraphicLink();
- else
- sGrfNm = "";
-
- if( !((SvxBrushItem*)pItem)->GetGraphicFilter().isEmpty() )
- sFilterNm = ((SvxBrushItem*)pItem)->GetGraphicFilter();
- else
- sFilterNm = "";
-
- if( !sGrfNm.isEmpty() )
- {
- SwDocShell* pDocSh = GetView().GetDocShell();
- SwWait aWait( *pDocSh, true );
- SfxMedium* pMedium = pDocSh->GetMedium();
- INetURLObject aAbs;
- if( pMedium )
- aAbs = pMedium->GetURLObject();
- rSh.ReRead( URIHelper::SmartRel2Abs(
- aAbs, sGrfNm,
- URIHelper::GetMaybeFileHdl() ),
- sFilterNm, 0 );
- }
- }
- if ( SFX_ITEM_SET == pSet->GetItemState(
- FN_SET_FRM_ALT_NAME, true, &pItem ))
- {
- // #i73249#
- rSh.SetObjTitle( ((const SfxStringItem*)pItem)->GetValue() );
- }
-
- SfxItemSet aGrfSet( rSh.GetAttrPool(), RES_GRFATR_BEGIN,
- RES_GRFATR_END-1 );
- aGrfSet.Put( *pSet );
- if( aGrfSet.Count() )
- rSh.SetAttrSet( aGrfSet );
-
- rSh.EndUndo(UNDO_END);
- rSh.EndAllAction();
- }
- delete pDlg;
- }
- break;
-
- case FN_GRAPHIC_MIRROR_ON_EVEN_PAGES:
- {
- SfxItemSet aSet(rSh.GetAttrPool(), RES_GRFATR_MIRRORGRF, RES_GRFATR_MIRRORGRF);
- rSh.GetCurAttr( aSet );
- SwMirrorGrf aGrf((const SwMirrorGrf &)aSet.Get(RES_GRFATR_MIRRORGRF));
- aGrf.SetGrfToggle(!aGrf.IsGrfToggle());
- rSh.SetAttrItem(aGrf);
- }
- break;
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
-}
-
-void SwGrfShell::ExecAttr( SfxRequest &rReq )
-{
- sal_uInt16 nGrfType;
- if( CNT_GRF == GetShell().GetCntType() &&
- ( GRAPHIC_BITMAP == ( nGrfType = GetShell().GetGraphicType()) ||
- GRAPHIC_GDIMETAFILE == nGrfType ))
- {
- SfxItemSet aGrfSet( GetShell().GetAttrPool(), RES_GRFATR_BEGIN,
- RES_GRFATR_END -1 );
- const SfxItemSet *pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem;
- sal_uInt16 nSlot = rReq.GetSlot();
- if( !pArgs || SFX_ITEM_SET != pArgs->GetItemState( nSlot, false, &pItem ))
- pItem = 0;
-
- switch( nSlot )
- {
- case SID_FLIP_VERTICAL:
- case SID_FLIP_HORIZONTAL:
- {
- GetShell().GetCurAttr( aGrfSet );
- SwMirrorGrf aMirror( (SwMirrorGrf&)aGrfSet.Get( RES_GRFATR_MIRRORGRF ) );
- sal_uInt16 nMirror = aMirror.GetValue();
- if ( nSlot==SID_FLIP_HORIZONTAL )
- switch( nMirror )
- {
- case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT;
- break;
- case RES_MIRROR_GRAPH_HOR: nMirror = RES_MIRROR_GRAPH_BOTH;
- break;
- case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_DONT;
- break;
- case RES_MIRROR_GRAPH_BOTH: nMirror = RES_MIRROR_GRAPH_HOR;
- break;
- }
- else
- switch( nMirror )
- {
- case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_HOR;
- break;
- case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_BOTH;
- break;
- case RES_MIRROR_GRAPH_HOR: nMirror = RES_MIRROR_GRAPH_DONT;
- break;
- case RES_MIRROR_GRAPH_BOTH: nMirror = RES_MIRROR_GRAPH_VERT;
- break;
- }
- aMirror.SetValue( nMirror );
- aGrfSet.ClearItem();
- aGrfSet.Put( aMirror );
- }
- break;
-
- case SID_ATTR_GRAF_LUMINANCE:
- if( pItem )
- aGrfSet.Put( SwLuminanceGrf(
- ((SfxInt16Item*)pItem)->GetValue() ));
- break;
-
- case SID_ATTR_GRAF_CONTRAST:
- if( pItem )
- aGrfSet.Put( SwContrastGrf(
- ((SfxInt16Item*)pItem)->GetValue() ));
- break;
-
- case SID_ATTR_GRAF_RED:
- if( pItem )
- aGrfSet.Put( SwChannelRGrf(
- ((SfxInt16Item*)pItem)->GetValue() ));
- break;
-
- case SID_ATTR_GRAF_GREEN:
- if( pItem )
- aGrfSet.Put( SwChannelGGrf(
- ((SfxInt16Item*)pItem)->GetValue() ));
- break;
-
- case SID_ATTR_GRAF_BLUE:
- if( pItem )
- aGrfSet.Put( SwChannelBGrf(
- ((SfxInt16Item*)pItem)->GetValue() ));
- break;
-
- case SID_ATTR_GRAF_GAMMA:
- if( pItem )
- {
- double fVal = ((SfxUInt32Item*)pItem)->GetValue();
- aGrfSet.Put( SwGammaGrf(fVal/100. ));
- }
- break;
-
- case SID_ATTR_GRAF_TRANSPARENCE:
- if( pItem )
- aGrfSet.Put( SwTransparencyGrf(
- static_cast< sal_Int8 >( ( (SfxUInt16Item*)pItem )->GetValue() ) ) );
- break;
-
- case SID_ATTR_GRAF_INVERT:
- if( pItem )
- aGrfSet.Put( SwInvertGrf(
- ((SfxBoolItem*)pItem)->GetValue() ));
- break;
-
- case SID_ATTR_GRAF_MODE:
- if( pItem )
- aGrfSet.Put( SwDrawModeGrf(
- ((SfxUInt16Item*)pItem)->GetValue() ));
- break;
-
- case SID_COLOR_SETTINGS:
- {
- svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
- aToolboxAccess.toggleToolbox();
- break;
- }
-
- case SID_GRFFILTER:
- case SID_GRFFILTER_INVERT:
- case SID_GRFFILTER_SMOOTH:
- case SID_GRFFILTER_SHARPEN:
- case SID_GRFFILTER_REMOVENOISE:
- case SID_GRFFILTER_SOBEL:
- case SID_GRFFILTER_MOSAIC:
- case SID_GRFFILTER_EMBOSS:
- case SID_GRFFILTER_POSTER:
- case SID_GRFFILTER_POPART:
- case SID_GRFFILTER_SEPIA:
- case SID_GRFFILTER_SOLARIZE:
- if( GRAPHIC_BITMAP == nGrfType )
- {
- // #119353# - robust
- const GraphicObject* pFilterObj( GetShell().GetGraphicObj() );
- if ( pFilterObj )
- {
- GraphicObject aFilterObj( *pFilterObj );
- if( SVX_GRAPHICFILTER_ERRCODE_NONE ==
- SvxGraphicFilter::ExecuteGrfFilterSlot( rReq, aFilterObj ))
- GetShell().ReRead( OUString(), OUString(),
- &aFilterObj.GetGraphic() );
- }
- }
- break;
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- }
-
- if( aGrfSet.Count() )
- GetShell().SetAttrSet( aGrfSet );
- }
- GetView().GetViewFrame()->GetBindings().Invalidate(rReq.GetSlot());
-}
-
-void SwGrfShell::GetAttrState(SfxItemSet &rSet)
-{
- SwWrtShell &rSh = GetShell();
- SfxItemSet aCoreSet( GetPool(), aNoTxtNodeSetRange );
- rSh.GetCurAttr( aCoreSet );
- bool bParentCntProt = 0 != rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
- bool bIsGrfCntnt = CNT_GRF == GetShell().GetCntType();
-
- SetGetStateSet( &rSet );
-
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- while( nWhich )
- {
- bool bDisable = bParentCntProt;
- switch( nWhich )
- {
- case SID_INSERT_GRAPHIC:
- case FN_FORMAT_GRAFIC_DLG:
- case SID_TWAIN_TRANSFER:
- if( bParentCntProt || !bIsGrfCntnt )
- bDisable = true;
- else if ( nWhich == SID_INSERT_GRAPHIC
- && rSh.CrsrInsideInputFld() )
- {
- bDisable = true;
- }
- break;
-
- case SID_SAVE_GRAPHIC:
- case SID_EXTERNAL_EDIT:
- if( rSh.GetGraphicType() == GRAPHIC_NONE )
- bDisable = true;
- break;
-
- case SID_COLOR_SETTINGS:
- {
- if ( bParentCntProt || !bIsGrfCntnt )
- bDisable = true;
- else
- {
- svx::ToolboxAccess aToolboxAccess( TOOLBOX_NAME );
- rSet.Put( SfxBoolItem( nWhich, aToolboxAccess.isToolboxVisible() ) );
- }
- break;
- }
-
- case SID_FLIP_HORIZONTAL:
- if( !bParentCntProt )
- {
- MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get(
- RES_GRFATR_MIRRORGRF )).GetValue());
-
- rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_VERT ||
- nState == RES_MIRROR_GRAPH_BOTH));
- }
- break;
-
- case SID_FLIP_VERTICAL:
- if( !bParentCntProt )
- {
- MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get(
- RES_GRFATR_MIRRORGRF )).GetValue());
-
- rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_HOR ||
- nState == RES_MIRROR_GRAPH_BOTH));
- }
- break;
-
- case SID_ATTR_GRAF_LUMINANCE:
- if( !bParentCntProt )
- rSet.Put( SfxInt16Item( nWhich, ((SwLuminanceGrf&)
- aCoreSet.Get(RES_GRFATR_LUMINANCE)).GetValue() ));
- break;
-
- case SID_ATTR_GRAF_CONTRAST:
- if( !bParentCntProt )
- rSet.Put( SfxInt16Item( nWhich, ((SwContrastGrf&)
- aCoreSet.Get(RES_GRFATR_CONTRAST)).GetValue() ));
- break;
-
- case SID_ATTR_GRAF_RED:
- if( !bParentCntProt )
- rSet.Put( SfxInt16Item( nWhich, ((SwChannelRGrf&)
- aCoreSet.Get(RES_GRFATR_CHANNELR)).GetValue() ));
- break;
-
- case SID_ATTR_GRAF_GREEN:
- if( !bParentCntProt )
- rSet.Put( SfxInt16Item( nWhich, ((SwChannelGGrf&)
- aCoreSet.Get(RES_GRFATR_CHANNELG)).GetValue() ));
- break;
-
- case SID_ATTR_GRAF_BLUE:
- if( !bParentCntProt )
- rSet.Put( SfxInt16Item( nWhich, ((SwChannelBGrf&)
- aCoreSet.Get(RES_GRFATR_CHANNELB)).GetValue() ));
- break;
-
- case SID_ATTR_GRAF_GAMMA:
- if( !bParentCntProt )
- rSet.Put( SfxUInt32Item( nWhich, static_cast< sal_uInt32 >(
- ( (SwGammaGrf&)aCoreSet.Get( RES_GRFATR_GAMMA ) ).GetValue() * 100 ) ) );
- break;
-
- case SID_ATTR_GRAF_TRANSPARENCE:
- if( !bParentCntProt )
- {
- // #119353# - robust
- const GraphicObject* pGrafObj = rSh.GetGraphicObj();
- if ( pGrafObj )
- {
- if( pGrafObj->IsAnimated() ||
- GRAPHIC_GDIMETAFILE == pGrafObj->GetType() )
- bDisable = true;
- else
- rSet.Put( SfxUInt16Item( nWhich, ((SwTransparencyGrf&)
- aCoreSet.Get(RES_GRFATR_TRANSPARENCY)).GetValue() ));
- }
- }
- break;
-
- case SID_ATTR_GRAF_INVERT:
- if( !bParentCntProt )
- rSet.Put( SfxBoolItem( nWhich, ((SwInvertGrf&)
- aCoreSet.Get(RES_GRFATR_INVERT)).GetValue() ));
- break;
-
- case SID_ATTR_GRAF_MODE:
- if( !bParentCntProt )
- rSet.Put( SfxUInt16Item( nWhich, ((SwDrawModeGrf&)
- aCoreSet.Get(RES_GRFATR_DRAWMODE)).GetValue() ));
- break;
-
- case SID_GRFFILTER:
- case SID_GRFFILTER_INVERT:
- case SID_GRFFILTER_SMOOTH:
- case SID_GRFFILTER_SHARPEN:
- case SID_GRFFILTER_REMOVENOISE:
- case SID_GRFFILTER_SOBEL:
- case SID_GRFFILTER_MOSAIC:
- case SID_GRFFILTER_EMBOSS:
- case SID_GRFFILTER_POSTER:
- case SID_GRFFILTER_POPART:
- case SID_GRFFILTER_SEPIA:
- case SID_GRFFILTER_SOLARIZE:
- {
- if( bParentCntProt || !bIsGrfCntnt )
- bDisable = true;
- // #i59688# load graphic only if type is unknown
- else
- {
- const sal_uInt16 eGraphicType( rSh.GetGraphicType() );
- if ( ( eGraphicType == GRAPHIC_NONE ||
- eGraphicType == GRAPHIC_DEFAULT ) &&
- rSh.IsGrfSwapOut( sal_True ) )
- {
- rSet.DisableItem( nWhich );
- if( AddGrfUpdateSlot( nWhich ))
- rSh.GetGraphic(sal_False); // start the loading
- }
- else
- {
- bDisable = eGraphicType != GRAPHIC_BITMAP;
- }
- }
- }
- break;
-
- default:
- bDisable = false;
- }
-
- if( bDisable )
- rSet.DisableItem( nWhich );
- nWhich = aIter.NextWhich();
- }
- SetGetStateSet( 0 );
-}
-
-void SwGrfShell::ExecuteRotation(SfxRequest &rReq)
-{
- sal_uInt16 aRotation;
-
- SwWrtShell& rShell = GetShell();
-
- if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_LEFT)
- {
- aRotation = 900;
- }
- else if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RIGHT)
- {
- aRotation = 2700;
- }
- else
- {
- return;
- }
-
- rShell.StartAllAction();
- rShell.StartUndo(UNDO_START);
-
- Graphic aGraphic = *rShell.GetGraphic();
- GraphicNativeTransform aTransform(aGraphic);
- aTransform.rotate(aRotation);
- rShell.ReRead(OUString(), OUString(), (const Graphic*) &aGraphic);
-
- SwFlyFrmAttrMgr aManager(false, &rShell, rShell.IsFrmSelected() ? FRMMGR_TYPE_NONE : FRMMGR_TYPE_GRF);
- Size aSize(aManager.GetSize().Height(), aManager.GetSize().Width());
- aManager.SetSize(aSize);
- aManager.UpdateFlyFrm();
-
- SfxItemSet aSet( rShell.GetAttrPool(), RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF );
- rShell.GetCurAttr( aSet );
- SwCropGrf aCrop( (const SwCropGrf&) aSet.Get(RES_GRFATR_CROPGRF) );
- Rectangle aCropRectangle(aCrop.GetLeft(), aCrop.GetTop(), aCrop.GetRight(), aCrop.GetBottom());
-
- if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_LEFT)
- {
- aCrop.SetLeft( aCropRectangle.Top() );
- aCrop.SetTop( aCropRectangle.Right() );
- aCrop.SetRight( aCropRectangle.Bottom() );
- aCrop.SetBottom( aCropRectangle.Left() );
- }
- else if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_RIGHT)
- {
- aCrop.SetLeft( aCropRectangle.Bottom() );
- aCrop.SetTop( aCropRectangle.Left() );
- aCrop.SetRight( aCropRectangle.Top() );
- aCrop.SetBottom( aCropRectangle.Right() );
- }
-
- rShell.SetAttrItem(aCrop);
-
- rShell.EndUndo(UNDO_END);
- rShell.EndAllAction();
-}
-
-void SwGrfShell::GetAttrStateForRotation(SfxItemSet &rSet)
-{
- SwWrtShell& rShell = GetShell();
- bool bIsParentContentProtected = 0 != rShell.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
-
- SetGetStateSet( &rSet );
-
- SfxWhichIter aIterator( rSet );
- sal_uInt16 nWhich = aIterator.FirstWhich();
- while( nWhich )
- {
- bool bDisable = bIsParentContentProtected;
- switch( nWhich )
- {
- case SID_ROTATE_GRAPHIC_LEFT:
- case SID_ROTATE_GRAPHIC_RIGHT:
- if( rShell.GetGraphicType() == GRAPHIC_NONE )
- {
- bDisable = true;
- }
- else
- {
- Graphic aGraphic = *rShell.GetGraphic();
- GraphicNativeTransform aTransform(aGraphic);
- if (!aTransform.canBeRotated())
- {
- bDisable = true;
- }
- }
- break;
- default:
- bDisable = false;
- }
-
- if( bDisable )
- rSet.DisableItem( nWhich );
- nWhich = aIterator.NextWhich();
- }
- SetGetStateSet( 0 );
-}
-
-SwGrfShell::SwGrfShell(SwView &_rView) :
- SwBaseShell(_rView)
-{
- SetName(OUString("Graphic"));
- SetHelpId(SW_GRFSHELL);
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Graphic));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/grfshex.cxx b/sw/source/ui/shells/grfshex.cxx
deleted file mode 100644
index 60988bac1736..000000000000
--- a/sw/source/ui/shells/grfshex.cxx
+++ /dev/null
@@ -1,154 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <docary.hxx>
-#include <grfsh.hxx>
-#include <wrtsh.hxx>
-#include <view.hxx>
-#include <textsh.hxx>
-#include <viewopt.hxx>
-#include <swundo.hxx>
-#include <shells.hrc>
-#include <caption.hxx>
-#include <vcl/graphicfilter.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <doc.hxx>
-#include <docsh.hxx>
-#include <frmfmt.hxx>
-#include <frmmgr.hxx>
-#include <vcl/msgbox.hxx>
-#include <svx/svdomedia.hxx>
-#include <svx/svdview.hxx>
-#include <svx/svdpagv.hxx>
-#include <SwStyleNameMapper.hxx>
-#include <sfx2/filedlghelper.hxx>
-#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
-#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
-#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp>
-#include <poolfmt.hrc>
-
-#include <sfx2/request.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <svl/stritem.hxx>
-#include <avmedia/mediawindow.hxx>
-#include <vcl/svapp.hxx>
-
-// -> #111827#
-#include <SwRewriter.hxx>
-#include <comcore.hrc>
-// <- #111827#
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ui::dialogs;
-using namespace ::sfx2;
-
-bool SwTextShell::InsertMediaDlg( SfxRequest& rReq )
-{
- OUString aURL;
- const SfxItemSet* pReqArgs = rReq.GetArgs();
- Window* pWindow = &GetView().GetViewFrame()->GetWindow();
- bool bAPI = false, bRet = false;
-
- if( pReqArgs )
- {
- const SfxStringItem* pStringItem = PTR_CAST( SfxStringItem, &pReqArgs->Get( rReq.GetSlot() ) );
-
- if( pStringItem )
- {
- aURL = pStringItem->GetValue();
- bAPI = !aURL.isEmpty();
- }
- }
-
- bool bLink(true);
- if (bAPI ||
- ::avmedia::MediaWindow::executeMediaURLDialog(pWindow, aURL, & bLink))
- {
- Size aPrefSize;
-
- if( pWindow )
- pWindow->EnterWait();
-
- if( !::avmedia::MediaWindow::isMediaURL( aURL, "", true, &aPrefSize ) )
- {
- if( pWindow )
- pWindow->LeaveWait();
-
- if( !bAPI )
- ::avmedia::MediaWindow::executeFormatErrorBox( pWindow );
- }
- else
- {
- SwWrtShell& rSh = GetShell();
-
- if( !rSh.HasDrawView() )
- rSh.MakeDrawView();
-
- Size aDocSz( rSh.GetDocSize() );
- const SwRect& rVisArea = rSh.VisArea();
- Point aPos( rVisArea.Center() );
- Size aSize;
-
- if( rVisArea.Width() > aDocSz.Width())
- aPos.X() = aDocSz.Width() / 2 + rVisArea.Left();
-
- if(rVisArea.Height() > aDocSz.Height())
- aPos.Y() = aDocSz.Height() / 2 + rVisArea.Top();
-
- if( aPrefSize.Width() && aPrefSize.Height() )
- {
- if( pWindow )
- aSize = pWindow->PixelToLogic( aPrefSize, MAP_TWIP );
- else
- aSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_TWIP );
- }
- else
- aSize = Size( 2835, 2835 );
-
- OUString realURL;
- if (bLink)
- {
- realURL = aURL;
- }
- else
- {
- uno::Reference<frame::XModel> const xModel(
- rSh.GetDoc()->GetDocShell()->GetModel());
- bRet = ::avmedia::EmbedMedia(xModel, aURL, realURL);
- if (!bRet) { return bRet; }
- }
-
- SdrMediaObj* pObj = new SdrMediaObj( Rectangle( aPos, aSize ) );
-
- pObj->SetModel(rSh.GetDoc()->GetDrawModel()); // set before setURL
- pObj->setURL( realURL, "" );
- rSh.EnterStdMode();
- rSh.SwFEShell::InsertDrawObj( *pObj, aPos );
- bRet = true;
-
- if( pWindow )
- pWindow->LeaveWait();
- }
- }
-
- return bRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/langhelper.cxx b/sw/source/ui/shells/langhelper.cxx
deleted file mode 100644
index 8342502e12ae..000000000000
--- a/sw/source/ui/shells/langhelper.cxx
+++ /dev/null
@@ -1,612 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <string.h>
-
-#include <vcl/window.hxx>
-
-#include <wrtsh.hxx>
-#include <doc.hxx>
-#include <docary.hxx>
-#include <charfmt.hxx>
-
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/request.hxx>
-#include <editeng/eeitem.hxx>
-#include <editeng/editeng.hxx>
-#include <editeng/editdata.hxx>
-#include <editeng/outliner.hxx>
-#include <editeng/editview.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <editeng/langitem.hxx>
-
-#include <svl/languageoptions.hxx>
-#include <svtools/langtab.hxx>
-#include <svl/slstitm.hxx>
-#include <svl/stritem.hxx>
-
-#include <ndtxt.hxx>
-#include <pam.hxx>
-#include <view.hxx>
-#include <viewopt.hxx>
-
-#include "swabstdlg.hxx"
-
-#include <vcl/msgbox.hxx>
-
-#include <langhelper.hxx>
-
-using namespace ::com::sun::star;
-
-namespace SwLangHelper
-{
-
- sal_uInt16 GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet )
- {
- ESelection aSelection = pOLV->GetSelection();
- EditView& rEditView=pOLV->GetEditView();
- EditEngine* pEditEngine=rEditView.GetEditEngine();
-
- // the value of used script types
- const sal_uInt16 nScriptType =pOLV->GetSelectedScriptType();
- OUString aScriptTypesInUse( OUString::number( nScriptType ) );//pEditEngine->GetScriptType(aSelection)
-
- SvtLanguageTable aLangTable;
-
- // get keyboard language
- OUString aKeyboardLang;
- LanguageType nLang = LANGUAGE_DONTKNOW;
-
- Window* pWin = rEditView.GetWindow();
- if(pWin)
- nLang = pWin->GetInputLanguage();
- if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
- aKeyboardLang = aLangTable.GetString( nLang );
-
- // get the language that is in use
- OUString aCurrentLang("*");
- SfxItemSet aSet(pOLV->GetAttribs());
- nLang = SwLangHelper::GetCurrentLanguage( aSet,nScriptType );
- if (nLang != LANGUAGE_DONTKNOW)
- aCurrentLang = aLangTable.GetString( nLang );
-
- // build sequence for status value
- uno::Sequence< OUString > aSeq( 4 );
- aSeq[0] = aCurrentLang;
- aSeq[1] = aScriptTypesInUse;
- aSeq[2] = aKeyboardLang;
- aSeq[3] = SwLangHelper::GetTextForLanguageGuessing( pEditEngine, aSelection );
-
- // set sequence as status value
- SfxStringListItem aItem( SID_LANGUAGE_STATUS );
- aItem.SetStringList( aSeq );
- rSet.Put( aItem, SID_LANGUAGE_STATUS );
- return 0;
- }
-
- bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView &rView, SwWrtShell &rSh )
- {
- bool bRestoreSelection = false;
- SfxItemSet aEditAttr(pOLV->GetAttribs());
- ESelection aSelection = pOLV->GetSelection();
- EditView & rEditView = pOLV->GetEditView();
- EditEngine * pEditEngine = rEditView.GetEditEngine();
-
- // get the language
- OUString aNewLangTxt;
-
- SFX_REQUEST_ARG( rReq, pItem, SfxStringItem, SID_LANGUAGE_STATUS , false );
- if (pItem)
- aNewLangTxt = pItem->GetValue();
-
- //!! Remember the view frame right now...
- //!! (call to GetView().GetViewFrame() will break if the
- //!! SwTextShell got destroyed meanwhile.)
- SfxViewFrame *pViewFrame = rView.GetViewFrame();
-
- if (aNewLangTxt == "*" )
- {
- // open the dialog "Tools/Options/Language Settings - Language"
- SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- if (pFact)
- {
- VclAbstractDialog* pDlg = pFact->CreateVclDialog( rView.GetWindow(), SID_LANGUAGE_OPTIONS );
- pDlg->Execute();
- delete pDlg;
- }
- }
- else
- {
- // setting the new language...
- if (!aNewLangTxt.isEmpty())
- {
- const OUString aSelectionLangPrefix("Current_");
- const OUString aParagraphLangPrefix("Paragraph_");
- const OUString aDocumentLangPrefix("Default_");
- const OUString aStrNone("LANGUAGE_NONE");
- const OUString aStrResetLangs("RESET_LANGUAGES");
-
- sal_Int32 nPos = 0;
- bool bForSelection = true;
- bool bForParagraph = false;
- if (-1 != (nPos = aNewLangTxt.indexOf( aSelectionLangPrefix, 0 )))
- {
- // ... for the current selection
- aNewLangTxt = aNewLangTxt.replaceAt(nPos, aSelectionLangPrefix.getLength(), "");
- bForSelection = true;
- }
- else if (-1 != (nPos = aNewLangTxt.indexOf( aParagraphLangPrefix , 0 )))
- {
- // ... for the current paragraph language
- aNewLangTxt = aNewLangTxt.replaceAt(nPos, aParagraphLangPrefix.getLength(), "");
- bForSelection = true;
- bForParagraph = true;
- }
- else if (-1 != (nPos = aNewLangTxt.indexOf( aDocumentLangPrefix , 0 )))
- {
- // ... as default document language
- aNewLangTxt = aNewLangTxt.replaceAt(nPos, aDocumentLangPrefix.getLength(), "");
- bForSelection = false;
- }
-
- if (bForParagraph)
- {
- bRestoreSelection = true;
- SwLangHelper::SelectPara( rEditView, aSelection );
- aSelection = pOLV->GetSelection();
- }
- if (!bForSelection) // document language to be changed...
- {
- rSh.StartAction();
- rSh.LockView( sal_True );
- rSh.Push();
-
- // prepare to apply new language to all text in document
- rSh.SelAll();
- rSh.ExtendedSelectAll();
- }
-
- if (aNewLangTxt == aStrNone)
- SwLangHelper::SetLanguage_None( rSh, pOLV, aSelection, bForSelection, aEditAttr );
- else if (aNewLangTxt == aStrResetLangs)
- SwLangHelper::ResetLanguages( rSh, pOLV, aSelection, bForSelection );
- else
- SwLangHelper::SetLanguage( rSh, pOLV, aSelection, aNewLangTxt, bForSelection, aEditAttr );
-
- // ugly hack, as it seems that EditView/EditEngine does not update their spellchecking marks
- // when setting a new language attribute
- if (bForSelection)
- {
- const SwViewOption* pVOpt = rView.GetWrtShellPtr()->GetViewOptions();
- sal_uLong nCntrl = pEditEngine->GetControlWord();
- // turn off
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- pEditEngine->SetControlWord(nCntrl);
-
- //turn back on
- if (pVOpt->IsOnlineSpell())
- nCntrl |= EE_CNTRL_ONLINESPELLING;
- else
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- pEditEngine->SetControlWord(nCntrl);
-
- pEditEngine->CompleteOnlineSpelling();
- rEditView.Invalidate();
- }
-
- if (!bForSelection)
- {
- // need to release view and restore selection...
- rSh.Pop( sal_False );
- rSh.LockView( sal_False );
- rSh.EndAction();
- }
- }
- }
-
- // invalidate slot to get the new language displayed
- pViewFrame->GetBindings().Invalidate( rReq.GetSlot() );
-
- rReq.Done();
- return bRestoreSelection;
- }
-
- void SetLanguage( SwWrtShell &rWrtSh, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
- {
- SetLanguage( rWrtSh, 0 , ESelection(), rLangText, bIsForSelection, rCoreSet );
- }
-
- void SetLanguage( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet )
- {
- const LanguageType nLang = SvtLanguageTable().GetType( rLangText );
- if (nLang != LANGUAGE_DONTKNOW)
- {
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLang );
-
- EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL;
- OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
-
- //get ScriptType
- sal_uInt16 nLangWhichId = 0;
- bool bIsSingleScriptType = true;
- switch (nScriptType)
- {
- case SCRIPTTYPE_LATIN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE : RES_CHRATR_LANGUAGE; break;
- case SCRIPTTYPE_ASIAN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CJK : RES_CHRATR_CJK_LANGUAGE; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CTL : RES_CHRATR_CTL_LANGUAGE; break;
- default:
- bIsSingleScriptType = false;
- OSL_FAIL("unexpected case" );
- }
- if (bIsSingleScriptType)
- {
- // change language for selection or paragraph
- // (for paragraph is handled by previosuly having set the selection to the
- // whole paragraph)
- if (bIsForSelection)
- {
- // apply language to current selection
- if (pEditEngine)
- {
- rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
- pEditEngine->QuickSetAttribs( rCoreSet, aSelection);
- }
- else
- {
- rWrtSh.GetCurAttr( rCoreSet );
- rCoreSet.Put( SvxLanguageItem( nLang, nLangWhichId ));
- rWrtSh.SetAttrSet( rCoreSet );
- }
- }
- else // change language for all text
- {
- // set document default language
- switch (nLangWhichId)
- {
- case EE_CHAR_LANGUAGE : nLangWhichId = RES_CHRATR_LANGUAGE; break;
- case EE_CHAR_LANGUAGE_CJK : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
- case EE_CHAR_LANGUAGE_CTL : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
- }
- //Set the default document language
- rWrtSh.SetDefault( SvxLanguageItem( nLang, nLangWhichId ) );
-
- //Resolves: fdo#35282 Clear the language from all Text Styles, and
- //fallback to default document language
- const SwTxtFmtColls *pColls = rWrtSh.GetDoc()->GetTxtFmtColls();
- for(sal_uInt16 i = 0, nCount = pColls->size(); i < nCount; ++i)
- {
- SwTxtFmtColl &rTxtColl = *(*pColls)[ i ];
- rTxtColl.ResetFmtAttr(nLangWhichId);
- }
- //Resolves: fdo#35282 Clear the language from all Character Styles,
- //and fallback to default document language
- const SwCharFmts *pCharFmts = rWrtSh.GetDoc()->GetCharFmts();
- for(sal_uInt16 i = 0, nCount = pCharFmts->size(); i < nCount; ++i)
- {
- SwCharFmt &rCharFmt = *(*pCharFmts)[ i ];
- rCharFmt.ResetFmtAttr(nLangWhichId);
- }
-
- // #i102191: hard set respective language attribute in text document
- // (for all text in the document - which should be selected by now...)
- rWrtSh.SetAttrItem( SvxLanguageItem( nLang, nLangWhichId ) );
- }
- }
- }
- }
-
- void SetLanguage_None( SwWrtShell &rWrtSh, bool bIsForSelection, SfxItemSet &rCoreSet )
- {
- SetLanguage_None( rWrtSh,0,ESelection(),bIsForSelection,rCoreSet );
- }
-
- void SetLanguage_None( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection, SfxItemSet &rCoreSet )
- {
- // EditEngine IDs
- const sal_uInt16 aLangWhichId_EE[3] =
- {
- EE_CHAR_LANGUAGE,
- EE_CHAR_LANGUAGE_CJK,
- EE_CHAR_LANGUAGE_CTL
- };
-
- // Writewr IDs
- const sal_uInt16 aLangWhichId_Writer[3] =
- {
- RES_CHRATR_LANGUAGE,
- RES_CHRATR_CJK_LANGUAGE,
- RES_CHRATR_CTL_LANGUAGE
- };
-
- if (bIsForSelection)
- {
- // change language for selection or paragraph
- // (for paragraph is handled by previosuly having set the selection to the
- // whole paragraph)
-
- EditEngine* pEditEngine = pOLV ? pOLV->GetEditView().GetEditEngine() : NULL;
- OSL_ENSURE( !pOLV || pEditEngine, "OutlinerView without EditEngine???" );
- if (pEditEngine)
- {
- for (sal_uInt16 i = 0; i < 3; ++i)
- rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_EE[i] ));
- pEditEngine->QuickSetAttribs( rCoreSet, aSelection);
- }
- else
- {
- rWrtSh.GetCurAttr( rCoreSet );
- for (sal_uInt16 i = 0; i < 3; ++i)
- rCoreSet.Put( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_Writer[i] ));
- rWrtSh.SetAttrSet( rCoreSet );
- }
- }
- else // change language for all text
- {
- std::set<sal_uInt16> aAttribs;
- for (sal_uInt16 i = 0; i < 3; ++i)
- {
- rWrtSh.SetDefault( SvxLanguageItem( LANGUAGE_NONE, aLangWhichId_Writer[i] ) );
- aAttribs.insert( aLangWhichId_Writer[i] );
- }
-
- // set all language attributes to default
- // (for all text in the document - which should be selected by now...)
- rWrtSh.ResetAttr( aAttribs );
- }
- }
-
- void ResetLanguages( SwWrtShell &rWrtSh, bool bIsForSelection )
- {
- ResetLanguages( rWrtSh, 0 , ESelection(), bIsForSelection );
- }
-
- void ResetLanguages( SwWrtShell &rWrtSh, OutlinerView* pOLV, ESelection aSelection, bool bIsForSelection )
- {
- (void) bIsForSelection;
- (void) aSelection;
-
- // reset language for current selection.
- // The selection should already have been expanded to the whole paragraph or
- // to all text in the document if those are the ranges where to reset
- // the language attributes
-
- if (pOLV)
- {
- EditView &rEditView = pOLV->GetEditView();
- rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE );
- rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CJK );
- rEditView.RemoveAttribs( true, EE_CHAR_LANGUAGE_CTL );
- }
- else
- {
- std::set<sal_uInt16> aAttribs;
- aAttribs.insert( RES_CHRATR_LANGUAGE );
- aAttribs.insert( RES_CHRATR_CJK_LANGUAGE );
- aAttribs.insert( RES_CHRATR_CTL_LANGUAGE );
- rWrtSh.ResetAttr( aAttribs );
- }
- }
-
- /// @returns : the language for the selected text that is set for the
- /// specified attribute (script type).
- /// If there are more than one languages used LANGUAGE_DONTKNOW will be returned.
- /// @param nLangWhichId : one of
- /// RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
- LanguageType GetLanguage( SwWrtShell &rSh, sal_uInt16 nLangWhichId )
- {
- SfxItemSet aSet( rSh.GetAttrPool(), nLangWhichId, nLangWhichId );
- rSh.GetCurAttr( aSet );
-
- return GetLanguage(aSet,nLangWhichId);
- }
-
- LanguageType GetLanguage( SfxItemSet aSet, sal_uInt16 nLangWhichId )
- {
-
- LanguageType nLang = LANGUAGE_SYSTEM;
-
- const SfxPoolItem *pItem = 0;
- SfxItemState nState = aSet.GetItemState( nLangWhichId, true, &pItem );
- if (nState > SFX_ITEM_DEFAULT && pItem)
- {
- // the item is set and can be used
- nLang = (dynamic_cast< const SvxLanguageItem* >(pItem))->GetLanguage();
- }
- else if (nState == SFX_ITEM_DEFAULT)
- {
- // since the attribute is not set: retrieve the default value
- nLang = (dynamic_cast< const SvxLanguageItem& >(aSet.GetPool()->GetDefaultItem( nLangWhichId ))).GetLanguage();
- }
- else if (nState == SFX_ITEM_DONTCARE)
- {
- // there is more than one language...
- nLang = LANGUAGE_DONTKNOW;
- }
- OSL_ENSURE( nLang != LANGUAGE_SYSTEM, "failed to get the language?" );
-
- return nLang;
- }
-
- /// @returns: the language in use for the selected text.
- /// 'In use' means the language(s) matching the script type(s) of the
- /// selected text. Or in other words, the language a spell checker would use.
- /// If there is more than one language LANGUAGE_DONTKNOW will be returned.
- LanguageType GetCurrentLanguage( SwWrtShell &rSh )
- {
- // get all script types used in current selection
- const sal_uInt16 nScriptType = rSh.GetScriptType();
-
- //set language attribute to use according to the script type
- sal_uInt16 nLangWhichId = 0;
- bool bIsSingleScriptType = true;
- switch (nScriptType)
- {
- case SCRIPTTYPE_LATIN : nLangWhichId = RES_CHRATR_LANGUAGE; break;
- case SCRIPTTYPE_ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
- default: bIsSingleScriptType = false; break;
- }
-
- // get language according to the script type(s) in use
- LanguageType nCurrentLang = LANGUAGE_SYSTEM;
- if (bIsSingleScriptType)
- nCurrentLang = GetLanguage( rSh, nLangWhichId );
- else
- {
- // check if all script types are set to LANGUAGE_NONE and return
- // that if this is the case. Otherwise, having multiple script types
- // in use always means there are several languages in use...
- const sal_uInt16 aScriptTypes[3] =
- {
- RES_CHRATR_LANGUAGE,
- RES_CHRATR_CJK_LANGUAGE,
- RES_CHRATR_CTL_LANGUAGE
- };
- nCurrentLang = LANGUAGE_NONE;
- for (sal_uInt16 i = 0; i < 3; ++i)
- {
- LanguageType nTmpLang = GetLanguage( rSh, aScriptTypes[i] );
- if (nTmpLang != LANGUAGE_NONE)
- {
- nCurrentLang = LANGUAGE_DONTKNOW;
- break;
- }
- }
- }
- OSL_ENSURE( nCurrentLang != LANGUAGE_SYSTEM, "failed to get the language?" );
-
- return nCurrentLang;
- }
-
- /// @returns: the language in use for the selected text.
- /// 'In use' means the language(s) matching the script type(s) of the
- /// selected text. Or in other words, the language a spell checker would use.
- /// If there is more than one language LANGUAGE_DONTKNOW will be returned.
- LanguageType GetCurrentLanguage( SfxItemSet aSet, sal_uInt16 nScriptType )
- {
- //set language attribute to use according to the script type
- sal_uInt16 nLangWhichId = 0;
- bool bIsSingleScriptType = true;
- switch (nScriptType)
- {
- case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE; break;
- case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
- default: bIsSingleScriptType = false;
- }
-
- // get language according to the script type(s) in use
- LanguageType nCurrentLang = LANGUAGE_SYSTEM;
- if (bIsSingleScriptType)
- nCurrentLang = GetLanguage( aSet, nLangWhichId );
- else
- {
- // check if all script types are set to LANGUAGE_NONE and return
- // that if this is the case. Otherwise, having multiple script types
- // in use always means there are several languages in use...
- const sal_uInt16 aScriptTypes[3] =
- {
- EE_CHAR_LANGUAGE,
- EE_CHAR_LANGUAGE_CJK,
- EE_CHAR_LANGUAGE_CTL
- };
- nCurrentLang = LANGUAGE_NONE;
- for (sal_uInt16 i = 0; i < 3; ++i)
- {
- LanguageType nTmpLang = GetLanguage( aSet, aScriptTypes[i] );
- if (nTmpLang != LANGUAGE_NONE)
- {
- nCurrentLang = LANGUAGE_DONTKNOW;
- break;
- }
- }
- }
- OSL_ENSURE( nCurrentLang != LANGUAGE_SYSTEM, "failed to get the language?" );
-
- return nCurrentLang;
- }
-
- OUString GetTextForLanguageGuessing( SwWrtShell &rSh )
- {
- // string for guessing language
- OUString aText;
- SwPaM *pCrsr = rSh.GetCrsr();
- SwTxtNode *pNode = pCrsr->GetNode()->GetTxtNode();
- if (pNode)
- {
- aText = pNode->GetTxt();
- if (!aText.isEmpty())
- {
- sal_Int32 nEnd = pCrsr->GetPoint()->nContent.GetIndex();
- // at most 100 chars to the left...
- const sal_Int32 nStt = nEnd > 100 ? nEnd - 100 : 0;
- // ... and 100 to the right of the cursor position
- nEnd = aText.getLength() - nEnd > 100 ? nEnd + 100 : aText.getLength();
- aText = aText.copy( nStt, nEnd - nStt );
- }
- }
- return aText;
- }
-
- OUString GetTextForLanguageGuessing( EditEngine* rEditEngine, ESelection aDocSelection )
- {
- // string for guessing language
- OUString aText;
-
- aText = rEditEngine->GetText(aDocSelection);
- if (!aText.isEmpty())
- {
- sal_Int32 nStt = 0;
- sal_Int32 nEnd = aDocSelection.nEndPos;
- // at most 100 chars to the left...
- nStt = nEnd > 100 ? nEnd - 100 : 0;
- // ... and 100 to the right of the cursor position
- nEnd = aText.getLength() - nEnd > 100 ? nEnd + 100 : aText.getLength();
- aText = aText.copy( nStt, nEnd - nStt );
- }
-
- return aText;
- }
-
- void SelectPara( EditView &rEditView, const ESelection &rCurSel )
- {
- ESelection aParaSel( rCurSel.nStartPara, 0, rCurSel.nStartPara, EE_TEXTPOS_ALL );
- rEditView.SetSelection( aParaSel );
- }
-
- void SelectCurrentPara( SwWrtShell &rWrtSh )
- {
- // select current para
- if (!rWrtSh.IsSttPara())
- rWrtSh.MovePara( fnParaCurr, fnParaStart );
- if (!rWrtSh.HasMark())
- rWrtSh.SetMark();
- rWrtSh.SwapPam();
- if (!rWrtSh.IsEndPara())
- rWrtSh.MovePara( fnParaCurr, fnParaEnd );
- #if OSL_DEBUG_LEVEL > 1
- OUString aSelTxt;
- rWrtSh.GetSelectedText( aSelTxt );
- (void) aSelTxt;
- #endif
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/listsh.cxx b/sw/source/ui/shells/listsh.cxx
deleted file mode 100644
index ae32351c3db8..000000000000
--- a/sw/source/ui/shells/listsh.cxx
+++ /dev/null
@@ -1,280 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "cmdid.h"
-#include "hintids.hxx"
-#include <editeng/sizeitem.hxx>
-#include <editeng/brushitem.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/objface.hxx>
-#include <sfx2/bindings.hxx>
-#include <svl/stritem.hxx>
-#include <svl/eitem.hxx>
-#include <svl/whiter.hxx>
-#include <svl/intitem.hxx>
-#include <tools/shl.hxx>
-#include <svl/srchitem.hxx>
-
-#include <numrule.hxx>
-#include <fmtornt.hxx>
-#include "wrtsh.hxx"
-#include "swmodule.hxx"
-#include "frmatr.hxx"
-#include "helpid.h"
-#include "globals.hrc"
-#include "shells.hrc"
-#include "uinums.hxx"
-#include "listsh.hxx"
-#include "poolfmt.hxx"
-#include "view.hxx"
-#include "edtwin.hxx"
-
-#define SwListShell
-#include <sfx2/msg.hxx>
-#include "swslots.hxx"
-
-#include <IDocumentOutlineNodes.hxx>
-
-SFX_IMPL_INTERFACE(SwListShell, SwBaseShell, SW_RES(STR_SHELLNAME_LIST))
-{
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_NUM_TOOLBOX));
-}
-
-TYPEINIT1(SwListShell,SwBaseShell)
-
-// #i35572# Functionality of Numbering/Bullet toolbar
-// for outline numbered paragraphs should match the functions for outlines
-// available in the navigator. Therefore the code in the following
-// function is quite similar the code in SwContentTree::ExecCommand.
-static void lcl_OutlineUpDownWithSubPoints( SwWrtShell& rSh, bool bMove, bool bUp )
-{
- const sal_uInt16 nActPos = rSh.GetOutlinePos();
- if ( nActPos < USHRT_MAX && rSh.IsOutlineMovable( nActPos ) )
- {
- rSh.Push();
- rSh.MakeOutlineSel( nActPos, nActPos, sal_True );
-
- if ( bMove )
- {
- const IDocumentOutlineNodes* pIDoc( rSh.getIDocumentOutlineNodesAccess() );
- const sal_uInt16 nActLevel = static_cast<sal_uInt16>(pIDoc->getOutlineLevel( nActPos ));
- sal_uInt16 nActEndPos = nActPos + 1;
- sal_Int16 nDir = 0;
-
- if ( !bUp )
- {
- // Move down with subpoints:
- while ( nActEndPos < pIDoc->getOutlineNodesCount() &&
- pIDoc->getOutlineLevel( nActEndPos ) > nActLevel )
- ++nActEndPos;
-
- if ( nActEndPos < pIDoc->getOutlineNodesCount() )
- {
- // The current subpoint which should be moved
- // starts at nActPos and ends at nActEndPos - 1
- --nActEndPos;
- sal_uInt16 nDest = nActEndPos + 2;
- while ( nDest < pIDoc->getOutlineNodesCount() &&
- pIDoc->getOutlineLevel( nDest ) > nActLevel )
- ++nDest;
-
- nDir = nDest - 1 - nActEndPos;
- }
- }
- else
- {
- // Move up with subpoints:
- if ( nActPos > 0 )
- {
- --nActEndPos;
- sal_uInt16 nDest = nActPos - 1;
- while ( nDest > 0 && pIDoc->getOutlineLevel( nDest ) > nActLevel )
- --nDest;
-
- nDir = nDest - nActPos;
- }
- }
-
- if ( nDir )
- {
- rSh.MoveOutlinePara( nDir );
- rSh.GotoOutline( nActPos + nDir );
- }
- }
- else
- {
- // Up/down with subpoints:
- rSh.OutlineUpDown( bUp ? -1 : 1 );
- }
-
- rSh.ClearMark();
- rSh.Pop( sal_False );
- }
-}
-
-void SwListShell::Execute(SfxRequest &rReq)
-{
- const SfxItemSet* pArgs = rReq.GetArgs();
- sal_uInt16 nSlot = rReq.GetSlot();
- SwWrtShell& rSh = GetShell();
-
- // #i35572#
- const SwNumRule* pCurRule = rSh.GetCurNumRule();
- OSL_ENSURE( pCurRule, "SwListShell::Execute without NumRule" );
- bool bOutline = pCurRule && pCurRule->IsOutlineRule();
-
- switch (nSlot)
- {
- case FN_NUM_BULLET_DOWN:
- case FN_NUM_BULLET_UP:
- {
- SfxViewFrame * pFrame = GetView().GetViewFrame();
-
- rReq.Done();
- rSh.NumUpDown( nSlot == FN_NUM_BULLET_DOWN );
- pFrame->GetBindings().Invalidate( SID_TABLE_CELL ); // Update status line!
- }
- break;
-
- case FN_NUM_BULLET_NEXT:
- rSh.GotoNextNum();
- rReq.Done();
- break;
-
- case FN_NUM_BULLET_NONUM:
- rSh.NoNum();
- rReq.Done();
- break;
-
- case FN_NUM_BULLET_OFF:
- {
- rReq.Ignore();
- SfxRequest aReq( GetView().GetViewFrame(), FN_NUM_BULLET_ON );
- aReq.AppendItem( SfxBoolItem( FN_PARAM_1, false ) );
- aReq.Done();
- rSh.DelNumRules();
- break;
- }
-
- case FN_NUM_BULLET_OUTLINE_DOWN:
- if ( bOutline )
- lcl_OutlineUpDownWithSubPoints( rSh, false, false );
- else
- rSh.MoveNumParas(false, false);
- rReq.Done();
- break;
-
- case FN_NUM_BULLET_OUTLINE_MOVEDOWN:
- if ( bOutline )
- lcl_OutlineUpDownWithSubPoints( rSh, true, false );
- else
- rSh.MoveNumParas(true, false);
- rReq.Done();
- break;
-
- case FN_NUM_BULLET_OUTLINE_MOVEUP:
- if ( bOutline )
- lcl_OutlineUpDownWithSubPoints( rSh, true, true );
- else
- rSh.MoveNumParas(true, true);
- rReq.Done();
- break;
-
- case FN_NUM_BULLET_OUTLINE_UP:
- if ( bOutline )
- lcl_OutlineUpDownWithSubPoints( rSh, false, true );
- else
- rSh.MoveNumParas(false, true);
- rReq.Done();
- break;
-
- case FN_NUM_BULLET_PREV:
- rSh.GotoPrevNum();
- rReq.Done();
- break;
-
- case FN_NUM_OR_NONUM:
- {
- sal_Bool bApi = rReq.IsAPI();
- sal_Bool bDelete = !rSh.IsNoNum(!bApi);
- if(pArgs )
- bDelete = ((SfxBoolItem &)pArgs->Get(rReq.GetSlot())).GetValue();
- rSh.NumOrNoNum( bDelete, !bApi );
- rReq.AppendItem( SfxBoolItem( nSlot, bDelete ) );
- rReq.Done();
- }
- break;
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
-}
-
-void SwListShell::GetState(SfxItemSet &rSet)
-{
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- SwWrtShell& rSh = GetShell();
- sal_uInt8 nCurrentNumLevel = rSh.GetNumLevel();
- while ( nWhich )
- {
- switch( nWhich )
- {
- case FN_NUM_OR_NONUM:
- rSet.Put(SfxBoolItem(nWhich, GetShell().IsNoNum(sal_False)));
- break;
- case FN_NUM_BULLET_OUTLINE_UP:
- case FN_NUM_BULLET_UP:
- if(!nCurrentNumLevel)
- rSet.DisableItem(nWhich);
- break;
- case FN_NUM_BULLET_OUTLINE_DOWN :
- {
- sal_uInt8 nUpper = 0;
- sal_uInt8 nLower = 0;
- rSh.GetCurrentOutlineLevels( nUpper, nLower );
- if(nLower == (MAXLEVEL - 1))
- rSet.DisableItem(nWhich);
- }
- break;
- case FN_NUM_BULLET_DOWN:
- if(nCurrentNumLevel == (MAXLEVEL - 1))
- rSet.DisableItem(nWhich);
- break;
-
- case FN_NUM_BULLET_NONUM:
- if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem(nWhich);
- }
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-SwListShell::SwListShell(SwView &_rView) :
- SwBaseShell(_rView)
-{
- SetName(OUString("List"));
- SetHelpId(SW_LISTSHELL);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/mediash.cxx b/sw/source/ui/shells/mediash.cxx
deleted file mode 100644
index 6f9671c42322..000000000000
--- a/sw/source/ui/shells/mediash.cxx
+++ /dev/null
@@ -1,199 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cmdid.h>
-#include <hintids.hxx>
-#include <vcl/msgbox.hxx>
-#include <svl/stritem.hxx>
-#include <svl/whiter.hxx>
-#include <svl/urihelper.hxx>
-#include <sfx2/dispatch.hxx>
-#include <editeng/sizeitem.hxx>
-#include <editeng/protitem.hxx>
-#include <sfx2/request.hxx>
-#include <svl/srchitem.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <svx/sdgluitm.hxx>
-#include <svx/sdgcoitm.hxx>
-#include <svx/sdggaitm.hxx>
-#include <svx/sdgtritm.hxx>
-#include <svx/sdginitm.hxx>
-#include <svx/sdgmoitm.hxx>
-#include <editeng/brushitem.hxx>
-#include <svx/grfflt.hxx>
-#include <fmturl.hxx>
-#include <view.hxx>
-#include <wrtsh.hxx>
-#include <viewopt.hxx>
-#include <swmodule.hxx>
-#include <frmatr.hxx>
-#include <swundo.hxx>
-#include <uitool.hxx>
-#include <docsh.hxx>
-#include <mediash.hxx>
-#include <frmmgr.hxx>
-#include <frmdlg.hxx>
-#include <frmfmt.hxx>
-#include <grfatr.hxx>
-#include <usrpref.hxx>
-#include <edtwin.hxx>
-#include <swwait.hxx>
-#include <shells.hrc>
-#include <popup.hrc>
-
-#include <sfx2/objface.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <svx/svdomedia.hxx>
-#include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
-#include <avmedia/mediaitem.hxx>
-
-#define SwMediaShell
-#include <sfx2/msg.hxx>
-#include "swslots.hxx"
-#include "swabstdlg.hxx"
-
-SFX_IMPL_INTERFACE(SwMediaShell, SwBaseShell, SW_RES(STR_SHELLNAME_MEDIA))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_MEDIA_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_MEDIA_TOOLBOX));
-}
-
-void SwMediaShell::ExecMedia(SfxRequest &rReq)
-{
- SwWrtShell* pSh = &GetShell();
- SdrView* pSdrView = pSh->GetDrawView();
-
- if( pSdrView )
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
- sal_uInt16 nSlotId = rReq.GetSlot();
- sal_Bool bChanged = pSdrView->GetModel()->IsChanged();
-
- pSdrView->GetModel()->SetChanged( false );
-
- switch( nSlotId )
- {
- case SID_DELETE:
- {
- if( pSh->IsObjSelected() )
- {
- pSh->SetModified();
- pSh->DelSelectedObj();
-
- if( pSh->IsSelFrmMode() )
- pSh->LeaveSelFrmMode();
-
- GetView().AttrChangedNotify( pSh );
- }
- }
- break;
-
- case( SID_AVMEDIA_TOOLBOX ):
- {
- if( pSh->IsObjSelected() )
- {
- const SfxPoolItem* pItem;
-
- if( !pArgs || ( SFX_ITEM_SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, false, &pItem ) ) )
- pItem = NULL;
-
- if( pItem )
- {
- SdrMarkList* pMarkList = new SdrMarkList( pSdrView->GetMarkedObjectList() );
-
- if( 1 == pMarkList->GetMarkCount() )
- {
- SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-
- if( pObj && pObj->ISA( SdrMediaObj ) )
- {
- static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
- static_cast< const ::avmedia::MediaItem& >( *pItem ) );
- }
- }
-
- delete pMarkList;
- }
- }
- }
- break;
-
- default:
- break;
- }
-
- if( pSdrView->GetModel()->IsChanged() )
- GetShell().SetModified();
- else if( bChanged )
- pSdrView->GetModel()->SetChanged(true);
- }
-}
-
-void SwMediaShell::GetMediaState(SfxItemSet &rSet)
-{
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while( nWhich )
- {
- if( SID_AVMEDIA_TOOLBOX == nWhich )
- {
- SwWrtShell& rSh = GetShell();
- SdrView* pView = rSh.GetDrawView();
-
- if( pView )
- {
- bool bDisable = true;
- SdrMarkList* pMarkList = new SdrMarkList( pView->GetMarkedObjectList() );
-
- if( 1 == pMarkList->GetMarkCount() )
- {
- SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
-
- if( pObj && pObj->ISA( SdrMediaObj ) )
- {
- ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
-
- static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
- rSet.Put( aItem );
- bDisable = false;
- }
- }
-
- if( bDisable )
- rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
-
- delete pMarkList;
- }
- }
-
- nWhich = aIter.NextWhich();
- }
-}
-
-SwMediaShell::SwMediaShell(SwView &_rView) :
- SwBaseShell(_rView)
-
-{
- SetName(OUString("Media Playback"));
- SetHelpId(SW_MEDIASHELL);
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Media));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/navsh.cxx b/sw/source/ui/shells/navsh.cxx
deleted file mode 100644
index c5a9199daa32..000000000000
--- a/sw/source/ui/shells/navsh.cxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include "cmdid.h"
-#include <svx/svdview.hxx>
-#include <svl/srchitem.hxx>
-#include <svl/eitem.hxx>
-#include <svl/whiter.hxx>
-#include <svx/svdopath.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/objface.hxx>
-#include "wrtsh.hxx"
-#include "view.hxx"
-#include "edtwin.hxx"
-#include "helpid.h"
-#include "globals.hrc"
-#include "navsh.hxx"
-#include "popup.hrc"
-#include "shells.hrc"
-#define SwNavigationShell
-#include "swslots.hxx"
-#include <unomid.h>
-#include "navmgr.hxx"
-
-SFX_IMPL_INTERFACE(SwNavigationShell, SwBaseShell, SW_RES(STR_SHELLNAME_NAVIGATION))
-{
-}
-
-SwNavigationShell::SwNavigationShell(SwView &_rView):
- SwBaseShell( _rView )
-
-{
- SetName(OUString("Navigation"));
- SetHelpId(SW_NAVIGATIONSHELL);
-}
-
-void SwNavigationShell::Execute(SfxRequest &rReq)
-{
- SwWrtShell *pSh = &GetShell();
- SdrView* pSdrView = pSh->GetDrawView();
- const SfxItemSet *pArgs = rReq.GetArgs();
- sal_uInt16 nSlotId = rReq.GetSlot();
- sal_Bool bChanged = pSdrView->GetModel()->IsChanged();
- pSdrView->GetModel()->SetChanged(false);
- SwNavigationMgr& aSwNavigationMgr = pSh->GetNavigationMgr();
- const SfxPoolItem* pItem;
- if(pArgs)
- pArgs->GetItemState(nSlotId, false, &pItem);
- switch (nSlotId)
- {
- case FN_NAVIGATION_BACK:
- aSwNavigationMgr.goBack();
- break;
-
- case FN_NAVIGATION_FORWARD:
- aSwNavigationMgr.goForward();
- break;
- default:
- break;
- }
- if (pSdrView->GetModel()->IsChanged())
- GetShell().SetModified();
- else if (bChanged)
- pSdrView->GetModel()->SetChanged(true);
-}
-
-// determine if the buttons should be enabled/disabled
-
-void SwNavigationShell::GetState(SfxItemSet &rSet)
-{
- SwWrtShell *pSh = &GetShell();
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- SwNavigationMgr& aNavigationMgr = pSh->GetNavigationMgr();
- while( nWhich )
- {
- switch( nWhich )
- {
- case FN_NAVIGATION_BACK:
- {
- if (!aNavigationMgr.backEnabled()) {
- rSet.DisableItem(FN_NAVIGATION_BACK);
- }
- }
- break;
- case FN_NAVIGATION_FORWARD:
- {
- if (!aNavigationMgr.forwardEnabled())
- rSet.DisableItem(FN_NAVIGATION_FORWARD);
- }
- break;
- default:
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/olesh.cxx b/sw/source/ui/shells/olesh.cxx
deleted file mode 100644
index 6014c2fd725a..000000000000
--- a/sw/source/ui/shells/olesh.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sfx2/app.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/objface.hxx>
-#include <sfx2/objitem.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <wrtsh.hxx>
-#include <view.hxx>
-#include <helpid.h>
-#include <globals.hrc>
-#include <frmsh.hxx>
-#include <olesh.hxx>
-
-#include <cmdid.h>
-#include <popup.hrc>
-#include <shells.hrc>
-
-#define SwOleShell
-#include <sfx2/msg.hxx>
-#include <swslots.hxx>
-
-SFX_IMPL_INTERFACE(SwOleShell, SwFrameShell, SW_RES(STR_SHELLNAME_OBJECT))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_OLE_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_OLE_TOOLBOX));
-}
-
-SwOleShell::SwOleShell(SwView &_rView) :
- SwFrameShell(_rView)
-
-{
- SetName(OUString("Object"));
- SetHelpId(SW_OLESHELL);
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OLE));
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/slotadd.cxx b/sw/source/ui/shells/slotadd.cxx
deleted file mode 100644
index ed66709a37e5..000000000000
--- a/sw/source/ui/shells/slotadd.cxx
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <config_options.h>
-
-#include "hintids.hxx"
-#include "uiitems.hxx"
-#include "cmdid.h"
-
-#include <svl/globalnameitem.hxx>
-#include <editeng/memberids.hrc>
-#include <svl/imageitm.hxx>
-#include <svl/aeitem.hxx>
-#include <svl/rectitem.hxx>
-#include <sfx2/objitem.hxx>
-#include <sfx2/objsh.hxx>
-#include <svx/rulritem.hxx>
-#include <sfx2/zoomitem.hxx>
-#include <svx/viewlayoutitem.hxx>
-#include <svx/zoomslideritem.hxx>
-#include <svx/hlnkitem.hxx>
-#include <svx/SmartTagItem.hxx>
-#include <svl/ptitem.hxx>
-#include <svx/pageitem.hxx>
-#include <svl/srchitem.hxx>
-#include <sfx2/tplpitem.hxx>
-#include <editeng/wrlmitem.hxx>
-#include <editeng/protitem.hxx>
-#include <editeng/opaqitem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <editeng/autokernitem.hxx>
-#include <editeng/keepitem.hxx>
-#include <editeng/kernitem.hxx>
-#include <editeng/spltitem.hxx>
-#include <editeng/brushitem.hxx>
-#include <editeng/wghtitem.hxx>
-#include <editeng/shaditem.hxx>
-#include <editeng/pbinitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/prntitem.hxx>
-#include <editeng/orphitem.hxx>
-#include <editeng/widwitem.hxx>
-#include <editeng/lineitem.hxx>
-#include <editeng/pmdlitem.hxx>
-#include <editeng/cmapitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/formatbreakitem.hxx>
-#include <editeng/hyphenzoneitem.hxx>
-#include <editeng/escapementitem.hxx>
-#include <editeng/lspcitem.hxx>
-#include <editeng/adjustitem.hxx>
-#include <editeng/crossedoutitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/shdditem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/postitem.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/contouritem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/boxitem.hxx>
-#include <editeng/sizeitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <svx/xgrad.hxx>
-#include <svx/xlnstit.hxx>
-#include <svx/xlnedit.hxx>
-#include <svx/xfillit0.hxx>
-#include <svx/xflclit.hxx>
-#include <svx/xflgrit.hxx>
-#include <svx/xflhtit.hxx>
-#include <svx/xbtmpit.hxx>
-#include <svx/xlineit0.hxx>
-#include <svx/xlnwtit.hxx>
-#include <svx/xlndsit.hxx>
-#include <svx/xlnclit.hxx>
-#include <svx/xtextit0.hxx>
-#include <svx/xftadit.hxx>
-#include <svx/xftdiit.hxx>
-#include <svx/xftstit.hxx>
-#include <svx/xftmrit.hxx>
-#include <svx/xftouit.hxx>
-#include <svx/xftshit.hxx>
-#include <svx/xftshcit.hxx>
-#include <svx/xftshxy.hxx>
-#include <svx/grafctrl.hxx>
-
-#include <fmtornt.hxx>
-#include <paratr.hxx>
-#include <fmtinfmt.hxx>
-#include <fmtfsize.hxx>
-#include <fmtsrnd.hxx>
-#include "envimg.hxx"
-#include "frmatr.hxx"
-#include "cfgitems.hxx"
-#include "grfatr.hxx"
-#include "fmtline.hxx"
-#include <svx/clipfmtitem.hxx>
-#include <editeng/blinkitem.hxx>
-#include <svl/slstitm.hxx>
-#include <editeng/paravertalignitem.hxx>
-#include <editeng/charreliefitem.hxx>
-#include <editeng/charrotateitem.hxx>
-#include <editeng/charscaleitem.hxx>
-#include <svx/postattr.hxx>
-#include <sfx2/frame.hxx>
-#include <svx/chrtitem.hxx>
-#include <svx/drawitem.hxx>
-#include <avmedia/mediaitem.hxx>
-
-#define SvxDrawToolItem SfxAllEnumItem
-#define SvxDrawAlignItem SfxAllEnumItem
-#define avmedia_MediaItem ::avmedia::MediaItem
-
-#include <svx/xflftrit.hxx>
-#include <svx/xlncapit.hxx>
-#include <svx/xlinjoit.hxx>
-#include <svx/AffineMatrixItem.hxx>
-#include <svx/galleryitem.hxx>
-
-#define SFX_TYPEMAP
-#include <sfx2/msg.hxx>
-#include "swslots.hxx"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx
deleted file mode 100644
index 5b60dafb9d50..000000000000
--- a/sw/source/ui/shells/tabsh.cxx
+++ /dev/null
@@ -1,1476 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-#include <svl/zforlist.hxx>
-#include <svl/stritem.hxx>
-#include <svl/whiter.hxx>
-#include <unotools/moduleoptions.hxx>
-#include <svx/rulritem.hxx>
-#include <svl/srchitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/ulspitem.hxx>
-#include <editeng/brushitem.hxx>
-#include <editeng/boxitem.hxx>
-#include <editeng/shaditem.hxx>
-#include <editeng/spltitem.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/keepitem.hxx>
-#include <editeng/lineitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/frmdiritem.hxx>
-#include <svx/numinf.hxx>
-#include <svx/svddef.hxx>
-#include <svx/svxdlg.hxx>
-#include <svl/zformat.hxx>
-#include <sfx2/bindings.hxx>
-#include <vcl/msgbox.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/objface.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-
-#include <fmtornt.hxx>
-#include <fmtclds.hxx>
-#include <fmtlsplt.hxx>
-#include <fmtrowsplt.hxx>
-#include <fmtfsize.hxx>
-#include <swmodule.hxx>
-#include <wrtsh.hxx>
-#include <wview.hxx>
-#include <frmatr.hxx>
-#include <uitool.hxx>
-#include <inputwin.hxx>
-#include <uiitems.hxx>
-#include <usrpref.hxx>
-#include <tabsh.hxx>
-#include "swtablerep.hxx"
-#include <tablemgr.hxx>
-#include <cellatr.hxx>
-#include <frmfmt.hxx>
-#include <swundo.hxx>
-#include <swtable.hxx>
-#include <docsh.hxx>
-#include <tblsel.hxx>
-
-#include <dialog.hrc>
-#include <popup.hrc>
-#include <shells.hrc>
-#include <cmdid.h>
-#include <globals.hrc>
-#include <helpid.h>
-#include <unobaseclass.hxx>
-
-#define SwTableShell
-#include <sfx2/msg.hxx>
-#include <swslots.hxx>
-
-#include "swabstdlg.hxx"
-#include <table.hrc>
-
-#include <boost/scoped_ptr.hpp>
-
-using ::editeng::SvxBorderLine;
-using namespace ::com::sun::star;
-
-SFX_IMPL_INTERFACE(SwTableShell, SwBaseShell, SW_RES(STR_SHELLNAME_TABLE))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TAB_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TABLE_TOOLBOX));
-}
-
-TYPEINIT1(SwTableShell,SwBaseShell)
-
-const sal_uInt16 aUITableAttrRange[] =
-{
- FN_PARAM_TABLE_NAME, FN_PARAM_TABLE_NAME,
- FN_PARAM_TABLE_HEADLINE, FN_PARAM_TABLE_HEADLINE,
- FN_PARAM_TABLE_SPACE, FN_PARAM_TABLE_SPACE,
- FN_TABLE_REP, FN_TABLE_REP,
- SID_RULER_BORDERS, SID_RULER_BORDERS,
- RES_LR_SPACE, RES_UL_SPACE,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_SHADOW,
- RES_BOX, RES_SHADOW,
- RES_BACKGROUND, RES_BACKGROUND,
- SID_BACKGRND_DESTINATION, SID_BACKGRND_DESTINATION,
- SID_HTML_MODE, SID_HTML_MODE,
- SID_ATTR_BRUSH_ROW, SID_ATTR_BRUSH_TABLE,
- RES_PAGEDESC, RES_BREAK,
- RES_KEEP, RES_KEEP,
- RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT,
- FN_TABLE_SET_VERT_ALIGN, FN_TABLE_SET_VERT_ALIGN,
- RES_FRAMEDIR, RES_FRAMEDIR,
- RES_ROW_SPLIT, RES_ROW_SPLIT,
- FN_TABLE_BOX_TEXTORIENTATION, FN_TABLE_BOX_TEXTORIENTATION,
-// #i29550#
- RES_COLLAPSING_BORDERS, RES_COLLAPSING_BORDERS,
-// <-- collapsing borders
- 0
-};
-
-const sal_uInt16* SwuiGetUITableAttrRange()
-{
- return aUITableAttrRange;
-}
-
-static void lcl_SetAttr( SwWrtShell &rSh, const SfxPoolItem &rItem )
-{
- SfxItemSet aSet( rSh.GetView().GetPool(), rItem.Which(), rItem.Which(), 0);
- aSet.Put( rItem );
- rSh.SetTblAttr( aSet );
-}
-
-static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh )
-{
- SwFrmFmt *pFmt = rSh.GetTableFmt();
- SwTabCols aCols;
- rSh.GetTabCols( aCols );
-
- //At first get the simple attributes.
- rSet.Put( SfxStringItem( FN_PARAM_TABLE_NAME, pFmt->GetName()));
- rSet.Put( SfxUInt16Item( FN_PARAM_TABLE_HEADLINE, rSh.GetRowsToRepeat() ) );
- rSet.Put( pFmt->GetShadow() );
- rSet.Put(SfxUInt16Item(FN_TABLE_SET_VERT_ALIGN, rSh.GetBoxAlign()));
- rSet.Put( pFmt->GetFrmDir() );
-
- SvxULSpaceItem aULSpace( pFmt->GetULSpace() );
- rSet.Put( aULSpace );
-
- sal_uInt16 nBackgroundDestination = rSh.GetViewOptions()->GetTblDest();
- rSet.Put(SwBackgroundDestinationItem(SID_BACKGRND_DESTINATION, nBackgroundDestination ));
- SvxBrushItem aBrush( RES_BACKGROUND );
- if(rSh.GetRowBackground(aBrush))
- rSet.Put( aBrush, SID_ATTR_BRUSH_ROW );
- else
- rSet.InvalidateItem(SID_ATTR_BRUSH_ROW);
- rSh.GetTabBackground(aBrush);
- rSet.Put( aBrush, SID_ATTR_BRUSH_TABLE );
-
- // text direction in boxes
- SvxFrameDirectionItem aBoxDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
- if(rSh.GetBoxDirection( aBoxDirection ))
- rSet.Put(aBoxDirection, FN_TABLE_BOX_TEXTORIENTATION);
-
- sal_Bool bTableSel = rSh.IsTableMode();
- if(!bTableSel)
- {
- rSh.StartAllAction();
- rSh.Push();
- rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_TABLE_SELECT_ALL, sal_False );
- }
- SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
-
- // Table variant: If multiple table cells are selected.
- rSh.GetCrsr(); //Thus GetCrsrCnt() returns the right thing
- aBoxInfo.SetTable ((rSh.IsTableMode() && rSh.GetCrsrCnt() > 1) ||
- !bTableSel);
- // Always show distance field.
- aBoxInfo.SetDist (true);
- // Set minimum size in tables and paragraphs.
- aBoxInfo.SetMinDist( !bTableSel || rSh.IsTableMode() ||
- rSh.GetSelectionType() &
- (nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL));
- // Always set the default spacing.
- aBoxInfo.SetDefDist (MIN_BORDER_DIST);
- // Individual lines can have DontCare status only in tables.
- aBoxInfo.SetValid( VALID_DISABLE, !bTableSel || !rSh.IsTableMode() );
-
- rSet.Put(aBoxInfo);
- rSh.GetTabBorders( rSet );
-
- //row split
- SwFmtRowSplit* pSplit = 0;
- rSh.GetRowSplit(pSplit);
- if(pSplit)
- {
- rSet.Put(*pSplit);
- delete pSplit;
- }
-
- if(!bTableSel)
- {
- rSh.ClearMark();
- rSh.Pop(sal_False);
- rSh.EndAllAction();
- }
-
- SwTabCols aTabCols;
- rSh.GetTabCols( aTabCols );
- SvxColumnItem aColItem;
-
- // Pointer will be deleted after the dialogue execution.
- SwTableRep* pRep = new SwTableRep( aTabCols );
- pRep->SetSpace(aCols.GetRightMax());
-
- sal_uInt16 nPercent = 0;
- long nWidth = ::GetTableWidth(pFmt, aCols, &nPercent, &rSh );
- // The table width is wrong for relative values.
- if(nPercent)
- nWidth = pRep->GetSpace() * nPercent / 100;
- sal_uInt16 nAlign = pFmt->GetHoriOrient().GetHoriOrient();
- pRep->SetAlign(nAlign);
- SvxLRSpaceItem aLRSpace( pFmt->GetLRSpace() );
- SwTwips nLeft = aLRSpace.GetLeft();
- SwTwips nRight = aLRSpace.GetRight();
- SwTwips nDiff = pRep->GetSpace() - nRight - nLeft - nWidth;
- if(nAlign != text::HoriOrientation::FULL && std::abs(nDiff) > 2)
- {
- SwTwips nLR = pRep->GetSpace() - nWidth;
- switch ( nAlign )
- {
- case text::HoriOrientation::CENTER: nLeft = nRight = nLR / 2;
- break;
- case text::HoriOrientation::LEFT: nRight = nLR; nLeft = 0;
- break;
- case text::HoriOrientation::RIGHT: nLeft = nLR, nRight = 0;
- break;
- case text::HoriOrientation::LEFT_AND_WIDTH:
- nRight = nLR - nLeft;
- break;
- case text::HoriOrientation::NONE:
- if(!nPercent)
- nWidth = pRep->GetSpace() - nLeft - nRight;
- break;
- }
- }
- pRep->SetLeftSpace(nLeft);
- pRep->SetRightSpace(nRight);
-
- pRep->SetWidth(nWidth);
- pRep->SetWidthPercent(nPercent);
- // Are individual rows / cells are selected, the column processing will be changed.
- pRep->SetLineSelected(bTableSel && ! rSh.HasWholeTabSelection());
- rSet.Put(SwPtrItem(FN_TABLE_REP, pRep));
- return pRep;
-}
-
-void ItemSetToTableParam( const SfxItemSet& rSet,
- SwWrtShell &rSh )
-{
- rSh.StartAllAction();
- rSh.StartUndo( UNDO_TABLE_ATTR );
- const SfxPoolItem* pItem = 0;
-
- SwViewOption aUsrPref( *rSh.GetViewOptions() );
- sal_uInt16 nBackgroundDestination = aUsrPref.GetTblDest();
- if(SFX_ITEM_SET == rSet.GetItemState(SID_BACKGRND_DESTINATION, false, &pItem))
- {
- nBackgroundDestination = ((SfxUInt16Item*)pItem)->GetValue();
- aUsrPref.SetTblDest((sal_uInt8)nBackgroundDestination);
- SW_MOD()->ApplyUsrPref(aUsrPref, &rSh.GetView());
- }
- bool bBorder = ( SFX_ITEM_SET == rSet.GetItemState( RES_BOX ) ||
- SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER ) );
- pItem = 0;
- bool bBackground = SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, false, &pItem );
- const SfxPoolItem* pRowItem = 0, *pTableItem = 0;
- bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_ROW, false, &pRowItem );
- bBackground |= SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BRUSH_TABLE, false, &pTableItem );
- const SfxPoolItem* pSplit = 0;
- bool bRowSplit = SFX_ITEM_SET == rSet.GetItemState( RES_ROW_SPLIT, false, &pSplit );
- const SfxPoolItem* pBoxDirection = 0;
- bool bBoxDirection = SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_BOX_TEXTORIENTATION, false, &pBoxDirection );
- if( bBackground || bBorder || bRowSplit || bBoxDirection)
- {
- // The border will be applied to the present selection.
- // If there is no selection, the table will be completely selected.
- // The background will always be applied to the current state.
- sal_Bool bTableSel = rSh.IsTableMode();
- rSh.StartAllAction();
-
- if(bBackground)
- {
- if(pItem)
- rSh.SetBoxBackground( *(const SvxBrushItem*)pItem );
- if(pRowItem)
- {
- SvxBrushItem aBrush(*(const SvxBrushItem*)pRowItem);
- aBrush.SetWhich(RES_BACKGROUND);
- rSh.SetRowBackground(aBrush);
- }
- if(pTableItem)
- {
- SvxBrushItem aBrush(*(const SvxBrushItem*)pTableItem);
- aBrush.SetWhich(RES_BACKGROUND);
- rSh.SetTabBackground( aBrush );
- }
- }
-
- if(bBoxDirection)
- {
- SvxFrameDirectionItem aDirection( FRMDIR_ENVIRONMENT, RES_FRAMEDIR );
- aDirection.SetValue(static_cast< const SvxFrameDirectionItem* >(pBoxDirection)->GetValue());
- rSh.SetBoxDirection(aDirection);
- }
-
- if(bBorder || bRowSplit)
- {
- rSh.Push();
- if(!bTableSel)
- {
- rSh.GetView().GetViewFrame()->GetDispatcher()->Execute( FN_TABLE_SELECT_ALL );
- }
- if(bBorder)
- rSh.SetTabBorders( rSet );
-
- if(bRowSplit)
- {
- rSh.SetRowSplit(*static_cast<const SwFmtRowSplit*>(pSplit));
- }
-
- if(!bTableSel)
- {
- rSh.ClearMark();
- }
- rSh.Pop(sal_False);
- }
-
- rSh.EndAllAction();
- }
-
- SwTabCols aTabCols;
- bool bTabCols = false;
- sal_Bool bSingleLine = sal_False;
- SwTableRep* pRep = 0;
- SwFrmFmt *pFmt = rSh.GetTableFmt();
- SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
- if(SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_REP, false, &pItem ))
- {
- pRep = (SwTableRep*)((const SwPtrItem*)pItem)->GetValue();
-
- const SwTwips nWidth = pRep->GetWidth();
- if ( text::HoriOrientation::FULL == pRep->GetAlign() )
- {
- SwFmtHoriOrient aAttr( pFmt->GetHoriOrient() );
- aAttr.SetHoriOrient( text::HoriOrientation::FULL );
- aSet.Put( aAttr );
- }
- else
- {
- SwFmtFrmSize aSz( ATT_VAR_SIZE, nWidth );
- if(pRep->GetWidthPercent())
- {
- aSz.SetWidthPercent( (sal_uInt8)pRep->GetWidthPercent() );
- }
- aSet.Put(aSz);
- }
-
- SvxLRSpaceItem aLRSpace( RES_LR_SPACE );
- aLRSpace.SetLeft(pRep->GetLeftSpace());
- aLRSpace.SetRight(pRep->GetRightSpace());
- aSet.Put( aLRSpace );
-
- sal_Int16 eOrient = pRep->GetAlign();
- SwFmtHoriOrient aAttr( 0, eOrient );
- aSet.Put( aAttr );
- // The item must only be recorded while manual alignment, so that the
- // alignment is not overwritten by the distances while recording.
- if(eOrient != text::HoriOrientation::NONE)
- ((SfxItemSet&)rSet).ClearItem( SID_ATTR_LRSPACE );
-
- if(pRep->HasColsChanged())
- {
- bTabCols = true;
- }
- }
-
- if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem))
- rSh.SetRowsToRepeat( ((SfxUInt16Item*)pItem)->GetValue() );
-
- if( SFX_ITEM_SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, false, &pItem))
- rSh.SetBoxAlign(((SfxUInt16Item*)(pItem))->GetValue());
-
- if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, false, &pItem ))
- rSh.SetTableName( *pFmt, ((const SfxStringItem*)pItem)->GetValue() );
-
- // Copy the chosen attributes in the ItemSet.
- static const sal_uInt16 aIds[] =
- {
- RES_PAGEDESC,
- RES_BREAK,
- RES_KEEP,
- RES_LAYOUT_SPLIT,
- RES_UL_SPACE,
- RES_SHADOW,
- RES_FRAMEDIR,
- // #i29550#
- RES_COLLAPSING_BORDERS,
- // <-- collapsing borders
- 0
- };
- for( const sal_uInt16* pIds = aIds; *pIds; ++pIds )
- if( SFX_ITEM_SET == rSet.GetItemState( *pIds, false, &pItem))
- aSet.Put( *pItem );
-
- if( aSet.Count() )
- rSh.SetTblAttr( aSet );
-
- if(bTabCols)
- {
- rSh.GetTabCols( aTabCols );
- bSingleLine = pRep->FillTabCols( aTabCols );
- rSh.SetTabCols( aTabCols, bSingleLine );
- }
-
- rSh.EndUndo( UNDO_TABLE_ATTR );
- rSh.EndAllAction();
-}
-
-static void lcl_TabGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLine& rBorderLine)
-{
- if(pBorderLine->GetWidth() > rBorderLine.GetWidth())
- rBorderLine.SetWidth(pBorderLine->GetWidth());
-
- rBorderLine.SetBorderLineStyle(pBorderLine->GetBorderLineStyle());
- rBorderLine.SetColor(pBorderLine->GetColor());
-}
-
-void SwTableShell::Execute(SfxRequest &rReq)
-{
- const SfxItemSet* pArgs = rReq.GetArgs();
- SwWrtShell &rSh = GetShell();
-
- // At first the slots which doesn't need a FrmMgr.
- bool bMore = false;
- const SfxPoolItem* pItem = 0;
- sal_uInt16 nSlot = rReq.GetSlot();
- if(pArgs)
- pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
- bool bCallDone = false;
- switch ( nSlot )
- {
- case SID_ATTR_BORDER:
- {
- if(!pArgs)
- break;
- // Create items, because we have to rework anyway.
- SvxBoxItem aBox( RES_BOX );
- SfxItemSet aCoreSet( GetPool(),
- RES_BOX, RES_BOX,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- 0);
- SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
- aCoreSet.Put(aCoreInfo);
- rSh.GetTabBorders( aCoreSet );
- const SvxBoxItem& rCoreBox = (const SvxBoxItem&)
- aCoreSet.Get(RES_BOX);
- const SfxPoolItem *pBoxItem = 0;
- if ( pArgs->GetItemState(RES_BOX, true, &pBoxItem) == SFX_ITEM_SET )
- {
- aBox = *(SvxBoxItem*)pBoxItem;
- if ( !rReq.IsAPI() )
- aBox.SetDistance( std::max(rCoreBox.GetDistance(),sal_uInt16(55)) );
- else if ( aBox.GetDistance() < MIN_BORDER_DIST )
- aBox.SetDistance( std::max(rCoreBox.GetDistance(),(sal_uInt16)MIN_BORDER_DIST) );
- }
- else
- OSL_ENSURE( !this, "where is BoxItem?" );
-
- //since the drawing layer also supports borders the which id might be a different one
- SvxBoxInfoItem aInfo( SID_ATTR_BORDER_INNER );
- if (pArgs->GetItemState(SID_ATTR_BORDER_INNER, true, &pBoxItem) == SFX_ITEM_SET)
- aInfo = *(SvxBoxInfoItem*)pBoxItem;
- else if( pArgs->GetItemState(SDRATTR_TABLE_BORDER_INNER, true, &pBoxItem) == SFX_ITEM_SET )
- {
- aInfo = *(SvxBoxInfoItem*)pBoxItem;
- aInfo.SetWhich(SID_ATTR_BORDER_INNER);
- }
-
- aInfo.SetTable( true );
- aInfo.SetValid( VALID_DISABLE, false );
-
-// The attributes of all lines will be read and the strongest wins.
- const SvxBorderLine* pBorderLine;
- SvxBorderLine aBorderLine;
- if ((pBorderLine = rCoreBox.GetTop()) != NULL)
- lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = rCoreBox.GetBottom()) != NULL)
- lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = rCoreBox.GetLeft()) != NULL)
- lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = rCoreBox.GetRight()) != NULL)
- lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = aCoreInfo.GetHori()) != NULL)
- lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
- if ((pBorderLine = aCoreInfo.GetVert()) != NULL)
- lcl_TabGetMaxLineWidth(pBorderLine, aBorderLine);
-
- if(aBorderLine.GetOutWidth() == 0)
- {
- aBorderLine.SetBorderLineStyle(table::BorderLineStyle::SOLID);
- aBorderLine.SetWidth( DEF_LINE_WIDTH_0 );
- }
-
- sal_Bool bLine = sal_False;
- if( aBox.GetTop() != NULL )
- aBox.SetLine(&aBorderLine, BOX_LINE_TOP), bLine |= sal_True;
- if( aBox.GetBottom() != NULL )
- aBox.SetLine(&aBorderLine, BOX_LINE_BOTTOM), bLine |= sal_True;
- if( aBox.GetLeft() != NULL )
- aBox.SetLine(&aBorderLine, BOX_LINE_LEFT), bLine |= sal_True;
- if( aBox.GetRight() != NULL )
- aBox.SetLine(&aBorderLine, BOX_LINE_RIGHT), bLine |= sal_True;
- if( aInfo.GetHori() != NULL )
- aInfo.SetLine(&aBorderLine, BOXINFO_LINE_HORI), bLine |= sal_True;
- if( aInfo.GetVert() != NULL )
- aInfo.SetLine(&aBorderLine, BOXINFO_LINE_VERT), bLine |= sal_True;
-
- aCoreSet.Put( aBox );
- aCoreSet.Put( aInfo );
- rSh.SetTabBorders( aCoreSet );
-
- // we must record the "real" values because otherwise the lines can't be reconstructed on playtime
- // the coding style of the controller (setting lines with width 0) is not transportable via Query/PutValue in
- // the SvxBoxItem
- rReq.AppendItem( aBox );
- rReq.AppendItem( aInfo );
- bCallDone = true;
-
- }
- break;
- case FN_INSERT_TABLE:
- InsertTable( rReq );
- break;
- case FN_FORMAT_TABLE_DLG:
- {
- //#127012# get the bindings before the dialog is called
- // it might happen that this shell is removed after closing the dialog
- SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
- SfxItemSet aCoreSet( GetPool(), aUITableAttrRange);
-
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rSh.GetView()));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
- SwTableRep* pTblRep = ::lcl_TableParamToItemSet( aCoreSet, rSh );
- SfxAbstractTabDialog * pDlg = NULL;
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- pDlg = pFact->CreateSwTableTabDlg(GetView().GetWindow(), GetPool(), &aCoreSet, &rSh);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
-
- if (pItem)
- pDlg->SetCurPageId(OUStringToOString(((SfxStringItem *)pItem)->GetValue(), RTL_TEXTENCODING_UTF8));
- }
- aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
- rSh.GetTblAttr(aCoreSet);
- // GetTblAttr overwrites the background!
- SvxBrushItem aBrush( RES_BACKGROUND );
- if(rSh.GetBoxBackground(aBrush))
- aCoreSet.Put( aBrush );
- else
- aCoreSet.InvalidateItem( RES_BACKGROUND );
-
- if ( (!pDlg && rReq.GetArgs()) || pDlg->Execute() == RET_OK )
- {
- const SfxItemSet* pOutSet = pDlg ? pDlg->GetOutputItemSet() : rReq.GetArgs();
- if ( pDlg )
- {
- //to record FN_INSERT_TABLE correctly
- rReq.SetSlot(FN_FORMAT_TABLE_DLG);
- rReq.Done( *pOutSet );
- }
- ItemSetToTableParam( *pOutSet, rSh );
- }
-
- delete pDlg;
- delete pTblRep;
- rBindings.Update(SID_RULER_BORDERS);
- rBindings.Update(SID_ATTR_TABSTOP);
- rBindings.Update(SID_RULER_BORDERS_VERTICAL);
- rBindings.Update(SID_ATTR_TABSTOP_VERTICAL);
- }
- break;
- case SID_ATTR_BRUSH:
- case SID_ATTR_BRUSH_ROW :
- case SID_ATTR_BRUSH_TABLE :
- if(rReq.GetArgs())
- ItemSetToTableParam(*rReq.GetArgs(), rSh);
- break;
- case FN_NUM_FORMAT_TABLE_DLG:
- {
- SwView* pView = GetActiveView();
- if(pView)
- {
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, pView));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
- SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
- SfxItemSet aCoreSet( GetPool(),
- SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE,
- SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
- 0 );
-
- SfxItemSet aBoxSet( *aCoreSet.GetPool(),
- RES_BOXATR_FORMAT, RES_BOXATR_FORMAT,
- RES_BOXATR_VALUE, RES_BOXATR_VALUE,
- 0 );
- rSh.GetTblBoxFormulaAttrs( aBoxSet );
-
- SfxItemState eState = aBoxSet.GetItemState(RES_BOXATR_FORMAT);
- if(eState == SFX_ITEM_DEFAULT)
- {
- aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
- pFormatter->GetFormatIndex(NF_TEXT, LANGUAGE_SYSTEM)));
- }
- else
- aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
- ((SwTblBoxNumFormat&)aBoxSet.Get(
- RES_BOXATR_FORMAT )).GetValue() ));
-
- OUString sCurText( rSh.GetTableBoxText() );
- aCoreSet.Put( SvxNumberInfoItem( pFormatter,
- ((SwTblBoxValue&)aBoxSet.Get(
- RES_BOXATR_VALUE)).GetValue(),
- sCurText, SID_ATTR_NUMBERFORMAT_INFO ));
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(),aCoreSet,
- pView->GetViewFrame()->GetFrame().GetFrameInterface(),
- RC_DLG_SWNUMFMTDLG );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
-
- if (RET_OK == pDlg->Execute())
- {
- const SfxPoolItem* pNumberFormatItem = GetView().GetDocShell()->
- GetItem( SID_ATTR_NUMBERFORMAT_INFO );
-
- if( pNumberFormatItem && 0 != ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount() )
- {
- const sal_uInt32* pDelArr = ((SvxNumberInfoItem*)
- pNumberFormatItem)->GetDelArray();
-
- for ( sal_uInt16 i = 0; i < ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount(); i++ )
- ((SvxNumberInfoItem*)pNumberFormatItem)->
- GetNumberFormatter()->DeleteEntry( pDelArr[i] );
- }
-
- if( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState(
- SID_ATTR_NUMBERFORMAT_VALUE, false, &pNumberFormatItem ))
- {
- SfxItemSet aBoxFormatSet( *aCoreSet.GetPool(),
- RES_BOXATR_FORMAT, RES_BOXATR_FORMAT );
- aBoxFormatSet.Put( SwTblBoxNumFormat(
- ((SfxUInt32Item*)pNumberFormatItem)->GetValue() ));
- rSh.SetTblBoxFormulaAttrs( aBoxFormatSet );
-
- }
- }
- delete pDlg;
- }
- }
- break;
- case FN_CALC_TABLE:
- rSh.UpdateTable();
- bCallDone = true;
- break;
- case FN_TABLE_OPTIMAL_HEIGHT:
- {
- const SwFmtFrmSize aSz;
- rSh.SetRowHeight( aSz );
- bCallDone = true;
- }
- break;
- case FN_TABLE_DELETE_COL:
- if ( rSh.DeleteCol() && rSh.HasSelection() )
- rSh.EnterStdMode();
- bCallDone = true;
- break;
- case FN_END_TABLE:
- rSh.MoveTable( fnTableCurr, fnTableEnd );
- bCallDone = true;
- break;
- case FN_START_TABLE:
- rSh.MoveTable( fnTableCurr, fnTableStart );
- bCallDone = true;
- break;
- case FN_GOTO_NEXT_CELL:
- {
- sal_Bool bAppendLine = sal_True;
- if( pItem )
- bAppendLine = ((SfxBoolItem*)pItem)->GetValue();
- rReq.SetReturnValue( SfxBoolItem( nSlot,
- rSh.GoNextCell( bAppendLine ) ) );
- bCallDone = true;
- }
- break;
- case FN_GOTO_PREV_CELL:
- rReq.SetReturnValue( SfxBoolItem( nSlot, rSh.GoPrevCell() ) );
- bCallDone = true;
- break;
- case FN_TABLE_DELETE_ROW:
- if ( rSh.DeleteRow() && rSh.HasSelection() )
- rSh.EnterStdMode();
- bCallDone = true;
- break;
- case FN_TABLE_MERGE_CELLS:
- if ( rSh.IsTableMode() )
- switch ( rSh.MergeTab() )
- {
- case TBLMERGE_OK:
- bCallDone = true;
- //no break;
- case TBLMERGE_NOSELECTION: break;
- case TBLMERGE_TOOCOMPLEX:
- {
- InfoBox aInfoBox( GetView().GetWindow(),
- SW_RES( MSG_ERR_TABLE_MERGE ) );
- aInfoBox.Execute();
- break;
- }
- default: OSL_ENSURE( !this, "unknown return value MergeTab.");
- }
- break;
- case FN_TABLE_ADJUST_CELLS:
- case FN_TABLE_BALANCE_CELLS:
- {
- sal_Bool bBalance = (FN_TABLE_BALANCE_CELLS == nSlot);
- if ( rSh.IsAdjustCellWidthAllowed(bBalance) )
- {
- {
- // remove actions to make a valid table selection
- UnoActionRemoveContext aRemoveContext(rSh.GetDoc());
- }
- rSh.AdjustCellWidth(bBalance);
- }
- bCallDone = true;
- }
- break;
- case FN_TABLE_BALANCE_ROWS:
- if ( rSh.BalanceRowHeight(sal_True) )
- rSh.BalanceRowHeight(sal_False);
- bCallDone = true;
- break;
- case FN_TABLE_SELECT_ALL:
- rSh.EnterStdMode();
- rSh.MoveTable( fnTableCurr, fnTableStart );
- rSh.SttSelect();
- rSh.MoveTable( fnTableCurr, fnTableEnd );
- rSh.EndSelect();
- bCallDone = true;
- break;
- case FN_TABLE_SELECT_COL:
- rSh.EnterStdMode();
- rSh.SelectTableCol();
- bCallDone = true;
- break;
- case FN_TABLE_SELECT_ROW:
- rSh.EnterStdMode();
- rSh.SelectTableRow();
- bCallDone = true;
- break;
- case FN_TABLE_SET_READ_ONLY_CELLS:
- rSh.ProtectCells();
- rSh.ResetSelect( 0, sal_False );
- bCallDone = true;
- break;
- case FN_TABLE_UNSET_READ_ONLY_CELLS:
- rSh.UnProtectCells();
- bCallDone = true;
- break;
- case SID_AUTOFORMAT:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- AbstractSwAutoFormatDlg* pDlg = pFact->CreateSwAutoFormatDlg(&GetView().GetViewFrame()->GetWindow(), &rSh);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- }
- break;
- case FN_TABLE_SET_ROW_HEIGHT:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rSh, DLG_ROW_HEIGHT );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- }
- break;
- case FN_NUMBER_BULLETS:
- case FN_NUM_BULLET_ON:
- OSL_ENSURE( !this, "function may not be called now." );
- break;
-
- case FN_TABLE_INSERT_COL:
- case FN_TABLE_INSERT_ROW:
- {
- bool bColumn = rReq.GetSlot() == FN_TABLE_INSERT_COL;
- sal_uInt16 nCount = 0;
- sal_Bool bAfter = sal_True;
- if (pItem)
- {
- nCount = ((const SfxInt16Item* )pItem)->GetValue();
- if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_INSERT_AFTER, true, &pItem))
- bAfter = ((const SfxBoolItem* )pItem)->GetValue();
- }
- else if( !rReq.IsAPI() )
- ++nCount;
-
- if( nCount )
- {
- // i74180: Table border patch submitted by chensuchun:
- // -->get the SvxBoxInfoItem of the table before insert
- SfxItemSet aCoreSet( GetPool(), aUITableAttrRange);
- ::lcl_TableParamToItemSet( aCoreSet, rSh );
- bool bSetInnerBorders = false;
- SwUndoId nUndoId = UNDO_EMPTY;
- // <--End
-
- if( bColumn )
- {
- rSh.StartUndo( UNDO_TABLE_INSCOL );
- rSh.InsertCol( nCount, bAfter );
- bSetInnerBorders = true;
- nUndoId = UNDO_TABLE_INSCOL;
- }
- else if ( !rSh.IsInRepeatedHeadline() )
- {
- rSh.StartUndo( UNDO_TABLE_INSROW );
- rSh.InsertRow( nCount, bAfter );
- bSetInnerBorders = true;
- nUndoId = UNDO_TABLE_INSROW;
- }
-
- // -->after inserting,reset the inner table borders
- if ( bSetInnerBorders )
- {
- const SvxBoxInfoItem aBoxInfo((const SvxBoxInfoItem&)
- aCoreSet.Get(SID_ATTR_BORDER_INNER));
- SfxItemSet aSet( GetPool(), SID_ATTR_BORDER_INNER,
- SID_ATTR_BORDER_INNER, 0);
- aSet.Put( aBoxInfo );
- ItemSetToTableParam( aSet, rSh );
- rSh.EndUndo( nUndoId );
- }
-
- bCallDone = true;
- break;
- }
-
- nSlot = bColumn ? FN_TABLE_INSERT_COL_DLG : FN_TABLE_INSERT_ROW_DLG;
- }
- // No break; on Count = 0 appears the dialog
- case FN_TABLE_INSERT_COL_DLG:
- case FN_TABLE_INSERT_ROW_DLG:
- {
- const SfxSlot* pSlot = GetStaticInterface()->GetSlot(nSlot);
- if ( FN_TABLE_INSERT_ROW_DLG != nSlot || !rSh.IsInRepeatedHeadline())
- {
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- boost::scoped_ptr<SvxAbstractInsRowColDlg> pDlg( pFact ? pFact->CreateSvxInsRowColDlg( GetView().GetWindow(), nSlot == FN_TABLE_INSERT_COL_DLG, pSlot->GetCommand() ) : 0);
-
- if( pDlg.get() && (pDlg->Execute() == 1) )
- {
- sal_uInt16 nDispatchSlot = (nSlot == FN_TABLE_INSERT_COL_DLG) ? FN_TABLE_INSERT_COL : FN_TABLE_INSERT_ROW;
- SfxUInt16Item aCountItem( nDispatchSlot, static_cast< sal_uInt16 >(pDlg->getInsertCount()) );
- SfxBoolItem aAfter( FN_PARAM_INSERT_AFTER, !pDlg->isInsertBefore() );
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if( pVFrame )
- pVFrame->GetDispatcher()->Execute( nDispatchSlot, SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD, &aCountItem, &aAfter, 0L);
- }
- }
- }
- break;
- case FN_TABLE_SPLIT_CELLS:
- {
- long nCount=0;
- sal_Bool bHorizontal=sal_True;
- sal_Bool bProportional = sal_False;
- SFX_REQUEST_ARG( rReq, pSplit, SfxInt32Item, FN_TABLE_SPLIT_CELLS, false );
- SFX_REQUEST_ARG( rReq, pHor, SfxBoolItem, FN_PARAM_1, false );
- SFX_REQUEST_ARG( rReq, pProp, SfxBoolItem, FN_PARAM_2, false );
- if ( pSplit )
- {
- nCount = pSplit->GetValue();
- if ( pHor )
- bHorizontal = pHor->GetValue();
- if ( pProp )
- bProportional = pProp->GetValue();
- }
- else
- {
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- if( pFact )
- {
- const long nMaxVert = rSh.GetAnyCurRect( RECT_FRM ).Width() / MINLAY;
- SvxAbstractSplittTableDialog* pDlg = pFact->CreateSvxSplittTableDialog( GetView().GetWindow(), rSh.IsTableVertical(), nMaxVert, 99 );
- if( pDlg && (pDlg->Execute() == RET_OK) )
- {
- nCount = pDlg->GetCount();
- bHorizontal = pDlg->IsHorizontal();
- bProportional = pDlg->IsProportional();
- rReq.AppendItem( SfxInt32Item( FN_TABLE_SPLIT_CELLS, nCount ) );
- rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bHorizontal ) );
- rReq.AppendItem( SfxBoolItem( FN_PARAM_2, bProportional ) );
- }
- delete pDlg;
- }
- }
-
- if ( nCount>1 )
- {
- rSh.SplitTab(!bHorizontal, static_cast< sal_uInt16 >( nCount-1 ), bProportional );
- bCallDone = true;
- }
- else
- rReq.Ignore();
- }
- break;
-
- case FN_TABLE_SPLIT_TABLE:
- {
- SFX_REQUEST_ARG( rReq, pType, SfxUInt16Item, FN_PARAM_1, false );
- if( pType )
- {
- switch( pType->GetValue() )
- {
- case HEADLINE_NONE :
- case HEADLINE_BORDERCOPY:
- case HEADLINE_CNTNTCOPY:
- case HEADLINE_BOXATTRCOPY:
- case HEADLINE_BOXATRCOLLCOPY:
- rSh.SplitTable(pType->GetValue()) ;
- default: ;//wrong parameter, do nothing
- }
- }
- else
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- AbstractSplitTableDialog* pDlg = pFact->CreateSplitTblDialog( GetView().GetWindow(), rSh );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, pDlg->GetSplitMode() ) );
- delete pDlg;
- bCallDone = true;
- }
- }
- break;
-
- case FN_TABLE_MERGE_TABLE:
- {
- sal_Bool bPrev = rSh.CanMergeTable( sal_True );
- sal_Bool bNext = rSh.CanMergeTable( sal_False );
-
- if( bPrev && bNext )
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
- VclAbstractDialog* pDlg = pFact->CreateTblMergeDialog(GetView().GetWindow(), bPrev);
- OSL_ENSURE(pDlg, "dialogdiet pDlg fail!");
- if( RET_OK != pDlg->Execute())
- bPrev = bNext = sal_False;
- delete pDlg;
- }
-
- if( bPrev || bNext )
- rSh.MergeTable( bPrev );
- }
- break;
-
- case FN_TABLE_MODE_FIX :
- case FN_TABLE_MODE_FIX_PROP :
- case FN_TABLE_MODE_VARIABLE :
- {
- rSh.SetTblChgMode( ( FN_TABLE_MODE_FIX == nSlot ? TBLFIX_CHGABS
- : FN_TABLE_MODE_FIX_PROP == nSlot
- ? TBLFIX_CHGPROP
- : TBLVAR_CHGABS ) );
-
- SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
- static sal_uInt16 aInva[] =
- { FN_TABLE_MODE_FIX,
- FN_TABLE_MODE_FIX_PROP,
- FN_TABLE_MODE_VARIABLE,
- 0
- };
- rBind.Invalidate( aInva );
- bCallDone = true;
- }
- break;
- case FN_TABLE_AUTOSUM:
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- pVFrame->GetDispatcher()->Execute(FN_EDIT_FORMULA, SFX_CALLMODE_SYNCHRON);
- const sal_uInt16 nId = SwInputChild::GetChildWindowId();
- SwInputChild* pChildWin = (SwInputChild*)pVFrame->
- GetChildWindow( nId );
- OUString sSum;
- GetShell().GetAutoSum(sSum);
- if( pChildWin )
- pChildWin->SetFormula( sSum );
-
- }
- break;
- case FN_TABLE_HEADLINE_REPEAT:
- if(0 != rSh.GetRowsToRepeat())
- rSh.SetRowsToRepeat( 0 );
- else
- rSh.SetRowsToRepeat(rSh.GetRowSelectionFromTop());
- break;
- case FN_TABLE_SELECT_CELL :
- rSh.SelectTableCell();
- break;
- case FN_TABLE_DELETE_TABLE :
- {
- rSh.StartAction();
- rSh.StartUndo();
- rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_TABLE_SELECT_ALL);
- rSh.DeleteRow();
- rSh.EndUndo();
- rSh.EndAction();
- }
- //'this' is already destroyed
- return;
- //break;
- default:
- bMore = true;
- }
-
- if ( !bMore )
- {
- if(bCallDone)
- rReq.Done();
- return;
- }
- else
- bMore = false;
- // Now the slots which are working directly on the TableFmt.
- SwFrmFmt *pFmt = rSh.GetTableFmt();
- switch ( nSlot )
- {
- case SID_ATTR_ULSPACE:
- {
- if(pItem)
- {
- SvxULSpaceItem aULSpace( *(const SvxULSpaceItem*)pItem );
- aULSpace.SetWhich( RES_UL_SPACE );
- ::lcl_SetAttr( rSh, aULSpace );
- }
- }
- break;
-
- case SID_ATTR_LRSPACE:
- {
- if(pItem)
- {
- SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE,
- RES_HORI_ORIENT, RES_HORI_ORIENT, 0 );
- SvxLRSpaceItem aLRSpace( *(const SvxLRSpaceItem*)pItem );
- aLRSpace.SetWhich( RES_LR_SPACE );
- aSet.Put( aLRSpace );
- SwFmtHoriOrient aHori( pFmt->GetHoriOrient() );
- aHori.SetHoriOrient( text::HoriOrientation::NONE );
- aSet.Put( aLRSpace );
- rSh.SetTblAttr( aSet );
- }
- }
- break;
-// The last case branch which needs a table manager!!
- case FN_TABLE_SET_COL_WIDTH:
- {
- SwTableFUNC aMgr( &rSh, sal_False);
- aMgr.ColWidthDlg(GetView().GetWindow());
- }
- break;
- case SID_TABLE_VERT_NONE:
- case SID_TABLE_VERT_CENTER:
- case SID_TABLE_VERT_BOTTOM:
- {
- sal_uInt16 nAlign = nSlot == SID_TABLE_VERT_NONE ?
- text::VertOrientation::NONE :
- nSlot == SID_TABLE_VERT_CENTER ?
- text::VertOrientation::CENTER : text::VertOrientation::BOTTOM;
- rSh.SetBoxAlign(nAlign);
- bCallDone = true;
- }
- break;
-
- case SID_ATTR_PARA_SPLIT:
- if ( pItem )
- {
- SwFmtLayoutSplit aSplit( ((const SvxFmtSplitItem*)pItem)->GetValue());
- SfxItemSet aSet(GetPool(), RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT, 0 );
- aSet.Put(aSplit);
- rSh.SetTblAttr(aSet);
- }
- break;
-
- case SID_ATTR_PARA_KEEP:
- if ( pItem )
- {
- SvxFmtKeepItem aKeep( *(const SvxFmtKeepItem*)pItem );
- aKeep.SetWhich( RES_KEEP );
- SfxItemSet aSet(GetPool(), RES_KEEP, RES_KEEP, 0 );
- aSet.Put(aKeep);
- rSh.SetTblAttr(aSet);
- }
- break;
- case FN_TABLE_ROW_SPLIT :
- {
- const SfxBoolItem* pBool = static_cast<const SfxBoolItem*>(pItem);
- SwFmtRowSplit* pSplit = 0;
- if(!pBool)
- {
- rSh.GetRowSplit(pSplit);
- if(pSplit)
- pSplit->SetValue(!pSplit->GetValue());
- else
- pSplit = new SwFmtRowSplit(sal_True);
- }
- else
- {
- pSplit = new SwFmtRowSplit(pBool->GetValue());
- }
- rSh.SetRowSplit( *pSplit );
- delete pSplit;
- }
- break;
-
- default:
- OSL_ENSURE( !this, "wrong Dispatcher" );
- return;
- }
- if(bCallDone)
- rReq.Done();
-}
-
-void SwTableShell::GetState(SfxItemSet &rSet)
-{
- SfxWhichIter aIter( rSet );
- SwWrtShell &rSh = GetShell();
- SwFrmFmt *pFmt = rSh.GetTableFmt();
- // os #124829# crash report: in case of an invalid shell selection return immediately
- if(!pFmt)
- return;
- sal_uInt16 nSlot = aIter.FirstWhich();
- while ( nSlot )
- {
- switch ( nSlot )
- {
- case FN_TABLE_MERGE_CELLS:
- if ( !rSh.IsTableMode() )
- rSet.DisableItem(FN_TABLE_MERGE_CELLS);
- break;
- case FN_TABLE_ADJUST_CELLS:
- if ( !rSh.IsAdjustCellWidthAllowed() )
- rSet.DisableItem(FN_TABLE_ADJUST_CELLS);
- break;
-
- case FN_TABLE_BALANCE_CELLS:
- if ( !rSh.IsAdjustCellWidthAllowed(sal_True) )
- rSet.DisableItem(FN_TABLE_BALANCE_CELLS);
- break;
-
- case FN_TABLE_BALANCE_ROWS:
- if ( !rSh.BalanceRowHeight(sal_True) )
- rSet.DisableItem(FN_TABLE_BALANCE_ROWS);
- break;
- case FN_OPTIMIZE_TABLE:
- if ( !rSh.IsTableMode() &&
- !rSh.IsAdjustCellWidthAllowed() &&
- !rSh.IsAdjustCellWidthAllowed(sal_True) &&
- !rSh.BalanceRowHeight(sal_True) )
- rSet.DisableItem(FN_OPTIMIZE_TABLE);
- break;
- case SID_INSERT_DIAGRAM:
- {
- SvtModuleOptions aMOpt;
- if ( !aMOpt.IsMath() || rSh.IsTblComplexForChart() )
- rSet.DisableItem(nSlot);
- }
- break;
-
- case FN_INSERT_TABLE:
- if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nSlot );
- }
- break;
-
- case FN_TABLE_OPTIMAL_HEIGHT:
- {
- // Disable if auto height already is enabled.
- SwFmtFrmSize *pSz;
- rSh.GetRowHeight( pSz );
- if ( pSz )
- {
- if ( ATT_VAR_SIZE == pSz->GetHeightSizeType() )
- rSet.DisableItem( nSlot );
- delete pSz;
- }
- }
- break;
- case FN_TABLE_INSERT_ROW:
- case FN_TABLE_INSERT_ROW_DLG:
- {
- if ( rSh.IsInRepeatedHeadline() )
- rSet.DisableItem( nSlot );
- }
- break;
- case RES_LR_SPACE:
- rSet.Put(pFmt->GetLRSpace());
- break;
- case RES_UL_SPACE:
- rSet.Put(pFmt->GetULSpace());
- break;
-
- case SID_TABLE_VERT_NONE:
- case SID_TABLE_VERT_CENTER:
- case SID_TABLE_VERT_BOTTOM:
- {
- sal_uInt16 nAlign = rSh.GetBoxAlign();
- sal_Bool bSet = (nSlot == SID_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) ||
- (nSlot == SID_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) ||
- (nSlot == SID_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM);
- rSet.Put(SfxBoolItem(nSlot, bSet));
- }
- break;
-
- case FN_TABLE_MODE_FIX :
- case FN_TABLE_MODE_FIX_PROP :
- case FN_TABLE_MODE_VARIABLE :
- {
- TblChgMode nMode = rSh.GetTblChgMode();
- sal_Bool bSet = (nSlot == FN_TABLE_MODE_FIX && nMode == TBLFIX_CHGABS) ||
- (nSlot == FN_TABLE_MODE_FIX_PROP && nMode == TBLFIX_CHGPROP) ||
- (nSlot == FN_TABLE_MODE_VARIABLE && nMode == TBLVAR_CHGABS);
- rSet.Put(SfxBoolItem(nSlot, bSet));
- }
- break;
-
- case SID_ATTR_PARA_SPLIT:
- rSet.Put( pFmt->GetKeep() );
- break;
-
- case SID_ATTR_PARA_KEEP:
- rSet.Put( pFmt->GetLayoutSplit() );
- break;
- case FN_TABLE_SPLIT_TABLE:
- {
- if ( rSh.IsInHeadline() )
- rSet.DisableItem( nSlot );
- }
- break;
- case FN_TABLE_MERGE_TABLE:
- {
- sal_Bool bAsk;
- if( !rSh.CanMergeTable( sal_True, &bAsk ))
- rSet.DisableItem( nSlot );
- }
- break;
-
- case FN_TABLE_DELETE_ROW:
- {
- SwSelBoxes aBoxes;
- ::GetTblSel( rSh, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
- if( ::HasProtectedCells( aBoxes ))
- rSet.DisableItem( nSlot );
- }
- break;
- case FN_TABLE_DELETE_COL:
- {
- SwSelBoxes aBoxes;
- ::GetTblSel( rSh, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
- if( ::HasProtectedCells( aBoxes ))
- rSet.DisableItem( nSlot );
- }
- break;
-
- case FN_TABLE_UNSET_READ_ONLY_CELLS:
- // disable in readonly sections, but enable in protected cells
- if( !rSh.CanUnProtectCells() )
- rSet.DisableItem( nSlot );
- break;
- case RES_ROW_SPLIT:
- {
- const SwFmtLayoutSplit& rTabSplit = pFmt->GetLayoutSplit();
- if ( !rTabSplit.GetValue() )
- {
- rSet.DisableItem( nSlot );
- }
- else
- {
- SwFmtRowSplit* pSplit = 0;
- rSh.GetRowSplit(pSplit);
- if(pSplit)
- rSet.Put(*pSplit);
- else
- rSet.InvalidateItem( nSlot );
- delete pSplit;
- }
- }
- break;
- case FN_TABLE_HEADLINE_REPEAT:
- if(0 != rSh.GetRowsToRepeat())
- rSet.Put(SfxBoolItem(nSlot, true));
- else if(!rSh.GetRowSelectionFromTop())
- rSet.DisableItem( nSlot );
- else
- rSet.Put(SfxBoolItem(nSlot, false));
- break;
- case FN_TABLE_SELECT_CELL :
- if(rSh.HasBoxSelection())
- rSet.DisableItem( nSlot );
- break;
- }
- nSlot = aIter.NextWhich();
- }
-}
-
-SwTableShell::SwTableShell(SwView &_rView) :
- SwBaseShell(_rView)
-{
- SetName(OUString("Table"));
- SetHelpId(SW_TABSHELL);
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Table));
-}
-
-void SwTableShell::GetFrmBorderState(SfxItemSet &rSet)
-{
- SfxItemSet aCoreSet( GetPool(),
- RES_BOX, RES_BOX,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0 );
- SvxBoxInfoItem aBoxInfo( SID_ATTR_BORDER_INNER );
- aCoreSet.Put( aBoxInfo );
- GetShell().GetTabBorders( aCoreSet );
- rSet.Put( aCoreSet );
-}
-
-void SwTableShell::ExecTableStyle(SfxRequest& rReq)
-{
- SwWrtShell &rSh = GetShell();
- const SfxItemSet *pArgs = rReq.GetArgs();
- if(pArgs)
- switch ( rReq.GetSlot() )
- {
- case SID_FRAME_LINESTYLE:
- case SID_FRAME_LINECOLOR:
- {
- if ( rReq.GetSlot() == SID_FRAME_LINESTYLE )
- {
- const SvxLineItem &rLineItem = (const SvxLineItem&)pArgs->
- Get( SID_FRAME_LINESTYLE );
- const SvxBorderLine* pBorderLine = rLineItem.GetLine();
- rSh.SetTabLineStyle( 0, sal_True, pBorderLine);
- }
- else
- {
- const SvxColorItem &rNewColorItem = (const SvxColorItem&)pArgs->
- Get( SID_FRAME_LINECOLOR );
- rSh.SetTabLineStyle( &rNewColorItem.GetValue() );
- }
-
- rReq.Done();
-
- break;
- }
- }
-}
-
-void SwTableShell::GetLineStyleState(SfxItemSet &rSet)
-{
- SfxItemSet aCoreSet( GetPool(),
- RES_BOX, RES_BOX,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0);
- SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER );
- aCoreSet.Put(aCoreInfo);
- GetShell().GetTabBorders( aCoreSet );
-
- const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aCoreSet.Get( RES_BOX );
- const SvxBorderLine* pLine = rBoxItem.GetTop();
-
- rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) );
- SvxLineItem aLine( SID_FRAME_LINESTYLE );
- aLine.SetLine(pLine);
- rSet.Put( aLine );
-}
-
-void SwTableShell::ExecNumberFormat(SfxRequest& rReq)
-{
- const SfxItemSet* pArgs = rReq.GetArgs();
- SwWrtShell &rSh = GetShell();
-
- // At first the slots, which doesn't need a FrmMgr.
- const SfxPoolItem* pItem = 0;
- sal_uInt16 nSlot = rReq.GetSlot();
- if(pArgs)
- pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
-
- // Always aquire the language from the current cursor position.
- LanguageType eLang = rSh.GetCurLang();
- SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
- sal_uInt32 nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
- sal_uInt16 nFmtType = 0, nOffset = 0;
-
- switch ( nSlot )
- {
- case FN_NUMBER_FORMAT:
- if( pItem )
- {
- // Determine index for string.
- OUString aCode( ((const SfxStringItem*)pItem)->GetValue() );
- nNumberFormat = pFormatter->GetEntryKey( aCode, eLang );
- if( NUMBERFORMAT_ENTRY_NOT_FOUND == nNumberFormat )
- {
- // Re-enter
- sal_Int32 nErrPos;
- short nType;
- if( !pFormatter->PutEntry( aCode, nErrPos, nType,
- nNumberFormat, eLang ))
- nNumberFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
- }
- }
- break;
- case FN_NUMBER_STANDARD: nFmtType = NUMBERFORMAT_NUMBER; break;
- case FN_NUMBER_SCIENTIFIC: nFmtType = NUMBERFORMAT_SCIENTIFIC; break;
- case FN_NUMBER_DATE: nFmtType = NUMBERFORMAT_DATE; break;
- case FN_NUMBER_TIME: nFmtType = NUMBERFORMAT_TIME; break;
- case FN_NUMBER_CURRENCY: nFmtType = NUMBERFORMAT_CURRENCY; break;
- case FN_NUMBER_PERCENT: nFmtType = NUMBERFORMAT_PERCENT; break;
-
- case FN_NUMBER_TWODEC: // #.##0,00
- nFmtType = NUMBERFORMAT_NUMBER;
- nOffset = NF_NUMBER_1000DEC2;
- break;
-
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
-
- if( nFmtType )
- nNumberFormat = pFormatter->GetStandardFormat( nFmtType, eLang ) + nOffset;
-
- if( NUMBERFORMAT_ENTRY_NOT_FOUND != nNumberFormat )
- {
- SfxItemSet aBoxSet( GetPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMAT );
- aBoxSet.Put( SwTblBoxNumFormat( nNumberFormat ));
- rSh.SetTblBoxFormulaAttrs( aBoxSet );
- }
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/textdrw.cxx b/sw/source/ui/shells/textdrw.cxx
deleted file mode 100644
index fcc12affcb9c..000000000000
--- a/sw/source/ui/shells/textdrw.cxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <svx/svdview.hxx>
-#include <tools/urlobj.hxx>
-#include <svx/fmglob.hxx>
-#include <svx/svdouno.hxx>
-#include <com/sun/star/form/FormButtonType.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <view.hxx>
-#include <wrtsh.hxx>
-#include <edtwin.hxx>
-#include <swundo.hxx>
-#include <basesh.hxx>
-
-#include <poolfmt.hrc>
-
-#include <docsh.hxx>
-#include <sfx2/docfile.hxx>
-#include <svl/urihelper.hxx>
-#include <avmedia/mediawindow.hxx>
-
-#include <unomid.h>
-
-using namespace ::com::sun::star;
-
-void SwBaseShell::InsertURLButton(const OUString& rURL, const OUString& rTarget, const OUString& rTxt)
-{
- SwWrtShell& rSh = GetShell();
-
- if (!rSh.HasDrawView())
- rSh.MakeDrawView();
- SdrView *pSdrView = rSh.GetDrawView();
-
- // OBJ_FM_BUTTON
- pSdrView->SetDesignMode(true);
- pSdrView->SetCurrentObj(OBJ_FM_BUTTON);
- pSdrView->SetEditMode(sal_False);
-
- Point aStartPos(rSh.GetCharRect().Pos() + Point(0, 1));
-
- rSh.StartAction();
- rSh.StartUndo( UNDO_UI_INSERT_URLBTN );
- if (rSh.BeginCreate(OBJ_FM_BUTTON, FmFormInventor, aStartPos))
- {
- pSdrView->SetOrtho(false);
- Size aSz(GetView().GetEditWin().PixelToLogic(Size(140, 20)));
- Point aEndPos(aSz.Width(), aSz.Height());
-
- rSh.MoveCreate(aStartPos + aEndPos);
- rSh.EndCreate(SDRCREATE_FORCEEND);
-
- const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
- if (rMarkList.GetMark(0))
- {
- SdrUnoObj* pUnoCtrl = PTR_CAST(SdrUnoObj, rMarkList.GetMark(0)->GetMarkedSdrObj());
- uno::Reference< awt::XControlModel > xControlModel = pUnoCtrl->GetUnoControlModel();
-
- OSL_ENSURE( xControlModel.is(), "UNO-Control without Model" );
- if( !xControlModel.is() )
- return;
-
- uno::Reference< beans::XPropertySet > xPropSet(xControlModel, uno::UNO_QUERY);
-
- uno::Any aTmp;
-
- aTmp <<= OUString(rTxt);
- xPropSet->setPropertyValue( "Label", aTmp );
-
- SfxMedium* pMedium = rSh.GetView().GetDocShell()->GetMedium();
- INetURLObject aAbs;
- if( pMedium )
- aAbs = pMedium->GetURLObject();
-
- aTmp <<= OUString(URIHelper::SmartRel2Abs(aAbs, rURL));
- xPropSet->setPropertyValue( "TargetURL", aTmp );
-
- if( !rTarget.isEmpty() )
- {
- aTmp <<= rTarget;
- xPropSet->setPropertyValue( "TargetFrame", aTmp );
- }
-
- form::FormButtonType eButtonType = form::FormButtonType_URL;
- aTmp.setValue( &eButtonType, ::getCppuType((const form::FormButtonType*)0));
- xPropSet->setPropertyValue( "ButtonType", aTmp );
-
- if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) )
- {
- // #105638# OJ
- aTmp <<= sal_True;
- xPropSet->setPropertyValue("DispatchURLInternal", aTmp );
- }
- }
-
- if (rSh.IsObjSelected())
- {
- rSh.UnSelectFrm();
- }
- }
- rSh.EndUndo( UNDO_UI_INSERT_URLBTN );
- rSh.EndAction();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx
deleted file mode 100644
index 5b336ff25aee..000000000000
--- a/sw/source/ui/shells/textfld.cxx
+++ /dev/null
@@ -1,923 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <crsskip.hxx>
-#include <hintids.hxx>
-
-#include <sfx2/lnkbase.hxx>
-#include <fmtfld.hxx>
-#include <vcl/msgbox.hxx>
-#include <svl/itempool.hxx>
-#include <unotools/useroptions.hxx>
-#include <svl/whiter.hxx>
-#include <svl/eitem.hxx>
-#include <svl/macitem.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/request.hxx>
-#include <svx/postattr.hxx>
-#include <svx/hlnkitem.hxx>
-#include <svx/svxdlg.hxx>
-#include <sfx2/linkmgr.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <sfx2/dispatch.hxx>
-#include <fmtinfmt.hxx>
-#include <fldwrap.hxx>
-#include <redline.hxx>
-#include <view.hxx>
-#include <viewopt.hxx>
-#include <wrtsh.hxx>
-#include <basesh.hxx>
-#include <flddat.hxx>
-#include <numrule.hxx>
-#include <textsh.hxx>
-#include <docsh.hxx>
-#include <docufld.hxx>
-#include <usrfld.hxx>
-#include <ddefld.hxx>
-#include <expfld.hxx>
-#include <fldmgr.hxx>
-#include <uitool.hxx>
-#include <cmdid.h>
-#include <shells.hrc>
-#include <sfx2/app.hxx>
-#include <svx/dialogs.hrc>
-#include "swabstdlg.hxx"
-#include "dialog.hrc"
-#include <fldui.hrc>
-#include <doc.hxx>
-#include <app.hrc>
-#include <edtwin.hxx>
-#include <PostItMgr.hxx>
-#include <switerator.hxx>
-
-using namespace nsSwDocInfoSubType;
-
-extern bool bNoInterrupt; // in mainwn.cxx
-
-static OUString& lcl_AppendRedlineStr( OUString& rStr, sal_uInt16 nRedlId )
-{
- sal_uInt16 nResId = 0;
- switch( nRedlId )
- {
- case nsRedlineType_t::REDLINE_INSERT: nResId = STR_REDLINE_INSERTED; break;
- case nsRedlineType_t::REDLINE_DELETE: nResId = STR_REDLINE_DELETED; break;
- case nsRedlineType_t::REDLINE_FORMAT: nResId = STR_REDLINE_FORMATED; break;
- case nsRedlineType_t::REDLINE_TABLE: nResId = STR_REDLINE_TABLECHG; break;
- case nsRedlineType_t::REDLINE_FMTCOLL: nResId = STR_REDLINE_FMTCOLLSET; break;
- }
- if( nResId )
- rStr += SW_RESSTR( nResId );
- return rStr;
-}
-
-void SwTextShell::ExecField(SfxRequest &rReq)
-{
- SwWrtShell& rSh = GetShell();
- const SfxPoolItem* pItem = 0;
-
- sal_uInt16 nSlot = rReq.GetSlot();
- const SfxItemSet* pArgs = rReq.GetArgs();
- if(pArgs)
- pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
-
- Window *pMDI = &GetView().GetViewFrame()->GetWindow();
- bool bMore = false;
- bool bIsText = true;
- sal_uInt16 nInsertType = 0;
- sal_uInt16 nInsertSubType = 0;
- sal_uLong nInsertFormat = 0;
-
- switch(nSlot)
- {
- case FN_EDIT_FIELD:
- {
- SwField* pFld = rSh.GetCurFld();
- if( pFld )
- {
- switch ( pFld->GetTypeId() )
- {
- case TYP_DDEFLD:
- {
- ::sfx2::SvBaseLink& rLink = ((SwDDEFieldType*)pFld->GetTyp())->
- GetBaseLink();
- if(rLink.IsVisible())
- {
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- SfxAbstractLinksDialog* pDlg = pFact->CreateLinksDialog( pMDI, &rSh.GetLinkManager(), sal_False, &rLink );
- if ( pDlg )
- {
- pDlg->Execute();
- delete pDlg;
- }
- }
- break;
- }
- default:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- SfxAbstractDialog* pDlg = pFact->CreateSwFldEditDlg( GetView(),RC_DLG_SWFLDEDITDLG );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- }
- }
- }
- break;
- }
- case FN_EXECUTE_MACROFIELD:
- {
- SwField* pFld = rSh.GetCurFld();
- if(pFld && pFld->GetTyp()->Which() == RES_MACROFLD)
- {
-
- const OUString& rMacro = ((SwMacroField*)pFld)->GetMacro();
- sal_Int32 nPos = rMacro.indexOf('.');
- if(nPos != -1)
- {
- SvxMacro aMacro( rMacro.copy(nPos + 1), rMacro.copy(0,nPos), STARBASIC );
- rSh.ExecMacro(aMacro);
- }
- }
- }
- break;
-
- case FN_GOTO_NEXT_INPUTFLD:
- case FN_GOTO_PREV_INPUTFLD:
- {
- sal_Bool bRet = sal_False;
- SwFieldType* pFld = rSh.GetFldType( 0, RES_INPUTFLD );
- const bool bAddSetExpressionFlds = !( rSh.GetViewOptions()->IsReadonly() );
- if ( pFld != NULL
- && rSh.MoveFldType(
- pFld,
- FN_GOTO_NEXT_INPUTFLD == nSlot,
- USHRT_MAX,
- bAddSetExpressionFlds ) )
- {
- rSh.ClearMark();
- if ( dynamic_cast<SwInputField*>(rSh.GetCurFld( true )) != NULL )
- {
- rSh.SttSelect();
- rSh.SelectTxt(
- rSh.StartOfInputFldAtPos( *(rSh.GetCrsr()->Start()) ) + 1,
- rSh.EndOfInputFldAtPos( *(rSh.GetCrsr()->Start()) ) - 1 );
- }
- else
- {
- rSh.StartInputFldDlg( rSh.GetCurFld( true ), sal_False );
- }
- bRet = sal_True;
- }
-
- rReq.SetReturnValue( SfxBoolItem( nSlot, bRet ));
- }
- break;
-
- default:
- bMore = true;
- }
- if(bMore)
- {
- // Here come the slots with FldMgr.
- SwFldMgr aFldMgr(GetShellPtr());
- switch(nSlot)
- {
- case FN_INSERT_DBFIELD:
- {
- sal_Bool bRes = sal_False;
- if( pItem )
- {
- sal_uLong nFormat = 0;
- sal_uInt16 nType = 0;
- OUString aPar1 = ((SfxStringItem *)pItem)->GetValue();
- OUString aPar2;
- sal_Int32 nCommand = 0;
-
- if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
- false, &pItem ))
- nType = ((SfxUInt16Item *)pItem)->GetValue();
- aPar1 += OUString(DB_DELIM);
- if( SFX_ITEM_SET == pArgs->GetItemState(
- FN_PARAM_1, false, &pItem ))
- {
- aPar1 += ((SfxStringItem *)pItem)->GetValue();
- }
- if( SFX_ITEM_SET == pArgs->GetItemState(
- FN_PARAM_3, false, &pItem ))
- nCommand = ((SfxInt32Item*)pItem)->GetValue();
- aPar1 += OUString(DB_DELIM);
- aPar1 += OUString::number(nCommand);
- aPar1 += OUString(DB_DELIM);
- if( SFX_ITEM_SET == pArgs->GetItemState(
- FN_PARAM_2, false, &pItem ))
- {
- aPar1 += ((SfxStringItem *)pItem)->GetValue();
- }
- if( SFX_ITEM_SET == pArgs->GetItemState(
- FN_PARAM_FIELD_CONTENT, false, &pItem ))
- aPar2 = ((SfxStringItem *)pItem)->GetValue();
- if( SFX_ITEM_SET == pArgs->GetItemState(
- FN_PARAM_FIELD_FORMAT, false, &pItem ))
- nFormat = ((SfxUInt32Item *)pItem)->GetValue();
- OSL_FAIL("Command is not yet used");
- sal_Unicode cSeparator = ' ';
- SwInsertFld_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
- bRes = aFldMgr.InsertFld(aData);
- }
- rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
- }
- break;
- case FN_INSERT_FIELD_CTRL:
- case FN_INSERT_FIELD:
- {
- sal_Bool bRes = sal_False;
- if( pItem && nSlot != FN_INSERT_FIELD_CTRL)
- {
- sal_uLong nFormat = 0;
- sal_uInt16 nType = 0;
- sal_uInt16 nSubType = 0;
- OUString aPar1 = ((SfxStringItem *)pItem)->GetValue();
- OUString aPar2;
- sal_Unicode cSeparator = ' ';
-
- if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE,
- false, &pItem ))
- nType = ((SfxUInt16Item *)pItem)->GetValue();
- if( SFX_ITEM_SET == pArgs->GetItemState( FN_PARAM_FIELD_SUBTYPE,
- false, &pItem ))
- nSubType = ((SfxUInt16Item *)pItem)->GetValue();
- if( SFX_ITEM_SET == pArgs->GetItemState(
- FN_PARAM_FIELD_CONTENT, false, &pItem ))
- aPar2 = ((SfxStringItem *)pItem)->GetValue();
- if( SFX_ITEM_SET == pArgs->GetItemState(
- FN_PARAM_FIELD_FORMAT, false, &pItem ))
- nFormat = ((SfxUInt32Item *)pItem)->GetValue();
- if( SFX_ITEM_SET == pArgs->GetItemState(
- FN_PARAM_3, false, &pItem ))
- {
- OUString sTmp = ((SfxStringItem *)pItem)->GetValue();
- if(!sTmp.isEmpty())
- cSeparator = sTmp[0];
- }
- SwInsertFld_Data aData(nType, nSubType, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator );
- bRes = aFldMgr.InsertFld( aData );
- }
- else
- //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
- if(!GetView().GetViewFrame()->IsInModalMode())
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- pVFrame->ToggleChildWindow(FN_INSERT_FIELD);
- bRes = pVFrame->GetChildWindow( nSlot ) != 0;
- Invalidate(rReq.GetSlot());
- Invalidate(FN_INSERT_FIELD_CTRL);
- rReq.Ignore();
- }
- rReq.SetReturnValue(SfxBoolItem( nSlot, bRes ));
- }
- break;
-
- case FN_INSERT_REF_FIELD:
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if (!pVFrame->HasChildWindow(FN_INSERT_FIELD))
- pVFrame->ToggleChildWindow(FN_INSERT_FIELD); // Show dialog
-
- // Switch Flddlg at a new TabPage
- sal_uInt16 nId = SwFldDlgWrapper::GetChildWindowId();
- SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->GetChildWindow(nId);
- if (pWrp)
- pWrp->ShowReferencePage();
- rReq.Ignore();
- }
- break;
- case FN_DELETE_COMMENT:
- if ( GetView().GetPostItMgr() &&
- GetView().GetPostItMgr()->HasActiveSidebarWin() )
- {
- GetView().GetPostItMgr()->DeleteActiveSidebarWin();
- }
- break;
- case FN_DELETE_ALL_NOTES:
- if ( GetView().GetPostItMgr() )
- GetView().GetPostItMgr()->Delete();
- break;
- case FN_DELETE_NOTE_AUTHOR:
- {
- SFX_REQUEST_ARG( rReq, pNoteItem, SfxStringItem, nSlot, false);
- if ( pNoteItem && GetView().GetPostItMgr() )
- GetView().GetPostItMgr()->Delete( pNoteItem->GetValue() );
- }
- break;
- case FN_HIDE_NOTE:
- if ( GetView().GetPostItMgr() &&
- GetView().GetPostItMgr()->HasActiveSidebarWin() )
- {
- GetView().GetPostItMgr()->HideActiveSidebarWin();
- }
- break;
- case FN_HIDE_ALL_NOTES:
- if ( GetView().GetPostItMgr() )
- GetView().GetPostItMgr()->Hide();
- break;
- case FN_HIDE_NOTE_AUTHOR:
- {
- SFX_REQUEST_ARG( rReq, pNoteItem, SfxStringItem, nSlot, false);
- if ( pNoteItem && GetView().GetPostItMgr() )
- GetView().GetPostItMgr()->Hide( pNoteItem->GetValue() );
- }
- break;
- case FN_POSTIT:
- {
- SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(aFldMgr.GetCurFld());
- bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == RES_POSTITFLD);
- if (bNew || GetView().GetPostItMgr()->IsAnswer())
- {
- SvtUserOptions aUserOpt;
- OUString sAuthor;
- if( (sAuthor = aUserOpt.GetFullName()).isEmpty())
- if( (sAuthor = aUserOpt.GetID()).isEmpty() )
- sAuthor = SW_RES( STR_REDLINE_UNKNOWN_AUTHOR );
-
- if ( rSh.HasSelection() && !rSh.IsTableMode() )
- {
- rSh.KillPams();
- }
-
- // #i120513# Inserting a comment into an autocompletion crashes
- // --> suggestion has to be removed before
- GetView().GetEditWin().StopQuickHelp();
-
- SwInsertFld_Data aData(TYP_POSTITFLD, 0, sAuthor, OUString(), 0);
- aFldMgr.InsertFld( aData );
-
- rSh.Push();
- rSh.SwCrsrShell::Left(1, CRSR_SKIP_CHARS, sal_False);
- pPostIt = (SwPostItField*)aFldMgr.GetCurFld();
- rSh.Pop(sal_False); // Restore cursor position
- }
-
- if (pPostIt)
- {
- SwFieldType* pType = rSh.GetDoc()->GetFldType(RES_POSTITFLD, OUString(), false);
- SwIterator<SwFmtFld,SwFieldType> aIter( *pType );
- SwFmtFld* pSwFmtFld = aIter.First();
- while( pSwFmtFld )
- {
- if ( pSwFmtFld->GetField() == pPostIt )
- {
- pSwFmtFld->Broadcast( SwFmtFldHint( 0, SWFMTFLD_FOCUS, &GetView() ) );
- break;
- }
- pSwFmtFld = aIter.Next();
- }
- }
- }
- break;
- case FN_REDLINE_COMMENT:
- {
- /* this code can be used once we want redline comments in the margin, all other stuff can
- then be deleted
- String sComment;
- const SwRangeRedline *pRedline = rSh.GetCurrRedline();
-
- if (pRedline)
- {
- sComment = pRedline->GetComment();
- if ( !sComment.Len() )
- GetView().GetDocShell()->Broadcast(SwRedlineHint(pRedline,SWREDLINE_INSERTED));
- const_cast<SwRangeRedline*>(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS,&GetView()));
- }
- */
-
- const SwRangeRedline *pRedline = rSh.GetCurrRedline();
-
- if (pRedline)
- {
- OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
-
- sal_Bool bTravel = sal_False;
-
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc();
- OSL_ENSURE(fnGetRange, "Dialogdiet fail! GetRanges()");
- SfxItemSet aSet(GetPool(), fnGetRange());
- aSet.Put(SvxPostItTextItem(sComment, SID_ATTR_POSTIT_TEXT));
- aSet.Put(SvxPostItAuthorItem(pRedline->GetAuthorString(), SID_ATTR_POSTIT_AUTHOR));
-
- aSet.Put( SvxPostItDateItem( GetAppLangDateTimeString(
- pRedline->GetRedlineData().GetTimeStamp() ),
- SID_ATTR_POSTIT_DATE ));
-
- // Traveling only if more than one field.
- rSh.StartAction();
-
- rSh.Push();
- const SwRangeRedline *pActRed = rSh.SelPrevRedline();
-
- if (pActRed == pRedline)
- { // New cursor is at the beginning of the current redlines.
- rSh.Pop(); // Throw old cursor away
- rSh.Push();
- pActRed = rSh.SelPrevRedline();
- }
-
- sal_Bool bPrev = pActRed != 0;
- rSh.Pop(sal_False);
- rSh.EndAction();
-
- rSh.ClearMark();
- rSh.SelNextRedline(); // Select current redline.
-
- rSh.StartAction();
- rSh.Push();
- pActRed = rSh.SelNextRedline();
- sal_Bool bNext = pActRed != 0;
- rSh.Pop(sal_False); // Restore cursor position
-
- if( rSh.IsCrsrPtAtEnd() )
- rSh.SwapPam();
-
- rSh.EndAction();
-
- bTravel |= bNext|bPrev;
-
- SvxAbstractDialogFactory* pFact2 = SvxAbstractDialogFactory::Create();
- OSL_ENSURE(pFact2, "Dialogdiet fail!");
- AbstractSvxPostItDialog* pDlg = pFact2->CreateSvxPostItDialog( pMDI, aSet, bTravel );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->HideAuthor();
-
- OUString sTitle(SW_RES(STR_REDLINE_COMMENT));
- ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() );
-
- pDlg->SetText(sTitle);
-
- if (bTravel)
- {
- pDlg->EnableTravel(bNext, bPrev);
- pDlg->SetPrevHdl(LINK(this, SwTextShell, RedlinePrevHdl));
- pDlg->SetNextHdl(LINK(this, SwTextShell, RedlineNextHdl));
- }
-
- rSh.SetCareWin(pDlg->GetWindow());
- bNoInterrupt = true;
-
- if ( pDlg->Execute() == RET_OK )
- {
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- OUString sMsg(((const SvxPostItTextItem&)pOutSet->Get(SID_ATTR_POSTIT_TEXT)).GetValue());
-
- // Insert or change a comment
- rSh.SetRedlineComment(sMsg);
- }
-
- delete pDlg;
- rSh.SetCareWin(NULL);
- bNoInterrupt = false;
- rSh.ClearMark();
- GetView().AttrChangedNotify(GetShellPtr());
- }
- }
- break;
-
- case FN_JAVAEDIT:
- {
- OUString aType, aText;
- sal_Bool bIsUrl=sal_False;
- sal_Bool bNew=sal_False;
- bool bUpdate = false;
- SwFldMgr aMgr;
- if ( pItem )
- {
- aText = ((SfxStringItem*)pItem)->GetValue();
- SFX_REQUEST_ARG( rReq, pType, SfxStringItem, FN_PARAM_2 , false );
- SFX_REQUEST_ARG( rReq, pIsUrl, SfxBoolItem, FN_PARAM_1 , false );
- if ( pType )
- aType = pType->GetValue();
- if ( pIsUrl )
- bIsUrl = pIsUrl->GetValue();
-
- SwScriptField* pFld = (SwScriptField*)aMgr.GetCurFld();
- bNew = !pFld || !(pFld->GetTyp()->Which() == RES_SCRIPTFLD);
- bUpdate = pFld && ( bIsUrl != pFld->GetFormat() || pFld->GetPar2() != aType || pFld->GetPar1() != aText );
- }
- else
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- AbstractJavaEditDialog* pDlg = pFact->CreateJavaEditDialog(pMDI, &rSh);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if ( pDlg->Execute() )
- {
- aType = pDlg->GetScriptType();
- aText = pDlg->GetScriptText();
- bIsUrl = pDlg->IsUrl();
- bNew = pDlg->IsNew();
- bUpdate = pDlg->IsUpdate();
- rReq.AppendItem( SfxStringItem( FN_JAVAEDIT, aText ) );
- rReq.AppendItem( SfxStringItem( FN_PARAM_2, aType ) );
- rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bIsUrl ) );
- }
-
- delete pDlg;
- }
-
- if( bNew )
- {
- SwInsertFld_Data aData(TYP_SCRIPTFLD, 0, aType, aText, bIsUrl);
- aMgr.InsertFld(aData);
- rReq.Done();
- }
- else if( bUpdate )
- {
- aMgr.UpdateCurFld( bIsUrl, aType, aText );
- rSh.SetUndoNoResetModified();
- rReq.Done();
- }
- else
- rReq.Ignore();
- }
- break;
-
- case FN_INSERT_FLD_DATE :
- nInsertType = TYP_DATEFLD;
- bIsText = false;
- goto FIELD_INSERT;
- case FN_INSERT_FLD_TIME :
- nInsertType = TYP_TIMEFLD;
- bIsText = false;
- goto FIELD_INSERT;
- case FN_INSERT_FLD_PGNUMBER:
- nInsertType = TYP_PAGENUMBERFLD;
- nInsertFormat = SVX_NUM_PAGEDESC; // Like page template
- bIsText = false;
- goto FIELD_INSERT;
- case FN_INSERT_FLD_PGCOUNT :
- nInsertType = TYP_DOCSTATFLD;
- nInsertSubType = 0;
- bIsText = false;
- nInsertFormat = SVX_NUM_PAGEDESC;
- goto FIELD_INSERT;
- case FN_INSERT_FLD_TOPIC :
- nInsertType = TYP_DOCINFOFLD;
- nInsertSubType = DI_THEMA;
- goto FIELD_INSERT;
- case FN_INSERT_FLD_TITLE :
- nInsertType = TYP_DOCINFOFLD;
- nInsertSubType = DI_TITEL;
- goto FIELD_INSERT;
- case FN_INSERT_FLD_AUTHOR :
- nInsertType = TYP_DOCINFOFLD;
- nInsertSubType = DI_CREATE|DI_SUB_AUTHOR;
-
-FIELD_INSERT:
- {
- //format conversion should only be done for number formatter formats
- if(!nInsertFormat)
- nInsertFormat = aFldMgr.GetDefaultFormat(nInsertType, bIsText, rSh.GetNumberFormatter());
- SwInsertFld_Data aData(nInsertType, nInsertSubType,
- OUString(), OUString(), nInsertFormat);
- aFldMgr.InsertFld(aData);
- rReq.Done();
- }
- break;
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
- }
-}
-
-void SwTextShell::StateField( SfxItemSet &rSet )
-{
- SwWrtShell& rSh = GetShell();
- SfxWhichIter aIter( rSet );
- const SwField* pField = 0;
- int bGetField = sal_False;
- sal_uInt16 nWhich = aIter.FirstWhich();
-
- while (nWhich)
- {
- switch (nWhich)
- {
- case FN_DELETE_COMMENT:
- case FN_DELETE_NOTE_AUTHOR:
- case FN_DELETE_ALL_NOTES:
- case FN_HIDE_NOTE:
- case FN_HIDE_NOTE_AUTHOR:
- case FN_HIDE_ALL_NOTES:
- {
- SwPostItMgr* pPostItMgr = GetView().GetPostItMgr();
- if ( !pPostItMgr )
- rSet.InvalidateItem( nWhich );
- else if ( !pPostItMgr->HasActiveSidebarWin() )
- {
- rSet.InvalidateItem( FN_DELETE_COMMENT );
- rSet.InvalidateItem( FN_HIDE_NOTE );
- }
- }
- break;
-
- case FN_EDIT_FIELD:
- {
- if( !bGetField )
- {
- pField = rSh.GetCurFld();
- bGetField = sal_True;
- }
-
- sal_uInt16 nTempWhich = pField ? pField->GetTyp()->Which() : USHRT_MAX;
- if( USHRT_MAX == nTempWhich ||
- RES_POSTITFLD == nTempWhich ||
- RES_SCRIPTFLD == nTempWhich ||
- RES_AUTHORITY == nTempWhich )
- rSet.DisableItem( nWhich );
- else if( RES_DDEFLD == nTempWhich &&
- !((SwDDEFieldType*)pField->GetTyp())->GetBaseLink().IsVisible())
- {
- // nested links cannot be edited
- rSet.DisableItem( nWhich );
- }
- }
- break;
-
- case FN_EXECUTE_MACROFIELD:
- {
- if(!bGetField)
- {
- pField = rSh.GetCurFld();
- bGetField = sal_True;
- }
- if(!pField || pField->GetTyp()->Which() != RES_MACROFLD)
- rSet.DisableItem(nWhich);
- }
- break;
-
- case FN_INSERT_FIELD:
- {
- if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem(nWhich);
- }
- else
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- //#i5788# prevent closing of the field dialog while a modal dialog ( Input field dialog ) is active
- if(!pVFrame->IsInModalMode() &&
- pVFrame->KnowsChildWindow(FN_INSERT_FIELD) && !pVFrame->HasChildWindow(FN_INSERT_FIELD_DATA_ONLY) )
- rSet.Put(SfxBoolItem( FN_INSERT_FIELD, pVFrame->HasChildWindow(nWhich)));
- else
- rSet.DisableItem(FN_INSERT_FIELD);
- }
- }
- break;
-
- case FN_INSERT_REF_FIELD:
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if ( !pVFrame->KnowsChildWindow(FN_INSERT_FIELD)
- || rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem(FN_INSERT_REF_FIELD);
- }
- }
- break;
-
- case FN_INSERT_FIELD_CTRL:
- if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem(nWhich);
- }
- else
- {
- rSet.Put(SfxBoolItem( nWhich, GetView().GetViewFrame()->HasChildWindow(FN_INSERT_FIELD)));
- }
- break;
-
- case FN_REDLINE_COMMENT:
- if (!rSh.GetCurrRedline())
- rSet.DisableItem(nWhich);
- break;
-
- case FN_POSTIT :
- case FN_JAVAEDIT :
- {
- sal_Bool bCurField = sal_False;
- pField = rSh.GetCurFld();
- if(nWhich == FN_POSTIT)
- bCurField = pField && pField->GetTyp()->Which() == RES_POSTITFLD;
- else
- bCurField = pField && pField->GetTyp()->Which() == RES_SCRIPTFLD;
-
- if( !bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() )
- {
- rSet.DisableItem(nWhich);
- }
- else if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem(nWhich);
- }
- }
-
- break;
-
- case FN_INSERT_FLD_AUTHOR:
- case FN_INSERT_FLD_DATE:
- case FN_INSERT_FLD_PGCOUNT:
- case FN_INSERT_FLD_PGNUMBER:
- case FN_INSERT_FLD_TIME:
- case FN_INSERT_FLD_TITLE:
- case FN_INSERT_FLD_TOPIC:
- case FN_INSERT_DBFIELD:
- if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem(nWhich);
- }
- break;
-
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwTextShell::InsertHyperlink(const SvxHyperlinkItem& rHlnkItem)
-{
- const OUString& rName = rHlnkItem.GetName();
- const OUString& rURL = rHlnkItem.GetURL();
- const OUString& rTarget = rHlnkItem.GetTargetFrame();
- sal_uInt16 nType = (sal_uInt16)rHlnkItem.GetInsertMode();
- nType &= ~HLINK_HTMLMODE;
- const SvxMacroTableDtor* pMacroTbl = rHlnkItem.GetMacroTbl();
-
- SwWrtShell& rSh = GetShell();
-
- if( rSh.GetSelectionType() & nsSelectionType::SEL_TXT )
- {
- rSh.StartAction();
- SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
- rSh.GetCurAttr( aSet );
-
- const SfxPoolItem* pItem;
- if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, false, &pItem))
- {
- // Select links
- rSh.SwCrsrShell::SelectTxtAttr(RES_TXTATR_INETFMT, sal_False);
- }
- switch (nType)
- {
- case HLINK_DEFAULT:
- case HLINK_FIELD:
- {
- SwFmtINetFmt aINetFmt( rURL, rTarget );
- aINetFmt.SetName(rHlnkItem.GetIntName());
- if(pMacroTbl)
- {
- const SvxMacro *pMacro = pMacroTbl->Get( SFX_EVENT_MOUSEOVER_OBJECT );
- if( pMacro )
- aINetFmt.SetMacro(SFX_EVENT_MOUSEOVER_OBJECT, *pMacro);
- pMacro = pMacroTbl->Get( SFX_EVENT_MOUSECLICK_OBJECT );
- if( pMacro )
- aINetFmt.SetMacro(SFX_EVENT_MOUSECLICK_OBJECT, *pMacro);
- pMacro = pMacroTbl->Get( SFX_EVENT_MOUSEOUT_OBJECT );
- if( pMacro )
- aINetFmt.SetMacro(SFX_EVENT_MOUSEOUT_OBJECT, *pMacro);
- }
- rSh.SttSelect();
- rSh.InsertURL( aINetFmt, rName, sal_True );
- rSh.EndSelect();
- }
- break;
-
- case HLINK_BUTTON:
- sal_Bool bSel = rSh.HasSelection();
- if(bSel)
- rSh.DelRight();
- InsertURLButton( rURL, rTarget, rName );
- rSh.EnterStdMode();
- break;
- }
- rSh.EndAction();
- }
-}
-
-IMPL_LINK( SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog *, pBtn )
-{
- SwWrtShell* pSh = GetShellPtr();
- AbstractSvxPostItDialog *pDlg = (AbstractSvxPostItDialog*)pBtn;
-
- // Insert or change a comment.
- pSh->SetRedlineComment(pDlg->GetNote());
-
- const SwRangeRedline *pRedline = pSh->GetCurrRedline();
-
- if (pRedline)
- {
- // Traveling only if more than one field.
- if( !pSh->IsCrsrPtAtEnd() )
- pSh->SwapPam(); // Move the cursor behind the Redline.
-
- pSh->Push();
- const SwRangeRedline *pActRed = pSh->SelNextRedline();
- pSh->Pop(pActRed != 0);
-
- sal_Bool bEnable = sal_False;
-
- if (pActRed)
- {
- pSh->StartAction();
- pSh->Push();
- bEnable = pSh->SelNextRedline() != 0;
- pSh->Pop(sal_False);
- pSh->EndAction();
- }
-
- pDlg->EnableTravel(bEnable, sal_True);
-
- if( pSh->IsCrsrPtAtEnd() )
- pSh->SwapPam();
-
- pRedline = pSh->GetCurrRedline();
- OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
-
- pDlg->SetNote(sComment);
- pDlg->ShowLastAuthor( pRedline->GetAuthorString(),
- GetAppLangDateTimeString(
- pRedline->GetRedlineData().GetTimeStamp() ));
-
- OUString sTitle(SW_RES(STR_REDLINE_COMMENT));
- ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() );
-
- pDlg->SetText(sTitle);
- }
-
- return 0;
-}
-
-IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog *, pBtn )
-{
- SwWrtShell* pSh = GetShellPtr();
- AbstractSvxPostItDialog *pDlg = (AbstractSvxPostItDialog*)pBtn;
-
- // Insert or change a comment.
- pSh->SetRedlineComment(pDlg->GetNote());
-
- const SwRangeRedline *pRedline = pSh->GetCurrRedline();
-
- if (pRedline)
- {
- // Traveling only if more than one field.
- pSh->Push();
- const SwRangeRedline *pActRed = pSh->SelPrevRedline();
- pSh->Pop(pActRed != 0);
-
- sal_Bool bEnable = sal_False;
-
- if (pActRed)
- {
- pSh->StartAction();
- pSh->Push();
- bEnable = pSh->SelPrevRedline() != 0;
- pSh->Pop(sal_False);
- pSh->EndAction();
- }
-
- pDlg->EnableTravel(sal_True, bEnable);
-
- pRedline = pSh->GetCurrRedline();
- OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
-
- pDlg->SetNote(sComment);
- pDlg->ShowLastAuthor(pRedline->GetAuthorString(),
- GetAppLangDateTimeString(
- pRedline->GetRedlineData().GetTimeStamp() ));
-
- OUString sTitle(SW_RES(STR_REDLINE_COMMENT));
- ::lcl_AppendRedlineStr( sTitle, pRedline->GetType() );
-
- pDlg->SetText(sTitle);
- }
-
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/textglos.cxx b/sw/source/ui/shells/textglos.cxx
deleted file mode 100644
index 365534a38549..000000000000
--- a/sw/source/ui/shells/textglos.cxx
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sfx2/request.hxx>
-#include <svl/eitem.hxx>
-#include <svl/stritem.hxx>
-
-#include "view.hxx"
-#include "cmdid.h"
-#include "textsh.hxx"
-#include "initui.hxx"
-#include "gloshdl.hxx"
-#include "glosdoc.hxx"
-#include "gloslst.hxx"
-#include "swabstdlg.hxx"
-#include <misc.hrc>
-
-void SwTextShell::ExecGlossary(SfxRequest &rReq)
-{
- sal_uInt16 nSlot = rReq.GetSlot();
- ::GetGlossaries()->UpdateGlosPath(!rReq.IsAPI() ||
- FN_GLOSSARY_DLG == nSlot );
- SwGlossaryHdl* pGlosHdl = GetView().GetGlosHdl();
- // Update SwGlossaryList?
- bool bUpdateList = false;
-
- const SfxItemSet *pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem = 0;
- if(pArgs)
- pArgs->GetItemState(nSlot, false, &pItem );
-
- switch( nSlot )
- {
- case FN_GLOSSARY_DLG:
- pGlosHdl->GlossaryDlg();
- bUpdateList = true;
- rReq.Ignore();
- break;
- case FN_EXPAND_GLOSSARY:
- {
- sal_Bool bReturn;
- bReturn = pGlosHdl->ExpandGlossary();
- rReq.SetReturnValue( SfxBoolItem( nSlot, bReturn ) );
- rReq.Done();
- }
- break;
- case FN_NEW_GLOSSARY:
- if(pItem && pArgs->Count() == 3 )
- {
- OUString aGroup = (( const SfxStringItem *)pItem)->GetValue();
- OUString aName;
- if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem ))
- aName = (( const SfxStringItem *)pItem)->GetValue();
- OUString aShortName;
- if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_2, false, &pItem ))
- aShortName = (( const SfxStringItem *)pItem)->GetValue();
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc();
- if ( fnSetActGroup )
- (*fnSetActGroup)( aGroup );
- pGlosHdl->SetCurGroup(aGroup, sal_True);
- // Chosen group must be created in NewGlossary if necessary!
- pGlosHdl->NewGlossary( aName, aShortName, sal_True );
- rReq.Done();
- }
- bUpdateList = true;
- break;
- case FN_SET_ACT_GLOSSARY:
- if(pItem)
- {
- OUString aGroup = (( const SfxStringItem *)pItem)->GetValue();
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc();
- if ( fnSetActGroup )
- (*fnSetActGroup)( aGroup );
- rReq.Done();
- }
- break;
- case FN_INSERT_GLOSSARY:
- {
- if(pItem && pArgs->Count() > 1)
- {
- OUString aGroup = (( const SfxStringItem *)pItem)->GetValue();
- OUString aName;
- if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem ))
- aName = (( const SfxStringItem *)pItem)->GetValue();
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc();
- if ( fnSetActGroup )
- (*fnSetActGroup)( aGroup );
- pGlosHdl->SetCurGroup(aGroup, sal_True);
- rReq.SetReturnValue(SfxBoolItem(nSlot, pGlosHdl->InsertGlossary( aName ) ? sal_True : sal_False));
- rReq.Done();
- }
- }
- break;
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
- if(bUpdateList)
- {
- SwGlossaryList* pList = ::GetGlossaryList();
- if(pList->IsActive())
- pList->Update();
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/textidx.cxx b/sw/source/ui/shells/textidx.cxx
deleted file mode 100644
index 05d9fc295c67..000000000000
--- a/sw/source/ui/shells/textidx.cxx
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-#include <vcl/msgbox.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <svl/stritem.hxx>
-#include <svl/eitem.hxx>
-#include <editeng/sizeitem.hxx>
-#include <fmtfsize.hxx>
-#include <fldbas.hxx>
-#include <uiitems.hxx>
-#include "viewopt.hxx"
-#include "cmdid.h"
-#include "view.hxx"
-#include "wrtsh.hxx"
-#include "swundo.hxx"
-#include "textsh.hxx"
-#include "idxmrk.hxx"
-#include "cnttab.hxx"
-#include "toxmgr.hxx"
-#include "swabstdlg.hxx"
-#include <index.hrc>
-#include <globals.hrc>
-
-void SwTextShell::ExecIdx(SfxRequest &rReq)
-{
- const SfxItemSet *pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem = 0;
- sal_uInt16 nSlot = rReq.GetSlot();
- if(pArgs)
- pArgs->GetItemState(nSlot, false, &pItem );
-
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- Window *pMDI = &pVFrame->GetWindow();
-
- switch( nSlot )
- {
- case FN_EDIT_AUTH_ENTRY_DLG :
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( pMDI, GetShell(), DLG_EDIT_AUTHMARK);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- }
- break;
- case FN_INSERT_AUTH_ENTRY_DLG:
- {
- // no BASIC support
- pVFrame->ToggleChildWindow(FN_INSERT_AUTH_ENTRY_DLG);
- Invalidate(rReq.GetSlot());
- }
- break;
- case FN_INSERT_IDX_ENTRY_DLG:
- {
- pVFrame->ToggleChildWindow(FN_INSERT_IDX_ENTRY_DLG);
- Invalidate(rReq.GetSlot());
- }
- break;
- case FN_EDIT_IDX_ENTRY_DLG:
- {
- SwTOXMgr aMgr(GetShellPtr());
- sal_uInt16 nRet = RET_OK;
- if(aMgr.GetTOXMarkCount() > 1)
- { // Several marks, which should it be?
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- VclAbstractDialog* pMultDlg = pFact->CreateMultiTOXMarkDlg(pMDI, aMgr);
- OSL_ENSURE(pMultDlg, "Dialogdiet fail!");
- nRet = pMultDlg->Execute();
- delete pMultDlg;
- }
- if( nRet == RET_OK)
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- VclAbstractDialog* pDlg = pFact->CreateIndexMarkModalDlg(pMDI, GetShell(), aMgr.GetCurTOXMark());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- }
- break;
- }
- case FN_IDX_MARK_TO_IDX:
- {
- GetShell().GotoTOXMarkBase();
- break;
- }
- case FN_INSERT_MULTI_TOX:
- {
- SfxItemSet aSet(GetPool(),
- RES_COL, RES_COL,
- RES_BACKGROUND, RES_BACKGROUND,
- RES_FRM_SIZE, RES_FRM_SIZE,
- SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
- RES_LR_SPACE, RES_LR_SPACE,
- FN_PARAM_TOX_TYPE, FN_PARAM_TOX_TYPE,
- 0 );
- SwWrtShell& rSh = GetShell();
- SwRect aRect;
- rSh.CalcBoundRect(aRect, FLY_AS_CHAR);
-
- long nWidth = aRect.Width();
- aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth));
- // Height = width for a more consistent preview (analogous to edit range)
- aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
- const SwTOXBase* pCurTOX = 0;
- sal_Bool bGlobal = sal_False;
- if(pItem)
- {
- pCurTOX = (const SwTOXBase* )((SwPtrItem*)pItem)->GetValue();
- bGlobal = sal_True;
- }
- else
- pCurTOX = rSh.GetCurTOX();
- if(pCurTOX)
- {
- const SfxItemSet* pSet = pCurTOX->GetAttrSet();
- if(pSet)
- aSet.Put(*pSet);
- }
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- AbstractMultiTOXTabDialog* pDlg = pFact->CreateMultiTOXTabDialog(
- pMDI, aSet, rSh, (SwTOXBase* )pCurTOX,
- USHRT_MAX, bGlobal);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- }
- break;
- case FN_REMOVE_CUR_TOX:
- {
- SwWrtShell& rSh = GetShell();
- const SwTOXBase* pBase = rSh.GetCurTOX();
- OSL_ENSURE(pBase, "no TOXBase to remove");
- if( pBase )
- rSh.DeleteTOX(*pBase, true);
- }
- break;
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
-}
-
-void SwTextShell::GetIdxState(SfxItemSet &rSet)
-{
- SwWrtShell& rSh = GetShell();
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- SwInsertIdxMarkWrapper *pIdxMrk = (SwInsertIdxMarkWrapper*)
- pVFrame->GetChildWindow(FN_INSERT_IDX_ENTRY_DLG);
-
- SfxChildWindow* pAuthMark = pVFrame->GetChildWindow(FN_INSERT_AUTH_ENTRY_DLG);
-
- const bool bHtmlMode = 0 != ::GetHtmlMode( GetView().GetDocShell() );
- const SwTOXBase* pBase = 0;
- if( bHtmlMode || 0 != ( pBase = rSh.GetCurTOX()) )
- {
- if( pBase )
- {
- if(pBase->IsTOXBaseInReadonly())
- {
- rSet.DisableItem( FN_INSERT_MULTI_TOX );
- }
- }
-
- rSet.DisableItem( FN_EDIT_IDX_ENTRY_DLG );
- rSet.DisableItem( FN_EDIT_AUTH_ENTRY_DLG );
-
- if(!pIdxMrk)
- rSet.DisableItem( FN_INSERT_IDX_ENTRY_DLG );
- else
- rSet.Put(SfxBoolItem(FN_INSERT_IDX_ENTRY_DLG, true));
-
- if(!pAuthMark)
- rSet.DisableItem( FN_INSERT_AUTH_ENTRY_DLG );
- else
- rSet.Put(SfxBoolItem(FN_INSERT_AUTH_ENTRY_DLG, true));
-
- }
- else if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( FN_INSERT_IDX_ENTRY_DLG );
- rSet.DisableItem( FN_INSERT_AUTH_ENTRY_DLG );
- rSet.DisableItem( FN_EDIT_AUTH_ENTRY_DLG );
- rSet.DisableItem( FN_EDIT_IDX_ENTRY_DLG );
- rSet.DisableItem( FN_INSERT_MULTI_TOX );
- rSet.DisableItem( FN_REMOVE_CUR_TOX );
- }
- else
- {
-
- bool bEnableEdit = true;
- sal_Bool bInReadonly = rSh.HasReadonlySel();
- if( rSh.HasSelection() || bInReadonly)
- bEnableEdit = false;
- else
- {
- SwTOXMarks aArr;
- rSh.GetCurTOXMarks( aArr );
- if( aArr.empty())
- bEnableEdit = false;
- }
-
- if(!bEnableEdit)
- rSet.DisableItem( FN_EDIT_IDX_ENTRY_DLG );
-
- if(bInReadonly)
- {
- rSet.DisableItem(FN_INSERT_IDX_ENTRY_DLG);
- rSet.DisableItem( FN_INSERT_MULTI_TOX );
- }
- else
- rSet.Put(SfxBoolItem(FN_INSERT_IDX_ENTRY_DLG,
- 0 != pIdxMrk));
-
- SwField* pField = rSh.GetCurFld();
-
- if(bInReadonly)
- rSet.DisableItem(FN_INSERT_AUTH_ENTRY_DLG);
- else
- rSet.Put(SfxBoolItem(FN_INSERT_AUTH_ENTRY_DLG, 0 != pAuthMark));
-
- if( bInReadonly || !pField ||
- pField->GetTyp()->Which() != RES_AUTHORITY)
- rSet.DisableItem(FN_EDIT_AUTH_ENTRY_DLG);
- rSet.DisableItem(FN_REMOVE_CUR_TOX);
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx
deleted file mode 100644
index 57314e0e8848..000000000000
--- a/sw/source/ui/shells/textsh.cxx
+++ /dev/null
@@ -1,1131 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-#include <comphelper/string.hxx>
-#include <svl/globalnameitem.hxx>
-#include <svl/ownlist.hxx>
-#include <sfx2/frmdescr.hxx>
-#include <sfx2/objface.hxx>
-#include <sfx2/lnkbase.hxx>
-
-#include <tools/errinf.hxx>
-#include <svx/svdview.hxx>
-#include <svl/ptitem.hxx>
-#include <svl/stritem.hxx>
-#include <unotools/moduleoptions.hxx>
-#include <vcl/msgbox.hxx>
-#include <sfx2/fcontnr.hxx>
-#include <svx/hlnkitem.hxx>
-#include <svl/srchitem.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/docfile.hxx>
-#include <svl/urihelper.hxx>
-#include <basic/sbxvar.hxx>
-#include <svl/whiter.hxx>
-#include <sfx2/request.hxx>
-#include <editeng/opaqitem.hxx>
-#include <editeng/fontitem.hxx>
-#include <editeng/adjustitem.hxx>
-#include <editeng/boxitem.hxx>
-#include <editeng/sizeitem.hxx>
-#include <editeng/svxacorr.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <vcl/graphicfilter.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <svx/pfiledlg.hxx>
-#include <svtools/htmlcfg.hxx>
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-#include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
-#include <com/sun/star/embed/Aspects.hpp>
-
-#include <comphelper/classids.hxx>
-#include <editeng/acorrcfg.hxx>
-#include <wdocsh.hxx>
-#include <fmtinfmt.hxx>
-#include <fmtclds.hxx>
-#include <fmtsrnd.hxx>
-#include <fmtfsize.hxx>
-#include <swmodule.hxx>
-#include <wrtsh.hxx>
-#include <view.hxx>
-#include <docsh.hxx>
-#include <doc.hxx>
-#include <uitool.hxx>
-#include <cmdid.h>
-#include <globals.hrc>
-#include <frmmgr.hxx>
-#include <textsh.hxx>
-#include <frmfmt.hxx>
-#include <tablemgr.hxx>
-#include <swundo.hxx>
-#include <shellio.hxx>
-#include <frmdlg.hxx>
-#include <usrpref.hxx>
-#include <swtable.hxx>
-#include <tblafmt.hxx>
-#include <caption.hxx>
-#include <idxmrk.hxx>
-#include <poolfmt.hxx>
-#include <breakit.hxx>
-#include <crsskip.hxx>
-#include <modcfg.hxx>
-#include <column.hxx>
-#include <edtwin.hxx>
-#include <shells.hrc>
-#include <popup.hrc>
-#include <swerror.h>
-#include <unochart.hxx>
-
-#include <chartins.hxx>
-
-#define SwTextShell
-#include <sfx2/msg.hxx>
-#include <sfx2/sidebar/EnumContext.hxx>
-#include <swslots.hxx>
-#include <SwRewriter.hxx>
-#include <comcore.hrc>
-
-using namespace ::com::sun::star;
-
-#include <svx/svxdlg.hxx>
-#include <svx/dialogs.hrc>
-#include "swabstdlg.hxx"
-#include <misc.hrc>
-#include <table.hrc>
-#include <frmui.hrc>
-#include <unomid.h>
-
-SFX_IMPL_INTERFACE(SwTextShell, SwBaseShell, SW_RES(STR_SHELLNAME_TEXT))
-{
- SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TEXT_POPUPMENU));
- SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX));
- SFX_CHILDWINDOW_REGISTRATION(FN_EDIT_FORMULA);
- SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD);
- SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_IDX_ENTRY_DLG);
- SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_AUTH_ENTRY_DLG);
- SFX_CHILDWINDOW_REGISTRATION(SID_RUBY_DIALOG);
- SFX_CHILDWINDOW_REGISTRATION(FN_WORDCOUNT_DIALOG);
-}
-
-TYPEINIT1(SwTextShell,SwBaseShell)
-
-void SwTextShell::ExecInsert(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
-
- OSL_ENSURE( !rSh.IsObjSelected() && !rSh.IsFrmSelected(),
- "wrong shell on dispatcher" );
-
- const SfxItemSet *pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem = 0;
- sal_uInt16 nSlot = rReq.GetSlot();
- if(pArgs)
- pArgs->GetItemState(nSlot, false, &pItem );
-
- switch( nSlot )
- {
- case FN_INSERT_STRING:
- if( pItem )
- rSh.InsertByWord(((const SfxStringItem *)pItem)->GetValue());
- break;
-
- case FN_INSERT_SOFT_HYPHEN:
- if( CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, 0 ) &&
- CHAR_SOFTHYPHEN != rSh.SwCrsrShell::GetChar( sal_True, -1 ))
- rSh.Insert( OUString( CHAR_SOFTHYPHEN ) );
- break;
-
- case FN_INSERT_HARDHYPHEN:
- case FN_INSERT_HARD_SPACE:
- {
- const sal_Unicode cIns = FN_INSERT_HARD_SPACE == nSlot ? CHAR_HARDBLANK : CHAR_HARDHYPHEN;
-
- SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
- SvxAutoCorrect* pACorr = rACfg.GetAutoCorrect();
- if( pACorr && rACfg.IsAutoFmtByInput()
- && pACorr->IsAutoCorrFlag(
- CptlSttSntnc | CptlSttWrd | AddNonBrkSpace | ChgOrdinalNumber | ChgToEnEmDash | SetINetAttr | Autocorrect ) )
- {
- rSh.AutoCorrect( *pACorr, cIns );
- }
- else
- {
- rSh.Insert( OUString( cIns ) );
- }
- }
- break;
-
- case SID_INSERT_RLM :
- case SID_INSERT_LRM :
- case SID_INSERT_ZWNBSP :
- case SID_INSERT_ZWSP:
- {
- sal_Unicode cIns = 0;
- switch(nSlot)
- {
- case SID_INSERT_RLM : cIns = CHAR_RLM ; break;
- case SID_INSERT_LRM : cIns = CHAR_LRM ; break;
- case SID_INSERT_ZWSP : cIns = CHAR_ZWSP ; break;
- case SID_INSERT_ZWNBSP: cIns = CHAR_ZWNBSP; break;
- }
- rSh.Insert( OUString( cIns ) );
- }
- break;
-
- case FN_INSERT_BREAK:
- {
- if( !rSh.CrsrInsideInputFld() )
- {
- rSh.SplitNode();
- }
- else
- {
- rSh.InsertLineBreak();
- }
- }
- rReq.Done();
- break;
-
- case FN_INSERT_PAGEBREAK:
- rSh.InsertPageBreak();
- rReq.Done();
- break;
-
- case FN_INSERT_LINEBREAK:
- rSh.InsertLineBreak();
- rReq.Done();
- break;
-
- case FN_INSERT_COLUMN_BREAK:
- rSh.InsertColumnBreak();
- rReq.Done();
- break;
-
- case SID_HYPERLINK_SETLINK:
- if (pItem)
- InsertHyperlink(*((const SvxHyperlinkItem *)pItem));
- rReq.Done();
- break;
-
- case SID_INSERT_AVMEDIA:
- rReq.SetReturnValue(SfxBoolItem(nSlot, InsertMediaDlg( rReq )));
- break;
-
- case SID_INSERT_SOUND:
- case SID_INSERT_VIDEO:
- {
- SvxPluginFileDlg aDlg( &GetView().GetViewFrame()->GetWindow(), nSlot );
- aDlg.SetContext( nSlot == SID_INSERT_SOUND? sfx2::FileDialogHelper::SW_INSERT_SOUND : sfx2::FileDialogHelper::SW_INSERT_VIDEO );
-
- if ( ERRCODE_NONE == aDlg.Execute() )
- {
- // Determine URL
- OUString aStrURL( aDlg.GetPath() );
- aStrURL = URIHelper::SmartRel2Abs(
- INetURLObject(), aStrURL, URIHelper::GetMaybeFileHdl() );
-
- INetURLObject url;
- url.SetSmartProtocol( INET_PROT_FILE );
-
- if ( url.SetURL( aStrURL, INetURLObject::WAS_ENCODED ) )
- {
- OUString aName;
- comphelper::EmbeddedObjectContainer aCnt;
- svt::EmbeddedObjectRef xObj( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT );
- if ( xObj.is() )
- {
- svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() );
-
- // set properties from dialog
- uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
- if ( xSet.is() )
- {
- xSet->setPropertyValue("PluginURL",
- uno::makeAny( OUString( url.GetMainURL( INetURLObject::NO_DECODE ) ) ) );
- }
- }
-
- rSh.InsertObject( xObj, 0, sal_True, nSlot);
- }
- }
- }
- break;
-
- case SID_INSERT_OBJECT:
- case SID_INSERT_PLUGIN:
- {
- SFX_REQUEST_ARG( rReq, pNameItem, SfxGlobalNameItem, SID_INSERT_OBJECT, false );
- SvGlobalName *pName = NULL;
- SvGlobalName aName;
- if ( pNameItem )
- {
- aName = pNameItem->GetValue();
- pName = &aName;
- }
-
- SFX_REQUEST_ARG( rReq, pClassLocationItem, SfxStringItem, FN_PARAM_2, false );
- SFX_REQUEST_ARG( rReq, pCommandsItem, SfxStringItem, FN_PARAM_3, false );
- //TODO/LATER: recording currently not working, need code for Commandlist
- svt::EmbeddedObjectRef xObj;
- if( nSlot == SID_INSERT_PLUGIN && ( pClassLocationItem || pCommandsItem ) )
- {
- OUString sClassLocation;
- if(pClassLocationItem)
- sClassLocation = pClassLocationItem->GetValue();
-
- SvCommandList aCommandList;
- if(pCommandsItem)
- {
- sal_Int32 nTemp;
- aCommandList.AppendCommands( pCommandsItem->GetValue(), &nTemp );
- }
-
- {
- comphelper::EmbeddedObjectContainer aCnt;
- OUString sName;
- xObj.Assign( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence(), sName ),
- embed::Aspects::MSOLE_CONTENT );
- svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() );
- uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
- if ( xSet.is() )
- {
- try
- {
- if ( !sClassLocation.isEmpty() )
- xSet->setPropertyValue("PluginURL",
- uno::makeAny(
- OUString(
- URIHelper::SmartRel2Abs(
- INetURLObject(), sClassLocation,
- URIHelper::GetMaybeFileHdl()) ) ) );
- uno::Sequence< beans::PropertyValue > aSeq;
- if ( aCommandList.size() )
- {
- aCommandList.FillSequence( aSeq );
- xSet->setPropertyValue("PluginCommands", uno::makeAny( aSeq ) );
- }
- }
- catch (const uno::Exception&)
- {
- }
- }
- }
-
- if(xObj.is())
- rSh.InsertOleObject( xObj );
- }
- else
- {
- OSL_ENSURE( !pNameItem || nSlot == SID_INSERT_OBJECT, "Superfluous argument!" );
- rSh.InsertObject( xObj, pName, sal_True, nSlot);
- rReq.Done();
- }
- break;
- }
- case SID_INSERT_FLOATINGFRAME:
- {
- svt::EmbeddedObjectRef xObj;
- SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, FN_PARAM_1, false );
- SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, FN_PARAM_2, false );
- SFX_REQUEST_ARG( rReq, pMarginItem, SvxSizeItem, FN_PARAM_3, false );
- SFX_REQUEST_ARG( rReq, pScrollingItem, SfxByteItem, FN_PARAM_4, false );
- SFX_REQUEST_ARG( rReq, pBorderItem, SfxBoolItem, FN_PARAM_5, false );
-
- if(pURLItem) // URL is a _must_
- {
- comphelper::EmbeddedObjectContainer aCnt;
- OUString aName;
- xObj.Assign( aCnt.CreateEmbeddedObject( SvGlobalName( SO3_IFRAME_CLASSID ).GetByteSequence(), aName ),
- embed::Aspects::MSOLE_CONTENT );
- svt::EmbeddedObjectRef::TryRunningState( xObj.GetObject() );
- uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
- if ( xSet.is() )
- {
- try
- {
- ScrollingMode eScroll = ScrollingAuto;
- if( pScrollingItem && pScrollingItem->GetValue() <= ScrollingAuto )
- eScroll = (ScrollingMode) pScrollingItem->GetValue();
-
- Size aMargin;
- if ( pMarginItem )
- aMargin = pMarginItem->GetSize();
-
- if ( pURLItem )
- xSet->setPropertyValue("FrameURL", uno::makeAny( OUString( pURLItem->GetValue() ) ) );
- if ( pNameItem )
- xSet->setPropertyValue("FrameName", uno::makeAny( OUString( pNameItem->GetValue() ) ) );
-
- if ( eScroll == ScrollingAuto )
- xSet->setPropertyValue("FrameIsAutoScroll",
- uno::makeAny( sal_True ) );
- else
- xSet->setPropertyValue("FrameIsScrollingMode",
- uno::makeAny( (sal_Bool) ( eScroll == ScrollingYes) ) );
-
- if ( pBorderItem )
- xSet->setPropertyValue("FrameIsBorder",
- uno::makeAny( (sal_Bool) pBorderItem->GetValue() ) );
-
- if ( pMarginItem )
- {
- xSet->setPropertyValue("FrameMarginWidth",
- uno::makeAny( sal_Int32( aMargin.Width() ) ) );
-
- xSet->setPropertyValue("FrameMarginHeight",
- uno::makeAny( sal_Int32( aMargin.Height() ) ) );
- }
- }
- catch (const uno::Exception&)
- {
- }
- }
-
- rSh.InsertOleObject( xObj );
- }
- else
- {
- rSh.InsertObject( xObj, 0, sal_True, nSlot);
- rReq.Done();
- }
- }
- break;
- case SID_INSERT_DIAGRAM:
- {
- SvtModuleOptions aMOpt;
- if ( !aMOpt.IsChart() )
- break;
- if(!rReq.IsAPI())
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- SwInsertChart( &GetView().GetEditWin(), &pVFrame->GetBindings() );
- }
- else
- {
- uno::Reference< chart2::data::XDataProvider > xDataProvider;
- sal_Bool bFillWithData = sal_True;
- OUString aRangeString;
- if (!GetShell().IsTblComplexForChart())
- {
- SwFrmFmt* pTblFmt = GetShell().GetTableFmt();
- aRangeString = pTblFmt->GetName();
- aRangeString += OUString( '.' );
- aRangeString += GetShell().GetBoxNms();
-
- // get table data provider
- xDataProvider.set( GetView().GetDocShell()->getIDocumentChartDataProviderAccess()->GetChartDataProvider() );
- }
- else
- bFillWithData = sal_False; // will create chart with only it's default image
-
- SwTableFUNC( &rSh, sal_False ).InsertChart( xDataProvider, bFillWithData, aRangeString );
- rSh.LaunchOLEObj();
-
- svt::EmbeddedObjectRef& xObj = rSh.GetOLEObject();
- if(pItem && xObj.is())
- {
- Size aSize(((SvxSizeItem*)pItem)->GetSize());
- aSize = OutputDevice::LogicToLogic
- ( aSize, MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ) );
-
- if(aSize.Width() > MINLAY&& aSize.Height()> MINLAY)
- {
- awt::Size aSz;
- aSz.Width = aSize.Width();
- aSz.Height = aSize.Height();
- xObj->setVisualAreaSize( xObj.GetViewAspect(), aSz );
- }
- }
- }
- }
- break;
-
- case FN_INSERT_SMA:
- {
- // #i34343# Inserting a math object into an autocompletion crashes
- // the suggestion has to be removed before
- GetView().GetEditWin().StopQuickHelp();
- SvGlobalName aGlobalName( SO3_SM_CLASSID );
- rSh.InsertObject( svt::EmbeddedObjectRef(), &aGlobalName, sal_True, 0 );
- }
- break;
-
- case FN_INSERT_TABLE:
- InsertTable( rReq );
- break;
-
- case FN_INSERT_FRAME_INTERACT_NOCOL:
- case FN_INSERT_FRAME_INTERACT:
- {
- sal_uInt16 nCols = 1;
- bool bModifier1 = rReq.GetModifier() == KEY_MOD1;
- if(pArgs)
- {
- if(FN_INSERT_FRAME_INTERACT_NOCOL != nSlot &&
- pArgs->GetItemState(SID_ATTR_COLUMNS, false, &pItem) == SFX_ITEM_SET)
- nCols = ((SfxUInt16Item *)pItem)->GetValue();
- if(pArgs->GetItemState(SID_MODIFIER, false, &pItem) == SFX_ITEM_SET)
- bModifier1 |= KEY_MOD1 == ((SfxUInt16Item *)pItem)->GetValue();
- }
- if(bModifier1 )
- {
- SwEditWin& rEdtWin = GetView().GetEditWin();
- Size aWinSize = rEdtWin.GetSizePixel();
- Point aStartPos(aWinSize.Width()/2, aWinSize.Height() / 2);
- aStartPos = rEdtWin.PixelToLogic(aStartPos);
- aStartPos.X() -= 8 * MM50;
- aStartPos.Y() -= 4 * MM50;
- Size aSize(16 * MM50, 8 * MM50);
- GetShell().LockPaint();
- GetShell().StartAllAction();
- SwFlyFrmAttrMgr aMgr( sal_True, GetShellPtr(), FRMMGR_TYPE_TEXT );
- if(nCols > 1)
- {
- SwFmtCol aCol;
- aCol.Init( nCols, aCol.GetGutterWidth(), aCol.GetWishWidth() );
- aMgr.SetCol( aCol );
- }
- aMgr.InsertFlyFrm(FLY_AT_PARA, aStartPos, aSize);
- GetShell().EndAllAction();
- GetShell().UnlockPaint();
- }
- else
- {
- GetView().InsFrmMode(nCols);
- }
- rReq.Ignore();
- }
- break;
- case FN_INSERT_FRAME:
- {
- bool bSingleCol = false;
- if( 0!= dynamic_cast< SwWebDocShell*>( GetView().GetDocShell()) )
- {
- SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
- sal_uInt16 nExport = rHtmlOpt.GetExportMode();
- if( HTML_CFG_MSIE == nExport )
- {
- bSingleCol = true;
- }
-
- }
- // Create new border
- SwFlyFrmAttrMgr aMgr( sal_True, GetShellPtr(), FRMMGR_TYPE_TEXT );
- if(pArgs)
- {
- Size aSize(aMgr.GetSize());
- aSize.Width() = GetShell().GetAnyCurRect(RECT_PAGE_PRT).Width();
- Point aPos = aMgr.GetPos();
- RndStdIds eAnchor = FLY_AT_PARA;
- if(pArgs->GetItemState(nSlot, false, &pItem) == SFX_ITEM_SET)
- eAnchor = (RndStdIds)((SfxUInt16Item *)pItem)->GetValue();
- if(pArgs->GetItemState(FN_PARAM_1, false, &pItem) == SFX_ITEM_SET)
- aPos = ((SfxPointItem *)pItem)->GetValue();
- if(pArgs->GetItemState(FN_PARAM_2, false, &pItem) == SFX_ITEM_SET)
- aSize = ((SvxSizeItem *)pItem)->GetSize();
- if(pArgs->GetItemState(SID_ATTR_COLUMNS, false, &pItem) == SFX_ITEM_SET)
- {
- sal_uInt16 nCols = ((SfxUInt16Item *)pItem)->GetValue();
- if( !bSingleCol && 1 < nCols )
- {
- SwFmtCol aFmtCol;
- aFmtCol.Init( nCols , (rReq.IsAPI() ? 0
- : DEF_GUTTER_WIDTH), USHRT_MAX );
- aMgr.SetCol(aFmtCol);
- }
- }
-
- GetShell().LockPaint();
- GetShell().StartAllAction();
-
- aMgr.InsertFlyFrm(eAnchor, aPos, aSize);
-
- GetShell().EndAllAction();
- GetShell().UnlockPaint();
- }
- else
- {
- static const sal_uInt16 aFrmAttrRange[] =
- {
- RES_FRMATR_BEGIN, RES_FRMATR_END-1,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- FN_GET_PRINT_AREA, FN_GET_PRINT_AREA,
- SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE,
- FN_SET_FRM_NAME, FN_SET_FRM_NAME,
- SID_HTML_MODE, SID_HTML_MODE,
- 0
- };
-
- SfxItemSet aSet(GetPool(), aFrmAttrRange );
- aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell())));
- const SwRect &rPg = GetShell().GetAnyCurRect(RECT_PAGE);
- SwFmtFrmSize aFrmSize(ATT_VAR_SIZE, rPg.Width(), rPg.Height());
- aFrmSize.SetWhich(GetPool().GetWhich(SID_ATTR_PAGE_SIZE));
- aSet.Put(aFrmSize);
-
- const SwRect &rPr = GetShell().GetAnyCurRect(RECT_PAGE_PRT);
- SwFmtFrmSize aPrtSize(ATT_VAR_SIZE, rPr.Width(), rPr.Height());
- aPrtSize.SetWhich(GetPool().GetWhich(FN_GET_PRINT_AREA));
- aSet.Put(aPrtSize);
-
- aSet.Put(aMgr.GetAttrSet());
- aSet.SetParent( aMgr.GetAttrSet().GetParent() );
-
- // Delete minimum size in columns.
- SvxBoxInfoItem aBoxInfo((SvxBoxInfoItem &)aSet.Get(SID_ATTR_BORDER_INNER));
- const SvxBoxItem& rBox = (const SvxBoxItem&)aSet.Get(RES_BOX);
- aBoxInfo.SetMinDist(false);
- aBoxInfo.SetDefDist(rBox.GetDistance(BOX_LINE_LEFT));
- aSet.Put(aBoxInfo);
-
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebDocShell, GetView().GetDocShell()));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- SfxAbstractTabDialog* pDlg = pFact->CreateFrmTabDialog("FrameDialog",
- GetView().GetViewFrame(),
- &GetView().GetViewFrame()->GetWindow(),
- aSet, true);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if(pDlg->Execute() == RET_OK && pDlg->GetOutputItemSet())
- {
- //local variable necessary at least after call of .AutoCaption() because this could be deleted at this point
- SwWrtShell& rShell = GetShell();
- rShell.LockPaint();
- rShell.StartAllAction();
- rShell.StartUndo(UNDO_INSERT);
-
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- aMgr.SetAttrSet(*pOutSet);
-
- // At first delete the selection at the ClickToEditField.
- if( rShell.IsInClickToEdit() )
- rShell.DelRight();
-
- aMgr.InsertFlyFrm();
-
- uno::Reference< frame::XDispatchRecorder > xRecorder =
- GetView().GetViewFrame()->GetBindings().GetRecorder();
- if ( xRecorder.is() )
- {
- //FN_INSERT_FRAME
- sal_uInt16 nAnchor = (sal_uInt16)aMgr.GetAnchor();
- rReq.AppendItem(SfxUInt16Item(nSlot, nAnchor));
- rReq.AppendItem(SfxPointItem(FN_PARAM_1, rShell.GetObjAbsPos()));
- rReq.AppendItem(SvxSizeItem(FN_PARAM_2, rShell.GetObjSize()));
- rReq.Done();
- }
-
- GetView().AutoCaption(FRAME_CAP);
-
- {
- SwRewriter aRewriter;
-
- aRewriter.AddRule(UndoArg1, SW_RESSTR(STR_FRAME));
-
- rShell.EndUndo(UNDO_INSERT, &aRewriter);
- }
- rShell.EndAllAction();
- rShell.UnlockPaint();
- }
-
- DELETEZ(pDlg);
- }
- break;
- }
- case FN_FORMAT_COLUMN :
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- VclAbstractDialog* pColDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rSh, DLG_COLUMN);
- OSL_ENSURE(pColDlg, "Dialogdiet fail!");
- pColDlg->Execute();
- delete pColDlg;
- }
- break;
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
-}
-
-static bool lcl_IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect )
-{
- rWrtSh.SwapPam();
- bool bRet = pSect == rWrtSh.GetCurrSection();
- rWrtSh.SwapPam();
- return bRet;
-}
-
-void SwTextShell::StateInsert( SfxItemSet &rSet )
-{
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- SfxWhichIter aIter( rSet );
- SwWrtShell &rSh = GetShell();
- sal_uInt16 nWhich = aIter.FirstWhich();
- SvtModuleOptions aMOpt;
- SfxObjectCreateMode eCreateMode =
- GetView().GetDocShell()->GetCreateMode();
-
- rSh.Push();
- const sal_Bool bCrsrInHidden = rSh.SelectHiddenRange();
- rSh.Pop();
-
- while ( nWhich )
- {
- switch ( nWhich )
- {
- case SID_INSERT_AVMEDIA:
- case SID_INSERT_SOUND:
- case SID_INSERT_VIDEO:
- if ( GetShell().IsSelFrmMode()
- || GetShell().CrsrInsideInputFld()
- || SFX_CREATE_MODE_EMBEDDED == eCreateMode
- || bCrsrInHidden )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case SID_INSERT_DIAGRAM:
- if( !aMOpt.IsChart()
- || GetShell().CrsrInsideInputFld()
- || eCreateMode == SFX_CREATE_MODE_EMBEDDED
- || bCrsrInHidden )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case FN_INSERT_SMA:
- if( !aMOpt.IsMath()
- || eCreateMode == SFX_CREATE_MODE_EMBEDDED
- || bCrsrInHidden
- || rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case SID_INSERT_FLOATINGFRAME:
- case SID_INSERT_OBJECT:
- case SID_INSERT_PLUGIN:
- {
- if( eCreateMode == SFX_CREATE_MODE_EMBEDDED || bCrsrInHidden )
- {
- rSet.DisableItem( nWhich );
- }
- else if( GetShell().IsSelFrmMode()
- || GetShell().CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- else if(SID_INSERT_FLOATINGFRAME == nWhich && nHtmlMode&HTMLMODE_ON)
- {
- SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
- sal_uInt16 nExport = rHtmlOpt.GetExportMode();
- if(HTML_CFG_MSIE != nExport && HTML_CFG_WRITER != nExport )
- rSet.DisableItem(nWhich);
- }
- }
- break;
-
- case FN_INSERT_FRAME_INTERACT_NOCOL :
- case FN_INSERT_FRAME_INTERACT:
- {
- if( GetShell().IsSelFrmMode()
- || GetShell().CrsrInsideInputFld()
- || bCrsrInHidden )
- rSet.DisableItem(nWhich);
- }
- break;
-
- case SID_HYPERLINK_GETLINK:
- {
- SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
- rSh.GetCurAttr( aSet );
-
- SvxHyperlinkItem aHLinkItem;
- const SfxPoolItem* pItem;
- if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, false, &pItem))
- {
- const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem;
- aHLinkItem.SetURL(pINetFmt->GetValue());
- aHLinkItem.SetTargetFrame(pINetFmt->GetTargetFrame());
- aHLinkItem.SetIntName(pINetFmt->GetName());
- const SvxMacro *pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSEOVER_OBJECT );
- if( pMacro )
- aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSEOVER_OBJECT, *pMacro);
-
- pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSECLICK_OBJECT );
- if( pMacro )
- aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSECLICK_OBJECT, *pMacro);
-
- pMacro = pINetFmt->GetMacro( SFX_EVENT_MOUSEOUT_OBJECT );
- if( pMacro )
- aHLinkItem.SetMacro(HYPERDLG_EVENT_MOUSEOUT_OBJECT, *pMacro);
-
- // Get the text of the Link.
- rSh.StartAction();
- rSh.CreateCrsr();
- rSh.SwCrsrShell::SelectTxtAttr(RES_TXTATR_INETFMT,sal_True);
- OUString sLinkName = rSh.GetSelTxt();
- aHLinkItem.SetName(sLinkName);
- aHLinkItem.SetInsertMode(HLINK_FIELD);
- rSh.DestroyCrsr();
- rSh.EndAction();
- }
- else
- {
- OUString sReturn = rSh.GetSelTxt();
- sReturn = sReturn.copy(0, std::min<sal_Int32>(255, sReturn.getLength()));
- aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' '));
- }
-
- aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() |
- ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0)));
- aHLinkItem.SetMacroEvents ( HYPERDLG_EVENT_MOUSEOVER_OBJECT|
- HYPERDLG_EVENT_MOUSECLICK_OBJECT | HYPERDLG_EVENT_MOUSEOUT_OBJECT );
-
- rSet.Put(aHLinkItem);
- }
- break;
-
- case FN_INSERT_FRAME:
- if (rSh.IsSelFrmMode() )
- {
- const int nSel = rSh.GetSelectionType();
- if( ((nsSelectionType::SEL_GRF | nsSelectionType::SEL_OLE ) & nSel ) || bCrsrInHidden )
- rSet.DisableItem(nWhich);
- }
- else if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem(nWhich);
- }
- break;
-
- case FN_FORMAT_COLUMN :
- {
- //#i80458# column dialog cannot work if the selection contains different page styles and different sections
- bool bDisable = true;
- if( rSh.GetFlyFrmFmt() || rSh.GetSelectedPageDescs() )
- bDisable = false;
- if( bDisable )
- {
- const SwSection* pCurrSection = rSh.GetCurrSection();
- sal_uInt16 nFullSectCnt = rSh.GetFullSelectedSectionCount();
- if( pCurrSection && ( !rSh.HasSelection() || 0 != nFullSectCnt ))
- bDisable = false;
- else if(
- rSh.HasSelection() && rSh.IsInsRegionAvailable() &&
- ( !pCurrSection || ( 1 != nFullSectCnt &&
- lcl_IsMarkInSameSection( rSh, pCurrSection ) )))
- bDisable = false;
- }
- if(bDisable)
- rSet.DisableItem(nWhich);
- }
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-void SwTextShell::ExecDelete(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- switch( rReq.GetSlot() )
- {
- case FN_DELETE_SENT:
- if( rSh.IsTableMode() )
- {
- rSh.DeleteRow();
- rSh.EnterStdMode();
- }
- else
- rSh.DelToEndOfSentence();
- break;
- case FN_DELETE_BACK_SENT:
- rSh.DelToStartOfSentence();
- break;
- case FN_DELETE_WORD:
- rSh.DelNxtWord();
- break;
- case FN_DELETE_BACK_WORD:
- rSh.DelPrvWord();
- break;
- case FN_DELETE_LINE:
- rSh.DelToEndOfLine();
- break;
- case FN_DELETE_BACK_LINE:
- rSh.DelToStartOfLine();
- break;
- case FN_DELETE_PARA:
- rSh.DelToEndOfPara();
- break;
- case FN_DELETE_BACK_PARA:
- rSh.DelToStartOfPara();
- break;
- case FN_DELETE_WHOLE_LINE:
- rSh.DelLine();
- break;
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
- rReq.Done();
-}
-
-void SwTextShell::ExecTransliteration( SfxRequest & rReq )
-{
- using namespace ::com::sun::star::i18n;
- sal_uInt32 nMode = 0;
-
- switch( rReq.GetSlot() )
- {
- case SID_TRANSLITERATE_SENTENCE_CASE:
- nMode = TransliterationModulesExtra::SENTENCE_CASE;
- break;
- case SID_TRANSLITERATE_TITLE_CASE:
- nMode = TransliterationModulesExtra::TITLE_CASE;
- break;
- case SID_TRANSLITERATE_TOGGLE_CASE:
- nMode = TransliterationModulesExtra::TOGGLE_CASE;
- break;
- case SID_TRANSLITERATE_UPPER:
- nMode = TransliterationModules_LOWERCASE_UPPERCASE;
- break;
- case SID_TRANSLITERATE_LOWER:
- nMode = TransliterationModules_UPPERCASE_LOWERCASE;
- break;
-
- case SID_TRANSLITERATE_HALFWIDTH:
- nMode = TransliterationModules_FULLWIDTH_HALFWIDTH;
- break;
- case SID_TRANSLITERATE_FULLWIDTH:
- nMode = TransliterationModules_HALFWIDTH_FULLWIDTH;
- break;
-
- case SID_TRANSLITERATE_HIRAGANA:
- nMode = TransliterationModules_KATAKANA_HIRAGANA;
- break;
- case SID_TRANSLITERATE_KATAGANA:
- nMode = TransliterationModules_HIRAGANA_KATAKANA;
- break;
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- }
-
- if( nMode )
- GetShell().TransliterateText( nMode );
-}
-
-void SwTextShell::ExecRotateTransliteration( SfxRequest & rReq )
-{
- if( rReq.GetSlot() == SID_TRANSLITERATE_ROTATE_CASE )
- GetShell().TransliterateText( m_aRotateCase.getNextMode() );
-}
-
-SwTextShell::SwTextShell(SwView &_rView) :
- SwBaseShell(_rView), pPostItFldMgr( 0 )
-{
- SetName(OUString("Text"));
- SetHelpId(SW_TEXTSHELL);
- SfxShell::SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_Text));
-}
-
-SwTextShell::~SwTextShell()
-{
-}
-
-void SwTextShell::InsertSymbol( SfxRequest& rReq )
-{
- const SfxItemSet *pArgs = rReq.GetArgs();
- const SfxPoolItem* pItem = 0;
- if( pArgs )
- pArgs->GetItemState(GetPool().GetWhich(SID_CHARMAP), false, &pItem);
-
- OUString aChars, aFontName;
- if ( pItem )
- {
- aChars = ((const SfxStringItem*)pItem)->GetValue();
- const SfxPoolItem* pFtItem = NULL;
- pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem);
- const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem );
- if ( pFontItem )
- aFontName = pFontItem->GetValue();
- }
-
- SwWrtShell &rSh = GetShell();
- SfxItemSet aSet( GetPool(), RES_CHRATR_FONT, RES_CHRATR_FONT,
- RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
- RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT,
- 0 );
- rSh.GetCurAttr( aSet );
- sal_uInt16 nScript = rSh.GetScriptType();
-
- SvxFontItem aFont( RES_CHRATR_FONT );
- {
- SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
- aSetItem.GetItemSet().Put( aSet, false );
- const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
- if( pI )
- aFont = *(SvxFontItem*)pI;
- else
- aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
- RES_CHRATR_FONT,
- GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ));
- if (aFontName.isEmpty())
- aFontName = aFont.GetFamilyName();
- }
-
- Font aNewFont(aFontName, Size(1,1)); // Size only because CTOR.
- if( aChars.isEmpty() )
- {
- // Set selected font as default.
- SfxAllItemSet aAllSet( rSh.GetAttrPool() );
- aAllSet.Put( SfxBoolItem( FN_PARAM_1, false ) );
-
- SwViewOption aOpt(*GetShell().GetViewOptions());
- OUString sSymbolFont = aOpt.GetSymbolFont();
- if( aFontName.isEmpty() && !sSymbolFont.isEmpty() )
- aAllSet.Put( SfxStringItem( SID_FONT_NAME, sSymbolFont ) );
- else
- aAllSet.Put( SfxStringItem( SID_FONT_NAME, aFont.GetFamilyName() ) );
-
- SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
- SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aAllSet,
- GetView().GetViewFrame()->GetFrame().GetFrameInterface(), RID_SVXDLG_CHARMAP );
- if( RET_OK == pDlg->Execute() )
- {
- SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pCItem, SfxStringItem, SID_CHARMAP, false );
- SFX_ITEMSET_ARG( pDlg->GetOutputItemSet(), pFontItem, SvxFontItem, SID_ATTR_CHAR_FONT, false );
- if ( pFontItem )
- {
- aNewFont.SetName( pFontItem->GetFamilyName() );
- aNewFont.SetStyleName( pFontItem->GetStyleName() );
- aNewFont.SetCharSet( pFontItem->GetCharSet() );
- aNewFont.SetPitch( pFontItem->GetPitch() );
- }
-
- if ( pCItem )
- {
- aChars = pCItem->GetValue();
- aOpt.SetSymbolFont(aNewFont.GetName());
- SW_MOD()->ApplyUsrPref(aOpt, &GetView());
- }
- }
-
- delete pDlg;
- }
-
- if( !aChars.isEmpty() )
- {
- rSh.StartAllAction();
-
- // Delete selected content.
- SwRewriter aRewriter;
- aRewriter.AddRule(UndoArg1, SW_RESSTR(STR_SPECIALCHAR));
-
- rSh.StartUndo( UNDO_INSERT, &aRewriter );
- if ( rSh.HasSelection() )
- {
- rSh.DelRight();
- aSet.ClearItem();
- rSh.GetCurAttr( aSet );
-
- SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() );
- aSetItem.GetItemSet().Put( aSet, false );
- const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript );
- if( pI )
- aFont = *(SvxFontItem*)pI;
- else
- aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript(
- RES_CHRATR_FONT,
- GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ));
- }
-
- // Insert character.
- rSh.Insert( aChars );
-
- // #108876# a font attribute has to be set always due to a guessed script type
- if( !aNewFont.GetName().isEmpty() )
- {
- SvxFontItem aNewFontItem( aFont );
- aNewFontItem.SetFamilyName( aNewFont.GetName());
- aNewFontItem.SetFamily( aNewFont.GetFamily());
- aNewFontItem.SetPitch( aNewFont.GetPitch());
- aNewFontItem.SetCharSet( aNewFont.GetCharSet() );
-
- SfxItemSet aRestoreSet( GetPool(), RES_CHRATR_FONT, RES_CHRATR_FONT,
- RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONT,
- RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT, 0 );
-
- nScript = g_pBreakIt->GetAllScriptsOfText( aChars );
- if( SCRIPTTYPE_LATIN & nScript )
- {
- aRestoreSet.Put( aSet.Get( RES_CHRATR_FONT, sal_True ) );
- aSet.Put( aNewFontItem, RES_CHRATR_FONT);
- }
- if( SCRIPTTYPE_ASIAN & nScript )
- {
- aRestoreSet.Put( aSet.Get( RES_CHRATR_CJK_FONT, sal_True ) );
- aSet.Put( aNewFontItem, RES_CHRATR_CJK_FONT );
- }
- if( SCRIPTTYPE_COMPLEX & nScript )
- {
- aRestoreSet.Put( aSet.Get( RES_CHRATR_CTL_FONT, sal_True ) );
- aSet.Put( aNewFontItem, RES_CHRATR_CTL_FONT );
- }
-
- rSh.SetMark();
- rSh.ExtendSelection( sal_False, aChars.getLength() );
- rSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND | nsSetAttrMode::SETATTR_NOFORMATATTR );
- if( !rSh.IsCrsrPtAtEnd() )
- rSh.SwapPam();
-
- rSh.ClearMark();
-
- // #i75891#
- // SETATTR_DONTEXPAND does not work if there are already hard attributes.
- // Therefore we have to restore the font attributes.
- rSh.SetMark();
- rSh.SetAttrSet( aRestoreSet );
- rSh.ClearMark();
-
- rSh.UpdateAttr();
- aFont = aNewFontItem;
- }
-
- rSh.EndAllAction();
- rSh.EndUndo();
-
- if ( !aChars.isEmpty() )
- {
- rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), aChars ) );
- rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aNewFont.GetName() ) );
- rReq.Done();
- }
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
deleted file mode 100644
index b346e8856bba..000000000000
--- a/sw/source/ui/shells/textsh1.cxx
+++ /dev/null
@@ -1,1811 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <com/sun/star/i18n/WordType.hpp>
-#include <com/sun/star/ui/dialogs/XSLTFilterDialog.hpp>
-
-#include <comphelper/processfactory.hxx>
-#include <hintids.hxx>
-#include <cmdid.h>
-#include <helpid.h>
-
-#include <i18nlangtag/languagetag.hxx>
-#include <svl/languageoptions.hxx>
-#include <editeng/langitem.hxx>
-#include <svtools/langtab.hxx>
-#include <svl/slstitm.hxx>
-#include <string.h>
-#include <svl/stritem.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <svl/whiter.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/objitem.hxx>
-#include <vcl/unohelp2.hxx>
-#include <sfx2/request.hxx>
-#include <svl/eitem.hxx>
-#include <svl/macitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/colritem.hxx>
-#include <editeng/tstpitem.hxx>
-#include <editeng/brushitem.hxx>
-#include <editeng/svxacorr.hxx>
-#include <svl/cjkoptions.hxx>
-#include <svl/ctloptions.hxx>
-#include <IDocumentSettingAccess.hxx>
-#include <charfmt.hxx>
-#include <editeng/fontitem.hxx>
-#include <svx/SmartTagItem.hxx>
-#include <fmtinfmt.hxx>
-#include <swwait.hxx>
-#include <wrtsh.hxx>
-#include <wview.hxx>
-#include <swmodule.hxx>
-#include <viewopt.hxx>
-#include <uitool.hxx>
-#include <swevent.hxx>
-#include <pagedesc.hxx>
-#include <textsh.hxx>
-#include <IMark.hxx>
-#include <swdtflvr.hxx>
-#include <docstat.hxx>
-#include <outline.hxx>
-#include <tablemgr.hxx>
-#include <swundo.hxx>
-#include <reffld.hxx>
-#include <docsh.hxx>
-#include <mdiexp.hxx>
-#include <inputwin.hxx>
-#include <chrdlgmodes.hxx>
-#include <pardlg.hxx>
-#include <frmatr.hxx>
-#include <fmtcol.hxx>
-#include <cellatr.hxx>
-#include <edtwin.hxx>
-#include <redlndlg.hxx>
-#include "fldmgr.hxx"
-
-#include <globals.hrc>
-#include <shells.hrc>
-#include <app.hrc>
-#include <web.hrc>
-#include "paratr.hxx"
-#include <crsskip.hxx>
-#include <vcl/svapp.hxx>
-#include <sfx2/app.hxx>
-#include <breakit.hxx>
-
-#include <SwSmartTagMgr.hxx>
-
-#include <editeng/acorrcfg.hxx>
-#include "swabstdlg.hxx"
-#include "misc.hrc"
-#include "chrdlg.hrc"
-#include <IDocumentStatistics.hxx>
-
-#include <sfx2/sfxdlg.hxx>
-#include <unotools/lingucfg.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/uno/Any.hxx>
-#include <editeng/unolingu.hxx>
-#include <unotools/syslocaleoptions.hxx>
-#include <doc.hxx>
-#include <view.hxx>
-#include <ndtxt.hxx>
-#include <pam.hxx>
-#include <sfx2/objface.hxx>
-#include <langhelper.hxx>
-#include <uiitems.hxx>
-#include <wordcountdialog.hxx>
-#include <tools/diagnose_ex.h>
-#include <svx/nbdtmgfact.hxx>
-#include <svx/nbdtmg.hxx>
-#include <numrule.hxx>
-
-using namespace ::com::sun::star;
-using namespace svx::sidebar;
-
-void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq )
-{
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rWrtSh.GetView()));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
- SfxItemSet aCoreSet( rWrtSh.GetView().GetPool(),
- RES_CHRATR_BEGIN, RES_CHRATR_END-1,
- RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
- RES_BACKGROUND, RES_BACKGROUND,
- RES_BOX, RES_BOX,
- RES_SHADOW, RES_SHADOW,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- FN_PARAM_SELECTION, FN_PARAM_SELECTION,
- SID_HTML_MODE, SID_HTML_MODE,
- SID_ATTR_CHAR_WIDTH_FIT_TO_LINE, SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
- 0 );
- rWrtSh.GetCurAttr( aCoreSet );
- sal_Bool bSel = rWrtSh.HasSelection();
- sal_Bool bSelectionPut = sal_False;
- if(bSel || rWrtSh.IsInWord())
- {
- if(!bSel)
- {
- rWrtSh.StartAction();
- rWrtSh.Push();
- if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
- rWrtSh.SelWrd();
- }
- aCoreSet.Put(SfxStringItem(FN_PARAM_SELECTION, rWrtSh.GetSelTxt()));
- bSelectionPut = sal_True;
- if(!bSel)
- {
- rWrtSh.Pop(sal_False);
- rWrtSh.EndAction();
- }
- }
- aCoreSet.Put( SfxUInt16Item( SID_ATTR_CHAR_WIDTH_FIT_TO_LINE,
- rWrtSh.GetScalingOfSelectedText() ) );
-
- ::ConvertAttrCharToGen(aCoreSet, CONV_ATTR_STD);
-
- // Setting the BoxInfo
- ::PrepareBoxInfo( aCoreSet, rWrtSh );
-
- aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(rWrtSh.GetView().GetDocShell())));
- SfxAbstractTabDialog* pDlg = NULL;
- if ( bUseDialog && GetActiveView() )
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- pDlg = pFact->CreateSwCharDlg(rWrtSh.GetView().GetWindow(), rWrtSh.GetView(), aCoreSet, DLG_CHAR_STD);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if( FN_INSERT_HYPERLINK == nSlot )
- pDlg->SetCurPageId("hyperlink");
- }
- if (pDlg && nSlot == SID_CHAR_DLG_EFFECT)
- {
- pDlg->SetCurPageId("fonteffect");
- }
-
- const SfxItemSet* pSet = NULL;
- if ( !bUseDialog )
- pSet = pArgs;
- else if ( NULL != pDlg && pDlg->Execute() == RET_OK ) /* #110771# pDlg can be NULL */
- {
- pSet = pDlg->GetOutputItemSet();
- }
-
- if ( pSet)
- {
- SfxItemSet aTmpSet( *pSet );
- ::ConvertAttrGenToChar(aTmpSet, CONV_ATTR_STD);
-
- const SfxPoolItem* pSelectionItem;
- sal_Bool bInsert = sal_False;
- sal_Int32 nInsert = 0;
-
- // The old item is for unknown reasons back in the set again.
- if( !bSelectionPut && SFX_ITEM_SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, false, &pSelectionItem) )
- {
- OUString sInsert = ((const SfxStringItem*)pSelectionItem)->GetValue();
- bInsert = !sInsert.isEmpty();
- if(bInsert)
- {
- nInsert = sInsert.getLength();
- rWrtSh.StartAction();
- rWrtSh.Insert( sInsert );
- rWrtSh.SetMark();
- rWrtSh.ExtendSelection(sal_False, sInsert.getLength());
- SfxRequest aReq( rWrtSh.GetView().GetViewFrame(), FN_INSERT_STRING );
- aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) );
- aReq.Done();
- SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_LEFT );
- aReq1.AppendItem( SfxInt32Item(FN_PARAM_MOVE_COUNT, nInsert) );
- aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, true) );
- aReq1.Done();
- }
- }
- aTmpSet.ClearItem(FN_PARAM_SELECTION);
-
- SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
- if(bSel && rWrtSh.IsSelFullPara() && pColl && pColl->IsAutoUpdateFmt())
- {
- rWrtSh.AutoUpdatePara(pColl, aTmpSet);
- }
- else
- rWrtSh.SetAttrSet( aTmpSet );
- if (pReq)
- pReq->Done(aTmpSet);
- if(bInsert)
- {
- SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_RIGHT );
- aReq1.AppendItem( SfxInt32Item(FN_PARAM_MOVE_COUNT, nInsert) );
- aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, false) );
- aReq1.Done();
- rWrtSh.SwapPam();
- rWrtSh.ClearMark();
- rWrtSh.DontExpandFmt();
- rWrtSh.EndAction();
- }
- }
-
- delete pDlg;
-}
-
-static short lcl_AskRedlineMode(Window *pWin)
-{
- MessBox aQBox( pWin, 0,
- OUString( SW_RES( STR_REDLINE_TITLE ) ),
- OUString( SW_RES( STR_REDLINE_MSG ) ) );
- aQBox.SetImage( QueryBox::GetStandardImage() );
- sal_uInt16 nBtnFlags = BUTTONDIALOG_DEFBUTTON |
- BUTTONDIALOG_OKBUTTON |
- BUTTONDIALOG_FOCUSBUTTON;
-
- aQBox.AddButton(OUString(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags);
- aQBox.GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT);
- aQBox.AddButton(OUString(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON);
- aQBox.GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT );
- aQBox.AddButton(OUString(SW_RES(STR_REDLINE_EDIT)), 2, 0);
- aQBox.GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG);
- aQBox.SetButtonHelpText( RET_OK, OUString() );
-
- return aQBox.Execute();
-}
-
-void SwTextShell::Execute(SfxRequest &rReq)
-{
- bool bUseDialog = true;
- const SfxItemSet *pArgs = rReq.GetArgs();
- SwWrtShell& rWrtSh = GetShell();
- const SfxPoolItem* pItem = 0;
- sal_uInt16 nSlot = rReq.GetSlot();
- if(pArgs)
- pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
- switch( nSlot )
- {
- case SID_LANGUAGE_STATUS:
- {
- // get the language
- OUString aNewLangTxt;
- SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_LANGUAGE_STATUS , false );
- if (pItem2)
- aNewLangTxt = pItem2->GetValue();
-
- //!! Remember the view frame right now...
- //!! (call to GetView().GetViewFrame() will break if the
- //!! SwTextShell got destroyed meanwhile.)
- SfxViewFrame *pViewFrame = GetView().GetViewFrame();
-
- if (aNewLangTxt == "*")
- {
- // open the dialog "Tools/Options/Language Settings - Language"
- // to set the documents default language
- SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
- if (pFact)
- {
- VclAbstractDialog* pDlg = pFact->CreateVclDialog( GetView().GetWindow(), SID_LANGUAGE_OPTIONS );
- pDlg->Execute();
- delete pDlg;
- }
- }
- else
- {
- //!! We have to use StartAction / EndAction bracketing in
- //!! order to prevent possible destruction of the SwTextShell
- //!! due to the selection changes coming below.
- rWrtSh.StartAction();
- // prevent view from jumping because of (temporary) selection changes
- rWrtSh.LockView( sal_True );
-
- // setting the new language...
- if (!aNewLangTxt.isEmpty())
- {
- const OUString aSelectionLangPrefix("Current_");
- const OUString aParagraphLangPrefix("Paragraph_");
- const OUString aDocumentLangPrefix("Default_");
- const OUString aStrNone("LANGUAGE_NONE");
- const OUString aStrResetLangs("RESET_LANGUAGES");
-
- SfxItemSet aCoreSet( GetPool(),
- RES_CHRATR_LANGUAGE, RES_CHRATR_LANGUAGE,
- RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
- RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_LANGUAGE,
- 0 );
-
- sal_Int32 nPos = 0;
- bool bForSelection = true;
- bool bForParagraph = false;
- if (-1 != (nPos = aNewLangTxt.indexOf( aSelectionLangPrefix, 0 )))
- {
- // ... for the current selection
- aNewLangTxt = aNewLangTxt.replaceAt(nPos, aSelectionLangPrefix.getLength(), "");
- bForSelection = true;
- }
- else if (-1 != (nPos = aNewLangTxt.indexOf(aParagraphLangPrefix, 0)))
- {
- // ... for the current paragraph language
- aNewLangTxt = aNewLangTxt.replaceAt(nPos, aParagraphLangPrefix.getLength(), "");
- bForSelection = true;
- bForParagraph = true;
- }
- else if (-1 != (nPos = aNewLangTxt.indexOf(aDocumentLangPrefix, 0)))
- {
- // ... as default document language
- aNewLangTxt = aNewLangTxt.replaceAt(nPos, aDocumentLangPrefix.getLength(), "");
- bForSelection = false;
- }
-
- if (bForParagraph || !bForSelection)
- {
- rWrtSh.Push(); // save selection for later restoration
- rWrtSh.ClearMark(); // fdo#67796: invalidate table crsr
- }
-
- if (bForParagraph)
- SwLangHelper::SelectCurrentPara( rWrtSh );
-
- if (!bForSelection) // document language to be changed...
- {
- rWrtSh.SelAll();
- rWrtSh.ExtendedSelectAll();
- }
-
- rWrtSh.StartUndo( ( !bForParagraph && !bForSelection ) ? UNDO_SETDEFTATTR : UNDO_EMPTY );
- if (aNewLangTxt == aStrNone)
- SwLangHelper::SetLanguage_None( rWrtSh, bForSelection, aCoreSet );
- else if (aNewLangTxt == aStrResetLangs)
- SwLangHelper::ResetLanguages( rWrtSh, bForSelection );
- else
- SwLangHelper::SetLanguage( rWrtSh, aNewLangTxt, bForSelection, aCoreSet );
- rWrtSh.EndUndo();
-
- if (bForParagraph || !bForSelection)
- {
- rWrtSh.Pop(false); // restore selection...
- }
- }
-
- rWrtSh.LockView( sal_False );
- rWrtSh.EndAction();
- }
-
- // invalidate slot to get the new language displayed
- pViewFrame->GetBindings().Invalidate( nSlot );
-
- rReq.Done();
- break;
- }
-
- case SID_THES:
- {
- // replace word/selection with text from selected sub menu entry
- OUString aReplaceText;
- SFX_REQUEST_ARG( rReq, pItem2, SfxStringItem, SID_THES , false );
- if (pItem2)
- aReplaceText = pItem2->GetValue();
- if (!aReplaceText.isEmpty())
- {
- SwView &rView2 = rWrtSh.GetView();
- const bool bSelection = rWrtSh.HasSelection();
- const OUString aLookUpText = rView2.GetThesaurusLookUpText( bSelection );
- rView2.InsertThesaurusSynonym( aReplaceText, aLookUpText, bSelection );
- }
- }
- break;
-
- case SID_CHARMAP:
- {
- InsertSymbol( rReq );
- }
- break;
- case FN_INSERT_FOOTNOTE:
- case FN_INSERT_ENDNOTE:
- {
- OUString aStr;
- SFX_REQUEST_ARG( rReq, pFont, SfxStringItem, FN_PARAM_1 , false );
- SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, nSlot , false );
- if ( pNameItem )
- aStr = pNameItem->GetValue();
- bool bFont = pFont && !pFont->GetValue().isEmpty();
- rWrtSh.StartUndo( UNDO_UI_INSERT_FOOTNOTE );
- rWrtSh.InsertFootnote( aStr, nSlot == FN_INSERT_ENDNOTE, !bFont );
- if ( bFont )
- {
- rWrtSh.Left( CRSR_SKIP_CHARS, sal_True, 1, sal_False );
- SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT );
- rWrtSh.GetCurAttr( aSet );
- SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT );
- SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(),
- rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT );
- rWrtSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND );
- rWrtSh.ResetSelect(0, sal_False);
- rWrtSh.EndSelect();
- rWrtSh.GotoFtnTxt();
- }
- rWrtSh.EndUndo( UNDO_UI_INSERT_FOOTNOTE );
- rReq.Done();
- }
- break;
- case FN_INSERT_FOOTNOTE_DLG:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- AbstractInsFootNoteDlg* pDlg = pFact->CreateInsFootNoteDlg(
- GetView().GetWindow(), rWrtSh, sal_False);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->SetHelpId(GetStaticInterface()->GetSlot(nSlot)->GetCommand());
- if ( pDlg->Execute() == RET_OK )
- {
- sal_uInt16 nId = pDlg->IsEndNote() ? FN_INSERT_ENDNOTE : FN_INSERT_FOOTNOTE;
- SfxRequest aReq( GetView().GetViewFrame(), nId );
- if ( !pDlg->GetStr().isEmpty() )
- aReq.AppendItem( SfxStringItem( nId, pDlg->GetStr() ) );
- if ( !pDlg->GetFontName().isEmpty() )
- aReq.AppendItem( SfxStringItem( FN_PARAM_1, pDlg->GetFontName() ) );
- ExecuteSlot( aReq );
- }
-
- rReq.Ignore();
- delete pDlg;
- }
- break;
- case FN_FORMAT_FOOTNOTE_DLG:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- VclAbstractDialog* pDlg = pFact->CreateSwFootNoteOptionDlg(GetView().GetWindow(), rWrtSh);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- break;
- }
- case SID_INSERTDOC:
- {
- GetView().ExecuteInsertDoc( rReq, pItem );
- break;
- }
- case FN_FORMAT_RESET:
- {
- // #i78856, reset all attributes but not the language attributes
- // (for this build an array of all relevant attributes and
- // remove the languages from that)
- std::set<sal_uInt16> aAttribs;
-
- sal_uInt16 aResetableSetRange[] = {
- RES_FRMATR_BEGIN, RES_FRMATR_END-1,
- RES_CHRATR_BEGIN, RES_CHRATR_LANGUAGE - 1,
- RES_CHRATR_LANGUAGE + 1, RES_CHRATR_CJK_LANGUAGE - 1,
- RES_CHRATR_CJK_LANGUAGE + 1, RES_CHRATR_CTL_LANGUAGE - 1,
- RES_CHRATR_CTL_LANGUAGE + 1, RES_CHRATR_END-1,
- RES_PARATR_BEGIN, RES_PARATR_END-1,
- RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0
- };
- sal_uInt16 *pUShorts = aResetableSetRange;
- while (*pUShorts)
- {
- sal_uInt16 nL = pUShorts[1] - pUShorts[0] + 1;
- sal_uInt16 nE = pUShorts[0];
- for (sal_uInt16 i = 0; i < nL; ++i)
- aAttribs.insert( aAttribs.end(), nE++ );
- pUShorts += 2;
- }
- // we don't want to change writing direction.
- aAttribs.erase( RES_FRAMEDIR );
- rWrtSh.ResetAttr( aAttribs );
- rReq.Done();
- break;
- }
- case FN_INSERT_BREAK_DLG:
- {
- sal_uInt16 nKind=0;
- ::boost::optional<sal_uInt16> oPageNumber;
- OUString aTemplateName;
- if ( pItem )
- {
- nKind = ((SfxInt16Item*)pItem)->GetValue();
- SFX_REQUEST_ARG( rReq, pTemplate, SfxStringItem, FN_PARAM_1 , false );
- SFX_REQUEST_ARG( rReq, pNumber, SfxUInt16Item, FN_PARAM_2 , false );
- SFX_REQUEST_ARG( rReq, pIsNumberFilled, SfxBoolItem, FN_PARAM_3, false );
- if ( pTemplate )
- aTemplateName = pTemplate->GetValue();
- if ( pNumber && pIsNumberFilled && pIsNumberFilled->GetValue() )
- oPageNumber = pNumber->GetValue();
- }
- else
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- AbstractSwBreakDlg* pDlg = pFact->CreateSwBreakDlg(GetView().GetWindow(), rWrtSh);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if ( pDlg->Execute() == RET_OK )
- {
- nKind = pDlg->GetKind();
- aTemplateName = pDlg->GetTemplateName();
- oPageNumber = pDlg->GetPageNumber();
-
- sal_Bool bIsNumberFilled = sal_False;
- sal_uInt16 nPageNumber = 0;
-
- if (oPageNumber)
- {
- bIsNumberFilled = sal_True;
- nPageNumber = oPageNumber.get();
- }
-
- rReq.AppendItem( SfxInt16Item ( FN_INSERT_BREAK_DLG, nKind ) );
- rReq.AppendItem( SfxStringItem( FN_PARAM_1, aTemplateName ) );
- rReq.AppendItem( SfxUInt16Item( FN_PARAM_2, nPageNumber ) );
- rReq.AppendItem( SfxBoolItem ( FN_PARAM_3, bIsNumberFilled ) );
- rReq.Done();
- }
- else
- rReq.Ignore();
- delete pDlg;
- }
-
- switch ( nKind )
- {
- case 1 :
- rWrtSh.InsertLineBreak(); break;
- case 2 :
- rWrtSh.InsertColumnBreak(); break;
- case 3 :
- {
- rWrtSh.StartAllAction();
- if( !aTemplateName.isEmpty() )
- rWrtSh.InsertPageBreak( &aTemplateName, oPageNumber );
- else
- rWrtSh.InsertPageBreak();
- rWrtSh.EndAllAction();
- }
- }
-
- break;
- }
- case FN_INSERT_BOOKMARK:
- {
- if ( pItem )
- {
- OUString sName = ((SfxStringItem*)pItem)->GetValue();
- rWrtSh.SetBookmark( KeyCode(), sName, OUString() );
- }
- else
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- VclAbstractDialog* pDlg = pFact->CreateSwInsertBookmarkDlg( GetView().GetWindow(), rWrtSh, rReq, DLG_INSERT_BOOKMARK );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- }
-
- break;
- }
- case FN_DELETE_BOOKMARK:
- {
- if ( pItem )
- {
- IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
- pMarkAccess->deleteMark( pMarkAccess->findMark(((SfxStringItem*)pItem)->GetValue()) );
- }
- break;
- }
- case FN_AUTOFORMAT_REDLINE_APPLY:
- {
- SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags());
- // This must always be sal_False for the postprocessing.
- aFlags.bAFmtByInput = false;
- aFlags.bWithRedlining = true;
- rWrtSh.AutoFormat( &aFlags );
- aFlags.bWithRedlining = false;
-
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if (pVFrame->HasChildWindow(FN_REDLINE_ACCEPT))
- pVFrame->ToggleChildWindow(FN_REDLINE_ACCEPT);
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- AbstractSwModalRedlineAcceptDlg* pDlg = pFact->CreateSwModalRedlineAcceptDlg(&GetView().GetEditWin());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
-
- switch (lcl_AskRedlineMode(&GetView().GetEditWin()))
- {
- case RET_OK:
- {
- pDlg->AcceptAll(sal_True);
- SfxRequest aReq( pVFrame, FN_AUTOFORMAT_APPLY );
- aReq.Done();
- rReq.Ignore();
- break;
- }
-
- case RET_CANCEL:
- pDlg->AcceptAll(sal_False);
- rReq.Ignore();
- break;
-
- case 2:
- pDlg->Execute();
- rReq.Done();
- break;
- }
- delete pDlg;
- }
- break;
-
- case FN_AUTOFORMAT_APPLY:
- {
- SvxSwAutoFmtFlags aFlags(SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags());
- // This must always be sal_False for the postprocessing.
- aFlags.bAFmtByInput = false;
- rWrtSh.AutoFormat( &aFlags );
- rReq.Done();
- }
- break;
- case FN_AUTOFORMAT_AUTO:
- {
- SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
- bool bSet = pItem ? ((const SfxBoolItem*)pItem)->GetValue() : !rACfg.IsAutoFmtByInput();
- if( bSet != rACfg.IsAutoFmtByInput() )
- {
- rACfg.SetAutoFmtByInput( bSet );
- GetView().GetViewFrame()->GetBindings().Invalidate( nSlot );
- if ( !pItem )
- rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), bSet ) );
- rReq.Done();
- }
- }
- break;
- case FN_AUTO_CORRECT:
- {
- // At first set to blank as default.
- sal_Unicode cChar = ' ';
- rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get().GetAutoCorrect(), cChar );
- rReq.Done();
- }
- break;
- case FN_TABLE_SORT_DIALOG:
- case FN_SORTING_DLG:
- {
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- VclAbstractDialog* pDlg = pFact->CreateVclAbstractDialog( GetView().GetWindow(), rWrtSh, DLG_SORTING );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- rReq.Done();
- }
- break;
- case FN_NUMBERING_OUTLINE_DLG:
- {
- SfxItemSet aTmp(GetPool(), FN_PARAM_1, FN_PARAM_1);
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_TAB_OUTLINE,
- GetView().GetWindow(), &aTmp, rWrtSh);
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- pDlg->Execute();
- delete pDlg;
- rReq.Done();
- }
- break;
- case FN_CALCULATE:
- {
- SwTransferable* pTransfer = new SwTransferable( rWrtSh );
-/*??*/ uno::Reference<
- datatransfer::XTransferable > xRef(
- pTransfer );
- pTransfer->CalculateAndCopy();
- rReq.Done();
- }
- break;
- case FN_GOTO_REFERENCE:
- {
- SwField *pFld = rWrtSh.GetCurFld();
- if(pFld && pFld->GetTypeId() == TYP_GETREFFLD)
- {
- rWrtSh.StartAllAction();
- rWrtSh.SwCrsrShell::GotoRefMark( ((SwGetRefField*)pFld)->GetSetRefName(),
- ((SwGetRefField*)pFld)->GetSubType(),
- ((SwGetRefField*)pFld)->GetSeqNo() );
- rWrtSh.EndAllAction();
- rReq.Done();
- }
- }
- break;
- case FN_EDIT_FORMULA:
- {
- const sal_uInt16 nId = SwInputChild::GetChildWindowId();
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if(pItem)
- {
- //if the ChildWindow is active it has to be removed
- if( pVFrame->HasChildWindow( nId ) )
- {
- pVFrame->ToggleChildWindow( nId );
- pVFrame->GetBindings().InvalidateAll( sal_True );
- }
-
- OUString sFormula(((const SfxStringItem*)pItem)->GetValue());
- SwFldMgr aFldMgr;
- rWrtSh.StartAllAction();
- sal_Bool bDelSel;
- if( 0 != (bDelSel = rWrtSh.HasSelection()) )
- {
- rWrtSh.StartUndo( UNDO_START );
- rWrtSh.DelRight();
- }
- else
- {
- rWrtSh.EnterStdMode();
- }
-
- if( !bDelSel && aFldMgr.GetCurFld() && TYP_FORMELFLD == aFldMgr.GetCurTypeId() )
- aFldMgr.UpdateCurFld( aFldMgr.GetCurFld()->GetFormat(), OUString(), sFormula );
- else if( !sFormula.isEmpty() )
- {
- if( rWrtSh.IsCrsrInTbl() )
- {
- SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
- aSet.Put( SwTblBoxFormula( sFormula ));
- rWrtSh.SetTblBoxFormulaAttrs( aSet );
- rWrtSh.UpdateTable();
- }
- else
- {
- SvNumberFormatter* pFormatter = rWrtSh.GetNumberFormatter();
- sal_uLong nSysNumFmt = pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, LANGUAGE_SYSTEM);
- SwInsertFld_Data aData(TYP_FORMELFLD, nsSwGetSetExpType::GSE_FORMULA, OUString(), sFormula, nSysNumFmt);
- aFldMgr.InsertFld(aData);
- }
- }
-
- if( bDelSel )
- rWrtSh.EndUndo( UNDO_END );
- rWrtSh.EndAllAction();
- rReq.Done();
- }
- else
- {
- rWrtSh.EndAllTblBoxEdit();
- pVFrame->ToggleChildWindow( nId );
- if( !pVFrame->HasChildWindow( nId ) )
- pVFrame->GetBindings().InvalidateAll( sal_True );
- rReq.Ignore();
- }
- }
-
- break;
- case FN_TABLE_UNSET_READ_ONLY:
- {
- rWrtSh.UnProtectTbls();
- }
- break;
- case FN_EDIT_HYPERLINK:
- GetView().GetViewFrame()->ToggleChildWindow(SID_HYPERLINK_DIALOG);
- break;
- case FN_REMOVE_HYPERLINK:
- {
- sal_Bool bSel = rWrtSh.HasSelection();
- if(!bSel)
- {
- rWrtSh.StartAction();
- rWrtSh.Push();
- if(!rWrtSh.SelectTxtAttr( RES_TXTATR_INETFMT ))
- rWrtSh.SelWrd();
- }
- //now remove the attribute
- std::set<sal_uInt16> aAttribs;
- aAttribs.insert( RES_TXTATR_INETFMT );
- rWrtSh.ResetAttr( aAttribs );
- if(!bSel)
- {
- rWrtSh.Pop(sal_False);
- rWrtSh.EndAction();
- }
- }
- break;
- case SID_ATTR_BRUSH_CHAR :
- case SID_ATTR_CHAR_SCALEWIDTH :
- case SID_ATTR_CHAR_ROTATED :
- case FN_TXTATR_INET :
- case FN_INSERT_HYPERLINK:
- {
- sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
- if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
- bUseDialog = false;
- // intentionally no break
- }
- case SID_CHAR_DLG:
- case SID_CHAR_DLG_EFFECT:
- {
- sw_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
- }
- break;
- case SID_CHAR_DLG_FOR_PARAGRAPH:
- {
- rWrtSh.Push(); //save current cursor
- SwLangHelper::SelectCurrentPara( rWrtSh );
- sw_CharDialog( rWrtSh, bUseDialog, nSlot, pArgs, &rReq );
- rWrtSh.Pop( sal_False ); //restore old cursor
- }
- break;
- case SID_ATTR_LRSPACE :
- case SID_ATTR_ULSPACE :
- case SID_ATTR_BRUSH :
- case SID_PARA_VERTALIGN :
- case SID_ATTR_PARA_NUMRULE :
- case SID_ATTR_PARA_REGISTER :
- case SID_ATTR_PARA_PAGENUM :
- case FN_FORMAT_LINENUMBER :
- case FN_NUMBER_NEWSTART :
- case FN_NUMBER_NEWSTART_AT :
- case FN_FORMAT_DROPCAPS :
- case FN_DROP_TEXT:
- case SID_ATTR_PARA_LRSPACE:
- {
- sal_uInt16 nWhich = GetPool().GetWhich( nSlot );
- if ( pArgs && pArgs->GetItemState( nWhich ) == SFX_ITEM_SET )
- bUseDialog = false;
- // intentionally no break
-
- }
- case SID_PARA_DLG:
- {
- SwPaM* pPaM = NULL;
-
- if ( pArgs )
- {
- const SfxPoolItem* pPaMItem = 0;
- pArgs->GetItemState( GetPool().GetWhich( FN_PARAM_PAM ), false, &pPaMItem );
- if ( pPaMItem )
- pPaM = static_cast< const SwPaMItem* >( pPaMItem )->GetValue( );
- }
-
- if ( !pPaM )
- pPaM = rWrtSh.GetCrsr();
-
- FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView()));
- SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric)));
-
- sal_Bool bApplyCharUnit = ::HasCharUnit(0 != PTR_CAST(SwWebView, &GetView()));
- SW_MOD()->PutItem(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bApplyCharUnit));
-
- SfxItemSet aCoreSet( GetPool(),
- RES_PARATR_BEGIN, RES_PARATR_END - 1,
- RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
- RES_FRMATR_BEGIN, RES_FRMATR_END - 1,
- SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS,
- SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS,
- SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
- SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER,
- SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP,
- SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM,
- SID_HTML_MODE, SID_HTML_MODE,
- FN_PARAM_1, FN_PARAM_1,
- FN_NUMBER_NEWSTART, FN_NUMBER_NEWSTART_AT,
- FN_DROP_TEXT, FN_DROP_CHAR_STYLE_NAME,
- 0);
- // get also the list level indent values merged as LR-SPACE item, if needed.
- rWrtSh.GetPaMAttr( pPaM, aCoreSet, true );
- aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE,
- ::GetHtmlMode(GetView().GetDocShell())));
-
- // Tabulators: Put DefaultTabs into ItemSet
- const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&)
- GetPool().GetDefaultItem(RES_PARATR_TABSTOP);
-
- sal_uInt16 nDefDist = ::GetTabDist( rDefTabs );
- SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist );
- aCoreSet.Put( aDefDistItem );
-
- // Current tabulator
- SfxUInt16Item aTabPos( SID_ATTR_TABSTOP_POS, 0 );
- aCoreSet.Put( aTabPos );
-
- // Left border as offset
- //#i24363# tab stops relative to indent
- const long nOff = rWrtSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ?
- ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0;
- SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
- aCoreSet.Put( aOff );
-
- // Setting the BoxInfo
- ::PrepareBoxInfo( aCoreSet, rWrtSh );
-
- // Current page format
- ::SwToSfxPageDescAttr( aCoreSet );
-
- // Properties of numbering
- if( rWrtSh.GetDoc()->GetCurrNumRule( *pPaM->GetPoint() ) )
- {
- SfxBoolItem aStart( FN_NUMBER_NEWSTART, rWrtSh.IsNumRuleStart( pPaM ) );
- aCoreSet.Put(aStart);
- SfxUInt16Item aStartAt( FN_NUMBER_NEWSTART_AT,
- rWrtSh.GetNodeNumStart( pPaM ) );
- aCoreSet.Put(aStartAt);
- }
- SfxAbstractTabDialog* pDlg = NULL;
-
- if ( bUseDialog && GetActiveView() )
- {
- OString sDefPage;
- if (pItem)
- sDefPage = OUStringToOString(((const SfxStringItem*)pItem)->GetValue(), RTL_TEXTENCODING_UTF8);
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- pDlg = pFact->CreateSwParaDlg( GetView().GetWindow(),GetView(), aCoreSet, DLG_STD, NULL, sal_False, sDefPage );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- }
- SfxItemSet* pSet = NULL;
- if ( !bUseDialog )
- {
- if ( nSlot == SID_ATTR_PARA_LRSPACE)
- {
- SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)pArgs->Get(nSlot));
- aParaMargin.SetWhich( RES_LR_SPACE);
- aCoreSet.Put(aParaMargin);
- pSet = &aCoreSet;
-
- } else
- pSet = (SfxItemSet*) pArgs;
-
- }
- else if ( NULL != pDlg && pDlg->Execute() == RET_OK )
- {
- // Apply defaults if nessecary.
- pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
- sal_uInt16 nNewDist;
- if( SFX_ITEM_SET == pSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, false, &pItem ) &&
- nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) )
- {
- SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
- MakeDefTabs( nNewDist, aDefTabs );
- rWrtSh.SetDefault( aDefTabs );
- pSet->ClearItem( SID_ATTR_TABSTOP_DEFAULTS );
- }
-
- if ( SFX_ITEM_SET == pSet->GetItemState(FN_PARAM_1,false,&pItem) )
- {
- pSet->Put(SfxStringItem(FN_DROP_TEXT, ((const SfxStringItem*)pItem)->GetValue()));
- pSet->ClearItem(FN_PARAM_1);
- }
-
- if( SFX_ITEM_SET == pSet->GetItemState( RES_PARATR_DROP, false, &pItem ))
- {
- OUString sCharStyleName;
- if(((const SwFmtDrop*)pItem)->GetCharFmt())
- sCharStyleName = ((const SwFmtDrop*)pItem)->GetCharFmt()->GetName();
- pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName));
- }
- }
-
- if ( pSet )
- {
- rReq.Done( *pSet );
- ::SfxToSwPageDescAttr( rWrtSh, *pSet );
- // #i56253#
- // enclose all undos.
- // Thus, check conditions, if actions will be performed.
- const bool bUndoNeeded( pSet->Count() ||
- SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) ||
- SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) );
- if ( bUndoNeeded )
- {
- rWrtSh.StartUndo( UNDO_INSATTR );
- }
- if( pSet->Count() )
- {
- rWrtSh.StartAction();
- if ( SFX_ITEM_SET == pSet->GetItemState(FN_DROP_TEXT, false, &pItem) )
- {
- if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() )
- rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue(), pPaM);
- }
- rWrtSh.SetAttrSet( *pSet, 0, pPaM );
- rWrtSh.EndAction();
- SwTxtFmtColl* pColl = rWrtSh.GetPaMTxtFmtColl( pPaM );
- if(pColl && pColl->IsAutoUpdateFmt())
- {
- rWrtSh.AutoUpdatePara(pColl, *pSet, pPaM);
- }
- }
-
- if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART) )
- {
- //SetNumRuleStart(sal_True) restarts the numbering at the value
- //that is defined at the starting point of the numbering level
- //otherwise the SetNodeNumStart() value determines the start
- //if it's set to something different than (sal_uInt16)0xFFFF
-
- sal_Bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
-
- // Default value for restart value has to be (sal_uInt16)0xFFFF
- // in order to indicate that the restart value of the list
- // style has to be used on restart.
- sal_uInt16 nNumStart = (sal_uInt16)0xFFFF;
- if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
- {
- nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
- }
- rWrtSh.SetNumRuleStart(bStart, pPaM);
- rWrtSh.SetNodeNumStart(nNumStart);
- }
- else if( SFX_ITEM_SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
- {
- sal_uInt16 nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
- rWrtSh.SetNodeNumStart(nNumStart);
- rWrtSh.SetNumRuleStart(sal_False, pPaM);
- }
- // #i56253#
- if ( bUndoNeeded )
- {
- rWrtSh.EndUndo( UNDO_INSATTR );
- }
- }
-
- delete pDlg;
- }
- break;
- case FN_NUM_CONTINUE:
- {
- OUString sContinuedListId;
- const SwNumRule* pRule =
- rWrtSh.SearchNumRule( false, true, false, -1, sContinuedListId );
- // #i86492#
- // Search also for bullet list
- if ( !pRule )
- {
- pRule = rWrtSh.SearchNumRule( false, false, false, -1, sContinuedListId );
- }
- if ( pRule )
- {
- rWrtSh.SetCurNumRule( *pRule, false, sContinuedListId );
- }
- }
- break;
- case FN_SELECT_PARA:
- {
- if(!rWrtSh.IsSttOfPara())
- rWrtSh.SttPara(sal_False);
- else
- rWrtSh.EnterStdMode();
- rWrtSh.EndPara(sal_True);
- }
- break;
-
- case SID_DEC_INDENT:
- case SID_INC_INDENT:
- //According to the requirement, modified the behavior when user
- //using the indent button on the toolbar. Now if we increase/decrease indent for a
- //paragraph which has bullet style it will increase/decrease the bullet level.
- {
- //If the current paragraph has bullet call the function to
- //increase or decrease the bullet level.
- //Why could I know wheter a paragraph has bullet or not by checking the below conditions?
- //Please refer to the "case KEY_TAB:" section in SwEditWin::KeyInput(..) :
- // if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
- // !rSh.HasReadonlySel() )
- // eKeyState = KS_NumDown;
- //Above code demonstrates that when the cursor is at the start of a paragraph which has bullet,
- //press TAB will increase the bullet level.
- //So I copied from that ^^
- if ( rWrtSh.GetCurNumRule() && !rWrtSh.HasReadonlySel() )
- {
- rWrtSh.NumUpDown( SID_INC_INDENT == nSlot );
- }
- else//execute the original processing functions
- {
- //below is copied of the old codes
- rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
- rReq.GetModifier() != KEY_MOD1 );
- }
- }
- rReq.Done();
- break;
- case FN_DEC_INDENT_OFFSET:
- case FN_INC_INDENT_OFFSET:
- rWrtSh.MoveLeftMargin( FN_INC_INDENT_OFFSET == nSlot,
- rReq.GetModifier() == KEY_MOD1 );
- rReq.Done();
- break;
-
- case SID_ATTR_CHAR_COLOR2:
- {
- if(pItem)
- {
- Color aSet = ((const SvxColorItem*)pItem)->GetValue();
- SwEditWin& rEditWin = GetView().GetEditWin();
- rEditWin.SetTextColor(aSet);
- SwApplyTemplate* pApply = rEditWin.GetApplyTemplate();
-
- // If there is a selection, then set the color on it
- // otherwise, it'll be the color for the next text to be typed
- if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_EXT)
- {
- rWrtSh.SetAttrItem(SvxColorItem (aSet, RES_CHRATR_COLOR));
- }
-
- rReq.Done();
- }
- }
- break;
- case SID_ATTR_CHAR_COLOR_BACKGROUND:
- {
- SwEditWin& rEdtWin = GetView().GetEditWin();
- SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
- rEdtWin.SetTextBackColorTransparent(0 == pItem);
- Color aSet;
- if(pItem)
- {
- aSet = ((const SvxColorItem*)pItem)->GetValue();
- rEdtWin.SetTextBackColor(aSet); //select last color
- }
- else
- rEdtWin.SetTextBackColor(Color(COL_TRANSPARENT)); //if last was "no fill"
- if(!pApply && (rWrtSh.HasSelection() || rReq.IsAPI()))
- {
- SvxBrushItem aBrushItem(RES_CHRATR_BACKGROUND);
- if(pItem)
- aBrushItem.SetColor(aSet); //set the selected color
- else
- aBrushItem.SetColor(Color(COL_TRANSPARENT));//set "no fill" color
- rWrtSh.SetAttrItem( aBrushItem );
- }
- else if(!pApply || pApply->nColor != SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
- {
- GetView().GetViewFrame()->GetDispatcher()->Execute(SID_ATTR_CHAR_COLOR_BACKGROUND_EXT);
- }
-
- rReq.Done();
-
- }
- break;
- case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
- case SID_ATTR_CHAR_COLOR_EXT:
- {
- SwEditWin& rEdtWin = GetView().GetEditWin();
- SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
- SwApplyTemplate aTempl;
- sal_Bool bSelection = rWrtSh.HasSelection();
- if(bSelection)
- {
-
- if(nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT)
- {
- rWrtSh.SetAttrItem(
- SvxBrushItem( rEdtWin.GetTextBackColor(), RES_CHRATR_BACKGROUND) );
- }
- else
- rWrtSh.SetAttrItem(
- SvxColorItem( rEdtWin.GetTextColor(), RES_CHRATR_COLOR) );
- }
- else
- {
- if(!pApply || pApply->nColor != nSlot)
- aTempl.nColor = nSlot;
- rEdtWin.SetApplyTemplate(aTempl);
- }
-
- rReq.Done();
- }
- break;
-
- case FN_NUM_BULLET_MOVEDOWN:
- if (!rWrtSh.IsAddMode())
- rWrtSh.MoveParagraph(1);
- rReq.Done();
- break;
-
- case FN_NUM_BULLET_MOVEUP:
- if (!rWrtSh.IsAddMode())
- rWrtSh.MoveParagraph(-1);
- rReq.Done();
- break;
- case SID_RUBY_DIALOG:
- case SID_HYPERLINK_DIALOG:
- {
- SfxRequest aReq(nSlot, SFX_CALLMODE_SLOT, SFX_APP()->GetPool());
- GetView().GetViewFrame()->ExecuteSlot( aReq);
- rReq.Ignore();
- }
- break;
- case FN_INSERT_PAGEHEADER:
- case FN_INSERT_PAGEFOOTER:
- if(pArgs && pArgs->Count())
- {
- OUString sStyleName;
- if(pItem)
- sStyleName = ((const SfxStringItem*)pItem)->GetValue();
- sal_Bool bOn = sal_True;
- if( SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem))
- bOn = ((const SfxBoolItem*)pItem)->GetValue();
- rWrtSh.ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI());
- rReq.Done();
- }
- break;
- case FN_READONLY_SELECTION_MODE :
- if(GetView().GetDocShell()->IsReadOnly())
- {
- rWrtSh.SetReadonlySelectionOption(
- !rWrtSh.GetViewOptions()->IsSelectionInReadonly());
- rWrtSh.ShowCrsr();
- }
- break;
- case FN_SELECTION_MODE_DEFAULT:
- case FN_SELECTION_MODE_BLOCK :
- {
- bool bSetBlockMode = !rWrtSh.IsBlockMode();
- if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(nSlot, false, &pItem))
- bSetBlockMode = ((const SfxBoolItem*)pItem)->GetValue();
- if( ( nSlot == FN_SELECTION_MODE_DEFAULT ) != bSetBlockMode )
- rWrtSh.EnterBlockMode();
- else
- rWrtSh.EnterStdMode();
- SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
- rBnd.Invalidate(FN_STAT_SELMODE);
- rBnd.Update(FN_STAT_SELMODE);
- }
- break;
- case SID_OPEN_HYPERLINK:
- case FN_COPY_HYPERLINK_LOCATION:
- {
- SfxItemSet aSet(GetPool(),
- RES_TXTATR_INETFMT,
- RES_TXTATR_INETFMT);
- rWrtSh.GetCurAttr(aSet);
- if(SFX_ITEM_SET <= aSet.GetItemState( RES_TXTATR_INETFMT, true ))
- {
- const SwFmtINetFmt& rINetFmt = dynamic_cast<const SwFmtINetFmt&>( aSet.Get(RES_TXTATR_INETFMT, sal_True) );
- if( nSlot == FN_COPY_HYPERLINK_LOCATION )
- {
- ::uno::Reference< datatransfer::clipboard::XClipboard > xClipboard = GetView().GetEditWin().GetClipboard();
- vcl::unohelper::TextDataObject::CopyStringTo(
- rINetFmt.GetValue(),
- xClipboard );
- }
- else
- rWrtSh.ClickToINetAttr(rINetFmt, URLLOAD_NOFILTER);
- }
- }
- break;
- case SID_OPEN_XML_FILTERSETTINGS:
- {
- try
- {
- uno::Reference < ui::dialogs::XExecutableDialog > xDialog = ui::dialogs::XSLTFilterDialog::create( ::comphelper::getProcessComponentContext() );
- xDialog->execute();
- }
- catch (const uno::Exception&)
- {
- }
- rReq.Ignore ();
- }
- break;
- case FN_FORMAT_APPLY_HEAD1:
- {
- }
- break;
- case FN_FORMAT_APPLY_HEAD2:
- {
- }
- break;
- case FN_FORMAT_APPLY_HEAD3:
- {
- }
- break;
- case FN_FORMAT_APPLY_DEFAULT:
- {
- }
- break;
- case FN_FORMAT_APPLY_TEXTBODY:
- {
- }
- break;
- case FN_WORDCOUNT_DIALOG:
- {
- SfxViewFrame* pVFrame = GetView().GetViewFrame();
- if (pVFrame != NULL)
- {
- pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
- Invalidate(rReq.GetSlot());
-
- SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId());
- if (pWrdCnt)
- pWrdCnt->UpdateCounts();
- }
- }
- break;
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
-}
-
-void SwTextShell::GetState( SfxItemSet &rSet )
-{
- SwWrtShell &rSh = GetShell();
- SfxWhichIter aIter( rSet );
- sal_uInt16 nWhich = aIter.FirstWhich();
- while ( nWhich )
- {
- switch ( nWhich )
- {
- case SID_LANGUAGE_STATUS:
- {
- // the value of used script types
- OUString aScriptTypesInUse( OUString::number( rSh.GetScriptType() ) );
-
- SvtLanguageTable aLangTable;
-
- // get keyboard language
- OUString aKeyboardLang;
- SwEditWin& rEditWin = GetView().GetEditWin();
- LanguageType nLang = rEditWin.GetInputLanguage();
- if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_SYSTEM)
- aKeyboardLang = aLangTable.GetString( nLang );
-
- // get the language that is in use
- OUString aCurrentLang = "*";
- nLang = SwLangHelper::GetCurrentLanguage( rSh );
- if (nLang != LANGUAGE_DONTKNOW)
- aCurrentLang = aLangTable.GetString( nLang );
-
- // build sequence for status value
- uno::Sequence< OUString > aSeq( 4 );
- aSeq[0] = aCurrentLang;
- aSeq[1] = aScriptTypesInUse;
- aSeq[2] = aKeyboardLang;
- aSeq[3] = SwLangHelper::GetTextForLanguageGuessing( rSh );
-
- // set sequence as status value
- SfxStringListItem aItem( SID_LANGUAGE_STATUS );
- aItem.SetStringList( aSeq );
- rSet.Put( aItem, SID_LANGUAGE_STATUS );
- }
- break;
-
- case SID_THES:
- {
- // is there a valid selection to get text from?
- OUString aText;
- bool bValid = !rSh.HasSelection() ||
- (rSh.IsSelOnePara() && !rSh.IsMultiSelection());
- // prevent context menu from showing when cursor is not in or at the end of a word
- // (GetCurWord will return the next word if there is none at the current position...)
- const sal_Int16 nWordType = ::i18n::WordType::DICTIONARY_WORD;
- bool bWord = rSh.IsInWord( nWordType ) || rSh.IsStartWord( nWordType ) || rSh.IsEndWord( nWordType );
- if (bValid && bWord)
- aText = rSh.HasSelection()? OUString(rSh.GetSelTxt()) : rSh.GetCurWord();
-
- LanguageType nLang = rSh.GetCurLang();
- LanguageTag aLanguageTag( nLang);
- lang::Locale aLocale( aLanguageTag.getLocale());
- OUString aLangText( aLanguageTag.getBcp47() );
-
- // set word and locale to look up as status value
- OUString aStatusVal = aText + "#" + aLangText;
-
- rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
-
- // disable "Thesaurus" context menu entry if there is nothing to look up
- uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() );
- if (aText.isEmpty() ||
- !xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( aLocale ))
- rSet.DisableItem( SID_THES );
- }
- break;
-
- case FN_NUMBER_NEWSTART :
- if(!rSh.GetCurNumRule())
- rSet.DisableItem(nWhich);
- else
- rSet.Put(SfxBoolItem(FN_NUMBER_NEWSTART,
- rSh.IsNumRuleStart()));
- break;
-
- case FN_EDIT_FORMULA:
- case SID_CHARMAP:
- {
- const int nType = rSh.GetSelectionType();
- if (!(nType & nsSelectionType::SEL_TXT) &&
- !(nType & nsSelectionType::SEL_TBL) &&
- !(nType & nsSelectionType::SEL_NUM))
- {
- rSet.DisableItem(nWhich);
- }
- else if ( nWhich == FN_EDIT_FORMULA
- && rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- }
- break;
-
- case FN_INSERT_ENDNOTE:
- case FN_INSERT_FOOTNOTE:
- case FN_INSERT_FOOTNOTE_DLG:
- {
- const sal_uInt16 nNoType =
- FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE;
- if ( (rSh.GetFrmType(0,sal_True) & nNoType) )
- rSet.DisableItem(nWhich);
-
- if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- }
- break;
-
- case FN_INSERT_HYPERLINK:
- case SID_INSERTDOC:
- case FN_INSERT_GLOSSARY:
- case FN_EXPAND_GLOSSARY:
- if ( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case FN_INSERT_TABLE:
- if ( rSh.CrsrInsideInputFld()
- || rSh.GetTableFmt()
- || (rSh.GetFrmType(0,sal_True) & FRMTYPE_FOOTNOTE) )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case FN_CALCULATE:
- if ( !rSh.IsSelection() )
- rSet.DisableItem(nWhich);
- break;
- case FN_GOTO_REFERENCE:
- {
- SwField *pFld = rSh.GetCurFld();
- if ( !pFld || (pFld && pFld->GetTypeId() != TYP_GETREFFLD) )
- rSet.DisableItem(nWhich);
- }
- break;
- case FN_AUTOFORMAT_AUTO:
- {
- rSet.Put( SfxBoolItem( nWhich, SvxAutoCorrCfg::Get().IsAutoFmtByInput() ));
- }
- break;
-
- case SID_DEC_INDENT:
- case SID_INC_INDENT:
- {
- //if the paragrah has bullet we'll do the following things:
- //1: if the bullet level is the first level, disable the decrease-indent button
- //2: if the bullet level is the last level, disable the increase-indent button
- if ( rSh.GetCurNumRule() && !rSh.HasReadonlySel() )
- {
- sal_uInt8 nLevel = rSh.GetNumLevel();
- if ( (nLevel == (MAXLEVEL-1) && nWhich == SID_INC_INDENT) ||
- (nLevel == 0 && nWhich == SID_DEC_INDENT) )
- {
- rSet.DisableItem( nWhich );
- }
- }
- else//if the paragraph has no bullet, execute the original functions
- {
- //below is copied of the old codes
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
- if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
- SID_INC_INDENT == nWhich, true ))
- rSet.DisableItem( nWhich );
- }
- }
- break;
-
- case FN_DEC_INDENT_OFFSET:
- case FN_INC_INDENT_OFFSET:
- {
- sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
- nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
- if( (nHtmlMode == HTMLMODE_ON) ||
- !rSh.IsMoveLeftMargin( FN_INC_INDENT_OFFSET == nWhich,
- false ))
- rSet.DisableItem( nWhich );
- }
- break;
-
- case SID_ATTR_CHAR_COLOR2:
- {
- rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextColor(), SID_ATTR_CHAR_COLOR2));
- }
- break;
- case SID_ATTR_CHAR_COLOR_BACKGROUND:
- {
- if(GetView().GetEditWin().IsTextBackColorTransparent())
- rSet.Put(SvxColorItem(Color(COL_TRANSPARENT), SID_ATTR_CHAR_COLOR_BACKGROUND));
- else
- rSet.Put(SvxColorItem(GetView().GetEditWin().GetTextBackColor(), SID_ATTR_CHAR_COLOR_BACKGROUND));
- }
- break;
- case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT:
- case SID_ATTR_CHAR_COLOR_EXT:
- {
- SwEditWin& rEdtWin = GetView().GetEditWin();
- SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate();
- rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
- }
- break;
-
- case FN_INSERT_BOOKMARK:
- if( rSh.IsTableMode()
- || rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case FN_INSERT_BREAK:
- if ( rSh.HasReadonlySel()
- && !rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case FN_INSERT_BREAK_DLG:
- case FN_INSERT_COLUMN_BREAK:
- case FN_INSERT_PAGEBREAK:
- if( rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem( nWhich );
- }
- break;
-
- case FN_INSERT_PAGEHEADER:
- case FN_INSERT_PAGEFOOTER:
- {
- rSet.Put( SfxObjectShellItem( nWhich, GetView().GetDocShell() ));
- }
- break;
- case FN_TABLE_SORT_DIALOG:
- case FN_SORTING_DLG:
- if(!rSh.HasSelection() ||
- (FN_TABLE_SORT_DIALOG == nWhich && !rSh.GetTableFmt()))
- rSet.DisableItem( nWhich );
- break;
-
- case SID_RUBY_DIALOG:
- {
- SvtCJKOptions aCJKOptions;
- if( !aCJKOptions.IsRubyEnabled()
- || rSh.CrsrInsideInputFld() )
- {
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
- rSet.DisableItem(nWhich);
- }
- else
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
- }
- break;
-
- case SID_HYPERLINK_DIALOG:
- if( GetView().GetDocShell()->IsReadOnly()
- || ( !GetView().GetViewFrame()->HasChildWindow(nWhich)
- && rSh.HasReadonlySel() )
- || rSh.CrsrInsideInputFld() )
- {
- rSet.DisableItem(nWhich);
- }
- else
- {
- rSet.Put(SfxBoolItem( nWhich, 0 != GetView().GetViewFrame()->GetChildWindow( nWhich ) ));
- }
- break;
-
- case FN_EDIT_HYPERLINK:
- case FN_COPY_HYPERLINK_LOCATION:
- {
- SfxItemSet aSet(GetPool(),
- RES_TXTATR_INETFMT,
- RES_TXTATR_INETFMT);
- rSh.GetCurAttr(aSet);
- if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, true ) || rSh.HasReadonlySel())
- {
- rSet.DisableItem(nWhich);
- }
- }
- break;
- case FN_REMOVE_HYPERLINK:
- {
- SfxItemSet aSet(GetPool(),
- RES_TXTATR_INETFMT,
- RES_TXTATR_INETFMT);
- rSh.GetCurAttr(aSet);
-
- // If a hyperlink is selected, either alone or along with other text...
- if( ((SFX_ITEM_DONTCARE & aSet.GetItemState( RES_TXTATR_INETFMT, true )) == 0) || rSh.HasReadonlySel())
- {
- rSet.DisableItem(nWhich);
- }
- }
- break;
- case SID_TRANSLITERATE_HALFWIDTH:
- case SID_TRANSLITERATE_FULLWIDTH:
- case SID_TRANSLITERATE_HIRAGANA:
- case SID_TRANSLITERATE_KATAGANA:
- {
- SvtCJKOptions aCJKOptions;
- if(!aCJKOptions.IsChangeCaseMapEnabled())
- {
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_False );
- rSet.DisableItem(nWhich);
- }
- else
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, sal_True );
- }
- break;
- case FN_READONLY_SELECTION_MODE :
- if(!GetView().GetDocShell()->IsReadOnly())
- rSet.DisableItem( nWhich );
- else
- {
- rSet.Put(SfxBoolItem(nWhich, rSh.GetViewOptions()->IsSelectionInReadonly()));
- }
- break;
- case FN_SELECTION_MODE_DEFAULT:
- case FN_SELECTION_MODE_BLOCK :
- rSet.Put(SfxBoolItem(nWhich, (nWhich == FN_SELECTION_MODE_DEFAULT) != rSh.IsBlockMode()));
- break;
- case SID_OPEN_HYPERLINK:
- {
- SfxItemSet aSet(GetPool(),
- RES_TXTATR_INETFMT,
- RES_TXTATR_INETFMT);
- rSh.GetCurAttr(aSet);
- if(SFX_ITEM_SET > aSet.GetItemState( RES_TXTATR_INETFMT, false ))
- rSet.DisableItem(nWhich);
- }
- break;
- case SID_OPEN_SMARTTAGMENU:
- {
- uno::Sequence< OUString > aSmartTagTypes;
- uno::Sequence< uno::Reference< container::XStringKeyMap > > aStringKeyMaps;
- uno::Reference<text::XTextRange> xRange;
-
- rSh.GetSmartTagTerm( aSmartTagTypes, aStringKeyMaps, xRange );
-
- if ( xRange.is() && aSmartTagTypes.getLength() )
- {
- uno::Sequence < uno::Sequence< uno::Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence;
- uno::Sequence < uno::Sequence< sal_Int32 > > aActionIndicesSequence;
-
- const SmartTagMgr& rSmartTagMgr = SwSmartTagMgr::Get();
- rSmartTagMgr.GetActionSequences( aSmartTagTypes,
- aActionComponentsSequence,
- aActionIndicesSequence );
-
- uno::Reference <frame::XController> xController = GetView().GetController();
- const lang::Locale aLocale( SW_BREAKITER()->GetLocale( GetAppLanguageTag() ) );
- const OUString aApplicationName( rSmartTagMgr.GetApplicationName() );
- const OUString aRangeText = xRange->getString();
-
- const SvxSmartTagItem aItem( nWhich,
- aActionComponentsSequence,
- aActionIndicesSequence,
- aStringKeyMaps,
- xRange,
- xController,
- aLocale,
- aApplicationName,
- aRangeText );
-
- rSet.Put( aItem );
- }
- else
- rSet.DisableItem(nWhich);
- }
- break;
- case FN_NUM_NUMBERING_ON:
- rSet.Put(SfxBoolItem(FN_NUM_NUMBERING_ON,rSh.SelectionHasNumber()));
- break;
- case FN_NUM_BULLET_ON:
- rSet.Put(SfxBoolItem(FN_NUM_BULLET_ON,rSh.SelectionHasBullet()));
- break;
- case FN_BUL_NUM_RULE_INDEX:
- case FN_NUM_NUM_RULE_INDEX:
- {
- SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetCurNumRule());
- sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
- rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
- rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
- if( pCurRule )
- {
- nActNumLvl = GetShell().GetNumLevel();
- if( nActNumLvl < MAXLEVEL )
- {
- nActNumLvl = 1<<nActNumLvl;
- }
- SvxNumRule aSvxRule = pCurRule->MakeSvxNumRule();
- if ( GetShell().HasBullet())
- {
- rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
- rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
- NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
- if ( pBullets )
- {
- sal_uInt16 nBulIndex = pBullets->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
- rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,nBulIndex));
- }
- }else if ( GetShell().HasNumber() )
- {
- rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
- rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,(sal_uInt16)0xFFFF));
- NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
- if ( pNumbering )
- {
- sal_uInt16 nBulIndex = pNumbering->GetNBOIndexForNumRule(aSvxRule,nActNumLvl);
- rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,nBulIndex));
- }
- }
- }
- }
- break;
- case FN_NUM_CONTINUE:
- {
- {
- // #i86492#
- // Search also for bullet list
- OUString aDummy;
- const SwNumRule* pRule =
- rSh.SearchNumRule( false, true, false, -1, aDummy );
- if ( !pRule )
- {
- pRule = rSh.SearchNumRule( false, false, false, -1, aDummy );
- }
- if ( !pRule )
- rSet.DisableItem(nWhich);
- }
- }
- break;
- case SID_INSERT_RLM :
- case SID_INSERT_LRM :
- case SID_INSERT_ZWNBSP :
- case SID_INSERT_ZWSP:
- {
- SvtCTLOptions aCTLOptions;
- sal_Bool bEnabled = aCTLOptions.IsCTLFontEnabled();
- GetView().GetViewFrame()->GetBindings().SetVisibleState( nWhich, bEnabled );
- if(!bEnabled)
- rSet.DisableItem(nWhich);
- }
- break;
- }
- nWhich = aIter.NextWhich();
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/textsh2.cxx b/sw/source/ui/shells/textsh2.cxx
deleted file mode 100644
index ebd67d2a4d8a..000000000000
--- a/sw/source/ui/shells/textsh2.cxx
+++ /dev/null
@@ -1,285 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <cstdarg>
-
-#include <svtools/svmedit.hxx>
-#include <svl/eitem.hxx>
-#include <svl/whiter.hxx>
-#include <sfx2/event.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <vcl/msgbox.hxx>
-#include <svl/stritem.hxx>
-#include <svl/itemset.hxx>
-#include <sfx2/request.hxx>
-#include <com/sun/star/sdb/CommandType.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/sdbc/XDataSource.hpp>
-#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#include <com/sun/star/sdb/XQueriesSupplier.hpp>
-#include <com/sun/star/sdb/XDatabaseAccess.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/sdbc/XRowSet.hpp>
-#include <sfx2/frame.hxx>
-#include <fldmgr.hxx>
-#include <fldbas.hxx>
-#include "dbmgr.hxx"
-#include <comphelper/uno3.hxx>
-#include <svx/dataaccessdescriptor.hxx>
-
-#include <vcl/svapp.hxx>
-
-#include "view.hxx"
-#include "wrtsh.hxx"
-#include "swtypes.hxx"
-#include "cmdid.h"
-#include "swevent.hxx"
-#include "shells.hrc"
-#include "textsh.hxx"
-#include "swabstdlg.hxx"
-#include "dbui.hrc"
-
-#include <unomid.h>
-
-#include <boost/scoped_ptr.hpp>
-
-using namespace ::svx;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::frame;
-
-struct DBTextStruct_Impl
-{
- SwDBData aDBData;
- Sequence<Any> aSelection;
- Reference<XResultSet> xCursor;
- Reference<XConnection> xConnection;
-};
-
-void SwTextShell::ExecDB(SfxRequest &rReq)
-{
- const SfxItemSet *pArgs = rReq.GetArgs();
- SwNewDBMgr* pNewDBMgr = GetShell().GetNewDBMgr();
- sal_uInt16 nSlot = rReq.GetSlot();
- OUString sSourceArg, sCommandArg;
- sal_Int32 nCommandTypeArg = 0;
-
- const SfxPoolItem* pSourceItem = 0;
- const SfxPoolItem* pCursorItem = 0;
- const SfxPoolItem* pConnectionItem = 0;
- const SfxPoolItem* pCommandItem = 0;
- const SfxPoolItem* pCommandTypeItem = 0;
- const SfxPoolItem* pSelectionItem = 0;
-
- // first get the selection of rows to be inserted
- pArgs->GetItemState(FN_DB_DATA_SELECTION_ANY, false, &pSelectionItem);
-
- Sequence<Any> aSelection;
- if(pSelectionItem)
- ((SfxUsrAnyItem*)pSelectionItem)->GetValue() >>= aSelection;
-
- // get the data source name
- pArgs->GetItemState(FN_DB_DATA_SOURCE_ANY, false, &pSourceItem);
- if(pSourceItem)
- ((const SfxUsrAnyItem*)pSourceItem)->GetValue() >>= sSourceArg;
-
- // get the command
- pArgs->GetItemState(FN_DB_DATA_COMMAND_ANY, false, &pCommandItem);
- if(pCommandItem)
- ((const SfxUsrAnyItem*)pCommandItem)->GetValue() >>= sCommandArg;
-
- // get the command type
- pArgs->GetItemState(FN_DB_DATA_COMMAND_TYPE_ANY, false, &pCommandTypeItem);
- if(pCommandTypeItem)
- ((const SfxUsrAnyItem*)pCommandTypeItem)->GetValue() >>= nCommandTypeArg;
-
- Reference<XConnection> xConnection;
- pArgs->GetItemState(FN_DB_CONNECTION_ANY, false, &pConnectionItem);
- if ( pConnectionItem )
- ((const SfxUsrAnyItem*)pConnectionItem)->GetValue() >>= xConnection;
- // may be we even get no connection
- if ( !xConnection.is() )
- {
- Reference<XDataSource> xSource;
- xConnection = pNewDBMgr->GetConnection(sSourceArg, xSource);
- }
- if(!xConnection.is())
- return ;
-
- // get the cursor, we use to travel, may be NULL
- Reference<XResultSet> xCursor;
- pArgs->GetItemState(FN_DB_DATA_CURSOR_ANY, false, &pCursorItem);
- if ( pCursorItem )
- ((const SfxUsrAnyItem*)pCursorItem)->GetValue() >>= xCursor;
-
- switch (nSlot)
- {
- case FN_QRY_INSERT:
- {
- if(pSourceItem && pCommandItem && pCommandTypeItem)
- {
- DBTextStruct_Impl* pNew = new DBTextStruct_Impl;
- pNew->aDBData.sDataSource = sSourceArg;
- pNew->aDBData.sCommand = sCommandArg;
- pNew->aDBData.nCommandType = nCommandTypeArg;
- pNew->aSelection = aSelection;
- //if the cursor is NULL, it must be created inside InsertDBTextHdl
- // because it called via a PostUserEvent
- pNew->xCursor = xCursor;
- pNew->xConnection = xConnection;
-
- Application::PostUserEvent( STATIC_LINK( this, SwBaseShell,
- InsertDBTextHdl ), pNew );
- // the pNew will be removed in InsertDBTextHdl !!
- }
- }
- break;
-
- case FN_QRY_MERGE_FIELD:
- {
- // we don't get any cursor, so we must create our own
- sal_Bool bDisposeResultSet = sal_False;
- if ( !xCursor.is() )
- {
- xCursor = SwNewDBMgr::createCursor(sSourceArg,sCommandArg,nCommandTypeArg,xConnection);
- bDisposeResultSet = xCursor.is();
- }
-
- ODataAccessDescriptor aDescriptor;
- aDescriptor.setDataSource(sSourceArg);
- aDescriptor[daCommand] <<= sCommandArg;
- aDescriptor[daCursor] <<= xCursor;
- aDescriptor[daSelection] <<= aSelection;
- aDescriptor[daCommandType] <<= nCommandTypeArg;
-
- SwMergeDescriptor aMergeDesc( DBMGR_MERGE, *GetShellPtr(), aDescriptor );
- pNewDBMgr->MergeNew(aMergeDesc);
-
- if ( bDisposeResultSet )
- ::comphelper::disposeComponent(xCursor);
- }
- break;
-
- case FN_QRY_INSERT_FIELD:
- {
- const SfxPoolItem* pColumnItem = 0;
- const SfxPoolItem* pColumnNameItem = 0;
-
- pArgs->GetItemState(FN_DB_COLUMN_ANY, false, &pColumnItem);
- pArgs->GetItemState(FN_DB_DATA_COLUMN_NAME_ANY, false, &pColumnNameItem);
-
- OUString sColumnName;
- if(pColumnNameItem)
- ((SfxUsrAnyItem*)pColumnNameItem)->GetValue() >>= sColumnName;
- OUString sDBName = sSourceArg;
- sDBName += OUString(DB_DELIM);
- sDBName += sCommandArg;
- sDBName += OUString(DB_DELIM);
- sDBName += OUString::number(nCommandTypeArg);
- sDBName += OUString(DB_DELIM);
- sDBName += sColumnName;
-
- SwFldMgr aFldMgr(GetShellPtr());
- SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, OUString(), 0);
- if(pConnectionItem)
- aData.aDBConnection = ((SfxUsrAnyItem*)pConnectionItem)->GetValue();
- if(pColumnItem)
- aData.aDBColumn = ((SfxUsrAnyItem*)pColumnItem)->GetValue();
- aFldMgr.InsertFld(aData);
- SfxViewFrame* pViewFrame = GetView().GetViewFrame();
- uno::Reference< XDispatchRecorder > xRecorder =
- pViewFrame->GetBindings().GetRecorder();
- if ( xRecorder.is() )
- {
- SfxRequest aReq( pViewFrame, FN_INSERT_DBFIELD );
- aReq.AppendItem( SfxUInt16Item(FN_PARAM_FIELD_TYPE, TYP_DBFLD));
- aReq.AppendItem( SfxStringItem( FN_INSERT_DBFIELD, sDBName ));
- aReq.AppendItem( SfxStringItem( FN_PARAM_1, sCommandArg ));
- aReq.AppendItem( SfxStringItem( FN_PARAM_2, sColumnName ));
- aReq.AppendItem( SfxInt32Item( FN_PARAM_3, nCommandTypeArg));
- aReq.Done();
- }
- }
- break;
-
- default:
- OSL_ENSURE(!this, "wrong dispatcher");
- return;
- }
-}
-
-IMPL_STATIC_LINK( SwBaseShell, InsertDBTextHdl, DBTextStruct_Impl*, pDBStruct )
-{
- if( pDBStruct )
- {
- bool bDispose = false;
- Reference< sdbc::XConnection> xConnection = pDBStruct->xConnection;
- Reference<XDataSource> xSource = SwNewDBMgr::getDataSourceAsParent(xConnection,pDBStruct->aDBData.sDataSource);
- // #111987# the connection is disposed an so no parent has been found
- if(xConnection.is() && !xSource.is())
- return 0;
-
- if ( !xConnection.is() )
- {
- xConnection = SwNewDBMgr::GetConnection(pDBStruct->aDBData.sDataSource, xSource);
- bDispose = true;
- }
-
- Reference< XColumnsSupplier> xColSupp;
- if(xConnection.is())
- xColSupp = SwNewDBMgr::GetColumnSupplier(xConnection,
- pDBStruct->aDBData.sCommand,
- pDBStruct->aDBData.nCommandType == CommandType::QUERY ?
- SW_DB_SELECT_QUERY : SW_DB_SELECT_TABLE);
-
- if( xColSupp.is() )
- {
- SwDBData aDBData = pDBStruct->aDBData;
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
- boost::scoped_ptr<AbstractSwInsertDBColAutoPilot>pDlg (pFact->CreateSwInsertDBColAutoPilot(pThis->GetView(),
- xSource,
- xColSupp,
- aDBData));
- if( RET_OK == pDlg->Execute() )
- {
- Reference <XResultSet> xResSet = pDBStruct->xCursor;
- pDlg->DataToDoc( pDBStruct->aSelection, xSource, xConnection, xResSet);
- }
- }
- if ( bDispose )
- ::comphelper::disposeComponent(xConnection);
- }
-
- delete pDBStruct;
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
deleted file mode 100644
index 47d7e9312acb..000000000000
--- a/sw/source/ui/shells/txtattr.cxx
+++ /dev/null
@@ -1,743 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-
-#include <vcl/msgbox.hxx>
-#include <svl/whiter.hxx>
-#include <svl/stritem.hxx>
-#include <svl/itemiter.hxx>
-#include <svl/ctloptions.hxx>
-#include <swmodule.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/request.hxx>
-#include <editeng/fhgtitem.hxx>
-#include <editeng/adjustitem.hxx>
-#include <editeng/lspcitem.hxx>
-#include <editeng/lrspitem.hxx>
-#include <editeng/udlnitem.hxx>
-#include <editeng/escapementitem.hxx>
-#include <sfx2/htmlmode.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <editeng/frmdiritem.hxx>
-#include "paratr.hxx"
-
-#include <fmtinfmt.hxx>
-#include <docsh.hxx>
-#include <wrtsh.hxx>
-#include <view.hxx>
-#include <viewopt.hxx>
-#include <uitool.hxx>
-#include <textsh.hxx>
-#include <num.hxx>
-#include <swundo.hxx>
-#include <fmtcol.hxx>
-
-#include <cmdid.h>
-#include <globals.h>
-#include <shells.hrc>
-#include <SwStyleNameMapper.hxx>
-#include "swabstdlg.hxx"
-#include "chrdlg.hrc"
-const sal_uInt32 nFontInc = 40; // 2pt
-const sal_uInt32 nFontMaxSz = 19998; // 999.9pt
-
-void SwTextShell::ExecCharAttr(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- const SfxItemSet *pArgs = rReq.GetArgs();
- int eState = STATE_TOGGLE;
- sal_uInt16 nWhich = rReq.GetSlot();
-
- if(pArgs )
- {
- const SfxPoolItem* pItem;
- pArgs->GetItemState(nWhich, false, &pItem);
- eState = ((const SfxBoolItem &) pArgs->
- Get( nWhich )).GetValue() ? STATE_ON : STATE_OFF;
- }
-
- SfxItemSet aSet( GetPool(), RES_CHRATR_BEGIN, RES_CHRATR_END-1 );
- if (STATE_TOGGLE == eState)
- rSh.GetCurAttr( aSet );
-
- switch ( nWhich )
- {
- case FN_SET_SUB_SCRIPT:
- case FN_SET_SUPER_SCRIPT:
- {
- SvxEscapement eEscape = SVX_ESCAPEMENT_SUBSCRIPT;
- switch (eState)
- {
- case STATE_TOGGLE:
- {
- short nTmpEsc = ((const SvxEscapementItem&)
- aSet.Get( RES_CHRATR_ESCAPEMENT )).GetEsc();
- eEscape = nWhich == FN_SET_SUPER_SCRIPT ?
- SVX_ESCAPEMENT_SUPERSCRIPT:
- SVX_ESCAPEMENT_SUBSCRIPT;
- if( (nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0) ||
- (nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0) )
- eEscape = SVX_ESCAPEMENT_OFF;
-
- SfxBindings& rBind = GetView().GetViewFrame()->GetBindings();
- if( nWhich == FN_SET_SUB_SCRIPT )
- rBind.SetState( SfxBoolItem( FN_SET_SUPER_SCRIPT,
- false ) );
- else
- rBind.SetState( SfxBoolItem( FN_SET_SUB_SCRIPT,
- false ) );
-
- }
- break;
- case STATE_ON:
- eEscape = nWhich == FN_SET_SUPER_SCRIPT ?
- SVX_ESCAPEMENT_SUPERSCRIPT:
- SVX_ESCAPEMENT_SUBSCRIPT;
- break;
- case STATE_OFF:
- eEscape = SVX_ESCAPEMENT_OFF;
- break;
- }
- SvxEscapementItem aEscape( eEscape, RES_CHRATR_ESCAPEMENT );
- if(eEscape == SVX_ESCAPEMENT_SUPERSCRIPT)
- aEscape.GetEsc() = DFLT_ESC_AUTO_SUPER;
- else if(eEscape == SVX_ESCAPEMENT_SUBSCRIPT)
- aEscape.GetEsc() = DFLT_ESC_AUTO_SUB;
- rSh.SetAttrItem( aEscape );
- rReq.AppendItem( aEscape );
- rReq.Done();
- }
- break;
-
- case FN_UPDATE_STYLE_BY_EXAMPLE:
- rSh.QuickUpdateStyle();
- rReq.Done();
- break;
- case FN_UNDERLINE_DOUBLE:
- {
- FontUnderline eUnderline = ((const SvxUnderlineItem&)
- aSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle();
- switch( eState )
- {
- case STATE_TOGGLE:
- eUnderline = eUnderline == UNDERLINE_DOUBLE ?
- UNDERLINE_NONE :
- UNDERLINE_DOUBLE;
- break;
- case STATE_ON:
- eUnderline = UNDERLINE_DOUBLE;
- break;
- case STATE_OFF:
- eUnderline = UNDERLINE_NONE;
- break;
- }
- SvxUnderlineItem aUnderline(eUnderline, RES_CHRATR_UNDERLINE );
- rSh.SetAttrItem( aUnderline );
- rReq.AppendItem( aUnderline );
- rReq.Done();
- }
- break;
- case FN_REMOVE_DIRECT_CHAR_FORMATS:
- if( !rSh.HasReadonlySel() && rSh.IsEndPara())
- rSh.DontExpandFmt();
- break;
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
-}
-
-void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
-{
- sal_uInt16 nSlot = rReq.GetSlot();
- const SfxItemSet* pArgs = rReq.GetArgs();
- bool bArgs = pArgs != 0 && pArgs->Count() > 0;
- SwWrtShell& rWrtSh = GetShell();
- SwTxtFmtColl* pColl = 0;
-
- // Is only set if the whole paragraph is selected and AutoUpdateFmt is set.
- if (rWrtSh.HasSelection() && rWrtSh.IsSelFullPara())
- {
- pColl = rWrtSh.GetCurTxtFmtColl();
- if ( pColl && !pColl->IsAutoUpdateFmt() )
- pColl = 0;
- }
- SfxItemPool& rPool = GetPool();
- sal_uInt16 nWhich = rPool.GetWhich( nSlot );
- switch (nSlot)
- {
- case FN_TXTATR_INET:
- // Special treatment of the PoolId of the SwFmtInetFmt
- if(bArgs)
- {
- const SfxPoolItem& rItem = pArgs->Get( nWhich );
-
- SwFmtINetFmt aINetFmt( (const SwFmtINetFmt&) rItem );
- if ( USHRT_MAX == aINetFmt.GetVisitedFmtId() )
- {
- OSL_ENSURE( false, "<SwTextShell::ExecCharAttrArgs(..)> - unexpected visited character format ID at hyperlink attribute" );
- aINetFmt.SetVisitedFmtAndId(
- aINetFmt.GetVisitedFmt(),
- SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetVisitedFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ) );
- }
- if ( USHRT_MAX == aINetFmt.GetINetFmtId() )
- {
- OSL_ENSURE( false, "<SwTextShell::ExecCharAttrArgs(..)> - unexpected unvisited character format ID at hyperlink attribute" );
- aINetFmt.SetINetFmtAndId(
- aINetFmt.GetINetFmt(),
- SwStyleNameMapper::GetPoolIdFromUIName( aINetFmt.GetINetFmt(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ) );
- }
-
- if ( pColl )
- pColl->SetFmtAttr( aINetFmt );
- else
- rWrtSh.SetAttrItem( aINetFmt );
- rReq.Done();
- }
- break;
-
- case FN_GROW_FONT_SIZE:
- case FN_SHRINK_FONT_SIZE:
- {
- SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, rPool );
- rWrtSh.GetCurAttr( aSetItem.GetItemSet() );
- SfxItemSet aAttrSet( rPool, aSetItem.GetItemSet().GetRanges() );
-
- sal_uInt16 nScriptTypes = rWrtSh.GetScriptType();
-
- const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>(
- aSetItem.GetItemOfScript( nScriptTypes ) ) );
-
- if (pSize)
- {
- SvxFontHeightItem aSize(*pSize);
-
- sal_uInt32 nSize = aSize.GetHeight();
-
- if ( nSlot == FN_GROW_FONT_SIZE && ( nSize += nFontInc ) > nFontMaxSz )
- nSize = nFontMaxSz;
- else if ( nSlot == FN_SHRINK_FONT_SIZE && ( nSize -= nFontInc ) < nFontInc )
- nSize = nFontInc;
-
- aSize.SetHeight( nSize );
- aSetItem.PutItemForScriptType( nScriptTypes, aSize );
- aAttrSet.Put( aSetItem.GetItemSet() );
-
- if( pColl )
- pColl->SetFmtAttr( aAttrSet );
- else
- rWrtSh.SetAttrSet( aAttrSet );
- }
-
- rReq.Done();
- }
- break;
-
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
-}
-
-void SwTextShell::ExecParaAttr(SfxRequest &rReq)
-{
- SvxAdjust eAdjst;
- sal_uInt8 ePropL;
- const SfxItemSet* pArgs = rReq.GetArgs();
-
- // Get both attributes immediately isn't more expensive!!
- SfxItemSet aSet( GetPool(),
- RES_PARATR_LINESPACING, RES_PARATR_ADJUST,
- RES_FRAMEDIR, RES_FRAMEDIR,
- 0 );
-
- sal_uInt16 nSlot = rReq.GetSlot();
- switch (nSlot)
- {
- case SID_ATTR_PARA_ADJUST:
- {
- if( pArgs && SFX_ITEM_SET == pArgs->GetItemState(RES_PARATR_ADJUST) )
- {
- const SvxAdjustItem& rAdj = (const SvxAdjustItem&) pArgs->Get(RES_PARATR_ADJUST);
- SvxAdjustItem aAdj( rAdj.GetAdjust(), RES_PARATR_ADJUST );
- if ( rAdj.GetAdjust() == SVX_ADJUST_BLOCK )
- {
- aAdj.SetLastBlock( rAdj.GetLastBlock() );
- aAdj.SetOneWord( rAdj.GetOneWord() );
- }
-
- aSet.Put(aAdj);
- }
- }
- break;
- case SID_ATTR_PARA_ADJUST_LEFT: eAdjst = SVX_ADJUST_LEFT; goto SET_ADJUST;
- case SID_ATTR_PARA_ADJUST_RIGHT: eAdjst = SVX_ADJUST_RIGHT; goto SET_ADJUST;
- case SID_ATTR_PARA_ADJUST_CENTER: eAdjst = SVX_ADJUST_CENTER; goto SET_ADJUST;
- case SID_ATTR_PARA_ADJUST_BLOCK: eAdjst = SVX_ADJUST_BLOCK; goto SET_ADJUST;
-SET_ADJUST:
- {
- aSet.Put(SvxAdjustItem(eAdjst,RES_PARATR_ADJUST));
- rReq.AppendItem( SfxBoolItem( GetPool().GetWhich(nSlot), true ) );
- }
- break;
-
- case SID_ATTR_PARA_LINESPACE:
- if(pArgs && SFX_ITEM_SET == pArgs->GetItemState( GetPool().GetWhich(nSlot) ))
- {
- SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pArgs->Get(
- GetPool().GetWhich(nSlot));
- aSet.Put( aLineSpace );
- }
- break;
- case SID_ATTR_PARA_LINESPACE_10: ePropL = 100; goto SET_LINESPACE;
- case SID_ATTR_PARA_LINESPACE_15: ePropL = 150; goto SET_LINESPACE;
- case SID_ATTR_PARA_LINESPACE_20: ePropL = 200; goto SET_LINESPACE;
-
-SET_LINESPACE:
- {
-
- SvxLineSpacingItem aLineSpacing(ePropL, RES_PARATR_LINESPACING );
- aLineSpacing.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
- if( 100 == ePropL )
- aLineSpacing.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
- else
- aLineSpacing.SetPropLineSpace(ePropL);
- aSet.Put( aLineSpacing );
- }
- break;
-
- case SID_ATTR_PARA_LEFT_TO_RIGHT :
- case SID_ATTR_PARA_RIGHT_TO_LEFT :
- {
- SfxItemSet aAdjustSet( GetPool(),
- RES_PARATR_ADJUST, RES_PARATR_ADJUST );
- GetShell().GetCurAttr(aAdjustSet);
- bool bChgAdjust = false;
- SfxItemState eAdjustState = aAdjustSet.GetItemState(RES_PARATR_ADJUST, false);
- if(eAdjustState >= SFX_ITEM_DEFAULT)
- {
- int eAdjust = (int)(( const SvxAdjustItem& )
- aAdjustSet.Get(RES_PARATR_ADJUST)).GetAdjust();
- bChgAdjust = (SVX_ADJUST_LEFT == eAdjust && SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot) ||
- (SVX_ADJUST_RIGHT == eAdjust && SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot);
- }
- else
- bChgAdjust = true;
-
- SvxFrameDirection eFrmDirection =
- (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot) ?
- FRMDIR_HORI_LEFT_TOP : FRMDIR_HORI_RIGHT_TOP;
- aSet.Put( SvxFrameDirectionItem( eFrmDirection, RES_FRAMEDIR ) );
-
- if (bChgAdjust)
- {
- SvxAdjust eAdjust = (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot) ?
- SVX_ADJUST_LEFT : SVX_ADJUST_RIGHT;
- SvxAdjustItem aAdjust( eAdjust, RES_PARATR_ADJUST );
- aSet.Put( aAdjust );
- aAdjust.SetWhich(SID_ATTR_PARA_ADJUST);
- GetView().GetViewFrame()->GetBindings().SetState( aAdjust );
- // Toggle numbering alignment
- const SwNumRule* pCurRule = GetShell().GetCurNumRule();
- if( pCurRule )
- {
- SvxNumRule aRule = pCurRule->MakeSvxNumRule();
-
- for(sal_uInt16 i = 0; i < aRule.GetLevelCount(); i++)
- {
- SvxNumberFormat aFmt(aRule.GetLevel(i));
- if(SVX_ADJUST_LEFT == aFmt.GetNumAdjust())
- aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
-
- else if(SVX_ADJUST_RIGHT == aFmt.GetNumAdjust())
- aFmt.SetNumAdjust( SVX_ADJUST_LEFT );
-
- aRule.SetLevel(i, aFmt, aRule.Get(i) != 0);
- }
- SwNumRule aSetRule( pCurRule->GetName(),
- pCurRule->Get( 0 ).GetPositionAndSpaceMode() );
- aSetRule.SetSvxRule( aRule, GetShell().GetDoc());
- aSetRule.SetAutoRule( sal_True );
- // no start or continuation of a list - list style is only changed
- GetShell().SetCurNumRule( aSetRule, false );
- }
- }
- }
- break;
-
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
- SwWrtShell& rWrtSh = GetShell();
- SwTxtFmtColl* pColl = rWrtSh.GetCurTxtFmtColl();
- if(pColl && pColl->IsAutoUpdateFmt())
- {
- rWrtSh.AutoUpdatePara(pColl, aSet);
- }
- else
- rWrtSh.SetAttrSet( aSet );
- rReq.Done();
-}
-
-void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- const SfxItemSet *pArgs = rReq.GetArgs();
- const SfxPoolItem *pItem = 0;
-
- sal_uInt16 nSlot = rReq.GetSlot();
- if(pArgs)
- pArgs->GetItemState(GetPool().GetWhich(nSlot), false, &pItem);
- switch ( nSlot )
- {
- case FN_DROP_CHAR_STYLE_NAME:
- if( pItem )
- {
- OUString sCharStyleName = ((const SfxStringItem*)pItem)->GetValue();
- SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP, 0L);
- rSh.GetCurAttr(aSet);
- SwFmtDrop aDropItem((const SwFmtDrop&)aSet.Get(RES_PARATR_DROP));
- SwCharFmt* pFmt = 0;
- if(!sCharStyleName.isEmpty())
- pFmt = rSh.FindCharFmtByName( sCharStyleName );
- aDropItem.SetCharFmt( pFmt );
- aSet.Put(aDropItem);
- rSh.SetAttrSet(aSet);
- }
- break;
- case FN_FORMAT_DROPCAPS:
- {
- if(pItem)
- {
- rSh.SetAttrItem(*pItem);
- rReq.Done();
- }
- else
- {
- SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP,
- HINT_END, HINT_END, 0);
- rSh.GetCurAttr(aSet);
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-
- SfxAbstractDialog* pDlg = pFact->CreateSfxDialog( GetView().GetWindow(), aSet,
- rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), DLG_SWDROPCAPS );
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- if (pDlg->Execute() == RET_OK)
- {
- rSh.StartAction();
- rSh.StartUndo( UNDO_START );
- if ( SFX_ITEM_SET == aSet.GetItemState(HINT_END,false,&pItem) )
- {
- if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() )
- rSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue());
- }
- rSh.SetAttrSet(*pDlg->GetOutputItemSet());
- rSh.StartUndo( UNDO_END );
- rSh.EndAction();
- rReq.Done(*pDlg->GetOutputItemSet());
- }
- delete pDlg;
- }
- }
- break;
- case SID_ATTR_PARA_PAGEBREAK:
- if(pItem)
- {
- rSh.SetAttrItem( *pItem );
- rReq.Done();
- }
- break;
- case SID_ATTR_PARA_MODEL:
- {
- if(pItem)
- {
- SfxItemSet aCoreSet( GetPool(),
- RES_PAGEDESC, RES_PAGEDESC,
- SID_ATTR_PARA_MODEL, SID_ATTR_PARA_MODEL, 0);
- aCoreSet.Put(*pItem);
- SfxToSwPageDescAttr( rSh, aCoreSet);
- rSh.SetAttrSet(aCoreSet);
- rReq.Done();
- }
- }
- break;
-
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
-}
-
-void SwTextShell::GetAttrState(SfxItemSet &rSet)
-{
- SwWrtShell &rSh = GetShell();
- SfxItemPool& rPool = GetPool();
- SfxItemSet aCoreSet(rPool, aTxtFmtCollSetRange);
- rSh.GetCurAttr(aCoreSet); // Request *all* text attributes from the core.
-
- SfxWhichIter aIter(rSet);
- sal_uInt16 nSlot = aIter.FirstWhich();
- sal_Bool bFlag = sal_False;
- SfxBoolItem aFlagItem;
- const SfxPoolItem* pItem = 0;
- int eAdjust = -1; // Illegal value to recognize DONTCARE.
- SfxItemState eState = aCoreSet.GetItemState(RES_PARATR_ADJUST, false, &pItem);
-
- if( SFX_ITEM_DEFAULT == eState )
- pItem = &rPool.GetDefaultItem(RES_PARATR_ADJUST);
- if( SFX_ITEM_DEFAULT <= eState )
- eAdjust = (int)(( SvxAdjustItem* ) pItem)->GetAdjust();
-
- short nEsc = 0;
- eState = aCoreSet.GetItemState(RES_CHRATR_ESCAPEMENT, false, &pItem);
- if( SFX_ITEM_DEFAULT == eState )
- pItem = &rPool.GetDefaultItem(RES_CHRATR_ESCAPEMENT);
- if( eState >= SFX_ITEM_DEFAULT )
- nEsc = ((SvxEscapementItem* )pItem)->GetEsc();
-
- sal_uInt16 nLineSpace = 0;
- eState = aCoreSet.GetItemState(RES_PARATR_LINESPACING, false, &pItem);
- if( SFX_ITEM_DEFAULT == eState )
- pItem = &rPool.GetDefaultItem(RES_PARATR_LINESPACING);
- if( SFX_ITEM_DEFAULT <= eState &&
- ((SvxLineSpacingItem* )pItem)->GetLineSpaceRule() == SVX_LINE_SPACE_AUTO )
- {
- if(SVX_INTER_LINE_SPACE_OFF ==
- ((SvxLineSpacingItem* )pItem)->GetInterLineSpaceRule())
- nLineSpace = 100;
- else
- nLineSpace = ((SvxLineSpacingItem* )pItem)->GetPropLineSpace();
- }
-
- while (nSlot)
- {
- switch(nSlot)
- {
- case FN_SET_SUPER_SCRIPT:
- bFlag = 0 < nEsc;
- break;
- case FN_SET_SUB_SCRIPT:
- bFlag = 0 > nEsc;
- break;
- case SID_ATTR_PARA_ADJUST_LEFT:
- if (eAdjust == -1)
- {
- rSet.InvalidateItem( nSlot );
- nSlot = 0;
- }
- else
- bFlag = SVX_ADJUST_LEFT == eAdjust;
- break;
- case SID_ATTR_PARA_ADJUST_RIGHT:
- if (eAdjust == -1)
- {
- rSet.InvalidateItem( nSlot );
- nSlot = 0;
- }
- else
- bFlag = SVX_ADJUST_RIGHT == eAdjust;
- break;
- case SID_ATTR_PARA_ADJUST_CENTER:
- if (eAdjust == -1)
- {
- rSet.InvalidateItem( nSlot );
- nSlot = 0;
- }
- else
- bFlag = SVX_ADJUST_CENTER == eAdjust;
- break;
- case SID_ATTR_PARA_ADJUST_BLOCK:
- {
- if (eAdjust == -1)
- {
- rSet.InvalidateItem( nSlot );
- nSlot = 0;
- }
- else
- {
- bFlag = SVX_ADJUST_BLOCK == eAdjust;
- sal_uInt16 nHtmlMode = GetHtmlMode(rSh.GetView().GetDocShell());
- if((nHtmlMode & HTMLMODE_ON) && !(nHtmlMode & HTMLMODE_FULL_STYLES ))
- {
- rSet.DisableItem( nSlot );
- nSlot = 0;
- }
- }
- }
- break;
- case SID_ATTR_PARA_LINESPACE_10:
- bFlag = nLineSpace == 100;
- break;
- case SID_ATTR_PARA_LINESPACE_15:
- bFlag = nLineSpace == 150;
- break;
- case SID_ATTR_PARA_LINESPACE_20:
- bFlag = nLineSpace == 200;
- break;
- case FN_GROW_FONT_SIZE:
- case FN_SHRINK_FONT_SIZE:
- {
- SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT,
- *rSet.GetPool() );
- aSetItem.GetItemSet().Put( aCoreSet, false );
- const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>(
- aSetItem.GetItemOfScript( rSh.GetScriptType() ) ) );
-
- if( !pSize )
- rSet.DisableItem( nSlot );
- else
- {
- sal_uInt32 nSize = pSize->GetHeight();
- if( nSize == nFontMaxSz )
- rSet.DisableItem( FN_GROW_FONT_SIZE );
- else if( nSize == nFontInc )
- rSet.DisableItem( FN_SHRINK_FONT_SIZE );
- }
- nSlot = 0;
- }
- break;
- case FN_UNDERLINE_DOUBLE:
- {
- eState = aCoreSet.GetItemState(RES_CHRATR_UNDERLINE);
- if( eState >= SFX_ITEM_DEFAULT )
- {
- FontUnderline eUnderline = ((const SvxUnderlineItem&)
- aCoreSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle();
- rSet.Put(SfxBoolItem(nSlot, eUnderline == UNDERLINE_DOUBLE));
- }
- else
- rSet.InvalidateItem(nSlot);
- nSlot = 0;
- }
- break;
- case SID_ATTR_PARA_ADJUST:
- if (eAdjust == -1)
- rSet.InvalidateItem( nSlot );
- else
- rSet.Put(SvxAdjustItem((SvxAdjust)eAdjust, SID_ATTR_PARA_ADJUST ));
- nSlot = 0;
- break;
- case SID_ATTR_PARA_LRSPACE:
- {
- eState = aCoreSet.GetItemState(RES_LR_SPACE);
- if( eState >= SFX_ITEM_DEFAULT )
- {
- SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aCoreSet.Get( RES_LR_SPACE ) );
- aLR.SetWhich(SID_ATTR_PARA_LRSPACE);
- rSet.Put(aLR);
- }
- else
- rSet.InvalidateItem(nSlot);
- nSlot = 0;
- }
- break;
-
- case SID_ATTR_PARA_LEFT_TO_RIGHT :
- case SID_ATTR_PARA_RIGHT_TO_LEFT :
- {
- if ( !SW_MOD()->GetCTLOptions().IsCTLFontEnabled() )
- {
- rSet.DisableItem( nSlot );
- nSlot = 0;
- }
- else
- {
- // is the item set?
- sal_uInt16 nHtmlMode = GetHtmlMode(rSh.GetView().GetDocShell());
- if((!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES))) &&
- aCoreSet.GetItemState( RES_FRAMEDIR, false ) >= SFX_ITEM_DEFAULT)
- {
- SvxFrameDirection eFrmDir = (SvxFrameDirection)
- ((const SvxFrameDirectionItem& )aCoreSet.Get(RES_FRAMEDIR)).GetValue();
- if (FRMDIR_ENVIRONMENT == eFrmDir)
- {
- eFrmDir = rSh.IsInRightToLeftText() ?
- FRMDIR_HORI_RIGHT_TOP : FRMDIR_HORI_LEFT_TOP;
- }
- bFlag = (SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot &&
- FRMDIR_HORI_LEFT_TOP == eFrmDir) ||
- (SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot &&
- FRMDIR_HORI_RIGHT_TOP == eFrmDir);
- }
- else
- {
- rSet.InvalidateItem(nSlot);
- nSlot = 0;
- }
- }
- }
- break;
-
- case SID_ATTR_CHAR_LANGUAGE:
- case SID_ATTR_CHAR_KERNING:
- case RES_PARATR_DROP:
- {
-#if OSL_DEBUG_LEVEL > 1
- const SfxPoolItem& rItem = aCoreSet.Get(GetPool().GetWhich(nSlot), sal_True);
- rSet.Put(rItem);
-#else
- rSet.Put(aCoreSet.Get( GetPool().GetWhich(nSlot), sal_True));
-#endif
- nSlot = 0;
- }
- break;
- case SID_ATTR_PARA_MODEL:
- {
- SfxItemSet aTemp(GetPool(),
- RES_PAGEDESC,RES_PAGEDESC,
- SID_ATTR_PARA_MODEL,SID_ATTR_PARA_MODEL,
- 0L);
- aTemp.Put(aCoreSet);
- ::SwToSfxPageDescAttr(aTemp);
- rSet.Put(aTemp.Get(SID_ATTR_PARA_MODEL));
- nSlot = 0;
- }
- break;
- case RES_TXTATR_INETFMT:
- {
- SfxItemSet aSet(GetPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT);
- rSh.GetCurAttr(aSet);
- const SfxPoolItem& rItem = aSet.Get(RES_TXTATR_INETFMT, sal_True);
- rSet.Put(rItem);
- nSlot = 0;
- }
- break;
-
- default:
- // Do nothing
- nSlot = 0;
- break;
-
- }
- if( nSlot )
- {
- aFlagItem.SetWhich( nSlot );
- aFlagItem.SetValue( bFlag );
- rSet.Put( aFlagItem );
- }
- nSlot = aIter.NextWhich();
- }
-
- rSet.Put(aCoreSet,false);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/txtcrsr.cxx b/sw/source/ui/shells/txtcrsr.cxx
deleted file mode 100644
index 1c0b43e1181a..000000000000
--- a/sw/source/ui/shells/txtcrsr.cxx
+++ /dev/null
@@ -1,376 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sfx2/request.hxx>
-#include <svl/eitem.hxx>
-#include <basic/sbxvar.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/bindings.hxx>
-
-#include <view.hxx>
-#include <wrtsh.hxx>
-#include <textsh.hxx>
-#include <num.hxx>
-#include <edtwin.hxx>
-#include <crsskip.hxx>
-#include <doc.hxx>
-#include <docsh.hxx>
-
-#include <cmdid.h>
-#include <globals.h>
-#include <globals.hrc>
-
-#include <svx/svdouno.hxx>
-#include <svx/fmshell.hxx>
-#include <svx/sdrobjectfilter.hxx>
-
-#include <boost/scoped_ptr.hpp>
-
-using namespace ::com::sun::star;
-
-void SwTextShell::ExecBasicMove(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- GetView().GetEditWin().FlushInBuffer();
- const SfxItemSet *pArgs = rReq.GetArgs();
- sal_Bool bSelect = sal_False;
- sal_Int32 nCount = 1;
- if(pArgs)
- {
- const SfxPoolItem *pItem;
- if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_MOVE_COUNT, true, &pItem))
- nCount = ((const SfxInt32Item *)pItem)->GetValue();
- if(SFX_ITEM_SET == pArgs->GetItemState(FN_PARAM_MOVE_SELECTION, true, &pItem))
- bSelect = ((const SfxBoolItem *)pItem)->GetValue();
- }
- switch(rReq.GetSlot())
- {
- case FN_CHAR_LEFT_SEL: rReq.SetSlot( FN_CHAR_LEFT ); bSelect = sal_True; break;
- case FN_CHAR_RIGHT_SEL: rReq.SetSlot( FN_CHAR_RIGHT ); bSelect = sal_True; break;
- case FN_LINE_UP_SEL: rReq.SetSlot( FN_LINE_UP ); bSelect = sal_True; break;
- case FN_LINE_DOWN_SEL: rReq.SetSlot( FN_LINE_DOWN ); bSelect = sal_True; break;
- }
-
- uno::Reference< frame::XDispatchRecorder > xRecorder =
- GetView().GetViewFrame()->GetBindings().GetRecorder();
- if ( xRecorder.is() )
- {
- rReq.AppendItem( SfxInt32Item(FN_PARAM_MOVE_COUNT, nCount) );
- rReq.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, bSelect) );
- }
- sal_uInt16 nSlot = rReq.GetSlot();
- rReq.Done();
- // Get EditWin before calling the move functions (shell change may occur!)
- SwEditWin& rTmpEditWin = GetView().GetEditWin();
- for( sal_Int32 i = 0; i < nCount; i++ )
- {
- switch(nSlot)
- {
- case FN_CHAR_LEFT: rSh.Left( CRSR_SKIP_CELLS, bSelect, 1, sal_False, sal_True ); break;
- case FN_CHAR_RIGHT: rSh.Right( CRSR_SKIP_CELLS, bSelect, 1, sal_False, sal_True ); break;
- case FN_LINE_UP: rSh.Up ( bSelect, 1 ); break;
- case FN_LINE_DOWN: rSh.Down ( bSelect, 1 ); break;
- default: OSL_FAIL("wrong Dispatcher"); return;
- }
- }
-
- //#i42732# - notify the edit window that from now on we do not use the input language
- rTmpEditWin.SetUseInputLanguage( sal_False );
-}
-
-void SwTextShell::ExecMove(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- SwEditWin& rTmpEditWin = GetView().GetEditWin();
- rTmpEditWin.FlushInBuffer();
-
- sal_uInt16 nSlot = rReq.GetSlot();
- sal_Bool bRet = sal_False;
- switch ( nSlot )
- {
- case FN_START_OF_LINE_SEL:
- case FN_START_OF_LINE: bRet = rSh.LeftMargin ( FN_START_OF_LINE_SEL == nSlot, sal_False );
- break;
-
- case FN_END_OF_LINE_SEL:
- case FN_END_OF_LINE: bRet = rSh.RightMargin( FN_END_OF_LINE_SEL == nSlot, sal_False );
- break;
-
- case FN_START_OF_DOCUMENT_SEL:
- case FN_START_OF_DOCUMENT: bRet = rSh.SttDoc ( FN_START_OF_DOCUMENT_SEL == nSlot);
- break;
-
- case FN_END_OF_DOCUMENT_SEL:
- case FN_END_OF_DOCUMENT: bRet = rSh.EndDoc( FN_END_OF_DOCUMENT_SEL == nSlot );
- break;
-
- case FN_SELECT_WORD: bRet = rSh.SelNearestWrd(); break;
-
- case SID_SELECTALL: bRet = 0 != rSh.SelAll(); break;
- default: OSL_FAIL("wrong dispatcher"); return;
- }
-
- if ( bRet )
- rReq.Done();
- else
- rReq.Ignore();
-
- //#i42732# - notify the edit window that from now on we do not use the input language
- rTmpEditWin.SetUseInputLanguage( sal_False );
-}
-
-void SwTextShell::ExecMovePage(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- GetView().GetEditWin().FlushInBuffer();
-
- sal_uInt16 nSlot = rReq.GetSlot();
- switch( nSlot )
- {
- case FN_START_OF_NEXT_PAGE_SEL :
- case FN_START_OF_NEXT_PAGE: rSh.SttNxtPg( FN_START_OF_NEXT_PAGE_SEL == nSlot ); break;
-
- case FN_END_OF_NEXT_PAGE_SEL:
- case FN_END_OF_NEXT_PAGE: rSh.EndNxtPg( FN_END_OF_NEXT_PAGE_SEL == nSlot ); break;
-
- case FN_START_OF_PREV_PAGE_SEL:
- case FN_START_OF_PREV_PAGE: rSh.SttPrvPg( FN_START_OF_PREV_PAGE_SEL == nSlot ); break;
-
- case FN_END_OF_PREV_PAGE_SEL:
- case FN_END_OF_PREV_PAGE: rSh.EndPrvPg( FN_END_OF_PREV_PAGE_SEL == nSlot ); break;
-
- case FN_START_OF_PAGE_SEL:
- case FN_START_OF_PAGE: rSh.SttPg ( FN_START_OF_PAGE_SEL == nSlot ); break;
-
- case FN_END_OF_PAGE_SEL:
- case FN_END_OF_PAGE: rSh.EndPg ( FN_END_OF_PAGE_SEL == nSlot ); break;
- default: OSL_FAIL("wrong dispatcher"); return;
- }
- rReq.Done();
-}
-
-void SwTextShell::ExecMoveCol(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- switch ( rReq.GetSlot() )
- {
- case FN_START_OF_COLUMN: rSh.StartOfColumn ( sal_False ); break;
- case FN_END_OF_COLUMN: rSh.EndOfColumn ( sal_False ); break;
- case FN_START_OF_NEXT_COLUMN: rSh.StartOfNextColumn( sal_False ) ; break;
- case FN_END_OF_NEXT_COLUMN: rSh.EndOfNextColumn ( sal_False ); break;
- case FN_START_OF_PREV_COLUMN: rSh.StartOfPrevColumn( sal_False ); break;
- case FN_END_OF_PREV_COLUMN: rSh.EndOfPrevColumn ( sal_False ); break;
- default: OSL_FAIL("wrong dispatcher"); return;
- }
- rReq.Done();
-}
-
-void SwTextShell::ExecMoveLingu(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- GetView().GetEditWin().FlushInBuffer();
-
- sal_uInt16 nSlot = rReq.GetSlot();
- switch ( nSlot )
- {
- case FN_NEXT_WORD_SEL:
- case FN_NEXT_WORD: rSh.NxtWrd( FN_NEXT_WORD_SEL == nSlot );
- break;
-
- case FN_START_OF_PARA_SEL:
- case FN_START_OF_PARA: rSh.SttPara( FN_START_OF_PARA_SEL == nSlot );
- break;
-
- case FN_END_OF_PARA_SEL:
- case FN_END_OF_PARA: rSh.EndPara( FN_END_OF_PARA_SEL == nSlot );
- break;
-
- case FN_PREV_WORD_SEL:
- case FN_PREV_WORD: rSh.PrvWrd( FN_PREV_WORD_SEL == nSlot );
- break;
-
- case FN_NEXT_SENT_SEL:
- case FN_NEXT_SENT: rSh.FwdSentence( FN_NEXT_SENT_SEL == nSlot );
- break;
-
- case FN_PREV_SENT_SEL:
- case FN_PREV_SENT: rSh.BwdSentence( FN_PREV_SENT_SEL == nSlot );
- break;
-
- case FN_NEXT_PARA: rSh.FwdPara ( sal_False );
- break;
-
- case FN_PREV_PARA: rSh.BwdPara ( sal_False );
- break;
- default: OSL_FAIL("wrong dispatcher"); return;
- }
- rReq.Done();
-}
-
-void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
-{
- SwWrtShell &rSh = GetShell();
- sal_uInt16 nSlot = rReq.GetSlot();
- sal_Bool bSetRetVal = sal_True, bRet = sal_True;
- switch ( nSlot )
- {
- case SID_FM_TOGGLECONTROLFOCUS:
- {
- const SwDoc* pDoc = rSh.GetDoc();
- const SwDocShell* pDocShell = pDoc ? pDoc->GetDocShell() : NULL;
- const SwView* pView = pDocShell ? pDocShell->GetView() : NULL;
- const FmFormShell* pFormShell = pView ? pView->GetFormShell() : NULL;
- SdrView* pDrawView = pView ? pView->GetDrawView() : NULL;
- Window* pWindow = pView ? pView->GetWrtShell().GetWin() : NULL;
-
- OSL_ENSURE( pFormShell && pDrawView && pWindow, "SwXTextView::ExecMoveMisc: no chance!" );
- if ( !pFormShell || !pDrawView || !pWindow )
- break;
-
- boost::scoped_ptr< ::svx::ISdrObjectFilter > pFilter( pFormShell->CreateFocusableControlFilter(
- *pDrawView, *pWindow ) );
- if ( !pFilter.get() )
- break;
-
- const SdrObject* pNearestControl = rSh.GetBestObject( sal_True, GOTOOBJ_DRAW_CONTROL, sal_False, pFilter.get() );
- if ( !pNearestControl )
- break;
-
- const SdrUnoObj* pUnoObject = dynamic_cast< const SdrUnoObj* >( pNearestControl );
- OSL_ENSURE( pUnoObject, "SwTextShell::ExecMoveMisc: GetBestObject returned nonsense!" );
- if ( !pUnoObject )
- break;
-
- pFormShell->ToggleControlFocus( *pUnoObject, *pDrawView, *pWindow );
- }
- break;
- case FN_CNTNT_TO_NEXT_FRAME:
- bRet = rSh.GotoObj(sal_True, GOTOOBJ_GOTO_ANY);
- if(bRet)
- {
- rSh.HideCrsr();
- rSh.EnterSelFrmMode();
- }
- break;
- case FN_NEXT_FOOTNOTE:
- rSh.MoveCrsr();
- bRet = rSh.GotoNextFtnAnchor();
- break;
- case FN_PREV_FOOTNOTE:
- rSh.MoveCrsr();
- bRet = rSh.GotoPrevFtnAnchor();
- break;
- case FN_TO_HEADER:
- rSh.MoveCrsr();
- if ( FRMTYPE_HEADER & rSh.GetFrmType(0,sal_False) )
- rSh.SttPg();
- else
- {
- bool bMoved = rSh.GotoHeaderTxt();
- if ( !bMoved )
- rSh.SttPg();
- }
- bSetRetVal = sal_False;
- break;
- case FN_TO_FOOTER:
- rSh.MoveCrsr();
- if ( FRMTYPE_FOOTER & rSh.GetFrmType(0,sal_False) )
- rSh.EndPg();
- else
- {
- bool bMoved = rSh.GotoFooterTxt();
- if ( !bMoved )
- rSh.EndPg();
- }
- bSetRetVal = sal_False;
- break;
- case FN_FOOTNOTE_TO_ANCHOR:
- rSh.MoveCrsr();
- if ( FRMTYPE_FOOTNOTE & rSh.GetFrmType(0,sal_False) )
- rSh.GotoFtnAnchor();
- else
- rSh.GotoFtnTxt();
- bSetRetVal = sal_False;
- break;
- case FN_TO_FOOTNOTE_AREA :
- rSh.GotoFtnTxt();
- break;
- case FN_PREV_TABLE:
- bRet = rSh.MoveTable( fnTablePrev, fnTableStart);
- break;
- case FN_NEXT_TABLE:
- bRet = rSh.MoveTable(fnTableNext, fnTableStart);
- break;
- case FN_GOTO_NEXT_REGION :
- bRet = rSh.MoveRegion(fnRegionNext, fnRegionStart);
- break;
- case FN_GOTO_PREV_REGION :
- bRet = rSh.MoveRegion(fnRegionPrev, fnRegionStart);
- break;
-
- case FN_NEXT_TOXMARK:
- bRet = rSh.GotoNxtPrvTOXMark( sal_True );
- break;
- case FN_PREV_TOXMARK:
- bRet = rSh.GotoNxtPrvTOXMark( sal_False );
- break;
- case FN_NEXT_TBLFML:
- bRet = rSh.GotoNxtPrvTblFormula( sal_True, sal_False );
- break;
- case FN_PREV_TBLFML:
- bRet = rSh.GotoNxtPrvTblFormula( sal_False, sal_False );
- break;
- case FN_NEXT_TBLFML_ERR:
- bRet = rSh.GotoNxtPrvTblFormula( sal_True, sal_True );
- break;
- case FN_PREV_TBLFML_ERR:
- bRet = rSh.GotoNxtPrvTblFormula( sal_False, sal_True );
- break;
-
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
-
- if( bSetRetVal )
- rReq.SetReturnValue(SfxBoolItem( nSlot, bRet ));
- rReq.Done();
-
- sal_Bool bInHeader = sal_True;
- if ( rSh.IsInHeaderFooter( &bInHeader ) )
- {
- if ( !bInHeader )
- {
- rSh.SetShowHeaderFooterSeparator( Footer, true );
- rSh.SetShowHeaderFooterSeparator( Header, false );
- }
- else
- {
- rSh.SetShowHeaderFooterSeparator( Header, true );
- rSh.SetShowHeaderFooterSeparator( Footer, false );
- }
-
- // Force repaint
- rSh.GetWin()->Invalidate();
- }
- if ( rSh.IsInHeaderFooter() != rSh.IsHeaderFooterEdit() )
- rSh.ToggleHeaderFooterEdit();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/shells/txtnum.cxx b/sw/source/ui/shells/txtnum.cxx
deleted file mode 100644
index bffbfc2c3583..000000000000
--- a/sw/source/ui/shells/txtnum.cxx
+++ /dev/null
@@ -1,410 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <hintids.hxx>
-#include <vcl/msgbox.hxx>
-#include <sfx2/request.hxx>
-#include <svl/eitem.hxx>
-#include <svl/stritem.hxx>
-#include <editeng/numitem.hxx>
-#include <editeng/brushitem.hxx>
-#include <numrule.hxx>
-
-#include "cmdid.h"
-#include "wrtsh.hxx"
-#include "view.hxx"
-#include "viewopt.hxx"
-#include "wdocsh.hxx"
-#include "textsh.hxx"
-#include "uiitems.hxx"
-#include "swabstdlg.hxx"
-#include <globals.hrc>
-#include <sfx2/tabdlg.hxx>
-#include <svx/nbdtmg.hxx>
-#include <svx/nbdtmgfact.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/bindings.hxx>
-using namespace svx::sidebar;
-
-void SwTextShell::ExecEnterNum(SfxRequest &rReq)
-{
- //Because the record before any shell exchange.
- switch(rReq.GetSlot())
- {
- case FN_NUM_NUMBERING_ON:
- {
- GetShell().StartAllAction();
- SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , false );
- sal_Bool bMode = !GetShell().SelectionHasNumber(); // #i29560#
- if ( pItem )
- bMode = pItem->GetValue();
- else
- rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
-
- if ( bMode != (GetShell().SelectionHasNumber()) ) // #i29560#
- {
- rReq.Done();
- if( bMode )
- GetShell().NumOn();
- else
- GetShell().NumOrBulletOff(); // #i29560#
- }
- sal_Bool bNewResult = GetShell().SelectionHasNumber();
- if (bNewResult!=bMode) {
- SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
- SfxBoolItem aItem(FN_NUM_NUMBERING_ON,!bNewResult);
- rBindings.SetState(aItem);
- SfxBoolItem aNewItem(FN_NUM_NUMBERING_ON,bNewResult);
- rBindings.SetState(aNewItem);
- }
- GetShell().EndAllAction();
- }
- break;
- case FN_NUM_BULLET_ON:
- {
- GetShell().StartAllAction();
- SFX_REQUEST_ARG( rReq, pItem, SfxBoolItem, FN_PARAM_1 , false );
- sal_Bool bMode = !GetShell().SelectionHasBullet(); // #i29560#
- if ( pItem )
- bMode = pItem->GetValue();
- else
- rReq.AppendItem( SfxBoolItem( FN_PARAM_1, bMode ) );
-
- if ( bMode != (GetShell().SelectionHasBullet()) ) // #i29560#
- {
- rReq.Done();
- if( bMode )
- GetShell().BulletOn();
- else
- GetShell().NumOrBulletOff(); // #i29560#
- }
- sal_Bool bNewResult = GetShell().SelectionHasBullet();
- if (bNewResult!=bMode) {
- SfxBindings& rBindings = GetView().GetViewFrame()->GetBindings();
- SfxBoolItem aItem(FN_NUM_BULLET_ON,!bNewResult);
- rBindings.SetState(aItem);
- SfxBoolItem aNewItem(FN_NUM_BULLET_ON,bNewResult);
- rBindings.SetState(aNewItem);
- }
- GetShell().EndAllAction();
- }
- break;
- case FN_NUMBER_BULLETS:
- case SID_OUTLINE_BULLET:
- {
- SfxItemSet aSet(GetPool(),
- SID_HTML_MODE, SID_HTML_MODE,
- SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
- 0 );
- SwDocShell* pDocSh = GetView().GetDocShell();
- bool bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh);
- const SwNumRule* pCurRule = GetShell().GetCurNumRule();
- if( pCurRule )
- {
- SvxNumRule aRule = pCurRule->MakeSvxNumRule();
-
- //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN)
- for(sal_uInt16 i = 0; i < aRule.GetLevelCount(); i++)
- {
- SvxNumberFormat aFmt(aRule.GetLevel(i));
- if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
- {
- const SvxBrushItem* pBrush = aFmt.GetBrush();
- if(pBrush && !pBrush->GetGraphicLink().isEmpty())
- aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
- aRule.SetLevel(i, aFmt, aRule.Get(i) != 0);
- }
- }
- if(bHtml)
- aRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, false);
-
- aSet.Put(SvxNumBulletItem(aRule));
- OSL_ENSURE( GetShell().GetNumLevel() < MAXLEVEL,
- "<SwTextShell::ExecEnterNum()> - numbered node without valid list level. Serious defect -> please inform OD." );
- sal_uInt16 nLevel = GetShell().GetNumLevel();
- if( nLevel < MAXLEVEL )
- {
- nLevel = 1<<nLevel;
- aSet.Put( SfxUInt16Item( SID_PARAM_CUR_NUM_LEVEL, nLevel ));
- }
- }
- else
- {
- SwNumRule aRule( GetShell().GetUniqueNumRuleName(),
- // #i89178#
- numfunc::GetDefaultPositionAndSpaceMode() );
- SvxNumRule aSvxRule = aRule.MakeSvxNumRule();
- const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 );
-
- if( bHtml || bRightToLeft )
- {
- for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
- {
- SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) );
- if ( n && bHtml )
- {
- // 1/2" for HTML
- aFmt.SetLSpace(720);
- aFmt.SetAbsLSpace(n * 720);
- }
- // #i38904# Default alignment for
- // numbering/bullet should be rtl in rtl paragraph:
- if ( bRightToLeft )
- {
- aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
- }
- aSvxRule.SetLevel( n, aFmt, false );
- }
- aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, false);
- }
- aSet.Put(SvxNumBulletItem(aSvxRule));
- }
-
- aSet.Put( SfxBoolItem( SID_PARAM_NUM_PRESET,false ));
-
- // Before the dialogue of the HTML mode will be dropped at the Docshell.
- pDocSh->PutItem(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(pDocSh)));
-
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialogdiet fail!");
- SfxAbstractTabDialog* pDlg = pFact->CreateSwTabDialog( DLG_SVXTEST_NUM_BULLET,
- GetView().GetWindow(), &aSet, GetShell());
- OSL_ENSURE(pDlg, "Dialogdiet fail!");
- sal_uInt16 nRet = pDlg->Execute();
- const SfxPoolItem* pItem;
- if( RET_OK == nRet )
- {
- if( SFX_ITEM_SET == pDlg->GetOutputItemSet()->GetItemState( SID_ATTR_NUMBERING_RULE, false, &pItem ))
- {
- rReq.AppendItem(*pItem);
- rReq.Done();
- SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
- pSetRule->UnLinkGraphics();
- SwNumRule aSetRule( pCurRule
- ? pCurRule->GetName()
- : GetShell().GetUniqueNumRuleName(),
- // #i89178#
- numfunc::GetDefaultPositionAndSpaceMode() );
- aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc());
- aSetRule.SetAutoRule( sal_True );
- // No start of new list, if an existing list style is edited.
- // Otherwise start a new list.
- const bool bCreateList = (pCurRule == 0);
- GetShell().SetCurNumRule( aSetRule, bCreateList );
- }
- // If the Dialog was leaved with OK but nothing was chosen then the
- // numbering must be at least activated, if it is not already.
- else if( !pCurRule && SFX_ITEM_SET == aSet.GetItemState( SID_ATTR_NUMBERING_RULE, false, &pItem ))
- {
- rReq.AppendItem( *pItem );
- rReq.Done();
- SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
- SwNumRule aSetRule( GetShell().GetUniqueNumRuleName(),
- // #i89178#
- numfunc::GetDefaultPositionAndSpaceMode() );
- aSetRule.SetSvxRule(*pSetRule, GetShell().GetDoc());
- aSetRule.SetAutoRule( sal_True );
- // start new list
- GetShell().SetCurNumRule( aSetRule, true );
- }
- }
- else if(RET_USER == nRet)
- GetShell().DelNumRules();
-
- delete pDlg;
- }
- break;
- default:
- OSL_FAIL("wrong dispatcher");
- return;
- }
-}
-
-void SwTextShell::ExecSetNumber(SfxRequest &rReq)
-{
- SwNumRule aRule( GetShell().GetUniqueNumRuleName(),
- // #i89178#
- numfunc::GetDefaultPositionAndSpaceMode() );
-
- SvxNumRule aSvxRule = aRule.MakeSvxNumRule();
- const bool bRightToLeft = GetShell().IsInRightToLeftText( 0 );
-
- if( bRightToLeft )
- {
- for( sal_uInt8 n = 0; n < MAXLEVEL; ++n )
- {
- SvxNumberFormat aFmt( aSvxRule.GetLevel( n ) );
- /* if ( n && bHtml )
- {
- // 1/2" for HTML
- aFmt.SetLSpace(720);
- aFmt.SetAbsLSpace(n * 720);
- }*/
- // #i38904# Default alignment for
- // numbering/bullet should be rtl in rtl paragraph:
- if ( bRightToLeft )
- {
- aFmt.SetNumAdjust( SVX_ADJUST_RIGHT );
- }
- aSvxRule.SetLevel( n, aFmt, false );
- }
- aSvxRule.SetFeatureFlag(NUM_ENABLE_EMBEDDED_BMP, false);
- }
-
- const SwNumRule* pCurRule = GetShell().GetCurNumRule();
- sal_uInt16 nActNumLvl = (sal_uInt16)0xFFFF;
- if( pCurRule )
- {
- sal_uInt16 nLevel = GetShell().GetNumLevel();
- if( nLevel < MAXLEVEL )
- {
- nActNumLvl = 1<<nLevel;
- }
-
- aSvxRule = pCurRule->MakeSvxNumRule();
-
- //convert type of linked bitmaps from SVX_NUM_BITMAP to (SVX_NUM_BITMAP|LINK_TOKEN)
- for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
- {
- SvxNumberFormat aFmt(aSvxRule.GetLevel(i));
- if(SVX_NUM_BITMAP == aFmt.GetNumberingType())
- {
- const SvxBrushItem* pBrush = aFmt.GetBrush();
- if( pBrush && !pBrush->GetGraphicLink().isEmpty() )
- aFmt.SetNumberingType(SvxExtNumType(SVX_NUM_BITMAP|LINK_TOKEN));
- aSvxRule.SetLevel(i, aFmt, aSvxRule.Get(i) != 0);
- }
- }
- }
-
- switch(rReq.GetSlot())
- {
- case FN_SVX_SET_NUMBER:
- {
- SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_NUMBER , false );
- if (pItem)
- {
- sal_uInt16 nIdx = pItem->GetValue();
- if (nIdx==DEFAULT_NONE) {
- GetShell().DelNumRules();
- break;
- }
- --nIdx;
-
- NBOTypeMgrBase* pNumbering = NBOutlineTypeMgrFact::CreateInstance(eNBOType::NUMBERING);
- if ( pNumbering )
- {
- SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
-
- SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
- // set unit attribute to NB Manager
- SfxItemSet aSet(GetPool(),
- SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
- 0 );
- aSet.Put(SvxNumBulletItem(aTempRule));
- pNumbering->SetItems(&aSet);
- pNumbering->ApplyNumRule(aTempRule,nIdx,nActNumLvl);
-
- sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
- {
- if(nActNumLvl & nMask)
- {
- SvxNumberFormat aFmt(aTempRule.GetLevel(i));
- aSvxRule.SetLevel(i, aFmt);
- }
- nMask <<= 1 ;
- }
-
- aSvxRule.UnLinkGraphics();
- SwNumRule aSetRule( pCurRule
- ? pCurRule->GetName()
- : GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
- aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());
-
- aSetRule.SetAutoRule( sal_True );
- const bool bCreateList = (pCurRule == 0);
- GetShell().SetCurNumRule( aSetRule, bCreateList );
- }
- //End
- }
- break;
- }
- case FN_SVX_SET_BULLET:
- {
- SFX_REQUEST_ARG( rReq, pItem, SfxUInt16Item, FN_SVX_SET_BULLET , false );
- if (pItem)
- {
- sal_uInt16 nIdx = pItem->GetValue();
- if (nIdx==DEFAULT_NONE) {
- GetShell().DelNumRules();
- break;
- }
- nIdx--;
-
- NBOTypeMgrBase* pBullets = NBOutlineTypeMgrFact::CreateInstance(eNBOType::MIXBULLETS);
- if ( pBullets )
- {
- SwNumRule aTmpRule( GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
-
- SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
- // set unit attribute to NB Manager
- SfxItemSet aSet(GetPool(),
- SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
- 0 );
- aSet.Put(SvxNumBulletItem(aTempRule));
- pBullets->SetItems(&aSet);
-
- //SvxNumRule aTempRule( 0, 10, false );
- pBullets->ApplyNumRule(aTempRule,nIdx,nActNumLvl);
- sal_uInt16 nMask = 1;
- for(sal_uInt16 i = 0; i < aSvxRule.GetLevelCount(); i++)
- {
- if(nActNumLvl & nMask)
- {
- SvxNumberFormat aFmt(aTempRule.GetLevel(i));
- aSvxRule.SetLevel(i, aFmt);
- }
- nMask <<= 1;
- }
- aSvxRule.UnLinkGraphics();
-
- SwNumRule aSetRule( pCurRule
- ? pCurRule->GetName()
- : GetShell().GetUniqueNumRuleName(),
- numfunc::GetDefaultPositionAndSpaceMode() );
-
- aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());
-
- aSetRule.SetAutoRule( sal_True );
- const bool bCreateList = (pCurRule == 0);
- GetShell().SetCurNumRule( aSetRule, bCreateList );
- }
- //End
- }
-
- }
- break;
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */