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 <svx/svdoutl.hxx>
30 : : #include <editeng/outliner.hxx>
31 : : #include <svx/svdotext.hxx>
32 : : #include <editeng/editstat.hxx>
33 : : #include <svx/svdmodel.hxx>
34 : : #include <editeng/eeitem.hxx>
35 : : #include <svl/itempool.hxx>
36 : :
37 : : DBG_NAME(SdrOutliner)
38 : :
39 : 23163 : SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
40 : : : Outliner( pItemPool, nMode ),
41 : : //mpPaintInfoRec( NULL )
42 [ + - ]: 23163 : mpVisualizedPage(0)
43 : : {
44 : : DBG_CTOR(SdrOutliner,NULL);
45 : 23163 : }
46 : :
47 : :
48 [ + - ]: 22941 : SdrOutliner::~SdrOutliner()
49 : : {
50 : : DBG_DTOR(SdrOutliner,NULL);
51 [ - + ]: 45731 : }
52 : :
53 : :
54 : 562090 : void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
55 : : {
56 [ + + ][ + + ]: 562090 : if( pObj && pObj != mpTextObj.get() )
[ + + ]
57 : : {
58 [ + - ]: 123284 : SetUpdateMode(sal_False);
59 : 123284 : sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
60 [ + + ]: 123284 : if ( !pObj->IsOutlText() )
61 : 122516 : nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
62 [ + - ]: 123284 : Init( nOutlinerMode2 );
63 : :
64 [ + - ]: 123284 : SetGlobalCharStretching(100,100);
65 : :
66 [ + - ]: 123284 : sal_uIntPtr nStat = GetControlWord();
67 : 123284 : nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
68 [ + - ]: 123284 : SetControlWord(nStat);
69 : :
70 : 123284 : Size aNullSize;
71 : 123284 : Size aMaxSize( 100000,100000 );
72 [ + - ]: 123284 : SetMinAutoPaperSize( aNullSize );
73 [ + - ]: 123284 : SetMaxAutoPaperSize( aMaxSize );
74 [ + - ]: 123284 : SetPaperSize( aMaxSize );
75 [ + - ]: 123284 : ClearPolygon();
76 : : }
77 : :
78 : 562090 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
79 : 562090 : }
80 : :
81 : 23101 : void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
82 : : {
83 : 23101 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
84 : 23101 : }
85 : :
86 : 2503 : XubString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos,
87 : : Color*& rpTxtColor, Color*& rpFldColor)
88 : : {
89 : 2503 : bool bOk = false;
90 : 2503 : XubString aRet;
91 : :
92 [ + + ]: 2503 : if(mpTextObj.is())
93 [ + - ]: 2471 : bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, sal_False, rpTxtColor, rpFldColor, aRet);
94 : :
95 [ + - ]: 2503 : if (!bOk)
96 [ + - ][ + - ]: 2503 : aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
[ + - ]
97 : :
98 : 2503 : return aRet;
99 : : }
100 : :
101 : 114870 : const SdrTextObj* SdrOutliner::GetTextObj() const
102 : : {
103 [ + + ]: 114870 : if( mpTextObj.is() )
104 : 3089 : return static_cast< SdrTextObj* >( mpTextObj.get() );
105 : : else
106 : 114870 : return 0;
107 : : }
108 : :
109 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|