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 <svx/svdoutl.hxx>
21 : #include <editeng/outliner.hxx>
22 : #include <svx/svdotext.hxx>
23 : #include <editeng/editstat.hxx>
24 : #include <svx/svdmodel.hxx>
25 : #include <editeng/eeitem.hxx>
26 : #include <svl/itempool.hxx>
27 :
28 :
29 33992 : SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
30 : : Outliner( pItemPool, nMode ),
31 : //mpPaintInfoRec( NULL )
32 33992 : mpVisualizedPage(0)
33 : {
34 33992 : }
35 :
36 :
37 66890 : SdrOutliner::~SdrOutliner()
38 : {
39 66890 : }
40 :
41 :
42 495318 : void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
43 : {
44 495318 : if( pObj && pObj != mpTextObj.get() )
45 : {
46 97180 : SetUpdateMode(false);
47 97180 : sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
48 97180 : if ( !pObj->IsOutlText() )
49 94138 : nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
50 97180 : Init( nOutlinerMode2 );
51 :
52 97180 : SetGlobalCharStretching(100,100);
53 :
54 97180 : sal_uIntPtr nStat = GetControlWord();
55 97180 : nStat &= ~( EE_CNTRL_STRETCHING | EE_CNTRL_AUTOPAGESIZE );
56 97180 : SetControlWord(nStat);
57 :
58 97180 : Size aNullSize;
59 97180 : Size aMaxSize( 100000,100000 );
60 97180 : SetMinAutoPaperSize( aNullSize );
61 97180 : SetMaxAutoPaperSize( aMaxSize );
62 97180 : SetPaperSize( aMaxSize );
63 97180 : ClearPolygon();
64 : }
65 :
66 495318 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
67 495318 : }
68 :
69 21575 : void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
70 : {
71 21575 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
72 21575 : }
73 :
74 9475 : OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
75 : Color*& rpTxtColor, Color*& rpFldColor)
76 : {
77 9475 : bool bOk = false;
78 9475 : OUString aRet;
79 :
80 9475 : if(mpTextObj.is())
81 9473 : bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
82 :
83 9475 : if (!bOk)
84 9307 : aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
85 :
86 9475 : return aRet;
87 : }
88 :
89 160413 : const SdrTextObj* SdrOutliner::GetTextObj() const
90 : {
91 160413 : if( mpTextObj.is() )
92 10267 : return static_cast< SdrTextObj* >( mpTextObj.get() );
93 : else
94 150146 : return 0;
95 651 : }
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|