Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "scitems.hxx"
30 : : #include <editeng/eeitem.hxx>
31 : :
32 : : #include <svx/svxdlg.hxx>
33 : : #include <editeng/brkitem.hxx>
34 : : #include <editeng/hyznitem.hxx>
35 : : #include <editeng/orphitem.hxx>
36 : : #include <editeng/outliner.hxx>
37 : : #include <editeng/spltitem.hxx>
38 : : #include <editeng/widwitem.hxx>
39 : : #include <sot/exchange.hxx>
40 : : #include <vcl/msgbox.hxx>
41 : : #include <svtools/transfer.hxx>
42 : :
43 : : #include "sc.hrc"
44 : : #include "drtxtob.hxx"
45 : : #include "drawview.hxx"
46 : : #include "viewdata.hxx"
47 : : #include "scresid.hxx"
48 : :
49 : : #include "scabstdlg.hxx"
50 : : //------------------------------------------------------------------------
51 : :
52 : 0 : sal_Bool ScDrawTextObjectBar::ExecuteCharDlg( const SfxItemSet& rArgs,
53 : : SfxItemSet& rOutSet )
54 : : {
55 : 0 : ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
56 : : OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
57 : :
58 : : SfxAbstractTabDialog* pDlg = pFact->CreateScCharDlg( pViewData->GetDialogParent(), &rArgs,
59 : 0 : pViewData->GetSfxDocShell(),RID_SCDLG_CHAR );
60 : : OSL_ENSURE(pDlg, "Dialog create fail!");
61 : 0 : sal_Bool bRet = ( pDlg->Execute() == RET_OK );
62 : :
63 [ # # ]: 0 : if ( bRet )
64 : : {
65 : 0 : const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
66 [ # # ]: 0 : if ( pNewAttrs )
67 : 0 : rOutSet.Put( *pNewAttrs );
68 : : }
69 [ # # ]: 0 : delete pDlg;
70 : :
71 : 0 : return bRet;
72 : : }
73 : :
74 : 0 : sal_Bool ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
75 : : SfxItemSet& rOutSet )
76 : : {
77 : 0 : SfxItemPool* pArgPool = rArgs.GetPool();
78 : : SfxItemSet aNewAttr( *pArgPool,
79 : : EE_ITEMS_START, EE_ITEMS_END,
80 : : SID_ATTR_PARA_HYPHENZONE, SID_ATTR_PARA_HYPHENZONE,
81 : : SID_ATTR_PARA_PAGEBREAK, SID_ATTR_PARA_PAGEBREAK,
82 : : SID_ATTR_PARA_SPLIT, SID_ATTR_PARA_SPLIT,
83 : : SID_ATTR_PARA_WIDOWS, SID_ATTR_PARA_WIDOWS,
84 : : SID_ATTR_PARA_ORPHANS, SID_ATTR_PARA_ORPHANS,
85 [ # # ]: 0 : 0 );
86 [ # # ]: 0 : aNewAttr.Put( rArgs );
87 : :
88 : : // Die Werte sind erst einmal uebernommen worden, um den Dialog anzuzeigen.
89 : : // Muss natuerlich noch geaendert werden
90 : : // aNewAttr.Put( SvxParaDlgLimitsItem( 567 * 50, 5670) );
91 : :
92 [ # # ][ # # ]: 0 : aNewAttr.Put( SvxHyphenZoneItem( false, SID_ATTR_PARA_HYPHENZONE ) );
[ # # ]
93 [ # # ][ # # ]: 0 : aNewAttr.Put( SvxFmtBreakItem( SVX_BREAK_NONE, SID_ATTR_PARA_PAGEBREAK ) );
[ # # ]
94 [ # # ][ # # ]: 0 : aNewAttr.Put( SvxFmtSplitItem( sal_True, SID_ATTR_PARA_SPLIT) );
[ # # ]
95 [ # # ][ # # ]: 0 : aNewAttr.Put( SvxWidowsItem( 0, SID_ATTR_PARA_WIDOWS) );
[ # # ]
96 [ # # ][ # # ]: 0 : aNewAttr.Put( SvxOrphansItem( 0, SID_ATTR_PARA_ORPHANS) );
[ # # ]
97 : :
98 [ # # ]: 0 : ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
99 : : OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
100 : :
101 [ # # ][ # # ]: 0 : SfxAbstractTabDialog* pDlg = pFact->CreateScParagraphDlg( pViewData->GetDialogParent(), &aNewAttr, RID_SCDLG_PARAGRAPH);
102 : : OSL_ENSURE(pDlg, "Dialog create fail!");
103 [ # # ]: 0 : sal_Bool bRet = ( pDlg->Execute() == RET_OK );
104 : :
105 [ # # ]: 0 : if ( bRet )
106 : : {
107 [ # # ]: 0 : const SfxItemSet* pNewAttrs = pDlg->GetOutputItemSet();
108 [ # # ]: 0 : if ( pNewAttrs )
109 [ # # ]: 0 : rOutSet.Put( *pNewAttrs );
110 : : }
111 [ # # ][ # # ]: 0 : delete pDlg;
112 : :
113 [ # # ]: 0 : return bRet;
114 : : }
115 : :
116 : 0 : void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest & /* rReq */ )
117 : : {
118 [ # # ]: 0 : SdrView* pView = pViewData->GetScDrawView();
119 : 0 : OutlinerView* pOutView = pView->GetTextEditOutlinerView();
120 [ # # ]: 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
121 [ # # ][ # # ]: 0 : SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() );
122 : :
123 [ # # ][ # # ]: 0 : pDlg->Insert( SOT_FORMAT_STRING, EMPTY_STRING );
124 [ # # ][ # # ]: 0 : pDlg->Insert( SOT_FORMAT_RTF, EMPTY_STRING );
125 : :
126 [ # # ][ # # ]: 0 : TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( pViewData->GetActiveWin() ) );
127 : :
128 [ # # ][ # # ]: 0 : sal_uLong nFormat = pDlg->GetFormat( aDataHelper.GetTransferable() );
[ # # ]
129 : :
130 : : //! test if outliner view is still valid
131 : :
132 [ # # ]: 0 : if (nFormat > 0)
133 : : {
134 [ # # ]: 0 : if (nFormat == SOT_FORMAT_STRING)
135 [ # # ]: 0 : pOutView->Paste();
136 : : else
137 [ # # ]: 0 : pOutView->PasteSpecial();
138 : : }
139 [ # # ][ # # ]: 0 : delete pDlg;
[ # # ]
140 : 0 : }
141 : :
142 : :
143 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|