2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* 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 .
|
|
|
|
*/
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
#include <svx/svxids.hrc>
|
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#include <sfx2/request.hxx>
|
|
|
|
#include <sfx2/dispatch.hxx>
|
|
|
|
#include <svx/svdview.hxx>
|
|
|
|
#include <svx/drawitem.hxx>
|
|
|
|
|
2004-02-03 15:48:08 +00:00
|
|
|
#include <svx/xtable.hxx>
|
2000-09-18 16:15:01 +00:00
|
|
|
#include "view.hxx"
|
|
|
|
#include "wrtsh.hxx"
|
|
|
|
#include "docsh.hxx"
|
|
|
|
#include "cmdid.h"
|
|
|
|
|
|
|
|
#include "drawsh.hxx"
|
2007-09-27 11:26:48 +00:00
|
|
|
#include <svx/svxdlg.hxx>
|
|
|
|
#include <svx/dialogs.hrc>
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
void SwDrawShell::ExecDrawDlg(SfxRequest& rReq)
|
|
|
|
{
|
|
|
|
SwWrtShell* pSh = &GetShell();
|
|
|
|
SdrView* pView = pSh->GetDrawView();
|
|
|
|
SdrModel* pDoc = pView->GetModel();
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bChanged = pDoc->IsChanged();
|
|
|
|
pDoc->SetChanged(sal_False);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
SfxItemSet aNewAttr( pDoc->GetItemPool() );
|
|
|
|
pView->GetAttributes( aNewAttr );
|
|
|
|
|
|
|
|
GetView().NoRotate();
|
|
|
|
|
|
|
|
switch (rReq.GetSlot())
|
|
|
|
{
|
|
|
|
case FN_DRAWTEXT_ATTR_DLG:
|
|
|
|
{
|
2004-02-03 15:48:08 +00:00
|
|
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
|
|
|
if ( pFact )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2009-11-02 20:49:14 +01:00
|
|
|
SfxAbstractTabDialog *pDlg = pFact->CreateTextTabDialog( NULL, &aNewAttr, pView );
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_uInt16 nResult = pDlg->Execute();
|
2004-02-03 15:48:08 +00:00
|
|
|
|
|
|
|
if (nResult == RET_OK)
|
2001-06-12 09:10:21 +00:00
|
|
|
{
|
2004-07-12 14:50:49 +00:00
|
|
|
if (pView->AreObjectsMarked())
|
2004-02-03 15:48:08 +00:00
|
|
|
{
|
|
|
|
pSh->StartAction();
|
|
|
|
pView->SetAttributes(*pDlg->GetOutputItemSet());
|
|
|
|
rReq.Done(*(pDlg->GetOutputItemSet()));
|
|
|
|
pSh->EndAction();
|
|
|
|
}
|
2001-06-12 09:10:21 +00:00
|
|
|
}
|
2004-02-03 15:48:08 +00:00
|
|
|
|
|
|
|
delete( pDlg );
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_ATTRIBUTES_AREA:
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bHasMarked = pView->AreObjectsMarked();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2004-02-03 15:48:08 +00:00
|
|
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
|
|
|
AbstractSvxAreaTabDialog * pDlg = pFact->CreateSvxAreaTabDialog( NULL,
|
|
|
|
&aNewAttr,
|
|
|
|
pDoc,
|
|
|
|
pView);
|
2000-09-18 16:15:01 +00:00
|
|
|
if (pDlg->Execute() == RET_OK)
|
|
|
|
{
|
2001-06-12 09:10:21 +00:00
|
|
|
pSh->StartAction();
|
2000-09-18 16:15:01 +00:00
|
|
|
if (bHasMarked)
|
|
|
|
pView->SetAttributes(*pDlg->GetOutputItemSet());
|
|
|
|
else
|
2011-01-17 15:06:54 +01:00
|
|
|
pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), sal_False);
|
2001-06-12 09:10:21 +00:00
|
|
|
pSh->EndAction();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SID_ATTR_FILL_STYLE, SID_ATTR_FILL_COLOR, 0
|
|
|
|
};
|
|
|
|
SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
|
|
|
|
rBnd.Invalidate(aInval);
|
|
|
|
rBnd.Update(SID_ATTR_FILL_STYLE);
|
|
|
|
rBnd.Update(SID_ATTR_FILL_COLOR);
|
|
|
|
}
|
|
|
|
delete pDlg;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_ATTRIBUTES_LINE:
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bHasMarked = pView->AreObjectsMarked();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
const SdrObject* pObj = NULL;
|
2004-07-12 14:50:49 +00:00
|
|
|
const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
|
2000-09-18 16:15:01 +00:00
|
|
|
if( rMarkList.GetMarkCount() == 1 )
|
2006-07-25 11:42:30 +00:00
|
|
|
pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2004-02-03 15:48:08 +00:00
|
|
|
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
|
2010-10-24 23:48:32 +02:00
|
|
|
OSL_ENSURE(pFact, "Dialogdiet Factory fail!");
|
2004-02-03 15:48:08 +00:00
|
|
|
SfxAbstractTabDialog * pDlg = pFact->CreateSvxLineTabDialog( NULL,
|
|
|
|
&aNewAttr,
|
|
|
|
pDoc,
|
|
|
|
pObj,
|
|
|
|
bHasMarked);
|
2010-10-24 23:48:32 +02:00
|
|
|
OSL_ENSURE(pDlg, "Dialogdiet fail!");
|
2000-09-18 16:15:01 +00:00
|
|
|
if (pDlg->Execute() == RET_OK)
|
|
|
|
{
|
2001-06-12 09:10:21 +00:00
|
|
|
pSh->StartAction();
|
2000-09-18 16:15:01 +00:00
|
|
|
if(bHasMarked)
|
2011-01-17 15:06:54 +01:00
|
|
|
pView->SetAttrToMarked(*pDlg->GetOutputItemSet(), sal_False);
|
2000-09-18 16:15:01 +00:00
|
|
|
else
|
2011-01-17 15:06:54 +01:00
|
|
|
pView->SetDefaultAttr(*pDlg->GetOutputItemSet(), sal_False);
|
2001-06-12 09:10:21 +00:00
|
|
|
pSh->EndAction();
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2011-03-14 16:51:14 +00:00
|
|
|
static sal_uInt16 aInval[] =
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
SID_ATTR_LINE_STYLE, SID_ATTR_LINE_WIDTH,
|
|
|
|
SID_ATTR_LINE_COLOR, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
GetView().GetViewFrame()->GetBindings().Invalidate(aInval);
|
|
|
|
}
|
|
|
|
delete pDlg;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (pDoc->IsChanged())
|
|
|
|
GetShell().SetModified();
|
|
|
|
else
|
|
|
|
if (bChanged)
|
2011-01-17 15:06:54 +01:00
|
|
|
pDoc->SetChanged(sal_True);
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawShell::ExecDrawAttrArgs(SfxRequest& rReq)
|
|
|
|
{
|
|
|
|
SwWrtShell* pSh = &GetShell();
|
|
|
|
SdrView* pView = pSh->GetDrawView();
|
|
|
|
const SfxItemSet* pArgs = rReq.GetArgs();
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bChanged = pView->GetModel()->IsChanged();
|
|
|
|
pView->GetModel()->SetChanged(sal_False);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
GetView().NoRotate();
|
|
|
|
|
|
|
|
if (pArgs)
|
|
|
|
{
|
2004-07-12 14:50:49 +00:00
|
|
|
if(pView->AreObjectsMarked())
|
2011-01-17 15:06:54 +01:00
|
|
|
pView->SetAttrToMarked(*rReq.GetArgs(), sal_False);
|
2000-09-18 16:15:01 +00:00
|
|
|
else
|
2011-01-17 15:06:54 +01:00
|
|
|
pView->SetDefaultAttr(*rReq.GetArgs(), sal_False);
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
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:
|
2011-01-17 15:06:54 +01:00
|
|
|
pDis->Execute(SID_ATTRIBUTES_AREA, sal_False);
|
2000-09-18 16:15:01 +00:00
|
|
|
break;
|
|
|
|
case SID_ATTR_LINE_STYLE:
|
|
|
|
case SID_ATTR_LINE_DASH:
|
|
|
|
case SID_ATTR_LINE_WIDTH:
|
|
|
|
case SID_ATTR_LINE_COLOR:
|
2011-01-17 15:06:54 +01:00
|
|
|
pDis->Execute(SID_ATTRIBUTES_LINE, sal_False);
|
2000-09-18 16:15:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pView->GetModel()->IsChanged())
|
|
|
|
GetShell().SetModified();
|
|
|
|
else
|
|
|
|
if (bChanged)
|
2011-01-17 15:06:54 +01:00
|
|
|
pView->GetModel()->SetChanged(sal_True);
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwDrawShell::GetDrawAttrState(SfxItemSet& rSet)
|
|
|
|
{
|
|
|
|
SdrView* pSdrView = GetShell().GetDrawView();
|
|
|
|
|
2004-07-12 14:50:49 +00:00
|
|
|
if (pSdrView->AreObjectsMarked())
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool bDisable = Disable( rSet );
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
if( !bDisable )
|
|
|
|
pSdrView->GetAttributes( rSet );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rSet.Put(pSdrView->GetDefaultAttr());
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|