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 30747 : SdrOutliner::SdrOutliner( SfxItemPool* pItemPool, sal_uInt16 nMode )
30 : : Outliner( pItemPool, nMode ),
31 : //mpPaintInfoRec( NULL )
32 30747 : mpVisualizedPage(0)
33 : {
34 30747 : }
35 :
36 :
37 60724 : SdrOutliner::~SdrOutliner()
38 : {
39 60724 : }
40 :
41 :
42 582109 : void SdrOutliner::SetTextObj( const SdrTextObj* pObj )
43 : {
44 582109 : if( pObj && pObj != mpTextObj.get() )
45 : {
46 135107 : SetUpdateMode(false);
47 135107 : sal_uInt16 nOutlinerMode2 = OUTLINERMODE_OUTLINEOBJECT;
48 135107 : if ( !pObj->IsOutlText() )
49 132104 : nOutlinerMode2 = OUTLINERMODE_TEXTOBJECT;
50 135107 : Init( nOutlinerMode2 );
51 :
52 135107 : SetGlobalCharStretching(100,100);
53 :
54 135107 : EEControlBits nStat = GetControlWord();
55 135107 : nStat &= ~EEControlBits( EEControlBits::STRETCHING | EEControlBits::AUTOPAGESIZE );
56 135107 : SetControlWord(nStat);
57 :
58 135107 : Size aNullSize;
59 135107 : Size aMaxSize( 100000,100000 );
60 135107 : SetMinAutoPaperSize( aNullSize );
61 135107 : SetMaxAutoPaperSize( aMaxSize );
62 135107 : SetPaperSize( aMaxSize );
63 135107 : ClearPolygon();
64 : }
65 :
66 582109 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
67 582109 : }
68 :
69 27158 : void SdrOutliner::SetTextObjNoInit( const SdrTextObj* pObj )
70 : {
71 27158 : mpTextObj.reset( const_cast< SdrTextObj* >(pObj) );
72 27158 : }
73 :
74 9122 : OUString SdrOutliner::CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos,
75 : Color*& rpTxtColor, Color*& rpFldColor)
76 : {
77 9122 : bool bOk = false;
78 9122 : OUString aRet;
79 :
80 9122 : if(mpTextObj.is())
81 9012 : bOk = static_cast< SdrTextObj* >( mpTextObj.get())->CalcFieldValue(rField, nPara, nPos, false, rpTxtColor, rpFldColor, aRet);
82 :
83 9122 : if (!bOk)
84 8647 : aRet = Outliner::CalcFieldValue(rField, nPara, nPos, rpTxtColor, rpFldColor);
85 :
86 9122 : return aRet;
87 : }
88 :
89 185997 : const SdrTextObj* SdrOutliner::GetTextObj() const
90 : {
91 185997 : if( mpTextObj.is() )
92 9094 : return static_cast< SdrTextObj* >( mpTextObj.get() );
93 : else
94 176903 : return 0;
95 435 : }
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|