15b190011SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file
55b190011SAndrew Rist * distributed with this work for additional information
65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file
75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the
85b190011SAndrew Rist * "License"); you may not use this file except in compliance
95b190011SAndrew Rist * with the License. You may obtain a copy of the License at
105b190011SAndrew Rist *
115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
125b190011SAndrew Rist *
135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing,
145b190011SAndrew Rist * software distributed under the License is distributed on an
155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165b190011SAndrew Rist * KIND, either express or implied. See the License for the
175b190011SAndrew Rist * specific language governing permissions and limitations
185b190011SAndrew Rist * under the License.
195b190011SAndrew Rist *
205b190011SAndrew Rist *************************************************************/
215b190011SAndrew Rist
225b190011SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sd.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir #include "fuparagr.hxx"
29cdf0e10cSrcweir #include <editeng/eeitem.hxx>
30cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen
31cdf0e10cSrcweir #include <vcl/msgbox.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #include <sfx2/bindings.hxx>
34cdf0e10cSrcweir #include <sfx2/request.hxx>
35cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
36cdf0e10cSrcweir #include <svx/svxids.hrc>
37cdf0e10cSrcweir #include <editeng/editdata.hxx>
38cdf0e10cSrcweir #include <editeng/lrspitem.hxx>
39cdf0e10cSrcweir #include <svx/svdoutl.hxx>
40cdf0e10cSrcweir
41cdf0e10cSrcweir #include "app.hrc"
42cdf0e10cSrcweir #include "View.hxx"
43cdf0e10cSrcweir #include "ViewShell.hxx"
44cdf0e10cSrcweir #include "drawdoc.hxx"
45cdf0e10cSrcweir #include "sdabstdlg.hxx"
46cdf0e10cSrcweir #include "paragr.hrc"
47cdf0e10cSrcweir #include "sdattr.hrc"
48cdf0e10cSrcweir
49cdf0e10cSrcweir namespace sd {
50cdf0e10cSrcweir
51cdf0e10cSrcweir TYPEINIT1( FuParagraph, FuPoor );
52cdf0e10cSrcweir
53cdf0e10cSrcweir /*************************************************************************
54cdf0e10cSrcweir |*
55cdf0e10cSrcweir |* Konstruktor
56cdf0e10cSrcweir |*
57cdf0e10cSrcweir \************************************************************************/
58cdf0e10cSrcweir
FuParagraph(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)59cdf0e10cSrcweir FuParagraph::FuParagraph (
60cdf0e10cSrcweir ViewShell* pViewSh,
61cdf0e10cSrcweir ::sd::Window* pWin,
62cdf0e10cSrcweir ::sd::View* pView,
63cdf0e10cSrcweir SdDrawDocument* pDoc,
64cdf0e10cSrcweir SfxRequest& rReq)
65cdf0e10cSrcweir : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
66cdf0e10cSrcweir {
67cdf0e10cSrcweir }
68cdf0e10cSrcweir
Create(ViewShell * pViewSh,::sd::Window * pWin,::sd::View * pView,SdDrawDocument * pDoc,SfxRequest & rReq)69cdf0e10cSrcweir FunctionReference FuParagraph::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
70cdf0e10cSrcweir {
71cdf0e10cSrcweir FunctionReference xFunc( new FuParagraph( pViewSh, pWin, pView, pDoc, rReq ) );
72cdf0e10cSrcweir xFunc->DoExecute(rReq);
73cdf0e10cSrcweir return xFunc;
74cdf0e10cSrcweir }
75cdf0e10cSrcweir
DoExecute(SfxRequest & rReq)76cdf0e10cSrcweir void FuParagraph::DoExecute( SfxRequest& rReq )
77cdf0e10cSrcweir {
78cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs();
79cdf0e10cSrcweir
80cdf0e10cSrcweir OutlinerView* pOutlView = mpView->GetTextEditOutlinerView();
81cdf0e10cSrcweir ::Outliner* pOutliner = mpView->GetTextEditOutliner();
82cdf0e10cSrcweir
83cdf0e10cSrcweir if( !pArgs )
84cdf0e10cSrcweir {
85cdf0e10cSrcweir SfxItemSet aEditAttr( mpDoc->GetPool() );
86cdf0e10cSrcweir mpView->GetAttributes( aEditAttr );
87cdf0e10cSrcweir SfxItemPool *pPool = aEditAttr.GetPool();
88cdf0e10cSrcweir SfxItemSet aNewAttr( *pPool,
89cdf0e10cSrcweir EE_ITEMS_START, EE_ITEMS_END,
90cdf0e10cSrcweir SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET,
91cdf0e10cSrcweir ATTR_PARANUMBERING_START, ATTR_PARANUMBERING_END,
92cdf0e10cSrcweir 0 );
93cdf0e10cSrcweir
94cdf0e10cSrcweir aNewAttr.Put( aEditAttr );
95cdf0e10cSrcweir
96cdf0e10cSrcweir // linker Rand als Offset
97cdf0e10cSrcweir const long nOff = ( (SvxLRSpaceItem&)aNewAttr.Get( EE_PARA_LRSPACE ) ).GetTxtLeft();
98cdf0e10cSrcweir // Umrechnung, da TabulatorTabPage immer von Twips ausgeht !
99cdf0e10cSrcweir SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
100cdf0e10cSrcweir aNewAttr.Put( aOff );
101cdf0e10cSrcweir
102cdf0e10cSrcweir if( pOutlView && pOutliner )
103cdf0e10cSrcweir {
104cdf0e10cSrcweir ESelection eSelection = pOutlView->GetSelection();
105cdf0e10cSrcweir aNewAttr.Put( SfxInt16Item( ATTR_NUMBER_NEWSTART_AT, pOutliner->GetNumberingStartValue( eSelection.nStartPara ) ) );
106cdf0e10cSrcweir aNewAttr.Put( SfxBoolItem( ATTR_NUMBER_NEWSTART, pOutliner->IsParaIsNumberingRestart( eSelection.nStartPara ) ) );
107cdf0e10cSrcweir }
108cdf0e10cSrcweir
109cdf0e10cSrcweir SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
110cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact ? pFact->CreateSdParagraphTabDlg(NULL, &aNewAttr ) : 0;
111cdf0e10cSrcweir if( pDlg )
112cdf0e10cSrcweir {
113cdf0e10cSrcweir sal_uInt16 nResult = pDlg->Execute();
114cdf0e10cSrcweir
115cdf0e10cSrcweir switch( nResult )
116cdf0e10cSrcweir {
117cdf0e10cSrcweir case RET_OK:
118cdf0e10cSrcweir {
119cdf0e10cSrcweir rReq.Done( *( pDlg->GetOutputItemSet() ) );
120cdf0e10cSrcweir
121cdf0e10cSrcweir pArgs = rReq.GetArgs();
122cdf0e10cSrcweir }
123cdf0e10cSrcweir break;
124cdf0e10cSrcweir
125cdf0e10cSrcweir default:
126cdf0e10cSrcweir {
127cdf0e10cSrcweir delete pDlg;
128cdf0e10cSrcweir }
129cdf0e10cSrcweir return; // Abbruch
130cdf0e10cSrcweir }
131cdf0e10cSrcweir delete( pDlg );
132cdf0e10cSrcweir }
133cdf0e10cSrcweir }
134cdf0e10cSrcweir mpView->SetAttributes( *pArgs );
135cdf0e10cSrcweir
136cdf0e10cSrcweir if( pOutlView && pOutliner )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir ESelection eSelection = pOutlView->GetSelection();
139cdf0e10cSrcweir
140cdf0e10cSrcweir const SfxPoolItem *pItem = 0;
141cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART, sal_False, &pItem ) )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir const sal_Bool bNewStart = ((SfxBoolItem*)pItem)->GetValue() ? sal_True : sal_False;
144cdf0e10cSrcweir pOutliner->SetParaIsNumberingRestart( eSelection.nStartPara, bNewStart );
145cdf0e10cSrcweir }
146cdf0e10cSrcweir
147cdf0e10cSrcweir if( SFX_ITEM_SET == pArgs->GetItemState( ATTR_NUMBER_NEWSTART_AT, sal_False, &pItem ) )
148cdf0e10cSrcweir {
149cdf0e10cSrcweir const sal_Int16 nStartAt = ((SfxInt16Item*)pItem)->GetValue();
150cdf0e10cSrcweir pOutliner->SetNumberingStartValue( eSelection.nStartPara, nStartAt );
151cdf0e10cSrcweir }
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
154cdf0e10cSrcweir // invalidieren der Slots
155cdf0e10cSrcweir static sal_uInt16 SidArray[] = {
156cdf0e10cSrcweir SID_ATTR_TABSTOP,
157*766ce4d0SZheng Fan SID_ATTR_PARA_LINESPACE,
158*766ce4d0SZheng Fan SID_ATTR_PARA_ULSPACE,
159cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_LEFT,
160cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_RIGHT,
161cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_CENTER,
162cdf0e10cSrcweir SID_ATTR_PARA_ADJUST_BLOCK,
163cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE_10,
164cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE_15,
165cdf0e10cSrcweir SID_ATTR_PARA_LINESPACE_20,
166cdf0e10cSrcweir SID_ATTR_PARA_LRSPACE,
167cdf0e10cSrcweir SID_ATTR_PARA_LEFT_TO_RIGHT,
168cdf0e10cSrcweir SID_ATTR_PARA_RIGHT_TO_LEFT,
169cdf0e10cSrcweir SID_RULER_TEXT_RIGHT_TO_LEFT,
170cdf0e10cSrcweir SID_PARASPACE_INCREASE,
171cdf0e10cSrcweir SID_PARASPACE_DECREASE,
172cdf0e10cSrcweir 0 };
173cdf0e10cSrcweir
174cdf0e10cSrcweir mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray );
175cdf0e10cSrcweir }
176cdf0e10cSrcweir
Activate()177cdf0e10cSrcweir void FuParagraph::Activate()
178cdf0e10cSrcweir {
179cdf0e10cSrcweir }
180cdf0e10cSrcweir
Deactivate()181cdf0e10cSrcweir void FuParagraph::Deactivate()
182cdf0e10cSrcweir {
183cdf0e10cSrcweir }
184cdf0e10cSrcweir
185cdf0e10cSrcweir } // end of namespace sd
186