Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "fuline.hxx"
21 :
22 : #include <svx/svxids.hrc>
23 : #include <svx/tabline.hxx>
24 : #include <svx/xenum.hxx>
25 : #include <vcl/msgbox.hxx>
26 : #include <svl/intitem.hxx>
27 : #include <svl/stritem.hxx>
28 : #include <sfx2/request.hxx>
29 : #include <svx/xdef.hxx>
30 : #include <sfx2/bindings.hxx>
31 : #include <sfx2/viewfrm.hxx>
32 : #include "ViewShell.hxx"
33 : #include "View.hxx"
34 : #include "Window.hxx"
35 : #include "drawdoc.hxx"
36 : #include "app.hrc"
37 : #include <svx/svxdlg.hxx>
38 : #include <svx/dialogs.hrc>
39 :
40 : namespace sd {
41 :
42 0 : TYPEINIT1( FuLine, FuPoor );
43 :
44 : /*************************************************************************
45 : |*
46 : |* Konstruktor
47 : |*
48 : \************************************************************************/
49 :
50 0 : FuLine::FuLine (
51 : ViewShell* pViewSh,
52 : ::sd::Window* pWin,
53 : ::sd::View* pView,
54 : SdDrawDocument* pDoc,
55 : SfxRequest& rReq)
56 0 : : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
57 : {
58 0 : }
59 :
60 0 : FunctionReference FuLine::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
61 : {
62 0 : FunctionReference xFunc( new FuLine( pViewSh, pWin, pView, pDoc, rReq ) );
63 0 : xFunc->DoExecute(rReq);
64 0 : return xFunc;
65 : }
66 :
67 0 : void FuLine::DoExecute( SfxRequest& rReq )
68 : {
69 0 : sal_Bool bHasMarked = mpView->AreObjectsMarked();
70 :
71 0 : const SfxItemSet* pArgs = rReq.GetArgs();
72 :
73 0 : if( !pArgs )
74 : {
75 0 : const SdrObject* pObj = NULL;
76 0 : const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
77 0 : if( rMarkList.GetMarkCount() == 1 )
78 0 : pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
79 :
80 0 : SfxItemSet* pNewAttr = new SfxItemSet( mpDoc->GetPool() );
81 0 : mpView->GetAttributes( *pNewAttr );
82 :
83 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
84 0 : SfxAbstractTabDialog * pDlg = pFact ? pFact->CreateSvxLineTabDialog(NULL,pNewAttr,mpDoc,pObj,bHasMarked) : 0;
85 0 : if( pDlg && (pDlg->Execute() == RET_OK) )
86 : {
87 0 : mpView->SetAttributes (*(pDlg->GetOutputItemSet ()));
88 : }
89 :
90 : // Attribute wurden geaendert, Listboxes in Objectbars muessen aktualisiert werden
91 : static sal_uInt16 SidArray[] = {
92 : SID_ATTR_LINE_STYLE,
93 : SID_ATTR_LINE_DASH,
94 : SID_ATTR_LINE_WIDTH,
95 : SID_ATTR_LINE_COLOR,
96 : 0 };
97 :
98 0 : mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
99 :
100 0 : delete pDlg;
101 0 : delete pNewAttr;
102 : }
103 :
104 0 : rReq.Ignore ();
105 0 : }
106 :
107 0 : void FuLine::Activate()
108 : {
109 0 : }
110 :
111 0 : void FuLine::Deactivate()
112 : {
113 0 : }
114 :
115 :
116 9 : } // end of namespace sd
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|